Allow multiple __self/__source props with classic JSX runtime (#12475)
This commit is contained in:
parent
e8176de528
commit
1ef9e196d3
@ -862,7 +862,6 @@ You can set \`throwIfNamespace: false\` to bypass this warning.`,
|
||||
|
||||
let props = [];
|
||||
const objs = [];
|
||||
const found = Object.create(null);
|
||||
|
||||
for (const attr of attribs) {
|
||||
const name =
|
||||
@ -870,10 +869,8 @@ You can set \`throwIfNamespace: false\` to bypass this warning.`,
|
||||
t.isJSXIdentifier(attr.name) &&
|
||||
attr.name.name;
|
||||
|
||||
if (name === "__source" || name === "__self") {
|
||||
if (found[name]) throw sourceSelfError(path, name);
|
||||
found[name] = true;
|
||||
if (!options.development) continue;
|
||||
if (!options.development && (name === "__source" || name === "__self")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (useSpread || !t.isJSXSpreadAttribute(attr)) {
|
||||
|
||||
@ -0,0 +1 @@
|
||||
<div/>
|
||||
@ -0,0 +1,3 @@
|
||||
module.exports = () => ({
|
||||
presets: [["@babel/preset-react", { development: true }]],
|
||||
});
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"presets": [["@babel/preset-react", { "development": true }], "./my-preset"],
|
||||
"os": ["linux", "darwin"]
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
var _jsxFileName = "<CWD>/packages/babel-preset-react/test/fixtures/regression/runtime-classic-allow-multiple-source-self/input.mjs",
|
||||
_jsxFileName2 = "<CWD>/packages/babel-preset-react/test/fixtures/regression/runtime-classic-allow-multiple-source-self/input.mjs";
|
||||
|
||||
/*#__PURE__*/
|
||||
React.createElement("div", {
|
||||
__self: this,
|
||||
__source: {
|
||||
fileName: _jsxFileName,
|
||||
lineNumber: 1,
|
||||
columnNumber: 1
|
||||
},
|
||||
__self: this,
|
||||
__source: {
|
||||
fileName: _jsxFileName2,
|
||||
lineNumber: 1,
|
||||
columnNumber: 1
|
||||
}
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user