-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
module: fix sync resolve hooks for require with node: prefixes #61088
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Previously, when require()-ing builtins with the node: prefix, the sync resolve hooks were not properly invoked, and load hooks could not override the builtin's format. This fixes the handling and enables redirecting prefixed built-ins to on-disk files and overriding them with other module types via hooks.
|
Review requested:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #61088 +/- ##
=======================================
Coverage 88.53% 88.53%
=======================================
Files 703 703
Lines 208546 208590 +44
Branches 40217 40228 +11
=======================================
+ Hits 184634 184675 +41
+ Misses 15926 15915 -11
- Partials 7986 8000 +14
🚀 New features to boost your workflow:
|
|
i'm confused; i thought the prefix was meant to prevent any kind of user intervention in accessing the core module, with require.extensions OR loaders - does this PR change that? |
|
|
wow, ok, that's unfortunate - that was one of the primary justifications for adding the prefix in the first place, the performance and reliability benefit of not being able to intercept it. |
|
Addressed the comments and fixed the linter complaint. PTAL, thanks! @aduh95 |
Failed to start CI⚠ No approving reviews found ✘ Refusing to run CI on potentially unsafe PRhttps://github.com/nodejs/node/actions/runs/20415476248 |
Commit Queue failed- Loading data for nodejs/node/pull/61088 ✔ Done loading data for nodejs/node/pull/61088 ----------------------------------- PR info ------------------------------------ Title module: fix sync resolve hooks for require with node: prefixes (#61088) Author Joyee Cheung <joyeec9h3@gmail.com> (@joyeecheung) Branch joyeecheung:fix-node-hooks -> nodejs:main Labels module, author ready, needs-ci Commits 2 - module: fix sync resolve hooks for require with node: prefixes - fixup! module: fix sync resolve hooks for require with node: prefixes Committers 1 - Joyee Cheung <joyeec9h3@gmail.com> PR-URL: https://github.com/nodejs/node/pull/61088 Fixes: https://github.com/nodejs/node/issues/60005 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/61088 Fixes: https://github.com/nodejs/node/issues/60005 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> -------------------------------------------------------------------------------- ℹ This PR was created on Tue, 16 Dec 2025 14:48:51 GMT ✔ Approvals: 1 ✔ - Antoine du Hamel (@aduh95) (TSC): https://github.com/nodejs/node/pull/61088#pullrequestreview-3602021967 ✘ This PR needs to wait 37 more hours to land (or 0 minutes if there is one more approval) ✔ Last GitHub CI successful ℹ Last Full PR CI on 2025-12-21T22:09:15Z: https://ci.nodejs.org/job/node-test-pull-request/70575/ - Querying data for job/node-test-pull-request/70575/ ✔ Build data downloaded ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/20419381566 |
|
Landed in 28f468a |
Previously, when require()-ing builtins with the node: prefix, the sync resolve hooks were not properly invoked, and load hooks could not override the builtin's format. This fixes the handling and enables redirecting prefixed built-ins to on-disk files and overriding them with other module types via hooks.
Fixes: #60005