@suss/adapter-typescript 0.16.0 → 0.18.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.
Files changed (3) hide show
  1. package/dist/index.cjs +926 -767
  2. package/dist/index.js +912 -753
  3. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // src/adapter.ts
2
2
  import path10 from "path";
3
3
  import {
4
- Node as Node58,
4
+ Node as Node59,
5
5
  Project,
6
6
  SyntaxKind as SyntaxKind12
7
7
  } from "ts-morph";
@@ -23,7 +23,7 @@ import {
23
23
  } from "@suss/extractor";
24
24
 
25
25
  // src/assembly.ts
26
- import { Node as Node25 } from "ts-morph";
26
+ import { Node as Node26 } from "ts-morph";
27
27
 
28
28
  // src/conditions.ts
29
29
  import {
@@ -3413,19 +3413,120 @@ function unwrapCall(node) {
3413
3413
  }
3414
3414
 
3415
3415
  // src/terminals/index.ts
3416
- import { Node as Node24 } from "ts-morph";
3416
+ import { Node as Node25 } from "ts-morph";
3417
+
3418
+ // src/terminals/jsx.ts
3419
+ import { Node as Node16 } from "ts-morph";
3420
+
3421
+ // src/resolve/unfollowedCall.ts
3422
+ import {
3423
+ Node as Node15,
3424
+ SyntaxKind as SyntaxKind4
3425
+ } from "ts-morph";
3426
+ function isInExternalCode(sourceFile) {
3427
+ if (sourceFile.isDeclarationFile()) {
3428
+ return true;
3429
+ }
3430
+ return sourceFile.getFilePath().includes("/node_modules/");
3431
+ }
3432
+ function hasBody(fn) {
3433
+ if (Node15.isFunctionDeclaration(fn) || Node15.isMethodDeclaration(fn) || Node15.isFunctionExpression(fn)) {
3434
+ return fn.getBody?.() !== void 0;
3435
+ }
3436
+ return true;
3437
+ }
3438
+ function isDeclaredShape(declaration) {
3439
+ return (Node15.isMethodSignature(declaration) || Node15.isPropertySignature(declaration)) && !isInExternalCode(declaration.getSourceFile());
3440
+ }
3441
+ function isExternalDeclaration(declaration) {
3442
+ if (isInExternalCode(declaration.getSourceFile())) {
3443
+ return true;
3444
+ }
3445
+ if (Node15.isImportSpecifier(declaration) || Node15.isImportClause(declaration) || Node15.isNamespaceImport(declaration)) {
3446
+ const target = declaration.getFirstAncestorByKind(SyntaxKind4.ImportDeclaration)?.getModuleSpecifierSourceFile();
3447
+ return target === void 0 || isInExternalCode(target);
3448
+ }
3449
+ return declaresAnotherModule(declaration);
3450
+ }
3451
+ function declaresAnotherModule(declaration) {
3452
+ const module = declaration.getFirstAncestorByKind(
3453
+ SyntaxKind4.ModuleDeclaration
3454
+ );
3455
+ return module !== void 0 && Node15.isStringLiteral(module.getNameNode());
3456
+ }
3457
+ function statesShapeOnly(declaration) {
3458
+ if (isExternalDeclaration(declaration)) {
3459
+ return false;
3460
+ }
3461
+ if (Node15.isMethodSignature(declaration) || Node15.isPropertySignature(declaration)) {
3462
+ return true;
3463
+ }
3464
+ if (Node15.isFunctionDeclaration(declaration) || Node15.isMethodDeclaration(declaration)) {
3465
+ return declaration.getBody() === void 0;
3466
+ }
3467
+ return false;
3468
+ }
3469
+ function declarationsBehind(symbol) {
3470
+ if (symbol === void 0) {
3471
+ return [];
3472
+ }
3473
+ const behind = symbol.getAliasedSymbol()?.getDeclarations() ?? [];
3474
+ return behind.length > 0 ? behind : symbol.getDeclarations();
3475
+ }
3476
+ function classifyStop(declarations) {
3477
+ if (declarations.length === 0) {
3478
+ return "noDeclaration";
3479
+ }
3480
+ for (const declaration of declarations) {
3481
+ if (!isInExternalCode(declaration.getSourceFile())) {
3482
+ recordFileDependency(declaration.getSourceFile().getFilePath());
3483
+ }
3484
+ }
3485
+ if (declarations.every(isExternalDeclaration)) {
3486
+ return "outsideRun";
3487
+ }
3488
+ if (declarations.some(statesShapeOnly)) {
3489
+ return "noBody";
3490
+ }
3491
+ return "unsettledValue";
3492
+ }
3493
+ var RECORDED = {
3494
+ noBody: true,
3495
+ unsettledValue: true,
3496
+ multipleSources: true,
3497
+ outsideRun: false,
3498
+ noDeclaration: false
3499
+ };
3500
+ function worthRecording(reason) {
3501
+ return RECORDED[reason];
3502
+ }
3503
+ var STOP_SENTENCE = {
3504
+ noBody: (callee) => `The call to ${callee} lands on a declaration with no body, so whatever runs there is missing from this summary`,
3505
+ unsettledValue: (callee) => `The call to ${callee} goes through a value this run could not settle, so whatever runs there is missing from this summary`,
3506
+ multipleSources: (callee) => `The call to ${callee} reaches a value with more than one possible source, so whatever runs there is missing from this summary`,
3507
+ outsideRun: (callee) => `The call to ${callee} lands in a package whose source is not in this run, so whatever runs there is missing from this summary`,
3508
+ noDeclaration: (callee) => `The call to ${callee} has no declaration this run could find, so whatever runs there is missing from this summary`
3509
+ };
3510
+ function unfollowedCallGap(stop) {
3511
+ return {
3512
+ type: "unfollowedCall",
3513
+ conditions: [],
3514
+ consequence: "unknown",
3515
+ description: STOP_SENTENCE[stop.reason](stop.callee),
3516
+ callee: stop.callee
3517
+ };
3518
+ }
3417
3519
 
3418
3520
  // src/terminals/jsx.ts
3419
- import { Node as Node15 } from "ts-morph";
3420
3521
  function tryMatchJsxReturn(node, pattern) {
3421
3522
  let expr;
3422
3523
  let source;
3423
- if (Node15.isReturnStatement(node)) {
3524
+ if (Node16.isReturnStatement(node)) {
3424
3525
  expr = node.getExpression();
3425
3526
  source = node;
3426
- } else if (Node15.isArrowFunction(node)) {
3527
+ } else if (Node16.isArrowFunction(node)) {
3427
3528
  const body = node.getBody();
3428
- if (body !== void 0 && !Node15.isBlock(body)) {
3529
+ if (body !== void 0 && !Node16.isBlock(body)) {
3429
3530
  expr = body;
3430
3531
  source = body;
3431
3532
  }
@@ -3455,34 +3556,62 @@ function tryMatchJsxReturn(node, pattern) {
3455
3556
  };
3456
3557
  return { node, source, terminal };
3457
3558
  }
3559
+ function componentTargetOf(tagNode) {
3560
+ if (!Node16.isIdentifier(tagNode) || !/^[A-Z]/.test(tagNode.getText())) {
3561
+ return null;
3562
+ }
3563
+ for (const decl of declarationsBehind(tagNode.getSymbol())) {
3564
+ if (isInExternalCode(decl.getSourceFile())) {
3565
+ continue;
3566
+ }
3567
+ const name = Node16.isFunctionDeclaration(decl) ? decl.getName() : void 0;
3568
+ if (name !== void 0) {
3569
+ return { file: decl.getSourceFile().getFilePath(), name };
3570
+ }
3571
+ if (Node16.isVariableDeclaration(decl)) {
3572
+ const init = decl.getInitializer();
3573
+ if (init !== void 0 && (Node16.isArrowFunction(init) || Node16.isFunctionExpression(init))) {
3574
+ return {
3575
+ file: decl.getSourceFile().getFilePath(),
3576
+ name: decl.getName()
3577
+ };
3578
+ }
3579
+ }
3580
+ }
3581
+ return null;
3582
+ }
3458
3583
  function jsxToRenderNode(node) {
3459
- if (Node15.isJsxElement(node)) {
3584
+ if (Node16.isJsxElement(node)) {
3460
3585
  const opening = node.getOpeningElement();
3461
3586
  const tag = opening.getTagNameNode().getText();
3462
3587
  const attrs = collectJsxAttributes(opening);
3588
+ const target = componentTargetOf(opening.getTagNameNode());
3463
3589
  const children = node.getJsxChildren().map(jsxChildToRenderNode).filter((n) => n !== null);
3464
3590
  return {
3465
3591
  type: "element",
3466
3592
  tag,
3467
3593
  children,
3468
- ...attrs !== null ? { attrs } : {}
3594
+ ...attrs !== null ? { attrs } : {},
3595
+ ...target !== null ? { target } : {}
3469
3596
  };
3470
3597
  }
3471
- if (Node15.isJsxSelfClosingElement(node)) {
3598
+ if (Node16.isJsxSelfClosingElement(node)) {
3472
3599
  const tag = node.getTagNameNode().getText();
3473
3600
  const attrs = collectJsxAttributes(node);
3601
+ const target = componentTargetOf(node.getTagNameNode());
3474
3602
  return {
3475
3603
  type: "element",
3476
3604
  tag,
3477
3605
  children: [],
3478
- ...attrs !== null ? { attrs } : {}
3606
+ ...attrs !== null ? { attrs } : {},
3607
+ ...target !== null ? { target } : {}
3479
3608
  };
3480
3609
  }
3481
- if (Node15.isJsxFragment(node)) {
3610
+ if (Node16.isJsxFragment(node)) {
3482
3611
  const children = node.getJsxChildren().map(jsxChildToRenderNode).filter((n) => n !== null);
3483
3612
  return { type: "element", tag: "Fragment", children };
3484
3613
  }
3485
- if (Node15.isParenthesizedExpression(node)) {
3614
+ if (Node16.isParenthesizedExpression(node)) {
3486
3615
  return jsxToRenderNode(node.getExpression());
3487
3616
  }
3488
3617
  return null;
@@ -3490,12 +3619,12 @@ function jsxToRenderNode(node) {
3490
3619
  function collectJsxAttributes(opening) {
3491
3620
  const entries = {};
3492
3621
  for (const attr of opening.getAttributes()) {
3493
- if (Node15.isJsxSpreadAttribute(attr)) {
3622
+ if (Node16.isJsxSpreadAttribute(attr)) {
3494
3623
  const exprText = attr.getExpression().getText();
3495
3624
  entries[`...${exprText}`] = exprText;
3496
3625
  continue;
3497
3626
  }
3498
- if (!Node15.isJsxAttribute(attr)) {
3627
+ if (!Node16.isJsxAttribute(attr)) {
3499
3628
  continue;
3500
3629
  }
3501
3630
  const name = attr.getNameNode().getText();
@@ -3504,7 +3633,7 @@ function collectJsxAttributes(opening) {
3504
3633
  entries[name] = "";
3505
3634
  continue;
3506
3635
  }
3507
- if (Node15.isJsxExpression(initializer)) {
3636
+ if (Node16.isJsxExpression(initializer)) {
3508
3637
  const inner = initializer.getExpression();
3509
3638
  entries[name] = inner !== void 0 ? inner.getText() : "";
3510
3639
  continue;
@@ -3514,30 +3643,30 @@ function collectJsxAttributes(opening) {
3514
3643
  return Object.keys(entries).length > 0 ? entries : null;
3515
3644
  }
3516
3645
  function jsxChildToRenderNode(child) {
3517
- if (Node15.isJsxText(child)) {
3646
+ if (Node16.isJsxText(child)) {
3518
3647
  const text = child.getLiteralText().trim();
3519
3648
  if (text.length === 0) {
3520
3649
  return null;
3521
3650
  }
3522
3651
  return { type: "text", value: text };
3523
3652
  }
3524
- if (Node15.isJsxExpression(child)) {
3653
+ if (Node16.isJsxExpression(child)) {
3525
3654
  const inner = child.getExpression();
3526
3655
  if (inner === void 0) {
3527
3656
  return null;
3528
3657
  }
3529
3658
  return jsxExpressionToRenderNode(inner);
3530
3659
  }
3531
- if (Node15.isJsxElement(child) || Node15.isJsxSelfClosingElement(child) || Node15.isJsxFragment(child)) {
3660
+ if (Node16.isJsxElement(child) || Node16.isJsxSelfClosingElement(child) || Node16.isJsxFragment(child)) {
3532
3661
  return jsxToRenderNode(child);
3533
3662
  }
3534
3663
  return null;
3535
3664
  }
3536
3665
  function jsxExpressionToRenderNode(expr) {
3537
- if (Node15.isParenthesizedExpression(expr)) {
3666
+ if (Node16.isParenthesizedExpression(expr)) {
3538
3667
  return jsxExpressionToRenderNode(expr.getExpression());
3539
3668
  }
3540
- if (Node15.isBinaryExpression(expr)) {
3669
+ if (Node16.isBinaryExpression(expr)) {
3541
3670
  const op = expr.getOperatorToken().getText();
3542
3671
  if (op === "&&") {
3543
3672
  const right = renderAlternative(peelParens(expr.getRight()));
@@ -3551,7 +3680,7 @@ function jsxExpressionToRenderNode(expr) {
3551
3680
  }
3552
3681
  }
3553
3682
  }
3554
- if (Node15.isConditionalExpression(expr)) {
3683
+ if (Node16.isConditionalExpression(expr)) {
3555
3684
  const truthy = renderAlternative(peelParens(expr.getWhenTrue()));
3556
3685
  const falsy = renderAlternative(peelParens(expr.getWhenFalse()));
3557
3686
  if (truthy.kind === "jsx") {
@@ -3574,16 +3703,16 @@ function jsxExpressionToRenderNode(expr) {
3574
3703
  return { type: "expression", sourceText: expr.getText() };
3575
3704
  }
3576
3705
  function renderAlternative(node) {
3577
- if (Node15.isNullLiteral(node)) {
3706
+ if (Node16.isNullLiteral(node)) {
3578
3707
  return { kind: "noRender" };
3579
3708
  }
3580
- if (Node15.isFalseLiteral(node)) {
3709
+ if (Node16.isFalseLiteral(node)) {
3581
3710
  return { kind: "noRender" };
3582
3711
  }
3583
- if (Node15.isIdentifier(node) && node.getText() === "undefined") {
3712
+ if (Node16.isIdentifier(node) && node.getText() === "undefined") {
3584
3713
  return { kind: "noRender" };
3585
3714
  }
3586
- if (Node15.isJsxElement(node) || Node15.isJsxSelfClosingElement(node) || Node15.isJsxFragment(node)) {
3715
+ if (Node16.isJsxElement(node) || Node16.isJsxSelfClosingElement(node) || Node16.isJsxFragment(node)) {
3587
3716
  const tree = jsxToRenderNode(node);
3588
3717
  if (tree !== null) {
3589
3718
  return { kind: "jsx", node: tree };
@@ -3594,13 +3723,13 @@ function renderAlternative(node) {
3594
3723
 
3595
3724
  // src/terminals/returns.ts
3596
3725
  import {
3597
- Node as Node22
3726
+ Node as Node23
3598
3727
  } from "ts-morph";
3599
3728
 
3600
3729
  // src/shapes/shapes.ts
3601
3730
  import {
3602
- Node as Node16,
3603
- SyntaxKind as SyntaxKind4
3731
+ Node as Node17,
3732
+ SyntaxKind as SyntaxKind5
3604
3733
  } from "ts-morph";
3605
3734
 
3606
3735
  // src/shapes/typeShapes.ts
@@ -4060,60 +4189,60 @@ function extractShapeWithArguments(node, substitutions) {
4060
4189
  }
4061
4190
  function extractShapeInner(node) {
4062
4191
  const unwrapped2 = peelSyntax(node);
4063
- if (boundArguments !== null && Node16.isIdentifier(unwrapped2)) {
4192
+ if (boundArguments !== null && Node17.isIdentifier(unwrapped2)) {
4064
4193
  const argument = boundArguments.get(unwrapped2.getText());
4065
4194
  if (argument !== void 0 && argument !== unwrapped2) {
4066
4195
  return extractShape(argument);
4067
4196
  }
4068
4197
  }
4069
- if (Node16.isObjectLiteralExpression(unwrapped2)) {
4198
+ if (Node17.isObjectLiteralExpression(unwrapped2)) {
4070
4199
  return shapeFromObjectLiteral(unwrapped2);
4071
4200
  }
4072
- if (Node16.isArrayLiteralExpression(unwrapped2)) {
4201
+ if (Node17.isArrayLiteralExpression(unwrapped2)) {
4073
4202
  return shapeFromArrayLiteral(unwrapped2);
4074
4203
  }
4075
- if (Node16.isStringLiteral(unwrapped2) || Node16.isNoSubstitutionTemplateLiteral(unwrapped2)) {
4204
+ if (Node17.isStringLiteral(unwrapped2) || Node17.isNoSubstitutionTemplateLiteral(unwrapped2)) {
4076
4205
  return { type: "literal", value: unwrapped2.getLiteralValue() };
4077
4206
  }
4078
- if (Node16.isTemplateExpression(unwrapped2)) {
4207
+ if (Node17.isTemplateExpression(unwrapped2)) {
4079
4208
  return { type: "text" };
4080
4209
  }
4081
- if (Node16.isNumericLiteral(unwrapped2)) {
4210
+ if (Node17.isNumericLiteral(unwrapped2)) {
4082
4211
  return numericLiteralShape(
4083
4212
  unwrapped2.getLiteralValue(),
4084
4213
  unwrapped2.getText()
4085
4214
  );
4086
4215
  }
4087
- if (Node16.isPrefixUnaryExpression(unwrapped2)) {
4216
+ if (Node17.isPrefixUnaryExpression(unwrapped2)) {
4088
4217
  const op = unwrapped2.getOperatorToken();
4089
- if (op === SyntaxKind4.MinusToken || op === SyntaxKind4.PlusToken) {
4218
+ if (op === SyntaxKind5.MinusToken || op === SyntaxKind5.PlusToken) {
4090
4219
  const inner = unwrapped2.getOperand();
4091
- if (Node16.isNumericLiteral(inner)) {
4220
+ if (Node17.isNumericLiteral(inner)) {
4092
4221
  const v3 = inner.getLiteralValue();
4093
- const signed = op === SyntaxKind4.MinusToken ? -v3 : v3;
4222
+ const signed = op === SyntaxKind5.MinusToken ? -v3 : v3;
4094
4223
  const rawBody = inner.getText();
4095
- const raw = op === SyntaxKind4.MinusToken ? `-${rawBody}` : rawBody;
4224
+ const raw = op === SyntaxKind5.MinusToken ? `-${rawBody}` : rawBody;
4096
4225
  return numericLiteralShape(signed, raw);
4097
4226
  }
4098
4227
  }
4099
4228
  }
4100
- if (Node16.isBigIntLiteral(unwrapped2)) {
4229
+ if (Node17.isBigIntLiteral(unwrapped2)) {
4101
4230
  return { type: "ref", name: "bigint" };
4102
4231
  }
4103
4232
  const kind = unwrapped2.getKind();
4104
- if (kind === SyntaxKind4.TrueKeyword) {
4233
+ if (kind === SyntaxKind5.TrueKeyword) {
4105
4234
  return { type: "literal", value: true };
4106
4235
  }
4107
- if (kind === SyntaxKind4.FalseKeyword) {
4236
+ if (kind === SyntaxKind5.FalseKeyword) {
4108
4237
  return { type: "literal", value: false };
4109
4238
  }
4110
- if (kind === SyntaxKind4.NullKeyword) {
4239
+ if (kind === SyntaxKind5.NullKeyword) {
4111
4240
  return { type: "null" };
4112
4241
  }
4113
- if (Node16.isIdentifier(unwrapped2) && unwrapped2.getText() === "undefined") {
4242
+ if (Node17.isIdentifier(unwrapped2) && unwrapped2.getText() === "undefined") {
4114
4243
  return { type: "undefined" };
4115
4244
  }
4116
- if (Node16.isConditionalExpression(unwrapped2)) {
4245
+ if (Node17.isConditionalExpression(unwrapped2)) {
4117
4246
  const whenTrue = extractShape(unwrapped2.getWhenTrue());
4118
4247
  const whenFalse = extractShape(unwrapped2.getWhenFalse());
4119
4248
  const variants = [];
@@ -4144,7 +4273,7 @@ function shapeFromArrayLiteral(arr) {
4144
4273
  }
4145
4274
  const shapes = [];
4146
4275
  for (const el of elements) {
4147
- if (Node16.isSpreadElement(el)) {
4276
+ if (Node17.isSpreadElement(el)) {
4148
4277
  const inner = el.getExpression();
4149
4278
  const innerShape = extractShape(inner);
4150
4279
  if (innerShape?.type === "array") {
@@ -4163,7 +4292,7 @@ function shapeFromObjectLiteral(obj) {
4163
4292
  const properties = {};
4164
4293
  const unresolvedSpreads = [];
4165
4294
  for (const prop of obj.getProperties()) {
4166
- if (Node16.isPropertyAssignment(prop)) {
4295
+ if (Node17.isPropertyAssignment(prop)) {
4167
4296
  const name = propertyName(prop);
4168
4297
  if (name === null) {
4169
4298
  continue;
@@ -4179,7 +4308,7 @@ function shapeFromObjectLiteral(obj) {
4179
4308
  };
4180
4309
  continue;
4181
4310
  }
4182
- if (Node16.isShorthandPropertyAssignment(prop)) {
4311
+ if (Node17.isShorthandPropertyAssignment(prop)) {
4183
4312
  const name = prop.getName();
4184
4313
  const valueExpr = prop.getNameNode();
4185
4314
  properties[name] = extractShape(valueExpr) ?? {
@@ -4188,7 +4317,7 @@ function shapeFromObjectLiteral(obj) {
4188
4317
  };
4189
4318
  continue;
4190
4319
  }
4191
- if (Node16.isSpreadAssignment(prop)) {
4320
+ if (Node17.isSpreadAssignment(prop)) {
4192
4321
  const expr = prop.getExpression();
4193
4322
  const spreadShape = extractShape(expr);
4194
4323
  if (spreadShape?.type === "record") {
@@ -4207,7 +4336,7 @@ function shapeFromObjectLiteral(obj) {
4207
4336
  }
4208
4337
  function propertyName(prop) {
4209
4338
  const nameNode = prop.getNameNode();
4210
- if (Node16.isIdentifier(nameNode) || Node16.isStringLiteral(nameNode) || Node16.isNoSubstitutionTemplateLiteral(nameNode) || Node16.isNumericLiteral(nameNode)) {
4339
+ if (Node17.isIdentifier(nameNode) || Node17.isStringLiteral(nameNode) || Node17.isNoSubstitutionTemplateLiteral(nameNode) || Node17.isNumericLiteral(nameNode)) {
4211
4340
  return nameNode.getText().replace(/^["']|["']$/g, "");
4212
4341
  }
4213
4342
  return null;
@@ -4234,22 +4363,22 @@ function collapseVariants2(shapes) {
4234
4363
 
4235
4364
  // src/terminals/extract.ts
4236
4365
  import {
4237
- Node as Node17
4366
+ Node as Node18
4238
4367
  } from "ts-morph";
4239
4368
  function unwrapAs(node) {
4240
- return Node17.isAsExpression(node) ? unwrapAs(node.getExpression()) : node;
4369
+ return Node18.isAsExpression(node) ? unwrapAs(node.getExpression()) : node;
4241
4370
  }
4242
4371
  function unwrapJsonStringify(node) {
4243
4372
  const outer = unwrapAs(node);
4244
- if (!Node17.isCallExpression(outer)) {
4373
+ if (!Node18.isCallExpression(outer)) {
4245
4374
  return node;
4246
4375
  }
4247
4376
  const callee = outer.getExpression();
4248
- if (!Node17.isPropertyAccessExpression(callee) || callee.getName() !== "stringify") {
4377
+ if (!Node18.isPropertyAccessExpression(callee) || callee.getName() !== "stringify") {
4249
4378
  return node;
4250
4379
  }
4251
4380
  const receiver = callee.getExpression();
4252
- if (!Node17.isIdentifier(receiver) || receiver.getText() !== "JSON") {
4381
+ if (!Node18.isIdentifier(receiver) || receiver.getText() !== "JSON") {
4253
4382
  return node;
4254
4383
  }
4255
4384
  const args = outer.getArguments();
@@ -4259,7 +4388,7 @@ function unwrapJsonStringify(node) {
4259
4388
  return unwrapAs(args[0]);
4260
4389
  }
4261
4390
  function substituted(value, ctx) {
4262
- if (ctx.substitutions === void 0 || !Node17.isIdentifier(value)) {
4391
+ if (ctx.substitutions === void 0 || !Node18.isIdentifier(value)) {
4263
4392
  return value;
4264
4393
  }
4265
4394
  return ctx.substitutions.get(value.getText()) ?? value;
@@ -4293,11 +4422,11 @@ function matchConstructorCode(ctorText, codes) {
4293
4422
  }
4294
4423
  function statusOf(value, ctx) {
4295
4424
  const unwrapped2 = unwrapAs(value);
4296
- if (Node17.isNumericLiteral(unwrapped2)) {
4425
+ if (Node18.isNumericLiteral(unwrapped2)) {
4297
4426
  return { type: "literal", value: Number(unwrapped2.getText()) };
4298
4427
  }
4299
4428
  const resolved = ctx.resolveWrittenValue?.(unwrapped2) ?? null;
4300
- if (resolved !== null && Node17.isNumericLiteral(resolved)) {
4429
+ if (resolved !== null && Node18.isNumericLiteral(resolved)) {
4301
4430
  return { type: "literal", value: Number(resolved.getText()) };
4302
4431
  }
4303
4432
  return { type: "dynamic", sourceText: unwrapped2.getText() };
@@ -4307,10 +4436,10 @@ function statusFromProperty(obj, name, ctx) {
4307
4436
  if (prop === void 0) {
4308
4437
  return null;
4309
4438
  }
4310
- if (Node17.isShorthandPropertyAssignment(prop)) {
4439
+ if (Node18.isShorthandPropertyAssignment(prop)) {
4311
4440
  return { type: "dynamic", sourceText: prop.getName() };
4312
4441
  }
4313
- if (!Node17.isPropertyAssignment(prop)) {
4442
+ if (!Node18.isPropertyAssignment(prop)) {
4314
4443
  return null;
4315
4444
  }
4316
4445
  const value = prop.getInitializer();
@@ -4333,7 +4462,7 @@ function extractStatusCodeFromRule(ctx) {
4333
4462
  return null;
4334
4463
  }
4335
4464
  const first = ctx.throwCallArgs?.[0];
4336
- if (first !== void 0 && Node17.isNumericLiteral(first)) {
4465
+ if (first !== void 0 && Node18.isNumericLiteral(first)) {
4337
4466
  const value = first.getLiteralValue();
4338
4467
  if (value >= 100 && value <= 599) {
4339
4468
  return { type: "literal", value };
@@ -4346,7 +4475,7 @@ function extractStatusCodeFromRule(ctx) {
4346
4475
  return null;
4347
4476
  }
4348
4477
  const arg = ctx.throwCallArgs[sc.position];
4349
- if (arg === void 0 || !Node17.isNewExpression(arg)) {
4478
+ if (arg === void 0 || !Node18.isNewExpression(arg)) {
4350
4479
  return null;
4351
4480
  }
4352
4481
  const ctorText = arg.getExpression().getText();
@@ -4355,7 +4484,7 @@ function extractStatusCodeFromRule(ctx) {
4355
4484
  if (sc.from === "argumentProperty") {
4356
4485
  const args = ctx.throwCallArgs ?? ctx.calls?.[0]?.getArguments();
4357
4486
  const arg = args?.[sc.position];
4358
- if (arg === void 0 || !Node17.isObjectLiteralExpression(arg)) {
4487
+ if (arg === void 0 || !Node18.isObjectLiteralExpression(arg)) {
4359
4488
  return null;
4360
4489
  }
4361
4490
  return statusFromProperty(arg, sc.name, ctx);
@@ -4365,8 +4494,8 @@ function extractStatusCodeFromRule(ctx) {
4365
4494
  return null;
4366
4495
  }
4367
4496
  for (const prop of ctx.returnedObj.getProperties()) {
4368
- if (!Node17.isPropertyAssignment(prop)) {
4369
- if (Node17.isShorthandPropertyAssignment(prop)) {
4497
+ if (!Node18.isPropertyAssignment(prop)) {
4498
+ if (Node18.isShorthandPropertyAssignment(prop)) {
4370
4499
  if (prop.getName() === sc.name) {
4371
4500
  const resolved = ctx.substitutions?.get(prop.getName());
4372
4501
  if (resolved !== void 0) {
@@ -4424,8 +4553,8 @@ function extractBody(ctx) {
4424
4553
  return null;
4425
4554
  }
4426
4555
  for (const prop of ctx.returnedObj.getProperties()) {
4427
- if (!Node17.isPropertyAssignment(prop)) {
4428
- if (Node17.isShorthandPropertyAssignment(prop)) {
4556
+ if (!Node18.isPropertyAssignment(prop)) {
4557
+ if (Node18.isShorthandPropertyAssignment(prop)) {
4429
4558
  if (prop.getName() === b.name) {
4430
4559
  const resolved = ctx.substitutions?.get(prop.getName());
4431
4560
  if (resolved !== void 0) {
@@ -4480,10 +4609,10 @@ function extractBody(ctx) {
4480
4609
  }
4481
4610
 
4482
4611
  // src/terminals/helperResolution.ts
4483
- import { Node as Node18, SyntaxKind as SyntaxKind5 } from "ts-morph";
4612
+ import { Node as Node19, SyntaxKind as SyntaxKind6 } from "ts-morph";
4484
4613
  function resolveHelperReturn(call) {
4485
4614
  const callee = call.getExpression();
4486
- if (!Node18.isIdentifier(callee)) {
4615
+ if (!Node19.isIdentifier(callee)) {
4487
4616
  return { kind: "notLocal" };
4488
4617
  }
4489
4618
  const helper = resolveLocalHelper(callee);
@@ -4513,16 +4642,16 @@ function guardsAbove(returnValue) {
4513
4642
  let child = returnValue;
4514
4643
  let current2 = returnValue.getParent();
4515
4644
  while (current2 !== void 0) {
4516
- if (Node18.isIfStatement(current2)) {
4645
+ if (Node19.isIfStatement(current2)) {
4517
4646
  guards.push({
4518
4647
  condition: current2.getExpression(),
4519
4648
  whenTrue: current2.getThenStatement() === child
4520
4649
  });
4521
4650
  }
4522
- if (Node18.isBlock(current2)) {
4651
+ if (Node19.isBlock(current2)) {
4523
4652
  guards.push(...earlyReturnGuardsBefore(current2, child));
4524
4653
  }
4525
- if (Node18.isFunctionDeclaration(current2) || Node18.isArrowFunction(current2) || Node18.isFunctionExpression(current2)) {
4654
+ if (Node19.isFunctionDeclaration(current2) || Node19.isArrowFunction(current2) || Node19.isFunctionExpression(current2)) {
4526
4655
  break;
4527
4656
  }
4528
4657
  child = current2;
@@ -4531,7 +4660,7 @@ function guardsAbove(returnValue) {
4531
4660
  return guards;
4532
4661
  }
4533
4662
  function earlyReturnGuardsBefore(block, child) {
4534
- if (!Node18.isBlock(block)) {
4663
+ if (!Node19.isBlock(block)) {
4535
4664
  return [];
4536
4665
  }
4537
4666
  const guards = [];
@@ -4539,7 +4668,7 @@ function earlyReturnGuardsBefore(block, child) {
4539
4668
  if (statement === child) {
4540
4669
  break;
4541
4670
  }
4542
- if (!Node18.isIfStatement(statement) || statement.getElseStatement()) {
4671
+ if (!Node19.isIfStatement(statement) || statement.getElseStatement()) {
4543
4672
  continue;
4544
4673
  }
4545
4674
  if (alwaysReturns(statement.getThenStatement())) {
@@ -4549,10 +4678,10 @@ function earlyReturnGuardsBefore(block, child) {
4549
4678
  return guards;
4550
4679
  }
4551
4680
  function alwaysReturns(statement) {
4552
- if (Node18.isReturnStatement(statement) || Node18.isThrowStatement(statement)) {
4681
+ if (Node19.isReturnStatement(statement) || Node19.isThrowStatement(statement)) {
4553
4682
  return true;
4554
4683
  }
4555
- if (!Node18.isBlock(statement)) {
4684
+ if (!Node19.isBlock(statement)) {
4556
4685
  return false;
4557
4686
  }
4558
4687
  const statements = statement.getStatements();
@@ -4570,7 +4699,7 @@ var COMPARISONS = {
4570
4699
  "!=": (a, b) => a !== b
4571
4700
  };
4572
4701
  function evaluateComparison(condition, substitutions) {
4573
- if (!Node18.isBinaryExpression(condition)) {
4702
+ if (!Node19.isBinaryExpression(condition)) {
4574
4703
  return null;
4575
4704
  }
4576
4705
  const left = numberFor(condition.getLeft(), substitutions);
@@ -4582,8 +4711,8 @@ function evaluateComparison(condition, substitutions) {
4582
4711
  return compare === void 0 ? null : compare(left, right);
4583
4712
  }
4584
4713
  function numberFor(node, substitutions) {
4585
- const resolved = Node18.isIdentifier(node) && substitutions.has(node.getText()) ? substitutions.get(node.getText()) : node;
4586
- return Node18.isNumericLiteral(resolved) ? Number(resolved.getText()) : null;
4714
+ const resolved = Node19.isIdentifier(node) && substitutions.has(node.getText()) ? substitutions.get(node.getText()) : node;
4715
+ return Node19.isNumericLiteral(resolved) ? Number(resolved.getText()) : null;
4587
4716
  }
4588
4717
  function resolveLocalHelper(callee) {
4589
4718
  for (const declaration of declarationsFor(callee)) {
@@ -4652,12 +4781,12 @@ function declarationsFor(callee) {
4652
4781
  return (aliased ?? symbol).getDeclarations();
4653
4782
  }
4654
4783
  function asFunctionLike(declaration) {
4655
- if (Node18.isFunctionDeclaration(declaration) || Node18.isArrowFunction(declaration) || Node18.isFunctionExpression(declaration)) {
4784
+ if (Node19.isFunctionDeclaration(declaration) || Node19.isArrowFunction(declaration) || Node19.isFunctionExpression(declaration)) {
4656
4785
  return declaration;
4657
4786
  }
4658
- if (Node18.isVariableDeclaration(declaration)) {
4787
+ if (Node19.isVariableDeclaration(declaration)) {
4659
4788
  const initializer = declaration.getInitializer();
4660
- if (initializer !== void 0 && (Node18.isArrowFunction(initializer) || Node18.isFunctionExpression(initializer))) {
4789
+ if (initializer !== void 0 && (Node19.isArrowFunction(initializer) || Node19.isFunctionExpression(initializer))) {
4661
4790
  return initializer;
4662
4791
  }
4663
4792
  }
@@ -4668,13 +4797,13 @@ function returnedObjects(fn) {
4668
4797
  if (body === void 0) {
4669
4798
  return [];
4670
4799
  }
4671
- if (!Node18.isBlock(body)) {
4800
+ if (!Node19.isBlock(body)) {
4672
4801
  const expression = peelParens(body);
4673
- return Node18.isObjectLiteralExpression(expression) ? [expression] : [];
4802
+ return Node19.isObjectLiteralExpression(expression) ? [expression] : [];
4674
4803
  }
4675
4804
  const found = [];
4676
4805
  for (const statement of body.getDescendantsOfKind(
4677
- SyntaxKind5.ReturnStatement
4806
+ SyntaxKind6.ReturnStatement
4678
4807
  )) {
4679
4808
  if (enclosingFunctionOf(statement) !== body) {
4680
4809
  continue;
@@ -4684,7 +4813,7 @@ function returnedObjects(fn) {
4684
4813
  continue;
4685
4814
  }
4686
4815
  const unwrapped2 = peelParens(expression);
4687
- if (Node18.isObjectLiteralExpression(unwrapped2)) {
4816
+ if (Node19.isObjectLiteralExpression(unwrapped2)) {
4688
4817
  found.push(unwrapped2);
4689
4818
  }
4690
4819
  }
@@ -4693,7 +4822,7 @@ function returnedObjects(fn) {
4693
4822
  function enclosingFunctionOf(node) {
4694
4823
  let current2 = node.getParent();
4695
4824
  while (current2 !== void 0) {
4696
- if (Node18.isFunctionDeclaration(current2) || Node18.isArrowFunction(current2) || Node18.isFunctionExpression(current2) || Node18.isMethodDeclaration(current2)) {
4825
+ if (Node19.isFunctionDeclaration(current2) || Node19.isArrowFunction(current2) || Node19.isFunctionExpression(current2) || Node19.isMethodDeclaration(current2)) {
4697
4826
  return current2.getBody();
4698
4827
  }
4699
4828
  current2 = current2.getParent();
@@ -4712,10 +4841,10 @@ function bindArguments(callArgs, params) {
4712
4841
  }
4713
4842
 
4714
4843
  // src/terminals/shared.ts
4715
- import { Node as Node19 } from "ts-morph";
4844
+ import { Node as Node20 } from "ts-morph";
4716
4845
  function unwrapValue(node) {
4717
4846
  let current2 = node;
4718
- while (Node19.isParenthesizedExpression(current2) || Node19.isAwaitExpression(current2) || Node19.isAsExpression(current2) || Node19.isNonNullExpression(current2) || Node19.isSatisfiesExpression(current2)) {
4847
+ while (Node20.isParenthesizedExpression(current2) || Node20.isAwaitExpression(current2) || Node20.isAsExpression(current2) || Node20.isNonNullExpression(current2) || Node20.isSatisfiesExpression(current2)) {
4719
4848
  current2 = current2.getExpression();
4720
4849
  }
4721
4850
  return current2;
@@ -4727,17 +4856,17 @@ function returnPositionOf(value) {
4727
4856
  if (parent === void 0) {
4728
4857
  return null;
4729
4858
  }
4730
- if (Node19.isReturnStatement(parent)) {
4859
+ if (Node20.isReturnStatement(parent)) {
4731
4860
  return parent;
4732
4861
  }
4733
- if (Node19.isArrowFunction(parent)) {
4862
+ if (Node20.isArrowFunction(parent)) {
4734
4863
  return parent.getBody() === current2 ? current2 : null;
4735
4864
  }
4736
- if (Node19.isParenthesizedExpression(parent) || Node19.isAwaitExpression(parent) || Node19.isAsExpression(parent) || Node19.isNonNullExpression(parent) || Node19.isSatisfiesExpression(parent)) {
4865
+ if (Node20.isParenthesizedExpression(parent) || Node20.isAwaitExpression(parent) || Node20.isAsExpression(parent) || Node20.isNonNullExpression(parent) || Node20.isSatisfiesExpression(parent)) {
4737
4866
  current2 = parent;
4738
4867
  continue;
4739
4868
  }
4740
- if (Node19.isConditionalExpression(parent) && (parent.getWhenTrue() === current2 || parent.getWhenFalse() === current2)) {
4869
+ if (Node20.isConditionalExpression(parent) && (parent.getWhenTrue() === current2 || parent.getWhenFalse() === current2)) {
4741
4870
  current2 = parent;
4742
4871
  continue;
4743
4872
  }
@@ -4746,10 +4875,10 @@ function returnPositionOf(value) {
4746
4875
  }
4747
4876
 
4748
4877
  // src/terminals/statusBranches.ts
4749
- import { Node as Node21 } from "ts-morph";
4878
+ import { Node as Node22 } from "ts-morph";
4750
4879
 
4751
4880
  // src/facts/assignments.ts
4752
- import { Node as Node20, SyntaxKind as SyntaxKind6, VariableDeclarationKind } from "ts-morph";
4881
+ import { Node as Node21, SyntaxKind as SyntaxKind7, VariableDeclarationKind } from "ts-morph";
4753
4882
  var byFile = createPerFileCache();
4754
4883
  var byDeclaration = /* @__PURE__ */ new WeakMap();
4755
4884
  var byField = /* @__PURE__ */ new WeakMap();
@@ -4814,7 +4943,7 @@ function writesToFieldUncached(declaration) {
4814
4943
  };
4815
4944
  }
4816
4945
  function startingValueOf(declaration) {
4817
- return Node20.isParameterDeclaration(declaration) ? declaration : declaration.getInitializer();
4946
+ return Node21.isParameterDeclaration(declaration) ? declaration : declaration.getInitializer();
4818
4947
  }
4819
4948
  function writeRunsInConstructor(declaration, write) {
4820
4949
  const statement = statementOf(write.node);
@@ -4822,20 +4951,20 @@ function writeRunsInConstructor(declaration, write) {
4822
4951
  return false;
4823
4952
  }
4824
4953
  const body = statement.getParent();
4825
- if (body === void 0 || !Node20.isBlock(body)) {
4954
+ if (body === void 0 || !Node21.isBlock(body)) {
4826
4955
  return false;
4827
4956
  }
4828
4957
  const owner = body.getParent();
4829
- return owner !== void 0 && Node20.isConstructorDeclaration(owner) && owner.getParent() === classHolding(declaration);
4958
+ return owner !== void 0 && Node21.isConstructorDeclaration(owner) && owner.getParent() === classHolding(declaration);
4830
4959
  }
4831
4960
  function classHolding(declaration) {
4832
- return Node20.isParameterDeclaration(declaration) ? declaration.getParent().getParent() : declaration.getParent();
4961
+ return Node21.isParameterDeclaration(declaration) ? declaration.getParent().getParent() : declaration.getParent();
4833
4962
  }
4834
4963
  function isWrittenAgain(declaration) {
4835
4964
  return assignmentsTo(declaration).length > 0;
4836
4965
  }
4837
4966
  function assignmentsTo(declaration) {
4838
- if (Node20.isPropertyDeclaration(declaration) || Node20.isParameterDeclaration(declaration)) {
4967
+ if (Node21.isPropertyDeclaration(declaration) || Node21.isParameterDeclaration(declaration)) {
4839
4968
  const sourceFile2 = declaration.getSourceFile();
4840
4969
  return sourceFile2.isDeclarationFile() ? [] : assignmentsInFile(sourceFile2).get(declaration) ?? [];
4841
4970
  }
@@ -4872,39 +5001,39 @@ function assignmentsInFile(sourceFile) {
4872
5001
  return found;
4873
5002
  }
4874
5003
  function isAssignmentOperator(kind) {
4875
- return kind >= SyntaxKind6.FirstAssignment && kind <= SyntaxKind6.LastAssignment;
5004
+ return kind >= SyntaxKind7.FirstAssignment && kind <= SyntaxKind7.LastAssignment;
4876
5005
  }
4877
5006
  function writeAt(node) {
4878
- if (Node20.isBinaryExpression(node)) {
5007
+ if (Node21.isBinaryExpression(node)) {
4879
5008
  const operator = node.getOperatorToken().getKind();
4880
5009
  const target = node.getLeft();
4881
- if (!isAssignmentOperator(operator) || !(Node20.isIdentifier(target) || Node20.isPropertyAccessExpression(target))) {
5010
+ if (!isAssignmentOperator(operator) || !(Node21.isIdentifier(target) || Node21.isPropertyAccessExpression(target))) {
4882
5011
  return null;
4883
5012
  }
4884
- const value = operator === SyntaxKind6.EqualsToken ? node.getRight() : null;
5013
+ const value = operator === SyntaxKind7.EqualsToken ? node.getRight() : null;
4885
5014
  return { target, write: { value, node } };
4886
5015
  }
4887
- if (Node20.isPrefixUnaryExpression(node) || Node20.isPostfixUnaryExpression(node)) {
5016
+ if (Node21.isPrefixUnaryExpression(node) || Node21.isPostfixUnaryExpression(node)) {
4888
5017
  const operator = node.getOperatorToken();
4889
- if (operator !== SyntaxKind6.PlusPlusToken && operator !== SyntaxKind6.MinusMinusToken) {
5018
+ if (operator !== SyntaxKind7.PlusPlusToken && operator !== SyntaxKind7.MinusMinusToken) {
4890
5019
  return null;
4891
5020
  }
4892
5021
  const target = node.getOperand();
4893
- return Node20.isIdentifier(target) ? { target, write: { value: null, node } } : null;
5022
+ return Node21.isIdentifier(target) ? { target, write: { value: null, node } } : null;
4894
5023
  }
4895
5024
  return null;
4896
5025
  }
4897
5026
  function declarationsOf(name) {
4898
- const nameNode = Node20.isPropertyAccessExpression(name) ? name.getNameNode() : name;
5027
+ const nameNode = Node21.isPropertyAccessExpression(name) ? name.getNameNode() : name;
4899
5028
  const symbol = nameNode.getSymbol();
4900
5029
  if (symbol === void 0) {
4901
5030
  return [];
4902
5031
  }
4903
5032
  const declarations = [];
4904
5033
  for (const declaration of symbol.getDeclarations()) {
4905
- if (Node20.isVariableDeclaration(declaration) || Node20.isPropertyDeclaration(declaration) || // A parameter property is the field's only declaration, so
5034
+ if (Node21.isVariableDeclaration(declaration) || Node21.isPropertyDeclaration(declaration) || // A parameter property is the field's only declaration, so
4906
5035
  // `this.dao = other` in the constructor writes to it.
4907
- Node20.isParameterDeclaration(declaration) && declaration.isParameterProperty()) {
5036
+ Node21.isParameterDeclaration(declaration) && declaration.isParameterProperty()) {
4908
5037
  declarations.push(declaration);
4909
5038
  }
4910
5039
  }
@@ -4924,7 +5053,7 @@ function writesRunInOrder(declaration, writes) {
4924
5053
  function statementOf(node) {
4925
5054
  let current2 = node;
4926
5055
  while (current2 !== void 0) {
4927
- if (Node20.isStatement(current2)) {
5056
+ if (Node21.isStatement(current2)) {
4928
5057
  return current2;
4929
5058
  }
4930
5059
  current2 = current2.getParent();
@@ -4948,7 +5077,7 @@ function isReadBefore(declaration, position) {
4948
5077
  traversal.skip();
4949
5078
  return;
4950
5079
  }
4951
- if (!Node20.isIdentifier(node) || node.getText() !== name) {
5080
+ if (!Node21.isIdentifier(node) || node.getText() !== name) {
4952
5081
  return;
4953
5082
  }
4954
5083
  if (node === declaration.getNameNode() || isWriteTarget(node)) {
@@ -4961,17 +5090,17 @@ function isReadBefore(declaration, position) {
4961
5090
  return read2;
4962
5091
  }
4963
5092
  function startsItsOwnBody(node) {
4964
- return Node20.isFunctionDeclaration(node) || Node20.isFunctionExpression(node) || Node20.isArrowFunction(node) || Node20.isMethodDeclaration(node) || Node20.isClassDeclaration(node);
5093
+ return Node21.isFunctionDeclaration(node) || Node21.isFunctionExpression(node) || Node21.isArrowFunction(node) || Node21.isMethodDeclaration(node) || Node21.isClassDeclaration(node);
4965
5094
  }
4966
5095
  function isWriteTarget(name) {
4967
5096
  const parent = name.getParent();
4968
5097
  if (parent === void 0) {
4969
5098
  return false;
4970
5099
  }
4971
- if (Node20.isBinaryExpression(parent)) {
5100
+ if (Node21.isBinaryExpression(parent)) {
4972
5101
  return parent.getLeft() === name && isAssignmentOperator(parent.getOperatorToken().getKind());
4973
5102
  }
4974
- return (Node20.isPrefixUnaryExpression(parent) || Node20.isPostfixUnaryExpression(parent)) && parent.getOperand() === name;
5103
+ return (Node21.isPrefixUnaryExpression(parent) || Node21.isPostfixUnaryExpression(parent)) && parent.getOperand() === name;
4975
5104
  }
4976
5105
 
4977
5106
  // src/terminals/statusBranches.ts
@@ -4997,10 +5126,10 @@ function asConditional(node) {
4997
5126
  if (direct !== null) {
4998
5127
  return direct;
4999
5128
  }
5000
- if (!Node21.isIdentifier(node)) {
5129
+ if (!Node22.isIdentifier(node)) {
5001
5130
  return null;
5002
5131
  }
5003
- const declaration = node.getSymbol()?.getDeclarations().find(Node21.isVariableDeclaration);
5132
+ const declaration = node.getSymbol()?.getDeclarations().find(Node22.isVariableDeclaration);
5004
5133
  if (declaration === void 0) {
5005
5134
  return null;
5006
5135
  }
@@ -5011,10 +5140,10 @@ function asConditional(node) {
5011
5140
  const only = written.values[0];
5012
5141
  return only === void 0 ? null : toConditional(only);
5013
5142
  }
5014
- var toConditional = (node) => Node21.isConditionalExpression(node) ? node : null;
5143
+ var toConditional = (node) => Node22.isConditionalExpression(node) ? node : null;
5015
5144
  function numberOf(node) {
5016
5145
  const inner = unwrap(node);
5017
- if (!Node21.isNumericLiteral(inner)) {
5146
+ if (!Node22.isNumericLiteral(inner)) {
5018
5147
  return null;
5019
5148
  }
5020
5149
  const value = Number(inner.getText());
@@ -5022,7 +5151,7 @@ function numberOf(node) {
5022
5151
  }
5023
5152
  function unwrap(node) {
5024
5153
  let current2 = node;
5025
- while (Node21.isParenthesizedExpression(current2) || Node21.isAsExpression(current2) || Node21.isNonNullExpression(current2)) {
5154
+ while (Node22.isParenthesizedExpression(current2) || Node22.isAsExpression(current2) || Node22.isNonNullExpression(current2)) {
5026
5155
  current2 = current2.getExpression();
5027
5156
  }
5028
5157
  return current2;
@@ -5038,7 +5167,7 @@ function unwrapMethodChain(call, methodChain, func, paramPos) {
5038
5167
  for (let i = methodChain.length - 1; i >= 0; i--) {
5039
5168
  const expectedMethod = methodChain[i];
5040
5169
  const callee = current2.getExpression();
5041
- if (!Node22.isPropertyAccessExpression(callee)) {
5170
+ if (!Node23.isPropertyAccessExpression(callee)) {
5042
5171
  return null;
5043
5172
  }
5044
5173
  if (callee.getName() !== expectedMethod) {
@@ -5047,7 +5176,7 @@ function unwrapMethodChain(call, methodChain, func, paramPos) {
5047
5176
  collected.unshift(current2);
5048
5177
  const subject = callee.getExpression();
5049
5178
  if (i === 0) {
5050
- if (!Node22.isIdentifier(subject)) {
5179
+ if (!Node23.isIdentifier(subject)) {
5051
5180
  return null;
5052
5181
  }
5053
5182
  const symbol = subject.getSymbol();
@@ -5059,7 +5188,7 @@ function unwrapMethodChain(call, methodChain, func, paramPos) {
5059
5188
  return null;
5060
5189
  }
5061
5190
  const decl = decls[0];
5062
- if (!Node22.isParameterDeclaration(decl)) {
5191
+ if (!Node23.isParameterDeclaration(decl)) {
5063
5192
  return null;
5064
5193
  }
5065
5194
  const params = func.getParameters();
@@ -5068,7 +5197,7 @@ function unwrapMethodChain(call, methodChain, func, paramPos) {
5068
5197
  return null;
5069
5198
  }
5070
5199
  } else {
5071
- if (!Node22.isCallExpression(subject)) {
5200
+ if (!Node23.isCallExpression(subject)) {
5072
5201
  return null;
5073
5202
  }
5074
5203
  current2 = subject;
@@ -5081,12 +5210,12 @@ function returnedValueOf(returnStatement) {
5081
5210
  return written === void 0 ? null : unwrapValue(written);
5082
5211
  }
5083
5212
  function tryMatchReturnShape(node, pattern, match, resolveWrittenValue) {
5084
- if (Node22.isObjectLiteralExpression(node)) {
5213
+ if (Node23.isObjectLiteralExpression(node)) {
5085
5214
  const source = returnPositionOf(node);
5086
5215
  if (source === null) {
5087
5216
  return [];
5088
5217
  }
5089
- if (Node22.isReturnStatement(source) && returnedValueOf(source) === node) {
5218
+ if (Node23.isReturnStatement(source) && returnedValueOf(source) === node) {
5090
5219
  return [];
5091
5220
  }
5092
5221
  const terminal = terminalFromReturnedObject(
@@ -5099,14 +5228,14 @@ function tryMatchReturnShape(node, pattern, match, resolveWrittenValue) {
5099
5228
  );
5100
5229
  return terminal === null ? [] : [{ ...terminal, source }];
5101
5230
  }
5102
- if (!Node22.isReturnStatement(node)) {
5231
+ if (!Node23.isReturnStatement(node)) {
5103
5232
  return [];
5104
5233
  }
5105
5234
  const returned = returnedValueOf(node);
5106
5235
  if (returned === null) {
5107
5236
  return [];
5108
5237
  }
5109
- if (Node22.isObjectLiteralExpression(returned)) {
5238
+ if (Node23.isObjectLiteralExpression(returned)) {
5110
5239
  const terminal = terminalFromReturnedObject(
5111
5240
  returned,
5112
5241
  node,
@@ -5117,7 +5246,7 @@ function tryMatchReturnShape(node, pattern, match, resolveWrittenValue) {
5117
5246
  );
5118
5247
  return terminal === null ? [] : [terminal];
5119
5248
  }
5120
- if (!Node22.isCallExpression(returned)) {
5249
+ if (!Node23.isCallExpression(returned)) {
5121
5250
  return [];
5122
5251
  }
5123
5252
  const resolved = resolveHelperReturn(returned);
@@ -5154,7 +5283,7 @@ function terminalFromReturnedObject(obj, anchor, pattern, match, substitutions,
5154
5283
  if (required !== void 0 && required.length > 0) {
5155
5284
  const presentNames = /* @__PURE__ */ new Set();
5156
5285
  for (const prop of obj.getProperties()) {
5157
- if (Node22.isPropertyAssignment(prop) || Node22.isShorthandPropertyAssignment(prop)) {
5286
+ if (Node23.isPropertyAssignment(prop) || Node23.isShorthandPropertyAssignment(prop)) {
5158
5287
  presentNames.add(prop.getName());
5159
5288
  }
5160
5289
  }
@@ -5180,7 +5309,7 @@ function terminalFromReturnedObject(obj, anchor, pattern, match, substitutions,
5180
5309
  // When a helper built the value, the anchor is the caller's own
5181
5310
  // return, so it doubles as the provenance. A value reached any other
5182
5311
  // way leaves this unset and its caller fills it in.
5183
- ...Node22.isReturnStatement(anchor) ? { source: anchor } : {},
5312
+ ...Node23.isReturnStatement(anchor) ? { source: anchor } : {},
5184
5313
  terminal: {
5185
5314
  kind: pattern.kind,
5186
5315
  statusCode,
@@ -5199,7 +5328,7 @@ function terminalFromReturnedObject(obj, anchor, pattern, match, substitutions,
5199
5328
  };
5200
5329
  }
5201
5330
  function tryMatchParameterMethodCall(node, func, pattern, match, resolveWrittenValue) {
5202
- if (!Node22.isCallExpression(node)) {
5331
+ if (!Node23.isCallExpression(node)) {
5203
5332
  return [];
5204
5333
  }
5205
5334
  const result = unwrapMethodChain(
@@ -5264,7 +5393,7 @@ function statusArgument(calls, extraction) {
5264
5393
  }
5265
5394
  function returnCoveredByParameterMethodCall(expr, func, patterns) {
5266
5395
  const current2 = unwrapValue(expr);
5267
- if (!Node22.isCallExpression(current2)) {
5396
+ if (!Node23.isCallExpression(current2)) {
5268
5397
  return false;
5269
5398
  }
5270
5399
  for (const pattern of patterns) {
@@ -5285,7 +5414,7 @@ function returnCoveredByParameterMethodCall(expr, func, patterns) {
5285
5414
  }
5286
5415
  function tryMatchReturnStatement(node, pattern, func, allPatterns) {
5287
5416
  const match = pattern.match.type === "returnStatement" ? pattern.match : null;
5288
- if (Node22.isReturnStatement(node)) {
5417
+ if (Node23.isReturnStatement(node)) {
5289
5418
  const expr = node.getExpression();
5290
5419
  if (match?.excludeCallReturns === true) {
5291
5420
  if (expr === void 0) {
@@ -5304,9 +5433,9 @@ function tryMatchReturnStatement(node, pattern, func, allPatterns) {
5304
5433
  }
5305
5434
  return buildReturnTerminal(node, pattern, body);
5306
5435
  }
5307
- if (Node22.isArrowFunction(node)) {
5436
+ if (Node23.isArrowFunction(node)) {
5308
5437
  const body = node.getBody();
5309
- if (body === void 0 || Node22.isBlock(body)) {
5438
+ if (body === void 0 || Node23.isBlock(body)) {
5310
5439
  return null;
5311
5440
  }
5312
5441
  const shape = extractShape(body);
@@ -5373,20 +5502,20 @@ function unresolvedTerminal(kind, node) {
5373
5502
  };
5374
5503
  }
5375
5504
  function calleeSubject(callee) {
5376
- if (Node22.isIdentifier(callee)) {
5505
+ if (Node23.isIdentifier(callee)) {
5377
5506
  return callee;
5378
5507
  }
5379
- if (Node22.isPropertyAccessExpression(callee)) {
5508
+ if (Node23.isPropertyAccessExpression(callee)) {
5380
5509
  const subject = callee.getExpression();
5381
- return Node22.isIdentifier(subject) ? subject : null;
5510
+ return Node23.isIdentifier(subject) ? subject : null;
5382
5511
  }
5383
5512
  return null;
5384
5513
  }
5385
5514
  function tryMatchFunctionCall(node, pattern, match, resolveWrittenValue) {
5386
- if (!Node22.isCallExpression(node) && !Node22.isNewExpression(node)) {
5515
+ if (!Node23.isCallExpression(node) && !Node23.isNewExpression(node)) {
5387
5516
  return null;
5388
5517
  }
5389
- if (Node22.isNewExpression(node) && returnPositionOf(node) === null) {
5518
+ if (Node23.isNewExpression(node) && returnPositionOf(node) === null) {
5390
5519
  return null;
5391
5520
  }
5392
5521
  const callee = node.getExpression();
@@ -5425,9 +5554,9 @@ function tryMatchFunctionCall(node, pattern, match, resolveWrittenValue) {
5425
5554
  }
5426
5555
 
5427
5556
  // src/terminals/throws.ts
5428
- import { Node as Node23 } from "ts-morph";
5557
+ import { Node as Node24 } from "ts-morph";
5429
5558
  function tryMatchThrowExpression(node, pattern, match, resolveWrittenValue) {
5430
- if (!Node23.isThrowStatement(node)) {
5559
+ if (!Node24.isThrowStatement(node)) {
5431
5560
  return null;
5432
5561
  }
5433
5562
  const thrownExpr = node.getExpression();
@@ -5469,17 +5598,17 @@ function extractThrowMessage(callArgs) {
5469
5598
  return null;
5470
5599
  }
5471
5600
  for (const arg of callArgs) {
5472
- if (Node23.isStringLiteral(arg) || Node23.isNoSubstitutionTemplateLiteral(arg)) {
5601
+ if (Node24.isStringLiteral(arg) || Node24.isNoSubstitutionTemplateLiteral(arg)) {
5473
5602
  return arg.getLiteralValue();
5474
5603
  }
5475
- if (Node23.isTemplateExpression(arg)) {
5604
+ if (Node24.isTemplateExpression(arg)) {
5476
5605
  return arg.getText();
5477
5606
  }
5478
5607
  }
5479
5608
  return null;
5480
5609
  }
5481
5610
  function classifyThrownExpression(thrown, constructorPattern) {
5482
- if (Node23.isCallExpression(thrown) || Node23.isNewExpression(thrown)) {
5611
+ if (Node24.isCallExpression(thrown) || Node24.isNewExpression(thrown)) {
5483
5612
  const calleeText = thrown.getExpression().getText();
5484
5613
  if (constructorPattern !== void 0 && !calleeText.startsWith(constructorPattern)) {
5485
5614
  return null;
@@ -5562,9 +5691,9 @@ function findTerminals(func, patterns, barriers = NO_BARRIERS, resolveWrittenVal
5562
5691
  }
5563
5692
  }
5564
5693
  });
5565
- if (results.length === 0 && Node24.isArrowFunction(func)) {
5694
+ if (results.length === 0 && Node25.isArrowFunction(func)) {
5566
5695
  const body = func.getBody();
5567
- if (body !== void 0 && !Node24.isBlock(body)) {
5696
+ if (body !== void 0 && !Node25.isBlock(body)) {
5568
5697
  for (const pattern of patterns) {
5569
5698
  let found = null;
5570
5699
  if (pattern.match.type === "parameterMethodCall") {
@@ -5599,7 +5728,7 @@ function functionMayFallThrough(func) {
5599
5728
  if (body === void 0) {
5600
5729
  return false;
5601
5730
  }
5602
- if (!Node24.isBlock(body)) {
5731
+ if (!Node25.isBlock(body)) {
5603
5732
  return false;
5604
5733
  }
5605
5734
  const statements = body.getStatements();
@@ -5607,7 +5736,7 @@ function functionMayFallThrough(func) {
5607
5736
  return true;
5608
5737
  }
5609
5738
  const last = statements[statements.length - 1];
5610
- if (Node24.isReturnStatement(last) || Node24.isThrowStatement(last)) {
5739
+ if (Node25.isReturnStatement(last) || Node25.isThrowStatement(last)) {
5611
5740
  return false;
5612
5741
  }
5613
5742
  return true;
@@ -5642,7 +5771,7 @@ function bodyContentOf(func) {
5642
5771
  if (body === void 0) {
5643
5772
  return "absent";
5644
5773
  }
5645
- if (!Node25.isBlock(body)) {
5774
+ if (!Node26.isBlock(body)) {
5646
5775
  return "statements";
5647
5776
  }
5648
5777
  return body.getStatements().length === 0 ? "empty" : "statements";
@@ -5658,7 +5787,7 @@ function countUnmatchedReturns(func, terminals, barriers = NO_BARRIERS) {
5658
5787
  claimed.add(source);
5659
5788
  }
5660
5789
  }
5661
- if (Node25.isArrowFunction(func) && Node25.isExpression(body)) {
5790
+ if (Node26.isArrowFunction(func) && Node26.isExpression(body)) {
5662
5791
  return claimed.has(body) ? 0 : 1;
5663
5792
  }
5664
5793
  let unmatched = 0;
@@ -5671,7 +5800,7 @@ function countUnmatchedReturns(func, terminals, barriers = NO_BARRIERS) {
5671
5800
  traversal.skip();
5672
5801
  return;
5673
5802
  }
5674
- if (!Node25.isReturnStatement(node)) {
5803
+ if (!Node26.isReturnStatement(node)) {
5675
5804
  return;
5676
5805
  }
5677
5806
  if (node.getExpression() === void 0) {
@@ -5790,7 +5919,7 @@ function extractRawBranches(func, terminalPatterns, invocationRecognizers = [],
5790
5919
  }
5791
5920
 
5792
5921
  // src/bootstrap/sourceFileLookup.ts
5793
- import { Node as Node26 } from "ts-morph";
5922
+ import { Node as Node27 } from "ts-morph";
5794
5923
  function createSourceFileLookup(project) {
5795
5924
  const all = project.getSourceFiles();
5796
5925
  const byAbs = /* @__PURE__ */ new Map();
@@ -5843,7 +5972,7 @@ function rangeKey(range) {
5843
5972
  function indexFunctions(sf) {
5844
5973
  const index = /* @__PURE__ */ new Map();
5845
5974
  sf.forEachDescendant((node) => {
5846
- if (!Node26.isFunctionDeclaration(node) && !Node26.isFunctionExpression(node) && !Node26.isArrowFunction(node) && !Node26.isMethodDeclaration(node)) {
5975
+ if (!Node27.isFunctionDeclaration(node) && !Node27.isFunctionExpression(node) && !Node27.isArrowFunction(node) && !Node27.isMethodDeclaration(node)) {
5847
5976
  return;
5848
5977
  }
5849
5978
  const key = rangeKey({ start: startLineOf(node), end: endLineOf(node) });
@@ -6205,13 +6334,13 @@ function fileStampEquals(a, b) {
6205
6334
  }
6206
6335
 
6207
6336
  // src/contract.ts
6208
- import { Node as Node27 } from "ts-morph";
6337
+ import { Node as Node28 } from "ts-morph";
6209
6338
  import { restBinding } from "@suss/behavioral-ir";
6210
6339
  function extractDeclaredBody(node) {
6211
6340
  if (node === void 0) {
6212
6341
  return null;
6213
6342
  }
6214
- if (!Node27.isCallExpression(node)) {
6343
+ if (!Node28.isCallExpression(node)) {
6215
6344
  return null;
6216
6345
  }
6217
6346
  const typeArgs = node.getTypeArguments();
@@ -6225,10 +6354,10 @@ function resolveHandlerPropNode(func) {
6225
6354
  if (parent === void 0) {
6226
6355
  return null;
6227
6356
  }
6228
- if (Node27.isPropertyAssignment(parent)) {
6357
+ if (Node28.isPropertyAssignment(parent)) {
6229
6358
  return parent;
6230
6359
  }
6231
- if (Node27.isMethodDeclaration(func)) {
6360
+ if (Node28.isMethodDeclaration(func)) {
6232
6361
  return func;
6233
6362
  }
6234
6363
  return null;
@@ -6240,11 +6369,11 @@ function findRouterCall(unit) {
6240
6369
  return null;
6241
6370
  }
6242
6371
  const handlersObj = propNode.getParent();
6243
- if (handlersObj === void 0 || !Node27.isObjectLiteralExpression(handlersObj)) {
6372
+ if (handlersObj === void 0 || !Node28.isObjectLiteralExpression(handlersObj)) {
6244
6373
  return null;
6245
6374
  }
6246
6375
  const routerCall = handlersObj.getParent();
6247
- if (routerCall === void 0 || !Node27.isCallExpression(routerCall)) {
6376
+ if (routerCall === void 0 || !Node28.isCallExpression(routerCall)) {
6248
6377
  return null;
6249
6378
  }
6250
6379
  const args = routerCall.getArguments();
@@ -6257,17 +6386,17 @@ function findRouterCall(unit) {
6257
6386
  };
6258
6387
  }
6259
6388
  function resolveContractObject(contractArg) {
6260
- if (Node27.isObjectLiteralExpression(contractArg)) {
6389
+ if (Node28.isObjectLiteralExpression(contractArg)) {
6261
6390
  return contractArg;
6262
6391
  }
6263
- if (Node27.isPropertyAccessExpression(contractArg)) {
6392
+ if (Node28.isPropertyAccessExpression(contractArg)) {
6264
6393
  const base = resolveContractObject(contractArg.getExpression());
6265
- if (base === null || !Node27.isObjectLiteralExpression(base)) {
6394
+ if (base === null || !Node28.isObjectLiteralExpression(base)) {
6266
6395
  return null;
6267
6396
  }
6268
6397
  const propName = contractArg.getName();
6269
6398
  for (const prop of base.getProperties()) {
6270
- if (!Node27.isPropertyAssignment(prop)) {
6399
+ if (!Node28.isPropertyAssignment(prop)) {
6271
6400
  continue;
6272
6401
  }
6273
6402
  if (prop.getName() !== propName) {
@@ -6277,20 +6406,20 @@ function resolveContractObject(contractArg) {
6277
6406
  if (value === void 0) {
6278
6407
  return null;
6279
6408
  }
6280
- if (Node27.isObjectLiteralExpression(value)) {
6409
+ if (Node28.isObjectLiteralExpression(value)) {
6281
6410
  return value;
6282
6411
  }
6283
- if (Node27.isIdentifier(value) || Node27.isPropertyAccessExpression(value)) {
6412
+ if (Node28.isIdentifier(value) || Node28.isPropertyAccessExpression(value)) {
6284
6413
  return resolveContractObject(value);
6285
6414
  }
6286
- if (Node27.isCallExpression(value)) {
6415
+ if (Node28.isCallExpression(value)) {
6287
6416
  return unwrapContractInit(value);
6288
6417
  }
6289
6418
  return null;
6290
6419
  }
6291
6420
  return null;
6292
6421
  }
6293
- if (!Node27.isIdentifier(contractArg)) {
6422
+ if (!Node28.isIdentifier(contractArg)) {
6294
6423
  return null;
6295
6424
  }
6296
6425
  const symbol = contractArg.getSymbol();
@@ -6302,21 +6431,21 @@ function resolveContractObject(contractArg) {
6302
6431
  return null;
6303
6432
  }
6304
6433
  const decl = decls[0];
6305
- if (Node27.isImportSpecifier(decl)) {
6434
+ if (Node28.isImportSpecifier(decl)) {
6306
6435
  const importDecl = decl.getImportDeclaration();
6307
6436
  const sourceFile = importDecl.getModuleSpecifierSourceFile();
6308
6437
  if (sourceFile !== void 0) {
6309
6438
  const exported = exportedDeclarationsOf(sourceFile).get(decl.getName());
6310
6439
  if (exported !== void 0 && exported.length > 0) {
6311
6440
  const exportedDecl = exported[0];
6312
- if (Node27.isVariableDeclaration(exportedDecl)) {
6441
+ if (Node28.isVariableDeclaration(exportedDecl)) {
6313
6442
  return unwrapContractInit(exportedDecl.getInitializer());
6314
6443
  }
6315
6444
  }
6316
6445
  }
6317
6446
  return null;
6318
6447
  }
6319
- if (Node27.isVariableDeclaration(decl)) {
6448
+ if (Node28.isVariableDeclaration(decl)) {
6320
6449
  return unwrapContractInit(decl.getInitializer());
6321
6450
  }
6322
6451
  return null;
@@ -6326,50 +6455,50 @@ function unwrapContractInit(init) {
6326
6455
  return null;
6327
6456
  }
6328
6457
  let node = init;
6329
- while (Node27.isAsExpression(node)) {
6458
+ while (Node28.isAsExpression(node)) {
6330
6459
  node = node.getExpression();
6331
6460
  }
6332
- if (Node27.isCallExpression(node)) {
6461
+ if (Node28.isCallExpression(node)) {
6333
6462
  const args = node.getArguments();
6334
- if (args.length > 0 && Node27.isObjectLiteralExpression(args[0])) {
6463
+ if (args.length > 0 && Node28.isObjectLiteralExpression(args[0])) {
6335
6464
  return args[0];
6336
6465
  }
6337
6466
  return null;
6338
6467
  }
6339
- if (Node27.isObjectLiteralExpression(node)) {
6468
+ if (Node28.isObjectLiteralExpression(node)) {
6340
6469
  return node;
6341
6470
  }
6342
6471
  return null;
6343
6472
  }
6344
6473
  function extractEndpointContract(endpointNode, pattern, framework) {
6345
- if (!Node27.isObjectLiteralExpression(endpointNode)) {
6474
+ if (!Node28.isObjectLiteralExpression(endpointNode)) {
6346
6475
  return null;
6347
6476
  }
6348
6477
  const responses = [];
6349
6478
  let method;
6350
6479
  let path13;
6351
6480
  for (const prop of endpointNode.getProperties()) {
6352
- if (!Node27.isPropertyAssignment(prop)) {
6481
+ if (!Node28.isPropertyAssignment(prop)) {
6353
6482
  continue;
6354
6483
  }
6355
6484
  const propName = prop.getName();
6356
6485
  if (propName === pattern.methodProperty) {
6357
6486
  const val = prop.getInitializer();
6358
- if (val !== void 0 && Node27.isStringLiteral(val)) {
6487
+ if (val !== void 0 && Node28.isStringLiteral(val)) {
6359
6488
  method = val.getLiteralValue();
6360
6489
  }
6361
6490
  }
6362
6491
  if (propName === pattern.pathProperty) {
6363
6492
  const val = prop.getInitializer();
6364
- if (val !== void 0 && Node27.isStringLiteral(val)) {
6493
+ if (val !== void 0 && Node28.isStringLiteral(val)) {
6365
6494
  path13 = val.getLiteralValue();
6366
6495
  }
6367
6496
  }
6368
6497
  if (propName === pattern.responseExtraction.property) {
6369
6498
  const val = prop.getInitializer();
6370
- if (val !== void 0 && Node27.isObjectLiteralExpression(val)) {
6499
+ if (val !== void 0 && Node28.isObjectLiteralExpression(val)) {
6371
6500
  for (const respProp of val.getProperties()) {
6372
- if (!Node27.isPropertyAssignment(respProp)) {
6501
+ if (!Node28.isPropertyAssignment(respProp)) {
6373
6502
  continue;
6374
6503
  }
6375
6504
  const statusStr = respProp.getName();
@@ -6413,11 +6542,11 @@ function readContract(unit, pattern, framework) {
6413
6542
  return null;
6414
6543
  }
6415
6544
  const contractObj = resolveContractObject(routerInfo.contractArg);
6416
- if (contractObj === null || !Node27.isObjectLiteralExpression(contractObj)) {
6545
+ if (contractObj === null || !Node28.isObjectLiteralExpression(contractObj)) {
6417
6546
  return null;
6418
6547
  }
6419
6548
  for (const prop of contractObj.getProperties()) {
6420
- if (!Node27.isPropertyAssignment(prop)) {
6549
+ if (!Node28.isPropertyAssignment(prop)) {
6421
6550
  continue;
6422
6551
  }
6423
6552
  if (prop.getName() !== routerInfo.handlerName) {
@@ -6437,7 +6566,7 @@ function endpointFromRegistrationArgument(unit, position) {
6437
6566
  return null;
6438
6567
  }
6439
6568
  const call = func.getParent();
6440
- if (call === void 0 || !Node27.isCallExpression(call)) {
6569
+ if (call === void 0 || !Node28.isCallExpression(call)) {
6441
6570
  return null;
6442
6571
  }
6443
6572
  const args = call.getArguments();
@@ -6449,24 +6578,24 @@ function endpointFromRegistrationArgument(unit, position) {
6449
6578
  return null;
6450
6579
  }
6451
6580
  let node = arg;
6452
- while (Node27.isAsExpression(node)) {
6581
+ while (Node28.isAsExpression(node)) {
6453
6582
  node = node.getExpression();
6454
6583
  }
6455
- if (Node27.isObjectLiteralExpression(node)) {
6584
+ if (Node28.isObjectLiteralExpression(node)) {
6456
6585
  return node;
6457
6586
  }
6458
- if (Node27.isCallExpression(node)) {
6587
+ if (Node28.isCallExpression(node)) {
6459
6588
  return unwrapContractInit(node);
6460
6589
  }
6461
6590
  return resolveContractObject(node);
6462
6591
  }
6463
6592
  function readContractForClientCall(callExpression, methodName, pattern, framework) {
6464
- const callee = Node27.isCallExpression(callExpression) ? callExpression.getExpression() : null;
6465
- if (callee === null || !Node27.isPropertyAccessExpression(callee)) {
6593
+ const callee = Node28.isCallExpression(callExpression) ? callExpression.getExpression() : null;
6594
+ if (callee === null || !Node28.isPropertyAccessExpression(callee)) {
6466
6595
  return null;
6467
6596
  }
6468
6597
  const clientIdentifier = callee.getExpression();
6469
- if (!Node27.isIdentifier(clientIdentifier)) {
6598
+ if (!Node28.isIdentifier(clientIdentifier)) {
6470
6599
  return null;
6471
6600
  }
6472
6601
  const symbol = clientIdentifier.getSymbol();
@@ -6478,11 +6607,11 @@ function readContractForClientCall(callExpression, methodName, pattern, framewor
6478
6607
  return null;
6479
6608
  }
6480
6609
  const decl = decls[0];
6481
- if (!Node27.isVariableDeclaration(decl)) {
6610
+ if (!Node28.isVariableDeclaration(decl)) {
6482
6611
  return null;
6483
6612
  }
6484
6613
  const init = decl.getInitializer();
6485
- if (init === void 0 || !Node27.isCallExpression(init)) {
6614
+ if (init === void 0 || !Node28.isCallExpression(init)) {
6486
6615
  return null;
6487
6616
  }
6488
6617
  const args = init.getArguments();
@@ -6490,11 +6619,11 @@ function readContractForClientCall(callExpression, methodName, pattern, framewor
6490
6619
  return null;
6491
6620
  }
6492
6621
  const contractObj = resolveContractObject(args[0]);
6493
- if (contractObj === null || !Node27.isObjectLiteralExpression(contractObj)) {
6622
+ if (contractObj === null || !Node28.isObjectLiteralExpression(contractObj)) {
6494
6623
  return null;
6495
6624
  }
6496
6625
  for (const prop of contractObj.getProperties()) {
6497
- if (!Node27.isPropertyAssignment(prop)) {
6626
+ if (!Node28.isPropertyAssignment(prop)) {
6498
6627
  continue;
6499
6628
  }
6500
6629
  if (prop.getName() !== methodName) {
@@ -6774,7 +6903,7 @@ function parameterName(segment, convention) {
6774
6903
 
6775
6904
  // src/discovery/graphqlClientConstruction.ts
6776
6905
  import picomatch from "picomatch";
6777
- import { Node as Node31 } from "ts-morph";
6906
+ import { Node as Node32 } from "ts-morph";
6778
6907
  import {
6779
6908
  isGraphqlOperationBinding,
6780
6909
  readGraphqlMetadata,
@@ -6782,16 +6911,16 @@ import {
6782
6911
  } from "@suss/behavioral-ir";
6783
6912
 
6784
6913
  // src/discovery/resolveValue.ts
6785
- import { Node as Node30 } from "ts-morph";
6914
+ import { Node as Node31 } from "ts-morph";
6786
6915
 
6787
6916
  // src/facts/extract.ts
6788
6917
  import {
6789
- Node as Node29,
6790
- SyntaxKind as SyntaxKind7
6918
+ Node as Node30,
6919
+ SyntaxKind as SyntaxKind8
6791
6920
  } from "ts-morph";
6792
6921
 
6793
6922
  // src/discovery/shared.ts
6794
- import { Node as Node28 } from "ts-morph";
6923
+ import { Node as Node29 } from "ts-morph";
6795
6924
  function unitNode(unit) {
6796
6925
  return unit.func ?? unit.announcedAt ?? null;
6797
6926
  }
@@ -6815,37 +6944,37 @@ function unitDedupKey(unit) {
6815
6944
  return parts.join("-");
6816
6945
  }
6817
6946
  function isFunctionRoot(node) {
6818
- return Node28.isFunctionDeclaration(node) || Node28.isFunctionExpression(node) || Node28.isArrowFunction(node) || Node28.isMethodDeclaration(node);
6947
+ return Node29.isFunctionDeclaration(node) || Node29.isFunctionExpression(node) || Node29.isArrowFunction(node) || Node29.isMethodDeclaration(node);
6819
6948
  }
6820
6949
  function declarationCarryingTheBody(declaration) {
6821
- if (!Node28.isFunctionDeclaration(declaration) && !Node28.isMethodDeclaration(declaration)) {
6950
+ if (!Node29.isFunctionDeclaration(declaration) && !Node29.isMethodDeclaration(declaration)) {
6822
6951
  return declaration;
6823
6952
  }
6824
6953
  return declaration.getImplementation() ?? declaration;
6825
6954
  }
6826
6955
  function couldResolveToFunction(value) {
6827
- return Node28.isCallExpression(value) || Node28.isIdentifier(value) || Node28.isPropertyAccessExpression(value) || Node28.isExportSpecifier(value) || Node28.isImportSpecifier(value) || Node28.isImportClause(value) || Node28.isBindingElement(value);
6956
+ return Node29.isCallExpression(value) || Node29.isIdentifier(value) || Node29.isPropertyAccessExpression(value) || Node29.isExportSpecifier(value) || Node29.isImportSpecifier(value) || Node29.isImportClause(value) || Node29.isBindingElement(value);
6828
6957
  }
6829
6958
  function couldStillNameAFunction(value) {
6830
6959
  if (!couldResolveToFunction(value)) {
6831
6960
  return false;
6832
6961
  }
6833
- if (!Node28.isIdentifier(value)) {
6962
+ if (!Node29.isIdentifier(value)) {
6834
6963
  return true;
6835
6964
  }
6836
6965
  const declaration = value.getSymbol()?.getDeclarations()?.[0];
6837
- if (declaration === void 0 || !Node28.isVariableDeclaration(declaration)) {
6966
+ if (declaration === void 0 || !Node29.isVariableDeclaration(declaration)) {
6838
6967
  return true;
6839
6968
  }
6840
6969
  const written = declaration.getInitializer();
6841
6970
  return written === void 0 || isFunctionRoot(written) || couldResolveToFunction(written);
6842
6971
  }
6843
6972
  function namesAParameter(value) {
6844
- if (!Node28.isIdentifier(value)) {
6973
+ if (!Node29.isIdentifier(value)) {
6845
6974
  return false;
6846
6975
  }
6847
6976
  const declaration = value.getSymbol()?.getDeclarations()?.[0];
6848
- return declaration !== void 0 && Node28.isParameterDeclaration(declaration);
6977
+ return declaration !== void 0 && Node29.isParameterDeclaration(declaration);
6849
6978
  }
6850
6979
  function toFunctionRoot(node) {
6851
6980
  return isFunctionRoot(node) ? declarationCarryingTheBody(node) : null;
@@ -6853,7 +6982,7 @@ function toFunctionRoot(node) {
6853
6982
  function findEnclosingFunction(node) {
6854
6983
  let current2 = node.getParent();
6855
6984
  while (current2 !== void 0) {
6856
- if (Node28.isFunctionDeclaration(current2) || Node28.isFunctionExpression(current2) || Node28.isArrowFunction(current2) || Node28.isMethodDeclaration(current2)) {
6985
+ if (Node29.isFunctionDeclaration(current2) || Node29.isFunctionExpression(current2) || Node29.isArrowFunction(current2) || Node29.isMethodDeclaration(current2)) {
6857
6986
  return current2;
6858
6987
  }
6859
6988
  current2 = current2.getParent();
@@ -6886,10 +7015,10 @@ function moduleKeyOf(declaration) {
6886
7015
  }
6887
7016
  function importOriginsOf(callee) {
6888
7017
  let root = callee;
6889
- while (Node29.isPropertyAccessExpression(root)) {
7018
+ while (Node30.isPropertyAccessExpression(root)) {
6890
7019
  root = root.getExpression();
6891
7020
  }
6892
- if (!Node29.isIdentifier(root)) {
7021
+ if (!Node30.isIdentifier(root)) {
6893
7022
  return [];
6894
7023
  }
6895
7024
  const symbol = root.getSymbol();
@@ -6904,7 +7033,7 @@ function importOriginsOf(callee) {
6904
7033
  origins.add(packagePartOf(specifier));
6905
7034
  }
6906
7035
  }
6907
- const named2 = Node29.isPropertyAccessExpression(callee) ? callee.getNameNode().getSymbol() : void 0;
7036
+ const named2 = Node30.isPropertyAccessExpression(callee) ? callee.getNameNode().getSymbol() : void 0;
6908
7037
  for (const candidate of [named2 ?? symbol, symbol]) {
6909
7038
  const aliased = resolveAliasedSymbol(candidate) ?? candidate;
6910
7039
  for (const declaration of aliased.getDeclarations()) {
@@ -6921,17 +7050,17 @@ function importOriginsOf(callee) {
6921
7050
  return [...origins];
6922
7051
  }
6923
7052
  function importSpecifierOf(declaration) {
6924
- if (Node29.isImportSpecifier(declaration)) {
7053
+ if (Node30.isImportSpecifier(declaration)) {
6925
7054
  return declaration.getImportDeclaration().getModuleSpecifierValue();
6926
7055
  }
6927
- if (Node29.isImportEqualsDeclaration(declaration)) {
7056
+ if (Node30.isImportEqualsDeclaration(declaration)) {
6928
7057
  const reference = declaration.getModuleReference();
6929
- return Node29.isExternalModuleReference(reference) ? reference.getExpression()?.getText().slice(1, -1) ?? null : null;
7058
+ return Node30.isExternalModuleReference(reference) ? reference.getExpression()?.getText().slice(1, -1) ?? null : null;
6930
7059
  }
6931
- const owner = Node29.isNamespaceImport(declaration) ? declaration.getParent() : declaration;
6932
- if (Node29.isImportClause(owner)) {
7060
+ const owner = Node30.isNamespaceImport(declaration) ? declaration.getParent() : declaration;
7061
+ if (Node30.isImportClause(owner)) {
6933
7062
  const importDecl = owner.getParent();
6934
- if (Node29.isImportDeclaration(importDecl)) {
7063
+ if (Node30.isImportDeclaration(importDecl)) {
6935
7064
  return importDecl.getModuleSpecifierValue();
6936
7065
  }
6937
7066
  }
@@ -6943,7 +7072,7 @@ function packagePartOf(specifier) {
6943
7072
  return parts.slice(0, take).join("/");
6944
7073
  }
6945
7074
  function declaresAValue(declaration) {
6946
- return !Node29.isPropertySignature(declaration) && !Node29.isMethodSignature(declaration);
7075
+ return !Node30.isPropertySignature(declaration) && !Node30.isMethodSignature(declaration);
6947
7076
  }
6948
7077
  function packagesDeclaring(filePath) {
6949
7078
  const marker = "/node_modules/";
@@ -6967,39 +7096,39 @@ function packagesDescribedByTypes(owner) {
6967
7096
  return scoped.length === 2 ? [name, `@${scoped[0]}/${scoped[1]}`] : [name];
6968
7097
  }
6969
7098
  function factKeyOf(value) {
6970
- return Node29.isExpression(value) ? unwrapExpression(value) : value;
7099
+ return Node30.isExpression(value) ? unwrapExpression(value) : value;
6971
7100
  }
6972
7101
  function literalIndexOf(index) {
6973
7102
  if (index === void 0) {
6974
7103
  return null;
6975
7104
  }
6976
- if (Node29.isNumericLiteral(index)) {
7105
+ if (Node30.isNumericLiteral(index)) {
6977
7106
  return String(index.getLiteralValue());
6978
7107
  }
6979
- if (Node29.isStringLiteral(index) || Node29.isNoSubstitutionTemplateLiteral(index)) {
7108
+ if (Node30.isStringLiteral(index) || Node30.isNoSubstitutionTemplateLiteral(index)) {
6980
7109
  return index.getLiteralValue();
6981
7110
  }
6982
7111
  return null;
6983
7112
  }
6984
7113
  function asFallbackExpression(expression) {
6985
- if (!Node29.isBinaryExpression(expression)) {
7114
+ if (!Node30.isBinaryExpression(expression)) {
6986
7115
  return null;
6987
7116
  }
6988
7117
  const operator = expression.getOperatorToken().getKind();
6989
- return operator === SyntaxKind7.BarBarToken || operator === SyntaxKind7.QuestionQuestionToken ? expression : null;
7118
+ return operator === SyntaxKind8.BarBarToken || operator === SyntaxKind8.QuestionQuestionToken ? expression : null;
6990
7119
  }
6991
7120
  function unwrapExpression(expression) {
6992
7121
  let current2 = expression;
6993
7122
  for (; ; ) {
6994
- if (Node29.isAwaitExpression(current2)) {
7123
+ if (Node30.isAwaitExpression(current2)) {
6995
7124
  current2 = current2.getExpression();
6996
7125
  continue;
6997
7126
  }
6998
- if (Node29.isParenthesizedExpression(current2)) {
7127
+ if (Node30.isParenthesizedExpression(current2)) {
6999
7128
  current2 = current2.getExpression();
7000
7129
  continue;
7001
7130
  }
7002
- if (Node29.isAsExpression(current2) || Node29.isSatisfiesExpression(current2)) {
7131
+ if (Node30.isAsExpression(current2) || Node30.isSatisfiesExpression(current2)) {
7003
7132
  current2 = current2.getExpression();
7004
7133
  continue;
7005
7134
  }
@@ -7019,7 +7148,7 @@ function emitValue(db, table, value) {
7019
7148
  emitFunctionFacts(db, table, expression);
7020
7149
  return id;
7021
7150
  }
7022
- if (Node29.isPropertyAccessExpression(expression)) {
7151
+ if (Node30.isPropertyAccessExpression(expression)) {
7023
7152
  fact(
7024
7153
  db,
7025
7154
  "readsProperty",
@@ -7030,11 +7159,11 @@ function emitValue(db, table, value) {
7030
7159
  emitReferenceFacts(db, table, expression);
7031
7160
  return id;
7032
7161
  }
7033
- if (Node29.isIdentifier(expression)) {
7162
+ if (Node30.isIdentifier(expression)) {
7034
7163
  emitReferenceFacts(db, table, expression);
7035
7164
  return id;
7036
7165
  }
7037
- if (Node29.isElementAccessExpression(expression)) {
7166
+ if (Node30.isElementAccessExpression(expression)) {
7038
7167
  const index = literalIndexOf(expression.getArgumentExpression());
7039
7168
  if (index !== null) {
7040
7169
  fact(
@@ -7049,7 +7178,7 @@ function emitValue(db, table, value) {
7049
7178
  fact(db, "writtenValue", id);
7050
7179
  return id;
7051
7180
  }
7052
- if (Node29.isArrayLiteralExpression(expression)) {
7181
+ if (Node30.isArrayLiteralExpression(expression)) {
7053
7182
  fact(db, "objectValue", id);
7054
7183
  const elements = expression.getElements();
7055
7184
  for (let position = 0; position < elements.length; position++) {
@@ -7067,10 +7196,10 @@ function emitValue(db, table, value) {
7067
7196
  }
7068
7197
  return id;
7069
7198
  }
7070
- if (Node29.isObjectLiteralExpression(expression)) {
7199
+ if (Node30.isObjectLiteralExpression(expression)) {
7071
7200
  fact(db, "objectValue", id);
7072
7201
  for (const property of expression.getProperties()) {
7073
- if (Node29.isPropertyAssignment(property)) {
7202
+ if (Node30.isPropertyAssignment(property)) {
7074
7203
  const held = property.getInitializer();
7075
7204
  if (held !== void 0) {
7076
7205
  fact(
@@ -7081,7 +7210,7 @@ function emitValue(db, table, value) {
7081
7210
  emitValue(db, table, held)
7082
7211
  );
7083
7212
  }
7084
- } else if (Node29.isShorthandPropertyAssignment(property)) {
7213
+ } else if (Node30.isShorthandPropertyAssignment(property)) {
7085
7214
  fact(
7086
7215
  db,
7087
7216
  "holdsProperty",
@@ -7089,7 +7218,7 @@ function emitValue(db, table, value) {
7089
7218
  property.getName(),
7090
7219
  emitValue(db, table, property.getNameNode())
7091
7220
  );
7092
- } else if (Node29.isMethodDeclaration(property)) {
7221
+ } else if (Node30.isMethodDeclaration(property)) {
7093
7222
  const methodId = nodeId(property);
7094
7223
  table.byId.set(methodId, property);
7095
7224
  fact(db, "func", methodId);
@@ -7105,7 +7234,7 @@ function emitValue(db, table, value) {
7105
7234
  fact(db, "fallbackBranch", id, emitValue(db, table, fallback.getRight()));
7106
7235
  return id;
7107
7236
  }
7108
- if (Node29.isCallExpression(expression) || Node29.isNewExpression(expression)) {
7237
+ if (Node30.isCallExpression(expression) || Node30.isNewExpression(expression)) {
7109
7238
  emitCallFacts(db, table, expression);
7110
7239
  fact(db, "writtenValue", id);
7111
7240
  return id;
@@ -7132,7 +7261,7 @@ function emitBindingValues(db, table, declaration) {
7132
7261
  function emitFieldValues(db, table, declaration) {
7133
7262
  const { values, inOrder } = writesToField(declaration);
7134
7263
  const last = values[values.length - 1];
7135
- if (!inOrder || last === void 0 || !Node29.isExpression(last)) {
7264
+ if (!inOrder || last === void 0 || !Node30.isExpression(last)) {
7136
7265
  return;
7137
7266
  }
7138
7267
  fact(db, "binds", nodeId(declaration), emitValue(db, table, last));
@@ -7143,7 +7272,7 @@ function emitParameterPropertyRead(db, table, referenceId, declaration) {
7143
7272
  if (!inOrder || last === void 0) {
7144
7273
  return;
7145
7274
  }
7146
- if (!Node29.isExpression(last)) {
7275
+ if (!Node30.isExpression(last)) {
7147
7276
  table.byId.set(nodeId(last), last);
7148
7277
  fact(db, "binds", referenceId, nodeId(last));
7149
7278
  return;
@@ -7158,7 +7287,7 @@ function emitBindingElementFacts(db, table, element) {
7158
7287
  }
7159
7288
  table.seenBindings.add(element);
7160
7289
  const pattern = element.getParent();
7161
- const container = Node29.isObjectBindingPattern(pattern) ? containerOfBindingPattern(pattern) : void 0;
7290
+ const container = Node30.isObjectBindingPattern(pattern) ? containerOfBindingPattern(pattern) : void 0;
7162
7291
  if (container !== void 0) {
7163
7292
  const property = element.getPropertyNameNode() ?? element.getNameNode();
7164
7293
  fact(
@@ -7177,11 +7306,11 @@ function emitBindingElementFacts(db, table, element) {
7177
7306
  }
7178
7307
  function containerOfBindingPattern(pattern) {
7179
7308
  const declaration = pattern.getParent();
7180
- return Node29.isVariableDeclaration(declaration) ? declaration.getInitializer() : void 0;
7309
+ return Node30.isVariableDeclaration(declaration) ? declaration.getInitializer() : void 0;
7181
7310
  }
7182
7311
  function referencedSymbol(nameNode) {
7183
7312
  const parent = nameNode.getParent();
7184
- if (parent !== void 0 && Node29.isShorthandPropertyAssignment(parent) && parent.getNameNode() === nameNode) {
7313
+ if (parent !== void 0 && Node30.isShorthandPropertyAssignment(parent) && parent.getNameNode() === nameNode) {
7185
7314
  return parent.getValueSymbol();
7186
7315
  }
7187
7316
  return nameNode.getSymbol();
@@ -7189,7 +7318,7 @@ function referencedSymbol(nameNode) {
7189
7318
  function emitReferenceFacts(db, table, reference) {
7190
7319
  const referenceId = nodeId(reference);
7191
7320
  table.byId.set(referenceId, reference);
7192
- const nameNode = Node29.isPropertyAccessExpression(reference) ? reference.getNameNode() : reference;
7321
+ const nameNode = Node30.isPropertyAccessExpression(reference) ? reference.getNameNode() : reference;
7193
7322
  const symbol = referencedSymbol(nameNode);
7194
7323
  if (symbol === void 0) {
7195
7324
  return;
@@ -7198,7 +7327,7 @@ function emitReferenceFacts(db, table, reference) {
7198
7327
  const declaration = declarationCarryingTheBody(spelling);
7199
7328
  const declarationId = nodeId(declaration);
7200
7329
  table.byId.set(declarationId, declaration);
7201
- if (Node29.isImportSpecifier(declaration)) {
7330
+ if (Node30.isImportSpecifier(declaration)) {
7202
7331
  const importDecl = declaration.getImportDeclaration();
7203
7332
  const moduleKey = moduleKeyOf(importDecl);
7204
7333
  if (moduleKey !== null) {
@@ -7207,9 +7336,9 @@ function emitReferenceFacts(db, table, reference) {
7207
7336
  }
7208
7337
  continue;
7209
7338
  }
7210
- if (Node29.isImportClause(declaration)) {
7339
+ if (Node30.isImportClause(declaration)) {
7211
7340
  const importDecl = declaration.getParentIfKind(
7212
- SyntaxKind7.ImportDeclaration
7341
+ SyntaxKind8.ImportDeclaration
7213
7342
  );
7214
7343
  if (importDecl !== void 0) {
7215
7344
  const moduleKey = moduleKeyOf(importDecl);
@@ -7220,30 +7349,30 @@ function emitReferenceFacts(db, table, reference) {
7220
7349
  }
7221
7350
  continue;
7222
7351
  }
7223
- if (Node29.isVariableDeclaration(declaration)) {
7352
+ if (Node30.isVariableDeclaration(declaration)) {
7224
7353
  fact(db, "binds", referenceId, declarationId);
7225
7354
  emitBindingValues(db, table, declaration);
7226
7355
  continue;
7227
7356
  }
7228
- if (Node29.isPropertyDeclaration(declaration)) {
7357
+ if (Node30.isPropertyDeclaration(declaration)) {
7229
7358
  fact(db, "binds", referenceId, declarationId);
7230
7359
  emitFieldValues(db, table, declaration);
7231
7360
  continue;
7232
7361
  }
7233
- if (Node29.isParameterDeclaration(declaration)) {
7234
- if (declaration.isParameterProperty() && Node29.isPropertyAccessExpression(reference)) {
7362
+ if (Node30.isParameterDeclaration(declaration)) {
7363
+ if (declaration.isParameterProperty() && Node30.isPropertyAccessExpression(reference)) {
7235
7364
  emitParameterPropertyRead(db, table, referenceId, declaration);
7236
7365
  } else {
7237
7366
  fact(db, "binds", referenceId, declarationId);
7238
7367
  }
7239
7368
  continue;
7240
7369
  }
7241
- if (Node29.isClassDeclaration(declaration)) {
7370
+ if (Node30.isClassDeclaration(declaration)) {
7242
7371
  fact(db, "binds", referenceId, declarationId);
7243
7372
  emitClassFacts(db, table, declaration);
7244
7373
  continue;
7245
7374
  }
7246
- if (Node29.isBindingElement(declaration)) {
7375
+ if (Node30.isBindingElement(declaration)) {
7247
7376
  fact(db, "binds", referenceId, declarationId);
7248
7377
  emitBindingElementFacts(db, table, declaration);
7249
7378
  continue;
@@ -7259,7 +7388,7 @@ function emitCallFacts(db, table, call) {
7259
7388
  const callId = nodeId(call);
7260
7389
  table.byId.set(callId, call);
7261
7390
  const callee = unwrapExpression(call.getExpression());
7262
- if (Node29.isPropertyAccessExpression(callee) && callee.getName() === "bind") {
7391
+ if (Node30.isPropertyAccessExpression(callee) && callee.getName() === "bind") {
7263
7392
  const target = unwrapExpression(callee.getExpression());
7264
7393
  fact(db, "bindCall", callId, emitValue(db, table, target));
7265
7394
  return;
@@ -7272,7 +7401,7 @@ function emitCallFacts(db, table, call) {
7272
7401
  const args = call.getArguments();
7273
7402
  for (let position = 0; position < args.length; position++) {
7274
7403
  const argument = args[position];
7275
- if (!Node29.isExpression(argument)) {
7404
+ if (!Node30.isExpression(argument)) {
7276
7405
  continue;
7277
7406
  }
7278
7407
  fact(
@@ -7339,11 +7468,11 @@ function emitFunctionFacts(db, table, fn) {
7339
7468
  table.seenFunctions.add(fn);
7340
7469
  const fnId = nodeId(fn);
7341
7470
  table.byId.set(fnId, fn);
7342
- if (Node29.isFunctionDeclaration(fn) || Node29.isFunctionExpression(fn) || Node29.isArrowFunction(fn) || Node29.isMethodDeclaration(fn)) {
7471
+ if (Node30.isFunctionDeclaration(fn) || Node30.isFunctionExpression(fn) || Node30.isArrowFunction(fn) || Node30.isMethodDeclaration(fn)) {
7343
7472
  emitParameters(db, table, fnId, fn.getParameters());
7344
7473
  const body = fn.getBody?.();
7345
7474
  if (body !== void 0) {
7346
- if (Node29.isExpression(body)) {
7475
+ if (Node30.isExpression(body)) {
7347
7476
  fact(db, "returnsValue", fnId, emitValue(db, table, body));
7348
7477
  recordBodyNode(db, table, fnId, body);
7349
7478
  }
@@ -7365,20 +7494,20 @@ function recordBodyNode(db, table, fnId, node) {
7365
7494
  fact(db, "containsFn", fnId, nodeId(node));
7366
7495
  return true;
7367
7496
  }
7368
- if (Node29.isReturnStatement(node)) {
7497
+ if (Node30.isReturnStatement(node)) {
7369
7498
  const returned = node.getExpression();
7370
7499
  if (returned !== void 0) {
7371
7500
  fact(db, "returnsValue", fnId, emitValue(db, table, returned));
7372
7501
  }
7373
7502
  return false;
7374
7503
  }
7375
- if (!Node29.isExpression(node)) {
7504
+ if (!Node30.isExpression(node)) {
7376
7505
  return false;
7377
7506
  }
7378
7507
  const call = unwrapExpression(node);
7379
- if (Node29.isCallExpression(call)) {
7508
+ if (Node30.isCallExpression(call)) {
7380
7509
  const callee = unwrapExpression(call.getExpression());
7381
- if (Node29.isIdentifier(callee) || Node29.isPropertyAccessExpression(callee)) {
7510
+ if (Node30.isIdentifier(callee) || Node30.isPropertyAccessExpression(callee)) {
7382
7511
  fact(db, "bodyCalls", fnId, emitValue(db, table, callee));
7383
7512
  }
7384
7513
  }
@@ -7387,10 +7516,10 @@ function recordBodyNode(db, table, fnId, node) {
7387
7516
  function descendantIsReturned(fn) {
7388
7517
  let current2 = fn.getParent();
7389
7518
  while (current2 !== void 0) {
7390
- if (Node29.isReturnStatement(current2)) {
7519
+ if (Node30.isReturnStatement(current2)) {
7391
7520
  return true;
7392
7521
  }
7393
- if (Node29.isParenthesizedExpression(current2) || Node29.isAsExpression(current2) || Node29.isSatisfiesExpression(current2)) {
7522
+ if (Node30.isParenthesizedExpression(current2) || Node30.isAsExpression(current2) || Node30.isSatisfiesExpression(current2)) {
7394
7523
  current2 = current2.getParent();
7395
7524
  continue;
7396
7525
  }
@@ -7437,19 +7566,19 @@ function extractFileFacts(db, table, sourceFile) {
7437
7566
  fact(db, "exportsAs", filePath, name, id);
7438
7567
  continue;
7439
7568
  }
7440
- if (Node29.isClassDeclaration(declaration)) {
7569
+ if (Node30.isClassDeclaration(declaration)) {
7441
7570
  emitClassFacts(db, table, declaration);
7442
7571
  fact(db, "exportsAs", filePath, name, nodeId(declaration));
7443
7572
  continue;
7444
7573
  }
7445
- if (Node29.isVariableDeclaration(declaration)) {
7574
+ if (Node30.isVariableDeclaration(declaration)) {
7446
7575
  const declarationId = nodeId(declaration);
7447
7576
  table.byId.set(declarationId, declaration);
7448
7577
  fact(db, "exportsAs", filePath, name, declarationId);
7449
7578
  emitBindingValues(db, table, declaration);
7450
7579
  continue;
7451
7580
  }
7452
- if (Node29.isBindingElement(declaration)) {
7581
+ if (Node30.isBindingElement(declaration)) {
7453
7582
  fact(
7454
7583
  db,
7455
7584
  "exportsAs",
@@ -7459,7 +7588,7 @@ function extractFileFacts(db, table, sourceFile) {
7459
7588
  );
7460
7589
  continue;
7461
7590
  }
7462
- if (Node29.isExpression(declaration)) {
7591
+ if (Node30.isExpression(declaration)) {
7463
7592
  fact(
7464
7593
  db,
7465
7594
  "exportsAs",
@@ -7474,13 +7603,13 @@ function extractFileFacts(db, table, sourceFile) {
7474
7603
 
7475
7604
  // src/discovery/resolveValue.ts
7476
7605
  function couldNameAValue(value) {
7477
- return Node30.isIdentifier(value) || Node30.isPropertyAccessExpression(value) || Node30.isElementAccessExpression(value) || Node30.isCallExpression(value);
7606
+ return Node31.isIdentifier(value) || Node31.isPropertyAccessExpression(value) || Node31.isElementAccessExpression(value) || Node31.isCallExpression(value);
7478
7607
  }
7479
7608
  function propertyValueOf(property) {
7480
- if (Node30.isPropertyAssignment(property)) {
7609
+ if (Node31.isPropertyAssignment(property)) {
7481
7610
  return property.getInitializer() ?? null;
7482
7611
  }
7483
- if (Node30.isShorthandPropertyAssignment(property)) {
7612
+ if (Node31.isShorthandPropertyAssignment(property)) {
7484
7613
  return property.getNameNode();
7485
7614
  }
7486
7615
  return null;
@@ -7501,7 +7630,7 @@ function objectLiteralOf(value, resolution) {
7501
7630
  return literalValueOf(
7502
7631
  value,
7503
7632
  resolution,
7504
- (node) => Node30.isObjectLiteralExpression(node)
7633
+ (node) => Node31.isObjectLiteralExpression(node)
7505
7634
  );
7506
7635
  }
7507
7636
  function propertiesOf(object, resolution) {
@@ -7513,7 +7642,7 @@ function propertiesReached(object, resolution, seen) {
7513
7642
  }
7514
7643
  seen.add(object);
7515
7644
  return object.getProperties().flatMap((property) => {
7516
- if (!Node30.isSpreadAssignment(property)) {
7645
+ if (!Node31.isSpreadAssignment(property)) {
7517
7646
  return [property];
7518
7647
  }
7519
7648
  const spread = objectLiteralOf(property.getExpression(), resolution);
@@ -7522,7 +7651,7 @@ function propertiesReached(object, resolution, seen) {
7522
7651
  }
7523
7652
  function writtenNodeOf(value, resolution) {
7524
7653
  const written = factKeyOf(value);
7525
- if (Node30.isCallExpression(written) || Node30.isNewExpression(written)) {
7654
+ if (Node31.isCallExpression(written) || Node31.isNewExpression(written)) {
7526
7655
  return written;
7527
7656
  }
7528
7657
  if (resolution === void 0 || !couldNameAValue(written)) {
@@ -7542,13 +7671,13 @@ function stringValueOf(value, resolution) {
7542
7671
  return resolved !== null && isStringNode(resolved) ? resolved.getLiteralValue() : null;
7543
7672
  }
7544
7673
  function isStringNode(node) {
7545
- return Node30.isStringLiteral(node) || Node30.isNoSubstitutionTemplateLiteral(node);
7674
+ return Node31.isStringLiteral(node) || Node31.isNoSubstitutionTemplateLiteral(node);
7546
7675
  }
7547
7676
  function arrayLiteralOf(value, resolution) {
7548
7677
  return literalValueOf(
7549
7678
  value,
7550
7679
  resolution,
7551
- (node) => Node30.isArrayLiteralExpression(node)
7680
+ (node) => Node31.isArrayLiteralExpression(node)
7552
7681
  );
7553
7682
  }
7554
7683
  function literalValueOf(value, resolution, isWanted) {
@@ -7705,7 +7834,7 @@ function constructionRegistryStatus(construction, spec) {
7705
7834
  if (cacheConstruction === null) {
7706
7835
  return "unknown";
7707
7836
  }
7708
- if (!Node31.isNewExpression(cacheConstruction) && !Node31.isCallExpression(cacheConstruction)) {
7837
+ if (!Node32.isNewExpression(cacheConstruction) && !Node32.isCallExpression(cacheConstruction)) {
7709
7838
  return "unknown";
7710
7839
  }
7711
7840
  const args = cacheConstruction.getArguments();
@@ -7719,15 +7848,15 @@ function constructionRegistryStatus(construction, spec) {
7719
7848
  if (cacheOptions.getProperty(spec.registryProperty) !== void 0) {
7720
7849
  return "configured";
7721
7850
  }
7722
- const hasSpread = cacheOptions.getProperties().some((property) => Node31.isSpreadAssignment(property));
7851
+ const hasSpread = cacheOptions.getProperties().some((property) => Node32.isSpreadAssignment(property));
7723
7852
  return hasSpread ? "unknown" : "absent";
7724
7853
  }
7725
7854
  function firstArgumentObjectLiteral(construction) {
7726
- if (!Node31.isNewExpression(construction) && !Node31.isCallExpression(construction)) {
7855
+ if (!Node32.isNewExpression(construction) && !Node32.isCallExpression(construction)) {
7727
7856
  return null;
7728
7857
  }
7729
7858
  const arg = construction.getArguments()[0];
7730
- if (arg === void 0 || !Node31.isObjectLiteralExpression(arg)) {
7859
+ if (arg === void 0 || !Node32.isObjectLiteralExpression(arg)) {
7731
7860
  return null;
7732
7861
  }
7733
7862
  return arg;
@@ -7737,10 +7866,10 @@ function propertyValueOf2(options, name) {
7737
7866
  if (property === void 0) {
7738
7867
  return null;
7739
7868
  }
7740
- if (Node31.isPropertyAssignment(property)) {
7869
+ if (Node32.isPropertyAssignment(property)) {
7741
7870
  return property.getInitializer() ?? null;
7742
7871
  }
7743
- if (Node31.isShorthandPropertyAssignment(property)) {
7872
+ if (Node32.isShorthandPropertyAssignment(property)) {
7744
7873
  const symbol = property.getProject().getTypeChecker().getShorthandAssignmentValueSymbol(property);
7745
7874
  return symbol?.getValueDeclaration() ?? null;
7746
7875
  }
@@ -7750,13 +7879,13 @@ function resolveToConstructionOf(expression, cacheClass) {
7750
7879
  let current2 = expression;
7751
7880
  for (let hop = 0; hop < 4 && current2 !== void 0; hop += 1) {
7752
7881
  current2 = unwrapExpression2(current2);
7753
- if (Node31.isVariableDeclaration(current2)) {
7882
+ if (Node32.isVariableDeclaration(current2)) {
7754
7883
  current2 = current2.getInitializer();
7755
7884
  continue;
7756
7885
  }
7757
- if (Node31.isNewExpression(current2) || Node31.isCallExpression(current2)) {
7886
+ if (Node32.isNewExpression(current2) || Node32.isCallExpression(current2)) {
7758
7887
  const callee = current2.getExpression();
7759
- if (callee === void 0 || !Node31.isIdentifier(callee)) {
7888
+ if (callee === void 0 || !Node32.isIdentifier(callee)) {
7760
7889
  return null;
7761
7890
  }
7762
7891
  const local = localImportName(
@@ -7766,11 +7895,11 @@ function resolveToConstructionOf(expression, cacheClass) {
7766
7895
  );
7767
7896
  return local !== null && callee.getText() === local ? current2 : null;
7768
7897
  }
7769
- if (!Node31.isIdentifier(current2)) {
7898
+ if (!Node32.isIdentifier(current2)) {
7770
7899
  return null;
7771
7900
  }
7772
7901
  const declaration = current2.getSymbol()?.getValueDeclaration();
7773
- if (declaration === void 0 || !Node31.isVariableDeclaration(declaration)) {
7902
+ if (declaration === void 0 || !Node32.isVariableDeclaration(declaration)) {
7774
7903
  return null;
7775
7904
  }
7776
7905
  current2 = declaration.getInitializer();
@@ -7779,17 +7908,17 @@ function resolveToConstructionOf(expression, cacheClass) {
7779
7908
  }
7780
7909
  function unwrapExpression2(node) {
7781
7910
  let current2 = node;
7782
- while (Node31.isParenthesizedExpression(current2) || Node31.isAsExpression(current2) || Node31.isNonNullExpression(current2)) {
7911
+ while (Node32.isParenthesizedExpression(current2) || Node32.isAsExpression(current2) || Node32.isNonNullExpression(current2)) {
7783
7912
  current2 = current2.getExpression();
7784
7913
  }
7785
7914
  return current2;
7786
7915
  }
7787
7916
  function isConstructionNamed(node, localName) {
7788
- if (!Node31.isNewExpression(node) && !Node31.isCallExpression(node)) {
7917
+ if (!Node32.isNewExpression(node) && !Node32.isCallExpression(node)) {
7789
7918
  return false;
7790
7919
  }
7791
7920
  const callee = node.getExpression();
7792
- return callee !== void 0 && Node31.isIdentifier(callee) && callee.getText() === localName;
7921
+ return callee !== void 0 && Node32.isIdentifier(callee) && callee.getText() === localName;
7793
7922
  }
7794
7923
  function localImportName(sourceFile, importModule, importName) {
7795
7924
  for (const importDecl of sourceFile.getImportDeclarations()) {
@@ -7825,11 +7954,11 @@ function localNamesFor(sourceFile, specs) {
7825
7954
  return names;
7826
7955
  }
7827
7956
  function constructionRef(node, localNames, resolution) {
7828
- if (!Node31.isNewExpression(node) && !Node31.isCallExpression(node)) {
7957
+ if (!Node32.isNewExpression(node) && !Node32.isCallExpression(node)) {
7829
7958
  return null;
7830
7959
  }
7831
7960
  const callee = node.getExpression();
7832
- if (callee === void 0 || !Node31.isIdentifier(callee)) {
7961
+ if (callee === void 0 || !Node32.isIdentifier(callee)) {
7833
7962
  return null;
7834
7963
  }
7835
7964
  const uriProperty = localNames.get(callee.getText());
@@ -7837,11 +7966,11 @@ function constructionRef(node, localNames, resolution) {
7837
7966
  return null;
7838
7967
  }
7839
7968
  const optionsArg = node.getArguments()[0];
7840
- if (optionsArg === void 0 || !Node31.isObjectLiteralExpression(optionsArg)) {
7969
+ if (optionsArg === void 0 || !Node32.isObjectLiteralExpression(optionsArg)) {
7841
7970
  return null;
7842
7971
  }
7843
7972
  const property = optionsArg.getProperty(uriProperty);
7844
- if (property === void 0 || !Node31.isPropertyAssignment(property)) {
7973
+ if (property === void 0 || !Node32.isPropertyAssignment(property)) {
7845
7974
  return null;
7846
7975
  }
7847
7976
  const value = property.getInitializer();
@@ -7857,7 +7986,7 @@ function constructionRef(node, localNames, resolution) {
7857
7986
 
7858
7987
  // src/discovery/clientCall.ts
7859
7988
  import path4 from "path";
7860
- import { Node as Node32 } from "ts-morph";
7989
+ import { Node as Node33 } from "ts-morph";
7861
7990
 
7862
7991
  // src/discovery/resolveImport.ts
7863
7992
  function resolveImportedLocalName(sourceFile, importModule, importName) {
@@ -7901,26 +8030,26 @@ function discoverClientCalls(sourceFile, match, kind, resolution) {
7901
8030
  if (!isGlobal && importedLocalName !== null) {
7902
8031
  for (const varDecl of sourceFile.getVariableDeclarations()) {
7903
8032
  const init = varDecl.getInitializer();
7904
- if (init !== void 0 && (Node32.isCallExpression(init) || Node32.isNewExpression(init)) && isInstanceCreationCall(init, importedLocalName, match.factoryMethods)) {
8033
+ if (init !== void 0 && (Node33.isCallExpression(init) || Node33.isNewExpression(init)) && isInstanceCreationCall(init, importedLocalName, match.factoryMethods)) {
7905
8034
  clientVarNames.add(varDecl.getName());
7906
8035
  }
7907
8036
  }
7908
8037
  }
7909
8038
  const methodFilter = match.methodFilter !== void 0 ? new Set(match.methodFilter) : null;
7910
8039
  sourceFile.forEachDescendant((node) => {
7911
- if (!Node32.isCallExpression(node)) {
8040
+ if (!Node33.isCallExpression(node)) {
7912
8041
  return;
7913
8042
  }
7914
8043
  const callee = node.getExpression();
7915
8044
  let methodName = null;
7916
8045
  let matched = false;
7917
- if (isGlobal && Node32.isIdentifier(callee)) {
8046
+ if (isGlobal && Node33.isIdentifier(callee)) {
7918
8047
  if (callee.getText() === importedLocalName) {
7919
8048
  matched = true;
7920
8049
  }
7921
- } else if (Node32.isPropertyAccessExpression(callee)) {
8050
+ } else if (Node33.isPropertyAccessExpression(callee)) {
7922
8051
  const subject = callee.getExpression();
7923
- if (Node32.isIdentifier(subject) && (importedLocalName !== null && subject.getText() === importedLocalName || clientVarNames.has(subject.getText()) || resolvesToKnownInstance(subject, match, resolution))) {
8052
+ if (Node33.isIdentifier(subject) && (importedLocalName !== null && subject.getText() === importedLocalName || clientVarNames.has(subject.getText()) || resolvesToKnownInstance(subject, match, resolution))) {
7924
8053
  methodName = callee.getName();
7925
8054
  if (methodFilter === null || methodFilter.has(methodName)) {
7926
8055
  matched = true;
@@ -7955,16 +8084,16 @@ function clientReceiverCheckFor(sourceFile, match, resolution) {
7955
8084
  const constructedHere = /* @__PURE__ */ new Set();
7956
8085
  if (localName !== null) {
7957
8086
  sourceFile.forEachDescendant((node) => {
7958
- if (Node32.isVariableDeclaration(node)) {
8087
+ if (Node33.isVariableDeclaration(node)) {
7959
8088
  const init = node.getInitializer();
7960
- if (init !== void 0 && (Node32.isCallExpression(init) || Node32.isNewExpression(init)) && isInstanceCreationCall(init, localName, match.factoryMethods) || typedAsClient(node.getTypeNode(), localName)) {
8089
+ if (init !== void 0 && (Node33.isCallExpression(init) || Node33.isNewExpression(init)) && isInstanceCreationCall(init, localName, match.factoryMethods) || typedAsClient(node.getTypeNode(), localName)) {
7961
8090
  constructedHere.add(node.getName());
7962
8091
  }
7963
8092
  return;
7964
8093
  }
7965
- if (Node32.isParameterDeclaration(node) && typedAsClient(node.getTypeNode(), localName)) {
8094
+ if (Node33.isParameterDeclaration(node) && typedAsClient(node.getTypeNode(), localName)) {
7966
8095
  const written = node.getNameNode();
7967
- if (Node32.isIdentifier(written)) {
8096
+ if (Node33.isIdentifier(written)) {
7968
8097
  constructedHere.add(written.getText());
7969
8098
  }
7970
8099
  }
@@ -7976,10 +8105,10 @@ function clientReceiverCheckFor(sourceFile, match, resolution) {
7976
8105
  importName: match.importName,
7977
8106
  ...match.factoryMethods === void 0 ? {} : { factoryMethods: match.factoryMethods }
7978
8107
  };
7979
- return (subject) => localName !== null && Node32.isIdentifier(subject) && subject.getText() === localName || Node32.isIdentifier(subject) && constructedHere.has(subject.getText()) || resolvesToKnownInstance(subject, full, resolution);
8108
+ return (subject) => localName !== null && Node33.isIdentifier(subject) && subject.getText() === localName || Node33.isIdentifier(subject) && constructedHere.has(subject.getText()) || resolvesToKnownInstance(subject, full, resolution);
7980
8109
  }
7981
8110
  function typedAsClient(typeNode, localName) {
7982
- if (typeNode === void 0 || !Node32.isTypeReference(typeNode)) {
8111
+ if (typeNode === void 0 || !Node33.isTypeReference(typeNode)) {
7983
8112
  return false;
7984
8113
  }
7985
8114
  return typeNode.getTypeName().getText() === localName;
@@ -7989,7 +8118,7 @@ function resolvesToKnownInstance(subject, match, resolution) {
7989
8118
  return false;
7990
8119
  }
7991
8120
  const written = writtenNodeOf(subject, resolution);
7992
- if (written === null || !Node32.isCallExpression(written) && !Node32.isNewExpression(written)) {
8121
+ if (written === null || !Node33.isCallExpression(written) && !Node33.isNewExpression(written)) {
7993
8122
  return false;
7994
8123
  }
7995
8124
  const writtenLocalName = resolvedImportLocalName(
@@ -8070,31 +8199,31 @@ function withoutSourceExtension(filePath) {
8070
8199
  return filePath.replace(/\.(ts|tsx|js|jsx|mjs|cjs)$/, "").replace(/\/index$/, "");
8071
8200
  }
8072
8201
  function clientUnitName(enclosingFunc, methodName) {
8073
- if (Node32.isFunctionDeclaration(enclosingFunc)) {
8202
+ if (Node33.isFunctionDeclaration(enclosingFunc)) {
8074
8203
  return enclosingFunc.getName() ?? methodName ?? "anonymous";
8075
8204
  }
8076
- if (Node32.isMethodDeclaration(enclosingFunc)) {
8205
+ if (Node33.isMethodDeclaration(enclosingFunc)) {
8077
8206
  return enclosingFunc.getName();
8078
8207
  }
8079
8208
  const parent = enclosingFunc.getParent();
8080
- if (parent !== void 0 && Node32.isVariableDeclaration(parent)) {
8209
+ if (parent !== void 0 && Node33.isVariableDeclaration(parent)) {
8081
8210
  return parent.getName();
8082
8211
  }
8083
- if (parent !== void 0 && Node32.isPropertyAssignment(parent)) {
8212
+ if (parent !== void 0 && Node33.isPropertyAssignment(parent)) {
8084
8213
  return parent.getName();
8085
8214
  }
8086
8215
  return methodName ?? "anonymous";
8087
8216
  }
8088
8217
 
8089
8218
  // src/discovery/decoratedMethod.ts
8090
- import { Node as Node35 } from "ts-morph";
8219
+ import { Node as Node36 } from "ts-morph";
8091
8220
 
8092
8221
  // src/discovery/decoratedMembers.ts
8093
- import { Node as Node33 } from "ts-morph";
8222
+ import { Node as Node34 } from "ts-morph";
8094
8223
  function decoratedCallablesOf(cls, decoratorNames) {
8095
8224
  const callables = [];
8096
8225
  for (const member of cls.getMembers()) {
8097
- if (!Node33.isMethodDeclaration(member) && !Node33.isPropertyDeclaration(member)) {
8226
+ if (!Node34.isMethodDeclaration(member) && !Node34.isPropertyDeclaration(member)) {
8098
8227
  continue;
8099
8228
  }
8100
8229
  const func = callableOf(member);
@@ -8118,7 +8247,7 @@ function decoratedCallablesOf(cls, decoratorNames) {
8118
8247
  return callables;
8119
8248
  }
8120
8249
  function callableOf(member) {
8121
- if (Node33.isMethodDeclaration(member)) {
8250
+ if (Node34.isMethodDeclaration(member)) {
8122
8251
  return toFunctionRoot(member);
8123
8252
  }
8124
8253
  const held = member.getInitializer();
@@ -8126,7 +8255,7 @@ function callableOf(member) {
8126
8255
  }
8127
8256
 
8128
8257
  // src/discovery/decoratorComposition.ts
8129
- import { Node as Node34, SyntaxKind as SyntaxKind8 } from "ts-morph";
8258
+ import { Node as Node35, SyntaxKind as SyntaxKind9 } from "ts-morph";
8130
8259
  function classDecoratorStandingFor(cls, names, modules, resolution) {
8131
8260
  for (const candidate of names) {
8132
8261
  const decorator = cls.getDecorator(candidate);
@@ -8164,7 +8293,7 @@ function frameworkArgs(decorator, standsFor, modules, resolution) {
8164
8293
  if (wrapper === null) {
8165
8294
  return atClass;
8166
8295
  }
8167
- for (const call of wrapper.getDescendantsOfKind(SyntaxKind8.CallExpression)) {
8296
+ for (const call of wrapper.getDescendantsOfKind(SyntaxKind9.CallExpression)) {
8168
8297
  const names = resolution.importedNamesOf(call.getExpression(), modules);
8169
8298
  if (!names.includes(standsFor)) {
8170
8299
  continue;
@@ -8175,10 +8304,10 @@ function frameworkArgs(decorator, standsFor, modules, resolution) {
8175
8304
  return atClass;
8176
8305
  }
8177
8306
  function statesAValue(arg, wrapper) {
8178
- const identifiers = Node34.isIdentifier(arg) ? [arg] : arg.getDescendantsOfKind(SyntaxKind8.Identifier);
8307
+ const identifiers = Node35.isIdentifier(arg) ? [arg] : arg.getDescendantsOfKind(SyntaxKind9.Identifier);
8179
8308
  return !identifiers.some(
8180
8309
  (identifier) => identifier.getSymbol()?.getDeclarations().some(
8181
- (declaration) => Node34.isParameterDeclaration(declaration) && isWithin(declaration, wrapper)
8310
+ (declaration) => Node35.isParameterDeclaration(declaration) && isWithin(declaration, wrapper)
8182
8311
  )
8183
8312
  );
8184
8313
  }
@@ -8198,39 +8327,39 @@ function resolverTypeName(args) {
8198
8327
  return args.typeMap[args.decoratorName] ?? args.classTypeName ?? null;
8199
8328
  }
8200
8329
  function resolveResolverClassTypeName(decoratorArg) {
8201
- if (Node35.isArrowFunction(decoratorArg)) {
8330
+ if (Node36.isArrowFunction(decoratorArg)) {
8202
8331
  const body = decoratorArg.getBody();
8203
- if (Node35.isIdentifier(body)) {
8332
+ if (Node36.isIdentifier(body)) {
8204
8333
  return body.getText();
8205
8334
  }
8206
8335
  return null;
8207
8336
  }
8208
- if (Node35.isStringLiteral(decoratorArg)) {
8337
+ if (Node36.isStringLiteral(decoratorArg)) {
8209
8338
  return decoratorArg.getLiteralValue();
8210
8339
  }
8211
- if (Node35.isIdentifier(decoratorArg)) {
8340
+ if (Node36.isIdentifier(decoratorArg)) {
8212
8341
  return decoratorArg.getText();
8213
8342
  }
8214
8343
  return null;
8215
8344
  }
8216
8345
  function resolveOperationNameOverride(decorator) {
8217
- if (!Node35.isDecorator(decorator)) {
8346
+ if (!Node36.isDecorator(decorator)) {
8218
8347
  return null;
8219
8348
  }
8220
8349
  const args = decorator.getArguments();
8221
8350
  for (const arg of args) {
8222
- if (!Node35.isObjectLiteralExpression(arg)) {
8351
+ if (!Node36.isObjectLiteralExpression(arg)) {
8223
8352
  continue;
8224
8353
  }
8225
8354
  const prop = arg.getProperty("name");
8226
- if (prop === void 0 || !Node35.isPropertyAssignment(prop)) {
8355
+ if (prop === void 0 || !Node36.isPropertyAssignment(prop)) {
8227
8356
  continue;
8228
8357
  }
8229
8358
  const init = prop.getInitializer();
8230
8359
  if (init === void 0) {
8231
8360
  continue;
8232
8361
  }
8233
- if (Node35.isStringLiteral(init) || Node35.isNoSubstitutionTemplateLiteral(init)) {
8362
+ if (Node36.isStringLiteral(init) || Node36.isNoSubstitutionTemplateLiteral(init)) {
8234
8363
  return init.getLiteralValue();
8235
8364
  }
8236
8365
  }
@@ -8288,9 +8417,9 @@ function discoverDecoratedMethods(sourceFile, match, kind, resolution) {
8288
8417
  }
8289
8418
 
8290
8419
  // src/discovery/decoratedRoute.ts
8291
- import { Node as Node36 } from "ts-morph";
8420
+ import { Node as Node37 } from "ts-morph";
8292
8421
  function resolveRoutePathArg(decorator, resolution) {
8293
- if (!Node36.isDecorator(decorator)) {
8422
+ if (!Node37.isDecorator(decorator)) {
8294
8423
  return "";
8295
8424
  }
8296
8425
  return routePathOf(decorator.getArguments(), resolution);
@@ -8318,7 +8447,7 @@ function declaredChannelOf(source, decorator, resolution) {
8318
8447
  if (source.from === "unstated") {
8319
8448
  return null;
8320
8449
  }
8321
- if (!Node36.isDecorator(decorator)) {
8450
+ if (!Node37.isDecorator(decorator)) {
8322
8451
  return null;
8323
8452
  }
8324
8453
  const arg = decorator.getArguments()[source.position];
@@ -8329,7 +8458,7 @@ function declaredChannelOf(source, decorator, resolution) {
8329
8458
  return text === null || text === "" ? null : text;
8330
8459
  }
8331
8460
  function literalStringOf(node, resolution) {
8332
- if (Node36.isStringLiteral(node) || Node36.isNoSubstitutionTemplateLiteral(node)) {
8461
+ if (Node37.isStringLiteral(node) || Node37.isNoSubstitutionTemplateLiteral(node)) {
8333
8462
  return node.getLiteralValue();
8334
8463
  }
8335
8464
  const written = resolution?.resolveWrittenValue(node) ?? null;
@@ -8405,32 +8534,32 @@ import picomatch2 from "picomatch";
8405
8534
 
8406
8535
  // src/discovery/namedExport.ts
8407
8536
  import {
8408
- Node as Node37
8537
+ Node as Node38
8409
8538
  } from "ts-morph";
8410
8539
  function nameWrittenAt(expression) {
8411
- if (Node37.isIdentifier(expression)) {
8540
+ if (Node38.isIdentifier(expression)) {
8412
8541
  return expression.getText();
8413
8542
  }
8414
- if (Node37.isPropertyAccessExpression(expression)) {
8543
+ if (Node38.isPropertyAccessExpression(expression)) {
8415
8544
  return expression.getName();
8416
8545
  }
8417
8546
  return null;
8418
8547
  }
8419
8548
  function resolveDefaultExportName(decl, fn) {
8420
- if (Node37.isFunctionDeclaration(fn) || Node37.isFunctionExpression(fn)) {
8549
+ if (Node38.isFunctionDeclaration(fn) || Node38.isFunctionExpression(fn)) {
8421
8550
  const n = fn.getName?.();
8422
8551
  if (typeof n === "string" && n.length > 0) {
8423
8552
  return n;
8424
8553
  }
8425
8554
  }
8426
- if (Node37.isVariableDeclaration(decl)) {
8555
+ if (Node38.isVariableDeclaration(decl)) {
8427
8556
  const name = decl.getName();
8428
8557
  if (name.length > 0) {
8429
8558
  return name;
8430
8559
  }
8431
8560
  }
8432
8561
  const binding = fn.getParent();
8433
- if (binding !== void 0 && Node37.isVariableDeclaration(binding)) {
8562
+ if (binding !== void 0 && Node38.isVariableDeclaration(binding)) {
8434
8563
  const name = binding.getName();
8435
8564
  if (name.length > 0) {
8436
8565
  return name;
@@ -8485,7 +8614,7 @@ function discoverNamedExports(sourceFile, match, kind, resolution) {
8485
8614
  }
8486
8615
  continue;
8487
8616
  }
8488
- if (Node37.isArrowFunction(init) || Node37.isFunctionExpression(init)) {
8617
+ if (Node38.isArrowFunction(init) || Node38.isFunctionExpression(init)) {
8489
8618
  results.push({
8490
8619
  func: init,
8491
8620
  kind,
@@ -8591,7 +8720,7 @@ function discoverFileConventions(sourceFile, match, kind, resolution) {
8591
8720
  }
8592
8721
 
8593
8722
  // src/discovery/graphqlHookCall.ts
8594
- import { Node as Node39 } from "ts-morph";
8723
+ import { Node as Node40 } from "ts-morph";
8595
8724
 
8596
8725
  // src/discovery/graphqlShared.ts
8597
8726
  import fs3 from "fs";
@@ -8601,7 +8730,7 @@ import {
8601
8730
  parse as graphqlParse,
8602
8731
  print as graphqlPrint
8603
8732
  } from "graphql";
8604
- import { Node as Node38 } from "ts-morph";
8733
+ import { Node as Node39 } from "ts-morph";
8605
8734
  var DOCUMENT_TAGS = /* @__PURE__ */ new Set(["gql", "graphql"]);
8606
8735
  var UNQUALIFIED_DOCUMENT_TAG = "gql";
8607
8736
  function parseGraphqlOperation(source) {
@@ -8667,10 +8796,10 @@ function startAssembly(resolution) {
8667
8796
  };
8668
8797
  }
8669
8798
  function assembledTemplateText(template, assembly) {
8670
- if (Node38.isNoSubstitutionTemplateLiteral(template)) {
8799
+ if (Node39.isNoSubstitutionTemplateLiteral(template)) {
8671
8800
  return innerTemplateText(template);
8672
8801
  }
8673
- if (!Node38.isTemplateExpression(template)) {
8802
+ if (!Node39.isTemplateExpression(template)) {
8674
8803
  return null;
8675
8804
  }
8676
8805
  let text = template.getHead().getLiteralText();
@@ -8806,7 +8935,7 @@ function collectDanglingSpreads(selectionSet, defined, dangling) {
8806
8935
  }
8807
8936
  }
8808
8937
  function documentTextFromExpression(node, assembly) {
8809
- if (Node38.isTaggedTemplateExpression(node)) {
8938
+ if (Node39.isTaggedTemplateExpression(node)) {
8810
8939
  if (!isDocumentTag(node.getTag())) {
8811
8940
  return null;
8812
8941
  }
@@ -8816,7 +8945,7 @@ function documentTextFromExpression(node, assembly) {
8816
8945
  assembly.seen.add(node);
8817
8946
  return assembledTemplateText(node.getTemplate(), assembly);
8818
8947
  }
8819
- if (!Node38.isCallExpression(node)) {
8948
+ if (!Node39.isCallExpression(node)) {
8820
8949
  return null;
8821
8950
  }
8822
8951
  if (!isDocumentTag(node.getExpression())) {
@@ -8827,7 +8956,7 @@ function documentTextFromExpression(node, assembly) {
8827
8956
  return null;
8828
8957
  }
8829
8958
  const template = stripDocumentNodeCasts(first);
8830
- if (!Node38.isNoSubstitutionTemplateLiteral(template) && !Node38.isTemplateExpression(template)) {
8959
+ if (!Node39.isNoSubstitutionTemplateLiteral(template) && !Node39.isTemplateExpression(template)) {
8831
8960
  return null;
8832
8961
  }
8833
8962
  if (assembly.seen.has(node)) {
@@ -8837,7 +8966,7 @@ function documentTextFromExpression(node, assembly) {
8837
8966
  return assembledTemplateText(template, assembly);
8838
8967
  }
8839
8968
  function isDocumentTag(tag) {
8840
- if (!Node38.isIdentifier(tag)) {
8969
+ if (!Node39.isIdentifier(tag)) {
8841
8970
  return false;
8842
8971
  }
8843
8972
  if (tag.getText() === UNQUALIFIED_DOCUMENT_TAG) {
@@ -8848,14 +8977,14 @@ function isDocumentTag(tag) {
8848
8977
  return false;
8849
8978
  }
8850
8979
  for (const declaration of symbol.getDeclarations()) {
8851
- if (Node38.isImportSpecifier(declaration) && DOCUMENT_TAGS.has(declaration.getName())) {
8980
+ if (Node39.isImportSpecifier(declaration) && DOCUMENT_TAGS.has(declaration.getName())) {
8852
8981
  return true;
8853
8982
  }
8854
8983
  }
8855
8984
  return false;
8856
8985
  }
8857
8986
  function resolveThroughFacts(arg, assembly) {
8858
- if (assembly.resolution === void 0 || !Node38.isIdentifier(arg)) {
8987
+ if (assembly.resolution === void 0 || !Node39.isIdentifier(arg)) {
8859
8988
  return null;
8860
8989
  }
8861
8990
  const written = assembly.resolution.resolveWrittenValue(arg);
@@ -8904,7 +9033,7 @@ function singleLine(text) {
8904
9033
  return collapsed.length > 80 ? `${collapsed.slice(0, 79)}\u2026` : collapsed;
8905
9034
  }
8906
9035
  function importedVariableInitializers(identifier) {
8907
- if (!Node38.isIdentifier(identifier)) {
9036
+ if (!Node39.isIdentifier(identifier)) {
8908
9037
  return [];
8909
9038
  }
8910
9039
  const symbol = identifier.getSymbol();
@@ -8914,7 +9043,7 @@ function importedVariableInitializers(identifier) {
8914
9043
  const resolved = resolveAliasedSymbol(symbol) ?? symbol;
8915
9044
  const inits = [];
8916
9045
  for (const decl of resolved.getDeclarations()) {
8917
- if (Node38.isVariableDeclaration(decl)) {
9046
+ if (Node39.isVariableDeclaration(decl)) {
8918
9047
  const init = decl.getInitializer();
8919
9048
  if (init !== void 0) {
8920
9049
  inits.push(init);
@@ -8928,7 +9057,7 @@ function resolveGqlTemplateText(arg, assembly) {
8928
9057
  if (direct !== null) {
8929
9058
  return direct;
8930
9059
  }
8931
- if (!Node38.isIdentifier(arg)) {
9060
+ if (!Node39.isIdentifier(arg)) {
8932
9061
  return null;
8933
9062
  }
8934
9063
  const symbol = arg.getSymbol();
@@ -8936,7 +9065,7 @@ function resolveGqlTemplateText(arg, assembly) {
8936
9065
  return null;
8937
9066
  }
8938
9067
  for (const decl of symbol.getDeclarations()) {
8939
- if (Node38.isImportClause(decl) || Node38.isImportSpecifier(decl)) {
9068
+ if (Node39.isImportClause(decl) || Node39.isImportSpecifier(decl)) {
8940
9069
  const fromGraphqlFile = resolveGraphqlFileImport(decl);
8941
9070
  if (fromGraphqlFile !== null) {
8942
9071
  return fromGraphqlFile;
@@ -8955,7 +9084,7 @@ function resolveGqlTemplateText(arg, assembly) {
8955
9084
  return null;
8956
9085
  }
8957
9086
  function resolveTypedDocumentSource(arg) {
8958
- if (!Node38.isIdentifier(arg)) {
9087
+ if (!Node39.isIdentifier(arg)) {
8959
9088
  return null;
8960
9089
  }
8961
9090
  for (const init of importedVariableInitializers(arg)) {
@@ -8968,7 +9097,7 @@ function resolveTypedDocumentSource(arg) {
8968
9097
  }
8969
9098
  function typedDocumentSourceOf(node) {
8970
9099
  const inner = stripDocumentNodeCasts(node);
8971
- if (!Node38.isObjectLiteralExpression(inner)) {
9100
+ if (!Node39.isObjectLiteralExpression(inner)) {
8972
9101
  return null;
8973
9102
  }
8974
9103
  const evaluated = evaluateObjectLiteralAsJson(inner);
@@ -8986,7 +9115,7 @@ function typedDocumentSourceOf(node) {
8986
9115
  }
8987
9116
  }
8988
9117
  function resolveTypedDocumentHeader(arg) {
8989
- if (!Node38.isIdentifier(arg)) {
9118
+ if (!Node39.isIdentifier(arg)) {
8990
9119
  return null;
8991
9120
  }
8992
9121
  const reference = arg.getText();
@@ -8996,7 +9125,7 @@ function resolveTypedDocumentHeader(arg) {
8996
9125
  }
8997
9126
  const resolved = resolveAliasedSymbol(symbol) ?? symbol;
8998
9127
  for (const decl of resolved.getDeclarations()) {
8999
- if (!Node38.isVariableDeclaration(decl)) {
9128
+ if (!Node39.isVariableDeclaration(decl)) {
9000
9129
  continue;
9001
9130
  }
9002
9131
  const init = decl.getInitializer();
@@ -9029,10 +9158,10 @@ function resolveTypedDocumentHeader(arg) {
9029
9158
  }
9030
9159
  function documentNodeCastTypeArgs(node) {
9031
9160
  let current2 = node;
9032
- while (Node38.isAsExpression(current2) || Node38.isParenthesizedExpression(current2)) {
9033
- if (Node38.isAsExpression(current2)) {
9161
+ while (Node39.isAsExpression(current2) || Node39.isParenthesizedExpression(current2)) {
9162
+ if (Node39.isAsExpression(current2)) {
9034
9163
  const typeNode = current2.getTypeNode();
9035
- if (typeNode !== void 0 && Node38.isTypeReference(typeNode)) {
9164
+ if (typeNode !== void 0 && Node39.isTypeReference(typeNode)) {
9036
9165
  const name = typeNode.getTypeName().getText();
9037
9166
  const simpleName = name.includes(".") ? name.split(".").pop() ?? name : name;
9038
9167
  if (simpleName === "TypedDocumentNode" || simpleName === "DocumentNode") {
@@ -9045,7 +9174,7 @@ function documentNodeCastTypeArgs(node) {
9045
9174
  return null;
9046
9175
  }
9047
9176
  function operationHeaderFromResultType(typeNode) {
9048
- if (typeNode === void 0 || !Node38.isTypeReference(typeNode)) {
9177
+ if (typeNode === void 0 || !Node39.isTypeReference(typeNode)) {
9049
9178
  return null;
9050
9179
  }
9051
9180
  const name = typeNode.getTypeName().getText();
@@ -9066,16 +9195,16 @@ function operationHeaderFromResultType(typeNode) {
9066
9195
  }
9067
9196
  function stripDocumentNodeCasts(node) {
9068
9197
  let current2 = node;
9069
- while (Node38.isAsExpression(current2) || Node38.isParenthesizedExpression(current2)) {
9198
+ while (Node39.isAsExpression(current2) || Node39.isParenthesizedExpression(current2)) {
9070
9199
  current2 = current2.getExpression();
9071
9200
  }
9072
9201
  return current2;
9073
9202
  }
9074
9203
  function evaluateObjectLiteralAsJson(node) {
9075
- if (Node38.isStringLiteral(node) || Node38.isNoSubstitutionTemplateLiteral(node)) {
9204
+ if (Node39.isStringLiteral(node) || Node39.isNoSubstitutionTemplateLiteral(node)) {
9076
9205
  return node.getLiteralValue();
9077
9206
  }
9078
- if (Node38.isNumericLiteral(node)) {
9207
+ if (Node39.isNumericLiteral(node)) {
9079
9208
  return Number(node.getText());
9080
9209
  }
9081
9210
  const kind = node.getText();
@@ -9088,17 +9217,17 @@ function evaluateObjectLiteralAsJson(node) {
9088
9217
  if (kind === "null") {
9089
9218
  return null;
9090
9219
  }
9091
- if (Node38.isObjectLiteralExpression(node)) {
9220
+ if (Node39.isObjectLiteralExpression(node)) {
9092
9221
  const out = {};
9093
9222
  for (const prop of node.getProperties()) {
9094
- if (!Node38.isPropertyAssignment(prop)) {
9223
+ if (!Node39.isPropertyAssignment(prop)) {
9095
9224
  return null;
9096
9225
  }
9097
9226
  const nameNode = prop.getNameNode();
9098
9227
  let name;
9099
- if (Node38.isIdentifier(nameNode)) {
9228
+ if (Node39.isIdentifier(nameNode)) {
9100
9229
  name = nameNode.getText();
9101
- } else if (Node38.isStringLiteral(nameNode) || Node38.isNoSubstitutionTemplateLiteral(nameNode)) {
9230
+ } else if (Node39.isStringLiteral(nameNode) || Node39.isNoSubstitutionTemplateLiteral(nameNode)) {
9102
9231
  name = nameNode.getLiteralValue();
9103
9232
  } else {
9104
9233
  return null;
@@ -9115,7 +9244,7 @@ function evaluateObjectLiteralAsJson(node) {
9115
9244
  }
9116
9245
  return out;
9117
9246
  }
9118
- if (Node38.isArrayLiteralExpression(node)) {
9247
+ if (Node39.isArrayLiteralExpression(node)) {
9119
9248
  const out = [];
9120
9249
  for (const el of node.getElements()) {
9121
9250
  const value = evaluateObjectLiteralAsJson(el);
@@ -9129,8 +9258,8 @@ function evaluateObjectLiteralAsJson(node) {
9129
9258
  return void 0;
9130
9259
  }
9131
9260
  function resolveGraphqlFileImport(decl) {
9132
- const importDecl = Node38.isImportSpecifier(decl) ? decl.getImportDeclaration() : Node38.isImportClause(decl) ? decl.getParent() : null;
9133
- if (importDecl === null || importDecl === void 0 || !Node38.isImportDeclaration(importDecl)) {
9261
+ const importDecl = Node39.isImportSpecifier(decl) ? decl.getImportDeclaration() : Node39.isImportClause(decl) ? decl.getParent() : null;
9262
+ if (importDecl === null || importDecl === void 0 || !Node39.isImportDeclaration(importDecl)) {
9134
9263
  return null;
9135
9264
  }
9136
9265
  const specifier = importDecl.getModuleSpecifierValue();
@@ -9149,7 +9278,7 @@ function resolveGraphqlFileImport(decl) {
9149
9278
  function enclosingFunctionRoot(node) {
9150
9279
  let current2 = node.getParent();
9151
9280
  while (current2 !== void 0) {
9152
- if (Node38.isFunctionDeclaration(current2) || Node38.isFunctionExpression(current2) || Node38.isArrowFunction(current2) || Node38.isMethodDeclaration(current2)) {
9281
+ if (Node39.isFunctionDeclaration(current2) || Node39.isFunctionExpression(current2) || Node39.isArrowFunction(current2) || Node39.isMethodDeclaration(current2)) {
9153
9282
  return current2;
9154
9283
  }
9155
9284
  current2 = current2.getParent();
@@ -9157,11 +9286,11 @@ function enclosingFunctionRoot(node) {
9157
9286
  return null;
9158
9287
  }
9159
9288
  function functionNameOrAnon(func) {
9160
- if (Node38.isFunctionDeclaration(func) || Node38.isMethodDeclaration(func)) {
9289
+ if (Node39.isFunctionDeclaration(func) || Node39.isMethodDeclaration(func)) {
9161
9290
  return func.getName() ?? "<anon>";
9162
9291
  }
9163
9292
  const parent = func.getParent();
9164
- if (parent !== void 0 && Node38.isVariableDeclaration(parent)) {
9293
+ if (parent !== void 0 && Node39.isVariableDeclaration(parent)) {
9165
9294
  return parent.getName();
9166
9295
  }
9167
9296
  return "<anon>";
@@ -9192,11 +9321,11 @@ function discoverGraphqlHookCalls(sourceFile, match, kind, resolution) {
9192
9321
  }
9193
9322
  const results = [];
9194
9323
  sourceFile.forEachDescendant((node) => {
9195
- if (!Node39.isCallExpression(node)) {
9324
+ if (!Node40.isCallExpression(node)) {
9196
9325
  return;
9197
9326
  }
9198
9327
  const callee = node.getExpression();
9199
- if (!Node39.isIdentifier(callee)) {
9328
+ if (!Node40.isIdentifier(callee)) {
9200
9329
  return;
9201
9330
  }
9202
9331
  const spec = hookByLocal.get(callee.getText());
@@ -9232,7 +9361,7 @@ function discoverGraphqlHookCalls(sourceFile, match, kind, resolution) {
9232
9361
  }
9233
9362
 
9234
9363
  // src/discovery/graphqlImperativeCall.ts
9235
- import { Node as Node40 } from "ts-morph";
9364
+ import { Node as Node41 } from "ts-morph";
9236
9365
  function discoverGraphqlImperativeCalls(sourceFile, match, kind, resolution) {
9237
9366
  const isTheClient = clientReceiverCheckFor(sourceFile, match, resolution);
9238
9367
  const methodSpec = /* @__PURE__ */ new Map();
@@ -9244,11 +9373,11 @@ function discoverGraphqlImperativeCalls(sourceFile, match, kind, resolution) {
9244
9373
  }
9245
9374
  const results = [];
9246
9375
  sourceFile.forEachDescendant((node) => {
9247
- if (!Node40.isCallExpression(node)) {
9376
+ if (!Node41.isCallExpression(node)) {
9248
9377
  return;
9249
9378
  }
9250
9379
  const callee = node.getExpression();
9251
- if (!Node40.isPropertyAccessExpression(callee)) {
9380
+ if (!Node41.isPropertyAccessExpression(callee)) {
9252
9381
  return;
9253
9382
  }
9254
9383
  const methodName = callee.getName();
@@ -9260,7 +9389,7 @@ function discoverGraphqlImperativeCalls(sourceFile, match, kind, resolution) {
9260
9389
  return;
9261
9390
  }
9262
9391
  const args = node.getArguments();
9263
- if (args.length === 0 || !Node40.isObjectLiteralExpression(args[0])) {
9392
+ if (args.length === 0 || !Node41.isObjectLiteralExpression(args[0])) {
9264
9393
  return;
9265
9394
  }
9266
9395
  const config = args[0];
@@ -9296,16 +9425,16 @@ function discoverGraphqlImperativeCalls(sourceFile, match, kind, resolution) {
9296
9425
  return results;
9297
9426
  }
9298
9427
  function imperativeConfigValue(prop) {
9299
- if (Node40.isPropertyAssignment(prop)) {
9428
+ if (Node41.isPropertyAssignment(prop)) {
9300
9429
  return prop.getInitializer() ?? null;
9301
9430
  }
9302
- if (Node40.isShorthandPropertyAssignment(prop)) {
9431
+ if (Node41.isShorthandPropertyAssignment(prop)) {
9303
9432
  const valueSymbol = prop.getValueSymbol();
9304
9433
  if (valueSymbol === void 0) {
9305
9434
  return null;
9306
9435
  }
9307
9436
  for (const decl of valueSymbol.getDeclarations()) {
9308
- if (Node40.isVariableDeclaration(decl)) {
9437
+ if (Node41.isVariableDeclaration(decl)) {
9309
9438
  const init = decl.getInitializer();
9310
9439
  if (init !== void 0) {
9311
9440
  return init;
@@ -9318,7 +9447,7 @@ function imperativeConfigValue(prop) {
9318
9447
  }
9319
9448
 
9320
9449
  // src/discovery/jsxElementRoute.ts
9321
- import { Node as Node41 } from "ts-morph";
9450
+ import { Node as Node42 } from "ts-morph";
9322
9451
  var PATH_NOT_LITERAL = "The path this route declares is not written as a string literal, so no path is claimed and this route pairs with nothing";
9323
9452
  var ENCLOSING_PATH_NOT_LITERAL = "A route this one is nested under declares its path as something other than a string literal, so the full path is not claimed and this route pairs with nothing";
9324
9453
  var SPREAD_NOT_ENUMERATED = "A spread stands in for routes declared elsewhere in this array, and they are not read here, so no path is claimed for any of them";
@@ -9350,7 +9479,7 @@ function discoverJsxElementRoutes(sourceFile, match, kind, resolution) {
9350
9479
  }
9351
9480
  return;
9352
9481
  }
9353
- if (Node41.isCallExpression(node) && callsAFactory(node, factoryNames)) {
9482
+ if (Node42.isCallExpression(node) && callsAFactory(node, factoryNames)) {
9354
9483
  results.push(
9355
9484
  ...unitsForRouteArray(node, match, elementsNames, kind, resolution)
9356
9485
  );
@@ -9377,7 +9506,7 @@ function localNamesFor2(sourceFile, match, exported) {
9377
9506
  return local;
9378
9507
  }
9379
9508
  function asRouteJsx(node, routeNames) {
9380
- if (!Node41.isJsxSelfClosingElement(node) && !Node41.isJsxElement(node)) {
9509
+ if (!Node42.isJsxSelfClosingElement(node) && !Node42.isJsxElement(node)) {
9381
9510
  return null;
9382
9511
  }
9383
9512
  return isRouteJsx(node, routeNames) ? node : null;
@@ -9387,15 +9516,15 @@ function isRouteJsx(node, routeNames) {
9387
9516
  return tag !== null && routeNames.has(tag.getText());
9388
9517
  }
9389
9518
  function tagNameOf(node) {
9390
- const tag = Node41.isJsxElement(node) ? node.getOpeningElement().getTagNameNode() : node.getTagNameNode();
9391
- return Node41.isIdentifier(tag) ? tag : null;
9519
+ const tag = Node42.isJsxElement(node) ? node.getOpeningElement().getTagNameNode() : node.getTagNameNode();
9520
+ return Node42.isIdentifier(tag) ? tag : null;
9392
9521
  }
9393
9522
  function attributesOf(node) {
9394
- return Node41.isJsxElement(node) ? node.getOpeningElement().getAttributes() : node.getAttributes();
9523
+ return Node42.isJsxElement(node) ? node.getOpeningElement().getAttributes() : node.getAttributes();
9395
9524
  }
9396
9525
  function attributeValueOf(node, name) {
9397
9526
  for (const attribute of attributesOf(node)) {
9398
- if (!Node41.isJsxAttribute(attribute)) {
9527
+ if (!Node42.isJsxAttribute(attribute)) {
9399
9528
  continue;
9400
9529
  }
9401
9530
  if (attribute.getNameNode().getText() !== name) {
@@ -9406,8 +9535,8 @@ function attributeValueOf(node, name) {
9406
9535
  return null;
9407
9536
  }
9408
9537
  function literalStringOf2(value) {
9409
- const unwrapped2 = Node41.isJsxExpression(value) ? value.getExpression() ?? value : value;
9410
- if (Node41.isStringLiteral(unwrapped2) || Node41.isNoSubstitutionTemplateLiteral(unwrapped2)) {
9538
+ const unwrapped2 = Node42.isJsxExpression(value) ? value.getExpression() ?? value : value;
9539
+ if (Node42.isStringLiteral(unwrapped2) || Node42.isNoSubstitutionTemplateLiteral(unwrapped2)) {
9411
9540
  return unwrapped2.getLiteralValue();
9412
9541
  }
9413
9542
  return null;
@@ -9427,8 +9556,8 @@ function elementTargetOfValue(value) {
9427
9556
  if (value === null) {
9428
9557
  return { kind: "absent" };
9429
9558
  }
9430
- const unwrapped2 = Node41.isJsxExpression(value) ? value.getExpression() ?? value : value;
9431
- if (!Node41.isJsxSelfClosingElement(unwrapped2) && !Node41.isJsxElement(unwrapped2)) {
9559
+ const unwrapped2 = Node42.isJsxExpression(value) ? value.getExpression() ?? value : value;
9560
+ if (!Node42.isJsxSelfClosingElement(unwrapped2) && !Node42.isJsxElement(unwrapped2)) {
9432
9561
  return { kind: "unreadable" };
9433
9562
  }
9434
9563
  const tag = tagNameOf(unwrapped2);
@@ -9440,7 +9569,7 @@ function elementTargetOfValue(value) {
9440
9569
  function composedPrefixOf(node, match, routeNames) {
9441
9570
  const enclosing = [];
9442
9571
  for (const ancestor of node.getAncestors()) {
9443
- if (Node41.isJsxElement(ancestor) && isRouteJsx(ancestor, routeNames)) {
9572
+ if (Node42.isJsxElement(ancestor) && isRouteJsx(ancestor, routeNames)) {
9444
9573
  enclosing.push(ancestor);
9445
9574
  }
9446
9575
  }
@@ -9556,14 +9685,14 @@ function abstention(at, kind, sentence, label) {
9556
9685
  }
9557
9686
  function callsAFactory(call, factoryNames) {
9558
9687
  const callee = call.getExpression();
9559
- return Node41.isIdentifier(callee) && factoryNames.has(callee.getText());
9688
+ return Node42.isIdentifier(callee) && factoryNames.has(callee.getText());
9560
9689
  }
9561
9690
  function unitsForRouteArray(call, match, elementsNames, kind, resolution) {
9562
9691
  const first = call.getArguments()[0];
9563
9692
  if (first === void 0) {
9564
9693
  return [];
9565
9694
  }
9566
- if (Node41.isJsxElement(first) || Node41.isJsxSelfClosingElement(first) || Node41.isCallExpression(first) && callsAFactory(first, elementsNames)) {
9695
+ if (Node42.isJsxElement(first) || Node42.isJsxSelfClosingElement(first) || Node42.isCallExpression(first) && callsAFactory(first, elementsNames)) {
9567
9696
  return [];
9568
9697
  }
9569
9698
  const array = arrayLiteralOf(first, resolution);
@@ -9588,7 +9717,7 @@ function unitsOfArrayElements(array, match, kind, resolution, prefix, ancestry)
9588
9717
  const nestedIn = new Set(ancestry).add(array);
9589
9718
  const results = [];
9590
9719
  for (const element of array.getElements()) {
9591
- if (Node41.isSpreadElement(element)) {
9720
+ if (Node42.isSpreadElement(element)) {
9592
9721
  results.push(
9593
9722
  abstention(
9594
9723
  element,
@@ -9599,7 +9728,7 @@ function unitsOfArrayElements(array, match, kind, resolution, prefix, ancestry)
9599
9728
  );
9600
9729
  continue;
9601
9730
  }
9602
- if (!Node41.isObjectLiteralExpression(element)) {
9731
+ if (!Node42.isObjectLiteralExpression(element)) {
9603
9732
  results.push(
9604
9733
  abstention(
9605
9734
  element,
@@ -9688,7 +9817,7 @@ function ownPathOfObject(object, match) {
9688
9817
  }
9689
9818
  if (match.indexAttribute !== void 0) {
9690
9819
  const indexValue = routePropertyOf(object, match.indexAttribute);
9691
- if (indexValue !== null && Node41.isTrueLiteral(indexValue)) {
9820
+ if (indexValue !== null && Node42.isTrueLiteral(indexValue)) {
9692
9821
  return { kind: "inherited" };
9693
9822
  }
9694
9823
  }
@@ -9702,10 +9831,10 @@ function objectLabelOf(target) {
9702
9831
  return target.kind === "named" ? target.identifier.getText() : "declaration";
9703
9832
  }
9704
9833
  function labelOfExpression(node) {
9705
- if (Node41.isIdentifier(node)) {
9834
+ if (Node42.isIdentifier(node)) {
9706
9835
  return node.getText();
9707
9836
  }
9708
- if (Node41.isCallExpression(node)) {
9837
+ if (Node42.isCallExpression(node)) {
9709
9838
  return node.getExpression().getText();
9710
9839
  }
9711
9840
  return node.getKindName();
@@ -9713,7 +9842,7 @@ function labelOfExpression(node) {
9713
9842
 
9714
9843
  // src/discovery/packageExports.ts
9715
9844
  import fs5 from "fs";
9716
- import { Node as Node43 } from "ts-morph";
9845
+ import { Node as Node44 } from "ts-morph";
9717
9846
 
9718
9847
  // src/packageExports.ts
9719
9848
  import fs4 from "fs";
@@ -9811,12 +9940,12 @@ function resolveSourceFor(pkgDir, distPath, srcRoot) {
9811
9940
  }
9812
9941
 
9813
9942
  // src/discovery/factorySurface.ts
9814
- import { Node as Node42, SyntaxKind as SyntaxKind9 } from "ts-morph";
9943
+ import { Node as Node43, SyntaxKind as SyntaxKind10 } from "ts-morph";
9815
9944
  function surfaceMethods(decl) {
9816
- if (Node42.isClassDeclaration(decl)) {
9945
+ if (Node43.isClassDeclaration(decl)) {
9817
9946
  return surfaceClassMethods(decl);
9818
9947
  }
9819
- if (Node42.isFunctionDeclaration(decl) || Node42.isFunctionExpression(decl) || Node42.isArrowFunction(decl) || Node42.isMethodDeclaration(decl)) {
9948
+ if (Node43.isFunctionDeclaration(decl) || Node43.isFunctionExpression(decl) || Node43.isArrowFunction(decl) || Node43.isMethodDeclaration(decl)) {
9820
9949
  return surfaceFactoryReturnMethods(decl);
9821
9950
  }
9822
9951
  return [];
@@ -9825,7 +9954,7 @@ function surfaceClassMethods(cls) {
9825
9954
  const out = [];
9826
9955
  const seen = /* @__PURE__ */ new Set();
9827
9956
  for (const method of cls.getInstanceMethods()) {
9828
- if (method.hasModifier(SyntaxKind9.PrivateKeyword)) {
9957
+ if (method.hasModifier(SyntaxKind10.PrivateKeyword)) {
9829
9958
  continue;
9830
9959
  }
9831
9960
  const name = method.getName();
@@ -9836,7 +9965,7 @@ function surfaceClassMethods(cls) {
9836
9965
  out.push({ func: method, name });
9837
9966
  }
9838
9967
  for (const method of cls.getStaticMethods()) {
9839
- if (method.hasModifier(SyntaxKind9.PrivateKeyword)) {
9968
+ if (method.hasModifier(SyntaxKind10.PrivateKeyword)) {
9840
9969
  continue;
9841
9970
  }
9842
9971
  const name = method.getName();
@@ -9851,9 +9980,9 @@ function surfaceClassMethods(cls) {
9851
9980
  function surfaceFactoryReturnMethods(fn) {
9852
9981
  const out = [];
9853
9982
  const seen = /* @__PURE__ */ new Set();
9854
- if (Node42.isArrowFunction(fn)) {
9983
+ if (Node43.isArrowFunction(fn)) {
9855
9984
  const body2 = fn.getBody();
9856
- if (Node42.isExpression(body2)) {
9985
+ if (Node43.isExpression(body2)) {
9857
9986
  collectFromObjectLiteral(body2, out, seen);
9858
9987
  return out;
9859
9988
  }
@@ -9864,11 +9993,11 @@ function surfaceFactoryReturnMethods(fn) {
9864
9993
  }
9865
9994
  const returns = [];
9866
9995
  body.forEachDescendant((node, traversal) => {
9867
- if (Node42.isFunctionDeclaration(node) || Node42.isFunctionExpression(node) || Node42.isArrowFunction(node) || Node42.isMethodDeclaration(node) || Node42.isConstructorDeclaration(node) || Node42.isGetAccessorDeclaration(node) || Node42.isSetAccessorDeclaration(node)) {
9996
+ if (Node43.isFunctionDeclaration(node) || Node43.isFunctionExpression(node) || Node43.isArrowFunction(node) || Node43.isMethodDeclaration(node) || Node43.isConstructorDeclaration(node) || Node43.isGetAccessorDeclaration(node) || Node43.isSetAccessorDeclaration(node)) {
9868
9997
  traversal.skip();
9869
9998
  return;
9870
9999
  }
9871
- if (Node42.isReturnStatement(node)) {
10000
+ if (Node43.isReturnStatement(node)) {
9872
10001
  returns.push(node);
9873
10002
  }
9874
10003
  });
@@ -9883,14 +10012,14 @@ function surfaceFactoryReturnMethods(fn) {
9883
10012
  }
9884
10013
  function collectFromObjectLiteral(node, out, seen) {
9885
10014
  let e = node;
9886
- while (Node42.isParenthesizedExpression(e)) {
10015
+ while (Node43.isParenthesizedExpression(e)) {
9887
10016
  e = e.getExpression();
9888
10017
  }
9889
- if (!Node42.isObjectLiteralExpression(e)) {
10018
+ if (!Node43.isObjectLiteralExpression(e)) {
9890
10019
  return;
9891
10020
  }
9892
10021
  for (const prop of e.getProperties()) {
9893
- if (Node42.isMethodDeclaration(prop)) {
10022
+ if (Node43.isMethodDeclaration(prop)) {
9894
10023
  const name = prop.getName();
9895
10024
  if (seen.has(name)) {
9896
10025
  continue;
@@ -9899,16 +10028,16 @@ function collectFromObjectLiteral(node, out, seen) {
9899
10028
  out.push({ func: prop, name });
9900
10029
  continue;
9901
10030
  }
9902
- if (Node42.isPropertyAssignment(prop)) {
10031
+ if (Node43.isPropertyAssignment(prop)) {
9903
10032
  const init = prop.getInitializer();
9904
10033
  if (init === void 0) {
9905
10034
  continue;
9906
10035
  }
9907
10036
  let v3 = init;
9908
- while (Node42.isParenthesizedExpression(v3)) {
10037
+ while (Node43.isParenthesizedExpression(v3)) {
9909
10038
  v3 = v3.getExpression();
9910
10039
  }
9911
- if (Node42.isArrowFunction(v3) || Node42.isFunctionExpression(v3)) {
10040
+ if (Node43.isArrowFunction(v3) || Node43.isFunctionExpression(v3)) {
9912
10041
  const name = prop.getName();
9913
10042
  if (seen.has(name)) {
9914
10043
  continue;
@@ -9974,9 +10103,9 @@ function discoverPackageExports(sourceFile, match, kind) {
9974
10103
  continue;
9975
10104
  }
9976
10105
  for (const decl of decls) {
9977
- if (Node43.isVariableDeclaration(decl)) {
10106
+ if (Node44.isVariableDeclaration(decl)) {
9978
10107
  const init = decl.getInitializer();
9979
- if (init !== void 0 && (Node43.isArrowFunction(init) || Node43.isFunctionExpression(init))) {
10108
+ if (init !== void 0 && (Node44.isArrowFunction(init) || Node44.isFunctionExpression(init))) {
9980
10109
  results.push(buildUnit(init, kind, exportName, entry));
9981
10110
  for (const m of surfaceMethods(init)) {
9982
10111
  results.push(buildSurfacedUnit(m, kind, exportName, entry));
@@ -9986,7 +10115,7 @@ function discoverPackageExports(sourceFile, match, kind) {
9986
10115
  }
9987
10116
  continue;
9988
10117
  }
9989
- if (Node43.isClassDeclaration(decl)) {
10118
+ if (Node44.isClassDeclaration(decl)) {
9990
10119
  for (const m of surfaceMethods(decl)) {
9991
10120
  results.push(buildSurfacedUnit(m, kind, exportName, entry));
9992
10121
  }
@@ -10031,12 +10160,12 @@ function buildSurfacedUnit(m, kind, parentExportName, entry) {
10031
10160
  }
10032
10161
 
10033
10162
  // src/discovery/packageImport.ts
10034
- import { Node as Node45 } from "ts-morph";
10163
+ import { Node as Node46 } from "ts-morph";
10035
10164
 
10036
10165
  // src/discovery/factoryTracking.ts
10037
- import { Node as Node44, SyntaxKind as SyntaxKind10 } from "ts-morph";
10166
+ import { Node as Node45, SyntaxKind as SyntaxKind11 } from "ts-morph";
10038
10167
  function isScopeNode(node) {
10039
- return Node44.isFunctionDeclaration(node) || Node44.isFunctionExpression(node) || Node44.isArrowFunction(node) || Node44.isMethodDeclaration(node) || Node44.isConstructorDeclaration(node) || Node44.isGetAccessorDeclaration(node) || Node44.isSetAccessorDeclaration(node);
10168
+ return Node45.isFunctionDeclaration(node) || Node45.isFunctionExpression(node) || Node45.isArrowFunction(node) || Node45.isMethodDeclaration(node) || Node45.isConstructorDeclaration(node) || Node45.isGetAccessorDeclaration(node) || Node45.isSetAccessorDeclaration(node);
10040
10169
  }
10041
10170
  function trackFactoryBindings(sourceFile, recognize) {
10042
10171
  const scopes = /* @__PURE__ */ new Map();
@@ -10059,19 +10188,19 @@ function trackFactoryBindings(sourceFile, recognize) {
10059
10188
  map.set(name, provenance);
10060
10189
  }
10061
10190
  for (const varDecl of sourceFile.getDescendantsOfKind(
10062
- SyntaxKind10.VariableDeclaration
10191
+ SyntaxKind11.VariableDeclaration
10063
10192
  )) {
10064
10193
  const init = varDecl.getInitializer();
10065
10194
  if (init === void 0) {
10066
10195
  continue;
10067
10196
  }
10068
- const peeled = Node44.isAwaitExpression(init) ? init.getExpression() : init;
10197
+ const peeled = Node45.isAwaitExpression(init) ? init.getExpression() : init;
10069
10198
  let callee;
10070
10199
  let isNew;
10071
- if (Node44.isCallExpression(peeled)) {
10200
+ if (Node45.isCallExpression(peeled)) {
10072
10201
  callee = peeled.getExpression();
10073
10202
  isNew = false;
10074
- } else if (Node44.isNewExpression(peeled)) {
10203
+ } else if (Node45.isNewExpression(peeled)) {
10075
10204
  const expr = peeled.getExpression();
10076
10205
  if (expr === void 0) {
10077
10206
  continue;
@@ -10087,11 +10216,11 @@ function trackFactoryBindings(sourceFile, recognize) {
10087
10216
  }
10088
10217
  const scope = scopeOf(varDecl);
10089
10218
  const nameNode = varDecl.getNameNode();
10090
- if (Node44.isIdentifier(nameNode)) {
10219
+ if (Node45.isIdentifier(nameNode)) {
10091
10220
  record(scope, nameNode.getText(), provenance);
10092
10221
  continue;
10093
10222
  }
10094
- if (Node44.isObjectBindingPattern(nameNode)) {
10223
+ if (Node45.isObjectBindingPattern(nameNode)) {
10095
10224
  for (const elem of nameNode.getElements()) {
10096
10225
  if (elem.getDotDotDotToken() !== void 0) {
10097
10226
  continue;
@@ -10145,13 +10274,13 @@ function splitPackageSpec(spec) {
10145
10274
  };
10146
10275
  }
10147
10276
  function enclosingFunctionName(func) {
10148
- if (Node45.isFunctionDeclaration(func) || Node45.isMethodDeclaration(func)) {
10277
+ if (Node46.isFunctionDeclaration(func) || Node46.isMethodDeclaration(func)) {
10149
10278
  const n = func.getName?.();
10150
10279
  if (typeof n === "string" && n.length > 0) {
10151
10280
  return n;
10152
10281
  }
10153
10282
  }
10154
- if (Node45.isFunctionExpression(func)) {
10283
+ if (Node46.isFunctionExpression(func)) {
10155
10284
  const n = func.getName();
10156
10285
  if (typeof n === "string" && n.length > 0) {
10157
10286
  return n;
@@ -10159,10 +10288,10 @@ function enclosingFunctionName(func) {
10159
10288
  }
10160
10289
  const parent = func.getParent();
10161
10290
  if (parent !== void 0) {
10162
- if (Node45.isVariableDeclaration(parent)) {
10291
+ if (Node46.isVariableDeclaration(parent)) {
10163
10292
  return parent.getName();
10164
10293
  }
10165
- if (Node45.isPropertyAssignment(parent)) {
10294
+ if (Node46.isPropertyAssignment(parent)) {
10166
10295
  return parent.getName();
10167
10296
  }
10168
10297
  }
@@ -10197,37 +10326,37 @@ function discoverPackageImports(sourceFile, match, kind) {
10197
10326
  return [];
10198
10327
  }
10199
10328
  const trackedBindings = trackFactoryBindings(sourceFile, (callee) => {
10200
- if (!Node45.isIdentifier(callee)) {
10329
+ if (!Node46.isIdentifier(callee)) {
10201
10330
  return null;
10202
10331
  }
10203
10332
  return localToExport.get(callee.getText()) ?? null;
10204
10333
  });
10205
10334
  function resolveReceiverProvenance(node, fromNode) {
10206
10335
  let n = node;
10207
- while (Node45.isParenthesizedExpression(n)) {
10336
+ while (Node46.isParenthesizedExpression(n)) {
10208
10337
  n = n.getExpression();
10209
10338
  }
10210
- if (Node45.isAwaitExpression(n)) {
10339
+ if (Node46.isAwaitExpression(n)) {
10211
10340
  const inner = n.getExpression();
10212
10341
  if (inner === void 0) {
10213
10342
  return null;
10214
10343
  }
10215
10344
  n = inner;
10216
10345
  }
10217
- if (Node45.isIdentifier(n)) {
10346
+ if (Node46.isIdentifier(n)) {
10218
10347
  const text = n.getText();
10219
10348
  return trackedBindings.resolve(text, fromNode) ?? localToExport.get(text) ?? null;
10220
10349
  }
10221
- if (Node45.isCallExpression(n)) {
10350
+ if (Node46.isCallExpression(n)) {
10222
10351
  const callee = n.getExpression();
10223
- if (Node45.isIdentifier(callee)) {
10352
+ if (Node46.isIdentifier(callee)) {
10224
10353
  return localToExport.get(callee.getText()) ?? null;
10225
10354
  }
10226
10355
  return null;
10227
10356
  }
10228
- if (Node45.isNewExpression(n)) {
10357
+ if (Node46.isNewExpression(n)) {
10229
10358
  const expr = n.getExpression();
10230
- if (expr !== void 0 && Node45.isIdentifier(expr)) {
10359
+ if (expr !== void 0 && Node46.isIdentifier(expr)) {
10231
10360
  return localToExport.get(expr.getText()) ?? null;
10232
10361
  }
10233
10362
  return null;
@@ -10235,11 +10364,11 @@ function discoverPackageImports(sourceFile, match, kind) {
10235
10364
  return null;
10236
10365
  }
10237
10366
  function attributeCall(callee) {
10238
- if (Node45.isIdentifier(callee)) {
10367
+ if (Node46.isIdentifier(callee)) {
10239
10368
  const text = callee.getText();
10240
10369
  return trackedBindings.resolve(text, callee) ?? localToExport.get(text) ?? null;
10241
10370
  }
10242
- if (Node45.isPropertyAccessExpression(callee)) {
10371
+ if (Node46.isPropertyAccessExpression(callee)) {
10243
10372
  const subject = callee.getExpression();
10244
10373
  const subjectProvenance = resolveReceiverProvenance(subject, callee);
10245
10374
  if (subjectProvenance === null) {
@@ -10267,7 +10396,7 @@ function discoverPackageImports(sourceFile, match, kind) {
10267
10396
  const results = [];
10268
10397
  const seen = /* @__PURE__ */ new Set();
10269
10398
  sourceFile.forEachDescendant((node) => {
10270
- if (!Node45.isCallExpression(node)) {
10399
+ if (!Node46.isCallExpression(node)) {
10271
10400
  return;
10272
10401
  }
10273
10402
  const callee = node.getExpression();
@@ -10298,10 +10427,10 @@ function discoverPackageImports(sourceFile, match, kind) {
10298
10427
  }
10299
10428
 
10300
10429
  // src/discovery/registrationCall.ts
10301
- import { Node as Node47 } from "ts-morph";
10430
+ import { Node as Node48 } from "ts-morph";
10302
10431
 
10303
10432
  // src/resolve/routePath.ts
10304
- import { Node as Node46 } from "ts-morph";
10433
+ import { Node as Node47 } from "ts-morph";
10305
10434
  import { patternHole as patternHole2 } from "@suss/behavioral-ir";
10306
10435
  var URL_SCHEME = /^[a-zA-Z][a-zA-Z\d+.-]*:\/\//;
10307
10436
  var URL_ORIGIN = /^[a-zA-Z][a-zA-Z\d+.-]*:\/\/[^/]*/;
@@ -10395,26 +10524,26 @@ function pathFromTemplateUrl(arg, resolution) {
10395
10524
  return path13 === "" ? void 0 : path13;
10396
10525
  }
10397
10526
  function pathFromUrlNode(node, resolution) {
10398
- if (Node46.isStringLiteral(node)) {
10527
+ if (Node47.isStringLiteral(node)) {
10399
10528
  return pathFromLiteralUrl(node.getLiteralValue());
10400
10529
  }
10401
- if (Node46.isNoSubstitutionTemplateLiteral(node)) {
10530
+ if (Node47.isNoSubstitutionTemplateLiteral(node)) {
10402
10531
  return pathFromLiteralUrl(node.getLiteralValue());
10403
10532
  }
10404
- if (Node46.isTemplateExpression(node)) {
10533
+ if (Node47.isTemplateExpression(node)) {
10405
10534
  return pathFromTemplateUrl(node, resolution);
10406
10535
  }
10407
- if (Node46.isBinaryExpression(node)) {
10536
+ if (Node47.isBinaryExpression(node)) {
10408
10537
  const joined = joinedStringOf(node, resolution);
10409
10538
  return joined === void 0 ? void 0 : pathFromLiteralUrl(joined);
10410
10539
  }
10411
10540
  return void 0;
10412
10541
  }
10413
10542
  function joinedStringOf(node, resolution) {
10414
- if (Node46.isStringLiteral(node) || Node46.isNoSubstitutionTemplateLiteral(node)) {
10543
+ if (Node47.isStringLiteral(node) || Node47.isNoSubstitutionTemplateLiteral(node)) {
10415
10544
  return node.getLiteralValue();
10416
10545
  }
10417
- if (Node46.isBinaryExpression(node) && node.getOperatorToken().getText() === "+") {
10546
+ if (Node47.isBinaryExpression(node) && node.getOperatorToken().getText() === "+") {
10418
10547
  const left = joinedStringOf(node.getLeft(), resolution);
10419
10548
  const right = joinedStringOf(node.getRight(), resolution);
10420
10549
  return left === void 0 || right === void 0 ? void 0 : left + right;
@@ -10423,10 +10552,10 @@ function joinedStringOf(node, resolution) {
10423
10552
  return written === null || written === node ? void 0 : joinedStringOf(written, resolution);
10424
10553
  }
10425
10554
  function placeholderName(expr) {
10426
- if (Node46.isIdentifier(expr)) {
10555
+ if (Node47.isIdentifier(expr)) {
10427
10556
  return expr.getText();
10428
10557
  }
10429
- if (Node46.isPropertyAccessExpression(expr)) {
10558
+ if (Node47.isPropertyAccessExpression(expr)) {
10430
10559
  return expr.getName();
10431
10560
  }
10432
10561
  return "param";
@@ -10442,7 +10571,7 @@ function holeText(expr, resolution) {
10442
10571
  return pathFromUrlNode(written, resolution) ?? patternHole2(placeholderName(expr));
10443
10572
  }
10444
10573
  function emptyStringLiteral(node) {
10445
- return (Node46.isStringLiteral(node) || Node46.isNoSubstitutionTemplateLiteral(node)) && node.getLiteralValue() === "";
10574
+ return (Node47.isStringLiteral(node) || Node47.isNoSubstitutionTemplateLiteral(node)) && node.getLiteralValue() === "";
10446
10575
  }
10447
10576
  function pathFromArgument(arg, resolution) {
10448
10577
  const written = pathFromUrlNode(arg, resolution);
@@ -10468,11 +10597,11 @@ function discoverRegistrationCalls(sourceFile, match, kind, bindingExtraction, r
10468
10597
  (c) => c.startsWith(".") ? c.slice(1) : c
10469
10598
  );
10470
10599
  sourceFile.forEachDescendant((node) => {
10471
- if (!Node47.isCallExpression(node)) {
10600
+ if (!Node48.isCallExpression(node)) {
10472
10601
  return;
10473
10602
  }
10474
10603
  const callee = node.getExpression();
10475
- if (!Node47.isPropertyAccessExpression(callee)) {
10604
+ if (!Node48.isPropertyAccessExpression(callee)) {
10476
10605
  return;
10477
10606
  }
10478
10607
  const methodName = callee.getName();
@@ -10480,7 +10609,7 @@ function discoverRegistrationCalls(sourceFile, match, kind, bindingExtraction, r
10480
10609
  return;
10481
10610
  }
10482
10611
  const subject = callee.getExpression();
10483
- const subjectName = Node47.isIdentifier(subject) ? subject.getText() : null;
10612
+ const subjectName = Node48.isIdentifier(subject) ? subject.getText() : null;
10484
10613
  const subjectNode = subjectName === null ? void 0 : registrationSubjects.get(subjectName);
10485
10614
  if (subjectNode === void 0) {
10486
10615
  return;
@@ -10488,12 +10617,12 @@ function discoverRegistrationCalls(sourceFile, match, kind, bindingExtraction, r
10488
10617
  const args = node.getArguments();
10489
10618
  let foundObjectArg = false;
10490
10619
  for (const arg of args) {
10491
- if (!Node47.isObjectLiteralExpression(arg)) {
10620
+ if (!Node48.isObjectLiteralExpression(arg)) {
10492
10621
  continue;
10493
10622
  }
10494
10623
  foundObjectArg = true;
10495
10624
  for (const prop of arg.getProperties()) {
10496
- if (Node47.isMethodDeclaration(prop)) {
10625
+ if (Node48.isMethodDeclaration(prop)) {
10497
10626
  results.push({
10498
10627
  func: prop,
10499
10628
  kind,
@@ -10501,7 +10630,7 @@ function discoverRegistrationCalls(sourceFile, match, kind, bindingExtraction, r
10501
10630
  });
10502
10631
  continue;
10503
10632
  }
10504
- if (!Node47.isPropertyAssignment(prop)) {
10633
+ if (!Node48.isPropertyAssignment(prop)) {
10505
10634
  continue;
10506
10635
  }
10507
10636
  const propInit = prop.getInitializer();
@@ -10599,9 +10728,9 @@ function registrationSubjectsOf(sourceFile, importModule, importName) {
10599
10728
  continue;
10600
10729
  }
10601
10730
  let calleeText = null;
10602
- if (Node47.isCallExpression(init)) {
10731
+ if (Node48.isCallExpression(init)) {
10603
10732
  calleeText = init.getExpression().getText();
10604
- } else if (Node47.isNewExpression(init)) {
10733
+ } else if (Node48.isNewExpression(init)) {
10605
10734
  calleeText = init.getExpression().getText();
10606
10735
  }
10607
10736
  if (calleeText === importedLocalName) {
@@ -10609,7 +10738,7 @@ function registrationSubjectsOf(sourceFile, importModule, importName) {
10609
10738
  }
10610
10739
  }
10611
10740
  sourceFile.forEachDescendant((node) => {
10612
- if (!Node47.isParameterDeclaration(node)) {
10741
+ if (!Node48.isParameterDeclaration(node)) {
10613
10742
  return;
10614
10743
  }
10615
10744
  const typeNode = node.getTypeNode();
@@ -10653,21 +10782,21 @@ function discoverMountEdges(sourceFile, match, mount, knownSubjectIds, resolutio
10653
10782
  }
10654
10783
  const edges = [];
10655
10784
  sourceFile.forEachDescendant((node) => {
10656
- if (!Node47.isCallExpression(node)) {
10785
+ if (!Node48.isCallExpression(node)) {
10657
10786
  return;
10658
10787
  }
10659
10788
  const callee = node.getExpression();
10660
- if (!Node47.isPropertyAccessExpression(callee) || callee.getName() !== mount.method) {
10789
+ if (!Node48.isPropertyAccessExpression(callee) || callee.getName() !== mount.method) {
10661
10790
  return;
10662
10791
  }
10663
10792
  const subject = callee.getExpression();
10664
- const subjectNode = Node47.isIdentifier(subject) ? subjects.get(subject.getText()) : void 0;
10793
+ const subjectNode = Node48.isIdentifier(subject) ? subjects.get(subject.getText()) : void 0;
10665
10794
  if (subjectNode === void 0) {
10666
10795
  return;
10667
10796
  }
10668
10797
  const args = node.getArguments();
10669
10798
  const prefixArg = args[mount.prefixPosition];
10670
- if (prefixArg === void 0 || !(Node47.isStringLiteral(prefixArg) || Node47.isNoSubstitutionTemplateLiteral(prefixArg))) {
10799
+ if (prefixArg === void 0 || !(Node48.isStringLiteral(prefixArg) || Node48.isNoSubstitutionTemplateLiteral(prefixArg))) {
10671
10800
  return;
10672
10801
  }
10673
10802
  const targetNodes = mountTargetsAmong(
@@ -10701,15 +10830,15 @@ function mountTargetsAmong(args, targetPosition, knownSubjectIds, resolution) {
10701
10830
  return targets;
10702
10831
  }
10703
10832
  function stringProperty(obj, name) {
10704
- if (!Node47.isObjectLiteralExpression(obj)) {
10833
+ if (!Node48.isObjectLiteralExpression(obj)) {
10705
10834
  return null;
10706
10835
  }
10707
10836
  const property = obj.getProperty(name);
10708
- if (property === void 0 || !Node47.isPropertyAssignment(property)) {
10837
+ if (property === void 0 || !Node48.isPropertyAssignment(property)) {
10709
10838
  return null;
10710
10839
  }
10711
10840
  const value = property.getInitializer();
10712
- if (value !== void 0 && (Node47.isStringLiteral(value) || Node47.isNoSubstitutionTemplateLiteral(value))) {
10841
+ if (value !== void 0 && (Node48.isStringLiteral(value) || Node48.isNoSubstitutionTemplateLiteral(value))) {
10713
10842
  return value.getLiteralValue();
10714
10843
  }
10715
10844
  return null;
@@ -10740,7 +10869,7 @@ function extractRouteInfoFromBinding(call, methodName, binding, resolution) {
10740
10869
  } else {
10741
10870
  const args = call.getArguments();
10742
10871
  const arg = args[binding.method.position];
10743
- if (arg === void 0 || !(Node47.isStringLiteral(arg) || Node47.isNoSubstitutionTemplateLiteral(arg))) {
10872
+ if (arg === void 0 || !(Node48.isStringLiteral(arg) || Node48.isNoSubstitutionTemplateLiteral(arg))) {
10744
10873
  return null;
10745
10874
  }
10746
10875
  method = arg.getLiteralValue().toUpperCase();
@@ -10751,7 +10880,7 @@ function extractRouteInfoFromBinding(call, methodName, binding, resolution) {
10751
10880
  }
10752
10881
 
10753
10882
  // src/discovery/registrationLoop.ts
10754
- import { Node as Node48 } from "ts-morph";
10883
+ import { Node as Node49 } from "ts-morph";
10755
10884
  function discoverRegistrationLoops(sourceFile, match, kind, resolution) {
10756
10885
  const results = [];
10757
10886
  const routables = routableNames(sourceFile, match);
@@ -10759,7 +10888,7 @@ function discoverRegistrationLoops(sourceFile, match, kind, resolution) {
10759
10888
  return results;
10760
10889
  }
10761
10890
  sourceFile.forEachDescendant((node) => {
10762
- if (!Node48.isForOfStatement(node)) {
10891
+ if (!Node49.isForOfStatement(node)) {
10763
10892
  return;
10764
10893
  }
10765
10894
  const expanded = tryExpandLoop(node, match, kind, resolution, routables);
@@ -10821,13 +10950,13 @@ function tryExpandLoop(loop, match, kind, resolution, routables) {
10821
10950
  }
10822
10951
  function loopVariableName(loop) {
10823
10952
  const initializer = loop.getInitializer();
10824
- if (Node48.isVariableDeclarationList(initializer)) {
10953
+ if (Node49.isVariableDeclarationList(initializer)) {
10825
10954
  const decls = initializer.getDeclarations();
10826
10955
  if (decls.length !== 1) {
10827
10956
  return null;
10828
10957
  }
10829
10958
  const nameNode = decls[0]?.getNameNode();
10830
- if (nameNode !== void 0 && Node48.isIdentifier(nameNode)) {
10959
+ if (nameNode !== void 0 && Node49.isIdentifier(nameNode)) {
10831
10960
  return nameNode.getText();
10832
10961
  }
10833
10962
  }
@@ -10840,14 +10969,14 @@ function bodyReferencesLoopVar(loop, name) {
10840
10969
  if (referenced) {
10841
10970
  return;
10842
10971
  }
10843
- if (!Node48.isCallExpression(node)) {
10972
+ if (!Node49.isCallExpression(node)) {
10844
10973
  return;
10845
10974
  }
10846
10975
  node.forEachDescendant((inner) => {
10847
10976
  if (referenced) {
10848
10977
  return;
10849
10978
  }
10850
- if (Node48.isIdentifier(inner) && inner.getText() === name) {
10979
+ if (Node49.isIdentifier(inner) && inner.getText() === name) {
10851
10980
  referenced = true;
10852
10981
  }
10853
10982
  });
@@ -10857,12 +10986,12 @@ function bodyReferencesLoopVar(loop, name) {
10857
10986
  function bodyCallsOn(loop, routables) {
10858
10987
  let found = false;
10859
10988
  loop.getStatement().forEachDescendant((node) => {
10860
- if (found || !Node48.isCallExpression(node)) {
10989
+ if (found || !Node49.isCallExpression(node)) {
10861
10990
  return;
10862
10991
  }
10863
10992
  const callee = node.getExpression();
10864
- const subject = Node48.isPropertyAccessExpression(callee) || Node48.isElementAccessExpression(callee) ? callee.getExpression() : null;
10865
- if (subject !== null && Node48.isIdentifier(subject) && routables.has(subject.getText())) {
10993
+ const subject = Node49.isPropertyAccessExpression(callee) || Node49.isElementAccessExpression(callee) ? callee.getExpression() : null;
10994
+ if (subject !== null && Node49.isIdentifier(subject) && routables.has(subject.getText())) {
10866
10995
  found = true;
10867
10996
  }
10868
10997
  });
@@ -10873,11 +11002,11 @@ function readRouteSpec(element, shape, resolution) {
10873
11002
  let path13 = null;
10874
11003
  let handler = null;
10875
11004
  for (const prop of element.getProperties()) {
10876
- if (Node48.isMethodDeclaration(prop) && prop.getName() === shape.handlerKey) {
11005
+ if (Node49.isMethodDeclaration(prop) && prop.getName() === shape.handlerKey) {
10877
11006
  handler = { func: prop, name: shape.handlerKey };
10878
11007
  continue;
10879
11008
  }
10880
- if (!Node48.isPropertyAssignment(prop)) {
11009
+ if (!Node49.isPropertyAssignment(prop)) {
10881
11010
  continue;
10882
11011
  }
10883
11012
  const name = prop.getName();
@@ -10900,17 +11029,17 @@ function readRouteSpec(element, shape, resolution) {
10900
11029
  return { method, path: path13, handler: handler.func, handlerName: handler.name };
10901
11030
  }
10902
11031
  function readStringLiteralValue(node) {
10903
- if (Node48.isStringLiteral(node) || Node48.isNoSubstitutionTemplateLiteral(node)) {
11032
+ if (Node49.isStringLiteral(node) || Node49.isNoSubstitutionTemplateLiteral(node)) {
10904
11033
  return node.getLiteralValue();
10905
11034
  }
10906
11035
  return null;
10907
11036
  }
10908
11037
  function handlerName(value) {
10909
- return Node48.isIdentifier(value) ? value.getText() : value.getKindName();
11038
+ return Node49.isIdentifier(value) ? value.getText() : value.getKindName();
10910
11039
  }
10911
11040
 
10912
11041
  // src/discovery/registrationTemplate.ts
10913
- import { Node as Node49 } from "ts-morph";
11042
+ import { Node as Node50 } from "ts-morph";
10914
11043
  function discoverRegistrationTemplates(sourceFile, match, kind, resolution) {
10915
11044
  const localName = resolveImportedLocalName2(sourceFile, match);
10916
11045
  if (localName === null) {
@@ -10918,7 +11047,7 @@ function discoverRegistrationTemplates(sourceFile, match, kind, resolution) {
10918
11047
  }
10919
11048
  const results = [];
10920
11049
  sourceFile.forEachDescendant((node) => {
10921
- if (!Node49.isCallExpression(node)) {
11050
+ if (!Node50.isCallExpression(node)) {
10922
11051
  return;
10923
11052
  }
10924
11053
  if (!isCallToHelper(node, localName)) {
@@ -10969,7 +11098,7 @@ function resolveImportedLocalName2(sourceFile, match) {
10969
11098
  }
10970
11099
  function isCallToHelper(call, localName) {
10971
11100
  const callee = call.getExpression();
10972
- return Node49.isIdentifier(callee) && callee.getText() === localName;
11101
+ return Node50.isIdentifier(callee) && callee.getText() === localName;
10973
11102
  }
10974
11103
  function substitutePath(template, args) {
10975
11104
  const re = /\{(\d+)\}/g;
@@ -10995,7 +11124,7 @@ function substitutePath(template, args) {
10995
11124
  return result;
10996
11125
  }
10997
11126
  function readStringLiteral(node) {
10998
- if (Node49.isStringLiteral(node) || Node49.isNoSubstitutionTemplateLiteral(node)) {
11127
+ if (Node50.isStringLiteral(node) || Node50.isNoSubstitutionTemplateLiteral(node)) {
10999
11128
  return node.getLiteralValue();
11000
11129
  }
11001
11130
  return null;
@@ -11018,7 +11147,7 @@ function resolveHandler(template, args, resolution) {
11018
11147
  return readPropertyAsFunction(arg, prop, resolution);
11019
11148
  }
11020
11149
  function handlerName2(value) {
11021
- return Node49.isIdentifier(value) ? value.getText() : value.getKindName();
11150
+ return Node50.isIdentifier(value) ? value.getText() : value.getKindName();
11022
11151
  }
11023
11152
  function readPropertyAsFunction(arg, prop, resolution) {
11024
11153
  const obj = objectLiteralOf(arg, resolution);
@@ -11029,7 +11158,7 @@ function readPropertyAsFunction(arg, prop, resolution) {
11029
11158
  if (propertyName2(property) !== prop) {
11030
11159
  continue;
11031
11160
  }
11032
- if (Node49.isMethodDeclaration(property)) {
11161
+ if (Node50.isMethodDeclaration(property)) {
11033
11162
  return { func: property, name: prop };
11034
11163
  }
11035
11164
  const held = propertyValueOf(property);
@@ -11037,19 +11166,19 @@ function readPropertyAsFunction(arg, prop, resolution) {
11037
11166
  return null;
11038
11167
  }
11039
11168
  const func = functionValueOf(held, resolution);
11040
- return func === null ? null : { func, name: Node49.isIdentifier(held) ? held.getText() : prop };
11169
+ return func === null ? null : { func, name: Node50.isIdentifier(held) ? held.getText() : prop };
11041
11170
  }
11042
11171
  return null;
11043
11172
  }
11044
11173
  function propertyName2(property) {
11045
- if (Node49.isPropertyAssignment(property) || Node49.isShorthandPropertyAssignment(property) || Node49.isMethodDeclaration(property)) {
11174
+ if (Node50.isPropertyAssignment(property) || Node50.isShorthandPropertyAssignment(property) || Node50.isMethodDeclaration(property)) {
11046
11175
  return property.getName();
11047
11176
  }
11048
11177
  return null;
11049
11178
  }
11050
11179
 
11051
11180
  // src/discovery/resolverMap.ts
11052
- import { Node as Node50 } from "ts-morph";
11181
+ import { Node as Node51 } from "ts-morph";
11053
11182
  function discoverResolverMaps(sourceFile, match, kind, resolution) {
11054
11183
  const localName = resolveImportedLocalName(
11055
11184
  sourceFile,
@@ -11063,15 +11192,15 @@ function discoverResolverMaps(sourceFile, match, kind, resolution) {
11063
11192
  const excludeTypes = new Set(match.excludeTypes ?? []);
11064
11193
  const results = [];
11065
11194
  sourceFile.forEachDescendant((node) => {
11066
- if (!Node50.isCallExpression(node) && !Node50.isNewExpression(node)) {
11195
+ if (!Node51.isCallExpression(node) && !Node51.isNewExpression(node)) {
11067
11196
  return;
11068
11197
  }
11069
11198
  const callee = node.getExpression();
11070
- if (!Node50.isIdentifier(callee) || callee.getText() !== localName) {
11199
+ if (!Node51.isIdentifier(callee) || callee.getText() !== localName) {
11071
11200
  return;
11072
11201
  }
11073
11202
  const args = node.getArguments();
11074
- if (args.length === 0 || !Node50.isObjectLiteralExpression(args[0])) {
11203
+ if (args.length === 0 || !Node51.isObjectLiteralExpression(args[0])) {
11075
11204
  return;
11076
11205
  }
11077
11206
  const config = args[0];
@@ -11125,7 +11254,7 @@ function resolverMapObject(prop, resolution) {
11125
11254
  return held === null ? null : objectLiteralOf(held, resolution);
11126
11255
  }
11127
11256
  function extractTypeDefsSdl(config, resolution) {
11128
- if (!Node50.isObjectLiteralExpression(config)) {
11257
+ if (!Node51.isObjectLiteralExpression(config)) {
11129
11258
  return null;
11130
11259
  }
11131
11260
  const prop = config.getProperty("typeDefs");
@@ -11147,15 +11276,15 @@ function schemaSdlOf(expr, resolution) {
11147
11276
  return resolved === null ? null : writtenSdl(resolved);
11148
11277
  }
11149
11278
  function writtenSdl(expr) {
11150
- if (Node50.isStringLiteral(expr) || Node50.isNoSubstitutionTemplateLiteral(expr)) {
11279
+ if (Node51.isStringLiteral(expr) || Node51.isNoSubstitutionTemplateLiteral(expr)) {
11151
11280
  const value = expr.getLiteralValue();
11152
11281
  return value === "" ? null : value;
11153
11282
  }
11154
- if (Node50.isTaggedTemplateExpression(expr)) {
11283
+ if (Node51.isTaggedTemplateExpression(expr)) {
11155
11284
  const tag = expr.getTag();
11156
- if (Node50.isIdentifier(tag) && tag.getText() === "gql") {
11285
+ if (Node51.isIdentifier(tag) && tag.getText() === "gql") {
11157
11286
  const template = expr.getTemplate();
11158
- if (Node50.isNoSubstitutionTemplateLiteral(template)) {
11287
+ if (Node51.isNoSubstitutionTemplateLiteral(template)) {
11159
11288
  return template.getLiteralValue();
11160
11289
  }
11161
11290
  }
@@ -11163,16 +11292,16 @@ function writtenSdl(expr) {
11163
11292
  return null;
11164
11293
  }
11165
11294
  function resolverPropertyName(prop) {
11166
- if (Node50.isPropertyAssignment(prop) || Node50.isMethodDeclaration(prop)) {
11295
+ if (Node51.isPropertyAssignment(prop) || Node51.isMethodDeclaration(prop)) {
11167
11296
  return prop.getName();
11168
11297
  }
11169
- if (Node50.isShorthandPropertyAssignment(prop)) {
11298
+ if (Node51.isShorthandPropertyAssignment(prop)) {
11170
11299
  return prop.getName();
11171
11300
  }
11172
11301
  return null;
11173
11302
  }
11174
11303
  function resolverPropertyFunction(prop, resolution) {
11175
- if (Node50.isMethodDeclaration(prop)) {
11304
+ if (Node51.isMethodDeclaration(prop)) {
11176
11305
  return prop;
11177
11306
  }
11178
11307
  const held = propertyValueOf(prop);
@@ -11434,7 +11563,7 @@ function resolvePrefix(edgesByChild, memo, childId, visiting) {
11434
11563
  }
11435
11564
 
11436
11565
  // src/discoveryContext.ts
11437
- import { Node as Node51 } from "ts-morph";
11566
+ import { Node as Node52 } from "ts-morph";
11438
11567
  function createTsDiscoveryContext(resolution) {
11439
11568
  return {
11440
11569
  getFilePath,
@@ -11466,7 +11595,7 @@ function exportedFunctions(sourceFile, resolution) {
11466
11595
  return out;
11467
11596
  }
11468
11597
  function exportedFunction(decl, resolution) {
11469
- const writtenAgain = Node51.isVariableDeclaration(decl) && isWrittenAgain(decl);
11598
+ const writtenAgain = Node52.isVariableDeclaration(decl) && isWrittenAgain(decl);
11470
11599
  if (!writtenAgain) {
11471
11600
  const declared = resolveDeclarationToFunction(decl);
11472
11601
  if (declared !== null) {
@@ -11487,7 +11616,7 @@ function valueToAskAbout(decl, writtenAgain) {
11487
11616
  if (writtenAgain) {
11488
11617
  return decl;
11489
11618
  }
11490
- const value = Node51.isVariableDeclaration(decl) ? decl.getInitializer() ?? decl : decl;
11619
+ const value = Node52.isVariableDeclaration(decl) ? decl.getInitializer() ?? decl : decl;
11491
11620
  return couldStillNameAFunction(value) ? value : null;
11492
11621
  }
11493
11622
  function exportedCallConfigString(sourceFile, exportName, spec, resolution) {
@@ -11497,11 +11626,11 @@ function exportedCallConfigString(sourceFile, exportName, spec, resolution) {
11497
11626
  }
11498
11627
  const found = /* @__PURE__ */ new Set();
11499
11628
  for (const decl of declarations) {
11500
- if (!Node51.isVariableDeclaration(decl)) {
11629
+ if (!Node52.isVariableDeclaration(decl)) {
11501
11630
  continue;
11502
11631
  }
11503
11632
  const init = peelExpression(decl.getInitializer());
11504
- if (init === void 0 || !Node51.isCallExpression(init)) {
11633
+ if (init === void 0 || !Node52.isCallExpression(init)) {
11505
11634
  continue;
11506
11635
  }
11507
11636
  if (!calleeIsNamed(init.getExpression(), spec.callees)) {
@@ -11520,7 +11649,7 @@ function calleeIsNamed(callee, names) {
11520
11649
  if (names === void 0 || names.length === 0) {
11521
11650
  return true;
11522
11651
  }
11523
- return Node51.isIdentifier(callee) && names.includes(callee.getText());
11652
+ return Node52.isIdentifier(callee) && names.includes(callee.getText());
11524
11653
  }
11525
11654
  function configArguments(args, argIndex) {
11526
11655
  if (argIndex === void 0) {
@@ -11535,18 +11664,18 @@ function configString(arg, property, resolution) {
11535
11664
  return null;
11536
11665
  }
11537
11666
  const prop = config.getProperty(property);
11538
- if (prop === void 0 || !Node51.isPropertyAssignment(prop)) {
11667
+ if (prop === void 0 || !Node52.isPropertyAssignment(prop)) {
11539
11668
  return null;
11540
11669
  }
11541
11670
  const value = peelExpression(prop.getInitializer());
11542
- if (value !== void 0 && Node51.isStringLiteral(value)) {
11671
+ if (value !== void 0 && Node52.isStringLiteral(value)) {
11543
11672
  return value.getLiteralValue();
11544
11673
  }
11545
11674
  return null;
11546
11675
  }
11547
11676
  function peelExpression(node) {
11548
11677
  let current2 = node;
11549
- while (current2 !== void 0 && (Node51.isAsExpression(current2) || Node51.isSatisfiesExpression(current2) || Node51.isParenthesizedExpression(current2) || Node51.isNonNullExpression(current2))) {
11678
+ while (current2 !== void 0 && (Node52.isAsExpression(current2) || Node52.isSatisfiesExpression(current2) || Node52.isParenthesizedExpression(current2) || Node52.isNonNullExpression(current2))) {
11550
11679
  current2 = current2.getExpression();
11551
11680
  }
11552
11681
  return current2;
@@ -11556,14 +11685,14 @@ function toObjectLiteral(node, resolution) {
11556
11685
  if (peeled === void 0) {
11557
11686
  return null;
11558
11687
  }
11559
- if (Node51.isObjectLiteralExpression(peeled)) {
11688
+ if (Node52.isObjectLiteralExpression(peeled)) {
11560
11689
  return peeled;
11561
11690
  }
11562
11691
  if (resolution === void 0) {
11563
11692
  return null;
11564
11693
  }
11565
11694
  const resolved = resolution.resolveObject(peeled);
11566
- if (resolved !== null && Node51.isObjectLiteralExpression(resolved)) {
11695
+ if (resolved !== null && Node52.isObjectLiteralExpression(resolved)) {
11567
11696
  return resolved;
11568
11697
  }
11569
11698
  return null;
@@ -11573,18 +11702,18 @@ function resolveDeclarationToFunction(decl) {
11573
11702
  if (fn !== null) {
11574
11703
  return fn;
11575
11704
  }
11576
- if (Node51.isVariableDeclaration(decl)) {
11705
+ if (Node52.isVariableDeclaration(decl)) {
11577
11706
  const init = decl.getInitializer();
11578
- if (init !== void 0 && (Node51.isArrowFunction(init) || Node51.isFunctionExpression(init))) {
11707
+ if (init !== void 0 && (Node52.isArrowFunction(init) || Node52.isFunctionExpression(init))) {
11579
11708
  return init;
11580
11709
  }
11581
11710
  }
11582
11711
  return null;
11583
11712
  }
11584
11713
  function hasJsxReturn(func) {
11585
- if (Node51.isArrowFunction(func)) {
11714
+ if (Node52.isArrowFunction(func)) {
11586
11715
  const body2 = func.getBody();
11587
- if (Node51.isExpression(body2) && isJsxOrFragment(body2)) {
11716
+ if (Node52.isExpression(body2) && isJsxOrFragment(body2)) {
11588
11717
  return true;
11589
11718
  }
11590
11719
  }
@@ -11598,11 +11727,11 @@ function hasJsxReturn(func) {
11598
11727
  traversal.stop();
11599
11728
  return;
11600
11729
  }
11601
- if (node !== func && (Node51.isFunctionDeclaration(node) || Node51.isFunctionExpression(node) || Node51.isArrowFunction(node) || Node51.isMethodDeclaration(node))) {
11730
+ if (node !== func && (Node52.isFunctionDeclaration(node) || Node52.isFunctionExpression(node) || Node52.isArrowFunction(node) || Node52.isMethodDeclaration(node))) {
11602
11731
  traversal.skip();
11603
11732
  return;
11604
11733
  }
11605
- if (Node51.isReturnStatement(node)) {
11734
+ if (Node52.isReturnStatement(node)) {
11606
11735
  const expr = node.getExpression();
11607
11736
  if (expr !== void 0 && isJsxOrFragment(expr)) {
11608
11737
  found = true;
@@ -11613,14 +11742,14 @@ function hasJsxReturn(func) {
11613
11742
  }
11614
11743
  function isJsxOrFragment(node) {
11615
11744
  let current2 = node;
11616
- while (Node51.isParenthesizedExpression(current2)) {
11745
+ while (Node52.isParenthesizedExpression(current2)) {
11617
11746
  current2 = current2.getExpression();
11618
11747
  }
11619
- return Node51.isJsxElement(current2) || Node51.isJsxSelfClosingElement(current2) || Node51.isJsxFragment(current2);
11748
+ return Node52.isJsxElement(current2) || Node52.isJsxSelfClosingElement(current2) || Node52.isJsxFragment(current2);
11620
11749
  }
11621
11750
 
11622
11751
  // src/facts/store.ts
11623
- import { Node as Node52 } from "ts-morph";
11752
+ import { Node as Node53 } from "ts-morph";
11624
11753
  import {
11625
11754
  clearRelations,
11626
11755
  Database as Database2,
@@ -11882,7 +12011,7 @@ var ResolutionStore = class {
11882
12011
  * can be rooted anywhere, so the queried value gets its own facts.
11883
12012
  */
11884
12013
  seedValue(value) {
11885
- if (!Node52.isExpression(value)) {
12014
+ if (!Node53.isExpression(value)) {
11886
12015
  return;
11887
12016
  }
11888
12017
  const id = nodeId(value);
@@ -11921,7 +12050,7 @@ var ResolutionStore = class {
11921
12050
  const candidates = /* @__PURE__ */ new Set();
11922
12051
  for (const target of this.answersFor("wantedIsWrittenAs", nodeId(value))) {
11923
12052
  const node = this.table.byId.get(target);
11924
- if (node === void 0 || node === value || !Node52.isExpression(node)) {
12053
+ if (node === void 0 || node === value || !Node53.isExpression(node)) {
11925
12054
  continue;
11926
12055
  }
11927
12056
  candidates.add(node);
@@ -12012,7 +12141,7 @@ function namesPackage2(moduleKey, packages) {
12012
12141
  );
12013
12142
  }
12014
12143
  function declarationOf2(value) {
12015
- const nameNode = Node52.isPropertyAccessExpression(value) ? value.getNameNode() : value;
12144
+ const nameNode = Node53.isPropertyAccessExpression(value) ? value.getNameNode() : value;
12016
12145
  return nameNode.getSymbol()?.getDeclarations()[0] ?? value;
12017
12146
  }
12018
12147
 
@@ -12147,6 +12276,68 @@ function moduleInitSummary(sourceFile, effects, options) {
12147
12276
  return assembleSummary(raw, options);
12148
12277
  }
12149
12278
 
12279
+ // src/parameterReads.ts
12280
+ import { Node as Node54 } from "ts-morph";
12281
+ function pathAbove(reference) {
12282
+ const path13 = [];
12283
+ let current2 = reference;
12284
+ for (; ; ) {
12285
+ const parent = current2.getParent();
12286
+ if (parent !== void 0 && Node54.isPropertyAccessExpression(parent) && parent.getExpression() === current2) {
12287
+ path13.push(parent.getName());
12288
+ current2 = parent;
12289
+ continue;
12290
+ }
12291
+ if (parent !== void 0 && Node54.isElementAccessExpression(parent) && parent.getExpression() === current2) {
12292
+ const argument = parent.getArgumentExpression();
12293
+ if (argument !== void 0 && Node54.isStringLiteral(argument)) {
12294
+ path13.push(argument.getLiteralValue());
12295
+ current2 = parent;
12296
+ continue;
12297
+ }
12298
+ }
12299
+ return path13;
12300
+ }
12301
+ }
12302
+ function declaresParameterOf(node, func) {
12303
+ if (Node54.isParameterDeclaration(node)) {
12304
+ return node.getParent() === func;
12305
+ }
12306
+ if (Node54.isBindingElement(node)) {
12307
+ const parameter = node.getFirstAncestor(Node54.isParameterDeclaration);
12308
+ return parameter !== void 0 && parameter.getParent() === func;
12309
+ }
12310
+ return false;
12311
+ }
12312
+ function parameterReads(func, parameterNames) {
12313
+ const wanted = new Set(parameterNames);
12314
+ if (wanted.size === 0) {
12315
+ return [];
12316
+ }
12317
+ const found = /* @__PURE__ */ new Map();
12318
+ func.forEachDescendant((node) => {
12319
+ if (!Node54.isIdentifier(node) || !wanted.has(node.getText())) {
12320
+ return;
12321
+ }
12322
+ const declarations = node.getSymbol()?.getDeclarations() ?? [];
12323
+ if (!declarations.some((decl) => declaresParameterOf(decl, func))) {
12324
+ return;
12325
+ }
12326
+ const inDeclaration = declarations.some(
12327
+ (decl) => decl.getStart() <= node.getStart() && node.getEnd() <= decl.getEnd()
12328
+ );
12329
+ if (inDeclaration) {
12330
+ return;
12331
+ }
12332
+ const read2 = { input: node.getText(), path: pathAbove(node) };
12333
+ const key = `${read2.input}\0${read2.path.join(".")}`;
12334
+ if (!found.has(key)) {
12335
+ found.set(key, read2);
12336
+ }
12337
+ });
12338
+ return [...found.values()];
12339
+ }
12340
+
12150
12341
  // src/referencedFiles.ts
12151
12342
  function createReferenceIndex(sourceFiles) {
12152
12343
  const direct = /* @__PURE__ */ new Map();
@@ -12288,111 +12479,10 @@ function deriveBoundaryEffects(summaries, facts) {
12288
12479
  }
12289
12480
 
12290
12481
  // src/resolve/reachableClosure.ts
12291
- import { Node as Node54 } from "ts-morph";
12482
+ import { Node as Node55 } from "ts-morph";
12292
12483
  import { functionCallBinding } from "@suss/behavioral-ir";
12293
12484
  import { Database as Database3, evaluate as evaluate4, lit as lit4, rule as rule4, variable as variable2 } from "@suss/datalog";
12294
12485
  import { assembleSummary as assembleSummary2 } from "@suss/extractor";
12295
-
12296
- // src/resolve/unfollowedCall.ts
12297
- import {
12298
- Node as Node53,
12299
- SyntaxKind as SyntaxKind11
12300
- } from "ts-morph";
12301
- function isInExternalCode(sourceFile) {
12302
- if (sourceFile.isDeclarationFile()) {
12303
- return true;
12304
- }
12305
- return sourceFile.getFilePath().includes("/node_modules/");
12306
- }
12307
- function hasBody(fn) {
12308
- if (Node53.isFunctionDeclaration(fn) || Node53.isMethodDeclaration(fn) || Node53.isFunctionExpression(fn)) {
12309
- return fn.getBody?.() !== void 0;
12310
- }
12311
- return true;
12312
- }
12313
- function isDeclaredShape(declaration) {
12314
- return (Node53.isMethodSignature(declaration) || Node53.isPropertySignature(declaration)) && !isInExternalCode(declaration.getSourceFile());
12315
- }
12316
- function isExternalDeclaration(declaration) {
12317
- if (isInExternalCode(declaration.getSourceFile())) {
12318
- return true;
12319
- }
12320
- if (Node53.isImportSpecifier(declaration) || Node53.isImportClause(declaration) || Node53.isNamespaceImport(declaration)) {
12321
- const target = declaration.getFirstAncestorByKind(SyntaxKind11.ImportDeclaration)?.getModuleSpecifierSourceFile();
12322
- return target === void 0 || isInExternalCode(target);
12323
- }
12324
- return declaresAnotherModule(declaration);
12325
- }
12326
- function declaresAnotherModule(declaration) {
12327
- const module = declaration.getFirstAncestorByKind(
12328
- SyntaxKind11.ModuleDeclaration
12329
- );
12330
- return module !== void 0 && Node53.isStringLiteral(module.getNameNode());
12331
- }
12332
- function statesShapeOnly(declaration) {
12333
- if (isExternalDeclaration(declaration)) {
12334
- return false;
12335
- }
12336
- if (Node53.isMethodSignature(declaration) || Node53.isPropertySignature(declaration)) {
12337
- return true;
12338
- }
12339
- if (Node53.isFunctionDeclaration(declaration) || Node53.isMethodDeclaration(declaration)) {
12340
- return declaration.getBody() === void 0;
12341
- }
12342
- return false;
12343
- }
12344
- function declarationsBehind(symbol) {
12345
- if (symbol === void 0) {
12346
- return [];
12347
- }
12348
- const behind = symbol.getAliasedSymbol()?.getDeclarations() ?? [];
12349
- return behind.length > 0 ? behind : symbol.getDeclarations();
12350
- }
12351
- function classifyStop(declarations) {
12352
- if (declarations.length === 0) {
12353
- return "noDeclaration";
12354
- }
12355
- for (const declaration of declarations) {
12356
- if (!isInExternalCode(declaration.getSourceFile())) {
12357
- recordFileDependency(declaration.getSourceFile().getFilePath());
12358
- }
12359
- }
12360
- if (declarations.every(isExternalDeclaration)) {
12361
- return "outsideRun";
12362
- }
12363
- if (declarations.some(statesShapeOnly)) {
12364
- return "noBody";
12365
- }
12366
- return "unsettledValue";
12367
- }
12368
- var RECORDED = {
12369
- noBody: true,
12370
- unsettledValue: true,
12371
- multipleSources: true,
12372
- outsideRun: false,
12373
- noDeclaration: false
12374
- };
12375
- function worthRecording(reason) {
12376
- return RECORDED[reason];
12377
- }
12378
- var STOP_SENTENCE = {
12379
- noBody: (callee) => `The call to ${callee} lands on a declaration with no body, so whatever runs there is missing from this summary`,
12380
- unsettledValue: (callee) => `The call to ${callee} goes through a value this run could not settle, so whatever runs there is missing from this summary`,
12381
- multipleSources: (callee) => `The call to ${callee} reaches a value with more than one possible source, so whatever runs there is missing from this summary`,
12382
- outsideRun: (callee) => `The call to ${callee} lands in a package whose source is not in this run, so whatever runs there is missing from this summary`,
12383
- noDeclaration: (callee) => `The call to ${callee} has no declaration this run could find, so whatever runs there is missing from this summary`
12384
- };
12385
- function unfollowedCallGap(stop) {
12386
- return {
12387
- type: "unfollowedCall",
12388
- conditions: [],
12389
- consequence: "unknown",
12390
- description: STOP_SENTENCE[stop.reason](stop.callee),
12391
- callee: stop.callee
12392
- };
12393
- }
12394
-
12395
- // src/resolve/reachableClosure.ts
12396
12486
  var reachablePack = {
12397
12487
  name: "reachable",
12398
12488
  languages: ["typescript"],
@@ -12426,9 +12516,9 @@ function resolveDecl(decl, calleeName) {
12426
12516
  }
12427
12517
  return { func: fn, name: declName(decl) ?? calleeName };
12428
12518
  }
12429
- if (Node54.isVariableDeclaration(decl)) {
12519
+ if (Node55.isVariableDeclaration(decl)) {
12430
12520
  const init = decl.getInitializer();
12431
- if (init !== void 0 && (Node54.isArrowFunction(init) || Node54.isFunctionExpression(init))) {
12521
+ if (init !== void 0 && (Node55.isArrowFunction(init) || Node55.isFunctionExpression(init))) {
12432
12522
  return { func: init, name: decl.getName() };
12433
12523
  }
12434
12524
  return null;
@@ -12436,26 +12526,26 @@ function resolveDecl(decl, calleeName) {
12436
12526
  return null;
12437
12527
  }
12438
12528
  function declName(decl) {
12439
- if (Node54.isFunctionDeclaration(decl) || Node54.isMethodDeclaration(decl)) {
12529
+ if (Node55.isFunctionDeclaration(decl) || Node55.isMethodDeclaration(decl)) {
12440
12530
  const n = decl.getName?.();
12441
12531
  if (typeof n === "string" && n.length > 0) {
12442
12532
  return n;
12443
12533
  }
12444
12534
  }
12445
- if (Node54.isFunctionExpression(decl)) {
12535
+ if (Node55.isFunctionExpression(decl)) {
12446
12536
  const n = decl.getName();
12447
12537
  if (typeof n === "string" && n.length > 0) {
12448
12538
  return n;
12449
12539
  }
12450
12540
  }
12451
12541
  const parent = decl.getParent();
12452
- if (parent !== void 0 && Node54.isVariableDeclaration(parent)) {
12542
+ if (parent !== void 0 && Node55.isVariableDeclaration(parent)) {
12453
12543
  return parent.getName();
12454
12544
  }
12455
12545
  return null;
12456
12546
  }
12457
12547
  function resolveCallee(call, calleeName, scan) {
12458
- if (!Node54.isCallExpression(call)) {
12548
+ if (!Node55.isCallExpression(call)) {
12459
12549
  return null;
12460
12550
  }
12461
12551
  const callee = call.getExpression();
@@ -12468,7 +12558,7 @@ function resolveCallee(call, calleeName, scan) {
12468
12558
  }
12469
12559
  }
12470
12560
  const resolveSources = scan.resolveCallableSources;
12471
- if (resolveSources !== void 0 && Node54.isPropertyAccessExpression(callee) && declarations.some(isDeclaredShape)) {
12561
+ if (resolveSources !== void 0 && Node55.isPropertyAccessExpression(callee) && declarations.some(isDeclaredShape)) {
12472
12562
  const sources = resolveSources(callee, scan.reachedFrom);
12473
12563
  const only = sources.length === 1 ? sources[0] : void 0;
12474
12564
  const resolved = only === void 0 ? null : resolveDecl(only, calleeName);
@@ -12490,19 +12580,35 @@ function resolveCallee(call, calleeName, scan) {
12490
12580
  }
12491
12581
  };
12492
12582
  }
12583
+ function resolveJsxReference(node) {
12584
+ if (!Node55.isJsxOpeningElement(node) && !Node55.isJsxSelfClosingElement(node)) {
12585
+ return null;
12586
+ }
12587
+ const tag = node.getTagNameNode();
12588
+ if (!Node55.isIdentifier(tag) || !/^[A-Z]/.test(tag.getText())) {
12589
+ return null;
12590
+ }
12591
+ const name = tag.getText();
12592
+ const declarations = declarationsBehind(tag.getSymbol());
12593
+ for (const decl of declarations) {
12594
+ const resolved = resolveDecl(decl, name);
12595
+ if (resolved !== null) {
12596
+ return { tag: name, outcome: { kind: "followed", candidate: resolved } };
12597
+ }
12598
+ }
12599
+ return {
12600
+ tag: name,
12601
+ outcome: {
12602
+ kind: "stopped",
12603
+ stop: { callee: name, reason: classifyStop(declarations) }
12604
+ }
12605
+ };
12606
+ }
12493
12607
  function collectReachable(func, scan) {
12494
12608
  const candidates = [];
12495
12609
  const stops = [];
12496
12610
  const seen = /* @__PURE__ */ new Set();
12497
- func.forEachDescendant((node) => {
12498
- if (!Node54.isCallExpression(node)) {
12499
- return;
12500
- }
12501
- const calleeText = normalizeCallee(node.getExpression().getText());
12502
- const outcome = resolveCallee(node, calleeText, scan);
12503
- if (outcome === null) {
12504
- return;
12505
- }
12611
+ const record = (outcome) => {
12506
12612
  if (outcome.kind === "stopped") {
12507
12613
  const stopKey = `${outcome.stop.reason}:${outcome.stop.callee}`;
12508
12614
  if (!seen.has(stopKey) && worthRecording(outcome.stop.reason)) {
@@ -12517,6 +12623,22 @@ function collectReachable(func, scan) {
12517
12623
  }
12518
12624
  seen.add(key);
12519
12625
  candidates.push(outcome.candidate);
12626
+ };
12627
+ func.forEachDescendant((node) => {
12628
+ const jsx = resolveJsxReference(node);
12629
+ if (jsx !== null) {
12630
+ record(jsx.outcome);
12631
+ return;
12632
+ }
12633
+ if (!Node55.isCallExpression(node)) {
12634
+ return;
12635
+ }
12636
+ const calleeText = normalizeCallee(node.getExpression().getText());
12637
+ const outcome = resolveCallee(node, calleeText, scan);
12638
+ if (outcome === null) {
12639
+ return;
12640
+ }
12641
+ record(outcome);
12520
12642
  });
12521
12643
  return { candidates, stops };
12522
12644
  }
@@ -12578,7 +12700,7 @@ function recognizerOnlyRoots(packsByFile) {
12578
12700
  }
12579
12701
  for (const declaration of variableStatement.getDeclarations()) {
12580
12702
  const init = declaration.getInitializer();
12581
- if (init !== void 0 && (Node54.isArrowFunction(init) || Node54.isFunctionExpression(init)) && hasBody(init)) {
12703
+ if (init !== void 0 && (Node55.isArrowFunction(init) || Node55.isFunctionExpression(init)) && hasBody(init)) {
12582
12704
  roots.push({ func: init, name: declaration.getName() });
12583
12705
  }
12584
12706
  }
@@ -12719,7 +12841,7 @@ function recordStops(stopsByKey, summariesByKey, options) {
12719
12841
  }
12720
12842
 
12721
12843
  // src/resolve/rethrowEnrichment.ts
12722
- import { Node as Node55 } from "ts-morph";
12844
+ import { Node as Node56 } from "ts-morph";
12723
12845
  import { Database as Database4, evaluate as evaluate5, lit as lit5, rule as rule5, variable as variable3 } from "@suss/datalog";
12724
12846
  var RETHROW_RULES = [
12725
12847
  rule5(
@@ -12859,7 +12981,7 @@ function findBareRethrow(func, location) {
12859
12981
  traversal.stop();
12860
12982
  return;
12861
12983
  }
12862
- if (!Node55.isThrowStatement(node)) {
12984
+ if (!Node56.isThrowStatement(node)) {
12863
12985
  return;
12864
12986
  }
12865
12987
  if (startLineOf(node) !== location.start) {
@@ -12869,7 +12991,7 @@ function findBareRethrow(func, location) {
12869
12991
  return;
12870
12992
  }
12871
12993
  const thrown = node.getExpression();
12872
- if (thrown !== void 0 && Node55.isIdentifier(thrown)) {
12994
+ if (thrown !== void 0 && Node56.isIdentifier(thrown)) {
12873
12995
  found = node;
12874
12996
  }
12875
12997
  });
@@ -12879,13 +13001,13 @@ function enclosingTry(throwStmt) {
12879
13001
  let current2 = throwStmt.getParent();
12880
13002
  let sawCatchClause = false;
12881
13003
  while (current2 !== void 0) {
12882
- if (Node55.isCatchClause(current2)) {
13004
+ if (Node56.isCatchClause(current2)) {
12883
13005
  sawCatchClause = true;
12884
13006
  }
12885
- if (Node55.isTryStatement(current2)) {
13007
+ if (Node56.isTryStatement(current2)) {
12886
13008
  return sawCatchClause ? current2 : null;
12887
13009
  }
12888
- if (Node55.isFunctionDeclaration(current2) || Node55.isFunctionExpression(current2) || Node55.isArrowFunction(current2) || Node55.isMethodDeclaration(current2)) {
13010
+ if (Node56.isFunctionDeclaration(current2) || Node56.isFunctionExpression(current2) || Node56.isArrowFunction(current2) || Node56.isMethodDeclaration(current2)) {
12889
13011
  return null;
12890
13012
  }
12891
13013
  current2 = current2.getParent();
@@ -12893,14 +13015,14 @@ function enclosingTry(throwStmt) {
12893
13015
  return null;
12894
13016
  }
12895
13017
  function collectTryBodyCallees(tryStmt, index, keyFor) {
12896
- if (!Node55.isTryStatement(tryStmt)) {
13018
+ if (!Node56.isTryStatement(tryStmt)) {
12897
13019
  return [];
12898
13020
  }
12899
13021
  const tryBlock = tryStmt.getTryBlock();
12900
13022
  const callees = [];
12901
13023
  const seen = /* @__PURE__ */ new Set();
12902
13024
  tryBlock.forEachDescendant((node) => {
12903
- if (!Node55.isCallExpression(node)) {
13025
+ if (!Node56.isCallExpression(node)) {
12904
13026
  return;
12905
13027
  }
12906
13028
  const calleeSummary = resolveCalleeSummary(node, index);
@@ -12917,7 +13039,7 @@ function collectTryBodyCallees(tryStmt, index, keyFor) {
12917
13039
  return callees;
12918
13040
  }
12919
13041
  function resolveCalleeSummary(call, index) {
12920
- if (!Node55.isCallExpression(call)) {
13042
+ if (!Node56.isCallExpression(call)) {
12921
13043
  return null;
12922
13044
  }
12923
13045
  const callee = call.getExpression();
@@ -12943,12 +13065,12 @@ function resolveCalleeSummary(call, index) {
12943
13065
  return null;
12944
13066
  }
12945
13067
  function functionFromDecl(decl) {
12946
- if (Node55.isFunctionDeclaration(decl) || Node55.isFunctionExpression(decl) || Node55.isArrowFunction(decl) || Node55.isMethodDeclaration(decl)) {
13068
+ if (Node56.isFunctionDeclaration(decl) || Node56.isFunctionExpression(decl) || Node56.isArrowFunction(decl) || Node56.isMethodDeclaration(decl)) {
12947
13069
  return decl;
12948
13070
  }
12949
- if (Node55.isVariableDeclaration(decl)) {
13071
+ if (Node56.isVariableDeclaration(decl)) {
12950
13072
  const init = decl.getInitializer();
12951
- if (init !== void 0 && (Node55.isArrowFunction(init) || Node55.isFunctionExpression(init))) {
13073
+ if (init !== void 0 && (Node56.isArrowFunction(init) || Node56.isFunctionExpression(init))) {
12952
13074
  return init;
12953
13075
  }
12954
13076
  }
@@ -12957,23 +13079,23 @@ function functionFromDecl(decl) {
12957
13079
 
12958
13080
  // src/shapes/fieldAccesses.ts
12959
13081
  import {
12960
- Node as Node56
13082
+ Node as Node57
12961
13083
  } from "ts-morph";
12962
13084
  function findResponseAccessor(callExpr) {
12963
13085
  let current2 = callExpr;
12964
13086
  const parent1 = current2.getParent();
12965
- if (parent1 !== void 0 && Node56.isAwaitExpression(parent1)) {
13087
+ if (parent1 !== void 0 && Node57.isAwaitExpression(parent1)) {
12966
13088
  current2 = parent1;
12967
13089
  }
12968
13090
  const parent2 = current2.getParent();
12969
- if (parent2 === void 0 || !Node56.isVariableDeclaration(parent2)) {
13091
+ if (parent2 === void 0 || !Node57.isVariableDeclaration(parent2)) {
12970
13092
  return null;
12971
13093
  }
12972
13094
  const nameNode = parent2.getNameNode();
12973
- if (Node56.isIdentifier(nameNode)) {
13095
+ if (Node57.isIdentifier(nameNode)) {
12974
13096
  return { kind: "identifier", name: nameNode.getText() };
12975
13097
  }
12976
- if (Node56.isObjectBindingPattern(nameNode)) {
13098
+ if (Node57.isObjectBindingPattern(nameNode)) {
12977
13099
  const bindings = /* @__PURE__ */ new Map();
12978
13100
  for (const element of nameNode.getElements()) {
12979
13101
  if (element.getDotDotDotToken() !== void 0) {
@@ -12994,11 +13116,11 @@ function findResponseAccessor(callExpr) {
12994
13116
  function buildThenChainAccessor(callExpr, func) {
12995
13117
  const bindings = /* @__PURE__ */ new Map();
12996
13118
  func.forEachDescendant((node) => {
12997
- if (!Node56.isParameterDeclaration(node)) {
13119
+ if (!Node57.isParameterDeclaration(node)) {
12998
13120
  return;
12999
13121
  }
13000
13122
  const nameNode = node.getNameNode();
13001
- if (!Node56.isIdentifier(nameNode)) {
13123
+ if (!Node57.isIdentifier(nameNode)) {
13002
13124
  return;
13003
13125
  }
13004
13126
  const prefix = prefixOfThenParam(node, callExpr, 0);
@@ -13030,7 +13152,7 @@ function prefixOfExpr(expr, responseCall, depth) {
13030
13152
  if (node === responseCall) {
13031
13153
  return [];
13032
13154
  }
13033
- if (Node56.isCallExpression(node)) {
13155
+ if (Node57.isCallExpression(node)) {
13034
13156
  const hop = thenLikeCall(node);
13035
13157
  if (hop !== null) {
13036
13158
  if (hop.method === "catch") {
@@ -13062,14 +13184,14 @@ function prefixOfMemberExpr(expr, responseCall, depth) {
13062
13184
  return null;
13063
13185
  }
13064
13186
  const decl = chain.root.getSymbol()?.getDeclarations()?.[0];
13065
- if (decl === void 0 || !Node56.isParameterDeclaration(decl)) {
13187
+ if (decl === void 0 || !Node57.isParameterDeclaration(decl)) {
13066
13188
  return null;
13067
13189
  }
13068
13190
  const base = prefixOfThenParam(decl, responseCall, depth + 1);
13069
13191
  return base === null ? null : [...base, ...chain.segments];
13070
13192
  }
13071
13193
  function firstCallbackParamName(callback) {
13072
- if (callback === void 0 || !(Node56.isArrowFunction(callback) || Node56.isFunctionExpression(callback))) {
13194
+ if (callback === void 0 || !(Node57.isArrowFunction(callback) || Node57.isFunctionExpression(callback))) {
13073
13195
  return null;
13074
13196
  }
13075
13197
  const param = callback.getParameters()[0];
@@ -13077,11 +13199,11 @@ function firstCallbackParamName(callback) {
13077
13199
  return null;
13078
13200
  }
13079
13201
  const nameNode = param.getNameNode();
13080
- return Node56.isIdentifier(nameNode) ? nameNode.getText() : null;
13202
+ return Node57.isIdentifier(nameNode) ? nameNode.getText() : null;
13081
13203
  }
13082
13204
  function unwrap2(expr) {
13083
13205
  let node = expr;
13084
- while (Node56.isAwaitExpression(node) || Node56.isParenthesizedExpression(node) || Node56.isAsExpression(node)) {
13206
+ while (Node57.isAwaitExpression(node) || Node57.isParenthesizedExpression(node) || Node57.isAsExpression(node)) {
13085
13207
  node = node.getExpression();
13086
13208
  }
13087
13209
  return node;
@@ -13091,15 +13213,15 @@ function chainRootedAt(expr, rootName) {
13091
13213
  if (chain === null) {
13092
13214
  return null;
13093
13215
  }
13094
- return Node56.isIdentifier(chain.root) && chain.root.getText() === rootName ? chain.segments : null;
13216
+ return Node57.isIdentifier(chain.root) && chain.root.getText() === rootName ? chain.segments : null;
13095
13217
  }
13096
13218
  function memberChain(expr) {
13097
- let node = Node56.isExpression(expr) ? unwrap2(expr) : expr;
13098
- if (Node56.isCallExpression(node)) {
13219
+ let node = Node57.isExpression(expr) ? unwrap2(expr) : expr;
13220
+ if (Node57.isCallExpression(node)) {
13099
13221
  node = node.getExpression();
13100
13222
  }
13101
13223
  const segments = [];
13102
- while (Node56.isPropertyAccessExpression(node)) {
13224
+ while (Node57.isPropertyAccessExpression(node)) {
13103
13225
  segments.unshift(node.getName());
13104
13226
  node = node.getExpression();
13105
13227
  }
@@ -13118,16 +13240,16 @@ function collectPropertyAccesses(subtree, accessor) {
13118
13240
  if (accessor.kind === "identifier") {
13119
13241
  const varName = accessor.name;
13120
13242
  subtree.forEachDescendant((node) => {
13121
- if (!Node56.isPropertyAccessExpression(node)) {
13243
+ if (!Node57.isPropertyAccessExpression(node)) {
13122
13244
  return;
13123
13245
  }
13124
13246
  const chain = [];
13125
13247
  let current2 = node;
13126
- while (Node56.isPropertyAccessExpression(current2)) {
13248
+ while (Node57.isPropertyAccessExpression(current2)) {
13127
13249
  chain.unshift(current2.getName());
13128
13250
  current2 = current2.getExpression();
13129
13251
  }
13130
- if (Node56.isIdentifier(current2) && current2.getText() === varName) {
13252
+ if (Node57.isIdentifier(current2) && current2.getText() === varName) {
13131
13253
  pushChain(chain);
13132
13254
  }
13133
13255
  });
@@ -13138,7 +13260,7 @@ function collectPropertyAccesses(subtree, accessor) {
13138
13260
  return source === void 0 ? void 0 : [source];
13139
13261
  } : (name) => accessor.bindings.get(name);
13140
13262
  subtree.forEachDescendant((node) => {
13141
- if (!Node56.isIdentifier(node)) {
13263
+ if (!Node57.isIdentifier(node)) {
13142
13264
  return;
13143
13265
  }
13144
13266
  const prefix = prefixOf(node.getText());
@@ -13150,13 +13272,13 @@ function collectPropertyAccesses(subtree, accessor) {
13150
13272
  }
13151
13273
  let chainTop = node;
13152
13274
  let parent = chainTop.getParent();
13153
- while (parent !== void 0 && Node56.isPropertyAccessExpression(parent) && parent.getExpression() === chainTop) {
13275
+ while (parent !== void 0 && Node57.isPropertyAccessExpression(parent) && parent.getExpression() === chainTop) {
13154
13276
  chainTop = parent;
13155
13277
  parent = chainTop.getParent();
13156
13278
  }
13157
13279
  const segments = [];
13158
13280
  let current2 = chainTop;
13159
- while (Node56.isPropertyAccessExpression(current2)) {
13281
+ while (Node57.isPropertyAccessExpression(current2)) {
13160
13282
  segments.push(current2.getName());
13161
13283
  current2 = current2.getExpression();
13162
13284
  }
@@ -13170,15 +13292,15 @@ function isBindingDeclarationSite(node) {
13170
13292
  return true;
13171
13293
  }
13172
13294
  const parent = node.getParent();
13173
- return parent !== void 0 && Node56.isParameterDeclaration(parent) && parent.getNameNode() === node;
13295
+ return parent !== void 0 && Node57.isParameterDeclaration(parent) && parent.getNameNode() === node;
13174
13296
  }
13175
13297
  function isInsideObjectBindingPattern(node) {
13176
13298
  let current2 = node.getParent();
13177
13299
  while (current2 !== void 0) {
13178
- if (Node56.isObjectBindingPattern(current2)) {
13300
+ if (Node57.isObjectBindingPattern(current2)) {
13179
13301
  return true;
13180
13302
  }
13181
- if (Node56.isFunctionLikeDeclaration(current2) || Node56.isVariableStatement(current2)) {
13303
+ if (Node57.isFunctionLikeDeclaration(current2) || Node57.isVariableStatement(current2)) {
13182
13304
  break;
13183
13305
  }
13184
13306
  current2 = current2.getParent();
@@ -13241,7 +13363,7 @@ function findBranchSubtree(func, byLineRange, terminalStartLine, terminalEndLine
13241
13363
  if (parent === void 0) {
13242
13364
  break;
13243
13365
  }
13244
- if (Node56.isIfStatement(parent)) {
13366
+ if (Node57.isIfStatement(parent)) {
13245
13367
  const ifStmt = parent;
13246
13368
  const thenBlock = ifStmt.getThenStatement();
13247
13369
  const elseBlock = ifStmt.getElseStatement();
@@ -13304,7 +13426,7 @@ function buildNonBodyPropertySet(semantics) {
13304
13426
 
13305
13427
  // src/subUnitContext.ts
13306
13428
  import {
13307
- Node as Node57
13429
+ Node as Node58
13308
13430
  } from "ts-morph";
13309
13431
  function createTsSubUnitContext() {
13310
13432
  return {
@@ -13318,7 +13440,7 @@ function createTsSubUnitContext() {
13318
13440
  }
13319
13441
  function skipNestedFunctions(parent) {
13320
13442
  return (node, traversal) => {
13321
- if (node !== parent && (Node57.isFunctionDeclaration(node) || Node57.isFunctionExpression(node) || Node57.isArrowFunction(node) || Node57.isMethodDeclaration(node))) {
13443
+ if (node !== parent && (Node58.isFunctionDeclaration(node) || Node58.isFunctionExpression(node) || Node58.isArrowFunction(node) || Node58.isMethodDeclaration(node))) {
13322
13444
  traversal.skip();
13323
13445
  return true;
13324
13446
  }
@@ -13332,18 +13454,18 @@ function findJsxAttributes(parent) {
13332
13454
  if (skip(node, traversal)) {
13333
13455
  return;
13334
13456
  }
13335
- if (!Node57.isJsxOpeningElement(node) && !Node57.isJsxSelfClosingElement(node)) {
13457
+ if (!Node58.isJsxOpeningElement(node) && !Node58.isJsxSelfClosingElement(node)) {
13336
13458
  return;
13337
13459
  }
13338
13460
  const tag = node.getTagNameNode().getText();
13339
13461
  for (const attr of node.getAttributes()) {
13340
- if (!Node57.isJsxAttribute(attr)) {
13462
+ if (!Node58.isJsxAttribute(attr)) {
13341
13463
  continue;
13342
13464
  }
13343
13465
  const initializer = attr.getInitializer();
13344
13466
  let valueExpression = null;
13345
13467
  if (initializer !== void 0) {
13346
- if (Node57.isJsxExpression(initializer)) {
13468
+ if (Node58.isJsxExpression(initializer)) {
13347
13469
  const inner = initializer.getExpression();
13348
13470
  valueExpression = inner ?? null;
13349
13471
  } else {
@@ -13366,11 +13488,11 @@ function findCallExpressionsByName(parent, name) {
13366
13488
  if (skip(node, traversal)) {
13367
13489
  return;
13368
13490
  }
13369
- if (!Node57.isCallExpression(node)) {
13491
+ if (!Node58.isCallExpression(node)) {
13370
13492
  return;
13371
13493
  }
13372
13494
  const callee = node.getExpression();
13373
- if (Node57.isIdentifier(callee) && callee.getText() === name) {
13495
+ if (Node58.isIdentifier(callee) && callee.getText() === name) {
13374
13496
  out.push(node);
13375
13497
  }
13376
13498
  });
@@ -13381,10 +13503,10 @@ function resolveAttributeValueFunction(attr, parent) {
13381
13503
  if (expr === null) {
13382
13504
  return null;
13383
13505
  }
13384
- if (Node57.isArrowFunction(expr) || Node57.isFunctionExpression(expr)) {
13506
+ if (Node58.isArrowFunction(expr) || Node58.isFunctionExpression(expr)) {
13385
13507
  return { func: expr, localName: null };
13386
13508
  }
13387
- if (Node57.isIdentifier(expr)) {
13509
+ if (Node58.isIdentifier(expr)) {
13388
13510
  const symbol = expr.getSymbol();
13389
13511
  if (symbol === void 0) {
13390
13512
  return null;
@@ -13403,15 +13525,15 @@ function resolveAttributeValueFunction(attr, parent) {
13403
13525
  return null;
13404
13526
  }
13405
13527
  function tryExtractFunction(decl) {
13406
- if (Node57.isFunctionDeclaration(decl)) {
13528
+ if (Node58.isFunctionDeclaration(decl)) {
13407
13529
  return decl;
13408
13530
  }
13409
- if (Node57.isVariableDeclaration(decl)) {
13531
+ if (Node58.isVariableDeclaration(decl)) {
13410
13532
  const init = decl.getInitializer();
13411
13533
  if (init === void 0) {
13412
13534
  return null;
13413
13535
  }
13414
- if (Node57.isArrowFunction(init) || Node57.isFunctionExpression(init)) {
13536
+ if (Node58.isArrowFunction(init) || Node58.isFunctionExpression(init)) {
13415
13537
  return init;
13416
13538
  }
13417
13539
  }
@@ -13432,7 +13554,7 @@ function getCallArgumentFunction(call, position) {
13432
13554
  if (arg === void 0) {
13433
13555
  return null;
13434
13556
  }
13435
- if (Node57.isArrowFunction(arg) || Node57.isFunctionExpression(arg)) {
13557
+ if (Node58.isArrowFunction(arg) || Node58.isFunctionExpression(arg)) {
13436
13558
  return arg;
13437
13559
  }
13438
13560
  return null;
@@ -13444,7 +13566,7 @@ function readArrayLiteralText(node) {
13444
13566
  if (node === null) {
13445
13567
  return null;
13446
13568
  }
13447
- if (Node57.isArrayLiteralExpression(node)) {
13569
+ if (Node58.isArrayLiteralExpression(node)) {
13448
13570
  return node.getElements().map((e) => e.getText());
13449
13571
  }
13450
13572
  return [node.getText()];
@@ -13864,13 +13986,13 @@ var raise = (msg) => {
13864
13986
  throw new Error(msg);
13865
13987
  };
13866
13988
  function bindingPatternNames(nameNode) {
13867
- if (Node58.isObjectBindingPattern(nameNode)) {
13989
+ if (Node59.isObjectBindingPattern(nameNode)) {
13868
13990
  return nameNode.getElements().map((e) => e.getName());
13869
13991
  }
13870
- if (Node58.isArrayBindingPattern(nameNode)) {
13992
+ if (Node59.isArrayBindingPattern(nameNode)) {
13871
13993
  const names = [];
13872
13994
  for (const element of nameNode.getElements()) {
13873
- if (Node58.isOmittedExpression(element)) {
13995
+ if (Node59.isOmittedExpression(element)) {
13874
13996
  continue;
13875
13997
  }
13876
13998
  names.push(element.getName());
@@ -13900,7 +14022,7 @@ function objectParamInputs(param, position, mapping) {
13900
14022
  }
13901
14023
  function componentPropsParameters(param, mapping) {
13902
14024
  const nameNode = param.getNameNode();
13903
- if (!Node58.isObjectBindingPattern(nameNode)) {
14025
+ if (!Node59.isObjectBindingPattern(nameNode)) {
13904
14026
  const type = param.getType();
13905
14027
  return [
13906
14028
  {
@@ -13949,7 +14071,17 @@ function extractParameters(func, inputMapping) {
13949
14071
  const param = params[i];
13950
14072
  const nameNode = param.getNameNode();
13951
14073
  const boundNames = bindingPatternNames(nameNode);
13952
- if (boundNames !== null) {
14074
+ if (Node59.isObjectBindingPattern(nameNode)) {
14075
+ for (const element of nameNode.getElements()) {
14076
+ const rest = element.getDotDotDotToken() !== void 0;
14077
+ result.push({
14078
+ name: element.getName(),
14079
+ position: i,
14080
+ role: rest ? "rest" : inputMapping.defaultRole ?? element.getName(),
14081
+ typeText: null
14082
+ });
14083
+ }
14084
+ } else if (boundNames !== null) {
13953
14085
  for (const name of boundNames) {
13954
14086
  result.push({
13955
14087
  name,
@@ -14003,11 +14135,11 @@ function extractParameters(func, inputMapping) {
14003
14135
  function extractDependencyCalls(func) {
14004
14136
  const results = [];
14005
14137
  func.forEachDescendant((node, traversal) => {
14006
- if (node !== func && (Node58.isFunctionDeclaration(node) || Node58.isFunctionExpression(node) || Node58.isArrowFunction(node) || Node58.isMethodDeclaration(node))) {
14138
+ if (node !== func && (Node59.isFunctionDeclaration(node) || Node59.isFunctionExpression(node) || Node59.isArrowFunction(node) || Node59.isMethodDeclaration(node))) {
14007
14139
  traversal.skip();
14008
14140
  return;
14009
14141
  }
14010
- if (!Node58.isVariableDeclaration(node)) {
14142
+ if (!Node59.isVariableDeclaration(node)) {
14011
14143
  return;
14012
14144
  }
14013
14145
  const init = node.getInitializer();
@@ -14016,19 +14148,19 @@ function extractDependencyCalls(func) {
14016
14148
  }
14017
14149
  let isAsync = false;
14018
14150
  let callExpr = init;
14019
- if (Node58.isAwaitExpression(init)) {
14151
+ if (Node59.isAwaitExpression(init)) {
14020
14152
  isAsync = true;
14021
14153
  callExpr = init.getExpression();
14022
14154
  }
14023
- if (!Node58.isCallExpression(callExpr)) {
14155
+ if (!Node59.isCallExpression(callExpr)) {
14024
14156
  return;
14025
14157
  }
14026
14158
  const calleeName = callExpr.getExpression().getText();
14027
14159
  const nameNode = node.getNameNode();
14028
- const assignedTo = Node58.isIdentifier(nameNode) ? nameNode.getText() : null;
14160
+ const assignedTo = Node59.isIdentifier(nameNode) ? nameNode.getText() : null;
14029
14161
  const declList = node.getParent();
14030
14162
  const varStmt = declList?.getParent();
14031
- const locationNode = varStmt !== void 0 && Node58.isVariableStatement(varStmt) ? varStmt : node;
14163
+ const locationNode = varStmt !== void 0 && Node59.isVariableStatement(varStmt) ? varStmt : node;
14032
14164
  results.push({
14033
14165
  name: calleeName,
14034
14166
  assignedTo,
@@ -14208,6 +14340,10 @@ function readCodeStructure(unit, pack, invocationRecognizers, accessRecognizers,
14208
14340
  barriers
14209
14341
  );
14210
14342
  const depCalls = extractDependencyCalls(func);
14343
+ const paramReads = parameterReads(
14344
+ func,
14345
+ params.map((one) => one.name)
14346
+ );
14211
14347
  if (unit.callSite !== void 0) {
14212
14348
  const calleeText = unit.callSite.callExpression.getExpression().getText();
14213
14349
  if (pack.responseSemantics !== void 0) {
@@ -14255,6 +14391,7 @@ function readCodeStructure(unit, pack, invocationRecognizers, accessRecognizers,
14255
14391
  bodyContent: bodyContentOf(func),
14256
14392
  dependencyCalls: depCalls,
14257
14393
  declaredContract: null,
14394
+ ...paramReads.length > 0 ? { extraInputReads: paramReads } : {},
14258
14395
  ...accessors,
14259
14396
  ...unit.callSite !== void 0 && pack.failureDelivery !== void 0 ? { failureDelivery: pack.failureDelivery } : {}
14260
14397
  };
@@ -14313,9 +14450,9 @@ function extractBindingMethod(binding, callSite, pack, resolution) {
14313
14450
  if (m.type === "fromArgumentProperty") {
14314
14451
  const args = callSite.callExpression.getArguments();
14315
14452
  const arg = args[m.position];
14316
- if (arg !== void 0 && Node58.isObjectLiteralExpression(arg)) {
14453
+ if (arg !== void 0 && Node59.isObjectLiteralExpression(arg)) {
14317
14454
  const prop = arg.getProperty(m.property);
14318
- if (prop !== void 0 && Node58.isPropertyAssignment(prop)) {
14455
+ if (prop !== void 0 && Node59.isPropertyAssignment(prop)) {
14319
14456
  const init = prop.getInitializer();
14320
14457
  if (init !== void 0) {
14321
14458
  const value = stringValueOf(init, resolution);
@@ -14398,8 +14535,8 @@ function collectAccessRecognizers(frameworks, tallies) {
14398
14535
  }
14399
14536
  return out;
14400
14537
  }
14401
- function computeSubUnitBarriers(unit, pack, ctx, tally, file) {
14402
- if (pack.subUnits === void 0 || unit.func === null) {
14538
+ function computeSubUnitBarriers(unit, packs, ctx, tallies, file) {
14539
+ if (unit.func === null) {
14403
14540
  return NO_BARRIERS;
14404
14541
  }
14405
14542
  const parentHandle = {
@@ -14407,27 +14544,27 @@ function computeSubUnitBarriers(unit, pack, ctx, tally, file) {
14407
14544
  name: unit.name,
14408
14545
  kind: unit.kind
14409
14546
  };
14410
- try {
14411
- const subUnits = pack.subUnits(parentHandle, ctx);
14412
- if (subUnits.length === 0) {
14413
- return NO_BARRIERS;
14547
+ const barriers = /* @__PURE__ */ new Set();
14548
+ for (const pack of packs) {
14549
+ if (pack.subUnits === void 0) {
14550
+ continue;
14414
14551
  }
14415
- const barriers = /* @__PURE__ */ new Set();
14416
- for (const su of subUnits) {
14417
- barriers.add(su.func);
14552
+ try {
14553
+ for (const su of pack.subUnits(parentHandle, ctx)) {
14554
+ barriers.add(su.func);
14555
+ }
14556
+ } catch (err) {
14557
+ process.stderr.write(
14558
+ recordPackFailure(tallies?.get(pack.name), {
14559
+ pack: pack.name,
14560
+ hook: "subUnits",
14561
+ file,
14562
+ error: err
14563
+ })
14564
+ );
14418
14565
  }
14419
- return barriers;
14420
- } catch (err) {
14421
- process.stderr.write(
14422
- recordPackFailure(tally, {
14423
- pack: pack.name,
14424
- hook: "subUnits",
14425
- file,
14426
- error: err
14427
- })
14428
- );
14429
- return NO_BARRIERS;
14430
14566
  }
14567
+ return barriers.size === 0 ? NO_BARRIERS : barriers;
14431
14568
  }
14432
14569
  function extractFromSourceFile(sourceFile, frameworks, claimedUnits, options, tallies, resolution, mountPrefixes) {
14433
14570
  const summaries = [];
@@ -14509,9 +14646,9 @@ function extractFromSourceFile(sourceFile, frameworks, claimedUnits, options, ta
14509
14646
  }
14510
14647
  const barriers = computeSubUnitBarriers(
14511
14648
  unit,
14512
- pack,
14649
+ frameworks,
14513
14650
  subUnitCtx,
14514
- tally,
14651
+ tallies,
14515
14652
  sourceFile.getFilePath()
14516
14653
  );
14517
14654
  const raw = extractCodeStructure(
@@ -14854,7 +14991,7 @@ function findWrapperPathParam(summary, lookup) {
14854
14991
  }
14855
14992
  for (const call of func.getDescendantsOfKind(SyntaxKind12.CallExpression)) {
14856
14993
  const first = call.getArguments()[0];
14857
- if (first === void 0 || !Node58.isIdentifier(first)) {
14994
+ if (first === void 0 || !Node59.isIdentifier(first)) {
14858
14995
  continue;
14859
14996
  }
14860
14997
  const at = names.indexOf(first.getText());
@@ -14903,16 +15040,16 @@ function synthesizeCallerSummaries(wrapper, _project, options, resolution) {
14903
15040
  return out;
14904
15041
  }
14905
15042
  function wrapperNameNode(func) {
14906
- if (Node58.isFunctionDeclaration(func) || Node58.isMethodDeclaration(func)) {
15043
+ if (Node59.isFunctionDeclaration(func) || Node59.isMethodDeclaration(func)) {
14907
15044
  const name = func.getNameNode();
14908
- if (name !== void 0 && Node58.isIdentifier(name)) {
15045
+ if (name !== void 0 && Node59.isIdentifier(name)) {
14909
15046
  return name;
14910
15047
  }
14911
15048
  }
14912
15049
  const parent = func.getParent();
14913
- if (parent !== void 0 && Node58.isVariableDeclaration(parent)) {
15050
+ if (parent !== void 0 && Node59.isVariableDeclaration(parent)) {
14914
15051
  const nameNode = parent.getNameNode();
14915
- if (Node58.isIdentifier(nameNode)) {
15052
+ if (Node59.isIdentifier(nameNode)) {
14916
15053
  return nameNode;
14917
15054
  }
14918
15055
  }
@@ -14921,10 +15058,10 @@ function wrapperNameNode(func) {
14921
15058
  function enclosingCall(node) {
14922
15059
  let current2 = node.getParent();
14923
15060
  while (current2 !== void 0) {
14924
- if (Node58.isCallExpression(current2)) {
15061
+ if (Node59.isCallExpression(current2)) {
14925
15062
  return current2;
14926
15063
  }
14927
- if (Node58.isPropertyAccessExpression(current2)) {
15064
+ if (Node59.isPropertyAccessExpression(current2)) {
14928
15065
  current2 = current2.getParent();
14929
15066
  continue;
14930
15067
  }
@@ -14935,7 +15072,7 @@ function enclosingCall(node) {
14935
15072
  function enclosingFunction(node) {
14936
15073
  let current2 = node.getParent();
14937
15074
  while (current2 !== void 0) {
14938
- if (Node58.isFunctionDeclaration(current2) || Node58.isFunctionExpression(current2) || Node58.isArrowFunction(current2) || Node58.isMethodDeclaration(current2)) {
15075
+ if (Node59.isFunctionDeclaration(current2) || Node59.isFunctionExpression(current2) || Node59.isArrowFunction(current2) || Node59.isMethodDeclaration(current2)) {
14939
15076
  return current2;
14940
15077
  }
14941
15078
  current2 = current2.getParent();
@@ -14943,13 +15080,13 @@ function enclosingFunction(node) {
14943
15080
  return null;
14944
15081
  }
14945
15082
  function callerName(func) {
14946
- if (Node58.isFunctionDeclaration(func) || Node58.isMethodDeclaration(func)) {
15083
+ if (Node59.isFunctionDeclaration(func) || Node59.isMethodDeclaration(func)) {
14947
15084
  return func.getName() ?? "anonymous";
14948
15085
  }
14949
15086
  const parent = func.getParent();
14950
- if (parent !== void 0 && Node58.isVariableDeclaration(parent)) {
15087
+ if (parent !== void 0 && Node59.isVariableDeclaration(parent)) {
14951
15088
  const nameNode = parent.getNameNode();
14952
- if (Node58.isIdentifier(nameNode)) {
15089
+ if (Node59.isIdentifier(nameNode)) {
14953
15090
  return nameNode.getText();
14954
15091
  }
14955
15092
  }
@@ -15280,6 +15417,7 @@ function createTypeScriptAdapter(suppliedConfig) {
15280
15417
  pipeline,
15281
15418
  project,
15282
15419
  config.frameworks,
15420
+ packsByFile,
15283
15421
  config.extractorOptions,
15284
15422
  tallies,
15285
15423
  (created, parent) => {
@@ -15620,11 +15758,15 @@ function buildCacheAttribution(args) {
15620
15758
  ];
15621
15759
  return { roots, owners };
15622
15760
  }
15623
- function synthesizeSubUnits(summaries, project, frameworks, options, tallies, onCreated) {
15761
+ function synthesizeSubUnits(summaries, project, frameworks, packsByFile, options, tallies, onCreated) {
15624
15762
  const packByRecognition = /* @__PURE__ */ new Map();
15625
15763
  for (const pack of frameworks) {
15626
15764
  packByRecognition.set(pack.name, pack);
15627
15765
  }
15766
+ const packsByPath = /* @__PURE__ */ new Map();
15767
+ for (const [sf, packs] of packsByFile) {
15768
+ packsByPath.set(sf.getFilePath(), packs);
15769
+ }
15628
15770
  const allInvocationRecognizers = collectInvocationRecognizers(
15629
15771
  frameworks,
15630
15772
  tallies
@@ -15638,8 +15780,15 @@ function synthesizeSubUnits(summaries, project, frameworks, options, tallies, on
15638
15780
  if (binding === null) {
15639
15781
  continue;
15640
15782
  }
15641
- const pack = packByRecognition.get(binding.recognition);
15642
- if (pack?.subUnits === void 0) {
15783
+ const discovering = packByRecognition.get(binding.recognition);
15784
+ const applicable = packsByPath.get(parent.location.file) ?? (discovering !== void 0 ? [discovering] : []);
15785
+ const hooked = [
15786
+ ...discovering?.subUnits !== void 0 ? [discovering] : [],
15787
+ ...applicable.filter(
15788
+ (one) => one.subUnits !== void 0 && one !== discovering
15789
+ )
15790
+ ];
15791
+ if (hooked.length === 0) {
15643
15792
  continue;
15644
15793
  }
15645
15794
  lookup ??= createSourceFileLookup(project);
@@ -15652,7 +15801,17 @@ function synthesizeSubUnits(summaries, project, frameworks, options, tallies, on
15652
15801
  name: parent.identity.name,
15653
15802
  kind: parent.kind
15654
15803
  };
15655
- const subUnits = pack.subUnits(parentHandle, subUnitCtx);
15804
+ const claimedFuncs = /* @__PURE__ */ new Set();
15805
+ const subUnits = [];
15806
+ for (const pack of hooked) {
15807
+ for (const subUnit of pack.subUnits?.(parentHandle, subUnitCtx) ?? []) {
15808
+ if (claimedFuncs.has(subUnit.func)) {
15809
+ continue;
15810
+ }
15811
+ claimedFuncs.add(subUnit.func);
15812
+ subUnits.push(subUnit);
15813
+ }
15814
+ }
15656
15815
  for (const subUnit of subUnits) {
15657
15816
  const summary = buildSubUnitSummary(
15658
15817
  subUnit,
@@ -15817,7 +15976,7 @@ function findNearestTsconfig(startDir) {
15817
15976
 
15818
15977
  // src/facts/why.ts
15819
15978
  import path12 from "path";
15820
- import { Node as Node59, Project as Project3, SyntaxKind as SyntaxKind13 } from "ts-morph";
15979
+ import { Node as Node60, Project as Project3, SyntaxKind as SyntaxKind13 } from "ts-morph";
15821
15980
  import { explainResolutionProof, renderExplanation } from "@suss/resolution";
15822
15981
  var JS_PHRASES = {
15823
15982
  bind: ({ tuple, describe }) => ({
@@ -15846,7 +16005,7 @@ var WhySession = class {
15846
16005
  }
15847
16006
  let found = null;
15848
16007
  sourceFile.forEachDescendant((node) => {
15849
- if (Node59.isExpression(node) && node.getStartLineNumber() === line && node.getText() === text && (found === null || node.getWidth() <= found.getWidth())) {
16008
+ if (Node60.isExpression(node) && node.getStartLineNumber() === line && node.getText() === text && (found === null || node.getWidth() <= found.getWidth())) {
15850
16009
  found = node;
15851
16010
  }
15852
16011
  });
@@ -15938,21 +16097,21 @@ var WhySession = class {
15938
16097
  }
15939
16098
  };
15940
16099
  function displayNameOf(node) {
15941
- if (Node59.isIdentifier(node) || Node59.isPropertyAccessExpression(node)) {
16100
+ if (Node60.isIdentifier(node) || Node60.isPropertyAccessExpression(node)) {
15942
16101
  return node.getText();
15943
16102
  }
15944
- if (Node59.isCallExpression(node) || Node59.isNewExpression(node)) {
16103
+ if (Node60.isCallExpression(node) || Node60.isNewExpression(node)) {
15945
16104
  return `${node.getExpression()?.getText() ?? "call"}(...)`;
15946
16105
  }
15947
- if (Node59.isFunctionDeclaration(node) || Node59.isClassDeclaration(node) || Node59.isMethodDeclaration(node) || Node59.isVariableDeclaration(node)) {
16106
+ if (Node60.isFunctionDeclaration(node) || Node60.isClassDeclaration(node) || Node60.isMethodDeclaration(node) || Node60.isVariableDeclaration(node)) {
15948
16107
  const name = node.getName();
15949
16108
  if (name !== void 0) {
15950
16109
  return name;
15951
16110
  }
15952
16111
  }
15953
- if (Node59.isArrowFunction(node) || Node59.isFunctionExpression(node)) {
16112
+ if (Node60.isArrowFunction(node) || Node60.isFunctionExpression(node)) {
15954
16113
  const parent = node.getParent();
15955
- if (parent !== void 0 && Node59.isVariableDeclaration(parent)) {
16114
+ if (parent !== void 0 && Node60.isVariableDeclaration(parent)) {
15956
16115
  return parent.getName();
15957
16116
  }
15958
16117
  }