babel-plugin-jsx-dom-expressions 0.36.10 → 0.37.0-beta.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 +37 -15
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1496,7 +1496,7 @@ function transformChildren$2(path, results, config) {
|
|
|
1496
1496
|
// boxed by textNodes
|
|
1497
1497
|
if (markers || wrappedByText(childNodes, index)) {
|
|
1498
1498
|
let exprId, contentId;
|
|
1499
|
-
if (markers) tempPath = createPlaceholder(path, results, tempPath, i++, "
|
|
1499
|
+
if (markers) tempPath = createPlaceholder(path, results, tempPath, i++, "$")[0].name;
|
|
1500
1500
|
if (nextPlaceholder) {
|
|
1501
1501
|
exprId = nextPlaceholder;
|
|
1502
1502
|
} else {
|
|
@@ -2421,7 +2421,7 @@ function transformChildren$1(path, results, { hydratable }) {
|
|
|
2421
2421
|
|
|
2422
2422
|
// boxed by textNodes
|
|
2423
2423
|
if (markers && !child.spreadElement) {
|
|
2424
|
-
appendToTemplate(results.template,
|
|
2424
|
+
appendToTemplate(results.template, `<!--$-->`);
|
|
2425
2425
|
results.template.push("");
|
|
2426
2426
|
results.templateValues.push(child.exprs[0]);
|
|
2427
2427
|
appendToTemplate(results.template, `<!--/-->`);
|
|
@@ -2448,7 +2448,7 @@ function createElement(path, { topLevel, hydratable }) {
|
|
|
2448
2448
|
} else {
|
|
2449
2449
|
const child = transformNode(path);
|
|
2450
2450
|
if (markers && child.exprs.length && !child.spreadElement)
|
|
2451
|
-
memo.push(t__namespace.stringLiteral("
|
|
2451
|
+
memo.push(t__namespace.stringLiteral("<!--$-->"));
|
|
2452
2452
|
if (child.exprs.length && !child.spreadElement)
|
|
2453
2453
|
child.exprs[0] = escapeExpression(path, child.exprs[0]);
|
|
2454
2454
|
memo.push(getCreateTemplate(config, path, child)(path, child, true));
|
|
@@ -3138,22 +3138,44 @@ function transformComponent(path) {
|
|
|
3138
3138
|
checkTags: true
|
|
3139
3139
|
})
|
|
3140
3140
|
) {
|
|
3141
|
-
|
|
3141
|
+
if (
|
|
3142
3142
|
config.wrapConditionals &&
|
|
3143
3143
|
config.generate !== "ssr" &&
|
|
3144
3144
|
(t__namespace.isLogicalExpression(value.expression) ||
|
|
3145
3145
|
t__namespace.isConditionalExpression(value.expression))
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3146
|
+
) {
|
|
3147
|
+
const expr = transformCondition(attribute.get("value").get("expression"), true);
|
|
3148
|
+
|
|
3149
|
+
runningObject.push(
|
|
3150
|
+
t__namespace.objectMethod(
|
|
3151
|
+
"get",
|
|
3152
|
+
id,
|
|
3153
|
+
[],
|
|
3154
|
+
t__namespace.blockStatement([t__namespace.returnStatement(expr.body)]),
|
|
3155
|
+
!t__namespace.isValidIdentifier(key)
|
|
3156
|
+
)
|
|
3157
|
+
);
|
|
3158
|
+
} else if (
|
|
3159
|
+
t__namespace.isCallExpression(value.expression) &&
|
|
3160
|
+
t__namespace.isArrowFunctionExpression(value.expression.callee)
|
|
3161
|
+
) {
|
|
3162
|
+
const callee = value.expression.callee;
|
|
3163
|
+
const body = t__namespace.isBlockStatement(callee.body)
|
|
3164
|
+
? callee.body
|
|
3165
|
+
: t__namespace.blockStatement([t__namespace.returnStatement(callee.body)]);
|
|
3166
|
+
|
|
3167
|
+
runningObject.push(t__namespace.objectMethod("get", id, [], body, !t__namespace.isValidIdentifier(key)));
|
|
3168
|
+
} else {
|
|
3169
|
+
runningObject.push(
|
|
3170
|
+
t__namespace.objectMethod(
|
|
3171
|
+
"get",
|
|
3172
|
+
id,
|
|
3173
|
+
[],
|
|
3174
|
+
t__namespace.blockStatement([t__namespace.returnStatement(value.expression)]),
|
|
3175
|
+
!t__namespace.isValidIdentifier(key)
|
|
3176
|
+
)
|
|
3177
|
+
);
|
|
3178
|
+
}
|
|
3157
3179
|
} else runningObject.push(t__namespace.objectProperty(id, value.expression));
|
|
3158
3180
|
else runningObject.push(t__namespace.objectProperty(id, value));
|
|
3159
3181
|
}
|
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.37.0-beta.0",
|
|
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": "3facf68629164c0b9f01447ac73ae6da9324ca06"
|
|
35
35
|
}
|