babel-plugin-jsx-dom-expressions 0.34.7 → 0.34.10
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 -9
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -288,7 +288,7 @@ function isDynamic(path, { checkMember, checkTags, checkCallExpressions = true,
|
|
|
288
288
|
return false;
|
|
289
289
|
}
|
|
290
290
|
if (
|
|
291
|
-
(checkCallExpressions && t__namespace.isCallExpression(expr)) ||
|
|
291
|
+
(checkCallExpressions && (t__namespace.isCallExpression(expr) || t__namespace.isOptionalCallExpression(expr))) ||
|
|
292
292
|
(checkMember &&
|
|
293
293
|
(t__namespace.isMemberExpression(expr) ||
|
|
294
294
|
t__namespace.isOptionalMemberExpression(expr) ||
|
|
@@ -309,6 +309,9 @@ function isDynamic(path, { checkMember, checkTags, checkCallExpressions = true,
|
|
|
309
309
|
CallExpression(p) {
|
|
310
310
|
checkCallExpressions && (dynamic = true) && p.stop();
|
|
311
311
|
},
|
|
312
|
+
OptionalCallExpression(p) {
|
|
313
|
+
checkCallExpressions && (dynamic = true) && p.stop();
|
|
314
|
+
},
|
|
312
315
|
MemberExpression(p) {
|
|
313
316
|
checkMember && (dynamic = true) && p.stop();
|
|
314
317
|
},
|
|
@@ -1970,10 +1973,10 @@ function transformChildren$1(path, results, { hydratable }) {
|
|
|
1970
1973
|
appendToTemplate(results.template, child.template);
|
|
1971
1974
|
results.templateValues.push.apply(results.templateValues, child.templateValues || []);
|
|
1972
1975
|
if (child.exprs.length) {
|
|
1973
|
-
if (!doNotEscape) child.exprs[0] = escapeExpression(path, child.exprs[0]);
|
|
1976
|
+
if (!doNotEscape && !child.spreadElement) child.exprs[0] = escapeExpression(path, child.exprs[0]);
|
|
1974
1977
|
|
|
1975
1978
|
// boxed by textNodes
|
|
1976
|
-
if (markers) {
|
|
1979
|
+
if (markers && !child.spreadElement) {
|
|
1977
1980
|
appendToTemplate(results.template, `<!--#-->`);
|
|
1978
1981
|
results.template.push("");
|
|
1979
1982
|
results.templateValues.push(child.exprs[0]);
|
|
@@ -1990,9 +1993,6 @@ function createElement(path, { topLevel, hydratable }) {
|
|
|
1990
1993
|
const tagName = getTagName(path.node),
|
|
1991
1994
|
config = getConfig(path),
|
|
1992
1995
|
attributes = normalizeAttributes(path);
|
|
1993
|
-
isDynamic(path, {
|
|
1994
|
-
checkMember: true
|
|
1995
|
-
});
|
|
1996
1996
|
|
|
1997
1997
|
const filteredChildren = filterChildren(path.get("children")),
|
|
1998
1998
|
multi = checkLength(filteredChildren),
|
|
@@ -2014,7 +2014,7 @@ function createElement(path, { topLevel, hydratable }) {
|
|
|
2014
2014
|
if (attributes.length === 1) {
|
|
2015
2015
|
transformed = attributes[0].node.argument;
|
|
2016
2016
|
} else {
|
|
2017
|
-
transformed = t__namespace.objectExpression(
|
|
2017
|
+
transformed = t__namespace.arrowFunctionExpression([], t__namespace.objectExpression(
|
|
2018
2018
|
attributes.reduce((memo, attribute) => {
|
|
2019
2019
|
const node = attribute.node;
|
|
2020
2020
|
|
|
@@ -2058,7 +2058,7 @@ function createElement(path, { topLevel, hydratable }) {
|
|
|
2058
2058
|
}
|
|
2059
2059
|
return memo;
|
|
2060
2060
|
}, [])
|
|
2061
|
-
);
|
|
2061
|
+
));
|
|
2062
2062
|
}
|
|
2063
2063
|
|
|
2064
2064
|
const exprs = [
|
|
@@ -2078,7 +2078,7 @@ function createElement(path, { topLevel, hydratable }) {
|
|
|
2078
2078
|
t__namespace.booleanLiteral(Boolean(topLevel && config.hydratable))
|
|
2079
2079
|
])
|
|
2080
2080
|
];
|
|
2081
|
-
return { exprs, template: "" };
|
|
2081
|
+
return { exprs, template: "", spreadElement: true };
|
|
2082
2082
|
}
|
|
2083
2083
|
|
|
2084
2084
|
function transformElement$1(path, info) {
|
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.34.
|
|
4
|
+
"version": "0.34.10",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@babel/core": "^7.0.0"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "0964d1754dea73a9e5d28d3780f9d14cee11bee3"
|
|
31
31
|
}
|