Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.4k
doc: crypto esm examples#37594
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: crypto esm examples #37594
Uh oh!
There was an error while loading. Please reload this page.
Conversation
Trott commented Mar 4, 2021
Should be unblocked once #37604 lands. |
aduh95 commented Mar 4, 2021
@jasnell I've pushed updates to your branch to use |
2e9ebce to c97c7f0Comparejasnell commented Mar 4, 2021
Thank you! :-) |
aduh95 left a comment
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.
As with #37607, non blocking comments.
For some reason my brain sees no issue with named import for crypto (same as fs), but there's something special with assert 🤷♂️
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Signed-off-by: James M Snell <[email protected]>
c97c7f0 to 8dbdd1aCompare
panva left a comment • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
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 think the examples should use the lexical import keyword.
- Are builds without crypto that common that all esm samples need to account for crypto missing?
- cjs -> esm transition is ongoing and top level
await import('crypto')cannot be transpiled to CJS, the samples will be a source of frustration for developers when used in their code.
jasnell commented Mar 9, 2021
Likely not but I'd rather that folks look at this and ask why it's different than be surprised later when it doesn't work. And, to be fair, I'd like to use this as a good reason to revisit how we do this -- I'd much rather the |
benjamingr left a comment
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 went over most of these examples, I only tried running a few. It would be really cool if our examples ran
jasnell commented Mar 10, 2021
@panva ... Would you mind if we went ahead with this PR as is (using the |
panva commented Mar 10, 2021 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
👍 |
jasnell commented Mar 11, 2021
Landed in bfa6e37 |
Signed-off-by: James M Snell <[email protected]> PR-URL: #37594 Refs: #37162 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Filip Skokan <[email protected]>
Signed-off-by: James M Snell <[email protected]> PR-URL: #37594 Refs: #37162 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Filip Skokan <[email protected]>
Signed-off-by: James M Snell <[email protected]> PR-URL: #37594 Refs: #37162 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Filip Skokan <[email protected]>
The original example used 'return' to terminate the current control flow, which is valid in CommonJS. When the example was copied and modified to use MJS syntax, the 'return' statement was left in but is not allowed. Refs: nodejs#37594
The original example used 'return' to terminate the current control flow, which is valid in CommonJS. When the example was copied and modified to use MJS syntax, the 'return' statement was left in but is not allowed. Refs: #37594 PR-URL: #39949 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
The original example used 'return' to terminate the current control flow, which is valid in CommonJS. When the example was copied and modified to use MJS syntax, the 'return' statement was left in but is not allowed. Refs: #37594 PR-URL: #39949 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
The original example used 'return' to terminate the current control flow, which is valid in CommonJS. When the example was copied and modified to use MJS syntax, the 'return' statement was left in but is not allowed. Refs: #37594 PR-URL: #39949 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
Add ESM examples to
cryptodocs in preparation for #37162 landing.Blocked for now until nodejs/remark-preset-lint-node#176 lands.
Refs: #37162
/cc @aduh95
Signed-off-by: James M Snell [email protected]