@barefootjs/vite 0.31.4 → 0.31.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { mkdir as mkdir2, readFile as readFile2, rm, writeFile as writeFile2 } f
3
3
  import { relative as relative2, resolve as resolve7, sep as sep3 } from "node:path";
4
4
 
5
5
  // ../jsx/src/compiler.ts
6
- import ts23 from "typescript";
6
+ import ts24 from "typescript";
7
7
 
8
8
  // ../jsx/src/analyzer.ts
9
9
  import ts9 from "typescript";
@@ -4239,6 +4239,8 @@ function generateCsrTemplateWithOpts(node, opts) {
4239
4239
  if (node.expr === "null" || node.expr === "undefined")
4240
4240
  return "";
4241
4241
  if (node.clientOnly && node.slotId) {
4242
+ if (node.markerless)
4243
+ return "";
4242
4244
  return `<!--bf:${node.slotId}--><!--/-->`;
4243
4245
  }
4244
4246
  {
@@ -8661,7 +8663,7 @@ function validateObjectFactoryDestructure(ctx, pattern, callee, loc) {
8661
8663
  }
8662
8664
 
8663
8665
  // ../jsx/src/jsx-to-ir.ts
8664
- import ts12 from "typescript";
8666
+ import ts13 from "typescript";
8665
8667
 
8666
8668
  // ../jsx/src/types.ts
8667
8669
  var SCOPE_FORBIDDEN = {
@@ -8760,6 +8762,7 @@ function pickAttrMetaFromIR(src) {
8760
8762
  }
8761
8763
 
8762
8764
  // ../jsx/src/module-exports.ts
8765
+ import ts10 from "typescript";
8763
8766
  function generateModuleExports(ir, extraInlineExported = new Set, rewriteRelativeImport, options) {
8764
8767
  const lines = [];
8765
8768
  for (const constant of options?.skipValueDeclarations ? [] : ir.metadata.localConstants) {
@@ -8856,6 +8859,49 @@ function findReachableNames(primaryRefs, declarations) {
8856
8859
  }
8857
8860
  return reachable;
8858
8861
  }
8862
+ function findAssignedNames(bodyText, candidates) {
8863
+ const assigned = new Set;
8864
+ if (candidates.size === 0)
8865
+ return assigned;
8866
+ const sf = ts10.createSourceFile("bf-assignment-scan.tsx", bodyText, ts10.ScriptTarget.Latest, false, ts10.ScriptKind.TSX);
8867
+ const record = (target) => {
8868
+ if (ts10.isIdentifier(target) && candidates.has(target.text)) {
8869
+ assigned.add(target.text);
8870
+ }
8871
+ };
8872
+ const visit2 = (node) => {
8873
+ if (ts10.isBinaryExpression(node) && isAssignmentOperator(node.operatorToken.kind)) {
8874
+ record(node.left);
8875
+ } else if ((ts10.isPrefixUnaryExpression(node) || ts10.isPostfixUnaryExpression(node)) && (node.operator === ts10.SyntaxKind.PlusPlusToken || node.operator === ts10.SyntaxKind.MinusMinusToken)) {
8876
+ record(node.operand);
8877
+ }
8878
+ ts10.forEachChild(node, visit2);
8879
+ };
8880
+ ts10.forEachChild(sf, visit2);
8881
+ return assigned;
8882
+ }
8883
+ function closeOverWritersOfMutableBindings(primaryRefs, declarations, mutableNames) {
8884
+ let reachable = findReachableNames(primaryRefs, declarations);
8885
+ if (mutableNames.size === 0)
8886
+ return reachable;
8887
+ let seedText = primaryRefs;
8888
+ for (let round = 0;round <= declarations.length; round++) {
8889
+ const survivingMutables = new Set([...reachable].filter((name) => mutableNames.has(name)));
8890
+ if (survivingMutables.size === 0)
8891
+ return reachable;
8892
+ const added = declarations.filter((d) => !reachable.has(d.name)).filter((d) => findAssignedNames(d.body, survivingMutables).size > 0).map((d) => d.name);
8893
+ if (added.length === 0)
8894
+ return reachable;
8895
+ seedText += `
8896
+ ` + added.join(`
8897
+ `);
8898
+ reachable = findReachableNames(seedText, declarations);
8899
+ }
8900
+ return reachable;
8901
+ }
8902
+ function isAssignmentOperator(kind) {
8903
+ return kind >= ts10.SyntaxKind.FirstAssignment && kind <= ts10.SyntaxKind.LastAssignment;
8904
+ }
8859
8905
 
8860
8906
  // ../jsx/src/builtins.ts
8861
8907
  var CLIENT_BUILTIN_SOURCE = "@barefootjs/client";
@@ -8878,7 +8924,7 @@ function stripClientBuiltinImports(imports) {
8878
8924
  }
8879
8925
 
8880
8926
  // ../jsx/src/reactivity-checker.ts
8881
- import ts10 from "typescript";
8927
+ import ts11 from "typescript";
8882
8928
  var REACTIVE_BRAND = "__reactive";
8883
8929
  function queryType(checker, node) {
8884
8930
  incrementCounter("typeCheckerQueries");
@@ -8896,7 +8942,7 @@ function safeGetText(node) {
8896
8942
  }
8897
8943
  }
8898
8944
  function analyze(node, checker) {
8899
- if (ts10.isPropertyAccessExpression(node)) {
8945
+ if (ts11.isPropertyAccessExpression(node)) {
8900
8946
  try {
8901
8947
  const type = queryType(checker, node);
8902
8948
  if (isReactiveType(type)) {
@@ -8920,7 +8966,7 @@ function analyze(node, checker) {
8920
8966
  }
8921
8967
  return NOT_REACTIVE;
8922
8968
  }
8923
- if (ts10.isIdentifier(node)) {
8969
+ if (ts11.isIdentifier(node)) {
8924
8970
  try {
8925
8971
  const type = queryType(checker, node);
8926
8972
  if (isReactiveType(type)) {
@@ -8932,7 +8978,7 @@ function analyze(node, checker) {
8932
8978
  } catch {}
8933
8979
  return NOT_REACTIVE;
8934
8980
  }
8935
- if (ts10.isCallExpression(node)) {
8981
+ if (ts11.isCallExpression(node)) {
8936
8982
  try {
8937
8983
  const calleeType = queryType(checker, node.expression);
8938
8984
  if (isReactiveType(calleeType)) {
@@ -8945,7 +8991,7 @@ function analyze(node, checker) {
8945
8991
  }
8946
8992
  let foundChild;
8947
8993
  let foundChildText = "";
8948
- ts10.forEachChild(node, (child) => {
8994
+ ts11.forEachChild(node, (child) => {
8949
8995
  if (foundChild?.isReactive)
8950
8996
  return;
8951
8997
  const result = analyze(child, checker);
@@ -8974,7 +9020,7 @@ function containsReactiveExpression(node, checker) {
8974
9020
  }
8975
9021
 
8976
9022
  // ../jsx/src/free-refs.ts
8977
- import ts11 from "typescript";
9023
+ import ts12 from "typescript";
8978
9024
  var _bindingMapCache = new WeakMap;
8979
9025
  function buildBindingMap(env) {
8980
9026
  const cached = _bindingMapCache.get(env);
@@ -9012,8 +9058,8 @@ function buildBindingMap(env) {
9012
9058
  for (const m of env.memos) {
9013
9059
  map.set(m.name, "memo-getter");
9014
9060
  }
9015
- if (env.loopParams) {
9016
- for (const name of env.loopParams)
9061
+ if (env.loopValueBoundNames) {
9062
+ for (const name of env.loopValueBoundNames)
9017
9063
  map.set(name, "render-item");
9018
9064
  }
9019
9065
  _bindingMapCache.set(env, map);
@@ -9042,20 +9088,20 @@ function defaultBindingScope(kind) {
9042
9088
  function collectIdentifiers2(node) {
9043
9089
  const out = [];
9044
9090
  const visit2 = (n, parent) => {
9045
- if (ts11.isIdentifier(n)) {
9046
- if (parent && ts11.isPropertyAccessExpression(parent) && parent.name === n)
9091
+ if (ts12.isIdentifier(n)) {
9092
+ if (parent && ts12.isPropertyAccessExpression(parent) && parent.name === n)
9047
9093
  return;
9048
- if (parent && ts11.isPropertyAssignment(parent) && parent.name === n)
9094
+ if (parent && ts12.isPropertyAssignment(parent) && parent.name === n)
9049
9095
  return;
9050
- if (parent && (ts11.isJsxOpeningElement(parent) || ts11.isJsxClosingElement(parent) || ts11.isJsxSelfClosingElement(parent)) && parent.tagName === n) {
9096
+ if (parent && (ts12.isJsxOpeningElement(parent) || ts12.isJsxClosingElement(parent) || ts12.isJsxSelfClosingElement(parent)) && parent.tagName === n) {
9051
9097
  return;
9052
9098
  }
9053
- if (parent && ts11.isJsxAttribute(parent) && parent.name === n)
9099
+ if (parent && ts12.isJsxAttribute(parent) && parent.name === n)
9054
9100
  return;
9055
9101
  out.push(n);
9056
9102
  return;
9057
9103
  }
9058
- ts11.forEachChild(n, (child) => visit2(child, n));
9104
+ ts12.forEachChild(n, (child) => visit2(child, n));
9059
9105
  };
9060
9106
  visit2(node);
9061
9107
  return out;
@@ -9064,7 +9110,7 @@ function collectReactiveBrandRefs(node, checker) {
9064
9110
  const out = [];
9065
9111
  const seen = new Set;
9066
9112
  const visit2 = (n) => {
9067
- if (ts11.isPropertyAccessExpression(n)) {
9113
+ if (ts12.isPropertyAccessExpression(n)) {
9068
9114
  try {
9069
9115
  const type = checker.getTypeAtLocation(n);
9070
9116
  if (isReactiveType(type)) {
@@ -9082,7 +9128,7 @@ function collectReactiveBrandRefs(node, checker) {
9082
9128
  incrementCounter("freeRefsTypeLookupFailures");
9083
9129
  }
9084
9130
  }
9085
- ts11.forEachChild(n, visit2);
9131
+ ts12.forEachChild(n, visit2);
9086
9132
  };
9087
9133
  visit2(node);
9088
9134
  return out;
@@ -9092,14 +9138,14 @@ function resolveConstantInitializerRefs(c, env, visited) {
9092
9138
  return [];
9093
9139
  if (c.containsArrow)
9094
9140
  return [];
9095
- const sf = ts11.createSourceFile("__const_init.ts", `const __probe = (${c.value});`, ts11.ScriptTarget.Latest, true);
9141
+ const sf = ts12.createSourceFile("__const_init.ts", `const __probe = (${c.value});`, ts12.ScriptTarget.Latest, true);
9096
9142
  const stmt = sf.statements[0];
9097
- if (!stmt || !ts11.isVariableStatement(stmt))
9143
+ if (!stmt || !ts12.isVariableStatement(stmt))
9098
9144
  return [];
9099
9145
  const decl = stmt.declarationList.declarations[0];
9100
9146
  if (!decl || !decl.initializer)
9101
9147
  return [];
9102
- const expr = ts11.isParenthesizedExpression(decl.initializer) ? decl.initializer.expression : decl.initializer;
9148
+ const expr = ts12.isParenthesizedExpression(decl.initializer) ? decl.initializer.expression : decl.initializer;
9103
9149
  return resolveFreeRefsInternal(expr, env, visited);
9104
9150
  }
9105
9151
  function resolveFreeRefsInternal(node, env, visited) {
@@ -9111,7 +9157,7 @@ function resolveFreeRefsInternal(node, env, visited) {
9111
9157
  const name = ident.text;
9112
9158
  if (env.propsObjectName === name) {
9113
9159
  const parent = ident.parent;
9114
- if (parent && ts11.isPropertyAccessExpression(parent) && parent.expression === ident && parent.name.text === "children") {
9160
+ if (parent && ts12.isPropertyAccessExpression(parent) && parent.expression === ident && parent.name.text === "children") {
9115
9161
  continue;
9116
9162
  }
9117
9163
  }
@@ -9539,13 +9585,13 @@ function exprCallsReactiveGetters(expr, ctx) {
9539
9585
  function visit2(n) {
9540
9586
  if (found)
9541
9587
  return;
9542
- if (ts12.isCallExpression(n) && ts12.isIdentifier(n.expression)) {
9588
+ if (ts13.isCallExpression(n) && ts13.isIdentifier(n.expression)) {
9543
9589
  if (names.has(n.expression.text)) {
9544
9590
  found = true;
9545
9591
  return;
9546
9592
  }
9547
9593
  }
9548
- ts12.forEachChild(n, visit2);
9594
+ ts13.forEachChild(n, visit2);
9549
9595
  }
9550
9596
  visit2(expr);
9551
9597
  return found;
@@ -9572,11 +9618,11 @@ function exprReferencesModuleClientSignal(expr, ctx) {
9572
9618
  function visit2(n) {
9573
9619
  if (found)
9574
9620
  return;
9575
- if (ts12.isCallExpression(n) && ts12.isIdentifier(n.expression) && names.has(n.expression.text)) {
9621
+ if (ts13.isCallExpression(n) && ts13.isIdentifier(n.expression) && names.has(n.expression.text)) {
9576
9622
  found = true;
9577
9623
  return;
9578
9624
  }
9579
- ts12.forEachChild(n, visit2);
9625
+ ts13.forEachChild(n, visit2);
9580
9626
  }
9581
9627
  visit2(expr);
9582
9628
  return found;
@@ -9586,11 +9632,11 @@ function exprHasFunctionCalls(expr) {
9586
9632
  function visit2(n) {
9587
9633
  if (found)
9588
9634
  return;
9589
- if (ts12.isCallExpression(n)) {
9635
+ if (ts13.isCallExpression(n)) {
9590
9636
  found = true;
9591
9637
  return;
9592
9638
  }
9593
- ts12.forEachChild(n, visit2);
9639
+ ts13.forEachChild(n, visit2);
9594
9640
  }
9595
9641
  visit2(expr);
9596
9642
  return found;
@@ -9627,10 +9673,10 @@ function lowerDateCalls(text, expr, ctx) {
9627
9673
  return text;
9628
9674
  const candidates = [];
9629
9675
  function visit2(n) {
9630
- if (ts12.isCallExpression(n) && n.arguments.length === 0 && ts12.isPropertyAccessExpression(n.expression) && !n.expression.questionDotToken && DATE_METHODS.has(n.expression.name.text)) {
9676
+ if (ts13.isCallExpression(n) && n.arguments.length === 0 && ts13.isPropertyAccessExpression(n.expression) && !n.expression.questionDotToken && DATE_METHODS.has(n.expression.name.text)) {
9631
9677
  candidates.push(n);
9632
9678
  }
9633
- ts12.forEachChild(n, visit2);
9679
+ ts13.forEachChild(n, visit2);
9634
9680
  }
9635
9681
  visit2(expr);
9636
9682
  if (candidates.length === 0)
@@ -9655,10 +9701,10 @@ function lowerToLocaleDateCalls(text, expr, ctx) {
9655
9701
  return text;
9656
9702
  const candidates = [];
9657
9703
  function visit2(n) {
9658
- if (ts12.isCallExpression(n) && n.arguments.length === 2 && ts12.isPropertyAccessExpression(n.expression) && !n.expression.questionDotToken && n.expression.name.text === "toLocaleDateString") {
9704
+ if (ts13.isCallExpression(n) && n.arguments.length === 2 && ts13.isPropertyAccessExpression(n.expression) && !n.expression.questionDotToken && n.expression.name.text === "toLocaleDateString") {
9659
9705
  candidates.push(n);
9660
9706
  }
9661
- ts12.forEachChild(n, visit2);
9707
+ ts13.forEachChild(n, visit2);
9662
9708
  }
9663
9709
  visit2(expr);
9664
9710
  if (candidates.length === 0)
@@ -9712,10 +9758,10 @@ function collectBranchLocalPropRefsViaSubstitution(node, ctx) {
9712
9758
  return;
9713
9759
  let acc;
9714
9760
  function visit2(n, parent) {
9715
- if (ts12.isIdentifier(n) && propDepsMap.has(n.text)) {
9716
- const isObjectKey = parent && ts12.isPropertyAssignment(parent) && parent.name === n;
9717
- const isShorthand = parent && ts12.isShorthandPropertyAssignment(parent) && parent.name === n;
9718
- const isAccessName = parent && ts12.isPropertyAccessExpression(parent) && parent.name === n;
9761
+ if (ts13.isIdentifier(n) && propDepsMap.has(n.text)) {
9762
+ const isObjectKey = parent && ts13.isPropertyAssignment(parent) && parent.name === n;
9763
+ const isShorthand = parent && ts13.isShorthandPropertyAssignment(parent) && parent.name === n;
9764
+ const isAccessName = parent && ts13.isPropertyAccessExpression(parent) && parent.name === n;
9719
9765
  if (!isObjectKey && !isShorthand && !isAccessName) {
9720
9766
  const deps = propDepsMap.get(n.text);
9721
9767
  if (deps && deps.size > 0) {
@@ -9726,7 +9772,7 @@ function collectBranchLocalPropRefsViaSubstitution(node, ctx) {
9726
9772
  }
9727
9773
  }
9728
9774
  }
9729
- ts12.forEachChild(n, (child) => visit2(child, n));
9775
+ ts13.forEachChild(n, (child) => visit2(child, n));
9730
9776
  }
9731
9777
  visit2(node);
9732
9778
  return acc;
@@ -9802,21 +9848,21 @@ function createTransformContext(analyzer) {
9802
9848
  function buildComponentNamespaces(ctx) {
9803
9849
  const result = new Map;
9804
9850
  for (const stmt of ctx.sourceFile.statements) {
9805
- if (!ts12.isVariableStatement(stmt))
9851
+ if (!ts13.isVariableStatement(stmt))
9806
9852
  continue;
9807
9853
  for (const decl of stmt.declarationList.declarations) {
9808
- if (!decl.initializer || !ts12.isIdentifier(decl.name))
9854
+ if (!decl.initializer || !ts13.isIdentifier(decl.name))
9809
9855
  continue;
9810
9856
  let init = decl.initializer;
9811
- while (ts12.isParenthesizedExpression(init))
9857
+ while (ts13.isParenthesizedExpression(init))
9812
9858
  init = init.expression;
9813
- if (!ts12.isObjectLiteralExpression(init))
9859
+ if (!ts13.isObjectLiteralExpression(init))
9814
9860
  continue;
9815
9861
  const members = new Map;
9816
9862
  for (const prop of init.properties) {
9817
- if (ts12.isShorthandPropertyAssignment(prop)) {
9863
+ if (ts13.isShorthandPropertyAssignment(prop)) {
9818
9864
  members.set(prop.name.text, prop.name.text);
9819
- } else if (ts12.isPropertyAssignment(prop) && (ts12.isIdentifier(prop.name) || ts12.isStringLiteral(prop.name)) && ts12.isIdentifier(prop.initializer)) {
9865
+ } else if (ts13.isPropertyAssignment(prop) && (ts13.isIdentifier(prop.name) || ts13.isStringLiteral(prop.name)) && ts13.isIdentifier(prop.initializer)) {
9820
9866
  members.set(prop.name.text, prop.initializer.text);
9821
9867
  }
9822
9868
  }
@@ -9828,11 +9874,11 @@ function buildComponentNamespaces(ctx) {
9828
9874
  return result;
9829
9875
  }
9830
9876
  function resolveMemberExpressionTag(tagNode, ctx) {
9831
- if (!ts12.isPropertyAccessExpression(tagNode))
9877
+ if (!ts13.isPropertyAccessExpression(tagNode))
9832
9878
  return null;
9833
- if (!ts12.isIdentifier(tagNode.expression))
9879
+ if (!ts13.isIdentifier(tagNode.expression))
9834
9880
  return null;
9835
- if (!ts12.isIdentifier(tagNode.name))
9881
+ if (!ts13.isIdentifier(tagNode.name))
9836
9882
  return null;
9837
9883
  if (!ctx._componentNamespaces) {
9838
9884
  ctx._componentNamespaces = buildComponentNamespaces(ctx);
@@ -9865,7 +9911,7 @@ function makeBindingEnv(ctx) {
9865
9911
  localFunctions: a.localFunctions,
9866
9912
  imports: a.imports,
9867
9913
  ambientGlobals: a.ambientGlobals,
9868
- loopParams: boundNames,
9914
+ loopValueBoundNames: boundNames,
9869
9915
  checker: a.checker
9870
9916
  };
9871
9917
  ctx._bindingEnv = env;
@@ -9989,7 +10035,7 @@ function buildIRRoot(analyzer) {
9989
10035
  return null;
9990
10036
  const ctx = createTransformContext(analyzer);
9991
10037
  const jsxReturn = analyzer.jsxReturn;
9992
- if (ts12.isJsxElement(jsxReturn) || ts12.isJsxSelfClosingElement(jsxReturn) || ts12.isJsxFragment(jsxReturn)) {
10038
+ if (ts13.isJsxElement(jsxReturn) || ts13.isJsxSelfClosingElement(jsxReturn) || ts13.isJsxFragment(jsxReturn)) {
9993
10039
  const ir2 = transformNode(jsxReturn, ctx);
9994
10040
  if (ir2 && needsScopeWrapper(ir2)) {
9995
10041
  return wrapInScopeElement(ir2);
@@ -10045,22 +10091,22 @@ function wrapInScopeElement(node) {
10045
10091
  };
10046
10092
  }
10047
10093
  function transformNode(node, ctx) {
10048
- if (ts12.isJsxElement(node)) {
10094
+ if (ts13.isJsxElement(node)) {
10049
10095
  return transformJsxElement(node, ctx);
10050
10096
  }
10051
- if (ts12.isJsxSelfClosingElement(node)) {
10097
+ if (ts13.isJsxSelfClosingElement(node)) {
10052
10098
  return transformSelfClosingElement(node, ctx);
10053
10099
  }
10054
- if (ts12.isJsxFragment(node)) {
10100
+ if (ts13.isJsxFragment(node)) {
10055
10101
  return transformFragment(node, ctx);
10056
10102
  }
10057
- if (ts12.isJsxText(node)) {
10103
+ if (ts13.isJsxText(node)) {
10058
10104
  return transformText(node, ctx);
10059
10105
  }
10060
- if (ts12.isJsxExpression(node)) {
10106
+ if (ts13.isJsxExpression(node)) {
10061
10107
  return transformExpression(node, ctx);
10062
10108
  }
10063
- if (ts12.isConditionalExpression(node)) {
10109
+ if (ts13.isConditionalExpression(node)) {
10064
10110
  return transformConditional(node, ctx);
10065
10111
  }
10066
10112
  return null;
@@ -10417,7 +10463,7 @@ function transformSelfClosingComponent(node, ctx, name) {
10417
10463
  }
10418
10464
  function isTransparentFragment(node, ctx) {
10419
10465
  const children = node.children.filter((child2) => {
10420
- if (ts12.isJsxText(child2)) {
10466
+ if (ts13.isJsxText(child2)) {
10421
10467
  return child2.text.trim() !== "";
10422
10468
  }
10423
10469
  return true;
@@ -10425,7 +10471,7 @@ function isTransparentFragment(node, ctx) {
10425
10471
  if (children.length !== 1)
10426
10472
  return false;
10427
10473
  const child = children[0];
10428
- if (!ts12.isJsxExpression(child))
10474
+ if (!ts13.isJsxExpression(child))
10429
10475
  return false;
10430
10476
  if (!child.expression)
10431
10477
  return false;
@@ -10469,7 +10515,7 @@ function transformChildren(children, ctx) {
10469
10515
  const result = [];
10470
10516
  for (let i = 0;i < children.length; i++) {
10471
10517
  const child = children[i];
10472
- if (ts12.isJsxExpression(child) && !child.expression) {
10518
+ if (ts13.isJsxExpression(child) && !child.expression) {
10473
10519
  continue;
10474
10520
  }
10475
10521
  const transformed = transformNode(child, ctx);
@@ -10484,10 +10530,10 @@ function transformChildren(children, ctx) {
10484
10530
  }
10485
10531
  function isRenderNothingLiteral(expr, ctx) {
10486
10532
  let e = expr;
10487
- while (ts12.isParenthesizedExpression(e) || ts12.isAsExpression(e) || ts12.isSatisfiesExpression(e) || ts12.isNonNullExpression(e)) {
10533
+ while (ts13.isParenthesizedExpression(e) || ts13.isAsExpression(e) || ts13.isSatisfiesExpression(e) || ts13.isNonNullExpression(e)) {
10488
10534
  e = e.expression;
10489
10535
  }
10490
- return e.kind === ts12.SyntaxKind.NullKeyword || e.kind === ts12.SyntaxKind.TrueKeyword || e.kind === ts12.SyntaxKind.FalseKeyword || ts12.isIdentifier(e) && e.text === "undefined" && !isNameBound("undefined", makeBindingEnv(ctx));
10536
+ return e.kind === ts13.SyntaxKind.NullKeyword || e.kind === ts13.SyntaxKind.TrueKeyword || e.kind === ts13.SyntaxKind.FalseKeyword || ts13.isIdentifier(e) && e.text === "undefined" && !isNameBound("undefined", makeBindingEnv(ctx));
10491
10537
  }
10492
10538
  function transformText(node, ctx) {
10493
10539
  const text = node.text.replace(/\s+/g, " ");
@@ -10513,7 +10559,7 @@ function transformExpressionInner(expr, ctx, node, isClientOnly) {
10513
10559
  return null;
10514
10560
  }
10515
10561
  checkBareSignalOrMemoIdentifier(expr, ctx);
10516
- if (ts12.isIdentifier(expr)) {
10562
+ if (ts13.isIdentifier(expr)) {
10517
10563
  const jsxNode = ctx.analyzer.jsxConstants.get(expr.text);
10518
10564
  if (jsxNode) {
10519
10565
  return transformNode(jsxNode, ctx);
@@ -10792,38 +10838,38 @@ function transformLogicalAnd(node, ctx) {
10792
10838
  };
10793
10839
  }
10794
10840
  function containsJsxInExpression(node) {
10795
- if (ts12.isJsxElement(node) || ts12.isJsxSelfClosingElement(node) || ts12.isJsxFragment(node)) {
10841
+ if (ts13.isJsxElement(node) || ts13.isJsxSelfClosingElement(node) || ts13.isJsxFragment(node)) {
10796
10842
  return true;
10797
10843
  }
10798
- return ts12.forEachChild(node, containsJsxInExpression) ?? false;
10844
+ return ts13.forEachChild(node, containsJsxInExpression) ?? false;
10799
10845
  }
10800
10846
  function callsJsxHelper(node, ctx) {
10801
10847
  let found = false;
10802
10848
  const visit2 = (n) => {
10803
10849
  if (found)
10804
10850
  return;
10805
- if (ts12.isCallExpression(n) && ts12.isIdentifier(n.expression)) {
10851
+ if (ts13.isCallExpression(n) && ts13.isIdentifier(n.expression)) {
10806
10852
  const name = n.expression.text;
10807
10853
  if (ctx.analyzer.jsxFunctions.has(name) || ctx.analyzer.jsxMultiReturnFunctions.has(name)) {
10808
10854
  found = true;
10809
10855
  return;
10810
10856
  }
10811
10857
  }
10812
- ts12.forEachChild(n, visit2);
10858
+ ts13.forEachChild(n, visit2);
10813
10859
  };
10814
10860
  visit2(node);
10815
10861
  return found;
10816
10862
  }
10817
10863
  function containsAwaitExpression(node) {
10818
- if (ts12.isAwaitExpression(node))
10864
+ if (ts13.isAwaitExpression(node))
10819
10865
  return true;
10820
- if (ts12.isFunctionDeclaration(node) || ts12.isFunctionExpression(node) || ts12.isArrowFunction(node))
10866
+ if (ts13.isFunctionDeclaration(node) || ts13.isFunctionExpression(node) || ts13.isArrowFunction(node))
10821
10867
  return false;
10822
- return ts12.forEachChild(node, containsAwaitExpression) ?? false;
10868
+ return ts13.forEachChild(node, containsAwaitExpression) ?? false;
10823
10869
  }
10824
10870
  function transformNullishCoalescing(node, ctx) {
10825
10871
  const leftText = ctx.getJS(node.left);
10826
- const isNullish = node.operatorToken.kind === ts12.SyntaxKind.QuestionQuestionToken;
10872
+ const isNullish = node.operatorToken.kind === ts13.SyntaxKind.QuestionQuestionToken;
10827
10873
  const condition = isNullish ? `${leftText} != null` : leftText;
10828
10874
  const leftOrigin = {
10829
10875
  phase: "tick",
@@ -10869,36 +10915,36 @@ function transformNullishCoalescing(node, ctx) {
10869
10915
  }
10870
10916
  function assertNever2(expr) {
10871
10917
  const kind = expr?.kind;
10872
- throw new Error(`transformJsxExpression: unhandled ts.SyntaxKind ${kind !== undefined ? ts12.SyntaxKind[kind] : "unknown"} ` + `(kind=${kind}). Update spec/compiler.md Appendix A and the switch in jsx-to-ir.ts.`);
10918
+ throw new Error(`transformJsxExpression: unhandled ts.SyntaxKind ${kind !== undefined ? ts13.SyntaxKind[kind] : "unknown"} ` + `(kind=${kind}). Update spec/compiler.md Appendix A and the switch in jsx-to-ir.ts.`);
10873
10919
  }
10874
10920
  function transformJsxExpression(expr, ctx, isClientOnly = false) {
10875
10921
  const node = expr;
10876
10922
  switch (node.kind) {
10877
- case ts12.SyntaxKind.ParenthesizedExpression:
10878
- case ts12.SyntaxKind.AsExpression:
10879
- case ts12.SyntaxKind.SatisfiesExpression:
10880
- case ts12.SyntaxKind.NonNullExpression:
10881
- case ts12.SyntaxKind.TypeAssertionExpression:
10882
- case ts12.SyntaxKind.PartiallyEmittedExpression:
10923
+ case ts13.SyntaxKind.ParenthesizedExpression:
10924
+ case ts13.SyntaxKind.AsExpression:
10925
+ case ts13.SyntaxKind.SatisfiesExpression:
10926
+ case ts13.SyntaxKind.NonNullExpression:
10927
+ case ts13.SyntaxKind.TypeAssertionExpression:
10928
+ case ts13.SyntaxKind.PartiallyEmittedExpression:
10883
10929
  return transformJsxExpression(node.expression, ctx, isClientOnly);
10884
- case ts12.SyntaxKind.JsxElement:
10930
+ case ts13.SyntaxKind.JsxElement:
10885
10931
  return transformJsxElement(node, ctx);
10886
- case ts12.SyntaxKind.JsxFragment:
10932
+ case ts13.SyntaxKind.JsxFragment:
10887
10933
  return transformFragment(node, ctx);
10888
- case ts12.SyntaxKind.JsxSelfClosingElement:
10934
+ case ts13.SyntaxKind.JsxSelfClosingElement:
10889
10935
  return transformSelfClosingElement(node, ctx);
10890
- case ts12.SyntaxKind.ConditionalExpression:
10936
+ case ts13.SyntaxKind.ConditionalExpression:
10891
10937
  return transformConditional(node, ctx);
10892
- case ts12.SyntaxKind.BinaryExpression: {
10893
- if (node.operatorToken.kind === ts12.SyntaxKind.AmpersandAmpersandToken) {
10938
+ case ts13.SyntaxKind.BinaryExpression: {
10939
+ if (node.operatorToken.kind === ts13.SyntaxKind.AmpersandAmpersandToken) {
10894
10940
  return transformLogicalAnd(node, ctx);
10895
10941
  }
10896
- if ((node.operatorToken.kind === ts12.SyntaxKind.QuestionQuestionToken || node.operatorToken.kind === ts12.SyntaxKind.BarBarToken) && (containsJsxInExpression(node.right) || callsJsxHelper(node.right, ctx))) {
10942
+ if ((node.operatorToken.kind === ts13.SyntaxKind.QuestionQuestionToken || node.operatorToken.kind === ts13.SyntaxKind.BarBarToken) && (containsJsxInExpression(node.right) || callsJsxHelper(node.right, ctx))) {
10897
10943
  return transformNullishCoalescing(node, ctx);
10898
10944
  }
10899
10945
  return null;
10900
10946
  }
10901
- case ts12.SyntaxKind.CallExpression: {
10947
+ case ts13.SyntaxKind.CallExpression: {
10902
10948
  const mapMethod = getMapLikeMethod(node);
10903
10949
  if (mapMethod) {
10904
10950
  const mapResult = transformMapCall(node, ctx, isClientOnly, mapMethod);
@@ -10906,7 +10952,7 @@ function transformJsxExpression(expr, ctx, isClientOnly = false) {
10906
10952
  return mapResult;
10907
10953
  }
10908
10954
  const callee = node.expression;
10909
- if (ts12.isIdentifier(callee)) {
10955
+ if (ts13.isIdentifier(callee)) {
10910
10956
  const jsxFunc = ctx.analyzer.jsxFunctions.get(callee.text);
10911
10957
  if (jsxFunc) {
10912
10958
  return transformJsxFunctionCall(node, jsxFunc, ctx, isClientOnly);
@@ -10918,39 +10964,39 @@ function transformJsxExpression(expr, ctx, isClientOnly = false) {
10918
10964
  }
10919
10965
  return null;
10920
10966
  }
10921
- case ts12.SyntaxKind.Identifier:
10922
- case ts12.SyntaxKind.StringLiteral:
10923
- case ts12.SyntaxKind.NumericLiteral:
10924
- case ts12.SyntaxKind.BigIntLiteral:
10925
- case ts12.SyntaxKind.RegularExpressionLiteral:
10926
- case ts12.SyntaxKind.NoSubstitutionTemplateLiteral:
10927
- case ts12.SyntaxKind.TemplateExpression:
10928
- case ts12.SyntaxKind.TaggedTemplateExpression:
10929
- case ts12.SyntaxKind.TrueKeyword:
10930
- case ts12.SyntaxKind.FalseKeyword:
10931
- case ts12.SyntaxKind.NullKeyword:
10932
- case ts12.SyntaxKind.ThisKeyword:
10933
- case ts12.SyntaxKind.SuperKeyword:
10934
- case ts12.SyntaxKind.ImportKeyword:
10935
- case ts12.SyntaxKind.PropertyAccessExpression:
10936
- case ts12.SyntaxKind.ElementAccessExpression:
10937
- case ts12.SyntaxKind.PrefixUnaryExpression:
10938
- case ts12.SyntaxKind.PostfixUnaryExpression:
10939
- case ts12.SyntaxKind.TypeOfExpression:
10940
- case ts12.SyntaxKind.VoidExpression:
10941
- case ts12.SyntaxKind.DeleteExpression:
10942
- case ts12.SyntaxKind.NewExpression:
10943
- case ts12.SyntaxKind.ObjectLiteralExpression:
10944
- case ts12.SyntaxKind.ArrowFunction:
10945
- case ts12.SyntaxKind.FunctionExpression:
10946
- case ts12.SyntaxKind.ClassExpression:
10947
- case ts12.SyntaxKind.MetaProperty:
10948
- case ts12.SyntaxKind.ExpressionWithTypeArguments:
10949
- case ts12.SyntaxKind.CommaListExpression:
10950
- case ts12.SyntaxKind.SyntheticExpression:
10951
- case ts12.SyntaxKind.ArrayLiteralExpression:
10967
+ case ts13.SyntaxKind.Identifier:
10968
+ case ts13.SyntaxKind.StringLiteral:
10969
+ case ts13.SyntaxKind.NumericLiteral:
10970
+ case ts13.SyntaxKind.BigIntLiteral:
10971
+ case ts13.SyntaxKind.RegularExpressionLiteral:
10972
+ case ts13.SyntaxKind.NoSubstitutionTemplateLiteral:
10973
+ case ts13.SyntaxKind.TemplateExpression:
10974
+ case ts13.SyntaxKind.TaggedTemplateExpression:
10975
+ case ts13.SyntaxKind.TrueKeyword:
10976
+ case ts13.SyntaxKind.FalseKeyword:
10977
+ case ts13.SyntaxKind.NullKeyword:
10978
+ case ts13.SyntaxKind.ThisKeyword:
10979
+ case ts13.SyntaxKind.SuperKeyword:
10980
+ case ts13.SyntaxKind.ImportKeyword:
10981
+ case ts13.SyntaxKind.PropertyAccessExpression:
10982
+ case ts13.SyntaxKind.ElementAccessExpression:
10983
+ case ts13.SyntaxKind.PrefixUnaryExpression:
10984
+ case ts13.SyntaxKind.PostfixUnaryExpression:
10985
+ case ts13.SyntaxKind.TypeOfExpression:
10986
+ case ts13.SyntaxKind.VoidExpression:
10987
+ case ts13.SyntaxKind.DeleteExpression:
10988
+ case ts13.SyntaxKind.NewExpression:
10989
+ case ts13.SyntaxKind.ObjectLiteralExpression:
10990
+ case ts13.SyntaxKind.ArrowFunction:
10991
+ case ts13.SyntaxKind.FunctionExpression:
10992
+ case ts13.SyntaxKind.ClassExpression:
10993
+ case ts13.SyntaxKind.MetaProperty:
10994
+ case ts13.SyntaxKind.ExpressionWithTypeArguments:
10995
+ case ts13.SyntaxKind.CommaListExpression:
10996
+ case ts13.SyntaxKind.SyntheticExpression:
10997
+ case ts13.SyntaxKind.ArrayLiteralExpression:
10952
10998
  return null;
10953
- case ts12.SyntaxKind.AwaitExpression:
10999
+ case ts13.SyntaxKind.AwaitExpression:
10954
11000
  ctx.analyzer.errors.push(createError(ErrorCodes.STAGE_AWAIT_IN_TEMPLATE, getSourceLocation(node, ctx.sourceFile, ctx.filePath)));
10955
11001
  return {
10956
11002
  type: "expression",
@@ -10961,16 +11007,16 @@ function transformJsxExpression(expr, ctx, isClientOnly = false) {
10961
11007
  loc: getSourceLocation(node, ctx.sourceFile, ctx.filePath),
10962
11008
  origin: { phase: "tick", scope: "template", effect: "pure", freeRefs: [] }
10963
11009
  };
10964
- case ts12.SyntaxKind.YieldExpression:
11010
+ case ts13.SyntaxKind.YieldExpression:
10965
11011
  return null;
10966
- case ts12.SyntaxKind.SpreadElement:
10967
- case ts12.SyntaxKind.OmittedExpression:
10968
- case ts12.SyntaxKind.JsxExpression:
10969
- case ts12.SyntaxKind.JsxOpeningElement:
10970
- case ts12.SyntaxKind.JsxOpeningFragment:
10971
- case ts12.SyntaxKind.JsxClosingFragment:
10972
- case ts12.SyntaxKind.JsxAttributes:
10973
- case ts12.SyntaxKind.MissingDeclaration:
11012
+ case ts13.SyntaxKind.SpreadElement:
11013
+ case ts13.SyntaxKind.OmittedExpression:
11014
+ case ts13.SyntaxKind.JsxExpression:
11015
+ case ts13.SyntaxKind.JsxOpeningElement:
11016
+ case ts13.SyntaxKind.JsxOpeningFragment:
11017
+ case ts13.SyntaxKind.JsxClosingFragment:
11018
+ case ts13.SyntaxKind.JsxAttributes:
11019
+ case ts13.SyntaxKind.MissingDeclaration:
10974
11020
  return null;
10975
11021
  default:
10976
11022
  return assertNever2(node);
@@ -11007,7 +11053,7 @@ function transformConditionalBranch(node, ctx) {
11007
11053
  };
11008
11054
  }
11009
11055
  function getMapLikeMethod(node) {
11010
- if (!ts12.isPropertyAccessExpression(node.expression))
11056
+ if (!ts13.isPropertyAccessExpression(node.expression))
11011
11057
  return null;
11012
11058
  const name = node.expression.name.text;
11013
11059
  if (name === "map")
@@ -11017,9 +11063,9 @@ function getMapLikeMethod(node) {
11017
11063
  return null;
11018
11064
  }
11019
11065
  function isFilterCall(node) {
11020
- if (!ts12.isCallExpression(node))
11066
+ if (!ts13.isCallExpression(node))
11021
11067
  return null;
11022
- if (!ts12.isPropertyAccessExpression(node.expression))
11068
+ if (!ts13.isPropertyAccessExpression(node.expression))
11023
11069
  return null;
11024
11070
  if (node.expression.name.text !== "filter")
11025
11071
  return null;
@@ -11031,9 +11077,9 @@ function isFilterCall(node) {
11031
11077
  };
11032
11078
  }
11033
11079
  function isSortCall(node) {
11034
- if (!ts12.isCallExpression(node))
11080
+ if (!ts13.isCallExpression(node))
11035
11081
  return null;
11036
- if (!ts12.isPropertyAccessExpression(node.expression))
11082
+ if (!ts13.isPropertyAccessExpression(node.expression))
11037
11083
  return null;
11038
11084
  const methodName = node.expression.name.text;
11039
11085
  if (methodName !== "sort" && methodName !== "toSorted")
@@ -11047,9 +11093,9 @@ function isSortCall(node) {
11047
11093
  };
11048
11094
  }
11049
11095
  function isIteratorShapeCall(node) {
11050
- if (!ts12.isCallExpression(node))
11096
+ if (!ts13.isCallExpression(node))
11051
11097
  return null;
11052
- if (!ts12.isPropertyAccessExpression(node.expression))
11098
+ if (!ts13.isPropertyAccessExpression(node.expression))
11053
11099
  return null;
11054
11100
  if (node.arguments.length !== 0)
11055
11101
  return null;
@@ -11059,11 +11105,11 @@ function isIteratorShapeCall(node) {
11059
11105
  return { array: node.expression.expression, shape: name };
11060
11106
  }
11061
11107
  function isObjectIteratorCall(node) {
11062
- if (!ts12.isCallExpression(node))
11108
+ if (!ts13.isCallExpression(node))
11063
11109
  return null;
11064
- if (!ts12.isPropertyAccessExpression(node.expression))
11110
+ if (!ts13.isPropertyAccessExpression(node.expression))
11065
11111
  return null;
11066
- if (!ts12.isIdentifier(node.expression.expression))
11112
+ if (!ts13.isIdentifier(node.expression.expression))
11067
11113
  return null;
11068
11114
  if (node.expression.expression.text !== "Object")
11069
11115
  return null;
@@ -11088,7 +11134,7 @@ function extractSortComparator(callback, _method, ctx) {
11088
11134
  ` + `(reverse the operands for descending order).`
11089
11135
  });
11090
11136
  let resolvedNode = callback;
11091
- if (ts12.isIdentifier(callback)) {
11137
+ if (ts13.isIdentifier(callback)) {
11092
11138
  const resolved = resolveSortComparatorIdentifier(callback.text, ctx);
11093
11139
  if (!resolved) {
11094
11140
  return {
@@ -11098,7 +11144,7 @@ function extractSortComparator(callback, _method, ctx) {
11098
11144
  }
11099
11145
  resolvedNode = resolved;
11100
11146
  }
11101
- if (!ts12.isArrowFunction(resolvedNode) && !ts12.isFunctionExpression(resolvedNode)) {
11147
+ if (!ts13.isArrowFunction(resolvedNode) && !ts13.isFunctionExpression(resolvedNode)) {
11102
11148
  return {
11103
11149
  result: null,
11104
11150
  unsupportedReason: "Sort comparator must be an arrow function or function expression"
@@ -11125,11 +11171,11 @@ function resolveSortComparatorIdentifier(name, ctx) {
11125
11171
  return null;
11126
11172
  if (constInfo) {
11127
11173
  const ast = parseConstInitializer(constInfo);
11128
- return ast && (ts12.isArrowFunction(ast) || ts12.isFunctionExpression(ast)) ? ast : null;
11174
+ return ast && (ts13.isArrowFunction(ast) || ts13.isFunctionExpression(ast)) ? ast : null;
11129
11175
  }
11130
11176
  if (fnInfo) {
11131
11177
  const ast = parseFunctionInfoAsExpr(fnInfo);
11132
- return ast && (ts12.isArrowFunction(ast) || ts12.isFunctionExpression(ast)) ? ast : null;
11178
+ return ast && (ts13.isArrowFunction(ast) || ts13.isFunctionExpression(ast)) ? ast : null;
11133
11179
  }
11134
11180
  return null;
11135
11181
  }
@@ -11140,11 +11186,11 @@ function resolveCallbackMethodFunctionReferenceIdentifier(name, analyzer) {
11140
11186
  return null;
11141
11187
  if (constInfo) {
11142
11188
  const ast = parseConstInitializer(constInfo);
11143
- return ast && (ts12.isArrowFunction(ast) || ts12.isFunctionExpression(ast)) ? ast : null;
11189
+ return ast && (ts13.isArrowFunction(ast) || ts13.isFunctionExpression(ast)) ? ast : null;
11144
11190
  }
11145
11191
  if (fnInfo) {
11146
11192
  const ast = parseFunctionInfoAsExpr(fnInfo);
11147
- return ast && (ts12.isArrowFunction(ast) || ts12.isFunctionExpression(ast)) ? ast : null;
11193
+ return ast && (ts13.isArrowFunction(ast) || ts13.isFunctionExpression(ast)) ? ast : null;
11148
11194
  }
11149
11195
  return null;
11150
11196
  }
@@ -11200,13 +11246,13 @@ function resolveCallbackMethodFunctionReferences(expr, analyzer, bound = EMPTY_B
11200
11246
  return visit2(expr, bound);
11201
11247
  }
11202
11248
  function extractFilterPredicate(callback, ctx) {
11203
- if (!ts12.isArrowFunction(callback))
11249
+ if (!ts13.isArrowFunction(callback))
11204
11250
  return { result: null };
11205
11251
  if (callback.parameters.length < 1)
11206
11252
  return { result: null };
11207
11253
  const firstParam = callback.parameters[0];
11208
- if (!ts12.isIdentifier(firstParam.name)) {
11209
- if (ts12.isBlock(callback.body)) {
11254
+ if (!ts13.isIdentifier(firstParam.name)) {
11255
+ if (ts13.isBlock(callback.body)) {
11210
11256
  return {
11211
11257
  result: null,
11212
11258
  unsupportedReason: "Block body in a destructured filter param is not supported. Workaround: use an expression-body arrow, or add /* @client */."
@@ -11226,7 +11272,7 @@ function extractFilterPredicate(callback, ctx) {
11226
11272
  return { result: null };
11227
11273
  }
11228
11274
  const param = firstParam.name.getText(ctx.sourceFile);
11229
- if (ts12.isBlock(callback.body)) {
11275
+ if (ts13.isBlock(callback.body)) {
11230
11276
  const raw2 = ctx.getJS(callback.body);
11231
11277
  const statements = parseBlockBody(callback.body, ctx.sourceFile, (n) => ctx.getJS(n));
11232
11278
  if (!statements) {
@@ -11252,7 +11298,7 @@ function extractFilterPredicate(callback, ctx) {
11252
11298
  return { result: { param, predicate, raw } };
11253
11299
  }
11254
11300
  function extractLoopParamBindings(pattern) {
11255
- if (ts12.isIdentifier(pattern))
11301
+ if (ts13.isIdentifier(pattern))
11256
11302
  return null;
11257
11303
  const bindings = [];
11258
11304
  let unsupported = false;
@@ -11261,7 +11307,7 @@ function extractLoopParamBindings(pattern) {
11261
11307
  return false;
11262
11308
  for (let i = 0;i < key.length; ) {
11263
11309
  const cp = key.codePointAt(i);
11264
- const ok = i === 0 ? ts12.isIdentifierStart(cp, ts12.ScriptTarget.Latest) : ts12.isIdentifierPart(cp, ts12.ScriptTarget.Latest);
11310
+ const ok = i === 0 ? ts13.isIdentifierStart(cp, ts13.ScriptTarget.Latest) : ts13.isIdentifierPart(cp, ts13.ScriptTarget.Latest);
11265
11311
  if (!ok)
11266
11312
  return false;
11267
11313
  i += cp > 65535 ? 2 : 1;
@@ -11274,17 +11320,17 @@ function extractLoopParamBindings(pattern) {
11274
11320
  const walk = (p, prefix, segments) => {
11275
11321
  if (unsupported)
11276
11322
  return;
11277
- if (ts12.isArrayBindingPattern(p)) {
11323
+ if (ts13.isArrayBindingPattern(p)) {
11278
11324
  const elements2 = p.elements;
11279
11325
  for (let index = 0;index < elements2.length; index++) {
11280
11326
  if (unsupported)
11281
11327
  return;
11282
11328
  const el = elements2[index];
11283
- if (ts12.isOmittedExpression(el))
11329
+ if (ts13.isOmittedExpression(el))
11284
11330
  continue;
11285
11331
  if (el.dotDotDotToken) {
11286
11332
  internalInvariant(index === elements2.length - 1, "extractLoopParamBindings: array rest token in non-final position (parser should reject)");
11287
- internalInvariant(ts12.isIdentifier(el.name), "extractLoopParamBindings: array rest target is not an identifier (parser should reject)");
11333
+ internalInvariant(ts13.isIdentifier(el.name), "extractLoopParamBindings: array rest target is not an identifier (parser should reject)");
11288
11334
  bindings.push({
11289
11335
  name: el.name.text,
11290
11336
  path: prefix,
@@ -11295,7 +11341,7 @@ function extractLoopParamBindings(pattern) {
11295
11341
  }
11296
11342
  const path3 = `${prefix}[${index}]`;
11297
11343
  const nextSegments = [...segments, { kind: "index", index }];
11298
- if (ts12.isIdentifier(el.name)) {
11344
+ if (ts13.isIdentifier(el.name)) {
11299
11345
  bindings.push({ name: el.name.text, path: path3, segments: nextSegments });
11300
11346
  } else {
11301
11347
  walk(el.name, path3, nextSegments);
@@ -11311,7 +11357,7 @@ function extractLoopParamBindings(pattern) {
11311
11357
  const el = elements[i];
11312
11358
  if (el.dotDotDotToken) {
11313
11359
  internalInvariant(i === elements.length - 1, "extractLoopParamBindings: object rest token in non-final position (parser should reject)");
11314
- internalInvariant(ts12.isIdentifier(el.name), "extractLoopParamBindings: object rest target is not an identifier (parser should reject)");
11360
+ internalInvariant(ts13.isIdentifier(el.name), "extractLoopParamBindings: object rest target is not an identifier (parser should reject)");
11315
11361
  bindings.push({
11316
11362
  name: el.name.text,
11317
11363
  path: prefix,
@@ -11323,17 +11369,17 @@ function extractLoopParamBindings(pattern) {
11323
11369
  let keyText = null;
11324
11370
  if (el.propertyName) {
11325
11371
  const pn = el.propertyName;
11326
- if (ts12.isIdentifier(pn))
11372
+ if (ts13.isIdentifier(pn))
11327
11373
  keyText = pn.text;
11328
- else if (ts12.isStringLiteral(pn))
11374
+ else if (ts13.isStringLiteral(pn))
11329
11375
  keyText = pn.text;
11330
- else if (ts12.isNumericLiteral(pn))
11376
+ else if (ts13.isNumericLiteral(pn))
11331
11377
  keyText = pn.text;
11332
11378
  else {
11333
11379
  unsupported = true;
11334
11380
  return;
11335
11381
  }
11336
- } else if (ts12.isIdentifier(el.name)) {
11382
+ } else if (ts13.isIdentifier(el.name)) {
11337
11383
  keyText = el.name.text;
11338
11384
  } else {
11339
11385
  unsupported = true;
@@ -11343,14 +11389,14 @@ function extractLoopParamBindings(pattern) {
11343
11389
  collectedKeys.push({ key: keyText, isIdent: keyIsIdent });
11344
11390
  const path3 = appendDotAccess(prefix, keyText);
11345
11391
  const nextSegments = [...segments, { kind: "field", key: keyText, isIdent: keyIsIdent }];
11346
- if (ts12.isIdentifier(el.name)) {
11392
+ if (ts13.isIdentifier(el.name)) {
11347
11393
  bindings.push({ name: el.name.text, path: path3, segments: nextSegments });
11348
11394
  } else {
11349
11395
  walk(el.name, path3, nextSegments);
11350
11396
  }
11351
11397
  }
11352
11398
  };
11353
- if (ts12.isArrayBindingPattern(pattern) || ts12.isObjectBindingPattern(pattern)) {
11399
+ if (ts13.isArrayBindingPattern(pattern) || ts13.isObjectBindingPattern(pattern)) {
11354
11400
  walk(pattern, "", []);
11355
11401
  if (unsupported)
11356
11402
  return { unsupported: true };
@@ -11360,7 +11406,7 @@ function extractLoopParamBindings(pattern) {
11360
11406
  }
11361
11407
  function findKeyJsxAttribute(opening) {
11362
11408
  for (const prop of opening.attributes.properties) {
11363
- if (ts12.isJsxAttribute(prop) && prop.name.getText() === "key") {
11409
+ if (ts13.isJsxAttribute(prop) && prop.name.getText() === "key") {
11364
11410
  return prop;
11365
11411
  }
11366
11412
  }
@@ -11405,7 +11451,7 @@ function keyAttrValueToExpr(v) {
11405
11451
  function normalizeKeyExpr(expr) {
11406
11452
  let out = "";
11407
11453
  for (const tok of iterateJsTokens(expr)) {
11408
- if (tok.kind === ts12.SyntaxKind.WhitespaceTrivia || tok.kind === ts12.SyntaxKind.NewLineTrivia) {
11454
+ if (tok.kind === ts13.SyntaxKind.WhitespaceTrivia || tok.kind === ts13.SyntaxKind.NewLineTrivia) {
11409
11455
  continue;
11410
11456
  }
11411
11457
  out += expr.slice(tok.pos, tok.end);
@@ -11417,13 +11463,13 @@ function conditionalHasExplicitNullishBranch(cond) {
11417
11463
  }
11418
11464
  function branchHasExplicitNullish(branch) {
11419
11465
  let b = branch;
11420
- while (ts12.isParenthesizedExpression(b))
11466
+ while (ts13.isParenthesizedExpression(b))
11421
11467
  b = b.expression;
11422
- if (b.kind === ts12.SyntaxKind.NullKeyword)
11468
+ if (b.kind === ts13.SyntaxKind.NullKeyword)
11423
11469
  return true;
11424
- if (ts12.isIdentifier(b) && b.text === "undefined")
11470
+ if (ts13.isIdentifier(b) && b.text === "undefined")
11425
11471
  return true;
11426
- if (ts12.isConditionalExpression(b))
11472
+ if (ts13.isConditionalExpression(b))
11427
11473
  return conditionalHasExplicitNullishBranch(b);
11428
11474
  return false;
11429
11475
  }
@@ -11432,26 +11478,26 @@ function classifyKeyProblem(keyAttr, checker) {
11432
11478
  return "missing";
11433
11479
  if (!keyAttr.initializer)
11434
11480
  return "missing";
11435
- if (ts12.isJsxExpression(keyAttr.initializer) && !keyAttr.initializer.expression) {
11481
+ if (ts13.isJsxExpression(keyAttr.initializer) && !keyAttr.initializer.expression) {
11436
11482
  return "missing";
11437
11483
  }
11438
11484
  let expr;
11439
- if (ts12.isStringLiteral(keyAttr.initializer)) {
11485
+ if (ts13.isStringLiteral(keyAttr.initializer)) {
11440
11486
  return null;
11441
- } else if (ts12.isJsxExpression(keyAttr.initializer)) {
11487
+ } else if (ts13.isJsxExpression(keyAttr.initializer)) {
11442
11488
  expr = keyAttr.initializer.expression;
11443
11489
  }
11444
11490
  if (!expr)
11445
11491
  return null;
11446
- if (expr.kind === ts12.SyntaxKind.NullKeyword)
11492
+ if (expr.kind === ts13.SyntaxKind.NullKeyword)
11447
11493
  return null;
11448
- if (ts12.isIdentifier(expr) && expr.text === "undefined")
11494
+ if (ts13.isIdentifier(expr) && expr.text === "undefined")
11449
11495
  return null;
11450
- if (ts12.isConditionalExpression(expr) && conditionalHasExplicitNullishBranch(expr))
11496
+ if (ts13.isConditionalExpression(expr) && conditionalHasExplicitNullishBranch(expr))
11451
11497
  return null;
11452
11498
  if (checker) {
11453
11499
  const type = checker.getTypeAtLocation(expr);
11454
- const isNullable = type.isUnion() ? type.types.some((t) => (t.flags & (ts12.TypeFlags.Null | ts12.TypeFlags.Undefined | ts12.TypeFlags.Void)) !== 0) : (type.flags & (ts12.TypeFlags.Null | ts12.TypeFlags.Undefined | ts12.TypeFlags.Void)) !== 0;
11500
+ const isNullable = type.isUnion() ? type.types.some((t) => (t.flags & (ts13.TypeFlags.Null | ts13.TypeFlags.Undefined | ts13.TypeFlags.Void)) !== 0) : (type.flags & (ts13.TypeFlags.Null | ts13.TypeFlags.Undefined | ts13.TypeFlags.Void)) !== 0;
11455
11501
  if (isNullable)
11456
11502
  return "nullable-type";
11457
11503
  }
@@ -11477,81 +11523,81 @@ function checkLoopKey(callback, ctx, isNested) {
11477
11523
  ctx.analyzer.errors.push(createError(errorCode, getSourceLocation(locNode, ctx.sourceFile, ctx.filePath), { suggestion: { message: keyErrorSuggestion(problem) } }));
11478
11524
  }
11479
11525
  let body = callback.body;
11480
- if (ts12.isBlock(body)) {
11481
- const ret = body.statements.find((s) => ts12.isReturnStatement(s) && s.expression != null);
11526
+ if (ts13.isBlock(body)) {
11527
+ const ret = body.statements.find((s) => ts13.isReturnStatement(s) && s.expression != null);
11482
11528
  if (!ret?.expression)
11483
11529
  return;
11484
11530
  body = ret.expression;
11485
11531
  }
11486
- while (ts12.isParenthesizedExpression(body))
11532
+ while (ts13.isParenthesizedExpression(body))
11487
11533
  body = body.expression;
11488
11534
  function checkJsxOperand(node) {
11489
11535
  let n = node;
11490
- while (ts12.isParenthesizedExpression(n))
11536
+ while (ts13.isParenthesizedExpression(n))
11491
11537
  n = n.expression;
11492
- if (ts12.isJsxElement(n))
11538
+ if (ts13.isJsxElement(n))
11493
11539
  checkOpening(n.openingElement);
11494
- else if (ts12.isJsxSelfClosingElement(n))
11540
+ else if (ts13.isJsxSelfClosingElement(n))
11495
11541
  checkOpening(n);
11496
11542
  }
11497
- if (ts12.isConditionalExpression(body)) {
11543
+ if (ts13.isConditionalExpression(body)) {
11498
11544
  checkJsxOperand(body.whenTrue);
11499
11545
  checkJsxOperand(body.whenFalse);
11500
11546
  return;
11501
11547
  }
11502
- if (ts12.isBinaryExpression(body) && (body.operatorToken.kind === ts12.SyntaxKind.AmpersandAmpersandToken || body.operatorToken.kind === ts12.SyntaxKind.BarBarToken || body.operatorToken.kind === ts12.SyntaxKind.QuestionQuestionToken)) {
11548
+ if (ts13.isBinaryExpression(body) && (body.operatorToken.kind === ts13.SyntaxKind.AmpersandAmpersandToken || body.operatorToken.kind === ts13.SyntaxKind.BarBarToken || body.operatorToken.kind === ts13.SyntaxKind.QuestionQuestionToken)) {
11503
11549
  checkJsxOperand(body.left);
11504
11550
  checkJsxOperand(body.right);
11505
11551
  return;
11506
11552
  }
11507
- if (ts12.isJsxElement(body)) {
11553
+ if (ts13.isJsxElement(body)) {
11508
11554
  checkOpening(body.openingElement);
11509
11555
  return;
11510
11556
  }
11511
- if (ts12.isJsxSelfClosingElement(body)) {
11557
+ if (ts13.isJsxSelfClosingElement(body)) {
11512
11558
  checkOpening(body);
11513
11559
  return;
11514
11560
  }
11515
11561
  }
11516
11562
  function flatMapProjectionCall(body) {
11517
11563
  let expr;
11518
- if (ts12.isBlock(body)) {
11564
+ if (ts13.isBlock(body)) {
11519
11565
  const real = body.statements;
11520
- if (real.length !== 1 || !ts12.isReturnStatement(real[0]) || !real[0].expression)
11566
+ if (real.length !== 1 || !ts13.isReturnStatement(real[0]) || !real[0].expression)
11521
11567
  return null;
11522
11568
  expr = real[0].expression;
11523
11569
  } else {
11524
11570
  expr = body;
11525
11571
  }
11526
- while (ts12.isParenthesizedExpression(expr))
11572
+ while (ts13.isParenthesizedExpression(expr))
11527
11573
  expr = expr.expression;
11528
- if (!ts12.isCallExpression(expr))
11574
+ if (!ts13.isCallExpression(expr))
11529
11575
  return null;
11530
11576
  if (!getMapLikeMethod(expr))
11531
11577
  return null;
11532
11578
  const cb = expr.arguments[0];
11533
- if (!cb || !ts12.isArrowFunction(cb) && !ts12.isFunctionExpression(cb))
11579
+ if (!cb || !ts13.isArrowFunction(cb) && !ts13.isFunctionExpression(cb))
11534
11580
  return null;
11535
11581
  for (const p of cb.parameters) {
11536
- if (!ts12.isIdentifier(p.name))
11582
+ if (!ts13.isIdentifier(p.name))
11537
11583
  return null;
11538
11584
  }
11539
11585
  let innerBody = cb.body;
11540
- if (ts12.isBlock(innerBody)) {
11541
- const ret = innerBody.statements.find((s) => ts12.isReturnStatement(s) && s.expression != null);
11586
+ if (ts13.isBlock(innerBody)) {
11587
+ const ret = innerBody.statements.find((s) => ts13.isReturnStatement(s) && s.expression != null);
11542
11588
  if (innerBody.statements.length !== 1 || !ret?.expression)
11543
11589
  return null;
11544
11590
  innerBody = ret.expression;
11545
11591
  }
11546
- while (ts12.isParenthesizedExpression(innerBody))
11592
+ while (ts13.isParenthesizedExpression(innerBody))
11547
11593
  innerBody = innerBody.expression;
11548
11594
  const isElementish = (n) => {
11549
11595
  let m = n;
11550
- while (ts12.isParenthesizedExpression(m))
11596
+ while (ts13.isParenthesizedExpression(m))
11551
11597
  m = m.expression;
11552
- if (ts12.isJsxElement(m) || ts12.isJsxSelfClosingElement(m))
11598
+ if (ts13.isJsxElement(m) || ts13.isJsxSelfClosingElement(m))
11553
11599
  return leafIsWirelessElement(m);
11554
- if (ts12.isConditionalExpression(m))
11600
+ if (ts13.isConditionalExpression(m))
11555
11601
  return isElementish(m.whenTrue) && isElementish(m.whenFalse);
11556
11602
  return false;
11557
11603
  };
@@ -11564,19 +11610,19 @@ function leafIsWirelessElement(el) {
11564
11610
  const visit2 = (n) => {
11565
11611
  if (!ok)
11566
11612
  return;
11567
- if (ts12.isJsxOpeningElement(n) || ts12.isJsxSelfClosingElement(n)) {
11613
+ if (ts13.isJsxOpeningElement(n) || ts13.isJsxSelfClosingElement(n)) {
11568
11614
  const tagNode = n.tagName;
11569
- const isIntrinsic = ts12.isIdentifier(tagNode) ? !/^[A-Z]/.test(tagNode.text) : ts12.isJsxNamespacedName(tagNode);
11615
+ const isIntrinsic = ts13.isIdentifier(tagNode) ? !/^[A-Z]/.test(tagNode.text) : ts13.isJsxNamespacedName(tagNode);
11570
11616
  if (!isIntrinsic) {
11571
11617
  ok = false;
11572
11618
  return;
11573
11619
  }
11574
11620
  for (const attr of n.attributes.properties) {
11575
- if (ts12.isJsxSpreadAttribute(attr)) {
11621
+ if (ts13.isJsxSpreadAttribute(attr)) {
11576
11622
  ok = false;
11577
11623
  return;
11578
11624
  }
11579
- if (ts12.isJsxAttribute(attr)) {
11625
+ if (ts13.isJsxAttribute(attr)) {
11580
11626
  const name = attr.name.getText();
11581
11627
  if (/^on[A-Z]/.test(name)) {
11582
11628
  ok = false;
@@ -11585,11 +11631,11 @@ function leafIsWirelessElement(el) {
11585
11631
  }
11586
11632
  }
11587
11633
  }
11588
- if (ts12.isCallExpression(n) && getMapLikeMethod(n) && containsJsxInExpression(n)) {
11634
+ if (ts13.isCallExpression(n) && getMapLikeMethod(n) && containsJsxInExpression(n)) {
11589
11635
  ok = false;
11590
11636
  return;
11591
11637
  }
11592
- ts12.forEachChild(n, visit2);
11638
+ ts13.forEachChild(n, visit2);
11593
11639
  };
11594
11640
  visit2(el);
11595
11641
  return ok;
@@ -11769,7 +11815,7 @@ function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
11769
11815
  let children = [];
11770
11816
  let paramBindings;
11771
11817
  let flatMapCallback;
11772
- if (ts12.isArrowFunction(callback)) {
11818
+ if (ts13.isArrowFunction(callback)) {
11773
11819
  if (callback.parameters.length > 0) {
11774
11820
  const firstParam = callback.parameters[0];
11775
11821
  param = firstParam.name.getText(ctx.sourceFile);
@@ -11777,9 +11823,9 @@ function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
11777
11823
  paramType = firstParam.type.getText(ctx.sourceFile);
11778
11824
  }
11779
11825
  const isEntriesShape = iterationShape === "entries" || objectIteration === "entries";
11780
- if (isEntriesShape && ts12.isArrayBindingPattern(firstParam.name)) {
11781
- const elements = firstParam.name.elements.filter((el) => !ts12.isOmittedExpression(el));
11782
- if (elements.length === 2 && ts12.isBindingElement(elements[0]) && ts12.isIdentifier(elements[0].name) && ts12.isBindingElement(elements[1]) && ts12.isIdentifier(elements[1].name)) {
11826
+ if (isEntriesShape && ts13.isArrayBindingPattern(firstParam.name)) {
11827
+ const elements = firstParam.name.elements.filter((el) => !ts13.isOmittedExpression(el));
11828
+ if (elements.length === 2 && ts13.isBindingElement(elements[0]) && ts13.isIdentifier(elements[0].name) && ts13.isBindingElement(elements[1]) && ts13.isIdentifier(elements[1].name)) {
11783
11829
  index = elements[0].name.text;
11784
11830
  param = elements[1].name.text;
11785
11831
  } else {
@@ -11810,10 +11856,10 @@ function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
11810
11856
  ctx.scope = ctx.scope.enterLoopRow({ param, index, paramBindings });
11811
11857
  ctx.loopDepth++;
11812
11858
  const tryTransformRenderableBody = (expr) => {
11813
- if (!ts12.isBinaryExpression(expr))
11859
+ if (!ts13.isBinaryExpression(expr))
11814
11860
  return;
11815
11861
  const op = expr.operatorToken.kind;
11816
- if (op !== ts12.SyntaxKind.AmpersandAmpersandToken && op !== ts12.SyntaxKind.BarBarToken && op !== ts12.SyntaxKind.QuestionQuestionToken) {
11862
+ if (op !== ts13.SyntaxKind.AmpersandAmpersandToken && op !== ts13.SyntaxKind.BarBarToken && op !== ts13.SyntaxKind.QuestionQuestionToken) {
11817
11863
  return;
11818
11864
  }
11819
11865
  if (!containsJsxInExpression(expr) && !callsJsxHelper(expr, ctx))
@@ -11823,33 +11869,33 @@ function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
11823
11869
  children = [transformed];
11824
11870
  };
11825
11871
  const body = callback.body;
11826
- if (ts12.isJsxElement(body) || ts12.isJsxSelfClosingElement(body) || ts12.isJsxFragment(body)) {
11872
+ if (ts13.isJsxElement(body) || ts13.isJsxSelfClosingElement(body) || ts13.isJsxFragment(body)) {
11827
11873
  const transformed = transformNode(body, ctx);
11828
11874
  if (transformed) {
11829
11875
  children = [transformed];
11830
11876
  }
11831
- } else if (ts12.isConditionalExpression(body)) {
11877
+ } else if (ts13.isConditionalExpression(body)) {
11832
11878
  children = [transformConditional(body, ctx)];
11833
- } else if (ts12.isParenthesizedExpression(body)) {
11879
+ } else if (ts13.isParenthesizedExpression(body)) {
11834
11880
  let inner = body.expression;
11835
- while (ts12.isParenthesizedExpression(inner)) {
11881
+ while (ts13.isParenthesizedExpression(inner)) {
11836
11882
  inner = inner.expression;
11837
11883
  }
11838
- if (ts12.isJsxElement(inner) || ts12.isJsxSelfClosingElement(inner) || ts12.isJsxFragment(inner)) {
11884
+ if (ts13.isJsxElement(inner) || ts13.isJsxSelfClosingElement(inner) || ts13.isJsxFragment(inner)) {
11839
11885
  const transformed = transformNode(inner, ctx);
11840
11886
  if (transformed) {
11841
11887
  children = [transformed];
11842
11888
  }
11843
- } else if (ts12.isConditionalExpression(inner)) {
11889
+ } else if (ts13.isConditionalExpression(inner)) {
11844
11890
  children = [transformConditional(inner, ctx)];
11845
- } else if (method === "flatMap" && ts12.isArrayLiteralExpression(inner)) {
11891
+ } else if (method === "flatMap" && ts13.isArrayLiteralExpression(inner)) {
11846
11892
  children = transformArrayLiteralChildren(inner, ctx);
11847
11893
  } else {
11848
11894
  tryTransformRenderableBody(inner);
11849
11895
  }
11850
- } else if (method === "flatMap" && ts12.isArrayLiteralExpression(body)) {
11896
+ } else if (method === "flatMap" && ts13.isArrayLiteralExpression(body)) {
11851
11897
  children = transformArrayLiteralChildren(body, ctx);
11852
- } else if (ts12.isBlock(body)) {
11898
+ } else if (ts13.isBlock(body)) {
11853
11899
  const multiReturn = method !== "flatMap" ? extractMultiReturnJsxBranches(body, true) : null;
11854
11900
  if (multiReturn && multiReturn.branches.length > 0) {
11855
11901
  const loc = getSourceLocation(body, ctx.sourceFile, ctx.filePath);
@@ -11867,7 +11913,7 @@ function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
11867
11913
  }
11868
11914
  }
11869
11915
  }
11870
- const returnStmt = children.length === 0 ? body.statements.find((s) => ts12.isReturnStatement(s) && s.expression != null) : undefined;
11916
+ const returnStmt = children.length === 0 ? body.statements.find((s) => ts13.isReturnStatement(s) && s.expression != null) : undefined;
11871
11917
  let rowScopeBeforePreamble = null;
11872
11918
  if (returnStmt) {
11873
11919
  const preambleNames = new Set;
@@ -11888,10 +11934,10 @@ function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
11888
11934
  }
11889
11935
  if (returnStmt && returnStmt.expression) {
11890
11936
  let returnExpr = returnStmt.expression;
11891
- while (ts12.isParenthesizedExpression(returnExpr)) {
11937
+ while (ts13.isParenthesizedExpression(returnExpr)) {
11892
11938
  returnExpr = returnExpr.expression;
11893
11939
  }
11894
- if (ts12.isJsxElement(returnExpr) || ts12.isJsxSelfClosingElement(returnExpr) || ts12.isJsxFragment(returnExpr)) {
11940
+ if (ts13.isJsxElement(returnExpr) || ts13.isJsxSelfClosingElement(returnExpr) || ts13.isJsxFragment(returnExpr)) {
11895
11941
  const transformed = transformNode(returnExpr, ctx);
11896
11942
  if (transformed) {
11897
11943
  children = [transformed];
@@ -11973,7 +12019,7 @@ function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
11973
12019
  }
11974
12020
  }
11975
12021
  }
11976
- if (method === "flatMap" && children.length === 0 && !flatMapCallback && !ts12.isBlock(body)) {
12022
+ if (method === "flatMap" && children.length === 0 && !flatMapCallback && !ts13.isBlock(body)) {
11977
12023
  flatMapCallback = buildFlatMapCallback(callback, body, ctx);
11978
12024
  }
11979
12025
  if (flatMapCallback)
@@ -11991,7 +12037,7 @@ function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
11991
12037
  }
11992
12038
  if (children.length === 0 && !flatMapCallback) {
11993
12039
  const cb = node.arguments[0];
11994
- const cbBody = cb && (ts12.isArrowFunction(cb) || ts12.isFunctionExpression(cb)) ? cb.body : undefined;
12040
+ const cbBody = cb && (ts13.isArrowFunction(cb) || ts13.isFunctionExpression(cb)) ? cb.body : undefined;
11995
12041
  if (cbBody && containsJsxInExpression(cbBody) && ctx.analyzer.errors.length === diagCountAtEntry) {
11996
12042
  ctx.analyzer.errors.push(createError(ErrorCodes.UNSUPPORTED_JSX_PATTERN, getSourceLocation(cbBody, ctx.sourceFile, ctx.filePath), {
11997
12043
  message: `A .${method}() callback that builds JSX in this shape cannot be ` + "compiled — the JSX would leak verbatim into the client bundle. " + "Recognized bodies: a JSX element/fragment, a ternary or " + "&& / || / ?? expression, an array literal (flatMap), or a block " + "body whose return the compiler can lower.",
@@ -12002,7 +12048,7 @@ function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
12002
12048
  }
12003
12049
  return null;
12004
12050
  }
12005
- if (ts12.isArrowFunction(node.arguments[0]) && children.length > 0) {
12051
+ if (ts13.isArrowFunction(node.arguments[0]) && children.length > 0) {
12006
12052
  checkLoopKey(node.arguments[0], ctx, isNested);
12007
12053
  }
12008
12054
  const itemConditional = children.length > 0 ? loopBodyItemConditional(children) : null;
@@ -12056,6 +12102,9 @@ function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
12056
12102
  const preambleRegions = preamble && !isStaticArray ? collectPreambleRegions(children, new Set(preamble.declaredNames), ctx) : undefined;
12057
12103
  if (preamble && !isStaticArray) {
12058
12104
  markPreambleAttrSlots(children, new Set(preamble.declaredNames), ctx);
12105
+ if (preamble.reactiveNames && preamble.reactiveNames.length > 0) {
12106
+ markPreambleConditionalReactivity(children, new Set(preamble.reactiveNames), ctx);
12107
+ }
12059
12108
  }
12060
12109
  const nestedComponents = collectNestedComponents(children).filter((c) => c.name !== childComponent?.name);
12061
12110
  return {
@@ -12099,12 +12148,12 @@ function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
12099
12148
  function transformArrayLiteralChildren(arrayLiteral, ctx) {
12100
12149
  const children = [];
12101
12150
  for (const element of arrayLiteral.elements) {
12102
- if (ts12.isSpreadElement(element))
12151
+ if (ts13.isSpreadElement(element))
12103
12152
  continue;
12104
12153
  let inner = element;
12105
- while (ts12.isParenthesizedExpression(inner))
12154
+ while (ts13.isParenthesizedExpression(inner))
12106
12155
  inner = inner.expression;
12107
- if (ts12.isJsxElement(inner) || ts12.isJsxSelfClosingElement(inner) || ts12.isJsxFragment(inner)) {
12156
+ if (ts13.isJsxElement(inner) || ts13.isJsxSelfClosingElement(inner) || ts13.isJsxFragment(inner)) {
12108
12157
  const transformed = transformNode(inner, ctx);
12109
12158
  if (transformed)
12110
12159
  children.push(transformed);
@@ -12113,7 +12162,7 @@ function transformArrayLiteralChildren(arrayLiteral, ctx) {
12113
12162
  return children;
12114
12163
  }
12115
12164
  function containsJsx(node) {
12116
- if (ts12.isJsxElement(node) || ts12.isJsxSelfClosingElement(node) || ts12.isJsxFragment(node))
12165
+ if (ts13.isJsxElement(node) || ts13.isJsxSelfClosingElement(node) || ts13.isJsxFragment(node))
12117
12166
  return true;
12118
12167
  let found = false;
12119
12168
  node.forEachChild((child) => {
@@ -12129,7 +12178,7 @@ function buildFlatMapCallback(callback, body, ctx) {
12129
12178
  const leafIrs = [];
12130
12179
  let refusalNode;
12131
12180
  const collectJsx = (n, underTemplate) => {
12132
- if (ts12.isJsxElement(n) || ts12.isJsxSelfClosingElement(n) || ts12.isJsxFragment(n)) {
12181
+ if (ts13.isJsxElement(n) || ts13.isJsxSelfClosingElement(n) || ts13.isJsxFragment(n)) {
12133
12182
  if (underTemplate)
12134
12183
  refusalNode ??= n;
12135
12184
  leafSpans.push({ start: n.getStart(ctx.sourceFile), end: n.getEnd() });
@@ -12137,7 +12186,7 @@ function buildFlatMapCallback(callback, body, ctx) {
12137
12186
  leafIrs.push(ir ?? { type: "text", value: "", loc: getSourceLocation(n, ctx.sourceFile, ctx.filePath) });
12138
12187
  return;
12139
12188
  }
12140
- const inTemplate = underTemplate || ts12.isTemplateExpression(n) || ts12.isTaggedTemplateExpression(n);
12189
+ const inTemplate = underTemplate || ts13.isTemplateExpression(n) || ts13.isTaggedTemplateExpression(n);
12141
12190
  n.forEachChild((c) => collectJsx(c, inTemplate));
12142
12191
  };
12143
12192
  collectJsx(body, false);
@@ -12313,6 +12362,33 @@ function markPreambleAttrSlots(nodes, declared, ctx) {
12313
12362
  };
12314
12363
  visit2(nodes);
12315
12364
  }
12365
+ function markPreambleConditionalReactivity(nodes, reactiveNames, ctx) {
12366
+ if (reactiveNames.size === 0)
12367
+ return;
12368
+ const visit2 = (list) => {
12369
+ for (const node of list) {
12370
+ switch (node.type) {
12371
+ case "element":
12372
+ case "fragment":
12373
+ visit2(node.children);
12374
+ break;
12375
+ case "conditional": {
12376
+ if (!node.reactive) {
12377
+ const refs = extractFreeIdentifiersFromText(node.condition);
12378
+ if ([...refs].some((r) => reactiveNames.has(r))) {
12379
+ node.reactive = true;
12380
+ if (!node.slotId)
12381
+ node.slotId = generateSlotId(ctx);
12382
+ }
12383
+ }
12384
+ visit2([node.whenTrue, ...node.whenFalse ? [node.whenFalse] : []]);
12385
+ break;
12386
+ }
12387
+ }
12388
+ }
12389
+ };
12390
+ visit2(nodes);
12391
+ }
12316
12392
  function attrValueText(value) {
12317
12393
  if (value.kind === "expression")
12318
12394
  return value.expr;
@@ -12328,24 +12404,46 @@ function attrValueText(value) {
12328
12404
  return out.join(" ");
12329
12405
  }
12330
12406
  function collectBindingNames2(name, out) {
12331
- if (ts12.isIdentifier(name)) {
12407
+ if (ts13.isIdentifier(name)) {
12332
12408
  out.add(name.text);
12333
12409
  return;
12334
12410
  }
12335
12411
  for (const el of name.elements) {
12336
- if (ts12.isBindingElement(el))
12412
+ if (ts13.isBindingElement(el))
12337
12413
  collectBindingNames2(el.name, out);
12338
12414
  }
12339
12415
  }
12340
12416
  function collectPreambleDeclaredNames(stmt, out) {
12341
- if (ts12.isVariableStatement(stmt)) {
12417
+ if (ts13.isVariableStatement(stmt)) {
12342
12418
  for (const decl of stmt.declarationList.declarations) {
12343
12419
  collectBindingNames2(decl.name, out);
12344
12420
  }
12345
- } else if (ts12.isFunctionDeclaration(stmt) && stmt.name) {
12421
+ } else if (ts13.isFunctionDeclaration(stmt) && stmt.name) {
12346
12422
  out.add(stmt.name.text);
12347
12423
  }
12348
12424
  }
12425
+ function computePreambleReactiveNames(statements, ctx) {
12426
+ const reactiveNames = new Set;
12427
+ for (const stmt of statements) {
12428
+ if (!ts13.isVariableStatement(stmt))
12429
+ continue;
12430
+ for (const decl of stmt.declarationList.declarations) {
12431
+ if (!decl.initializer)
12432
+ continue;
12433
+ const boundNames = new Set;
12434
+ collectBindingNames2(decl.name, boundNames);
12435
+ const initText = ctx.getJS(decl.initializer);
12436
+ const initFreeRefs = extractFreeIdentifiersFromNode(decl.initializer);
12437
+ const readsEarlierReactive = [...initFreeRefs].some((r) => reactiveNames.has(r));
12438
+ const isReactive = readsEarlierReactive || isReactiveExpression(initText, ctx, decl.initializer);
12439
+ if (isReactive) {
12440
+ for (const n of boundNames)
12441
+ reactiveNames.add(n);
12442
+ }
12443
+ }
12444
+ }
12445
+ return reactiveNames;
12446
+ }
12349
12447
  function preambleFromValueStatements(statements, ctx) {
12350
12448
  const segments = [];
12351
12449
  const typedParts = [];
@@ -12360,21 +12458,23 @@ function preambleFromValueStatements(statements, ctx) {
12360
12458
  typedParts.push(raw0.endsWith(";") ? raw0 : raw0 + ";");
12361
12459
  segments.push(tjs !== js ? { kind: "js", text: js, templateText: tjs } : { kind: "js", text: js });
12362
12460
  }
12461
+ const reactiveNames = computePreambleReactiveNames(statements, ctx);
12363
12462
  return {
12364
12463
  segments: trimPreambleSegments(segments),
12365
12464
  ssrText: tsxSourceText(typedParts.join(" ")),
12366
12465
  declaredNames: [...declared],
12367
12466
  builderNames: [],
12368
- declarations: neutralPreambleDeclarations(statements, ctx) ?? undefined
12467
+ declarations: neutralPreambleDeclarations(statements, ctx) ?? undefined,
12468
+ reactiveNames: reactiveNames.size > 0 ? [...reactiveNames] : undefined
12369
12469
  };
12370
12470
  }
12371
12471
  function neutralPreambleDeclarations(statements, ctx) {
12372
12472
  const out = [];
12373
12473
  for (const stmt of statements) {
12374
- if (!ts12.isVariableStatement(stmt))
12474
+ if (!ts13.isVariableStatement(stmt))
12375
12475
  return null;
12376
12476
  for (const decl of stmt.declarationList.declarations) {
12377
- if (!ts12.isIdentifier(decl.name))
12477
+ if (!ts13.isIdentifier(decl.name))
12378
12478
  return null;
12379
12479
  if (!decl.initializer)
12380
12480
  return null;
@@ -12407,11 +12507,11 @@ function buildPreambleSegments(statements, returnStmt, ctx) {
12407
12507
  let refusalNode;
12408
12508
  const recordBuilderTarget = (leaf, stmt) => {
12409
12509
  for (let n = leaf.parent;n && n !== stmt.parent; n = n.parent) {
12410
- if (ts12.isCallExpression(n) && ts12.isPropertyAccessExpression(n.expression) && (n.expression.name.text === "push" || n.expression.name.text === "unshift") && ts12.isIdentifier(n.expression.expression)) {
12510
+ if (ts13.isCallExpression(n) && ts13.isPropertyAccessExpression(n.expression) && (n.expression.name.text === "push" || n.expression.name.text === "unshift") && ts13.isIdentifier(n.expression.expression)) {
12411
12511
  builders.add(n.expression.expression.text);
12412
12512
  return;
12413
12513
  }
12414
- if (ts12.isVariableDeclaration(n) && ts12.isIdentifier(n.name)) {
12514
+ if (ts13.isVariableDeclaration(n) && ts13.isIdentifier(n.name)) {
12415
12515
  builders.add(n.name.text);
12416
12516
  return;
12417
12517
  }
@@ -12424,7 +12524,7 @@ function buildPreambleSegments(statements, returnStmt, ctx) {
12424
12524
  const leafSpans = [];
12425
12525
  const leafIrs = [];
12426
12526
  const collect = (n, underTemplate) => {
12427
- if (ts12.isJsxElement(n) || ts12.isJsxSelfClosingElement(n) || ts12.isJsxFragment(n)) {
12527
+ if (ts13.isJsxElement(n) || ts13.isJsxSelfClosingElement(n) || ts13.isJsxFragment(n)) {
12428
12528
  if (underTemplate)
12429
12529
  refusalNode ??= n;
12430
12530
  recordBuilderTarget(n, stmt);
@@ -12435,7 +12535,7 @@ function buildPreambleSegments(statements, returnStmt, ctx) {
12435
12535
  leafIrs.push(ir ?? { type: "text", value: "", loc: getSourceLocation(n, ctx.sourceFile, ctx.filePath) });
12436
12536
  return;
12437
12537
  }
12438
- const inTemplate = underTemplate || ts12.isTemplateExpression(n) || ts12.isTaggedTemplateExpression(n);
12538
+ const inTemplate = underTemplate || ts13.isTemplateExpression(n) || ts13.isTaggedTemplateExpression(n);
12439
12539
  n.forEachChild((c) => collect(c, inTemplate));
12440
12540
  };
12441
12541
  collect(stmt, false);
@@ -12539,13 +12639,13 @@ function expandSpreadAttribute(attr, ctx) {
12539
12639
  }];
12540
12640
  }
12541
12641
  function attrFreeIdentifiers(attr) {
12542
- if (!attr.initializer || !ts12.isJsxExpression(attr.initializer) || !attr.initializer.expression) {
12642
+ if (!attr.initializer || !ts13.isJsxExpression(attr.initializer) || !attr.initializer.expression) {
12543
12643
  return;
12544
12644
  }
12545
12645
  return extractFreeIdentifiersFromNode(attr.initializer.expression);
12546
12646
  }
12547
12647
  function computeReactivityFlags(attr, ctx) {
12548
- if (!attr.initializer || !ts12.isJsxExpression(attr.initializer) || !attr.initializer.expression) {
12648
+ if (!attr.initializer || !ts13.isJsxExpression(attr.initializer) || !attr.initializer.expression) {
12549
12649
  return {};
12550
12650
  }
12551
12651
  const expr = attr.initializer.expression;
@@ -12571,22 +12671,22 @@ function processAttributes(attributes, ctx) {
12571
12671
  const events = [];
12572
12672
  let ref = null;
12573
12673
  for (const attr of attributes.properties) {
12574
- if (ts12.isJsxSpreadAttribute(attr)) {
12674
+ if (ts13.isJsxSpreadAttribute(attr)) {
12575
12675
  attrs.push(...expandSpreadAttribute(attr, ctx));
12576
12676
  continue;
12577
12677
  }
12578
- if (!ts12.isJsxAttribute(attr))
12678
+ if (!ts13.isJsxAttribute(attr))
12579
12679
  continue;
12580
12680
  const rawName = attr.name.getText(ctx.sourceFile);
12581
12681
  if (rawName === "ref") {
12582
- if (attr.initializer && ts12.isJsxExpression(attr.initializer) && attr.initializer.expression) {
12682
+ if (attr.initializer && ts13.isJsxExpression(attr.initializer) && attr.initializer.expression) {
12583
12683
  reportJsxBranchLocalInCallback(attr.initializer.expression, ctx);
12584
12684
  ref = ctx.getJS(attr.initializer.expression);
12585
12685
  }
12586
12686
  continue;
12587
12687
  }
12588
12688
  if (/^on[A-Z]/.test(rawName)) {
12589
- if (attr.initializer && ts12.isJsxExpression(attr.initializer) && attr.initializer.expression) {
12689
+ if (attr.initializer && ts13.isJsxExpression(attr.initializer) && attr.initializer.expression) {
12590
12690
  const eventName = rawName.slice(2).toLowerCase();
12591
12691
  reportJsxBranchLocalInCallback(attr.initializer.expression, ctx);
12592
12692
  events.push({
@@ -12601,7 +12701,7 @@ function processAttributes(attributes, ctx) {
12601
12701
  const name = toHTMLAttrName(rawName);
12602
12702
  let value = getAttributeValue(attr, ctx);
12603
12703
  let clientOnly;
12604
- if (attr.initializer && ts12.isJsxExpression(attr.initializer) && attr.initializer.expression) {
12704
+ if (attr.initializer && ts13.isJsxExpression(attr.initializer) && attr.initializer.expression) {
12605
12705
  if (value.kind === "expression" && value.templateExpr === undefined) {
12606
12706
  const rewritten = rewriteBarePropRefs2(value.expr, attr.initializer.expression, ctx);
12607
12707
  if (rewritten !== value.expr) {
@@ -12628,55 +12728,55 @@ function getAttributeValue(attr, ctx) {
12628
12728
  if (!attr.initializer) {
12629
12729
  return AttrValueOf.booleanAttr();
12630
12730
  }
12631
- if (ts12.isStringLiteral(attr.initializer)) {
12731
+ if (ts13.isStringLiteral(attr.initializer)) {
12632
12732
  return AttrValueOf.literal(decodeEntities(attr.initializer.text));
12633
12733
  }
12634
- if (ts12.isJsxExpression(attr.initializer) && attr.initializer.expression) {
12734
+ if (ts13.isJsxExpression(attr.initializer) && attr.initializer.expression) {
12635
12735
  let expr = attr.initializer.expression;
12636
- if (ts12.isIdentifier(expr)) {
12736
+ if (ts13.isIdentifier(expr)) {
12637
12737
  const branchInit = ctx._branchScopeVars?.get(expr.text);
12638
12738
  if (branchInit && !initializerShapeContainsJsx(branchInit)) {
12639
12739
  expr = branchInit;
12640
12740
  }
12641
12741
  }
12642
12742
  expr = tryDesugarInterleaveTaggedTemplate(expr, ctx);
12643
- if (ts12.isAwaitExpression(expr)) {
12743
+ if (ts13.isAwaitExpression(expr)) {
12644
12744
  ctx.analyzer.errors.push(createError(ErrorCodes.STAGE_AWAIT_IN_TEMPLATE, getSourceLocation(expr, ctx.sourceFile, ctx.filePath)));
12645
12745
  return AttrValueOf.expression("undefined");
12646
12746
  }
12647
12747
  checkBareSignalOrMemoIdentifier(expr, ctx);
12648
- if (attr.name.getText(ctx.sourceFile) === "style" && ts12.isObjectLiteralExpression(expr)) {
12748
+ if (attr.name.getText(ctx.sourceFile) === "style" && ts13.isObjectLiteralExpression(expr)) {
12649
12749
  const cssString = tryStaticStyleObjectToCss(expr);
12650
12750
  if (cssString !== null) {
12651
12751
  return AttrValueOf.literal(cssString);
12652
12752
  }
12653
12753
  }
12654
- if (ts12.isTemplateExpression(expr)) {
12754
+ if (ts13.isTemplateExpression(expr)) {
12655
12755
  const parts = parseTemplateLiteral(expr, ctx);
12656
12756
  if (parts.some((p) => p.type === "ternary" || p.type === "lookup")) {
12657
12757
  return AttrValueOf.template(parts);
12658
12758
  }
12659
12759
  }
12660
- if (ts12.isElementAccessExpression(expr) && !ts12.isStringLiteralLike(expr.argumentExpression) && !ts12.isNumericLiteral(expr.argumentExpression)) {
12760
+ if (ts13.isElementAccessExpression(expr) && !ts13.isStringLiteralLike(expr.argumentExpression) && !ts13.isNumericLiteral(expr.argumentExpression)) {
12661
12761
  const parts = tryResolveTemplateSpanFromConst(expr, ctx);
12662
12762
  if (parts) {
12663
12763
  return AttrValueOf.template(parts);
12664
12764
  }
12665
12765
  }
12666
- if (ts12.isIdentifier(expr)) {
12766
+ if (ts13.isIdentifier(expr)) {
12667
12767
  const resolved = tryResolveIdentifierAsTemplateLiteral(expr, ctx);
12668
12768
  if (resolved) {
12669
12769
  return AttrValueOf.template(resolved);
12670
12770
  }
12671
12771
  }
12672
- if (ts12.isConditionalExpression(expr)) {
12772
+ if (ts13.isConditionalExpression(expr)) {
12673
12773
  const ternary = parseTernary(expr, ctx);
12674
12774
  if (ternary) {
12675
12775
  return AttrValueOf.template([ternary]);
12676
12776
  }
12677
12777
  }
12678
- if (ts12.isBinaryExpression(expr) && expr.operatorToken.kind === ts12.SyntaxKind.BarBarToken) {
12679
- if (ts12.isIdentifier(expr.right) && expr.right.text === "undefined") {
12778
+ if (ts13.isBinaryExpression(expr) && expr.operatorToken.kind === ts13.SyntaxKind.BarBarToken) {
12779
+ if (ts13.isIdentifier(expr.right) && expr.right.text === "undefined") {
12680
12780
  const baseExpr = ctx.getJS(expr.left);
12681
12781
  return AttrValueOf.expression(baseExpr, { presenceOrUndefined: true });
12682
12782
  }
@@ -12689,11 +12789,11 @@ function getAttributeValue(attr, ctx) {
12689
12789
  function tryStaticStyleObjectToCss(expr) {
12690
12790
  const parts = [];
12691
12791
  for (const prop of expr.properties) {
12692
- if (!ts12.isPropertyAssignment(prop))
12792
+ if (!ts13.isPropertyAssignment(prop))
12693
12793
  return null;
12694
- if (!ts12.isIdentifier(prop.name) && !ts12.isStringLiteral(prop.name))
12794
+ if (!ts13.isIdentifier(prop.name) && !ts13.isStringLiteral(prop.name))
12695
12795
  return null;
12696
- if (!ts12.isStringLiteral(prop.initializer))
12796
+ if (!ts13.isStringLiteral(prop.initializer))
12697
12797
  return null;
12698
12798
  const key = cssKebabCase(prop.name.text);
12699
12799
  parts.push(`${key}:${prop.initializer.text}`);
@@ -12706,7 +12806,7 @@ function parseTemplateLiteral(expr, ctx) {
12706
12806
  parts.push({ type: "string", value: expr.head.text });
12707
12807
  }
12708
12808
  for (const span of expr.templateSpans) {
12709
- if (ts12.isConditionalExpression(span.expression)) {
12809
+ if (ts13.isConditionalExpression(span.expression)) {
12710
12810
  const ternary = parseTernary(span.expression, ctx);
12711
12811
  if (ternary) {
12712
12812
  parts.push(ternary);
@@ -12732,7 +12832,7 @@ function parseTemplateLiteral(expr, ctx) {
12732
12832
  return parts;
12733
12833
  }
12734
12834
  function tryResolveTemplateSpanFromConst(expr, ctx) {
12735
- if (ts12.isIdentifier(expr)) {
12835
+ if (ts13.isIdentifier(expr)) {
12736
12836
  if (ctx.scope.isBound(expr.text))
12737
12837
  return null;
12738
12838
  const constInfo = findLocalConst(expr.text, ctx.analyzer);
@@ -12741,13 +12841,13 @@ function tryResolveTemplateSpanFromConst(expr, ctx) {
12741
12841
  const ast = parseConstInitializer(constInfo);
12742
12842
  if (!ast)
12743
12843
  return null;
12744
- if (ts12.isStringLiteral(ast) || ts12.isNoSubstitutionTemplateLiteral(ast)) {
12844
+ if (ts13.isStringLiteral(ast) || ts13.isNoSubstitutionTemplateLiteral(ast)) {
12745
12845
  return [{ type: "string", value: ast.text }];
12746
12846
  }
12747
12847
  return null;
12748
12848
  }
12749
- if (ts12.isElementAccessExpression(expr)) {
12750
- if (!ts12.isIdentifier(expr.expression))
12849
+ if (ts13.isElementAccessExpression(expr)) {
12850
+ if (!ts13.isIdentifier(expr.expression))
12751
12851
  return null;
12752
12852
  if (ctx.scope.isBound(expr.expression.text))
12753
12853
  return null;
@@ -12755,17 +12855,17 @@ function tryResolveTemplateSpanFromConst(expr, ctx) {
12755
12855
  if (!constInfo)
12756
12856
  return null;
12757
12857
  const ast = parseConstInitializer(constInfo);
12758
- if (!ast || !ts12.isObjectLiteralExpression(ast))
12858
+ if (!ast || !ts13.isObjectLiteralExpression(ast))
12759
12859
  return null;
12760
12860
  const cases = {};
12761
12861
  for (const prop of ast.properties) {
12762
- if (!ts12.isPropertyAssignment(prop))
12862
+ if (!ts13.isPropertyAssignment(prop))
12763
12863
  return null;
12764
- const keyName = prop.name && (ts12.isStringLiteral(prop.name) || ts12.isIdentifier(prop.name)) ? prop.name.text : null;
12864
+ const keyName = prop.name && (ts13.isStringLiteral(prop.name) || ts13.isIdentifier(prop.name)) ? prop.name.text : null;
12765
12865
  if (!keyName)
12766
12866
  return null;
12767
12867
  const value = prop.initializer;
12768
- if (ts12.isStringLiteral(value) || ts12.isNoSubstitutionTemplateLiteral(value)) {
12868
+ if (ts13.isStringLiteral(value) || ts13.isNoSubstitutionTemplateLiteral(value)) {
12769
12869
  cases[keyName] = value.text;
12770
12870
  } else {
12771
12871
  return null;
@@ -12812,17 +12912,17 @@ function hasDynamicTagBinding(name, sourceFile) {
12812
12912
  const visit2 = (node) => {
12813
12913
  if (found)
12814
12914
  return;
12815
- if (ts12.isVariableDeclaration(node) && ts12.isIdentifier(node.name) && node.name.text === name && node.initializer) {
12915
+ if (ts13.isVariableDeclaration(node) && ts13.isIdentifier(node.name) && node.name.text === name && node.initializer) {
12816
12916
  let init = node.initializer;
12817
- while (ts12.isAsExpression(init) || ts12.isSatisfiesExpression(init) || ts12.isParenthesizedExpression(init) || ts12.isNonNullExpression(init)) {
12917
+ while (ts13.isAsExpression(init) || ts13.isSatisfiesExpression(init) || ts13.isParenthesizedExpression(init) || ts13.isNonNullExpression(init)) {
12818
12918
  init = init.expression;
12819
12919
  }
12820
- if (ts12.isPropertyAccessExpression(init) && init.name.text === "tag") {
12920
+ if (ts13.isPropertyAccessExpression(init) && init.name.text === "tag") {
12821
12921
  found = true;
12822
12922
  return;
12823
12923
  }
12824
12924
  }
12825
- ts12.forEachChild(node, visit2);
12925
+ ts13.forEachChild(node, visit2);
12826
12926
  };
12827
12927
  visit2(sourceFile);
12828
12928
  return found;
@@ -12836,13 +12936,13 @@ function tryResolveIdentifierAsTemplateLiteral(ident, ctx) {
12836
12936
  const ast = parseConstInitializer(constInfo);
12837
12937
  if (!ast)
12838
12938
  return null;
12839
- if (ts12.isNoSubstitutionTemplateLiteral(ast) || ts12.isStringLiteral(ast)) {
12939
+ if (ts13.isNoSubstitutionTemplateLiteral(ast) || ts13.isStringLiteral(ast)) {
12840
12940
  return [{ type: "string", value: ast.text }];
12841
12941
  }
12842
- if (ts12.isElementAccessExpression(ast) && !ts12.isStringLiteralLike(ast.argumentExpression) && !ts12.isNumericLiteral(ast.argumentExpression)) {
12942
+ if (ts13.isElementAccessExpression(ast) && !ts13.isStringLiteralLike(ast.argumentExpression) && !ts13.isNumericLiteral(ast.argumentExpression)) {
12843
12943
  return tryResolveTemplateSpanFromConst(ast, ctx);
12844
12944
  }
12845
- if (!ts12.isTemplateExpression(ast))
12945
+ if (!ts13.isTemplateExpression(ast))
12846
12946
  return null;
12847
12947
  let resolvedAny = false;
12848
12948
  const parts = [];
@@ -12880,14 +12980,14 @@ function parseConstInitializerImpl(c) {
12880
12980
  if (!c.value)
12881
12981
  return null;
12882
12982
  const wrapped = `const __bf_resolve__ = (${c.value})`;
12883
- const sf = ts12.createSourceFile("__bf_resolve.ts", wrapped, ts12.ScriptTarget.Latest, true, ts12.ScriptKind.TS);
12983
+ const sf = ts13.createSourceFile("__bf_resolve.ts", wrapped, ts13.ScriptTarget.Latest, true, ts13.ScriptKind.TS);
12884
12984
  const stmt = sf.statements[0];
12885
- if (!stmt || !ts12.isVariableStatement(stmt))
12985
+ if (!stmt || !ts13.isVariableStatement(stmt))
12886
12986
  return null;
12887
12987
  const decl = stmt.declarationList.declarations[0];
12888
12988
  if (!decl?.initializer)
12889
12989
  return null;
12890
- return ts12.isParenthesizedExpression(decl.initializer) ? decl.initializer.expression : decl.initializer;
12990
+ return ts13.isParenthesizedExpression(decl.initializer) ? decl.initializer.expression : decl.initializer;
12891
12991
  }
12892
12992
  function astText(node) {
12893
12993
  return node.getText(node.getSourceFile());
@@ -12907,9 +13007,9 @@ function parseFunctionInfoAsExprImpl(fn) {
12907
13007
  const params = fn.typedParams !== undefined ? fn.typedParams : fn.params.map(formatParamWithType).join(", ");
12908
13008
  const body = fn.typedBody ?? fn.body;
12909
13009
  const wrapped = `const __bf_resolve_fn__ = function(${params}) ${body}`;
12910
- const sf = ts12.createSourceFile("__bf_resolve_fn.ts", wrapped, ts12.ScriptTarget.Latest, true, ts12.ScriptKind.TS);
13010
+ const sf = ts13.createSourceFile("__bf_resolve_fn.ts", wrapped, ts13.ScriptTarget.Latest, true, ts13.ScriptKind.TS);
12911
13011
  const stmt = sf.statements[0];
12912
- if (!stmt || !ts12.isVariableStatement(stmt))
13012
+ if (!stmt || !ts13.isVariableStatement(stmt))
12913
13013
  return null;
12914
13014
  const decl = stmt.declarationList.declarations[0];
12915
13015
  if (!decl?.initializer)
@@ -12917,9 +13017,9 @@ function parseFunctionInfoAsExprImpl(fn) {
12917
13017
  return decl.initializer;
12918
13018
  }
12919
13019
  function tryDesugarInterleaveTaggedTemplate(expr, ctx) {
12920
- if (!ts12.isTaggedTemplateExpression(expr))
13020
+ if (!ts13.isTaggedTemplateExpression(expr))
12921
13021
  return expr;
12922
- if (!ts12.isIdentifier(expr.tag))
13022
+ if (!ts13.isIdentifier(expr.tag))
12923
13023
  return expr;
12924
13024
  const resolvedTag = resolveInterleaveTagIdentifier(expr.tag.text, ctx);
12925
13025
  if (!resolvedTag)
@@ -12936,23 +13036,23 @@ function resolveInterleaveTagIdentifier(name, ctx) {
12936
13036
  return null;
12937
13037
  if (constInfo) {
12938
13038
  const ast = parseConstInitializer(constInfo);
12939
- return ast && (ts12.isArrowFunction(ast) || ts12.isFunctionExpression(ast)) ? ast : null;
13039
+ return ast && (ts13.isArrowFunction(ast) || ts13.isFunctionExpression(ast)) ? ast : null;
12940
13040
  }
12941
13041
  if (fnInfo) {
12942
13042
  const ast = parseFunctionInfoAsExpr(fnInfo);
12943
- return ast && (ts12.isArrowFunction(ast) || ts12.isFunctionExpression(ast)) ? ast : null;
13043
+ return ast && (ts13.isArrowFunction(ast) || ts13.isFunctionExpression(ast)) ? ast : null;
12944
13044
  }
12945
13045
  return null;
12946
13046
  }
12947
13047
  function isInterleaveTagFunction(fn) {
12948
- if (!ts12.isArrowFunction(fn) && !ts12.isFunctionExpression(fn))
13048
+ if (!ts13.isArrowFunction(fn) && !ts13.isFunctionExpression(fn))
12949
13049
  return false;
12950
13050
  if (fn.parameters.length !== 2)
12951
13051
  return false;
12952
13052
  const [partsParam, argsParam] = fn.parameters;
12953
- if (!ts12.isIdentifier(partsParam.name) || partsParam.dotDotDotToken)
13053
+ if (!ts13.isIdentifier(partsParam.name) || partsParam.dotDotDotToken)
12954
13054
  return false;
12955
- if (!ts12.isIdentifier(argsParam.name) || !argsParam.dotDotDotToken)
13055
+ if (!ts13.isIdentifier(argsParam.name) || !argsParam.dotDotDotToken)
12956
13056
  return false;
12957
13057
  const parsed = tsNodeToParsedExpr(fn);
12958
13058
  if (parsed.kind !== "arrow")
@@ -13009,7 +13109,7 @@ function isInterleaveSpanExpr(expr, i, argsName) {
13009
13109
  function buildUntaggedTemplateLiteral(node, ctx) {
13010
13110
  const template = node.template;
13011
13111
  let text;
13012
- if (ts12.isNoSubstitutionTemplateLiteral(template)) {
13112
+ if (ts13.isNoSubstitutionTemplateLiteral(template)) {
13013
13113
  text = "`" + (template.rawText ?? template.text) + "`";
13014
13114
  } else {
13015
13115
  let body = template.head.rawText ?? template.head.text;
@@ -13021,15 +13121,15 @@ function buildUntaggedTemplateLiteral(node, ctx) {
13021
13121
  text = "`" + body + "`";
13022
13122
  }
13023
13123
  const wrapped = `const __bf_resolve_tagged__ = (${text})`;
13024
- const sf = ts12.createSourceFile("__bf_resolve_tagged.tsx", wrapped, ts12.ScriptTarget.Latest, true, ts12.ScriptKind.TSX);
13124
+ const sf = ts13.createSourceFile("__bf_resolve_tagged.tsx", wrapped, ts13.ScriptTarget.Latest, true, ts13.ScriptKind.TSX);
13025
13125
  const stmt = sf.statements[0];
13026
- if (!stmt || !ts12.isVariableStatement(stmt))
13126
+ if (!stmt || !ts13.isVariableStatement(stmt))
13027
13127
  return null;
13028
13128
  const decl = stmt.declarationList.declarations[0];
13029
13129
  if (!decl?.initializer)
13030
13130
  return null;
13031
- const result = ts12.isParenthesizedExpression(decl.initializer) ? decl.initializer.expression : decl.initializer;
13032
- if (!ts12.isTemplateExpression(result) && !ts12.isNoSubstitutionTemplateLiteral(result))
13131
+ const result = ts13.isParenthesizedExpression(decl.initializer) ? decl.initializer.expression : decl.initializer;
13132
+ if (!ts13.isTemplateExpression(result) && !ts13.isNoSubstitutionTemplateLiteral(result))
13033
13133
  return null;
13034
13134
  return result;
13035
13135
  }
@@ -13049,10 +13149,10 @@ function parseTernary(expr, ctx) {
13049
13149
  return null;
13050
13150
  }
13051
13151
  function getStringValue(node) {
13052
- if (ts12.isStringLiteral(node)) {
13152
+ if (ts13.isStringLiteral(node)) {
13053
13153
  return node.text;
13054
13154
  }
13055
- if (ts12.isNoSubstitutionTemplateLiteral(node)) {
13155
+ if (ts13.isNoSubstitutionTemplateLiteral(node)) {
13056
13156
  return node.text;
13057
13157
  }
13058
13158
  return null;
@@ -13060,19 +13160,19 @@ function getStringValue(node) {
13060
13160
  function processComponentProps(attributes, ctx) {
13061
13161
  const props = [];
13062
13162
  for (const attr of attributes.properties) {
13063
- if (ts12.isJsxSpreadAttribute(attr)) {
13163
+ if (ts13.isJsxSpreadAttribute(attr)) {
13064
13164
  props.push(...expandSpreadAttribute(attr, ctx));
13065
13165
  continue;
13066
13166
  }
13067
- if (!ts12.isJsxAttribute(attr))
13167
+ if (!ts13.isJsxAttribute(attr))
13068
13168
  continue;
13069
13169
  const name = attr.name.getText(ctx.sourceFile);
13070
- if (attr.initializer && ts12.isJsxExpression(attr.initializer) && attr.initializer.expression) {
13170
+ if (attr.initializer && ts13.isJsxExpression(attr.initializer) && attr.initializer.expression) {
13071
13171
  let jsxExpr = attr.initializer.expression;
13072
- while (ts12.isParenthesizedExpression(jsxExpr)) {
13172
+ while (ts13.isParenthesizedExpression(jsxExpr)) {
13073
13173
  jsxExpr = jsxExpr.expression;
13074
13174
  }
13075
- if (ts12.isJsxElement(jsxExpr) || ts12.isJsxSelfClosingElement(jsxExpr) || ts12.isJsxFragment(jsxExpr)) {
13175
+ if (ts13.isJsxElement(jsxExpr) || ts13.isJsxSelfClosingElement(jsxExpr) || ts13.isJsxFragment(jsxExpr)) {
13076
13176
  const prevInsideComponentChildren = ctx.insideComponentChildren;
13077
13177
  ctx.insideComponentChildren = true;
13078
13178
  const irNode = transformNode(jsxExpr, ctx);
@@ -13099,7 +13199,7 @@ function processComponentProps(attributes, ctx) {
13099
13199
  value = AttrValueOf.booleanShorthand();
13100
13200
  }
13101
13201
  let clientOnly;
13102
- if (attr.initializer && ts12.isJsxExpression(attr.initializer) && attr.initializer.expression) {
13202
+ if (attr.initializer && ts13.isJsxExpression(attr.initializer) && attr.initializer.expression) {
13103
13203
  if (value.kind === "expression" && value.templateExpr === undefined) {
13104
13204
  const rewritten = rewriteBarePropRefs2(value.expr, attr.initializer.expression, ctx);
13105
13205
  if (rewritten !== value.expr) {
@@ -13123,7 +13223,7 @@ function processComponentProps(attributes, ctx) {
13123
13223
  return props;
13124
13224
  }
13125
13225
  function checkBareSignalOrMemoIdentifier(expr, ctx) {
13126
- if (!ts12.isIdentifier(expr))
13226
+ if (!ts13.isIdentifier(expr))
13127
13227
  return;
13128
13228
  const name = expr.text;
13129
13229
  for (const signal of ctx.analyzer.signals) {
@@ -13154,12 +13254,12 @@ function checkBareSignalOrMemoIdentifier(expr, ctx) {
13154
13254
  function isArrayExprDirectPropRef(arrayExpr, ctx) {
13155
13255
  const propNames = new Set(ctx.patterns.props.map((p) => p.name));
13156
13256
  const propsObjName = ctx.analyzer.propsObjectName;
13157
- if (ts12.isIdentifier(arrayExpr)) {
13257
+ if (ts13.isIdentifier(arrayExpr)) {
13158
13258
  return propNames.has(arrayExpr.text);
13159
13259
  }
13160
- if (ts12.isPropertyAccessExpression(arrayExpr) && propsObjName) {
13260
+ if (ts13.isPropertyAccessExpression(arrayExpr) && propsObjName) {
13161
13261
  const obj = arrayExpr.expression;
13162
- if (ts12.isIdentifier(obj) && obj.text === propsObjName) {
13262
+ if (ts13.isIdentifier(obj) && obj.text === propsObjName) {
13163
13263
  return true;
13164
13264
  }
13165
13265
  }
@@ -13354,7 +13454,7 @@ function buildIfStatementChain(analyzer, ctx, opts) {
13354
13454
  jsxBranchLocalNames.add(n);
13355
13455
  }
13356
13456
  for (const decl of condReturn.scopeVariables) {
13357
- if (ts12.isIdentifier(decl.name) && decl.initializer) {
13457
+ if (ts13.isIdentifier(decl.name) && decl.initializer) {
13358
13458
  branchScopeVars.set(decl.name.text, decl.initializer);
13359
13459
  if (initializerShapeContainsJsx(decl.initializer)) {
13360
13460
  jsxBranchLocalNames.add(decl.name.text);
@@ -13421,7 +13521,7 @@ function buildIfStatementChain(analyzer, ctx, opts) {
13421
13521
  }
13422
13522
  const scopeVariables = [];
13423
13523
  for (const decl of condReturn.scopeVariables) {
13424
- if (ts12.isIdentifier(decl.name) && decl.initializer) {
13524
+ if (ts13.isIdentifier(decl.name) && decl.initializer) {
13425
13525
  const init = ctx.getJS(decl.initializer);
13426
13526
  const typedInit = decl.initializer.getText(ctx.sourceFile);
13427
13527
  scopeVariables.push({
@@ -14712,7 +14812,8 @@ function collectLoopChildConditionals(node, ctx, siblingOffsets, loopParam, loop
14712
14812
  if (!n.reactive && !refsLoopParamInSource)
14713
14813
  return;
14714
14814
  const expanded = expandConstantForReactivity(n.condition, ctx, sourceFreeIds, scope);
14715
- if (classifyReactivity(expanded.expr, ctx, loopParam, loopParamBindings, expanded.freeIds).kind === "none")
14815
+ const readsPreamble = preambleNames !== undefined && preambleNames.size > 0 && anyNameIn(expanded.freeIds ?? extractFreeIdentifiersFromText(expanded.expr), preambleNames);
14816
+ if (!readsPreamble && classifyReactivity(expanded.expr, ctx, loopParam, loopParamBindings, expanded.freeIds).kind === "none")
14716
14817
  return;
14717
14818
  const loopParamsForCond = loopParam ? [{ param: loopParam, bindings: loopParamBindings }] : undefined;
14718
14819
  const whenTrueHtml = irToHtmlTemplate(n.whenTrue, undefined, 0, loopParamsForCond, "__slots");
@@ -14724,7 +14825,8 @@ function collectLoopChildConditionals(node, ctx, siblingOffsets, loopParam, loop
14724
14825
  whenFalseHtml,
14725
14826
  whenTrue: summarizeLoopChildBranch(n.whenTrue, ctx, siblingOffsets, loopParam, loopParamBindings, preambleNames, loopIndex),
14726
14827
  whenFalse: summarizeLoopChildBranch(n.whenFalse, ctx, siblingOffsets, loopParam, loopParamBindings, preambleNames, loopIndex),
14727
- ...expanded.freeIds !== undefined && { conditionFreeIdentifiers: expanded.freeIds }
14828
+ ...expanded.freeIds !== undefined && { conditionFreeIdentifiers: expanded.freeIds },
14829
+ ...readsPreamble && { readsPreamble: true }
14728
14830
  });
14729
14831
  }
14730
14832
  });
@@ -15100,7 +15202,7 @@ function graphDeclarationReferences(graph, kind, name) {
15100
15202
  }
15101
15203
 
15102
15204
  // ../jsx/src/ir-to-client-js/walk-prop-accesses.ts
15103
- import ts13 from "typescript";
15205
+ import ts14 from "typescript";
15104
15206
  function collectPropAccesses(source, propNames, out) {
15105
15207
  if (propNames.size === 0)
15106
15208
  return;
@@ -15114,7 +15216,7 @@ function collectPropAccesses(source, propNames, out) {
15114
15216
  if (!anyMentioned)
15115
15217
  return;
15116
15218
  for (const expr of normaliseExpressionParts(source)) {
15117
- const sourceFile = ts13.createSourceFile("p.ts", expr, ts13.ScriptTarget.Latest, false, ts13.ScriptKind.TS);
15219
+ const sourceFile = ts14.createSourceFile("p.ts", expr, ts14.ScriptTarget.Latest, false, ts14.ScriptKind.TS);
15118
15220
  visit2(sourceFile, propNames, out);
15119
15221
  }
15120
15222
  }
@@ -15124,15 +15226,15 @@ function normaliseExpressionParts(source) {
15124
15226
  return extractTemplateExpressions(source);
15125
15227
  }
15126
15228
  function visit2(node, propNames, out) {
15127
- if (ts13.isPropertyAccessExpression(node)) {
15229
+ if (ts14.isPropertyAccessExpression(node)) {
15128
15230
  recordIfPropAccess(node.expression, "property", propNames, out);
15129
- } else if (ts13.isElementAccessExpression(node)) {
15231
+ } else if (ts14.isElementAccessExpression(node)) {
15130
15232
  recordIfPropAccess(node.expression, "index", propNames, out);
15131
15233
  }
15132
- ts13.forEachChild(node, (child) => visit2(child, propNames, out));
15234
+ ts14.forEachChild(node, (child) => visit2(child, propNames, out));
15133
15235
  }
15134
15236
  function recordIfPropAccess(receiver, kind, propNames, out) {
15135
- if (!ts13.isIdentifier(receiver))
15237
+ if (!ts14.isIdentifier(receiver))
15136
15238
  return;
15137
15239
  const name = receiver.text;
15138
15240
  if (!propNames.has(name))
@@ -15185,56 +15287,56 @@ function propHasPropertyAccess(u) {
15185
15287
  }
15186
15288
 
15187
15289
  // ../jsx/src/value-references.ts
15188
- import ts14 from "typescript";
15290
+ import ts15 from "typescript";
15189
15291
  function isValueReferenceIdentifier(id) {
15190
15292
  const parent = id.parent;
15191
15293
  if (!parent)
15192
15294
  return false;
15193
- if (ts14.isPropertyAccessExpression(parent) && parent.name === id)
15295
+ if (ts15.isPropertyAccessExpression(parent) && parent.name === id)
15194
15296
  return false;
15195
- if (ts14.isPropertyAssignment(parent) && parent.name === id)
15297
+ if (ts15.isPropertyAssignment(parent) && parent.name === id)
15196
15298
  return false;
15197
- if ((ts14.isMethodDeclaration(parent) || ts14.isGetAccessorDeclaration(parent) || ts14.isSetAccessorDeclaration(parent)) && parent.name === id) {
15299
+ if ((ts15.isMethodDeclaration(parent) || ts15.isGetAccessorDeclaration(parent) || ts15.isSetAccessorDeclaration(parent)) && parent.name === id) {
15198
15300
  return false;
15199
15301
  }
15200
- if (ts14.isPropertyDeclaration(parent) && parent.name === id)
15302
+ if (ts15.isPropertyDeclaration(parent) && parent.name === id)
15201
15303
  return false;
15202
- if (ts14.isMetaProperty(parent) && parent.name === id)
15304
+ if (ts15.isMetaProperty(parent) && parent.name === id)
15203
15305
  return false;
15204
- if (ts14.isVariableDeclaration(parent) && parent.name === id)
15306
+ if (ts15.isVariableDeclaration(parent) && parent.name === id)
15205
15307
  return false;
15206
- if (ts14.isFunctionDeclaration(parent) && parent.name === id)
15308
+ if (ts15.isFunctionDeclaration(parent) && parent.name === id)
15207
15309
  return false;
15208
- if (ts14.isFunctionExpression(parent) && parent.name === id)
15310
+ if (ts15.isFunctionExpression(parent) && parent.name === id)
15209
15311
  return false;
15210
- if (ts14.isClassDeclaration(parent) && parent.name === id)
15312
+ if (ts15.isClassDeclaration(parent) && parent.name === id)
15211
15313
  return false;
15212
- if (ts14.isClassExpression(parent) && parent.name === id)
15314
+ if (ts15.isClassExpression(parent) && parent.name === id)
15213
15315
  return false;
15214
- if (ts14.isParameter(parent) && parent.name === id)
15316
+ if (ts15.isParameter(parent) && parent.name === id)
15215
15317
  return false;
15216
- if (ts14.isBindingElement(parent) && (parent.name === id || parent.propertyName === id))
15318
+ if (ts15.isBindingElement(parent) && (parent.name === id || parent.propertyName === id))
15217
15319
  return false;
15218
- if (ts14.isLabeledStatement(parent) && parent.label === id)
15320
+ if (ts15.isLabeledStatement(parent) && parent.label === id)
15219
15321
  return false;
15220
- if (ts14.isBreakOrContinueStatement(parent) && parent.label === id)
15322
+ if (ts15.isBreakOrContinueStatement(parent) && parent.label === id)
15221
15323
  return false;
15222
- if (ts14.isImportSpecifier(parent) && (parent.name === id || parent.propertyName === id))
15324
+ if (ts15.isImportSpecifier(parent) && (parent.name === id || parent.propertyName === id))
15223
15325
  return false;
15224
- if (ts14.isExportSpecifier(parent) && (parent.name === id || parent.propertyName === id))
15326
+ if (ts15.isExportSpecifier(parent) && (parent.name === id || parent.propertyName === id))
15225
15327
  return false;
15226
- if (ts14.isImportClause(parent) && parent.name === id)
15328
+ if (ts15.isImportClause(parent) && parent.name === id)
15227
15329
  return false;
15228
- if (ts14.isNamespaceImport(parent) && parent.name === id)
15330
+ if (ts15.isNamespaceImport(parent) && parent.name === id)
15229
15331
  return false;
15230
- if (ts14.isQualifiedName(parent) && parent.right === id)
15332
+ if (ts15.isQualifiedName(parent) && parent.right === id)
15231
15333
  return false;
15232
15334
  return true;
15233
15335
  }
15234
15336
  function collectValueReferencedNames(code) {
15235
15337
  let sourceFile;
15236
15338
  try {
15237
- sourceFile = ts14.createSourceFile("generated.js", code, ts14.ScriptTarget.Latest, true, ts14.ScriptKind.JS);
15339
+ sourceFile = ts15.createSourceFile("generated.js", code, ts15.ScriptTarget.Latest, true, ts15.ScriptKind.JS);
15238
15340
  } catch {
15239
15341
  return null;
15240
15342
  }
@@ -15243,10 +15345,10 @@ function collectValueReferencedNames(code) {
15243
15345
  return null;
15244
15346
  const names = new Set;
15245
15347
  function visit3(node) {
15246
- if (ts14.isIdentifier(node) && isValueReferenceIdentifier(node)) {
15348
+ if (ts15.isIdentifier(node) && isValueReferenceIdentifier(node)) {
15247
15349
  names.add(node.text);
15248
15350
  }
15249
- ts14.forEachChild(node, visit3);
15351
+ ts15.forEachChild(node, visit3);
15250
15352
  }
15251
15353
  visit3(sourceFile);
15252
15354
  return names;
@@ -15414,7 +15516,7 @@ function collectComponentNames(node) {
15414
15516
  }
15415
15517
 
15416
15518
  // ../jsx/src/relocate.ts
15417
- import ts15 from "typescript";
15519
+ import ts16 from "typescript";
15418
15520
 
15419
15521
  // ../jsx/src/lowering-registry.ts
15420
15522
  var plugins = [];
@@ -15442,19 +15544,19 @@ function classify(name, env) {
15442
15544
  function collectFreeRefs(node) {
15443
15545
  const refs = new Map;
15444
15546
  function visit3(n, parent) {
15445
- if (ts15.isIdentifier(n)) {
15446
- if (parent && ts15.isPropertyAccessExpression(parent) && parent.name === n)
15547
+ if (ts16.isIdentifier(n)) {
15548
+ if (parent && ts16.isPropertyAccessExpression(parent) && parent.name === n)
15447
15549
  return;
15448
- if (parent && ts15.isPropertyAssignment(parent) && parent.name === n)
15550
+ if (parent && ts16.isPropertyAssignment(parent) && parent.name === n)
15449
15551
  return;
15450
- if (parent && ts15.isShorthandPropertyAssignment(parent) && parent.name === n)
15552
+ if (parent && ts16.isShorthandPropertyAssignment(parent) && parent.name === n)
15451
15553
  return;
15452
15554
  const list = refs.get(n.text) ?? [];
15453
15555
  list.push(n);
15454
15556
  refs.set(n.text, list);
15455
15557
  return;
15456
15558
  }
15457
- ts15.forEachChild(n, (child) => visit3(child, n));
15559
+ ts16.forEachChild(n, (child) => visit3(child, n));
15458
15560
  }
15459
15561
  visit3(node);
15460
15562
  return refs;
@@ -15558,11 +15660,11 @@ function isInlinableInTemplate(value, env) {
15558
15660
  return { ok: true, rewrittenValue: r.text, decisions: r.decisions };
15559
15661
  }
15560
15662
  function getCalleeIdentifierPath(callee) {
15561
- if (ts15.isParenthesizedExpression(callee))
15663
+ if (ts16.isParenthesizedExpression(callee))
15562
15664
  return getCalleeIdentifierPath(callee.expression);
15563
- if (ts15.isIdentifier(callee))
15665
+ if (ts16.isIdentifier(callee))
15564
15666
  return callee.text;
15565
- if (ts15.isPropertyAccessExpression(callee)) {
15667
+ if (ts16.isPropertyAccessExpression(callee)) {
15566
15668
  const left = getCalleeIdentifierPath(callee.expression);
15567
15669
  if (left === null)
15568
15670
  return null;
@@ -15571,11 +15673,11 @@ function getCalleeIdentifierPath(callee) {
15571
15673
  return null;
15572
15674
  }
15573
15675
  function getCalleeLeftmostIdentifier(callee) {
15574
- if (ts15.isParenthesizedExpression(callee))
15676
+ if (ts16.isParenthesizedExpression(callee))
15575
15677
  return getCalleeLeftmostIdentifier(callee.expression);
15576
- if (ts15.isIdentifier(callee))
15678
+ if (ts16.isIdentifier(callee))
15577
15679
  return callee.text;
15578
- if (ts15.isPropertyAccessExpression(callee)) {
15680
+ if (ts16.isPropertyAccessExpression(callee)) {
15579
15681
  return getCalleeLeftmostIdentifier(callee.expression);
15580
15682
  }
15581
15683
  return null;
@@ -15623,12 +15725,12 @@ function isCallAcceptedByAdapter(call, env) {
15623
15725
  }
15624
15726
  function parseExpressionNode(text) {
15625
15727
  try {
15626
- const sf = ts15.createSourceFile("__inline_check__.ts", `(${text});`, ts15.ScriptTarget.Latest, false, ts15.ScriptKind.TS);
15728
+ const sf = ts16.createSourceFile("__inline_check__.ts", `(${text});`, ts16.ScriptTarget.Latest, false, ts16.ScriptKind.TS);
15627
15729
  const stmt = sf.statements[0];
15628
- if (!stmt || !ts15.isExpressionStatement(stmt))
15730
+ if (!stmt || !ts16.isExpressionStatement(stmt))
15629
15731
  return null;
15630
15732
  const inner = stmt.expression;
15631
- return ts15.isParenthesizedExpression(inner) ? inner.expression : inner;
15733
+ return ts16.isParenthesizedExpression(inner) ? inner.expression : inner;
15632
15734
  } catch {
15633
15735
  return null;
15634
15736
  }
@@ -15645,8 +15747,8 @@ function hasCallWithBridgedArg(node, decisions, env) {
15645
15747
  function visit3(n) {
15646
15748
  if (found)
15647
15749
  return;
15648
- if (ts15.isCallExpression(n) || ts15.isNewExpression(n)) {
15649
- const accepted = ts15.isCallExpression(n) && isCallAcceptedByAdapter(n, env);
15750
+ if (ts16.isCallExpression(n) || ts16.isNewExpression(n)) {
15751
+ const accepted = ts16.isCallExpression(n) && isCallAcceptedByAdapter(n, env);
15650
15752
  if (!accepted) {
15651
15753
  const args = n.arguments;
15652
15754
  if (args) {
@@ -15659,7 +15761,7 @@ function hasCallWithBridgedArg(node, decisions, env) {
15659
15761
  }
15660
15762
  }
15661
15763
  }
15662
- ts15.forEachChild(n, visit3);
15764
+ ts16.forEachChild(n, visit3);
15663
15765
  }
15664
15766
  visit3(node);
15665
15767
  return found;
@@ -15669,13 +15771,13 @@ function hasZeroArgCall(node, env) {
15669
15771
  function visit3(n) {
15670
15772
  if (found)
15671
15773
  return;
15672
- if (ts15.isCallExpression(n) && n.arguments.length === 0) {
15774
+ if (ts16.isCallExpression(n) && n.arguments.length === 0) {
15673
15775
  if (!isCallAcceptedByAdapter(n, env)) {
15674
15776
  found = true;
15675
15777
  return;
15676
15778
  }
15677
15779
  }
15678
- ts15.forEachChild(n, visit3);
15780
+ ts16.forEachChild(n, visit3);
15679
15781
  }
15680
15782
  visit3(node);
15681
15783
  return found;
@@ -15685,25 +15787,25 @@ function containsAnyIdentifier(node, names) {
15685
15787
  function visit3(n) {
15686
15788
  if (found)
15687
15789
  return;
15688
- if (ts15.isPropertyAccessExpression(n)) {
15790
+ if (ts16.isPropertyAccessExpression(n)) {
15689
15791
  visit3(n.expression);
15690
15792
  return;
15691
15793
  }
15692
- if (ts15.isPropertyAssignment(n)) {
15794
+ if (ts16.isPropertyAssignment(n)) {
15693
15795
  visit3(n.initializer);
15694
15796
  return;
15695
15797
  }
15696
- if (ts15.isShorthandPropertyAssignment(n)) {
15697
- if (ts15.isIdentifier(n.name) && names.has(n.name.text)) {
15798
+ if (ts16.isShorthandPropertyAssignment(n)) {
15799
+ if (ts16.isIdentifier(n.name) && names.has(n.name.text)) {
15698
15800
  found = true;
15699
15801
  }
15700
15802
  return;
15701
15803
  }
15702
- if (ts15.isIdentifier(n) && names.has(n.text)) {
15804
+ if (ts16.isIdentifier(n) && names.has(n.text)) {
15703
15805
  found = true;
15704
15806
  return;
15705
15807
  }
15706
- ts15.forEachChild(n, visit3);
15808
+ ts16.forEachChild(n, visit3);
15707
15809
  }
15708
15810
  visit3(node);
15709
15811
  return found;
@@ -16982,23 +17084,23 @@ function resolveFinalImports(generatedCode, ir, localImportPrefixes) {
16982
17084
  }
16983
17085
 
16984
17086
  // ../jsx/src/ir-to-client-js/prune-unused-prop-extractions.ts
16985
- import ts16 from "typescript";
17087
+ import ts17 from "typescript";
16986
17088
  function propExtractionName(stmt) {
16987
- if (!ts16.isVariableStatement(stmt))
17089
+ if (!ts17.isVariableStatement(stmt))
16988
17090
  return null;
16989
17091
  const decls = stmt.declarationList.declarations;
16990
17092
  if (decls.length !== 1)
16991
17093
  return null;
16992
17094
  const decl = decls[0];
16993
- if (!ts16.isIdentifier(decl.name) || !decl.initializer)
17095
+ if (!ts17.isIdentifier(decl.name) || !decl.initializer)
16994
17096
  return null;
16995
17097
  let core = decl.initializer;
16996
- if (ts16.isBinaryExpression(core) && core.operatorToken.kind === ts16.SyntaxKind.QuestionQuestionToken) {
17098
+ if (ts17.isBinaryExpression(core) && core.operatorToken.kind === ts17.SyntaxKind.QuestionQuestionToken) {
16997
17099
  core = core.left;
16998
17100
  }
16999
- if (!ts16.isPropertyAccessExpression(core))
17101
+ if (!ts17.isPropertyAccessExpression(core))
17000
17102
  return null;
17001
- if (!ts16.isIdentifier(core.expression) || core.expression.text !== PROPS_PARAM)
17103
+ if (!ts17.isIdentifier(core.expression) || core.expression.text !== PROPS_PARAM)
17002
17104
  return null;
17003
17105
  if (core.name.text !== decl.name.text)
17004
17106
  return null;
@@ -17011,10 +17113,10 @@ function pruneUnusedPropExtractions(code) {
17011
17113
  console.warn("[barefootjs] pruneUnusedPropExtractions: generated code did not parse; skipping prune");
17012
17114
  return code;
17013
17115
  }
17014
- const sourceFile = ts16.createSourceFile("generated.js", code, ts16.ScriptTarget.Latest, false, ts16.ScriptKind.JS);
17116
+ const sourceFile = ts17.createSourceFile("generated.js", code, ts17.ScriptTarget.Latest, false, ts17.ScriptKind.JS);
17015
17117
  const spans = [];
17016
17118
  for (const stmt of sourceFile.statements) {
17017
- if (!ts16.isFunctionDeclaration(stmt) || !stmt.name?.text.startsWith("init") || !stmt.body)
17119
+ if (!ts17.isFunctionDeclaration(stmt) || !stmt.name?.text.startsWith("init") || !stmt.body)
17018
17120
  continue;
17019
17121
  for (const inner of stmt.body.statements) {
17020
17122
  const name = propExtractionName(inner);
@@ -17976,7 +18078,8 @@ function buildReactiveEffectsPlan(args) {
17976
18078
  whenTrueTemplateHtml: addCondAttrToTemplate(wrap(cond.whenTrueHtml), cond.slotId),
17977
18079
  whenFalseTemplateHtml: addCondAttrToTemplate(wrap(cond.whenFalseHtml), cond.slotId),
17978
18080
  whenTrueArm: buildOuterArm(cond.whenTrue, wrap, loopParam, loopParamBindings, profileComponentName),
17979
- whenFalseArm: buildOuterArm(cond.whenFalse, wrap, loopParam, loopParamBindings, profileComponentName)
18081
+ whenFalseArm: buildOuterArm(cond.whenFalse, wrap, loopParam, loopParamBindings, profileComponentName),
18082
+ ...cond.readsPreamble && { readsPreamble: true }
17980
18083
  });
17981
18084
  }
17982
18085
  }
@@ -18457,7 +18560,7 @@ function analyzeLazyConditional(cond, indexParam, arms) {
18457
18560
  }
18458
18561
 
18459
18562
  // ../jsx/src/ir-to-client-js/control-flow/plan/lazy-preamble.ts
18460
- import ts17 from "typescript";
18563
+ import ts18 from "typescript";
18461
18564
  var NO_PREAMBLE = {
18462
18565
  lazySafe: true,
18463
18566
  facts: { declaredNames: new Set, freeNames: new Set }
@@ -18477,12 +18580,12 @@ function analyzeLazyPreamble(preamble, indexParam, primableNames) {
18477
18580
  if (text.trim().length === 0)
18478
18581
  return NO_PREAMBLE;
18479
18582
  const declaredNames = new Set;
18480
- const sf = ts17.createSourceFile("__lazy_preamble__.ts", text, ts17.ScriptTarget.Latest, true, ts17.ScriptKind.TS);
18583
+ const sf = ts18.createSourceFile("__lazy_preamble__.ts", text, ts18.ScriptTarget.Latest, true, ts18.ScriptKind.TS);
18481
18584
  for (const stmt of sf.statements) {
18482
- if (!ts17.isVariableStatement(stmt)) {
18483
- return NO2(`map-callback preamble has a non-declaration statement (${ts17.SyntaxKind[stmt.kind]})`);
18585
+ if (!ts18.isVariableStatement(stmt)) {
18586
+ return NO2(`map-callback preamble has a non-declaration statement (${ts18.SyntaxKind[stmt.kind]})`);
18484
18587
  }
18485
- const isConst = (stmt.declarationList.flags & ts17.NodeFlags.Const) !== 0;
18588
+ const isConst = (stmt.declarationList.flags & ts18.NodeFlags.Const) !== 0;
18486
18589
  if (!isConst)
18487
18590
  return NO2("map-callback preamble declares a mutable binding (let/var)");
18488
18591
  for (const decl of stmt.declarationList.declarations) {
@@ -18511,12 +18614,12 @@ function analyzeLazyPreamble(preamble, indexParam, primableNames) {
18511
18614
  return { lazySafe: true, facts: { declaredNames, freeNames } };
18512
18615
  }
18513
18616
  function collectBindingNames3(name, out) {
18514
- if (ts17.isIdentifier(name)) {
18617
+ if (ts18.isIdentifier(name)) {
18515
18618
  out.add(name.text);
18516
18619
  return;
18517
18620
  }
18518
18621
  for (const element of name.elements) {
18519
- if (ts17.isOmittedExpression(element))
18622
+ if (ts18.isOmittedExpression(element))
18520
18623
  continue;
18521
18624
  collectBindingNames3(element.name, out);
18522
18625
  }
@@ -18526,56 +18629,56 @@ function findImpureNode(root, primableNames) {
18526
18629
  const visit3 = (node) => {
18527
18630
  if (found)
18528
18631
  return;
18529
- if (ts17.isCallExpression(node)) {
18632
+ if (ts18.isCallExpression(node)) {
18530
18633
  const callee = node.expression;
18531
- const isSignalRead = ts17.isIdentifier(callee) && primableNames.has(callee.text) && node.arguments.length === 0 && node.questionDotToken === undefined;
18634
+ const isSignalRead = ts18.isIdentifier(callee) && primableNames.has(callee.text) && node.arguments.length === 0 && node.questionDotToken === undefined;
18532
18635
  if (!isSignalRead) {
18533
18636
  found = `call to ${callee.getText(callee.getSourceFile())}`;
18534
18637
  return;
18535
18638
  }
18536
18639
  }
18537
- if (ts17.isNewExpression(node)) {
18640
+ if (ts18.isNewExpression(node)) {
18538
18641
  found = "new expression";
18539
18642
  return;
18540
18643
  }
18541
- if (ts17.isTaggedTemplateExpression(node)) {
18644
+ if (ts18.isTaggedTemplateExpression(node)) {
18542
18645
  found = "tagged template";
18543
18646
  return;
18544
18647
  }
18545
- if (ts17.isAwaitExpression(node)) {
18648
+ if (ts18.isAwaitExpression(node)) {
18546
18649
  found = "await";
18547
18650
  return;
18548
18651
  }
18549
- if (ts17.isYieldExpression(node)) {
18652
+ if (ts18.isYieldExpression(node)) {
18550
18653
  found = "yield";
18551
18654
  return;
18552
18655
  }
18553
- if (ts17.isPrefixUnaryExpression(node) || ts17.isPostfixUnaryExpression(node)) {
18656
+ if (ts18.isPrefixUnaryExpression(node) || ts18.isPostfixUnaryExpression(node)) {
18554
18657
  const op = node.operator;
18555
- if (op === ts17.SyntaxKind.PlusPlusToken || op === ts17.SyntaxKind.MinusMinusToken) {
18658
+ if (op === ts18.SyntaxKind.PlusPlusToken || op === ts18.SyntaxKind.MinusMinusToken) {
18556
18659
  found = "increment/decrement";
18557
18660
  return;
18558
18661
  }
18559
18662
  }
18560
- if (ts17.isDeleteExpression(node)) {
18663
+ if (ts18.isDeleteExpression(node)) {
18561
18664
  found = "delete";
18562
18665
  return;
18563
18666
  }
18564
- if (ts17.isFunctionExpression(node) || ts17.isArrowFunction(node) || ts17.isClassExpression(node)) {
18667
+ if (ts18.isFunctionExpression(node) || ts18.isArrowFunction(node) || ts18.isClassExpression(node)) {
18565
18668
  found = "function or class expression";
18566
18669
  return;
18567
18670
  }
18568
- if (ts17.isBinaryExpression(node) && isAssignmentOperator(node.operatorToken.kind)) {
18671
+ if (ts18.isBinaryExpression(node) && isAssignmentOperator2(node.operatorToken.kind)) {
18569
18672
  found = "assignment";
18570
18673
  return;
18571
18674
  }
18572
- ts17.forEachChild(node, visit3);
18675
+ ts18.forEachChild(node, visit3);
18573
18676
  };
18574
18677
  visit3(root);
18575
18678
  return found;
18576
18679
  }
18577
- function isAssignmentOperator(kind) {
18578
- return kind >= ts17.SyntaxKind.FirstAssignment && kind <= ts17.SyntaxKind.LastAssignment;
18680
+ function isAssignmentOperator2(kind) {
18681
+ return kind >= ts18.SyntaxKind.FirstAssignment && kind <= ts18.SyntaxKind.LastAssignment;
18579
18682
  }
18580
18683
 
18581
18684
  // ../jsx/src/ir-to-client-js/control-flow/plan/lazy-row-eligibility.ts
@@ -19105,7 +19208,7 @@ function buildArmBody(branch, options) {
19105
19208
  }
19106
19209
 
19107
19210
  // ../jsx/src/ir-to-client-js/emit-reactive.ts
19108
- import ts18 from "typescript";
19211
+ import ts19 from "typescript";
19109
19212
 
19110
19213
  // ../jsx/src/ir-to-client-js/control-flow/stringify/claim-plan.ts
19111
19214
  function slotSpecLiteral(slot) {
@@ -19209,20 +19312,20 @@ function lowerToLocaleCallsInReactiveExpr(expr, matcher) {
19209
19312
  return expr;
19210
19313
  let sourceFile;
19211
19314
  try {
19212
- sourceFile = ts18.createSourceFile("__reactive_expr__.ts", `(${expr});`, ts18.ScriptTarget.Latest, true, ts18.ScriptKind.TS);
19315
+ sourceFile = ts19.createSourceFile("__reactive_expr__.ts", `(${expr});`, ts19.ScriptTarget.Latest, true, ts19.ScriptKind.TS);
19213
19316
  } catch {
19214
19317
  return expr;
19215
19318
  }
19216
19319
  const stmt = sourceFile.statements[0];
19217
- if (!stmt || !ts18.isExpressionStatement(stmt))
19320
+ if (!stmt || !ts19.isExpressionStatement(stmt))
19218
19321
  return expr;
19219
- const root = ts18.isParenthesizedExpression(stmt.expression) ? stmt.expression.expression : stmt.expression;
19322
+ const root = ts19.isParenthesizedExpression(stmt.expression) ? stmt.expression.expression : stmt.expression;
19220
19323
  const candidates = [];
19221
19324
  const visit3 = (n) => {
19222
- if (ts18.isCallExpression(n) && n.arguments.length === 2 && ts18.isPropertyAccessExpression(n.expression) && !n.expression.questionDotToken && n.expression.name.text === "toLocaleDateString") {
19325
+ if (ts19.isCallExpression(n) && n.arguments.length === 2 && ts19.isPropertyAccessExpression(n.expression) && !n.expression.questionDotToken && n.expression.name.text === "toLocaleDateString") {
19223
19326
  candidates.push(n);
19224
19327
  }
19225
- ts18.forEachChild(n, visit3);
19328
+ ts19.forEachChild(n, visit3);
19226
19329
  };
19227
19330
  visit3(root);
19228
19331
  if (candidates.length === 0)
@@ -19258,20 +19361,20 @@ function lowerDateCallsInReactiveExpr(expr, matcher) {
19258
19361
  return expr;
19259
19362
  let sourceFile;
19260
19363
  try {
19261
- sourceFile = ts18.createSourceFile("__reactive_expr__.ts", `(${expr});`, ts18.ScriptTarget.Latest, true, ts18.ScriptKind.TS);
19364
+ sourceFile = ts19.createSourceFile("__reactive_expr__.ts", `(${expr});`, ts19.ScriptTarget.Latest, true, ts19.ScriptKind.TS);
19262
19365
  } catch {
19263
19366
  return expr;
19264
19367
  }
19265
19368
  const stmt = sourceFile.statements[0];
19266
- if (!stmt || !ts18.isExpressionStatement(stmt))
19369
+ if (!stmt || !ts19.isExpressionStatement(stmt))
19267
19370
  return expr;
19268
- const root = ts18.isParenthesizedExpression(stmt.expression) ? stmt.expression.expression : stmt.expression;
19371
+ const root = ts19.isParenthesizedExpression(stmt.expression) ? stmt.expression.expression : stmt.expression;
19269
19372
  const candidates = [];
19270
19373
  const visit3 = (n) => {
19271
- if (ts18.isCallExpression(n) && n.arguments.length === 0 && ts18.isPropertyAccessExpression(n.expression) && !n.expression.questionDotToken && DATE_METHODS.has(n.expression.name.text)) {
19374
+ if (ts19.isCallExpression(n) && n.arguments.length === 0 && ts19.isPropertyAccessExpression(n.expression) && !n.expression.questionDotToken && DATE_METHODS.has(n.expression.name.text)) {
19272
19375
  candidates.push(n);
19273
19376
  }
19274
- ts18.forEachChild(n, visit3);
19377
+ ts19.forEachChild(n, visit3);
19275
19378
  };
19276
19379
  visit3(root);
19277
19380
  if (candidates.length === 0)
@@ -19586,7 +19689,7 @@ function stringifyReactiveEffects(lines, plan, opts) {
19586
19689
  emitConsolidatedRowEffect(lines, indent, elVar, lookup, attrSlots, outerTexts, elementIndexBySlot, textClaimPathExprs, preambleRegions, mapPreambleWrapped);
19587
19690
  }
19588
19691
  for (const cond of conditionals) {
19589
- emitOuterConditional(lines, indent, elVar, cond, pc);
19692
+ emitOuterConditional(lines, indent, elVar, cond, pc, mapPreambleWrapped);
19590
19693
  }
19591
19694
  }
19592
19695
  function emitAttrSlotsGranular(lines, indent, elVar, lookup, attrSlots, elementIndexBySlot, bindingBfId, mapPreambleWrapped) {
@@ -19688,9 +19791,10 @@ function emitOuterTexts(lines, indent, elVar, texts, bindingBfId, textClaimPathE
19688
19791
  lines.push(`${indent}createEffect(() => { ${writer}('${text.slotId}', String(${text.wrappedExpression})) }${bindingBfId(text.slotId)})`);
19689
19792
  }
19690
19793
  }
19691
- function emitOuterConditional(lines, indent, elVar, cond, pc) {
19794
+ function emitOuterConditional(lines, indent, elVar, cond, pc, mapPreambleWrapped) {
19692
19795
  const armIndent = `${indent} `;
19693
- lines.push(`${indent}insert(${elVar}, '${cond.slotId}', () => ${cond.wrappedCondition}, {`);
19796
+ const conditionGetter = cond.readsPreamble && mapPreambleWrapped ? `() => { ${mapPreambleWrapped}; return (${cond.wrappedCondition}) }` : `() => ${cond.wrappedCondition}`;
19797
+ lines.push(`${indent}insert(${elVar}, '${cond.slotId}', ${conditionGetter}, {`);
19694
19798
  lines.push(`${indent} template: () => { const __slots = []; return { html: \`${cond.whenTrueTemplateHtml}\`, slots: __slots } },`);
19695
19799
  lines.push(`${indent} bindEvents: (__branchScope, { isFirstRun: __bfFirstRun = false } = {}) => {`);
19696
19800
  stringifyLoopChildArm(lines, cond.whenTrueArm, armIndent, pc);
@@ -21274,20 +21378,20 @@ var PHASES = [
21274
21378
  ];
21275
21379
 
21276
21380
  // ../jsx/src/ir-to-client-js/rewrite-props-object.ts
21277
- import ts19 from "typescript";
21381
+ import ts20 from "typescript";
21278
21382
  function rewritePropsObjectRef(code, propsObjectName) {
21279
21383
  const srcPropsName = propsObjectName ?? "props";
21280
21384
  if (srcPropsName === PROPS_PARAM)
21281
21385
  return code;
21282
21386
  if (!identifierPattern(srcPropsName).test(code))
21283
21387
  return code;
21284
- const sourceFile = ts19.createSourceFile("init-body.ts", code, ts19.ScriptTarget.Latest, true, ts19.ScriptKind.TS);
21388
+ const sourceFile = ts20.createSourceFile("init-body.ts", code, ts20.ScriptTarget.Latest, true, ts20.ScriptKind.TS);
21285
21389
  const spans = [];
21286
21390
  function visit3(node) {
21287
- if (ts19.isIdentifier(node) && node.text === srcPropsName && shouldRewrite(node)) {
21391
+ if (ts20.isIdentifier(node) && node.text === srcPropsName && shouldRewrite(node)) {
21288
21392
  spans.push([node.getStart(sourceFile), node.getEnd()]);
21289
21393
  }
21290
- ts19.forEachChild(node, visit3);
21394
+ ts20.forEachChild(node, visit3);
21291
21395
  }
21292
21396
  visit3(sourceFile);
21293
21397
  if (spans.length === 0)
@@ -21303,17 +21407,17 @@ function shouldRewrite(node) {
21303
21407
  const parent = node.parent;
21304
21408
  if (!parent)
21305
21409
  return true;
21306
- if (ts19.isPropertyAccessExpression(parent) && parent.name === node)
21410
+ if (ts20.isPropertyAccessExpression(parent) && parent.name === node)
21307
21411
  return false;
21308
- if (ts19.isPropertyAssignment(parent) && parent.name === node)
21412
+ if (ts20.isPropertyAssignment(parent) && parent.name === node)
21309
21413
  return false;
21310
- if (ts19.isShorthandPropertyAssignment(parent) && parent.name === node)
21414
+ if (ts20.isShorthandPropertyAssignment(parent) && parent.name === node)
21311
21415
  return false;
21312
- if (ts19.isPropertySignature(parent) && parent.name === node)
21416
+ if (ts20.isPropertySignature(parent) && parent.name === node)
21313
21417
  return false;
21314
- if (ts19.isPropertyDeclaration(parent) && parent.name === node)
21418
+ if (ts20.isPropertyDeclaration(parent) && parent.name === node)
21315
21419
  return false;
21316
- if (ts19.isBindingElement(parent) && parent.name === node)
21420
+ if (ts20.isBindingElement(parent) && parent.name === node)
21317
21421
  return false;
21318
21422
  return true;
21319
21423
  }
@@ -21964,7 +22068,7 @@ function walkIR2(node, visitor) {
21964
22068
  }
21965
22069
 
21966
22070
  // ../jsx/src/preprocess-inline-jsx-callbacks.ts
21967
- import ts20 from "typescript";
22071
+ import ts21 from "typescript";
21968
22072
  var SYNTHETIC_PREFIX = "BFInlineJsxCallback";
21969
22073
  var MAX_FIXPOINT_ITERATIONS = 16;
21970
22074
  function preprocessInlineJsxCallbacks(source, filePath) {
@@ -21986,8 +22090,8 @@ function preprocessInlineJsxCallbacks(source, filePath) {
21986
22090
  return { source: current, errors, syntheticNames };
21987
22091
  }
21988
22092
  function runSinglePass(source, filePath, startingCounter) {
21989
- const sourceFile = ts20.createSourceFile(filePath, source, ts20.ScriptTarget.Latest, true, ts20.ScriptKind.TSX);
21990
- const hasUseClient = sourceFile.statements.some((stmt) => ts20.isExpressionStatement(stmt) && ts20.isStringLiteral(stmt.expression) && (stmt.expression.text === "use client" || stmt.expression.text === "'use client'"));
22093
+ const sourceFile = ts21.createSourceFile(filePath, source, ts21.ScriptTarget.Latest, true, ts21.ScriptKind.TSX);
22094
+ const hasUseClient = sourceFile.statements.some((stmt) => ts21.isExpressionStatement(stmt) && ts21.isStringLiteral(stmt.expression) && (stmt.expression.text === "use client" || stmt.expression.text === "'use client'"));
21991
22095
  if (!hasUseClient) {
21992
22096
  return { source, errors: [], syntheticNames: [], counterAfter: startingCounter };
21993
22097
  }
@@ -22009,22 +22113,22 @@ function runSinglePass(source, filePath, startingCounter) {
22009
22113
  }
22010
22114
  }
22011
22115
  function visit3(node) {
22012
- if (ts20.isJsxAttribute(node) && node.initializer && ts20.isJsxExpression(node.initializer) && node.initializer.expression) {
22116
+ if (ts21.isJsxAttribute(node) && node.initializer && ts21.isJsxExpression(node.initializer) && node.initializer.expression) {
22013
22117
  if (tryHandleArrowValue(node.initializer.expression)) {
22014
22118
  return;
22015
22119
  }
22016
22120
  }
22017
- if (ts20.isPropertyAssignment(node) && node.initializer) {
22121
+ if (ts21.isPropertyAssignment(node) && node.initializer) {
22018
22122
  if (tryHandleArrowValue(node.initializer))
22019
22123
  return;
22020
22124
  }
22021
- ts20.forEachChild(node, visit3);
22125
+ ts21.forEachChild(node, visit3);
22022
22126
  }
22023
22127
  function tryHandleArrowValue(initializer) {
22024
22128
  let expr = initializer;
22025
- while (ts20.isParenthesizedExpression(expr))
22129
+ while (ts21.isParenthesizedExpression(expr))
22026
22130
  expr = expr.expression;
22027
- if (ts20.isArrowFunction(expr) && arrowBodyContainsJsx(expr)) {
22131
+ if (ts21.isArrowFunction(expr) && arrowBodyContainsJsx(expr)) {
22028
22132
  return handleInlineArrow(expr);
22029
22133
  }
22030
22134
  return false;
@@ -22061,7 +22165,7 @@ function runSinglePass(source, filePath, startingCounter) {
22061
22165
  replacements.push({ start: arrowStart, end: arrowEnd, text: name });
22062
22166
  return true;
22063
22167
  }
22064
- ts20.forEachChild(sourceFile, visit3);
22168
+ ts21.forEachChild(sourceFile, visit3);
22065
22169
  if (replacements.length === 0) {
22066
22170
  return { source, errors, syntheticNames, counterAfter: counter };
22067
22171
  }
@@ -22084,11 +22188,11 @@ function errorMessageForCapture(captures) {
22084
22188
  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.`;
22085
22189
  }
22086
22190
  function arrowBodyContainsJsx(arrow) {
22087
- if (ts20.isBlock(arrow.body)) {
22191
+ if (ts21.isBlock(arrow.body)) {
22088
22192
  return blockReturnsJsx(arrow.body);
22089
22193
  }
22090
22194
  let body = arrow.body;
22091
- while (ts20.isParenthesizedExpression(body))
22195
+ while (ts21.isParenthesizedExpression(body))
22092
22196
  body = body.expression;
22093
22197
  return isJsxLike(body);
22094
22198
  }
@@ -22097,24 +22201,24 @@ function blockReturnsJsx(block) {
22097
22201
  function visit3(n) {
22098
22202
  if (found)
22099
22203
  return;
22100
- if (ts20.isReturnStatement(n) && n.expression) {
22204
+ if (ts21.isReturnStatement(n) && n.expression) {
22101
22205
  let e = n.expression;
22102
- while (ts20.isParenthesizedExpression(e))
22206
+ while (ts21.isParenthesizedExpression(e))
22103
22207
  e = e.expression;
22104
22208
  if (isJsxLike(e)) {
22105
22209
  found = true;
22106
22210
  return;
22107
22211
  }
22108
22212
  }
22109
- if (ts20.isArrowFunction(n) || ts20.isFunctionDeclaration(n) || ts20.isFunctionExpression(n))
22213
+ if (ts21.isArrowFunction(n) || ts21.isFunctionDeclaration(n) || ts21.isFunctionExpression(n))
22110
22214
  return;
22111
- ts20.forEachChild(n, visit3);
22215
+ ts21.forEachChild(n, visit3);
22112
22216
  }
22113
- ts20.forEachChild(block, visit3);
22217
+ ts21.forEachChild(block, visit3);
22114
22218
  return found;
22115
22219
  }
22116
22220
  function isJsxLike(expr) {
22117
- return ts20.isJsxElement(expr) || ts20.isJsxSelfClosingElement(expr) || ts20.isJsxFragment(expr);
22221
+ return ts21.isJsxElement(expr) || ts21.isJsxSelfClosingElement(expr) || ts21.isJsxFragment(expr);
22118
22222
  }
22119
22223
  function collectArrowParamNames(arrow) {
22120
22224
  const names = new Set;
@@ -22124,13 +22228,13 @@ function collectArrowParamNames(arrow) {
22124
22228
  }
22125
22229
  function collectBindingNames4(name, out) {
22126
22230
  const push = Array.isArray(out) ? (n) => out.push(n) : (n) => out.add(n);
22127
- if (ts20.isIdentifier(name)) {
22231
+ if (ts21.isIdentifier(name)) {
22128
22232
  push(name.text);
22129
- } else if (ts20.isObjectBindingPattern(name)) {
22233
+ } else if (ts21.isObjectBindingPattern(name)) {
22130
22234
  name.elements.forEach((el) => collectBindingNames4(el.name, out));
22131
- } else if (ts20.isArrayBindingPattern(name)) {
22235
+ } else if (ts21.isArrayBindingPattern(name)) {
22132
22236
  name.elements.forEach((el) => {
22133
- if (!ts20.isOmittedExpression(el))
22237
+ if (!ts21.isOmittedExpression(el))
22134
22238
  collectBindingNames4(el.name, out);
22135
22239
  });
22136
22240
  }
@@ -22157,48 +22261,48 @@ function collectFreeIdentifiers(arrow) {
22157
22261
  return bound.includes(name);
22158
22262
  }
22159
22263
  function visit3(node) {
22160
- if (ts20.isIdentifier(node)) {
22264
+ if (ts21.isIdentifier(node)) {
22161
22265
  const parent = node.parent;
22162
- if (parent && ts20.isPropertyAccessExpression(parent) && parent.name === node)
22266
+ if (parent && ts21.isPropertyAccessExpression(parent) && parent.name === node)
22163
22267
  return;
22164
- if (parent && ts20.isPropertyAssignment(parent) && parent.name === node)
22268
+ if (parent && ts21.isPropertyAssignment(parent) && parent.name === node)
22165
22269
  return;
22166
- if (parent && ts20.isPropertySignature(parent) && parent.name === node)
22270
+ if (parent && ts21.isPropertySignature(parent) && parent.name === node)
22167
22271
  return;
22168
- if (parent && ts20.isPropertyDeclaration(parent) && parent.name === node)
22272
+ if (parent && ts21.isPropertyDeclaration(parent) && parent.name === node)
22169
22273
  return;
22170
- if (parent && ts20.isMethodDeclaration(parent) && parent.name === node)
22274
+ if (parent && ts21.isMethodDeclaration(parent) && parent.name === node)
22171
22275
  return;
22172
- if (parent && ts20.isMethodSignature(parent) && parent.name === node)
22276
+ if (parent && ts21.isMethodSignature(parent) && parent.name === node)
22173
22277
  return;
22174
- if (parent && ts20.isGetAccessorDeclaration(parent) && parent.name === node)
22278
+ if (parent && ts21.isGetAccessorDeclaration(parent) && parent.name === node)
22175
22279
  return;
22176
- if (parent && ts20.isSetAccessorDeclaration(parent) && parent.name === node)
22280
+ if (parent && ts21.isSetAccessorDeclaration(parent) && parent.name === node)
22177
22281
  return;
22178
- if (parent && ts20.isEnumMember(parent) && parent.name === node)
22282
+ if (parent && ts21.isEnumMember(parent) && parent.name === node)
22179
22283
  return;
22180
- if (parent && ts20.isBindingElement(parent) && parent.propertyName === node)
22284
+ if (parent && ts21.isBindingElement(parent) && parent.propertyName === node)
22181
22285
  return;
22182
- if (parent && ts20.isShorthandPropertyAssignment(parent) && parent.name === node) {
22286
+ if (parent && ts21.isShorthandPropertyAssignment(parent) && parent.name === node) {
22183
22287
  if (!isBound(node.text))
22184
22288
  ids.add(node.text);
22185
22289
  return;
22186
22290
  }
22187
- if (parent && ts20.isParameter(parent) && parent.name === node)
22291
+ if (parent && ts21.isParameter(parent) && parent.name === node)
22188
22292
  return;
22189
- if (parent && ts20.isVariableDeclaration(parent) && parent.name === node)
22293
+ if (parent && ts21.isVariableDeclaration(parent) && parent.name === node)
22190
22294
  return;
22191
- if (parent && ts20.isFunctionDeclaration(parent) && parent.name === node)
22295
+ if (parent && ts21.isFunctionDeclaration(parent) && parent.name === node)
22192
22296
  return;
22193
- if (parent && ts20.isClassDeclaration(parent) && parent.name === node)
22297
+ if (parent && ts21.isClassDeclaration(parent) && parent.name === node)
22194
22298
  return;
22195
- if (parent && ts20.isJsxAttribute(parent) && parent.name === node)
22299
+ if (parent && ts21.isJsxAttribute(parent) && parent.name === node)
22196
22300
  return;
22197
- if (parent && ts20.isJsxOpeningElement(parent) && parent.tagName === node) {
22301
+ if (parent && ts21.isJsxOpeningElement(parent) && parent.tagName === node) {
22198
22302
  if (/^[a-z]/.test(node.text))
22199
22303
  return;
22200
22304
  }
22201
- if (parent && ts20.isJsxClosingElement(parent) && parent.tagName === node) {
22305
+ if (parent && ts21.isJsxClosingElement(parent) && parent.tagName === node) {
22202
22306
  if (/^[a-z]/.test(node.text))
22203
22307
  return;
22204
22308
  }
@@ -22207,43 +22311,43 @@ function collectFreeIdentifiers(arrow) {
22207
22311
  ids.add(node.text);
22208
22312
  return;
22209
22313
  }
22210
- if (ts20.isVariableDeclaration(node)) {
22314
+ if (ts21.isVariableDeclaration(node)) {
22211
22315
  const declared = pushBindings(node.name);
22212
22316
  if (node.initializer)
22213
22317
  visit3(node.initializer);
22214
22318
  return;
22215
22319
  }
22216
- if (ts20.isFunctionDeclaration(node)) {
22320
+ if (ts21.isFunctionDeclaration(node)) {
22217
22321
  if (node.name)
22218
22322
  bound.push(node.name.text);
22219
22323
  visitInsideNewScope(node);
22220
22324
  return;
22221
22325
  }
22222
- if (ts20.isClassDeclaration(node)) {
22326
+ if (ts21.isClassDeclaration(node)) {
22223
22327
  if (node.name)
22224
22328
  bound.push(node.name.text);
22225
- ts20.forEachChild(node, visit3);
22329
+ ts21.forEachChild(node, visit3);
22226
22330
  return;
22227
22331
  }
22228
- if (ts20.isArrowFunction(node) || ts20.isFunctionExpression(node)) {
22332
+ if (ts21.isArrowFunction(node) || ts21.isFunctionExpression(node)) {
22229
22333
  visitInsideNewScope(node);
22230
22334
  return;
22231
22335
  }
22232
- if (ts20.isCatchClause(node)) {
22336
+ if (ts21.isCatchClause(node)) {
22233
22337
  const before = bound.length;
22234
22338
  if (node.variableDeclaration)
22235
22339
  pushBindings(node.variableDeclaration.name);
22236
- ts20.forEachChild(node, visit3);
22340
+ ts21.forEachChild(node, visit3);
22237
22341
  popN(bound.length - before);
22238
22342
  return;
22239
22343
  }
22240
- if (ts20.isBlock(node)) {
22344
+ if (ts21.isBlock(node)) {
22241
22345
  const before = bound.length;
22242
- ts20.forEachChild(node, visit3);
22346
+ ts21.forEachChild(node, visit3);
22243
22347
  popN(bound.length - before);
22244
22348
  return;
22245
22349
  }
22246
- ts20.forEachChild(node, visit3);
22350
+ ts21.forEachChild(node, visit3);
22247
22351
  }
22248
22352
  function visitInsideNewScope(fn) {
22249
22353
  const before = bound.length;
@@ -22266,29 +22370,29 @@ function collectFreeIdentifiers(arrow) {
22266
22370
  function collectModuleScopeNames(sourceFile) {
22267
22371
  const names = new Set;
22268
22372
  for (const stmt of sourceFile.statements) {
22269
- if (ts20.isFunctionDeclaration(stmt) && stmt.name)
22373
+ if (ts21.isFunctionDeclaration(stmt) && stmt.name)
22270
22374
  names.add(stmt.name.text);
22271
- else if (ts20.isClassDeclaration(stmt) && stmt.name)
22375
+ else if (ts21.isClassDeclaration(stmt) && stmt.name)
22272
22376
  names.add(stmt.name.text);
22273
- else if (ts20.isVariableStatement(stmt)) {
22377
+ else if (ts21.isVariableStatement(stmt)) {
22274
22378
  for (const decl of stmt.declarationList.declarations)
22275
22379
  collectBindingNames4(decl.name, names);
22276
- } else if (ts20.isImportDeclaration(stmt) && stmt.importClause) {
22380
+ } else if (ts21.isImportDeclaration(stmt) && stmt.importClause) {
22277
22381
  const ic = stmt.importClause;
22278
22382
  if (ic.name)
22279
22383
  names.add(ic.name.text);
22280
22384
  if (ic.namedBindings) {
22281
- if (ts20.isNamespaceImport(ic.namedBindings))
22385
+ if (ts21.isNamespaceImport(ic.namedBindings))
22282
22386
  names.add(ic.namedBindings.name.text);
22283
22387
  else
22284
22388
  for (const e of ic.namedBindings.elements)
22285
22389
  names.add(e.name.text);
22286
22390
  }
22287
- } else if (ts20.isTypeAliasDeclaration(stmt))
22391
+ } else if (ts21.isTypeAliasDeclaration(stmt))
22288
22392
  names.add(stmt.name.text);
22289
- else if (ts20.isInterfaceDeclaration(stmt))
22393
+ else if (ts21.isInterfaceDeclaration(stmt))
22290
22394
  names.add(stmt.name.text);
22291
- else if (ts20.isEnumDeclaration(stmt))
22395
+ else if (ts21.isEnumDeclaration(stmt))
22292
22396
  names.add(stmt.name.text);
22293
22397
  }
22294
22398
  return names;
@@ -22296,7 +22400,7 @@ function collectModuleScopeNames(sourceFile) {
22296
22400
  function buildSyntheticDeclaration(name, arrow, sourceFile) {
22297
22401
  const paramsText = arrow.parameters.length === 0 ? "" : arrow.parameters.map((p) => p.getText(sourceFile)).join(", ");
22298
22402
  let bodyText;
22299
- if (ts20.isBlock(arrow.body)) {
22403
+ if (ts21.isBlock(arrow.body)) {
22300
22404
  bodyText = arrow.body.getText(sourceFile);
22301
22405
  } else {
22302
22406
  const expr = arrow.body.getText(sourceFile);
@@ -22306,7 +22410,7 @@ function buildSyntheticDeclaration(name, arrow, sourceFile) {
22306
22410
  }
22307
22411
 
22308
22412
  // ../jsx/src/ssr-defaults.ts
22309
- import ts21 from "typescript";
22413
+ import ts22 from "typescript";
22310
22414
  var UNRESOLVED = Symbol("unresolved");
22311
22415
  var NO_RETURN = Symbol("no-return");
22312
22416
  function extractSsrDefaults(metadata) {
@@ -22383,11 +22487,11 @@ function collectPropRefs(expr, propsObjectName, out) {
22383
22487
  if (!node)
22384
22488
  return;
22385
22489
  const visit3 = (n) => {
22386
- if (ts21.isPropertyAccessExpression(n) && ts21.isIdentifier(n.expression) && n.expression.text === propsObjectName && ts21.isIdentifier(n.name)) {
22490
+ if (ts22.isPropertyAccessExpression(n) && ts22.isIdentifier(n.expression) && n.expression.text === propsObjectName && ts22.isIdentifier(n.name)) {
22387
22491
  out.add(n.name.text);
22388
22492
  return;
22389
22493
  }
22390
- ts21.forEachChild(n, visit3);
22494
+ ts22.forEachChild(n, visit3);
22391
22495
  };
22392
22496
  visit3(node);
22393
22497
  }
@@ -22408,23 +22512,23 @@ function tryStaticEval(expr, ctx) {
22408
22512
  }
22409
22513
  function evalStatementsForReturn(statements, ctx) {
22410
22514
  for (const stmt of statements) {
22411
- if (ts21.isVariableStatement(stmt)) {
22515
+ if (ts22.isVariableStatement(stmt)) {
22412
22516
  for (const d of stmt.declarationList.declarations) {
22413
- if (!ts21.isIdentifier(d.name) || !d.initializer)
22517
+ if (!ts22.isIdentifier(d.name) || !d.initializer)
22414
22518
  continue;
22415
22519
  const v = evalNode(d.initializer, ctx);
22416
22520
  if (v !== UNRESOLVED)
22417
22521
  ctx.bindings[d.name.text] = v;
22418
22522
  }
22419
- } else if (ts21.isReturnStatement(stmt)) {
22523
+ } else if (ts22.isReturnStatement(stmt)) {
22420
22524
  return stmt.expression ? evalNode(stmt.expression, ctx) : UNRESOLVED;
22421
- } else if (ts21.isIfStatement(stmt)) {
22525
+ } else if (ts22.isIfStatement(stmt)) {
22422
22526
  const cond = evalNode(stmt.expression, ctx);
22423
22527
  if (cond === UNRESOLVED)
22424
22528
  return UNRESOLVED;
22425
22529
  const branch = cond ? stmt.thenStatement : stmt.elseStatement;
22426
22530
  if (branch) {
22427
- const taken = evalStatementsForReturn(ts21.isBlock(branch) ? branch.statements : [branch], ctx);
22531
+ const taken = evalStatementsForReturn(ts22.isBlock(branch) ? branch.statements : [branch], ctx);
22428
22532
  if (taken !== NO_RETURN)
22429
22533
  return taken;
22430
22534
  }
@@ -22435,45 +22539,45 @@ function evalStatementsForReturn(statements, ctx) {
22435
22539
  return NO_RETURN;
22436
22540
  }
22437
22541
  function parseExpression2(expr) {
22438
- const sf = ts21.createSourceFile("__ssr_default__.ts", `(${expr})`, ts21.ScriptTarget.Latest, false, ts21.ScriptKind.TS);
22542
+ const sf = ts22.createSourceFile("__ssr_default__.ts", `(${expr})`, ts22.ScriptTarget.Latest, false, ts22.ScriptKind.TS);
22439
22543
  const stmt = sf.statements[0];
22440
- if (!stmt || !ts21.isExpressionStatement(stmt))
22544
+ if (!stmt || !ts22.isExpressionStatement(stmt))
22441
22545
  return null;
22442
- const inner = ts21.isParenthesizedExpression(stmt.expression) ? stmt.expression.expression : stmt.expression;
22546
+ const inner = ts22.isParenthesizedExpression(stmt.expression) ? stmt.expression.expression : stmt.expression;
22443
22547
  return inner;
22444
22548
  }
22445
22549
  function evalNode(node, ctx) {
22446
- if (ts21.isParenthesizedExpression(node))
22550
+ if (ts22.isParenthesizedExpression(node))
22447
22551
  return evalNode(node.expression, ctx);
22448
- if (ts21.isAsExpression(node))
22552
+ if (ts22.isAsExpression(node))
22449
22553
  return evalNode(node.expression, ctx);
22450
- if (ts21.isSatisfiesExpression(node))
22554
+ if (ts22.isSatisfiesExpression(node))
22451
22555
  return evalNode(node.expression, ctx);
22452
- if (ts21.isTypeAssertionExpression(node))
22556
+ if (ts22.isTypeAssertionExpression(node))
22453
22557
  return evalNode(node.expression, ctx);
22454
- if (ts21.isNonNullExpression(node))
22558
+ if (ts22.isNonNullExpression(node))
22455
22559
  return evalNode(node.expression, ctx);
22456
- if (ts21.isArrowFunction(node)) {
22560
+ if (ts22.isArrowFunction(node)) {
22457
22561
  if (node.parameters.length !== 0)
22458
22562
  return UNRESOLVED;
22459
- if (!ts21.isBlock(node.body))
22563
+ if (!ts22.isBlock(node.body))
22460
22564
  return evalNode(node.body, ctx);
22461
22565
  const localBindings = { ...ctx.bindings };
22462
22566
  const localCtx = { ...ctx, bindings: localBindings };
22463
22567
  const result = evalStatementsForReturn(node.body.statements, localCtx);
22464
22568
  return result === NO_RETURN ? UNRESOLVED : result;
22465
22569
  }
22466
- if (ts21.isNumericLiteral(node))
22570
+ if (ts22.isNumericLiteral(node))
22467
22571
  return Number(node.text);
22468
- if (ts21.isStringLiteralLike(node))
22572
+ if (ts22.isStringLiteralLike(node))
22469
22573
  return node.text;
22470
- if (node.kind === ts21.SyntaxKind.TrueKeyword)
22574
+ if (node.kind === ts22.SyntaxKind.TrueKeyword)
22471
22575
  return true;
22472
- if (node.kind === ts21.SyntaxKind.FalseKeyword)
22576
+ if (node.kind === ts22.SyntaxKind.FalseKeyword)
22473
22577
  return false;
22474
- if (node.kind === ts21.SyntaxKind.NullKeyword)
22578
+ if (node.kind === ts22.SyntaxKind.NullKeyword)
22475
22579
  return null;
22476
- if (ts21.isIdentifier(node)) {
22580
+ if (ts22.isIdentifier(node)) {
22477
22581
  if (node.text === "undefined")
22478
22582
  return;
22479
22583
  if (node.text in ctx.bindings)
@@ -22482,29 +22586,29 @@ function evalNode(node, ctx) {
22482
22586
  return;
22483
22587
  return UNRESOLVED;
22484
22588
  }
22485
- if (ts21.isPrefixUnaryExpression(node)) {
22589
+ if (ts22.isPrefixUnaryExpression(node)) {
22486
22590
  const arg = evalNode(node.operand, ctx);
22487
22591
  if (arg === UNRESOLVED)
22488
22592
  return UNRESOLVED;
22489
22593
  switch (node.operator) {
22490
- case ts21.SyntaxKind.MinusToken:
22594
+ case ts22.SyntaxKind.MinusToken:
22491
22595
  return typeof arg === "number" ? -arg : UNRESOLVED;
22492
- case ts21.SyntaxKind.PlusToken:
22596
+ case ts22.SyntaxKind.PlusToken:
22493
22597
  return typeof arg === "number" ? +arg : UNRESOLVED;
22494
- case ts21.SyntaxKind.ExclamationToken:
22598
+ case ts22.SyntaxKind.ExclamationToken:
22495
22599
  return !arg;
22496
22600
  }
22497
22601
  return UNRESOLVED;
22498
22602
  }
22499
- if (ts21.isObjectLiteralExpression(node)) {
22603
+ if (ts22.isObjectLiteralExpression(node)) {
22500
22604
  const obj = {};
22501
22605
  for (const prop of node.properties) {
22502
- if (!ts21.isPropertyAssignment(prop))
22606
+ if (!ts22.isPropertyAssignment(prop))
22503
22607
  return UNRESOLVED;
22504
22608
  let key;
22505
- if (ts21.isIdentifier(prop.name) || ts21.isStringLiteralLike(prop.name)) {
22609
+ if (ts22.isIdentifier(prop.name) || ts22.isStringLiteralLike(prop.name)) {
22506
22610
  key = prop.name.text;
22507
- } else if (ts21.isNumericLiteral(prop.name)) {
22611
+ } else if (ts22.isNumericLiteral(prop.name)) {
22508
22612
  key = prop.name.text;
22509
22613
  } else {
22510
22614
  return UNRESOLVED;
@@ -22516,10 +22620,10 @@ function evalNode(node, ctx) {
22516
22620
  }
22517
22621
  return obj;
22518
22622
  }
22519
- if (ts21.isArrayLiteralExpression(node)) {
22623
+ if (ts22.isArrayLiteralExpression(node)) {
22520
22624
  const arr = [];
22521
22625
  for (const elem of node.elements) {
22522
- if (ts21.isOmittedExpression(elem))
22626
+ if (ts22.isOmittedExpression(elem))
22523
22627
  return UNRESOLVED;
22524
22628
  const v = evalNode(elem, ctx);
22525
22629
  if (v === UNRESOLVED)
@@ -22528,7 +22632,7 @@ function evalNode(node, ctx) {
22528
22632
  }
22529
22633
  return arr;
22530
22634
  }
22531
- if (ts21.isElementAccessExpression(node)) {
22635
+ if (ts22.isElementAccessExpression(node)) {
22532
22636
  const base = evalNode(node.expression, ctx);
22533
22637
  if (base === undefined)
22534
22638
  return;
@@ -22542,17 +22646,17 @@ function evalNode(node, ctx) {
22542
22646
  const k = String(key);
22543
22647
  return Object.prototype.hasOwnProperty.call(base, k) ? base[k] : undefined;
22544
22648
  }
22545
- if (ts21.isPropertyAccessExpression(node)) {
22649
+ if (ts22.isPropertyAccessExpression(node)) {
22546
22650
  const baseResult = evalNode(node.expression, ctx);
22547
22651
  if (baseResult === undefined)
22548
22652
  return;
22549
22653
  return UNRESOLVED;
22550
22654
  }
22551
- if (ts21.isCallExpression(node)) {
22552
- if (node.arguments.length === 0 && ts21.isIdentifier(node.expression) && node.expression.text in ctx.bindings) {
22655
+ if (ts22.isCallExpression(node)) {
22656
+ if (node.arguments.length === 0 && ts22.isIdentifier(node.expression) && node.expression.text in ctx.bindings) {
22553
22657
  return ctx.bindings[node.expression.text];
22554
22658
  }
22555
- if (ts21.isPropertyAccessExpression(node.expression) && node.expression.name.text === "join") {
22659
+ if (ts22.isPropertyAccessExpression(node.expression) && node.expression.name.text === "join") {
22556
22660
  const recv = evalNode(node.expression.expression, ctx);
22557
22661
  if (Array.isArray(recv)) {
22558
22662
  let sep = ",";
@@ -22568,27 +22672,27 @@ function evalNode(node, ctx) {
22568
22672
  }
22569
22673
  return UNRESOLVED;
22570
22674
  }
22571
- if (ts21.isConditionalExpression(node)) {
22675
+ if (ts22.isConditionalExpression(node)) {
22572
22676
  const cond = evalNode(node.condition, ctx);
22573
22677
  if (cond === UNRESOLVED)
22574
22678
  return UNRESOLVED;
22575
22679
  return cond ? evalNode(node.whenTrue, ctx) : evalNode(node.whenFalse, ctx);
22576
22680
  }
22577
- if (ts21.isBinaryExpression(node)) {
22681
+ if (ts22.isBinaryExpression(node)) {
22578
22682
  const op = node.operatorToken.kind;
22579
- if (op === ts21.SyntaxKind.QuestionQuestionToken) {
22683
+ if (op === ts22.SyntaxKind.QuestionQuestionToken) {
22580
22684
  const l2 = evalNode(node.left, ctx);
22581
22685
  if (l2 !== UNRESOLVED && l2 !== null && l2 !== undefined)
22582
22686
  return l2;
22583
22687
  return evalNode(node.right, ctx);
22584
22688
  }
22585
- if (op === ts21.SyntaxKind.BarBarToken) {
22689
+ if (op === ts22.SyntaxKind.BarBarToken) {
22586
22690
  const l2 = evalNode(node.left, ctx);
22587
22691
  if (l2 !== UNRESOLVED && l2)
22588
22692
  return l2;
22589
22693
  return evalNode(node.right, ctx);
22590
22694
  }
22591
- if (op === ts21.SyntaxKind.AmpersandAmpersandToken) {
22695
+ if (op === ts22.SyntaxKind.AmpersandAmpersandToken) {
22592
22696
  const l2 = evalNode(node.left, ctx);
22593
22697
  if (l2 === UNRESOLVED)
22594
22698
  return UNRESOLVED;
@@ -22601,30 +22705,30 @@ function evalNode(node, ctx) {
22601
22705
  if (l === UNRESOLVED || r === UNRESOLVED)
22602
22706
  return UNRESOLVED;
22603
22707
  switch (op) {
22604
- case ts21.SyntaxKind.PlusToken:
22708
+ case ts22.SyntaxKind.PlusToken:
22605
22709
  if (typeof l === "string" || typeof r === "string")
22606
22710
  return `${l}${r}`;
22607
22711
  if (typeof l === "number" && typeof r === "number")
22608
22712
  return l + r;
22609
22713
  return UNRESOLVED;
22610
- case ts21.SyntaxKind.MinusToken:
22714
+ case ts22.SyntaxKind.MinusToken:
22611
22715
  return typeof l === "number" && typeof r === "number" ? l - r : UNRESOLVED;
22612
- case ts21.SyntaxKind.AsteriskToken:
22716
+ case ts22.SyntaxKind.AsteriskToken:
22613
22717
  return typeof l === "number" && typeof r === "number" ? l * r : UNRESOLVED;
22614
- case ts21.SyntaxKind.SlashToken:
22718
+ case ts22.SyntaxKind.SlashToken:
22615
22719
  return typeof l === "number" && typeof r === "number" && r !== 0 ? l / r : UNRESOLVED;
22616
- case ts21.SyntaxKind.PercentToken:
22720
+ case ts22.SyntaxKind.PercentToken:
22617
22721
  return typeof l === "number" && typeof r === "number" && r !== 0 ? l % r : UNRESOLVED;
22618
- case ts21.SyntaxKind.EqualsEqualsEqualsToken:
22619
- case ts21.SyntaxKind.EqualsEqualsToken:
22722
+ case ts22.SyntaxKind.EqualsEqualsEqualsToken:
22723
+ case ts22.SyntaxKind.EqualsEqualsToken:
22620
22724
  return l === r;
22621
- case ts21.SyntaxKind.ExclamationEqualsEqualsToken:
22622
- case ts21.SyntaxKind.ExclamationEqualsToken:
22725
+ case ts22.SyntaxKind.ExclamationEqualsEqualsToken:
22726
+ case ts22.SyntaxKind.ExclamationEqualsToken:
22623
22727
  return l !== r;
22624
22728
  }
22625
22729
  return UNRESOLVED;
22626
22730
  }
22627
- if (ts21.isTemplateExpression(node)) {
22731
+ if (ts22.isTemplateExpression(node)) {
22628
22732
  if (node.templateSpans.length === 0)
22629
22733
  return node.head.text;
22630
22734
  let acc = node.head.text;
@@ -22636,41 +22740,41 @@ function evalNode(node, ctx) {
22636
22740
  }
22637
22741
  return acc;
22638
22742
  }
22639
- if (ts21.isNoSubstitutionTemplateLiteral(node))
22743
+ if (ts22.isNoSubstitutionTemplateLiteral(node))
22640
22744
  return node.text;
22641
22745
  return UNRESOLVED;
22642
22746
  }
22643
22747
 
22644
22748
  // ../jsx/src/augment-inherited-props.ts
22645
- import ts22 from "typescript";
22749
+ import ts23 from "typescript";
22646
22750
  function parseStaticStringConst(source) {
22647
- const sf = ts22.createSourceFile("__const.ts", `const __x = (${source});`, ts22.ScriptTarget.Latest, false);
22751
+ const sf = ts23.createSourceFile("__const.ts", `const __x = (${source});`, ts23.ScriptTarget.Latest, false);
22648
22752
  const stmt = sf.statements[0];
22649
- if (!stmt || !ts22.isVariableStatement(stmt))
22753
+ if (!stmt || !ts23.isVariableStatement(stmt))
22650
22754
  return null;
22651
22755
  let init = stmt.declarationList.declarations[0]?.initializer;
22652
- while (init && ts22.isParenthesizedExpression(init))
22756
+ while (init && ts23.isParenthesizedExpression(init))
22653
22757
  init = init.expression;
22654
22758
  if (!init)
22655
22759
  return null;
22656
- if (ts22.isStringLiteral(init) || ts22.isNoSubstitutionTemplateLiteral(init)) {
22760
+ if (ts23.isStringLiteral(init) || ts23.isNoSubstitutionTemplateLiteral(init)) {
22657
22761
  return init.text;
22658
22762
  }
22659
22763
  return evalStringArrayJoin(source);
22660
22764
  }
22661
22765
  function evalTemplateOfStringConsts(source, resolved) {
22662
- const sf = ts22.createSourceFile("__const.ts", `const __x = (${source});`, ts22.ScriptTarget.Latest, false);
22766
+ const sf = ts23.createSourceFile("__const.ts", `const __x = (${source});`, ts23.ScriptTarget.Latest, false);
22663
22767
  const stmt = sf.statements[0];
22664
- if (!stmt || !ts22.isVariableStatement(stmt))
22768
+ if (!stmt || !ts23.isVariableStatement(stmt))
22665
22769
  return null;
22666
22770
  let init = stmt.declarationList.declarations[0]?.initializer;
22667
- while (init && ts22.isParenthesizedExpression(init))
22771
+ while (init && ts23.isParenthesizedExpression(init))
22668
22772
  init = init.expression;
22669
- if (!init || !ts22.isTemplateExpression(init))
22773
+ if (!init || !ts23.isTemplateExpression(init))
22670
22774
  return null;
22671
22775
  let out = init.head.text;
22672
22776
  for (const span of init.templateSpans) {
22673
- if (!ts22.isIdentifier(span.expression))
22777
+ if (!ts23.isIdentifier(span.expression))
22674
22778
  return null;
22675
22779
  const value = resolved.get(span.expression.text);
22676
22780
  if (value === undefined)
@@ -22698,28 +22802,28 @@ function collectModuleStringConsts(constants) {
22698
22802
  return map;
22699
22803
  }
22700
22804
  function evalStringArrayJoin(source) {
22701
- const sf = ts22.createSourceFile("__join.ts", `const __x = (${source});`, ts22.ScriptTarget.Latest, false);
22805
+ const sf = ts23.createSourceFile("__join.ts", `const __x = (${source});`, ts23.ScriptTarget.Latest, false);
22702
22806
  const stmt = sf.statements[0];
22703
- if (!stmt || !ts22.isVariableStatement(stmt))
22807
+ if (!stmt || !ts23.isVariableStatement(stmt))
22704
22808
  return null;
22705
22809
  let node = stmt.declarationList.declarations[0]?.initializer;
22706
- while (node && ts22.isParenthesizedExpression(node))
22810
+ while (node && ts23.isParenthesizedExpression(node))
22707
22811
  node = node.expression;
22708
- if (!node || !ts22.isCallExpression(node))
22812
+ if (!node || !ts23.isCallExpression(node))
22709
22813
  return null;
22710
22814
  const callee = node.expression;
22711
- if (!ts22.isPropertyAccessExpression(callee))
22815
+ if (!ts23.isPropertyAccessExpression(callee))
22712
22816
  return null;
22713
22817
  if (callee.name.text !== "join")
22714
22818
  return null;
22715
22819
  let recv = callee.expression;
22716
- while (ts22.isParenthesizedExpression(recv))
22820
+ while (ts23.isParenthesizedExpression(recv))
22717
22821
  recv = recv.expression;
22718
- if (!ts22.isArrayLiteralExpression(recv))
22822
+ if (!ts23.isArrayLiteralExpression(recv))
22719
22823
  return null;
22720
22824
  const parts = [];
22721
22825
  for (const el of recv.elements) {
22722
- if (ts22.isStringLiteral(el) || ts22.isNoSubstitutionTemplateLiteral(el)) {
22826
+ if (ts23.isStringLiteral(el) || ts23.isNoSubstitutionTemplateLiteral(el)) {
22723
22827
  parts.push(el.text);
22724
22828
  } else {
22725
22829
  return null;
@@ -22728,7 +22832,7 @@ function evalStringArrayJoin(source) {
22728
22832
  let sep = ",";
22729
22833
  if (node.arguments.length >= 1) {
22730
22834
  const arg = node.arguments[0];
22731
- if (ts22.isStringLiteral(arg) || ts22.isNoSubstitutionTemplateLiteral(arg))
22835
+ if (ts23.isStringLiteral(arg) || ts23.isNoSubstitutionTemplateLiteral(arg))
22732
22836
  sep = arg.text;
22733
22837
  else
22734
22838
  return null;
@@ -23070,13 +23174,13 @@ function compileMultipleComponents(source, filePath, componentNames, options) {
23070
23174
  if (entries.some((e) => e.componentIR.metadata.isClientComponent)) {
23071
23175
  const topLevelNames = new Set;
23072
23176
  {
23073
- const sf = ts23.createSourceFile(filePath, source, ts23.ScriptTarget.Latest, true, ts23.ScriptKind.TSX);
23177
+ const sf = ts24.createSourceFile(filePath, source, ts24.ScriptTarget.Latest, true, ts24.ScriptKind.TSX);
23074
23178
  for (const stmt of sf.statements) {
23075
- if (ts23.isFunctionDeclaration(stmt) && stmt.name)
23179
+ if (ts24.isFunctionDeclaration(stmt) && stmt.name)
23076
23180
  topLevelNames.add(stmt.name.text);
23077
- else if (ts23.isVariableStatement(stmt)) {
23181
+ else if (ts24.isVariableStatement(stmt)) {
23078
23182
  for (const d of stmt.declarationList.declarations) {
23079
- if (ts23.isIdentifier(d.name))
23183
+ if (ts24.isIdentifier(d.name))
23080
23184
  topLevelNames.add(d.name.text);
23081
23185
  }
23082
23186
  }
@@ -23135,7 +23239,7 @@ function compileMultipleComponents(source, filePath, componentNames, options) {
23135
23239
  const moduleStatementSeen = new Set;
23136
23240
  const moduleStatementsOrdered = [];
23137
23241
  const collectModuleStatements = (block) => {
23138
- const sf = ts23.createSourceFile("__bf_module_decls.tsx", block, ts23.ScriptTarget.Latest, false, ts23.ScriptKind.TSX);
23242
+ const sf = ts24.createSourceFile("__bf_module_decls.tsx", block, ts24.ScriptTarget.Latest, false, ts24.ScriptKind.TSX);
23139
23243
  for (const stmt of sf.statements) {
23140
23244
  const text = stmt.getText(sf);
23141
23245
  if (moduleStatementSeen.has(text))
@@ -23372,6 +23476,12 @@ function compileMultipleComponents(source, filePath, componentNames, options) {
23372
23476
  }
23373
23477
  return { files, errors };
23374
23478
  }
23479
+ function componentTypeParametersText(componentNode, sourceFile) {
23480
+ const typeParameters = componentNode?.typeParameters;
23481
+ if (!typeParameters || typeParameters.length === 0)
23482
+ return null;
23483
+ return `<${typeParameters.map((p) => p.getText(sourceFile)).join(", ")}>`;
23484
+ }
23375
23485
  function buildMetadata(ctx) {
23376
23486
  const metadata = {
23377
23487
  componentName: ctx.componentName || "Unknown",
@@ -23380,6 +23490,7 @@ function buildMetadata(ctx) {
23380
23490
  isClientComponent: ctx.hasUseClientDirective,
23381
23491
  typeDefinitions: ctx.typeDefinitions,
23382
23492
  propsType: ctx.propsType,
23493
+ typeParameters: componentTypeParametersText(ctx.componentNode, ctx.sourceFile),
23383
23494
  propsParams: ctx.propsParams,
23384
23495
  propsObjectName: ctx.propsObjectName,
23385
23496
  restPropsName: ctx.restPropsName,
@@ -23570,7 +23681,7 @@ function compileJSX(source, filePath, options) {
23570
23681
  return { files, errors };
23571
23682
  }
23572
23683
  // ../jsx/src/shared-program.ts
23573
- import ts24 from "typescript";
23684
+ import ts25 from "typescript";
23574
23685
  import path3 from "node:path";
23575
23686
  function commonParent(paths) {
23576
23687
  if (paths.length === 0)
@@ -23592,10 +23703,10 @@ function commonParent(paths) {
23592
23703
  function createProgramForCorpus(files, options = {}) {
23593
23704
  const baseUrl = options.baseUrl ?? commonParent(files);
23594
23705
  const compilerOptions = {
23595
- target: ts24.ScriptTarget.Latest,
23596
- module: ts24.ModuleKind.ESNext,
23597
- moduleResolution: ts24.ModuleResolutionKind.Bundler,
23598
- jsx: ts24.JsxEmit.ReactJSX,
23706
+ target: ts25.ScriptTarget.Latest,
23707
+ module: ts25.ModuleKind.ESNext,
23708
+ moduleResolution: ts25.ModuleResolutionKind.Bundler,
23709
+ jsx: ts25.JsxEmit.ReactJSX,
23599
23710
  strict: true,
23600
23711
  skipLibCheck: true,
23601
23712
  noEmit: true,
@@ -23605,7 +23716,7 @@ function createProgramForCorpus(files, options = {}) {
23605
23716
  ...options.compilerOptions
23606
23717
  };
23607
23718
  const absolute = files.map((f) => path3.resolve(f));
23608
- return ts24.createProgram(absolute, compilerOptions, undefined, options.oldProgram);
23719
+ return ts25.createProgram(absolute, compilerOptions, undefined, options.oldProgram);
23609
23720
  }
23610
23721
  // ../jsx/src/adapters/interface.ts
23611
23722
  class BaseAdapter {
@@ -23659,7 +23770,7 @@ class JsxAdapter extends BaseAdapter {
23659
23770
  ...localFunctions.map((f) => ({ name: f.name, body: f.body })),
23660
23771
  ...localConstants.map((c) => ({ name: c.name, body: c.value }))
23661
23772
  ];
23662
- const reachable = findReachableNames(primaryRefText, declarations);
23773
+ const reachable = closeOverWritersOfMutableBindings(primaryRefText, declarations, new Set(ir.metadata.localConstants.filter((c) => (c.declarationKind ?? "const") !== "const").map((c) => c.name)));
23663
23774
  const reachableBodies = [...reachable].map((name) => {
23664
23775
  const func = localFunctions.find((f) => f.name === name);
23665
23776
  if (func)
@@ -23691,7 +23802,8 @@ class JsxAdapter extends BaseAdapter {
23691
23802
  if (signal.setter) {
23692
23803
  const setterUsed = identifierPattern(signal.setter).test(setterRefText);
23693
23804
  if (setterUsed) {
23694
- lines.push(` const ${signal.setter} = (..._args: any[]) => {}`);
23805
+ const setterType = preserveTypes && signal.type.kind !== "unknown" ? `(valueOrFn: ${signal.type.raw} | ((prev: ${signal.type.raw}) => ${signal.type.raw})) => void` : null;
23806
+ lines.push(setterType ? ` const ${signal.setter}: ${setterType} = () => {}` : ` const ${signal.setter} = (..._args: any[]) => {}`);
23695
23807
  }
23696
23808
  }
23697
23809
  }
@@ -23887,7 +23999,7 @@ class JsxAdapter extends BaseAdapter {
23887
23999
  }
23888
24000
 
23889
24001
  // ../jsx/src/adapters/template-imports.ts
23890
- import ts25 from "typescript";
24002
+ import ts26 from "typescript";
23891
24003
  var CLIENT_PACKAGE_SOURCES = new Set([
23892
24004
  "@barefootjs/client",
23893
24005
  "@barefootjs/client/runtime"
@@ -24026,7 +24138,8 @@ export default ${this.componentName}` : "";
24026
24138
  const noArgDefault = hasRequiredProps ? "" : ` = {} as ${propsTypeExpr}`;
24027
24139
  const lines = [];
24028
24140
  const exportPrefix = ir.metadata.isExported === false ? "" : "export ";
24029
- lines.push(`${exportPrefix}function ${name}(${fullPropsDestructure}${typeAnnotation}${noArgDefault}) {`);
24141
+ const typeParameters = ir.metadata.typeParameters ?? "";
24142
+ lines.push(`${exportPrefix}function ${name}${typeParameters}(${fullPropsDestructure}${typeAnnotation}${noArgDefault}) {`);
24030
24143
  if (hasClientInteractivity) {
24031
24144
  lines.push(` const __scopeId = (/_s\\d/.test(__bfScope || '') ? __bfScope : null) || __instanceId || \`${name}_\${Math.random().toString(36).slice(2, 8)}\``);
24032
24145
  } else {
@@ -24277,11 +24390,11 @@ function registerBuiltinLoweringPlugins() {
24277
24390
  registerLoweringPlugin(plugin);
24278
24391
  }
24279
24392
  // ../jsx/src/combine-client-js.ts
24280
- import ts26 from "typescript";
24281
- // ../jsx/src/debug.ts
24282
24393
  import ts27 from "typescript";
24283
- // ../jsx/src/profiler.ts
24394
+ // ../jsx/src/debug.ts
24284
24395
  import ts28 from "typescript";
24396
+ // ../jsx/src/profiler.ts
24397
+ import ts29 from "typescript";
24285
24398
 
24286
24399
  // ../jsx/src/index.ts
24287
24400
  registerBuiltinLoweringPlugins();