René's URL Explorer Experiment


Title: feat: ns:util builtin module (inspect, format) by edusperoni · Pull Request #1992 · NativeScript/android · GitHub

Open Graph Title: feat: ns:util builtin module (inspect, format) by edusperoni · Pull Request #1992 · NativeScript/android

X Title: feat: ns:util builtin module (inspect, format) by edusperoni · Pull Request #1992 · NativeScript/android

Description: Description Android mirror of NativeScript/ios#418. Stacked on #1991 (feat/inspect) — review only the last commit. Runtime-provided modules get a resolution scheme. require("ns:util"), import util, { inspect } from "ns:util" and await import("ns:util") all resolve to the same per-realm module, and console.* gains Node's %-substitution. docs/ns-builtin-modules.md (added here, same document as the iOS PR) is the cross-runtime contract both runtimes implement, with a non-normative Android section. v1 exports — ns:util: inspect(value[, options]) (the console formatter from the inspect PR, same instance) and format(fmt, ...args) (Node's %s %d %i %f %j %o %O %%). Resolution rules ns:/node: specifiers are intercepted before any filesystem or npm resolution in all three entry points: the CommonJS require path (ModuleInternal::RequireCallbackImpl), the ES module resolve callback, and the dynamic-import host callback (ModuleInternalCallbacks.cpp). A builtin can never be shadowed by a file or a package. ESM is served by v8::Module::CreateSyntheticModule, exporting every member by name plus default; instantiated, evaluated and cached per realm. Unknown names fail with exactly No such built-in module: — synchronously for require, as a rejection for import(). Builtins are singletons per realm: the main context and every worker build their own exports object. Android has no Caches class, so per-realm caches are isolate-keyed maps released on isolate disposal; the process-global g_moduleRegistry deliberately holds none of this state. Bare specifiers are untouched: require("util") still resolves through npm exactly as before (there is a test asserting it does not return the builtin). Exports are frozen. The internal require (new wrapper parameter) — the builtin wrapper becomes (exports, require, module, binding, primordials), Node's order. That require is created once per realm and resolves builtin specifiers only — no path, no package, no filesystem — with an in-progress guard so cycles throw instead of recursing. It's how node:util (node-util.js, its own lazy builtin) consumes ns:util and re-exports: all Node-compat adaptation lives in the shim, ns-util.js carries none, and the two module objects are distinct and separately frozen (nodeUtil.inspect === nsUtil.inspect, objects differ). console integration — the arg-joining routine calls the cached format with the full argument list, so console.log("%d apples", 3) prints 3 apples while console.log("100%"), unknown specifiers and a dangling % stay verbatim. Non-format calls keep joining with spaces; if the builtin is unavailable the old per-argument loop still runs, so logging can never be taken down by the formatter. ⚠️ Behavior changes (aligning the pre-existing ESM node: polyfills with the contract): The generic fallback for unshimmed node: imports (console.warn + export default {}, which broke at first use) is removed — they now fail with No such built-in module: node:. The node:fs stub whose every member threw on use is removed for the same reason (the contract requires missing members to be absent, never present-but-throwing) — node:fs now fails with the not-found message. The functional node:url (fileURLToPath/pathToFileURL), node:module (createRequire) and node:path polyfills are kept unchanged, import-only — require("node:path") reports not-found while import works, mirroring iOS's pre-registry node:url asymmetry. Documented in the doc's Android non-normative section. Related Pull Requests NativeScript/ios#418 (iOS counterpart; the contract doc is shared verbatim) #1991 (base) Does your pull request have unit tests? Yes — 21 new device specs (tests/testNsUtil.js + a static-import .mjs fixture covering the resolve callback, + a worker spec asserting a worker builds its own ns:util instance): frozen exports, require/static/dynamic-import singleton identity, every format specifier incl. %%/unknown/dangling %/%j on a circular value/extras/non-string first arg, node:util distinctness with shared members, exact unknown-ns:/node: messages in both schemes, and the bare-util non-change. Full suite: 648 specs, 0 failures (627 baseline + 21). Summary by CodeRabbit New Features Added built-in ns:util support with frozen inspect and format APIs. Added node:util compatibility support for inspect and format. Built-ins now work with CommonJS, static imports, and dynamic imports. Console output supports Node-style formatting and improved value inspection. Built-in modules are isolated per runtime realm and worker. Bug Fixes Unknown or unsupported built-ins now produce consistent not-found errors. Improved formatting for circular values, symbols, bigints, and JSON failures. Documentation Documented built-in module behavior, supported APIs, resolution rules, and limitations.

