Create `lib/internal/modules` and restructure the module loaders to make the purpose of those files clearer. Also make it clear in the code that the object exported by `lib/internal/modules/cjs/loader.js` is `CJSModule` instead of the ambiguous `Module`. Before: ``` lib ├── ... ├── internal │ ├── loaders │ │ ├── CreateDynamicModule.js │ │ ├── DefaultResolve.js │ │ ├── Loader.js │ │ ├── ModuleJob.js │ │ ├── ModuleMap.js │ │ ├── ModuleWrap.js │ │ └── Translators.js │ └── module.js └── module.js ``` After: ``` lib ├── ... ├── internal │ ├── ... │ └── modules │ ├── cjs │ │ ├── helpers.js │ │ └── loader.js │ └── esm │ ├── CreateDynamicModule.js │ ├── DefaultResolve.js │ ├── Loader.js │ ├── ModuleJob.js │ ├── ModuleMap.js │ └── Translators.js └── module.js # deleted in this commit to work with git file mode ``` Backport-PR-URL: https://github.com/nodejs/node/pull/19374 PR-URL: https://github.com/nodejs/node/pull/19177 Refs: https://github.com/nodejs/node/pull/19112 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> |
||
|---|---|---|
| .. | ||
| es-module.status | ||
| esm-snapshot-mutator.js | ||
| esm-snapshot.js | ||
| json.json | ||
| test-esm-basic-imports.mjs | ||
| test-esm-cyclic-dynamic-import.mjs | ||
| test-esm-double-encoding-native%20.js | ||
| test-esm-double-encoding.mjs | ||
| test-esm-dynamic-import.js | ||
| test-esm-encoded-path-native.js | ||
| test-esm-encoded-path.mjs | ||
| test-esm-example-loader.js | ||
| test-esm-forbidden-globals.mjs | ||
| test-esm-json.mjs | ||
| test-esm-loader-dependency.mjs | ||
| test-esm-loader-modulemap.js | ||
| test-esm-loader-search.js | ||
| test-esm-main-lookup.mjs | ||
| test-esm-named-exports.mjs | ||
| test-esm-namespace.mjs | ||
| test-esm-ok.mjs | ||
| test-esm-preserve-symlinks-not-found-plain.mjs | ||
| test-esm-preserve-symlinks-not-found.mjs | ||
| test-esm-preserve-symlinks.js | ||
| test-esm-require-cache.mjs | ||
| test-esm-resolve-hook.mjs | ||
| test-esm-shared-loader-dep.mjs | ||
| test-esm-shebang.mjs | ||
| test-esm-snapshot.mjs | ||
| test-esm-symlink-main.js | ||
| test-esm-symlink.js | ||
| testcfg.py | ||