Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: skip flattening spread object with __proto__ (#14759)
* fix: skip flattening spread object with __proto__ * update Babel 8 testcases * fix single spread element optimization * Update packages/babel-plugin-transform-react-jsx/src/create-plugin.ts Co-authored-by: Nicol貌 Ribaudo <nicolo.ribaudo@gmail.com> * update test fixtures Co-authored-by: Nicol貌 Ribaudo <nicolo.ribaudo@gmail.com>
- Loading branch information
1 parent
770c22f
commit ff6304b
Showing
15 changed files
with
117 additions
and
7 deletions.
There are no files selected for viewing
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
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
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
3 changes: 3 additions & 0 deletions
3
...lugin-transform-react-jsx/test/fixtures/react-automatic/handle-spread-with-proto/input.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<p {...{__proto__: null}}>text</p>; | ||
|
||
<div {...{"__proto__": null}}>{contents}</div>; |
15 changes: 15 additions & 0 deletions
15
...gin-transform-react-jsx/test/fixtures/react-automatic/handle-spread-with-proto/output.mjs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
|
||
/*#__PURE__*/ | ||
_jsx("p", { ...{ | ||
__proto__: null | ||
}, | ||
children: "text" | ||
}); | ||
|
||
/*#__PURE__*/ | ||
_jsx("div", { ...{ | ||
"__proto__": null | ||
}, | ||
children: contents | ||
}); |
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
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
3 changes: 3 additions & 0 deletions
3
...-plugin-transform-react-jsx/test/fixtures/react/handle-spread-with-proto-babel-7/input.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<p {...{__proto__: null}}>text</p>; | ||
|
||
<div {...{"__proto__": null}}>{contents}</div>; |
3 changes: 3 additions & 0 deletions
3
...gin-transform-react-jsx/test/fixtures/react/handle-spread-with-proto-babel-7/options.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"BABEL_8_BREAKING": false | ||
} |
9 changes: 9 additions & 0 deletions
9
...plugin-transform-react-jsx/test/fixtures/react/handle-spread-with-proto-babel-7/output.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/*#__PURE__*/ | ||
React.createElement("p", babelHelpers.extends({ | ||
__proto__: null | ||
}), "text"); | ||
|
||
/*#__PURE__*/ | ||
React.createElement("div", babelHelpers.extends({ | ||
"__proto__": null | ||
}), contents); |
3 changes: 3 additions & 0 deletions
3
...es/babel-plugin-transform-react-jsx/test/fixtures/react/handle-spread-with-proto/input.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<p {...{__proto__: null}}>text</p>; | ||
|
||
<div {...{"__proto__": null}}>{contents}</div>; |
3 changes: 3 additions & 0 deletions
3
...abel-plugin-transform-react-jsx/test/fixtures/react/handle-spread-with-proto/options.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"BABEL_8_BREAKING": true | ||
} |
11 changes: 11 additions & 0 deletions
11
...s/babel-plugin-transform-react-jsx/test/fixtures/react/handle-spread-with-proto/output.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/*#__PURE__*/ | ||
React.createElement("p", { ...{ | ||
__proto__: null | ||
} | ||
}, "text"); | ||
|
||
/*#__PURE__*/ | ||
React.createElement("div", { ...{ | ||
"__proto__": null | ||
} | ||
}, contents); |
1 change: 1 addition & 0 deletions
1
...ages/babel-plugin-transform-react-jsx/test/fixtures/react/proto-in-jsx-attribute/input.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<p __proto__={null} class="bar">text</p>; |
5 changes: 5 additions & 0 deletions
5
...ges/babel-plugin-transform-react-jsx/test/fixtures/react/proto-in-jsx-attribute/output.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/*#__PURE__*/ | ||
React.createElement("p", { | ||
__proto__: null, | ||
class: "bar" | ||
}, "text"); |