Skip to content

doc,loaders,module: clarify hook chain execution sequence - #51884

Merged
nodejs-github-bot merged 5 commits into
nodejs:mainfrom
JakobJingleheimer:doc/clarify-hooks-sequence
Mar 2, 2024
Merged

doc,loaders,module: clarify hook chain execution sequence#51884
nodejs-github-bot merged 5 commits into
nodejs:mainfrom
JakobJingleheimer:doc/clarify-hooks-sequence

Conversation

@JakobJingleheimer

@JakobJingleheimerJakobJingleheimer commented Feb 26, 2024

Copy link
Copy Markdown
Member

Closes#51876
Closes#51878

@JakobJingleheimerJakobJingleheimer added doc Issues and PRs related to the documentations. module Issues and PRs related to the module subsystem. loaders Issues and PRs related to ES module loaders labels Feb 26, 2024
@JakobJingleheimerJakobJingleheimer self-assigned this Feb 26, 2024
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/loaders

@yklcs

Copy link
Copy Markdown

I'd like to suggest making changes in the "hooks" section too for clarity, as it also mentions chaining. The "subsequent loader" part, in specific.

node/doc/api/module.md

Lines 376 to 380 in 6bb7c4d

Hooks are part of a chain, even if that chain consists of only one custom
(user-provided) hook and the default hook, which is always present. Hook
functions nest: each one must always return a plain object, and chaining happens
as a result of each function calling `next<hookName>()`, which is a reference to
the subsequent loader's hook.

Comment threaddoc/api/module.md Outdated
@JakobJingleheimer

JakobJingleheimer commented Feb 27, 2024

Copy link
Copy Markdown
MemberAuthor

I'd like to suggest making changes in the "hooks" section too for clarity, as it also mentions chaining. The "subsequent loader" part, in specific.

Hmm, here I'm not seeing the confusing bit. Do you mean you'd like some indication of which loader will be in next<hookName>? I wouldn't want to be too repetitive, so how about something simple, like:

- which is a reference to the subsequent loader's hook.+ which is a reference to the subsequent loader's hook (in LIFO order).

@yklcs

Copy link
Copy Markdown

I'd like to suggest making changes in the "hooks" section too for clarity, as it also mentions chaining. The "subsequent loader" part, in specific.

Hmm, here I'm not seeing the confusing bit here. Do you mean you'd like some indication of which loader will be in next<hookName>? I wouldn't want to be too repetitive, so how about something simple, like:

- which is a reference to the subsequent loader's hook.+ which is a reference to the subsequent loader's hook (in LIFO order).

I think that would help, maybe along with a link to #chaining?

Comment threaddoc/api/module.md Outdated
Comment threaddoc/api/module.md Outdated
JakobJingleheimerand others added 2 commits March 1, 2024 20:10
Co-authored-by: Geoffrey Booth <webadmin@geoffreybooth.com>
Co-authored-by: Geoffrey Booth <webadmin@geoffreybooth.com>
@GeoffreyBoothGeoffreyBooth added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Mar 1, 2024
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Mar 1, 2024
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@JakobJingleheimer

This comment was marked as resolved.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@JakobJingleheimerJakobJingleheimer added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Mar 2, 2024
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Mar 2, 2024
@nodejs-github-bot
nodejs-github-bot merged commit 2e2a848 into nodejs:mainMar 2, 2024
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 2e2a848

targos pushed a commit that referenced this pull request Mar 7, 2024
PR-URL: #51884
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
@targostargos mentioned this pull request Mar 7, 2024
richardlau pushed a commit that referenced this pull request Mar 25, 2024
PR-URL: #51884
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
@richardlaurichardlau mentioned this pull request Mar 25, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.commit-queue-squashAdd this label to instruct the Commit Queue to squash all the PR commits into the first one.docIssues and PRs related to the documentations.loadersIssues and PRs related to ES module loadersmoduleIssues and PRs related to the module subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

node:moduleregister hook chaining order behavior is incorrect

5 participants

@JakobJingleheimer@nodejs-github-bot@yklcs@GeoffreyBooth@lpinca