@suss/adapter-typescript 0.24.3 → 0.24.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +113 -83
- package/dist/index.js +113 -83
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -77,7 +77,7 @@ __export(index_exports, {
|
|
|
77
77
|
module.exports = __toCommonJS(index_exports);
|
|
78
78
|
|
|
79
79
|
// src/adapter.ts
|
|
80
|
-
var
|
|
80
|
+
var import_node_path11 = __toESM(require("path"), 1);
|
|
81
81
|
var import_ts_morph67 = require("ts-morph");
|
|
82
82
|
var import_behavioral_ir8 = require("@suss/behavioral-ir");
|
|
83
83
|
var import_datalog6 = require("@suss/datalog");
|
|
@@ -1913,8 +1913,8 @@ function loadImportGraphsDepthFirstFromPaths(project, rootPaths) {
|
|
|
1913
1913
|
stack.pop();
|
|
1914
1914
|
loadOrder.push(top.path);
|
|
1915
1915
|
let deepest = 0;
|
|
1916
|
-
for (const
|
|
1917
|
-
deepest = Math.max(deepest, chainDepth.get(
|
|
1916
|
+
for (const path15 of top.deps) {
|
|
1917
|
+
deepest = Math.max(deepest, chainDepth.get(path15) ?? 0);
|
|
1918
1918
|
}
|
|
1919
1919
|
chainDepth.set(top.path, deepest + 1);
|
|
1920
1920
|
}
|
|
@@ -2266,11 +2266,11 @@ function walkAndWarm(root, reach) {
|
|
|
2266
2266
|
if (warmedFiles.get(target) !== void 0) {
|
|
2267
2267
|
continue;
|
|
2268
2268
|
}
|
|
2269
|
-
const
|
|
2270
|
-
if (visited.has(
|
|
2269
|
+
const path15 = target.getFilePath();
|
|
2270
|
+
if (visited.has(path15)) {
|
|
2271
2271
|
continue;
|
|
2272
2272
|
}
|
|
2273
|
-
visited.add(
|
|
2273
|
+
visited.add(path15);
|
|
2274
2274
|
stack.push(frameOf(target, reach));
|
|
2275
2275
|
continue;
|
|
2276
2276
|
}
|
|
@@ -2287,7 +2287,7 @@ function sitsOnWarmChains(file) {
|
|
|
2287
2287
|
return false;
|
|
2288
2288
|
}
|
|
2289
2289
|
const imported = importedFilePathsOf(project, file.getFilePath());
|
|
2290
|
-
return imported.length > 0 && imported.every((
|
|
2290
|
+
return imported.length > 0 && imported.every((path15) => warmed.has(path15));
|
|
2291
2291
|
}
|
|
2292
2292
|
function markWarmed(file) {
|
|
2293
2293
|
warmedFiles.set(file, true);
|
|
@@ -5039,7 +5039,7 @@ function isPathStatement(node) {
|
|
|
5039
5039
|
return import_ts_morph18.Node.isStatement(node) && !import_ts_morph18.Node.isFunctionDeclaration(node);
|
|
5040
5040
|
}
|
|
5041
5041
|
function siteOf(node) {
|
|
5042
|
-
const
|
|
5042
|
+
const path15 = [];
|
|
5043
5043
|
let current2 = node;
|
|
5044
5044
|
for (; ; ) {
|
|
5045
5045
|
const parent = current2.getParent();
|
|
@@ -5047,10 +5047,10 @@ function siteOf(node) {
|
|
|
5047
5047
|
return null;
|
|
5048
5048
|
}
|
|
5049
5049
|
if (isPathStatement(current2)) {
|
|
5050
|
-
|
|
5050
|
+
path15.unshift(current2);
|
|
5051
5051
|
}
|
|
5052
5052
|
if (isRoot(parent)) {
|
|
5053
|
-
return { root: parent, path:
|
|
5053
|
+
return { root: parent, path: path15 };
|
|
5054
5054
|
}
|
|
5055
5055
|
current2 = parent;
|
|
5056
5056
|
}
|
|
@@ -7042,14 +7042,14 @@ function unitForJsxRoute(node, match, routeNames, kind, resolution) {
|
|
|
7042
7042
|
}
|
|
7043
7043
|
return routeUnit(node, kind, match.method, resolved.path, target, resolution);
|
|
7044
7044
|
}
|
|
7045
|
-
function routeUnit(at, kind, method,
|
|
7046
|
-
const routeInfo = { method, path:
|
|
7045
|
+
function routeUnit(at, kind, method, path15, target, resolution) {
|
|
7046
|
+
const routeInfo = { method, path: path15 };
|
|
7047
7047
|
if (target.kind === "unreadable") {
|
|
7048
7048
|
return {
|
|
7049
7049
|
func: null,
|
|
7050
7050
|
announcedAt: at,
|
|
7051
7051
|
kind,
|
|
7052
|
-
name:
|
|
7052
|
+
name: path15,
|
|
7053
7053
|
nameKind: "label",
|
|
7054
7054
|
routeInfo
|
|
7055
7055
|
};
|
|
@@ -8313,11 +8313,11 @@ function extractRouteInfoFromBinding(call, methodName, binding, resolution) {
|
|
|
8313
8313
|
return null;
|
|
8314
8314
|
}
|
|
8315
8315
|
const method2 = stringPropertyOf(arg, binding.method.property, resolution);
|
|
8316
|
-
const
|
|
8317
|
-
if (method2 === null ||
|
|
8316
|
+
const path16 = stringPropertyOf(arg, binding.path.property, resolution);
|
|
8317
|
+
if (method2 === null || path16 === null) {
|
|
8318
8318
|
return null;
|
|
8319
8319
|
}
|
|
8320
|
-
return { method: method2.toUpperCase(), path:
|
|
8320
|
+
return { method: method2.toUpperCase(), path: path16 };
|
|
8321
8321
|
}
|
|
8322
8322
|
if (binding.method.type !== "fromRegistration" || binding.path.type !== "fromArgument") {
|
|
8323
8323
|
return null;
|
|
@@ -8334,8 +8334,8 @@ function extractRouteInfoFromBinding(call, methodName, binding, resolution) {
|
|
|
8334
8334
|
method = arg.getLiteralValue().toUpperCase();
|
|
8335
8335
|
}
|
|
8336
8336
|
const pathArg = call.getArguments()[binding.path.position];
|
|
8337
|
-
const
|
|
8338
|
-
return
|
|
8337
|
+
const path15 = pathArg === void 0 ? void 0 : pathFromArgument(pathArg, resolution);
|
|
8338
|
+
return path15 === void 0 ? null : { method, path: path15 };
|
|
8339
8339
|
}
|
|
8340
8340
|
|
|
8341
8341
|
// src/discovery/registrationLoop.ts
|
|
@@ -8467,7 +8467,7 @@ function bodyCallsOnRoutable(loop, guard, resolution) {
|
|
|
8467
8467
|
}
|
|
8468
8468
|
function readRouteSpec(element, shape, resolution) {
|
|
8469
8469
|
let method = null;
|
|
8470
|
-
let
|
|
8470
|
+
let path15 = null;
|
|
8471
8471
|
let handler = null;
|
|
8472
8472
|
for (const prop of element.getProperties()) {
|
|
8473
8473
|
if (import_ts_morph35.Node.isMethodDeclaration(prop) && prop.getName() === shape.handlerKey) {
|
|
@@ -8485,16 +8485,16 @@ function readRouteSpec(element, shape, resolution) {
|
|
|
8485
8485
|
if (name === shape.methodKey) {
|
|
8486
8486
|
method = readStringLiteralValue(init);
|
|
8487
8487
|
} else if (name === shape.pathKey) {
|
|
8488
|
-
|
|
8488
|
+
path15 = readStringLiteralValue(init);
|
|
8489
8489
|
} else if (name === shape.handlerKey) {
|
|
8490
8490
|
const func = functionValueOf(init, resolution);
|
|
8491
8491
|
handler = func === null ? null : { func, name: handlerName(init) };
|
|
8492
8492
|
}
|
|
8493
8493
|
}
|
|
8494
|
-
if (method === null ||
|
|
8494
|
+
if (method === null || path15 === null || handler === null) {
|
|
8495
8495
|
return null;
|
|
8496
8496
|
}
|
|
8497
|
-
return { method, path:
|
|
8497
|
+
return { method, path: path15, handler: handler.func, handlerName: handler.name };
|
|
8498
8498
|
}
|
|
8499
8499
|
function readStringLiteralValue(node) {
|
|
8500
8500
|
if (import_ts_morph35.Node.isStringLiteral(node) || import_ts_morph35.Node.isNoSubstitutionTemplateLiteral(node)) {
|
|
@@ -8609,8 +8609,8 @@ function discoverRegistrationTemplates(sourceFile, match, kind, resolution, moun
|
|
|
8609
8609
|
const subject = subjectOfCall(sourceFile, args, match, resolution);
|
|
8610
8610
|
const prefix = subject === void 0 ? "" : mountPrefixes?.effectivePrefixFor(subject) ?? "";
|
|
8611
8611
|
for (const reg of match.registrations) {
|
|
8612
|
-
const
|
|
8613
|
-
if (
|
|
8612
|
+
const path15 = substitutePath(reg.pathTemplate, args);
|
|
8613
|
+
if (path15 === null) {
|
|
8614
8614
|
continue;
|
|
8615
8615
|
}
|
|
8616
8616
|
const handler = resolveHandler(reg.handlerArg, args, resolution);
|
|
@@ -8624,7 +8624,7 @@ function discoverRegistrationTemplates(sourceFile, match, kind, resolution, moun
|
|
|
8624
8624
|
...subject === void 0 ? {} : { registrationSubjectId: nodeId(subject) },
|
|
8625
8625
|
routeInfo: {
|
|
8626
8626
|
method: reg.method.toUpperCase(),
|
|
8627
|
-
path: prefix === "" ?
|
|
8627
|
+
path: prefix === "" ? path15 : (0, import_resolution4.joinMountedPath)(prefix, path15)
|
|
8628
8628
|
}
|
|
8629
8629
|
});
|
|
8630
8630
|
}
|
|
@@ -9087,24 +9087,24 @@ function declName(decl) {
|
|
|
9087
9087
|
|
|
9088
9088
|
// src/parameterReads.ts
|
|
9089
9089
|
function pathAbove(reference) {
|
|
9090
|
-
const
|
|
9090
|
+
const path15 = [];
|
|
9091
9091
|
let current2 = reference;
|
|
9092
9092
|
for (; ; ) {
|
|
9093
9093
|
const parent = current2.getParent();
|
|
9094
9094
|
if (parent !== void 0 && import_ts_morph40.Node.isPropertyAccessExpression(parent) && parent.getExpression() === current2) {
|
|
9095
|
-
|
|
9095
|
+
path15.push(parent.getName());
|
|
9096
9096
|
current2 = parent;
|
|
9097
9097
|
continue;
|
|
9098
9098
|
}
|
|
9099
9099
|
if (parent !== void 0 && import_ts_morph40.Node.isElementAccessExpression(parent) && parent.getExpression() === current2) {
|
|
9100
9100
|
const argument = parent.getArgumentExpression();
|
|
9101
9101
|
if (argument !== void 0 && import_ts_morph40.Node.isStringLiteral(argument)) {
|
|
9102
|
-
|
|
9102
|
+
path15.push(argument.getLiteralValue());
|
|
9103
9103
|
current2 = parent;
|
|
9104
9104
|
continue;
|
|
9105
9105
|
}
|
|
9106
9106
|
}
|
|
9107
|
-
return
|
|
9107
|
+
return path15;
|
|
9108
9108
|
}
|
|
9109
9109
|
}
|
|
9110
9110
|
function declaresParameterOf(node, func) {
|
|
@@ -12450,9 +12450,9 @@ function createSourceFileLookup(project) {
|
|
|
12450
12450
|
if (sf === null) {
|
|
12451
12451
|
return null;
|
|
12452
12452
|
}
|
|
12453
|
-
const
|
|
12454
|
-
const index = functionsByFile.get(
|
|
12455
|
-
functionsByFile.set(
|
|
12453
|
+
const path15 = sf.getFilePath();
|
|
12454
|
+
const index = functionsByFile.get(path15) ?? indexFunctions(sf);
|
|
12455
|
+
functionsByFile.set(path15, index);
|
|
12456
12456
|
if (location.span !== void 0) {
|
|
12457
12457
|
const bySpan = index.get(spanKey(location.span));
|
|
12458
12458
|
if (bySpan !== void 0) {
|
|
@@ -12639,7 +12639,7 @@ function extractEndpointContract(endpointNode, pattern, framework, resolution) {
|
|
|
12639
12639
|
}
|
|
12640
12640
|
const responses = [];
|
|
12641
12641
|
let method;
|
|
12642
|
-
let
|
|
12642
|
+
let path15;
|
|
12643
12643
|
for (const prop of endpointNode.getProperties()) {
|
|
12644
12644
|
if (!import_ts_morph57.Node.isPropertyAssignment(prop)) {
|
|
12645
12645
|
continue;
|
|
@@ -12654,7 +12654,7 @@ function extractEndpointContract(endpointNode, pattern, framework, resolution) {
|
|
|
12654
12654
|
if (propName === pattern.pathProperty) {
|
|
12655
12655
|
const val = prop.getInitializer();
|
|
12656
12656
|
if (val !== void 0 && import_ts_morph57.Node.isStringLiteral(val)) {
|
|
12657
|
-
|
|
12657
|
+
path15 = val.getLiteralValue();
|
|
12658
12658
|
}
|
|
12659
12659
|
}
|
|
12660
12660
|
if (propName === pattern.responseExtraction.property) {
|
|
@@ -12679,10 +12679,10 @@ function extractEndpointContract(endpointNode, pattern, framework, resolution) {
|
|
|
12679
12679
|
if (responses.length === 0) {
|
|
12680
12680
|
return null;
|
|
12681
12681
|
}
|
|
12682
|
-
const boundaryBinding = method !== void 0 ||
|
|
12682
|
+
const boundaryBinding = method !== void 0 || path15 !== void 0 ? (0, import_behavioral_ir4.restBinding)({
|
|
12683
12683
|
transport: "http",
|
|
12684
12684
|
method: method ?? null,
|
|
12685
|
-
path:
|
|
12685
|
+
path: path15 ?? null,
|
|
12686
12686
|
recognition: framework
|
|
12687
12687
|
}) : null;
|
|
12688
12688
|
return {
|
|
@@ -12893,6 +12893,8 @@ function parameterName(segment, convention) {
|
|
|
12893
12893
|
}
|
|
12894
12894
|
|
|
12895
12895
|
// src/discovery/graphqlClientConstruction.ts
|
|
12896
|
+
var import_node_fs3 = __toESM(require("fs"), 1);
|
|
12897
|
+
var import_node_path8 = __toESM(require("path"), 1);
|
|
12896
12898
|
var import_graphql2 = require("graphql");
|
|
12897
12899
|
var import_picomatch2 = __toESM(require("picomatch"), 1);
|
|
12898
12900
|
var import_ts_morph58 = require("ts-morph");
|
|
@@ -12947,8 +12949,36 @@ function fragmentsRegisteredIn(sourceFiles) {
|
|
|
12947
12949
|
}
|
|
12948
12950
|
});
|
|
12949
12951
|
}
|
|
12952
|
+
for (const text of graphqlFileTextsNear(sourceFiles)) {
|
|
12953
|
+
for (const name of fragmentOnlyDocumentNames(text)) {
|
|
12954
|
+
registered.add(name);
|
|
12955
|
+
}
|
|
12956
|
+
}
|
|
12950
12957
|
return registered;
|
|
12951
12958
|
}
|
|
12959
|
+
function graphqlFileTextsNear(sourceFiles) {
|
|
12960
|
+
const roots = new Set(
|
|
12961
|
+
sourceFiles.map((sourceFile) => import_node_path8.default.dirname(sourceFile.getFilePath()))
|
|
12962
|
+
);
|
|
12963
|
+
const texts = [];
|
|
12964
|
+
for (const root of roots) {
|
|
12965
|
+
let entries;
|
|
12966
|
+
try {
|
|
12967
|
+
entries = import_node_fs3.default.readdirSync(root, { withFileTypes: true });
|
|
12968
|
+
} catch {
|
|
12969
|
+
continue;
|
|
12970
|
+
}
|
|
12971
|
+
for (const entry of entries) {
|
|
12972
|
+
if (entry.isFile() && /\.(graphql|gql)$/.test(entry.name)) {
|
|
12973
|
+
try {
|
|
12974
|
+
texts.push(import_node_fs3.default.readFileSync(import_node_path8.default.join(root, entry.name), "utf8"));
|
|
12975
|
+
} catch {
|
|
12976
|
+
}
|
|
12977
|
+
}
|
|
12978
|
+
}
|
|
12979
|
+
}
|
|
12980
|
+
return texts;
|
|
12981
|
+
}
|
|
12952
12982
|
function fragmentOnlyDocumentNames(text) {
|
|
12953
12983
|
if (!text.includes("fragment")) {
|
|
12954
12984
|
return [];
|
|
@@ -13386,8 +13416,8 @@ function noteExpanded(expanded, readings, discovery) {
|
|
|
13386
13416
|
const paths = new Set(match.registrations.map((one) => one.pathTemplate));
|
|
13387
13417
|
const methods = expanded.get(reading.declarationId) ?? /* @__PURE__ */ new Set();
|
|
13388
13418
|
for (const sink of reading.helper.sinks) {
|
|
13389
|
-
const
|
|
13390
|
-
if (sink.method !== null &&
|
|
13419
|
+
const path15 = sink.arguments[0];
|
|
13420
|
+
if (sink.method !== null && path15?.as === "text" && paths.has(path15.text)) {
|
|
13391
13421
|
methods.add(sink.method);
|
|
13392
13422
|
}
|
|
13393
13423
|
}
|
|
@@ -15513,10 +15543,10 @@ function readArrayLiteralText(node) {
|
|
|
15513
15543
|
}
|
|
15514
15544
|
|
|
15515
15545
|
// src/summaryIdentity.ts
|
|
15516
|
-
var
|
|
15546
|
+
var import_node_path9 = __toESM(require("path"), 1);
|
|
15517
15547
|
var import_behavioral_ir7 = require("@suss/behavioral-ir");
|
|
15518
15548
|
function workspaceRootFor(anchor) {
|
|
15519
|
-
return namedPackageDirAbove(anchor) ??
|
|
15549
|
+
return namedPackageDirAbove(anchor) ?? import_node_path9.default.resolve(anchor);
|
|
15520
15550
|
}
|
|
15521
15551
|
function workspaceNameFor(root) {
|
|
15522
15552
|
if (root === void 0) {
|
|
@@ -15526,7 +15556,7 @@ function workspaceNameFor(root) {
|
|
|
15526
15556
|
if (dir !== null) {
|
|
15527
15557
|
return packageNameAt(dir);
|
|
15528
15558
|
}
|
|
15529
|
-
const folder =
|
|
15559
|
+
const folder = import_node_path9.default.basename(import_node_path9.default.resolve(root));
|
|
15530
15560
|
return folder.length > 0 ? folder : null;
|
|
15531
15561
|
}
|
|
15532
15562
|
function nameSummaries(summaries, args) {
|
|
@@ -15541,10 +15571,10 @@ function nameSummaries(summaries, args) {
|
|
|
15541
15571
|
(0, import_behavioral_ir7.linkCallsToSummaries)(summaries);
|
|
15542
15572
|
}
|
|
15543
15573
|
function relativeFile(file, projectRoot) {
|
|
15544
|
-
if (projectRoot === void 0 || !
|
|
15574
|
+
if (projectRoot === void 0 || !import_node_path9.default.isAbsolute(file)) {
|
|
15545
15575
|
return file;
|
|
15546
15576
|
}
|
|
15547
|
-
const relative =
|
|
15577
|
+
const relative = import_node_path9.default.relative(projectRoot, file);
|
|
15548
15578
|
return relative.startsWith("..") ? file : relative;
|
|
15549
15579
|
}
|
|
15550
15580
|
function idFor(workspace, file, summary) {
|
|
@@ -15576,11 +15606,11 @@ function declineWhenRunFromSource(cacheDir) {
|
|
|
15576
15606
|
}
|
|
15577
15607
|
|
|
15578
15608
|
// src/workspacePatterns.ts
|
|
15579
|
-
var
|
|
15580
|
-
var
|
|
15609
|
+
var import_node_fs4 = __toESM(require("fs"), 1);
|
|
15610
|
+
var import_node_path10 = __toESM(require("path"), 1);
|
|
15581
15611
|
function readJson(filePath) {
|
|
15582
15612
|
try {
|
|
15583
|
-
return JSON.parse(
|
|
15613
|
+
return JSON.parse(import_node_fs4.default.readFileSync(filePath, "utf8"));
|
|
15584
15614
|
} catch {
|
|
15585
15615
|
return void 0;
|
|
15586
15616
|
}
|
|
@@ -15607,7 +15637,7 @@ function pnpmWorkspaceGlobs(yamlText) {
|
|
|
15607
15637
|
return globs;
|
|
15608
15638
|
}
|
|
15609
15639
|
function workspaceGlobsAt(dir) {
|
|
15610
|
-
const pkg = readJson(
|
|
15640
|
+
const pkg = readJson(import_node_path10.default.join(dir, "package.json"));
|
|
15611
15641
|
if (typeof pkg === "object" && pkg !== null && "workspaces" in pkg) {
|
|
15612
15642
|
const ws = pkg.workspaces;
|
|
15613
15643
|
if (Array.isArray(ws)) {
|
|
@@ -15619,10 +15649,10 @@ function workspaceGlobsAt(dir) {
|
|
|
15619
15649
|
);
|
|
15620
15650
|
}
|
|
15621
15651
|
}
|
|
15622
|
-
const pnpmPath =
|
|
15623
|
-
if (
|
|
15652
|
+
const pnpmPath = import_node_path10.default.join(dir, "pnpm-workspace.yaml");
|
|
15653
|
+
if (import_node_fs4.default.existsSync(pnpmPath)) {
|
|
15624
15654
|
try {
|
|
15625
|
-
return pnpmWorkspaceGlobs(
|
|
15655
|
+
return pnpmWorkspaceGlobs(import_node_fs4.default.readFileSync(pnpmPath, "utf8"));
|
|
15626
15656
|
} catch {
|
|
15627
15657
|
return null;
|
|
15628
15658
|
}
|
|
@@ -15631,14 +15661,14 @@ function workspaceGlobsAt(dir) {
|
|
|
15631
15661
|
}
|
|
15632
15662
|
function isDirectory(candidate) {
|
|
15633
15663
|
try {
|
|
15634
|
-
return
|
|
15664
|
+
return import_node_fs4.default.statSync(candidate).isDirectory();
|
|
15635
15665
|
} catch {
|
|
15636
15666
|
return false;
|
|
15637
15667
|
}
|
|
15638
15668
|
}
|
|
15639
15669
|
function subdirectoriesOf(dir) {
|
|
15640
15670
|
try {
|
|
15641
|
-
return
|
|
15671
|
+
return import_node_fs4.default.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name).filter((name) => !name.startsWith(".") && name !== "node_modules");
|
|
15642
15672
|
} catch {
|
|
15643
15673
|
return [];
|
|
15644
15674
|
}
|
|
@@ -15656,13 +15686,13 @@ function directoriesMatchingGlob(root, glob) {
|
|
|
15656
15686
|
for (const dir of current2) {
|
|
15657
15687
|
for (const entry of subdirectoriesOf(dir)) {
|
|
15658
15688
|
if (pattern.test(entry)) {
|
|
15659
|
-
next.push(
|
|
15689
|
+
next.push(import_node_path10.default.join(dir, entry));
|
|
15660
15690
|
}
|
|
15661
15691
|
}
|
|
15662
15692
|
}
|
|
15663
15693
|
} else {
|
|
15664
15694
|
for (const dir of current2) {
|
|
15665
|
-
next.push(
|
|
15695
|
+
next.push(import_node_path10.default.join(dir, segment));
|
|
15666
15696
|
}
|
|
15667
15697
|
}
|
|
15668
15698
|
current2 = next.filter(isDirectory);
|
|
@@ -15670,7 +15700,7 @@ function directoriesMatchingGlob(root, glob) {
|
|
|
15670
15700
|
return current2;
|
|
15671
15701
|
}
|
|
15672
15702
|
function packageAt(dir) {
|
|
15673
|
-
const packageJsonPath =
|
|
15703
|
+
const packageJsonPath = import_node_path10.default.join(dir, "package.json");
|
|
15674
15704
|
const pkg = readJson(packageJsonPath);
|
|
15675
15705
|
if (typeof pkg === "object" && pkg !== null && typeof pkg.name === "string") {
|
|
15676
15706
|
return { name: pkg.name, packageJsonPath };
|
|
@@ -15678,7 +15708,7 @@ function packageAt(dir) {
|
|
|
15678
15708
|
return null;
|
|
15679
15709
|
}
|
|
15680
15710
|
function workspacePackagesFrom(anchor) {
|
|
15681
|
-
let dir =
|
|
15711
|
+
let dir = import_node_path10.default.resolve(anchor);
|
|
15682
15712
|
for (; ; ) {
|
|
15683
15713
|
const globs = workspaceGlobsAt(dir);
|
|
15684
15714
|
if (globs !== null) {
|
|
@@ -15698,7 +15728,7 @@ function workspacePackagesFrom(anchor) {
|
|
|
15698
15728
|
(a, b) => a.packageJsonPath.localeCompare(b.packageJsonPath)
|
|
15699
15729
|
);
|
|
15700
15730
|
}
|
|
15701
|
-
const parent =
|
|
15731
|
+
const parent = import_node_path10.default.dirname(dir);
|
|
15702
15732
|
if (parent === dir) {
|
|
15703
15733
|
return [];
|
|
15704
15734
|
}
|
|
@@ -16240,11 +16270,11 @@ function extractConsumerBinding(unit, pattern, pack, resolution) {
|
|
|
16240
16270
|
return null;
|
|
16241
16271
|
}
|
|
16242
16272
|
const method = extractBindingMethod(binding, callSite, pack, resolution);
|
|
16243
|
-
const
|
|
16273
|
+
const path15 = extractBindingPath(binding, callSite, pack, resolution);
|
|
16244
16274
|
return (0, import_behavioral_ir8.restBinding)({
|
|
16245
16275
|
transport: pack.protocol,
|
|
16246
16276
|
method: method ?? null,
|
|
16247
|
-
path:
|
|
16277
|
+
path: path15 ?? null,
|
|
16248
16278
|
recognition: pack.name
|
|
16249
16279
|
});
|
|
16250
16280
|
}
|
|
@@ -16891,8 +16921,8 @@ function synthesizeCallerSummaries(wrapper, _project, options, resolution) {
|
|
|
16891
16921
|
if (pathArg === void 0) {
|
|
16892
16922
|
continue;
|
|
16893
16923
|
}
|
|
16894
|
-
const
|
|
16895
|
-
if (
|
|
16924
|
+
const path15 = pathFromArgument(pathArg, resolution);
|
|
16925
|
+
if (path15 === void 0) {
|
|
16896
16926
|
continue;
|
|
16897
16927
|
}
|
|
16898
16928
|
const callerFunc = enclosingFunction(callExpr);
|
|
@@ -16904,7 +16934,7 @@ function synthesizeCallerSummaries(wrapper, _project, options, resolution) {
|
|
|
16904
16934
|
continue;
|
|
16905
16935
|
}
|
|
16906
16936
|
seen.add(dedupKey);
|
|
16907
|
-
out.push(buildCallerSummary(wrapper, callerFunc, callExpr,
|
|
16937
|
+
out.push(buildCallerSummary(wrapper, callerFunc, callExpr, path15, options));
|
|
16908
16938
|
}
|
|
16909
16939
|
return out;
|
|
16910
16940
|
}
|
|
@@ -16961,7 +16991,7 @@ function callerName(func) {
|
|
|
16961
16991
|
}
|
|
16962
16992
|
return "anonymous";
|
|
16963
16993
|
}
|
|
16964
|
-
function buildCallerSummary(wrapper, callerFunc, callExpr,
|
|
16994
|
+
function buildCallerSummary(wrapper, callerFunc, callExpr, path15, options) {
|
|
16965
16995
|
const wrapperBinding = wrapper.summary.identity.boundaryBinding;
|
|
16966
16996
|
const wrapperRest = wrapperBinding?.semantics.name === "rest" ? wrapperBinding.semantics : null;
|
|
16967
16997
|
const syntheticPack = {
|
|
@@ -16993,7 +17023,7 @@ function buildCallerSummary(wrapper, callerFunc, callExpr, path14, options) {
|
|
|
16993
17023
|
raw.boundaryBinding = (0, import_behavioral_ir8.restBinding)({
|
|
16994
17024
|
transport: wrapperBinding?.transport ?? "http",
|
|
16995
17025
|
method: wrapperRest?.method ?? null,
|
|
16996
|
-
path:
|
|
17026
|
+
path: path15,
|
|
16997
17027
|
recognition: wrapperBinding?.recognition ?? "unknown"
|
|
16998
17028
|
});
|
|
16999
17029
|
const summary = (0, import_extractor11.assembleSummary)(raw, options);
|
|
@@ -17051,7 +17081,7 @@ function createTypeScriptAdapter(suppliedConfig) {
|
|
|
17051
17081
|
...suppliedConfig,
|
|
17052
17082
|
frameworks: expandWorkspacePatterns(
|
|
17053
17083
|
suppliedConfig.frameworks,
|
|
17054
|
-
suppliedConfig.projectRoot ?? (suppliedConfig.tsConfigFilePath !== void 0 ?
|
|
17084
|
+
suppliedConfig.projectRoot ?? (suppliedConfig.tsConfigFilePath !== void 0 ? import_node_path11.default.dirname(suppliedConfig.tsConfigFilePath) : void 0)
|
|
17055
17085
|
)
|
|
17056
17086
|
};
|
|
17057
17087
|
const project = config.project ?? new import_ts_morph67.Project(
|
|
@@ -17060,11 +17090,11 @@ function createTypeScriptAdapter(suppliedConfig) {
|
|
|
17060
17090
|
skipAddingFilesFromTsConfig: true
|
|
17061
17091
|
} : { skipAddingFilesFromTsConfig: true }
|
|
17062
17092
|
);
|
|
17063
|
-
const runRoot = config.projectRoot ?? (config.tsConfigFilePath !== void 0 ? workspaceRootFor(
|
|
17093
|
+
const runRoot = config.projectRoot ?? (config.tsConfigFilePath !== void 0 ? workspaceRootFor(import_node_path11.default.dirname(config.tsConfigFilePath)) : void 0);
|
|
17064
17094
|
let lazyBootstrapped = false;
|
|
17065
17095
|
let projectFileSet;
|
|
17066
17096
|
const cacheDir = declineWhenRunFromSource(
|
|
17067
|
-
config.cacheDir === null ? null : config.cacheDir ?? (config.tsConfigFilePath !== void 0 ?
|
|
17097
|
+
config.cacheDir === null ? null : config.cacheDir ?? (config.tsConfigFilePath !== void 0 ? import_node_path11.default.join(import_node_path11.default.dirname(config.tsConfigFilePath), ".suss", "cache") : null)
|
|
17068
17098
|
);
|
|
17069
17099
|
const cache = (0, import_extractor11.createCacheLayer)(cacheDir);
|
|
17070
17100
|
const packsDigest = `${computeAdapterPacksDigest(
|
|
@@ -17768,8 +17798,8 @@ function buildSubUnitSummary(subUnit, parent, invocationRecognizers, accessRecog
|
|
|
17768
17798
|
}
|
|
17769
17799
|
|
|
17770
17800
|
// src/bootstrap/noTsconfigProject.ts
|
|
17771
|
-
var
|
|
17772
|
-
var
|
|
17801
|
+
var import_node_fs5 = __toESM(require("fs"), 1);
|
|
17802
|
+
var import_node_path12 = __toESM(require("path"), 1);
|
|
17773
17803
|
var import_ts_morph68 = require("ts-morph");
|
|
17774
17804
|
var SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
17775
17805
|
".ts",
|
|
@@ -17800,7 +17830,7 @@ function findSourceFiles(rootDir, depth = 0) {
|
|
|
17800
17830
|
const found = [];
|
|
17801
17831
|
let entries;
|
|
17802
17832
|
try {
|
|
17803
|
-
entries =
|
|
17833
|
+
entries = import_node_fs5.default.readdirSync(rootDir, { withFileTypes: true });
|
|
17804
17834
|
} catch {
|
|
17805
17835
|
return [];
|
|
17806
17836
|
}
|
|
@@ -17808,10 +17838,10 @@ function findSourceFiles(rootDir, depth = 0) {
|
|
|
17808
17838
|
if (entry.name.startsWith(".") || SKIP_DIRECTORIES.has(entry.name)) {
|
|
17809
17839
|
continue;
|
|
17810
17840
|
}
|
|
17811
|
-
const full =
|
|
17841
|
+
const full = import_node_path12.default.join(rootDir, entry.name);
|
|
17812
17842
|
if (entry.isDirectory()) {
|
|
17813
17843
|
found.push(...findSourceFiles(full, depth + 1));
|
|
17814
|
-
} else if (SOURCE_EXTENSIONS.has(
|
|
17844
|
+
} else if (SOURCE_EXTENSIONS.has(import_node_path12.default.extname(entry.name)) && !entry.name.endsWith(".d.ts")) {
|
|
17815
17845
|
found.push(full);
|
|
17816
17846
|
}
|
|
17817
17847
|
}
|
|
@@ -17846,15 +17876,15 @@ function createProjectWithoutTsconfig(rootDir) {
|
|
|
17846
17876
|
return { project, files };
|
|
17847
17877
|
}
|
|
17848
17878
|
function findNearestTsconfig(startDir) {
|
|
17849
|
-
let dir =
|
|
17879
|
+
let dir = import_node_path12.default.resolve(startDir);
|
|
17850
17880
|
while (true) {
|
|
17851
17881
|
for (const name of ["tsconfig.json", "jsconfig.json"]) {
|
|
17852
|
-
const candidate =
|
|
17853
|
-
if (
|
|
17882
|
+
const candidate = import_node_path12.default.join(dir, name);
|
|
17883
|
+
if (import_node_fs5.default.existsSync(candidate)) {
|
|
17854
17884
|
return candidate;
|
|
17855
17885
|
}
|
|
17856
17886
|
}
|
|
17857
|
-
const parent =
|
|
17887
|
+
const parent = import_node_path12.default.dirname(dir);
|
|
17858
17888
|
if (parent === dir) {
|
|
17859
17889
|
return null;
|
|
17860
17890
|
}
|
|
@@ -17863,7 +17893,7 @@ function findNearestTsconfig(startDir) {
|
|
|
17863
17893
|
}
|
|
17864
17894
|
|
|
17865
17895
|
// src/facts/why.ts
|
|
17866
|
-
var
|
|
17896
|
+
var import_node_path13 = __toESM(require("path"), 1);
|
|
17867
17897
|
var import_ts_morph69 = require("ts-morph");
|
|
17868
17898
|
var import_resolution7 = require("@suss/resolution");
|
|
17869
17899
|
var JS_PHRASES = {
|
|
@@ -17876,7 +17906,7 @@ var TypeScriptWhySession = class {
|
|
|
17876
17906
|
store;
|
|
17877
17907
|
root;
|
|
17878
17908
|
constructor(options) {
|
|
17879
|
-
this.root =
|
|
17909
|
+
this.root = import_node_path13.default.resolve(options.dir);
|
|
17880
17910
|
const tsconfig = findNearestTsconfig(this.root);
|
|
17881
17911
|
this.project = tsconfig === null ? createProjectWithoutTsconfig(this.root).project : new import_ts_morph69.Project({ tsConfigFilePath: tsconfig });
|
|
17882
17912
|
this.store = new ResolutionStore();
|
|
@@ -17965,7 +17995,7 @@ var TypeScriptWhySession = class {
|
|
|
17965
17995
|
};
|
|
17966
17996
|
}
|
|
17967
17997
|
sourceFileAt(file) {
|
|
17968
|
-
const absolute =
|
|
17998
|
+
const absolute = import_node_path13.default.resolve(this.root, file);
|
|
17969
17999
|
const loaded = this.project.getSourceFile(absolute);
|
|
17970
18000
|
if (loaded !== void 0) {
|
|
17971
18001
|
return loaded;
|
|
@@ -17979,7 +18009,7 @@ var TypeScriptWhySession = class {
|
|
|
17979
18009
|
/** A module key: a file path said relative to the root, or a package name. */
|
|
17980
18010
|
displayPath(key) {
|
|
17981
18011
|
if (key.startsWith(this.root)) {
|
|
17982
|
-
return
|
|
18012
|
+
return import_node_path13.default.relative(this.root, key);
|
|
17983
18013
|
}
|
|
17984
18014
|
return key;
|
|
17985
18015
|
}
|
|
@@ -18008,7 +18038,7 @@ function displayNameOf(node) {
|
|
|
18008
18038
|
}
|
|
18009
18039
|
|
|
18010
18040
|
// src/stubEvidence.ts
|
|
18011
|
-
var
|
|
18041
|
+
var import_node_path14 = __toESM(require("path"), 1);
|
|
18012
18042
|
var import_ts_morph70 = require("ts-morph");
|
|
18013
18043
|
function stubEvidenceIn(project, packageName, root) {
|
|
18014
18044
|
const resolution = new ResolutionStore();
|
|
@@ -18024,7 +18054,7 @@ function stubEvidenceIn(project, packageName, root) {
|
|
|
18024
18054
|
calls: []
|
|
18025
18055
|
};
|
|
18026
18056
|
entry.calls.push({
|
|
18027
|
-
file:
|
|
18057
|
+
file: import_node_path14.default.relative(root, sourceFile.getFilePath()).split(import_node_path14.default.sep).join("/"),
|
|
18028
18058
|
line: one.call.getStartLineNumber(),
|
|
18029
18059
|
args: one.call.getArguments().map((arg) => effectArgOf(arg))
|
|
18030
18060
|
});
|
|
@@ -18039,7 +18069,7 @@ function stubEvidence(options) {
|
|
|
18039
18069
|
const project = new import_ts_morph70.Project(
|
|
18040
18070
|
options.tsConfigFilePath !== void 0 ? { tsConfigFilePath: options.tsConfigFilePath } : { compilerOptions: { allowJs: true } }
|
|
18041
18071
|
);
|
|
18042
|
-
const root = options.tsConfigFilePath !== void 0 ?
|
|
18072
|
+
const root = options.tsConfigFilePath !== void 0 ? import_node_path14.default.dirname(options.tsConfigFilePath) : import_node_path14.default.resolve(options.directory ?? process.cwd());
|
|
18043
18073
|
if (options.tsConfigFilePath === void 0) {
|
|
18044
18074
|
project.addSourceFilesAtPaths([
|
|
18045
18075
|
`${root}/**/*.{ts,tsx,js,jsx}`,
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/adapter.ts
|
|
2
|
-
import
|
|
2
|
+
import path11 from "path";
|
|
3
3
|
import {
|
|
4
4
|
Node as Node64,
|
|
5
5
|
Project,
|
|
@@ -1871,8 +1871,8 @@ function loadImportGraphsDepthFirstFromPaths(project, rootPaths) {
|
|
|
1871
1871
|
stack.pop();
|
|
1872
1872
|
loadOrder.push(top.path);
|
|
1873
1873
|
let deepest = 0;
|
|
1874
|
-
for (const
|
|
1875
|
-
deepest = Math.max(deepest, chainDepth.get(
|
|
1874
|
+
for (const path15 of top.deps) {
|
|
1875
|
+
deepest = Math.max(deepest, chainDepth.get(path15) ?? 0);
|
|
1876
1876
|
}
|
|
1877
1877
|
chainDepth.set(top.path, deepest + 1);
|
|
1878
1878
|
}
|
|
@@ -2224,11 +2224,11 @@ function walkAndWarm(root, reach) {
|
|
|
2224
2224
|
if (warmedFiles.get(target) !== void 0) {
|
|
2225
2225
|
continue;
|
|
2226
2226
|
}
|
|
2227
|
-
const
|
|
2228
|
-
if (visited.has(
|
|
2227
|
+
const path15 = target.getFilePath();
|
|
2228
|
+
if (visited.has(path15)) {
|
|
2229
2229
|
continue;
|
|
2230
2230
|
}
|
|
2231
|
-
visited.add(
|
|
2231
|
+
visited.add(path15);
|
|
2232
2232
|
stack.push(frameOf(target, reach));
|
|
2233
2233
|
continue;
|
|
2234
2234
|
}
|
|
@@ -2245,7 +2245,7 @@ function sitsOnWarmChains(file) {
|
|
|
2245
2245
|
return false;
|
|
2246
2246
|
}
|
|
2247
2247
|
const imported = importedFilePathsOf(project, file.getFilePath());
|
|
2248
|
-
return imported.length > 0 && imported.every((
|
|
2248
|
+
return imported.length > 0 && imported.every((path15) => warmed.has(path15));
|
|
2249
2249
|
}
|
|
2250
2250
|
function markWarmed(file) {
|
|
2251
2251
|
warmedFiles.set(file, true);
|
|
@@ -5024,7 +5024,7 @@ function isPathStatement(node) {
|
|
|
5024
5024
|
return Node16.isStatement(node) && !Node16.isFunctionDeclaration(node);
|
|
5025
5025
|
}
|
|
5026
5026
|
function siteOf(node) {
|
|
5027
|
-
const
|
|
5027
|
+
const path15 = [];
|
|
5028
5028
|
let current2 = node;
|
|
5029
5029
|
for (; ; ) {
|
|
5030
5030
|
const parent = current2.getParent();
|
|
@@ -5032,10 +5032,10 @@ function siteOf(node) {
|
|
|
5032
5032
|
return null;
|
|
5033
5033
|
}
|
|
5034
5034
|
if (isPathStatement(current2)) {
|
|
5035
|
-
|
|
5035
|
+
path15.unshift(current2);
|
|
5036
5036
|
}
|
|
5037
5037
|
if (isRoot(parent)) {
|
|
5038
|
-
return { root: parent, path:
|
|
5038
|
+
return { root: parent, path: path15 };
|
|
5039
5039
|
}
|
|
5040
5040
|
current2 = parent;
|
|
5041
5041
|
}
|
|
@@ -7048,14 +7048,14 @@ function unitForJsxRoute(node, match, routeNames, kind, resolution) {
|
|
|
7048
7048
|
}
|
|
7049
7049
|
return routeUnit(node, kind, match.method, resolved.path, target, resolution);
|
|
7050
7050
|
}
|
|
7051
|
-
function routeUnit(at, kind, method,
|
|
7052
|
-
const routeInfo = { method, path:
|
|
7051
|
+
function routeUnit(at, kind, method, path15, target, resolution) {
|
|
7052
|
+
const routeInfo = { method, path: path15 };
|
|
7053
7053
|
if (target.kind === "unreadable") {
|
|
7054
7054
|
return {
|
|
7055
7055
|
func: null,
|
|
7056
7056
|
announcedAt: at,
|
|
7057
7057
|
kind,
|
|
7058
|
-
name:
|
|
7058
|
+
name: path15,
|
|
7059
7059
|
nameKind: "label",
|
|
7060
7060
|
routeInfo
|
|
7061
7061
|
};
|
|
@@ -8321,11 +8321,11 @@ function extractRouteInfoFromBinding(call, methodName, binding, resolution) {
|
|
|
8321
8321
|
return null;
|
|
8322
8322
|
}
|
|
8323
8323
|
const method2 = stringPropertyOf(arg, binding.method.property, resolution);
|
|
8324
|
-
const
|
|
8325
|
-
if (method2 === null ||
|
|
8324
|
+
const path16 = stringPropertyOf(arg, binding.path.property, resolution);
|
|
8325
|
+
if (method2 === null || path16 === null) {
|
|
8326
8326
|
return null;
|
|
8327
8327
|
}
|
|
8328
|
-
return { method: method2.toUpperCase(), path:
|
|
8328
|
+
return { method: method2.toUpperCase(), path: path16 };
|
|
8329
8329
|
}
|
|
8330
8330
|
if (binding.method.type !== "fromRegistration" || binding.path.type !== "fromArgument") {
|
|
8331
8331
|
return null;
|
|
@@ -8342,8 +8342,8 @@ function extractRouteInfoFromBinding(call, methodName, binding, resolution) {
|
|
|
8342
8342
|
method = arg.getLiteralValue().toUpperCase();
|
|
8343
8343
|
}
|
|
8344
8344
|
const pathArg = call.getArguments()[binding.path.position];
|
|
8345
|
-
const
|
|
8346
|
-
return
|
|
8345
|
+
const path15 = pathArg === void 0 ? void 0 : pathFromArgument(pathArg, resolution);
|
|
8346
|
+
return path15 === void 0 ? null : { method, path: path15 };
|
|
8347
8347
|
}
|
|
8348
8348
|
|
|
8349
8349
|
// src/discovery/registrationLoop.ts
|
|
@@ -8475,7 +8475,7 @@ function bodyCallsOnRoutable(loop, guard, resolution) {
|
|
|
8475
8475
|
}
|
|
8476
8476
|
function readRouteSpec(element, shape, resolution) {
|
|
8477
8477
|
let method = null;
|
|
8478
|
-
let
|
|
8478
|
+
let path15 = null;
|
|
8479
8479
|
let handler = null;
|
|
8480
8480
|
for (const prop of element.getProperties()) {
|
|
8481
8481
|
if (Node33.isMethodDeclaration(prop) && prop.getName() === shape.handlerKey) {
|
|
@@ -8493,16 +8493,16 @@ function readRouteSpec(element, shape, resolution) {
|
|
|
8493
8493
|
if (name === shape.methodKey) {
|
|
8494
8494
|
method = readStringLiteralValue(init);
|
|
8495
8495
|
} else if (name === shape.pathKey) {
|
|
8496
|
-
|
|
8496
|
+
path15 = readStringLiteralValue(init);
|
|
8497
8497
|
} else if (name === shape.handlerKey) {
|
|
8498
8498
|
const func = functionValueOf(init, resolution);
|
|
8499
8499
|
handler = func === null ? null : { func, name: handlerName(init) };
|
|
8500
8500
|
}
|
|
8501
8501
|
}
|
|
8502
|
-
if (method === null ||
|
|
8502
|
+
if (method === null || path15 === null || handler === null) {
|
|
8503
8503
|
return null;
|
|
8504
8504
|
}
|
|
8505
|
-
return { method, path:
|
|
8505
|
+
return { method, path: path15, handler: handler.func, handlerName: handler.name };
|
|
8506
8506
|
}
|
|
8507
8507
|
function readStringLiteralValue(node) {
|
|
8508
8508
|
if (Node33.isStringLiteral(node) || Node33.isNoSubstitutionTemplateLiteral(node)) {
|
|
@@ -8623,8 +8623,8 @@ function discoverRegistrationTemplates(sourceFile, match, kind, resolution, moun
|
|
|
8623
8623
|
const subject = subjectOfCall(sourceFile, args, match, resolution);
|
|
8624
8624
|
const prefix = subject === void 0 ? "" : mountPrefixes?.effectivePrefixFor(subject) ?? "";
|
|
8625
8625
|
for (const reg of match.registrations) {
|
|
8626
|
-
const
|
|
8627
|
-
if (
|
|
8626
|
+
const path15 = substitutePath(reg.pathTemplate, args);
|
|
8627
|
+
if (path15 === null) {
|
|
8628
8628
|
continue;
|
|
8629
8629
|
}
|
|
8630
8630
|
const handler = resolveHandler(reg.handlerArg, args, resolution);
|
|
@@ -8638,7 +8638,7 @@ function discoverRegistrationTemplates(sourceFile, match, kind, resolution, moun
|
|
|
8638
8638
|
...subject === void 0 ? {} : { registrationSubjectId: nodeId(subject) },
|
|
8639
8639
|
routeInfo: {
|
|
8640
8640
|
method: reg.method.toUpperCase(),
|
|
8641
|
-
path: prefix === "" ?
|
|
8641
|
+
path: prefix === "" ? path15 : joinMountedPath2(prefix, path15)
|
|
8642
8642
|
}
|
|
8643
8643
|
});
|
|
8644
8644
|
}
|
|
@@ -9101,24 +9101,24 @@ function declName(decl) {
|
|
|
9101
9101
|
|
|
9102
9102
|
// src/parameterReads.ts
|
|
9103
9103
|
function pathAbove(reference) {
|
|
9104
|
-
const
|
|
9104
|
+
const path15 = [];
|
|
9105
9105
|
let current2 = reference;
|
|
9106
9106
|
for (; ; ) {
|
|
9107
9107
|
const parent = current2.getParent();
|
|
9108
9108
|
if (parent !== void 0 && Node38.isPropertyAccessExpression(parent) && parent.getExpression() === current2) {
|
|
9109
|
-
|
|
9109
|
+
path15.push(parent.getName());
|
|
9110
9110
|
current2 = parent;
|
|
9111
9111
|
continue;
|
|
9112
9112
|
}
|
|
9113
9113
|
if (parent !== void 0 && Node38.isElementAccessExpression(parent) && parent.getExpression() === current2) {
|
|
9114
9114
|
const argument = parent.getArgumentExpression();
|
|
9115
9115
|
if (argument !== void 0 && Node38.isStringLiteral(argument)) {
|
|
9116
|
-
|
|
9116
|
+
path15.push(argument.getLiteralValue());
|
|
9117
9117
|
current2 = parent;
|
|
9118
9118
|
continue;
|
|
9119
9119
|
}
|
|
9120
9120
|
}
|
|
9121
|
-
return
|
|
9121
|
+
return path15;
|
|
9122
9122
|
}
|
|
9123
9123
|
}
|
|
9124
9124
|
function declaresParameterOf(node, func) {
|
|
@@ -12471,9 +12471,9 @@ function createSourceFileLookup(project) {
|
|
|
12471
12471
|
if (sf === null) {
|
|
12472
12472
|
return null;
|
|
12473
12473
|
}
|
|
12474
|
-
const
|
|
12475
|
-
const index = functionsByFile.get(
|
|
12476
|
-
functionsByFile.set(
|
|
12474
|
+
const path15 = sf.getFilePath();
|
|
12475
|
+
const index = functionsByFile.get(path15) ?? indexFunctions(sf);
|
|
12476
|
+
functionsByFile.set(path15, index);
|
|
12477
12477
|
if (location.span !== void 0) {
|
|
12478
12478
|
const bySpan = index.get(spanKey(location.span));
|
|
12479
12479
|
if (bySpan !== void 0) {
|
|
@@ -12660,7 +12660,7 @@ function extractEndpointContract(endpointNode, pattern, framework, resolution) {
|
|
|
12660
12660
|
}
|
|
12661
12661
|
const responses = [];
|
|
12662
12662
|
let method;
|
|
12663
|
-
let
|
|
12663
|
+
let path15;
|
|
12664
12664
|
for (const prop of endpointNode.getProperties()) {
|
|
12665
12665
|
if (!Node54.isPropertyAssignment(prop)) {
|
|
12666
12666
|
continue;
|
|
@@ -12675,7 +12675,7 @@ function extractEndpointContract(endpointNode, pattern, framework, resolution) {
|
|
|
12675
12675
|
if (propName === pattern.pathProperty) {
|
|
12676
12676
|
const val = prop.getInitializer();
|
|
12677
12677
|
if (val !== void 0 && Node54.isStringLiteral(val)) {
|
|
12678
|
-
|
|
12678
|
+
path15 = val.getLiteralValue();
|
|
12679
12679
|
}
|
|
12680
12680
|
}
|
|
12681
12681
|
if (propName === pattern.responseExtraction.property) {
|
|
@@ -12700,10 +12700,10 @@ function extractEndpointContract(endpointNode, pattern, framework, resolution) {
|
|
|
12700
12700
|
if (responses.length === 0) {
|
|
12701
12701
|
return null;
|
|
12702
12702
|
}
|
|
12703
|
-
const boundaryBinding = method !== void 0 ||
|
|
12703
|
+
const boundaryBinding = method !== void 0 || path15 !== void 0 ? restBinding({
|
|
12704
12704
|
transport: "http",
|
|
12705
12705
|
method: method ?? null,
|
|
12706
|
-
path:
|
|
12706
|
+
path: path15 ?? null,
|
|
12707
12707
|
recognition: framework
|
|
12708
12708
|
}) : null;
|
|
12709
12709
|
return {
|
|
@@ -12914,6 +12914,8 @@ function parameterName(segment, convention) {
|
|
|
12914
12914
|
}
|
|
12915
12915
|
|
|
12916
12916
|
// src/discovery/graphqlClientConstruction.ts
|
|
12917
|
+
import fs4 from "fs";
|
|
12918
|
+
import path8 from "path";
|
|
12917
12919
|
import {
|
|
12918
12920
|
parse as graphqlParse2
|
|
12919
12921
|
} from "graphql";
|
|
@@ -12976,8 +12978,36 @@ function fragmentsRegisteredIn(sourceFiles) {
|
|
|
12976
12978
|
}
|
|
12977
12979
|
});
|
|
12978
12980
|
}
|
|
12981
|
+
for (const text of graphqlFileTextsNear(sourceFiles)) {
|
|
12982
|
+
for (const name of fragmentOnlyDocumentNames(text)) {
|
|
12983
|
+
registered.add(name);
|
|
12984
|
+
}
|
|
12985
|
+
}
|
|
12979
12986
|
return registered;
|
|
12980
12987
|
}
|
|
12988
|
+
function graphqlFileTextsNear(sourceFiles) {
|
|
12989
|
+
const roots = new Set(
|
|
12990
|
+
sourceFiles.map((sourceFile) => path8.dirname(sourceFile.getFilePath()))
|
|
12991
|
+
);
|
|
12992
|
+
const texts = [];
|
|
12993
|
+
for (const root of roots) {
|
|
12994
|
+
let entries;
|
|
12995
|
+
try {
|
|
12996
|
+
entries = fs4.readdirSync(root, { withFileTypes: true });
|
|
12997
|
+
} catch {
|
|
12998
|
+
continue;
|
|
12999
|
+
}
|
|
13000
|
+
for (const entry of entries) {
|
|
13001
|
+
if (entry.isFile() && /\.(graphql|gql)$/.test(entry.name)) {
|
|
13002
|
+
try {
|
|
13003
|
+
texts.push(fs4.readFileSync(path8.join(root, entry.name), "utf8"));
|
|
13004
|
+
} catch {
|
|
13005
|
+
}
|
|
13006
|
+
}
|
|
13007
|
+
}
|
|
13008
|
+
}
|
|
13009
|
+
return texts;
|
|
13010
|
+
}
|
|
12981
13011
|
function fragmentOnlyDocumentNames(text) {
|
|
12982
13012
|
if (!text.includes("fragment")) {
|
|
12983
13013
|
return [];
|
|
@@ -13415,8 +13445,8 @@ function noteExpanded(expanded, readings, discovery) {
|
|
|
13415
13445
|
const paths = new Set(match.registrations.map((one) => one.pathTemplate));
|
|
13416
13446
|
const methods = expanded.get(reading.declarationId) ?? /* @__PURE__ */ new Set();
|
|
13417
13447
|
for (const sink of reading.helper.sinks) {
|
|
13418
|
-
const
|
|
13419
|
-
if (sink.method !== null &&
|
|
13448
|
+
const path15 = sink.arguments[0];
|
|
13449
|
+
if (sink.method !== null && path15?.as === "text" && paths.has(path15.text)) {
|
|
13420
13450
|
methods.add(sink.method);
|
|
13421
13451
|
}
|
|
13422
13452
|
}
|
|
@@ -15551,14 +15581,14 @@ function readArrayLiteralText(node) {
|
|
|
15551
15581
|
}
|
|
15552
15582
|
|
|
15553
15583
|
// src/summaryIdentity.ts
|
|
15554
|
-
import
|
|
15584
|
+
import path9 from "path";
|
|
15555
15585
|
import {
|
|
15556
15586
|
disambiguateSummaryIds,
|
|
15557
15587
|
linkCallsToSummaries,
|
|
15558
15588
|
summaryIdFromParts
|
|
15559
15589
|
} from "@suss/behavioral-ir";
|
|
15560
15590
|
function workspaceRootFor(anchor) {
|
|
15561
|
-
return namedPackageDirAbove(anchor) ??
|
|
15591
|
+
return namedPackageDirAbove(anchor) ?? path9.resolve(anchor);
|
|
15562
15592
|
}
|
|
15563
15593
|
function workspaceNameFor(root) {
|
|
15564
15594
|
if (root === void 0) {
|
|
@@ -15568,7 +15598,7 @@ function workspaceNameFor(root) {
|
|
|
15568
15598
|
if (dir !== null) {
|
|
15569
15599
|
return packageNameAt(dir);
|
|
15570
15600
|
}
|
|
15571
|
-
const folder =
|
|
15601
|
+
const folder = path9.basename(path9.resolve(root));
|
|
15572
15602
|
return folder.length > 0 ? folder : null;
|
|
15573
15603
|
}
|
|
15574
15604
|
function nameSummaries(summaries, args) {
|
|
@@ -15583,10 +15613,10 @@ function nameSummaries(summaries, args) {
|
|
|
15583
15613
|
linkCallsToSummaries(summaries);
|
|
15584
15614
|
}
|
|
15585
15615
|
function relativeFile(file, projectRoot) {
|
|
15586
|
-
if (projectRoot === void 0 || !
|
|
15616
|
+
if (projectRoot === void 0 || !path9.isAbsolute(file)) {
|
|
15587
15617
|
return file;
|
|
15588
15618
|
}
|
|
15589
|
-
const relative =
|
|
15619
|
+
const relative = path9.relative(projectRoot, file);
|
|
15590
15620
|
return relative.startsWith("..") ? file : relative;
|
|
15591
15621
|
}
|
|
15592
15622
|
function idFor(workspace, file, summary) {
|
|
@@ -15621,11 +15651,11 @@ function declineWhenRunFromSource(cacheDir) {
|
|
|
15621
15651
|
}
|
|
15622
15652
|
|
|
15623
15653
|
// src/workspacePatterns.ts
|
|
15624
|
-
import
|
|
15625
|
-
import
|
|
15654
|
+
import fs5 from "fs";
|
|
15655
|
+
import path10 from "path";
|
|
15626
15656
|
function readJson(filePath) {
|
|
15627
15657
|
try {
|
|
15628
|
-
return JSON.parse(
|
|
15658
|
+
return JSON.parse(fs5.readFileSync(filePath, "utf8"));
|
|
15629
15659
|
} catch {
|
|
15630
15660
|
return void 0;
|
|
15631
15661
|
}
|
|
@@ -15652,7 +15682,7 @@ function pnpmWorkspaceGlobs(yamlText) {
|
|
|
15652
15682
|
return globs;
|
|
15653
15683
|
}
|
|
15654
15684
|
function workspaceGlobsAt(dir) {
|
|
15655
|
-
const pkg = readJson(
|
|
15685
|
+
const pkg = readJson(path10.join(dir, "package.json"));
|
|
15656
15686
|
if (typeof pkg === "object" && pkg !== null && "workspaces" in pkg) {
|
|
15657
15687
|
const ws = pkg.workspaces;
|
|
15658
15688
|
if (Array.isArray(ws)) {
|
|
@@ -15664,10 +15694,10 @@ function workspaceGlobsAt(dir) {
|
|
|
15664
15694
|
);
|
|
15665
15695
|
}
|
|
15666
15696
|
}
|
|
15667
|
-
const pnpmPath =
|
|
15668
|
-
if (
|
|
15697
|
+
const pnpmPath = path10.join(dir, "pnpm-workspace.yaml");
|
|
15698
|
+
if (fs5.existsSync(pnpmPath)) {
|
|
15669
15699
|
try {
|
|
15670
|
-
return pnpmWorkspaceGlobs(
|
|
15700
|
+
return pnpmWorkspaceGlobs(fs5.readFileSync(pnpmPath, "utf8"));
|
|
15671
15701
|
} catch {
|
|
15672
15702
|
return null;
|
|
15673
15703
|
}
|
|
@@ -15676,14 +15706,14 @@ function workspaceGlobsAt(dir) {
|
|
|
15676
15706
|
}
|
|
15677
15707
|
function isDirectory(candidate) {
|
|
15678
15708
|
try {
|
|
15679
|
-
return
|
|
15709
|
+
return fs5.statSync(candidate).isDirectory();
|
|
15680
15710
|
} catch {
|
|
15681
15711
|
return false;
|
|
15682
15712
|
}
|
|
15683
15713
|
}
|
|
15684
15714
|
function subdirectoriesOf(dir) {
|
|
15685
15715
|
try {
|
|
15686
|
-
return
|
|
15716
|
+
return fs5.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name).filter((name) => !name.startsWith(".") && name !== "node_modules");
|
|
15687
15717
|
} catch {
|
|
15688
15718
|
return [];
|
|
15689
15719
|
}
|
|
@@ -15701,13 +15731,13 @@ function directoriesMatchingGlob(root, glob) {
|
|
|
15701
15731
|
for (const dir of current2) {
|
|
15702
15732
|
for (const entry of subdirectoriesOf(dir)) {
|
|
15703
15733
|
if (pattern.test(entry)) {
|
|
15704
|
-
next.push(
|
|
15734
|
+
next.push(path10.join(dir, entry));
|
|
15705
15735
|
}
|
|
15706
15736
|
}
|
|
15707
15737
|
}
|
|
15708
15738
|
} else {
|
|
15709
15739
|
for (const dir of current2) {
|
|
15710
|
-
next.push(
|
|
15740
|
+
next.push(path10.join(dir, segment));
|
|
15711
15741
|
}
|
|
15712
15742
|
}
|
|
15713
15743
|
current2 = next.filter(isDirectory);
|
|
@@ -15715,7 +15745,7 @@ function directoriesMatchingGlob(root, glob) {
|
|
|
15715
15745
|
return current2;
|
|
15716
15746
|
}
|
|
15717
15747
|
function packageAt(dir) {
|
|
15718
|
-
const packageJsonPath =
|
|
15748
|
+
const packageJsonPath = path10.join(dir, "package.json");
|
|
15719
15749
|
const pkg = readJson(packageJsonPath);
|
|
15720
15750
|
if (typeof pkg === "object" && pkg !== null && typeof pkg.name === "string") {
|
|
15721
15751
|
return { name: pkg.name, packageJsonPath };
|
|
@@ -15723,7 +15753,7 @@ function packageAt(dir) {
|
|
|
15723
15753
|
return null;
|
|
15724
15754
|
}
|
|
15725
15755
|
function workspacePackagesFrom(anchor) {
|
|
15726
|
-
let dir =
|
|
15756
|
+
let dir = path10.resolve(anchor);
|
|
15727
15757
|
for (; ; ) {
|
|
15728
15758
|
const globs = workspaceGlobsAt(dir);
|
|
15729
15759
|
if (globs !== null) {
|
|
@@ -15743,7 +15773,7 @@ function workspacePackagesFrom(anchor) {
|
|
|
15743
15773
|
(a, b) => a.packageJsonPath.localeCompare(b.packageJsonPath)
|
|
15744
15774
|
);
|
|
15745
15775
|
}
|
|
15746
|
-
const parent =
|
|
15776
|
+
const parent = path10.dirname(dir);
|
|
15747
15777
|
if (parent === dir) {
|
|
15748
15778
|
return [];
|
|
15749
15779
|
}
|
|
@@ -16285,11 +16315,11 @@ function extractConsumerBinding(unit, pattern, pack, resolution) {
|
|
|
16285
16315
|
return null;
|
|
16286
16316
|
}
|
|
16287
16317
|
const method = extractBindingMethod(binding, callSite, pack, resolution);
|
|
16288
|
-
const
|
|
16318
|
+
const path15 = extractBindingPath(binding, callSite, pack, resolution);
|
|
16289
16319
|
return restBinding2({
|
|
16290
16320
|
transport: pack.protocol,
|
|
16291
16321
|
method: method ?? null,
|
|
16292
|
-
path:
|
|
16322
|
+
path: path15 ?? null,
|
|
16293
16323
|
recognition: pack.name
|
|
16294
16324
|
});
|
|
16295
16325
|
}
|
|
@@ -16936,8 +16966,8 @@ function synthesizeCallerSummaries(wrapper, _project, options, resolution) {
|
|
|
16936
16966
|
if (pathArg === void 0) {
|
|
16937
16967
|
continue;
|
|
16938
16968
|
}
|
|
16939
|
-
const
|
|
16940
|
-
if (
|
|
16969
|
+
const path15 = pathFromArgument(pathArg, resolution);
|
|
16970
|
+
if (path15 === void 0) {
|
|
16941
16971
|
continue;
|
|
16942
16972
|
}
|
|
16943
16973
|
const callerFunc = enclosingFunction(callExpr);
|
|
@@ -16949,7 +16979,7 @@ function synthesizeCallerSummaries(wrapper, _project, options, resolution) {
|
|
|
16949
16979
|
continue;
|
|
16950
16980
|
}
|
|
16951
16981
|
seen.add(dedupKey);
|
|
16952
|
-
out.push(buildCallerSummary(wrapper, callerFunc, callExpr,
|
|
16982
|
+
out.push(buildCallerSummary(wrapper, callerFunc, callExpr, path15, options));
|
|
16953
16983
|
}
|
|
16954
16984
|
return out;
|
|
16955
16985
|
}
|
|
@@ -17006,7 +17036,7 @@ function callerName(func) {
|
|
|
17006
17036
|
}
|
|
17007
17037
|
return "anonymous";
|
|
17008
17038
|
}
|
|
17009
|
-
function buildCallerSummary(wrapper, callerFunc, callExpr,
|
|
17039
|
+
function buildCallerSummary(wrapper, callerFunc, callExpr, path15, options) {
|
|
17010
17040
|
const wrapperBinding = wrapper.summary.identity.boundaryBinding;
|
|
17011
17041
|
const wrapperRest = wrapperBinding?.semantics.name === "rest" ? wrapperBinding.semantics : null;
|
|
17012
17042
|
const syntheticPack = {
|
|
@@ -17038,7 +17068,7 @@ function buildCallerSummary(wrapper, callerFunc, callExpr, path14, options) {
|
|
|
17038
17068
|
raw.boundaryBinding = restBinding2({
|
|
17039
17069
|
transport: wrapperBinding?.transport ?? "http",
|
|
17040
17070
|
method: wrapperRest?.method ?? null,
|
|
17041
|
-
path:
|
|
17071
|
+
path: path15,
|
|
17042
17072
|
recognition: wrapperBinding?.recognition ?? "unknown"
|
|
17043
17073
|
});
|
|
17044
17074
|
const summary = assembleSummary3(raw, options);
|
|
@@ -17096,7 +17126,7 @@ function createTypeScriptAdapter(suppliedConfig) {
|
|
|
17096
17126
|
...suppliedConfig,
|
|
17097
17127
|
frameworks: expandWorkspacePatterns(
|
|
17098
17128
|
suppliedConfig.frameworks,
|
|
17099
|
-
suppliedConfig.projectRoot ?? (suppliedConfig.tsConfigFilePath !== void 0 ?
|
|
17129
|
+
suppliedConfig.projectRoot ?? (suppliedConfig.tsConfigFilePath !== void 0 ? path11.dirname(suppliedConfig.tsConfigFilePath) : void 0)
|
|
17100
17130
|
)
|
|
17101
17131
|
};
|
|
17102
17132
|
const project = config.project ?? new Project(
|
|
@@ -17105,11 +17135,11 @@ function createTypeScriptAdapter(suppliedConfig) {
|
|
|
17105
17135
|
skipAddingFilesFromTsConfig: true
|
|
17106
17136
|
} : { skipAddingFilesFromTsConfig: true }
|
|
17107
17137
|
);
|
|
17108
|
-
const runRoot = config.projectRoot ?? (config.tsConfigFilePath !== void 0 ? workspaceRootFor(
|
|
17138
|
+
const runRoot = config.projectRoot ?? (config.tsConfigFilePath !== void 0 ? workspaceRootFor(path11.dirname(config.tsConfigFilePath)) : void 0);
|
|
17109
17139
|
let lazyBootstrapped = false;
|
|
17110
17140
|
let projectFileSet;
|
|
17111
17141
|
const cacheDir = declineWhenRunFromSource(
|
|
17112
|
-
config.cacheDir === null ? null : config.cacheDir ?? (config.tsConfigFilePath !== void 0 ?
|
|
17142
|
+
config.cacheDir === null ? null : config.cacheDir ?? (config.tsConfigFilePath !== void 0 ? path11.join(path11.dirname(config.tsConfigFilePath), ".suss", "cache") : null)
|
|
17113
17143
|
);
|
|
17114
17144
|
const cache = createCacheLayer(cacheDir);
|
|
17115
17145
|
const packsDigest = `${computeAdapterPacksDigest(
|
|
@@ -17813,8 +17843,8 @@ function buildSubUnitSummary(subUnit, parent, invocationRecognizers, accessRecog
|
|
|
17813
17843
|
}
|
|
17814
17844
|
|
|
17815
17845
|
// src/bootstrap/noTsconfigProject.ts
|
|
17816
|
-
import
|
|
17817
|
-
import
|
|
17846
|
+
import fs6 from "fs";
|
|
17847
|
+
import path12 from "path";
|
|
17818
17848
|
import {
|
|
17819
17849
|
ModuleKind,
|
|
17820
17850
|
ModuleResolutionKind,
|
|
@@ -17850,7 +17880,7 @@ function findSourceFiles(rootDir, depth = 0) {
|
|
|
17850
17880
|
const found = [];
|
|
17851
17881
|
let entries;
|
|
17852
17882
|
try {
|
|
17853
|
-
entries =
|
|
17883
|
+
entries = fs6.readdirSync(rootDir, { withFileTypes: true });
|
|
17854
17884
|
} catch {
|
|
17855
17885
|
return [];
|
|
17856
17886
|
}
|
|
@@ -17858,10 +17888,10 @@ function findSourceFiles(rootDir, depth = 0) {
|
|
|
17858
17888
|
if (entry.name.startsWith(".") || SKIP_DIRECTORIES.has(entry.name)) {
|
|
17859
17889
|
continue;
|
|
17860
17890
|
}
|
|
17861
|
-
const full =
|
|
17891
|
+
const full = path12.join(rootDir, entry.name);
|
|
17862
17892
|
if (entry.isDirectory()) {
|
|
17863
17893
|
found.push(...findSourceFiles(full, depth + 1));
|
|
17864
|
-
} else if (SOURCE_EXTENSIONS.has(
|
|
17894
|
+
} else if (SOURCE_EXTENSIONS.has(path12.extname(entry.name)) && !entry.name.endsWith(".d.ts")) {
|
|
17865
17895
|
found.push(full);
|
|
17866
17896
|
}
|
|
17867
17897
|
}
|
|
@@ -17896,15 +17926,15 @@ function createProjectWithoutTsconfig(rootDir) {
|
|
|
17896
17926
|
return { project, files };
|
|
17897
17927
|
}
|
|
17898
17928
|
function findNearestTsconfig(startDir) {
|
|
17899
|
-
let dir =
|
|
17929
|
+
let dir = path12.resolve(startDir);
|
|
17900
17930
|
while (true) {
|
|
17901
17931
|
for (const name of ["tsconfig.json", "jsconfig.json"]) {
|
|
17902
|
-
const candidate =
|
|
17903
|
-
if (
|
|
17932
|
+
const candidate = path12.join(dir, name);
|
|
17933
|
+
if (fs6.existsSync(candidate)) {
|
|
17904
17934
|
return candidate;
|
|
17905
17935
|
}
|
|
17906
17936
|
}
|
|
17907
|
-
const parent =
|
|
17937
|
+
const parent = path12.dirname(dir);
|
|
17908
17938
|
if (parent === dir) {
|
|
17909
17939
|
return null;
|
|
17910
17940
|
}
|
|
@@ -17913,7 +17943,7 @@ function findNearestTsconfig(startDir) {
|
|
|
17913
17943
|
}
|
|
17914
17944
|
|
|
17915
17945
|
// src/facts/why.ts
|
|
17916
|
-
import
|
|
17946
|
+
import path13 from "path";
|
|
17917
17947
|
import { Node as Node65, Project as Project3, SyntaxKind as SyntaxKind13 } from "ts-morph";
|
|
17918
17948
|
import { explainResolutionProof, renderExplanation } from "@suss/resolution";
|
|
17919
17949
|
var JS_PHRASES = {
|
|
@@ -17926,7 +17956,7 @@ var TypeScriptWhySession = class {
|
|
|
17926
17956
|
store;
|
|
17927
17957
|
root;
|
|
17928
17958
|
constructor(options) {
|
|
17929
|
-
this.root =
|
|
17959
|
+
this.root = path13.resolve(options.dir);
|
|
17930
17960
|
const tsconfig = findNearestTsconfig(this.root);
|
|
17931
17961
|
this.project = tsconfig === null ? createProjectWithoutTsconfig(this.root).project : new Project3({ tsConfigFilePath: tsconfig });
|
|
17932
17962
|
this.store = new ResolutionStore();
|
|
@@ -18015,7 +18045,7 @@ var TypeScriptWhySession = class {
|
|
|
18015
18045
|
};
|
|
18016
18046
|
}
|
|
18017
18047
|
sourceFileAt(file) {
|
|
18018
|
-
const absolute =
|
|
18048
|
+
const absolute = path13.resolve(this.root, file);
|
|
18019
18049
|
const loaded = this.project.getSourceFile(absolute);
|
|
18020
18050
|
if (loaded !== void 0) {
|
|
18021
18051
|
return loaded;
|
|
@@ -18029,7 +18059,7 @@ var TypeScriptWhySession = class {
|
|
|
18029
18059
|
/** A module key: a file path said relative to the root, or a package name. */
|
|
18030
18060
|
displayPath(key) {
|
|
18031
18061
|
if (key.startsWith(this.root)) {
|
|
18032
|
-
return
|
|
18062
|
+
return path13.relative(this.root, key);
|
|
18033
18063
|
}
|
|
18034
18064
|
return key;
|
|
18035
18065
|
}
|
|
@@ -18058,7 +18088,7 @@ function displayNameOf(node) {
|
|
|
18058
18088
|
}
|
|
18059
18089
|
|
|
18060
18090
|
// src/stubEvidence.ts
|
|
18061
|
-
import
|
|
18091
|
+
import path14 from "path";
|
|
18062
18092
|
import { Project as Project4 } from "ts-morph";
|
|
18063
18093
|
function stubEvidenceIn(project, packageName, root) {
|
|
18064
18094
|
const resolution = new ResolutionStore();
|
|
@@ -18074,7 +18104,7 @@ function stubEvidenceIn(project, packageName, root) {
|
|
|
18074
18104
|
calls: []
|
|
18075
18105
|
};
|
|
18076
18106
|
entry.calls.push({
|
|
18077
|
-
file:
|
|
18107
|
+
file: path14.relative(root, sourceFile.getFilePath()).split(path14.sep).join("/"),
|
|
18078
18108
|
line: one.call.getStartLineNumber(),
|
|
18079
18109
|
args: one.call.getArguments().map((arg) => effectArgOf(arg))
|
|
18080
18110
|
});
|
|
@@ -18089,7 +18119,7 @@ function stubEvidence(options) {
|
|
|
18089
18119
|
const project = new Project4(
|
|
18090
18120
|
options.tsConfigFilePath !== void 0 ? { tsConfigFilePath: options.tsConfigFilePath } : { compilerOptions: { allowJs: true } }
|
|
18091
18121
|
);
|
|
18092
|
-
const root = options.tsConfigFilePath !== void 0 ?
|
|
18122
|
+
const root = options.tsConfigFilePath !== void 0 ? path14.dirname(options.tsConfigFilePath) : path14.resolve(options.directory ?? process.cwd());
|
|
18093
18123
|
if (options.tsConfigFilePath === void 0) {
|
|
18094
18124
|
project.addSourceFilesAtPaths([
|
|
18095
18125
|
`${root}/**/*.{ts,tsx,js,jsx}`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suss/adapter-typescript",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Read a TypeScript or JavaScript codebase with suss and check what each handler returns against every caller, spec and template it can see.",
|
|
6
6
|
"keywords": [
|
|
@@ -48,11 +48,11 @@
|
|
|
48
48
|
"typecheck": "tsc --noEmit"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@suss/behavioral-ir": "0.24.
|
|
52
|
-
"@suss/datalog": "0.24.
|
|
53
|
-
"@suss/extractor": "0.24.
|
|
54
|
-
"@suss/resolution": "0.24.
|
|
55
|
-
"@suss/values": "0.24.
|
|
51
|
+
"@suss/behavioral-ir": "0.24.4",
|
|
52
|
+
"@suss/datalog": "0.24.4",
|
|
53
|
+
"@suss/extractor": "0.24.4",
|
|
54
|
+
"@suss/resolution": "0.24.4",
|
|
55
|
+
"@suss/values": "0.24.4",
|
|
56
56
|
"graphql": "^16.8.0",
|
|
57
57
|
"picomatch": "^4.0.4",
|
|
58
58
|
"ts-morph": "^23.0.0",
|