You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
I have a WIP for the evaluate hook which already works for a mock of require-in-the-middle. Pending on resolution about whether/how ESM can play into it. Opened an issue in Chromium to discuss about ESM evaluation hook: https://issues.chromium.org/u/1/issues/384413088 (mutability of exports would probably be out of scope of V8 as that's mandated by the spec, but at least we can address the use case where the hook does not need to patch and simply wants to observe).
module.registerHooks()
or Node.js in generalSymbol.dispose
integration (requested in implement module.registerHooks() to run synchronous module customization hooks in thread #55698 (comment))module.registerHooks()
is battle tested enough and should be preferred overmodule.register
to 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))module.register()
built on top ofmodule.registerHooks()
startGraph
hook proposed in Proposal: Moving hooks on thread loaders#205The text was updated successfully, but these errors were encountered: