module: runtime deprecate module.register()#62401
module: runtime deprecate module.register()#62401GeoffreyBooth wants to merge 2 commits intonodejs:mainfrom
module.register()#62401Conversation
|
Review requested:
|
c5ce15e to
77638cb
Compare
77638cb to
1a08254
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #62401 +/- ##
==========================================
- Coverage 89.69% 89.67% -0.03%
==========================================
Files 676 676
Lines 206693 206704 +11
Branches 39577 39582 +5
==========================================
- Hits 185402 185361 -41
- Misses 13435 13489 +54
+ Partials 7856 7854 -2
🚀 New features to boost your workflow:
|
AugustinMauroy
left a comment
There was a problem hiding this comment.
In general that seem good.
| ); | ||
|
|
||
| function register(specifier, parentURL = undefined, options) { | ||
| emitRegisterDeprecation(); |
There was a problem hiding this comment.
| emitRegisterDeprecation(); | |
| emitRegisterDeprecation(); | |
separate core logic & deprecation by space
|
|
||
| [`module.register()`][] is deprecated. Use [`module.registerHooks()`][] | ||
| instead. | ||
|
|
There was a problem hiding this comment.
we should add small paragraph that exaplain why and what is the gap between theses api mainly one is only async and the other can do both
themavik
left a comment
There was a problem hiding this comment.
getDeprecationWarningEmitter + emitRegisterDeprecation() in lib/internal/modules/esm/loader.js lines up with DEP0205 docs. nit: new regression in test/es-module/test-esm-register-deprecation.mjs only counts [DEP0205] substrings — if stderr ever gains unrelated DEP0205 text, the “once per process” check could skew (unlikely).
mcollina
left a comment
There was a problem hiding this comment.
lgtm
I think we should aim for 26.x, so we can actually drop in 27
| const emitRegisterDeprecation = getDeprecationWarningEmitter( | ||
| 'DEP0205', | ||
| '`module.register()` is deprecated. Use `module.registerHooks()` instead.', | ||
| undefined, | ||
| false, | ||
| ); | ||
|
|
||
| function register(specifier, parentURL = undefined, options) { | ||
| emitRegisterDeprecation(); |
There was a problem hiding this comment.
| const emitRegisterDeprecation = getDeprecationWarningEmitter( | |
| 'DEP0205', | |
| '`module.register()` is deprecated. Use `module.registerHooks()` instead.', | |
| undefined, | |
| false, | |
| ); | |
| function register(specifier, parentURL = undefined, options) { | |
| emitRegisterDeprecation(); | |
| let emittedRegisterWarning = false; | |
| function register(specifier, parentURL = undefined, options) { | |
| if (!emittedRegisterWarning) { | |
| process.emitWarning( | |
| '`module.register()` is experimental and planned to be removed. Use `module.registerHooks()` instead.', | |
| 'ExperimentalWarning', | |
| ); | |
| emittedRegisterWarning = true; | |
| } |
Building on #62395, this runtime-deprecates
module.register().I’m not sure when we want to land and release this; I think the options are basically either:
module.registerHooks()goes stable, hopefully sometime before 26 goes LTS; module: doc-deprecatemodule.register()#62395 (comment)module.register()#62395 (comment)I’m opening this now in case the team wants to do the second option. cc @nodejs/loaders @nodejs/userland-migrations