@suss/adapter-typescript 0.3.0 → 0.3.1
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 +30 -22
- package/dist/index.js +30 -22
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -2503,8 +2503,8 @@ function namedOnce(type, ctx) {
|
|
|
2503
2503
|
if (table === null) {
|
|
2504
2504
|
return null;
|
|
2505
2505
|
}
|
|
2506
|
-
const
|
|
2507
|
-
if (
|
|
2506
|
+
const named2 = refFromType(type, ctx);
|
|
2507
|
+
if (named2.type !== "ref") {
|
|
2508
2508
|
return null;
|
|
2509
2509
|
}
|
|
2510
2510
|
const symbol2 = type.getAliasSymbol() ?? type.getSymbol();
|
|
@@ -2512,8 +2512,8 @@ function namedOnce(type, ctx) {
|
|
|
2512
2512
|
if (name === void 0 || name === "__type" || name === "__object") {
|
|
2513
2513
|
return null;
|
|
2514
2514
|
}
|
|
2515
|
-
const key = definitionKeyFor(type,
|
|
2516
|
-
const filed = { ...
|
|
2515
|
+
const key = definitionKeyFor(type, named2.name);
|
|
2516
|
+
const filed = { ...named2, def: key };
|
|
2517
2517
|
if (!table.has(key)) {
|
|
2518
2518
|
table.reserve(key);
|
|
2519
2519
|
const expanded = objectToShape(type, {
|
|
@@ -3867,8 +3867,8 @@ function importedFromAny(callee, modules) {
|
|
|
3867
3867
|
if (!matches) {
|
|
3868
3868
|
continue;
|
|
3869
3869
|
}
|
|
3870
|
-
for (const
|
|
3871
|
-
if ((
|
|
3870
|
+
for (const named2 of declaration.getNamedImports()) {
|
|
3871
|
+
if ((named2.getAliasNode() ?? named2.getNameNode()).getText() === name) {
|
|
3872
3872
|
return true;
|
|
3873
3873
|
}
|
|
3874
3874
|
}
|
|
@@ -5752,8 +5752,8 @@ function discoverDecoratedMethods(sourceFile, match, kind, resolution) {
|
|
|
5752
5752
|
if (!acceptedModules.includes(importDecl.getModuleSpecifierValue())) {
|
|
5753
5753
|
continue;
|
|
5754
5754
|
}
|
|
5755
|
-
for (const
|
|
5756
|
-
const local =
|
|
5755
|
+
for (const named2 of importDecl.getNamedImports()) {
|
|
5756
|
+
const local = named2.getAliasNode()?.getText() ?? named2.getName();
|
|
5757
5757
|
if (match.methodDecorators.includes(local)) {
|
|
5758
5758
|
methodDecoratorsFromFramework.add(local);
|
|
5759
5759
|
}
|
|
@@ -5832,8 +5832,8 @@ function discoverDecoratedRoutes(sourceFile, match, kind, resolution) {
|
|
|
5832
5832
|
if (!acceptedModules.includes(importDecl.getModuleSpecifierValue())) {
|
|
5833
5833
|
continue;
|
|
5834
5834
|
}
|
|
5835
|
-
for (const
|
|
5836
|
-
const local =
|
|
5835
|
+
for (const named2 of importDecl.getNamedImports()) {
|
|
5836
|
+
const local = named2.getAliasNode()?.getText() ?? named2.getName();
|
|
5837
5837
|
if (routeDecoratorNames.includes(local)) {
|
|
5838
5838
|
importedRouteDecorators.add(local);
|
|
5839
5839
|
}
|
|
@@ -6497,13 +6497,13 @@ function discoverGraphqlHookCalls(sourceFile, match, kind, resolution) {
|
|
|
6497
6497
|
if (importDecl.getModuleSpecifierValue() !== match.importModule) {
|
|
6498
6498
|
continue;
|
|
6499
6499
|
}
|
|
6500
|
-
for (const
|
|
6501
|
-
const canonical =
|
|
6500
|
+
for (const named2 of importDecl.getNamedImports()) {
|
|
6501
|
+
const canonical = named2.getName();
|
|
6502
6502
|
const operationType = operationTypeByHook.get(canonical);
|
|
6503
6503
|
if (operationType === void 0) {
|
|
6504
6504
|
continue;
|
|
6505
6505
|
}
|
|
6506
|
-
const local =
|
|
6506
|
+
const local = named2.getAliasNode()?.getText() ?? canonical;
|
|
6507
6507
|
hookByLocal.set(local, { canonical, operationType });
|
|
6508
6508
|
}
|
|
6509
6509
|
}
|
|
@@ -6560,9 +6560,9 @@ function resolveImportedLocalName(sourceFile, importModule, importName) {
|
|
|
6560
6560
|
if (importDecl.getModuleSpecifierValue() !== importModule) {
|
|
6561
6561
|
continue;
|
|
6562
6562
|
}
|
|
6563
|
-
for (const
|
|
6564
|
-
if (
|
|
6565
|
-
return
|
|
6563
|
+
for (const named2 of importDecl.getNamedImports()) {
|
|
6564
|
+
if (named2.getName() === importName || named2.getAliasNode()?.getText() === importName) {
|
|
6565
|
+
return named2.getAliasNode()?.getText() ?? named2.getName();
|
|
6566
6566
|
}
|
|
6567
6567
|
}
|
|
6568
6568
|
const defaultImport = importDecl.getDefaultImport();
|
|
@@ -7278,8 +7278,8 @@ function importOriginsOf(callee) {
|
|
|
7278
7278
|
origins.add(packagePartOf(specifier));
|
|
7279
7279
|
}
|
|
7280
7280
|
}
|
|
7281
|
-
const
|
|
7282
|
-
for (const candidate of [
|
|
7281
|
+
const named2 = import_ts_morph39.Node.isPropertyAccessExpression(callee) ? callee.getNameNode().getSymbol() : void 0;
|
|
7282
|
+
for (const candidate of [named2 ?? symbol2, symbol2]) {
|
|
7283
7283
|
const aliased = candidate.getAliasedSymbol() ?? candidate;
|
|
7284
7284
|
for (const declaration of aliased.getDeclarations()) {
|
|
7285
7285
|
if (!declaresAValue(declaration)) {
|
|
@@ -7700,9 +7700,9 @@ function extractModuleFacts(db, sourceFile) {
|
|
|
7700
7700
|
fact(db, "reExportsAll", filePath, moduleKey);
|
|
7701
7701
|
continue;
|
|
7702
7702
|
}
|
|
7703
|
-
for (const
|
|
7704
|
-
const exportedName =
|
|
7705
|
-
fact(db, "reExports", filePath, exportedName, moduleKey,
|
|
7703
|
+
for (const named2 of exportDecl.getNamedExports()) {
|
|
7704
|
+
const exportedName = named2.getAliasNode()?.getText() ?? named2.getName();
|
|
7705
|
+
fact(db, "reExports", filePath, exportedName, moduleKey, named2.getName());
|
|
7706
7706
|
}
|
|
7707
7707
|
}
|
|
7708
7708
|
}
|
|
@@ -25511,6 +25511,14 @@ function buildCallerSummary(wrapper, callerFunc, callExpr, path10, options) {
|
|
|
25511
25511
|
summary.confidence = { source: "inferred_static", level: "low" };
|
|
25512
25512
|
return summary;
|
|
25513
25513
|
}
|
|
25514
|
+
function named(summaries, workspace) {
|
|
25515
|
+
const projectRoot = commonDirectoryOf(summaries.map((s) => s.location.file));
|
|
25516
|
+
nameSummaries(summaries, {
|
|
25517
|
+
workspace: workspace ?? workspaceNameFor(projectRoot),
|
|
25518
|
+
projectRoot
|
|
25519
|
+
});
|
|
25520
|
+
return summaries;
|
|
25521
|
+
}
|
|
25514
25522
|
var saidWhyNoCache = false;
|
|
25515
25523
|
function declineWhenRunFromSource(cacheDir) {
|
|
25516
25524
|
if (cacheDir === null || adapterCodeStamp().kind === "bundle") {
|
|
@@ -25603,7 +25611,7 @@ function createTypeScriptAdapter(config2) {
|
|
|
25603
25611
|
if (config2.onTiming !== void 0) {
|
|
25604
25612
|
config2.onTiming(timer.report());
|
|
25605
25613
|
}
|
|
25606
|
-
return lookup.summaries;
|
|
25614
|
+
return named(lookup.summaries, config2.workspace);
|
|
25607
25615
|
}
|
|
25608
25616
|
if (lazyEligible) {
|
|
25609
25617
|
const lazy2 = await timer.timeAsync(
|
package/dist/index.js
CHANGED
|
@@ -2473,8 +2473,8 @@ function namedOnce(type, ctx) {
|
|
|
2473
2473
|
if (table === null) {
|
|
2474
2474
|
return null;
|
|
2475
2475
|
}
|
|
2476
|
-
const
|
|
2477
|
-
if (
|
|
2476
|
+
const named2 = refFromType(type, ctx);
|
|
2477
|
+
if (named2.type !== "ref") {
|
|
2478
2478
|
return null;
|
|
2479
2479
|
}
|
|
2480
2480
|
const symbol2 = type.getAliasSymbol() ?? type.getSymbol();
|
|
@@ -2482,8 +2482,8 @@ function namedOnce(type, ctx) {
|
|
|
2482
2482
|
if (name === void 0 || name === "__type" || name === "__object") {
|
|
2483
2483
|
return null;
|
|
2484
2484
|
}
|
|
2485
|
-
const key = definitionKeyFor(type,
|
|
2486
|
-
const filed = { ...
|
|
2485
|
+
const key = definitionKeyFor(type, named2.name);
|
|
2486
|
+
const filed = { ...named2, def: key };
|
|
2487
2487
|
if (!table.has(key)) {
|
|
2488
2488
|
table.reserve(key);
|
|
2489
2489
|
const expanded = objectToShape(type, {
|
|
@@ -3839,8 +3839,8 @@ function importedFromAny(callee, modules) {
|
|
|
3839
3839
|
if (!matches) {
|
|
3840
3840
|
continue;
|
|
3841
3841
|
}
|
|
3842
|
-
for (const
|
|
3843
|
-
if ((
|
|
3842
|
+
for (const named2 of declaration.getNamedImports()) {
|
|
3843
|
+
if ((named2.getAliasNode() ?? named2.getNameNode()).getText() === name) {
|
|
3844
3844
|
return true;
|
|
3845
3845
|
}
|
|
3846
3846
|
}
|
|
@@ -5724,8 +5724,8 @@ function discoverDecoratedMethods(sourceFile, match, kind, resolution) {
|
|
|
5724
5724
|
if (!acceptedModules.includes(importDecl.getModuleSpecifierValue())) {
|
|
5725
5725
|
continue;
|
|
5726
5726
|
}
|
|
5727
|
-
for (const
|
|
5728
|
-
const local =
|
|
5727
|
+
for (const named2 of importDecl.getNamedImports()) {
|
|
5728
|
+
const local = named2.getAliasNode()?.getText() ?? named2.getName();
|
|
5729
5729
|
if (match.methodDecorators.includes(local)) {
|
|
5730
5730
|
methodDecoratorsFromFramework.add(local);
|
|
5731
5731
|
}
|
|
@@ -5804,8 +5804,8 @@ function discoverDecoratedRoutes(sourceFile, match, kind, resolution) {
|
|
|
5804
5804
|
if (!acceptedModules.includes(importDecl.getModuleSpecifierValue())) {
|
|
5805
5805
|
continue;
|
|
5806
5806
|
}
|
|
5807
|
-
for (const
|
|
5808
|
-
const local =
|
|
5807
|
+
for (const named2 of importDecl.getNamedImports()) {
|
|
5808
|
+
const local = named2.getAliasNode()?.getText() ?? named2.getName();
|
|
5809
5809
|
if (routeDecoratorNames.includes(local)) {
|
|
5810
5810
|
importedRouteDecorators.add(local);
|
|
5811
5811
|
}
|
|
@@ -6475,13 +6475,13 @@ function discoverGraphqlHookCalls(sourceFile, match, kind, resolution) {
|
|
|
6475
6475
|
if (importDecl.getModuleSpecifierValue() !== match.importModule) {
|
|
6476
6476
|
continue;
|
|
6477
6477
|
}
|
|
6478
|
-
for (const
|
|
6479
|
-
const canonical =
|
|
6478
|
+
for (const named2 of importDecl.getNamedImports()) {
|
|
6479
|
+
const canonical = named2.getName();
|
|
6480
6480
|
const operationType = operationTypeByHook.get(canonical);
|
|
6481
6481
|
if (operationType === void 0) {
|
|
6482
6482
|
continue;
|
|
6483
6483
|
}
|
|
6484
|
-
const local =
|
|
6484
|
+
const local = named2.getAliasNode()?.getText() ?? canonical;
|
|
6485
6485
|
hookByLocal.set(local, { canonical, operationType });
|
|
6486
6486
|
}
|
|
6487
6487
|
}
|
|
@@ -6538,9 +6538,9 @@ function resolveImportedLocalName(sourceFile, importModule, importName) {
|
|
|
6538
6538
|
if (importDecl.getModuleSpecifierValue() !== importModule) {
|
|
6539
6539
|
continue;
|
|
6540
6540
|
}
|
|
6541
|
-
for (const
|
|
6542
|
-
if (
|
|
6543
|
-
return
|
|
6541
|
+
for (const named2 of importDecl.getNamedImports()) {
|
|
6542
|
+
if (named2.getName() === importName || named2.getAliasNode()?.getText() === importName) {
|
|
6543
|
+
return named2.getAliasNode()?.getText() ?? named2.getName();
|
|
6544
6544
|
}
|
|
6545
6545
|
}
|
|
6546
6546
|
const defaultImport = importDecl.getDefaultImport();
|
|
@@ -7259,8 +7259,8 @@ function importOriginsOf(callee) {
|
|
|
7259
7259
|
origins.add(packagePartOf(specifier));
|
|
7260
7260
|
}
|
|
7261
7261
|
}
|
|
7262
|
-
const
|
|
7263
|
-
for (const candidate of [
|
|
7262
|
+
const named2 = Node37.isPropertyAccessExpression(callee) ? callee.getNameNode().getSymbol() : void 0;
|
|
7263
|
+
for (const candidate of [named2 ?? symbol2, symbol2]) {
|
|
7264
7264
|
const aliased = candidate.getAliasedSymbol() ?? candidate;
|
|
7265
7265
|
for (const declaration of aliased.getDeclarations()) {
|
|
7266
7266
|
if (!declaresAValue(declaration)) {
|
|
@@ -7681,9 +7681,9 @@ function extractModuleFacts(db, sourceFile) {
|
|
|
7681
7681
|
fact(db, "reExportsAll", filePath, moduleKey);
|
|
7682
7682
|
continue;
|
|
7683
7683
|
}
|
|
7684
|
-
for (const
|
|
7685
|
-
const exportedName =
|
|
7686
|
-
fact(db, "reExports", filePath, exportedName, moduleKey,
|
|
7684
|
+
for (const named2 of exportDecl.getNamedExports()) {
|
|
7685
|
+
const exportedName = named2.getAliasNode()?.getText() ?? named2.getName();
|
|
7686
|
+
fact(db, "reExports", filePath, exportedName, moduleKey, named2.getName());
|
|
7687
7687
|
}
|
|
7688
7688
|
}
|
|
7689
7689
|
}
|
|
@@ -25510,6 +25510,14 @@ function buildCallerSummary(wrapper, callerFunc, callExpr, path10, options) {
|
|
|
25510
25510
|
summary.confidence = { source: "inferred_static", level: "low" };
|
|
25511
25511
|
return summary;
|
|
25512
25512
|
}
|
|
25513
|
+
function named(summaries, workspace) {
|
|
25514
|
+
const projectRoot = commonDirectoryOf(summaries.map((s) => s.location.file));
|
|
25515
|
+
nameSummaries(summaries, {
|
|
25516
|
+
workspace: workspace ?? workspaceNameFor(projectRoot),
|
|
25517
|
+
projectRoot
|
|
25518
|
+
});
|
|
25519
|
+
return summaries;
|
|
25520
|
+
}
|
|
25513
25521
|
var saidWhyNoCache = false;
|
|
25514
25522
|
function declineWhenRunFromSource(cacheDir) {
|
|
25515
25523
|
if (cacheDir === null || adapterCodeStamp().kind === "bundle") {
|
|
@@ -25602,7 +25610,7 @@ function createTypeScriptAdapter(config2) {
|
|
|
25602
25610
|
if (config2.onTiming !== void 0) {
|
|
25603
25611
|
config2.onTiming(timer.report());
|
|
25604
25612
|
}
|
|
25605
|
-
return lookup.summaries;
|
|
25613
|
+
return named(lookup.summaries, config2.workspace);
|
|
25606
25614
|
}
|
|
25607
25615
|
if (lazyEligible) {
|
|
25608
25616
|
const lazy2 = await timer.timeAsync(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suss/adapter-typescript",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "TypeScript adapter for suss — walks source files with ts-morph and emits raw extractions for the suss pipeline.",
|
|
6
6
|
"keywords": [
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"typecheck": "tsc --noEmit"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@suss/behavioral-ir": "0.3.
|
|
50
|
-
"@suss/datalog": "0.3.
|
|
51
|
-
"@suss/extractor": "0.3.
|
|
52
|
-
"@suss/resolution": "0.3.
|
|
49
|
+
"@suss/behavioral-ir": "0.3.1",
|
|
50
|
+
"@suss/datalog": "0.3.1",
|
|
51
|
+
"@suss/extractor": "0.3.1",
|
|
52
|
+
"@suss/resolution": "0.3.1",
|
|
53
53
|
"graphql": "^16.8.0",
|
|
54
54
|
"picomatch": "^4.0.4",
|
|
55
55
|
"ts-morph": "^23.0.0"
|