scip-query 0.6.7 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/augment-vue-worker.js +1 -1
- package/dist/chunk-23YIGCYF.js +25 -0
- package/dist/{chunk-KQWFRAQI.js → chunk-2IYEIFPP.js} +6 -6
- package/dist/chunk-2JEFS2YJ.js +2 -0
- package/dist/chunk-33SSUPCB.js +7 -0
- package/dist/chunk-3GNFUVFA.js +2 -0
- package/dist/{chunk-ZNNCDAYX.js → chunk-3OUC276S.js} +2 -2
- package/dist/{chunk-PQTGBYXV.js → chunk-4STLJYHI.js} +4 -4
- package/dist/chunk-563HLCDW.js +35 -0
- package/dist/chunk-5TT47UMX.js +44 -0
- package/dist/chunk-6H2XIIPY.js +71 -0
- package/dist/{chunk-HTJ5BOYP.js → chunk-72JOIFXL.js} +3 -3
- package/dist/chunk-7H4RJ4MC.js +2 -0
- package/dist/chunk-7O4MJYIW.js +63 -0
- package/dist/chunk-7OX2O53H.js +62 -0
- package/dist/chunk-A2AVLALL.js +2 -0
- package/dist/chunk-AQYBOORI.js +2 -0
- package/dist/chunk-ARBZM2NF.js +34 -0
- package/dist/{chunk-2CC7RA6B.js → chunk-BI4F6GXI.js} +2 -2
- package/dist/chunk-BOVNTAKQ.js +3 -0
- package/dist/chunk-CKIO6SVS.js +2 -0
- package/dist/chunk-D6Z67MZL.js +2 -0
- package/dist/chunk-DFK54IRN.js +2 -0
- package/dist/chunk-FD37DBTD.js +2 -0
- package/dist/chunk-FOQQDXE7.js +2 -0
- package/dist/chunk-GAQGJ52J.js +11 -0
- package/dist/chunk-IODTPF5H.js +20 -0
- package/dist/chunk-J6Z5YKGQ.js +4 -0
- package/dist/chunk-JB4PUN5S.js +40 -0
- package/dist/chunk-JTXKS5GK.js +3 -0
- package/dist/chunk-KJ3ZJIE5.js +2 -0
- package/dist/chunk-KJ6CW6EK.js +2 -0
- package/dist/{chunk-2R7OKZE5.js → chunk-KNA6Z7JB.js} +3 -3
- package/dist/{chunk-FYO3FPFH.js → chunk-LDV2B7ET.js} +8 -8
- package/dist/chunk-LWYIGRHR.js +5 -0
- package/dist/chunk-MDAYGS6T.js +2 -0
- package/dist/chunk-MX6F756F.js +2 -0
- package/dist/chunk-NHDPYW7O.js +2 -0
- package/dist/{chunk-TYRPQE6R.js → chunk-NKJKI6SE.js} +2 -2
- package/dist/chunk-NN3O7TPH.js +8 -0
- package/dist/chunk-NSTZMBAB.js +18 -0
- package/dist/chunk-NYEMZHUC.js +6 -0
- package/dist/chunk-OHEIZWIA.js +4 -0
- package/dist/chunk-PG3ZI5IH.js +2 -0
- package/dist/chunk-QAEDNTY7.js +2 -0
- package/dist/chunk-QE6MGGUY.js +2 -0
- package/dist/chunk-QPRIYXH4.js +2 -0
- package/dist/chunk-QWJBIBE6.js +3 -0
- package/dist/chunk-RCJEFQOK.js +4 -0
- package/dist/chunk-ROOHENEP.js +61 -0
- package/dist/{chunk-2YA36CXK.js → chunk-ROZNBWIF.js} +2 -2
- package/dist/chunk-TGK5DFBJ.js +2 -0
- package/dist/chunk-TKDJQ2WD.js +59 -0
- package/dist/chunk-TRNAQABL.js +7 -0
- package/dist/chunk-U75WH4XG.js +2 -0
- package/dist/chunk-V53J46BX.js +2 -0
- package/dist/chunk-V76FCF5F.js +2 -0
- package/dist/chunk-VUBQBW7H.js +16 -0
- package/dist/chunk-WJQY2LGT.js +2 -0
- package/dist/{chunk-ILQSK2KJ.js → chunk-WODJHE6Z.js} +3 -3
- package/dist/{chunk-RRWPHKZA.js → chunk-WPLKHAH7.js} +4 -4
- package/dist/chunk-XO6R3X5J.js +2 -0
- package/dist/chunk-YSZNAG4G.js +2 -0
- package/dist/chunk-ZNUPGRPR.js +3 -0
- package/dist/{chunk-OCQN6WF4.js → chunk-ZXFTC5ET.js} +4 -4
- package/dist/cli.js +361 -505
- package/dist/config-types-CGIeLEpY.d.ts +108 -0
- package/dist/db-DdTPetj5.d.ts +69 -0
- package/dist/health-x7B4Xu_6.d.ts +119 -0
- package/dist/index.d.ts +109 -336
- package/dist/index.js +3 -131
- package/dist/postinstall.js +1 -1
- package/dist/queries/affected.d.ts +9 -2
- package/dist/queries/affected.js +1 -1
- package/dist/queries/bottlenecks.d.ts +14 -2
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.d.ts +12 -2
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +22 -3
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +19 -3
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/code.d.ts +12 -2
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.d.ts +16 -2
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +22 -3
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/convergence.d.ts +25 -3
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.d.ts +8 -2
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +16 -2
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.d.ts +35 -3
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +34 -2
- package/dist/queries/dead.js +1 -1
- package/dist/queries/deep-chains.d.ts +8 -2
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/deps.d.ts +6 -2
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-impact.d.ts +22 -2
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/drift.d.ts +19 -2
- package/dist/queries/drift.js +1 -1
- package/dist/queries/extract-candidates.d.ts +20 -2
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +7 -2
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.d.ts +6 -2
- package/dist/queries/files.js +1 -1
- package/dist/queries/health.d.ts +4 -81
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +8 -2
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +10 -2
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +19 -4
- package/dist/queries/imports.js +1 -1
- package/dist/queries/index.d.ts +45 -44
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.d.ts +13 -2
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/members.d.ts +10 -2
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.d.ts +8 -2
- package/dist/queries/methods.js +1 -1
- package/dist/queries/outline.d.ts +10 -2
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +15 -2
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +13 -2
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.d.ts +10 -3
- package/dist/queries/refs.js +1 -1
- package/dist/queries/similar-chains.d.ts +21 -2
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.d.ts +12 -2
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.d.ts +18 -2
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +24 -2
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +17 -2
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.d.ts +37 -3
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +11 -2
- package/dist/queries/stats.js +1 -1
- package/dist/queries/surface.d.ts +8 -2
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.d.ts +10 -2
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system.d.ts +10 -2
- package/dist/queries/system.js +1 -1
- package/dist/queries/trace.d.ts +21 -3
- package/dist/queries/trace.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +15 -2
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +10 -10
- package/dist/reindex.d.ts +153 -0
- package/dist/reindex.js +69 -0
- package/dist/runtime.d.ts +108 -0
- package/dist/runtime.js +3 -0
- package/dist/scip-cli-a-xOztiK.d.ts +20 -0
- package/package.json +184 -4
- package/dist/chunk-2AUZ3PLO.js +0 -2
- package/dist/chunk-3A2M7AF3.js +0 -4
- package/dist/chunk-3EJRPTTB.js +0 -2
- package/dist/chunk-3SWWYJPB.js +0 -6
- package/dist/chunk-4M4FEWBL.js +0 -7
- package/dist/chunk-4Y6KUJDO.js +0 -39
- package/dist/chunk-55ZJ2FCW.js +0 -6
- package/dist/chunk-6FLGPRBR.js +0 -5
- package/dist/chunk-6XRB6ATD.js +0 -16
- package/dist/chunk-7EQ4J66C.js +0 -2
- package/dist/chunk-7TGEXAN5.js +0 -25
- package/dist/chunk-ABLXPGAZ.js +0 -2
- package/dist/chunk-BG7YU4DJ.js +0 -2
- package/dist/chunk-D2R6IIEO.js +0 -2
- package/dist/chunk-E47WMJ5F.js +0 -2
- package/dist/chunk-EEA3R37V.js +0 -11
- package/dist/chunk-FAN2CVZT.js +0 -2
- package/dist/chunk-FVH3Y44U.js +0 -1
- package/dist/chunk-G47V5V3U.js +0 -90
- package/dist/chunk-GS55K4WJ.js +0 -85
- package/dist/chunk-H4DXD2FB.js +0 -5
- package/dist/chunk-HADDFTMU.js +0 -2
- package/dist/chunk-IARIBTCL.js +0 -2
- package/dist/chunk-IBWYWAWE.js +0 -70
- package/dist/chunk-JVMXNDRU.js +0 -2
- package/dist/chunk-K345WFTU.js +0 -2
- package/dist/chunk-K6ULLR7M.js +0 -19
- package/dist/chunk-KAM4C6ZD.js +0 -4
- package/dist/chunk-KCC3GMCX.js +0 -2
- package/dist/chunk-KRVRD6KZ.js +0 -5
- package/dist/chunk-KYGNCIJ6.js +0 -84
- package/dist/chunk-LHLXHH43.js +0 -2
- package/dist/chunk-LJ2YWNQF.js +0 -2
- package/dist/chunk-M7GBLQG4.js +0 -7
- package/dist/chunk-MEVK6R7N.js +0 -2
- package/dist/chunk-QRYEOK3M.js +0 -2
- package/dist/chunk-QYWGC7JV.js +0 -114
- package/dist/chunk-R373SHXM.js +0 -2
- package/dist/chunk-RUAJV3TN.js +0 -2
- package/dist/chunk-S57GUI2T.js +0 -7
- package/dist/chunk-SVUVC5VS.js +0 -2
- package/dist/chunk-T426XELO.js +0 -12
- package/dist/chunk-TBJDUS4E.js +0 -71
- package/dist/chunk-TX7BHRMT.js +0 -2
- package/dist/chunk-WPY46NIL.js +0 -5
- package/dist/chunk-X3Z4KZNX.js +0 -2
- package/dist/db-DdlToIC-.d.ts +0 -835
- package/dist/queries/drift-policy.d.ts +0 -6
- package/dist/queries/drift-policy.js +0 -2
- package/dist/queries/health-cache-control.d.ts +0 -15
- package/dist/queries/health-cache-control.js +0 -2
package/README.md
CHANGED
|
@@ -1194,9 +1194,11 @@ Every CLI command is also a TypeScript function. The `queries` namespace exports
|
|
|
1194
1194
|
```typescript
|
|
1195
1195
|
import {
|
|
1196
1196
|
ScipDatabase, createGitignoreFilter,
|
|
1197
|
+
} from 'scip-query';
|
|
1198
|
+
import {
|
|
1197
1199
|
health, affected, changeSurface, diffImpact,
|
|
1198
1200
|
hotspots, similar, dead, convergence,
|
|
1199
|
-
} from 'scip-query';
|
|
1201
|
+
} from 'scip-query/queries';
|
|
1200
1202
|
|
|
1201
1203
|
const filter = createGitignoreFilter('/path/to/project');
|
|
1202
1204
|
const db = new ScipDatabase({
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as t}from"./chunk-
|
|
1
|
+
import{c as t}from"./chunk-6H2XIIPY.js";import{writeFileSync as o}from"fs";import{workerData as s}from"worker_threads";var e=s;try{let r=t({projectRoot:e.projectRoot,dbPath:e.dbPath,tsconfig:e.tsconfig,vueFiles:e.vueFiles,tasks:e.tasks});o(e.resultPath,JSON.stringify({ok:!0,result:r}))}catch(r){o(e.resultPath,JSON.stringify({ok:!1,error:r instanceof Error?r.message:String(r)}))}finally{let r=new Int32Array(e.sharedBuffer);Atomics.add(r,0,1),Atomics.notify(r,0)}
|
|
2
2
|
//# sourceMappingURL=augment-vue-worker.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import{b as d}from"./chunk-ARBZM2NF.js";import{c as r,t as l}from"./chunk-7OX2O53H.js";function b(t,o={}){let{limit:n=30,scope:e}=o,i=e?`AND def_d.relative_path LIKE '%${e}%'`:"",m=t.all(`SELECT
|
|
2
|
+
gs.symbol,
|
|
3
|
+
COUNT(*) AS ref_count,
|
|
4
|
+
COUNT(DISTINCT ref_d.id) AS file_count,
|
|
5
|
+
def_d.relative_path AS defined_in
|
|
6
|
+
FROM mentions m
|
|
7
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
8
|
+
JOIN documents ref_d ON c.document_id = ref_d.id
|
|
9
|
+
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
10
|
+
JOIN (
|
|
11
|
+
SELECT m2.symbol_id, c2.document_id
|
|
12
|
+
FROM mentions m2
|
|
13
|
+
JOIN chunks c2 ON m2.chunk_id = c2.id
|
|
14
|
+
WHERE m2.role = 1
|
|
15
|
+
GROUP BY m2.symbol_id
|
|
16
|
+
) sym_def ON sym_def.symbol_id = gs.id
|
|
17
|
+
JOIN documents def_d ON sym_def.document_id = def_d.id
|
|
18
|
+
WHERE m.role != 1
|
|
19
|
+
${t.pathExclusionsFor("def_d")}
|
|
20
|
+
${t.symbolNoiseFor("gs")}
|
|
21
|
+
${i}
|
|
22
|
+
GROUP BY gs.id
|
|
23
|
+
ORDER BY ref_count DESC
|
|
24
|
+
LIMIT ?`,n).filter(s=>!t.isIgnored(s.defined_in)).map(s=>({symbol:s.symbol,shortName:r(s.symbol),refCount:s.ref_count,fileCount:s.file_count,definedIn:s.defined_in}));return m.length>0?m:f(t,e,n)}function f(t,o,n){return l(t,{scope:o}).filter(e=>!t.isIgnored(e.relativePath)).map(e=>u(t,e)).filter(e=>e.refCount>0).sort((e,i)=>i.refCount-e.refCount||i.fileCount-e.fileCount).slice(0,n)}function u(t,o){let n=d(t,o,{limit:500});return{symbol:o.symbol,shortName:r(o.symbol),refCount:n.length,fileCount:new Set(n.map(e=>e.file)).size,definedIn:o.relativePath}}export{b as a};
|
|
25
|
+
//# sourceMappingURL=chunk-23YIGCYF.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{a as m}from"./chunk-
|
|
2
|
-
`),c=Math.max(0,e.startLine-a),i=Math.min(n.length-1,e.endLine+a),
|
|
3
|
-
`);return{symbol:e.symbol,shortName:
|
|
4
|
-
`),
|
|
5
|
-
`);return{symbol:`${n.relative_path}:${a}-${s}`,shortName:`${n.relative_path}:${a}-${s}`,relativePath:n.relative_path,startLine:
|
|
6
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as m}from"./chunk-DFK54IRN.js";import{a as h}from"./chunk-ZNUPGRPR.js";import{c as p}from"./chunk-7OX2O53H.js";import{readFileSync as f}from"fs";import{extname as y,join as d}from"path";function M(t,e,a={}){let{context:s=0}=a,r=L(e);if(r)return j(t,r.filePath,r.startLine,r.endLine,s);let l=h(t,e);return l?R(t,l,s):null}function L(t){let e=t.match(/^(.+\.\w+):(\d+)-(\d+)$/);return e?{filePath:e[1],startLine:parseInt(e[2],10),endLine:parseInt(e[3],10)}:null}function R(t,e,a){let s=t.get("SELECT language FROM documents WHERE relative_path = ?",e.relativePath),r=d(t.config.projectRoot,e.relativePath),l;try{l=f(r,"utf-8")}catch{return null}let n=l.split(`
|
|
2
|
+
`),c=Math.max(0,e.startLine-a),i=Math.min(n.length-1,e.endLine+a),u=n.slice(c,i+1).join(`
|
|
3
|
+
`);return{symbol:e.symbol,shortName:p(e.symbol),relativePath:e.relativePath,startLine:c,endLine:i,language:s?.language??v(e.relativePath),source:u}}function j(t,e,a,s,r){let l=m(t,e);if(!l)return null;let n=t.get("SELECT relative_path, language FROM documents WHERE relative_path = ?",l);if(!n)return null;let c=d(t.config.projectRoot,n.relative_path),i;try{i=f(c,"utf-8")}catch{return null}let u=i.split(`
|
|
4
|
+
`),o=Math.max(0,a-1-r),g=Math.min(u.length-1,s-1+r),b=u.slice(o,g+1).join(`
|
|
5
|
+
`);return{symbol:`${n.relative_path}:${a}-${s}`,shortName:`${n.relative_path}:${a}-${s}`,relativePath:n.relative_path,startLine:o,endLine:g,language:n.language??v(n.relative_path),source:b}}function v(t){switch(y(t).toLowerCase()){case".ts":case".tsx":case".mts":case".cts":return"typescript";case".js":case".jsx":case".mjs":case".cjs":return"javascript";case".py":case".pyi":return"python";case".rs":return"rust";case".go":return"go";case".java":return"java";case".kt":case".kts":return"kotlin";case".scala":return"scala";case".rb":return"ruby";case".php":return"php";case".cs":return"csharp";case".vb":return"vb";case".dart":return"dart";case".c":case".h":return"c";case".cc":case".cpp":case".cxx":case".hpp":case".hh":case".hxx":return"cpp";case".vue":return"vue";default:return null}}export{M as a};
|
|
6
|
+
//# sourceMappingURL=chunk-2IYEIFPP.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as u}from"./chunk-QAEDNTY7.js";import{a as h}from"./chunk-ARBZM2NF.js";import{r as S}from"./chunk-JB4PUN5S.js";import{a as d,b}from"./chunk-ZNUPGRPR.js";import{c as m,w as y}from"./chunk-7OX2O53H.js";function v(e,o,l={}){let{direction:c="backward",maxDepth:s=3}=l,r=d(e,o);return r?c==="backward"?w(e,r,s,{semantic:l.semantic!==!1}):M(e,r,{semantic:l.semantic!==!1}):null}function w(e,o,l,c){let s=[],r=new Set([o.symbol]),t=[o];for(let n=1;n<=l&&t.length!==0;n++){let i=[];for(let p of t){let g=h(e,p,{semantic:c.semantic});for(let a of g){if(r.has(a.symbol))continue;r.add(a.symbol),s.push({symbol:a.symbol,shortName:m(a.symbol),file:a.file,relationship:n===1?"referenced within definition (callee)":`depth ${n} callee`});let f=b(e,a.symbol);f&&!e.isIgnored(f.relativePath)&&i.push(f)}}t=i}return{symbol:o.symbol,shortName:m(o.symbol),direction:"backward",connectedSymbols:s}}function M(e,o,l){let c=new Set,s=[],r=new u(e);for(let t of S(e,o,{semantic:l.semantic})){if(s.length>=30)break;let n=t.enclosingSymbol??y(r.definitionsForFile(t.file),t.line)?.symbol??null;if(!n||n===o.symbol)continue;let i=b(e,n);!i||e.isIgnored(i.relativePath)||c.has(i.symbol)||(c.add(i.symbol),s.push({symbol:i.symbol,shortName:m(i.symbol),file:i.relativePath,relationship:`references target at ${t.file}:${t.line+1}`}))}return s.sort((t,n)=>t.file.localeCompare(n.file)),{symbol:o.symbol,shortName:m(o.symbol),direction:"forward",connectedSymbols:s}}export{v as a};
|
|
2
|
+
//# sourceMappingURL=chunk-2JEFS2YJ.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{b as u}from"./chunk-QAEDNTY7.js";import{a as b}from"./chunk-ZNUPGRPR.js";import{t as l}from"./chunk-BOVNTAKQ.js";import{c as m}from"./chunk-7OX2O53H.js";import{readFileSync as p}from"fs";import{join as h}from"path";function O(e,n,r={}){let t=b(e,n);if(!t)return null;let c=new u(e),o=P(d(e,t.relativePath,t.startLine,t.endLine),y(e,t.relativePath)),s=t.endLine-t.startLine+1,a=c.calleeMap([t],{additive:!0,semantic:r.semantic}).get(t.symbolId)??[],f=new Set(a.map(g=>g.symbol));return{symbol:t.symbol,shortName:m(t.symbol),relativePath:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:s,branches:o,cyclomaticEstimate:o+1,calleeCount:f.size,fanIn:S(e,t.symbolId),fanOut:L(a,t.relativePath)}}function y(e,n){return e.get("SELECT language FROM documents WHERE relative_path = ?",n)?.language??"unknown"}function d(e,n,r,t){try{return p(h(e.config.projectRoot,n),"utf-8").split(`
|
|
2
|
+
`).slice(r,t+1).join(`
|
|
3
|
+
`)}catch{return""}}function S(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 L(e,n){return new Set(e.filter(r=>r.file!==n).map(r=>r.symbol)).size}function P(e,n){let r=l(e),t=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=r.match(o);s&&(t+=s.length)}if(n==="python"){let o=[/\belif\b/g,/\bexcept\b/g,/\bfinally\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}else if(n==="rust"){let o=[/\bmatch\b/g,/=>/g,/\bloop\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.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 i=r.match(s);i&&(t+=i.length)}}else if(n==="go"){let o=[/\bselect\b/g,/\bdefer\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}return t}export{O as a};
|
|
7
|
+
//# sourceMappingURL=chunk-33SSUPCB.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as C}from"./chunk-V76FCF5F.js";import{a as x,b as L}from"./chunk-MX6F756F.js";import{b as h}from"./chunk-QAEDNTY7.js";import{c as m,g as c}from"./chunk-7OX2O53H.js";import{e as g,g as y,j as b}from"./chunk-5TT47UMX.js";function P(o,e,s,n){let r=g(e);if(!r)return!0;let i=b(o,e);if(!i)return!0;let a=S.get(i);return a||(a=N(i,r),S.set(i,a)),a.get(`${s}:${n}`)??!0}var S=new WeakMap;function N(o,e){let s=y(e),n=new Map,r=i=>{s.has(i.type)&&n.set(`${i.startPosition.row}:${i.endPosition.row}`,w(i,e));for(let a of i.children)r(a)};return r(o.rootNode),n}function w(o,e){let s=o.namedChildren.find(t=>t.type==="block"||t.type==="statement_block");if(!s)return!1;let n=s.namedChildren.filter(t=>t.type!=="comment"&&t.type!=="line_comment"&&t.type!=="block_comment");if(n.length!==1)return!1;let r=n[0],i=null;if(r.type==="return_statement"||r.type==="expression_statement"?i=r.namedChild(0)??null:e==="rust"&&(r.type==="call_expression"||r.type==="macro_invocation")&&(i=r),!i)return!1;let a=e==="python"?"call":"call_expression";if(i.type!==a)return!1;let l=i.namedChildren.find(t=>t.type==="arguments"||t.type==="argument_list");if(!l)return!1;let d=l.namedChildren.filter(t=>t.type!=="comment"),p=o.namedChildren.find(t=>t.type==="parameters"||t.type==="formal_parameters");if(!p)return!1;let u=[];for(let t of p.namedChildren)if(t.type==="identifier")u.push(t.text);else{let f=t.namedChildren.find(T=>T.type==="identifier");f&&u.push(f.text)}if(d.length!==u.length)return!1;for(let t=0;t<u.length;t+=1){let f=d[t];if(f.type!=="identifier"||f.text!==u[t])return!1}return!0}function $(o,e){let{scope:s,maxLoc:n=15,limit:r=30,scanLimit:i}=e??{},a=new h(o);return C({candidates:()=>A(a,s,n),orderCandidates:L,scanLimit:i,prepare:l=>a.calleeMap(l,{semantic:e?.semantic!==!1}),evaluate:(l,d)=>_(o,l,d.get(l.symbolId)??[]),orderResults:(l,d)=>l.loc-d.loc||l.file.localeCompare(d.file),limit:r})}function _(o,e,s){let n=D(s);if(n.size!==1||!P(o,e.relativePath,e.startLine,e.endLine))return null;let[,r]=[...n.entries()][0];return{symbol:e.symbol,shortName:m(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:x(e),forwardsTo:r.symbol,forwardsToShort:m(r.symbol),forwardsToFile:r.file}}function D(o){let e=o.some(n=>c(n.symbol))?o.filter(n=>c(n.symbol)):o,s=new Map;for(let n of e)s.has(n.symbol)||s.set(n.symbol,n);return s}function A(o,e,s){return o.productionCallableDefinitions({scope:e,minLoc:3,maxLoc:s,requireFunctionLikeSymbol:!0,excludeRustTraitImplMembers:!0})}export{$ as a};
|
|
2
|
+
//# sourceMappingURL=chunk-3GNFUVFA.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as d,c as f,e as u,t as p}from"./chunk-7OX2O53H.js";var m={0:"UnspecifiedKind",1:"AbstractMethod",2:"Accessor",3:"Array",4:"Assertion",5:"AssociatedType",6:"Attribute",7:"Axiom",8:"Boolean",9:"Class",10:"Constant",11:"Constructor",12:"Contract",13:"DataFamily",14:"DefinitionMacro",15:"Delegate",16:"Enum",17:"EnumMember",18:"Error",19:"Event",20:"Fact",21:"Field",22:"File",23:"Function",24:"Getter",25:"Grammar",26:"Instance",27:"Interface",28:"Key",29:"Lang",30:"Lemma",31:"Library",32:"Macro",33:"Method",34:"MethodAlias",35:"MethodReceiver",36:"MethodSpecification",37:"Message",38:"Modifier",39:"Module",40:"Namespace",41:"Null",42:"Number",43:"Object",44:"Operator",45:"Package",46:"PackageObject",47:"Parameter",48:"ParameterLabel",49:"Pattern",50:"Predicate",51:"Property",52:"Protocol",53:"ProtocolMethod",54:"PureVirtualMethod",55:"Quasiquoter",56:"SelfParameter",57:"Setter",58:"Signature",59:"SingletonClass",60:"SingletonMethod",61:"StaticDataMember",62:"StaticEvent",63:"StaticField",64:"StaticMethod",65:"StaticProperty",66:"StaticVariable",67:"String",68:"Struct",69:"Subscript",70:"Tactic",71:"Theorem",72:"ThisParameter",73:"Trait",74:"TraitMethod",75:"Type",76:"TypeAlias",77:"TypeClass",78:"TypeClassMethod",79:"TypeFamily",80:"TypeParameter",81:"Union",82:"Value",83:"Variable"},c=new Map;for(let[e,i]of Object.entries(m))c.set(i.toLowerCase(),Number(e));function y(e){let i=parseInt(e,10);if(!isNaN(i))return i;let s=e.toLowerCase(),n=c.get(s);if(n!==void 0)return n;for(let[r,o]of c)if(r.includes(s))return o;return null}function K(e,i,s={}){let{scope:n,limit:r=100}=s,o=y(i);return o===null?[]:b(e,n).map(t=>({row:t,resolvedKind:g(t)})).filter(t=>t.resolvedKind===o).slice(0,r).map(({row:t,resolvedKind:l})=>({symbol:t.symbol,shortName:f(t.symbol),kind:l,kindName:m[l]??"Unknown",relativePath:t.relative_path,startLine:t.start_line,endLine:t.end_line}))}function P(e,i={}){let s=new Map;for(let n of b(e,i.scope)){let r=g(n);r===null||r===0||s.set(r,(s.get(r)??0)+1)}return[...s.entries()].sort((n,r)=>r[1]-n[1]||n[0]-r[0]).map(([n,r])=>({kind:n,kindName:m[n]??"Unknown",count:r}))}function b(e,i){return p(e,{scope:i}).map(S)}function S(e){return{symbol:e.symbol,kind:e.kind,documentation:e.documentation,enclosing_symbol:e.enclosingSymbol,relative_path:e.relativePath,start_line:e.startLine,end_line:e.endLine}}function g(e){return e.kind!==null&&e.kind!==0?h(e.kind,e.symbol,e.documentation):k(e.symbol,e.documentation,e.enclosing_symbol)}function h(e,i,s){let n=(s??"").toLowerCase();if(u(i)==="type"){if(n.includes("type "))return 76;if(n.includes("interface "))return 27;if(n.includes("struct "))return 68;if(n.includes("trait "))return 73;if(n.includes("class "))return 9}return e}function k(e,i,s){let n=d(e);if("kind"in n)return null;let r=n.descriptors,o=r[r.length-2]??null,a=u(e),t=(i??"").toLowerCase();return a==="type"?t.includes("type ")?76:t.includes("interface ")?27:t.includes("struct ")?68:t.includes("trait ")?73:(t.includes("class "),9):a==="method"?o?.suffix==="type"?33:23:a==="namespace"?39:a!=="term"?null:t.includes("async def ")||t.includes("def ")?23:(s?u(s):o?.suffix??null)==="type"?21:83}export{K as a,P as b};
|
|
2
|
+
//# sourceMappingURL=chunk-3OUC276S.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
1
|
+
import{a as s}from"./chunk-DFK54IRN.js";function m(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-55ZJ2FCW.js";function a(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 o(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-55ZJ2FCW.js";function a(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{a,
|
|
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{m as a,o as b};
|
|
33
|
+
//# sourceMappingURL=chunk-4STLJYHI.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import{a as g}from"./chunk-DFK54IRN.js";import{b as u}from"./chunk-7O4MJYIW.js";import{a as p}from"./chunk-ZNUPGRPR.js";import{b as a}from"./chunk-RCJEFQOK.js";import{c as l,d as c,h as f}from"./chunk-7OX2O53H.js";import{a as d}from"./chunk-NN3O7TPH.js";function J(e,s,t={}){return I(e,s,t)?.map(r=>({symbol:r.symbol,shortName:r.shortName,fromFile:r.fromFile}))??[]}function P(e,s){let t=N(e,s);return t.length>0?t:E(e,s)}function v(e,s,t={}){return I(e,s,t)?.filter(r=>!r.used).map(r=>({symbol:r.symbol,shortName:r.shortName,importedIn:r.importer}))??[]}function N(e,s){return e.all(`SELECT DISTINCT gs.symbol, d.relative_path AS importer
|
|
2
|
+
FROM mentions m
|
|
3
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
4
|
+
JOIN documents d ON c.document_id = d.id
|
|
5
|
+
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
6
|
+
WHERE gs.symbol LIKE ?
|
|
7
|
+
AND m.role = 2
|
|
8
|
+
ORDER BY d.relative_path`,`%${s}%`).filter(r=>!e.isIgnored(r.importer)).map(r=>({symbol:r.symbol,shortName:l(r.symbol),fromFile:r.importer}))}function E(e,s){let t=p(e,s),r=t?.relativePath??null,o=t?c(t.symbol):s.replace(/\(\)$/,""),m=t?f(t.symbol):!1,i=new Set;for(let n of d(e,{includeIgnored:!1}))for(let _ of a(e,n))S(_,n,{targetFile:r,targetLeaf:o,targetIsModule:m})&&i.add(n);return[...i].sort().map(n=>({symbol:t?.symbol??o,shortName:t?l(t.symbol):o,fromFile:n}))}function S(e,s,t){return!e.sourcePath||t.targetFile&&b(e.sourcePath)!==b(t.targetFile)?!1:e.kind==="side-effect"||t.targetFile&&R(s)||t.targetIsModule||e.kind==="named"&&e.importedName===t.targetLeaf?!0:e.kind==="namespace"&&e.usedMembers.includes(t.targetLeaf)}function I(e,s,t={}){let r=g(e,s);return r?y(e,r,t)??(t.semantic===!1?null:F(e,r))??O(e,r):null}function y(e,s,t){let o=e.all(`SELECT DISTINCT
|
|
9
|
+
gs.symbol,
|
|
10
|
+
def_d.relative_path AS from_file,
|
|
11
|
+
imp_d.relative_path AS importer,
|
|
12
|
+
EXISTS (
|
|
13
|
+
SELECT 1
|
|
14
|
+
FROM mentions ref_m
|
|
15
|
+
JOIN chunks ref_c ON ref_m.chunk_id = ref_c.id
|
|
16
|
+
WHERE ref_m.symbol_id = gs.id
|
|
17
|
+
AND ref_m.role != 1
|
|
18
|
+
AND ref_c.document_id = imp_d.id
|
|
19
|
+
) AS used
|
|
20
|
+
FROM mentions m
|
|
21
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
22
|
+
JOIN documents imp_d ON c.document_id = imp_d.id
|
|
23
|
+
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
24
|
+
LEFT JOIN (
|
|
25
|
+
SELECT m2.symbol_id, c2.document_id
|
|
26
|
+
FROM mentions m2
|
|
27
|
+
JOIN chunks c2 ON m2.chunk_id = c2.id
|
|
28
|
+
WHERE m2.role = 1
|
|
29
|
+
GROUP BY m2.symbol_id
|
|
30
|
+
) sym_def ON sym_def.symbol_id = gs.id
|
|
31
|
+
LEFT JOIN documents def_d ON sym_def.document_id = def_d.id
|
|
32
|
+
WHERE imp_d.relative_path = ?
|
|
33
|
+
AND m.role = 2
|
|
34
|
+
ORDER BY def_d.relative_path, gs.symbol`,s).filter(m=>!e.isIgnored(m.importer));if(o.length>0){let m=t.semantic===!1?[]:u(e,s);return o.map(i=>({symbol:i.symbol,shortName:l(i.symbol),fromFile:i.from_file??"(external)",importer:i.importer,used:i.used!==0||m.some(n=>n.isUsed&&n.sourcePath===i.from_file)}))}return null}function F(e,s){let t=u(e,s);return t.length>0?t.map(r=>{let o=h(r.importedName,r.localName,r.kind);return{symbol:o,shortName:o,fromFile:r.sourcePath??"(external)",importer:s,used:r.kind==="side-effect"?!0:r.isUsed}}):null}function O(e,s){return a(e,s).map(t=>{let r=h(t.importedName,t.localName,t.kind),o=t.kind==="side-effect"?!0:t.used;return{symbol:r,shortName:r,fromFile:t.sourcePath??"(external)",importer:s,used:o}})}function h(e,s,t){return t==="namespace"&&e==="*"&&s?`* as ${s}`:t==="default"&&s?`default as ${s}`:t==="side-effect"?"(side effect import)":s&&s!==e?`${e} as ${s}`:e}function b(e){return e.replace(/\\/g,"/")}function R(e){return/\.(?:c|h|cc|cpp|cxx|hpp|hh|hxx)$/i.test(e)}export{J as a,P as b,v as c};
|
|
35
|
+
//# sourceMappingURL=chunk-563HLCDW.js.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import{a as w,c as k}from"./chunk-NHDPYW7O.js";import{existsSync as I,readFileSync as O}from"fs";import{join as B}from"path";var C=w("source-text");function y(e,n){let t=n.replace(/\\/g,"/");return C.get(e,t,()=>{let r=B(e.config.projectRoot,t);return I(r)?O(r,"utf-8"):""})}function pe(e){C.invalidateAll(e)}function fe(e,n){C.invalidate(e,n.replace(/\\/g,"/"))}var W=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale|wrapper|passthrough|drift|extract)?/i;function de(e,n,t){if(t<=0)return!1;let r=y(e,n);if(!r)return!1;let c=r.split(`
|
|
2
|
+
`);for(let a=t-1;a>=0&&a>=t-5;a-=1){let s=(c[a]??"").trim();if(s!==""){if(W.test(s))return!0;if(!s.startsWith("//")&&!s.startsWith("*")&&!s.startsWith("/*")&&!s.startsWith("@")&&!s.startsWith("#"))return!1}}return!1}import{extname as v}from"path";var F={".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"};function d(e){return F[v(e).toLowerCase()]??null}function S(e){return v(e).toLowerCase()===".vue"}import{createRequire as Y}from"module";var f=Y(import.meta.url),_=null,j=!1;function P(){if(j)return null;if(_)return _;try{return _=f("tree-sitter"),_}catch{return j=!0,null}}var E=new Map,A=new Set;function Q(e){if(A.has(e))return null;let n=E.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 A.add(e),null}return E.set(e,t),t}var N=new Map;function V(e){let n=N.get(e);if(n)return n;let t=Q(e);if(!t)return null;let r=P();if(!r)return null;let c=new r;try{c.setLanguage(t)}catch{return A.add(e),null}return N.set(e,c),c}function U(e,n){return e.parse(r=>r>=n.length?null:n.slice(r,Math.min(n.length,r+16384)))}function L(e,n){let t=V(e);if(!t)return null;try{return U(t,n)}catch{return null}}var g=new Map;function D(e,n){let t=`${e}::${n}`;if(g.has(t))return g.get(t)??null;let r=Q(e);if(!r)return g.set(t,null),null;let c=P();if(!c)return g.set(t,null),null;try{let a=new c.Query(r,n);return g.set(t,a),a}catch{return g.set(t,null),null}}function R(e){let n=[],t=/<script\b([^>]*)>([\s\S]*?)<\/script>/g;for(let i of e.matchAll(t))typeof i.index=="number"&&n.push({tagOpen:i[1]??"",body:i[2]??"",openIdx:i.index+(i[0].length-(i[2]?.length??0)-9)});if(n.length===0)return null;let r=n.find(i=>/\bsetup\b/.test(i.tagOpen))??n[0],a=r.tagOpen.match(/\blang\s*=\s*["']?([\w-]+)/)?.[1]?.toLowerCase(),s=a==="ts"||a==="typescript"?"typescript":a==="tsx"?"tsx":"javascript";return{body:r.body,startLine:q(e,r.openIdx),language:s}}function q(e,n){let t=0;for(let r=0;r<n&&r<e.length;r++)e.charCodeAt(r)===10&&t++;return t}var h=k("ast-trees");function H(e){h.invalidateAll(e)}function G(e,n){h.invalidate(e,n)}function b(e,n){if(S(n))return z(e,n);let t=d(n);if(!t)return null;let r=y(e,n);return r?h.get(e,n,r,()=>L(t,r)):null}function z(e,n){let t=y(e,n);return t?h.get(e,n,t,()=>{let r=R(t);if(!r)return null;let c=`
|
|
3
|
+
`.repeat(r.startLine)+r.body;return L(r.language,c)}):null}var X={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
|
+
`},$=new WeakMap;function J(e,n){return T(e,n,$,X,t=>{let r=[];for(let c of t){let a=null,s=null;for(let i of c.captures)i.name==="name"?a=i.node.text:i.name==="def"&&(s={startLine:i.node.startPosition.row,endLine:i.node.endPosition.row});a&&s&&r.push({name:a,startLine:s.startLine,endLine:s.endLine})}return r})}var K={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
|
+
`},Z=new WeakMap;function ee(e,n){return T(e,n,Z,K,t=>{let r=[];for(let c of t){let a=null,s=null;for(let o of c.captures)o.name==="target"?a=o.node:o.name==="call"&&(s=o.node);if(!a||!s)continue;let i=x(a);i&&r.push({calleeLeaf:i,memberAccess:te(a),line:s.startPosition.row})}return r})}function te(e){switch(e.type){case"field_expression":case"member_expression":case"attribute":return!0;default:return!1}}var ne=new WeakMap;function re(e,n){return M(e,n,ne,()=>new Map,(t,r,c)=>{let a=(o,l)=>{if(o===l)return;let u=c.get(o);u||(u=new Set,c.set(o,u)),u.add(l)},s=r==="python"?new Set(["identifier"]):new Set(["type_identifier"]),i=(o,l)=>{let u=p=>{s.has(p.type)&&p.text!==l&&a(p.text,l);for(let m of p.children)u(m)};for(let p of o.children)u(p)};if(r==="rust")for(let o of t.rootNode.descendantsOfType(["struct_item","enum_item","union_item","type_item"])){let l=o.namedChildren.find(p=>p.type==="type_identifier")?.text;if(!l)continue;let u=o.namedChildren.find(p=>p.type==="field_declaration_list"||p.type==="enum_variant_list"||p.type==="ordered_field_declaration_list");u&&i(u,l),o.type==="type_item"&&i(o,l)}else if(r==="python")for(let o of t.rootNode.descendantsOfType("class_definition")){let l=o.namedChildren.find(p=>p.type==="identifier")?.text;if(!l)continue;let u=o.namedChildren.find(p=>p.type==="block");if(u)for(let p of u.descendantsOfType("type"))for(let m of p.descendantsOfType("identifier"))m.text!==l&&a(m.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&&i(o,l)}})??new Map}function M(e,n,t,r,c){let a=d(n);if(!a)return null;let s=b(e,n);if(!s)return null;let i=t.get(s);if(i)return i;let o=r();return c(s,a,o),t.set(s,o),o}function T(e,n,t,r,c){let a=d(n);if(!a)return null;let s=r[a];if(!s)return null;let i=b(e,n);if(!i)return null;let o=t.get(i);if(o)return o;let l=D(a,s);if(!l)return null;let u=c(l.matches(i.rootNode));return t.set(i,u),u}function x(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?x(n):null}case"scoped_identifier":{let n=e.childForFieldName("name")??e.namedChild(e.namedChildCount-1);return n?x(n):null}case"super":case"self":case"this":return null;default:return null}}var ae=new Set(["function_item","function_signature_item"]),ie=new Set(["function_definition"]),se=new Set(["function_declaration","method_definition","arrow_function","function_expression"]);function oe(e){switch(e){case"rust":return ae;case"python":return ie;default:return se}}export{y as a,pe as b,fe as c,de as d,d as e,S as f,oe as g,H as h,G as i,b as j,J as k,ee as l,re as m,M as n,x as o};
|
|
44
|
+
//# sourceMappingURL=chunk-5TT47UMX.js.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import we from"better-sqlite3";import{existsSync as Lt,readFileSync as It,writeFileSync as Ft}from"fs";import{dirname as Et,join as wt,resolve as Oe}from"path";import Q from"better-sqlite3";import{execFileSync as Z}from"child_process";import{existsSync as ee,readdirSync as te,readFileSync as ne}from"fs";import{extname as m,join as I}from"path";import G from"ignore";import{readFileSync as U,existsSync as b}from"fs";import{dirname as h,isAbsolute as V,join as S,relative as K,resolve as B}from"path";function k(e){let t=G(),r=!1,n=J(e);for(let o of n)try{let i=U(o,"utf-8");t.add(i),r=!0}catch{}return r||t.add(z),{isIgnored:o=>x(t,e,o),filter:o=>o.filter(i=>!x(t,e,i))}}function J(e){let t=[],r=S(e,".gitignore");b(r)&&t.push(r);let n=h(e),o=0;for(;n!==h(n)&&o<5;){let i=S(n,".gitignore");if(b(i)&&t.push(i),b(S(n,".git")))break;n=h(n),o++}return t}var z=`
|
|
2
|
+
# Dependencies
|
|
3
|
+
node_modules/
|
|
4
|
+
vendor/
|
|
5
|
+
.bundle/
|
|
6
|
+
|
|
7
|
+
# Build output
|
|
8
|
+
dist/
|
|
9
|
+
build/
|
|
10
|
+
out/
|
|
11
|
+
target/
|
|
12
|
+
bin/
|
|
13
|
+
obj/
|
|
14
|
+
|
|
15
|
+
# Python
|
|
16
|
+
__pycache__/
|
|
17
|
+
*.pyc
|
|
18
|
+
*.pyo
|
|
19
|
+
.venv/
|
|
20
|
+
venv/
|
|
21
|
+
.env/
|
|
22
|
+
env/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
|
|
25
|
+
# Rust
|
|
26
|
+
target/
|
|
27
|
+
|
|
28
|
+
# Java / Kotlin / Scala
|
|
29
|
+
*.class
|
|
30
|
+
.gradle/
|
|
31
|
+
.mvn/
|
|
32
|
+
|
|
33
|
+
# C# / .NET
|
|
34
|
+
bin/
|
|
35
|
+
obj/
|
|
36
|
+
packages/
|
|
37
|
+
|
|
38
|
+
# Go
|
|
39
|
+
vendor/
|
|
40
|
+
|
|
41
|
+
# Dart
|
|
42
|
+
.dart_tool/
|
|
43
|
+
build/
|
|
44
|
+
|
|
45
|
+
# PHP
|
|
46
|
+
vendor/
|
|
47
|
+
|
|
48
|
+
# IDE / OS
|
|
49
|
+
.idea/
|
|
50
|
+
.vscode/
|
|
51
|
+
*.swp
|
|
52
|
+
*.swo
|
|
53
|
+
.DS_Store
|
|
54
|
+
Thumbs.db
|
|
55
|
+
|
|
56
|
+
# Type definitions (often noise in queries)
|
|
57
|
+
*.d.ts
|
|
58
|
+
`;function x(e,t,r){let n=X(t,r);if(!n)return!1;try{return e.ignores(n)}catch{return!1}}function X(e,t){if(!t||t===".")return null;if(!V(t)&&!t.startsWith(".."))return t.replaceAll("\\","/");let r=V(t)?t:B(e,t),n=K(e,r).replaceAll("\\","/");return!n||n==="."||n.startsWith("..")?null:n}import{readdirSync as Je}from"fs";import{extname as Xe,join as qe}from"path";function T(e){let t=new WeakMap,r=n=>{let o=t.get(n);return o||(o=new Map,t.set(n,o)),o};return{get(n,o,i){let s=r(n);if(s.has(o))return s.get(o);let a=i();return s.set(o,a),a},invalidate(n,o){t.get(n)?.delete(o)},invalidateAll(n){t.delete(n)},size(n){return t.get(n)?.size??0}}}var q=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".rs",".py",".pyi",".java",".kt",".kts",".scala",".sc",".rb",".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx",".cs",".vb",".php",".dart"],C=[".vue"],Y=new Set(q.map(e=>e.toLowerCase())),Qe=[...Y].sort().join(","),L=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo","out","coverage",".scipquery-cache","__pycache__",".venv","venv",".idea",".vscode"]);var Ze=T("source-files");function at(e){let t=new Set((e.extensions??C).map(i=>i.toLowerCase()));if(t.size===0)return{scanned:0,inserted:0,existing:0};if(!ee(e.dbPath))throw new Error(`SCIP SQLite database not found at ${e.dbPath}`);let r=k(e.projectRoot),n=re(e.projectRoot,t).filter(i=>!r.isIgnored(i)),o=new Q(e.dbPath);try{let i=ie(o,n),s=o.prepare(`INSERT OR IGNORE INTO documents (language, relative_path, position_encoding, text)
|
|
59
|
+
VALUES (?, ?, NULL, ?)`),u=o.transaction(l=>{let p=0;for(let g of l){if(i.has(g))continue;let d=ne(I(e.projectRoot,g),"utf-8"),H=s.run(se(g),g,d);p+=Number(H.changes)}return p})(n),c={scanned:n.length,inserted:u,existing:n.length-u};return e.onStatus?.(`Augmented SQLite documents with ${u} auxiliary source file${u===1?"":"s"} (${c.existing} already present).`),c}finally{o.close()}}function re(e,t){let r=oe(e,t);if(r)return r;let n=[],o=i=>{let s=i?I(e,i):e,a;try{a=te(s,{withFileTypes:!0})}catch{return}for(let u of a){if(L.has(u.name))continue;let c=i?`${i}/${u.name}`:u.name;if(u.isDirectory()){o(c);continue}t.has(m(u.name).toLowerCase())&&n.push(c)}};return o(""),n.sort()}function oe(e,t){try{return Z("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"]}).split(`
|
|
60
|
+
`).filter(n=>n&&t.has(m(n).toLowerCase())).sort()}catch{return null}}function ie(e,t){let r=new Set,n=500;for(let o=0;o<t.length;o+=n){let i=t.slice(o,o+n),s=e.prepare(`SELECT relative_path FROM documents WHERE relative_path IN (${i.map(()=>"?").join(",")})`).all(...i);for(let a of s)r.add(a.relative_path)}return r}function se(e){return m(e).toLowerCase()===".vue"?"vue":m(e).replace(/^\./,"").toLowerCase()||"source"}import{execFileSync as ae}from"child_process";import{createHash as ue}from"crypto";import{readdirSync as ce,readFileSync as le}from"fs";import{join as F}from"path";function ge(e){return(de(e)??fe(e)).filter(t=>t&&!D(t)).sort()}function ft(e){return ge(e).map(t=>{let r=F(e,t);try{let n=le(r);return{path:t,size:n.byteLength,hash:ue("sha256").update(n).digest("hex")}}catch{return{path:t,size:-1,hash:"unreadable"}}})}function de(e){try{return ae("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:50*1024*1024,stdio:["ignore","pipe","ignore"]}).split(`
|
|
61
|
+
`).filter(Boolean)}catch{return null}}function fe(e){let t=[],r=[""];for(;r.length>0;){let n=r.pop(),o=n?F(e,n):e,i;try{i=ce(o,{withFileTypes:!0})}catch{continue}for(let s of i){let a=n?`${n}/${s.name}`:s.name;if(s.isDirectory()){D(a)||r.push(a);continue}t.push(a)}}return t}function D(e){return e.split("/").some(r=>pe.has(r))||e.endsWith(".db")||e.endsWith(".db-wal")||e.endsWith(".db-shm")||e.endsWith(".scip")}var pe=new Set([".git","node_modules",".scipquery-cache",".stryker-tmp","dist","build","coverage",".next",".nuxt","target"]);import{createRequire as me}from"module";import{existsSync as be,readFileSync as v}from"fs";import{dirname as E,extname as he,join as w,relative as Se,resolve as St}from"path";import{pathToFileURL as ye}from"url";function O(e,t){let{vueCore:r,ts:n,volarTs:o}=ve(e),{parsed:i,vueOptions:s}=Re(r,n,t),a=E(t),u=r.createVueLanguagePlugin(n,i.options,s,d=>d),c=Ve(r,n,u),l=xe(a,i),{languageServiceHost:p}=o.createLanguageServiceHost(n,n.sys,c,d=>d,l),g=n.createLanguageService(p);return{ts:n,language:c,languageService:g,fileNames:i.fileNames,configDir:a}}function ve(e){let t=me(ye(w(e,"package.json")).href);return{vueCore:y(t,"@vue/language-core",e),ts:y(t,"typescript",e),volarTs:y(t,"@volar/typescript",e)}}function Re(e,t,r){let n=t.readConfigFile(r,t.sys.readFile);if(n.error||!n.config)throw new Error(`Failed to read ${r}`);let i=e.createParsedCommandLine(t,t.sys,r).vueOptions;return typeof e.createGlobalTypesWriter=="function"&&(i.globalTypesPath=e.createGlobalTypesWriter(i,t.sys.writeFile)),{parsed:t.parseJsonConfigFileContent(n.config,t.sys,E(r),void 0,r,void 0,e.getAllExtensions(i).map(s=>({extension:s.slice(1),isMixedContent:!0,scriptKind:t.ScriptKind.Deferred}))),vueOptions:i}}function Ve(e,t,r){let n={},o=e.createLanguage([r],new Map,i=>{if(!be(i))return;let s=v(i,"utf-8");n.current?.scripts.set(i,t.ScriptSnapshot.fromString(s),r.getLanguageId(i)??Le(i))});return n.current=o,o}function xe(e,t){return{getCurrentDirectory:()=>e,getCompilationSettings:()=>t.options,getScriptFileNames:()=>t.fileNames,getProjectReferences:()=>t.projectReferences,getProjectVersion:()=>"0"}}function y(e,t,r){try{return e(t)}catch(n){throw(typeof n=="object"&&n!==null&&"code"in n?n.code:null)==="MODULE_NOT_FOUND"?new Error(`Vue augmentation requires ${t} to be installed in ${r}. Install Vue/Volar dependencies for that project, then rerun augment-vue.`,{cause:n}):n}}function A(e,t,r){let n=ke(e);return o=>{let i=f(t,o.fileName),s=r.get(o.fileName);if(!s)return null;let a=r.positionAt(s,o.textSpan.start),u=n.get(i);if(!u)return null;let c=u.containingByLine.get(a.line);return c!==void 0?c:Te(u.starts,a.line,2)}}function ke(e){let t=e.prepare(`
|
|
62
|
+
SELECT
|
|
63
|
+
d.relative_path AS relativePath,
|
|
64
|
+
der.start_line AS startLine,
|
|
65
|
+
der.end_line AS endLine,
|
|
66
|
+
der.symbol_id AS symbolId
|
|
67
|
+
FROM defn_enclosing_ranges der
|
|
68
|
+
JOIN documents d ON d.id = der.document_id
|
|
69
|
+
ORDER BY d.relative_path, (der.end_line - der.start_line) DESC
|
|
70
|
+
`).all(),r=new Map;for(let n of t){let o=r.get(n.relativePath);o||(o={containingByLine:new Map,starts:[]},r.set(n.relativePath,o)),o.starts.push({line:n.startLine,symbolId:n.symbolId});for(let i=n.startLine;i<=n.endLine;i++)o.containingByLine.set(i,n.symbolId)}for(let n of r.values())n.starts.sort((o,i)=>o.line-i.line);return r}function Te(e,t,r){let n=0,o=e.length-1;for(;n<=o;){let s=Math.floor((n+o)/2);e[s].line<t?n=s+1:o=s-1}let i=null;for(let s of[o,n]){let a=e[s];if(!a)continue;let u=Math.abs(a.line-t);u>r||(!i||u<i.distance)&&(i={distance:u,symbolId:a.symbolId})}return i?.symbolId??null}function N(e,t){let r=Fe(t),n=e.prepare("SELECT id FROM global_symbols WHERE symbol = ?"),o=new Map;return{get(i){if(o.has(i))return o.get(i)??null;let s=De(n,r,t,i);return o.set(i,s),s}}}function P(e,t,r,n,o){if(e.fileName.endsWith(".vue")){let i=n.language.scripts.get(e.fileName),s=i?.generated?.languagePlugin.typescript?.getServiceScript(i.generated.root)?.code;if(i&&s){let a=n.language.maps.get(s,i);if(R(a,e.textSpan.start)!==null)return r.get(e.fileName)}return e.fileName.startsWith(o)?r.get(e.fileName):null}return t(e)}function*M(e){let t=/\b[A-Za-z_$][A-Za-z0-9_$]*\b/g,r=new Set(["script","setup","template","style","lang","scoped","true","false","null","undefined","const","let","var","import","from","export","return","if","else","for","while","function","class","type","interface","as","await","async"]),n;for(;n=t.exec(e);){let o=n[0];r.has(o)||(yield{text:o,start:n.index,end:n.index+o.length})}}function _(e,t){for(let[r]of e.toGeneratedLocation(t,n=>!!n.navigation))return r;return null}function R(e,t){let r=e;for(let[n]of r.toSourceLocation(t,o=>!!o.navigation))return n;return null}function Ce(e,t){let r=0,n=e.lineStarts.length-1;for(;r<=n;){let i=Math.floor((r+n)/2);e.lineStarts[i]<=t?r=i+1:n=i-1}let o=Math.max(0,n);return{line:o,character:t-e.lineStarts[o]}}function j(e,t){return f(e,t).startsWith("node_modules/")}function f(e,t){return Se(e,t).replaceAll("\\","/")}function Le(e){switch(he(e)){case".vue":return"vue";case".tsx":return"typescriptreact";case".ts":case".mts":case".cts":return"typescript";case".jsx":return"javascriptreact";case".js":case".mjs":case".cjs":return"javascript";case".json":return"json";default:return"typescript"}}function $(){let e=new Map;return{get(t){if(e.has(t))return e.get(t)??null;try{let r=v(t,"utf-8"),n={text:r,lineStarts:Ie(r)};return e.set(t,n),n}catch{return e.set(t,null),null}},positionAt:Ce}}function Ie(e){let t=[0];for(let r=0;r<e.length;r++)e.charCodeAt(r)===10&&t.push(r+1);return t}function Fe(e){try{let t=JSON.parse(v(w(e,"package.json"),"utf-8"));return{name:t.name??"workspace",version:t.version??"0.0.0"}}catch{return{name:"workspace",version:"0.0.0"}}}function De(e,t,r,n){let o=f(r,n),i=Ee(t.name,t.version,o);return e.get(i)?.id??null}function Ee(e,t,r){let n=r.split("/").map(o=>`\`${o.replaceAll("`","")}\``).join("/");return`scip-vue npm ${e} ${t} ${n}/default.`}function At(e){let t=Oe(e.projectRoot,e.tsconfig),r=O(e.projectRoot,t),n=new we(e.dbPath,{readonly:!0});try{let o=$();return Ae({projectRoot:e.projectRoot,vueFiles:e.vueFiles??[],tasks:e.tasks,context:r,symbolLookup:A(n,e.projectRoot,o),vueSymbolLookup:N(n,e.projectRoot),sourceReader:o})}finally{n.close()}}function Ae(e){let t=[],r=0,n=e.tasks??e.vueFiles.map(o=>({fileName:o,startOffset:0,endOffset:Number.POSITIVE_INFINITY,countFileSkip:!0}));for(let o of n){let i=Ne(e,o);t.push(...i.occurrences),r+=i.skippedReferences}return{occurrences:t,skippedReferences:r}}function Ne(e,t){let r=e.context.language.scripts.get(t.fileName),n=r?.generated?.languagePlugin.typescript?.getServiceScript(r.generated.root)?.code;if(!r||!n)return{occurrences:[],skippedReferences:t.countFileSkip?1:0};let o=e.sourceReader.get(t.fileName);if(!o)return{occurrences:[],skippedReferences:t.countFileSkip?1:0};let i=e.context.language.maps.get(n,r),s=f(e.projectRoot,t.fileName),a=[...M(o.text)],u={tokens:a.filter(c=>c.start>=t.startOffset&&c.start<t.endOffset),tokenByStart:new Map(a.map(c=>[c.start,c])),tokenTextCounts:_e(a),processedStarts:new Set};return Pe({...e,fileName:t.fileName,sourceInfo:o,sourceFile:s,map:i,tokenContext:u})}function Pe(e){let t=[],r=0;for(let n of e.tokenContext.tokens){if(e.tokenContext.processedStarts.has(n.start))continue;let o=_(e.map,n.start);if(o===null)continue;let s=(e.context.languageService.getDefinitionAtPosition(e.fileName,o+1)??[]).find(u=>!j(e.projectRoot,u.fileName));if(!s){r++;continue}let a=P(s,e.symbolLookup,e.vueSymbolLookup,e.context,e.projectRoot);if(a===null){r++;continue}W(t,e.sourceReader,e.sourceInfo,e.sourceFile,n,a),e.tokenContext.processedStarts.add(n.start),Me(t,e,n,o,a)}return{occurrences:t,skippedReferences:r}}function Me(e,t,r,n,o){if(!((t.tokenContext.tokenTextCounts.get(r.text)??0)<=1))for(let i of je(t.context.languageService,t.fileName,n+1,t.map,r,t.tokenContext.tokenByStart)){if(t.tokenContext.processedStarts.has(i))continue;let s=t.tokenContext.tokenByStart.get(i);s&&(W(e,t.sourceReader,t.sourceInfo,t.sourceFile,s,o),t.tokenContext.processedStarts.add(i))}}function W(e,t,r,n,o,i){let s=t.positionAt(r,o.start);e.push({sourceFile:n,sourceLine:s.line,sourceStartChar:s.character,sourceEndChar:s.character+o.text.length,symbolId:i})}function _e(e){let t=new Map;for(let r of e)t.set(r.text,(t.get(r.text)??0)+1);return t}function je(e,t,r,n,o,i){let s=e.getDocumentHighlights?.(t,r,[t])??[],a=[];for(let u of s)if(u.fileName===t)for(let c of u.highlightSpans){let l=$e(n,c.textSpan.start,i,o.text);l!==null&&a.push(l)}return a}function $e(e,t,r,n){let o=r.get(t);if(o?.text===n)return o.start;let i=R(e,t);if(i===null)return null;let s=r.get(i);return s?.text===n?s.start:null}export{at as a,ft as b,At as c};
|
|
71
|
+
//# sourceMappingURL=chunk-6H2XIIPY.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b as N}from"./chunk-ARBZM2NF.js";import{a as I,b as S}from"./chunk-ZNUPGRPR.js";import{c as h,e as b,s as p,w as g}from"./chunk-7OX2O53H.js";function x(o,s,r={}){let{maxDepth:c=5,scope:a}=r,l=I(o,s);if(!l)return[];let u=[],f=new Set([l.symbolId]),m=new Set,t=[l];for(let e=1;e<=c&&t.length!==0;e++){let i=[];for(let y of t)for(let n of D(o,y,a)){let d=`${n.file}|${n.shortName}`;if(n.symbolId!==null){if(f.has(n.symbolId))continue;f.add(n.symbolId)}else if(m.has(d))continue;m.add(d),u.push({symbol:n.symbol,shortName:n.shortName,file:n.file,depth:e}),n.symbolId!==null&&n.symbolMatch&&i.push(n.symbolMatch)}t=i}return u.sort((e,i)=>e.depth-i.depth||e.file.localeCompare(i.file)),u}function D(o,s,r){let c=N(o,s,{limit:500}).filter(t=>!o.isIgnored(t.file)).filter(t=>!r||t.file.includes(r)),a=new Set(c.map(t=>t.file)),l=[];for(let t of M(o,s,r)){if(a.has(t))continue;let e=p(o,t),i=e.length>0?g(e,e[0].startLine):null;l.push({symbol:i?.symbol??t,file:t})}let u=[...c,...l],f=[],m=new Set;for(let t of u){let e=S(o,t.symbol);if(!e){let y=`${t.file}|${t.symbol}`;if(m.has(y))continue;m.add(y),f.push({symbolId:null,symbol:t.symbol,shortName:h(t.symbol),file:t.file,symbolMatch:null});continue}if(e.symbolId===s.symbolId||o.isIgnored(e.relativePath)||!_(e.symbol))continue;let i=`${e.symbolId}|${e.relativePath}`;m.has(i)||(m.add(i),f.push({symbolId:e.symbolId,symbol:e.symbol,shortName:h(e.symbol),file:e.relativePath,symbolMatch:e}))}return f}function M(o,s,r){let c=r?"AND consumer_d.relative_path LIKE ?":"",a=[s.symbolId,s.documentId];return r&&a.push(`%${r}%`),new Set(o.all(`SELECT DISTINCT consumer_d.relative_path
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
JOIN documents consumer_d ON consumer_d.id = c.document_id
|
|
@@ -6,5 +6,5 @@ import{k as N}from"./chunk-GS55K4WJ.js";import{a as I,b as S}from"./chunk-QYWGC7
|
|
|
6
6
|
AND m.role != 1
|
|
7
7
|
AND c.document_id != ?
|
|
8
8
|
${o.pathExclusionsFor("consumer_d")}
|
|
9
|
-
${c}`,...a).map(l=>l.relative_path).filter(l=>!o.isIgnored(l)))}function _(o){let s=b(o);return s==="method"||s==="type"||o.endsWith("().")}export{
|
|
10
|
-
//# sourceMappingURL=chunk-
|
|
9
|
+
${c}`,...a).map(l=>l.relative_path).filter(l=>!o.isIgnored(l)))}function _(o){let s=b(o);return s==="method"||s==="type"||o.endsWith("().")}export{x as a};
|
|
10
|
+
//# sourceMappingURL=chunk-72JOIFXL.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as P}from"./chunk-OHEIZWIA.js";import{a as v}from"./chunk-AQYBOORI.js";import{a as R}from"./chunk-TRNAQABL.js";import{d as w}from"./chunk-JTXKS5GK.js";import{a as L}from"./chunk-3GNFUVFA.js";import{b as x}from"./chunk-NYEMZHUC.js";import{a as S}from"./chunk-A2AVLALL.js";import{a as b}from"./chunk-NSTZMBAB.js";import{a as C}from"./chunk-XO6R3X5J.js";import{a as g}from"./chunk-FD37DBTD.js";import{a as H}from"./chunk-BI4F6GXI.js";import{a as d,b as y}from"./chunk-D6Z67MZL.js";import{e as u,f as l}from"./chunk-NKJKI6SE.js";function m(t){let e=z(t);return{score:I(t),overview:{documents:t.statsResult.documents,symbols:t.statsResult.symbols,indexSizeBytes:t.statsResult.indexSizeBytes},findings:{deadSymbols:t.dead.count,deadLoc:t.dead.loc,isolatedSymbols:t.isolated.count,isolatedLoc:t.isolated.loc,cycles:t.realCycleCount,similarPairs:t.similarCount,extractionCandidates:t.extractCount,wrappers:t.wrappers.count,passthroughs:t.passthroughs.count,staleTypes:t.stale.count,driftedFiles:t.drift.count,complexityHotspotCount:t.complexity.extremeCount},actions:e,topComplexity:t.complexity.top,warnings:t.warnings.length>0?t.warnings:void 0}}function z(t){let e=[];if(t.dead.count>0&&e.push({category:"Dead code",description:`${t.dead.count} symbols with zero references anywhere \u2014 safe to delete`,effort:"low",impact:"high",count:t.dead.count,locRecoverable:t.dead.loc}),t.isolated.count>0&&e.push({category:"Isolated symbols",description:`${t.isolated.count} symbols completely disconnected from the codebase graph`,effort:"low",impact:"medium",count:t.isolated.count,locRecoverable:t.isolated.loc}),t.realCycleCount>0&&e.push({category:"Circular dependencies",description:`${t.realCycleCount} cycle(s) \u2014 break with dependency inversion or module restructuring`,effort:"medium",impact:"high",count:t.realCycleCount,locRecoverable:0}),t.similarCount>0&&e.push({category:"Similar functions",description:`${t.similarCount} pairs with real logic overlap (beyond shared imports) \u2014 consolidation candidates`,effort:"medium",impact:"medium",count:t.similarCount,locRecoverable:0}),t.extractCount>0&&e.push({category:"Extraction candidates",description:`${t.extractCount} large functions with isolated callee clusters \u2014 extract method opportunities`,effort:"medium",impact:"medium",count:t.extractCount,locRecoverable:0}),t.wrappers.count>0&&e.push({category:"Wrapper functions",description:`${t.wrappers.count} single-consumer symbols that could be inlined`,effort:"low",impact:"low",count:t.wrappers.count,locRecoverable:t.wrappers.loc}),t.passthroughs.count>0&&e.push({category:"Passthrough functions",description:`${t.passthroughs.count} functions that just forward to one callee \u2014 unnecessary indirection`,effort:"low",impact:"low",count:t.passthroughs.count,locRecoverable:t.passthroughs.loc}),t.stale.count>0){let i=[];t.stale.unused>0&&i.push(`${t.stale.unused} unused`),t.stale.singleUse>0&&i.push(`${t.stale.singleUse} single-consumer (not in types file)`),e.push({category:"Stale abstractions",description:`${i.join(", ")} \u2014 premature abstraction`,effort:"low",impact:"medium",count:t.stale.count,locRecoverable:t.stale.loc})}if(t.drift.count>0){let i=[];t.drift.unusedImports>0&&i.push(`${t.drift.unusedImports} unused imports`),t.drift.layerViolations>0&&i.push(`${t.drift.layerViolations} layer violations`),e.push({category:"Structural drift",description:i.join(", "),effort:t.drift.layerViolations>0?"medium":"low",impact:t.drift.layerViolations>0?"medium":"low",count:t.drift.count,locRecoverable:0})}let a={high:3,medium:2,low:1},r={low:3,medium:2,high:1};return e.sort((i,n)=>{let c=a[i.impact]*r[i.effort];return a[n.impact]*r[n.effort]-c}),e}function I(t){let e=Math.max(t.statsResult.documents,1),a=Math.max(t.statsResult.symbols,1),r=100,i=t.dead.count/a;r-=Math.min(20,Math.round(i*200));let n=t.isolated.count/a;r-=Math.min(10,Math.round(n*200)),r-=Math.min(15,t.realCycleCount*5);let c=t.similarCount/a*1e3;r-=Math.min(10,Math.round(c));let f=t.extractCount/a*1e3;r-=Math.min(5,Math.round(f/2)),r-=Math.min(3,t.wrappers.count),r-=Math.min(3,t.passthroughs.count);let M=t.stale.count/Math.max(a*.1,1);r-=Math.min(8,Math.round(M*10));let _=t.drift.count/e;return r-=Math.min(5,Math.round(_*50)),r-=Math.min(5,t.complexity.extremeCount*2),Math.max(0,Math.min(100,r))}import{getHeapStatistics as $}from"v8";var N=64*1024*1024;function h(){let t=globalThis.gc;if(!t)return;let e=$();e.heap_size_limit-e.used_heap_size<N||t()}var O=50,j=75e3,U=5e3,E=2500,V=["overview","dead","isolated","cycles","similar","extract-candidates","wrapper-candidates","passthrough-candidates","stale-abstractions","drift","complexity-hotspots"],A={overview:(t,e,a,r)=>({phase:"overview",statsResult:r,warnings:a.warnings}),dead:(t,e,a)=>({phase:"dead",dead:G(t,e,a)}),isolated:(t,e,a)=>({phase:"isolated",isolated:F(t,e,a)}),cycles:(t,e,a)=>({phase:"cycles",realCycleCount:W(t,e,a)}),similar:(t,e,a)=>({phase:"similar",similarCount:q(t,e,a)}),"extract-candidates":(t,e,a)=>({phase:"extract-candidates",extractCount:Y(t,e,a)}),"wrapper-candidates":(t,e,a)=>({phase:"wrapper-candidates",wrappers:Q(t,e,a)}),"passthrough-candidates":(t,e,a)=>({phase:"passthrough-candidates",passthroughs:X(t,e,a)}),"stale-abstractions":(t,e,a)=>({phase:"stale-abstractions",stale:J(t,e,a)}),drift:(t,e,a)=>({phase:"drift",drift:K(t,e,a)}),"complexity-hotspots":(t,e,a)=>({phase:"complexity-hotspots",complexity:Z(t,e,a)})};function Rt(t,e={}){return T(t,e.full===!0,(a,r)=>{let i=k(t,e.scope,a,r);return m(i)})}function Lt(t,e,a={}){return T(t,a.full===!0,(r,i)=>A[e](t,a.scope,i,r))}function T(t,e,a){let r=v(t),i=tt(r,e);try{return a(r,i)}finally{d(t,{semanticProvider:!0}),h()}}function Pt(t){return m(D(t))}function D(t){let e=o(t,"overview");return{statsResult:e.statsResult,warnings:e.warnings,dead:o(t,"dead").dead,isolated:o(t,"isolated").isolated,realCycleCount:o(t,"cycles").realCycleCount,similarCount:o(t,"similar").similarCount,extractCount:o(t,"extract-candidates").extractCount,wrappers:o(t,"wrapper-candidates").wrappers,passthroughs:o(t,"passthrough-candidates").passthroughs,stale:o(t,"stale-abstractions").stale,drift:o(t,"drift").drift,complexity:o(t,"complexity-hotspots").complexity}}function o(t,e){let a=t.find(r=>r.phase===e);if(!a)throw new Error(`Missing health phase result: ${e}`);return a}function k(t,e,a,r){return D(V.map(i=>A[i](t,e,r,a)))}function G(t,e,a){return s(t,a,"dead",()=>{let r=y(t,{scope:e,minLoc:3,skipBarrels:!0,deadCodeOnly:!0,scanLimit:a.candidateScanLimit,semantic:!1});return p(rt(t,r.symbols))})}function F(t,e,a){return s(t,a,"isolated",()=>{let r=S(t,{scope:e,minLoc:3,scanLimit:a.candidateScanLimit,semantic:!1});return p(it(t,r))})}function W(t,e,a){return s(t,a,"cycles",()=>H(t,{scope:e}).filter(i=>i.kind==="real").length)}function q(t,e,a){return s(t,a,"similar",()=>x(t,{scope:e,minSimilarity:.6,limit:50,minCallees:4,scanLimit:a.candidateScanLimit,semantic:!1}).length)}function Y(t,e,a){return s(t,a,"extract-candidates",()=>C(t,{scope:e,minLoc:15,minCallees:5,limit:50,scanLimit:a.candidateScanLimit,semantic:!1}).length)}function Q(t,e,a){return B(t,a,"wrapper-candidates",()=>R(t,{scope:e,maxLoc:15,limit:50,scanLimit:a.candidateScanLimit,semantic:!1}))}function X(t,e,a){return B(t,a,"passthrough-candidates",()=>L(t,{scope:e,maxLoc:15,limit:50,scanLimit:a.candidateScanLimit,semantic:!1}))}function J(t,e,a){return s(t,a,"stale-abstractions",()=>{let r=P(t,{scope:e,minLoc:3,limit:50,scanLimit:a.candidateScanLimit,semantic:!1}),i=r.filter(n=>n.consumers===0).length;return{count:r.length,loc:r.reduce((n,c)=>n+c.loc,0),unused:i,singleUse:r.length-i}})}function K(t,e,a){return s(t,a,"drift",()=>{let r=b(t,{scope:e,semantic:!1});return{count:r.unusedImports+r.layerViolations,unusedImports:r.unusedImports,layerViolations:r.layerViolations}})}function Z(t,e,a){return s(t,a,"complexity-hotspots",()=>{let r=g(t,{scope:e,minLoc:10,limit:10,scanLimit:a.candidateScanLimit,semantic:!1});return{top:r.slice(0,5).map(i=>({symbol:i.shortName,score:i.score})),extremeCount:r.filter(i=>i.score>O).length}})}function tt(t,e){return t.symbols>=j||t.documents>=U?e?{candidateScanLimit:void 0,releaseCachesBetweenPhases:!0,warnings:["Large index detected; running unbounded health analyses because --full was supplied."]}:{candidateScanLimit:E,releaseCachesBetweenPhases:!0,warnings:[`Large index detected; candidate-style health checks scanned their highest-priority ${E} symbols. Run "scip-query health --full" for unbounded candidate counts.`]}:{candidateScanLimit:void 0,releaseCachesBetweenPhases:!0,warnings:[]}}function et(t,e){e.releaseCachesBetweenPhases&&(w(t),d(t),h())}function s(t,e,a,r){at(a);try{return r()}finally{et(t,e)}}function B(t,e,a,r){return s(t,e,a,()=>p(r()))}function at(t){process.env.SCIP_QUERY_HEALTH_TRACE==="1"&&console.error(`[health] ${t}`)}function rt(t,e){return e.filter(a=>!u(t,a.relativePath)&&!l(t,a.symbol,a.relativePath)&&a.kind==="dead-code")}function it(t,e){return e.filter(a=>!u(t,a.relativePath)&&!l(t,a.symbol,a.relativePath))}function p(t){return{count:t.length,loc:t.reduce((e,a)=>e+a.loc,0)}}export{V as a,Rt as b,Lt as c,Pt as d};
|
|
2
|
+
//# sourceMappingURL=chunk-7H4RJ4MC.js.map
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import{l as T}from"./chunk-BOVNTAKQ.js";import{d as N,s as k}from"./chunk-7OX2O53H.js";import{a as x}from"./chunk-NN3O7TPH.js";function p(i,e,t){if(i.has(e))return i.get(e);let n=t();return i.set(e,n),n}import _ from"path";function oe(i,e){return i.getReferences().map(t=>{let n=t.getNode();return $(n,e)})}function se(i){let e=i;return typeof e.findReferences=="function"?e.findReferences():[]}function U(i,e,t,n){let r=[];for(let o of se(i))for(let s of oe(o,n))s.file===e.relativePath&&s.line>=e.startLine&&s.line<=e.endLine||r.push(s);for(let o of t)r.push(o);return E(r)}function W(i,e,t,n){let r=[],o=t?.getStart();for(let s of i.getReferences()){let a=s.getNode();y(n,a.getSourceFile().getFilePath())===e&&(o!==void 0&&a.getStart()===o||r.push({location:$(a,n),node:a}))}return r}function $(i,e){let t=i.getSourceFile(),n=t.getLineAndColumnAtPos(i.getStart());return{file:y(e,t.getFilePath())??t.getBaseName(),line:n.line-1,column:n.column-1}}function B(i,e,t){let n=i.getSourceFile(),r=g(n,i),o=i.getText(),s=new RegExp(`\\b${ae(o)}\\b`,"g"),a=n.getFullText().split(`
|
|
2
|
+
`),l=[];for(let c=0;c<a.length;c++){if(c===r)continue;let f=a[c]??"";s.lastIndex=0;let u;for(;(u=s.exec(f))!==null;)l.push({file:e,line:c,column:u.index})}return E(l.filter(c=>y(t,_.join(t,c.file))===e))}function P(i){for(let e=i;e;e=e.getParent()){let t=e.getKindName();if(t.includes("Type")||t==="InterfaceDeclaration"||t==="TypeAliasDeclaration")return!0;if(t==="CallExpression"||t==="NewExpression"||t==="ExpressionStatement")return!1}return!1}function g(i,e){return i.getLineAndColumnAtPos(e.getStart()).line-1}function E(i){let e=new Set,t=[];for(let n of i){let r=`${n.file}:${n.line}:${n.column}`;e.has(r)||(e.add(r),t.push(n))}return t}function y(i,e){let t=_.relative(i||process.cwd(),e).replace(/\\/g,"/");return!t||t.startsWith("..")?null:t}function ae(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function H(i,e,t,n){let r=ce(e,n);return r.size===0?new Map:le(i,t,r)}function ce(i,e){let t=new Map;for(let n of k(i,e)){let r=N(n.symbol)??n.leaf;if(!r)continue;let o=t.get(r);o||(o=[],t.set(r,o)),o.push(n)}return t}function le(i,e,t){let n=new Map,r=new Map;return e.forEachDescendant(o=>{for(let s of de(i,o)){let a=t.get(s);if(!a)continue;let l=g(e,o);for(let c of a){if(l<c.startLine-1||l>c.endLine+1)continue;let f=Math.abs(l-c.startLine),u=r.get(c.symbolId);u!==void 0&&u<=f||(r.set(c.symbolId,f),n.set(c.symbolId,o))}}}),n}function de(i,e){let t=[],n=r=>{r&&!t.includes(r)&&t.push(r)};if("getNameNode"in e&&typeof e.getNameNode=="function"){let r=e.getNameNode();n(r?.getText())}if("getName"in e&&typeof e.getName=="function"){let r=e.getName();n(r)}return i.Node.isIdentifier(e)&&n(e.getText()),t}function J(i,e,t,n){return i.all(`SELECT
|
|
3
|
+
gs.id AS symbolId,
|
|
4
|
+
gs.symbol,
|
|
5
|
+
d.relative_path AS relativePath,
|
|
6
|
+
COALESCE(der.start_line, c.start_line) AS startLine,
|
|
7
|
+
COALESCE(der.end_line, c.end_line) AS endLine,
|
|
8
|
+
COALESCE(gs.display_name, '') AS leaf,
|
|
9
|
+
NULL AS parentTypeName,
|
|
10
|
+
CASE WHEN gs.kind IN (6, 12, 13) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
|
|
11
|
+
CASE WHEN gs.kind IN (5, 8, 11) THEN 1 ELSE 0 END AS isTypeLike,
|
|
12
|
+
gs.kind AS kind,
|
|
13
|
+
gs.documentation AS documentation,
|
|
14
|
+
gs.enclosing_symbol AS enclosingSymbol
|
|
15
|
+
FROM global_symbols gs
|
|
16
|
+
LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
17
|
+
LEFT JOIN chunks c ON c.document_id = der.document_id
|
|
18
|
+
JOIN documents d ON d.id = der.document_id
|
|
19
|
+
WHERE d.relative_path = ?
|
|
20
|
+
AND COALESCE(gs.display_name, gs.symbol) LIKE ?
|
|
21
|
+
ORDER BY ABS(COALESCE(der.start_line, c.start_line) - ?)
|
|
22
|
+
LIMIT 5`,e,`%${n}%`,t)[0]??null}function V(i,e){let t=i.all(`SELECT
|
|
23
|
+
d.id AS documentId,
|
|
24
|
+
gs.id AS symbolId,
|
|
25
|
+
gs.symbol,
|
|
26
|
+
d.relative_path AS relativePath,
|
|
27
|
+
der.start_line AS startLine,
|
|
28
|
+
der.end_line AS endLine,
|
|
29
|
+
COALESCE(gs.display_name, '') AS leaf,
|
|
30
|
+
NULL AS parentTypeName,
|
|
31
|
+
CASE WHEN gs.kind IN (6, 12, 13) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
|
|
32
|
+
CASE WHEN gs.kind IN (5, 8, 11) THEN 1 ELSE 0 END AS isTypeLike,
|
|
33
|
+
gs.kind AS kind,
|
|
34
|
+
gs.documentation AS documentation,
|
|
35
|
+
gs.enclosing_symbol AS enclosingSymbol
|
|
36
|
+
FROM global_symbols gs
|
|
37
|
+
JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
38
|
+
JOIN documents d ON d.id = der.document_id
|
|
39
|
+
WHERE d.relative_path = ?
|
|
40
|
+
UNION ALL
|
|
41
|
+
SELECT
|
|
42
|
+
d.id AS documentId,
|
|
43
|
+
gs.id AS symbolId,
|
|
44
|
+
gs.symbol,
|
|
45
|
+
d.relative_path AS relativePath,
|
|
46
|
+
MIN(c.start_line) AS startLine,
|
|
47
|
+
MAX(c.end_line) AS endLine,
|
|
48
|
+
COALESCE(gs.display_name, '') AS leaf,
|
|
49
|
+
NULL AS parentTypeName,
|
|
50
|
+
CASE WHEN gs.kind IN (6, 12, 13) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
|
|
51
|
+
CASE WHEN gs.kind IN (5, 8, 11) THEN 1 ELSE 0 END AS isTypeLike,
|
|
52
|
+
gs.kind AS kind,
|
|
53
|
+
gs.documentation AS documentation,
|
|
54
|
+
gs.enclosing_symbol AS enclosingSymbol
|
|
55
|
+
FROM global_symbols gs
|
|
56
|
+
JOIN mentions m ON m.symbol_id = gs.id
|
|
57
|
+
JOIN chunks c ON c.id = m.chunk_id
|
|
58
|
+
JOIN documents d ON d.id = c.document_id
|
|
59
|
+
WHERE d.relative_path = ?
|
|
60
|
+
AND m.role = 1
|
|
61
|
+
GROUP BY gs.id, gs.symbol, d.id, d.relative_path, gs.display_name, gs.kind, gs.documentation, gs.enclosing_symbol
|
|
62
|
+
ORDER BY startLine, endLine`,e,e),n=new Set,r=new Map;for(let o of t){if(n.has(o.symbolId))continue;n.add(o.symbolId);let s=o.leaf||N(o.symbol);!s||r.has(s)||r.set(s,{...o,leaf:s})}return r}import pe from"path";var S=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"];function D(i){let e=i.toLowerCase();return S.some(t=>e.endsWith(t))}function K(i,e){let t=new Map,n=r=>D(r)?p(t,r,()=>{let o=pe.join(i.config.projectRoot,r);for(let{project:s}of e){let a=s.getSourceFile(o)??s.addSourceFileAtPathIfExists(o)??null;if(a)return{project:s,sourceFile:a}}return null}):null;return{sourceFile:r=>n(r)?.sourceFile??null,sourceFileMatch:n,indexedTypeScriptLikeDocuments:()=>x(i,{extensions:S})}}import m from"path";import{existsSync as M,readdirSync as fe,readFileSync as z}from"fs";function Y(i){let e=m.join(i,"package.json");if(!M(e))return[];let t;try{t=JSON.parse(z(e,"utf8"))}catch{return[]}return(Array.isArray(t.workspaces)?t.workspaces:t.workspaces?.packages??[]).flatMap(r=>ue(i,r)).flatMap(r=>me(i,r))}function ue(i,e){if(!e||e.startsWith("!")||e.includes("node_modules"))return[];if(!e.includes("*")){let s=m.join(i,e);return M(m.join(s,"package.json"))?[s]:[]}let t=e.indexOf("*"),n=e.slice(0,t).replace(/\/$/,""),r=e.slice(t+1).replace(/^\//,""),o=m.join(i,n||".");if(!M(o))return[];try{return fe(o).map(s=>m.join(o,s,r)).filter(s=>M(m.join(s,"package.json")))}catch{return[]}}function me(i,e){try{let t=JSON.parse(z(m.join(e,"package.json"),"utf8"));if(!t.name)return[];let n=m.relative(i,e).replace(/\\/g,"/");return[{name:t.name,rootRelative:n,sourceRootRelative:`${n}/src`}]}catch{return[]}}function X(i,e){for(let t of i)if(e===t.name||e.startsWith(`${t.name}/`))return t.name;return null}function q(i){return[`${i.sourceRootRelative}/index.ts`,`${i.sourceRootRelative}/index.tsx`,`${i.sourceRootRelative}/index.mts`,`${i.sourceRootRelative}/index.cts`]}import{existsSync as h,readFileSync as ge,readdirSync as ye,statSync as Se}from"fs";import d from"path";var R=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"];function C(i,e){let n=e?d.dirname(d.join(i,e)):i,r=d.resolve(i);for(;n.startsWith(r);){for(let s of R){let a=d.join(n,s);if(h(a))return a}let o=d.dirname(n);if(o===n)break;n=o}for(let o of R){let s=d.join(i,o);if(h(s))return s}return null}function G(i){let e=i.config.projectRoot,t=new Set(he(e,i.config.semantic?.typescript?.tsconfigs)),n=x(i,{includeIgnored:!1,extensions:S});for(let r of n){let o=C(e,r);o&&t.add(d.resolve(o))}if(t.size===0){let r=C(e);r&&t.add(d.resolve(r))}return[...t].filter(r=>!Q(e,r)).sort((r,o)=>r.localeCompare(o))}function he(i,e=[]){let t=new Set;for(let n of e){let r=d.isAbsolute(n)?n:d.join(i,n);h(r)&&t.add(d.resolve(r))}for(let n of be(i))for(let r of R){let o=d.join(n,r);h(o)&&t.add(d.resolve(o))}if(t.size===0){let n=C(i);n&&t.add(d.resolve(n))}return[...t].filter(n=>!Q(i,n)).sort((n,r)=>n.localeCompare(r))}function be(i){let e=d.join(i,"package.json");if(!h(e))return[];let t;try{t=JSON.parse(ge(e,"utf8"))}catch{return[]}return(Array.isArray(t.workspaces)?t.workspaces:t.workspaces?.packages??[]).flatMap(r=>Ie(i,r))}function Ie(i,e){if(!e||e.startsWith("!")||e.includes("node_modules"))return[];if(!e.includes("*")){let s=d.join(i,e);return L(s)?[s]:[]}let t=e.indexOf("*"),n=e.slice(0,t).replace(/\/$/,""),r=e.slice(t+1).replace(/^\//,""),o=d.join(i,n||".");return L(o)?ye(o).map(s=>d.join(o,s,r)).filter(L):[]}function L(i){try{return Se(i).isDirectory()}catch{return!1}}function Q(i,e){let t=d.relative(i,e).replace(/\\/g,"/");return t.startsWith("..")||t.includes("/node_modules/")||t.startsWith("node_modules/")||t.includes("/dist/")||t.startsWith("dist/")}import{createRequire as xe}from"module";var Ne=xe(import.meta.url),b;function Z(){if(b!==void 0)return b;try{b=Ne("ts-morph")}catch{b=null}return b}function ee(i,e){return e.map(t=>({tsconfigPath:t,project:new i.Project({tsConfigFilePath:t,skipFileDependencyResolution:!1})}))}function F(i,e,t){return{language:"typescript",availability:()=>({available:!1,reason:i,tsconfigPath:e,tsconfigPaths:t}),importUsage:()=>[],referencesFor:()=>[],calleesFor:()=>[],signatureFor:()=>null}}function ie(i,e){let t=Z();if(!t)return F("ts-morph is not installed");let n=G(i);if(n.length===0)return F("no tsconfig found");try{let r=ee(t,n);return new A(i,t,r)}catch(r){return F(r instanceof Error?r.message:String(r),n[0],n)}}var A=class{constructor(e,t,n){this.db=e;this.tsMorph=t;this.projects=n;this.workspacePackages=Y(e.config.projectRoot),this.sourceFiles=K(e,n)}db;tsMorph;projects;language="typescript";importUsageCache=new Map;referencesCache=new Map;calleesCache=new Map;fileCalleesCache=new Map;signatureCache=new Map;definitionNodeCache=new Map;fileDefinitionNodeCache=new Map;indexedDefinitionLeafCache=new Map;packageImportReferenceIndex=null;packageExportIndex=null;workspacePackages;sourceFiles;availability(){return{available:!0,tsconfigPath:this.projects[0]?.tsconfigPath,tsconfigPaths:this.projects.map(e=>e.tsconfigPath)}}importUsage(e){return p(this.importUsageCache,e,()=>{let t=this.sourceFiles.sourceFile(e);if(!t)return[];let n=[];for(let r of t.getImportDeclarations())for(let o of this.importUsageForDeclaration(e,r))n.push(o);return n})}referencesFor(e){return p(this.referencesCache,e.symbolId,()=>{let t=this.nodeForDefinition(e),n=this.packageImportReferencesForDefinition(e);return t?U(t,e,n,this.db.config.projectRoot):n})}calleesFor(e){return p(this.calleesCache,e.symbolId,()=>p(this.fileCalleesCache,e.relativePath,()=>this.calleeMapForFile(e.relativePath)).get(e.symbolId)??[])}signatureFor(e){return p(this.signatureCache,e.symbolId,()=>{let t=this.nodeForDefinition(e);if(!t||!this.tsMorph.Node.isFunctionDeclaration(t)&&!this.tsMorph.Node.isMethodDeclaration(t)&&!this.tsMorph.Node.isArrowFunction(t)&&!this.tsMorph.Node.isFunctionExpression(t)&&!this.tsMorph.Node.isConstructorDeclaration(t))return null;let n=t.getType().getCallSignatures()[0];if(!n)return null;let r=n.getParameters().map(s=>{let a=s.getDeclarations()[0],l=a?s.getTypeAtLocation(a).getText(a):s.getValueDeclaration()?.getType().getText()??"unknown";return ne(l)}),o=n.getReturnType().getText(t);return`(${r.join(",")})=>${ne(o)}`})}importUsageForDeclaration(e,t){let n=T(this.db,e,t.getModuleSpecifierValue()),r=te(t);return t.getImportClause()?.isTypeOnly()?r.map(o=>ke(e,n,o)):r.map(o=>this.valueImportUsageForEntry(e,n,o))}valueImportUsageForEntry(e,t,n){let r=n.identifier?n.identifier.findReferences():[],o=[];for(let c of r)for(let f of W(c,e,n.identifier,this.db.config.projectRoot))o.push(f);let s=o.some(c=>!P(c.node)),a=o.some(c=>P(c.node)),l=n.isTypeOnly;return{importer:e,sourcePath:t,importedName:n.importedName,localName:n.localName,kind:n.kind,isTypeOnly:l,isUsed:l||o.length>0,isTypeUsed:l||a,isValueUsed:s,references:o.map(c=>c.location)}}packageImportReferencesForDefinition(e){return this.packageImportReferences().get(e.symbolId)??[]}packageImportReferences(){if(this.packageImportReferenceIndex)return this.packageImportReferenceIndex;let e=new Map,t=this.packageExports();for(let n of this.sourceFiles.indexedTypeScriptLikeDocuments())this.addPackageImportReferencesForDocument(e,t,n);for(let[n,r]of e)e.set(n,E(r));return this.packageImportReferenceIndex=e,e}addPackageImportReferencesForDocument(e,t,n){if(this.db.isIgnored(n))return;let r=this.sourceFiles.sourceFileMatch(n);if(r)for(let o of r.sourceFile.getImportDeclarations())this.addPackageImportReferencesForDeclaration(e,t,n,o)}addPackageImportReferencesForDeclaration(e,t,n,r){let o=X(this.workspacePackages,r.getModuleSpecifierValue());if(!o)return;let s=t.get(o);if(s)for(let a of te(r)){if(a.kind!=="named"||!a.identifier)continue;let l=s.get(a.importedName);if(!l||l.size===0)continue;let c=B(a.identifier,n,this.db.config.projectRoot);c.length>0&&Me(e,l,c)}}packageExports(){if(this.packageExportIndex)return this.packageExportIndex;let e=new Map;for(let t of this.workspacePackages){let n=new Map;for(let r of q(t))this.collectPackageExports(t,r,n,new Set);n.size>0&&e.set(t.name,n)}return this.packageExportIndex=e,e}collectPackageExports(e,t,n,r){if(r.has(t))return;r.add(t);let o=this.sourceFiles.sourceFile(t);if(o)for(let s of o.getExportDeclarations()){let a=s.getModuleSpecifierValue(),l=a?T(this.db,t,a):t;if(!l||!l.startsWith(`${e.sourceRootRelative}/`))continue;let c=s.getNamedExports();if(c.length===0){if(s.isNamespaceExport())continue;this.collectPackageExports(e,l,n,r);continue}for(let f of c){let u=f.getNameNode().getText(),w=f.getAliasNode()?.getText()??u,O=this.indexedDefinitionByLeaf(l,u);if(!O)continue;let I=n.get(w);I||(I=new Set,n.set(w,I)),I.add(O.symbolId)}}}indexedDefinitionByLeaf(e,t){return p(this.indexedDefinitionLeafCache,e,()=>V(this.db,e)).get(t)??null}nodeForDefinition(e){return p(this.definitionNodeCache,e.symbolId,()=>this.definitionNodesForFile(e.relativePath).get(e.symbolId)??null)}definitionNodesForFile(e){return p(this.fileDefinitionNodeCache,e,()=>{let t=this.sourceFiles.sourceFile(e);return t?H(this.tsMorph,this.db,t,e):new Map})}definitionFromSymbol(e){let t=e.getDeclarations();for(let n of t){let r=n.getSourceFile(),o=y(this.db.config.projectRoot,r.getFilePath());if(!o||this.db.isIgnored(o))continue;let s=g(r,n),a=J(this.db,o,s,e.getName());if(a)return{symbol:a.symbol,file:a.relativePath,line:a.startLine}}return null}calleeMapForFile(e){let t=this.sourceFiles.sourceFile(e);if(!t)return new Map;let n=k(this.db,e).sort((o,s)=>o.startLine-s.startLine||s.endLine-o.endLine);if(n.length===0)return new Map;let r=new Map;t.forEachDescendant(o=>{if(!this.tsMorph.Node.isCallExpression(o)&&!this.tsMorph.Node.isNewExpression(o))return;let s=this.semanticCalleeForCallNode(t,n,o);s&&Ee(r,s.callerId,s.target)});for(let[o,s]of r)r.set(o,Fe(s));return r}semanticCalleeForCallNode(e,t,n){let r=De(t,g(e,n));if(!r)return null;let o=n.getExpression(),s=o.getSymbol()??o.getType().getSymbol(),a=s?this.definitionFromSymbol(s):null;return a?{callerId:r.symbolId,target:{symbol:a.symbol,file:a.file,line:a.line}}:null}};function te(i){let e=[],t=i.getDefaultImport();t&&e.push({identifier:t,importedName:"default",localName:t.getText(),kind:"default",isTypeOnly:i.getImportClause()?.isTypeOnly()??!1});let n=i.getNamespaceImport();n&&e.push({identifier:n,importedName:"*",localName:n.getText(),kind:"namespace",isTypeOnly:i.getImportClause()?.isTypeOnly()??!1});for(let r of i.getNamedImports()){let o=r.getNameNode(),a=r.getAliasNode()??(o.getKindName()==="Identifier"?o:null);e.push({identifier:a,importedName:o.getText(),localName:a?.getText()??o.getText(),kind:"named",isTypeOnly:r.isTypeOnly()||(i.getImportClause()?.isTypeOnly()??!1)})}return e.length===0&&e.push({identifier:null,importedName:"*",localName:null,kind:"side-effect",isTypeOnly:!1}),e}function ke(i,e,t){return{importer:i,sourcePath:e,importedName:t.importedName,localName:t.localName,kind:t.kind,isTypeOnly:!0,isUsed:!0,isTypeUsed:!0,isValueUsed:!1,references:[]}}function Ee(i,e,t){let n=i.get(e);n||(n=[],i.set(e,n)),n.push(t)}function De(i,e){let t=null;for(let n of i)e<n.startLine||e>n.endLine||(!t||n.startLine>=t.startLine)&&(t=n);return t}function Me(i,e,t){for(let n of e){let r=i.get(n)??[];r.push(...t),i.set(n,r)}}function Fe(i){let e=new Set,t=[];for(let n of i){let r=`${n.symbol}|${n.file}|${n.line}`;e.has(r)||(e.add(r),t.push(n))}return t}function ne(i){return i.replace(/\s+/g," ").replace(/\bimport\("[^"]+"\)\./g,"").trim()}var j=new WeakMap;function re(i,e){let t=`${i.config.projectRoot}:typescript-workspace`,n=j.get(i);n||(n=new Map,j.set(i,n));let r=n.get(t);if(r)return r;let o=ie(i,e);return n.set(t,o),o}function ft(i){j.delete(i)}function yt(i,e){let t=v(i,e);return t?t.importUsage(e):[]}function ve(i,e){let t=v(i,e.relativePath);return t?t.referencesFor(e):[]}function St(i,e){let t=new Map;for(let n of e)for(let r of ve(i,n)){if(r.file===n.relativePath||i.isIgnored(r.file))continue;let o=t.get(n.symbolId);o||(o=new Set,t.set(n.symbolId,o)),o.add(r.file)}return t}function ht(i,e){let t=new Map;for(let n of e){let r=v(i,n.relativePath);if(!r)continue;let o=r.calleesFor(n);o.length>0&&t.set(n.symbolId,o)}return t}function bt(i,e){let t=v(i,e.relativePath);return t?t.signatureFor(e):null}function v(i,e){if(!D(e))return null;let t=re(i,e);return t.availability().available?t:null}export{ft as a,yt as b,ve as c,St as d,ht as e,bt as f};
|
|
63
|
+
//# sourceMappingURL=chunk-7O4MJYIW.js.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import{a as h,k as S}from"./chunk-5TT47UMX.js";import{a as y}from"./chunk-NHDPYW7O.js";import{a as x}from"./chunk-NN3O7TPH.js";var F={"/":"namespace","#":"type",".":"term","[":"type-param",":":"meta","!":"macro"};function u(e){if(e.startsWith("local "))return{kind:"local",id:e.slice(6),raw:e};let t=e.split(" ");if(t.length<4)return{scheme:t[0]??"",manager:t[1]??"",packageName:t[2]??"",version:"",descriptors:[],raw:e};let n=t[0],r=t[1],i=e.slice(n.length+1+r.length+1),s;if(i.startsWith("`")){let l=i.indexOf("`",1);l===-1?(s=i.slice(1),i=""):(s=i.slice(1,l),i=i.slice(l+2))}else{let l=i.indexOf(" ");l===-1?(s=i,i=""):(s=i.slice(0,l),i=i.slice(l+1))}let o,a=i.indexOf(" ");a===-1?(o=i,i=""):(o=i.slice(0,a),i=i.slice(a+1));let c=C(i);return{scheme:n,manager:r,packageName:s,version:o,descriptors:c,raw:e}}function m(e){let t=u(e);if("kind"in t)return null;for(let n=t.descriptors.length-2;n>=0;n--){let r=t.descriptors[n];if(r?.suffix==="type")return r.name}return null}function C(e){let t=[],n=0;for(;n<e.length;){if(e[n]==="["){let s=e.indexOf("]",n+1);if(s===-1){t.push({name:e.slice(n+1),suffix:"type-param"});break}t.push({name:e.slice(n+1,s),suffix:"type-param"}),n=s+1;continue}if(e[n]==="("&&(t.length===0||n===0||D(e[n-1]))){let s=e.indexOf(")",n+1);if(s!==-1&&e[s+1]!=="."){t.push({name:e.slice(n+1,s),suffix:"parameter"}),n=s+1;continue}}let r;if(e[n]==="`"){let s=e.indexOf("`",n+1);if(s===-1){r=e.slice(n+1),t.push({name:r,suffix:"term"});break}r=e.slice(n+1,s),n=s+1}else{let s=n;for(;n<e.length&&!D(e[n]);)n++;r=e.slice(s,n)}if(n>=e.length){r&&t.push({name:r,suffix:"term"});break}let i=e[n];if(i==="("){let s=e.indexOf(")",n+1);s!==-1&&e[s+1]==="."?(t.push({name:r,suffix:"method"}),n=s+2):s!==-1?(t.push({name:r,suffix:"method"}),n=s+1):(t.push({name:r,suffix:"term"}),n++)}else{let s=F[i];s&&t.push({name:r,suffix:s}),n+=1}}return t}function D(e){return e==="/"||e==="#"||e==="."||e==="("||e==="["||e===":"||e==="!"}function _(e){let t=u(e);if("kind"in t&&t.kind==="local")return`local:${t.id}`;let n=t;if(n.descriptors.length===0)return n.raw;let r=[];for(let i of n.descriptors){let s=w(i);s&&r.push(s)}return r.join(":")}function w(e){let t=e.suffix==="namespace"?A(e.name):e.name;return t?e.suffix==="method"?`${t}()`:t:""}function A(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 L(e){let t=u(e);if("kind"in t&&t.kind==="local")return t.id;let n=t;return n.descriptors.length===0?"":n.descriptors[n.descriptors.length-1].name}function f(e){let t=u(e);if("kind"in t&&t.kind==="local")return null;let n=t;return n.descriptors[n.descriptors.length-1]?.suffix??null}function ne(e){return e.endsWith("().")||f(e)==="method"}function I(e){let t=f(e);return t==="method"||t==="term"}function te(e){return f(e)==="namespace"}var T=/^rust-analyzer\b.*[\s/]impl#\[[^\]]+\]\[[^\]]+\]/;function ie(e){return T.test(e)}var Q=new Set(["test","tests","_tests"]);function re(e){let t=u(e);if("kind"in t)return!1;for(let n=0;n<t.descriptors.length-1;n+=1){let r=t.descriptors[n];if(r?.suffix==="namespace"&&r.name&&Q.has(r.name))return!0}return!1}function se(e,t){let n=u(e),r=u(t);if("kind"in n||"kind"in r)return!1;let i=n.descriptors,s=r.descriptors;if(s.length!==i.length+1)return!1;for(let o=0;o<i.length;o++){let a=i[o],c=s[o];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function oe(e,t){let n=u(e),r=u(t);if("kind"in n||"kind"in r)return!1;let i=n.descriptors,s=r.descriptors;if(s.length<=i.length)return!1;for(let o=0;o<i.length;o++){let a=i[o],c=s[o];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function le(e,t){return e.all(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.end_line, d.relative_path, gs.display_name, gs.documentation
|
|
2
|
+
FROM global_symbols gs
|
|
3
|
+
JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
|
|
4
|
+
JOIN documents d ON der.document_id = d.id
|
|
5
|
+
WHERE ${t.where}
|
|
6
|
+
${e.pathExclusionsFor("d")}
|
|
7
|
+
${M(t.orderBy)}
|
|
8
|
+
${k(t.limit)}`,...t.params??[])}function ce(e,t){return e.all(`SELECT
|
|
9
|
+
gs.id,
|
|
10
|
+
gs.symbol,
|
|
11
|
+
c.document_id,
|
|
12
|
+
MIN(c.start_line) AS start_line,
|
|
13
|
+
MAX(c.end_line) AS end_line,
|
|
14
|
+
d.relative_path,
|
|
15
|
+
gs.display_name,
|
|
16
|
+
gs.documentation
|
|
17
|
+
FROM global_symbols gs
|
|
18
|
+
JOIN mentions m ON m.symbol_id = gs.id
|
|
19
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
20
|
+
JOIN documents d ON c.document_id = d.id
|
|
21
|
+
WHERE m.role = 1
|
|
22
|
+
AND ${t.where}
|
|
23
|
+
${e.pathExclusionsFor("d")}
|
|
24
|
+
GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path, gs.display_name, gs.documentation
|
|
25
|
+
${M(t.orderBy)}
|
|
26
|
+
${k(t.limit)}`,...t.params??[])}function M(e){return e?`ORDER BY ${e}`:""}function k(e){return typeof e=="number"?`LIMIT ${e}`:""}function N(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 O(e){if(!e)return null;let t=R(e);if(t)return t.replace(/\n/g," ");let n=e.indexOf("|");if(n===-1)return e.replace(/\n/g," ");let r=e.slice(n+1);return(R(r)??r).replace(/\n/g," ")}function R(e){return/^```(?:\w+)?\s*\n?([\s\S]*?)\n?```/.exec(e.trimStart())?.[1]?.trim()||null}function P(e){if(m(e.symbol)!==null)return!1;let n=(e.documentation??"").replace(/^```\w*\s*/,"").replace(/\s*```$/,"").trim();return/^(?:var|let|const|function|class|interface|type|enum)\b/.test(n)}function $(e,t,n={}){let r=new Map;for(let s of t)e.length>0&&!P(s)||r.set(s.id,s);for(let s of e)r.set(s.id,s);let i=[...r.values()];return n.sort?i.sort((s,o)=>s.start_line-o.start_line||s.end_line-o.end_line||s.symbol.localeCompare(o.symbol)):i}var E=y("file-definitions");function Se(e,t){E.invalidate(e,t)}function b(e,t){return E.get(e,t,()=>{let n=$(B(e,t),j(e,t),{sort:!0});return H(e,t,n.map(J))})}function B(e,t){return e.all(`SELECT
|
|
27
|
+
gs.id,
|
|
28
|
+
gs.symbol,
|
|
29
|
+
der.document_id,
|
|
30
|
+
der.start_line,
|
|
31
|
+
der.end_line,
|
|
32
|
+
d.relative_path,
|
|
33
|
+
gs.display_name,
|
|
34
|
+
gs.kind,
|
|
35
|
+
gs.documentation,
|
|
36
|
+
gs.enclosing_symbol
|
|
37
|
+
FROM global_symbols gs
|
|
38
|
+
JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
|
|
39
|
+
JOIN documents d ON der.document_id = d.id
|
|
40
|
+
WHERE d.relative_path = ?
|
|
41
|
+
${e.symbolNoiseFor("gs")}
|
|
42
|
+
ORDER BY der.start_line, der.end_line`,t)}function j(e,t){return e.all(`SELECT
|
|
43
|
+
gs.id,
|
|
44
|
+
gs.symbol,
|
|
45
|
+
c.document_id,
|
|
46
|
+
MIN(c.start_line) AS start_line,
|
|
47
|
+
MAX(c.end_line) AS end_line,
|
|
48
|
+
d.relative_path,
|
|
49
|
+
gs.display_name,
|
|
50
|
+
gs.kind,
|
|
51
|
+
gs.documentation,
|
|
52
|
+
gs.enclosing_symbol
|
|
53
|
+
FROM global_symbols gs
|
|
54
|
+
JOIN mentions m ON m.symbol_id = gs.id
|
|
55
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
56
|
+
JOIN documents d ON c.document_id = d.id
|
|
57
|
+
WHERE d.relative_path = ?
|
|
58
|
+
AND m.role = 1
|
|
59
|
+
${e.symbolNoiseFor("gs")}
|
|
60
|
+
GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
|
|
61
|
+
ORDER BY start_line, end_line`,t)}function J(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:L(e.symbol),parentTypeName:m(e.symbol),isFunctionLike:I(e.symbol),isTypeLike:f(e.symbol)==="type",kind:e.kind??null,documentation:e.documentation??null,enclosingSymbol:e.enclosing_symbol??null}}function De(e,t={}){return W(e,t.scope)}function W(e,t){return x(e,{scope:t,includeIgnored:!1}).flatMap(n=>b(e,n)).filter(n=>!e.isIgnored(n.relativePath))}function _e(e,t,n={}){if(t.length===0)return[];let r=t.flatMap(i=>b(e,i)).filter(i=>!e.isIgnored(i.relativePath));return n.onlyDocumented&&(r=r.filter(i=>i.documentation!==null&&i.documentation!=="")),n.sort&&(r=r.sort((i,s)=>i.relativePath.localeCompare(s.relativePath)||i.startLine-s.startLine||i.endLine-s.endLine)),r.map(i=>({startLine:i.startLine,endLine:i.endLine,symbol:i.symbol,shortName:_(i.symbol),signature:N(O(i.documentation)),relativePath:i.relativePath,enclosingSymbol:i.enclosingSymbol}))}function Le(e,t){let n=null;for(let r of e)r.startLine>t||r.endLine<t||(!n||r.endLine-r.startLine<n.endLine-n.startLine)&&(n=r);return n}function Ie(e,t){let n=b(e,t.relative_path).find(r=>r.symbolId===t.id);return n?{symbolId:n.symbolId,symbol:n.symbol,documentId:n.documentId,startLine:n.startLine,endLine:n.endLine,relativePath:n.relativePath}:{symbolId:t.id,symbol:t.symbol,documentId:t.document_id,startLine:t.start_line,endLine:t.end_line,relativePath:t.relative_path}}function H(e,t,n){let r=h(e,t),i=S(e,t);return i?G(n,i,r):r?z(n,r):n}function z(e,t){let n=t.split(/\r?\n/),r=Y(e,n),i=U(e,r),s=Z(i,n);return X(e,s)}function Y(e,t){let n=e.some(i=>g(i.symbol))?V(t):null,r=new Map;for(let i of e)r.set(i.symbolId,K(t,n,i));return r}function U(e,t){return e.filter(n=>g(n.symbol)).map(n=>({definition:n,startLine:t.get(n.symbolId)??n.startLine})).sort((n,r)=>n.startLine-r.startLine||n.definition.startLine-r.definition.startLine||n.definition.symbol.localeCompare(r.definition.symbol))}function Z(e,t){let n=new Map;for(let r=0;r<e.length;r+=1){let i=e[r],s=e[r+1],o=s?Math.max(i.startLine,s.startLine-1):t.length-1;n.set(i.definition.symbolId,{startLine:i.startLine,endLine:q(t,i.definition,i.startLine,o)})}return n}function X(e,t){return e.map(n=>{let r=t.get(n.symbolId);return r?{...n,startLine:r.startLine,endLine:r.endLine}:n})}function G(e,t,n=null){let r=new Map;for(let i of t){let s=r.get(i.name);s?s.push(i):r.set(i.name,[i])}return e.map(i=>{if(!g(i.symbol)||!i.leaf)return v(i,n);let s=r.get(i.leaf);if(!s||s.length===0)return v(i,n);let o=s[0],a=Math.abs(o.startLine-i.startLine);for(let c=1;c<s.length;c+=1){let l=s[c],d=Math.abs(l.startLine-i.startLine);d<a&&(o=l,a=d)}return{...i,startLine:o.startLine,endLine:o.endLine}})}function v(e,t){if(!t||!e.leaf||f(e.symbol)!=="term"||m(e.symbol)!==null)return e;let n=e.leaf.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\b(?:export\\s+)?(?:const|let|var)\\s+${n}\\b`),s=t.split(/\r?\n/).findIndex(o=>r.test(o));return s>=0?{...e,startLine:s,endLine:s}:e}function K(e,t,n){if(!g(n.symbol))return n.startLine;let r=Math.max(0,Math.min(n.startLine,e.length-1));if(!t)return r;let i=t.get(n.leaf);if(!i||i.length===0)return r;let s=null;for(let o of i){let a=Math.abs(o-n.startLine);(!s||a<s.distance)&&(s={line:o,distance:a})}return s?.line??r}function V(e){let t=/\b(?:function|def|fn)\s+([A-Za-z_$][\w$]*)/g,n=/\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,s=new Map,o=(a,c)=>{let l=s.get(a);if(!l){s.set(a,[c]);return}l[l.length-1]!==c&&l.push(c)};for(let a=0;a<e.length;a+=1){let c=e[a]??"";for(let d of c.matchAll(t))d[1]&&o(d[1],a);for(let d of c.matchAll(n))d[1]&&o(d[1],a);let l=c.match(r);l?.[1]&&o(l[1],a);for(let d of c.matchAll(i))d[1]&&o(d[1],a)}return s}function q(e,t,n,r){let i=Math.max(n,Math.min(e.length-1,r)),s=Math.max(n,Math.min(i,t.endLine)),o=0,a=0,c=!1;for(let l=n;l<=i;l+=1){let d=ee(e[l]??"");for(let p of d)p==="{"?(o+=1,c=!0):p==="}"?o=Math.max(0,o-1):p==="("?a+=1:p===")"&&(a=Math.max(0,a-1));if(c&&o===0||!c&&a===0&&l>=s)return l}return s}function ee(e){let t="",n=null,r=!1;for(let i=0;i<e.length;i+=1){let s=e[i],o=e[i+1];if(!n&&s==="/"&&o==="/"){t+=" ".repeat(e.length-i);break}if(n){if(r){r=!1,t+=" ";continue}if(s==="\\"){r=!0,t+=" ";continue}s===n&&(n=null),t+=" ";continue}if(s==='"'||s==="'"||s==="`"){n=s,t+=" ";continue}t+=s}return t}function g(e){return e.includes("().")}function Re(e){let t=u(e);if("kind"in t)return[];let n=[];for(let r=t.descriptors.length-2;r>=0;r-=1){let i=t.descriptors[r];i?.suffix==="type"&&i.name&&n.push(i.name)}return n}export{u as a,m as b,_ as c,L as d,f as e,ne as f,I as g,te as h,ie as i,re as j,se as k,oe as l,le as m,ce as n,N as o,O as p,$ as q,Se as r,b as s,De as t,W as u,_e as v,Le as w,Ie as x,Re as y};
|
|
62
|
+
//# sourceMappingURL=chunk-7OX2O53H.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as o,c as p}from"./chunk-MX6F756F.js";import{b as y}from"./chunk-QAEDNTY7.js";import{c as b}from"./chunk-7OX2O53H.js";function P(u,c={}){let{scope:f,minLoc:L=3,scanLimit:l}=c,s=new y(u),r=c.semantic!==!1,t=p(s.productionCallableDefinitions({scope:f,minLoc:L,excludeEntrySurfaces:!0,excludeRustTraitImplMembers:!0,includeSuppressed:!0,sortByLocDesc:typeof l=="number"&&l>0}),l),h=s.crossFileCallerMap(t,{semantic:r}),a=new Set(h.keys());for(let e of s.frameworkReferencedSymbolIds(t))a.add(e);let n=s.symbolsWithNonSelfCallees(t,{additive:!1,semantic:r}),m=t.filter(e=>!a.has(e.symbolId)).filter(e=>!n.has(e.symbolId)),I=s.sourceFallbackCallerFiles(m);for(let e of I.keys())a.add(e);let d=m.filter(e=>!a.has(e.symbolId)),C=s.symbolsWithNonSelfCallees(d,{additive:!0,semantic:r});for(let e of C)n.add(e);return d.filter(e=>!n.has(e.symbolId)).sort((e,i)=>o(i)-o(e)||e.relativePath.localeCompare(i.relativePath)||e.startLine-i.startLine).map(e=>({symbol:e.symbol,shortName:b(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:o(e)}))}export{P as a};
|
|
2
|
+
//# sourceMappingURL=chunk-A2AVLALL.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{statSync as c}from"fs";function o(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,i=t.get("SELECT COUNT(*) as c FROM mentions WHERE role != 1").c;return{documents:e,symbols:s,definitions:n,references:i,...r(t.config.dbPath)}}function r(t){try{let e=c(t);return{indexSizeBytes:e.size,lastBuilt:e.mtime}}catch{return{indexSizeBytes:0,lastBuilt:null}}}export{o as a};
|
|
2
|
+
//# sourceMappingURL=chunk-AQYBOORI.js.map
|