scip-query 0.10.5 → 0.10.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. package/README.md +6 -1
  2. package/dist/augment-vue-worker.js +1 -1
  3. package/dist/{chunk-CJJP64OC.js → chunk-27FU2KX7.js} +2 -2
  4. package/dist/chunk-3C4NIBY5.js +2 -0
  5. package/dist/chunk-3LQFMQPY.js +3 -0
  6. package/dist/{chunk-QVCCLDZI.js → chunk-5JXH6VGF.js} +2 -2
  7. package/dist/{chunk-77YBOOYT.js → chunk-5LM7RJMQ.js} +2 -2
  8. package/dist/{chunk-EWC3UK4V.js → chunk-5MHQI4RR.js} +2 -2
  9. package/dist/{chunk-X7ZY6FFF.js → chunk-72QDTW5U.js} +2 -2
  10. package/dist/{chunk-MZ7APUFN.js → chunk-733EF5FD.js} +2 -2
  11. package/dist/chunk-7AOMEMOA.js +4 -0
  12. package/dist/chunk-A536TEU4.js +3 -0
  13. package/dist/chunk-BZ2RRK7Y.js +8 -0
  14. package/dist/chunk-C6ROZBJA.js +32 -0
  15. package/dist/chunk-CMXD5VC4.js +2 -0
  16. package/dist/{chunk-BNKE4TT5.js → chunk-CQEJU32R.js} +2 -2
  17. package/dist/{chunk-5FOPAXWY.js → chunk-DBTL56LR.js} +2 -2
  18. package/dist/chunk-DOZ2X6TS.js +2 -0
  19. package/dist/{chunk-D322LMSA.js → chunk-DS6QEB3G.js} +5 -5
  20. package/dist/chunk-EOUTP32Q.js +4 -0
  21. package/dist/{chunk-QSXQT3NE.js → chunk-EPPCGQUI.js} +2 -2
  22. package/dist/{chunk-CSWZFD46.js → chunk-EW64FEJL.js} +2 -2
  23. package/dist/{chunk-O3OKSF6O.js → chunk-FG4NT6VY.js} +2 -2
  24. package/dist/chunk-FKYPOK7P.js +5 -0
  25. package/dist/chunk-FPYQA7JK.js +21 -0
  26. package/dist/{chunk-FIB4JPEX.js → chunk-FRIASDLG.js} +2 -2
  27. package/dist/chunk-FXI3AAKO.js +2 -0
  28. package/dist/{chunk-QUJBXLBY.js → chunk-FXWV2V7K.js} +2 -2
  29. package/dist/chunk-G2CGUNQU.js +4 -0
  30. package/dist/{chunk-LPLGJ4HO.js → chunk-GIOT3O6P.js} +2 -2
  31. package/dist/{chunk-YUTRW57I.js → chunk-GKRRO3WC.js} +2 -2
  32. package/dist/{chunk-Z4VHYJ5U.js → chunk-GOWLZ4NA.js} +2 -2
  33. package/dist/{chunk-4ZUJJRWT.js → chunk-GRZRMELG.js} +2 -2
  34. package/dist/{chunk-CFL2CNIF.js → chunk-H6RLM7D7.js} +2 -2
  35. package/dist/chunk-HDBQHJNY.js +2 -0
  36. package/dist/{chunk-AW4N6MGC.js → chunk-IA7Q6HVP.js} +2 -2
  37. package/dist/{chunk-E44ZMVNA.js → chunk-IL2EVPYP.js} +2 -2
  38. package/dist/{chunk-E7KERP7E.js → chunk-J43GIAVM.js} +2 -2
  39. package/dist/{chunk-56UN3DMK.js → chunk-JOGZKF5W.js} +2 -2
  40. package/dist/{chunk-CTCAF3YA.js → chunk-KT2ZO3CE.js} +2 -2
  41. package/dist/{chunk-DAI74TJU.js → chunk-KUIIQPDA.js} +2 -2
  42. package/dist/{chunk-VAA5FFIW.js → chunk-LM5SHAN4.js} +2 -2
  43. package/dist/chunk-LONIY5FF.js +2 -0
  44. package/dist/{chunk-FNRPGGVI.js → chunk-LQSLW7K7.js} +2 -2
  45. package/dist/{chunk-WBJZNPUT.js → chunk-M3YEHOCD.js} +2 -2
  46. package/dist/{chunk-GZCQTZLK.js → chunk-MFWAZFYD.js} +2 -2
  47. package/dist/{chunk-EYLXU575.js → chunk-MHATKJ3J.js} +2 -2
  48. package/dist/{chunk-ZQLO2SCU.js → chunk-MJXJ56LG.js} +2 -2
  49. package/dist/{chunk-47UA45TU.js → chunk-NIGHS7UP.js} +2 -2
  50. package/dist/{chunk-NVFERV4U.js → chunk-OFO7BIRK.js} +2 -2
  51. package/dist/{chunk-7OHWPJ5N.js → chunk-OMGE3V2Q.js} +2 -2
  52. package/dist/{chunk-ICXVNWMI.js → chunk-OT6CDRKC.js} +2 -2
  53. package/dist/{chunk-6UFMPECA.js → chunk-OWXN6ZS5.js} +2 -2
  54. package/dist/{chunk-QLNGUWR7.js → chunk-OZUJ3VZS.js} +2 -2
  55. package/dist/chunk-P3K7LX7M.js +4 -0
  56. package/dist/{chunk-ZSLT7NWQ.js → chunk-PQ6QG3EX.js} +2 -2
  57. package/dist/chunk-PTKQNPWX.js +23 -0
  58. package/dist/{chunk-YYD245WG.js → chunk-QMH2D6S5.js} +2 -2
  59. package/dist/{chunk-5M4TYWVI.js → chunk-QPTVFG4O.js} +2 -2
  60. package/dist/{chunk-MUULWXSJ.js → chunk-QR337MAA.js} +2 -2
  61. package/dist/{chunk-SPE4YCOT.js → chunk-QVS4SYAX.js} +2 -2
  62. package/dist/{chunk-AUVBR62P.js → chunk-RISLKTKQ.js} +2 -2
  63. package/dist/{chunk-OLD6PBU6.js → chunk-S7DNZ6IW.js} +2 -2
  64. package/dist/{chunk-EOZIZWW4.js → chunk-SXESPZUX.js} +2 -2
  65. package/dist/{chunk-TM6GVHA6.js → chunk-TDBTVMHY.js} +2 -2
  66. package/dist/{chunk-3UW7VM4H.js → chunk-TJXOD4IK.js} +2 -2
  67. package/dist/chunk-U73YFD3P.js +3 -0
  68. package/dist/{chunk-YUOAAR24.js → chunk-UBDFQBSE.js} +2 -2
  69. package/dist/chunk-UJEVABIR.js +2 -0
  70. package/dist/{chunk-5QJXH6ZL.js → chunk-VA3FJ3AY.js} +2 -2
  71. package/dist/{chunk-3KLLFNT4.js → chunk-VOYOYC5T.js} +2 -2
  72. package/dist/chunk-W2CBNBEL.js +71 -0
  73. package/dist/chunk-W2TIXAGN.js +40 -0
  74. package/dist/{chunk-CAWSSEVM.js → chunk-WMIQMXSK.js} +2 -2
  75. package/dist/{chunk-YQH353VA.js → chunk-WVRTGVHJ.js} +2 -2
  76. package/dist/{chunk-DJMK4DBL.js → chunk-WXMVK53S.js} +2 -2
  77. package/dist/{chunk-YTR4CO5S.js → chunk-XAYARHNF.js} +3 -3
  78. package/dist/{chunk-ESG4HBEF.js → chunk-XBIF45WK.js} +2 -2
  79. package/dist/{chunk-DE7MA6OD.js → chunk-XYI7XRZC.js} +2 -2
  80. package/dist/{chunk-7KCSELEV.js → chunk-YNLK3G63.js} +2 -2
  81. package/dist/{chunk-NNDYO2DX.js → chunk-YOCYR7KJ.js} +2 -2
  82. package/dist/chunk-YZA6PPZL.js +3 -0
  83. package/dist/{chunk-5UDFZC4D.js → chunk-ZUTV7DDX.js} +2 -2
  84. package/dist/cli.js +274 -237
  85. package/dist/{config-types-Bj4sh28g.d.ts → config-types-BDIWAYzr.d.ts} +13 -1
  86. package/dist/{db-CTarohbZ.d.ts → db-BAVwb4Pb.d.ts} +1 -1
  87. package/dist/{health-Bx0x1HAG.d.ts → health-B17sVFYf.d.ts} +6 -2
  88. package/dist/index.d.ts +3 -3
  89. package/dist/index.js +3 -3
  90. package/dist/queries/affected.d.ts +2 -2
  91. package/dist/queries/affected.js +1 -1
  92. package/dist/queries/bottlenecks.d.ts +2 -2
  93. package/dist/queries/bottlenecks.js +1 -1
  94. package/dist/queries/by-kind.d.ts +2 -2
  95. package/dist/queries/by-kind.js +1 -1
  96. package/dist/queries/call-graph.d.ts +2 -2
  97. package/dist/queries/call-graph.js +1 -1
  98. package/dist/queries/change-surface.d.ts +2 -2
  99. package/dist/queries/change-surface.js +1 -1
  100. package/dist/queries/cleanup-plan.d.ts +2 -2
  101. package/dist/queries/cleanup-plan.js +1 -1
  102. package/dist/queries/co-change.d.ts +2 -2
  103. package/dist/queries/co-change.js +1 -1
  104. package/dist/queries/code.d.ts +2 -2
  105. package/dist/queries/code.js +1 -1
  106. package/dist/queries/complexity-hotspots.d.ts +2 -2
  107. package/dist/queries/complexity-hotspots.js +1 -1
  108. package/dist/queries/complexity.d.ts +2 -2
  109. package/dist/queries/complexity.js +1 -1
  110. package/dist/queries/convergence.d.ts +2 -2
  111. package/dist/queries/convergence.js +1 -1
  112. package/dist/queries/coupling.d.ts +2 -2
  113. package/dist/queries/coupling.js +1 -1
  114. package/dist/queries/cycles.d.ts +2 -2
  115. package/dist/queries/cycles.js +1 -1
  116. package/dist/queries/dataflow.d.ts +2 -2
  117. package/dist/queries/dataflow.js +1 -1
  118. package/dist/queries/dead.d.ts +2 -2
  119. package/dist/queries/dead.js +1 -1
  120. package/dist/queries/deep-chains.d.ts +2 -2
  121. package/dist/queries/deep-chains.js +1 -1
  122. package/dist/queries/deps.d.ts +2 -2
  123. package/dist/queries/deps.js +1 -1
  124. package/dist/queries/diff-gate.d.ts +8 -5
  125. package/dist/queries/diff-gate.js +1 -1
  126. package/dist/queries/diff-impact.d.ts +7 -3
  127. package/dist/queries/diff-impact.js +1 -1
  128. package/dist/queries/doc-drift.d.ts +2 -2
  129. package/dist/queries/doc-drift.js +1 -1
  130. package/dist/queries/drift.d.ts +2 -2
  131. package/dist/queries/drift.js +1 -1
  132. package/dist/queries/extract-candidates.d.ts +2 -2
  133. package/dist/queries/extract-candidates.js +1 -1
  134. package/dist/queries/fan.d.ts +2 -2
  135. package/dist/queries/fan.js +1 -1
  136. package/dist/queries/files.d.ts +2 -2
  137. package/dist/queries/health.d.ts +3 -3
  138. package/dist/queries/health.js +1 -1
  139. package/dist/queries/hierarchy.d.ts +2 -2
  140. package/dist/queries/hierarchy.js +1 -1
  141. package/dist/queries/hotspots.d.ts +2 -2
  142. package/dist/queries/hotspots.js +1 -1
  143. package/dist/queries/imports.d.ts +2 -2
  144. package/dist/queries/imports.js +1 -1
  145. package/dist/queries/incomplete-migration.d.ts +5 -3
  146. package/dist/queries/incomplete-migration.js +1 -1
  147. package/dist/queries/index.d.ts +3 -3
  148. package/dist/queries/index.js +1 -1
  149. package/dist/queries/isolated.d.ts +2 -2
  150. package/dist/queries/isolated.js +1 -1
  151. package/dist/queries/locality-candidates.d.ts +2 -2
  152. package/dist/queries/locality-candidates.js +1 -1
  153. package/dist/queries/members.d.ts +2 -2
  154. package/dist/queries/members.js +1 -1
  155. package/dist/queries/methods.d.ts +2 -2
  156. package/dist/queries/methods.js +1 -1
  157. package/dist/queries/outline.d.ts +2 -2
  158. package/dist/queries/outline.js +1 -1
  159. package/dist/queries/passthrough-candidates.d.ts +2 -2
  160. package/dist/queries/passthrough-candidates.js +1 -1
  161. package/dist/queries/plan-context.d.ts +2 -2
  162. package/dist/queries/plan-context.js +1 -1
  163. package/dist/queries/react-component-duplicates.d.ts +2 -2
  164. package/dist/queries/react-component-duplicates.js +1 -1
  165. package/dist/queries/react-hook-candidates.d.ts +2 -2
  166. package/dist/queries/react-hook-candidates.js +1 -1
  167. package/dist/queries/react-large-component-pressure.d.ts +2 -2
  168. package/dist/queries/react-large-component-pressure.js +1 -1
  169. package/dist/queries/recent-duplicates.d.ts +2 -2
  170. package/dist/queries/recent-duplicates.js +1 -1
  171. package/dist/queries/redundant-reexports.d.ts +2 -2
  172. package/dist/queries/redundant-reexports.js +1 -1
  173. package/dist/queries/refs.d.ts +2 -2
  174. package/dist/queries/refs.js +1 -1
  175. package/dist/queries/self-audit.d.ts +2 -2
  176. package/dist/queries/self-audit.js +1 -1
  177. package/dist/queries/similar-chains.d.ts +2 -2
  178. package/dist/queries/similar-chains.js +1 -1
  179. package/dist/queries/similar-files.d.ts +2 -2
  180. package/dist/queries/similar-files.js +1 -1
  181. package/dist/queries/similar-signatures.d.ts +2 -2
  182. package/dist/queries/similar-signatures.js +1 -1
  183. package/dist/queries/similar.d.ts +5 -3
  184. package/dist/queries/similar.js +1 -1
  185. package/dist/queries/slice.d.ts +2 -2
  186. package/dist/queries/slice.js +1 -1
  187. package/dist/queries/stale-abstractions.d.ts +2 -2
  188. package/dist/queries/stale-abstractions.js +1 -1
  189. package/dist/queries/stats.d.ts +2 -2
  190. package/dist/queries/surface.d.ts +2 -2
  191. package/dist/queries/surface.js +1 -1
  192. package/dist/queries/symbols.d.ts +2 -2
  193. package/dist/queries/symbols.js +1 -1
  194. package/dist/queries/system.d.ts +2 -2
  195. package/dist/queries/system.js +1 -1
  196. package/dist/queries/trace.d.ts +2 -2
  197. package/dist/queries/trace.js +1 -1
  198. package/dist/queries/unused-imports.d.ts +2 -2
  199. package/dist/queries/unused-imports.js +1 -1
  200. package/dist/queries/unused-params.d.ts +2 -2
  201. package/dist/queries/unused-params.js +1 -1
  202. package/dist/queries/vue-component-duplicates.d.ts +2 -2
  203. package/dist/queries/vue-component-duplicates.js +1 -1
  204. package/dist/queries/vue-composable-candidates.d.ts +2 -2
  205. package/dist/queries/vue-composable-candidates.js +1 -1
  206. package/dist/queries/vue-large-view-pressure.d.ts +2 -2
  207. package/dist/queries/vue-large-view-pressure.js +1 -1
  208. package/dist/queries/wrapper-candidates.d.ts +2 -2
  209. package/dist/queries/wrapper-candidates.js +1 -1
  210. package/dist/reindex-worker.js +11 -11
  211. package/dist/reindex.d.ts +11 -2
  212. package/dist/reindex.js +22 -22
  213. package/dist/runtime.d.ts +17 -20
  214. package/dist/runtime.js +2 -2
  215. package/dist/scip-cli-CnK9Va4O.d.ts +56 -0
  216. package/docs/AGENT_GUIDE.md +1 -1
  217. package/docs/COMMAND_REFERENCE.md +3 -2
  218. package/docs/analyzer-inventory.md +2 -2
  219. package/docs/analyzer-validation-ledger.md +2 -2
  220. package/package.json +1 -1
  221. package/skills/concrete-plan/SKILL.md +2 -2
  222. package/skills/scip-adoption/SKILL.md +4 -2
  223. package/skills/scip-ai-cleanup/SKILL.md +1 -1
  224. package/skills/scip-api-impact/SKILL.md +6 -2
  225. package/skills/scip-debloat/SKILL.md +1 -1
  226. package/skills/scip-debug/SKILL.md +6 -2
  227. package/skills/scip-diagram/SKILL.md +3 -1
  228. package/skills/scip-directory-architecture/SKILL.md +7 -3
  229. package/skills/scip-doc-reconcile/SKILL.md +3 -1
  230. package/skills/scip-explore/SKILL.md +2 -2
  231. package/skills/scip-health-audit/SKILL.md +6 -2
  232. package/skills/scip-health-improve/SKILL.md +6 -2
  233. package/skills/scip-maintainability/SKILL.md +6 -3
  234. package/skills/scip-query/SKILL.md +10 -6
  235. package/skills/scip-query-setup/SKILL.md +10 -5
  236. package/skills/scip-react-maintainability/SKILL.md +7 -2
  237. package/skills/scip-triage-issue/SKILL.md +4 -2
  238. package/skills/scip-verify/SKILL.md +5 -3
  239. package/skills/scip-vue-maintainability/SKILL.md +7 -2
  240. package/dist/chunk-237YUOPK.js +0 -8
  241. package/dist/chunk-3UVJJ6Z7.js +0 -2
  242. package/dist/chunk-3ZYF3ELZ.js +0 -2
  243. package/dist/chunk-7JOTOWZO.js +0 -4
  244. package/dist/chunk-A3VNUGKJ.js +0 -2
  245. package/dist/chunk-A4L36SZS.js +0 -22
  246. package/dist/chunk-A7RNHUJH.js +0 -20
  247. package/dist/chunk-AYYIZ4BA.js +0 -4
  248. package/dist/chunk-BKDXBJDQ.js +0 -2
  249. package/dist/chunk-C3MZZ2ZN.js +0 -2
  250. package/dist/chunk-CRU42NJU.js +0 -2
  251. package/dist/chunk-ERHOS6AW.js +0 -2
  252. package/dist/chunk-FOQHUKNZ.js +0 -4
  253. package/dist/chunk-FUPDW5AC.js +0 -3
  254. package/dist/chunk-G3WGZU5Q.js +0 -2
  255. package/dist/chunk-HVTYSC26.js +0 -40
  256. package/dist/chunk-KPHKX4LP.js +0 -71
  257. package/dist/chunk-MA7OVFHI.js +0 -2
  258. package/dist/chunk-OBBDKQAG.js +0 -3
  259. package/dist/chunk-RHTJBYZ5.js +0 -2
  260. package/dist/chunk-UQJGTVHV.js +0 -5
  261. package/dist/chunk-ZFMPHDAT.js +0 -4
  262. package/dist/scip-cli-Bh1M_JPu.d.ts +0 -20
