node/lib/internal/modules
Joyee Cheung 5572f8fca0
module: do less CJS module loader initialization at run time
This patch:

- Builds the set of modules that can be required by users with/without
  the `node:` prefix at snapshot building time. We only modify it when
  `--expose-internals` but the default set is now in the snapshot. At
  run time the CJS module loader only creates a frozen array out of it.
- `BuiltinModule.canBeRequiredWithoutScheme()` is now enough to
  determine if an id can be required without `node:` without an
  additional call to `BuiltinModule.canBeRequiredByUsers()`
- Replace the pending-to-deprecate methods on `Module` with an internal
  implementation that only queries the CLI flags when being invoked.
  So we can install these methods in the snapshot.

PR-URL: https://github.com/nodejs/node/pull/47194
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2023-04-05 11:13:23 +00:00
..
cjs module: do less CJS module loader initialization at run time 2023-04-05 11:13:23 +00:00
esm module: do less CJS module loader initialization at run time 2023-04-05 11:13:23 +00:00
helpers.js module: do less CJS module loader initialization at run time 2023-04-05 11:13:23 +00:00
package_json_reader.js lib: enforce use of trailing commas for functions 2023-02-14 18:45:16 +01:00
run_main.js tools: add prefer-proto rule 2023-01-10 05:38:36 +00:00