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

Add detection of logical assignment operators to react-native-babel-preset #39186

Closed
wants to merge 1 commit into from

Conversation

jonthysell
Copy link
Contributor

Summary:

Though not currently in use in the RN code, when react-native-windows tried to integrate changes up to 7/28/23 (see PR microsoft/react-native-windows#11970) there happened to be a ??= operator in the virtualized-lists package (see diff here). (The offending line was removed in a later commit).

The default RNW engine is still Chakra and it couldn't handle the syntax. It looks like the @babel/plugin-proposal-nullish-coalescing-operator plugin only handles ??, so to handle ??= I've added @babel/plugin-proposal-logical-assignment-operators, which also happens to handle the logical assignment operators ||= and &&=.

Closes #31704

Changelog:

[GENERAL] [FIXED] - Add detection of logical assignment operators to react-native-babel-preset

Test Plan:

We started using these plugins in RNW's babel config to resolve the issue in our integrate PR.

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Microsoft Partner: Microsoft Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Aug 28, 2023
@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 8,960,709 -14
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 9,554,817 -7
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: 0c25f19
Branch: main

@facebook-github-bot
Copy link
Contributor

@rozele has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@rozele
Copy link
Contributor

rozele commented Nov 3, 2023

Rumor has it Chakra support is getting dropped from react-native-windows, closing this PR for now.

@rozele rozele closed this Nov 3, 2023
@rozele
Copy link
Contributor

rozele commented Nov 3, 2023

Re-opening while we assess whether this is applicable to JSC.

Copy link

github-actions bot commented Nov 6, 2023

This pull request was successfully merged by @jonthysell in c90485e.

When will my fix make it into a release? | Upcoming Releases

@github-actions github-actions bot added the Merged This PR has been merged. label Nov 6, 2023
Othinn pushed a commit to Othinn/react-native that referenced this pull request Jan 9, 2024
…preset` (facebook#39186)

Summary:
Though not currently in use in the RN code, when `react-native-windows` tried to integrate changes up to 7/28/23 (see PR microsoft/react-native-windows#11970) there happened to be a `??=` operator in the `virtualized-lists` package (see [diff here](facebook/react-native@ccc50dd...c168a4f#diff-abeff2daf5909e54a23562e43569de1d5b8db1d7170119eed485b618cdf04ec7R322)). (The offending line was removed in a later commit).

The default RNW engine is still Chakra and it couldn't handle the syntax. It looks like the `babel/plugin-proposal-nullish-coalescing-operator` plugin only handles `??`, so to handle `??=` I've added `babel/plugin-proposal-logical-assignment-operators`, which also happens to handle the logical assignment operators `||=` and `&&=`.

Closes facebook#31704

## Changelog:

[GENERAL] [FIXED] - Add detection of logical assignment operators to `react-native-babel-preset`

Pull Request resolved: facebook#39186

Test Plan: We started using these plugins in RNW's babel config to resolve the issue in our integrate PR.

Reviewed By: motiz88

Differential Revision: D50936554

Pulled By: rozele

fbshipit-source-id: 0a924b6085524d8c9551a158b91195b1f7448c19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. p: Microsoft Partner: Microsoft Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No Support for Logical OR Assignment ||=
4 participants