node/lib/internal/modules/esm
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
..
assert.js esm: fix import assertion warning 2023-03-07 10:32:47 +00:00
create_dynamic_module.js tools: add prefer-proto rule 2023-01-10 05:38:36 +00:00
fetch_module.js lib: enforce use of trailing commas for functions 2023-02-14 18:45:16 +01:00
formats.js lib: enforce use of trailing commas for functions 2023-02-14 18:45:16 +01:00
get_format.js esm: skip file: URL conversion to path when possible 2023-04-01 07:43:38 +00:00
handle_process_exit.js src: consolidate exit codes in the code base 2022-10-06 12:41:16 +00:00
hooks.js module: do less CJS module loader initialization at run time 2023-04-05 11:13:23 +00:00
initialize_import_meta.js lib: enforce use of trailing commas 2023-03-06 10:44:14 +01:00
load.js esm: move hooks handling into separate class 2022-12-20 07:36:45 +00:00
loader.js lib: enforce use of trailing commas 2023-03-06 10:44:14 +01:00
module_job.js lib: enforce use of trailing commas for functions 2023-02-14 18:45:16 +01:00
module_map.js tools: add prefer-proto rule 2023-01-10 05:38:36 +00:00
package_config.js lib: enforce use of trailing commas for functions 2023-02-14 18:45:16 +01:00
resolve.js module: do less CJS module loader initialization at run time 2023-04-05 11:13:23 +00:00
translators.js esm: skip file: URL conversion to path when possible 2023-04-01 07:43:38 +00:00
utils.js lib: enforce use of trailing commas 2023-03-06 10:44:14 +01:00