scip-query 0.6.4 → 0.6.6
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/README.md +74 -35
- package/dist/augment-vue-worker.js +2 -0
- package/dist/chunk-25HOGELX.js +2 -0
- package/dist/chunk-2TLYCK2L.js +11 -0
- package/dist/chunk-3PVIYZ74.js +84 -0
- package/dist/chunk-4TX5IMMK.js +12 -0
- package/dist/chunk-6DVA22YE.js +2 -0
- package/dist/{chunk-CGAO6FHN.js → chunk-6GPFHZP3.js} +2 -2
- package/dist/chunk-7LSCW7NF.js +6 -0
- package/dist/chunk-7PRMSA4Z.js +2 -0
- package/dist/chunk-7X7FLQC5.js +2 -0
- package/dist/chunk-7YI2M2AQ.js +2 -0
- package/dist/chunk-AADJ7MCQ.js +2 -0
- package/dist/chunk-AV7BOODV.js +4 -0
- package/dist/chunk-AXP4H62Q.js +6 -0
- package/dist/chunk-C4C3T4K3.js +2 -0
- package/dist/chunk-CSRPJCWO.js +2 -0
- package/dist/chunk-CYJMOTIH.js +2 -0
- package/dist/chunk-DLWRLPKO.js +29 -0
- package/dist/chunk-E2V5SE6M.js +70 -0
- package/dist/{chunk-ZE3BTHTS.js → chunk-ERRUE5G4.js} +4 -4
- package/dist/chunk-GBDZY73J.js +2 -0
- package/dist/chunk-GPY33RTH.js +19 -0
- package/dist/{chunk-4TYGGOLO.js → chunk-H4DXD2FB.js} +1 -1
- package/dist/{chunk-LAXFZ3UW.js → chunk-HVNVO6UW.js} +4 -4
- package/dist/chunk-I377UMS2.js +2 -0
- package/dist/chunk-IKQYNTW3.js +2 -0
- package/dist/chunk-IZ4KV37N.js +7 -0
- package/dist/{chunk-KYT47WU2.js → chunk-KAM4C6ZD.js} +1 -1
- package/dist/{chunk-OOMAS234.js → chunk-KBGFYKOJ.js} +2 -2
- package/dist/chunk-KW2F3WSV.js +5 -0
- package/dist/chunk-LJ2YWNQF.js +2 -0
- package/dist/chunk-MO65UK5V.js +6 -0
- package/dist/{chunk-6UJ5PXER.js → chunk-MXWC53GJ.js} +4 -4
- package/dist/chunk-NIN762LD.js +5 -0
- package/dist/{chunk-5OVBASGY.js → chunk-O6VBAW7P.js} +2 -2
- package/dist/{chunk-IVT2U2BV.js → chunk-OQZF2DQJ.js} +3 -3
- package/dist/chunk-PIRXZGV6.js +2 -0
- package/dist/{chunk-GALIM3IE.js → chunk-Q2ALKKSE.js} +4 -4
- package/dist/chunk-Q4R2IYA3.js +7 -0
- package/dist/{chunk-AW3QJT4O.js → chunk-QFBJZHMV.js} +3 -3
- package/dist/chunk-QFZE73XF.js +84 -0
- package/dist/chunk-QPJG6VRT.js +16 -0
- package/dist/chunk-QRYEOK3M.js +2 -0
- package/dist/{chunk-LORWXBOO.js → chunk-RKTDEIHF.js} +1 -1
- package/dist/chunk-TBJDUS4E.js +71 -0
- package/dist/chunk-TLRA5TR6.js +2 -0
- package/dist/chunk-TUV2VI7D.js +7 -0
- package/dist/chunk-UAPNU7UP.js +2 -0
- package/dist/chunk-URCJTFOD.js +2 -0
- package/dist/chunk-UUIWMLDX.js +39 -0
- package/dist/chunk-VEXS3I3N.js +2 -0
- package/dist/chunk-VRC3WKKE.js +2 -0
- package/dist/chunk-WFDTS7XL.js +2 -0
- package/dist/chunk-Y4DS3MDC.js +5 -0
- package/dist/chunk-YJODB2F5.js +2 -0
- package/dist/{chunk-QID23O53.js → chunk-YXMHTJYY.js} +2 -2
- package/dist/chunk-Z4AMQWVY.js +90 -0
- package/dist/chunk-ZHHMG4UC.js +114 -0
- package/dist/cli.js +487 -388
- package/dist/{db-DKhNQ75l.d.ts → db-BZPa7dzJ.d.ts} +19 -9
- package/dist/index.d.ts +224 -13
- package/dist/index.js +45 -31
- package/dist/postinstall.js +1 -1
- package/dist/queries/affected.d.ts +1 -1
- package/dist/queries/affected.js +1 -1
- package/dist/queries/bottlenecks.d.ts +1 -1
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.d.ts +1 -1
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +1 -1
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +1 -1
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/code.d.ts +1 -1
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.d.ts +1 -1
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +1 -1
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/convergence.d.ts +1 -1
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.d.ts +1 -1
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +1 -1
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.d.ts +1 -1
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +1 -1
- package/dist/queries/dead.js +1 -1
- package/dist/queries/deep-chains.d.ts +1 -1
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/deps.d.ts +1 -1
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-impact.d.ts +1 -1
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/drift-policy.d.ts +6 -0
- package/dist/queries/drift-policy.js +2 -0
- package/dist/queries/drift.d.ts +1 -1
- package/dist/queries/drift.js +1 -1
- package/dist/queries/extract-candidates.d.ts +1 -1
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +1 -1
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.d.ts +1 -1
- package/dist/queries/files.js +1 -1
- package/dist/queries/health.d.ts +1 -1
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +1 -1
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +1 -1
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +1 -1
- package/dist/queries/imports.js +1 -1
- package/dist/queries/index.d.ts +1 -1
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.d.ts +1 -1
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/members.d.ts +1 -1
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.d.ts +1 -1
- package/dist/queries/methods.js +1 -1
- package/dist/queries/outline.d.ts +1 -1
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +1 -1
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +1 -1
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.d.ts +1 -1
- package/dist/queries/refs.js +1 -1
- package/dist/queries/similar-chains.d.ts +1 -1
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.d.ts +1 -1
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.d.ts +1 -1
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +1 -1
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +1 -1
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.d.ts +1 -1
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +1 -1
- package/dist/queries/stats.js +1 -1
- package/dist/queries/surface.d.ts +1 -1
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.d.ts +1 -1
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system.d.ts +1 -1
- package/dist/queries/system.js +1 -1
- package/dist/queries/trace.d.ts +1 -1
- package/dist/queries/trace.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +1 -1
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +10 -63
- package/package.json +5 -3
- package/dist/chunk-2DQK2IDZ.js +0 -19
- package/dist/chunk-4HCKXL7T.js +0 -6
- package/dist/chunk-4Q2D5BMS.js +0 -2
- package/dist/chunk-5IM4IQ6N.js +0 -2
- package/dist/chunk-5NSYCQWM.js +0 -6
- package/dist/chunk-6QKHOBC6.js +0 -2
- package/dist/chunk-6U5UHIRD.js +0 -5
- package/dist/chunk-AQFXC7CF.js +0 -2
- package/dist/chunk-BSONDC3H.js +0 -7
- package/dist/chunk-ECT6SOBO.js +0 -2
- package/dist/chunk-FFE3RZ65.js +0 -2
- package/dist/chunk-FT4WPAEX.js +0 -65
- package/dist/chunk-G6HYVVRV.js +0 -2
- package/dist/chunk-GVVKLMXG.js +0 -10
- package/dist/chunk-HVM6SQPQ.js +0 -2
- package/dist/chunk-IDCWMWWP.js +0 -5
- package/dist/chunk-IJO2HZFL.js +0 -2
- package/dist/chunk-INPQVQ6O.js +0 -12
- package/dist/chunk-JSBWVSES.js +0 -39
- package/dist/chunk-MFVPKCS5.js +0 -2
- package/dist/chunk-MWCN46ZX.js +0 -89
- package/dist/chunk-N3Z2SJCR.js +0 -2
- package/dist/chunk-NKU7Z242.js +0 -8
- package/dist/chunk-P6IUCZA3.js +0 -24
- package/dist/chunk-PM3GTZ4I.js +0 -2
- package/dist/chunk-QL5MJOVA.js +0 -84
- package/dist/chunk-QWFK4QOQ.js +0 -2
- package/dist/chunk-RBYC6PHE.js +0 -2
- package/dist/chunk-TS7E5XBZ.js +0 -29
- package/dist/chunk-TUC6IWTY.js +0 -2
- package/dist/chunk-USMVRM6F.js +0 -2
- package/dist/chunk-VTZPTRKS.js +0 -7
- package/dist/chunk-WUYKGQSK.js +0 -2
- package/dist/chunk-X7LOLGYY.js +0 -2
- package/dist/chunk-XGOEZVMA.js +0 -7
- package/dist/chunk-Y6NOLG4X.js +0 -70
- package/dist/chunk-YVQ7CIKO.js +0 -6
- package/dist/chunk-ZIFKQQW2.js +0 -4
- package/dist/chunk-ZOR6FW74.js +0 -2
- package/dist/chunk-ZPZLVFJQ.js +0 -41
- package/dist/chunk-ZZ3F6P3X.js +0 -2
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import{a as m}from"./chunk-UAPNU7UP.js";import{c as u}from"./chunk-YXMHTJYY.js";import{e as l,f as a}from"./chunk-KW2F3WSV.js";import{o as d,q as c}from"./chunk-QFZE73XF.js";function C(e,t={}){let{scope:o,limit:r}=t,n=new m(e),i=x([...p(e,o),...f(e,n,o)]);return N(i),r?i.slice(0,r):i}function p(e,t){let o=[];for(let r of R(e,t)){if(e.isIgnored(r.barrel_path)||e.isIgnored(r.original_path)||u(e,r.barrel_path))continue;let n=b(e,r),i=n?.barrel_consumers??0,s=n?.direct_consumers??0;i!==0||s!==0||o.push({barrelFile:r.barrel_path,symbol:r.symbol,shortName:d(r.symbol),originalFile:r.original_path,barrelConsumers:i,directConsumers:s})}return o}function R(e,t){let o=t?`AND barrel_d.relative_path LIKE '%${t}%'`:"";return e.all(`SELECT DISTINCT
|
|
2
|
+
barrel_d.id AS barrel_doc_id,
|
|
3
|
+
barrel_d.relative_path AS barrel_path,
|
|
4
|
+
gs.id AS symbol_id,
|
|
5
|
+
gs.symbol AS symbol,
|
|
6
|
+
orig_d.id AS original_doc_id,
|
|
7
|
+
orig_d.relative_path AS original_path
|
|
8
|
+
FROM mentions m
|
|
9
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
10
|
+
JOIN documents barrel_d ON c.document_id = barrel_d.id
|
|
11
|
+
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
12
|
+
JOIN (
|
|
13
|
+
SELECT m2.symbol_id, c2.document_id
|
|
14
|
+
FROM mentions m2
|
|
15
|
+
JOIN chunks c2 ON m2.chunk_id = c2.id
|
|
16
|
+
WHERE m2.role = 1
|
|
17
|
+
GROUP BY m2.symbol_id
|
|
18
|
+
) sym_def ON sym_def.symbol_id = gs.id
|
|
19
|
+
JOIN documents orig_d ON sym_def.document_id = orig_d.id
|
|
20
|
+
WHERE m.role != 1
|
|
21
|
+
AND (barrel_d.relative_path LIKE '%/index.ts'
|
|
22
|
+
OR barrel_d.relative_path LIKE '%/index.js'
|
|
23
|
+
OR barrel_d.relative_path = 'index.ts'
|
|
24
|
+
OR barrel_d.relative_path = 'index.js')
|
|
25
|
+
AND orig_d.id != barrel_d.id
|
|
26
|
+
${e.pathExclusionsFor("barrel_d","orig_d")}
|
|
27
|
+
${e.symbolNoiseFor("gs")}
|
|
28
|
+
-- Only function-level symbols (ending with ().), not module-level
|
|
29
|
+
AND gs.symbol LIKE '%().'
|
|
30
|
+
${o}
|
|
31
|
+
ORDER BY barrel_d.relative_path, gs.symbol`)}function b(e,t){return e.get(`SELECT
|
|
32
|
+
SUM(CASE WHEN uses_barrel = 1 THEN 1 ELSE 0 END) AS barrel_consumers,
|
|
33
|
+
SUM(CASE WHEN uses_barrel = 0 THEN 1 ELSE 0 END) AS direct_consumers
|
|
34
|
+
FROM (
|
|
35
|
+
SELECT
|
|
36
|
+
consumer_d.id AS consumer_doc_id,
|
|
37
|
+
MAX(CASE WHEN EXISTS (
|
|
38
|
+
SELECT 1
|
|
39
|
+
FROM mentions barrel_m
|
|
40
|
+
JOIN chunks barrel_c ON barrel_m.chunk_id = barrel_c.id
|
|
41
|
+
WHERE barrel_c.document_id = consumer_d.id
|
|
42
|
+
AND barrel_m.role != 1
|
|
43
|
+
AND barrel_m.symbol_id IN (
|
|
44
|
+
SELECT m2.symbol_id
|
|
45
|
+
FROM mentions m2
|
|
46
|
+
JOIN chunks c2 ON m2.chunk_id = c2.id
|
|
47
|
+
WHERE c2.document_id = ?
|
|
48
|
+
AND m2.role != 1
|
|
49
|
+
)
|
|
50
|
+
) THEN 1 ELSE 0 END) AS uses_barrel
|
|
51
|
+
FROM mentions ref_m
|
|
52
|
+
JOIN chunks ref_c ON ref_m.chunk_id = ref_c.id
|
|
53
|
+
JOIN documents consumer_d ON ref_c.document_id = consumer_d.id
|
|
54
|
+
WHERE ref_m.symbol_id = ?
|
|
55
|
+
AND ref_m.role != 1
|
|
56
|
+
AND consumer_d.id != ?
|
|
57
|
+
AND consumer_d.id != ?
|
|
58
|
+
${e.pathExclusionsFor("consumer_d")}
|
|
59
|
+
GROUP BY consumer_d.id
|
|
60
|
+
)`,t.barrel_doc_id,t.symbol_id,t.barrel_doc_id,t.original_doc_id)}function f(e,t,o){let r=[];for(let n of E(e,o))_(e,n,n)>0||r.push(...h(e,t,n));return r}function E(e,t){return e.all(`SELECT relative_path
|
|
61
|
+
FROM documents
|
|
62
|
+
WHERE 1 = 1
|
|
63
|
+
${t?"AND relative_path LIKE ?":""}
|
|
64
|
+
${e.pathExclusionsFor("documents")}
|
|
65
|
+
ORDER BY relative_path`,...t?[`%${t}%`]:[]).map(r=>r.relative_path).filter(r=>!e.isIgnored(r)).filter(r=>a(e,r).length>0)}function h(e,t,o){return a(e,o).filter(r=>r.sourcePath&&!e.isIgnored(r.sourcePath)).flatMap(r=>g(e,t,o,r.sourcePath))}function g(e,t,o,r){let n=S(t,r);return n?[{barrelFile:o,symbol:n.symbol,shortName:d(n.symbol),originalFile:r,barrelConsumers:0,directConsumers:_(e,r,o)}]:[]}function _(e,t,o){let r=e.all(`SELECT relative_path
|
|
66
|
+
FROM documents
|
|
67
|
+
WHERE 1 = 1
|
|
68
|
+
${e.pathExclusionsFor("documents")}
|
|
69
|
+
ORDER BY relative_path`),n=new Set;for(let i of r)if(!(e.isIgnored(i.relative_path)||i.relative_path===o))for(let s of l(e,i.relative_path))s.sourcePath===t&&n.add(i.relative_path);return n.size}function S(e,t){let o=e.definitionsForFile(t);return o.find(r=>c(r.symbol)==="method")??o[0]??null}function x(e){let t=new Set,o=[];for(let r of e){let n=`${r.barrelFile}|${r.symbol}|${r.originalFile}`;t.has(n)||(t.add(n),o.push(r))}return o}function N(e){e.sort((t,o)=>o.directConsumers-t.directConsumers||t.barrelFile.localeCompare(o.barrelFile)||t.shortName.localeCompare(o.shortName))}export{C as a};
|
|
70
|
+
//# sourceMappingURL=chunk-E2V5SE6M.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
1
|
+
import{a as s}from"./chunk-MO65UK5V.js";function a(e,d){let i=s(e,d);return i?e.all(`SELECT DISTINCT d2.relative_path
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
JOIN documents d1 ON c.document_id = d1.id
|
|
@@ -14,7 +14,7 @@ import{a as s}from"./chunk-4HCKXL7T.js";function r(e,d){let i=s(e,d);return i?e.
|
|
|
14
14
|
WHERE d1.relative_path = ?
|
|
15
15
|
AND d2.relative_path <> d1.relative_path
|
|
16
16
|
AND ${e.localSymbolPredicate}
|
|
17
|
-
ORDER BY d2.relative_path`,i).filter(t=>!e.isIgnored(t.relative_path)).map(t=>({relativePath:t.relative_path})):[]}function
|
|
17
|
+
ORDER BY d2.relative_path`,i).filter(t=>!e.isIgnored(t.relative_path)).map(t=>({relativePath:t.relative_path})):[]}function r(e,d){let i=s(e,d);return i?e.all(`SELECT DISTINCT d1.relative_path
|
|
18
18
|
FROM mentions m
|
|
19
19
|
JOIN chunks c ON m.chunk_id = c.id
|
|
20
20
|
JOIN documents d1 ON c.document_id = d1.id
|
|
@@ -29,5 +29,5 @@ import{a as s}from"./chunk-4HCKXL7T.js";function r(e,d){let i=s(e,d);return i?e.
|
|
|
29
29
|
JOIN documents d2 ON sym_def.document_id = d2.id
|
|
30
30
|
WHERE d2.relative_path = ?
|
|
31
31
|
AND d1.relative_path != ?
|
|
32
|
-
ORDER BY d1.relative_path`,i,i).filter(t=>!e.isIgnored(t.relative_path)).map(t=>({relativePath:t.relative_path})):[]}export{
|
|
33
|
-
//# sourceMappingURL=chunk-
|
|
32
|
+
ORDER BY d1.relative_path`,i,i).filter(t=>!e.isIgnored(t.relative_path)).map(t=>({relativePath:t.relative_path})):[]}export{a,r as b};
|
|
33
|
+
//# sourceMappingURL=chunk-ERRUE5G4.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import{a as u,b as g,c as S}from"./chunk-LJ2YWNQF.js";import{a as p}from"./chunk-UAPNU7UP.js";import{a as y}from"./chunk-YXMHTJYY.js";import{e as d}from"./chunk-KW2F3WSV.js";import{n as m}from"./chunk-Z4AMQWVY.js";import l from"path";function q(t,n){let{scope:r,minDeviation:i=5}=n??{},s=new p(t).fileDependencyGraph(r),c=M(t,r);return R([...D(t,s,c),...v(s),...b(s,i)])}function D(t,n,r){let i=[];for(let[e,s]of n){if(a(e))continue;let c=r.get(e)??new Set;for(let o of s)if(!a(o)&&!c.has(o)){if(F(t,e,o)||w(t,e,o)||L(t,e,o)||$(o)||x(t,e,o)||P(o))continue;i.push({file:e,kind:"unused-import",description:`Depends on ${o} but references none of its symbols`,dep:o})}}return i}function v(t){let n=[],r=N(t);for(let[i,e]of t){if(a(i))continue;let s=u(i);for(let c of e){if(a(c))continue;let o=u(c);if(s===o)continue;(g(s,o)??r.get(`${s}->${o}`))==="violation"&&n.push({file:i,kind:"layer-violation",description:`Imports from ${o}/ (${c}) \u2014 may cross architectural boundary`,dep:c,detail:`${s}/ should not depend on ${o}/`})}}return n}function b(t,n){let r=[];for(let[i,e]of _(t)){let s=e.filter(o=>!a(o));if(s.length<n)continue;let c=k(t,s);for(let o of s)for(let f of t.get(o)??[])a(f)||(c.get(f)??0)===1&&l.dirname(f)!==i&&l.dirname(f)!==l.dirname(i)&&(S(o,f)||r.push({file:o,kind:"pattern-deviation",description:`Only file in ${i}/ that depends on ${f}`,dep:f}))}return r}function R(t){return{results:t,unusedImports:t.filter(n=>n.kind==="unused-import").length,layerViolations:t.filter(n=>n.kind==="layer-violation").length,patternDeviations:t.filter(n=>n.kind==="pattern-deviation").length}}function _(t){let n=new Map;for(let r of t.keys()){let i=l.dirname(r),e=n.get(i);e||(e=[],n.set(i,e)),e.push(r)}return n}function k(t,n){let r=new Map;for(let i of n)for(let e of t.get(i)??[])a(e)||r.set(e,(r.get(e)??0)+1);return r}function M(t,n){let r=new Map;return E(t,r,n),O(t,r),r}function E(t,n,r){for(let i of I(t,r))h(t,n,i.from_file,i.to_file)}function I(t,n){let r=n?`AND d1.relative_path LIKE '%${n}%'`:"";return t.all(`SELECT DISTINCT d1.relative_path AS from_file, d2.relative_path AS to_file
|
|
2
|
+
FROM mentions m
|
|
3
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
4
|
+
JOIN documents d1 ON c.document_id = d1.id
|
|
5
|
+
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
6
|
+
JOIN (
|
|
7
|
+
SELECT m2.symbol_id, c2.document_id
|
|
8
|
+
FROM mentions m2
|
|
9
|
+
JOIN chunks c2 ON m2.chunk_id = c2.id
|
|
10
|
+
WHERE m2.role = 1
|
|
11
|
+
GROUP BY m2.symbol_id
|
|
12
|
+
) sym_def ON sym_def.symbol_id = gs.id
|
|
13
|
+
JOIN documents d2 ON sym_def.document_id = d2.id
|
|
14
|
+
WHERE d1.id != d2.id
|
|
15
|
+
AND m.role != 1
|
|
16
|
+
${t.pathExclusionsFor("d1","d2")}
|
|
17
|
+
${r}`)}function O(t,n){let r=new p(t),i=t.all(`SELECT relative_path FROM documents
|
|
18
|
+
WHERE 1 = 1 ${t.pathExclusionsFor("documents")}`);r.scanSourceReferences({paths:i.map(e=>e.relative_path),includeRustAttributeNames:!0,identifierResolution:"permissive"},e=>{e.target.relativePath!==e.sourceFile&&(t.isIgnored(e.target.relativePath)||h(t,n,e.sourceFile,e.target.relativePath))})}function h(t,n,r,i){if(t.isIgnored(r)||t.isIgnored(i))return;let e=n.get(r);e||(e=new Set,n.set(r,e)),e.add(i)}function N(t){let n=new Map;for(let[i,e]of t){if(a(i))continue;let s=u(i);for(let c of e){if(a(c))continue;let o=u(c);if(s===o||g(s,o))continue;let f=`${s}->${o}`;n.set(f,(n.get(f)??0)+1)}}let r=new Map;for(let[i,e]of n)r.set(i,e<=2?"violation":"ok");return r}function $(t){return t.includes("types")||t.endsWith(".d.ts")}function F(t,n,r){let i=m(t,n).filter(e=>e.sourcePath===r);return i.length>0&&i.some(e=>e.isUsed)}function w(t,n,r){let i=d(t,n).filter(e=>e.sourcePath===r);return i.length>0&&i.some(e=>e.used)}function L(t,n,r){let i=d(t,n).filter(e=>e.sourcePath===r);return i.length>0&&i.every(e=>e.isTypeOnly===!0)}function P(t){return t.endsWith(".vue")}function x(t,n,r){let i=d(t,n).filter(e=>e.sourcePath===r);return i.length===0?!1:i.every(e=>e.kind==="side-effect"||e.kind==="namespace"&&e.usedMembers.length===0&&!e.used)}function a(t){let n=y(t);return!!(n==="entry"||n==="barrel"||n==="test"||n==="worker"||T(l.basename(t)))}function T(t){return!!(t==="index.ts"||t==="index.js"||t==="cli.ts"||t==="main.ts"||t==="main.rs"||t.includes("worker.")||t.includes("postinstall.")||t==="health.ts"||t==="health.js")}export{q as a};
|
|
19
|
+
//# sourceMappingURL=chunk-GPY33RTH.js.map
|
|
@@ -2,4 +2,4 @@ import{execFileSync as n}from"child_process";import{platform as o,arch as p}from
|
|
|
2
2
|
`),console.log("Or download manually:")):console.log("Download from:"),console.log(e?` ${e.url}
|
|
3
3
|
`:` https://github.com/sourcegraph/scip/releases/tag/${u}
|
|
4
4
|
`),console.log("After installing, ensure `scip` is on your PATH and run `scip-query reindex`.")}function I(e){if(o()==="darwin"&&t("brew")){e("Installing scip CLI via Homebrew...");try{if(n("brew",["install","sourcegraph/scip/scip"],{stdio:"inherit",timeout:3e5,env:process.env}),t("scip"))return e("Successfully installed scip CLI via Homebrew"),!0}catch(r){let i=r instanceof Error?r.message:String(r);e(`Homebrew install failed: ${i}`)}}if(t("go")){e("Installing scip CLI via go install...");try{if(n("go",["install","github.com/sourcegraph/scip/cmd/scip@latest"],{stdio:"inherit",timeout:3e5,env:process.env}),t("scip"))return e("Successfully installed scip CLI via go install"),!0}catch(r){let i=r instanceof Error?r.message:String(r);e(`go install failed: ${i}`)}}return e("Could not auto-install scip CLI."),e("Install manually from: https://github.com/sourcegraph/scip/releases"),!1}export{h as a,w as b,b as c,I as d};
|
|
5
|
-
//# sourceMappingURL=chunk-
|
|
5
|
+
//# sourceMappingURL=chunk-H4DXD2FB.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as r}from"./chunk-MO65UK5V.js";import{g as l}from"./chunk-3PVIYZ74.js";import{a as c}from"./chunk-ZHHMG4UC.js";import{o as d}from"./chunk-QFZE73XF.js";function f(e,t){let o=c(e,t);if(!o)return[];let i=e.get(`SELECT COUNT(DISTINCT c.document_id) AS file_count
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
WHERE m.symbol_id = ?
|
|
5
|
-
AND m.role != 1`,o.symbolId);return[{name:d(o.symbol),count:i?.file_count??0}]}function y(e,t){let o=
|
|
5
|
+
AND m.role != 1`,o.symbolId);return[{name:d(o.symbol),count:i?.file_count??0}]}function y(e,t){let o=r(e,t);if(!o)return[];let n=e.all(`SELECT d.relative_path, COUNT(DISTINCT gs.id) AS symbol_count
|
|
6
6
|
FROM mentions m
|
|
7
7
|
JOIN chunks c ON m.chunk_id = c.id
|
|
8
8
|
JOIN documents d ON c.document_id = d.id
|
|
@@ -19,7 +19,7 @@ import{a as l}from"./chunk-4HCKXL7T.js";import{g as r}from"./chunk-FT4WPAEX.js";
|
|
|
19
19
|
AND m.role != 1
|
|
20
20
|
AND def_d.id != d.id
|
|
21
21
|
GROUP BY d.id
|
|
22
|
-
ORDER BY symbol_count DESC`,o).filter(m=>!e.isIgnored(m.relative_path)).map(m=>({name:m.relative_path,count:m.symbol_count}));if(n.length>0)return n;let s=
|
|
22
|
+
ORDER BY symbol_count DESC`,o).filter(m=>!e.isIgnored(m.relative_path)).map(m=>({name:m.relative_path,count:m.symbol_count}));if(n.length>0)return n;let s=l(e).get(o);return!s||s.size===0?[]:[{name:o,count:s.size}]}function b(e,t={}){return _(e,t).map(o=>({name:d(o.symbol),count:o.file_count}))}function _(e,t){let{limit:o=30,scope:i}=t,n=i?`AND def_d.relative_path LIKE '%${i}%'`:"";return e.all(`SELECT gs.symbol, COUNT(DISTINCT c.document_id) AS file_count
|
|
23
23
|
FROM mentions m
|
|
24
24
|
JOIN chunks c ON m.chunk_id = c.id
|
|
25
25
|
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
@@ -59,4 +59,4 @@ import{a as l}from"./chunk-4HCKXL7T.js";import{g as r}from"./chunk-FT4WPAEX.js";
|
|
|
59
59
|
GROUP BY d.id
|
|
60
60
|
ORDER BY symbol_count DESC
|
|
61
61
|
LIMIT ?`,o).filter(s=>!e.isIgnored(s.relative_path)).map(s=>({name:s.relative_path,count:s.symbol_count}))}export{f as a,y as b,b as c,I as d};
|
|
62
|
-
//# sourceMappingURL=chunk-
|
|
62
|
+
//# sourceMappingURL=chunk-HVNVO6UW.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as g}from"./chunk-UAPNU7UP.js";import{c as h}from"./chunk-VEXS3I3N.js";import{h as u,j as p}from"./chunk-3PVIYZ74.js";import{a as d,b as y}from"./chunk-ZHHMG4UC.js";import{E as S,o as f}from"./chunk-QFZE73XF.js";function j(e,o,r={}){let{direction:c="backward",maxDepth:s=3}=r,t=d(e,o);return t?c==="backward"?w(e,t,s):R(e,t):null}function w(e,o,r){let c=[],s=new Set([o.symbol]),t=[o];for(let a=1;a<=r&&t.length!==0;a++){let n=[];for(let l of t){let i=u(e,l);for(let m of i){if(s.has(m.symbol))continue;s.add(m.symbol),c.push({symbol:m.symbol,shortName:f(m.symbol),file:m.file,relationship:a===1?"referenced within definition (callee)":`depth ${a} callee`});let b=y(e,m.symbol);b&&!e.isIgnored(b.relativePath)&&n.push(b)}}t=n}return{symbol:o.symbol,shortName:f(o.symbol),direction:"backward",connectedSymbols:c}}function R(e,o){let r=h(e,o),c=r.length>0?r:p(e,o),s=new Set,t=[],a=new g(e);for(let n of c){if(t.length>=30)break;if(e.isIgnored(n.file))continue;let l=n.enclosingSymbol??S(a.definitionsForFile(n.file),n.line)?.symbol??null;if(!l||l===o.symbol)continue;let i=y(e,l);!i||e.isIgnored(i.relativePath)||s.has(i.symbol)||(s.add(i.symbol),t.push({symbol:i.symbol,shortName:f(i.symbol),file:i.relativePath,relationship:`references target at ${n.file}:${n.line+1}`}))}return t.sort((n,l)=>n.file.localeCompare(l.file)),{symbol:o.symbol,shortName:f(o.symbol),direction:"forward",connectedSymbols:t}}export{j as a};
|
|
2
|
+
//# sourceMappingURL=chunk-I377UMS2.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as l}from"./chunk-UAPNU7UP.js";import{a as i}from"./chunk-ZHHMG4UC.js";import{o as s,q as m,w as n}from"./chunk-QFZE73XF.js";function c(r,a){let t=i(r,a);return t?new l(r).definitionsForFile(t.relativePath).filter(e=>e.symbol!==t.symbol).filter(e=>n(t.symbol,e.symbol)).sort((e,o)=>e.startLine-o.startLine||e.endLine-o.endLine).map(e=>({symbol:e.symbol,shortName:s(e.symbol),startLine:e.startLine,endLine:e.endLine,kind:m(e.symbol)??"unknown"})):[]}export{c as a};
|
|
2
|
+
//# sourceMappingURL=chunk-IKQYNTW3.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{c as m}from"./chunk-VEXS3I3N.js";import{j as g}from"./chunk-3PVIYZ74.js";import{a as R}from"./chunk-ZHHMG4UC.js";import{d as u,s as h}from"./chunk-QFZE73XF.js";function $(t,a){let e=R(t,a);if(!e)return[];let i=!h(e.symbol)&&!t.isIgnored(e.relativePath)?[{relativePath:e.relativePath,line:e.startLine}]:[],r=m(t,e),l=(r.length>0?r:g(t,e)).filter(n=>!t.isIgnored(n.file)).map(n=>({relativePath:n.file,line:n.line})),c=S(t,e),s=new Set,f=[];for(let n of[...i,...l,...c]){let p=`${n.relativePath}:${n.line}`;s.has(p)||(s.add(p),f.push(n))}return f}function S(t,a){if(!a.relativePath.endsWith(".rb"))return[];let e=d(a.symbol);if(e.length===0)return[];let o=t.all(`SELECT relative_path
|
|
2
|
+
FROM documents
|
|
3
|
+
WHERE relative_path LIKE '%.rb'
|
|
4
|
+
${t.pathExclusionsFor("documents")}
|
|
5
|
+
ORDER BY relative_path`),i=[];for(let r of o){if(t.isIgnored(r.relative_path))continue;let l=u(t,r.relative_path);if(!l)continue;let c=l.split(`
|
|
6
|
+
`);for(let s=0;s<c.length;s++){let f=c[s]??"";e.some(n=>new RegExp(`@${n}\\b|\\b${n}:`).test(f))&&i.push({relativePath:r.relative_path,line:s})}}return i}function d(t){let e=(t.split(":").pop()??t).replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[^A-Za-z0-9_]+/g,"_").toLowerCase().replace(/^_+|_+$/g,""),o=e.split("_").filter(Boolean),i=new Set;return e&&i.add(e),o.length>=1&&i.add(o[o.length-1]),o.length>=2&&i.add(o.slice(-2).join("_")),[...i]}export{$ as a};
|
|
7
|
+
//# sourceMappingURL=chunk-IZ4KV37N.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
function i(e){return/[*?]/.test(e)?e.replace(/\*\*/g,"%").replace(/\*/g,"%").replace(/\?/g,"_"):`%${e}%`}function l(e,r){let a=i(r);return e.all(`SELECT relative_path FROM documents
|
|
2
2
|
WHERE relative_path LIKE ?
|
|
3
3
|
ORDER BY relative_path`,a).filter(t=>!e.isIgnored(t.relative_path)).map(t=>({relativePath:t.relative_path}))}export{l as a};
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
4
|
+
//# sourceMappingURL=chunk-KAM4C6ZD.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as d}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{c as d}from"./chunk-RKTDEIHF.js";import{g as a}from"./chunk-3PVIYZ74.js";function F(t,i={}){let{minSimilarity:f=.5,limit:n=20,scope:o,filePattern:s}=i,u=i.minDeps??(s?1:3),e=g(t,{scope:o,minDeps:u}),p=[];if(s){let r=e.find(l=>l.file.includes(s));if(!r)return[];for(let l of e){if(l.file===r.file)continue;let c=m(r,l,f);c&&p.push(c)}}else for(let r=0;r<e.length;r++){for(let l=r+1;l<e.length;l++){let c=m(e[r],e[l],f);c&&p.push(c)}if(p.length>n*5)break}return p.sort((r,l)=>l.similarity-r.similarity),p.slice(0,n)}function g(t,i){let{scope:f,minDeps:n}=i,o=a(t,f),s=h(o),u=[];for(let[e,p]of o)p.size>=n&&u.push({file:e,deps:new Set([...p].filter(r=>!s.has(r)))});return u}function h(t){let i=new Set,f=t.size;if(f===0)return i;let n=new Map;for(let o of t.values())for(let s of o)n.set(s,(n.get(s)??0)+1);for(let[o,s]of n)s>=5&&s/f>.3&&i.add(o);return i}function m(t,i,f){let n=new Set;for(let e of t.deps)i.deps.has(e)&&n.add(e);if(n.size<3||t.deps.size<4||i.deps.size<4)return null;let o=d(t.deps,i.deps);if(o<f)return null;let s=[];for(let e of t.deps)i.deps.has(e)||s.push(e);let u=[];for(let e of i.deps)t.deps.has(e)||u.push(e);return{fileA:t.file,fileB:i.file,similarity:o,sharedDeps:[...n],uniqueToA:s,uniqueToB:u}}export{F as a};
|
|
2
|
+
//# sourceMappingURL=chunk-KBGFYKOJ.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as b,b as w,c as q,d as X,e as Z,f as T,g as O,h as _,i as U,j as B,k as h,l as W,m as J}from"./chunk-Z4AMQWVY.js";import{a as $,c as H,d as k,f as j,g as Q,h as g}from"./chunk-QFZE73XF.js";function Y(e){return e.replace(/'''[\s\S]*?'''/g,C).replace(/"""[\s\S]*?"""/g,C).replace(/#.*$/gm,C).replace(/\/\/.*$/gm,C).replace(/\/\*[\s\S]*?\*\//g,C).replace(/`(?:\\[\s\S]|[^`])*`/g,C).replace(/'(?:\\.|[^'\\\r\n])*'/g,C).replace(/"(?:\\.|[^"\\\r\n])*"/g,C)}function C(e){return e.replace(/[^\r\n]/g," ")}var Ie=H("stripped-lines");function Dt(e,r,t){return Ie.get(e,r,t,()=>Y(t).split(`
|
|
2
|
+
`))}var K=null,z="";function Pe(e){return K===e||(K=e,z=Y(e)),z}function E(e,r,t){let s=Pe(e);return`${s.slice(0,r)}${" ".repeat(t-r)}${s.slice(t)}`}function S(e,r){return new RegExp(`\\b${G(r)}\\b`,"m").test(e)}function A(e,r){let t=new Set,s=new RegExp(`\\b${G(r)}\\s*\\.\\s*([A-Za-z_$][\\w$]*)`,"g");for(let n of e.matchAll(s)){let i=n[1];i&&t.add(i)}return[...t]}function G(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var be=new Set(["identifier","type_identifier","property_identifier","shorthand_property_identifier","field_identifier"]);function x(e){let r=[],t=0,s=0;for(let n=0;n<e.length;n++){let i=e[n];(i==="{"||i==="["||i==="(")&&t++,(i==="}"||i==="]"||i===")")&&t--,i===","&&t===0&&(r.push(e.slice(s,n)),s=n+1)}return r.push(e.slice(s)),r}function y(e,r){for(let t of e.namedChildren)if(t.type===r)return t;return null}function f(e,r){let t=new Set,s=(n,i)=>{let o=i||r.has(n.type);!o&&be.has(n.type)&&t.add(n.text);for(let a of n.children)s(a,o)};return s(e.rootNode,!1),t}function P(e,r,t,s,n,i,o){return{importedName:n,localName:i,sourcePath:o??h(e,s,Z(r)),kind:"named",used:S(t,i),usedMembers:[]}}function N(e,r,t){let s=[];for(let n of e.matchAll(r)){let i=n[0];if(!i||typeof n.index!="number")continue;let o=E(e,n.index,n.index+i.length);for(let a of t(n,o))s.push(a)}return s}function te(e,r,t){let s=g(e,r);return s?_e(e,r,s):je(t).flatMap(n=>we(e,r,n.clause,n.specifier,n.start,n.end,t))}function _e(e,r,t){let s=Ce(e,r,t),n=[];for(let i of t.rootNode.descendantsOfType("import_statement"))n.push(...Ee(e,r,t,i,s));return n}function Ce(e,r,t){let s=f(t,new Set(["import_statement"]));if(Q(r))for(let n of Xe(e,r))s.add(n);return s}function Ee(e,r,t,s,n){let i=Me(s);if(!i)return[];let o=T(e,r,i),a=y(s,"import_clause");return a?Re(t,a,o,n,$e(s.text)):[Te(o)]}function Re(e,r,t,s,n){let i=[];for(let o of r.namedChildren)if(o.type==="identifier")i.push(De(o.text,t,s,n));else if(o.type==="namespace_import"){let a=ke(e,o,t,s,n);a&&i.push(a)}else o.type==="named_imports"&&i.push(...Ae(o,t,s,n));return i}function Te(e){return{importedName:"*",localName:null,sourcePath:e,kind:"side-effect",used:!0,usedMembers:[]}}function De(e,r,t,s){return{importedName:"default",localName:e,sourcePath:r,kind:"default",used:t.has(e),usedMembers:[],isTypeOnly:s}}function ke(e,r,t,s,n){let o=y(r,"identifier")?.text??"";if(!o)return null;let a=Le(e,o);return{importedName:"*",localName:o,sourcePath:t,kind:"namespace",used:a.length>0||s.has(o),usedMembers:a,isTypeOnly:n}}function Ae(e,r,t,s){let n=[];for(let i of e.namedChildren){if(i.type!=="import_specifier")continue;let o=i.namedChild(0),a=i.namedChild(1);if(!o)continue;let c=o.text,p=a?.text??c;n.push({importedName:c,localName:p,sourcePath:r,kind:"named",used:t.has(p),usedMembers:[],isTypeOnly:s||Oe(i.text)})}return n}function Me(e){let r=y(e,"string");if(!r)return null;let t=y(r,"string_fragment");return t?t.text:null}function $e(e){return/^\s*import\s+type\b/.test(e)}function Oe(e){return/^\s*type\b/.test(e.trim())}function Le(e,r){let t=new Set;for(let s of e.rootNode.descendantsOfType("member_expression")){let n=s.namedChild(0),i=s.namedChild(1);!n||!i||n.type!=="identifier"||n.text!==r||(i.type==="property_identifier"||i.type==="identifier")&&t.add(i.text)}return[...t]}function je(e){let r=[],t=/^[ \t]*import\s+([\s\S]*?)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let n of e.matchAll(t)){let i=n[0],o=n[1],a=n[2];!i||!a||typeof n.index!="number"||r.push({clause:o,specifier:a,start:n.index,end:n.index+i.length})}let s=/^[ \t]*import\s+['"]([^'"]+)['"]\s*;?/gm;for(let n of e.matchAll(s)){let i=n[0],o=n[1];!i||!o||typeof n.index!="number"||r.push({clause:null,specifier:o,start:n.index,end:n.index+i.length})}return r.sort((n,i)=>n.start-i.start)}function we(e,r,t,s,n,i,o){let a=T(e,r,s),c=E(o,n,i);return t?ve(t).map(u=>({...u,sourcePath:a})).map(u=>{if(u.kind==="namespace"){let m=A(c,u.localName);return{...u,used:m.length>0||S(c,u.localName),usedMembers:m}}return u.kind==="side-effect"?{...u,used:!0,usedMembers:[]}:{...u,used:u.localName?S(c,u.localName):!1,usedMembers:[]}}):[{importedName:"*",localName:null,sourcePath:a,kind:"side-effect",used:!0,usedMembers:[]}]}function ve(e){let r=e.trim(),t=/^type\b/.test(r),s=r.replace(/^type\s+/,""),[n,i]=qe(s),o=[];return n&&o.push(...ee(n,t)),i&&o.push(...ee(i,t)),o}function ee(e,r){let t=e.trim();if(!t)return[];if(t.startsWith("{")){let s=t.slice(1,-1).trim();return s?x(s).map(n=>{let i=n.trim(),o=r||/^type\b/.test(i),a=i.replace(/^type\s+/,""),[c,p]=a.split(/\s+as\s+/);return{importedName:c.trim(),localName:(p??c).trim(),kind:"named",isTypeOnly:o}}):[]}return t.startsWith("* as ")?[{importedName:"*",localName:t.slice(5).trim(),kind:"namespace",isTypeOnly:r}]:[{importedName:"default",localName:t,kind:"default",isTypeOnly:r}]}function qe(e){let r=0;for(let t=0;t<e.length;t++){let s=e[t];if(s==="{"&&r++,s==="}"&&r--,s===","&&r===0)return[e.slice(0,t).trim(),e.slice(t+1).trim()]}return[e.trim(),null]}function re(e,r){let t=g(e,r);if(t)return Fe(e,r,t);let s=k(e,r);return s?Ue(e,r,s):[]}function Ue(e,r,t){return[...Be(e,r,t),...We(e,r,t),...Je(e,r,t)]}function Be(e,r,t){let s=[],n=/^[ \t]*export\s+(?:type\s+)?\{([\s\S]*?)\}\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let i of t.matchAll(n)){if(typeof i.index!="number")continue;let o=i[1]??"",a=i[2]??"",c=x(o).map(m=>ze(m.trim())).filter(m=>!!m),p=M(t,i.index),u=M(t,i.index+i[0].length-1);s.push({kind:"named",sourcePath:T(e,r,a),names:c,startLine:p,endLine:u})}return s}function We(e,r,t){let s=[],n=/^[ \t]*export\s+\*\s+as\s+(\w+)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let i of t.matchAll(n)){if(typeof i.index!="number")continue;let o=i[2]??"",a=M(t,i.index),c=M(t,i.index+i[0].length-1);s.push({kind:"star-as",sourcePath:T(e,r,o),names:[],startLine:a,endLine:c})}return s}function Je(e,r,t){let s=[],n=/^[ \t]*export\s+\*\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let i of t.matchAll(n)){if(typeof i.index!="number")continue;let o=i[1]??"",a=M(t,i.index),c=M(t,i.index+i[0].length-1);s.push({kind:"star",sourcePath:T(e,r,o),names:[],startLine:a,endLine:c})}return s}function ze(e){if(!e)return null;let r=e.replace(/^type\s+/,"").trim();if(!r)return null;let t=r.match(/^(\w+)\s+as\s+(\w+)$/);if(t)return t[2]??null;let s=r.match(/^(\w+)$/);return s?s[1]??null:null}function M(e,r){let t=0;for(let s=0;s<r&&s<e.length;s++)e.charCodeAt(s)===10&&t++;return t}function Fe(e,r,t){let s=[];for(let n of t.rootNode.descendantsOfType("export_statement")){let i=Ve(e,r,n);if(i===void 0)continue;let o=n.startPosition.row,a=n.endPosition.row,c=He(n,i,o,a);s.push(c)}return s}function Ve(e,r,t){let s=y(t,"string");if(!s)return;let n=y(s,"string_fragment");if(n)return T(e,r,n.text)}function He(e,r,t,s){let n=y(e,"export_clause");if(n){let o=[];for(let a of n.namedChildren){if(a.type!=="export_specifier")continue;let c=a.namedChild(0),p=a.namedChild(1);c&&o.push((p??c).text)}return{kind:"named",sourcePath:r,names:o,startLine:t,endLine:s}}return y(e,"namespace_export")?{kind:"star-as",sourcePath:r,names:[],startLine:t,endLine:s}:{kind:"star",sourcePath:r,names:[],startLine:t,endLine:s}}var Qe=$("vue-non-script-identifiers");function Xe(e,r){return Qe.get(e,r,()=>{let t=new Set,s=k(e,r);if(!s)return t;let i=s.replace(/<script\b[^>]*>[\s\S]*?<\/script>/g,o=>o.replace(/[^\r\n]/g," ")).replace(/<!--[\s\S]*?-->/g,o=>o.replace(/[^\r\n]/g," ")).replace(/\/\*[\s\S]*?\*\//g,o=>o.replace(/[^\r\n]/g," "));for(let o of i.matchAll(/[A-Za-z_$][\w$]*/g))t.add(o[0]);return t})}import{basename as se}from"path";function ne(e,r,t){let s=g(e,r);return s?Ze(e,r,s):N(t,/^[ \t]*#include\s+[<"]([^">]+)[">]\s*$/gm,(n,i)=>{let o=n[1]?.trim();if(!o)return[];let a=se(o).replace(/\.[^.]+$/,"");return[{importedName:o,localName:a,sourcePath:B(e,r,o),kind:"named",used:S(i,a),usedMembers:[]}]})}function Ze(e,r,t){let s=f(t,new Set(["preproc_include"])),n=[];for(let i of t.rootNode.descendantsOfType("preproc_include")){let o=null;for(let c of i.namedChildren){if(c.type==="system_lib_string"){o=c.text.replace(/^<|>$/g,"");break}if(c.type==="string_literal"){o=c.namedChildren.find(u=>u.type==="string_content")?.text??c.text.replace(/^"|"$/g,"");break}}if(!o)continue;let a=se(o).replace(/\.[^.]+$/,"");n.push({importedName:o,localName:a,sourcePath:B(e,r,o),kind:"named",used:s.has(a),usedMembers:[]})}return n}function oe(e,r,t){let s=[];for(let n of t.matchAll(/^[ \t]*import\s+['"]([^'"]+)['"](?:\s+as\s+([A-Za-z_]\w*))?[\s\S]*?;$/gm)){let i=n[1]?.trim(),o=n[2]?.trim()??null,a=n[0];if(!i||!a||typeof n.index!="number")continue;let c=E(t,n.index,n.index+a.length);s.push({importedName:i,localName:o,sourcePath:W(e,r,i),kind:o?"namespace":"side-effect",used:o?S(c,o):!0,usedMembers:o?A(c,o):[]})}return s}function ie(e,r,t){let s=[];for(let n of t.matchAll(/^[ \t]*export\s+['"]([^'"]+)['"][\s\S]*?;$/gm)){let i=n[1]?.trim();i&&s.push({specifier:i,sourcePath:W(e,r,i)})}return s}function ae(e,r,t){let s=g(e,r),n=j(r);if(s&&n==="csharp")return Ye(e,r,s);if(s&&n==="vb")return Ke(e,r,s);let i=X(r)?/^[ \t]*Imports\s+(.+?)\s*$/gm:/^[ \t]*using\s+(.+?)\s*;$/gm;return N(t,i,(o,a)=>{let c=o[1]?.trim();if(!c)return[];let[p,u]=c.split(/\s*=\s*/),m=!!u,l=(m?u:p)?.trim()??c,d=l.split(".").pop()??l,I=m?p?.trim()??d:d;return[P(e,r,a,l,d,I,h(e,l,w))]})}function Ke(e,r,t){let s=f(t,new Set(["imports_statement"])),n=[];for(let i of t.rootNode.descendantsOfType("imports_statement")){let o=i.namedChildren.filter(l=>l.type==="namespace_name");if(o.length===0)continue;let a=o[o.length-1],c=o.length>1?o[0]:null,p=a.text,u=p.split(".").pop()??p,m=c?.text??u;n.push({importedName:u,localName:m,sourcePath:h(e,p,w),kind:c?"namespace":"named",used:s.has(m),usedMembers:[]})}return n}function Ye(e,r,t){let s=f(t,new Set(["using_directive"])),n=[];for(let i of t.rootNode.descendantsOfType("using_directive")){let o=i.namedChildren;if(o.length===0)continue;let a=null,c;o.length>=2&&o[0].type==="identifier"&&(o[1].type==="qualified_name"||o[1].type==="identifier")?(a=o[0],c=o[1]):c=o[o.length-1];let p=c.text,u=p.split(".").pop()??p,m=a?.text??u;n.push({importedName:u,localName:m,sourcePath:h(e,p,w),kind:a?"namespace":"named",used:s.has(m),usedMembers:[]})}return n}function ce(e,r,t){let s=g(e,r),n=j(r);return s&&n==="java"?Ge(e,r,s):s&&n==="kotlin"?et(e,r,s):s&&n==="scala"?tt(e,r,s):N(t,/^[ \t]*import\s+(?:static\s+)?(.+?)\s*;?$/gm,(i,o)=>{let a=i[1]?.trim();return a?rt(e,r,a,o):[]})}function Ge(e,r,t){let s=f(t,new Set(["import_declaration"])),n=[];for(let i of t.rootNode.descendantsOfType("import_declaration")){let o=i.children.some(m=>m.type==="asterisk"),c=i.namedChildren.find(m=>m.type==="scoped_identifier")??i.namedChildren.find(m=>m.type==="identifier");if(!c)continue;let p=c.text;if(o){n.push({importedName:"*",localName:null,sourcePath:h(e,p,b),kind:"namespace",used:!0,usedMembers:[]});continue}let u=p.split(".").pop()??p;n.push({importedName:u,localName:u,sourcePath:h(e,p,b),kind:"named",used:s.has(u),usedMembers:[]})}return n}function et(e,r,t){let s=f(t,new Set(["import_header","import_list"])),n=[];for(let i of t.rootNode.descendantsOfType("import_header")){let o=i.namedChildren.find(d=>d.type==="identifier");if(!o)continue;let a=i.namedChildren.some(d=>d.type==="wildcard_import"),c=i.namedChildren.find(d=>d.type==="import_alias");if(a){n.push({importedName:"*",localName:null,sourcePath:h(e,o.text,b),kind:"namespace",used:!0,usedMembers:[]});continue}let p=o.text,u=p.split(".").pop()??p,l=c?.namedChild(0)?.text??u;n.push({importedName:u,localName:l,sourcePath:h(e,p,b),kind:"named",used:s.has(l),usedMembers:[]})}return n}function tt(e,r,t){let s=f(t,new Set(["import_declaration"])),n=[];for(let i of t.rootNode.descendantsOfType("import_declaration")){let o=i.namedChildren.find(m=>m.type==="namespace_selectors"||m.type==="namespace_wildcard"),a=i.namedChildren.filter(m=>m!==o&&(m.type==="identifier"||m.type==="stable_identifier")),c=a.map(m=>m.text).join(".");if(!c)continue;if(o?.type==="namespace_wildcard"){n.push({importedName:"*",localName:null,sourcePath:h(e,c,b),kind:"namespace",used:!0,usedMembers:[]});continue}if(o?.type==="namespace_selectors"){for(let m of o.namedChildren)if(m.type==="arrow_renamed_identifier"){let[l,d]=m.namedChildren;if(!l)continue;let I=l.text,R=d?.text??I;if(I==="_")continue;n.push({importedName:I,localName:R,sourcePath:h(e,`${c}.${I}`,b),kind:"named",used:s.has(R),usedMembers:[]})}else if(m.type==="identifier"){let l=m.text;n.push({importedName:l,localName:l,sourcePath:h(e,`${c}.${l}`,b),kind:"named",used:s.has(l),usedMembers:[]})}continue}let p=a[a.length-1]?.text??c,u=a.slice(0,-1).map(m=>m.text).join(".")||c;n.push({importedName:p,localName:p,sourcePath:h(e,u&&a.length>1?`${u}.${p}`:c,b),kind:"named",used:s.has(p),usedMembers:[]})}return n}function rt(e,r,t,s){if(t.includes("{")&&t.includes("}")){let n=t.slice(0,t.indexOf("{")).replace(/\.$/,"").trim(),i=t.slice(t.indexOf("{")+1,t.lastIndexOf("}")).trim();return x(i).flatMap(o=>{let a=o.trim();if(!a)return[];let[c,p]=a.includes("=>")?a.split(/\s*=>\s*/):a.split(/\s+as\s+/),u=c?.trim();if(!u||u==="_")return[];let m=(p??u.split(".").pop()??u).trim(),l=u==="_"?n:`${n}.${u}`.replace(/\.\./g,".");return[P(e,r,s,l,u,m)]})}return[P(e,r,s,t,t.split(".").pop()??t,t.split(".").pop()??t)]}function me(e,r,t){let s=g(e,r);return s?st(e,r,s):N(t,/^[ \t]*use\s+(.+?)\s*;$/gm,(n,i)=>{let o=n[1]?.trim();return o?x(o).flatMap(a=>{let c=a.trim();if(!c)return[];let[p,u]=c.split(/\s+as\s+/i),m=p?.trim()??c,l=m.split("\\").pop()??m,d=(u??l).trim();return[P(e,r,i,m,l,d,h(e,m.replace(/\\/g,"."),q))]}):[]})}function st(e,r,t){let s=f(t,new Set(["namespace_use_declaration"])),n=[],i=(o,a,c)=>{n.push({importedName:a,localName:c,sourcePath:h(e,o.replace(/\\/g,"."),q),kind:"named",used:s.has(c),usedMembers:[]})};for(let o of t.rootNode.descendantsOfType("namespace_use_declaration")){let a=o.namedChildren.find(c=>c.type==="namespace_use_group");if(a){let c=o.namedChildren.find(p=>p.type==="namespace_name")?.text??"";for(let p of a.namedChildren){if(p.type!=="namespace_use_clause")continue;let{importedName:u,localName:m,qualified:l}=pe(p,c);u&&i(l,u,m)}continue}for(let c of o.namedChildren){if(c.type!=="namespace_use_clause")continue;let{importedName:p,localName:u,qualified:m}=pe(c,"");p&&i(m,p,u)}}return n}function pe(e,r){let t=e.namedChildren.find(p=>p.type==="qualified_name"),s=e.namedChildren.filter(p=>p.type==="name"),n="";t?n=t.text:s.length>=1&&(n=s[0].text);let i=t&&s.length>0?s[s.length-1]:null,o=n.split("\\").pop()??n,a=i?.text??o,c=r?`${r}\\${n}`:n;return{importedName:o,localName:a,qualified:c}}function de(e,r,t){let s=g(e,r);return s?nt(e,r,s):it(t).flatMap(n=>ct(e,r,n,t))}function nt(e,r,t){let s=f(t,new Set(["import_statement","import_from_statement"])),n=[];for(let i of t.rootNode.descendantsOfType("import_statement"))for(let o of i.namedChildren){let a=ue(o);if(!a)continue;let c=O(e,r,a.qualifiedName);n.push({importedName:a.qualifiedName,localName:a.localName,sourcePath:c,kind:"namespace",used:s.has(a.localName),usedMembers:[]})}for(let i of t.rootNode.descendantsOfType("import_from_statement")){let o=i.namedChild(0);if(!o)continue;let a=ot(o);if(a===null)continue;let c=O(e,r,a);for(let p=1;p<i.namedChildCount;p+=1){let u=i.namedChild(p);if(u.type==="wildcard_import"){n.push({importedName:"*",localName:null,sourcePath:c,kind:"side-effect",used:!0,usedMembers:[]});continue}let m=ue(u);m&&n.push({importedName:m.qualifiedName,localName:m.localName,sourcePath:c,kind:"named",used:s.has(m.localName),usedMembers:[]})}}return n}function ue(e){if(e.type==="aliased_import"){let r=e.namedChild(0),t=e.namedChild(1);return!r||!t?null:{qualifiedName:r.text,localName:t.text}}if(e.type==="dotted_name"){let r=e.text;return{qualifiedName:r,localName:r.split(".")[0]??r}}return e.type==="identifier"?{qualifiedName:e.text,localName:e.text}:null}function ot(e){if(e.type==="dotted_name")return e.text;if(e.type==="relative_import"){let r=y(e,"import_prefix")?.text??"",t=y(e,"dotted_name")?.text??"";return`${r}${t}`}return null}function it(e){let r=e.split(`
|
|
3
|
+
`),t=[],s=0;for(let n=0;n<r.length;n++){let i=r[n],o=i.trimStart(),a=s;if(s+=i.length+1,!o.startsWith("import ")&&!o.startsWith("from "))continue;let c=i,p=a+i.length,u=le(i);for(;n+1<r.length&&(u>0||c.trimEnd().endsWith("\\"));){n++;let l=r[n];c+=`
|
|
4
|
+
${l}`,p+=1+l.length,u+=le(l),s+=l.length+1}let m=at(c);m&&t.push({...m,start:a,end:p})}return t}function at(e){let r=e.replace(/\\\s*\n/g," ").trim();if(r.startsWith("import "))return{kind:"import",module:null,clause:r.slice(7).trim()};let t=r.match(/^from\s+([.\w]+)\s+import\s+([\s\S]+)$/);if(!t)return null;let s=t[2].trim();return s.startsWith("(")&&s.endsWith(")")&&(s=s.slice(1,-1).trim()),{kind:"from",module:t[1],clause:s}}function ct(e,r,t,s){let n=E(s,t.start,t.end),i=t.clause.replace(/\n/g," ").trim();if(t.kind==="import")return x(i).flatMap(c=>{let p=c.trim().replace(/,$/,"");if(!p)return[];let[u,m]=p.split(/\s+as\s+/),l=u.trim(),d=(m??l.split(".")[0]??l).trim(),I=O(e,r,l),R=A(n,d);return[{importedName:l,localName:d,sourcePath:I,kind:"namespace",used:S(n,d)||R.length>0,usedMembers:R}]});let o=t.module?O(e,r,t.module):null,a=[];for(let c of x(i)){let p=c.trim().replace(/,$/,"");if(!p)continue;if(p==="*"){a.push({importedName:"*",localName:null,sourcePath:o,kind:"side-effect",used:!0,usedMembers:[]});continue}let[u,m]=p.split(/\s+as\s+/),l=(m??u).trim();a.push({importedName:u.trim(),localName:l,sourcePath:o,kind:"named",used:S(n,l),usedMembers:[]})}return a}function le(e){let r=0;for(let t of e)t==="("&&r++,t===")"&&r--;return r}import{basename as pt}from"path";function fe(e,r,t){let s=g(e,r);return s?mt(e,r,s):N(t,/^[ \t]*(require_relative|require)\s+["']([^"']+)["']\s*$/gm,(n,i)=>{let o=n[1],a=n[2];if(!o||!a)return[];let c=o==="require_relative"?U(e,r,a):null;if(c){let p=ge(a);return[{importedName:p,localName:p,sourcePath:c,kind:"named",used:S(i,p),usedMembers:[]}]}return[{importedName:a,localName:null,sourcePath:c,kind:"side-effect",used:!0,usedMembers:[]}]})}function mt(e,r,t){let s=f(t,new Set([])),n=[],i=new Set(["require","require_relative","load"]);for(let o of t.rootNode.descendantsOfType("call")){let a=o.namedChild(0);if(!a||a.type!=="identifier"||!i.has(a.text))continue;let p=o.namedChildren.find(d=>d.type==="argument_list")?.namedChild(0);if(!p||p.type!=="string")continue;let m=p.namedChildren.find(d=>d.type==="string_content")?.text;if(!m)continue;let l=a.text==="require_relative"?U(e,r,m):null;if(l){let d=ge(m);n.push({importedName:d,localName:d,sourcePath:l,kind:"named",used:s.has(d),usedMembers:[]})}else n.push({importedName:m,localName:null,sourcePath:l,kind:"side-effect",used:!0,usedMembers:[]})}return n}function ge(e){return pt(e).replace(/\.[^.]+$/,"").split("_").filter(Boolean).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")}function he(e,r,t){let s=g(e,r);return s?ut(e,r,s):N(t,/^[ \t]*use\s+(.+?)\s*;$/gm,(n,i)=>{let o=n[1]?.trim();return o?lt(e,r,o,i):[]})}function ut(e,r,t){let s=f(t,new Set(["use_declaration"])),n=[];for(let i of t.rootNode.descendantsOfType("use_declaration")){let o=i.namedChild(0);if(o)for(let a of L(o,"")){if(!a.importedName||a.importedName==="*")continue;let c=_(e,r,a.qualifiedName)??_(e,r,a.qualifiedName.split("::").slice(0,-1).join("::"));n.push({importedName:a.importedName,localName:a.localName,sourcePath:c,kind:"named",used:s.has(a.localName),usedMembers:[]})}}return n}function L(e,r){switch(e.type){case"identifier":case"super":case"self":case"crate":{let t=e.text;return[{qualifiedName:v(r,t),importedName:t,localName:t}]}case"scoped_identifier":{let t=e.text,s=t.split("::").pop()??t;return[{qualifiedName:v(r,t),importedName:s,localName:s}]}case"scoped_use_list":{let t=e.namedChild(0),s=e.namedChild(1);if(!t||!s)return[];let n=v(r,t.text),i=[];for(let o of s.namedChildren)i.push(...L(o,n));return i}case"use_list":{let t=[];for(let s of e.namedChildren)t.push(...L(s,r));return t}case"use_as_clause":{let t=e.namedChild(0),s=e.namedChild(1);if(!t||!s)return[];let n=L(t,r),i=s.text;return n.map(o=>({...o,localName:i}))}case"use_wildcard":{let t=e.namedChild(0),s=t?t.text:"";return[{qualifiedName:v(r,`${s}::*`),importedName:"*",localName:"*"}]}default:return[]}}function v(e,r){return e?r?`${e}::${r}`:e:r}function lt(e,r,t,s){let n=t.trim();if(n.includes("{")&&n.includes("}")){let u=n.slice(0,n.indexOf("{")).replace(/::$/,"").trim(),m=n.slice(n.indexOf("{")+1,n.lastIndexOf("}")).trim();return x(m).flatMap(l=>{let d=l.trim();if(!d||d==="self")return[];let[I,R]=d.split(/\s+as\s+/),D=I?.trim();if(!D)return[];let ye=(R??D.split("::").pop()??D).trim(),Ne=`${u}::${D}`.replace(/::::/g,"::");return[P(e,r,s,Ne,D.split("::").pop()??D,ye,_(e,r,u))]})}let[i,o]=n.split(/\s+as\s+/),a=i?.trim()??n,c=(o??a.split("::").pop()??a).trim(),p=_(e,r,a)??_(e,r,a.split("::").slice(0,-1).join("::"));return[P(e,r,s,a,a.split("::").pop()??a,c,p)]}function Se(e,r,t){let s=g(e,r);if(s)return dt(e,r,s);let n=[];for(let i of t.matchAll(/^[ \t]*pub\s+use\s+(.+?)\s*;$/gm)){let o=i[1]?.trim();o&&n.push(...gt(e,r,o))}return n}function dt(e,r,t){let s=[];for(let n of t.rootNode.descendantsOfType("use_declaration")){if(!ft(n))continue;let i=n.namedChildren.find(o=>o.type!=="visibility_modifier");if(i)for(let o of L(i,""))o.importedName&&s.push(F(e,r,o.qualifiedName))}return s}function ft(e){for(let r of e.children)if(r.type==="visibility_modifier"&&r.text.startsWith("pub"))return!0;return!1}function gt(e,r,t){let s=t.trim();if(s.includes("{")&&s.includes("}")){let n=s.slice(0,s.indexOf("{")).replace(/::$/,"").trim(),i=s.slice(s.indexOf("{")+1,s.lastIndexOf("}")).trim();return x(i).flatMap(o=>{let a=o.trim();if(!a||a==="self")return[];let[c]=a.split(/\s+as\s+/),p=`${n}::${c?.trim()??a}`.replace(/::::/g,"::");return[F(e,r,p)]})}return[F(e,r,s)]}function F(e,r,t){return{specifier:t,sourcePath:_(e,r,t)??_(e,r,t.split("::").slice(0,-1).join("::"))}}function xe(e,r){let t=r.toLowerCase();for(let s of e)for(let n of s.extensions)if(t.endsWith(n))return s;return null}var ht={language:"javascript",extensions:[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue"],parseImports:te},St={language:"python",extensions:[".py",".pyi"],parseImports:de},xt={language:"jvm",extensions:[".java",".scala",".kt",".kts"],parseImports:ce},yt={language:"rust",extensions:[".rs"],parseImports:he,parseExports:Se},Nt={language:"ruby",extensions:[".rb"],parseImports:fe},It={language:"c/cpp",extensions:[".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx"],parseImports:ne},Pt={language:"dotnet",extensions:[".cs",".vb"],parseImports:ae},bt={language:"dart",extensions:[".dart"],parseImports:oe,parseExports:ie},_t={language:"php",extensions:[".php"],parseImports:me},Ct=[ht,St,xt,yt,Nt,It,Pt,bt,_t];function V(e){return xe(Ct,e)}function Ur(e,r){return re(e,r)}var Et=$("source-imports"),Rt=$("source-exports");function Br(e,r){let t=J(r);return Et.get(e,t,()=>{let s=V(t);if(!s)return[];let n=k(e,t);return n?s.parseImports(e,t,n):[]})}function Wr(e,r){let t=J(r);return Rt.get(e,t,()=>{let s=V(t);if(!s?.parseExports)return[];let n=k(e,t);return n?s.parseExports(e,t,n):[]})}export{Y as a,Dt as b,G as c,Ur as d,Br as e,Wr as f};
|
|
5
|
+
//# sourceMappingURL=chunk-KW2F3WSV.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function t(e){let r=e.replace(/\\/g,"/").split("/").filter(Boolean);return r.length<=1?"(root)":r.length>=3&&["src","lib","app","server","client"].includes(r[0])?`${r[0]}/${r[1]}`:r[0]}function l(e,n){if(e===n)return"ok";let r=s(e),o=s(n);return r&&o?i(r,o)?"ok":"violation":a(e,n)}function c(e,n){let r=s(t(e)),o=s(t(n));return!!r&&!!o}function s(e){return/^src\/([^/]+)$/.exec(e)?.[1]??null}function i(e,n){return n==="domain"?!0:e==="domain"?!1:{analysis:new Set(["domain","source","storage","symbols"]),core:new Set(["analysis","domain","resolution","source","storage","symbols"]),"language-parsers":new Set(["domain","resolution","source","storage"]),queries:new Set(["analysis","core","domain","language-parsers","resolution","semantic","source","storage","symbols"]),reindex:new Set(["domain","language-parsers","resolution","runtime","source","storage","symbols"]),resolution:new Set(["domain","source","storage","symbols"]),runtime:new Set(["domain","queries","reindex","resolution","source","storage","symbols"]),semantic:new Set(["domain","resolution","storage","symbols"]),source:new Set(["domain","storage"]),storage:new Set(["domain","source"]),symbols:new Set(["analysis","domain","language-parsers","resolution","semantic","source","storage"])}[e]?.has(n)??!1}function a(e,n){if(n==="shared")return"ok";let r={app:new Set(["core","shared","ui"]),core:new Set(["shared"]),infra:new Set(["core","shared"]),ui:new Set(["core","shared"])};return r[e]?r[e].has(n)?"ok":"violation":null}export{t as a,l as b,c};
|
|
2
|
+
//# sourceMappingURL=chunk-LJ2YWNQF.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{a as p}from"./chunk-ZHHMG4UC.js";import{existsSync as f}from"fs";import{basename as u,isAbsolute as g,join as d}from"path";function S(t,o){let e=h(t,o,{allowMultiple:!1})[0]?.relativePath;return e||v(t,o)}function b(t,o){return h(t,o,{allowMultiple:!0}).map(e=>e.relativePath)}function v(t,o){if(!o)return null;let e=o.replace(/\\/g,"/").replace(/^\.\//,""),i=g(e)&&e.startsWith(t.config.projectRoot)?e.slice(t.config.projectRoot.length).replace(/^\/+/,""):e,n=d(t.config.projectRoot,i);return f(n)?i:null}function h(t,o,e){let i=m(o);if(!i)return[];let a=t.all(`SELECT relative_path
|
|
2
|
+
FROM documents
|
|
3
|
+
WHERE 1 = 1
|
|
4
|
+
${t.pathExclusionsFor("documents")}
|
|
5
|
+
ORDER BY relative_path`).filter(r=>!t.isIgnored(r.relative_path)).map(r=>({relativePath:r.relative_path,score:x(r.relative_path,i)})).filter(r=>r.score>0).sort((r,c)=>c.score-r.score||r.relativePath.localeCompare(c.relativePath));if(a.length===0){let r=p(t,o);return!r||t.isIgnored(r.relativePath)?[]:[{relativePath:r.relativePath,score:700}]}let s=a.filter(r=>r.score>=1100);if(s.length>0)return e.allowMultiple?s:[s[0]];let l=a.filter(r=>r.score>=800);return l.length>0?e.allowMultiple?l:[l[0]]:e.allowMultiple?a:[a[0]]}function x(t,o){let e=m(t),i=u(e),n=u(o),a=0;return e===o&&(a+=1200),e.endsWith(`/${o}`)&&(a+=1100),i===n&&(a+=900),e.startsWith(`${o}/`)&&(a+=850),e.includes(o)&&(a+=250),a}function m(t){return t.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}export{S as a,b};
|
|
6
|
+
//# sourceMappingURL=chunk-MO65UK5V.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{b as
|
|
1
|
+
import{b as m}from"./chunk-MO65UK5V.js";import{D as o}from"./chunk-QFZE73XF.js";function y(t,l){let s=m(t,l);if(s.length===0)return{files:[],symbols:[],dependsOn:[],dependedOnBy:[]};let d=s.map(()=>"?").join(", "),i=t.all(`SELECT relative_path FROM documents
|
|
2
2
|
WHERE relative_path IN (${d})
|
|
3
|
-
ORDER BY relative_path`,...s).map(e=>e.relative_path).filter(e=>!t.isIgnored(e)),
|
|
3
|
+
ORDER BY relative_path`,...s).map(e=>e.relative_path).filter(e=>!t.isIgnored(e)),a=o(t,i,{onlyDocumented:!0,sort:!0}).map(({relativePath:e,...c})=>c),n=t.all(`SELECT DISTINCT d2.relative_path
|
|
4
4
|
FROM mentions m
|
|
5
5
|
JOIN chunks c ON m.chunk_id = c.id
|
|
6
6
|
JOIN documents d1 ON c.document_id = d1.id
|
|
@@ -31,5 +31,5 @@ import{b as o}from"./chunk-4HCKXL7T.js";import{s as m}from"./chunk-QL5MJOVA.js";
|
|
|
31
31
|
JOIN documents d2 ON sym_def.document_id = d2.id
|
|
32
32
|
WHERE d2.relative_path IN (${d})
|
|
33
33
|
AND d1.relative_path NOT IN (${d})
|
|
34
|
-
ORDER BY d1.relative_path`,...s,...s).map(e=>e.relative_path).filter(e=>!t.isIgnored(e));return{files:i,symbols:
|
|
35
|
-
//# sourceMappingURL=chunk-
|
|
34
|
+
ORDER BY d1.relative_path`,...s,...s).map(e=>e.relative_path).filter(e=>!t.isIgnored(e));return{files:i,symbols:a,dependsOn:n,dependedOnBy:r}}export{y as a};
|
|
35
|
+
//# sourceMappingURL=chunk-MXWC53GJ.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as w}from"./chunk-UAPNU7UP.js";import{d as D}from"./chunk-KW2F3WSV.js";import{a as S,d as p,f as C,h as x,j as I,n as L,o as v,p as d}from"./chunk-QFZE73XF.js";function le(n,e){let{scope:t,minLoc:i=3,maxLoc:s=80,limit:r=30,includeLowConfidence:a=!1}=e??{},o=new w(n),l=o.scopedDefinitions(t),u=K(o,t),f=A(n,o,l,{minLoc:i,maxLoc:s}),m=$(o,f),g=E(n,o,l,f),T=_(f);return B(n,f,m,T).filter(c=>!g.has(c.definition.symbolId)).filter(c=>!c.transitivelyReachable).filter(c=>c.realConsumers.length<=1).filter(c=>!(c.realConsumers.length===0&&c.barrelConsumers>0)).filter(c=>W(c.definition,c.realConsumers.length,u)).map(c=>N(n,c)).filter(c=>a||c.confidence!=="low").sort((c,b)=>{let h={high:0,medium:1,low:2};return h[c.confidence]-h[b.confidence]||b.loc-c.loc||c.file.localeCompare(b.file)||c.startLine-b.startLine}).slice(0,r)}function A(n,e,t,i){return t.filter(s=>s.isTypeLike&&y(s)>=i.minLoc).filter(s=>y(s)<=i.maxLoc).filter(s=>!n.isIgnored(s.relativePath)).filter(s=>!V(s.symbol)).filter(s=>!e.hasSuppressionComment(s))}function $(n,e){return R(n.crossFileCallerMap(e),n.sourceFallbackCallerFiles(e))}function _(n){let e=new Map;for(let t of n){let i=e.get(t.relativePath);i||(i=new Map,e.set(t.relativePath,i));let s=d(t.symbol);s&&i.set(s,t)}return e}function B(n,e,t,i){return e.map(s=>{let a=[...t.get(s.symbolId)??new Set].filter(f=>f!==s.relativePath&&!n.isIgnored(f)),{realConsumers:o,barrelConsumers:l}=G(n,s.relativePath,s.symbol,a),u=Z(n,s,t,i);return{definition:s,realConsumers:o,barrelConsumers:l,transitivelyReachable:u}})}function N(n,e){let t=k(n,e.definition.relativePath,e.definition.startLine),i=P(e.definition.relativePath)?!0:X(n,e.definition),{confidence:s,reason:r}=Y(e.realConsumers.length,t,i);return{symbol:e.definition.symbol,shortName:v(e.definition.symbol),file:e.definition.relativePath,startLine:e.definition.startLine,endLine:e.definition.endLine,loc:y(e.definition),consumers:e.realConsumers.length,barrelConsumers:e.barrelConsumers,kind:t,definerUsesType:i,confidence:s,reason:r}}function E(n,e,t,i){let s=O(n,j(t),i),r=s.map(l=>l.singleton);if(s.length===0)return new Set;let a=R(e.crossFileCallerMap(r),e.sourceFallbackCallerFiles(r)),o=new Set;for(let{singleton:l,classId:u}of s)z(n,l,a)&&o.add(u);return o}function j(n){let e=new Map;for(let t of n){let i=d(t.symbol);i&&e.set(M(t.relativePath,i),t)}return e}function O(n,e,t){let i=[];for(let s of t){let r=U(n,e,s);r&&i.push({singleton:r,classId:s.symbolId})}return i}function U(n,e,t){if(k(n,t.relativePath,t.startLine)!=="class")return null;let i=d(t.symbol);if(!i)return null;let s=H(n,t.relativePath,i);return s?e.get(M(t.relativePath,s))??null:null}function z(n,e,t){let i=d(e.symbol),s=t.get(e.symbolId);return!i||!s?!1:[...s].some(r=>r!==e.relativePath&&!n.isIgnored(r)&&!F(n,r,i))}function M(n,e){return`${n}\0${e}`}function H(n,e,t){let i=p(n,e);if(!i)return null;let s=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\bexport\\s+const\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*new\\s+${s}\\s*\\(`);return i.match(r)?.[1]??null}function K(n,e){return new Set(n.scopedDefinitions(e).filter(t=>t.isFunctionLike).map(t=>t.relativePath))}function V(n){let e=L(n);if("kind"in e)return!1;let t=e.descriptors;if(t.length<2)return!1;let i=t[t.length-1],s=t[t.length-2];return i?.suffix==="type"&&s?.suffix==="type"}function P(n){let t=(n.split("/").pop()??"").replace(/\.[^.]+$/,"");return!!(t==="types"||t==="models"||t==="schema"||t==="common"||t==="protocol"||t==="proto"||t==="dto"||t==="mod"||/(^|\/)types(\/|\.)/.test(n)||/(^|\/)models?(\/|\.)/.test(n)||/(^|\/)proto(?:col)?(\/|\.)/.test(n)||/(^|\/)schema(\/|\.)/.test(n))}function W(n,e,t){return!(P(n.relativePath)&&e>0||e===0&&t.has(n.relativePath))}function G(n,e,t,i){let s=[],r=0,a=d(t);for(let o of i)Q(n,o,e,a)||F(n,o,a)?r++:s.push(o);return{realConsumers:s,barrelConsumers:r}}function Z(n,e,t,i){let s=I(n,e.relativePath),r=d(e.symbol);if(!r)return!1;let a=s.get(r);if(!a||a.size===0)return!1;let o=i.get(e.relativePath);if(!o)return!1;for(let l of a){let u=o.get(l);if(!u)continue;let f=t.get(u.symbolId);if(f){for(let m of f)if(m!==e.relativePath&&!n.isIgnored(m))return!0}}return!1}var q=S("stale-abs-file-usage");function F(n,e,t){if(!t)return!1;let i=C(e);if(!i)return!1;let s=q.get(n,e,()=>J(n,e,i));return s.importedLeaves.has(t)&&!s.usedLeaves.has(t)}function J(n,e,t){let i=new Set,s=new Set,r=x(n,e);if(!r)return{importedLeaves:i,usedLeaves:s};let a=t==="rust"?new Set(["use_declaration"]):t==="python"?new Set(["import_statement","import_from_statement"]):new Set(["import_statement"]),o=(l,u)=>{let f=u||a.has(l.type);(l.type==="identifier"||l.type==="type_identifier"||l.type==="property_identifier"||l.type==="field_identifier")&&(f?i.add(l.text):s.add(l.text));for(let m of l.children)o(m,f)};return o(r.rootNode,!1),{importedLeaves:i,usedLeaves:s}}function Q(n,e,t,i){if(!i)return!1;let s=p(n,e);if(!s)return!1;let r=D(n,e);if(r.length===0)return!1;let a=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`\\b${a}\\b`),l=s.split(`
|
|
2
|
+
`),u=0;for(let f=0;f<l.length;f++){if(!o.test(l[f]??""))continue;if(u++,!r.find(g=>g.startLine<=f&&f<=g.endLine))return!1}return u>0}function k(n,e,t){let i=p(n,e);if(!i)return"other";let s=i.split(`
|
|
3
|
+
`),r=Math.max(0,t-2),a=Math.min(s.length-1,t+2);for(let o=r;o<=a;o++){let u=(s[o]??"").replace(/^\s*\/\/.*$/g,"");if(/\b(?:export\s+)?(?:abstract\s+)?class\s+\w/.test(u))return"class";if(/\b(?:export\s+)?interface\s+\w/.test(u))return"interface";if(/\b(?:export\s+)?type\s+\w/.test(u))return"type";if(/\b(?:export\s+)?(?:const\s+)?enum\s+\w/.test(u))return"enum"}return"other"}function X(n,e){let t=p(n,e.relativePath);if(!t)return!1;let i=d(e.symbol);if(!i)return!1;let s=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\b${s}\\b`),a=t.split(`
|
|
4
|
+
`);for(let o=0;o<a.length;o++)if(!(o>=e.startLine&&o<=e.endLine)&&r.test(a[o]??""))return!0;return!1}function Y(n,e,t){return n===0?{confidence:"high",reason:"unused \u2014 no consumers and defining file has no real usage"}:n===1&&e==="class"?{confidence:"low",reason:"1 consumer + class kind \u2014 likely 1:1 encapsulation, not over-abstraction"}:n===1&&!t?{confidence:"high",reason:"1 consumer + defining file never uses it \u2014 type belongs with its consumer"}:{confidence:"medium",reason:"1 consumer \u2014 single-use abstraction"}}function y(n){return n.endLine-n.startLine+1}function R(...n){let e=new Map;for(let t of n)for(let[i,s]of t){let r=e.get(i);r||(r=new Set,e.set(i,r));for(let a of s)r.add(a)}return e}export{le as a};
|
|
5
|
+
//# sourceMappingURL=chunk-NIN762LD.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{g as y}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{g as y}from"./chunk-3PVIYZ74.js";function L(D,k={}){let{limit:x=10,scope:M,minDepth:j=3}=k,a=y(D,M),u=new Map,o=[],l=new Map,r=new Map,g=new Set,f=[],d=0;for(let t of a.keys()){if(l.has(t))continue;let n=[],s=(a.get(t)??new Set).values();for(l.set(t,d),r.set(t,d),d+=1,f.push(t),g.add(t),n.push({node:t,iter:s,pendingChild:null});n.length>0;){let e=n[n.length-1];if(e.pendingChild!==null){let h=e.pendingChild;e.pendingChild=null,r.set(e.node,Math.min(r.get(e.node),r.get(h)))}let c=e.iter.next();if(c.done){if(r.get(e.node)===l.get(e.node)){let h=[];for(;;){let p=f.pop();if(g.delete(p),h.push(p),u.set(p,o.length),p===e.node)break}o.push(h)}n.pop();continue}let i=c.value;if(l.has(i))g.has(i)&&r.set(e.node,Math.min(r.get(e.node),l.get(i)));else{l.set(i,d),r.set(i,d),d+=1,f.push(i),g.add(i);let h=(a.get(i)??new Set).values();e.pendingChild=i,n.push({node:i,iter:h,pendingChild:null})}}}let m=new Map,b=new Array(o.length);for(let t=0;t<o.length;t++)b[t]=o[t].length,m.set(t,new Set);for(let[t,n]of a){let s=u.get(t);for(let e of n){let c=u.get(e);c!==s&&m.get(s).add(c)}}let S=new Array(o.length),I=new Array(o.length);for(let t=0;t<o.length;t++){let n=[],s=0;for(let e of m.get(t)){let c=I[e];c>s&&(s=c,n=S[e])}S[t]=[t,...n],I[t]=b[t]+s}function v(t){return S[t]}let A=o.map(t=>[...t].sort()),C=new Set,w=[];for(let t=0;t<o.length;t++){let n=v(t),s=[];for(let c of n)s.push(...A[c]);if(s.length<j)continue;let e=s.join(" ");C.has(e)||(C.add(e),w.push({chain:s,depth:s.length}))}return w.sort((t,n)=>n.depth-t.depth),w.slice(0,x)}export{L as a};
|
|
2
|
+
//# sourceMappingURL=chunk-O6VBAW7P.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
WHERE id = ? LIMIT 1`,
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as d}from"./chunk-ZHHMG4UC.js";import{n as g,o as m}from"./chunk-QFZE73XF.js";function S(n,f){let a=d(n,f);if(!a)return[];let t=n.get(`SELECT symbol, enclosing_symbol FROM global_symbols
|
|
2
|
+
WHERE id = ? LIMIT 1`,a.symbolId);if(!t)return[];let o=[{symbol:t.symbol,shortName:m(t.symbol),depth:0}],e=t.enclosing_symbol,r=1,c=new Set([t.symbol]);for(;e&&!c.has(e)&&r<20;){c.add(e);let s=n.get("SELECT symbol, enclosing_symbol FROM global_symbols WHERE symbol = ?",e);if(!s)break;o.push({symbol:s.symbol,shortName:m(s.symbol),depth:r}),e=s.enclosing_symbol,r++}if(o.length>1)return o;let y=g(t.symbol);if("kind"in y)return o;let l=y.descriptors;if(l.length<=1)return o;let b=[o[0]];for(let s=l.length-2,p=1;s>=0;s--,p++){let h=l.slice(0,s+1).map(i=>i.suffix==="method"?`${i.name}()`:i.name.replace(/\.(ts|tsx|js|jsx|mjs|cjs|py|pyi|rs|java|scala|kt|kts|rb|go|cs|vb|dart|php|c|cc|cpp|cxx|h|hpp)$/,"")).join(":");b.push({symbol:h,shortName:h,depth:p})}return b}export{S as a};
|
|
3
|
+
//# sourceMappingURL=chunk-OQZF2DQJ.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as p,b as g}from"./chunk-YXMHTJYY.js";import{g as B}from"./chunk-3PVIYZ74.js";function w(s,e={}){let{scope:r,maxDepth:c=10}=e,n=B(s,r),i=[],a=new Set,l=new Set,f=[];function y(t,o){if(o>c)return;if(l.has(t)){let h=f.indexOf(t);if(h!==-1){let u=f.slice(h).concat(t),m=u.indexOf(u.reduce(($,x)=>$<x?$:x)),d=[...u.slice(m,-1),...u.slice(0,m),u[m]],S=d.join(" -> ");b.has(S)||(b.add(S),i.push({path:d,kind:R(d)}))}return}if(a.has(t))return;a.add(t),l.add(t),f.push(t);let k=n.get(t);if(k)for(let h of k)y(h,o+1);f.pop(),l.delete(t)}let b=new Set;for(let t of n.keys())a.has(t)||y(t,0);return i.sort((t,o)=>t.kind!==o.kind?t.kind==="real"?-1:1:t.path.length-o.path.length),i}function R(s){for(let c of s){let n=p(c);if(n==="test"||n==="barrel"||n==="entry")return"module-hierarchy"}if(s.length!==3)return"real";let[e,r]=s;return!e||!r?"real":g(e)||g(r)||C(e,r)||C(r,e)||D(e,r)||D(r,e)||p(e)==="entry"||p(r)==="entry"?"module-hierarchy":"real"}function C(s,e){if(!/\.rs$/.test(s)||!/\.rs$/.test(e))return!1;let r=e.replace(/\.rs$/,"/");return s.startsWith(r)?!s.slice(r.length).includes("/"):!1}function D(s,e){if(!/\.rs$/.test(s)||!/\.rs$/.test(e))return!1;let r=s.replace(/\.rs$/,""),c=e.replace(/\.rs$/,"");if(r===c+"_tests"||r===c+"/tests")return!0;let n=s.split("/"),i=e.split("/");if(n.length===i.length&&n.includes("tests")&&i.includes("src")){let a=n[n.length-1],l=i[i.length-1];if(a&&a===l)return!0}return!1}export{w as a};
|
|
2
|
+
//# sourceMappingURL=chunk-PIRXZGV6.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as m}from"./chunk-
|
|
1
|
+
import{a as m}from"./chunk-MO65UK5V.js";function r(e,o,n){let d=m(e,o)??o,s=m(e,n)??n,t=e.get(`SELECT COUNT(DISTINCT gs.id) AS shared
|
|
2
2
|
FROM global_symbols gs
|
|
3
3
|
WHERE (
|
|
4
4
|
-- Defined in file1, referenced in file2
|
|
@@ -30,7 +30,7 @@ import{a as m}from"./chunk-4HCKXL7T.js";function c(e,n,o){let d=m(e,n)??n,s=m(e,
|
|
|
30
30
|
JOIN documents d ON c.document_id = d.id
|
|
31
31
|
WHERE m.symbol_id = gs.id AND m.role != 1 AND d.relative_path = ?
|
|
32
32
|
)
|
|
33
|
-
)`,d,s,s,d);return{file1:d,file2:s,sharedSymbols:t?.shared??0}}function
|
|
33
|
+
)`,d,s,s,d);return{file1:d,file2:s,sharedSymbols:t?.shared??0}}function c(e,o={}){let{limit:n=20,scope:d}=o,s=d?`AND d1.relative_path LIKE '%${d}%' AND d2.relative_path LIKE '%${d}%'`:"";return e.all(`SELECT
|
|
34
34
|
def_d.relative_path AS file1,
|
|
35
35
|
ref_d.relative_path AS file2,
|
|
36
36
|
COUNT(DISTINCT gs.id) AS shared
|
|
@@ -52,5 +52,5 @@ import{a as m}from"./chunk-4HCKXL7T.js";function c(e,n,o){let d=m(e,n)??n,s=m(e,
|
|
|
52
52
|
${s}
|
|
53
53
|
GROUP BY def_d.id, ref_d.id
|
|
54
54
|
ORDER BY shared DESC
|
|
55
|
-
LIMIT ?`,
|
|
56
|
-
//# sourceMappingURL=chunk-
|
|
55
|
+
LIMIT ?`,n).filter(i=>!e.isIgnored(i.file1)&&!e.isIgnored(i.file2)).map(i=>({file1:i.file1,file2:i.file2,sharedSymbols:i.shared}))}export{r as a,c as b};
|
|
56
|
+
//# sourceMappingURL=chunk-Q2ALKKSE.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{a as m}from"./chunk-UAPNU7UP.js";import{a as l}from"./chunk-ZHHMG4UC.js";import{o as a}from"./chunk-QFZE73XF.js";import{readFileSync as f}from"fs";import{join as u}from"path";function I(e,n){let t=l(e,n);if(!t)return null;let i=new m(e),c=S(h(e,t.relativePath,t.startLine,t.endLine),p(e,t.relativePath)),o=t.endLine-t.startLine+1,r=i.calleeMap([t],{additive:!0}).get(t.symbolId)??[],b=new Set(r.map(g=>g.symbol));return{symbol:t.symbol,shortName:a(t.symbol),relativePath:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:o,branches:c,cyclomaticEstimate:c+1,calleeCount:b.size,fanIn:y(e,t.symbolId),fanOut:d(r,t.relativePath)}}function p(e,n){return e.get("SELECT language FROM documents WHERE relative_path = ?",n)?.language??"unknown"}function h(e,n,t,i){try{return f(u(e.config.projectRoot,n),"utf-8").split(`
|
|
2
|
+
`).slice(t,i+1).join(`
|
|
3
|
+
`)}catch{return""}}function y(e,n){return e.get(`SELECT COUNT(DISTINCT c.document_id) AS c
|
|
4
|
+
FROM mentions m
|
|
5
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
6
|
+
WHERE m.symbol_id = ? AND m.role != 1`,n)?.c??0}function d(e,n){return new Set(e.filter(t=>t.file!==n).map(t=>t.symbol)).size}function S(e,n){let t=P(e),i=0,c=[/\bif\b/g,/\belse\s+if\b/g,/\belse\b/g,/\bfor\b/g,/\bwhile\b/g,/\bswitch\b/g,/\bcase\b/g,/\bcatch\b/g,/\?\s*[^?]/g,/&&/g,/\|\|/g];for(let o of c){let s=t.match(o);s&&(i+=s.length)}if(n==="python"){let o=[/\belif\b/g,/\bexcept\b/g,/\bfinally\b/g];for(let s of o){let r=t.match(s);r&&(i+=r.length)}}else if(n==="rust"){let o=[/\bmatch\b/g,/=>/g,/\bloop\b/g];for(let s of o){let r=t.match(s);r&&(i+=r.length)}}else if(n==="ruby"){let o=[/\belsif\b/g,/\bunless\b/g,/\brescue\b/g,/\bwhen\b/g];for(let s of o){let r=t.match(s);r&&(i+=r.length)}}else if(n==="go"){let o=[/\bselect\b/g,/\bdefer\b/g];for(let s of o){let r=t.match(s);r&&(i+=r.length)}}return i}function P(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/.*/g,"").replace(/#.*/g,"").replace(/"(?:[^"\\]|\\.)*"/g,'""').replace(/'(?:[^'\\]|\\.)*'/g,"''").replace(/`(?:[^`\\]|\\.)*`/g,"``")}export{I as a};
|
|
7
|
+
//# sourceMappingURL=chunk-Q4R2IYA3.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as d}from"./chunk-
|
|
1
|
+
import{i as d}from"./chunk-3PVIYZ74.js";import{B as l,o as m}from"./chunk-QFZE73XF.js";function y(o,t={}){let{limit:s=30,scope:e}=t,n=e?`AND def_d.relative_path LIKE '%${e}%'`:"",r=o.all(`SELECT
|
|
2
2
|
gs.symbol,
|
|
3
3
|
COUNT(*) AS ref_count,
|
|
4
4
|
COUNT(DISTINCT ref_d.id) AS file_count,
|
|
@@ -21,5 +21,5 @@ import{i as d}from"./chunk-FT4WPAEX.js";import{q as l}from"./chunk-QL5MJOVA.js";
|
|
|
21
21
|
${n}
|
|
22
22
|
GROUP BY gs.id
|
|
23
23
|
ORDER BY ref_count DESC
|
|
24
|
-
LIMIT ?`,s).filter(i=>!o.isIgnored(i.defined_in)).map(i=>({symbol:i.symbol,shortName:
|
|
25
|
-
//# sourceMappingURL=chunk-
|
|
24
|
+
LIMIT ?`,s).filter(i=>!o.isIgnored(i.defined_in)).map(i=>({symbol:i.symbol,shortName:m(i.symbol),refCount:i.ref_count,fileCount:i.file_count,definedIn:i.defined_in}));return r.length>0?r:f(o,e,s)}function f(o,t,s){return l(o,{scope:t}).filter(e=>!o.isIgnored(e.relativePath)).map(e=>u(o,e)).filter(e=>e.refCount>0).sort((e,n)=>n.refCount-e.refCount||n.fileCount-e.fileCount).slice(0,s)}function u(o,t){let s=d(o,t,{limit:500});return{symbol:t.symbol,shortName:m(t.symbol),refCount:s.length,fileCount:new Set(s.map(e=>e.file)).size,definedIn:t.relativePath}}export{y as a};
|
|
25
|
+
//# sourceMappingURL=chunk-QFBJZHMV.js.map
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
function h(e){let n=new WeakMap,t=r=>{let i=n.get(r);return i||(i=new Map,n.set(r,i)),i};return{get(r,i,a){let s=t(r);if(s.has(i))return s.get(i);let c=a();return s.set(i,c),c},invalidate(r,i){n.get(r)?.delete(i)},invalidateAll(r){n.delete(r)},size(r){return n.get(r)?.size??0}}}function Fe(e){let n=new WeakMap;return{get(t,r){let i=n.get(t);if(i)return i.value;let a=r();return n.set(t,{value:a}),a},invalidate(t){n.delete(t)},has(t){return n.has(t)}}}function I(e){let n=new WeakMap,t=r=>{let i=n.get(r);return i||(i=new Map,n.set(r,i)),i};return{get(r,i,a,s){let c=t(r),o=c.get(i);if(o&&o.source===a)return o.value;let l=s();return c.set(i,{source:a,value:l}),l},invalidate(r,i){n.get(r)?.delete(i)},invalidateAll(r){n.delete(r)}}}import{existsSync as K,readFileSync as G}from"fs";import{join as q}from"path";var J=h("source-text");function m(e,n){let t=n.replace(/\\/g,"/");return J.get(e,t,()=>{let r=q(e.config.projectRoot,t);return K(r)?G(r,"utf-8"):""})}var X=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale|wrapper|passthrough|drift|extract)?/i;function Be(e,n,t){if(t<=0)return!1;let r=m(e,n);if(!r)return!1;let i=r.split(`
|
|
2
|
+
`);for(let a=t-1;a>=0&&a>=t-5;a-=1){let s=(i[a]??"").trim();if(s!==""){if(X.test(s))return!0;if(!s.startsWith("//")&&!s.startsWith("*")&&!s.startsWith("/*")&&!s.startsWith("@")&&!s.startsWith("#"))return!1}}return!1}import{extname as N}from"path";import{createRequire as Z}from"module";var f=Z(import.meta.url),x=null,M=!1;function T(){if(M)return null;if(x)return x;try{return x=f("tree-sitter"),x}catch{return M=!0,null}}var ee={".rs":"rust",".ts":"typescript",".mts":"typescript",".cts":"typescript",".tsx":"tsx",".js":"javascript",".jsx":"javascript",".mjs":"javascript",".cjs":"javascript",".py":"python",".pyi":"python",".java":"java",".kt":"kotlin",".kts":"kotlin",".scala":"scala",".sc":"scala",".rb":"ruby",".c":"c",".h":"c",".cc":"cpp",".cpp":"cpp",".cxx":"cpp",".hpp":"cpp",".hh":"cpp",".hxx":"cpp",".cs":"csharp",".php":"php",".vb":"vb"},A=new Map,L=new Set;function E(e){if(L.has(e))return null;let n=A.get(e);if(n)return n;let t;try{switch(e){case"rust":t=f("tree-sitter-rust");break;case"typescript":t=f("tree-sitter-typescript").typescript;break;case"tsx":t=f("tree-sitter-typescript").tsx;break;case"javascript":t=f("tree-sitter-javascript");break;case"python":t=f("tree-sitter-python");break;case"java":t=f("tree-sitter-java");break;case"kotlin":t=f("tree-sitter-kotlin");break;case"scala":t=f("tree-sitter-scala");break;case"ruby":t=f("tree-sitter-ruby");break;case"c":t=f("tree-sitter-c");break;case"cpp":t=f("tree-sitter-cpp");break;case"csharp":t=f("tree-sitter-c-sharp");break;case"php":t=f("tree-sitter-php").php;break;case"vb":{let r=f("tree-sitter-vb-dotnet");t=r.language??r;break}}}catch{return L.add(e),null}return A.set(e,t),t}var w=new Map;function P(e){let n=w.get(e);if(n)return n;let t=E(e);if(!t)return null;let r=T();if(!r)return null;let i=new r;try{i.setLanguage(t)}catch{return L.add(e),null}return w.set(e,i),i}function S(e){return ee[N(e).toLowerCase()]??null}function te(e){return N(e).toLowerCase()===".vue"}var O=I("ast-trees");function C(e,n){if(te(n))return ne(e,n);let t=S(n);if(!t)return null;let r=m(e,n);return r?O.get(e,n,r,()=>{let i=P(t);if(!i)return null;try{return $(i,r)}catch{return null}}):null}function ne(e,n){let t=m(e,n);return t?O.get(e,n,t,()=>{let r=re(t);if(!r)return null;let i=P(r.language);if(!i)return null;let a=`
|
|
3
|
+
`.repeat(r.startLine)+r.body;try{return $(i,a)}catch{return null}}):null}function $(e,n){return e.parse(r=>r>=n.length?null:n.slice(r,Math.min(n.length,r+16384)))}function re(e){let n=[],t=/<script\b([^>]*)>([\s\S]*?)<\/script>/g;for(let o of e.matchAll(t))typeof o.index=="number"&&n.push({tagOpen:o[1]??"",body:o[2]??"",openIdx:o.index+(o[0].length-(o[2]?.length??0)-9)});if(n.length===0)return null;let r=n.find(o=>/\bsetup\b/.test(o.tagOpen))??n[0],a=r.tagOpen.match(/\blang\s*=\s*["']?([\w-]+)/)?.[1]?.toLowerCase(),s=a==="ts"||a==="typescript"?"typescript":a==="tsx"?"tsx":"javascript",c=ie(e,r.openIdx);return{body:r.body,startLine:c,language:s}}function ie(e,n){let t=0;for(let r=0;r<n&&r<e.length;r++)e.charCodeAt(r)===10&&t++;return t}var g=new Map;function ae(e,n){let t=`${e}::${n}`;if(g.has(t))return g.get(t)??null;let r=E(e);if(!r)return g.set(t,null),null;let i=T();if(!i)return g.set(t,null),null;try{let a=new i.Query(r,n);return g.set(t,a),a}catch{return g.set(t,null),null}}var se={rust:`
|
|
4
|
+
(function_item name: (identifier) @name) @def
|
|
5
|
+
(function_signature_item name: (identifier) @name) @def
|
|
6
|
+
`,typescript:`
|
|
7
|
+
(function_declaration name: (identifier) @name) @def
|
|
8
|
+
(method_definition name: (property_identifier) @name) @def
|
|
9
|
+
(method_signature name: (property_identifier) @name) @def
|
|
10
|
+
(function_signature name: (identifier) @name) @def
|
|
11
|
+
(variable_declarator name: (identifier) @name value: (arrow_function)) @def
|
|
12
|
+
(variable_declarator name: (identifier) @name value: (function_expression)) @def
|
|
13
|
+
(public_field_definition name: (property_identifier) @name value: (arrow_function)) @def
|
|
14
|
+
`,tsx:`
|
|
15
|
+
(function_declaration name: (identifier) @name) @def
|
|
16
|
+
(method_definition name: (property_identifier) @name) @def
|
|
17
|
+
(method_signature name: (property_identifier) @name) @def
|
|
18
|
+
(function_signature name: (identifier) @name) @def
|
|
19
|
+
(variable_declarator name: (identifier) @name value: (arrow_function)) @def
|
|
20
|
+
(variable_declarator name: (identifier) @name value: (function_expression)) @def
|
|
21
|
+
(public_field_definition name: (property_identifier) @name value: (arrow_function)) @def
|
|
22
|
+
`,javascript:`
|
|
23
|
+
(function_declaration name: (identifier) @name) @def
|
|
24
|
+
(method_definition name: (property_identifier) @name) @def
|
|
25
|
+
(variable_declarator name: (identifier) @name value: (arrow_function)) @def
|
|
26
|
+
(variable_declarator name: (identifier) @name value: (function_expression)) @def
|
|
27
|
+
`,python:`
|
|
28
|
+
(function_definition name: (identifier) @name) @def
|
|
29
|
+
`},oe=new WeakMap;function F(e,n){return j(e,n,oe,se,t=>{let r=[];for(let i of t){let a=null,s=null;for(let c of i.captures)c.name==="name"?a=c.node.text:c.name==="def"&&(s={startLine:c.node.startPosition.row,endLine:c.node.endPosition.row});a&&s&&r.push({name:a,startLine:s.startLine,endLine:s.endLine})}return r})}var ce={rust:`
|
|
30
|
+
(call_expression function: (_) @target) @call
|
|
31
|
+
(macro_invocation macro: (_) @target) @call
|
|
32
|
+
`,typescript:`
|
|
33
|
+
(call_expression function: (_) @target) @call
|
|
34
|
+
(new_expression constructor: (_) @target) @call
|
|
35
|
+
`,tsx:`
|
|
36
|
+
(call_expression function: (_) @target) @call
|
|
37
|
+
(new_expression constructor: (_) @target) @call
|
|
38
|
+
`,javascript:`
|
|
39
|
+
(call_expression function: (_) @target) @call
|
|
40
|
+
(new_expression constructor: (_) @target) @call
|
|
41
|
+
`,python:`
|
|
42
|
+
(call function: (_) @target) @call
|
|
43
|
+
`},le=new WeakMap;function Ge(e,n){return j(e,n,le,ce,t=>{let r=[];for(let i of t){let a=null,s=null;for(let o of i.captures)o.name==="target"?a=o.node:o.name==="call"&&(s=o.node);if(!a||!s)continue;let c=D(a);c&&r.push({calleeLeaf:c,memberAccess:ue(a),line:s.startPosition.row})}return r})}function ue(e){switch(e.type){case"field_expression":case"member_expression":case"attribute":return!0;default:return!1}}function qe(e,n){return de(e,n,fe,()=>new Map,(t,r,i)=>{let a=(o,l)=>{if(o===l)return;let u=i.get(o);u||(u=new Set,i.set(o,u)),u.add(l)},s=r==="python"?new Set(["identifier"]):new Set(["type_identifier"]),c=(o,l)=>{let u=d=>{s.has(d.type)&&d.text!==l&&a(d.text,l);for(let y of d.children)u(y)};for(let d of o.children)u(d)};if(r==="rust")for(let o of t.rootNode.descendantsOfType(["struct_item","enum_item","union_item","type_item"])){let l=o.namedChildren.find(d=>d.type==="type_identifier")?.text;if(!l)continue;let u=o.namedChildren.find(d=>d.type==="field_declaration_list"||d.type==="enum_variant_list"||d.type==="ordered_field_declaration_list");u&&c(u,l),o.type==="type_item"&&c(o,l)}else if(r==="python")for(let o of t.rootNode.descendantsOfType("class_definition")){let l=o.namedChildren.find(d=>d.type==="identifier")?.text;if(!l)continue;let u=o.namedChildren.find(d=>d.type==="block");if(u)for(let d of u.descendantsOfType("type"))for(let y of d.descendantsOfType("identifier"))y.text!==l&&a(y.text,l)}else for(let o of t.rootNode.descendantsOfType(["interface_declaration","type_alias_declaration","class_declaration"])){let l=o.namedChildren.find(u=>u.type==="type_identifier")?.text;l&&c(o,l)}})??new Map}function de(e,n,t,r,i){let a=S(n);if(!a)return null;let s=C(e,n);if(!s)return null;let c=t.get(s);if(c)return c;let o=r();return i(s,a,o),t.set(s,o),o}function j(e,n,t,r,i){let a=S(n);if(!a)return null;let s=r[a];if(!s)return null;let c=C(e,n);if(!c)return null;let o=t.get(c);if(o)return o;let l=ae(a,s);if(!l)return null;let u=i(l.matches(c.rootNode));return t.set(c,u),u}var fe=new WeakMap,R=new WeakMap;function Je(e,n,t,r){let i=S(n);if(!i)return null;let a=C(e,n);if(!a)return null;let s=R.get(a);return s||(s=pe(a,i),R.set(a,s)),s.get(`${t}:${r}`)??null}function pe(e,n){let t=n==="rust"?new Set(["function_item","function_signature_item"]):n==="python"?new Set(["function_definition"]):new Set(["function_declaration","method_definition","arrow_function","function_expression"]),r=new Map,i=a=>{if(t.has(a.type)){let s=a.namedChildren.find(o=>o.type==="parameters"||o.type==="formal_parameters"),c=0;if(s)for(let o of s.namedChildren)o.type==="comment"||o.type==="line_comment"||o.type==="block_comment"||(c+=1);r.set(`${a.startPosition.row}:${a.endPosition.row}`,{paramCount:c})}for(let s of a.children)i(s)};return i(e.rootNode),r}function D(e){switch(e.type){case"identifier":case"type_identifier":case"property_identifier":case"shorthand_property_identifier":return e.text;case"field_expression":case"member_expression":case"attribute":{let n=e.namedChild(e.namedChildCount-1);return n?D(n):null}case"scoped_identifier":{let n=e.childForFieldName("name")??e.namedChild(e.namedChildCount-1);return n?D(n):null}case"super":case"self":case"this":return null;default:return null}}var me={"/":"namespace","#":"type",".":"term","[":"type-param",":":"meta","!":"macro"};function p(e){if(e.startsWith("local "))return{kind:"local",id:e.slice(6),raw:e};let n=e.split(" ");if(n.length<4)return{scheme:n[0]??"",manager:n[1]??"",packageName:n[2]??"",version:"",descriptors:[],raw:e};let t=n[0],r=n[1],i=e.slice(t.length+1+r.length+1),a;if(i.startsWith("`")){let l=i.indexOf("`",1);l===-1?(a=i.slice(1),i=""):(a=i.slice(1,l),i=i.slice(l+2))}else{let l=i.indexOf(" ");l===-1?(a=i,i=""):(a=i.slice(0,l),i=i.slice(l+1))}let s,c=i.indexOf(" ");c===-1?(s=i,i=""):(s=i.slice(0,c),i=i.slice(c+1));let o=ge(i);return{scheme:t,manager:r,packageName:a,version:s,descriptors:o,raw:e}}function ge(e){let n=[],t=0;for(;t<e.length;){if(e[t]==="["){let a=e.indexOf("]",t+1);if(a===-1){n.push({name:e.slice(t+1),suffix:"type-param"});break}n.push({name:e.slice(t+1,a),suffix:"type-param"}),t=a+1;continue}if(e[t]==="("&&(n.length===0||t===0||Q(e[t-1]))){let a=e.indexOf(")",t+1);if(a!==-1&&e[a+1]!=="."){n.push({name:e.slice(t+1,a),suffix:"parameter"}),t=a+1;continue}}let r;if(e[t]==="`"){let a=e.indexOf("`",t+1);if(a===-1){r=e.slice(t+1),n.push({name:r,suffix:"term"});break}r=e.slice(t+1,a),t=a+1}else{let a=t;for(;t<e.length&&!Q(e[t]);)t++;r=e.slice(a,t)}if(t>=e.length){r&&n.push({name:r,suffix:"term"});break}let i=e[t];if(i==="("){let a=e.indexOf(")",t+1);a!==-1&&e[a+1]==="."?(n.push({name:r,suffix:"method"}),t=a+2):a!==-1?(n.push({name:r,suffix:"method"}),t=a+1):(n.push({name:r,suffix:"term"}),t++)}else{let a=me[i];a&&n.push({name:r,suffix:a}),t+=1}}return n}function Q(e){return e==="/"||e==="#"||e==="."||e==="("||e==="["||e===":"||e==="!"}function V(e){let n=p(e);if("kind"in n&&n.kind==="local")return`local:${n.id}`;let t=n;if(t.descriptors.length===0)return t.raw;let r=[];for(let i of t.descriptors){let a=be(i);a&&r.push(a)}return r.join(":")}function be(e){let n=e.suffix==="namespace"?ye(e.name):e.name;return n?e.suffix==="method"?`${n}()`:n:""}function ye(e){return e.replace(/\.(ts|tsx|js|jsx|mjs|cjs)$/,"").replace(/\.(py|pyi)$/,"").replace(/\.(rs)$/,"").replace(/\.(java|scala|kt|kts)$/,"").replace(/\.(rb)$/,"").replace(/\.(go)$/,"").replace(/\.(cs|vb)$/,"").replace(/\.(dart)$/,"").replace(/\.(php)$/,"").replace(/\.(c|cc|cpp|cxx|h|hpp)$/,"")}function W(e){let n=p(e);if("kind"in n&&n.kind==="local")return n.id;let t=n;return t.descriptors.length===0?"":t.descriptors[t.descriptors.length-1].name}function b(e){let n=p(e);if("kind"in n&&n.kind==="local")return null;let t=n;return t.descriptors[t.descriptors.length-1]?.suffix??null}function Ze(e){return e.endsWith("().")||b(e)==="method"}function B(e){let n=b(e);return n==="method"||n==="term"}function et(e){return b(e)==="namespace"}var he=/^rust-analyzer\b.*[\s/]impl#\[[^\]]+\]\[[^\]]+\]/;function tt(e){return he.test(e)}var xe=new Set(["test","tests","_tests"]);function nt(e){let n=p(e);if("kind"in n)return!1;for(let t=0;t<n.descriptors.length-1;t+=1){let r=n.descriptors[t];if(r?.suffix==="namespace"&&r.name&&xe.has(r.name))return!0}return!1}function rt(e,n){let t=p(e),r=p(n);if("kind"in t||"kind"in r)return!1;let i=t.descriptors,a=r.descriptors;if(a.length!==i.length+1)return!1;for(let s=0;s<i.length;s++){let c=i[s],o=a[s];if(c.name!==o.name||c.suffix!==o.suffix)return!1}return!0}function it(e,n){let t=p(e),r=p(n);if("kind"in t||"kind"in r)return!1;let i=t.descriptors,a=r.descriptors;if(a.length<=i.length)return!1;for(let s=0;s<i.length;s++){let c=i[s],o=a[s];if(c.name!==o.name||c.suffix!==o.suffix)return!1}return!0}function z(e){return!e||!e.trim()?null:e.replace(/^```\w*\s*/,"").replace(/\s*```$/,"").replace(/^\(method\)\s*/,"").replace(/^\(property\)\s*/,"").replace(/^\(function\)\s*/,"").replace(/^\(class\)\s*/,"").replace(/^\(interface\)\s*/,"").replace(/^\(enum\)\s*/,"").replace(/^\(type alias\)\s*/,"").replace(/^\(const\)\s*/,"").replace(/^\(var\)\s*/,"").trim()||null}function U(e){if(!e)return null;let n=H(e);if(n)return n.replace(/\n/g," ");let t=e.indexOf("|");if(t===-1)return e.replace(/\n/g," ");let r=e.slice(t+1);return(H(r)??r).replace(/\n/g," ")}function H(e){return/^```(?:\w+)?\s*\n?([\s\S]*?)\n?```/.exec(e.trimStart())?.[1]?.trim()||null}var Se=h("file-definitions");function k(e,n){return Se.get(e,n,()=>{let t=Ce(_e(e,n),Le(e,n));return Ie(e,n,t.map(De))})}function _e(e,n){return e.all(`SELECT
|
|
44
|
+
gs.id,
|
|
45
|
+
gs.symbol,
|
|
46
|
+
der.document_id,
|
|
47
|
+
der.start_line,
|
|
48
|
+
der.end_line,
|
|
49
|
+
d.relative_path,
|
|
50
|
+
gs.display_name,
|
|
51
|
+
gs.kind,
|
|
52
|
+
gs.documentation,
|
|
53
|
+
gs.enclosing_symbol
|
|
54
|
+
FROM global_symbols gs
|
|
55
|
+
JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
|
|
56
|
+
JOIN documents d ON der.document_id = d.id
|
|
57
|
+
WHERE d.relative_path = ?
|
|
58
|
+
${e.symbolNoiseFor("gs")}
|
|
59
|
+
ORDER BY der.start_line, der.end_line`,n)}function Le(e,n){return e.all(`SELECT
|
|
60
|
+
gs.id,
|
|
61
|
+
gs.symbol,
|
|
62
|
+
c.document_id,
|
|
63
|
+
MIN(c.start_line) AS start_line,
|
|
64
|
+
MAX(c.end_line) AS end_line,
|
|
65
|
+
d.relative_path,
|
|
66
|
+
gs.display_name,
|
|
67
|
+
gs.kind,
|
|
68
|
+
gs.documentation,
|
|
69
|
+
gs.enclosing_symbol
|
|
70
|
+
FROM global_symbols gs
|
|
71
|
+
JOIN mentions m ON m.symbol_id = gs.id
|
|
72
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
73
|
+
JOIN documents d ON c.document_id = d.id
|
|
74
|
+
WHERE d.relative_path = ?
|
|
75
|
+
AND m.role = 1
|
|
76
|
+
${e.symbolNoiseFor("gs")}
|
|
77
|
+
GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
|
|
78
|
+
ORDER BY start_line, end_line`,n)}function De(e){return{symbolId:e.id,symbol:e.symbol,documentId:e.document_id,startLine:e.start_line,endLine:e.end_line,relativePath:e.relative_path,leaf:W(e.symbol),parentTypeName:v(e.symbol),isFunctionLike:B(e.symbol),isTypeLike:b(e.symbol)==="type",kind:e.kind??null,documentation:e.documentation??null,enclosingSymbol:e.enclosing_symbol??null}}function Ce(e,n){let t=new Map;for(let r of n)e.length>0&&!ke(r)||t.set(r.id,r);for(let r of e)t.set(r.id,r);return[...t.values()].sort((r,i)=>r.start_line-i.start_line||r.end_line-i.end_line||r.symbol.localeCompare(i.symbol))}function ke(e){if(v(e.symbol)!==null)return!1;let t=(e.documentation??"").replace(/^```\w*\s*/,"").replace(/\s*```$/,"").trim();return/^(?:var|let|const|function|class|interface|type|enum)\b/.test(t)}function ft(e,n={}){return ve(e,n.scope)}function ve(e,n){let t=n?`AND relative_path LIKE '%${n}%'`:"";return e.all(`SELECT relative_path
|
|
79
|
+
FROM documents
|
|
80
|
+
WHERE 1 = 1
|
|
81
|
+
${e.pathExclusionsFor("documents")}
|
|
82
|
+
${t}
|
|
83
|
+
ORDER BY relative_path`).flatMap(r=>k(e,r.relative_path)).filter(r=>!e.isIgnored(r.relativePath))}function pt(e,n,t={}){if(n.length===0)return[];let r=n.flatMap(i=>k(e,i)).filter(i=>!e.isIgnored(i.relativePath));return t.onlyDocumented&&(r=r.filter(i=>i.documentation!==null&&i.documentation!=="")),t.sort&&(r=r.sort((i,a)=>i.relativePath.localeCompare(a.relativePath)||i.startLine-a.startLine||i.endLine-a.endLine)),r.map(i=>({startLine:i.startLine,endLine:i.endLine,symbol:i.symbol,shortName:V(i.symbol),signature:z(U(i.documentation)),relativePath:i.relativePath,enclosingSymbol:i.enclosingSymbol}))}function mt(e,n){let t=null;for(let r of e)r.startLine>n||r.endLine<n||(!t||r.endLine-r.startLine<t.endLine-t.startLine)&&(t=r);return t}function gt(e,n){let t=k(e,n.relative_path).find(r=>r.symbolId===n.id);return t?{symbolId:t.symbolId,symbol:t.symbol,documentId:t.documentId,startLine:t.startLine,endLine:t.endLine,relativePath:t.relativePath}:{symbolId:n.id,symbol:n.symbol,documentId:n.document_id,startLine:n.start_line,endLine:n.end_line,relativePath:n.relative_path}}function Ie(e,n,t){let r=m(e,n),i=F(e,n);return i?Te(t,i,r):r?Me(t,r):t}function Me(e,n){let t=n.split(/\r?\n/),r=Ae(e,t),i=we(e,r),a=Re(i,t);return Ne(e,a)}function Ae(e,n){let t=e.some(i=>_(i.symbol))?Pe(n):null,r=new Map;for(let i of e)r.set(i.symbolId,Ee(n,t,i));return r}function we(e,n){return e.filter(t=>_(t.symbol)).map(t=>({definition:t,startLine:n.get(t.symbolId)??t.startLine})).sort((t,r)=>t.startLine-r.startLine||t.definition.startLine-r.definition.startLine||t.definition.symbol.localeCompare(r.definition.symbol))}function Re(e,n){let t=new Map;for(let r=0;r<e.length;r+=1){let i=e[r],a=e[r+1],s=a?Math.max(i.startLine,a.startLine-1):n.length-1;t.set(i.definition.symbolId,{startLine:i.startLine,endLine:Oe(n,i.definition,i.startLine,s)})}return t}function Ne(e,n){return e.map(t=>{let r=n.get(t.symbolId);return r?{...t,startLine:r.startLine,endLine:r.endLine}:t})}function Te(e,n,t=null){let r=new Map;for(let i of n){let a=r.get(i.name);a?a.push(i):r.set(i.name,[i])}return e.map(i=>{if(!_(i.symbol)||!i.leaf)return Y(i,t);let a=r.get(i.leaf);if(!a||a.length===0)return Y(i,t);let s=a[0],c=Math.abs(s.startLine-i.startLine);for(let o=1;o<a.length;o+=1){let l=a[o],u=Math.abs(l.startLine-i.startLine);u<c&&(s=l,c=u)}return{...i,startLine:s.startLine,endLine:s.endLine}})}function Y(e,n){if(!n||!e.leaf||b(e.symbol)!=="term"||v(e.symbol)!==null)return e;let t=e.leaf.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\b(?:export\\s+)?(?:const|let|var)\\s+${t}\\b`),a=n.split(/\r?\n/).findIndex(s=>r.test(s));return a>=0?{...e,startLine:a,endLine:a}:e}function Ee(e,n,t){if(!_(t.symbol))return t.startLine;let r=Math.max(0,Math.min(t.startLine,e.length-1));if(!n)return r;let i=n.get(t.leaf);if(!i||i.length===0)return r;let a=null;for(let s of i){let c=Math.abs(s-t.startLine);(!a||c<a.distance)&&(a={line:s,distance:c})}return a?.line??r}function Pe(e){let n=/\b(?:function|def|fn)\s+([A-Za-z_$][\w$]*)/g,t=/\b([A-Za-z_$][\w$]*)\s*[:=]\s*(?:async\s*)?(?:function\b|\()/g,r=/^\s*(?:(?:export|public|private|protected|static|readonly|async|abstract|get|set)\s+)*([A-Za-z_$][\w$]*)\s*(?:<[^(]*>)?\s*\(/,i=/\b([A-Za-z_$][\w$]*)\s*\(/g,a=new Map,s=(c,o)=>{let l=a.get(c);if(!l){a.set(c,[o]);return}l[l.length-1]!==o&&l.push(o)};for(let c=0;c<e.length;c+=1){let o=e[c]??"";for(let u of o.matchAll(n))u[1]&&s(u[1],c);for(let u of o.matchAll(t))u[1]&&s(u[1],c);let l=o.match(r);l?.[1]&&s(l[1],c);for(let u of o.matchAll(i))u[1]&&s(u[1],c)}return a}function Oe(e,n,t,r){let i=Math.max(t,Math.min(e.length-1,r)),a=Math.max(t,Math.min(i,n.endLine)),s=0,c=0,o=!1;for(let l=t;l<=i;l+=1){let u=$e(e[l]??"");for(let d of u)d==="{"?(s+=1,o=!0):d==="}"?s=Math.max(0,s-1):d==="("?c+=1:d===")"&&(c=Math.max(0,c-1));if(o&&s===0||!o&&c===0&&l>=a)return l}return a}function $e(e){let n="",t=null,r=!1;for(let i=0;i<e.length;i+=1){let a=e[i],s=e[i+1];if(!t&&a==="/"&&s==="/"){n+=" ".repeat(e.length-i);break}if(t){if(r){r=!1,n+=" ";continue}if(a==="\\"){r=!0,n+=" ";continue}a===t&&(t=null),n+=" ";continue}if(a==='"'||a==="'"||a==="`"){t=a,n+=" ";continue}n+=a}return n}function _(e){return e.includes("().")}function v(e){let n=p(e);if("kind"in n)return null;for(let t=n.descriptors.length-2;t>=0;t--){let r=n.descriptors[t];if(r?.suffix==="type")return r.name}return null}function bt(e){let n=p(e);if("kind"in n)return[];let t=[];for(let r=n.descriptors.length-2;r>=0;r-=1){let i=n.descriptors[r];i?.suffix==="type"&&i.name&&t.push(i.name)}return t}export{h as a,Fe as b,I as c,m as d,Be as e,S as f,te as g,C as h,Ge as i,qe as j,de as k,Je as l,D as m,p as n,V as o,W as p,b as q,Ze as r,B as s,et as t,tt as u,nt as v,rt as w,it as x,z as y,U as z,k as A,ft as B,ve as C,pt as D,mt as E,gt as F,v as G,bt as H};
|
|
84
|
+
//# sourceMappingURL=chunk-QFZE73XF.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{a as h}from"./chunk-UAPNU7UP.js";import{p}from"./chunk-Z4AMQWVY.js";import{o as u,r as c,t as g}from"./chunk-QFZE73XF.js";import{execFileSync as f}from"child_process";function O(e,t={}){let{base:n="HEAD"}=t,s;try{s=b(e.config.projectRoot,n)}catch{return y("Unable to compute git diff.")}if(s.length===0)return y("No changed files found.");let o=I(e,s);if(o.length===0)return{changedFiles:s,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:s.length,totalChangedSymbols:0,totalAffectedFiles:0,note:"Changed files are not present in the current SCIP index."}};let a=new h(e),l=new Set(o),m=D(a,o),r=[],i=new Map;for(let C of m)_(e,C,o,l,r,i);let d=R(i);return{changedFiles:o,changedSymbols:r,affectedConsumers:d,summary:{totalChangedFiles:o.length,totalChangedSymbols:r.length,totalAffectedFiles:d.length}}}function y(e){return{changedFiles:[],changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:0,totalChangedSymbols:0,totalAffectedFiles:0,note:e}}}function b(e,t){let n=f("git",["diff","--name-only",t],{encoding:"utf-8",cwd:e,timeout:1e4}),s=f("git",["diff","--name-only","--cached",t],{encoding:"utf-8",cwd:e,timeout:1e4}),o=f("git",["ls-files","--others","--exclude-standard"],{encoding:"utf-8",cwd:e,timeout:1e4});return[...new Set([n,s,o].flatMap(a=>a.split(`
|
|
2
|
+
`)).map(a=>a.trim()).filter(a=>a.length>0))]}function I(e,t){let n=[];for(let s of t){let o=e.get(`SELECT relative_path FROM documents
|
|
3
|
+
WHERE relative_path LIKE ?
|
|
4
|
+
LIMIT 1`,`%${s}`);o&&!e.isIgnored(o.relative_path)&&n.push(o.relative_path)}return n}function D(e,t){return t.flatMap(n=>e.definitionsForFile(n)).filter(x).sort((n,s)=>n.relativePath.localeCompare(s.relativePath)||n.startLine-s.startLine)}function _(e,t,n,s,o,a){let l=p(e,[t]).get(t.symbolId)??new Set,m=Math.max(F(e,t.symbolId),l.size);if(!E(t,m))return;let r=u(t.symbol);o.push({symbol:t.symbol,shortName:r,file:t.relativePath,fanIn:m});for(let i of N(e,t.symbolId,n))S(e,s,a,i,r);for(let i of l)S(e,s,a,i,r)}function F(e,t){return e.get(`SELECT COUNT(DISTINCT c.document_id) AS fan_in
|
|
5
|
+
FROM mentions m
|
|
6
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
7
|
+
WHERE m.symbol_id = ?
|
|
8
|
+
AND m.role != 1`,t)?.fan_in??0}function N(e,t,n){return n.length===0?[]:e.all(`SELECT DISTINCT ref_d.relative_path
|
|
9
|
+
FROM mentions m
|
|
10
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
11
|
+
JOIN documents ref_d ON c.document_id = ref_d.id
|
|
12
|
+
WHERE m.symbol_id = ?
|
|
13
|
+
AND m.role != 1
|
|
14
|
+
AND ref_d.relative_path NOT IN (${n.map(()=>"?").join(",")})
|
|
15
|
+
${e.pathExclusionsFor("ref_d")}`,t,...n).map(o=>o.relative_path)}function S(e,t,n,s,o){if(e.isIgnored(s)||t.has(s))return;let a=n.get(s);a||(a=new Set,n.set(s,a)),a.add(o)}function R(e){return[...e.entries()].map(([t,n])=>({file:t,consumedSymbols:n.size})).sort((t,n)=>n.consumedSymbols-t.consumedSymbols)}function x(e){return!(g(e.symbol)||e.parentTypeName!==null&&!c(e.symbol))}function E(e,t){return c(e.symbol)||e.isTypeLike?!0:e.parentTypeName===null&&t>0}export{O as a};
|
|
16
|
+
//# sourceMappingURL=chunk-QPJG6VRT.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{statSync as i}from"fs";function r(t){let e=t.get("SELECT COUNT(*) as c FROM documents").c,s=t.get("SELECT COUNT(*) as c FROM global_symbols").c,n=t.get("SELECT COUNT(*) as c FROM mentions WHERE role = 1").c,c=t.get("SELECT COUNT(*) as c FROM mentions WHERE role != 1").c;return{documents:e,symbols:s,definitions:n,references:c,...o(t.config.dbPath)}}function o(t){try{let e=i(t);return{indexSizeBytes:e.size,lastBuilt:e.mtime}}catch{return{indexSizeBytes:0,lastBuilt:null}}}export{r as a};
|
|
2
|
+
//# sourceMappingURL=chunk-QRYEOK3M.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
function m(n,e){let t=new Set;for(let r of n)e.has(r)&&t.add(r);return t}function M(n,e){let t=new Set;for(let r of n)e.has(r)||t.add(r);return t}function w(n,e){if(n.size===0&&e.size===0)return 0;let t=0;for(let o of n)e.has(o)&&(t+=1);let r=n.size+e.size-t;return r===0?0:t/r}function x(n){let e=n.length;if(e===0)return new Map;let t=new Map;for(let o of n)for(let s of o)t.set(s,(t.get(s)??0)+1);let r=new Map;for(let[o,s]of t)r.set(o,Math.log(e/s));return r}function p(n){let e=[...n.values()].sort((r,o)=>r-o);if(e.length===0)return 0;let t=Math.floor(e.length/2);return e.length%2===0?(e[t-1]+e[t])/2:e[t]}function v(n,e,t){let r=m(n,e);if(r.size===0)return{similarity:0,significantShared:[],trivialShared:[]};let o=0,s=0,T=0,l=new Set([...n,...e]);for(let i of l){let a=t.get(i)??0,f=n.has(i)?a:0,u=e.has(i)?a:0;o+=f*u,s+=f*f,T+=u*u}let h=Math.sqrt(s)*Math.sqrt(T),g=h>0?o/h:0,S=p(t),c=[],d=[];for(let i of r)(t.get(i)??0)>=S?c.push(i):d.push(i);return c.sort((i,a)=>(t.get(a)??0)-(t.get(i)??0)),{similarity:g,significantShared:c,trivialShared:d}}export{m as a,M as b,w as c,x as d,v as e};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
//# sourceMappingURL=chunk-RKTDEIHF.js.map
|