scip-query 0.23.0 → 0.26.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 +491 -2
- package/README.md +111 -122
- package/dist/augment-vue-worker.js +1 -1
- package/dist/by-kind-PRVFAGTQ.js +2 -0
- package/dist/call-graph-DVPAQV2F.js +2 -0
- package/dist/call-graph-evidence-CUtj8V2I.d.ts +19 -0
- package/dist/chunk-2FSBGL5P.js +2 -0
- package/dist/chunk-2HLAFUCY.js +2 -0
- package/dist/chunk-2IWUT6CJ.js +3 -0
- package/dist/chunk-2KNN7GTQ.js +2 -0
- package/dist/chunk-2LHXRE2B.js +8 -0
- package/dist/{chunk-EG2CPZMJ.js → chunk-2YXE77TJ.js} +2 -2
- package/dist/chunk-36SGVCGX.js +2 -0
- package/dist/chunk-3ABBFPTP.js +2 -0
- package/dist/chunk-3IVFU4FD.js +3 -0
- package/dist/chunk-3JIQS44J.js +7 -0
- package/dist/chunk-3ZRB6DNK.js +7 -0
- package/dist/{chunk-6YTSKJJ3.js → chunk-42EOW5VI.js} +1 -1
- package/dist/{chunk-6I6L7Z62.js → chunk-4BHGBMNO.js} +2 -2
- package/dist/chunk-4BP3UBDG.js +2 -0
- package/dist/chunk-4D6RO7G4.js +2 -0
- package/dist/chunk-4FEWQ6RH.js +2 -0
- package/dist/chunk-4IGEOBG7.js +2 -0
- package/dist/chunk-4QZXBUKC.js +2 -0
- package/dist/chunk-4WBDEVX2.js +4 -0
- package/dist/chunk-4WCUBZU3.js +8 -0
- package/dist/chunk-4WTUBQ36.js +40 -0
- package/dist/chunk-4XQ4O6IM.js +3 -0
- package/dist/chunk-55UQAMZO.js +4 -0
- package/dist/chunk-5D2LVK7O.js +125 -0
- package/dist/chunk-5IYJ56TT.js +2 -0
- package/dist/chunk-5PLMJC7Q.js +2 -0
- package/dist/chunk-5TNQJUR2.js +5 -0
- package/dist/chunk-62BDNPMI.js +2 -0
- package/dist/chunk-64DZ5TXR.js +7 -0
- package/dist/chunk-65245JCM.js +2 -0
- package/dist/chunk-6FFVZZL4.js +2 -0
- package/dist/chunk-6KO5JHAR.js +2 -0
- package/dist/chunk-6LRXOOSX.js +2 -0
- package/dist/chunk-6LSEIIF7.js +2 -0
- package/dist/chunk-6YMNWD3H.js +6 -0
- package/dist/chunk-72AD6ZRR.js +5 -0
- package/dist/chunk-73AAKPUC.js +4 -0
- package/dist/chunk-76CZ77DF.js +2 -0
- package/dist/chunk-7VPEEAAG.js +2 -0
- package/dist/chunk-7WTPQ4NX.js +14 -0
- package/dist/chunk-7Y5T6XDP.js +2 -0
- package/dist/chunk-A2IIGFMJ.js +5 -0
- package/dist/chunk-AB5KCTEV.js +2 -0
- package/dist/chunk-AC566WBP.js +6 -0
- package/dist/chunk-AGWFSTXC.js +3 -0
- package/dist/chunk-AOSIYPTA.js +2 -0
- package/dist/chunk-AUVEWPIF.js +2 -0
- package/dist/chunk-B56T42J3.js +25 -0
- package/dist/chunk-BIQEF5NE.js +2 -0
- package/dist/chunk-BL6XJKTA.js +3 -0
- package/dist/chunk-BMKOQJRI.js +2 -0
- package/dist/chunk-BOZ4EXBB.js +3 -0
- package/dist/chunk-BUTWYEPH.js +2 -0
- package/dist/chunk-BZB4QPIP.js +2 -0
- package/dist/{chunk-ILTDAWEF.js → chunk-CE357GEE.js} +4 -4
- package/dist/chunk-CFN45HFP.js +2 -0
- package/dist/chunk-CFYMZFXT.js +368 -0
- package/dist/chunk-CN5EH7O3.js +2 -0
- package/dist/chunk-D254DNNQ.js +4 -0
- package/dist/chunk-D3FDISIC.js +2 -0
- package/dist/chunk-D3NX5XIE.js +3 -0
- package/dist/chunk-DA7RPPDF.js +3 -0
- package/dist/chunk-DDMC3FON.js +3 -0
- package/dist/chunk-DIO3FUSG.js +2 -0
- package/dist/chunk-DJ2NNSUK.js +3 -0
- package/dist/chunk-DKYQIM3C.js +18 -0
- package/dist/{chunk-JTQVMR42.js → chunk-DOOEL2IV.js} +2 -2
- package/dist/chunk-DVFP6PZI.js +2 -0
- package/dist/chunk-E3FDPXZK.js +2 -0
- package/dist/chunk-E7YNJLCB.js +2 -0
- package/dist/chunk-EFGW5JPH.js +2 -0
- package/dist/chunk-EJVTR244.js +13 -0
- package/dist/chunk-EOV7RTRZ.js +2 -0
- package/dist/chunk-ETOIKRHO.js +2 -0
- package/dist/chunk-EYK3ZAO2.js +3 -0
- package/dist/chunk-F2V2LPET.js +52 -0
- package/dist/chunk-F4LUHJTF.js +2 -0
- package/dist/chunk-F4PUT6IT.js +2 -0
- package/dist/chunk-F56GCXXS.js +5 -0
- package/dist/chunk-FC2EVQRM.js +2 -0
- package/dist/chunk-FL7NBMHP.js +3 -0
- package/dist/chunk-FMRN2TRL.js +3 -0
- package/dist/chunk-FVULPZDF.js +20 -0
- package/dist/chunk-GCKCF5FL.js +43 -0
- package/dist/chunk-GH2PYF46.js +2 -0
- package/dist/chunk-GHJAGXIP.js +2 -0
- package/dist/{chunk-WIWY3CRX.js → chunk-GMVSHUKZ.js} +2 -2
- package/dist/chunk-GS6KDO4R.js +2 -0
- package/dist/chunk-GUUBXNN7.js +2 -0
- package/dist/chunk-GVWX5T43.js +80 -0
- package/dist/chunk-GZKFETP5.js +2 -0
- package/dist/chunk-H4EQHO6J.js +9 -0
- package/dist/chunk-H73WY2RM.js +2 -0
- package/dist/chunk-H75GSPRV.js +60 -0
- package/dist/chunk-HDR3AHSV.js +61 -0
- package/dist/chunk-HQBSL74Y.js +2 -0
- package/dist/chunk-HRRFKWPZ.js +2 -0
- package/dist/chunk-HXENDJC6.js +2 -0
- package/dist/chunk-IIBAZNSW.js +21 -0
- package/dist/chunk-INLMWEUU.js +12 -0
- package/dist/chunk-IWQPAF4F.js +2 -0
- package/dist/chunk-IZJ6YUKP.js +35 -0
- package/dist/chunk-J2TMAIN5.js +60 -0
- package/dist/chunk-J5FJMODQ.js +142 -0
- package/dist/chunk-J7HZPIO3.js +2 -0
- package/dist/chunk-JEVRKFRL.js +2 -0
- package/dist/chunk-JFXSGAEB.js +30 -0
- package/dist/chunk-JVRTHGFS.js +3 -0
- package/dist/chunk-JYWEX7RR.js +360 -0
- package/dist/chunk-K3YL22N6.js +2 -0
- package/dist/chunk-K4CN7GXK.js +12 -0
- package/dist/chunk-K5TBVXU4.js +30 -0
- package/dist/chunk-KDDIE2DP.js +9 -0
- package/dist/chunk-KHWRRPV4.js +2 -0
- package/dist/chunk-KI6NBKDY.js +14 -0
- package/dist/chunk-KU3QRSTH.js +2 -0
- package/dist/chunk-KZBJWZJB.js +2 -0
- package/dist/chunk-L7GFM3NP.js +3 -0
- package/dist/chunk-LMO6PK3V.js +35 -0
- package/dist/chunk-LN4YXJJU.js +2 -0
- package/dist/chunk-LOVIZBJ4.js +43 -0
- package/dist/chunk-LPCRK4A2.js +11 -0
- package/dist/chunk-MMHZKBFA.js +2 -0
- package/dist/{chunk-M2O5NY6W.js → chunk-MOQQBQRD.js} +2 -2
- package/dist/chunk-N2WN6I3L.js +2 -0
- package/dist/chunk-N3ORQT7L.js +2 -0
- package/dist/chunk-NAZ3RAIW.js +2 -0
- package/dist/chunk-NDUNO5JQ.js +2 -0
- package/dist/chunk-NEIWRNAZ.js +4 -0
- package/dist/chunk-NJJMVD65.js +2 -0
- package/dist/chunk-NLOQOBXI.js +20 -0
- package/dist/chunk-NOLZOVCU.js +2 -0
- package/dist/chunk-NOWINRRN.js +2 -0
- package/dist/chunk-NZAXKGRL.js +16 -0
- package/dist/chunk-O2C4UILI.js +2 -0
- package/dist/chunk-O3RHA6ZT.js +3 -0
- package/dist/chunk-O4UZSPPI.js +3 -0
- package/dist/chunk-OGFV2BUX.js +2 -0
- package/dist/chunk-OZCJXZK6.js +499 -0
- package/dist/chunk-P6ODM7BY.js +2 -0
- package/dist/{chunk-XBGWL66K.js → chunk-PAVGPRHJ.js} +2 -2
- package/dist/chunk-PH52RA7D.js +2 -0
- package/dist/chunk-PKN354TH.js +3 -0
- package/dist/chunk-PWOASWEG.js +11 -0
- package/dist/chunk-QIWXRW72.js +2 -0
- package/dist/chunk-QJRMOK5N.js +2 -0
- package/dist/{chunk-YXPUP5G2.js → chunk-QOIXNWQR.js} +2 -2
- package/dist/chunk-QXEUDXBT.js +3 -0
- package/dist/chunk-QYUVVBMR.js +6 -0
- package/dist/chunk-QZ7KQZRN.js +2 -0
- package/dist/chunk-R6LQBUDH.js +2 -0
- package/dist/chunk-RBS42E55.js +20 -0
- package/dist/chunk-RSJKPCFX.js +26 -0
- package/dist/chunk-S6CZA3MV.js +2 -0
- package/dist/chunk-STMVAHJP.js +2 -0
- package/dist/chunk-SYVPTTVW.js +2 -0
- package/dist/chunk-T3I6NHBH.js +2 -0
- package/dist/chunk-T6DK3ZP7.js +2 -0
- package/dist/chunk-TKD34PHN.js +4 -0
- package/dist/chunk-TNNQFH7W.js +2 -0
- package/dist/chunk-TNV7SSUF.js +2 -0
- package/dist/chunk-TO7ZR3EH.js +8 -0
- package/dist/chunk-TOU3CHK4.js +2 -0
- package/dist/chunk-TRBI4UKT.js +2 -0
- package/dist/chunk-TZCVNCAN.js +4 -0
- package/dist/chunk-U4LZA5LL.js +3 -0
- package/dist/chunk-U5RIG3JP.js +3 -0
- package/dist/chunk-UP5KXN2I.js +2 -0
- package/dist/chunk-UQFR3NDH.js +5 -0
- package/dist/chunk-UXYXF7GV.js +2 -0
- package/dist/chunk-VB3GOKOS.js +2 -0
- package/dist/chunk-VF5JZICY.js +2 -0
- package/dist/chunk-VTY3VK6E.js +2 -0
- package/dist/chunk-VX2O4RIS.js +2 -0
- package/dist/chunk-WKPV2TDZ.js +2 -0
- package/dist/chunk-WOFQ5DTB.js +2 -0
- package/dist/chunk-WS4C6TCK.js +2 -0
- package/dist/chunk-WXU3DGPU.js +2 -0
- package/dist/chunk-X6RMKHJQ.js +81 -0
- package/dist/{chunk-4ILJCCXV.js → chunk-XHMN6ZX7.js} +2 -2
- package/dist/chunk-XHTVFLWW.js +2 -0
- package/dist/chunk-XKIDJCIK.js +2 -0
- package/dist/chunk-XTYTYZPT.js +2 -0
- package/dist/chunk-Y2JHHTTA.js +2 -0
- package/dist/chunk-YGVRMGYN.js +4 -0
- package/dist/chunk-YNQCGEQE.js +2 -0
- package/dist/chunk-YOQVEXVE.js +14 -0
- package/dist/chunk-YRT2WLYY.js +2 -0
- package/dist/chunk-YTAP5Y2G.js +2 -0
- package/dist/chunk-YTYWI7VB.js +2 -0
- package/dist/chunk-YULZRALL.js +2 -0
- package/dist/chunk-Z33WQG4Q.js +2 -0
- package/dist/chunk-ZGTYGDMF.js +16 -0
- package/dist/chunk-ZHMRSZFD.js +43 -0
- package/dist/chunk-ZHSP366W.js +10 -0
- package/dist/chunk-ZIBYCYKK.js +7 -0
- package/dist/{chunk-GAS2LJMP.js → chunk-ZLADLUE6.js} +3 -3
- package/dist/chunk-ZO4YXUT6.js +4 -0
- package/dist/{chunk-HYO3NP5Q.js → chunk-ZR4HBC2H.js} +2 -2
- package/dist/cli-main.js +6 -6
- package/dist/cli.js +1 -1
- package/dist/{code-B17qEMbt.d.ts → code-BNyrCF3_.d.ts} +3 -2
- package/dist/code-IL5WH3NZ.js +2 -0
- package/dist/code-result-json-ANTBEDFP.js +4 -0
- package/dist/command-descriptors-HEEMDHTU.js +222 -0
- package/dist/deps-EOWFC6FD.js +2 -0
- package/dist/direct-navigation-Y5B6OSIQ.js +3 -0
- package/dist/{exploration-topology-BG4v30HZ.d.ts → exploration-topology-CSgEyAz-.d.ts} +3 -1
- package/dist/files-K4AI3JUM.js +2 -0
- package/dist/frontend-profile-roles-D7eCum8P.d.ts +10 -0
- package/dist/{health-CPp2Jf1Z.d.ts → health-BtfmNrfa.d.ts} +58 -74
- package/dist/hierarchy-6W5NDIFI.js +2 -0
- package/dist/imports-WH365QY4.js +2 -0
- package/dist/index.d.ts +13 -1
- package/dist/index.js +1 -1
- package/dist/members-K3PHMF5S.js +2 -0
- package/dist/methods-E7KVMBX4.js +2 -0
- package/dist/output-continuation-command-BJSY67SN.js +3 -0
- package/dist/output-pagination-UZJ5ACIX.js +24 -0
- package/dist/postinstall.js +1 -1
- package/dist/project-reindex-EP24WT4X.js +3 -0
- package/dist/queries/affected.js +1 -1
- package/dist/queries/architecture.d.ts +15 -4
- 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 +3 -1
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +1 -0
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.d.ts +3 -3
- 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.d.ts +1 -1
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity.d.ts +6 -3
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/context.d.ts +1 -7
- package/dist/queries/context.js +1 -1
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.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/dependence-slice.d.ts +46 -22
- package/dist/queries/dependence-slice.js +1 -1
- package/dist/queries/dependency-depth.d.ts +1 -7
- package/dist/queries/dependency-depth.js +1 -1
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-impact.d.ts +3 -1
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.d.ts +1 -1
- package/dist/queries/drift.js +1 -1
- package/dist/queries/duplicate-bodies.d.ts +29 -2
- package/dist/queries/duplicate-bodies.js +1 -1
- package/dist/queries/entry-map.d.ts +2 -4
- package/dist/queries/entry-map.js +1 -1
- package/dist/queries/evidence.d.ts +121 -61
- package/dist/queries/evidence.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.d.ts +2 -2
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +1 -1
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +1 -0
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.d.ts +3 -3
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +17 -65
- package/dist/queries/index.js +1 -1
- package/dist/queries/locality-candidates.d.ts +4 -4
- package/dist/queries/locality-candidates.js +1 -1
- package/dist/queries/members.d.ts +2 -2
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.js +1 -1
- package/dist/queries/not-implemented.d.ts +2 -6
- 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/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.d.ts +4 -14
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.d.ts +4 -1
- package/dist/queries/refs.js +1 -1
- package/dist/queries/review.d.ts +188 -0
- package/dist/queries/review.js +2 -0
- package/dist/queries/similar-files.d.ts +7 -10
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +19 -1
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice-cohesion.d.ts +205 -0
- package/dist/queries/slice-cohesion.js +2 -0
- package/dist/queries/source-inspection.d.ts +6 -202
- package/dist/queries/source-inspection.js +1 -1
- package/dist/queries/source-search.d.ts +2 -3
- package/dist/queries/source-search.js +1 -1
- package/dist/queries/stats.d.ts +1 -0
- package/dist/queries/stats.js +1 -1
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system.d.ts +4 -2
- package/dist/queries/system.js +1 -1
- package/dist/queries/test-quality.d.ts +1 -1
- package/dist/queries/test-quality.js +1 -1
- package/dist/queries/twin-drift.d.ts +23 -7
- package/dist/queries/twin-drift.js +1 -1
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.d.ts +3 -15
- package/dist/queries/unused-params.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/query-service-fastpath.js +5 -5
- package/dist/query-service-server.js +4 -4
- package/dist/refs-CCBJG7WK.js +2 -0
- package/dist/refs-pagination-DRNLVU4S.js +2 -0
- package/dist/reindex-worker.js +79 -29
- package/dist/reindex.js +45 -45
- package/dist/repository-cache-worker.js +2 -0
- package/dist/runtime.d.ts +8 -8
- package/dist/runtime.js +3 -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/service-queries-2WAJI7R6.js +6 -0
- package/dist/source-inspection-91U9zdO3.d.ts +341 -0
- package/dist/{source-search-types-Dwz8KeuW.d.ts → source-search-types-DWGYNg8M.d.ts} +15 -2
- package/dist/stats-G7DIV6VU.js +2 -0
- package/dist/surface-IO55UALI.js +2 -0
- package/dist/system-ZBMSHJXU.js +2 -0
- package/dist/{queries/trace.d.ts → trace-BMjw3prn.d.ts} +1 -18
- package/dist/typescript-indexer.js +2 -0
- package/dist/typescript-mailbox-worker.js +1 -1
- package/dist/watch-server.js +3 -3
- package/docs/AGENT_GUIDE.md +19 -128
- package/docs/CLI_JSON_OUTPUT.md +21 -17
- package/docs/COMMAND_REFERENCE.md +34 -49
- package/docs/CURRENT_COMMANDS.md +123 -0
- package/docs/DETECTOR_EVIDENCE_CONTRACTS.md +0 -40
- package/docs/DETECTOR_GUIDE.md +55 -12
- package/docs/PRODUCT_VISION.md +135 -0
- package/docs/PROPERTY_TESTING.md +73 -0
- package/docs/REVIEW.md +76 -0
- package/docs/SKILLS.md +51 -0
- package/docs/WINDOWS_SIDECAR_RELEASE.md +12 -3
- package/docs/accuracy-audit-checklist.md +70 -13
- package/docs/analyzer-inventory.md +2 -2
- package/docs/locality-analyzer-design.md +9 -9
- package/package.json +18 -80
- package/scripts/evidence-product-contract.mjs +7 -3
- package/scripts/record-review-coverage.mjs +118 -0
- package/scripts/scip-windows-provenance.mjs +29 -19
- package/skills/scip-architecture-review/SKILL.md +57 -0
- package/skills/scip-architecture-review/agents/openai.yaml +4 -0
- package/skills/scip-architecture-review/references/design-checks.md +17 -0
- package/skills/scip-explore/SKILL.md +15 -59
- package/skills/scip-explore/agents/openai.yaml +3 -3
- package/skills/scip-explore/references/external-evidence.md +2 -2
- package/skills/scip-explore/references/information-model.md +26 -29
- package/skills/scip-explore/scripts/capture-evidence.mjs +68 -34
- package/skills/scip-integrity-audit/SKILL.md +53 -181
- package/skills/scip-integrity-audit/agents/openai.yaml +3 -3
- package/skills/scip-integrity-audit/references/integrity-probes.md +27 -0
- package/skills/scip-plan/SKILL.md +39 -65
- package/skills/scip-plan/agents/openai.yaml +2 -2
- package/skills/scip-query/SKILL.md +28 -81
- package/skills/scip-query/agents/openai.yaml +2 -2
- package/skills/scip-query/references/command-guide.md +169 -0
- package/skills/scip-setup/SKILL.md +4 -2
- package/skills/scip-setup/agents/openai.yaml +3 -3
- package/dist/by-kind-XI2CSWEY.js +0 -2
- package/dist/call-graph-UONR6JR5.js +0 -2
- package/dist/call-graph-evidence-lZa2dwQA.d.ts +0 -11
- package/dist/chunk-26CT72HM.js +0 -2
- package/dist/chunk-2E7CX53V.js +0 -2
- package/dist/chunk-2GRUZAQF.js +0 -43
- package/dist/chunk-2LDBDR6J.js +0 -29
- package/dist/chunk-2OOY75BW.js +0 -2
- package/dist/chunk-2R3V3PSD.js +0 -4
- package/dist/chunk-2WC2OEDO.js +0 -4
- package/dist/chunk-35NLDRZC.js +0 -2
- package/dist/chunk-3AF4TUFK.js +0 -3
- package/dist/chunk-3D3QG236.js +0 -2
- package/dist/chunk-3FHOF22C.js +0 -21
- package/dist/chunk-3JKSW6LJ.js +0 -2
- package/dist/chunk-3L2ZBPEX.js +0 -133
- package/dist/chunk-3PJABJSU.js +0 -2
- package/dist/chunk-3SVF22I5.js +0 -2
- package/dist/chunk-3WR4E3A3.js +0 -3
- package/dist/chunk-4FTZ4P5G.js +0 -2
- package/dist/chunk-4UX2F3JX.js +0 -2
- package/dist/chunk-4WNW27SX.js +0 -2
- package/dist/chunk-5ENOG4VP.js +0 -61
- package/dist/chunk-64BFSI5I.js +0 -2
- package/dist/chunk-66DVSJQG.js +0 -455
- package/dist/chunk-6HFCYNYE.js +0 -9
- package/dist/chunk-6PQNKL3G.js +0 -3
- package/dist/chunk-6V5CNXL6.js +0 -2
- package/dist/chunk-6VVV4WRR.js +0 -4
- package/dist/chunk-7BWFZPPZ.js +0 -2
- package/dist/chunk-7CYG22FH.js +0 -2
- package/dist/chunk-7F45LJKI.js +0 -2
- package/dist/chunk-7IWV2EG3.js +0 -3
- package/dist/chunk-7KCZELVM.js +0 -2
- package/dist/chunk-AFHTBORT.js +0 -2
- package/dist/chunk-AVRYW5OZ.js +0 -2
- package/dist/chunk-B3X6KU75.js +0 -2
- package/dist/chunk-B5D7QPBE.js +0 -4
- package/dist/chunk-BBCIS4DX.js +0 -16
- package/dist/chunk-BDUVI7TO.js +0 -3
- package/dist/chunk-BE7ZZTMC.js +0 -2
- package/dist/chunk-BHVUJOCQ.js +0 -3
- package/dist/chunk-BJT7LSPK.js +0 -3
- package/dist/chunk-BKVWUP7Y.js +0 -2
- package/dist/chunk-BQGB4HBD.js +0 -2
- package/dist/chunk-BRV7PIFF.js +0 -2
- package/dist/chunk-CEEZJXEF.js +0 -2
- package/dist/chunk-CIYLO6SI.js +0 -7
- package/dist/chunk-CJZXN4NU.js +0 -2
- package/dist/chunk-CNO7TOKL.js +0 -2
- package/dist/chunk-COF23M5F.js +0 -2
- package/dist/chunk-CWFP7GM5.js +0 -2
- package/dist/chunk-D2DHWI3D.js +0 -2
- package/dist/chunk-D4N5SQ2M.js +0 -4
- package/dist/chunk-DBRSYFXR.js +0 -2
- package/dist/chunk-DHUIOLDT.js +0 -2
- package/dist/chunk-DIRJWYBM.js +0 -6
- package/dist/chunk-DIUFNHRJ.js +0 -35
- package/dist/chunk-DRENNWRG.js +0 -2
- package/dist/chunk-DTZCKZEU.js +0 -4
- package/dist/chunk-DULC3QFP.js +0 -5
- package/dist/chunk-DYGHBZ2N.js +0 -16
- package/dist/chunk-E5R6AQ73.js +0 -40
- package/dist/chunk-E73UNJTF.js +0 -38
- package/dist/chunk-EKV5HX33.js +0 -2
- package/dist/chunk-EQHFIL6T.js +0 -3
- package/dist/chunk-ESIQ66Z7.js +0 -2
- package/dist/chunk-EVFUMY4R.js +0 -3
- package/dist/chunk-F7DY272B.js +0 -2
- package/dist/chunk-FBN2FGXG.js +0 -2
- package/dist/chunk-FDLOBR6P.js +0 -4
- package/dist/chunk-FESCRNVV.js +0 -5
- package/dist/chunk-FFRKR4EQ.js +0 -2
- package/dist/chunk-FGA2U4OR.js +0 -8
- package/dist/chunk-FIQRSHVM.js +0 -2
- package/dist/chunk-FPYLNQPT.js +0 -2
- package/dist/chunk-FRUSVINH.js +0 -2
- package/dist/chunk-GSP44ENC.js +0 -2
- package/dist/chunk-GUFSG5TX.js +0 -2
- package/dist/chunk-GYIZ4NXB.js +0 -2
- package/dist/chunk-GZIUDL6G.js +0 -2
- package/dist/chunk-H5EXS3HM.js +0 -2
- package/dist/chunk-HCXEQRFF.js +0 -18
- package/dist/chunk-HEHOQQKH.js +0 -2
- package/dist/chunk-HKGFPJ4T.js +0 -4
- package/dist/chunk-HLZTEXRA.js +0 -2
- package/dist/chunk-HOENASQM.js +0 -3
- package/dist/chunk-HVF5VBG6.js +0 -2
- package/dist/chunk-I55I7XXP.js +0 -2
- package/dist/chunk-IDFEUFKS.js +0 -2
- package/dist/chunk-IHGQTTVW.js +0 -2
- package/dist/chunk-IICPE7B2.js +0 -20
- package/dist/chunk-IL676XCC.js +0 -18
- package/dist/chunk-IW5XQG5G.js +0 -2
- package/dist/chunk-IZDPJ2QI.js +0 -2
- package/dist/chunk-J66VOFW6.js +0 -5
- package/dist/chunk-JFMEXGFE.js +0 -2
- package/dist/chunk-JGKUET5J.js +0 -3
- package/dist/chunk-JS4PGXMV.js +0 -3
- package/dist/chunk-JWTGMPIT.js +0 -80
- package/dist/chunk-JYR66JN5.js +0 -5
- package/dist/chunk-KFOYCQAJ.js +0 -9
- package/dist/chunk-KLFEXGQA.js +0 -2
- package/dist/chunk-KMVGRIO2.js +0 -2
- package/dist/chunk-KYSDI3GE.js +0 -5
- package/dist/chunk-L6PJPETJ.js +0 -29
- package/dist/chunk-LDVT66YM.js +0 -2
- package/dist/chunk-LEECKFCJ.js +0 -2
- package/dist/chunk-LMZ5PRUV.js +0 -2
- package/dist/chunk-LQRQN2XA.js +0 -2
- package/dist/chunk-LXABEJX3.js +0 -2
- package/dist/chunk-MNV5FSBW.js +0 -3
- package/dist/chunk-MPQ4OTBM.js +0 -2
- package/dist/chunk-MTDBHTSF.js +0 -2
- package/dist/chunk-MV3CDXPI.js +0 -38
- package/dist/chunk-MWN53KRN.js +0 -60
- package/dist/chunk-MXNGIEPU.js +0 -3
- package/dist/chunk-N2ZSIIGR.js +0 -117
- package/dist/chunk-N5B2NILC.js +0 -5
- package/dist/chunk-NJITK2GP.js +0 -2
- package/dist/chunk-NOGJXYFO.js +0 -2
- package/dist/chunk-NOYBFVJA.js +0 -554
- package/dist/chunk-NWQXSFFU.js +0 -3
- package/dist/chunk-ODDUPDP7.js +0 -13
- package/dist/chunk-OLIWTZI3.js +0 -3
- package/dist/chunk-OLNV6I6U.js +0 -2
- package/dist/chunk-OR2E3AGZ.js +0 -2
- package/dist/chunk-OSR2GEHQ.js +0 -2
- package/dist/chunk-OSSESPDX.js +0 -3
- package/dist/chunk-OWOOWNJ5.js +0 -7
- package/dist/chunk-P42EIXTA.js +0 -2
- package/dist/chunk-PJFGPYTU.js +0 -2
- package/dist/chunk-PP7KNN7L.js +0 -2
- package/dist/chunk-PU7T5QYQ.js +0 -2
- package/dist/chunk-PWWAJSKV.js +0 -74
- package/dist/chunk-PZL5T7SU.js +0 -73
- package/dist/chunk-QBE3YX64.js +0 -23
- package/dist/chunk-QGVTFRY2.js +0 -7
- package/dist/chunk-QOJONDS7.js +0 -2
- package/dist/chunk-QU5XRYB5.js +0 -4
- package/dist/chunk-QUU5OBVK.js +0 -11
- package/dist/chunk-RBLQNW26.js +0 -20
- package/dist/chunk-RTQ7NEKG.js +0 -81
- package/dist/chunk-SQXRS7BG.js +0 -4
- package/dist/chunk-SSK6LDPC.js +0 -2
- package/dist/chunk-SZHGTCPP.js +0 -7
- package/dist/chunk-T4N4P2K5.js +0 -16
- package/dist/chunk-TA3QKLLU.js +0 -2
- package/dist/chunk-TEBQMNVI.js +0 -43
- package/dist/chunk-TPFHAQ2G.js +0 -2
- package/dist/chunk-TQPCBMWT.js +0 -5
- package/dist/chunk-TQZV7KV4.js +0 -2
- package/dist/chunk-TRNAEQ6P.js +0 -3
- package/dist/chunk-TY7CRN3Z.js +0 -2
- package/dist/chunk-UHFYCMZO.js +0 -35
- package/dist/chunk-UICY4GTQ.js +0 -7
- package/dist/chunk-UVGEWT4Y.js +0 -26
- package/dist/chunk-UXW33INU.js +0 -29
- package/dist/chunk-VMPRET3I.js +0 -5
- package/dist/chunk-VNLGKHS6.js +0 -6
- package/dist/chunk-VQILFTEH.js +0 -2
- package/dist/chunk-VUPHCS7Y.js +0 -57
- package/dist/chunk-VVZSBTSU.js +0 -23
- package/dist/chunk-VZRNID6A.js +0 -2
- package/dist/chunk-W5OXRYGE.js +0 -7
- package/dist/chunk-W6STWDQI.js +0 -57
- package/dist/chunk-W7CXK74K.js +0 -2
- package/dist/chunk-WB3WYIRE.js +0 -4
- package/dist/chunk-WDNVY4E7.js +0 -20
- package/dist/chunk-WK46TNUM.js +0 -3
- package/dist/chunk-WNTFFKAX.js +0 -12
- package/dist/chunk-WOIKCX6A.js +0 -2
- package/dist/chunk-WUN6KBHV.js +0 -2
- package/dist/chunk-WYCTJDVR.js +0 -2
- package/dist/chunk-WYPL7GF7.js +0 -2
- package/dist/chunk-XDAUYDFT.js +0 -2
- package/dist/chunk-XDQMU3BT.js +0 -2
- package/dist/chunk-XFA4SSO3.js +0 -3
- package/dist/chunk-XGZEP6GR.js +0 -8
- package/dist/chunk-XPDPNWTQ.js +0 -368
- package/dist/chunk-XRYABF57.js +0 -8
- package/dist/chunk-YBGKCQIS.js +0 -2
- package/dist/chunk-YEN6CYC7.js +0 -16
- package/dist/chunk-YF5IB2LF.js +0 -2
- package/dist/chunk-YI2AWIHC.js +0 -3
- package/dist/chunk-YPWBKGFU.js +0 -2
- package/dist/chunk-YPWHBBIS.js +0 -2
- package/dist/chunk-YSH6U3L4.js +0 -3
- package/dist/chunk-YU5DZUZI.js +0 -10
- package/dist/chunk-YWO5DDRC.js +0 -16
- package/dist/chunk-Z4CDXYNQ.js +0 -2
- package/dist/chunk-ZF5KHH7C.js +0 -2
- package/dist/chunk-ZOHS7AQV.js +0 -21
- package/dist/chunk-ZTI4SBFV.js +0 -3
- package/dist/code-MI6F2TTU.js +0 -2
- package/dist/code-result-json-FXALY4HE.js +0 -2
- package/dist/command-descriptors-P34VABY5.js +0 -343
- package/dist/dataflow-4KEMJPC6.js +0 -2
- package/dist/dependence-slice-R7FPWD5M.js +0 -2
- package/dist/deps-7EMQUYUT.js +0 -2
- package/dist/direct-navigation-6YO234F2.js +0 -3
- package/dist/entry-map-KOOLR26E.js +0 -2
- package/dist/files-OPIPJIGZ.js +0 -2
- package/dist/graph-evidence-Bjyky2V4.d.ts +0 -126
- package/dist/hierarchy-QPD2CAER.js +0 -2
- package/dist/imports-M6HUXRXC.js +0 -2
- package/dist/members-I5MEFOCT.js +0 -2
- package/dist/methods-5JYGGHXA.js +0 -2
- package/dist/next-anchor-candidates-BwMczMvX.d.ts +0 -90
- package/dist/output-continuation-command-UPQAAKBP.js +0 -3
- package/dist/output-pagination-3OFL2MJV.js +0 -19
- package/dist/project-reindex-UKKQ5PLS.js +0 -3
- package/dist/queries/anchors.d.ts +0 -123
- package/dist/queries/anchors.js +0 -2
- package/dist/queries/complexity-hotspots.d.ts +0 -40
- package/dist/queries/complexity-hotspots.js +0 -2
- package/dist/queries/convergence.d.ts +0 -33
- package/dist/queries/convergence.js +0 -2
- package/dist/queries/dataflow.d.ts +0 -77
- package/dist/queries/dataflow.js +0 -2
- package/dist/queries/deep-chains.d.ts +0 -5
- package/dist/queries/deep-chains.js +0 -2
- package/dist/queries/extract-candidates.d.ts +0 -52
- package/dist/queries/extract-candidates.js +0 -2
- package/dist/queries/isolated.d.ts +0 -24
- package/dist/queries/isolated.js +0 -2
- package/dist/queries/plan-context.d.ts +0 -33
- package/dist/queries/plan-context.js +0 -2
- package/dist/queries/reference-neighborhood.d.ts +0 -4
- package/dist/queries/reference-neighborhood.js +0 -2
- package/dist/queries/reference-reachability.d.ts +0 -48
- package/dist/queries/reference-reachability.js +0 -2
- package/dist/queries/self-audit.d.ts +0 -63
- package/dist/queries/self-audit.js +0 -2
- package/dist/queries/similar-chains.d.ts +0 -48
- package/dist/queries/similar-chains.js +0 -2
- package/dist/queries/slice.d.ts +0 -4
- package/dist/queries/slice.js +0 -2
- package/dist/queries/stale-abstractions.d.ts +0 -72
- package/dist/queries/stale-abstractions.js +0 -2
- package/dist/queries/system-map.d.ts +0 -449
- package/dist/queries/system-map.js +0 -2
- package/dist/queries/trace.js +0 -2
- package/dist/queries/twin-ab.d.ts +0 -66
- package/dist/queries/twin-ab.js +0 -2
- package/dist/queries/value-flow.d.ts +0 -43
- package/dist/queries/value-flow.js +0 -2
- package/dist/queries/wrapper-candidates.d.ts +0 -34
- package/dist/queries/wrapper-candidates.js +0 -2
- package/dist/refs-PSU4JZZW.js +0 -2
- package/dist/refs-pagination-JG6CJMRC.js +0 -2
- package/dist/slice-HYRATV64.js +0 -2
- package/dist/source-snippet-_wrcgmZc.d.ts +0 -15
- package/dist/stats-OOJ74B32.js +0 -2
- package/dist/surface-VTGDYWF5.js +0 -2
- package/dist/symbol-resolution-WD5EU5JE.js +0 -2
- package/dist/system-LRQNFOR2.js +0 -2
- package/dist/trace-F4B6OLL4.js +0 -2
- package/dist/value-flow-VRPZY72V.js +0 -2
- package/skills/concrete-plan/SKILL.md +0 -8
- package/skills/concrete-plan/agents/openai.yaml +0 -4
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as T,b as q}from"./chunk-5PLMJC7Q.js";import{a as E,b as A,c as R,d as w}from"./chunk-TNNQFH7W.js";import{a as C,b as P,c as x,e as h,f as v,g as S}from"./chunk-2KNN7GTQ.js";import{a as B,b as H}from"./chunk-NOLZOVCU.js";import{$ as b}from"./chunk-FVULPZDF.js";function z(e,t={}){return F(e,t).results}function F(e,t={}){let{minSimilarity:s=.45,minSharedBehaviors:i=6,limit:a=20,scope:n,scanLimit:c,filePattern:d,focusFiles:u}=t,l=E(e),r=new A,f=b(e).reactProfiles({scope:n,minBehaviorTokens:Math.max(3,i),scanLimit:c}).filter(o=>l.roleOf(o.file)!=="test"?!0:(r.record("test-files",R.testFiles),!1)).map(o=>({file:o.file,component:o.name,tokens:o.behaviorTokens,profile:o})),k=T(f,o=>o.tokens);return{results:q({profiles:f,limit:a,filePattern:d,focusFiles:u,candidateIndex:k,profile:{name:"react-hook-candidates"},compare:(o,m)=>{let p=l.pairContext(o.file,m.file),y=V(o,m,s,i,p);return y?o.profile.kind!==m.profile.kind?(r.record("hook-component-pairs",R.hookComponentPairs),null):p==="ui-kit-pair"?(r.record("ui-kit-pairs",R.uiKitPairs),null):y:null},sort:S}),exclusions:r.list()}}function V(e,t,s,i,a){let n=B(e.tokens,t.tokens);if(n.size<i||!I(n))return null;let c=P(e.tokens,t.tokens);if(c<s)return null;let d=h(n,"hook:"),u=h(n,"react-hook:"),l=h(n,"effect:"),r=h(n,"state:"),f=h(n,"request:"),k=h(n,"handler:"),g=h(n,"handler-verb:"),o=O({sharedHooks:d,sharedReactHooks:u,sharedEffects:l,sharedState:r,sharedRequests:f,sharedHandlers:k,sharedHandlerVerbs:g}),m=w(a),p=j(a,o.actionTier,o.recommendation);return{fileA:e.file,componentA:e.component,fileB:t.file,componentB:t.component,similarity:c,tokenCountA:e.tokens.size,tokenCountB:t.tokens.size,sharedTokens:v(n),sharedHooks:d,sharedReactHooks:u,sharedEffects:l,sharedState:r,sharedRequests:f,sharedHandlers:k,sharedHandlerVerbs:g,evidenceClass:o.evidenceClass,actionTier:p.actionTier,evidenceClassReasons:m?[m,...o.reasons]:o.reasons,recommendation:p.recommendation,unitKind:e.profile.kind==="hook"&&t.profile.kind==="hook"?"hook":"component",pairContext:a,uniqueToA:v(H(e.tokens,t.tokens)),uniqueToB:v(H(t.tokens,e.tokens)),reason:_({sharedHooks:d,sharedReactHooks:u,sharedEffects:l,sharedState:r,sharedRequests:f,sharedHandlers:k,sharedHandlerVerbs:g}),locA:e.profile.loc,locB:t.profile.loc}}function j(e,t,s){switch(e){case"framework-route-pair":return{actionTier:t,recommendation:s};case"intercepting-route-pair":return{actionTier:t,recommendation:"Render one shared view component from both the intercepting route and its target route instead of repeating the behavior in each body."};case"ui-kit-pair":case"product":return{actionTier:t,recommendation:s}}}function O(e){return C({genericWords:$,stripPrefixes:D,primitiveGroups:[{values:e.sharedReactHooks,reasonPrefix:"shared React primitives",bucket:"generic"},{values:e.sharedEffects,reasonPrefix:"shared lifecycle primitive",bucket:"generic"}],nameGroups:[{names:e.sharedHooks,label:"shared hook",fallbackBucket:"shared-abstraction"},{names:e.sharedRequests,label:"shared request",fallbackBucket:"generic"},{names:e.sharedState,label:"shared state",fallbackBucket:"generic"},{names:e.sharedHandlers,label:"shared handler",fallbackBucket:"generic"},{names:e.sharedHandlerVerbs,label:"shared action verb",fallbackBucket:"generic"}],recommendation:W})}function W(e){switch(e){case"domain-behavior":return"Review for a shared hook, controller, or feature module around the named domain behavior.";case"mixed":return"Separate generic React mechanics from domain-specific behavior before extracting a shared hook.";case"shared-abstraction":return"Review the existing shared hook usage first; extract only if duplicated behavior remains outside it.";case"generic-workflow-scaffolding":return"Treat as support evidence for a repeated workflow shape, not direct hook-extraction evidence."}}function I(e){let t=0,s=0,i=0,a=0,n=0,c=0,d=0;for(let r of e)r.startsWith("hook:")?t+=1:r.startsWith("react-hook:")?s+=1:r.startsWith("effect:")?i+=1:r.startsWith("request:")?a+=1:r.startsWith("handler:")||r.startsWith("handler-verb:")?n+=1:r.startsWith("state:")?c+=1:r.startsWith("state-hook:")&&(d+=1);let u=c+d,l=t+s+i+a+n+u;return x([{name:"requests",count:a},{name:"customHooks",count:t},{name:"namedStates",count:c},{name:"handlers",count:n},{name:"effects",count:i},{name:"reactHooks",count:s},{name:"namedBehavior",count:l}],[{min:{requests:1,namedBehavior:4},reason:"shared request workflow"},{min:{customHooks:1,requests:1,namedBehavior:5},reason:"shared custom hook and request workflow"},{min:{customHooks:1,namedStates:1,namedBehavior:5},reason:"shared custom hook and state"},{min:{customHooks:1,handlers:2,namedBehavior:5},reason:"shared custom hook and handlers"},{min:{namedStates:1,handlers:2,effects:1,namedBehavior:5},reason:"shared stateful effects"},{min:{namedStates:1,handlers:2,reactHooks:2,namedBehavior:5},reason:"shared stateful React primitives"}]).pass}function _(e){let t=[];return e.sharedHooks.length&&t.push(`shared hooks: ${e.sharedHooks.join(", ")}`),e.sharedReactHooks.length&&t.push(`shared React hooks: ${e.sharedReactHooks.join(", ")}`),e.sharedEffects.length&&t.push(`shared effects: ${e.sharedEffects.join(", ")}`),e.sharedState.length&&t.push(`shared state: ${e.sharedState.join(", ")}`),e.sharedRequests.length&&t.push(`shared requests: ${e.sharedRequests.join(", ")}`),e.sharedHandlers.length&&t.push(`shared handlers: ${e.sharedHandlers.slice(0,6).join(", ")}`),e.sharedHandlerVerbs.length&&t.push(`shared action verbs: ${e.sharedHandlerVerbs.slice(0,6).join(", ")}`),t.join("; ")||"shared React behavior profile"}var $=new Set(["add","apply","async","callback","cancel","change","clear","client","close","context","create","data","deferred","delete","dispatch","draft","edit","effect","error","fetch","field","filter","form","handle","has","id","infinite","is","item","items","load","loader","loading","memo","mutate","mutation","name","navigate","navigation","open","params","pathname","query","reducer","refresh","ref","remove","request","reset","resource","router","row","rows","save","saving","search","select","selected","selector","state","store","submit","suspense","toggle","transition","update","use","value"]),D=[/^use(?=[A-Z])/,/^handle(?=[A-Z])/,/^is(?=[A-Z])/,/^has(?=[A-Z])/];export{z as a,F as b};
|
|
2
|
+
//# sourceMappingURL=chunk-5IYJ56TT.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as d}from"./chunk-GVWX5T43.js";function F(e,i){let n=new Map;return e.forEach((r,l)=>{let t=new Set;for(let o of i(r)){if(t.has(o))continue;t.add(o);let a=n.get(o);a?a.push(l):n.set(o,[l])}}),{candidatesFor:(r,l)=>{let t=new Set;for(let o of i(r)){let a=n.get(o);if(a)for(let s of a)s!==l&&t.add(s)}return[...t].sort((o,a)=>o-a)}}}function g(e){let i=u(e.profile?.name),n=()=>{let r=[];i=u(e.profile?.name,e);let l=(o,a)=>{let s=e.profiles[o],m=e.profiles[a];i.candidatePairs+=1,i.comparedPairs+=1;let f=e.compare(s,m);f&&r.push(f)};e.filePattern?p(e,l):e.focusFiles?.size!==0&&(i.overrunApplied=w(e,l,()=>r.length)),r.sort(e.sort??((o,a)=>a.similarity-o.similarity)),i.matchedResults=r.length;let t=r.slice(0,e.limit);return i.emittedResults=t.length,e.onProfile?.({...i}),t};return e.profile?d(`pairwise-profile:${e.profile.name}`,n,()=>({...x(e.profile?.metadata),...i})):n()}function p(e,i){let n=new Set;for(let r=0;r<e.profiles.length;r++){let l=e.profiles[r];if(l.file.includes(e.filePattern))for(let t of b(e,r)){let o=e.profiles[t];if(!P(e.focusFiles,l,o))continue;let a=`${Math.min(r,t)}:${Math.max(r,t)}`;n.has(a)||(n.add(a),i(r,t))}}}function w(e,i,n){let r=typeof e.overrunFactor=="number"&&Number.isFinite(e.limit)?e.limit*e.overrunFactor:Number.POSITIVE_INFINITY;for(let l=0;l<e.profiles.length;l+=1){let t=e.profiles[l];for(let o of R(e,l))P(e.focusFiles,t,e.profiles[o])&&i(l,o);if(n()>r)return!0}return!1}function P(e,i,n){return e===void 0||e.has(i.file)||e.has(n.file)}function b(e,i){if(e.candidateIndex)return c(e,i,-1);let n=[];for(let r=0;r<e.profiles.length;r+=1)r!==i&&n.push(r);return n}function R(e,i){if(e.candidateIndex)return c(e,i,i);let n=[];for(let r=i+1;r<e.profiles.length;r+=1)n.push(r);return n}function c(e,i,n){let r=e.profiles[i],l=new Set;for(let t of e.candidateIndex?.candidatesFor(r,i,e.profiles)??[])t<=n||t!==i&&(t<0||t>=e.profiles.length||l.add(t));return[...l].sort((t,o)=>t-o)}function u(e,i){return{pipeline:e,profileCount:i?.profiles.length??0,focusedProfileCount:i?.focusFiles?i.profiles.filter(n=>i.focusFiles.has(n.file)).length:0,candidatePairs:0,comparedPairs:0,matchedResults:0,emittedResults:0,candidateIndexApplied:i?.candidateIndex!==void 0,focusApplied:i?.focusFiles!==void 0,filePatternApplied:i?.filePattern!==void 0,overrunApplied:!1}}function x(e){return typeof e=="function"?e():e??{}}export{F as a,g as b};
|
|
2
|
+
//# sourceMappingURL=chunk-5PLMJC7Q.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{isAbsolute as nt,relative as kn}from"path";var g=class extends Error{constructor(n,r){super(`refusing unsafe project file path ${JSON.stringify(n)} (${r})`);this.relativePath=n;this.reason=r;this.name="UnsafeProjectPathError"}relativePath;reason;code="SCIP_QUERY_UNSAFE_PROJECT_PATH"};function me(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function jo(e){return e.replace(/\\/g,"/")}function xo(e,t){return me(e)===me(t)}function P(e,t){let n=kn(e,t);return n===""||!n.startsWith("..")&&!nt(n)}function F(e){if(!e)throw new g(e,"empty-path");if(e.includes("\0"))throw new g(e,"nul-byte");if(nt(e)||/^[A-Za-z]:/.test(e)||e.startsWith("//")||e.startsWith("\\\\"))throw new g(e,"absolute-path");let t=me(e);if(t.split("/").some(r=>r===".."))throw new g(e,"parent-traversal");if(!t||t===".")throw new g(e,"empty-path");return t}function X(e,t,n=[]){let r=ye(e);if(ut.has(r)||n.some(o=>Y(r,o))||t.some(o=>lt(r,o)))return"config";if(t.some(ft)&&/\.d\.(?:ts|mts|cts)$/.test(r.toLowerCase()))return"ambient";let i=pt(r);return t.some(o=>(dt[o]??[]).includes(i))?"source":"other"}function at(e,t,n){let r=ye(e);if(ut.has(r)||n?.some(o=>Y(r,o))||lt(r,t)||ft(t)&&/\.d\.(?:ts|mts|cts)$/.test(r.toLowerCase()))return!0;let i=pt(r);return(dt[t]??[]).includes(i)}function Fo(e){if(typeof e!="object"||e===null)return null;let t=e;return!An(t)||t.clojureConfigPath!==void 0&&typeof t.clojureConfigPath!="string"||!Array.isArray(t.files)||!t.files.every(Dn)?null:t}function rt(e){return{...e,files:e.files.map(({semanticHash:t,...n})=>n)}}function wo(e,t){return!e||!t?e===t:JSON.stringify(rt(e))===JSON.stringify(rt(t))}function Rn(e,t,n,r){if(!n&&r)return{kind:"added",path:e,inputKind:t,after:r};if(n&&!r)return{kind:"deleted",path:e,inputKind:t,before:n};if(n&&r&&(n.hash!==r.hash||n.size!==r.size))return{kind:"modified",path:e,inputKind:t,before:n,after:r}}function Tn(e,t){let n=e?.files??[],r=new Set;return e||r.add("prior-snapshot-unavailable"),e&&e.version!==t.version&&r.add("snapshot-version-changed"),(ot(n)||ot(t.files))&&r.add("duplicate-input-path"),[...n,...t.files].some(On)&&r.add("unreadable-input"),[...r].sort()}function vo(e,t){let n=new Map((e?.files??[]).map(c=>[c.path,c])),r=new Map(t.files.map(c=>[c.path,c])),i=new Set([...n.keys(),...r.keys()]),o=[];for(let c of[...i].sort()){let a=n.get(c),u=r.get(c),l=X(c,t.languages),f=Rn(c,l,a,u);f&&o.push(f)}let s=Tn(e,t);return{version:1,changes:o,projectIdentityChanged:e?!_n(e,t):!0,uncertainty:s}}function it(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function ot(e){return new Set(e.map(t=>t.path)).size!==e.length}function Dn(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.path=="string"&&typeof t.size=="number"&&Number.isFinite(t.size)&&typeof t.hash=="string"&&(t.semanticHash===void 0||typeof t.semanticHash=="string")}function On(e){return e.hash==="unreadable"||e.size<0}function _n(e,t){return st(e.languages,t.languages)&&e.pnpmWorkspaces===t.pnpmWorkspaces&&e.typescriptProjectMode===t.typescriptProjectMode&&st(e.typescriptProjects,t.typescriptProjects)&&e.clojureConfigPath===t.clojureConfigPath}function st(e,t){if(e.length!==t.length)return!1;let n=[...e].sort(),r=[...t].sort();return n.every((i,o)=>i===r[o])}var ut=new Set([".scipquery.json"]),Bn={typescript:["tsconfig.json"],javascript:["package.json"],java:["pom.xml","build.gradle"],scala:["build.sbt"],kotlin:["build.gradle.kts"],rust:["Cargo.toml"],python:["pyproject.toml","setup.py"],ruby:["Gemfile"],go:["go.mod"],cpp:["CMakeLists.txt","Makefile"],c:["CMakeLists.txt","Makefile"],csharp:["*.csproj","*.sln"],vb:["*.vbproj","*.sln"],dart:["pubspec.yaml"],php:["composer.json"],clojure:["deps.edn","project.clj","bb.edn","shadow-cljs.edn"]},Ln={typescript:["package.json","package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb","tsconfig.*.json","jsconfig.json","jsconfig.*.json"],javascript:["package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb","tsconfig.json","tsconfig.*.json","jsconfig.json","jsconfig.*.json"],java:["build.gradle.kts","settings.gradle","settings.gradle.kts","gradle.properties","gradle.lockfile","gradle-wrapper.properties"],scala:["plugins.sbt","build.properties"],kotlin:["pom.xml","build.gradle","settings.gradle","settings.gradle.kts","gradle.properties","gradle.lockfile","gradle-wrapper.properties"],rust:["Cargo.lock","rust-project.json","rust-toolchain","rust-toolchain.toml"],python:["setup.cfg","requirements*.txt","Pipfile","Pipfile.lock","poetry.lock","uv.lock"],ruby:["Gemfile.lock","gems.locked"],go:["go.sum","go.work","go.work.sum"],cpp:["compile_commands.json"],c:["compile_commands.json"],csharp:["Directory.Build.props","Directory.Build.targets","Directory.Packages.props","packages.lock.json","NuGet.Config","global.json"],vb:["Directory.Build.props","Directory.Build.targets","Directory.Packages.props","packages.lock.json","NuGet.Config","global.json"],dart:["pubspec.lock","analysis_options.yaml"],php:["composer.lock"],clojure:[]},ct=new Map;function lt(e,t){return Bn[t].some(n=>Y(e,n))||Ln[t].some(n=>Y(e,n))}function Y(e,t){let n=ye(t).replace(/^\.\//,"");if(!n)return!1;let r=e.split("/").at(-1)??e,i=n.includes("/")?e:r;if(!n.includes("*")&&!n.includes("?"))return i===n;let o=ct.get(n);if(!o){let s=n.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/\?/g,"[^/]");o=new RegExp(`^${s}$`),ct.set(n,o)}return o.test(i)}function ye(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function pt(e){return e.includes(".")?`.${e.split(".").at(-1).toLowerCase()}`:""}function ft(e){return e==="typescript"||e==="javascript"}var dt={typescript:[".ts",".tsx",".mts",".cts"],javascript:[".js",".jsx",".mjs",".cjs",".vue"],java:[".java"],scala:[".scala"],kotlin:[".kt",".kts"],rust:[".rs"],python:[".py",".pyi"],ruby:[".rb"],go:[".go"],cpp:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"],c:[".c",".h"],csharp:[".cs"],vb:[".vb"],dart:[".dart"],php:[".php"],clojure:[".clj",".cljs",".cljc"]};function An(e){return!(typeof e.version!="number"||!it(e.languages)||typeof e.pnpmWorkspaces!="boolean"||typeof e.typescriptProjectMode!="string"||!it(e.typescriptProjects))}import{closeSync as Se,fstatSync as Q,openSync as be,readSync as Pe}from"fs";import{createHash as Nn}from"crypto";var Z=8*1024*1024,Mn=64*1024*1024,Gn=512*1024*1024,Wn=256*1024*1024,k=class extends Error{constructor(n,r,i,o,s){let c=i==="too-large"?`is ${o} bytes; the safety limit is ${s} bytes`:i==="not-regular"?"is not a regular file":"changed while it was being read";super(`${n} ${JSON.stringify(r)} ${c}`);this.inputKind=n;this.inputPath=r;this.reason=i;this.observedBytes=o;this.limitBytes=s;this.name="BoundedFileReadError"}inputKind;inputPath;reason;observedBytes;limitBytes;code="SCIP_QUERY_BOUNDED_FILE_READ"};function _(e,t){w(t.maxBytes);let n=String(e),r=be(e,"r");try{let i=Q(r);yt(i,t,n);let o=je(r,i.size);return mt(i,Q(r),o.byteLength,t,n),o}finally{Se(r)}}function je(e,t){w(t);let n=Buffer.allocUnsafe(t),r=0;for(;r<n.length;){let i=Pe(e,n,r,n.length-r,r);if(i===0)break;r+=i}return n.subarray(0,r)}function gt(e,t,n="utf8"){return _(e,t).toString(n)}function N(e,t){return gt(e,{maxBytes:Z,inputKind:t})}function xe(e,t){w(t.maxBytes);let n=[],r=Buffer.allocUnsafe(64*1024),i=0;for(;;){let o=Pe(e,r,0,r.length,null);if(o===0)break;if(i+=o,!Number.isSafeInteger(i)||i>t.maxBytes)throw new k(t.inputKind,`file descriptor ${e}`,"too-large",i,t.maxBytes);n.push(Buffer.from(r.subarray(0,o)))}return Buffer.concat(n,i)}function zn(e,t,n="utf8"){return xe(e,t).toString(n)}function ht(e,t){let n=be(e,"r");try{return xe(n,t)}finally{Se(n)}}function Hn(e,t,n="utf8"){return ht(e,t).toString(n)}function ee(e,t,n){w(t.maxBytes);let r=String(e),i=be(e,"r");try{let o=Q(i);yt(o,t,r);let s=Buffer.allocUnsafe(Math.min(1024*1024,Math.max(1,o.size))),c=0;for(;c<o.size;){let a=Pe(i,s,0,Math.min(s.length,o.size-c),c);if(a===0)break;n(s.subarray(0,a)),c+=a}return mt(o,Q(i),c,t,r),c}finally{Se(i)}}function $n(e,t){let n=Nn("sha256");return ee(e,t,r=>n.update(r)),n.digest("hex")}function mt(e,t,n,r,i){if(t.dev!==e.dev||t.ino!==e.ino||t.size!==e.size||t.mtimeMs!==e.mtimeMs||n!==e.size)throw new k(r.inputKind,i,"changed-during-read",t.size,r.maxBytes)}function yt(e,t,n){if(!e.isFile())throw new k(t.inputKind,n,"not-regular",Number(e.size),t.maxBytes);if(e.size>t.maxBytes)throw new k(t.inputKind,n,"too-large",Number(e.size),t.maxBytes)}function w(e){if(!Number.isSafeInteger(e)||e<0)throw new RangeError(`maxBytes must be a non-negative safe integer; received ${e}`)}function Bo(e){return`${e}+scip-query-symbols.6`}import{spawnSync as Un}from"child_process";import{createHash as Jn}from"crypto";import{existsSync as Kn,lstatSync as qn,realpathSync as Yn}from"fs";import{dirname as Xn,isAbsolute as Qn,join as Zn,relative as zo,resolve as re,sep as Ho}from"path";var St=Symbol.for("scip-query.project-file-listing-context.v1"),bt=globalThis,Ce=bt[St],v=Ce&&typeof Ce=="object"?Ce:{};bt[St]=v;function Pt(e,t){let n=v.active?v.canonicalProjectRoots:void 0,r=n?.get(e);if(r!==void 0)return r;let i=t();return n?.set(e,i),i}function jt(){return v.sequence??0}function xt(e,t,n){let r=v.active,i=r?.get(e);if(i&&i.pathBytes<=t)return i;let o=Vn(n(),(v.sequence??0)+1);if(v.sequence=o.sequence,o.pathBytes>t)throw new RangeError(`Git project file listing exceeded ${t} path bytes.`);return r?.set(e,o),o}function Ct(e,t){let n=v.active?.get(e);return n&&n.sequence>t?n.indexAllowsTreeFingerprintReuse:void 0}function*Ft(e){let t=0;for(;t<e.taggedOutput.length;){let n=e.taggedOutput.indexOf("\0",t);if(n<0)return;yield e.taggedOutput.slice(t+2,n),t=n+1}}function Vn(e,t){let n=0,r=0,i=!0;for(;n<e.length;){let o=e.indexOf("\0",n);if(o<0||o<=n+2||e[n+1]!==" ")throw new Error("Git returned a malformed tagged project file listing.");let s=e[n];i&&=s==="H"||s==="?",r+=1,n=o+1}return{taggedOutput:e,pathBytes:Buffer.byteLength(e,"utf8")-r*2,indexAllowsTreeFingerprintReuse:i,sequence:t}}var E={run(e,t){let n=vt(e,t);return n.kind==="success"?n.output:void 0},runResult:vt},er=["rev-parse","--show-toplevel","--absolute-git-dir","--git-common-dir","HEAD","HEAD^{tree}"],we=["status","--porcelain=v2","--branch","-z","--untracked-files=all"],te=/^[0-9a-f]{40,64}$/;function Vo(e,t,n=E){if(!t||t.startsWith("-")||/[\0\r\n]/.test(t))throw new Error(`Invalid Git revision ${JSON.stringify(t)}.`);let r=n.runResult(e,["rev-parse","--verify","--end-of-options",`${t}^{commit}`]);if(r.kind!=="success"||!te.test(r.output))throw new Error(`Git revision ${JSON.stringify(t)} does not resolve to exactly one commit.`);return r.output}function Uo(e,t=E){return tr(e,t)?.context}function tr(e,t=E){let n=t.runResult(e,er);if(n.kind==="success"){let i=nr(n.output);if(i){let o=rr(i,t);if(o)return wt(o)}}let r=ir(e,t);return r?wt(r):void 0}function Jo(e,t=E){if(!e.headCommit)return;let n=t.run(e.projectRoot,we);if(n===void 0)return;let r=ve(n);if(!(!r?.headCommit||r.headCommit!==e.headCommit))return{...e,clean:r.clean}}function Ko(e,t=E,n={}){let r=t===E&&n.cachedInventoryAfterSequence!==void 0?Ct(e,n.cachedInventoryAfterSequence):void 0;if(r!==void 0)return r;let i=t.run(e,["ls-files","-v","-z"]);return i===void 0?!1:i.split("\0").filter(Boolean).every(o=>o.startsWith("H "))}function wt(e){return{context:e,projectFileInventorySequence:jt()}}function ve(e){let t=e.split("\0").filter(Boolean),n=t.find(i=>i.startsWith("# branch.oid "))?.slice(13),r=n==="(initial)"?void 0:n;if(!(r!==void 0&&!te.test(r))&&n!==void 0)return{headCommit:r,clean:t.every(i=>i.startsWith("# "))}}function nr(e){let t=e.split(`
|
|
2
|
+
`).map(a=>a.trim());if(t.length!==5)return;let[n,r,i,o,s]=t;if(!n||!r||!i||!o||!s||!te.test(o)||!te.test(s))return;let c=I(n);return{root:c,gitDir:I(ne(c,r)),commonDir:I(ne(c,i)),headCommit:o,treeOid:s}}function rr(e,t){let n=t.run(e.root,we);if(n===void 0)return;let r=ve(n);return r?.headCommit!==e.headCommit?void 0:{...It(e.root,e.gitDir),commonDir:e.commonDir,repositoryId:Ie("repository",e.commonDir),headCommit:e.headCommit,treeOid:e.treeOid,clean:r.clean}}function ir(e,t){let n=or(e,t);if(n.kind!=="worktree")return;let r=n.identity,i=r.projectRoot,o=t.run(i,["rev-parse","--git-common-dir"])?.trim();if(!o)return;let s=I(ne(i,o)),c=Fe(t.run(i,["rev-parse","--verify","HEAD"])),a=Fe(t.run(i,["rev-parse","--verify","HEAD^{tree}"])),u=t.run(i,we);if(u===void 0)return;let l=ve(u);if(!(!l||l.headCommit!==c))return{...r,commonDir:s,repositoryId:Ie("repository",s),headCommit:c,treeOid:a,clean:l.clean}}function or(e,t=E){let n=t.runResult(e,["rev-parse","--show-toplevel"]);if(n.kind==="not-repository")return{kind:"non-git"};if(n.kind==="error")return n;let r=n.output.trim();if(!r)return{kind:"error",message:"Git returned an empty worktree root."};let i=I(r),o=t.run(i,["rev-parse","--absolute-git-dir"])?.trim();if(!o)return{kind:"error",message:"Git did not return an absolute worktree directory."};let s=I(ne(i,o));return{kind:"worktree",identity:It(i,s)}}function It(e,t){return{projectRoot:e,gitDir:t,worktreeId:Ie("worktree",`${e}\0${t}`)}}function qo(e,t,n=E){return Fe(n.run(e,t))}function ne(e,t){return Qn(t)?t:re(e,t)}function I(e){try{return Yn(e)}catch{return re(e)}}function Ie(e,t){return Jn("sha256").update(`${e}\0${t}`).digest("hex").slice(0,24)}function Fe(e){return e?.trim()||void 0}function vt(e,t){let n=Un("git",["-C",e,...t],{encoding:"utf-8",env:{...process.env,LC_ALL:"C"},maxBuffer:52428800,stdio:["ignore","pipe","pipe"],timeout:3e4,killSignal:"SIGKILL"});if(n.status===0)return{kind:"success",output:n.stdout.trimEnd()};let i=(typeof n.stderr=="string"?n.stderr.trim():"")||n.error?.message||`git exited with status ${n.status??"unknown"}`,o=n.error?.code;return(/not a git repository/i.test(i)||o==="ENOENT"&&Kn(re(e)))&&!sr(e)?{kind:"not-repository"}:{kind:"error",message:i}}function sr(e){if(process.env.GIT_DIR||process.env.GIT_COMMON_DIR)return!0;let t=re(e);for(;;){try{return qn(Zn(t,".git")),!0}catch(r){let i=r.code;if(i!=="ENOENT"&&i!=="ENOTDIR")return!0}let n=Xn(t);if(n===t)return!1;t=n}}import{readdirSync as cr}from"fs";function ie(e){try{return cr(e,{withFileTypes:!0})}catch{return[]}}import{createRequire as lr}from"module";import{existsSync as pr,lstatSync as Tt,statSync as fr}from"fs";import p from"path";import{AsyncLocalStorage as ar}from"async_hooks";var ur=new ar;function R(e,t){let n=oe(e);if(!n||n.missing.has(t))return;let r=n.files.get(t);if(r)return r;let i=n.readBaseFile?.(t);return i&&n.files.set(t,i),i}function T(e,t){let n=oe(e);if(n)return n.missing.has(t)?"missing":n.paths.includes(t)?"present":"missing"}function Et(e,t){return oe(e)?.fingerprints.get(t)}function D(e){return oe(e)?.paths}function oe(e){let t=ur.getStore();if(t)return t.projectRoot===I(e)?t:void 0}var dr=lr(import.meta.url),Dt=new Set([".cache",".git",".next",".nuxt",".turbo",".nx","build","coverage","dist","node_modules","tmp","vendor"]),gr=18003;function se(e,t=[]){let n=p.resolve(e),r=t.flatMap(a=>br(n,a));if(r.length>0)return kt(n,Rt(r));let i=Sr(n),o=Rt(i),s=Pr(n,o)?[n,...o]:o,c=s.length>0?s:[n];return kt(n,c)}function Ot(e){return new Set(e.map(t=>t==="."?"tsconfig.json":`${t.replace(/\/$/u,"")}/tsconfig.json`))}function _t(e){let t=e.split("/").at(-1)?.toLowerCase();return t?.startsWith("tsconfig")===!0&&t.endsWith(".json")}var hr=/^\.scipquery-compiler-shard-\d+\.tsconfig\.json$/;function us(e){return`.scipquery-compiler-shard-${e}.tsconfig.json`}function Bt(e){return hr.test(e)}function Lt(e,t,n=[]){let r;try{r=dr("@ts-morph/common/dist/typescript.js")}catch{return null}let i=p.resolve(e),o=t==="workspace"?se(i,n):["."],s=new Set;for(let c of o){let a=c==="."?i:p.join(i,c),u=p.join(a,"tsconfig.json"),l=xr(r,i);if(!l.fileExists(u))return null;let f=r.readConfigFile(u,l.readFile);if(f.error)return null;let h=r.parseJsonConfigFileContent(f.config,l,a);if(h.errors.some(y=>y.code!==gr))return null;wr(i,h.fileNames,s)}return s}function ls(e,t,n,r){let i=p.resolve(e),o=new Set(r);for(let c of n)if(!mr(i,c,o))return!1;let s=t==="workspace"?se(i,n):["."];for(let c of s)if(!yr(i,c,o))return!1;return!0}function mr(e,t,n){let r=p.resolve(e,t);if(!P(e,r))return!0;try{let i=Tt(r);if(i.isSymbolicLink()||i.isFile()&&!n.has(O(e,r)))return!1}catch{}return!0}function yr(e,t,n){let r=t==="."?e:p.join(e,t),i=p.join(r,"tsconfig.json");if(!Mt(e,i))return!0;let o=O(e,i);if(!n.has(o))return!1;try{if(Tt(i).isSymbolicLink())return!1;let s=Gt(e,i);if(s.includes("extends")||s.includes("\\"))return!1}catch{return!1}return!0}function kt(e,t){return[...new Set(t.map(n=>O(e,n)))].sort((n,r)=>n.localeCompare(r))}function Sr(e){let t=D(e);if(t)return t.flatMap(i=>{if(i.split("/").some(s=>Dt.has(s)))return[];let o=p.join(e,...i.split("/"));return At(e,o)?[p.dirname(o)]:[]});let n=[],r=[e];for(;r.length>0;){let i=r.pop(),o=ie(i);for(let s of o){let c=p.join(i,s.name);vr(e,c,s,r,n)}}return n}function br(e,t){let n=t.trim();if(!n)return[];let r=p.resolve(e,n);if(!P(e,r))return[];let i=D(e);if(i)return Fr(e,r,i);try{let o=fr(r);if(o.isDirectory())return[r];if(o.isFile()&&Ee(p.basename(r)))return[p.dirname(r)]}catch{return[]}return[]}function At(e,t){if(!Ee(p.basename(t)))return!1;let n=Nt(e,t);return n?p.basename(t)==="tsconfig.json"||"include"in n||"files"in n||"references"in n:!1}function Ee(e){return e.startsWith("tsconfig")&&e.endsWith(".json")}function Rt(e){let t=[...new Set(e.map(n=>p.resolve(n)))].sort((n,r)=>n.localeCompare(r));return t.length<=1?t:t.filter(n=>!t.some(r=>r!==n&&Cr(n,r)))}function Pr(e,t){if(t.length===0||t.some(r=>p.resolve(r)===e))return!1;let n=p.join(e,"tsconfig.json");return Mt(e,n)&&jr(e,n)}function jr(e,t){let r=Nt(e,t)?.include;return Array.isArray(r)?r.some(i=>typeof i=="string"&&i.trim()!==""&&!i.startsWith("!")&&(i.includes("/")||i.includes("**")||!p.extname(i))):!1}function Nt(e,t){try{let n=JSON.parse(Gt(e,t));return n&&typeof n=="object"&&!Array.isArray(n)?n:null}catch{return null}}function Mt(e,t){let n=O(e,t),r=T(e,n);return r?r==="present":pr(t)}function Gt(e,t){let n=O(e,t);if(D(e)){let i=R(e,n);if(!i)throw Object.assign(new Error(`Snapshot file ${n} is missing.`),{code:"ENOENT"});return i.content.toString("utf8")}return N(t,"TypeScript project config")}function xr(e,t){let n=D(t);if(!n)return e.sys;let r=p.resolve(t),i=new Set(n),o=Wt(r,n),s=e,c=a=>{let u=p.resolve(a);return P(r,u)?O(r,u):null};return{useCaseSensitiveFileNames:e.sys.useCaseSensitiveFileNames,fileExists(a){let u=c(a);return u===null?e.sys.fileExists(a):i.has(u)},readFile(a){let u=c(a);return u===null?e.sys.readFile(a):R(r,u)?.content.toString("utf8")},readDirectory(a,u,l,f,h){let y=p.resolve(a);return P(r,y)?s.matchFiles(y,u,l,f,e.sys.useCaseSensitiveFileNames,r,h,j=>o.get(p.resolve(j))??{files:[],directories:[]},j=>j):e.sys.readDirectory(a,u,l,f,h)}}}function Wt(e,t,n=p.join){let r=new Map,i=new Map,o=s=>{r.has(s)||r.set(s,new Set),i.has(s)||i.set(s,new Set)};o(e);for(let s of t){let c=s.split("/"),a=e;for(let u=0;u<c.length-1;u+=1){let l=c[u];o(a),i.get(a).add(l),a=n(a,l),o(a)}r.get(a).add(c.at(-1))}return new Map([...r].map(([s,c])=>[s,{files:[...c].sort(),directories:[...i.get(s)??[]].sort()}]))}function ps(e,t,n){let i=new Set(t),o=Wt("/",t,p.posix.join),s=e;if(typeof s.matchFiles!="function")throw new Error("TypeScript snapshot file matching is unavailable.");let c=a=>p.posix.relative("/",p.posix.resolve("/",a));return{useCaseSensitiveFileNames:!0,fileExists:a=>i.has(c(a)),directoryExists:a=>o.has(p.posix.resolve("/",a)),getDirectories:a=>o.get(p.posix.resolve("/",a))?.directories??[],getCurrentDirectory:()=>"/",realpath:a=>p.posix.resolve("/",a),readFile:a=>{let u=c(a);return i.has(u)?n(u):void 0},readDirectory:(a,u,l,f,h)=>s.matchFiles(p.posix.resolve("/",a),u,l,f,!0,"/",h,y=>o.get(p.posix.resolve("/",y))??{files:[],directories:[]},y=>y)}}function O(e,t){let n=p.relative(e,t);return n?n.split(p.sep).join("/"):"."}function Cr(e,t){let n=p.relative(e,t);return!!n&&!n.startsWith("..")&&!p.isAbsolute(n)}function Fr(e,t,n){let r=O(e,t);if(n.includes(r)&&Ee(p.basename(t)))return[p.dirname(t)];let i=r==="."?"":`${r}/`;return n.some(o=>o.startsWith(i))?[t]:[]}function wr(e,t,n){for(let r of t){let i=p.resolve(r);P(e,i)&&n.add(p.relative(e,i).split(p.sep).join("/"))}}function vr(e,t,n,r,i){if(n.isDirectory()){!Dt.has(n.name)&&!n.name.startsWith(".")&&r.push(t);return}n.isFile()&&At(e,t)&&i.push(p.dirname(t))}import{createHash as Te}from"crypto";import{execFileSync as zt}from"child_process";import{createRequire as Ir}from"module";var Er=Ir(import.meta.url),kr=/\.(?:[cm]?[jt]sx?)$/iu,Rr=/\.[jt]sx$/iu,Ht=/(?:^|\/)package\.json$/iu,M,ke=new Map;function $t(e,t){if(!De(e))return;let n=Tr();if(n)try{let r=typeof t=="string"?t:t.toString("utf8"),i=Rr.test(e)?n.LanguageVariant.JSX:n.LanguageVariant.Standard,o=n.createScanner(n.ScriptTarget.Latest,!1,i,r),s=Te("sha256").update(`typescript-semantic-v1\0${i}\0`);return Dr(n,o,s),s.digest("hex")}catch{return}}function De(e){return kr.test(e)}function Oe(e,t){if(Ht.test(e))try{let n=JSON.parse(typeof t=="string"?t:t.toString("utf8"));if(typeof n!="object"||n===null||Array.isArray(n))return;let{scripts:r,...i}=n;return Te("sha256").update("typescript-package-json-v1\0").update(Re(i)).digest("hex")}catch{return}}function _e(e){return Ht.test(e)}function ms(e,t,n){if(!_e(t)||!/^[a-f0-9]{64}$/u.test(n))return;let r=`${e}\0${t}\0${n}`;if(ke.has(r))return ke.get(r);let i;try{let o=zt("git",["-C",e,"log","--all","--format=%H","--max-count=64","--",t],{encoding:"utf8",maxBuffer:1048576,timeout:5e3}).split(/\r?\n/u).filter(Boolean);for(let s of o){let c=zt("git",["-C",e,"show",`${s}:${t}`],{encoding:null,maxBuffer:4194304,timeout:5e3});if(Te("sha256").update(c).digest("hex")===n){i=Oe(t,c);break}}}catch{i=void 0}return ke.set(r,i),i}function Tr(){if(M!==void 0)return M;try{M=Er("typescript")}catch{M=null}return M}function Re(e){return Array.isArray(e)?`[${e.map(Re).join(",")}]`:typeof e=="object"&&e!==null?`{${Object.entries(e).sort(([t],[n])=>t.localeCompare(n)).map(([t,n])=>`${JSON.stringify(t)}:${Re(n)}`).join(",")}}`:JSON.stringify(e)}function Dr(e,t,n){let r=!1,i=!1;for(;;){let o=t.scan();if(o===e.SyntaxKind.EndOfFileToken)break;if(o===e.SyntaxKind.WhitespaceTrivia)continue;if(o===e.SyntaxKind.NewLineTrivia){r&&(i=!0);continue}i&&n.update("line-break\0");let s=t.getTokenText();n.update(`${o}\0${Buffer.byteLength(s)}\0`).update(s).update("\0"),r=!0,i=!1}}import{createHash as tn,randomUUID as Ur}from"crypto";import{chmodSync as nn,existsSync as B,linkSync as Jr,lstatSync as pe,readdirSync as Ne,realpathSync as x,unlinkSync as Kr,writeSync as qr}from"fs";import{homedir as Yr}from"os";import{basename as Xr,dirname as fe,isAbsolute as Zt,join as b,resolve as de}from"path";import{closeSync as Or,existsSync as _r,fsyncSync as Br,mkdirSync as Lr,openSync as Ar}from"fs";import{dirname as Vt}from"path";function ce(e,t,n,r){let i=0;for(;i<t.length;){let o=n.writeFile(e,t,i,t.length-i);if(!Number.isSafeInteger(o)||o<=0||o>t.length-i)throw new Error(`${r} write did not make valid forward progress`);i+=o}}function Be(e,t){if(t!=="win32")return!1;let n=e.code;return n==="EACCES"||n==="EBADF"||n==="EINVAL"||n==="EISDIR"||n==="EPERM"}var G=Object.freeze({platform:process.platform,pathExists:e=>_r(e),makeDirectory:e=>Lr(e,{recursive:!0}),openFile:(e,t,n)=>Ar(e,t,n),syncFile:e=>Br(e),closeFile:e=>Or(e)});function Ut(e,t=G){let n=[],r=e;for(;!t.pathExists(r);){n.push(r);let o=Vt(r);if(o===r)throw new Error(`Cannot establish a durable directory path without an existing ancestor: ${e}`);r=o}let i="synced";for(let o of n.reverse())t.makeDirectory(o),i=ue(i,ae(Vt(o),t));return i}function ae(e,t=G){let n;try{n=t.openFile(e,"r")}catch(r){if(Be(r,t.platform))return"unsupported";throw r}try{t.syncFile(n)}catch(r){try{t.closeFile(n)}catch{}if(Be(r,t.platform))return"unsupported";throw r}return t.closeFile(n),"synced"}function ue(...e){return e.every(t=>t==="not-requested")?"not-requested":e.includes("unsupported")?"unsupported":"synced"}import{createHash as Nr,randomUUID as Mr}from"crypto";import{readdirSync as Gr}from"fs";import{dirname as Kt,extname as Wr,join as Le,relative as qt,sep as Yt}from"path";import{fileURLToPath as zr}from"url";import{createRequire as Hr}from"module";var Jt=Hr(import.meta.url),z=Vr(),Xt=z.version,ks=z.path?Kt(z.path):null,W;function Rs(){if(W!==void 0)return W;try{if(!z.path)throw new Error("Package location unavailable");let e=Kt(z.path),n=qt(e,zr(import.meta.url)).startsWith(`src${Yt}`)?"src":"dist";W=$r(e,n)}catch{W=`unavailable:${Mr()}`}return W}function $r(e,t){let n=Nr("sha256").update("scip-query-runtime-v2\0"),r=t==="src"?new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".json"]):new Set([".js",".mjs",".cjs",".json"]),i=Qt(Le(e,t),r);if(i.length===0)throw new Error("Package runtime is empty");for(let o of[Le(e,"package.json"),...i]){let s=_(o,{maxBytes:Z,inputKind:"Package runtime input"});n.update(qt(e,o).split(Yt).join("/")).update("\0"),n.update(String(s.length)).update("\0").update(s)}return n.digest("hex").slice(0,16)}function Qt(e,t){let n=[],r=Gr(e,{withFileTypes:!0}).sort((i,o)=>i.name<o.name?-1:i.name>o.name?1:0);for(let i of r){let o=Le(e,i.name);if(i.isDirectory())n.push(...Qt(o,t));else if(i.isFile())t.has(Wr(i.name))&&n.push(o);else throw new Error(`Unsupported runtime entry: ${o}`)}return n}function Vr(){for(let e of["../package.json","../../package.json"])try{let t=Jt(e);if(t.name==="scip-query"&&typeof t.version=="string")return{version:t.version,path:Jt.resolve(e)}}catch{}return{version:"0.0.0"}}var rn=1,$=".scip-query-cache-owner.json",Qr=16*1024,on=Object.freeze({...G,randomToken:()=>Ur(),linkFile:(e,t)=>Jr(e,t),removeFile:e=>Kr(e),writeFile:(e,t,n,r)=>qr(e,t,n,r)});function le(e,t){return Object.assign(new Error(`refusing unsafe project dbPath ${JSON.stringify(e)} (${t}); use a repository-relative directory that remains inside the checkout`),{name:"UnsafeCachePathError",code:"SCIP_QUERY_UNSAFE_CACHE_PATH",configuredPath:e,reason:t})}function C(e,t){return Object.assign(new Error(`refusing unowned cache directory ${JSON.stringify(e)} (${t}); move unrelated data elsewhere or choose a new empty dbPath`),{name:"CacheOwnershipError",code:"SCIP_QUERY_CACHE_OWNERSHIP",cacheDir:e,reason:t})}function Zr(e,t){let n=x(e);return ti(n,Me(n,t))}function Me(e,t){let n=x(e),r=process.env.SCIP_QUERY_CACHE_DIR;return r?de(r):t?.dbPath?ri(n,t.dbPath):ei(n)}function sn(){let e=process.env.XDG_CACHE_HOME;return b(e||b(Yr(),".cache"),"scip-query")}function ei(e){let t=de(e);try{t=x(t)}catch{}let n=tn("sha256").update(t).digest("hex").slice(0,12);return b(sn(),"projects",n)}function Ws(e){if(!/^[a-f0-9]{24}$/.test(e))throw new Error(`invalid repository cache identity: ${e}`);let t=b(sn(),"repositories",e);return un(t),x(t)}function zs(e){return process.env.SCIP_QUERY_SHARED_CACHE!=="0"&&!process.env.SCIP_QUERY_CACHE_DIR&&!process.env.SCIP_QUERY_INDEX_DB&&!e?.dbPath}function Hs(e,t){let n=Zr(e,t);return{cacheDir:n,dbPath:b(n,"index.db"),indexPath:b(n,"index.scip"),metaPath:b(n,"meta.json")}}function ti(e,t,n=on){return ni(e,t,n).cacheDir}function ni(e,t,n=on){let r=x(e),i=B(t)?"synced":un(t,n),o=x(t),s=b(o,$);if(B(s))return Ae(r,o),Ge(s),H(o),{kind:"existing",cacheDir:o};en(o),ai(o),en(o);let a=`${JSON.stringify({schemaVersion:rn,canonicalProjectRoot:r,canonicalCacheDir:o,creatorVersion:Xt},null,2)}
|
|
3
|
+
`;try{let u=ui(s,a,n),l=ue(i,u);return{kind:"published",cacheDir:o,achievedDurability:l==="synced"?"directory-durable":"file-flushed",directorySync:l}}catch(u){if(pi(u))return Ae(r,o),{kind:"existing",cacheDir:o};throw u}}function Ae(e,t){let n=x(e),r=x(t);return oi(r,n,r)}function $s(e,t){return B(b(t,$))?(Ae(e,t),cn(t),!0):!1}function ri(e,t){let n;try{n=F(t)}catch(s){throw s instanceof g?le(t,s.reason):s}let r=de(e,...n.split("/"));if(r===e||!P(e,r))throw le(t,"outside-project");let i=ii(r),o=x(i);if(!P(e,o)&&o!==e)throw le(t,"symlink-escape");return r}function ii(e){let t=e;for(;!B(t);){let n=fe(t);if(n===t)throw le(e,"no-existing-ancestor");t=n}return t}function oi(e,t,n){let r=b(e,$);if(!B(r)||pe(r).isSymbolicLink())throw C(e,"missing regular ownership record");let i=pe(r);if(!i.isFile()||i.size>Qr)throw C(e,"invalid ownership record file");let o=N(r,"cache ownership record"),s=si(o,e);if(t!==void 0&&s.canonicalProjectRoot!==t)throw C(e,"ownership record belongs to a different project");if(s.canonicalCacheDir!==n)throw C(e,"ownership record names a different cache directory");return{record:s,ownerSha256:tn("sha256").update(o).digest("hex"),physicalCacheDir:e}}function si(e,t){try{let n=JSON.parse(e);if(n.schemaVersion!==rn||typeof n.canonicalProjectRoot!="string"||typeof n.canonicalCacheDir!="string"||typeof n.creatorVersion!="string"||!Zt(n.canonicalProjectRoot)||!Zt(n.canonicalCacheDir))throw new Error("invalid fields");return n}catch(n){throw C(t,`malformed ownership record: ${n instanceof Error?n.message:String(n)}`)}}function en(e){let t=Ne(e).filter(n=>n!==$&&!ci(n));if(t.length>0)throw C(e,`unrecognized existing entries: ${t.slice(0,3).join(", ")}`)}function ci(e){return e.startsWith(`${$}.tmp-`)||e.startsWith("git-worktree-context.json.tmp-")||[".scipquery-generations","affected-shadow-latest.json","affected-shadow.jsonl","agent-hooks","augment-vue-meta.json","cache-lifecycle.lock","evidence.db","evidence.db-shm","evidence.db-wal","health-report-cache.json","git-worktree-context.json","index.db","index.db-shm","index.db-wal","index.lock","index.scip","language-indexes","meta.json","reindex-activity.jsonl","shared-cache.json","typescript-index","typescript-scip-fragments","typescript-scip-overlays","typescript-semantic","typescript-shard-costs.json","watch-activity.json","watch-refresh-requests","watch-state.json","watch.lock"].includes(e)?!0:/^(?:reindex-|rust-|typescript-)/.test(e)}function ai(e){for(let t of Ne(e)){let n=b(e,t);try{let r=pe(n);if(r.isSymbolicLink())throw C(e,`legacy cache entry ${t} is a symlink`);if(r.isDirectory())H(n);else if(r.isFile())Ge(n);else throw C(e,`legacy cache entry ${t} is not a file or directory`)}catch(r){if(an(r))continue;throw r}}H(e)}function cn(e,t=!1){try{let n=pe(e);if(n.isSymbolicLink())throw C(e,"managed cache tree contains a symlink");if(n.isFile()){Ge(e);return}if(!n.isDirectory())throw C(e,"managed cache tree contains a special file");H(e);for(let r of Ne(e))cn(b(e,r),!0)}catch(n){if(t&&an(n))return;throw n}}function an(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}function un(e,t=G){let n=Ut(e,t);return H(e),n}function ui(e,t,n){let r=`${e}.tmp-${process.pid}-${n.randomToken()}`,i,o=!1;try{i=n.openFile(r,"wx",384),o=!0,ce(i,Buffer.from(t),n,"cache ownership record"),n.syncFile(i),n.closeFile(i),i=void 0,n.linkFile(r,e);let s=ae(fe(e),n);return n.removeFile(r),o=!1,ue(s,ae(fe(e),n))}finally{if(i!==void 0)try{n.closeFile(i)}catch{}if(o)try{n.removeFile(r)}catch{}}}function H(e){process.platform!=="win32"&&nn(e,448)}function Ge(e){process.platform!=="win32"&&nn(e,384)}function li(e){if(B(e))return x(e);let t=x(fe(e));return b(t,Xr(e))}function Vs(e){return li(de(e))}function pi(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="EEXIST"}import{closeSync as ln,existsSync as ze,openSync as fi,realpathSync as di,renameSync as gi,unlinkSync as pn,writeSync as hi}from"fs";import{dirname as mi,join as yi,resolve as Si}from"path";import{AsyncLocalStorage as bi}from"async_hooks";var Pi="fingerprint-stat-cache.json",fn=1,ji=8*1024*1024,We=new Map,dn=new bi;function Zs(e,t,n){return dn.run({projectRoot:Ue(e),cacheDir:Si(t)},n)}function gn(e){let t=dn.getStore();return t?.projectRoot===e?t.cacheDir:null}function xi(e){let t=Ue(e);return We.get(t)?.get(gn(t))}function He(e,t,n,r){let i=hn(e),o=i.files.get(t);if(!(!o||!mn(o,n,r)))return i.hits+=1,{hash:o.hash,size:o.fingerprintSize,...o.semanticHash===void 0?{}:{semanticHash:o.semanticHash}}}function $e(e,t,n,r,i){if(i.hash==="unreadable"||i.size<0||!Number.isFinite(i.size))return;let o=hn(e),s={kind:n,dev:r.dev,ino:r.ino,mtimeMs:r.mtimeMs,ctimeMs:r.ctimeMs,size:r.size,hash:i.hash,fingerprintSize:i.size,...i.semanticHash===void 0?{}:{semanticHash:i.semanticHash}},c=o.files.get(t);c&&ki(c,s)||(o.files.set(t,s),o.stores+=1,o.dirty=!0)}function Ve(e){let t=xi(e);if(!(!t?.dirty||!t.cachePath))try{let n=mi(t.cachePath);if(!ze(n))return;Ri(t.cachePath,wi(t)),t.dirty=!1}catch{}}function hn(e){let t=Ue(e),n=gn(t),r=We.get(t)??new Map,i=r.get(n);if(i)return i;let o=Ci(t,n),s=Fi(o),c={cachePath:o,files:s,dirty:!1,hits:0,stores:0};return r.set(n,c),We.set(t,r),c}function Ci(e,t){try{let n=t??Me(e);return ze(n)?yi(n,Pi):null}catch{return null}}function Fi(e){let t=new Map;if(!e||!ze(e))return t;try{let n=JSON.parse(_(e,{inputKind:"fingerprint stat cache",maxBytes:ji}).toString("utf8"));if(!vi(n))return t;for(let[r,i]of Object.entries(n.files))i&&t.set(r,i)}catch{return t}return t}function wi(e){return{version:fn,files:Object.fromEntries(e.files)}}function vi(e){if(typeof e!="object"||e===null)return!1;let t=e;return t.version!==fn||typeof t.files!="object"||t.files===null?!1:Object.values(t.files).every(Ii)}function Ii(e){if(typeof e!="object"||e===null)return!1;let t=e;return(t.kind==="file"||t.kind==="symlink")&&Ei(t)&&typeof t.hash=="string"&&t.hash!=="unreadable"&&(t.semanticHash===void 0||typeof t.semanticHash=="string")}function Ei(e){return Number.isFinite(e.dev)&&Number.isFinite(e.ino)&&Number.isFinite(e.mtimeMs)&&Number.isFinite(e.ctimeMs)&&Number.isFinite(e.size)&&Number.isFinite(e.fingerprintSize)}function mn(e,t,n){return e.kind===t&&e.dev===n.dev&&e.ino===n.ino&&e.mtimeMs===n.mtimeMs&&e.ctimeMs===n.ctimeMs&&e.size===n.size}function ki(e,t){return mn(e,t.kind,t)&&e.hash===t.hash&&e.fingerprintSize===t.fingerprintSize&&e.semanticHash===t.semanticHash}function Ri(e,t){let n=`${e}.${process.pid}.tmp`;try{pn(n)}catch{}let r=Buffer.from(`${JSON.stringify(t)}
|
|
4
|
+
`,"utf8"),i=fi(n,"wx",384);try{ce(i,r,{writeFile:(o,s,c,a)=>hi(o,s,c,a)},"fingerprint stat cache")}catch(o){throw ln(i),pn(n),o}ln(i),gi(n,e)}function Ue(e){return di(e)}import{execFileSync as Ti}from"child_process";import{isUtf8 as yn}from"buffer";import{createHash as Ke}from"crypto";import{closeSync as Sn,fstatSync as V,lstatSync as qe,openSync as bn,readSync as Pn,readlinkSync as Di,realpathSync as U}from"fs";import{isAbsolute as Oi,join as Ye,relative as _i,resolve as Bi,sep as Li}from"path";var K=64*1024*1024,Ai=1024*1024,Ni=1024,L=class extends Error{constructor(n,r,i,o){super(`${n} ${JSON.stringify(r)} is ${i} bytes; the safety limit is ${o} bytes`);this.inputKind=n;this.inputPath=r;this.observedBytes=i;this.limitBytes=o;this.name="InputTooLargeError"}inputKind;inputPath;observedBytes;limitBytes;code="SCIP_QUERY_INPUT_TOO_LARGE"};function Mi(e){return[...new Set((e??[]).map(t=>t.trim()).filter(Boolean))].sort((t,n)=>t.localeCompare(n))}function Xe(e,t,n={}){let r=F(t),i=Pt(e,()=>U(e)),o=Bi(i,...r.split("/"));if(!P(i,o)||o===i)throw new g(t,"outside-project");let s=U(o);if(!P(i,s)||s===i)throw new g(t,"outside-project");let c=qe(s);if(!c.isFile())throw new g(t,"not-a-file");let a={projectRoot:i,relativePath:r,absolutePath:s,size:c.size,mtimeMs:c.mtimeMs,device:c.dev,inode:c.ino},u=n.maxBytes??K;if(w(u),a.size>u)throw new L(n.inputKind??"project file",a.relativePath,a.size,u);return a}function Gi(e,t,n={}){let r=F(t),i=T(e,r);if(i)return po(e,r,i,n);let o=Xe(e,t,n),s=n.maxBytes??K,c=bn(o.absolutePath,"r");try{let a=V(c);if(J(a,o,t),a.size>s)throw new L(n.inputKind??"project file",o.relativePath,a.size,s);let u=je(c,a.size),l=V(c);if(J(l,o,t),u.byteLength!==a.size||l.mtimeMs!==a.mtimeMs)throw new g(t,"changed-during-read");return u}finally{Sn(c)}}function mc(e,t,n,r={}){if(n.byteLength===0)throw new Error("Project file probe literal must not be empty.");let{matchedLiteralIndexes:i,...o}=Wi(e,t,[n],r);return{...o,includesLiteral:i.length>0}}function Wi(e,t,n,r={}){if(n.length===0||n.some(a=>a.byteLength===0))throw new Error("Project file probe literals must not be empty.");let i=F(t),o=T(e,i);if(o){if(o==="missing")throw Object.assign(new Error(`Snapshot project file ${JSON.stringify(i)} does not exist.`),{code:"ENOENT"});return zi(e,i,n,r)}let s=Xe(e,t,r),c=bn(s.absolutePath,"r");try{let a=V(c);J(a,s,t);let{hash:u,containsNul:l,validUtf8:f,includesLiterals:h}=Hi(c,a.size,t,n,r);J(V(c),s,t);let y=!l&&f,j=y?h.flatMap((S,d)=>S?[d]:[]):[],m=null;return j.length>0&&(m=$i(c,s,t)),{byteLength:a.size,isUtf8Text:y,matchedLiteralIndexes:j,bytes:m,...u?{sha256:u.digest("hex")}:{}}}finally{Sn(c)}}function zi(e,t,n,r){let i=R(e,t);if(!i)throw new g(t,"changed-during-read");let o=r.maxBytes??K;if(w(o),i.size>o)throw new L(r.inputKind??"project file",t,i.size,o);let s=!i.content.includes(0)&&yn(i.content),c=n.map(jn),a=s?Ui(i.content,n,c):[];return{byteLength:i.size,isUtf8Text:s,matchedLiteralIndexes:a,bytes:a.length>0?Buffer.from(i.content):null,...r.computeSha256?{sha256:i.sha256}:{}}}function Hi(e,t,n,r,i){let o=i.computeSha256?Ke("sha256"):null,s=i.scratchBuffer??Buffer.allocUnsafe(Ai);if(s.byteLength===0)throw new Error("Project file probe scratch buffer must not be empty.");let c=0,a=r.map(()=>!1),u=!1,l=!0,f=Buffer.alloc(0),h=r.map(()=>Buffer.alloc(0)),y=r.map(jn),j=S=>{if(l){let d=f.byteLength>0?Buffer.concat([f,S]):S,A=Vi(d);l=yn(d.subarray(0,A)),f=Buffer.from(d.subarray(A))}},m=S=>{for(let d=0;d<r.length;d+=1){if(a[d])continue;let A=r[d],tt=h[d];a[d]=Ji(S,A,tt,y[d]),h[d]=Ki(S,A,tt)}};for(;c<t;){let S=Pn(e,s,0,Math.min(s.byteLength,t-c),c);if(S<=0)throw new g(n,"changed-during-read");let d=s.subarray(0,S);o?.update(d),u||=d.includes(0),j(d),m(d),c+=S}return l&&=f.byteLength===0,{hash:o,containsNul:u,validUtf8:l,includesLiterals:a}}function $i(e,t,n){let r=Buffer.allocUnsafe(t.size),i=0;for(;i<r.byteLength;){let o=Pn(e,r,i,r.byteLength-i,i);if(o<=0)throw new g(n,"changed-during-read");i+=o}return J(V(e),t,n),r}function yc(e,t,n={}){return Gi(e,t,n).toString("utf8")}function J(e,t,n){if(!e.isFile()||e.dev!==t.device||e.ino!==t.inode||e.size!==t.size)throw new g(n,"changed-during-read")}function Vi(e){if(e.byteLength===0)return 0;let t=e.byteLength-1,n=0;for(;t>=0&&n<3&&(e[t]&192)===128;)n+=1,t-=1;if(t<0)return e.byteLength;let r=e[t];return fo(r)>e.byteLength-t?t:e.byteLength}function Ui(e,t,n){return t.flatMap((r,i)=>Je(e,r,n[i])?[i]:[])}function Ji(e,t,n,r){if(Je(e,t,r))return!0;if(n.byteLength===0||t.byteLength===1)return!1;let i=e.subarray(0,Math.min(e.byteLength,t.byteLength-1));return Je(Buffer.concat([n,i]),t,r)}function Je(e,t,n){if(n<0)return e.includes(t);let r=t[n],i=e.indexOf(r),o=0;for(;i>=0;){if(o+=1,o>Ni)return e.includes(t);let s=i-n;if(s>=0&&s+t.byteLength<=e.byteLength&&e.compare(t,0,t.byteLength,s,s+t.byteLength)===0)return!0;i=e.indexOf(r,i+1)}return!1}function jn(e){for(let n=1;n<e.byteLength;n+=1){let r=e[n];if(r>=65&&r<=90)return n}let t=e[0];return t>=65&&t<=90?0:-1}function Ki(e,t,n){let r=t.byteLength-1;if(r===0)return Buffer.alloc(0);if(e.byteLength>=r)return Buffer.from(e.subarray(e.byteLength-r));let i=Buffer.concat([n,e]);return Buffer.from(i.subarray(Math.max(0,i.byteLength-r)))}function Qe(e){return typeof e=="object"&&e!==null&&"code"in e&&(e.code==="ENOENT"||e.code==="ENOTDIR")}function Sc(e,t){try{return Xe(e,t),!0}catch(n){if(Qe(n))return!1;throw n}}function qi(e){let t=D(e);return t?t.filter(n=>n&&!he(n)).sort():(ao(e)??uo(e)).filter(n=>n&&!he(n)).sort()}function Yi(e,t={}){let n=(t.includePaths??[]).map(F),r=[...new Set([...qi(e),...n])].filter(s=>!he(s)).filter(s=>!t.language||at(s,t.language,t.markerFiles)).filter(s=>!t.includePath||t.includePath(s)).sort((s,c)=>s.localeCompare(c)),i=U(e),o=r.flatMap(s=>xn(e,i,s));return Ve(i),o}function xn(e,t,n){let r=Xi(e,n);if(r)return r;let i=Ye(e,n);try{let o=qe(i);return o.isSymbolicLink()?Qi(t,n,i,o):Zi(t,n,i,o)}catch(o){return Qe(o)?[]:[{path:n,size:-1,hash:"unreadable"}]}}function Xi(e,t){let n=Et(e,t);if(n)return[{path:t,size:n.fingerprintSize??n.size,hash:n.sha256}];if(T(e,t)==="present"){let r=R(e,t);if(r)return[{path:t,size:r.fingerprintSize??r.size,hash:r.sha256}]}return null}function Qi(e,t,n,r){let i=He(e,t,"symlink",ge(r));if(i)return[{path:t,size:i.size,hash:i.hash}];let o=U(n),s=_i(e,o);if(s===".."||s.startsWith(`..${Li}`)||Oi(s))throw new Error("external symlink");let c=Di(n),a=Ke("sha256").update("symlink\0").update(c).digest("hex"),u=Buffer.byteLength(c);return $e(e,t,"symlink",ge(r),{hash:a,size:u}),[{path:t,size:u,hash:a}]}function Zi(e,t,n,r){let i=De(t)||_e(t),o=He(e,t,"file",ge(r));if(o&&(!i||o.semanticHash!==void 0))return[{path:t,size:o.size,hash:o.hash,...o.semanticHash===void 0?{}:{semanticHash:o.semanticHash}}];let s=eo(n,t,i);return $e(e,t,"file",ge(r),s),[{path:t,...s}]}function eo(e,t,n){let r=Ke("sha256"),i=n,o=[],s=ee(e,{inputKind:"project fingerprint input",maxBytes:K},l=>{r.update(l),i&&o.push(Buffer.from(l))}),c=r.digest("hex"),a=i?Buffer.concat(o,s):void 0,u=a?$t(t,a)??Oe(t,a):void 0;return{size:s,hash:c,...u===void 0?{}:{semanticHash:u}}}function ge(e){return{dev:e.dev,ino:e.ino,mtimeMs:e.mtimeMs,ctimeMs:e.ctimeMs,size:e.size}}function Cn(e,t,n){let r=Ze(t,n),i=[...r.typescriptProjects.filter(a=>so(e,a)),...r.clojureConfigPath?[r.clojureConfigPath]:[]],o=r.languages.includes("typescript")?Lt(e,r.typescriptProjectMode,r.typescriptProjects):null,s=r.languages.includes("typescript")?r.typescriptProjectMode==="workspace"?se(e,r.typescriptProjects):["."]:[],c=Ot(s);return{...r,files:Yi(e,{includePath:a=>{if(a===".scipquery.json")return!1;let u=X(a,t,i);return u==="other"||u==="config"&&_t(a)&&!c.has(a)?!1:u!=="source"||!oo(a)||!o?!0:o.has(a)},includePaths:i})}}function bc(e,t){let n=new Set(t.files.map(o=>o.path)),r=Cn(e,t.languages,t),i=new Map(r.files.map(o=>[o.path,o]));return{...Ze(t.languages,t),files:[...t.files.flatMap(o=>{let s=i.get(o.path);return s?[s]:[]}),...r.files.filter(o=>!n.has(o.path))]}}function Pc(e,t,n,r,i,o){let s=m=>({mode:"full",fingerprint:Cn(e,t,n),reason:m}),c=to(r,i,o);if(!c.ready)return s(c.reason);let{previous:a,journal:u}=c,l=Ze(t,n);if(!io(a,l))return s("project-input-configuration-changed");if(new Set(a.files.map(m=>m.path)).size!==a.files.length)return s("prior-project-input-snapshot-has-duplicate-paths");if(u.entries.length===0)return{mode:"delta",fingerprint:{...l,files:[...a.files].sort((m,S)=>m.path.localeCompare(S.path))},changedPaths:[]};let f=new Map(a.files.map(m=>[m.path,m])),h=no(t,l,f,u);if(h)return s(h);let y=U(e),j=ro(e,y,f,u);return j?s(j):(Ve(y),{mode:"delta",fingerprint:{...l,files:[...f.values()].sort((m,S)=>m.path.localeCompare(S.path))},changedPaths:u.entries.map(m=>m.path).sort()})}function to(e,t,n){return t?t.complete?n?t.baseGeneration!==n?{ready:!1,reason:"change-journal-base-mismatch"}:e?{ready:!0,previous:e,journal:t}:{ready:!1,reason:"prior-project-input-snapshot-unavailable"}:{ready:!1,reason:"accepted-generation-unavailable"}:{ready:!1,reason:`change-journal-incomplete:${t.incompleteReason??"unknown"}`}:{ready:!1,reason:"change-journal-unavailable"}}function no(e,t,n,r){let i=[...t.typescriptProjects,...t.clojureConfigPath?[t.clojureConfigPath]:[]];for(let o of r.entries){let s=go(o,n,e,i);if(s!==null)return s}return null}function ro(e,t,n,r){for(let i of r.entries){let o=xn(e,t,i.path);if(i.kind==="delete"){if(o.length!==0)return"deleted-source-is-still-readable";n.delete(i.path);continue}if(o.length!==1||o[0].hash==="unreadable"||o[0].size<0)return i.kind==="add"?"added-source-is-not-readable":"changed-source-no-longer-readable";n.set(i.path,o[0])}return null}function io(e,t){return e.version===t.version&&e.typescriptSymbolIdentityVersion===t.typescriptSymbolIdentityVersion&&JSON.stringify([...e.languages].sort())===JSON.stringify(t.languages)&&e.pnpmWorkspaces===t.pnpmWorkspaces&&e.typescriptProjectMode===t.typescriptProjectMode&&JSON.stringify([...e.typescriptProjects].sort())===JSON.stringify(t.typescriptProjects)&&e.clojureConfigPath===t.clojureConfigPath}function oo(e){return/\.(?:[cm]?[jt]sx?|vue)$/iu.test(e)}function so(e,t){let n;try{n=F(t)}catch{return!1}let r=T(e,n);if(r)return r==="present";try{return qe(Ye(e,n)).isFile()}catch(i){if(Qe(i))return!1;throw i}}function Ze(e,t){return{version:3,...e.includes("typescript")?{typescriptSymbolIdentityVersion:6}:{},languages:[...e].sort(),pnpmWorkspaces:t.typescriptProjectMode!=="workspace"&&t.pnpmWorkspaces===!0,typescriptProjectMode:t.typescriptProjectMode??"single",typescriptProjects:Mi(t.typescriptProjects),clojureConfigPath:co(t.clojureConfigPath)}}function co(e){return e?.trim()||void 0}function ao(e){try{let t=xt(e,52428800,()=>Ti("git",["-C",e,"ls-files","-co","-v","-z","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:104857600,stdio:["ignore","pipe","ignore"],timeout:3e4,killSignal:"SIGKILL"}));return[...Ft(t)]}catch{return null}}function uo(e){let t=[],n=[""];for(;n.length>0;){let r=n.pop(),i=r?Ye(e,r):e,o=ie(i);for(let s of o){let c=r?`${r}/${s.name}`:s.name;if(s.isDirectory()){he(c)||n.push(c);continue}t.push(c)}}return t}function he(e){let t=e.split("/");return e==="meta.json"||Bt(e)||t[0]===".scipquery"&&mo.has(t[1])||t.some(n=>lo.has(n))||e.endsWith(".db")||e.endsWith(".db-wal")||e.endsWith(".db-shm")||e.endsWith(".scip")}var lo=new Set([".git","node_modules",".scipquery-cache",".scipquery-generations",".stryker-tmp","dist","build","coverage",".next",".nuxt","target"]);function po(e,t,n,r){if(n==="missing")throw Object.assign(new Error(`Snapshot project file ${JSON.stringify(t)} does not exist.`),{code:"ENOENT"});let i=R(e,t);if(!i)throw new g(t,"changed-during-read");let o=r.maxBytes??K;if(w(o),i.size>o)throw new L(r.inputKind??"project file",t,i.size,o);return Buffer.from(i.content)}function fo(e){return(e&128)===0?1:(e&224)===192?2:(e&240)===224?3:(e&248)===240?4:0}function go(e,t,n,r){let i=t.get(e.path);return X(e.path,n,r)!=="source"?"non-source-project-input-changed":ho(e,i)}function ho(e,t){return e.kind==="add"&&t?"added-path-already-in-prior-project-input-snapshot":e.kind==="delete"&&!t?"deleted-path-not-in-prior-project-input-snapshot":e.kind==="change"&&!t?"changed-path-not-in-prior-project-input-snapshot":t&&(t.hash==="unreadable"||t.size<0)?"changed-path-was-unreadable":null}var mo=new Set(["events","ledger","releases","suppressions"]);var Fn=[];function q(e){e.groups.length>0&&Fn.push(e)}function xc(e,t){let n=new Set(t.groups);for(let r of Fn)r.groups.some(i=>n.has(i))&&(t.file!==void 0&&r.clearFile?r.clearFile(e,t.file):r.clearAll(e))}var wn=256;function et(e){let t=e.maxEntries;if(t!==void 0){if(!Number.isSafeInteger(t)||t<1)throw new Error(`Per-database cache maxEntries must be a positive safe integer; received ${t}.`);return t}return e.clearGroups.includes("source-file")?wn:void 0}function vn(e,t,n){e.delete(t),e.set(t,n)}function In(e,t){if(t!==void 0)for(;e.size>t;){let n=e.keys().next().value;if(n===void 0)return;e.delete(n)}}function En(){let e=new WeakMap;return{cache:e,ensure(t){let n=e.get(t);return n||(n=new Map,e.set(t,n)),n}}}function yo(e,t){let{cache:n,ensure:r}=En(),i=et(t),o={get(s,c,a){let u=r(s);if(u.has(c)){let f=u.get(c);return vn(u,c,f),f}let l=a();return u.set(c,l),In(u,i),l},has(s,c){return n.get(s)?.has(c)??!1},invalidate(s,c){n.get(s)?.delete(c)},invalidateAll(s){n.delete(s)},size(s){return n.get(s)?.size??0}};return q({name:e,groups:t.clearGroups,clearAll:s=>o.invalidateAll(s)}),o}function wc(e,t){let n=yo(e,{clearGroups:[],maxEntries:et(t)}),r=o=>o.replace(/\\/g,"/"),i={get:(o,s,c)=>n.get(o,r(s),c),has:(o,s)=>n.has(o,r(s)),invalidate:(o,s)=>n.invalidate(o,r(s)),invalidateAll:n.invalidateAll,size:n.size};return q({name:e,groups:t.clearGroups,clearAll:i.invalidateAll,clearFile:i.invalidate}),i}function vc(e,t){let n=new WeakMap,r={get(i,o){let s=n.get(i);if(s)return s.value;let c=o();return n.set(i,{value:c}),c},invalidate(i){n.delete(i)},has(i){return n.has(i)}};return q({name:e,groups:t.clearGroups,clearAll:i=>r.invalidate(i)}),r}var So={clearGroups:["whole-project","source-file"],maxEntries:wn};function Ic(e){return bo(e,So)}function bo(e,t){let{cache:n,ensure:r}=En(),i=et(t),o={get(s,c,a,u){c=c.replace(/\\/g,"/");let l=r(s),f=l.get(c);if(f&&f.source===a)return vn(l,c,f),f.value;let h=u();return l.set(c,{source:a,value:h}),In(l,i),h},invalidate(s,c){n.get(s)?.delete(c.replace(/\\/g,"/"))},invalidateAll(s){n.delete(s)}};return q({name:e,groups:t.clearGroups,clearAll:s=>o.invalidateAll(s),clearFile:(s,c)=>o.invalidate(s,c)}),o}export{g as a,me as b,jo as c,xo as d,P as e,F as f,X as g,at as h,Fo as i,rt as j,wo as k,vo as l,Dn as m,Bn as n,Z as o,Mn as p,Gn as q,Wn as r,k as s,_ as t,gt as u,N as v,zn as w,Hn as x,ee as y,$n as z,ce as A,Be as B,G as C,Ut as D,ae as E,ue as F,Bo as G,xt as H,Ft as I,E as J,Vo as K,Uo as L,Jo as M,Ko as N,qo as O,ne as P,I as Q,se as R,Ot as S,_t as T,us as U,Bt as V,Lt as W,ls as X,ps as Y,ms as Z,Xt as _,ks as $,Rs as aa,Me as ba,sn as ca,ei as da,Ws as ea,zs as fa,Hs as ga,$s as ha,Vs as ia,Zs as ja,L as ka,Mi as la,Xe as ma,Gi as na,mc as oa,Wi as pa,yc as qa,Qe as ra,Sc as sa,qi as ta,Yi as ua,Cn as va,bc as wa,Pc as xa,Ze as ya,q as za,xc as Aa,yo as Ba,wc as Ca,vc as Da,Ic as Ea,bo as Fa};
|
|
5
|
+
//# sourceMappingURL=chunk-5TNQJUR2.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{closeSync as l,fstatSync as u,openSync as m,readSync as h}from"fs";import{createHash as L}from"crypto";var B=8*1024*1024,A=64*1024*1024,R=512*1024*1024,_=256*1024*1024,s=class extends Error{constructor(i,r,n,a,d){let o=n==="too-large"?`is ${a} bytes; the safety limit is ${d} bytes`:n==="not-regular"?"is not a regular file":"changed while it was being read";super(`${i} ${JSON.stringify(r)} ${o}`);this.inputKind=i;this.inputPath=r;this.reason=n;this.observedBytes=a;this.limitBytes=d;this.name="BoundedFileReadError"}inputKind;inputPath;reason;observedBytes;limitBytes;code="SCIP_QUERY_BOUNDED_FILE_READ"};function g(t,e){f(e.maxBytes);let i=String(t),r=m(t,"r");try{let n=u(r);T(n,e,i);let a=b(r,n.size);return F(n,u(r),a.byteLength,e,i),a}finally{l(r)}}function b(t,e){f(e);let i=Buffer.allocUnsafe(e),r=0;for(;r<i.length;){let n=h(t,i,r,i.length-r,r);if(n===0)break;r+=n}return i.subarray(0,r)}function y(t,e,i="utf8"){return g(t,e).toString(i)}function E(t,e){return y(t,{maxBytes:B,inputKind:e})}function x(t,e){f(e.maxBytes);let i=[],r=Buffer.allocUnsafe(64*1024),n=0;for(;;){let a=h(t,r,0,r.length,null);if(a===0)break;if(n+=a,!Number.isSafeInteger(n)||n>e.maxBytes)throw new s(e.inputKind,`file descriptor ${t}`,"too-large",n,e.maxBytes);i.push(Buffer.from(r.subarray(0,a)))}return Buffer.concat(i,n)}function p(t,e){let i=m(t,"r");try{return x(i,e)}finally{l(i)}}function P(t,e,i="utf8"){return p(t,e).toString(i)}function S(t,e,i){f(e.maxBytes);let r=String(t),n=m(t,"r");try{let a=u(n);T(a,e,r);let d=Buffer.allocUnsafe(Math.min(1024*1024,Math.max(1,a.size))),o=0;for(;o<a.size;){let c=h(n,d,0,Math.min(d.length,a.size-o),o);if(c===0)break;i(d.subarray(0,c)),o+=c}return F(a,u(n),o,e,r),o}finally{l(n)}}function O(t,e){let i=L("sha256");return S(t,e,r=>i.update(r)),i.digest("hex")}function F(t,e,i,r,n){if(e.dev!==t.dev||e.ino!==t.ino||e.size!==t.size||e.mtimeMs!==t.mtimeMs||i!==t.size)throw new s(r.inputKind,n,"changed-during-read",e.size,r.maxBytes)}function T(t,e,i){if(!t.isFile())throw new s(e.inputKind,i,"not-regular",Number(t.size),e.maxBytes);if(t.size>e.maxBytes)throw new s(e.inputKind,i,"too-large",Number(t.size),e.maxBytes)}function f(t){if(!Number.isSafeInteger(t)||t<0)throw new RangeError(`maxBytes must be a non-negative safe integer; received ${t}`)}export{B as a,A as b,R as c,_ as d,s as e,g as f,b as g,y as h,E as i,P as j,S as k,O as l,f as m};
|
|
2
|
+
//# sourceMappingURL=chunk-62BDNPMI.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{a as R,b as v}from"./chunk-ZLADLUE6.js";import{a as b,b as L}from"./chunk-6FFVZZL4.js";import{d}from"./chunk-QZ7KQZRN.js";import{spawn as q}from"child_process";import{platform as P}from"os";var a=class extends Error{},h=class extends Error{},m=class extends Error{constructor(t,r,s){super(`rust-analyzer LSP request ${r} failed: ${s}`);this.code=t}code},k=3e4,M=16*1024,O=64*1024*1024,z=64*1024,A=256*1024*1024,p=Buffer.from(`\r
|
|
2
|
+
\r
|
|
3
|
+
`,"ascii"),x=class{constructor(e,t={}){this.transport=e;this.requestTimeoutMs=t.requestTimeoutMs??k,this.configuration=t.configuration??{};let r=C(t.maxHeaderBytes,t.maxMessageBytes);this.maxHeaderBytes=r.maxHeaderBytes,this.maxMessageBytes=r.maxMessageBytes,this.monotonicNow=t.monotonicNow??d,this.headerBuffer=Buffer.allocUnsafe(this.maxHeaderBytes+p.length),this.transport.onData(s=>this.handleData(s)),this.transport.onClose((s,i)=>this.failTransport(new Error($(s,i)),!1)),this.transport.onError(s=>this.failTransport(s,!0))}transport;nextId=1;pending=new Map;diagnosedUris=new Set;diagnosticWaiters=new Map;readinessWaiters=new Set;requestTimeoutMs;configuration;maxHeaderBytes;maxMessageBytes;monotonicNow;headerBuffer;headerLength=0;bodyBuffer=null;bodyLength=0;transportFailure=null;transportKilled=!1;transportKillPromise=null;currentServerStatusGeneration=0;latestServerStatus=null;shutdownStarted=!1;async initialize(e,t={}){let r=e.capabilities??{},s=r.experimental&&typeof r.experimental=="object"&&!Array.isArray(r.experimental)?r.experimental:{},i=await this.request("initialize",{...e,capabilities:{...r,experimental:{...s,serverStatusNotification:!0}}},t);return this.notify("initialized",{}),i}async references(e,t={}){let r=await this.request("textDocument/references",e,t);return Array.isArray(r)?r:[]}async definition(e,t={}){let r=await this.request("textDocument/definition",e,t);return W(r)}async prepareCallHierarchy(e,t={}){let r=await this.request("textDocument/prepareCallHierarchy",e,t);return Array.isArray(r)?r:[]}async outgoingCalls(e,t={}){let r=await this.request("callHierarchy/outgoingCalls",{item:e},t);return Array.isArray(r)?r:[]}async hover(e,t={}){let r=await this.request("textDocument/hover",e,t);return r&&typeof r=="object"?r:null}async readinessBarrier(e={}){try{await this.request("scip-query/readinessBarrier",null,e)}catch(t){if(t instanceof m&&t.code===-32601)return;throw t}}serverStatusGeneration(){return this.currentServerStatusGeneration}serverStatusSnapshot(){let e=this.latestServerStatus;return e?{generation:e.generation,status:{...e.status}}:null}waitForQuiescence(e,t){if(this.transportFailure)return Promise.reject(this.transportFailure);let r=this.latestServerStatus;if(r&&r.generation>e){if(r.status.health==="error")return Promise.reject(E());if(r.status.quiescent)return Promise.resolve(r.status)}return new Promise((s,i)=>{let o={afterGeneration:e,resolve:s,reject:i,timeout:setTimeout(()=>{this.readinessWaiters.delete(o),i(new Error(`rust-analyzer readiness timed out after ${t}ms`))},t)};this.readinessWaiters.add(o)})}didOpenTextDocument(e){this.notify("textDocument/didOpen",{textDocument:e})}waitForDiagnostics(e,t){return this.transportFailure?Promise.resolve(!1):this.diagnosedUris.has(e)?Promise.resolve(!0):new Promise(r=>{let s=l=>{clearTimeout(i),r(l)},i=setTimeout(()=>{let l=this.diagnosticWaiters.get(e)?.filter(u=>u!==s);l&&l.length>0?this.diagnosticWaiters.set(e,l):this.diagnosticWaiters.delete(e),r(!1)},t),o=this.diagnosticWaiters.get(e)??[];o.push(s),this.diagnosticWaiters.set(e,o)})}async shutdown(e={}){if(!this.shutdownStarted){this.shutdownStarted=!0;try{await this.request("shutdown",null,e),this.notify("exit",null)}catch(t){throw this.notify("exit",null),this.killTransportOnce(),t}}}async shutdownAndReap(e={}){let t;try{await this.shutdown(e)}catch(r){t=r}try{await this.killTransportOnce()}catch(r){throw new Error(`rust-analyzer process-tree cleanup failed: ${r instanceof Error?r.message:String(r)}`,{cause:r})}if(t)throw t}request(e,t,r={}){if(this.transportFailure)return Promise.reject(this.transportFailure);let s=y(r.timeoutMs??this.requestTimeoutMs,r.deadlineMs,this.monotonicNow),i=this.nextId++,o={jsonrpc:"2.0",id:i,method:e,params:t};return new Promise((l,u)=>{let c=setTimeout(()=>{let w=s.deadlineLimited?new a(`rust-analyzer readiness deadline expired during LSP request ${e}`):new Error(`rust-analyzer LSP request ${e} timed out after ${s.timeoutMs}ms`);this.cancelAndFailTimedOutRequest(i,w)},s.timeoutMs);this.pending.set(i,{method:e,deadlineMs:r.deadlineMs,resolve:w=>l(w),reject:u,timeout:c}),this.transport.write(f(o))})}notify(e,t){this.transportFailure||this.transport.write(f({jsonrpc:"2.0",method:e,params:t}))}handleData(e){if(this.transportFailure||e.length===0)return;let t=0;for(;t<e.length&&!this.transportFailure;){if(this.bodyBuffer){t=this.consumeBodyChunk(e,t);continue}let r=this.consumeHeaderByte(e,t);if(r===null)return;t=r}}consumeBodyChunk(e,t){let r=this.bodyBuffer,s=Math.min(e.length-t,r.length-this.bodyLength);return e.copy(r,this.bodyLength,t,t+s),this.bodyLength+=s,this.bodyLength===r.length&&this.dispatchCompletedBody(),t+s}dispatchCompletedBody(){let e=this.bodyBuffer.toString("utf8");this.bodyBuffer=null,this.bodyLength=0;let t;try{t=H(e)}catch{this.failProtocol("rust-analyzer LSP response body was not a valid JSON object");return}try{this.dispatchMessage(t)}catch{this.failTransport(new Error("rust-analyzer LSP message handling failed"),!0)}}consumeHeaderByte(e,t){if(this.headerLength===this.headerBuffer.length)return this.failProtocol(`rust-analyzer LSP header exceeded ${this.maxHeaderBytes} byte limit`),null;if(this.headerBuffer[this.headerLength++]=e[t++],!this.headerDelimiterComplete())return t;let r=this.headerLength-p.length;if(r>this.maxHeaderBytes)return this.failProtocol(`rust-analyzer LSP header exceeded ${this.maxHeaderBytes} byte limit`),null;let s=this.headerBuffer.subarray(0,r).toString("ascii");this.headerLength=0;let i;try{i=D(s,this.maxMessageBytes)}catch(o){return this.failProtocol(o instanceof Error?o.message:String(o)),null}return this.bodyBuffer=Buffer.allocUnsafe(i),this.bodyLength=0,i===0&&(this.bodyBuffer=null,this.failProtocol("rust-analyzer LSP response body was not a valid JSON object")),t}headerDelimiterComplete(){if(this.headerLength<p.length)return!1;let e=this.headerLength-p.length;return this.headerBuffer.subarray(e,this.headerLength).equals(p)}failProtocol(e){this.failTransport(new h(e),!0)}failTransport(e,t){this.transportFailure||(this.transportFailure=e,this.headerLength=0,this.bodyBuffer=null,this.bodyLength=0,t&&this.killTransportOnce().catch(()=>{}),this.rejectPending(e),this.resolveDiagnosticWaiters(!1))}killTransportOnce(){return this.transportKilled?this.transportKillPromise??Promise.resolve():(this.transportKilled=!0,this.transportKillPromise=Promise.resolve(this.transport.kill()),this.transportKillPromise)}async cancelAndFailTimedOutRequest(e,t){let r=this.pending.get(e);if(!r)return;this.pending.delete(e);try{this.transport.write(f({jsonrpc:"2.0",method:"$/cancelRequest",params:{id:e}}))}catch{}this.transportFailure||(this.transportFailure=t,this.headerLength=0,this.bodyBuffer=null,this.bodyLength=0);let s=t;try{await this.killTransportOnce()}catch(i){s=new Error(`${t.message}; rust-analyzer cleanup failed: ${i instanceof Error?i.message:String(i)}`,{cause:i})}r.reject(s),this.rejectPending(s),this.resolveDiagnosticWaiters(!1)}dispatchMessage(e){if(this.recordDiagnosticNotification(e),this.recordServerStatusNotification(e),e.id!==void 0&&e.id!==null&&e.method){this.respondToServerRequest(e);return}if(e.id===void 0||e.id===null)return;let t=this.pending.get(e.id);if(t){if(clearTimeout(t.timeout),this.pending.delete(e.id),e.error){t.reject(new m(e.error.code,t.method,e.error.message));return}if(t.deadlineMs!==void 0&&this.monotonicNow()>=t.deadlineMs){t.reject(new a(`rust-analyzer readiness deadline expired during LSP request ${t.method}`));return}t.resolve(e.result)}}recordDiagnosticNotification(e){if(e.method!=="textDocument/publishDiagnostics")return;let t=e.params,r=t&&typeof t=="object"&&typeof t.uri=="string"?t.uri:null;if(!r)return;this.diagnosedUris.add(r);let s=this.diagnosticWaiters.get(r)??[];this.diagnosticWaiters.delete(r),s.forEach(i=>i(!0))}recordServerStatusNotification(e){if(e.method!=="experimental/serverStatus"||e.id!==void 0||!j(e.params))return;let t=e.params,r={health:t.health,quiescent:t.quiescent,...typeof t.message=="string"?{message:t.message}:{}},s=++this.currentServerStatusGeneration;if(this.latestServerStatus={generation:s,status:r},r.health==="error"){this.rejectReadinessWaiters(E());return}if(r.quiescent)for(let i of this.readinessWaiters)s<=i.afterGeneration||(clearTimeout(i.timeout),this.readinessWaiters.delete(i),i.resolve(r))}respondToServerRequest(e){if(e.id===void 0||e.id===null||!e.method)return;let t=e.method==="workspace/configuration"?this.workspaceConfiguration(e.params):null;this.transport.write(f({jsonrpc:"2.0",id:e.id,result:t}))}workspaceConfiguration(e){return(e&&typeof e=="object"&&Array.isArray(e.items)?e.items:[]).map(r=>typeof r.section=="string"?F(this.configuration,r.section):this.configuration)}rejectPending(e){for(let[t,r]of this.pending)clearTimeout(r.timeout),r.reject(e),this.pending.delete(t);this.rejectReadinessWaiters(e)}resolveDiagnosticWaiters(e){for(let t of this.diagnosticWaiters.values())t.forEach(r=>r(e));this.diagnosticWaiters.clear()}rejectReadinessWaiters(e){for(let t of this.readinessWaiters)clearTimeout(t.timeout),t.reject(e),this.readinessWaiters.delete(t)}};function C(n=M,e=O){if(!Number.isSafeInteger(n)||n<=0)throw new TypeError("maxHeaderBytes must be a positive safe integer.");if(!Number.isSafeInteger(e)||e<=0)throw new TypeError("maxMessageBytes must be a positive safe integer.");if(n>z)throw new RangeError(`maxHeaderBytes cannot exceed ${z} bytes for rust-analyzer LSP.`);if(n+p.length+e>A)throw new RangeError(`Combined rust-analyzer LSP header and message limits cannot exceed ${A} bytes.`);return{maxHeaderBytes:n,maxMessageBytes:e}}function D(n,e){let t=[];for(let i of n.split(`\r
|
|
4
|
+
`)){let o=i.indexOf(":");o<0||i.slice(0,o).trim().toLowerCase()!=="content-length"||t.push(i.slice(o+1).trim())}if(t.length===0)throw new h("rust-analyzer LSP response missing Content-Length header");if(t.length>1){let i=new Set(t).size>1?"rust-analyzer LSP response has conflicting Content-Length headers":"rust-analyzer LSP response has duplicate Content-Length headers";throw new h(i)}let r=t[0];if(!/^\d+$/.test(r))throw new h("rust-analyzer LSP Content-Length must be a non-negative safe integer");let s=Number(r);if(!Number.isSafeInteger(s))throw new h("rust-analyzer LSP Content-Length must be a non-negative safe integer");if(s>e)throw new h(`rust-analyzer LSP Content-Length exceeds ${e} byte message limit`);return s}function y(n,e,t=d){if(e===void 0)return{timeoutMs:n,deadlineLimited:!1};let r=e-t();if(r<=0)throw new a("rust-analyzer readiness deadline expired before LSP operation");return{timeoutMs:Math.min(n,r),deadlineLimited:r<=n}}function j(n){if(!n||typeof n!="object"||Array.isArray(n))return!1;let e=n;return(e.health==="ok"||e.health==="warning"||e.health==="error")&&typeof e.quiescent=="boolean"&&(e.message===void 0||e.message===null||typeof e.message=="string")}function E(){return new a("rust-analyzer reported error health before reaching readiness")}function F(n,e){let t=e.startsWith("rust-analyzer.")?e.slice(14):e;if(t===""||t==="rust-analyzer")return n;let r=n;for(let s of t.split(".")){if(!r||typeof r!="object")return null;r=r[s]}return r??null}function W(n){return n?(Array.isArray(n)?n:[n]).flatMap(t=>N(t)?[t]:_(t)?[{uri:t.targetUri,range:t.targetSelectionRange}]:[]):[]}function N(n){return!!(n&&typeof n=="object"&&typeof n.uri=="string")}function _(n){return!!(n&&typeof n=="object"&&typeof n.targetUri=="string")}function Z(n,e,t=process.env,r){let s=q(n,[],{cwd:e,env:t,detached:P()!=="win32",stdio:["pipe","pipe","pipe"]}),i=s.pid===void 0?null:b(s.pid,P()!=="win32"),o=i?R(r,i):null,l=null;return s.on("close",()=>v(o)),{write(u){s.stdin.write(u)},onData(u){s.stdout.on("data",u)},onClose(u){s.on("close",u)},onError(u){s.on("error",u)},kill(){if(!i){s.kill();return}return l??=L(i,{gracefulMs:1e3,forceMs:1e3}).then(u=>{if(!u.reaped)throw new Error(u.detail??`rust-analyzer process tree ${i.rootPid} was not reaped.`);v(o)}),l}}}function f(n){let e=JSON.stringify(n);return`Content-Length: ${Buffer.byteLength(e,"utf8")}\r
|
|
5
|
+
\r
|
|
6
|
+
${e}`}function H(n){let e=JSON.parse(n);if(!e||typeof e!="object")throw new Error("rust-analyzer LSP response was not a JSON object");return e}function $(n,e){return`rust-analyzer LSP transport closed${e?` by ${e}`:n===null?"":` with code ${n}`}`}async function B(n,e,t,r=d){let s=t-r();if(s<=0)throw new a("rust-analyzer readiness deadline expired before quiescence");try{let i=await n.waitForQuiescence(e,s);if(g(t,r,"during quiescence"),i.health==="error")throw new a("rust-analyzer reported error health before reaching readiness");if(!i.quiescent)throw new a("rust-analyzer did not report quiescence before reaching readiness");return i}catch(i){throw i instanceof a?i:new a(i instanceof Error?i.message:String(i))}}async function te(n,e,t,r,s,i=d,o=S){let l=await B(n,e,r,i);if(t===0)return l;let u=n.serverStatusSnapshot();if(!u)throw new a("rust-analyzer status is unavailable after initial document open");return await J(n,u,t,r,s,i,o)??l}async function J(n,e,t,r,s,i=d,o=S){if(t===0)return null;if(!e)throw new a("rust-analyzer status is unavailable before document open");T(e.status,"before document open");try{await n.readinessBarrier({deadlineMs:r}),g(r,i,"during post-open synchronization")}catch(c){throw c instanceof a?c:new a(c instanceof Error?c.message:String(c))}let l=n.serverStatusSnapshot();if(!l||l.generation<e.generation)throw new a("rust-analyzer status is unavailable after document open");let u;return l.generation===e.generation?(T(l.status,"after document open"),u=l.status):u=await B(n,e.generation,r,i),await U(s,r,i,o),u}async function re(n,e,t,r=d){let s=y(e,t,r);await n(s.timeoutMs),g(t,r,"during diagnostics")}async function U(n,e,t=d,r=S){if(n<=0)return;if(y(n,e,t).deadlineLimited)throw new a("rust-analyzer readiness deadline cannot accommodate delay");await r(n),g(e,t,"during delay")}async function ne(n,e){try{return await n()}catch(t){throw t instanceof a&&await e(),t}}function se(n){return n instanceof a?{ok:!1,error:n.message}:null}function g(n,e,t){if(n-e()<=0)throw new a(`rust-analyzer readiness deadline expired ${t}`)}function T(n,e){if(n.health==="error")throw new a(`rust-analyzer reported error health ${e}`);if(!n.quiescent)throw new a(`rust-analyzer did not report quiescence ${e}`)}function S(n){return new Promise(e=>setTimeout(e,n))}export{a,x as b,Z as c,te as d,J as e,re as f,U as g,ne as h,se as i,S as j};
|
|
7
|
+
//# sourceMappingURL=chunk-64DZ5TXR.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as T}from"./chunk-LOVIZBJ4.js";import{b,d as I,i as U,j as L,k as J}from"./chunk-CN5EH7O3.js";import{e as z,g as O}from"./chunk-J5FJMODQ.js";import{a as G}from"./chunk-7Y5T6XDP.js";import{c as M}from"./chunk-X6RMKHJQ.js";import{d as _}from"./chunk-JEVRKFRL.js";import{a as W}from"./chunk-QOIXNWQR.js";import{b as A,e as B}from"./chunk-GZKFETP5.js";import{e as E,f as N}from"./chunk-HGFDYOVB.js";import{a as H,c as C}from"./chunk-U5RIG3JP.js";function v(e){let t=P(e.projectFiles),r=new Set(t),a=new Map(e.snapshot.files.map(c=>[c.path,c])),s=e.snapshot.files.filter(c=>{let o=H(c.path,["typescript"]);return o==="config"||o==="ambient"}).map(c=>c.path),i=P([...t,...s]),n=i.find(c=>!a.has(c)),p=new Set(e.snapshot.files.map(c=>c.path)).size!==e.snapshot.files.length,d=!n&&i.some(c=>V(a.get(c))),l=M(JSON.stringify({pnpmWorkspaces:e.snapshot.pnpmWorkspaces,typescriptProjectMode:e.snapshot.typescriptProjectMode,typescriptProjects:P(e.snapshot.typescriptProjects),membership:t})),y,m;return{identityFor(c,o){if(!r.has(c))return g("target-outside-project");if(p)return g("duplicate-input-path");if(n)return g("missing-input-fingerprint");if(d)return g("unreadable-input");let u=[],f,w;if(e.graph===null)u.push("dependency-graph-unavailable"),w="whole-project",f=i;else{let h=c===y&&m?m:Z(c,e.graph);if(y=c,m=h,h.find(k=>!a.has(k)))return g("missing-input-fingerprint");if(f=P([...h,...s]),f.some(k=>V(a.get(k))))return g("unreadable-input");w="dependency-closure"}let X=f.map(h=>Q(a.get(h)));return{version:1,key:M(JSON.stringify({version:1,engineIdentity:e.engineIdentity,schemaVersion:o,projectIdentity:l,inputs:X})),mode:w,inputFiles:f,reasons:u}}}}function Z(e,t){let r=new Set,a=[e];for(let s=0;s<a.length;s+=1){let i=a[s];if(!(i===void 0||r.has(i))){r.add(i);for(let n of[...t.get(i)??[]].sort())r.has(n)||a.push(n)}}return[...r].sort()}function Q(e){return e.semanticHash===void 0?{path:e.path,size:e.size,hash:e.hash}:{path:e.path,semanticHash:e.semanticHash}}function V(e){return e.size<0||e.hash==="unreadable"}function g(e){return{version:1,key:null,mode:"unkeyed",inputFiles:[],reasons:[e]}}function P(e){return[...new Set(e)].sort()}var ee=B("typescript-semantic-identity-context",{clearGroups:["whole-project"]});function x(e,t,r){let a=ee.get(e,()=>te(e));if(!a)return null;let s=`${r}\0${t}`,i=a.identities.get(s);if(i)return i;let n=a.builder.identityFor(t,r);return a.identities.set(s,n),n}function S(e){return W(e,{includeIgnored:!1}).filter(b).sort()}function te(e){try{if(!e.generation.metadataRaw)return null;let t=_(e.generation.metadataRaw);if(t.kind!=="legacy"&&t.kind!=="supported"||!t.capabilities.usableForEvidenceCache)return null;let r=C(t.metadata.fingerprint);return r?{builder:v({projectFiles:S(e),snapshot:r,graph:T(e),engineIdentity:I()}),identities:new Map}:null}catch{return null}}import{getHeapStatistics as ne}from"v8";var j="typescript-reference-fragment-v2",Y=128,R=z({kind:"typescript-reference-fragments",invalidation:O("typescript-reference-fragments"),serialize:e=>JSON.stringify(e),deserialize:ce});function _e(e,t,r,a=e,s,i=new Set(r.keys())){let n=S(e),p=v({projectFiles:n,snapshot:t,graph:s??T(e),engineIdentity:I()}),d=[],l=0;for(let[m,c]of r){let o=p.identityFor(m,j).key;if(!o){l+=1;continue}d.push({relativePath:m,contentHash:o,value:[...c]})}let y=n.filter(m=>!i.has(m)&&!r.has(m)).length;return R.writeBatch(a,d),{affectedFiles:d.length,carriedFiles:y,skippedAffectedFiles:l}}function Ae(e,t,r,a){let s=t.filter(n=>b(n.relativePath));if(s.length===0)return F("no TypeScript definitions");let i=F("shadow did not run");return E("typescript.reference-fragments.shadow",()=>{try{let n=a(s[0].relativePath);if(!n.availability().available||!n.referenceFragmentsForFiles)return i=F("TypeScript reference fragment provider is unavailable"),i;let p=S(e),d=new Set(p),l=new Map;for(let o of D(p)){let u=n.referenceFragmentsForFiles(o);if(o.some(f=>!u.has(f)))return i=F("TypeScript reference fragment provider returned an incomplete batch"),i;for(let f of o)l.set(f,u.get(f)??[])}let y=U(s,l),m=J(s,re(r,d),y);if(!m.passed)return i={state:"failing",files:p.length,keyedFiles:0,writtenFiles:0,...m},i;let c=pe(e,p,l);return R.writeBatch(e,c),i={state:"passing",files:p.length,keyedFiles:c.length,writtenFiles:c.length,...m},i}catch(n){return i=F(n instanceof Error?n.message:String(n)),i}},()=>({...i}))}function re(e,t){return new Map([...e].map(([r,a])=>[r,a.filter(s=>t.has(s.file))]))}function Be(e,t,r){if(t.length===0)return{references:new Map,files:0,cacheHits:0,cacheMisses:0,computedFiles:0};let a="fallback",s=0,i=0,n=0,p=0;return E("typescript.reference-fragments.materialize",()=>{try{let d=S(e);s=d.length;let l=L(t),y=[];for(let c of d){let o=x(e,c,j);if(!o?.key)return null;let u=R.read(e,c,o.key);u===null?(n+=1,y.push({file:c,contentHash:o.key})):(i+=1,l.add(u))}return n===0?(a="hit",{references:l.finish(),files:s,cacheHits:i,cacheMisses:n,computedFiles:p}):ae(e,y,r,c=>{for(let{fragments:o}of c)l.add(o);p+=c.length})?(a="computed",{references:l.finish(),files:s,cacheHits:i,cacheMisses:n,computedFiles:p}):null}catch{return null}},()=>({state:a,files:s,cacheHits:i,cacheMisses:n,computedFiles:p}))}function D(e){let t=[];for(let r=0;r<e.length;r+=Y)t.push(e.slice(r,r+Y));return t}var ie=.75;function q(e){return{heapUsedFraction:()=>{let t=ne();return t.heap_size_limit>0?t.used_heap_size/t.heap_size_limit:0},collect:G,release:()=>A(e,{groups:["semantic-provider"]})}}function $(e,t=ie){return e.heapUsedFraction()<t||e.collect()&&e.heapUsedFraction()<t?!1:(e.release(),!0)}function ae(e,t,r,a,s=q(e)){for(let i of D(t)){let n=K(e,i,r);if(!n)return!1;a(n),$(s)}return!0}function K(e,t,r){let a=t.map(({file:n})=>n),s=r(a[0]);if(!s.availability().available||!s.referenceFragmentsForFiles)return null;let i=s.referenceFragmentsForFiles(a);return a.some(n=>!i.has(n))?null:(R.writeBatch(e,t.map(({file:n,contentHash:p})=>({relativePath:n,contentHash:p,value:i.get(n)??[]}))),a.map(n=>({file:n,fragments:i.get(n)??[]})))}var se=()=>new Promise(e=>setImmediate(e));async function Ne(e,t,r={}){let a=r.yieldToEventLoop??se,s=r.probe??q(e),i="fallback",n=0,p=0,d=0,l=0;return N("typescript.reference-fragments.warm",async()=>{try{let y=S(e),m=r.files?new Set(r.files):null,c=m?y.filter(u=>m.has(u)):y;n=c.length;let o=[];for(let u of c){let f=x(e,u,j);if(!f?.key)return null;R.has(e,u,f.key)?p+=1:(d+=1,o.push({file:u,contentHash:f.key}))}if(o.length===0)return i="hit",{files:n,cacheHits:p,cacheMisses:d,computedFiles:l};for(let u of D(o)){let f=K(e,u,t);if(!f)return null;l+=f.length,$(s),r.onBatch?.({computedFiles:l,missingFiles:o.length}),await a()}return i="computed",{files:n,cacheHits:p,cacheMisses:d,computedFiles:l}}catch{return null}},()=>({state:i,files:n,cacheHits:p,cacheMisses:d,computedFiles:l}))}function F(e){return{state:"unavailable",files:0,keyedFiles:0,writtenFiles:0,expectedCount:0,actualCount:0,missing:[],extra:[],reason:e}}function ce(e){try{let t=JSON.parse(e);return!Array.isArray(t)||!t.every(oe)?null:t}catch{return null}}function oe(e){if(!e||typeof e!="object")return!1;let t=e,r=t.location;return typeof t.targetSymbol=="string"&&!!r&&typeof r.file=="string"&&typeof r.line=="number"&&typeof r.column=="number"}function pe(e,t,r){let a=[];for(let s of t){let i=x(e,s,j);i?.key&&a.push({relativePath:s,contentHash:i.key,value:r.get(s)??[]})}return a}export{x as a,_e as b,Ae as c,Be as d,Ne as e};
|
|
2
|
+
//# sourceMappingURL=chunk-65245JCM.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as c,c as f}from"./chunk-QZ7KQZRN.js";import{execFileSync as P}from"child_process";import{platform as S}from"os";var y=1e3,w=2*1024*1024,R=25;function A(e,n,r=h){let t=r.readIdentity(e),s=new Map;return t&&s.set(e,t),{rootPid:e,rootIdentity:t,ownsProcessGroup:n,knownMembers:s}}async function L(e,n,r=h){if(!e.rootIdentity)return I(e,n,r);let t=T(e,r);if(t==="mismatch")return{reaped:!1,reason:"identity-mismatch",detail:`Process ${e.rootPid} no longer has the identity owned by this runner.`};if(t==="exited"&&!b(e,r))return{reaped:!0,reason:"terminated"};if(r.platform==="win32")return x(e,n,r);let s=p(e,"SIGTERM",r);if(await a(e,n.gracefulMs,r))return{reaped:!0,reason:"terminated"};let o=p(e,"SIGKILL",r);return await a(e,n.forceMs,r)?{reaped:!0,reason:"terminated"}:o?{reaped:!1,reason:o.reason,detail:o.detail}:s?{reaped:!1,reason:s.reason,detail:s.detail}:{reaped:!1,reason:"deadline",detail:`Process tree ${e.rootPid} did not exit before its termination deadline.`}}async function I(e,n,r){let t=await a(e,n.gracefulMs+n.forceMs,r);return{reaped:t,reason:t?"terminated":"identity-unavailable",detail:t?void 0:`Could not establish the birth identity of process ${e.rootPid}.`}}async function x(e,n,r){try{r.terminateWindowsTree(e.rootPid)}catch(s){let i=await a(e,n.forceMs,r);return{reaped:i,reason:i?"terminated":"signal-failed",detail:i?void 0:l(s)}}let t=await a(e,n.forceMs,r);return{reaped:t,reason:t?"terminated":"deadline"}}function T(e,n){let r=n.readIdentity(e.rootPid);if(!r)return"exited";if(!e.rootIdentity||!c(e.rootIdentity,r))return"mismatch";e.knownMembers.set(e.rootPid,r);for(let t of n.listDescendantPids(e.rootPid)){let s=n.readIdentity(t);s&&e.knownMembers.set(t,s)}return"owned"}function p(e,n,r){let t=T(e,r);if(t==="mismatch")return{reason:"identity-mismatch",detail:`Process ${e.rootPid} changed identity before ${n}.`};if(t==="owned"&&e.ownsProcessGroup)try{return r.signal(-e.rootPid,n),null}catch(s){if(!g(s))return{reason:"signal-failed",detail:l(s)}}return v(e,n,r)}async function a(e,n,r){let t=r.now()+n;for(;b(e,r);){if(r.now()>=t)return!1;await r.sleep(Math.min(R,Math.max(1,t-r.now())))}return!0}function b(e,n){if(!e.rootIdentity&&n.isProcessAlive(e.rootPid))return!0;for(let r of e.knownMembers.values()){let t=n.readIdentity(r.pid);if(t&&c(r,t))return!0}return!!(e.ownsProcessGroup&&n.isProcessGroupAlive(e.rootPid))}function O(e){let n=E(!1),r=new Map;for(let o of n.split(/\r?\n/)){let d=/^\s*(\d+)\s+(\d+)\s*$/.exec(o);if(!d)continue;let M=Number(d[1]),u=Number(d[2]),m=r.get(u)??[];m.push(M),r.set(u,m)}let t=[],s=[...r.get(e)??[]],i=new Set;for(;s.length>0;){let o=s.pop();i.has(o)||(i.add(o),t.push(o),s.push(...r.get(o)??[]))}return t}function E(e){return P("ps",["-axo",e?"pid=,ppid=,rss=":"pid=,ppid="],{encoding:"utf8",timeout:y,maxBuffer:w,env:{...process.env,LC_ALL:"C",LANG:"C"},stdio:["ignore","pipe","ignore"]})}function g(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="ESRCH"}function l(e){return e instanceof Error?e.message:String(e)}var h={platform:S(),now:Date.now,readIdentity:f,isProcessAlive(e){try{return process.kill(e,0),!0}catch(n){return typeof n=="object"&&n!==null&&"code"in n&&n.code==="EPERM"}},isProcessGroupAlive(e){if(this.platform==="win32")return!1;try{return process.kill(-e,0),!0}catch(n){return typeof n=="object"&&n!==null&&"code"in n&&n.code==="EPERM"}},listDescendantPids(e){if(this.platform==="win32")return[];try{return O(e)}catch{return[]}},signal(e,n){process.kill(e,n)},terminateWindowsTree(e){P("taskkill.exe",["/PID",String(e),"/T","/F"],{timeout:y,maxBuffer:w,stdio:"ignore",windowsHide:!0})},async sleep(e){await new Promise(n=>setTimeout(n,e))}};function v(e,n,r){let t=null;for(let s of e.knownMembers.values()){let i=r.readIdentity(s.pid);if(!(!i||!c(s,i)))try{r.signal(s.pid,n)}catch(o){!g(o)&&t===null&&(t=l(o))}}return t===null?null:{reason:"signal-failed",detail:t}}export{A as a,L as b};
|
|
2
|
+
//# sourceMappingURL=chunk-6FFVZZL4.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as x}from"./chunk-E7YNJLCB.js";import{g as N,h as g}from"./chunk-D254DNNQ.js";import{a as L}from"./chunk-GMVSHUKZ.js";import{b as E}from"./chunk-BOJ5SVE2.js";import{b as I}from"./chunk-6LSEIIF7.js";import{a as h}from"./chunk-BGBBVSH4.js";import{e as T,g as S}from"./chunk-4WCUBZU3.js";import{d as y}from"./chunk-5D2LVK7O.js";import{b as p,c as b}from"./chunk-7WTPQ4NX.js";var R={caller:3,"entry-surface":2,rooted:1},D=/not\s*yet\s*implement|not\s*implement|unimplement|\bnyi\b|\btodo\b|\bstub\b|not\s*supported|coming\s*soon/i,F=/^throw\s+new\s+[\w.]*Error\s*\(([\s\S]*)\)\s*;?$/,P=/^return(\s+(null|undefined|false|0|''|""|``|\[\]|\{\}))?\s*;?$/,O=/\/\/\s*TODO\b|\/\*\s*TODO\b/i,C=/(?:=>|\))\s*(?::\s*[^{;=]+)?\s*\{\s*\}\s*;?\s*$/;function W(n,e={}){let{scope:o,limit:i=30,scanLimit:s,semantic:r=!0}=e,m=new I(n),u=E(m.productionCallableDefinitions({scope:o,minLoc:1,requireFunctionLikeSymbol:!0,excludeTypesFiles:!0}),s),a=[];for(let t of u){let l=A(n,t);l&&a.push(l)}if(a.length===0)return[];let _=x(n,m).forDefinitions(a.map(t=>t.def),{semantic:r}),c=[];for(let t of a){let d=_.get(t.def.symbolId)?.realConsumers.length??0,f=w(n,t.def,d);f&&c.push({symbol:t.def.symbol,shortName:y(t.def.symbol),file:t.def.relativePath,startLine:t.def.startLine,endLine:t.def.endLine,loc:h(t.def),stubKind:t.stubKind,reachability:f,callerFanIn:d,stubText:t.stubText})}return c.sort((t,l)=>R[l.reachability]-R[t.reachability]||l.callerFanIn-t.callerFanIn||t.file.localeCompare(l.file)||t.startLine-l.startLine),i?c.slice(0,i):c}function w(n,e,o){return o>0?"caller":S(n,e.symbol,e.relativePath)?"rooted":T(n,e.relativePath)?"entry-surface":null}function A(n,e){let o=N(n,e);if(!o)return null;let i=g(o),s=i.trim();if(s==="")return!U(o)||!L(n,e)?null:{def:e,stubKind:"empty-body",stubText:"(empty body)"};let r=b(i),m=p(i),u=v(r,m);if(u.length!==1)return null;let a=u[0];return B(a)?{def:e,stubKind:"throw-stub",stubText:a.trim()}:O.test(i)&&P.test(a.trim())?{def:e,stubKind:"todo-return-default",stubText:s}:null}var K=new Set(["(","[","{"]),M=new Set([")","]","}"]);function v(n,e){let o=[],i=0,s="";for(let r=0;r<e.length;r+=1){let m=e[r];if(K.has(m)?i+=1:M.has(m)&&(i=Math.max(0,i-1)),m===";"&&i===0){o.push(s),s="";continue}s+=n[r]??""}return s.trim()&&o.push(s),o.map(r=>r.trim()).filter(r=>r.length>0)}function B(n){let e=F.exec(n.trim());return e?D.test(e[1]??""):!1}function U(n){return C.test(n.trimEnd())}export{W as a};
|
|
2
|
+
//# sourceMappingURL=chunk-6KO5JHAR.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{d as x,f as b}from"./chunk-JEVRKFRL.js";import{c,e as f,g as p,h as I}from"./chunk-3JIQS44J.js";import{a as m,f as y}from"./chunk-62BDNPMI.js";import{createHash as S}from"crypto";import{dirname as T,join as g}from"path";var l=6,E=5,v=2,h="typescript-index";function j(e){let n=g(e,h),t=f(n);return{...t,requestDir:t.legacyRequestDir}}function k(e){let n=JSON.parse(e),t=n.protocolVersion,r=t===v,i=[4,E].includes(t),s=n.request,a=D(s,r||i);if(!(r||i||t===l)||!M(n)||!A(a))throw new Error("TypeScript index service received an invalid mailbox request.");if(!r&&!O(n))throw new Error("TypeScript index service received an invalid mailbox request.");if(!r)return P(n,s,a,t);let R=p("typescript-index-v2",{id:n.id,baseGeneration:n.baseGeneration,request:s});return{protocolVersion:l,mailboxVersion:c,id:n.id,operationKey:R,clientId:"legacy-v2",enqueuedAtMs:n.deadlineAtMs,deadlineAtMs:n.deadlineAtMs,baseGeneration:n.baseGeneration,request:a}}function P(e,n,t,r){let i=p(`typescript-index-v${r}`,{baseGeneration:e.baseGeneration,request:n});if(e.operationKey!==i)throw new Error("TypeScript index service received a mismatched mailbox operation identity.");return{...e,protocolVersion:l,request:t}}function D(e,n){return n&&e&&typeof e=="object"&&!Array.isArray(e)?{...e,removedFiles:e.removedFiles??[]}:e}function M(e){return typeof e.id=="string"&&!!e.id&&typeof e.baseGeneration=="string"&&!!e.baseGeneration&&typeof e.deadlineAtMs=="number"&&Number.isFinite(e.deadlineAtMs)}function O(e){return e.mailboxVersion===c&&q(e)&&typeof e.clientId=="string"&&!!e.clientId&&typeof e.enqueuedAtMs=="number"&&Number.isFinite(e.enqueuedAtMs)&&e.deadlineAtMs>=e.enqueuedAtMs}function q(e){return typeof e.operationKey=="string"&&/^[a-f0-9]{64}$/.test(e.operationKey)&&e.id===I(e.operationKey)}var u;function X(e){try{let n=y(g(T(e),"meta.json"),{inputKind:"reindex metadata",maxBytes:m}),t=S("sha256").update(n).digest("hex");if(u?.bytesHash===t)return u.generation;let r=b(x(n.toString("utf8"))),i=r?S("sha256").update(r).digest("hex"):null;return u={bytesHash:t,generation:i},i}catch{return null}}function A(e){if(!e||typeof e!="object")return!1;let n=e,t=d(n.modifiedFiles)?n.modifiedFiles:null,r=d(n.removedFiles)?n.removedFiles:null,i=d(n.affectedFiles)?n.affectedFiles:null;return B(n)&&w(t,r,i)&&_(n.knownDocuments,i??[])}function _(e,n){if(e===void 0)return!0;if(!Array.isArray(e))return!1;let t=new Set,r=new Set(n);return e.every(i=>!i||typeof i.relativePath!="string"||!r.has(i.relativePath)||t.has(i.relativePath)||typeof i.blobHash!="string"||!/^[a-f0-9]{64}$/.test(i.blobHash)||!Number.isSafeInteger(i.byteLength)||i.byteLength<=0?!1:(t.add(i.relativePath),!0))}function B(e){return e.kind==="emit-documents"&&o(e.tsconfigPath)&&o(e.projectArgument)&&o(e.projectIdentity)&&o(e.producerIdentity)}function o(e){return typeof e=="string"&&!!e}function w(e,n,t){return e!==null&&new Set(e).size===e.length&&n!==null&&new Set(n).size===n.length&&t!==null&&(t.length>0||n.length>0)&&new Set(t).size===t.length}function d(e){return Array.isArray(e)&&e.every(n=>typeof n=="string"&&n.length>0)}export{l as a,j as b,k as c,X as d,_ as e};
|
|
2
|
+
//# sourceMappingURL=chunk-6LRXOOSX.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as v}from"./chunk-BGBBVSH4.js";import{a as y}from"./chunk-36SGVCGX.js";import{B as ce,C as ue,y as le}from"./chunk-4WTUBQ36.js";import{b as ee,d as te,e as ie,f as re,g as ae,h as oe,k as F,l as se,m as k}from"./chunk-NZAXKGRL.js";import{d as ne}from"./chunk-KK7GPALL.js";import{e as Z,g as $}from"./chunk-4WCUBZU3.js";import{c as R}from"./chunk-E3FDPXZK.js";import{b as B}from"./chunk-GCKCF5FL.js";import{A as Y,B as J,C as P,a as z,e as U,i as L,j as x,l as Q,m as W,x as h,y as X}from"./chunk-5D2LVK7O.js";import{o as H,p as m}from"./chunk-7WTPQ4NX.js";import{A as d,B as G,Z as O,a as g}from"./chunk-FVULPZDF.js";import{a as j,f as K,g as V}from"./chunk-A2IIGFMJ.js";import{t as q}from"./chunk-GVWX5T43.js";import{Da as I}from"./chunk-5TNQJUR2.js";function E(t,e,n={}){let i=new Map;if(e&&e.length===0)return i;let a=g(t,{includeIgnored:!1}),r=re(t),o=e??X(t),l=new Set(o.map(u=>u.symbolId)),s=Ee(o);return Ce(t,i,a,r,l,s),Ie(t,i,o,l),Fe(t,i,a,r,l,s),n.semantic!==!1&&n.semanticEvidence&&Ae(i,n.semanticEvidence.callerMap(t,we(o))),i}function Ce(t,e,n,i,a,r){for(let o of n){if(!d(o))continue;let l=H(t,o);if(l)for(let s of l)r&&!r.has(s.calleeLeaf)||De(t,e,o,s,i,a)}}function De(t,e,n,i,a,r){let o=te(n,a.get(i.calleeLeaf)??[]);if(!o||o.length===0)return;let l=ie(t,n,o,i.memberAccess,i.calleeQualifier);l&&r.has(l.symbolId)&&l.file!==n&&w(e,l.symbolId,n)}function Ie(t,e,n,i){let a=xe(n);for(let r of Le(t,i))t.isIgnored(r.relative_path)||Pe(r,a.get(r.symbol_id))||w(e,r.symbol_id,r.relative_path)}function Le(t,e){return ne(t,e?[...e]:void 0)}function xe(t){let e=new Map;for(let n of t)e.set(n.symbolId,{docId:n.documentId,startLine:n.startLine,endLine:n.endLine});return e}function Pe(t,e){return!!e&&e.docId===t.document_id&&t.chunk_start>=e.startLine&&t.chunk_end<=e.endLine}function Fe(t,e,n,i,a,r){for(let o of n){if(d(o)!=="rust")continue;let l=m(t,o,{includeRustAttributeNames:!0});if(l.length!==0)for(let{name:s}of l)r&&!r.has(s)||ke(e,o,i.get(s),a)}}function ke(t,e,n,i){if(n)for(let a of n)i.has(a.symbolId)&&a.file!==e&&w(t,a.symbolId,e)}function w(t,e,n){let i=t.get(e);i||(i=new Set,t.set(e,i)),i.add(n)}function Ee(t){let e=new Set;for(let n of t){let i="leaf"in n&&typeof n.leaf=="string"?n.leaf:"symbol"in n&&typeof n.symbol=="string"?U(n.symbol):"";i&&e.add(i)}return e.size>0?e:null}function we(t){return t.filter(e=>"relativePath"in e&&"symbol"in e&&"leaf"in e)}function Ae(t,e){for(let[n,i]of e){let a=t.get(n);a||(a=new Set,t.set(n,a));for(let r of i)a.add(r)}}var Ne=I("cross-file-caller-files",{clearGroups:["whole-project","source-file"]}),Te=I("source-fallback-caller-files",{clearGroups:["whole-project","source-file"]});function fe(t,e,n){let i=e.filter(r=>!t.has(r.symbolId));if(i.length>0){let r=n(i);for(let o of i)t.set(o.symbolId,r.get(o.symbolId)??new Set)}let a=new Map;for(let r of e){let o=t.get(r.symbolId);o&&o.size>0&&a.set(r.symbolId,new Set(o))}return a}function A(t,e,n={}){if(e===void 0)return E(t,e,n);let i=fe(Ne.get(t,()=>new Map),e,a=>E(t,a,{semantic:!1}));return n.semantic===!1||!n.semanticEvidence?i:me(i,n.semanticEvidence.callerMap(t,e.filter(a=>"relativePath"in a&&"symbol"in a&&"leaf"in a)))}function N(t,e,n={}){return n.skipPath?k(t,e,n):fe(Te.get(t,()=>new Map),e,i=>k(t,i))}function de(t,e,n={}){let i=A(t,e,{semantic:n.semantic,semanticEvidence:n.semanticEvidence});return n.sourceFallback===!1?i:me(i,N(t,e))}function me(t,e){let n=new Map;for(let[i,a]of t)n.set(i,new Set(a));for(let[i,a]of e){let r=n.get(i)??new Set;for(let o of a)r.add(o);n.set(i,r)}return n}function be(t,e,n){let i=e.identifierResolution==="strict"?F:se,a=e.candidateNames?ae(e.candidateNames):null,r={scannedPaths:0,candidateMatchedPaths:0,visitedNames:0,visitedHits:0,currentPath:""};for(let o of e.paths)if(r.scannedPaths+=1,r.currentPath=o,!!_e(t,o,e))try{if(a&&!oe(j(t,o),a))continue;r.candidateMatchedPaths+=1,qe(t,o,e,i,n,r)}finally{e.afterPath?.(o),r.scannedPaths%10===0&&q("source-reference-scan.progress",()=>{},()=>({scannedPaths:r.scannedPaths,currentPath:r.currentPath,candidateMatchedPaths:r.candidateMatchedPaths,visitedNames:r.visitedNames,visitedHits:r.visitedHits}))}}function _e(t,e,n){return!(!d(e)&&!(n.includeVueSfc&&G(e))||t.isIgnored(e)||n.skipPath?.(e))}function qe(t,e,n,i,a,r){let o=(s,u,S,b)=>{if(n.candidateNames&&!n.candidateNames.has(s))return;r.visitedNames+=1;let M=n.resolveTargets?n.resolveTargets({sourceFile:e,name:s,kind:u,defaultTargets:b}):b();for(let C of M)r.visitedHits+=1,a({sourceFile:e,name:s,target:C,occurrences:S,kind:u})},l=ee(t,e);for(let[s,u]of l)o(s,"identifier",u.length,()=>i(t,e,s));for(let s of m(t,e,{includeCrossLanguageDispatchNames:n.includeCrossLanguageDispatchNames,includeRustAttributeNames:n.includeRustAttributeNames})){let u=s.kind==="cross-language-dispatch"?()=>F(t,e,s.name):()=>i(t,e,s.name);o(s.name,s.kind,s.occurrences,u)}}function pe(t,e={}){let{scope:n,files:i,minLoc:a=1,maxLoc:r=Number.POSITIVE_INFINITY,excludeSymbol:o,excludeEntrySurfaces:l=!1,excludeTypesFiles:s=!1,excludeRootedSymbols:u=!1,requireFunctionLikeSymbol:S=!1,requireCallableSymbol:b=!1,excludeRustTraitImplMembers:M=!1,includeSuppressed:C=!1,sortByLocDesc:Se=!1}=e,D=[],ge=Ge(t,{scope:n,files:i,requireFunctionLikeSymbol:S,requireCallableSymbol:b}),T=new Map,_=new Map,he=c=>{let f=T.get(c);if(f!==void 0)return f;let p=Z(t,c);return T.set(c,p),p},Re=c=>{let f=_.get(c);if(f!==void 0)return f;let p=R(c);return _.set(c,p),p},ve={excludeEntrySurfaces:l,requireFunctionLikeSymbol:S,requireCallableSymbol:b,excludeSymbol:o,minLoc:a,maxLoc:r},Me={excludeTypesFiles:s,excludeRootedSymbols:u,excludeRustTraitImplMembers:M};for(let c of ge)je(t,c,ve,he)&&Ke(t,c,Me)&&Ve(t,c,C,Re)&&D.push(c);return Se?D.sort((c,f)=>v(f)-v(c)):D}function je(t,e,n,i){let a=e.relativePath;if(t.isIgnored(a)||n.excludeEntrySurfaces&&i(a)||!He(e,n)||n.excludeSymbol!==void 0&&e.symbol===n.excludeSymbol)return!1;let r=v(e);return!(r<n.minLoc||r>n.maxLoc)}function Ke(t,e,n){let i=e.relativePath;return n.excludeTypesFiles&&Oe(i)||n.excludeRootedSymbols&&$(t,e.symbol,i)?!1:!n.excludeRustTraitImplMembers||!Q(e.symbol)}function Ve(t,e,n,i){let a=e.relativePath;return i(a)==="test"||W(e.symbol)?!1:n||!V(t,a,e.startLine,"")}function Ge(t,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=>h(t,i)):e.requireCallableSymbol?P(t,{scope:e.scope,symbolMatches:L,sqlPrefilter:"callable"}):e.requireFunctionLikeSymbol?P(t,{scope:e.scope,symbolMatches:x,sqlPrefilter:"function-like"}):J(t,e.scope)}function He(t,e){return e.requireCallableSymbol?L(t.symbol):e.requireFunctionLikeSymbol?x(t.symbol):t.isFunctionLike}function Oe(t){return(t.split("/").pop()??"").includes("types")}var ye=class{constructor(e){this.db=e}db;scopedDefinitions(e){return Y(this.db,e)}definitionsForFile(e){return h(this.db,e)}productionCallableDefinitions(e={}){return pe(this.db,e)}calleeMap(e,n={}){return ce(this.db,e,{...n,semanticEvidence:y})}callableCallees(e,n={}){return le(this.db,e,{...n,additive:!0,callableOnly:!0,semanticEvidence:y}).map(i=>({...i,evidenceStrength:ue(i.source)}))}crossFileCallerMap(e,n={}){return A(this.db,e,{...n,semanticEvidence:y})}sourceFallbackCallerFiles(e,n={}){return N(this.db,e,n)}callerFileMap(e,n={}){return de(this.db,e,{...n,semanticEvidence:y})}frameworkReferencedSymbolIds(e){let n=new Map;for(let a of e){if(!a.leaf)continue;let r=n.get(a.leaf)??[];r.push(a.symbolId),n.set(a.leaf,r)}let i=new Set;for(let a of g(this.db,{includeIgnored:!1}))if(d(a)==="rust")for(let{name:r}of m(this.db,a,{includeRustAttributeNames:!0}))for(let o of n.get(r)??[])i.add(o);return i}symbolsWithNonSelfCallees(e,n={}){if(e.length===0)return new Set;let i=new Map(e.map(r=>[r.symbolId,r.symbol])),a=this.calleeMap(e,n);return new Set([...a.entries()].filter(([r,o])=>{let l=i.get(r);return o.some(s=>s.symbol!==l)}).map(([r])=>r))}fileDependencyGraph(e){return B(this.db,e)}fileKind(e){return R(e)}hasSuppressionComment(e){return K(this.db,e.relativePath,e.startLine)}sourceFiles(){return O(this.db)}scanSourceReferences(e,n){be(this.db,e,n)}callableSignature(e){let n=z(this.db).forFile(e.relativePath,{facts:!0}).facts?.callables.find(i=>i.startLine===e.startLine&&i.endLine===e.endLine);return n?{paramCount:n.paramCount}:null}};export{N as a,ye as b};
|
|
2
|
+
//# sourceMappingURL=chunk-6LSEIIF7.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{a as Y}from"./chunk-JFXSGAEB.js";import{a as X}from"./chunk-CFN45HFP.js";import{a as W}from"./chunk-55UQAMZO.js";import{a as q}from"./chunk-YTYWI7VB.js";import{a as g}from"./chunk-UXYXF7GV.js";import{g as G}from"./chunk-D254DNNQ.js";import{a as H,b as K}from"./chunk-ZR4HBC2H.js";import{a as k}from"./chunk-F4LUHJTF.js";import{a as w}from"./chunk-PWOASWEG.js";import{c as $}from"./chunk-UP5KXN2I.js";import{a as U}from"./chunk-KDDIE2DP.js";import{d as j}from"./chunk-MOQQBQRD.js";import{a as z}from"./chunk-4WBDEVX2.js";import{b as O}from"./chunk-AOSIYPTA.js";import{a as F}from"./chunk-ZHSP366W.js";import{a as B,c as N}from"./chunk-FMRN2TRL.js";import{c as _}from"./chunk-E3FDPXZK.js";import{e as C,x}from"./chunk-5D2LVK7O.js";import{t as M}from"./chunk-GVWX5T43.js";function Z(t){let e=new Set(t.filter(n=>n.definition?.isFunctionLike).map(n=>`${n.role}:${n.definition.relativePath}`));return t.flatMap(n=>n.definition?!n.definition.isFunctionLike&&e.has(`${n.role}:${n.definition.relativePath}`)?[]:[{definition:n.definition,role:n.role}]:[])}var V=6,S=10,E=3,v=8,se=.7,ee=24,L=200,te=12,ne=80,oe=600;function Xe(t,e,n={}){let o=n.impactDepth??3,i=n.semantic,s=ve(e)?me(t,e):null,r=s?s.primary?.symbol??null:e,{traceResult:c,callGraphResult:l,complexityResult:m,affectedResults:u,reuseCandidates:p,targetSymbol:a,affectedConsumerReuse:d}=ae(t,r,n,o),b=f("change-surface",e,()=>w(t,e,{semantic:i}),y=>({symbols:y?.symbols.length??0,externalConsumers:y?.totalExternalConsumers??0})),h=f("system",e,()=>X(t,e),y=>({files:y.files.length,symbols:y.symbols.length})),{depsResults:P,rdepsResults:T}=re(t,e,h),I=f("surface",e,()=>Y(t,e),y=>({consumers:y.length})),A=le(c,l,m,u,b,P,T,h,I),ie=ce(s,c,A),D=b?.file??c.definitions[0]?.relativePath??null;return{target:e,...s?.primary?{primaryCallable:{symbol:s.primary.symbol,shortName:C(s.primary.symbol),file:s.primary.relativePath}}:{},matched:A,history:f("history",D??e,()=>Ee(t,D,n.gitHead)),trace:ue(c),callGraph:l,complexity:m,affected:u,changeSurface:b,deps:P,rdeps:T,system:h,surface:I,reuseCandidates:p,affectedConsumerReuse:d,sourcePacket:fe(t,a,c,d,p),warnings:ie}}function re(t,e,n){let o=n.files.length===1,i=f("deps",e,()=>o?n.dependsOn.map(r=>({relativePath:r,edgeBasis:"symbol-references",evidence:"cross-file SCIP references plus resolved source imports"})):H(t,e),r=>({files:r.length,reusedSystem:o})),s=f("rdeps",e,()=>o?n.dependedOnBy.map(r=>({relativePath:r,edgeBasis:"symbol-references",evidence:"cross-file SCIP references plus resolved source imports"})):K(t,e),r=>({files:r.length,reusedSystem:o}));return{depsResults:i,rdepsResults:s}}function le(t,e,n,o,i,s,r,c,l){return{symbol:t.definitions.length>0||t.referencedBy.length>0||e!==null||n!==null||o.length>0,file:i!==null||s.length>0||r.length>0,module:c.files.length>0||c.symbols.length>0||l.length>0}}function ce(t,e,n){let o=[];t&&!t.primary&&t.callableCount>1&&o.push(`File target has ${t.callableCount} callable symbols; use one callable name for compiler-resolved relationships.`);let i=[...new Set(e.referencedBy.map(s=>s.relativePath))];return i.length>0&&i.every(s=>_(s)==="test")&&o.push("Only test references were found for this target. For replacement or retirement work, map the currently wired owner or one production entry point before planning; this target does not describe the live affected surface."),!n.symbol&&!n.file&&!n.module&&o.push("No symbol, file, or module matched target."),o}function ae(t,e,n,o){let i=n.semantic,s=e?f("trace",e,()=>W(t,e,{semantic:i,referenceContext:te}),a=>({definitions:a.definitions.length,references:a.referencedBy.length})):{definitions:[],referencedBy:[],claimSupport:null},r=e?f("call-graph",e,()=>k(t,e,{semantic:i}),a=>({callers:a?.callers.length??0,callees:a?.callees.length??0})):null,c=e?f("complexity",e,()=>z(t,e,{semantic:i}),a=>({callees:a?.calleeCount??0})):null,l=e?f("affected",e,()=>F(t,e,{maxDepth:o,scope:n.scope}),a=>({maxDepth:o,affectedSymbols:a.length})):[],m=e?f("reuse-candidates",e,()=>g(t,e,{minSimilarity:.4,limit:5,semantic:i,sourceCandidateMode:"target-pruned"}),a=>({candidates:a.length,direct:a.filter(d=>d.actionTier==="direct").length})):[],u=e?B(t,e)?.symbol??null:null,p=e?f("affected-consumer-reuse",e,()=>Se(s,u,a=>g(t,a,{minSimilarity:.4,limit:S,semantic:i,sourceCandidateMode:"target-pruned"}),{consumerLimit:V,perConsumerSearchLimit:S,perConsumerCandidateLimit:E,candidateLimit:v}),a=>({totalConsumers:a.coverage.totalConsumers,analyzedConsumers:a.coverage.analyzedConsumers,candidates:a.candidates.length})):Le();return{traceResult:s,callGraphResult:r,complexityResult:c,affectedResults:l,reuseCandidates:m,targetSymbol:u,affectedConsumerReuse:p}}function ue(t){return{definitions:t.definitions,referencedBy:t.referencedBy.map(e=>({relativePath:e.relativePath,line:e.line,enclosingSymbol:e.enclosingSymbol,enclosingShort:e.enclosingShort}))}}function me(t,e){let n=O(t,e);if(n.length!==1)return{primary:null,callableCount:0};let o=x(t,n[0]).filter(r=>r.isFunctionLike),i=o.filter(r=>r.enclosingSymbol===null),s=i.length>0?i:o;return{primary:s.length===1?s[0]:null,callableCount:s.length}}function fe(t,e,n,o,i){let s=[...e?[{definition:J(t,e),role:"target"}]:[],...[...o.candidates.map(u=>u.candidate),...i].map(u=>({definition:J(t,u.symbolB),role:"reuse-candidate"}))],r=de(t,s),c=Ce(n),l=[...[...r.values()].filter(u=>u.role==="target"),...c.values(),...[...r.values()].filter(u=>u.role==="reuse-candidate")],m=Re(l);return{slices:m,candidateSlices:l.length,omittedSlices:Math.max(0,l.length-m.length),maxSlices:ee,maxLinesPerSlice:L,maxTotalLines:oe,targetLineLimit:L,consumerContextLines:te,reuseLineLimit:ne}}function de(t,e){let n=new Map;for(let o of Z(e)){if(n.has(o.definition.symbol))continue;let i=pe(t,o);i&&n.set(o.definition.symbol,i)}return n}function pe(t,e){let n=e.role==="target"?L:ne,o=e.definition.endLine<=e.definition.startLine?j(t,e.definition.relativePath,e.definition.startLine,n):null,i=o?.unitType?o.source:G(t,e.definition);if(!i)return null;let s=i.split(`
|
|
2
|
+
`),r=Math.min(s.length,n),c=o?.unitType?o.startLine:e.definition.startLine;return{role:e.role,symbol:e.definition.symbol,shortName:C(e.definition.symbol),file:e.definition.relativePath,startLine:c,endLine:c+r-1,source:s.slice(0,r).join(`
|
|
3
|
+
`),omittedLines:(o?.unitType?o.omittedLines:0)+Math.max(0,s.length-r)}}function ye(t){return t.source!==void 0&&t.source!==null&&t.sourceStartLine!==void 0&&t.sourceStartLine!==null&&t.sourceEndLine!==void 0&&t.sourceEndLine!==null}function Ce(t){let e=new Map;for(let n of t.referencedBy){if(!ye(n))continue;let o=`${n.relativePath}:${n.sourceStartLine}-${n.sourceEndLine}`,i=e.get(o);if(i){i.focusLines=[...new Set([...i.focusLines??[],n.line])].sort((s,r)=>s-r);continue}e.set(o,{role:"consumer",symbol:n.enclosingSymbol??`${n.relativePath}:${n.line}`,shortName:n.enclosingShort,file:n.relativePath,startLine:n.sourceStartLine,endLine:n.sourceEndLine,source:n.source,omittedLines:0,focusLines:[n.line]})}return e}function Re(t){let e=[],n=oe;for(let o of t){if(e.length>=ee||n<=0)break;let i=o.source.split(`
|
|
4
|
+
`),s=Math.min(i.length,n);e.push({...o,endLine:o.startLine+s-1,source:i.slice(0,s).join(`
|
|
5
|
+
`),omittedLines:o.omittedLines+Math.max(0,i.length-s),...o.focusLines?{focusLines:o.focusLines.filter(r=>r<=o.startLine+s-1)}:{}}),n-=s}return e}function J(t,e){let n=N(t,e);return n?x(t,n.relativePath).find(o=>o.symbol===e)??null:null}function Se(t,e,n,o={}){let i=R(o.consumerLimit,V),s=R(o.perConsumerSearchLimit,S),r=R(o.perConsumerCandidateLimit,E),c=R(o.candidateLimit,v),l=he(t),m=l.slice(0,i),u=new Set(l.map(d=>d.symbol));e&&u.add(e);let p=new Map;for(let d of m)be(d,n,u,p,s,r);let a=[...p.values()].filter(d=>d.candidate.actionTier==="direct"||d.candidate.similarity>=se||d.consumers.length>1).sort(ge).slice(0,c);return{candidates:a,coverage:{totalConsumers:l.length,analyzedConsumers:m.length,omittedConsumers:Math.max(0,l.length-m.length),perConsumerSearchLimit:s,perConsumerCandidateLimit:r,candidateLimit:c,returnedCandidates:a.length}}}function be(t,e,n,o,i,s){let r=e(t.symbol).slice(0,i),c=0;for(let l of r){let m=xe(l,t.symbol);if(!m||n.has(m.symbolB))continue;let u=o.get(m.symbolB);if(u?(u.consumers.some(p=>p.symbol===t.symbol)||u.consumers.push(t),m.similarity>u.candidate.similarity&&(u.candidate=m)):o.set(m.symbolB,{candidate:m,consumers:[t]}),c+=1,c>=s)break}}function he(t){let e=new Map;for(let n of t.referencedBy){if(!n.enclosingSymbol)continue;let o=e.get(n.enclosingSymbol);if(o){o.referenceCount+=1;continue}e.set(n.enclosingSymbol,{symbol:n.enclosingSymbol,shortName:C(n.enclosingSymbol)||n.enclosingShort,file:n.relativePath,referenceCount:1})}return[...e.values()].sort((n,o)=>o.referenceCount-n.referenceCount||n.symbol.localeCompare(o.symbol))}function xe(t,e){return t.symbolA===e?t:t.symbolB!==e?null:{...t,symbolA:t.symbolB,shortNameA:t.shortNameB,fileA:t.fileB,symbolB:t.symbolA,shortNameB:t.shortNameA,fileB:t.fileA,uniqueToA:t.uniqueToB,uniqueToB:t.uniqueToA}}function ge(t,e){let n=Q(e.candidate.actionTier)-Q(t.candidate.actionTier);if(n!==0)return n;let o=e.consumers.length-t.consumers.length;if(o!==0)return o;let i=e.candidate.similarity-t.candidate.similarity;return i!==0?i:t.candidate.symbolB.localeCompare(e.candidate.symbolB)}function Q(t){return t==="direct"?1:0}function R(t,e){return typeof t=="number"&&Number.isFinite(t)?Math.max(1,Math.floor(t)):e}function Le(){return{candidates:[],coverage:{totalConsumers:0,analyzedConsumers:0,omittedConsumers:0,perConsumerSearchLimit:S,perConsumerCandidateLimit:E,candidateLimit:v,returnedCandidates:0}}}function f(t,e,n,o=()=>({})){let i;return M(`context.${t}`,()=>(i=n(),i),()=>({target:e,...o(i)}))}function Ee(t,e,n){let o={available:!1,file:e,churn:null,coChangePartners:[],suppressionsInFile:0};if(!e)return o;let i=U(t,n?{head:n}:{}),s=f("history.churn",e,()=>i.fileChurn(),l=>({files:l?.size??0}));if(!s)return o;let r=f("history.co-change",e,()=>$(t,e,{limit:5,...n?{head:n}:{}}),l=>({commits:l.commitsAnalyzed,partners:l.findings.length})),c=f("history.suppressions",e,()=>q(t).byFile.get(e)??0,l=>({suppressions:l}));return{available:!0,file:e,churn:s.get(e)??{changes:0,fixChanges:0,lastChangedAt:0},coChangePartners:r.findings.map(l=>({file:l.fileA===e?l.fileB:l.fileA,together:l.together,confidence:l.confidence,subjectContext:l.subjectContext})),suppressionsInFile:c}}function ve(t){return t.includes("/")||t.includes("\\")||/\.[A-Za-z0-9]+(?::\d+(?:-\d+)?)?$/.test(t)}export{Xe as a,Se as b};
|
|
6
|
+
//# sourceMappingURL=chunk-6YMNWD3H.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{createHash as b}from"crypto";import{ts as i}from"@ts-morph/common";function S(e){return"elements"in e?e.elements.flatMap(t=>"name"in t?S(t.name):[]):[e.text]}var w="typescript-function-local-v1";function g(e){return b("sha256").update(e).digest("hex")}function K(e,t){let{sourceFile:n,checker:r,errors:c}=I(e,t),u=[];function l(o,m){if(d(o)){let a=v(o,n),p=[...m,a];u.push(N(o,n,p.join("."),r)),i.forEachChild(o,f=>l(f,p));return}let s=(i.isClassDeclaration(o)||i.isClassExpression(o))&&o.name?o.name.text:i.isVariableDeclaration(o)&&o.initializer&&!d(o.initializer)||i.isModuleDeclaration(o)?o.name.getText(n):null;i.forEachChild(o,a=>l(a,s?[...m,s]:m))}return c.length===0&&l(n,[]),{sourceFile:n,checker:r,functions:u,exports:c.length?[]:C(n),errors:c}}function C(e){let t=[];for(let n of e.statements){let r=k(n,e);r&&t.push({file:e.fileName,startLine:e.getLineAndCharacterOfPosition(n.getStart(e)).line+1,endLine:e.getLineAndCharacterOfPosition(n.getEnd()-1).line+1,names:r,syntax:i.isVariableStatement(n)?"VariableStatement":i.SyntaxKind[n.kind],...i.isExportDeclaration(n)&&n.moduleSpecifier?{from:i.isStringLiteralLike(n.moduleSpecifier)?n.moduleSpecifier.text:n.moduleSpecifier.getText(e)}:{}})}return t}function k(e,t){if(i.isExportDeclaration(e)){let n=e.exportClause;return n?i.isNamedExports(n)?n.elements.map(r=>r.name.text):[n.name.text]:["*"]}return i.isExportAssignment(e)?[e.isExportEquals?"export=":"default"]:F(e,t)}function F(e,t){let n=i.canHaveModifiers(e)?i.getModifiers(e):void 0;if(n?.some(r=>r.kind===i.SyntaxKind.ExportKeyword))return n.some(r=>r.kind===i.SyntaxKind.DefaultKeyword)?["default"]:i.isVariableStatement(e)?e.declarationList.declarations.flatMap(r=>S(r.name)):"name"in e&&e.name?[e.name.getText(t)]:[]}function d(e){return i.isFunctionLike(e)&&"body"in e&&!!e.body}function v(e,t){if(i.isConstructorDeclaration(e))return"constructor";if(i.isGetAccessor(e))return`get ${e.name.getText(t)}`;if(i.isSetAccessor(e))return`set ${e.name.getText(t)}`;if(e.name)return e.name.getText(t);let n=e.parent;if(i.isVariableDeclaration(n)||i.isPropertyAssignment(n)||i.isPropertyDeclaration(n))return n.name.getText(t);if(i.isCallExpression(n))return`<callback:${n.expression.getText(t)}:${n.arguments.indexOf(e)}>`;let r=t.getLineAndCharacterOfPosition(e.getStart(t));return`<anonymous@${r.line+1}:${r.character+1}>`}function N(e,t,n,r){let c=new h(t);c.visit(e.body,0);let u=c.contributions,l=e.getStart(t),o=e.getEnd(),m=D(e,t,r);return{name:n,file:t.fileName,startLine:t.getLineAndCharacterOfPosition(l).line+1,endLine:t.getLineAndCharacterOfPosition(o-1).line+1,startOffset:l,endOffset:o,sourceHash:g(t.text.slice(l,o)),bodyHash:g(m.exact.join(`
|
|
2
|
+
`)),renamedBodyHash:g(m.renamed.join(`
|
|
3
|
+
`)),tokenCount:m.exact.length,cyclomatic:1+u.reduce((s,a)=>s+a.cyclomatic,0),cognitive:u.reduce((s,a)=>s+a.cognitive,0),contributions:u}}var h=class{constructor(t){this.file=t}file;contributions=[];visit(t,n){if(!d(t)){if(i.isIfStatement(t)){this.visitIf(t,n);return}if(T(t)||i.isCatchClause(t)||i.isConditionalExpression(t)){this.add(t,i.SyntaxKind[t.kind],1,n+1),i.forEachChild(t,r=>this.visit(r,n+1));return}if(i.isSwitchStatement(t)){this.add(t,"switch",0,n+1),this.visit(t.expression,n),this.visit(t.caseBlock,n+1);return}i.isCaseClause(t)&&this.add(t,"case",1,0),this.recordLogicalOperator(t),this.recordLabeledJump(t),i.forEachChild(t,r=>this.visit(r,n))}}visitIf(t,n){let r=i.isIfStatement(t.parent)&&t.parent.elseStatement===t;this.add(t,r?"else-if":"if",1,r?1:n+1),this.visit(t.expression,n),this.visit(t.thenStatement,n+1),t.elseStatement&&(i.isIfStatement(t.elseStatement)||this.add(t.elseStatement,"else",0,1),this.visit(t.elseStatement,i.isIfStatement(t.elseStatement)?n:n+1))}recordLogicalOperator(t){if(!i.isBinaryExpression(t)||!E(t.operatorToken.kind))return;let n=t.operatorToken.kind,r=L(t),c=i.isBinaryExpression(r)&&r.operatorToken.kind===n;this.add(t.operatorToken,i.tokenToString(n)??"logical",1,n===i.SyntaxKind.QuestionQuestionToken||c?0:1)}recordLabeledJump(t){(i.isBreakStatement(t)||i.isContinueStatement(t))&&t.label&&this.add(t,"labeled-jump",0,1)}add(t,n,r,c){let u=this.file.getLineAndCharacterOfPosition(t.getStart(this.file));this.contributions.push({line:u.line+1,column:u.character+1,kind:n,cyclomatic:r,cognitive:c})}};function T(e){return i.isForStatement(e)||i.isForInStatement(e)||i.isForOfStatement(e)||i.isWhileStatement(e)||i.isDoStatement(e)}function E(e){return e===i.SyntaxKind.AmpersandAmpersandToken||e===i.SyntaxKind.BarBarToken||e===i.SyntaxKind.QuestionQuestionToken}function L(e){let t=e.parent;for(;i.isParenthesizedExpression(t);)t=t.parent;return t}function D(e,t,n){let r=new Map,c=s=>{if(i.isIdentifier(s)){let a=n.getSymbolAtLocation(s);a&&!r.has(a)&&r.set(a,`local:${r.size}`)}else for(let a of s.elements)i.isBindingElement(a)&&c(a.name)};for(let s of e.parameters)c(s.name);let u=s=>{d(s)||(i.isVariableDeclaration(s)&&c(s.name),i.forEachChild(s,u))};u(e.body);let l=[],o=[],m=s=>{let a=s.getChildren(t);if(a.length>0){for(let y of a)m(y);return}let p=s.getText(t);if(!p)return;l.push(`${s.kind}:${p}`);let f=i.isIdentifier(s)&&!A(s)?n.getSymbolAtLocation(s):void 0,x=f?r.get(f)??p:p;o.push(`${s.kind}:${x}`)};return m(e.body),{exact:l,renamed:o}}function A(e){let t=e.parent;return i.isShorthandPropertyAssignment(t)?!0:i.isBindingElement(t)?B(e,t):i.isPropertyAccessExpression(t)||i.isPropertyAssignment(t)||i.isMethodDeclaration(t)?t.name===e:!1}function B(e,t){return t.propertyName?t.propertyName===e:t.name===e&&!t.dotDotDotToken&&i.isObjectBindingPattern(t.parent)}function I(e,t){let n=i.createSourceFile(e,t,i.ScriptTarget.Latest,!0),c=(n.parseDiagnostics??[]).map(l=>{let o=n.getLineAndCharacterOfPosition(l.start??0).line+1;return`${e}:${o}: ${i.flattenDiagnosticMessageText(l.messageText," ")}`}),u;return{sourceFile:n,get checker(){return u??=P(n)},errors:c}}function P(e){let t=r=>r===e.fileName||r==="/"+e.fileName,n={getSourceFile:r=>t(r)?e:void 0,getDefaultLibFileName:()=>"",writeFile:()=>{},getCurrentDirectory:()=>"/",getDirectories:()=>[],fileExists:t,readFile:r=>t(r)?e.text:void 0,useCaseSensitiveFileNames:()=>!0,getCanonicalFileName:r=>r,getNewLine:()=>`
|
|
4
|
+
`};return i.createProgram([e.fileName],{noLib:!0,noResolve:!0,allowJs:!0,target:i.ScriptTarget.Latest},n).getTypeChecker()}export{S as a,w as b,g as c,K as d,I as e};
|
|
5
|
+
//# sourceMappingURL=chunk-72AD6ZRR.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{b as H,d as W}from"./chunk-KZBJWZJB.js";import{a as q,b as Se,e as Re,h as Q,k as De,m as ke,p as re}from"./chunk-DA7RPPDF.js";import{b as $}from"./chunk-GCKCF5FL.js";import{M as Ee,a as Ae}from"./chunk-FVULPZDF.js";import{g as Be,i as Te}from"./chunk-D3FDISIC.js";import{c as te,t as ne}from"./chunk-GVWX5T43.js";import{a as D,b as ye,d as a,e as k,f as be,h as S,j as he,m as xe}from"./chunk-T6DK3ZP7.js";import{$ as ee,Aa as ve,D as Ie,Da as Pe,E as C,F as Z,g as fe,i as ge,ma as we,na as Fe,s as Me,v as R}from"./chunk-5TNQJUR2.js";import{execFileSync as Ne}from"child_process";import{createHash as ut}from"crypto";import{existsSync as L,statSync as mt}from"fs";import{createRequire as pt}from"module";import{platform as ft}from"os";import{dirname as Ce,join as F}from"path";var gt=pt(import.meta.url),qn={language:"rust",indexerBinary:"rust-analyzer",installUrl:"https://github.com/rust-lang/rust-analyzer"};function ie(e){return[e.indexerBinary,...e.binaryAliases??[]]}function yt(e){let t=ie(e);return t.length===1?t[0]:t.join(" or ")}function oe(e){if(e.bundledNpmPackage==="@sourcegraph/scip-typescript"){let t=Le(e);if(t)return t}for(let t of ie(e)){let n=ke(t);if(n)return n}return Le(e)}function $n(e){return oe(e)!==null||bt(e)}function bt(e){return je(e)!==null}function Le(e){let t=je(e);if(!t)return null;if(e.bundledNpmPackage==="@sourcegraph/scip-typescript"){if(!ee)return null;let i=F(ee,"dist","typescript-indexer.js");return L(i)?i:null}let r=JSON.parse(R(t,"indexer package manifest")).bin;if(!r)return null;if(typeof r=="string")return F(Ce(t),r);for(let i of ie(e)){let o=r[i];if(o)return F(Ce(t),o)}return null}function je(e){if(!e.bundledNpmPackage)return null;try{return gt.resolve(`${e.bundledNpmPackage}/package.json`)}catch{return null}}function ht(e,t){for(let n of e.projectLocalBinaries??[]){let r=F(t,n);if(L(r))return r}return null}function xt(e,t){for(let n of e.projectLocalBinaries??[]){let r=F(t,n);if(L(r))return Oe(t,n,r)}return null}function Hn(e,t){let n=St(e,t);if(!n||n.canonicalPath!==t.canonicalPath||n.sha256!==t.sha256||n.size!==t.size||n.mtimeMs!==t.mtimeMs||n.device!==t.device||n.inode!==t.inode||n.executable!==t.executable)throw new Error(`refusing changed project-local indexer ${t.relativePath}; review the current file and rerun with --trust-project-tools`)}function St(e,t){try{return Oe(e,t.relativePath,t.configuredPath)}catch{return null}}function Oe(e,t,n){let r={maxBytes:268435456,inputKind:"project-local indexer"},i=we(e,t,r),o=Fe(e,t,r),s=mt(i.absolutePath);return{configuredPath:n,canonicalPath:i.absolutePath,relativePath:t,sha256:ut("sha256").update(o).digest("hex"),size:i.size,mtimeMs:i.mtimeMs,device:i.device,inode:i.inode,executable:(s.mode&73)!==0}}function Mt(e,t,n={}){return(n.trustProjectTools?xt(e,t)?.canonicalPath:null)??oe(e)}function Wn(e,t=process.env,n=e.indexerBinary){if(e.indexerBinary!=="scip-dotnet"||se(n,t))return t;let r=_e(n,t);return r?{...t,DOTNET_ROOT:r}:t}function Jn(e,t,n={}){let r=yt(e),i=t?Mt(e,t,n):oe(e);if(!i)return{language:e.language,binaryLabel:r,installed:!1,runnable:!1,resolvedBinary:null,installUrl:e.installUrl,...t&&ht(e,t)?{note:"project-local indexer available only with --trust-project-tools"}:{}};if(e.indexerBinary!=="scip-dotnet")return{language:e.language,binaryLabel:r,installed:!0,runnable:!0,resolvedBinary:i};let o=Rt(i);return{language:e.language,binaryLabel:r,installed:!0,runnable:o.runnable,resolvedBinary:i,installUrl:e.installUrl,note:o.note}}function Rt(e){if(se(e,process.env))return{runnable:!0};let t=_e(e,process.env);if(t)return{runnable:!0,note:`using .NET 9 runtime from ${t}`};let n=qe(process.env);return{runnable:!1,note:n.length>0?`.NET 9 runtime still unavailable after checking ${n.join(", ")}`:"binary is present, but scip-dotnet still needs a .NET 9 runtime"}}function _e(e,t){for(let n of qe(t))if(se(e,{...t,DOTNET_ROOT:n}))return n;return null}function qe(e){let t=[],n=e.DOTNET_ROOT;if(n&&L(n)&&t.push(n),ft()==="darwin"&&De("brew"))try{let r=Ne("brew",["--prefix","dotnet@9"],{stdio:"pipe",env:e,timeout:1e4,killSignal:"SIGKILL"}).toString().trim(),i=F(r,"libexec");L(i)&&!t.includes(i)&&t.push(i)}catch{}return t}function se(e,t){try{return Ne(e,["--version"],{stdio:"pipe",env:t,timeout:1e4,killSignal:"SIGKILL"}),!0}catch{return!1}}import{getHeapStatistics as Bt}from"v8";function z(e){let t=J(e.projectFiles),n=new Set(t),r=new Map(e.snapshot.files.map(u=>[u.path,u])),i=e.snapshot.files.filter(u=>{let f=fe(u.path,["typescript"]);return f==="config"||f==="ambient"}).map(u=>u.path),o=J([...t,...i]),s=o.find(u=>!r.has(u)),c=new Set(e.snapshot.files.map(u=>u.path)).size!==e.snapshot.files.length,d=!s&&o.some(u=>$e(r.get(u))),p=te(JSON.stringify({pnpmWorkspaces:e.snapshot.pnpmWorkspaces,typescriptProjectMode:e.snapshot.typescriptProjectMode,typescriptProjects:J(e.snapshot.typescriptProjects),membership:t})),y,m;return{identityFor(u,f){if(!n.has(u))return v("target-outside-project");if(c)return v("duplicate-input-path");if(s)return v("missing-input-fingerprint");if(d)return v("unreadable-input");let I=[],M,X;if(e.graph===null)I.push("dependency-graph-unavailable"),X="whole-project",M=o;else{let E=u===y&&m?m:It(u,e.graph);if(y=u,m=E,E.find(Y=>!r.has(Y)))return v("missing-input-fingerprint");if(M=J([...E,...i]),M.some(Y=>$e(r.get(Y))))return v("unreadable-input");X="dependency-closure"}let dt=M.map(E=>wt(r.get(E)));return{version:1,key:te(JSON.stringify({version:1,engineIdentity:e.engineIdentity,schemaVersion:f,projectIdentity:p,inputs:dt})),mode:X,inputFiles:M,reasons:I}}}}function It(e,t){let n=new Set,r=[e];for(let i=0;i<r.length;i+=1){let o=r[i];if(!(o===void 0||n.has(o))){n.add(o);for(let s of[...t.get(o)??[]].sort())n.has(s)||r.push(s)}}return[...n].sort()}function wt(e){return e.semanticHash===void 0?{path:e.path,size:e.size,hash:e.hash}:{path:e.path,semanticHash:e.semanticHash}}function $e(e){return e.size<0||e.hash==="unreadable"}function v(e){return{version:1,key:null,mode:"unkeyed",inputFiles:[],reasons:[e]}}function J(e){return[...new Set(e)].sort()}var Ft=Pe("typescript-semantic-identity-context",{clearGroups:["whole-project"]});function U(e,t,n){let r=Ft.get(e,()=>vt(e));if(!r)return null;let i=`${n}\0${t}`,o=r.identities.get(i);if(o)return o;let s=r.builder.identityFor(t,n);return r.identities.set(i,s),s}function P(e){return Ae(e,{includeIgnored:!1}).filter(H).sort()}function vt(e){try{if(!e.generation.metadataRaw)return null;let t=xe(e.generation.metadataRaw);if(t.kind!=="legacy"&&t.kind!=="supported"||!t.capabilities.usableForEvidenceCache)return null;let n=ge(t.metadata.fingerprint);return n?{builder:z({projectFiles:P(e),snapshot:n,graph:$(e),engineIdentity:W()}),identities:new Map}:null}catch{return null}}function Je(e,t){let n=ae(e);for(let r of t.values())n.add(r);return n.finish()}function ae(e){let t=new Map(e.map(r=>[r.symbol,r])),n=new Map(e.map(r=>[r.symbolId,[]]));return{add(r){for(let i of r){let o=t.get(i.targetSymbol);o&&n.get(o.symbolId).push(i.location)}},finish(){for(let[r,i]of n)n.set(r,Pt(i));return n}}}function ze(e,t,n){let r=We(e,t),i=We(e,n),o=[...r].filter(m=>!i.has(m)).sort(),s=[...i].filter(m=>!r.has(m)).sort(),c=He(e,t),d=He(e,n),p=[...c].filter(m=>!d.has(m)).sort(),y=[...d].filter(m=>!c.has(m)).sort();return{passed:o.length===0&&s.length===0,expectedCount:r.size,actualCount:i.size,missing:o,extra:s,callerFiles:{passed:p.length===0&&y.length===0,expectedCount:c.size,actualCount:d.size,missing:p,extra:y}}}function He(e,t){let n=new Set;for(let r of e)for(let i of t.get(r.symbolId)??[])i.file!==r.relativePath&&n.add(`${r.symbol}\0${i.file}`);return n}function ir(e,t,n){let r=new Set(n),i=new Map(n.map(o=>[o,[]]));for(let o of e)for(let s of t.get(o.symbolId)??[])r.has(s.file)&&i.get(s.file).push({targetSymbol:o.symbol,location:s});for(let[o,s]of i)i.set(o,At(s));return i}function We(e,t){let n=new Set;for(let r of e)for(let i of t.get(r.symbolId)??[])n.add(`${r.symbol}\0${i.file}\0${i.line}\0${i.column}`);return n}function Pt(e){let t=new Map;for(let n of e)t.set(`${n.file}\0${n.line}\0${n.column}`,n);return[...t.values()].sort(Ue)}function At(e){let t=new Map;for(let n of e){let{location:r}=n;t.set(`${n.targetSymbol}\0${r.file}\0${r.line}\0${r.column}`,n)}return[...t.values()].sort((n,r)=>n.targetSymbol.localeCompare(r.targetSymbol)||Ue(n.location,r.location))}function Ue(e,t){return e.file.localeCompare(t.file)||e.line-t.line||e.column-t.column}var V="typescript-reference-fragment-v2",Ve=128,j=Be({kind:"typescript-reference-fragments",invalidation:Te("typescript-reference-fragments"),serialize:e=>JSON.stringify(e),deserialize:Nt});function hr(e,t,n,r=e,i,o=new Set(n.keys())){let s=P(e),c=z({projectFiles:s,snapshot:t,graph:i??$(e),engineIdentity:W()}),d=[],p=0;for(let[m,u]of n){let f=c.identityFor(m,V).key;if(!f){p+=1;continue}d.push({relativePath:m,contentHash:f,value:[...u]})}let y=s.filter(m=>!o.has(m)&&!n.has(m)).length;return j.writeBatch(r,d),{affectedFiles:d.length,carriedFiles:y,skippedAffectedFiles:p}}function xr(e,t,n,r){let i=t.filter(s=>H(s.relativePath));if(i.length===0)return N("no TypeScript definitions");let o=N("shadow did not run");return ne("typescript.reference-fragments.shadow",()=>{try{let s=r(i[0].relativePath);if(!s.availability().available||!s.referenceFragmentsForFiles)return o=N("TypeScript reference fragment provider is unavailable"),o;let c=P(e),d=new Set(c),p=new Map;for(let f of Ke(c)){let I=s.referenceFragmentsForFiles(f);if(f.some(M=>!I.has(M)))return o=N("TypeScript reference fragment provider returned an incomplete batch"),o;for(let M of f)p.set(M,I.get(M)??[])}let y=Je(i,p),m=ze(i,Tt(n,d),y);if(!m.passed)return o={state:"failing",files:c.length,keyedFiles:0,writtenFiles:0,...m},o;let u=Ot(e,c,p);return j.writeBatch(e,u),o={state:"passing",files:c.length,keyedFiles:u.length,writtenFiles:u.length,...m},o}catch(s){return o=N(s instanceof Error?s.message:String(s)),o}},()=>({...o}))}function Tt(e,t){return new Map([...e].map(([n,r])=>[n,r.filter(i=>t.has(i.file))]))}function Sr(e,t,n){if(t.length===0)return{references:new Map,files:0,cacheHits:0,cacheMisses:0,computedFiles:0};let r="fallback",i=0,o=0,s=0,c=0;return ne("typescript.reference-fragments.materialize",()=>{try{let d=P(e);i=d.length;let p=ae(t),y=[];for(let u of d){let f=U(e,u,V);if(!f?.key)return null;let I=j.read(e,u,f.key);I===null?(s+=1,y.push({file:u,contentHash:f.key})):(o+=1,p.add(I))}return s===0?(r="hit",{references:p.finish(),files:i,cacheHits:o,cacheMisses:s,computedFiles:c}):Ct(e,y,n,u=>{for(let{fragments:f}of u)p.add(f);c+=u.length})?(r="computed",{references:p.finish(),files:i,cacheHits:o,cacheMisses:s,computedFiles:c}):null}catch{return null}},()=>({state:r,files:i,cacheHits:o,cacheMisses:s,computedFiles:c}))}function Ke(e){let t=[];for(let n=0;n<e.length;n+=Ve)t.push(e.slice(n,n+Ve));return t}var Et=.75;function Dt(e){return{heapUsedFraction:()=>{let t=Bt();return t.heap_size_limit>0?t.used_heap_size/t.heap_size_limit:0},collect:Ee,release:()=>ve(e,{groups:["semantic-provider"]})}}function kt(e,t=Et){return e.heapUsedFraction()<t||e.collect()&&e.heapUsedFraction()<t?!1:(e.release(),!0)}function Ct(e,t,n,r,i=Dt(e)){for(let o of Ke(t)){let s=Lt(e,o,n);if(!s)return!1;r(s),kt(i)}return!0}function Lt(e,t,n){let r=t.map(({file:s})=>s),i=n(r[0]);if(!i.availability().available||!i.referenceFragmentsForFiles)return null;let o=i.referenceFragmentsForFiles(r);return r.some(s=>!o.has(s))?null:(j.writeBatch(e,t.map(({file:s,contentHash:c})=>({relativePath:s,contentHash:c,value:o.get(s)??[]}))),r.map(s=>({file:s,fragments:o.get(s)??[]})))}function Mr(e){let t=P(e),n=0;for(let r of t){let i=U(e,r,V);if(!i?.key)return null;j.has(e,r,i.key)||(n+=1)}return{files:t.length,missing:n}}function N(e){return{state:"unavailable",files:0,keyedFiles:0,writtenFiles:0,expectedCount:0,actualCount:0,missing:[],extra:[],reason:e}}function Nt(e){try{let t=JSON.parse(e);return!Array.isArray(t)||!t.every(jt)?null:t}catch{return null}}function jt(e){if(!e||typeof e!="object")return!1;let t=e,n=t.location;return typeof t.targetSymbol=="string"&&!!n&&typeof n.file=="string"&&typeof n.line=="number"&&typeof n.column=="number"}function Ot(e,t,n){let r=[];for(let i of t){let o=U(e,i,V);o?.key&&r.push({relativePath:i,contentHash:o.key,value:n.get(i)??[]})}return r}import{createHash as qt,randomUUID as Qe}from"crypto";import{closeSync as Pr,existsSync as T,fstatSync as Ar,lstatSync as _,mkdirSync as Br,openSync as Tr,readdirSync as B,readSync as Er,renameSync as et,rmSync as w}from"fs";import{basename as K,dirname as $t,join as g}from"path";function Ge(e){return ce(e,_t)}function ce(e,t){return Array.isArray(e)?`[${e.map(n=>ce(n,t)).join(",")}]`:e&&typeof e=="object"?`{${Object.entries(e).sort(([n],[r])=>t(n,r)).map(([n,r])=>`${JSON.stringify(n)}:${ce(r,t)}`).join(",")}}`:JSON.stringify(e)}function _t(e,t){return e.localeCompare(t)}var Ht=1,Wt=Object.freeze({maxItems:1024,maxBytes:512*1024*1024,maxItemBytes:64*1024*1024,maxBatch:16,claimLeaseMs:5*6e4,responseRetentionMs:10*6e4,deadLetterRetentionMs:1440*6e4,temporaryRetentionMs:6e4,cleanupBatch:64}),A=class extends Error{constructor(n,r,i,o){let s=n==="item-too-large"?`request is ${o} bytes; per-item limit is ${i.maxItemBytes}`:n==="item-capacity"?`mailbox has ${r.totalItems} retained items; limit is ${i.maxItems}`:n==="byte-capacity"?`mailbox retains ${r.totalBytes} bytes and the request adds ${o}; limit is ${i.maxBytes}`:"another writer held the admission coordinator through the bounded wait";super(`Mailbox backpressure: ${s}. Retry after the service drains or expires retained work.`);this.code=n;this.status=r;this.limits=i;this.attemptedBytes=o;this.name="MailboxBackpressureError"}code;status;limits;attemptedBytes},Jt=".owner.json",zt={isProcessAlive:()=>!0,readProcessIdentity:()=>null};function Or(e){return{rootDir:e,pendingDir:g(e,"pending"),inflightDir:g(e,"inflight"),responseDir:g(e,"responses"),deadLetterDir:g(e,"dead-letter"),legacyRequestDir:g(e,"requests")}}function Ut(e={}){let t={...Wt,...e};for(let[n,r]of Object.entries(t))if(!Number.isFinite(r)||r<=0||!Number.isInteger(r))throw new Error(`Mailbox limit ${n} must be a positive integer.`);return t}function tt(e){let t=[e.pendingDir,e.inflightDir,e.responseDir,e.deadLetterDir,e.legacyRequestDir].map(n=>Ie(n));return Z(...t)}function _r(e,t){return qt("sha256").update(Ge({namespace:e,payload:t})).digest("hex")}function nt(e){if(!/^[a-f0-9]{64}$/.test(e))throw new Error("Mailbox operation keys must be lowercase SHA-256 identities.");return`op-${e}`}function qr(e,t,n={}){let r=Ut(n.limits),i=n.nowMs??Date.now(),o=tt(e);return on(t),Zt(e,r,n.admissionLockTimeoutMs??2e3,n.monotonicNow??Re,n.durability??"durable",()=>{Yt(e,i,r);let s=g(e.pendingDir,`${t.id}.json`),c=g(e.responseDir,`${t.id}.json`),d=Xe(e,t.id);if(d){let m=Ye(d,t.operationKey,t.id);return{disposition:"duplicate",requestId:t.id,responsePath:c,authoritativeDeadlineAtMs:m.deadlineAtMs??t.deadlineAtMs}}let p=`${JSON.stringify(t)}
|
|
2
|
+
`,y=Buffer.byteLength(p);mn(e,y,r),n.onBeforePublish?.();try{let m=n.durability??"durable",u=Q(s,p,{durability:m}),f=m==="durable"?Z(o,u.directorySync):"not-requested";return{disposition:"accepted",requestId:t.id,responsePath:c,authoritativeDeadlineAtMs:t.deadlineAtMs,achievedDurability:u.achievedDurability,directorySync:f}}catch(m){if(m.code!=="EEXIST")throw m;let u=Xe(e,t.id);if(!u)throw m;let f=Ye(u,t.operationKey,t.id);return{disposition:"duplicate",requestId:t.id,responsePath:c,authoritativeDeadlineAtMs:f.deadlineAtMs??t.deadlineAtMs}}})}function Vt(e,t,n,r,i){let o=g(e.responseDir,`${t.requestId}.json`);if(T(o))return w(t.path,{force:!0}),i.completedClaimsRemoved++,!0;if(t.claimExpiresAtMs>n||nn(e,t.ownerId,r)!=="dead")return!1;let s=g(e.pendingDir,t.originalFile);try{et(t.path,s),i.reclaimed++}catch(c){if(c.code!=="EEXIST")throw c;w(t.path,{force:!0})}return C($t(t.path)),C(e.pendingDir),!0}function Kt(e,t,n,r,i){for(let o of de(e.inflightDir)){if(n<=0)break;Vt(e,o,t,r,i)&&n--}return n}function Gt(e,t,n){if(!K(e).includes(".tmp-"))return!1;let r;try{r=_(e).mtimeMs}catch(i){if(i.code==="ENOENT")return!1;throw i}return r+n>t?!1:(w(e,{force:!0}),!0)}function Xt(e,t,n,r,i){for(let o of[e.pendingDir,e.inflightDir,e.responseDir,e.deadLetterDir,e.legacyRequestDir]){if(r<=0)break;for(let s of it(o)){if(r<=0)break;Gt(s,t,n.temporaryRetentionMs)&&(i.temporaryFilesRemoved++,r--)}}}function Yt(e,t,n,r=zt){let i={reclaimed:0,completedClaimsRemoved:0,responsesRemoved:0,deadLettersRemoved:0,temporaryFilesRemoved:0},o=n.cleanupBatch;return o=Kt(e,t,o,r,i),o=Ze(e.responseDir,o,(s,c)=>c+n.responseRetentionMs,t,()=>{i.responsesRemoved++}),o=Ze(e.deadLetterDir,o,(s,c)=>c+n.deadLetterRetentionMs,t,()=>{i.deadLettersRemoved++}),Xt(e,t,n,o,i),ln(e.inflightDir),i}function rt(e){tt(e);let t=[...O(e.pendingDir).map(d=>({path:d,pending:!0})),...O(e.legacyRequestDir).map(d=>({path:d,pending:!0}))],n=de(e.inflightDir).map(d=>({path:d.path,pending:!1})),r=O(e.responseDir).map(d=>({path:d,pending:!1})),i=O(e.deadLetterDir).map(d=>({path:d,pending:!1})),o=[...t,...n,...r,...i],s=0,c;for(let d of t){let p=ue(d.path);if(!p){s++;continue}let y=p.enqueuedAtMs;if(y===void 0)try{y=_(d.path).mtimeMs}catch(m){if(m.code==="ENOENT")continue;throw m}c=c===void 0?y:Math.min(c,y)}return{pending:t.length,inflight:n.length,responses:r.length,deadLetters:i.length,invalid:s,totalItems:o.length,totalBytes:o.reduce((d,p)=>d+dn(p.path),0),...c===void 0?{}:{oldestPendingAt:new Date(c).toISOString()}}}function Zt(e,t,n,r,i,o){let s=g(e.rootDir,".admission.lock"),c=`${process.pid}-${Qe()}`,d=r()+Math.max(0,n);for(;!Qt(e.rootDir,s,c,i);){if(en(s),r()>=d)throw new A("admission-busy",rt(e),t,0);Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,5)}try{return o()}finally{try{le(s).ownerToken===c&&(w(s,{recursive:!0,force:!0}),i==="durable"&&C(e.rootDir))}catch{}}}function Qt(e,t,n,r){let i=`${JSON.stringify({ownerToken:n,pid:process.pid,acquiredAtMs:Date.now()})}
|
|
3
|
+
`;try{return Q(t,i,{durability:r}),!0}catch(o){if(o.code==="EEXIST")return!1;try{le(t).ownerToken===n&&(w(t,{force:!0}),r==="durable"&&C(e))}catch{}throw o}}function en(e){let t=null;try{let r=le(e);typeof r.ownerToken=="string"&&Number.isSafeInteger(r.pid)&&Number(r.pid)>0&&(t=Number(r.pid))}catch{}if(t===null||tn(t))return;let n=`${e}.stale-${Qe()}`;try{et(e,n)}catch(r){let i=r.code;if(i==="ENOENT"||i==="EEXIST")return;throw r}w(n,{recursive:!0,force:!0})}function le(e){try{return JSON.parse(R(e,"mailbox lock record"))}catch(t){if(t.code!=="EISDIR"&&!(t instanceof Me&&t.reason==="not-regular"))throw t;return JSON.parse(R(g(e,"owner.json"),"mailbox lock owner record"))}}function tn(e){try{return process.kill(e,0),!0}catch(t){let n=t.code;return n==="EPERM"||n!=="ESRCH"}}function nn(e,t,n){let r=rn(g(e.inflightDir,ot(t),Jt));if(!r)return"unknown";if(!n.isProcessAlive(r.pid))return"dead";if(!r.processIdentity)return"live";let i=n.readProcessIdentity(r.pid);return i?Se(r.processIdentity,i)?"live":"dead":"unknown"}function rn(e){try{let t=JSON.parse(R(e,"mailbox owner record"));if(!un(t))return null;let n=t.processIdentity===void 0?null:q(t.processIdentity);return t.processIdentity!==void 0&&(!n||n.pid!==t.pid)?null:{version:1,ownerId:t.ownerId,pid:t.pid,...n?{processIdentity:n}:{}}}catch{return null}}function Xe(e,t){for(let n of[g(e.pendingDir,`${t}.json`),g(e.legacyRequestDir,`${t}.json`),g(e.responseDir,`${t}.json`)])if(T(n))return n;for(let n of de(e.inflightDir))if(n.requestId===t)return n.path;return null}function Ye(e,t,n){let r=ue(e);if(r?.operationKey===t)return r;if(K(e)===`${nt(t)}.json`)return{id:n,operationKey:t};throw new Error(`Mailbox operation ${n} conflicts with an existing retained record.`)}function on(e){if(e.mailboxVersion!==Ht||e.id!==nt(e.operationKey)||!e.clientId.trim()||!Number.isFinite(e.enqueuedAtMs)||!Number.isFinite(e.deadlineAtMs)||e.deadlineAtMs<e.enqueuedAtMs)throw new Error("Mailbox request has an invalid lifecycle identity.")}function sn(e){let t=/^(.*)\.(\d+)\.claim$/.exec(e);if(!t)return null;let n=st(t[1]),r=Number(t[2]);return n===null||K(n)!==n||!n.endsWith(".json")||!Number.isSafeInteger(r)?null:{originalFile:n,claimExpiresAtMs:r}}function an(e,t,n){let r=sn(n);if(!r)return null;let{originalFile:i,claimExpiresAtMs:o}=r,s=g(e,n),c=ue(s)??{id:K(i,".json")},d;try{d=_(s)}catch(p){if(p.code==="ENOENT")return null;throw p}return{requestId:c.id,ownerId:t,path:s,originalFile:i,claimedAtMs:d.mtimeMs,claimExpiresAtMs:o,byteLength:d.size,...c.operationKey?{operationKey:c.operationKey}:{},...c.clientId?{clientId:c.clientId}:{},...c.enqueuedAtMs===void 0?{}:{enqueuedAtMs:c.enqueuedAtMs},...c.deadlineAtMs===void 0?{}:{deadlineAtMs:c.deadlineAtMs},legacy:c.operationKey===void 0}}function cn(e,t){let n=[];for(let r of B(e,{withFileTypes:!0})){if(!r.isFile()||!r.name.endsWith(".claim"))continue;let i=an(e,t,r.name);i&&n.push(i)}return n}function de(e){if(!T(e))return[];let t=[];for(let n of B(e,{withFileTypes:!0})){if(!n.isDirectory())continue;let r=st(n.name);r!==null&&t.push(...cn(g(e,n.name),r))}return t.sort((n,r)=>n.claimedAtMs-r.claimedAtMs||n.path.localeCompare(r.path))}function ue(e){try{let t=JSON.parse(R(e,"mailbox record"));return typeof t.id!="string"||!t.id?null:{id:t.id,...typeof t.operationKey=="string"?{operationKey:t.operationKey}:{},...typeof t.clientId=="string"?{clientId:t.clientId}:{},...typeof t.enqueuedAtMs=="number"?{enqueuedAtMs:t.enqueuedAtMs}:{},...typeof t.deadlineAtMs=="number"?{deadlineAtMs:t.deadlineAtMs}:{}}}catch{return null}}function Ze(e,t,n,r,i){for(let o of O(e)){if(t<=0)break;let s;try{s=_(o)}catch(c){if(c.code==="ENOENT")continue;throw c}n(o,s.mtimeMs)>r||(w(o,{force:!0}),i(),t--)}return t}function O(e){return T(e)?B(e,{withFileTypes:!0}).filter(t=>t.isFile()).map(t=>g(e,t.name)).sort():[]}function it(e){if(!T(e))return[];let t=[];for(let n of B(e,{withFileTypes:!0})){let r=g(e,n.name);n.isFile()?t.push(r):n.isDirectory()&&t.push(...it(r))}return t.sort()}function ln(e){if(T(e))for(let t of B(e,{withFileTypes:!0})){if(!t.isDirectory())continue;let n=g(e,t.name);B(n).some(r=>r.endsWith(".claim"))||w(n,{recursive:!0,force:!0})}}function dn(e){try{return _(e).size}catch{return 0}}function ot(e){return Buffer.from(e,"utf8").toString("base64url")}function st(e){try{let t=Buffer.from(e,"base64url").toString("utf8");return ot(t)===e?t:null}catch{return null}}function un(e){return!(e.version!==1||typeof e.ownerId!="string"||!e.ownerId||typeof e.pid!="number"||!Number.isSafeInteger(e.pid)||e.pid<=0)}function mn(e,t,n){let r=rt(e);if(t>n.maxItemBytes)throw new A("item-too-large",r,n,t);if(r.totalItems+1>n.maxItems)throw new A("item-capacity",r,n,t);if(r.totalBytes+t>n.maxBytes)throw new A("byte-capacity",r,n,t)}import{join as G}from"path";var Kr=1e4,pn="watch.lock",fn="watch-state.json",gn="watch-activity.json",yn="watch-refresh-requests";function Gr(e){return{lockPath:G(e,pn),statePath:G(e,fn),activityPath:G(e,gn),refreshRequestsPath:G(e,yn)}}function Xr(e){try{return bn(JSON.parse(R(e,"watch service state")))}catch{return null}}function bn(e){if(!h(e,{version:n=>n===1,protocolVersion:k,pid:k,projectRoot:x,worktreeId:l(n=>x(n)&&n.length>0),cliVersion:x,startedAt:b,heartbeatAt:b,lastActivityAt:b,idleDeadlineAt:l(b),watcher:hn,indexGeneration:l(be),lastError:l(xn),lastRefresh:l(Sn),reindexActivity:l(Mn),refreshRequests:l(Fn),typescriptSemantic:l(vn),typescriptIndex:l(Pn)}))return null;if(e.processIdentity===void 0)return e;let t=q(e.processIdentity);return!t||t.pid!==e.pid?null:{...e,processIdentity:t}}function b(e){return ye(e)}function h(e,t){return D(e)&&Object.entries(t).every(([n,r])=>r(e[n]))}function l(e){return t=>t===void 0||e(t)}function x(e){return typeof e=="string"}function hn(e){if(!D(e))return!1;switch(e.state){case"idle":return!0;case"waiting":return h(e,{changedFiles:a,reindexAt:S});case"indexing":return h(e,{startedAt:S});case"cooldown":return h(e,{until:S,dirty:pe});case"budget-paused":return h(e,{until:S,dirty:pe,reason:x,rebuilt:a,estimatedWriteBytes:a});case"draining":return h(e,{startedAt:S,reason:x});default:return!1}}function xn(e){return h(e,{at:b,message:x})}function Sn(e){return h(e,{trigger:t=>h(t,{kind:re,detail:l(x)}),result:t=>t==="rebuilt"||t==="reused"||t==="failed",startedAt:b,completedAt:b,durationMs:S,indexedLanguages:l(t=>Array.isArray(t)&&t.every(me)),skipped:l(t=>Array.isArray(t)&&t.every(n=>h(n,{language:me,reason:x}))),error:l(x)})}function me(e){return x(e)&&he.includes(e)}function at(e){return e==="complete"||e==="partial"||e==="unavailable"}function Mn(e){return h(e,{confidence:l(at),recordsRead:l(a),invalidRecords:l(a),skippedRecords:l(a),readErrors:l(a),ignoredPartialTailBytes:l(a),windowStartedAt:b,windowEndedAt:b,runs:a,rebuilt:a,fullRebuilds:l(a),reused:a,failed:a,suppressed:a,estimatedLogicalOutputBytes:S,estimatedWriteBytes:l(a),reflinkedBytes:l(a),fallbackCopiedBytes:l(a),oldestRebuildAt:l(b),oldestWriteAt:l(b),languageAttribution:l(at),attributedRuns:l(a),unattributedRuns:l(a),invalidLanguageDetails:l(a),byTrigger:t=>D(t)&&Object.entries(t).every(([n,r])=>re(n)&&(r===void 0||a(r))),byLanguage:l(In),automatic:l(Rn)})}function Rn(e){return h(e,{runs:a,rebuilt:a,fullRebuilds:a,estimatedWriteBytes:a,oldestRebuildAt:l(b),oldestWriteAt:l(b)})}function In(e){return D(e)&&Object.entries(e).every(([t,n])=>me(t)&&wn(n))}function wn(e){return h(e,{runs:a,rebuilt:a,reused:a,producedOutputBytes:a,durationMs:S})?e.rebuilt+e.reused===e.runs:!1}function Fn(e){return h(e,{pending:a,claimed:a,completed:a,expired:a,invalid:a,oldestPendingAt:l(b)})}function ct(e){return e==="idle"||e==="ready"||e==="unavailable"||e==="error"}function vn(e){return h(e,{protocolVersion:k,state:ct,requests:a,sessionsCreated:a,sessionsReused:a,sessionsRefreshed:a,sessionsReplaced:a,projectsCreated:a,lastRequestAt:l(b),lastError:l(x),busyUntil:l(b),mailbox:l(lt)})}function pe(e){return typeof e=="boolean"}function Pn(e){return h(e,{protocolVersion:k,state:ct,requests:a,sessionsCreated:a,sessionsReplaced:a,sessionsEvicted:l(a),activeSessions:l(a),maxActiveSessions:l(a),heapUsedBytes:l(a),heapLimitBytes:l(a),softMemoryLimitBytes:l(a),retireRequested:l(pe),initializations:a,programUpdates:a,documentsEmitted:a,documentsRemoved:a,lastRequestAt:l(b),lastDurationMs:l(S),lastError:l(x),busyUntil:l(b),mailbox:l(lt)})}function lt(e){return h(e,{pending:a,inflight:a,responses:a,deadLetters:a,invalid:a,totalItems:a,totalBytes:S,oldestPendingAt:l(b)})?e.totalItems===e.pending+e.inflight+e.responses+e.deadLetters:!1}export{qn as a,yt as b,oe as c,$n as d,ht as e,xt as f,Hn as g,Wn as h,Jn as i,Ge as j,Ht as k,Or as l,_r as m,nt as n,qr as o,Kr as p,Gr as q,Xr as r,ir as s,U as t,hr as u,xr as v,Sr as w,Mr as x};
|
|
4
|
+
//# sourceMappingURL=chunk-73AAKPUC.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as B}from"./chunk-STMVAHJP.js";import{d as E}from"./chunk-NJJMVD65.js";import{M as x}from"./chunk-BIQEF5NE.js";import{c as T,d as k}from"./chunk-YTAP5Y2G.js";import{f as A}from"./chunk-X6RMKHJQ.js";import{c as R}from"./chunk-O4UZSPPI.js";import{a as h}from"./chunk-B3PYOSCX.js";import{g as f,h as D,j as W,m as y}from"./chunk-TKD34PHN.js";import{t as L,x as P}from"./chunk-U5RIG3JP.js";import{i as p}from"./chunk-62BDNPMI.js";import{existsSync as I,lstatSync as g,readdirSync as j,realpathSync as O,rmSync as u,statSync as H}from"fs";import{join as c,resolve as m,sep as _}from"path";var U=3600*1e3,q=2*1024*1024*1024,N=300*1e3,K="gc-state.json",Q="gc.lock";function V(e){let t=e.leases.filter(r=>r.managed&&!r.live&&!r.busy),o=X(e.leases,e.locks),n={};for(let r of e.generations)o.has(r.generationId)||(n[r.generationId]=r.unreferencedAt??e.nowMs);let i=e.generations.filter(r=>!o.has(r.generationId)).sort((r,l)=>n[r.generationId]-n[l.generationId]||r.generationId.localeCompare(l.generationId)),s=new Set;for(let r of i)e.nowMs-n[r.generationId]>=e.policy.generationTtlMs&&s.add(r.generationId);let a=e.generations.filter(r=>!s.has(r.generationId)).reduce((r,l)=>r+l.size,0);for(let r of i){if(a<=e.policy.budgetBytes)break;s.has(r.generationId)||(s.add(r.generationId),a-=r.size)}for(let r of s)delete n[r];return{deleteWorktrees:t,deleteGenerations:e.generations.filter(r=>s.has(r.generationId)),deleteLocks:e.locks.filter(r=>!r.live),deleteTemporaries:e.temporaries.filter(r=>!r.live),protectedGenerationIds:[...o].sort(),unreferencedSince:n}}function X(e,t){let o=new Set(e.filter(n=>n.managed&&(n.live||n.busy)).flatMap(n=>[n.lease.baseGenerationId,n.lease.activeGenerationId]).filter(n=>n!==void 0));for(let n of t)n.live&&o.add(n.generationId);return o}function Ae(e,t,o={}){if(!W())return{kind:"disabled"};let n=o.repositoryId===void 0?L(e)?.repositoryId:o.repositoryId;if(!n)return{kind:"unavailable"};let i=c(f(),"repositories",n),s=(o.now??Date.now)(),a=I(i)?z(e,i,n,t,s,o):{kind:"unavailable"};return te(e,n,t,s,o),a}function z(e,t,o,n,i,s){let a=c(t,"gc-state.json"),r=pe(a);if(!s.force&&r&&i-Date.parse(r.lastSweepAt)<N)return{kind:"throttled",sweptAt:r.lastSweepAt};let l=T(t,{now:()=>i});if(!l)return{kind:"busy"};try{let d=re(e,t,o,r?.unreferencedSince??{}),b=V({nowMs:i,...d,policy:{generationTtlMs:s.policy?.generationTtlMs??U,budgetBytes:s.policy?.budgetBytes??q}}),{deletedBytes:M,deletedWorktrees:J}=Z(b,t,n),C={kind:"swept",sweptAt:new Date(i).toISOString(),deletedWorktrees:J,deletedGenerations:b.deleteGenerations.length,deletedBytes:M,protectedGenerations:b.protectedGenerationIds.length},Y={version:1,lastSweepAt:C.sweptAt,unreferencedSince:b.unreferencedSince,lastResult:C};return R(a,Y,{spacing:2,trailingNewline:!0}),C}catch(d){return{kind:"failed",error:d instanceof Error?d.message:String(d)}}finally{l.release()}}function Z(e,t,o){let n=0,i=0;for(let s of e.deleteWorktrees)ee(s,o)&&(i+=1);for(let s of e.deleteLocks)u(s.path,{force:!0});for(let s of e.deleteTemporaries)u(s.path,{recursive:!0,force:!0});for(let s of e.deleteGenerations)u(s.path,{recursive:!0,force:!0}),n+=s.size;return A(c(t,"evidence.db")),{deletedBytes:n,deletedWorktrees:i}}function ee(e,t){if(!G(e.lease))return!1;if(!I(e.lease.localCacheDir))return u(e.leasePath,{force:!0}),!0;if(!ae(e.lease))return!1;let o=k(c(e.lease.localCacheDir,"cache-lifecycle.lock"));if(!o)return!1;try{if(v(e.lease,!0))return!1;try{B({projectRoot:e.lease.projectRoot,cacheDir:e.lease.localCacheDir,cliVersion:t})}catch{return!1}return v(e.lease,!0)?!1:(u(e.lease.localCacheDir,{recursive:!0,force:!0}),u(e.leasePath,{force:!0}),!0)}finally{o.release()}}function te(e,t,o,n,i){let s=c(f(),"repositories");if(!I(s))return;let a=c(s,K),r=fe(a);if(!i.force&&r!==void 0&&n-r<N)return;let l=k(c(s,Q));if(l)try{for(let d of S(s))ye(s,d,t,e,o,n,i);R(a,{version:1,lastSweepAt:new Date(n).toISOString()},{spacing:2,trailingNewline:!0})}finally{l.release()}}function re(e,t,o,n){let i=ne(e,t,o),s=oe(t),{generations:a,temporaries:r}=se(t,n);return{leases:i,generations:a,locks:s,temporaries:r}}function ne(e,t,o){let n=new Set(P(e).map(s=>m(s.path))),i=[];for(let s of S(c(t,"worktrees"))){if(!s.endsWith(".json"))continue;let a=c(t,"worktrees",s),r=$(a);if(!r)continue;let l=m(r.projectRoot);i.push({leasePath:a,lease:r,managed:r.repositoryId===o&&G(r),live:n.has(l)||I(l),busy:v(r)})}return i}function oe(e){let t=[];for(let o of S(c(e,"locks"))){let n=/^([a-f0-9]{64})\.lock$/.exec(o);if(!n)continue;let i=c(e,"locks",o),s=w(i),a=s!==void 0&&h(s),r=n[1];t.push({generationId:r,path:i,live:a})}return t}function se(e,t){let o=[],n=[];for(let i of S(c(e,"generations"))){let s=/^\.tmp-(\d+)-/.exec(i);if(s){ie(e,i,s[1],n);continue}if(!/^[a-f0-9]{64}$/.test(i))continue;let a=c(e,"generations",i),r;try{r=g(a)}catch{continue}!r.isDirectory()||r.isSymbolicLink()||o.push({generationId:i,path:a,size:F(a),...t[i]===void 0?{}:{unreferencedAt:t[i]}})}return{generations:o,temporaries:n}}function ie(e,t,o,n){let i=c(e,"generations",t),s=Number(o);try{n.push({path:i,size:F(i),live:Number.isSafeInteger(s)&&h(s)})}catch{}}function G(e){if(e.ownershipChecksum!==x(e)||y(e.localCacheDir)!==y(D(e.projectRoot)))return!1;let t=y(c(f(),"projects"));return y(e.localCacheDir).startsWith(`${t}${_}`)}function ae(e){if(!G(e))return!1;let t=m(f()),o=m(c(t,"projects")),n=m(e.localCacheDir);try{let i=g(t),s=g(o),a=g(n);if(!i.isDirectory()||i.isSymbolicLink()||!s.isDirectory()||s.isSymbolicLink()||!a.isDirectory()||a.isSymbolicLink())return!1;let r=O(o);return O(n).startsWith(`${r}${_}`)}catch{return!1}}function ce(e){for(let t of S(c(e,"worktrees"))){if(!t.endsWith(".json"))continue;let o=$(c(e,"worktrees",t));if(o)return o.projectRoot}}function v(e,t=!1){for(let n of t?["index.lock"]:["index.lock","cache-lifecycle.lock"]){let i=w(c(e.localCacheDir,n));if(i!==void 0&&h(i))return!0}let o=w(E(e.localCacheDir).lockPath);return o!==void 0&&h(o)}function le(e){return e.version===1&&typeof e.repositoryId=="string"&&typeof e.worktreeId=="string"&&typeof e.projectRoot=="string"&&typeof e.localCacheDir=="string"&&typeof e.ownershipChecksum=="string"&&/^[a-f0-9]{64}$/.test(e.ownershipChecksum)}function de(e){return(e.treeOid===void 0||typeof e.treeOid=="string")&&(e.baseGenerationId===void 0||typeof e.baseGenerationId=="string")&&(e.activeGenerationId===void 0||typeof e.activeGenerationId=="string")}function ue(e){return typeof e.lastAction=="string"&&(e.lastReason===void 0||typeof e.lastReason=="string")&&typeof e.lastSeenAt=="string"}function $(e){try{let t=JSON.parse(p(e,"worktree cache lease"));return!le(t)||!de(t)||!ue(t)?null:t}catch{return null}}function w(e){try{let t=JSON.parse(p(e,"watch lock record"));return typeof t.pid=="number"&&Number.isSafeInteger(t.pid)&&t.pid>0?t.pid:void 0}catch{return}}function pe(e){try{let t=JSON.parse(p(e,"repository cache GC state"));return t.version!==1||typeof t.lastSweepAt!="string"||!Number.isFinite(Date.parse(t.lastSweepAt))||!t.unreferencedSince||typeof t.unreferencedSince!="object"||!t.lastResult?null:t}catch{return null}}function fe(e){try{let t=JSON.parse(p(e,"global repository cache GC state"));if(t.version!==1||typeof t.lastSweepAt!="string")return;let o=Date.parse(t.lastSweepAt);return Number.isFinite(o)?o:void 0}catch{return}}function S(e){try{return j(e)}catch{return[]}}function F(e){let t=0,o=[e];for(;o.length>0;){let n=o.pop();for(let i of j(n,{withFileTypes:!0})){let s=c(n,i.name);i.isDirectory()?o.push(s):i.isFile()&&(t+=H(s).size)}}return t}function ye(e,t,o,n,i,s,a){if(t===o||!/^[a-f0-9]{24}$/.test(t))return;let r=c(e,t),l;try{l=g(r)}catch{return}if(!l.isDirectory()||l.isSymbolicLink())return;let d=ce(r)??n;z(d,r,t,i,s,a)}export{N as a,Ae as b};
|
|
2
|
+
//# sourceMappingURL=chunk-76CZ77DF.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as U,c as D,d as E,e as B,g as J,h as N,i as O}from"./chunk-S6CZA3MV.js";import{a as $}from"./chunk-65245JCM.js";import{b as j}from"./chunk-LOVIZBJ4.js";import{d as T}from"./chunk-TRBI4UKT.js";import{k as C}from"./chunk-J5FJMODQ.js";import{c as v,d as S,n as A,p as P}from"./chunk-X6RMKHJQ.js";import{d as R}from"./chunk-GZKFETP5.js";import{a as L,e as u}from"./chunk-HGFDYOVB.js";var ce={references:J,referenceMap:N,callerMap:(t,a)=>E(t).callerMap(a),calleeMap:q};function q(t,a){let r=L(),s=new Map,l=B(t,a),o=[],i=[],g=0,m=0,f=0,h=0,I=0,F=0,k=0;for(let{definition:e,callees:n}of l.hits)I+=1,n.length>0&&(F+=1,k+=n.length,s.set(e.symbolId,n));let d=K(t,l.hits);d.entries.length>0&&u("semantic.callees.prefetch-cache-write",()=>P(t,d.entries),()=>({entries:d.entries.length,sourceMissing:d.sourceMissing,skippedUnsupportedLanguage:d.skippedUnsupportedLanguage}));function z(e,n){if(!D(e)){r&&(g+=n.length);return}let c=C(t,e);if(!c){r&&(m+=n.length),i.push(...n);return}let y=S(t,e,c),p=_(t,e);if(!p){i.push(...n);return}let b=A(t,e,y,p);G(n,b,y,p)}function G(e,n,c,y){for(let p of e){let b=n.get(p.symbol)??null;Y(p,b)||o.push({def:p,contentHash:c,depsDigest:y})}}function Y(e,n){if(n===null)return!1;let c=V(n);return c?(r&&(f+=1),c.length>0&&s.set(e.symbolId,c),!0):(r&&(h+=1),!1)}if(u("semantic.callees.cache-scan",()=>{for(let[e,n]of U(l.misses))z(e,n)},()=>({definitions:a.length,skippedUnsupportedLanguage:g,sourceMissing:m,cacheHits:f,parseFailures:h,misses:o.length,unkeyed:i.length,inMemoryHits:I,inMemoryRows:F,inMemoryCalleeCount:k,resultRows:s.size,missSample:o.slice(0,8).map(e=>`${e.def.relativePath}#${e.def.symbol}`),unkeyedSample:i.slice(0,4).map(e=>`${e.relativePath}#${e.symbol}`)})),o.length===0&&i.length===0)return s;let w=[...i,...o.map(e=>e.def)],H=0,x=u("semantic.callees.compute-misses",()=>{let e=O(t,w);return H=e.size,e},()=>({definitions:w.length,misses:o.length,unkeyed:i.length,rows:H}));for(let[e,n]of x)s.set(e,n);let M=o.filter(e=>E(t).capability("semantic-callees",e.def.relativePath).available).map(e=>({relativePath:e.def.relativePath,symbol:e.def.symbol,contentHash:e.contentHash,depsDigest:e.depsDigest,payload:JSON.stringify(x.get(e.def.symbolId)??[])}));return M.length>0?u("semantic.callees.cache-write",()=>P(t,M),()=>({entries:M.length})):u("semantic.callees.cache-write-skip",()=>{},()=>({reason:"provider-unavailable",misses:o.length})),s}function K(t,a){let r=[],s=new Map,l=0,o=0;for(let{definition:i,callees:g}of a){if(!D(i.relativePath)){o+=1;continue}if(!s.has(i.relativePath)){let f=C(t,i.relativePath),h=f?_(t,i.relativePath):null;s.set(i.relativePath,f&&h?{contentHash:S(t,i.relativePath,f),depsDigest:h}:null)}let m=s.get(i.relativePath);if(!m){l+=1;continue}r.push({relativePath:i.relativePath,symbol:i.symbol,contentHash:m.contentHash,depsDigest:m.depsDigest,payload:JSON.stringify(g)})}return{entries:r,sourceMissing:l,skippedUnsupportedLanguage:o}}var Q="typescript-callees-v4-lexical-owner";function _(t,a){let r=D(a);if(r==="typescript")return $(t,a,Q)?.key??null;let s=X(t,a);return r==="rust"?v(JSON.stringify({kind:"semantic-callees",language:r,engine:T(t.config.projectRoot),positionMapping:"nearby-leaf-v2-callsite-line",depsDigest:s})):s}function V(t){try{return JSON.parse(t)}catch{return null}}var W=R("semantic-deps-digest",{clearGroups:["whole-project","source-file"]});function X(t,a){return W.get(t,a,()=>{let s=[...j(t).get(a)??[]].sort().map(l=>`${l}:${S(t,l,C(t,l))}`);return v(s.join("|"))})}export{ce as a,q as b};
|
|
2
|
+
//# sourceMappingURL=chunk-7VPEEAAG.js.map
|