@barefootjs/cli 0.28.0 → 0.28.1

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.
Files changed (2) hide show
  1. package/dist/index.js +507 -387
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -5553,6 +5553,13 @@ var init_errors = __esm({
5553
5553
  // so an unimported tag with the built-in name is either a forgotten import
5554
5554
  // or an undeclared component — fail loud with the import to add.
5555
5555
  BUILTIN_REQUIRES_IMPORT: "BF054",
5556
+ // A relative `.ts` module inlined into a client bundle (`resolveRelativeImports`'s
5557
+ // top-level IIFE wrap) was asked for a name it does not export. The IIFE's
5558
+ // `return { … }` has no binding for that name, so the reference throws
5559
+ // `ReferenceError: <name> is not defined` at load — killing the page's
5560
+ // client JS before hydrate. Fail the build instead of shipping the
5561
+ // dangling reference (#2432).
5562
+ INLINED_IMPORT_MISSING_EXPORT: "BF055",
5556
5563
  // Init statement errors (BF052)
5557
5564
  UNDECLARED_INIT_STATEMENT_REFERENCE: "BF052",
5558
5565
  // Stripped-import diagnostics (BF053) — a relative import was removed
@@ -5614,6 +5621,7 @@ var init_errors = __esm({
5614
5621
  [ErrorCodes.BUILTIN_REQUIRES_IMPORT]: "Built-in <Async> / <Region> must be imported from '@barefootjs/client'. The compiler recognises these tags by their import (not by tag name), so an unimported tag with this name is treated as an undeclared component.",
5615
5622
  [ErrorCodes.UNDECLARED_INIT_STATEMENT_REFERENCE]: "Init statement references an undeclared identifier. Declare it at module scope, inside the component, or import it \u2014 otherwise ESM strict mode throws ReferenceError at runtime.",
5616
5623
  [ErrorCodes.STRIPPED_CLIENT_IMPORT_REFERENCED]: "Import was stripped from the client bundle but its binding is still referenced. Client components ('use client' .tsx) are not callable as plain functions from imperative .ts modules \u2014 render them as JSX from a 'use client' parent instead. If the flagged name is a local shadow rather than the stripped import, please file an issue.",
5624
+ [ErrorCodes.INLINED_IMPORT_MISSING_EXPORT]: "An inlined relative import requests a name the target module does not export. The client bundle would throw ReferenceError at load.",
5617
5625
  [ErrorCodes.STAGE_REACTIVE_IN_TEMPLATE]: "Reactive binding (signal getter or memo) referenced from template scope. The template lambda runs at module scope without the reactive context, so the value cannot be evaluated at SSR. Wrap the JSX expression in /* @client */ to defer it to hydrate, or restructure so the template uses a prop or static value.",
5618
5626
  [ErrorCodes.STAGE_INIT_LOCAL_IN_TEMPLATE]: "Init-scope local referenced from template scope. The template lambda runs at module scope (via render() / renderChild()) and cannot reach init-body locals. Wrap the JSX expression in /* @client */, or lift the value to a prop or module-scope const.",
5619
5627
  [ErrorCodes.STAGE_AWAIT_IN_TEMPLATE]: "AwaitExpression in template scope. The generated template and init functions are synchronous \u2014 a bare `await` produces a SyntaxError at parse time. Move the await into the component body (before the return) or into an onMount/effect callback, and pass the resolved value to JSX.",
@@ -7874,6 +7882,7 @@ function importsBrowserOnlyClientApi(ctx2) {
7874
7882
  if (imp.source !== "@barefootjs/client") continue;
7875
7883
  if (imp.isTypeOnly) continue;
7876
7884
  for (const spec of imp.specifiers) {
7885
+ if (spec.isTypeOnly) continue;
7877
7886
  const importedName = spec.name;
7878
7887
  if (BROWSER_ONLY_CLIENT_APIS.has(importedName)) return true;
7879
7888
  }
@@ -15274,6 +15283,64 @@ var init_compute_prop_usage = __esm({
15274
15283
  }
15275
15284
  });
15276
15285
 
15286
+ // ../jsx/src/value-references.ts
15287
+ import ts13 from "typescript";
15288
+ function isValueReferenceIdentifier(id2) {
15289
+ const parent2 = id2.parent;
15290
+ if (!parent2) return false;
15291
+ if (ts13.isPropertyAccessExpression(parent2) && parent2.name === id2) return false;
15292
+ if (ts13.isPropertyAssignment(parent2) && parent2.name === id2) return false;
15293
+ if ((ts13.isMethodDeclaration(parent2) || ts13.isGetAccessorDeclaration(parent2) || ts13.isSetAccessorDeclaration(parent2)) && parent2.name === id2) {
15294
+ return false;
15295
+ }
15296
+ if (ts13.isVariableDeclaration(parent2) && parent2.name === id2) return false;
15297
+ if (ts13.isFunctionDeclaration(parent2) && parent2.name === id2) return false;
15298
+ if (ts13.isFunctionExpression(parent2) && parent2.name === id2) return false;
15299
+ if (ts13.isClassDeclaration(parent2) && parent2.name === id2) return false;
15300
+ if (ts13.isClassExpression(parent2) && parent2.name === id2) return false;
15301
+ if (ts13.isParameter(parent2) && parent2.name === id2) return false;
15302
+ if (ts13.isBindingElement(parent2) && (parent2.name === id2 || parent2.propertyName === id2)) return false;
15303
+ if (ts13.isLabeledStatement(parent2) && parent2.label === id2) return false;
15304
+ if (ts13.isBreakOrContinueStatement(parent2) && parent2.label === id2) return false;
15305
+ if (ts13.isImportSpecifier(parent2) && (parent2.name === id2 || parent2.propertyName === id2)) return false;
15306
+ if (ts13.isExportSpecifier(parent2) && (parent2.name === id2 || parent2.propertyName === id2)) return false;
15307
+ if (ts13.isImportClause(parent2) && parent2.name === id2) return false;
15308
+ if (ts13.isNamespaceImport(parent2) && parent2.name === id2) return false;
15309
+ if (ts13.isQualifiedName(parent2) && parent2.right === id2) return false;
15310
+ return true;
15311
+ }
15312
+ function collectValueReferencedNames(code) {
15313
+ let sourceFile;
15314
+ try {
15315
+ sourceFile = ts13.createSourceFile(
15316
+ "generated.js",
15317
+ code,
15318
+ ts13.ScriptTarget.Latest,
15319
+ /*setParentNodes*/
15320
+ true,
15321
+ ts13.ScriptKind.JS
15322
+ );
15323
+ } catch {
15324
+ return null;
15325
+ }
15326
+ const diagnostics = sourceFile.parseDiagnostics;
15327
+ if (diagnostics && diagnostics.length > 0) return null;
15328
+ const names = /* @__PURE__ */ new Set();
15329
+ function visit3(node) {
15330
+ if (ts13.isIdentifier(node) && isValueReferenceIdentifier(node)) {
15331
+ names.add(node.text);
15332
+ }
15333
+ ts13.forEachChild(node, visit3);
15334
+ }
15335
+ visit3(sourceFile);
15336
+ return names;
15337
+ }
15338
+ var init_value_references = __esm({
15339
+ "../jsx/src/value-references.ts"() {
15340
+ "use strict";
15341
+ }
15342
+ });
15343
+
15277
15344
  // ../jsx/src/ir-to-client-js/imports.ts
15278
15345
  function detectUsedImports(code) {
15279
15346
  const used = /* @__PURE__ */ new Set();
@@ -15299,7 +15366,7 @@ function collectUserDomImports(ir) {
15299
15366
  for (const imp of ir.metadata.imports) {
15300
15367
  if (runtimeSources.has(imp.source) && !imp.isTypeOnly) {
15301
15368
  for (const spec of imp.specifiers) {
15302
- if (!spec.isDefault && !spec.isNamespace) {
15369
+ if (!spec.isDefault && !spec.isNamespace && !spec.isTypeOnly) {
15303
15370
  if (isClientBuiltinName(spec.name)) continue;
15304
15371
  userImports.push(spec.alias ? `${spec.name} as ${spec.alias}` : spec.name);
15305
15372
  }
@@ -15308,9 +15375,22 @@ function collectUserDomImports(ir) {
15308
15375
  }
15309
15376
  return userImports;
15310
15377
  }
15378
+ function makeValueUsageTest(generatedCode) {
15379
+ let referenced;
15380
+ return (localName2) => {
15381
+ if (referenced === void 0) {
15382
+ referenced = collectValueReferencedNames(generatedCode);
15383
+ }
15384
+ if (referenced !== null) {
15385
+ return referenced.has(localName2);
15386
+ }
15387
+ return generatedCode.includes(localName2);
15388
+ };
15389
+ }
15311
15390
  function collectExternalImports(ir, generatedCode, localImportPrefixes) {
15312
15391
  const componentNames = collectComponentNames(ir.root);
15313
15392
  const importLines = [];
15393
+ const isUsedAsValue = makeValueUsageTest(generatedCode);
15314
15394
  for (const imp of ir.metadata.imports) {
15315
15395
  if (imp.isTypeOnly) continue;
15316
15396
  if (imp.source === "@barefootjs/client" || imp.source === RUNTIME_MODULE) continue;
@@ -15321,9 +15401,10 @@ function collectExternalImports(ir, generatedCode, localImportPrefixes) {
15321
15401
  }
15322
15402
  const usedSpecs = [];
15323
15403
  for (const spec of imp.specifiers) {
15404
+ if (spec.isTypeOnly) continue;
15324
15405
  const localName2 = spec.alias || spec.name;
15325
15406
  if (componentNames.has(localName2)) continue;
15326
- if (new RegExp(`\\b${localName2}\\b`).test(generatedCode)) {
15407
+ if (isUsedAsValue(localName2)) {
15327
15408
  usedSpecs.push(spec.alias ? `${spec.name} as ${spec.alias}` : spec.name);
15328
15409
  }
15329
15410
  }
@@ -15363,6 +15444,7 @@ var init_imports = __esm({
15363
15444
  "../jsx/src/ir-to-client-js/imports.ts"() {
15364
15445
  "use strict";
15365
15446
  init_builtins();
15447
+ init_value_references();
15366
15448
  RUNTIME_IMPORT_CANDIDATES = [
15367
15449
  "createSignal",
15368
15450
  "createMemo",
@@ -15475,23 +15557,23 @@ var init_lowering_registry = __esm({
15475
15557
  });
15476
15558
 
15477
15559
  // ../jsx/src/relocate.ts
15478
- import ts13 from "typescript";
15560
+ import ts14 from "typescript";
15479
15561
  function classify(name2, env) {
15480
15562
  return env.bindings.get(name2) ?? "global";
15481
15563
  }
15482
15564
  function collectFreeRefs(node) {
15483
15565
  const refs = /* @__PURE__ */ new Map();
15484
15566
  function visit3(n, parent2) {
15485
- if (ts13.isIdentifier(n)) {
15486
- if (parent2 && ts13.isPropertyAccessExpression(parent2) && parent2.name === n) return;
15487
- if (parent2 && ts13.isPropertyAssignment(parent2) && parent2.name === n) return;
15488
- if (parent2 && ts13.isShorthandPropertyAssignment(parent2) && parent2.name === n) return;
15567
+ if (ts14.isIdentifier(n)) {
15568
+ if (parent2 && ts14.isPropertyAccessExpression(parent2) && parent2.name === n) return;
15569
+ if (parent2 && ts14.isPropertyAssignment(parent2) && parent2.name === n) return;
15570
+ if (parent2 && ts14.isShorthandPropertyAssignment(parent2) && parent2.name === n) return;
15489
15571
  const list = refs.get(n.text) ?? [];
15490
15572
  list.push(n);
15491
15573
  refs.set(n.text, list);
15492
15574
  return;
15493
15575
  }
15494
- ts13.forEachChild(n, (child) => visit3(child, n));
15576
+ ts14.forEachChild(n, (child) => visit3(child, n));
15495
15577
  }
15496
15578
  visit3(node);
15497
15579
  return refs;
@@ -15592,9 +15674,9 @@ function isInlinableInTemplate(value2, env) {
15592
15674
  return { ok: true, rewrittenValue: r2.text, decisions: r2.decisions };
15593
15675
  }
15594
15676
  function getCalleeIdentifierPath(callee) {
15595
- if (ts13.isParenthesizedExpression(callee)) return getCalleeIdentifierPath(callee.expression);
15596
- if (ts13.isIdentifier(callee)) return callee.text;
15597
- if (ts13.isPropertyAccessExpression(callee)) {
15677
+ if (ts14.isParenthesizedExpression(callee)) return getCalleeIdentifierPath(callee.expression);
15678
+ if (ts14.isIdentifier(callee)) return callee.text;
15679
+ if (ts14.isPropertyAccessExpression(callee)) {
15598
15680
  const left = getCalleeIdentifierPath(callee.expression);
15599
15681
  if (left === null) return null;
15600
15682
  return `${left}.${callee.name.text}`;
@@ -15602,9 +15684,9 @@ function getCalleeIdentifierPath(callee) {
15602
15684
  return null;
15603
15685
  }
15604
15686
  function getCalleeLeftmostIdentifier(callee) {
15605
- if (ts13.isParenthesizedExpression(callee)) return getCalleeLeftmostIdentifier(callee.expression);
15606
- if (ts13.isIdentifier(callee)) return callee.text;
15607
- if (ts13.isPropertyAccessExpression(callee)) {
15687
+ if (ts14.isParenthesizedExpression(callee)) return getCalleeLeftmostIdentifier(callee.expression);
15688
+ if (ts14.isIdentifier(callee)) return callee.text;
15689
+ if (ts14.isPropertyAccessExpression(callee)) {
15608
15690
  return getCalleeLeftmostIdentifier(callee.expression);
15609
15691
  }
15610
15692
  return null;
@@ -15643,17 +15725,17 @@ function isCallAcceptedByAdapter(call, env) {
15643
15725
  }
15644
15726
  function parseExpressionNode(text) {
15645
15727
  try {
15646
- const sf = ts13.createSourceFile(
15728
+ const sf = ts14.createSourceFile(
15647
15729
  "__inline_check__.ts",
15648
15730
  `(${text});`,
15649
- ts13.ScriptTarget.Latest,
15731
+ ts14.ScriptTarget.Latest,
15650
15732
  false,
15651
- ts13.ScriptKind.TS
15733
+ ts14.ScriptKind.TS
15652
15734
  );
15653
15735
  const stmt = sf.statements[0];
15654
- if (!stmt || !ts13.isExpressionStatement(stmt)) return null;
15736
+ if (!stmt || !ts14.isExpressionStatement(stmt)) return null;
15655
15737
  const inner = stmt.expression;
15656
- return ts13.isParenthesizedExpression(inner) ? inner.expression : inner;
15738
+ return ts14.isParenthesizedExpression(inner) ? inner.expression : inner;
15657
15739
  } catch {
15658
15740
  return null;
15659
15741
  }
@@ -15667,8 +15749,8 @@ function hasCallWithBridgedArg(node, decisions, env) {
15667
15749
  let found = false;
15668
15750
  function visit3(n) {
15669
15751
  if (found) return;
15670
- if (ts13.isCallExpression(n) || ts13.isNewExpression(n)) {
15671
- const accepted = ts13.isCallExpression(n) && isCallAcceptedByAdapter(n, env);
15752
+ if (ts14.isCallExpression(n) || ts14.isNewExpression(n)) {
15753
+ const accepted = ts14.isCallExpression(n) && isCallAcceptedByAdapter(n, env);
15672
15754
  if (!accepted) {
15673
15755
  const args2 = n.arguments;
15674
15756
  if (args2) {
@@ -15681,7 +15763,7 @@ function hasCallWithBridgedArg(node, decisions, env) {
15681
15763
  }
15682
15764
  }
15683
15765
  }
15684
- ts13.forEachChild(n, visit3);
15766
+ ts14.forEachChild(n, visit3);
15685
15767
  }
15686
15768
  visit3(node);
15687
15769
  return found;
@@ -15690,13 +15772,13 @@ function hasZeroArgCall(node, env) {
15690
15772
  let found = false;
15691
15773
  function visit3(n) {
15692
15774
  if (found) return;
15693
- if (ts13.isCallExpression(n) && n.arguments.length === 0) {
15775
+ if (ts14.isCallExpression(n) && n.arguments.length === 0) {
15694
15776
  if (!isCallAcceptedByAdapter(n, env)) {
15695
15777
  found = true;
15696
15778
  return;
15697
15779
  }
15698
15780
  }
15699
- ts13.forEachChild(n, visit3);
15781
+ ts14.forEachChild(n, visit3);
15700
15782
  }
15701
15783
  visit3(node);
15702
15784
  return found;
@@ -15705,25 +15787,25 @@ function containsAnyIdentifier(node, names) {
15705
15787
  let found = false;
15706
15788
  function visit3(n) {
15707
15789
  if (found) return;
15708
- if (ts13.isPropertyAccessExpression(n)) {
15790
+ if (ts14.isPropertyAccessExpression(n)) {
15709
15791
  visit3(n.expression);
15710
15792
  return;
15711
15793
  }
15712
- if (ts13.isPropertyAssignment(n)) {
15794
+ if (ts14.isPropertyAssignment(n)) {
15713
15795
  visit3(n.initializer);
15714
15796
  return;
15715
15797
  }
15716
- if (ts13.isShorthandPropertyAssignment(n)) {
15717
- if (ts13.isIdentifier(n.name) && names.has(n.name.text)) {
15798
+ if (ts14.isShorthandPropertyAssignment(n)) {
15799
+ if (ts14.isIdentifier(n.name) && names.has(n.name.text)) {
15718
15800
  found = true;
15719
15801
  }
15720
15802
  return;
15721
15803
  }
15722
- if (ts13.isIdentifier(n) && names.has(n.text)) {
15804
+ if (ts14.isIdentifier(n) && names.has(n.text)) {
15723
15805
  found = true;
15724
15806
  return;
15725
15807
  }
15726
- ts13.forEachChild(n, visit3);
15808
+ ts14.forEachChild(n, visit3);
15727
15809
  }
15728
15810
  visit3(node);
15729
15811
  return found;
@@ -19042,7 +19124,7 @@ var init_claim_plan = __esm({
19042
19124
  });
19043
19125
 
19044
19126
  // ../jsx/src/ir-to-client-js/emit-reactive.ts
19045
- import ts14 from "typescript";
19127
+ import ts15 from "typescript";
19046
19128
  function bindingIdArg(ctx2, slotId) {
19047
19129
  if (!ctx2.profile || !slotId) return "";
19048
19130
  return `, ${JSON.stringify(`${ctx2.componentName}#binding:${slotId}`)}`;
@@ -19122,19 +19204,19 @@ function lowerToLocaleCallsInReactiveExpr(expr, matcher) {
19122
19204
  if (!matcher) return expr;
19123
19205
  let sourceFile;
19124
19206
  try {
19125
- sourceFile = ts14.createSourceFile("__reactive_expr__.ts", `(${expr});`, ts14.ScriptTarget.Latest, true, ts14.ScriptKind.TS);
19207
+ sourceFile = ts15.createSourceFile("__reactive_expr__.ts", `(${expr});`, ts15.ScriptTarget.Latest, true, ts15.ScriptKind.TS);
19126
19208
  } catch {
19127
19209
  return expr;
19128
19210
  }
19129
19211
  const stmt = sourceFile.statements[0];
19130
- if (!stmt || !ts14.isExpressionStatement(stmt)) return expr;
19131
- const root2 = ts14.isParenthesizedExpression(stmt.expression) ? stmt.expression.expression : stmt.expression;
19212
+ if (!stmt || !ts15.isExpressionStatement(stmt)) return expr;
19213
+ const root2 = ts15.isParenthesizedExpression(stmt.expression) ? stmt.expression.expression : stmt.expression;
19132
19214
  const candidates = [];
19133
19215
  const visit3 = (n) => {
19134
- if (ts14.isCallExpression(n) && n.arguments.length === 2 && ts14.isPropertyAccessExpression(n.expression) && !n.expression.questionDotToken && n.expression.name.text === "toLocaleDateString") {
19216
+ if (ts15.isCallExpression(n) && n.arguments.length === 2 && ts15.isPropertyAccessExpression(n.expression) && !n.expression.questionDotToken && n.expression.name.text === "toLocaleDateString") {
19135
19217
  candidates.push(n);
19136
19218
  }
19137
- ts14.forEachChild(n, visit3);
19219
+ ts15.forEachChild(n, visit3);
19138
19220
  };
19139
19221
  visit3(root2);
19140
19222
  if (candidates.length === 0) return expr;
@@ -19171,19 +19253,19 @@ function lowerDateCallsInReactiveExpr(expr, matcher) {
19171
19253
  if (!matcher) return expr;
19172
19254
  let sourceFile;
19173
19255
  try {
19174
- sourceFile = ts14.createSourceFile("__reactive_expr__.ts", `(${expr});`, ts14.ScriptTarget.Latest, true, ts14.ScriptKind.TS);
19256
+ sourceFile = ts15.createSourceFile("__reactive_expr__.ts", `(${expr});`, ts15.ScriptTarget.Latest, true, ts15.ScriptKind.TS);
19175
19257
  } catch {
19176
19258
  return expr;
19177
19259
  }
19178
19260
  const stmt = sourceFile.statements[0];
19179
- if (!stmt || !ts14.isExpressionStatement(stmt)) return expr;
19180
- const root2 = ts14.isParenthesizedExpression(stmt.expression) ? stmt.expression.expression : stmt.expression;
19261
+ if (!stmt || !ts15.isExpressionStatement(stmt)) return expr;
19262
+ const root2 = ts15.isParenthesizedExpression(stmt.expression) ? stmt.expression.expression : stmt.expression;
19181
19263
  const candidates = [];
19182
19264
  const visit3 = (n) => {
19183
- if (ts14.isCallExpression(n) && n.arguments.length === 0 && ts14.isPropertyAccessExpression(n.expression) && !n.expression.questionDotToken && DATE_METHODS.has(n.expression.name.text)) {
19265
+ if (ts15.isCallExpression(n) && n.arguments.length === 0 && ts15.isPropertyAccessExpression(n.expression) && !n.expression.questionDotToken && DATE_METHODS.has(n.expression.name.text)) {
19184
19266
  candidates.push(n);
19185
19267
  }
19186
- ts14.forEachChild(n, visit3);
19268
+ ts15.forEachChild(n, visit3);
19187
19269
  };
19188
19270
  visit3(root2);
19189
19271
  if (candidates.length === 0) return expr;
@@ -21318,25 +21400,25 @@ var init_phases = __esm({
21318
21400
  });
21319
21401
 
21320
21402
  // ../jsx/src/ir-to-client-js/rewrite-props-object.ts
21321
- import ts15 from "typescript";
21403
+ import ts16 from "typescript";
21322
21404
  function rewritePropsObjectRef(code, propsObjectName) {
21323
21405
  const srcPropsName = propsObjectName ?? "props";
21324
21406
  if (srcPropsName === PROPS_PARAM) return code;
21325
21407
  if (!new RegExp(`\\b${srcPropsName}\\b`).test(code)) return code;
21326
- const sourceFile = ts15.createSourceFile(
21408
+ const sourceFile = ts16.createSourceFile(
21327
21409
  "init-body.ts",
21328
21410
  code,
21329
- ts15.ScriptTarget.Latest,
21411
+ ts16.ScriptTarget.Latest,
21330
21412
  /*setParentNodes*/
21331
21413
  true,
21332
- ts15.ScriptKind.TS
21414
+ ts16.ScriptKind.TS
21333
21415
  );
21334
21416
  const spans = [];
21335
21417
  function visit3(node) {
21336
- if (ts15.isIdentifier(node) && node.text === srcPropsName && shouldRewrite(node)) {
21418
+ if (ts16.isIdentifier(node) && node.text === srcPropsName && shouldRewrite(node)) {
21337
21419
  spans.push([node.getStart(sourceFile), node.getEnd()]);
21338
21420
  }
21339
- ts15.forEachChild(node, visit3);
21421
+ ts16.forEachChild(node, visit3);
21340
21422
  }
21341
21423
  visit3(sourceFile);
21342
21424
  if (spans.length === 0) return code;
@@ -21350,12 +21432,12 @@ function rewritePropsObjectRef(code, propsObjectName) {
21350
21432
  function shouldRewrite(node) {
21351
21433
  const parent2 = node.parent;
21352
21434
  if (!parent2) return true;
21353
- if (ts15.isPropertyAccessExpression(parent2) && parent2.name === node) return false;
21354
- if (ts15.isPropertyAssignment(parent2) && parent2.name === node) return false;
21355
- if (ts15.isShorthandPropertyAssignment(parent2) && parent2.name === node) return false;
21356
- if (ts15.isPropertySignature(parent2) && parent2.name === node) return false;
21357
- if (ts15.isPropertyDeclaration(parent2) && parent2.name === node) return false;
21358
- if (ts15.isBindingElement(parent2) && parent2.name === node) return false;
21435
+ if (ts16.isPropertyAccessExpression(parent2) && parent2.name === node) return false;
21436
+ if (ts16.isPropertyAssignment(parent2) && parent2.name === node) return false;
21437
+ if (ts16.isShorthandPropertyAssignment(parent2) && parent2.name === node) return false;
21438
+ if (ts16.isPropertySignature(parent2) && parent2.name === node) return false;
21439
+ if (ts16.isPropertyDeclaration(parent2) && parent2.name === node) return false;
21440
+ if (ts16.isBindingElement(parent2) && parent2.name === node) return false;
21359
21441
  return true;
21360
21442
  }
21361
21443
  var init_rewrite_props_object = __esm({
@@ -22039,7 +22121,7 @@ var init_css_layer_prefixer = __esm({
22039
22121
  });
22040
22122
 
22041
22123
  // ../jsx/src/preprocess-inline-jsx-callbacks.ts
22042
- import ts16 from "typescript";
22124
+ import ts17 from "typescript";
22043
22125
  function preprocessInlineJsxCallbacks(source, filePath) {
22044
22126
  const errors = [];
22045
22127
  const syntheticNames = [];
@@ -22059,15 +22141,15 @@ function preprocessInlineJsxCallbacks(source, filePath) {
22059
22141
  return { source: current, errors, syntheticNames };
22060
22142
  }
22061
22143
  function runSinglePass(source, filePath, startingCounter) {
22062
- const sourceFile = ts16.createSourceFile(
22144
+ const sourceFile = ts17.createSourceFile(
22063
22145
  filePath,
22064
22146
  source,
22065
- ts16.ScriptTarget.Latest,
22147
+ ts17.ScriptTarget.Latest,
22066
22148
  true,
22067
- ts16.ScriptKind.TSX
22149
+ ts17.ScriptKind.TSX
22068
22150
  );
22069
22151
  const hasUseClient = sourceFile.statements.some(
22070
- (stmt) => ts16.isExpressionStatement(stmt) && ts16.isStringLiteral(stmt.expression) && (stmt.expression.text === "use client" || stmt.expression.text === "'use client'")
22152
+ (stmt) => ts17.isExpressionStatement(stmt) && ts17.isStringLiteral(stmt.expression) && (stmt.expression.text === "use client" || stmt.expression.text === "'use client'")
22071
22153
  );
22072
22154
  if (!hasUseClient) {
22073
22155
  return { source, errors: [], syntheticNames: [], counterAfter: startingCounter };
@@ -22090,20 +22172,20 @@ function runSinglePass(source, filePath, startingCounter) {
22090
22172
  }
22091
22173
  }
22092
22174
  function visit3(node) {
22093
- if (ts16.isJsxAttribute(node) && node.initializer && ts16.isJsxExpression(node.initializer) && node.initializer.expression) {
22175
+ if (ts17.isJsxAttribute(node) && node.initializer && ts17.isJsxExpression(node.initializer) && node.initializer.expression) {
22094
22176
  if (tryHandleArrowValue(node.initializer.expression)) {
22095
22177
  return;
22096
22178
  }
22097
22179
  }
22098
- if (ts16.isPropertyAssignment(node) && node.initializer) {
22180
+ if (ts17.isPropertyAssignment(node) && node.initializer) {
22099
22181
  if (tryHandleArrowValue(node.initializer)) return;
22100
22182
  }
22101
- ts16.forEachChild(node, visit3);
22183
+ ts17.forEachChild(node, visit3);
22102
22184
  }
22103
22185
  function tryHandleArrowValue(initializer) {
22104
22186
  let expr = initializer;
22105
- while (ts16.isParenthesizedExpression(expr)) expr = expr.expression;
22106
- if (ts16.isArrowFunction(expr) && arrowBodyContainsJsx(expr)) {
22187
+ while (ts17.isParenthesizedExpression(expr)) expr = expr.expression;
22188
+ if (ts17.isArrowFunction(expr) && arrowBodyContainsJsx(expr)) {
22107
22189
  return handleInlineArrow(expr);
22108
22190
  }
22109
22191
  return false;
@@ -22138,7 +22220,7 @@ function runSinglePass(source, filePath, startingCounter) {
22138
22220
  replacements.push({ start: arrowStart, end: arrowEnd, text: name2 });
22139
22221
  return true;
22140
22222
  }
22141
- ts16.forEachChild(sourceFile, visit3);
22223
+ ts17.forEachChild(sourceFile, visit3);
22142
22224
  if (replacements.length === 0) {
22143
22225
  return { source, errors, syntheticNames, counterAfter: counter };
22144
22226
  }
@@ -22157,33 +22239,33 @@ function errorMessageForCapture(captures) {
22157
22239
  return `Inline JSX-returning arrow function captures non-module identifier(s): ${captures.sort().join(", ")}. Extract the callback into a top-level '\\'use client\\'' component (e.g. \`function MyNode(n) { return <div/> }\` then \`renderNode={MyNode}\`) or pass captured values via component props.`;
22158
22240
  }
22159
22241
  function arrowBodyContainsJsx(arrow) {
22160
- if (ts16.isBlock(arrow.body)) {
22242
+ if (ts17.isBlock(arrow.body)) {
22161
22243
  return blockReturnsJsx(arrow.body);
22162
22244
  }
22163
22245
  let body2 = arrow.body;
22164
- while (ts16.isParenthesizedExpression(body2)) body2 = body2.expression;
22246
+ while (ts17.isParenthesizedExpression(body2)) body2 = body2.expression;
22165
22247
  return isJsxLike(body2);
22166
22248
  }
22167
22249
  function blockReturnsJsx(block) {
22168
22250
  let found = false;
22169
22251
  function visit3(n) {
22170
22252
  if (found) return;
22171
- if (ts16.isReturnStatement(n) && n.expression) {
22253
+ if (ts17.isReturnStatement(n) && n.expression) {
22172
22254
  let e = n.expression;
22173
- while (ts16.isParenthesizedExpression(e)) e = e.expression;
22255
+ while (ts17.isParenthesizedExpression(e)) e = e.expression;
22174
22256
  if (isJsxLike(e)) {
22175
22257
  found = true;
22176
22258
  return;
22177
22259
  }
22178
22260
  }
22179
- if (ts16.isArrowFunction(n) || ts16.isFunctionDeclaration(n) || ts16.isFunctionExpression(n)) return;
22180
- ts16.forEachChild(n, visit3);
22261
+ if (ts17.isArrowFunction(n) || ts17.isFunctionDeclaration(n) || ts17.isFunctionExpression(n)) return;
22262
+ ts17.forEachChild(n, visit3);
22181
22263
  }
22182
- ts16.forEachChild(block, visit3);
22264
+ ts17.forEachChild(block, visit3);
22183
22265
  return found;
22184
22266
  }
22185
22267
  function isJsxLike(expr) {
22186
- return ts16.isJsxElement(expr) || ts16.isJsxSelfClosingElement(expr) || ts16.isJsxFragment(expr);
22268
+ return ts17.isJsxElement(expr) || ts17.isJsxSelfClosingElement(expr) || ts17.isJsxFragment(expr);
22187
22269
  }
22188
22270
  function collectArrowParamNames(arrow) {
22189
22271
  const names = /* @__PURE__ */ new Set();
@@ -22192,13 +22274,13 @@ function collectArrowParamNames(arrow) {
22192
22274
  }
22193
22275
  function collectBindingNames2(name2, out) {
22194
22276
  const push = Array.isArray(out) ? (n) => out.push(n) : (n) => out.add(n);
22195
- if (ts16.isIdentifier(name2)) {
22277
+ if (ts17.isIdentifier(name2)) {
22196
22278
  push(name2.text);
22197
- } else if (ts16.isObjectBindingPattern(name2)) {
22279
+ } else if (ts17.isObjectBindingPattern(name2)) {
22198
22280
  name2.elements.forEach((el) => collectBindingNames2(el.name, out));
22199
- } else if (ts16.isArrayBindingPattern(name2)) {
22281
+ } else if (ts17.isArrayBindingPattern(name2)) {
22200
22282
  name2.elements.forEach((el) => {
22201
- if (!ts16.isOmittedExpression(el)) collectBindingNames2(el.name, out);
22283
+ if (!ts17.isOmittedExpression(el)) collectBindingNames2(el.name, out);
22202
22284
  });
22203
22285
  }
22204
22286
  }
@@ -22223,71 +22305,71 @@ function collectFreeIdentifiers(arrow) {
22223
22305
  return bound.includes(name2);
22224
22306
  }
22225
22307
  function visit3(node) {
22226
- if (ts16.isIdentifier(node)) {
22308
+ if (ts17.isIdentifier(node)) {
22227
22309
  const parent2 = node.parent;
22228
- if (parent2 && ts16.isPropertyAccessExpression(parent2) && parent2.name === node) return;
22229
- if (parent2 && ts16.isPropertyAssignment(parent2) && parent2.name === node) return;
22230
- if (parent2 && ts16.isPropertySignature(parent2) && parent2.name === node) return;
22231
- if (parent2 && ts16.isPropertyDeclaration(parent2) && parent2.name === node) return;
22232
- if (parent2 && ts16.isMethodDeclaration(parent2) && parent2.name === node) return;
22233
- if (parent2 && ts16.isMethodSignature(parent2) && parent2.name === node) return;
22234
- if (parent2 && ts16.isGetAccessorDeclaration(parent2) && parent2.name === node) return;
22235
- if (parent2 && ts16.isSetAccessorDeclaration(parent2) && parent2.name === node) return;
22236
- if (parent2 && ts16.isEnumMember(parent2) && parent2.name === node) return;
22237
- if (parent2 && ts16.isBindingElement(parent2) && parent2.propertyName === node) return;
22238
- if (parent2 && ts16.isShorthandPropertyAssignment(parent2) && parent2.name === node) {
22310
+ if (parent2 && ts17.isPropertyAccessExpression(parent2) && parent2.name === node) return;
22311
+ if (parent2 && ts17.isPropertyAssignment(parent2) && parent2.name === node) return;
22312
+ if (parent2 && ts17.isPropertySignature(parent2) && parent2.name === node) return;
22313
+ if (parent2 && ts17.isPropertyDeclaration(parent2) && parent2.name === node) return;
22314
+ if (parent2 && ts17.isMethodDeclaration(parent2) && parent2.name === node) return;
22315
+ if (parent2 && ts17.isMethodSignature(parent2) && parent2.name === node) return;
22316
+ if (parent2 && ts17.isGetAccessorDeclaration(parent2) && parent2.name === node) return;
22317
+ if (parent2 && ts17.isSetAccessorDeclaration(parent2) && parent2.name === node) return;
22318
+ if (parent2 && ts17.isEnumMember(parent2) && parent2.name === node) return;
22319
+ if (parent2 && ts17.isBindingElement(parent2) && parent2.propertyName === node) return;
22320
+ if (parent2 && ts17.isShorthandPropertyAssignment(parent2) && parent2.name === node) {
22239
22321
  if (!isBound(node.text)) ids.add(node.text);
22240
22322
  return;
22241
22323
  }
22242
- if (parent2 && ts16.isParameter(parent2) && parent2.name === node) return;
22243
- if (parent2 && ts16.isVariableDeclaration(parent2) && parent2.name === node) return;
22244
- if (parent2 && ts16.isFunctionDeclaration(parent2) && parent2.name === node) return;
22245
- if (parent2 && ts16.isClassDeclaration(parent2) && parent2.name === node) return;
22246
- if (parent2 && ts16.isJsxAttribute(parent2) && parent2.name === node) return;
22247
- if (parent2 && ts16.isJsxOpeningElement(parent2) && parent2.tagName === node) {
22324
+ if (parent2 && ts17.isParameter(parent2) && parent2.name === node) return;
22325
+ if (parent2 && ts17.isVariableDeclaration(parent2) && parent2.name === node) return;
22326
+ if (parent2 && ts17.isFunctionDeclaration(parent2) && parent2.name === node) return;
22327
+ if (parent2 && ts17.isClassDeclaration(parent2) && parent2.name === node) return;
22328
+ if (parent2 && ts17.isJsxAttribute(parent2) && parent2.name === node) return;
22329
+ if (parent2 && ts17.isJsxOpeningElement(parent2) && parent2.tagName === node) {
22248
22330
  if (/^[a-z]/.test(node.text)) return;
22249
22331
  }
22250
- if (parent2 && ts16.isJsxClosingElement(parent2) && parent2.tagName === node) {
22332
+ if (parent2 && ts17.isJsxClosingElement(parent2) && parent2.tagName === node) {
22251
22333
  if (/^[a-z]/.test(node.text)) return;
22252
22334
  }
22253
22335
  if (isBound(node.text)) return;
22254
22336
  ids.add(node.text);
22255
22337
  return;
22256
22338
  }
22257
- if (ts16.isVariableDeclaration(node)) {
22339
+ if (ts17.isVariableDeclaration(node)) {
22258
22340
  const declared = pushBindings(node.name);
22259
22341
  if (node.initializer) visit3(node.initializer);
22260
22342
  declared;
22261
22343
  return;
22262
22344
  }
22263
- if (ts16.isFunctionDeclaration(node)) {
22345
+ if (ts17.isFunctionDeclaration(node)) {
22264
22346
  if (node.name) bound.push(node.name.text);
22265
22347
  visitInsideNewScope(node);
22266
22348
  return;
22267
22349
  }
22268
- if (ts16.isClassDeclaration(node)) {
22350
+ if (ts17.isClassDeclaration(node)) {
22269
22351
  if (node.name) bound.push(node.name.text);
22270
- ts16.forEachChild(node, visit3);
22352
+ ts17.forEachChild(node, visit3);
22271
22353
  return;
22272
22354
  }
22273
- if (ts16.isArrowFunction(node) || ts16.isFunctionExpression(node)) {
22355
+ if (ts17.isArrowFunction(node) || ts17.isFunctionExpression(node)) {
22274
22356
  visitInsideNewScope(node);
22275
22357
  return;
22276
22358
  }
22277
- if (ts16.isCatchClause(node)) {
22359
+ if (ts17.isCatchClause(node)) {
22278
22360
  const before = bound.length;
22279
22361
  if (node.variableDeclaration) pushBindings(node.variableDeclaration.name);
22280
- ts16.forEachChild(node, visit3);
22362
+ ts17.forEachChild(node, visit3);
22281
22363
  popN(bound.length - before);
22282
22364
  return;
22283
22365
  }
22284
- if (ts16.isBlock(node)) {
22366
+ if (ts17.isBlock(node)) {
22285
22367
  const before = bound.length;
22286
- ts16.forEachChild(node, visit3);
22368
+ ts17.forEachChild(node, visit3);
22287
22369
  popN(bound.length - before);
22288
22370
  return;
22289
22371
  }
22290
- ts16.forEachChild(node, visit3);
22372
+ ts17.forEachChild(node, visit3);
22291
22373
  }
22292
22374
  function visitInsideNewScope(fn) {
22293
22375
  const before = bound.length;
@@ -22307,27 +22389,27 @@ function collectFreeIdentifiers(arrow) {
22307
22389
  function collectModuleScopeNames(sourceFile) {
22308
22390
  const names = /* @__PURE__ */ new Set();
22309
22391
  for (const stmt of sourceFile.statements) {
22310
- if (ts16.isFunctionDeclaration(stmt) && stmt.name) names.add(stmt.name.text);
22311
- else if (ts16.isClassDeclaration(stmt) && stmt.name) names.add(stmt.name.text);
22312
- else if (ts16.isVariableStatement(stmt)) {
22392
+ if (ts17.isFunctionDeclaration(stmt) && stmt.name) names.add(stmt.name.text);
22393
+ else if (ts17.isClassDeclaration(stmt) && stmt.name) names.add(stmt.name.text);
22394
+ else if (ts17.isVariableStatement(stmt)) {
22313
22395
  for (const decl of stmt.declarationList.declarations) collectBindingNames2(decl.name, names);
22314
- } else if (ts16.isImportDeclaration(stmt) && stmt.importClause) {
22396
+ } else if (ts17.isImportDeclaration(stmt) && stmt.importClause) {
22315
22397
  const ic = stmt.importClause;
22316
22398
  if (ic.name) names.add(ic.name.text);
22317
22399
  if (ic.namedBindings) {
22318
- if (ts16.isNamespaceImport(ic.namedBindings)) names.add(ic.namedBindings.name.text);
22400
+ if (ts17.isNamespaceImport(ic.namedBindings)) names.add(ic.namedBindings.name.text);
22319
22401
  else for (const e of ic.namedBindings.elements) names.add(e.name.text);
22320
22402
  }
22321
- } else if (ts16.isTypeAliasDeclaration(stmt)) names.add(stmt.name.text);
22322
- else if (ts16.isInterfaceDeclaration(stmt)) names.add(stmt.name.text);
22323
- else if (ts16.isEnumDeclaration(stmt)) names.add(stmt.name.text);
22403
+ } else if (ts17.isTypeAliasDeclaration(stmt)) names.add(stmt.name.text);
22404
+ else if (ts17.isInterfaceDeclaration(stmt)) names.add(stmt.name.text);
22405
+ else if (ts17.isEnumDeclaration(stmt)) names.add(stmt.name.text);
22324
22406
  }
22325
22407
  return names;
22326
22408
  }
22327
22409
  function buildSyntheticDeclaration(name2, arrow, sourceFile) {
22328
22410
  const paramsText = arrow.parameters.length === 0 ? "" : arrow.parameters.map((p) => p.getText(sourceFile)).join(", ");
22329
22411
  let bodyText;
22330
- if (ts16.isBlock(arrow.body)) {
22412
+ if (ts17.isBlock(arrow.body)) {
22331
22413
  bodyText = arrow.body.getText(sourceFile);
22332
22414
  } else {
22333
22415
  const expr = arrow.body.getText(sourceFile);
@@ -22346,7 +22428,7 @@ var init_preprocess_inline_jsx_callbacks = __esm({
22346
22428
  });
22347
22429
 
22348
22430
  // ../jsx/src/ssr-defaults.ts
22349
- import ts17 from "typescript";
22431
+ import ts18 from "typescript";
22350
22432
  function extractSsrDefaults(metadata) {
22351
22433
  const out = {};
22352
22434
  const propsLike = /* @__PURE__ */ new Set();
@@ -22406,11 +22488,11 @@ function collectPropRefs(expr, propsObjectName, out) {
22406
22488
  const node = parseExpression2(expr);
22407
22489
  if (!node) return;
22408
22490
  const visit3 = (n) => {
22409
- if (ts17.isPropertyAccessExpression(n) && ts17.isIdentifier(n.expression) && n.expression.text === propsObjectName && ts17.isIdentifier(n.name)) {
22491
+ if (ts18.isPropertyAccessExpression(n) && ts18.isIdentifier(n.expression) && n.expression.text === propsObjectName && ts18.isIdentifier(n.name)) {
22410
22492
  out.add(n.name.text);
22411
22493
  return;
22412
22494
  }
22413
- ts17.forEachChild(n, visit3);
22495
+ ts18.forEachChild(n, visit3);
22414
22496
  };
22415
22497
  visit3(node);
22416
22498
  }
@@ -22427,21 +22509,21 @@ function tryStaticEval(expr, ctx2) {
22427
22509
  }
22428
22510
  function evalStatementsForReturn(statements, ctx2) {
22429
22511
  for (const stmt of statements) {
22430
- if (ts17.isVariableStatement(stmt)) {
22512
+ if (ts18.isVariableStatement(stmt)) {
22431
22513
  for (const d of stmt.declarationList.declarations) {
22432
- if (!ts17.isIdentifier(d.name) || !d.initializer) continue;
22514
+ if (!ts18.isIdentifier(d.name) || !d.initializer) continue;
22433
22515
  const v = evalNode(d.initializer, ctx2);
22434
22516
  if (v !== UNRESOLVED) ctx2.bindings[d.name.text] = v;
22435
22517
  }
22436
- } else if (ts17.isReturnStatement(stmt)) {
22518
+ } else if (ts18.isReturnStatement(stmt)) {
22437
22519
  return stmt.expression ? evalNode(stmt.expression, ctx2) : UNRESOLVED;
22438
- } else if (ts17.isIfStatement(stmt)) {
22520
+ } else if (ts18.isIfStatement(stmt)) {
22439
22521
  const cond = evalNode(stmt.expression, ctx2);
22440
22522
  if (cond === UNRESOLVED) return UNRESOLVED;
22441
22523
  const branch = cond ? stmt.thenStatement : stmt.elseStatement;
22442
22524
  if (branch) {
22443
22525
  const taken = evalStatementsForReturn(
22444
- ts17.isBlock(branch) ? branch.statements : [branch],
22526
+ ts18.isBlock(branch) ? branch.statements : [branch],
22445
22527
  ctx2
22446
22528
  );
22447
22529
  if (taken !== NO_RETURN) return taken;
@@ -22453,64 +22535,64 @@ function evalStatementsForReturn(statements, ctx2) {
22453
22535
  return NO_RETURN;
22454
22536
  }
22455
22537
  function parseExpression2(expr) {
22456
- const sf = ts17.createSourceFile(
22538
+ const sf = ts18.createSourceFile(
22457
22539
  "__ssr_default__.ts",
22458
22540
  `(${expr})`,
22459
- ts17.ScriptTarget.Latest,
22541
+ ts18.ScriptTarget.Latest,
22460
22542
  false,
22461
- ts17.ScriptKind.TS
22543
+ ts18.ScriptKind.TS
22462
22544
  );
22463
22545
  const stmt = sf.statements[0];
22464
- if (!stmt || !ts17.isExpressionStatement(stmt)) return null;
22465
- const inner = ts17.isParenthesizedExpression(stmt.expression) ? stmt.expression.expression : stmt.expression;
22546
+ if (!stmt || !ts18.isExpressionStatement(stmt)) return null;
22547
+ const inner = ts18.isParenthesizedExpression(stmt.expression) ? stmt.expression.expression : stmt.expression;
22466
22548
  return inner;
22467
22549
  }
22468
22550
  function evalNode(node, ctx2) {
22469
- if (ts17.isParenthesizedExpression(node)) return evalNode(node.expression, ctx2);
22470
- if (ts17.isAsExpression(node)) return evalNode(node.expression, ctx2);
22471
- if (ts17.isSatisfiesExpression(node)) return evalNode(node.expression, ctx2);
22472
- if (ts17.isTypeAssertionExpression(node)) return evalNode(node.expression, ctx2);
22473
- if (ts17.isNonNullExpression(node)) return evalNode(node.expression, ctx2);
22474
- if (ts17.isArrowFunction(node)) {
22551
+ if (ts18.isParenthesizedExpression(node)) return evalNode(node.expression, ctx2);
22552
+ if (ts18.isAsExpression(node)) return evalNode(node.expression, ctx2);
22553
+ if (ts18.isSatisfiesExpression(node)) return evalNode(node.expression, ctx2);
22554
+ if (ts18.isTypeAssertionExpression(node)) return evalNode(node.expression, ctx2);
22555
+ if (ts18.isNonNullExpression(node)) return evalNode(node.expression, ctx2);
22556
+ if (ts18.isArrowFunction(node)) {
22475
22557
  if (node.parameters.length !== 0) return UNRESOLVED;
22476
- if (!ts17.isBlock(node.body)) return evalNode(node.body, ctx2);
22558
+ if (!ts18.isBlock(node.body)) return evalNode(node.body, ctx2);
22477
22559
  const localBindings = { ...ctx2.bindings };
22478
22560
  const localCtx = { ...ctx2, bindings: localBindings };
22479
22561
  const result2 = evalStatementsForReturn(node.body.statements, localCtx);
22480
22562
  return result2 === NO_RETURN ? UNRESOLVED : result2;
22481
22563
  }
22482
- if (ts17.isNumericLiteral(node)) return Number(node.text);
22483
- if (ts17.isStringLiteralLike(node)) return node.text;
22484
- if (node.kind === ts17.SyntaxKind.TrueKeyword) return true;
22485
- if (node.kind === ts17.SyntaxKind.FalseKeyword) return false;
22486
- if (node.kind === ts17.SyntaxKind.NullKeyword) return null;
22487
- if (ts17.isIdentifier(node)) {
22564
+ if (ts18.isNumericLiteral(node)) return Number(node.text);
22565
+ if (ts18.isStringLiteralLike(node)) return node.text;
22566
+ if (node.kind === ts18.SyntaxKind.TrueKeyword) return true;
22567
+ if (node.kind === ts18.SyntaxKind.FalseKeyword) return false;
22568
+ if (node.kind === ts18.SyntaxKind.NullKeyword) return null;
22569
+ if (ts18.isIdentifier(node)) {
22488
22570
  if (node.text === "undefined") return void 0;
22489
22571
  if (node.text in ctx2.bindings) return ctx2.bindings[node.text];
22490
22572
  if (ctx2.propsLike.has(node.text)) return void 0;
22491
22573
  return UNRESOLVED;
22492
22574
  }
22493
- if (ts17.isPrefixUnaryExpression(node)) {
22575
+ if (ts18.isPrefixUnaryExpression(node)) {
22494
22576
  const arg = evalNode(node.operand, ctx2);
22495
22577
  if (arg === UNRESOLVED) return UNRESOLVED;
22496
22578
  switch (node.operator) {
22497
- case ts17.SyntaxKind.MinusToken:
22579
+ case ts18.SyntaxKind.MinusToken:
22498
22580
  return typeof arg === "number" ? -arg : UNRESOLVED;
22499
- case ts17.SyntaxKind.PlusToken:
22581
+ case ts18.SyntaxKind.PlusToken:
22500
22582
  return typeof arg === "number" ? +arg : UNRESOLVED;
22501
- case ts17.SyntaxKind.ExclamationToken:
22583
+ case ts18.SyntaxKind.ExclamationToken:
22502
22584
  return !arg;
22503
22585
  }
22504
22586
  return UNRESOLVED;
22505
22587
  }
22506
- if (ts17.isObjectLiteralExpression(node)) {
22588
+ if (ts18.isObjectLiteralExpression(node)) {
22507
22589
  const obj = {};
22508
22590
  for (const prop of node.properties) {
22509
- if (!ts17.isPropertyAssignment(prop)) return UNRESOLVED;
22591
+ if (!ts18.isPropertyAssignment(prop)) return UNRESOLVED;
22510
22592
  let key;
22511
- if (ts17.isIdentifier(prop.name) || ts17.isStringLiteralLike(prop.name)) {
22593
+ if (ts18.isIdentifier(prop.name) || ts18.isStringLiteralLike(prop.name)) {
22512
22594
  key = prop.name.text;
22513
- } else if (ts17.isNumericLiteral(prop.name)) {
22595
+ } else if (ts18.isNumericLiteral(prop.name)) {
22514
22596
  key = prop.name.text;
22515
22597
  } else {
22516
22598
  return UNRESOLVED;
@@ -22521,17 +22603,17 @@ function evalNode(node, ctx2) {
22521
22603
  }
22522
22604
  return obj;
22523
22605
  }
22524
- if (ts17.isArrayLiteralExpression(node)) {
22606
+ if (ts18.isArrayLiteralExpression(node)) {
22525
22607
  const arr = [];
22526
22608
  for (const elem of node.elements) {
22527
- if (ts17.isOmittedExpression(elem)) return UNRESOLVED;
22609
+ if (ts18.isOmittedExpression(elem)) return UNRESOLVED;
22528
22610
  const v = evalNode(elem, ctx2);
22529
22611
  if (v === UNRESOLVED) return UNRESOLVED;
22530
22612
  arr.push(v === void 0 ? null : v);
22531
22613
  }
22532
22614
  return arr;
22533
22615
  }
22534
- if (ts17.isElementAccessExpression(node)) {
22616
+ if (ts18.isElementAccessExpression(node)) {
22535
22617
  const base = evalNode(node.expression, ctx2);
22536
22618
  if (base === void 0) return void 0;
22537
22619
  if (base === UNRESOLVED || base === null || typeof base !== "object") return UNRESOLVED;
@@ -22541,16 +22623,16 @@ function evalNode(node, ctx2) {
22541
22623
  const k = String(key);
22542
22624
  return Object.prototype.hasOwnProperty.call(base, k) ? base[k] : void 0;
22543
22625
  }
22544
- if (ts17.isPropertyAccessExpression(node)) {
22626
+ if (ts18.isPropertyAccessExpression(node)) {
22545
22627
  const baseResult = evalNode(node.expression, ctx2);
22546
22628
  if (baseResult === void 0) return void 0;
22547
22629
  return UNRESOLVED;
22548
22630
  }
22549
- if (ts17.isCallExpression(node)) {
22550
- if (node.arguments.length === 0 && ts17.isIdentifier(node.expression) && node.expression.text in ctx2.bindings) {
22631
+ if (ts18.isCallExpression(node)) {
22632
+ if (node.arguments.length === 0 && ts18.isIdentifier(node.expression) && node.expression.text in ctx2.bindings) {
22551
22633
  return ctx2.bindings[node.expression.text];
22552
22634
  }
22553
- if (ts17.isPropertyAccessExpression(node.expression) && node.expression.name.text === "join") {
22635
+ if (ts18.isPropertyAccessExpression(node.expression) && node.expression.name.text === "join") {
22554
22636
  const recv = evalNode(node.expression.expression, ctx2);
22555
22637
  if (Array.isArray(recv)) {
22556
22638
  let sep = ",";
@@ -22565,24 +22647,24 @@ function evalNode(node, ctx2) {
22565
22647
  }
22566
22648
  return UNRESOLVED;
22567
22649
  }
22568
- if (ts17.isConditionalExpression(node)) {
22650
+ if (ts18.isConditionalExpression(node)) {
22569
22651
  const cond = evalNode(node.condition, ctx2);
22570
22652
  if (cond === UNRESOLVED) return UNRESOLVED;
22571
22653
  return cond ? evalNode(node.whenTrue, ctx2) : evalNode(node.whenFalse, ctx2);
22572
22654
  }
22573
- if (ts17.isBinaryExpression(node)) {
22655
+ if (ts18.isBinaryExpression(node)) {
22574
22656
  const op = node.operatorToken.kind;
22575
- if (op === ts17.SyntaxKind.QuestionQuestionToken) {
22657
+ if (op === ts18.SyntaxKind.QuestionQuestionToken) {
22576
22658
  const l2 = evalNode(node.left, ctx2);
22577
22659
  if (l2 !== UNRESOLVED && l2 !== null && l2 !== void 0) return l2;
22578
22660
  return evalNode(node.right, ctx2);
22579
22661
  }
22580
- if (op === ts17.SyntaxKind.BarBarToken) {
22662
+ if (op === ts18.SyntaxKind.BarBarToken) {
22581
22663
  const l2 = evalNode(node.left, ctx2);
22582
22664
  if (l2 !== UNRESOLVED && l2) return l2;
22583
22665
  return evalNode(node.right, ctx2);
22584
22666
  }
22585
- if (op === ts17.SyntaxKind.AmpersandAmpersandToken) {
22667
+ if (op === ts18.SyntaxKind.AmpersandAmpersandToken) {
22586
22668
  const l2 = evalNode(node.left, ctx2);
22587
22669
  if (l2 === UNRESOLVED) return UNRESOLVED;
22588
22670
  if (!l2) return l2;
@@ -22592,28 +22674,28 @@ function evalNode(node, ctx2) {
22592
22674
  const r2 = evalNode(node.right, ctx2);
22593
22675
  if (l === UNRESOLVED || r2 === UNRESOLVED) return UNRESOLVED;
22594
22676
  switch (op) {
22595
- case ts17.SyntaxKind.PlusToken:
22677
+ case ts18.SyntaxKind.PlusToken:
22596
22678
  if (typeof l === "string" || typeof r2 === "string") return `${l}${r2}`;
22597
22679
  if (typeof l === "number" && typeof r2 === "number") return l + r2;
22598
22680
  return UNRESOLVED;
22599
- case ts17.SyntaxKind.MinusToken:
22681
+ case ts18.SyntaxKind.MinusToken:
22600
22682
  return typeof l === "number" && typeof r2 === "number" ? l - r2 : UNRESOLVED;
22601
- case ts17.SyntaxKind.AsteriskToken:
22683
+ case ts18.SyntaxKind.AsteriskToken:
22602
22684
  return typeof l === "number" && typeof r2 === "number" ? l * r2 : UNRESOLVED;
22603
- case ts17.SyntaxKind.SlashToken:
22685
+ case ts18.SyntaxKind.SlashToken:
22604
22686
  return typeof l === "number" && typeof r2 === "number" && r2 !== 0 ? l / r2 : UNRESOLVED;
22605
- case ts17.SyntaxKind.PercentToken:
22687
+ case ts18.SyntaxKind.PercentToken:
22606
22688
  return typeof l === "number" && typeof r2 === "number" && r2 !== 0 ? l % r2 : UNRESOLVED;
22607
- case ts17.SyntaxKind.EqualsEqualsEqualsToken:
22608
- case ts17.SyntaxKind.EqualsEqualsToken:
22689
+ case ts18.SyntaxKind.EqualsEqualsEqualsToken:
22690
+ case ts18.SyntaxKind.EqualsEqualsToken:
22609
22691
  return l === r2;
22610
- case ts17.SyntaxKind.ExclamationEqualsEqualsToken:
22611
- case ts17.SyntaxKind.ExclamationEqualsToken:
22692
+ case ts18.SyntaxKind.ExclamationEqualsEqualsToken:
22693
+ case ts18.SyntaxKind.ExclamationEqualsToken:
22612
22694
  return l !== r2;
22613
22695
  }
22614
22696
  return UNRESOLVED;
22615
22697
  }
22616
- if (ts17.isTemplateExpression(node)) {
22698
+ if (ts18.isTemplateExpression(node)) {
22617
22699
  if (node.templateSpans.length === 0) return node.head.text;
22618
22700
  let acc = node.head.text;
22619
22701
  for (const span of node.templateSpans) {
@@ -22623,7 +22705,7 @@ function evalNode(node, ctx2) {
22623
22705
  }
22624
22706
  return acc;
22625
22707
  }
22626
- if (ts17.isNoSubstitutionTemplateLiteral(node)) return node.text;
22708
+ if (ts18.isNoSubstitutionTemplateLiteral(node)) return node.text;
22627
22709
  return UNRESOLVED;
22628
22710
  }
22629
22711
  var UNRESOLVED, NO_RETURN;
@@ -22636,7 +22718,7 @@ var init_ssr_defaults = __esm({
22636
22718
  });
22637
22719
 
22638
22720
  // ../jsx/src/augment-inherited-props.ts
22639
- import ts18 from "typescript";
22721
+ import ts19 from "typescript";
22640
22722
  function collectContextConsumers(metadata) {
22641
22723
  const constants = metadata.localConstants ?? [];
22642
22724
  const contextDefaults = /* @__PURE__ */ new Map();
@@ -22663,35 +22745,35 @@ function collectContextConsumers(metadata) {
22663
22745
  }
22664
22746
  function parseUseContextArg(source) {
22665
22747
  const expr = parseSingleExpression(source);
22666
- if (!expr || !ts18.isCallExpression(expr)) return null;
22667
- if (!ts18.isIdentifier(expr.expression) || expr.expression.text !== "useContext") return null;
22748
+ if (!expr || !ts19.isCallExpression(expr)) return null;
22749
+ if (!ts19.isIdentifier(expr.expression) || expr.expression.text !== "useContext") return null;
22668
22750
  if (expr.arguments.length !== 1) return null;
22669
22751
  const arg = expr.arguments[0];
22670
- return ts18.isIdentifier(arg) ? arg.text : null;
22752
+ return ts19.isIdentifier(arg) ? arg.text : null;
22671
22753
  }
22672
22754
  function parseCreateContextDefault(source) {
22673
22755
  const expr = parseSingleExpression(source);
22674
- if (!expr || !ts18.isCallExpression(expr)) return null;
22756
+ if (!expr || !ts19.isCallExpression(expr)) return null;
22675
22757
  if (expr.arguments.length === 0) return null;
22676
22758
  const arg = expr.arguments[0];
22677
- if (ts18.isStringLiteral(arg) || ts18.isNoSubstitutionTemplateLiteral(arg)) return arg.text;
22678
- if (ts18.isNumericLiteral(arg)) return Number(arg.text);
22679
- if (arg.kind === ts18.SyntaxKind.TrueKeyword) return true;
22680
- if (arg.kind === ts18.SyntaxKind.FalseKeyword) return false;
22759
+ if (ts19.isStringLiteral(arg) || ts19.isNoSubstitutionTemplateLiteral(arg)) return arg.text;
22760
+ if (ts19.isNumericLiteral(arg)) return Number(arg.text);
22761
+ if (arg.kind === ts19.SyntaxKind.TrueKeyword) return true;
22762
+ if (arg.kind === ts19.SyntaxKind.FalseKeyword) return false;
22681
22763
  return null;
22682
22764
  }
22683
22765
  function isObjectLiteralCreateContextDefault(source) {
22684
22766
  const expr = parseSingleExpression(source);
22685
- if (!expr || !ts18.isCallExpression(expr)) return false;
22767
+ if (!expr || !ts19.isCallExpression(expr)) return false;
22686
22768
  if (expr.arguments.length === 0) return false;
22687
- return ts18.isObjectLiteralExpression(expr.arguments[0]);
22769
+ return ts19.isObjectLiteralExpression(expr.arguments[0]);
22688
22770
  }
22689
22771
  function parseSingleExpression(source) {
22690
- const sf = ts18.createSourceFile("__ctx.ts", `(${source})`, ts18.ScriptTarget.Latest, false);
22772
+ const sf = ts19.createSourceFile("__ctx.ts", `(${source})`, ts19.ScriptTarget.Latest, false);
22691
22773
  const stmt = sf.statements[0];
22692
- if (!stmt || !ts18.isExpressionStatement(stmt)) return null;
22774
+ if (!stmt || !ts19.isExpressionStatement(stmt)) return null;
22693
22775
  let e = stmt.expression;
22694
- while (ts18.isParenthesizedExpression(e)) e = e.expression;
22776
+ while (ts19.isParenthesizedExpression(e)) e = e.expression;
22695
22777
  return e;
22696
22778
  }
22697
22779
  function augmentInheritedPropAccesses(ir) {
@@ -22712,21 +22794,21 @@ function augmentInheritedPropAccesses(ir) {
22712
22794
  const coalesceLiteralTypes = /* @__PURE__ */ new Map();
22713
22795
  const pinCoalesceLiterals = (s) => {
22714
22796
  if (!s || !s.includes(propsObj)) return;
22715
- const sf = ts18.createSourceFile("__aug.ts", `(${s})`, ts18.ScriptTarget.Latest, false);
22797
+ const sf = ts19.createSourceFile("__aug.ts", `(${s})`, ts19.ScriptTarget.Latest, false);
22716
22798
  const visit3 = (n) => {
22717
- if (ts18.isBinaryExpression(n) && (n.operatorToken.kind === ts18.SyntaxKind.QuestionQuestionToken || n.operatorToken.kind === ts18.SyntaxKind.BarBarToken)) {
22799
+ if (ts19.isBinaryExpression(n) && (n.operatorToken.kind === ts19.SyntaxKind.QuestionQuestionToken || n.operatorToken.kind === ts19.SyntaxKind.BarBarToken)) {
22718
22800
  let left = n.left;
22719
- while (ts18.isParenthesizedExpression(left)) left = left.expression;
22720
- if (ts18.isPropertyAccessExpression(left) && ts18.isIdentifier(left.expression) && left.expression.text === propsObj) {
22801
+ while (ts19.isParenthesizedExpression(left)) left = left.expression;
22802
+ if (ts19.isPropertyAccessExpression(left) && ts19.isIdentifier(left.expression) && left.expression.text === propsObj) {
22721
22803
  const name2 = left.name.text;
22722
22804
  let right = n.right;
22723
- while (ts18.isParenthesizedExpression(right)) right = right.expression;
22724
- if (ts18.isPrefixUnaryExpression(right)) right = right.operand;
22725
- const kind2 = ts18.isNumericLiteral(right) ? "number" : right.kind === ts18.SyntaxKind.TrueKeyword || right.kind === ts18.SyntaxKind.FalseKeyword ? "boolean" : ts18.isStringLiteralLike(right) ? "string" : null;
22805
+ while (ts19.isParenthesizedExpression(right)) right = right.expression;
22806
+ if (ts19.isPrefixUnaryExpression(right)) right = right.operand;
22807
+ const kind2 = ts19.isNumericLiteral(right) ? "number" : right.kind === ts19.SyntaxKind.TrueKeyword || right.kind === ts19.SyntaxKind.FalseKeyword ? "boolean" : ts19.isStringLiteralLike(right) ? "string" : null;
22726
22808
  if (kind2 && !coalesceLiteralTypes.has(name2)) coalesceLiteralTypes.set(name2, kind2);
22727
22809
  }
22728
22810
  }
22729
- ts18.forEachChild(n, visit3);
22811
+ ts19.forEachChild(n, visit3);
22730
22812
  };
22731
22813
  visit3(sf);
22732
22814
  };
@@ -22822,39 +22904,39 @@ function augmentInheritedPropAccesses(ir) {
22822
22904
  }
22823
22905
  }
22824
22906
  function parseStaticStringConst(source) {
22825
- const sf = ts18.createSourceFile(
22907
+ const sf = ts19.createSourceFile(
22826
22908
  "__const.ts",
22827
22909
  `const __x = (${source});`,
22828
- ts18.ScriptTarget.Latest,
22910
+ ts19.ScriptTarget.Latest,
22829
22911
  /*setParentNodes*/
22830
22912
  false
22831
22913
  );
22832
22914
  const stmt = sf.statements[0];
22833
- if (!stmt || !ts18.isVariableStatement(stmt)) return null;
22915
+ if (!stmt || !ts19.isVariableStatement(stmt)) return null;
22834
22916
  let init = stmt.declarationList.declarations[0]?.initializer;
22835
- while (init && ts18.isParenthesizedExpression(init)) init = init.expression;
22917
+ while (init && ts19.isParenthesizedExpression(init)) init = init.expression;
22836
22918
  if (!init) return null;
22837
- if (ts18.isStringLiteral(init) || ts18.isNoSubstitutionTemplateLiteral(init)) {
22919
+ if (ts19.isStringLiteral(init) || ts19.isNoSubstitutionTemplateLiteral(init)) {
22838
22920
  return init.text;
22839
22921
  }
22840
22922
  return evalStringArrayJoin(source);
22841
22923
  }
22842
22924
  function evalTemplateOfStringConsts(source, resolved) {
22843
- const sf = ts18.createSourceFile(
22925
+ const sf = ts19.createSourceFile(
22844
22926
  "__const.ts",
22845
22927
  `const __x = (${source});`,
22846
- ts18.ScriptTarget.Latest,
22928
+ ts19.ScriptTarget.Latest,
22847
22929
  /*setParentNodes*/
22848
22930
  false
22849
22931
  );
22850
22932
  const stmt = sf.statements[0];
22851
- if (!stmt || !ts18.isVariableStatement(stmt)) return null;
22933
+ if (!stmt || !ts19.isVariableStatement(stmt)) return null;
22852
22934
  let init = stmt.declarationList.declarations[0]?.initializer;
22853
- while (init && ts18.isParenthesizedExpression(init)) init = init.expression;
22854
- if (!init || !ts18.isTemplateExpression(init)) return null;
22935
+ while (init && ts19.isParenthesizedExpression(init)) init = init.expression;
22936
+ if (!init || !ts19.isTemplateExpression(init)) return null;
22855
22937
  let out = init.head.text;
22856
22938
  for (const span of init.templateSpans) {
22857
- if (!ts18.isIdentifier(span.expression)) return null;
22939
+ if (!ts19.isIdentifier(span.expression)) return null;
22858
22940
  const value2 = resolved.get(span.expression.text);
22859
22941
  if (value2 === void 0) return null;
22860
22942
  out += value2 + span.literal.text;
@@ -22883,28 +22965,28 @@ function collectModuleStringConsts(constants) {
22883
22965
  function lookupStaticRecordLiteral(objectName, key, constants) {
22884
22966
  const constInfo = (constants ?? []).find((c) => c.name === objectName && c.isModule);
22885
22967
  if (constInfo?.value === void 0) return null;
22886
- const sf = ts18.createSourceFile(
22968
+ const sf = ts19.createSourceFile(
22887
22969
  "__rec.ts",
22888
22970
  `(${constInfo.value})`,
22889
- ts18.ScriptTarget.Latest,
22971
+ ts19.ScriptTarget.Latest,
22890
22972
  /*setParentNodes*/
22891
22973
  true
22892
22974
  );
22893
22975
  if (sf.statements.length !== 1) return null;
22894
22976
  const stmt = sf.statements[0];
22895
- if (!ts18.isExpressionStatement(stmt)) return null;
22977
+ if (!ts19.isExpressionStatement(stmt)) return null;
22896
22978
  let parsed = stmt.expression;
22897
- while (ts18.isParenthesizedExpression(parsed)) parsed = parsed.expression;
22898
- if (!ts18.isObjectLiteralExpression(parsed)) return null;
22979
+ while (ts19.isParenthesizedExpression(parsed)) parsed = parsed.expression;
22980
+ if (!ts19.isObjectLiteralExpression(parsed)) return null;
22899
22981
  for (const prop of parsed.properties) {
22900
- if (!ts18.isPropertyAssignment(prop)) continue;
22982
+ if (!ts19.isPropertyAssignment(prop)) continue;
22901
22983
  const name2 = prop.name;
22902
- const propKey = ts18.isIdentifier(name2) || ts18.isStringLiteral(name2) || ts18.isNoSubstitutionTemplateLiteral(name2) ? name2.text : null;
22984
+ const propKey = ts19.isIdentifier(name2) || ts19.isStringLiteral(name2) || ts19.isNoSubstitutionTemplateLiteral(name2) ? name2.text : null;
22903
22985
  if (propKey !== key) continue;
22904
22986
  let v = prop.initializer;
22905
- while (ts18.isParenthesizedExpression(v)) v = v.expression;
22906
- if (ts18.isNumericLiteral(v)) return { kind: "number", text: v.text };
22907
- if (ts18.isStringLiteral(v) || ts18.isNoSubstitutionTemplateLiteral(v)) {
22987
+ while (ts19.isParenthesizedExpression(v)) v = v.expression;
22988
+ if (ts19.isNumericLiteral(v)) return { kind: "number", text: v.text };
22989
+ if (ts19.isStringLiteral(v) || ts19.isNoSubstitutionTemplateLiteral(v)) {
22908
22990
  return { kind: "string", text: v.text };
22909
22991
  }
22910
22992
  return null;
@@ -22912,27 +22994,27 @@ function lookupStaticRecordLiteral(objectName, key, constants) {
22912
22994
  return null;
22913
22995
  }
22914
22996
  function evalStringArrayJoin(source) {
22915
- const sf = ts18.createSourceFile(
22997
+ const sf = ts19.createSourceFile(
22916
22998
  "__join.ts",
22917
22999
  `const __x = (${source});`,
22918
- ts18.ScriptTarget.Latest,
23000
+ ts19.ScriptTarget.Latest,
22919
23001
  /*setParentNodes*/
22920
23002
  false
22921
23003
  );
22922
23004
  const stmt = sf.statements[0];
22923
- if (!stmt || !ts18.isVariableStatement(stmt)) return null;
23005
+ if (!stmt || !ts19.isVariableStatement(stmt)) return null;
22924
23006
  let node = stmt.declarationList.declarations[0]?.initializer;
22925
- while (node && ts18.isParenthesizedExpression(node)) node = node.expression;
22926
- if (!node || !ts18.isCallExpression(node)) return null;
23007
+ while (node && ts19.isParenthesizedExpression(node)) node = node.expression;
23008
+ if (!node || !ts19.isCallExpression(node)) return null;
22927
23009
  const callee = node.expression;
22928
- if (!ts18.isPropertyAccessExpression(callee)) return null;
23010
+ if (!ts19.isPropertyAccessExpression(callee)) return null;
22929
23011
  if (callee.name.text !== "join") return null;
22930
23012
  let recv = callee.expression;
22931
- while (ts18.isParenthesizedExpression(recv)) recv = recv.expression;
22932
- if (!ts18.isArrayLiteralExpression(recv)) return null;
23013
+ while (ts19.isParenthesizedExpression(recv)) recv = recv.expression;
23014
+ if (!ts19.isArrayLiteralExpression(recv)) return null;
22933
23015
  const parts = [];
22934
23016
  for (const el of recv.elements) {
22935
- if (ts18.isStringLiteral(el) || ts18.isNoSubstitutionTemplateLiteral(el)) {
23017
+ if (ts19.isStringLiteral(el) || ts19.isNoSubstitutionTemplateLiteral(el)) {
22936
23018
  parts.push(el.text);
22937
23019
  } else {
22938
23020
  return null;
@@ -22941,16 +23023,16 @@ function evalStringArrayJoin(source) {
22941
23023
  let sep = ",";
22942
23024
  if (node.arguments.length >= 1) {
22943
23025
  const arg = node.arguments[0];
22944
- if (ts18.isStringLiteral(arg) || ts18.isNoSubstitutionTemplateLiteral(arg)) sep = arg.text;
23026
+ if (ts19.isStringLiteral(arg) || ts19.isNoSubstitutionTemplateLiteral(arg)) sep = arg.text;
22945
23027
  else return null;
22946
23028
  }
22947
23029
  return parts.join(sep);
22948
23030
  }
22949
23031
  function parseRecordIndexAccess(val, localConstants, propsParams, resolveKey) {
22950
- if (!ts18.isElementAccessExpression(val)) return null;
23032
+ if (!ts19.isElementAccessExpression(val)) return null;
22951
23033
  const obj = val.expression;
22952
23034
  const arg = val.argumentExpression;
22953
- if (!ts18.isIdentifier(obj) || !ts18.isIdentifier(arg)) return null;
23035
+ if (!ts19.isIdentifier(obj) || !ts19.isIdentifier(arg)) return null;
22954
23036
  let indexPropName;
22955
23037
  let defaultKey;
22956
23038
  const resolved = resolveKey?.(arg.text);
@@ -22964,35 +23046,35 @@ function parseRecordIndexAccess(val, localConstants, propsParams, resolveKey) {
22964
23046
  }
22965
23047
  const constInfo = localConstants.find((c) => c.name === obj.text && c.isModule);
22966
23048
  if (constInfo?.value === void 0) return null;
22967
- const sf = ts18.createSourceFile(
23049
+ const sf = ts19.createSourceFile(
22968
23050
  "__rec.ts",
22969
23051
  `(${constInfo.value})`,
22970
- ts18.ScriptTarget.Latest,
23052
+ ts19.ScriptTarget.Latest,
22971
23053
  /* setParentNodes */
22972
23054
  true
22973
23055
  );
22974
23056
  if (sf.statements.length !== 1) return null;
22975
23057
  const stmt = sf.statements[0];
22976
- if (!ts18.isExpressionStatement(stmt)) return null;
23058
+ if (!ts19.isExpressionStatement(stmt)) return null;
22977
23059
  let parsed = stmt.expression;
22978
- while (ts18.isParenthesizedExpression(parsed)) parsed = parsed.expression;
22979
- if (!ts18.isObjectLiteralExpression(parsed)) return null;
23060
+ while (ts19.isParenthesizedExpression(parsed)) parsed = parsed.expression;
23061
+ if (!ts19.isObjectLiteralExpression(parsed)) return null;
22980
23062
  const entries2 = [];
22981
23063
  for (const prop of parsed.properties) {
22982
- if (!ts18.isPropertyAssignment(prop)) return null;
23064
+ if (!ts19.isPropertyAssignment(prop)) return null;
22983
23065
  let key;
22984
- if (ts18.isIdentifier(prop.name)) {
23066
+ if (ts19.isIdentifier(prop.name)) {
22985
23067
  key = prop.name.text;
22986
- } else if (ts18.isStringLiteral(prop.name) || ts18.isNoSubstitutionTemplateLiteral(prop.name)) {
23068
+ } else if (ts19.isStringLiteral(prop.name) || ts19.isNoSubstitutionTemplateLiteral(prop.name)) {
22987
23069
  key = prop.name.text;
22988
23070
  } else {
22989
23071
  return null;
22990
23072
  }
22991
23073
  let v = prop.initializer;
22992
- while (ts18.isParenthesizedExpression(v)) v = v.expression;
22993
- if (ts18.isNumericLiteral(v)) {
23074
+ while (ts19.isParenthesizedExpression(v)) v = v.expression;
23075
+ if (ts19.isNumericLiteral(v)) {
22994
23076
  entries2.push({ key, value: { kind: "number", text: v.text } });
22995
- } else if (ts18.isStringLiteral(v) || ts18.isNoSubstitutionTemplateLiteral(v)) {
23077
+ } else if (ts19.isStringLiteral(v) || ts19.isNoSubstitutionTemplateLiteral(v)) {
22996
23078
  entries2.push({ key, value: { kind: "string", text: v.text } });
22997
23079
  } else {
22998
23080
  return null;
@@ -23627,6 +23709,7 @@ function compileJSX(source, filePath, options2) {
23627
23709
  const sortedRuntimeImports = [...runtimeImports].sort();
23628
23710
  const runtimeImportLine = sortedRuntimeImports.length > 0 ? `import { ${sortedRuntimeImports.join(", ")} } from '${RUNTIME_MODULE}'` : "";
23629
23711
  const externalImportLines = [];
23712
+ const isUsedAsValue = makeValueUsageTest(body2);
23630
23713
  for (const imp of ctx2.imports) {
23631
23714
  if (imp.isTypeOnly) continue;
23632
23715
  if (imp.source === "@barefootjs/client" || imp.source === RUNTIME_MODULE) continue;
@@ -23634,7 +23717,7 @@ function compileJSX(source, filePath, options2) {
23634
23717
  externalImportLines.push(`import '${imp.source}'`);
23635
23718
  continue;
23636
23719
  }
23637
- const used = imp.specifiers.filter((s2) => !s2.isDefault && !s2.isNamespace && new RegExp(`\\b${s2.alias || s2.name}\\b`).test(body2)).map((s2) => s2.alias ? `${s2.name} as ${s2.alias}` : s2.name);
23720
+ const used = imp.specifiers.filter((s2) => !s2.isDefault && !s2.isNamespace && !s2.isTypeOnly && isUsedAsValue(s2.alias || s2.name)).map((s2) => s2.alias ? `${s2.name} as ${s2.alias}` : s2.name);
23638
23721
  if (used.length > 0) {
23639
23722
  externalImportLines.push(`import { ${used.join(", ")} } from '${imp.source}'`);
23640
23723
  }
@@ -23665,6 +23748,7 @@ function compileJSX(source, filePath, options2) {
23665
23748
  if (imp.isTypeOnly) continue;
23666
23749
  if (!imp.source.startsWith("./") && !imp.source.startsWith("../")) continue;
23667
23750
  for (const spec of imp.specifiers) {
23751
+ if (spec.isTypeOnly) continue;
23668
23752
  if (ctx2.importedClientSignalNames.has(spec.alias ?? spec.name)) {
23669
23753
  sources.add(imp.source);
23670
23754
  break;
@@ -23794,7 +23878,7 @@ var init_compiler = __esm({
23794
23878
  });
23795
23879
 
23796
23880
  // ../jsx/src/shared-program.ts
23797
- import ts19 from "typescript";
23881
+ import ts20 from "typescript";
23798
23882
  import path5 from "node:path";
23799
23883
  function commonParent(paths) {
23800
23884
  if (paths.length === 0) return process.cwd();
@@ -23812,10 +23896,10 @@ function commonParent(paths) {
23812
23896
  function createProgramForCorpus(files2, options2 = {}) {
23813
23897
  const baseUrl = options2.baseUrl ?? commonParent(files2);
23814
23898
  const compilerOptions = {
23815
- target: ts19.ScriptTarget.Latest,
23816
- module: ts19.ModuleKind.ESNext,
23817
- moduleResolution: ts19.ModuleResolutionKind.Bundler,
23818
- jsx: ts19.JsxEmit.ReactJSX,
23899
+ target: ts20.ScriptTarget.Latest,
23900
+ module: ts20.ModuleKind.ESNext,
23901
+ moduleResolution: ts20.ModuleResolutionKind.Bundler,
23902
+ jsx: ts20.JsxEmit.ReactJSX,
23819
23903
  strict: true,
23820
23904
  skipLibCheck: true,
23821
23905
  noEmit: true,
@@ -23825,7 +23909,7 @@ function createProgramForCorpus(files2, options2 = {}) {
23825
23909
  ...options2.compilerOptions
23826
23910
  };
23827
23911
  const absolute = files2.map((f) => path5.resolve(f));
23828
- return ts19.createProgram(absolute, compilerOptions, void 0, options2.oldProgram);
23912
+ return ts20.createProgram(absolute, compilerOptions, void 0, options2.oldProgram);
23829
23913
  }
23830
23914
  var init_shared_program = __esm({
23831
23915
  "../jsx/src/shared-program.ts"() {
@@ -24894,7 +24978,7 @@ var init_dangerous_inner_html = __esm({
24894
24978
  });
24895
24979
 
24896
24980
  // ../jsx/src/combine-client-js.ts
24897
- import ts20 from "typescript";
24981
+ import ts21 from "typescript";
24898
24982
  function combineParentChildClientJs(files2) {
24899
24983
  const result2 = /* @__PURE__ */ new Map();
24900
24984
  const lookup = /* @__PURE__ */ new Map();
@@ -24951,17 +25035,17 @@ function combineParentChildClientJs(files2) {
24951
25035
  return result2;
24952
25036
  }
24953
25037
  function parseAndMerge(content2, importsBySource, otherImports, codeSections) {
24954
- const sourceFile = ts20.createSourceFile(
25038
+ const sourceFile = ts21.createSourceFile(
24955
25039
  "combine.js",
24956
25040
  content2,
24957
- ts20.ScriptTarget.Latest,
25041
+ ts21.ScriptTarget.Latest,
24958
25042
  /*setParentNodes*/
24959
25043
  false,
24960
- ts20.ScriptKind.JS
25044
+ ts21.ScriptKind.JS
24961
25045
  );
24962
25046
  const importSpans = [];
24963
25047
  for (const stmt of sourceFile.statements) {
24964
- if (!ts20.isImportDeclaration(stmt)) continue;
25048
+ if (!ts21.isImportDeclaration(stmt)) continue;
24965
25049
  const start2 = stmt.getStart(sourceFile);
24966
25050
  const end2 = stmt.getEnd();
24967
25051
  importSpans.push([start2, end2]);
@@ -24969,8 +25053,8 @@ function parseAndMerge(content2, importsBySource, otherImports, codeSections) {
24969
25053
  if (stmtText.includes("@bf-child:")) continue;
24970
25054
  const clause = stmt.importClause;
24971
25055
  const bindings = clause?.namedBindings;
24972
- const specifier = ts20.isStringLiteral(stmt.moduleSpecifier) ? stmt.moduleSpecifier.text : "";
24973
- if (clause && !clause.name && bindings && ts20.isNamedImports(bindings)) {
25056
+ const specifier = ts21.isStringLiteral(stmt.moduleSpecifier) ? stmt.moduleSpecifier.text : "";
25057
+ if (clause && !clause.name && bindings && ts21.isNamedImports(bindings)) {
24974
25058
  if (!importsBySource.has(specifier)) {
24975
25059
  importsBySource.set(specifier, /* @__PURE__ */ new Set());
24976
25060
  }
@@ -25164,7 +25248,7 @@ var init_loop_destructure = __esm({
25164
25248
  });
25165
25249
 
25166
25250
  // ../jsx/src/debug.ts
25167
- import ts21 from "typescript";
25251
+ import ts22 from "typescript";
25168
25252
  function buildComponentGraph(source, filePath, componentName) {
25169
25253
  const ctx2 = analyzeComponent(source, filePath, componentName);
25170
25254
  if (!ctx2.jsxReturn) {
@@ -26376,18 +26460,18 @@ function truncateExpr(expr, max = 40) {
26376
26460
  function exprReadsPropMember(expr, propsObjectName) {
26377
26461
  let sf;
26378
26462
  try {
26379
- sf = ts21.createSourceFile("__attr.tsx", `(${expr})`, ts21.ScriptTarget.Latest, true, ts21.ScriptKind.TSX);
26463
+ sf = ts22.createSourceFile("__attr.tsx", `(${expr})`, ts22.ScriptTarget.Latest, true, ts22.ScriptKind.TSX);
26380
26464
  } catch {
26381
26465
  return false;
26382
26466
  }
26383
26467
  let found = false;
26384
26468
  const visit3 = (n) => {
26385
26469
  if (found) return;
26386
- if (ts21.isPropertyAccessExpression(n) && ts21.isIdentifier(n.expression) && n.expression.text === propsObjectName && n.name.text !== "children") {
26470
+ if (ts22.isPropertyAccessExpression(n) && ts22.isIdentifier(n.expression) && n.expression.text === propsObjectName && n.name.text !== "children") {
26387
26471
  found = true;
26388
26472
  return;
26389
26473
  }
26390
- ts21.forEachChild(n, visit3);
26474
+ ts22.forEachChild(n, visit3);
26391
26475
  };
26392
26476
  visit3(sf);
26393
26477
  return found;
@@ -26464,7 +26548,7 @@ var init_debug = __esm({
26464
26548
  });
26465
26549
 
26466
26550
  // ../jsx/src/profiler.ts
26467
- import ts22 from "typescript";
26551
+ import ts23 from "typescript";
26468
26552
  function buildStaticBudget(source, filePath, componentName, options2 = {}) {
26469
26553
  const threshold = options2.fanOutThreshold ?? DEFAULT_FANOUT_THRESHOLD;
26470
26554
  const program = createProgramForFile(source, filePath)?.program;
@@ -26719,14 +26803,14 @@ function joinProfilerEvents(events, index) {
26719
26803
  return { joined, unattributed, diagnostics };
26720
26804
  }
26721
26805
  function findUninstrumentedEffects(source, filePath, instrumentedLines) {
26722
- const sf = ts22.createSourceFile(filePath, source, ts22.ScriptTarget.Latest, true, ts22.ScriptKind.TSX);
26806
+ const sf = ts23.createSourceFile(filePath, source, ts23.ScriptTarget.Latest, true, ts23.ScriptKind.TSX);
26723
26807
  const out = [];
26724
26808
  const visit3 = (node) => {
26725
- if (ts22.isCallExpression(node) && ts22.isIdentifier(node.expression) && node.expression.text === "createEffect") {
26809
+ if (ts23.isCallExpression(node) && ts23.isIdentifier(node.expression) && node.expression.text === "createEffect") {
26726
26810
  const line = sf.getLineAndCharacterOfPosition(node.getStart(sf)).line + 1;
26727
26811
  if (!instrumentedLines.has(line)) out.push({ file: filePath, line });
26728
26812
  }
26729
- ts22.forEachChild(node, visit3);
26813
+ ts23.forEachChild(node, visit3);
26730
26814
  };
26731
26815
  visit3(sf);
26732
26816
  out.sort((a, b) => a.line - b.line);
@@ -27012,19 +27096,19 @@ function assessBatchSafety(args2) {
27012
27096
  const signalGetters = new Set(args2.graph.signals.map((s) => s.name));
27013
27097
  let sf;
27014
27098
  try {
27015
- sf = ts22.createSourceFile("__h.ts", `const __h = ${args2.handler}`, ts22.ScriptTarget.Latest, true);
27099
+ sf = ts23.createSourceFile("__h.ts", `const __h = ${args2.handler}`, ts23.ScriptTarget.Latest, true);
27016
27100
  } catch {
27017
27101
  return "unverified";
27018
27102
  }
27019
27103
  const calls = [];
27020
27104
  const visit3 = (node) => {
27021
- if (ts22.isCallExpression(node) && ts22.isIdentifier(node.expression)) {
27105
+ if (ts23.isCallExpression(node) && ts23.isIdentifier(node.expression)) {
27022
27106
  const name2 = node.expression.text;
27023
27107
  if (setters.has(name2)) calls.push({ pos: node.getStart(sf), kind: "write" });
27024
27108
  else if (D.has(name2) && node.arguments.length === 0) calls.push({ pos: node.getStart(sf), kind: "memoRead" });
27025
27109
  else if (!signalGetters.has(name2) && !memoNames.has(name2)) calls.push({ pos: node.getStart(sf), kind: "risky" });
27026
27110
  }
27027
- ts22.forEachChild(node, visit3);
27111
+ ts23.forEachChild(node, visit3);
27028
27112
  };
27029
27113
  visit3(sf);
27030
27114
  calls.sort((a, b) => a.pos - b.pos);
@@ -27717,6 +27801,7 @@ __export(src_exports, {
27717
27801
  collectContextConsumers: () => collectContextConsumers,
27718
27802
  collectLoopBoundNames: () => collectLoopBoundNames,
27719
27803
  collectModuleStringConsts: () => collectModuleStringConsts,
27804
+ collectValueReferencedNames: () => collectValueReferencedNames,
27720
27805
  combineParentChildClientJs: () => combineParentChildClientJs,
27721
27806
  compileJSX: () => compileJSX,
27722
27807
  computeSsrSeedPlan: () => computeSsrSeedPlan,
@@ -27791,6 +27876,7 @@ __export(src_exports, {
27791
27876
  isStringTypedOperand: () => isStringTypedOperand,
27792
27877
  isSupported: () => isSupported,
27793
27878
  isValidHelperId: () => isValidHelperId,
27879
+ isValueReferenceIdentifier: () => isValueReferenceIdentifier,
27794
27880
  joinProfilerEvents: () => joinProfilerEvents,
27795
27881
  jsxToIR: () => jsxToIR,
27796
27882
  listComponentFunctions: () => listComponentFunctions,
@@ -27867,6 +27953,7 @@ var init_src2 = __esm({
27867
27953
  init_css_layer_prefixer();
27868
27954
  init_instrumentation();
27869
27955
  init_errors();
27956
+ init_value_references();
27870
27957
  init_expression_parser();
27871
27958
  init_expression_parser();
27872
27959
  init_loop_chain();
@@ -27941,7 +28028,7 @@ var init_runtime = __esm({
27941
28028
 
27942
28029
  // src/lib/resolve-imports.ts
27943
28030
  import { dirname as dirname2, resolve as resolve2 } from "node:path";
27944
- import ts23 from "typescript";
28031
+ import ts24 from "typescript";
27945
28032
  function shapeFromDecl(decl) {
27946
28033
  const clause = decl.importClause;
27947
28034
  if (!clause) return null;
@@ -27951,7 +28038,7 @@ function shapeFromDecl(decl) {
27951
28038
  }
27952
28039
  const bindings = clause.namedBindings;
27953
28040
  if (bindings) {
27954
- if (ts23.isNamespaceImport(bindings)) {
28041
+ if (ts24.isNamespaceImport(bindings)) {
27955
28042
  shape.namespace = bindings.name.text;
27956
28043
  } else {
27957
28044
  for (const el of bindings.elements) {
@@ -27963,60 +28050,85 @@ function shapeFromDecl(decl) {
27963
28050
  }
27964
28051
  return shape;
27965
28052
  }
27966
- function collectExportedNames(source) {
27967
- const names = /* @__PURE__ */ new Set();
27968
- const sourceFile = ts23.createSourceFile(
28053
+ function collectExportInfo(source) {
28054
+ const localValueExports = /* @__PURE__ */ new Set();
28055
+ const otherValueExports = /* @__PURE__ */ new Set();
28056
+ const reExportedNames = /* @__PURE__ */ new Set();
28057
+ let hasStarReExport = false;
28058
+ const sourceFile = ts24.createSourceFile(
27969
28059
  "mod.ts",
27970
28060
  source,
27971
- ts23.ScriptTarget.Latest,
28061
+ ts24.ScriptTarget.Latest,
27972
28062
  /*setParents*/
27973
28063
  false,
27974
- ts23.ScriptKind.TS
28064
+ ts24.ScriptKind.TS
27975
28065
  );
27976
28066
  function hasExport(node) {
27977
- if (!ts23.canHaveModifiers(node)) return false;
27978
- const mods = ts23.getModifiers(node);
27979
- return mods?.some((m) => m.kind === ts23.SyntaxKind.ExportKeyword) ?? false;
28067
+ if (!ts24.canHaveModifiers(node)) return false;
28068
+ const mods = ts24.getModifiers(node);
28069
+ return mods?.some((m) => m.kind === ts24.SyntaxKind.ExportKeyword) ?? false;
28070
+ }
28071
+ function isAmbient(node) {
28072
+ if (!ts24.canHaveModifiers(node)) return false;
28073
+ const mods = ts24.getModifiers(node);
28074
+ return mods?.some((m) => m.kind === ts24.SyntaxKind.DeclareKeyword) ?? false;
27980
28075
  }
27981
28076
  function collectFromBindingName(name2) {
27982
- if (ts23.isIdentifier(name2)) {
27983
- names.add(name2.text);
28077
+ if (ts24.isIdentifier(name2)) {
28078
+ localValueExports.add(name2.text);
27984
28079
  return;
27985
28080
  }
27986
28081
  for (const el of name2.elements) {
27987
- if (ts23.isBindingElement(el)) collectFromBindingName(el.name);
28082
+ if (ts24.isBindingElement(el)) collectFromBindingName(el.name);
27988
28083
  }
27989
28084
  }
27990
28085
  for (const stmt of sourceFile.statements) {
27991
- if (ts23.isVariableStatement(stmt) && hasExport(stmt)) {
28086
+ if (ts24.isVariableStatement(stmt) && hasExport(stmt)) {
27992
28087
  for (const d of stmt.declarationList.declarations) {
27993
28088
  collectFromBindingName(d.name);
27994
28089
  }
27995
- } else if (ts23.isFunctionDeclaration(stmt) && hasExport(stmt) && stmt.name) {
27996
- names.add(stmt.name.text);
27997
- } else if (ts23.isClassDeclaration(stmt) && hasExport(stmt) && stmt.name) {
27998
- names.add(stmt.name.text);
27999
- } else if (ts23.isExportDeclaration(stmt) && !stmt.moduleSpecifier && stmt.exportClause && ts23.isNamedExports(stmt.exportClause)) {
28090
+ } else if (ts24.isFunctionDeclaration(stmt) && hasExport(stmt) && stmt.name) {
28091
+ localValueExports.add(stmt.name.text);
28092
+ } else if (ts24.isClassDeclaration(stmt) && hasExport(stmt) && stmt.name) {
28093
+ localValueExports.add(stmt.name.text);
28094
+ } else if (ts24.isEnumDeclaration(stmt) && hasExport(stmt) && stmt.name) {
28095
+ otherValueExports.add(stmt.name.text);
28096
+ } else if (ts24.isModuleDeclaration(stmt) && hasExport(stmt) && ts24.isIdentifier(stmt.name)) {
28097
+ if (!isAmbient(stmt)) otherValueExports.add(stmt.name.text);
28098
+ } else if (ts24.isExportDeclaration(stmt)) {
28000
28099
  if (stmt.isTypeOnly) continue;
28001
- for (const el of stmt.exportClause.elements) {
28002
- if (el.isTypeOnly) continue;
28003
- names.add(el.name.text);
28100
+ if (!stmt.moduleSpecifier) {
28101
+ if (stmt.exportClause && ts24.isNamedExports(stmt.exportClause)) {
28102
+ for (const el of stmt.exportClause.elements) {
28103
+ if (el.isTypeOnly) continue;
28104
+ localValueExports.add(el.name.text);
28105
+ }
28106
+ }
28107
+ } else if (!stmt.exportClause) {
28108
+ hasStarReExport = true;
28109
+ } else if (ts24.isNamespaceExport(stmt.exportClause)) {
28110
+ reExportedNames.add(stmt.exportClause.name.text);
28111
+ } else if (ts24.isNamedExports(stmt.exportClause)) {
28112
+ for (const el of stmt.exportClause.elements) {
28113
+ if (el.isTypeOnly) continue;
28114
+ reExportedNames.add(el.name.text);
28115
+ }
28004
28116
  }
28005
28117
  }
28006
28118
  }
28007
- return [...names];
28119
+ return { localValueExports, otherValueExports, reExportedNames, hasStarReExport };
28008
28120
  }
28009
28121
  function hasUseClientDirective(source) {
28010
- const sourceFile = ts23.createSourceFile(
28122
+ const sourceFile = ts24.createSourceFile(
28011
28123
  "check.tsx",
28012
28124
  source,
28013
- ts23.ScriptTarget.Latest,
28125
+ ts24.ScriptTarget.Latest,
28014
28126
  /*setParents*/
28015
28127
  false,
28016
- ts23.ScriptKind.TSX
28128
+ ts24.ScriptKind.TSX
28017
28129
  );
28018
28130
  for (const stmt of sourceFile.statements) {
28019
- if (!ts23.isExpressionStatement(stmt) || !ts23.isStringLiteral(stmt.expression)) {
28131
+ if (!ts24.isExpressionStatement(stmt) || !ts24.isStringLiteral(stmt.expression)) {
28020
28132
  return false;
28021
28133
  }
28022
28134
  if (stmt.expression.text === "use client") return true;
@@ -28025,53 +28137,53 @@ function hasUseClientDirective(source) {
28025
28137
  }
28026
28138
  function collectTopLevelBindings(source) {
28027
28139
  const names = /* @__PURE__ */ new Set();
28028
- const sourceFile = ts23.createSourceFile(
28140
+ const sourceFile = ts24.createSourceFile(
28029
28141
  "bundle.ts",
28030
28142
  source,
28031
- ts23.ScriptTarget.Latest,
28143
+ ts24.ScriptTarget.Latest,
28032
28144
  /*setParents*/
28033
28145
  false,
28034
- ts23.ScriptKind.TS
28146
+ ts24.ScriptKind.TS
28035
28147
  );
28036
28148
  function collectFromBindingName(name2) {
28037
- if (ts23.isIdentifier(name2)) {
28149
+ if (ts24.isIdentifier(name2)) {
28038
28150
  names.add(name2.text);
28039
28151
  return;
28040
28152
  }
28041
28153
  for (const el of name2.elements) {
28042
- if (ts23.isBindingElement(el)) collectFromBindingName(el.name);
28154
+ if (ts24.isBindingElement(el)) collectFromBindingName(el.name);
28043
28155
  }
28044
28156
  }
28045
28157
  for (const stmt of sourceFile.statements) {
28046
- if (ts23.isVariableStatement(stmt)) {
28158
+ if (ts24.isVariableStatement(stmt)) {
28047
28159
  for (const d of stmt.declarationList.declarations) {
28048
28160
  collectFromBindingName(d.name);
28049
28161
  }
28050
- } else if (ts23.isFunctionDeclaration(stmt) && stmt.name) {
28162
+ } else if (ts24.isFunctionDeclaration(stmt) && stmt.name) {
28051
28163
  names.add(stmt.name.text);
28052
- } else if (ts23.isClassDeclaration(stmt) && stmt.name) {
28164
+ } else if (ts24.isClassDeclaration(stmt) && stmt.name) {
28053
28165
  names.add(stmt.name.text);
28054
28166
  }
28055
28167
  }
28056
28168
  return names;
28057
28169
  }
28058
28170
  function stripImportsAndExports(body2) {
28059
- const sourceFile = ts23.createSourceFile(
28171
+ const sourceFile = ts24.createSourceFile(
28060
28172
  "body.ts",
28061
28173
  body2,
28062
- ts23.ScriptTarget.Latest,
28174
+ ts24.ScriptTarget.Latest,
28063
28175
  /*setParents*/
28064
28176
  false,
28065
- ts23.ScriptKind.TS
28177
+ ts24.ScriptKind.TS
28066
28178
  );
28067
28179
  const spans = [];
28068
28180
  const hoistedImports = [];
28069
28181
  for (const stmt of sourceFile.statements) {
28070
- if (ts23.isImportDeclaration(stmt)) {
28182
+ if (ts24.isImportDeclaration(stmt)) {
28071
28183
  const start2 = stmt.getStart(sourceFile);
28072
28184
  const end2 = stmt.getEnd();
28073
28185
  const specifier = stmt.moduleSpecifier;
28074
- if (ts23.isStringLiteral(specifier)) {
28186
+ if (ts24.isStringLiteral(specifier)) {
28075
28187
  const path25 = specifier.text;
28076
28188
  const isRelative = path25.startsWith("./") || path25.startsWith("../");
28077
28189
  if (!isRelative) {
@@ -28081,24 +28193,24 @@ function stripImportsAndExports(body2) {
28081
28193
  spans.push([start2, end2]);
28082
28194
  continue;
28083
28195
  }
28084
- if (ts23.isExportDeclaration(stmt)) {
28196
+ if (ts24.isExportDeclaration(stmt)) {
28085
28197
  spans.push([stmt.getStart(sourceFile), stmt.getEnd()]);
28086
28198
  continue;
28087
28199
  }
28088
- if (ts23.isExportAssignment(stmt)) {
28089
- const exportKw = stmt.getChildren(sourceFile).find((c) => c.kind === ts23.SyntaxKind.ExportKeyword);
28090
- const defaultKw = stmt.getChildren(sourceFile).find((c) => c.kind === ts23.SyntaxKind.DefaultKeyword);
28091
- const equalsKw = stmt.getChildren(sourceFile).find((c) => c.kind === ts23.SyntaxKind.EqualsToken);
28200
+ if (ts24.isExportAssignment(stmt)) {
28201
+ const exportKw = stmt.getChildren(sourceFile).find((c) => c.kind === ts24.SyntaxKind.ExportKeyword);
28202
+ const defaultKw = stmt.getChildren(sourceFile).find((c) => c.kind === ts24.SyntaxKind.DefaultKeyword);
28203
+ const equalsKw = stmt.getChildren(sourceFile).find((c) => c.kind === ts24.SyntaxKind.EqualsToken);
28092
28204
  const start2 = exportKw?.getStart(sourceFile) ?? stmt.getStart(sourceFile);
28093
28205
  const end2 = (defaultKw ?? equalsKw)?.getEnd() ?? exportKw?.getEnd() ?? stmt.getStart(sourceFile);
28094
28206
  if (end2 > start2) spans.push([start2, end2]);
28095
28207
  continue;
28096
28208
  }
28097
- if (ts23.canHaveModifiers(stmt)) {
28098
- const mods = ts23.getModifiers(stmt);
28209
+ if (ts24.canHaveModifiers(stmt)) {
28210
+ const mods = ts24.getModifiers(stmt);
28099
28211
  if (!mods) continue;
28100
28212
  for (const mod of mods) {
28101
- if (mod.kind === ts23.SyntaxKind.ExportKeyword) {
28213
+ if (mod.kind === ts24.SyntaxKind.ExportKeyword) {
28102
28214
  const start2 = mod.getStart(sourceFile);
28103
28215
  let end2 = mod.getEnd();
28104
28216
  while (end2 < body2.length && /\s/.test(body2[end2])) end2++;
@@ -28130,15 +28242,43 @@ function buildConsumerBinding(shape, topLevelId) {
28130
28242
  );
28131
28243
  return `const { ${entries2.join(", ")} } = ${topLevelId};`;
28132
28244
  }
28133
- function buildTopLevelIIFE(topLevelId, body2, shapesNeeded, originalSource) {
28245
+ function buildMissingExportMessage(name2, modulePath) {
28246
+ return {
28247
+ message: `Import \`${name2}\` from '${modulePath}' has no matching export in that module. The client bundle would throw \`ReferenceError: ${name2} is not defined\` at load.`,
28248
+ suggestion: `Either \`${name2}\` is a TYPE \u2014 import it with \`import type { ${name2} }\` or \`import { type ${name2} }\` (the compiler no longer emits type-only specifiers into the client bundle as of #2432) \u2014 or it's a typo / removed export: check '${modulePath}' actually exports \`${name2}\`.`
28249
+ };
28250
+ }
28251
+ function buildTopLevelIIFE(topLevelId, body2, shapesNeeded, originalSource, modulePath) {
28134
28252
  const { body: stripped, hoistedImports } = stripImportsAndExports(body2);
28135
28253
  const wantsNamespace = shapesNeeded.some((s) => !!s.namespace);
28136
28254
  const namesNeeded = /* @__PURE__ */ new Set();
28137
- if (wantsNamespace) {
28138
- for (const n of collectExportedNames(originalSource)) namesNeeded.add(n);
28139
- }
28255
+ const namedRequests = /* @__PURE__ */ new Set();
28140
28256
  for (const shape of shapesNeeded) {
28141
- for (const { imported } of shape.named) namesNeeded.add(imported);
28257
+ for (const { imported } of shape.named) {
28258
+ namesNeeded.add(imported);
28259
+ namedRequests.add(imported);
28260
+ }
28261
+ }
28262
+ const errors = [];
28263
+ if (wantsNamespace || namedRequests.size > 0) {
28264
+ const info = collectExportInfo(originalSource);
28265
+ if (wantsNamespace) {
28266
+ for (const n of info.localValueExports) namesNeeded.add(n);
28267
+ }
28268
+ if (namedRequests.size > 0 && !info.hasStarReExport) {
28269
+ const surfaceNames = /* @__PURE__ */ new Set([...info.localValueExports, ...info.otherValueExports, ...info.reExportedNames]);
28270
+ const loc = { file: modulePath, start: { line: 1, column: 0 }, end: { line: 1, column: 0 } };
28271
+ for (const name2 of namedRequests) {
28272
+ if (surfaceNames.has(name2)) continue;
28273
+ const { message, suggestion } = buildMissingExportMessage(name2, modulePath);
28274
+ errors.push(
28275
+ createError(ErrorCodes.INLINED_IMPORT_MISSING_EXPORT, loc, {
28276
+ message,
28277
+ suggestion: { message: suggestion }
28278
+ })
28279
+ );
28280
+ }
28281
+ }
28142
28282
  }
28143
28283
  if (namesNeeded.size === 0) {
28144
28284
  return {
@@ -28146,7 +28286,8 @@ function buildTopLevelIIFE(topLevelId, body2, shapesNeeded, originalSource) {
28146
28286
  ${stripped}
28147
28287
  return {};
28148
28288
  })();`,
28149
- hoistedImports
28289
+ hoistedImports,
28290
+ errors
28150
28291
  };
28151
28292
  }
28152
28293
  const ret = `{ ${[...namesNeeded].join(", ")} }`;
@@ -28155,7 +28296,8 @@ return {};
28155
28296
  ${stripped}
28156
28297
  return ${ret};
28157
28298
  })();`,
28158
- hoistedImports
28299
+ hoistedImports,
28300
+ errors
28159
28301
  };
28160
28302
  }
28161
28303
  async function resolveSourceFile(importPath, searchDirs) {
@@ -28204,51 +28346,27 @@ function buildDanglingReferenceMessage(binding, s) {
28204
28346
  };
28205
28347
  }
28206
28348
  }
28207
- function isValueReference(id2) {
28208
- const parent2 = id2.parent;
28209
- if (!parent2) return false;
28210
- if (ts23.isPropertyAccessExpression(parent2) && parent2.name === id2) return false;
28211
- if (ts23.isPropertyAssignment(parent2) && parent2.name === id2) return false;
28212
- if ((ts23.isMethodDeclaration(parent2) || ts23.isGetAccessorDeclaration(parent2) || ts23.isSetAccessorDeclaration(parent2)) && parent2.name === id2) {
28213
- return false;
28214
- }
28215
- if (ts23.isVariableDeclaration(parent2) && parent2.name === id2) return false;
28216
- if (ts23.isFunctionDeclaration(parent2) && parent2.name === id2) return false;
28217
- if (ts23.isFunctionExpression(parent2) && parent2.name === id2) return false;
28218
- if (ts23.isClassDeclaration(parent2) && parent2.name === id2) return false;
28219
- if (ts23.isClassExpression(parent2) && parent2.name === id2) return false;
28220
- if (ts23.isParameter(parent2) && parent2.name === id2) return false;
28221
- if (ts23.isBindingElement(parent2) && (parent2.name === id2 || parent2.propertyName === id2)) return false;
28222
- if (ts23.isLabeledStatement(parent2) && parent2.label === id2) return false;
28223
- if (ts23.isBreakOrContinueStatement(parent2) && parent2.label === id2) return false;
28224
- if (ts23.isImportSpecifier(parent2) && (parent2.name === id2 || parent2.propertyName === id2)) return false;
28225
- if (ts23.isExportSpecifier(parent2) && (parent2.name === id2 || parent2.propertyName === id2)) return false;
28226
- if (ts23.isImportClause(parent2) && parent2.name === id2) return false;
28227
- if (ts23.isNamespaceImport(parent2) && parent2.name === id2) return false;
28228
- if (ts23.isQualifiedName(parent2) && parent2.right === id2) return false;
28229
- return true;
28230
- }
28231
28349
  function detectStrippedReferences(bundleSource, stripped) {
28232
28350
  if (stripped.length === 0) return [];
28233
28351
  let sf;
28234
28352
  try {
28235
- sf = ts23.createSourceFile(
28353
+ sf = ts24.createSourceFile(
28236
28354
  "bundle.js",
28237
28355
  bundleSource,
28238
- ts23.ScriptTarget.Latest,
28356
+ ts24.ScriptTarget.Latest,
28239
28357
  /*setParents*/
28240
28358
  true,
28241
- ts23.ScriptKind.JS
28359
+ ts24.ScriptKind.JS
28242
28360
  );
28243
28361
  } catch {
28244
28362
  return [];
28245
28363
  }
28246
28364
  const firstReference = /* @__PURE__ */ new Map();
28247
28365
  function visit3(node) {
28248
- if (ts23.isIdentifier(node) && isValueReference(node)) {
28366
+ if (ts24.isIdentifier(node) && isValueReferenceIdentifier(node)) {
28249
28367
  if (!firstReference.has(node.text)) firstReference.set(node.text, node);
28250
28368
  }
28251
- ts23.forEachChild(node, visit3);
28369
+ ts24.forEachChild(node, visit3);
28252
28370
  }
28253
28371
  visit3(sf);
28254
28372
  const errors = [];
@@ -28278,18 +28396,18 @@ function detectStrippedReferences(bundleSource, stripped) {
28278
28396
  return errors;
28279
28397
  }
28280
28398
  async function walkAndCollect(content2, searchDirs, modules2, visiting, loggingPath, stripped, stubDeps, nextId) {
28281
- const sourceFile = ts23.createSourceFile(
28399
+ const sourceFile = ts24.createSourceFile(
28282
28400
  "walk.js",
28283
28401
  content2,
28284
- ts23.ScriptTarget.Latest,
28402
+ ts24.ScriptTarget.Latest,
28285
28403
  /*setParents*/
28286
28404
  false,
28287
- ts23.ScriptKind.JS
28405
+ ts24.ScriptKind.JS
28288
28406
  );
28289
28407
  const sites = [];
28290
28408
  for (const stmt of sourceFile.statements) {
28291
- if (!ts23.isImportDeclaration(stmt)) continue;
28292
- if (!ts23.isStringLiteral(stmt.moduleSpecifier)) continue;
28409
+ if (!ts24.isImportDeclaration(stmt)) continue;
28410
+ if (!ts24.isStringLiteral(stmt.moduleSpecifier)) continue;
28293
28411
  const spec = stmt.moduleSpecifier.text;
28294
28412
  if (!spec.startsWith("./") && !spec.startsWith("../")) continue;
28295
28413
  const start2 = stmt.getStart(sourceFile);
@@ -28438,14 +28556,16 @@ async function inlineRelativeImports(content2, searchDirs, loggingPath, hoistedA
28438
28556
  const ordered = topoSort(modules2);
28439
28557
  const iifes = [];
28440
28558
  for (const mod of ordered) {
28441
- const { wrapped, hoistedImports } = buildTopLevelIIFE(
28559
+ const { wrapped, hoistedImports, errors } = buildTopLevelIIFE(
28442
28560
  mod.topLevelId,
28443
28561
  mod.transpiledBody,
28444
28562
  mod.consumerShapes,
28445
- mod.originalSource
28563
+ mod.originalSource,
28564
+ mod.path
28446
28565
  );
28447
28566
  iifes.push(wrapped);
28448
28567
  for (const h of hoistedImports) hoistedAcc.push(h);
28568
+ for (const err of errors) errorAcc.push(err);
28449
28569
  }
28450
28570
  const finalContent = iifes.join("\n") + "\n" + parentContent;
28451
28571
  for (const err of detectStrippedReferences(finalContent, stripped)) errorAcc.push(err);
@@ -28741,7 +28861,7 @@ var init_assets_ignore = __esm({
28741
28861
  });
28742
28862
 
28743
28863
  // src/lib/runtime-treeshake.ts
28744
- import ts24 from "typescript";
28864
+ import ts25 from "typescript";
28745
28865
  import { basename, dirname as dirname3 } from "node:path";
28746
28866
  import { build as esbuildBuild } from "esbuild";
28747
28867
  function isBarefootClientSpecifier(spec) {
@@ -28758,13 +28878,13 @@ function collectUsedRuntimeExports(code, sourceLabel = "<input>") {
28758
28878
  if (!code.includes("@barefootjs/client") && !code.includes("barefoot.js")) return result2;
28759
28879
  let sourceFile;
28760
28880
  try {
28761
- sourceFile = ts24.createSourceFile(
28881
+ sourceFile = ts25.createSourceFile(
28762
28882
  sourceLabel,
28763
28883
  code,
28764
- ts24.ScriptTarget.Latest,
28884
+ ts25.ScriptTarget.Latest,
28765
28885
  /*setParentNodes*/
28766
28886
  false,
28767
- ts24.ScriptKind.JS
28887
+ ts25.ScriptKind.JS
28768
28888
  );
28769
28889
  } catch (err) {
28770
28890
  result2.unsafe = true;
@@ -28772,13 +28892,13 @@ function collectUsedRuntimeExports(code, sourceLabel = "<input>") {
28772
28892
  return result2;
28773
28893
  }
28774
28894
  const visit3 = (node) => {
28775
- if (ts24.isImportDeclaration(node)) {
28895
+ if (ts25.isImportDeclaration(node)) {
28776
28896
  const spec = node.moduleSpecifier;
28777
- if (ts24.isStringLiteral(spec) && isEmittedRuntimeSpecifier(spec.text)) {
28897
+ if (ts25.isStringLiteral(spec) && isEmittedRuntimeSpecifier(spec.text)) {
28778
28898
  const clause = node.importClause;
28779
28899
  if (!clause) {
28780
28900
  } else if (clause.isTypeOnly) {
28781
- } else if (clause.namedBindings && ts24.isNamedImports(clause.namedBindings)) {
28901
+ } else if (clause.namedBindings && ts25.isNamedImports(clause.namedBindings)) {
28782
28902
  for (const el of clause.namedBindings.elements) {
28783
28903
  if (el.isTypeOnly) continue;
28784
28904
  const imported = (el.propertyName ?? el.name).text;
@@ -28788,7 +28908,7 @@ function collectUsedRuntimeExports(code, sourceLabel = "<input>") {
28788
28908
  result2.unsafe = true;
28789
28909
  result2.reasons.push(`default import of "${spec.text}" in ${sourceLabel}`);
28790
28910
  }
28791
- } else if (clause.namedBindings && ts24.isNamespaceImport(clause.namedBindings)) {
28911
+ } else if (clause.namedBindings && ts25.isNamespaceImport(clause.namedBindings)) {
28792
28912
  result2.unsafe = true;
28793
28913
  result2.reasons.push(`namespace import (* as ${clause.namedBindings.name.text}) of "${spec.text}" in ${sourceLabel}`);
28794
28914
  } else if (clause.name) {
@@ -28796,14 +28916,14 @@ function collectUsedRuntimeExports(code, sourceLabel = "<input>") {
28796
28916
  result2.reasons.push(`default import of "${spec.text}" in ${sourceLabel}`);
28797
28917
  }
28798
28918
  }
28799
- } else if (ts24.isCallExpression(node) && node.expression.kind === ts24.SyntaxKind.ImportKeyword) {
28919
+ } else if (ts25.isCallExpression(node) && node.expression.kind === ts25.SyntaxKind.ImportKeyword) {
28800
28920
  const arg = node.arguments[0];
28801
- if (arg && ts24.isStringLiteral(arg) && isEmittedRuntimeSpecifier(arg.text)) {
28921
+ if (arg && ts25.isStringLiteral(arg) && isEmittedRuntimeSpecifier(arg.text)) {
28802
28922
  result2.unsafe = true;
28803
28923
  result2.reasons.push(`dynamic import("${arg.text}") in ${sourceLabel}`);
28804
28924
  }
28805
28925
  }
28806
- ts24.forEachChild(node, visit3);
28926
+ ts25.forEachChild(node, visit3);
28807
28927
  };
28808
28928
  visit3(sourceFile);
28809
28929
  return result2;
@@ -28876,7 +28996,7 @@ var init_runtime_treeshake = __esm({
28876
28996
  });
28877
28997
 
28878
28998
  // src/lib/build.ts
28879
- import ts25 from "typescript";
28999
+ import ts26 from "typescript";
28880
29000
  import { mkdir, readdir, stat, unlink } from "node:fs/promises";
28881
29001
  import { resolve as resolve6, basename as basename2, relative as relative2, dirname as dirname4, isAbsolute as isAbsolute2 } from "node:path";
28882
29002
  import { fileURLToPath as fileURLToPath2 } from "node:url";
@@ -29524,7 +29644,7 @@ async function build(config, options2 = {}) {
29524
29644
  };
29525
29645
  }
29526
29646
  function extractBareImports(code) {
29527
- const { importedFiles } = ts25.preProcessFile(code, true, true);
29647
+ const { importedFiles } = ts26.preProcessFile(code, true, true);
29528
29648
  const specifiers = /* @__PURE__ */ new Set();
29529
29649
  for (const { fileName } of importedFiles) {
29530
29650
  if (!fileName.startsWith(".") && !fileName.startsWith("/") && !fileName.includes("://")) {
@@ -29591,16 +29711,16 @@ function effectiveOutName(tplPath, entryBaseNoExt) {
29591
29711
  }
29592
29712
  function topLevelImportLines(content2) {
29593
29713
  const lines = /* @__PURE__ */ new Set();
29594
- const sourceFile = ts25.createSourceFile(
29714
+ const sourceFile = ts26.createSourceFile(
29595
29715
  "merge.js",
29596
29716
  content2,
29597
- ts25.ScriptTarget.Latest,
29717
+ ts26.ScriptTarget.Latest,
29598
29718
  /*setParentNodes*/
29599
29719
  true,
29600
- ts25.ScriptKind.JS
29720
+ ts26.ScriptKind.JS
29601
29721
  );
29602
29722
  for (const stmt of sourceFile.statements) {
29603
- if (ts25.isImportDeclaration(stmt)) {
29723
+ if (ts26.isImportDeclaration(stmt)) {
29604
29724
  const { line } = sourceFile.getLineAndCharacterOfPosition(stmt.getStart(sourceFile));
29605
29725
  lines.add(line);
29606
29726
  }
@@ -29609,29 +29729,29 @@ function topLevelImportLines(content2) {
29609
29729
  }
29610
29730
  function rewriteBarefootClientSpecifiers(content2, rel) {
29611
29731
  if (!content2.includes("@barefootjs/client")) return content2;
29612
- const sourceFile = ts25.createSourceFile(
29732
+ const sourceFile = ts26.createSourceFile(
29613
29733
  "client.js",
29614
29734
  content2,
29615
- ts25.ScriptTarget.Latest,
29735
+ ts26.ScriptTarget.Latest,
29616
29736
  /*setParentNodes*/
29617
29737
  true,
29618
- ts25.ScriptKind.JS
29738
+ ts26.ScriptKind.JS
29619
29739
  );
29620
29740
  const isBarefootClient = (s) => s === "@barefootjs/client" || s.startsWith("@barefootjs/client/");
29621
29741
  const spans = [];
29622
29742
  const visit3 = (node) => {
29623
- if (ts25.isImportDeclaration(node) || ts25.isExportDeclaration(node)) {
29743
+ if (ts26.isImportDeclaration(node) || ts26.isExportDeclaration(node)) {
29624
29744
  const ms = node.moduleSpecifier;
29625
- if (ms && ts25.isStringLiteral(ms) && isBarefootClient(ms.text)) {
29745
+ if (ms && ts26.isStringLiteral(ms) && isBarefootClient(ms.text)) {
29626
29746
  spans.push([ms.getStart(sourceFile), ms.getEnd()]);
29627
29747
  }
29628
- } else if (ts25.isCallExpression(node) && node.expression.kind === ts25.SyntaxKind.ImportKeyword) {
29748
+ } else if (ts26.isCallExpression(node) && node.expression.kind === ts26.SyntaxKind.ImportKeyword) {
29629
29749
  const arg = node.arguments[0];
29630
- if (arg && ts25.isStringLiteral(arg) && isBarefootClient(arg.text)) {
29750
+ if (arg && ts26.isStringLiteral(arg) && isBarefootClient(arg.text)) {
29631
29751
  spans.push([arg.getStart(sourceFile), arg.getEnd()]);
29632
29752
  }
29633
29753
  }
29634
- ts25.forEachChild(node, visit3);
29754
+ ts26.forEachChild(node, visit3);
29635
29755
  };
29636
29756
  visit3(sourceFile);
29637
29757
  if (spans.length === 0) return content2;
@@ -110894,7 +111014,7 @@ __export(scenario_driver_exports, {
110894
111014
  import { writeFileSync as writeFileSync9, mkdtempSync, rmSync, readFileSync as readFileSync19, existsSync as existsSync23, statSync as statSync3 } from "node:fs";
110895
111015
  import { join as join2, dirname as dirname7, resolve as resolve11 } from "node:path";
110896
111016
  import { tmpdir } from "node:os";
110897
- import ts26 from "typescript";
111017
+ import ts27 from "typescript";
110898
111018
  function externalRuntimeImport(clientJs) {
110899
111019
  const chunks = Array.isArray(clientJs) ? clientJs : [clientJs];
110900
111020
  for (const chunk of chunks) {
@@ -110964,11 +111084,11 @@ function resolveLocalFile(spec) {
110964
111084
  }
110965
111085
  function rewriteLocalImports(js, chunkPath, inlined) {
110966
111086
  const chunkDir = dirname7(chunkPath);
110967
- const sf = ts26.createSourceFile("chunk.mjs", js, ts26.ScriptTarget.Latest, false, ts26.ScriptKind.JS);
111087
+ const sf = ts27.createSourceFile("chunk.mjs", js, ts27.ScriptTarget.Latest, false, ts27.ScriptKind.JS);
110968
111088
  const edits = [];
110969
111089
  for (const stmt of sf.statements) {
110970
- if (!ts26.isImportDeclaration(stmt)) continue;
110971
- if (!ts26.isStringLiteral(stmt.moduleSpecifier)) continue;
111090
+ if (!ts27.isImportDeclaration(stmt)) continue;
111091
+ if (!ts27.isStringLiteral(stmt.moduleSpecifier)) continue;
110972
111092
  const spec = stmt.moduleSpecifier.text;
110973
111093
  if (!spec.startsWith(".")) continue;
110974
111094
  const resolved = resolveLocalFile(join2(chunkDir, spec.replace(/\.client\.js$/, "")));
@@ -110980,13 +111100,13 @@ function rewriteLocalImports(js, chunkPath, inlined) {
110980
111100
  const abs = resolve11(resolved);
110981
111101
  if (inlined.has(abs)) {
110982
111102
  const clause = stmt.importClause;
110983
- if (clause && (clause.name || clause.namedBindings && ts26.isNamespaceImport(clause.namedBindings))) {
111103
+ if (clause && (clause.name || clause.namedBindings && ts27.isNamespaceImport(clause.namedBindings))) {
110984
111104
  throw new Error(
110985
111105
  `"${spec}" (imported by ${chunkPath}) uses a default or namespace import of a sibling client file, which the dynamic scenario runner cannot bind after inlining that file into the run. Import its exports by name, or use the static budget (\`bf debug profile <component>\`), which needs no run.`
110986
111106
  );
110987
111107
  }
110988
111108
  const shims = [];
110989
- if (clause?.namedBindings && ts26.isNamedImports(clause.namedBindings)) {
111109
+ if (clause?.namedBindings && ts27.isNamedImports(clause.namedBindings)) {
110990
111110
  for (const el of clause.namedBindings.elements) {
110991
111111
  if (el.propertyName) shims.push(`var ${el.name.text} = ${el.propertyName.text}`);
110992
111112
  }
@@ -111495,9 +111615,9 @@ function findProjectConfig(startDir) {
111495
111615
  let dir = path.resolve(startDir);
111496
111616
  const { root: fsRoot } = path.parse(dir);
111497
111617
  while (true) {
111498
- const ts27 = path.join(dir, "barefoot.config.ts");
111499
- if (existsSync2(ts27)) {
111500
- return { dir, tsConfigPath: ts27 };
111618
+ const ts28 = path.join(dir, "barefoot.config.ts");
111619
+ if (existsSync2(ts28)) {
111620
+ return { dir, tsConfigPath: ts28 };
111501
111621
  }
111502
111622
  if (dir === fsRoot) return null;
111503
111623
  dir = path.dirname(dir);