Skip to content

Commit 7d2cb00

Browse files
committed
doc: reorganize docs of module customization hooks
This reorganizes the documentation of module customization hooks to promote the synchronous variant as it has fewer caveats. Previously the documentation was organized as follows: To do something: 1. For asynchronous hooks, do this, which may have these caveats 2. For synchronous hooks, do this, which does not have the caveats To do something else: 1. For asynchronous hooks, do this, which may have these caveats 2. For synchronous hooks, do this, which does not have the caveats It's now organized as follows: Synchronous hooks: To do something, do this. To do something else, do this. (No mention that it doesn't have caveats, because users are not supposed to burden themselves with caveats in the other API that they do not use). Asynchronous hooks: They have these caveats, if they are too complex to deal with, consider use the synchronous variant. To do something, do this, which may have these caveats. To do something, do this, which may have these caveats.
1 parent 85852a3 commit 7d2cb00

File tree

2 files changed

+500
-336
lines changed

2 files changed

+500
-336
lines changed

doc/api/cli.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,9 +1175,9 @@ changes:
11751175

11761176
> This flag is discouraged and may be removed in a future version of Node.js.
11771177
> Please use
1178-
> [`--import` with `register()`][module customization hooks: enabling] instead.
1178+
> [`--import` with `register()`][preloading asynchronous module customization hooks] instead.
11791179
1180-
Specify the `module` containing exported [module customization hooks][].
1180+
Specify the `module` containing exported [asynchronous module customization hooks][].
11811181
`module` may be any string accepted as an [`import` specifier][].
11821182

11831183
This feature requires `--allow-worker` if used with the [Permission Model][].
@@ -4123,8 +4123,6 @@ node --stack-trace-limit=12 -p -e "Error.stackTraceLimit" # prints 12
41234123
[ExperimentalWarning: `vm.measureMemory` is an experimental feature]: vm.md#vmmeasurememoryoptions
41244124
[File System Permissions]: permissions.md#file-system-permissions
41254125
[Loading ECMAScript modules using `require()`]: modules.md#loading-ecmascript-modules-using-require
4126-
[Module customization hooks]: module.md#customization-hooks
4127-
[Module customization hooks: enabling]: module.md#enabling
41284126
[Module resolution and loading]: packages.md#module-resolution-and-loading
41294127
[Navigator API]: globals.md#navigator
41304128
[Node.js issue tracker]: https://github.com/nodejs/node/issues
@@ -4184,6 +4182,7 @@ node --stack-trace-limit=12 -p -e "Error.stackTraceLimit" # prints 12
41844182
[`tls.DEFAULT_MIN_VERSION`]: tls.md#tlsdefault_min_version
41854183
[`unhandledRejection`]: process.md#event-unhandledrejection
41864184
[`v8.startupSnapshot` API]: v8.md#startup-snapshot-api
4185+
[asynchronous module customization hooks]: module.md#asynchronous-customization-hooks
41874186
[collecting code coverage from tests]: test.md#collecting-code-coverage
41884187
[conditional exports]: packages.md#conditional-exports
41894188
[context-aware]: addons.md#context-aware-addons
@@ -4197,6 +4196,7 @@ node --stack-trace-limit=12 -p -e "Error.stackTraceLimit" # prints 12
41974196
[jitless]: https://v8.dev/blog/jitless
41984197
[libuv threadpool documentation]: https://docs.libuv.org/en/latest/threadpool.html
41994198
[module compile cache]: module.md#module-compile-cache
4199+
[preloading asynchronous module customization hooks]: module.md#registration-of-asynchronous-customization-hooks
42004200
[remote code execution]: https://www.owasp.org/index.php/Code_Injection
42014201
[running tests from the command line]: test.md#running-tests-from-the-command-line
42024202
[scavenge garbage collector]: https://v8.dev/blog/orinoco-parallel-scavenger

0 commit comments

Comments
 (0)