node/lib/internal/modules
Joyee Cheung f74beb53de
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.

PR-URL: https://github.com/nodejs/node/pull/52868
Fixes: https://github.com/nodejs/node/issues/52864
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2024-05-11 18:55:48 +02:00
..
cjs lib,src: remove --experimental-policy 2024-05-08 07:16:04 +02:00
esm module: cache synchronous module jobs before linking 2024-05-11 18:55:48 +02:00
helpers.js lib,src: remove --experimental-policy 2024-05-08 07:16:04 +02:00
package_json_reader.js lib,src: remove --experimental-policy 2024-05-08 07:16:04 +02:00
run_main.js lib,src: remove --experimental-policy 2024-05-08 07:16:04 +02:00