Skip to content

Commit ae65610

Browse files
GeoffreyBoothUlisesGascon
authored andcommitted
doc: update module hooks docs
PR-URL: #49265 Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent a11e64e commit ae65610

File tree

3 files changed

+321
-256
lines changed

3 files changed

+321
-256
lines changed

doc/api/cli.md

+12-7
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ absolute path, it's resolved as a relative path from the current working
2828
directory. That path is then resolved by [CommonJS][] module loader. If no
2929
corresponding file is found, an error is thrown.
3030

31-
If a file is found, its path will be passed to the [ECMAScript module loader][]
32-
under any of the following conditions:
31+
If a file is found, its path will be passed to the
32+
[ES module loader][Modules loaders] under any of the following conditions:
3333

3434
* The program was started with a command-line flag that forces the entry
3535
point to be loaded with ECMAScript module loader.
@@ -43,9 +43,9 @@ Otherwise, the file is loaded using the CommonJS module loader. See
4343

4444
### ECMAScript modules loader entry point caveat
4545

46-
When loading [ECMAScript module loader][] loads the program entry point, the `node`
47-
command will only accept as input only files with `.js`, `.mjs`, or `.cjs`
48-
extensions; and with `.wasm` extensions when
46+
When loading, the [ES module loader][Modules loaders] loads the program
47+
entry point, the `node` command will accept as input only files with `.js`,
48+
`.mjs`, or `.cjs` extensions; and with `.wasm` extensions when
4949
[`--experimental-wasm-modules`][] is enabled.
5050

5151
## Options
@@ -550,7 +550,11 @@ changes:
550550
`--experimental-loader`.
551551
-->
552552

553-
Specify the `module` of a custom experimental [ECMAScript module loader][].
553+
> This flag is discouraged and may be removed in a future version of Node.js.
554+
> Please use
555+
> [`--import` with `register()`][module customization hooks: enabling] instead.
556+
557+
Specify the `module` containing exported [module customization hooks][].
554558
`module` may be any string accepted as an [`import` specifier][].
555559

556560
### `--experimental-network-imports`
@@ -2640,9 +2644,10 @@ done
26402644
[CommonJS module]: modules.md
26412645
[CustomEvent Web API]: https://dom.spec.whatwg.org/#customevent
26422646
[ECMAScript module]: esm.md#modules-ecmascript-modules
2643-
[ECMAScript module loader]: esm.md#loaders
26442647
[Fetch API]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
26452648
[File System Permissions]: permissions.md#file-system-permissions
2649+
[Module customization hooks]: module.md#customization-hooks
2650+
[Module customization hooks: enabling]: module.md#enabling
26462651
[Modules loaders]: packages.md#modules-loaders
26472652
[Node.js issue tracker]: https://github.com/nodejs/node/issues
26482653
[OSSL_PROVIDER-legacy]: https://www.openssl.org/docs/man3.0/man7/OSSL_PROVIDER-legacy.html

doc/api/esm.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,7 @@ resolution for ESM specifiers is [commonjs-extension-resolution-loader][].
10701070
[`process.dlopen`]: process.md#processdlopenmodule-filename-flags
10711071
[cjs-module-lexer]: https://github.com/nodejs/cjs-module-lexer/tree/1.2.2
10721072
[commonjs-extension-resolution-loader]: https://github.com/nodejs/loaders-test/tree/main/commonjs-extension-resolution-loader
1073-
[custom https loader]: module.md#https-loader
1073+
[custom https loader]: module.md#import-from-https
10741074
[import.meta.resolve]: #importmetaresolvespecifier
10751075
[percent-encoded]: url.md#percent-encoding-in-urls
10761076
[special scheme]: https://url.spec.whatwg.org/#special-scheme

0 commit comments

Comments
 (0)