From f8ba672c7bc6a514ed0501d757fa3cd40b19e144 Mon Sep 17 00:00:00 2001 From: Jacob Hummer Date: Mon, 19 Jun 2023 21:24:27 -0500 Subject: [PATCH] doc: link to Runtime Keys in export conditions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-By: Luigi Pinca Reviewed-By: Geoffrey Booth Reviewed-By: Jacob Smith Reviewed-By: Yagiz Nizipli Reviewed-By: Tobias Nießen Reviewed-By: James M Snell --- doc/api/packages.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/api/packages.md b/doc/api/packages.md index 58d6e97be20292..09f32e6c160892 100644 --- a/doc/api/packages.md +++ b/doc/api/packages.md @@ -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