@suss/adapter-typescript 0.26.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // src/adapter.ts
2
2
  import path11 from "path";
3
3
  import {
4
- Node as Node64,
4
+ Node as Node65,
5
5
  Project,
6
6
  SyntaxKind as SyntaxKind12
7
7
  } from "ts-morph";
@@ -29,7 +29,7 @@ import {
29
29
  } from "@suss/extractor";
30
30
 
31
31
  // src/assembly.ts
32
- import { Node as Node52 } from "ts-morph";
32
+ import { Node as Node53 } from "ts-morph";
33
33
  import { guardsHoldOn, runsBefore } from "@suss/extractor";
34
34
 
35
35
  // src/conditions.ts
@@ -846,11 +846,11 @@ function tryExpandArrayIncludes(call) {
846
846
  return {
847
847
  type: "compound",
848
848
  op: "or",
849
- operands: literalValues.map((lit6) => ({
849
+ operands: literalValues.map((lit5) => ({
850
850
  type: "comparison",
851
851
  left: subject,
852
852
  op: "eq",
853
- right: lit6
853
+ right: lit5
854
854
  }))
855
855
  };
856
856
  }
@@ -1502,7 +1502,7 @@ function degradedResult(func, terminalNodes, reason) {
1502
1502
 
1503
1503
  // src/resolve/invocationEffects.ts
1504
1504
  import {
1505
- Node as Node41
1505
+ Node as Node42
1506
1506
  } from "ts-morph";
1507
1507
  import { rawConditionToPredicate } from "@suss/extractor";
1508
1508
 
@@ -1987,7 +1987,8 @@ function readFileText(project, filePath) {
1987
1987
  return null;
1988
1988
  }
1989
1989
  }
1990
- function parseTsconfig(tsConfigFilePath) {
1990
+ function parseTsconfig(tsConfigFilePath, seen = /* @__PURE__ */ new Set()) {
1991
+ seen.add(tsConfigFilePath);
1991
1992
  const configFile = ts.readConfigFile(tsConfigFilePath, ts.sys.readFile);
1992
1993
  if (configFile.error !== void 0) {
1993
1994
  return { fileNames: [], options: {} };
@@ -2000,7 +2001,18 @@ function parseTsconfig(tsConfigFilePath) {
2000
2001
  void 0,
2001
2002
  tsConfigFilePath
2002
2003
  );
2003
- return { fileNames: parsed.fileNames, options: parsed.options };
2004
+ if (parsed.fileNames.length > 0) {
2005
+ return { fileNames: parsed.fileNames, options: parsed.options };
2006
+ }
2007
+ const referenced = (parsed.projectReferences ?? []).map((reference) => ts.resolveProjectReferencePath(reference)).filter((referencePath) => !seen.has(referencePath));
2008
+ const fileNames = [
2009
+ ...new Set(
2010
+ referenced.flatMap(
2011
+ (referencePath) => parseTsconfig(referencePath, seen).fileNames
2012
+ )
2013
+ )
2014
+ ];
2015
+ return { fileNames, options: parsed.options };
2004
2016
  }
2005
2017
  async function selectCandidateFiles(allFiles, packs, options) {
2006
2018
  const ungatedExists = packs.some(packIsUngated);
@@ -2361,7 +2373,7 @@ function reportUnreadableExports(file) {
2361
2373
  }
2362
2374
 
2363
2375
  // src/resolve/callOps.ts
2364
- import { Node as Node40 } from "ts-morph";
2376
+ import { Node as Node41 } from "ts-morph";
2365
2377
 
2366
2378
  // src/configuredCall.ts
2367
2379
  import { Node as Node11 } from "ts-morph";
@@ -2419,17 +2431,16 @@ function rootIdentifier(node) {
2419
2431
  }
2420
2432
 
2421
2433
  // src/parameterReads.ts
2422
- import { Node as Node38 } from "ts-morph";
2434
+ import { Node as Node39 } from "ts-morph";
2423
2435
 
2424
2436
  // src/resolve/functionBehind.ts
2425
- import { Node as Node37 } from "ts-morph";
2437
+ import { Node as Node38 } from "ts-morph";
2426
2438
 
2427
2439
  // src/facts/store.ts
2428
2440
  import { Node as Node15 } from "ts-morph";
2429
2441
  import {
2430
2442
  clearRelations,
2431
2443
  Database as Database2,
2432
- deriveOnDemand,
2433
2444
  evaluate as evaluate2,
2434
2445
  lit as lit2,
2435
2446
  proofOf,
@@ -2440,8 +2451,10 @@ import {
2440
2451
  witnesses
2441
2452
  } from "@suss/datalog";
2442
2453
  import {
2443
- ANSWER_RELATIONS,
2454
+ ASKING_RELATIONS,
2455
+ queryFacts,
2444
2456
  RESOLUTION_QUESTIONS,
2457
+ resolutionProgram,
2445
2458
  RESOLUTION_RULES as SHARED_RULES,
2446
2459
  VALUE_STEP
2447
2460
  } from "@suss/resolution";
@@ -2525,7 +2538,7 @@ import {
2525
2538
  SyntaxKind as SyntaxKind4,
2526
2539
  ts as ts2
2527
2540
  } from "ts-morph";
2528
- import { NAMESPACE_IMPORT_NAME } from "@suss/resolution";
2541
+ import { NAMESPACE_IMPORT_NAME, valueLeftByWrites } from "@suss/resolution";
2529
2542
 
2530
2543
  // src/facts/assignments.ts
2531
2544
  import { Node as Node13, SyntaxKind as SyntaxKind3, VariableDeclarationKind } from "ts-morph";
@@ -2563,22 +2576,15 @@ function writesToBindingUncached(declaration) {
2563
2576
  }
2564
2577
  return { values, inOrder: writesRunInOrder(declaration, writes) };
2565
2578
  }
2566
- function sameConstructionAcrossWrites(values) {
2567
- const candidates = values.filter((value) => !isNotYetPlaceholder(value));
2568
- if (candidates.length === 0) {
2569
- return null;
2570
- }
2571
- let construction = null;
2572
- for (const value of candidates) {
2573
- if (!isConstruction(value)) {
2574
- return null;
2575
- }
2576
- if (construction !== null && sourceOf(value) !== sourceOf(construction)) {
2577
- return null;
2578
- }
2579
- construction = value;
2580
- }
2581
- return construction;
2579
+ function describeWrites(values) {
2580
+ return values.map((value, index) => ({
2581
+ value: String(index),
2582
+ placeholder: isNotYetPlaceholder(value),
2583
+ construction: isConstruction(value) ? sourceOf(value) : null,
2584
+ // Which name each value was written to does not reach here, and
2585
+ // that is what a narrowing write is compared against.
2586
+ narrowsName: false
2587
+ }));
2582
2588
  }
2583
2589
  function isNotYetPlaceholder(value) {
2584
2590
  return value.getKind() === SyntaxKind3.NullKeyword || Node13.isIdentifier(value) && value.getText() === "undefined";
@@ -3069,6 +3075,13 @@ function emitValue(db, table, value) {
3069
3075
  fact(db, "writtenValue", id);
3070
3076
  return id;
3071
3077
  }
3078
+ function settledWrite(values, inOrder) {
3079
+ const key = valueLeftByWrites(describeWrites(values), inOrder);
3080
+ if (key === null) {
3081
+ return null;
3082
+ }
3083
+ return values[Number(key)] ?? null;
3084
+ }
3072
3085
  function emitBindingValues(db, table, declaration) {
3073
3086
  const declarationId = nodeId(declaration);
3074
3087
  if (!isWrittenAgain(declaration)) {
@@ -3079,17 +3092,12 @@ function emitBindingValues(db, table, declaration) {
3079
3092
  return;
3080
3093
  }
3081
3094
  const { values, inOrder } = writesToBinding(declaration);
3082
- const last = values[values.length - 1];
3083
- if (inOrder && last !== void 0) {
3084
- fact(db, "endsHolding", declarationId, emitValue(db, table, last));
3085
- return;
3086
- }
3087
- const construction = sameConstructionAcrossWrites(values);
3088
- if (construction !== null) {
3089
- fact(db, "endsHolding", declarationId, emitValue(db, table, construction));
3095
+ const settled2 = settledWrite(values, inOrder);
3096
+ if (settled2 === null) {
3097
+ reassignedUnstated.add(declarationId);
3090
3098
  return;
3091
3099
  }
3092
- reassignedUnstated.add(declarationId);
3100
+ fact(db, "endsHolding", declarationId, emitValue(db, table, settled2));
3093
3101
  }
3094
3102
  var reassignedUnstated = /* @__PURE__ */ new Set();
3095
3103
  function reassignedNamesUnstated() {
@@ -3100,32 +3108,24 @@ function forgetReassignedNamesUnstated() {
3100
3108
  }
3101
3109
  function emitFieldValues(db, table, declaration) {
3102
3110
  const { values, inOrder } = writesToField(declaration);
3103
- const last = values[values.length - 1];
3104
- if (inOrder && last !== void 0 && Node14.isExpression(last)) {
3105
- fact(db, "binds", nodeId(declaration), emitValue(db, table, last));
3111
+ const settled2 = settledWrite(values, inOrder);
3112
+ if (settled2 === null || !Node14.isExpression(settled2)) {
3106
3113
  return;
3107
3114
  }
3108
- const construction = sameConstructionAcrossWrites(values);
3109
- if (construction !== null) {
3110
- fact(db, "binds", nodeId(declaration), emitValue(db, table, construction));
3111
- }
3115
+ fact(db, "binds", nodeId(declaration), emitValue(db, table, settled2));
3112
3116
  }
3113
3117
  function emitParameterPropertyRead(db, table, referenceId, declaration) {
3114
3118
  const { values, inOrder } = writesToField(declaration);
3115
- const last = values[values.length - 1];
3116
- if (inOrder && last !== void 0 && Node14.isExpression(last)) {
3117
- fact(db, "binds", referenceId, emitValue(db, table, last));
3119
+ const settled2 = settledWrite(values, inOrder);
3120
+ if (settled2 === null) {
3118
3121
  return;
3119
3122
  }
3120
- if (inOrder && last !== void 0) {
3121
- table.byId.set(nodeId(last), last);
3122
- fact(db, "binds", referenceId, nodeId(last));
3123
+ if (Node14.isExpression(settled2)) {
3124
+ fact(db, "binds", referenceId, emitValue(db, table, settled2));
3123
3125
  return;
3124
3126
  }
3125
- const construction = sameConstructionAcrossWrites(values);
3126
- if (construction !== null) {
3127
- fact(db, "binds", referenceId, emitValue(db, table, construction));
3128
- }
3127
+ table.byId.set(nodeId(settled2), settled2);
3128
+ fact(db, "binds", referenceId, nodeId(settled2));
3129
3129
  }
3130
3130
  function emitBindingElementFacts(db, table, element) {
3131
3131
  const id = nodeId(element);
@@ -3587,36 +3587,16 @@ var JS_RULES = [
3587
3587
  "bind"
3588
3588
  )
3589
3589
  ];
3590
- var RESOLUTION_PROGRAM = process.env.SUSS_RESOLUTION_ON_DEMAND === "0" ? {
3591
- rules: [...SHARED_RULES, ...JS_RULES, ...RESOLUTION_QUESTIONS],
3592
- demandDriven: [],
3593
- demands: []
3594
- } : deriveOnDemand(
3595
- [...SHARED_RULES, ...JS_RULES, ...RESOLUTION_QUESTIONS],
3596
- ANSWER_RELATIONS
3597
- );
3590
+ var RESOLUTION_PROGRAM = resolutionProgram(JS_RULES);
3598
3591
  var WITNESS_RULES = [...SHARED_RULES, ...JS_RULES];
3599
3592
  var NOT_BASE_FACTS = /* @__PURE__ */ new Set([
3600
3593
  ...[...SHARED_RULES, ...JS_RULES, ...RESOLUTION_QUESTIONS].map(
3601
3594
  (r) => r.head.relation
3602
3595
  ),
3603
3596
  ...RESOLUTION_PROGRAM.rules.map((r) => r.head.relation),
3604
- "wanted",
3605
- "wantedOrigin",
3606
- "wantedCallOrigin",
3607
- "wantedExportsOf",
3608
- "wantedAnchor",
3609
- "wantedSubject"
3597
+ ...ASKING_RELATIONS
3610
3598
  ]);
3611
- var QUERY_FACTS = RESOLUTION_PROGRAM.demandDriven.length === 0 ? [] : [
3612
- ...RESOLUTION_PROGRAM.demandDriven,
3613
- "wanted",
3614
- "wantedOrigin",
3615
- "wantedCallOrigin",
3616
- "wantedExportsOf",
3617
- "wantedAnchor",
3618
- "wantedSubject"
3619
- ];
3599
+ var QUERY_FACTS = queryFacts(RESOLUTION_PROGRAM);
3620
3600
  var MODULE_DEMANDS = RESOLUTION_PROGRAM.demands.filter(
3621
3601
  (one) => (one.relation === "moduleExport" || one.relation === "moduleForwards") && one.bound[0] === true
3622
3602
  ).map((one) => one.demand);
@@ -5240,6 +5220,7 @@ function literalValueOf(value, resolution, isWanted) {
5240
5220
  }
5241
5221
 
5242
5222
  // src/discovery/clientCall.ts
5223
+ var GLOBAL_OBJECTS = /* @__PURE__ */ new Set(["globalThis", "window", "self", "global"]);
5243
5224
  function discoverClientCalls(sourceFile, match, kind, resolution) {
5244
5225
  const results = [];
5245
5226
  const isGlobal = match.importModule === "global";
@@ -5264,9 +5245,15 @@ function discoverClientCalls(sourceFile, match, kind, resolution) {
5264
5245
  if (callee.getText() === match.importName) {
5265
5246
  matched = true;
5266
5247
  }
5248
+ } else if (isGlobal && Node18.isPropertyAccessExpression(callee)) {
5249
+ if (callee.getName() === match.importName && GLOBAL_OBJECTS.has(callee.getExpression().getText())) {
5250
+ matched = true;
5251
+ }
5252
+ } else if (match.callable === true && isClientItself(callee, match, clientVarNames, resolution)) {
5253
+ matched = true;
5267
5254
  } else if (Node18.isPropertyAccessExpression(callee)) {
5268
5255
  const subject = callee.getExpression();
5269
- if (Node18.isIdentifier(subject) && (isClientImport(subject, match, resolution, true) || clientVarNames.has(subject.getText())) || resolvesToKnownInstance(subject, match, resolution)) {
5256
+ if (isClientItself(subject, match, clientVarNames, resolution)) {
5270
5257
  methodName = callee.getName();
5271
5258
  if (methodFilter === null || methodFilter.has(methodName)) {
5272
5259
  matched = true;
@@ -5292,6 +5279,9 @@ function discoverClientCalls(sourceFile, match, kind, resolution) {
5292
5279
  });
5293
5280
  return results;
5294
5281
  }
5282
+ function isClientItself(subject, match, clientVarNames, resolution) {
5283
+ return Node18.isIdentifier(subject) && (isClientImport(subject, match, resolution, true) || clientVarNames.has(subject.getText())) || resolvesToKnownInstance(subject, match, resolution);
5284
+ }
5295
5285
  function clientReceiverCheckFor(sourceFile, match, resolution) {
5296
5286
  const localName = resolveImportedLocalName(
5297
5287
  sourceFile,
@@ -7721,17 +7711,157 @@ function discoverPackageImports(sourceFile, match, kind, resolution) {
7721
7711
  }
7722
7712
 
7723
7713
  // src/discovery/registrationCall.ts
7724
- import { Node as Node32 } from "ts-morph";
7714
+ import { Node as Node34 } from "ts-morph";
7725
7715
  import { joinMountedPath } from "@suss/resolution";
7726
7716
 
7727
7717
  // src/resolve/routePath.ts
7728
- import { pathOf } from "@suss/values";
7718
+ import { force as force3, pathOf } from "@suss/values";
7729
7719
  function pathFromArgument(arg, resolution) {
7730
7720
  return pathOf(evaluatedValue(arg, resolution));
7731
7721
  }
7722
+ function pathFromProperty(arg, property, resolution) {
7723
+ const record2 = evaluatedValue(arg, resolution);
7724
+ if (record2.kind !== "record") {
7725
+ return void 0;
7726
+ }
7727
+ const field = record2.fields.get(property);
7728
+ return field === void 0 ? void 0 : pathOf(force3(field.value));
7729
+ }
7730
+
7731
+ // src/discovery/wrapperFactory.ts
7732
+ import { Node as Node33 } from "ts-morph";
7733
+
7734
+ // src/resolve/unfollowedCall.ts
7735
+ import {
7736
+ Node as Node32,
7737
+ SyntaxKind as SyntaxKind8
7738
+ } from "ts-morph";
7739
+ import {
7740
+ unfollowedCallGap,
7741
+ worthRecording
7742
+ } from "@suss/behavioral-ir";
7743
+ function isInExternalCode(sourceFile) {
7744
+ if (sourceFile.isDeclarationFile()) {
7745
+ return true;
7746
+ }
7747
+ return sourceFile.getFilePath().includes("/node_modules/");
7748
+ }
7749
+ function hasBody(fn) {
7750
+ if (Node32.isFunctionDeclaration(fn) || Node32.isMethodDeclaration(fn) || Node32.isFunctionExpression(fn)) {
7751
+ return fn.getBody?.() !== void 0;
7752
+ }
7753
+ return true;
7754
+ }
7755
+ function isDeclaredShape(declaration) {
7756
+ return (Node32.isMethodSignature(declaration) || Node32.isPropertySignature(declaration)) && !isInExternalCode(declaration.getSourceFile());
7757
+ }
7758
+ function isExternalDeclaration(declaration) {
7759
+ if (isInExternalCode(declaration.getSourceFile())) {
7760
+ return true;
7761
+ }
7762
+ if (Node32.isImportSpecifier(declaration) || Node32.isImportClause(declaration) || Node32.isNamespaceImport(declaration)) {
7763
+ const target = declaration.getFirstAncestorByKind(SyntaxKind8.ImportDeclaration)?.getModuleSpecifierSourceFile();
7764
+ return target === void 0 || isInExternalCode(target);
7765
+ }
7766
+ return declaresAnotherModule(declaration);
7767
+ }
7768
+ function declaresAnotherModule(declaration) {
7769
+ const module = declaration.getFirstAncestorByKind(
7770
+ SyntaxKind8.ModuleDeclaration
7771
+ );
7772
+ return module !== void 0 && Node32.isStringLiteral(module.getNameNode());
7773
+ }
7774
+ function statesShapeOnly(declaration) {
7775
+ if (isExternalDeclaration(declaration)) {
7776
+ return false;
7777
+ }
7778
+ if (Node32.isMethodSignature(declaration) || Node32.isPropertySignature(declaration)) {
7779
+ return true;
7780
+ }
7781
+ if (Node32.isFunctionDeclaration(declaration) || Node32.isMethodDeclaration(declaration)) {
7782
+ return declaration.getBody() === void 0;
7783
+ }
7784
+ return false;
7785
+ }
7786
+ function declarationsBehind(symbol) {
7787
+ if (symbol === void 0) {
7788
+ return [];
7789
+ }
7790
+ const behind = symbol.getAliasedSymbol()?.getDeclarations() ?? [];
7791
+ return behind.length > 0 ? behind : symbol.getDeclarations();
7792
+ }
7793
+ function isParameterOf(declaration, scanning) {
7794
+ return Node32.isParameterDeclaration(declaration) && declaration.getParent() === scanning;
7795
+ }
7796
+ function parameterIndexOf(declarations, scanning) {
7797
+ if (scanning === void 0) {
7798
+ return void 0;
7799
+ }
7800
+ const params = scanning.getParameters();
7801
+ for (const declaration of declarations) {
7802
+ const index = params.findIndex((param) => param === declaration);
7803
+ if (index !== -1) {
7804
+ return index;
7805
+ }
7806
+ }
7807
+ return void 0;
7808
+ }
7809
+ function classifyStop(declarations, scanning) {
7810
+ if (declarations.length === 0) {
7811
+ return "noDeclaration";
7812
+ }
7813
+ for (const declaration of declarations) {
7814
+ if (!isInExternalCode(declaration.getSourceFile())) {
7815
+ recordFileDependency(declaration.getSourceFile().getFilePath());
7816
+ }
7817
+ }
7818
+ if (scanning !== void 0 && declarations.some((declaration) => isParameterOf(declaration, scanning))) {
7819
+ return "callerSupplied";
7820
+ }
7821
+ if (declarations.every(isExternalDeclaration)) {
7822
+ return "outsideRun";
7823
+ }
7824
+ if (declarations.some(statesShapeOnly)) {
7825
+ return "noBody";
7826
+ }
7827
+ return "unsettledValue";
7828
+ }
7829
+
7830
+ // src/discovery/wrapperFactory.ts
7831
+ function factoryNameOf(targetArg) {
7832
+ const written = factKeyOf(targetArg);
7833
+ if (!Node33.isCallExpression(written)) {
7834
+ return void 0;
7835
+ }
7836
+ const callee = written.getExpression();
7837
+ if (Node33.isIdentifier(callee)) {
7838
+ return callee.getText();
7839
+ }
7840
+ if (Node33.isPropertyAccessExpression(callee)) {
7841
+ return callee.getName();
7842
+ }
7843
+ return void 0;
7844
+ }
7845
+ function factoryStopOf(targetArg) {
7846
+ const written = factKeyOf(targetArg);
7847
+ if (!Node33.isCallExpression(written)) {
7848
+ return null;
7849
+ }
7850
+ const callee = factoryNameOf(targetArg);
7851
+ if (callee === void 0) {
7852
+ return null;
7853
+ }
7854
+ const reason = classifyStop(
7855
+ declarationsBehind(written.getExpression().getSymbol())
7856
+ );
7857
+ if (!worthRecording(reason)) {
7858
+ return null;
7859
+ }
7860
+ return { callee, reason: "unresolvedWrapper" };
7861
+ }
7732
7862
 
7733
7863
  // src/discovery/registrationCall.ts
7734
- function discoverRegistrationCalls(sourceFile, match, kind, bindingExtraction, resolution, mountPrefixes, expandedElsewhere) {
7864
+ function discoverRegistrationCalls(sourceFile, match, kind, bindingExtraction, resolution, mountPrefixes, expandedElsewhere, routeWrapperPattern) {
7735
7865
  const results = [];
7736
7866
  const registrationSubjects = registrationSubjectsOf(
7737
7867
  sourceFile,
@@ -7746,11 +7876,11 @@ function discoverRegistrationCalls(sourceFile, match, kind, bindingExtraction, r
7746
7876
  return results;
7747
7877
  }
7748
7878
  sourceFile.forEachDescendant((node) => {
7749
- if (!Node32.isCallExpression(node)) {
7879
+ if (!Node34.isCallExpression(node)) {
7750
7880
  return;
7751
7881
  }
7752
7882
  const callee = node.getExpression();
7753
- if (!Node32.isPropertyAccessExpression(callee)) {
7883
+ if (!Node34.isPropertyAccessExpression(callee)) {
7754
7884
  return;
7755
7885
  }
7756
7886
  const methodName = callee.getName();
@@ -7787,12 +7917,12 @@ function discoverRegistrationCalls(sourceFile, match, kind, bindingExtraction, r
7787
7917
  const registrationSubjectId = nodeId(subjectNode);
7788
7918
  let foundObjectArg = false;
7789
7919
  for (const arg of args) {
7790
- if (!Node32.isObjectLiteralExpression(arg)) {
7920
+ if (!Node34.isObjectLiteralExpression(arg)) {
7791
7921
  continue;
7792
7922
  }
7793
7923
  foundObjectArg = true;
7794
7924
  for (const prop of arg.getProperties()) {
7795
- if (Node32.isMethodDeclaration(prop)) {
7925
+ if (Node34.isMethodDeclaration(prop)) {
7796
7926
  results.push({
7797
7927
  func: prop,
7798
7928
  kind,
@@ -7801,7 +7931,7 @@ function discoverRegistrationCalls(sourceFile, match, kind, bindingExtraction, r
7801
7931
  });
7802
7932
  continue;
7803
7933
  }
7804
- if (!Node32.isPropertyAssignment(prop)) {
7934
+ if (!Node34.isPropertyAssignment(prop)) {
7805
7935
  continue;
7806
7936
  }
7807
7937
  const propInit = prop.getInitializer();
@@ -7833,6 +7963,13 @@ function discoverRegistrationCalls(sourceFile, match, kind, bindingExtraction, r
7833
7963
  mountPrefixes
7834
7964
  );
7835
7965
  if (handler !== null) {
7966
+ const chain = routeWrapperPattern === void 0 ? null : routeChainOf(
7967
+ args.slice(0, -1),
7968
+ routeWrapperPattern,
7969
+ methodName,
7970
+ routeInfo,
7971
+ resolution
7972
+ );
7836
7973
  results.push({
7837
7974
  func: handler,
7838
7975
  kind,
@@ -7840,8 +7977,13 @@ function discoverRegistrationCalls(sourceFile, match, kind, bindingExtraction, r
7840
7977
  name: methodName,
7841
7978
  nameKind: "label",
7842
7979
  registrationSubjectId,
7843
- ...routeInfo !== null ? { routeInfo } : {}
7980
+ ...routeInfo !== null ? { routeInfo } : {},
7981
+ ...chain === null || chain.references.length === 0 ? {} : { routeWrappers: chain.references },
7982
+ ...chain === null || chain.unfollowed.length === 0 ? {} : { routeUnfollowed: chain.unfollowed }
7844
7983
  });
7984
+ if (chain !== null) {
7985
+ results.push(...chain.units);
7986
+ }
7845
7987
  return;
7846
7988
  }
7847
7989
  if (routeInfo !== null && lastArg !== void 0 && namesAParameter(lastArg)) {
@@ -7887,6 +8029,47 @@ function declinedRegistration(call, callee, methodName, kind, receiver, resoluti
7887
8029
  }
7888
8030
  ];
7889
8031
  }
8032
+ function routeChainOf(listed, pattern, methodName, routeInfo, resolution) {
8033
+ const chain = { units: [], references: [], unfollowed: [] };
8034
+ const anonymousLabels = /* @__PURE__ */ new Map();
8035
+ for (const arg of listed) {
8036
+ const elements = Node34.isArrayLiteralExpression(arg) ? arg.getElements() : [arg];
8037
+ for (const element of elements) {
8038
+ const target = functionValueOf(element, resolution);
8039
+ if (target === null) {
8040
+ const stop = factoryStopOf(element);
8041
+ if (stop !== null) {
8042
+ chain.unfollowed.push(stop);
8043
+ }
8044
+ continue;
8045
+ }
8046
+ const ownName = functionNameOrAnon(target);
8047
+ const named2 = ownName !== "<anon>";
8048
+ const label = factoryNameOf(element) ?? methodName;
8049
+ const seen = anonymousLabels.get(label) ?? 0;
8050
+ if (!named2) {
8051
+ anonymousLabels.set(label, seen + 1);
8052
+ }
8053
+ const name = named2 ? ownName : routeWrapperLabel(label, routeInfo, element, seen);
8054
+ chain.units.push({
8055
+ func: target,
8056
+ kind: pattern.kind,
8057
+ name,
8058
+ pattern,
8059
+ ...named2 ? {} : { nameKind: "label" }
8060
+ });
8061
+ chain.references.push({
8062
+ file: target.getSourceFile().getFilePath(),
8063
+ name
8064
+ });
8065
+ }
8066
+ }
8067
+ return chain;
8068
+ }
8069
+ function routeWrapperLabel(label, routeInfo, element, seen) {
8070
+ const where = routeInfo === null ? `L${element.getStartLineNumber()}` : `${routeInfo.method} ${routeInfo.path}`;
8071
+ return seen === 0 ? `${label}@${where}` : `${label}@${where}#${seen + 1}`;
8072
+ }
7890
8073
  function withMountPrefix(routeInfo, subjectNode, mountPrefixes) {
7891
8074
  if (routeInfo === null || mountPrefixes === void 0) {
7892
8075
  return routeInfo;
@@ -7914,13 +8097,13 @@ function subjectNodeFor(subject, subjects, match, resolution) {
7914
8097
  }
7915
8098
  var NOT_A_ROUTABLE = { kind: "none" };
7916
8099
  function receiverOf(subject, subjects, match, resolution) {
7917
- if (Node32.isIdentifier(subject)) {
8100
+ if (Node34.isIdentifier(subject)) {
7918
8101
  const known = subjects.get(subject.getText());
7919
8102
  if (known !== void 0) {
7920
8103
  return { kind: "routable", node: known };
7921
8104
  }
7922
8105
  }
7923
- if (resolution === void 0 || !(Node32.isIdentifier(subject) || Node32.isPropertyAccessExpression(subject))) {
8106
+ if (resolution === void 0 || !(Node34.isIdentifier(subject) || Node34.isPropertyAccessExpression(subject))) {
7924
8107
  return NOT_A_ROUTABLE;
7925
8108
  }
7926
8109
  const construction = resolution.subjectConstructionOf(
@@ -7960,18 +8143,18 @@ function collectMethodsCalledOnCallResults(sourceFile) {
7960
8143
  const setToCalls = /* @__PURE__ */ new Set();
7961
8144
  const calledOn = /* @__PURE__ */ new Map();
7962
8145
  sourceFile.forEachDescendant((node) => {
7963
- if (Node32.isVariableDeclaration(node)) {
8146
+ if (Node34.isVariableDeclaration(node)) {
7964
8147
  const init = node.getInitializer();
7965
- if (init !== void 0 && Node32.isCallExpression(init)) {
8148
+ if (init !== void 0 && Node34.isCallExpression(init)) {
7966
8149
  setToCalls.add(node.getName());
7967
8150
  }
7968
8151
  return;
7969
8152
  }
7970
- if (!Node32.isCallExpression(node)) {
8153
+ if (!Node34.isCallExpression(node)) {
7971
8154
  return;
7972
8155
  }
7973
8156
  const callee = node.getExpression();
7974
- if (!Node32.isPropertyAccessExpression(callee) || !Node32.isIdentifier(callee.getExpression())) {
8157
+ if (!Node34.isPropertyAccessExpression(callee) || !Node34.isIdentifier(callee.getExpression())) {
7975
8158
  return;
7976
8159
  }
7977
8160
  const receiver = callee.getExpression().getText();
@@ -7998,18 +8181,18 @@ function registrationSubjectsOf(sourceFile, importModule, importName, resolution
7998
8181
  return subjects;
7999
8182
  }
8000
8183
  sourceFile.forEachDescendant((node) => {
8001
- if (Node32.isVariableDeclaration(node)) {
8184
+ if (Node34.isVariableDeclaration(node)) {
8002
8185
  const init = node.getInitializer();
8003
8186
  if (init === void 0) {
8004
8187
  return;
8005
8188
  }
8006
- const calleeText = Node32.isCallExpression(init) || Node32.isNewExpression(init) ? init.getExpression().getText() : null;
8189
+ const calleeText = Node34.isCallExpression(init) || Node34.isNewExpression(init) ? init.getExpression().getText() : null;
8007
8190
  if (calleeText !== null && spellings.includes(calleeText)) {
8008
8191
  subjects.set(node.getName(), init);
8009
8192
  }
8010
8193
  return;
8011
8194
  }
8012
- if (!Node32.isParameterDeclaration(node)) {
8195
+ if (!Node34.isParameterDeclaration(node)) {
8013
8196
  return;
8014
8197
  }
8015
8198
  const typeNode = node.getTypeNode();
@@ -8030,7 +8213,7 @@ function creationSiteBehind(parameter, resolution) {
8030
8213
  return parameter;
8031
8214
  }
8032
8215
  const written = resolution.resolveWrittenValue(parameter);
8033
- if (written === null || !(Node32.isCallExpression(written) || Node32.isNewExpression(written))) {
8216
+ if (written === null || !(Node34.isCallExpression(written) || Node34.isNewExpression(written))) {
8034
8217
  return parameter;
8035
8218
  }
8036
8219
  return written;
@@ -8073,7 +8256,7 @@ function unboundConstructionsOf(sourceFile, importModule, importName) {
8073
8256
  }
8074
8257
  const constructions = [];
8075
8258
  sourceFile.forEachDescendant((node) => {
8076
- if ((Node32.isCallExpression(node) || Node32.isNewExpression(node)) && spellings.includes(node.getExpression().getText()) && !Node32.isVariableDeclaration(node.getParent())) {
8259
+ if ((Node34.isCallExpression(node) || Node34.isNewExpression(node)) && spellings.includes(node.getExpression().getText()) && !Node34.isVariableDeclaration(node.getParent())) {
8077
8260
  constructions.push(node);
8078
8261
  }
8079
8262
  });
@@ -8091,11 +8274,11 @@ function discoverMountEdges(sourceFile, match, mount, knownSubjectIds, resolutio
8091
8274
  }
8092
8275
  const edges = [];
8093
8276
  sourceFile.forEachDescendant((node) => {
8094
- if (!Node32.isCallExpression(node)) {
8277
+ if (!Node34.isCallExpression(node)) {
8095
8278
  return;
8096
8279
  }
8097
8280
  const callee = node.getExpression();
8098
- if (!Node32.isPropertyAccessExpression(callee) || callee.getName() !== mount.method) {
8281
+ if (!Node34.isPropertyAccessExpression(callee) || callee.getName() !== mount.method) {
8099
8282
  return;
8100
8283
  }
8101
8284
  const subjectNode = subjectNodeFor(
@@ -8109,7 +8292,7 @@ function discoverMountEdges(sourceFile, match, mount, knownSubjectIds, resolutio
8109
8292
  }
8110
8293
  const args = node.getArguments();
8111
8294
  const prefixArg = args[mount.prefixPosition];
8112
- if (prefixArg === void 0 || !(Node32.isStringLiteral(prefixArg) || Node32.isNoSubstitutionTemplateLiteral(prefixArg))) {
8295
+ if (prefixArg === void 0 || !(Node34.isStringLiteral(prefixArg) || Node34.isNoSubstitutionTemplateLiteral(prefixArg))) {
8113
8296
  return;
8114
8297
  }
8115
8298
  const targetNodes = mountTargetsAmong(
@@ -8164,7 +8347,7 @@ function extractRouteInfoFromBinding(call, methodName, binding, resolution) {
8164
8347
  } else {
8165
8348
  const args = call.getArguments();
8166
8349
  const arg = args[binding.method.position];
8167
- if (arg === void 0 || !(Node32.isStringLiteral(arg) || Node32.isNoSubstitutionTemplateLiteral(arg))) {
8350
+ if (arg === void 0 || !(Node34.isStringLiteral(arg) || Node34.isNoSubstitutionTemplateLiteral(arg))) {
8168
8351
  return null;
8169
8352
  }
8170
8353
  method = arg.getLiteralValue().toUpperCase();
@@ -8175,7 +8358,7 @@ function extractRouteInfoFromBinding(call, methodName, binding, resolution) {
8175
8358
  }
8176
8359
 
8177
8360
  // src/discovery/registrationLoop.ts
8178
- import { Node as Node33 } from "ts-morph";
8361
+ import { Node as Node35 } from "ts-morph";
8179
8362
  function discoverRegistrationLoops(sourceFile, match, kind, resolution) {
8180
8363
  const results = [];
8181
8364
  const guard = receiverGuard(sourceFile, match.receiver, resolution);
@@ -8183,7 +8366,7 @@ function discoverRegistrationLoops(sourceFile, match, kind, resolution) {
8183
8366
  return results;
8184
8367
  }
8185
8368
  sourceFile.forEachDescendant((node) => {
8186
- if (!Node33.isForOfStatement(node)) {
8369
+ if (!Node35.isForOfStatement(node)) {
8187
8370
  return;
8188
8371
  }
8189
8372
  const expanded = tryExpandLoop(node, match, kind, resolution, guard);
@@ -8246,13 +8429,13 @@ function tryExpandLoop(loop, match, kind, resolution, guard) {
8246
8429
  }
8247
8430
  function loopVariableName(loop) {
8248
8431
  const initializer = loop.getInitializer();
8249
- if (Node33.isVariableDeclarationList(initializer)) {
8432
+ if (Node35.isVariableDeclarationList(initializer)) {
8250
8433
  const decls = initializer.getDeclarations();
8251
8434
  if (decls.length !== 1) {
8252
8435
  return null;
8253
8436
  }
8254
8437
  const nameNode = decls[0]?.getNameNode();
8255
- if (nameNode !== void 0 && Node33.isIdentifier(nameNode)) {
8438
+ if (nameNode !== void 0 && Node35.isIdentifier(nameNode)) {
8256
8439
  return nameNode.getText();
8257
8440
  }
8258
8441
  }
@@ -8265,14 +8448,14 @@ function bodyReferencesLoopVar(loop, name) {
8265
8448
  if (referenced) {
8266
8449
  return;
8267
8450
  }
8268
- if (!Node33.isCallExpression(node)) {
8451
+ if (!Node35.isCallExpression(node)) {
8269
8452
  return;
8270
8453
  }
8271
8454
  node.forEachDescendant((inner) => {
8272
8455
  if (referenced) {
8273
8456
  return;
8274
8457
  }
8275
- if (Node33.isIdentifier(inner) && inner.getText() === name) {
8458
+ if (Node35.isIdentifier(inner) && inner.getText() === name) {
8276
8459
  referenced = true;
8277
8460
  }
8278
8461
  });
@@ -8282,11 +8465,11 @@ function bodyReferencesLoopVar(loop, name) {
8282
8465
  function bodyCallsOnRoutable(loop, guard, resolution) {
8283
8466
  let found = false;
8284
8467
  loop.getStatement().forEachDescendant((node) => {
8285
- if (found || !Node33.isCallExpression(node)) {
8468
+ if (found || !Node35.isCallExpression(node)) {
8286
8469
  return;
8287
8470
  }
8288
8471
  const callee = node.getExpression();
8289
- if (!Node33.isPropertyAccessExpression(callee) && !Node33.isElementAccessExpression(callee)) {
8472
+ if (!Node35.isPropertyAccessExpression(callee) && !Node35.isElementAccessExpression(callee)) {
8290
8473
  return;
8291
8474
  }
8292
8475
  const subject = callee.getExpression();
@@ -8306,11 +8489,11 @@ function readRouteSpec(element, shape, resolution) {
8306
8489
  let path15 = null;
8307
8490
  let handler = null;
8308
8491
  for (const prop of element.getProperties()) {
8309
- if (Node33.isMethodDeclaration(prop) && prop.getName() === shape.handlerKey) {
8492
+ if (Node35.isMethodDeclaration(prop) && prop.getName() === shape.handlerKey) {
8310
8493
  handler = { func: prop, name: shape.handlerKey };
8311
8494
  continue;
8312
8495
  }
8313
- if (!Node33.isPropertyAssignment(prop)) {
8496
+ if (!Node35.isPropertyAssignment(prop)) {
8314
8497
  continue;
8315
8498
  }
8316
8499
  const name = prop.getName();
@@ -8333,117 +8516,19 @@ function readRouteSpec(element, shape, resolution) {
8333
8516
  return { method, path: path15, handler: handler.func, handlerName: handler.name };
8334
8517
  }
8335
8518
  function readStringLiteralValue(node) {
8336
- if (Node33.isStringLiteral(node) || Node33.isNoSubstitutionTemplateLiteral(node)) {
8519
+ if (Node35.isStringLiteral(node) || Node35.isNoSubstitutionTemplateLiteral(node)) {
8337
8520
  return node.getLiteralValue();
8338
8521
  }
8339
8522
  return null;
8340
8523
  }
8341
8524
  function handlerName(value) {
8342
- return Node33.isIdentifier(value) ? value.getText() : value.getKindName();
8525
+ return Node35.isIdentifier(value) ? value.getText() : value.getKindName();
8343
8526
  }
8344
8527
 
8345
8528
  // src/discovery/registrationTemplate.ts
8346
8529
  import path6 from "path";
8347
- import { Node as Node35 } from "ts-morph";
8530
+ import { Node as Node36 } from "ts-morph";
8348
8531
  import { joinMountedPath as joinMountedPath2 } from "@suss/resolution";
8349
-
8350
- // src/resolve/unfollowedCall.ts
8351
- import {
8352
- Node as Node34,
8353
- SyntaxKind as SyntaxKind8
8354
- } from "ts-morph";
8355
- import {
8356
- unfollowedCallGap,
8357
- worthRecording
8358
- } from "@suss/behavioral-ir";
8359
- function isInExternalCode(sourceFile) {
8360
- if (sourceFile.isDeclarationFile()) {
8361
- return true;
8362
- }
8363
- return sourceFile.getFilePath().includes("/node_modules/");
8364
- }
8365
- function hasBody(fn) {
8366
- if (Node34.isFunctionDeclaration(fn) || Node34.isMethodDeclaration(fn) || Node34.isFunctionExpression(fn)) {
8367
- return fn.getBody?.() !== void 0;
8368
- }
8369
- return true;
8370
- }
8371
- function isDeclaredShape(declaration) {
8372
- return (Node34.isMethodSignature(declaration) || Node34.isPropertySignature(declaration)) && !isInExternalCode(declaration.getSourceFile());
8373
- }
8374
- function isExternalDeclaration(declaration) {
8375
- if (isInExternalCode(declaration.getSourceFile())) {
8376
- return true;
8377
- }
8378
- if (Node34.isImportSpecifier(declaration) || Node34.isImportClause(declaration) || Node34.isNamespaceImport(declaration)) {
8379
- const target = declaration.getFirstAncestorByKind(SyntaxKind8.ImportDeclaration)?.getModuleSpecifierSourceFile();
8380
- return target === void 0 || isInExternalCode(target);
8381
- }
8382
- return declaresAnotherModule(declaration);
8383
- }
8384
- function declaresAnotherModule(declaration) {
8385
- const module = declaration.getFirstAncestorByKind(
8386
- SyntaxKind8.ModuleDeclaration
8387
- );
8388
- return module !== void 0 && Node34.isStringLiteral(module.getNameNode());
8389
- }
8390
- function statesShapeOnly(declaration) {
8391
- if (isExternalDeclaration(declaration)) {
8392
- return false;
8393
- }
8394
- if (Node34.isMethodSignature(declaration) || Node34.isPropertySignature(declaration)) {
8395
- return true;
8396
- }
8397
- if (Node34.isFunctionDeclaration(declaration) || Node34.isMethodDeclaration(declaration)) {
8398
- return declaration.getBody() === void 0;
8399
- }
8400
- return false;
8401
- }
8402
- function declarationsBehind(symbol) {
8403
- if (symbol === void 0) {
8404
- return [];
8405
- }
8406
- const behind = symbol.getAliasedSymbol()?.getDeclarations() ?? [];
8407
- return behind.length > 0 ? behind : symbol.getDeclarations();
8408
- }
8409
- function isParameterOf(declaration, scanning) {
8410
- return Node34.isParameterDeclaration(declaration) && declaration.getParent() === scanning;
8411
- }
8412
- function parameterIndexOf(declarations, scanning) {
8413
- if (scanning === void 0) {
8414
- return void 0;
8415
- }
8416
- const params = scanning.getParameters();
8417
- for (const declaration of declarations) {
8418
- const index = params.findIndex((param) => param === declaration);
8419
- if (index !== -1) {
8420
- return index;
8421
- }
8422
- }
8423
- return void 0;
8424
- }
8425
- function classifyStop(declarations, scanning) {
8426
- if (declarations.length === 0) {
8427
- return "noDeclaration";
8428
- }
8429
- for (const declaration of declarations) {
8430
- if (!isInExternalCode(declaration.getSourceFile())) {
8431
- recordFileDependency(declaration.getSourceFile().getFilePath());
8432
- }
8433
- }
8434
- if (scanning !== void 0 && declarations.some((declaration) => isParameterOf(declaration, scanning))) {
8435
- return "callerSupplied";
8436
- }
8437
- if (declarations.every(isExternalDeclaration)) {
8438
- return "outsideRun";
8439
- }
8440
- if (declarations.some(statesShapeOnly)) {
8441
- return "noBody";
8442
- }
8443
- return "unsettledValue";
8444
- }
8445
-
8446
- // src/discovery/registrationTemplate.ts
8447
8532
  function discoverRegistrationTemplates(sourceFile, match, kind, resolution, mountPrefixes) {
8448
8533
  const results = [];
8449
8534
  for (const node of helperCallsOf(sourceFile, match, resolution)) {
@@ -8504,15 +8589,15 @@ function helperCallsOf(sourceFile, match, resolution) {
8504
8589
  return callsResolvingTo(sourceFile, store, {
8505
8590
  module,
8506
8591
  name: match.helperName
8507
- }).filter(Node35.isCallExpression);
8592
+ }).filter(Node36.isCallExpression);
8508
8593
  }
8509
8594
  const calls = [];
8510
8595
  sourceFile.forEachDescendant((node) => {
8511
- if (!Node35.isCallExpression(node)) {
8596
+ if (!Node36.isCallExpression(node)) {
8512
8597
  return;
8513
8598
  }
8514
8599
  const callee = node.getExpression();
8515
- if (!Node35.isIdentifier(callee) || callee.getText() !== match.helperName) {
8600
+ if (!Node36.isIdentifier(callee) || callee.getText() !== match.helperName) {
8516
8601
  return;
8517
8602
  }
8518
8603
  if (module === void 0 || declaredInModule(callee, module)) {
@@ -8556,7 +8641,7 @@ function substitutePath(template, args) {
8556
8641
  return result;
8557
8642
  }
8558
8643
  function readStringLiteral(node) {
8559
- if (Node35.isStringLiteral(node) || Node35.isNoSubstitutionTemplateLiteral(node)) {
8644
+ if (Node36.isStringLiteral(node) || Node36.isNoSubstitutionTemplateLiteral(node)) {
8560
8645
  return node.getLiteralValue();
8561
8646
  }
8562
8647
  return null;
@@ -8579,7 +8664,7 @@ function resolveHandler(template, args, resolution) {
8579
8664
  return readPropertyAsFunction(arg, prop, resolution);
8580
8665
  }
8581
8666
  function handlerName2(value) {
8582
- return Node35.isIdentifier(value) ? value.getText() : value.getKindName();
8667
+ return Node36.isIdentifier(value) ? value.getText() : value.getKindName();
8583
8668
  }
8584
8669
  function readPropertyAsFunction(arg, prop, resolution) {
8585
8670
  const obj = objectLiteralOf(arg, resolution);
@@ -8590,7 +8675,7 @@ function readPropertyAsFunction(arg, prop, resolution) {
8590
8675
  if (propertyName(property) !== prop) {
8591
8676
  continue;
8592
8677
  }
8593
- if (Node35.isMethodDeclaration(property)) {
8678
+ if (Node36.isMethodDeclaration(property)) {
8594
8679
  return { func: property, name: prop };
8595
8680
  }
8596
8681
  const held = propertyValueOf(property);
@@ -8598,19 +8683,19 @@ function readPropertyAsFunction(arg, prop, resolution) {
8598
8683
  return null;
8599
8684
  }
8600
8685
  const func = functionValueOf(held, resolution);
8601
- return func === null ? null : { func, name: Node35.isIdentifier(held) ? held.getText() : prop };
8686
+ return func === null ? null : { func, name: Node36.isIdentifier(held) ? held.getText() : prop };
8602
8687
  }
8603
8688
  return null;
8604
8689
  }
8605
8690
  function propertyName(property) {
8606
- if (Node35.isPropertyAssignment(property) || Node35.isShorthandPropertyAssignment(property) || Node35.isMethodDeclaration(property)) {
8691
+ if (Node36.isPropertyAssignment(property) || Node36.isShorthandPropertyAssignment(property) || Node36.isMethodDeclaration(property)) {
8607
8692
  return property.getName();
8608
8693
  }
8609
8694
  return null;
8610
8695
  }
8611
8696
 
8612
8697
  // src/discovery/resolverMap.ts
8613
- import { Node as Node36 } from "ts-morph";
8698
+ import { Node as Node37 } from "ts-morph";
8614
8699
  function discoverResolverMaps(sourceFile, match, kind, resolution) {
8615
8700
  const store = resolution ?? new ResolutionStore();
8616
8701
  const mapProperty = match.mapProperty;
@@ -8621,7 +8706,7 @@ function discoverResolverMaps(sourceFile, match, kind, resolution) {
8621
8706
  name: match.importName
8622
8707
  })) {
8623
8708
  const args = node.getArguments();
8624
- if (args.length === 0 || !Node36.isObjectLiteralExpression(args[0])) {
8709
+ if (args.length === 0 || !Node37.isObjectLiteralExpression(args[0])) {
8625
8710
  continue;
8626
8711
  }
8627
8712
  const config = args[0];
@@ -8675,7 +8760,7 @@ function resolverMapObject(prop, resolution) {
8675
8760
  return held === null ? null : objectLiteralOf(held, resolution);
8676
8761
  }
8677
8762
  function extractTypeDefsSdl(config, resolution) {
8678
- if (!Node36.isObjectLiteralExpression(config)) {
8763
+ if (!Node37.isObjectLiteralExpression(config)) {
8679
8764
  return null;
8680
8765
  }
8681
8766
  const prop = config.getProperty("typeDefs");
@@ -8697,15 +8782,15 @@ function schemaSdlOf(expr, resolution) {
8697
8782
  return resolved === null ? null : writtenSdl(resolved);
8698
8783
  }
8699
8784
  function writtenSdl(expr) {
8700
- if (Node36.isStringLiteral(expr) || Node36.isNoSubstitutionTemplateLiteral(expr)) {
8785
+ if (Node37.isStringLiteral(expr) || Node37.isNoSubstitutionTemplateLiteral(expr)) {
8701
8786
  const value = expr.getLiteralValue();
8702
8787
  return value === "" ? null : value;
8703
8788
  }
8704
- if (Node36.isTaggedTemplateExpression(expr)) {
8789
+ if (Node37.isTaggedTemplateExpression(expr)) {
8705
8790
  const tag = expr.getTag();
8706
- if (Node36.isIdentifier(tag) && tag.getText() === "gql") {
8791
+ if (Node37.isIdentifier(tag) && tag.getText() === "gql") {
8707
8792
  const template = expr.getTemplate();
8708
- if (Node36.isNoSubstitutionTemplateLiteral(template)) {
8793
+ if (Node37.isNoSubstitutionTemplateLiteral(template)) {
8709
8794
  return template.getLiteralValue();
8710
8795
  }
8711
8796
  }
@@ -8714,7 +8799,7 @@ function writtenSdl(expr) {
8714
8799
  }
8715
8800
 
8716
8801
  // src/discovery/index.ts
8717
- function runPattern(sourceFile, pattern, resolution, mountPrefixes, expandedElsewhere) {
8802
+ function runPattern(sourceFile, pattern, resolution, mountPrefixes, expandedElsewhere, routeWrapperPattern) {
8718
8803
  if (pattern.match.type === "namedExport") {
8719
8804
  return discoverNamedExports(
8720
8805
  sourceFile,
@@ -8731,7 +8816,8 @@ function runPattern(sourceFile, pattern, resolution, mountPrefixes, expandedElse
8731
8816
  pattern.bindingExtraction,
8732
8817
  resolution,
8733
8818
  mountPrefixes,
8734
- expandedElsewhere
8819
+ expandedElsewhere,
8820
+ routeWrapperPattern
8735
8821
  );
8736
8822
  }
8737
8823
  if (pattern.match.type === "registrationTemplate") {
@@ -8837,19 +8923,26 @@ function runPattern(sourceFile, pattern, resolution, mountPrefixes, expandedElse
8837
8923
  }
8838
8924
  return [];
8839
8925
  }
8926
+ function routeWrapperPatternOf(patterns) {
8927
+ return patterns.find(
8928
+ (pattern) => pattern.wraps !== void 0 && "method" in pattern.wraps && pattern.wraps.continuationParam !== void 0 && pattern.wraps.throwParam === void 0 && pattern.wraps.arity === void 0 && pattern.wraps.scopePosition === void 0
8929
+ );
8930
+ }
8840
8931
  function discoverUnits(sourceFile, patterns, resolution, mountPrefixes, expandedElsewhere) {
8841
8932
  const store = resolution ?? new ResolutionStore();
8842
8933
  const allResults = [];
8934
+ const routeWrapperPattern = routeWrapperPatternOf(patterns);
8843
8935
  for (const pattern of patterns) {
8844
8936
  const found = runPattern(
8845
8937
  sourceFile,
8846
8938
  pattern,
8847
8939
  store,
8848
8940
  mountPrefixes,
8849
- expandedElsewhere
8941
+ expandedElsewhere,
8942
+ routeWrapperPattern
8850
8943
  );
8851
8944
  for (const unit of found) {
8852
- unit.pattern = pattern;
8945
+ unit.pattern ??= pattern;
8853
8946
  }
8854
8947
  allResults.push(...found);
8855
8948
  }
@@ -8868,7 +8961,7 @@ function discoverUnits(sourceFile, patterns, resolution, mountPrefixes, expanded
8868
8961
  // src/resolve/functionBehind.ts
8869
8962
  function symbolBehind(node) {
8870
8963
  const parent = node.getParent();
8871
- if (parent !== void 0 && Node37.isShorthandPropertyAssignment(parent)) {
8964
+ if (parent !== void 0 && Node38.isShorthandPropertyAssignment(parent)) {
8872
8965
  return parent.getValueSymbol();
8873
8966
  }
8874
8967
  return node.getSymbol();
@@ -8898,9 +8991,9 @@ function resolveDecl(decl, calleeName) {
8898
8991
  }
8899
8992
  return { func: fn, name: declName(decl) ?? calleeName };
8900
8993
  }
8901
- if (Node37.isVariableDeclaration(decl)) {
8994
+ if (Node38.isVariableDeclaration(decl)) {
8902
8995
  const init = decl.getInitializer();
8903
- if (init !== void 0 && (Node37.isArrowFunction(init) || Node37.isFunctionExpression(init))) {
8996
+ if (init !== void 0 && (Node38.isArrowFunction(init) || Node38.isFunctionExpression(init))) {
8904
8997
  return { func: init, name: decl.getName() };
8905
8998
  }
8906
8999
  return null;
@@ -8908,20 +9001,20 @@ function resolveDecl(decl, calleeName) {
8908
9001
  return null;
8909
9002
  }
8910
9003
  function declName(decl) {
8911
- if (Node37.isFunctionDeclaration(decl) || Node37.isMethodDeclaration(decl)) {
9004
+ if (Node38.isFunctionDeclaration(decl) || Node38.isMethodDeclaration(decl)) {
8912
9005
  const n = decl.getName?.();
8913
9006
  if (typeof n === "string" && n.length > 0) {
8914
9007
  return n;
8915
9008
  }
8916
9009
  }
8917
- if (Node37.isFunctionExpression(decl)) {
9010
+ if (Node38.isFunctionExpression(decl)) {
8918
9011
  const n = decl.getName();
8919
9012
  if (typeof n === "string" && n.length > 0) {
8920
9013
  return n;
8921
9014
  }
8922
9015
  }
8923
9016
  const parent = decl.getParent();
8924
- if (parent !== void 0 && Node37.isVariableDeclaration(parent)) {
9017
+ if (parent !== void 0 && Node38.isVariableDeclaration(parent)) {
8925
9018
  return parent.getName();
8926
9019
  }
8927
9020
  return null;
@@ -8933,14 +9026,14 @@ function pathAbove(reference) {
8933
9026
  let current2 = reference;
8934
9027
  for (; ; ) {
8935
9028
  const parent = current2.getParent();
8936
- if (parent !== void 0 && Node38.isPropertyAccessExpression(parent) && parent.getExpression() === current2) {
9029
+ if (parent !== void 0 && Node39.isPropertyAccessExpression(parent) && parent.getExpression() === current2) {
8937
9030
  path15.push(parent.getName());
8938
9031
  current2 = parent;
8939
9032
  continue;
8940
9033
  }
8941
- if (parent !== void 0 && Node38.isElementAccessExpression(parent) && parent.getExpression() === current2) {
9034
+ if (parent !== void 0 && Node39.isElementAccessExpression(parent) && parent.getExpression() === current2) {
8942
9035
  const argument = parent.getArgumentExpression();
8943
- if (argument !== void 0 && Node38.isStringLiteral(argument)) {
9036
+ if (argument !== void 0 && Node39.isStringLiteral(argument)) {
8944
9037
  path15.push(argument.getLiteralValue());
8945
9038
  current2 = parent;
8946
9039
  continue;
@@ -8950,11 +9043,11 @@ function pathAbove(reference) {
8950
9043
  }
8951
9044
  }
8952
9045
  function declaresParameterOf(node, func) {
8953
- if (Node38.isParameterDeclaration(node)) {
9046
+ if (Node39.isParameterDeclaration(node)) {
8954
9047
  return node.getParent() === func;
8955
9048
  }
8956
- if (Node38.isBindingElement(node)) {
8957
- const parameter = node.getFirstAncestor(Node38.isParameterDeclaration);
9049
+ if (Node39.isBindingElement(node)) {
9050
+ const parameter = node.getFirstAncestor(Node39.isParameterDeclaration);
8958
9051
  return parameter !== void 0 && parameter.getParent() === func;
8959
9052
  }
8960
9053
  return false;
@@ -8970,7 +9063,7 @@ function parameterReads(func, parameterNames2, barriers = NO_BARRIERS) {
8970
9063
  traversal.skip();
8971
9064
  return;
8972
9065
  }
8973
- if (!Node38.isIdentifier(node) || !wanted.has(node.getText())) {
9066
+ if (!Node39.isIdentifier(node) || !wanted.has(node.getText())) {
8974
9067
  return;
8975
9068
  }
8976
9069
  const declarations = symbolBehind(node)?.getDeclarations() ?? [];
@@ -8993,7 +9086,7 @@ function parameterReads(func, parameterNames2, barriers = NO_BARRIERS) {
8993
9086
  }
8994
9087
 
8995
9088
  // src/resolve/readName.ts
8996
- import { Node as Node39, SyntaxKind as SyntaxKind9 } from "ts-morph";
9089
+ import { Node as Node40, SyntaxKind as SyntaxKind9 } from "ts-morph";
8997
9090
  import { patternHole, referenceName } from "@suss/behavioral-ir";
8998
9091
  var MAX_HELPER_HOPS = 2;
8999
9092
  var UNNAMED_HOLE = "param";
@@ -9028,11 +9121,11 @@ function referenceIn(expr) {
9028
9121
  function parameterPath(expr) {
9029
9122
  const fields = [];
9030
9123
  let step = expr;
9031
- while (Node39.isPropertyAccessExpression(step)) {
9124
+ while (Node40.isPropertyAccessExpression(step)) {
9032
9125
  fields.unshift(step.getName());
9033
9126
  step = step.getExpression();
9034
9127
  }
9035
- if (!Node39.isIdentifier(step) || !isParameter(step)) {
9128
+ if (!Node40.isIdentifier(step) || !isParameter(step)) {
9036
9129
  return null;
9037
9130
  }
9038
9131
  return { root: step.getText(), fields };
@@ -9040,7 +9133,7 @@ function parameterPath(expr) {
9040
9133
  function isParameter(identifier) {
9041
9134
  const declarations = identifier.getSymbol()?.getDeclarations() ?? [];
9042
9135
  return declarations.some(
9043
- (declaration) => Node39.isParameterDeclaration(declaration)
9136
+ (declaration) => Node40.isParameterDeclaration(declaration)
9044
9137
  );
9045
9138
  }
9046
9139
  function read(expr, ctx) {
@@ -9049,25 +9142,25 @@ function read(expr, ctx) {
9049
9142
  }
9050
9143
  const seen = new Set(ctx.seen).add(expr);
9051
9144
  const inner = { ...ctx, seen };
9052
- if (Node39.isStringLiteral(expr) || Node39.isNoSubstitutionTemplateLiteral(expr)) {
9145
+ if (Node40.isStringLiteral(expr) || Node40.isNoSubstitutionTemplateLiteral(expr)) {
9053
9146
  return expr.getLiteralValue();
9054
9147
  }
9055
- if (Node39.isNumericLiteral(expr)) {
9148
+ if (Node40.isNumericLiteral(expr)) {
9056
9149
  return expr.getLiteralText();
9057
9150
  }
9058
- if (Node39.isTemplateExpression(expr)) {
9151
+ if (Node40.isTemplateExpression(expr)) {
9059
9152
  return fromTemplate(expr, inner);
9060
9153
  }
9061
- if (Node39.isParenthesizedExpression(expr)) {
9154
+ if (Node40.isParenthesizedExpression(expr)) {
9062
9155
  return read(peelParens(expr), inner);
9063
9156
  }
9064
- if (Node39.isBinaryExpression(expr)) {
9157
+ if (Node40.isBinaryExpression(expr)) {
9065
9158
  return fromBinary(expr, inner);
9066
9159
  }
9067
- if (Node39.isCallExpression(expr)) {
9160
+ if (Node40.isCallExpression(expr)) {
9068
9161
  return fromCall(expr, inner);
9069
9162
  }
9070
- if (Node39.isIdentifier(expr)) {
9163
+ if (Node40.isIdentifier(expr)) {
9071
9164
  const only = boundOnce(expr, ctx);
9072
9165
  if (only !== null) {
9073
9166
  return read(only.node, { ...inner, bindings: only.scope });
@@ -9087,17 +9180,17 @@ function read(expr, ctx) {
9087
9180
  }
9088
9181
  function isFallbackBranch(node) {
9089
9182
  let step = node.getParent();
9090
- while (step !== void 0 && Node39.isParenthesizedExpression(step)) {
9183
+ while (step !== void 0 && Node40.isParenthesizedExpression(step)) {
9091
9184
  step = step.getParent();
9092
9185
  }
9093
- if (step === void 0 || !Node39.isBinaryExpression(step)) {
9186
+ if (step === void 0 || !Node40.isBinaryExpression(step)) {
9094
9187
  return false;
9095
9188
  }
9096
9189
  const operator = step.getOperatorToken().getKind();
9097
9190
  return operator === SyntaxKind9.BarBarToken || operator === SyntaxKind9.QuestionQuestionToken;
9098
9191
  }
9099
9192
  function fromTemplate(expr, ctx) {
9100
- if (!Node39.isTemplateExpression(expr)) {
9193
+ if (!Node40.isTemplateExpression(expr)) {
9101
9194
  return null;
9102
9195
  }
9103
9196
  let name = expr.getHead().getLiteralText();
@@ -9108,7 +9201,7 @@ function fromTemplate(expr, ctx) {
9108
9201
  return name;
9109
9202
  }
9110
9203
  function fromBinary(expr, ctx) {
9111
- if (!Node39.isBinaryExpression(expr)) {
9204
+ if (!Node40.isBinaryExpression(expr)) {
9112
9205
  return null;
9113
9206
  }
9114
9207
  const operator = expr.getOperatorToken().getKind();
@@ -9122,14 +9215,14 @@ function fromBinary(expr, ctx) {
9122
9215
  return readOrHole(expr.getLeft(), parts) + readOrHole(expr.getRight(), parts);
9123
9216
  }
9124
9217
  function fromCall(expr, ctx) {
9125
- if (!Node39.isCallExpression(expr)) {
9218
+ if (!Node40.isCallExpression(expr)) {
9126
9219
  return null;
9127
9220
  }
9128
9221
  const callee = expr.getExpression();
9129
- if (Node39.isPropertyAccessExpression(callee) && callee.getName() === "join") {
9222
+ if (Node40.isPropertyAccessExpression(callee) && callee.getName() === "join") {
9130
9223
  return fromJoin(callee.getExpression(), expr.getArguments(), ctx);
9131
9224
  }
9132
- if (Node39.isIdentifier(callee) && callee.getText() === "String") {
9225
+ if (Node40.isIdentifier(callee) && callee.getText() === "String") {
9133
9226
  const only = expr.getArguments()[0];
9134
9227
  return only === void 0 ? null : readOrHole(only, ctx);
9135
9228
  }
@@ -9148,7 +9241,7 @@ function fromCall(expr, ctx) {
9148
9241
  }
9149
9242
  function fromJoin(subject, args, ctx) {
9150
9243
  const separator = args[0];
9151
- if (separator === void 0 || !Node39.isStringLiteral(separator)) {
9244
+ if (separator === void 0 || !Node40.isStringLiteral(separator)) {
9152
9245
  return null;
9153
9246
  }
9154
9247
  const parts = elementsOf(subject, ctx);
@@ -9164,17 +9257,17 @@ function fromJoin(subject, args, ctx) {
9164
9257
  ).join(separator.getLiteralValue());
9165
9258
  }
9166
9259
  function elementsOf(subject, ctx) {
9167
- if (Node39.isArrayLiteralExpression(subject)) {
9260
+ if (Node40.isArrayLiteralExpression(subject)) {
9168
9261
  return subject.getElements().map((element) => here(element, ctx));
9169
9262
  }
9170
- if (Node39.isCallExpression(subject)) {
9263
+ if (Node40.isCallExpression(subject)) {
9171
9264
  const callee = subject.getExpression();
9172
- if (Node39.isPropertyAccessExpression(callee) && callee.getName() === "map") {
9265
+ if (Node40.isPropertyAccessExpression(callee) && callee.getName() === "map") {
9173
9266
  return elementsOf(callee.getExpression(), ctx);
9174
9267
  }
9175
9268
  return null;
9176
9269
  }
9177
- if (!Node39.isIdentifier(subject)) {
9270
+ if (!Node40.isIdentifier(subject)) {
9178
9271
  return null;
9179
9272
  }
9180
9273
  const bound = ctx.bindings.get(subject.getText());
@@ -9182,7 +9275,7 @@ function elementsOf(subject, ctx) {
9182
9275
  return null;
9183
9276
  }
9184
9277
  const only = bound.length === 1 ? bound[0] : void 0;
9185
- return only !== void 0 && Node39.isArrayLiteralExpression(only.node) ? only.node.getElements().map((element) => here(element, ctx)) : bound;
9278
+ return only !== void 0 && Node40.isArrayLiteralExpression(only.node) ? only.node.getElements().map((element) => here(element, ctx)) : bound;
9186
9279
  }
9187
9280
  function singleReturnBody(callee, ctx) {
9188
9281
  const declaration = declarationOf2(callee, ctx);
@@ -9197,22 +9290,22 @@ function singleReturnBody(callee, ctx) {
9197
9290
  if (body === void 0) {
9198
9291
  return null;
9199
9292
  }
9200
- if (Node39.isExpression(body)) {
9293
+ if (Node40.isExpression(body)) {
9201
9294
  return { parameters, returned: body };
9202
9295
  }
9203
- if (!Node39.isBlock(body)) {
9296
+ if (!Node40.isBlock(body)) {
9204
9297
  return null;
9205
9298
  }
9206
9299
  const statements = body.getStatements();
9207
9300
  const only = statements[0];
9208
- if (statements.length !== 1 || only === void 0 || !Node39.isReturnStatement(only)) {
9301
+ if (statements.length !== 1 || only === void 0 || !Node40.isReturnStatement(only)) {
9209
9302
  return null;
9210
9303
  }
9211
9304
  const returned = only.getExpression();
9212
9305
  return returned === void 0 ? null : { parameters, returned };
9213
9306
  }
9214
9307
  function declarationOf2(callee, ctx) {
9215
- const symbol = Node39.isPropertyAccessExpression(callee) ? callee.getNameNode().getSymbol() : callee.getSymbol();
9308
+ const symbol = Node40.isPropertyAccessExpression(callee) ? callee.getNameNode().getSymbol() : callee.getSymbol();
9216
9309
  const declarations = symbol?.getAliasedSymbol()?.getDeclarations() ?? symbol?.getDeclarations() ?? [];
9217
9310
  for (const declaration of declarations) {
9218
9311
  const callable = asCallable(declaration);
@@ -9224,14 +9317,14 @@ function declarationOf2(callee, ctx) {
9224
9317
  return written === null || written === callee ? null : declarationOf2(written, { ...ctx, resolve: () => null });
9225
9318
  }
9226
9319
  function asCallable(declaration) {
9227
- if (Node39.isFunctionDeclaration(declaration) || Node39.isMethodDeclaration(declaration) || Node39.isArrowFunction(declaration) || Node39.isFunctionExpression(declaration)) {
9320
+ if (Node40.isFunctionDeclaration(declaration) || Node40.isMethodDeclaration(declaration) || Node40.isArrowFunction(declaration) || Node40.isFunctionExpression(declaration)) {
9228
9321
  return declaration;
9229
9322
  }
9230
- if (!Node39.isVariableDeclaration(declaration)) {
9323
+ if (!Node40.isVariableDeclaration(declaration)) {
9231
9324
  return null;
9232
9325
  }
9233
9326
  const initializer = declaration.getInitializer();
9234
- if (initializer !== void 0 && (Node39.isArrowFunction(initializer) || Node39.isFunctionExpression(initializer))) {
9327
+ if (initializer !== void 0 && (Node40.isArrowFunction(initializer) || Node40.isFunctionExpression(initializer))) {
9235
9328
  return initializer;
9236
9329
  }
9237
9330
  return null;
@@ -9253,7 +9346,7 @@ function here(node, ctx) {
9253
9346
  return { node, scope: ctx.bindings };
9254
9347
  }
9255
9348
  function boundOnce(expr, ctx) {
9256
- const bound = Node39.isIdentifier(expr) ? ctx.bindings.get(expr.getText()) : void 0;
9349
+ const bound = Node40.isIdentifier(expr) ? ctx.bindings.get(expr.getText()) : void 0;
9257
9350
  return bound !== void 0 && bound.length === 1 ? bound[0] : null;
9258
9351
  }
9259
9352
  function readOrHole(expr, ctx) {
@@ -9265,10 +9358,10 @@ function holeName(expr, ctx) {
9265
9358
  if (bound !== null) {
9266
9359
  return holeName(bound.node, { ...ctx, bindings: bound.scope });
9267
9360
  }
9268
- if (Node39.isIdentifier(expr)) {
9361
+ if (Node40.isIdentifier(expr)) {
9269
9362
  return expr.getText();
9270
9363
  }
9271
- if (Node39.isPropertyAccessExpression(expr)) {
9364
+ if (Node40.isPropertyAccessExpression(expr)) {
9272
9365
  return expr.getName();
9273
9366
  }
9274
9367
  return UNNAMED_HOLE;
@@ -9295,8 +9388,8 @@ function madeFromNamed(origin, made) {
9295
9388
  return origin.named.includes(constructorName(made));
9296
9389
  }
9297
9390
  function constructorName(made) {
9298
- const expression = Node40.isNewExpression(made) || Node40.isCallExpression(made) ? made.getExpression() : made;
9299
- return Node40.isPropertyAccessExpression(expression) ? expression.getName() : expression.getText();
9391
+ const expression = Node41.isNewExpression(made) || Node41.isCallExpression(made) ? made.getExpression() : made;
9392
+ return Node41.isPropertyAccessExpression(expression) ? expression.getName() : expression.getText();
9300
9393
  }
9301
9394
  var CALL_ORIGIN = {
9302
9395
  declaredBy: ORIGIN.declaredBy,
@@ -9310,7 +9403,7 @@ var CALL_ORIGIN = {
9310
9403
  };
9311
9404
  function madeBy(receiver) {
9312
9405
  const made = madeExpression(receiver);
9313
- const expression = Node40.isNewExpression(made) || Node40.isCallExpression(made) ? made.getExpression() : made;
9406
+ const expression = Node41.isNewExpression(made) || Node41.isCallExpression(made) ? made.getExpression() : made;
9314
9407
  return rootIdentifier(expression) ?? expression;
9315
9408
  }
9316
9409
  function madeExpression(receiver) {
@@ -9318,7 +9411,7 @@ function madeExpression(receiver) {
9318
9411
  return receiver.expression;
9319
9412
  }
9320
9413
  const written = receiver.resolve(receiver.callee.getExpression());
9321
- if (written === null || !Node40.isNewExpression(written) && !Node40.isCallExpression(written)) {
9414
+ if (written === null || !Node41.isNewExpression(written) && !Node41.isCallExpression(written)) {
9322
9415
  return receiver.callee;
9323
9416
  }
9324
9417
  return written;
@@ -9326,7 +9419,7 @@ function madeExpression(receiver) {
9326
9419
  function callOpsFor(call, resolveWrittenValue, originatesFrom, anchorCallsOf) {
9327
9420
  const resolve2 = resolveWrittenValue ?? (() => null);
9328
9421
  const expression = calleeOf3(call);
9329
- const callee = Node40.isPropertyAccessExpression(expression) ? expression : null;
9422
+ const callee = Node41.isPropertyAccessExpression(expression) ? expression : null;
9330
9423
  let args = null;
9331
9424
  const argumentsOf = () => {
9332
9425
  args ??= argumentsIn(call);
@@ -9349,7 +9442,7 @@ function callOpsFor(call, resolveWrittenValue, originatesFrom, anchorCallsOf) {
9349
9442
  argumentCount: () => argumentsOf().length,
9350
9443
  nameAt: (index, unsettled) => nameAt(argumentsOf()[index], unsettled, resolve2),
9351
9444
  calleeText: () => expression.getText(),
9352
- namedCallee: () => Node40.isIdentifier(expression),
9445
+ namedCallee: () => Node41.isIdentifier(expression),
9353
9446
  parameterReadsAt: (index) => selectorReadsOf(argumentsOf()[index]),
9354
9447
  receiver: () => callee === null ? null : opsOverCall(callee.getExpression(), resolve2),
9355
9448
  argument: (index) => opsOverCall(argumentsOf()[index], resolve2),
@@ -9374,7 +9467,7 @@ function anchorCallBehind(subject, origin, resolve2, originatesFrom, anchorCalls
9374
9467
  return null;
9375
9468
  }
9376
9469
  const found = anchorCallsOf(subject, (candidate) => {
9377
- if (!Node40.isCallExpression(candidate) && !Node40.isNewExpression(candidate)) {
9470
+ if (!Node41.isCallExpression(candidate) && !Node41.isNewExpression(candidate)) {
9378
9471
  return false;
9379
9472
  }
9380
9473
  const candidateCallee = calleeOf3(candidate);
@@ -9389,7 +9482,7 @@ function anchorCallBehind(subject, origin, resolve2, originatesFrom, anchorCalls
9389
9482
  if (distinct.length !== 1 || only === void 0) {
9390
9483
  return null;
9391
9484
  }
9392
- if (!Node40.isCallExpression(only) && !Node40.isNewExpression(only)) {
9485
+ if (!Node41.isCallExpression(only) && !Node41.isNewExpression(only)) {
9393
9486
  return null;
9394
9487
  }
9395
9488
  return callOpsFor(only, resolve2, originatesFrom, anchorCallsOf);
@@ -9409,7 +9502,7 @@ function valueOpsFor(value, resolve2) {
9409
9502
  asArg: () => effectArgOf(written()),
9410
9503
  property: (name) => {
9411
9504
  const object = written();
9412
- const inside = Node40.isObjectLiteralExpression(object) ? initializerOf(object, name) : null;
9505
+ const inside = Node41.isObjectLiteralExpression(object) ? initializerOf(object, name) : null;
9413
9506
  return inside === null ? null : valueOpsFor(inside, resolve2);
9414
9507
  },
9415
9508
  parts: () => literalParts(written()),
@@ -9422,7 +9515,7 @@ function literalParts(value) {
9422
9515
  if (whole !== null) {
9423
9516
  return [whole];
9424
9517
  }
9425
- if (!Node40.isTemplateExpression(written)) {
9518
+ if (!Node41.isTemplateExpression(written)) {
9426
9519
  return null;
9427
9520
  }
9428
9521
  return [
@@ -9432,26 +9525,26 @@ function literalParts(value) {
9432
9525
  }
9433
9526
  function templateHoles(value, resolve2) {
9434
9527
  const written = untagged(value);
9435
- if (!Node40.isTemplateExpression(written)) {
9528
+ if (!Node41.isTemplateExpression(written)) {
9436
9529
  return [];
9437
9530
  }
9438
9531
  return written.getTemplateSpans().map((span) => opsOverCall(span.getExpression(), resolve2));
9439
9532
  }
9440
9533
  function untagged(value) {
9441
- return Node40.isTaggedTemplateExpression(value) ? value.getTemplate() : value;
9534
+ return Node41.isTaggedTemplateExpression(value) ? value.getTemplate() : value;
9442
9535
  }
9443
9536
  function entriesOf(value, unsettled, resolve2) {
9444
- if (!Node40.isObjectLiteralExpression(value)) {
9537
+ if (!Node41.isObjectLiteralExpression(value)) {
9445
9538
  return [];
9446
9539
  }
9447
9540
  const found = [];
9448
9541
  for (const written of value.getProperties()) {
9449
- if (Node40.isShorthandPropertyAssignment(written)) {
9542
+ if (Node41.isShorthandPropertyAssignment(written)) {
9450
9543
  const name = written.getNameNode();
9451
9544
  found.push({ key: name.getText(), value: valueOpsFor(name, resolve2) });
9452
9545
  continue;
9453
9546
  }
9454
- if (!Node40.isPropertyAssignment(written)) {
9547
+ if (!Node41.isPropertyAssignment(written)) {
9455
9548
  continue;
9456
9549
  }
9457
9550
  const stated = written.getInitializer();
@@ -9464,35 +9557,35 @@ function entriesOf(value, unsettled, resolve2) {
9464
9557
  }
9465
9558
  function entryKey(written, unsettled, resolve2) {
9466
9559
  const name = written.getNameNode();
9467
- if (Node40.isComputedPropertyName(name)) {
9560
+ if (Node41.isComputedPropertyName(name)) {
9468
9561
  return readName(name.getExpression(), { resolve: resolve2, unsettled });
9469
9562
  }
9470
9563
  return unquoted(written.getName());
9471
9564
  }
9472
9565
  function itemsOf(value, resolve2) {
9473
- if (!Node40.isArrayLiteralExpression(value)) {
9566
+ if (!Node41.isArrayLiteralExpression(value)) {
9474
9567
  return [];
9475
9568
  }
9476
9569
  return value.getElements().map((element) => valueOpsFor(element, resolve2));
9477
9570
  }
9478
9571
  function literalText(value) {
9479
- return Node40.isStringLiteral(value) || Node40.isNoSubstitutionTemplateLiteral(value) ? value.getLiteralValue() : null;
9572
+ return Node41.isStringLiteral(value) || Node41.isNoSubstitutionTemplateLiteral(value) ? value.getLiteralValue() : null;
9480
9573
  }
9481
9574
  function literalFlag(value) {
9482
- if (Node40.isTrueLiteral(value) || Node40.isFalseLiteral(value)) {
9483
- return Node40.isTrueLiteral(value);
9575
+ if (Node41.isTrueLiteral(value) || Node41.isFalseLiteral(value)) {
9576
+ return Node41.isTrueLiteral(value);
9484
9577
  }
9485
- return Node40.isNumericLiteral(value) ? value.getLiteralValue() !== 0 : null;
9578
+ return Node41.isNumericLiteral(value) ? value.getLiteralValue() !== 0 : null;
9486
9579
  }
9487
9580
  function unquoted(name) {
9488
9581
  return name.replace(/^["']|["']$/g, "");
9489
9582
  }
9490
9583
  function selectorReadsOf(argument) {
9491
- if (argument === void 0 || !Node40.isArrowFunction(argument) && !Node40.isFunctionExpression(argument)) {
9584
+ if (argument === void 0 || !Node41.isArrowFunction(argument) && !Node41.isFunctionExpression(argument)) {
9492
9585
  return null;
9493
9586
  }
9494
9587
  const parameter = argument.getParameters()[0];
9495
- if (parameter === void 0 || !Node40.isIdentifier(parameter.getNameNode())) {
9588
+ if (parameter === void 0 || !Node41.isIdentifier(parameter.getNameNode())) {
9496
9589
  return null;
9497
9590
  }
9498
9591
  const names = /* @__PURE__ */ new Set();
@@ -9509,17 +9602,17 @@ function opsOverCall(value, resolve2) {
9509
9602
  return callOpsFor(written, resolve2);
9510
9603
  }
9511
9604
  function isCalled(value) {
9512
- return Node40.isCallExpression(value) || Node40.isNewExpression(value) || Node40.isTaggedTemplateExpression(value);
9605
+ return Node41.isCallExpression(value) || Node41.isNewExpression(value) || Node41.isTaggedTemplateExpression(value);
9513
9606
  }
9514
9607
  function calleeOf3(call) {
9515
- return Node40.isTaggedTemplateExpression(call) ? call.getTag() : call.getExpression();
9608
+ return Node41.isTaggedTemplateExpression(call) ? call.getTag() : call.getExpression();
9516
9609
  }
9517
9610
  function argumentsIn(call) {
9518
- return Node40.isTaggedTemplateExpression(call) ? [call.getTemplate()] : call.getArguments();
9611
+ return Node41.isTaggedTemplateExpression(call) ? [call.getTemplate()] : call.getArguments();
9519
9612
  }
9520
9613
  function settled(value, resolve2) {
9521
9614
  const step = unwrapped(value ?? null);
9522
- if (step === null || !Node40.isIdentifier(step)) {
9615
+ if (step === null || !Node41.isIdentifier(step)) {
9523
9616
  return step;
9524
9617
  }
9525
9618
  return unwrapped(resolve2(step));
@@ -9546,11 +9639,11 @@ function objectAt(argument, resolve2) {
9546
9639
  if (isCalled(written)) {
9547
9640
  return objectAt(argumentsIn(written)[0], resolve2);
9548
9641
  }
9549
- return Node40.isObjectLiteralExpression(written) ? written : null;
9642
+ return Node41.isObjectLiteralExpression(written) ? written : null;
9550
9643
  }
9551
9644
  function initializerOf(object, property) {
9552
9645
  for (const written of object.getProperties()) {
9553
- if (Node40.isPropertyAssignment(written) && written.getName() === property) {
9646
+ if (Node41.isPropertyAssignment(written) && written.getName() === property) {
9554
9647
  return written.getInitializer() ?? null;
9555
9648
  }
9556
9649
  }
@@ -9580,7 +9673,7 @@ function invocationContextFor(call, resolveWrittenValue, originatesFrom, anchorC
9580
9673
  };
9581
9674
  }
9582
9675
  function isImportedFrom(identifier, expectedModule, originatesFrom) {
9583
- if (!Node41.isIdentifier(identifier)) {
9676
+ if (!Node42.isIdentifier(identifier)) {
9584
9677
  return false;
9585
9678
  }
9586
9679
  const symbol = identifier.getSymbol();
@@ -9601,7 +9694,7 @@ function isImportedFrom(identifier, expectedModule, originatesFrom) {
9601
9694
  );
9602
9695
  }
9603
9696
  function methodDeclaredIn(callee, expectedModule, resolve2, originatesFrom) {
9604
- if (!Node41.isPropertyAccessExpression(callee)) {
9697
+ if (!Node42.isPropertyAccessExpression(callee)) {
9605
9698
  return false;
9606
9699
  }
9607
9700
  const declarations = callee.getNameNode().getSymbol()?.getDeclarations();
@@ -9621,37 +9714,37 @@ function maker(written) {
9621
9714
  if (written === null) {
9622
9715
  return null;
9623
9716
  }
9624
- if (Node41.isNewExpression(written) || Node41.isCallExpression(written)) {
9717
+ if (Node42.isNewExpression(written) || Node42.isCallExpression(written)) {
9625
9718
  return written.getExpression();
9626
9719
  }
9627
9720
  return null;
9628
9721
  }
9629
9722
  function rootIdentifier2(expression) {
9630
9723
  let root = expression;
9631
- while (Node41.isPropertyAccessExpression(root)) {
9724
+ while (Node42.isPropertyAccessExpression(root)) {
9632
9725
  root = root.getExpression();
9633
9726
  }
9634
9727
  return root;
9635
9728
  }
9636
9729
  function importSpecifierMatches(decl, expectedModule) {
9637
- if (Node41.isImportSpecifier(decl)) {
9730
+ if (Node42.isImportSpecifier(decl)) {
9638
9731
  return decl.getImportDeclaration().getModuleSpecifierValue() === expectedModule;
9639
9732
  }
9640
- const owner = Node41.isNamespaceImport(decl) ? decl.getParent() : decl;
9641
- if (!Node41.isImportClause(owner)) {
9733
+ const owner = Node42.isNamespaceImport(decl) ? decl.getParent() : decl;
9734
+ if (!Node42.isImportClause(owner)) {
9642
9735
  return false;
9643
9736
  }
9644
9737
  const importDecl = owner.getParent();
9645
- return Node41.isImportDeclaration(importDecl) && importDecl.getModuleSpecifierValue() === expectedModule;
9738
+ return Node42.isImportDeclaration(importDecl) && importDecl.getModuleSpecifierValue() === expectedModule;
9646
9739
  }
9647
9740
  function extractInvocationEffects(func, barriers = NO_BARRIERS) {
9648
9741
  const calls = [];
9649
9742
  func.forEachDescendant((node, traversal) => {
9650
- if (isDescentStop(node, func, barriers) || Node41.isDecorator(node)) {
9743
+ if (isDescentStop(node, func, barriers) || Node42.isDecorator(node)) {
9651
9744
  traversal.skip();
9652
9745
  return;
9653
9746
  }
9654
- if (Node41.isCallExpression(node)) {
9747
+ if (Node42.isCallExpression(node)) {
9655
9748
  calls.push(node);
9656
9749
  }
9657
9750
  });
@@ -9675,10 +9768,10 @@ function invocationAt(call, func) {
9675
9768
  }
9676
9769
  function isAwaited(call) {
9677
9770
  let current2 = call.getParent();
9678
- while (current2 !== void 0 && Node41.isParenthesizedExpression(current2)) {
9771
+ while (current2 !== void 0 && Node42.isParenthesizedExpression(current2)) {
9679
9772
  current2 = current2.getParent();
9680
9773
  }
9681
- return current2 !== void 0 && Node41.isAwaitExpression(current2);
9774
+ return current2 !== void 0 && Node42.isAwaitExpression(current2);
9682
9775
  }
9683
9776
  function runInvocationRecognizers(func, recognizers, barriers = NO_BARRIERS, resolveWrittenValue, originatesFrom, anchorCallsOf) {
9684
9777
  if (recognizers.length === 0) {
@@ -9691,7 +9784,7 @@ function runInvocationRecognizers(func, recognizers, barriers = NO_BARRIERS, res
9691
9784
  traversal.skip();
9692
9785
  return;
9693
9786
  }
9694
- if (!Node41.isCallExpression(node)) {
9787
+ if (!Node42.isCallExpression(node)) {
9695
9788
  return;
9696
9789
  }
9697
9790
  const ctx = invocationContextFor(
@@ -9753,7 +9846,7 @@ function runAccessRecognizersAtModuleScope(sourceFile, recognizers, resolveWritt
9753
9846
  }
9754
9847
  function accessContextFor(node, sourceFile, resolveWrittenValue = () => null, originatesFrom, anchorCallsOf) {
9755
9848
  const given = { access: node, sourceFile, resolveWrittenValue };
9756
- if (Node41.isPropertyAccessExpression(node)) {
9849
+ if (Node42.isPropertyAccessExpression(node)) {
9757
9850
  return given;
9758
9851
  }
9759
9852
  let ops;
@@ -9782,7 +9875,7 @@ function dispatchAccessRecognizers(root, recognizers, isStop, resolveWrittenValu
9782
9875
  traversal.skip();
9783
9876
  return;
9784
9877
  }
9785
- if (!Node41.isPropertyAccessExpression(node) && !Node41.isCallExpression(node) && !Node41.isTaggedTemplateExpression(node)) {
9878
+ if (!Node42.isPropertyAccessExpression(node) && !Node42.isCallExpression(node) && !Node42.isTaggedTemplateExpression(node)) {
9786
9879
  return;
9787
9880
  }
9788
9881
  const ctx = accessContextFor(
@@ -9838,35 +9931,35 @@ function extractArg(node, depth) {
9838
9931
  return extractArg(bare, depth);
9839
9932
  }
9840
9933
  }
9841
- if (Node41.isStringLiteral(node) || Node41.isNoSubstitutionTemplateLiteral(node)) {
9934
+ if (Node42.isStringLiteral(node) || Node42.isNoSubstitutionTemplateLiteral(node)) {
9842
9935
  return { kind: "string", value: node.getLiteralValue() };
9843
9936
  }
9844
- if (Node41.isNumericLiteral(node)) {
9937
+ if (Node42.isNumericLiteral(node)) {
9845
9938
  return { kind: "number", value: node.getLiteralValue() };
9846
9939
  }
9847
- if (Node41.isTrueLiteral(node)) {
9940
+ if (Node42.isTrueLiteral(node)) {
9848
9941
  return { kind: "boolean", value: true };
9849
9942
  }
9850
- if (Node41.isFalseLiteral(node)) {
9943
+ if (Node42.isFalseLiteral(node)) {
9851
9944
  return { kind: "boolean", value: false };
9852
9945
  }
9853
- if (Node41.isTemplateExpression(node)) {
9946
+ if (Node42.isTemplateExpression(node)) {
9854
9947
  return { kind: "template", sourceText: node.getText() };
9855
9948
  }
9856
- if (Node41.isIdentifier(node)) {
9949
+ if (Node42.isIdentifier(node)) {
9857
9950
  const inlined = inlineModuleBinding(node, depth);
9858
9951
  if (inlined !== null) {
9859
9952
  return inlined;
9860
9953
  }
9861
9954
  return { kind: "identifier", name: node.getText() };
9862
9955
  }
9863
- if (Node41.isPropertyAccessExpression(node) || Node41.isElementAccessExpression(node)) {
9956
+ if (Node42.isPropertyAccessExpression(node) || Node42.isElementAccessExpression(node)) {
9864
9957
  return { kind: "identifier", name: node.getText() };
9865
9958
  }
9866
9959
  if (depth <= 0) {
9867
9960
  return null;
9868
9961
  }
9869
- if (Node41.isCallExpression(node)) {
9962
+ if (Node42.isCallExpression(node)) {
9870
9963
  const element = mapCallbackReturn(node);
9871
9964
  if (element !== null) {
9872
9965
  return { kind: "array", items: [extractArg(element, depth - 1)] };
@@ -9877,19 +9970,19 @@ function extractArg(node, depth) {
9877
9970
  args: node.getArguments().map((a) => extractArg(a, depth - 1))
9878
9971
  };
9879
9972
  }
9880
- if (Node41.isNewExpression(node)) {
9973
+ if (Node42.isNewExpression(node)) {
9881
9974
  return {
9882
9975
  kind: "call",
9883
9976
  callee: node.getExpression().getText(),
9884
9977
  args: node.getArguments().map((a) => extractArg(a, depth - 1))
9885
9978
  };
9886
9979
  }
9887
- if (Node41.isObjectLiteralExpression(node)) {
9980
+ if (Node42.isObjectLiteralExpression(node)) {
9888
9981
  const fields = {};
9889
9982
  for (const prop of node.getProperties()) {
9890
- if (Node41.isShorthandPropertyAssignment(prop)) {
9983
+ if (Node42.isShorthandPropertyAssignment(prop)) {
9891
9984
  const nameNode2 = prop.getNameNode();
9892
- if (Node41.isIdentifier(nameNode2)) {
9985
+ if (Node42.isIdentifier(nameNode2)) {
9893
9986
  fields[nameNode2.getText()] = {
9894
9987
  kind: "identifier",
9895
9988
  name: nameNode2.getText()
@@ -9897,14 +9990,14 @@ function extractArg(node, depth) {
9897
9990
  }
9898
9991
  continue;
9899
9992
  }
9900
- if (!Node41.isPropertyAssignment(prop)) {
9993
+ if (!Node42.isPropertyAssignment(prop)) {
9901
9994
  continue;
9902
9995
  }
9903
9996
  const nameNode = prop.getNameNode();
9904
- if (!Node41.isIdentifier(nameNode) && !Node41.isStringLiteral(nameNode) && !Node41.isNoSubstitutionTemplateLiteral(nameNode)) {
9997
+ if (!Node42.isIdentifier(nameNode) && !Node42.isStringLiteral(nameNode) && !Node42.isNoSubstitutionTemplateLiteral(nameNode)) {
9905
9998
  continue;
9906
9999
  }
9907
- const name = Node41.isIdentifier(nameNode) ? nameNode.getText() : nameNode.getLiteralValue();
10000
+ const name = Node42.isIdentifier(nameNode) ? nameNode.getText() : nameNode.getLiteralValue();
9908
10001
  const initializer = prop.getInitializer();
9909
10002
  if (initializer === void 0) {
9910
10003
  continue;
@@ -9913,7 +10006,7 @@ function extractArg(node, depth) {
9913
10006
  }
9914
10007
  return { kind: "object", fields };
9915
10008
  }
9916
- if (Node41.isArrayLiteralExpression(node)) {
10009
+ if (Node42.isArrayLiteralExpression(node)) {
9917
10010
  const items = node.getElements().map((el) => extractArg(el, depth - 1));
9918
10011
  return { kind: "array", items };
9919
10012
  }
@@ -9921,20 +10014,20 @@ function extractArg(node, depth) {
9921
10014
  }
9922
10015
  function mapCallbackReturn(call) {
9923
10016
  const callee = call.getExpression();
9924
- if (!Node41.isPropertyAccessExpression(callee) || callee.getName() !== "map") {
10017
+ if (!Node42.isPropertyAccessExpression(callee) || callee.getName() !== "map") {
9925
10018
  return null;
9926
10019
  }
9927
10020
  const callback = call.getArguments()[0];
9928
- if (callback === void 0 || !(Node41.isArrowFunction(callback) || Node41.isFunctionExpression(callback))) {
10021
+ if (callback === void 0 || !(Node42.isArrowFunction(callback) || Node42.isFunctionExpression(callback))) {
9929
10022
  return null;
9930
10023
  }
9931
10024
  const body = callback.getBody();
9932
- if (!Node41.isBlock(body)) {
10025
+ if (!Node42.isBlock(body)) {
9933
10026
  return body;
9934
10027
  }
9935
10028
  const statements = body.getStatements();
9936
10029
  const only = statements.length === 1 ? statements[0] : void 0;
9937
- return only !== void 0 && Node41.isReturnStatement(only) ? only.getExpression() ?? null : null;
10030
+ return only !== void 0 && Node42.isReturnStatement(only) ? only.getExpression() ?? null : null;
9938
10031
  }
9939
10032
  function collectPreconditions(node, root) {
9940
10033
  return collectAncestorConditionInfosBelow(node, root).map(
@@ -9945,7 +10038,7 @@ function runsOnEveryPath(node, root) {
9945
10038
  let current2 = node;
9946
10039
  while (current2 !== void 0 && current2 !== root) {
9947
10040
  const parent = current2.getParent();
9948
- if (parent !== void 0 && Node41.isTryStatement(parent) && parent.getFinallyBlock() === current2) {
10041
+ if (parent !== void 0 && Node42.isTryStatement(parent) && parent.getFinallyBlock() === current2) {
9949
10042
  return true;
9950
10043
  }
9951
10044
  current2 = parent;
@@ -9968,7 +10061,7 @@ function withPreconditions(effect, preconditions) {
9968
10061
  };
9969
10062
  }
9970
10063
  function inlineModuleBinding(ident, depth) {
9971
- if (!Node41.isIdentifier(ident)) {
10064
+ if (!Node42.isIdentifier(ident)) {
9972
10065
  return null;
9973
10066
  }
9974
10067
  const symbol = ident.getSymbol();
@@ -9976,7 +10069,7 @@ function inlineModuleBinding(ident, depth) {
9976
10069
  return null;
9977
10070
  }
9978
10071
  for (const decl of symbol.getDeclarations()) {
9979
- if (!Node41.isVariableDeclaration(decl)) {
10072
+ if (!Node42.isVariableDeclaration(decl)) {
9980
10073
  continue;
9981
10074
  }
9982
10075
  if (!isModuleScoped(decl)) {
@@ -9997,10 +10090,10 @@ function inlineModuleBinding(ident, depth) {
9997
10090
  function isModuleScoped(decl) {
9998
10091
  let current2 = decl.getParent();
9999
10092
  while (current2 !== void 0) {
10000
- if (Node41.isSourceFile(current2)) {
10093
+ if (Node42.isSourceFile(current2)) {
10001
10094
  return true;
10002
10095
  }
10003
- if (Node41.isVariableDeclarationList(current2) || Node41.isVariableStatement(current2)) {
10096
+ if (Node42.isVariableDeclarationList(current2) || Node42.isVariableStatement(current2)) {
10004
10097
  current2 = current2.getParent();
10005
10098
  continue;
10006
10099
  }
@@ -10014,7 +10107,7 @@ function unwrapCasts(node) {
10014
10107
  function enclosingStatementLine(node) {
10015
10108
  let current2 = node;
10016
10109
  while (current2 !== void 0) {
10017
- if (Node41.isStatement(current2)) {
10110
+ if (Node42.isStatement(current2)) {
10018
10111
  return startLineOf(current2);
10019
10112
  }
10020
10113
  current2 = current2.getParent();
@@ -10023,19 +10116,19 @@ function enclosingStatementLine(node) {
10023
10116
  }
10024
10117
 
10025
10118
  // src/terminals/index.ts
10026
- import { Node as Node51 } from "ts-morph";
10119
+ import { Node as Node52 } from "ts-morph";
10027
10120
 
10028
10121
  // src/terminals/continuation.ts
10029
- import { Node as Node43 } from "ts-morph";
10122
+ import { Node as Node44 } from "ts-morph";
10030
10123
 
10031
10124
  // src/terminals/shared.ts
10032
- import { Node as Node42 } from "ts-morph";
10125
+ import { Node as Node43 } from "ts-morph";
10033
10126
  function parameterPositionOf(identifier, func) {
10034
- if (!Node42.isIdentifier(identifier)) {
10127
+ if (!Node43.isIdentifier(identifier)) {
10035
10128
  return null;
10036
10129
  }
10037
10130
  const declaration = identifier.getSymbol()?.getDeclarations()[0];
10038
- if (declaration === void 0 || !Node42.isParameterDeclaration(declaration)) {
10131
+ if (declaration === void 0 || !Node43.isParameterDeclaration(declaration)) {
10039
10132
  return null;
10040
10133
  }
10041
10134
  const params = func.getParameters();
@@ -10052,17 +10145,17 @@ function returnPositionOf(value) {
10052
10145
  if (parent === void 0) {
10053
10146
  return null;
10054
10147
  }
10055
- if (Node42.isReturnStatement(parent)) {
10148
+ if (Node43.isReturnStatement(parent)) {
10056
10149
  return parent;
10057
10150
  }
10058
- if (Node42.isArrowFunction(parent)) {
10151
+ if (Node43.isArrowFunction(parent)) {
10059
10152
  return parent.getBody() === current2 ? current2 : null;
10060
10153
  }
10061
10154
  if (passesValueThrough(parent)) {
10062
10155
  current2 = parent;
10063
10156
  continue;
10064
10157
  }
10065
- if (Node42.isConditionalExpression(parent) && (parent.getWhenTrue() === current2 || parent.getWhenFalse() === current2)) {
10158
+ if (Node43.isConditionalExpression(parent) && (parent.getWhenTrue() === current2 || parent.getWhenFalse() === current2)) {
10066
10159
  current2 = parent;
10067
10160
  continue;
10068
10161
  }
@@ -10072,7 +10165,7 @@ function returnPositionOf(value) {
10072
10165
 
10073
10166
  // src/terminals/continuation.ts
10074
10167
  function tryMatchParameterCall(node, func, pattern, match) {
10075
- if (!Node43.isCallExpression(node)) {
10168
+ if (!Node44.isCallExpression(node)) {
10076
10169
  return null;
10077
10170
  }
10078
10171
  const callee = node.getExpression();
@@ -10096,13 +10189,13 @@ function tryMatchParameterCall(node, func, pattern, match) {
10096
10189
 
10097
10190
  // src/terminals/extract.ts
10098
10191
  import {
10099
- Node as Node45
10192
+ Node as Node46
10100
10193
  } from "ts-morph";
10101
10194
  import { constantOf } from "@suss/values";
10102
10195
 
10103
10196
  // src/shapes/shapes.ts
10104
10197
  import {
10105
- Node as Node44,
10198
+ Node as Node45,
10106
10199
  SyntaxKind as SyntaxKind10
10107
10200
  } from "ts-morph";
10108
10201
 
@@ -10569,35 +10662,35 @@ function extractShapeWithArguments(node, substitutions) {
10569
10662
  }
10570
10663
  function extractShapeInner(node) {
10571
10664
  const unwrapped2 = peelSyntax(node);
10572
- if (boundArguments !== null && Node44.isIdentifier(unwrapped2)) {
10665
+ if (boundArguments !== null && Node45.isIdentifier(unwrapped2)) {
10573
10666
  const argument = boundArguments.get(unwrapped2.getText());
10574
10667
  if (argument !== void 0 && argument !== unwrapped2) {
10575
10668
  return extractShape(argument);
10576
10669
  }
10577
10670
  }
10578
- if (Node44.isObjectLiteralExpression(unwrapped2)) {
10671
+ if (Node45.isObjectLiteralExpression(unwrapped2)) {
10579
10672
  return shapeFromObjectLiteral(unwrapped2);
10580
10673
  }
10581
- if (Node44.isArrayLiteralExpression(unwrapped2)) {
10674
+ if (Node45.isArrayLiteralExpression(unwrapped2)) {
10582
10675
  return shapeFromArrayLiteral(unwrapped2);
10583
10676
  }
10584
- if (Node44.isStringLiteral(unwrapped2) || Node44.isNoSubstitutionTemplateLiteral(unwrapped2)) {
10677
+ if (Node45.isStringLiteral(unwrapped2) || Node45.isNoSubstitutionTemplateLiteral(unwrapped2)) {
10585
10678
  return { type: "literal", value: unwrapped2.getLiteralValue() };
10586
10679
  }
10587
- if (Node44.isTemplateExpression(unwrapped2)) {
10680
+ if (Node45.isTemplateExpression(unwrapped2)) {
10588
10681
  return { type: "text" };
10589
10682
  }
10590
- if (Node44.isNumericLiteral(unwrapped2)) {
10683
+ if (Node45.isNumericLiteral(unwrapped2)) {
10591
10684
  return numericLiteralShape(
10592
10685
  unwrapped2.getLiteralValue(),
10593
10686
  unwrapped2.getText()
10594
10687
  );
10595
10688
  }
10596
- if (Node44.isPrefixUnaryExpression(unwrapped2)) {
10689
+ if (Node45.isPrefixUnaryExpression(unwrapped2)) {
10597
10690
  const op = unwrapped2.getOperatorToken();
10598
10691
  if (op === SyntaxKind10.MinusToken || op === SyntaxKind10.PlusToken) {
10599
10692
  const inner = unwrapped2.getOperand();
10600
- if (Node44.isNumericLiteral(inner)) {
10693
+ if (Node45.isNumericLiteral(inner)) {
10601
10694
  const v3 = inner.getLiteralValue();
10602
10695
  const signed = op === SyntaxKind10.MinusToken ? -v3 : v3;
10603
10696
  const rawBody = inner.getText();
@@ -10606,7 +10699,7 @@ function extractShapeInner(node) {
10606
10699
  }
10607
10700
  }
10608
10701
  }
10609
- if (Node44.isBigIntLiteral(unwrapped2)) {
10702
+ if (Node45.isBigIntLiteral(unwrapped2)) {
10610
10703
  return { type: "ref", name: "bigint" };
10611
10704
  }
10612
10705
  const kind = unwrapped2.getKind();
@@ -10619,10 +10712,10 @@ function extractShapeInner(node) {
10619
10712
  if (kind === SyntaxKind10.NullKeyword) {
10620
10713
  return { type: "null" };
10621
10714
  }
10622
- if (Node44.isIdentifier(unwrapped2) && unwrapped2.getText() === "undefined") {
10715
+ if (Node45.isIdentifier(unwrapped2) && unwrapped2.getText() === "undefined") {
10623
10716
  return { type: "undefined" };
10624
10717
  }
10625
- if (Node44.isConditionalExpression(unwrapped2)) {
10718
+ if (Node45.isConditionalExpression(unwrapped2)) {
10626
10719
  const whenTrue = extractShape(unwrapped2.getWhenTrue());
10627
10720
  const whenFalse = extractShape(unwrapped2.getWhenFalse());
10628
10721
  const variants = [];
@@ -10653,7 +10746,7 @@ function shapeFromArrayLiteral(arr) {
10653
10746
  }
10654
10747
  const shapes = [];
10655
10748
  for (const el of elements) {
10656
- if (Node44.isSpreadElement(el)) {
10749
+ if (Node45.isSpreadElement(el)) {
10657
10750
  const inner = el.getExpression();
10658
10751
  const innerShape = extractShape(inner);
10659
10752
  if (innerShape?.type === "array") {
@@ -10672,7 +10765,7 @@ function shapeFromObjectLiteral(obj) {
10672
10765
  const properties = {};
10673
10766
  const unresolvedSpreads = [];
10674
10767
  for (const prop of obj.getProperties()) {
10675
- if (Node44.isPropertyAssignment(prop)) {
10768
+ if (Node45.isPropertyAssignment(prop)) {
10676
10769
  const name = propertyName2(prop);
10677
10770
  if (name === null) {
10678
10771
  continue;
@@ -10688,7 +10781,7 @@ function shapeFromObjectLiteral(obj) {
10688
10781
  };
10689
10782
  continue;
10690
10783
  }
10691
- if (Node44.isShorthandPropertyAssignment(prop)) {
10784
+ if (Node45.isShorthandPropertyAssignment(prop)) {
10692
10785
  const name = prop.getName();
10693
10786
  const valueExpr = prop.getNameNode();
10694
10787
  properties[name] = extractShape(valueExpr) ?? {
@@ -10697,7 +10790,7 @@ function shapeFromObjectLiteral(obj) {
10697
10790
  };
10698
10791
  continue;
10699
10792
  }
10700
- if (Node44.isSpreadAssignment(prop)) {
10793
+ if (Node45.isSpreadAssignment(prop)) {
10701
10794
  const expr = prop.getExpression();
10702
10795
  const spreadShape = extractShape(expr);
10703
10796
  if (spreadShape?.type === "record") {
@@ -10716,7 +10809,7 @@ function shapeFromObjectLiteral(obj) {
10716
10809
  }
10717
10810
  function propertyName2(prop) {
10718
10811
  const nameNode = prop.getNameNode();
10719
- if (Node44.isIdentifier(nameNode) || Node44.isStringLiteral(nameNode) || Node44.isNoSubstitutionTemplateLiteral(nameNode) || Node44.isNumericLiteral(nameNode)) {
10812
+ if (Node45.isIdentifier(nameNode) || Node45.isStringLiteral(nameNode) || Node45.isNoSubstitutionTemplateLiteral(nameNode) || Node45.isNumericLiteral(nameNode)) {
10720
10813
  return nameNode.getText().replace(/^["']|["']$/g, "");
10721
10814
  }
10722
10815
  return null;
@@ -10747,15 +10840,15 @@ function unwrapAs(node) {
10747
10840
  }
10748
10841
  function unwrapJsonStringify(node) {
10749
10842
  const outer = unwrapAs(node);
10750
- if (!Node45.isCallExpression(outer)) {
10843
+ if (!Node46.isCallExpression(outer)) {
10751
10844
  return node;
10752
10845
  }
10753
10846
  const callee = outer.getExpression();
10754
- if (!Node45.isPropertyAccessExpression(callee) || callee.getName() !== "stringify") {
10847
+ if (!Node46.isPropertyAccessExpression(callee) || callee.getName() !== "stringify") {
10755
10848
  return node;
10756
10849
  }
10757
10850
  const receiver = callee.getExpression();
10758
- if (!Node45.isIdentifier(receiver) || receiver.getText() !== "JSON") {
10851
+ if (!Node46.isIdentifier(receiver) || receiver.getText() !== "JSON") {
10759
10852
  return node;
10760
10853
  }
10761
10854
  const args = outer.getArguments();
@@ -10765,7 +10858,7 @@ function unwrapJsonStringify(node) {
10765
10858
  return unwrapAs(args[0]);
10766
10859
  }
10767
10860
  function substituted(value, ctx) {
10768
- if (ctx.substitutions === void 0 || !Node45.isIdentifier(value)) {
10861
+ if (ctx.substitutions === void 0 || !Node46.isIdentifier(value)) {
10769
10862
  return value;
10770
10863
  }
10771
10864
  return ctx.substitutions.get(value.getText()) ?? value;
@@ -10809,10 +10902,10 @@ function statusFromProperty(obj, name, ctx) {
10809
10902
  if (prop === void 0) {
10810
10903
  return null;
10811
10904
  }
10812
- if (Node45.isShorthandPropertyAssignment(prop)) {
10905
+ if (Node46.isShorthandPropertyAssignment(prop)) {
10813
10906
  return { type: "dynamic", sourceText: prop.getName() };
10814
10907
  }
10815
- if (!Node45.isPropertyAssignment(prop)) {
10908
+ if (!Node46.isPropertyAssignment(prop)) {
10816
10909
  return null;
10817
10910
  }
10818
10911
  const value = prop.getInitializer();
@@ -10835,7 +10928,7 @@ function extractStatusCodeFromRule(ctx) {
10835
10928
  return null;
10836
10929
  }
10837
10930
  const first = ctx.throwCallArgs?.[0];
10838
- if (first !== void 0 && Node45.isNumericLiteral(first)) {
10931
+ if (first !== void 0 && Node46.isNumericLiteral(first)) {
10839
10932
  const value = first.getLiteralValue();
10840
10933
  if (value >= 100 && value <= 599) {
10841
10934
  return { type: "literal", value };
@@ -10848,7 +10941,7 @@ function extractStatusCodeFromRule(ctx) {
10848
10941
  return null;
10849
10942
  }
10850
10943
  const arg = ctx.throwCallArgs[sc.position];
10851
- if (arg === void 0 || !Node45.isNewExpression(arg)) {
10944
+ if (arg === void 0 || !Node46.isNewExpression(arg)) {
10852
10945
  return null;
10853
10946
  }
10854
10947
  const ctorText = arg.getExpression().getText();
@@ -10857,7 +10950,7 @@ function extractStatusCodeFromRule(ctx) {
10857
10950
  if (sc.from === "argumentProperty") {
10858
10951
  const args = ctx.throwCallArgs ?? ctx.calls?.[0]?.getArguments();
10859
10952
  const arg = args?.[sc.position];
10860
- if (arg === void 0 || !Node45.isObjectLiteralExpression(arg)) {
10953
+ if (arg === void 0 || !Node46.isObjectLiteralExpression(arg)) {
10861
10954
  return null;
10862
10955
  }
10863
10956
  return statusFromProperty(arg, sc.name, ctx);
@@ -10867,8 +10960,8 @@ function extractStatusCodeFromRule(ctx) {
10867
10960
  return null;
10868
10961
  }
10869
10962
  for (const prop of ctx.returnedObj.getProperties()) {
10870
- if (!Node45.isPropertyAssignment(prop)) {
10871
- if (Node45.isShorthandPropertyAssignment(prop)) {
10963
+ if (!Node46.isPropertyAssignment(prop)) {
10964
+ if (Node46.isShorthandPropertyAssignment(prop)) {
10872
10965
  if (prop.getName() === sc.name) {
10873
10966
  const resolved = ctx.substitutions?.get(prop.getName());
10874
10967
  if (resolved !== void 0) {
@@ -10926,8 +11019,8 @@ function extractBody(ctx) {
10926
11019
  return null;
10927
11020
  }
10928
11021
  for (const prop of ctx.returnedObj.getProperties()) {
10929
- if (!Node45.isPropertyAssignment(prop)) {
10930
- if (Node45.isShorthandPropertyAssignment(prop)) {
11022
+ if (!Node46.isPropertyAssignment(prop)) {
11023
+ if (Node46.isShorthandPropertyAssignment(prop)) {
10931
11024
  if (prop.getName() === b.name) {
10932
11025
  const resolved = ctx.substitutions?.get(prop.getName());
10933
11026
  if (resolved !== void 0) {
@@ -10982,16 +11075,16 @@ function extractBody(ctx) {
10982
11075
  }
10983
11076
 
10984
11077
  // src/terminals/jsx.ts
10985
- import { Node as Node46 } from "ts-morph";
11078
+ import { Node as Node47 } from "ts-morph";
10986
11079
  function tryMatchJsxReturn(node, pattern) {
10987
11080
  let expr;
10988
11081
  let source;
10989
- if (Node46.isReturnStatement(node)) {
11082
+ if (Node47.isReturnStatement(node)) {
10990
11083
  expr = node.getExpression();
10991
11084
  source = node;
10992
- } else if (Node46.isArrowFunction(node)) {
11085
+ } else if (Node47.isArrowFunction(node)) {
10993
11086
  const body = node.getBody();
10994
- if (body !== void 0 && !Node46.isBlock(body)) {
11087
+ if (body !== void 0 && !Node47.isBlock(body)) {
10995
11088
  expr = body;
10996
11089
  source = body;
10997
11090
  }
@@ -11022,14 +11115,14 @@ function tryMatchJsxReturn(node, pattern) {
11022
11115
  return { node, source, terminal };
11023
11116
  }
11024
11117
  function componentTargetOf(tagNode) {
11025
- if (!Node46.isIdentifier(tagNode) || !/^[A-Z]/.test(tagNode.getText())) {
11118
+ if (!Node47.isIdentifier(tagNode) || !/^[A-Z]/.test(tagNode.getText())) {
11026
11119
  return null;
11027
11120
  }
11028
11121
  const target = functionTargetOf(tagNode);
11029
11122
  return target === null ? null : { file: target.file, name: target.name };
11030
11123
  }
11031
11124
  function jsxToRenderNode(node) {
11032
- if (Node46.isJsxElement(node)) {
11125
+ if (Node47.isJsxElement(node)) {
11033
11126
  const opening = node.getOpeningElement();
11034
11127
  const tag = opening.getTagNameNode().getText();
11035
11128
  const attrs = collectJsxAttributes(opening);
@@ -11043,7 +11136,7 @@ function jsxToRenderNode(node) {
11043
11136
  ...target !== null ? { target } : {}
11044
11137
  };
11045
11138
  }
11046
- if (Node46.isJsxSelfClosingElement(node)) {
11139
+ if (Node47.isJsxSelfClosingElement(node)) {
11047
11140
  const tag = node.getTagNameNode().getText();
11048
11141
  const attrs = collectJsxAttributes(node);
11049
11142
  const target = componentTargetOf(node.getTagNameNode());
@@ -11055,11 +11148,11 @@ function jsxToRenderNode(node) {
11055
11148
  ...target !== null ? { target } : {}
11056
11149
  };
11057
11150
  }
11058
- if (Node46.isJsxFragment(node)) {
11151
+ if (Node47.isJsxFragment(node)) {
11059
11152
  const children = node.getJsxChildren().map(jsxChildToRenderNode).filter((n) => n !== null);
11060
11153
  return { type: "element", tag: "Fragment", children };
11061
11154
  }
11062
- if (Node46.isParenthesizedExpression(node)) {
11155
+ if (Node47.isParenthesizedExpression(node)) {
11063
11156
  return jsxToRenderNode(node.getExpression());
11064
11157
  }
11065
11158
  return null;
@@ -11067,12 +11160,12 @@ function jsxToRenderNode(node) {
11067
11160
  function collectJsxAttributes(opening) {
11068
11161
  const entries = {};
11069
11162
  for (const attr of opening.getAttributes()) {
11070
- if (Node46.isJsxSpreadAttribute(attr)) {
11163
+ if (Node47.isJsxSpreadAttribute(attr)) {
11071
11164
  const exprText = attr.getExpression().getText();
11072
11165
  entries[`...${exprText}`] = exprText;
11073
11166
  continue;
11074
11167
  }
11075
- if (!Node46.isJsxAttribute(attr)) {
11168
+ if (!Node47.isJsxAttribute(attr)) {
11076
11169
  continue;
11077
11170
  }
11078
11171
  const name = attr.getNameNode().getText();
@@ -11081,7 +11174,7 @@ function collectJsxAttributes(opening) {
11081
11174
  entries[name] = "";
11082
11175
  continue;
11083
11176
  }
11084
- if (Node46.isJsxExpression(initializer)) {
11177
+ if (Node47.isJsxExpression(initializer)) {
11085
11178
  const inner = initializer.getExpression();
11086
11179
  entries[name] = inner !== void 0 ? inner.getText() : "";
11087
11180
  continue;
@@ -11091,30 +11184,30 @@ function collectJsxAttributes(opening) {
11091
11184
  return Object.keys(entries).length > 0 ? entries : null;
11092
11185
  }
11093
11186
  function jsxChildToRenderNode(child) {
11094
- if (Node46.isJsxText(child)) {
11187
+ if (Node47.isJsxText(child)) {
11095
11188
  const text = child.getLiteralText().trim();
11096
11189
  if (text.length === 0) {
11097
11190
  return null;
11098
11191
  }
11099
11192
  return { type: "text", value: text };
11100
11193
  }
11101
- if (Node46.isJsxExpression(child)) {
11194
+ if (Node47.isJsxExpression(child)) {
11102
11195
  const inner = child.getExpression();
11103
11196
  if (inner === void 0) {
11104
11197
  return null;
11105
11198
  }
11106
11199
  return jsxExpressionToRenderNode(inner);
11107
11200
  }
11108
- if (Node46.isJsxElement(child) || Node46.isJsxSelfClosingElement(child) || Node46.isJsxFragment(child)) {
11201
+ if (Node47.isJsxElement(child) || Node47.isJsxSelfClosingElement(child) || Node47.isJsxFragment(child)) {
11109
11202
  return jsxToRenderNode(child);
11110
11203
  }
11111
11204
  return null;
11112
11205
  }
11113
11206
  function jsxExpressionToRenderNode(expr) {
11114
- if (Node46.isParenthesizedExpression(expr)) {
11207
+ if (Node47.isParenthesizedExpression(expr)) {
11115
11208
  return jsxExpressionToRenderNode(expr.getExpression());
11116
11209
  }
11117
- if (Node46.isBinaryExpression(expr)) {
11210
+ if (Node47.isBinaryExpression(expr)) {
11118
11211
  const op = expr.getOperatorToken().getText();
11119
11212
  if (op === "&&") {
11120
11213
  const right = renderAlternative(peelParens(expr.getRight()));
@@ -11128,7 +11221,7 @@ function jsxExpressionToRenderNode(expr) {
11128
11221
  }
11129
11222
  }
11130
11223
  }
11131
- if (Node46.isConditionalExpression(expr)) {
11224
+ if (Node47.isConditionalExpression(expr)) {
11132
11225
  const truthy = renderAlternative(peelParens(expr.getWhenTrue()));
11133
11226
  const falsy = renderAlternative(peelParens(expr.getWhenFalse()));
11134
11227
  if (truthy.kind === "jsx") {
@@ -11151,16 +11244,16 @@ function jsxExpressionToRenderNode(expr) {
11151
11244
  return { type: "expression", sourceText: expr.getText() };
11152
11245
  }
11153
11246
  function renderAlternative(node) {
11154
- if (Node46.isNullLiteral(node)) {
11247
+ if (Node47.isNullLiteral(node)) {
11155
11248
  return { kind: "noRender" };
11156
11249
  }
11157
- if (Node46.isFalseLiteral(node)) {
11250
+ if (Node47.isFalseLiteral(node)) {
11158
11251
  return { kind: "noRender" };
11159
11252
  }
11160
- if (Node46.isIdentifier(node) && node.getText() === "undefined") {
11253
+ if (Node47.isIdentifier(node) && node.getText() === "undefined") {
11161
11254
  return { kind: "noRender" };
11162
11255
  }
11163
- if (Node46.isJsxElement(node) || Node46.isJsxSelfClosingElement(node) || Node46.isJsxFragment(node)) {
11256
+ if (Node47.isJsxElement(node) || Node47.isJsxSelfClosingElement(node) || Node47.isJsxFragment(node)) {
11164
11257
  const tree = jsxToRenderNode(node);
11165
11258
  if (tree !== null) {
11166
11259
  return { kind: "jsx", node: tree };
@@ -11171,14 +11264,14 @@ function renderAlternative(node) {
11171
11264
 
11172
11265
  // src/terminals/returns.ts
11173
11266
  import {
11174
- Node as Node49
11267
+ Node as Node50
11175
11268
  } from "ts-morph";
11176
11269
 
11177
11270
  // src/terminals/helperResolution.ts
11178
- import { Node as Node47, SyntaxKind as SyntaxKind11 } from "ts-morph";
11271
+ import { Node as Node48, SyntaxKind as SyntaxKind11 } from "ts-morph";
11179
11272
  function resolveHelperReturn(call, resolveCallee2) {
11180
11273
  const callee = call.getExpression();
11181
- if (!Node47.isIdentifier(callee)) {
11274
+ if (!Node48.isIdentifier(callee)) {
11182
11275
  return { kind: "notLocal" };
11183
11276
  }
11184
11277
  const helper = memoizedLocalHelper(callee, resolveCallee2);
@@ -11208,16 +11301,16 @@ function guardsAbove(returnValue) {
11208
11301
  let child = returnValue;
11209
11302
  let current2 = returnValue.getParent();
11210
11303
  while (current2 !== void 0) {
11211
- if (Node47.isIfStatement(current2)) {
11304
+ if (Node48.isIfStatement(current2)) {
11212
11305
  guards.push({
11213
11306
  condition: current2.getExpression(),
11214
11307
  whenTrue: current2.getThenStatement() === child
11215
11308
  });
11216
11309
  }
11217
- if (Node47.isBlock(current2)) {
11310
+ if (Node48.isBlock(current2)) {
11218
11311
  guards.push(...earlyReturnGuardsBefore(current2, child));
11219
11312
  }
11220
- if (Node47.isFunctionDeclaration(current2) || Node47.isArrowFunction(current2) || Node47.isFunctionExpression(current2)) {
11313
+ if (Node48.isFunctionDeclaration(current2) || Node48.isArrowFunction(current2) || Node48.isFunctionExpression(current2)) {
11221
11314
  break;
11222
11315
  }
11223
11316
  child = current2;
@@ -11226,7 +11319,7 @@ function guardsAbove(returnValue) {
11226
11319
  return guards;
11227
11320
  }
11228
11321
  function earlyReturnGuardsBefore(block, child) {
11229
- if (!Node47.isBlock(block)) {
11322
+ if (!Node48.isBlock(block)) {
11230
11323
  return [];
11231
11324
  }
11232
11325
  const guards = [];
@@ -11234,7 +11327,7 @@ function earlyReturnGuardsBefore(block, child) {
11234
11327
  if (statement === child) {
11235
11328
  break;
11236
11329
  }
11237
- if (!Node47.isIfStatement(statement) || statement.getElseStatement()) {
11330
+ if (!Node48.isIfStatement(statement) || statement.getElseStatement()) {
11238
11331
  continue;
11239
11332
  }
11240
11333
  if (alwaysReturns(statement.getThenStatement())) {
@@ -11244,10 +11337,10 @@ function earlyReturnGuardsBefore(block, child) {
11244
11337
  return guards;
11245
11338
  }
11246
11339
  function alwaysReturns(statement) {
11247
- if (Node47.isReturnStatement(statement) || Node47.isThrowStatement(statement)) {
11340
+ if (Node48.isReturnStatement(statement) || Node48.isThrowStatement(statement)) {
11248
11341
  return true;
11249
11342
  }
11250
- if (!Node47.isBlock(statement)) {
11343
+ if (!Node48.isBlock(statement)) {
11251
11344
  return false;
11252
11345
  }
11253
11346
  const statements = statement.getStatements();
@@ -11265,7 +11358,7 @@ var COMPARISONS = {
11265
11358
  "!=": (a, b) => a !== b
11266
11359
  };
11267
11360
  function evaluateComparison(condition, substitutions) {
11268
- if (!Node47.isBinaryExpression(condition)) {
11361
+ if (!Node48.isBinaryExpression(condition)) {
11269
11362
  return null;
11270
11363
  }
11271
11364
  const left = numberFor(condition.getLeft(), substitutions);
@@ -11277,8 +11370,8 @@ function evaluateComparison(condition, substitutions) {
11277
11370
  return compare === void 0 ? null : compare(left, right);
11278
11371
  }
11279
11372
  function numberFor(node, substitutions) {
11280
- const resolved = Node47.isIdentifier(node) && substitutions.has(node.getText()) ? substitutions.get(node.getText()) : node;
11281
- return Node47.isNumericLiteral(resolved) ? Number(resolved.getText()) : null;
11373
+ const resolved = Node48.isIdentifier(node) && substitutions.has(node.getText()) ? substitutions.get(node.getText()) : node;
11374
+ return Node48.isNumericLiteral(resolved) ? Number(resolved.getText()) : null;
11282
11375
  }
11283
11376
  var helperBySymbol = /* @__PURE__ */ new WeakMap();
11284
11377
  function memoizedLocalHelper(callee, resolveCallee2) {
@@ -11344,8 +11437,8 @@ function implementationBeside(declaration, name) {
11344
11437
  return candidate;
11345
11438
  }
11346
11439
  }
11347
- const variable4 = source.getVariableDeclaration(name);
11348
- const fn = variable4 === void 0 ? null : asFunctionLike(variable4);
11440
+ const variable3 = source.getVariableDeclaration(name);
11441
+ const fn = variable3 === void 0 ? null : asFunctionLike(variable3);
11349
11442
  if (fn !== null) {
11350
11443
  return fn;
11351
11444
  }
@@ -11365,12 +11458,12 @@ function declarationsFor(callee, resolveCallee2) {
11365
11458
  return (aliased ?? symbol).getDeclarations();
11366
11459
  }
11367
11460
  function asFunctionLike(declaration) {
11368
- if (Node47.isFunctionDeclaration(declaration) || Node47.isArrowFunction(declaration) || Node47.isFunctionExpression(declaration)) {
11461
+ if (Node48.isFunctionDeclaration(declaration) || Node48.isArrowFunction(declaration) || Node48.isFunctionExpression(declaration)) {
11369
11462
  return declaration;
11370
11463
  }
11371
- if (Node47.isVariableDeclaration(declaration)) {
11464
+ if (Node48.isVariableDeclaration(declaration)) {
11372
11465
  const initializer = declaration.getInitializer();
11373
- if (initializer !== void 0 && (Node47.isArrowFunction(initializer) || Node47.isFunctionExpression(initializer))) {
11466
+ if (initializer !== void 0 && (Node48.isArrowFunction(initializer) || Node48.isFunctionExpression(initializer))) {
11374
11467
  return initializer;
11375
11468
  }
11376
11469
  }
@@ -11381,9 +11474,9 @@ function returnedObjects(fn) {
11381
11474
  if (body === void 0) {
11382
11475
  return [];
11383
11476
  }
11384
- if (!Node47.isBlock(body)) {
11477
+ if (!Node48.isBlock(body)) {
11385
11478
  const expression = peelParens(body);
11386
- return Node47.isObjectLiteralExpression(expression) ? [expression] : [];
11479
+ return Node48.isObjectLiteralExpression(expression) ? [expression] : [];
11387
11480
  }
11388
11481
  const found = [];
11389
11482
  for (const statement of body.getDescendantsOfKind(
@@ -11397,7 +11490,7 @@ function returnedObjects(fn) {
11397
11490
  continue;
11398
11491
  }
11399
11492
  const unwrapped2 = peelParens(expression);
11400
- if (Node47.isObjectLiteralExpression(unwrapped2)) {
11493
+ if (Node48.isObjectLiteralExpression(unwrapped2)) {
11401
11494
  found.push(unwrapped2);
11402
11495
  }
11403
11496
  }
@@ -11406,7 +11499,7 @@ function returnedObjects(fn) {
11406
11499
  function enclosingFunctionOf(node) {
11407
11500
  let current2 = node.getParent();
11408
11501
  while (current2 !== void 0) {
11409
- if (Node47.isFunctionDeclaration(current2) || Node47.isArrowFunction(current2) || Node47.isFunctionExpression(current2) || Node47.isMethodDeclaration(current2)) {
11502
+ if (Node48.isFunctionDeclaration(current2) || Node48.isArrowFunction(current2) || Node48.isFunctionExpression(current2) || Node48.isMethodDeclaration(current2)) {
11410
11503
  return current2.getBody();
11411
11504
  }
11412
11505
  current2 = current2.getParent();
@@ -11425,7 +11518,7 @@ function bindArguments(callArgs, params) {
11425
11518
  }
11426
11519
 
11427
11520
  // src/terminals/statusBranches.ts
11428
- import { Node as Node48 } from "ts-morph";
11521
+ import { Node as Node49 } from "ts-morph";
11429
11522
  import { constantOf as constantOf2 } from "@suss/values";
11430
11523
  function statusChoicesOf(argument, resolution) {
11431
11524
  const chosen = asConditional(argument);
@@ -11449,10 +11542,10 @@ function asConditional(node) {
11449
11542
  if (direct !== null) {
11450
11543
  return direct;
11451
11544
  }
11452
- if (!Node48.isIdentifier(node)) {
11545
+ if (!Node49.isIdentifier(node)) {
11453
11546
  return null;
11454
11547
  }
11455
- const declaration = node.getSymbol()?.getDeclarations().find(Node48.isVariableDeclaration);
11548
+ const declaration = node.getSymbol()?.getDeclarations().find(Node49.isVariableDeclaration);
11456
11549
  if (declaration === void 0) {
11457
11550
  return null;
11458
11551
  }
@@ -11463,7 +11556,7 @@ function asConditional(node) {
11463
11556
  const only = written.values[0];
11464
11557
  return only === void 0 ? null : toConditional(only);
11465
11558
  }
11466
- var toConditional = (node) => Node48.isConditionalExpression(node) ? node : null;
11559
+ var toConditional = (node) => Node49.isConditionalExpression(node) ? node : null;
11467
11560
  function numberOf(node, resolution) {
11468
11561
  const value = constantOf2(evaluatedValue(node, resolution));
11469
11562
  return typeof value === "number" && Number.isFinite(value) ? value : null;
@@ -11480,7 +11573,7 @@ function unwrapMethodChain(call, match, func) {
11480
11573
  for (let i = methodChain.length - 1; i >= 0; i--) {
11481
11574
  const expectedMethod = methodChain[i];
11482
11575
  const callee = current2.getExpression();
11483
- if (!Node49.isPropertyAccessExpression(callee)) {
11576
+ if (!Node50.isPropertyAccessExpression(callee)) {
11484
11577
  return null;
11485
11578
  }
11486
11579
  if (callee.getName() !== expectedMethod) {
@@ -11496,7 +11589,7 @@ function unwrapMethodChain(call, match, func) {
11496
11589
  return null;
11497
11590
  }
11498
11591
  } else {
11499
- if (!Node49.isCallExpression(subject)) {
11592
+ if (!Node50.isCallExpression(subject)) {
11500
11593
  return null;
11501
11594
  }
11502
11595
  current2 = subject;
@@ -11506,9 +11599,9 @@ function unwrapMethodChain(call, match, func) {
11506
11599
  }
11507
11600
  function withoutPassThroughCalls(subject, passThrough) {
11508
11601
  let current2 = subject;
11509
- while (Node49.isCallExpression(current2)) {
11602
+ while (Node50.isCallExpression(current2)) {
11510
11603
  const callee = current2.getExpression();
11511
- if (!Node49.isPropertyAccessExpression(callee) || !passThrough.includes(callee.getName())) {
11604
+ if (!Node50.isPropertyAccessExpression(callee) || !passThrough.includes(callee.getName())) {
11512
11605
  break;
11513
11606
  }
11514
11607
  current2 = callee.getExpression();
@@ -11520,12 +11613,12 @@ function returnedValueOf(returnStatement) {
11520
11613
  return written === void 0 ? null : unwrapValue(written);
11521
11614
  }
11522
11615
  function tryMatchReturnShape(node, pattern, match, resolution, resolveCallee2) {
11523
- if (Node49.isObjectLiteralExpression(node)) {
11616
+ if (Node50.isObjectLiteralExpression(node)) {
11524
11617
  const source = returnPositionOf(node);
11525
11618
  if (source === null) {
11526
11619
  return [];
11527
11620
  }
11528
- if (Node49.isReturnStatement(source) && returnedValueOf(source) === node) {
11621
+ if (Node50.isReturnStatement(source) && returnedValueOf(source) === node) {
11529
11622
  return [];
11530
11623
  }
11531
11624
  const terminal = terminalFromReturnedObject(
@@ -11538,14 +11631,14 @@ function tryMatchReturnShape(node, pattern, match, resolution, resolveCallee2) {
11538
11631
  );
11539
11632
  return terminal === null ? [] : [{ ...terminal, source }];
11540
11633
  }
11541
- if (!Node49.isReturnStatement(node)) {
11634
+ if (!Node50.isReturnStatement(node)) {
11542
11635
  return [];
11543
11636
  }
11544
11637
  const returned = returnedValueOf(node);
11545
11638
  if (returned === null) {
11546
11639
  return [];
11547
11640
  }
11548
- if (Node49.isObjectLiteralExpression(returned)) {
11641
+ if (Node50.isObjectLiteralExpression(returned)) {
11549
11642
  const terminal = terminalFromReturnedObject(
11550
11643
  returned,
11551
11644
  node,
@@ -11556,7 +11649,7 @@ function tryMatchReturnShape(node, pattern, match, resolution, resolveCallee2) {
11556
11649
  );
11557
11650
  return terminal === null ? [] : [terminal];
11558
11651
  }
11559
- if (!Node49.isCallExpression(returned)) {
11652
+ if (!Node50.isCallExpression(returned)) {
11560
11653
  return [];
11561
11654
  }
11562
11655
  const resolved = resolveHelperReturn(returned, resolveCallee2);
@@ -11593,7 +11686,7 @@ function terminalFromReturnedObject(obj, anchor, pattern, match, substitutions,
11593
11686
  if (required !== void 0 && required.length > 0) {
11594
11687
  const presentNames = /* @__PURE__ */ new Set();
11595
11688
  for (const prop of obj.getProperties()) {
11596
- if (Node49.isPropertyAssignment(prop) || Node49.isShorthandPropertyAssignment(prop)) {
11689
+ if (Node50.isPropertyAssignment(prop) || Node50.isShorthandPropertyAssignment(prop)) {
11597
11690
  presentNames.add(prop.getName());
11598
11691
  }
11599
11692
  }
@@ -11619,7 +11712,7 @@ function terminalFromReturnedObject(obj, anchor, pattern, match, substitutions,
11619
11712
  // When a helper built the value, the anchor is the caller's own
11620
11713
  // return, so it doubles as the provenance. A value reached any other
11621
11714
  // way leaves this unset and its caller fills it in.
11622
- ...Node49.isReturnStatement(anchor) ? { source: anchor } : {},
11715
+ ...Node50.isReturnStatement(anchor) ? { source: anchor } : {},
11623
11716
  terminal: {
11624
11717
  kind: pattern.kind,
11625
11718
  statusCode,
@@ -11638,7 +11731,7 @@ function terminalFromReturnedObject(obj, anchor, pattern, match, substitutions,
11638
11731
  };
11639
11732
  }
11640
11733
  function tryMatchParameterMethodCall(node, func, pattern, match, resolution) {
11641
- if (!Node49.isCallExpression(node)) {
11734
+ if (!Node50.isCallExpression(node)) {
11642
11735
  return [];
11643
11736
  }
11644
11737
  const result = unwrapMethodChain(node, match, func);
@@ -11698,7 +11791,7 @@ function statusArgument(calls, extraction) {
11698
11791
  }
11699
11792
  function returnCoveredByParameterMethodCall(expr, func, patterns) {
11700
11793
  const current2 = unwrapValue(expr);
11701
- if (!Node49.isCallExpression(current2)) {
11794
+ if (!Node50.isCallExpression(current2)) {
11702
11795
  return false;
11703
11796
  }
11704
11797
  for (const pattern of patterns) {
@@ -11714,7 +11807,7 @@ function returnCoveredByParameterMethodCall(expr, func, patterns) {
11714
11807
  }
11715
11808
  function tryMatchReturnStatement(node, pattern, func, allPatterns) {
11716
11809
  const match = pattern.match.type === "returnStatement" ? pattern.match : null;
11717
- if (Node49.isReturnStatement(node)) {
11810
+ if (Node50.isReturnStatement(node)) {
11718
11811
  const expr = node.getExpression();
11719
11812
  if (match?.excludeCallReturns === true) {
11720
11813
  if (expr === void 0) {
@@ -11733,9 +11826,9 @@ function tryMatchReturnStatement(node, pattern, func, allPatterns) {
11733
11826
  }
11734
11827
  return buildReturnTerminal(node, pattern, body);
11735
11828
  }
11736
- if (Node49.isArrowFunction(node)) {
11829
+ if (Node50.isArrowFunction(node)) {
11737
11830
  const body = node.getBody();
11738
- if (body === void 0 || Node49.isBlock(body)) {
11831
+ if (body === void 0 || Node50.isBlock(body)) {
11739
11832
  return null;
11740
11833
  }
11741
11834
  const shape = extractShape(body);
@@ -11793,20 +11886,20 @@ function unresolvedTerminal(kind, node) {
11793
11886
  };
11794
11887
  }
11795
11888
  function calleeSubject(callee) {
11796
- if (Node49.isIdentifier(callee)) {
11889
+ if (Node50.isIdentifier(callee)) {
11797
11890
  return callee;
11798
11891
  }
11799
- if (Node49.isPropertyAccessExpression(callee)) {
11892
+ if (Node50.isPropertyAccessExpression(callee)) {
11800
11893
  const subject = callee.getExpression();
11801
- return Node49.isIdentifier(subject) ? subject : null;
11894
+ return Node50.isIdentifier(subject) ? subject : null;
11802
11895
  }
11803
11896
  return null;
11804
11897
  }
11805
11898
  function tryMatchFunctionCall(node, pattern, match, resolution, originatesFrom) {
11806
- if (!Node49.isCallExpression(node) && !Node49.isNewExpression(node)) {
11899
+ if (!Node50.isCallExpression(node) && !Node50.isNewExpression(node)) {
11807
11900
  return null;
11808
11901
  }
11809
- if (Node49.isNewExpression(node) && returnPositionOf(node) === null) {
11902
+ if (Node50.isNewExpression(node) && returnPositionOf(node) === null) {
11810
11903
  return null;
11811
11904
  }
11812
11905
  const callee = node.getExpression();
@@ -11845,9 +11938,9 @@ function tryMatchFunctionCall(node, pattern, match, resolution, originatesFrom)
11845
11938
  }
11846
11939
 
11847
11940
  // src/terminals/throws.ts
11848
- import { Node as Node50 } from "ts-morph";
11941
+ import { Node as Node51 } from "ts-morph";
11849
11942
  function tryMatchThrowExpression(node, pattern, match, resolution) {
11850
- if (!Node50.isThrowStatement(node)) {
11943
+ if (!Node51.isThrowStatement(node)) {
11851
11944
  return null;
11852
11945
  }
11853
11946
  const thrownExpr = node.getExpression();
@@ -11889,17 +11982,17 @@ function extractThrowMessage(callArgs) {
11889
11982
  return null;
11890
11983
  }
11891
11984
  for (const arg of callArgs) {
11892
- if (Node50.isStringLiteral(arg) || Node50.isNoSubstitutionTemplateLiteral(arg)) {
11985
+ if (Node51.isStringLiteral(arg) || Node51.isNoSubstitutionTemplateLiteral(arg)) {
11893
11986
  return arg.getLiteralValue();
11894
11987
  }
11895
- if (Node50.isTemplateExpression(arg)) {
11988
+ if (Node51.isTemplateExpression(arg)) {
11896
11989
  return arg.getText();
11897
11990
  }
11898
11991
  }
11899
11992
  return null;
11900
11993
  }
11901
11994
  function classifyThrownExpression(thrown, constructorPattern) {
11902
- if (Node50.isCallExpression(thrown) || Node50.isNewExpression(thrown)) {
11995
+ if (Node51.isCallExpression(thrown) || Node51.isNewExpression(thrown)) {
11903
11996
  const calleeText = thrown.getExpression().getText();
11904
11997
  if (constructorPattern !== void 0 && !calleeText.startsWith(constructorPattern)) {
11905
11998
  return null;
@@ -11986,9 +12079,9 @@ function findTerminals(func, patterns, barriers = NO_BARRIERS, resolution, origi
11986
12079
  }
11987
12080
  }
11988
12081
  });
11989
- if (results.length === 0 && Node51.isArrowFunction(func)) {
12082
+ if (results.length === 0 && Node52.isArrowFunction(func)) {
11990
12083
  const body = func.getBody();
11991
- if (body !== void 0 && !Node51.isBlock(body)) {
12084
+ if (body !== void 0 && !Node52.isBlock(body)) {
11992
12085
  for (const pattern of patterns) {
11993
12086
  let found = null;
11994
12087
  if (pattern.match.type === "parameterMethodCall") {
@@ -12023,7 +12116,7 @@ function functionMayFallThrough(func) {
12023
12116
  if (body === void 0) {
12024
12117
  return false;
12025
12118
  }
12026
- if (!Node51.isBlock(body)) {
12119
+ if (!Node52.isBlock(body)) {
12027
12120
  return false;
12028
12121
  }
12029
12122
  const statements = body.getStatements();
@@ -12031,7 +12124,7 @@ function functionMayFallThrough(func) {
12031
12124
  return true;
12032
12125
  }
12033
12126
  const last = statements[statements.length - 1];
12034
- if (Node51.isReturnStatement(last) || Node51.isThrowStatement(last)) {
12127
+ if (Node52.isReturnStatement(last) || Node52.isThrowStatement(last)) {
12035
12128
  return false;
12036
12129
  }
12037
12130
  return true;
@@ -12079,7 +12172,7 @@ function writesTerminal(call, terminalNodes) {
12079
12172
  }
12080
12173
  }
12081
12174
  function isReceiverOf(node, parent) {
12082
- return (Node52.isPropertyAccessExpression(parent) || Node52.isElementAccessExpression(parent) || Node52.isCallExpression(parent)) && parent.getExpression() === node;
12175
+ return (Node53.isPropertyAccessExpression(parent) || Node53.isElementAccessExpression(parent) || Node53.isCallExpression(parent)) && parent.getExpression() === node;
12083
12176
  }
12084
12177
  var isDefaultConditionList = (conditions) => conditions.length === 0 || conditions.every(
12085
12178
  (c) => c.source === "earlyReturn" || c.source === "earlyThrow"
@@ -12089,7 +12182,7 @@ function bodyContentOf(func) {
12089
12182
  if (body === void 0) {
12090
12183
  return "absent";
12091
12184
  }
12092
- if (!Node52.isBlock(body)) {
12185
+ if (!Node53.isBlock(body)) {
12093
12186
  return "statements";
12094
12187
  }
12095
12188
  return body.getStatements().length === 0 ? "empty" : "statements";
@@ -12105,7 +12198,7 @@ function countUnmatchedReturns(func, terminals, barriers = NO_BARRIERS) {
12105
12198
  claimed.add(source);
12106
12199
  }
12107
12200
  }
12108
- if (Node52.isArrowFunction(func) && Node52.isExpression(body)) {
12201
+ if (Node53.isArrowFunction(func) && Node53.isExpression(body)) {
12109
12202
  return claimed.has(body) ? 0 : 1;
12110
12203
  }
12111
12204
  let unmatched = 0;
@@ -12118,7 +12211,7 @@ function countUnmatchedReturns(func, terminals, barriers = NO_BARRIERS) {
12118
12211
  traversal.skip();
12119
12212
  return;
12120
12213
  }
12121
- if (!Node52.isReturnStatement(node)) {
12214
+ if (!Node53.isReturnStatement(node)) {
12122
12215
  return;
12123
12216
  }
12124
12217
  if (node.getExpression() === void 0) {
@@ -12271,7 +12364,7 @@ function accountFor(site, terminalNodes, branches) {
12271
12364
  }
12272
12365
 
12273
12366
  // src/bootstrap/sourceFileLookup.ts
12274
- import { Node as Node53 } from "ts-morph";
12367
+ import { Node as Node54 } from "ts-morph";
12275
12368
  function createSourceFileLookup(project) {
12276
12369
  const all = project.getSourceFiles();
12277
12370
  const byAbs = /* @__PURE__ */ new Map();
@@ -12333,7 +12426,7 @@ function spanKey(span) {
12333
12426
  function indexFunctions(sf) {
12334
12427
  const index = /* @__PURE__ */ new Map();
12335
12428
  sf.forEachDescendant((node) => {
12336
- if (!Node53.isFunctionDeclaration(node) && !Node53.isFunctionExpression(node) && !Node53.isArrowFunction(node) && !Node53.isMethodDeclaration(node)) {
12429
+ if (!Node54.isFunctionDeclaration(node) && !Node54.isFunctionExpression(node) && !Node54.isArrowFunction(node) && !Node54.isMethodDeclaration(node)) {
12337
12430
  return;
12338
12431
  }
12339
12432
  const bySpan = spanKey({ start: node.getStart(), end: node.getEnd() });
@@ -12347,13 +12440,13 @@ function indexFunctions(sf) {
12347
12440
  }
12348
12441
 
12349
12442
  // src/contract.ts
12350
- import { Node as Node54 } from "ts-morph";
12443
+ import { Node as Node55 } from "ts-morph";
12351
12444
  import { restBinding } from "@suss/behavioral-ir";
12352
12445
  function extractDeclaredBody(node) {
12353
12446
  if (node === void 0) {
12354
12447
  return null;
12355
12448
  }
12356
- if (!Node54.isCallExpression(node)) {
12449
+ if (!Node55.isCallExpression(node)) {
12357
12450
  return null;
12358
12451
  }
12359
12452
  const typeArgs = node.getTypeArguments();
@@ -12367,10 +12460,10 @@ function resolveHandlerPropNode(func) {
12367
12460
  if (parent === void 0) {
12368
12461
  return null;
12369
12462
  }
12370
- if (Node54.isPropertyAssignment(parent)) {
12463
+ if (Node55.isPropertyAssignment(parent)) {
12371
12464
  return parent;
12372
12465
  }
12373
- if (Node54.isMethodDeclaration(func)) {
12466
+ if (Node55.isMethodDeclaration(func)) {
12374
12467
  return func;
12375
12468
  }
12376
12469
  return null;
@@ -12382,11 +12475,11 @@ function findRouterCall(unit) {
12382
12475
  return null;
12383
12476
  }
12384
12477
  const handlersObj = propNode.getParent();
12385
- if (handlersObj === void 0 || !Node54.isObjectLiteralExpression(handlersObj)) {
12478
+ if (handlersObj === void 0 || !Node55.isObjectLiteralExpression(handlersObj)) {
12386
12479
  return null;
12387
12480
  }
12388
12481
  const routerCall = handlersObj.getParent();
12389
- if (routerCall === void 0 || !Node54.isCallExpression(routerCall)) {
12482
+ if (routerCall === void 0 || !Node55.isCallExpression(routerCall)) {
12390
12483
  return null;
12391
12484
  }
12392
12485
  const args = routerCall.getArguments();
@@ -12399,17 +12492,17 @@ function findRouterCall(unit) {
12399
12492
  };
12400
12493
  }
12401
12494
  function resolveContractObject(contractArg, resolution) {
12402
- if (Node54.isObjectLiteralExpression(contractArg)) {
12495
+ if (Node55.isObjectLiteralExpression(contractArg)) {
12403
12496
  return contractArg;
12404
12497
  }
12405
- if (Node54.isPropertyAccessExpression(contractArg)) {
12498
+ if (Node55.isPropertyAccessExpression(contractArg)) {
12406
12499
  const base = resolveContractObject(contractArg.getExpression(), resolution);
12407
- if (base === null || !Node54.isObjectLiteralExpression(base)) {
12500
+ if (base === null || !Node55.isObjectLiteralExpression(base)) {
12408
12501
  return null;
12409
12502
  }
12410
12503
  const propName = contractArg.getName();
12411
12504
  for (const prop of base.getProperties()) {
12412
- if (!Node54.isPropertyAssignment(prop)) {
12505
+ if (!Node55.isPropertyAssignment(prop)) {
12413
12506
  continue;
12414
12507
  }
12415
12508
  if (prop.getName() !== propName) {
@@ -12419,20 +12512,20 @@ function resolveContractObject(contractArg, resolution) {
12419
12512
  if (value === void 0) {
12420
12513
  return null;
12421
12514
  }
12422
- if (Node54.isObjectLiteralExpression(value)) {
12515
+ if (Node55.isObjectLiteralExpression(value)) {
12423
12516
  return value;
12424
12517
  }
12425
- if (Node54.isIdentifier(value) || Node54.isPropertyAccessExpression(value)) {
12518
+ if (Node55.isIdentifier(value) || Node55.isPropertyAccessExpression(value)) {
12426
12519
  return resolveContractObject(value, resolution);
12427
12520
  }
12428
- if (Node54.isCallExpression(value)) {
12521
+ if (Node55.isCallExpression(value)) {
12429
12522
  return unwrapContractInit(value);
12430
12523
  }
12431
12524
  return null;
12432
12525
  }
12433
12526
  return null;
12434
12527
  }
12435
- if (!Node54.isIdentifier(contractArg)) {
12528
+ if (!Node55.isIdentifier(contractArg)) {
12436
12529
  return null;
12437
12530
  }
12438
12531
  const symbol = contractArg.getSymbol();
@@ -12444,7 +12537,7 @@ function resolveContractObject(contractArg, resolution) {
12444
12537
  return null;
12445
12538
  }
12446
12539
  const decl = decls[0];
12447
- if (Node54.isImportSpecifier(decl)) {
12540
+ if (Node55.isImportSpecifier(decl)) {
12448
12541
  const importDecl = decl.getImportDeclaration();
12449
12542
  const sourceFile = importDecl.getModuleSpecifierSourceFile();
12450
12543
  if (sourceFile !== void 0 && resolution !== void 0) {
@@ -12453,14 +12546,14 @@ function resolveContractObject(contractArg, resolution) {
12453
12546
  );
12454
12547
  if (exported !== void 0 && exported.length > 0) {
12455
12548
  const exportedDecl = exported[0];
12456
- if (Node54.isVariableDeclaration(exportedDecl)) {
12549
+ if (Node55.isVariableDeclaration(exportedDecl)) {
12457
12550
  return unwrapContractInit(exportedDecl.getInitializer());
12458
12551
  }
12459
12552
  }
12460
12553
  }
12461
12554
  return null;
12462
12555
  }
12463
- if (Node54.isVariableDeclaration(decl)) {
12556
+ if (Node55.isVariableDeclaration(decl)) {
12464
12557
  return unwrapContractInit(decl.getInitializer());
12465
12558
  }
12466
12559
  return null;
@@ -12470,39 +12563,39 @@ function unwrapContractInit(init) {
12470
12563
  return null;
12471
12564
  }
12472
12565
  const node = peelSyntax(init);
12473
- if (Node54.isCallExpression(node)) {
12566
+ if (Node55.isCallExpression(node)) {
12474
12567
  const args = node.getArguments();
12475
- if (args.length > 0 && Node54.isObjectLiteralExpression(args[0])) {
12568
+ if (args.length > 0 && Node55.isObjectLiteralExpression(args[0])) {
12476
12569
  return args[0];
12477
12570
  }
12478
12571
  return null;
12479
12572
  }
12480
- if (Node54.isObjectLiteralExpression(node)) {
12573
+ if (Node55.isObjectLiteralExpression(node)) {
12481
12574
  return node;
12482
12575
  }
12483
12576
  return null;
12484
12577
  }
12485
12578
  function extractEndpointContract(endpointNode, pattern, framework, resolution) {
12486
- if (!Node54.isObjectLiteralExpression(endpointNode)) {
12579
+ if (!Node55.isObjectLiteralExpression(endpointNode)) {
12487
12580
  return null;
12488
12581
  }
12489
12582
  const responses = [];
12490
12583
  let method;
12491
12584
  let path15;
12492
12585
  for (const prop of endpointNode.getProperties()) {
12493
- if (!Node54.isPropertyAssignment(prop)) {
12586
+ if (!Node55.isPropertyAssignment(prop)) {
12494
12587
  continue;
12495
12588
  }
12496
12589
  const propName = prop.getName();
12497
12590
  if (propName === pattern.methodProperty) {
12498
12591
  const val = prop.getInitializer();
12499
- if (val !== void 0 && Node54.isStringLiteral(val)) {
12592
+ if (val !== void 0 && Node55.isStringLiteral(val)) {
12500
12593
  method = val.getLiteralValue();
12501
12594
  }
12502
12595
  }
12503
12596
  if (propName === pattern.pathProperty) {
12504
12597
  const val = prop.getInitializer();
12505
- if (val !== void 0 && Node54.isStringLiteral(val)) {
12598
+ if (val !== void 0 && Node55.isStringLiteral(val)) {
12506
12599
  path15 = val.getLiteralValue();
12507
12600
  }
12508
12601
  }
@@ -12511,7 +12604,7 @@ function extractEndpointContract(endpointNode, pattern, framework, resolution) {
12511
12604
  const val = written === void 0 ? null : objectLiteralOf(written, resolution);
12512
12605
  if (val !== null) {
12513
12606
  for (const respProp of propertiesOf(val, resolution)) {
12514
- if (!Node54.isPropertyAssignment(respProp)) {
12607
+ if (!Node55.isPropertyAssignment(respProp)) {
12515
12608
  continue;
12516
12609
  }
12517
12610
  const statusStr = respProp.getName();
@@ -12561,11 +12654,11 @@ function readContract(unit, pattern, framework, resolution) {
12561
12654
  return null;
12562
12655
  }
12563
12656
  const contractObj = resolveContractObject(routerInfo.contractArg, resolution);
12564
- if (contractObj === null || !Node54.isObjectLiteralExpression(contractObj)) {
12657
+ if (contractObj === null || !Node55.isObjectLiteralExpression(contractObj)) {
12565
12658
  return null;
12566
12659
  }
12567
12660
  for (const prop of contractObj.getProperties()) {
12568
- if (!Node54.isPropertyAssignment(prop)) {
12661
+ if (!Node55.isPropertyAssignment(prop)) {
12569
12662
  continue;
12570
12663
  }
12571
12664
  if (prop.getName() !== routerInfo.handlerName) {
@@ -12590,7 +12683,7 @@ function endpointFromRegistrationArgument(unit, position, resolution) {
12590
12683
  return null;
12591
12684
  }
12592
12685
  const call = func.getParent();
12593
- if (call === void 0 || !Node54.isCallExpression(call)) {
12686
+ if (call === void 0 || !Node55.isCallExpression(call)) {
12594
12687
  return null;
12595
12688
  }
12596
12689
  const args = call.getArguments();
@@ -12602,24 +12695,24 @@ function endpointFromRegistrationArgument(unit, position, resolution) {
12602
12695
  return null;
12603
12696
  }
12604
12697
  let node = arg;
12605
- while (Node54.isAsExpression(node)) {
12698
+ while (Node55.isAsExpression(node)) {
12606
12699
  node = node.getExpression();
12607
12700
  }
12608
- if (Node54.isObjectLiteralExpression(node)) {
12701
+ if (Node55.isObjectLiteralExpression(node)) {
12609
12702
  return node;
12610
12703
  }
12611
- if (Node54.isCallExpression(node)) {
12704
+ if (Node55.isCallExpression(node)) {
12612
12705
  return unwrapContractInit(node);
12613
12706
  }
12614
12707
  return resolveContractObject(node, resolution);
12615
12708
  }
12616
12709
  function readContractForClientCall(callExpression, methodName, pattern, framework, resolution) {
12617
- const callee = Node54.isCallExpression(callExpression) ? callExpression.getExpression() : null;
12618
- if (callee === null || !Node54.isPropertyAccessExpression(callee)) {
12710
+ const callee = Node55.isCallExpression(callExpression) ? callExpression.getExpression() : null;
12711
+ if (callee === null || !Node55.isPropertyAccessExpression(callee)) {
12619
12712
  return null;
12620
12713
  }
12621
12714
  const clientIdentifier = callee.getExpression();
12622
- if (!Node54.isIdentifier(clientIdentifier)) {
12715
+ if (!Node55.isIdentifier(clientIdentifier)) {
12623
12716
  return null;
12624
12717
  }
12625
12718
  const symbol = clientIdentifier.getSymbol();
@@ -12631,11 +12724,11 @@ function readContractForClientCall(callExpression, methodName, pattern, framewor
12631
12724
  return null;
12632
12725
  }
12633
12726
  const decl = decls[0];
12634
- if (!Node54.isVariableDeclaration(decl)) {
12727
+ if (!Node55.isVariableDeclaration(decl)) {
12635
12728
  return null;
12636
12729
  }
12637
12730
  const init = decl.getInitializer();
12638
- if (init === void 0 || !Node54.isCallExpression(init)) {
12731
+ if (init === void 0 || !Node55.isCallExpression(init)) {
12639
12732
  return null;
12640
12733
  }
12641
12734
  const args = init.getArguments();
@@ -12643,11 +12736,11 @@ function readContractForClientCall(callExpression, methodName, pattern, framewor
12643
12736
  return null;
12644
12737
  }
12645
12738
  const contractObj = resolveContractObject(args[0], resolution);
12646
- if (contractObj === null || !Node54.isObjectLiteralExpression(contractObj)) {
12739
+ if (contractObj === null || !Node55.isObjectLiteralExpression(contractObj)) {
12647
12740
  return null;
12648
12741
  }
12649
12742
  for (const prop of contractObj.getProperties()) {
12650
- if (!Node54.isPropertyAssignment(prop)) {
12743
+ if (!Node55.isPropertyAssignment(prop)) {
12651
12744
  continue;
12652
12745
  }
12653
12746
  if (prop.getName() !== methodName) {
@@ -12902,7 +12995,7 @@ import {
12902
12995
  } from "graphql";
12903
12996
  import picomatch2 from "picomatch";
12904
12997
  import {
12905
- Node as Node55
12998
+ Node as Node56
12906
12999
  } from "ts-morph";
12907
13000
  import {
12908
13001
  isGraphqlOperationBinding,
@@ -12947,11 +13040,11 @@ function fragmentsRegisteredIn(sourceFiles) {
12947
13040
  const registered = /* @__PURE__ */ new Set();
12948
13041
  for (const sourceFile of sourceFiles) {
12949
13042
  sourceFile.forEachDescendant((node) => {
12950
- if (!Node55.isCallExpression(node)) {
13043
+ if (!Node56.isCallExpression(node)) {
12951
13044
  return;
12952
13045
  }
12953
13046
  const argument = node.getArguments()[0];
12954
- if (argument === void 0 || !Node55.isNoSubstitutionTemplateLiteral(argument)) {
13047
+ if (argument === void 0 || !Node56.isNoSubstitutionTemplateLiteral(argument)) {
12955
13048
  return;
12956
13049
  }
12957
13050
  for (const name of fragmentOnlyDocumentNames(argument.getLiteralText())) {
@@ -13138,7 +13231,7 @@ function constructionRegistryStatus(construction, spec) {
13138
13231
  if (cacheConstruction === null) {
13139
13232
  return "unknown";
13140
13233
  }
13141
- if (!Node55.isNewExpression(cacheConstruction) && !Node55.isCallExpression(cacheConstruction)) {
13234
+ if (!Node56.isNewExpression(cacheConstruction) && !Node56.isCallExpression(cacheConstruction)) {
13142
13235
  return "unknown";
13143
13236
  }
13144
13237
  const args = cacheConstruction.getArguments();
@@ -13152,15 +13245,15 @@ function constructionRegistryStatus(construction, spec) {
13152
13245
  if (cacheOptions.getProperty(spec.registryProperty) !== void 0) {
13153
13246
  return "configured";
13154
13247
  }
13155
- const hasSpread = cacheOptions.getProperties().some((property) => Node55.isSpreadAssignment(property));
13248
+ const hasSpread = cacheOptions.getProperties().some((property) => Node56.isSpreadAssignment(property));
13156
13249
  return hasSpread ? "unknown" : "absent";
13157
13250
  }
13158
13251
  function firstArgumentObjectLiteral(construction) {
13159
- if (!Node55.isNewExpression(construction) && !Node55.isCallExpression(construction)) {
13252
+ if (!Node56.isNewExpression(construction) && !Node56.isCallExpression(construction)) {
13160
13253
  return null;
13161
13254
  }
13162
13255
  const arg = construction.getArguments()[0];
13163
- if (arg === void 0 || !Node55.isObjectLiteralExpression(arg)) {
13256
+ if (arg === void 0 || !Node56.isObjectLiteralExpression(arg)) {
13164
13257
  return null;
13165
13258
  }
13166
13259
  return arg;
@@ -13170,10 +13263,10 @@ function propertyValueOf2(options, name) {
13170
13263
  if (property === void 0) {
13171
13264
  return null;
13172
13265
  }
13173
- if (Node55.isPropertyAssignment(property)) {
13266
+ if (Node56.isPropertyAssignment(property)) {
13174
13267
  return property.getInitializer() ?? null;
13175
13268
  }
13176
- if (Node55.isShorthandPropertyAssignment(property)) {
13269
+ if (Node56.isShorthandPropertyAssignment(property)) {
13177
13270
  const symbol = property.getProject().getTypeChecker().getShorthandAssignmentValueSymbol(property);
13178
13271
  return symbol?.getValueDeclaration() ?? null;
13179
13272
  }
@@ -13183,13 +13276,13 @@ function resolveToConstructionOf(expression, cacheClass) {
13183
13276
  let current2 = expression;
13184
13277
  for (let hop = 0; hop < 4 && current2 !== void 0; hop += 1) {
13185
13278
  current2 = unwrapExpression2(current2);
13186
- if (Node55.isVariableDeclaration(current2)) {
13279
+ if (Node56.isVariableDeclaration(current2)) {
13187
13280
  current2 = current2.getInitializer();
13188
13281
  continue;
13189
13282
  }
13190
- if (Node55.isNewExpression(current2) || Node55.isCallExpression(current2)) {
13283
+ if (Node56.isNewExpression(current2) || Node56.isCallExpression(current2)) {
13191
13284
  const callee = current2.getExpression();
13192
- if (callee === void 0 || !Node55.isIdentifier(callee)) {
13285
+ if (callee === void 0 || !Node56.isIdentifier(callee)) {
13193
13286
  return null;
13194
13287
  }
13195
13288
  const local = localImportName(
@@ -13199,11 +13292,11 @@ function resolveToConstructionOf(expression, cacheClass) {
13199
13292
  );
13200
13293
  return local !== null && callee.getText() === local ? current2 : null;
13201
13294
  }
13202
- if (!Node55.isIdentifier(current2)) {
13295
+ if (!Node56.isIdentifier(current2)) {
13203
13296
  return null;
13204
13297
  }
13205
13298
  const declaration = current2.getSymbol()?.getValueDeclaration();
13206
- if (declaration === void 0 || !Node55.isVariableDeclaration(declaration)) {
13299
+ if (declaration === void 0 || !Node56.isVariableDeclaration(declaration)) {
13207
13300
  return null;
13208
13301
  }
13209
13302
  current2 = declaration.getInitializer();
@@ -13214,11 +13307,11 @@ function unwrapExpression2(node) {
13214
13307
  return peelSyntax(node);
13215
13308
  }
13216
13309
  function isConstructionNamed(node, localName) {
13217
- if (!Node55.isNewExpression(node) && !Node55.isCallExpression(node)) {
13310
+ if (!Node56.isNewExpression(node) && !Node56.isCallExpression(node)) {
13218
13311
  return false;
13219
13312
  }
13220
13313
  const callee = node.getExpression();
13221
- return callee !== void 0 && Node55.isIdentifier(callee) && callee.getText() === localName;
13314
+ return callee !== void 0 && Node56.isIdentifier(callee) && callee.getText() === localName;
13222
13315
  }
13223
13316
  function localImportName(sourceFile, importModule, importName) {
13224
13317
  for (const one of namedImportsOf(sourceFile, [importModule], {
@@ -13232,11 +13325,11 @@ function localImportName(sourceFile, importModule, importName) {
13232
13325
  }
13233
13326
  function constructionRef(node, uriProperty, resolution) {
13234
13327
  const optionsArg = node.getArguments()[0];
13235
- if (optionsArg === void 0 || !Node55.isObjectLiteralExpression(optionsArg)) {
13328
+ if (optionsArg === void 0 || !Node56.isObjectLiteralExpression(optionsArg)) {
13236
13329
  return null;
13237
13330
  }
13238
13331
  const property = optionsArg.getProperty(uriProperty);
13239
- if (property === void 0 || !Node55.isPropertyAssignment(property)) {
13332
+ if (property === void 0 || !Node56.isPropertyAssignment(property)) {
13240
13333
  return null;
13241
13334
  }
13242
13335
  const value = property.getInitializer();
@@ -13251,10 +13344,10 @@ function constructionRef(node, uriProperty, resolution) {
13251
13344
  }
13252
13345
 
13253
13346
  // src/discovery/helperIndex.ts
13254
- import { Node as Node57 } from "ts-morph";
13347
+ import { Node as Node58 } from "ts-morph";
13255
13348
 
13256
13349
  // src/discovery/helperReading.ts
13257
- import { Node as Node56 } from "ts-morph";
13350
+ import { Node as Node57 } from "ts-morph";
13258
13351
  var UNREAD = { as: "unread" };
13259
13352
  function readHelperSinks(helper) {
13260
13353
  const positions = parameterPositions(helper);
@@ -13264,11 +13357,11 @@ function readHelperSinks(helper) {
13264
13357
  return sinks;
13265
13358
  }
13266
13359
  body.forEachDescendant((node) => {
13267
- if (!Node56.isCallExpression(node)) {
13360
+ if (!Node57.isCallExpression(node)) {
13268
13361
  return;
13269
13362
  }
13270
13363
  const callee = node.getExpression();
13271
- const [method, receiver] = Node56.isPropertyAccessExpression(callee) ? [callee.getName(), readValue(callee.getExpression(), positions)] : [null, UNREAD];
13364
+ const [method, receiver] = Node57.isPropertyAccessExpression(callee) ? [callee.getName(), readValue(callee.getExpression(), positions)] : [null, UNREAD];
13272
13365
  sinks.push({
13273
13366
  method,
13274
13367
  receiver,
@@ -13288,25 +13381,25 @@ function parameterPositions(helper) {
13288
13381
  return positions;
13289
13382
  }
13290
13383
  function readValue(node, positions) {
13291
- if (Node56.isStringLiteral(node) || Node56.isNoSubstitutionTemplateLiteral(node)) {
13384
+ if (Node57.isStringLiteral(node) || Node57.isNoSubstitutionTemplateLiteral(node)) {
13292
13385
  return { as: "text", text: node.getLiteralValue() };
13293
13386
  }
13294
- if (Node56.isTemplateExpression(node)) {
13387
+ if (Node57.isTemplateExpression(node)) {
13295
13388
  return templateText(node, positions);
13296
13389
  }
13297
- if (Node56.isIdentifier(node)) {
13390
+ if (Node57.isIdentifier(node)) {
13298
13391
  const position = positions.get(node.getText());
13299
13392
  return position === void 0 ? UNREAD : { as: "parameter", position };
13300
13393
  }
13301
- if (Node56.isPropertyAccessExpression(node)) {
13394
+ if (Node57.isPropertyAccessExpression(node)) {
13302
13395
  const target = node.getExpression();
13303
- const position = Node56.isIdentifier(target) ? positions.get(target.getText()) : void 0;
13396
+ const position = Node57.isIdentifier(target) ? positions.get(target.getText()) : void 0;
13304
13397
  return position === void 0 ? UNREAD : { as: "parameter", position, property: node.getName() };
13305
13398
  }
13306
- if (Node56.isObjectLiteralExpression(node)) {
13399
+ if (Node57.isObjectLiteralExpression(node)) {
13307
13400
  return objectValue(node, positions);
13308
13401
  }
13309
- if (Node56.isCallExpression(node)) {
13402
+ if (Node57.isCallExpression(node)) {
13310
13403
  return {
13311
13404
  as: "call",
13312
13405
  callee: node.getExpression().getText(),
@@ -13316,13 +13409,13 @@ function readValue(node, positions) {
13316
13409
  return UNREAD;
13317
13410
  }
13318
13411
  function templateText(node, positions) {
13319
- if (!Node56.isTemplateExpression(node)) {
13412
+ if (!Node57.isTemplateExpression(node)) {
13320
13413
  return UNREAD;
13321
13414
  }
13322
13415
  let text = node.getHead().getLiteralText();
13323
13416
  for (const span of node.getTemplateSpans()) {
13324
13417
  const expression = span.getExpression();
13325
- const position = Node56.isIdentifier(expression) ? positions.get(expression.getText()) : void 0;
13418
+ const position = Node57.isIdentifier(expression) ? positions.get(expression.getText()) : void 0;
13326
13419
  if (position === void 0) {
13327
13420
  return UNREAD;
13328
13421
  }
@@ -13331,12 +13424,12 @@ function templateText(node, positions) {
13331
13424
  return { as: "text", text };
13332
13425
  }
13333
13426
  function objectValue(node, positions) {
13334
- if (!Node56.isObjectLiteralExpression(node)) {
13427
+ if (!Node57.isObjectLiteralExpression(node)) {
13335
13428
  return UNREAD;
13336
13429
  }
13337
13430
  const properties = {};
13338
13431
  for (const property of node.getProperties()) {
13339
- if (!Node56.isPropertyAssignment(property)) {
13432
+ if (!Node57.isPropertyAssignment(property)) {
13340
13433
  continue;
13341
13434
  }
13342
13435
  const initializer = property.getInitializer();
@@ -13351,7 +13444,7 @@ function objectValue(node, positions) {
13351
13444
  return { as: "object", properties };
13352
13445
  }
13353
13446
  function propertyKey(name) {
13354
- return Node56.isStringLiteral(name) ? name.getLiteralValue() : name.getText();
13447
+ return Node57.isStringLiteral(name) ? name.getLiteralValue() : name.getText();
13355
13448
  }
13356
13449
 
13357
13450
  // src/discovery/helperIndex.ts
@@ -13481,11 +13574,11 @@ function registrationMatchesOf(pack) {
13481
13574
  }
13482
13575
  function collectHandOffs(sourceFile, subjects, match, resolution, found) {
13483
13576
  sourceFile.forEachDescendant((node) => {
13484
- if (!Node57.isCallExpression(node)) {
13577
+ if (!Node58.isCallExpression(node)) {
13485
13578
  return;
13486
13579
  }
13487
13580
  const callee = node.getExpression();
13488
- if (!Node57.isIdentifier(callee)) {
13581
+ if (!Node58.isIdentifier(callee)) {
13489
13582
  return;
13490
13583
  }
13491
13584
  const handedOver = subjectArgument(node, subjects, match, resolution);
@@ -13500,12 +13593,12 @@ function collectHandOffs(sourceFile, subjects, match, resolution, found) {
13500
13593
  });
13501
13594
  }
13502
13595
  function subjectArgument(call, subjects, match, resolution) {
13503
- if (!Node57.isCallExpression(call)) {
13596
+ if (!Node58.isCallExpression(call)) {
13504
13597
  return -1;
13505
13598
  }
13506
13599
  const args = call.getArguments();
13507
13600
  for (const [position, argument] of args.entries()) {
13508
- if (!Node57.isIdentifier(argument) && !Node57.isPropertyAccessExpression(argument)) {
13601
+ if (!Node58.isIdentifier(argument) && !Node58.isPropertyAccessExpression(argument)) {
13509
13602
  continue;
13510
13603
  }
13511
13604
  if (subjectNodeFor(argument, subjects, match, resolution) !== void 0) {
@@ -13564,10 +13657,10 @@ function declaredFunctions(sourceFile) {
13564
13657
  found.push([name, declaration]);
13565
13658
  }
13566
13659
  }
13567
- for (const variable4 of sourceFile.getVariableDeclarations()) {
13568
- const initializer = variable4.getInitializer();
13569
- if (initializer !== void 0 && (Node57.isArrowFunction(initializer) || Node57.isFunctionExpression(initializer))) {
13570
- found.push([variable4.getName(), initializer]);
13660
+ for (const variable3 of sourceFile.getVariableDeclarations()) {
13661
+ const initializer = variable3.getInitializer();
13662
+ if (initializer !== void 0 && (Node58.isArrowFunction(initializer) || Node58.isFunctionExpression(initializer))) {
13663
+ found.push([variable3.getName(), initializer]);
13571
13664
  }
13572
13665
  }
13573
13666
  return found;
@@ -13661,7 +13754,7 @@ function recordEdge(edgesByChild, candidate) {
13661
13754
  }
13662
13755
 
13663
13756
  // src/discovery/wrapperIndex.ts
13664
- import { Node as Node58 } from "ts-morph";
13757
+ import { Node as Node59 } from "ts-morph";
13665
13758
  import { joinMountedPath as joinMountedPath3 } from "@suss/resolution";
13666
13759
  var NO_WRAPPERS = {
13667
13760
  wrappersFor: () => [],
@@ -13785,11 +13878,11 @@ function discoverWrapperRegistrations(sourceFile, pattern, match, wraps, resolut
13785
13878
  const candidates = [];
13786
13879
  const unresolved = [];
13787
13880
  sourceFile.forEachDescendant((node) => {
13788
- if (!Node58.isCallExpression(node)) {
13881
+ if (!Node59.isCallExpression(node)) {
13789
13882
  return;
13790
13883
  }
13791
13884
  const callee = node.getExpression();
13792
- if (!Node58.isPropertyAccessExpression(callee) || callee.getName() !== wraps.method) {
13885
+ if (!Node59.isPropertyAccessExpression(callee) || callee.getName() !== wraps.method) {
13793
13886
  return;
13794
13887
  }
13795
13888
  const subjectNode = subjectNodeFor(
@@ -13884,7 +13977,7 @@ function discoverConstructorOptions(sourceFile, pattern, wraps, subjects, resolu
13884
13977
  return { candidates, unresolved };
13885
13978
  }
13886
13979
  function constructorOptionOf(construction, wraps, resolution) {
13887
- if (!(Node58.isNewExpression(construction) || Node58.isCallExpression(construction))) {
13980
+ if (!(Node59.isNewExpression(construction) || Node59.isCallExpression(construction))) {
13888
13981
  return void 0;
13889
13982
  }
13890
13983
  const optionsArg = construction.getArguments()[wraps.targetPosition];
@@ -13914,6 +14007,7 @@ function candidateOf(registration, pattern, sourceFile) {
13914
14007
  reference: {
13915
14008
  file: target.getSourceFile().getFilePath(),
13916
14009
  name: named2 ? functionNameOrAnon(target) : label,
14010
+ ...named2 ? {} : { line: target.getStartLineNumber() },
13917
14011
  ...onThrow ? { onThrow: true } : {},
13918
14012
  ...scope === void 0 ? {} : { scope }
13919
14013
  }
@@ -13922,37 +14016,6 @@ function candidateOf(registration, pattern, sourceFile) {
13922
14016
  function labelFor(targetArg, wraps) {
13923
14017
  return factoryNameOf(targetArg) ?? wraps.method;
13924
14018
  }
13925
- function factoryNameOf(targetArg) {
13926
- const written = factKeyOf(targetArg);
13927
- if (!Node58.isCallExpression(written)) {
13928
- return void 0;
13929
- }
13930
- const callee = written.getExpression();
13931
- if (Node58.isIdentifier(callee)) {
13932
- return callee.getText();
13933
- }
13934
- if (Node58.isPropertyAccessExpression(callee)) {
13935
- return callee.getName();
13936
- }
13937
- return void 0;
13938
- }
13939
- function factoryStopOf(targetArg) {
13940
- const written = factKeyOf(targetArg);
13941
- if (!Node58.isCallExpression(written)) {
13942
- return null;
13943
- }
13944
- const callee = factoryNameOf(targetArg);
13945
- if (callee === void 0) {
13946
- return null;
13947
- }
13948
- const reason = classifyStop(
13949
- declarationsBehind(written.getExpression().getSymbol())
13950
- );
13951
- if (!worthRecording(reason)) {
13952
- return null;
13953
- }
13954
- return { callee, reason: "unresolvedWrapper" };
13955
- }
13956
14019
  function mountedAt(subjectId, mountPrefixes, scope) {
13957
14020
  const prefix = mountPrefixes?.prefixForId?.(subjectId) ?? "";
13958
14021
  return joinMountedPath3(prefix, scope);
@@ -13969,7 +14032,7 @@ function scopeOf(args, wraps, resolution) {
13969
14032
  }
13970
14033
 
13971
14034
  // src/discoveryContext.ts
13972
- import { Node as Node59 } from "ts-morph";
14035
+ import { Node as Node60 } from "ts-morph";
13973
14036
  function createTsDiscoveryContext(resolution) {
13974
14037
  const store = resolution ?? new ResolutionStore();
13975
14038
  return {
@@ -14004,7 +14067,7 @@ function exportedFunctions(sourceFile, resolution) {
14004
14067
  return out;
14005
14068
  }
14006
14069
  function exportedFunction(decl, resolution) {
14007
- const writtenAgain = Node59.isVariableDeclaration(decl) && isWrittenAgain(decl);
14070
+ const writtenAgain = Node60.isVariableDeclaration(decl) && isWrittenAgain(decl);
14008
14071
  if (!writtenAgain) {
14009
14072
  const declared = resolveDeclarationToFunction(decl);
14010
14073
  if (declared !== null) {
@@ -14025,7 +14088,7 @@ function valueToAskAbout(decl, writtenAgain) {
14025
14088
  if (writtenAgain) {
14026
14089
  return decl;
14027
14090
  }
14028
- const value = Node59.isVariableDeclaration(decl) ? decl.getInitializer() ?? decl : decl;
14091
+ const value = Node60.isVariableDeclaration(decl) ? decl.getInitializer() ?? decl : decl;
14029
14092
  return couldStillNameAFunction(value) ? value : null;
14030
14093
  }
14031
14094
  function resolveDeclarationToFunction(decl) {
@@ -14033,18 +14096,18 @@ function resolveDeclarationToFunction(decl) {
14033
14096
  if (fn !== null) {
14034
14097
  return fn;
14035
14098
  }
14036
- if (Node59.isVariableDeclaration(decl)) {
14099
+ if (Node60.isVariableDeclaration(decl)) {
14037
14100
  const init = decl.getInitializer();
14038
- if (init !== void 0 && (Node59.isArrowFunction(init) || Node59.isFunctionExpression(init))) {
14101
+ if (init !== void 0 && (Node60.isArrowFunction(init) || Node60.isFunctionExpression(init))) {
14039
14102
  return init;
14040
14103
  }
14041
14104
  }
14042
14105
  return null;
14043
14106
  }
14044
14107
  function hasJsxReturn(func) {
14045
- if (Node59.isArrowFunction(func)) {
14108
+ if (Node60.isArrowFunction(func)) {
14046
14109
  const body2 = func.getBody();
14047
- if (Node59.isExpression(body2) && isJsxOrFragment(body2)) {
14110
+ if (Node60.isExpression(body2) && isJsxOrFragment(body2)) {
14048
14111
  return true;
14049
14112
  }
14050
14113
  }
@@ -14058,11 +14121,11 @@ function hasJsxReturn(func) {
14058
14121
  traversal.stop();
14059
14122
  return;
14060
14123
  }
14061
- if (node !== func && (Node59.isFunctionDeclaration(node) || Node59.isFunctionExpression(node) || Node59.isArrowFunction(node) || Node59.isMethodDeclaration(node))) {
14124
+ if (node !== func && (Node60.isFunctionDeclaration(node) || Node60.isFunctionExpression(node) || Node60.isArrowFunction(node) || Node60.isMethodDeclaration(node))) {
14062
14125
  traversal.skip();
14063
14126
  return;
14064
14127
  }
14065
- if (Node59.isReturnStatement(node)) {
14128
+ if (Node60.isReturnStatement(node)) {
14066
14129
  const expr = node.getExpression();
14067
14130
  if (expr !== void 0 && isJsxOrFragment(expr)) {
14068
14131
  found = true;
@@ -14073,7 +14136,7 @@ function hasJsxReturn(func) {
14073
14136
  }
14074
14137
  function isJsxOrFragment(node) {
14075
14138
  const current2 = peelParens(node);
14076
- return Node59.isJsxElement(current2) || Node59.isJsxSelfClosingElement(current2) || Node59.isJsxFragment(current2);
14139
+ return Node60.isJsxElement(current2) || Node60.isJsxSelfClosingElement(current2) || Node60.isJsxFragment(current2);
14077
14140
  }
14078
14141
 
14079
14142
  // src/graphqlContract.ts
@@ -14199,132 +14262,10 @@ function createReferenceIndex(sourceFiles) {
14199
14262
  };
14200
14263
  }
14201
14264
 
14202
- // src/resolve/boundaryEffects.ts
14203
- import { evaluate as evaluate3, lit as lit3, rule as rule3, variable } from "@suss/datalog";
14204
- var EFFECT_RULES = [
14205
- rule3(
14206
- "reachFrom",
14207
- [variable("e"), variable("e")],
14208
- [lit3("entry", variable("e"))]
14209
- ),
14210
- rule3(
14211
- "reachFrom",
14212
- [variable("e"), variable("v")],
14213
- [
14214
- lit3("reachFrom", variable("e"), variable("u")),
14215
- lit3("calls", variable("u"), variable("v"))
14216
- ]
14217
- ),
14218
- rule3(
14219
- "boundaryEffect",
14220
- [variable("e"), variable("kind"), variable("target")],
14221
- [
14222
- lit3("reachFrom", variable("e"), variable("u")),
14223
- lit3("unitEffect", variable("u"), variable("kind"), variable("target"))
14224
- ]
14225
- )
14226
- ];
14227
- function bindingLabel(binding) {
14228
- const semantics = binding.semantics;
14229
- if (semantics.name === "rest") {
14230
- return `${semantics.method} ${semantics.path}`;
14231
- }
14232
- if (semantics.name === "storage") {
14233
- return `${semantics.storageSystem}:${semantics.container}`;
14234
- }
14235
- if (semantics.name === "message-bus") {
14236
- return `${semantics.messageBus}:${semantics.channel}`;
14237
- }
14238
- if (semantics.name === "runtime-config") {
14239
- return semantics.instanceName;
14240
- }
14241
- if (semantics.name === "graphql-resolver") {
14242
- return `${semantics.typeName}.${semantics.fieldName}`;
14243
- }
14244
- if (semantics.name === "graphql-operation") {
14245
- return `${semantics.operationType} ${semantics.operationName ?? ""}`.trim();
14246
- }
14247
- if ("exportName" in semantics || "module" in semantics) {
14248
- return semantics.exportName ?? semantics.module ?? binding.recognition;
14249
- }
14250
- if ("instanceName" in semantics && semantics.instanceName !== null) {
14251
- return `${semantics.deploymentTarget}:${semantics.instanceName}`;
14252
- }
14253
- return binding.recognition;
14254
- }
14255
- function effectFact(effect) {
14256
- if (effect.type === "invocation") {
14257
- return { kind: "invocation", target: effect.callee };
14258
- }
14259
- if (effect.type === "mutation") {
14260
- return { kind: "mutation", target: `${effect.operation}:${effect.target}` };
14261
- }
14262
- if (effect.type === "emission") {
14263
- return { kind: "emission", target: effect.event };
14264
- }
14265
- if (effect.type === "stateChange") {
14266
- return { kind: "stateChange", target: effect.variable };
14267
- }
14268
- if (effect.type === "interaction") {
14269
- return { kind: "interaction", target: bindingLabel(effect.binding) };
14270
- }
14271
- return null;
14272
- }
14273
- function deriveBoundaryEffects(summaries, facts) {
14274
- const { db, unitKeyBySummary } = facts;
14275
- for (const summary of summaries) {
14276
- const key = unitKeyBySummary.get(summary);
14277
- if (key === void 0) {
14278
- continue;
14279
- }
14280
- for (const transition of summary.transitions) {
14281
- for (const effect of transition.effects) {
14282
- const fact2 = effectFact(effect);
14283
- if (fact2 !== null) {
14284
- db.add("unitEffect", [key, fact2.kind, fact2.target]);
14285
- }
14286
- }
14287
- }
14288
- }
14289
- evaluate3(db, EFFECT_RULES);
14290
- const ownByEntry = /* @__PURE__ */ new Map();
14291
- for (const [unit, kind, target] of db.facts("unitEffect")) {
14292
- const bucket = ownByEntry.get(String(unit)) ?? /* @__PURE__ */ new Set();
14293
- bucket.add(`${kind}\0${target}`);
14294
- ownByEntry.set(String(unit), bucket);
14295
- }
14296
- const closureByEntry = /* @__PURE__ */ new Map();
14297
- for (const [entry, kind, target] of db.facts("boundaryEffect")) {
14298
- const entryKey2 = String(entry);
14299
- const bucket = closureByEntry.get(entryKey2) ?? [];
14300
- bucket.push({
14301
- kind: String(kind),
14302
- target: String(target),
14303
- transitive: !(ownByEntry.get(entryKey2)?.has(`${kind}\0${target}`) ?? false)
14304
- });
14305
- closureByEntry.set(entryKey2, bucket);
14306
- }
14307
- for (const summary of summaries) {
14308
- const key = unitKeyBySummary.get(summary);
14309
- if (key === void 0 || !db.has("entry", [key])) {
14310
- continue;
14311
- }
14312
- const effects = closureByEntry.get(key);
14313
- if (effects === void 0 || effects.length === 0) {
14314
- continue;
14315
- }
14316
- const sorted = [...effects].sort(
14317
- (a, b) => `${a.kind}:${a.target}`.localeCompare(`${b.kind}:${b.target}`)
14318
- );
14319
- summary.metadata = { ...summary.metadata, effectsClosure: sorted };
14320
- }
14321
- return summaries;
14322
- }
14323
-
14324
14265
  // src/resolve/reachableClosure.ts
14325
- import { Node as Node60 } from "ts-morph";
14266
+ import { Node as Node61 } from "ts-morph";
14326
14267
  import { functionCallBinding, TargetPlacements } from "@suss/behavioral-ir";
14327
- import { Database as Database3, evaluate as evaluate4, lit as lit4, rule as rule4, variable as variable2 } from "@suss/datalog";
14268
+ import { Database as Database3, evaluate as evaluate3, lit as lit3, rule as rule3, variable } from "@suss/datalog";
14328
14269
  import { assembleSummary as assembleSummary2 } from "@suss/extractor";
14329
14270
  var GENERIC_TERMINALS = [
14330
14271
  { kind: "return", match: { type: "returnStatement" }, extraction: {} },
@@ -14355,7 +14296,7 @@ function targetOf(node) {
14355
14296
  };
14356
14297
  }
14357
14298
  function resolveCallee(call, calleeName, scan) {
14358
- if (!Node60.isCallExpression(call)) {
14299
+ if (!Node61.isCallExpression(call)) {
14359
14300
  return null;
14360
14301
  }
14361
14302
  const callee = call.getExpression();
@@ -14368,7 +14309,7 @@ function resolveCallee(call, calleeName, scan) {
14368
14309
  }
14369
14310
  }
14370
14311
  const resolveSources = scan.resolveCallableSources;
14371
- if (resolveSources !== void 0 && Node60.isPropertyAccessExpression(callee) && declarations.some(isDeclaredShape)) {
14312
+ if (resolveSources !== void 0 && Node61.isPropertyAccessExpression(callee) && declarations.some(isDeclaredShape)) {
14372
14313
  const sources = resolveSources(callee, scan.reachedFrom);
14373
14314
  const only = sources.length === 1 ? sources[0] : void 0;
14374
14315
  const resolved = only === void 0 ? null : resolveDecl(only, calleeName);
@@ -14414,11 +14355,11 @@ function passedPositionKey(target, position) {
14414
14355
  return `${offsetKeyFor(target.file, target.span)}#${position}`;
14415
14356
  }
14416
14357
  function resolveJsxReference(node, scan) {
14417
- if (!Node60.isJsxOpeningElement(node) && !Node60.isJsxSelfClosingElement(node)) {
14358
+ if (!Node61.isJsxOpeningElement(node) && !Node61.isJsxSelfClosingElement(node)) {
14418
14359
  return null;
14419
14360
  }
14420
14361
  const tag = node.getTagNameNode();
14421
- if (!Node60.isIdentifier(tag) || !/^[A-Z]/.test(tag.getText())) {
14362
+ if (!Node61.isIdentifier(tag) || !/^[A-Z]/.test(tag.getText())) {
14422
14363
  return null;
14423
14364
  }
14424
14365
  const name = tag.getText();
@@ -14464,12 +14405,12 @@ function collectReachable(func, scan) {
14464
14405
  candidates.push(outcome.candidate);
14465
14406
  };
14466
14407
  const recordPassedArgs = (call, calleeText, calleeOutcome) => {
14467
- if (!Node60.isCallExpression(call)) {
14408
+ if (!Node61.isCallExpression(call)) {
14468
14409
  return;
14469
14410
  }
14470
14411
  const calleeTarget = declaredAtOf(calleeOutcome);
14471
14412
  call.getArguments().forEach((arg, position) => {
14472
- if (!Node60.isIdentifier(arg)) {
14413
+ if (!Node61.isIdentifier(arg)) {
14473
14414
  return;
14474
14415
  }
14475
14416
  const resolved = functionTargetOf(arg);
@@ -14489,7 +14430,7 @@ function collectReachable(func, scan) {
14489
14430
  record2(jsx.outcome);
14490
14431
  return;
14491
14432
  }
14492
- if (!Node60.isCallExpression(node)) {
14433
+ if (!Node61.isCallExpression(node)) {
14493
14434
  return;
14494
14435
  }
14495
14436
  const calleeText = normalizeCallee(node.getExpression().getText());
@@ -14541,13 +14482,13 @@ function extractReachableSummary(candidate, options, recognizers) {
14541
14482
  return assembleSummary2(raw, options);
14542
14483
  }
14543
14484
  var REACHABLE_RULES = [
14544
- rule4("reachable", [variable2("f")], [lit4("entry", variable2("f"))]),
14545
- rule4(
14485
+ rule3("reachable", [variable("f")], [lit3("entry", variable("f"))]),
14486
+ rule3(
14546
14487
  "reachable",
14547
- [variable2("g")],
14488
+ [variable("g")],
14548
14489
  [
14549
- lit4("reachable", variable2("f")),
14550
- lit4("calls", variable2("f"), variable2("g"))
14490
+ lit3("reachable", variable("f")),
14491
+ lit3("calls", variable("f"), variable("g"))
14551
14492
  ]
14552
14493
  )
14553
14494
  ];
@@ -14575,7 +14516,7 @@ function recognizerOnlyRoots(packsByFile) {
14575
14516
  }
14576
14517
  for (const declaration of variableStatement.getDeclarations()) {
14577
14518
  const init = declaration.getInitializer();
14578
- if (init !== void 0 && (Node60.isArrowFunction(init) || Node60.isFunctionExpression(init)) && hasBody(init)) {
14519
+ if (init !== void 0 && (Node61.isArrowFunction(init) || Node61.isFunctionExpression(init)) && hasBody(init)) {
14579
14520
  roots.push({ func: init, name: declaration.getName() });
14580
14521
  }
14581
14522
  }
@@ -14624,7 +14565,7 @@ function expandReachableClosure(seeds, project, options, projectFileSet, facts,
14624
14565
  }
14625
14566
  }
14626
14567
  for (; ; ) {
14627
- evaluate4(db, REACHABLE_RULES);
14568
+ evaluate3(db, REACHABLE_RULES);
14628
14569
  const frontier = db.facts("reachable").map(([key]) => String(key)).filter((key) => !scanned.has(key));
14629
14570
  if (frontier.length === 0) {
14630
14571
  break;
@@ -14829,21 +14770,21 @@ function recordParameterGaps(parameterCallsByKey, summariesByKey, passedPosition
14829
14770
  }
14830
14771
 
14831
14772
  // src/resolve/rethrowEnrichment.ts
14832
- import { Node as Node61 } from "ts-morph";
14833
- import { Database as Database4, evaluate as evaluate5, lit as lit5, rule as rule5, variable as variable3 } from "@suss/datalog";
14773
+ import { Node as Node62 } from "ts-morph";
14774
+ import { Database as Database4, evaluate as evaluate4, lit as lit4, rule as rule4, variable as variable2 } from "@suss/datalog";
14834
14775
  var RETHROW_RULES = [
14835
- rule5(
14776
+ rule4(
14836
14777
  "contributes",
14837
- [variable3("u"), variable3("s")],
14838
- [lit5("throwsDirect", variable3("u"), variable3("s"))]
14778
+ [variable2("u"), variable2("s")],
14779
+ [lit4("throwsDirect", variable2("u"), variable2("s"))]
14839
14780
  ),
14840
- rule5(
14781
+ rule4(
14841
14782
  "contributes",
14842
- [variable3("u"), variable3("s")],
14783
+ [variable2("u"), variable2("s")],
14843
14784
  [
14844
- lit5("rethrowSite", variable3("u"), variable3("site")),
14845
- lit5("siteCalls", variable3("site"), variable3("c")),
14846
- lit5("contributes", variable3("c"), variable3("s"))
14785
+ lit4("rethrowSite", variable2("u"), variable2("site")),
14786
+ lit4("siteCalls", variable2("site"), variable2("c")),
14787
+ lit4("contributes", variable2("c"), variable2("s"))
14847
14788
  ]
14848
14789
  )
14849
14790
  ];
@@ -14905,7 +14846,7 @@ function enrichRethrows(summaries, project, facts) {
14905
14846
  }
14906
14847
  }
14907
14848
  }
14908
- evaluate5(db, RETHROW_RULES);
14849
+ evaluate4(db, RETHROW_RULES);
14909
14850
  const contributesByUnit = /* @__PURE__ */ new Map();
14910
14851
  for (const [unit, sourceId] of db.facts("contributes")) {
14911
14852
  const bucket = contributesByUnit.get(String(unit));
@@ -14966,7 +14907,7 @@ function findBareRethrow(func, location) {
14966
14907
  traversal.stop();
14967
14908
  return;
14968
14909
  }
14969
- if (!Node61.isThrowStatement(node)) {
14910
+ if (!Node62.isThrowStatement(node)) {
14970
14911
  return;
14971
14912
  }
14972
14913
  if (startLineOf(node) !== location.start) {
@@ -14976,7 +14917,7 @@ function findBareRethrow(func, location) {
14976
14917
  return;
14977
14918
  }
14978
14919
  const thrown = node.getExpression();
14979
- if (thrown !== void 0 && Node61.isIdentifier(thrown)) {
14920
+ if (thrown !== void 0 && Node62.isIdentifier(thrown)) {
14980
14921
  found = node;
14981
14922
  }
14982
14923
  });
@@ -14986,13 +14927,13 @@ function enclosingTry(throwStmt) {
14986
14927
  let current2 = throwStmt.getParent();
14987
14928
  let sawCatchClause = false;
14988
14929
  while (current2 !== void 0) {
14989
- if (Node61.isCatchClause(current2)) {
14930
+ if (Node62.isCatchClause(current2)) {
14990
14931
  sawCatchClause = true;
14991
14932
  }
14992
- if (Node61.isTryStatement(current2)) {
14933
+ if (Node62.isTryStatement(current2)) {
14993
14934
  return sawCatchClause ? current2 : null;
14994
14935
  }
14995
- if (Node61.isFunctionDeclaration(current2) || Node61.isFunctionExpression(current2) || Node61.isArrowFunction(current2) || Node61.isMethodDeclaration(current2)) {
14936
+ if (Node62.isFunctionDeclaration(current2) || Node62.isFunctionExpression(current2) || Node62.isArrowFunction(current2) || Node62.isMethodDeclaration(current2)) {
14996
14937
  return null;
14997
14938
  }
14998
14939
  current2 = current2.getParent();
@@ -15000,14 +14941,14 @@ function enclosingTry(throwStmt) {
15000
14941
  return null;
15001
14942
  }
15002
14943
  function collectTryBodyCallees(tryStmt, index, keyFor) {
15003
- if (!Node61.isTryStatement(tryStmt)) {
14944
+ if (!Node62.isTryStatement(tryStmt)) {
15004
14945
  return [];
15005
14946
  }
15006
14947
  const tryBlock = tryStmt.getTryBlock();
15007
14948
  const callees = [];
15008
14949
  const seen = /* @__PURE__ */ new Set();
15009
14950
  tryBlock.forEachDescendant((node) => {
15010
- if (!Node61.isCallExpression(node)) {
14951
+ if (!Node62.isCallExpression(node)) {
15011
14952
  return;
15012
14953
  }
15013
14954
  const calleeSummary = resolveCalleeSummary(node, index);
@@ -15024,7 +14965,7 @@ function collectTryBodyCallees(tryStmt, index, keyFor) {
15024
14965
  return callees;
15025
14966
  }
15026
14967
  function resolveCalleeSummary(call, index) {
15027
- if (!Node61.isCallExpression(call)) {
14968
+ if (!Node62.isCallExpression(call)) {
15028
14969
  return null;
15029
14970
  }
15030
14971
  const callee = call.getExpression();
@@ -15054,12 +14995,12 @@ function resolveCalleeSummary(call, index) {
15054
14995
  return null;
15055
14996
  }
15056
14997
  function functionFromDecl(decl) {
15057
- if (Node61.isFunctionDeclaration(decl) || Node61.isFunctionExpression(decl) || Node61.isArrowFunction(decl) || Node61.isMethodDeclaration(decl)) {
14998
+ if (Node62.isFunctionDeclaration(decl) || Node62.isFunctionExpression(decl) || Node62.isArrowFunction(decl) || Node62.isMethodDeclaration(decl)) {
15058
14999
  return decl;
15059
15000
  }
15060
- if (Node61.isVariableDeclaration(decl)) {
15001
+ if (Node62.isVariableDeclaration(decl)) {
15061
15002
  const init = decl.getInitializer();
15062
- if (init !== void 0 && (Node61.isArrowFunction(init) || Node61.isFunctionExpression(init))) {
15003
+ if (init !== void 0 && (Node62.isArrowFunction(init) || Node62.isFunctionExpression(init))) {
15063
15004
  return init;
15064
15005
  }
15065
15006
  }
@@ -15068,23 +15009,23 @@ function functionFromDecl(decl) {
15068
15009
 
15069
15010
  // src/shapes/fieldAccesses.ts
15070
15011
  import {
15071
- Node as Node62
15012
+ Node as Node63
15072
15013
  } from "ts-morph";
15073
15014
  function findResponseAccessor(callExpr) {
15074
15015
  let current2 = callExpr;
15075
15016
  const parent1 = current2.getParent();
15076
- if (parent1 !== void 0 && Node62.isAwaitExpression(parent1)) {
15017
+ if (parent1 !== void 0 && Node63.isAwaitExpression(parent1)) {
15077
15018
  current2 = parent1;
15078
15019
  }
15079
15020
  const parent2 = current2.getParent();
15080
- if (parent2 === void 0 || !Node62.isVariableDeclaration(parent2)) {
15021
+ if (parent2 === void 0 || !Node63.isVariableDeclaration(parent2)) {
15081
15022
  return null;
15082
15023
  }
15083
15024
  const nameNode = parent2.getNameNode();
15084
- if (Node62.isIdentifier(nameNode)) {
15025
+ if (Node63.isIdentifier(nameNode)) {
15085
15026
  return { kind: "identifier", name: nameNode.getText() };
15086
15027
  }
15087
- if (Node62.isObjectBindingPattern(nameNode)) {
15028
+ if (Node63.isObjectBindingPattern(nameNode)) {
15088
15029
  const bindings = /* @__PURE__ */ new Map();
15089
15030
  for (const element of nameNode.getElements()) {
15090
15031
  if (element.getDotDotDotToken() !== void 0) {
@@ -15105,11 +15046,11 @@ function findResponseAccessor(callExpr) {
15105
15046
  function buildThenChainAccessor(callExpr, func) {
15106
15047
  const bindings = /* @__PURE__ */ new Map();
15107
15048
  func.forEachDescendant((node) => {
15108
- if (!Node62.isParameterDeclaration(node)) {
15049
+ if (!Node63.isParameterDeclaration(node)) {
15109
15050
  return;
15110
15051
  }
15111
15052
  const nameNode = node.getNameNode();
15112
- if (!Node62.isIdentifier(nameNode)) {
15053
+ if (!Node63.isIdentifier(nameNode)) {
15113
15054
  return;
15114
15055
  }
15115
15056
  const prefix = prefixOfThenParam(node, callExpr, 0);
@@ -15141,7 +15082,7 @@ function prefixOfExpr(expr, responseCall, depth) {
15141
15082
  if (node === responseCall) {
15142
15083
  return [];
15143
15084
  }
15144
- if (Node62.isCallExpression(node)) {
15085
+ if (Node63.isCallExpression(node)) {
15145
15086
  const hop = thenLikeCall(node);
15146
15087
  if (hop !== null) {
15147
15088
  if (hop.method === "catch") {
@@ -15173,14 +15114,14 @@ function prefixOfMemberExpr(expr, responseCall, depth) {
15173
15114
  return null;
15174
15115
  }
15175
15116
  const decl = chain.root.getSymbol()?.getDeclarations()?.[0];
15176
- if (decl === void 0 || !Node62.isParameterDeclaration(decl)) {
15117
+ if (decl === void 0 || !Node63.isParameterDeclaration(decl)) {
15177
15118
  return null;
15178
15119
  }
15179
15120
  const base = prefixOfThenParam(decl, responseCall, depth + 1);
15180
15121
  return base === null ? null : [...base, ...chain.segments];
15181
15122
  }
15182
15123
  function firstCallbackParamName(callback) {
15183
- if (callback === void 0 || !(Node62.isArrowFunction(callback) || Node62.isFunctionExpression(callback))) {
15124
+ if (callback === void 0 || !(Node63.isArrowFunction(callback) || Node63.isFunctionExpression(callback))) {
15184
15125
  return null;
15185
15126
  }
15186
15127
  const param = callback.getParameters()[0];
@@ -15188,11 +15129,11 @@ function firstCallbackParamName(callback) {
15188
15129
  return null;
15189
15130
  }
15190
15131
  const nameNode = param.getNameNode();
15191
- return Node62.isIdentifier(nameNode) ? nameNode.getText() : null;
15132
+ return Node63.isIdentifier(nameNode) ? nameNode.getText() : null;
15192
15133
  }
15193
15134
  function unwrap(expr) {
15194
15135
  let node = expr;
15195
- while (Node62.isAwaitExpression(node) || Node62.isParenthesizedExpression(node) || Node62.isAsExpression(node)) {
15136
+ while (Node63.isAwaitExpression(node) || Node63.isParenthesizedExpression(node) || Node63.isAsExpression(node)) {
15196
15137
  node = node.getExpression();
15197
15138
  }
15198
15139
  return node;
@@ -15202,15 +15143,15 @@ function chainRootedAt(expr, rootName) {
15202
15143
  if (chain === null) {
15203
15144
  return null;
15204
15145
  }
15205
- return Node62.isIdentifier(chain.root) && chain.root.getText() === rootName ? chain.segments : null;
15146
+ return Node63.isIdentifier(chain.root) && chain.root.getText() === rootName ? chain.segments : null;
15206
15147
  }
15207
15148
  function memberChain(expr) {
15208
- let node = Node62.isExpression(expr) ? unwrap(expr) : expr;
15209
- if (Node62.isCallExpression(node)) {
15149
+ let node = Node63.isExpression(expr) ? unwrap(expr) : expr;
15150
+ if (Node63.isCallExpression(node)) {
15210
15151
  node = node.getExpression();
15211
15152
  }
15212
15153
  const segments = [];
15213
- while (Node62.isPropertyAccessExpression(node)) {
15154
+ while (Node63.isPropertyAccessExpression(node)) {
15214
15155
  segments.unshift(node.getName());
15215
15156
  node = node.getExpression();
15216
15157
  }
@@ -15229,16 +15170,16 @@ function collectPropertyAccesses(subtree, accessor) {
15229
15170
  if (accessor.kind === "identifier") {
15230
15171
  const varName = accessor.name;
15231
15172
  subtree.forEachDescendant((node) => {
15232
- if (!Node62.isPropertyAccessExpression(node)) {
15173
+ if (!Node63.isPropertyAccessExpression(node)) {
15233
15174
  return;
15234
15175
  }
15235
15176
  const chain = [];
15236
15177
  let current2 = node;
15237
- while (Node62.isPropertyAccessExpression(current2)) {
15178
+ while (Node63.isPropertyAccessExpression(current2)) {
15238
15179
  chain.unshift(current2.getName());
15239
15180
  current2 = current2.getExpression();
15240
15181
  }
15241
- if (Node62.isIdentifier(current2) && current2.getText() === varName) {
15182
+ if (Node63.isIdentifier(current2) && current2.getText() === varName) {
15242
15183
  pushChain(chain);
15243
15184
  }
15244
15185
  });
@@ -15249,7 +15190,7 @@ function collectPropertyAccesses(subtree, accessor) {
15249
15190
  return source === void 0 ? void 0 : [source];
15250
15191
  } : (name) => accessor.bindings.get(name);
15251
15192
  subtree.forEachDescendant((node) => {
15252
- if (!Node62.isIdentifier(node)) {
15193
+ if (!Node63.isIdentifier(node)) {
15253
15194
  return;
15254
15195
  }
15255
15196
  const prefix = prefixOf(node.getText());
@@ -15261,13 +15202,13 @@ function collectPropertyAccesses(subtree, accessor) {
15261
15202
  }
15262
15203
  let chainTop = node;
15263
15204
  let parent = chainTop.getParent();
15264
- while (parent !== void 0 && Node62.isPropertyAccessExpression(parent) && parent.getExpression() === chainTop) {
15205
+ while (parent !== void 0 && Node63.isPropertyAccessExpression(parent) && parent.getExpression() === chainTop) {
15265
15206
  chainTop = parent;
15266
15207
  parent = chainTop.getParent();
15267
15208
  }
15268
15209
  const segments = [];
15269
15210
  let current2 = chainTop;
15270
- while (Node62.isPropertyAccessExpression(current2)) {
15211
+ while (Node63.isPropertyAccessExpression(current2)) {
15271
15212
  segments.push(current2.getName());
15272
15213
  current2 = current2.getExpression();
15273
15214
  }
@@ -15281,15 +15222,15 @@ function isBindingDeclarationSite(node) {
15281
15222
  return true;
15282
15223
  }
15283
15224
  const parent = node.getParent();
15284
- return parent !== void 0 && Node62.isParameterDeclaration(parent) && parent.getNameNode() === node;
15225
+ return parent !== void 0 && Node63.isParameterDeclaration(parent) && parent.getNameNode() === node;
15285
15226
  }
15286
15227
  function isInsideObjectBindingPattern(node) {
15287
15228
  let current2 = node.getParent();
15288
15229
  while (current2 !== void 0) {
15289
- if (Node62.isObjectBindingPattern(current2)) {
15230
+ if (Node63.isObjectBindingPattern(current2)) {
15290
15231
  return true;
15291
15232
  }
15292
- if (Node62.isFunctionLikeDeclaration(current2) || Node62.isVariableStatement(current2)) {
15233
+ if (Node63.isFunctionLikeDeclaration(current2) || Node63.isVariableStatement(current2)) {
15293
15234
  break;
15294
15235
  }
15295
15236
  current2 = current2.getParent();
@@ -15352,7 +15293,7 @@ function findBranchSubtree(func, byLineRange, terminalStartLine, terminalEndLine
15352
15293
  if (parent === void 0) {
15353
15294
  break;
15354
15295
  }
15355
- if (Node62.isIfStatement(parent)) {
15296
+ if (Node63.isIfStatement(parent)) {
15356
15297
  const ifStmt = parent;
15357
15298
  const thenBlock = ifStmt.getThenStatement();
15358
15299
  const elseBlock = ifStmt.getElseStatement();
@@ -15415,7 +15356,7 @@ function buildNonBodyPropertySet(semantics) {
15415
15356
 
15416
15357
  // src/subUnitContext.ts
15417
15358
  import {
15418
- Node as Node63
15359
+ Node as Node64
15419
15360
  } from "ts-morph";
15420
15361
  function createTsSubUnitContext() {
15421
15362
  return {
@@ -15443,18 +15384,18 @@ function findJsxAttributes(parent) {
15443
15384
  if (skip(node, traversal)) {
15444
15385
  return;
15445
15386
  }
15446
- if (!Node63.isJsxOpeningElement(node) && !Node63.isJsxSelfClosingElement(node)) {
15387
+ if (!Node64.isJsxOpeningElement(node) && !Node64.isJsxSelfClosingElement(node)) {
15447
15388
  return;
15448
15389
  }
15449
15390
  const tag = node.getTagNameNode().getText();
15450
15391
  for (const attr of node.getAttributes()) {
15451
- if (!Node63.isJsxAttribute(attr)) {
15392
+ if (!Node64.isJsxAttribute(attr)) {
15452
15393
  continue;
15453
15394
  }
15454
15395
  const initializer = attr.getInitializer();
15455
15396
  let valueExpression = null;
15456
15397
  if (initializer !== void 0) {
15457
- if (Node63.isJsxExpression(initializer)) {
15398
+ if (Node64.isJsxExpression(initializer)) {
15458
15399
  const inner = initializer.getExpression();
15459
15400
  valueExpression = inner ?? null;
15460
15401
  } else {
@@ -15477,11 +15418,11 @@ function findCallExpressionsByName(parent, name) {
15477
15418
  if (skip(node, traversal)) {
15478
15419
  return;
15479
15420
  }
15480
- if (!Node63.isCallExpression(node)) {
15421
+ if (!Node64.isCallExpression(node)) {
15481
15422
  return;
15482
15423
  }
15483
15424
  const callee = node.getExpression();
15484
- if (Node63.isIdentifier(callee) && callee.getText() === name) {
15425
+ if (Node64.isIdentifier(callee) && callee.getText() === name) {
15485
15426
  out.push(node);
15486
15427
  }
15487
15428
  });
@@ -15492,10 +15433,10 @@ function resolveAttributeValueFunction(attr, parent) {
15492
15433
  if (expr === null) {
15493
15434
  return null;
15494
15435
  }
15495
- if (Node63.isArrowFunction(expr) || Node63.isFunctionExpression(expr)) {
15436
+ if (Node64.isArrowFunction(expr) || Node64.isFunctionExpression(expr)) {
15496
15437
  return { func: expr, localName: null };
15497
15438
  }
15498
- if (Node63.isIdentifier(expr)) {
15439
+ if (Node64.isIdentifier(expr)) {
15499
15440
  const symbol = expr.getSymbol();
15500
15441
  if (symbol === void 0) {
15501
15442
  return null;
@@ -15514,15 +15455,15 @@ function resolveAttributeValueFunction(attr, parent) {
15514
15455
  return null;
15515
15456
  }
15516
15457
  function tryExtractFunction(decl) {
15517
- if (Node63.isFunctionDeclaration(decl)) {
15458
+ if (Node64.isFunctionDeclaration(decl)) {
15518
15459
  return decl;
15519
15460
  }
15520
- if (Node63.isVariableDeclaration(decl)) {
15461
+ if (Node64.isVariableDeclaration(decl)) {
15521
15462
  const init = decl.getInitializer();
15522
15463
  if (init === void 0) {
15523
15464
  return null;
15524
15465
  }
15525
- if (Node63.isArrowFunction(init) || Node63.isFunctionExpression(init)) {
15466
+ if (Node64.isArrowFunction(init) || Node64.isFunctionExpression(init)) {
15526
15467
  return init;
15527
15468
  }
15528
15469
  }
@@ -15543,7 +15484,7 @@ function getCallArgumentFunction(call, position) {
15543
15484
  if (arg === void 0) {
15544
15485
  return null;
15545
15486
  }
15546
- if (Node63.isArrowFunction(arg) || Node63.isFunctionExpression(arg)) {
15487
+ if (Node64.isArrowFunction(arg) || Node64.isFunctionExpression(arg)) {
15547
15488
  return arg;
15548
15489
  }
15549
15490
  return null;
@@ -15555,7 +15496,7 @@ function readArrayLiteralText(node) {
15555
15496
  if (node === null) {
15556
15497
  return null;
15557
15498
  }
15558
- if (Node63.isArrayLiteralExpression(node)) {
15499
+ if (Node64.isArrayLiteralExpression(node)) {
15559
15500
  return node.getElements().map((e) => e.getText());
15560
15501
  }
15561
15502
  return [node.getText()];
@@ -15811,13 +15752,13 @@ var raise = (msg) => {
15811
15752
  throw new Error(msg);
15812
15753
  };
15813
15754
  function bindingPatternNames(nameNode) {
15814
- if (Node64.isObjectBindingPattern(nameNode)) {
15755
+ if (Node65.isObjectBindingPattern(nameNode)) {
15815
15756
  return nameNode.getElements().map((e) => e.getName());
15816
15757
  }
15817
- if (Node64.isArrayBindingPattern(nameNode)) {
15758
+ if (Node65.isArrayBindingPattern(nameNode)) {
15818
15759
  const names = [];
15819
15760
  for (const element of nameNode.getElements()) {
15820
- if (Node64.isOmittedExpression(element)) {
15761
+ if (Node65.isOmittedExpression(element)) {
15821
15762
  continue;
15822
15763
  }
15823
15764
  names.push(element.getName());
@@ -15847,7 +15788,7 @@ function objectParamInputs(param, position, mapping) {
15847
15788
  }
15848
15789
  function componentPropsParameters(param, mapping) {
15849
15790
  const nameNode = param.getNameNode();
15850
- if (!Node64.isObjectBindingPattern(nameNode)) {
15791
+ if (!Node65.isObjectBindingPattern(nameNode)) {
15851
15792
  const type = param.getType();
15852
15793
  return [
15853
15794
  {
@@ -15877,7 +15818,7 @@ function bindingRole(element, name) {
15877
15818
  if (property === void 0) {
15878
15819
  return name;
15879
15820
  }
15880
- if (Node64.isStringLiteral(property)) {
15821
+ if (Node65.isStringLiteral(property)) {
15881
15822
  return property.getLiteralValue();
15882
15823
  }
15883
15824
  return property.getText();
@@ -15909,7 +15850,7 @@ function extractParameters(func, inputMapping) {
15909
15850
  const param = params[i];
15910
15851
  const nameNode = param.getNameNode();
15911
15852
  const boundNames = bindingPatternNames(nameNode);
15912
- if (Node64.isObjectBindingPattern(nameNode)) {
15853
+ if (Node65.isObjectBindingPattern(nameNode)) {
15913
15854
  for (const element of nameNode.getElements()) {
15914
15855
  result.push({
15915
15856
  name: element.getName(),
@@ -15976,7 +15917,7 @@ function extractDependencyCalls(func, barriers = NO_BARRIERS) {
15976
15917
  traversal.skip();
15977
15918
  return;
15978
15919
  }
15979
- if (!Node64.isVariableDeclaration(node)) {
15920
+ if (!Node65.isVariableDeclaration(node)) {
15980
15921
  return;
15981
15922
  }
15982
15923
  const init = node.getInitializer();
@@ -15985,19 +15926,19 @@ function extractDependencyCalls(func, barriers = NO_BARRIERS) {
15985
15926
  }
15986
15927
  let isAsync = false;
15987
15928
  let callExpr = init;
15988
- if (Node64.isAwaitExpression(init)) {
15929
+ if (Node65.isAwaitExpression(init)) {
15989
15930
  isAsync = true;
15990
15931
  callExpr = init.getExpression();
15991
15932
  }
15992
- if (!Node64.isCallExpression(callExpr)) {
15933
+ if (!Node65.isCallExpression(callExpr)) {
15993
15934
  return;
15994
15935
  }
15995
15936
  const calleeName = callExpr.getExpression().getText();
15996
15937
  const nameNode = node.getNameNode();
15997
- const assignedTo = Node64.isIdentifier(nameNode) ? nameNode.getText() : null;
15938
+ const assignedTo = Node65.isIdentifier(nameNode) ? nameNode.getText() : null;
15998
15939
  const declList = node.getParent();
15999
15940
  const varStmt = declList?.getParent();
16000
- const locationNode = varStmt !== void 0 && Node64.isVariableStatement(varStmt) ? varStmt : node;
15941
+ const locationNode = varStmt !== void 0 && Node65.isVariableStatement(varStmt) ? varStmt : node;
16001
15942
  results.push({
16002
15943
  name: calleeName,
16003
15944
  assignedTo,
@@ -16356,6 +16297,10 @@ function extractBindingPath(binding, callSite, pack, resolution) {
16356
16297
  const arg = callSite.callExpression.getArguments()[p.position];
16357
16298
  return arg === void 0 ? void 0 : pathFromArgument(arg, resolution);
16358
16299
  }
16300
+ if (p.type === "fromArgumentProperty") {
16301
+ const arg = callSite.callExpression.getArguments()[p.position];
16302
+ return arg === void 0 ? void 0 : pathFromProperty(arg, p.property, resolution);
16303
+ }
16359
16304
  return void 0;
16360
16305
  }
16361
16306
  function resolveContractField(callSite, pack, field, resolution) {
@@ -16751,20 +16696,23 @@ function extractFromSourceFile(sourceFile, frameworks, claimedUnits, options, ta
16751
16696
  return summaries;
16752
16697
  }
16753
16698
  function stampWrappers(raw, unit, wrappers) {
16754
- if (wrappers === void 0 || unit.registrationSubjectId === void 0) {
16755
- return;
16756
- }
16757
- const applied = wrappers.wrappersFor(unit.registrationSubjectId);
16699
+ const applied = [
16700
+ ...wrappers === void 0 || unit.registrationSubjectId === void 0 ? [] : wrappers.wrappersFor(unit.registrationSubjectId),
16701
+ ...unit.routeWrappers ?? []
16702
+ ];
16758
16703
  if (applied.length === 0) {
16759
16704
  return;
16760
16705
  }
16761
- raw.wrappers = [...applied];
16706
+ raw.wrappers = applied;
16762
16707
  for (const wrapper of applied) {
16763
16708
  recordFileDependency(wrapper.file);
16764
16709
  }
16765
16710
  }
16766
16711
  function unfollowedStopsOf(unit, wrappers) {
16767
- const stops = unit.unfollowed === void 0 ? [] : [unit.unfollowed];
16712
+ const stops = [
16713
+ ...unit.unfollowed === void 0 ? [] : [unit.unfollowed],
16714
+ ...unit.routeUnfollowed ?? []
16715
+ ];
16768
16716
  if (wrappers === void 0 || unit.registrationSubjectId === void 0) {
16769
16717
  return stops;
16770
16718
  }
@@ -16913,7 +16861,7 @@ function findWrapperPathParam(summary, lookup) {
16913
16861
  }
16914
16862
  for (const call of func.getDescendantsOfKind(SyntaxKind12.CallExpression)) {
16915
16863
  const first = call.getArguments()[0];
16916
- if (first === void 0 || !Node64.isIdentifier(first)) {
16864
+ if (first === void 0 || !Node65.isIdentifier(first)) {
16917
16865
  continue;
16918
16866
  }
16919
16867
  const at = names.indexOf(first.getText());
@@ -16962,16 +16910,16 @@ function synthesizeCallerSummaries(wrapper, _project, options, resolution) {
16962
16910
  return out;
16963
16911
  }
16964
16912
  function wrapperNameNode(func) {
16965
- if (Node64.isFunctionDeclaration(func) || Node64.isMethodDeclaration(func)) {
16913
+ if (Node65.isFunctionDeclaration(func) || Node65.isMethodDeclaration(func)) {
16966
16914
  const name = func.getNameNode();
16967
- if (name !== void 0 && Node64.isIdentifier(name)) {
16915
+ if (name !== void 0 && Node65.isIdentifier(name)) {
16968
16916
  return name;
16969
16917
  }
16970
16918
  }
16971
16919
  const parent = func.getParent();
16972
- if (parent !== void 0 && Node64.isVariableDeclaration(parent)) {
16920
+ if (parent !== void 0 && Node65.isVariableDeclaration(parent)) {
16973
16921
  const nameNode = parent.getNameNode();
16974
- if (Node64.isIdentifier(nameNode)) {
16922
+ if (Node65.isIdentifier(nameNode)) {
16975
16923
  return nameNode;
16976
16924
  }
16977
16925
  }
@@ -16980,10 +16928,10 @@ function wrapperNameNode(func) {
16980
16928
  function enclosingCall(node) {
16981
16929
  let current2 = node.getParent();
16982
16930
  while (current2 !== void 0) {
16983
- if (Node64.isCallExpression(current2)) {
16931
+ if (Node65.isCallExpression(current2)) {
16984
16932
  return current2;
16985
16933
  }
16986
- if (Node64.isPropertyAccessExpression(current2)) {
16934
+ if (Node65.isPropertyAccessExpression(current2)) {
16987
16935
  current2 = current2.getParent();
16988
16936
  continue;
16989
16937
  }
@@ -16994,7 +16942,7 @@ function enclosingCall(node) {
16994
16942
  function enclosingFunction(node) {
16995
16943
  let current2 = node.getParent();
16996
16944
  while (current2 !== void 0) {
16997
- if (Node64.isFunctionDeclaration(current2) || Node64.isFunctionExpression(current2) || Node64.isArrowFunction(current2) || Node64.isMethodDeclaration(current2)) {
16945
+ if (Node65.isFunctionDeclaration(current2) || Node65.isFunctionExpression(current2) || Node65.isArrowFunction(current2) || Node65.isMethodDeclaration(current2)) {
16998
16946
  return current2;
16999
16947
  }
17000
16948
  current2 = current2.getParent();
@@ -17002,13 +16950,13 @@ function enclosingFunction(node) {
17002
16950
  return null;
17003
16951
  }
17004
16952
  function callerName(func) {
17005
- if (Node64.isFunctionDeclaration(func) || Node64.isMethodDeclaration(func)) {
16953
+ if (Node65.isFunctionDeclaration(func) || Node65.isMethodDeclaration(func)) {
17006
16954
  return func.getName() ?? "anonymous";
17007
16955
  }
17008
16956
  const parent = func.getParent();
17009
- if (parent !== void 0 && Node64.isVariableDeclaration(parent)) {
16957
+ if (parent !== void 0 && Node65.isVariableDeclaration(parent)) {
17010
16958
  const nameNode = parent.getNameNode();
17011
- if (Node64.isIdentifier(nameNode)) {
16959
+ if (Node65.isIdentifier(nameNode)) {
17012
16960
  return nameNode.getText();
17013
16961
  }
17014
16962
  }
@@ -17154,7 +17102,11 @@ function createTypeScriptAdapter(suppliedConfig) {
17154
17102
  )
17155
17103
  );
17156
17104
  }
17157
- return named(summaries, config.workspace, runRoot);
17105
+ return named(
17106
+ composeWrappers(summaries, config.extractorOptions ?? {}),
17107
+ config.workspace,
17108
+ runRoot
17109
+ );
17158
17110
  },
17159
17111
  async extractAll() {
17160
17112
  const timer = createTimer();
@@ -17414,12 +17366,6 @@ function createTypeScriptAdapter(suppliedConfig) {
17414
17366
  "enrichRethrows",
17415
17367
  () => enrichRethrows(merged.summaries, project, closureFacts)
17416
17368
  );
17417
- if (config.includeReachable !== false) {
17418
- timer.time(
17419
- "deriveBoundaryEffects",
17420
- () => deriveBoundaryEffects(enriched, closureFacts)
17421
- );
17422
- }
17423
17369
  timer.time(
17424
17370
  "stampModuleImports",
17425
17371
  () => stampModuleImports(enriched, (file) => {
@@ -17903,10 +17849,18 @@ function createProjectWithoutTsconfig(rootDir) {
17903
17849
  }
17904
17850
  return { project, files };
17905
17851
  }
17852
+ var TSCONFIG_NAMES = [
17853
+ "tsconfig.json",
17854
+ "jsconfig.json",
17855
+ "tsconfig.base.json"
17856
+ ];
17857
+ var WALK_UP_TSCONFIG_NAMES = ["tsconfig.json", "jsconfig.json"];
17906
17858
  function findNearestTsconfig(startDir) {
17907
- let dir = path12.resolve(startDir);
17859
+ const start = path12.resolve(startDir);
17860
+ let dir = start;
17908
17861
  while (true) {
17909
- for (const name of ["tsconfig.json", "jsconfig.json"]) {
17862
+ const names = dir === start ? TSCONFIG_NAMES : WALK_UP_TSCONFIG_NAMES;
17863
+ for (const name of names) {
17910
17864
  const candidate = path12.join(dir, name);
17911
17865
  if (fs6.existsSync(candidate)) {
17912
17866
  return candidate;
@@ -17922,7 +17876,7 @@ function findNearestTsconfig(startDir) {
17922
17876
 
17923
17877
  // src/facts/why.ts
17924
17878
  import path13 from "path";
17925
- import { Node as Node65, Project as Project3, SyntaxKind as SyntaxKind13 } from "ts-morph";
17879
+ import { Node as Node66, Project as Project3, SyntaxKind as SyntaxKind13 } from "ts-morph";
17926
17880
  import { explainResolutionProof, renderExplanation } from "@suss/resolution";
17927
17881
  var JS_PHRASES = {
17928
17882
  bind: ({ tuple, describe }) => ({
@@ -17951,7 +17905,7 @@ var TypeScriptWhySession = class {
17951
17905
  }
17952
17906
  let found = null;
17953
17907
  sourceFile.forEachDescendant((node) => {
17954
- if (Node65.isExpression(node) && node.getStartLineNumber() === line && node.getText() === text && (found === null || node.getWidth() <= found.getWidth())) {
17908
+ if (Node66.isExpression(node) && node.getStartLineNumber() === line && node.getText() === text && (found === null || node.getWidth() <= found.getWidth())) {
17955
17909
  found = node;
17956
17910
  }
17957
17911
  });
@@ -18043,21 +17997,21 @@ var TypeScriptWhySession = class {
18043
17997
  }
18044
17998
  };
18045
17999
  function displayNameOf(node) {
18046
- if (Node65.isIdentifier(node) || Node65.isPropertyAccessExpression(node)) {
18000
+ if (Node66.isIdentifier(node) || Node66.isPropertyAccessExpression(node)) {
18047
18001
  return node.getText();
18048
18002
  }
18049
- if (Node65.isCallExpression(node) || Node65.isNewExpression(node)) {
18003
+ if (Node66.isCallExpression(node) || Node66.isNewExpression(node)) {
18050
18004
  return `${node.getExpression()?.getText() ?? "call"}(...)`;
18051
18005
  }
18052
- if (Node65.isFunctionDeclaration(node) || Node65.isClassDeclaration(node) || Node65.isMethodDeclaration(node) || Node65.isVariableDeclaration(node)) {
18006
+ if (Node66.isFunctionDeclaration(node) || Node66.isClassDeclaration(node) || Node66.isMethodDeclaration(node) || Node66.isVariableDeclaration(node)) {
18053
18007
  const name = node.getName();
18054
18008
  if (name !== void 0) {
18055
18009
  return name;
18056
18010
  }
18057
18011
  }
18058
- if (Node65.isArrowFunction(node) || Node65.isFunctionExpression(node)) {
18012
+ if (Node66.isArrowFunction(node) || Node66.isFunctionExpression(node)) {
18059
18013
  const parent = node.getParent();
18060
- if (parent !== void 0 && Node65.isVariableDeclaration(parent)) {
18014
+ if (parent !== void 0 && Node66.isVariableDeclaration(parent)) {
18061
18015
  return parent.getName();
18062
18016
  }
18063
18017
  }
@@ -18111,6 +18065,7 @@ export {
18111
18065
  GENERIC_TERMINALS,
18112
18066
  NO_BARRIERS,
18113
18067
  ResolutionStore,
18068
+ TSCONFIG_NAMES,
18114
18069
  TypeScriptWhySession,
18115
18070
  accessContextFor,
18116
18071
  buildProjectHelperIndex,