babel-plugin-jsx-dom-expressions 0.35.9 → 0.35.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 +27 -1
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1735,9 +1735,31 @@ function createTemplate$1(path, result) {
|
|
|
1735
1735
|
});
|
|
1736
1736
|
} else id = found.id;
|
|
1737
1737
|
|
|
1738
|
+
if (result.wontEscape) {
|
|
1739
|
+
if (!Array.isArray(result.template) || result.template.length === 1) return id;
|
|
1740
|
+
else if (
|
|
1741
|
+
Array.isArray(result.template) &&
|
|
1742
|
+
result.template.length === 2 &&
|
|
1743
|
+
result.templateValues[0].type === "CallExpression" &&
|
|
1744
|
+
result.templateValues[0].callee.name === "_$ssrHydrationKey"
|
|
1745
|
+
) {
|
|
1746
|
+
// remove unnecessary ssr call when only hydration key is used
|
|
1747
|
+
return t__namespace.binaryExpression(
|
|
1748
|
+
"+",
|
|
1749
|
+
t__namespace.binaryExpression(
|
|
1750
|
+
"+",
|
|
1751
|
+
t__namespace.memberExpression(id, t__namespace.numericLiteral(0), true),
|
|
1752
|
+
result.templateValues[0]
|
|
1753
|
+
),
|
|
1754
|
+
t__namespace.memberExpression(id, t__namespace.numericLiteral(1), true)
|
|
1755
|
+
);
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1738
1758
|
return t__namespace.callExpression(
|
|
1739
1759
|
registerImportMethod(path, "ssr"),
|
|
1740
|
-
Array.isArray(result.template) && result.template.length > 1
|
|
1760
|
+
Array.isArray(result.template) && result.template.length > 1
|
|
1761
|
+
? [id, ...result.templateValues]
|
|
1762
|
+
: [id]
|
|
1741
1763
|
);
|
|
1742
1764
|
}
|
|
1743
1765
|
|
|
@@ -1772,6 +1794,7 @@ function transformElement$2(path, info) {
|
|
|
1772
1794
|
exprs: [],
|
|
1773
1795
|
dynamics: [],
|
|
1774
1796
|
tagName,
|
|
1797
|
+
wontEscape: path.node.wontEscape,
|
|
1775
1798
|
renderer: "ssr"
|
|
1776
1799
|
};
|
|
1777
1800
|
|
|
@@ -1890,6 +1913,9 @@ function escapeExpression(path, expression, attr, escapeLiterals) {
|
|
|
1890
1913
|
} else
|
|
1891
1914
|
expression.callee.body = escapeExpression(path, expression.callee.body, attr, escapeLiterals);
|
|
1892
1915
|
return expression;
|
|
1916
|
+
} else if(t__namespace.isJSXElement(expression) && !isComponent(getTagName(expression))) {
|
|
1917
|
+
expression.wontEscape = true;
|
|
1918
|
+
return expression;
|
|
1893
1919
|
}
|
|
1894
1920
|
|
|
1895
1921
|
return t__namespace.callExpression(
|
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.35.
|
|
4
|
+
"version": "0.35.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": "fa02473265bc994e8f858ae60be40527a584c66f"
|
|
31
31
|
}
|