-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: clarify options for single customization hooks thread #53006
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -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][]. | ||||||||||||||||
Comment on lines
+116
to
+118
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I know that for the main thread, obviously the hooks don’t apply to any modules already imported before the hooks are registered, and then they do apply to modules imported after registration; is it the same for worker threads? So if I have code that creates a new worker thread, then registers hooks, and then code within the worker thread does And what happens when you call |
||||||||||||||||
|
||||||||||||||||
### `module.syncBuiltinESMExports()` | ||||||||||||||||
|
||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. strictly from code point of view it is the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In that case I find it a bit misplaced here as I would assume only very few users of workers actually use customization hooks. One might argue that setting I would prefer to improve the documentation at Also the behavior in case loader thread hangs or dies is not described. Usually one would expect that workers are isolated but via customization hooks all of them are bound to the loader thread and via this one to main thread. But not sure if it is your intention to get that far in this PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think let’s just cut the addition to |
||
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` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
“only has an effect on the main thread” sounds like the hooks don’t apply to worker threads. I just wouldn’t add anything here. I think the default assumption is that customization hooks apply everywhere, and thanks to the recent PR, now they do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, removed the change in
cli.md
now.