node/lib/internal/modules
Joyee Cheung 96f19a16d0
module: fix sync hook short-circuit in require() in imported CJS
- For imported CJS, if it's not customized by asynchronous hooks,
  make sure it won't use the quirky re-invented require in all
  cases.
- When the imported CJS module is customized by synchronous hooks,
  in the synthetic module evalutation step, avoid calling the
  respective default step again.
- Make the branching of loadCJSModuleWithModuleLoad() and
  loadCJSModuleWithSpecialRequire() more explicit, and fold
  the tentative fs read in the 'commonjs' translator into the
  share createCJSModuleWrap() helper instead of checking it
  twice in the same path.

Signed-off-by: Joyee Cheung <joyeec9h3@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/62920
Fixes: https://github.com/nodejs/node/issues/63060
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
2026-05-19 14:08:17 +02:00
..
cjs module: fix sync hook short-circuit in require() in imported CJS 2026-05-19 14:08:17 +02:00
esm module: fix sync hook short-circuit in require() in imported CJS 2026-05-19 14:08:17 +02:00
customization_hooks.js
helpers.js module: run require.resolve through module.registerHooks() 2026-03-02 18:28:25 +00:00
package_json_reader.js
run_main.js
typescript.js module: remove --experimental-transform-types 2026-02-27 16:32:43 +00:00