-
Notifications
You must be signed in to change notification settings - Fork 30k
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: Extend esm examples, document and lint import forms for process + Buffer #39043
Conversation
Co-authored-by: Antoine du Hamel <[email protected]>
Co-authored-by: Bradley Farias <[email protected]>
It might make sense to modify Lines 65 to 101 in f4609bd
|
Thanks, I've gone ahead and added the lint rule for I've also updated the process docs to use destructured import forms wherever possible as well eg |
const module = { exports: {} }; | ||
process.dlopen(module, path.join(__dirname, 'local.node'), | ||
os.constants.dlopen.RTLD_NOW); | ||
dlopen(module, join(__dirname, 'local.node'), constants.dlopen.RTLD_NOW); |
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 subjectively prefer path.join
rather than simply join
, feel free to disregard if you disagree.
dlopen(module, join(__dirname, 'local.node'), constants.dlopen.RTLD_NOW); | |
dlopen(module, path.join(__dirname, 'local.node'), constants.dlopen.RTLD_NOW); |
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 did go quite agressive on the destructured imports, down to leaving out cases like "on". I understand some of these get tricky, but want to try and encourage this as much as possible for tree-shaking style optimizations. In theory leaving out the member expression access is more performant as well although it's a micro-optimization for sure. Will leave this in unless anyone wants to push back further.
Co-authored-by: Antoine du Hamel <[email protected]>
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.
LGTM, docs only change, would want to do some styling work to agree how to reduce noise viewing overall size of docs in a different PR.
PR-URL: #39043 Reviewed-By: Bradley Farias <[email protected]>
Landed in f4d0a6a. |
@guybedford the lint rule only targets ESM syntax, is that on purpose? For info there are 135 occurrences of |
PR-URL: #39043 Reviewed-By: Bradley Farias <[email protected]>
Refs: #39043 PR-URL: #42394 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Mestery <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Akhil Marsonya <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
Refs: #39043 PR-URL: #42394 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Mestery <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Akhil Marsonya <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
Refs: nodejs#39043 PR-URL: nodejs#42394 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Mestery <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Akhil Marsonya <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
Refs: #39043 PR-URL: #42394 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Mestery <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Akhil Marsonya <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
Refs: nodejs#39043 PR-URL: nodejs#42394 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Mestery <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Akhil Marsonya <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
Refs: #39043 PR-URL: #42394 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Mestery <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Akhil Marsonya <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
Refs: #39043 PR-URL: #42394 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Mestery <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Akhil Marsonya <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
Refs: #39043 PR-URL: #42394 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Mestery <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Akhil Marsonya <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
Refs: #39043 PR-URL: #42394 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Mestery <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Akhil Marsonya <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
Refs: nodejs/node#39043 PR-URL: nodejs/node#42394 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Mestery <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Akhil Marsonya <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
This updates the use of esm examples in the documentation to cover more core modules while encouraging the use of Buffer and process imports / requires where possible, instead of saying that this is unnecessary. It does not deprecate or say that the global forms are deprecated though.
Summary:
@nodejs/modules