@vitejs/plugin-react 2.1.0-beta.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -73,6 +73,8 @@ function babelRestoreJsx({ types: t }, { reactAlias = "React" }) {
|
|
73
73
|
getJSXIdentifier(prop.key),
|
74
74
|
getJSXAttributeValue(prop.value)
|
75
75
|
) : t.jsxSpreadAttribute(prop.argument)
|
76
|
+
).filter(
|
77
|
+
(prop) => t.isJSXIdentifier(prop.name) ? prop.name.name !== "__self" && prop.name.name !== "__source" : true
|
76
78
|
);
|
77
79
|
}
|
78
80
|
function getJSXChild(node) {
|
@@ -71,6 +71,8 @@ function babelRestoreJsx({ types: t }, { reactAlias = "React" }) {
|
|
71
71
|
getJSXIdentifier(prop.key),
|
72
72
|
getJSXAttributeValue(prop.value)
|
73
73
|
) : t.jsxSpreadAttribute(prop.argument)
|
74
|
+
).filter(
|
75
|
+
(prop) => t.isJSXIdentifier(prop.name) ? prop.name.name !== "__self" && prop.name.name !== "__source" : true
|
74
76
|
);
|
75
77
|
}
|
76
78
|
function getJSXChild(node) {
|
package/package.json
CHANGED
@@ -115,4 +115,18 @@ describe('babel-restore-jsx', () => {
|
|
115
115
|
`"React.createElement(aaa);"`
|
116
116
|
)
|
117
117
|
})
|
118
|
+
|
119
|
+
it('should not handle contains __self prop', () => {
|
120
|
+
expect(
|
121
|
+
jsx('React.createElement(Provider, { __self: this })')
|
122
|
+
).toMatchInlineSnapshot('"<Provider />;"')
|
123
|
+
})
|
124
|
+
|
125
|
+
it('should not handle contains __source prop', () => {
|
126
|
+
expect(
|
127
|
+
jsx(
|
128
|
+
'React.createElement(Provider, { __source: { fileName: _jsxFileName, lineNumber: 133 }})'
|
129
|
+
)
|
130
|
+
).toMatchInlineSnapshot('"<Provider />;"')
|
131
|
+
})
|
118
132
|
})
|
@@ -126,14 +126,20 @@ export default function (
|
|
126
126
|
if (!isPlainObjectExpression(node)) {
|
127
127
|
return null
|
128
128
|
}
|
129
|
-
return node.properties
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
129
|
+
return node.properties
|
130
|
+
.map((prop: any) =>
|
131
|
+
t.isObjectProperty(prop)
|
132
|
+
? t.jsxAttribute(
|
133
|
+
getJSXIdentifier(prop.key)!,
|
134
|
+
getJSXAttributeValue(prop.value)
|
135
|
+
)
|
136
|
+
: t.jsxSpreadAttribute(prop.argument)
|
137
|
+
)
|
138
|
+
.filter((prop: any) =>
|
139
|
+
t.isJSXIdentifier(prop.name)
|
140
|
+
? prop.name.name !== '__self' && prop.name.name !== '__source'
|
141
|
+
: true
|
142
|
+
)
|
137
143
|
}
|
138
144
|
|
139
145
|
function getJSXChild(node: any) {
|