GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — module: remove async module customization hooks by GeoffreyBooth · Pull Request #67090 · nodejs/node Conversation
|
|
Review requested:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
a98403b to
95c14fc
Compare
Sorry, something went wrong.
There was an error while loading. Please reload this page.
6cea4a9 to
355da9b
Compare
Sorry, something went wrong.
There was an error while loading. Please reload this page.
355da9b to
aab37fe
Compare
Sorry, something went wrong.
There was an error while loading. Please reload this page.
aab37fe to
ada3473
Compare
ada3473 to
937a866
Compare
Sorry, something went wrong.
There was an error while loading. Please reload this page.
937a866 to
a825144
Compare
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@ ## main #67090 +/- ## ========================================== - Coverage 90.70% 90.67% -0.04% ========================================== Files 801 798 -3 Lines 281881 279829 -2052 Branches 54315 54018 -297 ========================================== - Hits 255675 253725 -1950 + Misses 16353 16238 -115 - Partials 9853 9866 +13
🚀 New features to boost your workflow:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
since it's simplify loading phase, it's there are an positive impact in term of perf ? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I think this should be treated as semver major due to the large impact |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I ran Node’s
So there’s no regression, and at most a small gain in the import path, because loading no longer has to check for async hooks. The larger win is for hook users. In a separate hyperfine run, a script using benchmark results (
|
| Scenario | Before | After |
|---|---|---|
node -e 0 |
99.1 ± 5.0 ms | 99.0 ± 5.7 ms |
| ESM entry (three modules) | 107.1 ± 7.7 ms | 105.6 ± 5.6 ms |
| CJS entry | 104.8 ± 4.3 ms | 103.1 ± 4.6 ms |
The removal mainly benefits hook users. A script using module.register() async hooks took about 141 ms, versus about 107 ms with the equivalent registerHooks() (about 24% faster). That gain comes from the sync API, which is already on main.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@marco-ippolito I’m happy for this to land only in the 27 line with I’d still argue it isn’t semver-major in the policy sense, because
We also went well beyond what an experimental API requires. After the discussion in #62395 (e.g. “experimental status is already a warning”, and the concerns about existing adoption), we shipped a docs-only deprecation in v25.9.0/v24.15.0 (#62395) and a runtime deprecation in v26.0.0 (#62401). Users have had a full major of runtime warnings, and the plan to remove in 27 has been on record since #62401. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Yes that works for me |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGMT !
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Landed in cb05e4d |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
The
notable-change
Please suggest a text for the release notes if you'd like to include a more detailed summary, then proceed to update the PR description with the text or a link to the notable change suggested text comment. Otherwise, the commit will be placed in the Other Notable Changes section. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I should've added |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Node removed module.register() and --experimental-loader/--loader for 28 (nodejs/node#67090). Nub never injects either flag. Refs #1126
Node 28 removed module.register() (nodejs/node#67090). Under --no-experimental-require-module the preload cannot load its transform core synchronously, so it fell back to a module.register() loader worker, and on Node 28 that crashed every process at startup with "module_.register is not a function". The CLI preload and the standalone runner's --require entry now print one line saying the hooks are off and let Node run the program, with its own type stripping still covering erasable TypeScript. Refs #1126
Remove `module.register()` (DEP0205), the `--experimental-loader` and `--loader` flags, and the machinery that supported them: the loader hooks worker thread, the hooks proxy, the async module customization hook chains for resolving and loading, the internal worker class used to run the loader thread, and the asynchronous module job linking. Module customization is now provided only by `module.registerHooks()`, which runs synchronously on the thread that loads the modules. As the loader thread no longer exists, the ES module loader always loads and links modules synchronously, so the code that handled promises and the re-invented `require()` for imported CommonJS customized by the async module customization hooks is removed too. `import()` still defers evaluation of the module to a later microtask, as before. `worker_threads.isInternalThread` is kept for compatibility and is now always `false`; removing it is left for a future semver-major change. The `ERR_ASYNC_LOADER_REQUEST_NEVER_SETTLED` and `ERR_LOADER_CHAIN_INCOMPLETE` error codes are no longer used and are documented as removed. Tests that exist only to exercise the async module customization hooks are removed. Assisted-by: Claude Signed-off-by: Geoffrey Booth <[email protected]> PR-URL: #67090 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Ilyas Shabi <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jacob Smith <[email protected]>
Notable changes: doc: * swap `util.TextDecoder` and `util.TextEncoder` with globals (LiviaMedeiros) #67461 * use global `TextDecoder` and `TextEncoder` instead of `util` (LiviaMedeiros) #67461 * deprecate `util.TextDecoder` and `util.TextEncoder` (LiviaMedeiros) #67461 http2: * (SEMVER-MINOR) add missing setHeaders (jakecastelli) #67597 * (SEMVER-MINOR) add callback to informational header methods (Yuya Inoue) #67470 lib: * (SEMVER-MINOR) graduate the --process-timeout option (James M Snell) #67506 module: * remove async module customization hooks (Geoffrey Booth) #67090 os: * (SEMVER-MINOR) expose `guessFileDescriptorType` (Vlad Frangu) #58060 sqlite: * mark as stable (Christian Aurich Zanettini Martins) #67654 src: * (SEMVER-MINOR) restore tty state on exit only if changed (Matteo Collina) #66753 test: * update Intl tests for CLDR 49 (Renegade334) #66992 * remove unnecessary imports for `TextDecoder` and `TextEncoder` (LiviaMedeiros) #67461 tls: * (SEMVER-MINOR) docs-deprecate TLS renegotiation, add allowRenegotiation opt-in (Tim Perry) #67532 PR-URL: #67757
Notable changes: doc: * deprecate `util.TextDecoder` and `util.TextEncoder` (LiviaMedeiros) #67461 http2: * (SEMVER-MINOR) add missing setHeaders (jakecastelli) #67597 * (SEMVER-MINOR) add callback to informational header methods (Yuya Inoue) #67470 lib: * (SEMVER-MINOR) graduate the `--process-timeout` option (James M Snell) #67506 module: * remove async module customization hooks (Geoffrey Booth) #67090 os: * (SEMVER-MINOR) expose `guessFileDescriptorType` (Vlad Frangu) #58060 sqlite: * mark as stable (Christian Aurich Zanettini Martins) #67654 src: * (SEMVER-MINOR) restore tty state on exit only if changed (Matteo Collina) #66753 tls: * (SEMVER-MINOR) docs-deprecate TLS renegotiation, add allowRenegotiation opt-in (Tim Perry) #67532 PR-URL: #67757
It doesn't matter what its status was before it was deprecated; now that it's deprecated, removing it is semver-major |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
In practical terms, I assume this makes no difference for this particular PR? It goes out in 27 either way, right? Separately, I don't follow the logic that because something became deprecated its removal therefore becomes semver-major. That would seem to mean that deprecated status is equivalent to being stable, which makes no sense. Deprecated is a lower status than experimental, and the removal of a deprecated feature should be just as permissible. To argue otherwise would discourage people from deprecating experimental features; if deprecating something makes it harder to remove, then people will try to simply remove things from experimental directly and skip the deprecation step. Our users are better served by getting as much warning as possible, which is what the deprecation step provides. We shouldn't make deprecation a barrier to removal. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
When module.register() hooks are registered, they run in the default step of the module.registerHooks() resolve chain, but reaching that step was only tracked when there were no asynchronous hooks. Imported CommonJS resolved by a synchronous hook that calls nextResolve() was then treated as short-circuited, and the format from the hooks made the CommonJS loader bypass require.extensions. Track reaching the default step in both cases. This only applies to release lines that still have module.register(), which has been removed from main. Fixes: nodejs#66998 Refs: nodejs#62920 Refs: nodejs#67090 Signed-off-by: Sebastian Danielsson <[email protected]> Assisted-by: Claude Code
When module.register() hooks are registered, they run in the default step of the module.registerHooks() resolve chain, but reaching that step was only tracked when there were no asynchronous hooks. Imported CommonJS resolved by a synchronous hook that calls nextResolve() was then treated as short-circuited, and the format from the hooks made the CommonJS loader bypass require.extensions. Track reaching the default step in both cases. This only applies to release lines that still have module.register(), which has been removed from main. Fixes: nodejs#66998 Refs: nodejs#62920 Refs: nodejs#67090 Signed-off-by: Sebastian Danielsson <[email protected]> Assisted-by: Claude Code
Remove `module.register()` (DEP0205), the `--experimental-loader` and `--loader` flags, and the machinery that supported them: the loader hooks worker thread, the hooks proxy, the async module customization hook chains for resolving and loading, the internal worker class used to run the loader thread, and the asynchronous module job linking. Module customization is now provided only by `module.registerHooks()`, which runs synchronously on the thread that loads the modules. As the loader thread no longer exists, the ES module loader always loads and links modules synchronously, so the code that handled promises and the re-invented `require()` for imported CommonJS customized by the async module customization hooks is removed too. `import()` still defers evaluation of the module to a later microtask, as before. `worker_threads.isInternalThread` is kept for compatibility and is now always `false`; removing it is left for a future semver-major change. The `ERR_ASYNC_LOADER_REQUEST_NEVER_SETTLED` and `ERR_LOADER_CHAIN_INCOMPLETE` error codes are no longer used and are documented as removed. Tests that exist only to exercise the async module customization hooks are removed. Assisted-by: Claude Signed-off-by: Geoffrey Booth <[email protected]> PR-URL: nodejs#67090 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Ilyas Shabi <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jacob Smith <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.