Skip to content

Commit

Permalink
doc: update module hooks docs
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoffreyBooth committed Aug 21, 2023
1 parent 1c660aa commit e96232b
Show file tree
Hide file tree
Showing 2 changed files with 304 additions and 250 deletions.
20 changes: 13 additions & 7 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ absolute path, it's resolved as a relative path from the current working
directory. That path is then resolved by [CommonJS][] module loader. If no
corresponding file is found, an error is thrown.

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

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

### ECMAScript modules loader entry point caveat

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

## Options
Expand Down Expand Up @@ -550,7 +551,11 @@ changes:
`--experimental-loader`.
-->

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

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

0 comments on commit e96232b

Please sign in to comment.