From 24966444fb272a5d0a218f636f3e63a1de4d86e1 Mon Sep 17 00:00:00 2001 From: Gabriel Bota Date: Thu, 16 May 2024 07:46:51 +0200 Subject: [PATCH 1/2] doc: clarify options for single customization hooks thread --- doc/api/cli.md | 4 +++- doc/api/module.md | 4 +++- doc/api/worker_threads.md | 5 ++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/doc/api/cli.md b/doc/api/cli.md index 7c95014395f6f8..2676a96cb6387a 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -898,7 +898,9 @@ changes: > [`--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][]. +`module` may be any string accepted as an [`import` specifier][]. This option +has no effect on worker threads. Worker threads inherit the customization hooks +chain configured on main thread. ### `--experimental-network-imports` diff --git a/doc/api/module.md b/doc/api/module.md index b62cb55a094f59..3bafb71de734b2 100644 --- a/doc/api/module.md +++ b/doc/api/module.md @@ -113,7 +113,9 @@ changes: `initialize` hook. Register a module that exports [hooks][] that customize Node.js module -resolution and loading behavior. See [Customization hooks][]. +resolution and loading behavior. Registering modules that export [hooks][] only +has an effect on the main thread. All worker threads inherit the customization +hooks chain of the main thread. See [Customization hooks][]. ### `module.syncBuiltinESMExports()` diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md index e4e842c6d21365..2fcfb0f89478d5 100644 --- a/doc/api/worker_threads.md +++ b/doc/api/worker_threads.md @@ -1008,7 +1008,10 @@ changes: * `execArgv` {string\[]} List of node CLI options passed to the worker. V8 options (such as `--max-old-space-size`) and options that affect the process (such as `--title`) are not supported. If set, this is provided - as [`process.execArgv`][] inside the worker. By default, options are + as [`process.execArgv`][] inside the worker. `--experimental-loader` + and `--import` with `module.register()` calls to contribute to the hooks + chain do not have an effect on the worker threads. These options affect + only the configuration of the main thread. By default, options are inherited from the parent thread. * `stdin` {boolean} If this is set to `true`, then `worker.stdin` provides a writable stream whose contents appear as `process.stdin` From 4de0ba9add040e64e41bc38206f74e34b3166339 Mon Sep 17 00:00:00 2001 From: Gabriel Bota Date: Mon, 20 May 2024 13:23:27 +0200 Subject: [PATCH 2/2] remove doc update --- doc/api/cli.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/doc/api/cli.md b/doc/api/cli.md index 2676a96cb6387a..7c95014395f6f8 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -898,9 +898,7 @@ changes: > [`--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][]. This option -has no effect on worker threads. Worker threads inherit the customization hooks -chain configured on main thread. +`module` may be any string accepted as an [`import` specifier][]. ### `--experimental-network-imports`