scip-query 0.21.1 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (399) hide show
  1. package/CHANGELOG.md +317 -0
  2. package/README.md +11 -0
  3. package/dist/augment-vue-worker.js +1 -1
  4. package/dist/by-kind-XI2CSWEY.js +2 -0
  5. package/dist/call-graph-UONR6JR5.js +2 -0
  6. package/dist/{chunk-JGMD6JGB.js → chunk-2E7CX53V.js} +2 -2
  7. package/dist/chunk-2GRUZAQF.js +43 -0
  8. package/dist/{chunk-RSUH7G5T.js → chunk-2LDBDR6J.js} +2 -2
  9. package/dist/{chunk-4SZJF4GK.js → chunk-2OOY75BW.js} +2 -2
  10. package/dist/{chunk-3YETOKNO.js → chunk-2R3V3PSD.js} +2 -2
  11. package/dist/chunk-2WC2OEDO.js +4 -0
  12. package/dist/{chunk-O4PZFAXA.js → chunk-3AF4TUFK.js} +2 -2
  13. package/dist/{chunk-I2LY3KN7.js → chunk-3D3QG236.js} +2 -2
  14. package/dist/{chunk-DXEJ4FLZ.js → chunk-3FHOF22C.js} +8 -8
  15. package/dist/{chunk-BCTCADNB.js → chunk-3JKSW6LJ.js} +2 -2
  16. package/dist/chunk-3L2ZBPEX.js +133 -0
  17. package/dist/{chunk-4HQYNZ3P.js → chunk-3PJABJSU.js} +2 -2
  18. package/dist/{chunk-GBZCVYWA.js → chunk-3SVF22I5.js} +2 -2
  19. package/dist/{chunk-TP2X2C2Y.js → chunk-3WR4E3A3.js} +2 -2
  20. package/dist/chunk-4FTZ4P5G.js +2 -0
  21. package/dist/{chunk-LJMWILX6.js → chunk-4ILJCCXV.js} +2 -2
  22. package/dist/chunk-4UX2F3JX.js +2 -0
  23. package/dist/chunk-4WNW27SX.js +2 -0
  24. package/dist/chunk-5ENOG4VP.js +61 -0
  25. package/dist/{chunk-YKHL4J3G.js → chunk-64BFSI5I.js} +2 -2
  26. package/dist/chunk-66DVSJQG.js +455 -0
  27. package/dist/{chunk-BYXWXLKM.js → chunk-6HFCYNYE.js} +2 -2
  28. package/dist/{chunk-UBETC3Q2.js → chunk-6I6L7Z62.js} +2 -2
  29. package/dist/{chunk-IZKJQQCQ.js → chunk-6PQNKL3G.js} +2 -2
  30. package/dist/{chunk-ITF3CWS5.js → chunk-6V5CNXL6.js} +2 -2
  31. package/dist/chunk-6VVV4WRR.js +4 -0
  32. package/dist/{chunk-ZQUNCTEZ.js → chunk-7BWFZPPZ.js} +2 -2
  33. package/dist/{chunk-5QM7QT5B.js → chunk-7CYG22FH.js} +2 -2
  34. package/dist/chunk-7F45LJKI.js +2 -0
  35. package/dist/{chunk-QN2AI3D2.js → chunk-7IWV2EG3.js} +2 -2
  36. package/dist/{chunk-5KIJMEPC.js → chunk-AFHTBORT.js} +2 -2
  37. package/dist/chunk-AVRYW5OZ.js +2 -0
  38. package/dist/chunk-B3PYOSCX.js +2 -0
  39. package/dist/{chunk-YF25RQER.js → chunk-B5D7QPBE.js} +2 -2
  40. package/dist/{chunk-PU6XDQ2X.js → chunk-BBCIS4DX.js} +5 -5
  41. package/dist/chunk-BDUVI7TO.js +3 -0
  42. package/dist/{chunk-UXNXOMXJ.js → chunk-BE7ZZTMC.js} +2 -2
  43. package/dist/{chunk-527HV7JY.js → chunk-BHVUJOCQ.js} +2 -2
  44. package/dist/{chunk-4IASLUOP.js → chunk-BJT7LSPK.js} +2 -2
  45. package/dist/chunk-BKVWUP7Y.js +2 -0
  46. package/dist/{chunk-QZCACNV5.js → chunk-BQGB4HBD.js} +2 -2
  47. package/dist/{chunk-QH5Q6M5C.js → chunk-BRV7PIFF.js} +2 -2
  48. package/dist/chunk-CEEZJXEF.js +2 -0
  49. package/dist/{chunk-X5MWO4DM.js → chunk-CIYLO6SI.js} +2 -2
  50. package/dist/chunk-CJZXN4NU.js +2 -0
  51. package/dist/{chunk-V6XENWOF.js → chunk-CNO7TOKL.js} +2 -2
  52. package/dist/{chunk-FUUDUAKM.js → chunk-COF23M5F.js} +2 -2
  53. package/dist/{chunk-GTZFKDP3.js → chunk-CWFP7GM5.js} +2 -2
  54. package/dist/chunk-D2DHWI3D.js +2 -0
  55. package/dist/{chunk-SBFDPHKH.js → chunk-D4N5SQ2M.js} +2 -2
  56. package/dist/{chunk-FCGMQETU.js → chunk-DBRSYFXR.js} +2 -2
  57. package/dist/{chunk-47WX6UC4.js → chunk-DHUIOLDT.js} +2 -2
  58. package/dist/{chunk-KGKCJFWZ.js → chunk-DIRJWYBM.js} +2 -2
  59. package/dist/{chunk-QGVUPYBC.js → chunk-DIUFNHRJ.js} +2 -2
  60. package/dist/{chunk-YLNCTPOI.js → chunk-DTZCKZEU.js} +2 -2
  61. package/dist/{chunk-O3EX5STE.js → chunk-DULC3QFP.js} +2 -2
  62. package/dist/{chunk-B3AREUQK.js → chunk-DYGHBZ2N.js} +2 -2
  63. package/dist/{chunk-AAOEROT3.js → chunk-E5R6AQ73.js} +2 -2
  64. package/dist/{chunk-UM56ZET4.js → chunk-E73UNJTF.js} +2 -2
  65. package/dist/{chunk-6QN4FYQW.js → chunk-EG2CPZMJ.js} +2 -2
  66. package/dist/{chunk-OMVNRPST.js → chunk-EKV5HX33.js} +2 -2
  67. package/dist/{chunk-27OUNZW5.js → chunk-EQHFIL6T.js} +2 -2
  68. package/dist/{chunk-ZGDHC5AT.js → chunk-ESIQ66Z7.js} +2 -2
  69. package/dist/chunk-EVFUMY4R.js +3 -0
  70. package/dist/{chunk-WZRNEVYC.js → chunk-F7DY272B.js} +2 -2
  71. package/dist/chunk-FBN2FGXG.js +2 -0
  72. package/dist/{chunk-HR5JYLVV.js → chunk-FDLOBR6P.js} +2 -2
  73. package/dist/chunk-FESCRNVV.js +5 -0
  74. package/dist/{chunk-MLTKGHD2.js → chunk-FFRKR4EQ.js} +2 -2
  75. package/dist/chunk-FGA2U4OR.js +8 -0
  76. package/dist/{chunk-3KXFB2FM.js → chunk-FIQRSHVM.js} +2 -2
  77. package/dist/{chunk-ZP2WUVZ5.js → chunk-FPYLNQPT.js} +2 -2
  78. package/dist/{chunk-EPLE5O5O.js → chunk-FRUSVINH.js} +2 -2
  79. package/dist/chunk-GAS2LJMP.js +3 -0
  80. package/dist/{chunk-4TOU7HHQ.js → chunk-GSP44ENC.js} +2 -2
  81. package/dist/{chunk-DXYMTQZ4.js → chunk-GUFSG5TX.js} +2 -2
  82. package/dist/chunk-GYIZ4NXB.js +2 -0
  83. package/dist/{chunk-CQVDALWQ.js → chunk-GZIUDL6G.js} +2 -2
  84. package/dist/chunk-HCXEQRFF.js +18 -0
  85. package/dist/{chunk-2LJLEM5B.js → chunk-HEHOQQKH.js} +2 -2
  86. package/dist/{chunk-RNKRYK6B.js → chunk-HKGFPJ4T.js} +2 -2
  87. package/dist/chunk-HLZTEXRA.js +2 -0
  88. package/dist/{chunk-T2PBOVDI.js → chunk-HOENASQM.js} +2 -2
  89. package/dist/{chunk-PX6QNUYF.js → chunk-HVF5VBG6.js} +2 -2
  90. package/dist/{chunk-K2DZCH2K.js → chunk-HYO3NP5Q.js} +2 -2
  91. package/dist/{chunk-MRXBLYRE.js → chunk-I55I7XXP.js} +2 -2
  92. package/dist/{chunk-AQF35NGT.js → chunk-IDFEUFKS.js} +2 -2
  93. package/dist/{chunk-7G2WIVIX.js → chunk-IHGQTTVW.js} +2 -2
  94. package/dist/{chunk-P3UFF22M.js → chunk-IICPE7B2.js} +2 -2
  95. package/dist/{chunk-NT4NVEHU.js → chunk-IL676XCC.js} +2 -2
  96. package/dist/{chunk-OU6SDWAM.js → chunk-ILTDAWEF.js} +2 -2
  97. package/dist/chunk-IW5XQG5G.js +2 -0
  98. package/dist/chunk-IZDPJ2QI.js +2 -0
  99. package/dist/{chunk-J4HUBIVF.js → chunk-J66VOFW6.js} +2 -2
  100. package/dist/chunk-JFMEXGFE.js +2 -0
  101. package/dist/{chunk-DGM2RJ3I.js → chunk-JGKUET5J.js} +2 -2
  102. package/dist/{chunk-BM4OTGSY.js → chunk-JS4PGXMV.js} +2 -2
  103. package/dist/{chunk-OG5UK2K7.js → chunk-JTQVMR42.js} +2 -2
  104. package/dist/chunk-JWTGMPIT.js +80 -0
  105. package/dist/{chunk-3XQLJG7V.js → chunk-JYR66JN5.js} +2 -2
  106. package/dist/chunk-KLFEXGQA.js +2 -0
  107. package/dist/chunk-KYSDI3GE.js +5 -0
  108. package/dist/{chunk-LIWIV26I.js → chunk-L6PJPETJ.js} +2 -2
  109. package/dist/{chunk-6DO3VBLV.js → chunk-LDVT66YM.js} +2 -2
  110. package/dist/chunk-LEECKFCJ.js +2 -0
  111. package/dist/{chunk-BVR44XXB.js → chunk-LMZ5PRUV.js} +2 -2
  112. package/dist/{chunk-KFFQURUZ.js → chunk-LQRQN2XA.js} +2 -2
  113. package/dist/{chunk-YR7VRWNX.js → chunk-LXABEJX3.js} +2 -2
  114. package/dist/{chunk-ARGPDW2Y.js → chunk-M2O5NY6W.js} +2 -2
  115. package/dist/{chunk-7YZGSLW6.js → chunk-MNV5FSBW.js} +2 -2
  116. package/dist/{chunk-XFRHBAIT.js → chunk-MPQ4OTBM.js} +2 -2
  117. package/dist/{chunk-PJBYDCBQ.js → chunk-MV3CDXPI.js} +2 -2
  118. package/dist/{chunk-DK6MB565.js → chunk-MWN53KRN.js} +2 -2
  119. package/dist/chunk-N2ZSIIGR.js +117 -0
  120. package/dist/chunk-N5B2NILC.js +5 -0
  121. package/dist/{chunk-HW7FASEL.js → chunk-NJITK2GP.js} +2 -2
  122. package/dist/{chunk-DUDUIT5P.js → chunk-NOGJXYFO.js} +2 -2
  123. package/dist/chunk-NOYBFVJA.js +554 -0
  124. package/dist/chunk-NWQXSFFU.js +3 -0
  125. package/dist/chunk-ODDUPDP7.js +13 -0
  126. package/dist/chunk-OLIWTZI3.js +3 -0
  127. package/dist/{chunk-JO6FK3Q5.js → chunk-OLNV6I6U.js} +2 -2
  128. package/dist/{chunk-CXT3GZSQ.js → chunk-OR2E3AGZ.js} +2 -2
  129. package/dist/chunk-OSR2GEHQ.js +2 -0
  130. package/dist/{chunk-7MUHSZGN.js → chunk-OSSESPDX.js} +2 -2
  131. package/dist/{chunk-ND3BWIVN.js → chunk-OWOOWNJ5.js} +2 -2
  132. package/dist/{chunk-UEQORB2A.js → chunk-P42EIXTA.js} +2 -2
  133. package/dist/{chunk-PWEQ6CZZ.js → chunk-PJFGPYTU.js} +2 -2
  134. package/dist/{chunk-CNT4ND5O.js → chunk-PP7KNN7L.js} +2 -2
  135. package/dist/{chunk-C52Q3JEQ.js → chunk-PU7T5QYQ.js} +2 -2
  136. package/dist/{chunk-OY7PCALC.js → chunk-PWWAJSKV.js} +2 -2
  137. package/dist/{chunk-LXMW6ZAX.js → chunk-PZL5T7SU.js} +2 -2
  138. package/dist/{chunk-G47MFF47.js → chunk-QBE3YX64.js} +2 -2
  139. package/dist/{chunk-SGSPCEFC.js → chunk-QGVTFRY2.js} +2 -2
  140. package/dist/chunk-QOJONDS7.js +2 -0
  141. package/dist/chunk-QU5XRYB5.js +4 -0
  142. package/dist/{chunk-4ZCLDH6T.js → chunk-QUU5OBVK.js} +2 -2
  143. package/dist/{chunk-N4EFQIRX.js → chunk-RBLQNW26.js} +2 -2
  144. package/dist/chunk-RTQ7NEKG.js +81 -0
  145. package/dist/{chunk-XNF5T4T2.js → chunk-SQXRS7BG.js} +2 -2
  146. package/dist/chunk-SSK6LDPC.js +2 -0
  147. package/dist/chunk-SZHGTCPP.js +7 -0
  148. package/dist/chunk-T4N4P2K5.js +16 -0
  149. package/dist/{chunk-LFWB7TOJ.js → chunk-TA3QKLLU.js} +2 -2
  150. package/dist/chunk-TEBQMNVI.js +43 -0
  151. package/dist/chunk-TPFHAQ2G.js +2 -0
  152. package/dist/chunk-TQPCBMWT.js +5 -0
  153. package/dist/chunk-TQZV7KV4.js +2 -0
  154. package/dist/{chunk-FOP7HD6H.js → chunk-TRNAEQ6P.js} +2 -2
  155. package/dist/chunk-TY7CRN3Z.js +2 -0
  156. package/dist/{chunk-XDOEHEET.js → chunk-UHFYCMZO.js} +2 -2
  157. package/dist/{chunk-E6N6YTVM.js → chunk-UICY4GTQ.js} +2 -2
  158. package/dist/{chunk-AFRS7WJU.js → chunk-UVGEWT4Y.js} +2 -2
  159. package/dist/{chunk-IHGK3SZ7.js → chunk-UXW33INU.js} +2 -2
  160. package/dist/{chunk-RZWBTKXO.js → chunk-VMPRET3I.js} +2 -2
  161. package/dist/{chunk-DZA7MQMU.js → chunk-VNLGKHS6.js} +2 -2
  162. package/dist/chunk-VQILFTEH.js +2 -0
  163. package/dist/chunk-VUPHCS7Y.js +57 -0
  164. package/dist/{chunk-K63CAPS2.js → chunk-VVZSBTSU.js} +2 -2
  165. package/dist/{chunk-IH3K5J6K.js → chunk-VZRNID6A.js} +2 -2
  166. package/dist/{chunk-NSDPPUDY.js → chunk-W5OXRYGE.js} +2 -2
  167. package/dist/chunk-W6STWDQI.js +57 -0
  168. package/dist/chunk-W7CXK74K.js +2 -0
  169. package/dist/chunk-WB3WYIRE.js +4 -0
  170. package/dist/{chunk-WV6R37XV.js → chunk-WDNVY4E7.js} +2 -2
  171. package/dist/{chunk-Z2QB75BS.js → chunk-WIWY3CRX.js} +2 -2
  172. package/dist/chunk-WK46TNUM.js +3 -0
  173. package/dist/chunk-WNTFFKAX.js +12 -0
  174. package/dist/{chunk-U2MNECDU.js → chunk-WOIKCX6A.js} +2 -2
  175. package/dist/{chunk-5BJPJUXF.js → chunk-WUN6KBHV.js} +2 -2
  176. package/dist/chunk-WYCTJDVR.js +2 -0
  177. package/dist/chunk-WYPL7GF7.js +2 -0
  178. package/dist/{chunk-OFZVFIDF.js → chunk-XBGWL66K.js} +2 -2
  179. package/dist/{chunk-3T5U2EQ2.js → chunk-XDQMU3BT.js} +2 -2
  180. package/dist/{chunk-BZCRHP46.js → chunk-XFA4SSO3.js} +2 -2
  181. package/dist/{chunk-4KIPF45P.js → chunk-XGZEP6GR.js} +2 -2
  182. package/dist/chunk-XPDPNWTQ.js +368 -0
  183. package/dist/chunk-XRYABF57.js +8 -0
  184. package/dist/{chunk-KBIC6JHJ.js → chunk-YBGKCQIS.js} +2 -2
  185. package/dist/{chunk-5J3A6RBZ.js → chunk-YEN6CYC7.js} +2 -2
  186. package/dist/{chunk-OA2BO4DR.js → chunk-YF5IB2LF.js} +2 -2
  187. package/dist/{chunk-Q4MRRB3C.js → chunk-YI2AWIHC.js} +2 -2
  188. package/dist/{chunk-YCXQQ3YB.js → chunk-YPWBKGFU.js} +2 -2
  189. package/dist/{chunk-EJHNTAEE.js → chunk-YPWHBBIS.js} +2 -2
  190. package/dist/{chunk-FIO44MVK.js → chunk-YSH6U3L4.js} +2 -2
  191. package/dist/{chunk-HYU4W353.js → chunk-YU5DZUZI.js} +2 -2
  192. package/dist/chunk-YWO5DDRC.js +16 -0
  193. package/dist/{chunk-5Z2H76VD.js → chunk-YXPUP5G2.js} +2 -2
  194. package/dist/{chunk-H2RBDP5S.js → chunk-Z4CDXYNQ.js} +2 -2
  195. package/dist/{chunk-VJAD5WX5.js → chunk-ZF5KHH7C.js} +2 -2
  196. package/dist/chunk-ZOHS7AQV.js +21 -0
  197. package/dist/{chunk-YT4IQBET.js → chunk-ZTI4SBFV.js} +2 -2
  198. package/dist/cli-main.js +2 -2
  199. package/dist/code-MI6F2TTU.js +2 -0
  200. package/dist/code-result-json-FXALY4HE.js +2 -0
  201. package/dist/{command-descriptors-6INSCKLW.js → command-descriptors-P34VABY5.js} +144 -143
  202. package/dist/dataflow-4KEMJPC6.js +2 -0
  203. package/dist/dependence-slice-R7FPWD5M.js +2 -0
  204. package/dist/deps-7EMQUYUT.js +2 -0
  205. package/dist/direct-navigation-6YO234F2.js +3 -0
  206. package/dist/entry-map-KOOLR26E.js +2 -0
  207. package/dist/files-OPIPJIGZ.js +2 -0
  208. package/dist/hierarchy-QPD2CAER.js +2 -0
  209. package/dist/imports-M6HUXRXC.js +2 -0
  210. package/dist/index.js +1 -1
  211. package/dist/members-I5MEFOCT.js +2 -0
  212. package/dist/methods-5JYGGHXA.js +2 -0
  213. package/dist/output-continuation-command-UPQAAKBP.js +3 -0
  214. package/dist/postinstall.js +1 -1
  215. package/dist/project-reindex-UKKQ5PLS.js +3 -0
  216. package/dist/queries/affected.js +1 -1
  217. package/dist/queries/anchors.js +1 -1
  218. package/dist/queries/architecture.js +1 -1
  219. package/dist/queries/bottlenecks.js +1 -1
  220. package/dist/queries/by-kind.js +1 -1
  221. package/dist/queries/call-graph.js +1 -1
  222. package/dist/queries/change-surface.js +1 -1
  223. package/dist/queries/cleanup-plan.js +1 -1
  224. package/dist/queries/co-change.js +1 -1
  225. package/dist/queries/code.js +1 -1
  226. package/dist/queries/complexity-hotspots.js +1 -1
  227. package/dist/queries/complexity.d.ts +11 -0
  228. package/dist/queries/complexity.js +1 -1
  229. package/dist/queries/context.js +1 -1
  230. package/dist/queries/convergence.js +1 -1
  231. package/dist/queries/coupling.js +1 -1
  232. package/dist/queries/cycles.js +1 -1
  233. package/dist/queries/dataflow.js +1 -1
  234. package/dist/queries/dead.js +1 -1
  235. package/dist/queries/decorative-checkers.js +1 -1
  236. package/dist/queries/deep-chains.js +1 -1
  237. package/dist/queries/dependence-slice.js +1 -1
  238. package/dist/queries/dependency-depth.js +1 -1
  239. package/dist/queries/deps.js +1 -1
  240. package/dist/queries/diff-impact.d.ts +9 -0
  241. package/dist/queries/diff-impact.js +1 -1
  242. package/dist/queries/doc-drift.js +1 -1
  243. package/dist/queries/drift.js +1 -1
  244. package/dist/queries/duplicate-bodies.js +1 -1
  245. package/dist/queries/entry-map.js +1 -1
  246. package/dist/queries/evidence.js +1 -1
  247. package/dist/queries/extract-candidates.js +1 -1
  248. package/dist/queries/fan.js +1 -1
  249. package/dist/queries/files.js +1 -1
  250. package/dist/queries/health.js +1 -1
  251. package/dist/queries/hierarchy.js +1 -1
  252. package/dist/queries/hotspots.js +1 -1
  253. package/dist/queries/imports.js +1 -1
  254. package/dist/queries/incomplete-migration.js +1 -1
  255. package/dist/queries/index.js +1 -1
  256. package/dist/queries/isolated.js +1 -1
  257. package/dist/queries/locality-candidates.js +1 -1
  258. package/dist/queries/members.js +1 -1
  259. package/dist/queries/methods.js +1 -1
  260. package/dist/queries/not-implemented.js +1 -1
  261. package/dist/queries/outline.js +1 -1
  262. package/dist/queries/passthrough-candidates.js +1 -1
  263. package/dist/queries/plan-context.js +1 -1
  264. package/dist/queries/react-component-duplicates.js +1 -1
  265. package/dist/queries/react-hook-candidates.js +1 -1
  266. package/dist/queries/react-large-component-pressure.js +1 -1
  267. package/dist/queries/recent-duplicates.js +1 -1
  268. package/dist/queries/redundant-reexports.js +1 -1
  269. package/dist/queries/reference-neighborhood.js +1 -1
  270. package/dist/queries/reference-reachability.js +1 -1
  271. package/dist/queries/refs.js +1 -1
  272. package/dist/queries/self-audit.js +1 -1
  273. package/dist/queries/similar-chains.js +1 -1
  274. package/dist/queries/similar-files.js +1 -1
  275. package/dist/queries/similar-signatures.js +1 -1
  276. package/dist/queries/similar.js +1 -1
  277. package/dist/queries/slice.js +1 -1
  278. package/dist/queries/source-inspection.js +1 -1
  279. package/dist/queries/source-search.js +1 -1
  280. package/dist/queries/stale-abstractions.js +1 -1
  281. package/dist/queries/surface.js +1 -1
  282. package/dist/queries/symbols.js +1 -1
  283. package/dist/queries/system-map.js +1 -1
  284. package/dist/queries/system.js +1 -1
  285. package/dist/queries/test-quality.js +1 -1
  286. package/dist/queries/trace.js +1 -1
  287. package/dist/queries/twin-ab.js +1 -1
  288. package/dist/queries/twin-drift.js +1 -1
  289. package/dist/queries/unused-imports.js +1 -1
  290. package/dist/queries/unused-params.js +1 -1
  291. package/dist/queries/value-flow.js +1 -1
  292. package/dist/queries/vue-component-duplicates.js +1 -1
  293. package/dist/queries/vue-composable-candidates.js +1 -1
  294. package/dist/queries/vue-large-view-pressure.js +1 -1
  295. package/dist/queries/wrapper-candidates.js +1 -1
  296. package/dist/query-service-fastpath.js +5 -5
  297. package/dist/query-service-server.js +3 -3
  298. package/dist/refs-PSU4JZZW.js +2 -0
  299. package/dist/refs-pagination-JG6CJMRC.js +2 -0
  300. package/dist/reindex-worker.js +64 -22
  301. package/dist/reindex.d.ts +3 -2
  302. package/dist/reindex.js +74 -32
  303. package/dist/runtime.d.ts +34 -2
  304. package/dist/runtime.js +4 -4
  305. package/dist/rust-semantic-session-server.js +1 -1
  306. package/dist/rust-semantic-session-worker.js +1 -1
  307. package/dist/rust-semantic-worker.js +1 -1
  308. package/dist/{scip-cli-H-n59izO.d.ts → scip-cli-DOerTq-R.d.ts} +42 -4
  309. package/dist/slice-HYRATV64.js +2 -0
  310. package/dist/surface-VTGDYWF5.js +2 -0
  311. package/dist/symbol-resolution-WD5EU5JE.js +2 -0
  312. package/dist/system-LRQNFOR2.js +2 -0
  313. package/dist/trace-F4B6OLL4.js +2 -0
  314. package/dist/typescript-mailbox-worker.js +1 -1
  315. package/dist/value-flow-VRPZY72V.js +2 -0
  316. package/dist/watch-server.js +3 -3
  317. package/package.json +1 -1
  318. package/dist/by-kind-XXGZGNZ6.js +0 -2
  319. package/dist/call-graph-VGY3R4L3.js +0 -2
  320. package/dist/chunk-3XZELASU.js +0 -2
  321. package/dist/chunk-63TFRBMB.js +0 -2
  322. package/dist/chunk-67FK5KGV.js +0 -3
  323. package/dist/chunk-6LS3IG2I.js +0 -13
  324. package/dist/chunk-6X4KO5A7.js +0 -11
  325. package/dist/chunk-743MEVFJ.js +0 -8
  326. package/dist/chunk-7Z4GMCHM.js +0 -117
  327. package/dist/chunk-ANCHW2R4.js +0 -57
  328. package/dist/chunk-BMKTDJI6.js +0 -16
  329. package/dist/chunk-BZYSGZRK.js +0 -2
  330. package/dist/chunk-C7WSQA6A.js +0 -21
  331. package/dist/chunk-CTO3TRX7.js +0 -2
  332. package/dist/chunk-DNPETNXT.js +0 -2
  333. package/dist/chunk-DZNWXJN2.js +0 -18
  334. package/dist/chunk-E7CJ6O72.js +0 -2
  335. package/dist/chunk-FLSVYEPL.js +0 -2
  336. package/dist/chunk-FSPENGSU.js +0 -4
  337. package/dist/chunk-FYCH2EYQ.js +0 -2
  338. package/dist/chunk-G6VV7ROY.js +0 -2
  339. package/dist/chunk-GSHTVE56.js +0 -3
  340. package/dist/chunk-IGBQVEHE.js +0 -2
  341. package/dist/chunk-IM23CSG5.js +0 -2
  342. package/dist/chunk-IQMGNIGY.js +0 -2
  343. package/dist/chunk-JLZWYDCZ.js +0 -4
  344. package/dist/chunk-JSHDCVUM.js +0 -81
  345. package/dist/chunk-L7WRUNKJ.js +0 -2
  346. package/dist/chunk-LGVTIZPV.js +0 -61
  347. package/dist/chunk-MFBVUQJZ.js +0 -2
  348. package/dist/chunk-MLTSTKXD.js +0 -5
  349. package/dist/chunk-MR4ZKWO6.js +0 -57
  350. package/dist/chunk-NODZYYGC.js +0 -2
  351. package/dist/chunk-NP4JFCLE.js +0 -133
  352. package/dist/chunk-NQXWWE6S.js +0 -8
  353. package/dist/chunk-O2VY47Y5.js +0 -325
  354. package/dist/chunk-PAZSBPJR.js +0 -3
  355. package/dist/chunk-PRLU3I7G.js +0 -79
  356. package/dist/chunk-QLWZUFDT.js +0 -2
  357. package/dist/chunk-SIGVQT43.js +0 -2
  358. package/dist/chunk-SRIZDEWX.js +0 -4
  359. package/dist/chunk-U7DOYZDH.js +0 -2
  360. package/dist/chunk-UAQQR55F.js +0 -2
  361. package/dist/chunk-VRJG7N3I.js +0 -453
  362. package/dist/chunk-W7HN6V4E.js +0 -7
  363. package/dist/chunk-WCIKJ2E3.js +0 -3
  364. package/dist/chunk-WEXQYJY3.js +0 -5
  365. package/dist/chunk-WOPZX5GM.js +0 -2
  366. package/dist/chunk-WZ7V4BQV.js +0 -2
  367. package/dist/chunk-XDQX6LDT.js +0 -4
  368. package/dist/chunk-XIPGCT3D.js +0 -5
  369. package/dist/chunk-XKM5D2XS.js +0 -16
  370. package/dist/chunk-Y2S4YNLH.js +0 -3
  371. package/dist/chunk-YA72ZUKO.js +0 -2
  372. package/dist/chunk-YBWE6J32.js +0 -43
  373. package/dist/chunk-YDTK77JP.js +0 -43
  374. package/dist/chunk-Z2KGMIL4.js +0 -2
  375. package/dist/chunk-Z67JOKRE.js +0 -554
  376. package/dist/chunk-ZMS4YCY7.js +0 -2
  377. package/dist/chunk-ZNW5A5VX.js +0 -3
  378. package/dist/code-AXLJBZ6T.js +0 -2
  379. package/dist/code-result-json-CTZHAQXJ.js +0 -2
  380. package/dist/dataflow-AFXY423Q.js +0 -2
  381. package/dist/dependence-slice-2G4X6VSJ.js +0 -2
  382. package/dist/deps-LMCAV5DO.js +0 -2
  383. package/dist/direct-navigation-2ONV22Y2.js +0 -3
  384. package/dist/entry-map-ZOC3VXO5.js +0 -2
  385. package/dist/files-WJQJLHMH.js +0 -2
  386. package/dist/hierarchy-ASNIHAX4.js +0 -2
  387. package/dist/imports-JICEKDKK.js +0 -2
  388. package/dist/members-C5H2K3MS.js +0 -2
  389. package/dist/methods-KZOZHSD4.js +0 -2
  390. package/dist/output-continuation-command-NX3RH3TP.js +0 -3
  391. package/dist/project-reindex-A2SXUH2H.js +0 -3
  392. package/dist/refs-ZOORVRQC.js +0 -2
  393. package/dist/refs-pagination-SRCUOYRD.js +0 -2
  394. package/dist/slice-NOTBWA7S.js +0 -2
  395. package/dist/surface-BTBCLKNA.js +0 -2
  396. package/dist/symbol-resolution-SVSMX4RN.js +0 -2
  397. package/dist/system-2EIUFP6B.js +0 -2
  398. package/dist/trace-BB2GHQPG.js +0 -2
  399. package/dist/value-flow-OA7AHSUG.js +0 -2
