@barefootjs/test 0.6.1 → 0.7.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/dist/index.js +36 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -192582,6 +192582,7 @@ function transformComponentElement(node, ctx, name) {
|
|
|
192582
192582
|
children,
|
|
192583
192583
|
template: name.toLowerCase(),
|
|
192584
192584
|
slotId,
|
|
192585
|
+
...isDynamicTagLocal(name, ctx) ? { dynamicTag: true } : {},
|
|
192585
192586
|
loc: getSourceLocation(node, ctx.sourceFile, ctx.filePath)
|
|
192586
192587
|
};
|
|
192587
192588
|
}
|
|
@@ -192597,6 +192598,7 @@ function transformSelfClosingComponent(node, ctx, name) {
|
|
|
192597
192598
|
children: [],
|
|
192598
192599
|
template: name.toLowerCase(),
|
|
192599
192600
|
slotId,
|
|
192601
|
+
...isDynamicTagLocal(name, ctx) ? { dynamicTag: true } : {},
|
|
192600
192602
|
loc: getSourceLocation(node, ctx.sourceFile, ctx.filePath)
|
|
192601
192603
|
};
|
|
192602
192604
|
}
|
|
@@ -194289,6 +194291,40 @@ function findLocalConst(name, ctx) {
|
|
|
194289
194291
|
const pool = fnScoped.length > 0 ? fnScoped : matches;
|
|
194290
194292
|
return pool[pool.length - 1];
|
|
194291
194293
|
}
|
|
194294
|
+
function isDynamicTagLocal(name, ctx) {
|
|
194295
|
+
if (!hasDynamicTagBinding(name, ctx.sourceFile))
|
|
194296
|
+
return false;
|
|
194297
|
+
const a = ctx.analyzer;
|
|
194298
|
+
if (a.jsxConstants?.has(name))
|
|
194299
|
+
return false;
|
|
194300
|
+
if (a.jsxFunctions?.has(name))
|
|
194301
|
+
return false;
|
|
194302
|
+
if (a.jsxMultiReturnFunctions?.has(name))
|
|
194303
|
+
return false;
|
|
194304
|
+
if (a.inlineableJsxConsts?.has(name))
|
|
194305
|
+
return false;
|
|
194306
|
+
return true;
|
|
194307
|
+
}
|
|
194308
|
+
function hasDynamicTagBinding(name, sourceFile) {
|
|
194309
|
+
let found = false;
|
|
194310
|
+
const visit2 = (node) => {
|
|
194311
|
+
if (found)
|
|
194312
|
+
return;
|
|
194313
|
+
if (import_typescript11.default.isVariableDeclaration(node) && import_typescript11.default.isIdentifier(node.name) && node.name.text === name && node.initializer) {
|
|
194314
|
+
let init = node.initializer;
|
|
194315
|
+
while (import_typescript11.default.isAsExpression(init) || import_typescript11.default.isSatisfiesExpression(init) || import_typescript11.default.isParenthesizedExpression(init) || import_typescript11.default.isNonNullExpression(init)) {
|
|
194316
|
+
init = init.expression;
|
|
194317
|
+
}
|
|
194318
|
+
if (import_typescript11.default.isPropertyAccessExpression(init) && init.name.text === "tag") {
|
|
194319
|
+
found = true;
|
|
194320
|
+
return;
|
|
194321
|
+
}
|
|
194322
|
+
}
|
|
194323
|
+
import_typescript11.default.forEachChild(node, visit2);
|
|
194324
|
+
};
|
|
194325
|
+
visit2(sourceFile);
|
|
194326
|
+
return found;
|
|
194327
|
+
}
|
|
194292
194328
|
function tryResolveIdentifierAsTemplateLiteral(ident, ctx) {
|
|
194293
194329
|
const constInfo = findLocalConst(ident.text, ctx);
|
|
194294
194330
|
if (!constInfo)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barefootjs/test",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Test utilities for BarefootJS - IR-based component testing without a browser",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"directory": "packages/test"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@barefootjs/jsx": "0.
|
|
42
|
+
"@barefootjs/jsx": "0.7.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"typescript": "^5.0.0"
|