Skip to content

Commit 1ac389e

Browse files
GeoffreyBoothtargos
authored andcommitted
doc: update module hooks docs
PR-URL: #49265 Backport-PR-URL: #50669 Reviewed-By: Jacob Smith <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
1 parent ed2d46f commit 1ac389e

File tree

3 files changed

+304
-243
lines changed

3 files changed

+304
-243
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
@@ -396,7 +396,11 @@ changes:
396396
`--experimental-loader`.
397397
-->
398398

399-
Specify the `module` of a custom experimental [ECMAScript module loader][].
399+
> This flag is discouraged and may be removed in a future version of Node.js.
400+
> Please use
401+
> [`--import` with `register()`][module customization hooks: enabling] instead.
402+
403+
Specify the `module` containing exported [module customization hooks][].
400404
`module` may be any string accepted as an [`import` specifier][].
401405

402406
### `--experimental-network-imports`
@@ -2366,8 +2370,9 @@ done
23662370
[CommonJS module]: modules.md
23672371
[CustomEvent Web API]: https://dom.spec.whatwg.org/#customevent
23682372
[ECMAScript module]: esm.md#modules-ecmascript-modules
2369-
[ECMAScript module loader]: esm.md#loaders
23702373
[Fetch API]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
2374+
[Module customization hooks]: module.md#customization-hooks
2375+
[Module customization hooks: enabling]: module.md#enabling
23712376
[Modules loaders]: packages.md#modules-loaders
23722377
[Node.js issue tracker]: https://github.com/nodejs/node/issues
23732378
[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
@@ -1090,7 +1090,7 @@ success!
10901090
[`package.json`]: packages.md#nodejs-packagejson-field-definitions
10911091
[`process.dlopen`]: process.md#processdlopenmodule-filename-flags
10921092
[cjs-module-lexer]: https://github.com/nodejs/cjs-module-lexer/tree/1.2.2
1093-
[custom https loader]: module.md#https-loader
1093+
[custom https loader]: module.md#import-from-https
10941094
[import.meta.resolve]: #importmetaresolvespecifier
10951095
[percent-encoded]: url.md#percent-encoding-in-urls
10961096
[special scheme]: https://url.spec.whatwg.org/#special-scheme

0 commit comments

Comments
 (0)