@barefootjs/test 0.33.2 → 0.33.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 +297 -50
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -187288,7 +187288,7 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
|
|
|
187288
187288
|
});
|
|
187289
187289
|
|
|
187290
187290
|
// ../jsx/src/compiler.ts
|
|
187291
|
-
var
|
|
187291
|
+
var import_typescript25 = __toESM(require_typescript(), 1);
|
|
187292
187292
|
|
|
187293
187293
|
// ../jsx/src/analyzer.ts
|
|
187294
187294
|
var import_typescript9 = __toESM(require_typescript(), 1);
|
|
@@ -188980,6 +188980,11 @@ function applyReplacement(slice, re, replacement) {
|
|
|
188980
188980
|
var BF_SCOPE = "bf-s";
|
|
188981
188981
|
var BF_SLOT = "bf";
|
|
188982
188982
|
var BF_COND = "bf-c";
|
|
188983
|
+
var BF_KEY = "data-key";
|
|
188984
|
+
var BF_KEY_PREFIX = "data-key-";
|
|
188985
|
+
function keyAttrName(loopDepth) {
|
|
188986
|
+
return loopDepth > 0 ? `${BF_KEY_PREFIX}${loopDepth}` : BF_KEY;
|
|
188987
|
+
}
|
|
188983
188988
|
// ../shared/src/dom-prop.ts
|
|
188984
188989
|
var BOOLEAN_ATTRS = new Set([
|
|
188985
188990
|
"checked",
|
|
@@ -189625,6 +189630,19 @@ function buildPropAliasMap(params) {
|
|
|
189625
189630
|
}
|
|
189626
189631
|
return map;
|
|
189627
189632
|
}
|
|
189633
|
+
function resolveRestSpreadOriginCore(bindings, constantValues, name) {
|
|
189634
|
+
const visited = new Set;
|
|
189635
|
+
let current = name.trim();
|
|
189636
|
+
while (current !== undefined && !visited.has(current)) {
|
|
189637
|
+
if (bindings.restPropsName && current === bindings.restPropsName)
|
|
189638
|
+
return "rest";
|
|
189639
|
+
if (bindings.propsObjectName && current === bindings.propsObjectName)
|
|
189640
|
+
return "props";
|
|
189641
|
+
visited.add(current);
|
|
189642
|
+
current = constantValues.get(current)?.trim();
|
|
189643
|
+
}
|
|
189644
|
+
return null;
|
|
189645
|
+
}
|
|
189628
189646
|
|
|
189629
189647
|
// ../jsx/src/instrumentation.ts
|
|
189630
189648
|
var _enabled = false;
|
|
@@ -194951,10 +194969,44 @@ function attachParsedExpressions(node, analyzer, bound = EMPTY_BOUND) {
|
|
|
194951
194969
|
break;
|
|
194952
194970
|
}
|
|
194953
194971
|
}
|
|
194972
|
+
function resolveRootKeyAttr(node) {
|
|
194973
|
+
if (!node)
|
|
194974
|
+
return;
|
|
194975
|
+
switch (node.type) {
|
|
194976
|
+
case "element":
|
|
194977
|
+
if (node.needsScope && !node.keyAttr)
|
|
194978
|
+
node.keyAttr = { name: BF_KEY };
|
|
194979
|
+
for (const c of node.children)
|
|
194980
|
+
resolveRootKeyAttr(c);
|
|
194981
|
+
return;
|
|
194982
|
+
case "fragment":
|
|
194983
|
+
case "component":
|
|
194984
|
+
case "provider":
|
|
194985
|
+
case "loop":
|
|
194986
|
+
for (const c of node.children)
|
|
194987
|
+
resolveRootKeyAttr(c);
|
|
194988
|
+
return;
|
|
194989
|
+
case "async":
|
|
194990
|
+
resolveRootKeyAttr(node.fallback);
|
|
194991
|
+
for (const c of node.children)
|
|
194992
|
+
resolveRootKeyAttr(c);
|
|
194993
|
+
return;
|
|
194994
|
+
case "conditional":
|
|
194995
|
+
resolveRootKeyAttr(node.whenTrue);
|
|
194996
|
+
resolveRootKeyAttr(node.whenFalse);
|
|
194997
|
+
return;
|
|
194998
|
+
case "if-statement":
|
|
194999
|
+
resolveRootKeyAttr(node.consequent);
|
|
195000
|
+
resolveRootKeyAttr(node.alternate);
|
|
195001
|
+
return;
|
|
195002
|
+
}
|
|
195003
|
+
}
|
|
194954
195004
|
function jsxToIR(analyzer) {
|
|
194955
195005
|
const root = buildIRRoot(analyzer);
|
|
194956
|
-
if (root)
|
|
195006
|
+
if (root) {
|
|
194957
195007
|
attachParsedExpressions(root, analyzer);
|
|
195008
|
+
resolveRootKeyAttr(root);
|
|
195009
|
+
}
|
|
194958
195010
|
return root;
|
|
194959
195011
|
}
|
|
194960
195012
|
function buildIRRoot(analyzer) {
|
|
@@ -195143,6 +195195,7 @@ function lowerFormControlValueSsr(tagName, attrs, children) {
|
|
|
195143
195195
|
type: "expression",
|
|
195144
195196
|
expr,
|
|
195145
195197
|
templateExpr: `escapeText(${templateExpr ?? expr})`,
|
|
195198
|
+
escapeInClientTemplate: true,
|
|
195146
195199
|
typeInfo: null,
|
|
195147
195200
|
reactive: false,
|
|
195148
195201
|
slotId: null,
|
|
@@ -195180,7 +195233,7 @@ function transformHtmlElement(node, ctx, tagName) {
|
|
|
195180
195233
|
ctx.isRoot = false;
|
|
195181
195234
|
const children = transformChildren(node.children, ctx);
|
|
195182
195235
|
lowerFormControlValueSsr(tagName, attrs, children);
|
|
195183
|
-
const needsSlot = events.length > 0 || hasDynamicContent(children) || hasReactiveAttributes(attrs, ctx) || ref !== null;
|
|
195236
|
+
const needsSlot = events.length > 0 || hasDynamicContent(children) || hasReactiveAttributes(attrs, ctx) || ref !== null || forwardsCallerRestProps(attrs, ctx);
|
|
195184
195237
|
const slotId = needsSlot ? generateSlotId(ctx) : null;
|
|
195185
195238
|
if (slotId) {
|
|
195186
195239
|
propagateSlotIdToLoops(children, slotId);
|
|
@@ -195213,7 +195266,7 @@ function transformSelfClosingElement(node, ctx) {
|
|
|
195213
195266
|
const { attrs, events, ref } = processAttributes(node.attributes, ctx);
|
|
195214
195267
|
const selfClosingChildren = [];
|
|
195215
195268
|
lowerFormControlValueSsr(tagName, attrs, selfClosingChildren);
|
|
195216
|
-
const needsSlot = events.length > 0 || hasReactiveAttributes(attrs, ctx) || ref !== null;
|
|
195269
|
+
const needsSlot = events.length > 0 || hasReactiveAttributes(attrs, ctx) || ref !== null || forwardsCallerRestProps(attrs, ctx);
|
|
195217
195270
|
const slotId = needsSlot ? generateSlotId(ctx) : null;
|
|
195218
195271
|
const needsScope = ctx.isRoot;
|
|
195219
195272
|
ctx.isRoot = false;
|
|
@@ -195452,7 +195505,9 @@ function markDataKeyCarrier(children) {
|
|
|
195452
195505
|
}
|
|
195453
195506
|
function markCarrierIn(node) {
|
|
195454
195507
|
if (node.type === "element") {
|
|
195455
|
-
|
|
195508
|
+
if (node.keyAttr)
|
|
195509
|
+
return null;
|
|
195510
|
+
return { ...node, keyAttr: { name: BF_KEY } };
|
|
195456
195511
|
}
|
|
195457
195512
|
if (node.type === "conditional") {
|
|
195458
195513
|
const cond = node;
|
|
@@ -195527,7 +195582,7 @@ function transformExpressionInner(expr, ctx, node, isClientOnly) {
|
|
|
195527
195582
|
if (isRenderNothingLiteral(expr, ctx)) {
|
|
195528
195583
|
return null;
|
|
195529
195584
|
}
|
|
195530
|
-
checkBareSignalOrMemoIdentifier(expr, ctx);
|
|
195585
|
+
checkBareSignalOrMemoIdentifier(expr, ctx, { descendNested: true });
|
|
195531
195586
|
if (import_typescript13.default.isIdentifier(expr)) {
|
|
195532
195587
|
const jsxNode = ctx.analyzer.jsxConstants.get(expr.text);
|
|
195533
195588
|
if (jsxNode) {
|
|
@@ -196406,6 +196461,10 @@ function extractLoopKey(node) {
|
|
|
196406
196461
|
return null;
|
|
196407
196462
|
return normalizeKeyExpr(a) === normalizeKeyExpr(b) ? a : null;
|
|
196408
196463
|
}
|
|
196464
|
+
if (node.type === "fragment") {
|
|
196465
|
+
const first = node.children.find((c) => !(c.type === "text" && typeof c.value === "string" && !c.value.trim()));
|
|
196466
|
+
return first ? extractLoopKey(first) : null;
|
|
196467
|
+
}
|
|
196409
196468
|
return null;
|
|
196410
196469
|
}
|
|
196411
196470
|
function keyAttrValueToExpr(v) {
|
|
@@ -196596,7 +196655,7 @@ function leafIsWirelessElement(el) {
|
|
|
196596
196655
|
}
|
|
196597
196656
|
if (import_typescript13.default.isJsxAttribute(attr)) {
|
|
196598
196657
|
const name = attr.name.getText();
|
|
196599
|
-
if (
|
|
196658
|
+
if (isEventHandlerAttrName(name)) {
|
|
196600
196659
|
ok = false;
|
|
196601
196660
|
return;
|
|
196602
196661
|
}
|
|
@@ -196644,6 +196703,22 @@ function tagLoopItemRootComponents(nodes) {
|
|
|
196644
196703
|
}
|
|
196645
196704
|
}
|
|
196646
196705
|
}
|
|
196706
|
+
function applyLoopKeyAttr(node, name, value) {
|
|
196707
|
+
if (node.type === "element") {
|
|
196708
|
+
node.keyAttr = { name, value };
|
|
196709
|
+
return;
|
|
196710
|
+
}
|
|
196711
|
+
if (node.type === "conditional") {
|
|
196712
|
+
applyLoopKeyAttr(node.whenTrue, name, value);
|
|
196713
|
+
applyLoopKeyAttr(node.whenFalse, name, value);
|
|
196714
|
+
return;
|
|
196715
|
+
}
|
|
196716
|
+
if (node.type === "fragment") {
|
|
196717
|
+
const first = node.children.find((c) => !(c.type === "text" && typeof c.value === "string" && !c.value.trim()));
|
|
196718
|
+
if (first)
|
|
196719
|
+
applyLoopKeyAttr(first, name, value);
|
|
196720
|
+
}
|
|
196721
|
+
}
|
|
196647
196722
|
function loopBodyItemConditional(children) {
|
|
196648
196723
|
const real = children.filter((c) => !(c.type === "text" && typeof c.value === "string" && !c.value.trim()));
|
|
196649
196724
|
if (real.length !== 1)
|
|
@@ -196874,7 +196949,7 @@ function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
|
|
|
196874
196949
|
children = [foldMultiReturnBranches(multiReturn, ctx, loc, ctx.getJS)];
|
|
196875
196950
|
const pre = multiReturn.preamble ?? [];
|
|
196876
196951
|
if (pre.length > 0) {
|
|
196877
|
-
preamble = preambleFromValueStatements(pre, ctx);
|
|
196952
|
+
preamble = preambleFromValueStatements(pre, ctx, body.statements);
|
|
196878
196953
|
if (!preamble.declarations && !isClientOnly && !(ctx.analyzer.acceptsCallbackBody?.("map") ?? false)) {
|
|
196879
196954
|
ctx.analyzer.errors.push(createError(ErrorCodes.UNSUPPORTED_JSX_PATTERN, loc, {
|
|
196880
196955
|
message: "A .map() callback body with a preamble before its branches cannot be " + "lowered to a template: the preamble is not a sequence of value " + "declarations, so this backend has no per-row local to carry into the " + "branches.",
|
|
@@ -196961,7 +197036,7 @@ function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
|
|
|
196961
197036
|
valueStmts.push(stmt);
|
|
196962
197037
|
}
|
|
196963
197038
|
if (valueStmts.length > 0) {
|
|
196964
|
-
preamble = preambleFromValueStatements(valueStmts, ctx);
|
|
197039
|
+
preamble = preambleFromValueStatements(valueStmts, ctx, body.statements);
|
|
196965
197040
|
if (!preamble.declarations && !isClientOnly && !(ctx.analyzer.acceptsCallbackBody?.("map") ?? false)) {
|
|
196966
197041
|
ctx.analyzer.errors.push(createError(ErrorCodes.UNSUPPORTED_JSX_PATTERN, getSourceLocation(body, ctx.sourceFile, ctx.filePath), {
|
|
196967
197042
|
message: "A .map() callback preamble that is not a sequence of value " + "declarations cannot be lowered to a template: this backend can " + "declare a per-row local, but cannot run arbitrary statements per row.",
|
|
@@ -197026,6 +197101,14 @@ function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
|
|
|
197026
197101
|
const itemConditional = children.length > 0 ? loopBodyItemConditional(children) : null;
|
|
197027
197102
|
const bodyIsItemConditional = itemConditional !== null;
|
|
197028
197103
|
const key = bodyIsItemConditional ? extractItemConditionalKey(itemConditional) : children.length > 0 ? extractLoopKey(children[0]) : null;
|
|
197104
|
+
if (key !== null) {
|
|
197105
|
+
const resolvedKeyAttrName = keyAttrName(depth);
|
|
197106
|
+
if (bodyIsItemConditional) {
|
|
197107
|
+
applyLoopKeyAttr(itemConditional, resolvedKeyAttrName, key);
|
|
197108
|
+
} else if (children.length > 0) {
|
|
197109
|
+
applyLoopKeyAttr(children[0], resolvedKeyAttrName, key);
|
|
197110
|
+
}
|
|
197111
|
+
}
|
|
197029
197112
|
const declaredNameSet = preamble && preamble.declaredNames.length > 0 ? new Set(preamble.declaredNames) : undefined;
|
|
197030
197113
|
if (key && declaredNameSet) {
|
|
197031
197114
|
const keyRefs = extractFreeIdentifiersFromText(key);
|
|
@@ -197416,7 +197499,7 @@ function computePreambleReactiveNames(statements, ctx) {
|
|
|
197416
197499
|
}
|
|
197417
197500
|
return reactiveNames;
|
|
197418
197501
|
}
|
|
197419
|
-
function preambleFromValueStatements(statements, ctx) {
|
|
197502
|
+
function preambleFromValueStatements(statements, ctx, bodyStatements) {
|
|
197420
197503
|
const segments = [];
|
|
197421
197504
|
const typedParts = [];
|
|
197422
197505
|
const declared = new Set;
|
|
@@ -197436,11 +197519,11 @@ function preambleFromValueStatements(statements, ctx) {
|
|
|
197436
197519
|
ssrText: tsxSourceText(typedParts.join(" ")),
|
|
197437
197520
|
declaredNames: [...declared],
|
|
197438
197521
|
builderNames: [],
|
|
197439
|
-
declarations: neutralPreambleDeclarations(statements, ctx) ?? undefined,
|
|
197522
|
+
declarations: neutralPreambleDeclarations(statements, ctx, bodyStatements) ?? undefined,
|
|
197440
197523
|
reactiveNames: reactiveNames.size > 0 ? [...reactiveNames] : undefined
|
|
197441
197524
|
};
|
|
197442
197525
|
}
|
|
197443
|
-
function neutralPreambleDeclarations(statements, ctx) {
|
|
197526
|
+
function neutralPreambleDeclarations(statements, ctx, bodyStatements) {
|
|
197444
197527
|
const out = [];
|
|
197445
197528
|
for (const stmt of statements) {
|
|
197446
197529
|
if (!import_typescript13.default.isVariableStatement(stmt))
|
|
@@ -197450,6 +197533,11 @@ function neutralPreambleDeclarations(statements, ctx) {
|
|
|
197450
197533
|
return null;
|
|
197451
197534
|
if (!decl.initializer)
|
|
197452
197535
|
return null;
|
|
197536
|
+
if (isFunctionLiteral(decl.initializer)) {
|
|
197537
|
+
if (everyReadIsEventHandlerPropValue(decl.name.text, bodyStatements))
|
|
197538
|
+
continue;
|
|
197539
|
+
return null;
|
|
197540
|
+
}
|
|
197453
197541
|
const valueParsed = tsNodeToParsedExpr(decl.initializer);
|
|
197454
197542
|
if (!isSupported(valueParsed).supported)
|
|
197455
197543
|
return null;
|
|
@@ -197460,7 +197548,30 @@ function neutralPreambleDeclarations(statements, ctx) {
|
|
|
197460
197548
|
});
|
|
197461
197549
|
}
|
|
197462
197550
|
}
|
|
197463
|
-
return out
|
|
197551
|
+
return out;
|
|
197552
|
+
}
|
|
197553
|
+
function isFunctionLiteral(node) {
|
|
197554
|
+
return import_typescript13.default.isArrowFunction(node) || import_typescript13.default.isFunctionExpression(node);
|
|
197555
|
+
}
|
|
197556
|
+
function everyReadIsEventHandlerPropValue(name, bodyStatements) {
|
|
197557
|
+
const findDisallowedRead = (node) => {
|
|
197558
|
+
if (import_typescript13.default.isIdentifier(node) && node.text === name) {
|
|
197559
|
+
const isBindingName = import_typescript13.default.isVariableDeclaration(node.parent) && node.parent.name === node;
|
|
197560
|
+
const isPropertyName = import_typescript13.default.isPropertyAccessExpression(node.parent) && node.parent.name === node;
|
|
197561
|
+
if (!isBindingName && !isPropertyName) {
|
|
197562
|
+
const jsxExpr = node.parent;
|
|
197563
|
+
const attr = jsxExpr.parent;
|
|
197564
|
+
const isEventHandlerAttrValue = import_typescript13.default.isJsxExpression(jsxExpr) && import_typescript13.default.isJsxAttribute(attr) && attr.initializer === jsxExpr && import_typescript13.default.isIdentifier(attr.name) && isEventHandlerAttrName(attr.name.text);
|
|
197565
|
+
if (!isEventHandlerAttrValue)
|
|
197566
|
+
return true;
|
|
197567
|
+
}
|
|
197568
|
+
}
|
|
197569
|
+
return import_typescript13.default.forEachChild(node, findDisallowedRead);
|
|
197570
|
+
};
|
|
197571
|
+
return !bodyStatements.some(findDisallowedRead);
|
|
197572
|
+
}
|
|
197573
|
+
function isEventHandlerAttrName(name) {
|
|
197574
|
+
return /^on[A-Z]/.test(name);
|
|
197464
197575
|
}
|
|
197465
197576
|
function trimPreambleSegments(segments) {
|
|
197466
197577
|
const last = segments[segments.length - 1];
|
|
@@ -197657,7 +197768,7 @@ function processAttributes(attributes, ctx) {
|
|
|
197657
197768
|
}
|
|
197658
197769
|
continue;
|
|
197659
197770
|
}
|
|
197660
|
-
if (
|
|
197771
|
+
if (isEventHandlerAttrName(rawName)) {
|
|
197661
197772
|
if (attr.initializer && import_typescript13.default.isJsxExpression(attr.initializer) && attr.initializer.expression) {
|
|
197662
197773
|
const eventName = rawName.slice(2).toLowerCase();
|
|
197663
197774
|
reportJsxBranchLocalInCallback(attr.initializer.expression, ctx);
|
|
@@ -197716,7 +197827,7 @@ function getAttributeValue(attr, ctx) {
|
|
|
197716
197827
|
ctx.analyzer.errors.push(createError(ErrorCodes.STAGE_AWAIT_IN_TEMPLATE, getSourceLocation(expr, ctx.sourceFile, ctx.filePath)));
|
|
197717
197828
|
return AttrValueOf.expression("undefined");
|
|
197718
197829
|
}
|
|
197719
|
-
checkBareSignalOrMemoIdentifier(expr, ctx);
|
|
197830
|
+
checkBareSignalOrMemoIdentifier(expr, ctx, { descendNested: isRenderedElementAttribute(attr, ctx) });
|
|
197720
197831
|
if (attr.name.getText(ctx.sourceFile) === "style" && import_typescript13.default.isObjectLiteralExpression(expr)) {
|
|
197721
197832
|
const cssString = tryStaticStyleObjectToCss(expr);
|
|
197722
197833
|
if (cssString !== null) {
|
|
@@ -198224,34 +198335,142 @@ function processComponentProps(attributes, ctx) {
|
|
|
198224
198335
|
}
|
|
198225
198336
|
return props;
|
|
198226
198337
|
}
|
|
198227
|
-
function
|
|
198228
|
-
|
|
198338
|
+
function isRenderedElementAttribute(attr, ctx) {
|
|
198339
|
+
const tagName = attr.parent.parent.tagName.getText(ctx.sourceFile);
|
|
198340
|
+
return !/^[A-Z]/.test(tagName);
|
|
198341
|
+
}
|
|
198342
|
+
function checkBareSignalOrMemoIdentifier(expr, ctx, options) {
|
|
198343
|
+
const reactiveNames = new Map;
|
|
198344
|
+
for (const signal of ctx.analyzer.signals)
|
|
198345
|
+
reactiveNames.set(signal.getter, "signal");
|
|
198346
|
+
for (const memo of ctx.analyzer.memos)
|
|
198347
|
+
reactiveNames.set(memo.name, "memo");
|
|
198348
|
+
if (reactiveNames.size === 0)
|
|
198229
198349
|
return;
|
|
198230
|
-
const
|
|
198231
|
-
|
|
198232
|
-
|
|
198233
|
-
|
|
198234
|
-
|
|
198235
|
-
|
|
198236
|
-
|
|
198237
|
-
|
|
198238
|
-
|
|
198239
|
-
|
|
198350
|
+
const report = (id, name, kind) => {
|
|
198351
|
+
const label = kind === "signal" ? "Signal" : "Memo";
|
|
198352
|
+
ctx.analyzer.errors.push(createError(ErrorCodes.SIGNAL_GETTER_NOT_CALLED, getSourceLocation(id, ctx.sourceFile, ctx.filePath), {
|
|
198353
|
+
message: `${label} getter '${name}' passed without calling it`,
|
|
198354
|
+
suggestion: {
|
|
198355
|
+
message: `${label} getters must be called to read the value. Use \`${name}()\` instead of \`${name}\`.`,
|
|
198356
|
+
replacement: `${name}()`
|
|
198357
|
+
}
|
|
198358
|
+
}));
|
|
198359
|
+
};
|
|
198360
|
+
if (import_typescript13.default.isIdentifier(expr)) {
|
|
198361
|
+
const kind = reactiveNames.get(expr.text);
|
|
198362
|
+
if (kind && !ctx.scope.isBound(expr.text))
|
|
198363
|
+
report(expr, expr.text, kind);
|
|
198364
|
+
return;
|
|
198365
|
+
}
|
|
198366
|
+
if (!options?.descendNested)
|
|
198367
|
+
return;
|
|
198368
|
+
const boundStack = [];
|
|
198369
|
+
const isBound = (name) => {
|
|
198370
|
+
for (let i2 = boundStack.length - 1;i2 >= 0; i2--) {
|
|
198371
|
+
if (boundStack[i2].has(name))
|
|
198372
|
+
return true;
|
|
198373
|
+
}
|
|
198374
|
+
return ctx.scope.isBound(name);
|
|
198375
|
+
};
|
|
198376
|
+
const visitBindingDefaults = (name, bound) => {
|
|
198377
|
+
if (import_typescript13.default.isIdentifier(name)) {
|
|
198378
|
+
bound.add(name.text);
|
|
198240
198379
|
return;
|
|
198241
198380
|
}
|
|
198242
|
-
|
|
198243
|
-
|
|
198244
|
-
|
|
198245
|
-
|
|
198246
|
-
|
|
198247
|
-
|
|
198248
|
-
|
|
198249
|
-
|
|
198250
|
-
|
|
198251
|
-
|
|
198381
|
+
for (const el of name.elements) {
|
|
198382
|
+
if (import_typescript13.default.isOmittedExpression(el))
|
|
198383
|
+
continue;
|
|
198384
|
+
if (el.initializer)
|
|
198385
|
+
visit2(el.initializer);
|
|
198386
|
+
visitBindingDefaults(el.name, bound);
|
|
198387
|
+
}
|
|
198388
|
+
};
|
|
198389
|
+
const collectBindingNames3 = (name, out) => {
|
|
198390
|
+
if (import_typescript13.default.isIdentifier(name))
|
|
198391
|
+
out.add(name.text);
|
|
198392
|
+
else if (import_typescript13.default.isObjectBindingPattern(name)) {
|
|
198393
|
+
for (const el of name.elements)
|
|
198394
|
+
collectBindingNames3(el.name, out);
|
|
198395
|
+
} else if (import_typescript13.default.isArrayBindingPattern(name)) {
|
|
198396
|
+
for (const el of name.elements) {
|
|
198397
|
+
if (!import_typescript13.default.isOmittedExpression(el))
|
|
198398
|
+
collectBindingNames3(el.name, out);
|
|
198399
|
+
}
|
|
198400
|
+
}
|
|
198401
|
+
};
|
|
198402
|
+
const collectBlockDeclarations = (block, out) => {
|
|
198403
|
+
for (const stmt of block.statements) {
|
|
198404
|
+
if (import_typescript13.default.isVariableStatement(stmt)) {
|
|
198405
|
+
for (const decl of stmt.declarationList.declarations)
|
|
198406
|
+
collectBindingNames3(decl.name, out);
|
|
198407
|
+
} else if (import_typescript13.default.isFunctionDeclaration(stmt) && stmt.name) {
|
|
198408
|
+
out.add(stmt.name.text);
|
|
198409
|
+
}
|
|
198410
|
+
}
|
|
198411
|
+
};
|
|
198412
|
+
function visit2(node) {
|
|
198413
|
+
if (import_typescript13.default.isJsxElement(node) || import_typescript13.default.isJsxSelfClosingElement(node) || import_typescript13.default.isJsxFragment(node)) {
|
|
198252
198414
|
return;
|
|
198253
198415
|
}
|
|
198416
|
+
if (import_typescript13.default.isTypeNode(node))
|
|
198417
|
+
return;
|
|
198418
|
+
if (import_typescript13.default.isCallExpression(node) && node.arguments.length === 0 && import_typescript13.default.isIdentifier(node.expression)) {
|
|
198419
|
+
return;
|
|
198420
|
+
}
|
|
198421
|
+
if (import_typescript13.default.isPropertyAccessExpression(node)) {
|
|
198422
|
+
visit2(node.expression);
|
|
198423
|
+
return;
|
|
198424
|
+
}
|
|
198425
|
+
if (import_typescript13.default.isPropertyAssignment(node)) {
|
|
198426
|
+
if (import_typescript13.default.isComputedPropertyName(node.name))
|
|
198427
|
+
visit2(node.name.expression);
|
|
198428
|
+
visit2(node.initializer);
|
|
198429
|
+
return;
|
|
198430
|
+
}
|
|
198431
|
+
if (import_typescript13.default.isShorthandPropertyAssignment(node)) {
|
|
198432
|
+
if (import_typescript13.default.isIdentifier(node.name) && !isBound(node.name.text)) {
|
|
198433
|
+
const kind = reactiveNames.get(node.name.text);
|
|
198434
|
+
if (kind)
|
|
198435
|
+
report(node.name, node.name.text, kind);
|
|
198436
|
+
}
|
|
198437
|
+
return;
|
|
198438
|
+
}
|
|
198439
|
+
if (import_typescript13.default.isArrowFunction(node) || import_typescript13.default.isFunctionExpression(node)) {
|
|
198440
|
+
const bound = new Set;
|
|
198441
|
+
boundStack.push(bound);
|
|
198442
|
+
for (const p of node.parameters) {
|
|
198443
|
+
if (p.initializer)
|
|
198444
|
+
visit2(p.initializer);
|
|
198445
|
+
visitBindingDefaults(p.name, bound);
|
|
198446
|
+
}
|
|
198447
|
+
if (node.body && import_typescript13.default.isBlock(node.body))
|
|
198448
|
+
collectBlockDeclarations(node.body, bound);
|
|
198449
|
+
if (node.body)
|
|
198450
|
+
visit2(node.body);
|
|
198451
|
+
boundStack.pop();
|
|
198452
|
+
return;
|
|
198453
|
+
}
|
|
198454
|
+
if (import_typescript13.default.isVariableDeclaration(node)) {
|
|
198455
|
+
if (node.initializer)
|
|
198456
|
+
visit2(node.initializer);
|
|
198457
|
+
const declared = new Set;
|
|
198458
|
+
boundStack.push(declared);
|
|
198459
|
+
visitBindingDefaults(node.name, declared);
|
|
198460
|
+
boundStack.pop();
|
|
198461
|
+
return;
|
|
198462
|
+
}
|
|
198463
|
+
if (import_typescript13.default.isIdentifier(node)) {
|
|
198464
|
+
if (isBound(node.text))
|
|
198465
|
+
return;
|
|
198466
|
+
const kind = reactiveNames.get(node.text);
|
|
198467
|
+
if (kind)
|
|
198468
|
+
report(node, node.text, kind);
|
|
198469
|
+
return;
|
|
198470
|
+
}
|
|
198471
|
+
import_typescript13.default.forEachChild(node, visit2);
|
|
198254
198472
|
}
|
|
198473
|
+
visit2(expr);
|
|
198255
198474
|
}
|
|
198256
198475
|
function isArrayExprDirectPropRef(arrayExpr, ctx) {
|
|
198257
198476
|
const propNames = new Set(ctx.patterns.props.map((p) => p.name));
|
|
@@ -198350,6 +198569,31 @@ function isPropsReference(expr, ctx, visited) {
|
|
|
198350
198569
|
}
|
|
198351
198570
|
return false;
|
|
198352
198571
|
}
|
|
198572
|
+
function forwardsCallerRestProps(attrs, ctx) {
|
|
198573
|
+
for (const attr of attrs) {
|
|
198574
|
+
if (attr.value.kind !== "spread")
|
|
198575
|
+
continue;
|
|
198576
|
+
const constants3 = restSpreadConstantValues(ctx);
|
|
198577
|
+
for (const name of new Set([attr.value.expr, attr.value.templateExpr])) {
|
|
198578
|
+
if (!name)
|
|
198579
|
+
continue;
|
|
198580
|
+
if (resolveRestSpreadOriginCore(ctx.analyzer, constants3, name) !== null)
|
|
198581
|
+
return true;
|
|
198582
|
+
}
|
|
198583
|
+
}
|
|
198584
|
+
return false;
|
|
198585
|
+
}
|
|
198586
|
+
function restSpreadConstantValues(ctx) {
|
|
198587
|
+
if (ctx._restSpreadConstantValues)
|
|
198588
|
+
return ctx._restSpreadConstantValues;
|
|
198589
|
+
const byName = new Map;
|
|
198590
|
+
for (const constant of ctx.analyzer.localConstants) {
|
|
198591
|
+
if (!byName.has(constant.name))
|
|
198592
|
+
byName.set(constant.name, constant.value);
|
|
198593
|
+
}
|
|
198594
|
+
ctx._restSpreadConstantValues = byName;
|
|
198595
|
+
return byName;
|
|
198596
|
+
}
|
|
198353
198597
|
function hasReactiveAttributes(attrs, ctx) {
|
|
198354
198598
|
for (const attr of attrs) {
|
|
198355
198599
|
if (attr.name === "key")
|
|
@@ -198695,11 +198939,14 @@ var KEYWORDS_AND_GLOBALS = new Set([
|
|
|
198695
198939
|
// ../jsx/src/ir-to-client-js/walk-prop-accesses.ts
|
|
198696
198940
|
var import_typescript14 = __toESM(require_typescript(), 1);
|
|
198697
198941
|
|
|
198942
|
+
// ../jsx/src/ir-to-client-js/imports.ts
|
|
198943
|
+
var import_typescript16 = __toESM(require_typescript(), 1);
|
|
198944
|
+
|
|
198698
198945
|
// ../jsx/src/value-references.ts
|
|
198699
198946
|
var import_typescript15 = __toESM(require_typescript(), 1);
|
|
198700
198947
|
|
|
198701
198948
|
// ../jsx/src/relocate.ts
|
|
198702
|
-
var
|
|
198949
|
+
var import_typescript17 = __toESM(require_typescript(), 1);
|
|
198703
198950
|
|
|
198704
198951
|
// ../jsx/src/lowering-registry.ts
|
|
198705
198952
|
var plugins = [];
|
|
@@ -198878,10 +199125,10 @@ function formatDateLocalNames(metadata) {
|
|
|
198878
199125
|
}
|
|
198879
199126
|
|
|
198880
199127
|
// ../jsx/src/ir-to-client-js/prune-unused-prop-extractions.ts
|
|
198881
|
-
var
|
|
199128
|
+
var import_typescript18 = __toESM(require_typescript(), 1);
|
|
198882
199129
|
|
|
198883
199130
|
// ../jsx/src/ir-to-client-js/control-flow/plan/lazy-preamble.ts
|
|
198884
|
-
var
|
|
199131
|
+
var import_typescript19 = __toESM(require_typescript(), 1);
|
|
198885
199132
|
var NO_PREAMBLE = {
|
|
198886
199133
|
lazySafe: true,
|
|
198887
199134
|
facts: { declaredNames: new Set, freeNames: new Set }
|
|
@@ -198931,7 +199178,7 @@ var INERT_BINDING_GLOBALS = new Set([
|
|
|
198931
199178
|
]);
|
|
198932
199179
|
|
|
198933
199180
|
// ../jsx/src/ir-to-client-js/emit-reactive.ts
|
|
198934
|
-
var
|
|
199181
|
+
var import_typescript20 = __toESM(require_typescript(), 1);
|
|
198935
199182
|
|
|
198936
199183
|
// ../jsx/src/ir-to-client-js/control-flow/stringify/event-delegation.ts
|
|
198937
199184
|
var NON_BUBBLING_EVENTS = new Set([
|
|
@@ -198946,7 +199193,7 @@ var NON_BUBBLING_EVENTS = new Set([
|
|
|
198946
199193
|
]);
|
|
198947
199194
|
|
|
198948
199195
|
// ../jsx/src/ir-to-client-js/rewrite-props-object.ts
|
|
198949
|
-
var
|
|
199196
|
+
var import_typescript21 = __toESM(require_typescript(), 1);
|
|
198950
199197
|
|
|
198951
199198
|
// ../jsx/src/ir-to-client-js/source-map.ts
|
|
198952
199199
|
var BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
@@ -199037,21 +199284,21 @@ class SourceMapGenerator {
|
|
|
199037
199284
|
}
|
|
199038
199285
|
|
|
199039
199286
|
// ../jsx/src/preprocess-inline-jsx-callbacks.ts
|
|
199040
|
-
var
|
|
199287
|
+
var import_typescript22 = __toESM(require_typescript(), 1);
|
|
199041
199288
|
|
|
199042
199289
|
// ../jsx/src/ssr-defaults.ts
|
|
199043
|
-
var
|
|
199290
|
+
var import_typescript23 = __toESM(require_typescript(), 1);
|
|
199044
199291
|
var UNRESOLVED = Symbol("unresolved");
|
|
199045
199292
|
var NO_RETURN = Symbol("no-return");
|
|
199046
199293
|
|
|
199047
199294
|
// ../jsx/src/augment-inherited-props.ts
|
|
199048
|
-
var
|
|
199295
|
+
var import_typescript24 = __toESM(require_typescript(), 1);
|
|
199049
199296
|
|
|
199050
199297
|
// ../jsx/src/rich-type-refusal.ts
|
|
199051
199298
|
var EMPTY_BINDINGS2 = new Map;
|
|
199052
199299
|
// ../jsx/src/shared-program.ts
|
|
199053
199300
|
init_path();
|
|
199054
|
-
var
|
|
199301
|
+
var import_typescript26 = __toESM(require_typescript(), 1);
|
|
199055
199302
|
// ../jsx/src/adapters/interface.ts
|
|
199056
199303
|
class BaseAdapter {
|
|
199057
199304
|
renderChildren(children) {
|
|
@@ -199333,7 +199580,7 @@ class JsxAdapter extends BaseAdapter {
|
|
|
199333
199580
|
}
|
|
199334
199581
|
|
|
199335
199582
|
// ../jsx/src/adapters/template-imports.ts
|
|
199336
|
-
var
|
|
199583
|
+
var import_typescript27 = __toESM(require_typescript(), 1);
|
|
199337
199584
|
var CLIENT_PACKAGE_SOURCES = new Set([
|
|
199338
199585
|
"@barefootjs/client",
|
|
199339
199586
|
"@barefootjs/client/runtime"
|
|
@@ -199726,9 +199973,9 @@ function registerBuiltinLoweringPlugins() {
|
|
|
199726
199973
|
registerLoweringPlugin(plugin);
|
|
199727
199974
|
}
|
|
199728
199975
|
// ../jsx/src/combine-client-js.ts
|
|
199729
|
-
var import_typescript27 = __toESM(require_typescript(), 1);
|
|
199730
|
-
// ../jsx/src/debug.ts
|
|
199731
199976
|
var import_typescript28 = __toESM(require_typescript(), 1);
|
|
199977
|
+
// ../jsx/src/debug.ts
|
|
199978
|
+
var import_typescript29 = __toESM(require_typescript(), 1);
|
|
199732
199979
|
function escapeForIdBoundary(name) {
|
|
199733
199980
|
return name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
199734
199981
|
}
|
|
@@ -199820,7 +200067,7 @@ function resolveSetters(handler, setterToSignal, fnSetters) {
|
|
|
199820
200067
|
return refs;
|
|
199821
200068
|
}
|
|
199822
200069
|
// ../jsx/src/profiler.ts
|
|
199823
|
-
var
|
|
200070
|
+
var import_typescript30 = __toESM(require_typescript(), 1);
|
|
199824
200071
|
|
|
199825
200072
|
// ../jsx/src/index.ts
|
|
199826
200073
|
registerBuiltinLoweringPlugins();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barefootjs/test",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.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.33.
|
|
42
|
+
"@barefootjs/jsx": "0.33.4"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"typescript": "^5.0.0"
|