scip-query 0.10.12 → 0.12.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 +45 -0
- package/{vendor/scip/LICENSE.scip → LICENSE} +1 -0
- package/README.md +164 -49
- package/dist/augment-vue-worker.js +1 -1
- package/dist/{chunk-RUV5IY25.js → chunk-2LQWMYG4.js} +2 -2
- package/dist/{chunk-KZ4MG5NY.js → chunk-2QGE5AEP.js} +2 -2
- package/dist/chunk-4D54JIU3.js +2 -0
- package/dist/{chunk-2GLNBCHB.js → chunk-52Q4JFDW.js} +2 -2
- package/dist/chunk-5AAAEZ2Z.js +2 -0
- package/dist/chunk-64PRNLKP.js +2 -0
- package/dist/chunk-6XA4LDHY.js +2 -0
- package/dist/chunk-72MFTCU5.js +38 -0
- package/dist/chunk-75X52JTA.js +2 -0
- package/dist/{chunk-LEHVP4DY.js → chunk-7ITCOJGD.js} +2 -2
- package/dist/chunk-7JZRFDCU.js +2 -0
- package/dist/{chunk-XRUGSM76.js → chunk-AZLKLZ5S.js} +2 -2
- package/dist/chunk-B4VYXRCQ.js +26 -0
- package/dist/chunk-BCNT6ODA.js +5 -0
- package/dist/chunk-BP2NAIAZ.js +2 -0
- package/dist/chunk-BVNO67DB.js +2 -0
- package/dist/{chunk-XHMVZFA6.js → chunk-CW3KZ7UF.js} +2 -2
- package/dist/{chunk-6BN3EHQE.js → chunk-D64L53WX.js} +2 -2
- package/dist/{chunk-T3AEVJBG.js → chunk-D7J6GZAG.js} +2 -2
- package/dist/chunk-ECVXWZ4Q.js +3 -0
- package/dist/chunk-EDB7Y442.js +2 -0
- package/dist/{chunk-4ISHQ7UW.js → chunk-ETU2I5JM.js} +4 -4
- package/dist/chunk-EXKLAEB4.js +18 -0
- package/dist/chunk-EZ5WDZ2Q.js +3 -0
- package/dist/{chunk-S2MRVIJ5.js → chunk-F5BJSNU5.js} +6 -6
- package/dist/chunk-FBCOFKEC.js +2 -0
- package/dist/chunk-FERAXG6Y.js +72 -0
- package/dist/chunk-FXG3PHVW.js +9 -0
- package/dist/{chunk-XUCZ3RQ5.js → chunk-G2UBOONK.js} +4 -4
- package/dist/chunk-GNG622H3.js +3 -0
- package/dist/{chunk-JS6B76AQ.js → chunk-H2NMIZFD.js} +2 -2
- package/dist/chunk-H7NSJ7L2.js +5 -0
- package/dist/chunk-HSU3M25J.js +21 -0
- package/dist/chunk-HXXMPYEF.js +2 -0
- package/dist/chunk-IRJDYTNZ.js +3 -0
- package/dist/chunk-ISLWJ4PY.js +10 -0
- package/dist/chunk-J5WVNZ6O.js +2 -0
- package/dist/{chunk-UVPY3RUZ.js → chunk-K6UI6EBZ.js} +2 -2
- package/dist/{chunk-MNCQPMCH.js → chunk-KJCDEDQW.js} +2 -2
- package/dist/{chunk-ELC77ZDE.js → chunk-KMVGRIO2.js} +2 -2
- package/dist/chunk-KSUZS77X.js +16 -0
- package/dist/{chunk-A4UTLKHU.js → chunk-L2CX5GHZ.js} +2 -2
- package/dist/chunk-LFM3O5KX.js +2 -0
- package/dist/{chunk-ZUUNREKS.js → chunk-M72ZFN6E.js} +5 -5
- package/dist/chunk-MBKJ7GHT.js +102 -0
- package/dist/chunk-MJKJMWIM.js +2 -0
- package/dist/chunk-MKM7NBZK.js +43 -0
- package/dist/chunk-MTDBHTSF.js +2 -0
- package/dist/chunk-NAH5EAZS.js +6 -0
- package/dist/chunk-NJJ7AS4F.js +2 -0
- package/dist/{chunk-EOLGSSDR.js → chunk-NKT5EMEX.js} +2 -2
- package/dist/{chunk-ANUEY5WV.js → chunk-NLMRJ7SI.js} +2 -2
- package/dist/chunk-NQ75OVUU.js +40 -0
- package/dist/{chunk-TBCHRDAC.js → chunk-O3WDE26W.js} +2 -2
- package/dist/{chunk-VB2EZZPA.js → chunk-OPE5YXFE.js} +2 -2
- package/dist/chunk-ORBRX2QJ.js +2 -0
- package/dist/{chunk-OFXN2BCT.js → chunk-OSWF3HSF.js} +2 -2
- package/dist/{chunk-JJ5SAWBT.js → chunk-OVMUVXKQ.js} +2 -2
- package/dist/{chunk-NTSR6SRP.js → chunk-PH7ZFK6L.js} +2 -2
- package/dist/chunk-PXHPCWX5.js +2 -0
- package/dist/chunk-Q3B3FNCU.js +3 -0
- package/dist/{chunk-SQNHOOJ5.js → chunk-Q7S2DADC.js} +2 -2
- package/dist/{chunk-3XSNW5XB.js → chunk-QARYU7R3.js} +2 -2
- package/dist/chunk-QZ4JVECJ.js +2 -0
- package/dist/{chunk-FX6ULETZ.js → chunk-R5336VHZ.js} +2 -2
- package/dist/chunk-RA5MTIOO.js +2 -0
- package/dist/{chunk-RXINFVBN.js → chunk-RIQED5OU.js} +2 -2
- package/dist/chunk-T2FQ4GHD.js +9 -0
- package/dist/chunk-T6NGEV5I.js +2 -0
- package/dist/chunk-T7VQG55Q.js +2 -0
- package/dist/chunk-TFWDJDGO.js +2 -0
- package/dist/chunk-TG7QSYCJ.js +2 -0
- package/dist/{chunk-DQ6433ZG.js → chunk-TTMKELT7.js} +17 -8
- package/dist/{chunk-DDQONX6B.js → chunk-U7I373V4.js} +2 -2
- package/dist/chunk-UAHZ57BR.js +2 -0
- package/dist/chunk-URSSPS5H.js +2 -0
- package/dist/chunk-V3Z3IOWO.js +2 -0
- package/dist/{chunk-7C6JBBE4.js → chunk-V7CVBPWX.js} +2 -2
- package/dist/{chunk-PWAK75BU.js → chunk-VYF5HA76.js} +2 -2
- package/dist/chunk-WIBFXSYB.js +6 -0
- package/dist/chunk-WS3Z6W3M.js +65 -0
- package/dist/chunk-WXVGNFAO.js +2 -0
- package/dist/chunk-XEMQUN3Z.js +20 -0
- package/dist/chunk-YCPASUCX.js +2 -0
- package/dist/chunk-YDDGCJJG.js +3 -0
- package/dist/{chunk-2UVCH7CQ.js → chunk-YPKBZ77R.js} +2 -2
- package/dist/chunk-YZXV3CU3.js +60 -0
- package/dist/chunk-Z3IPJKJP.js +4 -0
- package/dist/chunk-ZMGBWSFZ.js +2 -0
- package/dist/{chunk-GKB4JJDU.js → chunk-ZOIPAYRP.js} +2 -2
- package/dist/chunk-ZRIOGL7F.js +8 -0
- package/dist/cli.js +446 -280
- package/dist/{config-types-dvHOz0zU.d.ts → config-types-BrHl3Bge.d.ts} +57 -0
- package/dist/{db-rMZO5JFK.d.ts → db-_Bdx0E1W.d.ts} +1 -1
- package/dist/diff-gate-types-CG2YQ_ei.d.ts +4 -0
- package/dist/{frontend-behavior-evidence-BxKpKWUu.d.ts → frontend-behavior-evidence-EfM4_9bc.d.ts} +1 -1
- package/dist/{health-CtTIGh6H.d.ts → health-BEZ1Rt0S.d.ts} +54 -2
- package/dist/index.d.ts +4 -68
- package/dist/index.js +1 -1
- package/dist/postinstall.js +1 -4
- package/dist/queries/affected.d.ts +2 -2
- package/dist/queries/affected.js +1 -1
- package/dist/queries/bottlenecks.d.ts +2 -2
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.d.ts +2 -2
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +2 -2
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +2 -2
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.d.ts +2 -2
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.d.ts +12 -2
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.d.ts +2 -2
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.d.ts +7 -3
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +42 -4
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/convergence.d.ts +2 -2
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.d.ts +2 -2
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +12 -3
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.d.ts +2 -2
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +3 -3
- package/dist/queries/dead.js +1 -1
- package/dist/queries/deep-chains.d.ts +2 -2
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/deps.d.ts +2 -2
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-gate.d.ts +65 -8
- package/dist/queries/diff-gate.js +1 -1
- package/dist/queries/diff-impact.d.ts +21 -3
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.d.ts +29 -2
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.d.ts +15 -3
- package/dist/queries/drift.js +1 -1
- package/dist/queries/duplicate-bodies.d.ts +55 -0
- package/dist/queries/duplicate-bodies.js +2 -0
- package/dist/queries/extract-candidates.d.ts +2 -2
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +2 -2
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.d.ts +4 -3
- package/dist/queries/files.js +1 -1
- package/dist/queries/health.d.ts +3 -3
- 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 +2 -2
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +2 -2
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.d.ts +3 -2
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +12 -7
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.d.ts +2 -2
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/locality-candidates.d.ts +2 -2
- 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.d.ts +2 -2
- package/dist/queries/methods.js +1 -1
- package/dist/queries/outline.d.ts +2 -2
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +11 -3
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.d.ts +3 -2
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.d.ts +7 -2
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.d.ts +3 -3
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.d.ts +2 -2
- package/dist/queries/react-large-component-pressure.js +1 -1
- package/dist/queries/recent-duplicates.d.ts +2 -2
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +2 -2
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.d.ts +2 -2
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.d.ts +4 -2
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-chains.d.ts +2 -2
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.d.ts +2 -2
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.d.ts +17 -10
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +42 -3
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +2 -2
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.d.ts +2 -2
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +2 -2
- package/dist/queries/surface.d.ts +2 -2
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.d.ts +2 -2
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system.d.ts +2 -2
- package/dist/queries/system.js +1 -1
- package/dist/queries/trace.d.ts +2 -2
- package/dist/queries/trace.js +1 -1
- package/dist/queries/twin-ab.d.ts +55 -0
- package/dist/queries/twin-ab.js +2 -0
- package/dist/queries/twin-drift.d.ts +97 -0
- package/dist/queries/twin-drift.js +2 -0
- package/dist/queries/unused-imports.d.ts +2 -2
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.d.ts +2 -2
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/vue-component-duplicates.d.ts +7 -2
- package/dist/queries/vue-component-duplicates.js +1 -1
- package/dist/queries/vue-composable-candidates.d.ts +3 -3
- package/dist/queries/vue-composable-candidates.js +1 -1
- package/dist/queries/vue-large-view-pressure.d.ts +6 -2
- package/dist/queries/vue-large-view-pressure.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +2 -2
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +9 -9
- package/dist/reindex.d.ts +23 -4
- package/dist/reindex.js +19 -19
- package/dist/runtime.d.ts +11 -6
- package/dist/runtime.js +2 -2
- package/dist/{scip-cli-trnNvymv.d.ts → scip-cli-C7cg4ZHR.d.ts} +1 -1
- package/dist/symbol-types-DaoeXKUt.d.ts +66 -0
- package/docs/AGENT_GUIDE.md +20 -18
- package/docs/AI_FAILURE_MODES.md +36 -13
- package/docs/API.md +1 -1
- package/docs/COMMAND_REFERENCE.md +57 -14
- package/docs/DETECTOR_GUIDE.md +20 -3
- package/docs/REGEX_POLICY.md +34 -0
- package/docs/analyzer-inventory.md +40 -3
- package/docs/analyzer-validation-ledger.md +34 -6
- package/package.json +39 -7
- package/scripts/build-scip-windows.mjs +10 -7
- package/skills/_shared/SKILL.md +243 -0
- package/skills/_shared/agents/openai.yaml +4 -0
- package/skills/scip-api-impact/SKILL.md +55 -71
- package/skills/scip-claim-audit/SKILL.md +105 -0
- package/skills/scip-claim-audit/agents/openai.yaml +4 -0
- package/skills/scip-cleanup-audit/SKILL.md +122 -0
- package/skills/scip-cleanup-audit/agents/openai.yaml +4 -0
- package/skills/scip-cleanup-improve/SKILL.md +84 -0
- package/skills/scip-cleanup-improve/agents/openai.yaml +4 -0
- package/skills/scip-concrete-plan/SKILL.md +181 -0
- package/skills/scip-concrete-plan/agents/openai.yaml +4 -0
- package/skills/scip-conductor/SKILL.md +133 -0
- package/skills/scip-conductor/agents/openai.yaml +4 -0
- package/skills/scip-debug/SKILL.md +60 -58
- package/skills/scip-diagram/SKILL.md +64 -94
- package/skills/scip-directory-architecture/SKILL.md +65 -107
- package/skills/scip-doc-reconcile/SKILL.md +56 -67
- package/skills/scip-explore/SKILL.md +78 -210
- package/skills/scip-hyper-optimization/SKILL.md +124 -198
- package/skills/scip-integrity-audit/SKILL.md +103 -0
- package/skills/scip-integrity-audit/agents/openai.yaml +4 -0
- package/skills/scip-language-playbook/SKILL.md +56 -326
- package/skills/scip-maintainability/SKILL.md +80 -219
- package/skills/scip-probe-reachability/SKILL.md +92 -0
- package/skills/scip-probe-reachability/agents/openai.yaml +4 -0
- package/skills/scip-query/SKILL.md +108 -124
- package/skills/scip-react-maintainability/SKILL.md +64 -82
- package/skills/scip-setup/SKILL.md +121 -0
- package/skills/scip-setup/agents/openai.yaml +4 -0
- package/skills/scip-tla-model-system/SKILL.md +150 -0
- package/skills/scip-tla-model-system/agents/openai.yaml +4 -0
- package/skills/scip-triage-issue/SKILL.md +53 -41
- package/skills/scip-twin-drift/SKILL.md +107 -0
- package/skills/scip-twin-drift/agents/openai.yaml +4 -0
- package/skills/scip-verify/SKILL.md +70 -88
- package/skills/scip-vue-maintainability/SKILL.md +67 -94
- package/dist/chunk-2DOW7QCA.js +0 -71
- package/dist/chunk-2FMFF4RI.js +0 -2
- package/dist/chunk-5GXTUANY.js +0 -2
- package/dist/chunk-5JHEN5VN.js +0 -25
- package/dist/chunk-62ULXMQ7.js +0 -18
- package/dist/chunk-63CI3IXR.js +0 -102
- package/dist/chunk-7EK7OSWS.js +0 -2
- package/dist/chunk-7IWIMNHI.js +0 -2
- package/dist/chunk-7XTO4YXB.js +0 -8
- package/dist/chunk-AOWFUGDL.js +0 -2
- package/dist/chunk-AREANYIA.js +0 -3
- package/dist/chunk-AZBELWZQ.js +0 -7
- package/dist/chunk-B32FX5KB.js +0 -2
- package/dist/chunk-B6MJ5VQV.js +0 -2
- package/dist/chunk-CXWCLVYL.js +0 -2
- package/dist/chunk-CYHIKTJN.js +0 -3
- package/dist/chunk-DFSEARAU.js +0 -2
- package/dist/chunk-DVFP6PZI.js +0 -2
- package/dist/chunk-E3ADDB43.js +0 -2
- package/dist/chunk-F6IXELII.js +0 -20
- package/dist/chunk-FMGVZBS2.js +0 -2
- package/dist/chunk-GG5LHT27.js +0 -2
- package/dist/chunk-H7JF2CKK.js +0 -2
- package/dist/chunk-HHOMJCP5.js +0 -4
- package/dist/chunk-HRDSU5FN.js +0 -9
- package/dist/chunk-HWVYTJOV.js +0 -2
- package/dist/chunk-JNMLBL36.js +0 -2
- package/dist/chunk-L446VQYQ.js +0 -2
- package/dist/chunk-LDJUB7XW.js +0 -2
- package/dist/chunk-MYTUWXHK.js +0 -4
- package/dist/chunk-N25HPUOK.js +0 -2
- package/dist/chunk-NABVR6B7.js +0 -2
- package/dist/chunk-NBNEVLRC.js +0 -3
- package/dist/chunk-ONPCQ2PM.js +0 -6
- package/dist/chunk-Q5P7NOVM.js +0 -2
- package/dist/chunk-RGKRYO22.js +0 -4
- package/dist/chunk-RM2WQ75T.js +0 -2
- package/dist/chunk-ROGZXWN2.js +0 -2
- package/dist/chunk-RSSXKJ6J.js +0 -38
- package/dist/chunk-RVGEZYMQ.js +0 -2
- package/dist/chunk-SA3DPTHT.js +0 -7
- package/dist/chunk-SGTKURU6.js +0 -52
- package/dist/chunk-T4N2ZRVY.js +0 -21
- package/dist/chunk-THB6AM3V.js +0 -11
- package/dist/chunk-ULHLDOD6.js +0 -4
- package/dist/chunk-UQ73QF5D.js +0 -43
- package/dist/chunk-UUBMFL3F.js +0 -59
- package/dist/chunk-V5FGK3DZ.js +0 -2
- package/dist/chunk-WTY5FERW.js +0 -2
- package/dist/chunk-WUOB4DHH.js +0 -6
- package/dist/chunk-YFQIKYOP.js +0 -2
- package/dist/chunk-Z2LDWIJV.js +0 -5
- package/dist/chunk-ZNWWVYQL.js +0 -3
- package/skills/concrete-plan/SKILL.md +0 -372
- package/skills/concrete-plan/agents/openai.yaml +0 -4
- package/skills/scip-adoption/SKILL.md +0 -122
- package/skills/scip-adoption/agents/openai.yaml +0 -4
- package/skills/scip-ai-cleanup/SKILL.md +0 -153
- package/skills/scip-ai-cleanup/agents/openai.yaml +0 -4
- package/skills/scip-debloat/SKILL.md +0 -439
- package/skills/scip-debloat/agents/openai.yaml +0 -4
- package/skills/scip-health-audit/SKILL.md +0 -162
- package/skills/scip-health-audit/agents/openai.yaml +0 -4
- package/skills/scip-health-improve/SKILL.md +0 -155
- package/skills/scip-health-improve/agents/openai.yaml +0 -4
- package/skills/scip-query-setup/SKILL.md +0 -170
- package/skills/scip-query-setup/agents/openai.yaml +0 -3
- package/vendor/scip/README.md +0 -6
- package/vendor/scip/win32-arm64/scip.exe +0 -0
- package/vendor/scip/win32-x64/scip.exe +0 -0
package/dist/chunk-NBNEVLRC.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as y,b as d,e as w,n as f}from"./chunk-63CI3IXR.js";import{c as D,d as $,e as Q,g as v,h as A,i as N}from"./chunk-NABVR6B7.js";function re(e,n){let t=Z(e,n.trim());if(t)return t;let i=q(e,n);if(i)return i;let o=F(e,n);return o||j(e,n)}function F(e,n){let t=x(n),i=I(t);if(!i)return null;let o=`%${i.path}%`,r=i.leaf,c=O(e,o,r,t)[0];return c?f(e,c):null}function O(e,n,t,i){let o=w([],[...z(e,n,t),...W(e,n,t)]).filter(r=>!e.isIgnored(r.relative_path)).filter(r=>h(r,i)>1);return o.sort((r,a)=>h(a,i)-h(r,i)||r.end_line-r.start_line-(a.end_line-a.start_line)||r.start_line-a.start_line||r.symbol.localeCompare(a.symbol)),o}function z(e,n,t){return y(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function W(e,n,t){return d(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function j(e,n){let t=x(n),i=U(n),o=H(e,i),r=V(o,n,t);if(r&&!e.isIgnored(r.relative_path))return f(e,r);let a=null;for(let c of o){if(e.isIgnored(c.relative_path))continue;let l=J(c,n,t,i);l<=0||(!a||l>a.score)&&(a={row:c,score:l})}return a?f(e,a.row):null}function q(e,n){let t=n.match(/^(.+):(\d+)-(\d+)$/);if(!t)return null;let[,i,o,r]=t,a=Math.max(0,parseInt(o,10)-1),c=Math.max(a,parseInt(r,10)-1),l=T(e,i,a,c)??X(e,i,a,c);return l&&!e.isIgnored(l.relative_path)?f(e,l):null}function T(e,n,t,i){return y(e,{where:"d.relative_path LIKE ? AND der.start_line <= ? AND der.end_line >= ?",params:[`%${n}%`,t,i],orderBy:"(der.end_line - der.start_line) ASC",limit:1})[0]}function X(e,n,t,i){return d(e,{where:"d.relative_path LIKE ? AND c.start_line <= ? AND c.end_line >= ?",params:[`%${n}%`,t,i],orderBy:"(MAX(c.end_line) - MIN(c.start_line)) ASC",limit:1})[0]}function Z(e,n){let i=y(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, der.start_line",limit:1})[0]??d(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, start_line",limit:1})[0];return!i||e.isIgnored(i.relative_path)?null:f(e,i)}function ae(e,n){if("symbol"in n&&"relativePath"in n)return n;let t=G(e,n.symbolId)[0];return t?f(e,t):null}function G(e,n){let t=y(e,{where:"gs.id = ?",params:[n],orderBy:"der.start_line, der.end_line"}),i=d(e,{where:"gs.id = ?",params:[n],orderBy:"start_line, end_line"});return w(t,i)}function H(e,n){let t=n.map(()=>"(gs.symbol LIKE ? OR d.relative_path LIKE ? OR COALESCE(gs.display_name, '') LIKE ?)"),i=n.flatMap(c=>{let l=`%${c}%`;return[l,l,l]}),o=t.join(`
|
|
2
|
-
AND `),r=y(e,{where:o,params:i,limit:200}),a=d(e,{where:o,params:i,limit:200});return w(r,a)}function J(e,n,t,i){let o=n.trim(),r=t,a=r.replace(/\(\)$/,""),c=n.toLowerCase(),l=t.toLowerCase(),S=l.replace(/\(\)$/,""),k=e.symbol,C=$(e.symbol),b=Q(e.symbol),E=e.display_name??"",g=e.symbol.toLowerCase(),u=C.toLowerCase(),m=b.toLowerCase(),R=E.toLowerCase(),p=e.relative_path.toLowerCase(),K=/[/:.]/.test(t),M=I(t),_=M?.leaf.toLowerCase(),s=0;return(k===o||k===r)&&(s+=1150),(C===o||C===r)&&(s+=1100),E===a&&(s+=1180),b===a&&(s+=1160),(`${b}()`===o||`${b}()`===r)&&(s+=955),(g===c||g===l)&&(s+=1e3),(u===c||u===l)&&(s+=950),(p===c||p===l)&&(s+=925),(p.endsWith(`/${l}`)||p.endsWith(`/${c}`))&&(s+=875),R===S&&(s+=850),m===S&&(s+=825),(`${m}()`===c||`${m}()`===l)&&(s+=820),(u.endsWith(`:${l}`)||u.endsWith(`:${S}`)||u.endsWith(`:${S}()`))&&(s+=800),g.includes(l)&&(s+=120),u.includes(l)&&(s+=140),p.includes(l)&&(s+=140),R.includes(l)&&(s+=110),i.every(B=>{let L=B.toLowerCase();return g.includes(L)||u.includes(L)||p.includes(L)||R.includes(L)})&&(s+=100+i.length*15),M&&p.includes(M.path.toLowerCase())&&(s+=360,_&&(m===_||`${m}()`===_||`${m}()`==`${_}()`)&&(s+=700),v(e.symbol)&&(s+=180)),A(e.symbol)&&m===S&&(s+=60),!K&&N(e.symbol)&&(s-=160),s-=Math.min(50,Math.max(0,e.end_line-e.start_line)),s}function I(e){let n=e.trim().replace(/\\/g,"/"),t=n.lastIndexOf("/");if(t<=0||t===n.length-1)return null;let i=n.slice(t+1).replace(/\(\)$/,"");return!i||i.includes(".")?null:{path:n.slice(0,t),leaf:i}}function x(e){return e.trim().replace(/\(\)$/,"").replace(/\(.*$/,"")}function U(e){let n=x(e),t=n.split(/[^A-Za-z0-9_]+/).map(i=>i.trim()).filter(i=>i.length>0);return t.length>0?[...new Set(t)]:[n]}function V(e,n,t){let i=n.trim(),o=e.filter(r=>{let a=$(r.symbol),c=(r.display_name??"").trim();return r.symbol===i||a===i||a===t||c===i||c===t||`${c}()`===i||h(r,t)>1||r.relative_path===i});return o.length===0?null:(o.sort((r,a)=>h(a,t)-h(r,t)||r.end_line-r.start_line-(a.end_line-a.start_line)||r.relative_path.localeCompare(a.relative_path)||r.symbol.localeCompare(a.symbol)),o[0]??null)}function h(e,n){let t=I(n);if(!t)return 0;let i=e.relative_path.toLowerCase(),o=Q(e.symbol).toLowerCase(),r=t.path.toLowerCase(),a=t.leaf.toLowerCase();return i.includes(r)?o!==a?1:v(e.symbol)?D(e.symbol)===null?5:4:D(e.symbol)===null?3:2:0}export{re as a,Z as b,ae as c};
|
|
3
|
-
//# sourceMappingURL=chunk-NBNEVLRC.js.map
|
package/dist/chunk-ONPCQ2PM.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{execFileSync as h}from"child_process";import{platform as y}from"os";var b=y()==="win32";function t(e){let r=b?"where":"which";try{return h(r,[e],{stdio:"pipe"}),!0}catch{return!1}}import{execFileSync as c}from"child_process";import{existsSync as g,readFileSync as I}from"fs";import{platform as o,arch as m}from"os";import{dirname as p,join as s}from"path";import{fileURLToPath as v}from"url";var d="v0.8.1",a="https://github.com/scip-code/scip",x={win32:{x64:s("vendor","scip","win32-x64","scip.exe"),arm64:s("vendor","scip","win32-arm64","scip.exe")}};function S(){let e=p(v(import.meta.url));for(;;){let r=s(e,"package.json");if(g(r))try{if(JSON.parse(I(r,"utf-8")).name==="scip-query")return e}catch{}let n=p(e);if(n===e)return null;e=n}}function f(){let e=x[o()]?.[m()];if(!e)return null;let r=S();if(!r)return null;let n=s(r,e);return g(n)?n:null}function w(){return t("scip")?"scip":f()}function H(){return w()!==null}function q(){let e=w();if(!e)return null;try{return c(e,["--version"],{stdio:"pipe"}).toString().trim()}catch{return null}}function $(){let e=o(),r=m(),n,i,l;switch(e){case"darwin":n="darwin",l="tar.gz";break;case"linux":n="linux",l="tar.gz";break;default:return null}switch(r){case"arm64":i="arm64";break;case"x64":i="amd64";break;default:return null}let u=`scip-${n}-${i}.${l}`;return{url:`${a}/releases/download/${d}/${u}`,filename:u}}function U(){let e=$();console.log("\nThe `scip` CLI is required but not found on PATH.\n"),o()==="darwin"?(console.log("Install via Homebrew:"),console.log(` brew install sourcegraph/scip/scip
|
|
2
|
-
`),console.log("Or download manually:")):o()==="win32"?(console.log("Windows installs should include a managed scip.exe in the scip-query package."),console.log("Reinstall scip-query, or build the managed binary from source with:"),console.log(` npm run build:scip-windows
|
|
3
|
-
`),console.log("Upstream release page:")):console.log("Download from:"),console.log(e?` ${e.url}
|
|
4
|
-
`:` ${a}/releases/tag/${d}
|
|
5
|
-
`),console.log("After installing, ensure `scip` is on your PATH and run `scip-query reindex`.")}function D(e){let r=f();if(r)return e(`Using bundled scip CLI at ${r}`),!0;if(o()==="darwin"&&t("brew")){e("Installing scip CLI via Homebrew...");try{if(c("brew",["install","sourcegraph/scip/scip"],{stdio:"inherit",timeout:3e5,env:process.env}),t("scip"))return e("Successfully installed scip CLI via Homebrew"),!0}catch(n){let i=n instanceof Error?n.message:String(n);e(`Homebrew install failed: ${i}`)}}if(t("go")){e("Installing scip CLI via go install...");try{if(c("go",["install","github.com/sourcegraph/scip/cmd/scip@latest"],{stdio:"inherit",timeout:3e5,env:process.env}),t("scip"))return e("Successfully installed scip CLI via go install"),!0}catch(n){let i=n instanceof Error?n.message:String(n);e(`go install failed: ${i}`)}}return e("Could not auto-install scip CLI."),e(`Install manually from: ${a}/releases`),!1}export{t as a,w as b,H as c,q as d,U as e,D as f};
|
|
6
|
-
//# sourceMappingURL=chunk-ONPCQ2PM.js.map
|
package/dist/chunk-Q5P7NOVM.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as b}from"./chunk-RSSXKJ6J.js";import{a as f}from"./chunk-NBNEVLRC.js";import{f as v}from"./chunk-63CI3IXR.js";import{d as r}from"./chunk-NABVR6B7.js";import{f as C}from"./chunk-THB6AM3V.js";function N(s,c,m,y={}){let n=f(s,c),o=f(s,m);if(!n||!o)return null;let d=b(s,n,{semantic:y.semantic}),p=b(s,o,{semantic:y.semantic}),A=d.filter(e=>!w(s,e)),B=p.filter(e=>!w(s,e)),S=A.length!==d.length||B.length!==p.length,g=new Set(A.map(e=>e.symbol)),h=new Set(B.map(e=>e.symbol)),a=[];for(let e of g)h.has(e)&&a.push(e);let l=[];for(let e of g)h.has(e)||l.push(e);let i=[];for(let e of h)g.has(e)||i.push(e);let u=new Set([...g,...h]),T=u.size>0?a.length/u.size:0,t;u.size===0?t="Neither function calls other tracked symbols. There is no callee-pattern evidence for consolidation; inspect the source bodies directly.":a.length===0?t="These functions do not share any callees. They are not a callee-based consolidation candidate.":l.length===0&&i.length===0?t="These functions have identical tracked callee sets. They are a strong structural match, but identical callees do not prove interchangeable semantics; inspect signatures, control flow, and return values before consolidating.":l.length===0?t="A's tracked callees are a subset of B's. B may subsume part of A's structure, but verify signatures, guards, and non-call logic before replacing A with B.":i.length===0?t="B's tracked callees are a subset of A's. A may subsume part of B's structure, but verify signatures, guards, and non-call logic before replacing B with A.":l.length<=2&&i.length<=2?t=`Create a shared function with the ${a.length} common callees. Pass the ${l.length+i.length} divergent callees as parameters or strategy callbacks.`:t=`Extract the ${a.length} shared callees into a common helper. Each function calls the helper plus its own unique logic (${l.length} callees in A, ${i.length} in B).`,S&&(t=`Ignored Clojure macro scaffolding while comparing tracked callees. ${t}`);let q=n.endLine-n.startLine+1,D=o.endLine-o.startLine+1;return{symbolA:{symbol:n.symbol,shortName:r(n.symbol),file:n.relativePath,loc:q},symbolB:{symbol:o.symbol,shortName:r(o.symbol),file:o.relativePath,loc:D},similarity:T,sharedCallees:a.map(r),uniqueToA:l.map(r),uniqueToB:i.map(r),consolidationStrategy:t}}function w(s,c){return v(s,c.file).some(m=>m.symbol===c.symbol&&C(s,m))}export{N as a};
|
|
2
|
-
//# sourceMappingURL=chunk-Q5P7NOVM.js.map
|
package/dist/chunk-RGKRYO22.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{a as ce}from"./chunk-XHMVZFA6.js";import{a as ae}from"./chunk-7XTO4YXB.js";import{a as S}from"./chunk-B32FX5KB.js";import{a as se}from"./chunk-RUV5IY25.js";import{a as oe}from"./chunk-T3AEVJBG.js";import{a as re}from"./chunk-C2QSK7E7.js";import{a as ie,c as ne}from"./chunk-Z2LDWIJV.js";import{a as ee}from"./chunk-JJ5SAWBT.js";import{a as te}from"./chunk-ZNWWVYQL.js";import{a as X}from"./chunk-GKB4JJDU.js";import{a as U,c as V,d as q,h as L,i as K}from"./chunk-T4N2ZRVY.js";import{a as W,b as A,e as Y}from"./chunk-MYTUWXHK.js";import{a as Q}from"./chunk-62ULXMQ7.js";import{b as Z}from"./chunk-ROGZXWN2.js";import{a as B,c as _,d as z,e as O}from"./chunk-GG5LHT27.js";import{a as H}from"./chunk-HRDSU5FN.js";import{a as J}from"./chunk-FMGVZBS2.js";import{a as I}from"./chunk-RM2WQ75T.js";import{f as F,g as v}from"./chunk-WUOB4DHH.js";import{b as N}from"./chunk-ULHLDOD6.js";import{e as T,f as P,g as M}from"./chunk-NABVR6B7.js";import{createHash as Oe}from"crypto";import{existsSync as me}from"fs";function le(e){let[i,t]=G(e,":"),n=i||"unknown",o=(s={})=>{let r=s.actionTier??Se(n);return{sourceAnalyzer:n,actionTier:r,rootCauseKey:s.rootCauseKey??(t||e),label:s.label??`${n} finding`,relatedFiles:s.relatedFiles??[],why:s.why??[],remediation:s.remediation??$e(r,n),file:s.file}};if(!t)return o({rootCauseKey:e,why:["Baseline identity did not include analyzer payload."]});if(["dead","isolated","extract","wrapper","passthrough","stale"].includes(n)){let[s,r]=G(t,":");return o({file:s,relatedFiles:s?[s]:[],rootCauseKey:r?`${s}:${r}`:t,label:`${n} finding`,why:r?[`Baseline subject: ${r}.`]:[]})}if(n==="cycle"){let s=t.split(">").filter(Boolean);return o({relatedFiles:s,rootCauseKey:t,label:"cycle finding",why:s.length>0?[`Cycle path: ${s.join(" > ")}.`]:[]})}if(n==="similar"){let s=t.split("|").filter(Boolean);return o({relatedFiles:[],rootCauseKey:t,label:"similarity finding",why:s.length>0?[`Similar symbols: ${s.join(" | ")}.`]:[]})}if(n==="drift"){let[s,r]=G(t,":"),[l,a]=G(r,":");return o({actionTier:s==="unused-import"?"direct":"signal",file:l,relatedFiles:[...new Set([l,a].filter(Boolean))],rootCauseKey:t,label:`${s||"drift"} finding`,why:[...s?[`Drift kind: ${s}.`]:[],...a?[`Related dependency: ${a}.`]:[]]})}return o({why:["Baseline analyzer prefix is not recognized by this diff-gate version."]})}function Se(e){switch(e){case"dead":case"isolated":case"cycle":case"passthrough":return"direct";case"similar":case"extract":case"wrapper":case"stale":return"signal";default:return"signal"}}function $e(e,i){return e==="direct"?`Fix the new ${i} baseline finding, or knowingly accept it via health --write-baseline.`:`Review the new ${i} baseline signal; fix it if it reflects real debt, or knowingly accept it via health --write-baseline.`}function G(e,i){let t=e.indexOf(i);return t<0?[e,""]:[e.slice(0,t),e.slice(t+i.length)]}import{existsSync as De,readFileSync as fe}from"fs";var w={classifyCitation:we,citationContexts:ke,citationKindLabel:Te,citationRemediation:Fe,referenceTargets:ve};function we(e){let i=e.join(`
|
|
2
|
-
`).toLowerCase(),t=[],n=A(i,[".scipquery","declaredcouplings","suppression","suppressions","config","configuration","json"]);if(n.length>0)return t.push(`configuration/example terms near citation: ${n.join(", ")}`),{citationKind:"configuration-example",actionTier:"support",reasons:t};let o=A(i,["accepted","intentional","intentionally","retained","historical"]);if(o.length>0)return t.push(`intentional-record terms near citation: ${o.join(", ")}`),{citationKind:"intentional-record",actionTier:"support",reasons:t};let s=A(i,["command","cli","usage","example","run","workflow"]);return s.length>0?(t.push(`guide/reference terms near citation: ${s.join(", ")}`),{citationKind:"guide-reference",actionTier:"signal",reasons:t}):(t.push(e.length>0?"citation appears in prose without config or guide markers":"citation context unavailable"),{citationKind:"behavioral-claim",actionTier:"direct",reasons:t})}function ke(e,i,t){let n;try{n=fe(`${e.config.projectRoot}/${i}`,"utf-8").split(/\r?\n/)}catch{return[]}let o=t.flatMap(Re),s=[];for(let r=0;r<n.length;r+=1){let l=n[r]??"";o.some(a=>l.includes(a))&&s.push(W(n,r))}return s}function Re(e){let i=e.split("/");return[e,`./${e}`,i.slice(-3).join("/"),i.slice(-2).join("/")].filter((t,n,o)=>t.length>0&&o.indexOf(t)===n)}function Te(e){switch(e){case"behavioral-claim":return"a behavioral doc claim";case"configuration-example":return"a configuration example";case"guide-reference":return"a guide reference";case"intentional-record":return"an intentional record"}}function Fe(e,i){switch(e){case"behavioral-claim":return`Re-read ${i} and update the behavioral claim or citation.`;case"configuration-example":return`Verify the configuration example in ${i} still points at the intended file; update only if the example target changed.`;case"guide-reference":return`Verify the guide reference in ${i} still sends readers to the right implementation or command surface.`;case"intentional-record":return`Verify the intentional citation in ${i} is still meant to name this file.`}}function ve(e,i,t){let n=U(t),o=new Set;for(let s of i)xe(e,s,n.get(s)??[])&&o.add(s);return o}function xe(e,i,t){if(t.length===0)return!1;if(!Ae.test(i))return!0;let n=`${e.config.projectRoot}/${i}`;if(!De(n))return!0;let o=fe(n,"utf-8").split(/\r?\n/),s=Ge(o);for(let r of t)for(let l=r.startLine;l<=r.endLine;l+=1)if((o[l]??"").trim()!==""&&!s.has(l))return!0;return!1}var Ae=/\.(?:[cm]?[jt]sx?)$/i;function Ge(e){let i=new Set,t=!1;for(let n=0;n<e.length;n+=1){let o=e[n].trim();!t&&je(o)&&(t=!0),t&&(i.add(n),o.endsWith(";")&&(t=!1))}return i}function je(e){return/^import(?:\s|$)/.test(e)||/^export(?:\s+type)?\s+(?:\*|\{)/.test(e)}import{existsSync as Ee,readFileSync as Be,writeFileSync as Le}from"fs";import{isAbsolute as Ke,join as Ne}from"path";var Pe=25e3,Me=2500,Ie=2500;function He(e){let i=re(e);return i.symbols>=Pe||i.documents>=Me?Ie:void 0}var _e=".scipquery-baseline.json";function j(e,i){return i&&Ke(i)?i:Ne(e.config.projectRoot,i??_e)}function de(e,i={}){let{scope:t}=i,n=He(e),o=[],s=Z(e,{scope:t,...S.dead,scanLimit:n});for(let r of s.symbols)F(e,r.relativePath)||v(e,r.symbol,r.relativePath)||r.kind==="dead-code"&&o.push(`dead:${r.relativePath}:${r.shortName}`);for(let r of ee(e,{scope:t,...S.isolated,scanLimit:n}))F(e,r.relativePath)||v(e,r.symbol,r.relativePath)||o.push(`isolated:${r.relativePath}:${r.shortName}`);for(let r of J(e,{scope:t}))r.kind==="real"&&o.push(`cycle:${ze(r.path)}`);for(let r of ne(e,{scope:t,...S.similar,scanLimit:n}))o.push(`similar:${[r.symbolA,r.symbolB].sort().join("|")}`);for(let r of X(e,{scope:t,...S.extract,scanLimit:n}))o.push(`extract:${r.relativePath}:${r.shortName}`);for(let r of se(e,{scope:t,...S.wrappers,scanLimit:n}))o.push(`wrapper:${r.file}:${r.shortName}`);for(let r of te(e,{scope:t,...S.passthroughs,scanLimit:n}))o.push(`passthrough:${r.file}:${r.shortName}`);for(let r of oe(e,{scope:t,...S.stale,scanLimit:n}))o.push(`stale:${r.file}:${r.shortName}`);for(let r of Q(e,{scope:t,...S.drift,includePatternDeviations:!1}).results)o.push(`drift:${r.kind}:${r.file}:${r.dep}`);return[...new Set(o)].sort()}function ze(e){if(e.length===0)return"";let i=0;for(let t=1;t<e.length;t++)e[t]<e[i]&&(i=t);return[...e.slice(i),...e.slice(0,i)].join(">")}function Mt(e,i={}){let t=de(e,{scope:i.scope}),n=j(e,i.path);return Le(n,JSON.stringify({version:1,findings:t},null,2)+`
|
|
3
|
-
`),{path:n,findingCount:t.length}}function ue(e,i={}){let t=j(e,i.path);if(!Ee(t))throw new Error(`No baseline found at ${t}. Create one with: scip-query health --write-baseline`);let n=JSON.parse(Be(t,"utf-8")),o=new Set(n.findings??[]),s=de(e,{scope:i.scope}),r=new Set(s);return{baselinePath:t,baselineCount:o.size,current:s,newFindings:s.filter(l=>!o.has(l)),fixedFindings:[...o].filter(l=>!r.has(l))}}var ni=["echo","incomplete-migration","co-change-partner","doc-reference","unused-params","new-dead","baseline"];function oi(e,i={}){let t=i.base??"HEAD",{minTogether:n=6,minConfidence:o=.6,maxEchoChecks:s=Number.POSITIVE_INFINITY,maxHelpers:r=Number.POSITIVE_INFINITY,minSimilarity:l=.8,includeBaseline:a=!1,scanLimit:c}=i,y=i.semantic!==!1,h=new Set(i.skip??[]),f=q(e,{base:t}),p=V(e,{base:t,plan:f}),m=p.changedFiles,d=new Set(m),u=new Set(f.changedFileLines),b=new Set([...d,...u]),C=L(e.config.projectRoot,t,K(f,m)),R=mt(e.config.projectRoot,t,f,C),g={base:t,changedFiles:m,changedSymbols:p.changedSymbols.length,checksRun:[],skipped:[],suppressed:[],findings:[],rootCauseGroups:[],note:p.summary.note};if(m.length===0)return g;let $=(x,pe)=>{if(h.has(x)){g.skipped.push({check:x,reason:"skipped via --skip"});return}let ye=g.findings.length,be=g.skipped.length,Ce=g.checksRun.length;N(`diff-gate.check.${x}`,pe,()=>({check:x,changedFiles:m.length,changedSymbols:p.changedSymbols.length,findingsAdded:g.findings.length-ye,skippedAdded:g.skipped.length-be,checksRunAdded:g.checksRun.length-Ce}))};return $("echo",()=>Je(e,p.changedSymbols,d,R,s,l,c,y,g)),$("incomplete-migration",()=>rt(e,t,f,r,c,y,C,g)),$("co-change-partner",()=>st(e,b,n,o,g)),$("doc-reference",()=>dt(e,d,u,f.changedRanges,g)),$("unused-params",()=>ut(e,m,g)),$("new-dead",()=>ht(e,p.changedSymbols,R,g)),a&&$("baseline",()=>bt(e,g)),We(g,e.config.suppressions??[]),g.rootCauseGroups=Ue(g.findings),g}function Ue(e){let i=new Map;for(let t of e){let n=t.groupKey??`${t.check}:${t.id}`,o=i.get(n);o||(o={groupKey:n,check:t.check,severity:t.severity,actionTier:t.actionTier,sourceAnalyzer:t.sourceAnalyzer,rootCauseKey:t.rootCauseKey,count:0,findingIds:[],files:new Set,relatedFiles:new Set,message:t.message,remediation:t.remediation},i.set(n,o)),o.count+=1,o.findingIds.push(t.id),o.severity=Ve(o.severity,t.severity),o.actionTier=qe(o.actionTier,t.actionTier),t.file&&o.files.add(t.file);for(let s of t.relatedFiles??[])o.relatedFiles.add(s)}return[...i.values()].map(t=>({...t,files:[...t.files].sort(),relatedFiles:[...t.relatedFiles].sort()})).sort((t,n)=>n.count-t.count||E(n.severity)-E(t.severity)||t.groupKey.localeCompare(n.groupKey))}function Ve(e,i){return E(i)>E(e)?i:e}function E(e){return e==="error"?2:e==="warning"?1:0}function qe(e,i){return e?i&&he(i)>he(e)?i:e:i}function he(e){return e==="direct"?2:e==="signal"?1:0}function We(e,i){if(i.length===0||e.findings.length===0)return;let t=[];for(let n of e.findings){let o=i.find(s=>Ye(s,n));o?e.suppressed.push({finding:n,suppression:o}):t.push(n)}e.findings=t}function Ye(e,i){return!e.reason||e.reason.trim()===""||e.expiresAt&&Date.parse(e.expiresAt)<=Date.now()||e.id&&e.id!==i.id||e.check&&e.check!==i.check||e.file&&e.file!==i.file?!1:!!(e.id||e.check)}function k(e,i){e.findings.push({...i,suppressionHint:`scip-query: ignore ${i.check} ${i.id} -- <reason>`})}function Je(e,i,t,n,o,s,r,l,a){a.checksRun.push("echo");for(let c of i.slice(0,o)){if(!M(c.symbol)||n(c))continue;let y=ie(e,c.symbol,{minSimilarity:s,limit:5,scanLimit:r,semantic:l,sourceCandidateMode:"target-pruned"}),h=[];for(let d of y){let u=d.fileA===c.file?d.fileB:d.fileA,b=d.fileA===c.file?d.shortNameB:d.shortNameA,C=d.fileA===c.file?d.symbolB:d.symbolA;t.has(u)||h.push({otherFile:u,otherShort:b,otherSymbol:C,similarity:d.similarity,similarityBasis:d.similarityBasis??"callees",sharedEvidence:d.sharedCallees})}if(h.length===0)continue;let f=h[0],p=D("echo",c.symbol,c.file,...h.map(d=>`${d.otherSymbol}|${d.otherFile}`).sort()),m=Ze(c,h);k(a,{id:p,groupKey:p,actionTier:m,check:"echo",severity:"warning",evidence:"heuristic",confidence:f.similarity,file:c.file,symbol:c.symbol,relatedFiles:[...new Set(h.map(d=>d.otherFile))].sort(),message:it(c,h),why:nt(c,h),remediation:ot(m,c.shortName,f.otherShort)})}i.length>o&&a.skipped.push({check:"echo",reason:`echo check capped at ${o} of ${i.length} changed symbols`})}function Ze(e,i){return i.some(n=>Qe(e.symbol,n))?"direct":"signal"}function Qe(e,i){if(i.similarityBasis!=="source-tokens"||i.similarity<.98||i.sharedEvidence.length>8)return!1;let t=T(e),n=T(i.otherSymbol);return!t||!n?!1:t===n?!0:tt(i.sharedEvidence)?!1:Xe(t,n)}function Xe(e,i){let t=ge(e),n=ge(i);if(t.length===0||n.length===0)return!1;let o=new Set(n),s=t.filter(r=>o.has(r)).length;return s>=2&&s/Math.min(t.length,n.length)>=.5}function ge(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).map(i=>i.toLowerCase()).filter(i=>i.length>=2)}var et=new Set(["bytes","crypto","hex","num","random","secret","to","token"]);function tt(e){return e.length>=3&&e.every(i=>et.has(i.toLowerCase()))}function it(e,i){let t=i[0],n=Math.round(t.similarity*100);return i.length===1?`${e.shortName} (${e.file}) is ${n}% similar to established ${t.otherShort} (${t.otherFile})`:`${e.shortName} (${e.file}) resembles ${i.length} established symbol(s); strongest is ${n}% similar to ${t.otherShort} (${t.otherFile})`}function nt(e,i){let t=[`${e.shortName} was changed in this diff.`];for(let n of i.slice(0,3))t.push(`${n.otherShort} is outside this diff and scored ${Math.round(n.similarity*100)}% similar by ${n.similarityBasis} evidence.`),t.push(`Shared evidence: ${n.sharedEvidence.slice(0,5).join(", ")||"(none listed)"}.`);return i.length>3&&t.push(`${i.length-3} additional similar match(es) grouped into this finding.`),t}function ot(e,i,t){return e==="direct"?`Extract or reuse the shared behavior with ${t}, or keep the duplicate with a suppression reason.`:`Review whether ${i} is intentionally parallel to the established implementation(s); extract shared behavior only if the product semantics match.`}function rt(e,i,t,n,o,s,r,l){let a=ae(e,{base:i,maxHelpers:n,diffPlan:t,scanLimit:o,semantic:s,baseContentAt:r});if(!a.available){l.skipped.push({check:"incomplete-migration",reason:"no git history"});return}l.checksRun.push("incomplete-migration"),a.note&&l.skipped.push({check:"incomplete-migration",reason:a.note});for(let c of a.findings){let y=c.leftovers.map(u=>`${u.shortName} (${u.file}, ${Math.round(u.containment*100)}% helper / ${Math.round(u.siteCoverage*100)}% site, ${u.migrationScope})`).join(", "),h=c.leftovers.map(u=>`${u.shortName}: ${u.migrationScope} (${u.migrationScopeReasons[0]})`).join("; "),f=[...c.migratedFiles,...c.leftovers.map(u=>u.file)],p=c.leftovers.length===0?void 0:Math.max(...c.leftovers.map(u=>Math.min(u.containment,u.siteCoverage))),m=c.leftovers.some(u=>u.migrationScope==="possible-subtype"),d=D("incomplete-migration",c.helperSymbol,c.helperFile,f.join("|"));k(l,{id:d,check:"incomplete-migration",severity:"warning",evidence:"heuristic",confidence:p,file:c.helperFile,symbol:c.helperSymbol,relatedFiles:f,message:`new helper ${c.helperShortName} (${c.helperFile}) is wired into ${c.migratedFiles.length} file(s), but ${c.leftovers.length} similar un-migrated site(s) remain: ${y}`,why:[`${c.helperShortName} is new in this diff and already referenced by ${c.migratedFiles.join(", ")}.`,`Helper shape: ${c.helperShape}; ${c.specificHelperCalleeCount}/${c.helperCalleeCount} helper callees are specific enough to score.`,`Unchanged site(s) still contain the helper's callee pattern: ${y}.`,`Migration scope hints: ${h}.`],remediation:m?`Migrate same-scope sites to ${c.helperShortName}; review possible subtype/variant sites before applying the helper.`:`Migrate the remaining sites to ${c.helperShortName}, or confirm they are intentionally different.`})}}function st(e,i,t,n,o){let s=H(e).directionalCoChangePairsForFiles(i,{minTogether:t,minConfidence:0,maxFilesPerCommit:20});if(!s){o.skipped.push({check:"co-change-partner",reason:"no git history"});return}o.checksRun.push("co-change-partner");let r=new Set,l;for(let a of s){let c=i.has(a.fileA),y=i.has(a.fileB);if(c===y)continue;let h=c?a.fileA:a.fileB,f=c?a.fileB:a.fileA,p=c?a.changesA:a.changesB,m=p>0?a.together/p:0;if(m<n||B(f)||B(h)||!me(`${e.config.projectRoot}/${f}`))continue;let d=`${h}|${f}`;if(r.has(d))continue;r.add(d);let u=D("co-change-partner",h,f,String(a.together)),b=_(h,f),C=z({fileA:h,fileB:f,together:a.together,confidence:m,commitScope:a.commitScope,recency:a.recency,subjectContext:a.subjectContext},b,(l??=O(e))(h,f)),R=[h,f].sort().join("|");o.findings.push({id:u,check:"co-change-partner",severity:"warning",evidence:"change-graph",actionTier:"signal",groupKey:`co-change-partner:${R}`,confidence:m,file:h,relatedFiles:[f],sourceAnalyzer:"co-change",rootCauseKey:R,partnerClass:b.partnerClass,partnerClassReasons:b.reasons,commitScope:a.commitScope,recency:a.recency,focusedTogether:a.focusedTogether,broadTogether:a.broadTogether,broadCommitRatio:a.broadCommitRatio,lastTogetherAt:a.lastTogetherAt,recentTogether:a.recentTogether,subjectContext:a.subjectContext,...C?{declaredCouplingSuggestion:C}:{},message:`${h} changed, but ${f} did not \u2014 they change together ${a.together}x (${Math.round(m*100)}% of the time)`,why:[`${h} is in this diff and ${f} is not.`,`Git history shows ${a.together} co-change(s), which is ${Math.round(m*100)}% of changes to the edited side.`,`History context: ${at(a)}.`,`Subject context: ${ct(a.subjectContext)}.`,...lt(a),`Partner class: ${b.partnerClass} (${b.reasons.join("; ")}).`],remediation:C?`Update ${f} alongside this change, declare the coupling "${C.name}", or confirm the coupling no longer holds.`:`Update ${f} alongside this change, or confirm the coupling no longer holds.`})}}function at(e){return`${e.commitScope}/${e.recency}; ${e.focusedTogether} focused, ${e.broadTogether} broad-sweep (${Math.round(e.broadCommitRatio*100)}% broad), ${e.recentTogether} recent, last ${ft(e.lastTogetherAt)}`}function ct(e){let i=e.subjectLabels.length>0?e.subjectLabels.slice(0,5).join(", "):"none inferred",t=e.issueRefs.length>0?e.issueRefs.slice(0,5).join(", "):"none",n=e.sampleSubjects.length>0?e.sampleSubjects.slice(0,3).map(o=>`"${o}"`).join("; "):"none";return`labels ${i}; refs ${t}; samples ${n}; external issue/PR labels ${e.externalIssueLabelStatus}`}function lt(e){let i=[];return e.commitScope==="broad-sweep"&&i.push("Broad-sweep history is weaker than focused co-edits; confirm this is a real coordination contract."),e.recency==="stale"&&i.push("The pair has no co-change in the recent history window; confirm the coupling still holds."),i}function ft(e){return e<=0?"unknown":new Date(e*1e3).toISOString().slice(0,10)}function dt(e,i,t,n,o){o.checksRun.push("doc-reference");let s=w.referenceTargets(e,i,n);if(s.size!==0)for(let r of Y(e,s)){if(t.has(r.doc))continue;let l=r.citedClaims.length>0?r.citedClaims:w.citationContexts(e,r.doc,r.cited),a=w.classifyCitation(l),c=D("doc-reference",r.doc,r.cited.join("|"));k(o,{id:c,check:"doc-reference",severity:"warning",evidence:"change-graph",actionTier:a.actionTier,confidence:1,file:r.doc,relatedFiles:r.cited,citationKind:a.citationKind,citationKindReasons:a.reasons,citedClaims:l,message:`${r.doc} cites ${r.cited.join(", ")} as ${w.citationKindLabel(a.citationKind)} \u2014 changed in this diff, doc untouched`,why:[`${r.cited.join(", ")} changed in this diff.`,`${r.doc} cites the changed file(s) but was not updated in the same diff.`,...a.reasons.map(y=>`Citation kind evidence: ${y}`)],remediation:w.citationRemediation(a.citationKind,r.doc)})}}function ut(e,i,t){t.checksRun.push("unused-params");for(let n of ce(e,{files:i,limit:50})){let o=D("unused-params",n.symbol,n.file,n.unusedTrailing.join("|"));k(t,{id:o,check:"unused-params",severity:"warning",evidence:"heuristic",confidence:.85,file:n.file,startLine:n.startLine,endLine:n.endLine,symbol:n.symbol,message:`${n.shortName} (${n.file}) has trailing unused parameter(s): ${n.unusedTrailing.join(", ")}`,why:[`${n.shortName} is in a changed file.`,`The trailing parameter(s) ${n.unusedTrailing.join(", ")} are not referenced in the function body.`],remediation:"Drop the unused trailing parameters and their call-site arguments."})}}function ht(e,i,t,n){n.checksRun.push("new-dead");let o=new I(e);for(let s of i){if(t(s)||s.fanIn>0||o.fileKind(s.file)==="test"||F(e,s.file)||v(e,s.symbol,s.file)||gt(s.symbol))continue;let r=D("new-dead",s.symbol,s.file);k(n,{id:r,check:"new-dead",severity:"warning",evidence:"graph-fact",confidence:.9,file:s.file,symbol:s.symbol,message:`${s.shortName} (${s.file}) was changed but has zero indexed consumers`,why:[`${s.shortName} is a changed production symbol.`,"The index reports zero consumers for this symbol.","The symbol is not in a detected entry surface or configured live root."],remediation:"Wire it up, or remove it before it becomes permanent dead code."})}}function gt(e){if(P(e)!=="type")return!1;let i=T(e);return i.startsWith("_Assert")||i.startsWith("Assert")}function mt(e,i,t,n){let o=new Map(t.renamedFiles.map(r=>[r.to,r.from])),s=n??L(e,i,K(t));return r=>{let l=o.get(r.file)??r.file,a=T(r.symbol);if(!a)return!1;let c=s(l);return c!==null&&pt(c,a)}}function pt(e,i){return new RegExp(`\\b${yt(i)}\\b`).test(e)}function yt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function bt(e,i){if(!me(j(e))){i.skipped.push({check:"baseline",reason:"no .scipquery-baseline.json \u2014 run health --write-baseline to enable"});return}i.checksRun.push("baseline");let t=ue(e);for(let n of t.newFindings){let o=le(n),s=D("baseline",n);k(i,{id:s,groupKey:`baseline:${o.sourceAnalyzer}:${o.rootCauseKey}`,check:"baseline",severity:"error",evidence:"baseline",actionTier:o.actionTier,confidence:1,file:o.file,relatedFiles:o.relatedFiles.length>0?o.relatedFiles:void 0,sourceAnalyzer:o.sourceAnalyzer,rootCauseKey:o.rootCauseKey,message:`new ${o.label} vs committed baseline: ${n}`,why:["A committed health baseline exists.","The current health result contains a finding not present in that baseline.",`Underlying analyzer: ${o.sourceAnalyzer}.`,`Inherited action tier: ${o.actionTier}.`,`Root cause key: ${o.rootCauseKey}.`,...o.why],remediation:o.remediation})}}function D(e,...i){return`SQ${Oe("sha256").update([e,...i].join("\0")).digest("hex").slice(0,12).toUpperCase()}`}export{de as a,Mt as b,ue as c,ni as d,oi as e,mt as f};
|
|
4
|
-
//# sourceMappingURL=chunk-RGKRYO22.js.map
|
package/dist/chunk-RM2WQ75T.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{b as D,f as H,g as O}from"./chunk-WUOB4DHH.js";import{a as x}from"./chunk-BGBBVSH4.js";import{b as X,c as Z,d as $}from"./chunk-L446VQYQ.js";import{c as U}from"./chunk-RSSXKJ6J.js";import{a as _,k as z,l as J,n as N,o as Q}from"./chunk-UQ73QF5D.js";import{a as B}from"./chunk-F6IXELII.js";import{b as K}from"./chunk-ULHLDOD6.js";import{f as I,h as W,i as Y,j as P}from"./chunk-63CI3IXR.js";import{a as j,g as k,h as T,j as V,k as G}from"./chunk-NABVR6B7.js";import{j as F}from"./chunk-THB6AM3V.js";import{a as w,d as h,e as R,f as A}from"./chunk-SA3DPTHT.js";import{c as E}from"./chunk-AREANYIA.js";import{a as q}from"./chunk-64MNV6AB.js";function ee(n,e,t){let r=e.identifierResolution==="strict"?N:Q,l=e.candidateNames?z(e.candidateNames):null,o=0,f=0,m=0,p=0,y="";for(let a of e.paths)if(o+=1,y=a,!(!R(a)&&!(e.includeVueSfc&&A(a)))&&!n.isIgnored(a)&&!e.skipPath?.(a))try{if(l&&!J(w(n,a),l))continue;f+=1;let S=(s,u,v,b)=>{if(e.candidateNames&&!e.candidateNames.has(s))return;m+=1;let g=e.resolveTargets?e.resolveTargets({sourceFile:a,name:s,kind:u,defaultTargets:b}):b();for(let L of g)p+=1,t({sourceFile:a,name:s,target:L,occurrences:v,kind:u})},M=_(n,a);for(let[s,u]of M)S(s,"identifier",u.length,()=>r(n,a,s));for(let s of F(n,a,{includeCrossLanguageDispatchNames:e.includeCrossLanguageDispatchNames,includeRustAttributeNames:e.includeRustAttributeNames})){let u=s.kind==="cross-language-dispatch"?()=>N(n,a,s.name):()=>r(n,a,s.name);S(s.name,s.kind,s.occurrences,u)}}finally{e.afterPath?.(a),o%10===0&&K("source-reference-scan.progress",()=>{},()=>({scannedPaths:o,currentPath:y,candidateMatchedPaths:f,visitedNames:m,visitedHits:p}))}}function ne(n,e={}){let{scope:t,files:r,minLoc:l=1,maxLoc:o=Number.POSITIVE_INFINITY,excludeSymbol:f,excludeEntrySurfaces:m=!1,excludeTypesFiles:p=!1,excludeRootedSymbols:y=!1,requireFunctionLikeSymbol:a=!1,requireCallableSymbol:C=!1,excludeRustTraitImplMembers:S=!1,includeSuppressed:M=!1,sortByLocDesc:s=!1}=e,u=[],v=re(n,{scope:t,files:r,requireFunctionLikeSymbol:a,requireCallableSymbol:C}),b=new Map,g=new Map,L=i=>{let c=b.get(i);if(c!==void 0)return c;let d=H(n,i);return b.set(i,d),d},ie=i=>{let c=g.get(i);if(c!==void 0)return c;let d=D(i);return g.set(i,d),d};for(let i of v){let c=i.relativePath;if(n.isIgnored(c)||m&&L(c)||!oe(i,{requireFunctionLikeSymbol:a,requireCallableSymbol:C})||f!==void 0&&i.symbol===f)continue;let d=x(i);d<l||d>o||p&&ae(c)||y&&O(n,i.symbol,c)||S&&V(i.symbol)||ie(c)!=="test"&&(G(i.symbol)||!M&&h(n,c,i.startLine)||u.push(i))}return s?u.sort((i,c)=>x(c)-x(i)):u}function re(n,e){return e.files!==void 0?[...new Set(e.files.map(r=>r.replace(/\\/g,"/")))].sort().filter(r=>!e.scope||r.includes(e.scope)).flatMap(r=>I(n,r)):e.requireCallableSymbol?P(n,{scope:e.scope,symbolMatches:k,sqlPrefilter:"callable"}):e.requireFunctionLikeSymbol?P(n,{scope:e.scope,symbolMatches:T,sqlPrefilter:"function-like"}):Y(n,e.scope)}function oe(n,e){return e.requireCallableSymbol?k(n.symbol):e.requireFunctionLikeSymbol?T(n.symbol):n.isFunctionLike}function ae(n){return(n.split("/").pop()??"").includes("types")}var te=class{constructor(e){this.db=e}db;scopedDefinitions(e){return W(this.db,e)}definitionsForFile(e){return I(this.db,e)}productionCallableDefinitions(e={}){return ne(this.db,e)}calleeMap(e,t={}){return U(this.db,e,t)}crossFileCallerMap(e,t={}){return X(this.db,e,t)}sourceFallbackCallerFiles(e,t={}){return Z(this.db,e,t)}callerFileMap(e,t={}){return $(this.db,e,t)}frameworkReferencedSymbolIds(e){let t=new Map;for(let l of e){if(!l.leaf)continue;let o=t.get(l.leaf)??[];o.push(l.symbolId),t.set(l.leaf,o)}let r=new Set;for(let l of q(this.db,{includeIgnored:!1}))if(R(l)==="rust")for(let{name:o}of F(this.db,l,{includeRustAttributeNames:!0}))for(let f of t.get(o)??[])r.add(f);return r}symbolsWithNonSelfCallees(e,t={}){if(e.length===0)return new Set;let r=new Map(e.map(o=>[o.symbolId,o.symbol])),l=this.calleeMap(e,t);return new Set([...l.entries()].filter(([o,f])=>{let m=r.get(o);return f.some(p=>p.symbol!==m)}).map(([o])=>o))}fileDependencyGraph(e){return B(this.db,e)}fileKind(e){return D(e)}hasSuppressionComment(e){return h(this.db,e.relativePath,e.startLine)}sourceFiles(){return E(this.db)}scanSourceReferences(e,t){ee(this.db,e,t)}callableSignature(e){let t=j(this.db).forFile(e.relativePath,{facts:!0}).facts?.callables.find(r=>r.startLine===e.startLine&&r.endLine===e.endLine);return t?{paramCount:t.paramCount}:null}};export{te as a};
|
|
2
|
-
//# sourceMappingURL=chunk-RM2WQ75T.js.map
|
package/dist/chunk-ROGZXWN2.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{b as se}from"./chunk-B75HZHUP.js";import{a as N}from"./chunk-RM2WQ75T.js";import{b as q,e as J,f as $,g as G}from"./chunk-WUOB4DHH.js";import{a as ie}from"./chunk-L446VQYQ.js";import{c as Q,d as Y,e as ee,f as te,g as P,m as re}from"./chunk-UQ73QF5D.js";import{e as ne}from"./chunk-CYHIKTJN.js";import{b}from"./chunk-ULHLDOD6.js";import{j as X,o as _}from"./chunk-63CI3IXR.js";import{d as W,g as U,h as H,i as V,j as K,k as Z}from"./chunk-NABVR6B7.js";import{l as z}from"./chunk-THB6AM3V.js";import{a as w,e as j,h as I}from"./chunk-SA3DPTHT.js";import{b as O,j as B}from"./chunk-SGTKURU6.js";import{a as R}from"./chunk-64MNV6AB.js";import{b as L}from"./chunk-7S5E7KWT.js";var x=new WeakMap,oe=B({kind:"definition-exclusions",serialize:e=>JSON.stringify(e),deserialize:ve});function ce(e,t){let n=j(t);if(!(n==="rust"||n==="typescript"||n==="tsx"||n==="javascript"))return[];let r=w(e,t);if(!r)return[];let s=O(e,t,r),a=oe.read(e,t,s);if(a)return a;let u=n==="rust"?Fe(e,t):Ie(e,t);return oe.write(e,t,s,u),u}function ve(e){try{let t=JSON.parse(e);return!Array.isArray(t)||!t.every(De)?null:t}catch{return null}}function De(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.startLine!="number"||!Number.isFinite(t.startLine)||typeof t.endLine!="number"||!Number.isFinite(t.endLine)||typeof t.reason!="string"?!1:t.containerName===void 0||typeof t.containerName=="string"}var le=new Set(["describe","it","test","fdescribe","fit","xdescribe","xit","beforeEach","afterEach","beforeAll","afterAll","before","after","suite","bench","benchmark"]),Le=/\b(?:describe|it|test|fdescribe|fit|xdescribe|xit|beforeEach|afterEach|beforeAll|afterAll|before|after|suite|bench|benchmark)\s*\(/,we=/\b(?:export\s+)?(?:async\s+)?function\s+use[A-Z][A-Za-z0-9_$]*\b|\b(?:const|let|var)\s+use[A-Z][A-Za-z0-9_$]*\s*(?::[^=;]+)?=\s*(?:async\s*)?(?:function\b|(?:<[^=;{]+>\s*)?(?:\([^)]*\)|[A-Za-z_$][\w$]*)\s*=>)/;function Ie(e,t){let n=w(e,t);if(!n||!Pe(n))return[];let i=I(e,t);if(!i)return[];let r=x.get(i);if(r)return r;let s=!1,a=i.rootNode;for(let l of a.namedChildren){if(l.type!=="expression_statement")continue;let d=l.namedChild(0);if(!d||d.type!=="call_expression")continue;let o=d.namedChild(0);if(!o)continue;let c=o.type==="member_expression"?o.namedChild(o.namedChildCount-1)?.text:o.text;if(c&&le.has(c)){s=!0;break}}let u=[];s&&u.push({startLine:0,endLine:a.endPosition.row,reason:"TS/JS test file (describe/it/test at top level)"});for(let l of a.namedChildren){let d=null,o=null;if(l.type==="function_declaration")d=l.namedChild(0)?.text??null,o=l;else if(l.type==="export_statement"){let c=l.namedChild(0);c?.type==="function_declaration"&&(d=c.namedChild(0)?.text??null,o=c)}else if(l.type==="lexical_declaration"){let c=l.namedChild(0);if(c?.type==="variable_declarator"){let p=c.namedChild(0)?.text,m=c.namedChild(1);p&&(m?.type==="arrow_function"||m?.type==="function_expression")&&(d=p,o=c)}}d&&/^use[A-Z]/.test(d)&&o&&u.push({startLine:o.startPosition.row,endLine:o.endPosition.row,reason:"React custom hook (use*)"})}return u.push(...ue(i,new Set(["function_declaration","method_definition","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","variable_declarator","export_statement"]),new Set(["comment"]))),x.set(i,u),u}function Pe(e){if(e.includes("scip-query"))return!0;let t=!1;for(let n of le)if(e.includes(n)){t=!0;break}return t&&Le.test(e)?!0:e.includes("use")&&we.test(e)}var Ne=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale)?/i;function ke(e){return Ne.test(e)}function ue(e,t,n){let i=[],r=s=>{if(t.has(s.type)&&s.parent){let u=s.parent.children,l=-1;for(let d=0;d<u.length;d+=1)if(u[d].startIndex===s.startIndex&&u[d].type===s.type){l=d;break}if(l>0)for(let d=l-1;d>=0;d-=1){let o=u[d];if(n.has(o.type)){if(ke(o.text)){i.push({startLine:s.startPosition.row,endLine:s.endPosition.row,reason:"scip-query suppression comment"});break}continue}if(!(o.type==="attribute_item"||o.type==="inner_attribute_item"))break}}for(let a of s.namedChildren)r(a)};return r(e.rootNode),i}function Fe(e,t){let n=I(e,t);if(!n)return[];let i=x.get(n);if(i)return i;let r=[],s=Te(n);return s?(x.set(n,s),s):(de(n.rootNode,r,!1,!1),r.push(...ue(n,new Set(["function_item","function_signature_item","struct_item","enum_item","union_item","impl_item","mod_item","static_item","const_item"]),new Set(["line_comment","block_comment"]))),r.push(...Ue(n.rootNode)),x.set(n,r),r)}function Te(e){return He(e.rootNode)?[{startLine:0,endLine:e.rootNode.endPosition.row,reason:"generated file (@generated header)"}]:null}function de(e,t,n,i){let r=n,s=i;e.type==="trait_item"&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait declaration body (dynamic dispatch)"}),e.type==="impl_item"&&e.childForFieldName("trait")&&(s=!0,t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl block (dynamic dispatch)"})),e.type==="function_item"||e.type==="function_signature_item"?Me(e,t,n,i):i&&We(e)?t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl associated item (dynamic dispatch)"}):e.type==="struct_item"||e.type==="enum_item"||e.type==="union_item"?Ae(e,t,n):e.type==="mod_item"&&k(e).some(a=>/#\[\s*cfg\s*\(\s*test\s*\)/.test(a))&&(r=!0);for(let a of e.namedChildren)de(a,t,r,s)}function Me(e,t,n,i){let r=k(e),s=null;i?s="trait impl method (dynamic dispatch)":n&&(s="inside #[cfg(test)] mod");for(let a of r){let u=Be(a);if(u){s=u;break}if(fe(a)){s="#[allow(dead_code)]";break}}s&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:s})}function Ae(e,t,n){let i=k(e),r=e.namedChildren.find(s=>s.type==="type_identifier")?.text;i.some(ze)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[derive(<reflective>)] \u2014 fields accessed via macro/reflection",containerName:r}),i.some(fe)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[allow(dead_code)]",containerName:r}),n&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"inside #[cfg(test)] mod",containerName:r})}function k(e){let t=e.parent;if(!t)return[];let n=t.children,i=-1;for(let s=0;s<n.length;s+=1)if(n[s].startIndex===e.startIndex&&n[s].type===e.type){i=s;break}if(i<=0)return[];let r=[];for(let s=i-1;s>=0;s-=1){let a=n[s];if(a.type==="attribute_item"||a.type==="inner_attribute_item")r.push(a.text);else{if(a.type==="line_comment"||a.type==="block_comment")continue;break}}return r}var Oe=[{re:/#\[\s*tauri::command\b/,reason:"#[tauri::command]"},{re:/#\[\s*command\b/,reason:"#[command]"},{re:/#\[\s*test\b/,reason:"#[test]"},{re:/#\[\s*bench\b/,reason:"#[bench]"},{re:/#\[\s*tokio::test\b/,reason:"#[tokio::test]"},{re:/#\[\s*async_std::test\b/,reason:"#[async_std::test]"},{re:/#\[\s*wasm_bindgen\b/,reason:"#[wasm_bindgen]"},{re:/#\[\s*no_mangle\b/,reason:"#[no_mangle]"},{re:/#\[\s*napi\b/,reason:"#[napi]"},{re:/#\[\s*pyfunction\b/,reason:"#[pyfunction]"},{re:/#\[\s*pymethod\b/,reason:"#[pymethod]"},{re:/#\[\s*pyo3\b/,reason:"#[pyo3]"},{re:/#\[\s*cfg\s*\(\s*test\s*\)/,reason:"#[cfg(test)]"},{re:/#\[\s*doc\s*\(\s*hidden\s*\)/,reason:"#[doc(hidden)]"}];function Be(e){return Oe.find(({re:t})=>t.test(e))?.reason??null}var je=[/\bSerialize\b/,/\bDeserialize\b/,/\bFromRow\b/,/\bsqlx::FromRow\b/,/\bDeriveEntityModel\b/,/\bIntoSchema\b/,/\bToSchema\b/,/\bDeriveValueType\b/,/\bError\b/,/\bthiserror::Error\b/];function ze(e){return/#\[\s*derive\s*\(/.test(e)?je.some(t=>t.test(e)):!1}function fe(e){return/#\[\s*allow\s*\(\s*dead_code\s*\)/.test(e)}function We(e){return e.type==="const_item"||e.type==="type_item"||e.type==="static_item"||e.type==="associated_type"}function Ue(e){let t=Ke(e);if(t.size===0)return[];let n=[];for(let i of e.descendantsOfType("mod_item")){let r=i.childForFieldName("name")?.text;r&&t.has(r)&&n.push({startLine:i.startPosition.row,endLine:i.endPosition.row,reason:'serde `with = "..."` module \u2014 body invoked via reflection',containerName:r})}return n}function He(e){for(let t=0;t<Math.min(e.namedChildCount,12);t+=1){let n=e.namedChild(t);if(!n||n.type!=="line_comment"&&n.type!=="block_comment")break;if(/@generated\b/.test(n.text)||/This file is .*generated\b/i.test(n.text)||/Code generated by/i.test(n.text)||/Generated by:\s*https?:\/\/openapi-generator/i.test(n.text)||/openapi-generator/i.test(n.text)&&/Generated by/i.test(n.text))return!0}return!1}var Ve=/^#!?\[\s*serde\s*\(/,ae=/\bwith\s*=\s*"([^"]+)"/g;function Ke(e){let t=new Set;for(let n of e.descendantsOfType("attribute_item")){if(!Ve.test(n.text))continue;ae.lastIndex=0;let i;for(;(i=ae.exec(n.text))!==null;){let r=i[1],s=r.split("::").pop()??r;s&&t.add(s)}}return t}function me(e){let t=new Map,n=i=>{let r=t.get(i);if(r)return r;let s=ce(e,i);return r={ranges:s.map(a=>({startLine:a.startLine,endLine:a.endLine})),containers:new Set(s.map(a=>a.containerName).filter(a=>!!a))},t.set(i,r),r};return(i,r,s,a)=>{let u=n(i);for(let l of u.ranges)if(r>=l.startLine&&r<=l.endLine)return!0;if(a&&u.containers.has(a))return!0;for(let l of _(s))if(u.containers.has(l))return!0;return!1}}function yt(e,t={}){L(e,{groups:t.semanticProvider===!0?["whole-project","semantic-provider"]:["whole-project"]})}function pe(e,t,n={}){L(e,{groups:n.definitions===!0?["source-file","definition-catalog"]:["source-file"],file:t.replace(/\\/g,"/")})}function be(e,t){return t.isIgnoredPath(e.relativePath)?y("ignored-file"):V(e.symbol)?y("module-like-symbol"):E(e.symbol)?!e.isFunctionLike&&e.enclosingSymbol&&E(e.enclosingSymbol)?y("nested-non-callable-value"):!t.includeTests&&!S(e.relativePath)?y("test-file"):!t.includeTests&&t.isExcludedRegion(e.relativePath,e.startLine,e.symbol,e.parentTypeName)?y("excluded-file-region"):K(e.symbol)?y("rust-trait-impl-member"):Z(e.symbol)?y("rust-test-module"):!t.includeMembers&&!Ze(e)?y("member"):e.endLine-e.startLine+1<t.minLoc?y("below-min-loc"):{accepted:!0}:y("non-value-symbol")}function S(e){return q(e)!=="test"}function y(e){return{accepted:!1,rejectionReason:e}}function E(e){return H(e)||e.endsWith("().")||e.endsWith(".")}function Ze(e){return U(e.symbol)||_(e.symbol).length===0}function ye(){return new Map}function ge(e,t,n){let i=new Map;for(let r of Q(e,n))e.isIgnored(r.relative_path)||t.has(r.relative_path)||v(i,r.symbol_id,r.relative_path,r.ref_count,"scip-mention");return i}function he(e,t,n,i={}){let r=new Set;if(i.conservative||n.size===0){for(let s of ee(e,t))r.add(s.symbol_id);return r}for(let s of Y(e,t))e.isIgnored(s.relative_path)||n.has(s.relative_path)||r.add(s.symbol_id);return r}function F(e,t){let n=e.get(t);if(!n)return!1;for(let i of n.values())if(i.occurrences>0)return!0;return!1}function C(e,t,n){let i=e.get(t);if(!i)return!1;for(let[r,s]of i)if(r!==n&&s.occurrences>0)return!0;return!1}function xe(e){return e?.occurrences??0}function v(e,t,n,i,r="source-fallback"){if(i<=0)return;let s=Re(e,t,n);s.occurrences+=i,s.sources.add(r)}function Se(e,t,n,i,r){if(i<=0)return;let s=Re(e,t,n);s.occurrences=Math.max(i,s.occurrences),s.sources.add(r)}function Re(e,t,n){let i=e.get(t);i||(i=new Map,e.set(t,i));let r=i.get(n);return r||(r={occurrences:0,sources:new Set},i.set(n,r)),r}var qe=3e3,Je=1e3;function Wt(e,t={}){let{scope:n,minLoc:i=1,includeTests:r=!1,skipBarrels:s=!1,includeMembers:a=!1,deadCodeOnly:u=!1,scanLimit:l,semantic:d=!0}=t,o=0,c=b("dead.candidates",()=>{let f=se($e(e,{scope:n,minLoc:i,includeTests:r,includeMembers:a}),l);return o=f.length,f},()=>({definitions:o})),p=0,m=s?b("dead.inactive-barrels",()=>{let f=new Set(J(e));return p=f.size,f},()=>({paths:p})):new Set,T=0,g=u?ye():b("dead.mention-reference-counts",()=>{let f=ge(e,m,c.map(D=>D.symbolId));return T=f.size,f},()=>({definitions:c.length,symbolsWithReferences:T})),M=0,Ee=u?b("dead.mentioned-symbol-ids",()=>{let f=he(e,c.map(D=>D.symbolId),m,{conservative:m.size===0});return M=f.size,f},()=>({definitions:c.length,referencedSymbols:M})):new Set,h=u?c.filter(f=>!Ee.has(f.symbolId)):c.filter(f=>!C(g,f.symbolId,f.relativePath));u?b("dead.source-fallback.dead-code-only",()=>et(e,h,g,{includeTests:r,inactiveBarrelPaths:m}),()=>({definitions:h.length,includeTests:r})):b("dead.source-fallback.ast",()=>Ye(e,h,g,{includeTests:r,inactiveBarrelPaths:m}),()=>({definitions:h.length,includeTests:r}));let A=u?h.filter(f=>!F(g,f.symbolId)):h.filter(f=>!C(g,f.symbolId,f.relativePath));b("dead.caller-map-supplement",()=>st(e,A,g,{includeTests:r,inactiveBarrelPaths:m,includeSemantic:!u&&d}),()=>({definitions:A.length,semantic:!u&&d}));let Ce=u?h.filter(f=>!F(g,f.symbolId)):c;return Qe(e,Ge(Ce,g))}function $e(e,t){let n=me(e),i=[];for(let r of X(e,{scope:t.scope,symbolMatches:E,sqlPrefilter:"function-like"}))be(r,{minLoc:t.minLoc,includeTests:t.includeTests,includeMembers:t.includeMembers,isIgnoredPath:a=>e.isIgnored(a),isExcludedRegion:n}).accepted&&i.push(r);return i}function Ge(e,t){return e.map(n=>Xe(n,t)).filter(n=>n.cross_file_refs===0).sort((n,i)=>i.loc-n.loc||n.relative_path.localeCompare(i.relative_path)||n.start_line-i.start_line)}function Xe(e,t){let n=t.get(e.symbolId)??new Map,i=xe(n.get(e.relativePath)),r=0;for(let[s,a]of n)s!==e.relativePath&&(r+=a.occurrences);return{relative_path:e.relativePath,start_line:e.startLine,end_line:e.endLine,loc:e.endLine-e.startLine+1,symbol:e.symbol,same_file_refs:i,cross_file_refs:r}}function Qe(e,t){let n=[],i=0,r=0,s=0;for(let a of t){if(e.isIgnored(a.relative_path)||$(e,a.relative_path)||G(e,a.symbol,a.relative_path))continue;let u=a.same_file_refs===0?"dead-code":"file-internal";u==="dead-code"?i++:r++,s+=a.loc,n.push({relativePath:a.relative_path,startLine:a.start_line,endLine:a.end_line,loc:a.loc,symbol:a.symbol,shortName:W(a.symbol),sameFileRefs:a.same_file_refs,kind:u})}return{symbols:n,counts:{total:n.length,deadCode:i,fileInternal:r,loc:s},totalCount:n.length,deadCodeCount:i,fileInternalCount:r,totalLoc:s}}function Ye(e,t,n,i){if(t.length===0)return;let r=new N(e),s=new Set(t.map(l=>l.symbolId)),a=new Set(t.map(l=>l.leaf).filter(Boolean)),u=new Set(r.sourceFiles());for(let l of R(e))u.add(l);r.scanSourceReferences({paths:u,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:a,skipPath:l=>i.inactiveBarrelPaths.has(l)||!i.includeTests&&!S(l)},l=>{s.has(l.target.symbolId)&&(rt(e,l)||v(n,l.target.symbolId,l.sourceFile,it(l),"source-fallback"))})}function et(e,t,n,i){if(t.length===0)return;let r=new N(e),s=tt(t),a=new Set(r.sourceFiles());for(let o of R(e))a.add(o);let u=new Set(s.keys()),l=new Map,d=o=>{let c=l.get(o);return c||(c=re(e,o),l.set(o,c)),c};r.scanSourceReferences({paths:a,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:u,skipPath:o=>i.inactiveBarrelPaths.has(o)||!i.includeTests&&!S(o),resolveTargets:({sourceFile:o,name:c,kind:p})=>{let m=s.get(c);return m?nt(o,c,m,()=>d(o),{permissive:p!=="cross-language-dispatch"}):[]},afterPath:o=>{l.delete(o),pe(e,o)}},o=>{let c=o.kind==="identifier"&&o.sourceFile===o.target.relativePath?Math.max(0,o.occurrences-1):o.occurrences;o.kind==="identifier"&&_e(e,{sourceFile:o.sourceFile,name:o.name,target:o.target,occurrences:c})||v(n,o.target.symbolId,o.sourceFile,c,"source-fallback")})}function tt(e){let t=new Map;for(let n of e){if(!n.leaf)continue;let i=t.get(n.leaf)??[];i.push(n),t.set(n.leaf,i)}return t}function nt(e,t,n,i,r){let s=n.filter(d=>d.relativePath===e);if(s.length>0)return s;if(!r.permissive&&n.length===1)return[...n];let a=i(),u=a.get(t);if(u)for(let d of u){let o=n.filter(c=>P(d,c.relativePath));if(o.length>0)return o}let l=new Set;for(let d of a.values())for(let o of d)l.add(o);for(let d of l){let o=n.filter(c=>P(d,c.relativePath));if(o.length>0&&o.length===n.length)return o}return r.permissive?[...n]:[]}function rt(e,t){return t.kind==="cross-language-dispatch"&&t.target.relativePath===t.sourceFile?!0:t.kind==="identifier"&&_e(e,t)}function it(e){return e.kind==="identifier"&&e.target.relativePath===e.sourceFile?Math.max(0,e.occurrences-1):e.occurrences}function _e(e,t){return t.occurrences>1?!1:z(e,t.sourceFile).some(n=>n.used||n.sourcePath!==t.target.relativePath?!1:n.importedName===t.name||n.localName===t.name)}function st(e,t,n,i){let r=i.includeSemantic!==!1,s=r&&t.length>=qe&&R(e).length>=Je,a=(o,c)=>{c===o.relativePath||e.isIgnored(c)||i.inactiveBarrelPaths.has(c)||!i.includeTests&&!S(c)||Se(n,o.symbolId,c,1,"caller-map")};if(s?b("dead.caller-map.mention-chunks",()=>ot(e,t,a),()=>({definitions:t.length})):b("dead.caller-map.per-symbol",()=>{for(let o of t){let c=ie(e,o,{semantic:r});if(c.length!==0)for(let p of c)a(o,p.file)}},()=>({definitions:t.length,semantic:r})),!s)return;let u=0,l=b("dead.caller-map.semantic-candidates",()=>{let o=t.filter(c=>!C(n,c.symbolId,c.relativePath));return u=o.length,o},()=>({definitions:t.length,semanticCandidates:u}));if(l.length===0)return;let d=ne(e,l);for(let o of l){let c=d.get(o.symbolId);if(c)for(let p of c)a(o,p)}}function ot(e,t,n){let i=new Map(t.map(r=>[r.symbolId,r]));for(let r of te(e,[...i.keys()])){let s=i.get(r.symbol_id);s&&n(s,r.relative_path)}}export{yt as a,Wt as b};
|
|
2
|
-
//# sourceMappingURL=chunk-ROGZXWN2.js.map
|
package/dist/chunk-RSSXKJ6J.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import{b as Y,g as Z,h as q,i as X,j as ee,q as se}from"./chunk-UQ73QF5D.js";import{a as ne,b as te,d as oe,f as ie}from"./chunk-CYHIKTJN.js";import{a as J}from"./chunk-F6IXELII.js";import{a as G,b as w}from"./chunk-ULHLDOD6.js";import{d as le,e as ae}from"./chunk-DVFP6PZI.js";import{f as Q,g as U,l as z,m as V}from"./chunk-63CI3IXR.js";import{e as W,g as K}from"./chunk-NABVR6B7.js";import{h as N,l as B}from"./chunk-THB6AM3V.js";import{a as A,e as v}from"./chunk-SA3DPTHT.js";import{a as H,b as k,d as j,f as $}from"./chunk-SGTKURU6.js";import{c as x,d as F}from"./chunk-7S5E7KWT.js";function Ke(e,n,o={}){let t=re(e,[n],{additive:o.additive,semantic:o.semantic}),i=o.callableOnly?(t.get(n.symbolId)??[]).filter(c=>K(c.symbol)||c.source==="ast-callsite"):t.get(n.symbolId)??[];return typeof o.limit=="number"?i.slice(0,o.limit):i}function Qe(e,n,o={}){let t=pe(e)?ye(e,n,{semantic:o.semantic!==!1}):be(e).get(n.symbolId)??[];return typeof o.limit=="number"?t.slice(0,o.limit):t}var ue=F("caller-rows",{clearGroups:["whole-project"]}),fe=2e4;function pe(e){return(e.get("SELECT COUNT(*) AS count FROM global_symbols")?.count??0)>fe}function be(e){return ue.get(e,()=>{let n=U(e),o=re(e,n),t=new Map;for(let l of n)t.set(l.symbol,l.symbolId);let i=new Map,c=new Map;for(let l of n){let a=o.get(l.symbolId);if(!(!a||a.length===0))for(let u of a){let m=t.get(u.symbol);if(m===void 0||m===l.symbolId)continue;let d=i.get(m);d||(d=[],i.set(m,d),c.set(m,new Set));let f=`${l.symbol}|${l.relativePath}`;c.get(m).has(f)||(c.get(m).add(f),d.push({symbol:l.symbol,file:l.relativePath,source:"caller-map-inversion"}))}}return i})}function ye(e,n,o){let t=[],i=new Set,c=a=>{if(a.symbol===n.symbol)return;let u=`${a.symbol}|${a.file}`;i.has(u)||(i.add(u),t.push(a))};for(let a of se(e,n))a.file!==n.relativePath&&c({symbol:a.enclosingSymbol??a.file,file:a.file,source:"resolved-reference"});let l=o.semantic?ge(e,n):null;if(l)for(let a of oe(e,l)){if(a.file===n.relativePath||e.isIgnored(a.file))continue;let u=V(Q(e,a.file),a.line);c({symbol:u?.symbol??a.file,file:a.file,source:"semantic-reference"})}return t}function ge(e,n){let o=le().join(", "),t=ae().join(", ");return e.get(`SELECT
|
|
2
|
-
d.id AS documentId,
|
|
3
|
-
gs.id AS symbolId,
|
|
4
|
-
gs.symbol,
|
|
5
|
-
d.relative_path AS relativePath,
|
|
6
|
-
COALESCE(der.start_line, c.start_line) AS startLine,
|
|
7
|
-
COALESCE(der.end_line, c.end_line) AS endLine,
|
|
8
|
-
COALESCE(gs.display_name, '') AS leaf,
|
|
9
|
-
NULL AS parentTypeName,
|
|
10
|
-
CASE WHEN gs.kind IN (${o}) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
|
|
11
|
-
CASE WHEN gs.kind IN (${t}) THEN 1 ELSE 0 END AS isTypeLike,
|
|
12
|
-
gs.kind AS kind,
|
|
13
|
-
gs.documentation AS documentation,
|
|
14
|
-
gs.enclosing_symbol AS enclosingSymbol
|
|
15
|
-
FROM global_symbols gs
|
|
16
|
-
LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
17
|
-
LEFT JOIN chunks c ON c.document_id = der.document_id
|
|
18
|
-
JOIN documents d ON d.id = COALESCE(der.document_id, c.document_id)
|
|
19
|
-
WHERE gs.id = ?
|
|
20
|
-
LIMIT 1`,n.symbolId)??null}function re(e,n,o={}){if(n.length===0)return new Map;let t=o.additive??!1,i=[],c=[];for(let d of n)v(d.relativePath)&&N(e,d.relativePath)!==null?i.push(d):c.push(d);let l=new Map,a=new Map,u=d=>{for(let[f,M]of d){let s=l.get(f);s||(s=[],l.set(f,s));let r=a.get(f);r||(r=new Set,a.set(f,r));for(let b of M){let g=`${b.symbol}|${b.chunkId}`;r.has(g)||(r.add(g),s.push(b))}}};i.length>0&&u(Me(e,i)),o.semantic!==!1&&u(De(he(e,n)));let m=t?n:c;return m.length>0&&u(Re(e,m)),l}function he(e,n){let o=G(),t=new Map,i=[],c=[],l=0,a=0,u=0,m=0;if(w("semantic.callees.cache-scan",()=>{for(let r of n){if(!ne(r.relativePath)){o&&(l+=1);continue}let b=A(e,r.relativePath);if(!b){o&&(a+=1),c.push(r);continue}let g=k(e,r.relativePath,b),L=_e(e,r.relativePath),_=j(e,r.relativePath,r.symbol,g,L);if(_!==null){let h=Se(_);if(h){o&&(u+=1),h.length>0&&t.set(r.symbolId,h);continue}o&&(m+=1)}i.push({def:r,contentHash:g,depsDigest:L})}},()=>({definitions:n.length,skippedNonTs:l,sourceMissing:a,cacheHits:u,parseFailures:m,misses:i.length,unkeyed:c.length,resultRows:t.size})),i.length===0&&c.length===0)return t;let d=[...c,...i.map(r=>r.def)],f=0,M=w("semantic.callees.compute-misses",()=>{let r=ie(e,d);return f=r.size,r},()=>({definitions:d.length,misses:i.length,unkeyed:c.length,rows:f}));for(let[r,b]of M)t.set(r,b);if(te(e).capability("semantic-callees").available){let r=i.map(b=>({relativePath:b.def.relativePath,symbol:b.def.symbol,contentHash:b.contentHash,depsDigest:b.depsDigest,payload:JSON.stringify(M.get(b.def.symbolId)??[])}));w("semantic.callees.cache-write",()=>$(e,r),()=>({entries:r.length}))}else w("semantic.callees.cache-write-skip",()=>{},()=>({reason:"provider-unavailable",misses:i.length}));return t}function Se(e){try{return JSON.parse(e)}catch{return null}}var Ce=x("semantic-deps-digest",{clearGroups:["whole-project","source-file"]});function _e(e,n){return Ce.get(e,n,()=>{let t=[...J(e).get(n)??[]].sort().map(i=>`${i}:${k(e,i,A(e,i))}`);return H(t.join("|"))})}function Me(e,n){let o=new Map,t=Ie(n,o),i=ee(e);for(let[c,l]of t){let a=N(e,c);if(!a)continue;let u=z(l);for(let m of a){let d=u.get(m.line);if(!d)continue;let f=we(e,c,i,m);f&&f.symbol!==d.symbol&&o.get(d.symbolId).push({symbol:f.symbol,file:f.file,chunkId:m.line,source:"ast-callsite"})}}return o}function Ie(e,n){let o=new Map;for(let t of e){let i=o.get(t.relativePath);i?i.push(t):o.set(t.relativePath,[t]),n.set(t.symbolId,[])}for(let t of o.values())t.sort((i,c)=>i.endLine-i.startLine-(c.endLine-c.startLine));return o}function we(e,n,o,t){let i=q(n,o.get(t.calleeLeaf)??[]);if(i.length===0)return null;let c=Le(e,n,i,t.calleeQualifier);return c||X(e,n,i,t.memberAccess)}function Le(e,n,o,t){if(!t||v(n)!=="clojure")return null;let c=B(e,n).filter(l=>l.kind==="namespace"&&l.localName===t&&l.sourcePath).map(l=>l.sourcePath);for(let l of c){let a=o.find(u=>Z(l,u.file));if(a)return a}return o.find(l=>/`([^`]+)`\//.exec(l.symbol)?.[1]===t)??null}function Re(e,n){if(n.length===0)return new Map;let t=O(n.map(s=>s.documentId)).flatMap(s=>e.all(`SELECT c.document_id, c.id AS chunk_id, c.start_line, c.end_line, m.symbol_id
|
|
21
|
-
FROM mentions m
|
|
22
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
23
|
-
WHERE m.role != 1
|
|
24
|
-
AND c.document_id IN (${s.map(()=>"?").join(",")})`,...s)),i=new Map;for(let s of t)i.has(s.document_id)||i.set(s.document_id,[]),i.get(s.document_id).push(s);let l=O(t.map(s=>s.symbol_id)).flatMap(s=>e.all(`SELECT gs.id AS symbol_id, gs.symbol,
|
|
25
|
-
COALESCE(der.document_id, def_chunk.document_id) AS document_id
|
|
26
|
-
FROM global_symbols gs
|
|
27
|
-
LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
28
|
-
LEFT JOIN (
|
|
29
|
-
SELECT m.symbol_id, MIN(c.document_id) AS document_id
|
|
30
|
-
FROM mentions m
|
|
31
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
32
|
-
WHERE m.role = 1
|
|
33
|
-
AND m.symbol_id IN (${s.map(()=>"?").join(",")})
|
|
34
|
-
GROUP BY m.symbol_id
|
|
35
|
-
) def_chunk ON def_chunk.symbol_id = gs.id
|
|
36
|
-
WHERE gs.id IN (${s.map(()=>"?").join(",")})`,...s,...s)),a=O([...n.map(s=>s.documentId),...l.flatMap(s=>s.document_id===null?[]:[s.document_id])]),u=new Map(a.flatMap(s=>e.all(`SELECT id, relative_path FROM documents
|
|
37
|
-
WHERE id IN (${s.map(()=>"?").join(",")})`,...s).map(r=>[r.id,r.relative_path]))),m=new Map;for(let s of l)m.has(s.symbol_id)||m.set(s.symbol_id,{symbol:s.symbol,file:s.document_id!==null?u.get(s.document_id)??"":""});let d=new Map,f=u,M=Ee(n);for(let[s,r]of M){let g=[...i.get(s)??[]].sort((p,S)=>p.start_line-S.start_line||p.end_line-S.end_line),L=[...r].sort((p,S)=>p.startLine-S.startLine||p.endLine-S.endLine),_=new Set,h=0;for(let p of L){for(;h<g.length&&g[h].start_line<=p.endLine;)_.add(g[h]),h+=1;for(let y of _)y.end_line<p.startLine&&_.delete(y);let S=new Set,T=[],E=null,me=()=>{if(E)return E;let y=f.get(p.documentId)??"",C=new Set;if(y){let D=Y(e,y),R=Math.max(0,p.startLine),P=Math.min(D.length-1,p.endLine);for(let I=R;I<=P;I+=1)for(let de of D[I])C.add(de)}return E=C,C};for(let y of _){if(y.symbol_id===p.symbolId)continue;let C=m.get(y.symbol_id);if(!C)continue;if(!(y.start_line>=p.startLine&&y.end_line<=p.endLine)){if(!(y.start_line<=p.endLine&&y.end_line>=p.startLine))continue;let I=W(C.symbol);if(!I||!me().has(I))continue}let R=`${C.symbol}|${y.chunk_id}`;S.has(R)||(S.add(R),T.push({...C,chunkId:y.chunk_id,source:"scip-chunk"}))}d.set(p.symbolId,T)}}return d}var ce=500;function O(e){let n=[...new Set(e)],o=[];for(let t=0;t<n.length;t+=ce)o.push(n.slice(t,t+ce));return o}function Ee(e){let n=new Map;for(let o of e){let t=n.get(o.documentId);t?t.push(o):n.set(o.documentId,[o])}return n}function De(e){let n=new Map;for(let[o,t]of e){let i=[];for(let c of t)i.push({symbol:c.symbol,file:c.file,chunkId:-1,source:"semantic-callee"});n.set(o,i)}return n}export{Ke as a,Qe as b,re as c};
|
|
38
|
-
//# sourceMappingURL=chunk-RSSXKJ6J.js.map
|
package/dist/chunk-RVGEZYMQ.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as A,b as F}from"./chunk-2FMFF4RI.js";import{a as C}from"./chunk-RM2WQ75T.js";import{a as k}from"./chunk-NBNEVLRC.js";import{d as b}from"./chunk-NABVR6B7.js";import{a as p}from"./chunk-64MNV6AB.js";import{posix as h}from"path";var _=20,G=1,O=new Map([["app","app"],["apps","app"],["component","component"],["components","component"],["composable","composable"],["composables","composable"],["contract","contract"],["contracts","contract"],["domain","domain"],["domains","domain"],["feature","feature"],["features","feature"],["hook","hook"],["hooks","hook"],["lib","library"],["module","module"],["modules","module"],["package","package"],["packages","package"],["page","page"],["pages","page"],["route","route"],["routes","route"],["screen","screen"],["screens","screen"],["service","service"],["services","service"],["shared","shared"],["src","source-root"],["store","state"],["stores","state"],["test","test"],["tests","test"],["util","utility"],["utils","utility"],["view","view"],["views","view"]]),q=new Set(["components","contracts","hooks","lib","services","shared","stores","utils"]),Y=new Set(["access","api","auth","config","db","effect","errors","hooks","lib","middleware","permissions","routes","schemas","servicetasks","services","startup","store","stores","test-utils","repository","repositories","tests","types","ui","utils","workflow","workflows"]);function ke(e,n={}){let t=x(n.limit,_),i=x(n.minConsumers,G),r=new C(e),s=r.fileDependencyGraph(n.scope),o=ge(p(e,{includeIgnored:!1})),a=pe(e.config.locality?.architecturalBoundarySegments,n.architecturalBoundarySegments);return(n.target?K(e,r,n.target):J(e,n.scope,n.scanLimit)).map(c=>Q(e,r,s,c,n,o,a)).filter(c=>c.consumerFiles.length>=i||n.target).sort(me).slice(0,t)}function K(e,n,t){let i=Z(e,t);if(i)return[I(i)];let r=k(e,t);if(!r)return[];let s=n.definitionsForFile(r.relativePath).find(o=>o.symbolId===r.symbolId);return s?[ee(s)]:[{unit:{kind:"symbol",file:r.relativePath,shortName:b(r.symbol),symbol:r.symbol,startLine:r.startLine,endLine:r.endLine}}]}function J(e,n,t){let i=p(e,{scope:n,includeIgnored:!1}),r=x(t,i.length);return i.slice(0,r).map(s=>I(s))}function Q(e,n,t,i,r,s,o){let a=i.definition?V(e,n,i.definition,r.semantic):X(t,i.unit.file),d=i.definition?a.length>0?"exact":"none":a.length>0?"file-level":"none",f=i.unit.file,c=l(h.dirname(f)),u=te(a),B=ne(c),W=w([...T(c),...u?T(u):[]]),y=ie(i.unit,c,u,a),g=re(y,i.unit,c,u,a,s,o),j=le(i.unit,d,u,a,c,g.whyNoSuggestedHome),z=ue(i.unit,c,u,a,g.suggestedHome,g.whyNoSuggestedHome);return{actionTier:"signal",sourceUnit:i.unit,candidatePath:f,currentDirectory:c,directoryAncestry:B,consumerFiles:a,consumerCoverage:d,nearestCommonOwner:u,boundaryMarkers:W,recommendedTier:y,suggestedHome:g.suggestedHome,destinationConfidence:g.confidence,whyNoSuggestedHome:g.whyNoSuggestedHome,counterevidence:j,reasons:z,recommendation:de(y,g.suggestedHome,d)}}function V(e,n,t,i){let r=F(A(e,n).forDefinitions([t],{semantic:i!==!1,sourceFallback:!0}));return E(r.get(t.symbolId)??[])}function X(e,n){let t=[];for(let[i,r]of e.entries())i!==n&&r.has(n)&&t.push(i);return E(t)}function Z(e,n){let t=D(n),i=p(e,{includeIgnored:!1}),r=i.find(o=>o===t);if(r)return r;let s=i.find(o=>o.endsWith(`/${t}`));return s||(i.find(o=>o.includes(t))??null)}function ee(e){return{definition:e,unit:{kind:"symbol",file:e.relativePath,shortName:b(e.symbol),symbol:e.symbol,startLine:e.startLine,endLine:e.endLine}}}function I(e){return{unit:{kind:"file",file:e,shortName:h.basename(e)}}}function ne(e){if(e===".")return[{path:".",depth:0,markers:[]}];let n=[],t=e.split("/").filter(Boolean);for(let i=0;i<t.length;i+=1){let r=t.slice(0,i+1).join("/");n.push({path:r,depth:i,markers:L(r)})}return n}function T(e){return e==="."?[]:$(e).map(({marker:n,prefix:t})=>`${n}: ${t}`)}function L(e){return w($(e).map(({marker:n})=>n))}function $(e){let n=e.split("/").filter(Boolean),t=[];for(let i=0;i<n.length;i+=1){let r=O.get(n[i]);r&&t.push({marker:r,prefix:n.slice(0,i+1).join("/")})}return t}function te(e){if(e.length===0)return null;let n=e.map(i=>l(h.dirname(i))),t=n[0].split("/").filter(Boolean);for(let i of n.slice(1)){let r=i.split("/").filter(Boolean),s=[],o=Math.min(t.length,r.length);for(let a=0;a<o&&t[a]===r[a];a+=1)s.push(t[a]);t=s}return t.length===0?".":t.join("/")}function ie(e,n,t,i){return t?e.kind==="symbol"&&i.length===1?i[0]===e.file?"same-file":"sibling-folder":t==="."||t==="src"?"repository-level-review":U(t,"package")?"package-level-shared":U(t,"app")?"app-level-shared":N(t,["feature","domain","module"])||N(n,["feature","domain","module"])?"feature-local-shared":"sibling-folder":"no-exact-consumers"}function re(e,n,t,i,r,s,o){let a=oe(e,i);if(a)return m(a);let d=fe(n.file),f=se(e,t,d,r,o);if(f)return f;let c=i;if(l(t)===l(c))return m(`${t} is already the nearest common owner for its consumers.`);let u=ae(c,t,d,o);return u||ce(c,t,d,s,o)}function oe(e,n){return n?e==="no-exact-consumers"||e==="repository-level-review"?"The inferred owner is too broad or unsupported for an exact destination.":null:"No consumer owner could be inferred from the current index."}function se(e,n,t,i,r){if(e==="same-file"){let s=i[0]??null;return s?S(s):m("No same-file consumer path was available.")}if(e==="sibling-folder"&&i.length===1){let s=l(h.dirname(i[0])),o=H(n,t,s,r);return o?m(o):S(s)}return null}function ae(e,n,t,i){return be(e)?P(e,n,t,i,`Nearest shared owner ${e} is outside source root ${t}.`):null}function ce(e,n,t,i,r){if(e===".")return m("The nearest common owner is the repository root.");let s=`${e}/shared`,o=P(s,n,t,r,`Proposed home ${s} is outside source root ${t}.`);return o.confidence==="withheld"||i.has(s)?o:m(`${s} does not exist in the indexed project.`)}function P(e,n,t,i,r){if(!M(e,t))return m(r);let s=H(n,t,e,i);return s?m(s):S(e)}function S(e){return{suggestedHome:e,confidence:"exact",whyNoSuggestedHome:null}}function m(e){return{suggestedHome:null,confidence:"withheld",whyNoSuggestedHome:e}}function le(e,n,t,i,r,s){let o=["Report-only signal; review ownership before moving files."];return n==="none"&&o.push("No consumers were found in the current index."),n==="file-level"&&o.push("File-level import evidence can hide which exported unit is actually used."),(t==="."||t==="src")&&o.push("Nearest common owner is broad, so this is not enough evidence for automatic placement."),i.length===1&&o.push("Only one consumer was found; inlining or same-folder placement may be better than shared extraction."),e.kind==="file"&&o.push("File targets describe module locality, not symbol-level usage."),t&&r.startsWith(`${t}/`)&&o.push("Candidate already lives under the nearest common owner."),s&&o.push(`No exact suggested home: ${s}`),o}function ue(e,n,t,i,r,s){let o=[];return o.push(`${e.shortName} currently lives in ${n}.`),t?o.push(`${i.length} consumer file(s) share ${t} as their nearest common owner.`):o.push("No consumer owner could be inferred from the current index."),r?o.push(`Suggested home is ${r}.`):s&&o.push(`No exact suggested home: ${s}`),o}function de(e,n,t){return e==="no-exact-consumers"?"Review references before moving; no consumers were found.":e==="repository-level-review"?"Keep this as a broad locality signal; the inferred owner is too general for automatic relocation.":n?`Review whether ${t==="exact"?"symbol usage":"module import"} supports moving or extracting toward ${n}.`:"Review ownership manually before changing structure."}function me(e,n){return R(n)-R(e)||e.candidatePath.localeCompare(n.candidatePath)}function R(e){let n=e.consumerFiles.length*10;return e.consumerCoverage==="exact"&&(n+=5),e.suggestedHome&&(n+=3),e.recommendedTier==="repository-level-review"&&(n-=8),e.recommendedTier==="no-exact-consumers"&&(n-=12),n}function ge(e){let n=new Set(["."]);for(let t of e){let i=l(h.dirname(t));for(;!n.has(i)&&(n.add(i),i!==".");)i=l(h.dirname(i))}return n}function fe(e){let n=v(e),t=n.indexOf("src");return t>=0?n.slice(0,t+1).join("/"):n.length<=1?".":n[0]}function M(e,n){let t=l(e),i=l(n);return i==="."||t===i||t.startsWith(`${i}/`)}function he(e,n,t){let i=v(e),r=v(n);return(M(e,n)?i.slice(r.length):i).some(o=>t.has(o.toLowerCase()))}function H(e,n,t,i){return l(e)===l(t)||!he(e,n,i)?null:`${e} is a named architectural boundary; an exact move to ${t} needs human design.`}function pe(...e){let n=new Set(Y);for(let t of e)for(let i of t??[]){let r=ye(i);r&&n.add(r)}return n}function ye(e){let n=e.trim().toLowerCase();return n===""?null:n}function U(e,n){return L(e).includes(n)}function N(e,n){let t=L(e);return n.some(i=>t.includes(i))}function be(e){let n=e.split("/").filter(Boolean),t=n[n.length-1];return t?q.has(t):!1}function D(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function l(e){let n=D(e);return n===""?".":n}function v(e){let n=D(e);return n==="."?[]:n.split("/").filter(Boolean)}function x(e,n){return!Number.isFinite(e)||e===void 0||e<1?n:Math.floor(e)}function E(e){return w([...e]).sort((n,t)=>n.localeCompare(t))}function w(e){return[...new Set(e)]}export{ke as a};
|
|
2
|
-
//# sourceMappingURL=chunk-RVGEZYMQ.js.map
|
package/dist/chunk-SA3DPTHT.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{b as J,h as Q,i as g,j as G}from"./chunk-SGTKURU6.js";import{c as V}from"./chunk-AREANYIA.js";import{c as D,e as x,f as H}from"./chunk-7S5E7KWT.js";import{readFileSync as Ee}from"fs";import{join as je}from"path";var $e=D("source-text",{clearGroups:["whole-project","source-file"]}),Ie=D("source-lines",{clearGroups:["whole-project","source-file"]});function f(e,t){let n=t.replace(/\\/g,"/");return $e.get(e,n,()=>{let r=je(e.config.projectRoot,n);try{return Ee(r,"utf-8")}catch(s){if(Oe(s))return"";throw s}})}function Oe(e){return typeof e=="object"&&e!==null&&"code"in e&&(e.code==="ENOENT"||e.code==="ENOTDIR")}function z(e,t){let n=t.replace(/\\/g,"/");return Ie.get(e,n,()=>{let r=f(e,n);return r?r.split(`
|
|
2
|
-
`):[]})}var De=/^\s*(?:\/\/|#|\/\*+|\*)\s*scip-query[\s:-]*ignore(?:[\s:-]+(dead(?:-code)?|stale|wrapper|passthrough|drift|extract|similar))?\b/i;function ze(e){let t=De.exec(e);return t?t[1]??"":null}function Tn(e,t,n){if(n<=0)return!1;let r=z(e,t);if(r.length===0)return!1;for(let s=n-1;s>=0&&s>=n-5;s-=1){let o=(r[s]??"").trim();if(o!==""){if(ze(o)!==null)return!0;if(!o.startsWith("//")&&!o.startsWith("*")&&!o.startsWith("/*")&&!o.startsWith("@")&&!o.startsWith("#"))return!1}}return!1}import{extname as K}from"path";var Ue={".rs":"rust",".ts":"typescript",".mts":"typescript",".cts":"typescript",".tsx":"tsx",".js":"javascript",".jsx":"javascript",".mjs":"javascript",".cjs":"javascript",".py":"python",".pyi":"python",".java":"java",".kt":"kotlin",".kts":"kotlin",".scala":"scala",".sc":"scala",".rb":"ruby",".c":"c",".h":"c",".cc":"cpp",".cpp":"cpp",".cxx":"cpp",".hpp":"cpp",".hh":"cpp",".hxx":"cpp",".cs":"csharp",".php":"php",".vb":"vb",".clj":"clojure",".cljs":"clojure",".cljc":"clojure"};function B(e){return Ue[K(e).toLowerCase()]??null}function X(e){return K(e).toLowerCase()===".vue"}import{extname as rt}from"path";import{createRequire as qe}from"module";var m=qe(import.meta.url),w=null,Y=!1;function Me(){if(Y)return null;if(w)return w;try{return w=m("tree-sitter"),w}catch{return Y=!0,null}}var ee=new Map,A=new Set;function Ze(e){if(A.has(e))return null;let t=ee.get(e);if(t)return t;let n;try{switch(e){case"rust":n=m("tree-sitter-rust");break;case"typescript":n=m("tree-sitter-typescript").typescript;break;case"tsx":n=m("tree-sitter-typescript").tsx;break;case"javascript":n=m("tree-sitter-javascript");break;case"python":n=m("tree-sitter-python");break;case"java":n=m("tree-sitter-java");break;case"kotlin":n=m("tree-sitter-kotlin");break;case"scala":n=m("tree-sitter-scala");break;case"ruby":n=m("tree-sitter-ruby");break;case"c":n=m("tree-sitter-c");break;case"cpp":n=m("tree-sitter-cpp");break;case"csharp":n=m("tree-sitter-c-sharp");break;case"php":n=m("tree-sitter-php").php;break;case"vb":{let r=m("tree-sitter-vb-dotnet");n=r.language??r;break}case"clojure":return A.add(e),null}}catch{return A.add(e),null}return ee.set(e,n),n}var te=new Map;function We(e){let t=te.get(e);if(t)return t;let n=Ze(e);if(!n)return null;let r=Me();if(!r)return null;let s=new r;try{s.setLanguage(n)}catch{return A.add(e),null}return te.set(e,s),s}function He(e,t){return e.parse(r=>r>=t.length?null:t.slice(r,Math.min(t.length,r+16384)))}function T(e,t){let n=We(e);if(!n)return null;try{return He(n,t)}catch{return null}}import{parse as Ye}from"@vue/compiler-sfc";import{posix as U}from"path";import{parse as Je}from"@vue/compiler-sfc";var Qe=x("vue-sfc-units");function b(e,t){let n=se(t),r=f(e,n);return Qe.get(e,n,r,()=>Ge(e,n,r))}function se(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function q(e){let t=e?.toLowerCase();return!t||t==="js"||t==="javascript"||t==="jsx"?"javascript":t==="ts"||t==="typescript"?"typescript":t==="tsx"?"tsx":null}function N(e){return!e||e.body.length===0?0:e.body.split(`
|
|
3
|
-
`).length}function Ge(e,t,n){let r={relativePath:t,template:null,scripts:[],styles:[],customBlocks:[],errors:[]};if(!n)return r;let s;try{s=Je(n,{filename:t})}catch(i){return r.errors.push(re(i)),r}r.errors.push(...s.errors.map(re));let{descriptor:o}=s;return o.template&&(r.template=R(e,t,"template",o.template)),o.script&&r.scripts.push(ne(e,t,o.script,!1)),o.scriptSetup&&r.scripts.push(ne(e,t,o.scriptSetup,!0)),r.styles=o.styles.map(i=>R(e,t,"style",i)),r.customBlocks=o.customBlocks.map(i=>R(e,t,"custom",i)),r.errors.push(...[r.template,...r.scripts,...r.styles,...r.customBlocks].flatMap(i=>i?.errors??[])),r}function ne(e,t,n,r){let s=R(e,t,"script",n);return{...s,kind:"script",setup:r,astLanguage:q(s.lang)}}function R(e,t,n,r){let s=Xe(r.attrs),o=typeof s.lang=="string"?s.lang:null,i=typeof s.src=="string"?s.src:typeof r.src=="string"?r.src:void 0;if(i){let c=Ke(t,i);if(!c)return{kind:n,ownerPath:t,sourcePath:t,external:!0,src:i,attrs:s,lang:o,body:"",startLine:0,endLine:0,errors:[`Could not resolve Vue ${n} block source: ${i}`]};let l=f(e,c),h=l?Math.max(0,l.split(`
|
|
4
|
-
`).length-1):0;return{kind:n,ownerPath:t,sourcePath:c,external:!0,src:i,attrs:s,lang:o,body:l,startLine:0,endLine:h,errors:l?[]:[`Vue ${n} block source not found: ${c}`]}}let a=Math.max(0,r.loc.start.line-1);return{kind:n,ownerPath:t,sourcePath:t,external:!1,attrs:s,lang:o,body:r.content,startLine:a,endLine:Math.max(a,r.loc.end.line-1),errors:[]}}function Ke(e,t){let n=t.split(/[?#]/,1)[0];if(!n||n.startsWith("/")||n.includes("://"))return null;let r=se(U.normalize(U.join(U.dirname(e),n)));return r===".."||r.startsWith("../")?null:r}function Xe(e){return{...e}}function re(e){return e instanceof Error?e.message:String(e)}function oe(e){let t=Ye(e),n=t.descriptor.scriptSetup??t.descriptor.script;if(!n||n.src)return null;let r=q(n.lang??null);return r?{body:n.content,startLine:Math.max(0,n.loc.start.line-1),language:r}:null}var ie=H("ast-trees",{clearGroups:["whole-project","source-file"]});function ae(e,t){if(X(t))return et(e,t);let n=B(t);if(!n)return null;let r=f(e,t);return r?ie.get(e,t,r,()=>T(n,r)):null}function et(e,t){let n=f(e,t);return n?ie.get(e,t,n,()=>{let r=oe(n);if(!r)return null;let s=`
|
|
5
|
-
`.repeat(r.startLine)+r.body;return T(r.language,s)}):null}function E(e,t){let n=tt(e,t);if(!n)return null;let r=M(n);return r?{calleeLeaf:r,memberAccess:nt(n),line:e.startPosition.row}:null}function tt(e,t){if(t==="rust")return e.type==="call_expression"?e.childForFieldName("function")??e.namedChild(0):e.type==="macro_invocation"?e.childForFieldName("macro")??e.namedChild(0):null;if(t==="python")return e.type!=="call"?null:e.childForFieldName("function")??e.namedChild(0);if(t==="typescript"||t==="tsx"||t==="javascript"){if(e.type==="call_expression")return e.childForFieldName("function")??e.namedChild(0);if(e.type==="new_expression")return e.childForFieldName("constructor")??e.namedChild(0)}return null}function nt(e){switch(e.type){case"field_expression":case"member_expression":case"attribute":return!0;default:return!1}}function M(e){switch(e.type){case"identifier":case"type_identifier":case"property_identifier":case"shorthand_property_identifier":return e.text;case"field_expression":case"member_expression":case"attribute":{let t=e.namedChild(e.namedChildCount-1);return t?M(t):null}case"scoped_identifier":{let t=e.childForFieldName("name")??e.namedChild(e.namedChildCount-1);return t?M(t):null}case"super":case"self":case"this":return null;default:return null}}var st=[".tsx",".jsx"],ce=new Set(["useActionState","useCallback","useContext","useDebugValue","useDeferredValue","useEffect","useId","useImperativeHandle","useInsertionEffect","useLayoutEffect","useMemo","useOptimistic","useReducer","useRef","useState","useSyncExternalStore","useTransition"]),ot=new Set(["useEffect","useInsertionEffect","useLayoutEffect"]),it=new Set(["useActionState","useOptimistic","useReducer","useRef","useState"]),at=new Set(["useLocation","useNavigate","useParams","useSearchParams","useTranslation"]),ct=new Set(["axios","fetch","gql","graphql","mutate","query","request","useMutation","useQuery","useSuspenseQuery"]),ut=new Set(["add","apply","cancel","change","clear","close","create","delete","fetch","filter","handle","load","open","refresh","remove","render","reset","save","select","submit","toggle","update"]),lt=new Set(["children","className","false","key","null","style","true","undefined"]),pt=new Set(["aria-hidden","className","clipRule","d","fill","fillRule","height","role","stroke","strokeLinecap","strokeLinejoin","strokeWidth","style","viewBox","width","xmlns"]),mt=x("react-component-behavior-profiles"),ue=G({kind:"react-component-behavior-profiles",serialize:ht,deserialize:yt});function fe(e,t={}){let n=V(e,{extensions:st}).filter(s=>!t.scope||s.includes(t.scope)).sort();return(typeof t.scanLimit=="number"&&t.scanLimit>0?n.slice(0,t.scanLimit):n).flatMap(s=>Z(e,s)).filter(s=>(t.minJsxTokens===void 0||s.jsxTokens.size>=t.minJsxTokens)&&(t.minBehaviorTokens===void 0||s.behaviorTokens.size>=t.minBehaviorTokens))}function Z(e,t){let n=t.replace(/\\/g,"/"),r=f(e,n);return mt.get(e,n,r,()=>ft(e,n,r)).map(gt)}function ft(e,t,n){let r=J(e,t,n),s=ue.read(e,t,r);if(s)return s;let o=dt(e,t);return ue.write(e,t,r,o),o}function dt(e,t){let n=vt(t);if(!n)return[];let r=ae(e,t);if(!r)return[];let s=z(e,t).length;return xt(r.rootNode,n).filter(i=>i.kind==="hook"||ge(i.bodyNode)).map(i=>{let a=kt(i.bodyNode),c=Vt(i.bodyNode,n);return{file:t,name:i.name,kind:i.kind,startLine:i.node.startPosition.row,endLine:i.node.endPosition.row,loc:Math.max(1,i.node.endPosition.row-i.node.startPosition.row+1),fileLines:s,jsxTokens:a.tokens,behaviorTokens:c.tokens,componentNames:v(a.componentNames),nativeTags:v(a.nativeTags),propNames:v(a.propNames),eventNames:v(a.eventNames),hookNames:v(c.hookNames),requestNames:v(c.requestNames),stateNames:v(c.stateNames),effectNames:v(c.effectNames),handlerNames:v(c.handlerNames)}})}function gt(e){return{...e,jsxTokens:new Set(e.jsxTokens),behaviorTokens:new Set(e.behaviorTokens),componentNames:[...e.componentNames],nativeTags:[...e.nativeTags],propNames:[...e.propNames],eventNames:[...e.eventNames],hookNames:[...e.hookNames],requestNames:[...e.requestNames],stateNames:[...e.stateNames],effectNames:[...e.effectNames],handlerNames:[...e.handlerNames]}}function ht(e){return JSON.stringify(e.map(t=>({...t,jsxTokens:[...t.jsxTokens],behaviorTokens:[...t.behaviorTokens]})))}function yt(e){try{let t=JSON.parse(e);if(!Array.isArray(t))return null;let n=[];for(let r of t){let s=St(r);if(!s)return null;n.push(s)}return n}catch{return null}}function St(e){if(!Q(e))return null;let{file:t,name:n,kind:r,startLine:s,endLine:o,loc:i,fileLines:a,jsxTokens:c,behaviorTokens:l,componentNames:h,nativeTags:u,propNames:y,eventNames:k,hookNames:p,requestNames:S,stateNames:F,effectNames:we,handlerNames:Ae}=e;if(typeof t!="string"||typeof n!="string"||r!=="component"&&r!=="hook"||!j(s)||!j(o)||!j(i)||!j(a))return null;let d={jsxTokens:g(c),behaviorTokens:g(l),componentNames:g(h),nativeTags:g(u),propNames:g(y),eventNames:g(k),hookNames:g(p),requestNames:g(S),stateNames:g(F),effectNames:g(we),handlerNames:g(Ae)};return Object.values(d).some(Re=>Re===null)?null:{file:t,name:n,kind:r,startLine:s,endLine:o,loc:i,fileLines:a,jsxTokens:new Set(d.jsxTokens),behaviorTokens:new Set(d.behaviorTokens),componentNames:d.componentNames,nativeTags:d.nativeTags,propNames:d.propNames,eventNames:d.eventNames,hookNames:d.hookNames,requestNames:d.requestNames,stateNames:d.stateNames,effectNames:d.effectNames,handlerNames:d.handlerNames}}function j(e){return typeof e=="number"&&Number.isFinite(e)}function vt(e){let t=rt(e).toLowerCase();return t!==".tsx"&&t!==".jsx"?null:B(e)}function xt(e,t){let n=[],r=new Set,s=o=>{let i=Nt(o);if(i&&!Ct(o)){let a=`${i.name}:${i.node.startIndex}:${i.node.endIndex}`;r.has(a)||(r.add(a),n.push(i));return}for(let a of o.namedChildren)s(a)};return(t==="tsx"||t==="javascript")&&s(e),n}function Nt(e){if(e.type==="function_declaration"){let o=de(e);return!o||!le(o)?null:{name:o,kind:pe(o),node:e,bodyNode:e}}if(e.type!=="variable_declarator")return null;let t=e.childForFieldName("name")??e.namedChild(0),n=e.childForFieldName("value")??e.namedChild(1),r=P(t);if(!r||!n||!le(r))return null;let s=bt(n);return s?{name:r,kind:pe(r),node:e,bodyNode:s}:null}function le(e){return/^[A-Z]/.test(e)||/^use[A-Z0-9_]/.test(e)}function pe(e){return/^use[A-Z0-9_]/.test(e)?"hook":"component"}function bt(e){if(e.type==="arrow_function"||e.type==="function_expression")return e;if(e.type!=="call_expression")return null;let t=Lt(e);return t!=="memo"&&t!=="forwardRef"?null:e.namedChildren.find(s=>s.type==="arguments")?.namedChildren.find(s=>s.type==="arrow_function"||s.type==="function_expression")??null}function Ct(e){let t=e.parent;for(;t;){if(t.type==="function_declaration"||t.type==="function_expression"||t.type==="arrow_function"||t.type==="method_definition")return!0;t=t.parent}return!1}function de(e){return P(e.childForFieldName("name")??e.namedChild(0))}function Lt(e){let t=e.childForFieldName("function")??e.namedChild(0);return t?t.text.split(".").pop()??t.text:null}function ge(e){return e.type.startsWith("jsx_")?!0:e.namedChildren.some(ge)}function kt(e){let t={tokens:new Set,componentNames:new Set,nativeTags:new Set,propNames:new Set,eventNames:new Set},n=r=>{r.type==="jsx_opening_element"||r.type==="jsx_self_closing_element"?Ft(r,t):r.type==="jsx_expression"?Tt(r,t):r.type==="jsx_fragment"&&t.tokens.add("jsx:fragment");for(let s of r.namedChildren)n(s)};return n(e),t}function Ft(e,t){let n=Pt(e),r=!1;if(n){let s=me(n);r=Et(s),r?(t.componentNames.add(s),t.tokens.add(`component:${s}`)):(t.nativeTags.add(s),t.tokens.add(`native:${s}`))}for(let s of e.namedChildren)if(s.type==="jsx_attribute"){let o=_t(s);if(!o)continue;let i=me(o);if(i.startsWith("on")&&i.length>2){let a=i.slice(2).replace(/^[A-Z]/,c=>c.toLowerCase());t.eventNames.add(a),t.tokens.add(`event:${a}`)}else pt.has(i)||(t.propNames.add(i),t.tokens.add(`${r?"prop":"native-prop"}:${i}`))}else s.type==="jsx_spread_attribute"&&t.tokens.add("prop:spread")}function Tt(e,t){let n=e.text;(n.includes("&&")||n.includes("?"))&&t.tokens.add("jsx:conditional"),(n.includes(".map(")||n.includes(".flatMap("))&&t.tokens.add("jsx:list");for(let r of jt(n))lt.has(r)||t.tokens.add(`binding:${r}`)}function Pt(e){for(let t of e.namedChildren)if(t.type==="identifier"||t.type==="jsx_identifier"||t.type==="property_identifier"||t.type==="member_expression"||t.type==="jsx_member_expression")return t.text;return/^<\s*([A-Za-z][\w$.]*)/.exec(e.text)?.[1]??null}function _t(e){for(let t of e.namedChildren)if(t.type==="property_identifier"||t.type==="identifier"||t.type==="jsx_identifier")return t.text;return/^([A-Za-z_$][\w$:-]*)/.exec(e.text)?.[1]??null}function Vt(e,t){let n={tokens:new Set,hookNames:new Set,requestNames:new Set,stateNames:new Set,effectNames:new Set,handlerNames:new Set},r=s=>{if(s.type==="call_expression"){let o=E(s,t);o&&Bt(o.calleeLeaf,n)}else if(s.type==="variable_declarator")At(s,n);else if(s.type==="function_declaration"){let o=de(s);o&&he(o,n)}for(let o of s.namedChildren)r(o)};return r(e),n}function Bt(e,t){/^use[A-Z0-9_]/.test(e)&&(t.hookNames.add(e),!ce.has(e)&&!at.has(e)&&t.tokens.add(`hook:${e}`)),ce.has(e)&&t.tokens.add(`react-hook:${e}`),ot.has(e)&&(t.effectNames.add(e),t.tokens.add(`effect:${e}`)),it.has(e)&&t.tokens.add(`state-hook:${e}`),wt(e)&&(t.requestNames.add(e),t.tokens.add(`request:${e}`))}function wt(e){if(ct.has(e))return!0;let t=/^use([A-Z0-9_].*)$/.exec(e)?.[1];return t?/(Query|Mutation|Fetch|Resource)$/.test(t):!1}function At(e,t){let n=e.childForFieldName("name")??e.namedChild(0),r=e.childForFieldName("value")??e.namedChild(1);if(n?.type==="array_pattern"&&r?.text.includes("useState")){let o=n.namedChildren.find(a=>P(a)),i=P(o);i&&(t.stateNames.add(i),t.tokens.add(`state:${i}`))}let s=P(n);s&&he(s,t)}function he(e,t){let n=Rt(e);!n||!ut.has(n)||(t.handlerNames.add(e),t.tokens.add(`handler:${e}`),t.tokens.add(`handler-verb:${n}`))}function Rt(e){let t=e.startsWith("handle")&&e.length>6?e.slice(6).replace(/^[A-Z]/,n=>n.toLowerCase()):e;return/^[a-z]+/.exec(t)?.[0]??null}function Et(e){return/^[A-Z]/.test(e)||e.includes(".")}function me(e){return e.replace(/^this\./,"").replace(/\$/g,".")}function P(e){return e&&(e.type==="identifier"||e.type==="property_identifier"||e.type==="shorthand_property_identifier"||/^[A-Za-z_$][\w$]*$/.test(e.text))?e.text:null}function jt(e){let t=[];for(let n of e.matchAll(/\b[A-Za-z_$][\w$]*\b/g)){let r=n[0];t.includes(r)||t.push(r)}return t}function v(e){return[...e].sort()}function _(e){return e.type==="comment"||e.type==="line_comment"||e.type==="block_comment"}var $t=new Set(["function_declaration","method_definition","method_signature","function_signature"]);function Ne(e,t){let n=Ot(e,t);if(n)return{name:n.name,startLine:n.definitionNode.startPosition.row,endLine:n.definitionNode.endPosition.row,paramCount:ve(n.functionNode),params:ye(n.functionNode),paramsEndLine:Se(n.functionNode),isLiteralPassthrough:xe(n.functionNode,t)};if(!It(e.type,t))return null;let r=e.childForFieldName("name")??e.namedChildren.find(s=>s.type==="identifier"||s.type==="property_identifier");return r?{name:r.text,startLine:e.startPosition.row,endLine:e.endPosition.row,paramCount:ve(e),params:ye(e),paramsEndLine:Se(e),isLiteralPassthrough:xe(e,t)}:null}function be(e){return e.namedChildren.find(t=>t.type==="parameters"||t.type==="formal_parameters")}function ye(e){let t=be(e);if(!t)return[];let n=[];for(let r of t.namedChildren){if(_(r))continue;if(r.type==="identifier"){n.push({name:r.text,simple:!0});continue}let s=r.namedChildren.some(a=>a.type.endsWith("_modifier"))||/^\s*(?:public|private|protected|readonly|override)\b/.test(r.text),o=r.childForFieldName("pattern");if(!s&&o&&o.type==="identifier"){n.push({name:o.text,simple:!0});continue}let i=r.namedChildren.find(a=>a.type==="identifier");n.push({name:o?.type==="identifier"?o.text:i?.text??"",simple:!1})}return n}function Se(e){let t=be(e);return t?t.endPosition.row:e.startPosition.row}function It(e,t){return t==="rust"?e==="function_item"||e==="function_signature_item":t==="python"?e==="function_definition":t==="typescript"||t==="tsx"||t==="javascript"?$t.has(e):!1}function Ot(e,t){if(t!=="typescript"&&t!=="tsx"&&t!=="javascript")return null;if(e.type==="variable_declarator"){let n=e.childForFieldName("name")??e.namedChild(0),r=e.childForFieldName("value")??e.namedChild(1);return!n||!r||r.type!=="arrow_function"&&r.type!=="function_expression"?null:{name:n.text,definitionNode:e,functionNode:r}}if(e.type==="public_field_definition"){let n=e.childForFieldName("name")??e.namedChild(0),r=e.childForFieldName("value")??e.namedChild(1);return!n||!r||r.type!=="arrow_function"&&r.type!=="function_expression"?null:{name:n.text,definitionNode:e,functionNode:r}}return null}function ve(e){let t=e.namedChildren.find(r=>r.type==="parameters"||r.type==="formal_parameters");if(!t)return 0;let n=0;for(let r of t.namedChildren)_(r)||(n+=1);return n}function xe(e,t){let n=e.namedChildren.find(u=>u.type==="block"||u.type==="statement_block");if(!n)return!1;let r=n.namedChildren.filter(u=>!_(u));if(r.length!==1)return!1;let s=r[0],o=null;if(s.type==="return_statement"||s.type==="expression_statement"?o=s.namedChild(0)??null:t==="rust"&&(s.type==="call_expression"||s.type==="macro_invocation")&&(o=s),!o)return!1;let i=t==="python"?"call":"call_expression";if(o.type!==i)return!1;let a=o.namedChildren.find(u=>u.type==="arguments"||u.type==="argument_list");if(!a)return!1;let c=a.namedChildren.filter(u=>!_(u)),l=e.namedChildren.find(u=>u.type==="parameters"||u.type==="formal_parameters");if(!l)return!1;let h=[];for(let u of l.namedChildren){if(u.type==="identifier"){h.push(u.text);continue}let y=u.namedChildren.find(k=>k.type==="identifier");y&&h.push(y.text)}if(c.length!==h.length)return!1;for(let u=0;u<h.length;u+=1){let y=c[u];if(y.type!=="identifier"||y.text!==h[u])return!1}return!0}var Dt=new Set(["ref","shallowRef","reactive","computed","watch","watchEffect"]),zt=new Set(["onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","onActivated","onDeactivated","onErrorCaptured"]),Ut=new Set(["axios","fetch","runRequest","useAsyncData","useFetch","useResource"]),qt=new Set(["defineEmits","defineExpose","defineModel","defineOptions","defineProps","withDefaults"]),Mt=new Set(["catch","for","function","if","return","switch","while"]);function I(e){let t={imports:[],functions:[],calls:[],composables:[],stores:[],reactivity:[],lifecycle:[],requests:[],macros:[],lineCount:0,externalLineCount:0,externalScriptPaths:[],unresolvedScripts:[]};for(let n of e.scripts){t.lineCount+=N(n),n.external&&(t.externalLineCount+=N(n),t.externalScriptPaths.push(n.sourcePath));for(let s of n.errors)t.unresolvedScripts.push({sourcePath:n.sourcePath,reason:s});if(!n.body||!n.astLanguage){n.astLanguage||t.unresolvedScripts.push({sourcePath:n.sourcePath,reason:`Unsupported Vue script language: ${n.lang??"unknown"}`});continue}t.imports.push(...Jt(n));let r=T(n.astLanguage,n.body);r?Wt(n,r.rootNode,t):Ht(n,t)}return Zt(t),t.externalScriptPaths=Le(t.externalScriptPaths),t}function Zt(e){e.composables=C(e,"composable"),e.stores=C(e,"store"),e.reactivity=C(e,"reactivity"),e.lifecycle=C(e,"lifecycle"),e.requests=C(e,"request"),e.macros=C(e,"macro")}function C(e,t){return Le(e.calls.filter(n=>n.categories.includes(t)).map(n=>n.name))}function Wt(e,t,n){let r=new Set,s=new Set,o=i=>{let a=Ne(i,e.astLanguage);if(a){let l=`${a.name}:${a.startLine}:${a.endLine}`;s.has(l)||(s.add(l),n.functions.push({name:a.name,sourcePath:e.sourcePath,startLine:e.startLine+a.startLine,endLine:e.startLine+a.endLine,setup:e.setup}))}let c=E(i,e.astLanguage);if(c){let l=`${c.calleeLeaf}:${c.line}`;r.has(l)||(r.add(l),n.calls.push({name:c.calleeLeaf,sourcePath:e.sourcePath,line:e.startLine+c.line,categories:Ce(c.calleeLeaf),setup:e.setup}))}for(let l of i.children)o(l)};o(t)}function Ht(e,t){for(let n of e.body.matchAll(/\b([A-Za-z_$][\w$]*)\s*\(/g)){let r=n[1];!r||Mt.has(r)||t.calls.push({name:r,sourcePath:e.sourcePath,line:e.startLine+$(e.body,n.index??0),categories:Ce(r),setup:e.setup})}for(let n of e.body.matchAll(/\bfunction\s+([A-Za-z_$][\w$]*)\b/g)){let r=n[1];if(!r)continue;let s=e.startLine+$(e.body,n.index??0);t.functions.push({name:r,sourcePath:e.sourcePath,startLine:s,endLine:s,setup:e.setup})}for(let n of e.body.matchAll(/\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(?:async\s*)?(?:function\b|\([^)]*\)\s*=>|[A-Za-z_$][\w$]*\s*=>)/g)){let r=n[1];if(!r)continue;let s=e.startLine+$(e.body,n.index??0);t.functions.push({name:r,sourcePath:e.sourcePath,startLine:s,endLine:s,setup:e.setup})}}function Jt(e){let t=[];for(let n of e.body.matchAll(/\bimport\s+(?:type\s+)?([^'";]+?)\s+from\s+['"]([^'"]+)['"]/g)){let r=n[1]?.trim(),s=n[2];if(!r||!s)continue;let o=e.startLine+$(e.body,n.index??0);for(let i of Qt(r))t.push({local:i,source:s,sourcePath:e.sourcePath,line:o,setup:e.setup})}return t}function Qt(e){let t=[],r=e.split(",").map(i=>i.trim()).filter(Boolean)[0];r&&!r.startsWith("{")&&!r.startsWith("*")&&t.push(r);let s=/\{([^}]*)\}/.exec(e)?.[1];if(s)for(let i of s.split(",")){let a=i.trim();if(!a)continue;let c=/\bas\s+([A-Za-z_$][\w$]*)$/.exec(a)?.[1];t.push(c??a.replace(/^type\s+/,"").trim())}let o=/\*\s+as\s+([A-Za-z_$][\w$]*)/.exec(e)?.[1];return o&&t.push(o),t.filter(i=>/^[A-Za-z_$][\w$]*$/.test(i))}function Ce(e){let t=["call"];return/^use[A-Z0-9_]/.test(e)&&t.push("composable"),/^use[A-Z0-9_].*Store$/.test(e)&&t.push("store"),Dt.has(e)&&t.push("reactivity"),zt.has(e)&&t.push("lifecycle"),Ut.has(e)&&t.push("request"),qt.has(e)&&t.push("macro"),t}function $(e,t){let n=0;for(let r=0;r<t&&r<e.length;r+=1)e.charCodeAt(r)===10&&(n+=1);return n}function Le(e){return[...new Set(e)].sort()}import{ElementTypes as Gt,NodeTypes as Te,parse as Kt}from"@vue/compiler-dom";import{parse as hr}from"@vue/compiler-sfc";function ke(e,t){return e.split(t).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join("")}var Xt=x("vue-template-facts"),Yt=new Set(["component","keep-alive","slot","suspense","teleport","template","transition","transition-group"]),en=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]),tn=new Set(["div","span","template"]),nn=new Set(["as","await","break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","false","finally","for","from","function","if","import","in","instanceof","let","new","null","of","return","super","switch","this","throw","true","try","typeof","undefined","var","void","while","with","yield"]);function O(e,t){let n=t.replace(/\\/g,"/"),r=f(e,n);return Xt.get(e,n,r,()=>rn(n,b(e,n).template))}function rn(e,t){let n={relativePath:e,template:t?{startLine:t.startLine,endLine:t.endLine}:null,componentTags:[],nativeTags:[],builtinTags:[],props:[],events:[],directives:[],slots:[],expressionIdentifiers:[],structuralTokens:[]};if(!t)return n;let r;try{r=Kt(t.body,{comments:!1})}catch{return n}let s=new Set,o=i=>{i.trim()&&s.add(i)};return Pe(r.children,t.startLine,n,o),n.structuralTokens=[...s].sort(),n}function Pe(e,t,n,r){for(let s of e)s.type===Te.ELEMENT&&(sn(s,t,n,r),Pe(s.children,t,n,r))}function sn(e,t,n,r){let s=fn(e.tag),o={tag:e.tag,normalized:s,kind:mn(e),startLine:L(t,e.loc.start.line),endLine:L(t,e.loc.end.line)};o.kind==="component"?(n.componentTags.push(o),r(`component:${s}`)):o.kind==="builtin"?(n.builtinTags.push(o),r(`builtin:${s}`)):(n.nativeTags.push(o),tn.has(e.tag)||r(`native:${e.tag}`));for(let i of e.props)on(i,t,n,r)}function on(e,t,n,r){if(e.type===Te.ATTRIBUTE){let a=e.value?.content??null,c=Fe("prop",e.name,a,t,e.loc.start.line,e.loc.end.line);n.props.push(c),r(`prop:${e.name}`);return}let s=cn(e),o=_e(e.exp),i=Fe(an(e.name),s,o,t,e.loc.start.line,e.loc.end.line);switch(i.kind){case"prop":n.props.push(i),r(`prop:${s}`);break;case"event":n.events.push(i),r(`event:${s}`);break;case"slot":n.slots.push(i),r(`slot:${s}`);break;case"directive":n.directives.push(i),r(`directive:${s}`);break}o&&un(o,t,e.loc.start.line,n,r)}function Fe(e,t,n,r,s,o){return{kind:e,name:t,value:n,startLine:L(r,s),endLine:L(r,o)}}function an(e){switch(e){case"bind":case"model":return"prop";case"on":return"event";case"slot":return"slot";default:return"directive"}}function cn(e){let t=_e(e.arg);return t||e.name}function _e(e){if(!e)return null;let t=("content"in e&&typeof e.content=="string"?e.content:e.loc.source).trim();return t||null}function un(e,t,n,r,s){for(let o of ln(e)){let i={name:o,startLine:L(t,n),endLine:L(t,n)};r.expressionIdentifiers.push(i),s(`id:${o}`)}}function ln(e){let t=new Set,n=pn(e),r=/\b[A-Za-z_$][A-Za-z0-9_$]*\b/g,s;for(;s=r.exec(n);){let o=s[0];nn.has(o)||/^[A-Z_]+$/.test(o)||t.add(o)}return[...t].sort()}function pn(e){return e.replace(/\/\*[\s\S]*?\*\//g," ").replace(/\/\/.*$/gm," ").replace(/`(?:\\[\s\S]|\$\{([^}]*)\}|[^`\\])*`/g,(t,n)=>n??" ").replace(/'(?:\\[\s\S]|[^'\\])*'/g," ").replace(/"(?:\\[\s\S]|[^"\\])*"/g," ")}function mn(e){let t=e.tag;return e.tagType===Gt.COMPONENT?"component":Yt.has(t)?"builtin":en.has(t)?"native":/^[A-Z]/.test(t)||t.includes("-")?"component":"native"}function fn(e){return ke(e,/[-_:]/)}function L(e,t){return e+Math.max(0,t-1)}var dn=new Set(["in","key","of"]),gn=new Set(["computed","defineEmits","defineProps","reactive","ref","watch","watchEffect"]),hn=x("vue-component-behavior-profiles");function Ve(e,t={}){let n=V(e,{extensions:[".vue"]}).filter(s=>!t.scope||s.includes(t.scope)).sort();return(typeof t.scanLimit=="number"&&t.scanLimit>0?n.slice(0,t.scanLimit):n).map(s=>W(e,s)).filter(s=>(t.minTemplateTokens===void 0||s.templateTokens.size>=t.minTemplateTokens)&&(t.minBehaviorTokens===void 0||s.behaviorTokens.size>=t.minBehaviorTokens))}function W(e,t){let n=t.replace(/\\/g,"/"),r=f(e,n),s=hn.get(e,n,r,()=>yn(e,n,r));return Sn(s)}function yn(e,t,n){let r=b(e,t),s=O(e,t),o=I(r),i=Nn(s),a=s.expressionIdentifiers.map(p=>p.name).filter(p=>!i.includes(p)).filter((p,S,F)=>F.indexOf(p)===S).sort(),c=s.componentTags.map(p=>p.normalized).filter((p,S,F)=>F.indexOf(p)===S).sort(),l=n?n.split(`
|
|
6
|
-
`).length:0,h=N(r.template),u=o.lineCount,y=r.styles.reduce((p,S)=>p+N(S),0),k=r.customBlocks.reduce((p,S)=>p+N(S),0);return{file:t,sfc:r,templateFacts:s,scriptFacts:o,templateTokens:new Set(s.structuralTokens),behaviorTokens:xn(s,o,a),templateBindingNames:a,templateLocalNames:i,componentNames:c,sfcLines:l,totalLines:l+o.externalLineCount,templateLines:h,scriptLines:u,styleLines:y,externalScriptLines:o.externalLineCount,externalScriptPaths:o.externalScriptPaths,customBlockLines:k}}function Sn(e){let t=vn(e.scriptFacts);return{...e,scriptFacts:t,templateTokens:new Set(e.templateTokens),behaviorTokens:new Set(e.behaviorTokens),templateBindingNames:[...e.templateBindingNames],templateLocalNames:[...e.templateLocalNames],componentNames:[...e.componentNames],externalScriptPaths:t.externalScriptPaths}}function vn(e){return{...e,imports:e.imports.map(t=>({...t})),functions:e.functions.map(t=>({...t})),calls:e.calls.map(t=>({...t,categories:[...t.categories]})),composables:[...e.composables],stores:[...e.stores],reactivity:[...e.reactivity],lifecycle:[...e.lifecycle],requests:[...e.requests],macros:[...e.macros],externalScriptPaths:[...e.externalScriptPaths],unresolvedScripts:e.unresolvedScripts.map(t=>({...t}))}}function xn(e,t,n){let r=new Set;for(let s of t.composables)r.add(`composable:${s}`);for(let s of t.stores)r.add(`store:${s}`);for(let s of t.reactivity)r.add(`reactivity:${s}`);for(let s of t.lifecycle)r.add(`lifecycle:${s}`);for(let s of t.requests)r.add(`request:${s}`);for(let s of t.macros)r.add(`macro:${s}`);for(let s of t.functions){if(gn.has(s.name))continue;r.add(`function:${s.name}`);let o=/^[a-z]+/.exec(s.name)?.[0]??null;o&&o.length>2&&o!==s.name&&r.add(`function-verb:${o}`)}for(let s of e.events)r.add(`template-event:${s.name}`);for(let s of n)r.add(`template-binding:${s}`);return r}function Nn(e){let t=new Set;for(let n of e.directives)if(n.name==="for"&&n.value)for(let r of bn(n.value))t.add(r);for(let n of e.slots)if(n.value)for(let r of Be(n.value))t.add(r);return[...t].sort()}function bn(e){let t=/^(.*?)\s+(?:in|of)\s+/.exec(e.trim());return t?Be(t[1]??""):[]}function Be(e){let t=[];for(let n of e.matchAll(/\b[A-Za-z_$][\w$]*\b/g)){let r=n[0];dn.has(r)||t.push(r)}return t}function Rr(e){return{capability:(t,n)=>Cn(t,n),reactProfiles:(t={})=>fe(e,t),reactProfilesForFile:t=>Z(e,t),vueProfiles:(t={})=>Ve(e,t),vueProfileForFile:t=>W(e,t),vueTemplateFacts:t=>O(e,t),vueScriptFacts:t=>I(b(e,t))}}function Cn(e,t){let n=e.startsWith("react-")?"react":"vue";if(t===void 0)return{slot:e,available:!0,framework:n};let r=t.replace(/\\/g,"/").toLowerCase();return n==="react"&&!r.endsWith(".tsx")&&!r.endsWith(".jsx")?{slot:e,available:!1,framework:n,reason:"React behavior profiles are only available for .tsx and .jsx files"}:n==="vue"&&!r.endsWith(".vue")?{slot:e,available:!1,framework:n,reason:"Vue behavior facts are only available for .vue files"}:{slot:e,available:!0,framework:n}}export{f as a,z as b,ze as c,Tn as d,B as e,X as f,oe as g,ae as h,E as i,M as j,Ne as k,ke as l,Rr as m};
|
|
7
|
-
//# sourceMappingURL=chunk-SA3DPTHT.js.map
|
package/dist/chunk-SGTKURU6.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import{c as E}from"./chunk-7S5E7KWT.js";import{createHash as L}from"crypto";import{readFileSync as S}from"fs";import{dirname as g,join as v}from"path";import D from"better-sqlite3";var _="evidence.db",p=new WeakMap,R=E("evidence-content-hash",{clearGroups:["whole-project","source-file"]}),m=E("evidence-project-fingerprint",{clearGroups:["whole-project"]}),c="evidence-v1",l="version NOT LIKE 'evidence-%'";function T(n){return L("sha256").update(n).digest("hex")}function P(n,t,e){return R.get(n,t,()=>T(e))}function F(n){return m.get(n,"current",()=>{try{let t=JSON.parse(S(v(g(n.config.dbPath),"meta.json"),"utf-8"));if(t.version!==2&&t.version!==3||t.status!=="complete"||t.fingerprint===void 0)return null;let e=Array.isArray(t.indexedLanguages)?[...t.indexedLanguages].sort():[];return T(JSON.stringify({fingerprint:t.fingerprint,indexedLanguages:e}))}catch(t){return u("project fingerprint unavailable",t),null}})}function u(n,t){process.env.SCIP_QUERY_DEBUG&&console.error(`evidence-cache: ${n}: ${t instanceof Error?t.message:String(t)}`)}function o(n){if(p.has(n))return p.get(n)??null;let t=null;try{let e=new D(v(g(n.config.dbPath),_));e.pragma("journal_mode = WAL"),e.pragma("busy_timeout = 5000"),e.pragma("synchronous = NORMAL"),e.exec(`
|
|
2
|
-
CREATE TABLE IF NOT EXISTS file_evidence (
|
|
3
|
-
kind TEXT NOT NULL,
|
|
4
|
-
relative_path TEXT NOT NULL,
|
|
5
|
-
content_hash TEXT NOT NULL,
|
|
6
|
-
version TEXT NOT NULL,
|
|
7
|
-
payload TEXT NOT NULL,
|
|
8
|
-
PRIMARY KEY (kind, relative_path)
|
|
9
|
-
);
|
|
10
|
-
CREATE TABLE IF NOT EXISTS project_evidence (
|
|
11
|
-
kind TEXT NOT NULL,
|
|
12
|
-
cache_key TEXT NOT NULL,
|
|
13
|
-
project_fingerprint TEXT NOT NULL,
|
|
14
|
-
version TEXT NOT NULL,
|
|
15
|
-
payload TEXT NOT NULL,
|
|
16
|
-
PRIMARY KEY (kind, cache_key)
|
|
17
|
-
);
|
|
18
|
-
CREATE TABLE IF NOT EXISTS semantic_callees (
|
|
19
|
-
relative_path TEXT NOT NULL,
|
|
20
|
-
symbol TEXT NOT NULL,
|
|
21
|
-
content_hash TEXT NOT NULL,
|
|
22
|
-
deps_digest TEXT NOT NULL,
|
|
23
|
-
version TEXT NOT NULL,
|
|
24
|
-
payload TEXT NOT NULL,
|
|
25
|
-
PRIMARY KEY (relative_path, symbol)
|
|
26
|
-
);
|
|
27
|
-
CREATE TABLE IF NOT EXISTS semantic_references (
|
|
28
|
-
relative_path TEXT NOT NULL,
|
|
29
|
-
symbol TEXT NOT NULL,
|
|
30
|
-
project_fingerprint TEXT NOT NULL,
|
|
31
|
-
version TEXT NOT NULL,
|
|
32
|
-
payload TEXT NOT NULL,
|
|
33
|
-
PRIMARY KEY (relative_path, symbol)
|
|
34
|
-
);
|
|
35
|
-
`),t={evidence:e,readFileEvidence:e.prepare("SELECT payload FROM file_evidence WHERE kind = ? AND relative_path = ? AND content_hash = ? AND version = ?"),readLegacyFileEvidence:e.prepare(`SELECT payload FROM file_evidence
|
|
36
|
-
WHERE kind = ? AND relative_path = ? AND content_hash = ? AND ${l}
|
|
37
|
-
ORDER BY version DESC
|
|
38
|
-
LIMIT 1`),writeFileEvidence:e.prepare("INSERT OR REPLACE INTO file_evidence (kind, relative_path, content_hash, version, payload) VALUES (?, ?, ?, ?, ?)"),readProjectEvidence:e.prepare("SELECT payload FROM project_evidence WHERE kind = ? AND cache_key = ? AND project_fingerprint = ? AND version = ?"),readLegacyProjectEvidence:e.prepare(`SELECT payload FROM project_evidence
|
|
39
|
-
WHERE kind = ? AND cache_key = ? AND project_fingerprint = ? AND ${l}
|
|
40
|
-
ORDER BY version DESC
|
|
41
|
-
LIMIT 1`),writeProjectEvidence:e.prepare("INSERT OR REPLACE INTO project_evidence (kind, cache_key, project_fingerprint, version, payload) VALUES (?, ?, ?, ?, ?)"),readCallees:e.prepare(`SELECT payload FROM semantic_callees
|
|
42
|
-
WHERE relative_path = ? AND symbol = ? AND content_hash = ? AND deps_digest = ? AND version = ?`),readLegacyCallees:e.prepare(`SELECT payload FROM semantic_callees
|
|
43
|
-
WHERE relative_path = ? AND symbol = ? AND content_hash = ? AND deps_digest = ? AND ${l}
|
|
44
|
-
ORDER BY version DESC
|
|
45
|
-
LIMIT 1`),writeCallees:e.prepare(`INSERT OR REPLACE INTO semantic_callees
|
|
46
|
-
(relative_path, symbol, content_hash, deps_digest, version, payload) VALUES (?, ?, ?, ?, ?, ?)`),dropStaleCallees:e.prepare("DELETE FROM semantic_callees WHERE relative_path = ? AND content_hash != ?"),readReferences:e.prepare(`SELECT payload FROM semantic_references
|
|
47
|
-
WHERE relative_path = ? AND symbol = ? AND project_fingerprint = ? AND version = ?`),readLegacyReferences:e.prepare(`SELECT payload FROM semantic_references
|
|
48
|
-
WHERE relative_path = ? AND symbol = ? AND project_fingerprint = ? AND ${l}
|
|
49
|
-
ORDER BY version DESC
|
|
50
|
-
LIMIT 1`),writeReferences:e.prepare(`INSERT OR REPLACE INTO semantic_references
|
|
51
|
-
(relative_path, symbol, project_fingerprint, version, payload) VALUES (?, ?, ?, ?, ?)`),dropStaleReferences:e.prepare("DELETE FROM semantic_references WHERE project_fingerprint != ?")}}catch(e){u("disabled (open failed)",e)}return p.set(n,t),t}function s(n,t,e){u(`disabled (${t})`,e),p.set(n,null)}function f(n,t,e,i){let r=o(n);if(!r)return null;try{return(r.readFileEvidence.get(t,e,i,c)??r.readLegacyFileEvidence.get(t,e,i))?.payload??null}catch(a){return s(n,"file_evidence read",a),null}}function y(n,t,e,i,r){let a=o(n);if(a)try{a.writeFileEvidence.run(t,e,i,c,r)}catch(d){s(n,"file_evidence write",d)}}function h(n,t,e,i){let r=o(n);if(!r)return null;try{return(r.readProjectEvidence.get(t,e,i,c)??r.readLegacyProjectEvidence.get(t,e,i))?.payload??null}catch(a){return s(n,"project_evidence read",a),null}}function N(n,t,e,i,r){let a=o(n);if(a)try{a.writeProjectEvidence.run(t,e,i,c,r)}catch(d){s(n,"project_evidence write",d)}}function w(n,t,e,i,r){let a=o(n);if(!a)return null;try{return(a.readCallees.get(t,e,i,r,c)??a.readLegacyCallees.get(t,e,i,r))?.payload??null}catch(d){return s(n,"semantic_callees read",d),null}}function I(n,t,e,i){let r=o(n);if(!r)return null;try{return(r.readReferences.get(t,e,i,c)??r.readLegacyReferences.get(t,e,i))?.payload??null}catch(a){return s(n,"semantic_references read",a),null}}function x(n,t){if(t.length===0)return;let e=o(n);if(e)try{e.evidence.transaction(()=>{let i=new Set;for(let r of t){let a=`${r.relativePath}\0${r.contentHash}`;i.has(a)||(i.add(a),e.dropStaleCallees.run(r.relativePath,r.contentHash)),e.writeCallees.run(r.relativePath,r.symbol,r.contentHash,r.depsDigest,c,r.payload)}})()}catch(i){s(n,"semantic_callees write",i)}}function k(n,t){if(t.length===0)return;let e=o(n);if(e)try{e.evidence.transaction(()=>{let i=new Set;for(let r of t)i.has(r.projectFingerprint)||(i.add(r.projectFingerprint),e.dropStaleReferences.run(r.projectFingerprint)),e.writeReferences.run(r.relativePath,r.symbol,r.projectFingerprint,c,r.payload)})()}catch(i){s(n,"semantic_references write",i)}}function X(n){return typeof n=="object"&&n!==null}function M(n){return Array.isArray(n)&&n.every(t=>typeof t=="string")?n:null}function Y(n){return{kind:n.kind,read(t,e,i){let r=f(t,n.kind,e,i);if(r===null)return null;try{return n.deserialize(r)}catch{return null}},write(t,e,i,r){y(t,n.kind,e,i,n.serialize(r))}}}function B(n){return{kind:n.kind,read(t,e,i){let r=h(t,n.kind,e,i);if(r===null)return null;try{return n.deserialize(r)}catch{return null}},write(t,e,i,r){N(t,n.kind,e,i,n.serialize(r))}}}export{T as a,P as b,F as c,w as d,I as e,x as f,k as g,X as h,M as i,Y as j,B as k};
|
|
52
|
-
//# sourceMappingURL=chunk-SGTKURU6.js.map
|
package/dist/chunk-T4N2ZRVY.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import{a as C}from"./chunk-RM2WQ75T.js";import{e as S}from"./chunk-CYHIKTJN.js";import{d as y,g as p,i as b}from"./chunk-NABVR6B7.js";import{execFileSync as g}from"child_process";import{existsSync as v,readFileSync as E}from"fs";import{basename as F}from"path";function R(e){let t=new Map;for(let i of e){let n=t.get(i.file);n||(n=[],t.set(i.file,n)),n.push(i)}return t}var B="Unable to compute git diff.";function ge(e,t={}){let i=t.plan??P(e,t);return i.note?A(i.note,i.changedFileLines):i.changedFiles.length===0?O(i.changedFileLines):T(i.changedFiles,[$(e,i.changedFiles,i.changedFiles,i.changedRanges)])}function P(e,t={}){let{base:i="HEAD"}=t;try{let n=k(e.config.projectRoot,i),r=Y(e,n),s=j(e,z(e.config.projectRoot,i));return{changedFileLines:n,changedFiles:r,changedRanges:s,renamedFiles:H(e.config.projectRoot,i,r),note:n.length===0?"No changed files found.":void 0}}catch{return{changedFileLines:[],changedFiles:[],changedRanges:[],renamedFiles:[],note:B}}}function $(e,t,i,n=[]){let r=new C(e),s=new Set(i),a=R(n),o=[],d=new Map,f=t.flatMap(c=>r.definitionsForFile(c)).filter(te).filter(c=>Z(c,a)).sort((c,m)=>c.relativePath.localeCompare(m.relativePath)||c.startLine-m.startLine),l=f.map(c=>c.symbolId),u=X(e,l),M=ee(e,l,i),N=S(e,f.filter(c=>u.get(c.symbolId)===0));for(let c of f)Q(e,c,s,o,d,N.get(c.symbolId)??new Set,u.get(c.symbolId)??0,M.get(c.symbolId)??new Set);return{changedSymbols:o,consumerEntries:[...d.entries()].map(([c,m])=>({file:c,symbols:[...m].sort()}))}}function T(e,t){let i=new Map,n=t.flatMap(s=>s.changedSymbols);for(let s of t)for(let a of s.consumerEntries){let o=i.get(a.file);o||(o=new Set,i.set(a.file,o));for(let d of a.symbols)o.add(d)}let r=ne(i);return{changedFiles:[...e],changedSymbols:n,affectedConsumers:r,summary:{totalChangedFiles:e.length,totalChangedSymbols:n.length,totalAffectedFiles:r.length}}}function A(e,t=[]){return{changedFiles:t,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:t.length,totalChangedSymbols:0,totalAffectedFiles:0,note:e}}}function O(e){return{changedFiles:e,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:e.length,totalChangedSymbols:0,totalAffectedFiles:0,note:"Changed files are not present in the current SCIP index."}}}function k(e,t){let i=g("git",["diff","--name-only",t],{encoding:"utf-8",cwd:e,timeout:1e4}),n=g("git",["diff","--name-only","--cached",t],{encoding:"utf-8",cwd:e,timeout:1e4}),r=g("git",["ls-files","--others","--exclude-standard"],{encoding:"utf-8",cwd:e,timeout:1e4});return[...new Set([i,n,r].flatMap(s=>s.split(`
|
|
2
|
-
`)).map(s=>s.trim()).filter(s=>s.length>0))]}function z(e,t){let i=g("git",["diff","--unified=0",t],{encoding:"utf-8",cwd:e,timeout:1e4}),n=g("git",["diff","--unified=0","--cached",t],{encoding:"utf-8",cwd:e,timeout:1e4});return _([...D(i),...D(n)])}function h(e,t,i){try{return g("git",["show",`${t}:./${i}`],{encoding:"utf-8",cwd:e,timeout:1e4,stdio:["ignore","pipe","ignore"]})}catch{return null}}function ue(e,t,i=[]){let n=W(e,t,i);return r=>(n.has(r)||n.set(r,h(e,t,r)),n.get(r)??null)}function me(e,t=e.changedFiles){let i=new Map(e.renamedFiles.map(n=>[n.to,n.from]));return[...new Set(t.map(n=>i.get(n)??n))]}function W(e,t,i){let n=[...new Set(i)],r=new Map;if(n.length===0)return r;try{let s=n.map(o=>`${t}:./${o}
|
|
3
|
-
`).join(""),a=g("git",["cat-file","--batch"],{cwd:e,input:s,maxBuffer:256*1024*1024,timeout:1e4,stdio:["pipe","pipe","ignore"]});return U(a,n)}catch{for(let s of n)r.set(s,h(e,t,s));return r}}function U(e,t){let i=new Map,n=0;for(let r of t){let s=e.indexOf(10,n);if(s<0)throw new Error("git cat-file batch output ended before object header");let a=e.subarray(n,s).toString("utf-8");if(n=s+1,a.endsWith(" missing")){i.set(r,null);continue}let o=/^[0-9a-f]+ ([^ ]+) (\d+)$/.exec(a);if(!o)throw new Error(`unexpected git cat-file batch header: ${a}`);let[,d,f]=o,l=Number(f);if(!Number.isFinite(l)||l<0)throw new Error(`unexpected git cat-file batch size: ${a}`);if(n+l>e.length)throw new Error("git cat-file batch output ended before blob payload");let u=e.subarray(n,n+l);i.set(r,d==="blob"?u.toString("utf-8"):null),n+=l,e[n]===10&&(n+=1)}return i}function H(e,t,i){if(i.length===0)return[];let n=new Map,r=new Set;for(let a of q(e,t))i.includes(a.to)&&(n.set(a.to,a),r.add(a.from));let s=J(e,t);if(s.length===0)return[...n.values()].sort((a,o)=>a.to.localeCompare(o.to));for(let a of i){if(n.has(a)||!v(`${e}/${a}`))continue;let o=s.filter(l=>!r.has(l)).filter(l=>F(l)===F(a));if(o.length===0)continue;let d=E(`${e}/${a}`,"utf-8"),f=o.map(l=>({from:l,to:a,similarity:G(h(e,t,l)??"",d)})).sort((l,u)=>u.similarity-l.similarity)[0];f&&f.similarity>=.45&&(n.set(a,f),r.add(f.from))}return[...n.values()].sort((a,o)=>a.to.localeCompare(o.to))}function J(e,t){let i=g("git",["diff","--name-only","--diff-filter=D",t],{encoding:"utf-8",cwd:e,timeout:1e4}),n=g("git",["diff","--name-only","--diff-filter=D","--cached",t],{encoding:"utf-8",cwd:e,timeout:1e4});return[...new Set([...w(i),...w(n)])]}function q(e,t){let i=g("git",["diff","--name-status","--find-renames",t],{encoding:"utf-8",cwd:e,timeout:1e4}),n=g("git",["diff","--name-status","--find-renames","--cached",t],{encoding:"utf-8",cwd:e,timeout:1e4});return[...i.split(`
|
|
4
|
-
`),...n.split(`
|
|
5
|
-
`)].map(r=>r.trim()).filter(r=>r.startsWith("R")).map(r=>r.split(" ")).filter(r=>r.length>=3).map(([r,s,a])=>({from:s,to:a,similarity:Number(r.slice(1))/100}))}function G(e,t){let i=new Set(I(e)),n=new Set(I(t));if(i.size===0&&n.size===0)return 1;if(i.size===0||n.size===0)return 0;let r=0;for(let s of i)n.has(s)&&(r+=1);return 2*r/(i.size+n.size)}function I(e){return e.match(/[A-Za-z_$][\w$]*|[{}()[\].,]/g)??[]}function w(e){return e.split(`
|
|
6
|
-
`).map(t=>t.trim()).filter(t=>t.length>0)}function Y(e,t){let i=x(e),n=[];for(let r of t){let s=i(r);s&&!e.isIgnored(s)&&n.push(s)}return n}function j(e,t){let i=x(e),n=[];for(let r of t){let s=i(r.file);s&&!e.isIgnored(s)&&n.push({...r,file:s})}return _(n)}function x(e){let t=e.all(`SELECT relative_path FROM documents
|
|
7
|
-
ORDER BY id`).map(n=>n.relative_path),i=new Map(t.map(n=>[n,n]));return n=>{let r=n.replace(/\\/g,"/"),s=i.get(r);return s||(t.find(a=>a.endsWith(r))??null)}}function D(e){let t=[],i=null;for(let n of e.split(`
|
|
8
|
-
`)){if(n.startsWith("+++ ")){i=V(n.slice(4).trim());continue}if(!i||!n.startsWith("@@ "))continue;let r=/@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/.exec(n);if(!r)continue;let s=Math.max(0,Number(r[1])-1),a=r[2]===void 0?1:Number(r[2]);t.push({file:i,startLine:s,endLine:Math.max(s,s+Math.max(a,1)-1)})}return t}function V(e){return e==="/dev/null"?null:e.startsWith("a/")||e.startsWith("b/")?e.slice(2):e}function _(e){let t=new Set,i=[];for(let n of e){let r=`${n.file}:${n.startLine}:${n.endLine}`;t.has(r)||(t.add(r),i.push(n))}return i}function Z(e,t){let i=t.get(e.relativePath);return!i||i.length===0?!0:i.some(n=>K(e.startLine,e.endLine,n.startLine,n.endLine))}function K(e,t,i,n){return e<=n&&i<=t}function Q(e,t,i,n,r,s,a,o){let d=Math.max(a,s.size);if(!ie(t,d))return;let f=y(t.symbol);n.push({symbol:t.symbol,shortName:f,file:t.relativePath,startLine:t.startLine,endLine:t.endLine,fanIn:d});for(let l of o)L(e,i,r,l,f);for(let l of s)L(e,i,r,l,f)}function X(e,t){if(t.length===0)return new Map;let i=e.all(`SELECT m.symbol_id, COUNT(DISTINCT c.document_id) AS fan_in
|
|
9
|
-
FROM mentions m
|
|
10
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
11
|
-
WHERE m.symbol_id IN (${t.map(()=>"?").join(",")})
|
|
12
|
-
AND m.role != 1
|
|
13
|
-
GROUP BY m.symbol_id`,...t);return new Map(i.map(n=>[n.symbol_id,n.fan_in]))}function ee(e,t,i){if(t.length===0||i.length===0)return new Map;let n=e.all(`SELECT DISTINCT m.symbol_id, ref_d.relative_path
|
|
14
|
-
FROM mentions m
|
|
15
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
16
|
-
JOIN documents ref_d ON c.document_id = ref_d.id
|
|
17
|
-
WHERE m.symbol_id IN (${t.map(()=>"?").join(",")})
|
|
18
|
-
AND m.role != 1
|
|
19
|
-
AND ref_d.relative_path NOT IN (${i.map(()=>"?").join(",")})
|
|
20
|
-
${e.pathExclusionsFor("ref_d")}`,...t,...i),r=new Map;for(let s of n){let a=r.get(s.symbol_id);a||(a=new Set,r.set(s.symbol_id,a)),a.add(s.relative_path)}return r}function L(e,t,i,n,r){if(e.isIgnored(n)||t.has(n))return;let s=i.get(n);s||(s=new Set,i.set(n,s)),s.add(r)}function ne(e){return[...e.entries()].map(([t,i])=>({file:t,consumedSymbols:i.size})).sort((t,i)=>i.consumedSymbols-t.consumedSymbols)}function te(e){return!(b(e.symbol)||e.parentTypeName!==null&&!p(e.symbol))}function ie(e,t){return p(e.symbol)||e.isTypeLike?!0:e.parentTypeName===null&&t>0}export{R as a,B as b,ge as c,P as d,$ as e,T as f,h as g,ue as h,me as i,W as j};
|
|
21
|
-
//# sourceMappingURL=chunk-T4N2ZRVY.js.map
|
package/dist/chunk-THB6AM3V.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{a as O,e as ne,f as se,g as et,h as R,i as tt,j as Pe,k as rt,l as nt}from"./chunk-SA3DPTHT.js";import{a as Ye,b as te,h as Ce,j as re}from"./chunk-SGTKURU6.js";import{a as Ze}from"./chunk-64MNV6AB.js";import{a as Qe,c as G,d as _e,f as le}from"./chunk-7S5E7KWT.js";function Ht(e){return e.replace(/'''[\s\S]*?'''/g,M).replace(/"""[\s\S]*?"""/g,M).replace(/#.*$/gm,M).replace(/\/\/.*$/gm,M).replace(/\/\*[\s\S]*?\*\//g,M).replace(/`(?:\\[\s\S]|[^`])*`/g,M).replace(/'(?:\\.|[^'\\\r\n])*'/g,M).replace(/"(?:\\.|[^"\\\r\n])*"/g,M)}function M(e){return e.replace(/[^\r\n]/g," ")}var Ps=le("stripped-lines",{clearGroups:["whole-project","source-file"]});Qe({name:"stripped-source-singleton",groups:["whole-project","source-file"],clearAll:()=>{pe=null,oe=""},clearFile:()=>{pe=null,oe=""}});var pe=null,oe="";function Vt(e){return pe===e||(pe=e,oe=Ht(e)),oe}function v(e,r,t){let n=Vt(e);return`${n.slice(0,r)}${" ".repeat(t-r)}${n.slice(t)}`}function x(e,r){return new RegExp(`\\b${st(r)}\\b`,"m").test(e)}function Q(e,r){let t=new Set,n=new RegExp(`\\b${st(r)}\\s*\\.\\s*([A-Za-z_$][\\w$]*)`,"g");for(let s of e.matchAll(n)){let o=s[1];o&&t.add(o)}return[...t]}function st(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Te(e){let r=0;for(let t of e)t==="("&&(r+=1),t===")"&&(r-=1);return r}var Xt=new Set(["identifier","type_identifier","field_identifier"]),Jt=new Set(["identifier"]),Kt=new Set(["identifier","property_identifier","type_identifier","shorthand_property_identifier","shorthand_property_identifier_pattern"]),Gt=new Set(["rust","python"]),Qt=/\{([^{}]*)\}/g,Yt=/\b([A-Za-z_][\w]*)\b/g;function ot(e,r){return Zt(r).has(e.type)}function it(e,r){return Gt.has(r)&&e.type==="string_content"}function Re(e){let r=0;for(let n of e.values()){let s=n[n.length-1];s!==void 0&&s>r&&(r=s)}let t=new Array(r+1);for(let n=0;n<=r;n+=1)t[n]=new Set;for(let[n,s]of e)for(let o of s)t[o].add(n);return t}function Zt(e){return e==="rust"?Xt:e==="python"?Jt:Kt}function at(e,r){let t=e.startPosition.row;for(let n of e.text.matchAll(Qt)){let s=n[1]??"";for(let o of s.matchAll(Yt))o[1]&&r(o[1],t)}}var er=[/\bdefault\s*=\s*"([^"]+)"/g,/\bwith\s*=\s*"([^"]+)"/g,/\bserialize_with\s*=\s*"([^"]+)"/g,/\bdeserialize_with\s*=\s*"([^"]+)"/g,/\bskip_serializing_if\s*=\s*"([^"]+)"/g,/\bgetter\s*=\s*"([^"]+)"/g,/\brename_all_with\s*=\s*"([^"]+)"/g,/\bschema_with\s*=\s*"([^"]+)"/g],tr=/^#!?\[\s*serde\s*\(/,rr=/^#!?\[\s*schemars\s*\(/,nr=/^#!?\[\s*validate\s*\(/,sr=new Set(["invoke","invokeTauriCommand","listen","once","emit","subscribe","dispatch","sendCommand","callRust"]);function ct(e,r,t){if(r!=="typescript"&&r!=="tsx"&&r!=="javascript"||e.type!=="call_expression")return;let n=e.childForFieldName("function")??e.namedChild(0);if(!n)return;let s=Pe(n);if(!s||!sr.has(s))return;let o=e.namedChildren.find(c=>c.type==="arguments");if(!o)return;let i=o.namedChild(0);if(!i||i.type!=="string")return;let a=i.namedChildren.find(c=>c.type==="string_fragment");a&&t.add(a.text)}function lt(e,r){let t=tr.test(e),n=rr.test(e),s=nr.test(e);if(!(!t&&!n&&!s))for(let o of er){o.lastIndex=0;let i;for(;(i=o.exec(e))!==null;){let a=i[1],c=a.split("::").pop()??a;c==="is_none"&&/\bOption\b/.test(a)||c==="is_empty"&&/\b(String|Vec|HashMap|BTreeMap|HashSet|BTreeSet)\b/.test(a)||c&&r.add(c)}}}function pt(e,r){let t=new Map,n=(i,a)=>{if(i===a)return;let c=t.get(i);c||(c=new Set,t.set(i,c)),c.add(a)},s=r==="python"?new Set(["identifier"]):new Set(["type_identifier"]),o=(i,a)=>{let c=l=>{s.has(l.type)&&l.text!==a&&n(l.text,a);for(let p of l.children)c(p)};for(let l of i.children)c(l)};if(r==="rust")for(let i of e.rootNode.descendantsOfType(["struct_item","enum_item","union_item","type_item"])){let a=i.namedChildren.find(l=>l.type==="type_identifier")?.text;if(!a)continue;let c=i.namedChildren.find(l=>l.type==="field_declaration_list"||l.type==="enum_variant_list"||l.type==="ordered_field_declaration_list");c&&o(c,a),i.type==="type_item"&&o(i,a)}else if(r==="python")for(let i of e.rootNode.descendantsOfType("class_definition")){let a=i.namedChildren.find(l=>l.type==="identifier")?.text;if(!a)continue;let c=i.namedChildren.find(l=>l.type==="block");if(c)for(let l of c.descendantsOfType("type"))for(let p of l.descendantsOfType("identifier"))p.text!==a&&n(p.text,a)}else for(let i of e.rootNode.descendantsOfType(["interface_declaration","type_alias_declaration","class_declaration"])){let a=i.namedChildren.find(c=>c.type==="type_identifier")?.text;a&&o(i,a)}return t}var or=new Map([["defn","function"],["defn-","function"],["defmacro","macro"],["defmacro-","macro"],["defmethod","method"]]),ke=new Set(["catch","comment","def","defprotocol","defrecord","deftype","defmethod","defmacro","defmacro-","defn","defn-","do","doseq","dotimes","fn","for","if","let","loop","ns","quote","recur","throw","try","extend-protocol","extend-type","when","when-let","when-not"]);function ut(e){let r=[],t=[],n=[],s=new Map,o=[],i=0,a=0,c=(l,p)=>{let u=s.get(l);if(!u){s.set(l,[p]);return}u[u.length-1]!==p&&u.push(p)};for(;a<e.length;){let l=e[a];if(l===`
|
|
2
|
-
`){i+=1,a+=1;continue}if(/\s|,/.test(l)){a+=1;continue}if(l===";"){a=mr(e,a);continue}if(l==='"'){let h=fr(e,a,i);i=h.line,a=h.index;continue}if(l==="("||l==="["||l==="{"){o.push({kind:l,startLine:i,endLine:i,headTokens:[],tokens:[],children:[]}),a+=1;continue}if(l===")"||l==="]"||l==="}"){let h=o.pop();h&&(h.endLine=i,ir(h,{callables:r,callSites:t,clojureMembers:n,recordIdentifier:c}),o[o.length-1]?.children.push(h)),a+=1;continue}if(dr(l)){a+=1;continue}let p=i,u=a;for(;a<e.length&&!gr(e[a]);)a+=1;let m=e.slice(u,a);if(!m)continue;let f={text:m,line:p};ar(o[o.length-1],f),c(I(m),p)}return{language:"clojure",callables:r,callSites:t,clojureMembers:n,typeContainerMap:new Map,identifierLineMap:s,identifiersByLine:Sr(s),fileIdentifiers:new Set(s.keys()),rustAttrReferencedNames:new Set,crossLanguageDispatchNames:new Set}}function ir(e,r){if(e.kind!=="("||e.headTokens.length===0)return;let t=e.headTokens[0],n=I(t.text),s=or.get(t.text);if(s){let i=e.headTokens[1];if(i){let a=I(i.text);r.recordIdentifier(a,i.line),r.callables.push({name:a,startLine:e.startLine,endLine:e.endLine,paramCount:0,params:[],paramsEndLine:i.line,isLiteralPassthrough:!1,clojureKind:s})}}if(cr(e,r),!n||ke.has(t.text)||ke.has(n)||n.startsWith(":"))return;let o=ur(t.text);r.callSites.push({calleeLeaf:o.leaf,calleeQualifier:o.qualifier,calleeText:o.text,memberAccess:!1,line:t.line})}function ar(e,r){e&&(e.headTokens.length<2&&e.headTokens.push(r),e.tokens.length<200&&e.tokens.push(r))}function cr(e,r){let t=I(e.tokens[0]?.text??"");if(t==="defprotocol"){let n=I(e.tokens[1]?.text??"");if(!n)return;for(let s of ue(e))ie(r,n,"protocol",s,"protocol-method");return}if(t==="defrecord"||t==="deftype"){let n=I(e.tokens[1]?.text??"");if(!n)return;let s=t==="defrecord"?"record":"type",o=t==="defrecord"?"record-method":"type-method";for(let i of ue(e))ie(r,n,s,i,o);return}if(t==="extend-type"){let n=I(e.tokens[1]?.text??"");if(!n)return;for(let s of ue(e))ie(r,n,"extension",s,"extension-method");return}if(t==="extend-protocol"){let n=I(e.tokens[1]?.text??"");for(let s of ue(e)){n&&ie(r,n,"extension",s,"extension-method");let o=pr(e,s.startLine);o&&o!==n&&ie(r,o,"extension",s,"extension-method")}}}function ue(e){return e.children.filter(lr)}function lr(e){if(e.kind!=="(")return!1;let r=I(e.tokens[0]?.text??"");return!!(r&&!ke.has(r)&&!r.startsWith(":"))}function ie(e,r,t,n,s){let o=n.tokens[0],i=I(o?.text??"");!o||!i||(e.recordIdentifier(i,o.line),e.clojureMembers.push({ownerName:r,ownerKind:t,memberName:i,memberKind:s,startLine:n.startLine,endLine:n.endLine}))}function pr(e,r){let t=null;for(let n=2;n<e.tokens.length;n+=1){let s=e.tokens[n];if(s.line>r)break;let o=I(s.text);o&&!o.startsWith(":")&&(t=o)}return t}function I(e){return e.replace(/^#?['`~@]+/,"").split("/").pop()?.replace(/^\./,"")??""}function ur(e){let r=e.replace(/^#?['`~@]+/,""),t=r.lastIndexOf("/"),n=I(r);if(t<=0)return{leaf:n,text:r};let s=r.slice(0,t);return{leaf:n,qualifier:s,text:r}}function mr(e,r){let t=r;for(;t<e.length&&e[t]!==`
|
|
3
|
-
`;)t+=1;return t}function fr(e,r,t){let n=r+1,s=t;for(;n<e.length;){let o=e[n];if(o==="\\"){n+=2;continue}if(o===`
|
|
4
|
-
`&&(s+=1),n+=1,o==='"')break}return{index:n,line:s}}function dr(e){return e==="'"||e==="`"||e==="~"||e==="@"||e==="^"||e==="#"}function gr(e){return/\s|,/.test(e)||e==="("||e===")"||e==="["||e==="]"||e==="{"||e==="}"}function Sr(e){let r=[];for(let[t,n]of e)for(let s of n)r[s]??=new Set,r[s].add(t);return r}var hr=le("source-facts",{clearGroups:["whole-project","source-file"]}),Le=re({kind:"source-facts",serialize:Nr,deserialize:br});function A(e,r){let t=O(e,r);if(!t)return null;let n=xr(r,t);return n?hr.get(e,r,t,()=>yr(e,r,n,t)):null}function xr(e,r){return se(e)?et(r)?.language??null:ne(e)}function yr(e,r,t,n){let s=te(e,r,n),o=Le.read(e,r,s);if(o&&o.language===t)return o;if(t==="clojure"){let c=ut(n);return Le.write(e,r,s,c),c}let i=R(e,r);if(!i)return null;let a=Cr(i,t);return Le.write(e,r,s,a),a}function Nr(e){let r={language:e.language,callables:e.callables,callSites:e.callSites,clojureMembers:e.clojureMembers,typeContainerMap:[...e.typeContainerMap.entries()].map(([t,n])=>[t,[...n]]),identifierLineMap:[...e.identifierLineMap.entries()],rustAttrReferencedNames:[...e.rustAttrReferencedNames],crossLanguageDispatchNames:[...e.crossLanguageDispatchNames]};return JSON.stringify(r)}function br(e){try{let r=JSON.parse(e);if(r.language==="clojure"&&(r.clojureMembers===void 0||r.callSites.some(n=>n.calleeText===void 0)))return null;let t=new Map(r.identifierLineMap);return{language:r.language,callables:r.callables,callSites:r.callSites,clojureMembers:r.clojureMembers??[],typeContainerMap:new Map(r.typeContainerMap.map(([n,s])=>[n,new Set(s)])),identifierLineMap:t,identifiersByLine:Re(t),fileIdentifiers:new Set(t.keys()),rustAttrReferencedNames:new Set(r.rustAttrReferencedNames),crossLanguageDispatchNames:new Set(r.crossLanguageDispatchNames)}}catch{return null}}function Ir(e,r,t,n){let s=A(e,r);return s?_r(s,t,n)?.isLiteralPassthrough??!0:!0}function Er(e,r){return r.relativePath.includes(".clj-kondo/hooks/")?!0:A(e,r.relativePath)?.callables.find(n=>n.startLine===r.startLine&&n.endLine===r.endLine)?.clojureKind==="macro"}function _r(e,r,t){return e.callables.find(n=>n.startLine===r&&n.endLine===t)??null}function Cr(e,r){let t=[],n=[],s=new Set,o=new Set,i=new Map,a=(l,p)=>{let u=i.get(l);if(!u){i.set(l,[p]);return}u[u.length-1]!==p&&u.push(p)},c=l=>{let p=rt(l,r);p&&t.push(p);let u=tt(l,r);u&&n.push(u),ct(l,r,o),r==="rust"&&(l.type==="attribute_item"||l.type==="inner_attribute_item")&<(l.text,s),ot(l,r)&&a(l.text,l.startPosition.row),it(l,r)&&at(l,a);for(let m of l.children)c(m)};return c(e.rootNode),{language:r,callables:t,callSites:n,clojureMembers:[],typeContainerMap:pt(e,r),identifierLineMap:i,identifiersByLine:Re(i),fileIdentifiers:new Set(i.keys()),rustAttrReferencedNames:s,crossLanguageDispatchNames:o}}var mt=new Set(["rust","typescript","tsx","javascript","python","clojure"]);function Pr(e,r){let t=A(e,r);return!t||!mt.has(t.language)?null:t.callables.map(n=>({name:n.name,startLine:n.startLine,endLine:n.endLine}))}function Tr(e,r){let t=A(e,r);return!t||!mt.has(t.language)?null:t.callSites}function Rr(e,r){return A(e,r)?.typeContainerMap??new Map}function kr(e,r,t={}){let n=A(e,r);if(!n)return[];let s=[];if(t.includeCrossLanguageDispatchNames)for(let o of n.crossLanguageDispatchNames)s.push({name:o,kind:"cross-language-dispatch",occurrences:1});if(t.includeRustAttributeNames&&n.language==="rust")for(let o of n.rustAttrReferencedNames)s.push({name:o,kind:"rust-attribute",occurrences:1});return s}import{existsSync as me}from"fs";import{basename as ft,dirname as $,extname as D,join as P,relative as ae,resolve as E}from"path";var Lr=_e("indexed-paths",{clearGroups:[]}),Ar=_e("indexed-path-digest",{clearGroups:[]}),W=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue"],fe=[".py",".pyi"],N=[".java",".scala",".kt",".kts"],de=[".rs"],ge=[".rb"],Se=[".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx"],U=[".cs",".vb"],he=[".dart"],z=[".php"],Y=[".clj",".cljs",".cljc"],Dr=new Set(W),Ae=new Set(fe),dt=new Set(N),De=new Set(de),we=new Set(ge),gt=new Set(Se),St=new Set(U),je=new Set(he),ht=new Set(z),xt=new Set(Y),wr=[{extensions:W,lookup:Dr},{extensions:fe,lookup:Ae},{extensions:N,lookup:dt},{extensions:de,lookup:De},{extensions:ge,lookup:we},{extensions:Se,lookup:gt},{extensions:U,lookup:St},{extensions:he,lookup:je},{extensions:z,lookup:ht},{extensions:Y,lookup:xt}];function w(e,r){return r.has(D(e).toLowerCase())}function jr(e){return w(e,Ae)}function Fr(e){return w(e,dt)}function Or(e){return w(e,De)}function Mr(e){return w(e,we)}function vr(e){return w(e,gt)}function $r(e){return w(e,St)}function yt(e){return D(e).toLowerCase()===".vb"}function Ur(e){return w(e,je)}function Br(e){return w(e,ht)}function qr(e){return w(e,xt)}function Fe(e){let r=D(e).toLowerCase();for(let t of wr)if(t.lookup.has(r))return t.extensions;return W}function Wr(e){return Fr(e)||$r(e)||Br(e)}function B(e,r,t){return jr(r)?Z(e,r,t):Or(r)?j(e,r,t):Mr(r)?xe(e,r,t):vr(r)?ye(e,r,t):Wr(r)?g(e,t.replace(/\\/g,"."),Fe(r)):Ur(r)?Ne(e,r,t):qr(r)?Oe(e,t):zr(e,r,t)}function zr(e,r,t){if(!t.startsWith(".")&&!t.startsWith("/"))return null;let n=$(P(e.config.projectRoot,r)),s=E(n,t),o=H(e);for(let i of Kr(s)){let a=T(ae(e.config.projectRoot,i));if(o.has(a)||me(i))return a}return T(ae(e.config.projectRoot,s))}function Z(e,r,t){let n=H(e),s;if(t.startsWith(".")){let o=t.match(/^(\.+)(.*)$/);if(!o)return null;let i=o[1].length,a=o[2].replace(/^\./,""),c=$(P(e.config.projectRoot,r));for(let l=1;l<i;l++)c=$(c);s=a?E(c,a.replace(/\./g,"/")):c}else s=E(e.config.projectRoot,t.replace(/\./g,"/"));for(let o of Hr(s)){let i=T(ae(e.config.projectRoot,o));if(n.has(i)||me(o))return i}return null}function j(e,r,t){if(!t)return null;let n=t.replace(/\s+as\s+.+$/,"").trim();if(!n.startsWith("crate::")&&!n.startsWith("self::")&&!n.startsWith("super::"))return null;let s=$(P(e.config.projectRoot,r)),o;return n.startsWith("crate::")?o=E(e.config.projectRoot,"src",n.slice(7).replace(/::/g,"/")):n.startsWith("self::")?o=E(s,n.slice(6).replace(/::/g,"/")):o=E($(s),n.slice(7).replace(/::/g,"/")),Me(e,Vr(o))}function xe(e,r,t){let n=$(P(e.config.projectRoot,r)),s=E(n,t);return Me(e,Xr(s))}function ye(e,r,t){let n=$(P(e.config.projectRoot,r)),s=[E(n,t),E(e.config.projectRoot,t),E(e.config.projectRoot,"include",t),E(e.config.projectRoot,"src",t)];return Me(e,s)}function g(e,r,t){let n=H(e),s=r.replace(/\\/g,".").replace(/::/g,".").replace(/^global::/,""),o=s.replace(/\./g,"/"),i=s.split(".").pop()??s;for(let c of t){let l=`${o}${c}`,p=[...n].find(u=>u.endsWith(l));if(p)return p}for(let c of t){let l=[...n].find(p=>ft(p)===`${i}${c}`);if(l)return l}let a=[...n].filter(c=>t.includes(D(c).toLowerCase())).filter(c=>c.includes(`/${o}/`)||c.includes(`/${i}/`)).sort((c,l)=>c.localeCompare(l));return a.length===1?a[0]:null}function Ne(e,r,t){let n=H(e);if(t.startsWith("package:")){let i=t.slice(8),a=i.indexOf("/");if(a<0)return null;let c=i.slice(a+1),l=T(c.startsWith("lib/")?c:`lib/${c}`);return n.has(l)?l:null}let s=$(P(e.config.projectRoot,r)),o=E(s,t);for(let i of Jr(o)){let a=T(ae(e.config.projectRoot,i));if(n.has(a)||me(i))return a}return null}function Oe(e,r){let t=r.replace(/-/g,"_").replace(/\./g,"/"),n=H(e);for(let s of Y){let o=`${t}${s}`,i=[...n].find(a=>a.endsWith(o));if(i)return i}for(let s of Y){let o=[...n].find(i=>ft(i)===`${t.split("/").pop()}${s}`);if(o)return o}return null}function Hr(e){let r=D(e);return Ae.has(r)?[e]:[`${e}.py`,`${e}.pyi`,P(e,"__init__.py"),P(e,"__init__.pyi")]}function Me(e,r){let t=H(e);for(let n of r){let s=T(ae(e.config.projectRoot,n));if(t.has(s)||me(n))return s}return null}function Vr(e){let r=D(e);return De.has(r)?[e]:[`${e}.rs`,P(e,"mod.rs")]}function Xr(e){let r=D(e);return we.has(r)?[e]:[`${e}.rb`,P(e,"index.rb")]}function Jr(e){let r=D(e);return je.has(r)?[e]:[`${e}.dart`,e]}function Kr(e){let r=D(e),t=new Set;if(r){t.add(e);for(let n of W)t.add(e.slice(0,-r.length)+n)}else for(let n of W)t.add(`${e}${n}`),t.add(P(e,`index${n}`));return[...t]}function H(e){return Lr.get(e,()=>new Set(Ze(e,{includeIgnored:!1}).map(T)))}function ve(e){return Ar.get(e,()=>Ye([...H(e)].sort().join(`
|
|
5
|
-
`)))}function T(e){return e.replace(/\\/g,"/")}import{basename as Nt}from"path";var Gr=new Set(["identifier","type_identifier","property_identifier","shorthand_property_identifier","field_identifier"]);function y(e){let r=[],t=0,n=0;for(let s=0;s<e.length;s++){let o=e[s];(o==="{"||o==="["||o==="(")&&t++,(o==="}"||o==="]"||o===")")&&t--,o===","&&t===0&&(r.push(e.slice(n,s)),n=s+1)}return r.push(e.slice(n)),r}function b(e,r){for(let t of e.namedChildren)if(t.type===r)return t;return null}function S(e,r){let t=new Set,n=(s,o)=>{let i=o||r.has(s.type);!i&&Gr.has(s.type)&&t.add(s.text);for(let a of s.children)n(a,i)};return n(e.rootNode,!1),t}function k(e,r,t,n,s,o,i){return{importedName:s,localName:o,sourcePath:i??g(e,n,Fe(r)),kind:"named",used:x(t,o),usedMembers:[]}}function d(e,r,t,n,s="named",o={}){return{importedName:e,localName:r,sourcePath:t,kind:s,used:n.has(r),usedMembers:[],isTypeOnly:o.isTypeOnly}}function F(e,r,t,n,s="named",o=[],i={}){return{importedName:e,localName:r,sourcePath:t,kind:s,used:n,usedMembers:o,isTypeOnly:i.isTypeOnly}}function V(e,r){return{importedName:e,localName:null,sourcePath:r,kind:"side-effect",used:!0,usedMembers:[]}}function X(e,r,t={}){return{importedName:e,localName:t.localName??null,sourcePath:r,kind:"namespace",used:t.used??!0,usedMembers:t.usedMembers??[],isTypeOnly:t.isTypeOnly}}function _(e,r,t){let n=[];for(let s of e.matchAll(r)){let o=s[0];if(!o||typeof s.index!="number")continue;let i=v(e,s.index,s.index+o.length);for(let a of t(s,i))n.push(a)}return n}function C(e,r,t,n){let s=R(e,r);if(s){let o=t(s);if(o)return o}return n()}function be(e,r,t,n){let s=R(e,r),o=ne(r),i=o?t[o]:void 0;return s&&i?i(s):n()}function bt(e,r,t){return C(e,r,n=>Yr(e,r,n),()=>Qr(e,r,t))}function Qr(e,r,t){return _(t,/^[ \t]*#include\s+[<"]([^">]+)[">]\s*$/gm,(n,s)=>{let o=n[1]?.trim();if(!o)return[];let i=Nt(o).replace(/\.[^.]+$/,"");return[F(o,i,ye(e,r,o),x(s,i))]})}function Yr(e,r,t){let n=S(t,new Set(["preproc_include"])),s=[];for(let o of t.rootNode.descendantsOfType("preproc_include")){let i=null;for(let c of o.namedChildren){if(c.type==="system_lib_string"){i=c.text.replace(/^<|>$/g,"");break}if(c.type==="string_literal"){i=c.namedChildren.find(p=>p.type==="string_content")?.text??c.text.replace(/^"|"$/g,"");break}}if(!i)continue;let a=Nt(i).replace(/\.[^.]+$/,"");s.push(d(i,a,ye(e,r,i),n))}return s}var Zr=new Set([":require",":require-macros",":use"]),qe=String.raw`A-Za-z0-9_$*+!?.<>=-`;function Et(e,r,t){let n=un(t);if(!n)return[];let s=pn(t,n.start,n.end),o=[];for(let i of n.children.slice(2)){if(i.type!=="list"||i.children.length===0)continue;let a=L(i.children[0]);if(a){if(Zr.has(a)){for(let c of rn(i.children.slice(1)))o.push(...tn(e,c,s));continue}if(a===":import")for(let c of sn(i.children.slice(1)))o.push(c)}}return o}function en(e){return e.type==="list"&&L(e.children[0])==="ns"}function tn(e,r,t){let n=Oe(e,r.namespace),s=r.alias??r.namespace,o=an(t,s),i=[{importedName:r.namespace,localName:s,sourcePath:n,kind:"namespace",used:r.refers.length>0||r.referAll||o.length>0||cn(t,r.namespace),usedMembers:o}];r.referAll&&i.push({importedName:"*",localName:null,sourcePath:n,kind:"side-effect",used:!0,usedMembers:[]});for(let a of r.refers)i.push({importedName:a,localName:a,sourcePath:n,kind:"named",used:ln(t,a),usedMembers:[]});return i}function rn(e){return e.flatMap(r=>_t(r,null))}function _t(e,r){if(e.type==="atom")return e.text.startsWith(":")?[]:[{namespace:Ue(r,e.text),alias:null,refers:[],referAll:!1}];if(e.type==="vector")return nn(e,r);if(e.type==="list"&&e.children.length>0){let t=L(e.children[0]);return!t||t.startsWith(":")?[]:e.children.slice(1).flatMap(n=>_t(n,Ue(r,t)))}return[]}function nn(e,r){let t=L(e.children[0]);if(!t||t.startsWith(":"))return[];let n={namespace:Ue(r,t),alias:null,refers:[],referAll:!1};for(let s=1;s<e.children.length;s+=1){let o=L(e.children[s]);if(!o?.startsWith(":"))continue;let i=e.children[s+1];if((o===":as"||o===":as-alias")&&i){n.alias=L(i),s+=1;continue}o===":refer"&&i&&(L(i)===":all"?n.referAll=!0:(i.type==="vector"||i.type==="list")&&n.refers.push(...i.children.map(L).filter(on)),s+=1)}return[n]}function sn(e){let r=[];for(let t of e){if(t.type==="atom"){let s=t.text.split(".").pop()??t.text;r.push(F(s,s,null,!0));continue}if(t.type!=="vector")continue;let n=L(t.children[0]);if(n)for(let s of t.children.slice(1)){let o=L(s);o&&r.push(F(`${n}.${o}`,o,null,!0))}}return r}function Ue(e,r){return e?`${e}.${r}`:r}function L(e){return e?.type==="atom"?e.text:null}function on(e){return!!(e&&!e.startsWith(":"))}function an(e,r){let t=new Set,n=new RegExp(`${We()}${ze(r)}\\s*/\\s*([${qe}]+)`,"g");for(let s of e.matchAll(n)){let o=s[1];o&&t.add(o)}return[...t]}function cn(e,r){return new RegExp(`${We()}${ze(r)}\\s*/`,"m").test(e)}function ln(e,r){return new RegExp(`${We()}${ze(r)}(?![${qe}])`,"m").test(e)}function We(){return`(?<![${qe}])`}function ze(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function pn(e,r,t){let n="",s=0;for(;s<e.length;){if(s>=r&&s<t){n+=e[s]===`
|
|
6
|
-
`?`
|
|
7
|
-
`:" ",s+=1;continue}let o=e[s];if(o===";"){let i=Ct(e,s);n+=It(e.slice(s,i)),s=i;continue}if(o==='"'){let i=Be(e,s);n+=It(e.slice(s,i)),s=i;continue}n+=o,s+=1}return n}function un(e){let r=0;for(;r<e.length&&(r=Ve(e,r),!(r>=e.length));){let t=He(e,r);if(!t){r+=1;continue}if(en(t.form))return t.form;r=t.index}return null}function He(e,r){let t=Ve(e,r);if(e.startsWith("#_",t)){let s=He(e,t+2);return s?{form:{type:"atom",text:"",start:t,end:s.index},index:s.index}:null}for(;fn(e[t]);)t+=1;let n=e[t];return n?n==="("?$e(e,t,"list",")"):n==="["?$e(e,t,"vector","]"):n==="{"?$e(e,t,"map","}"):n==='"'?{form:{type:"atom",text:"",start:t,end:Be(e,t)},index:Be(e,t)}:mn(e,t):null}function $e(e,r,t,n){let s=[],o=r+1;for(;o<e.length;){if(o=Ve(e,o),e[o]===n)return{form:{type:t,children:s,start:r,end:o+1},index:o+1};let i=He(e,o);if(!i){o+=1;continue}i.form.type==="atom"&&i.form.text===""||s.push(i.form),o=i.index}return{form:{type:t,children:s,start:r,end:e.length},index:e.length}}function mn(e,r){let t=r;for(;t<e.length&&!dn(e[t]);)t+=1;return{form:{type:"atom",text:e.slice(r,t),start:r,end:t},index:t}}function Ve(e,r){let t=r;for(;t<e.length;){let n=e[t];if(/\s|,/.test(n)){t+=1;continue}if(n===";"){t=Ct(e,t);continue}break}return t}function Ct(e,r){let t=r;for(;t<e.length&&e[t]!==`
|
|
8
|
-
`;)t+=1;return t}function Be(e,r){let t=r+1;for(;t<e.length;){let n=e[t];if(n==="\\"){t+=2;continue}if(t+=1,n==='"')break}return t}function fn(e){return e==="'"||e==="`"||e==="~"||e==="@"||e==="^"}function dn(e){return/\s|,/.test(e)||e==="("||e===")"||e==="["||e==="]"||e==="{"||e==="}"||e==='"'||e===";"}function It(e){return e.replace(/[^\r\n]/g," ")}function Pt(e,r,t){let n=[];for(let s of t.matchAll(/^[ \t]*import\s+['"]([^'"]+)['"](?:\s+as\s+([A-Za-z_]\w*))?[\s\S]*?;$/gm)){let o=s[1]?.trim(),i=s[2]?.trim()??null,a=s[0];if(!o||!a||typeof s.index!="number")continue;let c=v(t,s.index,s.index+a.length);n.push({importedName:o,localName:i,sourcePath:Ne(e,r,o),kind:i?"namespace":"side-effect",used:i?x(c,i):!0,usedMembers:i?Q(c,i):[]})}return n}function Tt(e,r,t){let n=[];for(let s of t.matchAll(/^[ \t]*export\s+['"]([^'"]+)['"][\s\S]*?;$/gm)){let o=s[1]?.trim();o&&n.push({specifier:o,sourcePath:Ne(e,r,o)})}return n}function Rt(e,r,t){return be(e,r,{csharp:n=>Sn(e,r,n),vb:n=>gn(e,r,n)},()=>{let n=yt(r)?/^[ \t]*Imports\s+(.+?)\s*$/gm:/^[ \t]*using\s+(.+?)\s*;$/gm;return _(t,n,(s,o)=>{let i=s[1]?.trim();if(!i)return[];let[a,c]=i.split(/\s*=\s*/),l=!!c,p=(l?c:a)?.trim()??i,u=p.split(".").pop()??p,m=l?a?.trim()??u:u;return[k(e,r,o,p,u,m,g(e,p,U))]})})}function gn(e,r,t){let n=S(t,new Set(["imports_statement"])),s=[];for(let o of t.rootNode.descendantsOfType("imports_statement")){let i=o.namedChildren.filter(m=>m.type==="namespace_name");if(i.length===0)continue;let a=i[i.length-1],c=i.length>1?i[0]:null,l=a.text,p=l.split(".").pop()??l,u=c?.text??p;s.push(d(p,u,g(e,l,U),n,c?"namespace":"named"))}return s}function Sn(e,r,t){let n=S(t,new Set(["using_directive"])),s=[];for(let o of t.rootNode.descendantsOfType("using_directive")){let i=o.namedChildren;if(i.length===0)continue;let a=null,c;i.length>=2&&i[0].type==="identifier"&&(i[1].type==="qualified_name"||i[1].type==="identifier")?(a=i[0],c=i[1]):c=i[i.length-1];let l=c.text,p=l.split(".").pop()??l,u=a?.text??p;s.push(d(p,u,g(e,l,U),n,a?"namespace":"named"))}return s}var hn=G("vue-non-script-identifiers",{clearGroups:["whole-project","source-file"]});function kt(e,r){return hn.get(e,r,()=>{let t=new Set,n=O(e,r);if(!n)return t;let o=n.replace(/<script\b[^>]*>[\s\S]*?<\/script>/g,i=>i.replace(/[^\r\n]/g," ")).replace(/<!--[\s\S]*?-->/g,i=>i.replace(/[^\r\n]/g," ")).replace(/\/\*[\s\S]*?\*\//g,i=>i.replace(/[^\r\n]/g," "));for(let i of o.matchAll(/[A-Za-z_$][\w$]*/g))t.add(i[0]);return t})}function Xe(e,r,t){return C(e,r,n=>yn(e,r,n),()=>xn(e,r,t))}function xn(e,r,t){return Ln(t).flatMap(n=>An(e,r,n.clause,n.specifier,n.start,n.end,t))}function yn(e,r,t){let n=Nn(e,r,t),s=[];for(let o of t.rootNode.descendantsOfType("import_statement"))s.push(...bn(e,r,t,o,n));return s}function Nn(e,r,t){let n=S(t,new Set(["import_statement"]));if(se(r))for(let s of kt(e,r))n.add(s);return n}function bn(e,r,t,n,s){let o=Pn(n);if(!o)return[];let i=B(e,r,o),a=b(n,"import_clause");return a?In(t,a,i,s,Tn(n.text)):[V("*",i)]}function In(e,r,t,n,s){let o=[];for(let i of r.namedChildren)if(i.type==="identifier")o.push(En(i.text,t,n,s));else if(i.type==="namespace_import"){let a=_n(e,i,t,n,s);a&&o.push(a)}else i.type==="named_imports"&&o.push(...Cn(i,t,n,s));return o}function En(e,r,t,n){return d("default",e,r,t,"default",{isTypeOnly:n})}function _n(e,r,t,n,s){let i=b(r,"identifier")?.text??"";if(!i)return null;let a=kn(e,i);return X("*",t,{localName:i,usedMembers:a,isTypeOnly:s,used:a.length>0||n.has(i)})}function Cn(e,r,t,n){let s=[];for(let o of e.namedChildren){if(o.type!=="import_specifier")continue;let i=o.namedChild(0),a=o.namedChild(1);if(!i)continue;let c=i.text,l=a?.text??c;s.push(d(c,l,r,t,"named",{isTypeOnly:n||Rn(o.text)}))}return s}function Pn(e){let r=b(e,"string");if(!r)return null;let t=b(r,"string_fragment");return t?t.text:null}function Tn(e){return/^\s*import\s+type\b/.test(e)}function Rn(e){return/^\s*type\b/.test(e.trim())}function kn(e,r){let t=new Set;for(let n of e.rootNode.descendantsOfType("member_expression")){let s=n.namedChild(0),o=n.namedChild(1);!s||!o||s.type!=="identifier"||s.text!==r||(o.type==="property_identifier"||o.type==="identifier")&&t.add(o.text)}return[...t]}function Ln(e){let r=[],t=/^[ \t]*import\s+([\s\S]*?)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let s of e.matchAll(t)){let o=s[0],i=s[1],a=s[2];!o||!a||typeof s.index!="number"||r.push({clause:i,specifier:a,start:s.index,end:s.index+o.length})}let n=/^[ \t]*import\s+['"]([^'"]+)['"]\s*;?/gm;for(let s of e.matchAll(n)){let o=s[0],i=s[1];!o||!i||typeof s.index!="number"||r.push({clause:null,specifier:i,start:s.index,end:s.index+o.length})}return r.sort((s,o)=>s.start-o.start)}function An(e,r,t,n,s,o,i){let a=B(e,r,n),c=v(i,s,o);return t?Dn(t).map(p=>({...p,sourcePath:a})).map(p=>{if(p.kind==="namespace"){let u=Q(c,p.localName);return X(p.importedName,p.sourcePath,{localName:p.localName,usedMembers:u,used:u.length>0||x(c,p.localName),isTypeOnly:p.isTypeOnly})}return p.kind==="side-effect"?V(p.importedName,p.sourcePath):F(p.importedName,p.localName??"",p.sourcePath,p.localName?x(c,p.localName):!1,p.kind,[],{isTypeOnly:p.isTypeOnly})}):[V("*",a)]}function Dn(e){let r=e.trim(),t=/^type\b/.test(r),n=r.replace(/^type\s+/,""),[s,o]=wn(n),i=[];return s&&i.push(...Lt(s,t)),o&&i.push(...Lt(o,t)),i}function Lt(e,r){let t=e.trim();if(!t)return[];if(t.startsWith("{")){let n=t.slice(1,-1).trim();return n?y(n).map(s=>{let o=s.trim(),i=r||/^type\b/.test(o),a=o.replace(/^type\s+/,""),[c,l]=a.split(/\s+as\s+/);return{importedName:c.trim(),localName:(l??c).trim(),kind:"named",isTypeOnly:i}}):[]}return t.startsWith("* as ")?[{importedName:"*",localName:t.slice(5).trim(),kind:"namespace",isTypeOnly:r}]:[{importedName:"default",localName:t,kind:"default",isTypeOnly:r}]}function wn(e){let r=0;for(let t=0;t<e.length;t++){let n=e[t];if(n==="{"&&r++,n==="}"&&r--,n===","&&r===0)return[e.slice(0,t).trim(),e.slice(t+1).trim()]}return[e.trim(),null]}function Je(e,r,t){let n=R(e,r);return n?$n(e,r,n):jn(e,r,t)}function jn(e,r,t){return[...Fn(e,r,t),...On(e,r,t),...Mn(e,r,t)]}function Fn(e,r,t){let n=[],s=/^[ \t]*export\s+(?:type\s+)?\{([\s\S]*?)\}\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of t.matchAll(s)){if(typeof o.index!="number")continue;let i=o[1]??"",a=o[2]??"",c=y(i).map(u=>vn(u.trim())).filter(u=>!!u),l=ee(t,o.index),p=ee(t,o.index+o[0].length-1);n.push({kind:"named",sourcePath:B(e,r,a),names:c,startLine:l,endLine:p})}return n}function On(e,r,t){let n=[],s=/^[ \t]*export\s+\*\s+as\s+(\w+)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of t.matchAll(s)){if(typeof o.index!="number")continue;let i=o[2]??"",a=ee(t,o.index),c=ee(t,o.index+o[0].length-1);n.push({kind:"star-as",sourcePath:B(e,r,i),names:[],startLine:a,endLine:c})}return n}function Mn(e,r,t){let n=[],s=/^[ \t]*export\s+\*\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of t.matchAll(s)){if(typeof o.index!="number")continue;let i=o[1]??"",a=ee(t,o.index),c=ee(t,o.index+o[0].length-1);n.push({kind:"star",sourcePath:B(e,r,i),names:[],startLine:a,endLine:c})}return n}function vn(e){if(!e)return null;let r=e.replace(/^type\s+/,"").trim();if(!r)return null;let t=r.match(/^(\w+)\s+as\s+(\w+)$/);if(t)return t[2]??null;let n=r.match(/^(\w+)$/);return n?n[1]??null:null}function ee(e,r){let t=0;for(let n=0;n<r&&n<e.length;n++)e.charCodeAt(n)===10&&t++;return t}function $n(e,r,t){let n=[];for(let s of t.rootNode.descendantsOfType("export_statement")){let o=Un(e,r,s);if(o===void 0)continue;let i=s.startPosition.row,a=s.endPosition.row,c=Bn(s,o,i,a);n.push(c)}return n}function Un(e,r,t){let n=b(t,"string");if(!n)return;let s=b(n,"string_fragment");if(s)return B(e,r,s.text)}function Bn(e,r,t,n){let s=b(e,"export_clause");if(s){let i=[];for(let a of s.namedChildren){if(a.type!=="export_specifier")continue;let c=a.namedChild(0),l=a.namedChild(1);c&&i.push((l??c).text)}return{kind:"named",sourcePath:r,names:i,startLine:t,endLine:n}}return b(e,"namespace_export")?{kind:"star-as",sourcePath:r,names:[],startLine:t,endLine:n}:{kind:"star",sourcePath:r,names:[],startLine:t,endLine:n}}function At(e,r,t){return be(e,r,{java:n=>qn(e,r,n),kotlin:n=>Wn(e,r,n),scala:n=>zn(e,r,n)},()=>_(t,/^[ \t]*import\s+(?:static\s+)?(.+?)\s*;?$/gm,(n,s)=>{let o=n[1]?.trim();return o?Hn(e,r,o,s):[]}))}function qn(e,r,t){let n=S(t,new Set(["import_declaration"])),s=[];for(let o of t.rootNode.descendantsOfType("import_declaration")){let i=o.children.some(u=>u.type==="asterisk"),c=o.namedChildren.find(u=>u.type==="scoped_identifier")??o.namedChildren.find(u=>u.type==="identifier");if(!c)continue;let l=c.text;if(i){s.push(X("*",g(e,l,N)));continue}let p=l.split(".").pop()??l;s.push(d(p,p,g(e,l,N),n))}return s}function Wn(e,r,t){let n=S(t,new Set(["import_header","import_list"])),s=[];for(let o of t.rootNode.descendantsOfType("import_header")){let i=o.namedChildren.find(f=>f.type==="identifier");if(!i)continue;let a=o.namedChildren.some(f=>f.type==="wildcard_import"),c=o.namedChildren.find(f=>f.type==="import_alias");if(a){s.push(X("*",g(e,i.text,N)));continue}let l=i.text,p=l.split(".").pop()??l,m=c?.namedChild(0)?.text??p;s.push(d(p,m,g(e,l,N),n))}return s}function zn(e,r,t){let n=S(t,new Set(["import_declaration"])),s=[];for(let o of t.rootNode.descendantsOfType("import_declaration")){let i=o.namedChildren.find(u=>u.type==="namespace_selectors"||u.type==="namespace_wildcard"),a=o.namedChildren.filter(u=>u!==i&&(u.type==="identifier"||u.type==="stable_identifier")),c=a.map(u=>u.text).join(".");if(!c)continue;if(i?.type==="namespace_wildcard"){s.push(X("*",g(e,c,N)));continue}if(i?.type==="namespace_selectors"){for(let u of i.namedChildren)if(u.type==="arrow_renamed_identifier"){let[m,f]=u.namedChildren;if(!m)continue;let h=m.text,J=f?.text??h;if(h==="_")continue;s.push(d(h,J,g(e,`${c}.${h}`,N),n))}else if(u.type==="identifier"){let m=u.text;s.push(d(m,m,g(e,`${c}.${m}`,N),n))}continue}let l=a[a.length-1]?.text??c,p=a.slice(0,-1).map(u=>u.text).join(".")||c;s.push(d(l,l,g(e,p&&a.length>1?`${p}.${l}`:c,N),n))}return s}function Hn(e,r,t,n){if(t.includes("{")&&t.includes("}")){let s=t.slice(0,t.indexOf("{")).replace(/\.$/,"").trim(),o=t.slice(t.indexOf("{")+1,t.lastIndexOf("}")).trim();return y(o).flatMap(i=>{let a=i.trim();if(!a)return[];let[c,l]=a.includes("=>")?a.split(/\s*=>\s*/):a.split(/\s+as\s+/),p=c?.trim();if(!p||p==="_")return[];let u=(l??p.split(".").pop()??p).trim(),m=p==="_"?s:`${s}.${p}`.replace(/\.\./g,".");return[k(e,r,n,m,p,u)]})}return[k(e,r,n,t,t.split(".").pop()??t,t.split(".").pop()??t)]}function wt(e,r,t){return C(e,r,n=>Vn(e,r,n),()=>_(t,/^[ \t]*use\s+(.+?)\s*;$/gm,(n,s)=>{let o=n[1]?.trim();return o?y(o).flatMap(i=>{let a=i.trim();if(!a)return[];let[c,l]=a.split(/\s+as\s+/i),p=c?.trim()??a,u=p.split("\\").pop()??p,m=(l??u).trim();return[k(e,r,s,p,u,m,g(e,p.replace(/\\/g,"."),z))]}):[]}))}function Vn(e,r,t){let n=S(t,new Set(["namespace_use_declaration"])),s=[],o=(i,a,c)=>{s.push(d(a,c,g(e,i.replace(/\\/g,"."),z),n))};for(let i of t.rootNode.descendantsOfType("namespace_use_declaration")){let a=i.namedChildren.find(c=>c.type==="namespace_use_group");if(a){let c=i.namedChildren.find(l=>l.type==="namespace_name")?.text??"";for(let l of a.namedChildren){if(l.type!=="namespace_use_clause")continue;let{importedName:p,localName:u,qualified:m}=Dt(l,c);p&&o(m,p,u)}continue}for(let c of i.namedChildren){if(c.type!=="namespace_use_clause")continue;let{importedName:l,localName:p,qualified:u}=Dt(c,"");l&&o(u,l,p)}}return s}function Dt(e,r){let t=e.namedChildren.find(l=>l.type==="qualified_name"),n=e.namedChildren.filter(l=>l.type==="name"),s="";t?s=t.text:n.length>=1&&(s=n[0].text);let o=t&&n.length>0?n[n.length-1]:null,i=s.split("\\").pop()??s,a=o?.text??i,c=r?`${r}\\${s}`:s;return{importedName:i,localName:a,qualified:c}}function Ft(e,r,t){return C(e,r,n=>Xn(e,r,n),()=>Kn(t).flatMap(n=>Qn(e,r,n,t)))}function Xn(e,r,t){let n=S(t,new Set(["import_statement","import_from_statement"])),s=[];for(let o of t.rootNode.descendantsOfType("import_statement"))for(let i of o.namedChildren){let a=jt(i);if(!a)continue;let c=Z(e,r,a.qualifiedName);s.push({importedName:a.qualifiedName,localName:a.localName,sourcePath:c,kind:"namespace",used:n.has(a.localName),usedMembers:[]})}for(let o of t.rootNode.descendantsOfType("import_from_statement")){let i=o.namedChild(0);if(!i)continue;let a=Jn(i);if(a===null)continue;let c=Z(e,r,a);for(let l=1;l<o.namedChildCount;l+=1){let p=o.namedChild(l);if(p.type==="wildcard_import"){s.push({importedName:"*",localName:null,sourcePath:c,kind:"side-effect",used:!0,usedMembers:[]});continue}let u=jt(p);u&&s.push({importedName:u.qualifiedName,localName:u.localName,sourcePath:c,kind:"named",used:n.has(u.localName),usedMembers:[]})}}return s}function jt(e){if(e.type==="aliased_import"){let r=e.namedChild(0),t=e.namedChild(1);return!r||!t?null:{qualifiedName:r.text,localName:t.text}}if(e.type==="dotted_name"){let r=e.text;return{qualifiedName:r,localName:r.split(".")[0]??r}}return e.type==="identifier"?{qualifiedName:e.text,localName:e.text}:null}function Jn(e){if(e.type==="dotted_name")return e.text;if(e.type==="relative_import"){let r=b(e,"import_prefix")?.text??"",t=b(e,"dotted_name")?.text??"";return`${r}${t}`}return null}function Kn(e){let r=e.split(`
|
|
9
|
-
`),t=[],n=0;for(let s=0;s<r.length;s++){let o=r[s],i=o.trimStart(),a=n;if(n+=o.length+1,!i.startsWith("import ")&&!i.startsWith("from "))continue;let c=o,l=a+o.length,p=Te(o);for(;s+1<r.length&&(p>0||c.trimEnd().endsWith("\\"));){s++;let m=r[s];c+=`
|
|
10
|
-
${m}`,l+=1+m.length,p+=Te(m),n+=m.length+1}let u=Gn(c);u&&t.push({...u,start:a,end:l})}return t}function Gn(e){let r=e.replace(/\\\s*\n/g," ").trim();if(r.startsWith("import "))return{kind:"import",module:null,clause:r.slice(7).trim()};let t=r.match(/^from\s+([.\w]+)\s+import\s+([\s\S]+)$/);if(!t)return null;let n=t[2].trim();return n.startsWith("(")&&n.endsWith(")")&&(n=n.slice(1,-1).trim()),{kind:"from",module:t[1],clause:n}}function Qn(e,r,t,n){let s=v(n,t.start,t.end),o=t.clause.replace(/\n/g," ").trim();if(t.kind==="import")return y(o).flatMap(c=>{let l=c.trim().replace(/,$/,"");if(!l)return[];let[p,u]=l.split(/\s+as\s+/),m=p.trim(),f=(u??m.split(".")[0]??m).trim(),h=Z(e,r,m),J=Q(s,f);return[{importedName:m,localName:f,sourcePath:h,kind:"namespace",used:x(s,f)||J.length>0,usedMembers:J}]});let i=t.module?Z(e,r,t.module):null,a=[];for(let c of y(o)){let l=c.trim().replace(/,$/,"");if(!l)continue;if(l==="*"){a.push({importedName:"*",localName:null,sourcePath:i,kind:"side-effect",used:!0,usedMembers:[]});continue}let[p,u]=l.split(/\s+as\s+/),m=(u??p).trim();a.push({importedName:p.trim(),localName:m,sourcePath:i,kind:"named",used:x(s,m),usedMembers:[]})}return a}import{basename as Yn}from"path";function Ot(e,r,t){return C(e,r,n=>es(e,r,n),()=>Zn(e,r,t))}function Zn(e,r,t){return _(t,/^[ \t]*(require_relative|require)\s+["']([^"']+)["']\s*$/gm,(n,s)=>{let o=n[1],i=n[2];if(!o||!i)return[];let a=o==="require_relative"?xe(e,r,i):null;if(a){let c=Mt(i);return[F(c,c,a,x(s,c))]}return[V(i,a)]})}function es(e,r,t){let n=S(t,new Set([])),s=[],o=new Set(["require","require_relative","load"]);for(let i of t.rootNode.descendantsOfType("call")){let a=i.namedChild(0);if(!a||a.type!=="identifier"||!o.has(a.text))continue;let l=i.namedChildren.find(f=>f.type==="argument_list")?.namedChild(0);if(!l||l.type!=="string")continue;let u=l.namedChildren.find(f=>f.type==="string_content")?.text;if(!u)continue;let m=a.text==="require_relative"?xe(e,r,u):null;if(m){let f=Mt(u);s.push(d(f,f,m,n))}else s.push(V(u,m))}return s}function Mt(e){return nt(Yn(e).replace(/\.[^.]+$/,""),/_/)}function vt(e,r,t){return C(e,r,n=>ts(e,r,n),()=>_(t,/^[ \t]*use\s+(.+?)\s*;$/gm,(n,s)=>{let o=n[1]?.trim();return o?rs(e,r,o,s):[]}))}function ts(e,r,t){let n=S(t,new Set(["use_declaration"])),s=[];for(let o of t.rootNode.descendantsOfType("use_declaration")){let i=o.namedChild(0);if(i)for(let a of ce(i,"")){if(!a.importedName||a.importedName==="*")continue;let c=j(e,r,a.qualifiedName)??j(e,r,a.qualifiedName.split("::").slice(0,-1).join("::"));s.push(d(a.importedName,a.localName,c,n))}}return s}function ce(e,r){switch(e.type){case"identifier":case"super":case"self":case"crate":{let t=e.text;return[{qualifiedName:Ie(r,t),importedName:t,localName:t}]}case"scoped_identifier":{let t=e.text,n=t.split("::").pop()??t;return[{qualifiedName:Ie(r,t),importedName:n,localName:n}]}case"scoped_use_list":{let t=e.namedChild(0),n=e.namedChild(1);if(!t||!n)return[];let s=Ie(r,t.text),o=[];for(let i of n.namedChildren)o.push(...ce(i,s));return o}case"use_list":{let t=[];for(let n of e.namedChildren)t.push(...ce(n,r));return t}case"use_as_clause":{let t=e.namedChild(0),n=e.namedChild(1);if(!t||!n)return[];let s=ce(t,r),o=n.text;return s.map(i=>({...i,localName:o}))}case"use_wildcard":{let t=e.namedChild(0),n=t?t.text:"";return[{qualifiedName:Ie(r,`${n}::*`),importedName:"*",localName:"*"}]}default:return[]}}function Ie(e,r){return e?r?`${e}::${r}`:e:r}function rs(e,r,t,n){let s=t.trim();if(s.includes("{")&&s.includes("}")){let p=s.slice(0,s.indexOf("{")).replace(/::$/,"").trim(),u=s.slice(s.indexOf("{")+1,s.lastIndexOf("}")).trim();return y(u).flatMap(m=>{let f=m.trim();if(!f||f==="self")return[];let[h,J]=f.split(/\s+as\s+/),K=h?.trim();if(!K)return[];let Wt=(J??K.split("::").pop()??K).trim(),zt=`${p}::${K}`.replace(/::::/g,"::");return[k(e,r,n,zt,K.split("::").pop()??K,Wt,j(e,r,p))]})}let[o,i]=s.split(/\s+as\s+/),a=o?.trim()??s,c=(i??a.split("::").pop()??a).trim(),l=j(e,r,a)??j(e,r,a.split("::").slice(0,-1).join("::"));return[k(e,r,n,a,a.split("::").pop()??a,c,l)]}function $t(e,r,t){let n=R(e,r);if(n)return ns(e,r,n);let s=[];for(let o of t.matchAll(/^[ \t]*pub\s+use\s+(.+?)\s*;$/gm)){let i=o[1]?.trim();i&&s.push(...os(e,r,i))}return s}function ns(e,r,t){let n=[];for(let s of t.rootNode.descendantsOfType("use_declaration")){if(!ss(s))continue;let o=s.namedChildren.find(i=>i.type!=="visibility_modifier");if(o)for(let i of ce(o,""))i.importedName&&n.push(Ke(e,r,i.qualifiedName))}return n}function ss(e){for(let r of e.children)if(r.type==="visibility_modifier"&&r.text.startsWith("pub"))return!0;return!1}function os(e,r,t){let n=t.trim();if(n.includes("{")&&n.includes("}")){let s=n.slice(0,n.indexOf("{")).replace(/::$/,"").trim(),o=n.slice(n.indexOf("{")+1,n.lastIndexOf("}")).trim();return y(o).flatMap(i=>{let a=i.trim();if(!a||a==="self")return[];let[c]=a.split(/\s+as\s+/),l=`${s}::${c?.trim()??a}`.replace(/::::/g,"::");return[Ke(e,r,l)]})}return[Ke(e,r,n)]}function Ke(e,r,t){return{specifier:t,sourcePath:j(e,r,t)??j(e,r,t.split("::").slice(0,-1).join("::"))}}function q({language:e,extensions:r,imports:t,parseImports:n}){return{language:e,extensions:r,capabilities:{imports:t},parseImports:n}}function Ut(e,r){let t=r.toLowerCase();for(let n of e)for(let s of n.extensions)if(t.endsWith(s))return n;return null}var is={language:"javascript",extensions:W,capabilities:{imports:"ast-with-regex-fallback",reExports:"ast-with-regex-fallback"},parseImports:Xe,parseReExports:Je},as=q({language:"python",extensions:fe,imports:"ast-with-regex-fallback",parseImports:Ft}),cs=q({language:"jvm",extensions:N,imports:"ast-dispatch-with-regex-fallback",parseImports:At}),ls={language:"rust",extensions:de,capabilities:{imports:"ast-with-regex-fallback",exports:"ast-with-regex-fallback"},parseImports:vt,parseExports:$t},ps=q({language:"ruby",extensions:ge,imports:"ast-with-regex-fallback",parseImports:Ot}),us=q({language:"c/cpp",extensions:Se,imports:"ast-with-regex-fallback",parseImports:bt}),ms=q({language:"dotnet",extensions:U,imports:"ast-dispatch-with-regex-fallback",parseImports:Rt}),fs={language:"dart",extensions:he,capabilities:{imports:"regex-only",exports:"regex-only"},parseImports:Pt,parseExports:Tt},ds=q({language:"php",extensions:z,imports:"ast-with-regex-fallback",parseImports:wt}),gs=q({language:"clojure",extensions:Y,imports:"regex-only",parseImports:Et}),Ss=[is,as,cs,ls,ps,us,ms,fs,ds,gs];function Ee(e){return Ut(Ss,e)}var Ge={clearGroups:["whole-project","source-file"]},hs=G("source-imports",Ge),xs=G("source-exports",Ge),ys=G("source-reexports",Ge),Bt=re({kind:"source-imports",serialize:Ns,deserialize:bs}),qt=re({kind:"source-reexports",serialize:Is,deserialize:Es});function ji(e,r){let t=T(r);return ys.get(e,t,()=>{let n=Ee(t);if(!n?.parseReExports)return[];let s=O(e,t);if(!s)return[];let o=te(e,t,s),i=ve(e),a=qt.read(e,t,o);if(a?.resolutionFingerprint===i)return a.reExports;let c=n.parseReExports(e,t,s);return qt.write(e,t,o,{resolutionFingerprint:i,reExports:c}),c})}function Fi(e,r){let t=T(r);return hs.get(e,t,()=>{let n=Ee(t);if(!n)return[];let s=O(e,t);if(!s)return[];let o=te(e,t,s),i=ve(e),a=Bt.read(e,t,o);if(a?.resolutionFingerprint===i)return a.imports;let c=n.parseImports(e,t,s);return Bt.write(e,t,o,{resolutionFingerprint:i,imports:c}),c})}function Oi(e,r){let t=T(r);return xs.get(e,t,()=>{let n=Ee(t);if(!n?.parseExports)return[];let s=O(e,t);return s?n.parseExports(e,t,s):[]})}function Ns(e){return JSON.stringify(e)}function bs(e){try{let r=JSON.parse(e);return!Ce(r)||typeof r.resolutionFingerprint!="string"||!Array.isArray(r.imports)?null:{resolutionFingerprint:r.resolutionFingerprint,imports:r.imports}}catch{return null}}function Is(e){return JSON.stringify(e)}function Es(e){try{let r=JSON.parse(e);return!Ce(r)||typeof r.resolutionFingerprint!="string"||!Array.isArray(r.reExports)?null:{resolutionFingerprint:r.resolutionFingerprint,reExports:r.reExports}}catch{return null}}export{B as a,Ht as b,Te as c,A as d,Ir as e,Er as f,Pr as g,Tr as h,Rr as i,kr as j,ji as k,Fi as l,Oi as m};
|
|
11
|
-
//# sourceMappingURL=chunk-THB6AM3V.js.map
|
package/dist/chunk-ULHLDOD6.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{appendFileSync as p,mkdirSync as u}from"fs";import{dirname as l}from"path";import{performance as i}from"perf_hooks";var E="SCIP_QUERY_PROFILE",M="SCIP_QUERY_PROFILE_OUT",P="SCIP_QUERY_PROFILE_COMMAND",s=new Set,a=!1;function c(){let e=process.env[E];return e==="1"||e==="true"}function m(){return process.env[M]}function O(){return process.env[P]}function g(e,n,o){if(!c())return n();let t=i.now();try{let r=n();return f({type:"span",name:e,durationMs:Math.round(i.now()-t),ok:!0,...d(o)??{}}),r}catch(r){throw f({type:"span",name:e,durationMs:Math.round(i.now()-t),ok:!1,error:r instanceof Error?r.message:String(r),...d(o)??{}}),r}}function f(e,n=m()){let o={timestamp:new Date().toISOString(),pid:process.pid,command:O(),...e},t=`${JSON.stringify(o)}
|
|
2
|
-
`;if(n)try{let r=l(n);s.has(r)||(u(r,{recursive:!0}),s.add(r)),p(n,t);return}catch(r){a||(a=!0,process.stderr.write(`[profile] failed to write ${n}: ${r instanceof Error?r.message:String(r)}
|
|
3
|
-
`));return}c()&&process.stderr.write(t)}function d(e){return typeof e=="function"?e():e}export{c as a,g as b};
|
|
4
|
-
//# sourceMappingURL=chunk-ULHLDOD6.js.map
|