scip-query 0.4.3 → 0.6.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/chunk-2DSS2NGF.js +10 -0
- package/dist/chunk-2RLP74AO.js +2 -0
- package/dist/chunk-4QJ7LVW5.js +2 -0
- package/dist/chunk-4TYGGOLO.js +5 -0
- package/dist/chunk-5IADAU5B.js +7 -0
- package/dist/chunk-7754WFFV.js +18 -0
- package/dist/chunk-7VOF4ZG6.js +2 -0
- package/dist/chunk-7Z4COVMC.js +2 -0
- package/dist/chunk-AJ5PWKD4.js +2 -0
- package/dist/chunk-BDBRZPX3.js +7 -0
- package/dist/chunk-BE6EQIWY.js +2 -0
- package/dist/chunk-BQ3INTYT.js +8 -0
- package/dist/chunk-D7KLLMPB.js +2 -0
- package/dist/chunk-D7YBWSON.js +29 -0
- package/dist/chunk-DE5ZBHMK.js +39 -0
- package/dist/chunk-DHYIJHXZ.js +33 -0
- package/dist/chunk-EEF3YEHW.js +2 -0
- package/dist/chunk-F2LLHRRZ.js +2 -0
- package/dist/chunk-FCC3XJTI.js +2 -0
- package/dist/chunk-GNXRLK5G.js +2 -0
- package/dist/chunk-GXVB36TG.js +62 -0
- package/dist/chunk-HMKJTAZD.js +2 -0
- package/dist/chunk-IBGBI3VU.js +2 -0
- package/dist/chunk-IYFZS4PV.js +84 -0
- package/dist/chunk-JH3A7HTU.js +2 -0
- package/dist/chunk-JS2RNIC7.js +2 -0
- package/dist/chunk-K5FQFCSN.js +41 -0
- package/dist/chunk-K6GBKEQE.js +6 -0
- package/dist/chunk-KO7YJRWP.js +12 -0
- package/dist/chunk-KYT47WU2.js +4 -0
- package/dist/chunk-LORWXBOO.js +2 -0
- package/dist/chunk-LX4H4LLG.js +89 -0
- package/dist/chunk-N3Z2SJCR.js +2 -0
- package/dist/chunk-NTDA4A2D.js +25 -0
- package/dist/chunk-NXMYYHDO.js +24 -0
- package/dist/chunk-PZ6ESKRH.js +7 -0
- package/dist/chunk-QXE6EDY2.js +6 -0
- package/dist/chunk-RJ7SPBJ5.js +5 -0
- package/dist/chunk-RWE6FHG3.js +3 -0
- package/dist/chunk-SDX6MDBL.js +2 -0
- package/dist/chunk-SG35Y7J2.js +2 -0
- package/dist/chunk-STOGKRJH.js +4 -0
- package/dist/chunk-TINPMWJK.js +2 -0
- package/dist/chunk-UJB62HV3.js +2 -0
- package/dist/chunk-VEUMRDHW.js +2 -0
- package/dist/chunk-WCDXJGYT.js +65 -0
- package/dist/chunk-WTSTDJZ7.js +6 -0
- package/dist/chunk-XAZTIDST.js +2 -0
- package/dist/chunk-XVDASCN7.js +35 -0
- package/dist/chunk-Y7H6D2EV.js +2 -0
- package/dist/chunk-Y7LOQSWY.js +2 -0
- package/dist/chunk-YIPCV7M7.js +70 -0
- package/dist/chunk-ZSRXMNMK.js +5 -0
- package/dist/chunk-ZXKURFVB.js +56 -0
- package/dist/cli.js +509 -8938
- package/dist/{db-6F9R9e_t.d.ts → db-BSTtBG_H.d.ts} +146 -1
- package/dist/index.d.ts +11 -2
- package/dist/index.js +13 -1616
- package/dist/postinstall.js +4 -100
- package/dist/queries/affected.d.ts +1 -1
- package/dist/queries/affected.js +1 -8
- package/dist/queries/bottlenecks.d.ts +1 -1
- package/dist/queries/bottlenecks.js +1 -8
- package/dist/queries/by-kind.d.ts +1 -4
- package/dist/queries/by-kind.js +1 -10
- package/dist/queries/call-graph.d.ts +1 -1
- package/dist/queries/call-graph.js +1 -8
- package/dist/queries/change-surface.d.ts +4 -1
- package/dist/queries/change-surface.js +1 -8
- package/dist/queries/code.d.ts +1 -1
- package/dist/queries/code.js +1 -8
- package/dist/queries/complexity-hotspots.d.ts +5 -3
- package/dist/queries/complexity-hotspots.js +1 -8
- package/dist/queries/complexity.d.ts +1 -1
- package/dist/queries/complexity.js +1 -8
- package/dist/queries/convergence.d.ts +1 -1
- package/dist/queries/convergence.js +1 -8
- package/dist/queries/coupling.d.ts +1 -1
- package/dist/queries/coupling.js +1 -10
- package/dist/queries/cycles.d.ts +1 -1
- package/dist/queries/cycles.js +1 -8
- package/dist/queries/dataflow.d.ts +1 -1
- package/dist/queries/dataflow.js +1 -8
- package/dist/queries/dead.d.ts +1 -1
- package/dist/queries/dead.js +1 -9
- package/dist/queries/deep-chains.d.ts +9 -1
- package/dist/queries/deep-chains.js +1 -8
- package/dist/queries/deps.d.ts +1 -1
- package/dist/queries/deps.js +1 -10
- package/dist/queries/diff-impact.d.ts +1 -1
- package/dist/queries/diff-impact.js +1 -7
- package/dist/queries/drift.d.ts +1 -1
- package/dist/queries/drift.js +1 -8
- package/dist/queries/extract-candidates.d.ts +1 -1
- package/dist/queries/extract-candidates.js +1 -8
- package/dist/queries/fan.d.ts +1 -1
- package/dist/queries/fan.js +1 -14
- package/dist/queries/files.d.ts +1 -1
- package/dist/queries/files.js +1 -6
- package/dist/queries/health.d.ts +1 -1
- package/dist/queries/health.js +1 -20
- package/dist/queries/hierarchy.d.ts +1 -1
- package/dist/queries/hierarchy.js +1 -8
- package/dist/queries/hotspots.d.ts +1 -1
- package/dist/queries/hotspots.js +1 -8
- package/dist/queries/imports.d.ts +1 -1
- package/dist/queries/imports.js +1 -12
- package/dist/queries/index.d.ts +1 -1
- package/dist/queries/index.js +1 -197
- package/dist/queries/isolated.d.ts +1 -1
- package/dist/queries/isolated.js +1 -9
- package/dist/queries/members.d.ts +4 -1
- package/dist/queries/members.js +1 -8
- package/dist/queries/methods.d.ts +1 -1
- package/dist/queries/methods.js +1 -8
- package/dist/queries/outline.d.ts +4 -1
- package/dist/queries/outline.js +1 -8
- package/dist/queries/passthrough-candidates.d.ts +1 -1
- package/dist/queries/passthrough-candidates.js +1 -8
- package/dist/queries/redundant-reexports.d.ts +1 -1
- package/dist/queries/redundant-reexports.js +1 -9
- package/dist/queries/refs.d.ts +1 -1
- package/dist/queries/refs.js +1 -8
- package/dist/queries/similar-chains.d.ts +1 -1
- package/dist/queries/similar-chains.js +1 -8
- package/dist/queries/similar-files.d.ts +1 -1
- package/dist/queries/similar-files.js +1 -8
- package/dist/queries/similar-signatures.d.ts +1 -1
- package/dist/queries/similar-signatures.js +1 -8
- package/dist/queries/similar.d.ts +1 -1
- package/dist/queries/similar.js +1 -10
- package/dist/queries/slice.d.ts +1 -1
- package/dist/queries/slice.js +1 -8
- package/dist/queries/stale-abstractions.d.ts +15 -5
- package/dist/queries/stale-abstractions.js +1 -8
- package/dist/queries/stats.d.ts +1 -1
- package/dist/queries/stats.js +1 -6
- package/dist/queries/surface.d.ts +1 -1
- package/dist/queries/surface.js +1 -8
- package/dist/queries/symbols.d.ts +1 -1
- package/dist/queries/symbols.js +1 -9
- package/dist/queries/system.d.ts +6 -2
- package/dist/queries/system.js +1 -9
- package/dist/queries/trace.d.ts +1 -1
- package/dist/queries/trace.js +1 -9
- package/dist/queries/wrapper-candidates.d.ts +1 -1
- package/dist/queries/wrapper-candidates.js +1 -8
- package/dist/reindex-worker.js +7 -672
- package/package.json +20 -2
- package/dist/chunk-334PCFO3.js +0 -221
- package/dist/chunk-46ZTW4AI.js +0 -61
- package/dist/chunk-4TYLS5XX.js +0 -10
- package/dist/chunk-4YN3PE57.js +0 -124
- package/dist/chunk-5YB6UXQ3.js +0 -101
- package/dist/chunk-6PVHJ332.js +0 -44
- package/dist/chunk-74RFWB5T.js +0 -24
- package/dist/chunk-7KGTWDAX.js +0 -87
- package/dist/chunk-7OGXSMLY.js +0 -105
- package/dist/chunk-AEBM56CO.js +0 -69
- package/dist/chunk-B747RITP.js +0 -38
- package/dist/chunk-B7LDMCUS.js +0 -110
- package/dist/chunk-C2VSV54P.js +0 -110
- package/dist/chunk-DIYEUFVP.js +0 -81
- package/dist/chunk-E74RY6AQ.js +0 -93
- package/dist/chunk-FIMTTUGE.js +0 -165
- package/dist/chunk-FMAYH7GS.js +0 -2542
- package/dist/chunk-FO2CBB7U.js +0 -23
- package/dist/chunk-HESWGDIV.js +0 -162
- package/dist/chunk-HL2LXSBW.js +0 -34
- package/dist/chunk-HW76DVE4.js +0 -216
- package/dist/chunk-IC5NTO47.js +0 -53
- package/dist/chunk-J34HAAEQ.js +0 -59
- package/dist/chunk-JSXGC2EH.js +0 -151
- package/dist/chunk-LQXBFCP2.js +0 -87
- package/dist/chunk-NML6M5AS.js +0 -37
- package/dist/chunk-NNFP4ZRF.js +0 -72
- package/dist/chunk-NWXTQGUE.js +0 -49
- package/dist/chunk-NYZ6INK3.js +0 -95
- package/dist/chunk-OMVF3BHY.js +0 -84
- package/dist/chunk-P3VCDYMJ.js +0 -269
- package/dist/chunk-PGQXIAJF.js +0 -79
- package/dist/chunk-PKDFXASW.js +0 -76
- package/dist/chunk-PSK5BPFE.js +0 -82
- package/dist/chunk-QZ4FRB65.js +0 -341
- package/dist/chunk-R2QBMQQN.js +0 -185
- package/dist/chunk-T3ALCNCP.js +0 -113
- package/dist/chunk-T6UVM534.js +0 -213
- package/dist/chunk-U74VYTLX.js +0 -46
- package/dist/chunk-UIRCHPOU.js +0 -34
- package/dist/chunk-UNS6ZQVX.js +0 -71
- package/dist/chunk-VJMTX3OR.js +0 -115
- package/dist/chunk-XJSPWHNT.js +0 -64
- package/dist/chunk-XMZAC2VU.js +0 -84
- package/dist/chunk-Y7FKURZG.js +0 -130
- package/dist/chunk-YMSJCSRG.js +0 -213
- package/dist/chunk-YQIWS5V6.js +0 -172
- package/dist/chunk-ZPEI7DRJ.js +0 -66
- package/dist/queries/clean-signature.d.ts +0 -9
- package/dist/queries/clean-signature.js +0 -7
package/dist/chunk-R2QBMQQN.js
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isLiveBarrel
|
|
3
|
-
} from "./chunk-OMVF3BHY.js";
|
|
4
|
-
import {
|
|
5
|
-
getDefinitionsForFile,
|
|
6
|
-
getSourceExports,
|
|
7
|
-
getSourceImports
|
|
8
|
-
} from "./chunk-FMAYH7GS.js";
|
|
9
|
-
import {
|
|
10
|
-
leafSuffix,
|
|
11
|
-
shortenSymbol
|
|
12
|
-
} from "./chunk-YMSJCSRG.js";
|
|
13
|
-
|
|
14
|
-
// src/queries/redundant-reexports.ts
|
|
15
|
-
function redundantReexports(db, opts = {}) {
|
|
16
|
-
const { scope, limit } = opts;
|
|
17
|
-
const scopeFilter = scope ? `AND barrel_d.relative_path LIKE '%${scope}%'` : "";
|
|
18
|
-
const reexportRows = db.all(
|
|
19
|
-
`SELECT DISTINCT
|
|
20
|
-
barrel_d.id AS barrel_doc_id,
|
|
21
|
-
barrel_d.relative_path AS barrel_path,
|
|
22
|
-
gs.id AS symbol_id,
|
|
23
|
-
gs.symbol AS symbol,
|
|
24
|
-
orig_d.id AS original_doc_id,
|
|
25
|
-
orig_d.relative_path AS original_path
|
|
26
|
-
FROM mentions m
|
|
27
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
28
|
-
JOIN documents barrel_d ON c.document_id = barrel_d.id
|
|
29
|
-
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
30
|
-
JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
|
|
31
|
-
JOIN documents orig_d ON der.document_id = orig_d.id
|
|
32
|
-
WHERE m.role != 1
|
|
33
|
-
AND (barrel_d.relative_path LIKE '%/index.ts'
|
|
34
|
-
OR barrel_d.relative_path LIKE '%/index.js'
|
|
35
|
-
OR barrel_d.relative_path = 'index.ts'
|
|
36
|
-
OR barrel_d.relative_path = 'index.js')
|
|
37
|
-
AND orig_d.id != barrel_d.id
|
|
38
|
-
${db.pathExclusionsFor("barrel_d", "orig_d")}
|
|
39
|
-
${db.symbolNoiseFor("gs")}
|
|
40
|
-
-- Only function-level symbols (ending with ().), not module-level
|
|
41
|
-
AND gs.symbol LIKE '%().'
|
|
42
|
-
${scopeFilter}
|
|
43
|
-
ORDER BY barrel_d.relative_path, gs.symbol`
|
|
44
|
-
);
|
|
45
|
-
const results = [];
|
|
46
|
-
for (const row of reexportRows) {
|
|
47
|
-
if (db.isIgnored(row.barrel_path) || db.isIgnored(row.original_path)) continue;
|
|
48
|
-
if (isLiveBarrel(db, row.barrel_path)) continue;
|
|
49
|
-
const consumerCounts = db.get(
|
|
50
|
-
`SELECT
|
|
51
|
-
SUM(CASE WHEN uses_barrel = 1 THEN 1 ELSE 0 END) AS barrel_consumers,
|
|
52
|
-
SUM(CASE WHEN uses_barrel = 0 THEN 1 ELSE 0 END) AS direct_consumers
|
|
53
|
-
FROM (
|
|
54
|
-
SELECT
|
|
55
|
-
consumer_d.id AS consumer_doc_id,
|
|
56
|
-
MAX(CASE WHEN EXISTS (
|
|
57
|
-
SELECT 1
|
|
58
|
-
FROM mentions barrel_m
|
|
59
|
-
JOIN chunks barrel_c ON barrel_m.chunk_id = barrel_c.id
|
|
60
|
-
WHERE barrel_c.document_id = consumer_d.id
|
|
61
|
-
AND barrel_m.role != 1
|
|
62
|
-
AND barrel_m.symbol_id IN (
|
|
63
|
-
SELECT m2.symbol_id
|
|
64
|
-
FROM mentions m2
|
|
65
|
-
JOIN chunks c2 ON m2.chunk_id = c2.id
|
|
66
|
-
WHERE c2.document_id = ?
|
|
67
|
-
AND m2.role != 1
|
|
68
|
-
)
|
|
69
|
-
) THEN 1 ELSE 0 END) AS uses_barrel
|
|
70
|
-
FROM mentions ref_m
|
|
71
|
-
JOIN chunks ref_c ON ref_m.chunk_id = ref_c.id
|
|
72
|
-
JOIN documents consumer_d ON ref_c.document_id = consumer_d.id
|
|
73
|
-
WHERE ref_m.symbol_id = ?
|
|
74
|
-
AND ref_m.role != 1
|
|
75
|
-
AND consumer_d.id != ?
|
|
76
|
-
AND consumer_d.id != ?
|
|
77
|
-
${db.pathExclusionsFor("consumer_d")}
|
|
78
|
-
GROUP BY consumer_d.id
|
|
79
|
-
)`,
|
|
80
|
-
row.barrel_doc_id,
|
|
81
|
-
// for the inner subquery checking barrel mentions
|
|
82
|
-
row.symbol_id,
|
|
83
|
-
// the re-exported symbol
|
|
84
|
-
row.barrel_doc_id,
|
|
85
|
-
// exclude the barrel itself
|
|
86
|
-
row.original_doc_id
|
|
87
|
-
// exclude the original file
|
|
88
|
-
);
|
|
89
|
-
const barrelConsumers = consumerCounts?.barrel_consumers ?? 0;
|
|
90
|
-
const directConsumers = consumerCounts?.direct_consumers ?? 0;
|
|
91
|
-
if (barrelConsumers === 0 && directConsumers === 0) {
|
|
92
|
-
results.push({
|
|
93
|
-
barrelFile: row.barrel_path,
|
|
94
|
-
symbol: row.symbol,
|
|
95
|
-
shortName: shortenSymbol(row.symbol),
|
|
96
|
-
originalFile: row.original_path,
|
|
97
|
-
barrelConsumers,
|
|
98
|
-
directConsumers
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
results.sort(
|
|
103
|
-
(a, b) => b.directConsumers - a.directConsumers || a.barrelFile.localeCompare(b.barrelFile) || a.shortName.localeCompare(b.shortName)
|
|
104
|
-
);
|
|
105
|
-
const withDartFallback = dedupeReexports([
|
|
106
|
-
...results,
|
|
107
|
-
...findSourceRedundantReexports(db, scope)
|
|
108
|
-
]);
|
|
109
|
-
withDartFallback.sort(
|
|
110
|
-
(a, b) => b.directConsumers - a.directConsumers || a.barrelFile.localeCompare(b.barrelFile) || a.shortName.localeCompare(b.shortName)
|
|
111
|
-
);
|
|
112
|
-
return limit ? withDartFallback.slice(0, limit) : withDartFallback;
|
|
113
|
-
}
|
|
114
|
-
function findSourceRedundantReexports(db, scope) {
|
|
115
|
-
const files = db.all(
|
|
116
|
-
`SELECT relative_path
|
|
117
|
-
FROM documents
|
|
118
|
-
WHERE 1 = 1
|
|
119
|
-
${scope ? "AND relative_path LIKE ?" : ""}
|
|
120
|
-
${db.pathExclusionsFor("documents")}
|
|
121
|
-
ORDER BY relative_path`,
|
|
122
|
-
...scope ? [`%${scope}%`] : []
|
|
123
|
-
);
|
|
124
|
-
const candidates = files.map((row) => row.relative_path).filter((relativePath) => !db.isIgnored(relativePath)).filter((relativePath) => getSourceExports(db, relativePath).length > 0);
|
|
125
|
-
const results = [];
|
|
126
|
-
for (const barrelPath of candidates) {
|
|
127
|
-
const exports = getSourceExports(db, barrelPath).filter((entry) => entry.sourcePath && !db.isIgnored(entry.sourcePath));
|
|
128
|
-
if (exports.length === 0) continue;
|
|
129
|
-
const barrelConsumers = countDirectImporters(db, barrelPath, barrelPath);
|
|
130
|
-
if (barrelConsumers > 0) continue;
|
|
131
|
-
for (const exported of exports) {
|
|
132
|
-
const sourcePath = exported.sourcePath;
|
|
133
|
-
const representative = representativeExportSymbol(db, sourcePath);
|
|
134
|
-
if (!representative) continue;
|
|
135
|
-
results.push({
|
|
136
|
-
barrelFile: barrelPath,
|
|
137
|
-
symbol: representative.symbol,
|
|
138
|
-
shortName: shortenSymbol(representative.symbol),
|
|
139
|
-
originalFile: sourcePath,
|
|
140
|
-
barrelConsumers: 0,
|
|
141
|
-
directConsumers: countDirectImporters(db, sourcePath, barrelPath)
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
return results;
|
|
146
|
-
}
|
|
147
|
-
function countDirectImporters(db, targetPath, excludedPath) {
|
|
148
|
-
const files = db.all(
|
|
149
|
-
`SELECT relative_path
|
|
150
|
-
FROM documents
|
|
151
|
-
WHERE 1 = 1
|
|
152
|
-
${db.pathExclusionsFor("documents")}
|
|
153
|
-
ORDER BY relative_path`
|
|
154
|
-
);
|
|
155
|
-
const importers = /* @__PURE__ */ new Set();
|
|
156
|
-
for (const row of files) {
|
|
157
|
-
if (db.isIgnored(row.relative_path) || row.relative_path === excludedPath) continue;
|
|
158
|
-
for (const imported of getSourceImports(db, row.relative_path)) {
|
|
159
|
-
if (imported.sourcePath === targetPath) {
|
|
160
|
-
importers.add(row.relative_path);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
return importers.size;
|
|
165
|
-
}
|
|
166
|
-
function representativeExportSymbol(db, sourcePath) {
|
|
167
|
-
const definitions = getDefinitionsForFile(db, sourcePath);
|
|
168
|
-
return definitions.find((definition) => leafSuffix(definition.symbol) === "method") ?? definitions[0] ?? null;
|
|
169
|
-
}
|
|
170
|
-
function dedupeReexports(rows) {
|
|
171
|
-
const seen = /* @__PURE__ */ new Set();
|
|
172
|
-
const unique = [];
|
|
173
|
-
for (const row of rows) {
|
|
174
|
-
const key = `${row.barrelFile}|${row.symbol}|${row.originalFile}`;
|
|
175
|
-
if (seen.has(key)) continue;
|
|
176
|
-
seen.add(key);
|
|
177
|
-
unique.push(row);
|
|
178
|
-
}
|
|
179
|
-
return unique;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
export {
|
|
183
|
-
redundantReexports
|
|
184
|
-
};
|
|
185
|
-
//# sourceMappingURL=chunk-R2QBMQQN.js.map
|
package/dist/chunk-T3ALCNCP.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
findExactSymbolMatch,
|
|
3
|
-
findFirstSymbolMatch,
|
|
4
|
-
getCalleeRowsForSymbol
|
|
5
|
-
} from "./chunk-FMAYH7GS.js";
|
|
6
|
-
import {
|
|
7
|
-
shortenSymbol
|
|
8
|
-
} from "./chunk-YMSJCSRG.js";
|
|
9
|
-
|
|
10
|
-
// src/queries/slice.ts
|
|
11
|
-
function slice(db, symbolPattern, opts = {}) {
|
|
12
|
-
const { direction = "backward", maxDepth = 3 } = opts;
|
|
13
|
-
const match = findFirstSymbolMatch(db, symbolPattern);
|
|
14
|
-
if (!match) return null;
|
|
15
|
-
if (direction === "backward") {
|
|
16
|
-
return backwardSlice(db, match, maxDepth);
|
|
17
|
-
} else {
|
|
18
|
-
return forwardSlice(db, match);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function backwardSlice(db, match, maxDepth) {
|
|
22
|
-
const connected = [];
|
|
23
|
-
const visited = /* @__PURE__ */ new Set([match.symbol]);
|
|
24
|
-
let frontier = [match];
|
|
25
|
-
for (let depth = 1; depth <= maxDepth; depth++) {
|
|
26
|
-
if (frontier.length === 0) break;
|
|
27
|
-
const nextFrontier = [];
|
|
28
|
-
for (const current of frontier) {
|
|
29
|
-
const callees = getCalleeRowsForSymbol(db, current);
|
|
30
|
-
for (const c of callees) {
|
|
31
|
-
if (visited.has(c.symbol)) continue;
|
|
32
|
-
visited.add(c.symbol);
|
|
33
|
-
connected.push({
|
|
34
|
-
symbol: c.symbol,
|
|
35
|
-
shortName: shortenSymbol(c.symbol),
|
|
36
|
-
file: c.file,
|
|
37
|
-
relationship: depth === 1 ? "referenced within definition (callee)" : `depth ${depth} callee`
|
|
38
|
-
});
|
|
39
|
-
const calleeMatch = findExactSymbolMatch(db, c.symbol);
|
|
40
|
-
if (calleeMatch && !db.isIgnored(calleeMatch.relativePath)) {
|
|
41
|
-
nextFrontier.push(calleeMatch);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
frontier = nextFrontier;
|
|
46
|
-
}
|
|
47
|
-
return {
|
|
48
|
-
symbol: match.symbol,
|
|
49
|
-
shortName: shortenSymbol(match.symbol),
|
|
50
|
-
direction: "backward",
|
|
51
|
-
connectedSymbols: connected
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
function forwardSlice(db, match) {
|
|
55
|
-
const rows = db.all(
|
|
56
|
-
`SELECT DISTINCT
|
|
57
|
-
enc_gs.symbol AS enclosing_symbol,
|
|
58
|
-
enc_d.relative_path AS enclosing_file,
|
|
59
|
-
out_gs.symbol AS output_symbol,
|
|
60
|
-
out_d.relative_path AS output_file
|
|
61
|
-
FROM mentions ref_m
|
|
62
|
-
JOIN chunks ref_c ON ref_m.chunk_id = ref_c.id
|
|
63
|
-
JOIN documents ref_d ON ref_c.document_id = ref_d.id
|
|
64
|
-
-- Find enclosing function at each reference site
|
|
65
|
-
JOIN defn_enclosing_ranges enc_der
|
|
66
|
-
ON enc_der.document_id = ref_d.id
|
|
67
|
-
AND enc_der.start_line <= ref_c.start_line
|
|
68
|
-
AND enc_der.end_line >= ref_c.end_line
|
|
69
|
-
JOIN global_symbols enc_gs ON enc_der.symbol_id = enc_gs.id
|
|
70
|
-
JOIN documents enc_d ON enc_der.document_id = enc_d.id
|
|
71
|
-
-- Find other symbols referenced within that enclosing function
|
|
72
|
-
JOIN mentions out_m ON out_m.role != 1
|
|
73
|
-
JOIN chunks out_c ON out_m.chunk_id = out_c.id
|
|
74
|
-
AND out_c.document_id = enc_der.document_id
|
|
75
|
-
AND out_c.start_line >= enc_der.start_line
|
|
76
|
-
AND out_c.end_line <= enc_der.end_line
|
|
77
|
-
JOIN global_symbols out_gs ON out_m.symbol_id = out_gs.id
|
|
78
|
-
JOIN defn_enclosing_ranges out_der ON out_gs.id = out_der.symbol_id
|
|
79
|
-
JOIN documents out_d ON out_der.document_id = out_d.id
|
|
80
|
-
WHERE ref_m.symbol_id = ? AND ref_m.role != 1
|
|
81
|
-
AND out_gs.id != ? AND out_gs.id != enc_gs.id
|
|
82
|
-
AND out_d.id != ref_d.id
|
|
83
|
-
${db.symbolNoiseFor("out_gs")}
|
|
84
|
-
${db.pathExclusionsFor("out_d")}
|
|
85
|
-
ORDER BY out_d.relative_path
|
|
86
|
-
LIMIT 30`,
|
|
87
|
-
match.symbolId,
|
|
88
|
-
match.symbolId
|
|
89
|
-
);
|
|
90
|
-
const seen = /* @__PURE__ */ new Set();
|
|
91
|
-
const connected = [];
|
|
92
|
-
for (const r of rows) {
|
|
93
|
-
if (seen.has(r.output_symbol) || db.isIgnored(r.output_file)) continue;
|
|
94
|
-
seen.add(r.output_symbol);
|
|
95
|
-
connected.push({
|
|
96
|
-
symbol: r.output_symbol,
|
|
97
|
-
shortName: shortenSymbol(r.output_symbol),
|
|
98
|
-
file: r.output_file,
|
|
99
|
-
relationship: `used alongside target in ${shortenSymbol(r.enclosing_symbol)}`
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
return {
|
|
103
|
-
symbol: match.symbol,
|
|
104
|
-
shortName: shortenSymbol(match.symbol),
|
|
105
|
-
direction: "forward",
|
|
106
|
-
connectedSymbols: connected
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export {
|
|
111
|
-
slice
|
|
112
|
-
};
|
|
113
|
-
//# sourceMappingURL=chunk-T3ALCNCP.js.map
|
package/dist/chunk-T6UVM534.js
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
buildFileDepGraph
|
|
3
|
-
} from "./chunk-FMAYH7GS.js";
|
|
4
|
-
|
|
5
|
-
// src/queries/similar-chains.ts
|
|
6
|
-
function similarChains(db, opts = {}) {
|
|
7
|
-
const {
|
|
8
|
-
minSimilarity = 0.5,
|
|
9
|
-
limit = 15,
|
|
10
|
-
scope,
|
|
11
|
-
minChainLength = 3,
|
|
12
|
-
maxChainLength = 8
|
|
13
|
-
} = opts;
|
|
14
|
-
const graph = buildFileDepGraph(db, scope);
|
|
15
|
-
const rawChains = generateChains(graph, minChainLength, maxChainLength);
|
|
16
|
-
if (rawChains.length === 0) return [];
|
|
17
|
-
const nodeFreq = /* @__PURE__ */ new Map();
|
|
18
|
-
const tailFreq = /* @__PURE__ */ new Map();
|
|
19
|
-
for (const chain of rawChains) {
|
|
20
|
-
const seen = /* @__PURE__ */ new Set();
|
|
21
|
-
for (const node of chain) {
|
|
22
|
-
if (!seen.has(node)) {
|
|
23
|
-
nodeFreq.set(node, (nodeFreq.get(node) ?? 0) + 1);
|
|
24
|
-
seen.add(node);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
for (let t = Math.max(0, chain.length - 2); t < chain.length; t++) {
|
|
28
|
-
tailFreq.set(chain[t], (tailFreq.get(chain[t]) ?? 0) + 1);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
const infraThreshold = rawChains.length * 0.9;
|
|
32
|
-
const tailThreshold = rawChains.length * 0.8;
|
|
33
|
-
const infraNodes = /* @__PURE__ */ new Set();
|
|
34
|
-
for (const [node, freq] of nodeFreq) {
|
|
35
|
-
if (freq > infraThreshold) infraNodes.add(node);
|
|
36
|
-
}
|
|
37
|
-
for (const [node, freq] of tailFreq) {
|
|
38
|
-
if (freq > tailThreshold) infraNodes.add(node);
|
|
39
|
-
}
|
|
40
|
-
const structuralNames = ["index.ts", "index.js", "cli.ts", "main.ts", "health.ts", "health.js"];
|
|
41
|
-
for (const node of nodeFreq.keys()) {
|
|
42
|
-
const basename = node.split("/").pop() ?? "";
|
|
43
|
-
if (structuralNames.includes(basename)) infraNodes.add(node);
|
|
44
|
-
}
|
|
45
|
-
const filteredChains = [];
|
|
46
|
-
for (const chain of rawChains) {
|
|
47
|
-
const filtered = chain.filter((n) => !infraNodes.has(n));
|
|
48
|
-
if (filtered.length >= 2) {
|
|
49
|
-
filteredChains.push({ original: chain, filtered });
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (filteredChains.length < 2) return [];
|
|
53
|
-
const results = [];
|
|
54
|
-
for (let i = 0; i < filteredChains.length; i++) {
|
|
55
|
-
for (let j = i + 1; j < filteredChains.length; j++) {
|
|
56
|
-
const a = filteredChains[i];
|
|
57
|
-
const b = filteredChains[j];
|
|
58
|
-
const setA = new Set(a.filtered);
|
|
59
|
-
let hasShared = false;
|
|
60
|
-
for (const node of b.filtered) {
|
|
61
|
-
if (setA.has(node)) {
|
|
62
|
-
hasShared = true;
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
if (!hasShared) continue;
|
|
67
|
-
const { distance, ops } = editDistance(a.filtered, b.filtered);
|
|
68
|
-
const maxLen = Math.max(a.filtered.length, b.filtered.length);
|
|
69
|
-
if (maxLen === 0) continue;
|
|
70
|
-
const similarity = 1 - distance / maxLen;
|
|
71
|
-
if (similarity < minSimilarity) continue;
|
|
72
|
-
if (distance === 0) continue;
|
|
73
|
-
const divergencePoints = ops.filter((op) => op.type === "substitute").map((op) => ({
|
|
74
|
-
index: op.indexA,
|
|
75
|
-
nodeA: a.filtered[op.indexA],
|
|
76
|
-
nodeB: b.filtered[op.indexB]
|
|
77
|
-
}));
|
|
78
|
-
if (divergencePoints.length === 0) continue;
|
|
79
|
-
const matchCount = ops.filter((op) => op.type === "match").length;
|
|
80
|
-
if (matchCount < 2) continue;
|
|
81
|
-
const commonPrefix = getCommonPrefix(a.original, b.original);
|
|
82
|
-
const commonSuffix = getCommonSuffix(a.original, b.original);
|
|
83
|
-
results.push({
|
|
84
|
-
chainA: a.original,
|
|
85
|
-
chainB: b.original,
|
|
86
|
-
similarity,
|
|
87
|
-
editDistance: distance,
|
|
88
|
-
divergencePoints,
|
|
89
|
-
commonPrefix,
|
|
90
|
-
commonSuffix
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
if (results.length > limit * 10) break;
|
|
94
|
-
}
|
|
95
|
-
results.sort((a, b) => {
|
|
96
|
-
if (Math.abs(b.similarity - a.similarity) > 0.01) return b.similarity - a.similarity;
|
|
97
|
-
return a.divergencePoints.length - b.divergencePoints.length;
|
|
98
|
-
});
|
|
99
|
-
const deduped = [];
|
|
100
|
-
for (const r of results) {
|
|
101
|
-
const isDuplicate = deduped.some(
|
|
102
|
-
(existing) => isSubChain(r.chainA, existing.chainA) && isSubChain(r.chainB, existing.chainB)
|
|
103
|
-
);
|
|
104
|
-
if (!isDuplicate) deduped.push(r);
|
|
105
|
-
if (deduped.length >= limit) break;
|
|
106
|
-
}
|
|
107
|
-
return deduped;
|
|
108
|
-
}
|
|
109
|
-
function generateChains(graph, minLen, maxLen) {
|
|
110
|
-
const chains = [];
|
|
111
|
-
const maxChains = 500;
|
|
112
|
-
for (const startNode of graph.keys()) {
|
|
113
|
-
if (chains.length >= maxChains) break;
|
|
114
|
-
dfsChains(graph, startNode, [startNode], /* @__PURE__ */ new Set([startNode]), minLen, maxLen, chains, maxChains);
|
|
115
|
-
}
|
|
116
|
-
return chains;
|
|
117
|
-
}
|
|
118
|
-
function dfsChains(graph, node, path, visited, minLen, maxLen, results, maxResults) {
|
|
119
|
-
if (results.length >= maxResults) return;
|
|
120
|
-
if (path.length >= maxLen) {
|
|
121
|
-
if (path.length >= minLen) results.push([...path]);
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
const neighbors = graph.get(node);
|
|
125
|
-
if (!neighbors || neighbors.size === 0) {
|
|
126
|
-
if (path.length >= minLen) results.push([...path]);
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
let extended = false;
|
|
130
|
-
for (const next of neighbors) {
|
|
131
|
-
if (visited.has(next)) continue;
|
|
132
|
-
visited.add(next);
|
|
133
|
-
path.push(next);
|
|
134
|
-
dfsChains(graph, next, path, visited, minLen, maxLen, results, maxResults);
|
|
135
|
-
path.pop();
|
|
136
|
-
visited.delete(next);
|
|
137
|
-
extended = true;
|
|
138
|
-
if (results.length >= maxResults) return;
|
|
139
|
-
}
|
|
140
|
-
if (!extended && path.length >= minLen) {
|
|
141
|
-
results.push([...path]);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
function editDistance(a, b) {
|
|
145
|
-
const m = a.length;
|
|
146
|
-
const n = b.length;
|
|
147
|
-
const dp = Array.from({ length: m + 1 }, () => Array(n + 1).fill(0));
|
|
148
|
-
for (let i2 = 0; i2 <= m; i2++) dp[i2][0] = i2;
|
|
149
|
-
for (let j2 = 0; j2 <= n; j2++) dp[0][j2] = j2;
|
|
150
|
-
for (let i2 = 1; i2 <= m; i2++) {
|
|
151
|
-
for (let j2 = 1; j2 <= n; j2++) {
|
|
152
|
-
if (a[i2 - 1] === b[j2 - 1]) {
|
|
153
|
-
dp[i2][j2] = dp[i2 - 1][j2 - 1];
|
|
154
|
-
} else {
|
|
155
|
-
dp[i2][j2] = 1 + Math.min(
|
|
156
|
-
dp[i2 - 1][j2],
|
|
157
|
-
dp[i2][j2 - 1],
|
|
158
|
-
dp[i2 - 1][j2 - 1]
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
const ops = [];
|
|
164
|
-
let i = m, j = n;
|
|
165
|
-
while (i > 0 || j > 0) {
|
|
166
|
-
if (i > 0 && j > 0 && a[i - 1] === b[j - 1]) {
|
|
167
|
-
ops.unshift({ type: "match", indexA: i - 1, indexB: j - 1 });
|
|
168
|
-
i--;
|
|
169
|
-
j--;
|
|
170
|
-
} else if (i > 0 && j > 0 && dp[i][j] === dp[i - 1][j - 1] + 1) {
|
|
171
|
-
ops.unshift({ type: "substitute", indexA: i - 1, indexB: j - 1 });
|
|
172
|
-
i--;
|
|
173
|
-
j--;
|
|
174
|
-
} else if (j > 0 && dp[i][j] === dp[i][j - 1] + 1) {
|
|
175
|
-
ops.unshift({ type: "insert", indexA: i, indexB: j - 1 });
|
|
176
|
-
j--;
|
|
177
|
-
} else {
|
|
178
|
-
ops.unshift({ type: "delete", indexA: i - 1, indexB: j });
|
|
179
|
-
i--;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
return { distance: dp[m][n], ops };
|
|
183
|
-
}
|
|
184
|
-
function getCommonPrefix(a, b) {
|
|
185
|
-
const prefix = [];
|
|
186
|
-
for (let i = 0; i < Math.min(a.length, b.length); i++) {
|
|
187
|
-
if (a[i] === b[i]) prefix.push(a[i]);
|
|
188
|
-
else break;
|
|
189
|
-
}
|
|
190
|
-
return prefix;
|
|
191
|
-
}
|
|
192
|
-
function getCommonSuffix(a, b) {
|
|
193
|
-
const suffix = [];
|
|
194
|
-
let ai = a.length - 1;
|
|
195
|
-
let bi = b.length - 1;
|
|
196
|
-
while (ai >= 0 && bi >= 0 && a[ai] === b[bi]) {
|
|
197
|
-
suffix.unshift(a[ai]);
|
|
198
|
-
ai--;
|
|
199
|
-
bi--;
|
|
200
|
-
}
|
|
201
|
-
return suffix;
|
|
202
|
-
}
|
|
203
|
-
function isSubChain(sub, full) {
|
|
204
|
-
if (sub.length > full.length) return false;
|
|
205
|
-
const fullStr = full.join("\u2192");
|
|
206
|
-
const subStr = sub.join("\u2192");
|
|
207
|
-
return fullStr.includes(subStr);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
export {
|
|
211
|
-
similarChains
|
|
212
|
-
};
|
|
213
|
-
//# sourceMappingURL=chunk-T6UVM534.js.map
|
package/dist/chunk-U74VYTLX.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
findFirstSymbolMatch,
|
|
3
|
-
getCalleeRowsForSymbol,
|
|
4
|
-
getCallerRowsForSymbol
|
|
5
|
-
} from "./chunk-FMAYH7GS.js";
|
|
6
|
-
import {
|
|
7
|
-
shortenSymbol
|
|
8
|
-
} from "./chunk-YMSJCSRG.js";
|
|
9
|
-
|
|
10
|
-
// src/queries/call-graph.ts
|
|
11
|
-
function callGraph(db, symbolPattern) {
|
|
12
|
-
const target = findFirstSymbolMatch(db, symbolPattern);
|
|
13
|
-
if (!target) return null;
|
|
14
|
-
const callerRows = getCallerRowsForSymbol(db, target, { limit: 50 });
|
|
15
|
-
const calleeRows = uniqueRows(getCalleeRowsForSymbol(db, target, { limit: 50 }));
|
|
16
|
-
return {
|
|
17
|
-
symbol: target.symbol,
|
|
18
|
-
shortName: shortenSymbol(target.symbol),
|
|
19
|
-
callers: callerRows.map((r) => ({
|
|
20
|
-
symbol: r.symbol,
|
|
21
|
-
shortName: shortenSymbol(r.symbol),
|
|
22
|
-
file: r.file
|
|
23
|
-
})),
|
|
24
|
-
callees: calleeRows.map((r) => ({
|
|
25
|
-
symbol: r.symbol,
|
|
26
|
-
shortName: shortenSymbol(r.symbol),
|
|
27
|
-
file: r.file
|
|
28
|
-
}))
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
function uniqueRows(rows) {
|
|
32
|
-
const seen = /* @__PURE__ */ new Set();
|
|
33
|
-
const unique = [];
|
|
34
|
-
for (const row of rows) {
|
|
35
|
-
const key = `${row.symbol}|${row.file}`;
|
|
36
|
-
if (seen.has(key)) continue;
|
|
37
|
-
seen.add(key);
|
|
38
|
-
unique.push(row);
|
|
39
|
-
}
|
|
40
|
-
return unique;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export {
|
|
44
|
-
callGraph
|
|
45
|
-
};
|
|
46
|
-
//# sourceMappingURL=chunk-U74VYTLX.js.map
|
package/dist/chunk-UIRCHPOU.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isEntrySurface
|
|
3
|
-
} from "./chunk-OMVF3BHY.js";
|
|
4
|
-
import {
|
|
5
|
-
getAllDefinitions,
|
|
6
|
-
getCalleeRowsForSymbol,
|
|
7
|
-
getCallerRowsForSymbol
|
|
8
|
-
} from "./chunk-FMAYH7GS.js";
|
|
9
|
-
import {
|
|
10
|
-
shortenSymbol
|
|
11
|
-
} from "./chunk-YMSJCSRG.js";
|
|
12
|
-
|
|
13
|
-
// src/queries/isolated.ts
|
|
14
|
-
function isolated(db, opts = {}) {
|
|
15
|
-
const { scope, minLoc = 3 } = opts;
|
|
16
|
-
return getAllDefinitions(db, { scope }).filter((definition) => !db.isIgnored(definition.relativePath)).filter((definition) => !isEntrySurface(db, definition.relativePath)).filter((definition) => definition.isFunctionLike).map((definition) => ({
|
|
17
|
-
definition,
|
|
18
|
-
loc: definition.endLine - definition.startLine + 1
|
|
19
|
-
})).filter((entry) => entry.loc >= minLoc).filter((entry) => getCallerRowsForSymbol(db, entry.definition, { limit: 1 }).length === 0).filter((entry) => getCalleeRowsForSymbol(db, entry.definition, { limit: 1 }).length === 0).sort(
|
|
20
|
-
(left, right) => right.loc - left.loc || left.definition.relativePath.localeCompare(right.definition.relativePath) || left.definition.startLine - right.definition.startLine
|
|
21
|
-
).map((entry) => ({
|
|
22
|
-
symbol: entry.definition.symbol,
|
|
23
|
-
shortName: shortenSymbol(entry.definition.symbol),
|
|
24
|
-
relativePath: entry.definition.relativePath,
|
|
25
|
-
startLine: entry.definition.startLine,
|
|
26
|
-
endLine: entry.definition.endLine,
|
|
27
|
-
loc: entry.loc
|
|
28
|
-
}));
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export {
|
|
32
|
-
isolated
|
|
33
|
-
};
|
|
34
|
-
//# sourceMappingURL=chunk-UIRCHPOU.js.map
|
package/dist/chunk-UNS6ZQVX.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
resolveIndexedFile
|
|
3
|
-
} from "./chunk-FMAYH7GS.js";
|
|
4
|
-
import {
|
|
5
|
-
shortenSymbol
|
|
6
|
-
} from "./chunk-YMSJCSRG.js";
|
|
7
|
-
|
|
8
|
-
// src/queries/change-surface.ts
|
|
9
|
-
function changeSurface(db, filePattern) {
|
|
10
|
-
const resolvedFile = resolveIndexedFile(db, filePattern);
|
|
11
|
-
if (!resolvedFile) return null;
|
|
12
|
-
const doc = db.get(
|
|
13
|
-
`SELECT id, relative_path FROM documents
|
|
14
|
-
WHERE relative_path = ?
|
|
15
|
-
${db.pathExclusionsFor("documents")}
|
|
16
|
-
LIMIT 1`,
|
|
17
|
-
resolvedFile
|
|
18
|
-
);
|
|
19
|
-
if (!doc || db.isIgnored(doc.relative_path)) return null;
|
|
20
|
-
const syms = db.all(
|
|
21
|
-
`SELECT DISTINCT gs.id AS symbol_id, gs.symbol, der.start_line, der.end_line
|
|
22
|
-
FROM defn_enclosing_ranges der
|
|
23
|
-
JOIN global_symbols gs ON der.symbol_id = gs.id
|
|
24
|
-
WHERE der.document_id = ?
|
|
25
|
-
${db.symbolNoiseFor("gs")}
|
|
26
|
-
ORDER BY der.start_line`,
|
|
27
|
-
doc.id
|
|
28
|
-
);
|
|
29
|
-
const symbols = [];
|
|
30
|
-
let totalExternalConsumers = 0;
|
|
31
|
-
for (const sym of syms) {
|
|
32
|
-
const consumerRow = db.get(
|
|
33
|
-
`SELECT COUNT(DISTINCT c.document_id) AS consumer_count
|
|
34
|
-
FROM mentions m
|
|
35
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
36
|
-
WHERE m.symbol_id = ?
|
|
37
|
-
AND m.role != 1
|
|
38
|
-
AND c.document_id != ?`,
|
|
39
|
-
sym.symbol_id,
|
|
40
|
-
doc.id
|
|
41
|
-
);
|
|
42
|
-
const externalConsumers = consumerRow?.consumer_count ?? 0;
|
|
43
|
-
let riskLevel;
|
|
44
|
-
if (externalConsumers > 10) {
|
|
45
|
-
riskLevel = "high";
|
|
46
|
-
} else if (externalConsumers > 0) {
|
|
47
|
-
riskLevel = "medium";
|
|
48
|
-
} else {
|
|
49
|
-
riskLevel = "low";
|
|
50
|
-
}
|
|
51
|
-
totalExternalConsumers += externalConsumers;
|
|
52
|
-
symbols.push({
|
|
53
|
-
symbol: sym.symbol,
|
|
54
|
-
shortName: shortenSymbol(sym.symbol),
|
|
55
|
-
startLine: sym.start_line,
|
|
56
|
-
endLine: sym.end_line,
|
|
57
|
-
externalConsumers,
|
|
58
|
-
riskLevel
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
return {
|
|
62
|
-
file: doc.relative_path,
|
|
63
|
-
symbols,
|
|
64
|
-
totalExternalConsumers
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export {
|
|
69
|
-
changeSurface
|
|
70
|
-
};
|
|
71
|
-
//# sourceMappingURL=chunk-UNS6ZQVX.js.map
|