Open Graph Description: Description Android mirror of NativeScript/ios#418. Stacked on #1991 (feat/inspect) — review only the last commit. Runtime-provided modules get a resolution scheme. require("ns:util"), im...

X Description: Description Android mirror of NativeScript/ios#418. Stacked on #1991 (feat/inspect) — review only the last commit. Runtime-provided modules get a resolution scheme. require("ns:util&qu...

Opengraph URL: https://github.com/NativeScript/android/pull/1992

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:4c91413f-7795-119b-0500-cacd29af6f0e
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idACFC:20AA01:1CBE700:2483641:6B0144FB
html-safe-noncef6f307b2ca267fb8c954d8bf0972aa93ca8eb4cc13221926b2fb6f5af59ce7f1
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQ0ZDOjIwQUEwMToxQ0JFNzAwOjI0ODM2NDE6NkIwMTQ0RkIiLCJ2aXNpdG9yX2lkIjoiNjcwNDkyODc1ODE2OTY4MzE5NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacb205cf181983e04ebc74bbf7d02e9f61dfb24e5a249a0aa27e517dd0920b383f
hovercard-subject-tagpull_request:4172675257
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/NativeScript/android/pull/1992/files
twitter:imagehttps://avatars.githubusercontent.com/u/4061767?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/4061767?s=400&v=4
og:image:altDescription Android mirror of NativeScript/ios#418. Stacked on #1991 (feat/inspect) — review only the last commit. Runtime-provided modules get a resolution scheme. require("ns:util"), im...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/NativeScript/android git https://github.com/NativeScript/android.git
octolytics-dimension-user_id7392261
octolytics-dimension-user_loginNativeScript
octolytics-dimension-repository_id29137950
octolytics-dimension-repository_nwoNativeScript/android
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id29137950
octolytics-dimension-repository_network_root_nwoNativeScript/android
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/NativeScript/android/pull/1992/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2Fandroid%2Fpull%2F1992%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2Fandroid%2Fpull%2F1992%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=NativeScript%2Fandroid
Reloadhttps://github.com/NativeScript/android/pull/1992/files
Reloadhttps://github.com/NativeScript/android/pull/1992/files
Reloadhttps://github.com/NativeScript/android/pull/1992/files
NativeScripthttps://github.com/NativeScript
androidhttps://github.com/NativeScript/android
Codehttps://github.com/NativeScript/android
Issues106 (106)https://github.com/NativeScript/android/issues
Pull requests24 (24)https://github.com/NativeScript/android/pulls
Actionshttps://github.com/NativeScript/android/actions
Projectshttps://github.com/NativeScript/android/projects
Wikihttps://github.com/NativeScript/android/wiki
Security and qualityhttps://github.com/NativeScript/android/security
Insightshttps://github.com/NativeScript/android/insights
Sign up for GitHub https://github.com/signup?return_to=%2FNativeScript%2Fandroid%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FNativeScript%2Fandroid%2Fissues%2Fnew%2Fchoose
edusperonihttps://github.com/edusperoni
mainhttps://github.com/NativeScript/android/tree/main
feat/ns-utilhttps://github.com/NativeScript/android/tree/feat/ns-util
Conversation 3 https://github.com/NativeScript/android/pull/1992
Commits 1 https://github.com/NativeScript/android/pull/1992/commits
Checks 7 https://github.com/NativeScript/android/pull/1992/checks
Files changed https://github.com/NativeScript/android/pull/1992/files
Please reload this pagehttps://github.com/NativeScript/android/pull/1992/files
feat: ns:util builtin module (inspect, format) https://github.com/NativeScript/android/pull/1992/files#top
Show all changes 1 commit https://github.com/NativeScript/android/pull/1992/files
0feae8a feat: ns:util builtin module (inspect, format) edusperoni Jul 30, 2026 https://github.com/NativeScript/android/pull/1992/commits/0feae8af7809d6f471c8db6975a522ac83344ca7
Clear filters https://github.com/NativeScript/android/pull/1992/files
Please reload this pagehttps://github.com/NativeScript/android/pull/1992/files
Please reload this pagehttps://github.com/NativeScript/android/pull/1992/files
ns-builtin-modules.md https://github.com/NativeScript/android/pull/1992/files#diff-f49fa83084691682143a83515d6be04f599ea5d1cc41aa8e262d0daf53ebc63d
eslint.config.mjs https://github.com/NativeScript/android/pull/1992/files#diff-9601a8f6c734c2001be34a2361f76946d19a39a709b5e8c624a2a5a0aade05f2
mainpage.js https://github.com/NativeScript/android/pull/1992/files#diff-b7fd6c22bfc29391e9e3ed935d6c6194b1ad595c7592690229952b5ddb99c0d5
testNsUtilImport.mjs https://github.com/NativeScript/android/pull/1992/files#diff-f97c5ebbf5dcfb62e72e95102e33fddeeb5bebf05910fb51b89170de5faab7d5
nsUtilWorker.js https://github.com/NativeScript/android/pull/1992/files#diff-933849842f1ed155cba2152b9307808cb02ba5c176a5b18ce969e3ef2a586211
testNsUtil.js https://github.com/NativeScript/android/pull/1992/files#diff-4a178c324811a85088d1402dc1d505976fe6ff1d6c1b54ba0e4243c6f5b037c4
CMakeLists.txt https://github.com/NativeScript/android/pull/1992/files#diff-9aa48152a82c07a60ab6e09923a9b266e2985f78e579653848df730cd8ec5e4c
BuiltinLoader.cpp https://github.com/NativeScript/android/pull/1992/files#diff-fcedb819fe4f3f0f0406fa6f3ad2e6b725f6f39d83737af64486c91ba96fdffa
BuiltinLoader.h https://github.com/NativeScript/android/pull/1992/files#diff-80ceda457b8ed4e5fc6f0d5a7cb59538fb88ffd8b9787e6f91c8f6be728c05d8
IsolateDisposer.cpp https://github.com/NativeScript/android/pull/1992/files#diff-665bfa196480c5d77dc1764a434d06ae4c4c5e1b107dc9efce1452692ceb6894
ModuleInternal.cpp https://github.com/NativeScript/android/pull/1992/files#diff-8fb647a9437c57deb39dc2079f0cdfc94a75fafef82b46766fd7d1d276af246e
ModuleInternalCallbacks.cpp https://github.com/NativeScript/android/pull/1992/files#diff-a29f30988e4bc02de7c519f256ce882ac70847698e04f4bfb078f7be28c3271e
NsBuiltinModules.cpp https://github.com/NativeScript/android/pull/1992/files#diff-d82c13136f989e9986f3b6974e589fe807eb1d97c6a75bb5f20a6b70a7d98c0f
NsBuiltinModules.h https://github.com/NativeScript/android/pull/1992/files#diff-72a63b5c9b1756fdef3888f5480cafc03c7c30006840c8de8f12699edcdb13a8
Console.cpp https://github.com/NativeScript/android/pull/1992/files#diff-e809a7c5f84aa5b41d82cb99d07062a5644f7cb64a3b702069a145e4a2bdf190
Console.h https://github.com/NativeScript/android/pull/1992/files#diff-c477d5f2a39498881e035ea8f7dd84c0b8df0fe51284b56f3f74677e9ae680b6
README.md https://github.com/NativeScript/android/pull/1992/files#diff-751334ceaf7705bb581ba52ea1f45b471007312e7194253725e94c12eb8f22fe
node-util.js https://github.com/NativeScript/android/pull/1992/files#diff-505c2057c390808c18defe6f24d19aa5cc7cd8a346916efa79511129d591be1a
ns-util.js https://github.com/NativeScript/android/pull/1992/files#diff-375583c1ab3a065040e04a8f79eaa62026e847be6a748b6b899e8b7b2f6b3585
primordials.js https://github.com/NativeScript/android/pull/1992/files#diff-9b1f22214698543a37f4ef99bb7a3c87aa30de65ecd042dd7b9eec18501914fc
js2c.mjs https://github.com/NativeScript/android/pull/1992/files#diff-89c6c38f8703605ded23d4d526e0b56521ffaa1f1ef6811310d4d62d47f6ff1c
docs/ns-builtin-modules.mdhttps://github.com/NativeScript/android/pull/1992/files#diff-f49fa83084691682143a83515d6be04f599ea5d1cc41aa8e262d0daf53ebc63d
View file https://github.com/NativeScript/android/blob/0feae8af7809d6f471c8db6975a522ac83344ca7/docs/ns-builtin-modules.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/android/pull/1992/{{ revealButtonHref }}
eslint.config.mjshttps://github.com/NativeScript/android/pull/1992/files#diff-9601a8f6c734c2001be34a2361f76946d19a39a709b5e8c624a2a5a0aade05f2
View file https://github.com/NativeScript/android/blob/0feae8af7809d6f471c8db6975a522ac83344ca7/eslint.config.mjs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/android/pull/1992/{{ revealButtonHref }}
https://github.com/NativeScript/android/pull/1992/files#diff-9601a8f6c734c2001be34a2361f76946d19a39a709b5e8c624a2a5a0aade05f2
https://github.com/NativeScript/android/pull/1992/files#diff-9601a8f6c734c2001be34a2361f76946d19a39a709b5e8c624a2a5a0aade05f2
https://github.com/NativeScript/android/pull/1992/files#diff-9601a8f6c734c2001be34a2361f76946d19a39a709b5e8c624a2a5a0aade05f2
https://github.com/NativeScript/android/pull/1992/files#diff-9601a8f6c734c2001be34a2361f76946d19a39a709b5e8c624a2a5a0aade05f2
test-app/app/src/main/assets/app/mainpage.jshttps://github.com/NativeScript/android/pull/1992/files#diff-b7fd6c22bfc29391e9e3ed935d6c6194b1ad595c7592690229952b5ddb99c0d5
View file https://github.com/NativeScript/android/blob/0feae8af7809d6f471c8db6975a522ac83344ca7/test-app/app/src/main/assets/app/mainpage.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/android/pull/1992/{{ revealButtonHref }}
https://github.com/NativeScript/android/pull/1992/files#diff-b7fd6c22bfc29391e9e3ed935d6c6194b1ad595c7592690229952b5ddb99c0d5
test-app/app/src/main/assets/app/testNsUtilImport.mjshttps://github.com/NativeScript/android/pull/1992/files#diff-f97c5ebbf5dcfb62e72e95102e33fddeeb5bebf05910fb51b89170de5faab7d5
View file https://github.com/NativeScript/android/blob/0feae8af7809d6f471c8db6975a522ac83344ca7/test-app/app/src/main/assets/app/testNsUtilImport.mjs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/android/pull/1992/{{ revealButtonHref }}
test-app/app/src/main/assets/app/tests/nsUtilWorker.jshttps://github.com/NativeScript/android/pull/1992/files#diff-933849842f1ed155cba2152b9307808cb02ba5c176a5b18ce969e3ef2a586211
View file https://github.com/NativeScript/android/blob/0feae8af7809d6f471c8db6975a522ac83344ca7/test-app/app/src/main/assets/app/tests/nsUtilWorker.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/android/pull/1992/{{ revealButtonHref }}
Please reload this pagehttps://github.com/NativeScript/android/pull/1992/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.