@barefootjs/test 0.31.2 → 0.31.4
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 +164 -50
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -188846,6 +188846,24 @@ function templatePartsToJsExpr(parts, opts) {
|
|
|
188846
188846
|
return result;
|
|
188847
188847
|
}
|
|
188848
188848
|
|
|
188849
|
+
// ../jsx/src/identifier-pattern.ts
|
|
188850
|
+
function withUnicodeFlag(flags) {
|
|
188851
|
+
return flags.includes("u") ? flags : `${flags}u`;
|
|
188852
|
+
}
|
|
188853
|
+
function escapeIdentifierForRegex(name) {
|
|
188854
|
+
return name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
188855
|
+
}
|
|
188856
|
+
var ID_BOUNDARY_BEFORE = "(?<![\\p{ID_Continue}$])";
|
|
188857
|
+
var ID_BOUNDARY_AFTER = "(?![\\p{ID_Continue}$])";
|
|
188858
|
+
function identifierPattern(name, flags = "") {
|
|
188859
|
+
const esc = escapeIdentifierForRegex(name);
|
|
188860
|
+
return new RegExp(`${ID_BOUNDARY_BEFORE}${esc}${ID_BOUNDARY_AFTER}`, withUnicodeFlag(flags));
|
|
188861
|
+
}
|
|
188862
|
+
function identifierCallPattern(name, flags = "") {
|
|
188863
|
+
const esc = escapeIdentifierForRegex(name);
|
|
188864
|
+
return new RegExp(`${ID_BOUNDARY_BEFORE}${esc}\\s*\\(`, withUnicodeFlag(flags));
|
|
188865
|
+
}
|
|
188866
|
+
|
|
188849
188867
|
// ../jsx/src/scanner/js-scanner.ts
|
|
188850
188868
|
var import_typescript2 = __toESM(require_typescript(), 1);
|
|
188851
188869
|
function* iterateJsTokens(text, start = 0, end = text.length) {
|
|
@@ -189229,6 +189247,83 @@ function extractFreeIdentifiersFromText(text) {
|
|
|
189229
189247
|
return extractFreeIdentifiersFromNode(expr);
|
|
189230
189248
|
}
|
|
189231
189249
|
|
|
189250
|
+
// ../jsx/src/scope/binding-scope.ts
|
|
189251
|
+
class BindingScope {
|
|
189252
|
+
frames;
|
|
189253
|
+
static EMPTY = new BindingScope([]);
|
|
189254
|
+
constructor(frames) {
|
|
189255
|
+
this.frames = frames;
|
|
189256
|
+
}
|
|
189257
|
+
enterLoopRow(loop) {
|
|
189258
|
+
const bindings = new Map;
|
|
189259
|
+
if (loop.paramBindings && loop.paramBindings.length > 0) {
|
|
189260
|
+
for (const b of loop.paramBindings)
|
|
189261
|
+
bindings.set(b.name, { source: "destructure" });
|
|
189262
|
+
} else {
|
|
189263
|
+
bindings.set(loop.param, { source: "item" });
|
|
189264
|
+
}
|
|
189265
|
+
if (loop.index != null)
|
|
189266
|
+
bindings.set(loop.index, { source: "index" });
|
|
189267
|
+
for (const name of loop.preamble?.declaredNames ?? [])
|
|
189268
|
+
bindings.set(name, { source: "preamble" });
|
|
189269
|
+
const frame = { kind: "loop-row", bindings };
|
|
189270
|
+
return new BindingScope([frame, ...this.frames]);
|
|
189271
|
+
}
|
|
189272
|
+
enterCallback(params) {
|
|
189273
|
+
const bindings = new Map;
|
|
189274
|
+
for (const name of params)
|
|
189275
|
+
bindings.set(name, { source: "param" });
|
|
189276
|
+
const frame = { kind: "callback", bindings };
|
|
189277
|
+
return new BindingScope([frame, ...this.frames]);
|
|
189278
|
+
}
|
|
189279
|
+
isBound(name) {
|
|
189280
|
+
for (const frame of this.frames) {
|
|
189281
|
+
if (frame.bindings.has(name))
|
|
189282
|
+
return true;
|
|
189283
|
+
}
|
|
189284
|
+
return false;
|
|
189285
|
+
}
|
|
189286
|
+
lookup(name) {
|
|
189287
|
+
for (let depth = 0;depth < this.frames.length; depth++) {
|
|
189288
|
+
const frame = this.frames[depth];
|
|
189289
|
+
const binding = frame.bindings.get(name);
|
|
189290
|
+
if (binding)
|
|
189291
|
+
return { depth, frame, binding };
|
|
189292
|
+
}
|
|
189293
|
+
return null;
|
|
189294
|
+
}
|
|
189295
|
+
boundNames() {
|
|
189296
|
+
if (this.boundNamesCache)
|
|
189297
|
+
return this.boundNamesCache;
|
|
189298
|
+
const names = new Set;
|
|
189299
|
+
for (const frame of this.frames) {
|
|
189300
|
+
for (const name of frame.bindings.keys())
|
|
189301
|
+
names.add(name);
|
|
189302
|
+
}
|
|
189303
|
+
this.boundNamesCache = names;
|
|
189304
|
+
return names;
|
|
189305
|
+
}
|
|
189306
|
+
boundNamesCache;
|
|
189307
|
+
valueBoundNamesCache;
|
|
189308
|
+
valueBoundNames() {
|
|
189309
|
+
if (this.valueBoundNamesCache)
|
|
189310
|
+
return this.valueBoundNamesCache;
|
|
189311
|
+
const names = new Set;
|
|
189312
|
+
for (const frame of this.frames) {
|
|
189313
|
+
for (const [name, binding] of frame.bindings) {
|
|
189314
|
+
if (binding.source === "item" || binding.source === "index" || binding.source === "destructure") {
|
|
189315
|
+
names.add(name);
|
|
189316
|
+
}
|
|
189317
|
+
}
|
|
189318
|
+
}
|
|
189319
|
+
this.valueBoundNamesCache = names;
|
|
189320
|
+
return names;
|
|
189321
|
+
}
|
|
189322
|
+
asShadowPredicate() {
|
|
189323
|
+
return (name) => this.isBound(name);
|
|
189324
|
+
}
|
|
189325
|
+
}
|
|
189326
|
+
|
|
189232
189327
|
// ../jsx/src/ir-to-client-js/html-template.ts
|
|
189233
189328
|
function splitTemplateInterpolations(inner) {
|
|
189234
189329
|
const parts = [];
|
|
@@ -190429,7 +190524,8 @@ function visit(node, ctx, targetComponentName, namedExports) {
|
|
|
190429
190524
|
if (!ctx.componentNode) {
|
|
190430
190525
|
collectAmbientGlobals(node, ctx);
|
|
190431
190526
|
}
|
|
190432
|
-
|
|
190527
|
+
const isDeclareStatement = import_typescript9.default.isVariableStatement(node) && (node.modifiers?.some((m) => m.kind === import_typescript9.default.SyntaxKind.DeclareKeyword) ?? false);
|
|
190528
|
+
if (import_typescript9.default.isVariableStatement(node) && !ctx.componentNode && !isDeclareStatement) {
|
|
190433
190529
|
const isExported = node.modifiers?.some((m) => m.kind === import_typescript9.default.SyntaxKind.ExportKeyword) ?? false;
|
|
190434
190530
|
const isLet = (node.declarationList.flags & import_typescript9.default.NodeFlags.Let) !== 0;
|
|
190435
190531
|
const isModuleClientDirective = hasLeadingClientDirectiveOnStatement(node, ctx.sourceFile);
|
|
@@ -190442,7 +190538,7 @@ function visit(node, ctx, targetComponentName, namedExports) {
|
|
|
190442
190538
|
}
|
|
190443
190539
|
continue;
|
|
190444
190540
|
}
|
|
190445
|
-
if (import_typescript9.default.isIdentifier(decl.name) && decl.initializer && !isArrowComponentFunction(decl)) {
|
|
190541
|
+
if (import_typescript9.default.isIdentifier(decl.name) && (decl.initializer || isLet) && !isArrowComponentFunction(decl)) {
|
|
190446
190542
|
collectConstant(decl, ctx, true, isLet ? "let" : "const", isExported);
|
|
190447
190543
|
}
|
|
190448
190544
|
}
|
|
@@ -192013,6 +192109,7 @@ function collectConstant(node, ctx, _isModule, declarationKind = "const", isExpo
|
|
|
192013
192109
|
value,
|
|
192014
192110
|
parsed,
|
|
192015
192111
|
typedValue: typedValue !== value ? typedValue : undefined,
|
|
192112
|
+
typeAnnotation: node.type ? node.type.getText(ctx.sourceFile) : undefined,
|
|
192016
192113
|
valueBranches,
|
|
192017
192114
|
declarationKind,
|
|
192018
192115
|
isExported,
|
|
@@ -193631,7 +193728,7 @@ function findReachableNames(primaryRefs, declarations) {
|
|
|
193631
193728
|
const reachable = new Set;
|
|
193632
193729
|
const queue = [];
|
|
193633
193730
|
for (const name of allNames) {
|
|
193634
|
-
if (
|
|
193731
|
+
if (identifierPattern(name).test(primaryRefs)) {
|
|
193635
193732
|
reachable.add(name);
|
|
193636
193733
|
queue.push(name);
|
|
193637
193734
|
}
|
|
@@ -193640,7 +193737,7 @@ function findReachableNames(primaryRefs, declarations) {
|
|
|
193640
193737
|
const current = queue.shift();
|
|
193641
193738
|
const body = bodyMap.get(current) || "";
|
|
193642
193739
|
for (const name of allNames) {
|
|
193643
|
-
if (!reachable.has(name) &&
|
|
193740
|
+
if (!reachable.has(name) && identifierPattern(name).test(body)) {
|
|
193644
193741
|
reachable.add(name);
|
|
193645
193742
|
queue.push(name);
|
|
193646
193743
|
}
|
|
@@ -194472,8 +194569,9 @@ function rewriteBarePropRefs2(text, expr, ctx) {
|
|
|
194472
194569
|
let propNames = getDestructuredPropNames(ctx);
|
|
194473
194570
|
if (!propNames)
|
|
194474
194571
|
return dateLowered === text ? undefined : dateLowered;
|
|
194475
|
-
|
|
194476
|
-
|
|
194572
|
+
const shadowingNames = ctx.scope.boundNames();
|
|
194573
|
+
if (shadowingNames.size > 0) {
|
|
194574
|
+
const filtered = new Set([...propNames].filter((n) => !shadowingNames.has(n)));
|
|
194477
194575
|
if (filtered.size === 0)
|
|
194478
194576
|
return dateLowered === text ? undefined : dateLowered;
|
|
194479
194577
|
propNames = filtered;
|
|
@@ -194549,22 +194647,22 @@ function createTransformContext(analyzer) {
|
|
|
194549
194647
|
spreadIdCounter: 0,
|
|
194550
194648
|
isRoot: true,
|
|
194551
194649
|
insideComponentChildren: false,
|
|
194552
|
-
|
|
194650
|
+
scope: BindingScope.EMPTY,
|
|
194553
194651
|
loopDepth: 0,
|
|
194554
194652
|
patterns: {
|
|
194555
194653
|
signals: analyzer.signals.map((s) => ({
|
|
194556
194654
|
getter: s.getter,
|
|
194557
|
-
pattern:
|
|
194655
|
+
pattern: identifierCallPattern(s.getter)
|
|
194558
194656
|
})),
|
|
194559
194657
|
memos: analyzer.memos.map((m) => ({
|
|
194560
194658
|
name: m.name,
|
|
194561
|
-
pattern:
|
|
194659
|
+
pattern: identifierCallPattern(m.name)
|
|
194562
194660
|
})),
|
|
194563
|
-
props: analyzer.propsParams.filter((p) => p.name !== "children").map((p) => ({ name: p.name, pattern:
|
|
194661
|
+
props: analyzer.propsParams.filter((p) => p.name !== "children").map((p) => ({ name: p.name, pattern: identifierPattern(p.name) })),
|
|
194564
194662
|
constants: analyzer.localConstants.map((c) => ({
|
|
194565
194663
|
name: c.name,
|
|
194566
194664
|
value: c.value,
|
|
194567
|
-
pattern:
|
|
194665
|
+
pattern: identifierPattern(c.name)
|
|
194568
194666
|
}))
|
|
194569
194667
|
},
|
|
194570
194668
|
getJS(node) {
|
|
@@ -194626,7 +194724,8 @@ function generateSpreadSlotId(ctx) {
|
|
|
194626
194724
|
return `Spread_${ctx.spreadIdCounter++}`;
|
|
194627
194725
|
}
|
|
194628
194726
|
function makeBindingEnv(ctx) {
|
|
194629
|
-
const
|
|
194727
|
+
const boundNames = ctx.scope.valueBoundNames();
|
|
194728
|
+
const loopKey = boundNames.size === 0 ? "" : Array.from(boundNames).sort().join("\x00");
|
|
194630
194729
|
if (ctx._bindingEnv && ctx._bindingEnvLoopKey === loopKey) {
|
|
194631
194730
|
return ctx._bindingEnv;
|
|
194632
194731
|
}
|
|
@@ -194641,7 +194740,7 @@ function makeBindingEnv(ctx) {
|
|
|
194641
194740
|
localFunctions: a.localFunctions,
|
|
194642
194741
|
imports: a.imports,
|
|
194643
194742
|
ambientGlobals: a.ambientGlobals,
|
|
194644
|
-
loopParams:
|
|
194743
|
+
loopParams: boundNames,
|
|
194645
194744
|
checker: a.checker
|
|
194646
194745
|
};
|
|
194647
194746
|
ctx._bindingEnv = env;
|
|
@@ -195334,7 +195433,8 @@ function transformExpressionInner(expr, ctx, node, isClientOnly) {
|
|
|
195334
195433
|
freeRefs
|
|
195335
195434
|
};
|
|
195336
195435
|
const reactive = isReactiveExpression(exprText, ctx, expr) || isReactiveOrigin(origin);
|
|
195337
|
-
const
|
|
195436
|
+
const scopeValueNames = ctx.scope.valueBoundNames();
|
|
195437
|
+
const refsLoopParam = scopeValueNames.size > 0 && Array.from(scopeValueNames).some((p) => identifierPattern(p).test(exprText));
|
|
195338
195438
|
const callsReactive = exprCallsReactiveGetters(expr, ctx);
|
|
195339
195439
|
const hasCalls = exprHasFunctionCalls(expr);
|
|
195340
195440
|
const needsSlot = reactive || isClientOnly || refsLoopParam || callsReactive || hasCalls;
|
|
@@ -195369,7 +195469,7 @@ function transformJsxFunctionCall(callExpr, jsxFunc, ctx, _isClientOnly) {
|
|
|
195369
195469
|
const substitutedGetJS = (node) => {
|
|
195370
195470
|
let text = baseGetJS(node);
|
|
195371
195471
|
for (const [paramName, argExpr] of substitutions) {
|
|
195372
|
-
text = text.replace(
|
|
195472
|
+
text = text.replace(identifierPattern(paramName, "g"), () => argExpr);
|
|
195373
195473
|
}
|
|
195374
195474
|
return text;
|
|
195375
195475
|
};
|
|
@@ -195411,7 +195511,7 @@ function transformMultiReturnJsxFunctionCall(callExpr, info, ctx) {
|
|
|
195411
195511
|
const substitutedGetJS = (node) => {
|
|
195412
195512
|
let text = baseGetJS(node);
|
|
195413
195513
|
for (const [paramName, argExpr] of substitutions) {
|
|
195414
|
-
text = text.replace(
|
|
195514
|
+
text = text.replace(identifierPattern(paramName, "g"), () => argExpr);
|
|
195415
195515
|
}
|
|
195416
195516
|
return text;
|
|
195417
195517
|
};
|
|
@@ -196422,7 +196522,7 @@ function extractItemConditionalKey(cond) {
|
|
|
196422
196522
|
return a ?? b;
|
|
196423
196523
|
}
|
|
196424
196524
|
function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
|
|
196425
|
-
const isNested = ctx.
|
|
196525
|
+
const isNested = ctx.scope.valueBoundNames().size > 0;
|
|
196426
196526
|
const diagCountAtEntry = ctx.analyzer.errors.length;
|
|
196427
196527
|
const depth = ctx.loopDepth;
|
|
196428
196528
|
const propAccess = node.expression;
|
|
@@ -196581,14 +196681,8 @@ function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
|
|
|
196581
196681
|
indexType = secondParam.type.getText(ctx.sourceFile);
|
|
196582
196682
|
}
|
|
196583
196683
|
}
|
|
196584
|
-
|
|
196585
|
-
|
|
196586
|
-
ctx.loopParams.add(b.name);
|
|
196587
|
-
} else {
|
|
196588
|
-
ctx.loopParams.add(param);
|
|
196589
|
-
}
|
|
196590
|
-
if (index)
|
|
196591
|
-
ctx.loopParams.add(index);
|
|
196684
|
+
const savedScope = ctx.scope;
|
|
196685
|
+
ctx.scope = ctx.scope.enterLoopRow({ param, index, paramBindings });
|
|
196592
196686
|
ctx.loopDepth++;
|
|
196593
196687
|
const tryTransformRenderableBody = (expr) => {
|
|
196594
196688
|
if (!import_typescript12.default.isBinaryExpression(expr))
|
|
@@ -196649,6 +196743,24 @@ function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
|
|
|
196649
196743
|
}
|
|
196650
196744
|
}
|
|
196651
196745
|
const returnStmt = children.length === 0 ? body.statements.find((s) => import_typescript12.default.isReturnStatement(s) && s.expression != null) : undefined;
|
|
196746
|
+
let rowScopeBeforePreamble = null;
|
|
196747
|
+
if (returnStmt) {
|
|
196748
|
+
const preambleNames = new Set;
|
|
196749
|
+
for (const stmt of body.statements) {
|
|
196750
|
+
if (stmt === returnStmt)
|
|
196751
|
+
break;
|
|
196752
|
+
collectPreambleDeclaredNames(stmt, preambleNames);
|
|
196753
|
+
}
|
|
196754
|
+
if (preambleNames.size > 0) {
|
|
196755
|
+
rowScopeBeforePreamble = ctx.scope;
|
|
196756
|
+
ctx.scope = savedScope.enterLoopRow({
|
|
196757
|
+
param,
|
|
196758
|
+
index,
|
|
196759
|
+
paramBindings,
|
|
196760
|
+
preamble: { declaredNames: [...preambleNames] }
|
|
196761
|
+
});
|
|
196762
|
+
}
|
|
196763
|
+
}
|
|
196652
196764
|
if (returnStmt && returnStmt.expression) {
|
|
196653
196765
|
let returnExpr = returnStmt.expression;
|
|
196654
196766
|
while (import_typescript12.default.isParenthesizedExpression(returnExpr)) {
|
|
@@ -196718,6 +196830,9 @@ function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
|
|
|
196718
196830
|
}
|
|
196719
196831
|
}
|
|
196720
196832
|
}
|
|
196833
|
+
if (rowScopeBeforePreamble) {
|
|
196834
|
+
ctx.scope = rowScopeBeforePreamble;
|
|
196835
|
+
}
|
|
196721
196836
|
if (method === "flatMap" && children.length === 0 && !flatMapProjectionCall(body)) {
|
|
196722
196837
|
flatMapCallback = buildFlatMapCallback(callback, body, ctx);
|
|
196723
196838
|
}
|
|
@@ -196746,14 +196861,7 @@ function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
|
|
|
196746
196861
|
}
|
|
196747
196862
|
}));
|
|
196748
196863
|
}
|
|
196749
|
-
|
|
196750
|
-
for (const b of paramBindings)
|
|
196751
|
-
ctx.loopParams.delete(b.name);
|
|
196752
|
-
} else {
|
|
196753
|
-
ctx.loopParams.delete(param);
|
|
196754
|
-
}
|
|
196755
|
-
if (index)
|
|
196756
|
-
ctx.loopParams.delete(index);
|
|
196864
|
+
ctx.scope = savedScope;
|
|
196757
196865
|
ctx.loopDepth--;
|
|
196758
196866
|
}
|
|
196759
196867
|
if (children.length === 0 && !flatMapCallback) {
|
|
@@ -197500,7 +197608,7 @@ function parseTemplateLiteral(expr, ctx) {
|
|
|
197500
197608
|
}
|
|
197501
197609
|
function tryResolveTemplateSpanFromConst(expr, ctx) {
|
|
197502
197610
|
if (import_typescript12.default.isIdentifier(expr)) {
|
|
197503
|
-
if (ctx.
|
|
197611
|
+
if (ctx.scope.isBound(expr.text))
|
|
197504
197612
|
return null;
|
|
197505
197613
|
const constInfo = findLocalConst(expr.text, ctx.analyzer);
|
|
197506
197614
|
if (!constInfo)
|
|
@@ -197516,7 +197624,7 @@ function tryResolveTemplateSpanFromConst(expr, ctx) {
|
|
|
197516
197624
|
if (import_typescript12.default.isElementAccessExpression(expr)) {
|
|
197517
197625
|
if (!import_typescript12.default.isIdentifier(expr.expression))
|
|
197518
197626
|
return null;
|
|
197519
|
-
if (ctx.
|
|
197627
|
+
if (ctx.scope.isBound(expr.expression.text))
|
|
197520
197628
|
return null;
|
|
197521
197629
|
const constInfo = findLocalConst(expr.expression.text, ctx.analyzer);
|
|
197522
197630
|
if (!constInfo)
|
|
@@ -197595,7 +197703,7 @@ function hasDynamicTagBinding(name, sourceFile) {
|
|
|
197595
197703
|
return found;
|
|
197596
197704
|
}
|
|
197597
197705
|
function tryResolveIdentifierAsTemplateLiteral(ident, ctx) {
|
|
197598
|
-
if (ctx.
|
|
197706
|
+
if (ctx.scope.isBound(ident.text))
|
|
197599
197707
|
return null;
|
|
197600
197708
|
const constInfo = findLocalConst(ident.text, ctx.analyzer);
|
|
197601
197709
|
if (!constInfo)
|
|
@@ -197944,10 +198052,11 @@ function isSignalOrMemoArray(array, ctx) {
|
|
|
197944
198052
|
return false;
|
|
197945
198053
|
}
|
|
197946
198054
|
function referencesLoopParam(expr, ctx) {
|
|
197947
|
-
|
|
198055
|
+
const boundNames = ctx.scope.valueBoundNames();
|
|
198056
|
+
if (boundNames.size === 0)
|
|
197948
198057
|
return false;
|
|
197949
|
-
for (const p of
|
|
197950
|
-
if (
|
|
198058
|
+
for (const p of boundNames) {
|
|
198059
|
+
if (identifierPattern(p).test(expr))
|
|
197951
198060
|
return true;
|
|
197952
198061
|
}
|
|
197953
198062
|
return false;
|
|
@@ -198026,9 +198135,10 @@ function hasReactiveAttributes(attrs, ctx) {
|
|
|
198026
198135
|
if (isSignalOrMemoReference(valueToCheck, ctx) || isPropsReference(valueToCheck, ctx)) {
|
|
198027
198136
|
return true;
|
|
198028
198137
|
}
|
|
198029
|
-
|
|
198030
|
-
|
|
198031
|
-
|
|
198138
|
+
const scopeValueNames = ctx.scope.valueBoundNames();
|
|
198139
|
+
if (scopeValueNames.size > 0) {
|
|
198140
|
+
for (const p of scopeValueNames) {
|
|
198141
|
+
if (identifierPattern(p).test(valueToCheck))
|
|
198032
198142
|
return true;
|
|
198033
198143
|
}
|
|
198034
198144
|
}
|
|
@@ -198765,7 +198875,7 @@ class JsxAdapter extends BaseAdapter {
|
|
|
198765
198875
|
lines.push(` const ${signal.getter} = () => ${initialValue}`);
|
|
198766
198876
|
}
|
|
198767
198877
|
if (signal.setter) {
|
|
198768
|
-
const setterUsed =
|
|
198878
|
+
const setterUsed = identifierPattern(signal.setter).test(setterRefText);
|
|
198769
198879
|
if (setterUsed) {
|
|
198770
198880
|
lines.push(` const ${signal.setter} = (..._args: any[]) => {}`);
|
|
198771
198881
|
}
|
|
@@ -198785,7 +198895,7 @@ class JsxAdapter extends BaseAdapter {
|
|
|
198785
198895
|
continue;
|
|
198786
198896
|
const keyword = constant.declarationKind ?? "const";
|
|
198787
198897
|
if (!constant.value) {
|
|
198788
|
-
const typeAnnotation = preserveTypes && constant.type ? `: ${constant.type
|
|
198898
|
+
const typeAnnotation = preserveTypes && (constant.typeAnnotation ?? constant.type) ? `: ${constant.typeAnnotation ?? constant.type?.raw}` : "";
|
|
198789
198899
|
lines.push(` ${keyword} ${constant.name}${typeAnnotation}`);
|
|
198790
198900
|
continue;
|
|
198791
198901
|
}
|
|
@@ -198795,7 +198905,8 @@ class JsxAdapter extends BaseAdapter {
|
|
|
198795
198905
|
if (!reachable.has(constant.name))
|
|
198796
198906
|
continue;
|
|
198797
198907
|
const constValue = preserveTypes ? constant.typedValue ?? constant.value : constant.value;
|
|
198798
|
-
|
|
198908
|
+
const letTypeAnnotation = preserveTypes && keyword === "let" && constant.typeAnnotation ? `: ${constant.typeAnnotation}` : "";
|
|
198909
|
+
lines.push(` ${keyword} ${constant.name}${letTypeAnnotation} = ${constValue}`);
|
|
198799
198910
|
}
|
|
198800
198911
|
for (const func of localFunctions) {
|
|
198801
198912
|
if (moduleScopeNames.has(func.name))
|
|
@@ -198902,7 +199013,8 @@ class JsxAdapter extends BaseAdapter {
|
|
|
198902
199013
|
const keyword = c.declarationKind ?? "const";
|
|
198903
199014
|
const exportKw = c.isExported ? "export " : "";
|
|
198904
199015
|
if (!c.value) {
|
|
198905
|
-
|
|
199016
|
+
const typeAnnotation = preserveTypes && (c.typeAnnotation ?? c.type) ? `: ${c.typeAnnotation ?? c.type?.raw}` : "";
|
|
199017
|
+
entries.push({ line: c.loc.start.line, text: `${exportKw}${keyword} ${c.name}${typeAnnotation}` });
|
|
198906
199018
|
continue;
|
|
198907
199019
|
}
|
|
198908
199020
|
const trimmed = c.value.trim();
|
|
@@ -198911,7 +199023,8 @@ class JsxAdapter extends BaseAdapter {
|
|
|
198911
199023
|
if (c.isExported && /^createContext\b/.test(trimmed))
|
|
198912
199024
|
continue;
|
|
198913
199025
|
const value = preserveTypes ? c.typedValue ?? c.value : c.value;
|
|
198914
|
-
|
|
199026
|
+
const letTypeAnnotation = preserveTypes && keyword === "let" && c.typeAnnotation ? `: ${c.typeAnnotation}` : "";
|
|
199027
|
+
entries.push({ line: c.loc.start.line, text: `${exportKw}${keyword} ${c.name}${letTypeAnnotation} = ${value}` });
|
|
198915
199028
|
}
|
|
198916
199029
|
for (const f of ir.metadata.localFunctions) {
|
|
198917
199030
|
if (!f.isModule || !moduleNames.has(f.name))
|
|
@@ -198960,6 +199073,7 @@ class JsxAdapter extends BaseAdapter {
|
|
|
198960
199073
|
}
|
|
198961
199074
|
|
|
198962
199075
|
// ../jsx/src/adapters/template-imports.ts
|
|
199076
|
+
var import_typescript25 = __toESM(require_typescript(), 1);
|
|
198963
199077
|
var CLIENT_PACKAGE_SOURCES = new Set([
|
|
198964
199078
|
"@barefootjs/client",
|
|
198965
199079
|
"@barefootjs/client/runtime"
|
|
@@ -199349,9 +199463,9 @@ function registerBuiltinLoweringPlugins() {
|
|
|
199349
199463
|
registerLoweringPlugin(plugin);
|
|
199350
199464
|
}
|
|
199351
199465
|
// ../jsx/src/combine-client-js.ts
|
|
199352
|
-
var import_typescript25 = __toESM(require_typescript(), 1);
|
|
199353
|
-
// ../jsx/src/debug.ts
|
|
199354
199466
|
var import_typescript26 = __toESM(require_typescript(), 1);
|
|
199467
|
+
// ../jsx/src/debug.ts
|
|
199468
|
+
var import_typescript27 = __toESM(require_typescript(), 1);
|
|
199355
199469
|
function escapeForIdBoundary(name) {
|
|
199356
199470
|
return name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
199357
199471
|
}
|
|
@@ -199443,7 +199557,7 @@ function resolveSetters(handler, setterToSignal, fnSetters) {
|
|
|
199443
199557
|
return refs;
|
|
199444
199558
|
}
|
|
199445
199559
|
// ../jsx/src/profiler.ts
|
|
199446
|
-
var
|
|
199560
|
+
var import_typescript28 = __toESM(require_typescript(), 1);
|
|
199447
199561
|
|
|
199448
199562
|
// ../jsx/src/index.ts
|
|
199449
199563
|
registerBuiltinLoweringPlugins();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barefootjs/test",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.4",
|
|
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.31.
|
|
42
|
+
"@barefootjs/jsx": "0.31.4"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"typescript": "^5.0.0"
|