-
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: mention existence/purpose of module wrapper #6433
Conversation
Seems fine to me, but I might be missing some context. cc @nodejs/documentation |
LGTM, but could you also update the statement that I referenced in #6427 (comment). |
Note that, as is, this opens the possibility that people -god forbid- start accessing |
b9a9973
to
59523ae
Compare
@cjihrig sure, updated! |
59523ae
to
6e9de4e
Compare
|
||
- It keeps top-level variables (defined with `var`, `const` or `let`) scoped to | ||
your module rather than the global object | ||
- It helps to provide some global-looking variables that are actually specific |
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.
Extra space after "to"
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.
Fixed.
LGTM, but let's wait a day or so to let other collaborators weigh in. |
<!-- type=misc --> | ||
|
||
Before Node.js hands off your module to be executed by V8, it wraps the entire | ||
thing in a function wrapper that looks like this: |
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.
thing? Wouldn't code be better?
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.
Sorted.
LGTM with mine and @thefourtheye's nits. Thanks for the PR @mtharrison! Also, can you update the commit title and message to conform to https://github.com/nodejs/node/blob/master/CONTRIBUTING.md#step-3-commit? Specifically, the title and body line lengths. Thanks! |
f609afc
to
fbe510a
Compare
@evanlucas Thanks. I squashed into a single commit. Which looks like it conforms. Is it correct? |
|
||
<!-- type=misc --> | ||
|
||
Before Node.js hands off your module to be executed by V8, it wraps your code |
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.
I wouldn’t reference V8 here directly, as this does not depend on the specific engine that’s being used.
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.
ah good point @addaleax
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.
@addaleax @evanlucas Do you have any suggestions for something more appropriate? Some ideas:
- s/V8/the JavaScript [runtime|engine]
- Change the whole sentence to "Before Node.js executes the code in your module, it wraps it in..."
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.
I like the change the whole sentence idea
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.
@evanlucas thanks, updated accordingly.
@mtharrison commit message looks good. Thanks! |
fbe510a
to
be86e84
Compare
<!-- type=misc --> | ||
|
||
Before Node.js executes the code in your module, it wraps it with a function | ||
wrapper that looks like this: |
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.
I know this particular document is riddled with you
and your
, which we should get refactored out later.. can you reword this to avoid adding a new instance of your
? Perhaps, Before a module's code is executed, Node.js will wrap it with a function wrapper.
Left some comments. LGTM otherwise. |
Included a block in the modules.md file to explain the existence and purpose of the module wrapper.
be86e84
to
696fc71
Compare
@jasnell Thanks, I've addressed those issues now. |
Thank you! |
Included a block in the modules.md file to explain the existence and purpose of the module wrapper. PR-URL: #6433 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Landed in 7164003. Thanks! |
Included a block in the modules.md file to explain the existence and purpose of the module wrapper. PR-URL: #6433 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Included a block in the modules.md file to explain the existence and purpose of the module wrapper. PR-URL: #6433 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Included a block in the modules.md file to explain the existence and purpose of the module wrapper. PR-URL: #6433 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Included a block in the modules.md file to explain the existence and purpose of the module wrapper. PR-URL: #6433 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Included a block in the modules.md file to explain the existence and purpose of the module wrapper. PR-URL: #6433 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Checklist
Affected core subsystem(s)
doc
Description of change
Included a block in the modules.md file to explain the existence and
purpose of the module wrapper