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.
Files changed (199) hide show
  1. package/dist/chunk-2DSS2NGF.js +10 -0
  2. package/dist/chunk-2RLP74AO.js +2 -0
  3. package/dist/chunk-4QJ7LVW5.js +2 -0
  4. package/dist/chunk-4TYGGOLO.js +5 -0
  5. package/dist/chunk-5IADAU5B.js +7 -0
  6. package/dist/chunk-7754WFFV.js +18 -0
  7. package/dist/chunk-7VOF4ZG6.js +2 -0
  8. package/dist/chunk-7Z4COVMC.js +2 -0
  9. package/dist/chunk-AJ5PWKD4.js +2 -0
  10. package/dist/chunk-BDBRZPX3.js +7 -0
  11. package/dist/chunk-BE6EQIWY.js +2 -0
  12. package/dist/chunk-BQ3INTYT.js +8 -0
  13. package/dist/chunk-D7KLLMPB.js +2 -0
  14. package/dist/chunk-D7YBWSON.js +29 -0
  15. package/dist/chunk-DE5ZBHMK.js +39 -0
  16. package/dist/chunk-DHYIJHXZ.js +33 -0
  17. package/dist/chunk-EEF3YEHW.js +2 -0
  18. package/dist/chunk-F2LLHRRZ.js +2 -0
  19. package/dist/chunk-FCC3XJTI.js +2 -0
  20. package/dist/chunk-GNXRLK5G.js +2 -0
  21. package/dist/chunk-GXVB36TG.js +62 -0
  22. package/dist/chunk-HMKJTAZD.js +2 -0
  23. package/dist/chunk-IBGBI3VU.js +2 -0
  24. package/dist/chunk-IYFZS4PV.js +84 -0
  25. package/dist/chunk-JH3A7HTU.js +2 -0
  26. package/dist/chunk-JS2RNIC7.js +2 -0
  27. package/dist/chunk-K5FQFCSN.js +41 -0
  28. package/dist/chunk-K6GBKEQE.js +6 -0
  29. package/dist/chunk-KO7YJRWP.js +12 -0
  30. package/dist/chunk-KYT47WU2.js +4 -0
  31. package/dist/chunk-LORWXBOO.js +2 -0
  32. package/dist/chunk-LX4H4LLG.js +89 -0
  33. package/dist/chunk-N3Z2SJCR.js +2 -0
  34. package/dist/chunk-NTDA4A2D.js +25 -0
  35. package/dist/chunk-NXMYYHDO.js +24 -0
  36. package/dist/chunk-PZ6ESKRH.js +7 -0
  37. package/dist/chunk-QXE6EDY2.js +6 -0
  38. package/dist/chunk-RJ7SPBJ5.js +5 -0
  39. package/dist/chunk-RWE6FHG3.js +3 -0
  40. package/dist/chunk-SDX6MDBL.js +2 -0
  41. package/dist/chunk-SG35Y7J2.js +2 -0
  42. package/dist/chunk-STOGKRJH.js +4 -0
  43. package/dist/chunk-TINPMWJK.js +2 -0
  44. package/dist/chunk-UJB62HV3.js +2 -0
  45. package/dist/chunk-VEUMRDHW.js +2 -0
  46. package/dist/chunk-WCDXJGYT.js +65 -0
  47. package/dist/chunk-WTSTDJZ7.js +6 -0
  48. package/dist/chunk-XAZTIDST.js +2 -0
  49. package/dist/chunk-XVDASCN7.js +35 -0
  50. package/dist/chunk-Y7H6D2EV.js +2 -0
  51. package/dist/chunk-Y7LOQSWY.js +2 -0
  52. package/dist/chunk-YIPCV7M7.js +70 -0
  53. package/dist/chunk-ZSRXMNMK.js +5 -0
  54. package/dist/chunk-ZXKURFVB.js +56 -0
  55. package/dist/cli.js +509 -8938
  56. package/dist/{db-6F9R9e_t.d.ts → db-BSTtBG_H.d.ts} +146 -1
  57. package/dist/index.d.ts +11 -2
  58. package/dist/index.js +13 -1616
  59. package/dist/postinstall.js +4 -100
  60. package/dist/queries/affected.d.ts +1 -1
  61. package/dist/queries/affected.js +1 -8
  62. package/dist/queries/bottlenecks.d.ts +1 -1
  63. package/dist/queries/bottlenecks.js +1 -8
  64. package/dist/queries/by-kind.d.ts +1 -4
  65. package/dist/queries/by-kind.js +1 -10
  66. package/dist/queries/call-graph.d.ts +1 -1
  67. package/dist/queries/call-graph.js +1 -8
  68. package/dist/queries/change-surface.d.ts +4 -1
  69. package/dist/queries/change-surface.js +1 -8
  70. package/dist/queries/code.d.ts +1 -1
  71. package/dist/queries/code.js +1 -8
  72. package/dist/queries/complexity-hotspots.d.ts +5 -3
  73. package/dist/queries/complexity-hotspots.js +1 -8
  74. package/dist/queries/complexity.d.ts +1 -1
  75. package/dist/queries/complexity.js +1 -8
  76. package/dist/queries/convergence.d.ts +1 -1
  77. package/dist/queries/convergence.js +1 -8
  78. package/dist/queries/coupling.d.ts +1 -1
  79. package/dist/queries/coupling.js +1 -10
  80. package/dist/queries/cycles.d.ts +1 -1
  81. package/dist/queries/cycles.js +1 -8
  82. package/dist/queries/dataflow.d.ts +1 -1
  83. package/dist/queries/dataflow.js +1 -8
  84. package/dist/queries/dead.d.ts +1 -1
  85. package/dist/queries/dead.js +1 -9
  86. package/dist/queries/deep-chains.d.ts +9 -1
  87. package/dist/queries/deep-chains.js +1 -8
  88. package/dist/queries/deps.d.ts +1 -1
  89. package/dist/queries/deps.js +1 -10
  90. package/dist/queries/diff-impact.d.ts +1 -1
  91. package/dist/queries/diff-impact.js +1 -7
  92. package/dist/queries/drift.d.ts +1 -1
  93. package/dist/queries/drift.js +1 -8
  94. package/dist/queries/extract-candidates.d.ts +1 -1
  95. package/dist/queries/extract-candidates.js +1 -8
  96. package/dist/queries/fan.d.ts +1 -1
  97. package/dist/queries/fan.js +1 -14
  98. package/dist/queries/files.d.ts +1 -1
  99. package/dist/queries/files.js +1 -6
  100. package/dist/queries/health.d.ts +1 -1
  101. package/dist/queries/health.js +1 -20
  102. package/dist/queries/hierarchy.d.ts +1 -1
  103. package/dist/queries/hierarchy.js +1 -8
  104. package/dist/queries/hotspots.d.ts +1 -1
  105. package/dist/queries/hotspots.js +1 -8
  106. package/dist/queries/imports.d.ts +1 -1
  107. package/dist/queries/imports.js +1 -12
  108. package/dist/queries/index.d.ts +1 -1
  109. package/dist/queries/index.js +1 -197
  110. package/dist/queries/isolated.d.ts +1 -1
  111. package/dist/queries/isolated.js +1 -9
  112. package/dist/queries/members.d.ts +4 -1
  113. package/dist/queries/members.js +1 -8
  114. package/dist/queries/methods.d.ts +1 -1
  115. package/dist/queries/methods.js +1 -8
  116. package/dist/queries/outline.d.ts +4 -1
  117. package/dist/queries/outline.js +1 -8
  118. package/dist/queries/passthrough-candidates.d.ts +1 -1
  119. package/dist/queries/passthrough-candidates.js +1 -8
  120. package/dist/queries/redundant-reexports.d.ts +1 -1
  121. package/dist/queries/redundant-reexports.js +1 -9
  122. package/dist/queries/refs.d.ts +1 -1
  123. package/dist/queries/refs.js +1 -8
  124. package/dist/queries/similar-chains.d.ts +1 -1
  125. package/dist/queries/similar-chains.js +1 -8
  126. package/dist/queries/similar-files.d.ts +1 -1
  127. package/dist/queries/similar-files.js +1 -8
  128. package/dist/queries/similar-signatures.d.ts +1 -1
  129. package/dist/queries/similar-signatures.js +1 -8
  130. package/dist/queries/similar.d.ts +1 -1
  131. package/dist/queries/similar.js +1 -10
  132. package/dist/queries/slice.d.ts +1 -1
  133. package/dist/queries/slice.js +1 -8
  134. package/dist/queries/stale-abstractions.d.ts +15 -5
  135. package/dist/queries/stale-abstractions.js +1 -8
  136. package/dist/queries/stats.d.ts +1 -1
  137. package/dist/queries/stats.js +1 -6
  138. package/dist/queries/surface.d.ts +1 -1
  139. package/dist/queries/surface.js +1 -8
  140. package/dist/queries/symbols.d.ts +1 -1
  141. package/dist/queries/symbols.js +1 -9
  142. package/dist/queries/system.d.ts +6 -2
  143. package/dist/queries/system.js +1 -9
  144. package/dist/queries/trace.d.ts +1 -1
  145. package/dist/queries/trace.js +1 -9
  146. package/dist/queries/wrapper-candidates.d.ts +1 -1
  147. package/dist/queries/wrapper-candidates.js +1 -8
  148. package/dist/reindex-worker.js +7 -672
  149. package/package.json +20 -2
  150. package/dist/chunk-334PCFO3.js +0 -221
  151. package/dist/chunk-46ZTW4AI.js +0 -61
  152. package/dist/chunk-4TYLS5XX.js +0 -10
  153. package/dist/chunk-4YN3PE57.js +0 -124
  154. package/dist/chunk-5YB6UXQ3.js +0 -101
  155. package/dist/chunk-6PVHJ332.js +0 -44
  156. package/dist/chunk-74RFWB5T.js +0 -24
  157. package/dist/chunk-7KGTWDAX.js +0 -87
  158. package/dist/chunk-7OGXSMLY.js +0 -105
  159. package/dist/chunk-AEBM56CO.js +0 -69
  160. package/dist/chunk-B747RITP.js +0 -38
  161. package/dist/chunk-B7LDMCUS.js +0 -110
  162. package/dist/chunk-C2VSV54P.js +0 -110
  163. package/dist/chunk-DIYEUFVP.js +0 -81
  164. package/dist/chunk-E74RY6AQ.js +0 -93
  165. package/dist/chunk-FIMTTUGE.js +0 -165
  166. package/dist/chunk-FMAYH7GS.js +0 -2542
  167. package/dist/chunk-FO2CBB7U.js +0 -23
  168. package/dist/chunk-HESWGDIV.js +0 -162
  169. package/dist/chunk-HL2LXSBW.js +0 -34
  170. package/dist/chunk-HW76DVE4.js +0 -216
  171. package/dist/chunk-IC5NTO47.js +0 -53
  172. package/dist/chunk-J34HAAEQ.js +0 -59
  173. package/dist/chunk-JSXGC2EH.js +0 -151
  174. package/dist/chunk-LQXBFCP2.js +0 -87
  175. package/dist/chunk-NML6M5AS.js +0 -37
  176. package/dist/chunk-NNFP4ZRF.js +0 -72
  177. package/dist/chunk-NWXTQGUE.js +0 -49
  178. package/dist/chunk-NYZ6INK3.js +0 -95
  179. package/dist/chunk-OMVF3BHY.js +0 -84
  180. package/dist/chunk-P3VCDYMJ.js +0 -269
  181. package/dist/chunk-PGQXIAJF.js +0 -79
  182. package/dist/chunk-PKDFXASW.js +0 -76
  183. package/dist/chunk-PSK5BPFE.js +0 -82
  184. package/dist/chunk-QZ4FRB65.js +0 -341
  185. package/dist/chunk-R2QBMQQN.js +0 -185
  186. package/dist/chunk-T3ALCNCP.js +0 -113
  187. package/dist/chunk-T6UVM534.js +0 -213
  188. package/dist/chunk-U74VYTLX.js +0 -46
  189. package/dist/chunk-UIRCHPOU.js +0 -34
  190. package/dist/chunk-UNS6ZQVX.js +0 -71
  191. package/dist/chunk-VJMTX3OR.js +0 -115
  192. package/dist/chunk-XJSPWHNT.js +0 -64
  193. package/dist/chunk-XMZAC2VU.js +0 -84
  194. package/dist/chunk-Y7FKURZG.js +0 -130
  195. package/dist/chunk-YMSJCSRG.js +0 -213
  196. package/dist/chunk-YQIWS5V6.js +0 -172
  197. package/dist/chunk-ZPEI7DRJ.js +0 -66
  198. package/dist/queries/clean-signature.d.ts +0 -9
  199. package/dist/queries/clean-signature.js +0 -7
