babel-plugin-jsx-dom-expressions 0.31.9 → 0.31.11
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.
- package/index.js +9 -7
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -2197,18 +2197,21 @@ function wrapDynamics(path, dynamics) {
|
|
|
2197
2197
|
|
|
2198
2198
|
function convertComponentIdentifier(node) {
|
|
2199
2199
|
if (t__namespace.isJSXIdentifier(node)) {
|
|
2200
|
-
node.type = "Identifier";
|
|
2200
|
+
if (t__namespace.isValidIdentifier(node.name)) node.type = "Identifier";
|
|
2201
|
+
else return t__namespace.stringLiteral(node.name);
|
|
2201
2202
|
} else if (t__namespace.isJSXMemberExpression(node)) {
|
|
2203
|
+
const prop = convertComponentIdentifier(node.property);
|
|
2204
|
+
const computed = t__namespace.isStringLiteral(prop);
|
|
2202
2205
|
return t__namespace.memberExpression(
|
|
2203
2206
|
convertComponentIdentifier(node.object),
|
|
2204
|
-
|
|
2207
|
+
prop,
|
|
2208
|
+
computed
|
|
2205
2209
|
);
|
|
2206
2210
|
}
|
|
2207
2211
|
|
|
2208
2212
|
return node;
|
|
2209
2213
|
}
|
|
2210
2214
|
|
|
2211
|
-
|
|
2212
2215
|
function convertJSXIdentifier(node) {
|
|
2213
2216
|
if (t__namespace.isJSXIdentifier(node)) {
|
|
2214
2217
|
if (t__namespace.isValidIdentifier(node.name)) {
|
|
@@ -2219,7 +2222,7 @@ function convertJSXIdentifier(node) {
|
|
|
2219
2222
|
} else if (t__namespace.isJSXMemberExpression(node)) {
|
|
2220
2223
|
return t__namespace.memberExpression(
|
|
2221
2224
|
convertJSXIdentifier(node.object),
|
|
2222
|
-
convertJSXIdentifier(node.property)
|
|
2225
|
+
convertJSXIdentifier(node.property)
|
|
2223
2226
|
);
|
|
2224
2227
|
} else if (t__namespace.isJSXNamespacedName(node)) {
|
|
2225
2228
|
return t__namespace.stringLiteral(`${node.namespace.name}:${node.name.name}`);
|
|
@@ -2425,7 +2428,7 @@ function transformComponentChildren(children, config) {
|
|
|
2425
2428
|
return memo;
|
|
2426
2429
|
}, []);
|
|
2427
2430
|
|
|
2428
|
-
if (
|
|
2431
|
+
if (transformedChildren.length === 1) {
|
|
2429
2432
|
transformedChildren = transformedChildren[0];
|
|
2430
2433
|
if (
|
|
2431
2434
|
!t__namespace.isJSXExpressionContainer(filteredChildren[0]) &&
|
|
@@ -2455,7 +2458,6 @@ function transformFragmentChildren(children, results, config) {
|
|
|
2455
2458
|
? createTemplate$1
|
|
2456
2459
|
: createTemplate$2,
|
|
2457
2460
|
filteredChildren = filterChildren(children),
|
|
2458
|
-
singleChild = filteredChildren.length === 1,
|
|
2459
2461
|
childNodes = filteredChildren.reduce((memo, path) => {
|
|
2460
2462
|
if (t__namespace.isJSXText(path.node)) {
|
|
2461
2463
|
const v = htmlEntities.decode(trimWhitespace(path.node.extra.raw));
|
|
@@ -2466,7 +2468,7 @@ function transformFragmentChildren(children, results, config) {
|
|
|
2466
2468
|
}
|
|
2467
2469
|
return memo;
|
|
2468
2470
|
}, []);
|
|
2469
|
-
results.exprs.push(
|
|
2471
|
+
results.exprs.push(childNodes.length === 1 ? childNodes[0] : t__namespace.arrayExpression(childNodes));
|
|
2470
2472
|
}
|
|
2471
2473
|
|
|
2472
2474
|
function transformJSX(path) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babel-plugin-jsx-dom-expressions",
|
|
3
3
|
"description": "A JSX to DOM plugin that wraps expressions for fine grained change detection",
|
|
4
|
-
"version": "0.31.
|
|
4
|
+
"version": "0.31.11",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -23,5 +23,5 @@
|
|
|
23
23
|
"@babel/types": "^7.16.0",
|
|
24
24
|
"html-entities": "2.3.2"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "fd496194eaf6d4155f2fc27bf4a90bc3ed44b1ac"
|
|
27
27
|
}
|