mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
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: https://github.com/nodejs/node/pull/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>
This commit is contained in:
1 parent
6c590835f3
commit
2a403cdad5
1 file changed
+9
-4
+9
-4
@@ -704,11 +704,7 @@ is provided below to assist with ecosystem coordination.
|
||||
|
||||
* `"types"` - can be used by typing systems to resolve the typing file for
|
||||
the given export. _This condition should always be included first._
|
||||
* `"deno"` - indicates a variation for the Deno platform.
|
||||
* `"browser"` - any web browser environment.
|
||||
* `"react-native"` - will be matched by the React Native framework (all
|
||||
platforms). _To target React Native for Web, `"browser"` should be specified
|
||||
before this condition._
|
||||
* `"development"` - can be used to define a development-only environment
|
||||
entry point, for example to provide additional debugging context such as
|
||||
better error messages when running in a development mode. _Must always be
|
||||
@@ -716,6 +712,9 @@ is provided below to assist with ecosystem coordination.
|
||||
* `"production"` - can be used to define a production environment entry
|
||||
point. _Must always be mutually exclusive with `"development"`._
|
||||
|
||||
For other runtimes, platform-specific condition key definitions are maintained
|
||||
by the [WinterCG][] in the [Runtime Keys][] proposal specification.
|
||||
|
||||
New conditions definitions may be added to this list by creating a pull request
|
||||
to the [Node.js documentation for this section][]. The requirements for listing
|
||||
a new condition definition here are that:
|
||||
@@ -729,6 +728,10 @@ a new condition definition here are that:
|
||||
benefit to the ecosystem that wouldn't otherwise be possible. For example,
|
||||
this would not necessarily be the case for company-specific or
|
||||
application-specific conditions.
|
||||
* The condition should be such that a Node.js user would expect it to be in
|
||||
Node.js core documentation. The `"types"` condition is a good example: It
|
||||
doesn't really belong in the [Runtime Keys][] proposal but is a good fit
|
||||
here in the Node.js docs.
|
||||
|
||||
The above definitions may be moved to a dedicated conditions registry in due
|
||||
course.
|
||||
@@ -1325,6 +1328,8 @@ This field defines [subpath imports][] for the current package.
|
||||
[ES module]: esm.md
|
||||
[ES modules]: esm.md
|
||||
[Node.js documentation for this section]: https://github.com/nodejs/node/blob/HEAD/doc/api/packages.md#conditions-definitions
|
||||
[Runtime Keys]: https://runtime-keys.proposal.wintercg.org/
|
||||
[WinterCG]: https://wintercg.org/
|
||||
[`"exports"`]: #exports
|
||||
[`"imports"`]: #imports
|
||||
[`"main"`]: #main
|
||||
|
||||
Reference in new issue
Block a user