@@ -1,172 +0,0 @@
1
- import {
2
- findFirstSymbolMatch,
3
- getSourceImports,
4
- resolveIndexedFile
5
- } from "./chunk-FMAYH7GS.js";
6
- import {
7
- isModuleLikeSymbol,
8
- leafName,
9
- shortenSymbol
10
- } from "./chunk-YMSJCSRG.js";
11
-
12
- // src/queries/imports.ts
13
- function imports(db, filePattern) {
14
- const importer = resolveIndexedFile(db, filePattern);
15
- if (!importer) return [];
16
- const rows = db.all(
17
- `SELECT DISTINCT gs.symbol, def_d.relative_path AS from_file, imp_d.relative_path AS importer
18
- FROM mentions m
19
- JOIN chunks c ON m.chunk_id = c.id
20
- JOIN documents imp_d ON c.document_id = imp_d.id
21
- JOIN global_symbols gs ON m.symbol_id = gs.id
22
- LEFT JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
23
- LEFT JOIN documents def_d ON der.document_id = def_d.id
24
- WHERE imp_d.relative_path = ?
25
- AND m.role = 2
26
- ORDER BY def_d.relative_path, gs.symbol`,
27
- importer
28
- );
29
- const indexedResults = rows.filter((row) => !db.isIgnored(row.importer)).map((r) => ({
30
- symbol: r.symbol,
31
- shortName: shortenSymbol(r.symbol),
32
- fromFile: r.from_file ?? "(external)"
33
- }));
34
- if (indexedResults.length > 0) {
35
- return indexedResults;
36
- }
37
- return getSourceImports(db, importer).map((entry) => ({
38
- symbol: renderImportSymbol(entry.importedName, entry.localName, entry.kind),
39
- shortName: renderImportSymbol(entry.importedName, entry.localName, entry.kind),
40
- fromFile: entry.sourcePath ?? "(external)"
41
- }));
42
- }
43
- function importedBy(db, symbolPattern) {
44
- const rows = db.all(
45
- `SELECT DISTINCT gs.symbol, d.relative_path AS importer
46
- FROM mentions m
47
- JOIN chunks c ON m.chunk_id = c.id
48
- JOIN documents d ON c.document_id = d.id
49
- JOIN global_symbols gs ON m.symbol_id = gs.id
50
- WHERE gs.symbol LIKE ?
51
- AND m.role = 2
52
- ORDER BY d.relative_path`,
53
- `%${symbolPattern}%`
54
- );
55
- const indexedResults = rows.filter((r) => !db.isIgnored(r.importer)).map((r) => ({
56
- symbol: r.symbol,
57
- shortName: shortenSymbol(r.symbol),
58
- fromFile: r.importer
59
- }));
60
- if (indexedResults.length > 0) {
61
- return indexedResults;
62
- }
63
- const target = findFirstSymbolMatch(db, symbolPattern);
64
- const targetFile = target?.relativePath ?? null;
65
- const targetLeaf = target ? leafName(target.symbol) : symbolPattern.replace(/\(\)$/, "");
66
- const targetIsModule = target ? isModuleLikeSymbol(target.symbol) : false;
67
- const files = db.all(
68
- `SELECT relative_path
69
- FROM documents
70
- WHERE 1 = 1
71
- ${db.pathExclusionsFor("documents")}
72
- ORDER BY relative_path`
73
- );
74
- const importers = /* @__PURE__ */ new Set();
75
- for (const row of files) {
76
- if (db.isIgnored(row.relative_path)) continue;
77
- for (const entry of getSourceImports(db, row.relative_path)) {
78
- if (!entry.sourcePath) continue;
79
- if (targetFile && normalizePath(entry.sourcePath) !== normalizePath(targetFile)) {
80
- continue;
81
- }
82
- if (entry.kind === "side-effect") {
83
- importers.add(row.relative_path);
84
- continue;
85
- }
86
- if (targetFile && isCLikeImporter(row.relative_path)) {
87
- importers.add(row.relative_path);
88
- continue;
89
- }
90
- if (targetIsModule) {
91
- importers.add(row.relative_path);
92
- continue;
93
- }
94
- if (entry.kind === "named" && entry.importedName === targetLeaf) {
95
- importers.add(row.relative_path);
96
- continue;
97
- }
98
- if (entry.kind === "namespace" && entry.usedMembers.includes(targetLeaf)) {
99
- importers.add(row.relative_path);
100
- }
101
- }
102
- }
103
- return [...importers].sort().map((importer) => ({
104
- symbol: target?.symbol ?? targetLeaf,
105
- shortName: target ? shortenSymbol(target.symbol) : targetLeaf,
106
- fromFile: importer
107
- }));
108
- }
109
- function unusedImports(db, filePattern) {
110
- const importer = resolveIndexedFile(db, filePattern);
111
- if (!importer) return [];
112
- const rows = db.all(
113
- `SELECT gs.symbol, d.relative_path AS imported_in, d.relative_path AS importer
114
- FROM mentions m
115
- JOIN chunks c ON m.chunk_id = c.id
116
- JOIN documents d ON c.document_id = d.id
117
- JOIN global_symbols gs ON m.symbol_id = gs.id
118
- WHERE d.relative_path = ?
119
- AND m.role = 2
120
- AND NOT EXISTS (
121
- SELECT 1
122
- FROM mentions ref_m
123
- JOIN chunks ref_c ON ref_m.chunk_id = ref_c.id
124
- WHERE ref_m.symbol_id = gs.id
125
- AND ref_m.role != 1
126
- AND ref_c.document_id = d.id
127
- )
128
- ORDER BY d.relative_path, gs.symbol`,
129
- importer
130
- );
131
- const indexedResults = rows.filter((row) => !db.isIgnored(row.importer)).map((r) => ({
132
- symbol: r.symbol,
133
- shortName: shortenSymbol(r.symbol),
134
- importedIn: r.imported_in
135
- }));
136
- if (indexedResults.length > 0) {
137
- return indexedResults;
138
- }
139
- return getSourceImports(db, importer).filter((entry) => entry.kind !== "side-effect" && !entry.used).map((entry) => ({
140
- symbol: renderImportSymbol(entry.importedName, entry.localName, entry.kind),
141
- shortName: renderImportSymbol(entry.importedName, entry.localName, entry.kind),
142
- importedIn: importer
143
- }));
144
- }
145
- function renderImportSymbol(importedName, localName, kind) {
146
- if (kind === "namespace" && importedName === "*" && localName) {
147
- return `* as ${localName}`;
148
- }
149
- if (kind === "default" && localName) {
150
- return `default as ${localName}`;
151
- }
152
- if (kind === "side-effect") {
153
- return "(side effect import)";
154
- }
155
- if (localName && localName !== importedName) {
156
- return `${importedName} as ${localName}`;
157
- }
158
- return importedName;
159
- }
160
- function normalizePath(path) {
161
- return path.replace(/\\/g, "/");
162
- }
163
- function isCLikeImporter(relativePath) {
164
- return /\.(?:c|h|cc|cpp|cxx|hpp|hh|hxx)$/i.test(relativePath);
165
- }
166
-
167
- export {
168
- imports,
169
- importedBy,
170
- unusedImports
171
- };
172
- //# sourceMappingURL=chunk-YQIWS5V6.js.map
@@ -1,66 +0,0 @@
1
- import {
2
- resolveIndexedPaths
3
- } from "./chunk-FMAYH7GS.js";
4
- import {
5
- shortenSymbol
6
- } from "./chunk-YMSJCSRG.js";
7
-
8
- // src/queries/outline.ts
9
- function outline(db, filePattern) {
10
- const resolvedPaths = resolveIndexedPaths(db, filePattern);
11
- if (resolvedPaths.length === 0) {
12
- return [];
13
- }
14
- const placeholders = resolvedPaths.map(() => "?").join(", ");
15
- const rows = db.all(
16
- `SELECT gs.symbol, gs.enclosing_symbol, der.start_line, der.end_line
17
- FROM defn_enclosing_ranges der
18
- JOIN global_symbols gs ON der.symbol_id = gs.id
19
- JOIN documents d ON der.document_id = d.id
20
- WHERE d.relative_path IN (${placeholders})
21
- ${db.symbolNoise}
22
- ORDER BY d.relative_path, der.start_line`,
23
- ...resolvedPaths
24
- );
25
- const nodes = rows.map((r) => ({
26
- symbol: r.symbol,
27
- shortName: shortenSymbol(r.symbol),
28
- startLine: r.start_line,
29
- endLine: r.end_line,
30
- children: []
31
- }));
32
- const nodeMap = /* @__PURE__ */ new Map();
33
- for (const n of nodes) nodeMap.set(n.symbol, n);
34
- const roots = [];
35
- for (let i = 0; i < rows.length; i++) {
36
- const r = rows[i];
37
- const node = nodes[i];
38
- if (r.enclosing_symbol && nodeMap.has(r.enclosing_symbol)) {
39
- nodeMap.get(r.enclosing_symbol).children.push(node);
40
- continue;
41
- }
42
- let bestParent = null;
43
- let bestSize = Infinity;
44
- for (const candidate of nodes) {
45
- if (candidate === node) continue;
46
- if (candidate.startLine <= node.startLine && candidate.endLine >= node.endLine) {
47
- const size = candidate.endLine - candidate.startLine;
48
- if (size < bestSize) {
49
- bestSize = size;
50
- bestParent = candidate;
51
- }
52
- }
53
- }
54
- if (bestParent) {
55
- bestParent.children.push(node);
56
- } else {
57
- roots.push(node);
58
- }
59
- }
60
- return roots;
61
- }
62
-
63
- export {
64
- outline
65
- };
66
- //# sourceMappingURL=chunk-ZPEI7DRJ.js.map
@@ -1,9 +0,0 @@
1
- /**
2
- * Clean up the raw doc/signature string from the SCIP index.
3
- *
4
- * Shared across symbols, trace, and system queries.
5
- * Previously duplicated as cleanSig/cleanSignature in three files.
6
- */
7
- declare function cleanSignature(sig: string | null): string | null;
8
-
9
- export { cleanSignature };
@@ -1,7 +0,0 @@
1
- import {
2
- cleanSignature
3
- } from "../chunk-4TYLS5XX.js";
4
- export {
5
- cleanSignature
6
- };
7
- //# sourceMappingURL=clean-signature.js.map