-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Open
Labels
loadersIssues and PRs related to ES module loadersIssues and PRs related to ES module loadersmoduleIssues and PRs related to the module subsystem.Issues and PRs related to the module subsystem.
Description
- Initial proposal: Proposal for a simple, universal module loader hooks API to replace require() monkey-patching #52219
- Loaders design proposal: doc: add synchronous hooks proposal loaders#198
- Initial implementation: implement module.registerHooks() to run synchronous module customization hooks in thread #55698
- Make the internal resolution and loading paths synchronous, to reduce the chance of races esm: use sync loading/resolving on non-loader-hook thread #60380
so thatwe can't really polyfillmodule.register()can be an helper built on top ofmodule.registerHooks(), and internally we only have one set of hooking points to take care ofmodule.registerwith it if we want to keep the internals to ourselves, oh well - Handle with the nullish sources of CommonJS caused by
module.register()quirk during interop: module: handle null source from async loader hooks in sync hooks #59929 - Implement evaluation hook for at least CJS to help use cases like require-in-the-middle, which was supposed to be based on doc: add synchronous hooks proposal loaders#198 but we had some discussions over the collaboration summit/NodeConf EU about changing the hook to be "wrapping around evaluation", not "after evaluation": WIP
- For ESM, there's currently no way for Node.js to hook into the evaluation of child modules, will need to discuss with V8 about it (issue). Allowing mutation of the exports would require a spec change so out of scope for
module.registerHooks()or Node.js in general
- For ESM, there's currently no way for Node.js to hook into the evaluation of child modules, will need to discuss with V8 about it (issue). Allowing mutation of the exports would require a spec change so out of scope for
- Implement link hook for ESM, as proposed in doc: add synchronous hooks proposal loaders#198 to make use cases like import-in-the-middle less hacky
-
Symbol.disposeintegration (requested in implement module.registerHooks() to run synchronous module customization hooks in thread #55698 (comment)) - Reordering of the documentation when
module.registerHooks()is battle tested enough and should be preferred overmodule.registerto avoid various caveats (requested in implement module.registerHooks() to run synchronous module customization hooks in thread #55698 (comment) and implement module.registerHooks() to run synchronous module customization hooks in thread #55698 (review)) - Advocating it to popular npm packages doing CJS monkey-patching to reduce the overall dependency of CJS loader internals in the ecosystem
- Support of unknown extensions (learned about it when I was initially proposing Proposal for a simple, universal module loader hooks API to replace require() monkey-patching #52219)
- Support
node:builtin?param=val - Figure out how to make search params work with CJS cache
- Create a polyfill of
module.register()built on top ofmodule.registerHooks() -
startGraphhook proposed in Proposal: Moving hooks on thread loaders#205
timokoessler, jacobshirley and dogabudak
Metadata
Metadata
Assignees
Labels
loadersIssues and PRs related to ES module loadersIssues and PRs related to ES module loadersmoduleIssues and PRs related to the module subsystem.Issues and PRs related to the module subsystem.