Add bugfix plugin for Safari array rest destructuring bug#17788
Conversation
|
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: |
|
I run |
|
I just come up with a new idea that will further shrink the extra footprint to 2 bytes, let me give it a try. |
|
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... |
7fd51c2 to
2c1ad94
Compare
Backport of f1a708c Co-authored-by: Nicolò Ribaudo <[email protected]>
Backport of f1a708c Co-authored-by: Nicolò Ribaudo <[email protected]>
Backport of f1a708c Co-authored-by: Nicolò Ribaudo <[email protected]>
Backport of f1a708c Co-authored-by: Nicolò Ribaudo <[email protected]>
Backport of f1a708c Co-authored-by: Nicolò Ribaudo <[email protected]>
Backport of f1a708c Co-authored-by: Nicolò Ribaudo <[email protected]>
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.