babel-plugin-jsx-dom-expressions 0.37.0 → 0.37.7
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 +11 -6
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1370,7 +1370,10 @@ function transformAttributes$2(path, results) {
|
|
|
1370
1370
|
} else {
|
|
1371
1371
|
!isSVG && (key = key.toLowerCase());
|
|
1372
1372
|
results.template += `${needsSpacing ? ' ' : ''}${key}`;
|
|
1373
|
-
if (!value)
|
|
1373
|
+
if (!value) {
|
|
1374
|
+
needsSpacing = true;
|
|
1375
|
+
return;
|
|
1376
|
+
}
|
|
1374
1377
|
|
|
1375
1378
|
let text = value.value;
|
|
1376
1379
|
let needsQuoting = false;
|
|
@@ -1383,6 +1386,7 @@ function transformAttributes$2(path, results) {
|
|
|
1383
1386
|
}
|
|
1384
1387
|
|
|
1385
1388
|
if (!text.length) {
|
|
1389
|
+
needsSpacing = false;
|
|
1386
1390
|
results.template += `=""`;
|
|
1387
1391
|
return;
|
|
1388
1392
|
}
|
|
@@ -1407,7 +1411,6 @@ function transformAttributes$2(path, results) {
|
|
|
1407
1411
|
}
|
|
1408
1412
|
|
|
1409
1413
|
if (needsQuoting) {
|
|
1410
|
-
|
|
1411
1414
|
needsSpacing = false;
|
|
1412
1415
|
results.template += `="${escapeBackticks(escapeHTML(text, true))}"`;
|
|
1413
1416
|
} else {
|
|
@@ -2287,7 +2290,7 @@ function transformAttributes$1(path, results, info) {
|
|
|
2287
2290
|
t__namespace.isJSXExpressionContainer(value) &&
|
|
2288
2291
|
(reservedNameSpace ||
|
|
2289
2292
|
ChildProperties.has(key) ||
|
|
2290
|
-
!(t__namespace.isStringLiteral(value.expression) || t__namespace.isNumericLiteral(value.expression)))
|
|
2293
|
+
!(t__namespace.isStringLiteral(value.expression) || t__namespace.isNumericLiteral(value.expression) || t__namespace.isBooleanLiteral(value.expression)))
|
|
2291
2294
|
) {
|
|
2292
2295
|
if (
|
|
2293
2296
|
key === "ref" ||
|
|
@@ -2363,7 +2366,7 @@ function transformAttributes$1(path, results, info) {
|
|
|
2363
2366
|
}
|
|
2364
2367
|
if (doEscape) value.expression = escapeExpression(path, value.expression, true);
|
|
2365
2368
|
|
|
2366
|
-
if (!doEscape || t__namespace.isLiteral(value.expression)
|
|
2369
|
+
if (!doEscape || t__namespace.isLiteral(value.expression)) {
|
|
2367
2370
|
key = toAttribute(key, isSVG);
|
|
2368
2371
|
appendToTemplate(results.template, ` ${key}="`);
|
|
2369
2372
|
results.template.push(`"`);
|
|
@@ -2374,9 +2377,11 @@ function transformAttributes$1(path, results, info) {
|
|
|
2374
2377
|
if (key === "$ServerOnly") return;
|
|
2375
2378
|
if (t__namespace.isJSXExpressionContainer(value)) value = value.expression;
|
|
2376
2379
|
key = toAttribute(key, isSVG);
|
|
2380
|
+
const isBoolean = BooleanAttributes.has(key);
|
|
2381
|
+
if (isBoolean && value.value !== "" && !value.value) return;
|
|
2377
2382
|
appendToTemplate(results.template, ` ${key}`);
|
|
2378
2383
|
if (!value) return;
|
|
2379
|
-
let text = value.value;
|
|
2384
|
+
let text = isBoolean ? "" : value.value;
|
|
2380
2385
|
if (key === "style" || key === "class") {
|
|
2381
2386
|
text = trimWhitespace(text);
|
|
2382
2387
|
if (key === "style") {
|
|
@@ -2900,7 +2905,7 @@ function processSpreads(path, attributes, { elem, hasChildren, wrapConditionals
|
|
|
2900
2905
|
(firstSpread ||
|
|
2901
2906
|
(t__namespace.isJSXExpressionContainer(node.value) &&
|
|
2902
2907
|
isDynamic(attribute.get("value").get("expression"), { checkMember: true }))) &&
|
|
2903
|
-
canNativeSpread(key)
|
|
2908
|
+
canNativeSpread(key, { checkNameSpaces: true })
|
|
2904
2909
|
) {
|
|
2905
2910
|
const isContainer = t__namespace.isJSXExpressionContainer(node.value);
|
|
2906
2911
|
const dynamic =
|
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.37.
|
|
4
|
+
"version": "0.37.7",
|
|
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": "5a6904fe67f815157f00496c23a538f4b8218ad0"
|
|
35
35
|
}
|