Skip to content
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: packages docs feedback #35370

Closed
wants to merge 9 commits into from

Conversation

guybedford
Copy link
Contributor

This PR brings through the deferred feedback from #34748 from myself and @isaacs.

I carefully ensured to mention all items brought up there in this PR including renaming "package scope" to "package boundary" and adding a summary section to the list of fields.

Further review suggestions very welcome. This should then unblock #34970 and subsequent PRs from release.

@nodejs/modules-active-members @nodejs/documentation @aduh95

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the doc Issues and PRs related to the documentations. label Sep 27, 2020
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/modules


Since `"not:valid"` is not a valid specifier, `"./submodule.js"` is used
instead as the fallback, as if it were the only target.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per @isaacs's comment this also removes documentation on package fallbacks. This may or may not be controversial to the modules group though but I tend to agree with the sentiment of simplifying the outward documentation for this already-complex field.

Copy link
Contributor

@DerekNonGeneric DerekNonGeneric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for following through.

Copy link
Contributor

@aduh95 aduh95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for doing this!

doc/api/packages.md Outdated Show resolved Hide resolved
doc/api/packages.md Show resolved Hide resolved
doc/api/packages.md Outdated Show resolved Hide resolved
Comment on lines -563 to +548
A package could also switch from CommonJS to ES module syntax in a breaking
change version bump. This has the disadvantage that the newest version
of the package would only be usable in ES module-supporting versions of Node.js.
A package could also switch from CommonJS to ES module syntax in a [breaking
change](https://semver.org/) version bump. This has the disadvantage that the
newest version of the package would only be usable in ES module-supporting
versions of Node.js.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a note to help users find the relevant info? Somebody who's new to Node.js may ask themself what are the ESM-supporting versions.
That could go in a separate PR as I see there is no History section at the top of esm.md.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sounds like a section on compatibility via a new PR would be useful to users actually. Perhaps esm.md could get a history or we could add a module compatibility section that mentions what levels of ESM support can be expected where.

Copy link
Contributor

@aduh95 aduh95 Sep 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO for myself: add a reference to the support table on #35395 if this PR lands first.

doc/api/packages.md Outdated Show resolved Hide resolved
@guybedford
Copy link
Contributor Author

@aduh95 thanks for the review, feedback added.

doc/api/packages.md Outdated Show resolved Hide resolved
Copy link
Member

@GeoffreyBooth GeoffreyBooth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@guybedford please take a look. After this I don’t think there should be any remaining references to “scope” or “boundary”, please let me know if I missed any.

doc/api/packages.md Outdated Show resolved Hide resolved
doc/api/packages.md Outdated Show resolved Hide resolved
doc/api/packages.md Outdated Show resolved Hide resolved
doc/api/packages.md Outdated Show resolved Hide resolved
doc/api/packages.md Outdated Show resolved Hide resolved
doc/api/packages.md Outdated Show resolved Hide resolved
doc/api/packages.md Outdated Show resolved Hide resolved
doc/api/packages.md Outdated Show resolved Hide resolved
doc/api/packages.md Outdated Show resolved Hide resolved
doc/api/packages.md Outdated Show resolved Hide resolved
guybedford and others added 3 commits September 27, 2020 23:05
Co-authored-by: Geoffrey Booth <456802+GeoffreyBooth@users.noreply.github.com>
Co-authored-by: Geoffrey Booth <456802+GeoffreyBooth@users.noreply.github.com>
@guybedford
Copy link
Contributor Author

@GeoffreyBooth yes that's all cases of boundary now removed.

Copy link
Member

@GeoffreyBooth GeoffreyBooth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@guybedford Thanks for working with me on this.

Do we want to link the various “nearest parent package.json“ references to the new “package.json and file extensions” section?

@guybedford
Copy link
Contributor Author

guybedford commented Sep 28, 2020 via email

doc/api/packages.md Outdated Show resolved Hide resolved
@GeoffreyBooth
Copy link
Member

Possibly that can be a subsequent PR? Also note that that section no longer covers the lookup algorithm though.

Can certainly come later, if we think it’s a good idea at all. Not everything needs to be a link.

And you’re right, it should link to the “"type"“ section. That’s where the algorithm is defined.

@aduh95 aduh95 mentioned this pull request Sep 28, 2020
3 tasks
@guybedford guybedford added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Sep 29, 2020
* [`"type"`][] - The package type determining whether to load `.js` files as
CommonJS or ES modules.
* [`"exports"`][] - Package exports and conditional exports. When present,
limits which submodules may be loaded from within the package.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
limits which submodules may be loaded from within the package.
limits which submodules can be loaded from within the package.

subpaths of the package will no longer be available to importers under
`require('pkg/subpath.js')`, and instead they will get a new error,
`ERR_PACKAGE_PATH_NOT_EXPORTED`.
When defining the [`"exports"`][] field, all subpaths of the package will be
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When defining the [`"exports"`][] field, all subpaths of the package will be
When defining the [`"exports"`][] field, all subpaths of the package are

...or perhaps:

Suggested change
When defining the [`"exports"`][] field, all subpaths of the package will be
When the [`"exports"`][] field is defined, all subpaths of the package are

`ERR_PACKAGE_PATH_NOT_EXPORTED`.
When defining the [`"exports"`][] field, all subpaths of the package will be
encapsulated and no longer available to importers. For example,
`require('pkg/subpath.js')` would throw an [`ERR_PACKAGE_PATH_NOT_EXPORTED`][]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`require('pkg/subpath.js')` would throw an [`ERR_PACKAGE_PATH_NOT_EXPORTED`][]
`require('pkg/subpath.js')` throws an [`ERR_PACKAGE_PATH_NOT_EXPORTED`][]

Copy link
Member

@Trott Trott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some micro-nit suggestions, but this looks good to me with or without them.

MylesBorins pushed a commit that referenced this pull request Sep 29, 2020
PR-URL: #35370
Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@MylesBorins
Copy link
Member

landed in 4d7015f

@Trott I totally missed your suggestions, apologies. Can you include in a follow up? (I can do this too)

MylesBorins pushed a commit that referenced this pull request Sep 29, 2020
PR-URL: #35370
Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Sep 29, 2020
@Trott Trott mentioned this pull request Sep 30, 2020
2 tasks
@Trott
Copy link
Member

Trott commented Sep 30, 2020

@Trott I totally missed your suggestions, apologies. Can you include in a follow up?

Sure. #35427

None of them were blocking anyway, so no big deal.

Trott added a commit to Trott/io.js that referenced this pull request Oct 3, 2020
Some minor adjustments, mostly moving things to present tense and
avoiding the ambiguity of _may_.

Refs: nodejs#35370 (comment)

PR-URL: nodejs#35427
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
danielleadams pushed a commit that referenced this pull request Oct 6, 2020
Some minor adjustments, mostly moving things to present tense and
avoiding the ambiguity of _may_.

Refs: #35370 (comment)

PR-URL: #35427
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
aduh95 pushed a commit to aduh95/node that referenced this pull request Oct 23, 2020
PR-URL: nodejs#35370
Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
aduh95 pushed a commit to aduh95/node that referenced this pull request Oct 23, 2020
Some minor adjustments, mostly moving things to present tense and
avoiding the ambiguity of _may_.

Refs: nodejs#35370 (comment)

PR-URL: nodejs#35427
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request Nov 3, 2020
Backport-PR-URL: #35757
PR-URL: #35370
Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
MylesBorins pushed a commit that referenced this pull request Nov 3, 2020
Some minor adjustments, mostly moving things to present tense and
avoiding the ambiguity of _may_.

Refs: #35370 (comment)

Backport-PR-URL: #35757
PR-URL: #35427
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Nov 3, 2020
MylesBorins pushed a commit that referenced this pull request Nov 16, 2020
Backport-PR-URL: #35757
PR-URL: #35370
Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
MylesBorins pushed a commit that referenced this pull request Nov 16, 2020
Some minor adjustments, mostly moving things to present tense and
avoiding the ambiguity of _may_.

Refs: #35370 (comment)

Backport-PR-URL: #35757
PR-URL: #35427
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
joesepi pushed a commit to joesepi/node that referenced this pull request Jan 8, 2021
PR-URL: nodejs#35370
Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
joesepi pushed a commit to joesepi/node that referenced this pull request Jan 8, 2021
Some minor adjustments, mostly moving things to present tense and
avoiding the ambiguity of _may_.

Refs: nodejs#35370 (comment)

PR-URL: nodejs#35427
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. doc Issues and PRs related to the documentations.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants