scip-query 0.22.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +500 -0
- package/README.md +13 -0
- package/dist/augment-vue-worker.js +1 -1
- package/dist/by-kind-H3P6BR5G.js +2 -0
- package/dist/call-graph-VTG2CUOQ.js +2 -0
- package/dist/call-graph-evidence-BociKRpF.d.ts +19 -0
- package/dist/chunk-2BMSSRBH.js +2 -0
- package/dist/{chunk-TAYD3AE7.js → chunk-2GJSD5GY.js} +2 -2
- package/dist/{chunk-TUQIPUDS.js → chunk-2M2LSIMY.js} +3 -3
- package/dist/{chunk-GIQ6CSL4.js → chunk-2N6WBNDC.js} +2 -2
- package/dist/{chunk-JHH5SCZ3.js → chunk-2OOY75BW.js} +2 -2
- package/dist/{chunk-EELPBR7E.js → chunk-2USA3S3P.js} +2 -2
- package/dist/chunk-2VAHDDLM.js +133 -0
- package/dist/chunk-2XWIUW5Z.js +455 -0
- package/dist/{chunk-57N6LN2A.js → chunk-3AF4TUFK.js} +2 -2
- package/dist/chunk-3D4BOXW6.js +20 -0
- package/dist/{chunk-FFJQZG6J.js → chunk-3LO4FST5.js} +2 -2
- package/dist/{chunk-HXOU4XNH.js → chunk-3WTY4LP2.js} +2 -2
- package/dist/{chunk-DPWKKNKI.js → chunk-3Z5AMSK6.js} +2 -2
- package/dist/{chunk-F24G5NBE.js → chunk-44IETFOU.js} +2 -2
- package/dist/chunk-4FR6GQIT.js +2 -0
- package/dist/chunk-4KBTHJLP.js +2 -0
- package/dist/chunk-5BIKR67W.js +2 -0
- package/dist/{chunk-DJAO2OZJ.js → chunk-5PROPLHI.js} +2 -2
- package/dist/chunk-5V7EPTII.js +2 -0
- package/dist/{chunk-VZ7NXSHV.js → chunk-62LPZCBQ.js} +2 -2
- package/dist/{chunk-LXQUF2RP.js → chunk-64O2JHQA.js} +2 -2
- package/dist/chunk-6D4F5VWG.js +10 -0
- package/dist/{chunk-NEIQPFBI.js → chunk-6ERFBC3X.js} +2 -2
- package/dist/{chunk-4HE7MVWD.js → chunk-6ILKOOGH.js} +2 -2
- package/dist/chunk-6MFXCMZC.js +2 -0
- package/dist/chunk-6O7FACKB.js +2 -0
- package/dist/{chunk-R6M456QG.js → chunk-6TS3KOXR.js} +2 -2
- package/dist/{chunk-7U2YQSDE.js → chunk-76QOU4PK.js} +2 -2
- package/dist/{chunk-25GWKRUZ.js → chunk-7DUI77BN.js} +2 -2
- package/dist/chunk-7F45LJKI.js +2 -0
- package/dist/{chunk-DEAB5TGT.js → chunk-7F7T6DCR.js} +2 -2
- package/dist/chunk-7H6VHWWJ.js +2 -0
- package/dist/chunk-7HXT6YLU.js +5 -0
- package/dist/{chunk-KZYID5KV.js → chunk-7R4V5ES6.js} +4 -4
- package/dist/chunk-7RIRIADH.js +7 -0
- package/dist/chunk-7ZLWLOGT.js +2 -0
- package/dist/{chunk-WHADK6OS.js → chunk-A4WEAK35.js} +2 -2
- package/dist/chunk-AADQLOQ4.js +38 -0
- package/dist/{chunk-XFMVKFSF.js → chunk-AN76MGUE.js} +2 -2
- package/dist/chunk-ANLNLY66.js +2 -0
- package/dist/chunk-ATXPTSEI.js +81 -0
- package/dist/{chunk-EELG7D3Q.js → chunk-AX7IDVFT.js} +2 -2
- package/dist/chunk-B3PYOSCX.js +2 -0
- package/dist/chunk-B7MPDEAK.js +3 -0
- package/dist/chunk-BBB5FBX4.js +2 -0
- package/dist/{chunk-Y2VM4CJC.js → chunk-BHKK5RJY.js} +2 -2
- package/dist/chunk-BJWFVAA5.js +2 -0
- package/dist/chunk-BKVWUP7Y.js +2 -0
- package/dist/{chunk-7XA3OM44.js → chunk-BKZYTLGE.js} +2 -2
- package/dist/chunk-BL6DCHQP.js +2 -0
- package/dist/chunk-BOW7SSQH.js +43 -0
- package/dist/{chunk-KQHJEU6V.js → chunk-C4RHHCKL.js} +2 -2
- package/dist/chunk-C7C6AKAT.js +117 -0
- package/dist/chunk-CD6M6LS2.js +16 -0
- package/dist/chunk-CFE6PSG6.js +2 -0
- package/dist/{chunk-GPGRZJ3R.js → chunk-CFNIGQMT.js} +2 -2
- package/dist/{chunk-K3XFWJI2.js → chunk-CKBUBRYD.js} +2 -2
- package/dist/chunk-CZW5MZ5B.js +2 -0
- package/dist/chunk-DBBZ63ZX.js +2 -0
- package/dist/chunk-DBN7DMJB.js +18 -0
- package/dist/{chunk-CKRWA452.js → chunk-DUULLZHZ.js} +2 -2
- package/dist/{chunk-6HRZQLOI.js → chunk-DV5Y5NOS.js} +2 -2
- package/dist/chunk-DZOIKCTM.js +3 -0
- package/dist/chunk-E4PKTOL3.js +2 -0
- package/dist/{chunk-GVOMSPGL.js → chunk-E65ELFKU.js} +2 -2
- package/dist/{chunk-VXJJTQYE.js → chunk-E7QR35ST.js} +2 -2
- package/dist/{chunk-2RE5OCHZ.js → chunk-EFSXAINW.js} +2 -2
- package/dist/{chunk-GY7CCCEZ.js → chunk-EHVEIEQN.js} +2 -2
- package/dist/{chunk-BVFYEEBH.js → chunk-EHYDXE3Z.js} +2 -2
- package/dist/{chunk-HISEUIL2.js → chunk-EP63Y6LD.js} +2 -2
- package/dist/chunk-EPX6NQN6.js +4 -0
- package/dist/chunk-ETC674NS.js +5 -0
- package/dist/{chunk-5H5WTJSD.js → chunk-F5GSBHC6.js} +2 -2
- package/dist/chunk-FH3DGXC6.js +2 -0
- package/dist/{chunk-2XCGSDIT.js → chunk-FI7VGOR4.js} +2 -2
- package/dist/chunk-FJF6VO2P.js +2 -0
- package/dist/{chunk-FELGD32K.js → chunk-FLMTCX5R.js} +2 -2
- package/dist/chunk-FVFDOIM3.js +2 -0
- package/dist/{chunk-AQ2PORIO.js → chunk-G2HU5WRN.js} +2 -2
- package/dist/{chunk-7YQOCABQ.js → chunk-G4ALYS4J.js} +2 -2
- package/dist/{chunk-SWK4XPUS.js → chunk-G56I7K4W.js} +2 -2
- package/dist/{chunk-JFQBRL3J.js → chunk-GC4DG2V5.js} +2 -2
- package/dist/chunk-GG45PK4S.js +4 -0
- package/dist/{chunk-XN22RGSR.js → chunk-GHNPACNP.js} +2 -2
- package/dist/{chunk-XU75YQN4.js → chunk-GINH3YQU.js} +2 -2
- package/dist/chunk-GTZZVLKJ.js +2 -0
- package/dist/chunk-GXXW5ZHH.js +2 -0
- package/dist/{chunk-RNKPYYYE.js → chunk-HAXXKRTD.js} +2 -2
- package/dist/chunk-HEZWBAZY.js +2 -0
- package/dist/chunk-HMEWLMML.js +2 -0
- package/dist/{chunk-2KVU55CW.js → chunk-HOBOVYPO.js} +2 -2
- package/dist/{chunk-2YC7YNKT.js → chunk-HRFQ6GW5.js} +2 -2
- package/dist/{chunk-RYOYJMGF.js → chunk-HX4X7KG3.js} +2 -2
- package/dist/{chunk-AZS7YPCB.js → chunk-HYT2R7LX.js} +2 -2
- package/dist/chunk-IKQVBVQL.js +40 -0
- package/dist/chunk-J6GLBBRK.js +4 -0
- package/dist/{chunk-TNG2FYS5.js → chunk-J7A4PWFX.js} +2 -2
- package/dist/chunk-JCSAZ35V.js +2 -0
- package/dist/{chunk-EWWY2ZFL.js → chunk-JDU2IV3A.js} +2 -2
- package/dist/{chunk-SB25YMEQ.js → chunk-JFMEXGFE.js} +2 -2
- package/dist/chunk-JFMI5SGB.js +4 -0
- package/dist/chunk-JJP37RGX.js +57 -0
- package/dist/chunk-JZ2A7LDM.js +5 -0
- package/dist/chunk-KNLQGXVH.js +80 -0
- package/dist/chunk-KVQCECPR.js +2 -0
- package/dist/{chunk-F24QUEQP.js → chunk-KXXORBZ2.js} +2 -2
- package/dist/{chunk-IKVNEGTW.js → chunk-L5KYH6U3.js} +2 -2
- package/dist/chunk-L6XHYJPZ.js +21 -0
- package/dist/chunk-L7KTFEAV.js +43 -0
- package/dist/{chunk-UAQ4T73O.js → chunk-LDXHR5EL.js} +2 -2
- package/dist/chunk-LEECKFCJ.js +2 -0
- package/dist/{chunk-LO5JSW2C.js → chunk-MHGDSBFX.js} +2 -2
- package/dist/{chunk-JUN5DOAK.js → chunk-MLQVVDG3.js} +2 -2
- package/dist/chunk-MOKUWRHO.js +3 -0
- package/dist/{chunk-44T4DUAA.js → chunk-MPYAPMNE.js} +2 -2
- package/dist/{chunk-ARVO6TTW.js → chunk-MV6SPXCR.js} +2 -2
- package/dist/{chunk-NRBNAECH.js → chunk-MWN53KRN.js} +2 -2
- package/dist/{chunk-TH6IC56G.js → chunk-MZPXPSUJ.js} +2 -2
- package/dist/{chunk-FBCVASUG.js → chunk-N55KIE46.js} +2 -2
- package/dist/{chunk-VMWUV6WB.js → chunk-NB4D3BNM.js} +2 -2
- package/dist/{chunk-JAT6C3VX.js → chunk-NGKBOT6G.js} +2 -2
- package/dist/{chunk-Q6T2CAJL.js → chunk-NJGKXKQF.js} +2 -2
- package/dist/chunk-NJQISBL4.js +8 -0
- package/dist/chunk-NJT3ZEKY.js +16 -0
- package/dist/{chunk-KFVSJX25.js → chunk-NKMKZP6A.js} +2 -2
- package/dist/chunk-NODFZ6ED.js +2 -0
- package/dist/{chunk-ERCYGVAM.js → chunk-NSM5IEVW.js} +2 -2
- package/dist/{chunk-YAGYMBEX.js → chunk-NTGUVNR2.js} +2 -2
- package/dist/{chunk-N7FP5H5U.js → chunk-NU3KFF2O.js} +8 -8
- package/dist/chunk-NWLVNU66.js +557 -0
- package/dist/{chunk-Q55NF3ZG.js → chunk-NYKZMCRC.js} +2 -2
- package/dist/{chunk-I6UTXNHU.js → chunk-O6BUXZEH.js} +2 -2
- package/dist/chunk-ODPDP7A4.js +3 -0
- package/dist/{chunk-ZAZGGSM3.js → chunk-OHIV323X.js} +2 -2
- package/dist/chunk-OIAPEKMT.js +3 -0
- package/dist/chunk-OIOC5EHF.js +3 -0
- package/dist/{chunk-YIHNPKWD.js → chunk-ONPPQM4G.js} +2 -2
- package/dist/{chunk-RHHCLWQ6.js → chunk-OUHEZBYI.js} +2 -2
- package/dist/{chunk-MSR2QRUE.js → chunk-OVGYW7UD.js} +2 -2
- package/dist/{chunk-OPSAW5DT.js → chunk-OYKU4B3Y.js} +2 -2
- package/dist/{chunk-5YRQIE2B.js → chunk-POBJ6FR2.js} +2 -2
- package/dist/{chunk-ZGW4HLPD.js → chunk-PSZPMMWN.js} +2 -2
- package/dist/chunk-PXTRBKRK.js +3 -0
- package/dist/{chunk-U2N2KE7A.js → chunk-Q5JRIHT3.js} +2 -2
- package/dist/{chunk-GRX7JOXQ.js → chunk-Q7ATHARX.js} +2 -2
- package/dist/{chunk-5ZMBRQFC.js → chunk-Q7CSKIDM.js} +2 -2
- package/dist/{chunk-HG722PO7.js → chunk-QBQE7ZJ5.js} +2 -2
- package/dist/{chunk-Z2PZVKPR.js → chunk-QH22UIXP.js} +2 -2
- package/dist/chunk-QXCKQTKR.js +60 -0
- package/dist/chunk-RBAD4GJ2.js +13 -0
- package/dist/chunk-RMDPFPNW.js +2 -0
- package/dist/chunk-ROPJDEJZ.js +4 -0
- package/dist/{chunk-56NQAEPJ.js → chunk-RVZC6TJE.js} +2 -2
- package/dist/{chunk-XJX6LGHL.js → chunk-S4QZBKSR.js} +2 -2
- package/dist/chunk-SCPMZ73U.js +2 -0
- package/dist/{chunk-7IQXARSQ.js → chunk-SIAP5RGI.js} +2 -2
- package/dist/{chunk-4TQU4TX2.js → chunk-SIX4RFR3.js} +2 -2
- package/dist/{chunk-AYPDH2LU.js → chunk-SKKXTABJ.js} +2 -2
- package/dist/{chunk-ZYM4HOFA.js → chunk-SSRFUQBD.js} +2 -2
- package/dist/chunk-SYVJEEUJ.js +3 -0
- package/dist/chunk-T3CZAZSI.js +8 -0
- package/dist/chunk-T3I6NHBH.js +2 -0
- package/dist/{chunk-GDRJB3SB.js → chunk-T6DWDI5E.js} +2 -2
- package/dist/chunk-T6HRIROJ.js +7 -0
- package/dist/{chunk-OTSPRVNW.js → chunk-TAA7HXHE.js} +2 -2
- package/dist/{chunk-IJMD6BRI.js → chunk-TJ2JQYT3.js} +2 -2
- package/dist/chunk-TULNMD5T.js +368 -0
- package/dist/chunk-U2FPY5XA.js +3 -0
- package/dist/chunk-U3SXIMII.js +38 -0
- package/dist/{chunk-ENWQWA2R.js → chunk-U6KCHXJ4.js} +2 -2
- package/dist/chunk-UH3XSKS5.js +9 -0
- package/dist/{chunk-UDY7MIAW.js → chunk-UIFUZVCC.js} +2 -2
- package/dist/{chunk-BDGTPN27.js → chunk-UXKURIVI.js} +2 -2
- package/dist/{chunk-FGNCOQUX.js → chunk-V2RBODHL.js} +2 -2
- package/dist/chunk-VBKUWB6N.js +2 -0
- package/dist/{chunk-PIFTZEEM.js → chunk-VBV6ALJE.js} +2 -2
- package/dist/{chunk-2OXVP5U5.js → chunk-VDGFWCQV.js} +2 -2
- package/dist/chunk-VDSDOEWF.js +2 -0
- package/dist/{chunk-C76O5MDS.js → chunk-VZPWVCLN.js} +2 -2
- package/dist/chunk-WDSFQDPN.js +2 -0
- package/dist/{chunk-BTVKZGWT.js → chunk-WFA35BGR.js} +2 -2
- package/dist/{chunk-H7CG6LOE.js → chunk-WLMP3OCW.js} +2 -2
- package/dist/{chunk-WOOAY3PA.js → chunk-WSA52GOR.js} +2 -2
- package/dist/chunk-WYPL7GF7.js +2 -0
- package/dist/{chunk-RDULNRSJ.js → chunk-X3YVZAKZ.js} +2 -2
- package/dist/chunk-X6OGVFIT.js +2 -0
- package/dist/{chunk-ISWFRGJ6.js → chunk-XKXTR6ZI.js} +2 -2
- package/dist/chunk-Y5DFAW5W.js +4 -0
- package/dist/chunk-YSYPDRD5.js +3 -0
- package/dist/chunk-ZFVPWH62.js +5 -0
- package/dist/chunk-ZGIHTH27.js +2 -0
- package/dist/{chunk-QKT4UI2Y.js → chunk-ZGIQN2SX.js} +2 -2
- package/dist/chunk-ZHG4WAHR.js +12 -0
- package/dist/{chunk-CLG6DWVS.js → chunk-ZKB2XUEN.js} +2 -2
- package/dist/chunk-ZLMXIQLC.js +21 -0
- package/dist/chunk-ZMCQIHI4.js +2 -0
- package/dist/cli-main.js +2 -2
- package/dist/code-TAVIKWJI.js +2 -0
- package/dist/code-result-json-5FEFQCAQ.js +2 -0
- package/dist/command-descriptors-7BKH53Y3.js +343 -0
- package/dist/dataflow-GFBTVDH3.js +2 -0
- package/dist/dependence-slice-GWGQCODG.js +2 -0
- package/dist/deps-4QHVDPYA.js +2 -0
- package/dist/direct-navigation-4UBC6HNW.js +3 -0
- package/dist/entry-map-QCTF4RVY.js +2 -0
- package/dist/files-M2UBF5HJ.js +2 -0
- package/dist/frontend-profile-roles-D7eCum8P.d.ts +10 -0
- package/dist/{health-CPp2Jf1Z.d.ts → health-BI2a9WPy.d.ts} +60 -2
- package/dist/hierarchy-2UIHRLW4.js +2 -0
- package/dist/imports-WIE3YZOB.js +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/members-YKD636DA.js +2 -0
- package/dist/methods-VDF4IMYG.js +2 -0
- package/dist/output-continuation-command-4UMDOOLO.js +3 -0
- package/dist/output-pagination-2GME6OPY.js +19 -0
- package/dist/postinstall.js +1 -1
- package/dist/project-reindex-XEQTRCV5.js +3 -0
- package/dist/queries/affected.js +1 -1
- package/dist/queries/anchors.d.ts +1 -1
- package/dist/queries/anchors.js +1 -1
- package/dist/queries/architecture.js +1 -1
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +2 -0
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.d.ts +20 -2
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/context.js +1 -1
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +2 -0
- package/dist/queries/dead.js +1 -1
- package/dist/queries/decorative-checkers.js +1 -1
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/dependence-slice.js +1 -1
- package/dist/queries/dependency-depth.js +1 -1
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-impact.d.ts +9 -0
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.js +1 -1
- package/dist/queries/duplicate-bodies.d.ts +28 -1
- package/dist/queries/duplicate-bodies.js +1 -1
- package/dist/queries/entry-map.d.ts +1 -1
- package/dist/queries/entry-map.js +1 -1
- package/dist/queries/evidence.js +1 -1
- package/dist/queries/extract-candidates.d.ts +50 -23
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.js +1 -1
- package/dist/queries/health.d.ts +1 -1
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +4 -3
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/locality-candidates.js +1 -1
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.js +1 -1
- package/dist/queries/not-implemented.js +1 -1
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +9 -1
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.d.ts +19 -3
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.d.ts +22 -3
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.d.ts +17 -3
- package/dist/queries/react-large-component-pressure.js +1 -1
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/reference-neighborhood.js +1 -1
- package/dist/queries/reference-reachability.js +1 -1
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.d.ts +7 -1
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.js +1 -1
- package/dist/queries/source-inspection.js +1 -1
- package/dist/queries/source-search.js +1 -1
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system-map.d.ts +1 -1
- package/dist/queries/system-map.js +1 -1
- package/dist/queries/system.js +1 -1
- package/dist/queries/test-quality.js +1 -1
- package/dist/queries/trace.js +1 -1
- package/dist/queries/twin-ab.js +1 -1
- package/dist/queries/twin-drift.d.ts +22 -6
- package/dist/queries/twin-drift.js +1 -1
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/value-flow.js +1 -1
- package/dist/queries/vue-component-duplicates.js +1 -1
- package/dist/queries/vue-composable-candidates.js +1 -1
- package/dist/queries/vue-large-view-pressure.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +16 -1
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/query-service-fastpath.js +5 -5
- package/dist/query-service-server.js +3 -3
- package/dist/refs-JNK5CLM7.js +2 -0
- package/dist/refs-pagination-6BLRYGMV.js +2 -0
- package/dist/reindex-worker.js +25 -25
- package/dist/reindex.d.ts +3 -2
- package/dist/reindex.js +35 -35
- package/dist/runtime.d.ts +34 -2
- package/dist/runtime.js +4 -4
- package/dist/rust-semantic-session-server.js +1 -1
- package/dist/rust-semantic-session-worker.js +1 -1
- package/dist/rust-semantic-worker.js +1 -1
- package/dist/{scip-cli-H-n59izO.d.ts → scip-cli-DOerTq-R.d.ts} +42 -4
- package/dist/slice-PHPVNCWX.js +2 -0
- package/dist/surface-MQX5MPIV.js +2 -0
- package/dist/symbol-resolution-DBLVXLBC.js +2 -0
- package/dist/system-JOPKV4OG.js +2 -0
- package/dist/trace-I2P2YFH4.js +2 -0
- package/dist/typescript-mailbox-worker.js +1 -1
- package/dist/value-flow-JJVMF7NP.js +2 -0
- package/dist/watch-server.js +3 -3
- package/docs/COMMAND_REFERENCE.md +2 -2
- package/docs/DETECTOR_GUIDE.md +51 -12
- package/docs/accuracy-audit-checklist.md +36 -13
- package/docs/locality-analyzer-design.md +9 -9
- package/package.json +2 -2
- package/skills/conductor/SKILL.md +110 -0
- package/skills/conductor/agents/openai.yaml +4 -0
- package/skills/principal-maintainability-review/SKILL.md +273 -0
- package/skills/principal-maintainability-review/agents/openai.yaml +4 -0
- package/skills/scip-calibrate/SKILL.md +102 -0
- package/skills/scip-calibrate/agents/openai.yaml +4 -0
- package/skills/scip-claim-audit/SKILL.md +113 -0
- package/skills/scip-claim-audit/agents/openai.yaml +4 -0
- package/skills/scip-probe-reachability/SKILL.md +93 -0
- package/skills/scip-probe-reachability/agents/openai.yaml +4 -0
- package/skills/scip-root-cause/SKILL.md +160 -0
- package/skills/scip-root-cause/agents/openai.yaml +4 -0
- package/skills/scip-system-compression/SKILL.md +252 -0
- package/skills/scip-system-compression/agents/openai.yaml +4 -0
- package/skills/scip-system-compression/references/compression-atlas.md +116 -0
- package/skills/scip-system-compression/references/compression-patterns.md +87 -0
- package/skills/scip-twin-drift/SKILL.md +109 -0
- package/skills/scip-twin-drift/agents/openai.yaml +4 -0
- package/dist/by-kind-4IYG2SKW.js +0 -2
- package/dist/call-graph-WQNXMNNN.js +0 -2
- package/dist/call-graph-evidence-lZa2dwQA.d.ts +0 -11
- package/dist/chunk-2BTJALUS.js +0 -454
- package/dist/chunk-3QXC54FQ.js +0 -3
- package/dist/chunk-3TJY6M3B.js +0 -7
- package/dist/chunk-42W3LFUK.js +0 -13
- package/dist/chunk-4GAQ6FI4.js +0 -43
- package/dist/chunk-6NC3YSPY.js +0 -38
- package/dist/chunk-6VEFRPTD.js +0 -5
- package/dist/chunk-7C26EKLZ.js +0 -4
- package/dist/chunk-7JYHQAH2.js +0 -22
- package/dist/chunk-7KSO2OAP.js +0 -2
- package/dist/chunk-7XZGZBSQ.js +0 -2
- package/dist/chunk-A77SCPW2.js +0 -3
- package/dist/chunk-AK3PYTIK.js +0 -5
- package/dist/chunk-AMIMMNA4.js +0 -11
- package/dist/chunk-AUY5BL74.js +0 -2
- package/dist/chunk-BDHFVH2M.js +0 -18
- package/dist/chunk-BECZLYNU.js +0 -8
- package/dist/chunk-BUTEIZKP.js +0 -10
- package/dist/chunk-BWVQP3LB.js +0 -38
- package/dist/chunk-BYDAFMSR.js +0 -57
- package/dist/chunk-BZYSGZRK.js +0 -2
- package/dist/chunk-C7IJMOFP.js +0 -134
- package/dist/chunk-CBBHFNLX.js +0 -2
- package/dist/chunk-D2MVJSP4.js +0 -21
- package/dist/chunk-D35XIZGN.js +0 -2
- package/dist/chunk-DKM723YF.js +0 -79
- package/dist/chunk-DRENNWRG.js +0 -2
- package/dist/chunk-E44IVWIJ.js +0 -367
- package/dist/chunk-EDMB6SSO.js +0 -7
- package/dist/chunk-EETGXQY7.js +0 -3
- package/dist/chunk-FKGQOTKD.js +0 -2
- package/dist/chunk-GH5YSGZL.js +0 -5
- package/dist/chunk-GQIDEID3.js +0 -2
- package/dist/chunk-HCVJR2V4.js +0 -3
- package/dist/chunk-IMKZEXZG.js +0 -2
- package/dist/chunk-ISIQLPJ2.js +0 -61
- package/dist/chunk-IXESDH3J.js +0 -2
- package/dist/chunk-JJ62MTQH.js +0 -40
- package/dist/chunk-JT6XX7QY.js +0 -8
- package/dist/chunk-KFOYCQAJ.js +0 -9
- package/dist/chunk-LRI5OMPE.js +0 -2
- package/dist/chunk-MHIEP7EG.js +0 -4
- package/dist/chunk-NK3JMP22.js +0 -2
- package/dist/chunk-NVSZNESQ.js +0 -2
- package/dist/chunk-OJNK5ALA.js +0 -2
- package/dist/chunk-OXYAWIEA.js +0 -2
- package/dist/chunk-OZETODHH.js +0 -2
- package/dist/chunk-PBUH2P5S.js +0 -3
- package/dist/chunk-PLJUQFQN.js +0 -2
- package/dist/chunk-PLYUVM4F.js +0 -2
- package/dist/chunk-PXXYQK55.js +0 -2
- package/dist/chunk-Q5TA4OY4.js +0 -20
- package/dist/chunk-Q7GBK5T7.js +0 -81
- package/dist/chunk-QLBSG7U5.js +0 -3
- package/dist/chunk-QWKHW6VZ.js +0 -2
- package/dist/chunk-RPL3ARU7.js +0 -16
- package/dist/chunk-SVHTMVA4.js +0 -4
- package/dist/chunk-T6QD2ZQB.js +0 -43
- package/dist/chunk-TD7VKJ2Y.js +0 -117
- package/dist/chunk-TKDNDQA7.js +0 -3
- package/dist/chunk-TQZV7KV4.js +0 -2
- package/dist/chunk-TUSPIVZ3.js +0 -4
- package/dist/chunk-URSGGIZX.js +0 -2
- package/dist/chunk-UT7TADJX.js +0 -2
- package/dist/chunk-V4NG5OMS.js +0 -554
- package/dist/chunk-VTCIYFEK.js +0 -2
- package/dist/chunk-VU6LIWHT.js +0 -2
- package/dist/chunk-VUSKPCUB.js +0 -2
- package/dist/chunk-WN3TCGJ4.js +0 -2
- package/dist/chunk-WSLEJSFR.js +0 -2
- package/dist/chunk-WYZIHUPZ.js +0 -16
- package/dist/chunk-XE33FV5W.js +0 -2
- package/dist/chunk-XGGBK66W.js +0 -4
- package/dist/chunk-XSWYJCAK.js +0 -2
- package/dist/chunk-Y334QQU5.js +0 -3
- package/dist/chunk-Z2AWCTN6.js +0 -2
- package/dist/chunk-ZOXKSQQB.js +0 -2
- package/dist/chunk-ZPASRBLF.js +0 -2
- package/dist/chunk-ZZ3Z7D56.js +0 -2
- package/dist/code-EQJFDT6I.js +0 -2
- package/dist/code-result-json-7UWIWBOO.js +0 -2
- package/dist/command-descriptors-ORNTVNYV.js +0 -342
- package/dist/dataflow-6VL54GX5.js +0 -2
- package/dist/dependence-slice-DT2NUHD2.js +0 -2
- package/dist/deps-DB7H5IKC.js +0 -2
- package/dist/direct-navigation-O3LUAYWQ.js +0 -3
- package/dist/entry-map-6K62RV3D.js +0 -2
- package/dist/files-MSLD7MO6.js +0 -2
- package/dist/hierarchy-IVBXAKFA.js +0 -2
- package/dist/imports-FRAVZ3Y2.js +0 -2
- package/dist/members-KJOJDYGO.js +0 -2
- package/dist/methods-2AYABBT3.js +0 -2
- package/dist/output-continuation-command-JHMPH6NC.js +0 -3
- package/dist/output-pagination-3OFL2MJV.js +0 -19
- package/dist/project-reindex-HYO4WD7Z.js +0 -3
- package/dist/refs-ARMA6XUJ.js +0 -2
- package/dist/refs-pagination-VUGIWN6U.js +0 -2
- package/dist/slice-YOB5YFAM.js +0 -2
- package/dist/surface-VY5EFWTW.js +0 -2
- package/dist/symbol-resolution-DGQN4XIV.js +0 -2
- package/dist/system-2KQ3QD2P.js +0 -2
- package/dist/trace-HTIPTXAE.js +0 -2
- package/dist/value-flow-5FV3VQI7.js +0 -2
package/dist/chunk-MHIEP7EG.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{b as ye}from"./chunk-Q6T2CAJL.js";import{i as I,m as W}from"./chunk-42W3LFUK.js";import{C as O}from"./chunk-7JYHQAH2.js";import{B as pe,E as G,e as me}from"./chunk-Q7GBK5T7.js";var Pe=12,Te=20,re=200,oe=800,Ae=.9,Oe=64,De=me("behavior-construct-ranges"),Se={if_statement:"branch",conditional_expression:"branch",ternary_expression:"branch",switch_statement:"branch",switch_expression:"branch",switch_case:"branch",case_statement:"branch",match_statement:"branch",match_expression:"branch",match_arm:"branch",for_statement:"loop",for_in_statement:"loop",for_of_statement:"loop",while_statement:"loop",do_statement:"loop",await_expression:"await",return_statement:"return",throw_statement:"throw",raise_statement:"throw",assignment_expression:"mutation",augmented_assignment_expression:"mutation",assignment:"mutation",pair:"shape",field_initializer:"shape",spread_element:"spread",dictionary_splat:"spread",catch_clause:"catch",except_clause:"catch",finally_clause:"finally"},Z=["anchor","signature","binding","branch","loop","call","await","return","throw","mutation","shape","spread","catch","finally"],ge=[...Z,"lifecycle"],Ce=["loop","await","throw","mutation","spread","catch","finally","lifecycle"],Ie=new Set(["onBeforeMount","onBeforeUnmount","onMounted","onUnmounted","useEffect","useInsertionEffect","useLayoutEffect"]);var _e=new Set(["object","object_pattern","dictionary","field_declaration_list","struct_expression","struct_pattern"]);function mt(e,n,t,o,r=[],s={}){let a=O(e,n);if(!a)return null;let h=G(e,n),c=Ne(e,n,t,o,r),l=te(e,n,c.startLine,c.endLine),u=l?.startLine??t,p=l?.endLine??o,N=(l?D(a.rootNode,c.startLine,c.endLine):null)??I(a.rootNode,u,p);if(!N)return null;let b=Le(N,h,u,p,r);if(!b||b.lines.length===0||b.lines.some(S=>S.text.length>oe))return null;let m=tt(h,u,p),C=nt(b);if((s.requireSavings??!0)&&C>=m*Ae)return null;let v=Z.filter(S=>b.lines.some(x=>x.signals.includes(S)));return{...l?{callable:{name:l.name,startLine:l.startLine,endLine:l.endLine}}:{},representation:"outline",constructKind:b.constructKind,signature:b.signature,lines:b.lines,signals:v,testCases:ye(n)==="test"?st(h,u,p):[],coverage:{sourceStatements:b.sourceStatements,representedStatements:b.sourceStatements,copiedStatements:b.copiedStatements,omittedStatements:0},rawCharacters:m,outlineCharacters:C,candidateLines:b.sourceStatements,omittedLines:0}}function pt(e,n,t,o,r){if(r.length===0)return[];let s=O(e,n);if(!s)return[];let a=G(e,n),h=Ne(e,n,t,o,r),c=te(e,n,h.startLine,h.endLine),l=c?.startLine??t,u=c?.endLine??o,p=(c?D(s.rootNode,h.startLine,h.endLine):null)??I(s.rootNode,l,u);if(!p)return[];let N=Le(p,a,l,u,r);return N?N.lines.filter(b=>b.text.length<=oe&&b.signals.some(m=>["branch","loop","catch","finally"].includes(m))&&r.some(m=>m>=b.line&&m<=b.endLine)):[]}function yt(e,n,t,o){let r=O(e,n);if(!r)return null;let s=D(r.rootNode,t,o)??I(r.rootNode,t,o);if(!s)return null;let a=[],h=ae(s),c=[];return se(s,s,l=>{if(k.has(l.type)||ke.has(l.type)){$e(a,c,l);return}if(ee.has(l.type)){qe(a,c,l);return}if(z.has(l.type)){ze(a,c,l);return}j.has(l.type)&&je(a,l)}),{facts:Ue(a),terminals:we(h),unsupported:c}}function Ne(e,n,t,o,r=[]){let s=r.filter(u=>u>=t&&u<=o),a=De.get(e,n,pe(e,n)??"",()=>new Map),h=`${t}:${o}:${s.join(",")}`,c=a.get(h);if(c)return a.delete(h),a.set(h,c),{startLine:c[0],endLine:c[1]};let l=Me(e,n,t,o,s);if(a.set(h,[l.startLine,l.endLine]),a.size>Oe){let u=a.keys().next().value;u!==void 0&&a.delete(u)}return l}function Me(e,n,t,o,r){let s=O(e,n),a=[];if(r.length>0&&s){let u=[],p=r[0],N=p;for(let m of r)p=Math.min(p,m),N=Math.max(N,m);Ee(s.rootNode,p,N,m=>{Ve(m)&&m.startPosition.row>=t&&m.endPosition.row<=o&&r.every(C=>m.startPosition.row<=C&&m.endPosition.row>=C)&&u.push(m),P.has(m.type)&&m.startPosition.row>=t&&m.endPosition.row<=o&&r.every(C=>m.startPosition.row<=C&&m.endPosition.row>=C)&&a.push(m)});let b=u.sort((m,C)=>m.endPosition.row-m.startPosition.row-(C.endPosition.row-C.startPosition.row)||m.startPosition.row-C.startPosition.row)[0];if(b)return{startLine:b.startPosition.row,endLine:b.endPosition.row}}let h=te(e,n,t,o);if(h)return{startLine:h.startLine,endLine:h.endLine};if(r.length===0)return{startLine:t,endLine:o};let c=(W(e,n)?.callables??[]).filter(u=>u.startLine>=t&&u.endLine<=o&&r.every(p=>u.startLine<=p&&u.endLine>=p)).sort((u,p)=>u.endLine-u.startLine-(p.endLine-p.startLine)||u.startLine-p.startLine)[0];if(!s)return c?{startLine:c.startLine,endLine:c.endLine}:{startLine:t,endLine:o};let l=a.sort((u,p)=>u.endPosition.row-u.startPosition.row-(p.endPosition.row-p.startPosition.row)||u.startPosition.row-p.startPosition.row)[0];return l?{startLine:l.startPosition.row,endLine:l.endPosition.row}:c?{startLine:c.startLine,endLine:c.endLine}:{startLine:t,endLine:o}}function bt(e,n,t,o,r={}){if(o-t+1<(r.minimumBodyLines??Te))return null;let a=Re(e,n,t,o,[],!1);if(!a)return null;let h=a.candidates.map(S=>({...S,signals:S.signals.filter(x=>x!=="anchor"&&x!=="signature")})).filter(S=>S.signals.length>0);if(h.length===0)return null;let c=it(h),l=h.filter(S=>S.text.length<=re);if(l.length===0)return null;let u=Ce.filter(S=>(c[S]??0)>0),p=u.filter(S=>S!=="await"),N=a.shapes.reduce((S,x)=>S+x.fields.length,0);if(p.length===0&&!((c.await??0)>0&&N>0)&&N<3)return null;let b=at(l,c),m=new Map;for(let S of u){let x=b.find(f=>f.signals.includes(S));x&&m.set(x.line,x)}if(m.size===0){let S=b.find(x=>x.signals.includes("branch"));S&&m.set(S.line,S)}let C=Math.min(10,Math.max(1,r.maxLines??m.size)),v=new Map;for(let S of m.values()){if(v.size>=C)break;v.set(S.line,S)}return v.size>=h.length&&a.shapes.length===0?null:{owner:a.callable?.name??null,startLine:t,endLine:o,lines:[...v.values()].sort((S,x)=>S.line-x.line),shapes:a.shapes,signalCounts:c,candidateLines:h.length,omittedLines:h.length-v.size}}function St(e,n,t,o){let r=Re(e,n,t,o,[],!1);return r?new Map(r.candidates.map(s=>[s.line,s.signals.filter(a=>a!=="lifecycle")])):new Map}var P=new Set(["arrow_function","constructor_declaration","function_declaration","function_definition","function_expression","generator_function","generator_function_declaration","function_item","lambda","lambda_expression","method","method_declaration","method_definition"]),B=new Set(["block","body","compound_statement","declaration_list","statement_block"]),k=new Set(["if_expression","if_statement","unless","unless_statement"]),ke=new Set(["conditional_expression","ternary_expression"]),ee=new Set(["do_statement","enhanced_for_statement","for_expression","for_in_statement","for_of_statement","for_statement","loop_expression","while_statement"]),z=new Set(["match_expression","match_statement","switch_expression","switch_statement"]),ve=new Set(["case_statement","match_arm","switch_case","switch_default"]),j=new Set(["try_expression","try_statement"]),X=new Set(["catch_clause","except_clause","rescue"]),$=new Set(["ensure","finally_clause"]),Y=new Set(["else","else_clause"]),xe=new Set(["raise_statement","return_statement","throw_statement"]),Ye=new Set(["block_comment","comment","line_comment"]);function $e(e,n,t){let o=t.childForFieldName("condition")??le(t),r=t.childForFieldName("consequence")??t.childForFieldName("body")??t.namedChildren.find(c=>B.has(c.type)),s=t.childForFieldName("alternative")??t.namedChildren.find(c=>Y.has(c.type));if(!o||!r){n.push(ce(t,"conditional-fields-unresolved"));return}let a=F(o,"predicate",o.text),h=F(r,be(r),"consequence");if(E(e,a,h,"predicate-consequence",{branchRole:"consequence"}),J(e,a,r,"consequence"),s){let c=F(s,be(s),"alternative");E(e,a,c,"predicate-alternative",{branchRole:"alternative"}),J(e,a,s,"alternative");return}E(e,a,ie(a,"otherwise continue"),"predicate-fallthrough",{branchRole:"fallthrough"})}function qe(e,n,t){let o=t.childForFieldName("body")??t.namedChildren.find(a=>B.has(a.type));if(!o){n.push(ce(t,"loop-body-unresolved"));return}let r=t.childForFieldName("condition"),s=F(r??t,"predicate",r?.text??R(t,o));E(e,s,F(o,"outcome","iteration"),"loop-iteration",{branchRole:"iteration"}),J(e,s,o,"iteration"),E(e,s,ie(s,"loop exits"),"loop-exit",{branchRole:"exit"})}function ze(e,n,t){let o=t.childForFieldName("body")??t.namedChildren.find(c=>B.has(c.type)),r=t.childForFieldName("value")??t.childForFieldName("condition")??t.childForFieldName("subject")??le(t),s=Ke(o??t);if(!r||s.length===0){n.push(ce(t,"switch-cases-unresolved"));return}let a=F(r,"predicate",r.text),h=!1;for(let c of s){let l=We(c);h||=l;let u=R(c,c.namedChildren.find(p=>Q(p)));E(e,a,F(c,"outcome",u||(l?"default":"case")),l?"predicate-default":"predicate-case",{branchRole:l?"default":"case"}),J(e,a,c,l?"default":"case")}h||E(e,a,ie(a,"no case matched"),"predicate-fallthrough",{branchRole:"fallthrough"})}function je(e,n){let t=F(n,"scope","try");for(let o of Ge(n)){let r=$.has(o.type),s=F(o,"handler",r?"finally":R(o,U(o)));E(e,t,s,r?"finally-cleanup":"exception-handler",{branchRole:r?"finally":"catch"}),He(e,s,o,r?"finally":"catch")}}function He(e,n,t,o){for(let r of ae(t)){let s=r.label.startsWith("throw")||r.label.startsWith("raise")?"throw":"return";E(e,n,r,s==="throw"?"handler-throw":"handler-return",{branchRole:o,terminalKind:s})}}function J(e,n,t,o){for(let r of ae(t)){let s=r.label.startsWith("throw")||r.label.startsWith("raise")?"throw":"return";E(e,n,r,s==="throw"?"predicate-throw":"predicate-return",{branchRole:o,terminalKind:s})}}function E(e,n,t,o,r){e.push({controller:n,outcome:t,subtype:o,attributes:r})}function F(e,n,t){return{kind:n,label:q(t).slice(0,oe),startLine:e.startPosition.row,endLine:e.endPosition.row,implicit:!1}}function ie(e,n){return{...e,kind:"outcome",label:n,implicit:!0}}function be(e){return xe.has(e.type)?"terminal":"outcome"}function ae(e){let n=[];return se(e,e,t=>{xe.has(t.type)&&n.push(F(t,"terminal",t.text))}),we(n)}function se(e,n,t){t(n);for(let o of n.namedChildren)o!==e&&P.has(o.type)||se(e,o,t)}function Ke(e){let n=[],t=o=>{for(let r of o.namedChildren)z.has(r.type)||(ve.has(r.type)?n.push(r):t(r))};return t(e),n}function Ge(e){let n=[],t=o=>{for(let r of o.namedChildren)j.has(r.type)||(X.has(r.type)||$.has(r.type)?n.push(r):P.has(r.type)||t(r))};return t(e),n}function We(e){let n=R(e,e.namedChildren.find(t=>Q(t))).trim();return e.type==="switch_default"||/^(?:default\b|_\s*=>)/u.test(n)}function ce(e,n){return{startLine:e.startPosition.row,endLine:e.endPosition.row,reason:n}}function Ue(e){let n=new Map;for(let t of e)n.set(`${t.controller.startLine}\0${t.controller.endLine}\0${t.outcome.startLine}\0${t.outcome.endLine}\0${t.subtype}\0${t.outcome.label}`,t);return[...n.values()]}function we(e){let n=new Map;for(let t of e)n.set(`${t.startLine}\0${t.endLine}\0${t.kind}\0${t.label}`,t);return[...n.values()]}function Ve(e){return P.has(e.type)||ee.has(e.type)||z.has(e.type)||j.has(e.type)||X.has(e.type)||$.has(e.type)}function Le(e,n,t,o,r){let a=D(e,t,o)??e,h=U(a),c=[],l=0,u=0,p=(i,d,y,g,w=!1,A=!0)=>{let K=w?y.trim():q(y);if(!K)return;let T=Math.max(t,i.startPosition.row),de=Math.min(o,i.endPosition.row);c.push({line:T,endLine:Math.max(T,de),depth:d,signals:Z.filter(he=>g.includes(he)||he==="anchor"&&r.some(fe=>fe>=T&&fe<=de)),text:K,copied:w}),A&&(l+=1,w&&(u+=1))},N=(i,d)=>{for(let y of i.namedChildren)_(y,d)},b=(i,d)=>{if(k.has(i.type)){m(i,d,"else if");return}if(Y.has(i.type)){let y=i.namedChildren.find(w=>k.has(w.type));if(y){m(y,d,"else if");return}p(i,d,"else",["branch"],!1,!1);let g=U(i)??i.namedChildren.find(w=>B.has(w.type));if(g)_(g,d+1);else for(let w of i.namedChildren)_(w,d+1);return}p(i,d,"else",["branch"],!1,!1),_(i,d+1)},m=(i,d,y=i.type.startsWith("unless")?"unless":"if")=>{let g=i.childForFieldName("condition")??le(i),w=i.childForFieldName("consequence")??i.childForFieldName("body")??i.namedChildren.find(T=>B.has(T.type)),A=i.childForFieldName("alternative")??i.namedChildren.find(T=>Y.has(T.type)),K=g?g.text:R(i,w);p(i,d,`${y} ${Ze(K)}`,M(g,["branch"])),w&&_(w,d+1),A&&b(A,d)},C=(i,d)=>{let y=i.childForFieldName("body")??i.namedChildren.find(g=>B.has(g.type));p(i,d,R(i,y),M(i,["loop"])),y&&_(y,d+1)},v=(i,d)=>{let y=i.childForFieldName("body")??i.namedChildren.find(g=>B.has(g.type));p(i,d,R(i,y),M(i,["branch"])),y&&_(y,d+1)},S=(i,d)=>{let y=i.namedChildren.find(g=>Q(g));p(i,d,R(i,y),["branch"],!1,!1);for(let g of i.namedChildren)(g===y||Q(g))&&_(g,d+1)},x=(i,d)=>{p(i,d,"try",[],!1);for(let y of i.namedChildren)B.has(y.type)?_(y,d+1):(X.has(y.type)||$.has(y.type))&&_(y,d)},f=(i,d,y)=>{let g=i.childForFieldName("body")??i.namedChildren.find(A=>B.has(A.type)),w=y==="finally"?"finally":R(i,g);p(i,d,w,[y],!1,!1),g&&_(g,d+1)},L=(i,d)=>{let y=U(i);p(i,d,R(i,y),M(i,["binding"])),y&&_(y,d+1)},_=(i,d)=>{if(i.startPosition.row>o||i.endPosition.row<t||Ye.has(i.type)||i.type==="empty_statement")return;if(B.has(i.type)){N(i,d);return}if(k.has(i.type)){m(i,d);return}if(ee.has(i.type)){C(i,d);return}if(z.has(i.type)){v(i,d);return}if(ve.has(i.type)){S(i,d);return}if(j.has(i.type)){x(i,d);return}if(X.has(i.type)){f(i,d,"catch");return}if($.has(i.type)){f(i,d,"finally");return}if(Y.has(i.type)){b(i,d);return}if(P.has(i.type)){L(i,d);return}let g=!Be(i)||et(i);p(i,d,i.text,M(i),g)};return _(h&&h!==a?h:a,0),l===0?null:{constructKind:Qe(a),signature:Je(a,h,n,t),lines:c,sourceStatements:l,copiedStatements:u}}function D(e,n,t){let o=e.namedChildren.filter(r=>r.startPosition.row<=n&&r.endPosition.row>=t);for(let r of o.sort(Xe)){let s=D(r,n,t);if(s)return s}return P.has(e.type)&&e.startPosition.row<=n&&e.endPosition.row>=t?e:null}function Xe(e,n){return e.endPosition.row-e.startPosition.row-(n.endPosition.row-n.startPosition.row)||e.startPosition.row-n.startPosition.row}function U(e){return e.childForFieldName("body")??e.childForFieldName("consequence")??e.namedChildren.find(n=>B.has(n.type))??null}function Je(e,n,t,o){let r=R(e,n);return r||(t[o]??e.text).trim()}function Qe(e){return e.type.includes("constructor")?"constructor":e.type.includes("method")||e.type==="method"?ne(e,new Set(["class_body","class_declaration","class_definition"]))?"class method":"object method":e.type==="arrow_function"||e.type==="function_expression"||e.type==="lambda"?ne(e,new Set(["object","pair"]))?"object member":"function value":e.type.includes("function")?ne(e,P)?"nested function":"module function":"source construct"}function ne(e,n){let t=e.parent;for(;t;){if(n.has(t.type))return!0;t=t.parent}return!1}function le(e){return e.namedChildren.find(n=>!B.has(n.type)&&!Y.has(n.type))??null}function R(e,n){if(!n)return q(e.text);let t=Math.max(0,n.startIndex-e.startIndex);return q(e.text.slice(0,t)).replace(/[:{]\s*$/u,"").trim()}function Ze(e){let n=q(e);return n.startsWith("(")&&n.endsWith(")")?n.slice(1,-1).trim():n}function q(e){return e.trim().replace(/\r?\n[\t ]*/gu," ")}function M(e,n=[]){let t=new Set(n);return e&&H(e,o=>{let r=Se[o.type];r&&t.add(r),o.type==="call_expression"&&(t.add("call"),Fe(o)&&t.add("shape")),ue.has(o.type)&&t.add("binding")}),Z.filter(o=>t.has(o))}function et(e){let n=!1;return H(e,t=>{n||!t.text.includes(`
|
|
2
|
-
`)||/(?:string|template|heredoc|raw_string)/u.test(t.type)&&(n=!0)}),n}function Q(e){return B.has(e.type)||k.has(e.type)||ee.has(e.type)||z.has(e.type)||j.has(e.type)||P.has(e.type)||Be(e)}function Be(e){return/(?:statement|declaration|expression|assignment|return|throw|raise|break|continue|yield|with_item)$/u.test(e.type)||ue.has(e.type)}function tt(e,n,t){let o=0;for(let r=n;r<=t;r+=1)o+=(e[r]?.length??0)+10;return o}function nt(e){return e.constructKind.length+e.signature.length+80+e.lines.reduce((n,t)=>n+t.text.length+t.depth*2+10,0)}function Re(e,n,t,o,r,s){let a=O(e,n);if(!a)return null;let h=G(e,n),c=te(e,n,t,o),l=s?c?.startLine??t:t,u=s?c?.endLine??o:o,N=(c?.startLine===l&&c.endLine===u?D(a.rootNode,l,u):null)??I(a.rootNode,l,u);if(!N)return null;let b=new Map,m=new Map,C=new Map,v=(f,L)=>{if(f<l||f>u)return;let _=b.get(f)??new Set;_.add(L),b.set(f,_)};c&&v(c.startLine,"signature");for(let f of r)v(f,"anchor");H(N,f=>{let L=Se[f.type];if(L&&v(f.startPosition.row,L),L==="shape"&&rt(m,f,N,l,u),f.type==="call_expression"){let i=(f.childForFieldName("function")??f.namedChild(0))?.text.split(".").at(-1);if(Fe(f)){v(f.startPosition.row,"shape");let d=V(f.text);d.length<=re&&C.set(f.startPosition.row,d)}if(i&&Ie.has(i)){v(f.startPosition.row,"lifecycle");let d=V(f.text);d.length<=re&&C.set(f.startPosition.row,d)}}ue.has(f.type)&&v(f.startPosition.row,"binding")});let S=W(e,n);for(let f of S?.callSites??[])f.line<l||f.line>u||(v(f.line,"call"),f.calleeLeaf==="catch"&&v(f.line,"catch"));let x=[...b.entries()].sort(([f],[L])=>f-L).map(([f,L])=>({line:f,signals:ge.filter(_=>L.has(_)),text:C.get(f)??V(h[f]??"")})).filter(f=>f.text.length>0||f.signals.includes("anchor"));return{...c?{callable:c}:{},rangeStart:l,rangeEnd:u,sourceLines:h,candidates:x,shapes:[...m.values()].sort((f,L)=>f.startLine-L.startLine)}}function rt(e,n,t,o,r){if(n.startPosition.row<o||n.endPosition.row>r)return;let s=n.childForFieldName("key")??n.childForFieldName("name")??n.namedChild(0),a=V(s?.text??"");if(!a||a.includes(`
|
|
3
|
-
`)||a.length>60)return;let h=ot(n,t);if(h.startPosition.row<o||h.endPosition.row>r)return;let c=`${h.startPosition.row}:${h.endPosition.row}`,l=e.get(c)??{startLine:h.startPosition.row,endLine:h.endPosition.row,fields:[]};l.fields.some(u=>u.name===a&&u.line===n.startPosition.row)||l.fields.push({name:a,line:n.startPosition.row}),e.set(c,l)}function ot(e,n){let t=e.parent;for(;t&&t!==n.parent;){if(_e.has(t.type))return t;if(t===n)break;t=t.parent}return e.parent??e}function te(e,n,t,o){return W(e,n)?.callables.filter(r=>r.startLine<=t&&r.endLine>=o).sort((r,s)=>r.endLine-r.startLine-(s.endLine-s.startLine)||r.startLine-s.startLine)[0]}function H(e,n){n(e);for(let t of e.namedChildren)H(t,n)}function Ee(e,n,t,o){o(e);for(let r of e.namedChildren)r.startPosition.row>n||r.endPosition.row<t||Ee(r,n,t,o)}function V(e){return e.trim().replace(/\s+/gu," ")}function Fe(e){if(e.type!=="call_expression")return!1;let n=e.childForFieldName("arguments")??e.namedChildren.find(o=>o.type==="arguments"||o.type==="argument_list");if(!n)return!1;let t=!1;return H(n,o=>{_e.has(o.type)&&(t=!0)}),t}function it(e){let n={};for(let t of ge){let o=e.filter(r=>r.signals.includes(t)).length;o>0&&(n[t]=o)}return n}function at(e,n){let t=new Map;for(let s of e){let a=s.signals.join(",");t.set(a,(t.get(a)??0)+1)}let o=new Set(Ce),r=s=>{let a=t.get(s.signals.join(","))??1,h=Math.min(...s.signals.map(u=>n[u]??1)),c=s.signals.some(u=>o.has(u))?3:1,l=Math.max(0,s.signals.length-1)*1e3;return c*(1e3/a+1e3/h)+l};return[...e].sort((s,a)=>r(a)-r(s)||a.line-s.line)}var ue=new Set(["lexical_declaration","variable_declarator","const_item","static_item","let_declaration","assignment"]);function st(e,n,t){let o=[],r=/\b(?:describe|it|test)(?:\.(?:only|skip|todo))?\s*\(\s*(['"`])([^'"`]+)\1/u;for(let s=n;s<=t;s+=1){let a=r.exec(e[s]??"")?.[2];if(!(!a||o.includes(a))&&(o.push(a),o.length>=Pe))break}return o}export{mt as a,pt as b,yt as c,Ne as d,bt as e,St as f};
|
|
4
|
-
//# sourceMappingURL=chunk-MHIEP7EG.js.map
|
package/dist/chunk-NK3JMP22.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as D}from"./chunk-JFQBRL3J.js";import{d as H,e as J,f as ee,m as Z}from"./chunk-AYPDH2LU.js";import{c as Y,t as T,u as U}from"./chunk-TD7VKJ2Y.js";import{f as R,h as E,m as z,q as N,s as j,x as A}from"./chunk-42W3LFUK.js";import{C as w}from"./chunk-7JYHQAH2.js";import{B as X}from"./chunk-Q7GBK5T7.js";import{E as G,H as K,d as M}from"./chunk-GH5YSGZL.js";var te=new WeakMap,ne=new WeakMap,re=new WeakMap,ie=new WeakMap,ae=new WeakMap;function qe(t,e){let n=ne.get(t);n||(n=new Map,ne.set(t,n));let r=n.get(e);if(r)return r;let i=w(t,e)?.rootNode;if(!i)return n.set(e,[]),[];let o=new Set;I(i,c=>{if(c.type!=="call_expression")return;let p=c.childForFieldName("function")??c.namedChild(0),s=/^([A-Za-z_$][\w$]*(?:\.Service)?)\.of$/u.exec(p?.text.replace(/\s+/gu,"")??"");s&&o.add(s[1])});let m=A(t,e).filter(c=>!!c.sourcePath),u=new Set;for(let c of o){let p=/^([A-Za-z_$][\w$]*)\.Service$/u.exec(c);if(p){for(let s of m)s.localName===p[1]&&u.add(s.sourcePath);continue}if(c==="Service"){T(t,e).some(s=>s.leaf==="Service")&&u.add(e);for(let s of m)(s.localName??s.importedName)==="Service"&&u.add(s.sourcePath)}}let l=Q([...u]).sort();return n.set(e,l),l}function Ge(t,e,n={}){let i=j(t,e)?.filter(a=>!n.ranges||n.ranges.some(d=>a.line>=d.startLine&&a.line<=d.endLine));if(!i)return{targets:[],unresolvedCallsites:0};let o=A(t,e).filter(a=>!!a.sourcePath),m=Fe(X(t,e)??""),u=w(t,e)?.rootNode??null,l=u?ge(u):se(),c=new Map,p=ee(t),s=[],f=0;for(let a of i){if(!a.memberAccess)continue;let d=H(e,p.get(a.calleeLeaf)??[]);if(n.excludeIndexedTargets!==!1&&J(t,e,d,!0,a.calleeQualifier))continue;let h=a.calleeQualifier,L=$e(t,e,a,o);if(L){s.push(L);continue}let S=pe(t,e,a,o,he(l,a.calleeQualifier,a.line));if(S.length>0){s.push(...S);continue}let x=ye(t,e,a);if(x.length>0){s.push(...x);continue}let y=h?m.get(h)??h:null,P=(y?Q(o.filter(g=>(g.localName??g.importedName)===y).map(g=>g.sourcePath)):[]).flatMap(g=>{let v=c.get(g);return v||(v=N(t,g)??[],c.set(g,v)),v.filter(b=>b.name===a.calleeLeaf).map(b=>({file:g,callable:b}))});if(P.length!==1){f+=1;continue}let _=P[0];s.push({calleeLeaf:a.calleeLeaf,line:a.line,sourceFile:e,targetFile:_.file,targetStartLine:_.callable.startLine,targetEndLine:_.callable.endLine,resolution:"direct-import-receiver",strength:"candidate"})}return{targets:s,unresolvedCallsites:f}}function pe(t,e,n,r,i){let o=n.calleeQualifier;if(!o||!/^[A-Za-z_$][\w$]*$/u.test(o))return[];if(i.size!==1)return[];let m=[...i][0],u=Q(r.filter(p=>p.localName===m||p.importedName===m).map(p=>p.sourcePath));if(u.length!==1)return[];let l=u[0],c=be(t,l,n.calleeLeaf);return c.map(p=>({calleeLeaf:p.name,line:n.line,sourceFile:e,targetFile:p.file,targetStartLine:p.startLine,targetEndLine:p.endLine,serviceFile:l,resolutionAlternativeCount:c.length,resolution:"imported-service-object-member",strength:"candidate"}))}function se(){return{declarations:new Map,callbacks:[]}}function ge(t){let e=se();return I(t,n=>{if(n.type==="variable_declarator"){let l=n.childForFieldName("name")??n.namedChild(0),c=n.childForFieldName("value")??n.namedChild(1);if(l?.type!=="identifier"||!c)return;let p=new Set;if(I(c,s=>{if(s.type!=="member_expression")return;let f=s.childForFieldName("object")??s.namedChild(0),a=s.childForFieldName("property")??s.namedChild(1);f?.type==="identifier"&&a?.text==="Service"&&p.add(f.text)}),p.size===1){let s=e.declarations.get(l.text)??[];s.push({line:n.startPosition.row,alias:[...p][0]}),e.declarations.set(l.text,s)}return}if(!["arrow_function","function_expression","generator_function"].includes(n.type))return;let r=n.childForFieldName("parameters")??n.childForFieldName("parameter");if(!r)return;let i=n.parent;for(;i&&i.type!=="call_expression";)i=i.parent;if(!i)return;let o=i.childForFieldName("function")??i.namedChild(0),m=/^([A-Za-z_$][\w$]*)\.Service\.use$/u.exec(o?.text??"");if(!m)return;let u=new Set;I(r,l=>{l.type==="identifier"&&u.add(l.text)}),u.size!==0&&e.callbacks.push({startLine:n.startPosition.row,endLine:n.endPosition.row,receivers:u,alias:m[1]})}),e}function he(t,e,n){if(!e||!/^[A-Za-z_$][\w$]*$/u.test(e))return new Set;let r=new Set((t.declarations.get(e)??[]).filter(i=>i.line<=n).map(i=>i.alias));for(let i of t.callbacks)i.startLine<=n&&i.endLine>=n&&i.receivers.has(e)&&r.add(i.alias);return r}function ye(t,e,n){let r=n.calleeQualifier;if(!r||!/^[A-Za-z_$][\w$]*$/u.test(r))return[];let i=w(t,e)?.rootNode;if(!i)return[];let o=Le(t,e,i,n.line,n.calleeLeaf,r),m=o?xe(o,r):null;if(!m)return[];if(!Se(m))return[];let u=(N(t,e)??[]).filter(a=>a.startLine<=m.startPosition.row&&a.endLine>=m.endPosition.row).sort((a,d)=>a.endLine-a.startLine-(d.endLine-d.startLine))[0];if(!u)return[];let l=T(t,e).filter(a=>a.isFunctionLike&&a.leaf===u.name);if(l.length!==1)return[];let c=l[0],p=ie.get(t);p||(p=new Map,ie.set(t,p));let s=`${c.symbol}\0${n.calleeLeaf}`,f=p.get(s);if(!f){let a=[];for(let d of Z(t,c)){let h=w(t,d.file)?.rootNode;if(!h)continue;let L=R(h,"call_expression").filter(y=>y.startPosition.row>d.line||y.endPosition.row<d.line?!1:(y.childForFieldName("function")??y.namedChild(0))?.text.replace(/\s+/gu,"").replace(/<[^<>]*>$/u,"").match(/[A-Za-z_$][\w$]*$/u)?.[0]===c.leaf);if(L.length!==1)continue;let x=L[0].childForFieldName("arguments")?.namedChildren.find(y=>F(y).type==="object");if(x)for(let y of F(x).namedChildren){if(y.type==="shorthand_property_identifier"&&y.text===n.calleeLeaf){a.push(...O(t,d.file,n.calleeLeaf,y,y));continue}if(y.type!=="pair")continue;let $=y.childForFieldName("key")??y.namedChild(0),P=y.childForFieldName("value")??y.namedChild(1);k($?.text)!==n.calleeLeaf||!P||a.push(...O(t,d.file,n.calleeLeaf,P,y))}}f=a.filter((d,h,L)=>L.findIndex(S=>S.file===d.file&&S.startLine===d.startLine&&S.endLine===d.endLine&&S.name===d.name)===h),p.set(s,f)}return f.map(a=>({calleeLeaf:a.name,line:n.line,sourceFile:e,targetFile:a.file,targetStartLine:a.startLine,targetEndLine:a.endLine,resolutionAlternativeCount:f.length,resolution:"factory-callback-member",strength:f.length===1?"exact":"candidate"}))}function Le(t,e,n,r,i,o){let m=re.get(t);m||(m=new Map,re.set(t,m));let u=m.get(e);if(!u){u=new Map;for(let l of R(n,"call_expression")){let c=l.childForFieldName("function")??l.namedChild(0),p=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(c?.text.replace(/\s+/gu,"")??"");if(p)for(let s=l.startPosition.row;s<=l.endPosition.row;s+=1){let f=`${s}\0${p[1]}\0${p[2]}`,a=u.get(f);(!a||l.endIndex-l.startIndex<a.endIndex-a.startIndex)&&u.set(f,l)}}m.set(e,u)}return u.get(`${r}\0${o}\0${i}`)??null}function Se(t){return t.descendantsOfType("return_statement").some(e=>{let n=e.childForFieldName("argument")??e.namedChild(0);return!!(n&&F(n).type==="object")})}function xe(t,e){let n=t.parent;for(;n;){if(/(?:function|method|lambda)/u.test(n.type)||n.type==="arrow_function"){let r=n.childForFieldName("parameters")??n.childForFieldName("parameter"),i=!1;if(r&&I(r,o=>{o.type==="identifier"&&o.text===e&&(i=!0)}),i)return n}n=n.parent}return null}function O(t,e,n,r,i){if(r.type==="identifier")return(N(t,e)??[]).filter(l=>l.name===r.text).map(l=>({...l,file:e}));let o=B(t,e,r.text);if(o.length>0)return o;if(!W(r))return[];let u=(N(t,e)??[]).filter(l=>l.startLine>=i.startPosition.row&&l.endLine<=i.endPosition.row&&(l.name===n||l.name.startsWith("source@"))).sort((l,c)=>l.endLine-l.startLine-(c.endLine-c.startLine))[0];return[u?{...u,file:e}:{name:n,file:e,startLine:i.startPosition.row,endLine:i.endPosition.row}]}function be(t,e,n){let r=ae.get(t);r||(r=new Map,ae.set(t,r));let i=`${e}\0${n}`,o=r.get(i);if(o)return o;let m=ve(t,e).flatMap(u=>Ce(t,u,e,n));return r.set(i,m),m}function Ce(t,e,n,r){let i=w(t,e)?.rootNode,o=N(t,e)??[];if(!i)return[];let m=we(t,e,n);if(m.size===0)return[];let u=new Set,l=[],c=[],p=[];return I(i,f=>{if(Ne(f,m)){if(f.type==="pair"){let a=f.childForFieldName("key")??f.namedChild(0),d=f.childForFieldName("value")??f.namedChild(1);if(k(a?.text)!==r||!d)return;if(d.type==="identifier")u.add(d.text);else if(W(d))l.push({name:r,startLine:f.startPosition.row,endLine:f.endPosition.row});else{let h=Ie(t,e,d.text),L=B(t,e,d.text);if(h.length>0)p.push(...h);else if(L.length>0)p.push(...L);else{let S=Pe(f);S&&c.push(S)}}return}f.type==="shorthand_property_identifier"&&f.text===r&&u.add(r)}}),[...o.filter(f=>u.has(f.name)).map(f=>({...f,file:e})),...l.map(f=>({...f,file:e})),...c.map(f=>({...f,file:e})),...p].filter((f,a,d)=>d.findIndex(h=>h.file===f.file&&h.name===f.name&&h.startLine===f.startLine&&h.endLine===f.endLine)===a)}function Ne(t,e){let n=t,r=null;for(;n;){if(n.type==="object"&&(r=n),n.type==="call_expression"){if(!r)return!1;let i=n.childForFieldName("function")??n.namedChild(0);return i?e.has(i.text.replace(/\.of$/u,""))&&i.text.endsWith(".of"):!1}n=n.parent}return!1}function ve(t,e){let n=te.get(t);n||(n=new Map,te.set(t,n));let r=n.get(e);if(r)return r;let i=new Set([e]),o=T(t,e).filter(u=>u.leaf==="Service"&&u.isTypeLike);for(let u of o)for(let l of Z(t,u))i.add(l.file);let m=[...i].sort();return n.set(e,m),m}function we(t,e,n){let r=new Set;M(e,n)&&r.add("Service");for(let i of A(t,e)){if(!i.sourcePath||!M(i.sourcePath,n))continue;if(i.kind==="namespace"&&i.localName){r.add(`${i.localName}.Service`);continue}(i.importedName==="default"?i.localName:i.importedName)==="Service"?r.add(i.localName??i.importedName):i.localName&&i.importedName!=="default"&&r.add(`${i.localName}.Service`)}return r}function B(t,e,n){let r=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n.replace(/\s+/gu,""));if(!r)return[];let i=w(t,e)?.rootNode;if(!i)return[];let o=oe(i,r[1]),m=o?le(o):null;if(!m)return[];let u=m.childForFieldName("function")??m.namedChild(0),l=u?ce(t,e,u.text):[];if(l.length!==1)return[];let c=l[0],p=w(t,c.relativePath)?.rootNode;if(!p)return[];let s=E(p,c.startLine,c.endLine);if(!s)return[];let f=[];for(let a of s.descendantsOfType("return_statement")){let d=a.childForFieldName("argument")??a.namedChild(0);if(!d)continue;let h=F(d);if(h.type==="object")for(let L of h.namedChildren){if(L.type==="shorthand_property_identifier"&&L.text===r[2]){for(let y of N(t,c.relativePath)??[])y.name===r[2]&&f.push({...y,file:c.relativePath});continue}if(L.type!=="pair")continue;let S=L.childForFieldName("key")??L.namedChild(0),x=L.childForFieldName("value")??L.namedChild(1);if(!(k(S?.text)!==r[2]||!x))if(x.type==="identifier")for(let y of N(t,c.relativePath)??[])y.name===x.text&&f.push({...y,file:c.relativePath});else W(x)&&f.push({name:r[2],startLine:L.startPosition.row,endLine:L.endPosition.row,file:c.relativePath})}}return f.filter((a,d,h)=>h.findIndex(L=>L.file===a.file&&L.name===a.name&&L.startLine===a.startLine&&L.endLine===a.endLine)===d)}function Ie(t,e,n){let r=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n.replace(/\s+/gu,""));if(!r)return[];let i=w(t,e)?.rootNode;if(!i)return[];let o=oe(i,r[1]),m=o?le(o):null,u=m?.childForFieldName("function")??m?.namedChild(0),l=u?ce(t,e,u.text):[];if(l.length!==1||!m)return[];let c=l[0],p=w(t,c.relativePath)?.rootNode;if(!p)return[];let s=E(p,c.startLine,c.endLine);if(!s)return[];let f=new Set,a=s.childForFieldName("parameters")??s.childForFieldName("parameter");if(a&&I(a,g=>{g.type==="identifier"&&f.add(g.text)}),f.size===0)return[];let d=B(t,e,n);if(d.length===0)return[];let h=(N(t,c.relativePath)??[]).filter(g=>g.startLine>=c.startLine&&g.endLine<=c.endLine),L=(j(t,c.relativePath)??[]).filter(g=>g.line>=c.startLine&&g.line<=c.endLine),S=new Set,x=d.map(g=>({name:g.name,startLine:g.startLine,endLine:g.endLine})),y=new Set;for(;x.length>0&&y.size<32;){let g=x.shift(),v=`${g.name}\0${g.startLine}\0${g.endLine}`;if(!y.has(v)){y.add(v);for(let b of L.filter(C=>C.line>=g.startLine&&C.line<=g.endLine)){if(b.memberAccess&&b.calleeQualifier&&f.has(b.calleeQualifier)){S.add(b.calleeLeaf);continue}if(b.memberAccess)continue;let C=h.filter(de=>de.name===b.calleeLeaf);C.length===1&&x.push(C[0])}}}if(S.size===0)return[];let P=m.childForFieldName("arguments")?.namedChildren.find(g=>F(g).type==="object");if(!P)return[];let _=[];for(let g of F(P).namedChildren){if(g.type==="shorthand_property_identifier"&&S.has(g.text)){_.push(...O(t,e,g.text,g,g));continue}if(g.type!=="pair")continue;let v=g.childForFieldName("key")??g.namedChild(0),b=g.childForFieldName("value")??g.namedChild(1),C=k(v?.text);!C||!S.has(C)||!b||_.push(...O(t,e,C,b,g))}return _.filter((g,v,b)=>b.findIndex(C=>C.file===g.file&&C.name===g.name&&C.startLine===g.startLine&&C.endLine===g.endLine)===v)}function oe(t,e){for(let n of R(t,"variable_declarator"))if((n.childForFieldName("name")??n.namedChild(0))?.text===e)return n.childForFieldName("value")??n.namedChild(1);return null}function le(t){return t.type==="call_expression"?t:t.descendantsOfType("call_expression")[0]??null}function ce(t,e,n){let r=n.replace(/\s+/gu,"").replace(/<[^<>]*>$/u,""),i=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(r);if(i){let s=A(t,e).filter(d=>d.localName===i[1]&&d.sourcePath);if(s.length!==1||!s[0].sourcePath)return[];let f=s[0].sourcePath,a=D(t,f,i[2]).filter(d=>d.isFunctionLike);return a.length>0?a:(N(t,f)??[]).filter(d=>d.name===i[2]).map(d=>({...d,relativePath:f}))}if(!/^[A-Za-z_$][\w$]*$/u.test(r))return[];let o=T(t,e).filter(s=>s.leaf===r&&s.isFunctionLike);if(o.length>0)return o;let m=(N(t,e)??[]).filter(s=>s.name===r).map(s=>({...s,relativePath:e}));if(m.length>0)return m;let u=A(t,e).filter(s=>s.localName===r&&s.sourcePath&&s.kind!=="namespace");if(u.length!==1||!u[0].sourcePath)return[];let l=u[0].sourcePath,c=u[0].importedName==="default"?r:u[0].importedName,p=D(t,l,c).filter(s=>s.isFunctionLike);return p.length>0?p:(N(t,l)??[]).filter(s=>s.name===c).map(s=>({...s,relativePath:l}))}function W(t){return["arrow_function","function_expression","generator_function"].includes(t.type)||t.descendantsOfType(["arrow_function","function_expression","generator_function"]).length>0}function Pe(t){let e=t.parent;for(;e;){if(e.type==="variable_declarator"){let n=e.childForFieldName("name")??e.namedChild(0);if(n?.type==="identifier")return{name:n.text,startLine:e.startPosition.row,endLine:e.endPosition.row}}e=e.parent}return null}function k(t){return t?t.replace(/^(?:['"])(.*)(?:['"])$/u,"$1"):null}function $e(t,e,n,r){let i=/^this\.([A-Za-z_$][\w$]*)$/u.exec(n.calleeQualifier??"");if(!i)return null;let o=w(t,e)?.rootNode;if(!o)return null;let m=_e(o,n.line);if(!m)return null;let u=new Set;if(I(m,h=>{if(h.type!=="assignment_expression")return;let L=h.childForFieldName("left")??h.namedChild(0),S=h.childForFieldName("right")??h.namedChild(h.namedChildCount-1);if(L?.text.replace(/\s+/gu,"")!==`this.${i[1]}`||!S)return;let x=F(S);if(x.type!=="new_expression")return;let $=(x.childForFieldName("constructor")??x.namedChild(0))?.text.match(/[A-Za-z_$][\w$]*$/u)?.[0];$&&u.add($)}),u.size!==1)return null;let l=[...u][0],c=r.filter(h=>h.localName===l);if(c.length!==1)return null;let p=c[0].importedName==="default"?l:c[0].importedName,s=c[0].importedName==="default"?D(t,c[0].sourcePath,l):[],f=s.length===1?s[0].leaf:p,a=T(t,c[0].sourcePath).filter(h=>h.isFunctionLike&&h.leaf===n.calleeLeaf&&Y(h.symbol)===f);if(a.length!==1)return null;let d=a[0];return{calleeLeaf:n.calleeLeaf,line:n.line,sourceFile:e,targetFile:d.relativePath,targetStartLine:d.startLine,targetEndLine:d.endLine,targetSymbol:d.symbol,resolution:"constructed-member-receiver",strength:"exact"}}function _e(t,e){let n=[];return I(t,r=>{["class","class_declaration","class_definition"].includes(r.type)&&r.startPosition.row<=e&&r.endPosition.row>=e&&n.push(r)}),n.sort((r,i)=>r.endPosition.row-r.startPosition.row-(i.endPosition.row-i.startPosition.row))[0]??null}function F(t){let e=t;for(;["parenthesized_expression","as_expression","type_assertion","satisfies_expression"].includes(e.type)&&e.namedChildCount===1;)e=e.namedChild(0);return e}function I(t,e){e(t);for(let n of t.namedChildren)I(n,e)}function Fe(t){let e=new Map,n=/\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*([A-Za-z_$][\w$]*)\s*;/gu;for(let r of t.matchAll(n)){let i=r[1],o=r[2];i&&o&&e.set(i,o)}return e}function Q(t){let e=[];for(let n of t)e.some(r=>M(r,n))||e.push(n);return e}import{existsSync as Te}from"fs";import{SymbolRole as Me}from"@c4312/scip";import{deserializeSCIP as Ae}from"@c4312/scip";function ue(t,e){return Ae(K(t,{inputKind:e,maxBytes:G}))}var V=new WeakMap;function rt(t,e,n,r){let i=z(t,e),o=(i?.callSites??[]).filter(a=>a.line>=n&&a.line<=r);if(!i||o.length===0)return{available:!!i,targets:[],resolvedCallsites:0,unresolvedCallsites:0};let m=q(t);if(!m)return{available:!1,targets:[],resolvedCallsites:0,unresolvedCallsites:o.length};let u=(m.byFile.get(e)??[]).filter(a=>a.sourceLine>=n&&a.sourceLine<=r).map(a=>({...a,calleeLeaf:a.definition.leaf})),l=fe(o.map(a=>({line:a.line,leaf:a.calleeLeaf}))),c=fe(u.map(a=>({line:a.sourceLine,leaf:a.calleeLeaf}))),p=new Set([...l].flatMap(([a,d])=>c.get(a)===d?[a]:[])),s=u.filter(a=>p.has(me(a.sourceLine,a.calleeLeaf))),f=[...p].reduce((a,d)=>a+(l.get(d)??0),0);return{available:!0,targets:s,resolvedCallsites:f,unresolvedCallsites:Math.max(0,o.length-f)}}function it(t,e,n,r){let i=q(t);return i?{available:!0,targets:(i.byFile.get(e)??[]).filter(o=>o.sourceLine>=n&&o.sourceLine<=r)}:{available:!1,targets:[]}}function at(t,e,n,r){let i=q(t);return i?{available:!0,targets:(i.byFile.get(e)??[]).filter(o=>o.sourceLine>=n&&o.sourceLine<=r&&De(t,o.definition)).map(o=>({...o,calleeLeaf:o.definition.leaf}))}:{available:!1,targets:[]}}function q(t){if(V.has(t))return V.get(t)??null;let e=Re(t);return V.set(t,e),e}function Re(t){if(!t.generation.indexPath||!Te(t.generation.indexPath))return null;try{let e=U(t),n=new Map(e.map(o=>[o.symbol,o])),r=ue(t.generation.indexPath,"SCIP source-range call-target index"),i=new Map;for(let o of r.documents??[]){let m=o.relativePath;if(!m||t.isIgnored(m))continue;let u=[];for(let l of o.occurrences??[]){if(!l.symbol||(l.symbolRoles&Me.Definition)!==0)continue;let c=n.get(l.symbol),p=l.range?.[0];!c||!Number.isInteger(p)||u.push({sourceLine:p,definition:c})}i.set(m,u)}return{byFile:i}}catch{return null}}function De(t,e){if(!e.isFunctionLike)return!1;let n=z(t,e.relativePath);return!n||n.callables.some(r=>r.name===e.leaf&&r.startLine===e.startLine&&r.endLine===e.endLine)?!0:Oe(e)}function Oe(t){let e=t.documentation;if(!e)return!1;let n=t.leaf.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`\\bfunction\\s+${n}\\s*(?:<[^>]*>)?\\s*\\(`,"u").test(e)||new RegExp(`\\b(?:const|let|var)\\s+${n}\\s*:\\s*(?:<[^>]*>\\s*)?\\([^\\n]*\\)\\s*=>`,"u").test(e)}function fe(t){let e=new Map;for(let n of t){let r=me(n.line,n.leaf);e.set(r,(e.get(r)??0)+1)}return e}function me(t,e){return`${t}\0${e}`}export{qe as a,Ge as b,rt as c,it as d,at as e,De as f};
|
|
2
|
-
//# sourceMappingURL=chunk-NK3JMP22.js.map
|
package/dist/chunk-NVSZNESQ.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as g}from"./chunk-PIFTZEEM.js";import{c as m}from"./chunk-PLYUVM4F.js";import{a as d}from"./chunk-BGBBVSH4.js";import{d as u}from"./chunk-TD7VKJ2Y.js";function k(n,c={}){let{scope:e,minLoc:t=10,minCallees:a=6,limit:r=20,scanLimit:i}=c,o=new m(n);return g({candidates:()=>o.productionCallableDefinitions({scope:e,minLoc:t,excludeTypesFiles:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:!0}),scanLimit:i,profile:{name:"extract-candidates"},prepare:s=>o.calleeMap(s,{semantic:c.semantic!==!1}),evaluate:(s,l)=>h(s,l.get(s.symbolId)??[],a),orderResults:(s,l)=>l.clusters.length-s.clusters.length||l.loc-s.loc,limit:r})}function h(n,c,e){let t=new Set(c.map(l=>l.symbol));if(t.size<e)return null;let a=S(t,c),r=y(t,a);if(r.length<2)return null;let i=C(r,a);if(i.length===0)return null;let o=u(n.symbol),s=p(o,t.size,r.length,i);return{symbol:n.symbol,shortName:o,relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:d(n),totalCallees:t.size,extractionKind:s.extractionKind,actionTier:"signal",evidenceReasons:s.evidenceReasons,recommendation:s.recommendation,clusters:i}}function p(n,c,e,t){let a=Math.max(...t.map(s=>s.callees.length)),r=Math.max(...t.map(s=>s.isolation)),i=[`${c} distinct callees across ${e} co-occurrence cluster(s)`,`${t.length} extractable cluster(s) passed size and isolation thresholds`,`largest extractable cluster has ${a} callees at ${Math.round(r*100)}% isolation`],o=f(n,c,e);return o!==null?{extractionKind:"workflow-orchestration",evidenceReasons:[...i,o],recommendation:"Review the isolated helper group as a possible private or feature-local helper, but keep the orchestration sequence together when it preserves the workflow."}:a>=6?{extractionKind:"broad-helper-cluster",evidenceReasons:[...i,"one isolated helper group is broad enough to deserve a named review"],recommendation:"Review whether the broad helper cluster has a stable concept name before extracting it; avoid creating a bag-of-helpers abstraction."}:{extractionKind:"cohesive-helper-cluster",evidenceReasons:i,recommendation:"Review the isolated callee group as a possible same-file or feature-local helper; extract only if the new name preserves the current behavior."}}function f(n,c,e){if(c>=10)return`callee breadth suggests orchestration: ${c} callees`;if(e>=4)return`multiple disconnected callee groups suggest orchestration: ${e} groups`;let t=b(n);return x.has(t)?`caller verb suggests orchestration: ${t}`:null}function b(n){return n.split(":").pop()?.replace(/\(\)$/,"").replace(/[^A-Za-z0-9_]/g,"").replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[_\s-]+/).filter(Boolean)[0]?.toLowerCase()??""}var x=new Set(["apply","build","check","collect","create","diff","execute","find","handle","load","prepare","process","render","resolve","run","select","sync","update","validate","verify","write"]);function S(n,c){let e=new Map;for(let a of n)e.set(a,new Set);let t=new Map;for(let a of c){let r=t.get(a.chunkId);r||(r=new Set,t.set(a.chunkId,r)),r.add(a.symbol)}for(let a of t.values()){let r=[...a];for(let i=0;i<r.length;i++)for(let o=i+1;o<r.length;o++)e.get(r[i]).add(r[o]),e.get(r[o]).add(r[i])}return e}function y(n,c){let e=new Set,t=[];for(let a of n){if(e.has(a))continue;let r=new Set,i=[a];for(;i.length>0;){let o=i.pop();if(!e.has(o)){e.add(o),r.add(o);for(let s of c.get(o)??[])e.has(s)||i.push(s)}}t.push(r)}return t}function C(n,c){return n.filter(e=>e.size>=3).map(e=>v(e,n,c)).filter(e=>e.isolation>.5).sort((e,t)=>t.isolation-e.isolation)}function v(n,c,e){let t=new Set;for(let o of c)if(o!==n)for(let s of o)t.add(s);let a=0;for(let o of n)for(let s of e.get(o)??[])t.has(s)&&a++;let r=n.size*t.size,i=r>0?1-a/r:1;return{callees:[...n].map(u),isolation:i}}export{k as a};
|
|
2
|
-
//# sourceMappingURL=chunk-NVSZNESQ.js.map
|
package/dist/chunk-OJNK5ALA.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{f as B,g as S}from"./chunk-QLBSG7U5.js";import{b as O}from"./chunk-BOJ5SVE2.js";import{a as E}from"./chunk-BGBBVSH4.js";import{c as k}from"./chunk-BECZLYNU.js";import{b as L}from"./chunk-Q6T2CAJL.js";import{d as P}from"./chunk-MTDBHTSF.js";import{d as I,g as z,j as D,u as $}from"./chunk-TD7VKJ2Y.js";import{b as T,s as v,x as A}from"./chunk-42W3LFUK.js";import{H as _,t as p}from"./chunk-Q7GBK5T7.js";import{d as b}from"./chunk-GH5YSGZL.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-OJNK5ALA.js.map
|
package/dist/chunk-OXYAWIEA.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as fe,c as Ve,d as Qe}from"./chunk-FKGQOTKD.js";import{a as rt}from"./chunk-WRQXLNYE.js";import{a as mt,b as ft,c as pt,d as Se,i as G,j as Y,k as dt,l as Z,n as St}from"./chunk-WSLEJSFR.js";import{j as ct}from"./chunk-VUSKPCUB.js";import{h as ut}from"./chunk-HCVJR2V4.js";import{b as gt}from"./chunk-EETGXQY7.js";import{b as Ze}from"./chunk-TQZV7KV4.js";import{B as K,G as Ge,I as Ye,R as tt,S as nt,a as ce,b as ue,c as z,m as me,o as Je,x as Ke}from"./chunk-C7IJMOFP.js";import{d as Xe,g as et,i as pe}from"./chunk-DRENNWRG.js";import{c as lt,d as de}from"./chunk-BVFYEEBH.js";import{a as V,b as yt}from"./chunk-ENWQWA2R.js";import{b as oe,d as le,m as He,o as $e}from"./chunk-DKM723YF.js";import{a as We,d as qe}from"./chunk-IW5XQG5G.js";import{a as Ne,g as it,k as st,l as at,m as ot}from"./chunk-JT6XX7QY.js";import{a as ae,c as Oe,e as T}from"./chunk-HGFDYOVB.js";import{b as ke,c as Le,d as J}from"./chunk-SB25YMEQ.js";import{_ as Be,c as Fe,f as _e,g as Ue,ma as je,na as ze}from"./chunk-AK3PYTIK.js";function Rt(e){let t=new Map,n=Jt(e),r=new Map;return i=>{let s=$t(i),a=r.get(s);if(a!==void 0)return a;if(!n.has(i.file))return r.set(s,i.symbol),i.symbol;let o=t.get(i.file);o||(o=Kt(tt(e,i.file)),t.set(i.file,o));let u=Gt(o,i);return r.set(s,u),u}}function $t(e){return`${e.file}\0${e.symbol}\0${e.line}`}function Jt(e){return new Set(e.all("SELECT relative_path FROM documents").map(t=>t.relative_path))}function Kt(e){let t=new Map,n=new Map;for(let r of e){let i=t.get(r.leaf);i?i.push(r):t.set(r.leaf,[r]);let s=n.get(r.startLine);s?s.push(r):n.set(r.startLine,[r])}return{definitions:e,byLeaf:t,byStartLine:n}}function Gt(e,t){if(e.definitions.length===0)return t.symbol;let n=Vt(t.symbol),r=Yt(e.byLeaf,n),i=Zt(r,t.line);if(i)return i.symbol;let s=e.byStartLine.get(t.line)??[];return s.length===1?s[0].symbol:t.symbol}function Yt(e,t){let n=[],r=new Set;for(let i of t)for(let s of e.get(i)??[])r.has(s.symbolId)||(r.add(s.symbolId),n.push(s));return n}function Zt(e,t){let n=null;for(let r of e)if(!(r.startLine>t||r.endLine<t)){if(r.startLine===t)return r;(!n||r.endLine-r.startLine<n.endLine-n.startLine)&&(n=r)}return n}function Vt(e){let t=new Set([e]),r=e.split(/::|\.|#/).filter(Boolean).at(-1);return r&&t.add(r),t}function bt(e,t){let r=Ye(e,t).map(i=>Xt(t,i));return{usage:r,positions:en(e,t,r)}}function vt(e,t){return{importUsage(n){let r=e.importUsageFacts(n);if(!t||r.positions.length===0)return r.usage;let i=t.importDefinitionsForFile(n,r.positions);return i.available?Qt(r.usage,i.sourcePaths):r.usage}}}function Qt(e,t){return e.map((n,r)=>{let i=t.get(String(r));return i?{...n,sourcePath:i}:n})}function Xt(e,t){let n=t.isTypeOnly===!0,r=t.kind==="side-effect"||n||t.used;return{importer:e,sourcePath:t.sourcePath,importedName:t.importedName,localName:t.localName,kind:t.kind,isTypeOnly:n,isUsed:r,isTypeUsed:n,isValueUsed:t.kind==="side-effect"||!n&&t.used,references:[]}}function en(e,t,n){let r=Ke(e,t);if(!r)return[];let i=tn(r.rootNode),s=new Map;for(let o of i){let u=s.get(ye(o.importedName,o.localName));u?u.push(o.position):s.set(ye(o.importedName,o.localName),[o.position])}let a=[];return n.forEach((o,u)=>{let c=s.get(ye(o.importedName,o.localName??o.importedName))?.shift();c&&a.push({...c,id:String(u),file:t})}),a}function tn(e){let t=[];for(let n of e.descendantsOfType("use_declaration")){let r=n.namedChildren.find(i=>i.type!=="visibility_modifier");r&&t.push(...Q(r,""))}return t.filter(n=>n.importedName!=="*")}function Q(e,t){switch(e.type){case"identifier":case"super":case"self":case"crate":return[{importedName:e.text,localName:e.text,position:ge(e,e.text)}];case"scoped_identifier":{let n=e.text.split("::").pop()??e.text;return[{importedName:n,localName:n,position:ge(e,n)}]}case"scoped_use_list":{let n=e.namedChild(0),r=e.namedChild(1);if(!n||!r)return[];let i=Ge(t,n.text);return r.namedChildren.flatMap(s=>Q(s,i))}case"use_list":return e.namedChildren.flatMap(n=>Q(n,t));case"use_as_clause":{let n=e.namedChild(0),r=e.namedChild(1);return!n||!r?[]:Q(n,t).map(i=>({...i,localName:r.text}))}case"use_wildcard":{let n=e.namedChild(0),r="*";return[{importedName:r,localName:r,position:ge(n??e,r)}]}default:return[]}}function ge(e,t){let n=Math.max(0,e.text.lastIndexOf(t));return{id:"",file:"",line:e.startPosition.row,column:e.startPosition.column+n+nn(t)}}function nn(e){return Math.max(0,Math.min(e.length-1,1))}function ye(e,t){return`${e}\0${t}`}import{spawnSync as Re}from"child_process";import{existsSync as be}from"fs";import{fileURLToPath as rn}from"url";var ve=15e3,he=8;function Dt(e,t={}){let n=t.status??pt,r=on(e,n),i=ln(e,n),s=cn(e,n),a=t.referenceResolver||t.calleeResolver||t.signatureResolver||!sn(t)?null:dt(e,n,{fallbackReferenceResolver:r,fallbackCalleeResolver:i,fallbackSignatureResolver:s}),o=t.referenceResolver??a??r,u=t.calleeResolver??a??i,c=t.signatureResolver??a??s,p=t.importUsageResolver??vt(t.sourceImportUsageResolver??an(),t.importDefinitionResolver??a),l=t.calleeSymbolResolver,m=t.sourceZeroCalleeOracle,S=t.scipOccurrenceCalleeOracle,M=new Map,D=new Map,A=null,v=null,x=()=>(A??=n(e),A),w=()=>{let g=x();return g.dependencyAvailable?v??g:g},y=g=>{if(g.length===0)return new Map;let f=q(g);try{let d=o.referencesForDefinitions(f),R=x();return v=X(R,d),d.available?new Map(d.references):G(f,d.references)}catch(d){let R=x();return v=W(R,d),L(f)}},I=g=>{if(g.length===0)return new Map;let f=q(g),d=f.filter(ht);if(d.length===0)return O(f);let R=new Map,U=Ct(d,S),E=[];for(let b of d)D.has(b.symbolId)?R.set(b.symbolId,D.get(b.symbolId)??[]):U.has(b.symbolId)?R.set(b.symbolId,U.get(b.symbolId)??[]):It(b,m)?R.set(b.symbolId,[]):E.push(b);if(E.length===0)return N(f,R,void 0);try{let b=u.calleesForDefinitions(E),F=x();v=X(F,b);let P=N(E,b.callees,l);for(let[j,re]of P)R.set(j,re);return N(f,R,void 0)}catch(b){let F=x();return v=W(F,b),O(f)}},C=(g,f)=>{let d=q(g),R=q(f),U=R.filter(ht),E=new Map,b=Ct(U,S),F=[];for(let P of U)b.has(P.symbolId)?E.set(P.symbolId,b.get(P.symbolId)??[]):It(P,m)?E.set(P.symbolId,[]):F.push(P);if(d.length===0&&F.length===0)return{references:L(d),callees:N(R,E,void 0)};try{let P=a?a.referencesAndCalleesForDefinitions(d,F):pn(o,u,{referenceDefinitions:d,calleeDefinitions:F}),j=x();v=X(j,P);let re=P.available?new Map(P.references):G(d,P.references);for(let[ie,se]of P.callees)E.set(ie,se);let Ee=N(R,E,l);for(let[ie,se]of Ee)D.set(ie,se);return{references:re,callees:Ee}}catch(P){let j=x();return v=W(j,P),{references:L(d),callees:O(R)}}},h=g=>{if(g.length===0)return new Map;let f=q(g);try{let d=c.signaturesForDefinitions(f),R=x();return v=X(R,d),Mt(f,d.signatures)}catch(d){let R=x();return v=W(R,d),ee(f)}};return{language:"rust",availability:w,dispose:()=>{a?.dispose()},importUsage:g=>{let f=M.get(g);if(f)return f;try{let d=p.importUsage(g);return M.set(g,d),d}catch(d){let R=x();return v=W(R,d),[]}},referencesFor:g=>y([g]).get(g.symbolId)??[],referencesForDefinitions:y,referencesAndCalleesForDefinitions:C,calleesFor:g=>I([g]).get(g.symbolId)??[],calleesForDefinitions:I,signatureFor:g=>h([g]).get(g.symbolId)??null}}function X(e,t){let n={dependencyAvailable:e.dependencyAvailable,resolvedBinary:t.resolvedBinary??e.resolvedBinary,...e.note?{note:e.note}:{}};return t.available?{available:!0,...n}:{available:!1,reason:t.reason,...n}}function W(e,t){return{available:!1,dependencyAvailable:e.dependencyAvailable,resolvedBinary:e.resolvedBinary,...e.note?{note:e.note}:{},reason:t instanceof Error?t.message:String(t)}}function sn(e){if(e.usePersistentSession!==void 0)return e.usePersistentSession;let t=process.env.SCIP_RUST_SEMANTIC_SESSION;return t!=="0"&&t!=="false"}function an(){return{importUsageFacts:()=>({usage:[],positions:[]})}}function q(e){return e.map(t=>{let n=t;return{...t,leaf:typeof n.leaf=="string"?n.leaf:Xe(t.symbol),parentTypeName:n.parentTypeName??null,isFunctionLike:typeof n.isFunctionLike=="boolean"?n.isFunctionLike:et(t.symbol),isTypeLike:n.isTypeLike??!1,kind:n.kind??null,documentation:n.documentation??null,enclosingSymbol:n.enclosingSymbol??null}})}function ht(e){return e.isFunctionLike}function It(e,t){if(!t)return!1;try{return t(e)}catch{return!1}}function Ct(e,t){if(!t||e.length===0)return new Map;try{return t(e)}catch{return new Map}}function on(e,t){return{referencesForDefinitions:n=>un(e,t,n)}}function ln(e,t){return{calleesForDefinitions:n=>mn(e,t,n)}}function cn(e,t){return{signaturesForDefinitions:n=>fn(e,t,n)}}function un(e,t,n){let r=t(e);if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:De(r),references:L(n)};let i=Ie();if(!be(i))return{available:!1,resolvedBinary:r.resolvedBinary,reason:`Rust semantic worker was not found at ${i}. Run npm run build before using built semantic Rust queries.`,references:L(n)};let s=B(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,ve),a=te(process.env.SCIP_RUST_SEMANTIC_REFERENCE_RETRY_TIMEOUT_MS,0),o=B(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,he),u=te(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(s,1e4)),c=Z(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,{definitionCount:n.length,includeReferences:!0}),p={projectRoot:e,rustAnalyzerBinary:r.resolvedBinary,definitions:[...n],requestTimeoutMs:s,...a>0?{referenceRetryTimeoutMs:a}:{},diagnosticsTimeoutMs:u,settleDelayMs:c,concurrency:o},l=Re(process.execPath,[i],{cwd:e,input:JSON.stringify(p),encoding:"utf8",maxBuffer:50*1024*1024,timeout:Y(n.length,St(s,p.referenceRetryTimeoutMs),o)}),m=Me(l.stdout);if(m)return{...Ce(m),resolvedBinary:r.resolvedBinary,references:G(n,new Map(m.references),new Set(m.incompleteReferenceSymbolIds??[]))};let S=l.error instanceof Error?l.error.message:l.stderr.trim()||`Rust semantic worker exited with status ${l.status??"unknown"}.`;return{available:!1,resolvedBinary:r.resolvedBinary,reason:S,references:L(n)}}function mn(e,t,n){let r=t(e);if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:De(r),callees:O(n)};let i=Ie();if(!be(i))return{available:!1,resolvedBinary:r.resolvedBinary,reason:`Rust semantic worker was not found at ${i}. Run npm run build before using built semantic Rust queries.`,callees:O(n)};let s=B(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,ve),a=B(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,he),o=te(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(s,1e4)),u=Z(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,{definitionCount:n.length,includeReferences:!1,includeCallees:!0}),c={projectRoot:e,rustAnalyzerBinary:r.resolvedBinary,definitions:[...n],requestTimeoutMs:s,diagnosticsTimeoutMs:o,settleDelayMs:u,concurrency:a,includeReferences:!1,includeCallees:!0},p=Re(process.execPath,[i],{cwd:e,input:JSON.stringify(c),encoding:"utf8",maxBuffer:50*1024*1024,timeout:Y(n.length,s,a)}),l=Me(p.stdout);if(l)return{...Ce(l),resolvedBinary:r.resolvedBinary,callees:N(n,new Map(l.callees??[]),void 0)};let m=p.error instanceof Error?p.error.message:p.stderr.trim()||`Rust semantic worker exited with status ${p.status??"unknown"}.`;return{available:!1,resolvedBinary:r.resolvedBinary,reason:m,callees:O(n)}}function fn(e,t,n){let r=t(e);if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:De(r),signatures:ee(n)};let i=Ie();if(!be(i))return{available:!1,resolvedBinary:r.resolvedBinary,reason:`Rust semantic worker was not found at ${i}. Run npm run build before using built semantic Rust queries.`,signatures:ee(n)};let s=B(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,ve),a=B(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,he),o=te(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(s,1e4)),u=Z(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,{definitionCount:n.length,includeReferences:!1,includeCallees:!1,includeSignatures:!0}),c={projectRoot:e,rustAnalyzerBinary:r.resolvedBinary,definitions:[...n],requestTimeoutMs:s,diagnosticsTimeoutMs:o,settleDelayMs:u,concurrency:a,includeReferences:!1,includeCallees:!1,includeSignatures:!0},p=Re(process.execPath,[i],{cwd:e,input:JSON.stringify(c),encoding:"utf8",maxBuffer:50*1024*1024,timeout:Y(n.length,s,a)}),l=Me(p.stdout);if(l)return{...Ce(l),resolvedBinary:r.resolvedBinary,signatures:Mt(n,new Map(l.signatures??[]))};let m=p.error instanceof Error?p.error.message:p.stderr.trim()||`Rust semantic worker exited with status ${p.status??"unknown"}.`;return{available:!1,resolvedBinary:r.resolvedBinary,reason:m,signatures:ee(n)}}function pn(e,t,n){let r=n.referenceDefinitions.length>0?e.referencesForDefinitions(n.referenceDefinitions):{available:!0,references:L(n.referenceDefinitions)},i=n.calleeDefinitions.length>0?t.calleesForDefinitions(n.calleeDefinitions):{available:!0,callees:O(n.calleeDefinitions)},s={resolvedBinary:r.resolvedBinary??i.resolvedBinary,references:r.references,callees:i.callees};return r.available&&i.available?{available:!0,...s}:{available:!1,reason:(r.available?void 0:r.reason)??(i.available?void 0:i.reason)??"Rust semantic resolution was unavailable.",...s}}function L(e){return new Map(e.map(t=>[t.symbolId,[]]))}function O(e){return new Map(e.map(t=>[t.symbolId,[]]))}function ee(e){return new Map(e.map(t=>[t.symbolId,null]))}function N(e,t,n){let r=0,i=0;return T("rust.semantic.callees.complete-map",()=>{let s=new Map;for(let a of e){let o=t.get(a.symbolId)??[];o.length>0&&(r+=1),i+=o.length,s.set(a.symbolId,o.map(u=>({...u,symbol:n?n(u):u.symbol})))}return s},()=>({definitions:e.length,rows:r,callees:i,resolveSymbols:!!n}))}function Mt(e,t){return new Map(e.map(n=>[n.symbolId,t.get(n.symbolId)??null]))}function Ie(){return rn(new URL("./rust-semantic-worker.js",import.meta.url))}function Ce(e){return e.available?{available:!0}:{available:!1,reason:e.reason}}function De(e){return e.available?"rust-analyzer binary path is unavailable.":e.reason}function Me(e){try{let t=JSON.parse(e);if(!t||typeof t!="object")return null;let n=t;if(typeof n.available!="boolean"||!Array.isArray(n.references)||n.available===!1&&typeof n.reason!="string"||n.available===!0&&n.reason!==void 0)return null;let r={references:n.references,incompleteReferenceSymbolIds:Array.isArray(n.incompleteReferenceSymbolIds)?n.incompleteReferenceSymbolIds.filter(i=>typeof i=="number"):void 0,callees:Array.isArray(n.callees)?n.callees:void 0,signatures:Array.isArray(n.signatures)?n.signatures:void 0};return n.available===!0?{available:!0,...r}:{available:!1,reason:String(n.reason),...r}}catch{return null}}function B(e,t){return ct(e)??t}function te(e,t){if(!e)return t;let n=Number(e);return Number.isInteger(n)&&n>=0?n:t}import{existsSync as dn}from"fs";import{deserializeSCIP as Sn,SymbolRole as gn}from"@c4312/scip";var xe=new WeakMap;function Pt(e,t){let n=t.filter(yn);if(n.length===0)return new Map;let r=!1,i=0,s=0;return T("rust.scip-occurrence.callees",()=>{let a=vn(e);if(r=!!a,!a)return new Map;let o=new Map;for(let u of n){let c=Rn(e,a,u);c!==null&&(o.set(u.symbolId,c),i+=1,s+=c.length)}return o},()=>({definitions:t.length,candidates:n.length,indexAvailable:r,resolvedDefinitions:i,resolvedCallees:s}))}function yn(e){return!(!e.symbol.startsWith("rust-analyzer ")||!e.relativePath.endsWith(".rs")||!e.isFunctionLike||e.leaf==="main"||pe(e.symbol))}function Rn(e,t,n){let r=K(e,n.relativePath);if(!r||r.language!=="rust")return null;let i=r.callables.find(c=>c.startLine!==n.startLine||c.endLine!==n.endLine?!1:c.name===n.leaf||n.leaf.endsWith(c.name)||c.name.endsWith(n.leaf));if(!i)return null;let s=r.callSites.filter(c=>c.line>=i.startLine&&c.line<=i.endLine);if(s.length===0)return null;let a=(t.occurrencesByFile.get(n.relativePath)??[]).filter(c=>c.line>=i.startLine&&c.line<=i.endLine&&c.callee.symbol!==n.symbol);if(a.some(c=>c.traitImplMember)||!bn(s,a))return null;let o=[],u=new Set;for(let c of a){let p=`${c.callee.symbol}\0${c.callee.file}\0${c.callee.line}`;u.has(p)||(u.add(p),o.push(c.callee))}return o}function bn(e,t){let n=xt(e),r=xt(t);if(n.size!==r.size)return!1;for(let[i,s]of n)if(r.get(i)!==s)return!1;return!0}function xt(e){let t=new Map;for(let n of e){let r=n.calleeLeaf??n.leaf;if(!r)continue;let i=`${n.line}\0${r}`;t.set(i,(t.get(i)??0)+1)}return t}function vn(e){if(xe.has(e))return xe.get(e)??null;let t=hn(e);return xe.set(e,t),t}function hn(e){if(!e.generation.indexPath||!dn(e.generation.indexPath))return null;try{let t=nt(e).filter(s=>s.symbol.startsWith("rust-analyzer ")&&s.relativePath.endsWith(".rs")&&s.isFunctionLike),n=new Map(t.map(s=>[s.symbol,s])),r=Sn(_e(e.generation.indexPath,{inputKind:"SCIP occurrence-callee index",maxBytes:Fe})),i=new Map;for(let s of r.documents??[]){let a=s.relativePath;if(!a||!a.endsWith(".rs")||e.isIgnored(a))continue;let o=[];for(let u of s.occurrences??[]){if(!u.symbol||(u.symbolRoles&gn.Definition)!==0)continue;let c=n.get(u.symbol);if(!c)continue;let p=u.range?.[0];Number.isInteger(p)&&o.push({line:p,leaf:c.leaf,traitImplMember:pe(c.symbol),callee:{symbol:c.symbol,file:c.relativePath,line:c.startLine,callsiteLine:p}})}i.set(a,o)}return{occurrencesByFile:i}}catch{return null}}var ne=class{sessions=new WeakMap;getOrCreate(t,n,r){let i=In(t,n),s=this.sessions.get(t);s||(s=new Map,this.sessions.set(t,s));let a=s.get(i);if(a)return a.hits+=1,a.lastUsedAtMs=Date.now(),a.provider;let o=Date.now(),u=r();return s.set(i,{key:i,language:n,projectRoot:t.config.projectRoot,provider:u,createdAtMs:o,lastUsedAtMs:o,hits:1}),u}sessionsFor(t){return[...this.sessions.get(t)?.values()??[]]}clear(t){let n=this.sessions.get(t);if(n)for(let r of n.values())r.provider.dispose?.();this.sessions.delete(t)}};function In(e,t){return`${e.config.projectRoot}:${t}-workspace`}import{randomUUID as Cn}from"crypto";import{existsSync as Dn}from"fs";import{dirname as Mn}from"path";function wt(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e;if(typeof t.available!="boolean"||t.dependencyAvailable!==void 0&&typeof t.dependencyAvailable!="boolean"||t.tsconfigPath!==void 0&&typeof t.tsconfigPath!="string"||t.tsconfigPaths!==void 0&&(!Array.isArray(t.tsconfigPaths)||!t.tsconfigPaths.every(n=>typeof n=="string"))||t.resolvedBinary!==void 0&&typeof t.resolvedBinary!="string"||t.note!==void 0&&typeof t.note!="string")return null;if(t.available===!0){if(t.reason!==void 0)return null}else if(typeof t.reason!="string"||t.reason.length===0)return null;return t}var xn=12e4,Pn=5;function Et(e,t,n={}){let r=new Pe(e,n),i=null,s=null,a=process.env.SCIP_QUERY_SKIP_WATCH_SERVICE==="1",o=()=>(i??=gt(e,t),i),u=(l,m,S)=>{if(a)return S();try{return m(r.request(l))}catch{return a=!0,S()}},c=(l,m)=>u({kind:"references",definitions:[...l],...m?.exact?{exact:!0}:{}},S=>At(S),()=>o().referencesForDefinitions?.(l,m)??new Map(l.map(S=>[S.symbolId,o().referencesFor(S)]))),p=l=>u({kind:"callees",definitions:[...l]},m=>At(m),()=>o().calleesForDefinitions?.(l)??new Map(l.map(m=>[m.symbolId,o().calleesFor(m)])));return{language:"typescript",availability:()=>(s??=u({kind:"availability"},An,()=>o().availability()),s),importUsage:l=>u({kind:"import-usage",file:l},m=>m,()=>o().importUsage(l)),referencesFor:l=>c([l]).get(l.symbolId)??[],referencesForDefinitions:c,referenceFragmentsForFiles:l=>u({kind:"reference-fragments",files:[...l]},m=>Tn(m),()=>o().referenceFragmentsForFiles?.(l)??new Map),calleesFor:l=>p([l]).get(l.symbolId)??[],calleesForDefinitions:p,signatureFor:l=>u({kind:"signature",definition:l},En,()=>o().signatureFor(l)),dispose:()=>i?.dispose?.()}}var Pe=class{constructor(t,n={}){this.db=t;this.runtime=n.runtime??_n,this.timeoutMs=n.timeoutMs??Fn(),this.mailboxLimits=n.mailboxLimits??{},this.cacheDir=Mn(t.config.dbPath),this.projectRoot=Be(t.config.projectRoot)}db;runtime;timeoutMs;cacheDir;projectRoot;mailboxLimits;request(t){let n=lt(this.cacheDir),r=yt(this.cacheDir),i=de(n.statePath);if(!Tt(i,this.projectRoot,this.runtime))throw new Error("Compatible TypeScript semantic service is not running.");let s=this.db.generation.identity;if(!s)throw new Error("Published TypeScript generation identity is unavailable.");let a=this.runtime.now(),o=a+this.timeoutMs,u=(this.runtime.monotonicNow??J)()+this.timeoutMs,c=Oe(),p=st("typescript-semantic-v3",{generation:s,profileEnvironment:c,request:t}),l=at(p),m=ot(r,{mailboxVersion:it,operationKey:p,clientId:this.runtime.randomId(),enqueuedAtMs:a,deadlineAtMs:o,protocolVersion:V,id:l,generation:s,profileEnvironment:c,request:t},{nowMs:a,limits:this.mailboxLimits});for(;(this.runtime.monotonicNow??J)()<=u;){if(Dn(m.responsePath))return wn(Ue(m.responsePath,{maxBytes:this.mailboxLimits.maxItemBytes??64*1024*1024,inputKind:"TypeScript semantic mailbox response"}),l,s,p);let S=de(n.statePath);if(!Tt(S,this.projectRoot,this.runtime))throw new Error("TypeScript semantic service stopped while processing a request.");this.runtime.sleep(Pn)}throw new Error(`TypeScript semantic service timed out after ${this.timeoutMs}ms.`)}};function Tt(e,t,n){let r=e?.processIdentity?n.readProcessIdentity?.(e.pid):null;return e!==null&&e.projectRoot===t&&e.typescriptSemantic?.protocolVersion===V&&n.isProcessAlive(e.pid)&&(!e.processIdentity||r!=null&&ke(e.processIdentity,r))}function wn(e,t,n,r){let i=JSON.parse(e);if(i.protocolVersion!==V||i.id!==t||i.operationKey!==r||i.ok===!0&&i.generation!==n)throw new Error("TypeScript semantic service wrote an incompatible response.");if(i.ok===!0)return i.response;throw new Error(typeof i.error=="string"?i.error:"TypeScript semantic service request failed.")}function At(e){if(!Array.isArray(e))throw new Error("TypeScript semantic service wrote an invalid numeric map.");return new Map(e)}function Tn(e){if(!Array.isArray(e))throw new Error("TypeScript semantic service wrote an invalid string map.");return new Map(e)}function An(e){let t=wt(e);if(!t)throw new Error("TypeScript semantic service wrote invalid availability.");return t}function En(e){if(e!==null&&typeof e!="string")throw new Error("TypeScript semantic service wrote an invalid signature.");return e}function Fn(){let e=Number(process.env.SCIP_TYPESCRIPT_SEMANTIC_TIMEOUT_MS);return Number.isInteger(e)&&e>0?e:xn}var _n={now:Date.now,monotonicNow:J,randomId:Cn,sleep(e){let t=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(t,0,0,e)},isProcessAlive:Ne,readProcessIdentity:Le};var Ft=new ne;We({name:"semantic-provider",groups:["semantic-provider"],clearAll:e=>Ft.clear(e)});function H(e,t){let n=_(t)??"typescript";return Ft.getOrCreate(e,n,()=>n==="rust"?Dt(e.config.projectRoot,{sourceImportUsageResolver:{importUsageFacts:r=>bt(e,r)},calleeSymbolResolver:Rt(e),sourceZeroCalleeOracle:r=>Un(e,r),scipOccurrenceCalleeOracle:r=>Pt(e,r)}):Et(e,t))}function _(e){return e?Je(e)==="rust"?"rust":Ze(e)?"typescript":null:"typescript"}function Un(e,t){let n=K(e,t.relativePath);if(!n||n.language!=="rust")return!1;let r=n.callables.find(i=>i.startLine===t.startLine&&i.endLine===t.endLine&&i.name===t.leaf)??n.callables.find(i=>i.startLine===t.startLine&&i.endLine===t.endLine);return r?!n.callSites.some(i=>i.line>=r.startLine&&i.line<=r.endLine):!1}var kn=/^[A-Za-z_][A-Za-z0-9_]*$/,_t=/\bDefault::default\b/g,Ln=/^\.\.\s*Default::default\b/;function Ut(e,t){let n=new Map,r=new Map;for(let i of t){let s=we(e,i,r);s!==null&&n.set(i.symbolId,s)}return n}function we(e,t,n=new Map){let r=Nn(t.symbol);if(!r)return null;let i=rt(e,[t.symbolId]);if(i.length===0)return null;let s=new RegExp(`(^|[^A-Za-z0-9_])${me(r)}::default\\b`,"g"),a=new RegExp(`(^|[^A-Za-z0-9_])${me(r)}\\s*$`),o=On(e,t.symbolId),u=[];for(let c of i){let p=Bn(e,c.relative_path,n);if(p===null)return null;let l=p.split(/\r?\n/),m=0,S=[],M=0;for(let D=c.chunk_start;D<=c.chunk_end&&D<l.length;D+=1){let v=l[D]??"",x=new Set;s.lastIndex=0;let w;for(;w=s.exec(v);)u.push({file:c.relative_path,line:D,column:w.index+w[1].length+r.length+2}),M+=1;for(let y=0;y<v.length;y+=1){let I=Ln.exec(v.slice(y));if(I){if(o&&S.includes(m)){let h=y+I[0].lastIndexOf("default");u.push({file:c.relative_path,line:D,column:h}),x.add(h),M+=1}y+=I[0].length-1;continue}let C=v[y];if(C==="{"){let h=a.test(v.slice(0,y));m+=1,h&&S.push(m);continue}if(C==="}")for(m=Math.max(0,m-1);S.length>0&&S[S.length-1]>m;)S.pop()}for(_t.lastIndex=0;w=_t.exec(v);){let y=w.index+9;if(!x.has(y))return null}}if(M===0)return null}return ut(u)}function On(e,t){return e.get("SELECT 1 AS present FROM mentions WHERE symbol_id = ? AND role = 1 LIMIT 1",t)?.present===1}function Nn(e){let t=/impl#\[([^\]]+)\]\[Default\]default\(\)\./.exec(e)?.[1]??null;return!t||!kn.test(t)?null:t}function Bn(e,t,n){if(n.has(t))return n.get(t)??null;let r=e.get("SELECT text FROM documents WHERE relative_path = ?",t),i=typeof r?.text=="string"?r.text:jn(e,t);return n.set(t,i),i}function jn(e,t){try{return je(e.config.projectRoot,t,{inputKind:"indexed Rust source file"})}catch(n){if(!ze(n))throw n;return null}}function kt(e){let t=new Map;for(let n of e){let r=t.get(n.relativePath)??[];r.push(n),t.set(n.relativePath,r)}return t}var zn="typescript-import-usage-v1",Wn="typescript-signatures-v1",Te=qe("semantic-prefetched-callees",{clearGroups:["whole-project","source-file","semantic-provider"]}),Lt=ue({kind:"semantic-import-usage",invalidation:z("semantic-import-usage"),serialize:e=>JSON.stringify(e),deserialize:qt}),Ot=ue({kind:"semantic-signatures",invalidation:z("semantic-signatures"),serialize:e=>JSON.stringify(e),deserialize:er}),Nt=ce({kind:"typescript-import-usage",invalidation:z("typescript-import-usage"),serialize:e=>JSON.stringify(e),deserialize:qt}),Bt=ce({kind:"typescript-signatures",invalidation:z("typescript-signatures"),serialize:e=>JSON.stringify(e),deserialize:tr});function Ae(e){let t=new Map,n=new Set;return{capability:(r,i)=>Ht(e,r,i),importUsage:r=>Hn(e,r),references:r=>$n(e,r),materializeReferences:(r,i)=>zt(e,r,t,n,i),callerMap:r=>Jn(e,r,t,n),calleeMap:r=>Vn(e,r),signature:r=>Qn(e,r)}}function qn(e,t){if(t.size===0)return;let n=Te.get(e,()=>new Map);for(let[r,i]of t)n.set(r,[...i])}function Ri(e,t){if(!Te.has(e))return{hits:[],misses:[...t]};let n=Te.get(e,()=>new Map),r=[],i=[];for(let s of t)n.has(s.symbolId)?r.push({definition:s,callees:n.get(s.symbolId)??[]}):i.push(s);return{hits:r,misses:i}}function bi(e,t){return Ae(e).importUsage(t)}function Hn(e,t){if(_(t)==="typescript"){let s="fallback",a=0,o=0,u=0,c=0;return T("typescript.import-usage.materialize",()=>{let p=fe(e,t,zn);if(p?.key){a=1;let m=Nt.read(e,t,p.key);if(m)return s="hit",o=1,m;u=1;let S=k(e,t);if(!S)return s="unavailable",[];let M=S.importUsage(t);return Nt.write(e,t,p.key,M),s="computed",M}c=1;let l=k(e,t);return l?(s="direct-fallback",l.importUsage(t)):(s="unavailable",[])},()=>({state:s,eligible:a,cacheHits:o,cacheMisses:u,fallbacks:c}))}let n=Wt(e,"semantic-import-usage",t);if(n){let s=Lt.read(e,t,n);if(s)return s}let r=k(e,t);if(!r)return[];let i=r.importUsage(t);return n&&Lt.write(e,t,n,i),i}function vi(e,t){return Ae(e).references(t)}function $n(e,t){let n=we(e,t);if(n)return n;let r=ft(e,t);if(r)return r;let i=k(e,t.relativePath);return i?i.referencesFor(t):[]}function Jn(e,t,n=new Map,r=new Set){let i=new Map,s=zt(e,t,n,r),a=0;return T("semantic.callers.from-references",()=>{for(let o of t)a+=Yn(e,i,o,n.get(o.symbolId)??[])},()=>({definitions:t.length,materialized:s.definitions,inMemoryHits:s.inMemoryHits,incompleteInMemoryHits:s.incompleteInMemoryHits,resultRows:i.size,callerFiles:a})),i}function zt(e,t,n,r,i={}){let s=le(e),a=[],o=[],u=[],c=0,p=0,l=0,m=0,S=0,M=0,D=0,A=0,v=0,x=0,w=0,y=0,I=[],C=new Map,h=t.filter(f=>_(f.relativePath)==="typescript"&&!n.has(f.symbolId)&&!r.has(f.symbolId)),g=Qe(e,h,f=>H(e,f));if(g){v=h.length,x=g.cacheHits,w=g.cacheMisses,y=g.computedFiles;for(let f of h)n.set(f.symbolId,g.references.get(f.symbolId)??[])}if(T("semantic.references.cache-scan",()=>{for(let[f,d]of kt(t)){let R=[];for(let b of d)n.has(b.symbolId)?p+=1:r.has(b.symbolId)?A+=1:R.push(b);if(R.length===0){D+=1;continue}let U=Kn(e,s,f);if(!U){for(let b of R)_(b.relativePath)||(c+=1),u.push(b);continue}M+=1;let E=He(e,f,U);for(let b of R){let F=E.get(b.symbol)??null;if(F!==null){let P=Zn(F);if(P){l+=1,n.set(b.symbolId,P);continue}m+=1}o.push({definition:b,cacheFingerprint:U})}}},()=>({definitions:t.length,skippedUnsupportedLanguage:c,cacheHits:l,parseFailures:m,misses:o.length,unkeyed:u.length,inMemoryHits:p,incompleteInMemoryHits:A,fullyInMemoryFiles:D,cacheReadFiles:M})),o.length>0||u.length>0){I=[...u,...o.map(f=>f.definition)],C=T("semantic.references.compute-misses",()=>{let f=Gn(e,I,i);return S=f.size,f},()=>({definitions:I.length,misses:o.length,unkeyed:u.length,rows:S}));for(let f of I)C.has(f.symbolId)?(n.set(f.symbolId,C.get(f.symbolId)??[]),r.delete(f.symbolId)):r.add(f.symbolId);for(let{definition:f,cacheFingerprint:d}of o)C.has(f.symbolId)&&Ht(e,"semantic-references",f.relativePath).available&&a.push({relativePath:f.relativePath,symbol:f.symbol,projectFingerprint:d,payload:JSON.stringify(C.get(f.symbolId)??[])})}return a.length>0&&T("semantic.references.cache-write",()=>$e(e,a),()=>({entries:a.length})),C.size>0&&Ve(e,I,C,f=>H(e,f)),{definitions:t.length,inMemoryHits:p,incompleteInMemoryHits:A,cacheHits:l,misses:o.length,unkeyed:u.length,skippedUnsupportedLanguage:c,parseFailures:m,computed:S,incomplete:r.size,cacheWrites:a.length,fragmentDefinitions:v,fragmentCacheHits:x,fragmentCacheMisses:w,fragmentComputedFiles:y}}function Kn(e,t,n){if(!t)return null;let r=_(n);return r==="typescript"?t:r==="rust"?oe(JSON.stringify({kind:"semantic-references",language:r,engine:Se(e.config.projectRoot),projectFingerprint:t})):null}function Gn(e,t,n={}){let r=ae(),i=new Map,s=0,a=0,o=0,u=0,c=0,p=0,l=0,m=0,S=0;return T("semantic.references.provider-loop",()=>{let M=Ut(e,t),D=mt(e,t),A=new Map,v=n.prefetchCallees?new Map:null,x=[];for(let y of t){let I,C=()=>(I??=k(e,y.relativePath),I);if(v){let d=C();if(d?.referencesAndCalleesForDefinitions){let R=v.get(d);R?R.push(y):v.set(d,[y]),S+=1}}let h=M.get(y.symbolId);if(h){o+=1,u+=h.length,$(i,y.symbolId,h,r,d=>{l+=1,m+=d});continue}let g=D.get(y.symbolId);if(g){c+=1,p+=g.length,$(i,y.symbolId,g,r,d=>{l+=1,m+=d});continue}let f=C();if(!f){r&&(a+=1);continue}if(r&&(s+=1),f.referencesForDefinitions){let d=A.get(f);d?d.push(y):A.set(f,[y])}else x.push({provider:f,definition:y})}let w=new Set;if(v)for(let[y,I]of v){if(!y.referencesAndCalleesForDefinitions)continue;let C=A.get(y)??[],h=y.referencesAndCalleesForDefinitions(C,I);w.add(y),qn(e,h.callees);for(let g of C){if(!h.references.has(g.symbolId))continue;let f=h.references.get(g.symbolId)??[];$(i,g.symbolId,f,r,d=>{l+=1,m+=d})}}for(let[y,I]of A){if(w.has(y))continue;let C=y.referencesForDefinitions(I);for(let h of I){if(!C.has(h.symbolId))continue;let g=C.get(h.symbolId)??[];$(i,h.symbolId,g,r,f=>{l+=1,m+=f})}}for(let{provider:y,definition:I}of x){let C=y.referencesFor(I);$(i,I.symbolId,C,r,h=>{l+=1,m+=h})}return i},()=>({definitions:t.length,providerHits:s,providerMisses:a,rustDefaultFastPathRows:o,rustDefaultFastPathReferences:u,rustScipOccurrenceFastPathRows:c,rustScipOccurrenceFastPathReferences:p,prefetchCalleeDefinitions:S,definitionsWithReferences:l,referenceCount:m,rows:i.size}))}function $(e,t,n,r,i){e.set(t,n),r&&n.length>0&&i(n.length)}function Yn(e,t,n,r){let i=0;for(let s of r){if(s.file===n.relativePath||e.isIgnored(s.file))continue;let a=t.get(n.symbolId);a||(a=new Set,t.set(n.symbolId,a));let o=a.size;a.add(s.file),a.size!==o&&(i+=1)}return i}function Zn(e){try{return JSON.parse(e)}catch{return null}}function hi(e,t){return Ae(e).calleeMap(t)}function Vn(e,t){let n=ae(),r=new Map,i=0,s=0,a=0,o=0;return T("semantic.callees.provider-loop",()=>{let u=new Map,c=[];for(let p of t){let l=k(e,p.relativePath);if(!l){n&&(s+=1);continue}n&&(i+=1);let m=p;if(l.calleesForDefinitions){let S=u.get(l);S?S.push(m):u.set(l,[m])}else c.push({provider:l,definition:m})}for(let[p,l]of u){let m=p.calleesForDefinitions(l);for(let S of l){let M=m.get(S.symbolId)??[];jt(r,S.symbolId,M,n,D=>{a+=1,o+=D})}}for(let{provider:p,definition:l}of c){let m=p.calleesFor(l);jt(r,l.symbolId,m,n,S=>{a+=1,o+=S})}return r},()=>({definitions:t.length,providerHits:i,providerMisses:s,definitionsWithCallees:a,calleeCount:o,rows:r.size}))}function jt(e,t,n,r,i){n.length>0&&(e.set(t,n),r&&i(n.length))}function Qn(e,t){if(_(t.relativePath)==="typescript"){let a="fallback",o=0,u=0,c=0,p=0;return T("typescript.signature.materialize",()=>{let l=fe(e,t.relativePath,Wn);if(l?.key){o=1;let S=Bt.read(e,t.relativePath,l.key)??{};if(Object.prototype.hasOwnProperty.call(S,t.symbol))return a="hit",u=1,S[t.symbol]??null;c=1;let M=k(e,t.relativePath);if(!M)return a="unavailable",null;let D=M.signatureFor(t);return Bt.write(e,t.relativePath,l.key,{...S,[t.symbol]:D}),a="computed",D}p=1;let m=k(e,t.relativePath);return m?(a="direct-fallback",m.signatureFor(t)):(a="unavailable",null)},()=>({state:a,eligible:o,cacheHits:u,cacheMisses:c,fallbacks:p}))}let n=Wt(e,"semantic-signatures",t.relativePath),r=Xn(t);if(n){let a=Ot.read(e,r,n);if(a)return a.signature}let i=k(e,t.relativePath);if(!i)return null;let s=i.signatureFor(t);return n&&Ot.write(e,r,n,{signature:s}),s}function Wt(e,t,n){let r=le(e);if(!r)return null;let i=_(n);return i!=="rust"?null:oe(JSON.stringify({kind:t,language:i,engine:Se(e.config.projectRoot),projectFingerprint:r}))}function Xn(e){return`${e.relativePath}\0${e.symbol}`}function qt(e){try{let t=JSON.parse(e);return Array.isArray(t)?t:null}catch{return null}}function er(e){try{let t=JSON.parse(e);if(!t||typeof t!="object")return null;let n=t.signature;return n!==null&&typeof n!="string"?null:{signature:n}}catch{return null}}function tr(e){try{let t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return null;for(let n of Object.values(t))if(n!==null&&typeof n!="string")return null;return t}catch{return null}}function Ht(e,t,n){let r=_(n);if(!r)return{slot:t,language:"typescript",available:!1,reason:"semantic evidence is only available for TypeScript or Rust files"};try{return{slot:t,language:r,...H(e,n).availability()}}catch(i){return{slot:t,language:r,available:!1,reason:i instanceof Error?i.message:String(i)}}}function k(e,t){if(!_(t))return null;let n=H(e,t);return n.availability().available?n:null}export{kt as a,_ as b,Ae as c,Ri as d,bi as e,vi as f,Gn as g,hi as h};
|
|
2
|
-
//# sourceMappingURL=chunk-OXYAWIEA.js.map
|
package/dist/chunk-OZETODHH.js
DELETED
package/dist/chunk-PBUH2P5S.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as X}from"./chunk-P5XHIJHI.js";import{A as mn,B as yn,a as It,i as Mt,j as me,k as $,l as Le,m as Z,n as ee,o as Oe,q as Dt,r as pn,s as Ue,t as ne,u as xt,v as Ct,w as Be,x as Tt,y as dn}from"./chunk-TUSPIVZ3.js";import{d as ht}from"./chunk-KK7GPALL.js";import{a as xe,b as Ce,c as we,d as Pe,e as q,o as vt}from"./chunk-HG722PO7.js";import{b as Rt,e as V,f as Ne,h as bt,j as de,t as z,u as _e}from"./chunk-TD7VKJ2Y.js";import{a as pe,m as Fe,v as St,x as gt}from"./chunk-42W3LFUK.js";import{C as yt,a as Ee,c as ft,d as pt,q as ln,z as mt}from"./chunk-7JYHQAH2.js";import{a as ot,c as at,d as ct,h as an,j as cn,m as lt,o as ut,r as _,s as dt,t as w,v as Ae,w as un,x as fn,y as fe}from"./chunk-Q7GBK5T7.js";import{Ba as st,C as et,D as H,E as Te,H as ke,I as B,J as nt,O as on,aa as tt,n as le,q as N,ta as rt,xa as it,ya as ue}from"./chunk-GH5YSGZL.js";function kt(n){let e=new Map,t=ti(n),r=new Map;return i=>{let s=ni(i),o=r.get(s);if(o!==void 0)return o;if(!t.has(i.file))return r.set(s,i.symbol),i.symbol;let a=e.get(i.file);a||(a=ri(z(n,i.file)),e.set(i.file,a));let l=ii(a,i);return r.set(s,l),l}}function ni(n){return`${n.file}\0${n.symbol}\0${n.line}`}function ti(n){return new Set(n.all("SELECT relative_path FROM documents").map(e=>e.relative_path))}function ri(n){let e=new Map,t=new Map;for(let r of n){let i=e.get(r.leaf);i?i.push(r):e.set(r.leaf,[r]);let s=t.get(r.startLine);s?s.push(r):t.set(r.startLine,[r])}return{definitions:n,byLeaf:e,byStartLine:t}}function ii(n,e){if(n.definitions.length===0)return e.symbol;let t=ai(e.symbol),r=si(n.byLeaf,t),i=oi(r,e.line);if(i)return i.symbol;let s=n.byStartLine.get(e.line)??[];return s.length===1?s[0].symbol:e.symbol}function si(n,e){let t=[],r=new Set;for(let i of e)for(let s of n.get(i)??[])r.has(s.symbolId)||(r.add(s.symbolId),t.push(s));return t}function oi(n,e){let t=null;for(let r of n)if(!(r.startLine>e||r.endLine<e)){if(r.startLine===e)return r;(!t||r.endLine-r.startLine<t.endLine-t.startLine)&&(t=r)}return t}function ai(n){let e=new Set([n]),r=n.split(/::|\.|#/).filter(Boolean).at(-1);return r&&e.add(r),e}function wt(n,e){let r=gt(n,e).map(i=>li(e,i));return{usage:r,positions:ui(n,e,r)}}function Pt(n,e){return{importUsage(t){let r=n.importUsageFacts(t);if(!e||r.positions.length===0)return r.usage;let i=e.importDefinitionsForFile(t,r.positions);return i.available?ci(r.usage,i.sourcePaths):r.usage}}}function ci(n,e){return n.map((t,r)=>{let i=e.get(String(r));return i?{...t,sourcePath:i}:t})}function li(n,e){let t=e.isTypeOnly===!0,r=e.kind==="side-effect"||t||e.used;return{importer:n,sourcePath:e.sourcePath,importedName:e.importedName,localName:e.localName,kind:e.kind,isTypeOnly:t,isUsed:r,isTypeUsed:t,isValueUsed:e.kind==="side-effect"||!t&&e.used,references:[]}}function ui(n,e,t){let r=yt(n,e);if(!r)return[];let i=fi(r.rootNode),s=new Map;for(let a of i){let l=s.get(gn(a.importedName,a.localName));l?l.push(a.position):s.set(gn(a.importedName,a.localName),[a.position])}let o=[];return t.forEach((a,l)=>{let u=s.get(gn(a.importedName,a.localName??a.importedName))?.shift();u&&o.push({...u,id:String(l),file:e})}),o}function fi(n){let e=[];for(let t of n.descendantsOfType("use_declaration")){let r=t.namedChildren.find(i=>i.type!=="visibility_modifier");r&&e.push(...qe(r,""))}return e.filter(t=>t.importedName!=="*")}function qe(n,e){switch(n.type){case"identifier":case"super":case"self":case"crate":return[{importedName:n.text,localName:n.text,position:Sn(n,n.text)}];case"scoped_identifier":{let t=n.text.split("::").pop()??n.text;return[{importedName:t,localName:t,position:Sn(n,t)}]}case"scoped_use_list":{let t=n.namedChild(0),r=n.namedChild(1);if(!t||!r)return[];let i=St(e,t.text);return r.namedChildren.flatMap(s=>qe(s,i))}case"use_list":return n.namedChildren.flatMap(t=>qe(t,e));case"use_as_clause":{let t=n.namedChild(0),r=n.namedChild(1);return!t||!r?[]:qe(t,e).map(i=>({...i,localName:r.text}))}case"use_wildcard":{let t=n.namedChild(0),r="*";return[{importedName:r,localName:r,position:Sn(t??n,r)}]}default:return[]}}function Sn(n,e){let t=Math.max(0,n.text.lastIndexOf(e));return{id:"",file:"",line:n.startPosition.row,column:n.startPosition.column+t+pi(e)}}function pi(n){return Math.max(0,Math.min(n.length-1,1))}function gn(n,e){return`${n}\0${e}`}import{spawnSync as kn}from"child_process";import{existsSync as wn}from"fs";import{fileURLToPath as ms}from"url";function je(n){let e=Mt(It,n),t=e.runnable;return t?{available:!0,dependencyAvailable:t,resolvedBinary:e.resolvedBinary??void 0,note:"rust-analyzer semantic reference queries are enabled."}:{available:!1,dependencyAvailable:t,resolvedBinary:e.resolvedBinary??void 0,reason:"rust-analyzer is not runnable; Rust semantic checks will use SCIP/source evidence only."}}import{existsSync as Qi,mkdtempSync as er,rmSync as vn}from"fs";import{tmpdir as nr}from"os";import{join as Dn}from"path";import{fileURLToPath as Ye,pathToFileURL as Xi}from"url";import{SHARE_ENV as Zi,Worker as es}from"worker_threads";function K(n,e,t=new Set){let r=new Map;for(let i of n)t.has(i.symbolId)||r.set(i.symbolId,e.get(i.symbolId)??[]);return r}function Y(n,e,t){let r=X(process.env.SCIP_RUST_SEMANTIC_BATCH_TIMEOUT_MS)??0;if(r>0)return r;let i=Math.max(1,Math.ceil(n/Math.max(1,t)));return Math.max(12e4,3e4+i*e)}import{spawn as Ei}from"child_process";import{createHash as Ai,randomUUID as Fi}from"crypto";import{existsSync as Ht,realpathSync as Ni,rmSync as _i}from"fs";import{tmpdir as Li}from"os";import{resolve as re}from"path";import{execFileSync as hi}from"child_process";import{existsSync as di}from"fs";import{deserializeSCIP as mi,SymbolRole as yi}from"@c4312/scip";import{realpathSync as $o}from"fs";import{basename as Jo,dirname as Go,join as Qo,relative as Xo,sep as Zo}from"path";import{fileURLToPath as na,pathToFileURL as ta}from"url";function We(n){let e=new Map;for(let t of n)e.set(`${t.file}\0${t.line}\0${t.column}`,t);return[...e.values()].sort((t,r)=>{let i=t.file.localeCompare(r.file);return i!==0?i:t.line!==r.line?t.line-r.line:t.column-r.column})}var Rn=new WeakMap,Si="SCIP_RUST_SCIP_OCCURRENCE_REFERENCE_MODE";function Et(n,e){let t=new Map,r=ze(),i=e.filter(o=>Nt(o,r));if(i.length===0)return t;let s=_t(n);if(!s)return t;for(let o of i){let a=Ft(s,o);a!==null&&t.set(o.symbolId,a)}return t}function At(n,e){if(!Nt(e,ze()))return null;let t=_t(n);return t?Ft(t,e):null}function Ft(n,e){return n.referencesBySymbol.get(e.symbol)??[]}function Nt(n,e="safe"){if(!n.symbol.startsWith("rust-analyzer ")||!n.relativePath.endsWith(".rs")||de(n.symbol)||/impl#\[[^\]]+\]\[Default\]default\(\)\.$/.test(n.symbol))return!1;if(e==="all")return!0;let t=Ne(n.symbol);if(t==="method")return!0;if(t!=="term")return!1;let r=Rt(n.symbol);return"kind"in r?!1:!gi(r)}function gi(n){for(let e=0;e<n.descriptors.length-1;e+=1)if(n.descriptors[e]?.suffix==="type")return!0;return!1}function _t(n){if(Rn.has(n))return Rn.get(n)??null;let e=Ri(n);return Rn.set(n,e),e}function Ri(n){if(!n.generation.indexPath||!di(n.generation.indexPath))return null;try{let e=mi(ke(n.generation.indexPath,{inputKind:"SCIP occurrence-reference index",maxBytes:Te})),t=new Map;for(let r of e.documents??[]){let i=r.relativePath;if(!(!i||n.isIgnored(i)))for(let s of r.occurrences??[]){if(!s.symbol||(s.symbolRoles&yi.Definition)!==0)continue;let o=bi(i,s.range);if(!o)continue;let a=t.get(s.symbol)??[];a.push(o),t.set(s.symbol,a)}}for(let[r,i]of t)t.set(r,We(i));return{referencesBySymbol:t}}catch{return null}}function bi(n,e){if(e.length<3)return null;let t=e[0],r=e[1];return!Number.isInteger(t)||!Number.isInteger(r)?null:{file:n,line:t,column:r}}function ze(){return process.env[Si]==="all"?"all":"safe"}var Lt=new Map;function bn(n){let t=je(n).resolvedBinary??null;return{engine:"rust-analyzer",resolvedBinary:t,version:t?Ii(n,t):"unavailable"}}function hn(n){return{...bn(n),scipOccurrenceReferenceMode:ze()}}function Ii(n,e){let t=`${n}\0${e}`,r=Lt.get(t);if(r)return r;let i;try{i=hi(e,["--version"],{cwd:n,encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:2e3}).trim()}catch{i="unknown"}return Lt.set(t,i),i}import{createHash as Mi}from"crypto";var vi=new Set(["Cargo.lock","Cargo.toml","rust-project.json","rust-toolchain","rust-toolchain.toml"]);function Ot(n){let e=st(n,{includePath:Di});return Mi("sha256").update(JSON.stringify(e)).digest("hex")}function Di(n){let e=n.replaceAll("\\","/"),t=e.split("/").at(-1)??e;return e.endsWith(".rs")||vi.has(t)?!0:e===".cargo/config"||e===".cargo/config.toml"||e.endsWith("/.cargo/config")||e.endsWith("/.cargo/config.toml")}import{createHash as xi}from"crypto";import{resolve as Ci}from"path";var te=3;function Mn(n){return xi("sha256").update(me({kind:"scip-query-durable-rust-mailbox",protocolVersion:te,sessionDir:Ci(n)})).digest("hex")}function qt(n,e){return le(n)?n.protocolVersion!==te?Bt(n.protocolVersion===void 0?"helper wrote a prior uncorrelated response protocol":`helper wrote unsupported response protocol ${String(n.protocolVersion)}`):n.mailboxVersion!==$||n.id!==e.requestId||n.operationKey!==e.operationKey||n.sessionIdentity!==e.sessionIdentity||n.deadlineAtMs!==e.deadlineAtMs?Bt("helper wrote an incompatible response identity"):typeof n.completedAtMs!="number"||!Number.isFinite(n.completedAtMs)||n.completedAtMs>e.deadlineAtMs||e.nowMs>e.deadlineAtMs?{ok:!1,code:"expired-request",error:"helper response arrived after the durable request deadline"}:n.ok===!1?typeof n.error!="string"||!Pi(n.errorCode)?In("helper wrote an invalid rejection response"):{ok:!1,code:n.errorCode,error:n.error}:n.ok!==!0||n.session!=="created"&&n.session!=="reused"&&n.session!=="invalidated"||!Ti(n.response,e.requestKind)?In("helper wrote an invalid success response"):{ok:!0,session:n.session,response:n.response}:In("helper wrote an invalid response object")}function Ti(n,e){return!le(n)||typeof n.available!="boolean"||n.available===!1&&(typeof n.reason!="string"||n.reason.length===0)||n.available===!0&&n.reason!==void 0?!1:e==="import-definitions"?Array.isArray(n.sourcePaths)&&n.sourcePaths.every(t=>Array.isArray(t)&&t.length===2&&typeof t[0]=="string"&&(t[1]===null||typeof t[1]=="string")):Ut(n.references,ki)&&(n.incompleteReferenceSymbolIds===void 0||Array.isArray(n.incompleteReferenceSymbolIds)&&n.incompleteReferenceSymbolIds.every(t=>Number.isSafeInteger(t)))&&(n.callees===void 0||Ut(n.callees,wi))&&(n.signatures===void 0||Array.isArray(n.signatures)&&n.signatures.every(t=>Array.isArray(t)&&t.length===2&&Number.isSafeInteger(t[0])&&(t[1]===null||typeof t[1]=="string")))}function Ut(n,e){return Array.isArray(n)&&n.every(t=>Array.isArray(t)&&t.length===2&&Number.isSafeInteger(t[0])&&Array.isArray(t[1])&&t[1].every(e))}function ki(n){return le(n)&&typeof n.file=="string"&&N(n.line)&&N(n.column)}function wi(n){return le(n)&&typeof n.symbol=="string"&&typeof n.file=="string"&&N(n.line)&&(n.callsiteLine===void 0||N(n.callsiteLine))}function Pi(n){return n==="unsupported-protocol"||n==="malformed-request"||n==="expired-request"||n==="handler-error"}function In(n){return{ok:!1,code:"malformed-response",error:n}}function Bt(n){return{ok:!1,code:"incompatible-response",error:n}}var Oi=5e3,Vt=10,Ui=3e4;function jt(n,e,t,r=Qt){let i=r.engineIdentity(n),s={protocolVersion:te,projectRoot:r.canonicalProjectRoot(n),projectFingerprint:r.projectFingerprint(n),engine:{engine:i.engine,resolvedBinary:i.resolvedBinary,version:i.version},workerFingerprint:r.fileFingerprint(e),environment:Yt(r.environment())};return{key:Xt(me(s)),...s}}function Ke(n,e,t,r){if(n.protocolVersion!==te||!t(n.pid))return!1;if(!n.processIdentity)return!0;let i=r?.(n.pid);return i!=null&&Ce(n.processIdentity,i)}function $t(n,e,t){let r;try{r=on(e,{maxBytes:H,inputKind:"Rust semantic engine artifact"})}catch{r="missing"}let i=Xt(me({projectRoot:re(n),serverPath:re(e),serverFingerprint:r})).slice(0,20);return re(t,`scip-query-rust-session-${i}`)}function Wt(n){let e=n===void 0?Number.NaN:Number(n);return Number.isInteger(e)&&e>=0?e:0}function Yt(n){return Object.fromEntries(Object.entries(n).filter(([e])=>Gt(e)).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,t??null]))}function Jt(n,e){let t=e.runtime??Ki,r=e.identityRuntime??Qt,i=$t(n,e.serverPath,e.tempRoot??Li()),s=!1,o=(a,l)=>{if(s)throw new Error("Durable Rust semantic session was already disposed.");return qi(i,e.serverPath,e.semanticWorkerPath,a,l,t,e.mailboxLimits)};return{requestSemantic(a,l){let u=jt(n,e.semanticWorkerPath,a,r),{readinessDeadlineMs:f,...c}=a;return o({kind:"semantic",identityKey:u.key,workerEnvironment:Kt(),request:{...c,referenceRetryTimeoutMs:Bi(process.env.SCIP_RUST_SEMANTIC_REFERENCE_RETRY_TIMEOUT_MS,a.referenceRetryTimeoutMs),settleDelayMs:process.env.SCIP_RUST_SEMANTIC_SETTLE_MS===void 0?a.settleDelayMs:Wt(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS)},timeoutMs:l},l)},requestImportDefinitions(a,l){let u=jt(n,e.semanticWorkerPath,a,r),{readinessDeadlineMs:f,...c}=a;return o({kind:"import-definitions",identityKey:u.key,workerEnvironment:Kt(),request:{...c,settleDelayMs:process.env.SCIP_RUST_SEMANTIC_SETTLE_MS===void 0?a.settleDelayMs:Wt(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS)},timeoutMs:l},l)},shutdown(){s=!0}}}function Bi(n,e){return e!==void 0?e:n===void 0?Ui:void 0}function qi(n,e,t,r,i,s,o={}){let a=s.now(),l=a+i,u=(s.monotonicNow??q)(),f=u+i,c=Z("rust-semantic-v3",r),p=ee(c),d=Le(n),y=Mn(n),R=Oe(d,{mailboxVersion:$,protocolVersion:te,id:p,operationKey:c,clientId:s.randomId(),enqueuedAtMs:a,deadlineAtMs:l,sessionIdentity:y,request:r},{nowMs:a,limits:o});for(zt(n,e,t,f,s);(s.monotonicNow??q)()<=f;){if(Ht(R.responsePath)){let S=ji(B(R.responsePath,{maxBytes:o.maxItemBytes??H,inputKind:"durable Rust semantic mailbox response"}),{requestId:p,operationKey:c,sessionIdentity:y,deadlineAtMs:R.authoritativeDeadlineAtMs,requestKind:r.kind,nowMs:s.now()});if(!S.ok)throw new Error(S.error);return _()&&Ae({type:"span",name:"rust.semantic.durable-session.request",durationMs:(s.monotonicNow??q)()-u,ok:!0,session:S.session,kind:r.kind}),S.response}let b=He(n);(!b||!Ke(b,s.now(),s.isProcessAlive,s.readProcessIdentity))&&zt(n,e,t,f,s),s.sleep(Vt)}throw new Error(`Durable Rust semantic session timed out after ${(i/1e3).toFixed(0)}s.`)}function zt(n,e,t,r,i){let s=He(n);if(s&&Ke(s,i.now(),i.isProcessAlive,i.readProcessIdentity))return;_i(re(n,"server.json"),{force:!0}),i.spawnServer(e,n,t);let o=i.monotonicNow??q,a=Math.min(r,o()+Oi);for(;o()<=a;){let l=He(n);if(l&&Ke(l,i.now(),i.isProcessAlive,i.readProcessIdentity))return;i.sleep(Vt)}throw new Error("Durable Rust semantic session helper did not become ready within 5s.")}function He(n){try{let e=JSON.parse(B(re(n,"server.json"),{maxBytes:et,inputKind:"durable Rust session state"}));if(typeof e.protocolVersion!="number"||e.sessionIdentity!==void 0&&(typeof e.sessionIdentity!="string"||e.sessionIdentity!==Mn(n))||typeof e.pid!="number"||typeof e.heartbeatAtMs!="number"||e.busyUntilMs!==void 0&&typeof e.busyUntilMs!="number"||e.mailbox!==void 0&&!Wi(e.mailbox))return null;let t=e.processIdentity===void 0?null:xe(e.processIdentity);return e.processIdentity!==void 0&&(!t||t.pid!==e.pid)?null:{protocolVersion:e.protocolVersion,...e.sessionIdentity===void 0?{}:{sessionIdentity:e.sessionIdentity},pid:e.pid,...t?{processIdentity:t}:{},heartbeatAtMs:e.heartbeatAtMs,...e.busyUntilMs===void 0?{}:{busyUntilMs:e.busyUntilMs},...e.mailbox===void 0?{}:{mailbox:e.mailbox}}}catch{return null}}function ji(n,e){try{return qt(JSON.parse(n),e)}catch(t){return{ok:!1,code:"malformed-response",error:`helper wrote malformed JSON: ${t instanceof Error?t.message:String(t)}`}}}function Wi(n){if(!n||typeof n!="object")return!1;let e=n;return N(e.pending)&&N(e.inflight)&&N(e.responses)&&N(e.deadLetters)&&N(e.invalid)&&N(e.totalItems)&&typeof e.totalBytes=="number"&&Number.isFinite(e.totalBytes)&&e.totalBytes>=0&&(e.oldestPendingAt===void 0||Number.isFinite(Date.parse(e.oldestPendingAt)))}function Kt(){return Object.fromEntries(Object.entries(process.env).filter(([n])=>zi(n)).sort(([n],[e])=>n.localeCompare(e)).map(([n,e])=>[n,e??null]))}function Gt(n){return n==="HOME"||n==="PATH"||n.startsWith("CARGO_")||n.startsWith("RA_")||n.startsWith("RUST")}function zi(n){return Gt(n)||n.startsWith("SCIP_RUST_")||n==="SCIP_QUERY_PROFILE"||n==="SCIP_QUERY_PROFILE_CACHE_STATE"||n==="SCIP_QUERY_PROFILE_COMMAND"||n==="SCIP_QUERY_PROFILE_OUT"||n==="SCIP_QUERY_PROFILE_RUN_ID"||n==="SCIP_QUERY_PROFILE_WORKLOAD_IDENTITY"||n==="SCIP_QUERY_PROFILE_WORKLOAD_IDENTITY_KIND"||n==="SCIP_QUERY_PROFILE_MIN_MS"}var Qt={canonicalProjectRoot(n){try{return Ni(n)}catch{return re(n)}},projectFingerprint(n){return Ot(n)},engineIdentity:bn,fileFingerprint(n){return on(n,{maxBytes:H,inputKind:"Rust semantic engine artifact"})},environment(){return Yt(process.env)}},Ki={now:Date.now,monotonicNow:q,randomId:Fi,isProcessAlive:Pe,readProcessIdentity:we,spawnServer(n,e,t){if(!Ht(n))throw new Error(`Durable Rust semantic session helper was not found at ${n}. Run npm run build first.`);Ei(process.execPath,[n,e,t],{detached:!0,stdio:"ignore"}).unref()},sleep(n){let e=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(e,0,0,n)}};function Xt(n){return Ai("sha256").update(n).digest("hex")}import{randomUUID as Va}from"crypto";import{readdirSync as Hi,rmSync as Ya,writeFileSync as Ja}from"fs";import{join as Vi}from"path";var $i="rust-analyzer-owner-",Yi=".json",Ji=16*1024;async function Zt(n,e){if(!n)return[];let t;try{t=Hi(n)}catch{return[]}let r=t.filter(o=>o.startsWith($i)&&o.endsWith(Yi)).map(o=>Vi(n,o)),i=[],s=[];for(let o of r){let a=Gi(o);a?s.push(a):i.push({reaped:!1,reason:"identity-unavailable",detail:`Rust analyzer ownership record ${o} could not be validated.`})}return i.push(...await Promise.all(s.map(o=>vt(o,e)))),i}function Gi(n){try{let e=B(n,{maxBytes:Ji,inputKind:"rust-analyzer process ownership record"}),t=JSON.parse(e),r=xe(t.rootIdentity);return t.version!==1||!r||typeof t.ownsProcessGroup!="boolean"?null:{rootPid:r.pid,rootIdentity:r,ownsProcessGroup:t.ownsProcessGroup,knownMembers:new Map([[r.pid,r]])}}catch{return null}}var tr=15e3,rr=8,sr=5e3,ns=64,ts=96,Cn=class{constructor(e,t,r={}){this.projectRoot=e;this.status=t;this.opts=r;this.requester=r.requester??os(e,process.env.SCIP_RUST_SEMANTIC_DURABLE_SESSION)}projectRoot;status;opts;requester;referencesForDefinitions(e){let t=this.status(this.projectRoot);if(!t.available||!t.resolvedBinary)return{available:!1,resolvedBinary:t.resolvedBinary,reason:Se(t),references:ge(e)};try{let r=this.requestSession(t.resolvedBinary,e,{includeReferences:!0});return{...ye(r),resolvedBinary:t.resolvedBinary,references:K(e,new Map(r.references),new Set(r.incompleteReferenceSymbolIds??[]))}}catch(r){return this.opts.fallbackReferenceResolver?.referencesForDefinitions(e)??{available:!1,resolvedBinary:t.resolvedBinary,reason:r instanceof Error?r.message:String(r),references:ge(e)}}}calleesForDefinitions(e){let t=this.status(this.projectRoot);if(!t.available||!t.resolvedBinary)return{available:!1,resolvedBinary:t.resolvedBinary,reason:Se(t),callees:Re(e)};try{let r=this.requestSession(t.resolvedBinary,e,{includeReferences:!1,includeCallees:!0});return{...ye(r),resolvedBinary:t.resolvedBinary,callees:xn(e,new Map(r.callees??[]))}}catch(r){return this.opts.fallbackCalleeResolver?.calleesForDefinitions(e)??{available:!1,resolvedBinary:t.resolvedBinary,reason:r instanceof Error?r.message:String(r),callees:Re(e)}}}referencesAndCalleesForDefinitions(e,t){let r=this.status(this.projectRoot);if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:Se(r),references:ge(e),callees:Re(t)};let i=[...e,...t];try{let s=this.requestSession(r.resolvedBinary,i,{includeReferences:e.length>0,includeCallees:t.length>0,referenceDefinitions:e,calleeDefinitions:t});return{...ye(s),resolvedBinary:r.resolvedBinary,references:K(e,new Map(s.references),new Set(s.incompleteReferenceSymbolIds??[])),callees:xn(t,new Map(s.callees??[]))}}catch(s){return this.fallbackReferencesAndCallees(r,e,t,s)}}signaturesForDefinitions(e){let t=this.status(this.projectRoot);if(!t.available||!t.resolvedBinary)return{available:!1,resolvedBinary:t.resolvedBinary,reason:Se(t),signatures:ir(e)};try{let r=this.requestSession(t.resolvedBinary,e,{includeReferences:!1,includeCallees:!1,includeSignatures:!0});return{...ye(r),resolvedBinary:t.resolvedBinary,signatures:fs(e,new Map(r.signatures??[]))}}catch(r){return this.opts.fallbackSignatureResolver?.signaturesForDefinitions(e)??{available:!1,resolvedBinary:t.resolvedBinary,reason:r instanceof Error?r.message:String(r),signatures:ir(e)}}}importDefinitionsForFile(e,t){let r=this.status(this.projectRoot);if(t.length===0)return r.available?{available:!0,resolvedBinary:r.resolvedBinary,sourcePaths:new Map}:{available:!1,reason:r.reason,resolvedBinary:r.resolvedBinary,sourcePaths:new Map};if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:Se(r),sourcePaths:new Map(t.map(i=>[i.id,null]))};try{let i=this.requestImportDefinitions(r.resolvedBinary,e,t);return{...ye(i),resolvedBinary:r.resolvedBinary,sourcePaths:new Map(i.sourcePaths)}}catch(i){return{available:!1,resolvedBinary:r.resolvedBinary,reason:i instanceof Error?i.message:String(i),sourcePaths:new Map(t.map(s=>[s.id,null]))}}}dispose(){this.requester.shutdown()}requestSession(e,t,r){let i=Ve(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,tr),s=$e(process.env.SCIP_RUST_SEMANTIC_REFERENCE_RETRY_TIMEOUT_MS,0),o=Ve(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,rr),a=$e(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(i,1e4)),l=r.referenceDefinitions?[...r.referenceDefinitions]:void 0,u=r.calleeDefinitions?[...r.calleeDefinitions]:void 0,f=r.signatureDefinitions?[...r.signatureDefinitions]:void 0,c=be(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,{definitionCount:t.length,...r}),p={projectRoot:this.projectRoot,rustAnalyzerBinary:e,definitions:[...t],...l?{referenceDefinitions:l}:{},...u?{calleeDefinitions:u}:{},...f?{signatureDefinitions:f}:{},requestTimeoutMs:i,...r.includeReferences!==!1&&s>0?{referenceRetryTimeoutMs:s}:{},diagnosticsTimeoutMs:a,settleDelayMs:c,concurrency:o,includeReferences:r.includeReferences,includeCallees:r.includeCallees,includeSignatures:r.includeSignatures},d=ps(p);return w("rust.semantic.session.request",()=>this.requester.requestSemantic(p,Y(d,Tn(i,p.referenceRetryTimeoutMs),o)),()=>({definitions:t.length,operationDefinitions:d,referenceDefinitions:p.referenceDefinitions?.length,calleeDefinitions:p.calleeDefinitions?.length,signatureDefinitions:p.signatureDefinitions?.length,references:p.includeReferences!==!1,callees:p.includeCallees===!0,signatures:p.includeSignatures===!0,referenceRetryTimeoutMs:p.referenceRetryTimeoutMs}))}fallbackReferencesAndCallees(e,t,r,i){let s=t.length===0?{available:!0,resolvedBinary:e.resolvedBinary,references:ge(t)}:this.opts.fallbackReferenceResolver?.referencesForDefinitions(t),o=r.length===0?{available:!0,resolvedBinary:e.resolvedBinary,callees:Re(r)}:this.opts.fallbackCalleeResolver?.calleesForDefinitions(r);if(s&&o){let a={resolvedBinary:s.resolvedBinary??o.resolvedBinary??e.resolvedBinary,references:K(t,s.references),callees:xn(r,o.callees)};return s.available&&o.available?{available:!0,...a}:{available:!1,reason:(s.available?void 0:s.reason)??(o.available?void 0:o.reason)??"Rust semantic fallback was unavailable.",...a}}return{available:!1,resolvedBinary:e.resolvedBinary,reason:i instanceof Error?i.message:String(i),references:ge(t),callees:Re(r)}}requestImportDefinitions(e,t,r){let i=Ve(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,tr),s=Ve(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,rr),o=$e(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(i,1e4)),a=$e(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,sr),l={projectRoot:this.projectRoot,rustAnalyzerBinary:e,file:t,positions:[...r],requestTimeoutMs:i,diagnosticsTimeoutMs:o,settleDelayMs:a,concurrency:s};return w("rust.semantic.import-definitions.session.request",()=>this.requester.requestImportDefinitions(l,Y(r.length,i,s)),()=>({file:t,positions:r.length}))}};function ye(n){return n.available?{available:!0}:{available:!1,reason:n.reason}}function Se(n){return n.available?"rust-analyzer binary path is unavailable.":n.reason}function or(n,e,t={}){return new Cn(n,e,t)}function be(n,e){let t=cr(n);if(t!==null)return t;let r=e.includeReferences!==!1;return r&&e.includeCallees!==!0&&e.includeSignatures!==!0&&e.definitionCount<=ns||r&&e.includeCallees===!0&&e.includeSignatures!==!0&&e.definitionCount<=ts?0:sr}function rs(n){let e=n?.trim().toLowerCase(),t=e==="0"||e==="false"||e==="off"||e==="worker",r=e==="1"||e==="true"||e==="on"||e==="durable",i=e===void 0||e==="";return{transport:t||!i&&!r?"worker":"durable",source:i?"default":"environment",fallback:"worker",valid:i||t||r,optOut:"SCIP_RUST_SEMANTIC_DURABLE_SESSION=0"}}function is(n){return rs(n).transport}function ss(n,e){let t=null,r=!1,i=!1,s=!1,o=()=>t??=e(),a=()=>{i||(n.shutdown(),i=!0)},l=(f,c,p)=>{let d=us(f);r=!0;try{a()}catch{}_()&&Ae({type:"span",name:"rust.semantic.durable-session.request",durationMs:p,ok:!1,kind:c,session:"worker-fallback",reason:d})},u=(f,c,p)=>{if(s)throw new Error("Rust semantic failover session was already disposed.");if(r)return p(o());let d=performance.now();try{return c(n)}catch(y){l(y,f,performance.now()-d)}return p(o())};return{requestSemantic(f,c){return u("semantic",p=>p.requestSemantic(f,c),p=>p.requestSemantic(f,c))},requestImportDefinitions(f,c){return u("import-definitions",p=>p.requestImportDefinitions(f,c),p=>p.requestImportDefinitions(f,c))},shutdown(){if(s)return;s=!0;let f=[];try{a()}catch(c){f.push(c)}try{t?.shutdown()}catch(c){f.push(c)}if(f.length>0)throw f[0]}}}function os(n,e,t={worker:()=>as(),durable:()=>Jt(n,{serverPath:Ye(ds()),semanticWorkerPath:Ye(ar())})}){return is(e)==="durable"?ss(t.durable(),t.worker):t.worker()}function as(n={}){let e=null,t=null,r=1,i=!1,s=null,o=null,a=c=>{c&&vn(c,{recursive:!0,force:!0})},l=()=>{if(s)return;let c=e,p=t;e=null,t=null;let d=c?c.terminate():Promise.resolve(0);s=Promise.allSettled([d,Zt(p,{gracefulMs:1e3,forceMs:1e3})]).then(([y,R])=>{let S=(R.status==="fulfilled"?R.value:[{reaped:!1,detail:String(R.reason)}]).filter(M=>!M.reaped);if(y.status==="rejected"||S.length>0){o=new Error(`Rust semantic worker cleanup did not complete; ownership evidence remains at ${p??"unknown"}.`);return}a(p)}).finally(()=>{s=null})},u=()=>{if(e)return e;if(s)throw new Error("The previous Rust semantic session worker is still terminating; retry the request.");if(o)throw o;let c=n.semanticWorkerPath?Xi(n.semanticWorkerPath):ar();if(!Qi(Ye(c)))throw new Error(`Rust semantic session worker was not found at ${Ye(c)}. Run npm run build before using built semantic Rust queries.`);return t=er(Dn(nr(),"scip-query-rust-session-")),e=new es(c,n.shareEnvironment?{env:Zi}:void 0),e.unref(),e},f=()=>{let c=t??er(Dn(nr(),"scip-query-rust-session-"));return t=c,Dn(c,`${r++}.json`)};return{requestSemantic(c,p){if(i)throw new Error("Rust semantic session was already disposed.");let d=u(),y=f(),R=new SharedArrayBuffer(4),b=new Int32Array(R);if(d.postMessage({kind:"semantic",request:c,responsePath:y,sharedBuffer:R}),Atomics.wait(b,0,0,p)==="timed-out")throw l(),new Error(`Rust semantic session worker timed out after ${(p/1e3).toFixed(0)}s`);try{let M=cs(B(y,{maxBytes:H,inputKind:"Rust semantic worker response"}));if(!M.ok)throw new Error(M.error);return M.response}finally{vn(y,{force:!0})}},requestImportDefinitions(c,p){if(i)throw new Error("Rust semantic session was already disposed.");let d=u(),y=f(),R=new SharedArrayBuffer(4),b=new Int32Array(R);if(d.postMessage({kind:"import-definitions",request:c,responsePath:y,sharedBuffer:R}),Atomics.wait(b,0,0,p)==="timed-out")throw l(),new Error(`Rust semantic import-definition session worker timed out after ${(p/1e3).toFixed(0)}s`);try{let M=ls(B(y,{maxBytes:H,inputKind:"Rust import-definition worker response"}));if(!M.ok)throw new Error(M.error);return M.response}finally{vn(y,{force:!0})}},shutdown(){if(i)return;if(i=!0,!e){a(t),t=null;return}let c=f(),p=new SharedArrayBuffer(4),d=new Int32Array(p);e.postMessage({kind:"shutdown",responsePath:c,sharedBuffer:p}),Atomics.wait(d,0,0,5e3),l()}}}function cs(n){let e=JSON.parse(n);if(!e||typeof e!="object")return{ok:!1,error:"Rust semantic session worker wrote a non-object response."};let t=e;return t.ok===!0&&"response"in t?{ok:!0,response:t.response}:{ok:!1,error:typeof e.error=="string"?e.error:"Rust semantic session worker failed."}}function ls(n){let e=JSON.parse(n);if(!e||typeof e!="object")return{ok:!1,error:"Rust semantic session worker wrote a non-object response."};let t=e;return t.ok===!0&&"response"in t?{ok:!0,response:t.response}:{ok:!1,error:typeof e.error=="string"?e.error:"Rust semantic session worker failed."}}function us(n){let e=n instanceof Error?`${n.name} ${n.message}`.toLowerCase():String(n).toLowerCase();return e.includes("readiness")?"readiness":e.includes("timeout")||e.includes("timed out")?"timeout":e.includes("helper")?"helper":"request"}function ge(n){return new Map(n.map(e=>[e.symbolId,[]]))}function Re(n){return new Map(n.map(e=>[e.symbolId,[]]))}function ir(n){return new Map(n.map(e=>[e.symbolId,null]))}function xn(n,e){return new Map(n.map(t=>[t.symbolId,e.get(t.symbolId)??[]]))}function fs(n,e){return new Map(n.map(t=>[t.symbolId,e.get(t.symbolId)??null]))}function ps(n){let e=0;return n.includeReferences!==!1&&(e+=(n.referenceDefinitions??n.definitions).length),n.includeCallees===!0&&(e+=(n.calleeDefinitions??n.definitions).length),n.includeSignatures===!0&&(e+=(n.signatureDefinitions??n.definitions).length),Math.max(1,e)}function Tn(n,e){return e&&e>0?Math.max(n,e):n}function ar(){return new URL("./rust-semantic-session-worker.js",import.meta.url)}function ds(){return new URL("./rust-semantic-session-server.js",import.meta.url)}function Ve(n,e){return X(n)??e}function $e(n,e){return cr(n)??e}function cr(n){if(!n)return null;let e=Number(n);return Number.isInteger(e)&&e>=0?e:null}var Pn=15e3,En=8;function pr(n,e={}){let t=e.status??je,r=gs(n,t),i=Rs(n,t),s=bs(n,t),o=e.referenceResolver||e.calleeResolver||e.signatureResolver||!ys(e)?null:or(n,t,{fallbackReferenceResolver:r,fallbackCalleeResolver:i,fallbackSignatureResolver:s}),a=e.referenceResolver??o??r,l=e.calleeResolver??o??i,u=e.signatureResolver??o??s,f=e.importUsageResolver??Pt(e.sourceImportUsageResolver??Ss(),e.importDefinitionResolver??o),c=e.calleeSymbolResolver,p=e.sourceZeroCalleeOracle,d=e.scipOccurrenceCalleeOracle,y=new Map,R=new Map,b=null,S=null,M=()=>(b??=t(n),b),P=()=>{let g=M();return g.dependencyAvailable?S??g:g},h=g=>{if(g.length===0)return new Map;let m=Ie(g);try{let I=a.referencesForDefinitions(m),T=M();return S=Je(T,I),I.available?new Map(I.references):K(m,I.references)}catch(I){let T=M();return S=he(T,I),J(m)}},C=g=>{if(g.length===0)return new Map;let m=Ie(g),I=m.filter(lr);if(I.length===0)return G(m);let T=new Map,W=fr(I,d),F=[];for(let k of I)R.has(k.symbolId)?T.set(k.symbolId,R.get(k.symbolId)??[]):W.has(k.symbolId)?T.set(k.symbolId,W.get(k.symbolId)??[]):ur(k,p)?T.set(k.symbolId,[]):F.push(k);if(F.length===0)return ie(m,T,void 0);try{let k=l.calleesForDefinitions(F),O=M();S=Je(O,k);let E=ie(F,k.callees,c);for(let[ce,tn]of E)T.set(ce,tn);return ie(m,T,void 0)}catch(k){let O=M();return S=he(O,k),G(m)}},x=(g,m)=>{let I=Ie(g),T=Ie(m),W=T.filter(lr),F=new Map,k=fr(W,d),O=[];for(let E of W)k.has(E.symbolId)?F.set(E.symbolId,k.get(E.symbolId)??[]):ur(E,p)?F.set(E.symbolId,[]):O.push(E);if(I.length===0&&O.length===0)return{references:J(I),callees:ie(T,F,void 0)};try{let E=o?o.referencesAndCalleesForDefinitions(I,O):vs(a,l,{referenceDefinitions:I,calleeDefinitions:O}),ce=M();S=Je(ce,E);let tn=E.available?new Map(E.references):K(I,E.references);for(let[rn,sn]of E.callees)F.set(rn,sn);let Zn=ie(T,F,c);for(let[rn,sn]of Zn)R.set(rn,sn);return{references:tn,callees:Zn}}catch(E){let ce=M();return S=he(ce,E),{references:J(I),callees:G(T)}}},v=g=>{if(g.length===0)return new Map;let m=Ie(g);try{let I=u.signaturesForDefinitions(m),T=M();return S=Je(T,I),dr(m,I.signatures)}catch(I){let T=M();return S=he(T,I),Ge(m)}};return{language:"rust",availability:P,dispose:()=>{o?.dispose()},importUsage:g=>{let m=y.get(g);if(m)return m;try{let I=f.importUsage(g);return y.set(g,I),I}catch(I){let T=M();return S=he(T,I),[]}},referencesFor:g=>h([g]).get(g.symbolId)??[],referencesForDefinitions:h,referencesAndCalleesForDefinitions:x,calleesFor:g=>C([g]).get(g.symbolId)??[],calleesForDefinitions:C,signatureFor:g=>v([g]).get(g.symbolId)??null}}function Je(n,e){let t={dependencyAvailable:n.dependencyAvailable,resolvedBinary:e.resolvedBinary??n.resolvedBinary,...n.note?{note:n.note}:{}};return e.available?{available:!0,...t}:{available:!1,reason:e.reason,...t}}function he(n,e){return{available:!1,dependencyAvailable:n.dependencyAvailable,resolvedBinary:n.resolvedBinary,...n.note?{note:n.note}:{},reason:e instanceof Error?e.message:String(e)}}function ys(n){if(n.usePersistentSession!==void 0)return n.usePersistentSession;let e=process.env.SCIP_RUST_SEMANTIC_SESSION;return e!=="0"&&e!=="false"}function Ss(){return{importUsageFacts:()=>({usage:[],positions:[]})}}function Ie(n){return n.map(e=>{let t=e;return{...e,leaf:typeof t.leaf=="string"?t.leaf:V(e.symbol),parentTypeName:t.parentTypeName??null,isFunctionLike:typeof t.isFunctionLike=="boolean"?t.isFunctionLike:bt(e.symbol),isTypeLike:t.isTypeLike??!1,kind:t.kind??null,documentation:t.documentation??null,enclosingSymbol:t.enclosingSymbol??null}})}function lr(n){return n.isFunctionLike}function ur(n,e){if(!e)return!1;try{return e(n)}catch{return!1}}function fr(n,e){if(!e||n.length===0)return new Map;try{return e(n)}catch{return new Map}}function gs(n,e){return{referencesForDefinitions:t=>hs(n,e,t)}}function Rs(n,e){return{calleesForDefinitions:t=>Is(n,e,t)}}function bs(n,e){return{signaturesForDefinitions:t=>Ms(n,e,t)}}function hs(n,e,t){let r=e(n);if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:Nn(r),references:J(t)};let i=An();if(!wn(i))return{available:!1,resolvedBinary:r.resolvedBinary,reason:`Rust semantic worker was not found at ${i}. Run npm run build before using built semantic Rust queries.`,references:J(t)};let s=se(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,Pn),o=Qe(process.env.SCIP_RUST_SEMANTIC_REFERENCE_RETRY_TIMEOUT_MS,0),a=se(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,En),l=Qe(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(s,1e4)),u=be(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,{definitionCount:t.length,includeReferences:!0}),f={projectRoot:n,rustAnalyzerBinary:r.resolvedBinary,definitions:[...t],requestTimeoutMs:s,...o>0?{referenceRetryTimeoutMs:o}:{},diagnosticsTimeoutMs:l,settleDelayMs:u,concurrency:a},c=kn(process.execPath,[i],{cwd:n,input:JSON.stringify(f),encoding:"utf8",maxBuffer:50*1024*1024,timeout:Y(t.length,Tn(s,f.referenceRetryTimeoutMs),a)}),p=_n(c.stdout);if(p)return{...Fn(p),resolvedBinary:r.resolvedBinary,references:K(t,new Map(p.references),new Set(p.incompleteReferenceSymbolIds??[]))};let d=c.error instanceof Error?c.error.message:c.stderr.trim()||`Rust semantic worker exited with status ${c.status??"unknown"}.`;return{available:!1,resolvedBinary:r.resolvedBinary,reason:d,references:J(t)}}function Is(n,e,t){let r=e(n);if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:Nn(r),callees:G(t)};let i=An();if(!wn(i))return{available:!1,resolvedBinary:r.resolvedBinary,reason:`Rust semantic worker was not found at ${i}. Run npm run build before using built semantic Rust queries.`,callees:G(t)};let s=se(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,Pn),o=se(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,En),a=Qe(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(s,1e4)),l=be(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,{definitionCount:t.length,includeReferences:!1,includeCallees:!0}),u={projectRoot:n,rustAnalyzerBinary:r.resolvedBinary,definitions:[...t],requestTimeoutMs:s,diagnosticsTimeoutMs:a,settleDelayMs:l,concurrency:o,includeReferences:!1,includeCallees:!0},f=kn(process.execPath,[i],{cwd:n,input:JSON.stringify(u),encoding:"utf8",maxBuffer:50*1024*1024,timeout:Y(t.length,s,o)}),c=_n(f.stdout);if(c)return{...Fn(c),resolvedBinary:r.resolvedBinary,callees:ie(t,new Map(c.callees??[]),void 0)};let p=f.error instanceof Error?f.error.message:f.stderr.trim()||`Rust semantic worker exited with status ${f.status??"unknown"}.`;return{available:!1,resolvedBinary:r.resolvedBinary,reason:p,callees:G(t)}}function Ms(n,e,t){let r=e(n);if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:Nn(r),signatures:Ge(t)};let i=An();if(!wn(i))return{available:!1,resolvedBinary:r.resolvedBinary,reason:`Rust semantic worker was not found at ${i}. Run npm run build before using built semantic Rust queries.`,signatures:Ge(t)};let s=se(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,Pn),o=se(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,En),a=Qe(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(s,1e4)),l=be(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,{definitionCount:t.length,includeReferences:!1,includeCallees:!1,includeSignatures:!0}),u={projectRoot:n,rustAnalyzerBinary:r.resolvedBinary,definitions:[...t],requestTimeoutMs:s,diagnosticsTimeoutMs:a,settleDelayMs:l,concurrency:o,includeReferences:!1,includeCallees:!1,includeSignatures:!0},f=kn(process.execPath,[i],{cwd:n,input:JSON.stringify(u),encoding:"utf8",maxBuffer:50*1024*1024,timeout:Y(t.length,s,o)}),c=_n(f.stdout);if(c)return{...Fn(c),resolvedBinary:r.resolvedBinary,signatures:dr(t,new Map(c.signatures??[]))};let p=f.error instanceof Error?f.error.message:f.stderr.trim()||`Rust semantic worker exited with status ${f.status??"unknown"}.`;return{available:!1,resolvedBinary:r.resolvedBinary,reason:p,signatures:Ge(t)}}function vs(n,e,t){let r=t.referenceDefinitions.length>0?n.referencesForDefinitions(t.referenceDefinitions):{available:!0,references:J(t.referenceDefinitions)},i=t.calleeDefinitions.length>0?e.calleesForDefinitions(t.calleeDefinitions):{available:!0,callees:G(t.calleeDefinitions)},s={resolvedBinary:r.resolvedBinary??i.resolvedBinary,references:r.references,callees:i.callees};return r.available&&i.available?{available:!0,...s}:{available:!1,reason:(r.available?void 0:r.reason)??(i.available?void 0:i.reason)??"Rust semantic resolution was unavailable.",...s}}function J(n){return new Map(n.map(e=>[e.symbolId,[]]))}function G(n){return new Map(n.map(e=>[e.symbolId,[]]))}function Ge(n){return new Map(n.map(e=>[e.symbolId,null]))}function ie(n,e,t){let r=0,i=0;return w("rust.semantic.callees.complete-map",()=>{let s=new Map;for(let o of n){let a=e.get(o.symbolId)??[];a.length>0&&(r+=1),i+=a.length,s.set(o.symbolId,a.map(l=>({...l,symbol:t?t(l):l.symbol})))}return s},()=>({definitions:n.length,rows:r,callees:i,resolveSymbols:!!t}))}function dr(n,e){return new Map(n.map(t=>[t.symbolId,e.get(t.symbolId)??null]))}function An(){return ms(new URL("./rust-semantic-worker.js",import.meta.url))}function Fn(n){return n.available?{available:!0}:{available:!1,reason:n.reason}}function Nn(n){return n.available?"rust-analyzer binary path is unavailable.":n.reason}function _n(n){try{let e=JSON.parse(n);if(!e||typeof e!="object")return null;let t=e;if(typeof t.available!="boolean"||!Array.isArray(t.references)||t.available===!1&&typeof t.reason!="string"||t.available===!0&&t.reason!==void 0)return null;let r={references:t.references,incompleteReferenceSymbolIds:Array.isArray(t.incompleteReferenceSymbolIds)?t.incompleteReferenceSymbolIds.filter(i=>typeof i=="number"):void 0,callees:Array.isArray(t.callees)?t.callees:void 0,signatures:Array.isArray(t.signatures)?t.signatures:void 0};return t.available===!0?{available:!0,...r}:{available:!1,reason:String(t.reason),...r}}catch{return null}}function se(n,e){return X(n)??e}function Qe(n,e){if(!n)return e;let t=Number(n);return Number.isInteger(t)&&t>=0?t:e}import{existsSync as Ds}from"fs";import{deserializeSCIP as xs,SymbolRole as Cs}from"@c4312/scip";var Ln=new WeakMap;function yr(n,e){let t=e.filter(Ts);if(t.length===0)return new Map;let r=!1,i=0,s=0;return w("rust.scip-occurrence.callees",()=>{let o=Ps(n);if(r=!!o,!o)return new Map;let a=new Map;for(let l of t){let u=ks(n,o,l);u!==null&&(a.set(l.symbolId,u),i+=1,s+=u.length)}return a},()=>({definitions:e.length,candidates:t.length,indexAvailable:r,resolvedDefinitions:i,resolvedCallees:s}))}function Ts(n){return!(!n.symbol.startsWith("rust-analyzer ")||!n.relativePath.endsWith(".rs")||!n.isFunctionLike||n.leaf==="main"||de(n.symbol))}function ks(n,e,t){let r=Fe(n,t.relativePath);if(!r||r.language!=="rust")return null;let i=r.callables.find(u=>u.startLine!==t.startLine||u.endLine!==t.endLine?!1:u.name===t.leaf||t.leaf.endsWith(u.name)||u.name.endsWith(t.leaf));if(!i)return null;let s=r.callSites.filter(u=>u.line>=i.startLine&&u.line<=i.endLine);if(s.length===0)return null;let o=(e.occurrencesByFile.get(t.relativePath)??[]).filter(u=>u.line>=i.startLine&&u.line<=i.endLine&&u.callee.symbol!==t.symbol);if(o.some(u=>u.traitImplMember)||!ws(s,o))return null;let a=[],l=new Set;for(let u of o){let f=`${u.callee.symbol}\0${u.callee.file}\0${u.callee.line}`;l.has(f)||(l.add(f),a.push(u.callee))}return a}function ws(n,e){let t=mr(n),r=mr(e);if(t.size!==r.size)return!1;for(let[i,s]of t)if(r.get(i)!==s)return!1;return!0}function mr(n){let e=new Map;for(let t of n){let r=t.calleeLeaf??t.leaf;if(!r)continue;let i=`${t.line}\0${r}`;e.set(i,(e.get(i)??0)+1)}return e}function Ps(n){if(Ln.has(n))return Ln.get(n)??null;let e=Es(n);return Ln.set(n,e),e}function Es(n){if(!n.generation.indexPath||!Ds(n.generation.indexPath))return null;try{let e=_e(n).filter(s=>s.symbol.startsWith("rust-analyzer ")&&s.relativePath.endsWith(".rs")&&s.isFunctionLike),t=new Map(e.map(s=>[s.symbol,s])),r=xs(ke(n.generation.indexPath,{inputKind:"SCIP occurrence-callee index",maxBytes:Te})),i=new Map;for(let s of r.documents??[]){let o=s.relativePath;if(!o||!o.endsWith(".rs")||n.isIgnored(o))continue;let a=[];for(let l of s.occurrences??[]){if(!l.symbol||(l.symbolRoles&Cs.Definition)!==0)continue;let u=t.get(l.symbol);if(!u)continue;let f=l.range?.[0];Number.isInteger(f)&&a.push({line:f,leaf:u.leaf,traitImplMember:de(u.symbol),callee:{symbol:u.symbol,file:u.relativePath,line:u.startLine,callsiteLine:f}})}i.set(o,a)}return{occurrencesByFile:i}}catch{return null}}var Xe=class{sessions=new WeakMap;getOrCreate(e,t,r){let i=As(e,t),s=this.sessions.get(e);s||(s=new Map,this.sessions.set(e,s));let o=s.get(i);if(o)return o.hits+=1,o.lastUsedAtMs=Date.now(),o.provider;let a=Date.now(),l=r();return s.set(i,{key:i,language:t,projectRoot:e.config.projectRoot,provider:l,createdAtMs:a,lastUsedAtMs:a,hits:1}),l}sessionsFor(e){return[...this.sessions.get(e)?.values()??[]]}clear(e){let t=this.sessions.get(e);if(t)for(let r of t.values())r.provider.dispose?.();this.sessions.delete(e)}};function As(n,e){return`${n.config.projectRoot}:${e}-workspace`}import{randomUUID as io}from"crypto";import{existsSync as so}from"fs";import{dirname as oo}from"path";function Sr(n){if(!n||typeof n!="object"||Array.isArray(n))return null;let e=n;if(typeof e.available!="boolean"||e.dependencyAvailable!==void 0&&typeof e.dependencyAvailable!="boolean"||e.tsconfigPath!==void 0&&typeof e.tsconfigPath!="string"||e.tsconfigPaths!==void 0&&(!Array.isArray(e.tsconfigPaths)||!e.tsconfigPaths.every(t=>typeof t=="string"))||e.resolvedBinary!==void 0&&typeof e.resolvedBinary!="string"||e.note!==void 0&&typeof e.note!="string")return null;if(e.available===!0){if(e.reason!==void 0)return null}else if(typeof e.reason!="string"||e.reason.length===0)return null;return e}import{performance as D}from"perf_hooks";function L(n,e,t){if(n.has(e))return n.get(e);let r=t();return n.set(e,r),r}import br from"path";import{realpathSync as gr}from"fs";function Fs(n,e){return n.getReferences().map(t=>{let r=t.getNode();return Ze(r,e)})}function Ns(n){let e=n;return typeof e.findReferences=="function"?e.findReferences():[]}function hr(n,e,t,r){let i=[];for(let s of Ns(n))for(let o of Fs(s,r))o.file===e.relativePath&&o.line>=e.startLine&&o.line<=e.endLine||i.push(o);for(let s of t)i.push(s);return oe(i)}function Ir(n,e,t,r){let i=[],s=t?.getStart();for(let o of n.getReferences()){let a=o.getNode();ae(r,a.getSourceFile().getFilePath())===e&&(s!==void 0&&a.getStart()===s||i.push({location:Ze(a,r),node:a}))}return i}function Ze(n,e){let t=n.getSourceFile(),r=t.getLineAndColumnAtPos(n.getStart());return{file:ae(e,t.getFilePath())??t.getBaseName(),line:r.line-1,column:r.column-1}}function Mr(n,e,t){let r=n.getSourceFile(),i=Un(r,n),s=n.getText(),o=new RegExp(`\\b${pe(s)}\\b`,"g"),a=r.getFullText().split(`
|
|
2
|
-
`),l=[];for(let u=0;u<a.length;u++){if(u===i)continue;let f=a[u]??"";o.lastIndex=0;let c;for(;(c=o.exec(f))!==null;)l.push({file:e,line:u,column:c.index})}return oe(l.filter(u=>ae(t,br.join(t,u.file))===e))}function On(n){for(let e=n;e;e=e.getParent()){let t=e.getKindName();if(t.includes("Type")||t==="InterfaceDeclaration"||t==="TypeAliasDeclaration")return!0;if(t==="CallExpression"||t==="NewExpression"||t==="ExpressionStatement")return!1}return!1}function Un(n,e){return n.getLineAndColumnAtPos(e.getStart()).line-1}function oe(n){let e=new Set,t=[];for(let r of n){let i=`${r.file}:${r.line}:${r.column}`;e.has(i)||(e.add(i),t.push(r))}return t}function ae(n,e){let t=n||process.cwd(),r=Rr(t,e);if(r)return r;try{return Rr(gr(t),gr(e))}catch{return null}}function Rr(n,e){let t=br.relative(n,e).replace(/\\/g,"/");return!t||t===".."||t.startsWith("../")?null:t}function vr(n,e,t,r){let i=_s(e,r);return i.size===0?new Map:Ls(n,t,i)}function _s(n,e){let t=new Map;for(let r of z(n,e)){let i=V(r.symbol)??r.leaf;if(!i)continue;let s=t.get(i);s||(s=[],t.set(i,s)),s.push(r)}return t}function Ls(n,e,t){let r=new Map,i=new Map;return e.forEachDescendant(s=>{for(let o of Os(n,s)){let a=t.get(o);if(!a)continue;let l=Un(e,s);for(let u of a){if(l<u.startLine-1||l>u.endLine+1)continue;let f=Math.abs(l-u.startLine),c=i.get(u.symbolId);c!==void 0&&c<=f||(i.set(u.symbolId,f),r.set(u.symbolId,s))}}}),r}function Os(n,e){let t=[],r=i=>{i&&!t.includes(i)&&t.push(i)};if("getNameNode"in e&&typeof e.getNameNode=="function"){let i=e.getNameNode();r(i?.getText())}if("getName"in e&&typeof e.getName=="function"){let i=e.getName();r(i)}return n.Node.isIdentifier(e)&&r(e.getText()),t}var Us=at("ts-definition-leaf-candidates",{clearGroups:["definition-catalog"]});function Dr(n,e,t,r){let i=jn(n,e),s=Bn(i.get(r)??[],t);if(s)return s;let o=[];for(let a of i.values())for(let l of a)((l.leaf||V(l.symbol)||"").includes(r)||l.symbol.includes(r))&&o.push(l);return Bn(o,t)}function qn(n,e,t,r){return Bn(jn(n,e).get(r)??[],t)}function xr(n,e){let t=new Map;for(let[r,i]of jn(n,e)){let s=i[0];s&&t.set(r,s)}return t}function jn(n,e){return Us.get(n,e,()=>{let t=new Map;for(let r of z(n,e)){let i=r.leaf||V(r.symbol);if(!i)continue;let s=t.get(i);s||(s=[],t.set(i,s)),s.push({...r,leaf:i})}for(let r of t.values())r.sort((i,s)=>i.startLine-s.startLine||i.endLine-s.endLine||i.symbolId-s.symbolId);return t})}function Bn(n,e){let t=null,r=Number.POSITIVE_INFINITY;for(let i of n){let s=Math.abs(i.startLine-e);(s<r||s===r&&t&&i.startLine<t.startLine)&&(t=i,r=s)}return t}import Bs from"path";import{realpathSync as qs}from"fs";function Cr(n,e){let t=new Map,r=null,i=null,s=()=>(i??=Ee(n,{extensions:Ue}),i),o=()=>(r??=w("typescript.source-file-index",()=>js(n.config.projectRoot,e,s()),()=>({projects:e.length,indexedDocuments:s().length})),r),a=l=>ne(l)?L(t,l,()=>{let u=Tr(n.config.projectRoot,l);if(!u)return null;for(let{project:f,sourceFiles:c}of o()){let p=c.get(u)??null;if(p||(p=f.addSourceFileAtPathIfExists(u)??null,p&&Wn(c,p)),p)return{project:f,sourceFile:p}}return null}):null;return{sourceFile:l=>a(l)?.sourceFile??null,sourceFileMatch:a,indexedTypeScriptLikeDocuments:s}}function js(n,e,t){let r=e.map(({project:i})=>{let s=new Map;for(let o of i.getSourceFiles())Wn(s,o);return{project:i,sourceFiles:s}});for(let i of t){let s=Tr(n,i);if(s)for(let o of r){if(o.sourceFiles.has(s))break;let a=o.project.addSourceFileAtPathIfExists(s)??null;if(a){Wn(o.sourceFiles,a);break}}}return r}function Wn(n,e){let t=zn(e.getFilePath());n.set(t,e);try{n.set(zn(qs(t)),e)}catch(r){if(!ue(r))throw r}}function Tr(n,e){try{return zn(rt(n,e,{inputKind:"indexed TypeScript source file"}).absolutePath)}catch(t){if(!ue(t))throw t;return null}}function zn(n){return Bs.resolve(n)}function Kn(n,e){for(let t of n)if(e===t.name||e.startsWith(`${t.name}/`))return t.name;return null}function kr(n){let e=`${n.relativeDir}/src`;return[`${e}/index.ts`,`${e}/index.tsx`,`${e}/index.mts`,`${e}/index.cts`]}import{existsSync as Me}from"fs";import A from"path";var Hn=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"];function Vn(n,e){let r=e?A.dirname(A.join(n,e)):n,i=A.resolve(n);for(;r.startsWith(i);){for(let o of Hn){let a=A.join(r,o);if(Me(a))return a}let s=A.dirname(r);if(s===r)break;r=s}for(let s of Hn){let o=A.join(n,s);if(Me(o))return o}return null}function wr(n){let e=n.config.projectRoot,t=new Set(Ws(e,n.config.semantic?.typescript?.tsconfigs)),r=Ee(n,{includeIgnored:!1,extensions:Ue});for(let i of r){let s=Vn(e,i);s&&t.add(A.resolve(s))}if(t.size===0){let i=Vn(e);i&&t.add(A.resolve(i))}return[...t].filter(i=>!Pr(e,i)).sort((i,s)=>i.localeCompare(s))}function Ws(n,e=[]){let t=new Set;for(let r of e){let i=A.isAbsolute(r)?r:A.join(n,r);Me(i)&&t.add(A.resolve(i))}for(let r of zs(n))for(let i of Hn){let s=A.join(r,i);Me(s)&&t.add(A.resolve(s))}if(t.size===0){let r=Vn(n);r&&t.add(A.resolve(r))}return[...t].filter(r=>!Pr(n,r)).sort((r,i)=>r.localeCompare(i))}function zs(n){let e=A.join(n,"package.json");if(!Me(e))return[];let t;try{t=JSON.parse(nt(e,"project package manifest"))}catch{return[]}return(Array.isArray(t.workspaces)?t.workspaces:t.workspaces?.packages??[]).flatMap(i=>pt(n,i))}function Pr(n,e){let t=A.relative(n,e).replace(/\\/g,"/");return t.startsWith("..")||t.includes("/node_modules/")||t.startsWith("node_modules/")||t.includes("/dist/")||t.startsWith("dist/")}var Ks=32;function Lr(n,e){let t=w("typescript.provider.load",()=>xt());if(!t)return Be("ts-morph is not installed");let r=w("typescript.provider.tsconfig-discovery",()=>wr(n));if(r.length===0)return Be("no tsconfig found");try{let i=w("typescript.provider.project-bundles",()=>Ct(t,r),()=>({tsconfigs:r.length}));return Hs(n,t,i)}catch(i){return Be(i instanceof Error?i.message:String(i),r[0],r)}}function Hs(n,e,t,r={}){return w("typescript.provider.construct",()=>new $n(n,e,t),()=>({tsconfigs:t.length,reusedProjects:r.reusedProjects===!0}))}var $n=class{constructor(e,t,r){this.db=e;this.tsMorph=t;this.projects=r;this.workspacePackages=ft(e.config.projectRoot),this.sourceFiles=Cr(e,r)}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(e=>e.tsconfigPath)}}importUsage(e){return L(this.importUsageCache,e,()=>{let t=this.sourceFiles.sourceFile(e);if(!t)return[];let r=$s();return w("typescript.import-usage.file",()=>this.importUsageForSourceFile(e,t,r),()=>({file:e,...r}))})}referencesFor(e){return L(this.referencesCache,e.symbolId,()=>{let t=this.nodeForDefinition(e);return this.referencesForDefinitionNode(e,t)})}referencesForDefinitions(e,t={}){let r=new Map,i=_(),s=[];for(let f of e){let c=this.referencesCache.get(f.symbolId);c?r.set(f.symbolId,c):s.push(f)}if(s.length===0)return r;let o=s,a=t.exact?[]:s.filter(f=>!Ar(f));if(a.length>=Ks){let f=this.referencesForDefinitionsBySymbolScan(a);for(let c of a){let p=f.get(c.symbolId)??[];this.referencesCache.set(c.symbolId,p),r.set(c.symbolId,p)}if(o=s.filter(c=>Ar(c)),o.length===0)return r}let l=new Map;for(let f of o){let c=l.get(f.relativePath);c?c.push(f):l.set(f.relativePath,[f])}let u=[];for(let[f,c]of l){let p=Fr();w("typescript.references-map.file",()=>{let d=this.definitionNodesForFile(f);for(let y of c){i&&(p.cacheMisses+=1);let R=d.get(y.symbolId)??null;i&&(R?p.nodeHits+=1:p.nodeMisses+=1);try{let b=this.referencesForDefinitionNode(y,R,i?p:void 0);this.referencesCache.set(y.symbolId,b),r.set(y.symbolId,b)}catch{p.preciseSearchFailures+=1,u.push(y)}}},()=>({relativePath:f,definitions:c.length,...Nr(p)}))}if(u.length>0){let f=this.referencesForDefinitionsBySymbolScan(u);for(let c of u){let p=f.get(c.symbolId)??[];this.referencesCache.set(c.symbolId,p),r.set(c.symbolId,p)}}return r}referenceFragmentsForFiles(e){let t=_e(this.db).filter(s=>ne(s.relativePath)),r=e.filter(s=>this.sourceFiles.sourceFile(s)!==null),i=this.referencesForDefinitionsBySymbolScan(t,r);return Tt(t,i,r)}referencesForDefinitionsBySymbolScan(e,t){let r=_(),i=Fr(),s=new Map,o=new Set(e.map(l=>l.symbolId)),a=new Map(e.map(l=>[l.symbolId,l]));for(let l of e)s.set(l.symbolId,[]);return w("typescript.references-map.inverted-scan",()=>{let l=r?D.now():0,u=t?this.packageImportReferencesForFiles(t):this.packageImportReferences();for(let b of e){let S=u.get(b.symbolId)??[];if(S.length>0){let M=s.get(b.symbolId)??[];M.push(...S),s.set(b.symbolId,M)}r&&(i.packageReferenceCount+=S.length)}r&&(i.packageRefsMs+=D.now()-l);let f=new Map,c=new Map,p=this.hierarchyTargetsForDefinitions(e),d=new Set(e.map(b=>b.leaf).filter(Boolean)),y=r?D.now():0;for(let b of t??this.sourceFiles.indexedTypeScriptLikeDocuments()){if(this.db.isIgnored(b))continue;let S=this.sourceFiles.sourceFile(b);S&&(r&&(i.scanFiles+=1),this.addReferencesFromSourceFileScan(S,b,o,a,p,d,f,c,s,r?i:void 0))}r&&(i.scanMs+=D.now()-y);let R=r?D.now():0;this.addHierarchyMemberReferences(e,s,r?i:void 0),r&&(i.hierarchyMs+=D.now()-R);for(let[b,S]of s){let M=oe(S);s.set(b,M),r&&(i.referenceCount+=M.length)}},()=>({definitions:e.length,...Nr(i)})),s}addReferencesFromSourceFileScan(e,t,r,i,s,o,a,l,u,f){let c=this.compilerCheckerForSourceFile(e),p=e.compilerNode,d=Gs(e),y=R=>{if(this.tsMorph.ts.isIdentifier(R)){if(f&&(f.identifiers+=1),!o.has(R.text)&&!d.has(R.text)){this.tsMorph.ts.forEachChild(R,y);return}let b=this.compilerReferenceSymbol(c,R,f);if(b){let S;a.has(b)?S=a.get(b)??null:(S=this.referenceDefinitionFromCompilerSymbol(b),a.set(b,S)),f&&(S?f.targetHits+=1:f.targetMisses+=1);let M=L(l,b,()=>this.compilerSymbolKeys(b)),P=null,h=null,C=S&&r.has(S.symbolId)?i.get(S.symbolId):void 0;if(C&&(P=en(p,R),!Er(C,t,P))){let x=p.getLineAndCharacterOfPosition(R.getStart(p));h={file:t,line:x.line,column:x.character};let v=u.get(C.symbolId)??[];v.push(h),u.set(C.symbolId,v),f&&(f.requestedHits+=1)}for(let x of M)for(let v of s.get(x)?.values()??[]){if(P??=en(p,R),Er(v,t,P))continue;if(!h){let m=p.getLineAndCharacterOfPosition(R.getStart(p));h={file:t,line:m.line,column:m.character}}let g=u.get(v.symbolId)??[];g.push(h),u.set(v.symbolId,g),f&&(f.requestedHits+=1)}}}this.tsMorph.ts.forEachChild(R,y)};y(p)}hierarchyTargetsForDefinitions(e){let t=new Map;for(let r of e){let i=this.nodeForDefinition(r),s=i?.compilerNode;if(!s||!this.isHierarchyMethod(s))continue;let o=s.parent;if(!this.isHierarchyContainer(o))continue;let a=this.compilerCheckerForSourceFile(i.getSourceFile()),l=a.getSymbolAtLocation(s.name);if(l)for(let u of this.hierarchyMemberSymbols(a,o,l))for(let f of this.compilerSymbolKeys(u)){let c=t.get(f)??new Map;c.set(r.symbolId,r),t.set(f,c)}}return t}hierarchyMemberSymbols(e,t,r){let i=new Set,s=new Set,o=(a,l,u)=>{if(!s.has(a)){s.add(a),i.add(l);for(let f of u){let c=f.getProperty(r.name);c&&o(f,c,this.hierarchyAncestorTypesForType(e,f))}}};return o(e.getTypeAtLocation(t),r,this.hierarchyAncestorTypes(e,t)),i}addHierarchyMemberReferences(e,t,r){let i=new Map;for(let s of e){let o=this.nodeForDefinition(s),a=o?.compilerNode;if(!a||!this.isHierarchyMethod(a))continue;let l=a.parent;if(!this.isHierarchyContainer(l))continue;let u=this.compilerCheckerForSourceFile(o.getSourceFile()),f=u.getSymbolAtLocation(a.name);if(!f)continue;let c=a.getSourceFile(),p=c.getLineAndCharacterOfPosition(a.name.getStart(c)),d={definition:s,location:{file:s.relativePath,line:p.line,column:p.character}},y=t.get(s.symbolId)??[];for(let b of this.hierarchyMemberSymbols(u,l,f))if(b!==f)for(let S of this.compilerSymbolLocations(b))y.push(S),r&&(r.hierarchyReferences+=1);t.set(s.symbolId,y);let R=this.hierarchyRootMemberSymbols(u,l,f);for(let b of R){let S=i.get(b)??new Map;S.set(s.symbolId,d),i.set(b,S)}r&&(r.hierarchyDefinitions+=1)}for(let s of i.values())if(!(s.size<2)){r&&(r.hierarchyFamilies+=1);for(let{definition:o}of s.values()){let a=t.get(o.symbolId)??[];for(let l of s.values())l.definition.symbolId!==o.symbolId&&(a.push(l.location),r&&(r.hierarchyReferences+=1));t.set(o.symbolId,a)}}}hierarchyRootMemberSymbols(e,t,r){let i=new Set,s=new Set,o=(a,l,u)=>{if(s.has(a))return;s.add(a);let f=!1;for(let c of u){let p=c.getProperty(r.name);p&&(f=!0,o(c,p,this.hierarchyAncestorTypesForType(e,c)))}if(!f)for(let c of this.compilerSymbolKeys(l))i.add(c)};return o(e.getTypeAtLocation(t),r,this.hierarchyAncestorTypes(e,t)),i}compilerSymbolKeys(e){return(e.declarations??[]).map(t=>{let r=t.getSourceFile();return`${r.fileName}\0${t.getStart(r)}\0${e.name}`})}compilerSymbolLocations(e){let t=[];for(let r of e.declarations??[]){let i=r.getSourceFile(),s=ae(this.db.config.projectRoot,i.fileName);if(!s)continue;let o=r.name,a=i.getLineAndCharacterOfPosition((o??r).getStart(i));t.push({file:s,line:a.line,column:a.character})}return t}baseTypes(e,t){try{return e.getBaseTypes(t)??[]}catch{return[]}}hierarchyAncestorTypes(e,t){let r=new Set(this.hierarchyAncestorTypesForType(e,e.getTypeAtLocation(t)));for(let i of t.heritageClauses??[])for(let s of i.types)r.add(e.getTypeAtLocation(s));return[...r]}hierarchyAncestorTypesForType(e,t){let r=new Set(this.baseTypes(e,t));for(let i of t.getSymbol()?.declarations??[])if(this.isHierarchyContainer(i))for(let s of i.heritageClauses??[])for(let o of s.types)r.add(e.getTypeAtLocation(o));return[...r]}isHierarchyMethod(e){return this.tsMorph.ts.isMethodDeclaration(e)||this.tsMorph.ts.isMethodSignature(e)}isHierarchyContainer(e){return this.tsMorph.ts.isClassDeclaration(e)||this.tsMorph.ts.isClassExpression(e)||this.tsMorph.ts.isInterfaceDeclaration(e)}compilerReferenceSymbol(e,t,r){r&&(r.symbolLookups+=1);let i=e.getSymbolAtLocation(t);if(i){if((i.flags&this.tsMorph.ts.SymbolFlags.Alias)===0)return i;try{return r&&(r.aliasResolutions+=1),e.getAliasedSymbol(i)}catch{return i}}}calleesFor(e){return L(this.calleesCache,e.symbolId,()=>L(this.fileCalleesCache,e.relativePath,()=>this.calleeMapForFile(e.relativePath)).get(e.symbolId)??[])}calleesForDefinitions(e){let t=new Map,r=new Map;for(let i of e){let s=r.get(i.relativePath);s?s.push(i):r.set(i.relativePath,[i])}for(let[i,s]of r){let o=this.fileCalleesCache.get(i),a=new Set(s.map(u=>u.symbolId)),l=o??this.calleeMapForFile(i,a);for(let u of s){let f=l.get(u.symbolId)??[];this.calleesCache.set(u.symbolId,f),t.set(u.symbolId,f)}}return t}referencesForDefinitionNode(e,t,r){let i=r?D.now():0,s=this.packageImportReferencesForDefinition(e);if(r&&(r.packageRefsMs+=D.now()-i,r.packageReferenceCount+=s.length),!t)return s;let o=r?D.now():0,a=hr(t,e,s,this.db.config.projectRoot);return r&&(r.semanticRefsMs+=D.now()-o,r.referenceCount+=a.length),a}signatureFor(e){return L(this.signatureCache,e.symbolId,()=>{let t=this.nodeForDefinition(e);if(!t||!this.tsMorph.Node.isFunctionDeclaration(t)&&!this.tsMorph.Node.isMethodDeclaration(t)&&!this.tsMorph.Node.isArrowFunction(t)&&!this.tsMorph.Node.isFunctionExpression(t)&&!this.tsMorph.Node.isConstructorDeclaration(t))return null;let r=t.getType().getCallSignatures()[0];if(!r)return null;let i=r.getParameters().map(o=>{let a=o.getDeclarations()[0],l=a?o.getTypeAtLocation(a).getText(a):o.getValueDeclaration()?.getType().getText()??"unknown";return _r(l)}),s=r.getReturnType().getText(t);return`(${i.join(",")})=>${_r(s)}`})}importUsageForSourceFile(e,t,r){let i=[],s=new Map;for(let o of t.getImportDeclarations()){r.declarations+=1;let a=ln(this.db,e,o.getModuleSpecifierValue()),l=o.getImportClause()?.isTypeOnly()??!1;for(let u of Yn(o)){r.entries+=1;let f=l?null:u.identifier?.getSymbol()?.compilerSymbol??null;!l&&u.identifier&&(f?r.bindingSymbols+=1:r.missingBindingSymbols+=1);let c={sourcePath:a,entry:u,typeOnlyDeclaration:l,bindingSymbol:f,references:[]};if(i.push(c),l||!u.localName||!f)continue;let p=s.get(u.localName);p?p.push(c):s.set(u.localName,[c])}}return s.size>0&&t.forEachDescendant(o=>{if(o.getKindName()!=="Identifier")return;let a=s.get(o.getText());if(!a||Ys(o))return;r.scannedIdentifiers+=1;let l=o.getSymbol()?.compilerSymbol;if(r.symbolLookups+=1,!!l){for(let u of a)if(u.bindingSymbol===l){u.references.push({location:Ze(o,this.db.config.projectRoot),node:o}),r.matchedReferences+=1;break}}}),i.map(o=>o.typeOnlyDeclaration?Vs(e,o.sourcePath,o.entry):o.entry.identifier&&!o.bindingSymbol?(r.fallbackEntries+=1,this.valueImportUsageForEntry(e,o.sourcePath,o.entry)):this.valueImportUsageFromLocations(e,o.sourcePath,o.entry,o.references))}valueImportUsageForEntry(e,t,r){let i=r.identifier?r.identifier.findReferences():[],s=[];for(let o of i)for(let a of Ir(o,e,r.identifier,this.db.config.projectRoot))s.push(a);return this.valueImportUsageFromLocations(e,t,r,s)}valueImportUsageFromLocations(e,t,r,i){let s=i.some(l=>!On(l.node)),o=i.some(l=>On(l.node)),a=r.isTypeOnly;return{importer:e,sourcePath:t,importedName:r.importedName,localName:r.localName,kind:r.kind,isTypeOnly:a,isUsed:a||i.length>0,isTypeUsed:a||o,isValueUsed:s,references:i.map(l=>l.location)}}packageImportReferencesForDefinition(e){return this.packageImportReferences().get(e.symbolId)??[]}packageImportReferencesForFiles(e){let t=new Map,r=new Set;for(let s of e){let o=this.sourceFiles.sourceFile(s);if(o)for(let a of o.getImportDeclarations()){let l=Kn(this.workspacePackages,a.getModuleSpecifierValue());l&&r.add(l)}}if(r.size===0)return t;let i=this.packageExportsForNames(r);for(let s of e)this.addPackageImportReferencesForDocument(t,i,s);for(let[s,o]of t)t.set(s,oe(o));return t}packageImportReferences(){if(this.packageImportReferenceIndex)return this.packageImportReferenceIndex;let e=new Map,t=this.packageExports();for(let r of this.sourceFiles.indexedTypeScriptLikeDocuments())this.addPackageImportReferencesForDocument(e,t,r);for(let[r,i]of e)e.set(r,oe(i));return this.packageImportReferenceIndex=e,e}addPackageImportReferencesForDocument(e,t,r){if(this.db.isIgnored(r))return;let i=this.sourceFiles.sourceFileMatch(r);if(i)for(let s of i.sourceFile.getImportDeclarations())this.addPackageImportReferencesForDeclaration(e,t,r,s)}addPackageImportReferencesForDeclaration(e,t,r,i){let s=Kn(this.workspacePackages,i.getModuleSpecifierValue());if(!s)return;let o=t.get(s);if(o)for(let a of Yn(i)){if(a.kind!=="named"||!a.identifier)continue;let l=o.get(a.importedName);if(!l||l.size===0)continue;let u=Mr(a.identifier,r,this.db.config.projectRoot);u.length>0&&eo(e,l,u)}}packageExports(){return this.packageExportIndex?this.packageExportIndex:(this.packageExportIndex=this.packageExportsForNames(new Set(this.workspacePackages.map(e=>e.name))),this.packageExportIndex)}packageExportsForNames(e){let t=new Map;for(let r of this.workspacePackages){if(!e.has(r.name))continue;let i=new Map;for(let s of kr(r))this.collectPackageExports(r,s,i,new Set);i.size>0&&t.set(r.name,i)}return t}collectPackageExports(e,t,r,i){if(i.has(t))return;i.add(t);let s=this.sourceFiles.sourceFile(t);if(s)for(let o of s.getExportDeclarations()){let a=o.getModuleSpecifierValue(),l=a?ln(this.db,t,a):t;if(!l||!l.startsWith(`${e.relativeDir}/src/`))continue;let u=o.getNamedExports();if(u.length===0){if(o.isNamespaceExport())continue;this.collectPackageExports(e,l,r,i);continue}for(let f of u){let c=f.getNameNode().getText(),p=f.getAliasNode()?.getText()??c,d=this.indexedDefinitionByLeaf(l,c);if(!d)continue;let y=r.get(p);y||(y=new Set,r.set(p,y)),y.add(d.symbolId)}}}indexedDefinitionByLeaf(e,t){return L(this.indexedDefinitionLeafCache,e,()=>xr(this.db,e)).get(t)??null}nodeForDefinition(e){return L(this.definitionNodeCache,e.symbolId,()=>this.definitionNodesForFile(e.relativePath).get(e.symbolId)??null)}definitionNodesForFile(e){return L(this.fileDefinitionNodeCache,e,()=>{let t=this.sourceFiles.sourceFile(e);return t?vr(this.tsMorph,this.db,t,e):new Map})}referenceDefinitionFromCompilerSymbol(e){return this.definitionFromCompilerSymbol(e,void 0,!0)}definitionFromCompilerSymbol(e,t,r=!1){let i=e.name,s=t?D.now():0,o=e.declarations??[];t&&(t.declarationsMs+=D.now()-s,t.declarationChecks+=o.length);for(let a of o){let l=t?D.now():0,u=a.getSourceFile(),f=ae(this.db.config.projectRoot,u.fileName),c=u.getLineAndCharacterOfPosition(a.getStart(u)).line;if(t&&(t.declarationLocationMs+=D.now()-l),!f||this.db.isIgnored(f))continue;let p=t?D.now():0,d=this.compilerDeclarationName(a),y=r?qn(this.db,f,c,i)??(d&&d!==i?qn(this.db,f,c,d):null):Dr(this.db,f,c,i);if(t&&(t.indexedLookupMs+=D.now()-p),y)return{symbolId:y.symbolId,symbol:y.symbol,file:y.relativePath,line:y.startLine}}return null}compilerDeclarationName(e){let t=e.name;return t&&this.tsMorph.ts.isIdentifier(t)?t.text:null}calleeMapForFile(e,t){let r=_(),i=0,s=0,o=0,a=0,l=0,u=0,f=0,c=0,p=r?Xs():void 0;return w("typescript.callee-map.file",()=>{let d=r?D.now():0,y=this.sourceFiles.sourceFile(e);if(r&&(l=Math.round(D.now()-d)),!y)return new Map;let R=r?D.now():0,b=z(this.db,e).sort((g,m)=>g.startLine-m.startLine||m.endLine-g.endLine);if(r&&(u=Math.round(D.now()-R)),i=b.length,b.length===0)return new Map;let S=new Map,M=r?D.now():0,P=this.compilerCheckerForSourceFile(y),h=y.compilerNode;r&&(f=Math.round(D.now()-M));let C=new Map,x=g=>{if(this.tsMorph.ts.isCallExpression(g)||this.tsMorph.ts.isNewExpression(g)){r&&(s+=1);let m=this.semanticCalleeForCallNode(P,h,b,g,C,t,p);m&&(r&&(o+=1),Js(S,m.callerId,m.target))}this.tsMorph.ts.forEachChild(g,x)},v=r?D.now():0;x(h),r&&(c=Math.round(D.now()-v));for(let[g,m]of S)S.set(g,no(m));return a=S.size,S},()=>({relativePath:e,definitions:i,callNodes:s,resolvedCallees:o,outputRows:a,requestedDefinitions:t?.size??i,sourceFileLookupMs:l,definitionsLoadMs:u,checkerLookupMs:f,traversalMs:c,...p?Zs(p):{}}))}semanticCalleeForCallNode(e,t,r,i,s,o,a){let l=a?D.now():0,u=Qs(r,en(t,i));if(a&&(a.callerLookupMs+=D.now()-l),!u)return null;if(o&&!o.has(u.symbolId))return a&&(a.skippedUnrequestedCallers+=1),null;let f=i.expression,c=this.compilerSymbolForExpression(e,f,a),p=null;if(c)if(a&&(a.targetSymbolHits+=1),s.has(c))a&&(a.compilerSymbolCacheHits+=1),p=s.get(c)??null;else{a&&(a.compilerSymbolCacheMisses+=1);let d=a?D.now():0;p=this.definitionFromCompilerSymbol(c,a),a&&(a.targetLookupMs+=D.now()-d),s.set(c,p)}else a&&(a.targetMisses+=1);return p?{callerId:u.symbolId,target:{symbol:p.symbol,file:p.file,line:p.line,callsiteLine:en(t,i)}}:null}compilerSymbolForExpression(e,t,r){let i=r?D.now():0,s=e.getSymbolAtLocation(t);if(r&&(r.expressionSymbolMs+=D.now()-i),s)return s;r&&(r.typeFallbacks+=1);let o=r?D.now():0,a=e.getTypeAtLocation(t).getSymbol();return r&&(r.typeSymbolMs+=D.now()-o),a}compilerCheckerForSourceFile(e){let t=e.getProject(),r=this.compilerCheckerCache.get(t);return r||(r=t.getTypeChecker().compilerObject,this.compilerCheckerCache.set(t,r)),r}};function Yn(n){let e=[],t=n.getDefaultImport();t&&e.push({identifier:t,importedName:"default",localName:t.getText(),kind:"default",isTypeOnly:n.getImportClause()?.isTypeOnly()??!1});let r=n.getNamespaceImport();r&&e.push({identifier:r,importedName:"*",localName:r.getText(),kind:"namespace",isTypeOnly:n.getImportClause()?.isTypeOnly()??!1});for(let i of n.getNamedImports()){let s=i.getNameNode(),a=i.getAliasNode()??(s.getKindName()==="Identifier"?s:null);e.push({identifier:a,importedName:s.getText(),localName:a?.getText()??s.getText(),kind:"named",isTypeOnly:i.isTypeOnly()||(n.getImportClause()?.isTypeOnly()??!1)})}return e.length===0&&e.push({identifier:null,importedName:"*",localName:null,kind:"side-effect",isTypeOnly:!1}),e}function Vs(n,e,t){return{importer:n,sourcePath:e,importedName:t.importedName,localName:t.localName,kind:t.kind,isTypeOnly:!0,isUsed:!0,isTypeUsed:!0,isValueUsed:!1,references:[]}}function $s(){return{declarations:0,entries:0,bindingSymbols:0,missingBindingSymbols:0,scannedIdentifiers:0,symbolLookups:0,matchedReferences:0,fallbackEntries:0}}function Ys(n){for(let e=n;e;e=e.getParent())if(e.getKindName()==="ImportDeclaration")return!0;return!1}function Js(n,e,t){let r=n.get(e);r||(r=[],n.set(e,r)),r.push(t)}function Gs(n){let e=new Set;for(let t of n.getImportDeclarations())for(let r of Yn(t))r.localName&&e.add(r.localName);return e}function Qs(n,e){let t=null;for(let r of n)e<r.startLine||e>r.endLine||(!t||r.startLine>=t.startLine)&&(t=r);return t}function en(n,e){return n.getLineAndCharacterOfPosition(e.getStart(n)).line}function Er(n,e,t){return e===n.relativePath&&t>=n.startLine&&t<=n.endLine}function Ar(n){return n.symbol.includes("#")?Ne(n.symbol)==="type"&&n.relativePath.endsWith(".d.ts"):!1}function Xs(){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 Zs(n){return{...n,callerLookupMs:Math.round(n.callerLookupMs),expressionSymbolMs:Math.round(n.expressionSymbolMs),typeSymbolMs:Math.round(n.typeSymbolMs),targetLookupMs:Math.round(n.targetLookupMs),declarationsMs:Math.round(n.declarationsMs),declarationLocationMs:Math.round(n.declarationLocationMs),indexedLookupMs:Math.round(n.indexedLookupMs)}}function Fr(){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 Nr(n){return{...n,scanMs:Math.round(n.scanMs),packageRefsMs:Math.round(n.packageRefsMs),semanticRefsMs:Math.round(n.semanticRefsMs),hierarchyMs:Math.round(n.hierarchyMs)}}function eo(n,e,t){for(let r of e){let i=n.get(r)??[];i.push(...t),n.set(r,i)}}function no(n){let e=new Set,t=[];for(let r of n){let i=`${r.symbol}|${r.file}|${r.line}|${r.callsiteLine??""}`;e.has(i)||(e.add(i),t.push(r))}return t}function _r(n){return n.replace(/\s+/g," ").replace(/\bimport\("[^"]+"\)\./g,"").trim()}import{join as to}from"path";var nn=3;var ro="typescript-semantic";function Or(n){let e=to(n,ro),t=Le(e);return{...t,requestDir:t.legacyRequestDir}}var ao=12e4,co=5;function qr(n,e,t={}){let r=new Jn(n,t),i=null,s=null,o=process.env.SCIP_QUERY_SKIP_WATCH_SERVICE==="1",a=()=>(i??=Lr(n,e),i),l=(c,p,d)=>{if(o)return d();try{return p(r.request(c))}catch{return o=!0,d()}},u=(c,p)=>l({kind:"references",definitions:[...c],...p?.exact?{exact:!0}:{}},d=>Br(d),()=>a().referencesForDefinitions?.(c,p)??new Map(c.map(d=>[d.symbolId,a().referencesFor(d)]))),f=c=>l({kind:"callees",definitions:[...c]},p=>Br(p),()=>a().calleesForDefinitions?.(c)??new Map(c.map(p=>[p.symbolId,a().calleesFor(p)])));return{language:"typescript",availability:()=>(s??=l({kind:"availability"},fo,()=>a().availability()),s),importUsage:c=>l({kind:"import-usage",file:c},p=>p,()=>a().importUsage(c)),referencesFor:c=>u([c]).get(c.symbolId)??[],referencesForDefinitions:u,referenceFragmentsForFiles:c=>l({kind:"reference-fragments",files:[...c]},p=>uo(p),()=>a().referenceFragmentsForFiles?.(c)??new Map),calleesFor:c=>f([c]).get(c.symbolId)??[],calleesForDefinitions:f,signatureFor:c=>l({kind:"signature",definition:c},po,()=>a().signatureFor(c)),dispose:()=>i?.dispose?.()}}var Jn=class{constructor(e,t={}){this.db=e;this.runtime=t.runtime??yo,this.timeoutMs=t.timeoutMs??mo(),this.mailboxLimits=t.mailboxLimits??{},this.cacheDir=oo(e.config.dbPath),this.projectRoot=tt(e.config.projectRoot)}db;runtime;timeoutMs;cacheDir;projectRoot;mailboxLimits;request(e){let t=Dt(this.cacheDir),r=Or(this.cacheDir),i=pn(t.statePath);if(!Ur(i,this.projectRoot,this.runtime))throw new Error("Compatible TypeScript semantic service is not running.");let s=this.db.generation.identity;if(!s)throw new Error("Published TypeScript generation identity is unavailable.");let o=this.runtime.now(),a=o+this.timeoutMs,l=(this.runtime.monotonicNow??q)()+this.timeoutMs,u=dt(),f=Z("typescript-semantic-v3",{generation:s,profileEnvironment:u,request:e}),c=ee(f),p=Oe(r,{mailboxVersion:$,operationKey:f,clientId:this.runtime.randomId(),enqueuedAtMs:o,deadlineAtMs:a,protocolVersion:nn,id:c,generation:s,profileEnvironment:u,request:e},{nowMs:o,limits:this.mailboxLimits});for(;(this.runtime.monotonicNow??q)()<=l;){if(so(p.responsePath))return lo(B(p.responsePath,{maxBytes:this.mailboxLimits.maxItemBytes??64*1024*1024,inputKind:"TypeScript semantic mailbox response"}),c,s,f);let d=pn(t.statePath);if(!Ur(d,this.projectRoot,this.runtime))throw new Error("TypeScript semantic service stopped while processing a request.");this.runtime.sleep(co)}throw new Error(`TypeScript semantic service timed out after ${this.timeoutMs}ms.`)}};function Ur(n,e,t){let r=n?.processIdentity?t.readProcessIdentity?.(n.pid):null;return n!==null&&n.projectRoot===e&&n.typescriptSemantic?.protocolVersion===nn&&t.isProcessAlive(n.pid)&&(!n.processIdentity||r!=null&&Ce(n.processIdentity,r))}function lo(n,e,t,r){let i=JSON.parse(n);if(i.protocolVersion!==nn||i.id!==e||i.operationKey!==r||i.ok===!0&&i.generation!==t)throw new Error("TypeScript semantic service wrote an incompatible response.");if(i.ok===!0)return i.response;throw new Error(typeof i.error=="string"?i.error:"TypeScript semantic service request failed.")}function Br(n){if(!Array.isArray(n))throw new Error("TypeScript semantic service wrote an invalid numeric map.");return new Map(n)}function uo(n){if(!Array.isArray(n))throw new Error("TypeScript semantic service wrote an invalid string map.");return new Map(n)}function fo(n){let e=Sr(n);if(!e)throw new Error("TypeScript semantic service wrote invalid availability.");return e}function po(n){if(n!==null&&typeof n!="string")throw new Error("TypeScript semantic service wrote an invalid signature.");return n}function mo(){let n=Number(process.env.SCIP_TYPESCRIPT_SEMANTIC_TIMEOUT_MS);return Number.isInteger(n)&&n>0?n:ao}var yo={now:Date.now,monotonicNow:q,randomId:io,sleep(n){let e=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(e,0,0,n)},isProcessAlive:Pe,readProcessIdentity:we};var jr=new Xe;ot({name:"semantic-provider",groups:["semantic-provider"],clearAll:n=>jr.clear(n)});function Q(n,e){let t=U(e)??"typescript";return jr.getOrCreate(n,t,()=>t==="rust"?pr(n.config.projectRoot,{sourceImportUsageResolver:{importUsageFacts:r=>wt(n,r)},calleeSymbolResolver:kt(n),sourceZeroCalleeOracle:r=>So(n,r),scipOccurrenceCalleeOracle:r=>yr(n,r)}):qr(n,e))}function U(n){return n?mt(n)==="rust"?"rust":ne(n)?"typescript":null:"typescript"}function So(n,e){let t=Fe(n,e.relativePath);if(!t||t.language!=="rust")return!1;let r=t.callables.find(i=>i.startLine===e.startLine&&i.endLine===e.endLine&&i.name===e.leaf)??t.callables.find(i=>i.startLine===e.startLine&&i.endLine===e.endLine);return r?!t.callSites.some(i=>i.line>=r.startLine&&i.line<=r.endLine):!1}var go=/^[A-Za-z_][A-Za-z0-9_]*$/,Wr=/\bDefault::default\b/g,Ro=/^\.\.\s*Default::default\b/;function zr(n,e){let t=new Map,r=new Map;for(let i of e){let s=Gn(n,i,r);s!==null&&t.set(i.symbolId,s)}return t}function Gn(n,e,t=new Map){let r=ho(e.symbol);if(!r)return null;let i=ht(n,[e.symbolId]);if(i.length===0)return null;let s=new RegExp(`(^|[^A-Za-z0-9_])${pe(r)}::default\\b`,"g"),o=new RegExp(`(^|[^A-Za-z0-9_])${pe(r)}\\s*$`),a=bo(n,e.symbolId),l=[];for(let u of i){let f=Io(n,u.relative_path,t);if(f===null)return null;let c=f.split(/\r?\n/),p=0,d=[],y=0;for(let R=u.chunk_start;R<=u.chunk_end&&R<c.length;R+=1){let S=c[R]??"",M=new Set;s.lastIndex=0;let P;for(;P=s.exec(S);)l.push({file:u.relative_path,line:R,column:P.index+P[1].length+r.length+2}),y+=1;for(let h=0;h<S.length;h+=1){let C=Ro.exec(S.slice(h));if(C){if(a&&d.includes(p)){let v=h+C[0].lastIndexOf("default");l.push({file:u.relative_path,line:R,column:v}),M.add(v),y+=1}h+=C[0].length-1;continue}let x=S[h];if(x==="{"){let v=o.test(S.slice(0,h));p+=1,v&&d.push(p);continue}if(x==="}")for(p=Math.max(0,p-1);d.length>0&&d[d.length-1]>p;)d.pop()}for(Wr.lastIndex=0;P=Wr.exec(S);){let h=P.index+9;if(!M.has(h))return null}}if(y===0)return null}return We(l)}function bo(n,e){return n.get("SELECT 1 AS present FROM mentions WHERE symbol_id = ? AND role = 1 LIMIT 1",e)?.present===1}function ho(n){let e=/impl#\[([^\]]+)\]\[Default\]default\(\)\./.exec(n)?.[1]??null;return!e||!go.test(e)?null:e}function Io(n,e,t){if(t.has(e))return t.get(e)??null;let r=n.get("SELECT text FROM documents WHERE relative_path = ?",e),i=typeof r?.text=="string"?r.text:Mo(n,e);return t.set(e,i),i}function Mo(n,e){try{return it(n.config.projectRoot,e,{inputKind:"indexed Rust source file"})}catch(t){if(!ue(t))throw t;return null}}function Kr(n){let e=new Map;for(let t of n){let r=e.get(t.relativePath)??[];r.push(t),e.set(t.relativePath,r)}return e}var vo="typescript-import-usage-v1",Do="typescript-signatures-v1",Qn=ct("semantic-prefetched-callees",{clearGroups:["whole-project","source-file","semantic-provider"]}),Hr=fn({kind:"semantic-import-usage",invalidation:fe("semantic-import-usage"),serialize:n=>JSON.stringify(n),deserialize:Zr}),Vr=fn({kind:"semantic-signatures",invalidation:fe("semantic-signatures"),serialize:n=>JSON.stringify(n),deserialize:No}),$r=un({kind:"typescript-import-usage",invalidation:fe("typescript-import-usage"),serialize:n=>JSON.stringify(n),deserialize:Zr}),Yr=un({kind:"typescript-signatures",invalidation:fe("typescript-signatures"),serialize:n=>JSON.stringify(n),deserialize:_o});function De(n){let e=new Map,t=new Set;return{capability:(r,i)=>ei(n,r,i),importUsage:r=>Co(n,r),references:r=>Gr(n,r),materializeReferences:(r,i)=>Qr(n,r,e,t,i),callerMap:r=>To(n,r,e,t),calleeMap:r=>Eo(n,r),signature:r=>Ao(n,r)}}function xo(n,e){if(e.size===0)return;let t=Qn.get(n,()=>new Map);for(let[r,i]of e)t.set(r,[...i])}function Ru(n,e){if(!Qn.has(n))return{hits:[],misses:[...e]};let t=Qn.get(n,()=>new Map),r=[],i=[];for(let s of e)t.has(s.symbolId)?r.push({definition:s,callees:t.get(s.symbolId)??[]}):i.push(s);return{hits:r,misses:i}}function bu(n,e){return De(n).importUsage(e)}function Co(n,e){if(U(e)==="typescript"){let s="fallback",o=0,a=0,l=0,u=0;return w("typescript.import-usage.materialize",()=>{let f=dn(n,e,vo);if(f?.key){o=1;let p=$r.read(n,e,f.key);if(p)return s="hit",a=1,p;l=1;let d=j(n,e);if(!d)return s="unavailable",[];let y=d.importUsage(e);return $r.write(n,e,f.key,y),s="computed",y}u=1;let c=j(n,e);return c?(s="direct-fallback",c.importUsage(e)):(s="unavailable",[])},()=>({state:s,eligible:o,cacheHits:a,cacheMisses:l,fallbacks:u}))}let t=Xr(n,"semantic-import-usage",e);if(t){let s=Hr.read(n,e,t);if(s)return s}let r=j(n,e);if(!r)return[];let i=r.importUsage(e);return t&&Hr.write(n,e,t,i),i}function hu(n,e){return De(n).references(e)}function Gr(n,e){let t=Gn(n,e);if(t)return t;let r=At(n,e);if(r)return r;let i=j(n,e.relativePath);return i?i.referencesFor(e):[]}function Iu(n,e){return De(n).callerMap(e)}function Mu(n,e){let t=new Map,r=[];for(let i of e){if(U(i.relativePath)==="typescript"){r.push(i);continue}Xn(n,t,i,Gr(n,i))}if(r.length>0){let s=yn(n,r,o=>Q(n,o))?.references;if(!s){let o=j(n,r[0].relativePath);s=o?o.referencesForDefinitions?o.referencesForDefinitions(r,{exact:!0}):new Map(r.map(a=>[a.symbolId,o.referencesFor(a)])):new Map,o&&_()&&mn(n,r,s,a=>Q(n,a))}for(let o of r)Xn(n,t,o,s.get(o.symbolId)??[])}return t}function To(n,e,t=new Map,r=new Set){let i=new Map,s=Qr(n,e,t,r),o=0;return w("semantic.callers.from-references",()=>{for(let a of e)o+=Xn(n,i,a,t.get(a.symbolId)??[])},()=>({definitions:e.length,materialized:s.definitions,inMemoryHits:s.inMemoryHits,incompleteInMemoryHits:s.incompleteInMemoryHits,resultRows:i.size,callerFiles:o})),i}function Qr(n,e,t,r,i={}){let s=cn(n),o=[],a=[],l=[],u=0,f=0,c=0,p=0,d=0,y=0,R=0,b=0,S=0,M=0,P=0,h=0,C=[],x=new Map,v=e.filter(m=>U(m.relativePath)==="typescript"&&!t.has(m.symbolId)&&!r.has(m.symbolId)),g=yn(n,v,m=>Q(n,m));if(g){S=v.length,M=g.cacheHits,P=g.cacheMisses,h=g.computedFiles;for(let m of v)t.set(m.symbolId,g.references.get(m.symbolId)??[])}if(w("semantic.references.cache-scan",()=>{for(let[m,I]of Kr(e)){let T=[];for(let k of I)t.has(k.symbolId)?f+=1:r.has(k.symbolId)?b+=1:T.push(k);if(T.length===0){R+=1;continue}let W=ko(n,s,m);if(!W){for(let k of T)U(k.relativePath)||(u+=1),l.push(k);continue}y+=1;let F=lt(n,m,W);for(let k of T){let O=F.get(k.symbol)??null;if(O!==null){let E=Po(O);if(E){c+=1,t.set(k.symbolId,E);continue}p+=1}a.push({definition:k,cacheFingerprint:W})}}},()=>({definitions:e.length,skippedUnsupportedLanguage:u,cacheHits:c,parseFailures:p,misses:a.length,unkeyed:l.length,inMemoryHits:f,incompleteInMemoryHits:b,fullyInMemoryFiles:R,cacheReadFiles:y})),a.length>0||l.length>0){C=[...l,...a.map(m=>m.definition)],x=w("semantic.references.compute-misses",()=>{let m=wo(n,C,i);return d=m.size,m},()=>({definitions:C.length,misses:a.length,unkeyed:l.length,rows:d}));for(let m of C)x.has(m.symbolId)?(t.set(m.symbolId,x.get(m.symbolId)??[]),r.delete(m.symbolId)):r.add(m.symbolId);for(let{definition:m,cacheFingerprint:I}of a)x.has(m.symbolId)&&ei(n,"semantic-references",m.relativePath).available&&o.push({relativePath:m.relativePath,symbol:m.symbol,projectFingerprint:I,payload:JSON.stringify(x.get(m.symbolId)??[])})}return o.length>0&&w("semantic.references.cache-write",()=>ut(n,o),()=>({entries:o.length})),x.size>0&&mn(n,C,x,m=>Q(n,m)),{definitions:e.length,inMemoryHits:f,incompleteInMemoryHits:b,cacheHits:c,misses:a.length,unkeyed:l.length,skippedUnsupportedLanguage:u,parseFailures:p,computed:d,incomplete:r.size,cacheWrites:o.length,fragmentDefinitions:S,fragmentCacheHits:M,fragmentCacheMisses:P,fragmentComputedFiles:h}}function ko(n,e,t){if(!e)return null;let r=U(t);return r==="typescript"?e:r==="rust"?an(JSON.stringify({kind:"semantic-references",language:r,engine:hn(n.config.projectRoot),projectFingerprint:e})):null}function wo(n,e,t={}){let r=_(),i=new Map,s=0,o=0,a=0,l=0,u=0,f=0,c=0,p=0,d=0;return w("semantic.references.provider-loop",()=>{let y=zr(n,e),R=Et(n,e),b=new Map,S=t.prefetchCallees?new Map:null,M=[];for(let h of e){let C,x=()=>(C??=j(n,h.relativePath),C);if(S){let I=x();if(I?.referencesAndCalleesForDefinitions){let T=S.get(I);T?T.push(h):S.set(I,[h]),d+=1}}let v=y.get(h.symbolId);if(v){a+=1,l+=v.length,ve(i,h.symbolId,v,r,I=>{c+=1,p+=I});continue}let g=R.get(h.symbolId);if(g){u+=1,f+=g.length,ve(i,h.symbolId,g,r,I=>{c+=1,p+=I});continue}let m=x();if(!m){r&&(o+=1);continue}if(r&&(s+=1),m.referencesForDefinitions){let I=b.get(m);I?I.push(h):b.set(m,[h])}else M.push({provider:m,definition:h})}let P=new Set;if(S)for(let[h,C]of S){if(!h.referencesAndCalleesForDefinitions)continue;let x=b.get(h)??[],v=h.referencesAndCalleesForDefinitions(x,C);P.add(h),xo(n,v.callees);for(let g of x){if(!v.references.has(g.symbolId))continue;let m=v.references.get(g.symbolId)??[];ve(i,g.symbolId,m,r,I=>{c+=1,p+=I})}}for(let[h,C]of b){if(P.has(h))continue;let x=h.referencesForDefinitions(C);for(let v of C){if(!x.has(v.symbolId))continue;let g=x.get(v.symbolId)??[];ve(i,v.symbolId,g,r,m=>{c+=1,p+=m})}}for(let{provider:h,definition:C}of M){let x=h.referencesFor(C);ve(i,C.symbolId,x,r,v=>{c+=1,p+=v})}return i},()=>({definitions:e.length,providerHits:s,providerMisses:o,rustDefaultFastPathRows:a,rustDefaultFastPathReferences:l,rustScipOccurrenceFastPathRows:u,rustScipOccurrenceFastPathReferences:f,prefetchCalleeDefinitions:d,definitionsWithReferences:c,referenceCount:p,rows:i.size}))}function ve(n,e,t,r,i){n.set(e,t),r&&t.length>0&&i(t.length)}function Xn(n,e,t,r){let i=0;for(let s of r){if(s.file===t.relativePath||n.isIgnored(s.file))continue;let o=e.get(t.symbolId);o||(o=new Set,e.set(t.symbolId,o));let a=o.size;o.add(s.file),o.size!==a&&(i+=1)}return i}function Po(n){try{return JSON.parse(n)}catch{return null}}function vu(n,e){return De(n).calleeMap(e)}function Eo(n,e){let t=_(),r=new Map,i=0,s=0,o=0,a=0;return w("semantic.callees.provider-loop",()=>{let l=new Map,u=[];for(let f of e){let c=j(n,f.relativePath);if(!c){t&&(s+=1);continue}t&&(i+=1);let p=f;if(c.calleesForDefinitions){let d=l.get(c);d?d.push(p):l.set(c,[p])}else u.push({provider:c,definition:p})}for(let[f,c]of l){let p=f.calleesForDefinitions(c);for(let d of c){let y=p.get(d.symbolId)??[];Jr(r,d.symbolId,y,t,R=>{o+=1,a+=R})}}for(let{provider:f,definition:c}of u){let p=f.calleesFor(c);Jr(r,c.symbolId,p,t,d=>{o+=1,a+=d})}return r},()=>({definitions:e.length,providerHits:i,providerMisses:s,definitionsWithCallees:o,calleeCount:a,rows:r.size}))}function Jr(n,e,t,r,i){t.length>0&&(n.set(e,t),r&&i(t.length))}function Du(n,e){return De(n).signature(e)}function Ao(n,e){if(U(e.relativePath)==="typescript"){let o="fallback",a=0,l=0,u=0,f=0;return w("typescript.signature.materialize",()=>{let c=dn(n,e.relativePath,Do);if(c?.key){a=1;let d=Yr.read(n,e.relativePath,c.key)??{};if(Object.prototype.hasOwnProperty.call(d,e.symbol))return o="hit",l=1,d[e.symbol]??null;u=1;let y=j(n,e.relativePath);if(!y)return o="unavailable",null;let R=y.signatureFor(e);return Yr.write(n,e.relativePath,c.key,{...d,[e.symbol]:R}),o="computed",R}f=1;let p=j(n,e.relativePath);return p?(o="direct-fallback",p.signatureFor(e)):(o="unavailable",null)},()=>({state:o,eligible:a,cacheHits:l,cacheMisses:u,fallbacks:f}))}let t=Xr(n,"semantic-signatures",e.relativePath),r=Fo(e);if(t){let o=Vr.read(n,r,t);if(o)return o.signature}let i=j(n,e.relativePath);if(!i)return null;let s=i.signatureFor(e);return t&&Vr.write(n,r,t,{signature:s}),s}function Xr(n,e,t){let r=cn(n);if(!r)return null;let i=U(t);return i!=="rust"?null:an(JSON.stringify({kind:e,language:i,engine:hn(n.config.projectRoot),projectFingerprint:r}))}function Fo(n){return`${n.relativePath}\0${n.symbol}`}function Zr(n){try{let e=JSON.parse(n);return Array.isArray(e)?e:null}catch{return null}}function No(n){try{let e=JSON.parse(n);if(!e||typeof e!="object")return null;let t=e.signature;return t!==null&&typeof t!="string"?null:{signature:t}}catch{return null}}function _o(n){try{let e=JSON.parse(n);if(!e||typeof e!="object"||Array.isArray(e))return null;for(let t of Object.values(e))if(t!==null&&typeof t!="string")return null;return e}catch{return null}}function ei(n,e,t){let r=U(t);if(!r)return{slot:e,language:"typescript",available:!1,reason:"semantic evidence is only available for TypeScript or Rust files"};try{return{slot:e,language:r,...Q(n,t).availability()}}catch(i){return{slot:e,language:r,available:!1,reason:i instanceof Error?i.message:String(i)}}}function j(n,e){if(!U(e))return null;let t=Q(n,e);return t.availability().available?t:null}export{Kr as a,hn as b,U as c,De as d,Ru as e,bu as f,hu as g,Iu as h,Mu as i,wo as j,vu as k,Du as l};
|
|
3
|
-
//# sourceMappingURL=chunk-PBUH2P5S.js.map
|
package/dist/chunk-PLJUQFQN.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as y}from"./chunk-XE33FV5W.js";import{a as d}from"./chunk-TAYD3AE7.js";import{a as P}from"./chunk-PIFTZEEM.js";import{a as v}from"./chunk-BOJ5SVE2.js";import{c as b}from"./chunk-PLYUVM4F.js";import{a as p}from"./chunk-BGBBVSH4.js";import{a as g,h}from"./chunk-BECZLYNU.js";import{d as l,h as u}from"./chunk-TD7VKJ2Y.js";import{o as f,p as m}from"./chunk-42W3LFUK.js";import{basename as x,extname as L}from"path";function z(i,e){let{scope:r,maxLoc:n=15,limit:o=30,scanLimit:s}=e??{},a=new b(i);return P({candidates:()=>E(i,a,r,n),orderCandidates:v,scanLimit:s,profile:{name:"passthrough-candidates"},prepare:t=>a.calleeMap(t,{semantic:e?.semantic!==!1}),evaluate:(t,c)=>S(i,t,c.get(t.symbolId)??[]),orderResults:(t,c)=>t.loc-c.loc||t.file.localeCompare(c.file),limit:o})}function S(i,e,r){let n=w(r);if(n.size!==1||!f(i,e.relativePath,e.startLine,e.endLine))return null;let[,o]=[...n.entries()][0],s=D(i,e,o),a=T(i,e),t=s.length>0||a.length>0?"signal":"direct";return{symbol:e.symbol,shortName:l(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:p(e),forwardsTo:o.symbol,forwardsToShort:l(o.symbol),forwardsToFile:o.file,actionTier:t,boundaryEvidence:s,publicFacadeEvidence:a,recommendation:I(t,s,a)}}function D(i,e,r){return y(i,e.relativePath,e.startLine,"passthrough","explicit ignore-passthrough comment",[{label:"passthrough name",value:l(e.symbol)},{label:"callee name",value:l(r.symbol)},{label:"passthrough module",value:x(e.relativePath,L(e.relativePath))},{label:"callee module",value:x(r.file,L(r.file))}])}function I(i,e,r){if(i==="signal"){if(r.length>0)return`Review the public API before inlining; public-facade evidence: ${r.slice(0,2).join("; ")}.`;let n=e.filter(C);return n.length>0?`Review the public API before inlining; public-surface evidence: ${n.slice(0,2).join("; ")}.`:`Review the boundary before inlining; boundary evidence: ${e.slice(0,2).join("; ")}.`}return"Inline or remove this passthrough unless an external API or runtime registration depends on the forwarding name."}function T(i,e){return d(i,e)?g(i,e.relativePath)?["exported passthrough is declared on the package public surface"]:h(i,e.symbol,e.relativePath)?["exported passthrough matches configured or framework public entry surface"]:[]:[]}function C(i){return i.includes("public surface")}function w(i){let e=i.some(n=>u(n.symbol))?i.filter(n=>u(n.symbol)):i,r=new Map;for(let n of e)r.has(n.symbol)||r.set(n.symbol,n);return r}function E(i,e,r,n){return e.productionCallableDefinitions({scope:r,minLoc:3,maxLoc:n,requireFunctionLikeSymbol:!0,excludeRustTraitImplMembers:!0}).filter(o=>!m(i,o))}export{z as a};
|
|
2
|
-
//# sourceMappingURL=chunk-PLJUQFQN.js.map
|
package/dist/chunk-PLYUVM4F.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as F}from"./chunk-BGBBVSH4.js";import{a as I}from"./chunk-Z2AWCTN6.js";import{d as le}from"./chunk-BWVQP3LB.js";import{b as $,d as ne,e as te,f as ie,g as oe,h as re,j as N,k as ae,l as se}from"./chunk-AYPDH2LU.js";import{d as ee}from"./chunk-KK7GPALL.js";import{f as X,h as Z}from"./chunk-BECZLYNU.js";import{b as C}from"./chunk-Q6T2CAJL.js";import{b as H}from"./chunk-4GAQ6FI4.js";import{a as O,e as z,g as w,h as E,j as Q,k as W,t as D,u as Y,v as J,w as U,x as A}from"./chunk-TD7VKJ2Y.js";import{s as B,u as S}from"./chunk-42W3LFUK.js";import{A as V,N as G,a as M,z as y}from"./chunk-7JYHQAH2.js";import{B as _,G as v,t as j}from"./chunk-Q7GBK5T7.js";function ce(n,e,t={}){let i=new Map;if(e&&e.length===0)return i;let r=M(n,{includeIgnored:!1}),o=ie(n),a=e??Y(n),f=new Set(a.map(m=>m.symbolId)),c=Me(a);return pe(n,i,r,o,f,c),ye(n,i,a,f),Re(n,i,r,o,f,c),t.semantic!==!1&&t.semanticEvidence&&De(i,t.semanticEvidence.callerMap(n,ve(a))),i}function pe(n,e,t,i,r,o){for(let a of t){if(!y(a))continue;let f=B(n,a);if(f)for(let c of f){if(o&&!o.has(c.calleeLeaf))continue;let m=ne(a,i.get(c.calleeLeaf)??[]);if(!m||m.length===0)continue;let s=te(n,a,m,c.memberAccess,c.calleeQualifier);s&&r.has(s.symbolId)&&s.file!==a&&T(e,s.symbolId,a)}}}function ye(n,e,t,i){let r=ge(t);for(let o of Se(n,i))n.isIgnored(o.relative_path)||he(o,r.get(o.symbol_id))||T(e,o.symbol_id,o.relative_path)}function Se(n,e){return ee(n,e?[...e]:void 0)}function ge(n){let e=new Map;for(let t of n)e.set(t.symbolId,{docId:t.documentId,startLine:t.startLine,endLine:t.endLine});return e}function he(n,e){return!!e&&e.docId===n.document_id&&n.chunk_start>=e.startLine&&n.chunk_end<=e.endLine}function Re(n,e,t,i,r,o){for(let a of t){if(y(a)!=="rust")continue;let f=S(n,a,{includeRustAttributeNames:!0});if(f.length!==0)for(let{name:c}of f){if(o&&!o.has(c))continue;let m=i.get(c);if(m)for(let s of m)r.has(s.symbolId)&&s.file!==a&&T(e,s.symbolId,a)}}}function T(n,e,t){let i=n.get(e);i||(i=new Set,n.set(e,i)),i.add(t)}function Me(n){let e=new Set;for(let t of n){let i="leaf"in t&&typeof t.leaf=="string"?t.leaf:"symbol"in t&&typeof t.symbol=="string"?z(t.symbol):"";i&&e.add(i)}return e.size>0?e:null}function ve(n){return n.filter(e=>"relativePath"in e&&"symbol"in e&&"leaf"in e)}function De(n,e){for(let[t,i]of e){let r=n.get(t);r||(r=new Set,n.set(t,r));for(let o of i)r.add(o)}}function q(n,e,t={}){return ce(n,e,t)}function K(n,e,t={}){return se(n,e,t)}function fe(n,e,t={}){let i=q(n,e,{semantic:t.semantic,semanticEvidence:t.semanticEvidence});return t.sourceFallback===!1?i:Ce(i,K(n,e))}function Ce(n,e){let t=new Map;for(let[i,r]of n)t.set(i,new Set(r));for(let[i,r]of e){let o=t.get(i)??new Set;for(let a of r)o.add(a);t.set(i,o)}return t}function ue(n,e,t){let i=e.identifierResolution==="strict"?N:ae,r=e.candidateNames?oe(e.candidateNames):null,o=0,a=0,f=0,c=0,m="";for(let s of e.paths)if(o+=1,m=s,!(!y(s)&&!(e.includeVueSfc&&V(s)))&&!n.isIgnored(s)&&!e.skipPath?.(s))try{if(r&&!re(_(n,s),r))continue;a+=1;let h=(u,b,x,g)=>{if(e.candidateNames&&!e.candidateNames.has(u))return;f+=1;let R=e.resolveTargets?e.resolveTargets({sourceFile:s,name:u,kind:b,defaultTargets:g}):g();for(let P of R)c+=1,t({sourceFile:s,name:u,target:P,occurrences:x,kind:b})},k=$(n,s);for(let[u,b]of k)h(u,"identifier",b.length,()=>i(n,s,u));for(let u of S(n,s,{includeCrossLanguageDispatchNames:e.includeCrossLanguageDispatchNames,includeRustAttributeNames:e.includeRustAttributeNames})){let b=u.kind==="cross-language-dispatch"?()=>N(n,s,u.name):()=>i(n,s,u.name);h(u.name,u.kind,u.occurrences,b)}}finally{e.afterPath?.(s),o%10===0&&j("source-reference-scan.progress",()=>{},()=>({scannedPaths:o,currentPath:m,candidateMatchedPaths:a,visitedNames:f,visitedHits:c}))}}function de(n,e={}){let{scope:t,files:i,minLoc:r=1,maxLoc:o=Number.POSITIVE_INFINITY,excludeSymbol:a,excludeEntrySurfaces:f=!1,excludeTypesFiles:c=!1,excludeRootedSymbols:m=!1,requireFunctionLikeSymbol:s=!1,requireCallableSymbol:L=!1,excludeRustTraitImplMembers:h=!1,includeSuppressed:k=!1,sortByLocDesc:u=!1}=e,b=[],x=Ie(n,{scope:t,files:i,requireFunctionLikeSymbol:s,requireCallableSymbol:L}),g=new Map,R=new Map,P=l=>{let d=g.get(l);if(d!==void 0)return d;let p=X(n,l);return g.set(l,p),p},be=l=>{let d=R.get(l);if(d!==void 0)return d;let p=C(l);return R.set(l,p),p};for(let l of x){let d=l.relativePath;if(n.isIgnored(d)||f&&P(d)||!Fe(l,{requireFunctionLikeSymbol:s,requireCallableSymbol:L})||a!==void 0&&l.symbol===a)continue;let p=F(l);p<r||p>o||c&&Le(d)||m&&Z(n,l.symbol,d)||h&&Q(l.symbol)||be(d)!=="test"&&(W(l.symbol)||!k&&v(n,d,l.startLine)||b.push(l))}return u?b.sort((l,d)=>F(d)-F(l)):b}function Ie(n,e){return e.files!==void 0?[...new Set(e.files.map(i=>i.replace(/\\/g,"/")))].sort().filter(i=>!e.scope||i.includes(e.scope)).flatMap(i=>D(n,i)):e.requireCallableSymbol?A(n,{scope:e.scope,symbolMatches:w,sqlPrefilter:"callable"}):e.requireFunctionLikeSymbol?A(n,{scope:e.scope,symbolMatches:E,sqlPrefilter:"function-like"}):U(n,e.scope)}function Fe(n,e){return e.requireCallableSymbol?w(n.symbol):e.requireFunctionLikeSymbol?E(n.symbol):n.isFunctionLike}function Le(n){return(n.split("/").pop()??"").includes("types")}var me=class{constructor(e){this.db=e}db;scopedDefinitions(e){return J(this.db,e)}definitionsForFile(e){return D(this.db,e)}productionCallableDefinitions(e={}){return de(this.db,e)}calleeMap(e,t={}){return le(this.db,e,{...t,semanticEvidence:I})}crossFileCallerMap(e,t={}){return q(this.db,e,{...t,semanticEvidence:I})}sourceFallbackCallerFiles(e,t={}){return K(this.db,e,t)}callerFileMap(e,t={}){return fe(this.db,e,{...t,semanticEvidence:I})}frameworkReferencedSymbolIds(e){let t=new Map;for(let r of e){if(!r.leaf)continue;let o=t.get(r.leaf)??[];o.push(r.symbolId),t.set(r.leaf,o)}let i=new Set;for(let r of M(this.db,{includeIgnored:!1}))if(y(r)==="rust")for(let{name:o}of S(this.db,r,{includeRustAttributeNames:!0}))for(let a of t.get(o)??[])i.add(a);return i}symbolsWithNonSelfCallees(e,t={}){if(e.length===0)return new Set;let i=new Map(e.map(o=>[o.symbolId,o.symbol])),r=this.calleeMap(e,t);return new Set([...r.entries()].filter(([o,a])=>{let f=i.get(o);return a.some(c=>c.symbol!==f)}).map(([o])=>o))}fileDependencyGraph(e){return H(this.db,e)}fileKind(e){return C(e)}hasSuppressionComment(e){return v(this.db,e.relativePath,e.startLine)}sourceFiles(){return G(this.db)}scanSourceReferences(e,t){ue(this.db,e,t)}callableSignature(e){let t=O(this.db).forFile(e.relativePath,{facts:!0}).facts?.callables.find(i=>i.startLine===e.startLine&&i.endLine===e.endLine);return t?{paramCount:t.paramCount}:null}};export{K as a,Ce as b,me as c};
|
|
2
|
-
//# sourceMappingURL=chunk-PLYUVM4F.js.map
|
package/dist/chunk-PXXYQK55.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as x}from"./chunk-ISWFRGJ6.js";import{b as u}from"./chunk-Q6T2CAJL.js";import{b as p}from"./chunk-4GAQ6FI4.js";import{za as y}from"./chunk-GH5YSGZL.js";function ee(e){return b.test(e)}var b=/(?:^|\/)(?:package-lock\.json|pnpm-lock\.yaml|yarn\.lock|Cargo\.lock|uv\.lock|poetry\.lock|Pipfile\.lock|bun\.lockb?|\.SRCINFO|CHANGELOG(?:\.[a-z]+)?|.*\.(?:map|tsbuildinfo))$|(?:^|\/)(?:dist|build|out|node_modules|docs\/plans)\//i;function te(e,t,n={}){let{minTogether:s=4,minConfidence:i=.6,limit:a=30,maxFilesPerCommit:l=20}=n,g=x(e,{historyMode:n.historyMode,...n.head?{head:n.head}:{}}),r=g.commitHistory(),c=t!==void 0,d=g.coChangePairs({minTogether:c?Math.min(s,2):s,minConfidence:c?0:i,maxFilesPerCommit:l});if(!r||!d)return{available:!1,commitsAnalyzed:0,findings:[]};let f=typeof n.scanLimit=="number"?d.slice(0,n.scanLimit):d,R=p(e),j=E(e),L=F(e,R,j),v=n.includeLinked===!0||c,h=[];for(let o of f){if(b.test(o.fileA)||b.test(o.fileB)||!P(e,o.fileA)||!P(e,o.fileB)||c&&!o.fileA.includes(t)&&!o.fileB.includes(t)||!c&&(u(o.fileA)==="test"||u(o.fileB)==="test"||O(o.fileA,o.fileB)||I(o.fileA,o.fileB)))continue;let m=L(o.fileA,o.fileB);if(!v&&m)continue;let C=w(o.fileA,o.fileB),S=$(o,C,m);if(h.push({...o,structurallyLinked:m,partnerClass:C.partnerClass,partnerClassReasons:C.reasons,...S?{declaredCouplingSuggestion:S}:{}}),h.length>=a)break}return{available:!0,commitsAnalyzed:r.commits.length,findings:h}}function P(e,t){return y(e.config.projectRoot,t)}function w(e,t){let n=A(e),s=A(t),i=[],a=r=>{i.includes(r)||i.push(r)},l=(r,c)=>n.tags.has(r)&&s.tags.has(c)||n.tags.has(c)&&s.tags.has(r);if(l("doc","code"))return a("one side is documentation and the other is executable source"),{partnerClass:"doc-code",reasons:i};if(n.tags.has("test")||s.tags.has("test"))return a("one side is classified as a test file"),{partnerClass:"test-code",reasons:i};if(l("schema","script"))return a("schema or contract file changes with a script or generated-code path"),{partnerClass:"schema-script",reasons:i};if(l("model","view"))return a("model or state path changes with a view or component path"),{partnerClass:"model-view",reasons:i};if(l("config","code"))return a("configuration file changes with executable source"),{partnerClass:"config-code",reasons:i};let g=K(n.tokens,s.tokens).filter(r=>!Z.has(r));return k(e,t)||g.length>=2?(a(k(e,t)?"both files live in the same directory":`files share feature tokens: ${g.slice(0,4).join(", ")}`),{partnerClass:"same-feature",reasons:i}):(a("no specific relationship pattern matched"),{partnerClass:"unknown",reasons:i})}function $(e,t,n){if(n||e.together<4||e.confidence<.75||e.commitScope==="broad-sweep"||e.recency==="stale"||!W.has(t.partnerClass))return;let s=[e.fileA,e.fileB].sort();return{name:`co-change ${t.partnerClass}: ${U(s)}`,files:s,reason:`${t.partnerClass} pair changed together ${e.together}x with ${Math.round(e.confidence*100)}% confidence; declare it if future edits should require both sides.`}}function F(e,t=p(e),n=E(e)){return(s,i)=>D(t,n,s,i)}var _=/(?:^|\/)(?:locales|i18n)\//i;function T(e){return _.test(e)}function I(e,t){return T(e)&&T(t)?!0:N(e,t)}function N(e,t){if(!e.endsWith(".json")||!t.endsWith(".json"))return!1;let n=e.lastIndexOf("/"),s=t.lastIndexOf("/");if(n<0||s<0)return!1;let i=e.slice(0,n),a=t.slice(0,s);if(i===a)return!1;let l=e.slice(n+1),g=t.slice(s+1);if(l!==g)return!1;let r=i.lastIndexOf("/"),c=a.lastIndexOf("/"),d=r>=0?i.slice(0,r):"",f=c>=0?a.slice(0,c):"";return d===f}function O(e,t){let n=e.lastIndexOf("/"),s=t.lastIndexOf("/");if(e.slice(0,n)!==t.slice(0,s))return!1;let i=e.slice(n+1).split(".")[0],a=t.slice(s+1).split(".")[0];return i!==""&&i===a}function E(e){return(e.config.declaredCouplings??[]).filter(t=>Array.isArray(t.files)&&t.files.length>=2).map(t=>new Set(t.files))}function D(e,t,n,s){return e.get(n)?.has(s)===!0||e.get(s)?.has(n)===!0?!0:t.some(i=>i.has(n)&&i.has(s))}var B=/(?:^|\/)(?:readme|docs?|guides?|adr|architecture|design)(?:\/|$)|\.(?:md|mdx|rst|adoc|txt)$/i,M=/(?:^|\/)(?:\.[a-z0-9-]+rc|config|configs|settings|\.github)(?:\/|$)|(?:^|\/)(?:package\.json|tsconfig(?:\.[^.]+)?\.json|vite\.config\.[cm]?[jt]s|rollup\.config\.[cm]?[jt]s|eslint\.config\.[cm]?[jt]s)$|\.(?:json|ya?ml|toml|ini|env)$/i,z=/(?:^|\/)(?:schemas?|contracts?|migrations?|models?|types?)(?:\/|$)|(?:^|\/)[^/]*(?:schema|contract|migration|model|types?)[^/]*|(?:\.schema)?\.(?:graphql|gql|proto|prisma)$/i,G=/(?:^|\/)(?:scripts?|bin|tools?|tasks?|generators?|codegen|migrations?|seeds?)(?:\/|$)|(?:^|\/)[^/]*(?:generate|codegen|migrate|seed|script)[^/]*\.[cm]?[jt]s$/i,H=/(?:^|\/)(?:models?|entities|domain|state|stores?|reducers?)(?:\/|$)|(?:^|\/)[^/]*(?:model|entity|state|store|reducer|viewmodel)[^/]*\.[^.]+$/i,q=/(?:^|\/)(?:views?|pages?|components?|screens?|routes?|templates?)(?:\/|$)|(?:^|\/)[^/]*(?:view|page|component|screen|template)[^/]*\.[^.]+$|\.(?:vue|svelte|tsx|jsx)$/i,W=new Set(["doc-code","config-code","schema-script","model-view","test-code"]),Z=new Set(["src","lib","app","apps","packages","frontend","backend","examples","python","typescript","javascript","test","tests","spec","index","main","utils","util","types","type","config","docs","doc","package","requirements","ts","tsx","js","jsx","mjs","cjs","vue","py","md","mdx","json","yaml","yml","toml","txt"]);function A(e){let t=e.replace(/\\/g,"/"),n=new Set;return B.test(t)&&n.add("doc"),M.test(t)&&n.add("config"),z.test(t)&&n.add("schema"),G.test(t)&&n.add("script"),H.test(t)&&n.add("model"),q.test(t)&&n.add("view"),u(t)==="test"&&n.add("test"),!n.has("doc")&&!n.has("config")&&n.add("code"),{tags:n,tokens:J(t)}}function k(e,t){let n=e.lastIndexOf("/"),s=t.lastIndexOf("/"),i=n>=0?e.slice(0,n):"",a=s>=0?t.slice(0,s):"";return i!==""&&i===a}function J(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).map(t=>t.toLowerCase()).filter(t=>t.length>=2)}function K(e,t){let n=new Set(t);return[...new Set(e.filter(s=>n.has(s)))].sort()}function U(e){return e.map(t=>t.split("/").pop()?.replace(/\.[^.]+$/,"")||t).join(" + ")}export{ee as a,te as b,w as c,$ as d,F as e};
|
|
2
|
-
//# sourceMappingURL=chunk-PXXYQK55.js.map
|