@suss/adapter-typescript 0.25.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +773 -792
- package/dist/index.js +176 -194
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
import { Database as Database5 } from "@suss/datalog";
|
|
22
22
|
import {
|
|
23
23
|
assembleSummary as assembleSummary3,
|
|
24
|
+
commonDirectoryOf as commonDirectoryOf2,
|
|
24
25
|
composeWrappers,
|
|
25
26
|
createCacheLayer,
|
|
26
27
|
runDigest,
|
|
@@ -4382,180 +4383,8 @@ function declarationOf(value) {
|
|
|
4382
4383
|
import { Node as Node18 } from "ts-morph";
|
|
4383
4384
|
|
|
4384
4385
|
// src/discovery/importScan.ts
|
|
4385
|
-
import path3 from "path";
|
|
4386
|
-
|
|
4387
|
-
// src/diagnostics.ts
|
|
4388
4386
|
import path2 from "path";
|
|
4389
|
-
import {
|
|
4390
|
-
import {
|
|
4391
|
-
createPackTallies,
|
|
4392
|
-
emptyTally,
|
|
4393
|
-
recordPackFailure,
|
|
4394
|
-
summaryCountsByPack
|
|
4395
|
-
} from "@suss/extractor";
|
|
4396
|
-
function commonDirectoryOf(files) {
|
|
4397
|
-
const absolute = files.filter((f) => path2.isAbsolute(f));
|
|
4398
|
-
const first = absolute[0];
|
|
4399
|
-
if (first === void 0) {
|
|
4400
|
-
return void 0;
|
|
4401
|
-
}
|
|
4402
|
-
let shared = path2.dirname(first).split(path2.sep);
|
|
4403
|
-
for (const file of absolute.slice(1)) {
|
|
4404
|
-
const parts = path2.dirname(file).split(path2.sep);
|
|
4405
|
-
let i = 0;
|
|
4406
|
-
while (i < shared.length && i < parts.length && shared[i] === parts[i]) {
|
|
4407
|
-
i += 1;
|
|
4408
|
-
}
|
|
4409
|
-
shared = shared.slice(0, i);
|
|
4410
|
-
}
|
|
4411
|
-
const joined2 = shared.join(path2.sep);
|
|
4412
|
-
return joined2.length > 1 ? joined2 : void 0;
|
|
4413
|
-
}
|
|
4414
|
-
var DEFAULT_RESOLUTION = {
|
|
4415
|
-
moduleResolution: ts3.ModuleResolutionKind.Bundler,
|
|
4416
|
-
target: ts3.ScriptTarget.ESNext,
|
|
4417
|
-
module: ts3.ModuleKind.ESNext
|
|
4418
|
-
};
|
|
4419
|
-
function resolutionContext(args) {
|
|
4420
|
-
if (args.tsConfigFilePath !== void 0) {
|
|
4421
|
-
const configFile = ts3.readConfigFile(
|
|
4422
|
-
args.tsConfigFilePath,
|
|
4423
|
-
ts3.sys.readFile
|
|
4424
|
-
);
|
|
4425
|
-
if (configFile.error !== void 0) {
|
|
4426
|
-
return null;
|
|
4427
|
-
}
|
|
4428
|
-
const dir = path2.dirname(args.tsConfigFilePath);
|
|
4429
|
-
const parsed = ts3.parseJsonConfigFileContent(
|
|
4430
|
-
configFile.config,
|
|
4431
|
-
ts3.sys,
|
|
4432
|
-
dir,
|
|
4433
|
-
/*existingOptions*/
|
|
4434
|
-
void 0,
|
|
4435
|
-
args.tsConfigFilePath
|
|
4436
|
-
);
|
|
4437
|
-
return {
|
|
4438
|
-
containingFile: path2.join(dir, "index.ts"),
|
|
4439
|
-
options: parsed.options
|
|
4440
|
-
};
|
|
4441
|
-
}
|
|
4442
|
-
if (args.projectRoot === void 0 || !path2.isAbsolute(args.projectRoot)) {
|
|
4443
|
-
return null;
|
|
4444
|
-
}
|
|
4445
|
-
return {
|
|
4446
|
-
containingFile: path2.join(args.projectRoot, "index.ts"),
|
|
4447
|
-
options: DEFAULT_RESOLUTION
|
|
4448
|
-
};
|
|
4449
|
-
}
|
|
4450
|
-
function unresolvedGatesFor(gates, args) {
|
|
4451
|
-
if (gates.length === 0) {
|
|
4452
|
-
return [];
|
|
4453
|
-
}
|
|
4454
|
-
const context = resolutionContext(args);
|
|
4455
|
-
if (context === null) {
|
|
4456
|
-
return [];
|
|
4457
|
-
}
|
|
4458
|
-
const unresolved = [];
|
|
4459
|
-
for (const gate of gates) {
|
|
4460
|
-
const resolved = ts3.resolveModuleName(
|
|
4461
|
-
gate,
|
|
4462
|
-
context.containingFile,
|
|
4463
|
-
context.options,
|
|
4464
|
-
ts3.sys
|
|
4465
|
-
);
|
|
4466
|
-
if (resolved.resolvedModule === void 0) {
|
|
4467
|
-
unresolved.push(gate);
|
|
4468
|
-
}
|
|
4469
|
-
}
|
|
4470
|
-
return unresolved;
|
|
4471
|
-
}
|
|
4472
|
-
function helpersWithNoCall(patterns, matched, projectRoot) {
|
|
4473
|
-
const missing = [];
|
|
4474
|
-
for (const pattern of patterns) {
|
|
4475
|
-
if (pattern.match.type !== "registrationTemplate" || matched.has(pattern.match.helperName)) {
|
|
4476
|
-
continue;
|
|
4477
|
-
}
|
|
4478
|
-
const from = pattern.match.importModule;
|
|
4479
|
-
missing.push(
|
|
4480
|
-
from === void 0 ? pattern.match.helperName : `${pattern.match.helperName} from ${shortModule(from, projectRoot)}`
|
|
4481
|
-
);
|
|
4482
|
-
}
|
|
4483
|
-
return missing;
|
|
4484
|
-
}
|
|
4485
|
-
function shortModule(module, projectRoot) {
|
|
4486
|
-
if (projectRoot === void 0 || !path2.isAbsolute(module)) {
|
|
4487
|
-
return module;
|
|
4488
|
-
}
|
|
4489
|
-
return path2.relative(projectRoot, module);
|
|
4490
|
-
}
|
|
4491
|
-
function buildExtractionReport(args) {
|
|
4492
|
-
const bySummary = summaryCountsByPack(args.summaries);
|
|
4493
|
-
const packFunnels = args.packs.map((pack) => {
|
|
4494
|
-
const gates = packIsUngated(pack) ? [] : collectPackGates(pack);
|
|
4495
|
-
const tally = args.tallies.get(pack.name) ?? emptyTally();
|
|
4496
|
-
const counted = bySummary.get(pack.name) ?? {
|
|
4497
|
-
bound: 0,
|
|
4498
|
-
providers: 0,
|
|
4499
|
-
withBehavior: 0
|
|
4500
|
-
};
|
|
4501
|
-
return {
|
|
4502
|
-
pack: pack.name,
|
|
4503
|
-
version: pack.version ?? null,
|
|
4504
|
-
discovers: pack.discovery.length > 0 || pack.discoverUnits !== void 0,
|
|
4505
|
-
recognizes: (pack.invocationRecognizers?.length ?? 0) > 0 || (pack.accessRecognizers?.length ?? 0) > 0,
|
|
4506
|
-
gates,
|
|
4507
|
-
unresolvedGates: unresolvedGatesFor(gates, {
|
|
4508
|
-
tsConfigFilePath: args.tsConfigFilePath,
|
|
4509
|
-
projectRoot: args.projectRoot
|
|
4510
|
-
}),
|
|
4511
|
-
candidateFiles: tally.candidateFiles,
|
|
4512
|
-
unitsDiscovered: tally.unitsDiscovered,
|
|
4513
|
-
unitsInGatedFiles: tally.unitsInGatedFiles,
|
|
4514
|
-
effectsRecognized: tally.effectsRecognized,
|
|
4515
|
-
unitsClaimed: tally.unitsClaimed,
|
|
4516
|
-
summariesProduced: tally.summariesProduced,
|
|
4517
|
-
failures: tally.failures,
|
|
4518
|
-
helpersUnmatched: helpersWithNoCall(
|
|
4519
|
-
[...pack.discovery, ...args.contributedPatterns?.(pack.name) ?? []],
|
|
4520
|
-
tally.helpersMatched,
|
|
4521
|
-
args.projectRoot
|
|
4522
|
-
),
|
|
4523
|
-
summariesBound: counted.bound,
|
|
4524
|
-
providerSummaries: counted.providers,
|
|
4525
|
-
summariesWithBehavior: counted.withBehavior,
|
|
4526
|
-
declarations: pack.declarations ?? null
|
|
4527
|
-
};
|
|
4528
|
-
});
|
|
4529
|
-
return {
|
|
4530
|
-
filesInProject: args.filesInProject,
|
|
4531
|
-
filesWalked: args.filesWalked,
|
|
4532
|
-
packs: packFunnels,
|
|
4533
|
-
summaries: args.summaries.length,
|
|
4534
|
-
filesWithUnreadableExports: [...args.filesWithUnreadableExports ?? []],
|
|
4535
|
-
reassignedNamesUnstated: args.reassignedNamesUnstated ?? 0,
|
|
4536
|
-
emptyStage: args.summaries.length === 0 ? firstEmptyStage(packFunnels, args) : null
|
|
4537
|
-
};
|
|
4538
|
-
}
|
|
4539
|
-
function firstEmptyStage(packs, args) {
|
|
4540
|
-
if (args.filesInProject === 0) {
|
|
4541
|
-
return "tsconfig";
|
|
4542
|
-
}
|
|
4543
|
-
const gateFailed = packs.some(
|
|
4544
|
-
(p) => p.unresolvedGates.length > 0 && p.candidateFiles > 0
|
|
4545
|
-
);
|
|
4546
|
-
if (gateFailed) {
|
|
4547
|
-
return "gateResolution";
|
|
4548
|
-
}
|
|
4549
|
-
if (args.filesWalked === 0 || packs.every((p) => p.candidateFiles === 0)) {
|
|
4550
|
-
return "candidateFiles";
|
|
4551
|
-
}
|
|
4552
|
-
if (packs.every((p) => p.unitsDiscovered === 0)) {
|
|
4553
|
-
return "discovery";
|
|
4554
|
-
}
|
|
4555
|
-
return "assembly";
|
|
4556
|
-
}
|
|
4557
|
-
|
|
4558
|
-
// src/discovery/importScan.ts
|
|
4387
|
+
import { commonDirectoryOf } from "@suss/extractor";
|
|
4559
4388
|
function specifierMatches(specifier, moduleName, subpaths) {
|
|
4560
4389
|
if (specifier === moduleName) {
|
|
4561
4390
|
return true;
|
|
@@ -4647,7 +4476,7 @@ function resolvedModuleFile(project, importModule, resolution) {
|
|
|
4647
4476
|
function projectFileNamedBy(project, specifier) {
|
|
4648
4477
|
const files = project.getSourceFiles().filter((sf) => !sf.isDeclarationFile());
|
|
4649
4478
|
const root = commonDirectoryOf(files.map((sf) => sf.getFilePath())) ?? "/";
|
|
4650
|
-
const target = withoutSourceExtension(
|
|
4479
|
+
const target = withoutSourceExtension(path2.resolve(root, specifier));
|
|
4651
4480
|
for (const candidate of files) {
|
|
4652
4481
|
if (withoutSourceExtension(candidate.getFilePath()) === target) {
|
|
4653
4482
|
return candidate;
|
|
@@ -6106,7 +5935,7 @@ import { Node as Node26 } from "ts-morph";
|
|
|
6106
5935
|
|
|
6107
5936
|
// src/discovery/graphqlShared.ts
|
|
6108
5937
|
import fs2 from "fs";
|
|
6109
|
-
import
|
|
5938
|
+
import path3 from "path";
|
|
6110
5939
|
import {
|
|
6111
5940
|
Kind as GraphqlKind,
|
|
6112
5941
|
parse as graphqlParse,
|
|
@@ -6649,8 +6478,8 @@ function resolveGraphqlFileImport(decl) {
|
|
|
6649
6478
|
return null;
|
|
6650
6479
|
}
|
|
6651
6480
|
const sourceFile = importDecl.getSourceFile();
|
|
6652
|
-
const baseDir =
|
|
6653
|
-
const absolute =
|
|
6481
|
+
const baseDir = path3.dirname(sourceFile.getFilePath());
|
|
6482
|
+
const absolute = path3.resolve(baseDir, specifier);
|
|
6654
6483
|
try {
|
|
6655
6484
|
return fs2.readFileSync(absolute, "utf8");
|
|
6656
6485
|
} catch {
|
|
@@ -7257,13 +7086,13 @@ import { Node as Node30 } from "ts-morph";
|
|
|
7257
7086
|
|
|
7258
7087
|
// src/packageExports.ts
|
|
7259
7088
|
import fs3 from "fs";
|
|
7260
|
-
import
|
|
7089
|
+
import path4 from "path";
|
|
7261
7090
|
function resolvePackageExports(packageJsonPath, opts = {}) {
|
|
7262
|
-
const absPkgJson =
|
|
7263
|
-
const pkgDir =
|
|
7091
|
+
const absPkgJson = path4.resolve(packageJsonPath);
|
|
7092
|
+
const pkgDir = path4.dirname(absPkgJson);
|
|
7264
7093
|
const raw = fs3.readFileSync(absPkgJson, "utf8");
|
|
7265
7094
|
const pkg = JSON.parse(raw);
|
|
7266
|
-
const packageName = pkg.name ??
|
|
7095
|
+
const packageName = pkg.name ?? path4.basename(pkgDir);
|
|
7267
7096
|
const warnings = [];
|
|
7268
7097
|
const entries = [];
|
|
7269
7098
|
const pushEntry = (subPath, distPath) => {
|
|
@@ -7282,7 +7111,7 @@ function resolvePackageExports(packageJsonPath, opts = {}) {
|
|
|
7282
7111
|
subPath,
|
|
7283
7112
|
exportPathPrefix: subPathToPrefix(subPath),
|
|
7284
7113
|
sourceFile: src,
|
|
7285
|
-
publishedFile:
|
|
7114
|
+
publishedFile: path4.resolve(pkgDir, distPath)
|
|
7286
7115
|
});
|
|
7287
7116
|
};
|
|
7288
7117
|
const exportsField = pkg.exports;
|
|
@@ -7324,12 +7153,12 @@ function resolvePackageExportsCached(packageJsonPath) {
|
|
|
7324
7153
|
return fresh;
|
|
7325
7154
|
}
|
|
7326
7155
|
function namedPackageDirAbove(start) {
|
|
7327
|
-
let at =
|
|
7156
|
+
let at = path4.resolve(start);
|
|
7328
7157
|
for (let up = 0; up < 12; up += 1) {
|
|
7329
7158
|
if (packageNameAt(at) !== null) {
|
|
7330
7159
|
return at;
|
|
7331
7160
|
}
|
|
7332
|
-
const parent =
|
|
7161
|
+
const parent = path4.dirname(at);
|
|
7333
7162
|
if (parent === at) {
|
|
7334
7163
|
break;
|
|
7335
7164
|
}
|
|
@@ -7340,7 +7169,7 @@ function namedPackageDirAbove(start) {
|
|
|
7340
7169
|
function packageNameAt(dir) {
|
|
7341
7170
|
try {
|
|
7342
7171
|
const manifest = JSON.parse(
|
|
7343
|
-
fs3.readFileSync(
|
|
7172
|
+
fs3.readFileSync(path4.join(dir, "package.json"), "utf8")
|
|
7344
7173
|
);
|
|
7345
7174
|
if (typeof manifest.name === "string" && manifest.name.length > 0) {
|
|
7346
7175
|
return manifest.name;
|
|
@@ -7390,7 +7219,7 @@ function resolveSourceFor(pkgDir, distPath, srcRoot) {
|
|
|
7390
7219
|
const stem = withoutDist.replace(/\.d\.ts$/, "").replace(/\.js$/, "").replace(/\.cjs$/, "").replace(/\.mjs$/, "").replace(/\.ts$/, "");
|
|
7391
7220
|
const candidates = [`${stem}.ts`, `${stem}.tsx`];
|
|
7392
7221
|
for (const candidate of candidates) {
|
|
7393
|
-
const abs =
|
|
7222
|
+
const abs = path4.resolve(pkgDir, candidate);
|
|
7394
7223
|
if (fs3.existsSync(abs)) {
|
|
7395
7224
|
return abs;
|
|
7396
7225
|
}
|
|
@@ -7399,20 +7228,20 @@ function resolveSourceFor(pkgDir, distPath, srcRoot) {
|
|
|
7399
7228
|
}
|
|
7400
7229
|
|
|
7401
7230
|
// src/resolve/sourceDeclaration.ts
|
|
7402
|
-
import
|
|
7231
|
+
import path5 from "path";
|
|
7403
7232
|
function sourceDeclarationsBehind(decl, resolution, visited = /* @__PURE__ */ new Set()) {
|
|
7404
7233
|
const file = decl.getSourceFile();
|
|
7405
7234
|
if (!file.isDeclarationFile() || file.isInNodeModules()) {
|
|
7406
7235
|
return [decl];
|
|
7407
7236
|
}
|
|
7408
|
-
const packageDir = namedPackageDirAbove(
|
|
7237
|
+
const packageDir = namedPackageDirAbove(path5.dirname(file.getFilePath()));
|
|
7409
7238
|
if (packageDir === null || visited.has(packageDir)) {
|
|
7410
7239
|
return [decl];
|
|
7411
7240
|
}
|
|
7412
7241
|
visited.add(packageDir);
|
|
7413
7242
|
const project = file.getProject();
|
|
7414
7243
|
const { entries } = resolvePackageExportsCached(
|
|
7415
|
-
|
|
7244
|
+
path5.join(packageDir, "package.json")
|
|
7416
7245
|
);
|
|
7417
7246
|
const found = [];
|
|
7418
7247
|
for (const entry of entries) {
|
|
@@ -8514,7 +8343,7 @@ function handlerName(value) {
|
|
|
8514
8343
|
}
|
|
8515
8344
|
|
|
8516
8345
|
// src/discovery/registrationTemplate.ts
|
|
8517
|
-
import
|
|
8346
|
+
import path6 from "path";
|
|
8518
8347
|
import { Node as Node35 } from "ts-morph";
|
|
8519
8348
|
import { joinMountedPath as joinMountedPath2 } from "@suss/resolution";
|
|
8520
8349
|
|
|
@@ -8670,7 +8499,7 @@ function subjectOfCall(sourceFile, args, match, resolution) {
|
|
|
8670
8499
|
}
|
|
8671
8500
|
function helperCallsOf(sourceFile, match, resolution) {
|
|
8672
8501
|
const module = match.importModule;
|
|
8673
|
-
if (module !== void 0 && !
|
|
8502
|
+
if (module !== void 0 && !path6.isAbsolute(module)) {
|
|
8674
8503
|
const store = resolution ?? new ResolutionStore();
|
|
8675
8504
|
return callsResolvingTo(sourceFile, store, {
|
|
8676
8505
|
module,
|
|
@@ -12838,6 +12667,159 @@ function readContractForClientCall(callExpression, methodName, pattern, framewor
|
|
|
12838
12667
|
return null;
|
|
12839
12668
|
}
|
|
12840
12669
|
|
|
12670
|
+
// src/diagnostics.ts
|
|
12671
|
+
import path7 from "path";
|
|
12672
|
+
import { ts as ts3 } from "ts-morph";
|
|
12673
|
+
import {
|
|
12674
|
+
createPackTallies,
|
|
12675
|
+
emptyTally,
|
|
12676
|
+
recordPackFailure,
|
|
12677
|
+
summaryCountsByPack
|
|
12678
|
+
} from "@suss/extractor";
|
|
12679
|
+
var DEFAULT_RESOLUTION = {
|
|
12680
|
+
moduleResolution: ts3.ModuleResolutionKind.Bundler,
|
|
12681
|
+
target: ts3.ScriptTarget.ESNext,
|
|
12682
|
+
module: ts3.ModuleKind.ESNext
|
|
12683
|
+
};
|
|
12684
|
+
function resolutionContext(args) {
|
|
12685
|
+
if (args.tsConfigFilePath !== void 0) {
|
|
12686
|
+
const configFile = ts3.readConfigFile(
|
|
12687
|
+
args.tsConfigFilePath,
|
|
12688
|
+
ts3.sys.readFile
|
|
12689
|
+
);
|
|
12690
|
+
if (configFile.error !== void 0) {
|
|
12691
|
+
return null;
|
|
12692
|
+
}
|
|
12693
|
+
const dir = path7.dirname(args.tsConfigFilePath);
|
|
12694
|
+
const parsed = ts3.parseJsonConfigFileContent(
|
|
12695
|
+
configFile.config,
|
|
12696
|
+
ts3.sys,
|
|
12697
|
+
dir,
|
|
12698
|
+
/*existingOptions*/
|
|
12699
|
+
void 0,
|
|
12700
|
+
args.tsConfigFilePath
|
|
12701
|
+
);
|
|
12702
|
+
return {
|
|
12703
|
+
containingFile: path7.join(dir, "index.ts"),
|
|
12704
|
+
options: parsed.options
|
|
12705
|
+
};
|
|
12706
|
+
}
|
|
12707
|
+
if (args.projectRoot === void 0 || !path7.isAbsolute(args.projectRoot)) {
|
|
12708
|
+
return null;
|
|
12709
|
+
}
|
|
12710
|
+
return {
|
|
12711
|
+
containingFile: path7.join(args.projectRoot, "index.ts"),
|
|
12712
|
+
options: DEFAULT_RESOLUTION
|
|
12713
|
+
};
|
|
12714
|
+
}
|
|
12715
|
+
function unresolvedGatesFor(gates, args) {
|
|
12716
|
+
if (gates.length === 0) {
|
|
12717
|
+
return [];
|
|
12718
|
+
}
|
|
12719
|
+
const context = resolutionContext(args);
|
|
12720
|
+
if (context === null) {
|
|
12721
|
+
return [];
|
|
12722
|
+
}
|
|
12723
|
+
const unresolved = [];
|
|
12724
|
+
for (const gate of gates) {
|
|
12725
|
+
const resolved = ts3.resolveModuleName(
|
|
12726
|
+
gate,
|
|
12727
|
+
context.containingFile,
|
|
12728
|
+
context.options,
|
|
12729
|
+
ts3.sys
|
|
12730
|
+
);
|
|
12731
|
+
if (resolved.resolvedModule === void 0) {
|
|
12732
|
+
unresolved.push(gate);
|
|
12733
|
+
}
|
|
12734
|
+
}
|
|
12735
|
+
return unresolved;
|
|
12736
|
+
}
|
|
12737
|
+
function helpersWithNoCall(patterns, matched, projectRoot) {
|
|
12738
|
+
const missing = [];
|
|
12739
|
+
for (const pattern of patterns) {
|
|
12740
|
+
if (pattern.match.type !== "registrationTemplate" || matched.has(pattern.match.helperName)) {
|
|
12741
|
+
continue;
|
|
12742
|
+
}
|
|
12743
|
+
const from = pattern.match.importModule;
|
|
12744
|
+
missing.push(
|
|
12745
|
+
from === void 0 ? pattern.match.helperName : `${pattern.match.helperName} from ${shortModule(from, projectRoot)}`
|
|
12746
|
+
);
|
|
12747
|
+
}
|
|
12748
|
+
return missing;
|
|
12749
|
+
}
|
|
12750
|
+
function shortModule(module, projectRoot) {
|
|
12751
|
+
if (projectRoot === void 0 || !path7.isAbsolute(module)) {
|
|
12752
|
+
return module;
|
|
12753
|
+
}
|
|
12754
|
+
return path7.relative(projectRoot, module);
|
|
12755
|
+
}
|
|
12756
|
+
function buildExtractionReport(args) {
|
|
12757
|
+
const bySummary = summaryCountsByPack(args.summaries);
|
|
12758
|
+
const packFunnels = args.packs.map((pack) => {
|
|
12759
|
+
const gates = packIsUngated(pack) ? [] : collectPackGates(pack);
|
|
12760
|
+
const tally = args.tallies.get(pack.name) ?? emptyTally();
|
|
12761
|
+
const counted = bySummary.get(pack.name) ?? {
|
|
12762
|
+
bound: 0,
|
|
12763
|
+
providers: 0,
|
|
12764
|
+
withBehavior: 0
|
|
12765
|
+
};
|
|
12766
|
+
return {
|
|
12767
|
+
pack: pack.name,
|
|
12768
|
+
version: pack.version ?? null,
|
|
12769
|
+
discovers: pack.discovery.length > 0 || pack.discoverUnits !== void 0,
|
|
12770
|
+
recognizes: (pack.invocationRecognizers?.length ?? 0) > 0 || (pack.accessRecognizers?.length ?? 0) > 0,
|
|
12771
|
+
gates,
|
|
12772
|
+
unresolvedGates: unresolvedGatesFor(gates, {
|
|
12773
|
+
tsConfigFilePath: args.tsConfigFilePath,
|
|
12774
|
+
projectRoot: args.projectRoot
|
|
12775
|
+
}),
|
|
12776
|
+
candidateFiles: tally.candidateFiles,
|
|
12777
|
+
unitsDiscovered: tally.unitsDiscovered,
|
|
12778
|
+
unitsInGatedFiles: tally.unitsInGatedFiles,
|
|
12779
|
+
effectsRecognized: tally.effectsRecognized,
|
|
12780
|
+
unitsClaimed: tally.unitsClaimed,
|
|
12781
|
+
summariesProduced: tally.summariesProduced,
|
|
12782
|
+
failures: tally.failures,
|
|
12783
|
+
helpersUnmatched: helpersWithNoCall(
|
|
12784
|
+
[...pack.discovery, ...args.contributedPatterns?.(pack.name) ?? []],
|
|
12785
|
+
tally.helpersMatched,
|
|
12786
|
+
args.projectRoot
|
|
12787
|
+
),
|
|
12788
|
+
summariesBound: counted.bound,
|
|
12789
|
+
providerSummaries: counted.providers,
|
|
12790
|
+
summariesWithBehavior: counted.withBehavior,
|
|
12791
|
+
declarations: pack.declarations ?? null
|
|
12792
|
+
};
|
|
12793
|
+
});
|
|
12794
|
+
return {
|
|
12795
|
+
filesInProject: args.filesInProject,
|
|
12796
|
+
filesWalked: args.filesWalked,
|
|
12797
|
+
packs: packFunnels,
|
|
12798
|
+
summaries: args.summaries.length,
|
|
12799
|
+
filesWithUnreadableExports: [...args.filesWithUnreadableExports ?? []],
|
|
12800
|
+
reassignedNamesUnstated: args.reassignedNamesUnstated ?? 0,
|
|
12801
|
+
emptyStage: args.summaries.length === 0 ? firstEmptyStage(packFunnels, args) : null
|
|
12802
|
+
};
|
|
12803
|
+
}
|
|
12804
|
+
function firstEmptyStage(packs, args) {
|
|
12805
|
+
if (args.filesInProject === 0) {
|
|
12806
|
+
return "tsconfig";
|
|
12807
|
+
}
|
|
12808
|
+
const gateFailed = packs.some(
|
|
12809
|
+
(p) => p.unresolvedGates.length > 0 && p.candidateFiles > 0
|
|
12810
|
+
);
|
|
12811
|
+
if (gateFailed) {
|
|
12812
|
+
return "gateResolution";
|
|
12813
|
+
}
|
|
12814
|
+
if (args.filesWalked === 0 || packs.every((p) => p.candidateFiles === 0)) {
|
|
12815
|
+
return "candidateFiles";
|
|
12816
|
+
}
|
|
12817
|
+
if (packs.every((p) => p.unitsDiscovered === 0)) {
|
|
12818
|
+
return "discovery";
|
|
12819
|
+
}
|
|
12820
|
+
return "assembly";
|
|
12821
|
+
}
|
|
12822
|
+
|
|
12841
12823
|
// src/discovery/filenameRoute.ts
|
|
12842
12824
|
function routePathFromFile(filePath, convention) {
|
|
12843
12825
|
const belowRoot = segmentsBelowRoot(filePath, convention.root);
|
|
@@ -17079,7 +17061,7 @@ function buildCallerSummary(wrapper, callerFunc, callExpr, path15, options) {
|
|
|
17079
17061
|
return summary;
|
|
17080
17062
|
}
|
|
17081
17063
|
function named(summaries, workspace, runRoot) {
|
|
17082
|
-
const projectRoot = runRoot ??
|
|
17064
|
+
const projectRoot = runRoot ?? commonDirectoryOf2(summaries.map((s) => s.location.file));
|
|
17083
17065
|
nameSummaries(summaries, {
|
|
17084
17066
|
workspace: workspace ?? workspaceNameFor(projectRoot),
|
|
17085
17067
|
projectRoot
|
|
@@ -17516,7 +17498,7 @@ function createTypeScriptAdapter(suppliedConfig) {
|
|
|
17516
17498
|
filesWalked: walkList.length,
|
|
17517
17499
|
summaries: composed,
|
|
17518
17500
|
tsConfigFilePath: config.tsConfigFilePath,
|
|
17519
|
-
projectRoot:
|
|
17501
|
+
projectRoot: commonDirectoryOf2(
|
|
17520
17502
|
sourceFiles.map((f) => f.getFilePath())
|
|
17521
17503
|
),
|
|
17522
17504
|
filesWithUnreadableExports: unreadableExportFiles(),
|
|
@@ -17528,7 +17510,7 @@ function createTypeScriptAdapter(suppliedConfig) {
|
|
|
17528
17510
|
return named(
|
|
17529
17511
|
composed,
|
|
17530
17512
|
config.workspace,
|
|
17531
|
-
runRoot ??
|
|
17513
|
+
runRoot ?? commonDirectoryOf2(sourceFiles.map((f) => f.getFilePath()))
|
|
17532
17514
|
);
|
|
17533
17515
|
}
|
|
17534
17516
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suss/adapter-typescript",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
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.
|
|
52
|
-
"@suss/datalog": "0.
|
|
53
|
-
"@suss/extractor": "0.
|
|
54
|
-
"@suss/resolution": "0.
|
|
55
|
-
"@suss/values": "0.
|
|
51
|
+
"@suss/behavioral-ir": "0.26.0",
|
|
52
|
+
"@suss/datalog": "0.26.0",
|
|
53
|
+
"@suss/extractor": "0.26.0",
|
|
54
|
+
"@suss/resolution": "0.26.0",
|
|
55
|
+
"@suss/values": "0.26.0",
|
|
56
56
|
"graphql": "^16.8.0",
|
|
57
57
|
"picomatch": "^4.0.4",
|
|
58
58
|
"ts-morph": "^23.0.0",
|