Add bugfix plugin for Safari array rest destructuring bug#17788
Merged
nicolo-ribaudo merged 6 commits intobabel:mainfrom Mar 7, 2026
Merged
Add bugfix plugin for Safari array rest destructuring bug#17788nicolo-ribaudo merged 6 commits intobabel:mainfrom
nicolo-ribaudo merged 6 commits intobabel:mainfrom
Conversation
Collaborator
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/61141 |
e6dc800 to
5d7ec11
Compare
5d7ec11 to
c4c4d20
Compare
|
commit: |
Member
|
I run |
Contributor
Author
|
I just come up with a new idea that will further shrink the extra footprint to 2 bytes, let me give it a try. |
Contributor
Author
|
Never mind, the new approach is to unshift hole elements into both array, but that would break TSSatisfiesExpression since the array composition is changed. However, either approach would change the completion value of an assignment expression, which would otherwise be kept by the trailling comma approach. But this approach would not survive from minifiers... |
liuxingbaoyu
approved these changes
Feb 19, 2026
7fd51c2 to
2c1ad94
Compare
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.
In this PR we introduce a new bugfix plugin
@babel/plugin-bugfix-safari-rest-destructuring-rhs-array, which detects the affected code patterns by this Safari bug and transform the affected code such thatThis plugin is also added to the
preset-env. In Babel 8, thebugfixesoption is always enabled, so if users ever targeted affected Safari versions from 9 to 13.1, this plugin will be enabled automatically to avoid triggering the specific Webkit bug.This PR is currently blocked by #17787 as the CI is failing. I will rebase once that PR gets merged.