node/lib/internal/modules/cjs
Darshan Sen 7fe4745ca1
module: refactor to use normalizeRequirableId in the CJS module loader
`BuiltinModule.normalizeRequirableId()` was introduced in
https://github.com/nodejs/node/pull/47779 to fix a bug in the require
function of SEAs and Snapshots, so that built-in modules with the
`node:` scheme could be required correctly. This change makes more use
of this API instead of `BuiltinModule.canBeRequiredByUsers()` and
`BuiltinModule.canBeRequiredWithoutScheme()` to reduce chances of
such bugs.

Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/47896
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
2023-05-08 08:17:13 +00:00
..
loader.js module: refactor to use normalizeRequirableId in the CJS module loader 2023-05-08 08:17:13 +00:00