-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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: add node protocol to ESM and CommonJS api examples #38620
doc: add node protocol to ESM and CommonJS api examples #38620
Conversation
I'll make sure to clean up those markdown lint issues. |
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 although depending on collaborator consensus, landing may have to wait.
@nodejs/documentation |
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.
These all look great, thanks.
Well, as @ljharb said, wait until node protocol is backported to LTS. I had not seen that comment yet. |
Are there plans to backport |
@Trott, core modules should be documented this way. I would say to give it some time for people to gain awareness. I am not aware of any other prior discussions about it though. |
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.
@jeromecovington, here is a second-pass review. I will have to get back to you once I have the answer to this, but perhaps @GeoffreyBooth knows what should be stated in these code blocks?
doc/api/esm.md
Outdated
@@ -340,11 +340,11 @@ module default import or its corresponding sugar syntax: | |||
|
|||
<!-- eslint-disable no-duplicate-imports --> | |||
```js | |||
import { default as cjs } from 'cjs'; | |||
import { default as cjs } from 'node:cjs'; |
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.
This seems wrong to me after looking at it again. There is no core module named cjs
.
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.
Thanks I'll be sure to fix 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.
@DerekNonGeneric I fixed this, and a couple other instances of node:cjs
.
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.
/cc @nodejs/modules if anyone knows why the code blocks here have a cjs
specifier
b2b6fa5
to
8e6349f
Compare
@jeromecovington I don't know how this pull request is going to play out, but thank you for your patience and diligence on this, whatever happens! |
Requested changes have been addressed.
@jasnell You seemed to express support for something like this in #38343 (comment). What do you think of this PR? |
@guybedford Given #38343 (comment), I'm guessing there's nothing that can be done in this PR to address your reservation expressed there. But if I'm wrong, please do indicate what might happen to make this PR something you endorse, or at least don't have any significant reservations about. |
I'm in favor of the change but there's no particular rush on it |
@jeromecovington Thanks for the email ping. If you're up for rebasing to address all the conflicts, this may be ready to go. @guybedford Is @aduh95 |
@Trott yes I wouldn't block this PR anymore personally. |
fwiw use of |
@ljharb do you have examples of such reports? How is it breaking? I think we could reach out to the maintainers of the tools that don't handle those correctly to gather more feedback on this. |
@aduh95 one reason is that the |
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'm generally +1 on this change but I think we should wait until 12.x reaches end of LTS support in April 2020. Let's mark this PR blocked until then.
@jeromecovington With Node.js v18.0.0 around the corner and Node.js v12.x fading to EOL next month, I think we should consider landing this soon. Would you be available to rebase your branch on top of |
@aduh95 from what I can tell the conflicts are mostly around the addition of cjs/mjs dependency-style code blocks. I should have some time to take care of that later this week or this weekend. Thanks for the heads up. |
The conflicts are now so significant that I think we'll have better luck just cutting a fresh branch off of master and redoing this work, rather than working toward resolving. I can take a look at that later or if someone else has time, I'm happy to shut down this PR in favor of a more up to date approach. |
FWIW you don't have to create a new PR to start fresh. You can run the following command when on this PR branch: git fetch https://github.com/nodejs/node.git master
git reset FETCH_HEAD --hard
# now your local git repo is in a fresh state
# and when you're done:
git commit
git push --force-with-lease That being said, if creating a new PR is more convenient for you, you can certainly do that – whatever you do, I'm grateful for the work you're putting to improve Node.js docs :) |
We should add this to the contributors’ guide. |
This PR addresses #38343. As far as I can tell that issue may have only been concerned with updating the
node:
protocol for ESM examples, but I think it makes sense to update for CommonJS examples as well, as it seems to me that it also works for that. I'm not sure if there are other areas of the docs other than the api examples that need this change, that's all I've looked at so far.