babel-plugin-jsx-dom-expressions 0.37.19 → 0.37.21
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 +29 -13
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -159,6 +159,7 @@ const SVGElements = /*#__PURE__*/ new Set([
|
|
|
159
159
|
"feDiffuseLighting",
|
|
160
160
|
"feDisplacementMap",
|
|
161
161
|
"feDistantLight",
|
|
162
|
+
"feDropShadow",
|
|
162
163
|
"feFlood",
|
|
163
164
|
"feFuncA",
|
|
164
165
|
"feFuncB",
|
|
@@ -1216,7 +1217,7 @@ function transformAttributes$2(path, results) {
|
|
|
1216
1217
|
)
|
|
1217
1218
|
)
|
|
1218
1219
|
);
|
|
1219
|
-
} else
|
|
1220
|
+
} else {
|
|
1220
1221
|
const refIdentifier = path.scope.generateUidIdentifier("_ref$");
|
|
1221
1222
|
results.exprs.unshift(
|
|
1222
1223
|
t__namespace.variableDeclaration("var", [
|
|
@@ -1444,6 +1445,7 @@ function transformAttributes$2(path, results) {
|
|
|
1444
1445
|
}
|
|
1445
1446
|
|
|
1446
1447
|
let text = value.value;
|
|
1448
|
+
if (typeof text === "number") text = String(text);
|
|
1447
1449
|
let needsQuoting = false;
|
|
1448
1450
|
|
|
1449
1451
|
if (key === "style" || key === "class") {
|
|
@@ -1925,11 +1927,16 @@ function wrapDynamics$1(path, dynamics) {
|
|
|
1925
1927
|
const effectWrapperId = registerImportMethod(path, config.effectWrapper);
|
|
1926
1928
|
|
|
1927
1929
|
if (dynamics.length === 1) {
|
|
1930
|
+
let dynamicStyle;
|
|
1928
1931
|
const prevValue =
|
|
1929
|
-
dynamics[0].key === "classList" ||
|
|
1932
|
+
dynamics[0].key === "classList" ||
|
|
1933
|
+
dynamics[0].key === "style" ||
|
|
1934
|
+
(dynamicStyle = dynamics[0].key.startsWith("style:"))
|
|
1930
1935
|
? t__namespace.identifier("_$p")
|
|
1931
1936
|
: undefined;
|
|
1932
|
-
if (
|
|
1937
|
+
if (dynamicStyle) {
|
|
1938
|
+
dynamics[0].value = t__namespace.assignmentExpression("=", prevValue, dynamics[0].value);
|
|
1939
|
+
} else if (
|
|
1933
1940
|
dynamics[0].key.startsWith("class:") &&
|
|
1934
1941
|
!t__namespace.isBooleanLiteral(dynamics[0].value) &&
|
|
1935
1942
|
!t__namespace.isUnaryExpression(dynamics[0].value)
|
|
@@ -2796,7 +2803,7 @@ function transformAttributes(path, results) {
|
|
|
2796
2803
|
)
|
|
2797
2804
|
)
|
|
2798
2805
|
);
|
|
2799
|
-
} else
|
|
2806
|
+
} else {
|
|
2800
2807
|
const refIdentifier = path.scope.generateUidIdentifier("_ref$");
|
|
2801
2808
|
results.exprs.unshift(
|
|
2802
2809
|
t__namespace.variableDeclaration("var", [
|
|
@@ -3468,11 +3475,11 @@ function transformThis(path) {
|
|
|
3468
3475
|
}
|
|
3469
3476
|
},
|
|
3470
3477
|
JSXElement(path) {
|
|
3471
|
-
let source = path.get(
|
|
3478
|
+
let source = path.get("openingElement").get("name");
|
|
3472
3479
|
while (source.isJSXMemberExpression()) {
|
|
3473
|
-
source = source.get(
|
|
3480
|
+
source = source.get("object");
|
|
3474
3481
|
}
|
|
3475
|
-
if (source.isJSXIdentifier() && source.node.name ===
|
|
3482
|
+
if (source.isJSXIdentifier() && source.node.name === "this") {
|
|
3476
3483
|
const current = getTargetFunctionParent(path, parent);
|
|
3477
3484
|
if (current === parent) {
|
|
3478
3485
|
thisId || (thisId = path.scope.generateUidIdentifier("self$"));
|
|
@@ -3483,15 +3490,23 @@ function transformThis(path) {
|
|
|
3483
3490
|
}
|
|
3484
3491
|
}
|
|
3485
3492
|
}
|
|
3486
|
-
}
|
|
3493
|
+
}
|
|
3487
3494
|
});
|
|
3488
3495
|
return node => {
|
|
3489
3496
|
if (thisId) {
|
|
3490
|
-
parent.
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3497
|
+
if (!parent || parent.block.type === "ClassMethod") {
|
|
3498
|
+
const stmt = path.getStatementParent();
|
|
3499
|
+
const decl = t__namespace.variableDeclaration("const", [
|
|
3500
|
+
t__namespace.variableDeclarator(thisId, t__namespace.thisExpression())
|
|
3501
|
+
]);
|
|
3502
|
+
stmt.insertBefore(decl);
|
|
3503
|
+
} else {
|
|
3504
|
+
parent.push({
|
|
3505
|
+
id: thisId,
|
|
3506
|
+
init: t__namespace.thisExpression(),
|
|
3507
|
+
kind: "const"
|
|
3508
|
+
});
|
|
3509
|
+
}
|
|
3495
3510
|
}
|
|
3496
3511
|
return node;
|
|
3497
3512
|
};
|
|
@@ -3546,6 +3561,7 @@ function transformNode(path, info = {}) {
|
|
|
3546
3561
|
: !info.componentChild &&
|
|
3547
3562
|
(config.generate !== "ssr" || info.fragmentChild) &&
|
|
3548
3563
|
t__namespace.isCallExpression(node.expression) &&
|
|
3564
|
+
!t__namespace.isCallExpression(node.expression.callee) &&
|
|
3549
3565
|
!t__namespace.isMemberExpression(node.expression.callee) &&
|
|
3550
3566
|
node.expression.arguments.length === 0
|
|
3551
3567
|
? node.expression.callee
|
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.37.
|
|
4
|
+
"version": "0.37.21",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@babel/core": "^7.20.12"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "38ad815b0c610b936ad140ed5c230afe4419d3b7"
|
|
35
35
|
}
|