babel-plugin-jsx-dom-expressions 0.32.8 → 0.32.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 +11 -12
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -286,6 +286,9 @@ function isDynamic(path, { checkMember, checkTags, checkCallExpressions = true,
|
|
|
286
286
|
let dynamic;
|
|
287
287
|
path.traverse({
|
|
288
288
|
Function(p) {
|
|
289
|
+
if (t__namespace.isObjectMethod(p.node) && p.node.computed) {
|
|
290
|
+
dynamic = isDynamic(p.get("key"), { checkMember, checkTags, checkCallExpressions, native });
|
|
291
|
+
}
|
|
289
292
|
p.skip();
|
|
290
293
|
},
|
|
291
294
|
CallExpression(p) {
|
|
@@ -774,7 +777,7 @@ function transformAttributes$2(path, results) {
|
|
|
774
777
|
values.push(t__namespace.logicalExpression("||", attr.value.expression, t__namespace.stringLiteral("")));
|
|
775
778
|
quasis.push(t__namespace.TemplateElement({ raw: isLast ? "" : " " }));
|
|
776
779
|
}
|
|
777
|
-
i && attributes.splice(classAttributes[i]
|
|
780
|
+
i && attributes.splice(attributes.indexOf(classAttributes[i]), 1);
|
|
778
781
|
}
|
|
779
782
|
if (values.length) first.value = t__namespace.JSXExpressionContainer(t__namespace.TemplateLiteral(quasis, values));
|
|
780
783
|
else first.value = t__namespace.stringLiteral(quasis[0].value.raw);
|
|
@@ -1642,7 +1645,7 @@ function transformAttributes$1(path, results) {
|
|
|
1642
1645
|
if (attr.name.name === "classList") {
|
|
1643
1646
|
if (t__namespace.isObjectExpression(expr) && !expr.properties.some(p => t__namespace.isSpreadElement(p))) {
|
|
1644
1647
|
transformClasslistObject(path, expr, values, quasis);
|
|
1645
|
-
i && attributes.splice(attributes.indexOf(classAttributes[i]
|
|
1648
|
+
i && attributes.splice(attributes.indexOf(classAttributes[i]), 1);
|
|
1646
1649
|
continue;
|
|
1647
1650
|
}
|
|
1648
1651
|
expr = t__namespace.callExpression(registerImportMethod(path, "ssrClassList"), [expr]);
|
|
@@ -1650,7 +1653,7 @@ function transformAttributes$1(path, results) {
|
|
|
1650
1653
|
values.push(t__namespace.logicalExpression("||", expr, t__namespace.stringLiteral("")));
|
|
1651
1654
|
quasis.push(t__namespace.TemplateElement({ raw: isLast ? "" : " " }));
|
|
1652
1655
|
}
|
|
1653
|
-
i && attributes.splice(attributes.indexOf(classAttributes[i]
|
|
1656
|
+
i && attributes.splice(attributes.indexOf(classAttributes[i]), 1);
|
|
1654
1657
|
}
|
|
1655
1658
|
first.value = t__namespace.JSXExpressionContainer(t__namespace.TemplateLiteral(quasis, values));
|
|
1656
1659
|
}
|
|
@@ -2215,11 +2218,7 @@ function convertComponentIdentifier(node) {
|
|
|
2215
2218
|
} else if (t__namespace.isJSXMemberExpression(node)) {
|
|
2216
2219
|
const prop = convertComponentIdentifier(node.property);
|
|
2217
2220
|
const computed = t__namespace.isStringLiteral(prop);
|
|
2218
|
-
return t__namespace.memberExpression(
|
|
2219
|
-
convertComponentIdentifier(node.object),
|
|
2220
|
-
prop,
|
|
2221
|
-
computed
|
|
2222
|
-
);
|
|
2221
|
+
return t__namespace.memberExpression(convertComponentIdentifier(node.object), prop, computed);
|
|
2223
2222
|
}
|
|
2224
2223
|
|
|
2225
2224
|
return node;
|
|
@@ -2272,7 +2271,10 @@ function transformComponent(path) {
|
|
|
2272
2271
|
isDynamic(attribute.get("argument"), {
|
|
2273
2272
|
checkMember: true
|
|
2274
2273
|
}) && (dynamicSpread = true)
|
|
2275
|
-
? t__namespace.isCallExpression(node.argument) &&
|
|
2274
|
+
? t__namespace.isCallExpression(node.argument) &&
|
|
2275
|
+
!node.argument.arguments.length &&
|
|
2276
|
+
!t__namespace.isCallExpression(node.argument.callee) &&
|
|
2277
|
+
!t__namespace.isMemberExpression(node.argument.callee)
|
|
2276
2278
|
? node.argument.callee
|
|
2277
2279
|
: t__namespace.arrowFunctionExpression([], node.argument)
|
|
2278
2280
|
: node.argument
|
|
@@ -2510,9 +2512,6 @@ function transformThis(path) {
|
|
|
2510
2512
|
ThisExpression(path) {
|
|
2511
2513
|
thisId || (thisId = path.scope.generateUidIdentifier("self$"));
|
|
2512
2514
|
path.replaceWith(thisId);
|
|
2513
|
-
},
|
|
2514
|
-
Function(p) {
|
|
2515
|
-
p.skip();
|
|
2516
2515
|
}
|
|
2517
2516
|
});
|
|
2518
2517
|
return node => {
|
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.32.
|
|
4
|
+
"version": "0.32.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": "d4b76380fe65699d7d57b99df26247ddf56561f5"
|
|
27
27
|
}
|