Skip to content

Commit e96232b

Browse files
committed
doc: update module hooks docs
1 parent 1c660aa commit e96232b

File tree

2 files changed

+304
-250
lines changed

2 files changed

+304
-250
lines changed

doc/api/cli.md

+13-7
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ 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+
[ECMAScript module loader][Modules loaders] under any of the following
33+
conditions:
3334

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

4445
### ECMAScript modules loader entry point caveat
4546

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
47+
When loading [ECMAScript module loader][Modules loaders] loads the program
48+
entry point, the `node` command will only accept as input only files with
49+
`.js`, `.mjs`, or `.cjs` extensions; and with `.wasm` extensions when
4950
[`--experimental-wasm-modules`][] is enabled.
5051

5152
## Options
@@ -550,7 +551,11 @@ changes:
550551
`--experimental-loader`.
551552
-->
552553

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

556561
### `--experimental-network-imports`
@@ -2644,9 +2649,10 @@ done
26442649
[CommonJS module]: modules.md
26452650
[CustomEvent Web API]: https://dom.spec.whatwg.org/#customevent
26462651
[ECMAScript module]: esm.md#modules-ecmascript-modules
2647-
[ECMAScript module loader]: esm.md#loaders
26482652
[Fetch API]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
26492653
[File System Permissions]: permissions.md#file-system-permissions
2654+
[Module customization hooks]: module.md#customization-hooks
2655+
[Module customization hooks: enabling]: module.md#enabling
26502656
[Modules loaders]: packages.md#modules-loaders
26512657
[Node.js issue tracker]: https://github.com/nodejs/node/issues
26522658
[OSSL_PROVIDER-legacy]: https://www.openssl.org/docs/man3.0/man7/OSSL_PROVIDER-legacy.html

0 commit comments

Comments
 (0)