module: refactor to use `normalizeRequirableId` in the CJS module loader · nodejs/node@c19385c · GitHub
Skip to content

Commit c19385c

Browse files
RaisinTentargos
authored andcommitted
module: refactor to use normalizeRequirableId in the CJS module loader
`BuiltinModule.normalizeRequirableId()` was introduced in #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: #47896 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
1 parent 00668fc commit c19385c

2 files changed

Lines changed: 9 additions & 22 deletions

File tree

lib/internal/bootstrap/realm.js

Lines changed: 7 additions & 8 deletions

lib/internal/modules/cjs/loader.js

Lines changed: 2 additions & 14 deletions

0 commit comments

Comments
 (0)