node
node copied to clipboard
module: cache synchronous module jobs before linking
test: add common.expectRequiredModule()
To minimize changes if/when we change the layout of the result returned by require(esm).
module: cache synchronous module jobs before linking
So that if there are circular dependencies in the synchronous module graph, they could be resolved using the cached jobs. In case linking fails and the error gets caught, reset the cache right after linking. If it succeeds, the caller will cache it again. Otherwise the error bubbles up to users, and since we unset the cache for the unlinkable module the next attempt would still fail.
Fixes: https://github.com/nodejs/node/issues/52864
Review requested:
- [ ] @nodejs/loaders
CI: https://ci.nodejs.org/job/node-test-pull-request/58996/
CI: https://ci.nodejs.org/job/node-test-pull-request/59018/
CI: https://ci.nodejs.org/job/node-test-pull-request/59020/
Landed in 1291d3d5c406ffc3d85820f14cda662d4b495a38...2863c5425734d404101c190d53b66f7c475c42e3