scip-query 0.6.5 → 0.6.7
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 +63 -7
- package/dist/augment-vue-worker.js +1 -1
- package/dist/chunk-2AUZ3PLO.js +2 -0
- package/dist/{chunk-EB5IVUNU.js → chunk-2CC7RA6B.js} +2 -2
- package/dist/{chunk-OQZF2DQJ.js → chunk-2R7OKZE5.js} +2 -2
- package/dist/{chunk-YDKWDTAW.js → chunk-2YA36CXK.js} +2 -2
- package/dist/chunk-3A2M7AF3.js +4 -0
- package/dist/chunk-3EJRPTTB.js +2 -0
- package/dist/chunk-3SWWYJPB.js +6 -0
- package/dist/chunk-4M4FEWBL.js +7 -0
- package/dist/{chunk-QFCK6WV2.js → chunk-4Y6KUJDO.js} +2 -2
- package/dist/{chunk-MO65UK5V.js → chunk-55ZJ2FCW.js} +2 -2
- package/dist/chunk-6FLGPRBR.js +5 -0
- package/dist/chunk-6XRB6ATD.js +16 -0
- package/dist/{chunk-WIIZF5FP.js → chunk-7EQ4J66C.js} +2 -2
- package/dist/{chunk-Z5CTXSWT.js → chunk-7TGEXAN5.js} +2 -2
- package/dist/chunk-ABLXPGAZ.js +2 -0
- package/dist/{chunk-F4KR22Z2.js → chunk-BG7YU4DJ.js} +2 -2
- package/dist/chunk-D2R6IIEO.js +2 -0
- package/dist/{chunk-LT2CPEQ4.js → chunk-E47WMJ5F.js} +2 -2
- package/dist/chunk-EEA3R37V.js +11 -0
- package/dist/chunk-FAN2CVZT.js +2 -0
- package/dist/{chunk-PFMGJ4BR.js → chunk-FYO3FPFH.js} +2 -2
- package/dist/chunk-G47V5V3U.js +90 -0
- package/dist/chunk-GS55K4WJ.js +85 -0
- package/dist/{chunk-BNCTPTVX.js → chunk-HADDFTMU.js} +2 -2
- package/dist/chunk-HTJ5BOYP.js +10 -0
- package/dist/chunk-IARIBTCL.js +2 -0
- package/dist/{chunk-5YYMKE3G.js → chunk-IBWYWAWE.js} +2 -2
- package/dist/{chunk-URUVLDM7.js → chunk-ILQSK2KJ.js} +2 -2
- package/dist/{chunk-DRLWW74T.js → chunk-JVMXNDRU.js} +2 -2
- package/dist/{chunk-YDNCX5PF.js → chunk-K345WFTU.js} +2 -2
- package/dist/{chunk-FHSD5RKF.js → chunk-K6ULLR7M.js} +2 -2
- package/dist/chunk-KCC3GMCX.js +2 -0
- package/dist/{chunk-7LSCW7NF.js → chunk-KQWFRAQI.js} +2 -2
- package/dist/chunk-KRVRD6KZ.js +5 -0
- package/dist/{chunk-QFZE73XF.js → chunk-KYGNCIJ6.js} +8 -8
- package/dist/chunk-LHLXHH43.js +2 -0
- package/dist/{chunk-RT5PV5JQ.js → chunk-M7GBLQG4.js} +2 -2
- package/dist/{chunk-5LQ6CVX3.js → chunk-MEVK6R7N.js} +2 -2
- package/dist/{chunk-Q2ALKKSE.js → chunk-OCQN6WF4.js} +2 -2
- package/dist/{chunk-ERRUE5G4.js → chunk-PQTGBYXV.js} +2 -2
- package/dist/{chunk-ZHHMG4UC.js → chunk-QYWGC7JV.js} +2 -2
- package/dist/{chunk-TLRA5TR6.js → chunk-R373SHXM.js} +2 -2
- package/dist/{chunk-MXWC53GJ.js → chunk-RRWPHKZA.js} +2 -2
- package/dist/{chunk-C5BFS23M.js → chunk-RUAJV3TN.js} +2 -2
- package/dist/{chunk-MKFH7QJG.js → chunk-S57GUI2T.js} +2 -2
- package/dist/chunk-SVUVC5VS.js +2 -0
- package/dist/{chunk-MO32JMOD.js → chunk-T426XELO.js} +2 -2
- package/dist/{chunk-HUASU3AD.js → chunk-TBJDUS4E.js} +7 -7
- package/dist/chunk-TX7BHRMT.js +2 -0
- package/dist/{chunk-PK4U6NWP.js → chunk-TYRPQE6R.js} +2 -2
- package/dist/chunk-WPY46NIL.js +5 -0
- package/dist/{chunk-U5MVUPOO.js → chunk-X3Z4KZNX.js} +2 -2
- package/dist/{chunk-7X7FLQC5.js → chunk-ZNNCDAYX.js} +2 -2
- package/dist/cli.js +159 -148
- package/dist/{db-BZPa7dzJ.d.ts → db-DdlToIC-.d.ts} +1 -0
- package/dist/index.d.ts +12 -9
- package/dist/index.js +11 -11
- package/dist/queries/affected.d.ts +1 -1
- package/dist/queries/affected.js +1 -1
- package/dist/queries/bottlenecks.d.ts +1 -1
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.d.ts +1 -1
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +1 -1
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +1 -1
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/code.d.ts +1 -1
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.d.ts +2 -1
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +1 -1
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/convergence.d.ts +1 -1
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.d.ts +1 -1
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +1 -1
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.d.ts +1 -1
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +1 -1
- package/dist/queries/dead.js +1 -1
- package/dist/queries/deep-chains.d.ts +1 -1
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/deps.d.ts +1 -1
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-impact.d.ts +20 -2
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/drift.d.ts +1 -1
- package/dist/queries/drift.js +1 -1
- package/dist/queries/extract-candidates.d.ts +2 -1
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +1 -1
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.d.ts +1 -1
- package/dist/queries/health-cache-control.d.ts +15 -0
- package/dist/queries/health-cache-control.js +2 -0
- package/dist/queries/health.d.ts +66 -2
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +1 -1
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +1 -1
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +1 -1
- package/dist/queries/imports.js +1 -1
- package/dist/queries/index.d.ts +3 -3
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.d.ts +1 -1
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/members.d.ts +1 -1
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.d.ts +1 -1
- package/dist/queries/methods.js +1 -1
- package/dist/queries/outline.d.ts +1 -1
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +2 -1
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +1 -1
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.d.ts +1 -1
- package/dist/queries/refs.js +1 -1
- package/dist/queries/similar-chains.d.ts +1 -1
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.d.ts +1 -1
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.d.ts +1 -1
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +2 -1
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +1 -1
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.d.ts +4 -2
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +1 -1
- package/dist/queries/surface.d.ts +1 -1
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.d.ts +1 -1
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system.d.ts +1 -1
- package/dist/queries/system.js +1 -1
- package/dist/queries/trace.d.ts +1 -1
- package/dist/queries/trace.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +2 -1
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-2ZGHRI2A.js +0 -5
- package/dist/chunk-32R4VYYA.js +0 -2
- package/dist/chunk-3UB2DPLP.js +0 -2
- package/dist/chunk-4X7C236P.js +0 -84
- package/dist/chunk-A5UNS4DR.js +0 -4
- package/dist/chunk-FG6A6ZUP.js +0 -2
- package/dist/chunk-FVVEIGP3.js +0 -5
- package/dist/chunk-GBDZY73J.js +0 -2
- package/dist/chunk-IJWIYZO5.js +0 -2
- package/dist/chunk-K6H3XJQW.js +0 -7
- package/dist/chunk-KTCODJNQ.js +0 -5
- package/dist/chunk-M5QTG55L.js +0 -2
- package/dist/chunk-MTK3JAJT.js +0 -2
- package/dist/chunk-PBFMZKXE.js +0 -6
- package/dist/chunk-ROWAEEOD.js +0 -2
- package/dist/chunk-WHGCGENP.js +0 -16
- package/dist/chunk-WNMAH3P7.js +0 -2
- package/dist/chunk-XV3XUZ3X.js +0 -11
- package/dist/chunk-YU25IHJX.js +0 -90
- package/dist/chunk-ZFCQQ4B5.js +0 -2
package/dist/reindex-worker.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as k,b as $}from"./chunk-
|
|
1
|
+
import{a as k,b as $}from"./chunk-TBJDUS4E.js";import{d as E}from"./chunk-H4DXD2FB.js";import{execFile as Ke,execFileSync as Ve}from"child_process";import{closeSync as Ye,existsSync as m,mkdirSync as ee,mkdtempSync as Ze,openSync as en,readFileSync as nn,renameSync as f,rmSync as h,writeFileSync as ne}from"fs";import{cpus as tn}from"os";import{basename as I,dirname as d,extname as rn,join as c}from"path";import{execFileSync as ue}from"child_process";import{existsSync as le,readdirSync as M}from"fs";import{extname as N,join as F}from"path";var ce=new Set([".git",".hg",".svn",".idea",".vscode","node_modules","vendor","dist","build","target","bin","obj",".dart_tool",".gradle",".next",".venv","venv","__pycache__"]),pe=[{language:"typescript",files:["tsconfig.json","tsconfig.base.json"],extensions:[".ts",".tsx",".mts",".cts"]},{language:"rust",files:["Cargo.toml"],extensions:[".rs"]},{language:"go",files:["go.mod"],extensions:[".go"]},{language:"java",files:["pom.xml","build.gradle","build.gradle.kts"],extensions:[".java"]},{language:"kotlin",files:["build.gradle.kts"],extensions:[".kt",".kts"]},{language:"scala",files:["build.sbt"],extensions:[".scala"]},{language:"python",files:["pyproject.toml","setup.py","setup.cfg","Pipfile"],extensions:[".py",".pyi"]},{language:"ruby",files:["Gemfile"],extensions:[".rb"]},{language:"cpp",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"]},{language:"c",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".c",".h"]},{language:"csharp",globs:["*.csproj","*.sln"],extensions:[".cs"]},{language:"vb",globs:["*.vbproj"],extensions:[".vb"]},{language:"dart",files:["pubspec.yaml"],extensions:[".dart"]},{language:"php",files:["composer.json"],extensions:[".php"]},{language:"javascript",files:["package.json"],extensions:[".js",".jsx",".mjs",".cjs"]}];function A(e){let n=[],t=ge(e),r=he(e);for(let a of pe){if(de(e,a.files)){n.push(a.language);continue}if(me(t,a.globs)){n.push(a.language);continue}ye(r,a.extensions)&&n.push(a.language)}return n.includes("typescript")&&B(n,"javascript"),n.includes("cpp")&&!r.has(".c")&&B(n,"c"),n}function ge(e){try{return M(e)}catch{return[]}}function de(e,n){return n?.length?n.some(t=>le(F(e,t))):!1}function me(e,n){return n?.length?e.some(t=>n.some(r=>fe(t,r))):!1}function fe(e,n){if(n==="*")return!0;if(!n.includes("*"))return e===n;let[t,r]=n.split("*");return e.startsWith(t??"")&&e.endsWith(r??"")}function he(e){let n=xe(e);if(n)return n;let t=new Set,r=[e];for(;r.length>0;){let a=r.pop();if(!a)continue;let i;try{i=M(a,{withFileTypes:!0})}catch{continue}for(let s of i){if(s.name.startsWith(".")&&!s.name.endsWith("proj")&&!s.name.endsWith("sln")&&s.isDirectory())continue;let o=F(a,s.name);if(s.isDirectory()){ce.has(s.name)||r.push(o);continue}let g=N(s.name).toLowerCase();g&&t.add(g)}}return t}function xe(e){try{let n=ue("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"]}),t=new Set;for(let r of n.split(`
|
|
2
2
|
`)){if(!r)continue;let a=N(r).toLowerCase();a&&t.add(a)}return t}catch{return null}}function ye(e,n){return n?.length?n.some(t=>e.has(t)):!1}function B(e,n){let t=e.indexOf(n);t!==-1&&e.splice(t,1)}import{existsSync as _,readdirSync as be}from"fs";import{join as R}from"path";var Se={typescript:{language:"typescript",indexerBinary:"scip-typescript",checkCommand:"npx scip-typescript --version",indexArgs:({outputPath:e,pnpmWorkspaces:n,indexerBinary:t})=>{let r=["index","--infer-tsconfig","--output",e,"--no-progress-bar"];return n&&r.splice(1,0,"--pnpm-workspaces"),{binary:t,args:r}},markerFiles:["tsconfig.json"],installMethods:[{label:"npm",prerequisite:"npm",binary:"npm",args:["install","-g","@sourcegraph/scip-typescript"]}],installUrl:"https://github.com/sourcegraph/scip-typescript",bundledNpmPackage:"@sourcegraph/scip-typescript"},javascript:{language:"javascript",indexerBinary:"scip-typescript",checkCommand:"npx scip-typescript --version",indexArgs:({outputPath:e,indexerBinary:n})=>({binary:n,args:["index","--infer-tsconfig","--output",e,"--no-progress-bar"]}),markerFiles:["package.json"],installMethods:[{label:"npm",prerequisite:"npm",binary:"npm",args:["install","-g","@sourcegraph/scip-typescript"]}],installUrl:"https://github.com/sourcegraph/scip-typescript",bundledNpmPackage:"@sourcegraph/scip-typescript"},java:{language:"java",indexerBinary:"scip-java",checkCommand:"scip-java --version",indexArgs:({outputPath:e})=>({binary:"scip-java",args:["index","--output",e]}),markerFiles:["pom.xml","build.gradle"],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-java/releases"},scala:{language:"scala",indexerBinary:"scip-java",checkCommand:"scip-java --version",indexArgs:({outputPath:e})=>({binary:"scip-java",args:["index","--output",e]}),markerFiles:["build.sbt"],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-java/releases"},kotlin:{language:"kotlin",indexerBinary:"scip-java",checkCommand:"scip-java --version",indexArgs:({outputPath:e})=>({binary:"scip-java",args:["index","--output",e]}),markerFiles:["build.gradle.kts"],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-java/releases"},rust:{language:"rust",indexerBinary:"rust-analyzer",checkCommand:"rust-analyzer --version",indexArgs:({outputPath:e})=>({binary:"rust-analyzer",args:["scip",".","--output",e]}),markerFiles:["Cargo.toml"],installMethods:[{label:"rustup",prerequisite:"rustup",binary:"rustup",args:["component","add","rust-analyzer"]}],installUrl:"https://github.com/rust-lang/rust-analyzer"},python:{language:"python",indexerBinary:"scip-python-plus",binaryAliases:["scip-python"],checkCommand:"scip-python-plus --version",indexArgs:({outputPath:e,indexerBinary:n})=>({binary:n,args:["index","--output",e,"--project-name","project"]}),markerFiles:["pyproject.toml","setup.py"],installMethods:[{label:"npm",prerequisite:"npm",binary:"npm",args:["install","-g","scip-python-plus"]}],installUrl:"https://github.com/PlunderStruck/scip-python",bundledNpmPackage:"scip-python-plus"},ruby:{language:"ruby",indexerBinary:"scip-ruby",checkCommand:"scip-ruby --version",indexArgs:({indexerBinary:e})=>({binary:e,args:["--dir","."]}),defaultOutputPath:"index.scip",markerFiles:["Gemfile"],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-ruby/releases"},go:{language:"go",indexerBinary:"scip-go",checkCommand:"scip-go --version",indexArgs:({outputPath:e})=>({binary:"scip-go",args:["--output",e]}),markerFiles:["go.mod"],installMethods:[{label:"go install",prerequisite:"go",binary:"go",args:["install","github.com/sourcegraph/scip-go@latest"]}],installUrl:"https://github.com/sourcegraph/scip-go"},cpp:{language:"cpp",indexerBinary:"scip-clang",checkCommand:"scip-clang --version",indexArgs:({outputPath:e})=>({binary:"scip-clang",args:["--compdb-path","compile_commands.json","--index-output-path",e]}),markerFiles:["CMakeLists.txt","Makefile"],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-clang/releases"},c:{language:"c",indexerBinary:"scip-clang",checkCommand:"scip-clang --version",indexArgs:({outputPath:e})=>({binary:"scip-clang",args:["--compdb-path","compile_commands.json","--index-output-path",e]}),markerFiles:["CMakeLists.txt","Makefile"],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-clang/releases"},csharp:{language:"csharp",indexerBinary:"scip-dotnet",checkCommand:"scip-dotnet --version",indexArgs:({projectRoot:e,outputPath:n})=>({binary:"scip-dotnet",args:["index",T(e,[".sln",".csproj"])??e,"--output",n,"--working-directory",e]}),markerFiles:["*.csproj","*.sln"],installMethods:[{label:"dotnet",prerequisite:"dotnet",binary:"dotnet",args:["tool","install","--global","scip-dotnet"]}],installUrl:"https://github.com/sourcegraph/scip-dotnet/releases"},vb:{language:"vb",indexerBinary:"scip-dotnet",checkCommand:"scip-dotnet --version",indexArgs:({projectRoot:e,outputPath:n})=>({binary:"scip-dotnet",args:["index",T(e,[".sln",".vbproj"])??e,"--output",n,"--working-directory",e]}),markerFiles:["*.vbproj","*.sln"],installMethods:[{label:"dotnet",prerequisite:"dotnet",binary:"dotnet",args:["tool","install","--global","scip-dotnet"]}],installUrl:"https://github.com/sourcegraph/scip-dotnet/releases"},dart:{language:"dart",indexerBinary:"scip-dart",checkCommand:"scip-dart --version",indexArgs:({indexerBinary:e,outputPath:n})=>({binary:e,args:["--output",n]}),markerFiles:["pubspec.yaml"],installMethods:[{label:"dart pub",prerequisite:"dart",binary:"dart",args:["pub","global","activate","scip_dart"]}],installUrl:"https://github.com/Workiva/scip-dart/releases"},php:{language:"php",indexerBinary:"scip-php",projectLocalBinaries:["vendor/davidrjenni/scip-php/bin/scip-php","vendor/bin/scip-php"],checkCommand:"scip-php --version",indexArgs:({projectRoot:e,indexerBinary:n})=>{let t=R(e,"vendor","bin","scip-php"),r=R(e,"vendor","davidrjenni","scip-php","bin","scip-php");return{binary:"php",args:["-d","error_reporting=E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED",_(r)?r:_(t)?t:n]}},defaultOutputPath:"index.scip",markerFiles:["composer.json"],installMethods:[],installUrl:"https://github.com/davidrjenni/scip-php/releases"}};function U(e){return Se[e]}function T(e,n){let t;try{t=be(e)}catch{return null}for(let r of t)if(n.some(a=>r.endsWith(a)))return R(e,r);return null}import{readFileSync as Pe,writeFileSync as ve}from"fs";import{create as D}from"@bufbuild/protobuf";import{deserializeSCIP as Ie,serializeSCIP as ke,DocumentSchema as Re,IndexSchema as De,SymbolInformationSchema as Ce}from"@c4312/scip";function Oe(e){if(e.length===0)throw new Error("Cannot merge zero SCIP indexes");if(e.length===1)return e[0];let n=je(e),t=Le(e.flatMap(a=>a.documents??[])),r=q(e.flatMap(a=>a.externalSymbols??[]));return D(De,{metadata:n,documents:t,externalSymbols:r})}function W(e,n){if(e.length===0)throw new Error("Cannot merge zero SCIP files");let t=e.map(a=>Ie(Pe(a))),r=Oe(t);return ve(n,Buffer.from(ke(r))),{documentCount:r.documents.length,externalSymbolCount:r.externalSymbols.length,inputCount:e.length}}function je(e){let n=e[0]?.metadata;if(!n)return;let t=n.projectRoot;for(let r of e.slice(1)){let a=r.metadata?.projectRoot;if(t&&a&&a!==t)throw new Error(`Cannot merge SCIP indexes with different project roots: ${t} vs ${a}`)}return n}function Le(e){let n=new Map;for(let t of e){let r=n.get(t.relativePath);if(!r){n.set(t.relativePath,t);continue}n.set(t.relativePath,D(Re,{language:r.language||t.language,relativePath:r.relativePath||t.relativePath,occurrences:[...r.occurrences,...t.occurrences],symbols:q([...r.symbols,...t.symbols]),text:Ee(r.text,t.text),positionEncoding:r.positionEncoding||t.positionEncoding}))}return[...n.values()]}function q(e){let n=new Map;for(let t of e){let r=n.get(t.symbol);if(!r){n.set(t.symbol,t);continue}n.set(t.symbol,D(Ce,{symbol:r.symbol,documentation:$e([...r.documentation,...t.documentation]),relationships:we([...r.relationships,...t.relationships]),kind:r.kind||t.kind,displayName:r.displayName||t.displayName,enclosingSymbol:r.enclosingSymbol||t.enclosingSymbol,signatureDocumentation:r.signatureDocumentation??t.signatureDocumentation}))}return[...n.values()]}function we(e){let n=new Set,t=[];for(let r of e){let a=[r.symbol,r.isReference?"1":"0",r.isImplementation?"1":"0",r.isTypeDefinition?"1":"0",r.isDefinition?"1":"0"].join("|");n.has(a)||(n.add(a),t.push(r))}return t}function Ee(e,n){return e?n?e.length>=n.length?e:n:e:n}function $e(e){return[...new Set(e)]}import{readFileSync as Be,writeFileSync as Me}from"fs";import{create as z}from"@bufbuild/protobuf";import{deserializeSCIP as Ne,DocumentSchema as Fe,IndexSchema as Ae,serializeSCIP as _e,SymbolRole as Te}from"@c4312/scip";function J(e){let n;try{n=Ne(Be(e))}catch{return{removedDefinitionOccurrences:0,touchedDocuments:0}}let t=Ue(n);return t.removedDefinitionOccurrences>0&&Me(e,Buffer.from(_e(t.index))),{removedDefinitionOccurrences:t.removedDefinitionOccurrences,touchedDocuments:t.touchedDocuments}}function Ue(e){let n=new Set;for(let i of e.documents)for(let s of i.symbols)s.symbol&&n.add(s.symbol);for(let i of e.externalSymbols)i.symbol&&n.add(i.symbol);let t=0,r=0,a=[];for(let i of e.documents){let s=i.occurrences.filter(o=>(o.symbolRoles&Te.Definition)===0||n.has(o.symbol)?!0:(t+=1,!1));if(s.length===i.occurrences.length){a.push(i);continue}r+=1,a.push(z(Fe,{language:i.language,relativePath:i.relativePath,occurrences:s,symbols:i.symbols,text:i.text,positionEncoding:i.positionEncoding}))}return{index:t===0?e:z(Ae,{metadata:e.metadata,documents:a,externalSymbols:e.externalSymbols}),removedDefinitionOccurrences:t,touchedDocuments:r}}import{execFileSync as S}from"child_process";import{existsSync as C,readFileSync as We}from"fs";import{createRequire as qe}from"module";import{platform as H}from"os";import{dirname as G,join as b}from"path";var ze=qe(import.meta.url),Je=H()==="win32";function x(e){let n=Je?"where":"which";try{return S(n,[e],{stdio:"pipe"}),!0}catch{return!1}}function O(e){return[e.indexerBinary,...e.binaryAliases??[]]}function j(e){let n=O(e);return n.length===1?n[0]:n.join(" or ")}function P(e){for(let n of O(e))if(x(n))return n;return He(e)}function X(e){return P(e)!==null||Ge(e)}function Ge(e){return Q(e)!==null}function He(e){let n=Q(e);if(!n)return null;let r=JSON.parse(We(n,"utf8")).bin;if(!r)return null;if(typeof r=="string")return b(G(n),r);for(let a of O(e)){let i=r[a];if(i)return b(G(n),i)}return null}function Q(e){if(!e.bundledNpmPackage)return null;try{return ze.resolve(`${e.bundledNpmPackage}/package.json`)}catch{return null}}function K(e,n){for(let t of e.projectLocalBinaries??[]){let r=b(n,t);if(C(r))return r}return null}function V(e,n=process.env,t=e.indexerBinary){if(e.indexerBinary!=="scip-dotnet"||Z(t,n))return n;let r=Xe(t,n);return r?{...n,DOTNET_ROOT:r}:n}function Y(e,n){let t=e.installMethods,r=j(e);if(!t?.length)return n(`No auto-install method available for ${r}.`),e.installUrl&&n(`Install manually from: ${e.installUrl}`),!1;for(let a of t)if(x(a.prerequisite)){n(`Installing ${r} via ${a.label}...`);try{S(a.binary,a.args,{stdio:"inherit",timeout:3e5,env:process.env});let i=P(e);if(i){let s=i===e.indexerBinary?"":` (using ${i})`;return n(`Successfully installed ${r} via ${a.label}${s}`),!0}n(`${a.label} command completed but ${r} was not found on PATH`)}catch(i){let s=i instanceof Error?i.message:String(i);n(`${a.label} install failed: ${s}`)}}return n(`Could not auto-install ${r}.`),e.installUrl&&n(`Install manually from: ${e.installUrl}`),!1}function Xe(e,n){for(let t of Qe(n))if(Z(e,{...n,DOTNET_ROOT:t}))return t;return null}function Qe(e){let n=[],t=e.DOTNET_ROOT;if(t&&C(t)&&n.push(t),H()==="darwin"&&x("brew"))try{let r=S("brew",["--prefix","dotnet@9"],{stdio:"pipe",env:e}).toString().trim(),a=b(r,"libexec");C(a)&&!n.includes(a)&&n.push(a)}catch{}return n}function Z(e,n){try{return S(e,["--version"],{stdio:"pipe",env:n}),!0}catch{return!1}}async function te(e){let{projectRoot:n,maxHeapMb:t=8192,onStatus:r=console.log,skipAutoInstall:a=!1}=e,i=an(e),s=Date.now();ee(d(i.outputScip),{recursive:!0}),ee(d(i.outputDb),{recursive:!0});let o=e.languages??A(n);if(o.length===0)throw new Error("No supported languages detected in this project. Looked for: tsconfig.json, Cargo.toml, go.mod, pyproject.toml, etc.");r(`Detected languages: ${o.join(", ")}`);let g=On(n,o,{pnpmWorkspaces:e.pnpmWorkspaces}),u=vn(c(d(i.outputDb),"index.lock")),p=null;try{let l=sn({opts:e,paths:i,languages:o,fingerprint:g,start:s,onStatus:r});if(l)return l;pn(a,r);let y=on(i);return p=y.runDir,await un({opts:e,languages:o,projectRoot:n,paths:i,tempPaths:y,fingerprint:g,start:s,maxHeapMb:t,skipAutoInstall:a,onStatus:r})}finally{p&&h(p,{recursive:!0,force:!0}),u()}}function an(e){let n=e.outputScip??c(e.projectRoot,"index.scip"),t=e.outputDb??c(e.projectRoot,"index.db");return{outputScip:n,outputDb:t,metaPath:c(d(t),"meta.json")}}function sn(e){if(e.opts.skipIfUnchanged===!1||!m(e.paths.outputScip)||!m(e.paths.outputDb)||!jn(e.paths.metaPath,e.fingerprint))return null;k({projectRoot:e.opts.projectRoot,dbPath:e.paths.outputDb,onStatus:e.onStatus});let n=Date.now()-e.start;return e.onStatus(`Index unchanged; reused existing SQLite index in ${(n/1e3).toFixed(1)}s`),{languages:e.languages,indexPath:e.paths.outputScip,dbPath:e.paths.outputDb,durationMs:n,reused:!0,skipped:[]}}function on(e){let n=Ze(c(d(e.outputDb),"reindex-"));return{runDir:n,tempOutputScip:c(n,I(e.outputScip)),tempOutputDb:c(n,I(e.outputDb)),tempMetaPath:c(n,I(e.metaPath))}}async function un(e){let n={...process.env,NODE_OPTIONS:`--max-old-space-size=${e.maxHeapMb}`},{indexedOutputs:t,skippedLanguages:r}=await ln(e,n);cn(e,n,t,r);let a=Date.now()-e.start;return e.onStatus(`Done in ${(a/1e3).toFixed(1)}s`),{languages:t.map(i=>i.language),indexPath:e.paths.outputScip,dbPath:e.paths.outputDb,durationMs:a,reused:!1,skipped:r}}async function ln(e,n){let{preparedRuns:t,skippedLanguages:r}=gn({languages:e.languages,tempOutputScip:e.tempPaths.tempOutputScip,projectRoot:e.projectRoot,env:n,skipAutoInstall:e.skipAutoInstall,pnpmWorkspaces:e.opts.pnpmWorkspaces,onStatus:e.onStatus}),a=await Rn(t,e.projectRoot,e.onStatus,e.opts.indexerConcurrency),{indexedOutputs:i}=mn(a,r);return fn(i,r,e.languages,e.opts.allowPartial,e.onStatus),{indexedOutputs:i,skippedLanguages:r}}function cn(e,n,t,r){hn(t,e.tempPaths.tempOutputScip,e.onStatus),xn(e.tempPaths.tempOutputScip,e.tempPaths.tempOutputDb,n,e.onStatus),k({projectRoot:e.projectRoot,dbPath:e.tempPaths.tempOutputDb,onStatus:e.onStatus}),Ln(e.tempPaths.tempMetaPath,{version:2,status:r.length===0?"complete":"partial",updatedAt:new Date().toISOString(),fingerprint:e.fingerprint,requestedLanguages:e.languages,indexedLanguages:t.map(a=>a.language),skipped:[...r]}),In({tempOutputScip:e.tempPaths.tempOutputScip,tempOutputDb:e.tempPaths.tempOutputDb,tempMetaPath:e.tempPaths.tempMetaPath,outputScip:e.paths.outputScip,outputDb:e.paths.outputDb,metaPath:e.paths.metaPath})}function pn(e,n){if(!x("scip")){if(e)throw new Error(`The scip CLI is required but not found on PATH.
|
|
3
3
|
Install from: https://github.com/sourcegraph/scip/releases`);if(n("scip CLI not found on PATH. Attempting auto-install..."),!E(n))throw new Error(`The scip CLI is required but could not be installed.
|
|
4
4
|
Install manually from: https://github.com/sourcegraph/scip/releases`)}}function gn(e){let n=[],t=[],r=e.languages.map((a,i)=>({language:a,scipPath:e.languages.length>1?Pn(e.tempOutputScip,a,i):e.tempOutputScip}));for(let{language:a,scipPath:i}of r){let s=dn({...e,language:a,scipPath:i});"skipped"in s?t.push(s.skipped):n.push(s.prepared)}return{preparedRuns:n,skippedLanguages:t}}function dn(e){let n=U(e.language),t=j(n),r=K(n,e.projectRoot);if(!r&&!X(n)){if(e.skipAutoInstall){let o=`${t} not found on PATH (auto-install disabled). ${n.installUrl??""}`.trim();return e.onStatus(`Skipping ${e.language}: ${o}`),{skipped:{language:e.language,reason:o}}}if(e.onStatus(`${t} not found. Attempting auto-install...`),!Y(n,e.onStatus)){let o=`${t} could not be auto-installed. ${n.installUrl?`Install manually from ${n.installUrl}`:`Install ${t} and put it on PATH.`}`;return e.onStatus(`Skipping ${e.language}: ${o}`),{skipped:{language:e.language,reason:o}}}}let a=r??P(n);if(!a){let o=`${t} was not found after installation checks.`;return e.onStatus(`Skipping ${e.language}: ${o}`),{skipped:{language:e.language,reason:o}}}let{binary:i,args:s}=n.indexArgs({projectRoot:e.projectRoot,outputPath:e.scipPath,pnpmWorkspaces:e.pnpmWorkspaces,indexerBinary:a});return{prepared:{language:e.language,scipPath:e.scipPath,config:n,resolvedBinary:a,binary:i,args:s,env:V(n,e.env,a)}}}function mn(e,n){let t=[];for(let r of e)r.skipped?n.push(r.skipped):t.push({language:r.language,scipPath:r.scipPath});return{indexedOutputs:t}}function fn(e,n,t,r,a){if(e.length===0){let i=n.map(s=>` - ${s.language}: ${s.reason}`).join(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scip-query",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.7",
|
|
4
4
|
"description": "Language-agnostic code intelligence CLI powered by SCIP indexes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"test": "vitest run",
|
|
35
35
|
"test:watch": "vitest",
|
|
36
36
|
"typecheck": "tsc --noEmit",
|
|
37
|
-
"lint": "eslint src
|
|
37
|
+
"lint": "eslint src tests tsup.config.ts",
|
|
38
38
|
"calibrate": "node scripts/accuracy-calibration.mjs",
|
|
39
39
|
"prepublishOnly": "npm run build",
|
|
40
40
|
"postinstall": "node dist/postinstall.js || true"
|
package/dist/chunk-2ZGHRI2A.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{a as b,b as L,c as q,d as X,e as Z,f as T,g as $,h as _,i as U,j as B,k as h,l as W,m as J}from"./chunk-YU25IHJX.js";import{a as M,c as H,d as v,f as j,g as Q,h as g}from"./chunk-QFZE73XF.js";import{existsSync as ye,readFileSync as Ne}from"fs";import{join as Ie}from"path";function G(e){return e.replace(/'''[\s\S]*?'''/g,C).replace(/"""[\s\S]*?"""/g,C).replace(/#.*$/gm,C).replace(/\/\/.*$/gm,C).replace(/\/\*[\s\S]*?\*\//g,C).replace(/`(?:\\[\s\S]|[^`])*`/g,C).replace(/'(?:\\.|[^'\\\r\n])*'/g,C).replace(/"(?:\\.|[^"\\\r\n])*"/g,C)}function C(e){return e.replace(/[^\r\n]/g," ")}var _e=H("stripped-lines");function At(e,r,t){return _e.get(e,r,t,()=>G(t).split(`
|
|
2
|
-
`))}var K=null,z="";function Ce(e){return K===e||(K=e,z=G(e)),z}function E(e,r,t){let s=Ce(e);return`${s.slice(0,r)}${" ".repeat(t-r)}${s.slice(t)}`}function S(e,r){return new RegExp(`\\b${Y(r)}\\b`,"m").test(e)}function k(e,r){let t=new Set,s=new RegExp(`\\b${Y(r)}\\s*\\.\\s*([A-Za-z_$][\\w$]*)`,"g");for(let n of e.matchAll(s)){let o=n[1];o&&t.add(o)}return[...t]}function Y(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function x(e){let r=[],t=0,s=0;for(let n=0;n<e.length;n++){let o=e[n];(o==="{"||o==="["||o==="(")&&t++,(o==="}"||o==="]"||o===")")&&t--,o===","&&t===0&&(r.push(e.slice(s,n)),s=n+1)}return r.push(e.slice(s)),r}function y(e,r){for(let t of e.namedChildren)if(t.type===r)return t;return null}function f(e,r){let t=new Set,s=new Set(["identifier","type_identifier","property_identifier","shorthand_property_identifier","field_identifier"]),n=(o,i)=>{let a=i||r.has(o.type);!a&&s.has(o.type)&&t.add(o.text);for(let c of o.children)n(c,a)};return n(e.rootNode,!1),t}function P(e,r,t,s,n,o,i){return{importedName:n,localName:o,sourcePath:i??h(e,s,Z(r)),kind:"named",used:S(t,o),usedMembers:[]}}function N(e,r,t){let s=[];for(let n of e.matchAll(r)){let o=n[0];if(!o||typeof n.index!="number")continue;let i=E(e,n.index,n.index+o.length);s.push(...t(n,i))}return s}function te(e,r,t){let s=g(e,r);return s?Ee(e,r,s):ve(t).flatMap(n=>qe(e,r,n.clause,n.specifier,n.start,n.end,t))}function Ee(e,r,t){let s=Re(e,r,t),n=[];for(let o of t.rootNode.descendantsOfType("import_statement"))n.push(...Te(e,r,t,o,s));return n}function Re(e,r,t){let s=f(t,new Set(["import_statement"]));if(Q(r))for(let n of Ke(e,r))s.add(n);return s}function Te(e,r,t,s,n){let o=Oe(s);if(!o)return[];let i=T(e,r,o),a=y(s,"import_clause");return a?De(t,a,i,n,je(s.text)):[ke(i)]}function De(e,r,t,s,n){let o=[];for(let i of r.namedChildren)if(i.type==="identifier")o.push(Ae(i.text,t,s,n));else if(i.type==="namespace_import"){let a=Me(e,i,t,s,n);a&&o.push(a)}else i.type==="named_imports"&&o.push(...$e(i,t,s,n));return o}function ke(e){return{importedName:"*",localName:null,sourcePath:e,kind:"side-effect",used:!0,usedMembers:[]}}function Ae(e,r,t,s){return{importedName:"default",localName:e,sourcePath:r,kind:"default",used:t.has(e),usedMembers:[],isTypeOnly:s}}function Me(e,r,t,s,n){let i=y(r,"identifier")?.text??"";if(!i)return null;let a=we(e,i);return{importedName:"*",localName:i,sourcePath:t,kind:"namespace",used:a.length>0||s.has(i),usedMembers:a,isTypeOnly:n}}function $e(e,r,t,s){let n=[];for(let o of e.namedChildren){if(o.type!=="import_specifier")continue;let i=o.namedChild(0),a=o.namedChild(1);if(!i)continue;let c=i.text,p=a?.text??c;n.push({importedName:c,localName:p,sourcePath:r,kind:"named",used:t.has(p),usedMembers:[],isTypeOnly:s||Le(o.text)})}return n}function Oe(e){let r=y(e,"string");if(!r)return null;let t=y(r,"string_fragment");return t?t.text:null}function je(e){return/^\s*import\s+type\b/.test(e)}function Le(e){return/^\s*type\b/.test(e.trim())}function we(e,r){let t=new Set;for(let s of e.rootNode.descendantsOfType("member_expression")){let n=s.namedChild(0),o=s.namedChild(1);!n||!o||n.type!=="identifier"||n.text!==r||(o.type==="property_identifier"||o.type==="identifier")&&t.add(o.text)}return[...t]}function ve(e){let r=[],t=/^[ \t]*import\s+([\s\S]*?)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let n of e.matchAll(t)){let o=n[0],i=n[1],a=n[2];!o||!a||typeof n.index!="number"||r.push({clause:i,specifier:a,start:n.index,end:n.index+o.length})}let s=/^[ \t]*import\s+['"]([^'"]+)['"]\s*;?/gm;for(let n of e.matchAll(s)){let o=n[0],i=n[1];!o||!i||typeof n.index!="number"||r.push({clause:null,specifier:i,start:n.index,end:n.index+o.length})}return r.sort((n,o)=>n.start-o.start)}function qe(e,r,t,s,n,o,i){let a=T(e,r,s),c=E(i,n,o);return t?Ue(t).map(u=>({...u,sourcePath:a})).map(u=>{if(u.kind==="namespace"){let m=k(c,u.localName);return{...u,used:m.length>0||S(c,u.localName),usedMembers:m}}return u.kind==="side-effect"?{...u,used:!0,usedMembers:[]}:{...u,used:u.localName?S(c,u.localName):!1,usedMembers:[]}}):[{importedName:"*",localName:null,sourcePath:a,kind:"side-effect",used:!0,usedMembers:[]}]}function Ue(e){let r=e.trim(),t=/^type\b/.test(r),s=r.replace(/^type\s+/,""),[n,o]=Be(s),i=[];return n&&i.push(...ee(n,t)),o&&i.push(...ee(o,t)),i}function ee(e,r){let t=e.trim();if(!t)return[];if(t.startsWith("{")){let s=t.slice(1,-1).trim();return s?x(s).map(n=>{let o=n.trim(),i=r||/^type\b/.test(o),a=o.replace(/^type\s+/,""),[c,p]=a.split(/\s+as\s+/);return{importedName:c.trim(),localName:(p??c).trim(),kind:"named",isTypeOnly:i}}):[]}return t.startsWith("* as ")?[{importedName:"*",localName:t.slice(5).trim(),kind:"namespace",isTypeOnly:r}]:[{importedName:"default",localName:t,kind:"default",isTypeOnly:r}]}function Be(e){let r=0;for(let t=0;t<e.length;t++){let s=e[t];if(s==="{"&&r++,s==="}"&&r--,s===","&&r===0)return[e.slice(0,t).trim(),e.slice(t+1).trim()]}return[e.trim(),null]}function re(e,r){let t=g(e,r);if(t)return He(e,r,t);let s=v(e,r);return s?We(e,r,s):[]}function We(e,r,t){return[...Je(e,r,t),...ze(e,r,t),...Fe(e,r,t)]}function Je(e,r,t){let s=[],n=/^[ \t]*export\s+(?:type\s+)?\{([\s\S]*?)\}\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of t.matchAll(n)){if(typeof o.index!="number")continue;let i=o[1]??"",a=o[2]??"",c=x(i).map(m=>Ve(m.trim())).filter(m=>!!m),p=A(t,o.index),u=A(t,o.index+o[0].length-1);s.push({kind:"named",sourcePath:T(e,r,a),names:c,startLine:p,endLine:u})}return s}function ze(e,r,t){let s=[],n=/^[ \t]*export\s+\*\s+as\s+(\w+)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of t.matchAll(n)){if(typeof o.index!="number")continue;let i=o[2]??"",a=A(t,o.index),c=A(t,o.index+o[0].length-1);s.push({kind:"star-as",sourcePath:T(e,r,i),names:[],startLine:a,endLine:c})}return s}function Fe(e,r,t){let s=[],n=/^[ \t]*export\s+\*\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of t.matchAll(n)){if(typeof o.index!="number")continue;let i=o[1]??"",a=A(t,o.index),c=A(t,o.index+o[0].length-1);s.push({kind:"star",sourcePath:T(e,r,i),names:[],startLine:a,endLine:c})}return s}function Ve(e){if(!e)return null;let r=e.replace(/^type\s+/,"").trim();if(!r)return null;let t=r.match(/^(\w+)\s+as\s+(\w+)$/);if(t)return t[2]??null;let s=r.match(/^(\w+)$/);return s?s[1]??null:null}function A(e,r){let t=0;for(let s=0;s<r&&s<e.length;s++)e.charCodeAt(s)===10&&t++;return t}function He(e,r,t){let s=[];for(let n of t.rootNode.descendantsOfType("export_statement")){let o=Qe(e,r,n);if(o===void 0)continue;let i=n.startPosition.row,a=n.endPosition.row,c=Xe(n,o,i,a);s.push(c)}return s}function Qe(e,r,t){let s=y(t,"string");if(!s)return;let n=y(s,"string_fragment");if(n)return T(e,r,n.text)}function Xe(e,r,t,s){let n=y(e,"export_clause");if(n){let i=[];for(let a of n.namedChildren){if(a.type!=="export_specifier")continue;let c=a.namedChild(0),p=a.namedChild(1);c&&i.push((p??c).text)}return{kind:"named",sourcePath:r,names:i,startLine:t,endLine:s}}return y(e,"namespace_export")?{kind:"star-as",sourcePath:r,names:[],startLine:t,endLine:s}:{kind:"star",sourcePath:r,names:[],startLine:t,endLine:s}}var Ze=M("vue-non-script-identifiers");function Ke(e,r){return Ze.get(e,r,()=>{let t=new Set,s=v(e,r);if(!s)return t;let o=s.replace(/<script\b[^>]*>[\s\S]*?<\/script>/g,i=>i.replace(/[^\r\n]/g," ")).replace(/<!--[\s\S]*?-->/g,i=>i.replace(/[^\r\n]/g," ")).replace(/\/\*[\s\S]*?\*\//g,i=>i.replace(/[^\r\n]/g," "));for(let i of o.matchAll(/[A-Za-z_$][\w$]*/g))t.add(i[0]);return t})}import{basename as se}from"path";function ne(e,r,t){let s=g(e,r);return s?Ge(e,r,s):N(t,/^[ \t]*#include\s+[<"]([^">]+)[">]\s*$/gm,(n,o)=>{let i=n[1]?.trim();if(!i)return[];let a=se(i).replace(/\.[^.]+$/,"");return[{importedName:i,localName:a,sourcePath:B(e,r,i),kind:"named",used:S(o,a),usedMembers:[]}]})}function Ge(e,r,t){let s=f(t,new Set(["preproc_include"])),n=[];for(let o of t.rootNode.descendantsOfType("preproc_include")){let i=null;for(let c of o.namedChildren){if(c.type==="system_lib_string"){i=c.text.replace(/^<|>$/g,"");break}if(c.type==="string_literal"){i=c.namedChildren.find(u=>u.type==="string_content")?.text??c.text.replace(/^"|"$/g,"");break}}if(!i)continue;let a=se(i).replace(/\.[^.]+$/,"");n.push({importedName:i,localName:a,sourcePath:B(e,r,i),kind:"named",used:s.has(a),usedMembers:[]})}return n}function oe(e,r,t){let s=[];for(let n of t.matchAll(/^[ \t]*import\s+['"]([^'"]+)['"](?:\s+as\s+([A-Za-z_]\w*))?[\s\S]*?;$/gm)){let o=n[1]?.trim(),i=n[2]?.trim()??null,a=n[0];if(!o||!a||typeof n.index!="number")continue;let c=E(t,n.index,n.index+a.length);s.push({importedName:o,localName:i,sourcePath:W(e,r,o),kind:i?"namespace":"side-effect",used:i?S(c,i):!0,usedMembers:i?k(c,i):[]})}return s}function ie(e,r,t){let s=[];for(let n of t.matchAll(/^[ \t]*export\s+['"]([^'"]+)['"][\s\S]*?;$/gm)){let o=n[1]?.trim();o&&s.push({specifier:o,sourcePath:W(e,r,o)})}return s}function ae(e,r,t){let s=g(e,r),n=j(r);if(s&&n==="csharp")return et(e,r,s);if(s&&n==="vb")return Ye(e,r,s);let o=X(r)?/^[ \t]*Imports\s+(.+?)\s*$/gm:/^[ \t]*using\s+(.+?)\s*;$/gm;return N(t,o,(i,a)=>{let c=i[1]?.trim();if(!c)return[];let[p,u]=c.split(/\s*=\s*/),m=!!u,l=(m?u:p)?.trim()??c,d=l.split(".").pop()??l,I=m?p?.trim()??d:d;return[P(e,r,a,l,d,I,h(e,l,L))]})}function Ye(e,r,t){let s=f(t,new Set(["imports_statement"])),n=[];for(let o of t.rootNode.descendantsOfType("imports_statement")){let i=o.namedChildren.filter(l=>l.type==="namespace_name");if(i.length===0)continue;let a=i[i.length-1],c=i.length>1?i[0]:null,p=a.text,u=p.split(".").pop()??p,m=c?.text??u;n.push({importedName:u,localName:m,sourcePath:h(e,p,L),kind:c?"namespace":"named",used:s.has(m),usedMembers:[]})}return n}function et(e,r,t){let s=f(t,new Set(["using_directive"])),n=[];for(let o of t.rootNode.descendantsOfType("using_directive")){let i=o.namedChildren;if(i.length===0)continue;let a=null,c;i.length>=2&&i[0].type==="identifier"&&(i[1].type==="qualified_name"||i[1].type==="identifier")?(a=i[0],c=i[1]):c=i[i.length-1];let p=c.text,u=p.split(".").pop()??p,m=a?.text??u;n.push({importedName:u,localName:m,sourcePath:h(e,p,L),kind:a?"namespace":"named",used:s.has(m),usedMembers:[]})}return n}function ce(e,r,t){let s=g(e,r),n=j(r);return s&&n==="java"?tt(e,r,s):s&&n==="kotlin"?rt(e,r,s):s&&n==="scala"?st(e,r,s):N(t,/^[ \t]*import\s+(?:static\s+)?(.+?)\s*;?$/gm,(o,i)=>{let a=o[1]?.trim();return a?nt(e,r,a,i):[]})}function tt(e,r,t){let s=f(t,new Set(["import_declaration"])),n=[];for(let o of t.rootNode.descendantsOfType("import_declaration")){let i=o.children.some(m=>m.type==="asterisk"),c=o.namedChildren.find(m=>m.type==="scoped_identifier")??o.namedChildren.find(m=>m.type==="identifier");if(!c)continue;let p=c.text;if(i){n.push({importedName:"*",localName:null,sourcePath:h(e,p,b),kind:"namespace",used:!0,usedMembers:[]});continue}let u=p.split(".").pop()??p;n.push({importedName:u,localName:u,sourcePath:h(e,p,b),kind:"named",used:s.has(u),usedMembers:[]})}return n}function rt(e,r,t){let s=f(t,new Set(["import_header","import_list"])),n=[];for(let o of t.rootNode.descendantsOfType("import_header")){let i=o.namedChildren.find(d=>d.type==="identifier");if(!i)continue;let a=o.namedChildren.some(d=>d.type==="wildcard_import"),c=o.namedChildren.find(d=>d.type==="import_alias");if(a){n.push({importedName:"*",localName:null,sourcePath:h(e,i.text,b),kind:"namespace",used:!0,usedMembers:[]});continue}let p=i.text,u=p.split(".").pop()??p,l=c?.namedChild(0)?.text??u;n.push({importedName:u,localName:l,sourcePath:h(e,p,b),kind:"named",used:s.has(l),usedMembers:[]})}return n}function st(e,r,t){let s=f(t,new Set(["import_declaration"])),n=[];for(let o of t.rootNode.descendantsOfType("import_declaration")){let i=o.namedChildren.find(m=>m.type==="namespace_selectors"||m.type==="namespace_wildcard"),a=o.namedChildren.filter(m=>m!==i&&(m.type==="identifier"||m.type==="stable_identifier")),c=a.map(m=>m.text).join(".");if(!c)continue;if(i?.type==="namespace_wildcard"){n.push({importedName:"*",localName:null,sourcePath:h(e,c,b),kind:"namespace",used:!0,usedMembers:[]});continue}if(i?.type==="namespace_selectors"){for(let m of i.namedChildren)if(m.type==="arrow_renamed_identifier"){let[l,d]=m.namedChildren;if(!l)continue;let I=l.text,R=d?.text??I;if(I==="_")continue;n.push({importedName:I,localName:R,sourcePath:h(e,`${c}.${I}`,b),kind:"named",used:s.has(R),usedMembers:[]})}else if(m.type==="identifier"){let l=m.text;n.push({importedName:l,localName:l,sourcePath:h(e,`${c}.${l}`,b),kind:"named",used:s.has(l),usedMembers:[]})}continue}let p=a[a.length-1]?.text??c,u=a.slice(0,-1).map(m=>m.text).join(".")||c;n.push({importedName:p,localName:p,sourcePath:h(e,u&&a.length>1?`${u}.${p}`:c,b),kind:"named",used:s.has(p),usedMembers:[]})}return n}function nt(e,r,t,s){if(t.includes("{")&&t.includes("}")){let n=t.slice(0,t.indexOf("{")).replace(/\.$/,"").trim(),o=t.slice(t.indexOf("{")+1,t.lastIndexOf("}")).trim();return x(o).flatMap(i=>{let a=i.trim();if(!a)return[];let[c,p]=a.includes("=>")?a.split(/\s*=>\s*/):a.split(/\s+as\s+/),u=c?.trim();if(!u||u==="_")return[];let m=(p??u.split(".").pop()??u).trim(),l=u==="_"?n:`${n}.${u}`.replace(/\.\./g,".");return[P(e,r,s,l,u,m)]})}return[P(e,r,s,t,t.split(".").pop()??t,t.split(".").pop()??t)]}function me(e,r,t){let s=g(e,r);return s?ot(e,r,s):N(t,/^[ \t]*use\s+(.+?)\s*;$/gm,(n,o)=>{let i=n[1]?.trim();return i?x(i).flatMap(a=>{let c=a.trim();if(!c)return[];let[p,u]=c.split(/\s+as\s+/i),m=p?.trim()??c,l=m.split("\\").pop()??m,d=(u??l).trim();return[P(e,r,o,m,l,d,h(e,m.replace(/\\/g,"."),q))]}):[]})}function ot(e,r,t){let s=f(t,new Set(["namespace_use_declaration"])),n=[],o=(i,a,c)=>{n.push({importedName:a,localName:c,sourcePath:h(e,i.replace(/\\/g,"."),q),kind:"named",used:s.has(c),usedMembers:[]})};for(let i of t.rootNode.descendantsOfType("namespace_use_declaration")){let a=i.namedChildren.find(c=>c.type==="namespace_use_group");if(a){let c=i.namedChildren.find(p=>p.type==="namespace_name")?.text??"";for(let p of a.namedChildren){if(p.type!=="namespace_use_clause")continue;let{importedName:u,localName:m,qualified:l}=pe(p,c);u&&o(l,u,m)}continue}for(let c of i.namedChildren){if(c.type!=="namespace_use_clause")continue;let{importedName:p,localName:u,qualified:m}=pe(c,"");p&&o(m,p,u)}}return n}function pe(e,r){let t=e.namedChildren.find(p=>p.type==="qualified_name"),s=e.namedChildren.filter(p=>p.type==="name"),n="";t?n=t.text:s.length>=1&&(n=s[0].text);let o=t&&s.length>0?s[s.length-1]:null,i=n.split("\\").pop()??n,a=o?.text??i,c=r?`${r}\\${n}`:n;return{importedName:i,localName:a,qualified:c}}function de(e,r,t){let s=g(e,r);return s?it(e,r,s):ct(t).flatMap(n=>mt(e,r,n,t))}function it(e,r,t){let s=f(t,new Set(["import_statement","import_from_statement"])),n=[];for(let o of t.rootNode.descendantsOfType("import_statement"))for(let i of o.namedChildren){let a=ue(i);if(!a)continue;let c=$(e,r,a.qualifiedName);n.push({importedName:a.qualifiedName,localName:a.localName,sourcePath:c,kind:"namespace",used:s.has(a.localName),usedMembers:[]})}for(let o of t.rootNode.descendantsOfType("import_from_statement")){let i=o.namedChild(0);if(!i)continue;let a=at(i);if(a===null)continue;let c=$(e,r,a);for(let p=1;p<o.namedChildCount;p+=1){let u=o.namedChild(p);if(u.type==="wildcard_import"){n.push({importedName:"*",localName:null,sourcePath:c,kind:"side-effect",used:!0,usedMembers:[]});continue}let m=ue(u);m&&n.push({importedName:m.qualifiedName,localName:m.localName,sourcePath:c,kind:"named",used:s.has(m.localName),usedMembers:[]})}}return n}function ue(e){if(e.type==="aliased_import"){let r=e.namedChild(0),t=e.namedChild(1);return!r||!t?null:{qualifiedName:r.text,localName:t.text}}if(e.type==="dotted_name"){let r=e.text;return{qualifiedName:r,localName:r.split(".")[0]??r}}return e.type==="identifier"?{qualifiedName:e.text,localName:e.text}:null}function at(e){if(e.type==="dotted_name")return e.text;if(e.type==="relative_import"){let r=y(e,"import_prefix")?.text??"",t=y(e,"dotted_name")?.text??"";return`${r}${t}`}return null}function ct(e){let r=e.split(`
|
|
3
|
-
`),t=[],s=0;for(let n=0;n<r.length;n++){let o=r[n],i=o.trimStart(),a=s;if(s+=o.length+1,!i.startsWith("import ")&&!i.startsWith("from "))continue;let c=o,p=a+o.length,u=le(o);for(;n+1<r.length&&(u>0||c.trimEnd().endsWith("\\"));){n++;let l=r[n];c+=`
|
|
4
|
-
${l}`,p+=1+l.length,u+=le(l),s+=l.length+1}let m=pt(c);m&&t.push({...m,start:a,end:p})}return t}function pt(e){let r=e.replace(/\\\s*\n/g," ").trim();if(r.startsWith("import "))return{kind:"import",module:null,clause:r.slice(7).trim()};let t=r.match(/^from\s+([.\w]+)\s+import\s+([\s\S]+)$/);if(!t)return null;let s=t[2].trim();return s.startsWith("(")&&s.endsWith(")")&&(s=s.slice(1,-1).trim()),{kind:"from",module:t[1],clause:s}}function mt(e,r,t,s){let n=E(s,t.start,t.end),o=t.clause.replace(/\n/g," ").trim();if(t.kind==="import")return x(o).flatMap(c=>{let p=c.trim().replace(/,$/,"");if(!p)return[];let[u,m]=p.split(/\s+as\s+/),l=u.trim(),d=(m??l.split(".")[0]??l).trim(),I=$(e,r,l),R=k(n,d);return[{importedName:l,localName:d,sourcePath:I,kind:"namespace",used:S(n,d)||R.length>0,usedMembers:R}]});let i=t.module?$(e,r,t.module):null,a=[];for(let c of x(o)){let p=c.trim().replace(/,$/,"");if(!p)continue;if(p==="*"){a.push({importedName:"*",localName:null,sourcePath:i,kind:"side-effect",used:!0,usedMembers:[]});continue}let[u,m]=p.split(/\s+as\s+/),l=(m??u).trim();a.push({importedName:u.trim(),localName:l,sourcePath:i,kind:"named",used:S(n,l),usedMembers:[]})}return a}function le(e){let r=0;for(let t of e)t==="("&&r++,t===")"&&r--;return r}import{basename as ut}from"path";function fe(e,r,t){let s=g(e,r);return s?lt(e,r,s):N(t,/^[ \t]*(require_relative|require)\s+["']([^"']+)["']\s*$/gm,(n,o)=>{let i=n[1],a=n[2];if(!i||!a)return[];let c=i==="require_relative"?U(e,r,a):null;if(c){let p=ge(a);return[{importedName:p,localName:p,sourcePath:c,kind:"named",used:S(o,p),usedMembers:[]}]}return[{importedName:a,localName:null,sourcePath:c,kind:"side-effect",used:!0,usedMembers:[]}]})}function lt(e,r,t){let s=f(t,new Set([])),n=[],o=new Set(["require","require_relative","load"]);for(let i of t.rootNode.descendantsOfType("call")){let a=i.namedChild(0);if(!a||a.type!=="identifier"||!o.has(a.text))continue;let p=i.namedChildren.find(d=>d.type==="argument_list")?.namedChild(0);if(!p||p.type!=="string")continue;let m=p.namedChildren.find(d=>d.type==="string_content")?.text;if(!m)continue;let l=a.text==="require_relative"?U(e,r,m):null;if(l){let d=ge(m);n.push({importedName:d,localName:d,sourcePath:l,kind:"named",used:s.has(d),usedMembers:[]})}else n.push({importedName:m,localName:null,sourcePath:l,kind:"side-effect",used:!0,usedMembers:[]})}return n}function ge(e){return ut(e).replace(/\.[^.]+$/,"").split("_").filter(Boolean).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")}function he(e,r,t){let s=g(e,r);return s?dt(e,r,s):N(t,/^[ \t]*use\s+(.+?)\s*;$/gm,(n,o)=>{let i=n[1]?.trim();return i?ft(e,r,i,o):[]})}function dt(e,r,t){let s=f(t,new Set(["use_declaration"])),n=[];for(let o of t.rootNode.descendantsOfType("use_declaration")){let i=o.namedChild(0);if(i)for(let a of O(i,"")){if(!a.importedName||a.importedName==="*")continue;let c=_(e,r,a.qualifiedName)??_(e,r,a.qualifiedName.split("::").slice(0,-1).join("::"));n.push({importedName:a.importedName,localName:a.localName,sourcePath:c,kind:"named",used:s.has(a.localName),usedMembers:[]})}}return n}function O(e,r){switch(e.type){case"identifier":case"super":case"self":case"crate":{let t=e.text;return[{qualifiedName:w(r,t),importedName:t,localName:t}]}case"scoped_identifier":{let t=e.text,s=t.split("::").pop()??t;return[{qualifiedName:w(r,t),importedName:s,localName:s}]}case"scoped_use_list":{let t=e.namedChild(0),s=e.namedChild(1);if(!t||!s)return[];let n=w(r,t.text),o=[];for(let i of s.namedChildren)o.push(...O(i,n));return o}case"use_list":{let t=[];for(let s of e.namedChildren)t.push(...O(s,r));return t}case"use_as_clause":{let t=e.namedChild(0),s=e.namedChild(1);if(!t||!s)return[];let n=O(t,r),o=s.text;return n.map(i=>({...i,localName:o}))}case"use_wildcard":{let t=e.namedChild(0),s=t?t.text:"";return[{qualifiedName:w(r,`${s}::*`),importedName:"*",localName:"*"}]}default:return[]}}function w(e,r){return e?r?`${e}::${r}`:e:r}function ft(e,r,t,s){let n=t.trim();if(n.includes("{")&&n.includes("}")){let u=n.slice(0,n.indexOf("{")).replace(/::$/,"").trim(),m=n.slice(n.indexOf("{")+1,n.lastIndexOf("}")).trim();return x(m).flatMap(l=>{let d=l.trim();if(!d||d==="self")return[];let[I,R]=d.split(/\s+as\s+/),D=I?.trim();if(!D)return[];let Pe=(R??D.split("::").pop()??D).trim(),be=`${u}::${D}`.replace(/::::/g,"::");return[P(e,r,s,be,D.split("::").pop()??D,Pe,_(e,r,u))]})}let[o,i]=n.split(/\s+as\s+/),a=o?.trim()??n,c=(i??a.split("::").pop()??a).trim(),p=_(e,r,a)??_(e,r,a.split("::").slice(0,-1).join("::"));return[P(e,r,s,a,a.split("::").pop()??a,c,p)]}function Se(e,r,t){let s=g(e,r);if(s)return gt(e,r,s);let n=[];for(let o of t.matchAll(/^[ \t]*pub\s+use\s+(.+?)\s*;$/gm)){let i=o[1]?.trim();i&&n.push(...St(e,r,i))}return n}function gt(e,r,t){let s=[];for(let n of t.rootNode.descendantsOfType("use_declaration")){if(!ht(n))continue;let o=n.namedChildren.find(i=>i.type!=="visibility_modifier");if(o)for(let i of O(o,""))i.importedName&&s.push(F(e,r,i.qualifiedName))}return s}function ht(e){for(let r of e.children)if(r.type==="visibility_modifier"&&r.text.startsWith("pub"))return!0;return!1}function St(e,r,t){let s=t.trim();if(s.includes("{")&&s.includes("}")){let n=s.slice(0,s.indexOf("{")).replace(/::$/,"").trim(),o=s.slice(s.indexOf("{")+1,s.lastIndexOf("}")).trim();return x(o).flatMap(i=>{let a=i.trim();if(!a||a==="self")return[];let[c]=a.split(/\s+as\s+/),p=`${n}::${c?.trim()??a}`.replace(/::::/g,"::");return[F(e,r,p)]})}return[F(e,r,s)]}function F(e,r,t){return{specifier:t,sourcePath:_(e,r,t)??_(e,r,t.split("::").slice(0,-1).join("::"))}}function xe(e,r){let t=r.toLowerCase();for(let s of e)for(let n of s.extensions)if(t.endsWith(n))return s;return null}var xt={language:"javascript",extensions:[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue"],parseImports:te},yt={language:"python",extensions:[".py",".pyi"],parseImports:de},Nt={language:"jvm",extensions:[".java",".scala",".kt",".kts"],parseImports:ce},It={language:"rust",extensions:[".rs"],parseImports:he,parseExports:Se},Pt={language:"ruby",extensions:[".rb"],parseImports:fe},bt={language:"c/cpp",extensions:[".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx"],parseImports:ne},_t={language:"dotnet",extensions:[".cs",".vb"],parseImports:ae},Ct={language:"dart",extensions:[".dart"],parseImports:oe,parseExports:ie},Et={language:"php",extensions:[".php"],parseImports:me},Rt=[xt,yt,Nt,It,Pt,bt,_t,Ct,Et];function V(e){return xe(Rt,e)}function Jr(e,r){return re(e,r)}var Tt=M("source-imports"),Dt=M("source-exports");function zr(e,r){let t=J(r);return Tt.get(e,t,()=>{let s=V(t);if(!s)return[];let n=Ie(e.config.projectRoot,t);if(!ye(n))return[];let o=Ne(n,"utf-8");return s.parseImports(e,t,o)})}function Fr(e,r){let t=J(r);return Dt.get(e,t,()=>{let s=V(t);if(!s?.parseExports)return[];let n=Ie(e.config.projectRoot,t);if(!ye(n))return[];let o=Ne(n,"utf-8");return s.parseExports(e,t,o)})}export{G as a,At as b,Y as c,Jr as d,zr as e,Fr as f};
|
|
5
|
-
//# sourceMappingURL=chunk-2ZGHRI2A.js.map
|
package/dist/chunk-32R4VYYA.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as b,e as N}from"./chunk-PK4U6NWP.js";import{a as p,b as q,d as A}from"./chunk-WIIZF5FP.js";import{c as M}from"./chunk-KTCODJNQ.js";import{b as h,c as R,f as F,g as k,k as T,m as v}from"./chunk-4X7C236P.js";import{A as P,C as x,e as d,f as y,g as S,l as g,r as L,s as D,u as C,v as I}from"./chunk-QFZE73XF.js";function O(i,e,o){let l=e.identifierResolution==="strict"?p:q;for(let r of e.paths){let s=y(r);if(!s&&!(e.includeVueSfc&&S(r))||i.isIgnored(r)||e.skipPath?.(r))continue;let u=F(i,r);for(let[n,a]of u)for(let f of l(i,r,n))o({sourceFile:r,name:n,target:f,occurrences:a.length,kind:"identifier"});if(e.includeCrossLanguageDispatchNames)for(let n of R(i,r))for(let a of p(i,r,n))o({sourceFile:r,name:n,target:a,occurrences:1,kind:"cross-language-dispatch"});if(e.includeRustAttributeNames&&s==="rust")for(let n of h(i,r))for(let a of l(i,r,n))o({sourceFile:r,name:n,target:a,occurrences:1,kind:"rust-attribute"})}}var E=class{constructor(e){this.db=e}db;scopedDefinitions(e){return x(this.db,e)}definitionsForFile(e){return P(this.db,e)}productionCallableDefinitions(e={}){let{scope:o,minLoc:l=1,maxLoc:r=Number.POSITIVE_INFINITY,excludeSymbol:s,excludeEntrySurfaces:u=!1,excludeTypesFiles:n=!1,requireFunctionLikeSymbol:a=!1,requireCallableSymbol:f=!1,excludeRustTraitImplMembers:V=!1,includeSuppressed:G=!1,sortByLocDesc:K=!1}=e,m=this.scopedDefinitions(o).filter(t=>!this.db.isIgnored(t.relativePath)).filter(t=>!u||!N(this.db,t.relativePath)).filter(t=>B(t,{requireFunctionLikeSymbol:a,requireCallableSymbol:f})).filter(t=>s===void 0||t.symbol!==s).filter(t=>c(t)>=l&&c(t)<=r).filter(t=>!n||!H(t.relativePath)).filter(t=>!V||!C(t.symbol)).filter(t=>b(t.relativePath)!=="test").filter(t=>!I(t.symbol)).filter(t=>G||!d(this.db,t.relativePath,t.startLine));return K?[...m].sort((t,j)=>c(j)-c(t)):m}calleeMap(e,o={}){return T(this.db,e,o)}crossFileCallerMap(e){return v(this.db,e)}sourceFallbackCallerFiles(e){return A(this.db,e)}fileDependencyGraph(e){return k(this.db,e)}fileKind(e){return b(e)}hasSuppressionComment(e){return d(this.db,e.relativePath,e.startLine)}sourceFiles(){return M(this.db)}scanSourceReferences(e,o){O(this.db,e,o)}callableSignature(e){return g(this.db,e.relativePath,e.startLine,e.endLine)}};function c(i){return i.endLine-i.startLine+1}function B(i,e){return e.requireCallableSymbol?L(i.symbol):e.requireFunctionLikeSymbol?D(i.symbol):i.isFunctionLike}function H(i){return(i.split("/").pop()??"").includes("types")}export{E as a};
|
|
2
|
-
//# sourceMappingURL=chunk-32R4VYYA.js.map
|
package/dist/chunk-3UB2DPLP.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as y}from"./chunk-32R4VYYA.js";import{f as g,h,o as m,s as p}from"./chunk-QFZE73XF.js";function x(n,e,s,o){let r=g(e);if(!r)return!0;let i=h(n,e);if(!i)return!0;let a=b.get(i);return a||(a=L(i,r),b.set(i,a)),a.get(`${s}:${o}`)??!0}var b=new WeakMap;function L(n,e){let s=e==="rust"?new Set(["function_item","function_signature_item"]):e==="python"?new Set(["function_definition"]):new Set(["function_declaration","method_definition","arrow_function","function_expression"]),o=new Map,r=i=>{s.has(i.type)&&o.set(`${i.startPosition.row}:${i.endPosition.row}`,S(i,e));for(let a of i.children)r(a)};return r(n.rootNode),o}function S(n,e){let s=n.namedChildren.find(t=>t.type==="block"||t.type==="statement_block");if(!s)return!1;let o=s.namedChildren.filter(t=>t.type!=="comment"&&t.type!=="line_comment"&&t.type!=="block_comment");if(o.length!==1)return!1;let r=o[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 f=i.namedChildren.find(t=>t.type==="arguments"||t.type==="argument_list");if(!f)return!1;let c=f.namedChildren.filter(t=>t.type!=="comment"),u=n.namedChildren.find(t=>t.type==="parameters"||t.type==="formal_parameters");if(!u)return!1;let l=[];for(let t of u.namedChildren)if(t.type==="identifier")l.push(t.text);else{let d=t.namedChildren.find(C=>C.type==="identifier");d&&l.push(d.text)}if(c.length!==l.length)return!1;for(let t=0;t<l.length;t+=1){let d=c[t];if(d.type!=="identifier"||d.text!==l[t])return!1}return!0}function k(n,e){let{scope:s,maxLoc:o=15,limit:r=30}=e??{},i=new y(n),a=w(i,s,o),f=i.calleeMap(a),c=[];for(let u of a){let l=_(n,u,f.get(u.symbolId)??[]);l&&c.push(l)}return c.sort((u,l)=>u.loc-l.loc||u.file.localeCompare(l.file)),c.slice(0,r)}function _(n,e,s){let o=P(s);if(o.size!==1||!x(n,e.relativePath,e.startLine,e.endLine))return null;let[,r]=[...o.entries()][0];return{symbol:e.symbol,shortName:m(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:D(e),forwardsTo:r.symbol,forwardsToShort:m(r.symbol),forwardsToFile:r.file}}function P(n){let e=n.some(o=>p(o.symbol))?n.filter(o=>p(o.symbol)):n,s=new Map;for(let o of e)s.has(o.symbol)||s.set(o.symbol,o);return s}function w(n,e,s){return n.productionCallableDefinitions({scope:e,minLoc:3,maxLoc:s,requireFunctionLikeSymbol:!0,excludeRustTraitImplMembers:!0})}function D(n){return n.endLine-n.startLine+1}export{k as a};
|
|
2
|
-
//# sourceMappingURL=chunk-3UB2DPLP.js.map
|
package/dist/chunk-4X7C236P.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import{a as H,b as $,c as J,e as k}from"./chunk-2ZGHRI2A.js";import{o as B,p as j,q as z}from"./chunk-YU25IHJX.js";import{c as G}from"./chunk-ZHHMG4UC.js";import{A as M,B as N,E as v,a as S,b as x,d as w,f as b,h as L,i as C,k as A,m as P,p as I,r as W}from"./chunk-QFZE73XF.js";var R=new WeakMap;function ft(e,t){let n=b(t);return n==="rust"?fe(e,t):n==="typescript"||n==="tsx"||n==="javascript"?ce(e,t):[]}var le=new Set(["describe","it","test","fdescribe","fit","xdescribe","xit","beforeEach","afterEach","beforeAll","afterAll","before","after","suite","bench","benchmark"]);function ce(e,t){let n=L(e,t);if(!n)return[];let r=R.get(n);if(r)return r;let i=/(^|\/)(pages|app)\/.+\.(tsx?|jsx?)$/.test(t)||/(^|\/)(layout|page|loading|error|not-found|head|template|default)\.(tsx?|jsx?)$/.test(t),s=/(^|\/)src\/(pages|views|routes)\/.+\.(tsx?|jsx?|vue)$/.test(t),o=!1,l=n.rootNode;for(let a of l.namedChildren){if(a.type!=="expression_statement")continue;let u=a.namedChild(0);if(!u||u.type!=="call_expression")continue;let d=u.namedChild(0);if(!d)continue;let f=d.type==="member_expression"?d.namedChild(d.namedChildCount-1)?.text:d.text;if(f&&le.has(f)){o=!0;break}}let c=[];o&&c.push({startLine:0,endLine:l.endPosition.row,reason:"TS/JS test file (describe/it/test at top level)"}),(i||s)&&c.push({startLine:0,endLine:l.endPosition.row,reason:i?"Next.js / Remix route file":"Vite/Vue route component"});for(let a of l.namedChildren){let u=null,d=null;if(a.type==="function_declaration")u=a.namedChild(0)?.text??null,d=a;else if(a.type==="export_statement"){let f=a.namedChild(0);f?.type==="function_declaration"&&(u=f.namedChild(0)?.text??null,d=f)}else if(a.type==="lexical_declaration"){let f=a.namedChild(0);if(f?.type==="variable_declarator"){let g=f.namedChild(0)?.text,m=f.namedChild(1);g&&(m?.type==="arrow_function"||m?.type==="function_expression")&&(u=g,d=f)}}u&&/^use[A-Z]/.test(u)&&d&&c.push({startLine:d.startPosition.row,endLine:d.endPosition.row,reason:"React custom hook (use*)"})}return c.push(...Y(n,new Set(["function_declaration","method_definition","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","variable_declarator","export_statement"]),new Set(["comment"]))),R.set(n,c),c}var ue=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale)?/i;function de(e){return ue.test(e)}function Y(e,t,n){let r=[],i=s=>{if(t.has(s.type)&&s.parent){let l=s.parent.children,c=-1;for(let a=0;a<l.length;a+=1)if(l[a].startIndex===s.startIndex&&l[a].type===s.type){c=a;break}if(c>0)for(let a=c-1;a>=0;a-=1){let u=l[a];if(n.has(u.type)){if(de(u.text)){r.push({startLine:s.startPosition.row,endLine:s.endPosition.row,reason:"scip-query suppression comment"});break}continue}if(!(u.type==="attribute_item"||u.type==="inner_attribute_item"))break}}for(let o of s.namedChildren)i(o)};return i(e.rootNode),r}function fe(e,t){let n=L(e,t);if(!n)return[];let r=R.get(n);if(r)return r;let i=[],s=me(n);return s?(R.set(n,s),s):(K(n.rootNode,i,!1,!1),i.push(...Y(n,new Set(["function_item","function_signature_item","struct_item","enum_item","union_item","impl_item","mod_item","static_item","const_item"]),new Set(["line_comment","block_comment"]))),i.push(...he(n.rootNode)),R.set(n,i),i)}function me(e){return Se(e.rootNode)?[{startLine:0,endLine:e.rootNode.endPosition.row,reason:"generated file (@generated header)"}]:null}function K(e,t,n,r){let i=n,s=r;e.type==="trait_item"&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait declaration body (dynamic dispatch)"}),e.type==="impl_item"&&e.childForFieldName("trait")&&(s=!0,t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl block (dynamic dispatch)"})),e.type==="function_item"||e.type==="function_signature_item"?pe(e,t,n,r):r&&_e(e)?t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl associated item (dynamic dispatch)"}):e.type==="struct_item"||e.type==="enum_item"||e.type==="union_item"?ge(e,t,n):e.type==="mod_item"&&D(e).some(o=>/#\[\s*cfg\s*\(\s*test\s*\)/.test(o))&&(i=!0);for(let o of e.namedChildren)K(o,t,i,s)}function pe(e,t,n,r){let i=D(e),s=null;r?s="trait impl method (dynamic dispatch)":n&&(s="inside #[cfg(test)] mod");for(let o of i){let l=be(o);if(l){s=l;break}if(q(o)){s="#[allow(dead_code)]";break}}s&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:s})}function ge(e,t,n){let r=D(e),i=e.namedChildren.find(s=>s.type==="type_identifier")?.text;r.some(ye)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[derive(<reflective>)] \u2014 fields accessed via macro/reflection",containerName:i}),r.some(q)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[allow(dead_code)]",containerName:i}),n&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"inside #[cfg(test)] mod",containerName:i})}function D(e){let t=e.parent;if(!t)return[];let n=t.children,r=-1;for(let s=0;s<n.length;s+=1)if(n[s].startIndex===e.startIndex&&n[s].type===e.type){r=s;break}if(r<=0)return[];let i=[];for(let s=r-1;s>=0;s-=1){let o=n[s];if(o.type==="attribute_item"||o.type==="inner_attribute_item")i.push(o.text);else{if(o.type==="line_comment"||o.type==="block_comment")continue;break}}return i}function be(e){return/#\[\s*tauri::command\b/.test(e)?"#[tauri::command]":/#\[\s*command\b/.test(e)?"#[command]":/#\[\s*test\b/.test(e)?"#[test]":/#\[\s*bench\b/.test(e)?"#[bench]":/#\[\s*tokio::test\b/.test(e)?"#[tokio::test]":/#\[\s*async_std::test\b/.test(e)?"#[async_std::test]":/#\[\s*wasm_bindgen\b/.test(e)?"#[wasm_bindgen]":/#\[\s*no_mangle\b/.test(e)?"#[no_mangle]":/#\[\s*napi\b/.test(e)?"#[napi]":/#\[\s*pyfunction\b/.test(e)?"#[pyfunction]":/#\[\s*pymethod\b/.test(e)?"#[pymethod]":/#\[\s*pyo3\b/.test(e)?"#[pyo3]":/#\[\s*cfg\s*\(\s*test\s*\)/.test(e)?"#[cfg(test)]":/#\[\s*doc\s*\(\s*hidden\s*\)/.test(e)?"#[doc(hidden)]":null}function ye(e){return/#\[\s*derive\s*\(/.test(e)?/\bSerialize\b/.test(e)||/\bDeserialize\b/.test(e)||/\bFromRow\b/.test(e)||/\bDeriveEntityModel\b/.test(e)||/\bIntoSchema\b/.test(e)||/\bToSchema\b/.test(e)||/\bDeriveValueType\b/.test(e)||/\bsqlx::FromRow\b/.test(e)||/\bError\b/.test(e)||/\bthiserror::Error\b/.test(e):!1}function q(e){return/#\[\s*allow\s*\(\s*dead_code\s*\)/.test(e)}function _e(e){return e.type==="const_item"||e.type==="type_item"||e.type==="static_item"||e.type==="associated_type"}function he(e){let t=Ie(e);if(t.size===0)return[];let n=[];for(let r of e.descendantsOfType("mod_item")){let i=r.childForFieldName("name")?.text;i&&t.has(i)&&n.push({startLine:r.startPosition.row,endLine:r.endPosition.row,reason:'serde `with = "..."` module \u2014 body invoked via reflection',containerName:i})}return n}function Se(e){for(let t=0;t<Math.min(e.namedChildCount,12);t+=1){let n=e.namedChild(t);if(!n||n.type!=="line_comment"&&n.type!=="block_comment")break;if(/@generated\b/.test(n.text)||/This file is .*generated\b/i.test(n.text)||/Code generated by/i.test(n.text)||/Generated by:\s*https?:\/\/openapi-generator/i.test(n.text)||/openapi-generator/i.test(n.text)&&/Generated by/i.test(n.text))return!0}return!1}var Ee=[{key:"default",re:/\bdefault\s*=\s*"([^"]+)"/g},{key:"with",re:/\bwith\s*=\s*"([^"]+)"/g},{key:"serialize_with",re:/\bserialize_with\s*=\s*"([^"]+)"/g},{key:"deserialize_with",re:/\bdeserialize_with\s*=\s*"([^"]+)"/g},{key:"skip_serializing_if",re:/\bskip_serializing_if\s*=\s*"([^"]+)"/g},{key:"getter",re:/\bgetter\s*=\s*"([^"]+)"/g},{key:"rename_all_with",re:/\brename_all_with\s*=\s*"([^"]+)"/g},{key:"schema_with",re:/\bschema_with\s*=\s*"([^"]+)"/g}],Z=/^#!?\[\s*serde\s*\(/,Le=/^#!?\[\s*schemars\s*\(/,Re=/^#!?\[\s*validate\s*\(/,U=/\bwith\s*=\s*"([^"]+)"/g;function X(e,t){return A(e,t,Ce,()=>new Set,(n,r,i)=>{if(r==="rust"){for(let s of n.rootNode.descendantsOfType("attribute_item"))V(s.text,i);for(let s of n.rootNode.descendantsOfType("inner_attribute_item"))V(s.text,i)}})??new Set}var Ce=new WeakMap;function V(e,t){let n=Z.test(e),r=Le.test(e),i=Re.test(e);if(!(!n&&!r&&!i))for(let{re:s}of Ee){s.lastIndex=0;let o;for(;(o=s.exec(e))!==null;){let l=o[1],c=l.split("::").pop()??l;c==="is_none"&&/\bOption\b/.test(l)||c==="is_empty"&&/\b(String|Vec|HashMap|BTreeMap|HashSet|BTreeSet)\b/.test(l)||c&&t.add(c)}}}function Ie(e){let t=new Set;for(let n of e.descendantsOfType("attribute_item")){if(!Z.test(n.text))continue;U.lastIndex=0;let r;for(;(r=U.exec(n.text))!==null;){let i=r[1],s=i.split("::").pop()??i;s&&t.add(s)}}return t}var xe=new Set(["invoke","invokeTauriCommand","listen","once","emit","subscribe","dispatch","sendCommand","callRust"]);function mt(e,t){return A(e,t,we,()=>new Set,(n,r,i)=>{if(!(r!=="typescript"&&r!=="tsx"&&r!=="javascript"))for(let s of n.rootNode.descendantsOfType("call_expression")){let o=s.namedChild(0);if(!o)continue;let l=P(o);if(!l||!xe.has(l))continue;let c=s.namedChildren.find(d=>d.type==="arguments");if(!c)continue;let a=c.namedChild(0);if(!a||a.type!=="string")continue;let u=a.namedChildren.find(d=>d.type==="string_fragment");u&&i.add(u.text)}})??new Set}var we=new WeakMap;function ee(e,t,n,r={}){if(!n)return[];let i=w(e,t);if(!i)return[];if(i.indexOf(n)===-1)return[];if(b(t))return(O(e,t).get(n)??[]).filter(u=>!Q(u,r));let s=$(e,t,i),o=new RegExp(`\\b${J(n)}\\b`),l=[];for(let c=0;c<s.length;c++)Q(c,r)||o.test(s[c]??"")&&l.push(c);return l}function Q(e,t){return typeof t.excludeStartLine=="number"&&typeof t.excludeEndLine=="number"&&e>=t.excludeStartLine&&e<=t.excludeEndLine}var Ae=S("file-identifiers");function ht(e,t){return Ae.get(e,t,()=>new Set(O(e,t).keys()))}var ke=S("file-ident-lines");function O(e,t){return ke.get(e,t,()=>Ne(e,t))}var Me=S("file-idents-by-line");function te(e,t){return Me.get(e,t,()=>{let n=O(e,t),r=0;for(let s of n.values()){let o=s[s.length-1];o!==void 0&&o>r&&(r=o)}let i=new Array(r+1);for(let s=0;s<=r;s+=1)i[s]=new Set;for(let[s,o]of n)for(let l of o)i[l].add(s);return i})}function Ne(e,t){let n=new Map,r=(l,c)=>{let a=n.get(l);if(!a){n.set(l,[c]);return}a[a.length-1]!==c&&a.push(c)};if(b(t)){let l=L(e,t);if(l){let c=b(t),a=c==="rust"?new Set(["identifier","type_identifier","field_identifier"]):c==="python"?new Set(["identifier"]):new Set(["identifier","property_identifier","type_identifier"]),u=new Set(["rust","python"]),d=/\{([^{}]*)\}/g,f=/\b([A-Za-z_][\w]*)\b/g,g=m=>{if(a.has(m.type)&&r(m.text,m.startPosition.row),c&&u.has(c)&&m.type==="string_content"){let p=m.startPosition.row;for(let y of m.text.matchAll(d)){let E=y[1]??"";for(let _ of E.matchAll(f))_[1]&&r(_[1],p)}}for(let p of m.children)g(p)};return g(l.rootNode),n}}let i=w(e,t);if(!i)return n;let s=H(i).split(/\r?\n/),o=/\b([A-Za-z_$][\w$]*)\b/g;for(let l=0;l<s.length;l+=1){let c=s[l]??"";for(let a of c.matchAll(o))a[1]&&r(a[1],l)}return n}var ve=S("file-dep-graph");function Mt(e,t){return ve.get(e,t??"",()=>{let n=new Map,r=Oe(e),i=(s,o)=>Fe(e,n,r,s,o);for(let s of De(e,t))i(s.from_file,s.to_file);for(let s of r)if(!(t&&!s.includes(t)))for(let o of k(e,s))o.sourcePath&&i(s,o.sourcePath);return n})}function De(e,t){let n=t?`AND d1.relative_path LIKE '%${t}%'`:"";return e.all(`SELECT DISTINCT
|
|
2
|
-
d1.relative_path AS from_file,
|
|
3
|
-
d2.relative_path AS to_file
|
|
4
|
-
FROM mentions m
|
|
5
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
6
|
-
JOIN documents d1 ON c.document_id = d1.id
|
|
7
|
-
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
8
|
-
JOIN (
|
|
9
|
-
SELECT m2.symbol_id, c2.document_id
|
|
10
|
-
FROM mentions m2
|
|
11
|
-
JOIN chunks c2 ON m2.chunk_id = c2.id
|
|
12
|
-
WHERE m2.role = 1
|
|
13
|
-
GROUP BY m2.symbol_id
|
|
14
|
-
) sym_def ON sym_def.symbol_id = gs.id
|
|
15
|
-
JOIN documents d2 ON sym_def.document_id = d2.id
|
|
16
|
-
WHERE d1.id != d2.id
|
|
17
|
-
AND m.role != 1
|
|
18
|
-
${e.pathExclusionsFor("d1","d2")}
|
|
19
|
-
${n}`)}function Oe(e){return new Set(e.all(`SELECT relative_path
|
|
20
|
-
FROM documents
|
|
21
|
-
WHERE 1 = 1
|
|
22
|
-
${e.pathExclusionsFor("documents")}
|
|
23
|
-
ORDER BY relative_path`).map(t=>t.relative_path).filter(t=>!e.isIgnored(t)))}function Fe(e,t,n,r,i){if(r===i||e.isIgnored(r)||e.isIgnored(i)||!n.has(i))return;let s=t.get(r);s||(s=new Set,t.set(r,s)),s.add(i)}function Nt(e,t,n={}){let r=ie(e,[t],{additive:n.additive}),i=n.callableOnly?(r.get(t.symbolId)??[]).filter(s=>W(s.symbol)):r.get(t.symbolId)??[];return typeof n.limit=="number"?i.slice(0,n.limit):i}function vt(e,t,n={}){let r=He(e)?Je(e,t):$e(e).get(t.symbolId)??[];return typeof n.limit=="number"?r.slice(0,n.limit):r}var Te=x("caller-rows"),Pe=2e4;function He(e){return(e.get("SELECT COUNT(*) AS count FROM global_symbols")?.count??0)>Pe}function $e(e){return Te.get(e,()=>{let t=N(e),n=ie(e,t),r=new Map;for(let o of t)r.set(o.symbol,o.symbolId);let i=new Map,s=new Map;for(let o of t){let l=n.get(o.symbolId);if(!(!l||l.length===0))for(let c of l){let a=r.get(c.symbol);if(a===void 0||a===o.symbolId)continue;let u=i.get(a);u||(u=[],i.set(a,u),s.set(a,new Set));let d=`${o.symbol}|${o.relativePath}`;s.get(a).has(d)||(s.get(a).add(d),u.push({symbol:o.symbol,file:o.relativePath}))}}return i})}function Je(e,t){let n=[],r=new Set,i=o=>{if(o.symbol===t.symbol)return;let l=`${o.symbol}|${o.file}`;r.has(l)||(r.add(l),n.push(o))};for(let o of Ge(e,t))o.file!==t.relativePath&&i({symbol:o.enclosingSymbol??o.file,file:o.file});let s=We(e,t);if(s)for(let o of B(e,s)){if(o.file===t.relativePath||e.isIgnored(o.file))continue;let l=v(M(e,o.file),o.line);i({symbol:l?.symbol??o.file,file:o.file})}return n}function We(e,t){return e.get(`SELECT
|
|
24
|
-
d.id AS documentId,
|
|
25
|
-
gs.id AS symbolId,
|
|
26
|
-
gs.symbol,
|
|
27
|
-
d.relative_path AS relativePath,
|
|
28
|
-
COALESCE(der.start_line, c.start_line) AS startLine,
|
|
29
|
-
COALESCE(der.end_line, c.end_line) AS endLine,
|
|
30
|
-
COALESCE(gs.display_name, '') AS leaf,
|
|
31
|
-
NULL AS parentTypeName,
|
|
32
|
-
CASE WHEN gs.kind IN (6, 12, 13) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
|
|
33
|
-
CASE WHEN gs.kind IN (5, 8, 11) THEN 1 ELSE 0 END AS isTypeLike,
|
|
34
|
-
gs.kind AS kind,
|
|
35
|
-
gs.documentation AS documentation,
|
|
36
|
-
gs.enclosing_symbol AS enclosingSymbol
|
|
37
|
-
FROM global_symbols gs
|
|
38
|
-
LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
39
|
-
LEFT JOIN chunks c ON c.document_id = der.document_id
|
|
40
|
-
JOIN documents d ON d.id = COALESCE(der.document_id, c.document_id)
|
|
41
|
-
WHERE gs.id = ?
|
|
42
|
-
LIMIT 1`,t.symbolId)??null}function Ge(e,t){let n=Ve(e,t);return n?Ye(e,Be(e,n.match,n.identifier)):[]}function Be(e,t,n){let r=new Map;for(let[i,s]of je(e,t.symbolId))r.set(i,ze(e,i,s,t,n));return r}function je(e,t){let n=new Map,r=e.all(`SELECT DISTINCT d.relative_path, c.start_line, c.end_line
|
|
43
|
-
FROM mentions m
|
|
44
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
45
|
-
JOIN documents d ON c.document_id = d.id
|
|
46
|
-
WHERE m.symbol_id = ?
|
|
47
|
-
AND m.role != 1
|
|
48
|
-
${e.pathExclusionsFor("d")}
|
|
49
|
-
ORDER BY d.relative_path, c.start_line`,t);for(let i of r){if(e.isIgnored(i.relative_path))continue;let s=n.get(i.relative_path);s||(s=[],n.set(i.relative_path,s)),s.push({start_line:i.start_line,end_line:i.end_line})}return n}function ze(e,t,n,r,i){let s=t===r.relativePath?{excludeStartLine:r.startLine,excludeEndLine:r.endLine}:{},o=i?ee(e,t,i,s):[];return n.flatMap(l=>Ue(o,l))}function Ue(e,t){let n=e.filter(r=>r>=t.start_line&&r<=t.end_line);return n.length>0?n:[t.start_line]}function Ve(e,t){let n=G(e,t);return n?{match:n,identifier:I(n.symbol)||null}:null}function Ye(e,t){let n=[],r=new Set;for(let[i,s]of t){let o=M(e,i);for(let l of s){let c=v(o,l),a=`${i}|${l}|${c?.symbol??""}`;r.has(a)||(r.add(a),n.push({file:i,line:l,enclosingSymbol:c?.symbol??null}))}}return n}function ie(e,t,n={}){if(t.length===0)return new Map;let r=n.additive??!1,i=[],s=[];for(let a of t)b(a.relativePath)&&C(e,a.relativePath)!==null?i.push(a):s.push(a);let o=new Map,l=a=>{for(let[u,d]of a){let f=o.get(u);f||(f=[],o.set(u,f));let g=new Set(f.map(m=>`${m.symbol}|${m.chunkId}`));for(let m of d){let p=`${m.symbol}|${m.chunkId}`;g.has(p)||(g.add(p),f.push(m))}}};i.length>0&&l(Ke(e,i)),l(ct(z(e,t)));let c=r?t:s;return c.length>0&&l(tt(e,c)),o}function Ke(e,t){let n=new Map,r=qe(t,n),i=oe(e);for(let[s,o]of r){let l=C(e,s);if(l)for(let c of l){let a=Ze(o,c.line);if(!a)continue;let u=Xe(e,s,i,c.calleeLeaf,c.memberAccess);u&&u.symbol!==a.symbol&&n.get(a.symbolId).push({symbol:u.symbol,file:u.file,chunkId:c.line})}}return n}function qe(e,t){let n=new Map;for(let r of e){let i=n.get(r.relativePath);i?i.push(r):n.set(r.relativePath,[r]),t.set(r.symbolId,[])}for(let r of n.values())r.sort((i,s)=>i.endLine-i.startLine-(s.endLine-s.startLine));return n}function Ze(e,t){return e.find(n=>t>=n.startLine&&t<=n.endLine)??null}function Xe(e,t,n,r,i){let s=se(t,n.get(r)??[]);return s.length===0?null:re(e,t,s,i)}function se(e,t){let n=ne(e);return n?t.filter(r=>ne(r.file)===n):t}function re(e,t,n,r){let i=n.find(s=>s.file===t);if(i)return i;if(r){let s=new Set(k(e,t).map(o=>o.sourcePath).filter(o=>!!o));return n.find(o=>[...s].some(l=>Qe(l,o.file)))??null}return n.length===1?n[0]:null}function Qe(e,t){let n=r=>r.replace(/\\/g,"/").replace(/^\.\//,"");return n(e)===n(t)}function ne(e){let t=b(e);return t?t==="typescript"||t==="tsx"||t==="javascript"?"javascript-family":t:null}var et=x("global-leaf-index");function oe(e){return et.get(e,()=>{let t=e.all(`SELECT gs.id, gs.symbol,
|
|
50
|
-
COALESCE(der_doc.relative_path, mention_doc.relative_path) AS relative_path
|
|
51
|
-
FROM global_symbols gs
|
|
52
|
-
LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
53
|
-
LEFT JOIN documents der_doc ON der_doc.id = der.document_id
|
|
54
|
-
LEFT JOIN (
|
|
55
|
-
SELECT m.symbol_id, MIN(d.relative_path) AS relative_path
|
|
56
|
-
FROM mentions m
|
|
57
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
58
|
-
JOIN documents d ON c.document_id = d.id
|
|
59
|
-
WHERE m.role = 1
|
|
60
|
-
GROUP BY m.symbol_id
|
|
61
|
-
) mention_doc ON mention_doc.symbol_id = gs.id
|
|
62
|
-
WHERE 1 = 1
|
|
63
|
-
${e.symbolNoiseFor("gs")}`),n=new Map;for(let r of t){if(!r.relative_path||e.isIgnored(r.relative_path))continue;let i=I(r.symbol);if(!i)continue;let s=n.get(i);s||(s=[],n.set(i,s)),s.some(o=>o.symbolId===r.id)||s.push({symbol:r.symbol,symbolId:r.id,file:r.relative_path})}return n})}function tt(e,t){if(t.length===0)return new Map;let n=e.all(`SELECT c.document_id, c.id AS chunk_id, c.start_line, c.end_line, m.symbol_id
|
|
64
|
-
FROM mentions m
|
|
65
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
66
|
-
WHERE m.role != 1`),r=new Map;for(let a of n)r.has(a.document_id)||r.set(a.document_id,[]),r.get(a.document_id).push(a);let i=new Map(e.all("SELECT id, relative_path FROM documents").map(a=>[a.id,a.relative_path])),s=new Map,o=e.all(`SELECT gs.id AS symbol_id, gs.symbol,
|
|
67
|
-
COALESCE(der.document_id, def_chunk.document_id) AS document_id
|
|
68
|
-
FROM global_symbols gs
|
|
69
|
-
LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
70
|
-
LEFT JOIN (
|
|
71
|
-
SELECT m.symbol_id, MIN(c.document_id) AS document_id
|
|
72
|
-
FROM mentions m
|
|
73
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
74
|
-
WHERE m.role = 1
|
|
75
|
-
GROUP BY m.symbol_id
|
|
76
|
-
) def_chunk ON def_chunk.symbol_id = gs.id`);for(let a of o)s.has(a.symbol_id)||s.set(a.symbol_id,{symbol:a.symbol,file:a.document_id!==null?i.get(a.document_id)??"":""});let l=new Map,c=i;for(let a of t){let u=r.get(a.documentId)??[],d=new Set,f=[],g=null,m=()=>{if(g)return g;let p=c.get(a.documentId)??"",y=new Set;if(p){let E=te(e,p),_=Math.max(0,a.startLine),T=Math.min(E.length-1,a.endLine);for(let h=_;h<=T;h+=1)for(let ae of E[h])y.add(ae)}return g=y,y};for(let p of u){if(p.symbol_id===a.symbolId)continue;let y=s.get(p.symbol_id);if(!y)continue;if(!(p.start_line>=a.startLine&&p.end_line<=a.endLine)){if(!(p.start_line<=a.endLine&&p.end_line>=a.startLine))continue;let h=I(y.symbol);if(!h||!m().has(h))continue}let _=`${y.symbol}|${p.chunk_id}`;d.has(_)||(d.add(_),f.push({...y,chunkId:p.chunk_id}))}l.set(a.symbolId,f)}return l}function Dt(e,t){let n=new Map,r=e.all(`SELECT relative_path FROM documents
|
|
77
|
-
WHERE 1 = 1 ${e.pathExclusionsFor("documents")}`),i=oe(e),s=t??N(e);return nt(e,n,r,i),it(e,n,s),at(e,n,r,i),ut(n,j(e,lt(s))),n}function nt(e,t,n,r){for(let i of n){if(!b(i.relative_path)||e.isIgnored(i.relative_path))continue;let s=C(e,i.relative_path);if(s)for(let o of s){let l=se(i.relative_path,r.get(o.calleeLeaf)??[]);if(!l||l.length===0)continue;let c=re(e,i.relative_path,l,o.memberAccess);c&&c.file!==i.relative_path&&F(t,c.symbolId,i.relative_path)}}}function it(e,t,n){let r=rt(n);for(let i of st(e))e.isIgnored(i.relative_path)||ot(i,r.get(i.symbol_id))||F(t,i.symbol_id,i.relative_path)}function st(e){return e.all(`SELECT DISTINCT m.symbol_id, d.relative_path, c.document_id,
|
|
78
|
-
c.start_line AS chunk_start, c.end_line AS chunk_end
|
|
79
|
-
FROM mentions m
|
|
80
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
81
|
-
JOIN documents d ON c.document_id = d.id
|
|
82
|
-
WHERE m.role != 1
|
|
83
|
-
${e.pathExclusionsFor("d")}`)}function rt(e){let t=new Map;for(let n of e)t.set(n.symbolId,{docId:n.documentId,startLine:n.startLine,endLine:n.endLine});return t}function ot(e,t){return!!t&&t.docId===e.document_id&&e.chunk_start>=t.startLine&&e.chunk_end<=t.endLine}function at(e,t,n,r){for(let i of n){if(e.isIgnored(i.relative_path)||b(i.relative_path)!=="rust")continue;let s=X(e,i.relative_path);if(s.size!==0)for(let o of s){let l=r.get(o);if(l)for(let c of l)c.file!==i.relative_path&&F(t,c.symbolId,i.relative_path)}}}function F(e,t,n){let r=e.get(t);r||(r=new Set,e.set(t,r)),r.add(n)}function lt(e){return e.filter(t=>"relativePath"in t&&"symbol"in t&&"leaf"in t)}function ct(e){let t=new Map;for(let[n,r]of e)t.set(n,r.map(i=>({...i,chunkId:-1})));return t}function ut(e,t){for(let[n,r]of t){let i=e.get(n);i||(i=new Set,e.set(n,i));for(let s of r)i.add(s)}}export{ft as a,X as b,mt as c,ee as d,ht as e,O as f,Mt as g,Nt as h,vt as i,Ge as j,ie as k,oe as l,Dt as m};
|
|
84
|
-
//# sourceMappingURL=chunk-4X7C236P.js.map
|
package/dist/chunk-A5UNS4DR.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{c as S}from"./chunk-WIIZF5FP.js";import{j as d}from"./chunk-4X7C236P.js";import{a as f}from"./chunk-ZHHMG4UC.js";import{d as a,o as s,s as u,y as m,z as g}from"./chunk-QFZE73XF.js";function _(n,o){let e=f(n,o);if(!e)return{definitions:[],referencedBy:[]};let i=n.get("SELECT display_name, documentation FROM global_symbols WHERE id = ?",e.symbolId),t=g(i?.documentation??null),c=n.isIgnored(e.relativePath)?[]:[{relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,signature:b(t,i?.display_name??null,e.symbol),source:y(n,e.relativePath,e.startLine,e.endLine)}],l=S(n,e),p=(l.length>0?l:d(n,e)).filter(r=>!n.isIgnored(r.file)).map(r=>({relativePath:r.file,line:r.line,enclosingSymbol:r.enclosingSymbol,enclosingShort:r.enclosingSymbol?s(r.enclosingSymbol):"(top-level)"}));return{definitions:c,referencedBy:p}}function y(n,o,e,i){let t=a(n,o);if(!t)return null;let l=t.split(`
|
|
2
|
-
`).slice(e,i+1).join(`
|
|
3
|
-
`).trimEnd();return l.length>0?l:null}function b(n,o,e){let i=m(n);if(i&&!h(i))return i;let t=(o??"").trim();return t?u(e)&&!t.endsWith("()")?`${t}()`:t:s(e)}function h(n){return n.startsWith("undefined")||n.includes("|")||n.includes("```")}export{_ as a};
|
|
4
|
-
//# sourceMappingURL=chunk-A5UNS4DR.js.map
|
package/dist/chunk-FG6A6ZUP.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as d}from"./chunk-QRYEOK3M.js";import{a as g}from"./chunk-K6H3XJQW.js";import{b as R}from"./chunk-PBFMZKXE.js";import{a as x}from"./chunk-FVVEIGP3.js";import{a as f}from"./chunk-MTK3JAJT.js";import{a as S}from"./chunk-3UB2DPLP.js";import{a as y}from"./chunk-FHSD5RKF.js";import{a as C}from"./chunk-IJWIYZO5.js";import{a as h}from"./chunk-EB5IVUNU.js";import{a as p}from"./chunk-MO32JMOD.js";import{a as b}from"./chunk-WNMAH3P7.js";import{e as c,f as m}from"./chunk-PK4U6NWP.js";var H=50;function _(e,t={}){let r=v(e,t.scope),u=L(e,r),o=I(r,u);return{score:A(r,u),overview:{documents:r.statsResult.documents,symbols:r.statsResult.symbols,indexSizeBytes:r.statsResult.indexSizeBytes},findings:{deadSymbols:u.trueDeadCount,deadLoc:u.trueDeadLoc,isolatedSymbols:u.trueIsolatedCount,isolatedLoc:u.trueIsolatedLoc,cycles:u.realCycleCount,similarPairs:u.trueSimilarCount,extractionCandidates:r.extractResult.length,wrappers:r.wrapperResult.length,passthroughs:r.passthroughResult.length,staleTypes:u.trueStaleCount,driftedFiles:u.trueDriftCount,complexityHotspotCount:w(r)},actions:o,topComplexity:r.complexResult.slice(0,5).map(l=>({symbol:l.shortName,score:l.score}))}}function v(e,t){return{statsResult:d(e),deadResult:p(e,{scope:t,minLoc:3,skipBarrels:!0}),isolatedResult:f(e,{scope:t,minLoc:3}),cycleResult:h(e,{scope:t}),similarResult:R(e,{scope:t,minSimilarity:.6,limit:50,minCallees:4}),extractResult:C(e,{scope:t,minLoc:15,minCallees:5,limit:50}),wrapperResult:g(e,{scope:t,maxLoc:15,limit:50}),passthroughResult:S(e,{scope:t,maxLoc:15,limit:50}),staleResult:x(e,{scope:t,minLoc:3,limit:50}),driftResult:y(e,{scope:t}),complexResult:b(e,{scope:t,minLoc:10,limit:10})}}function L(e,t){let r=t.deadResult.symbols.filter(o=>!c(e,o.relativePath)&&!m(e,o.symbol,o.relativePath)&&o.kind==="dead-code"),u=t.isolatedResult.filter(o=>!c(e,o.relativePath)&&!m(e,o.symbol,o.relativePath));return{trueDeadCount:r.length,trueDeadLoc:r.reduce((o,i)=>o+i.loc,0),trueIsolatedCount:u.length,trueIsolatedLoc:u.reduce((o,i)=>o+i.loc,0),trueStaleCount:t.staleResult.length,trueDriftCount:t.driftResult.unusedImports+t.driftResult.layerViolations,trueSimilarCount:t.similarResult.length,realCycleCount:t.cycleResult.filter(o=>o.kind==="real").length}}function I(e,t){let r=[];if(t.trueDeadCount>0&&r.push({category:"Dead code",description:`${t.trueDeadCount} symbols with zero references anywhere \u2014 safe to delete`,effort:"low",impact:"high",count:t.trueDeadCount,locRecoverable:t.trueDeadLoc}),t.trueIsolatedCount>0&&r.push({category:"Isolated symbols",description:`${t.trueIsolatedCount} symbols completely disconnected from the codebase graph`,effort:"low",impact:"medium",count:t.trueIsolatedCount,locRecoverable:t.trueIsolatedLoc}),t.realCycleCount>0&&r.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.trueSimilarCount>0&&r.push({category:"Similar functions",description:`${t.trueSimilarCount} pairs with real logic overlap (beyond shared imports) \u2014 consolidation candidates`,effort:"medium",impact:"medium",count:t.trueSimilarCount,locRecoverable:0}),e.extractResult.length>0&&r.push({category:"Extraction candidates",description:`${e.extractResult.length} large functions with isolated callee clusters \u2014 extract method opportunities`,effort:"medium",impact:"medium",count:e.extractResult.length,locRecoverable:0}),e.wrapperResult.length>0&&r.push({category:"Wrapper functions",description:`${e.wrapperResult.length} single-consumer symbols that could be inlined`,effort:"low",impact:"low",count:e.wrapperResult.length,locRecoverable:e.wrapperResult.reduce((i,l)=>i+l.loc,0)}),e.passthroughResult.length>0&&r.push({category:"Passthrough functions",description:`${e.passthroughResult.length} functions that just forward to one callee \u2014 unnecessary indirection`,effort:"low",impact:"low",count:e.passthroughResult.length,locRecoverable:e.passthroughResult.reduce((i,l)=>i+l.loc,0)}),t.trueStaleCount>0){let i=e.staleResult.filter(n=>n.consumers===0).length,l=t.trueStaleCount-i,s=[];i>0&&s.push(`${i} unused`),l>0&&s.push(`${l} single-consumer (not in types file)`),r.push({category:"Stale abstractions",description:`${s.join(", ")} \u2014 premature abstraction`,effort:"low",impact:"medium",count:t.trueStaleCount,locRecoverable:e.staleResult.reduce((n,a)=>n+a.loc,0)})}if(t.trueDriftCount>0){let i=[];e.driftResult.unusedImports>0&&i.push(`${e.driftResult.unusedImports} unused imports`),e.driftResult.layerViolations>0&&i.push(`${e.driftResult.layerViolations} layer violations`),r.push({category:"Structural drift",description:i.join(", "),effort:e.driftResult.layerViolations>0?"medium":"low",impact:e.driftResult.layerViolations>0?"medium":"low",count:t.trueDriftCount,locRecoverable:0})}let u={high:3,medium:2,low:1},o={low:3,medium:2,high:1};return r.sort((i,l)=>{let s=u[i.impact]*o[i.effort];return u[l.impact]*o[l.effort]-s}),r}function A(e,t){let r=Math.max(e.statsResult.documents,1),u=Math.max(e.statsResult.symbols,1),o=100,i=t.trueDeadCount/u;o-=Math.min(20,Math.round(i*200));let l=t.trueIsolatedCount/u;o-=Math.min(10,Math.round(l*200)),o-=Math.min(15,t.realCycleCount*5);let s=t.trueSimilarCount/u*1e3;o-=Math.min(10,Math.round(s));let n=e.extractResult.length/u*1e3;o-=Math.min(5,Math.round(n/2)),o-=Math.min(3,e.wrapperResult.length),o-=Math.min(3,e.passthroughResult.length);let a=t.trueStaleCount/Math.max(u*.1,1);o-=Math.min(8,Math.round(a*10));let M=t.trueDriftCount/r;o-=Math.min(5,Math.round(M*50));let D=w(e);return o-=Math.min(5,D*2),Math.max(0,Math.min(100,o))}function w(e){return e.complexResult.filter(t=>t.score>H).length}export{_ as a};
|
|
2
|
-
//# sourceMappingURL=chunk-FG6A6ZUP.js.map
|
package/dist/chunk-FVVEIGP3.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{a as w}from"./chunk-32R4VYYA.js";import{d as D}from"./chunk-2ZGHRI2A.js";import{a as S,d as p,f as C,h as x,j as I,n as L,o as v,p as d}from"./chunk-QFZE73XF.js";function le(n,e){let{scope:t,minLoc:i=3,maxLoc:s=80,limit:r=30,includeLowConfidence:a=!1}=e??{},o=new w(n),l=o.scopedDefinitions(t),u=K(o,t),f=A(n,o,l,{minLoc:i,maxLoc:s}),m=$(o,f),g=E(n,o,l,f),T=_(f);return B(n,f,m,T).filter(c=>!g.has(c.definition.symbolId)).filter(c=>!c.transitivelyReachable).filter(c=>c.realConsumers.length<=1).filter(c=>!(c.realConsumers.length===0&&c.barrelConsumers>0)).filter(c=>W(c.definition,c.realConsumers.length,u)).map(c=>N(n,c)).filter(c=>a||c.confidence!=="low").sort((c,b)=>{let h={high:0,medium:1,low:2};return h[c.confidence]-h[b.confidence]||b.loc-c.loc||c.file.localeCompare(b.file)||c.startLine-b.startLine}).slice(0,r)}function A(n,e,t,i){return t.filter(s=>s.isTypeLike&&y(s)>=i.minLoc).filter(s=>y(s)<=i.maxLoc).filter(s=>!n.isIgnored(s.relativePath)).filter(s=>!V(s.symbol)).filter(s=>!e.hasSuppressionComment(s))}function $(n,e){return R(n.crossFileCallerMap(e),n.sourceFallbackCallerFiles(e))}function _(n){let e=new Map;for(let t of n){let i=e.get(t.relativePath);i||(i=new Map,e.set(t.relativePath,i));let s=d(t.symbol);s&&i.set(s,t)}return e}function B(n,e,t,i){return e.map(s=>{let a=[...t.get(s.symbolId)??new Set].filter(f=>f!==s.relativePath&&!n.isIgnored(f)),{realConsumers:o,barrelConsumers:l}=G(n,s.relativePath,s.symbol,a),u=Z(n,s,t,i);return{definition:s,realConsumers:o,barrelConsumers:l,transitivelyReachable:u}})}function N(n,e){let t=k(n,e.definition.relativePath,e.definition.startLine),i=P(e.definition.relativePath)?!0:X(n,e.definition),{confidence:s,reason:r}=Y(e.realConsumers.length,t,i);return{symbol:e.definition.symbol,shortName:v(e.definition.symbol),file:e.definition.relativePath,startLine:e.definition.startLine,endLine:e.definition.endLine,loc:y(e.definition),consumers:e.realConsumers.length,barrelConsumers:e.barrelConsumers,kind:t,definerUsesType:i,confidence:s,reason:r}}function E(n,e,t,i){let s=O(n,j(t),i),r=s.map(l=>l.singleton);if(s.length===0)return new Set;let a=R(e.crossFileCallerMap(r),e.sourceFallbackCallerFiles(r)),o=new Set;for(let{singleton:l,classId:u}of s)z(n,l,a)&&o.add(u);return o}function j(n){let e=new Map;for(let t of n){let i=d(t.symbol);i&&e.set(M(t.relativePath,i),t)}return e}function O(n,e,t){let i=[];for(let s of t){let r=U(n,e,s);r&&i.push({singleton:r,classId:s.symbolId})}return i}function U(n,e,t){if(k(n,t.relativePath,t.startLine)!=="class")return null;let i=d(t.symbol);if(!i)return null;let s=H(n,t.relativePath,i);return s?e.get(M(t.relativePath,s))??null:null}function z(n,e,t){let i=d(e.symbol),s=t.get(e.symbolId);return!i||!s?!1:[...s].some(r=>r!==e.relativePath&&!n.isIgnored(r)&&!F(n,r,i))}function M(n,e){return`${n}\0${e}`}function H(n,e,t){let i=p(n,e);if(!i)return null;let s=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\bexport\\s+const\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*new\\s+${s}\\s*\\(`);return i.match(r)?.[1]??null}function K(n,e){return new Set(n.scopedDefinitions(e).filter(t=>t.isFunctionLike).map(t=>t.relativePath))}function V(n){let e=L(n);if("kind"in e)return!1;let t=e.descriptors;if(t.length<2)return!1;let i=t[t.length-1],s=t[t.length-2];return i?.suffix==="type"&&s?.suffix==="type"}function P(n){let t=(n.split("/").pop()??"").replace(/\.[^.]+$/,"");return!!(t==="types"||t==="models"||t==="schema"||t==="common"||t==="protocol"||t==="proto"||t==="dto"||t==="mod"||/(^|\/)types(\/|\.)/.test(n)||/(^|\/)models?(\/|\.)/.test(n)||/(^|\/)proto(?:col)?(\/|\.)/.test(n)||/(^|\/)schema(\/|\.)/.test(n))}function W(n,e,t){return!(P(n.relativePath)&&e>0||e===0&&t.has(n.relativePath))}function G(n,e,t,i){let s=[],r=0,a=d(t);for(let o of i)Q(n,o,e,a)||F(n,o,a)?r++:s.push(o);return{realConsumers:s,barrelConsumers:r}}function Z(n,e,t,i){let s=I(n,e.relativePath),r=d(e.symbol);if(!r)return!1;let a=s.get(r);if(!a||a.size===0)return!1;let o=i.get(e.relativePath);if(!o)return!1;for(let l of a){let u=o.get(l);if(!u)continue;let f=t.get(u.symbolId);if(f){for(let m of f)if(m!==e.relativePath&&!n.isIgnored(m))return!0}}return!1}var q=S("stale-abs-file-usage");function F(n,e,t){if(!t)return!1;let i=C(e);if(!i)return!1;let s=q.get(n,e,()=>J(n,e,i));return s.importedLeaves.has(t)&&!s.usedLeaves.has(t)}function J(n,e,t){let i=new Set,s=new Set,r=x(n,e);if(!r)return{importedLeaves:i,usedLeaves:s};let a=t==="rust"?new Set(["use_declaration"]):t==="python"?new Set(["import_statement","import_from_statement"]):new Set(["import_statement"]),o=(l,u)=>{let f=u||a.has(l.type);(l.type==="identifier"||l.type==="type_identifier"||l.type==="property_identifier"||l.type==="field_identifier")&&(f?i.add(l.text):s.add(l.text));for(let m of l.children)o(m,f)};return o(r.rootNode,!1),{importedLeaves:i,usedLeaves:s}}function Q(n,e,t,i){if(!i)return!1;let s=p(n,e);if(!s)return!1;let r=D(n,e);if(r.length===0)return!1;let a=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`\\b${a}\\b`),l=s.split(`
|
|
2
|
-
`),u=0;for(let f=0;f<l.length;f++){if(!o.test(l[f]??""))continue;if(u++,!r.find(g=>g.startLine<=f&&f<=g.endLine))return!1}return u>0}function k(n,e,t){let i=p(n,e);if(!i)return"other";let s=i.split(`
|
|
3
|
-
`),r=Math.max(0,t-2),a=Math.min(s.length-1,t+2);for(let o=r;o<=a;o++){let u=(s[o]??"").replace(/^\s*\/\/.*$/g,"");if(/\b(?:export\s+)?(?:abstract\s+)?class\s+\w/.test(u))return"class";if(/\b(?:export\s+)?interface\s+\w/.test(u))return"interface";if(/\b(?:export\s+)?type\s+\w/.test(u))return"type";if(/\b(?:export\s+)?(?:const\s+)?enum\s+\w/.test(u))return"enum"}return"other"}function X(n,e){let t=p(n,e.relativePath);if(!t)return!1;let i=d(e.symbol);if(!i)return!1;let s=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\b${s}\\b`),a=t.split(`
|
|
4
|
-
`);for(let o=0;o<a.length;o++)if(!(o>=e.startLine&&o<=e.endLine)&&r.test(a[o]??""))return!0;return!1}function Y(n,e,t){return n===0?{confidence:"high",reason:"unused \u2014 no consumers and defining file has no real usage"}:n===1&&e==="class"?{confidence:"low",reason:"1 consumer + class kind \u2014 likely 1:1 encapsulation, not over-abstraction"}:n===1&&!t?{confidence:"high",reason:"1 consumer + defining file never uses it \u2014 type belongs with its consumer"}:{confidence:"medium",reason:"1 consumer \u2014 single-use abstraction"}}function y(n){return n.endLine-n.startLine+1}function R(...n){let e=new Map;for(let t of n)for(let[i,s]of t){let r=e.get(i);r||(r=new Set,e.set(i,r));for(let a of s)r.add(a)}return e}export{le as a};
|
|
5
|
-
//# sourceMappingURL=chunk-FVVEIGP3.js.map
|
package/dist/chunk-GBDZY73J.js
DELETED
package/dist/chunk-IJWIYZO5.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as g}from"./chunk-32R4VYYA.js";import{o as f}from"./chunk-QFZE73XF.js";function L(e,i={}){let{scope:t,minLoc:o=10,minCallees:r=6,limit:n=20}=i,l=new g(e),s=l.productionCallableDefinitions({scope:t,minLoc:o,excludeTypesFiles:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:!0}),c=l.calleeMap(s),d=[];for(let a of s){let u=m(a,c.get(a.symbolId)??[],r);u&&d.push(u)}return d.sort((a,u)=>u.clusters.length-a.clusters.length||u.loc-a.loc),d.slice(0,n)}function m(e,i,t){let o=new Set(i.map(s=>s.symbol));if(o.size<t)return null;let r=p(o,i),n=h(o,r);if(n.length<2)return null;let l=C(n,r);return l.length===0?null:{symbol:e.symbol,shortName:f(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:b(e),totalCallees:o.size,clusters:l}}function p(e,i){let t=new Map;for(let r of e)t.set(r,new Set);let o=new Map;for(let r of i){let n=o.get(r.chunkId);n||(n=new Set,o.set(r.chunkId,n)),n.add(r.symbol)}for(let r of o.values()){let n=[...r];for(let l=0;l<n.length;l++)for(let s=l+1;s<n.length;s++)t.get(n[l]).add(n[s]),t.get(n[s]).add(n[l])}return t}function h(e,i){let t=new Set,o=[];for(let r of e){if(t.has(r))continue;let n=new Set,l=[r];for(;l.length>0;){let s=l.pop();if(!t.has(s)){t.add(s),n.add(s);for(let c of i.get(s)??[])t.has(c)||l.push(c)}}o.push(n)}return o}function C(e,i){return e.filter(t=>t.size>=3).map(t=>S(t,e,i)).filter(t=>t.isolation>.5).sort((t,o)=>o.isolation-t.isolation)}function S(e,i,t){let o=new Set;for(let s of i)if(s!==e)for(let c of s)o.add(c);let r=0;for(let s of e)for(let c of t.get(s)??[])o.has(c)&&r++;let n=e.size*o.size,l=n>0?1-r/n:1;return{callees:[...e].map(f),isolation:l}}function b(e){return e.endLine-e.startLine+1}export{L as a};
|
|
2
|
-
//# sourceMappingURL=chunk-IJWIYZO5.js.map
|
package/dist/chunk-K6H3XJQW.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{a as M}from"./chunk-32R4VYYA.js";import{f as b}from"./chunk-4X7C236P.js";import{E as C,o as p,p as g,v as I}from"./chunk-QFZE73XF.js";import{basename as c,extname as d}from"path";function R(i,e){let{scope:n,maxLoc:o=15,limit:r=30}=e??{},t=new M(i),a=P(t.fileDependencyGraph(n)),s=x(t,n,o),u=v(t.crossFileCallerMap(s),t.sourceFallbackCallerFiles(s)),m=[];for(let f of s){let l=F(i,t,f,{callerFileMap:u,reverseFanIn:a});l&&m.push(l)}return m.sort((f,l)=>l.callerFanIn-f.callerFanIn||l.loc-f.loc),m.slice(0,r)}function F(i,e,n,o){let r=D(e,n,o.callerFileMap);if(r.length!==1)return null;let t=r[0],a=S(i,n.symbolId,t);if(!a)return null;let s=L(e,i,t,n.symbol,a);if(s&&I(s.symbol))return null;let u=y(o.callerFileMap,o.reverseFanIn,t,s);return u<=3?null:{symbol:n.symbol,shortName:p(n.symbol),file:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:h(n),singleCaller:s?.symbol??"",singleCallerShort:s?.isFunctionLike?p(s.symbol):c(t),callerFanIn:u}}function h(i){return i.endLine-i.startLine+1}function x(i,e,n){return i.productionCallableDefinitions({scope:e,minLoc:2,maxLoc:n,requireFunctionLikeSymbol:!0})}function D(i,e,n){let o=c(e.relativePath,d(e.relativePath));return[...n.get(e.symbolId)??[]].filter(r=>r!==e.relativePath).filter(r=>c(r,d(r))!==o).filter(r=>{let t=i.fileKind(r);return t!=="barrel"&&t!=="entry"&&t!=="test"})}function S(i,e,n){return i.get(`SELECT c.start_line, c.end_line
|
|
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
|
-
WHERE m.symbol_id = ? AND m.role != 1 AND d.relative_path = ?
|
|
6
|
-
LIMIT 1`,e,n)}function L(i,e,n,o,r){let t=i.definitionsForFile(n),a=k(e,n,o,r.start_line,r.end_line);return C(t,a)}function y(i,e,n,o){if(o?.isFunctionLike){let r=[...i.get(o.symbolId)??[]].filter(t=>t!==o.relativePath);if(r.length>0)return r.length}return _(e,n)}function k(i,e,n,o,r){let t=g(n);if(!t)return o;let a=b(i,e).get(t);if(!a||a.length===0)return o;for(let s of a)if(s>=o&&s<=r)return s;return o}function v(...i){let e=new Map;for(let n of i)for(let[o,r]of n){let t=e.get(o);t||(t=new Set,e.set(o,t));for(let a of r)t.add(a)}return e}function P(i){let e=new Map;for(let[n,o]of i){e.has(n)||e.set(n,e.get(n)??0);for(let r of o)e.set(r,(e.get(r)??0)+1)}return e}function _(i,e){let n=i.get(e)??0;if(n>0)return n;let o=c(e,d(e)),r=0;for(let[t,a]of i)t!==e&&c(t,d(t))===o&&a>r&&(r=a);return r}export{R as a};
|
|
7
|
-
//# sourceMappingURL=chunk-K6H3XJQW.js.map
|
package/dist/chunk-KTCODJNQ.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{a as u}from"./chunk-QFZE73XF.js";import{readdirSync as l}from"fs";import{extname as d,join as p}from"path";var x=[".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"],v=[".vue"],S=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo","out","coverage",".scipquery-cache","__pycache__",".venv","venv",".idea",".vscode"]);function _(o,s={}){let i=s.includeIndexed??!0,r=s.includeAuxiliary??!0,t=s.extensions?new Set(s.extensions.map(n=>n.toLowerCase())):new Set(x.map(n=>n.toLowerCase())),c=`${i?"1":"0"}|${r?"1":"0"}|${[...t].sort().join(",")}`;return f.get(o,c,()=>{let n=new Set;if(i){let e=o.all(`SELECT relative_path
|
|
2
|
-
FROM documents
|
|
3
|
-
WHERE 1 = 1
|
|
4
|
-
${o.pathExclusionsFor("documents")}`);for(let a of e)o.isIgnored(a.relative_path)||t.has(d(a.relative_path).toLowerCase())&&n.add(a.relative_path)}if(r)for(let e of g(o.config.projectRoot,t))o.isIgnored(e)||n.add(e);return[...n].sort()})}var f=u("source-files");function g(o,s){let i=new Set,r=t=>{let c=t?p(o,t):o,n;try{n=l(c,{withFileTypes:!0})}catch{return}for(let e of n)if(!S.has(e.name)){if(e.isDirectory()){r(t?`${t}/${e.name}`:e.name);continue}s.has(d(e.name).toLowerCase())&&i.add(t?`${t}/${e.name}`:e.name)}};return r(""),i}export{v as a,S as b,_ as c};
|
|
5
|
-
//# sourceMappingURL=chunk-KTCODJNQ.js.map
|
package/dist/chunk-M5QTG55L.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as w}from"./chunk-32R4VYYA.js";import{i as S}from"./chunk-4X7C236P.js";import{a as g,b as I}from"./chunk-ZHHMG4UC.js";import{E as p,o as h,q as d}from"./chunk-QFZE73XF.js";function $(s,l,r={}){let{maxDepth:y=5,scope:b}=r,m=g(s,l);if(!m)return[];let f=[],c=new Set([m.symbolId]),u=new Set,i=[m];for(let n=1;n<=y&&i.length!==0;n++){let e=[];for(let t of i)for(let o of M(s,t,b)){let a=`${o.file}|${o.shortName}`;if(o.symbolId!==null){if(c.has(o.symbolId))continue;c.add(o.symbolId)}else if(u.has(a))continue;u.add(a),f.push({symbol:o.symbol,shortName:o.shortName,file:o.file,depth:n}),o.symbolId!==null&&o.symbolMatch&&e.push(o.symbolMatch)}i=e}return f.sort((n,e)=>n.depth-e.depth||n.file.localeCompare(e.file)),f}function M(s,l,r){let y=new w(s),b=S(s,l,{limit:500}).filter(e=>!s.isIgnored(e.file)).filter(e=>!r||e.file.includes(r)),m=new Set(b.map(e=>e.file)),f=y.crossFileCallerMap().get(l.symbolId)??new Set,c=[];for(let e of f){if(m.has(e)||s.isIgnored(e)||r&&!e.includes(r))continue;let t=y.definitionsForFile(e),o=t.length>0?p(t,t[0].startLine):null;c.push({symbol:o?.symbol??e,file:e})}let u=[...b,...c],i=[],n=new Set;for(let e of u){let t=I(s,e.symbol);if(!t){let a=`${e.file}|${e.symbol}`;if(n.has(a))continue;n.add(a),i.push({symbolId:null,symbol:e.symbol,shortName:h(e.symbol),file:e.file,symbolMatch:null});continue}if(t.symbolId===l.symbolId||s.isIgnored(t.relativePath)||!R(t.symbol))continue;let o=`${t.symbolId}|${t.relativePath}`;n.has(o)||(n.add(o),i.push({symbolId:t.symbolId,symbol:t.symbol,shortName:h(t.symbol),file:t.relativePath,symbolMatch:t}))}return i}function R(s){let l=d(s);return l==="method"||l==="type"||s.endsWith("().")}export{$ as a};
|
|
2
|
-
//# sourceMappingURL=chunk-M5QTG55L.js.map
|
package/dist/chunk-MTK3JAJT.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as d}from"./chunk-32R4VYYA.js";import{b as m}from"./chunk-4X7C236P.js";import{f as i,o as p,p as u}from"./chunk-QFZE73XF.js";function E(a,y={}){let{scope:b,minLoc:f=3}=y,r=new d(a),s=r.productionCallableDefinitions({scope:b,minLoc:f,excludeEntrySurfaces:!0,excludeRustTraitImplMembers:!0,includeSuppressed:!0}),L=r.crossFileCallerMap(s),h=r.sourceFallbackCallerFiles(s),c=new Set([...L.keys(),...h.keys()]),l=new Map;for(let e of s){let t=u(e.symbol);if(!t)continue;let o=l.get(t)??[];o.push(e.symbolId),l.set(t,o)}let v=a.all(`SELECT relative_path FROM documents WHERE 1 = 1 ${a.pathExclusionsFor("documents")}`);for(let e of v){if(a.isIgnored(e.relative_path)||i(e.relative_path)!=="rust")continue;let t=m(a,e.relative_path);for(let o of t){let n=l.get(o);if(n)for(let M of n)c.add(M)}}let I=new Map(s.map(e=>[e.symbolId,e.symbol])),S=r.calleeMap(s,{additive:!0}),C=new Set([...S.entries()].filter(([e,t])=>{let o=I.get(e);return t.some(n=>n.symbol!==o)}).map(([e])=>e));return s.filter(e=>!c.has(e.symbolId)).filter(e=>!C.has(e.symbolId)).sort((e,t)=>t.endLine-t.startLine-(e.endLine-e.startLine)||e.relativePath.localeCompare(t.relativePath)||e.startLine-t.startLine).map(e=>({symbol:e.symbol,shortName:p(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:e.endLine-e.startLine+1}))}export{E as a};
|
|
2
|
-
//# sourceMappingURL=chunk-MTK3JAJT.js.map
|
package/dist/chunk-PBFMZKXE.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{a as F,b as d,d as R,e as $}from"./chunk-RKTDEIHF.js";import{a as k}from"./chunk-32R4VYYA.js";import{h as B}from"./chunk-4X7C236P.js";import{a as x}from"./chunk-ZHHMG4UC.js";import{d as P,o as p,p as M,s as w,v as q}from"./chunk-QFZE73XF.js";function ne(t,i,e={}){let{minSimilarity:r=.4,limit:a=20}=e,s=V(t,i);if(!s)return[];if(!w(s.symbol))return[];let n=_(t,s,r);return n.length>0?n.slice(0,a):U(t,i,{minSimilarity:r,limit:a})}function _(t,i,e){let r=E(t,{minCallees:3,excludeSymbol:i.symbol}),a=R([i,...r].map(n=>n.callees)),s=[];for(let n of r){if(n.callees.size<3)continue;let l=v(i,n,a,{minSimilarity:e,requireSignificantShared:1,requireSharedCount:0});l&&s.push(l)}return s.sort((n,l)=>l.similarity-n.similarity),s}function v(t,i,e,r){let{similarity:a,significantShared:s}=$(t.callees,i.callees,e);if(a<r.minSimilarity)return null;let n=F(t.callees,i.callees).size;if(s.length<r.requireSignificantShared&&n<r.requireSharedCount)return null;let l=s.length>0?s:[...F(t.callees,i.callees)];return{symbolA:t.symbol,shortNameA:p(t.symbol),fileA:t.file,symbolB:i.symbol,shortNameB:p(i.symbol),fileB:i.file,similarity:a,similarityBasis:"callees",sharedCallees:l.map(p),uniqueToA:[...d(t.callees,i.callees)].map(p),uniqueToB:[...d(i.callees,t.callees)].map(p)}}function re(t,i={}){let{minSimilarity:e=.5,limit:r=20,scope:a,minCallees:s=4,crossFileOnly:n=!1}=i,l=E(t,{minCallees:s,scope:a}),o=R(l.map(c=>c.callees)),u=new Map;for(let c of l)for(let m of c.callees)u.set(m,(u.get(m)??0)+1);let f=Math.max(8,Math.ceil(Math.sqrt(l.length))),S=new Map;for(let c=0;c<l.length;c+=1)for(let m of l[c].callees){if((u.get(m)??0)>f)continue;let g=S.get(m);g||(g=[],S.set(m,g)),g.push(c)}let C=[],A=new Set;e:for(let c=0;c<l.length;c+=1){let m=l[c],g=new Set;for(let D of m.callees){let y=S.get(D);if(y)for(let b of y)b>c&&g.add(b)}for(let D of g){let y=`${c}|${D}`;if(A.has(y))continue;A.add(y);let b=l[D];if(n&&m.file===b.file)continue;if(m.paramCount>=0&&b.paramCount>=0){let j=Math.abs(m.paramCount-b.paramCount),L=Math.max(2,Math.ceil(Math.max(m.paramCount,b.paramCount)*.5));if(j>L)continue}let z=v(m,b,o,{minSimilarity:e,requireSignificantShared:2,requireSharedCount:4});if(z&&(C.push(z),C.length>r*5))break e}}return C.sort((c,m)=>m.similarity-c.similarity),C.slice(0,r)}var O=["ScipDatabase#all","ScipDatabase#get","ScipDatabase#prepare","ScipDatabase#pathExclusionsFor","ScipDatabase#isIgnored","ScipDatabase#symbolNoiseFor","PerDbValue#get","PerDbValue#has",":storage:db:ScipDatabase:all",":storage:db:ScipDatabase:get",":storage:db:ScipDatabase:prepare",":storage:db:ScipDatabase:pathExclusionsFor",":storage:db:ScipDatabase:isIgnored",":storage:db:ScipDatabase:symbolNoiseFor",":storage:per-db-cache:PerDbValue:get",":storage:per-db-cache:PerDbValue:has"];function V(t,i){let e=x(t,i),r=new k(t);if(!e)return null;let a=B(t,e);return{symbol:e.symbol,file:e.relativePath,callees:I(a.map(s=>s.symbol)),paramCount:r.callableSignature(e)?.paramCount??-1}}function E(t,i){let{minCallees:e,scope:r,excludeSymbol:a}=i,s=new k(t),n=s.productionCallableDefinitions({scope:r,minLoc:5,excludeSymbol:a}),l=s.calleeMap(n);return n.map(o=>({symbol:o.symbol,file:o.relativePath,callees:I((l.get(o.symbolId)??[]).map(u=>u.symbol)),paramCount:s.callableSignature(o)?.paramCount??-1})).filter(o=>o.callees.size>=e)}function I(t){return new Set([...t].filter(i=>!Z(i)))}function Z(t){return O.some(i=>t.includes(i))}function U(t,i,e){let r=W(t,i);if(!r||r.tokens.size<3)return[];let a=e.minSimilarity>=.5?e.minSimilarity:.3,s=[];for(let n of G(t)){if(n.symbol===r.symbol||n.tokens.size<3)continue;let l=F(r.tokens,n.tokens);if(l.size<2)continue;let o=new Set([...r.tokens,...n.tokens]),u=o.size>0?l.size/o.size:0;u<a||s.push({symbolA:r.symbol,shortNameA:p(r.symbol),fileA:r.file,symbolB:n.symbol,shortNameB:p(n.symbol),fileB:n.file,similarity:u,similarityBasis:"source-tokens",sharedCallees:[...l].sort(),uniqueToA:[...d(r.tokens,n.tokens)].sort(),uniqueToB:[...d(n.tokens,r.tokens)].sort()})}return s.sort((n,l)=>l.similarity-n.similarity||n.shortNameB.localeCompare(l.shortNameB)),s.slice(0,e.limit)}function W(t,i){let e=x(t,i);if(!e||!w(e.symbol))return null;let r=K(t,e);return r?{symbol:e.symbol,file:e.relativePath,tokens:r}:null}function K(t,i){let e=M(i.symbol),r=N(t,i.relativePath,i.startLine,i.endLine,e),a=T(r,e);return a.size>0?a:null}function G(t){let i=new k(t);return i.scopedDefinitions().filter(e=>e.isFunctionLike).filter(e=>i.fileKind(e.relativePath)!=="test").filter(e=>!q(e.symbol)).map(e=>({symbol:e.symbol,file:e.relativePath,tokens:T(N(t,e.relativePath,e.startLine,e.endLine,e.leaf),e.leaf)})).filter(e=>e.tokens.size>0)}function N(t,i,e,r,a){let s=P(t,i);if(!s)return"";let n=s.split(`
|
|
2
|
-
`);if(r>=e&&r-e<=12)return n.slice(e,r+1).join(`
|
|
3
|
-
`);let l=[new RegExp(`\\bdef\\s+${h(a)}\\b`),new RegExp(`\\bfun\\s+${h(a)}\\b`),new RegExp(`\\bfn\\s+${h(a)}\\b`),new RegExp(`\\bfunction\\s+${h(a)}\\b`),new RegExp(`\\b${h(a)}\\s*\\(`)],o=n.findIndex(u=>l.some(f=>f.test(u)));if(o>=0){let u=o;for(let f=o+1;f<n.length&&f<=o+8;f++){let S=n[f]??"";if(f>o&&J(S)||(u=f,S.trim()===""&&f>o+1))break}return n.slice(o,u+1).join(`
|
|
4
|
-
`)}return n.slice(e,Math.min(n.length,e+8)).join(`
|
|
5
|
-
`)}function T(t,i){if(!t)return new Set;let e=new Set(["public","private","protected","final","static","class","def","fun","fn","function","return","string","bool","boolean","void","unit","self","this","new","const","let","var","end","pub"]),r=H(i),s=t.replace(/["'`]/g," ").replace(/\b\d+\b/g," NUM ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[^A-Za-z0-9_]+/g," ").replace(/_/g," ").toLowerCase().split(/\s+/).map(n=>n.trim()).filter(n=>n.length>1).filter(n=>!e.has(n)).filter(n=>!r.has(n));return new Set(s)}function H(t){return new Set(t.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9_]+|_/).map(i=>i.toLowerCase()).filter(i=>i.length>1))}function J(t){return/^\s*(?:def|fun|fn|function|class|trait|module|object|enum|interface|public|private|protected)\b/.test(t)}function h(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{ne as a,re as b};
|
|
6
|
-
//# sourceMappingURL=chunk-PBFMZKXE.js.map
|
package/dist/chunk-ROWAEEOD.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as c}from"./chunk-32R4VYYA.js";import{h as a,i}from"./chunk-4X7C236P.js";import{o as m}from"./chunk-QFZE73XF.js";function d(o,e={}){let{limit:r=20,scope:s,minFanIn:t=2,minFanOut:p=2}=e;return new c(o).productionCallableDefinitions({scope:s,requireCallableSymbol:!0,includeSuppressed:!0}).map(n=>u(o,n)).filter(n=>n.fanIn>=t&&n.fanOut>=p).sort((n,l)=>l.score-n.score||l.fanIn-n.fanIn).slice(0,r)}function u(o,e){let r=new Set(i(o,e,{limit:500}).map(t=>t.file)).size,s=new Set(a(o,e,{limit:500}).filter(t=>t.file!==e.relativePath).map(t=>`${t.symbol}|${t.file}`)).size;return{symbol:e.symbol,shortName:m(e.symbol),fanIn:r,fanOut:s,score:r*s,definedIn:e.relativePath}}export{d as a};
|
|
2
|
-
//# sourceMappingURL=chunk-ROWAEEOD.js.map
|
package/dist/chunk-WHGCGENP.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import{a as h}from"./chunk-32R4VYYA.js";import{p}from"./chunk-YU25IHJX.js";import{o as u,r as c,t as g}from"./chunk-QFZE73XF.js";import{execFileSync as f}from"child_process";function O(e,t={}){let{base:n="HEAD"}=t,s;try{s=b(e.config.projectRoot,n)}catch{return y("Unable to compute git diff.")}if(s.length===0)return y("No changed files found.");let o=I(e,s);if(o.length===0)return{changedFiles:s,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:s.length,totalChangedSymbols:0,totalAffectedFiles:0,note:"Changed files are not present in the current SCIP index."}};let a=new h(e),l=new Set(o),m=D(a,o),r=[],i=new Map;for(let C of m)_(e,C,o,l,r,i);let d=R(i);return{changedFiles:o,changedSymbols:r,affectedConsumers:d,summary:{totalChangedFiles:o.length,totalChangedSymbols:r.length,totalAffectedFiles:d.length}}}function y(e){return{changedFiles:[],changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:0,totalChangedSymbols:0,totalAffectedFiles:0,note:e}}}function b(e,t){let n=f("git",["diff","--name-only",t],{encoding:"utf-8",cwd:e,timeout:1e4}),s=f("git",["diff","--name-only","--cached",t],{encoding:"utf-8",cwd:e,timeout:1e4}),o=f("git",["ls-files","--others","--exclude-standard"],{encoding:"utf-8",cwd:e,timeout:1e4});return[...new Set([n,s,o].flatMap(a=>a.split(`
|
|
2
|
-
`)).map(a=>a.trim()).filter(a=>a.length>0))]}function I(e,t){let n=[];for(let s of t){let o=e.get(`SELECT relative_path FROM documents
|
|
3
|
-
WHERE relative_path LIKE ?
|
|
4
|
-
LIMIT 1`,`%${s}`);o&&!e.isIgnored(o.relative_path)&&n.push(o.relative_path)}return n}function D(e,t){return t.flatMap(n=>e.definitionsForFile(n)).filter(x).sort((n,s)=>n.relativePath.localeCompare(s.relativePath)||n.startLine-s.startLine)}function _(e,t,n,s,o,a){let l=p(e,[t]).get(t.symbolId)??new Set,m=Math.max(F(e,t.symbolId),l.size);if(!E(t,m))return;let r=u(t.symbol);o.push({symbol:t.symbol,shortName:r,file:t.relativePath,fanIn:m});for(let i of N(e,t.symbolId,n))S(e,s,a,i,r);for(let i of l)S(e,s,a,i,r)}function F(e,t){return e.get(`SELECT COUNT(DISTINCT c.document_id) AS fan_in
|
|
5
|
-
FROM mentions m
|
|
6
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
7
|
-
WHERE m.symbol_id = ?
|
|
8
|
-
AND m.role != 1`,t)?.fan_in??0}function N(e,t,n){return n.length===0?[]:e.all(`SELECT DISTINCT ref_d.relative_path
|
|
9
|
-
FROM mentions m
|
|
10
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
11
|
-
JOIN documents ref_d ON c.document_id = ref_d.id
|
|
12
|
-
WHERE m.symbol_id = ?
|
|
13
|
-
AND m.role != 1
|
|
14
|
-
AND ref_d.relative_path NOT IN (${n.map(()=>"?").join(",")})
|
|
15
|
-
${e.pathExclusionsFor("ref_d")}`,t,...n).map(o=>o.relative_path)}function S(e,t,n,s,o){if(e.isIgnored(s)||t.has(s))return;let a=n.get(s);a||(a=new Set,n.set(s,a)),a.add(o)}function R(e){return[...e.entries()].map(([t,n])=>({file:t,consumedSymbols:n.size})).sort((t,n)=>n.consumedSymbols-t.consumedSymbols)}function x(e){return!(g(e.symbol)||e.parentTypeName!==null&&!c(e.symbol))}function E(e,t){return c(e.symbol)||e.isTypeLike?!0:e.parentTypeName===null&&t>0}export{O as a};
|
|
16
|
-
//# sourceMappingURL=chunk-WHGCGENP.js.map
|
package/dist/chunk-WNMAH3P7.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as m}from"./chunk-32R4VYYA.js";import{o as p}from"./chunk-QFZE73XF.js";function L(s,r){let{scope:l,minLoc:o=10,limit:u=30}=r??{},{definitions:d,callerMap:y,calleeMap:b}=f(s,l);return d.map(e=>{let a=e.endLine-e.startLine+1,n=y.get(e.symbolId)?.size??0,c=b.get(e.symbolId)??[],x=c.filter(t=>t.file!==e.relativePath),i=new Set(x.map(t=>`${t.symbol}|${t.file}`)).size,M=new Set(c.map(t=>`${t.symbol}|${t.file}`)).size;return{symbol:e.symbol,shortName:p(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:a,fanIn:n,fanOut:i,calleeCount:M,score:Math.round(a/50*(n/5)*Math.max(i/5,1)*100)/100}}).filter(e=>e.loc>=o).sort((e,a)=>a.score-e.score||a.loc-e.loc).slice(0,u)}function f(s,r){let l=new m(s),o=l.productionCallableDefinitions({scope:r,requireCallableSymbol:!0,includeSuppressed:!0});return{definitions:o,callerMap:l.crossFileCallerMap(o),calleeMap:l.calleeMap(o)}}export{L as a};
|
|
2
|
-
//# sourceMappingURL=chunk-WNMAH3P7.js.map
|
package/dist/chunk-XV3XUZ3X.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{a as c}from"./chunk-MO65UK5V.js";import{a as m}from"./chunk-32R4VYYA.js";import{p as l}from"./chunk-YU25IHJX.js";import{o as u}from"./chunk-QFZE73XF.js";function C(e,r){let n=c(e,r);if(!n)return null;let t=d(e,n);if(!t||e.isIgnored(t.relative_path))return null;let s=[],i=0;for(let o of p(e,t.relative_path)){let a=h(e,t,o);i+=a,s.push({symbol:o.symbol,shortName:u(o.symbol),startLine:o.startLine,endLine:o.endLine,externalConsumers:a,riskLevel:f(a)})}return{file:t.relative_path,symbols:s,totalExternalConsumers:i}}function d(e,r){return e.get(`SELECT id, relative_path FROM documents
|
|
2
|
-
WHERE relative_path = ?
|
|
3
|
-
${e.pathExclusionsFor("documents")}
|
|
4
|
-
LIMIT 1`,r)??null}function p(e,r){return new m(e).definitionsForFile(r).sort((n,t)=>n.startLine-t.startLine||n.endLine-t.endLine)}function h(e,r,n){let t=e.all(`SELECT DISTINCT consumer_d.relative_path
|
|
5
|
-
FROM mentions m
|
|
6
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
7
|
-
JOIN documents consumer_d ON consumer_d.id = c.document_id
|
|
8
|
-
WHERE m.symbol_id = ?
|
|
9
|
-
AND m.role != 1
|
|
10
|
-
AND c.document_id != ?`,n.symbolId,r.id),s=l(e,[n]).get(n.symbolId)??new Set;return new Set([...t.map(i=>i.relative_path),...[...s].filter(i=>i!==r.relative_path)]).size}function f(e){return e>10?"high":e>0?"medium":"low"}export{C as a};
|
|
11
|
-
//# sourceMappingURL=chunk-XV3XUZ3X.js.map
|