-
Notifications
You must be signed in to change notification settings - Fork 642
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
Use Object.assign
instead of Babel _extends
#745
Closed
newyankeecodeshop
wants to merge
2
commits into
facebook:main
from
newyankeecodeshop:preset-object-assign
Closed
Use Object.assign
instead of Babel _extends
#745
newyankeecodeshop
wants to merge
2
commits into
facebook:main
from
newyankeecodeshop:preset-object-assign
+95
−52
Conversation
This file contains 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
ericanderson
reviewed
Feb 1, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
@rh389 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
facebook-github-bot
pushed a commit
to facebook/react-native
that referenced
this pull request
Feb 11, 2022
Summary: React Native has an *implicit* dev dependency on this transform via `metro-react-native-babel-transformer`. The transform replaces `Object.assign` with `babelHelpers.extend`, but `Object.assign` has been available natively since node 4. We intend remove it from metro (facebook/metro#745) as it's no longer needed by any supported runtime - removing RN's small dependency in advance so RN's tests won't break when we do. Changelog: [Internal][Changed] - Remove `babel/plugin-transform-object-assign` from jest preprocessor Reviewed By: motiz88 Differential Revision: D34110208 fbshipit-source-id: 064f8241461fb338de1cd8b53077e8660301aa77
Thanks again @newyankeecodeshop 👍 |
nevilm-lt
pushed a commit
to nevilm-lt/metro
that referenced
this pull request
Mar 14, 2022
Summary: **Summary** All React Native JavaScript runtimes, as well as Node, implement `Object.assign()`. This PR removes the transform and configures plugins to use `Object.assign` instead of injecting the Babel helper `_extends()`. This simplifies the generated code, and it aligns JavaScriptCore users more closely with Hermes, which doesn't use several of the plugins. The following plugins generate code using `Object.assign` directly: - `transform-destructuring` - `proposal-object-rest-spread` - `transform-react-jsx` **Test plan** I added a unit test to verify the new behavior. The Babel `_extends` helper already uses Object.assign if it exists, so the runtime behavior will be identical. ``` _extends = Object.assign || function (target) { ... } ``` Pull Request resolved: facebook#745 Reviewed By: motiz88 Differential Revision: D34074342 Pulled By: rh389 fbshipit-source-id: dc416d9b40877da49f6966c5c6708b99fa0ce492
nevilm-lt
pushed a commit
to nevilm-lt/metro
that referenced
this pull request
Apr 21, 2022
Summary: **Summary** All React Native JavaScript runtimes, as well as Node, implement `Object.assign()`. This PR removes the transform and configures plugins to use `Object.assign` instead of injecting the Babel helper `_extends()`. This simplifies the generated code, and it aligns JavaScriptCore users more closely with Hermes, which doesn't use several of the plugins. The following plugins generate code using `Object.assign` directly: - `transform-destructuring` - `proposal-object-rest-spread` - `transform-react-jsx` **Test plan** I added a unit test to verify the new behavior. The Babel `_extends` helper already uses Object.assign if it exists, so the runtime behavior will be identical. ``` _extends = Object.assign || function (target) { ... } ``` Pull Request resolved: facebook#745 Reviewed By: motiz88 Differential Revision: D34074342 Pulled By: rh389 fbshipit-source-id: dc416d9b40877da49f6966c5c6708b99fa0ce492
nevilm-lt
pushed a commit
to nevilm-lt/metro
that referenced
this pull request
Apr 22, 2022
Summary: **Summary** All React Native JavaScript runtimes, as well as Node, implement `Object.assign()`. This PR removes the transform and configures plugins to use `Object.assign` instead of injecting the Babel helper `_extends()`. This simplifies the generated code, and it aligns JavaScriptCore users more closely with Hermes, which doesn't use several of the plugins. The following plugins generate code using `Object.assign` directly: - `transform-destructuring` - `proposal-object-rest-spread` - `transform-react-jsx` **Test plan** I added a unit test to verify the new behavior. The Babel `_extends` helper already uses Object.assign if it exists, so the runtime behavior will be identical. ``` _extends = Object.assign || function (target) { ... } ``` Pull Request resolved: facebook#745 Reviewed By: motiz88 Differential Revision: D34074342 Pulled By: rh389 fbshipit-source-id: dc416d9b40877da49f6966c5c6708b99fa0ce492
Saadnajmi
pushed a commit
to Saadnajmi/react-native-macos
that referenced
this pull request
Jan 15, 2023
Summary: React Native has an *implicit* dev dependency on this transform via `metro-react-native-babel-transformer`. The transform replaces `Object.assign` with `babelHelpers.extend`, but `Object.assign` has been available natively since node 4. We intend remove it from metro (facebook/metro#745) as it's no longer needed by any supported runtime - removing RN's small dependency in advance so RN's tests won't break when we do. Changelog: [Internal][Changed] - Remove `babel/plugin-transform-object-assign` from jest preprocessor Reviewed By: motiz88 Differential Revision: D34110208 fbshipit-source-id: 064f8241461fb338de1cd8b53077e8660301aa77
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.
Shared with Meta
Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
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.
Summary
All React Native JavaScript runtimes, as well as Node, implement
Object.assign()
. This PR removes the transform and configures plugins to useObject.assign
instead of injecting the Babel helper_extends()
. This simplifies the generated code, and it aligns JavaScriptCore users more closely with Hermes, which doesn't use several of the plugins.The following plugins generate code using
Object.assign
directly:transform-destructuring
proposal-object-rest-spread
transform-react-jsx
Test plan
I added a unit test to verify the new behavior.
The Babel
_extends
helper already uses Object.assign if it exists, so the runtime behavior will be identical.