@@ -1,3 +0,0 @@
1
- import{a as O,b as H,c as ce,e as le,f as U,i as fe}from"./chunk-UAQQR55F.js";import{P as v,Q as de,d as ie,e as se,f as K,l as ae}from"./chunk-NP4JFCLE.js";import{a as A}from"./chunk-5Z2H76VD.js";import{d as w,e as pe}from"./chunk-DRENNWRG.js";import{c as re}from"./chunk-FYCH2EYQ.js";import{a as j,e as x}from"./chunk-HGFDYOVB.js";import{fa as oe,h as ne,ka as $}from"./chunk-XIPGCT3D.js";import{existsSync as E}from"fs";import b from"path";var _=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"];function z(i,t){let e=t?b.dirname(b.join(i,t)):i,o=b.resolve(i);for(;e.startsWith(o);){for(let a of _){let s=b.join(e,a);if(E(s))return s}let r=b.dirname(e);if(r===e)break;e=r}for(let r of _){let a=b.join(i,r);if(E(a))return a}return null}function ue(i){let t=i.config.projectRoot,n=new Set(Le(t,i.config.semantic?.typescript?.tsconfigs)),e=A(i,{includeIgnored:!1,extensions:O});for(let o of e){let r=z(t,o);r&&n.add(b.resolve(r))}if(n.size===0){let o=z(t);o&&n.add(b.resolve(o))}return[...n].filter(o=>!me(t,o)).sort((o,r)=>o.localeCompare(r))}function Le(i,t=[]){let n=new Set;for(let e of t){let o=b.isAbsolute(e)?e:b.join(i,e);E(o)&&n.add(b.resolve(o))}for(let e of we(i))for(let o of _){let r=b.join(e,o);E(r)&&n.add(b.resolve(r))}if(n.size===0){let e=z(i);e&&n.add(b.resolve(e))}return[...n].filter(e=>!me(i,e)).sort((e,o)=>e.localeCompare(o))}function we(i){let t=b.join(i,"package.json");if(!E(t))return[];let n;try{n=JSON.parse(ne(t,"project package manifest"))}catch{return[]}return(Array.isArray(n.workspaces)?n.workspaces:n.workspaces?.packages??[]).flatMap(o=>se(i,o))}function me(i,t){let n=b.relative(i,t).replace(/\\/g,"/");return n.startsWith("..")||n.includes("/node_modules/")||n.startsWith("node_modules/")||n.includes("/dist/")||n.startsWith("dist/")}import{performance as m}from"perf_hooks";function I(i,t,n){if(i.has(t))return i.get(t);let e=n();return i.set(t,e),e}import he from"path";import{realpathSync as ye}from"fs";function Ee(i,t){return i.getReferences().map(n=>{let e=n.getNode();return B(e,t)})}function je(i){let t=i;return typeof t.findReferences=="function"?t.findReferences():[]}function Se(i,t,n,e){let o=[];for(let r of je(i))for(let a of Ee(r,e))a.file===t.relativePath&&a.line>=t.startLine&&a.line<=t.endLine||o.push(a);for(let r of n)o.push(r);return P(o)}function be(i,t,n,e){let o=[],r=n?.getStart();for(let a of i.getReferences()){let s=a.getNode();L(e,s.getSourceFile().getFilePath())===t&&(r!==void 0&&s.getStart()===r||o.push({location:B(s,e),node:s}))}return o}function B(i,t){let n=i.getSourceFile(),e=n.getLineAndColumnAtPos(i.getStart());return{file:L(t,n.getFilePath())??n.getBaseName(),line:e.line-1,column:e.column-1}}function Me(i,t,n){let e=i.getSourceFile(),o=q(e,i),r=i.getText(),a=new RegExp(`\\b${ae(r)}\\b`,"g"),s=e.getFullText().split(`
2
- `),c=[];for(let l=0;l<s.length;l++){if(l===o)continue;let f=s[l]??"";a.lastIndex=0;let p;for(;(p=a.exec(f))!==null;)c.push({file:t,line:l,column:p.index})}return P(c.filter(l=>L(n,he.join(n,l.file))===t))}function V(i){for(let t=i;t;t=t.getParent()){let n=t.getKindName();if(n.includes("Type")||n==="InterfaceDeclaration"||n==="TypeAliasDeclaration")return!0;if(n==="CallExpression"||n==="NewExpression"||n==="ExpressionStatement")return!1}return!1}function q(i,t){return i.getLineAndColumnAtPos(t.getStart()).line-1}function P(i){let t=new Set,n=[];for(let e of i){let o=`${e.file}:${e.line}:${e.column}`;t.has(o)||(t.add(o),n.push(e))}return n}function L(i,t){let n=i||process.cwd(),e=ge(n,t);if(e)return e;try{return ge(ye(n),ye(t))}catch{return null}}function ge(i,t){let n=he.relative(i,t).replace(/\\/g,"/");return!n||n===".."||n.startsWith("../")?null:n}function Ie(i,t,n,e){let o=Ae(t,e);return o.size===0?new Map:Oe(i,n,o)}function Ae(i,t){let n=new Map;for(let e of v(i,t)){let o=w(e.symbol)??e.leaf;if(!o)continue;let r=n.get(o);r||(r=[],n.set(o,r)),r.push(e)}return n}function Oe(i,t,n){let e=new Map,o=new Map;return t.forEachDescendant(r=>{for(let a of He(i,r)){let s=n.get(a);if(!s)continue;let c=q(t,r);for(let l of s){if(c<l.startLine-1||c>l.endLine+1)continue;let f=Math.abs(c-l.startLine),p=o.get(l.symbolId);p!==void 0&&p<=f||(o.set(l.symbolId,f),e.set(l.symbolId,r))}}}),e}function He(i,t){let n=[],e=o=>{o&&!n.includes(o)&&n.push(o)};if("getNameNode"in t&&typeof t.getNameNode=="function"){let o=t.getNameNode();e(o?.getText())}if("getName"in t&&typeof t.getName=="function"){let o=t.getName();e(o)}return i.Node.isIdentifier(t)&&e(t.getText()),n}var Ue=re("ts-definition-leaf-candidates",{clearGroups:["definition-catalog"]});function Fe(i,t,n,e){let o=J(i,t),r=Y(o.get(e)??[],n);if(r)return r;let a=[];for(let s of o.values())for(let c of s)((c.leaf||w(c.symbol)||"").includes(e)||c.symbol.includes(e))&&a.push(c);return Y(a,n)}function G(i,t,n,e){return Y(J(i,t).get(e)??[],n)}function xe(i,t){let n=new Map;for(let[e,o]of J(i,t)){let r=o[0];r&&n.set(e,r)}return n}function J(i,t){return Ue.get(i,t,()=>{let n=new Map;for(let e of v(i,t)){let o=e.leaf||w(e.symbol);if(!o)continue;let r=n.get(o);r||(r=[],n.set(o,r)),r.push({...e,leaf:o})}for(let e of n.values())e.sort((o,r)=>o.startLine-r.startLine||o.endLine-r.endLine||o.symbolId-r.symbolId);return n})}function Y(i,t){let n=null,e=Number.POSITIVE_INFINITY;for(let o of i){let r=Math.abs(o.startLine-t);(r<e||r===e&&n&&o.startLine<n.startLine)&&(n=o,e=r)}return n}import Be from"path";import{realpathSync as We}from"fs";function ke(i,t){let n=new Map,e=null,o=null,r=()=>(o??=A(i,{extensions:O}),o),a=()=>(e??=x("typescript.source-file-index",()=>$e(i.config.projectRoot,t,r()),()=>({projects:t.length,indexedDocuments:r().length})),e),s=c=>H(c)?I(n,c,()=>{let l=Te(i.config.projectRoot,c);if(!l)return null;for(let{project:f,sourceFiles:p}of a()){let d=p.get(l)??null;if(d||(d=f.addSourceFileAtPathIfExists(l)??null,d&&X(p,d)),d)return{project:f,sourceFile:d}}return null}):null;return{sourceFile:c=>s(c)?.sourceFile??null,sourceFileMatch:s,indexedTypeScriptLikeDocuments:r}}function $e(i,t,n){let e=t.map(({project:o})=>{let r=new Map;for(let a of o.getSourceFiles())X(r,a);return{project:o,sourceFiles:r}});for(let o of n){let r=Te(i,o);if(r)for(let a of e){if(a.sourceFiles.has(r))break;let s=a.project.addSourceFileAtPathIfExists(r)??null;if(s){X(a.sourceFiles,s);break}}}return e}function X(i,t){let n=Q(t.getFilePath());i.set(n,t);try{i.set(Q(We(n)),t)}catch(e){if(!$(e))throw e}}function Te(i,t){try{return Q(oe(i,t,{inputKind:"indexed TypeScript source file"}).absolutePath)}catch(n){if(!$(n))throw n;return null}}function Q(i){return Be.resolve(i)}function Z(i,t){for(let n of i)if(t===n.name||t.startsWith(`${n.name}/`))return n.name;return null}function De(i){let t=`${i.relativeDir}/src`;return[`${t}/index.ts`,`${t}/index.tsx`,`${t}/index.mts`,`${t}/index.cts`]}var Ke=32;function Vt(i,t){let n=x("typescript.provider.load",()=>ce());if(!n)return U("ts-morph is not installed");let e=x("typescript.provider.tsconfig-discovery",()=>ue(i));if(e.length===0)return U("no tsconfig found");try{let o=x("typescript.provider.project-bundles",()=>le(n,e),()=>({tsconfigs:e.length}));return _e(i,n,o)}catch(o){return U(o instanceof Error?o.message:String(o),e[0],e)}}function _e(i,t,n,e={}){return x("typescript.provider.construct",()=>new ee(i,t,n),()=>({tsconfigs:n.length,reusedProjects:e.reusedProjects===!0}))}var ee=class{constructor(t,n,e){this.db=t;this.tsMorph=n;this.projects=e;this.workspacePackages=ie(t.config.projectRoot),this.sourceFiles=ke(t,e)}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;compilerCheckerCache=new WeakMap;packageImportReferenceIndex=null;packageExportIndex=null;workspacePackages;sourceFiles;availability(){return{available:!0,tsconfigPath:this.projects[0]?.tsconfigPath,tsconfigPaths:this.projects.map(t=>t.tsconfigPath)}}importUsage(t){return I(this.importUsageCache,t,()=>{let n=this.sourceFiles.sourceFile(t);if(!n)return[];let e=Ve();return x("typescript.import-usage.file",()=>this.importUsageForSourceFile(t,n,e),()=>({file:t,...e}))})}referencesFor(t){return I(this.referencesCache,t.symbolId,()=>{let n=this.nodeForDefinition(t);return this.referencesForDefinitionNode(t,n)})}referencesForDefinitions(t,n={}){let e=new Map,o=j(),r=[];for(let f of t){let p=this.referencesCache.get(f.symbolId);p?e.set(f.symbolId,p):r.push(f)}if(r.length===0)return e;let a=r,s=n.exact?[]:r.filter(f=>!Ce(f));if(s.length>=Ke){let f=this.referencesForDefinitionsBySymbolScan(s);for(let p of s){let d=f.get(p.symbolId)??[];this.referencesCache.set(p.symbolId,d),e.set(p.symbolId,d)}if(a=r.filter(p=>Ce(p)),a.length===0)return e}let c=new Map;for(let f of a){let p=c.get(f.relativePath);p?p.push(f):c.set(f.relativePath,[f])}let l=[];for(let[f,p]of c){let d=Re();x("typescript.references-map.file",()=>{let S=this.definitionNodesForFile(f);for(let y of p){o&&(d.cacheMisses+=1);let h=S.get(y.symbolId)??null;o&&(h?d.nodeHits+=1:d.nodeMisses+=1);try{let u=this.referencesForDefinitionNode(y,h,o?d:void 0);this.referencesCache.set(y.symbolId,u),e.set(y.symbolId,u)}catch{d.preciseSearchFailures+=1,l.push(y)}}},()=>({relativePath:f,definitions:p.length,...ve(d)}))}if(l.length>0){let f=this.referencesForDefinitionsBySymbolScan(l);for(let p of l){let d=f.get(p.symbolId)??[];this.referencesCache.set(p.symbolId,d),e.set(p.symbolId,d)}}return e}referenceFragmentsForFiles(t){let n=de(this.db).filter(r=>H(r.relativePath)),e=t.filter(r=>this.sourceFiles.sourceFile(r)!==null),o=this.referencesForDefinitionsBySymbolScan(n,e);return fe(n,o,e)}referencesForDefinitionsBySymbolScan(t,n){let e=j(),o=Re(),r=new Map,a=new Set(t.map(c=>c.symbolId)),s=new Map(t.map(c=>[c.symbolId,c]));for(let c of t)r.set(c.symbolId,[]);return x("typescript.references-map.inverted-scan",()=>{let c=e?m.now():0,l=n?this.packageImportReferencesForFiles(n):this.packageImportReferences();for(let u of t){let g=l.get(u.symbolId)??[];if(g.length>0){let k=r.get(u.symbolId)??[];k.push(...g),r.set(u.symbolId,k)}e&&(o.packageReferenceCount+=g.length)}e&&(o.packageRefsMs+=m.now()-c);let f=new Map,p=new Map,d=this.hierarchyTargetsForDefinitions(t),S=new Set(t.map(u=>u.leaf).filter(Boolean)),y=e?m.now():0;for(let u of n??this.sourceFiles.indexedTypeScriptLikeDocuments()){if(this.db.isIgnored(u))continue;let g=this.sourceFiles.sourceFile(u);g&&(e&&(o.scanFiles+=1),this.addReferencesFromSourceFileScan(g,u,a,s,d,S,f,p,r,e?o:void 0))}e&&(o.scanMs+=m.now()-y);let h=e?m.now():0;this.addHierarchyMemberReferences(t,r,e?o:void 0),e&&(o.hierarchyMs+=m.now()-h);for(let[u,g]of r){let k=P(g);r.set(u,k),e&&(o.referenceCount+=k.length)}},()=>({definitions:t.length,...ve(o)})),r}addReferencesFromSourceFileScan(t,n,e,o,r,a,s,c,l,f){let p=this.compilerCheckerForSourceFile(t),d=t.compilerNode,S=Ge(t),y=h=>{if(this.tsMorph.ts.isIdentifier(h)){if(f&&(f.identifiers+=1),!a.has(h.text)&&!S.has(h.text)){this.tsMorph.ts.forEachChild(h,y);return}let u=this.compilerReferenceSymbol(p,h,f);if(u){let g;s.has(u)?g=s.get(u)??null:(g=this.referenceDefinitionFromCompilerSymbol(u),s.set(u,g)),f&&(g?f.targetHits+=1:f.targetMisses+=1);let k=I(c,u,()=>this.compilerSymbolKeys(u)),C=null,T=null,R=g&&e.has(g.symbolId)?o.get(g.symbolId):void 0;if(R&&(C=W(d,h),!Ne(R,n,C))){let N=d.getLineAndCharacterOfPosition(h.getStart(d));T={file:n,line:N.line,column:N.character};let D=l.get(R.symbolId)??[];D.push(T),l.set(R.symbolId,D),f&&(f.requestedHits+=1)}for(let N of k)for(let D of r.get(N)?.values()??[]){if(C??=W(d,h),Ne(D,n,C))continue;if(!T){let F=d.getLineAndCharacterOfPosition(h.getStart(d));T={file:n,line:F.line,column:F.character}}let M=l.get(D.symbolId)??[];M.push(T),l.set(D.symbolId,M),f&&(f.requestedHits+=1)}}}this.tsMorph.ts.forEachChild(h,y)};y(d)}hierarchyTargetsForDefinitions(t){let n=new Map;for(let e of t){let o=this.nodeForDefinition(e),r=o?.compilerNode;if(!r||!this.isHierarchyMethod(r))continue;let a=r.parent;if(!this.isHierarchyContainer(a))continue;let s=this.compilerCheckerForSourceFile(o.getSourceFile()),c=s.getSymbolAtLocation(r.name);if(c)for(let l of this.hierarchyMemberSymbols(s,a,c))for(let f of this.compilerSymbolKeys(l)){let p=n.get(f)??new Map;p.set(e.symbolId,e),n.set(f,p)}}return n}hierarchyMemberSymbols(t,n,e){let o=new Set,r=new Set,a=(s,c,l)=>{if(!r.has(s)){r.add(s),o.add(c);for(let f of l){let p=f.getProperty(e.name);p&&a(f,p,this.hierarchyAncestorTypesForType(t,f))}}};return a(t.getTypeAtLocation(n),e,this.hierarchyAncestorTypes(t,n)),o}addHierarchyMemberReferences(t,n,e){let o=new Map;for(let r of t){let a=this.nodeForDefinition(r),s=a?.compilerNode;if(!s||!this.isHierarchyMethod(s))continue;let c=s.parent;if(!this.isHierarchyContainer(c))continue;let l=this.compilerCheckerForSourceFile(a.getSourceFile()),f=l.getSymbolAtLocation(s.name);if(!f)continue;let p=s.getSourceFile(),d=p.getLineAndCharacterOfPosition(s.name.getStart(p)),S={definition:r,location:{file:r.relativePath,line:d.line,column:d.character}},y=n.get(r.symbolId)??[];for(let u of this.hierarchyMemberSymbols(l,c,f))if(u!==f)for(let g of this.compilerSymbolLocations(u))y.push(g),e&&(e.hierarchyReferences+=1);n.set(r.symbolId,y);let h=this.hierarchyRootMemberSymbols(l,c,f);for(let u of h){let g=o.get(u)??new Map;g.set(r.symbolId,S),o.set(u,g)}e&&(e.hierarchyDefinitions+=1)}for(let r of o.values())if(!(r.size<2)){e&&(e.hierarchyFamilies+=1);for(let{definition:a}of r.values()){let s=n.get(a.symbolId)??[];for(let c of r.values())c.definition.symbolId!==a.symbolId&&(s.push(c.location),e&&(e.hierarchyReferences+=1));n.set(a.symbolId,s)}}}hierarchyRootMemberSymbols(t,n,e){let o=new Set,r=new Set,a=(s,c,l)=>{if(r.has(s))return;r.add(s);let f=!1;for(let p of l){let d=p.getProperty(e.name);d&&(f=!0,a(p,d,this.hierarchyAncestorTypesForType(t,p)))}if(!f)for(let p of this.compilerSymbolKeys(c))o.add(p)};return a(t.getTypeAtLocation(n),e,this.hierarchyAncestorTypes(t,n)),o}compilerSymbolKeys(t){return(t.declarations??[]).map(n=>{let e=n.getSourceFile();return`${e.fileName}\0${n.getStart(e)}\0${t.name}`})}compilerSymbolLocations(t){let n=[];for(let e of t.declarations??[]){let o=e.getSourceFile(),r=L(this.db.config.projectRoot,o.fileName);if(!r)continue;let a=e.name,s=o.getLineAndCharacterOfPosition((a??e).getStart(o));n.push({file:r,line:s.line,column:s.character})}return n}baseTypes(t,n){try{return t.getBaseTypes(n)??[]}catch{return[]}}hierarchyAncestorTypes(t,n){let e=new Set(this.hierarchyAncestorTypesForType(t,t.getTypeAtLocation(n)));for(let o of n.heritageClauses??[])for(let r of o.types)e.add(t.getTypeAtLocation(r));return[...e]}hierarchyAncestorTypesForType(t,n){let e=new Set(this.baseTypes(t,n));for(let o of n.getSymbol()?.declarations??[])if(this.isHierarchyContainer(o))for(let r of o.heritageClauses??[])for(let a of r.types)e.add(t.getTypeAtLocation(a));return[...e]}isHierarchyMethod(t){return this.tsMorph.ts.isMethodDeclaration(t)||this.tsMorph.ts.isMethodSignature(t)}isHierarchyContainer(t){return this.tsMorph.ts.isClassDeclaration(t)||this.tsMorph.ts.isClassExpression(t)||this.tsMorph.ts.isInterfaceDeclaration(t)}compilerReferenceSymbol(t,n,e){e&&(e.symbolLookups+=1);let o=t.getSymbolAtLocation(n);if(o){if((o.flags&this.tsMorph.ts.SymbolFlags.Alias)===0)return o;try{return e&&(e.aliasResolutions+=1),t.getAliasedSymbol(o)}catch{return o}}}calleesFor(t){return I(this.calleesCache,t.symbolId,()=>I(this.fileCalleesCache,t.relativePath,()=>this.calleeMapForFile(t.relativePath)).get(t.symbolId)??[])}calleesForDefinitions(t){let n=new Map,e=new Map;for(let o of t){let r=e.get(o.relativePath);r?r.push(o):e.set(o.relativePath,[o])}for(let[o,r]of e){let a=this.fileCalleesCache.get(o),s=new Set(r.map(l=>l.symbolId)),c=a??this.calleeMapForFile(o,s);for(let l of r){let f=c.get(l.symbolId)??[];this.calleesCache.set(l.symbolId,f),n.set(l.symbolId,f)}}return n}referencesForDefinitionNode(t,n,e){let o=e?m.now():0,r=this.packageImportReferencesForDefinition(t);if(e&&(e.packageRefsMs+=m.now()-o,e.packageReferenceCount+=r.length),!n)return r;let a=e?m.now():0,s=Se(n,t,r,this.db.config.projectRoot);return e&&(e.semanticRefsMs+=m.now()-a,e.referenceCount+=s.length),s}signatureFor(t){return I(this.signatureCache,t.symbolId,()=>{let n=this.nodeForDefinition(t);if(!n||!this.tsMorph.Node.isFunctionDeclaration(n)&&!this.tsMorph.Node.isMethodDeclaration(n)&&!this.tsMorph.Node.isArrowFunction(n)&&!this.tsMorph.Node.isFunctionExpression(n)&&!this.tsMorph.Node.isConstructorDeclaration(n))return null;let e=n.getType().getCallSignatures()[0];if(!e)return null;let o=e.getParameters().map(a=>{let s=a.getDeclarations()[0],c=s?a.getTypeAtLocation(s).getText(s):a.getValueDeclaration()?.getType().getText()??"unknown";return Pe(c)}),r=e.getReturnType().getText(n);return`(${o.join(",")})=>${Pe(r)}`})}importUsageForSourceFile(t,n,e){let o=[],r=new Map;for(let a of n.getImportDeclarations()){e.declarations+=1;let s=K(this.db,t,a.getModuleSpecifierValue()),c=a.getImportClause()?.isTypeOnly()??!1;for(let l of te(a)){e.entries+=1;let f=c?null:l.identifier?.getSymbol()?.compilerSymbol??null;!c&&l.identifier&&(f?e.bindingSymbols+=1:e.missingBindingSymbols+=1);let p={sourcePath:s,entry:l,typeOnlyDeclaration:c,bindingSymbol:f,references:[]};if(o.push(p),c||!l.localName||!f)continue;let d=r.get(l.localName);d?d.push(p):r.set(l.localName,[p])}}return r.size>0&&n.forEachDescendant(a=>{if(a.getKindName()!=="Identifier")return;let s=r.get(a.getText());if(!s||qe(a))return;e.scannedIdentifiers+=1;let c=a.getSymbol()?.compilerSymbol;if(e.symbolLookups+=1,!!c){for(let l of s)if(l.bindingSymbol===c){l.references.push({location:B(a,this.db.config.projectRoot),node:a}),e.matchedReferences+=1;break}}}),o.map(a=>a.typeOnlyDeclaration?ze(t,a.sourcePath,a.entry):a.entry.identifier&&!a.bindingSymbol?(e.fallbackEntries+=1,this.valueImportUsageForEntry(t,a.sourcePath,a.entry)):this.valueImportUsageFromLocations(t,a.sourcePath,a.entry,a.references))}valueImportUsageForEntry(t,n,e){let o=e.identifier?e.identifier.findReferences():[],r=[];for(let a of o)for(let s of be(a,t,e.identifier,this.db.config.projectRoot))r.push(s);return this.valueImportUsageFromLocations(t,n,e,r)}valueImportUsageFromLocations(t,n,e,o){let r=o.some(c=>!V(c.node)),a=o.some(c=>V(c.node)),s=e.isTypeOnly;return{importer:t,sourcePath:n,importedName:e.importedName,localName:e.localName,kind:e.kind,isTypeOnly:s,isUsed:s||o.length>0,isTypeUsed:s||a,isValueUsed:r,references:o.map(c=>c.location)}}packageImportReferencesForDefinition(t){return this.packageImportReferences().get(t.symbolId)??[]}packageImportReferencesForFiles(t){let n=new Map,e=new Set;for(let r of t){let a=this.sourceFiles.sourceFile(r);if(a)for(let s of a.getImportDeclarations()){let c=Z(this.workspacePackages,s.getModuleSpecifierValue());c&&e.add(c)}}if(e.size===0)return n;let o=this.packageExportsForNames(e);for(let r of t)this.addPackageImportReferencesForDocument(n,o,r);for(let[r,a]of n)n.set(r,P(a));return n}packageImportReferences(){if(this.packageImportReferenceIndex)return this.packageImportReferenceIndex;let t=new Map,n=this.packageExports();for(let e of this.sourceFiles.indexedTypeScriptLikeDocuments())this.addPackageImportReferencesForDocument(t,n,e);for(let[e,o]of t)t.set(e,P(o));return this.packageImportReferenceIndex=t,t}addPackageImportReferencesForDocument(t,n,e){if(this.db.isIgnored(e))return;let o=this.sourceFiles.sourceFileMatch(e);if(o)for(let r of o.sourceFile.getImportDeclarations())this.addPackageImportReferencesForDeclaration(t,n,e,r)}addPackageImportReferencesForDeclaration(t,n,e,o){let r=Z(this.workspacePackages,o.getModuleSpecifierValue());if(!r)return;let a=n.get(r);if(a)for(let s of te(o)){if(s.kind!=="named"||!s.identifier)continue;let c=a.get(s.importedName);if(!c||c.size===0)continue;let l=Me(s.identifier,e,this.db.config.projectRoot);l.length>0&&Ze(t,c,l)}}packageExports(){return this.packageExportIndex?this.packageExportIndex:(this.packageExportIndex=this.packageExportsForNames(new Set(this.workspacePackages.map(t=>t.name))),this.packageExportIndex)}packageExportsForNames(t){let n=new Map;for(let e of this.workspacePackages){if(!t.has(e.name))continue;let o=new Map;for(let r of De(e))this.collectPackageExports(e,r,o,new Set);o.size>0&&n.set(e.name,o)}return n}collectPackageExports(t,n,e,o){if(o.has(n))return;o.add(n);let r=this.sourceFiles.sourceFile(n);if(r)for(let a of r.getExportDeclarations()){let s=a.getModuleSpecifierValue(),c=s?K(this.db,n,s):n;if(!c||!c.startsWith(`${t.relativeDir}/src/`))continue;let l=a.getNamedExports();if(l.length===0){if(a.isNamespaceExport())continue;this.collectPackageExports(t,c,e,o);continue}for(let f of l){let p=f.getNameNode().getText(),d=f.getAliasNode()?.getText()??p,S=this.indexedDefinitionByLeaf(c,p);if(!S)continue;let y=e.get(d);y||(y=new Set,e.set(d,y)),y.add(S.symbolId)}}}indexedDefinitionByLeaf(t,n){return I(this.indexedDefinitionLeafCache,t,()=>xe(this.db,t)).get(n)??null}nodeForDefinition(t){return I(this.definitionNodeCache,t.symbolId,()=>this.definitionNodesForFile(t.relativePath).get(t.symbolId)??null)}definitionNodesForFile(t){return I(this.fileDefinitionNodeCache,t,()=>{let n=this.sourceFiles.sourceFile(t);return n?Ie(this.tsMorph,this.db,n,t):new Map})}referenceDefinitionFromCompilerSymbol(t){return this.definitionFromCompilerSymbol(t,void 0,!0)}definitionFromCompilerSymbol(t,n,e=!1){let o=t.name,r=n?m.now():0,a=t.declarations??[];n&&(n.declarationsMs+=m.now()-r,n.declarationChecks+=a.length);for(let s of a){let c=n?m.now():0,l=s.getSourceFile(),f=L(this.db.config.projectRoot,l.fileName),p=l.getLineAndCharacterOfPosition(s.getStart(l)).line;if(n&&(n.declarationLocationMs+=m.now()-c),!f||this.db.isIgnored(f))continue;let d=n?m.now():0,S=this.compilerDeclarationName(s),y=e?G(this.db,f,p,o)??(S&&S!==o?G(this.db,f,p,S):null):Fe(this.db,f,p,o);if(n&&(n.indexedLookupMs+=m.now()-d),y)return{symbolId:y.symbolId,symbol:y.symbol,file:y.relativePath,line:y.startLine}}return null}compilerDeclarationName(t){let n=t.name;return n&&this.tsMorph.ts.isIdentifier(n)?n.text:null}calleeMapForFile(t,n){let e=j(),o=0,r=0,a=0,s=0,c=0,l=0,f=0,p=0,d=e?Xe():void 0;return x("typescript.callee-map.file",()=>{let S=e?m.now():0,y=this.sourceFiles.sourceFile(t);if(e&&(c=Math.round(m.now()-S)),!y)return new Map;let h=e?m.now():0,u=v(this.db,t).sort((M,F)=>M.startLine-F.startLine||F.endLine-M.endLine);if(e&&(l=Math.round(m.now()-h)),o=u.length,u.length===0)return new Map;let g=new Map,k=e?m.now():0,C=this.compilerCheckerForSourceFile(y),T=y.compilerNode;e&&(f=Math.round(m.now()-k));let R=new Map,N=M=>{if(this.tsMorph.ts.isCallExpression(M)||this.tsMorph.ts.isNewExpression(M)){e&&(r+=1);let F=this.semanticCalleeForCallNode(C,T,u,M,R,n,d);F&&(e&&(a+=1),Ye(g,F.callerId,F.target))}this.tsMorph.ts.forEachChild(M,N)},D=e?m.now():0;N(T),e&&(p=Math.round(m.now()-D));for(let[M,F]of g)g.set(M,et(F));return s=g.size,g},()=>({relativePath:t,definitions:o,callNodes:r,resolvedCallees:a,outputRows:s,requestedDefinitions:n?.size??o,sourceFileLookupMs:c,definitionsLoadMs:l,checkerLookupMs:f,traversalMs:p,...d?Qe(d):{}}))}semanticCalleeForCallNode(t,n,e,o,r,a,s){let c=s?m.now():0,l=Je(e,W(n,o));if(s&&(s.callerLookupMs+=m.now()-c),!l)return null;if(a&&!a.has(l.symbolId))return s&&(s.skippedUnrequestedCallers+=1),null;let f=o.expression,p=this.compilerSymbolForExpression(t,f,s),d=null;if(p)if(s&&(s.targetSymbolHits+=1),r.has(p))s&&(s.compilerSymbolCacheHits+=1),d=r.get(p)??null;else{s&&(s.compilerSymbolCacheMisses+=1);let S=s?m.now():0;d=this.definitionFromCompilerSymbol(p,s),s&&(s.targetLookupMs+=m.now()-S),r.set(p,d)}else s&&(s.targetMisses+=1);return d?{callerId:l.symbolId,target:{symbol:d.symbol,file:d.file,line:d.line,callsiteLine:W(n,o)}}:null}compilerSymbolForExpression(t,n,e){let o=e?m.now():0,r=t.getSymbolAtLocation(n);if(e&&(e.expressionSymbolMs+=m.now()-o),r)return r;e&&(e.typeFallbacks+=1);let a=e?m.now():0,s=t.getTypeAtLocation(n).getSymbol();return e&&(e.typeSymbolMs+=m.now()-a),s}compilerCheckerForSourceFile(t){let n=t.getProject(),e=this.compilerCheckerCache.get(n);return e||(e=n.getTypeChecker().compilerObject,this.compilerCheckerCache.set(n,e)),e}};function te(i){let t=[],n=i.getDefaultImport();n&&t.push({identifier:n,importedName:"default",localName:n.getText(),kind:"default",isTypeOnly:i.getImportClause()?.isTypeOnly()??!1});let e=i.getNamespaceImport();e&&t.push({identifier:e,importedName:"*",localName:e.getText(),kind:"namespace",isTypeOnly:i.getImportClause()?.isTypeOnly()??!1});for(let o of i.getNamedImports()){let r=o.getNameNode(),s=o.getAliasNode()??(r.getKindName()==="Identifier"?r:null);t.push({identifier:s,importedName:r.getText(),localName:s?.getText()??r.getText(),kind:"named",isTypeOnly:o.isTypeOnly()||(i.getImportClause()?.isTypeOnly()??!1)})}return t.length===0&&t.push({identifier:null,importedName:"*",localName:null,kind:"side-effect",isTypeOnly:!1}),t}function ze(i,t,n){return{importer:i,sourcePath:t,importedName:n.importedName,localName:n.localName,kind:n.kind,isTypeOnly:!0,isUsed:!0,isTypeUsed:!0,isValueUsed:!1,references:[]}}function Ve(){return{declarations:0,entries:0,bindingSymbols:0,missingBindingSymbols:0,scannedIdentifiers:0,symbolLookups:0,matchedReferences:0,fallbackEntries:0}}function qe(i){for(let t=i;t;t=t.getParent())if(t.getKindName()==="ImportDeclaration")return!0;return!1}function Ye(i,t,n){let e=i.get(t);e||(e=[],i.set(t,e)),e.push(n)}function Ge(i){let t=new Set;for(let n of i.getImportDeclarations())for(let e of te(n))e.localName&&t.add(e.localName);return t}function Je(i,t){let n=null;for(let e of i)t<e.startLine||t>e.endLine||(!n||e.startLine>=n.startLine)&&(n=e);return n}function W(i,t){return i.getLineAndCharacterOfPosition(t.getStart(i)).line}function Ne(i,t,n){return t===i.relativePath&&n>=i.startLine&&n<=i.endLine}function Ce(i){return i.symbol.includes("#")?pe(i.symbol)==="type"&&i.relativePath.endsWith(".d.ts"):!1}function Xe(){return{callerLookupMs:0,expressionSymbolMs:0,typeSymbolMs:0,targetLookupMs:0,declarationsMs:0,declarationLocationMs:0,indexedLookupMs:0,compilerSymbolCacheHits:0,compilerSymbolCacheMisses:0,targetSymbolHits:0,targetMisses:0,typeFallbacks:0,declarationChecks:0,skippedUnrequestedCallers:0}}function Qe(i){return{...i,callerLookupMs:Math.round(i.callerLookupMs),expressionSymbolMs:Math.round(i.expressionSymbolMs),typeSymbolMs:Math.round(i.typeSymbolMs),targetLookupMs:Math.round(i.targetLookupMs),declarationsMs:Math.round(i.declarationsMs),declarationLocationMs:Math.round(i.declarationLocationMs),indexedLookupMs:Math.round(i.indexedLookupMs)}}function Re(){return{cacheHits:0,cacheMisses:0,nodeHits:0,nodeMisses:0,scanFiles:0,identifiers:0,symbolLookups:0,aliasResolutions:0,targetHits:0,targetMisses:0,requestedHits:0,scanMs:0,packageRefsMs:0,semanticRefsMs:0,packageReferenceCount:0,referenceCount:0,preciseSearchFailures:0,hierarchyDefinitions:0,hierarchyFamilies:0,hierarchyReferences:0,hierarchyMs:0}}function ve(i){return{...i,scanMs:Math.round(i.scanMs),packageRefsMs:Math.round(i.packageRefsMs),semanticRefsMs:Math.round(i.semanticRefsMs),hierarchyMs:Math.round(i.hierarchyMs)}}function Ze(i,t,n){for(let e of t){let o=i.get(e)??[];o.push(...n),i.set(e,o)}}function et(i){let t=new Set,n=[];for(let e of i){let o=`${e.symbol}|${e.file}|${e.line}|${e.callsiteLine??""}`;t.has(o)||(t.add(o),n.push(e))}return n}function Pe(i){return i.replace(/\s+/g," ").replace(/\bimport\("[^"]+"\)\./g,"").trim()}export{ue as a,Vt as b,_e as c};
3
- //# sourceMappingURL=chunk-PAZSBPJR.js.map
@@ -1,79 +0,0 @@
1
- import{d as y}from"./chunk-DXYMTQZ4.js";import{c as v}from"./chunk-FYCH2EYQ.js";import{createHash as C}from"crypto";import{existsSync as L,mkdirSync as A}from"fs";import{dirname as T,join as F}from"path";import g from"better-sqlite3";var b="evidence.db";var O=["source-facts","definition-exclusions","doc-path-tokens","react-component-behavior-profiles"],_=new Set(O),w=25e4,I=512*1024*1024,k=6e4,u=new WeakMap,x=v("evidence-content-hash",{clearGroups:["whole-project","source-file"]}),j=v("evidence-project-fingerprint",{clearGroups:["whole-project"]}),s="evidence-v1",E="version NOT LIKE 'evidence-%'";function N(t){return C("sha256").update(t).digest("hex")}function Y(t,n,e){return x.get(t,n,()=>N(e))}function V(t){return j.get(t,"current",()=>{try{if(!t.generation.metadataRaw)return null;let n=y(t.generation.metadataRaw);if(n.kind!=="legacy"&&n.kind!=="supported"||!n.capabilities.usableForEvidenceCache)return null;let e=n.metadata,a=[...e.indexedLanguages??[]].sort();return N(JSON.stringify({fingerprint:e.fingerprint,indexedLanguages:a,status:e.status}))}catch(n){return d("project fingerprint unavailable",n),null}})}function d(t,n){process.env.SCIP_QUERY_DEBUG&&console.error(`evidence-cache: ${t}: ${n instanceof Error?n.message:String(n)}`)}function o(t){if(u.has(t))return u.get(t)??null;let n=null;try{let e=new g(t.config.evidenceDbPath??F(T(t.config.dbPath),b));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 project_evidence (
11
- kind TEXT NOT NULL,
12
- cache_key TEXT NOT NULL,
13
- project_fingerprint TEXT NOT NULL,
14
- version TEXT NOT NULL,
15
- payload TEXT NOT NULL,
16
- PRIMARY KEY (kind, cache_key)
17
- );
18
- CREATE TABLE IF NOT EXISTS semantic_callees (
19
- relative_path TEXT NOT NULL,
20
- symbol TEXT NOT NULL,
21
- content_hash TEXT NOT NULL,
22
- deps_digest TEXT NOT NULL,
23
- version TEXT NOT NULL,
24
- payload TEXT NOT NULL,
25
- PRIMARY KEY (relative_path, symbol)
26
- );
27
- CREATE TABLE IF NOT EXISTS semantic_references (
28
- relative_path TEXT NOT NULL,
29
- symbol TEXT NOT NULL,
30
- project_fingerprint TEXT NOT NULL,
31
- version TEXT NOT NULL,
32
- payload TEXT NOT NULL,
33
- PRIMARY KEY (relative_path, symbol)
34
- );
35
- `),n={evidence:e,shared:M(t.config.sharedEvidenceDbPath),readFileEvidence:e.prepare("SELECT payload FROM file_evidence WHERE kind = ? AND relative_path = ? AND content_hash = ? AND version = ?"),readLegacyFileEvidence:e.prepare(`SELECT payload FROM file_evidence
36
- WHERE kind = ? AND relative_path = ? AND content_hash = ? AND ${E}
37
- ORDER BY version DESC
38
- LIMIT 1`),writeFileEvidence:e.prepare("INSERT OR REPLACE INTO file_evidence (kind, relative_path, content_hash, version, payload) VALUES (?, ?, ?, ?, ?)"),rekeyFileEvidence:e.prepare("UPDATE file_evidence SET content_hash = ?, version = ? WHERE kind = ? AND relative_path = ? AND content_hash = ?"),readProjectEvidence:e.prepare("SELECT payload FROM project_evidence WHERE kind = ? AND cache_key = ? AND project_fingerprint = ? AND version = ?"),readLegacyProjectEvidence:e.prepare(`SELECT payload FROM project_evidence
39
- WHERE kind = ? AND cache_key = ? AND project_fingerprint = ? AND ${E}
40
- ORDER BY version DESC
41
- LIMIT 1`),writeProjectEvidence:e.prepare("INSERT OR REPLACE INTO project_evidence (kind, cache_key, project_fingerprint, version, payload) VALUES (?, ?, ?, ?, ?)"),rekeyProjectEvidenceKind:e.prepare("UPDATE project_evidence SET project_fingerprint = ?, version = ? WHERE kind = ? AND project_fingerprint = ?"),readCallees:e.prepare(`SELECT payload FROM semantic_callees
42
- WHERE relative_path = ? AND symbol = ? AND content_hash = ? AND deps_digest = ? AND version = ?`),readLegacyCallees:e.prepare(`SELECT payload FROM semantic_callees
43
- WHERE relative_path = ? AND symbol = ? AND content_hash = ? AND deps_digest = ? AND ${E}
44
- ORDER BY version DESC
45
- LIMIT 1`),readCalleesForFile:e.prepare(`SELECT symbol, payload FROM semantic_callees
46
- WHERE relative_path = ? AND content_hash = ? AND deps_digest = ? AND version = ?`),readLegacyCalleesForFile:e.prepare(`SELECT symbol, payload FROM semantic_callees
47
- WHERE relative_path = ? AND content_hash = ? AND deps_digest = ? AND ${E}
48
- ORDER BY symbol, version DESC`),writeCallees:e.prepare(`INSERT OR REPLACE INTO semantic_callees
49
- (relative_path, symbol, content_hash, deps_digest, version, payload) VALUES (?, ?, ?, ?, ?, ?)`),dropStaleCallees:e.prepare("DELETE FROM semantic_callees WHERE relative_path = ? AND content_hash != ?"),readReferences:e.prepare(`SELECT payload FROM semantic_references
50
- WHERE relative_path = ? AND symbol = ? AND project_fingerprint = ? AND version = ?`),readLegacyReferences:e.prepare(`SELECT payload FROM semantic_references
51
- WHERE relative_path = ? AND symbol = ? AND project_fingerprint = ? AND ${E}
52
- ORDER BY version DESC
53
- LIMIT 1`),readReferencesForFile:e.prepare(`SELECT symbol, payload FROM semantic_references
54
- WHERE relative_path = ? AND project_fingerprint = ? AND version = ?`),readLegacyReferencesForFile:e.prepare(`SELECT symbol, payload FROM semantic_references
55
- WHERE relative_path = ? AND project_fingerprint = ? AND ${E}
56
- ORDER BY symbol, version DESC`),writeReferences:e.prepare(`INSERT OR REPLACE INTO semantic_references
57
- (relative_path, symbol, project_fingerprint, version, payload) VALUES (?, ?, ?, ?, ?)`),dropStaleReferences:e.prepare("DELETE FROM semantic_references WHERE relative_path = ? AND project_fingerprint != ?")}}catch(e){d("disabled (open failed)",e)}return u.set(t,n),n}function l(t,n,e){d(`disabled (${n})`,e),u.set(t,null)}function M(t){if(!t)return null;try{A(T(t),{recursive:!0});let n=new g(t);return n.pragma("journal_mode = WAL"),n.pragma("busy_timeout = 250"),n.pragma("synchronous = NORMAL"),n.exec(`
58
- CREATE TABLE IF NOT EXISTS file_evidence (
59
- kind TEXT NOT NULL,
60
- relative_path TEXT NOT NULL,
61
- content_hash TEXT NOT NULL,
62
- version TEXT NOT NULL,
63
- payload TEXT NOT NULL,
64
- last_accessed_at INTEGER NOT NULL,
65
- PRIMARY KEY (kind, relative_path, content_hash, version)
66
- );
67
- CREATE INDEX IF NOT EXISTS idx_file_evidence_lru
68
- ON file_evidence(last_accessed_at, kind, relative_path, content_hash, version);
69
- `),{evidence:n,readFileEvidence:n.prepare("SELECT payload FROM file_evidence WHERE kind = ? AND relative_path = ? AND content_hash = ? AND version = ?"),writeFileEvidence:n.prepare(`INSERT INTO file_evidence (kind, relative_path, content_hash, version, payload, last_accessed_at)
70
- VALUES (?, ?, ?, ?, ?, ?)
71
- ON CONFLICT(kind, relative_path, content_hash, version)
72
- DO UPDATE SET payload = excluded.payload, last_accessed_at = excluded.last_accessed_at`),touchFileEvidence:n.prepare(`UPDATE file_evidence
73
- SET last_accessed_at = ?
74
- WHERE kind = ? AND relative_path = ? AND content_hash = ? AND version = ?
75
- AND last_accessed_at < ?`)}}catch(n){return d("shared cache disabled (open failed)",n),null}}function f(t,n,e){d(`shared cache disabled (${n})`,e);try{t.shared?.evidence.close()}catch{}t.shared=null}function $(t,n={}){if(!L(t))return null;let e;try{e=new g(t),e.pragma("busy_timeout = 50"),e.exec(`CREATE INDEX IF NOT EXISTS idx_file_evidence_lru
76
- ON file_evidence(last_accessed_at, kind, relative_path, content_hash, version)`),e.pragma("wal_checkpoint(TRUNCATE)");let a=e.prepare("SELECT COUNT(*) AS count FROM file_evidence").get().count,r=n.maxRows??w,i=n.budgetBytes??I,c=Number(e.pragma("page_size",{simple:!0})),m=Number(e.pragma("page_count",{simple:!0})),S=Number(e.pragma("freelist_count",{simple:!0})),h=Math.max(0,m-S)*c,R=a>0&&h>i?Math.min(a,Math.ceil((h-i)/Math.max(1,h/a))):0,p=Math.max(a-r,R);return p>0&&(e.prepare(`DELETE FROM file_evidence WHERE rowid IN (
77
- SELECT rowid FROM file_evidence ORDER BY last_accessed_at ASC, rowid ASC LIMIT ?
78
- )`).run(p),e.pragma("wal_checkpoint(TRUNCATE)")),{deletedRows:p,remainingRows:a-p}}catch(a){return d("shared cache maintenance skipped",a),null}finally{try{e?.close()}catch{}}}function G(t,n,e,a){let r=o(t);if(!r)return null;try{let i=r.readFileEvidence.get(n,e,a,s)??r.readLegacyFileEvidence.get(n,e,a);if(i?.payload!==void 0)return i.payload;if(!_.has(n)||!r.shared)return null;try{let c=r.shared.readFileEvidence.get(n,e,a,s);return c?.payload!==void 0&&P(r.shared,n,e,a),c?.payload??null}catch(c){return f(r,"file_evidence read",c),null}}catch(i){return l(t,"file_evidence read",i),null}}function P(t,n,e,a){let r=Date.now();try{t.touchFileEvidence.run(r,n,e,a,s,r-k)}catch(i){d("shared file_evidence recency touch skipped",i)}}function J(t,n,e,a,r){let i=o(t);if(i)try{if(i.writeFileEvidence.run(n,e,a,s,r),_.has(n)&&i.shared)try{i.shared.writeFileEvidence.run(n,e,a,s,r,Date.now())}catch(c){f(i,"file_evidence write",c)}}catch(c){l(t,"file_evidence write",c)}}function z(t,n){if(n.length===0)return;let e=o(t);if(e)try{e.evidence.transaction(()=>{for(let r of n)e.writeFileEvidence.run(r.kind,r.relativePath,r.contentHash,s,r.payload)})();let a=n.filter(r=>_.has(r.kind));if(a.length>0&&e.shared)try{e.shared.evidence.transaction(()=>{for(let r of a)e.shared.writeFileEvidence.run(r.kind,r.relativePath,r.contentHash,s,r.payload,Date.now())})()}catch(r){f(e,"file_evidence batch write",r)}}catch(a){l(t,"file_evidence batch write",a)}}function Q(t,n,e,a){let r=o(t);if(!r)return null;try{return(r.readProjectEvidence.get(n,e,a,s)??r.readLegacyProjectEvidence.get(n,e,a))?.payload??null}catch(i){return l(t,"project_evidence read",i),null}}function q(t,n,e,a,r){let i=o(t);if(i)try{i.writeProjectEvidence.run(n,e,a,s,r)}catch(c){l(t,"project_evidence write",c)}}function Z(t,n,e,a){if(e===a)return 0;let r=o(t);if(!r)return 0;try{return r.rekeyProjectEvidenceKind.run(a,s,n,e).changes}catch(i){return l(t,"project_evidence kind rekey",i),0}}function ee(t,n,e,a){let r=o(t);if(!r)return new Map;try{let i=r.readCalleesForFile.all(n,e,a,s),c=r.readLegacyCalleesForFile.all(n,e,a);return D([...c,...i])}catch(i){return l(t,"semantic_callees bulk read",i),new Map}}function ne(t,n,e){let a=o(t);if(!a)return new Map;try{let r=a.readReferencesForFile.all(n,e,s),i=a.readLegacyReferencesForFile.all(n,e);return D([...i,...r])}catch(r){return l(t,"semantic_references bulk read",r),new Map}}function D(t){let n=new Map;for(let e of t)n.set(e.symbol,e.payload);return n}function te(t,n){if(n.length===0)return;let e=o(t);if(e)try{e.evidence.transaction(()=>{let a=new Set;for(let r of n){let i=`${r.relativePath}\0${r.contentHash}`;a.has(i)||(a.add(i),e.dropStaleCallees.run(r.relativePath,r.contentHash)),e.writeCallees.run(r.relativePath,r.symbol,r.contentHash,r.depsDigest,s,r.payload)}})()}catch(a){l(t,"semantic_callees write",a)}}function re(t,n){if(n.length===0)return;let e=o(t);if(e)try{e.evidence.transaction(()=>{let a=new Set;for(let r of n){let i=`${r.relativePath}\0${r.projectFingerprint}`;a.has(i)||(a.add(i),e.dropStaleReferences.run(r.relativePath,r.projectFingerprint)),e.writeReferences.run(r.relativePath,r.symbol,r.projectFingerprint,s,r.payload)}})()}catch(a){l(t,"semantic_references write",a)}}function ie(t){return typeof t=="object"&&t!==null}function ce(t){return Array.isArray(t)&&t.every(n=>typeof n=="string")?t:null}export{b as a,N as b,Y as c,V as d,$ as e,G as f,J as g,z as h,Q as i,q as j,Z as k,ee as l,ne as m,te as n,re as o,ie as p,ce as q};
79
- //# sourceMappingURL=chunk-PRLU3I7G.js.map
@@ -1,2 +0,0 @@
1
- import{f as B,g as S}from"./chunk-DGM2RJ3I.js";import{b as O}from"./chunk-BOJ5SVE2.js";import{a as E}from"./chunk-BGBBVSH4.js";import{c as k}from"./chunk-743MEVFJ.js";import{b as L}from"./chunk-HW7FASEL.js";import{d as P}from"./chunk-MTDBHTSF.js";import{d as I,g as z,j as D,u as $}from"./chunk-7Z4GMCHM.js";import{b as T,r as v,w as A}from"./chunk-6LS3IG2I.js";import{F as _,t as p}from"./chunk-JSHDCVUM.js";import{d as b}from"./chunk-WEXQYJY3.js";var U=new Set(P());function $e(e,t={}){let{includeHomonyms:n=!1,limit:i}=t,s=X(e,t).filter(r=>r.relationship==="divergent"||n&&r.relationship==="homonym");return i?s.slice(0,i):s}function X(e,t={}){let{scope:n,minSimilarity:i=.3,scanLimit:s}=t,r=Q(e,{scope:n,scanLimit:s});return Y(r,{minSimilarity:i,isDelegatePair:De(e)}).filter(a=>!a.members.some(o=>_(e,o.file,o.startLine,"twin")))}function Y(e,t={}){let n=t.minSimilarity??.3,i=t.isDelegatePair,s=e.filter(c=>!V(c.leaf)&&!fe(c.leaf)&&L(c.file)!=="test"&&!D(c.symbol)&&!Z(c.symbol)&&!j(c.symbol,c.leaf)),{recordsByLeaf:r,recordOrder:a}=p("twin-drift.group-by-leaf",()=>q(s),()=>({records:s.length})),o=p("twin-drift.cluster-leaf-names",()=>W([...r.keys()]),()=>({leaves:r.size}));return p("twin-drift.compare-clusters",()=>{let c=[];for(let h of o){let u=J(h,r,a);if(u.length<2||new Set(u.map(f=>f.file)).size<2)continue;let m=null,R=!1,C=!1,y=new Set;for(let f=0;f<u.length;f+=1)for(let w=f+1;w<u.length;w+=1){let d=u[f],g=u[w];if(d.file===g.file||!ge(d,g)||i?.(d,g,u)||i?.(g,d,u))continue;if(R=!0,y.add(d.symbol),y.add(g.symbol),d.normalizedBody===g.normalizedBody){C=!0;continue}let M=oe(d.tokens,g.tokens);(!m||M>m.similarity)&&(m={a:d,b:g,similarity:M})}if(!R)continue;let x=u.filter(f=>y.has(f.symbol)).sort((f,w)=>f.file.localeCompare(w.file)||f.startLine-w.startLine).map(se);if(!m){c.push({leaf:G(h),relationship:C?"identical":"homonym",maxDivergence:0,members:x});continue}let N=m.similarity>=n?"divergent":"homonym";c.push({leaf:G(h),relationship:N,maxDivergence:Math.round((1-m.similarity)*1e3)/1e3,members:x,...N==="divergent"?{firstDivergentTokens:ae(m.a.tokens,m.b.tokens)}:{}})}return c},()=>({clusters:o.length,records:s.length})).sort((c,h)=>h.members.length-c.members.length||h.maxDivergence-c.maxDivergence||c.leaf.localeCompare(h.leaf))}function q(e){let t=new Map,n=new Map;for(let[i,s]of e.entries()){let r=t.get(s.leaf)??[];r.push(s),t.set(s.leaf,r),n.set(s,i)}return{recordsByLeaf:t,recordOrder:n}}function J(e,t,n){let i=[...e].flatMap(s=>t.get(s)??[]);return e.size>1&&i.sort((s,r)=>(n.get(s)??0)-(n.get(r)??0)),i}function Q(e,t){let n=p("twin-drift.load-definitions",()=>$(e,{scope:t.scope}).filter(r=>ee(r)&&!e.isIgnored(r.relativePath)).filter(r=>!k(r.relativePath)));p("twin-drift.sort-definitions",()=>n.sort((r,a)=>r.relativePath.localeCompare(a.relativePath)||r.startLine-a.startLine),()=>({definitions:n.length}));let i=O(n,t.scanLimit),s=p("twin-drift.select-candidates",()=>te(i),()=>({scanned:i.length}));return p("twin-drift.build-records",()=>{let r=[];for(let a of s){let o=ne(e,a);o&&r.push(o)}return r},()=>({candidates:s.length,scanned:i.length}))}function ee(e){return e.isFunctionLike?e.symbol.startsWith("rust-analyzer ")?typeof e.kind=="number"&&U.has(e.kind):!0:!1}function te(e){let t=e.filter(r=>r.leaf&&!V(r.leaf)&&!D(r.symbol)&&!Z(r.symbol)&&!j(r.symbol,r.leaf)),n=new Map;for(let r of t){let a=n.get(r.leaf)??[];a.push(r),n.set(r.leaf,a)}let i=W([...n.keys()]),s=new Set;for(let r of i){let a=[...r].flatMap(o=>n.get(o)??[]);if(!(a.length<2)&&!(new Set(a.map(o=>o.relativePath)).size<2)&&!a.every(o=>L(o.relativePath)==="test"))for(let o of a)s.add(o)}return e.filter(r=>s.has(r))}function ne(e,t){if(!t.leaf)return null;let n=B(e,t);if(!n||!z(t.symbol)&&!re(n,t.leaf))return null;let i=T(S(n)),s=i.replace(/\s+/g,"");if(!s||s.length<8)return null;let r=i.match(ie)??[];return r.length===0?null:{leaf:t.leaf,symbol:t.symbol,shortName:I(t.symbol),file:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:E(t),normalizedBody:s,tokens:r,isThinForwarder:H(i)}}function re(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`\\b(?:const|let|var)\\s+${n}(?:\\s*:[^=]+)?\\s*=\\s*(?:async\\s*)?(?:\\([^)]*\\)|[A-Za-z_$][\\w$]*)\\s*=>`,"s").test(e)}var ie=/[A-Za-z_$][A-Za-z0-9_$]*|\d+(?:\.\d+)?|[^\sA-Za-z0-9_$]/g;function se(e){return{symbol:e.symbol,shortName:e.shortName,file:e.file,startLine:e.startLine,endLine:e.endLine,loc:e.loc}}function oe(e,t){let n=new Set(e),i=new Set(t);if(n.size===0&&i.size===0)return 1;if(n.size===0||i.size===0)return 0;let s=0;for(let a of n)i.has(a)&&(s+=1);let r=n.size+i.size-s;return r===0?0:s/r}function ae(e,t){let n=Math.min(e.length,t.length),i=0;for(;i<n&&e[i]===t[i];)i+=1;let s=e.slice(i,i+6).join(" "),r=t.slice(i,i+6).join(" ");return!s&&!r?"(bodies differ only in trailing length)":`A: ${s||"(end)"} | B: ${r||"(end)"}`}function W(e){let t=new Map;for(let a of e)t.set(a,a);let n=a=>{let o=a;for(;t.get(o)!==o;)o=t.get(o);let l=a;for(;t.get(l)!==o;){let c=t.get(l);t.set(l,o),l=c}return o},i=(a,o)=>{let l=n(a),c=n(o);l!==c&&t.set(l,c)},s=new Map;for(let a of e){let o=a.slice(0,2).toLowerCase(),l=s.get(o)??[];l.push(a),s.set(o,l)}for(let a of s.values())for(let o=0;o<a.length;o+=1)for(let l=o+1;l<a.length;l+=1)le(a[o],a[l])&&i(a[o],a[l]);let r=new Map;for(let a of e){let o=n(a),l=r.get(o)??new Set;l.add(a),r.set(o,l)}return[...r.values()]}function le(e,t){return e===t||e.toLowerCase()===t.toLowerCase()?!0:e.length<8||t.length<8||Math.abs(e.length-t.length)>2||ce(e.toLowerCase(),t.toLowerCase())/Math.max(e.length,t.length)<.8?!1:pe(e.toLowerCase(),t.toLowerCase(),2)}function ce(e,t){let n=Math.min(e.length,t.length),i=0;for(;i<n&&e[i]===t[i];)i+=1;return i}function fe(e){return/^[A-Z][A-Z0-9_]*$/.test(e)||/^__[^_].*__$/.test(e)||ue.has(e.toLowerCase())}var ue=new Set(["main","row"]),me=new Set(["app","component","components","feature","features","impl","index","lib","route","routes","shared","src","tsx","typescript","ui"]);function Z(e){return e.startsWith("rust-analyzer ")&&/\/(?:tests?|benches?)\//.test(e)}var de=new Set(["default","new","reset"]);function j(e,t){return e.startsWith("rust-analyzer ")&&de.has(t.toLowerCase())}function ge(e,t){if(e.leaf.toLowerCase()!==t.leaf.toLowerCase()||e.leaf.length>4)return!0;let n=F(e);return[...F(t)].some(i=>n.has(i))}function F(e){let t=e.leaf.toLowerCase();return new Set(`${e.file}/${e.shortName}`.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(n=>n.length>2&&n!==t&&!me.has(n)))}function pe(e,t,n){if(Math.abs(e.length-t.length)>n)return!1;let i=Array.from({length:t.length+1},(s,r)=>r);for(let s=1;s<=e.length;s+=1){let r=[s],a=r[0];for(let o=1;o<=t.length;o+=1){let l=e[s-1]===t[o-1]?0:1,c=Math.min(i[o]+1,r[o-1]+1,i[o-1]+l);r.push(c),a=Math.min(a,c)}if(a>n)return!1;i=r}return i[t.length]<=n}function ke(e){return H(T(S(e)))}function H(e){let t=e.trim();if(!t||he.test(t))return!1;let n=be(t);return n.length===0||n.length>2?!1:ye(n[n.length-1])}var he=/\b(?:if|else|for|while|switch|try|catch|do)\b/,we=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\[[^[\]]*\])*\((?:[^()]|\([^()]*\))*\)$/;function ye(e){let t=e.trim().replace(/^return\s+/,"").replace(/^await\s+/,"").replace(/;\s*$/,"").trim();return we.test(t)}function be(e){let t=[],n=0,i="";for(let s of e){if(s==="("||s==="["||s==="{"?n+=1:(s===")"||s==="]"||s==="}")&&(n=Math.max(0,n-1)),s===";"&&n===0){t.push(i),i="";continue}i+=s}return i.trim()&&t.push(i),t.map(s=>s.trim()).filter(s=>s.length>0)}var Te=3;function De(e){let t=new Map;return(n,i,s)=>{if(!n.isThinForwarder)return!1;let r=`${n.symbol}\0${i.symbol}`,a=t.get(r);if(a!==void 0)return a;let o=K(e,n,i,s,Te,new Set);return t.set(r,o),o}}function K(e,t,n,i,s,r){if(s<=0||r.has(t.symbol)||(r.add(t.symbol),(v(e,t.file)??[]).filter(l=>l.line>=t.startLine&&l.line<=t.endLine&&l.calleeLeaf===n.leaf).length===0))return!1;let o=new Set(A(e,t.file).filter(l=>l.sourcePath&&(l.kind!=="namespace"||l.usedMembers.includes(n.leaf))).map(l=>l.sourcePath));if([...o].some(l=>b(l,n.file)))return!0;for(let l of i)if(!(l.symbol===t.symbol||l.symbol===n.symbol||!l.isThinForwarder)&&[...o].some(c=>b(c,l.file))&&K(e,l,n,i,s-1,r))return!0;return!1}function V(e){return e.startsWith("<")&&e.endsWith(">")}function G(e){return[...e].sort()[0]}export{$e as a,X as b,Y as c,ke as d,be as e};
2
- //# sourceMappingURL=chunk-QLWZUFDT.js.map
@@ -1,2 +0,0 @@
1
- import{b as A}from"./chunk-PRLU3I7G.js";import{d as fe,f as vt}from"./chunk-DXYMTQZ4.js";import{b as ye}from"./chunk-O4PZFAXA.js";import{a as ge,b as he,c as H,d as E}from"./chunk-NQXWWE6S.js";import{e as K}from"./chunk-HGFDYOVB.js";import{a as St,b as It,c as le,d as pe}from"./chunk-Z2KGMIL4.js";import{A as ke,E as Rt,F as Pt,H as Et,I as Gt,J as Ae,K as Le,N as Ce,P as Tt,Q as Dt,S as kt,a as v,b as Q,c as x,f as S,g as R,h as I,j as ht,k as W,l as bt,n as xt,o as wt,p as ue,ra as Oe,w as me,x as L,y as J}from"./chunk-XIPGCT3D.js";import{createHash as Br,randomUUID as zr}from"crypto";import{existsSync as V,mkdirSync as Wr,readdirSync as Hr,rmSync as Ct,statSync as Ot}from"fs";import{basename as Vr,dirname as Se,join as w}from"path";import{join as Fr}from"path";function jr(e,t){return e.reason instanceof Error?e.reason:new Error(t)}function Fi(e,t){if(e?.aborted)throw jr(e,t)}var _r=e=>{if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e.pid;return typeof t=="number"&&Number.isSafeInteger(t)&&t>0?{pid:t}:null};function At(e,t={}){return C(Fr(e,"gc.lock"),t)}function C(e,t={}){let r=t.waitMs??0,n=t.pollMs??10,i=t.now??pe,o=i()+r;do{let a=qr(e,t.directoryDurability);if(a)return Nr(a);let s=o-i();if(s<=0)return null;$r(Math.min(n,s))}while(i()<=o);return null}function qr(e,t){let r=ye(e,{kind:"generic",parseLegacy:_r,...t?{directoryDurability:t}:{}});return r.kind==="acquired"?r.lock:null}function Nr(e){return{release:()=>{e.release()}}}function $r(e){let t=new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));Atomics.wait(t,0,0,e)}var F=1,_e=1,Z=".scipquery-generations",Ie="manifest.json",Mt="readers",Ur="gc.lock",Yr=128,X=new Map,jt={pid:process.pid,now:()=>new Date,randomToken:()=>zr(),isProcessAlive:ge,readProcessIdentity:le};function h(e){return w(Se(e),Z)}function qe(e){return w(h(e),Ur)}function Zi(e,t=jt){let r=C(qe(e.dbPath),{waitMs:5e3,directoryDurability:"recoverable"});if(!r)throw new Error("SQLite generation retention is busy; retry opening the index.");let n;try{let i=Jr(e);if(i.source!=="immutable")return{generation:i,release(){}};let o=t.randomToken();if(!/^[A-Za-z0-9._-]+$/.test(o))throw new Error("SQLite generation reader token is unsafe.");let a=w(h(e.dbPath),Mt);Wr(a,{recursive:!0}),n=w(a,`${t.pid}-${o}.json`);let s=t.readProcessIdentity(t.pid);H(n,{version:1,token:o,generationIdentity:i.identity,pid:t.pid,...s?{processIdentity:s}:{},acquiredAt:t.now().toISOString()},{spacing:2,trailingNewline:!0});let c=!1;return{generation:i,release(){c||!n||(c=!0,Ct(n,{force:!0}))}}}finally{r.release()}}function Ft(e,t,r=jt,n={}){let i=w(h(e),Mt);if(!V(i))return{protectedGenerations:new Set,activeLeases:0,staleLeasesRemoved:0,malformedLeases:0};let o=new Set,a=0,s=0,c=0;for(let d of Hr(i,{withFileTypes:!0})){if(!d.isFile()||!d.name.endsWith(".json"))continue;let u=w(i,d.name),f;try{f=Qr(JSON.parse(I(u,"SQLite generation reader lease")))}catch{f=null}if(!f){c+=1;for(let m of t)o.add(m);continue}if(!Kr(f,r)){n.removeStale!==!1&&(Ct(u,{force:!0}),s+=1);continue}a+=1,o.add(f.generationIdentity)}return{protectedGenerations:o,activeLeases:a,staleLeasesRemoved:s,malformedLeases:c}}function Qr(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e,r=t.processIdentity===void 0?null:St(t.processIdentity);return t.version!==1||typeof t.token!="string"||t.token.trim()===""||typeof t.generationIdentity!="string"||!/^[a-f0-9]{64}$/.test(t.generationIdentity)||typeof t.pid!="number"||!Number.isSafeInteger(t.pid)||t.pid<=0||typeof t.acquiredAt!="string"||!Number.isFinite(Date.parse(t.acquiredAt))||t.processIdentity!==void 0&&(!r||r.pid!==t.pid)?null:{version:1,token:t.token,generationIdentity:t.generationIdentity,pid:t.pid,...r?{processIdentity:r}:{},acquiredAt:t.acquiredAt}}function Kr(e,t){if(!t.isProcessAlive(e.pid))return!1;if(!e.processIdentity)return!0;let r=t.readProcessIdentity(e.pid);return r===null||It(e.processIdentity,r)}function _(e){try{let t=JSON.parse(I(w(h(e),"state.json"),"SQLite generation state"));return tn(t)?t:null}catch{return null}}function ee(e,t){return te(h(e),t)}function te(e,t){try{let r=JSON.parse(I(w(e,t,Ie),"SQLite generation manifest"));return en(r,t)?r:null}catch{return null}}function Jr(e){let t=_(e.dbPath);if(t){let r=Xr(e,t.currentGeneration);if(r)return r;if(t.artifactSet==="immutable-v1")throw new Error(`Published SQLite generation ${t.currentGeneration} is missing or invalid.`)}if(V(w(Se(e.dbPath),"index.lock")))throw new Error("Legacy SQLite publication is in progress; retry after the reindex lock is released.");return Zr(e,t?.currentGeneration)}function eo(e){let t=_(e);if(t)return t.currentGeneration;try{let r=w(Se(e),"meta.json"),n=V(r)?I(r,"reindex metadata"):void 0;return _t(e,n)}catch{return null}}function O(e){return vt(fe(e))??e}function Xr(e,t){try{let r=w(h(e.dbPath),t),n=ee(e.dbPath,t);if(!n)return null;let i=Me(r,n.database),o=n.index?Me(r,n.index):void 0,a=n.metadata?Me(r,n.metadata):void 0;return!je(i,n.database)||n.index&&(!o||!je(o,n.index))||n.metadata&&(!a||!je(a,n.metadata))?null:{identity:t,databasePath:i,...o?{indexPath:o}:{},...a?{metadataPath:a,metadataRaw:I(a,"reindex metadata")}:{},source:"immutable"}}catch{return null}}function Zr(e,t){let r=q(e.dbPath),n=w(Se(e.dbPath),"meta.json"),i=V(n)?I(n,"reindex metadata"):void 0,o=V(e.indexPath)?e.indexPath:void 0;return{identity:t??_t(e.dbPath,i),databasePath:e.dbPath,...o?{indexPath:o}:{},...i===void 0?{}:{metadataPath:n,metadataRaw:i},source:"legacy",databaseFileIdentity:r}}function _t(e,t){let r=Br("sha256").update("sqlite-generation-legacy-v1\0");return t!==void 0&&r.update(O(t)),r.update(`\0${q(e)}`),r.digest("hex")}function q(e){let t=Ot(e);return`${t.dev}:${t.ino}:${t.size}:${t.mtimeMs}`}function Me(e,t){if(Vr(t.file)!==t.file||t.file==="."||t.file==="..")throw new Error("SQLite generation manifest contains an unsafe artifact path");return w(e,t.file)}function je(e,t){if(!V(e))return!1;let r=Lt(e);if(!r||r.size!==t.size)return!1;let n=`${e}\0${t.sha256}\0${r.identity}`;if(X.has(n))return!0;let i=W(e,{inputKind:"immutable SQLite generation artifact",maxBytes:t.size}),o=Lt(e);if(!o||o.identity!==r.identity||i!==t.sha256)return!1;for(X.set(n,!0);X.size>Yr;){let a=X.keys().next().value;if(a===void 0)break;X.delete(a)}return!0}function Lt(e){let t=Ot(e,{bigint:!0});return t.isFile()?{identity:`${t.dev}:${t.ino}:${t.size}:${t.mtimeNs}:${t.ctimeNs}`,size:Number(t.size)}:null}function en(e,t){return e.version===_e&&e.identity===t&&Fe(e.database)&&(e.index===void 0||Fe(e.index))&&(e.metadata===void 0||Fe(e.metadata))}function Fe(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.file=="string"&&!!t.file&&Number.isSafeInteger(t.size)&&(t.size??-1)>=0&&typeof t.sha256=="string"&&/^[a-f0-9]{64}$/.test(t.sha256)}function tn(e){return e.version===F&&typeof e.currentGeneration=="string"&&!!e.currentGeneration&&typeof e.publishedAt=="string"&&Number.isFinite(Date.parse(e.publishedAt))&&(e.artifactSet===void 0||e.artifactSet==="immutable-v1")&&rn(e.stableMirrors)&&nn(e.previousGeneration)&&on(e.publication)}function rn(e){if(e===void 0)return!0;if(!e||typeof e!="object")return!1;let t=e;return typeof t.databaseFileIdentity=="string"&&!!t.databaseFileIdentity&&(t.indexFileIdentity===void 0||typeof t.indexFileIdentity=="string"&&!!t.indexFileIdentity)}function nn(e){if(e===void 0)return!0;if(!e||typeof e!="object")return!1;let t=e;return typeof t.generationIdentity=="string"&&!!t.generationIdentity&&typeof t.databasePath=="string"&&!!t.databasePath&&(t.metadataPath===void 0||typeof t.metadataPath=="string"&&!!t.metadataPath)}function on(e){if(e===void 0)return!0;if(!e||typeof e!="object")return!1;let t=e,r=[t.converterDurationMs,t.affectedDocumentCount,t.changedDocumentCount,t.producerDurationMs,t.materializationDurationMs,t.patchDurationMs].filter(n=>n!==void 0);return(t.mode==="incremental"||t.mode==="full")&&t.validation==="passed"&&t.converterDurationMs!==void 0&&r.every(n=>typeof n=="number"&&Number.isFinite(n)&&n>=0)&&(t.scipCompanion===void 0||t.scipCompanion==="current"||t.scipCompanion==="deferred")&&(t.typescriptOverlayGeneration===void 0||typeof t.typescriptOverlayGeneration=="string"&&!!t.typescriptOverlayGeneration)&&(t.scipCompanion!=="deferred"||!!t.typescriptOverlayGeneration)&&(t.fallbackReason===void 0||typeof t.fallbackReason=="string")}import{execFileSync as an}from"child_process";import{existsSync as sn,readdirSync as qt}from"fs";import{extname as Nt,join as $t}from"path";var Bt=new Set([".git",".hg",".svn",".idea",".vscode","node_modules","vendor","dist","build","target","bin","obj",".dart_tool",".gradle",".next",".venv","venv","__pycache__"]),cn=[{language:"typescript",files:["tsconfig.json","tsconfig.base.json"],extensions:[".ts",".tsx",".mts",".cts"]},{language:"rust",files:["Cargo.toml"],extensions:[".rs"]},{language:"go",files:["go.mod"],extensions:[".go"]},{language:"java",files:["pom.xml","build.gradle","build.gradle.kts"],extensions:[".java"]},{language:"kotlin",files:["build.gradle.kts"],extensions:[".kt",".kts"]},{language:"scala",files:["build.sbt"],extensions:[".scala"]},{language:"clojure",files:["deps.edn","project.clj","bb.edn","shadow-cljs.edn"],extensions:[".clj",".cljs",".cljc"]},{language:"python",files:["pyproject.toml","setup.py","setup.cfg","Pipfile"],extensions:[".py",".pyi"]},{language:"ruby",files:["Gemfile"],extensions:[".rb"]},{language:"cpp",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"]},{language:"c",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".c",".h"]},{language:"csharp",globs:["*.csproj","*.sln"],extensions:[".cs"]},{language:"vb",globs:["*.vbproj"],extensions:[".vb"]},{language:"dart",files:["pubspec.yaml"],extensions:[".dart"]},{language:"php",files:["composer.json"],extensions:[".php"]},{language:"javascript",files:["package.json"],extensions:[".js",".jsx",".mjs",".cjs"]}];function ao(e){let t=[],r=dn(e),n=pn(e);for(let i of cn){if(ln(e,i.files)){t.push(i.language);continue}if(un(r,i.globs)){t.push(i.language);continue}gn(n,i.extensions)&&t.push(i.language)}if(t.includes("typescript")&&Ne(t,"javascript"),t.includes("cpp")&&t.includes("c")){let i=n.has(".c"),o=[".cc",".cpp",".cxx"].some(a=>n.has(a));i&&!o?Ne(t,"cpp"):i||Ne(t,"c")}return t}function dn(e){try{return qt(e)}catch{return[]}}function ln(e,t){return t?.length?t.some(r=>sn($t(e,r))):!1}function un(e,t){return t?.length?e.some(r=>t.some(n=>fn(r,n))):!1}function fn(e,t){if(t==="*")return!0;if(!t.includes("*"))return e===t;let[r,n]=t.split("*");return e.startsWith(r??"")&&e.endsWith(n??"")}function pn(e){let t=mn(e);if(t)return t;let r=new Set,n=[e];for(;n.length>0;){let i=n.pop();if(!i)continue;let o;try{o=qt(i,{withFileTypes:!0})}catch{continue}for(let a of o){if(a.name.startsWith(".")&&!a.name.endsWith("proj")&&!a.name.endsWith("sln")&&a.isDirectory())continue;let s=$t(i,a.name);if(a.isDirectory()){Bt.has(a.name)||n.push(s);continue}let c=Nt(a.name).toLowerCase();c&&r.add(c)}}return r}function mn(e){try{let t=Tt(e,26214400,()=>an("git",["-C",e,"ls-files","-co","-v","-z","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:52428800,stdio:["ignore","pipe","ignore"],timeout:3e4,killSignal:"SIGKILL"})),r=new Set;for(let n of Dt(t)){if(n.split("/").some(o=>Bt.has(o)))continue;let i=Nt(n).toLowerCase();i&&r.add(i)}return r}catch{return null}}function gn(e,t){return t?.length?t.some(r=>e.has(r)):!1}function Ne(e,t){let r=e.indexOf(t);r!==-1&&e.splice(r,1)}import{writeFileSync as yn}from"fs";import{create as zt}from"@bufbuild/protobuf";import{deserializeSCIP as hn,DocumentSchema as Sn,IndexSchema as In,serializeSCIP as bn,SymbolRole as xn}from"@c4312/scip";function mo(e){let t;try{t=hn(S(e,{inputKind:"SCIP sanitization input",maxBytes:x}))}catch{return{removedDefinitionOccurrences:0,touchedDocuments:0}}let r=$e(t);return r.removedDefinitionOccurrences>0&&yn(e,bn(r.index)),{removedDefinitionOccurrences:r.removedDefinitionOccurrences,touchedDocuments:r.touchedDocuments}}function $e(e){let t=new Set;for(let o of e.documents){Rt(o.relativePath);for(let a of o.symbols)a.symbol&&t.add(a.symbol)}for(let o of e.externalSymbols)o.symbol&&t.add(o.symbol);let r=0,n=0,i=[];for(let o of e.documents){let a=o.occurrences.filter(s=>(s.symbolRoles&xn.Definition)===0||t.has(s.symbol)?!0:(r+=1,!1));if(a.length===o.occurrences.length){i.push(o);continue}n+=1,i.push(zt(Sn,{language:o.language,relativePath:o.relativePath,occurrences:a,symbols:o.symbols,text:o.text,positionEncoding:o.positionEncoding}))}return{index:r===0?e:zt(In,{metadata:e.metadata,documents:i,externalSymbols:e.externalSymbols}),removedDefinitionOccurrences:r,touchedDocuments:n}}import{writeFileSync as Be}from"fs";import{create as re}from"@bufbuild/protobuf";import{deserializeSCIP as ze,serializeSCIP as We,DocumentSchema as wn,IndexSchema as Wt,MetadataSchema as vn,SymbolInformationSchema as Rn}from"@c4312/scip";function Ht(e){if(e.length===0)throw new Error("Cannot merge zero SCIP indexes");if(e.length===1)return e[0];let t=En(e),r=Gn(e.flatMap(i=>i.documents??[])),n=Ut(e.flatMap(i=>i.externalSymbols??[]));return re(Wt,{metadata:t,documents:r,externalSymbols:n})}function wo(e,t){if(e.length===0)throw new Error("Cannot merge zero SCIP files");let r=e.map(i=>ze(S(i,{inputKind:"SCIP merge input",maxBytes:x}))),n=Ht(r);return Be(t,We(n)),{documentCount:n.documents.length,externalSymbolCount:n.externalSymbols.length,inputCount:e.length}}function vo(e,t){if(e.length===0)throw new Error("Cannot merge zero SCIP files");let r=K("reindex.publish.scip-output.deserialize",()=>e.map(o=>ze(S(o,{inputKind:"SCIP merge input",maxBytes:x})))),n=K("reindex.publish.scip-output.merge",()=>Ht(r)),i=K("reindex.publish.scip-output.sanitize",()=>$e(n));return K("reindex.publish.scip-output.serialize",()=>Be(t,We(i.index))),{documentCount:i.index.documents.length,externalSymbolCount:i.index.externalSymbols.length,inputCount:e.length,removedDefinitionOccurrences:i.removedDefinitionOccurrences,touchedDocuments:i.touchedDocuments}}function Pn(e,t,r){let n=e.metadata;if(!n)throw new Error("Cannot rebase a SCIP index without metadata");if(n.projectRoot!==t)throw new Error(`Cannot rebase SCIP project root: expected ${t}, got ${n.projectRoot}`);return re(Wt,{metadata:re(vn,{...n,projectRoot:r}),documents:e.documents,externalSymbols:e.externalSymbols})}function Vt(e,t,r){let n=ze(S(e,{inputKind:"SCIP normalization input",maxBytes:x})),i=Pn(n,t,r);Be(e,We(i))}function En(e){let t=e[0]?.metadata;if(!t)return;let r=t.projectRoot;for(let n of e.slice(1)){let i=n.metadata?.projectRoot;if(r&&i&&i!==r)throw new Error(`Cannot merge SCIP indexes with different project roots: ${r} vs ${i}`)}return t}function Gn(e){let t=new Map;for(let r of e){let n=t.get(r.relativePath);if(!n){t.set(r.relativePath,r);continue}t.set(r.relativePath,re(wn,{language:n.language||r.language,relativePath:n.relativePath||r.relativePath,occurrences:Tn([...n.occurrences,...r.occurrences]),symbols:Ut([...n.symbols,...r.symbols]),text:kn(n.text,r.text),positionEncoding:n.positionEncoding||r.positionEncoding}))}return[...t.values()]}function Tn(e){let t=new Set,r=[];for(let n of e){let i=JSON.stringify(n);t.has(i)||(t.add(i),r.push(n))}return r}function Ut(e){let t=new Map;for(let r of e){let n=t.get(r.symbol);if(!n){t.set(r.symbol,r);continue}t.set(r.symbol,re(Rn,{symbol:n.symbol,documentation:An([...n.documentation,...r.documentation]),relationships:Dn([...n.relationships,...r.relationships]),kind:n.kind||r.kind,displayName:n.displayName||r.displayName,enclosingSymbol:n.enclosingSymbol||r.enclosingSymbol,signatureDocumentation:n.signatureDocumentation??r.signatureDocumentation}))}return[...t.values()]}function Dn(e){let t=new Set,r=[];for(let n of e){let i=[n.symbol,n.isReference?"1":"0",n.isImplementation?"1":"0",n.isTypeDefinition?"1":"0",n.isDefinition?"1":"0"].join("|");t.has(i)||(t.add(i),r.push(n))}return r}function kn(e,t){return e?t?e.length>=t.length?e:t:e:t}function An(e){return[...new Set(e)]}import Ln from"better-sqlite3";var Cn=25,On=new Set(["typescript","javascript"]);function To(e,t,r){let n=null;try{n=new Ln(e,{readonly:!0,fileMustExist:!0});let i=new Set(n.prepare("SELECT relative_path FROM documents").pluck().all().map(ke)),o=Mn(t,r),a=new Set([...o.values()].flatMap(u=>[...u])),s=[...a].filter(u=>!i.has(u)).sort();if(s.length===0)return{state:"complete",expectedDocumentCount:a.size,actualDocumentCount:i.size};let c=new Set(s),d=r.filter(u=>[...o.get(u)??[]].some(f=>c.has(f)));return{state:"incomplete",expectedDocumentCount:a.size,actualDocumentCount:i.size,missingDocumentCount:s.length,missingPaths:s.slice(0,Cn),affectedLanguages:d}}catch(i){return{state:"unavailable",reason:i instanceof Error?i.message:String(i)}}finally{n?.close()}}function Mn(e,t){let r=new Map,n=t.filter(i=>On.has(i));for(let i of n)r.set(i,new Set);for(let i of e.files){let o=ke(i.path);for(let a of n)bt(o,[a])==="source"&&r.get(a).add(o)}return r}import{existsSync as Qt,readdirSync as Kt,rmSync as Jt}from"fs";import{join as U}from"path";import{create as Zt,fromBinary as er,toBinary as _o}from"@bufbuild/protobuf";import{deserializeSCIP as He,DocumentSchema as tr,IndexSchema as rr,serializeSCIP as nr}from"@c4312/scip";import{existsSync as jn,mkdirSync as Fn,renameSync as _n,writeFileSync as qn}from"fs";import{join as Nn}from"path";function Yt(e){Fn(e.blobDir,{recursive:!0});let t=Nn(e.blobDir,`${e.blobHash}.scipdoc`);if(jn(t)){let n=S(t,{maxBytes:Q,inputKind:e.inputKind});if(n.byteLength!==e.bytes.byteLength||A(n)!==e.blobHash)throw new Error(`existing ${e.inputKind} is corrupt: ${e.relativePath}`);return}let r=`${t}.${process.pid}.${Date.now()}.tmp`;qn(r,e.bytes),_n(r,t)}var Ve=1,ne="typescript-scip-fragments";function Bo(e){let t=new Set,r=[];for(let o of e){let a=be(o.relativePath);if(t.has(a))throw new Error(`duplicate TypeScript fragment replacement: ${a}`);if(t.add(a),o.bytes===null)throw new Error(`affected TypeScript mini index cannot contain a deleted document: ${a}`);let s=er(tr,o.bytes);if(s.relativePath!==a)throw new Error(`TypeScript fragment path mismatch: expected ${a}, got ${s.relativePath}`);r.push(s)}let n=nr(Zt(rr,{documents:r,externalSymbols:[]})),i=He(n);if(i.documents.length!==r.length||i.externalSymbols.length!==0)throw new Error("affected TypeScript SCIP index failed structural verification");return n}function $n(e){let t=U(e,ne);return{rootDir:t,blobDir:U(t,"blobs"),generationDir:U(t,"generations")}}function ir(e){let t=Bn(e);return zn(t.baseIndex,t.completeDocuments,"assembled")}function Bn(e){let t=He(e.baseIndexBytes);Un(t.metadata,Yn(e)),Vn(t.externalSymbols);let r=new Map;for(let s of e.fragments){let c=be(s.relativePath);if(r.has(c))throw new Error(`duplicate TypeScript fragment replacement: ${c}`);r.set(c,s)}if(r.size===0)throw new Error("TypeScript index assembly requires at least one replacement");let n=new Set,i=[],o=[],a=[];for(let s of t.documents){let c=be(s.relativePath);if(n.has(c))throw new Error(`duplicate TypeScript SCIP document path: ${c}`);n.add(c);let d=r.get(c);if(!d){i.push(s);continue}if(r.delete(c),d.bytes===null){a.push(c);continue}let u=Xt(c,d.bytes);i.push(u),o.push(u)}for(let s of[...r.keys()].sort()){let c=r.get(s);if(c.bytes===null)continue;if(n.has(s))throw new Error(`duplicate TypeScript SCIP document path: ${s}`);n.add(s);let d=Xt(s,c.bytes);i.push(d),o.push(d)}return{baseIndex:t,completeDocuments:i,affectedDocuments:o,deletedAffectedPaths:a}}function Xt(e,t){let r=er(tr,t);if(r.relativePath!==e)throw new Error(`TypeScript fragment path mismatch: expected ${e}, got ${r.relativePath}`);return r}function zn(e,t,r){let n=nr(Zt(rr,{metadata:e.metadata,documents:t,externalSymbols:[]})),i=He(n);if(i.documents.length!==t.length||i.externalSymbols.length!==0)throw new Error(`${r} TypeScript SCIP index failed structural verification`);return n}function zo(e,t){let r=$n(e);if(!Qt(r.generationDir))return;let n=new Set(t.map(a=>Hn(a))),i=Kt(r.generationDir).filter(a=>a.endsWith(".json")),o=new Set;for(let a of i.filter(s=>n.has(s))){let s=Wn(R(U(r.generationDir,a),{maxBytes:v,inputKind:"TypeScript fragment manifest"}));for(let c of s.documents)o.add(`${c.blobHash}.scipdoc`)}for(let a of i)n.has(a)||Jt(U(r.generationDir,a),{force:!0});if(Qt(r.blobDir))for(let a of Kt(r.blobDir))o.has(a)||Jt(U(r.blobDir,a),{force:!0})}function Wn(e){let t=JSON.parse(e);if(t.version!==Ve||typeof t.producerIdentity!="string"||typeof t.projectIdentity!="string"||typeof t.generationIdentity!="string"||typeof t.createdAt!="string"||!Number.isFinite(Date.parse(t.createdAt))||!Array.isArray(t.documents))throw new Error("invalid TypeScript fragment generation manifest");let r=new Set;for(let n of t.documents){if(!n||typeof n.relativePath!="string"||typeof n.blobHash!="string"||!/^[a-f0-9]{64}$/.test(n.blobHash)||typeof n.byteLength!="number"||!Number.isInteger(n.byteLength)||n.byteLength<0||typeof n.documentIdentity!="string"||!n.documentIdentity)throw new Error("invalid TypeScript fragment record");if(be(n.relativePath),r.has(n.relativePath))throw new Error("duplicate TypeScript fragment record");r.add(n.relativePath)}return t}function Hn(e){if(!e)throw new Error("TypeScript fragment generation identity must be non-empty");return`${A(e)}.json`}function Vn(e){if(e.length>0)throw new Error("scip-typescript emitted external symbols; incremental document assembly is unsupported")}function Un(e,t){if(!e||typeof e!="object")throw new Error("TypeScript SCIP shard has no producer metadata");let r=e,n=r.toolInfo??r.tool_info;if(!n||typeof n!="object")throw new Error("TypeScript SCIP shard has no producer tool identity");let i=n;if(i.name!=="scip-typescript"||i.version!==t)throw new Error("TypeScript SCIP shard producer identity changed")}function Yn(e){let t=e.packageVersion??e.runtime?.packageVersion;if(!t)throw new Error("scip-typescript package version is unavailable");return t}function be(e){if(!e||e.startsWith("/")||e.startsWith("\\")||e.includes("\\"))throw new Error(`invalid TypeScript SCIP document path: ${e}`);let t=e.split("/");if(t.includes("")||t.includes(".")||t.includes(".."))throw new Error(`invalid TypeScript SCIP document path: ${e}`);return e}import{existsSync as xe,readdirSync as Ue,rmSync as or}from"fs";import{join as G}from"path";var we=1,ie="typescript-scip-overlays",ar="typescript-project-v3:";function Xo(e){let t=cr(e.cacheDir,e.previousGenerationIdentity);if(!t&&!e.baseShardCurrent)throw new Error("deferred TypeScript SCIP base has no matching overlay generation");if(t?.producerIdentity!==void 0&&t.producerIdentity!==e.producerIdentity)throw new Error("TypeScript overlay producer identity changed");let r=e.allowLegacyProjectIdentityMigration===!0&&t!==null&&!t.projectIdentity.startsWith(ar)&&e.projectIdentity.startsWith(ar);if(t&&t.projectIdentity!==e.projectIdentity&&!e.allowProjectIdentityChange&&!r)throw new Error("TypeScript overlay project identity changed");let n=new Map((t?.overlays??[]).map(a=>[a.relativePath,a])),i=new Set;for(let a of e.fragments){let s=Ke(a.relativePath);if(i.has(s))throw new Error(`duplicate TypeScript overlay: ${s}`);i.add(s),n.set(s,Qn(e.cacheDir,a))}if(i.size===0)throw new Error("TypeScript overlay generation requires affected documents");let o={version:we,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity,baseGenerationIdentity:t?.baseGenerationIdentity??e.previousGenerationIdentity,generationIdentity:e.nextGenerationIdentity,createdAt:(e.now??(()=>new Date))().toISOString(),overlays:[...n.values()].sort((a,s)=>a.relativePath.localeCompare(s.relativePath))};return Kn(e.cacheDir,o),o}function Zo(e){let t=cr(e.cacheDir,e.generationIdentity);if(!t)throw new Error("TypeScript overlay generation is unavailable");let r=t.overlays.map(n=>{if(n.blobHash===null)return{relativePath:n.relativePath,bytes:null,occurrences:0,symbols:0,referenceFragments:[]};let i=S(G(oe(e.cacheDir),"blobs",`${n.blobHash}.scipdoc`),{maxBytes:Q,inputKind:"TypeScript overlay blob"});if(i.byteLength!==n.byteLength||A(i)!==n.blobHash)throw new Error(`TypeScript overlay blob is corrupt: ${n.relativePath}`);return{relativePath:n.relativePath,bytes:i,occurrences:0,symbols:0,referenceFragments:[]}});return ir({packageVersion:e.packageVersion,baseIndexBytes:e.baseIndexBytes,fragments:r})}function ea(e,t){let r=oe(e),n=G(r,"generations");if(!xe(n))return;let i=new Set(t.map(Qe)),o=new Set;for(let s of Ue(n).filter(c=>i.has(c))){let c=Ye(R(G(n,s),{maxBytes:v,inputKind:"TypeScript overlay manifest"}));for(let d of c.overlays)d.blobHash&&o.add(`${d.blobHash}.scipdoc`)}for(let s of Ue(n))i.has(s)||or(G(n,s),{force:!0});let a=G(r,"blobs");if(xe(a))for(let s of Ue(a))o.has(s)||or(G(a,s),{force:!0})}function cr(e,t){let r=G(oe(e),"generations",Qe(t));if(!xe(r))return null;let n=Ye(R(r,{maxBytes:v,inputKind:"TypeScript overlay manifest"}));if(n.generationIdentity!==t)throw new Error("TypeScript overlay generation identity does not match its path");return n}function Qn(e,t){let r=Ke(t.relativePath);if(t.bytes===null)return{relativePath:r,blobHash:null,byteLength:0};let n=Buffer.from(t.bytes),i=A(n);return Yt({blobDir:G(oe(e),"blobs"),blobHash:i,bytes:n,relativePath:r,inputKind:"TypeScript overlay blob"}),{relativePath:r,blobHash:i,byteLength:n.byteLength}}function Kn(e,t){let r=G(oe(e),"generations",Qe(t.generationIdentity));if(xe(r)){let n=Ye(R(r,{maxBytes:v,inputKind:"TypeScript overlay manifest"}));if(sr(n)!==sr(t))throw new Error(`TypeScript overlay generation is immutable: ${t.generationIdentity}`);return}H(r,t,{spacing:2,trailingNewline:!0})}function Ye(e){let t=JSON.parse(e);if(t.version!==we||typeof t.producerIdentity!="string"||!t.producerIdentity||typeof t.projectIdentity!="string"||!t.projectIdentity||typeof t.baseGenerationIdentity!="string"||!t.baseGenerationIdentity||typeof t.generationIdentity!="string"||!t.generationIdentity||typeof t.createdAt!="string"||!Number.isFinite(Date.parse(t.createdAt))||!Array.isArray(t.overlays))throw new Error("invalid TypeScript overlay manifest");let r=new Set;for(let n of t.overlays){if(!n||typeof n.relativePath!="string"||n.blobHash!==null&&(typeof n.blobHash!="string"||!/^[a-f0-9]{64}$/.test(n.blobHash))||!Number.isInteger(n.byteLength)||n.byteLength<0||n.blobHash===null&&n.byteLength!==0)throw new Error("invalid TypeScript overlay record");if(Ke(n.relativePath),r.has(n.relativePath))throw new Error("duplicate TypeScript overlay record");r.add(n.relativePath)}return t}function oe(e){return G(e,ie)}function Qe(e){if(!e)throw new Error("TypeScript overlay generation identity must be non-empty");return`${A(e)}.json`}function sr(e){return A(JSON.stringify({version:e.version,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity,baseGenerationIdentity:e.baseGenerationIdentity,generationIdentity:e.generationIdentity,overlays:e.overlays}))}function Ke(e){if(!e||e.startsWith("/")||e.includes("\\")||e.split("/").some(t=>!t||t==="."))throw new Error(`invalid TypeScript overlay path: ${e}`);if(e.split("/").includes(".."))throw new Error(`invalid TypeScript overlay path: ${e}`);return e}import{createHash as rt}from"crypto";import{closeSync as Jn,existsSync as g,mkdirSync as Xn,openSync as Zn,readSync as ei,readdirSync as nt,renameSync as et,rmSync as ae,statSync as N}from"fs";import{basename as it,dirname as T,join as p,relative as dr}from"path";var ti=Object.freeze({maxGenerations:2,maxLogicalBytes:2*1024*1024*1024});function ur(e){let t=h(e.outputDb),r=ai(e);e.onStage?.("after-recovery-retained");let n=e.preserveOutputScip?e.outputScip:e.tempOutputScip,i=si(e,r),o=at({generationRoot:t,databasePath:e.tempOutputDb,indexPath:g(n)?n:void 0,verifiedIndexArtifact:i,metadataPath:g(e.tempMetaPath)?e.tempMetaPath:void 0}),a=(e.now??(()=>new Date))().toISOString(),s={version:F,currentGeneration:o.identity,artifactSet:"immutable-v1",...r?{previousGeneration:r}:{},...e.publication?{publication:e.publication}:{},publishedAt:a},c=E(p(t,"state.json"),s,{spacing:2,trailingNewline:!0});e.onStage?.("after-pointer-handoff"),e.preserveOutputScip||Ze(e.tempOutputScip,e.outputScip),e.onStage?.("after-scip-handoff"),Ze(e.tempOutputDb,e.outputDb),e.onStage?.("after-database-handoff"),Ze(e.tempMetaPath,e.metaPath),e.onStage?.("after-metadata-handoff");let d=o.identity,u={...s,stableMirrors:ot(e.outputDb,e.outputScip)};E(p(t,"state.json"),u,{spacing:2,trailingNewline:!0});let f=fr(e.outputDb,{now:e.now}),m=J(o.directorySync,c.directorySync);return{currentGeneration:d,...r?{previousGeneration:r}:{},retention:f,achievedDurability:m==="synced"?"directory-durable":"file-flushed",directorySync:m}}function ri(e,t,r,n=()=>new Date){if(!g(e))return null;let i=_(e),o=p(h(e),"state.json");if(i?.artifactSet==="immutable-v1"&&ee(e,i.currentGeneration))return i;let a=h(e),s=!i&&g(o)?di(r,e,t):void 0;if(s&&!te(a,s))return null;let c=at({generationRoot:a,databasePath:e,indexPath:g(t)?t:void 0,metadataPath:g(r)?r:void 0,forcedIdentity:i?.currentGeneration??s}),d={version:F,currentGeneration:c.identity,artifactSet:"immutable-v1",stableMirrors:ot(e,t),...i?.previousGeneration?{previousGeneration:i.previousGeneration}:{},...i?.publication?{publication:i.publication}:{},publishedAt:i?.publishedAt??n().toISOString()};return E(p(a,"state.json"),d,{spacing:2,trailingNewline:!0}),d}function fa(e,t,r=()=>new Date){if(!g(e)||!g(t))throw new Error("metadata-only generation refresh requires stable database and metadata files");let n=_(e),i=h(e),o=at({generationRoot:i,databasePath:e,indexPath:g(p(T(e),"index.scip"))?p(T(e),"index.scip"):void 0,metadataPath:t}),a=n&&n.currentGeneration!==o.identity?mr(e,n.currentGeneration):void 0,s={version:F,currentGeneration:o.identity,artifactSet:"immutable-v1",stableMirrors:ot(e,p(T(e),"index.scip")),...a?{previousGeneration:a}:{},...n?.publication?{publication:n.publication}:{},publishedAt:r().toISOString()};return E(p(h(e),"state.json"),s,{spacing:2,trailingNewline:!0}),fr(e,{now:r}),s}function fr(e,t={}){let r=ni(t.limits),i=(t.now??(()=>new Date))().toISOString(),o=C(qe(e),{waitMs:0});if(!o)return{state:"deferred",generationCount:0,logicalBytes:0,protectedGenerations:0,activeReaderLeases:0,staleReaderLeasesRemoved:0,malformedReaderLeases:0,removedGenerations:0,removedLogicalBytes:0,limits:r,at:i,reason:"another process owns local generation retention"};try{let a=_(e),s=ii(e),c=Ft(e,s.map(b=>b.identity),{isProcessAlive:t.isProcessAlive??ge,readProcessIdentity:t.readProcessIdentity??le}),d=new Set(c.protectedGenerations);a?.currentGeneration&&d.add(a.currentGeneration),a?.previousGeneration?.generationIdentity&&d.add(a.previousGeneration.generationIdentity);let u=s.length,f=s.reduce((b,De)=>b+De.logicalBytes,0),m=0,P=0;for(let b of s){if(u<=r.maxGenerations&&f<=r.maxLogicalBytes)break;d.has(b.identity)||(t.onBeforeRemove?.(b.identity),ae(b.path,{recursive:!0,force:!0}),u-=1,f-=b.logicalBytes,m+=1,P+=b.logicalBytes)}let y=u>r.maxGenerations||f>r.maxLogicalBytes,k={state:y?"protected":m>0?"collected":"within-bounds",generationCount:u,logicalBytes:f,protectedGenerations:d.size,activeReaderLeases:c.activeLeases,staleReaderLeasesRemoved:c.staleLeasesRemoved,malformedReaderLeases:c.malformedLeases,removedGenerations:m,removedLogicalBytes:P,limits:r,at:i,...y?{reason:c.malformedLeases>0?"malformed reader ownership evidence fails closed":"retention bounds cannot be met without deleting a protected generation"}:{}};return lr(e,k),k}catch(a){let s={state:"error",generationCount:0,logicalBytes:0,protectedGenerations:0,activeReaderLeases:0,staleReaderLeasesRemoved:0,malformedReaderLeases:0,removedGenerations:0,removedLogicalBytes:0,limits:r,at:i,reason:a instanceof Error?a.message:String(a)};try{lr(e,s)}catch{}return s}finally{o.release()}}function ni(e={}){let t={...ti,...e};if(!Number.isSafeInteger(t.maxGenerations)||t.maxGenerations<2)throw new Error("Local SQLite generation retention must keep at least current and previous generations.");if(!Number.isSafeInteger(t.maxLogicalBytes)||t.maxLogicalBytes<=0)throw new Error("Local SQLite generation byte retention must be a positive safe integer.");return t}function ii(e){let t=h(e);return g(t)?nt(t,{withFileTypes:!0}).filter(r=>r.isDirectory()&&/^[a-f0-9]{64}$/.test(r.name)).map(r=>{let n=p(t,r.name),i=te(t,r.name),o=i?i.database.size+(i.index?.size??0)+(i.metadata?.size??0):pr(n);return{identity:r.name,path:n,logicalBytes:o,modifiedAtMs:N(n).mtimeMs}}).sort((r,n)=>r.modifiedAtMs-n.modifiedAtMs||r.identity.localeCompare(n.identity)):[]}function pr(e){let t=0;for(let r of nt(e,{withFileTypes:!0})){let n=p(e,r.name);r.isDirectory()?t+=pr(n):r.isFile()&&(t+=N(n).size)}return t}function lr(e,t){H(p(h(e),"gc.json"),t,{spacing:2,trailingNewline:!0})}function Re(e,t=p(T(e),"meta.json")){let r=p(h(e),"state.json");if(!g(r))return{state:"legacy",statePath:r};let n=_(e);if(!n)return{state:"invalid",statePath:r,reason:"generation state is malformed"};try{let i=ee(e,n.currentGeneration),o=i!==null,a=i?oi(e,t,i,n):!1,s=n.previousGeneration?g(p(T(e),n.previousGeneration.databasePath)):!0;return!a||!o||!s?{state:"drifted",statePath:r,currentMatches:a,recoveryExists:s,generation:n,reason:o?a?"retained recovery database is missing":"stable database or metadata no longer matches the published generation":"published immutable generation is missing"}:{state:"current",statePath:r,currentMatches:a,recoveryExists:s,generation:n}}catch(i){return{state:"drifted",statePath:r,currentMatches:!1,recoveryExists:!1,generation:n,reason:i instanceof Error?i.message:String(i)}}}function oi(e,t,r,n){if(n.stableMirrors&&(n.stableMirrors.databaseFileIdentity!==q(e)||n.stableMirrors.indexFileIdentity!==void 0&&n.stableMirrors.indexFileIdentity!==q(p(T(e),"index.scip")))||!tt(e,r.database))return!1;let i=p(T(e),"index.scip");if(r.index&&!tt(i,r.index))return!1;if(!r.metadata)return!g(t);if(!g(t))return!1;let o=p(h(e),r.identity,r.metadata.file);return g(o)&&O(I(t,"reindex metadata"))===O(I(o,"immutable reindex metadata"))}function tt(e,t){return g(e)&&N(e).isFile()&&N(e).size===t.size}function ai(e){let t=ri(e.outputDb,e.outputScip,e.metaPath);return t?mr(e.outputDb,t.currentGeneration):void 0}function si(e,t){if(!e.preserveOutputScip)return;if(!t)throw new Error("deferred SCIP publication requires an accepted immutable generation");let r=Re(e.outputDb,e.metaPath);if(r.state!=="current"||r.generation.currentGeneration!==t.generationIdentity){let i=r.state==="current"?"generation identity changed":"reason"in r?r.reason:`generation state is ${r.state}`;throw new Error(`deferred SCIP publication requires a verified accepted companion: ${i}`)}let n=ee(e.outputDb,t.generationIdentity);if(!n?.index||!tt(e.outputScip,n.index))throw new Error("deferred SCIP publication requires the verified accepted index artifact");return n.index}function ot(e,t){return{databaseFileIdentity:q(e),...g(t)?{indexFileIdentity:q(t)}:{}}}function mr(e,t){let r=p(h(e),t),n=p(r,it(e)),i=p(r,"meta.json");return{generationIdentity:t,databasePath:dr(T(e),n),...g(i)?{metadataPath:dr(T(e),i)}:{}}}function ci(e){if(g(e))for(let t of nt(e,{withFileTypes:!0}))t.isDirectory()&&t.name.endsWith(".tmp")&&ae(p(e,t.name),{recursive:!0,force:!0})}function di(e,t,r=p(T(t),"index.scip")){let n=rt("sha256").update("sqlite-generation-artifacts-v1\0");return n.update(ve(t)),g(r)&&n.update(`\0${ve(r)}`),g(e)&&n.update(`\0${O(I(e,"reindex metadata"))}`),n.digest("hex")}function at(e){let t=Je(e.databasePath),r=e.indexPath?e.verifiedIndexArtifact?ui(e.indexPath,e.verifiedIndexArtifact):Je(e.indexPath):void 0,n=e.metadataPath?Je(e.metadataPath):void 0,i=e.forcedIdentity??li(t,r,e.metadataPath),o=p(e.generationRoot,i),a=p(o,Ie);if(g(a)){let d=te(e.generationRoot,i);if(d&&gr(o,d.database,t)&&pi(o,d.index,r)&&mi(o,d.metadata,e.metadataPath))return{identity:i,directorySync:L(e.generationRoot)};throw new Error(`SQLite generation ${i} already exists with different or corrupt artifacts.`)}let s=[me(e.generationRoot)];ci(e.generationRoot);let c=`${o}.${process.pid}.${Date.now()}.tmp`;ae(c,{recursive:!0,force:!0}),Xn(c,{recursive:!0});try{s.push(Xe(e.databasePath,p(c,t.file))),r&&e.indexPath&&s.push(Xe(e.indexPath,p(c,r.file))),n&&e.metadataPath&&s.push(Xe(e.metadataPath,p(c,n.file)));let d=E(p(c,Ie),{version:_e,identity:i,database:t,...r?{index:r}:{},...n?{metadata:n}:{}},{spacing:2,trailingNewline:!0});d.directorySync!=="not-requested"&&s.push(d.directorySync),s.push(L(c)),et(c,o),s.push(L(e.generationRoot))}finally{ae(c,{recursive:!0,force:!0})}return{identity:i,directorySync:J(...s)}}function li(e,t,r){let n=rt("sha256").update("sqlite-generation-artifacts-v1\0");return n.update(e.sha256),t&&n.update(`\0${t.sha256}`),r&&n.update(`\0${O(I(r,"reindex metadata"))}`),n.digest("hex")}function Je(e){return{file:it(e),size:N(e).size,sha256:ve(e)}}function ui(e,t){if(t.file!==it(e)||N(e).size!==t.size)throw new Error(`verified SQLite generation artifact changed before publication: ${e}`);return t}function ve(e){let t=rt("sha256"),r=Zn(e,"r"),n=Buffer.allocUnsafe(1024*1024);try{for(;;){let i=fi(r,n);if(i===0)break;t.update(n.subarray(0,i))}}finally{Jn(r)}return t.digest("hex")}function fi(e,t){let r=0;for(;r<t.length;){let n=ei(e,t,r,t.length-r,null);if(r+=n,n===0)break}return r}function Xe(e,t){return he(e,t,{mode:292})}function gr(e,t,r){let n=p(e,t.file);return t.file===r.file&&t.size===r.size&&t.sha256===r.sha256&&g(n)&&N(n).size===t.size&&ve(n)===t.sha256}function pi(e,t,r){return!t||!r?t===r:gr(e,t,r)}function mi(e,t,r){if(!t||!r)return t===void 0&&r===void 0;let n=p(e,t.file);return g(n)&&O(I(n,"stored reindex metadata"))===O(I(r,"candidate reindex metadata"))}function Ze(e,t){ae(`${t}.tmp-replace`,{force:!0}),et(e,`${t}.tmp-replace`),et(`${t}.tmp-replace`,t)}import{createHash as Rr,randomUUID as xi}from"crypto";import{existsSync as j,lstatSync as dt,mkdirSync as Y,mkdtempSync as Pr,readdirSync as Er,realpathSync as Gr,renameSync as B,rmSync as M,statSync as Te}from"fs";import{dirname as lt,join as l,resolve as $}from"path";import{setTimeout as wi}from"timers/promises";import{pathToFileURL as Ir}from"url";import{deserializeSCIP as Tr}from"@c4312/scip";import vi from"better-sqlite3";import{lstatSync as gi,readdirSync as yi}from"fs";import{join as hi,relative as Si,resolve as st,sep as Ii}from"path";var se=1,ct="language-indexes",yr=["index.db","index.scip","meta.json"],hr=[ct,ne,ie];function Pe(e){let t=[];for(let r of yr)bi(e,r),t.push(r);for(let r of hr)Sr(e,r,t);return{version:se,files:t.sort()}}function Ee(e){if(!e||e.includes("\0")||e.startsWith("/")||e.includes("\\"))throw new Error(`invalid index artifact path: ${e||"<empty>"}`);let t=e.split("/");if(t.some(n=>!n||n==="."||n===".."))throw new Error(`invalid index artifact path: ${e}`);let r=t[0];if(!yr.includes(e)&&!hr.includes(r))throw new Error(`index artifact path is not shareable: ${e}`);return e}function D(e,t){let r=Ee(t),n=st(e),i=st(n,...r.split("/"));if(i!==n&&!i.startsWith(`${n}${Ii}`))throw new Error(`index artifact escapes cache: ${t}`);return i}function Sr(e,t,r){let n=hi(e,t),i;try{i=yi(n,{withFileTypes:!0,encoding:"utf8"})}catch{return}for(let o of i){let a=`${t}/${o.name}`;if(o.isSymbolicLink())throw new Error(`index artifact cannot be a symlink: ${a}`);o.isDirectory()?Sr(e,a,r):o.isFile()&&r.push(Ee(a))}}function bi(e,t){let r=D(e,t),n;try{n=gi(r)}catch{throw new Error(`required index artifact is missing: ${t}`)}if(!n.isFile()||n.isSymbolicLink())throw new Error(`required index artifact is not a regular file: ${t}`);if(Si(st(e),r).startsWith(".."))throw new Error(`index artifact escapes cache: ${t}`)}var ut=1,br="SCIP_QUERY_SHARED_CACHE",Ri=2,Ge=JSON.stringify({cliVersion:Pt,artifactCatalogVersion:se,postIndexAugmentationSchemaVersion:Ri,sqliteGenerationStoreVersion:F,typescriptFragmentStoreVersion:Ve,typescriptOverlayStoreVersion:we}),ft="manifest.json",Dr="shared-cache.json";var pt=[ct,ne,ie];function Pi(e,t){if(!e.clean||!e.treeOid)return;let r=Mr(JSON.stringify({version:ut,repositoryId:e.repositoryId,treeOid:e.treeOid,fingerprint:wt(t),producerIdentity:Ge}));return{repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:e.treeOid,fingerprint:t,producerIdentity:Ge,generationId:r,repositoryCacheDir:Ae(e.repositoryId)}}function Ha(e,t,r){if(!ji(r))return!1;let n=Pi(e,r);if(!n)return!1;try{let i=Ai(t);if(!i||i.repositoryId!==e.repositoryId||i.worktreeId!==e.worktreeId)return!1;let o=JSON.parse(R(l(n.repositoryCacheDir,"worktrees",`${i.worktreeId}.json`),{inputKind:"worktree cache lease",maxBytes:v}));return o.version!==1||o.repositoryId!==i.repositoryId||o.worktreeId!==i.worktreeId||$(o.projectRoot)!==$(e.projectRoot)||o.treeOid!==e.treeOid||$(o.localCacheDir)!==$(t)||o.ownershipChecksum!==mt(o)||o.baseGenerationId!==n.generationId||o.activeGenerationId!==n.generationId?!1:z(n,!1)!==null}catch{return!1}}function Va(e,t,r){if(process.env[br]==="0")return`${br}=0`;if(!Le(r))return"explicit cache or database override";if(Ce(lt(t))!==Ce(Gt(e))||t!==l(lt(t),"index.db"))return"index database is outside the managed worktree cache"}function Ua(e,t,r){if(!Le(t))return;let n=r??kt(e);return n?l(Ae(n.repositoryId),"evidence.db"):void 0}function z(e,t=!0){let r=gt(e),n;try{n=kr(R(l(r,ft),{inputKind:"shared-generation manifest",maxBytes:v}))}catch{return null}if(n.generationId!==e.generationId||n.repositoryId!==e.repositoryId||n.treeOid!==e.treeOid||n.producerIdentity!==e.producerIdentity||!ue(n.fingerprint,e.fingerprint)||!Di(r))return null;if(!t)return n;try{for(let i of n.artifacts){let o=D(r,i.path),a=Te(o);if(!a.isFile()||a.size!==i.size||W(o,{inputKind:"shared-generation artifact",maxBytes:x})!==i.sha256)return null}}catch{return null}return n}function Ya(e,t,r,n){if(!e.treeOid)return null;let i=Oe(t,r),o=l(Et(),"repositories",e.repositoryId),a;try{let d=dt(o);if(!d.isDirectory()||d.isSymbolicLink())return null;a=Gr(o)}catch{return null}let s=l(a,"generations"),c=[];try{for(let d of Er(s)){if(!/^[a-f0-9]{64}$/.test(d))continue;let u=l(s,d),f;try{f=dt(u)}catch{continue}if(!(!f.isDirectory()||f.isSymbolicLink()))try{let m=kr(R(l(u,ft),{inputKind:"shared-generation baseline manifest",maxBytes:v}));m.generationId===d&&m.repositoryId===e.repositoryId&&m.producerIdentity===Ge&&ki(m.fingerprint,i)&&c.push(m)}catch{continue}}}catch{return null}c.sort((d,u)=>{let f=d.treeOid===e.treeOid?0:1,m=u.treeOid===e.treeOid?0:1;if(f!==m)return f-m;if(n){let y=vr(d.fingerprint,n)-vr(u.fingerprint,n);if(y!==0)return y}return Date.parse(u.createdAt)-Date.parse(d.createdAt)||d.generationId.localeCompare(u.generationId)});for(let d of c){let u={repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:d.treeOid,fingerprint:d.fingerprint,producerIdentity:d.producerIdentity,generationId:d.generationId,repositoryCacheDir:a},f=z(u);if(f)return{snapshot:u,manifest:f}}return null}function Qa(e){let t=C(l(e.snapshot.repositoryCacheDir,"locks",`${e.snapshot.generationId}.publish.lock`));if(!t)throw new Error(`shared generation publication is already in progress for ${e.snapshot.generationId}`);try{return Ei(e)}finally{t.release()}}function Ei(e){let t=z(e.snapshot);if(t)return xr(e.snapshot,t);if(!Or(e.sourceCacheDir,e.sourceProjectRoot,e.snapshot.fingerprint))throw new Error("source index is incomplete, incompatible, or corrupt");let r=wr(e.sourceCacheDir);if(!r)throw new Error("source index artifacts are incomplete");let n=Pe(e.sourceCacheDir),i=l(e.snapshot.repositoryCacheDir,"generations"),o=[me(i)],a=Pr(l(i,`.tmp-${process.pid}-`));try{let s=[];for(let y of n.files){let k=D(e.sourceCacheDir,y),b=D(a,y);o.push(de(k,b,292)),e.onPublicationStage?.("after-artifact-flushed",y);let De=Te(b).size;s.push({path:y,size:De,sha256:W(b,{inputKind:"staged shared-generation artifact",maxBytes:x})})}let c=Tr(S(l(a,"index.scip"),{inputKind:"staged shared SCIP index",maxBytes:x})).metadata?.projectRoot;if(!c)throw new Error("shared SCIP generation has no project root metadata");let d=yt(e.sourceProjectRoot);if(c!==d)throw new Error("shared SCIP generation root does not match its source worktree");if(wr(e.sourceCacheDir)!==r||e.sourceStillValid&&!e.sourceStillValid())throw new Error("source index changed while staging a shared generation");let u={version:ut,artifactCatalogVersion:se,generationId:e.snapshot.generationId,repositoryId:e.snapshot.repositoryId,treeOid:e.snapshot.treeOid,fingerprint:e.snapshot.fingerprint,producerIdentity:e.snapshot.producerIdentity,sourceProjectRoot:e.sourceProjectRoot,scipProjectRoot:c,createdAt:(e.now??(()=>new Date))().toISOString(),artifacts:s.sort((y,k)=>y.path.localeCompare(k.path))},f=E(l(a,ft),u,{spacing:2,trailingNewline:!0});f.directorySync!=="not-requested"&&o.push(f.directorySync),e.onPublicationStage?.("after-manifest-flushed"),o.push(L(a)),e.onPublicationStage?.("after-staging-directory-synced");let m=gt(e.snapshot);try{if(j(m)&&!z(e.snapshot)){let y=`${m}.corrupt-${process.pid}-${Date.now()}`;B(m,y),M(y,{recursive:!0,force:!0})}B(a,m)}catch(y){let k=z(e.snapshot);if(k)return xr(e.snapshot,k);throw y}e.onPublicationStage?.("after-generation-renamed"),o.push(L(i)),e.onPublicationStage?.("after-generations-directory-synced");let P=J(...o);return{kind:"published",manifest:u,achievedDurability:P==="synced"?"directory-durable":"file-flushed",directorySync:P}}finally{M(a,{recursive:!0,force:!0})}}function xr(e,t){let r=L(l(e.repositoryCacheDir,"generations"));return{kind:"existing",manifest:t,achievedDurability:r==="synced"?"directory-durable":"file-flushed",directorySync:r}}function Ka(e){let t=gt(e.snapshot);Y(e.targetCacheDir,{recursive:!0});let r=C(l(e.targetCacheDir,"cache-lifecycle.lock"),{waitMs:e.lockWaitMs??3e4});if(!r)throw new Error("timed out waiting for another cache hydration");let n,i,o=!1;try{n=Pr(l(e.targetCacheDir,".shared-hydrate-")),Mi(e.manifest,e.snapshot);for(let c of e.manifest.artifacts){let d=D(t,c.path),u=D(n,c.path);if(de(d,u),Te(u).size!==c.size||W(u,{inputKind:"hydrated shared-generation artifact",maxBytes:x})!==c.sha256)throw new Error(`shared artifact is corrupt: ${c.path}`)}let a=yt(e.targetProjectRoot);if(a!==e.manifest.scipProjectRoot)for(let c of e.manifest.artifacts)c.path.endsWith(".scip")&&Vt(D(n,c.path),e.manifest.scipProjectRoot,a);if(!Or(n,e.targetProjectRoot,e.snapshot.fingerprint,!1))throw new Error("staged shared generation failed completeness or integrity validation");i=Li(e.targetCacheDir,n),o=!0,Ci(n,e.targetCacheDir,i),ur({tempOutputScip:l(n,"index.scip"),tempOutputDb:l(n,"index.db"),tempMetaPath:l(n,"meta.json"),outputScip:l(e.targetCacheDir,"index.scip"),outputDb:l(e.targetCacheDir,"index.db"),metaPath:l(e.targetCacheDir,"meta.json"),now:e.now});let s=Re(l(e.targetCacheDir,"index.db"),l(e.targetCacheDir,"meta.json"));if(s.state==="invalid"||s.state==="drifted")throw new Error(`hydrated SQLite generation failed validation: ${s.reason}`);e.persistLease!==!1&&Gi(e.snapshot,e.targetCacheDir,e.action??"attached",e.now)}catch(a){throw o&&i&&Oi(e.targetCacheDir,i),a}finally{n&&M(n,{recursive:!0,force:!0}),r.release()}}async function Ja(e,t={}){let r=t.timeoutMs??3e4,n=t.pollMs??100,i=t.now??pe,o=i()+r,a=l(e.repositoryCacheDir,"locks"),s=l(a,`${e.generationId}.lock`),c=d=>{if(!d||typeof d!="object"||Array.isArray(d))return null;let u=d.pid;return typeof u=="number"&&Number.isSafeInteger(u)&&u>0?{pid:u}:null};for(;i()<=o;){if(z(e))return{kind:"generation-ready"};let d=ye(s,{kind:"shared-generation-build",detail:{generationId:e.generationId},parseLegacy:c});if(d.kind==="acquired")return{kind:"owner",release:()=>d.lock.release()};let u=o-i();if(u<=0)break;await wi(Math.min(n,u))}return z(e)?{kind:"generation-ready"}:{kind:"timeout"}}function Gi(e,t,r,n=void 0){let i={version:1,repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:e.treeOid,localCacheDir:t,baseGenerationId:e.generationId,activeGenerationId:e.generationId,lastAction:r,lastSeenAt:(n??(()=>new Date))().toISOString()},o={...i,ownershipChecksum:mt(i)};return Lr(e.repositoryCacheDir,o,!0),o}function Xa(e,t,r=void 0){let n={version:1,repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:e.treeOid,localCacheDir:t,baseGenerationId:e.generationId,lastAction:"overlay",lastReason:`private cache forked from shared baseline ${e.generationId}`,lastSeenAt:(r??(()=>new Date))().toISOString()},i={...n,ownershipChecksum:mt(n)};return Lr(e.repositoryCacheDir,i,!0),i}function mt(e){return Mr(JSON.stringify({version:1,repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:$(e.projectRoot),localCacheDir:$(e.localCacheDir)}))}function kr(e){let t=JSON.parse(e);if(t.version!==ut||t.artifactCatalogVersion!==se||typeof t.generationId!="string"||!/^[a-f0-9]{64}$/.test(t.generationId)||typeof t.repositoryId!="string"||!/^[a-f0-9]{24}$/.test(t.repositoryId)||typeof t.treeOid!="string"||!t.treeOid||typeof t.producerIdentity!="string"||t.producerIdentity!==Ge||typeof t.sourceProjectRoot!="string"||typeof t.scipProjectRoot!="string"||typeof t.createdAt!="string"||!Number.isFinite(Date.parse(t.createdAt))||!t.fingerprint||!Array.isArray(t.artifacts))throw new Error("invalid shared generation manifest");let r=new Set;for(let n of t.artifacts){if(!n||typeof n.path!="string"||typeof n.size!="number"||n.size<0||typeof n.sha256!="string"||!/^[a-f0-9]{64}$/.test(n.sha256))throw new Error("invalid shared generation artifact");if(Ee(n.path),r.has(n.path))throw new Error(`duplicate shared generation artifact: ${n.path}`);r.add(n.path)}for(let n of["index.db","index.scip","meta.json"])if(!r.has(n))throw new Error(`shared generation is missing ${n}`);return t}function de(e,t,r=384){return he(e,t,{mode:r})}function Ti(e,t,r){Y(e,{recursive:!0}),E(l(e,Dr),{version:1,repositoryId:t,worktreeId:r},{spacing:2,trailingNewline:!0})}function wr(e){try{let t=Pe(e),r=Rr("sha256");for(let n of t.files){let i=D(e,n),o=Te(i).size;r.update(n).update("\0").update(String(o)).update("\0"),ht(i,{inputKind:"source-generation artifact",maxBytes:x},a=>r.update(a)),r.update("\0")}return r.digest("hex")}catch{return null}}function Ar(e){try{let t=fe(R(l(e,"meta.json"),{inputKind:"reindex metadata",maxBytes:v}));return(t.kind==="legacy"||t.kind==="supported")&&t.capabilities.publishableGeneration?t.metadata:void 0}catch{return}}function Di(e){return Ar(e)?.scipCompanion!=="deferred"}function ki(e,t){let r=Oe(e.languages,e);return JSON.stringify(r)===JSON.stringify(t)}function vr(e,t){let r=new Map(e.files.map(o=>[o.path,`${o.size}\0${o.hash}`])),n=new Map(t.files.map(o=>[o.path,`${o.size}\0${o.hash}`])),i=0;for(let[o,a]of r)n.get(o)!==a&&(i+=1);for(let o of n.keys())r.has(o)||(i+=1);return i}function gt(e){return l(e.repositoryCacheDir,"generations",e.generationId)}function Ai(e){let t=JSON.parse(R(l(e,Dr),{inputKind:"worktree cache pointer",maxBytes:v}));return t.version!==1||typeof t.repositoryId!="string"||!/^[a-f0-9]{24}$/.test(t.repositoryId)||typeof t.worktreeId!="string"||!/^[a-f0-9]{24}$/.test(t.worktreeId)?null:{version:t.version,repositoryId:t.repositoryId,worktreeId:t.worktreeId}}function Lr(e,t,r){let n=At(e,{waitMs:5e3});if(!n)throw new Error("repository cache cleanup is busy");try{if(r){let o=t.activeGenerationId??t.baseGenerationId;if(!o||!j(l(e,"generations",o)))throw new Error("shared generation disappeared before its lease was attached")}let i=l(e,"worktrees");Y(i,{recursive:!0}),E(l(i,`${t.worktreeId}.json`),t,{spacing:2,trailingNewline:!0}),Ti(t.localCacheDir,t.repositoryId,t.worktreeId)}finally{n.release()}}function Li(e,t){let r=l(t,".rollback"),n=new Map,i=new Map;Y(r,{recursive:!0});for(let s of["index.scip","index.db","meta.json"]){let c=l(e,s),d=j(c);n.set(s,d),d&&de(c,l(r,"stable",s))}for(let s of pt){let c=l(e,s),d=j(c);if(d){let u=dt(c);if(!u.isDirectory()||u.isSymbolicLink())throw new Error(`managed artifact path is not a directory: ${s}`)}i.set(s,d)}let o=l(e,Z),a=j(o);return a&&Cr(o,l(r,"sqlite-generations")),{root:r,stableFiles:n,managedDirectories:i,generationStoreExisted:a}}function Ci(e,t,r){for(let n of pt){let i=l(t,n);if(r.managedDirectories.get(n)){let a=l(r.root,"managed",n);Y(lt(a),{recursive:!0}),B(i,a)}let o=l(e,n);j(o)&&B(o,i)}}function Oi(e,t){for(let i of pt){let o=l(e,i),a=l(t.root,"managed",i);t.managedDirectories.get(i)?j(a)&&(M(o,{recursive:!0,force:!0}),B(a,o)):M(o,{recursive:!0,force:!0})}for(let[i,o]of t.stableFiles){let a=l(e,i);if(!o){M(a,{force:!0});continue}let s=`${a}.shared-restore-${xi()}`;de(l(t.root,"stable",i),s),M(a,{force:!0}),B(s,a)}let r=l(e,Z);M(r,{recursive:!0,force:!0});let n=l(t.root,"sqlite-generations");t.generationStoreExisted&&j(n)&&B(n,r)}function Cr(e,t){Y(t,{recursive:!0});for(let r of Er(e,{withFileTypes:!0})){let n=l(e,r.name),i=l(t,r.name);if(r.isSymbolicLink())throw new Error(`managed cache backup cannot contain a symlink: ${n}`);r.isDirectory()?Cr(n,i):r.isFile()&&de(n,i)}}function Mi(e,t){if(e.generationId!==t.generationId||e.repositoryId!==t.repositoryId||e.treeOid!==t.treeOid||e.producerIdentity!==t.producerIdentity||!ue(e.fingerprint,t.fingerprint))throw new Error("shared generation manifest does not match the requested snapshot")}function Or(e,t,r,n=!0,i=!0){try{let o=Ar(e);if(!o||o.scipCompanion==="deferred"||!ue(xt(o.fingerprint),r)||JSON.stringify([...o.indexedLanguages??[]].sort())!==JSON.stringify([...r.languages].sort()))return ce("source validation rejected metadata"),!1;let a=Pe(e),s=Re(l(e,"index.db"),l(e,"meta.json"));if(n?s.state!=="current":s.state==="invalid"||s.state==="drifted")return ce(`source validation rejected SQLite generation state ${s.state}`),!1;let c=new vi(l(e,"index.db"),{readonly:!0,fileMustExist:!0});try{if(i){if(c.pragma("quick_check(1)",{simple:!0})!=="ok")return!1}else c.pragma("schema_version",{simple:!0})}finally{c.close()}let d=yt(t),f=(i?a.files.filter(m=>m.endsWith(".scip")):["index.scip"]).every(m=>{let P=Tr(S(D(e,m),{inputKind:"shared SCIP validation artifact",maxBytes:x})).metadata?.projectRoot;return P!==d&&ce(`source validation rejected SCIP root for ${m}: ${String(P)}`),P===d});return f||ce("source validation rejected SCIP project roots"),f}catch(o){return ce(`source validation failed: ${o instanceof Error?o.message:String(o)}`),!1}}function ce(e){process.env.SCIP_QUERY_DEBUG&&console.error(`shared-cache: ${e}`)}function yt(e){try{return Ir(Gr(e)).href}catch{return Ir($(e)).href}}function ji(e){if(!e||typeof e!="object")return!1;let t=e;return t.version===3&&Array.isArray(t.languages)&&typeof t.pnpmWorkspaces=="boolean"&&(t.typescriptProjectMode==="single"||t.typescriptProjectMode==="workspace")&&Array.isArray(t.typescriptProjects)&&Array.isArray(t.files)&&t.files.every(r=>r!==null&&typeof r=="object"&&typeof r.path=="string"&&typeof r.size=="number"&&typeof r.hash=="string"&&(r.semanticHash===void 0||typeof r.semanticHash=="string"))}function Mr(e){return Rr("sha256").update(e).digest("hex")}export{jr as a,Fi as b,At as c,C as d,Zi as e,Jr as f,eo as g,q as h,ao as i,mo as j,wo as k,vo as l,To as m,Bo as n,zo as o,Xo as p,Zo as q,ea as r,ur as s,ri as t,fa as u,Re as v,Pi as w,Ha as x,Va as y,Ua as z,z as A,Ya as B,Qa as C,Ka as D,Ja as E,Gi as F,Xa as G,mt as H};
2
- //# sourceMappingURL=chunk-SIGVQT43.js.map
@@ -1,4 +0,0 @@
1
- import{a as L}from"./chunk-BGBBVSH4.js";import{d as Pe}from"./chunk-PJBYDCBQ.js";import{a as I}from"./chunk-ZMS4YCY7.js";import{b}from"./chunk-EPLE5O5O.js";import{b as pe,d as me,e as ge,f as be,g as Se,h as ye,i as K,j as he,m as Re}from"./chunk-5J3A6RBZ.js";import{a as de}from"./chunk-WRQXLNYE.js";import{b as F}from"./chunk-YDTK77JP.js";import{c as ie}from"./chunk-4IASLUOP.js";import{C as re,D as P,F as se,J as oe,P as E,Q as le,R as ue,S as fe,T as B,g as ee,j as te,k as w,n as R,o as ne}from"./chunk-NP4JFCLE.js";import{a as h}from"./chunk-5Z2H76VD.js";import{d as k,f as $,g as V,i as ae,j as ce}from"./chunk-DRENNWRG.js";import{a as xe}from"./chunk-DHEQMPLW.js";import{d as g}from"./chunk-FYCH2EYQ.js";import{e as J}from"./chunk-HGFDYOVB.js";import{B as x,ja as T,ka as Q,la as z}from"./chunk-XIPGCT3D.js";import{existsSync as A,readdirSync as Ee}from"fs";import{join as M}from"path";var ze={files:new Set,pathPrefixes:[]};var X=/^(?:dist|build|lib|out|output|esm|cjs|umd)\//,et=/\.(?:d\.ts|d\.mts|d\.cts|ts|tsx|mts|cts|js|jsx|mjs|cjs)$/,De=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"],tt=new Set([".git",".next",".turbo","build","coverage","dist","node_modules","out"]),nt=4,rt=g("package-surface",{clearGroups:["whole-project"]}),fn=g("package-operational-surface",{clearGroups:["whole-project"]});function Me(t){return rt.get(t,()=>it(t.config.projectRoot))}function G(t,e){let n=Me(t);return n.files.has(e)?!0:n.pathPrefixes.some(r=>e.startsWith(r))}function ve(t,e){return Me(t).files.has(e)}function it(t){let e=new Set,n=[];for(let{manifest:r,packageRoot:s}of st(t))for(let i of ot(r))at(t,s,i,e,n);return e.size===0&&n.length===0?ze:{files:e,pathPrefixes:n}}function st(t){let e=[],n=Te(t,"");return n&&e.push({manifest:n,packageRoot:""}),Ce(t,"",e,0),e}function Ce(t,e,n,r){if(r>=nt)return;let s=M(t,e);if(A(s))for(let i of Ee(s,{withFileTypes:!0})){if(!i.isDirectory()||tt.has(i.name))continue;let o=e?`${e}/${i.name}`:i.name,a=Te(t,o);a&&n.push({manifest:a,packageRoot:o}),Ce(t,o,n,r+1)}}function Te(t,e){let n;try{n=T(t,M(e,"package.json"),{maxBytes:8*1024*1024,inputKind:"package manifest"})}catch(r){if(!Q(r))throw r;return null}try{let r=JSON.parse(n);return r&&typeof r=="object"?r:null}catch{return null}}function ot(t){let e=[];for(let r of["main","module","types","browser"])typeof t[r]=="string"&&e.push(t[r]);let n=t.bin;if(typeof n=="string")e.push(n);else if(n&&typeof n=="object")for(let r of Object.values(n))typeof r=="string"&&e.push(r);return we(t.exports,e),e}function we(t,e){if(typeof t=="string"){e.push(t);return}if(!(!t||typeof t!="object"))for(let n of Object.values(t))we(n,e)}function at(t,e,n,r,s){let i=n.replace(/\\/g,"/").replace(/^\.\//,"");if(i===""||i.startsWith(".."))return;let o=i.indexOf("*");if(o>=0){let l=i.slice(0,o);for(let u of ke(l))u!==""&&s.push(S(e,u));return}let a=i.replace(et,"");for(let l of ke(a)){l===a&&l===i&&r.add(S(e,i));for(let u of De)ct(t,r,e,l+u)}r.add(S(e,i))}function ke(t){let e=[t];return X.test(t)&&(e.push(t.replace(X,"src/")),e.push(t.replace(X,""))),e}function ct(t,e,n,r){let s=S(n,r);if(e.add(s),!r.startsWith("src/")||A(M(t,s)))return;let i=De.find(c=>r.endsWith(c));if(!i)return;let o=r.slice(0,-i.length);lt(t,e,n,o,i);let a=o.lastIndexOf("/");if(a<=4)return;let l=o.slice(0,a),u=o.slice(a+1);for(let c of Fe(t,n,l,`${u}${i}`))e.add(c)}function lt(t,e,n,r,s){let i=S(n,`${r}/index${s}`);A(M(t,i))&&e.add(i)}function Fe(t,e,n,r){let s=M(t,e,n);if(!A(s))return[];let i=[];for(let o of Ee(s,{withFileTypes:!0})){let a=`${n}/${o.name}`;o.isDirectory()?i.push(...Fe(t,e,a,r)):o.isFile()&&o.name===r&&i.push(S(e,a))}return i}function S(t,e){return t?`${t}/${e}`:e}import{existsSync as q,readdirSync as ut}from"fs";import{dirname as ft,join as U}from"path";var dt={rootFiles:new Set,sourcePrefixes:[]},pt=new Set([".git",".scipquery","node_modules","target"]),mt=6,gt=g("rust-library-surface",{clearGroups:["whole-project"]});function Ie(t,e,n){if(!n.endsWith(".rs")||!yt(bt(t),n))return!1;let r=E(t,n).find(s=>s.symbol===e);return r?ht(te(t,n)[r.startLine]??""):!1}function bt(t){return gt.get(t,()=>St(t.config.projectRoot))}function St(t){let e=new Set,n=new Set;for(let r of Rt(t)){let s=T(t,U(r,"Cargo.toml"),{maxBytes:8388608,inputKind:"Cargo manifest"}),i=xt(s),o=S(r,"src/lib.rs"),a=i?S(r,i):!Pt(s)&&z(t,o)?o:null;if(!a)continue;e.add(a);let l=ft(a).replaceAll("\\","/");n.add(l==="."?"":`${l}/`)}return e.size===0?dt:{rootFiles:e,sourcePrefixes:[...n].sort()}}function yt(t,e){return e.endsWith(".rs")?t.rootFiles.has(e)?!0:kt(e)?!1:t.sourcePrefixes.some(n=>e.startsWith(n)):!1}function ht(t){return/^\s*pub\s+(?!\()/.test(t)}function Rt(t){if(!q(t))return[];let e=[];return Le(t,"",e,0),e}function Le(t,e,n,r){let s=U(t,e);if(q(s)&&(q(U(s,"Cargo.toml"))&&n.push(e),!(r>=mt)))for(let i of ut(s,{withFileTypes:!0})){if(!i.isDirectory()||pt.has(i.name))continue;let o=e?`${e}/${i.name}`:i.name;Le(t,o,n,r+1)}}function xt(t){let e=!1;for(let n of t.split(`
2
- `)){let r=n.replace(/\s+#.*$/,"").trim(),s=/^\[([^\]]+)\]$/.exec(r);if(s){e=s[1]==="lib";continue}if(!e)continue;let i=/^path\s*=\s*["']([^"']+)["']/.exec(r)?.[1];if(i)return i.replaceAll("\\","/").replace(/^\.\//,"")}return null}function Pt(t){let e=!1;for(let n of t.split(`
3
- `)){let r=n.replace(/\s+#.*$/,"").trim(),s=/^\[([^\]]+)\]$/.exec(r);if(s){e=s[1]==="package";continue}if(e&&/^autolib\s*=\s*false\b/.test(r))return!0}return!1}function kt(t){return/(?:^|\/)src\/main\.rs$/.test(t)||/(?:^|\/)src\/bin\//.test(t)||/(?:^|\/)(?:examples|tests|benches)\//.test(t)}function Et(t){return Dt.get(t,()=>{let n=h(t,{includeIgnored:!1}).filter(o=>{let a=b(o);return a==="entry"||a==="worker"});if(n.length===0)return new Set;let r=F(t),s=new Set,i=new Set;for(;n.length>0;){let o=n.shift();if(!s.has(o)){s.add(o),b(o)==="barrel"&&i.add(o);for(let a of r.get(o)??[])s.has(a)||n.push(a)}}return i})}var Dt=g("live-barrels",{clearGroups:["whole-project"]});function Mt(t,e){return Et(t).has(x(e))}function Ne(t,e){let n=x(e),r=b(e);return r==="entry"||r==="worker"||Gt(n)||Mt(t,n)}function vt(t,e,n){let r=x(n),s=[];G(t,r)&&s.push("package-surface-file"),wt(t,e,r)&&s.push("transitive-package-surface"),Ie(t,e,r)&&s.push("rust-public-library"),Xt(e,r)&&s.push("framework-entrypoint");let i=t.config.entryRoots;return i&&(i.files?.some(o=>x(o)===r)&&s.push("configured-file"),i.pathPrefixes?.some(o=>r.startsWith(x(o)))&&s.push("configured-path-prefix"),i.qualifiedVars?.some(o=>Ut(e,o))&&s.push("configured-qualified-var"),i.symbolPatterns?.some(o=>{try{return xe(o,"entryRoots.symbolPatterns entry").test(e)}catch{return!1}})&&s.push("configured-symbol-pattern")),s}function _e(t,e,n){return vt(t,e,n).length>0}var Ct=g("package-surface-reachability",{clearGroups:["whole-project"]}),Tt=g("explicit-package-surface-reachability",{clearGroups:["whole-project"]});function wt(t,e,n){let r=Ft(t).get(n);return r===void 0?!1:r===null||r.has(k(e))}function In(t,e,n){let r=It(t).get(n);return r===void 0?!1:r===null||r.has(k(e))}function Ft(t){return Ct.get(t,()=>je(t,e=>G(t,e)))}function It(t){return Tt.get(t,()=>je(t,e=>ve(t,e)))}function je(t,e){let n=new Map,r=[];for(let s of h(t,{includeIgnored:!1}))e(s)&&(n.set(s,null),r.push(s));for(;r.length>0;){let s=r.shift(),i=n.get(s);if(i!==void 0)for(let o of se(t,s)){if(!o.sourcePath||t.isIgnored(o.sourcePath))continue;let a=Lt(i,o);a!==void 0&&At(n,o.sourcePath,a)&&r.push(o.sourcePath)}}return n}function Lt(t,e){if(t===null)return e.kind==="named"?new Set(e.names):null;if(e.kind==="star")return new Set(t);if(e.kind==="star-as")return e.names.some(r=>t.has(r))?null:void 0;let n=e.names.filter(r=>t.has(r));return n.length>0?new Set(n):void 0}function At(t,e,n){if(!t.has(e))return t.set(e,n),!0;let r=t.get(e);if(r===void 0)return!1;if(r===null||n===null)return r===null?!1:(t.set(e,null),!0);let s=!1;for(let i of n)r.has(i)||(r.add(i),s=!0);return s}var Oe=new Set(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"]),Nt=new Set(["default","generateMetadata","generateStaticParams"]),_t=new Set(["default","getStaticProps","getServerSideProps","getStaticPaths","config"]),jt=new Set(["default","middleware","config"]),Ot=new Set(["register","onRequestError"]),$t=new Set(["onRouterTransitionStart"]),Vt=new Set(["default","loader","action","clientLoader","clientAction","headers","links","meta","shouldRevalidate","ErrorBoundary","HydrateFallback"]),Bt=new Set(["load","actions","entries",...Oe]),Kt=new Set(["default"]);function Xt(t,e){let n=k(t);return n===""?!1:$e(e)?Oe.has(n):Ve(e)?Nt.has(n):Be(e)?_t.has(n):Ke(e)?jt.has(n):Xe(e)?Ot.has(n):Ge(e)?$t.has(n):qe(e)?Vt.has(n):Ue(e)?Bt.has(n):qt(e)?Kt.has(n):!1}function Gt(t){return $e(t)||Ve(t)||Be(t)||Ke(t)||Xe(t)||Ge(t)||qe(t)||Ue(t)}function $e(t){return/(?:^|\/)app(?:\/[^/]+)*\/route\.(?:ts|tsx|js|jsx|mjs|cjs)$/.test(t)}function Ve(t){return/(?:^|\/)app(?:\/[^/]+)*\/(?:page|layout|template|loading|error|not-found|global-error|head|default)\.(?:ts|tsx|js|jsx|mjs|cjs)$/.test(t)}function Be(t){return/(?:^|\/)pages\/.+\.(?:ts|tsx|js|jsx|mjs|cjs)$/.test(t)}function Ke(t){return W(t,"(?:middleware|proxy)\\.(?:ts|js|mts|mjs)")}function Xe(t){return W(t,"instrumentation\\.(?:ts|js|mts|mjs)")}function Ge(t){return W(t,"instrumentation-client\\.(?:ts|js|mts|mjs)")}function W(t,e){return new RegExp(`^(?:src/)?${e}$`).test(t)||new RegExp(`(?:^|/)src/${e}$`).test(t)||new RegExp(`(?:^|/)(?:apps|services|packages)/[^/]+/(?:src/)?${e}$`).test(t)}function qe(t){return/(?:^|\/)app\/routes\/.+\.(?:ts|tsx|js|jsx|mjs|cjs)$/.test(t)}function Ue(t){return/(?:^|\/)src\/routes\/(?:.*\/)?\+(?:page|page\.server|layout|layout\.server|server)\.(?:ts|js)$/.test(t)}function qt(t){return/(?:^|\/)src\/(?:pages|views|routes)\/.+\.(?:ts|tsx|js|jsx|vue)$/.test(t)}function Ut(t,e){let n=e.lastIndexOf("/");if(n<0)return!1;let r=e.slice(0,n),s=e.slice(n+1);return t.includes(Ae(r)+"/")&&t.includes(Ae(s)+".")}function Ae(t){return/^[A-Za-z0-9_$+-]+$/.test(t)?t:"`"+t.replace(/`/g,"``")+"`"}function We(t,e,n={}){let r=new Map;if(e&&e.length===0)return r;let s=h(t,{includeIgnored:!1}),i=be(t),o=e??le(t),a=new Set(o.map(u=>u.symbolId)),l=zt(o);return Wt(t,r,s,i,a,l),Ht(t,r,o,a),Qt(t,r,s,i,a,l),n.semantic!==!1&&n.semanticEvidence&&tn(r,n.semanticEvidence.callerMap(t,en(o))),r}function Wt(t,e,n,r,s,i){for(let o of n){if(!R(o))continue;let a=re(t,o);if(a)for(let l of a){if(i&&!i.has(l.calleeLeaf))continue;let u=me(o,r.get(l.calleeLeaf)??[]);if(!u||u.length===0)continue;let c=ge(t,o,u,l.memberAccess,l.calleeQualifier);c&&s.has(c.symbolId)&&c.file!==o&&H(e,c.symbolId,o)}}}function Ht(t,e,n,r){let s=Zt(n);for(let i of Yt(t,r))t.isIgnored(i.relative_path)||Jt(i,s.get(i.symbol_id))||H(e,i.symbol_id,i.relative_path)}function Yt(t,e){return de(t,e?[...e]:void 0)}function Zt(t){let e=new Map;for(let n of t)e.set(n.symbolId,{docId:n.documentId,startLine:n.startLine,endLine:n.endLine});return e}function Jt(t,e){return!!e&&e.docId===t.document_id&&t.chunk_start>=e.startLine&&t.chunk_end<=e.endLine}function Qt(t,e,n,r,s,i){for(let o of n){if(R(o)!=="rust")continue;let a=P(t,o,{includeRustAttributeNames:!0});if(a.length!==0)for(let{name:l}of a){if(i&&!i.has(l))continue;let u=r.get(l);if(u)for(let c of u)s.has(c.symbolId)&&c.file!==o&&H(e,c.symbolId,o)}}}function H(t,e,n){let r=t.get(e);r||(r=new Set,t.set(e,r)),r.add(n)}function zt(t){let e=new Set;for(let n of t){let r="leaf"in n&&typeof n.leaf=="string"?n.leaf:"symbol"in n&&typeof n.symbol=="string"?k(n.symbol):"";r&&e.add(r)}return e.size>0?e:null}function en(t){return t.filter(e=>"relativePath"in e&&"symbol"in e&&"leaf"in e)}function tn(t,e){for(let[n,r]of e){let s=t.get(n);s||(s=new Set,t.set(n,s));for(let i of r)s.add(i)}}function Y(t,e,n={}){return We(t,e,n)}function Z(t,e,n={}){return Re(t,e,n)}function He(t,e,n={}){let r=Y(t,e,{semantic:n.semantic,semanticEvidence:n.semanticEvidence});return n.sourceFallback===!1?r:nn(r,Z(t,e))}function nn(t,e){let n=new Map;for(let[r,s]of t)n.set(r,new Set(s));for(let[r,s]of e){let i=n.get(r)??new Set;for(let o of s)i.add(o);n.set(r,i)}return n}function Ye(t,e,n){let r=e.identifierResolution==="strict"?K:he,s=e.candidateNames?Se(e.candidateNames):null,i=0,o=0,a=0,l=0,u="";for(let c of e.paths)if(i+=1,u=c,!(!R(c)&&!(e.includeVueSfc&&ne(c)))&&!t.isIgnored(c)&&!e.skipPath?.(c))try{if(s&&!ye(ee(t,c),s))continue;o+=1;let v=(d,m,j,D)=>{if(e.candidateNames&&!e.candidateNames.has(d))return;a+=1;let C=e.resolveTargets?e.resolveTargets({sourceFile:c,name:d,kind:m,defaultTargets:D}):D();for(let O of C)l+=1,n({sourceFile:c,name:d,target:O,occurrences:j,kind:m})},_=pe(t,c);for(let[d,m]of _)v(d,"identifier",m.length,()=>r(t,c,d));for(let d of P(t,c,{includeCrossLanguageDispatchNames:e.includeCrossLanguageDispatchNames,includeRustAttributeNames:e.includeRustAttributeNames})){let m=d.kind==="cross-language-dispatch"?()=>K(t,c,d.name):()=>r(t,c,d.name);v(d.name,d.kind,d.occurrences,m)}}finally{e.afterPath?.(c),i%10===0&&J("source-reference-scan.progress",()=>{},()=>({scannedPaths:i,currentPath:u,candidateMatchedPaths:o,visitedNames:a,visitedHits:l}))}}function Ze(t,e={}){let{scope:n,files:r,minLoc:s=1,maxLoc:i=Number.POSITIVE_INFINITY,excludeSymbol:o,excludeEntrySurfaces:a=!1,excludeTypesFiles:l=!1,excludeRootedSymbols:u=!1,requireFunctionLikeSymbol:c=!1,requireCallableSymbol:N=!1,excludeRustTraitImplMembers:v=!1,includeSuppressed:_=!1,sortByLocDesc:d=!1}=e,m=[],j=rn(t,{scope:n,files:r,requireFunctionLikeSymbol:c,requireCallableSymbol:N}),D=new Map,C=new Map,O=f=>{let p=D.get(f);if(p!==void 0)return p;let y=Ne(t,f);return D.set(f,y),y},Qe=f=>{let p=C.get(f);if(p!==void 0)return p;let y=b(f);return C.set(f,y),y};for(let f of j){let p=f.relativePath;if(t.isIgnored(p)||a&&O(p)||!sn(f,{requireFunctionLikeSymbol:c,requireCallableSymbol:N})||o!==void 0&&f.symbol===o)continue;let y=L(f);y<s||y>i||l&&on(p)||u&&_e(t,f.symbol,p)||v&&ae(f.symbol)||Qe(p)!=="test"&&(ce(f.symbol)||!_&&w(t,p,f.startLine)||m.push(f))}return d?m.sort((f,p)=>L(p)-L(f)):m}function rn(t,e){return e.files!==void 0?[...new Set(e.files.map(r=>r.replace(/\\/g,"/")))].sort().filter(r=>!e.scope||r.includes(e.scope)).flatMap(r=>E(t,r)):e.requireCallableSymbol?B(t,{scope:e.scope,symbolMatches:$,sqlPrefilter:"callable"}):e.requireFunctionLikeSymbol?B(t,{scope:e.scope,symbolMatches:V,sqlPrefilter:"function-like"}):fe(t,e.scope)}function sn(t,e){return e.requireCallableSymbol?$(t.symbol):e.requireFunctionLikeSymbol?V(t.symbol):t.isFunctionLike}function on(t){return(t.split("/").pop()??"").includes("types")}var Je=class{constructor(e){this.db=e}db;scopedDefinitions(e){return ue(this.db,e)}definitionsForFile(e){return E(this.db,e)}productionCallableDefinitions(e={}){return Ze(this.db,e)}calleeMap(e,n={}){return Pe(this.db,e,{...n,semanticEvidence:I})}crossFileCallerMap(e,n={}){return Y(this.db,e,{...n,semanticEvidence:I})}sourceFallbackCallerFiles(e,n={}){return Z(this.db,e,n)}callerFileMap(e,n={}){return He(this.db,e,{...n,semanticEvidence:I})}frameworkReferencedSymbolIds(e){let n=new Map;for(let s of e){if(!s.leaf)continue;let i=n.get(s.leaf)??[];i.push(s.symbolId),n.set(s.leaf,i)}let r=new Set;for(let s of h(this.db,{includeIgnored:!1}))if(R(s)==="rust")for(let{name:i}of P(this.db,s,{includeRustAttributeNames:!0}))for(let o of n.get(i)??[])r.add(o);return r}symbolsWithNonSelfCallees(e,n={}){if(e.length===0)return new Set;let r=new Map(e.map(i=>[i.symbolId,i.symbol])),s=this.calleeMap(e,n);return new Set([...s.entries()].filter(([i,o])=>{let a=r.get(i);return o.some(l=>l.symbol!==a)}).map(([i])=>i))}fileDependencyGraph(e){return F(this.db,e)}fileKind(e){return b(e)}hasSuppressionComment(e){return w(this.db,e.relativePath,e.startLine)}sourceFiles(){return ie(this.db)}scanSourceReferences(e,n){Ye(this.db,e,n)}callableSignature(e){let n=oe(this.db).forFile(e.relativePath,{facts:!0}).facts?.callables.find(r=>r.startLine===e.startLine&&r.endLine===e.endLine);return n?{paramCount:n.paramCount}:null}};export{Ne as a,vt as b,In as c,Je as d};
4
- //# sourceMappingURL=chunk-SRIZDEWX.js.map
@@ -1,2 +0,0 @@
1
- import{c as Q,d as Y,e as I}from"./chunk-UXNXOMXJ.js";import{a as _,b as K,c as x,d as G}from"./chunk-O4PZFAXA.js";import{a as C,c as J,d as W}from"./chunk-NQXWWE6S.js";import{b as v}from"./chunk-H5EXS3HM.js";import{a as j,b as R,c as A,d as P}from"./chunk-Z2KGMIL4.js";import{V as U,Z as T,h as y,w as q,x as f,y as V}from"./chunk-XIPGCT3D.js";import{watch as fe}from"fs";function Le(e){let t=!1,r=!1,i,n=[],s=()=>{r=!0;let o=i;i=void 0,o?.()};for(let o of new Set(e))try{let a=fe(o,{persistent:!1},s);a.on("error",()=>{}),n.push(a)}catch{}return{wait(o){return t||o<=0?(r=!1,Promise.resolve()):new Promise(a=>{let c=setTimeout(()=>{i===d&&(i=void 0),a()},o),d=()=>{clearTimeout(c),i===d&&(i=void 0),a()};i=d,(r||t)&&(r=!1,d())})},close(){if(!t){t=!0;for(let o of n)try{o.close()}catch{}n.length=0}s()}}}import{spawn as qe}from"child_process";import{existsSync as Ce,rmSync as oe}from"fs";import{dirname as nt,resolve as F}from"path";import{fileURLToPath as ot}from"url";import{createHash as me,randomUUID as O}from"crypto";import{existsSync as ve,linkSync as Se,readdirSync as ge,rmSync as m}from"fs";import{basename as ye,dirname as Re,join as u}from"path";var p=1,We=10*6e4,Ie=10080*6e4,k="requests",S="claims",w="completions",B="staging";function Ge(e,t,r={}){let i=r.now?.()??new Date,n=Ee(r.ttlMs),s=be(r.idempotencyKey),o=s?`key-${me("sha256").update(s).digest("hex")}`:`request-${(r.randomId??O)()}`,a={version:p,requestId:o,...s?{idempotencyKey:s}:{},createdAt:i.toISOString(),deadlineAt:new Date(i.getTime()+n).toISOString(),detail:t.trim().slice(0,2048)||"stale index observed by a command"},c=ie(e,o),d=M(e,c,a,r.onStage);if(d.published)return{disposition:"accepted",request:a,achievedDurability:d.achievedDurability,directorySync:d.directorySync};let l=D(c);if(!l)throw new Error(`Watch refresh request identity ${o} exists but is malformed.`);return{disposition:"duplicate",request:l}}function Je(e,t={}){let r=t.now?.()??new Date,i=`claim-${(t.randomId??O)()}`,n=Math.max(1,Math.floor(t.limit??64)),s=ee(e).sort(Ae),o=[];for(let a of s){if(o.length>=n)break;if(z(e,a.requestId))continue;if(Date.parse(a.deadlineAt)<=r.getTime()){Z(e,{version:p,requestId:a.requestId,outcome:"expired",completedAt:r.toISOString()});continue}let c={version:p,requestId:a.requestId,claimId:i,claimedAt:r.toISOString()};if(M(e,ne(e,a.requestId),c).published){if(z(e,a.requestId)){te(e,a.requestId,i);continue}o.push(a)}}return{claimId:i,requests:o}}function Qe(e,t,r=()=>new Date,i){let n=r().toISOString();for(let s of t.requests)Z(e,{version:p,requestId:s.requestId,claimId:t.claimId,outcome:"completed",completedAt:n});i?.("after-completion"),we(e,t),i?.("after-claim-release")}function we(e,t){for(let r of t.requests)te(e,r.requestId,t.claimId)}function Ye(e){let t=0;for(let r of h(u(e,S)))m(r,{force:!0}),t++;return t>0&&f(u(e,S)),re(e),t}function ze(e){let t=ee(e),r=new Map,i=ke(u(e,k),D);for(let c of h(u(e,w))){let d=E(c);if(!d){i++;continue}r.set(d.requestId,d)}let n=new Set;for(let c of h(u(e,S))){let d=X(c);if(!d){i++;continue}n.add(d.requestId)}let s=t.filter(c=>!r.has(c.requestId)&&!n.has(c.requestId)),o=[...r.values()].filter(c=>c.outcome==="completed").length,a=[...r.values()].filter(c=>c.outcome==="expired").length;return{pending:s.length,claimed:t.filter(c=>!r.has(c.requestId)&&n.has(c.requestId)).length,completed:o,expired:a,invalid:i,...s.length>0?{oldestPendingAt:s.map(c=>c.createdAt).reduce((c,d)=>Pe(c,d))}:{}}}function Be(e,t={}){let r=(t.now?.()??new Date).getTime(),i=Math.max(0,t.retentionMs??Ie),n=0;for(let s of h(u(e,w))){let o=E(s);!o||r-Date.parse(o.completedAt)<i||(m(s,{force:!0}),m(ie(e,o.requestId),{force:!0}),n++)}return n>0&&(f(u(e,w)),f(u(e,k))),re(e),n}function D(e){return L(e,t=>{let r=t;return r.version===p&&g(r.requestId)&&(r.idempotencyKey===void 0||typeof r.idempotencyKey=="string")&&v(r.createdAt)&&v(r.deadlineAt)&&Date.parse(r.deadlineAt)>=Date.parse(r.createdAt)&&typeof r.detail=="string"&&r.detail.length>0})}function X(e){return L(e,t=>{let r=t;return r.version===p&&g(r.requestId)&&g(r.claimId)&&v(r.claimedAt)})}function E(e){return L(e,t=>{let r=t;return r.version===p&&g(r.requestId)&&(r.claimId===void 0||g(r.claimId))&&(r.outcome==="completed"||r.outcome==="expired")&&v(r.completedAt)})}function Z(e,t){let r=se(e,t.requestId);if(M(e,r,t).published)return;let i=E(r);if(!i||i.requestId!==t.requestId||i.outcome!==t.outcome)throw new Error(`Watch refresh completion ${t.requestId} conflicts with an existing record.`)}function M(e,t,r,i){let n=u(e,B),s=Re(t),o=q(n),a=q(s),c=u(n,`${ye(t)}.${process.pid}.${O()}.tmp`);try{let d=W(c,r,{spacing:2,trailingNewline:!0});i?.("after-staged");try{Se(c,t)}catch(H){if(H.code==="EEXIST")return{published:!1};throw H}let l=V(o,a,d.directorySync,f(s));return i?.("after-published"),{published:!0,achievedDurability:l==="synced"?"directory-durable":"file-flushed",directorySync:l}}finally{m(c,{force:!0})}}function ee(e){let t=[];for(let r of h(u(e,k))){let i=D(r);i&&t.push(i)}return t}function te(e,t,r){let i=ne(e,t),n=X(i);!n||n.claimId!==r||(m(i,{force:!0}),f(u(e,S)))}function re(e){for(let t of h(u(e,B),".tmp"))m(t,{force:!0})}function ke(e,t){return h(e).filter(r=>!t(r)).length}function h(e,t=".json"){return ve(e)?ge(e,{withFileTypes:!0}).filter(r=>r.isFile()&&r.name.endsWith(t)).map(r=>u(e,r.name)).sort():[]}function L(e,t){try{let r=JSON.parse(y(e,"watch refresh request record"));return t(r)?r:null}catch{return null}}function ie(e,t){return u(e,k,`${t}.json`)}function ne(e,t){return u(e,S,`${t}.json`)}function se(e,t){return u(e,w,`${t}.json`)}function z(e,t){return E(se(e,t))!==null}function Ee(e){if(e===void 0)return We;if(!Number.isFinite(e)||e<=0)throw new Error("Watch refresh request ttlMs must be positive.");return Math.floor(e)}function be(e){let t=e?.trim();return t?t.slice(0,512):void 0}function g(e){return typeof e=="string"&&/^[a-z0-9][a-z0-9-]{0,127}$/i.test(e)}function Ae(e,t){return Date.parse(e.createdAt)-Date.parse(t.createdAt)||e.requestId.localeCompare(t.requestId)}function Pe(e,t){return Date.parse(t)<Date.parse(e)?t:e}var Te=6e3,_e=1e3,ce=10;function mt(e,t,r){let i=T(F(e));if(r&&T(r.projectRoot)===i)return{projectRoot:i,worktreeKind:"git",worktreeId:r.worktreeId,cliVersion:t};let n=U(i);if(n.kind==="error")throw new Error(`Could not establish Git worktree identity for ${i}: ${n.message}`);return n.kind==="non-git"?{projectRoot:i,worktreeKind:"non-git",cliVersion:t}:{projectRoot:i,worktreeKind:"git",worktreeId:n.identity.worktreeId,cliVersion:t}}function vt(e){let t=e.runtime??De,r=Q(e.cacheDir),i=Y(r.statePath),n=i?de(i,t)?{kind:"live",state:i}:{kind:"stale",state:i,reason:"dead-process"}:{kind:"stopped"},s=xe("stop",n);if(s.kind==="signal-stop")return ae(s.state,e,t),N(r,s.state.pid,t),{disposition:"stopped",pid:s.state.pid};if(s.kind==="clean-stale")return N(r,s.state.pid,t),{disposition:"stopped",pid:s.state.pid};let o=le(r.lockPath);return s.kind==="already-stopped"&&o?(de(o,t)&&ae(o,e,t),N(r,o.pid,t),{disposition:"stopped",pid:o.pid}):{disposition:"already-stopped"}}function St(e,t,r={}){let{durability:i="durable",...n}=r;i==="durable"?W(e,t,n):J(e,t,n)}function gt(e){try{let t=JSON.parse(y(e,"watch activity record"));return t.version!==1||!I(t.at)||t.refreshRequestedAt!==void 0&&!I(t.refreshRequestedAt)||t.refreshDetail!==void 0&&typeof t.refreshDetail!="string"?null:{atMs:Date.parse(t.at),...t.refreshRequestedAt===void 0?{}:{refreshRequestedAtMs:Date.parse(t.refreshRequestedAt)},...t.refreshDetail===void 0?{}:{refreshDetail:t.refreshDetail}}}catch{return null}}function yt(e,t,r={}){let i=r.pid??process.pid,n=r.isProcessAlive??C,s=()=>{},o=r.readProcessIdentity??A,a=r.now??(()=>new Date),c={..._,wallNow:()=>a().getTime(),isProcessAlive:n,readProcessIdentity:o},d=K(e,{kind:"watch",pid:i,processIdentity:o(i),detail:{projectRoot:F(t)},parseLegacy:b,runtime:c});if(d.kind==="contended"){let l=pe(d.observation);return{acquired:!1,lockPath:e,message:Oe(e,t,l),release:s}}return{acquired:!0,lockPath:e,message:"",release:()=>{d.lock.release()}}}function le(e){return pe(x(e,{parseLegacy:b}))}var b=e=>{let t=he(e);return t?{pid:t.pid,...t.processIdentity?{processIdentity:t.processIdentity}:{}}:null};function pe(e){if(e.state==="valid"&&e.record?.kind==="watch"){let t=e.record.detail?.projectRoot;return typeof t!="string"?null:{version:1,pid:e.record.pid,...e.record.processIdentity?{processIdentity:e.record.processIdentity}:{},projectRoot:t,startedAt:e.record.startedAt}}return he(e.parsed)}function he(e){try{let t=e;if(t.version!==1||typeof t.pid!="number"||!Number.isInteger(t.pid)||t.pid<=0||typeof t.projectRoot!="string"||!I(t.startedAt))return null;let r=t.processIdentity===void 0?null:j(t.processIdentity);return t.processIdentity!==void 0&&(!r||r.pid!==t.pid)?null:{version:1,pid:t.pid,...r?{processIdentity:r}:{},projectRoot:t.projectRoot,startedAt:t.startedAt}}catch{return null}}function xe(e,t){switch(e){case"status":return{kind:"report",classification:t};case"ensure":switch(t.kind){case"stopped":return{kind:"start"};case"stale":return t.reason==="old-heartbeat"?{kind:"refuse-replace",state:t.state,reason:"old-heartbeat"}:{kind:"start"};case"live":return{kind:"reuse",state:t.state};case"incompatible":return{kind:"replace",state:t.state};default:return $(t)}case"stop":switch(t.kind){case"stopped":return{kind:"already-stopped"};case"stale":return t.reason==="old-heartbeat"?{kind:"signal-stop",state:t.state}:{kind:"clean-stale",state:t.state};case"live":case"incompatible":return{kind:"signal-stop",state:t.state};default:return $(t)}default:return $(e)}}function Rt(e){return e.idleTimeoutMs===0||e.watcher.state!=="idle"?!1:e.nowMs-e.lastActivityAtMs>=e.idleTimeoutMs}function ae(e,t,r){let{pid:i}=e;if(!r.isProcessAlive(i))return;ue(e,r),r.signalProcess(i);let n=t.stopTimeoutMs??Te,s=r.monotonicNow??P,o=s()+n;for(;s()<=o;){if(!r.isProcessAlive(i))return;r.sleep(ce)}if(!r.forceSignalProcess)throw new Error(`scip-query watch service pid ${i} did not stop within ${n}ms and forced termination is unavailable.`);ue(e,r),r.forceSignalProcess(i);let a=t.forceStopTimeoutMs??_e,c=s()+a;for(;s()<=c;){if(!r.isProcessAlive(i))return;let d=r.readProcessIdentity(i);if(e.processIdentity&&d&&!R(e.processIdentity,d))return;r.sleep(ce)}throw new Error(`scip-query watch service pid ${i} remained alive ${a}ms after forced termination.`)}function N(e,t,r){if(oe(e.statePath,{force:!0}),oe(e.activityPath,{force:!0}),le(e.lockPath)?.pid===t){let n={..._,wallNow:r.now,isProcessAlive:r.isProcessAlive,readProcessIdentity:r.readProcessIdentity},s=x(e.lockPath,{parseLegacy:b,runtime:n});G(e.lockPath,s,{parseLegacy:b,runtime:n})}}function de(e,t){if(!t.isProcessAlive(e.pid))return!1;if(!e.processIdentity)return!0;let r=t.readProcessIdentity(e.pid);return r===null||R(e.processIdentity,r)}function Oe(e,t,r){return`error: scip-query watch is already running for ${F(t)}${r?` (pid ${r.pid}, started ${r.startedAt}; lock: ${e})`:` (lock: ${e})`}. Stop that watcher before starting another.`}var De={now:Date.now,monotonicNow:P,isProcessAlive:C,readProcessIdentity:A,spawnServer(e,t,r,i){if(!Ce(e))throw new Error(`Watch service helper was not found at ${e}. Run npm run build first.`);qe(process.execPath,[e,t,r,JSON.stringify(i)],{detached:!0,stdio:"ignore",env:{...process.env,SCIP_QUERY_SKIP_WATCH_SERVICE:"1"}}).unref()},signalProcess(e){process.kill(e,"SIGTERM")},forceSignalProcess(e){process.kill(e,"SIGKILL")},sleep(e){let t=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(t,0,0,e)}};function ue(e,t){if(!e.processIdentity)throw new Error(`Refusing to signal scip-query watch pid ${e.pid}: its ownership record has no process identity.`);let r=t.readProcessIdentity(e.pid);if(!r)throw new Error(`Refusing to signal scip-query watch pid ${e.pid}: its process identity is unavailable.`);if(!R(e.processIdentity,r))throw new Error(`Refusing to signal scip-query watch pid ${e.pid}: its process identity does not match the ownership record.`)}function $(e){throw new Error(`Unhandled watch service value: ${JSON.stringify(e)}`)}export{Le as a,Ge as b,Je as c,Qe as d,we as e,Ye as f,ze as g,Be as h,mt as i,vt as j,St as k,gt as l,yt as m,Rt as n};
2
- //# sourceMappingURL=chunk-U7DOYZDH.js.map
@@ -1,2 +0,0 @@
1
- var b=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"];function x(n){let t=n.toLowerCase();return b.some(e=>t.endsWith(e))}import{createRequire as R}from"module";var d=R(import.meta.url),c,l;function M(){if(c!==void 0)return c;try{c=d("ts-morph")}catch{c=null}return c}function P(){if(l)return l;let n=M();if(!n)return"ts-morph:unavailable";let t="unknown";try{t=d("ts-morph/package.json").version??"unknown"}catch{}return l=`ts-morph:${t}:typescript:${n.ts.version}`,l}function j(n,t){return t.map(e=>({tsconfigPath:e,project:new n.Project({tsConfigFilePath:e,skipFileDependencyResolution:!0})}))}function $(n,t,e){return{language:"typescript",availability:()=>({available:!1,reason:n,tsconfigPath:t,tsconfigPaths:e}),importUsage:()=>[],referencesFor:()=>[],calleesFor:()=>[],signatureFor:()=>null}}function T(n,t){let e=new Map(n.map(r=>[r.symbol,r])),o=new Map(n.map(r=>[r.symbolId,[]]));for(let r of t.values())for(let s of r){let a=e.get(s.targetSymbol);a&&o.get(a.symbolId).push(s.location)}for(let[r,s]of o)o.set(r,F(s));return o}function w(n,t,e){let o=g(n,t),r=g(n,e),s=[...o].filter(i=>!r.has(i)).sort(),a=[...r].filter(i=>!o.has(i)).sort(),f=y(n,t),m=y(n,e),u=[...f].filter(i=>!m.has(i)).sort(),p=[...m].filter(i=>!f.has(i)).sort();return{passed:s.length===0&&a.length===0,expectedCount:o.size,actualCount:r.size,missing:s,extra:a,callerFiles:{passed:u.length===0&&p.length===0,expectedCount:f.size,actualCount:m.size,missing:u,extra:p}}}function y(n,t){let e=new Set;for(let o of n)for(let r of t.get(o.symbolId)??[])r.file!==o.relativePath&&e.add(`${o.symbol}\0${r.file}`);return e}function D(n,t,e){let o=new Set(e),r=new Map(e.map(s=>[s,[]]));for(let s of n)for(let a of t.get(s.symbolId)??[])o.has(a.file)&&r.get(a.file).push({targetSymbol:s.symbol,location:a});for(let[s,a]of r)r.set(s,h(a));return r}function g(n,t){let e=new Set;for(let o of n)for(let r of t.get(o.symbolId)??[])e.add(`${o.symbol}\0${r.file}\0${r.line}\0${r.column}`);return e}function F(n){let t=new Map;for(let e of n)t.set(`${e.file}\0${e.line}\0${e.column}`,e);return[...t.values()].sort(S)}function h(n){let t=new Map;for(let e of n){let{location:o}=e;t.set(`${e.targetSymbol}\0${o.file}\0${o.line}\0${o.column}`,e)}return[...t.values()].sort((e,o)=>e.targetSymbol.localeCompare(o.targetSymbol)||S(e.location,o.location))}function S(n,t){return n.file.localeCompare(t.file)||n.line-t.line||n.column-t.column}export{b as a,x as b,M as c,P as d,j as e,$ as f,T as g,w as h,D as i};
2
- //# sourceMappingURL=chunk-UAQQR55F.js.map