babel-plugin-jsx-dom-expressions 0.33.11 → 0.33.12
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 +24 -18
- package/package.json +5 -2
package/index.js
CHANGED
|
@@ -311,6 +311,9 @@ function isDynamic(path, { checkMember, checkTags, checkCallExpressions = true,
|
|
|
311
311
|
OptionalMemberExpression(p) {
|
|
312
312
|
checkMember && (dynamic = true) && p.stop();
|
|
313
313
|
},
|
|
314
|
+
SpreadElement(p) {
|
|
315
|
+
checkMember && (dynamic = true) && p.stop();
|
|
316
|
+
},
|
|
314
317
|
JSXElement(p) {
|
|
315
318
|
checkTags ? (dynamic = true) && p.stop() : p.skip();
|
|
316
319
|
},
|
|
@@ -1043,9 +1046,11 @@ function transformAttributes$2(path, results) {
|
|
|
1043
1046
|
}
|
|
1044
1047
|
} else if (
|
|
1045
1048
|
config.effectWrapper &&
|
|
1046
|
-
isDynamic(attribute.get("value").get("expression"), {
|
|
1049
|
+
(isDynamic(attribute.get("value").get("expression"), {
|
|
1047
1050
|
checkMember: true
|
|
1048
|
-
})
|
|
1051
|
+
}) ||
|
|
1052
|
+
((key === "classList" || key === "style") &&
|
|
1053
|
+
!attribute.get("value").get("expression").evaluate().confident))
|
|
1049
1054
|
) {
|
|
1050
1055
|
let nextElem = elem;
|
|
1051
1056
|
if (key === "value" || key === "checked") {
|
|
@@ -1093,7 +1098,7 @@ function transformAttributes$2(path, results) {
|
|
|
1093
1098
|
} else {
|
|
1094
1099
|
!isSVG && (key = key.toLowerCase());
|
|
1095
1100
|
results.template += ` ${key}`;
|
|
1096
|
-
results.template += value ? `="${escapeBackticks(value.value)}"` : "";
|
|
1101
|
+
results.template += value ? `="${escapeBackticks(escapeHTML(value.value, true))}"` : "";
|
|
1097
1102
|
}
|
|
1098
1103
|
}
|
|
1099
1104
|
});
|
|
@@ -1110,21 +1115,22 @@ function transformChildren$2(path, results, config) {
|
|
|
1110
1115
|
nextPlaceholder,
|
|
1111
1116
|
i = 0;
|
|
1112
1117
|
const filteredChildren = filterChildren(path.get("children")),
|
|
1113
|
-
childNodes = filteredChildren
|
|
1114
|
-
.
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1118
|
+
childNodes = filteredChildren.reduce((memo, child, index) => {
|
|
1119
|
+
if (child.isJSXFragment()) {
|
|
1120
|
+
throw new Error(
|
|
1121
|
+
`Fragments can only be used top level in JSX. Not used under a <${tagName}>.`
|
|
1122
|
+
);
|
|
1123
|
+
}
|
|
1124
|
+
const transformed = transformNode(child, {
|
|
1125
|
+
skipId: !results.id || !detectExpressions(filteredChildren, index, config)
|
|
1126
|
+
});
|
|
1127
|
+
if (!transformed) return memo;
|
|
1128
|
+
const i = memo.length;
|
|
1129
|
+
if (transformed.text && i && memo[i - 1].text) {
|
|
1130
|
+
memo[i - 1].template += transformed.template;
|
|
1131
|
+
} else memo.push(transformed);
|
|
1132
|
+
return memo;
|
|
1133
|
+
}, []);
|
|
1128
1134
|
|
|
1129
1135
|
childNodes.forEach((child, index) => {
|
|
1130
1136
|
if (!child) return;
|
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.33.
|
|
4
|
+
"version": "0.33.12",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -23,5 +23,8 @@
|
|
|
23
23
|
"@babel/types": "^7.16.0",
|
|
24
24
|
"html-entities": "2.3.2"
|
|
25
25
|
},
|
|
26
|
-
"
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"@babel/core": "^7.0.0"
|
|
28
|
+
},
|
|
29
|
+
"gitHead": "3c593d43147a73ddd52c58ba8c49f4f1e0e7e560"
|
|
27
30
|
}
|