scip-query 0.6.5 → 0.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -6
- package/dist/augment-vue-worker.js +1 -1
- package/dist/{chunk-FG6A6ZUP.js → chunk-25HOGELX.js} +2 -2
- package/dist/{chunk-XV3XUZ3X.js → chunk-2TLYCK2L.js} +2 -2
- package/dist/chunk-3PVIYZ74.js +84 -0
- package/dist/{chunk-MO32JMOD.js → chunk-4TX5IMMK.js} +2 -2
- package/dist/{chunk-3UB2DPLP.js → chunk-6DVA22YE.js} +2 -2
- package/dist/{chunk-C5BFS23M.js → chunk-6GPFHZP3.js} +2 -2
- package/dist/{chunk-YDKWDTAW.js → chunk-7PRMSA4Z.js} +2 -2
- package/dist/{chunk-MTK3JAJT.js → chunk-7YI2M2AQ.js} +2 -2
- package/dist/{chunk-M5QTG55L.js → chunk-AADJ7MCQ.js} +2 -2
- package/dist/{chunk-A5UNS4DR.js → chunk-AV7BOODV.js} +2 -2
- package/dist/{chunk-PBFMZKXE.js → chunk-AXP4H62Q.js} +2 -2
- package/dist/{chunk-IJWIYZO5.js → chunk-C4C3T4K3.js} +2 -2
- package/dist/{chunk-ZFCQQ4B5.js → chunk-CSRPJCWO.js} +2 -2
- package/dist/{chunk-U5MVUPOO.js → chunk-CYJMOTIH.js} +2 -2
- package/dist/{chunk-URUVLDM7.js → chunk-DLWRLPKO.js} +2 -2
- package/dist/{chunk-5YYMKE3G.js → chunk-E2V5SE6M.js} +2 -2
- package/dist/{chunk-FHSD5RKF.js → chunk-GPY33RTH.js} +2 -2
- package/dist/{chunk-PFMGJ4BR.js → chunk-HVNVO6UW.js} +2 -2
- package/dist/{chunk-BNCTPTVX.js → chunk-I377UMS2.js} +2 -2
- package/dist/{chunk-F4KR22Z2.js → chunk-IKQYNTW3.js} +2 -2
- package/dist/{chunk-RT5PV5JQ.js → chunk-IZ4KV37N.js} +2 -2
- package/dist/{chunk-DRLWW74T.js → chunk-KBGFYKOJ.js} +2 -2
- package/dist/chunk-KW2F3WSV.js +5 -0
- package/dist/{chunk-FVVEIGP3.js → chunk-NIN762LD.js} +2 -2
- package/dist/{chunk-YDNCX5PF.js → chunk-O6VBAW7P.js} +2 -2
- package/dist/{chunk-EB5IVUNU.js → chunk-PIRXZGV6.js} +2 -2
- package/dist/{chunk-MKFH7QJG.js → chunk-Q4R2IYA3.js} +2 -2
- package/dist/{chunk-Z5CTXSWT.js → chunk-QFBJZHMV.js} +2 -2
- package/dist/{chunk-WHGCGENP.js → chunk-QPJG6VRT.js} +2 -2
- package/dist/{chunk-HUASU3AD.js → chunk-TBJDUS4E.js} +7 -7
- package/dist/{chunk-K6H3XJQW.js → chunk-TUV2VI7D.js} +2 -2
- package/dist/chunk-UAPNU7UP.js +2 -0
- package/dist/{chunk-WNMAH3P7.js → chunk-URCJTFOD.js} +2 -2
- package/dist/{chunk-QFCK6WV2.js → chunk-UUIWMLDX.js} +2 -2
- package/dist/{chunk-WIIZF5FP.js → chunk-VEXS3I3N.js} +2 -2
- package/dist/{chunk-ROWAEEOD.js → chunk-VRC3WKKE.js} +2 -2
- package/dist/{chunk-5LQ6CVX3.js → chunk-WFDTS7XL.js} +2 -2
- package/dist/chunk-Y4DS3MDC.js +5 -0
- package/dist/{chunk-LT2CPEQ4.js → chunk-YJODB2F5.js} +2 -2
- package/dist/{chunk-PK4U6NWP.js → chunk-YXMHTJYY.js} +2 -2
- package/dist/chunk-Z4AMQWVY.js +90 -0
- package/dist/cli.js +111 -111
- package/dist/index.d.ts +8 -5
- package/dist/index.js +11 -11
- package/dist/queries/affected.js +1 -1
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.js +1 -1
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/drift.js +1 -1
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.js +1 -1
- package/dist/queries/health.js +1 -1
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.js +1 -1
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.js +1 -1
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.js +1 -1
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/surface.js +1 -1
- package/dist/queries/trace.js +1 -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-4X7C236P.js +0 -84
- package/dist/chunk-KTCODJNQ.js +0 -5
- package/dist/chunk-YU25IHJX.js +0 -90
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.6",
|
|
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-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-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-YU25IHJX.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import{A as z,b as B,p as F}from"./chunk-QFZE73XF.js";import f from"path";import{createRequire as $e}from"module";import{existsSync as T,readdirSync as Ue,readFileSync as ie}from"fs";import{existsSync as L}from"fs";import{basename as le,dirname as S,extname as m,join as d,relative as N,resolve as p}from"path";var ue=B("indexed-paths"),D=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue"],M=[".py",".pyi"],Y=[".java",".scala",".kt",".kts"],P=[".rs"],O=[".rb"],G=[".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx"],q=[".cs",".vb"],j=[".dart"],Q=[".php"],pe=[D,M,Y,P,O,G,q,j,Q];function h(n,e){return e.includes(m(n).toLowerCase())}function de(n){return h(n,M)}function fe(n){return h(n,Y)}function ge(n){return h(n,P)}function me(n){return h(n,O)}function Se(n){return h(n,G)}function he(n){return h(n,q)}function gt(n){return m(n).toLowerCase()===".vb"}function ye(n){return h(n,j)}function Ie(n){return h(n,Q)}function xe(n){let e=m(n).toLowerCase();for(let t of pe)if(t.includes(e))return t;return D}function Ee(n){return fe(n)||he(n)||Ie(n)}function A(n,e,t){return de(e)?be(n,e,t):ge(e)?ve(n,e,t):me(e)?ke(n,e,t):Se(e)?Re(n,e,t):Ee(e)?De(n,t.replace(/\\/g,"."),xe(e)):ye(e)?Le(n,e,t):Ne(n,e,t)}function Ne(n,e,t){if(!t.startsWith(".")&&!t.startsWith("/"))return null;let r=S(d(n.config.projectRoot,e)),i=p(r,t),o=b(n);for(let s of Me(i)){let a=I(N(n.config.projectRoot,s));if(o.has(a)||L(s))return a}return I(N(n.config.projectRoot,i))}function be(n,e,t){let r=b(n),i;if(t.startsWith(".")){let o=t.match(/^(\.+)(.*)$/);if(!o)return null;let s=o[1].length,a=o[2].replace(/^\./,""),c=S(d(n.config.projectRoot,e));for(let l=1;l<s;l++)c=S(c);i=a?p(c,a.replace(/\./g,"/")):c}else i=p(n.config.projectRoot,t.replace(/\./g,"/"));for(let o of Te(i)){let s=I(N(n.config.projectRoot,o));if(r.has(s)||L(o))return s}return null}function ve(n,e,t){if(!t)return null;let r=t.replace(/\s+as\s+.+$/,"").trim();if(!r.startsWith("crate::")&&!r.startsWith("self::")&&!r.startsWith("super::"))return null;let i=S(d(n.config.projectRoot,e)),o;return r.startsWith("crate::")?o=p(n.config.projectRoot,"src",r.slice(7).replace(/::/g,"/")):r.startsWith("self::")?o=p(i,r.slice(6).replace(/::/g,"/")):o=p(S(i),r.slice(7).replace(/::/g,"/")),w(n,Ce(o))}function ke(n,e,t){let r=S(d(n.config.projectRoot,e)),i=p(r,t);return w(n,_e(i))}function Re(n,e,t){let r=S(d(n.config.projectRoot,e)),i=[p(r,t),p(n.config.projectRoot,t),p(n.config.projectRoot,"include",t),p(n.config.projectRoot,"src",t)];return w(n,i)}function De(n,e,t){let r=b(n),i=e.replace(/\\/g,".").replace(/::/g,".").replace(/^global::/,""),o=i.replace(/\./g,"/"),s=i.split(".").pop()??i;for(let c of t){let l=`${o}${c}`,g=[...r].find(y=>y.endsWith(l));if(g)return g}for(let c of t){let l=[...r].find(g=>le(g)===`${s}${c}`);if(l)return l}let a=[...r].filter(c=>t.includes(m(c).toLowerCase())).filter(c=>c.includes(`/${o}/`)||c.includes(`/${s}/`)).sort((c,l)=>c.localeCompare(l));return a.length===1?a[0]:null}function Le(n,e,t){let r=b(n);if(t.startsWith("package:")){let s=t.slice(8),a=s.indexOf("/");if(a<0)return null;let c=s.slice(a+1),l=I(c.startsWith("lib/")?c:`lib/${c}`);return r.has(l)?l:null}let i=S(d(n.config.projectRoot,e)),o=p(i,t);for(let s of Fe(o)){let a=I(N(n.config.projectRoot,s));if(r.has(a)||L(s))return a}return null}function Te(n){let e=m(n);return M.includes(e)?[n]:[`${n}.py`,`${n}.pyi`,d(n,"__init__.py"),d(n,"__init__.pyi")]}function w(n,e){let t=b(n);for(let r of e){let i=I(N(n.config.projectRoot,r));if(t.has(i)||L(r))return i}return null}function Ce(n){let e=m(n);return P.includes(e)?[n]:[`${n}.rs`,d(n,"mod.rs")]}function _e(n){let e=m(n);return O.includes(e)?[n]:[`${n}.rb`,d(n,"index.rb")]}function Fe(n){let e=m(n);return j.includes(e)?[n]:[`${n}.dart`,n]}function Me(n){let e=m(n),t=new Set;if(e){t.add(n);for(let r of D)t.add(n.slice(0,-e.length)+r)}else for(let r of D)t.add(`${n}${r}`),t.add(d(n,`index${r}`));return[...t]}function b(n){return ue.get(n,()=>new Set(n.all(`SELECT relative_path
|
|
2
|
-
FROM documents
|
|
3
|
-
WHERE 1 = 1
|
|
4
|
-
${n.pathExclusionsFor("documents")}`).map(e=>I(e.relative_path)).filter(e=>!n.isIgnored(e))))}function I(n){return n.replace(/\\/g,"/")}import{existsSync as v,readFileSync as Pe,readdirSync as Oe,statSync as je}from"fs";import u from"path";var $=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"];function U(n,e){let r=e?u.dirname(u.join(n,e)):n,i=u.resolve(n);for(;r.startsWith(i);){for(let s of $){let a=u.join(r,s);if(v(a))return a}let o=u.dirname(r);if(o===r)break;r=o}for(let o of $){let s=u.join(n,o);if(v(s))return s}return null}function Z(n){let e=n.config.projectRoot,t=new Set(Ae(e,n.config.semantic?.typescript?.tsconfigs)),r=n.all(`SELECT relative_path
|
|
5
|
-
FROM documents
|
|
6
|
-
WHERE (
|
|
7
|
-
relative_path LIKE '%.ts'
|
|
8
|
-
OR relative_path LIKE '%.tsx'
|
|
9
|
-
OR relative_path LIKE '%.mts'
|
|
10
|
-
OR relative_path LIKE '%.cts'
|
|
11
|
-
OR relative_path LIKE '%.js'
|
|
12
|
-
OR relative_path LIKE '%.jsx'
|
|
13
|
-
OR relative_path LIKE '%.mjs'
|
|
14
|
-
OR relative_path LIKE '%.cjs'
|
|
15
|
-
)
|
|
16
|
-
${n.pathExclusionsFor("documents")}`);for(let i of r){if(n.isIgnored(i.relative_path))continue;let o=U(e,i.relative_path);o&&t.add(u.resolve(o))}if(t.size===0){let i=U(e);i&&t.add(u.resolve(i))}return[...t].filter(i=>!ee(e,i)).sort((i,o)=>i.localeCompare(o))}function Ae(n,e=[]){let t=new Set;for(let r of e){let i=u.isAbsolute(r)?r:u.join(n,r);v(i)&&t.add(u.resolve(i))}for(let r of we(n))for(let i of $){let o=u.join(r,i);v(o)&&t.add(u.resolve(o))}if(t.size===0){let r=U(n);r&&t.add(u.resolve(r))}return[...t].filter(r=>!ee(n,r)).sort((r,i)=>r.localeCompare(i))}function we(n){let e=u.join(n,"package.json");if(!v(e))return[];let t;try{t=JSON.parse(Pe(e,"utf8"))}catch{return[]}return(Array.isArray(t.workspaces)?t.workspaces:t.workspaces?.packages??[]).flatMap(i=>We(n,i))}function We(n,e){if(!e||e.startsWith("!")||e.includes("node_modules"))return[];if(!e.includes("*")){let s=u.join(n,e);return W(s)?[s]:[]}let t=e.indexOf("*"),r=e.slice(0,t).replace(/\/$/,""),i=e.slice(t+1).replace(/^\//,""),o=u.join(n,r||".");return W(o)?Oe(o).map(s=>u.join(o,s,i)).filter(W):[]}function W(n){try{return je(n).isDirectory()}catch{return!1}}function ee(n,e){let t=u.relative(n,e).replace(/\\/g,"/");return t.startsWith("..")||t.includes("/node_modules/")||t.startsWith("node_modules/")||t.includes("/dist/")||t.startsWith("dist/")}var Ke=$e(import.meta.url),k;function oe(n,e){let t=He();if(!t)return K("ts-morph is not installed");let r=Z(n);if(r.length===0)return K("no tsconfig found");try{let i=r.map(o=>({tsconfigPath:o,project:new t.Project({tsConfigFilePath:o,skipFileDependencyResolution:!1})}));return new H(n,t,i)}catch(i){return K(i instanceof Error?i.message:String(i),r[0],r)}}function He(){if(k!==void 0)return k;try{k=Ke("ts-morph")}catch{k=null}return k}function K(n,e,t){return{language:"typescript",availability:()=>({available:!1,reason:n,tsconfigPath:e,tsconfigPaths:t}),importUsage:()=>[],referencesFor:()=>[],calleesFor:()=>[],signatureFor:()=>null}}var H=class{constructor(e,t,r){this.db=e;this.tsMorph=t;this.projects=r;this.workspacePackages=Ve(e.config.projectRoot)}db;tsMorph;projects;language="typescript";importUsageCache=new Map;referencesCache=new Map;calleesCache=new Map;fileCalleesCache=new Map;signatureCache=new Map;sourceFileCache=new Map;indexedDefinitionLeafCache=new Map;packageImportReferenceIndex=null;packageExportIndex=null;workspacePackages;availability(){return{available:!0,tsconfigPath:this.projects[0]?.tsconfigPath,tsconfigPaths:this.projects.map(e=>e.tsconfigPath)}}importUsage(e){return x(this.importUsageCache,e,()=>{let t=this.sourceFile(e);if(!t)return[];let r=[];for(let i of t.getImportDeclarations())r.push(...this.importUsageForDeclaration(e,i));return r})}referencesFor(e){return x(this.referencesCache,e.symbolId,()=>{let t=this.nodeForDefinition(e),r=this.packageImportReferencesForDefinition(e);if(!t)return r;let i=Qe(t);return J([...i.flatMap(o=>qe(o,this.db.config.projectRoot)).filter(o=>o.file!==e.relativePath||o.line<e.startLine||o.line>e.endLine),...r])})}calleesFor(e){return x(this.calleesCache,e.symbolId,()=>x(this.fileCalleesCache,e.relativePath,()=>this.calleeMapForFile(e.relativePath)).get(e.symbolId)??[])}signatureFor(e){return x(this.signatureCache,e.symbolId,()=>{let t=this.nodeForDefinition(e);if(!t||!this.tsMorph.Node.isFunctionDeclaration(t)&&!this.tsMorph.Node.isMethodDeclaration(t)&&!this.tsMorph.Node.isArrowFunction(t)&&!this.tsMorph.Node.isFunctionExpression(t)&&!this.tsMorph.Node.isConstructorDeclaration(t))return null;let r=t.getType().getCallSignatures()[0];if(!r)return null;let i=r.getParameters().map(s=>{let a=s.getDeclarations()[0],c=a?s.getTypeAtLocation(a).getText(a):s.getValueDeclaration()?.getType().getText()??"unknown";return re(c)}),o=r.getReturnType().getText(t);return`(${i.join(",")})=>${re(o)}`})}importUsageForDeclaration(e,t){let r=A(this.db,e,t.getModuleSpecifierValue()),i=te(t);return t.getImportClause()?.isTypeOnly()?i.map(o=>Je(e,r,o)):i.map(o=>this.valueImportUsageForEntry(e,r,o))}valueImportUsageForEntry(e,t,r){let o=(r.identifier?r.identifier.findReferences():[]).flatMap(l=>Ze(l,e,r.identifier,this.db.config.projectRoot)),s=o.some(l=>!ne(l.node)),a=o.some(l=>ne(l.node)),c=r.isTypeOnly;return{importer:e,sourcePath:t,importedName:r.importedName,localName:r.localName,kind:r.kind,isTypeOnly:c,isUsed:c||o.length>0,isTypeUsed:c||a,isValueUsed:s,references:o.map(l=>l.location)}}sourceFile(e){return this.sourceFileMatch(e)?.sourceFile??null}sourceFileMatch(e){return at(e)?x(this.sourceFileCache,e,()=>{let t=f.join(this.db.config.projectRoot,e);for(let{project:r}of this.projects){let i=r.getSourceFile(t)??r.addSourceFileAtPathIfExists(t)??null;if(i)return{project:r,sourceFile:i}}return null}):null}packageImportReferencesForDefinition(e){return this.packageImportReferences().get(e.symbolId)??[]}packageImportReferences(){if(this.packageImportReferenceIndex)return this.packageImportReferenceIndex;let e=new Map,t=this.packageExports();for(let r of this.indexedTypeScriptLikeDocuments())this.addPackageImportReferencesForDocument(e,t,r);for(let[r,i]of e)e.set(r,J(i));return this.packageImportReferenceIndex=e,e}indexedTypeScriptLikeDocuments(){return this.db.all(`SELECT relative_path
|
|
17
|
-
FROM documents
|
|
18
|
-
WHERE (
|
|
19
|
-
relative_path LIKE '%.ts'
|
|
20
|
-
OR relative_path LIKE '%.tsx'
|
|
21
|
-
OR relative_path LIKE '%.mts'
|
|
22
|
-
OR relative_path LIKE '%.cts'
|
|
23
|
-
OR relative_path LIKE '%.js'
|
|
24
|
-
OR relative_path LIKE '%.jsx'
|
|
25
|
-
OR relative_path LIKE '%.mjs'
|
|
26
|
-
OR relative_path LIKE '%.cjs'
|
|
27
|
-
)
|
|
28
|
-
${this.db.pathExclusionsFor("documents")}`).map(e=>e.relative_path)}addPackageImportReferencesForDocument(e,t,r){if(this.db.isIgnored(r))return;let i=this.sourceFileMatch(r);if(i)for(let o of i.sourceFile.getImportDeclarations())this.addPackageImportReferencesForDeclaration(e,t,r,o)}addPackageImportReferencesForDeclaration(e,t,r,i){let o=Ye(this.workspacePackages,i.getModuleSpecifierValue());if(!o)return;let s=t.get(o);if(s)for(let a of te(i)){if(a.kind!=="named"||!a.identifier)continue;let c=s.get(a.importedName);if(!c||c.size===0)continue;let l=et(a.identifier,r,this.db.config.projectRoot);l.length>0&&ot(e,c,l)}}packageExports(){if(this.packageExportIndex)return this.packageExportIndex;let e=new Map;for(let t of this.workspacePackages){let r=new Map;for(let i of Ge(t))this.collectPackageExports(t,i,r,new Set);r.size>0&&e.set(t.name,r)}return this.packageExportIndex=e,e}collectPackageExports(e,t,r,i){if(i.has(t))return;i.add(t);let o=this.sourceFile(t);if(o)for(let s of o.getExportDeclarations()){let a=s.getModuleSpecifierValue(),c=a?A(this.db,t,a):t;if(!c||!c.startsWith(`${e.sourceRootRelative}/`))continue;let l=s.getNamedExports();if(l.length===0){if(s.isNamespaceExport())continue;this.collectPackageExports(e,c,r,i);continue}for(let g of l){let y=g.getNameNode().getText(),X=g.getAliasNode()?.getText()??y,V=this.indexedDefinitionByLeaf(c,y);if(!V)continue;let R=r.get(X);R||(R=new Set,r.set(X,R)),R.add(V.symbolId)}}}indexedDefinitionByLeaf(e,t){return x(this.indexedDefinitionLeafCache,e,()=>rt(this.db,e)).get(t)??null}nodeForDefinition(e){let t=this.sourceFile(e.relativePath);if(!t)return null;let r=F(e.symbol)??e.leaf,i=[];return t.forEachDescendant(o=>{if(!tt(this.tsMorph,o,r))return;let s=E(t,o);s<e.startLine-1||s>e.endLine+1||i.push(o)}),i.sort((o,s)=>Math.abs(E(t,o)-e.startLine)-Math.abs(E(t,s)-e.startLine))[0]??null}definitionFromSymbol(e){let t=e.getDeclarations();for(let r of t){let i=r.getSourceFile(),o=C(this.db.config.projectRoot,i.getFilePath());if(!o||this.db.isIgnored(o))continue;let s=E(i,r),a=nt(this.db,o,s,e.getName());if(a)return{symbol:a.symbol,file:a.relativePath,line:a.startLine}}return null}calleeMapForFile(e){let t=this.sourceFile(e);if(!t)return new Map;let r=z(this.db,e).sort((o,s)=>o.startLine-s.startLine||s.endLine-o.endLine);if(r.length===0)return new Map;let i=new Map;t.forEachDescendant(o=>{if(!this.tsMorph.Node.isCallExpression(o)&&!this.tsMorph.Node.isNewExpression(o))return;let s=this.semanticCalleeForCallNode(t,r,o);s&&Xe(i,s.callerId,s.target)});for(let[o,s]of i)i.set(o,st(s));return i}semanticCalleeForCallNode(e,t,r){let i=it(t,E(e,r));if(!i)return null;let o=r.getExpression(),s=o.getSymbol()??o.getType().getSymbol(),a=s?this.definitionFromSymbol(s):null;return a?{callerId:i.symbolId,target:{symbol:a.symbol,file:a.file,line:a.line}}:null}};function te(n){let e=[],t=n.getDefaultImport();t&&e.push({identifier:t,importedName:"default",localName:t.getText(),kind:"default",isTypeOnly:n.getImportClause()?.isTypeOnly()??!1});let r=n.getNamespaceImport();r&&e.push({identifier:r,importedName:"*",localName:r.getText(),kind:"namespace",isTypeOnly:n.getImportClause()?.isTypeOnly()??!1});for(let i of n.getNamedImports()){let o=i.getNameNode(),a=i.getAliasNode()??(o.getKindName()==="Identifier"?o:null);e.push({identifier:a,importedName:o.getText(),localName:a?.getText()??o.getText(),kind:"named",isTypeOnly:i.isTypeOnly()||(n.getImportClause()?.isTypeOnly()??!1)})}return e.length===0&&e.push({identifier:null,importedName:"*",localName:null,kind:"side-effect",isTypeOnly:!1}),e}function Je(n,e,t){return{importer:n,sourcePath:e,importedName:t.importedName,localName:t.localName,kind:t.kind,isTypeOnly:!0,isUsed:!0,isTypeUsed:!0,isValueUsed:!1,references:[]}}function Xe(n,e,t){let r=n.get(e);r||(r=[],n.set(e,r)),r.push(t)}function Ve(n){let e=f.join(n,"package.json");if(!T(e))return[];let t;try{t=JSON.parse(ie(e,"utf8"))}catch{return[]}return(Array.isArray(t.workspaces)?t.workspaces:t.workspaces?.packages??[]).flatMap(i=>Be(n,i)).flatMap(i=>ze(n,i))}function Be(n,e){if(!e||e.startsWith("!")||e.includes("node_modules"))return[];if(!e.includes("*")){let s=f.join(n,e);return T(f.join(s,"package.json"))?[s]:[]}let t=e.indexOf("*"),r=e.slice(0,t).replace(/\/$/,""),i=e.slice(t+1).replace(/^\//,""),o=f.join(n,r||".");if(!T(o))return[];try{return Ue(o).map(s=>f.join(o,s,i)).filter(s=>T(f.join(s,"package.json")))}catch{return[]}}function ze(n,e){try{let t=JSON.parse(ie(f.join(e,"package.json"),"utf8"));if(!t.name)return[];let r=f.relative(n,e).replace(/\\/g,"/");return[{name:t.name,rootRelative:r,sourceRootRelative:`${r}/src`}]}catch{return[]}}function Ye(n,e){for(let t of n)if(e===t.name||e.startsWith(`${t.name}/`))return t.name;return null}function Ge(n){return[`${n.sourceRootRelative}/index.ts`,`${n.sourceRootRelative}/index.tsx`,`${n.sourceRootRelative}/index.mts`,`${n.sourceRootRelative}/index.cts`]}function qe(n,e){return n.getReferences().map(t=>{let r=t.getNode();return se(r,e)})}function Qe(n){let e=n;return typeof e.findReferences=="function"?e.findReferences():[]}function Ze(n,e,t,r){return n.getReferences().map(i=>i.getNode()).filter(i=>C(r,i.getSourceFile().getFilePath())===e).filter(i=>!t||i.getStart()!==t.getStart()).map(i=>({location:se(i,r),node:i}))}function se(n,e){let t=n.getSourceFile(),r=t.getLineAndColumnAtPos(n.getStart());return{file:C(e,t.getFilePath())??t.getBaseName(),line:r.line-1,column:r.column-1}}function et(n,e,t){let r=n.getSourceFile(),i=E(r,n),o=n.getText(),s=new RegExp(`\\b${ct(o)}\\b`,"g"),a=r.getFullText().split(`
|
|
29
|
-
`),c=[];for(let l=0;l<a.length;l++){if(l===i)continue;let g=a[l]??"";s.lastIndex=0;let y;for(;(y=s.exec(g))!==null;)c.push({file:e,line:l,column:y.index})}return J(c.filter(l=>C(t,f.join(t,l.file))===e))}function ne(n){for(let e=n;e;e=e.getParent()){let t=e.getKindName();if(t.includes("Type")||t==="InterfaceDeclaration"||t==="TypeAliasDeclaration")return!0;if(t==="CallExpression"||t==="NewExpression"||t==="ExpressionStatement")return!1}return!1}function tt(n,e,t){return"getNameNode"in e&&typeof e.getNameNode=="function"&&e.getNameNode()?.getText()===t||"getName"in e&&typeof e.getName=="function"&&e.getName()===t?!0:n.Node.isIdentifier(e)&&e.getText()===t}function nt(n,e,t,r){return n.all(`SELECT
|
|
30
|
-
gs.id AS symbolId,
|
|
31
|
-
gs.symbol,
|
|
32
|
-
d.relative_path AS relativePath,
|
|
33
|
-
COALESCE(der.start_line, c.start_line) AS startLine,
|
|
34
|
-
COALESCE(der.end_line, c.end_line) AS endLine,
|
|
35
|
-
COALESCE(gs.display_name, '') AS leaf,
|
|
36
|
-
NULL AS parentTypeName,
|
|
37
|
-
CASE WHEN gs.kind IN (6, 12, 13) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
|
|
38
|
-
CASE WHEN gs.kind IN (5, 8, 11) THEN 1 ELSE 0 END AS isTypeLike,
|
|
39
|
-
gs.kind AS kind,
|
|
40
|
-
gs.documentation AS documentation,
|
|
41
|
-
gs.enclosing_symbol AS enclosingSymbol
|
|
42
|
-
FROM global_symbols gs
|
|
43
|
-
LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
44
|
-
LEFT JOIN chunks c ON c.document_id = der.document_id
|
|
45
|
-
JOIN documents d ON d.id = der.document_id
|
|
46
|
-
WHERE d.relative_path = ?
|
|
47
|
-
AND COALESCE(gs.display_name, gs.symbol) LIKE ?
|
|
48
|
-
ORDER BY ABS(COALESCE(der.start_line, c.start_line) - ?)
|
|
49
|
-
LIMIT 5`,e,`%${r}%`,t)[0]??null}function rt(n,e){let t=n.all(`SELECT
|
|
50
|
-
d.id AS documentId,
|
|
51
|
-
gs.id AS symbolId,
|
|
52
|
-
gs.symbol,
|
|
53
|
-
d.relative_path AS relativePath,
|
|
54
|
-
der.start_line AS startLine,
|
|
55
|
-
der.end_line AS endLine,
|
|
56
|
-
COALESCE(gs.display_name, '') AS leaf,
|
|
57
|
-
NULL AS parentTypeName,
|
|
58
|
-
CASE WHEN gs.kind IN (6, 12, 13) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
|
|
59
|
-
CASE WHEN gs.kind IN (5, 8, 11) THEN 1 ELSE 0 END AS isTypeLike,
|
|
60
|
-
gs.kind AS kind,
|
|
61
|
-
gs.documentation AS documentation,
|
|
62
|
-
gs.enclosing_symbol AS enclosingSymbol
|
|
63
|
-
FROM global_symbols gs
|
|
64
|
-
JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
65
|
-
JOIN documents d ON d.id = der.document_id
|
|
66
|
-
WHERE d.relative_path = ?
|
|
67
|
-
UNION ALL
|
|
68
|
-
SELECT
|
|
69
|
-
d.id AS documentId,
|
|
70
|
-
gs.id AS symbolId,
|
|
71
|
-
gs.symbol,
|
|
72
|
-
d.relative_path AS relativePath,
|
|
73
|
-
MIN(c.start_line) AS startLine,
|
|
74
|
-
MAX(c.end_line) AS endLine,
|
|
75
|
-
COALESCE(gs.display_name, '') AS leaf,
|
|
76
|
-
NULL AS parentTypeName,
|
|
77
|
-
CASE WHEN gs.kind IN (6, 12, 13) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
|
|
78
|
-
CASE WHEN gs.kind IN (5, 8, 11) THEN 1 ELSE 0 END AS isTypeLike,
|
|
79
|
-
gs.kind AS kind,
|
|
80
|
-
gs.documentation AS documentation,
|
|
81
|
-
gs.enclosing_symbol AS enclosingSymbol
|
|
82
|
-
FROM global_symbols gs
|
|
83
|
-
JOIN mentions m ON m.symbol_id = gs.id
|
|
84
|
-
JOIN chunks c ON c.id = m.chunk_id
|
|
85
|
-
JOIN documents d ON d.id = c.document_id
|
|
86
|
-
WHERE d.relative_path = ?
|
|
87
|
-
AND m.role = 1
|
|
88
|
-
GROUP BY gs.id, gs.symbol, d.id, d.relative_path, gs.display_name, gs.kind, gs.documentation, gs.enclosing_symbol
|
|
89
|
-
ORDER BY startLine, endLine`,e,e),r=new Set,i=new Map;for(let o of t){if(r.has(o.symbolId))continue;r.add(o.symbolId);let s=o.leaf||F(o.symbol);!s||i.has(s)||i.set(s,{...o,leaf:s})}return i}function it(n,e){let t=null;for(let r of n)e<r.startLine||e>r.endLine||(!t||r.startLine>=t.startLine)&&(t=r);return t}function E(n,e){return n.getLineAndColumnAtPos(e.getStart()).line-1}function J(n){let e=new Set,t=[];for(let r of n){let i=`${r.file}:${r.line}:${r.column}`;e.has(i)||(e.add(i),t.push(r))}return t}function ot(n,e,t){for(let r of e){let i=n.get(r)??[];i.push(...t),n.set(r,i)}}function st(n){let e=new Set,t=[];for(let r of n){let i=`${r.symbol}|${r.file}|${r.line}`;e.has(i)||(e.add(i),t.push(r))}return t}function x(n,e,t){if(n.has(e))return n.get(e);let r=t();return n.set(e,r),r}function C(n,e){let t=f.relative(n||process.cwd(),e).replace(/\\/g,"/");return!t||t.startsWith("..")?null:t}function at(n){return/\.(?:ts|tsx|mts|cts|js|jsx|mjs|cjs)$/.test(n)}function re(n){return n.replace(/\s+/g," ").replace(/\bimport\("[^"]+"\)\./g,"").trim()}function ct(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var ae=new WeakMap;function ce(n,e){let t=`${n.config.projectRoot}:typescript-workspace`,r=ae.get(n);r||(r=new Map,ae.set(n,r));let i=r.get(t);if(i)return i;let o=oe(n,e);return r.set(t,o),o}function Ct(n,e){let t=_(n,e);return t?t.importUsage(e):[]}function lt(n,e){let t=_(n,e.relativePath);return t?t.referencesFor(e):[]}function _t(n,e){let t=new Map;for(let r of e)for(let i of lt(n,r)){if(i.file===r.relativePath||n.isIgnored(i.file))continue;let o=t.get(r.symbolId);o||(o=new Set,t.set(r.symbolId,o)),o.add(i.file)}return t}function Ft(n,e){let t=new Map;for(let r of e){let i=_(n,r.relativePath);if(!i)continue;let o=i.calleesFor(r);o.length>0&&t.set(r.symbolId,o)}return t}function Mt(n,e){let t=_(n,e.relativePath);return t?t.signatureFor(e):null}function _(n,e){if(!ut(e))return null;let t=ce(n,e);return t.availability().available?t:null}function ut(n){return/\.(?:ts|tsx|mts|cts|js|jsx|mjs|cjs)$/.test(n)}export{Y as a,q as b,Q as c,gt as d,xe as e,A as f,be as g,ve as h,ke as i,Re as j,De as k,Le as l,I as m,Ct as n,lt as o,_t as p,Ft as q,Mt as r};
|
|
90
|
-
//# sourceMappingURL=chunk-YU25IHJX.js.map
|