babel-plugin-jsx-dom-expressions 0.36.0-beta.2 → 0.36.0-beta.3
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 +35 -29
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -647,7 +647,7 @@ function transformElement$3(path, info) {
|
|
|
647
647
|
results.template += ">";
|
|
648
648
|
if (!voidTag) {
|
|
649
649
|
transformChildren$2(path, results, config);
|
|
650
|
-
results.template += `</${tagName}>`;
|
|
650
|
+
if (!info.lastElement) results.template += `</${tagName}>`;
|
|
651
651
|
}
|
|
652
652
|
if (info.topLevel && config.hydratable && results.hasHydratableEvent) {
|
|
653
653
|
let runHydrationEvents = registerImportMethod(
|
|
@@ -1185,10 +1185,19 @@ function transformAttributes$2(path, results) {
|
|
|
1185
1185
|
t__namespace.variableDeclarator(nextElem, t__namespace.memberExpression(elem, t__namespace.identifier("firstChild")))
|
|
1186
1186
|
);
|
|
1187
1187
|
}
|
|
1188
|
-
results.dynamics.push({
|
|
1188
|
+
results.dynamics.push({
|
|
1189
|
+
elem: nextElem,
|
|
1190
|
+
key,
|
|
1191
|
+
value: value.expression,
|
|
1192
|
+
isSVG,
|
|
1193
|
+
isCE,
|
|
1194
|
+
tagName
|
|
1195
|
+
});
|
|
1189
1196
|
} else {
|
|
1190
1197
|
results.exprs.push(
|
|
1191
|
-
t__namespace.expressionStatement(
|
|
1198
|
+
t__namespace.expressionStatement(
|
|
1199
|
+
setAttr$2(attribute, elem, key, value.expression, { isSVG, isCE, tagName })
|
|
1200
|
+
)
|
|
1192
1201
|
);
|
|
1193
1202
|
}
|
|
1194
1203
|
} else {
|
|
@@ -1230,6 +1239,7 @@ function transformChildren$2(path, results, config) {
|
|
|
1230
1239
|
);
|
|
1231
1240
|
}
|
|
1232
1241
|
const transformed = transformNode(child, {
|
|
1242
|
+
lastElement: index === filteredChildren.length - 1,
|
|
1233
1243
|
skipId: !results.id || !detectExpressions(filteredChildren, index, config)
|
|
1234
1244
|
});
|
|
1235
1245
|
if (!transformed) return memo;
|
|
@@ -1496,7 +1506,9 @@ function processSpreads$1(path, attributes, { elem, isSVG, hasChildren, wrapCond
|
|
|
1496
1506
|
runningObject.push(
|
|
1497
1507
|
t__namespace.objectProperty(
|
|
1498
1508
|
t__namespace.stringLiteral(key),
|
|
1499
|
-
isContainer
|
|
1509
|
+
isContainer
|
|
1510
|
+
? node.value.expression
|
|
1511
|
+
: node.value || (Properties.has(key) ? t__namespace.booleanLiteral(true) : t__namespace.stringLiteral(""))
|
|
1500
1512
|
)
|
|
1501
1513
|
);
|
|
1502
1514
|
}
|
|
@@ -1566,10 +1578,11 @@ function appendTemplates$1(path, templates) {
|
|
|
1566
1578
|
t__namespace.addComment(
|
|
1567
1579
|
t__namespace.callExpression(
|
|
1568
1580
|
registerImportMethod(path, "template", getRendererConfig(path, "dom").moduleName),
|
|
1569
|
-
[
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1581
|
+
[t__namespace.templateLiteral([t__namespace.templateElement(tmpl, true)], [])].concat(
|
|
1582
|
+
template.isSVG || template.isCE
|
|
1583
|
+
? [t__namespace.booleanLiteral(template.isSVG), t__namespace.booleanLiteral(template.isCE)]
|
|
1584
|
+
: []
|
|
1585
|
+
)
|
|
1573
1586
|
),
|
|
1574
1587
|
"leading",
|
|
1575
1588
|
"#__PURE__"
|
|
@@ -1595,8 +1608,8 @@ function registerTemplate(path, results) {
|
|
|
1595
1608
|
templates.push({
|
|
1596
1609
|
id: templateId,
|
|
1597
1610
|
template: results.template,
|
|
1598
|
-
elementCount: results.template.split("<").length - 1,
|
|
1599
1611
|
isSVG: results.isSVG,
|
|
1612
|
+
isCE: results.hasCustomElement,
|
|
1600
1613
|
renderer: "dom"
|
|
1601
1614
|
});
|
|
1602
1615
|
}
|
|
@@ -1608,22 +1621,7 @@ function registerTemplate(path, results) {
|
|
|
1608
1621
|
registerImportMethod(path, "getNextElement", getRendererConfig(path, "dom").moduleName),
|
|
1609
1622
|
templateId ? [templateId] : []
|
|
1610
1623
|
)
|
|
1611
|
-
:
|
|
1612
|
-
? t__namespace.callExpression(
|
|
1613
|
-
registerImportMethod(path, "untrack", getRendererConfig(path, "dom").moduleName),
|
|
1614
|
-
[
|
|
1615
|
-
t__namespace.arrowFunctionExpression(
|
|
1616
|
-
[],
|
|
1617
|
-
t__namespace.callExpression(
|
|
1618
|
-
t__namespace.memberExpression(t__namespace.identifier("document"), t__namespace.identifier("importNode")),
|
|
1619
|
-
[templateId, t__namespace.booleanLiteral(true)]
|
|
1620
|
-
)
|
|
1621
|
-
)
|
|
1622
|
-
]
|
|
1623
|
-
)
|
|
1624
|
-
: t__namespace.callExpression(t__namespace.memberExpression(templateId, t__namespace.identifier("cloneNode")), [
|
|
1625
|
-
t__namespace.booleanLiteral(true)
|
|
1626
|
-
])
|
|
1624
|
+
: t__namespace.callExpression(templateId, [])
|
|
1627
1625
|
);
|
|
1628
1626
|
}
|
|
1629
1627
|
results.declarations.unshift(decl);
|
|
@@ -1682,7 +1680,13 @@ function wrapDynamics$1(path, dynamics) {
|
|
|
1682
1680
|
t__namespace.assignmentExpression(
|
|
1683
1681
|
"=",
|
|
1684
1682
|
prev,
|
|
1685
|
-
setAttr$2(path, elem, key, identifier, {
|
|
1683
|
+
setAttr$2(path, elem, key, identifier, {
|
|
1684
|
+
isSVG,
|
|
1685
|
+
isCE,
|
|
1686
|
+
tagName,
|
|
1687
|
+
dynamic: true,
|
|
1688
|
+
prevId: prev
|
|
1689
|
+
})
|
|
1686
1690
|
)
|
|
1687
1691
|
)
|
|
1688
1692
|
);
|
|
@@ -3019,7 +3023,8 @@ function transformComponentChildren(children, config) {
|
|
|
3019
3023
|
} else {
|
|
3020
3024
|
const child = transformNode(path, {
|
|
3021
3025
|
topLevel: true,
|
|
3022
|
-
componentChild: true
|
|
3026
|
+
componentChild: true,
|
|
3027
|
+
lastElement: true
|
|
3023
3028
|
});
|
|
3024
3029
|
dynamic = dynamic || child.dynamic;
|
|
3025
3030
|
if (
|
|
@@ -3084,7 +3089,7 @@ function transformFragmentChildren(children, results, config) {
|
|
|
3084
3089
|
prevResult = v;
|
|
3085
3090
|
}
|
|
3086
3091
|
} else {
|
|
3087
|
-
const child = transformNode(path, { topLevel: true, fragmentChild: true });
|
|
3092
|
+
const child = transformNode(path, { topLevel: true, fragmentChild: true, lastElement: true });
|
|
3088
3093
|
const insertMarkers =
|
|
3089
3094
|
config.hydratable &&
|
|
3090
3095
|
!child.component &&
|
|
@@ -3109,7 +3114,8 @@ function transformJSX(path) {
|
|
|
3109
3114
|
t__namespace.isJSXFragment(path.node)
|
|
3110
3115
|
? {}
|
|
3111
3116
|
: {
|
|
3112
|
-
topLevel: true
|
|
3117
|
+
topLevel: true,
|
|
3118
|
+
lastElement: true
|
|
3113
3119
|
}
|
|
3114
3120
|
);
|
|
3115
3121
|
|
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.36.0-beta.
|
|
4
|
+
"version": "0.36.0-beta.3",
|
|
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": "6ea8dcf7878c06eb241b45ba4432baf08d6657f3"
|
|
35
35
|
}
|