Skip to content

Commit 43c3d9f

Browse files
authored
doc: link to Runtime Keys in export conditions
This commit: 1. Adds a link to the WinterCG Runtime Keys proposal draft spec in the documentation for the `export` condition. 2. Adds a criteria to add more export conditions to the Node.js docs: they should be Node.js core-relevant. 3. Removes the "deno" and "react-native" export conditions from the core docs with the expectation that readers will follow the link to the Runtime Keys proposal draft spec to learn about them and more. PR-URL: #48408 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 51ca71c commit 43c3d9f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

doc/api/packages.md

+9-4
Original file line numberDiff line numberDiff line change
@@ -704,18 +704,17 @@ is provided below to assist with ecosystem coordination.
704704

705705
* `"types"` - can be used by typing systems to resolve the typing file for
706706
the given export. _This condition should always be included first._
707-
* `"deno"` - indicates a variation for the Deno platform.
708707
* `"browser"` - any web browser environment.
709-
* `"react-native"` - will be matched by the React Native framework (all
710-
platforms). _To target React Native for Web, `"browser"` should be specified
711-
before this condition._
712708
* `"development"` - can be used to define a development-only environment
713709
entry point, for example to provide additional debugging context such as
714710
better error messages when running in a development mode. _Must always be
715711
mutually exclusive with `"production"`._
716712
* `"production"` - can be used to define a production environment entry
717713
point. _Must always be mutually exclusive with `"development"`._
718714

715+
For other runtimes, platform-specific condition key definitions are maintained
716+
by the [WinterCG][] in the [Runtime Keys][] proposal specification.
717+
719718
New conditions definitions may be added to this list by creating a pull request
720719
to the [Node.js documentation for this section][]. The requirements for listing
721720
a new condition definition here are that:
@@ -729,6 +728,10 @@ a new condition definition here are that:
729728
benefit to the ecosystem that wouldn't otherwise be possible. For example,
730729
this would not necessarily be the case for company-specific or
731730
application-specific conditions.
731+
* The condition should be such that a Node.js user would expect it to be in
732+
Node.js core documentation. The `"types"` condition is a good example: It
733+
doesn't really belong in the [Runtime Keys][] proposal but is a good fit
734+
here in the Node.js docs.
732735

733736
The above definitions may be moved to a dedicated conditions registry in due
734737
course.
@@ -1325,6 +1328,8 @@ This field defines [subpath imports][] for the current package.
13251328
[ES module]: esm.md
13261329
[ES modules]: esm.md
13271330
[Node.js documentation for this section]: https://github.com/nodejs/node/blob/HEAD/doc/api/packages.md#conditions-definitions
1331+
[Runtime Keys]: https://runtime-keys.proposal.wintercg.org/
1332+
[WinterCG]: https://wintercg.org/
13281333
[`"exports"`]: #exports
13291334
[`"imports"`]: #imports
13301335
[`"main"`]: #main

0 commit comments

Comments
 (0)