babel-plugin-jsx-dom-expressions 0.32.17 → 0.33.0
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 +28 -25
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -594,7 +594,7 @@ function setAttr$2(path, elem, name, value, { isSVG, dynamic, prevId, isCE }) {
|
|
|
594
594
|
}
|
|
595
595
|
|
|
596
596
|
if (!isSVG && name === "class") {
|
|
597
|
-
return t__namespace.
|
|
597
|
+
return t__namespace.callExpression(registerImportMethod(path, "className", getRendererConfig(path, "dom").moduleName), [elem, value]);
|
|
598
598
|
}
|
|
599
599
|
|
|
600
600
|
if (name === "classList") {
|
|
@@ -1557,7 +1557,7 @@ function toAttribute(key, isSVG) {
|
|
|
1557
1557
|
return key;
|
|
1558
1558
|
}
|
|
1559
1559
|
|
|
1560
|
-
function setAttr$1(results, name, value, isSVG) {
|
|
1560
|
+
function setAttr$1(attribute, results, name, value, isSVG) {
|
|
1561
1561
|
// strip out namespaces for now, everything at this point is an attribute
|
|
1562
1562
|
let parts;
|
|
1563
1563
|
if ((parts = name.split(":")) && parts[1] && reservedNameSpaces.has(parts[0])) {
|
|
@@ -1565,9 +1565,18 @@ function setAttr$1(results, name, value, isSVG) {
|
|
|
1565
1565
|
}
|
|
1566
1566
|
|
|
1567
1567
|
name = toAttribute(name, isSVG);
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1568
|
+
const attr = t__namespace.callExpression(registerImportMethod(attribute, "ssrAttribute"), [
|
|
1569
|
+
t__namespace.stringLiteral(name),
|
|
1570
|
+
value,
|
|
1571
|
+
t__namespace.booleanLiteral(false)
|
|
1572
|
+
]);
|
|
1573
|
+
if (results.template[results.template.length - 1].length) {
|
|
1574
|
+
results.template.push("");
|
|
1575
|
+
results.templateValues.push(attr);
|
|
1576
|
+
} else {
|
|
1577
|
+
const last = results.templateValues.length - 1;
|
|
1578
|
+
results.templateValues[last] = t__namespace.binaryExpression("+", results.templateValues[last], attr);
|
|
1579
|
+
}
|
|
1571
1580
|
}
|
|
1572
1581
|
|
|
1573
1582
|
function escapeExpression(path, expression, attr) {
|
|
@@ -1754,23 +1763,15 @@ function transformAttributes$1(path, results) {
|
|
|
1754
1763
|
children = value;
|
|
1755
1764
|
if (key === "innerHTML") path.doNotEscape = true;
|
|
1756
1765
|
} else {
|
|
1757
|
-
let
|
|
1758
|
-
doEscape = true;
|
|
1759
|
-
if (
|
|
1760
|
-
isDynamic(attribute.get("value").get("expression"), {
|
|
1761
|
-
checkMember: true,
|
|
1762
|
-
native: true
|
|
1763
|
-
})
|
|
1764
|
-
)
|
|
1765
|
-
dynamic = true;
|
|
1766
|
-
|
|
1766
|
+
let doEscape = true;
|
|
1767
1767
|
if (BooleanAttributes.has(key)) {
|
|
1768
1768
|
results.template.push("");
|
|
1769
|
-
const fn = t__namespace.callExpression(registerImportMethod(attribute, "
|
|
1769
|
+
const fn = t__namespace.callExpression(registerImportMethod(attribute, "ssrAttribute"), [
|
|
1770
1770
|
t__namespace.stringLiteral(key),
|
|
1771
|
-
value.expression
|
|
1771
|
+
value.expression,
|
|
1772
|
+
t__namespace.booleanLiteral(true)
|
|
1772
1773
|
]);
|
|
1773
|
-
results.templateValues.push(
|
|
1774
|
+
results.templateValues.push(fn);
|
|
1774
1775
|
return;
|
|
1775
1776
|
}
|
|
1776
1777
|
if (key === "style") {
|
|
@@ -1829,13 +1830,15 @@ function transformAttributes$1(path, results) {
|
|
|
1829
1830
|
key = "class";
|
|
1830
1831
|
doEscape = false;
|
|
1831
1832
|
}
|
|
1832
|
-
if (
|
|
1833
|
-
value.expression =
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
);
|
|
1837
|
-
|
|
1838
|
-
|
|
1833
|
+
if (doEscape)
|
|
1834
|
+
value.expression = escapeExpression(path, value.expression, true);
|
|
1835
|
+
|
|
1836
|
+
if (!doEscape || t__namespace.isLiteral(value.expression) || t__namespace.isBinaryExpression(value.expression)) {
|
|
1837
|
+
key = toAttribute(key, isSVG);
|
|
1838
|
+
appendToTemplate(results.template, ` ${key}="`);
|
|
1839
|
+
results.template.push(`"`);
|
|
1840
|
+
results.templateValues.push(value.expression);
|
|
1841
|
+
} else setAttr$1(attribute, results, key, value.expression, isSVG);
|
|
1839
1842
|
}
|
|
1840
1843
|
} else {
|
|
1841
1844
|
if (key === "$ServerOnly") 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.
|
|
4
|
+
"version": "0.33.0",
|
|
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": "1f388eacd1601e06e84689837a5363f13ae5ffe7"
|
|
27
27
|
}
|