@@ -1,22 +0,0 @@
1
- import{c as p}from"./chunk-7S5E7KWT.js";import{createHash as u}from"crypto";import{createRequire as h}from"module";import{dirname as g,join as v}from"path";import T from"better-sqlite3";var m=h(import.meta.url),f="evidence.db",s=new WeakMap,N=p("evidence-content-hash",{clearGroups:["whole-project","source-file"]});function C(){for(let t of["../package.json","../../package.json"])try{return m(t).version}catch{}return"0.0.0"}var c=C();function S(t){return u("sha256").update(t).digest("hex")}function O(t,n,e){return N.get(t,n,()=>S(e))}function E(t,n){process.env.SCIP_QUERY_DEBUG&&console.error(`evidence-cache: ${t}: ${n instanceof Error?n.message:String(n)}`)}function l(t){if(s.has(t))return s.get(t)??null;let n=null;try{let e=new T(v(g(t.config.dbPath),f));e.pragma("journal_mode = WAL"),e.pragma("busy_timeout = 5000"),e.pragma("synchronous = NORMAL"),e.exec(`
2
- CREATE TABLE IF NOT EXISTS file_evidence (
3
- kind TEXT NOT NULL,
4
- relative_path TEXT NOT NULL,
5
- content_hash TEXT NOT NULL,
6
- version TEXT NOT NULL,
7
- payload TEXT NOT NULL,
8
- PRIMARY KEY (kind, relative_path)
9
- );
10
- CREATE TABLE IF NOT EXISTS semantic_callees (
11
- relative_path TEXT NOT NULL,
12
- symbol TEXT NOT NULL,
13
- content_hash TEXT NOT NULL,
14
- deps_digest TEXT NOT NULL,
15
- version TEXT NOT NULL,
16
- payload TEXT NOT NULL,
17
- PRIMARY KEY (relative_path, symbol)
18
- );
19
- `),n={evidence:e,readFileEvidence:e.prepare("SELECT payload FROM file_evidence WHERE kind = ? AND relative_path = ? AND content_hash = ? AND version = ?"),writeFileEvidence:e.prepare("INSERT OR REPLACE INTO file_evidence (kind, relative_path, content_hash, version, payload) VALUES (?, ?, ?, ?, ?)"),readCallees:e.prepare(`SELECT payload FROM semantic_callees
20
- WHERE relative_path = ? AND symbol = ? AND content_hash = ? AND deps_digest = ? AND version = ?`),writeCallees:e.prepare(`INSERT OR REPLACE INTO semantic_callees
21
- (relative_path, symbol, content_hash, deps_digest, version, payload) VALUES (?, ?, ?, ?, ?, ?)`),dropStaleCallees:e.prepare("DELETE FROM semantic_callees WHERE relative_path = ? AND content_hash != ?")}}catch(e){E("disabled (open failed)",e)}return s.set(t,n),n}function d(t,n,e){E(`disabled (${n})`,e),s.set(t,null)}function A(t,n,e,i){let a=l(t);if(!a)return null;try{return a.readFileEvidence.get(n,e,i,c)?.payload??null}catch(r){return d(t,"file_evidence read",r),null}}function R(t,n,e,i,a){let r=l(t);if(r)try{r.writeFileEvidence.run(n,e,i,c,a)}catch(o){d(t,"file_evidence write",o)}}function w(t,n,e,i,a){let r=l(t);if(!r)return null;try{return r.readCallees.get(n,e,i,a,c)?.payload??null}catch(o){return d(t,"semantic_callees read",o),null}}function F(t,n){if(n.length===0)return;let e=l(t);if(e)try{e.evidence.transaction(()=>{let i=new Set;for(let a of n){let r=`${a.relativePath}\0${a.contentHash}`;i.has(r)||(i.add(r),e.dropStaleCallees.run(a.relativePath,a.contentHash)),e.writeCallees.run(a.relativePath,a.symbol,a.contentHash,a.depsDigest,c,a.payload)}})()}catch(i){d(t,"semantic_callees write",i)}}export{S as a,O as b,A as c,R as d,w as e,F as f};
22
- //# sourceMappingURL=chunk-A4L36SZS.js.map
@@ -1,20 +0,0 @@
1
- import{a as S}from"./chunk-3ZYF3ELZ.js";import{e as b}from"./chunk-FUPDW5AC.js";import{c as h,f as p,h as y}from"./chunk-JM72FNGA.js";import{execFileSync as d}from"child_process";import{existsSync as N,readFileSync as v}from"fs";import{basename as R}from"path";function C(e){let n=new Map;for(let t of e){let i=n.get(t.file);i||(i=[],n.set(t.file,i)),i.push(t)}return n}var P="Unable to compute git diff.";function fe(e,n={}){let t=n.plan??E(e,n);return t.note?O(t.note,t.changedFileLines):t.changedFiles.length===0?$(t.changedFileLines):A(t.changedFiles,[T(e,t.changedFiles,t.changedFiles,t.changedRanges)])}function E(e,n={}){let{base:t="HEAD"}=n;try{let i=k(e.config.projectRoot,t),r=G(e,i),s=Y(e,z(e.config.projectRoot,t));return{changedFileLines:i,changedFiles:r,changedRanges:s,renamedFiles:W(e.config.projectRoot,t,r),note:i.length===0?"No changed files found.":void 0}}catch{return{changedFileLines:[],changedFiles:[],changedRanges:[],renamedFiles:[],note:P}}}function T(e,n,t,i=[]){let r=new S(e),s=new Set(t),a=C(i),l=[],m=new Map,f=n.flatMap(o=>r.definitionsForFile(o)).filter(ee).filter(o=>V(o,a)).sort((o,u)=>o.relativePath.localeCompare(u.relativePath)||o.startLine-u.startLine),c=f.map(o=>o.symbolId),g=K(e,c),x=Q(e,c,t),M=b(e,f.filter(o=>g.get(o.symbolId)===0));for(let o of f)j(e,o,s,l,m,M.get(o.symbolId)??new Set,g.get(o.symbolId)??0,x.get(o.symbolId)??new Set);return{changedSymbols:l,consumerEntries:[...m.entries()].map(([o,u])=>({file:o,symbols:[...u].sort()}))}}function A(e,n){let t=new Map,i=n.flatMap(s=>s.changedSymbols);for(let s of n)for(let a of s.consumerEntries){let l=t.get(a.file);l||(l=new Set,t.set(a.file,l));for(let m of a.symbols)l.add(m)}let r=X(t);return{changedFiles:[...e],changedSymbols:i,affectedConsumers:r,summary:{totalChangedFiles:e.length,totalChangedSymbols:i.length,totalAffectedFiles:r.length}}}function O(e,n=[]){return{changedFiles:n,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:n.length,totalChangedSymbols:0,totalAffectedFiles:0,note:e}}}function $(e){return{changedFiles:e,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:e.length,totalChangedSymbols:0,totalAffectedFiles:0,note:"Changed files are not present in the current SCIP index."}}}function k(e,n){let t=d("git",["diff","--name-only",n],{encoding:"utf-8",cwd:e,timeout:1e4}),i=d("git",["diff","--name-only","--cached",n],{encoding:"utf-8",cwd:e,timeout:1e4}),r=d("git",["ls-files","--others","--exclude-standard"],{encoding:"utf-8",cwd:e,timeout:1e4});return[...new Set([t,i,r].flatMap(s=>s.split(`
2
- `)).map(s=>s.trim()).filter(s=>s.length>0))]}function z(e,n){let t=d("git",["diff","--unified=0",n],{encoding:"utf-8",cwd:e,timeout:1e4}),i=d("git",["diff","--unified=0","--cached",n],{encoding:"utf-8",cwd:e,timeout:1e4});return w([...D(t),...D(i)])}function B(e,n,t){try{return d("git",["show",`${n}:./${t}`],{encoding:"utf-8",cwd:e,timeout:1e4,stdio:["ignore","pipe","ignore"]})}catch{return null}}function W(e,n,t){if(t.length===0)return[];let i=new Map,r=new Set;for(let a of H(e,n))t.includes(a.to)&&(i.set(a.to,a),r.add(a.from));let s=U(e,n);if(s.length===0)return[...i.values()].sort((a,l)=>a.to.localeCompare(l.to));for(let a of t){if(i.has(a)||!N(`${e}/${a}`))continue;let l=s.filter(c=>!r.has(c)).filter(c=>R(c)===R(a));if(l.length===0)continue;let m=v(`${e}/${a}`,"utf-8"),f=l.map(c=>({from:c,to:a,similarity:J(B(e,n,c)??"",m)})).sort((c,g)=>g.similarity-c.similarity)[0];f&&f.similarity>=.45&&(i.set(a,f),r.add(f.from))}return[...i.values()].sort((a,l)=>a.to.localeCompare(l.to))}function U(e,n){let t=d("git",["diff","--name-only","--diff-filter=D",n],{encoding:"utf-8",cwd:e,timeout:1e4}),i=d("git",["diff","--name-only","--diff-filter=D","--cached",n],{encoding:"utf-8",cwd:e,timeout:1e4});return[...new Set([...F(t),...F(i)])]}function H(e,n){let t=d("git",["diff","--name-status","--find-renames",n],{encoding:"utf-8",cwd:e,timeout:1e4}),i=d("git",["diff","--name-status","--find-renames","--cached",n],{encoding:"utf-8",cwd:e,timeout:1e4});return[...t.split(`
3
- `),...i.split(`
4
- `)].map(r=>r.trim()).filter(r=>r.startsWith("R")).map(r=>r.split(" ")).filter(r=>r.length>=3).map(([r,s,a])=>({from:s,to:a,similarity:Number(r.slice(1))/100}))}function J(e,n){let t=new Set(I(e)),i=new Set(I(n));if(t.size===0&&i.size===0)return 1;if(t.size===0||i.size===0)return 0;let r=0;for(let s of t)i.has(s)&&(r+=1);return 2*r/(t.size+i.size)}function I(e){return e.match(/[A-Za-z_$][\w$]*|[{}()[\].,]/g)??[]}function F(e){return e.split(`
5
- `).map(n=>n.trim()).filter(n=>n.length>0)}function G(e,n){let t=_(e),i=[];for(let r of n){let s=t(r);s&&!e.isIgnored(s)&&i.push(s)}return i}function Y(e,n){let t=_(e),i=[];for(let r of n){let s=t(r.file);s&&!e.isIgnored(s)&&i.push({...r,file:s})}return w(i)}function _(e){let n=e.all(`SELECT relative_path FROM documents
6
- ORDER BY id`).map(i=>i.relative_path),t=new Map(n.map(i=>[i,i]));return i=>{let r=i.replace(/\\/g,"/"),s=t.get(r);return s||(n.find(a=>a.endsWith(r))??null)}}function D(e){let n=[],t=null;for(let i of e.split(`
7
- `)){if(i.startsWith("+++ ")){t=q(i.slice(4).trim());continue}if(!t||!i.startsWith("@@ "))continue;let r=/@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/.exec(i);if(!r)continue;let s=Math.max(0,Number(r[1])-1),a=r[2]===void 0?1:Number(r[2]);n.push({file:t,startLine:s,endLine:Math.max(s,s+Math.max(a,1)-1)})}return n}function q(e){return e==="/dev/null"?null:e.startsWith("a/")||e.startsWith("b/")?e.slice(2):e}function w(e){let n=new Set,t=[];for(let i of e){let r=`${i.file}:${i.startLine}:${i.endLine}`;n.has(r)||(n.add(r),t.push(i))}return t}function V(e,n){let t=n.get(e.relativePath);return!t||t.length===0?!0:t.some(i=>Z(e.startLine,e.endLine,i.startLine,i.endLine))}function Z(e,n,t,i){return e<=i&&t<=n}function j(e,n,t,i,r,s,a,l){let m=Math.max(a,s.size);if(!ne(n,m))return;let f=h(n.symbol);i.push({symbol:n.symbol,shortName:f,file:n.relativePath,startLine:n.startLine,endLine:n.endLine,fanIn:m});for(let c of l)L(e,t,r,c,f);for(let c of s)L(e,t,r,c,f)}function K(e,n){if(n.length===0)return new Map;let t=e.all(`SELECT m.symbol_id, COUNT(DISTINCT c.document_id) AS fan_in
8
- FROM mentions m
9
- JOIN chunks c ON m.chunk_id = c.id
10
- WHERE m.symbol_id IN (${n.map(()=>"?").join(",")})
11
- AND m.role != 1
12
- GROUP BY m.symbol_id`,...n);return new Map(t.map(i=>[i.symbol_id,i.fan_in]))}function Q(e,n,t){if(n.length===0||t.length===0)return new Map;let i=e.all(`SELECT DISTINCT m.symbol_id, ref_d.relative_path
13
- FROM mentions m
14
- JOIN chunks c ON m.chunk_id = c.id
15
- JOIN documents ref_d ON c.document_id = ref_d.id
16
- WHERE m.symbol_id IN (${n.map(()=>"?").join(",")})
17
- AND m.role != 1
18
- AND ref_d.relative_path NOT IN (${t.map(()=>"?").join(",")})
19
- ${e.pathExclusionsFor("ref_d")}`,...n,...t),r=new Map;for(let s of i){let a=r.get(s.symbol_id);a||(a=new Set,r.set(s.symbol_id,a)),a.add(s.relative_path)}return r}function L(e,n,t,i,r){if(e.isIgnored(i)||n.has(i))return;let s=t.get(i);s||(s=new Set,t.set(i,s)),s.add(r)}function X(e){return[...e.entries()].map(([n,t])=>({file:n,consumedSymbols:t.size})).sort((n,t)=>t.consumedSymbols-n.consumedSymbols)}function ee(e){return!(y(e.symbol)||e.parentTypeName!==null&&!p(e.symbol))}function ne(e,n){return p(e.symbol)||e.isTypeLike?!0:e.parentTypeName===null&&n>0}export{C as a,P as b,fe as c,E as d,T as e,A as f,B as g};
20
- //# sourceMappingURL=chunk-A7RNHUJH.js.map
@@ -1,4 +0,0 @@
1
- import{a as O,d as I}from"./chunk-KRGBLZT2.js";import{b as v,c as N,d as E}from"./chunk-A4L36SZS.js";import{existsSync as X,readFileSync as M}from"fs";import{join as D}from"path";function L(t,n){let e=$(t,n)??W(t,n)??G(t,n)??Z(t,n);return J(t,e,n)}function $(t,n){let e=-1,i=null;for(let o=0;o<=n;o+=1){let r=x(t[o]??"");r&&(i===null?(i=r,e=o):r===i&&(i=null,e=-1))}if(i===null||e<0)return null;for(let o=n+1;o<t.length;o+=1)if(x(t[o]??"")===i)return{start:e,end:o+1};return{start:e,end:t.length}}function x(t){let n=t.match(/^\s*(```+|~~~+)/);return n?n[1].startsWith("`")?"`":"~":null}function W(t,n){if(!T(t[n]??""))return null;let e=n;for(;e>0&&T(t[e-1]??"");)e-=1;let i=n+1;for(;i<t.length&&T(t[i]??"");)i+=1;return{start:e,end:i}}function T(t){let n=t.trim();return n.startsWith("|")&&n.endsWith("|")&&n.includes("|")}function G(t,n){let e=n;for(;e>=0;){let r=t[e]??"";if(y(r)!==null)break;if(k(r)!==null)return null;e-=1}if(e<0)return null;let i=y(t[e]??"");if(i===null)return null;let o=e+1;for(;o<t.length;){let r=t[o]??"",s=y(r);if(s!==null){if(s<=i)break;o+=1;continue}if(k(r)!==null)break;o+=1}return{start:e,end:o}}function y(t){let n=t.match(/^(\s*)(?:[-*+]\s+|\d+[.)]\s+)/);return n?n[1].length:null}function Z(t,n){let e=t[n]??"";if(F(e)||e.trim().length===0)return{start:n,end:n+1};let i=n;for(;i>0&&j(t[i-1]??"");)i-=1;let o=n+1;for(;o<t.length&&j(t[o]??"");)o+=1;return{start:i,end:o}}function j(t){return k(t)===null}function k(t){return t.trim().length===0?"blank":F(t)?"heading":x(t)?"fence":T(t)?"table":y(t)!==null?"list":null}function F(t){return/^#{1,6}\s+/.test(t.trim())}function J(t,n,e){let{start:i,end:o}=n;if(o-i>40){let s=Math.floor(20);i=Math.max(i,e-s),o=Math.min(o,i+40),i=Math.max(n.start,o-40)}let r=t.slice(i,o).join(`
2
- `).trim();return r.length<=2e3?r:`${r.slice(0,2e3).trimEnd()}...`}function w(t,n){return n.filter(e=>t.includes(e))}var p=/\.(?:md|mdx|rst|txt)$/i;function q(t){return/(?:^|\/)(?:docs\/plans|plans|adrs?|rfcs?|decisions|changelogs?|archive|reports?)\//i.test(t)||/(?:^|\/)CHANGELOG\.(?:md|mdx|rst|txt)$/i.test(t)}var K=3,H=/[A-Za-z0-9_@-]+(?:\/[A-Za-z0-9_.@-]+)+\.[A-Za-z0-9]{1,6}\b/g;function ft(t,n={}){let{doc:e,limit:i=20,minCoupling:o=K}=n,r=Y(t);if(!r)return{available:!1,commitsAnalyzed:0,docsScanned:0,findings:[]};let s=[];for(let c of r.docFiles){if(e!==void 0&&!c.includes(e)||e===void 0&&!z(t,c)||e!==void 0&&!X(D(t.config.projectRoot,c)))continue;let d=Math.max(0,...r.changeTimes.get(c)??[]),g=Q(t,c),l=new Map,{resolved:a,broken:u,citations:m}=P(t,c,r.tracked,r.trackedBySuffix,r.everSeenInHistory),S=new Map(m.map(f=>[f.file,f.contexts]));for(let f of a){if(f===c||p.test(f))continue;let h=(r.changeTimes.get(f)??[]).filter(b=>b>d).length;h!==0&&l.set(f,{file:f,evidence:"reference",coChanges:0,changesSinceDocUpdate:h,...A("reference",g),citationContexts:S.get(f)})}for(let[f,h]of r.coupling.get(c)??[]){if(h<o||!r.tracked.has(f))continue;let b=(r.changeTimes.get(f)??[]).filter(U=>U>d).length;if(b===0)continue;let C=l.get(f);C?(C.evidence="both",C.coChanges=h,Object.assign(C,A("both",g))):l.set(f,{file:f,evidence:"co-change",coChanges:h,changesSinceDocUpdate:b,...A("co-change",g)})}if(l.size===0&&u.length===0)continue;let _=[...l.values()].sort((f,h)=>h.changesSinceDocUpdate-f.changesSinceDocUpdate);s.push({doc:c,docLastChangedAt:d,staleness:_.reduce((f,h)=>f+h.changesSinceDocUpdate,0)+u.length*10,subjects:_.slice(0,8),brokenReferences:u})}return s.sort((c,d)=>d.staleness-c.staleness),{available:!0,commitsAnalyzed:r.historyCommitCount,docsScanned:r.docFiles.length,findings:s.slice(0,i)}}function Q(t,n){let e;try{e=M(D(t.config.projectRoot,n),"utf8").slice(0,6e3)}catch{return{docIntent:"unknown",reasons:["doc text unavailable"]}}let i=`${n}
3
- ${e}`.toLowerCase(),o=w(i,["historical note","historical record","history note","retrospective","postmortem","post-mortem","archived","archive","previously","legacy","recorded","record of","snapshot","as of","migration note","decision record"]);if(o.length>0)return{docIntent:"historical-note",reasons:[`historical-note terms: ${o.join(", ")}`]};let r=w(i,["current","standard","standards","must","should","policy","guide","guidance","workflow","contract","invariant","source of truth"]);return r.length>0?{docIntent:"current-guidance",reasons:[`current-guidance terms: ${r.join(", ")}`]}:{docIntent:"unknown",reasons:["no current-guidance or historical-note markers found"]}}function A(t,n){return{actionTier:V(t,n.docIntent),docIntent:n.docIntent,docIntentReasons:n.reasons}}function V(t,n){return n==="historical-note"?"support":t==="co-change"?"signal":"direct"}function Y(t){let n=O(t);if(!n)return null;let e=I(t)??new Set,i=new Map,o=new Map,r=new Set;for(let s of n.commits){let c=[...new Set(s.files)],d=c.filter(l=>p.test(l)),g=c.filter(l=>!p.test(l));for(let l of c){r.add(l);let a=i.get(l)??[];a.push(s.timestamp),i.set(l,a)}for(let l of d){let a=o.get(l);a||(a=new Map,o.set(l,a));for(let u of g)a.set(u,(a.get(u)??0)+1)}}return{changeTimes:i,coupling:o,docFiles:[...e].filter(s=>p.test(s)),everSeenInHistory:r,historyCommitCount:n.commits.length,tracked:e,trackedBySuffix:B(e)}}function gt(t,n){let e=I(t)??new Set,i=B(e),o=[];for(let r of e){if(!z(t,r))continue;let{resolved:s,citations:c}=P(t,r,e,i,new Set),d=[...s].filter(g=>n.has(g));if(d.length>0){let g=d.sort(),l=new Set(g),a=c.filter(u=>l.has(u.file));o.push({doc:r,cited:g,citations:a,citedClaims:R(a.flatMap(u=>u.contexts)).slice(0,3)})}}return o}function z(t,n){return p.test(n)&&!q(n)&&X(D(t.config.projectRoot,n))}function B(t){let n=new Map;for(let e of t){let i=e.split("/");for(let o of[2,3]){if(i.length<o)continue;let r=i.slice(-o).join("/"),s=n.get(r)??[];s.push(e),n.set(r,s)}}return n}function P(t,n,e,i,o){let r=new Set,s=new Set,c=et(t,n);if(!c)return{resolved:r,broken:[],citations:[]};let d=tt(t,n,c),g=new Map,l=(a,u)=>{let m=d.get(u);if(!m||m.length===0)return;let S=g.get(a)??[];S.push(...m),g.set(a,R(S).slice(0,3))};for(let a of c){if(e.has(a)){r.add(a),l(a,a);continue}let u=i.get(a);if(u&&u.length===1){r.add(u[0]),l(u[0],a);continue}u&&u.length>1||o.has(a)&&s.add(a)}return{resolved:r,broken:[...s],citations:[...g].map(([a,u])=>({file:a,contexts:u}))}}function tt(t,n,e){let i;try{i=M(D(t.config.projectRoot,n),"utf-8").split(/\r?\n/)}catch{return new Map}let o=new Set(e),r=new Map;for(let s=0;s<i.length;s+=1){let c=i[s]??"";for(let d of c.matchAll(H)){let g=d[0].replace(/^\.?\//,"");if(!o.has(g))continue;let l=L(i,s);if(l.length===0)continue;let a=r.get(g)??[];a.push(l),r.set(g,R(a).slice(0,3))}}return r}function R(t){let n=[];for(let e of new Set(t))n.some(i=>nt(i,e))||n.push(e);return n}function nt(t,n){if(t===n)return!0;let e=t.split(/\r?\n/).map(c=>c.trim()).filter(c=>c.length>0),i=n.split(/\r?\n/).map(c=>c.trim()).filter(c=>c.length>0),o=Math.min(e.length,i.length);if(o===0)return!1;if(o<3)return t.includes(n)||n.includes(t);let r=new Set(i),s=e.filter(c=>r.has(c)).length;return s>=3&&s/o>=.6}function et(t,n){let e;try{e=M(D(t.config.projectRoot,n),"utf-8")}catch{return null}let i=v(t,n,e),o=N(t,"doc-path-tokens",n,i);if(o!==null)try{return JSON.parse(o)}catch{}let r=[...new Set([...e.matchAll(H)].map(s=>s[0].replace(/^\.?\//,"")))];return E(t,"doc-path-tokens",n,i,JSON.stringify(r)),r}export{L as a,w as b,q as c,ft as d,gt as e};
4
- //# sourceMappingURL=chunk-AYYIZ4BA.js.map
@@ -1,2 +0,0 @@
1
- import{g as p}from"./chunk-3UW7VM4H.js";import{a as d,c as f,e as u}from"./chunk-JM72FNGA.js";var m={0:"UnspecifiedKind",1:"AbstractMethod",2:"Accessor",3:"Array",4:"Assertion",5:"AssociatedType",6:"Attribute",7:"Axiom",8:"Boolean",9:"Class",10:"Constant",11:"Constructor",12:"Contract",13:"DataFamily",14:"DefinitionMacro",15:"Delegate",16:"Enum",17:"EnumMember",18:"Error",19:"Event",20:"Fact",21:"Field",22:"File",23:"Function",24:"Getter",25:"Grammar",26:"Instance",27:"Interface",28:"Key",29:"Lang",30:"Lemma",31:"Library",32:"Macro",33:"Method",34:"MethodAlias",35:"MethodReceiver",36:"MethodSpecification",37:"Message",38:"Modifier",39:"Module",40:"Namespace",41:"Null",42:"Number",43:"Object",44:"Operator",45:"Package",46:"PackageObject",47:"Parameter",48:"ParameterLabel",49:"Pattern",50:"Predicate",51:"Property",52:"Protocol",53:"ProtocolMethod",54:"PureVirtualMethod",55:"Quasiquoter",56:"SelfParameter",57:"Setter",58:"Signature",59:"SingletonClass",60:"SingletonMethod",61:"StaticDataMember",62:"StaticEvent",63:"StaticField",64:"StaticMethod",65:"StaticProperty",66:"StaticVariable",67:"String",68:"Struct",69:"Subscript",70:"Tactic",71:"Theorem",72:"ThisParameter",73:"Trait",74:"TraitMethod",75:"Type",76:"TypeAlias",77:"TypeClass",78:"TypeClassMethod",79:"TypeFamily",80:"TypeParameter",81:"Union",82:"Value",83:"Variable"},c=new Map;for(let[e,i]of Object.entries(m))c.set(i.toLowerCase(),Number(e));function y(e){let i=parseInt(e,10);if(!isNaN(i))return i;let s=e.toLowerCase(),n=c.get(s);if(n!==void 0)return n;for(let[r,o]of c)if(r.includes(s))return o;return null}function K(e,i,s={}){let{scope:n,limit:r=100}=s,o=y(i);return o===null?[]:b(e,n).map(t=>({row:t,resolvedKind:g(t)})).filter(t=>t.resolvedKind===o).slice(0,r).map(({row:t,resolvedKind:l})=>({symbol:t.symbol,shortName:f(t.symbol),kind:l,kindName:m[l]??"Unknown",relativePath:t.relative_path,startLine:t.start_line,endLine:t.end_line}))}function P(e,i={}){let s=new Map;for(let n of b(e,i.scope)){let r=g(n);r===null||r===0||s.set(r,(s.get(r)??0)+1)}return[...s.entries()].sort((n,r)=>r[1]-n[1]||n[0]-r[0]).map(([n,r])=>({kind:n,kindName:m[n]??"Unknown",count:r}))}function b(e,i){return p(e,{scope:i}).map(S)}function S(e){return{symbol:e.symbol,kind:e.kind,documentation:e.documentation,enclosing_symbol:e.enclosingSymbol,relative_path:e.relativePath,start_line:e.startLine,end_line:e.endLine}}function g(e){return e.kind!==null&&e.kind!==0?h(e.kind,e.symbol,e.documentation):k(e.symbol,e.documentation,e.enclosing_symbol)}function h(e,i,s){let n=(s??"").toLowerCase();if(u(i)==="type"){if(n.includes("type "))return 76;if(n.includes("interface "))return 27;if(n.includes("struct "))return 68;if(n.includes("trait "))return 73;if(n.includes("class "))return 9}return e}function k(e,i,s){let n=d(e);if("kind"in n)return null;let r=n.descriptors,o=r[r.length-2]??null,a=u(e),t=(i??"").toLowerCase();return a==="type"?t.includes("type ")?76:t.includes("interface ")?27:t.includes("struct ")?68:t.includes("trait ")?73:(t.includes("class "),9):a==="method"?o?.suffix==="type"?33:23:a==="namespace"?39:a!=="term"?null:t.includes("async def ")||t.includes("def ")?23:(s?u(s):o?.suffix??null)==="type"?21:83}export{K as a,P as b};
2
- //# sourceMappingURL=chunk-BKDXBJDQ.js.map
@@ -1,2 +0,0 @@
1
- import{b as G}from"./chunk-B75HZHUP.js";import{a as E}from"./chunk-3ZYF3ELZ.js";import{b as j,e as O,f as B,g as W}from"./chunk-ZQLO2SCU.js";import{a as z}from"./chunk-GZCQTZLK.js";import{c as V,d as U,f as v,j as q}from"./chunk-HVTYSC26.js";import{b as I}from"./chunk-FOQHUKNZ.js";import{f as H,m as x}from"./chunk-3UW7VM4H.js";import{c as F,f as k,g as N,h as T,i as M,j as A}from"./chunk-JM72FNGA.js";import{a as P,d as _}from"./chunk-EWC3UK4V.js";import{a as h}from"./chunk-64MNV6AB.js";import{b as S}from"./chunk-7S5E7KWT.js";var b=new WeakMap;function K(e,n){let t=P(n);return t==="rust"?pe(e,n):t==="typescript"||t==="tsx"||t==="javascript"?de(e,n):[]}var ue=new Set(["describe","it","test","fdescribe","fit","xdescribe","xit","beforeEach","afterEach","beforeAll","afterAll","before","after","suite","bench","benchmark"]);function de(e,n){let t=_(e,n);if(!t)return[];let i=b.get(t);if(i)return i;let r=!1,o=t.rootNode;for(let c of o.namedChildren){if(c.type!=="expression_statement")continue;let l=c.namedChild(0);if(!l||l.type!=="call_expression")continue;let u=l.namedChild(0);if(!u)continue;let a=u.type==="member_expression"?u.namedChild(u.namedChildCount-1)?.text:u.text;if(a&&ue.has(a)){r=!0;break}}let s=[];r&&s.push({startLine:0,endLine:o.endPosition.row,reason:"TS/JS test file (describe/it/test at top level)"});for(let c of o.namedChildren){let l=null,u=null;if(c.type==="function_declaration")l=c.namedChild(0)?.text??null,u=c;else if(c.type==="export_statement"){let a=c.namedChild(0);a?.type==="function_declaration"&&(l=a.namedChild(0)?.text??null,u=a)}else if(c.type==="lexical_declaration"){let a=c.namedChild(0);if(a?.type==="variable_declarator"){let d=a.namedChild(0)?.text,f=a.namedChild(1);d&&(f?.type==="arrow_function"||f?.type==="function_expression")&&(l=d,u=a)}}l&&/^use[A-Z]/.test(l)&&u&&s.push({startLine:u.startPosition.row,endLine:u.endPosition.row,reason:"React custom hook (use*)"})}return s.push(...X(t,new Set(["function_declaration","method_definition","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","variable_declarator","export_statement"]),new Set(["comment"]))),b.set(t,s),s}var fe=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale)?/i;function me(e){return fe.test(e)}function X(e,n,t){let i=[],r=o=>{if(n.has(o.type)&&o.parent){let c=o.parent.children,l=-1;for(let u=0;u<c.length;u+=1)if(c[u].startIndex===o.startIndex&&c[u].type===o.type){l=u;break}if(l>0)for(let u=l-1;u>=0;u-=1){let a=c[u];if(t.has(a.type)){if(me(a.text)){i.push({startLine:o.startPosition.row,endLine:o.endPosition.row,reason:"scip-query suppression comment"});break}continue}if(!(a.type==="attribute_item"||a.type==="inner_attribute_item"))break}}for(let s of o.namedChildren)r(s)};return r(e.rootNode),i}function pe(e,n){let t=_(e,n);if(!t)return[];let i=b.get(t);if(i)return i;let r=[],o=be(t);return o?(b.set(t,o),o):(Z(t.rootNode,r,!1,!1),r.push(...X(t,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"]))),r.push(...ve(t.rootNode)),b.set(t,r),r)}function be(e){return Ee(e.rootNode)?[{startLine:0,endLine:e.rootNode.endPosition.row,reason:"generated file (@generated header)"}]:null}function Z(e,n,t,i){let r=t,o=i;e.type==="trait_item"&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait declaration body (dynamic dispatch)"}),e.type==="impl_item"&&e.childForFieldName("trait")&&(o=!0,n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl block (dynamic dispatch)"})),e.type==="function_item"||e.type==="function_signature_item"?ye(e,n,t,i):i&&_e(e)?n.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,n,t):e.type==="mod_item"&&C(e).some(s=>/#\[\s*cfg\s*\(\s*test\s*\)/.test(s))&&(r=!0);for(let s of e.namedChildren)Z(s,n,r,o)}function ye(e,n,t,i){let r=C(e),o=null;i?o="trait impl method (dynamic dispatch)":t&&(o="inside #[cfg(test)] mod");for(let s of r){let c=xe(s);if(c){o=c;break}if(Q(s)){o="#[allow(dead_code)]";break}}o&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:o})}function ge(e,n,t){let i=C(e),r=e.namedChildren.find(o=>o.type==="type_identifier")?.text;i.some(Se)&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[derive(<reflective>)] \u2014 fields accessed via macro/reflection",containerName:r}),i.some(Q)&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[allow(dead_code)]",containerName:r}),t&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"inside #[cfg(test)] mod",containerName:r})}function C(e){let n=e.parent;if(!n)return[];let t=n.children,i=-1;for(let o=0;o<t.length;o+=1)if(t[o].startIndex===e.startIndex&&t[o].type===e.type){i=o;break}if(i<=0)return[];let r=[];for(let o=i-1;o>=0;o-=1){let s=t[o];if(s.type==="attribute_item"||s.type==="inner_attribute_item")r.push(s.text);else{if(s.type==="line_comment"||s.type==="block_comment")continue;break}}return r}var he=[{re:/#\[\s*tauri::command\b/,reason:"#[tauri::command]"},{re:/#\[\s*command\b/,reason:"#[command]"},{re:/#\[\s*test\b/,reason:"#[test]"},{re:/#\[\s*bench\b/,reason:"#[bench]"},{re:/#\[\s*tokio::test\b/,reason:"#[tokio::test]"},{re:/#\[\s*async_std::test\b/,reason:"#[async_std::test]"},{re:/#\[\s*wasm_bindgen\b/,reason:"#[wasm_bindgen]"},{re:/#\[\s*no_mangle\b/,reason:"#[no_mangle]"},{re:/#\[\s*napi\b/,reason:"#[napi]"},{re:/#\[\s*pyfunction\b/,reason:"#[pyfunction]"},{re:/#\[\s*pymethod\b/,reason:"#[pymethod]"},{re:/#\[\s*pyo3\b/,reason:"#[pyo3]"},{re:/#\[\s*cfg\s*\(\s*test\s*\)/,reason:"#[cfg(test)]"},{re:/#\[\s*doc\s*\(\s*hidden\s*\)/,reason:"#[doc(hidden)]"}];function xe(e){return he.find(({re:n})=>n.test(e))?.reason??null}var Re=[/\bSerialize\b/,/\bDeserialize\b/,/\bFromRow\b/,/\bsqlx::FromRow\b/,/\bDeriveEntityModel\b/,/\bIntoSchema\b/,/\bToSchema\b/,/\bDeriveValueType\b/,/\bError\b/,/\bthiserror::Error\b/];function Se(e){return/#\[\s*derive\s*\(/.test(e)?Re.some(n=>n.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 ve(e){let n=De(e);if(n.size===0)return[];let t=[];for(let i of e.descendantsOfType("mod_item")){let r=i.childForFieldName("name")?.text;r&&n.has(r)&&t.push({startLine:i.startPosition.row,endLine:i.endPosition.row,reason:'serde `with = "..."` module \u2014 body invoked via reflection',containerName:r})}return t}function Ee(e){for(let n=0;n<Math.min(e.namedChildCount,12);n+=1){let t=e.namedChild(n);if(!t||t.type!=="line_comment"&&t.type!=="block_comment")break;if(/@generated\b/.test(t.text)||/This file is .*generated\b/i.test(t.text)||/Code generated by/i.test(t.text)||/Generated by:\s*https?:\/\/openapi-generator/i.test(t.text)||/openapi-generator/i.test(t.text)&&/Generated by/i.test(t.text))return!0}return!1}var Ce=/^#!?\[\s*serde\s*\(/,J=/\bwith\s*=\s*"([^"]+)"/g;function De(e){let n=new Set;for(let t of e.descendantsOfType("attribute_item")){if(!Ce.test(t.text))continue;J.lastIndex=0;let i;for(;(i=J.exec(t.text))!==null;){let r=i[1],o=r.split("::").pop()??r;o&&n.add(o)}}return n}function Y(e){let n=new Map,t=i=>{let r=n.get(i);if(r)return r;let o=K(e,i);return r={ranges:o.map(s=>({startLine:s.startLine,endLine:s.endLine})),containers:new Set(o.map(s=>s.containerName).filter(s=>!!s))},n.set(i,r),r};return(i,r,o,s)=>{let c=t(i);for(let l of c.ranges)if(r>=l.startLine&&r<=l.endLine)return!0;if(s&&c.containers.has(s))return!0;for(let l of x(o))if(c.containers.has(l))return!0;return!1}}function ze(e,n={}){S(e,{groups:n.semanticProvider===!0?["whole-project","semantic-provider"]:["whole-project"]})}function D(e,n,t={}){S(e,{groups:t.definitions===!0?["source-file","definition-catalog"]:["source-file"],file:n.replace(/\\/g,"/")})}function ee(e,n){return n.isIgnoredPath(e.relativePath)?m("ignored-file"):T(e.symbol)?m("module-like-symbol"):$(e.symbol)?!e.isFunctionLike&&e.enclosingSymbol&&$(e.enclosingSymbol)?m("nested-non-callable-value"):!n.includeTests&&!w(e.relativePath)?m("test-file"):!n.includeTests&&n.isExcludedRegion(e.relativePath,e.startLine,e.symbol,e.parentTypeName)?m("excluded-file-region"):M(e.symbol)?m("rust-trait-impl-member"):A(e.symbol)?m("rust-test-module"):!n.includeMembers&&!we(e)?m("member"):e.endLine-e.startLine+1<n.minLoc?m("below-min-loc"):{accepted:!0}:m("non-value-symbol")}function w(e){return j(e)!=="test"}function m(e){return{accepted:!1,rejectionReason:e}}function $(e){return N(e)||e.endsWith("().")||e.endsWith(".")}function we(e){return k(e.symbol)||x(e.symbol).length===0}function te(){return new Map}function ne(e,n,t){let i=new Map;for(let r of V(e,t))e.isIgnored(r.relative_path)||n.has(r.relative_path)||R(i,r.symbol_id,r.relative_path,r.ref_count,"scip-mention");return i}function re(e,n,t){let i=new Set;for(let r of U(e,n))e.isIgnored(r.relative_path)||t.has(r.relative_path)||i.add(r.symbol_id);return i}function L(e,n){let t=e.get(n);if(!t)return!1;for(let i of t.values())if(i.occurrences>0)return!0;return!1}function ie(e){return e?.occurrences??0}function R(e,n,t,i,r="source-fallback"){if(i<=0)return;let o=se(e,n,t);o.occurrences+=i,o.sources.add(r)}function oe(e,n,t,i,r){if(i<=0)return;let o=se(e,n,t);o.occurrences=Math.max(i,o.occurrences),o.sources.add(r)}function se(e,n,t){let i=e.get(n);i||(i=new Map,e.set(n,i));let r=i.get(t);return r||(r={occurrences:0,sources:new Set},i.set(t,r)),r}function mt(e,n={}){let{scope:t,minLoc:i=1,includeTests:r=!1,skipBarrels:o=!1,includeMembers:s=!1,deadCodeOnly:c=!1,scanLimit:l,semantic:u=!0}=n,a=G(Le(e,{scope:t,minLoc:i,includeTests:r,includeMembers:s}),l),d=o?new Set(O(e)):new Set,f=c?te():ne(e,d,a.map(p=>p.symbolId)),y=c?re(e,a.map(p=>p.symbolId),d):new Set,g=c?a.filter(p=>!y.has(p.symbolId)):a;c?Ne(e,g,f,d):ke(e,g,f,d);let ce=c?g.filter(p=>!L(f,p.symbolId)):a;Oe(e,ce,f,{includeTests:r,inactiveBarrelPaths:d,includeSemantic:!c&&u});let le=c?g.filter(p=>!L(f,p.symbolId)):a;return Fe(e,Pe(le,f))}function Le(e,n){let t=Y(e),i=[];for(let r of h(e,{scope:n.scope}))try{for(let o of H(e,r))ee(o,{minLoc:n.minLoc,includeTests:n.includeTests,includeMembers:n.includeMembers,isIgnoredPath:c=>e.isIgnored(c),isExcludedRegion:t}).accepted&&i.push(o)}finally{D(e,r,{definitions:!0})}return i}function Pe(e,n){return e.map(t=>Ie(t,n)).filter(t=>t.cross_file_refs===0).sort((t,i)=>i.loc-t.loc||t.relative_path.localeCompare(i.relative_path)||t.start_line-i.start_line)}function Ie(e,n){let t=n.get(e.symbolId)??new Map,i=ie(t.get(e.relativePath)),r=0;for(let[o,s]of t)o!==e.relativePath&&(r+=s.occurrences);return{relative_path:e.relativePath,start_line:e.startLine,end_line:e.endLine,loc:e.endLine-e.startLine+1,symbol:e.symbol,same_file_refs:i,cross_file_refs:r}}function Fe(e,n){let t=[],i=0,r=0,o=0;for(let s of n){if(e.isIgnored(s.relative_path)||B(e,s.relative_path)||W(e,s.symbol,s.relative_path))continue;let c=s.same_file_refs===0?"dead-code":"file-internal";c==="dead-code"?i++:r++,o+=s.loc,t.push({relativePath:s.relative_path,startLine:s.start_line,endLine:s.end_line,loc:s.loc,symbol:s.symbol,shortName:F(s.symbol),sameFileRefs:s.same_file_refs,kind:c})}return{symbols:t,counts:{total:t.length,deadCode:i,fileInternal:r,loc:o},totalCount:t.length,deadCodeCount:i,fileInternalCount:r,totalLoc:o}}function ke(e,n,t,i){if(n.length===0)return;let r=new E(e),o=new Set(n.map(l=>l.symbolId)),s=new Set(n.map(l=>l.leaf).filter(Boolean)),c=new Set(r.sourceFiles());for(let l of h(e))c.add(l);r.scanSourceReferences({paths:c,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:s,skipPath:l=>i.has(l)},l=>{o.has(l.target.symbolId)&&(Ae(e,l)||R(t,l.target.symbolId,l.sourceFile,je(l),"source-fallback"))})}function Ne(e,n,t,i){if(n.length===0)return;let r=new E(e),o=Te(n),s=new Set(r.sourceFiles());for(let a of h(e))s.add(a);let c=new Set(o.keys()),l=new Map,u=a=>{let d=l.get(a);return d||(d=q(e,a),l.set(a,d)),d};r.scanSourceReferences({paths:s,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:c,skipPath:a=>i.has(a),resolveTargets:({sourceFile:a,name:d,kind:f})=>{let y=o.get(d);return y?Me(a,d,y,u(a),{permissive:f!=="cross-language-dispatch"}):[]},afterPath:a=>{l.delete(a),D(e,a)}},a=>{let d=a.kind==="identifier"&&a.sourceFile===a.target.relativePath?Math.max(0,a.occurrences-1):a.occurrences;a.kind==="identifier"&&ae(e,{sourceFile:a.sourceFile,name:a.name,target:a.target,occurrences:d})||R(t,a.target.symbolId,a.sourceFile,d,"source-fallback")})}function Te(e){let n=new Map;for(let t of e){if(!t.leaf)continue;let i=n.get(t.leaf)??[];i.push(t),n.set(t.leaf,i)}return n}function Me(e,n,t,i,r){let o=t.filter(l=>l.relativePath===e);if(o.length>0)return o;if(!r.permissive&&t.length===1)return[...t];let s=i.get(n);if(s)for(let l of s){let u=t.filter(a=>v(l,a.relativePath));if(u.length>0)return u}let c=new Set;for(let l of i.values())for(let u of l)c.add(u);for(let l of c){let u=t.filter(a=>v(l,a.relativePath));if(u.length>0&&u.length===t.length)return u}return r.permissive?[...t]:[]}function Ae(e,n){return n.kind==="cross-language-dispatch"&&n.target.relativePath===n.sourceFile?!0:n.kind==="identifier"&&ae(e,n)}function je(e){return e.kind==="identifier"&&e.target.relativePath===e.sourceFile?Math.max(0,e.occurrences-1):e.occurrences}function ae(e,n){return n.occurrences>1?!1:I(e,n.sourceFile).some(t=>t.used||t.sourcePath!==n.target.relativePath?!1:t.importedName===n.name||t.localName===n.name)}function Oe(e,n,t,i){for(let r of n){let o=z(e,r,{semantic:i.includeSemantic!==!1});if(o.length!==0)for(let s of o){let c=s.file;c===r.relativePath||e.isIgnored(c)||i.inactiveBarrelPaths.has(c)||!i.includeTests&&!w(c)||oe(t,r.symbolId,c,1,"caller-map")}}}export{ze as a,mt as b};
2
- //# sourceMappingURL=chunk-C3MZZ2ZN.js.map
@@ -1,2 +0,0 @@
1
- import{a as P}from"./chunk-64MNV6AB.js";import{a as j,d as O,f as w}from"./chunk-7S5E7KWT.js";function G(t){return t.replace(/'''[\s\S]*?'''/g,f).replace(/"""[\s\S]*?"""/g,f).replace(/#.*$/gm,f).replace(/\/\/.*$/gm,f).replace(/\/\*[\s\S]*?\*\//g,f).replace(/`(?:\\[\s\S]|[^`])*`/g,f).replace(/'(?:\\.|[^'\\\r\n])*'/g,f).replace(/"(?:\\.|[^"\\\r\n])*"/g,f)}function f(t){return t.replace(/[^\r\n]/g," ")}var Tt=w("stripped-lines",{clearGroups:["whole-project","source-file"]});j({name:"stripped-source-singleton",groups:["whole-project","source-file"],clearAll:()=>{_=null,E=""},clearFile:()=>{_=null,E=""}});var _=null,E="";function V(t){return _===t||(_=t,E=G(t)),E}function Rt(t,n,e){let r=V(t);return`${r.slice(0,n)}${" ".repeat(e-n)}${r.slice(e)}`}function Dt(t,n){return new RegExp(`\\b${v(n)}\\b`,"m").test(t)}function $t(t,n){let e=new Set,r=new RegExp(`\\b${v(n)}\\s*\\.\\s*([A-Za-z_$][\\w$]*)`,"g");for(let o of t.matchAll(r)){let s=o[1];s&&e.add(s)}return[...e]}function v(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function yt(t){let n=0;for(let e of t)e==="("&&(n+=1),e===")"&&(n-=1);return n}import{existsSync as T}from"fs";import{basename as Y,dirname as S,extname as p,join as g,relative as h,resolve as u}from"path";var K=O("indexed-paths",{clearGroups:[]}),m=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue"],X=[".py",".pyi"],b=[".java",".scala",".kt",".kts"],k=[".rs"],A=[".rb"],L=[".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx"],W=[".cs",".vb"],H=[".dart"],U=[".php"],Q=new Set(m),R=new Set(X),J=new Set(b),D=new Set(k),$=new Set(A),M=new Set(L),B=new Set(W),y=new Set(H),z=new Set(U),Z=[{extensions:m,lookup:Q},{extensions:X,lookup:R},{extensions:b,lookup:J},{extensions:k,lookup:D},{extensions:A,lookup:$},{extensions:L,lookup:M},{extensions:W,lookup:B},{extensions:H,lookup:y},{extensions:U,lookup:z}];function x(t,n){return n.has(p(t).toLowerCase())}function q(t){return x(t,R)}function tt(t){return x(t,J)}function nt(t){return x(t,D)}function et(t){return x(t,$)}function rt(t){return x(t,M)}function ot(t){return x(t,B)}function vt(t){return p(t).toLowerCase()===".vb"}function st(t){return x(t,y)}function it(t){return x(t,z)}function ct(t){let n=p(t).toLowerCase();for(let e of Z)if(e.lookup.has(n))return e.extensions;return m}function at(t){return tt(t)||ot(t)||it(t)}function Xt(t,n,e){return q(n)?ut(t,n,e):nt(n)?gt(t,n,e):et(n)?pt(t,n,e):rt(n)?ft(t,n,e):at(n)?St(t,e.replace(/\\/g,"."),ct(n)):st(n)?xt(t,n,e):lt(t,n,e)}function lt(t,n,e){if(!e.startsWith(".")&&!e.startsWith("/"))return null;let r=S(g(t.config.projectRoot,n)),o=u(r,e),s=N(t);for(let c of Nt(o)){let a=d(h(t.config.projectRoot,c));if(s.has(a)||T(c))return a}return d(h(t.config.projectRoot,o))}function ut(t,n,e){let r=N(t),o;if(e.startsWith(".")){let s=e.match(/^(\.+)(.*)$/);if(!s)return null;let c=s[1].length,a=s[2].replace(/^\./,""),i=S(g(t.config.projectRoot,n));for(let l=1;l<c;l++)i=S(i);o=a?u(i,a.replace(/\./g,"/")):i}else o=u(t.config.projectRoot,e.replace(/\./g,"/"));for(let s of dt(o)){let c=d(h(t.config.projectRoot,s));if(r.has(c)||T(s))return c}return null}function gt(t,n,e){if(!e)return null;let r=e.replace(/\s+as\s+.+$/,"").trim();if(!r.startsWith("crate::")&&!r.startsWith("self::")&&!r.startsWith("super::"))return null;let o=S(g(t.config.projectRoot,n)),s;return r.startsWith("crate::")?s=u(t.config.projectRoot,"src",r.slice(7).replace(/::/g,"/")):r.startsWith("self::")?s=u(o,r.slice(6).replace(/::/g,"/")):s=u(S(o),r.slice(7).replace(/::/g,"/")),C(t,Et(s))}function pt(t,n,e){let r=S(g(t.config.projectRoot,n)),o=u(r,e);return C(t,ht(o))}function ft(t,n,e){let r=S(g(t.config.projectRoot,n)),o=[u(r,e),u(t.config.projectRoot,e),u(t.config.projectRoot,"include",e),u(t.config.projectRoot,"src",e)];return C(t,o)}function St(t,n,e){let r=N(t),o=n.replace(/\\/g,".").replace(/::/g,".").replace(/^global::/,""),s=o.replace(/\./g,"/"),c=o.split(".").pop()??o;for(let i of e){let l=`${s}${i}`,I=[...r].find(F=>F.endsWith(l));if(I)return I}for(let i of e){let l=[...r].find(I=>Y(I)===`${c}${i}`);if(l)return l}let a=[...r].filter(i=>e.includes(p(i).toLowerCase())).filter(i=>i.includes(`/${s}/`)||i.includes(`/${c}/`)).sort((i,l)=>i.localeCompare(l));return a.length===1?a[0]:null}function xt(t,n,e){let r=N(t);if(e.startsWith("package:")){let c=e.slice(8),a=c.indexOf("/");if(a<0)return null;let i=c.slice(a+1),l=d(i.startsWith("lib/")?i:`lib/${i}`);return r.has(l)?l:null}let o=S(g(t.config.projectRoot,n)),s=u(o,e);for(let c of mt(s)){let a=d(h(t.config.projectRoot,c));if(r.has(a)||T(c))return a}return null}function dt(t){let n=p(t);return R.has(n)?[t]:[`${t}.py`,`${t}.pyi`,g(t,"__init__.py"),g(t,"__init__.pyi")]}function C(t,n){let e=N(t);for(let r of n){let o=d(h(t.config.projectRoot,r));if(e.has(o)||T(r))return o}return null}function Et(t){let n=p(t);return D.has(n)?[t]:[`${t}.rs`,g(t,"mod.rs")]}function ht(t){let n=p(t);return $.has(n)?[t]:[`${t}.rb`,g(t,"index.rb")]}function mt(t){let n=p(t);return y.has(n)?[t]:[`${t}.dart`,t]}function Nt(t){let n=p(t),e=new Set;if(n){e.add(t);for(let r of m)e.add(t.slice(0,-n.length)+r)}else for(let r of m)e.add(`${t}${r}`),e.add(g(t,`index${r}`));return[...e]}function N(t){return K.get(t,()=>new Set(P(t,{includeIgnored:!1}).map(d)))}function d(t){return t.replace(/\\/g,"/")}export{m as a,X as b,b as c,k as d,A as e,L as f,W as g,H as h,U as i,vt as j,ct as k,Xt as l,ut as m,gt as n,pt as o,ft as p,St as q,xt as r,d as s,G as t,Rt as u,Dt as v,$t as w,yt as x};
2
- //# sourceMappingURL=chunk-CRU42NJU.js.map
@@ -1,2 +0,0 @@
1
- import{a as C,b as F,e as V,f as b,h as g,i as N}from"./chunk-D322LMSA.js";import{c as _}from"./chunk-OBBDKQAG.js";import{e as T}from"./chunk-7S5E7KWT.js";import{ElementTypes as q,NodeTypes as w,parse as W}from"@vue/compiler-dom";import{parse as Ae}from"@vue/compiler-sfc";function P(e,t){return e.split(t).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join("")}var G=T("vue-template-facts"),H=new Set(["component","keep-alive","slot","suspense","teleport","template","transition","transition-group"]),Y=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]),K=new Set(["div","span","template"]),J=new Set(["as","await","break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","false","finally","for","from","function","if","import","in","instanceof","let","new","null","of","return","super","switch","this","throw","true","try","typeof","undefined","var","void","while","with","yield"]);function $(e,t){let n=t.replace(/\\/g,"/"),r=C(e,n);return G.get(e,n,r,()=>Q(n,b(e,n).template))}function Q(e,t){let n={relativePath:e,template:t?{startLine:t.startLine,endLine:t.endLine}:null,componentTags:[],nativeTags:[],builtinTags:[],props:[],events:[],directives:[],slots:[],expressionIdentifiers:[],structuralTokens:[]};if(!t)return n;let r;try{r=W(t.body,{comments:!1})}catch{return n}let i=new Set,o=s=>{s.trim()&&i.add(s)};return E(r.children,t.startLine,n,o),n.structuralTokens=[...i].sort(),n}function E(e,t,n,r){for(let i of e)i.type===w.ELEMENT&&(X(i,t,n,r),E(i.children,t,n,r))}function X(e,t,n,r){let i=ae(e.tag),o={tag:e.tag,normalized:i,kind:se(e),startLine:h(t,e.loc.start.line),endLine:h(t,e.loc.end.line)};o.kind==="component"?(n.componentTags.push(o),r(`component:${i}`)):o.kind==="builtin"?(n.builtinTags.push(o),r(`builtin:${i}`)):(n.nativeTags.push(o),K.has(e.tag)||r(`native:${e.tag}`));for(let s of e.props)ee(s,t,n,r)}function ee(e,t,n,r){if(e.type===w.ATTRIBUTE){let a=e.value?.content??null,u=A("prop",e.name,a,t,e.loc.start.line,e.loc.end.line);n.props.push(u),r(`prop:${e.name}`);return}let i=ne(e),o=B(e.exp),s=A(te(e.name),i,o,t,e.loc.start.line,e.loc.end.line);switch(s.kind){case"prop":n.props.push(s),r(`prop:${i}`);break;case"event":n.events.push(s),r(`event:${i}`);break;case"slot":n.slots.push(s),r(`slot:${i}`);break;case"directive":n.directives.push(s),r(`directive:${i}`);break}o&&re(o,t,e.loc.start.line,n,r)}function A(e,t,n,r,i,o){return{kind:e,name:t,value:n,startLine:h(r,i),endLine:h(r,o)}}function te(e){switch(e){case"bind":case"model":return"prop";case"on":return"event";case"slot":return"slot";default:return"directive"}}function ne(e){let t=B(e.arg);return t||e.name}function B(e){if(!e)return null;let t=("content"in e&&typeof e.content=="string"?e.content:e.loc.source).trim();return t||null}function re(e,t,n,r,i){for(let o of ie(e)){let s={name:o,startLine:h(t,n),endLine:h(t,n)};r.expressionIdentifiers.push(s),i(`id:${o}`)}}function ie(e){let t=new Set,n=oe(e),r=/\b[A-Za-z_$][A-Za-z0-9_$]*\b/g,i;for(;i=r.exec(n);){let o=i[0];J.has(o)||/^[A-Z_]+$/.test(o)||t.add(o)}return[...t].sort()}function oe(e){return e.replace(/\/\*[\s\S]*?\*\//g," ").replace(/\/\/.*$/gm," ").replace(/`(?:\\[\s\S]|\$\{([^}]*)\}|[^`\\])*`/g,(t,n)=>n??" ").replace(/'(?:\\[\s\S]|[^'\\])*'/g," ").replace(/"(?:\\[\s\S]|[^"\\])*"/g," ")}function se(e){let t=e.tag;return e.tagType===q.COMPONENT?"component":H.has(t)?"builtin":Y.has(t)?"native":/^[A-Z]/.test(t)||t.includes("-")?"component":"native"}function ae(e){return P(e,/[-_:]/)}function h(e,t){return e+Math.max(0,t-1)}function S(e){return e.type==="comment"||e.type==="line_comment"||e.type==="block_comment"}var ce=new Set(["function_declaration","method_definition","method_signature","function_signature"]);function D(e,t){let n=le(e,t);if(n)return{name:n.name,startLine:n.definitionNode.startPosition.row,endLine:n.definitionNode.endPosition.row,paramCount:R(n.functionNode),params:k(n.functionNode),paramsEndLine:I(n.functionNode),isLiteralPassthrough:z(n.functionNode,t)};if(!ue(e.type,t))return null;let r=e.childForFieldName("name")??e.namedChildren.find(i=>i.type==="identifier"||i.type==="property_identifier");return r?{name:r.text,startLine:e.startPosition.row,endLine:e.endPosition.row,paramCount:R(e),params:k(e),paramsEndLine:I(e),isLiteralPassthrough:z(e,t)}:null}function U(e){return e.namedChildren.find(t=>t.type==="parameters"||t.type==="formal_parameters")}function k(e){let t=U(e);if(!t)return[];let n=[];for(let r of t.namedChildren){if(S(r))continue;if(r.type==="identifier"){n.push({name:r.text,simple:!0});continue}let i=r.namedChildren.some(a=>a.type.endsWith("_modifier"))||/^\s*(?:public|private|protected|readonly|override)\b/.test(r.text),o=r.childForFieldName("pattern");if(!i&&o&&o.type==="identifier"){n.push({name:o.text,simple:!0});continue}let s=r.namedChildren.find(a=>a.type==="identifier");n.push({name:o?.type==="identifier"?o.text:s?.text??"",simple:!1})}return n}function I(e){let t=U(e);return t?t.endPosition.row:e.startPosition.row}function ue(e,t){return t==="rust"?e==="function_item"||e==="function_signature_item":t==="python"?e==="function_definition":t==="typescript"||t==="tsx"||t==="javascript"?ce.has(e):!1}function le(e,t){if(t!=="typescript"&&t!=="tsx"&&t!=="javascript")return null;if(e.type==="variable_declarator"){let n=e.childForFieldName("name")??e.namedChild(0),r=e.childForFieldName("value")??e.namedChild(1);return!n||!r||r.type!=="arrow_function"&&r.type!=="function_expression"?null:{name:n.text,definitionNode:e,functionNode:r}}if(e.type==="public_field_definition"){let n=e.childForFieldName("name")??e.namedChild(0),r=e.childForFieldName("value")??e.namedChild(1);return!n||!r||r.type!=="arrow_function"&&r.type!=="function_expression"?null:{name:n.text,definitionNode:e,functionNode:r}}return null}function R(e){let t=e.namedChildren.find(r=>r.type==="parameters"||r.type==="formal_parameters");if(!t)return 0;let n=0;for(let r of t.namedChildren)S(r)||(n+=1);return n}function z(e,t){let n=e.namedChildren.find(c=>c.type==="block"||c.type==="statement_block");if(!n)return!1;let r=n.namedChildren.filter(c=>!S(c));if(r.length!==1)return!1;let i=r[0],o=null;if(i.type==="return_statement"||i.type==="expression_statement"?o=i.namedChild(0)??null:t==="rust"&&(i.type==="call_expression"||i.type==="macro_invocation")&&(o=i),!o)return!1;let s=t==="python"?"call":"call_expression";if(o.type!==s)return!1;let a=o.namedChildren.find(c=>c.type==="arguments"||c.type==="argument_list");if(!a)return!1;let u=a.namedChildren.filter(c=>!S(c)),l=e.namedChildren.find(c=>c.type==="parameters"||c.type==="formal_parameters");if(!l)return!1;let m=[];for(let c of l.namedChildren){if(c.type==="identifier"){m.push(c.text);continue}let f=c.namedChildren.find(v=>v.type==="identifier");f&&m.push(f.text)}if(u.length!==m.length)return!1;for(let c=0;c<m.length;c+=1){let f=u[c];if(f.type!=="identifier"||f.text!==m[c])return!1}return!0}var pe=new Set(["ref","shallowRef","reactive","computed","watch","watchEffect"]),me=new Set(["onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","onActivated","onDeactivated","onErrorCaptured"]),fe=new Set(["axios","fetch","runRequest","useAsyncData","useFetch","useResource"]),de=new Set(["defineEmits","defineExpose","defineModel","defineOptions","defineProps","withDefaults"]),ge=new Set(["catch","for","function","if","return","switch","while"]);function j(e){let t={imports:[],functions:[],calls:[],composables:[],stores:[],reactivity:[],lifecycle:[],requests:[],macros:[],lineCount:0,externalLineCount:0,externalScriptPaths:[],unresolvedScripts:[]};for(let n of e.scripts){t.lineCount+=g(n),n.external&&(t.externalLineCount+=g(n),t.externalScriptPaths.push(n.sourcePath));for(let i of n.errors)t.unresolvedScripts.push({sourcePath:n.sourcePath,reason:i});if(!n.body||!n.astLanguage){n.astLanguage||t.unresolvedScripts.push({sourcePath:n.sourcePath,reason:`Unsupported Vue script language: ${n.lang??"unknown"}`});continue}t.imports.push(...be(n));let r=V(n.astLanguage,n.body);r?ye(n,r.rootNode,t):Se(n,t)}return he(t),t.externalScriptPaths=Z(t.externalScriptPaths),t}function he(e){e.composables=y(e,"composable"),e.stores=y(e,"store"),e.reactivity=y(e,"reactivity"),e.lifecycle=y(e,"lifecycle"),e.requests=y(e,"request"),e.macros=y(e,"macro")}function y(e,t){return Z(e.calls.filter(n=>n.categories.includes(t)).map(n=>n.name))}function ye(e,t,n){let r=new Set,i=new Set,o=s=>{let a=D(s,e.astLanguage);if(a){let l=`${a.name}:${a.startLine}:${a.endLine}`;i.has(l)||(i.add(l),n.functions.push({name:a.name,sourcePath:e.sourcePath,startLine:e.startLine+a.startLine,endLine:e.startLine+a.endLine,setup:e.setup}))}let u=N(s,e.astLanguage);if(u){let l=`${u.calleeLeaf}:${u.line}`;r.has(l)||(r.add(l),n.calls.push({name:u.calleeLeaf,sourcePath:e.sourcePath,line:e.startLine+u.line,categories:O(u.calleeLeaf),setup:e.setup}))}for(let l of s.children)o(l)};o(t)}function Se(e,t){for(let n of e.body.matchAll(/\b([A-Za-z_$][\w$]*)\s*\(/g)){let r=n[1];!r||ge.has(r)||t.calls.push({name:r,sourcePath:e.sourcePath,line:e.startLine+L(e.body,n.index??0),categories:O(r),setup:e.setup})}for(let n of e.body.matchAll(/\bfunction\s+([A-Za-z_$][\w$]*)\b/g)){let r=n[1];if(!r)continue;let i=e.startLine+L(e.body,n.index??0);t.functions.push({name:r,sourcePath:e.sourcePath,startLine:i,endLine:i,setup:e.setup})}for(let n of e.body.matchAll(/\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(?:async\s*)?(?:function\b|\([^)]*\)\s*=>|[A-Za-z_$][\w$]*\s*=>)/g)){let r=n[1];if(!r)continue;let i=e.startLine+L(e.body,n.index??0);t.functions.push({name:r,sourcePath:e.sourcePath,startLine:i,endLine:i,setup:e.setup})}}function be(e){let t=[];for(let n of e.body.matchAll(/\bimport\s+(?:type\s+)?([^'";]+?)\s+from\s+['"]([^'"]+)['"]/g)){let r=n[1]?.trim(),i=n[2];if(!r||!i)continue;let o=e.startLine+L(e.body,n.index??0);for(let s of Le(r))t.push({local:s,source:i,sourcePath:e.sourcePath,line:o,setup:e.setup})}return t}function Le(e){let t=[],r=e.split(",").map(s=>s.trim()).filter(Boolean)[0];r&&!r.startsWith("{")&&!r.startsWith("*")&&t.push(r);let i=/\{([^}]*)\}/.exec(e)?.[1];if(i)for(let s of i.split(",")){let a=s.trim();if(!a)continue;let u=/\bas\s+([A-Za-z_$][\w$]*)$/.exec(a)?.[1];t.push(u??a.replace(/^type\s+/,"").trim())}let o=/\*\s+as\s+([A-Za-z_$][\w$]*)/.exec(e)?.[1];return o&&t.push(o),t.filter(s=>/^[A-Za-z_$][\w$]*$/.test(s))}function O(e){let t=["call"];return/^use[A-Z0-9_]/.test(e)&&t.push("composable"),/^use[A-Z0-9_].*Store$/.test(e)&&t.push("store"),pe.has(e)&&t.push("reactivity"),me.has(e)&&t.push("lifecycle"),fe.has(e)&&t.push("request"),de.has(e)&&t.push("macro"),t}function L(e,t){let n=0;for(let r=0;r<t&&r<e.length;r+=1)e.charCodeAt(r)===10&&(n+=1);return n}function Z(e){return[...new Set(e)].sort()}var ve=new Set(["in","key","of"]),xe=new Set(["computed","defineEmits","defineProps","reactive","ref","watch","watchEffect"]);function Ye(e,t={}){let n=_(e,{extensions:[".vue"]}).filter(i=>!t.scope||i.includes(t.scope)).sort();return(typeof t.scanLimit=="number"&&t.scanLimit>0?n.slice(0,t.scanLimit):n).map(i=>Te(e,i)).filter(i=>(t.minTemplateTokens===void 0||i.templateTokens.size>=t.minTemplateTokens)&&(t.minBehaviorTokens===void 0||i.behaviorTokens.size>=t.minBehaviorTokens))}function Te(e,t){let n=t.replace(/\\/g,"/"),r=b(e,n),i=$(e,n),o=j(r),s=Fe(i),a=i.expressionIdentifiers.map(p=>p.name).filter(p=>!s.includes(p)).filter((p,d,x)=>x.indexOf(p)===d).sort(),u=i.componentTags.map(p=>p.normalized).filter((p,d,x)=>x.indexOf(p)===d).sort(),l=F(e,n).length,m=g(r.template),c=o.lineCount,f=r.styles.reduce((p,d)=>p+g(d),0),v=r.customBlocks.reduce((p,d)=>p+g(d),0);return{file:n,sfc:r,templateFacts:i,scriptFacts:o,templateTokens:new Set(i.structuralTokens),behaviorTokens:Ce(i,o,a),templateBindingNames:a,templateLocalNames:s,componentNames:u,sfcLines:l,totalLines:l+o.externalLineCount,templateLines:m,scriptLines:c,styleLines:f,externalScriptLines:o.externalLineCount,externalScriptPaths:o.externalScriptPaths,customBlockLines:v}}function Ce(e,t,n){let r=new Set;for(let i of t.composables)r.add(`composable:${i}`);for(let i of t.stores)r.add(`store:${i}`);for(let i of t.reactivity)r.add(`reactivity:${i}`);for(let i of t.lifecycle)r.add(`lifecycle:${i}`);for(let i of t.requests)r.add(`request:${i}`);for(let i of t.macros)r.add(`macro:${i}`);for(let i of t.functions){if(xe.has(i.name))continue;r.add(`function:${i.name}`);let o=/^[a-z]+/.exec(i.name)?.[0]??null;o&&o.length>2&&o!==i.name&&r.add(`function-verb:${o}`)}for(let i of e.events)r.add(`template-event:${i.name}`);for(let i of n)r.add(`template-binding:${i}`);return r}function Fe(e){let t=new Set;for(let n of e.directives)if(n.name==="for"&&n.value)for(let r of Ve(n.value))t.add(r);for(let n of e.slots)if(n.value)for(let r of M(n.value))t.add(r);return[...t].sort()}function Ve(e){let t=/^(.*?)\s+(?:in|of)\s+/.exec(e.trim());return t?M(t[1]??""):[]}function M(e){let t=[];for(let n of e.matchAll(/\b[A-Za-z_$][\w$]*\b/g)){let r=n[0];ve.has(r)||t.push(r)}return t}export{D as a,P as b,Ye as c};
2
- //# sourceMappingURL=chunk-ERHOS6AW.js.map
@@ -1,4 +0,0 @@
1
- import{a as te,b as re,c as b,d as se,e as ne,f as oe,g as j,h as ie,i as U,j as ae,k as pe,l as E,m as W,n as T,o as V,p as z,q as S,r as Q,s as J,u as R,v as h,w as M,x as G}from"./chunk-CRU42NJU.js";import{b as le}from"./chunk-ERHOS6AW.js";import{a as ce,b as me,d as C}from"./chunk-EWC3UK4V.js";import{a as v}from"./chunk-D322LMSA.js";import{c as L}from"./chunk-7S5E7KWT.js";import{basename as ue}from"path";var ke=new Set(["identifier","type_identifier","property_identifier","shorthand_property_identifier","field_identifier"]);function x(t){let r=[],e=0,s=0;for(let n=0;n<t.length;n++){let o=t[n];(o==="{"||o==="["||o==="(")&&e++,(o==="}"||o==="]"||o===")")&&e--,o===","&&e===0&&(r.push(t.slice(s,n)),s=n+1)}return r.push(t.slice(s)),r}function y(t,r){for(let e of t.namedChildren)if(e.type===r)return e;return null}function g(t,r){let e=new Set,s=(n,o)=>{let i=o||r.has(n.type);!i&&ke.has(n.type)&&e.add(n.text);for(let a of n.children)s(a,i)};return s(t.rootNode,!1),e}function P(t,r,e,s,n,o,i){return{importedName:n,localName:o,sourcePath:i??S(t,s,pe(r)),kind:"named",used:h(e,o),usedMembers:[]}}function f(t,r,e,s,n="named",o={}){return{importedName:t,localName:r,sourcePath:e,kind:n,used:s.has(r),usedMembers:[],isTypeOnly:o.isTypeOnly}}function $(t,r,e,s,n="named",o=[],i={}){return{importedName:t,localName:r,sourcePath:e,kind:n,used:s,usedMembers:o,isTypeOnly:i.isTypeOnly}}function D(t,r){return{importedName:t,localName:null,sourcePath:r,kind:"side-effect",used:!0,usedMembers:[]}}function O(t,r,e={}){return{importedName:t,localName:e.localName??null,sourcePath:r,kind:"namespace",used:e.used??!0,usedMembers:e.usedMembers??[],isTypeOnly:e.isTypeOnly}}function N(t,r,e){let s=[];for(let n of t.matchAll(r)){let o=n[0];if(!o||typeof n.index!="number")continue;let i=R(t,n.index,n.index+o.length);for(let a of e(n,i))s.push(a)}return s}function I(t,r,e,s){let n=C(t,r);if(n){let o=e(n);if(o)return o}return s()}function X(t,r,e,s){let n=C(t,r),o=ce(r),i=o?e[o]:void 0;return n&&i?i(n):s()}function de(t,r,e){return I(t,r,s=>we(t,r,s),()=>Ae(t,r,e))}function Ae(t,r,e){return N(e,/^[ \t]*#include\s+[<"]([^">]+)[">]\s*$/gm,(s,n)=>{let o=s[1]?.trim();if(!o)return[];let i=ue(o).replace(/\.[^.]+$/,"");return[$(o,i,z(t,r,o),h(n,i))]})}function we(t,r,e){let s=g(e,new Set(["preproc_include"])),n=[];for(let o of e.rootNode.descendantsOfType("preproc_include")){let i=null;for(let p of o.namedChildren){if(p.type==="system_lib_string"){i=p.text.replace(/^<|>$/g,"");break}if(p.type==="string_literal"){i=p.namedChildren.find(c=>c.type==="string_content")?.text??p.text.replace(/^"|"$/g,"");break}}if(!i)continue;let a=ue(i).replace(/\.[^.]+$/,"");n.push(f(i,a,z(t,r,i),s))}return n}function fe(t,r,e){let s=[];for(let n of e.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 p=R(e,n.index,n.index+a.length);s.push({importedName:o,localName:i,sourcePath:Q(t,r,o),kind:i?"namespace":"side-effect",used:i?h(p,i):!0,usedMembers:i?M(p,i):[]})}return s}function ge(t,r,e){let s=[];for(let n of e.matchAll(/^[ \t]*export\s+['"]([^'"]+)['"][\s\S]*?;$/gm)){let o=n[1]?.trim();o&&s.push({specifier:o,sourcePath:Q(t,r,o)})}return s}function Se(t,r,e){return X(t,r,{csharp:s=>je(t,r,s),vb:s=>Le(t,r,s)},()=>{let s=ae(r)?/^[ \t]*Imports\s+(.+?)\s*$/gm:/^[ \t]*using\s+(.+?)\s*;$/gm;return N(e,s,(n,o)=>{let i=n[1]?.trim();if(!i)return[];let[a,p]=i.split(/\s*=\s*/),m=!!p,c=(m?p:a)?.trim()??i,l=c.split(".").pop()??c,u=m?a?.trim()??l:l;return[P(t,r,o,c,l,u,S(t,c,j))]})})}function Le(t,r,e){let s=g(e,new Set(["imports_statement"])),n=[];for(let o of e.rootNode.descendantsOfType("imports_statement")){let i=o.namedChildren.filter(u=>u.type==="namespace_name");if(i.length===0)continue;let a=i[i.length-1],p=i.length>1?i[0]:null,m=a.text,c=m.split(".").pop()??m,l=p?.text??c;n.push(f(c,l,S(t,m,j),s,p?"namespace":"named"))}return n}function je(t,r,e){let s=g(e,new Set(["using_directive"])),n=[];for(let o of e.rootNode.descendantsOfType("using_directive")){let i=o.namedChildren;if(i.length===0)continue;let a=null,p;i.length>=2&&i[0].type==="identifier"&&(i[1].type==="qualified_name"||i[1].type==="identifier")?(a=i[0],p=i[1]):p=i[i.length-1];let m=p.text,c=m.split(".").pop()??m,l=a?.text??c;n.push(f(c,l,S(t,m,j),s,a?"namespace":"named"))}return n}var ve=L("vue-non-script-identifiers",{clearGroups:["whole-project","source-file"]});function he(t,r){return ve.get(t,r,()=>{let e=new Set,s=v(t,r);if(!s)return e;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))e.add(i[0]);return e})}function Y(t,r,e){return I(t,r,s=>$e(t,r,s),()=>Me(t,r,e))}function Me(t,r,e){return Qe(e).flatMap(s=>Ge(t,r,s.clause,s.specifier,s.start,s.end,e))}function $e(t,r,e){let s=qe(t,r,e),n=[];for(let o of e.rootNode.descendantsOfType("import_statement"))n.push(...Ue(t,r,e,o,s));return n}function qe(t,r,e){let s=g(e,new Set(["import_statement"]));if(me(r))for(let n of he(t,r))s.add(n);return s}function Ue(t,r,e,s,n){let o=Be(s);if(!o)return[];let i=E(t,r,o),a=y(s,"import_clause");return a?We(e,a,i,n,He(s.text)):[D("*",i)]}function We(t,r,e,s,n){let o=[];for(let i of r.namedChildren)if(i.type==="identifier")o.push(Fe(i.text,e,s,n));else if(i.type==="namespace_import"){let a=Je(t,i,e,s,n);a&&o.push(a)}else i.type==="named_imports"&&o.push(...Xe(i,e,s,n));return o}function Fe(t,r,e,s){return f("default",t,r,e,"default",{isTypeOnly:s})}function Je(t,r,e,s,n){let i=y(r,"identifier")?.text??"";if(!i)return null;let a=ze(t,i);return O("*",e,{localName:i,usedMembers:a,isTypeOnly:n,used:a.length>0||s.has(i)})}function Xe(t,r,e,s){let n=[];for(let o of t.namedChildren){if(o.type!=="import_specifier")continue;let i=o.namedChild(0),a=o.namedChild(1);if(!i)continue;let p=i.text,m=a?.text??p;n.push(f(p,m,r,e,"named",{isTypeOnly:s||Ve(o.text)}))}return n}function Be(t){let r=y(t,"string");if(!r)return null;let e=y(r,"string_fragment");return e?e.text:null}function He(t){return/^\s*import\s+type\b/.test(t)}function Ve(t){return/^\s*type\b/.test(t.trim())}function ze(t,r){let e=new Set;for(let s of t.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")&&e.add(o.text)}return[...e]}function Qe(t){let r=[],e=/^[ \t]*import\s+([\s\S]*?)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let n of t.matchAll(e)){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 t.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 Ge(t,r,e,s,n,o,i){let a=E(t,r,s),p=R(i,n,o);return e?Ye(e).map(c=>({...c,sourcePath:a})).map(c=>{if(c.kind==="namespace"){let l=M(p,c.localName);return O(c.importedName,c.sourcePath,{localName:c.localName,usedMembers:l,used:l.length>0||h(p,c.localName),isTypeOnly:c.isTypeOnly})}return c.kind==="side-effect"?D(c.importedName,c.sourcePath):$(c.importedName,c.localName??"",c.sourcePath,c.localName?h(p,c.localName):!1,c.kind,[],{isTypeOnly:c.isTypeOnly})}):[D("*",a)]}function Ye(t){let r=t.trim(),e=/^type\b/.test(r),s=r.replace(/^type\s+/,""),[n,o]=Ke(s),i=[];return n&&i.push(...xe(n,e)),o&&i.push(...xe(o,e)),i}function xe(t,r){let e=t.trim();if(!e)return[];if(e.startsWith("{")){let s=e.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+/,""),[p,m]=a.split(/\s+as\s+/);return{importedName:p.trim(),localName:(m??p).trim(),kind:"named",isTypeOnly:i}}):[]}return e.startsWith("* as ")?[{importedName:"*",localName:e.slice(5).trim(),kind:"namespace",isTypeOnly:r}]:[{importedName:"default",localName:e,kind:"default",isTypeOnly:r}]}function Ke(t){let r=0;for(let e=0;e<t.length;e++){let s=t[e];if(s==="{"&&r++,s==="}"&&r--,s===","&&r===0)return[t.slice(0,e).trim(),t.slice(e+1).trim()]}return[t.trim(),null]}function K(t,r,e){let s=C(t,r);return s?nt(t,r,s):Ze(t,r,e)}function Ze(t,r,e){return[...et(t,r,e),...tt(t,r,e),...rt(t,r,e)]}function et(t,r,e){let s=[],n=/^[ \t]*export\s+(?:type\s+)?\{([\s\S]*?)\}\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of e.matchAll(n)){if(typeof o.index!="number")continue;let i=o[1]??"",a=o[2]??"",p=x(i).map(l=>st(l.trim())).filter(l=>!!l),m=q(e,o.index),c=q(e,o.index+o[0].length-1);s.push({kind:"named",sourcePath:E(t,r,a),names:p,startLine:m,endLine:c})}return s}function tt(t,r,e){let s=[],n=/^[ \t]*export\s+\*\s+as\s+(\w+)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of e.matchAll(n)){if(typeof o.index!="number")continue;let i=o[2]??"",a=q(e,o.index),p=q(e,o.index+o[0].length-1);s.push({kind:"star-as",sourcePath:E(t,r,i),names:[],startLine:a,endLine:p})}return s}function rt(t,r,e){let s=[],n=/^[ \t]*export\s+\*\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of e.matchAll(n)){if(typeof o.index!="number")continue;let i=o[1]??"",a=q(e,o.index),p=q(e,o.index+o[0].length-1);s.push({kind:"star",sourcePath:E(t,r,i),names:[],startLine:a,endLine:p})}return s}function st(t){if(!t)return null;let r=t.replace(/^type\s+/,"").trim();if(!r)return null;let e=r.match(/^(\w+)\s+as\s+(\w+)$/);if(e)return e[2]??null;let s=r.match(/^(\w+)$/);return s?s[1]??null:null}function q(t,r){let e=0;for(let s=0;s<r&&s<t.length;s++)t.charCodeAt(s)===10&&e++;return e}function nt(t,r,e){let s=[];for(let n of e.rootNode.descendantsOfType("export_statement")){let o=ot(t,r,n);if(o===void 0)continue;let i=n.startPosition.row,a=n.endPosition.row,p=it(n,o,i,a);s.push(p)}return s}function ot(t,r,e){let s=y(e,"string");if(!s)return;let n=y(s,"string_fragment");if(n)return E(t,r,n.text)}function it(t,r,e,s){let n=y(t,"export_clause");if(n){let i=[];for(let a of n.namedChildren){if(a.type!=="export_specifier")continue;let p=a.namedChild(0),m=a.namedChild(1);p&&i.push((m??p).text)}return{kind:"named",sourcePath:r,names:i,startLine:e,endLine:s}}return y(t,"namespace_export")?{kind:"star-as",sourcePath:r,names:[],startLine:e,endLine:s}:{kind:"star",sourcePath:r,names:[],startLine:e,endLine:s}}function ye(t,r,e){return X(t,r,{java:s=>at(t,r,s),kotlin:s=>pt(t,r,s),scala:s=>ct(t,r,s)},()=>N(e,/^[ \t]*import\s+(?:static\s+)?(.+?)\s*;?$/gm,(s,n)=>{let o=s[1]?.trim();return o?mt(t,r,o,n):[]}))}function at(t,r,e){let s=g(e,new Set(["import_declaration"])),n=[];for(let o of e.rootNode.descendantsOfType("import_declaration")){let i=o.children.some(l=>l.type==="asterisk"),p=o.namedChildren.find(l=>l.type==="scoped_identifier")??o.namedChildren.find(l=>l.type==="identifier");if(!p)continue;let m=p.text;if(i){n.push(O("*",S(t,m,b)));continue}let c=m.split(".").pop()??m;n.push(f(c,c,S(t,m,b),s))}return n}function pt(t,r,e){let s=g(e,new Set(["import_header","import_list"])),n=[];for(let o of e.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"),p=o.namedChildren.find(d=>d.type==="import_alias");if(a){n.push(O("*",S(t,i.text,b)));continue}let m=i.text,c=m.split(".").pop()??m,u=p?.namedChild(0)?.text??c;n.push(f(c,u,S(t,m,b),s))}return n}function ct(t,r,e){let s=g(e,new Set(["import_declaration"])),n=[];for(let o of e.rootNode.descendantsOfType("import_declaration")){let i=o.namedChildren.find(l=>l.type==="namespace_selectors"||l.type==="namespace_wildcard"),a=o.namedChildren.filter(l=>l!==i&&(l.type==="identifier"||l.type==="stable_identifier")),p=a.map(l=>l.text).join(".");if(!p)continue;if(i?.type==="namespace_wildcard"){n.push(O("*",S(t,p,b)));continue}if(i?.type==="namespace_selectors"){for(let l of i.namedChildren)if(l.type==="arrow_renamed_identifier"){let[u,d]=l.namedChildren;if(!u)continue;let _=u.text,A=d?.text??_;if(_==="_")continue;n.push(f(_,A,S(t,`${p}.${_}`,b),s))}else if(l.type==="identifier"){let u=l.text;n.push(f(u,u,S(t,`${p}.${u}`,b),s))}continue}let m=a[a.length-1]?.text??p,c=a.slice(0,-1).map(l=>l.text).join(".")||p;n.push(f(m,m,S(t,c&&a.length>1?`${c}.${m}`:p,b),s))}return n}function mt(t,r,e,s){if(e.includes("{")&&e.includes("}")){let n=e.slice(0,e.indexOf("{")).replace(/\.$/,"").trim(),o=e.slice(e.indexOf("{")+1,e.lastIndexOf("}")).trim();return x(o).flatMap(i=>{let a=i.trim();if(!a)return[];let[p,m]=a.includes("=>")?a.split(/\s*=>\s*/):a.split(/\s+as\s+/),c=p?.trim();if(!c||c==="_")return[];let l=(m??c.split(".").pop()??c).trim(),u=c==="_"?n:`${n}.${c}`.replace(/\.\./g,".");return[P(t,r,s,u,c,l)]})}return[P(t,r,s,e,e.split(".").pop()??e,e.split(".").pop()??e)]}function Ie(t,r,e){return I(t,r,s=>lt(t,r,s),()=>N(e,/^[ \t]*use\s+(.+?)\s*;$/gm,(s,n)=>{let o=s[1]?.trim();return o?x(o).flatMap(i=>{let a=i.trim();if(!a)return[];let[p,m]=a.split(/\s+as\s+/i),c=p?.trim()??a,l=c.split("\\").pop()??c,u=(m??l).trim();return[P(t,r,n,c,l,u,S(t,c.replace(/\\/g,"."),U))]}):[]}))}function lt(t,r,e){let s=g(e,new Set(["namespace_use_declaration"])),n=[],o=(i,a,p)=>{n.push(f(a,p,S(t,i.replace(/\\/g,"."),U),s))};for(let i of e.rootNode.descendantsOfType("namespace_use_declaration")){let a=i.namedChildren.find(p=>p.type==="namespace_use_group");if(a){let p=i.namedChildren.find(m=>m.type==="namespace_name")?.text??"";for(let m of a.namedChildren){if(m.type!=="namespace_use_clause")continue;let{importedName:c,localName:l,qualified:u}=Ne(m,p);c&&o(u,c,l)}continue}for(let p of i.namedChildren){if(p.type!=="namespace_use_clause")continue;let{importedName:m,localName:c,qualified:l}=Ne(p,"");m&&o(l,m,c)}}return n}function Ne(t,r){let e=t.namedChildren.find(m=>m.type==="qualified_name"),s=t.namedChildren.filter(m=>m.type==="name"),n="";e?n=e.text:s.length>=1&&(n=s[0].text);let o=e&&s.length>0?s[s.length-1]:null,i=n.split("\\").pop()??n,a=o?.text??i,p=r?`${r}\\${n}`:n;return{importedName:i,localName:a,qualified:p}}function Pe(t,r,e){return I(t,r,s=>ut(t,r,s),()=>ft(e).flatMap(s=>St(t,r,s,e)))}function ut(t,r,e){let s=g(e,new Set(["import_statement","import_from_statement"])),n=[];for(let o of e.rootNode.descendantsOfType("import_statement"))for(let i of o.namedChildren){let a=be(i);if(!a)continue;let p=W(t,r,a.qualifiedName);n.push({importedName:a.qualifiedName,localName:a.localName,sourcePath:p,kind:"namespace",used:s.has(a.localName),usedMembers:[]})}for(let o of e.rootNode.descendantsOfType("import_from_statement")){let i=o.namedChild(0);if(!i)continue;let a=dt(i);if(a===null)continue;let p=W(t,r,a);for(let m=1;m<o.namedChildCount;m+=1){let c=o.namedChild(m);if(c.type==="wildcard_import"){n.push({importedName:"*",localName:null,sourcePath:p,kind:"side-effect",used:!0,usedMembers:[]});continue}let l=be(c);l&&n.push({importedName:l.qualifiedName,localName:l.localName,sourcePath:p,kind:"named",used:s.has(l.localName),usedMembers:[]})}}return n}function be(t){if(t.type==="aliased_import"){let r=t.namedChild(0),e=t.namedChild(1);return!r||!e?null:{qualifiedName:r.text,localName:e.text}}if(t.type==="dotted_name"){let r=t.text;return{qualifiedName:r,localName:r.split(".")[0]??r}}return t.type==="identifier"?{qualifiedName:t.text,localName:t.text}:null}function dt(t){if(t.type==="dotted_name")return t.text;if(t.type==="relative_import"){let r=y(t,"import_prefix")?.text??"",e=y(t,"dotted_name")?.text??"";return`${r}${e}`}return null}function ft(t){let r=t.split(`
2
- `),e=[],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 p=o,m=a+o.length,c=G(o);for(;n+1<r.length&&(c>0||p.trimEnd().endsWith("\\"));){n++;let u=r[n];p+=`
3
- ${u}`,m+=1+u.length,c+=G(u),s+=u.length+1}let l=gt(p);l&&e.push({...l,start:a,end:m})}return e}function gt(t){let r=t.replace(/\\\s*\n/g," ").trim();if(r.startsWith("import "))return{kind:"import",module:null,clause:r.slice(7).trim()};let e=r.match(/^from\s+([.\w]+)\s+import\s+([\s\S]+)$/);if(!e)return null;let s=e[2].trim();return s.startsWith("(")&&s.endsWith(")")&&(s=s.slice(1,-1).trim()),{kind:"from",module:e[1],clause:s}}function St(t,r,e,s){let n=R(s,e.start,e.end),o=e.clause.replace(/\n/g," ").trim();if(e.kind==="import")return x(o).flatMap(p=>{let m=p.trim().replace(/,$/,"");if(!m)return[];let[c,l]=m.split(/\s+as\s+/),u=c.trim(),d=(l??u.split(".")[0]??u).trim(),_=W(t,r,u),A=M(n,d);return[{importedName:u,localName:d,sourcePath:_,kind:"namespace",used:h(n,d)||A.length>0,usedMembers:A}]});let i=e.module?W(t,r,e.module):null,a=[];for(let p of x(o)){let m=p.trim().replace(/,$/,"");if(!m)continue;if(m==="*"){a.push({importedName:"*",localName:null,sourcePath:i,kind:"side-effect",used:!0,usedMembers:[]});continue}let[c,l]=m.split(/\s+as\s+/),u=(l??c).trim();a.push({importedName:c.trim(),localName:u,sourcePath:i,kind:"named",used:h(n,u),usedMembers:[]})}return a}import{basename as ht}from"path";function _e(t,r,e){return I(t,r,s=>yt(t,r,s),()=>xt(t,r,e))}function xt(t,r,e){return N(e,/^[ \t]*(require_relative|require)\s+["']([^"']+)["']\s*$/gm,(s,n)=>{let o=s[1],i=s[2];if(!o||!i)return[];let a=o==="require_relative"?V(t,r,i):null;if(a){let p=Ee(i);return[$(p,p,a,h(n,p))]}return[D(i,a)]})}function yt(t,r,e){let s=g(e,new Set([])),n=[],o=new Set(["require","require_relative","load"]);for(let i of e.rootNode.descendantsOfType("call")){let a=i.namedChild(0);if(!a||a.type!=="identifier"||!o.has(a.text))continue;let m=i.namedChildren.find(d=>d.type==="argument_list")?.namedChild(0);if(!m||m.type!=="string")continue;let l=m.namedChildren.find(d=>d.type==="string_content")?.text;if(!l)continue;let u=a.text==="require_relative"?V(t,r,l):null;if(u){let d=Ee(l);n.push(f(d,d,u,s))}else n.push(D(l,u))}return n}function Ee(t){return le(ht(t).replace(/\.[^.]+$/,""),/_/)}function Te(t,r,e){return I(t,r,s=>Nt(t,r,s),()=>N(e,/^[ \t]*use\s+(.+?)\s*;$/gm,(s,n)=>{let o=s[1]?.trim();return o?It(t,r,o,n):[]}))}function Nt(t,r,e){let s=g(e,new Set(["use_declaration"])),n=[];for(let o of e.rootNode.descendantsOfType("use_declaration")){let i=o.namedChild(0);if(i)for(let a of F(i,"")){if(!a.importedName||a.importedName==="*")continue;let p=T(t,r,a.qualifiedName)??T(t,r,a.qualifiedName.split("::").slice(0,-1).join("::"));n.push(f(a.importedName,a.localName,p,s))}}return n}function F(t,r){switch(t.type){case"identifier":case"super":case"self":case"crate":{let e=t.text;return[{qualifiedName:B(r,e),importedName:e,localName:e}]}case"scoped_identifier":{let e=t.text,s=e.split("::").pop()??e;return[{qualifiedName:B(r,e),importedName:s,localName:s}]}case"scoped_use_list":{let e=t.namedChild(0),s=t.namedChild(1);if(!e||!s)return[];let n=B(r,e.text),o=[];for(let i of s.namedChildren)o.push(...F(i,n));return o}case"use_list":{let e=[];for(let s of t.namedChildren)e.push(...F(s,r));return e}case"use_as_clause":{let e=t.namedChild(0),s=t.namedChild(1);if(!e||!s)return[];let n=F(e,r),o=s.text;return n.map(i=>({...i,localName:o}))}case"use_wildcard":{let e=t.namedChild(0),s=e?e.text:"";return[{qualifiedName:B(r,`${s}::*`),importedName:"*",localName:"*"}]}default:return[]}}function B(t,r){return t?r?`${t}::${r}`:t:r}function It(t,r,e,s){let n=e.trim();if(n.includes("{")&&n.includes("}")){let c=n.slice(0,n.indexOf("{")).replace(/::$/,"").trim(),l=n.slice(n.indexOf("{")+1,n.lastIndexOf("}")).trim();return x(l).flatMap(u=>{let d=u.trim();if(!d||d==="self")return[];let[_,A]=d.split(/\s+as\s+/),w=_?.trim();if(!w)return[];let De=(A??w.split("::").pop()??w).trim(),Oe=`${c}::${w}`.replace(/::::/g,"::");return[P(t,r,s,Oe,w.split("::").pop()??w,De,T(t,r,c))]})}let[o,i]=n.split(/\s+as\s+/),a=o?.trim()??n,p=(i??a.split("::").pop()??a).trim(),m=T(t,r,a)??T(t,r,a.split("::").slice(0,-1).join("::"));return[P(t,r,s,a,a.split("::").pop()??a,p,m)]}function Re(t,r,e){let s=C(t,r);if(s)return bt(t,r,s);let n=[];for(let o of e.matchAll(/^[ \t]*pub\s+use\s+(.+?)\s*;$/gm)){let i=o[1]?.trim();i&&n.push(..._t(t,r,i))}return n}function bt(t,r,e){let s=[];for(let n of e.rootNode.descendantsOfType("use_declaration")){if(!Pt(n))continue;let o=n.namedChildren.find(i=>i.type!=="visibility_modifier");if(o)for(let i of F(o,""))i.importedName&&s.push(Z(t,r,i.qualifiedName))}return s}function Pt(t){for(let r of t.children)if(r.type==="visibility_modifier"&&r.text.startsWith("pub"))return!0;return!1}function _t(t,r,e){let s=e.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[p]=a.split(/\s+as\s+/),m=`${n}::${p?.trim()??a}`.replace(/::::/g,"::");return[Z(t,r,m)]})}return[Z(t,r,s)]}function Z(t,r,e){return{specifier:e,sourcePath:T(t,r,e)??T(t,r,e.split("::").slice(0,-1).join("::"))}}function k({language:t,extensions:r,imports:e,parseImports:s}){return{language:t,extensions:r,capabilities:{imports:e},parseImports:s}}function Ce(t,r){let e=r.toLowerCase();for(let s of t)for(let n of s.extensions)if(e.endsWith(n))return s;return null}var Et={language:"javascript",extensions:te,capabilities:{imports:"ast-with-regex-fallback",reExports:"ast-with-regex-fallback"},parseImports:Y,parseReExports:K},Tt=k({language:"python",extensions:re,imports:"ast-with-regex-fallback",parseImports:Pe}),Rt=k({language:"jvm",extensions:b,imports:"ast-dispatch-with-regex-fallback",parseImports:ye}),Ct={language:"rust",extensions:se,capabilities:{imports:"ast-with-regex-fallback",exports:"ast-with-regex-fallback"},parseImports:Te,parseExports:Re},Dt=k({language:"ruby",extensions:ne,imports:"ast-with-regex-fallback",parseImports:_e}),Ot=k({language:"c/cpp",extensions:oe,imports:"ast-with-regex-fallback",parseImports:de}),kt=k({language:"dotnet",extensions:j,imports:"ast-dispatch-with-regex-fallback",parseImports:Se}),At={language:"dart",extensions:ie,capabilities:{imports:"regex-only",exports:"regex-only"},parseImports:fe,parseExports:ge},wt=k({language:"php",extensions:U,imports:"ast-with-regex-fallback",parseImports:Ie}),Lt=[Et,Tt,Rt,Ct,Dt,Ot,kt,At,wt];function H(t){return Ce(Lt,t)}var ee={clearGroups:["whole-project","source-file"]},jt=L("source-imports",ee),vt=L("source-exports",ee),Mt=L("source-reexports",ee);function Zr(t,r){let e=J(r);return Mt.get(t,e,()=>{let s=H(e);if(!s?.parseReExports)return[];let n=v(t,e);return n?s.parseReExports(t,e,n):[]})}function es(t,r){let e=J(r);return jt.get(t,e,()=>{let s=H(e);if(!s)return[];let n=v(t,e);return n?s.parseImports(t,e,n):[]})}function ts(t,r){let e=J(r);return vt.get(t,e,()=>{let s=H(e);if(!s?.parseExports)return[];let n=v(t,e);return n?s.parseExports(t,e,n):[]})}export{Zr as a,es as b,ts as c};
4
- //# sourceMappingURL=chunk-FOQHUKNZ.js.map
@@ -1,3 +0,0 @@
1
- import{l as T}from"./chunk-CRU42NJU.js";import{f as g}from"./chunk-3UW7VM4H.js";import{d as h}from"./chunk-JM72FNGA.js";import{a as k}from"./chunk-64MNV6AB.js";import{a as U,c as W}from"./chunk-7S5E7KWT.js";function p(i,e,t){if(i.has(e))return i.get(e);let n=t();return i.set(e,n),n}import $ from"path";function le(i,e){return i.getReferences().map(t=>{let n=t.getNode();return V(n,e)})}function fe(i){let e=i;return typeof e.findReferences=="function"?e.findReferences():[]}function _(i,e,t,n){let r=[];for(let o of fe(i))for(let s of le(o,n))s.file===e.relativePath&&s.line>=e.startLine&&s.line<=e.endLine||r.push(s);for(let o of t)r.push(o);return N(r)}function B(i,e,t,n){let r=[],o=t?.getStart();for(let s of i.getReferences()){let a=s.getNode();S(n,a.getSourceFile().getFilePath())===e&&(o!==void 0&&a.getStart()===o||r.push({location:V(a,n),node:a}))}return r}function V(i,e){let t=i.getSourceFile(),n=t.getLineAndColumnAtPos(i.getStart());return{file:S(e,t.getFilePath())??t.getBaseName(),line:n.line-1,column:n.column-1}}function z(i,e,t){let n=i.getSourceFile(),r=y(n,i),o=i.getText(),s=new RegExp(`\\b${pe(o)}\\b`,"g"),a=n.getFullText().split(`
2
- `),l=[];for(let c=0;c<a.length;c++){if(c===r)continue;let d=a[c]??"";s.lastIndex=0;let u;for(;(u=s.exec(d))!==null;)l.push({file:e,line:c,column:u.index})}return N(l.filter(c=>S(t,$.join(t,c.file))===e))}function R(i){for(let e=i;e;e=e.getParent()){let t=e.getKindName();if(t.includes("Type")||t==="InterfaceDeclaration"||t==="TypeAliasDeclaration")return!0;if(t==="CallExpression"||t==="NewExpression"||t==="ExpressionStatement")return!1}return!1}function y(i,e){return i.getLineAndColumnAtPos(e.getStart()).line-1}function N(i){let e=new Set,t=[];for(let n of i){let r=`${n.file}:${n.line}:${n.column}`;e.has(r)||(e.add(r),t.push(n))}return t}function S(i,e){let t=$.relative(i||process.cwd(),e).replace(/\\/g,"/");return!t||t.startsWith("..")?null:t}function pe(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function J(i,e,t,n){let r=de(e,n);return r.size===0?new Map:ue(i,t,r)}function de(i,e){let t=new Map;for(let n of g(i,e)){let r=h(n.symbol)??n.leaf;if(!r)continue;let o=t.get(r);o||(o=[],t.set(r,o)),o.push(n)}return t}function ue(i,e,t){let n=new Map,r=new Map;return e.forEachDescendant(o=>{for(let s of me(i,o)){let a=t.get(s);if(!a)continue;let l=y(e,o);for(let c of a){if(l<c.startLine-1||l>c.endLine+1)continue;let d=Math.abs(l-c.startLine),u=r.get(c.symbolId);u!==void 0&&u<=d||(r.set(c.symbolId,d),n.set(c.symbolId,o))}}}),n}function me(i,e){let t=[],n=r=>{r&&!t.includes(r)&&t.push(r)};if("getNameNode"in e&&typeof e.getNameNode=="function"){let r=e.getNameNode();n(r?.getText())}if("getName"in e&&typeof e.getName=="function"){let r=e.getName();n(r)}return i.Node.isIdentifier(e)&&n(e.getText()),t}var ge=W("ts-definition-leaf-candidates",{clearGroups:["definition-catalog"]});function Y(i,e,t,n){let r=q(i,e),o=K(r.get(n)??[],t);if(o)return o;let s=[];for(let a of r.values())for(let l of a)((l.leaf||h(l.symbol)||"").includes(n)||l.symbol.includes(n))&&s.push(l);return K(s,t)}function X(i,e){let t=new Map;for(let[n,r]of q(i,e)){let o=r[0];o&&t.set(n,o)}return t}function q(i,e){return ge.get(i,e,()=>{let t=new Map;for(let n of g(i,e)){let r=n.leaf||h(n.symbol);if(!r)continue;let o=t.get(r);o||(o=[],t.set(r,o)),o.push({...n,leaf:r})}for(let n of t.values())n.sort((r,o)=>r.startLine-o.startLine||r.endLine-o.endLine||r.symbolId-o.symbolId);return t})}function K(i,e){let t=null,n=Number.POSITIVE_INFINITY;for(let r of i){let o=Math.abs(r.startLine-e);(o<n||o===n&&t&&r.startLine<t.startLine)&&(t=r,n=o)}return t}import ye from"path";var x=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"];function M(i){let e=i.toLowerCase();return x.some(t=>e.endsWith(t))}function G(i,e){let t=new Map,n=r=>M(r)?p(t,r,()=>{let o=ye.join(i.config.projectRoot,r);for(let{project:s}of e){let a=s.getSourceFile(o)??s.addSourceFileAtPathIfExists(o)??null;if(a)return{project:s,sourceFile:a}}return null}):null;return{sourceFile:r=>n(r)?.sourceFile??null,sourceFileMatch:n,indexedTypeScriptLikeDocuments:()=>k(i,{extensions:x})}}import m from"path";import{existsSync as F,readdirSync as he,readFileSync as H}from"fs";function Q(i){let e=m.join(i,"package.json");if(!F(e))return[];let t;try{t=JSON.parse(H(e,"utf8"))}catch{return[]}return(Array.isArray(t.workspaces)?t.workspaces:t.workspaces?.packages??[]).flatMap(r=>Se(i,r)).flatMap(r=>xe(i,r))}function Se(i,e){if(!e||e.startsWith("!")||e.includes("node_modules"))return[];if(!e.includes("*")){let s=m.join(i,e);return F(m.join(s,"package.json"))?[s]:[]}let t=e.indexOf("*"),n=e.slice(0,t).replace(/\/$/,""),r=e.slice(t+1).replace(/^\//,""),o=m.join(i,n||".");if(!F(o))return[];try{return he(o).map(s=>m.join(o,s,r)).filter(s=>F(m.join(s,"package.json")))}catch{return[]}}function xe(i,e){try{let t=JSON.parse(H(m.join(e,"package.json"),"utf8"));if(!t.name)return[];let n=m.relative(i,e).replace(/\\/g,"/");return[{name:t.name,rootRelative:n,sourceRootRelative:`${n}/src`}]}catch{return[]}}function Z(i,e){for(let t of i)if(e===t.name||e.startsWith(`${t.name}/`))return t.name;return null}function ee(i){return[`${i.sourceRootRelative}/index.ts`,`${i.sourceRootRelative}/index.tsx`,`${i.sourceRootRelative}/index.mts`,`${i.sourceRootRelative}/index.cts`]}import{existsSync as I,readFileSync as Ie,readdirSync as be,statSync as De}from"fs";import f from"path";var j=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"];function E(i,e){let n=e?f.dirname(f.join(i,e)):i,r=f.resolve(i);for(;n.startsWith(r);){for(let s of j){let a=f.join(n,s);if(I(a))return a}let o=f.dirname(n);if(o===n)break;n=o}for(let o of j){let s=f.join(i,o);if(I(s))return s}return null}function te(i){let e=i.config.projectRoot,t=new Set(ke(e,i.config.semantic?.typescript?.tsconfigs)),n=k(i,{includeIgnored:!1,extensions:x});for(let r of n){let o=E(e,r);o&&t.add(f.resolve(o))}if(t.size===0){let r=E(e);r&&t.add(f.resolve(r))}return[...t].filter(r=>!ne(e,r)).sort((r,o)=>r.localeCompare(o))}function ke(i,e=[]){let t=new Set;for(let n of e){let r=f.isAbsolute(n)?n:f.join(i,n);I(r)&&t.add(f.resolve(r))}for(let n of Ne(i))for(let r of j){let o=f.join(n,r);I(o)&&t.add(f.resolve(o))}if(t.size===0){let n=E(i);n&&t.add(f.resolve(n))}return[...t].filter(n=>!ne(i,n)).sort((n,r)=>n.localeCompare(r))}function Ne(i){let e=f.join(i,"package.json");if(!I(e))return[];let t;try{t=JSON.parse(Ie(e,"utf8"))}catch{return[]}return(Array.isArray(t.workspaces)?t.workspaces:t.workspaces?.packages??[]).flatMap(r=>Me(i,r))}function Me(i,e){if(!e||e.startsWith("!")||e.includes("node_modules"))return[];if(!e.includes("*")){let s=f.join(i,e);return C(s)?[s]:[]}let t=e.indexOf("*"),n=e.slice(0,t).replace(/\/$/,""),r=e.slice(t+1).replace(/^\//,""),o=f.join(i,n||".");return C(o)?be(o).map(s=>f.join(o,s,r)).filter(C):[]}function C(i){try{return De(i).isDirectory()}catch{return!1}}function ne(i,e){let t=f.relative(i,e).replace(/\\/g,"/");return t.startsWith("..")||t.includes("/node_modules/")||t.startsWith("node_modules/")||t.includes("/dist/")||t.startsWith("dist/")}import{createRequire as Fe}from"module";var ve=Fe(import.meta.url),b;function re(){if(b!==void 0)return b;try{b=ve("ts-morph")}catch{b=null}return b}function ie(i,e){return e.map(t=>({tsconfigPath:t,project:new i.Project({tsConfigFilePath:t,skipFileDependencyResolution:!1})}))}function v(i,e,t){return{language:"typescript",availability:()=>({available:!1,reason:i,tsconfigPath:e,tsconfigPaths:t}),importUsage:()=>[],referencesFor:()=>[],calleesFor:()=>[],signatureFor:()=>null}}function ae(i,e){let t=re();if(!t)return v("ts-morph is not installed");let n=te(i);if(n.length===0)return v("no tsconfig found");try{let r=ie(t,n);return new w(i,t,r)}catch(r){return v(r instanceof Error?r.message:String(r),n[0],n)}}var w=class{constructor(e,t,n){this.db=e;this.tsMorph=t;this.projects=n;this.workspacePackages=Q(e.config.projectRoot),this.sourceFiles=G(e,n)}db;tsMorph;projects;language="typescript";importUsageCache=new Map;referencesCache=new Map;calleesCache=new Map;fileCalleesCache=new Map;signatureCache=new Map;definitionNodeCache=new Map;fileDefinitionNodeCache=new Map;indexedDefinitionLeafCache=new Map;packageImportReferenceIndex=null;packageExportIndex=null;workspacePackages;sourceFiles;availability(){return{available:!0,tsconfigPath:this.projects[0]?.tsconfigPath,tsconfigPaths:this.projects.map(e=>e.tsconfigPath)}}importUsage(e){return p(this.importUsageCache,e,()=>{let t=this.sourceFiles.sourceFile(e);if(!t)return[];let n=[];for(let r of t.getImportDeclarations())for(let o of this.importUsageForDeclaration(e,r))n.push(o);return n})}referencesFor(e){return p(this.referencesCache,e.symbolId,()=>{let t=this.nodeForDefinition(e),n=this.packageImportReferencesForDefinition(e);return t?_(t,e,n,this.db.config.projectRoot):n})}calleesFor(e){return p(this.calleesCache,e.symbolId,()=>p(this.fileCalleesCache,e.relativePath,()=>this.calleeMapForFile(e.relativePath)).get(e.symbolId)??[])}signatureFor(e){return p(this.signatureCache,e.symbolId,()=>{let t=this.nodeForDefinition(e);if(!t||!this.tsMorph.Node.isFunctionDeclaration(t)&&!this.tsMorph.Node.isMethodDeclaration(t)&&!this.tsMorph.Node.isArrowFunction(t)&&!this.tsMorph.Node.isFunctionExpression(t)&&!this.tsMorph.Node.isConstructorDeclaration(t))return null;let n=t.getType().getCallSignatures()[0];if(!n)return null;let r=n.getParameters().map(s=>{let a=s.getDeclarations()[0],l=a?s.getTypeAtLocation(a).getText(a):s.getValueDeclaration()?.getType().getText()??"unknown";return se(l)}),o=n.getReturnType().getText(t);return`(${r.join(",")})=>${se(o)}`})}importUsageForDeclaration(e,t){let n=T(this.db,e,t.getModuleSpecifierValue()),r=oe(t);return t.getImportClause()?.isTypeOnly()?r.map(o=>Pe(e,n,o)):r.map(o=>this.valueImportUsageForEntry(e,n,o))}valueImportUsageForEntry(e,t,n){let r=n.identifier?n.identifier.findReferences():[],o=[];for(let c of r)for(let d of B(c,e,n.identifier,this.db.config.projectRoot))o.push(d);let s=o.some(c=>!R(c.node)),a=o.some(c=>R(c.node)),l=n.isTypeOnly;return{importer:e,sourcePath:t,importedName:n.importedName,localName:n.localName,kind:n.kind,isTypeOnly:l,isUsed:l||o.length>0,isTypeUsed:l||a,isValueUsed:s,references:o.map(c=>c.location)}}packageImportReferencesForDefinition(e){return this.packageImportReferences().get(e.symbolId)??[]}packageImportReferences(){if(this.packageImportReferenceIndex)return this.packageImportReferenceIndex;let e=new Map,t=this.packageExports();for(let n of this.sourceFiles.indexedTypeScriptLikeDocuments())this.addPackageImportReferencesForDocument(e,t,n);for(let[n,r]of e)e.set(n,N(r));return this.packageImportReferenceIndex=e,e}addPackageImportReferencesForDocument(e,t,n){if(this.db.isIgnored(n))return;let r=this.sourceFiles.sourceFileMatch(n);if(r)for(let o of r.sourceFile.getImportDeclarations())this.addPackageImportReferencesForDeclaration(e,t,n,o)}addPackageImportReferencesForDeclaration(e,t,n,r){let o=Z(this.workspacePackages,r.getModuleSpecifierValue());if(!o)return;let s=t.get(o);if(s)for(let a of oe(r)){if(a.kind!=="named"||!a.identifier)continue;let l=s.get(a.importedName);if(!l||l.size===0)continue;let c=z(a.identifier,n,this.db.config.projectRoot);c.length>0&&Ce(e,l,c)}}packageExports(){if(this.packageExportIndex)return this.packageExportIndex;let e=new Map;for(let t of this.workspacePackages){let n=new Map;for(let r of ee(t))this.collectPackageExports(t,r,n,new Set);n.size>0&&e.set(t.name,n)}return this.packageExportIndex=e,e}collectPackageExports(e,t,n,r){if(r.has(t))return;r.add(t);let o=this.sourceFiles.sourceFile(t);if(o)for(let s of o.getExportDeclarations()){let a=s.getModuleSpecifierValue(),l=a?T(this.db,t,a):t;if(!l||!l.startsWith(`${e.sourceRootRelative}/`))continue;let c=s.getNamedExports();if(c.length===0){if(s.isNamespaceExport())continue;this.collectPackageExports(e,l,n,r);continue}for(let d of c){let u=d.getNameNode().getText(),A=d.getAliasNode()?.getText()??u,O=this.indexedDefinitionByLeaf(l,u);if(!O)continue;let D=n.get(A);D||(D=new Set,n.set(A,D)),D.add(O.symbolId)}}}indexedDefinitionByLeaf(e,t){return p(this.indexedDefinitionLeafCache,e,()=>X(this.db,e)).get(t)??null}nodeForDefinition(e){return p(this.definitionNodeCache,e.symbolId,()=>this.definitionNodesForFile(e.relativePath).get(e.symbolId)??null)}definitionNodesForFile(e){return p(this.fileDefinitionNodeCache,e,()=>{let t=this.sourceFiles.sourceFile(e);return t?J(this.tsMorph,this.db,t,e):new Map})}definitionFromSymbol(e){let t=e.getDeclarations();for(let n of t){let r=n.getSourceFile(),o=S(this.db.config.projectRoot,r.getFilePath());if(!o||this.db.isIgnored(o))continue;let s=y(r,n),a=Y(this.db,o,s,e.getName());if(a)return{symbol:a.symbol,file:a.relativePath,line:a.startLine}}return null}calleeMapForFile(e){let t=this.sourceFiles.sourceFile(e);if(!t)return new Map;let n=g(this.db,e).sort((o,s)=>o.startLine-s.startLine||s.endLine-o.endLine);if(n.length===0)return new Map;let r=new Map;t.forEachDescendant(o=>{if(!this.tsMorph.Node.isCallExpression(o)&&!this.tsMorph.Node.isNewExpression(o))return;let s=this.semanticCalleeForCallNode(t,n,o);s&&Te(r,s.callerId,s.target)});for(let[o,s]of r)r.set(o,je(s));return r}semanticCalleeForCallNode(e,t,n){let r=Re(t,y(e,n));if(!r)return null;let o=n.getExpression(),s=o.getSymbol()??o.getType().getSymbol(),a=s?this.definitionFromSymbol(s):null;return a?{callerId:r.symbolId,target:{symbol:a.symbol,file:a.file,line:a.line}}:null}};function oe(i){let e=[],t=i.getDefaultImport();t&&e.push({identifier:t,importedName:"default",localName:t.getText(),kind:"default",isTypeOnly:i.getImportClause()?.isTypeOnly()??!1});let n=i.getNamespaceImport();n&&e.push({identifier:n,importedName:"*",localName:n.getText(),kind:"namespace",isTypeOnly:i.getImportClause()?.isTypeOnly()??!1});for(let r of i.getNamedImports()){let o=r.getNameNode(),a=r.getAliasNode()??(o.getKindName()==="Identifier"?o:null);e.push({identifier:a,importedName:o.getText(),localName:a?.getText()??o.getText(),kind:"named",isTypeOnly:r.isTypeOnly()||(i.getImportClause()?.isTypeOnly()??!1)})}return e.length===0&&e.push({identifier:null,importedName:"*",localName:null,kind:"side-effect",isTypeOnly:!1}),e}function Pe(i,e,t){return{importer:i,sourcePath:e,importedName:t.importedName,localName:t.localName,kind:t.kind,isTypeOnly:!0,isUsed:!0,isTypeUsed:!0,isValueUsed:!1,references:[]}}function Te(i,e,t){let n=i.get(e);n||(n=[],i.set(e,n)),n.push(t)}function Re(i,e){let t=null;for(let n of i)e<n.startLine||e>n.endLine||(!t||n.startLine>=t.startLine)&&(t=n);return t}function Ce(i,e,t){for(let n of e){let r=i.get(n)??[];r.push(...t),i.set(n,r)}}function je(i){let e=new Set,t=[];for(let n of i){let r=`${n.symbol}|${n.file}|${n.line}`;e.has(r)||(e.add(r),t.push(n))}return t}function se(i){return i.replace(/\s+/g," ").replace(/\bimport\("[^"]+"\)\./g,"").trim()}var L=new WeakMap;U({name:"semantic-provider",groups:["semantic-provider"],clearAll:i=>L.delete(i)});function ce(i,e){let t=`${i.config.projectRoot}:typescript-workspace`,n=L.get(i);n||(n=new Map,L.set(i,n));let r=n.get(t);if(r)return r;let o=ae(i,e);return n.set(t,o),o}function kt(i,e){let t=P(i,e);return t?t.importUsage(e):[]}function Ee(i,e){let t=P(i,e.relativePath);return t?t.referencesFor(e):[]}function Nt(i,e){let t=new Map;for(let n of e)for(let r of Ee(i,n)){if(r.file===n.relativePath||i.isIgnored(r.file))continue;let o=t.get(n.symbolId);o||(o=new Set,t.set(n.symbolId,o)),o.add(r.file)}return t}function Mt(i,e){let t=new Map;for(let n of e){let r=P(i,n.relativePath);if(!r)continue;let o=r.calleesFor(n);o.length>0&&t.set(n.symbolId,o)}return t}function Ft(i,e){let t=P(i,e.relativePath);return t?t.signatureFor(e):null}function P(i,e){if(!M(e))return null;let t=ce(i,e);return t.availability().available?t:null}export{M as a,ce as b,kt as c,Ee as d,Nt as e,Mt as f,Ft as g};
3
- //# sourceMappingURL=chunk-FUPDW5AC.js.map
@@ -1,2 +0,0 @@
1
- import{b as p}from"./chunk-B75HZHUP.js";import{a as y}from"./chunk-3ZYF3ELZ.js";import{a as o}from"./chunk-BGBBVSH4.js";import{c as b}from"./chunk-JM72FNGA.js";function P(u,c={}){let{scope:f,minLoc:L=3,scanLimit:l}=c,s=new y(u),r=c.semantic!==!1,t=p(s.productionCallableDefinitions({scope:f,minLoc:L,excludeEntrySurfaces:!0,excludeRustTraitImplMembers:!0,includeSuppressed:!0,sortByLocDesc:typeof l=="number"&&l>0}),l),h=s.crossFileCallerMap(t,{semantic:r}),a=new Set(h.keys());for(let e of s.frameworkReferencedSymbolIds(t))a.add(e);let n=s.symbolsWithNonSelfCallees(t,{additive:!1,semantic:r}),m=t.filter(e=>!a.has(e.symbolId)).filter(e=>!n.has(e.symbolId)),I=s.sourceFallbackCallerFiles(m);for(let e of I.keys())a.add(e);let d=m.filter(e=>!a.has(e.symbolId)),C=s.symbolsWithNonSelfCallees(d,{additive:!0,semantic:r});for(let e of C)n.add(e);return d.filter(e=>!n.has(e.symbolId)).sort((e,i)=>o(i)-o(e)||e.relativePath.localeCompare(i.relativePath)||e.startLine-i.startLine).map(e=>({symbol:e.symbol,shortName:b(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:o(e)}))}export{P as a};
2
- //# sourceMappingURL=chunk-G3WGZU5Q.js.map
@@ -1,40 +0,0 @@
1
- import{d as C}from"./chunk-FUPDW5AC.js";import{c as _}from"./chunk-MZ7APUFN.js";import{b as S}from"./chunk-FOQHUKNZ.js";import{t as M}from"./chunk-CRU42NJU.js";import{f as y,k as h}from"./chunk-3UW7VM4H.js";import{d as f}from"./chunk-JM72FNGA.js";import{a as b}from"./chunk-QLNGUWR7.js";import{a as v}from"./chunk-EWC3UK4V.js";import{a as m}from"./chunk-D322LMSA.js";import{c as I}from"./chunk-OBBDKQAG.js";import{c as g,d as D}from"./chunk-7S5E7KWT.js";function R(e,r,n,t={}){if(!n)return[];let i=m(e,r);return i?i.indexOf(n)===-1?[]:(L(e,r).get(n)??[]).filter(s=>!B(s,t)):[]}function B(e,r){return typeof r.excludeStartLine=="number"&&typeof r.excludeEndLine=="number"&&e>=r.excludeStartLine&&e<=r.excludeEndLine}var G=g("file-identifiers",{clearGroups:["whole-project","source-file"]});function w(e,r){let n=b(e,r);return n?n.fileIdentifiers:G.get(e,r,()=>new Set(L(e,r).keys()))}var H=g("file-ident-lines",{clearGroups:["whole-project","source-file"]});function L(e,r){let n=b(e,r);return n?n.identifierLineMap:H.get(e,r,()=>z(e,r))}var J=g("file-idents-by-line",{clearGroups:["whole-project","source-file"]});function ie(e,r){let n=b(e,r);return n?n.identifiersByLine:J.get(e,r,()=>{let t=L(e,r),i=0;for(let s of t.values()){let c=s[s.length-1];c!==void 0&&c>i&&(i=c)}let o=new Array(i+1);for(let s=0;s<=i;s+=1)o[s]=new Set;for(let[s,c]of t)for(let a of c)o[a].add(s);return o})}function z(e,r){let n=new Map,t=(c,a)=>{let l=n.get(c);if(!l){n.set(c,[a]);return}l[l.length-1]!==a&&l.push(a)},i=m(e,r);if(!i)return n;let o=M(i).split(/\r?\n/),s=/\b([A-Za-z_$][\w$]*)\b/g;for(let c=0;c<o.length;c+=1){let a=o[c]??"";for(let l of a.matchAll(s))l[1]&&t(l[1],c)}return n}function k(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function d(e,r){return k(e)===k(r)}function O(e,r){let n=new Map;for(let t of S(e,r)){if(!t.sourcePath)continue;let i=t.localName??t.importedName;if(i&&F(n,i,t.sourcePath),t.kind==="namespace")for(let o of t.usedMembers)F(n,o,t.sourcePath)}return n}function F(e,r,n){let t=e.get(r);t||(t=new Set,e.set(r,t)),t.add(n)}function le(e,r){return E(e,r,n=>{let t=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT
2
- m.symbol_id,
3
- d.relative_path,
4
- COUNT(*) AS ref_count
5
- FROM mentions m
6
- JOIN chunks c ON m.chunk_id = c.id
7
- JOIN documents d ON c.document_id = d.id
8
- WHERE m.role != 1
9
- ${t}
10
- ${e.pathExclusionsFor("d")}
11
- GROUP BY m.symbol_id, d.relative_path`,...n??[])})}function fe(e,r){return E(e,r,n=>{let t=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT DISTINCT m.symbol_id, d.relative_path
12
- FROM mentions m
13
- JOIN chunks c ON m.chunk_id = c.id
14
- JOIN documents d ON c.document_id = d.id
15
- WHERE m.role != 1
16
- ${t}
17
- ${e.pathExclusionsFor("d")}`,...n??[])}).filter(n=>n.symbol_id!==null)}function A(e,r){return E(e,r,n=>{let t=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT DISTINCT m.symbol_id, d.relative_path, c.document_id,
18
- c.start_line AS chunk_start, c.end_line AS chunk_end
19
- FROM mentions m
20
- JOIN chunks c ON m.chunk_id = c.id
21
- JOIN documents d ON c.document_id = d.id
22
- WHERE m.role != 1
23
- ${t}
24
- ${e.pathExclusionsFor("d")}
25
- ORDER BY d.relative_path, c.start_line`,...n??[])})}function E(e,r,n){if(!r)return n();if(r.length===0)return[];let t=[];for(let i=0;i<r.length;i+=750)t.push(...n(r.slice(i,i+750)));return t}function Se(e,r){let n=T(e);return n?r.filter(t=>T(t.file)===n):r}function ye(e,r,n,t){let i=n.find(o=>o.file===r);if(i)return i;if(t){let o=new Set(S(e,r).map(s=>s.sourcePath).filter(s=>!!s));for(let s of n)for(let c of o)if(d(c,s.file))return s;return null}return n.length===1?n[0]:null}function T(e){let r=v(e);return r?r==="typescript"||r==="tsx"||r==="javascript"?"javascript-family":r:null}var W=D("global-leaf-index",{clearGroups:["whole-project"]});function x(e){return W.get(e,()=>{let r=e.all(`SELECT gs.id, gs.symbol,
26
- COALESCE(der_doc.relative_path, mention_doc.relative_path) AS relative_path
27
- FROM global_symbols gs
28
- LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
29
- LEFT JOIN documents der_doc ON der_doc.id = der.document_id
30
- LEFT JOIN (
31
- SELECT m.symbol_id, MIN(d.relative_path) AS relative_path
32
- FROM mentions m
33
- JOIN chunks c ON m.chunk_id = c.id
34
- JOIN documents d ON c.document_id = d.id
35
- WHERE m.role = 1
36
- GROUP BY m.symbol_id
37
- ) mention_doc ON mention_doc.symbol_id = gs.id
38
- WHERE 1 = 1
39
- ${e.symbolNoiseFor("gs")}`),n=new Map;for(let t of r){if(!t.relative_path||e.isIgnored(t.relative_path))continue;let i=f(t.symbol);if(!i)continue;let o=n.get(i);o||(o=[],n.set(i,o)),o.some(s=>s.symbolId===t.id)||o.push({symbol:t.symbol,symbolId:t.id,file:t.relative_path})}return n})}function N(e,r,n){let t=x(e).get(n);if(!t||t.length===0)return[];if(t.length===1)return[p(t[0])];let i=t.filter(a=>a.file===r);if(i.length>0)return i.map(p);let o=O(e,r),s=o.get(n);if(s)for(let a of s){let l=t.filter(u=>d(a,u.file));if(l.length>0)return l.map(p)}let c=new Set;for(let a of o.values())for(let l of a)c.add(l);for(let a of c){let l=t.filter(u=>d(a,u.file));if(l.length>0&&l.length===t.length)return l.map(p)}return[]}function Ce(e,r,n){let t=N(e,r,n);if(t.length>0)return t;let i=x(e).get(n);return!i||i.length===0?[]:i.map(p)}function $(e,r,n={}){let t=_(e,r);if(!t)return[];let i=f(t.symbol);if(!i)return[];if(n.semantic!==!1){let s=C(e,{...t,leaf:i,parentTypeName:null,isFunctionLike:!1,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:null});if(s.length>0){let c=new Map;for(let a of s){let l=c.get(a.file)??[];l.push(a.line),c.set(a.file,l)}return P(e,c)}}let o=new Map;for(let s of I(e)){let c=m(e,s);if(!c||c.indexOf(i)===-1||s!==t.relativePath&&!N(e,s,i).some(u=>u.symbolId===t.symbolId))continue;let a=R(e,s,i,s===t.relativePath?{excludeStartLine:t.startLine,excludeEndLine:t.endLine}:{});a.length>0&&o.set(s,a)}return P(e,o)}function we(e,r){let n=new Map;for(let o of r){if(!o.leaf)continue;let s=n.get(o.leaf)??[];s.push(o),n.set(o.leaf,s)}if(n.size===0)return new Map;let t=new Set(r.map(o=>o.symbolId)),i=new Map;for(let o of I(e)){let s=w(e,o);if(s.size!==0){for(let c of s)if(n.has(c))for(let a of N(e,o,c)){if(!t.has(a.symbolId)||o===a.relativePath)continue;let l=i.get(a.symbolId);l||(l=new Set,i.set(a.symbolId,l)),l.add(o)}}}return i}function p(e){return{symbolId:e.symbolId,symbol:e.symbol,relativePath:e.file}}function P(e,r){let n=[],t=new Set;for(let[i,o]of r){let s=y(e,i);for(let c of o){let a=h(s,c),l=`${i}|${c}|${a?.symbol??""}`;t.has(l)||(t.add(l),n.push({file:i,line:c,enclosingSymbol:a?.symbol??null}))}}return n}function Y(e,r){let n=q(e,r);return n?K(e,Q(e,n.match,n.identifier)):[]}function je(e,r,n={}){return Z(e,r,n).map(t=>({file:t.file,line:t.line,enclosingSymbol:t.enclosingSymbol}))}function Z(e,r,n={}){let t=$(e,r,{semantic:n.semantic}),i=t.length>0?j(t,"source-attribution"):j(Y(e,r),"scip-reference-chunk");return n.includeIgnored===!0?i:i.filter(o=>!e.isIgnored(o.file))}function j(e,r){return e.map(n=>({...n,provenance:r}))}function Q(e,r,n){let t=new Map;for(let[i,o]of U(e,r.symbolId))t.set(i,V(e,i,o,r,n));return t}function U(e,r){let n=new Map;for(let t of A(e,[r])){if(e.isIgnored(t.relative_path))continue;let i=n.get(t.relative_path);i||(i=[],n.set(t.relative_path,i)),i.push({start_line:t.chunk_start,end_line:t.chunk_end})}return n}function V(e,r,n,t,i){let o=r===t.relativePath?{excludeStartLine:t.startLine,excludeEndLine:t.endLine}:{},s=i?R(e,r,i,o):[];return n.flatMap(c=>X(s,c))}function X(e,r){let n=e.filter(t=>t>=r.start_line&&t<=r.end_line);return n.length>0?n:[r.start_line]}function q(e,r){let n=_(e,r);return n?{match:n,identifier:f(n.symbol)||null}:null}function K(e,r){let n=[],t=new Set;for(let[i,o]of r){let s=y(e,i);for(let c of o){let a=h(s,c),l=`${i}|${c}|${a?.symbol??""}`;t.has(l)||(t.add(l),n.push({file:i,line:c,enclosingSymbol:a?.symbol??null}))}}return n}export{L as a,ie as b,le as c,fe as d,A as e,d as f,Se as g,ye as h,x as i,O as j,N as k,Ce as l,we as m,Y as n,je as o};
40
- //# sourceMappingURL=chunk-HVTYSC26.js.map
@@ -1,71 +0,0 @@
1
- import _e from"better-sqlite3";import{existsSync as _t,readFileSync as Mt,writeFileSync as Gt}from"fs";import{dirname as Wt,join as Ht,resolve as Me}from"path";import ne from"better-sqlite3";import{execFileSync as re}from"child_process";import{existsSync as oe,readdirSync as ie,readFileSync as se}from"fs";import{extname as m,join as F}from"path";import K from"ignore";import{readFileSync as B,existsSync as b}from"fs";import{dirname as h,isAbsolute as x,join as S,relative as J,resolve as X}from"path";function C(e){let t=K(),r=!1,n=z(e);for(let i of n)try{let o=B(i,"utf-8");t.add(o),r=!0}catch{}return r||t.add(q),{isIgnored:i=>V(t,e,i),filter:i=>i.filter(o=>!V(t,e,o))}}function z(e){let t=[],r=S(e,".gitignore");b(r)&&t.push(r);let n=h(e),i=0;for(;n!==h(n)&&i<5;){let o=S(n,".gitignore");if(b(o)&&t.push(o),b(S(n,".git")))break;n=h(n),i++}return t}var q=`
2
- # Dependencies
3
- node_modules/
4
- vendor/
5
- .bundle/
6
-
7
- # Build output
8
- dist/
9
- build/
10
- out/
11
- target/
12
- bin/
13
- obj/
14
-
15
- # Python
16
- __pycache__/
17
- *.pyc
18
- *.pyo
19
- .venv/
20
- venv/
21
- .env/
22
- env/
23
- *.egg-info/
24
-
25
- # Rust
26
- target/
27
-
28
- # Java / Kotlin / Scala
29
- *.class
30
- .gradle/
31
- .mvn/
32
-
33
- # C# / .NET
34
- bin/
35
- obj/
36
- packages/
37
-
38
- # Go
39
- vendor/
40
-
41
- # Dart
42
- .dart_tool/
43
- build/
44
-
45
- # PHP
46
- vendor/
47
-
48
- # IDE / OS
49
- .idea/
50
- .vscode/
51
- *.swp
52
- *.swo
53
- .DS_Store
54
- Thumbs.db
55
-
56
- # Type definitions (often noise in queries)
57
- *.d.ts
58
- `;function V(e,t,r){let n=Y(t,r);if(!n)return!1;try{return e.ignores(n)}catch{return!1}}function Y(e,t){if(!t||t===".")return null;if(!x(t)&&!t.startsWith(".."))return t.replaceAll("\\","/");let r=x(t)?t:X(e,t),n=J(e,r).replaceAll("\\","/");return!n||n==="."||n.startsWith("..")?null:n}import{readdirSync as nt}from"fs";import{execFileSync as ot}from"child_process";import{extname as st,join as at}from"path";var Q=[];function k(e){e.groups.length>0&&Q.push(e)}function Z(){let e=new WeakMap;return{cache:e,ensure(t){let r=e.get(t);return r||(r=new Map,e.set(t,r)),r}}}function L(e,t){let{cache:r,ensure:n}=Z(),i={get(o,s,a){let u=n(o);if(u.has(s))return u.get(s);let c=a();return u.set(s,c),c},invalidate(o,s){r.get(o)?.delete(s)},invalidateAll(o){r.delete(o)},size(o){return r.get(o)?.size??0}};return k({name:e,groups:t.clearGroups,clearAll:o=>i.invalidateAll(o),clearFile:(o,s)=>i.invalidate(o,s)}),i}var ee=[".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"],T=[".vue"],te=new Set(ee.map(e=>e.toLowerCase())),ct=[...te].sort().join(","),D=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo","out","coverage",".scipquery-cache","__pycache__",".venv","venv",".idea",".vscode"]);var lt=L("source-files",{clearGroups:[]});function St(e){let t=new Set((e.extensions??T).map(o=>o.toLowerCase()));if(t.size===0)return{scanned:0,inserted:0,existing:0};if(!oe(e.dbPath))throw new Error(`SCIP SQLite database not found at ${e.dbPath}`);let r=C(e.projectRoot),n=ae(e.projectRoot,t).filter(o=>!r.isIgnored(o)),i=new ne(e.dbPath);try{let o=ce(i,n),s=i.prepare(`INSERT OR IGNORE INTO documents (language, relative_path, position_encoding, text)
59
- VALUES (?, ?, NULL, ?)`),u=i.transaction(l=>{let p=0;for(let g of l){if(o.has(g))continue;let d=se(F(e.projectRoot,g),"utf-8"),U=s.run(le(g),g,d);p+=Number(U.changes)}return p})(n),c={scanned:n.length,inserted:u,existing:n.length-u};return e.onStatus?.(`Augmented SQLite documents with ${u} auxiliary source file${u===1?"":"s"} (${c.existing} already present).`),c}finally{i.close()}}function ae(e,t){let r=ue(e,t);if(r)return r;let n=[],i=o=>{let s=o?F(e,o):e,a;try{a=ie(s,{withFileTypes:!0})}catch{return}for(let u of a){if(D.has(u.name))continue;let c=o?`${o}/${u.name}`:u.name;if(u.isDirectory()){i(c);continue}t.has(m(u.name).toLowerCase())&&n.push(c)}};return i(""),n.sort()}function ue(e,t){try{return re("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"]}).split(`
60
- `).filter(n=>n&&t.has(m(n).toLowerCase())).sort()}catch{return null}}function ce(e,t){let r=new Set,n=500;for(let i=0;i<t.length;i+=n){let o=t.slice(i,i+n),s=e.prepare(`SELECT relative_path FROM documents WHERE relative_path IN (${o.map(()=>"?").join(",")})`).all(...o);for(let a of s)r.add(a.relative_path)}return r}function le(e){return m(e).toLowerCase()===".vue"?"vue":m(e).replace(/^\./,"").toLowerCase()||"source"}import{execFileSync as ge}from"child_process";import{createHash as de}from"crypto";import{readdirSync as fe,readFileSync as pe}from"fs";import{join as E}from"path";function I(e){return(be(e)??he(e)).filter(t=>t&&!w(t)).sort()}function Ct(e,t={}){return(t.language?I(e).filter(n=>me(n,t.language,t.markerFiles)):I(e)).map(n=>{let i=E(e,n);try{let o=pe(i);return{path:n,size:o.byteLength,hash:de("sha256").update(o).digest("hex")}}catch{return{path:n,size:-1,hash:"unreadable"}}})}function me(e,t,r){let n=e.split("/").at(-1)??e;if(r?.includes(e)||r?.includes(n)||ye.has(n))return!0;let i=e.includes(".")?`.${e.split(".").at(-1).toLowerCase()}`:"";return(ve[t]??[]).includes(i)}function be(e){try{return ge("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:50*1024*1024,stdio:["ignore","pipe","ignore"]}).split(`
61
- `).filter(Boolean)}catch{return null}}function he(e){let t=[],r=[""];for(;r.length>0;){let n=r.pop(),i=n?E(e,n):e,o;try{o=fe(i,{withFileTypes:!0})}catch{continue}for(let s of o){let a=n?`${n}/${s.name}`:s.name;if(s.isDirectory()){w(a)||r.push(a);continue}t.push(a)}}return t}function w(e){return e.split("/").some(r=>Se.has(r))||e.endsWith(".db")||e.endsWith(".db-wal")||e.endsWith(".db-shm")||e.endsWith(".scip")}var Se=new Set([".git","node_modules",".scipquery-cache",".stryker-tmp","dist","build","coverage",".next",".nuxt","target"]),ye=new Set(["package.json","package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lockb","tsconfig.json","tsconfig.base.json","pyproject.toml","setup.py","setup.cfg","Cargo.toml","Cargo.lock","go.mod","go.sum","pom.xml","build.gradle","build.gradle.kts","build.sbt","compile_commands.json","CMakeLists.txt","Makefile","Gemfile","Gemfile.lock","composer.json","composer.lock","pubspec.yaml","pubspec.lock"]),ve={typescript:[".ts",".tsx",".mts",".cts"],javascript:[".js",".jsx",".mjs",".cjs"],java:[".java"],scala:[".scala"],kotlin:[".kt",".kts"],rust:[".rs"],python:[".py",".pyi"],ruby:[".rb"],go:[".go"],cpp:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"],c:[".c",".h"],csharp:[".cs"],vb:[".vb"],dart:[".dart"],php:[".php"]};import{createRequire as Re}from"module";import{existsSync as xe,readFileSync as v}from"fs";import{dirname as O,extname as Ve,join as A,relative as Ce,resolve as Ft}from"path";import{pathToFileURL as ke}from"url";function P(e,t){let{vueCore:r,ts:n,volarTs:i}=Le(e),{parsed:o,vueOptions:s}=Te(r,n,t),a=O(t),u=r.createVueLanguagePlugin(n,o.options,s,d=>d),c=De(r,n,u),l=Fe(a,o),{languageServiceHost:p}=i.createLanguageServiceHost(n,n.sys,c,d=>d,l),g=n.createLanguageService(p);return{ts:n,language:c,languageService:g,fileNames:o.fileNames,configDir:a}}function Le(e){let t=Re(ke(A(e,"package.json")).href);return{vueCore:y(t,"@vue/language-core",e),ts:y(t,"typescript",e),volarTs:y(t,"@volar/typescript",e)}}function Te(e,t,r){let n=t.readConfigFile(r,t.sys.readFile);if(n.error||!n.config)throw new Error(`Failed to read ${r}`);let o=e.createParsedCommandLine(t,t.sys,r).vueOptions;return typeof e.createGlobalTypesWriter=="function"&&(o.globalTypesPath=e.createGlobalTypesWriter(o,t.sys.writeFile)),{parsed:t.parseJsonConfigFileContent(n.config,t.sys,O(r),void 0,r,void 0,e.getAllExtensions(o).map(s=>({extension:s.slice(1),isMixedContent:!0,scriptKind:t.ScriptKind.Deferred}))),vueOptions:o}}function De(e,t,r){let n={},i=e.createLanguage([r],new Map,o=>{if(!xe(o))return;let s=v(o,"utf-8");n.current?.scripts.set(o,t.ScriptSnapshot.fromString(s),r.getLanguageId(o)??Oe(o))});return n.current=i,i}function Fe(e,t){return{getCurrentDirectory:()=>e,getCompilationSettings:()=>t.options,getScriptFileNames:()=>t.fileNames,getProjectReferences:()=>t.projectReferences,getProjectVersion:()=>"0"}}function y(e,t,r){try{return e(t)}catch(n){throw(typeof n=="object"&&n!==null&&"code"in n?n.code:null)==="MODULE_NOT_FOUND"?new Error(`Vue augmentation requires ${t} to be installed in ${r}. Install Vue/Volar dependencies for that project, then rerun augment-vue.`,{cause:n}):n}}function N(e,t,r){let n=Ie(e);return i=>{let o=f(t,i.fileName),s=r.get(i.fileName);if(!s)return null;let a=r.positionAt(s,i.textSpan.start),u=n.get(o);if(!u)return null;let c=u.containingByLine.get(a.line);return c!==void 0?c:Ee(u.starts,a.line,2)}}function Ie(e){let t=e.prepare(`
62
- SELECT
63
- d.relative_path AS relativePath,
64
- der.start_line AS startLine,
65
- der.end_line AS endLine,
66
- der.symbol_id AS symbolId
67
- FROM defn_enclosing_ranges der
68
- JOIN documents d ON d.id = der.document_id
69
- ORDER BY d.relative_path, (der.end_line - der.start_line) DESC
70
- `).all(),r=new Map;for(let n of t){let i=r.get(n.relativePath);i||(i={containingByLine:new Map,starts:[]},r.set(n.relativePath,i)),i.starts.push({line:n.startLine,symbolId:n.symbolId});for(let o=n.startLine;o<=n.endLine;o++)i.containingByLine.set(o,n.symbolId)}for(let n of r.values())n.starts.sort((i,o)=>i.line-o.line);return r}function Ee(e,t,r){let n=0,i=e.length-1;for(;n<=i;){let s=Math.floor((n+i)/2);e[s].line<t?n=s+1:i=s-1}let o=null;for(let s of[i,n]){let a=e[s];if(!a)continue;let u=Math.abs(a.line-t);u>r||(!o||u<o.distance)&&(o={distance:u,symbolId:a.symbolId})}return o?.symbolId??null}function j(e,t){let r=Pe(t),n=e.prepare("SELECT id FROM global_symbols WHERE symbol = ?"),i=new Map;return{get(o){if(i.has(o))return i.get(o)??null;let s=Ne(n,r,t,o);return i.set(o,s),s}}}function _(e,t,r,n,i){if(e.fileName.endsWith(".vue")){let o=n.language.scripts.get(e.fileName),s=o?.generated?.languagePlugin.typescript?.getServiceScript(o.generated.root)?.code;if(o&&s){let a=n.language.maps.get(s,o);if(R(a,e.textSpan.start)!==null)return r.get(e.fileName)}return e.fileName.startsWith(i)?r.get(e.fileName):null}return t(e)}function*M(e){let t=/\b[A-Za-z_$][A-Za-z0-9_$]*\b/g,r=new Set(["script","setup","template","style","lang","scoped","true","false","null","undefined","const","let","var","import","from","export","return","if","else","for","while","function","class","type","interface","as","await","async"]),n;for(;n=t.exec(e);){let i=n[0];r.has(i)||(yield{text:i,start:n.index,end:n.index+i.length})}}function G(e,t){for(let[r]of e.toGeneratedLocation(t,n=>!!n.navigation))return r;return null}function R(e,t){let r=e;for(let[n]of r.toSourceLocation(t,i=>!!i.navigation))return n;return null}function we(e,t){let r=0,n=e.lineStarts.length-1;for(;r<=n;){let o=Math.floor((r+n)/2);e.lineStarts[o]<=t?r=o+1:n=o-1}let i=Math.max(0,n);return{line:i,character:t-e.lineStarts[i]}}function $(e,t){return f(e,t).startsWith("node_modules/")}function f(e,t){return Ce(e,t).replaceAll("\\","/")}function Oe(e){switch(Ve(e)){case".vue":return"vue";case".tsx":return"typescriptreact";case".ts":case".mts":case".cts":return"typescript";case".jsx":return"javascriptreact";case".js":case".mjs":case".cjs":return"javascript";case".json":return"json";default:return"typescript"}}function W(){let e=new Map;return{get(t){if(e.has(t))return e.get(t)??null;try{let r=v(t,"utf-8"),n={text:r,lineStarts:Ae(r)};return e.set(t,n),n}catch{return e.set(t,null),null}},positionAt:we}}function Ae(e){let t=[0];for(let r=0;r<e.length;r++)e.charCodeAt(r)===10&&t.push(r+1);return t}function Pe(e){try{let t=JSON.parse(v(A(e,"package.json"),"utf-8"));return{name:t.name??"workspace",version:t.version??"0.0.0"}}catch{return{name:"workspace",version:"0.0.0"}}}function Ne(e,t,r,n){let i=f(r,n),o=je(t.name,t.version,i);return e.get(o)?.id??null}function je(e,t,r){let n=r.split("/").map(i=>`\`${i.replaceAll("`","")}\``).join("/");return`scip-vue npm ${e} ${t} ${n}/default.`}function Kt(e){let t=Me(e.projectRoot,e.tsconfig),r=new _e(e.dbPath,{readonly:!0});try{let n=Ge({db:r,projectRoot:e.projectRoot,configPath:t,vueSymbolLookup:j(r,e.projectRoot)});return $e({vueFiles:e.vueFiles??[],tasks:e.tasks,...n})}finally{r.close()}}function Ge(e){let t=W();return{projectRoot:e.projectRoot,context:P(e.projectRoot,e.configPath),symbolLookup:N(e.db,e.projectRoot,t),vueSymbolLookup:e.vueSymbolLookup,sourceReader:t}}function $e(e){let t=[],r=0,n=e.tasks??e.vueFiles.map(i=>({fileName:i,startOffset:0,endOffset:Number.POSITIVE_INFINITY,countFileSkip:!0}));for(let i of n){let o=We(e,i);t.push(...o.occurrences),r+=o.skippedReferences}return{occurrences:t,skippedReferences:r}}function We(e,t){let r=e.context.language.scripts.get(t.fileName),n=r?.generated?.languagePlugin.typescript?.getServiceScript(r.generated.root)?.code;if(!r||!n)return{occurrences:[],skippedReferences:t.countFileSkip?1:0};let i=e.sourceReader.get(t.fileName);if(!i)return{occurrences:[],skippedReferences:t.countFileSkip?1:0};let o=e.context.language.maps.get(n,r),s=f(e.projectRoot,t.fileName),a=[...M(i.text)],u={tokens:a.filter(c=>c.start>=t.startOffset&&c.start<t.endOffset),tokenByStart:new Map(a.map(c=>[c.start,c])),tokenTextCounts:Ke(a),processedStarts:new Set};return He({...e,fileName:t.fileName,sourceInfo:i,sourceFile:s,map:o,tokenContext:u})}function He(e){let t=[],r=0;for(let n of e.tokenContext.tokens){if(e.tokenContext.processedStarts.has(n.start))continue;let i=G(e.map,n.start);if(i===null)continue;let s=(e.context.languageService.getDefinitionAtPosition(e.fileName,i+1)??[]).find(u=>!$(e.projectRoot,u.fileName));if(!s){r++;continue}let a=_(s,e.symbolLookup,e.vueSymbolLookup,e.context,e.projectRoot);if(a===null){r++;continue}H(t,e.sourceReader,e.sourceInfo,e.sourceFile,n,a),e.tokenContext.processedStarts.add(n.start),Ue(t,e,n,i,a)}return{occurrences:t,skippedReferences:r}}function Ue(e,t,r,n,i){if(!((t.tokenContext.tokenTextCounts.get(r.text)??0)<=1))for(let o of Be(t.context.languageService,t.fileName,n+1,t.map,r,t.tokenContext.tokenByStart)){if(t.tokenContext.processedStarts.has(o))continue;let s=t.tokenContext.tokenByStart.get(o);s&&(H(e,t.sourceReader,t.sourceInfo,t.sourceFile,s,i),t.tokenContext.processedStarts.add(o))}}function H(e,t,r,n,i,o){let s=t.positionAt(r,i.start);e.push({sourceFile:n,sourceLine:s.line,sourceStartChar:s.character,sourceEndChar:s.character+i.text.length,symbolId:o})}function Ke(e){let t=new Map;for(let r of e)t.set(r.text,(t.get(r.text)??0)+1);return t}function Be(e,t,r,n,i,o){let s=e.getDocumentHighlights?.(t,r,[t])??[],a=[];for(let u of s)if(u.fileName===t)for(let c of u.highlightSpans){let l=Je(n,c.textSpan.start,o,i.text);l!==null&&a.push(l)}return a}function Je(e,t,r,n){let i=r.get(t);if(i?.text===n)return i.start;let o=R(e,t);if(o===null)return null;let s=r.get(o);return s?.text===n?s.start:null}export{St as a,Ct as b,Kt as c};
71
- //# sourceMappingURL=chunk-KPHKX4LP.js.map
@@ -1,2 +0,0 @@
1
- import{a as D}from"./chunk-5UDFZC4D.js";import{a as g}from"./chunk-BNKE4TT5.js";import{a as y}from"./chunk-WBJZNPUT.js";import{a as f}from"./chunk-56UN3DMK.js";import{b as h}from"./chunk-UQJGTVHV.js";import{e as p}from"./chunk-KRGBLZT2.js";var v=.7,S=.62,C=.45;function j(i,t={}){let{windowCommits:e=100,limit:n=30,scope:o,scanLimit:a}=t,s=p(i);if(!s)return{available:!1,windowCommits:e,findings:[]};if(n<=0)return{available:!0,windowCommits:e,findings:[]};let d=F(i,{limit:n,minSimilarity:t.minSimilarity,scanLimit:a,scope:o,semantic:t.semantic}).map(r=>x(r,s,e)).filter(r=>r!==null);d.sort((r,c)=>(r.kind===c.kind?0:r.kind==="echo"?-1:1)||c.similarity-r.similarity||r.echoFile.localeCompare(c.echoFile)||r.echoSymbol.localeCompare(c.echoSymbol)||r.domain.localeCompare(c.domain));let b=d.slice(0,n).map(I);return{available:!0,windowCommits:e,findings:b,rootCauseGroups:w(b)}}function F(i,t){let e=N(t.limit);return[...A(i,{scope:t.scope,minSimilarity:t.minSimilarity??v,limit:e,scanLimit:t.scanLimit,semantic:t.semantic}),...B(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit}),...k(i,{scope:t.scope,minSimilarity:t.minSimilarity??C,limit:e,scanLimit:t.scanLimit}),...L(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit}),...E(i,{scope:t.scope,minSimilarity:t.minSimilarity??C,limit:e,scanLimit:t.scanLimit})]}function A(i,t){return h(i,{scope:t.scope,minSimilarity:t.minSimilarity,limit:t.limit,crossFileOnly:!0,scanLimit:t.scanLimit,semantic:t.semantic}).map(e=>({domain:"callable",basis:e.similarityBasis??"callees",symbolA:e.shortNameA,fileA:e.fileA,symbolB:e.shortNameB,fileB:e.fileB,similarity:e.similarity,sharedEvidence:e.sharedCallees,sharedCallees:e.sharedCallees}))}function B(i,t){return u(i,t,{query:y,domain:"react-component",basis:"jsx-structure",symbolA:e=>e.componentA,symbolB:e=>e.componentB,evidenceBuckets:e=>[["component",e.sharedComponents],["tag",e.sharedNativeTags],["prop",e.sharedProps],["event",e.sharedEvents],["binding",e.sharedBindings]]})}function u(i,t,e){return e.query(i,t).filter(n=>n.fileA!==n.fileB).map(n=>({domain:e.domain,basis:e.basis,symbolA:e.symbolA(n),fileA:n.fileA,symbolB:e.symbolB(n),fileB:n.fileB,similarity:n.similarity,sharedEvidence:K(...e.evidenceBuckets(n)),sharedCallees:[]}))}function k(i,t){return u(i,t,{query:f,domain:"react-hook",basis:"react-behavior",symbolA:e=>e.componentA,symbolB:e=>e.componentB,evidenceBuckets:e=>[["hook",e.sharedHooks],["react-hook",e.sharedReactHooks],["effect",e.sharedEffects],["state",e.sharedState],["request",e.sharedRequests],["handler",e.sharedHandlers],["action",e.sharedHandlerVerbs]]})}function L(i,t){return u(i,t,{query:g,domain:"vue-component",basis:"vue-template",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["component",e.sharedComponents],["prop",e.sharedProps],["event",e.sharedEvents],["directive",e.sharedDirectives],["slot",e.sharedSlots],["identifier",e.sharedIdentifiers]]})}function E(i,t){return u(i,t,{query:D,domain:"vue-composable",basis:"vue-behavior",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["composable",e.sharedComposables],["store",e.sharedStores],["reactivity",e.sharedReactivity],["lifecycle",e.sharedLifecycle],["request",e.sharedRequests],["function",e.sharedFunctions],["action",e.sharedFunctionVerbs],["binding",e.sharedBindings],["template-event",e.sharedTemplateEvents]]})}function x(i,t,e){let n=t.get(i.fileA)?.commitsAgo??null,o=t.get(i.fileB)?.commitsAgo??null,a=n!==null&&n<=e,s=o!==null&&o<=e;if(!a&&!s)return null;if(a&&s){let l=(n??0)<=(o??0);return{kind:"twin",domain:i.domain,basis:i.basis,echoSymbol:l?i.symbolA:i.symbolB,echoFile:l?i.fileA:i.fileB,echoAgeCommits:(l?n:o)??0,establishedSymbol:l?i.symbolB:i.symbolA,establishedFile:l?i.fileB:i.fileA,establishedAgeCommits:l?o:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}return{kind:"echo",domain:i.domain,basis:i.basis,echoSymbol:a?i.symbolA:i.symbolB,echoFile:a?i.fileA:i.fileB,echoAgeCommits:(a?n:o)??0,establishedSymbol:a?i.symbolB:i.symbolA,establishedFile:a?i.fileB:i.fileA,establishedAgeCommits:a?o:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}function I(i){let t=R(i);return{...i,rootCauseKey:t,groupKey:`recent-duplicate:${t}`}}function R(i){if(i.kind==="echo")return["echo",i.domain,i.basis,i.establishedSymbol].join(":");let t=i.sharedEvidence.slice().sort().join("|"),e=[i.echoSymbol,i.establishedSymbol].sort().join("|");return["twin",i.domain,i.basis,t||e].join(":")}function w(i){let t=new Map;for(let[e,n]of i.entries()){let o=n.rootCauseKey??R(n),a=n.groupKey??`recent-duplicate:${o}`,s=t.get(a);s||(s={groupKey:a,rootCauseKey:o,kind:n.kind,domain:n.domain,basis:n.basis,count:0,maxSimilarity:n.similarity,findingIndexes:[],echoFiles:new Set,establishedFile:n.kind==="echo"?n.establishedFile:void 0,establishedSymbol:n.kind==="echo"?n.establishedSymbol:void 0,relatedFiles:new Set,sharedEvidence:new Set,recommendation:T(n)},t.set(a,s)),s.count+=1,s.maxSimilarity=Math.max(s.maxSimilarity,n.similarity),s.findingIndexes.push(e),s.echoFiles.add(n.echoFile),s.relatedFiles.add(n.echoFile),s.relatedFiles.add(n.establishedFile);for(let l of n.sharedEvidence)s.sharedEvidence.add(l)}return[...t.values()].map(e=>({...e,echoFiles:[...e.echoFiles].sort(),relatedFiles:[...e.relatedFiles].sort(),sharedEvidence:[...e.sharedEvidence].sort().slice(0,16)})).sort((e,n)=>n.count-e.count||n.maxSimilarity-e.maxSimilarity||e.groupKey.localeCompare(n.groupKey))}function T(i){return i.kind==="echo"?"Review the established side once, then migrate or delete every echo in this group.":"Pick one owner for the new twins and consolidate the group before the copies diverge."}function N(i){return Number.isFinite(i)?i*5:Number.POSITIVE_INFINITY}function K(...i){let t=[],e=new Set;for(let[n,o]of i)for(let a of o){let s=`${n}:${a}`;e.has(s)||(e.add(s),t.push(s))}return t}function m(i){return(i.split("/").pop()??i).replace(/\.[^.]+$/,"")}export{j as a};
2
- //# sourceMappingURL=chunk-MA7OVFHI.js.map
@@ -1,3 +0,0 @@
1
- import{a as f}from"./chunk-64MNV6AB.js";import{c as l}from"./chunk-7S5E7KWT.js";import{readdirSync as g}from"fs";import{execFileSync as p}from"child_process";import{extname as d,join as m}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"],O=[".vue"],S=new Set(x.map(e=>e.toLowerCase())),y=[...S].sort().join(","),h=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo","out","coverage",".scipquery-cache","__pycache__",".venv","venv",".idea",".vscode"]);function F(e,n={}){let s=n.includeIndexed??!0,r=n.includeAuxiliary??!0,t=n.extensions?.map(c=>c.toLowerCase()),o=t?new Set(t):S,u=t?[...o].sort().join(","):y,i=`${s?"1":"0"}|${r?"1":"0"}|${u}`;return E.get(e,i,()=>{let c=new Set;if(s)for(let a of f(e,{includeIgnored:!1}))o.has(d(a).toLowerCase())&&c.add(a);if(r)for(let a of _(e.config.projectRoot,o))e.isIgnored(a)||s&&c.has(a)||c.add(a);return[...c].sort()})}var E=l("source-files",{clearGroups:[]});function _(e,n){return I(e,n)??v(e,n)}function I(e,n){try{let s=p("git",["ls-files","--cached","--others","--exclude-standard"],{cwd:e,encoding:"utf-8",timeout:1e4,stdio:["ignore","pipe","ignore"]}),r=new Set;for(let t of s.split(`
2
- `)){let o=t.trim();o&&n.has(d(o).toLowerCase())&&r.add(o)}return r}catch{return null}}function v(e,n){let s=new Set,r=t=>{let o=t?m(e,t):e,u;try{u=g(o,{withFileTypes:!0})}catch{return}for(let i of u)if(!h.has(i.name)){if(i.isDirectory()){r(t?`${t}/${i.name}`:i.name);continue}n.has(d(i.name).toLowerCase())&&s.add(t?`${t}/${i.name}`:i.name)}};return r(""),s}export{O as a,h as b,F as c};
3
- //# sourceMappingURL=chunk-OBBDKQAG.js.map
@@ -1,2 +0,0 @@
1
- import{a as y}from"./chunk-FOQHUKNZ.js";import{d as b}from"./chunk-JM72FNGA.js";import{a as d,d as g}from"./chunk-EWC3UK4V.js";import{b as u}from"./chunk-D322LMSA.js";import{c as m}from"./chunk-7S5E7KWT.js";var x=m("definition-consumer-file-usage",{clearGroups:["whole-project","source-file"]});function E(n,e,r){return n.callerFileMap(e,{semantic:r.semantic,sourceFallback:r.sourceFallback})}function I(n,e,r){let i=[],t=0,s=0,p=b(e.symbol);for(let a of r)v(n,a,e.relativePath,p)?t++:S(n,a,p)?s++:i.push(a);return{realConsumers:i,barrelConsumers:t,importOnlyConsumers:s}}function S(n,e,r){if(!r)return!1;let i=d(e);if(!i)return!1;let t=x.get(n,e,()=>C(n,e,i));return t.importedLeaves.has(r)&&!t.usedLeaves.has(r)}function C(n,e,r){let i=new Set,t=new Set,s=g(n,e);if(!s)return{importedLeaves:i,usedLeaves:t};let p=r==="rust"?new Set(["use_declaration"]):r==="python"?new Set(["import_statement","import_from_statement"]):new Set(["import_statement"]),a=(o,c)=>{let l=c||p.has(o.type);(o.type==="identifier"||o.type==="type_identifier"||o.type==="property_identifier"||o.type==="field_identifier")&&(l?i.add(o.text):t.add(o.text));for(let f of o.children)a(f,l)};return a(s.rootNode,!1),{importedLeaves:i,usedLeaves:t}}function v(n,e,r,i){if(!i)return!1;let t=u(n,e);if(t.length===0)return!1;let s=y(n,e);if(s.length===0)return!1;let p=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`\\b${p}\\b`),o=0;for(let c=0;c<t.length;c++){if(!a.test(t[c]??""))continue;if(o++,!s.find(f=>f.startLine<=c&&c<=f.endLine))return!1}return o>0}export{E as a,I as b,S as c};
2
- //# sourceMappingURL=chunk-RHTJBYZ5.js.map
@@ -1,5 +0,0 @@
1
- import{a as T,b as x,e as N,f as _}from"./chunk-3UVJJ6Z7.js";import{b as z}from"./chunk-B75HZHUP.js";import{a as v}from"./chunk-3ZYF3ELZ.js";import{a as $}from"./chunk-YTR4CO5S.js";import{a as I}from"./chunk-MZ7APUFN.js";import{c as d,d as E,g as D}from"./chunk-JM72FNGA.js";import{b as B}from"./chunk-D322LMSA.js";import{d as F}from"./chunk-7S5E7KWT.js";function Ae(e,n,i={}){let{minSimilarity:t=.4,limit:r=20}=i,s=ie(e,n,{semantic:i.semantic!==!1});if(!s)return[];if(!D(s.symbol))return[];let o=J(e,s,t,{scanLimit:i.scanLimit,semantic:i.semantic!==!1});return o.length>0?o.slice(0,r):me(e,n,{minSimilarity:t,limit:r})}function J(e,n,i,t){let r=se(e,{minCallees:3,scanLimit:t.scanLimit,semantic:t.semantic}),s=ae(n,r),o=N([n,...r.corpus].map(l=>l.callees)),a=[];for(let l of s){if(l.callees.size<3)continue;let c=j(n,l,o,{minSimilarity:i,requireSignificantShared:1,requireSharedCount:0});c&&a.push(c)}return a.sort((l,c)=>c.similarity-l.similarity),a}function j(e,n,i,t){let{similarity:r,significantShared:s}=_(e.callees,n.callees,i);if(r<t.minSimilarity)return null;let o=T(e.callees,n.callees).size;if(s.length<t.requireSignificantShared&&o<t.requireSharedCount)return null;let a=s.length>0?s:[...T(e.callees,n.callees)],l=K(a,"callees");return{symbolA:e.symbol,shortNameA:d(e.symbol),fileA:e.file,symbolB:n.symbol,shortNameB:d(n.symbol),fileB:n.file,similarity:r,similarityBasis:"callees",sharedCallees:a.map(d),uniqueToA:[...x(e.callees,n.callees)].map(d),uniqueToB:[...x(n.callees,e.callees)].map(d),...l}}function qe(e,n={}){let{minSimilarity:i=.5,limit:t=20,scope:r,minCallees:s=4,crossFileOnly:o=!1,scanLimit:a}=n,l=G(e,{minCallees:s,scope:r,scanLimit:a,semantic:n.semantic!==!1}),c=N(l.map(m=>m.callees)),f=new Map;for(let m of l)for(let u of m.callees)f.set(u,(f.get(u)??0)+1);let w=Math.max(8,Math.ceil(Math.sqrt(l.length))),y=new Map;for(let m=0;m<l.length;m+=1)for(let u of l[m].callees){if((f.get(u)??0)>w)continue;let g=y.get(u);g||(g=[],y.set(u,g)),g.push(m)}let S=[],b=0,h=new Set;for(let m=0;m<l.length;m+=1){let u=l[m],g=new Set;for(let R of u.callees){let C=y.get(R);if(C)for(let p of C)p>m&&g.add(p)}for(let R of g){let C=`${m}|${R}`;if(h.has(C))continue;h.add(C);let p=l[R];if(o&&u.file===p.file)continue;if(u.paramCount>=0&&p.paramCount>=0){let Q=Math.abs(u.paramCount-p.paramCount),Y=Math.max(2,Math.ceil(Math.max(u.paramCount,p.paramCount)*.5));if(Q>Y)continue}let L=j(u,p,c,{minSimilarity:i,requireSignificantShared:2,requireSharedCount:4});L&&(ee(S,L,t,b),b+=1)}}return S.sort((m,u)=>u.result.similarity-m.result.similarity||m.order-u.order),S.map(m=>m.result)}function ee(e,n,i,t){if(i<=0)return;if(e.length<i){e.push({result:n,order:t});return}let r=0;for(let o=1;o<e.length;o+=1){let a=e[o],l=e[r];(a.result.similarity<l.result.similarity||a.result.similarity===l.result.similarity&&a.order>l.order)&&(r=o)}let s=e[r];n.similarity<=s.result.similarity||(e[r]={result:n,order:t})}var ne=["ScipDatabase#all","ScipDatabase#get","ScipDatabase#prepare","ScipDatabase#pathExclusionsFor","ScipDatabase#isIgnored","ScipDatabase#symbolNoiseFor","PerDbValue#get","PerDbValue#has",":storage:db:ScipDatabase:all",":storage:db:ScipDatabase:get",":storage:db:ScipDatabase:prepare",":storage:db:ScipDatabase:pathExclusionsFor",":storage:db:ScipDatabase:isIgnored",":storage:db:ScipDatabase:symbolNoiseFor",":storage:per-db-cache:PerDbValue:get",":storage:per-db-cache:PerDbValue:has"];function ie(e,n,i){let t=I(e,n),r=new v(e);if(!t)return null;let s=$(e,t,{semantic:i.semantic});return{symbol:t.symbol,file:t.relativePath,callees:U(s.map(o=>o.symbol)),paramCount:r.callableSignature(t)?.paramCount??-1}}var te=F("callee-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),re=F("callee-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function G(e,n){let{minCallees:i,scope:t,excludeSymbol:r,scanLimit:s}=n,o=n.semantic!==!1,a=te.get(e,()=>new Map),l=`${i}|${t??""}|${s??""}|${o}`,c=a.get(l);return c||(c=le(e,{minCallees:i,scope:t,scanLimit:s,semantic:o}),a.set(l,c)),r===void 0?c:c.filter(f=>f.symbol!==r)}function se(e,n){let{minCallees:i,scope:t,scanLimit:r}=n,s=n.semantic!==!1,o=re.get(e,()=>new Map),a=`${i}|${t??""}|${r??""}|${s}`,l=o.get(a);return l||(l=oe(G(e,{minCallees:i,scope:t,scanLimit:r,semantic:s})),o.set(a,l)),l}function oe(e){let n=new Map;for(let r of e)for(let s of r.callees)n.set(s,(n.get(s)??0)+1);let i=Math.max(8,Math.ceil(Math.sqrt(e.length))),t=new Map;for(let r of e)for(let s of r.callees){if((n.get(s)??0)>i)continue;let o=t.get(s);o||(o=[],t.set(s,o)),o.push(r)}return{corpus:e,candidateByCallee:t,docFreq:n,ubiquityThreshold:i}}function ae(e,n){let i=new Map;for(let t of e.callees)for(let r of n.candidateByCallee.get(t)??[])r.symbol!==e.symbol&&i.set(r.symbol,r);return i.size>0?[...i.values()]:n.corpus.filter(t=>t.symbol!==e.symbol)}function le(e,n){let{minCallees:i,scope:t,scanLimit:r,semantic:s}=n,o=new v(e),a=z(o.productionCallableDefinitions({scope:t,minLoc:5,sortByLocDesc:typeof r=="number"&&r>0}),r),l=o.calleeMap(a,{semantic:s});return a.map(c=>({symbol:c.symbol,file:c.relativePath,callees:U((l.get(c.symbolId)??[]).map(f=>f.symbol)),paramCount:o.callableSignature(c)?.paramCount??-1})).filter(c=>c.callees.size>=i)}function U(e){return new Set([...e].filter(n=>!ce(n)))}function ce(e){return ne.some(n=>e.includes(n))}function me(e,n,i){let t=pe(e,n);if(!t||t.tokens.size<3)return[];let r=i.minSimilarity>=.5?i.minSimilarity:.3,s=[],o=Fe(t,he(e));for(let a of o){if(a.symbol===t.symbol||a.tokens.size<3)continue;let l=T(t.tokens,a.tokens);if(l.size<2)continue;let c=new Set([...t.tokens,...a.tokens]),f=c.size>0?l.size/c.size:0;f<r||s.push({symbolA:t.symbol,shortNameA:d(t.symbol),fileA:t.file,symbolB:a.symbol,shortNameB:d(a.symbol),fileB:a.file,similarity:f,similarityBasis:"source-tokens",sharedCallees:[...l].sort(),uniqueToA:[...x(t.tokens,a.tokens)].sort(),uniqueToB:[...x(a.tokens,t.tokens)].sort(),...K([...l],"source-tokens")})}return s.sort((a,l)=>l.similarity-a.similarity||a.shortNameB.localeCompare(l.shortNameB)),s.slice(0,i.limit)}function K(e,n){let i=e.flatMap(A),t=e.flatMap(m=>O(m,n)),r=M(i,V),s=M(i,Z),o=M(t,q),a=[...new Set(t.filter(P))],l=e.filter(m=>{let u=O(m,n);return u.some(g=>q.has(g))&&u.some(P)}).length,c=[];r.length>0&&c.push(`access/query scaffolding: ${r.slice(0,5).join(", ")}`),s.length>0&&c.push(`framework/generic scaffolding: ${s.slice(0,5).join(", ")}`),o.length>0&&c.push(`domain behavior verbs: ${o.slice(0,5).join(", ")}`),o.length>0&&a.length>0&&c.push(`domain-specific terms: ${a.slice(0,5).join(", ")}`);let f=n==="source-tokens"&&i.length>0&&i.every(m=>H.has(m));f&&c.push("shared source tokens are generic scaffolding");let w=o.length>0&&a.length>0,y=r.length+s.length>0,S=n==="callees"&&w&&e.length>=4&&a.length>=4&&l>=2,b=S?"domain-behavior":w?y?"mixed":"domain-behavior":r.length>0?"access-query-scaffolding":s.length>0||f?"framework-scaffolding":"structural-overlap";b==="structural-overlap"&&e.length>0&&c.push(`shared ${n} overlap has no recognized domain or scaffolding category`);let h=b==="domain-behavior"&&(e.length>=3||S)?"direct":"signal";return{evidenceClass:b,actionTier:h,evidenceClassReasons:c,recommendation:ue(b,h)}}function ue(e,n){return n==="direct"?"Shared domain behavior looks concrete; review for an extract/reuse opportunity.":e==="mixed"?"Shared evidence mixes domain behavior with scaffolding; review semantics before extracting anything.":e==="access-query-scaffolding"?"Shared evidence is mostly access/query scaffolding; compare product semantics before reusing code.":e==="structural-overlap"?"Shared structure has no domain or scaffolding classification; inspect names and behavior before reusing code.":"Shared evidence is mostly framework or generic scaffolding; treat as a contextual signal."}function M(e,n){return[...new Set(e.filter(i=>n.has(i)))]}function A(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(n=>n.length>1)}function O(e,n){if(n==="source-tokens")return A(e);let i=E(e);return A(i.length>0?i:fe(e))}function fe(e){return e.replace(/[()`]/g," ").replace(/\.[a-z][a-z0-9]+(?=\s|$)/gi," ").split(/[:/\\\s]+/).map(t=>t.trim()).filter(t=>/[A-Za-z]/.test(t)).at(-1)?.replace(/\.$/,"")??e}function P(e){return e.length>3&&!q.has(e)&&!V.has(e)&&!Z.has(e)&&!H.has(e)&&!ge.has(e)}var q=new Set(["archive","assign","book","cancel","create","delete","ensure","export","import","notify","persist","publish","restore","schedule","send","set","submit","sync","update","upload","validate","write"]),V=new Set(["access","auth","authorize","cache","context","db","find","get","guard","list","permission","permissions","prisma","query","request","response","role","route","session","sql","where"]),Z=new Set(["bytes","computed","crypto","describe","effect","expect","fetch","filter","hex","hook","json","map","mounted","on","promise","random","react","reduce","ref","render","state","test","token","trim","uuid","vue","watch"]),H=new Set(["bytes","crypto","data","false","get","hex","id","key","map","name","num","random","result","secret","set","string","to","token","true","type","value"]),ge=new Set(["best","backend","conflict","database","effect","effects","error","errors","frontend","found","helpers","javascript","module","modules","scip","shared","source","typescript","utils","with","workflow","workflows"]);function pe(e,n){let i=I(e,n);if(!i||!D(i.symbol))return null;let t=de(e,i);return t?{symbol:i.symbol,file:i.relativePath,tokens:t}:null}function de(e,n){let i=E(n.symbol),t=W(e,n.relativePath,n.startLine,n.endLine,i),r=X(t,i);return r.size>0?r:null}var be=F("source-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),Se=F("source-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function ye(e){return be.get(e,()=>xe(e))}function he(e){return Se.get(e,()=>Ce(ye(e)))}function Ce(e){let n=new Map;for(let r of e)for(let s of r.tokens)n.set(s,(n.get(s)??0)+1);let i=Math.max(8,Math.ceil(Math.sqrt(e.length))),t=new Map;for(let r of e)for(let s of r.tokens){if((n.get(s)??0)>i)continue;let o=t.get(s);o||(o=[],t.set(s,o)),o.push(r)}return{corpus:e,candidateByToken:t,docFreq:n,ubiquityThreshold:i}}function Fe(e,n){let i=new Map;for(let t of e.tokens)for(let r of n.candidateByToken.get(t)??[])r.symbol!==e.symbol&&i.set(r.symbol,r);return i.size>0?[...i.values()]:n.corpus.filter(t=>t.symbol!==e.symbol)}function xe(e){return new v(e).productionCallableDefinitions().map(i=>({symbol:i.symbol,file:i.relativePath,tokens:X(W(e,i.relativePath,i.startLine,i.endLine,i.leaf),i.leaf)})).filter(i=>i.tokens.size>0)}function W(e,n,i,t,r){let s=B(e,n);if(s.length===0)return"";if(t>=i&&t-i<=12)return s.slice(i,t+1).join(`
2
- `);let o=[new RegExp(`\\bdef\\s+${k(r)}\\b`),new RegExp(`\\bfun\\s+${k(r)}\\b`),new RegExp(`\\bfn\\s+${k(r)}\\b`),new RegExp(`\\bfunction\\s+${k(r)}\\b`),new RegExp(`\\b${k(r)}\\s*\\(`)],a=s.findIndex(l=>o.some(c=>c.test(l)));if(a>=0){let l=a;for(let c=a+1;c<s.length&&c<=a+8;c++){let f=s[c]??"";if(c>a&&we(f)||(l=c,f.trim()===""&&c>a+1))break}return s.slice(a,l+1).join(`
3
- `)}return s.slice(i,Math.min(s.length,i+8)).join(`
4
- `)}function X(e,n){if(!e)return new Set;let i=new Set(["public","private","protected","final","static","class","def","fun","fn","function","return","string","bool","boolean","void","unit","self","this","new","const","let","var","end","pub"]),t=ke(n),s=e.replace(/["'`]/g," ").replace(/\b\d+\b/g," NUM ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[^A-Za-z0-9_]+/g," ").replace(/_/g," ").toLowerCase().split(/\s+/).map(o=>o.trim()).filter(o=>o.length>1).filter(o=>!i.has(o)).filter(o=>!t.has(o));return new Set(s)}function ke(e){return new Set(e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9_]+|_/).map(n=>n.toLowerCase()).filter(n=>n.length>1))}function we(e){return/^\s*(?:def|fun|fn|function|class|trait|module|object|enum|interface|public|private|protected)\b/.test(e)}function k(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{Ae as a,qe as b,ee as c,G as d,oe as e,ae as f,U as g,K as h};
5
- //# sourceMappingURL=chunk-UQJGTVHV.js.map
@@ -1,4 +0,0 @@
1
- import{a as h,b as P,c as M}from"./chunk-RHTJBYZ5.js";import{a as w}from"./chunk-PFOCOG57.js";import{a as T}from"./chunk-3ZYF3ELZ.js";import{b as L,g as v}from"./chunk-ZQLO2SCU.js";import{a as b}from"./chunk-BGBBVSH4.js";import{a as I,c as D,d as p}from"./chunk-JM72FNGA.js";import{e as S}from"./chunk-QLNGUWR7.js";import{a as y}from"./chunk-D322LMSA.js";function re(t,e){let{scope:n,minLoc:i=3,maxLoc:s=80,limit:r=30,includeLowConfidence:a=!1,scanLimit:l}=e??{},d=e?.semantic!==!1,o=new T(t),m=o.scopedDefinitions(n),g=H(o,n),x={high:0,medium:1,low:2};return w({candidates:()=>F(t,o,m,{minLoc:i,maxLoc:s}),orderCandidates:(c,u)=>b(u)-b(c)||c.relativePath.localeCompare(u.relativePath),scanLimit:l,prepare:c=>({consumerFileMap:K(o,c,{semantic:d}),singletonBackedClassIds:O(t,o,m,c,{semantic:d}),candidateIndex:$(c)}),evaluate:(c,u)=>{if(u.singletonBackedClassIds.has(c.symbolId))return null;let f=B(t,c,u.consumerFileMap,u.candidateIndex);if(f.transitivelyReachable||f.realConsumers.length>1||f.realConsumers.length===0&&f.barrelConsumers>0||!_(f.definition,f.realConsumers.length,g))return null;let C=N(t,f);return!a&&C.confidence==="low"?null:C},orderResults:(c,u)=>x[c.confidence]-x[u.confidence]||u.loc-c.loc||c.file.localeCompare(u.file)||c.startLine-u.startLine,limit:r})}function F(t,e,n,i){return n.filter(s=>s.isTypeLike&&b(s)>=i.minLoc).filter(s=>b(s)<=i.maxLoc).filter(s=>!t.isIgnored(s.relativePath)).filter(s=>L(s.relativePath)!=="test").filter(s=>!v(t,s.symbol,s.relativePath)).filter(s=>!Z(s.symbol)).filter(s=>!e.hasSuppressionComment(s))}function K(t,e,n){return h(t,e,{semantic:n.semantic})}function $(t){let e=new Map;for(let n of t){let i=e.get(n.relativePath);i||(i=new Map,e.set(n.relativePath,i));let s=p(n.symbol);s&&i.set(s,n)}return e}function B(t,e,n,i){let r=[...n.get(e.symbolId)??new Set].filter(m=>m!==e.relativePath&&!t.isIgnored(m)),{realConsumers:a,barrelConsumers:l,importOnlyConsumers:d}=P(t,e,r),o=q(t,e,n,i);return{definition:e,realConsumers:a,barrelConsumers:l+d,transitivelyReachable:o}}function N(t,e){let n=R(t,e.definition.relativePath,e.definition.startLine),i=A(e.definition.relativePath)?!0:G(t,e.definition),{confidence:s,reason:r}=J(e.realConsumers.length,n,i),a=j(e.realConsumers.length,n,i);return{symbol:e.definition.symbol,shortName:D(e.definition.symbol),file:e.definition.relativePath,startLine:e.definition.startLine,endLine:e.definition.endLine,loc:b(e.definition),consumers:e.realConsumers.length,barrelConsumers:e.barrelConsumers,kind:n,definerUsesType:i,confidence:s,reason:r,actionTier:a.actionTier,stalenessKind:a.stalenessKind,recommendation:a.recommendation}}function j(t,e,n){return t===0?{actionTier:"direct",stalenessKind:"unused-abstraction",recommendation:"Delete the abstraction or wire the missing consumer after checking public/package surfaces."}:e==="class"?{actionTier:"signal",stalenessKind:"one-to-one-class-encapsulation",recommendation:"Treat as weak signal: a one-consumer class may be intentional encapsulation, so inline only after reviewing ownership and state boundaries."}:n?{actionTier:"signal",stalenessKind:"single-consumer-abstraction",recommendation:"Review whether this single-consumer abstraction earns its name or should be folded into the owning feature."}:{actionTier:"signal",stalenessKind:"misplaced-single-consumer-type",recommendation:"Review moving or co-locating the type with its only real consumer; keep it here only if this file owns the public contract."}}function O(t,e,n,i,s){let r=W(t,U(n),i),a=r.map(o=>o.singleton);if(r.length===0)return new Set;let l=h(e,a,{semantic:s.semantic}),d=new Set;for(let{singleton:o,classId:m}of r)E(t,o,l)&&d.add(m);return d}function U(t){let e=new Map;for(let n of t){let i=p(n.symbol);i&&e.set(k(n.relativePath,i),n)}return e}function W(t,e,n){let i=[];for(let s of n){let r=z(t,e,s);r&&i.push({singleton:r,classId:s.symbolId})}return i}function z(t,e,n){if(R(t,n.relativePath,n.startLine)!=="class")return null;let i=p(n.symbol);if(!i)return null;let s=V(t,n.relativePath,i);return s?e.get(k(n.relativePath,s))??null:null}function E(t,e,n){let i=p(e.symbol),s=n.get(e.symbolId);return!i||!s?!1:[...s].some(r=>r!==e.relativePath&&!t.isIgnored(r)&&!M(t,r,i))}function k(t,e){return`${t}\0${e}`}function V(t,e,n){let i=y(t,e);if(!i)return null;let s=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\bexport\\s+const\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*new\\s+${s}\\s*\\(`);return i.match(r)?.[1]??null}function H(t,e){return new Set(t.scopedDefinitions(e).filter(n=>n.isFunctionLike).map(n=>n.relativePath))}function Z(t){let e=I(t);if("kind"in e)return!1;let n=e.descriptors;if(n.length<2)return!1;let i=n[n.length-1],s=n[n.length-2];return i?.suffix==="type"&&s?.suffix==="type"}function A(t){let n=(t.split("/").pop()??"").replace(/\.[^.]+$/,"");return!!(n==="types"||n.endsWith("-types")||n==="models"||n==="schema"||n==="common"||n==="protocol"||n==="proto"||n==="dto"||n==="mod"||n==="contracts"||/(^|\/)types(\/|\.)/.test(t)||/(^|\/)models?(\/|\.)/.test(t)||/(^|\/)proto(?:col)?(\/|\.)/.test(t)||/(^|\/)schema(\/|\.)/.test(t)||/(^|\/)contracts?(\/|\.)/.test(t))}function _(t,e,n){return!(A(t.relativePath)&&e>0||e===0&&n.has(t.relativePath))}function q(t,e,n,i){let s=S(t,e.relativePath),r=p(e.symbol);if(!r)return!1;let a=s.get(r);if(!a||a.size===0)return!1;let l=i.get(e.relativePath);if(!l)return!1;for(let d of a){let o=l.get(d);if(!o)continue;let m=n.get(o.symbolId);if(m){for(let g of m)if(g!==e.relativePath&&!t.isIgnored(g))return!0}}return!1}function R(t,e,n){let i=y(t,e);if(!i)return"other";let s=i.split(`
2
- `),r=Math.max(0,n-2),a=Math.min(s.length-1,n+2);for(let l=r;l<=a;l++){let o=(s[l]??"").replace(/^\s*\/\/.*$/g,"");if(/\b(?:export\s+)?(?:abstract\s+)?class\s+\w/.test(o))return"class";if(/\b(?:export\s+)?interface\s+\w/.test(o))return"interface";if(/\b(?:export\s+)?type\s+\w/.test(o))return"type";if(/\b(?:export\s+)?(?:const\s+)?enum\s+\w/.test(o))return"enum"}return"other"}function G(t,e){let n=y(t,e.relativePath);if(!n)return!1;let i=p(e.symbol);if(!i)return!1;let s=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\b${s}\\b`),a=n.split(`
3
- `);for(let l=0;l<a.length;l++)if(!(l>=e.startLine&&l<=e.endLine)&&r.test(a[l]??""))return!0;return!1}function J(t,e,n){return t===0?{confidence:"high",reason:"unused \u2014 no consumers and defining file has no real usage"}:t===1&&e==="class"?{confidence:"low",reason:"1 consumer + class kind \u2014 likely 1:1 encapsulation, not over-abstraction"}:t===1&&!n?{confidence:"high",reason:"1 consumer + defining file never uses it \u2014 type belongs with its consumer"}:{confidence:"medium",reason:"1 consumer \u2014 single-use abstraction"}}export{re as a};
4
- //# sourceMappingURL=chunk-ZFMPHDAT.js.map