babel-plugin-jsx-dom-expressions 0.37.21 → 0.37.23
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 +14 -5
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -773,6 +773,7 @@ const alwaysClose = [
|
|
|
773
773
|
"select",
|
|
774
774
|
"iframe",
|
|
775
775
|
"script",
|
|
776
|
+
"noscript",
|
|
776
777
|
"template",
|
|
777
778
|
"fieldset"
|
|
778
779
|
];
|
|
@@ -782,7 +783,7 @@ function transformElement$3(path, info) {
|
|
|
782
783
|
config = getConfig(path),
|
|
783
784
|
wrapSVG = info.topLevel && tagName != "svg" && SVGElements.has(tagName),
|
|
784
785
|
voidTag = VoidElements.indexOf(tagName) > -1,
|
|
785
|
-
isCustomElement = tagName.indexOf("-") > -1,
|
|
786
|
+
isCustomElement = tagName.indexOf("-") > -1 || !!path.get("openingElement").get("attributes").find(a => a.node.name?.name === "is"),
|
|
786
787
|
results = {
|
|
787
788
|
template: `<${tagName}`,
|
|
788
789
|
declarations: [],
|
|
@@ -833,7 +834,7 @@ function transformElement$3(path, info) {
|
|
|
833
834
|
results.toBeClosed.add(tagName);
|
|
834
835
|
if (InlineElements.includes(tagName)) BlockElements.forEach(i => results.toBeClosed.add(i));
|
|
835
836
|
} else results.toBeClosed = info.toBeClosed;
|
|
836
|
-
transformChildren$2(path, results, config);
|
|
837
|
+
if (tagName !== "noscript") transformChildren$2(path, results, config);
|
|
837
838
|
if (toBeClosed) results.template += `</${tagName}>`;
|
|
838
839
|
}
|
|
839
840
|
if (info.topLevel && config.hydratable && results.hasHydratableEvent) {
|
|
@@ -3304,7 +3305,8 @@ function transformComponent(path) {
|
|
|
3304
3305
|
);
|
|
3305
3306
|
} else if (
|
|
3306
3307
|
t__namespace.isCallExpression(value.expression) &&
|
|
3307
|
-
t__namespace.isArrowFunctionExpression(value.expression.callee)
|
|
3308
|
+
t__namespace.isArrowFunctionExpression(value.expression.callee) &&
|
|
3309
|
+
value.expression.callee.params.length === 0
|
|
3308
3310
|
) {
|
|
3309
3311
|
const callee = value.expression.callee;
|
|
3310
3312
|
const body = t__namespace.isBlockStatement(callee.body)
|
|
@@ -3495,11 +3497,18 @@ function transformThis(path) {
|
|
|
3495
3497
|
return node => {
|
|
3496
3498
|
if (thisId) {
|
|
3497
3499
|
if (!parent || parent.block.type === "ClassMethod") {
|
|
3498
|
-
const stmt = path.getStatementParent();
|
|
3499
3500
|
const decl = t__namespace.variableDeclaration("const", [
|
|
3500
3501
|
t__namespace.variableDeclarator(thisId, t__namespace.thisExpression())
|
|
3501
3502
|
]);
|
|
3502
|
-
|
|
3503
|
+
if (parent) {
|
|
3504
|
+
const stmt = path.getStatementParent();
|
|
3505
|
+
stmt.insertBefore(decl);
|
|
3506
|
+
} else {
|
|
3507
|
+
return t__namespace.callExpression(
|
|
3508
|
+
t__namespace.arrowFunctionExpression([], t__namespace.blockStatement([decl, t__namespace.returnStatement(node)])),
|
|
3509
|
+
[]
|
|
3510
|
+
);
|
|
3511
|
+
}
|
|
3503
3512
|
} else {
|
|
3504
3513
|
parent.push({
|
|
3505
3514
|
id: thisId,
|
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.23",
|
|
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": "77a306e89d44a11b3e5254810ebc1d2cbae92838"
|
|
35
35
|
}
|