module.registerHooks() tracking issue
Abierto
Nadie ha tomado este issue todavía.
loaders
module
- Lenguaje dominante
- JavaScript
- Estrellas
- 122k
- Forks
- 37.3k
- Merge medio
- 4 d 2 h
- PR fusionados (30 d)
- 283
Descripción
- Support
node:builtin?param=val& figure out how to make search params work with CJS cache- Some clues can be found in https://github.com/nodejs/node/pull/62920 (which smooths it for internal test mocking)
-
Symbol.disposeintegration (requested in https://github.com/nodejs/node/pull/55698#discussion_r1855211481) - Initial proposal: https://github.com/nodejs/node/issues/52219
- Loaders design proposal: https://github.com/nodejs/loaders/pull/198
- Initial implementation: https://github.com/nodejs/node/pull/55698
- Make the internal resolution and loading paths synchronous, to reduce the chance of races https://github.com/nodejs/node/pull/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: https://github.com/nodejs/node/pull/59929- 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
- Reordering of the documentation when
module.registerHooks()is battle tested enough and should be preferred overmodule.registerto avoid various caveats https://github.com/nodejs/node/issues/56241 - Support of unknown extensions (learned about it when I was initially proposing https://github.com/nodejs/node/issues/52219): this is already fully possible with the resolve hook?
Moved to https://github.com/nodejs/node/issues/62720
- Implement link hook for ESM, as proposed in https://github.com/nodejs/loaders/pull/198 to make use cases like import-in-the-middle less hacky https://github.com/nodejs/node/issues/62720
startGraphhook proposed in https://github.com/nodejs/loaders/pull/205- Implement evaluation hook for at least CJS to help use cases like require-in-the-middle, which was supposed to be based on https://github.com/nodejs/loaders/pull/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
Nice to have:
- Advocating it to popular npm packages doing CJS monkey-patching to reduce the overall dependency of CJS loader internals in the ecosystem
- Create a polyfill of
module.register()built on top ofmodule.registerHooks(): WIP in https://github.com/joyeecheung/module-register-ponyfill
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con el issue sucesor https://github.com/nodejs/node/issues/62720 y las propuestas vinculadas de Node.js loaders, especialmente los hooks link y startGraph. Este tracking issue se ha trasladado a otro lugar y enumera trabajo de diseño sin resolver, por lo que sus criterios de finalización no están definidos aquí.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- javascript, node.js
- Área
- backend
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 15/100