module.registerHooks() tracking issue
オープン
まだ誰も着手していません。
loaders
module
- 主要言語
- JavaScript
- スター
- 122k
- フォーク
- 37.3k
- 平均マージ
- 4日 2時間
- マージ済み PR(30日)
- 283
説明
- 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
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
後継 issue https://github.com/nodejs/node/issues/62720 と、関連付けられた Node.js loaders proposals、特に link フックと startGraph フックから始めてください。この tracking issue は別の場所に移されており、未解決の設計作業を列挙しているため、その完了条件はここでは定義されていません。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, node.js
- 領域
- backend
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 15/100