doc: define "react-native" community condition#45367
Merged
nodejs-github-bot merged 1 commit intonodejs:mainfrom Nov 28, 2022
huntie:react-native-community-condition
Merged
doc: define "react-native" community condition#45367nodejs-github-bot merged 1 commit intonodejs:mainfrom huntie:react-native-community-condition
nodejs-github-bot merged 1 commit intonodejs:mainfrom
huntie:react-native-community-condition
Conversation
Collaborator
|
Review requested:
|
ljharb
approved these changes
Nov 7, 2022
Member
|
There’s a spec in progress for this: nodejs/tooling#166. I assume we should defer to that spec? cc @nodejs/tsc @guybedford |
Member
|
+1, but this submission aligns with it so far afaict. |
mcollina
approved these changes
Nov 8, 2022
Member
mcollina
left a comment
There was a problem hiding this comment.
generically +1, with the WinterCG caveat
Contributor
Author
@GeoffreyBooth Thanks for raising, we also gave input on the WinterCG spec. Worth noting that
|
legendecas
approved these changes
Nov 9, 2022
hybrist
approved these changes
Nov 9, 2022
targos
approved these changes
Nov 9, 2022
jasnell
approved these changes
Nov 16, 2022
Contributor
Author
|
Hi all, is this good to merge? :) |
Collaborator
|
Landed in d09f0c4 |
ErickWendel
pushed a commit
to ErickWendel/node
that referenced
this pull request
Nov 30, 2022
PR-URL: nodejs#45367 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
pushed a commit
that referenced
this pull request
Dec 12, 2022
PR-URL: #45367 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
danielleadams
pushed a commit
that referenced
this pull request
Dec 30, 2022
PR-URL: #45367 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
danielleadams
pushed a commit
that referenced
this pull request
Dec 30, 2022
PR-URL: #45367 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
danielleadams
pushed a commit
that referenced
this pull request
Jan 3, 2023
PR-URL: #45367 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
danielleadams
pushed a commit
that referenced
this pull request
Jan 4, 2023
PR-URL: #45367 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
danielleadams
pushed a commit
that referenced
this pull request
Jan 5, 2023
PR-URL: #45367 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'm a React Native maintainer working on Metro, our first-party JavaScript bundler. Here I'm proposing the inclusion of a
"react-native"condition under the "Community Conditions Definitions" section of Node's docs.This is linked to our framework proposal for package exports support: react-native-community/discussions-and-proposals#534.
Why this condition is needed
React Native is a popular platform within the JS ecosystem, where code can be executed in non-browser environments, such as our Hermes JavaScript engine. When package maintainers want to target React Native, we have historically provided a top-level
"react-native"root field withinpackage.json— which was an extension of the"browser"field spec (now itself a community condition).e.g. Used by pusher-js:
As with
"browser", we are aiming to translate"react-native"to the conditional exports concept.What the
"react-native"condition will representThese are unchanged from current use of the
"react-native"root field.What will change when this is used as a condition via
"exports":"exports"allows packages to define the order of conditional exports, package maintainers will have more fine-grained control over what is selected for their package (e.g. matching before, or after,"browser").Prior usage
Use of
"react-native"root fieldThis is a popular feature and is used by both React Native-specific libraries and larger multiplatform libraries (such as the above pusher-js example). Searching across GitHub, use of the top-level
"react-native"field for specifying alternate source files is present in ~20k repositories.Use of
"react-native"package exports conditionWebpack already lists
"react-native"under its docs for Package exports, which is enabled when configured by the user or in templates under React Native projects.From this we can infer there is independent desire for such a condition, and perhaps limited use today. The definition it provides is "TBD", leaving us to provide the concrete and canonical definition with this PR.
How we teach this
Once "exports" support is ready in Metro:
With the merging of this PR: