scip-query 0.10.1 → 0.10.2
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/README.md +2 -2
- package/dist/augment-vue-worker.js +1 -1
- package/dist/{chunk-24PFLKFK.js → chunk-3KLLFNT4.js} +2 -2
- package/dist/{chunk-UIWAZ2NT.js → chunk-3UVJJ6Z7.js} +1 -1
- package/dist/chunk-3UW7VM4H.js +62 -0
- package/dist/chunk-3ZYF3ELZ.js +2 -0
- package/dist/{chunk-6YKJSETN.js → chunk-47UA45TU.js} +2 -2
- package/dist/{chunk-5VB3WU7K.js → chunk-4ZUJJRWT.js} +2 -2
- package/dist/chunk-5B53WB6E.js +4 -0
- package/dist/{chunk-LWPEZ4FP.js → chunk-5FOPAXWY.js} +2 -2
- package/dist/{chunk-CCB45WDY.js → chunk-5M4TYWVI.js} +2 -2
- package/dist/{chunk-PV4CEDIL.js → chunk-5QJXH6ZL.js} +5 -5
- package/dist/{chunk-NN3O7TPH.js → chunk-64MNV6AB.js} +1 -1
- package/dist/{chunk-LWWZBABT.js → chunk-77YBOOYT.js} +2 -2
- package/dist/chunk-7KCSELEV.js +2 -0
- package/dist/{chunk-GZXXBDJA.js → chunk-7OHWPJ5N.js} +2 -2
- package/dist/{chunk-BJ7OHKB5.js → chunk-7S5E7KWT.js} +1 -1
- package/dist/chunk-A3VNUGKJ.js +2 -0
- package/dist/{chunk-CMGOXDVP.js → chunk-A4L36SZS.js} +2 -2
- package/dist/{chunk-5D3BT4B4.js → chunk-AUVBR62P.js} +2 -2
- package/dist/chunk-AW4N6MGC.js +18 -0
- package/dist/{chunk-65UWNXEH.js → chunk-B6MJ5VQV.js} +2 -2
- package/dist/chunk-BKDXBJDQ.js +2 -0
- package/dist/{chunk-WZVTADY7.js → chunk-C2QSK7E7.js} +1 -1
- package/dist/chunk-C3MZZ2ZN.js +2 -0
- package/dist/{chunk-GTNPPGZJ.js → chunk-CAWSSEVM.js} +2 -2
- package/dist/chunk-CFL2CNIF.js +10 -0
- package/dist/{chunk-E55WCTLH.js → chunk-CJJP64OC.js} +2 -2
- package/dist/chunk-CNTEQMHA.js +2 -0
- package/dist/{chunk-ADKQX2OY.js → chunk-CRU42NJU.js} +2 -2
- package/dist/chunk-CSWZFD46.js +2 -0
- package/dist/{chunk-QOFKVNFE.js → chunk-CTCAF3YA.js} +2 -2
- package/dist/{chunk-YVQUQIBM.js → chunk-D322LMSA.js} +2 -2
- package/dist/{chunk-IJYWCB57.js → chunk-DAI74TJU.js} +2 -2
- package/dist/chunk-DE7MA6OD.js +3 -0
- package/dist/chunk-DJMK4DBL.js +2 -0
- package/dist/chunk-DRAZH77R.js +7 -0
- package/dist/{chunk-FVX4GEAC.js → chunk-E44ZMVNA.js} +2 -2
- package/dist/{chunk-MESUJJVQ.js → chunk-E7KERP7E.js} +2 -2
- package/dist/{chunk-YIE5FZAF.js → chunk-EOZIZWW4.js} +2 -2
- package/dist/{chunk-XGGTESMN.js → chunk-ERHOS6AW.js} +2 -2
- package/dist/{chunk-5HDYAOSF.js → chunk-ESG4HBEF.js} +2 -2
- package/dist/{chunk-HCQ7J2N5.js → chunk-EWC3UK4V.js} +3 -3
- package/dist/chunk-FGCL6NDB.js +8 -0
- package/dist/chunk-FIB4JPEX.js +2 -0
- package/dist/chunk-FNRPGGVI.js +2 -0
- package/dist/{chunk-QUKZ77A6.js → chunk-FOQHUKNZ.js} +2 -2
- package/dist/chunk-FPMVCDIJ.js +2 -0
- package/dist/{chunk-QH5GTVVB.js → chunk-FUPDW5AC.js} +2 -2
- package/dist/{chunk-B3HMRQDA.js → chunk-G3WGZU5Q.js} +2 -2
- package/dist/{chunk-TUAPDKBI.js → chunk-GS33KGAY.js} +2 -2
- package/dist/{chunk-623UQCVG.js → chunk-GZCQTZLK.js} +2 -2
- package/dist/{chunk-SA6B3EGD.js → chunk-HVTYSC26.js} +2 -2
- package/dist/{chunk-R7S3UCDR.js → chunk-ICXVNWMI.js} +2 -2
- package/dist/chunk-JM72FNGA.js +2 -0
- package/dist/{chunk-DRU74YUM.js → chunk-KPHKX4LP.js} +1 -1
- package/dist/{chunk-YYCQQBMG.js → chunk-LPLGJ4HO.js} +2 -2
- package/dist/chunk-MHK7Z53U.js +2 -0
- package/dist/chunk-MHTDOFV7.js +5 -0
- package/dist/chunk-MUULWXSJ.js +2 -0
- package/dist/chunk-MZ7APUFN.js +3 -0
- package/dist/{chunk-LYS4SMAQ.js → chunk-NNDYO2DX.js} +2 -2
- package/dist/{chunk-ATGRITZP.js → chunk-NP5HYVLX.js} +4 -4
- package/dist/{chunk-MHAQXOZY.js → chunk-NVFERV4U.js} +2 -2
- package/dist/{chunk-LWYIGRHR.js → chunk-NXIAHE7F.js} +1 -1
- package/dist/chunk-O3OKSF6O.js +2 -0
- package/dist/chunk-O4L4AB3T.js +2 -0
- package/dist/{chunk-TMS4JPWY.js → chunk-OBBDKQAG.js} +2 -2
- package/dist/chunk-OLD6PBU6.js +7 -0
- package/dist/{chunk-5BZOSICN.js → chunk-PFOCOG57.js} +1 -1
- package/dist/{chunk-CFLYMEUS.js → chunk-PVZMPG5I.js} +1 -1
- package/dist/{chunk-T67R7V5I.js → chunk-QLNGUWR7.js} +2 -2
- package/dist/chunk-QSXQT3NE.js +2 -0
- package/dist/{chunk-6TWFT4Y5.js → chunk-QVCCLDZI.js} +2 -2
- package/dist/{chunk-PNN3D4BE.js → chunk-RHTJBYZ5.js} +2 -2
- package/dist/chunk-SPE4YCOT.js +7 -0
- package/dist/{chunk-4N7LFYSD.js → chunk-TM6GVHA6.js} +2 -2
- package/dist/chunk-TO54DY4O.js +2 -0
- package/dist/{chunk-HQHFMPLJ.js → chunk-UMNENNTX.js} +2 -2
- package/dist/chunk-UNJG7P2I.js +2 -0
- package/dist/{chunk-TKDJQ2WD.js → chunk-UUBMFL3F.js} +1 -1
- package/dist/chunk-VAA5FFIW.js +2 -0
- package/dist/chunk-WDUTG2ZR.js +4 -0
- package/dist/chunk-X7ZY6FFF.js +4 -0
- package/dist/{chunk-RNLUCQJB.js → chunk-YQH353VA.js} +2 -2
- package/dist/{chunk-44JOJLMO.js → chunk-YTR4CO5S.js} +2 -2
- package/dist/chunk-YUOAAR24.js +2 -0
- package/dist/{chunk-ADTG377O.js → chunk-YYD245WG.js} +2 -2
- package/dist/{chunk-I6PTB2CM.js → chunk-Z4VHYJ5U.js} +2 -2
- package/dist/chunk-ZFMPHDAT.js +4 -0
- package/dist/chunk-ZQLO2SCU.js +6 -0
- package/dist/chunk-ZSLT7NWQ.js +61 -0
- package/dist/cli.js +242 -225
- package/dist/{config-types-Bok4jrO3.d.ts → config-types-Bj4sh28g.d.ts} +8 -0
- package/dist/{db-BkFlkzI3.d.ts → db-CTarohbZ.d.ts} +1 -1
- package/dist/git-history-Dao3_Pu9.d.ts +12 -0
- package/dist/{health-CbGMdRPg.d.ts → health-Bx0x1HAG.d.ts} +23 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/postinstall.js +1 -1
- package/dist/queries/affected.d.ts +2 -2
- package/dist/queries/affected.js +1 -1
- package/dist/queries/bottlenecks.d.ts +6 -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 +37 -3
- 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 +2 -2
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +2 -2
- 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 +6 -2
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +2 -2
- 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 +10 -3
- package/dist/queries/dead.js +1 -1
- package/dist/queries/deep-chains.d.ts +6 -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 +48 -3
- package/dist/queries/diff-gate.js +1 -1
- package/dist/queries/diff-impact.d.ts +2 -2
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.d.ts +20 -3
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.d.ts +10 -3
- package/dist/queries/drift.js +1 -1
- package/dist/queries/extract-candidates.d.ts +11 -3
- 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 +2 -2
- 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 +14 -3
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +17 -15
- 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 +51 -0
- package/dist/queries/locality-candidates.js +2 -0
- 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 +8 -3
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.d.ts +4 -2
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.d.ts +2 -2
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.d.ts +9 -3
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.d.ts +9 -3
- package/dist/queries/react-large-component-pressure.js +1 -1
- package/dist/queries/recent-duplicates.d.ts +25 -3
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +7 -3
- 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 +2 -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 +2 -2
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +16 -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 +10 -3
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +2 -2
- package/dist/queries/stats.js +1 -1
- 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/unused-imports.d.ts +4 -0
- package/dist/queries/unused-imports.js +2 -0
- 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 +2 -2
- package/dist/queries/vue-component-duplicates.js +1 -1
- package/dist/queries/vue-composable-candidates.d.ts +9 -3
- package/dist/queries/vue-composable-candidates.js +1 -1
- package/dist/queries/vue-large-view-pressure.d.ts +9 -3
- package/dist/queries/vue-large-view-pressure.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +6 -3
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +1 -1
- package/dist/reindex.d.ts +1 -1
- package/dist/reindex.js +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +2 -2
- package/docs/COMMAND_REFERENCE.md +3 -2
- package/docs/analyzer-inventory.md +162 -0
- package/docs/analyzer-validation-ledger.md +262 -0
- package/docs/analyzer-validation-protocol.md +192 -0
- package/docs/locality-analyzer-design.md +193 -0
- package/package.json +14 -3
- package/skills/scip-directory-architecture/SKILL.md +178 -0
- package/skills/scip-maintainability/SKILL.md +1 -1
- package/skills/scip-query/SKILL.md +2 -1
- package/skills/scip-query-setup/SKILL.md +118 -0
- package/skills/scip-react-maintainability/SKILL.md +1 -1
- package/skills/scip-vue-maintainability/SKILL.md +1 -1
- package/dist/chunk-23FVN4Y5.js +0 -2
- package/dist/chunk-27KPKLRJ.js +0 -7
- package/dist/chunk-2NLK4INB.js +0 -2
- package/dist/chunk-2XKAMW6B.js +0 -61
- package/dist/chunk-332L7SRO.js +0 -2
- package/dist/chunk-4EAANIWC.js +0 -2
- package/dist/chunk-5ALI77D7.js +0 -3
- package/dist/chunk-5IDEQEM4.js +0 -4
- package/dist/chunk-62NMBOA5.js +0 -2
- package/dist/chunk-64LH2QUP.js +0 -62
- package/dist/chunk-6U4EODW3.js +0 -2
- package/dist/chunk-A2GVUCZR.js +0 -8
- package/dist/chunk-DBIG4QAJ.js +0 -2
- package/dist/chunk-DMLPJ75B.js +0 -2
- package/dist/chunk-DTERBKUE.js +0 -7
- package/dist/chunk-F4PKYBQB.js +0 -2
- package/dist/chunk-JTRY2YRJ.js +0 -2
- package/dist/chunk-L77GXANO.js +0 -6
- package/dist/chunk-LT6GJ27X.js +0 -10
- package/dist/chunk-LUBKUISI.js +0 -2
- package/dist/chunk-LVYXX7ZW.js +0 -2
- package/dist/chunk-LXM7AHQG.js +0 -4
- package/dist/chunk-LY6NRJPJ.js +0 -2
- package/dist/chunk-N2T2GPYQ.js +0 -2
- package/dist/chunk-OB6PEVI3.js +0 -2
- package/dist/chunk-R42LZMLX.js +0 -2
- package/dist/chunk-RGDUIMNE.js +0 -3
- package/dist/chunk-RYBMW2EN.js +0 -2
- package/dist/chunk-TTGWDUJ4.js +0 -5
- package/dist/chunk-UVK3SL4Z.js +0 -2
- package/dist/chunk-W3PQRAI4.js +0 -2
- package/dist/chunk-WWFBDM5Y.js +0 -2
- package/dist/chunk-Y33GRQK6.js +0 -18
- package/dist/chunk-YISMWW66.js +0 -7
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as u}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as u}from"./chunk-MZ7APUFN.js";import{a as c}from"./chunk-64MNV6AB.js";import{existsSync as m}from"fs";import{basename as p,isAbsolute as g,join as d}from"path";function S(t,r){let e=f(t,r,{allowMultiple:!1})[0]?.relativePath;return e||x(t,r)}function j(t,r){return f(t,r,{allowMultiple:!0}).map(e=>e.relativePath)}function x(t,r){if(!r)return null;let e=r.replace(/\\/g,"/").replace(/^\.\//,""),s=g(e)&&e.startsWith(t.config.projectRoot)?e.slice(t.config.projectRoot.length).replace(/^\/+/,""):e,i=d(t.config.projectRoot,s);return m(i)?s:null}function f(t,r,e){let s=h(r);if(!s)return[];let i=c(t,{includeIgnored:!1}).map(o=>({relativePath:o,score:v(o,s)})).filter(o=>o.score>0).sort((o,l)=>l.score-o.score||o.relativePath.localeCompare(l.relativePath));if(i.length===0){let o=u(t,r);return!o||t.isIgnored(o.relativePath)?[]:[{relativePath:o.relativePath,score:700}]}let n=i.filter(o=>o.score>=1100);if(n.length>0)return e.allowMultiple?n:[n[0]];let a=i.filter(o=>o.score>=800);return a.length>0?e.allowMultiple?a:[a[0]]:e.allowMultiple?i:[i[0]]}function v(t,r){let e=h(t),s=p(e),i=p(r),n=0;return e===r&&(n+=1200),e.endsWith(`/${r}`)&&(n+=1100),s===i&&(n+=900),e.startsWith(`${r}/`)&&(n+=850),e.includes(r)&&(n+=250),n}function h(t){return t.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}export{S as a,j as b};
|
|
2
|
+
//# sourceMappingURL=chunk-CTCAF3YA.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{c as g,e as h}from"./chunk-
|
|
1
|
+
import{c as g,e as h}from"./chunk-7S5E7KWT.js";import{existsSync as V,readFileSync as w}from"fs";import{join as v}from"path";var j=g("source-text",{clearGroups:["whole-project","source-file"]}),_=g("source-lines",{clearGroups:["whole-project","source-file"]});function l(e,t){let r=t.replace(/\\/g,"/");return j.get(e,r,()=>{let n=v(e.config.projectRoot,r);return V(n)?w(n,"utf-8"):""})}function A(e,t){let r=t.replace(/\\/g,"/");return _.get(e,r,()=>{let n=l(e,r);return n?n.split(`
|
|
2
2
|
`):[]})}var N=/^\s*(?:\/\/|#|\/\*+|\*)\s*scip-query[\s:-]*ignore(?:[\s:-]+(dead(?:-code)?|stale|wrapper|passthrough|drift|extract|similar))?\b/i;function R(e){let t=N.exec(e);return t?t[1]??"":null}function X(e,t,r){if(r<=0)return!1;let n=A(e,t);if(n.length===0)return!1;for(let s=r-1;s>=0&&s>=r-5;s-=1){let a=(n[s]??"").trim();if(a!==""){if(R(a)!==null)return!0;if(!a.startsWith("//")&&!a.startsWith("*")&&!a.startsWith("/*")&&!a.startsWith("@")&&!a.startsWith("#"))return!1}}return!1}import{createRequire as P}from"module";var c=P(import.meta.url),p=null,k=!1;function T(){if(k)return null;if(p)return p;try{return p=c("tree-sitter"),p}catch{return k=!0,null}}var C=new Map,m=new Set;function Q(e){if(m.has(e))return null;let t=C.get(e);if(t)return t;let r;try{switch(e){case"rust":r=c("tree-sitter-rust");break;case"typescript":r=c("tree-sitter-typescript").typescript;break;case"tsx":r=c("tree-sitter-typescript").tsx;break;case"javascript":r=c("tree-sitter-javascript");break;case"python":r=c("tree-sitter-python");break;case"java":r=c("tree-sitter-java");break;case"kotlin":r=c("tree-sitter-kotlin");break;case"scala":r=c("tree-sitter-scala");break;case"ruby":r=c("tree-sitter-ruby");break;case"c":r=c("tree-sitter-c");break;case"cpp":r=c("tree-sitter-cpp");break;case"csharp":r=c("tree-sitter-c-sharp");break;case"php":r=c("tree-sitter-php").php;break;case"vb":{let n=c("tree-sitter-vb-dotnet");r=n.language??n;break}}}catch{return m.add(e),null}return C.set(e,r),r}var x=new Map;function U(e){let t=x.get(e);if(t)return t;let r=Q(e);if(!r)return null;let n=T();if(!n)return null;let s=new n;try{s.setLanguage(r)}catch{return m.add(e),null}return x.set(e,s),s}function E(e,t){return e.parse(n=>n>=t.length?null:t.slice(n,Math.min(t.length,n+16384)))}function Z(e,t){let r=U(e);if(!r)return null;try{return E(r,t)}catch{return null}}import{posix as y}from"path";import{parse as M}from"@vue/compiler-sfc";var I=h("vue-sfc-units");function ae(e,t){let r=B(t),n=l(e,r);return I.get(e,r,n,()=>z(e,r,n))}function B(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function D(e){let t=e?.toLowerCase();return!t||t==="js"||t==="javascript"||t==="jsx"?"javascript":t==="ts"||t==="typescript"?"typescript":t==="tsx"?"tsx":null}function ce(e){return!e||e.body.length===0?0:e.body.split(`
|
|
3
3
|
`).length}function z(e,t,r){let n={relativePath:t,template:null,scripts:[],styles:[],customBlocks:[],errors:[]};if(!r)return n;let s;try{s=M(r,{filename:t})}catch(i){return n.errors.push(L(i)),n}n.errors.push(...s.errors.map(L));let{descriptor:a}=s;return a.template&&(n.template=f(e,t,"template",a.template)),a.script&&n.scripts.push(b(e,t,a.script,!1)),a.scriptSetup&&n.scripts.push(b(e,t,a.scriptSetup,!0)),n.styles=a.styles.map(i=>f(e,t,"style",i)),n.customBlocks=a.customBlocks.map(i=>f(e,t,"custom",i)),n.errors.push(...[n.template,...n.scripts,...n.styles,...n.customBlocks].flatMap(i=>i?.errors??[])),n}function b(e,t,r,n){let s=f(e,t,"script",r);return{...s,kind:"script",setup:n,astLanguage:D(s.lang)}}function f(e,t,r,n){let s=$(n.attrs),a=typeof s.lang=="string"?s.lang:null,i=typeof s.src=="string"?s.src:typeof n.src=="string"?n.src:void 0;if(i){let o=W(t,i);if(!o)return{kind:r,ownerPath:t,sourcePath:t,external:!0,src:i,attrs:s,lang:a,body:"",startLine:0,endLine:0,errors:[`Could not resolve Vue ${r} block source: ${i}`]};let u=l(e,o),F=u?Math.max(0,u.split(`
|
|
4
4
|
`).length-1):0;return{kind:r,ownerPath:t,sourcePath:o,external:!0,src:i,attrs:s,lang:a,body:u,startLine:0,endLine:F,errors:u?[]:[`Vue ${r} block source not found: ${o}`]}}let S=Math.max(0,n.loc.start.line-1);return{kind:r,ownerPath:t,sourcePath:t,external:!1,attrs:s,lang:a,body:n.content,startLine:S,endLine:Math.max(S,n.loc.end.line-1),errors:[]}}function W(e,t){let r=t.split(/[?#]/,1)[0];if(!r||r.startsWith("/")||r.includes("://"))return null;let n=B(y.normalize(y.join(y.dirname(e),r)));return n===".."||n.startsWith("../")?null:n}function $(e){return{...e}}function L(e){return e instanceof Error?e.message:String(e)}function oe(e,t){let r=q(e,t);if(!r)return null;let n=d(r);return n?{calleeLeaf:n,memberAccess:G(r),line:e.startPosition.row}:null}function q(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 G(e){switch(e.type){case"field_expression":case"member_expression":case"attribute":return!0;default:return!1}}function d(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?d(t):null}case"scoped_identifier":{let t=e.childForFieldName("name")??e.namedChild(e.namedChildCount-1);return t?d(t):null}case"super":case"self":case"this":return null;default:return null}}export{l as a,A as b,R as c,X as d,Z as e,ae as f,D as g,ce as h,oe as i,d as j};
|
|
5
|
-
//# sourceMappingURL=chunk-
|
|
5
|
+
//# sourceMappingURL=chunk-D322LMSA.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as u}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as u}from"./chunk-PFOCOG57.js";import{a as p}from"./chunk-3ZYF3ELZ.js";import{c as i}from"./chunk-JM72FNGA.js";function x(e,r){let{scope:m,minLoc:o=10,limit:c=30,scanLimit:a}=r??{},s=new p(e);return u({candidates:()=>s.productionCallableDefinitions({scope:m,requireCallableSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof a=="number"&&a>0}),scanLimit:a,prepare:t=>({callerMap:s.crossFileCallerMap(t,{semantic:r?.semantic!==!1}),calleeMap:s.calleeMap(t,{semantic:r?.semantic!==!1})}),evaluate:(t,n)=>b(t,n,o),orderResults:(t,n)=>n.score-t.score||n.loc-t.loc,limit:c})}function b(e,r,m){let o=e.endLine-e.startLine+1;if(o<m)return null;let c=r.callerMap.get(e.symbolId)?.size??0,a=r.calleeMap.get(e.symbolId)??[],s=a.filter(l=>l.file!==e.relativePath),t=new Set(s.map(l=>`${l.symbol}|${l.file}`)).size,n=new Set(a.map(l=>`${l.symbol}|${l.file}`)).size;return{symbol:e.symbol,shortName:i(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:o,fanIn:c,fanOut:t,calleeCount:n,score:Math.round(o/50*(c/5)*Math.max(t/5,1)*100)/100}}export{x as a};
|
|
2
|
+
//# sourceMappingURL=chunk-DAI74TJU.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as P}from"./chunk-VAA5FFIW.js";import{a as x}from"./chunk-PFOCOG57.js";import{a as v}from"./chunk-B75HZHUP.js";import{a as b}from"./chunk-3ZYF3ELZ.js";import{a as g,g as p}from"./chunk-ZQLO2SCU.js";import{a as h}from"./chunk-BGBBVSH4.js";import{c as l,d as m,g as u}from"./chunk-JM72FNGA.js";import{b as f}from"./chunk-QLNGUWR7.js";import{b as d}from"./chunk-D322LMSA.js";import{basename as y,extname as L}from"path";function X(n,e){let{scope:i,maxLoc:t=15,limit:o=30,scanLimit:s}=e??{},a=new b(n);return x({candidates:()=>A(a,i,t),orderCandidates:v,scanLimit:s,prepare:r=>a.calleeMap(r,{semantic:e?.semantic!==!1}),evaluate:(r,c)=>S(n,r,c.get(r.symbolId)??[]),orderResults:(r,c)=>r.loc-c.loc||r.file.localeCompare(c.file),limit:o})}function S(n,e,i){let t=R(i);if(t.size!==1||!f(n,e.relativePath,e.startLine,e.endLine))return null;let[,o]=[...t.entries()][0],s=I(n,e,o),a=T(n,e),r=s.length>0||a.length>0?"signal":"direct";return{symbol:e.symbol,shortName:l(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:h(e),forwardsTo:o.symbol,forwardsToShort:l(o.symbol),forwardsToFile:o.file,actionTier:r,boundaryEvidence:s,publicFacadeEvidence:a,recommendation:D(r,s,a)}}function I(n,e,i){return P(n,e.relativePath,e.startLine,"passthrough","explicit ignore-passthrough comment",[{label:"passthrough name",value:l(e.symbol)},{label:"callee name",value:l(i.symbol)},{label:"passthrough module",value:y(e.relativePath,L(e.relativePath))},{label:"callee module",value:y(i.file,L(i.file))}])}function D(n,e,i){if(n==="signal"){if(i.length>0)return`Review the public API before inlining; public-facade evidence: ${i.slice(0,2).join("; ")}.`;let t=e.filter(C);return t.length>0?`Review the public API before inlining; public-surface evidence: ${t.slice(0,2).join("; ")}.`:`Review the boundary before inlining; boundary evidence: ${e.slice(0,2).join("; ")}.`}return"Inline or remove this passthrough unless an external API or runtime registration depends on the forwarding name."}function T(n,e){return E(n,e)?g(n,e.relativePath)?["exported passthrough is declared on the package public surface"]:p(n,e.symbol,e.relativePath)?["exported passthrough matches configured or framework public entry surface"]:[]:[]}function E(n,e){let i=d(n,e.relativePath);if(i.length===0)return!1;let t=i.slice(Math.max(0,e.startLine-2),e.startLine+1).join(`
|
|
2
|
+
`);return j.test(t)?!0:w(i,m(e.symbol))}function w(n,e){if(!e)return!1;let i=new RegExp(`^\\s*export\\s*\\{[^}\\n]*\\b${F(e)}\\b`);return n.some(t=>i.test(t))}function C(n){return n.includes("public surface")}function F(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function R(n){let e=n.some(t=>u(t.symbol))?n.filter(t=>u(t.symbol)):n,i=new Map;for(let t of e)i.has(t.symbol)||i.set(t.symbol,t);return i}function A(n,e,i){return n.productionCallableDefinitions({scope:e,minLoc:3,maxLoc:i,requireFunctionLikeSymbol:!0,excludeRustTraitImplMembers:!0})}var j=/^\s*export\s+(?:default\s+)?(?:(?:async\s+)?function\b|(?:const|let|var)\b)/m;export{X as a};
|
|
3
|
+
//# sourceMappingURL=chunk-DE7MA6OD.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as A}from"./chunk-RHTJBYZ5.js";import{a as C}from"./chunk-3ZYF3ELZ.js";import{a as k}from"./chunk-MZ7APUFN.js";import{c as b}from"./chunk-JM72FNGA.js";import{a as p}from"./chunk-64MNV6AB.js";import{posix as f}from"path";var j=20,z=1,_=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"]]),G=new Set(["components","contracts","hooks","lib","services","shared","stores","utils"]),O=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 De(e,n={}){let t=L(n.limit,j),i=L(n.minConsumers,z),o=new C(e),s=o.fileDependencyGraph(n.scope),r=de(p(e,{includeIgnored:!1})),c=fe(e.config.locality?.architecturalBoundarySegments,n.architecturalBoundarySegments);return(n.target?q(e,o,n.target):Y(e,n.scope,n.scanLimit)).map(a=>K(o,s,a,n,r,c)).filter(a=>a.consumerFiles.length>=i||n.target).sort(ue).slice(0,t)}function q(e,n,t){let i=V(e,t);if(i)return[N(i)];let o=k(e,t);if(!o)return[];let s=n.definitionsForFile(o.relativePath).find(r=>r.symbolId===o.symbolId);return s?[X(s)]:[{unit:{kind:"symbol",file:o.relativePath,shortName:b(o.symbol),symbol:o.symbol,startLine:o.startLine,endLine:o.endLine}}]}function Y(e,n,t){let i=p(e,{scope:n,includeIgnored:!1}),o=L(t,i.length);return i.slice(0,o).map(s=>N(s))}function K(e,n,t,i,o,s){let r=t.definition?J(e,t.definition,i.semantic):Q(n,t.unit.file),c=t.definition?r.length>0?"exact":"none":r.length>0?"file-level":"none",m=t.unit.file,l=u(f.dirname(m)),a=ee(r),h=Z(l),B=w([...F(l),...a?F(a):[]]),y=ne(t.unit,l,a,r),g=te(y,t.unit,l,a,r,o,s),E=ae(t.unit,c,a,r,l,g.whyNoSuggestedHome),W=ce(t.unit,l,a,r,g.suggestedHome,g.whyNoSuggestedHome);return{actionTier:"signal",sourceUnit:t.unit,candidatePath:m,currentDirectory:l,directoryAncestry:h,consumerFiles:r,consumerCoverage:c,nearestCommonOwner:a,boundaryMarkers:B,recommendedTier:y,suggestedHome:g.suggestedHome,destinationConfidence:g.confidence,whyNoSuggestedHome:g.whyNoSuggestedHome,counterevidence:E,reasons:W,recommendation:le(y,g.suggestedHome,c)}}function J(e,n,t){let i=A(e,[n],{semantic:t!==!1,sourceFallback:!0});return H(i.get(n.symbolId)??[])}function Q(e,n){let t=[];for(let[i,o]of e.entries())i!==n&&o.has(n)&&t.push(i);return H(t)}function V(e,n){let t=D(n),i=p(e,{includeIgnored:!1}),o=i.find(r=>r===t);if(o)return o;let s=i.find(r=>r.endsWith(`/${t}`));return s||(i.find(r=>r.includes(t))??null)}function X(e){return{definition:e,unit:{kind:"symbol",file:e.relativePath,shortName:b(e.symbol),symbol:e.symbol,startLine:e.startLine,endLine:e.endLine}}}function N(e){return{unit:{kind:"file",file:e,shortName:f.basename(e)}}}function Z(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 o=t.slice(0,i+1).join("/");n.push({path:o,depth:i,markers:v(o)})}return n}function F(e){return e==="."?[]:I(e).map(({marker:n,prefix:t})=>`${n}: ${t}`)}function v(e){return w(I(e).map(({marker:n})=>n))}function I(e){let n=e.split("/").filter(Boolean),t=[];for(let i=0;i<n.length;i+=1){let o=_.get(n[i]);o&&t.push({marker:o,prefix:n.slice(0,i+1).join("/")})}return t}function ee(e){if(e.length===0)return null;let n=e.map(i=>u(f.dirname(i))),t=n[0].split("/").filter(Boolean);for(let i of n.slice(1)){let o=i.split("/").filter(Boolean),s=[],r=Math.min(t.length,o.length);for(let c=0;c<r&&t[c]===o[c];c+=1)s.push(t[c]);t=s}return t.length===0?".":t.join("/")}function ne(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":R(t,"package")?"package-level-shared":R(t,"app")?"app-level-shared":U(t,["feature","domain","module"])||U(n,["feature","domain","module"])?"feature-local-shared":"sibling-folder":"no-exact-consumers"}function te(e,n,t,i,o,s,r){let c=ie(e,i);if(c)return d(c);let m=me(n.file),l=re(e,t,m,o,r);if(l)return l;let a=i;if(u(t)===u(a))return d(`${t} is already the nearest common owner for its consumers.`);let h=oe(a,t,m,r);return h||se(a,t,m,s,r)}function ie(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 re(e,n,t,i,o){if(e==="same-file"){let s=i[0]??null;return s?S(s):d("No same-file consumer path was available.")}if(e==="sibling-folder"&&i.length===1){let s=u(f.dirname(i[0])),r=M(n,t,s,o);return r?d(r):S(s)}return null}function oe(e,n,t,i){return pe(e)?$(e,n,t,i,`Nearest shared owner ${e} is outside source root ${t}.`):null}function se(e,n,t,i,o){if(e===".")return d("The nearest common owner is the repository root.");let s=`${e}/shared`,r=$(s,n,t,o,`Proposed home ${s} is outside source root ${t}.`);return r.confidence==="withheld"||i.has(s)?r:d(`${s} does not exist in the indexed project.`)}function $(e,n,t,i,o){if(!P(e,t))return d(o);let s=M(n,t,e,i);return s?d(s):S(e)}function S(e){return{suggestedHome:e,confidence:"exact",whyNoSuggestedHome:null}}function d(e){return{suggestedHome:null,confidence:"withheld",whyNoSuggestedHome:e}}function ae(e,n,t,i,o,s){let r=["Report-only signal; review ownership before moving files."];return n==="none"&&r.push("No consumers were found in the current index."),n==="file-level"&&r.push("File-level import evidence can hide which exported unit is actually used."),(t==="."||t==="src")&&r.push("Nearest common owner is broad, so this is not enough evidence for automatic placement."),i.length===1&&r.push("Only one consumer was found; inlining or same-folder placement may be better than shared extraction."),e.kind==="file"&&r.push("File targets describe module locality, not symbol-level usage."),t&&o.startsWith(`${t}/`)&&r.push("Candidate already lives under the nearest common owner."),s&&r.push(`No exact suggested home: ${s}`),r}function ce(e,n,t,i,o,s){let r=[];return r.push(`${e.shortName} currently lives in ${n}.`),t?r.push(`${i.length} consumer file(s) share ${t} as their nearest common owner.`):r.push("No consumer owner could be inferred from the current index."),o?r.push(`Suggested home is ${o}.`):s&&r.push(`No exact suggested home: ${s}`),r}function le(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 ue(e,n){return T(n)-T(e)||e.candidatePath.localeCompare(n.candidatePath)}function T(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 de(e){let n=new Set(["."]);for(let t of e){let i=u(f.dirname(t));for(;!n.has(i)&&(n.add(i),i!==".");)i=u(f.dirname(i))}return n}function me(e){let n=x(e),t=n.indexOf("src");return t>=0?n.slice(0,t+1).join("/"):n.length<=1?".":n[0]}function P(e,n){let t=u(e),i=u(n);return i==="."||t===i||t.startsWith(`${i}/`)}function ge(e,n,t){let i=x(e),o=x(n);return(P(e,n)?i.slice(o.length):i).some(r=>t.has(r.toLowerCase()))}function M(e,n,t,i){return u(e)===u(t)||!ge(e,n,i)?null:`${e} is a named architectural boundary; an exact move to ${t} needs human design.`}function fe(...e){let n=new Set(O);for(let t of e)for(let i of t??[]){let o=he(i);o&&n.add(o)}return n}function he(e){let n=e.trim().toLowerCase();return n===""?null:n}function R(e,n){return v(e).includes(n)}function U(e,n){let t=v(e);return n.some(i=>t.includes(i))}function pe(e){let n=e.split("/").filter(Boolean),t=n[n.length-1];return t?G.has(t):!1}function D(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function u(e){let n=D(e);return n===""?".":n}function x(e){let n=D(e);return n==="."?[]:n.split("/").filter(Boolean)}function L(e,n){return!Number.isFinite(e)||e===void 0||e<1?n:Math.floor(e)}function H(e){return w([...e]).sort((n,t)=>n.localeCompare(t))}function w(e){return[...new Set(e)]}export{De as a};
|
|
2
|
+
//# sourceMappingURL=chunk-DJMK4DBL.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{d as y}from"./chunk-7S5E7KWT.js";import{execFileSync as j}from"child_process";var F=2e3,E=50,H=8,M=3,L=2160*60*60,P=/\b(?:fix(?:es|ed)?|bug|regression|hotfix)\b/i,D=3,O=/#\d+|\b[A-Z][A-Z0-9]+-\d+\b/g,B=/^([a-z][a-z0-9-]+)(?:\([^)]+\))?!?:/i;function x(e){let t=y(e,{clearGroups:["whole-project"]});return(n,o)=>{let i=N(n.config.projectRoot);if(!i)return null;let r=t.has(n)?t.get(n,()=>({head:"",value:null})):null;return r&&r.head===i?r.value:(t.invalidate(n),t.get(n,()=>({head:i,value:o(n.config.projectRoot,i)})).value)}}var I=x("git-commit-history");function A(e){return I(e,v)}function N(e){try{return C(e,["rev-parse","HEAD"]).trim()||null}catch{return null}}function C(e,t){return j("git",["-C",e,...t],{encoding:"utf-8",maxBuffer:64*1024*1024,stdio:["ignore","pipe","ignore"]})}function v(e,t){let n;try{n=C(e,["log","--no-merges","--name-only","-n",String(F),"--pretty=format:%x01%H%x00%ct%x00%s"])}catch{return null}let o=[],i=0;for(let r of n.split("")){if(r.trim()==="")continue;let a=r.indexOf(`
|
|
2
|
+
`),d=a>=0?r.slice(0,a):r,[f,g,h]=d.split("\0");if(!f||!g)continue;let c=a>=0?r.slice(a+1).split(`
|
|
3
|
+
`).map(s=>s.trim()).filter(s=>s!==""):[];if(c.length>E){i+=1;continue}o.push({hash:f,timestamp:Number(g)||0,subject:h??"",files:c})}return{head:t,commits:o,skippedBulkCommits:i}}function k(e){return P.test(e.subject)}function Q(e){let t=A(e);if(!t)return null;let n=new Map;for(let o of t.commits){let i=k(o);for(let r of o.files){let a=n.get(r)??{changes:0,fixChanges:0,lastChangedAt:0};a.changes+=1,i&&(a.fixChanges+=1),o.timestamp>a.lastChangedAt&&(a.lastChangedAt=o.timestamp),n.set(r,a)}}return n}function Y(e){let t=A(e);if(!t||t.commits.length===0)return null;let n=t.commits.map(o=>o.files.length).filter(o=>o>0).sort((o,i)=>o-i);return n.length===0?null:{medianFilesPerCommit:R(n,.5),p90FilesPerCommit:R(n,.9),commitsAnalyzed:n.length}}function R(e,t){let n=Math.min(e.length-1,Math.floor(e.length*t));return e[n]}var z=x("git-tracked-files");function ee(e){return z(e,t=>{try{let n=C(t,["ls-files"]);return new Set(n.split(`
|
|
4
|
+
`).map(o=>o.trim()).filter(o=>o!==""))}catch{return null}})}var G=x("git-file-adds");function te(e){return G(e,t=>U(t))}function U(e){let t;try{t=C(e,["log","--no-merges","--diff-filter=A","--name-only","-n",String(F),"--pretty=format:%x01%H%x00%ct%x00%s"])}catch{return null}let n=new Map,o=-1;for(let i of t.split("")){if(i.trim()==="")continue;o+=1;let r=i.indexOf(`
|
|
5
|
+
`),a=r>=0?i.slice(0,r):i,[,d]=a.split("\0"),f=Number(d)||0;if(!(r<0))for(let g of i.slice(r+1).split(`
|
|
6
|
+
`)){let h=g.trim();h!==""&&n.set(h,{commitsAgo:o,addedAt:f})}}return n}function ne(e,t={}){let{minTogether:n=4,minConfidence:o=.6,maxFilesPerCommit:i=E}=t,r=A(e);if(!r)return null;let a=new Map,d=new Map,f=0;for(let c of r.commits){let s=[...new Set(c.files)].sort();if(s.length>i)continue;c.timestamp>f&&(f=c.timestamp);let m=J(s);for(let u of s)a.set(u,(a.get(u)??0)+1);for(let u=0;u<s.length;u++)for(let b=u+1;b<s.length;b++){let p=`${s[u]}\0${s[b]}`,l=d.get(p)??{together:0,focusedTogether:0,broadTogether:0,lastTogetherAt:0,timestamps:[],subjects:[]};l.together+=1,m?l.broadTogether+=1:l.focusedTogether+=1,c.timestamp>l.lastTogetherAt&&(l.lastTogetherAt=c.timestamp),l.timestamps.push(c.timestamp),l.subjects.push(c.subject),d.set(p,l)}}let g=[],h=f-L;for(let[c,s]of d){let m=s.together;if(m<n)continue;let[u,b]=c.split("\0"),p=a.get(u)??m,l=a.get(b)??m,S=Math.max(m/p,m/l);if(S<o)continue;let _=s.broadTogether/m,T=s.timestamps.filter(w=>w>=h).length;g.push({fileA:u,fileB:b,together:m,confidence:S,changesA:p,changesB:l,focusedTogether:s.focusedTogether,broadTogether:s.broadTogether,broadCommitRatio:_,lastTogetherAt:s.lastTogetherAt,recentTogether:T,commitScope:K(s.broadTogether,m),recency:T>0?"recent":"stale",subjectContext:W(s.subjects)})}return g.sort((c,s)=>s.together-c.together||s.confidence-c.confidence||c.fileA.localeCompare(s.fileA)),g}function J(e){return e.length>=H?!0:V(e).size>=M}function V(e){let t=new Set;for(let n of e){let o=n.indexOf("/");t.add(o>=0?n.slice(0,o):".")}return t}function K(e,t){return e===0?"focused":e/t>=.5?"broad-sweep":"mixed"}function W(e){let t=new Set,n=[],o=[];for(let i of e){!o.includes(i)&&o.length<D&&o.push(i);for(let r of X(i))t.add(r);for(let r of i.match(O)??[])n.includes(r)||n.push(r)}return{subjectLabels:[...t].sort(),issueRefs:n,sampleSubjects:o,externalIssueLabelStatus:"unavailable"}}function X(e){let t=new Set,n=B.exec(e)?.[1]?.toLowerCase();return n&&t.add(Z(n)),/\b(?:feat|feature)\b/i.test(e)&&t.add("feature"),/\b(?:fix(?:es|ed)?|bug|regression|hotfix)\b/i.test(e)&&t.add("fix"),/\b(?:docs?|documentation|guide|readme)\b/i.test(e)&&t.add("docs"),/\brefactor(?:ing|ed)?\b/i.test(e)&&t.add("refactor"),/\btests?\b/i.test(e)&&t.add("test"),/\b(?:release|version|v\d+\.\d+)\b/i.test(e)&&t.add("release"),/\bchore\b/i.test(e)&&t.add("chore"),/\bbuild\b/i.test(e)&&t.add("build"),/\bci\b/i.test(e)&&t.add("ci"),/\bperf(?:ormance)?\b/i.test(e)&&t.add("perf"),[...t]}function Z(e){return e==="feat"?"feature":e}export{A as a,Q as b,Y as c,ee as d,te as e,ne as f};
|
|
7
|
+
//# sourceMappingURL=chunk-DRAZH77R.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as D}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as D}from"./chunk-3ZYF3ELZ.js";import{n as A}from"./chunk-HVTYSC26.js";import{b as d,d as h,f as y}from"./chunk-FUPDW5AC.js";import{c as S}from"./chunk-JM72FNGA.js";function F(e,n={}){let{samples:o=50,scope:r,maxDisagreements:l=5}=n,s=new D(e),i=C(s.productionCallableDefinitions({scope:r,minLoc:2,requireFunctionLikeSymbol:!0}),o);if(i.length===0||!R(e,i))return{available:!1,sampleSize:i.length,oracleCoverage:0,scores:[],topDisagreements:[]};let c={references:v(),callees:v()},a=[],g=0,T=y(e,i);for(let t of i){let u=f(t,h(e,t).map(m=>m.file)),b=f(t,(T.get(t.symbolId)??[]).map(m=>m.file));if(u.size===0&&b.size===0)continue;g+=1;let Q=f(t,A(e,t).map(m=>m.file)),I=f(t,(s.calleeMap([t],{semantic:!1}).get(t.symbolId)??[]).map(m=>m.file));x(c.references,t,"references",Q,u,a),x(c.callees,t,"callees",I,b,a)}return a.sort((t,u)=>u.cheapOnly.length+u.oracleOnly.length-(t.cheapOnly.length+t.oracleOnly.length)),{available:!0,sampleSize:i.length,oracleCoverage:i.length>0?p(g/i.length):0,scores:["references","callees"].map(t=>O(t,c[t])),topDisagreements:a.slice(0,l)}}function v(){return{comparedSymbols:0,agreed:0,cheapTotal:0,oracleTotal:0}}function C(e,n){let o=[...e].sort((s,i)=>s.symbolId-i.symbolId);if(o.length<=n)return o;let r=o.length/n,l=[];for(let s=0;s<n;s++)l.push(o[Math.floor(s*r)]);return l}function R(e,n){let o=n[0];if(!o)return!1;try{return d(e,o.relativePath).availability().available}catch{return!1}}function f(e,n){let o=new Set;for(let r of n)r!==e.relativePath&&o.add(r);return o}function x(e,n,o,r,l,s){if(r.size===0&&l.size===0)return;e.comparedSymbols+=1,e.cheapTotal+=r.size,e.oracleTotal+=l.size;let i=[],c=[];for(let a of r)l.has(a)?e.agreed+=1:i.push(a);for(let a of l)r.has(a)||c.push(a);(i.length>0||c.length>0)&&s.push({symbol:S(n.symbol),question:o,cheapOnly:i,oracleOnly:c})}var z={references:!0,callees:!1};function O(e,n){let o=n.oracleTotal>0?n.agreed/n.oracleTotal:1,r=n.cheapTotal-n.agreed;return{question:e,comparedSymbols:n.comparedSymbols,precision:z[e]&&n.cheapTotal>0?p(n.agreed/n.cheapTotal):null,recall:p(o),unverified:r}}function p(e){return Math.round(e*1e3)/1e3}export{F as a};
|
|
2
|
+
//# sourceMappingURL=chunk-E44ZMVNA.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as d}from"./chunk-
|
|
1
|
+
import{a as d}from"./chunk-GZCQTZLK.js";import{g as l}from"./chunk-3UW7VM4H.js";import{c as r}from"./chunk-JM72FNGA.js";function b(o,t={}){let{limit:n=30,scope:e}=t,i=e?`AND def_d.relative_path LIKE '%${e}%'`:"",m=o.all(`SELECT
|
|
2
2
|
gs.symbol,
|
|
3
3
|
COUNT(*) AS ref_count,
|
|
4
4
|
COUNT(DISTINCT ref_d.id) AS file_count,
|
|
@@ -22,4 +22,4 @@ import{a as d}from"./chunk-623UQCVG.js";import{c as r,s as l}from"./chunk-64LH2Q
|
|
|
22
22
|
GROUP BY gs.id
|
|
23
23
|
ORDER BY ref_count DESC
|
|
24
24
|
LIMIT ?`,n).filter(s=>!o.isIgnored(s.defined_in)).map(s=>({symbol:s.symbol,shortName:r(s.symbol),refCount:s.ref_count,fileCount:s.file_count,definedIn:s.defined_in}));return m.length>0?m:f(o,e,n)}function f(o,t,n){return l(o,{scope:t}).filter(e=>!o.isIgnored(e.relativePath)).map(e=>u(o,e)).filter(e=>e.refCount>0).sort((e,i)=>i.refCount-e.refCount||i.fileCount-e.fileCount).slice(0,n)}function u(o,t){let n=d(o,t,{limit:500});return{symbol:t.symbol,shortName:r(t.symbol),refCount:n.length,fileCount:new Set(n.map(e=>e.file)).size,definedIn:t.relativePath}}export{b as a};
|
|
25
|
-
//# sourceMappingURL=chunk-
|
|
25
|
+
//# sourceMappingURL=chunk-E7KERP7E.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as m}from"./chunk-B75HZHUP.js";import{a as b}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{c as m}from"./chunk-B75HZHUP.js";import{a as b}from"./chunk-GZCQTZLK.js";import{a as g}from"./chunk-YTR4CO5S.js";import{o as y}from"./chunk-HVTYSC26.js";import{a as c}from"./chunk-MZ7APUFN.js";import{c as r}from"./chunk-JM72FNGA.js";function v(l,t,n={}){let o=c(l,t);if(!o)return null;let a=[{file:o.relativePath,line:o.startLine}],s=y(l,o,{semantic:n.semantic}).map(e=>({file:e.file,line:e.line,enclosingSymbol:e.enclosingSymbol??"(top-level)",enclosingShort:e.enclosingSymbol?r(e.enclosingSymbol):"(top-level)"})),{producers:f,consumers:i}=S(l,o,s,{semantic:n.semantic!==!1});return{symbol:o.symbol,shortName:r(o.symbol),relativePath:o.relativePath,definitionSites:a.filter(e=>!l.isIgnored(e.file)),usageSites:s,producers:f.filter(e=>!l.isIgnored(e.file)).map(e=>({symbol:e.symbol,shortName:r(e.symbol),file:e.file})),consumers:i.filter(e=>!l.isIgnored(e.file)).map(e=>({symbol:e.symbol,shortName:e.symbol===e.file?"(top-level)":r(e.symbol),file:e.file}))}}function S(l,t,n,o){let a=m(g(l,t,{limit:30,semantic:o.semantic}).map(i=>({symbol:i.symbol,file:i.file}))),s=m(b(l,t,{limit:30,semantic:o.semantic})),f=s.length>0?s:m(n.map(i=>({symbol:i.enclosingSymbol==="(top-level)"?i.file:i.enclosingSymbol,file:i.file})));return{producers:a,consumers:f}}export{v as a};
|
|
2
|
+
//# sourceMappingURL=chunk-EOZIZWW4.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as C,b as F,e as V,f as b,h as g,i as N}from"./chunk-YVQUQIBM.js";import{c as _}from"./chunk-TMS4JPWY.js";import{e as T}from"./chunk-BJ7OHKB5.js";import{ElementTypes as q,NodeTypes as w,parse as W}from"@vue/compiler-dom";import{parse as Ae}from"@vue/compiler-sfc";function P(e,t){return e.split(t).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join("")}var G=T("vue-template-facts"),H=new Set(["component","keep-alive","slot","suspense","teleport","template","transition","transition-group"]),Y=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]),K=new Set(["div","span","template"]),J=new Set(["as","await","break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","false","finally","for","from","function","if","import","in","instanceof","let","new","null","of","return","super","switch","this","throw","true","try","typeof","undefined","var","void","while","with","yield"]);function $(e,t){let n=t.replace(/\\/g,"/"),r=C(e,n);return G.get(e,n,r,()=>Q(n,b(e,n).template))}function Q(e,t){let n={relativePath:e,template:t?{startLine:t.startLine,endLine:t.endLine}:null,componentTags:[],nativeTags:[],builtinTags:[],props:[],events:[],directives:[],slots:[],expressionIdentifiers:[],structuralTokens:[]};if(!t)return n;let r;try{r=W(t.body,{comments:!1})}catch{return n}let i=new Set,o=s=>{s.trim()&&i.add(s)};return E(r.children,t.startLine,n,o),n.structuralTokens=[...i].sort(),n}function E(e,t,n,r){for(let i of e)i.type===w.ELEMENT&&(X(i,t,n,r),E(i.children,t,n,r))}function X(e,t,n,r){let i=ae(e.tag),o={tag:e.tag,normalized:i,kind:se(e),startLine:h(t,e.loc.start.line),endLine:h(t,e.loc.end.line)};o.kind==="component"?(n.componentTags.push(o),r(`component:${i}`)):o.kind==="builtin"?(n.builtinTags.push(o),r(`builtin:${i}`)):(n.nativeTags.push(o),K.has(e.tag)||r(`native:${e.tag}`));for(let s of e.props)ee(s,t,n,r)}function ee(e,t,n,r){if(e.type===w.ATTRIBUTE){let a=e.value?.content??null,u=A("prop",e.name,a,t,e.loc.start.line,e.loc.end.line);n.props.push(u),r(`prop:${e.name}`);return}let i=ne(e),o=B(e.exp),s=A(te(e.name),i,o,t,e.loc.start.line,e.loc.end.line);switch(s.kind){case"prop":n.props.push(s),r(`prop:${i}`);break;case"event":n.events.push(s),r(`event:${i}`);break;case"slot":n.slots.push(s),r(`slot:${i}`);break;case"directive":n.directives.push(s),r(`directive:${i}`);break}o&&re(o,t,e.loc.start.line,n,r)}function A(e,t,n,r,i,o){return{kind:e,name:t,value:n,startLine:h(r,i),endLine:h(r,o)}}function te(e){switch(e){case"bind":case"model":return"prop";case"on":return"event";case"slot":return"slot";default:return"directive"}}function ne(e){let t=B(e.arg);return t||e.name}function B(e){if(!e)return null;let t=("content"in e&&typeof e.content=="string"?e.content:e.loc.source).trim();return t||null}function re(e,t,n,r,i){for(let o of ie(e)){let s={name:o,startLine:h(t,n),endLine:h(t,n)};r.expressionIdentifiers.push(s),i(`id:${o}`)}}function ie(e){let t=new Set,n=oe(e),r=/\b[A-Za-z_$][A-Za-z0-9_$]*\b/g,i;for(;i=r.exec(n);){let o=i[0];J.has(o)||/^[A-Z_]+$/.test(o)||t.add(o)}return[...t].sort()}function oe(e){return e.replace(/\/\*[\s\S]*?\*\//g," ").replace(/\/\/.*$/gm," ").replace(/`(?:\\[\s\S]|\$\{([^}]*)\}|[^`\\])*`/g,(t,n)=>n??" ").replace(/'(?:\\[\s\S]|[^'\\])*'/g," ").replace(/"(?:\\[\s\S]|[^"\\])*"/g," ")}function se(e){let t=e.tag;return e.tagType===q.COMPONENT?"component":H.has(t)?"builtin":Y.has(t)?"native":/^[A-Z]/.test(t)||t.includes("-")?"component":"native"}function ae(e){return P(e,/[-_:]/)}function h(e,t){return e+Math.max(0,t-1)}function S(e){return e.type==="comment"||e.type==="line_comment"||e.type==="block_comment"}var ce=new Set(["function_declaration","method_definition","method_signature","function_signature"]);function D(e,t){let n=le(e,t);if(n)return{name:n.name,startLine:n.definitionNode.startPosition.row,endLine:n.definitionNode.endPosition.row,paramCount:R(n.functionNode),params:k(n.functionNode),paramsEndLine:I(n.functionNode),isLiteralPassthrough:z(n.functionNode,t)};if(!ue(e.type,t))return null;let r=e.childForFieldName("name")??e.namedChildren.find(i=>i.type==="identifier"||i.type==="property_identifier");return r?{name:r.text,startLine:e.startPosition.row,endLine:e.endPosition.row,paramCount:R(e),params:k(e),paramsEndLine:I(e),isLiteralPassthrough:z(e,t)}:null}function U(e){return e.namedChildren.find(t=>t.type==="parameters"||t.type==="formal_parameters")}function k(e){let t=U(e);if(!t)return[];let n=[];for(let r of t.namedChildren){if(S(r))continue;if(r.type==="identifier"){n.push({name:r.text,simple:!0});continue}let i=r.namedChildren.some(a=>a.type.endsWith("_modifier"))||/^\s*(?:public|private|protected|readonly|override)\b/.test(r.text),o=r.childForFieldName("pattern");if(!i&&o&&o.type==="identifier"){n.push({name:o.text,simple:!0});continue}let s=r.namedChildren.find(a=>a.type==="identifier");n.push({name:o?.type==="identifier"?o.text:s?.text??"",simple:!1})}return n}function I(e){let t=U(e);return t?t.endPosition.row:e.startPosition.row}function ue(e,t){return t==="rust"?e==="function_item"||e==="function_signature_item":t==="python"?e==="function_definition":t==="typescript"||t==="tsx"||t==="javascript"?ce.has(e):!1}function le(e,t){if(t!=="typescript"&&t!=="tsx"&&t!=="javascript")return null;if(e.type==="variable_declarator"){let n=e.childForFieldName("name")??e.namedChild(0),r=e.childForFieldName("value")??e.namedChild(1);return!n||!r||r.type!=="arrow_function"&&r.type!=="function_expression"?null:{name:n.text,definitionNode:e,functionNode:r}}if(e.type==="public_field_definition"){let n=e.childForFieldName("name")??e.namedChild(0),r=e.childForFieldName("value")??e.namedChild(1);return!n||!r||r.type!=="arrow_function"&&r.type!=="function_expression"?null:{name:n.text,definitionNode:e,functionNode:r}}return null}function R(e){let t=e.namedChildren.find(r=>r.type==="parameters"||r.type==="formal_parameters");if(!t)return 0;let n=0;for(let r of t.namedChildren)S(r)||(n+=1);return n}function z(e,t){let n=e.namedChildren.find(c=>c.type==="block"||c.type==="statement_block");if(!n)return!1;let r=n.namedChildren.filter(c=>!S(c));if(r.length!==1)return!1;let i=r[0],o=null;if(i.type==="return_statement"||i.type==="expression_statement"?o=i.namedChild(0)??null:t==="rust"&&(i.type==="call_expression"||i.type==="macro_invocation")&&(o=i),!o)return!1;let s=t==="python"?"call":"call_expression";if(o.type!==s)return!1;let a=o.namedChildren.find(c=>c.type==="arguments"||c.type==="argument_list");if(!a)return!1;let u=a.namedChildren.filter(c=>!S(c)),l=e.namedChildren.find(c=>c.type==="parameters"||c.type==="formal_parameters");if(!l)return!1;let m=[];for(let c of l.namedChildren){if(c.type==="identifier"){m.push(c.text);continue}let f=c.namedChildren.find(v=>v.type==="identifier");f&&m.push(f.text)}if(u.length!==m.length)return!1;for(let c=0;c<m.length;c+=1){let f=u[c];if(f.type!=="identifier"||f.text!==m[c])return!1}return!0}var pe=new Set(["ref","shallowRef","reactive","computed","watch","watchEffect"]),me=new Set(["onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","onActivated","onDeactivated","onErrorCaptured"]),fe=new Set(["axios","fetch","runRequest","useAsyncData","useFetch","useResource"]),de=new Set(["defineEmits","defineExpose","defineModel","defineOptions","defineProps","withDefaults"]),ge=new Set(["catch","for","function","if","return","switch","while"]);function j(e){let t={imports:[],functions:[],calls:[],composables:[],stores:[],reactivity:[],lifecycle:[],requests:[],macros:[],lineCount:0,externalLineCount:0,externalScriptPaths:[],unresolvedScripts:[]};for(let n of e.scripts){t.lineCount+=g(n),n.external&&(t.externalLineCount+=g(n),t.externalScriptPaths.push(n.sourcePath));for(let i of n.errors)t.unresolvedScripts.push({sourcePath:n.sourcePath,reason:i});if(!n.body||!n.astLanguage){n.astLanguage||t.unresolvedScripts.push({sourcePath:n.sourcePath,reason:`Unsupported Vue script language: ${n.lang??"unknown"}`});continue}t.imports.push(...be(n));let r=V(n.astLanguage,n.body);r?ye(n,r.rootNode,t):Se(n,t)}return he(t),t.externalScriptPaths=Z(t.externalScriptPaths),t}function he(e){e.composables=y(e,"composable"),e.stores=y(e,"store"),e.reactivity=y(e,"reactivity"),e.lifecycle=y(e,"lifecycle"),e.requests=y(e,"request"),e.macros=y(e,"macro")}function y(e,t){return Z(e.calls.filter(n=>n.categories.includes(t)).map(n=>n.name))}function ye(e,t,n){let r=new Set,i=new Set,o=s=>{let a=D(s,e.astLanguage);if(a){let l=`${a.name}:${a.startLine}:${a.endLine}`;i.has(l)||(i.add(l),n.functions.push({name:a.name,sourcePath:e.sourcePath,startLine:e.startLine+a.startLine,endLine:e.startLine+a.endLine,setup:e.setup}))}let u=N(s,e.astLanguage);if(u){let l=`${u.calleeLeaf}:${u.line}`;r.has(l)||(r.add(l),n.calls.push({name:u.calleeLeaf,sourcePath:e.sourcePath,line:e.startLine+u.line,categories:O(u.calleeLeaf),setup:e.setup}))}for(let l of s.children)o(l)};o(t)}function Se(e,t){for(let n of e.body.matchAll(/\b([A-Za-z_$][\w$]*)\s*\(/g)){let r=n[1];!r||ge.has(r)||t.calls.push({name:r,sourcePath:e.sourcePath,line:e.startLine+L(e.body,n.index??0),categories:O(r),setup:e.setup})}for(let n of e.body.matchAll(/\bfunction\s+([A-Za-z_$][\w$]*)\b/g)){let r=n[1];if(!r)continue;let i=e.startLine+L(e.body,n.index??0);t.functions.push({name:r,sourcePath:e.sourcePath,startLine:i,endLine:i,setup:e.setup})}for(let n of e.body.matchAll(/\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(?:async\s*)?(?:function\b|\([^)]*\)\s*=>|[A-Za-z_$][\w$]*\s*=>)/g)){let r=n[1];if(!r)continue;let i=e.startLine+L(e.body,n.index??0);t.functions.push({name:r,sourcePath:e.sourcePath,startLine:i,endLine:i,setup:e.setup})}}function be(e){let t=[];for(let n of e.body.matchAll(/\bimport\s+(?:type\s+)?([^'";]+?)\s+from\s+['"]([^'"]+)['"]/g)){let r=n[1]?.trim(),i=n[2];if(!r||!i)continue;let o=e.startLine+L(e.body,n.index??0);for(let s of Le(r))t.push({local:s,source:i,sourcePath:e.sourcePath,line:o,setup:e.setup})}return t}function Le(e){let t=[],r=e.split(",").map(s=>s.trim()).filter(Boolean)[0];r&&!r.startsWith("{")&&!r.startsWith("*")&&t.push(r);let i=/\{([^}]*)\}/.exec(e)?.[1];if(i)for(let s of i.split(",")){let a=s.trim();if(!a)continue;let u=/\bas\s+([A-Za-z_$][\w$]*)$/.exec(a)?.[1];t.push(u??a.replace(/^type\s+/,"").trim())}let o=/\*\s+as\s+([A-Za-z_$][\w$]*)/.exec(e)?.[1];return o&&t.push(o),t.filter(s=>/^[A-Za-z_$][\w$]*$/.test(s))}function O(e){let t=["call"];return/^use[A-Z0-9_]/.test(e)&&t.push("composable"),/^use[A-Z0-9_].*Store$/.test(e)&&t.push("store"),pe.has(e)&&t.push("reactivity"),me.has(e)&&t.push("lifecycle"),fe.has(e)&&t.push("request"),de.has(e)&&t.push("macro"),t}function L(e,t){let n=0;for(let r=0;r<t&&r<e.length;r+=1)e.charCodeAt(r)===10&&(n+=1);return n}function Z(e){return[...new Set(e)].sort()}var ve=new Set(["in","key","of"]),xe=new Set(["computed","defineEmits","defineProps","reactive","ref","watch","watchEffect"]);function Ye(e,t={}){let n=_(e,{extensions:[".vue"]}).filter(i=>!t.scope||i.includes(t.scope)).sort();return(typeof t.scanLimit=="number"&&t.scanLimit>0?n.slice(0,t.scanLimit):n).map(i=>Te(e,i)).filter(i=>(t.minTemplateTokens===void 0||i.templateTokens.size>=t.minTemplateTokens)&&(t.minBehaviorTokens===void 0||i.behaviorTokens.size>=t.minBehaviorTokens))}function Te(e,t){let n=t.replace(/\\/g,"/"),r=b(e,n),i=$(e,n),o=j(r),s=Fe(i),a=i.expressionIdentifiers.map(p=>p.name).filter(p=>!s.includes(p)).filter((p,d,x)=>x.indexOf(p)===d).sort(),u=i.componentTags.map(p=>p.normalized).filter((p,d,x)=>x.indexOf(p)===d).sort(),l=F(e,n).length,m=g(r.template),c=o.lineCount,f=r.styles.reduce((p,d)=>p+g(d),0),v=r.customBlocks.reduce((p,d)=>p+g(d),0);return{file:n,sfc:r,templateFacts:i,scriptFacts:o,templateTokens:new Set(i.structuralTokens),behaviorTokens:Ce(i,o,a),templateBindingNames:a,templateLocalNames:s,componentNames:u,sfcLines:l,totalLines:l+o.externalLineCount,templateLines:m,scriptLines:c,styleLines:f,externalScriptLines:o.externalLineCount,externalScriptPaths:o.externalScriptPaths,customBlockLines:v}}function Ce(e,t,n){let r=new Set;for(let i of t.composables)r.add(`composable:${i}`);for(let i of t.stores)r.add(`store:${i}`);for(let i of t.reactivity)r.add(`reactivity:${i}`);for(let i of t.lifecycle)r.add(`lifecycle:${i}`);for(let i of t.requests)r.add(`request:${i}`);for(let i of t.macros)r.add(`macro:${i}`);for(let i of t.functions){if(xe.has(i.name))continue;r.add(`function:${i.name}`);let o=/^[a-z]+/.exec(i.name)?.[0]??null;o&&o.length>2&&o!==i.name&&r.add(`function-verb:${o}`)}for(let i of e.events)r.add(`template-event:${i.name}`);for(let i of n)r.add(`template-binding:${i}`);return r}function Fe(e){let t=new Set;for(let n of e.directives)if(n.name==="for"&&n.value)for(let r of Ve(n.value))t.add(r);for(let n of e.slots)if(n.value)for(let r of M(n.value))t.add(r);return[...t].sort()}function Ve(e){let t=/^(.*?)\s+(?:in|of)\s+/.exec(e.trim());return t?M(t[1]??""):[]}function M(e){let t=[];for(let n of e.matchAll(/\b[A-Za-z_$][\w$]*\b/g)){let r=n[0];ve.has(r)||t.push(r)}return t}export{D as a,P as b,Ye as c};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as C,b as F,e as V,f as b,h as g,i as N}from"./chunk-D322LMSA.js";import{c as _}from"./chunk-OBBDKQAG.js";import{e as T}from"./chunk-7S5E7KWT.js";import{ElementTypes as q,NodeTypes as w,parse as W}from"@vue/compiler-dom";import{parse as Ae}from"@vue/compiler-sfc";function P(e,t){return e.split(t).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join("")}var G=T("vue-template-facts"),H=new Set(["component","keep-alive","slot","suspense","teleport","template","transition","transition-group"]),Y=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]),K=new Set(["div","span","template"]),J=new Set(["as","await","break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","false","finally","for","from","function","if","import","in","instanceof","let","new","null","of","return","super","switch","this","throw","true","try","typeof","undefined","var","void","while","with","yield"]);function $(e,t){let n=t.replace(/\\/g,"/"),r=C(e,n);return G.get(e,n,r,()=>Q(n,b(e,n).template))}function Q(e,t){let n={relativePath:e,template:t?{startLine:t.startLine,endLine:t.endLine}:null,componentTags:[],nativeTags:[],builtinTags:[],props:[],events:[],directives:[],slots:[],expressionIdentifiers:[],structuralTokens:[]};if(!t)return n;let r;try{r=W(t.body,{comments:!1})}catch{return n}let i=new Set,o=s=>{s.trim()&&i.add(s)};return E(r.children,t.startLine,n,o),n.structuralTokens=[...i].sort(),n}function E(e,t,n,r){for(let i of e)i.type===w.ELEMENT&&(X(i,t,n,r),E(i.children,t,n,r))}function X(e,t,n,r){let i=ae(e.tag),o={tag:e.tag,normalized:i,kind:se(e),startLine:h(t,e.loc.start.line),endLine:h(t,e.loc.end.line)};o.kind==="component"?(n.componentTags.push(o),r(`component:${i}`)):o.kind==="builtin"?(n.builtinTags.push(o),r(`builtin:${i}`)):(n.nativeTags.push(o),K.has(e.tag)||r(`native:${e.tag}`));for(let s of e.props)ee(s,t,n,r)}function ee(e,t,n,r){if(e.type===w.ATTRIBUTE){let a=e.value?.content??null,u=A("prop",e.name,a,t,e.loc.start.line,e.loc.end.line);n.props.push(u),r(`prop:${e.name}`);return}let i=ne(e),o=B(e.exp),s=A(te(e.name),i,o,t,e.loc.start.line,e.loc.end.line);switch(s.kind){case"prop":n.props.push(s),r(`prop:${i}`);break;case"event":n.events.push(s),r(`event:${i}`);break;case"slot":n.slots.push(s),r(`slot:${i}`);break;case"directive":n.directives.push(s),r(`directive:${i}`);break}o&&re(o,t,e.loc.start.line,n,r)}function A(e,t,n,r,i,o){return{kind:e,name:t,value:n,startLine:h(r,i),endLine:h(r,o)}}function te(e){switch(e){case"bind":case"model":return"prop";case"on":return"event";case"slot":return"slot";default:return"directive"}}function ne(e){let t=B(e.arg);return t||e.name}function B(e){if(!e)return null;let t=("content"in e&&typeof e.content=="string"?e.content:e.loc.source).trim();return t||null}function re(e,t,n,r,i){for(let o of ie(e)){let s={name:o,startLine:h(t,n),endLine:h(t,n)};r.expressionIdentifiers.push(s),i(`id:${o}`)}}function ie(e){let t=new Set,n=oe(e),r=/\b[A-Za-z_$][A-Za-z0-9_$]*\b/g,i;for(;i=r.exec(n);){let o=i[0];J.has(o)||/^[A-Z_]+$/.test(o)||t.add(o)}return[...t].sort()}function oe(e){return e.replace(/\/\*[\s\S]*?\*\//g," ").replace(/\/\/.*$/gm," ").replace(/`(?:\\[\s\S]|\$\{([^}]*)\}|[^`\\])*`/g,(t,n)=>n??" ").replace(/'(?:\\[\s\S]|[^'\\])*'/g," ").replace(/"(?:\\[\s\S]|[^"\\])*"/g," ")}function se(e){let t=e.tag;return e.tagType===q.COMPONENT?"component":H.has(t)?"builtin":Y.has(t)?"native":/^[A-Z]/.test(t)||t.includes("-")?"component":"native"}function ae(e){return P(e,/[-_:]/)}function h(e,t){return e+Math.max(0,t-1)}function S(e){return e.type==="comment"||e.type==="line_comment"||e.type==="block_comment"}var ce=new Set(["function_declaration","method_definition","method_signature","function_signature"]);function D(e,t){let n=le(e,t);if(n)return{name:n.name,startLine:n.definitionNode.startPosition.row,endLine:n.definitionNode.endPosition.row,paramCount:R(n.functionNode),params:k(n.functionNode),paramsEndLine:I(n.functionNode),isLiteralPassthrough:z(n.functionNode,t)};if(!ue(e.type,t))return null;let r=e.childForFieldName("name")??e.namedChildren.find(i=>i.type==="identifier"||i.type==="property_identifier");return r?{name:r.text,startLine:e.startPosition.row,endLine:e.endPosition.row,paramCount:R(e),params:k(e),paramsEndLine:I(e),isLiteralPassthrough:z(e,t)}:null}function U(e){return e.namedChildren.find(t=>t.type==="parameters"||t.type==="formal_parameters")}function k(e){let t=U(e);if(!t)return[];let n=[];for(let r of t.namedChildren){if(S(r))continue;if(r.type==="identifier"){n.push({name:r.text,simple:!0});continue}let i=r.namedChildren.some(a=>a.type.endsWith("_modifier"))||/^\s*(?:public|private|protected|readonly|override)\b/.test(r.text),o=r.childForFieldName("pattern");if(!i&&o&&o.type==="identifier"){n.push({name:o.text,simple:!0});continue}let s=r.namedChildren.find(a=>a.type==="identifier");n.push({name:o?.type==="identifier"?o.text:s?.text??"",simple:!1})}return n}function I(e){let t=U(e);return t?t.endPosition.row:e.startPosition.row}function ue(e,t){return t==="rust"?e==="function_item"||e==="function_signature_item":t==="python"?e==="function_definition":t==="typescript"||t==="tsx"||t==="javascript"?ce.has(e):!1}function le(e,t){if(t!=="typescript"&&t!=="tsx"&&t!=="javascript")return null;if(e.type==="variable_declarator"){let n=e.childForFieldName("name")??e.namedChild(0),r=e.childForFieldName("value")??e.namedChild(1);return!n||!r||r.type!=="arrow_function"&&r.type!=="function_expression"?null:{name:n.text,definitionNode:e,functionNode:r}}if(e.type==="public_field_definition"){let n=e.childForFieldName("name")??e.namedChild(0),r=e.childForFieldName("value")??e.namedChild(1);return!n||!r||r.type!=="arrow_function"&&r.type!=="function_expression"?null:{name:n.text,definitionNode:e,functionNode:r}}return null}function R(e){let t=e.namedChildren.find(r=>r.type==="parameters"||r.type==="formal_parameters");if(!t)return 0;let n=0;for(let r of t.namedChildren)S(r)||(n+=1);return n}function z(e,t){let n=e.namedChildren.find(c=>c.type==="block"||c.type==="statement_block");if(!n)return!1;let r=n.namedChildren.filter(c=>!S(c));if(r.length!==1)return!1;let i=r[0],o=null;if(i.type==="return_statement"||i.type==="expression_statement"?o=i.namedChild(0)??null:t==="rust"&&(i.type==="call_expression"||i.type==="macro_invocation")&&(o=i),!o)return!1;let s=t==="python"?"call":"call_expression";if(o.type!==s)return!1;let a=o.namedChildren.find(c=>c.type==="arguments"||c.type==="argument_list");if(!a)return!1;let u=a.namedChildren.filter(c=>!S(c)),l=e.namedChildren.find(c=>c.type==="parameters"||c.type==="formal_parameters");if(!l)return!1;let m=[];for(let c of l.namedChildren){if(c.type==="identifier"){m.push(c.text);continue}let f=c.namedChildren.find(v=>v.type==="identifier");f&&m.push(f.text)}if(u.length!==m.length)return!1;for(let c=0;c<m.length;c+=1){let f=u[c];if(f.type!=="identifier"||f.text!==m[c])return!1}return!0}var pe=new Set(["ref","shallowRef","reactive","computed","watch","watchEffect"]),me=new Set(["onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","onActivated","onDeactivated","onErrorCaptured"]),fe=new Set(["axios","fetch","runRequest","useAsyncData","useFetch","useResource"]),de=new Set(["defineEmits","defineExpose","defineModel","defineOptions","defineProps","withDefaults"]),ge=new Set(["catch","for","function","if","return","switch","while"]);function j(e){let t={imports:[],functions:[],calls:[],composables:[],stores:[],reactivity:[],lifecycle:[],requests:[],macros:[],lineCount:0,externalLineCount:0,externalScriptPaths:[],unresolvedScripts:[]};for(let n of e.scripts){t.lineCount+=g(n),n.external&&(t.externalLineCount+=g(n),t.externalScriptPaths.push(n.sourcePath));for(let i of n.errors)t.unresolvedScripts.push({sourcePath:n.sourcePath,reason:i});if(!n.body||!n.astLanguage){n.astLanguage||t.unresolvedScripts.push({sourcePath:n.sourcePath,reason:`Unsupported Vue script language: ${n.lang??"unknown"}`});continue}t.imports.push(...be(n));let r=V(n.astLanguage,n.body);r?ye(n,r.rootNode,t):Se(n,t)}return he(t),t.externalScriptPaths=Z(t.externalScriptPaths),t}function he(e){e.composables=y(e,"composable"),e.stores=y(e,"store"),e.reactivity=y(e,"reactivity"),e.lifecycle=y(e,"lifecycle"),e.requests=y(e,"request"),e.macros=y(e,"macro")}function y(e,t){return Z(e.calls.filter(n=>n.categories.includes(t)).map(n=>n.name))}function ye(e,t,n){let r=new Set,i=new Set,o=s=>{let a=D(s,e.astLanguage);if(a){let l=`${a.name}:${a.startLine}:${a.endLine}`;i.has(l)||(i.add(l),n.functions.push({name:a.name,sourcePath:e.sourcePath,startLine:e.startLine+a.startLine,endLine:e.startLine+a.endLine,setup:e.setup}))}let u=N(s,e.astLanguage);if(u){let l=`${u.calleeLeaf}:${u.line}`;r.has(l)||(r.add(l),n.calls.push({name:u.calleeLeaf,sourcePath:e.sourcePath,line:e.startLine+u.line,categories:O(u.calleeLeaf),setup:e.setup}))}for(let l of s.children)o(l)};o(t)}function Se(e,t){for(let n of e.body.matchAll(/\b([A-Za-z_$][\w$]*)\s*\(/g)){let r=n[1];!r||ge.has(r)||t.calls.push({name:r,sourcePath:e.sourcePath,line:e.startLine+L(e.body,n.index??0),categories:O(r),setup:e.setup})}for(let n of e.body.matchAll(/\bfunction\s+([A-Za-z_$][\w$]*)\b/g)){let r=n[1];if(!r)continue;let i=e.startLine+L(e.body,n.index??0);t.functions.push({name:r,sourcePath:e.sourcePath,startLine:i,endLine:i,setup:e.setup})}for(let n of e.body.matchAll(/\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(?:async\s*)?(?:function\b|\([^)]*\)\s*=>|[A-Za-z_$][\w$]*\s*=>)/g)){let r=n[1];if(!r)continue;let i=e.startLine+L(e.body,n.index??0);t.functions.push({name:r,sourcePath:e.sourcePath,startLine:i,endLine:i,setup:e.setup})}}function be(e){let t=[];for(let n of e.body.matchAll(/\bimport\s+(?:type\s+)?([^'";]+?)\s+from\s+['"]([^'"]+)['"]/g)){let r=n[1]?.trim(),i=n[2];if(!r||!i)continue;let o=e.startLine+L(e.body,n.index??0);for(let s of Le(r))t.push({local:s,source:i,sourcePath:e.sourcePath,line:o,setup:e.setup})}return t}function Le(e){let t=[],r=e.split(",").map(s=>s.trim()).filter(Boolean)[0];r&&!r.startsWith("{")&&!r.startsWith("*")&&t.push(r);let i=/\{([^}]*)\}/.exec(e)?.[1];if(i)for(let s of i.split(",")){let a=s.trim();if(!a)continue;let u=/\bas\s+([A-Za-z_$][\w$]*)$/.exec(a)?.[1];t.push(u??a.replace(/^type\s+/,"").trim())}let o=/\*\s+as\s+([A-Za-z_$][\w$]*)/.exec(e)?.[1];return o&&t.push(o),t.filter(s=>/^[A-Za-z_$][\w$]*$/.test(s))}function O(e){let t=["call"];return/^use[A-Z0-9_]/.test(e)&&t.push("composable"),/^use[A-Z0-9_].*Store$/.test(e)&&t.push("store"),pe.has(e)&&t.push("reactivity"),me.has(e)&&t.push("lifecycle"),fe.has(e)&&t.push("request"),de.has(e)&&t.push("macro"),t}function L(e,t){let n=0;for(let r=0;r<t&&r<e.length;r+=1)e.charCodeAt(r)===10&&(n+=1);return n}function Z(e){return[...new Set(e)].sort()}var ve=new Set(["in","key","of"]),xe=new Set(["computed","defineEmits","defineProps","reactive","ref","watch","watchEffect"]);function Ye(e,t={}){let n=_(e,{extensions:[".vue"]}).filter(i=>!t.scope||i.includes(t.scope)).sort();return(typeof t.scanLimit=="number"&&t.scanLimit>0?n.slice(0,t.scanLimit):n).map(i=>Te(e,i)).filter(i=>(t.minTemplateTokens===void 0||i.templateTokens.size>=t.minTemplateTokens)&&(t.minBehaviorTokens===void 0||i.behaviorTokens.size>=t.minBehaviorTokens))}function Te(e,t){let n=t.replace(/\\/g,"/"),r=b(e,n),i=$(e,n),o=j(r),s=Fe(i),a=i.expressionIdentifiers.map(p=>p.name).filter(p=>!s.includes(p)).filter((p,d,x)=>x.indexOf(p)===d).sort(),u=i.componentTags.map(p=>p.normalized).filter((p,d,x)=>x.indexOf(p)===d).sort(),l=F(e,n).length,m=g(r.template),c=o.lineCount,f=r.styles.reduce((p,d)=>p+g(d),0),v=r.customBlocks.reduce((p,d)=>p+g(d),0);return{file:n,sfc:r,templateFacts:i,scriptFacts:o,templateTokens:new Set(i.structuralTokens),behaviorTokens:Ce(i,o,a),templateBindingNames:a,templateLocalNames:s,componentNames:u,sfcLines:l,totalLines:l+o.externalLineCount,templateLines:m,scriptLines:c,styleLines:f,externalScriptLines:o.externalLineCount,externalScriptPaths:o.externalScriptPaths,customBlockLines:v}}function Ce(e,t,n){let r=new Set;for(let i of t.composables)r.add(`composable:${i}`);for(let i of t.stores)r.add(`store:${i}`);for(let i of t.reactivity)r.add(`reactivity:${i}`);for(let i of t.lifecycle)r.add(`lifecycle:${i}`);for(let i of t.requests)r.add(`request:${i}`);for(let i of t.macros)r.add(`macro:${i}`);for(let i of t.functions){if(xe.has(i.name))continue;r.add(`function:${i.name}`);let o=/^[a-z]+/.exec(i.name)?.[0]??null;o&&o.length>2&&o!==i.name&&r.add(`function-verb:${o}`)}for(let i of e.events)r.add(`template-event:${i.name}`);for(let i of n)r.add(`template-binding:${i}`);return r}function Fe(e){let t=new Set;for(let n of e.directives)if(n.name==="for"&&n.value)for(let r of Ve(n.value))t.add(r);for(let n of e.slots)if(n.value)for(let r of M(n.value))t.add(r);return[...t].sort()}function Ve(e){let t=/^(.*?)\s+(?:in|of)\s+/.exec(e.trim());return t?M(t[1]??""):[]}function M(e){let t=[];for(let n of e.matchAll(/\b[A-Za-z_$][\w$]*\b/g)){let r=n[0];ve.has(r)||t.push(r)}return t}export{D as a,P as b,Ye as c};
|
|
2
|
+
//# sourceMappingURL=chunk-ERHOS6AW.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{a as u}from"./chunk-
|
|
1
|
+
import{a as u}from"./chunk-3ZYF3ELZ.js";import{a as b}from"./chunk-MZ7APUFN.js";import{t as l}from"./chunk-CRU42NJU.js";import{c as m}from"./chunk-JM72FNGA.js";import{readFileSync as p}from"fs";import{join as h}from"path";function O(e,n,r={}){let t=b(e,n);if(!t)return null;let c=new u(e),o=P(d(e,t.relativePath,t.startLine,t.endLine),y(e,t.relativePath)),s=t.endLine-t.startLine+1,a=c.calleeMap([t],{additive:!0,semantic:r.semantic}).get(t.symbolId)??[],f=new Set(a.map(g=>g.symbol));return{symbol:t.symbol,shortName:m(t.symbol),relativePath:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:s,branches:o,cyclomaticEstimate:o+1,calleeCount:f.size,fanIn:S(e,t.symbolId),fanOut:L(a,t.relativePath)}}function y(e,n){return e.get("SELECT language FROM documents WHERE relative_path = ?",n)?.language??"unknown"}function d(e,n,r,t){try{return p(h(e.config.projectRoot,n),"utf-8").split(`
|
|
2
2
|
`).slice(r,t+1).join(`
|
|
3
3
|
`)}catch{return""}}function S(e,n){return e.get(`SELECT COUNT(DISTINCT c.document_id) AS c
|
|
4
4
|
FROM mentions m
|
|
5
5
|
JOIN chunks c ON m.chunk_id = c.id
|
|
6
6
|
WHERE m.symbol_id = ? AND m.role != 1`,n)?.c??0}function L(e,n){return new Set(e.filter(r=>r.file!==n).map(r=>r.symbol)).size}function P(e,n){let r=l(e),t=0,c=[/\bif\b/g,/\belse\s+if\b/g,/\belse\b/g,/\bfor\b/g,/\bwhile\b/g,/\bswitch\b/g,/\bcase\b/g,/\bcatch\b/g,/\?\s*[^?]/g,/&&/g,/\|\|/g];for(let o of c){let s=r.match(o);s&&(t+=s.length)}if(n==="python"){let o=[/\belif\b/g,/\bexcept\b/g,/\bfinally\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}else if(n==="rust"){let o=[/\bmatch\b/g,/=>/g,/\bloop\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}else if(n==="ruby"){let o=[/\belsif\b/g,/\bunless\b/g,/\brescue\b/g,/\bwhen\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}else if(n==="go"){let o=[/\bselect\b/g,/\bdefer\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}return t}export{O as a};
|
|
7
|
-
//# sourceMappingURL=chunk-
|
|
7
|
+
//# sourceMappingURL=chunk-ESG4HBEF.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as f,b as h,e as m,g as x,i as N}from"./chunk-
|
|
2
|
-
`.repeat(s.startLine)+s.body;return m(s.language,r)}):null}var O=[".tsx",".jsx"],C=new Set(["useActionState","useCallback","useContext","useDebugValue","useDeferredValue","useEffect","useId","useImperativeHandle","useInsertionEffect","useLayoutEffect","useMemo","useOptimistic","useReducer","useRef","useState","useSyncExternalStore","useTransition"]),J=new Set(["useEffect","useInsertionEffect","useLayoutEffect"]),P=new Set(["useActionState","useOptimistic","useReducer","useRef","useState"]),D=new Set(["useLocation","useNavigate","useParams","useSearchParams","useTranslation"]),V=new Set(["axios","fetch","gql","graphql","mutate","query","request","useMutation","useQuery","useSuspenseQuery"]),q=new Set(["add","apply","cancel","change","clear","close","create","delete","fetch","filter","handle","load","open","refresh","remove","render","reset","save","select","submit","toggle","update"]),I=new Set(["children","className","false","key","null","style","true","undefined"]),Z=new Set(["aria-hidden","className","clipRule","d","fill","fillRule","height","role","stroke","strokeLinecap","strokeLinejoin","strokeWidth","style","viewBox","width","xmlns"]);function Le(e,t={}){let n=y(e,{extensions:O}).filter(r=>!t.scope||r.includes(t.scope)).sort();return(typeof t.scanLimit=="number"&&t.scanLimit>0?n.slice(0,t.scanLimit):n).flatMap(r=>z(e,r)).filter(r=>(t.minJsxTokens===void 0||r.jsxTokens.size>=t.minJsxTokens)&&(t.minBehaviorTokens===void 0||r.behaviorTokens.size>=t.minBehaviorTokens))}function z(e,t){let n=t.replace(/\\/g,"/"),s=H(n);if(!s)return[];let r=_(e,n);if(!r)return[];let o=h(e,n).length;return M(r.rootNode,s).filter(
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as f,b as h,e as m,g as x,i as N}from"./chunk-D322LMSA.js";import{c as y}from"./chunk-OBBDKQAG.js";import{f as g}from"./chunk-7S5E7KWT.js";import{extname as S}from"path";var R={".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"};function p(e){return R[S(e).toLowerCase()]??null}function k(e){return S(e).toLowerCase()===".vue"}import{extname as B}from"path";import{parse as $}from"@vue/compiler-sfc";function v(e){let t=$(e),n=t.descriptor.scriptSetup??t.descriptor.script;if(!n||n.src)return null;let s=x(n.lang??null);return s?{body:n.content,startLine:Math.max(0,n.loc.start.line-1),language:s}:null}var b=g("ast-trees",{clearGroups:["whole-project","source-file"]});function _(e,t){if(k(t))return E(e,t);let n=p(t);if(!n)return null;let s=f(e,t);return s?b.get(e,t,s,()=>m(n,s)):null}function E(e,t){let n=f(e,t);return n?b.get(e,t,n,()=>{let s=v(n);if(!s)return null;let r=`
|
|
2
|
+
`.repeat(s.startLine)+s.body;return m(s.language,r)}):null}var O=[".tsx",".jsx"],C=new Set(["useActionState","useCallback","useContext","useDebugValue","useDeferredValue","useEffect","useId","useImperativeHandle","useInsertionEffect","useLayoutEffect","useMemo","useOptimistic","useReducer","useRef","useState","useSyncExternalStore","useTransition"]),J=new Set(["useEffect","useInsertionEffect","useLayoutEffect"]),P=new Set(["useActionState","useOptimistic","useReducer","useRef","useState"]),D=new Set(["useLocation","useNavigate","useParams","useSearchParams","useTranslation"]),V=new Set(["axios","fetch","gql","graphql","mutate","query","request","useMutation","useQuery","useSuspenseQuery"]),q=new Set(["add","apply","cancel","change","clear","close","create","delete","fetch","filter","handle","load","open","refresh","remove","render","reset","save","select","submit","toggle","update"]),I=new Set(["children","className","false","key","null","style","true","undefined"]),Z=new Set(["aria-hidden","className","clipRule","d","fill","fillRule","height","role","stroke","strokeLinecap","strokeLinejoin","strokeWidth","style","viewBox","width","xmlns"]);function Le(e,t={}){let n=y(e,{extensions:O}).filter(r=>!t.scope||r.includes(t.scope)).sort();return(typeof t.scanLimit=="number"&&t.scanLimit>0?n.slice(0,t.scanLimit):n).flatMap(r=>z(e,r)).filter(r=>(t.minJsxTokens===void 0||r.jsxTokens.size>=t.minJsxTokens)&&(t.minBehaviorTokens===void 0||r.behaviorTokens.size>=t.minBehaviorTokens))}function z(e,t){let n=t.replace(/\\/g,"/"),s=H(n);if(!s)return[];let r=_(e,n);if(!r)return[];let o=h(e,n).length;return M(r.rootNode,s).filter(a=>a.kind==="hook"||A(a.bodyNode)).map(a=>{let l=Q(a.bodyNode),u=ne(a.bodyNode,s);return{file:n,name:a.name,kind:a.kind,startLine:a.node.startPosition.row,endLine:a.node.endPosition.row,loc:Math.max(1,a.node.endPosition.row-a.node.startPosition.row+1),fileLines:o,jsxTokens:l.tokens,behaviorTokens:u.tokens,componentNames:c(l.componentNames),nativeTags:c(l.nativeTags),propNames:c(l.propNames),eventNames:c(l.eventNames),hookNames:c(u.hookNames),requestNames:c(u.requestNames),stateNames:c(u.stateNames),effectNames:c(u.effectNames),handlerNames:c(u.handlerNames)}})}function H(e){let t=B(e).toLowerCase();return t!==".tsx"&&t!==".jsx"?null:p(e)}function M(e,t){let n=[],s=new Set,r=o=>{let i=K(o);if(i&&!U(o)){let a=`${i.name}:${i.node.startIndex}:${i.node.endIndex}`;s.has(a)||(s.add(a),n.push(i));return}for(let a of o.namedChildren)r(a)};return(t==="tsx"||t==="javascript")&&r(e),n}function K(e){if(e.type==="function_declaration"){let o=j(e);return!o||!L(o)?null:{name:o,kind:w(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),s=d(t);if(!s||!n||!L(s))return null;let r=W(n);return r?{name:s,kind:w(s),node:e,bodyNode:r}:null}function L(e){return/^[A-Z]/.test(e)||/^use[A-Z0-9_]/.test(e)}function w(e){return/^use[A-Z0-9_]/.test(e)?"hook":"component"}function W(e){if(e.type==="arrow_function"||e.type==="function_expression")return e;if(e.type!=="call_expression")return null;let t=G(e);return t!=="memo"&&t!=="forwardRef"?null:e.namedChildren.find(r=>r.type==="arguments")?.namedChildren.find(r=>r.type==="arrow_function"||r.type==="function_expression")??null}function U(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 j(e){return d(e.childForFieldName("name")??e.namedChild(0))}function G(e){let t=e.childForFieldName("function")??e.namedChild(0);return t?t.text.split(".").pop()??t.text:null}function A(e){return e.type.startsWith("jsx_")?!0:e.namedChildren.some(A)}function Q(e){let t={tokens:new Set,componentNames:new Set,nativeTags:new Set,propNames:new Set,eventNames:new Set},n=s=>{s.type==="jsx_opening_element"||s.type==="jsx_self_closing_element"?X(s,t):s.type==="jsx_expression"?Y(s,t):s.type==="jsx_fragment"&&t.tokens.add("jsx:fragment");for(let r of s.namedChildren)n(r)};return n(e),t}function X(e,t){let n=ee(e),s=!1;if(n){let r=T(n);s=ie(r),s?(t.componentNames.add(r),t.tokens.add(`component:${r}`)):(t.nativeTags.add(r),t.tokens.add(`native:${r}`))}for(let r of e.namedChildren)if(r.type==="jsx_attribute"){let o=te(r);if(!o)continue;let i=T(o);if(i.startsWith("on")&&i.length>2){let a=i.slice(2).replace(/^[A-Z]/,l=>l.toLowerCase());t.eventNames.add(a),t.tokens.add(`event:${a}`)}else Z.has(i)||(t.propNames.add(i),t.tokens.add(`${s?"prop":"native-prop"}:${i}`))}else r.type==="jsx_spread_attribute"&&t.tokens.add("prop:spread")}function Y(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 s of ce(n))I.has(s)||t.tokens.add(`binding:${s}`)}function ee(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 te(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 ne(e,t){let n={tokens:new Set,hookNames:new Set,requestNames:new Set,stateNames:new Set,effectNames:new Set,handlerNames:new Set},s=r=>{if(r.type==="call_expression"){let o=N(r,t);o&&se(o.calleeLeaf,n)}else if(r.type==="variable_declarator")oe(r,n);else if(r.type==="function_declaration"){let o=j(r);o&&F(o,n)}for(let o of r.namedChildren)s(o)};return s(e),n}function se(e,t){/^use[A-Z0-9_]/.test(e)&&(t.hookNames.add(e),!C.has(e)&&!D.has(e)&&t.tokens.add(`hook:${e}`)),C.has(e)&&t.tokens.add(`react-hook:${e}`),J.has(e)&&(t.effectNames.add(e),t.tokens.add(`effect:${e}`)),P.has(e)&&t.tokens.add(`state-hook:${e}`),re(e)&&(t.requestNames.add(e),t.tokens.add(`request:${e}`))}function re(e){if(V.has(e))return!0;let t=/^use([A-Z0-9_].*)$/.exec(e)?.[1];return t?/(Query|Mutation|Fetch|Resource)$/.test(t):!1}function oe(e,t){let n=e.childForFieldName("name")??e.namedChild(0),s=e.childForFieldName("value")??e.namedChild(1);if(n?.type==="array_pattern"&&s?.text.includes("useState")){let o=n.namedChildren.find(a=>d(a)),i=d(o);i&&(t.stateNames.add(i),t.tokens.add(`state:${i}`))}let r=d(n);r&&F(r,t)}function F(e,t){let n=ae(e);!n||!q.has(n)||(t.handlerNames.add(e),t.tokens.add(`handler:${e}`),t.tokens.add(`handler-verb:${n}`))}function ae(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 ie(e){return/^[A-Z]/.test(e)||e.includes(".")}function T(e){return e.replace(/^this\./,"").replace(/\$/g,".")}function d(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 ce(e){let t=[];for(let n of e.matchAll(/\b[A-Za-z_$][\w$]*\b/g)){let s=n[0];t.includes(s)||t.push(s)}return t}function c(e){return[...e].sort()}export{p as a,k as b,v as c,_ as d,Le as e};
|
|
3
|
+
//# sourceMappingURL=chunk-EWC3UK4V.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{d as E,e as D}from"./chunk-MHTDOFV7.js";import{d as _}from"./chunk-3UVJJ6Z7.js";import{a as N,c as P,f as T}from"./chunk-NP5HYVLX.js";import{a as R}from"./chunk-3ZYF3ELZ.js";import{c as S,d as y}from"./chunk-JM72FNGA.js";var A=5;function ne(e,t={}){let{base:i="HEAD",minContainment:r=.7,minCallees:n=3,minSiteCoverage:o=.4,maxHelpers:a=Number.POSITIVE_INFINITY,limit:g=20}=t,c=t.semantic!==!1,p=t.diffPlan??P(e,{base:i}),s={available:p.note!==N,base:i,changedFiles:p.changedFiles,helpersChecked:0,skipped:[],findings:[]};if(!s.available||p.changedFiles.length===0)return s;let v=new R(e),M=new Set(p.changedFiles),q=new Map(p.renamedFiles.map(l=>[l.to,l.from])),f=K(e,v,M,i,q);if(f.length===0)return s;let k=f.slice(0,a);f.length>a&&(s.note=`helper scoring capped at ${a} of ${f.length} new symbols`);let H=E(e,{minCallees:Math.min(3,n),semantic:c}),x=z(H),O=v.calleeMap(k,{semantic:c}),$=k.map(l=>({def:l,callees:D((O.get(l.symbolId)??[]).map(m=>m.symbol))}));for(let{def:l,callees:m}of $){let h=S(l.symbol);if(m.size<n){s.skipped.push({helperShortName:h,helperFile:l.relativePath,reason:`fewer than ${n} meaningful callees \u2014 too small to score`});continue}let w=J(m,x);if(w===0){s.skipped.push({helperShortName:h,helperFile:l.relativePath,reason:"helper callee pattern is all project-wide infrastructure \u2014 too generic to score"});continue}let b=U(e,l.symbolId);if(b.length===0){s.skipped.push({helperShortName:h,helperFile:l.relativePath,reason:"no references yet \u2014 covered by the new-dead check"});continue}s.helpersChecked+=1;let C=j({candidateIndex:x,changed:M,helperCallees:m,helperFile:l.relativePath,helperSymbol:l.symbol,minContainment:r,minSiteCoverage:o,migratedFiles:b});C.length!==0&&(C.sort((u,d)=>L(d.migrationScope)-L(u.migrationScope)||d.containment-u.containment||d.siteCoverage-u.siteCoverage||u.file.localeCompare(d.file)),s.findings.push({helperSymbol:l.symbol,helperShortName:h,helperFile:l.relativePath,helperShape:"specific-callee-cluster",helperCalleeCount:m.size,specificHelperCalleeCount:w,migratedFiles:b.sort(),leftovers:C.slice(0,A)}))}return s.findings.sort((l,m)=>(m.leftovers[0]?.containment??0)-(l.leftovers[0]?.containment??0)||l.helperFile.localeCompare(m.helperFile)),s.findings=s.findings.slice(0,g),s}function z(e){let t=new Map,i=new Map;for(let r of e)for(let n of r.callees){t.set(n,(t.get(n)??0)+1);let o=i.get(n);o||(o=[],i.set(n,o)),o.push(r)}return{candidatesByCallee:i,docFreq:t,ubiquityThreshold:Math.max(8,Math.ceil(Math.sqrt(e.length)))}}function j(e){let t=[],i=B(e.helperSymbol,e.helperFile,e.migratedFiles),r=new Set;for(let n of e.helperCallees)for(let o of e.candidateIndex.candidatesByCallee.get(n)??[])r.add(o);for(let n of r){if(n.symbol===e.helperSymbol||e.changed.has(n.file)||n.callees.has(e.helperSymbol))continue;let o=_(e.helperCallees,n.callees);if(o<e.minContainment)continue;let a=[...e.helperCallees].filter(p=>n.callees.has(p)),g=n.callees.size===0?0:a.length/n.callees.size;if(g<e.minSiteCoverage||!a.some(p=>(e.candidateIndex.docFreq.get(p)??0)<=e.candidateIndex.ubiquityThreshold))continue;let c=V(i,n.symbol,n.file);t.push({symbol:n.symbol,shortName:S(n.symbol),file:n.file,...c,containment:o,siteCoverage:g,uniqueSiteCalleeCount:Math.max(0,n.callees.size-a.length),sharedCallees:a.map(S).sort()})}return t}function L(e){return e==="same-scope"?2:e==="unknown"?1:0}function B(e,t,i){let r=new Set([...I(t),...F(y(e))]);for(let n of i)for(let o of I(n))r.add(o);return r}function V(e,t,i){let r=new Set([...I(i),...F(y(t))]);if(e.size===0||r.size===0)return{migrationScope:"unknown",migrationScopeReasons:["insufficient path/name tokens to infer migration scope"]};let n=[...r].filter(o=>e.has(o)).sort();return n.length>0?{migrationScope:"same-scope",migrationScopeReasons:[`shares migration-scope token(s): ${n.slice(0,5).join(", ")}`]}:{migrationScope:"possible-subtype",migrationScopeReasons:["no path/name tokens shared with the helper or already migrated files"]}}var G=new Set(["app","apps","common","component","components","helper","helpers","index","lib","package","packages","page","pages","route","routes","service","services","shared","spec","src","test","tests","util","utils"]);function I(e){return F(e.replace(/\.[^.]+$/,""))}function F(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(t=>t.length>1&&!G.has(t))}function J(e,t){let i=0;for(let r of e)(t.docFreq.get(r)??0)<=t.ubiquityThreshold&&(i+=1);return i}function K(e,t,i,r,n){let o=new Map;return t.productionCallableDefinitions({requireFunctionLikeSymbol:!0}).filter(a=>{if(!i.has(a.relativePath))return!1;let g=n.get(a.relativePath)??a.relativePath,c=o.get(g);return c===void 0&&(c=T(e.config.projectRoot,r,g),o.set(g,c)),c===null||!new RegExp(`\\b${W(a.leaf)}\\b`).test(c)})}function U(e,t){return e.all(`SELECT DISTINCT ref_d.relative_path
|
|
2
|
+
FROM mentions m
|
|
3
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
4
|
+
JOIN documents ref_d ON c.document_id = ref_d.id
|
|
5
|
+
WHERE m.symbol_id = ?
|
|
6
|
+
AND m.role != 1
|
|
7
|
+
${e.pathExclusionsFor("ref_d")}`,t).map(r=>r.relative_path)}function W(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{ne as a};
|
|
8
|
+
//# sourceMappingURL=chunk-FGCL6NDB.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as u}from"./chunk-3ZYF3ELZ.js";import{a as h}from"./chunk-YTR4CO5S.js";import{o as S}from"./chunk-HVTYSC26.js";import{a as d,b}from"./chunk-MZ7APUFN.js";import{k as y}from"./chunk-3UW7VM4H.js";import{c as m}from"./chunk-JM72FNGA.js";function v(e,o,l={}){let{direction:c="backward",maxDepth:s=3}=l,r=d(e,o);return r?c==="backward"?w(e,r,s,{semantic:l.semantic!==!1}):M(e,r,{semantic:l.semantic!==!1}):null}function w(e,o,l,c){let s=[],r=new Set([o.symbol]),t=[o];for(let n=1;n<=l&&t.length!==0;n++){let i=[];for(let p of t){let g=h(e,p,{semantic:c.semantic});for(let a of g){if(r.has(a.symbol))continue;r.add(a.symbol),s.push({symbol:a.symbol,shortName:m(a.symbol),file:a.file,relationship:n===1?"referenced within definition (callee)":`depth ${n} callee`});let f=b(e,a.symbol);f&&!e.isIgnored(f.relativePath)&&i.push(f)}}t=i}return{symbol:o.symbol,shortName:m(o.symbol),direction:"backward",connectedSymbols:s}}function M(e,o,l){let c=new Set,s=[],r=new u(e);for(let t of S(e,o,{semantic:l.semantic})){if(s.length>=30)break;let n=t.enclosingSymbol??y(r.definitionsForFile(t.file),t.line)?.symbol??null;if(!n||n===o.symbol)continue;let i=b(e,n);!i||e.isIgnored(i.relativePath)||c.has(i.symbol)||(c.add(i.symbol),s.push({symbol:i.symbol,shortName:m(i.symbol),file:i.relativePath,relationship:`references target at ${t.file}:${t.line+1}`}))}return s.sort((t,n)=>t.file.localeCompare(n.file)),{symbol:o.symbol,shortName:m(o.symbol),direction:"forward",connectedSymbols:s}}export{v as a};
|
|
2
|
+
//# sourceMappingURL=chunk-FIB4JPEX.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as y}from"./chunk-B75HZHUP.js";import{a as f}from"./chunk-BGBBVSH4.js";import{g as L}from"./chunk-FUPDW5AC.js";import{x as d}from"./chunk-CRU42NJU.js";import{c as h,d as S,g as x}from"./chunk-3UW7VM4H.js";import{c as b}from"./chunk-JM72FNGA.js";import{a as g}from"./chunk-D322LMSA.js";function F(n,e={}){let{scope:s,minLoc:t=1,limit:i,scanLimit:a}=e,o=e.semantic!==!1,l=M(n,$(n,{scope:s,minLoc:t,scanLimit:a}),{semantic:o}),r=I(l);return i?r.slice(0,i):r}function $(n,e){let s=x(n,{scope:e.scope}).filter(t=>t.isFunctionLike&&!n.isIgnored(t.relativePath)).filter(t=>f(t)>=e.minLoc);return typeof e.scanLimit=="number"&&e.scanLimit>0&&s.sort((t,i)=>f(i)-f(t)||t.relativePath.localeCompare(i.relativePath)),y(s,e.scanLimit)}function M(n,e,s){let t=new Map;for(let i of e){let a=w(n,i,s);if(!a)continue;let o=t.get(a)??[];o.push(v(i)),t.set(a,o)}return t}function v(n){return{symbol:n.symbol,shortName:b(n.symbol),file:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:f(n)}}function I(n){let e=[];for(let[s,t]of n)t.length>=2&&e.push({signature:s,functions:t});return e.sort((s,t)=>{let i=t.functions.length-s.functions.length;if(i!==0)return i;let a=s.functions.reduce((l,r)=>l+r.loc,0);return t.functions.reduce((l,r)=>l+r.loc,0)-a}),e}function w(n,e,s){if(s.semantic){let a=L(n,e);if(a)return a}let t=G(e.documentation),i=t?A(t):null;return i||R(P(n,e.relativePath,e.startLine,e.endLine,e.leaf),e.leaf)}function G(n){return h(S(n))}function P(n,e,s,t,i){let a=g(n,e);if(!a)return null;let o=a.split(/\r?\n/),l=E(o,s,t,i);for(let r of l){let p=Math.min(o.length-1,Math.max(r,r+4)),u="";for(let c=r;c<=p;c+=1){let m=o[c]?.trim();if(m&&(u=u?`${u} ${m}`:m,z(u)))return u}if(u&&u.includes("("))return u}return null}function z(n){let e=n.replace(/\s+/g," ").trim();return!e.includes("(")||d(e)>0?!1:/[;{]$/.test(e)||/\)\s*(?::\s*[^={]+)?\s*(?:=>|=|throws\b|where\b|$)/i.test(e)||/\)\s*As\s+.+$/i.test(e)}function A(n){if(!n||!n.trim())return null;let e=n.replace(/^```\w*\s*/,"").replace(/\s*```$/,"").replace(/^\(method\)\s*/,"").replace(/^\(property\)\s*/,"").replace(/^\(function\)\s*/,"").replace(/^\(class\)\s*/,"").replace(/^\(interface\)\s*/,"").replace(/^\(enum\)\s*/,"").replace(/^\(type alias\)\s*/,"").replace(/^\(const\)\s*/,"").replace(/^\(var\)\s*/,"").trim(),s=e.indexOf("(");return s===-1||(e=e.slice(s),e=e.replace(/\s+/g,"").toLowerCase(),e.length<3)?null:e}function R(n,e){if(!n||!n.trim())return null;let s=n.replace(/\s+/g," ").trim(),t=s.indexOf("(");if(t===-1)return null;let i=s.slice(0,t),o=new RegExp(`\\b${D(e)}\\b`,"i").exec(i);o&&typeof o.index=="number"&&(i=i.slice(0,o.index)),i=i.replace(/\b(public|private|protected|internal|final|static|abstract|sealed|virtual|override|async|suspend|inline|constexpr|consteval|constinit|const|pub|fn|function|def|sub|friend|shared|readonly|new|open|partial|export)\b/gi," ").replace(/\s+/g," ").trim();let l=C(s.slice(t)).replace(/\)\s*=\s*[\s\S]*$/,")").replace(/\s+throws\s+[^={]+$/i,"").replace(/\s+where\s+.+$/i,"").replace(/\s+/g," ").trim();if(!l.startsWith("("))return null;let r=`${i?`${i} `:""}${l}`.replace(/\s+/g,"").toLowerCase();return r.length>=3?r:null}function C(n){let e=0,s=0,t=0,i=0,a=null,o=!1;for(let l=0;l<n.length;l+=1){let r=n[l];if(a){if(o){o=!1;continue}if(r==="\\"){o=!0;continue}r===a&&(a=null);continue}if(r==='"'||r==="'"||r==="`"){a=r;continue}if(r==="(")e+=1;else if(r===")")e=Math.max(0,e-1);else if(r==="[")t+=1;else if(r==="]")t=Math.max(0,t-1);else if(r==="<")i+=1;else if(r===">")i=Math.max(0,i-1);else if(r==="{"){if(e===0&&t===0&&i===0)return n.slice(0,l);s+=1}else if(r==="}")s=Math.max(0,s-1);else if(r==="="&&n[l+1]===">"&&e===0&&s===0&&t===0&&i===0)return n.slice(0,l)}return n}function E(n,e,s,t){let i=D(t),a=new RegExp(`\\b${i}\\b\\s*\\(`,"i"),o=new RegExp(`\\bdef\\s+${i}\\b`,"i"),l=[],r=new Set,p=Math.max(0,Math.min(e,n.length-1)),u=Math.max(p,Math.min(n.length-1,Math.max(s,e+4)));for(let c=p;c<=u;c+=1){let m=n[c]??"";(a.test(m)||o.test(m))&&!r.has(c)&&(r.add(c),l.push(c))}for(let c=0;c<n.length;c+=1){let m=n[c]??"";(a.test(m)||o.test(m))&&!r.has(c)&&(r.add(c),l.push(c))}return l}function D(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{F as a};
|
|
2
|
+
//# sourceMappingURL=chunk-FNRPGGVI.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as te,b as re,c as b,d as se,e as ne,f as oe,g as j,h as ie,i as U,j as ae,k as pe,l as E,m as W,n as T,o as V,p as z,q as S,r as Q,s as J,u as R,v as h,w as M,x as G}from"./chunk-ADKQX2OY.js";import{b as le}from"./chunk-XGGTESMN.js";import{a as ce,b as me,d as C}from"./chunk-HCQ7J2N5.js";import{a as v}from"./chunk-YVQUQIBM.js";import{c as L}from"./chunk-BJ7OHKB5.js";import{basename as ue}from"path";var ke=new Set(["identifier","type_identifier","property_identifier","shorthand_property_identifier","field_identifier"]);function x(t){let r=[],e=0,s=0;for(let n=0;n<t.length;n++){let o=t[n];(o==="{"||o==="["||o==="(")&&e++,(o==="}"||o==="]"||o===")")&&e--,o===","&&e===0&&(r.push(t.slice(s,n)),s=n+1)}return r.push(t.slice(s)),r}function y(t,r){for(let e of t.namedChildren)if(e.type===r)return e;return null}function g(t,r){let e=new Set,s=(n,o)=>{let i=o||r.has(n.type);!i&&ke.has(n.type)&&e.add(n.text);for(let a of n.children)s(a,i)};return s(t.rootNode,!1),e}function P(t,r,e,s,n,o,i){return{importedName:n,localName:o,sourcePath:i??S(t,s,pe(r)),kind:"named",used:h(e,o),usedMembers:[]}}function f(t,r,e,s,n="named",o={}){return{importedName:t,localName:r,sourcePath:e,kind:n,used:s.has(r),usedMembers:[],isTypeOnly:o.isTypeOnly}}function $(t,r,e,s,n="named",o=[],i={}){return{importedName:t,localName:r,sourcePath:e,kind:n,used:s,usedMembers:o,isTypeOnly:i.isTypeOnly}}function D(t,r){return{importedName:t,localName:null,sourcePath:r,kind:"side-effect",used:!0,usedMembers:[]}}function O(t,r,e={}){return{importedName:t,localName:e.localName??null,sourcePath:r,kind:"namespace",used:e.used??!0,usedMembers:e.usedMembers??[],isTypeOnly:e.isTypeOnly}}function N(t,r,e){let s=[];for(let n of t.matchAll(r)){let o=n[0];if(!o||typeof n.index!="number")continue;let i=R(t,n.index,n.index+o.length);for(let a of e(n,i))s.push(a)}return s}function I(t,r,e,s){let n=C(t,r);if(n){let o=e(n);if(o)return o}return s()}function X(t,r,e,s){let n=C(t,r),o=ce(r),i=o?e[o]:void 0;return n&&i?i(n):s()}function de(t,r,e){return I(t,r,s=>we(t,r,s),()=>Ae(t,r,e))}function Ae(t,r,e){return N(e,/^[ \t]*#include\s+[<"]([^">]+)[">]\s*$/gm,(s,n)=>{let o=s[1]?.trim();if(!o)return[];let i=ue(o).replace(/\.[^.]+$/,"");return[$(o,i,z(t,r,o),h(n,i))]})}function we(t,r,e){let s=g(e,new Set(["preproc_include"])),n=[];for(let o of e.rootNode.descendantsOfType("preproc_include")){let i=null;for(let p of o.namedChildren){if(p.type==="system_lib_string"){i=p.text.replace(/^<|>$/g,"");break}if(p.type==="string_literal"){i=p.namedChildren.find(c=>c.type==="string_content")?.text??p.text.replace(/^"|"$/g,"");break}}if(!i)continue;let a=ue(i).replace(/\.[^.]+$/,"");n.push(f(i,a,z(t,r,i),s))}return n}function fe(t,r,e){let s=[];for(let n of e.matchAll(/^[ \t]*import\s+['"]([^'"]+)['"](?:\s+as\s+([A-Za-z_]\w*))?[\s\S]*?;$/gm)){let o=n[1]?.trim(),i=n[2]?.trim()??null,a=n[0];if(!o||!a||typeof n.index!="number")continue;let p=R(e,n.index,n.index+a.length);s.push({importedName:o,localName:i,sourcePath:Q(t,r,o),kind:i?"namespace":"side-effect",used:i?h(p,i):!0,usedMembers:i?M(p,i):[]})}return s}function ge(t,r,e){let s=[];for(let n of e.matchAll(/^[ \t]*export\s+['"]([^'"]+)['"][\s\S]*?;$/gm)){let o=n[1]?.trim();o&&s.push({specifier:o,sourcePath:Q(t,r,o)})}return s}function Se(t,r,e){return X(t,r,{csharp:s=>je(t,r,s),vb:s=>Le(t,r,s)},()=>{let s=ae(r)?/^[ \t]*Imports\s+(.+?)\s*$/gm:/^[ \t]*using\s+(.+?)\s*;$/gm;return N(e,s,(n,o)=>{let i=n[1]?.trim();if(!i)return[];let[a,p]=i.split(/\s*=\s*/),m=!!p,c=(m?p:a)?.trim()??i,l=c.split(".").pop()??c,u=m?a?.trim()??l:l;return[P(t,r,o,c,l,u,S(t,c,j))]})})}function Le(t,r,e){let s=g(e,new Set(["imports_statement"])),n=[];for(let o of e.rootNode.descendantsOfType("imports_statement")){let i=o.namedChildren.filter(u=>u.type==="namespace_name");if(i.length===0)continue;let a=i[i.length-1],p=i.length>1?i[0]:null,m=a.text,c=m.split(".").pop()??m,l=p?.text??c;n.push(f(c,l,S(t,m,j),s,p?"namespace":"named"))}return n}function je(t,r,e){let s=g(e,new Set(["using_directive"])),n=[];for(let o of e.rootNode.descendantsOfType("using_directive")){let i=o.namedChildren;if(i.length===0)continue;let a=null,p;i.length>=2&&i[0].type==="identifier"&&(i[1].type==="qualified_name"||i[1].type==="identifier")?(a=i[0],p=i[1]):p=i[i.length-1];let m=p.text,c=m.split(".").pop()??m,l=a?.text??c;n.push(f(c,l,S(t,m,j),s,a?"namespace":"named"))}return n}var ve=L("vue-non-script-identifiers",{clearGroups:["whole-project","source-file"]});function he(t,r){return ve.get(t,r,()=>{let e=new Set,s=v(t,r);if(!s)return e;let o=s.replace(/<script\b[^>]*>[\s\S]*?<\/script>/g,i=>i.replace(/[^\r\n]/g," ")).replace(/<!--[\s\S]*?-->/g,i=>i.replace(/[^\r\n]/g," ")).replace(/\/\*[\s\S]*?\*\//g,i=>i.replace(/[^\r\n]/g," "));for(let i of o.matchAll(/[A-Za-z_$][\w$]*/g))e.add(i[0]);return e})}function Y(t,r,e){return I(t,r,s=>$e(t,r,s),()=>Me(t,r,e))}function Me(t,r,e){return Qe(e).flatMap(s=>Ge(t,r,s.clause,s.specifier,s.start,s.end,e))}function $e(t,r,e){let s=qe(t,r,e),n=[];for(let o of e.rootNode.descendantsOfType("import_statement"))n.push(...Ue(t,r,e,o,s));return n}function qe(t,r,e){let s=g(e,new Set(["import_statement"]));if(me(r))for(let n of he(t,r))s.add(n);return s}function Ue(t,r,e,s,n){let o=Be(s);if(!o)return[];let i=E(t,r,o),a=y(s,"import_clause");return a?We(e,a,i,n,He(s.text)):[D("*",i)]}function We(t,r,e,s,n){let o=[];for(let i of r.namedChildren)if(i.type==="identifier")o.push(Fe(i.text,e,s,n));else if(i.type==="namespace_import"){let a=Je(t,i,e,s,n);a&&o.push(a)}else i.type==="named_imports"&&o.push(...Xe(i,e,s,n));return o}function Fe(t,r,e,s){return f("default",t,r,e,"default",{isTypeOnly:s})}function Je(t,r,e,s,n){let i=y(r,"identifier")?.text??"";if(!i)return null;let a=ze(t,i);return O("*",e,{localName:i,usedMembers:a,isTypeOnly:n,used:a.length>0||s.has(i)})}function Xe(t,r,e,s){let n=[];for(let o of t.namedChildren){if(o.type!=="import_specifier")continue;let i=o.namedChild(0),a=o.namedChild(1);if(!i)continue;let p=i.text,m=a?.text??p;n.push(f(p,m,r,e,"named",{isTypeOnly:s||Ve(o.text)}))}return n}function Be(t){let r=y(t,"string");if(!r)return null;let e=y(r,"string_fragment");return e?e.text:null}function He(t){return/^\s*import\s+type\b/.test(t)}function Ve(t){return/^\s*type\b/.test(t.trim())}function ze(t,r){let e=new Set;for(let s of t.rootNode.descendantsOfType("member_expression")){let n=s.namedChild(0),o=s.namedChild(1);!n||!o||n.type!=="identifier"||n.text!==r||(o.type==="property_identifier"||o.type==="identifier")&&e.add(o.text)}return[...e]}function Qe(t){let r=[],e=/^[ \t]*import\s+([\s\S]*?)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let n of t.matchAll(e)){let o=n[0],i=n[1],a=n[2];!o||!a||typeof n.index!="number"||r.push({clause:i,specifier:a,start:n.index,end:n.index+o.length})}let s=/^[ \t]*import\s+['"]([^'"]+)['"]\s*;?/gm;for(let n of t.matchAll(s)){let o=n[0],i=n[1];!o||!i||typeof n.index!="number"||r.push({clause:null,specifier:i,start:n.index,end:n.index+o.length})}return r.sort((n,o)=>n.start-o.start)}function Ge(t,r,e,s,n,o,i){let a=E(t,r,s),p=R(i,n,o);return e?Ye(e).map(c=>({...c,sourcePath:a})).map(c=>{if(c.kind==="namespace"){let l=M(p,c.localName);return O(c.importedName,c.sourcePath,{localName:c.localName,usedMembers:l,used:l.length>0||h(p,c.localName),isTypeOnly:c.isTypeOnly})}return c.kind==="side-effect"?D(c.importedName,c.sourcePath):$(c.importedName,c.localName??"",c.sourcePath,c.localName?h(p,c.localName):!1,c.kind,[],{isTypeOnly:c.isTypeOnly})}):[D("*",a)]}function Ye(t){let r=t.trim(),e=/^type\b/.test(r),s=r.replace(/^type\s+/,""),[n,o]=Ke(s),i=[];return n&&i.push(...xe(n,e)),o&&i.push(...xe(o,e)),i}function xe(t,r){let e=t.trim();if(!e)return[];if(e.startsWith("{")){let s=e.slice(1,-1).trim();return s?x(s).map(n=>{let o=n.trim(),i=r||/^type\b/.test(o),a=o.replace(/^type\s+/,""),[p,m]=a.split(/\s+as\s+/);return{importedName:p.trim(),localName:(m??p).trim(),kind:"named",isTypeOnly:i}}):[]}return e.startsWith("* as ")?[{importedName:"*",localName:e.slice(5).trim(),kind:"namespace",isTypeOnly:r}]:[{importedName:"default",localName:e,kind:"default",isTypeOnly:r}]}function Ke(t){let r=0;for(let e=0;e<t.length;e++){let s=t[e];if(s==="{"&&r++,s==="}"&&r--,s===","&&r===0)return[t.slice(0,e).trim(),t.slice(e+1).trim()]}return[t.trim(),null]}function K(t,r,e){let s=C(t,r);return s?nt(t,r,s):Ze(t,r,e)}function Ze(t,r,e){return[...et(t,r,e),...tt(t,r,e),...rt(t,r,e)]}function et(t,r,e){let s=[],n=/^[ \t]*export\s+(?:type\s+)?\{([\s\S]*?)\}\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of e.matchAll(n)){if(typeof o.index!="number")continue;let i=o[1]??"",a=o[2]??"",p=x(i).map(l=>st(l.trim())).filter(l=>!!l),m=q(e,o.index),c=q(e,o.index+o[0].length-1);s.push({kind:"named",sourcePath:E(t,r,a),names:p,startLine:m,endLine:c})}return s}function tt(t,r,e){let s=[],n=/^[ \t]*export\s+\*\s+as\s+(\w+)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of e.matchAll(n)){if(typeof o.index!="number")continue;let i=o[2]??"",a=q(e,o.index),p=q(e,o.index+o[0].length-1);s.push({kind:"star-as",sourcePath:E(t,r,i),names:[],startLine:a,endLine:p})}return s}function rt(t,r,e){let s=[],n=/^[ \t]*export\s+\*\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of e.matchAll(n)){if(typeof o.index!="number")continue;let i=o[1]??"",a=q(e,o.index),p=q(e,o.index+o[0].length-1);s.push({kind:"star",sourcePath:E(t,r,i),names:[],startLine:a,endLine:p})}return s}function st(t){if(!t)return null;let r=t.replace(/^type\s+/,"").trim();if(!r)return null;let e=r.match(/^(\w+)\s+as\s+(\w+)$/);if(e)return e[2]??null;let s=r.match(/^(\w+)$/);return s?s[1]??null:null}function q(t,r){let e=0;for(let s=0;s<r&&s<t.length;s++)t.charCodeAt(s)===10&&e++;return e}function nt(t,r,e){let s=[];for(let n of e.rootNode.descendantsOfType("export_statement")){let o=ot(t,r,n);if(o===void 0)continue;let i=n.startPosition.row,a=n.endPosition.row,p=it(n,o,i,a);s.push(p)}return s}function ot(t,r,e){let s=y(e,"string");if(!s)return;let n=y(s,"string_fragment");if(n)return E(t,r,n.text)}function it(t,r,e,s){let n=y(t,"export_clause");if(n){let i=[];for(let a of n.namedChildren){if(a.type!=="export_specifier")continue;let p=a.namedChild(0),m=a.namedChild(1);p&&i.push((m??p).text)}return{kind:"named",sourcePath:r,names:i,startLine:e,endLine:s}}return y(t,"namespace_export")?{kind:"star-as",sourcePath:r,names:[],startLine:e,endLine:s}:{kind:"star",sourcePath:r,names:[],startLine:e,endLine:s}}function ye(t,r,e){return X(t,r,{java:s=>at(t,r,s),kotlin:s=>pt(t,r,s),scala:s=>ct(t,r,s)},()=>N(e,/^[ \t]*import\s+(?:static\s+)?(.+?)\s*;?$/gm,(s,n)=>{let o=s[1]?.trim();return o?mt(t,r,o,n):[]}))}function at(t,r,e){let s=g(e,new Set(["import_declaration"])),n=[];for(let o of e.rootNode.descendantsOfType("import_declaration")){let i=o.children.some(l=>l.type==="asterisk"),p=o.namedChildren.find(l=>l.type==="scoped_identifier")??o.namedChildren.find(l=>l.type==="identifier");if(!p)continue;let m=p.text;if(i){n.push(O("*",S(t,m,b)));continue}let c=m.split(".").pop()??m;n.push(f(c,c,S(t,m,b),s))}return n}function pt(t,r,e){let s=g(e,new Set(["import_header","import_list"])),n=[];for(let o of e.rootNode.descendantsOfType("import_header")){let i=o.namedChildren.find(d=>d.type==="identifier");if(!i)continue;let a=o.namedChildren.some(d=>d.type==="wildcard_import"),p=o.namedChildren.find(d=>d.type==="import_alias");if(a){n.push(O("*",S(t,i.text,b)));continue}let m=i.text,c=m.split(".").pop()??m,u=p?.namedChild(0)?.text??c;n.push(f(c,u,S(t,m,b),s))}return n}function ct(t,r,e){let s=g(e,new Set(["import_declaration"])),n=[];for(let o of e.rootNode.descendantsOfType("import_declaration")){let i=o.namedChildren.find(l=>l.type==="namespace_selectors"||l.type==="namespace_wildcard"),a=o.namedChildren.filter(l=>l!==i&&(l.type==="identifier"||l.type==="stable_identifier")),p=a.map(l=>l.text).join(".");if(!p)continue;if(i?.type==="namespace_wildcard"){n.push(O("*",S(t,p,b)));continue}if(i?.type==="namespace_selectors"){for(let l of i.namedChildren)if(l.type==="arrow_renamed_identifier"){let[u,d]=l.namedChildren;if(!u)continue;let _=u.text,A=d?.text??_;if(_==="_")continue;n.push(f(_,A,S(t,`${p}.${_}`,b),s))}else if(l.type==="identifier"){let u=l.text;n.push(f(u,u,S(t,`${p}.${u}`,b),s))}continue}let m=a[a.length-1]?.text??p,c=a.slice(0,-1).map(l=>l.text).join(".")||p;n.push(f(m,m,S(t,c&&a.length>1?`${c}.${m}`:p,b),s))}return n}function mt(t,r,e,s){if(e.includes("{")&&e.includes("}")){let n=e.slice(0,e.indexOf("{")).replace(/\.$/,"").trim(),o=e.slice(e.indexOf("{")+1,e.lastIndexOf("}")).trim();return x(o).flatMap(i=>{let a=i.trim();if(!a)return[];let[p,m]=a.includes("=>")?a.split(/\s*=>\s*/):a.split(/\s+as\s+/),c=p?.trim();if(!c||c==="_")return[];let l=(m??c.split(".").pop()??c).trim(),u=c==="_"?n:`${n}.${c}`.replace(/\.\./g,".");return[P(t,r,s,u,c,l)]})}return[P(t,r,s,e,e.split(".").pop()??e,e.split(".").pop()??e)]}function Ie(t,r,e){return I(t,r,s=>lt(t,r,s),()=>N(e,/^[ \t]*use\s+(.+?)\s*;$/gm,(s,n)=>{let o=s[1]?.trim();return o?x(o).flatMap(i=>{let a=i.trim();if(!a)return[];let[p,m]=a.split(/\s+as\s+/i),c=p?.trim()??a,l=c.split("\\").pop()??c,u=(m??l).trim();return[P(t,r,n,c,l,u,S(t,c.replace(/\\/g,"."),U))]}):[]}))}function lt(t,r,e){let s=g(e,new Set(["namespace_use_declaration"])),n=[],o=(i,a,p)=>{n.push(f(a,p,S(t,i.replace(/\\/g,"."),U),s))};for(let i of e.rootNode.descendantsOfType("namespace_use_declaration")){let a=i.namedChildren.find(p=>p.type==="namespace_use_group");if(a){let p=i.namedChildren.find(m=>m.type==="namespace_name")?.text??"";for(let m of a.namedChildren){if(m.type!=="namespace_use_clause")continue;let{importedName:c,localName:l,qualified:u}=Ne(m,p);c&&o(u,c,l)}continue}for(let p of i.namedChildren){if(p.type!=="namespace_use_clause")continue;let{importedName:m,localName:c,qualified:l}=Ne(p,"");m&&o(l,m,c)}}return n}function Ne(t,r){let e=t.namedChildren.find(m=>m.type==="qualified_name"),s=t.namedChildren.filter(m=>m.type==="name"),n="";e?n=e.text:s.length>=1&&(n=s[0].text);let o=e&&s.length>0?s[s.length-1]:null,i=n.split("\\").pop()??n,a=o?.text??i,p=r?`${r}\\${n}`:n;return{importedName:i,localName:a,qualified:p}}function Pe(t,r,e){return I(t,r,s=>ut(t,r,s),()=>ft(e).flatMap(s=>St(t,r,s,e)))}function ut(t,r,e){let s=g(e,new Set(["import_statement","import_from_statement"])),n=[];for(let o of e.rootNode.descendantsOfType("import_statement"))for(let i of o.namedChildren){let a=be(i);if(!a)continue;let p=W(t,r,a.qualifiedName);n.push({importedName:a.qualifiedName,localName:a.localName,sourcePath:p,kind:"namespace",used:s.has(a.localName),usedMembers:[]})}for(let o of e.rootNode.descendantsOfType("import_from_statement")){let i=o.namedChild(0);if(!i)continue;let a=dt(i);if(a===null)continue;let p=W(t,r,a);for(let m=1;m<o.namedChildCount;m+=1){let c=o.namedChild(m);if(c.type==="wildcard_import"){n.push({importedName:"*",localName:null,sourcePath:p,kind:"side-effect",used:!0,usedMembers:[]});continue}let l=be(c);l&&n.push({importedName:l.qualifiedName,localName:l.localName,sourcePath:p,kind:"named",used:s.has(l.localName),usedMembers:[]})}}return n}function be(t){if(t.type==="aliased_import"){let r=t.namedChild(0),e=t.namedChild(1);return!r||!e?null:{qualifiedName:r.text,localName:e.text}}if(t.type==="dotted_name"){let r=t.text;return{qualifiedName:r,localName:r.split(".")[0]??r}}return t.type==="identifier"?{qualifiedName:t.text,localName:t.text}:null}function dt(t){if(t.type==="dotted_name")return t.text;if(t.type==="relative_import"){let r=y(t,"import_prefix")?.text??"",e=y(t,"dotted_name")?.text??"";return`${r}${e}`}return null}function ft(t){let r=t.split(`
|
|
1
|
+
import{a as te,b as re,c as b,d as se,e as ne,f as oe,g as j,h as ie,i as U,j as ae,k as pe,l as E,m as W,n as T,o as V,p as z,q as S,r as Q,s as J,u as R,v as h,w as M,x as G}from"./chunk-CRU42NJU.js";import{b as le}from"./chunk-ERHOS6AW.js";import{a as ce,b as me,d as C}from"./chunk-EWC3UK4V.js";import{a as v}from"./chunk-D322LMSA.js";import{c as L}from"./chunk-7S5E7KWT.js";import{basename as ue}from"path";var ke=new Set(["identifier","type_identifier","property_identifier","shorthand_property_identifier","field_identifier"]);function x(t){let r=[],e=0,s=0;for(let n=0;n<t.length;n++){let o=t[n];(o==="{"||o==="["||o==="(")&&e++,(o==="}"||o==="]"||o===")")&&e--,o===","&&e===0&&(r.push(t.slice(s,n)),s=n+1)}return r.push(t.slice(s)),r}function y(t,r){for(let e of t.namedChildren)if(e.type===r)return e;return null}function g(t,r){let e=new Set,s=(n,o)=>{let i=o||r.has(n.type);!i&&ke.has(n.type)&&e.add(n.text);for(let a of n.children)s(a,i)};return s(t.rootNode,!1),e}function P(t,r,e,s,n,o,i){return{importedName:n,localName:o,sourcePath:i??S(t,s,pe(r)),kind:"named",used:h(e,o),usedMembers:[]}}function f(t,r,e,s,n="named",o={}){return{importedName:t,localName:r,sourcePath:e,kind:n,used:s.has(r),usedMembers:[],isTypeOnly:o.isTypeOnly}}function $(t,r,e,s,n="named",o=[],i={}){return{importedName:t,localName:r,sourcePath:e,kind:n,used:s,usedMembers:o,isTypeOnly:i.isTypeOnly}}function D(t,r){return{importedName:t,localName:null,sourcePath:r,kind:"side-effect",used:!0,usedMembers:[]}}function O(t,r,e={}){return{importedName:t,localName:e.localName??null,sourcePath:r,kind:"namespace",used:e.used??!0,usedMembers:e.usedMembers??[],isTypeOnly:e.isTypeOnly}}function N(t,r,e){let s=[];for(let n of t.matchAll(r)){let o=n[0];if(!o||typeof n.index!="number")continue;let i=R(t,n.index,n.index+o.length);for(let a of e(n,i))s.push(a)}return s}function I(t,r,e,s){let n=C(t,r);if(n){let o=e(n);if(o)return o}return s()}function X(t,r,e,s){let n=C(t,r),o=ce(r),i=o?e[o]:void 0;return n&&i?i(n):s()}function de(t,r,e){return I(t,r,s=>we(t,r,s),()=>Ae(t,r,e))}function Ae(t,r,e){return N(e,/^[ \t]*#include\s+[<"]([^">]+)[">]\s*$/gm,(s,n)=>{let o=s[1]?.trim();if(!o)return[];let i=ue(o).replace(/\.[^.]+$/,"");return[$(o,i,z(t,r,o),h(n,i))]})}function we(t,r,e){let s=g(e,new Set(["preproc_include"])),n=[];for(let o of e.rootNode.descendantsOfType("preproc_include")){let i=null;for(let p of o.namedChildren){if(p.type==="system_lib_string"){i=p.text.replace(/^<|>$/g,"");break}if(p.type==="string_literal"){i=p.namedChildren.find(c=>c.type==="string_content")?.text??p.text.replace(/^"|"$/g,"");break}}if(!i)continue;let a=ue(i).replace(/\.[^.]+$/,"");n.push(f(i,a,z(t,r,i),s))}return n}function fe(t,r,e){let s=[];for(let n of e.matchAll(/^[ \t]*import\s+['"]([^'"]+)['"](?:\s+as\s+([A-Za-z_]\w*))?[\s\S]*?;$/gm)){let o=n[1]?.trim(),i=n[2]?.trim()??null,a=n[0];if(!o||!a||typeof n.index!="number")continue;let p=R(e,n.index,n.index+a.length);s.push({importedName:o,localName:i,sourcePath:Q(t,r,o),kind:i?"namespace":"side-effect",used:i?h(p,i):!0,usedMembers:i?M(p,i):[]})}return s}function ge(t,r,e){let s=[];for(let n of e.matchAll(/^[ \t]*export\s+['"]([^'"]+)['"][\s\S]*?;$/gm)){let o=n[1]?.trim();o&&s.push({specifier:o,sourcePath:Q(t,r,o)})}return s}function Se(t,r,e){return X(t,r,{csharp:s=>je(t,r,s),vb:s=>Le(t,r,s)},()=>{let s=ae(r)?/^[ \t]*Imports\s+(.+?)\s*$/gm:/^[ \t]*using\s+(.+?)\s*;$/gm;return N(e,s,(n,o)=>{let i=n[1]?.trim();if(!i)return[];let[a,p]=i.split(/\s*=\s*/),m=!!p,c=(m?p:a)?.trim()??i,l=c.split(".").pop()??c,u=m?a?.trim()??l:l;return[P(t,r,o,c,l,u,S(t,c,j))]})})}function Le(t,r,e){let s=g(e,new Set(["imports_statement"])),n=[];for(let o of e.rootNode.descendantsOfType("imports_statement")){let i=o.namedChildren.filter(u=>u.type==="namespace_name");if(i.length===0)continue;let a=i[i.length-1],p=i.length>1?i[0]:null,m=a.text,c=m.split(".").pop()??m,l=p?.text??c;n.push(f(c,l,S(t,m,j),s,p?"namespace":"named"))}return n}function je(t,r,e){let s=g(e,new Set(["using_directive"])),n=[];for(let o of e.rootNode.descendantsOfType("using_directive")){let i=o.namedChildren;if(i.length===0)continue;let a=null,p;i.length>=2&&i[0].type==="identifier"&&(i[1].type==="qualified_name"||i[1].type==="identifier")?(a=i[0],p=i[1]):p=i[i.length-1];let m=p.text,c=m.split(".").pop()??m,l=a?.text??c;n.push(f(c,l,S(t,m,j),s,a?"namespace":"named"))}return n}var ve=L("vue-non-script-identifiers",{clearGroups:["whole-project","source-file"]});function he(t,r){return ve.get(t,r,()=>{let e=new Set,s=v(t,r);if(!s)return e;let o=s.replace(/<script\b[^>]*>[\s\S]*?<\/script>/g,i=>i.replace(/[^\r\n]/g," ")).replace(/<!--[\s\S]*?-->/g,i=>i.replace(/[^\r\n]/g," ")).replace(/\/\*[\s\S]*?\*\//g,i=>i.replace(/[^\r\n]/g," "));for(let i of o.matchAll(/[A-Za-z_$][\w$]*/g))e.add(i[0]);return e})}function Y(t,r,e){return I(t,r,s=>$e(t,r,s),()=>Me(t,r,e))}function Me(t,r,e){return Qe(e).flatMap(s=>Ge(t,r,s.clause,s.specifier,s.start,s.end,e))}function $e(t,r,e){let s=qe(t,r,e),n=[];for(let o of e.rootNode.descendantsOfType("import_statement"))n.push(...Ue(t,r,e,o,s));return n}function qe(t,r,e){let s=g(e,new Set(["import_statement"]));if(me(r))for(let n of he(t,r))s.add(n);return s}function Ue(t,r,e,s,n){let o=Be(s);if(!o)return[];let i=E(t,r,o),a=y(s,"import_clause");return a?We(e,a,i,n,He(s.text)):[D("*",i)]}function We(t,r,e,s,n){let o=[];for(let i of r.namedChildren)if(i.type==="identifier")o.push(Fe(i.text,e,s,n));else if(i.type==="namespace_import"){let a=Je(t,i,e,s,n);a&&o.push(a)}else i.type==="named_imports"&&o.push(...Xe(i,e,s,n));return o}function Fe(t,r,e,s){return f("default",t,r,e,"default",{isTypeOnly:s})}function Je(t,r,e,s,n){let i=y(r,"identifier")?.text??"";if(!i)return null;let a=ze(t,i);return O("*",e,{localName:i,usedMembers:a,isTypeOnly:n,used:a.length>0||s.has(i)})}function Xe(t,r,e,s){let n=[];for(let o of t.namedChildren){if(o.type!=="import_specifier")continue;let i=o.namedChild(0),a=o.namedChild(1);if(!i)continue;let p=i.text,m=a?.text??p;n.push(f(p,m,r,e,"named",{isTypeOnly:s||Ve(o.text)}))}return n}function Be(t){let r=y(t,"string");if(!r)return null;let e=y(r,"string_fragment");return e?e.text:null}function He(t){return/^\s*import\s+type\b/.test(t)}function Ve(t){return/^\s*type\b/.test(t.trim())}function ze(t,r){let e=new Set;for(let s of t.rootNode.descendantsOfType("member_expression")){let n=s.namedChild(0),o=s.namedChild(1);!n||!o||n.type!=="identifier"||n.text!==r||(o.type==="property_identifier"||o.type==="identifier")&&e.add(o.text)}return[...e]}function Qe(t){let r=[],e=/^[ \t]*import\s+([\s\S]*?)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let n of t.matchAll(e)){let o=n[0],i=n[1],a=n[2];!o||!a||typeof n.index!="number"||r.push({clause:i,specifier:a,start:n.index,end:n.index+o.length})}let s=/^[ \t]*import\s+['"]([^'"]+)['"]\s*;?/gm;for(let n of t.matchAll(s)){let o=n[0],i=n[1];!o||!i||typeof n.index!="number"||r.push({clause:null,specifier:i,start:n.index,end:n.index+o.length})}return r.sort((n,o)=>n.start-o.start)}function Ge(t,r,e,s,n,o,i){let a=E(t,r,s),p=R(i,n,o);return e?Ye(e).map(c=>({...c,sourcePath:a})).map(c=>{if(c.kind==="namespace"){let l=M(p,c.localName);return O(c.importedName,c.sourcePath,{localName:c.localName,usedMembers:l,used:l.length>0||h(p,c.localName),isTypeOnly:c.isTypeOnly})}return c.kind==="side-effect"?D(c.importedName,c.sourcePath):$(c.importedName,c.localName??"",c.sourcePath,c.localName?h(p,c.localName):!1,c.kind,[],{isTypeOnly:c.isTypeOnly})}):[D("*",a)]}function Ye(t){let r=t.trim(),e=/^type\b/.test(r),s=r.replace(/^type\s+/,""),[n,o]=Ke(s),i=[];return n&&i.push(...xe(n,e)),o&&i.push(...xe(o,e)),i}function xe(t,r){let e=t.trim();if(!e)return[];if(e.startsWith("{")){let s=e.slice(1,-1).trim();return s?x(s).map(n=>{let o=n.trim(),i=r||/^type\b/.test(o),a=o.replace(/^type\s+/,""),[p,m]=a.split(/\s+as\s+/);return{importedName:p.trim(),localName:(m??p).trim(),kind:"named",isTypeOnly:i}}):[]}return e.startsWith("* as ")?[{importedName:"*",localName:e.slice(5).trim(),kind:"namespace",isTypeOnly:r}]:[{importedName:"default",localName:e,kind:"default",isTypeOnly:r}]}function Ke(t){let r=0;for(let e=0;e<t.length;e++){let s=t[e];if(s==="{"&&r++,s==="}"&&r--,s===","&&r===0)return[t.slice(0,e).trim(),t.slice(e+1).trim()]}return[t.trim(),null]}function K(t,r,e){let s=C(t,r);return s?nt(t,r,s):Ze(t,r,e)}function Ze(t,r,e){return[...et(t,r,e),...tt(t,r,e),...rt(t,r,e)]}function et(t,r,e){let s=[],n=/^[ \t]*export\s+(?:type\s+)?\{([\s\S]*?)\}\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of e.matchAll(n)){if(typeof o.index!="number")continue;let i=o[1]??"",a=o[2]??"",p=x(i).map(l=>st(l.trim())).filter(l=>!!l),m=q(e,o.index),c=q(e,o.index+o[0].length-1);s.push({kind:"named",sourcePath:E(t,r,a),names:p,startLine:m,endLine:c})}return s}function tt(t,r,e){let s=[],n=/^[ \t]*export\s+\*\s+as\s+(\w+)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of e.matchAll(n)){if(typeof o.index!="number")continue;let i=o[2]??"",a=q(e,o.index),p=q(e,o.index+o[0].length-1);s.push({kind:"star-as",sourcePath:E(t,r,i),names:[],startLine:a,endLine:p})}return s}function rt(t,r,e){let s=[],n=/^[ \t]*export\s+\*\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of e.matchAll(n)){if(typeof o.index!="number")continue;let i=o[1]??"",a=q(e,o.index),p=q(e,o.index+o[0].length-1);s.push({kind:"star",sourcePath:E(t,r,i),names:[],startLine:a,endLine:p})}return s}function st(t){if(!t)return null;let r=t.replace(/^type\s+/,"").trim();if(!r)return null;let e=r.match(/^(\w+)\s+as\s+(\w+)$/);if(e)return e[2]??null;let s=r.match(/^(\w+)$/);return s?s[1]??null:null}function q(t,r){let e=0;for(let s=0;s<r&&s<t.length;s++)t.charCodeAt(s)===10&&e++;return e}function nt(t,r,e){let s=[];for(let n of e.rootNode.descendantsOfType("export_statement")){let o=ot(t,r,n);if(o===void 0)continue;let i=n.startPosition.row,a=n.endPosition.row,p=it(n,o,i,a);s.push(p)}return s}function ot(t,r,e){let s=y(e,"string");if(!s)return;let n=y(s,"string_fragment");if(n)return E(t,r,n.text)}function it(t,r,e,s){let n=y(t,"export_clause");if(n){let i=[];for(let a of n.namedChildren){if(a.type!=="export_specifier")continue;let p=a.namedChild(0),m=a.namedChild(1);p&&i.push((m??p).text)}return{kind:"named",sourcePath:r,names:i,startLine:e,endLine:s}}return y(t,"namespace_export")?{kind:"star-as",sourcePath:r,names:[],startLine:e,endLine:s}:{kind:"star",sourcePath:r,names:[],startLine:e,endLine:s}}function ye(t,r,e){return X(t,r,{java:s=>at(t,r,s),kotlin:s=>pt(t,r,s),scala:s=>ct(t,r,s)},()=>N(e,/^[ \t]*import\s+(?:static\s+)?(.+?)\s*;?$/gm,(s,n)=>{let o=s[1]?.trim();return o?mt(t,r,o,n):[]}))}function at(t,r,e){let s=g(e,new Set(["import_declaration"])),n=[];for(let o of e.rootNode.descendantsOfType("import_declaration")){let i=o.children.some(l=>l.type==="asterisk"),p=o.namedChildren.find(l=>l.type==="scoped_identifier")??o.namedChildren.find(l=>l.type==="identifier");if(!p)continue;let m=p.text;if(i){n.push(O("*",S(t,m,b)));continue}let c=m.split(".").pop()??m;n.push(f(c,c,S(t,m,b),s))}return n}function pt(t,r,e){let s=g(e,new Set(["import_header","import_list"])),n=[];for(let o of e.rootNode.descendantsOfType("import_header")){let i=o.namedChildren.find(d=>d.type==="identifier");if(!i)continue;let a=o.namedChildren.some(d=>d.type==="wildcard_import"),p=o.namedChildren.find(d=>d.type==="import_alias");if(a){n.push(O("*",S(t,i.text,b)));continue}let m=i.text,c=m.split(".").pop()??m,u=p?.namedChild(0)?.text??c;n.push(f(c,u,S(t,m,b),s))}return n}function ct(t,r,e){let s=g(e,new Set(["import_declaration"])),n=[];for(let o of e.rootNode.descendantsOfType("import_declaration")){let i=o.namedChildren.find(l=>l.type==="namespace_selectors"||l.type==="namespace_wildcard"),a=o.namedChildren.filter(l=>l!==i&&(l.type==="identifier"||l.type==="stable_identifier")),p=a.map(l=>l.text).join(".");if(!p)continue;if(i?.type==="namespace_wildcard"){n.push(O("*",S(t,p,b)));continue}if(i?.type==="namespace_selectors"){for(let l of i.namedChildren)if(l.type==="arrow_renamed_identifier"){let[u,d]=l.namedChildren;if(!u)continue;let _=u.text,A=d?.text??_;if(_==="_")continue;n.push(f(_,A,S(t,`${p}.${_}`,b),s))}else if(l.type==="identifier"){let u=l.text;n.push(f(u,u,S(t,`${p}.${u}`,b),s))}continue}let m=a[a.length-1]?.text??p,c=a.slice(0,-1).map(l=>l.text).join(".")||p;n.push(f(m,m,S(t,c&&a.length>1?`${c}.${m}`:p,b),s))}return n}function mt(t,r,e,s){if(e.includes("{")&&e.includes("}")){let n=e.slice(0,e.indexOf("{")).replace(/\.$/,"").trim(),o=e.slice(e.indexOf("{")+1,e.lastIndexOf("}")).trim();return x(o).flatMap(i=>{let a=i.trim();if(!a)return[];let[p,m]=a.includes("=>")?a.split(/\s*=>\s*/):a.split(/\s+as\s+/),c=p?.trim();if(!c||c==="_")return[];let l=(m??c.split(".").pop()??c).trim(),u=c==="_"?n:`${n}.${c}`.replace(/\.\./g,".");return[P(t,r,s,u,c,l)]})}return[P(t,r,s,e,e.split(".").pop()??e,e.split(".").pop()??e)]}function Ie(t,r,e){return I(t,r,s=>lt(t,r,s),()=>N(e,/^[ \t]*use\s+(.+?)\s*;$/gm,(s,n)=>{let o=s[1]?.trim();return o?x(o).flatMap(i=>{let a=i.trim();if(!a)return[];let[p,m]=a.split(/\s+as\s+/i),c=p?.trim()??a,l=c.split("\\").pop()??c,u=(m??l).trim();return[P(t,r,n,c,l,u,S(t,c.replace(/\\/g,"."),U))]}):[]}))}function lt(t,r,e){let s=g(e,new Set(["namespace_use_declaration"])),n=[],o=(i,a,p)=>{n.push(f(a,p,S(t,i.replace(/\\/g,"."),U),s))};for(let i of e.rootNode.descendantsOfType("namespace_use_declaration")){let a=i.namedChildren.find(p=>p.type==="namespace_use_group");if(a){let p=i.namedChildren.find(m=>m.type==="namespace_name")?.text??"";for(let m of a.namedChildren){if(m.type!=="namespace_use_clause")continue;let{importedName:c,localName:l,qualified:u}=Ne(m,p);c&&o(u,c,l)}continue}for(let p of i.namedChildren){if(p.type!=="namespace_use_clause")continue;let{importedName:m,localName:c,qualified:l}=Ne(p,"");m&&o(l,m,c)}}return n}function Ne(t,r){let e=t.namedChildren.find(m=>m.type==="qualified_name"),s=t.namedChildren.filter(m=>m.type==="name"),n="";e?n=e.text:s.length>=1&&(n=s[0].text);let o=e&&s.length>0?s[s.length-1]:null,i=n.split("\\").pop()??n,a=o?.text??i,p=r?`${r}\\${n}`:n;return{importedName:i,localName:a,qualified:p}}function Pe(t,r,e){return I(t,r,s=>ut(t,r,s),()=>ft(e).flatMap(s=>St(t,r,s,e)))}function ut(t,r,e){let s=g(e,new Set(["import_statement","import_from_statement"])),n=[];for(let o of e.rootNode.descendantsOfType("import_statement"))for(let i of o.namedChildren){let a=be(i);if(!a)continue;let p=W(t,r,a.qualifiedName);n.push({importedName:a.qualifiedName,localName:a.localName,sourcePath:p,kind:"namespace",used:s.has(a.localName),usedMembers:[]})}for(let o of e.rootNode.descendantsOfType("import_from_statement")){let i=o.namedChild(0);if(!i)continue;let a=dt(i);if(a===null)continue;let p=W(t,r,a);for(let m=1;m<o.namedChildCount;m+=1){let c=o.namedChild(m);if(c.type==="wildcard_import"){n.push({importedName:"*",localName:null,sourcePath:p,kind:"side-effect",used:!0,usedMembers:[]});continue}let l=be(c);l&&n.push({importedName:l.qualifiedName,localName:l.localName,sourcePath:p,kind:"named",used:s.has(l.localName),usedMembers:[]})}}return n}function be(t){if(t.type==="aliased_import"){let r=t.namedChild(0),e=t.namedChild(1);return!r||!e?null:{qualifiedName:r.text,localName:e.text}}if(t.type==="dotted_name"){let r=t.text;return{qualifiedName:r,localName:r.split(".")[0]??r}}return t.type==="identifier"?{qualifiedName:t.text,localName:t.text}:null}function dt(t){if(t.type==="dotted_name")return t.text;if(t.type==="relative_import"){let r=y(t,"import_prefix")?.text??"",e=y(t,"dotted_name")?.text??"";return`${r}${e}`}return null}function ft(t){let r=t.split(`
|
|
2
2
|
`),e=[],s=0;for(let n=0;n<r.length;n++){let o=r[n],i=o.trimStart(),a=s;if(s+=o.length+1,!i.startsWith("import ")&&!i.startsWith("from "))continue;let p=o,m=a+o.length,c=G(o);for(;n+1<r.length&&(c>0||p.trimEnd().endsWith("\\"));){n++;let u=r[n];p+=`
|
|
3
3
|
${u}`,m+=1+u.length,c+=G(u),s+=u.length+1}let l=gt(p);l&&e.push({...l,start:a,end:m})}return e}function gt(t){let r=t.replace(/\\\s*\n/g," ").trim();if(r.startsWith("import "))return{kind:"import",module:null,clause:r.slice(7).trim()};let e=r.match(/^from\s+([.\w]+)\s+import\s+([\s\S]+)$/);if(!e)return null;let s=e[2].trim();return s.startsWith("(")&&s.endsWith(")")&&(s=s.slice(1,-1).trim()),{kind:"from",module:e[1],clause:s}}function St(t,r,e,s){let n=R(s,e.start,e.end),o=e.clause.replace(/\n/g," ").trim();if(e.kind==="import")return x(o).flatMap(p=>{let m=p.trim().replace(/,$/,"");if(!m)return[];let[c,l]=m.split(/\s+as\s+/),u=c.trim(),d=(l??u.split(".")[0]??u).trim(),_=W(t,r,u),A=M(n,d);return[{importedName:u,localName:d,sourcePath:_,kind:"namespace",used:h(n,d)||A.length>0,usedMembers:A}]});let i=e.module?W(t,r,e.module):null,a=[];for(let p of x(o)){let m=p.trim().replace(/,$/,"");if(!m)continue;if(m==="*"){a.push({importedName:"*",localName:null,sourcePath:i,kind:"side-effect",used:!0,usedMembers:[]});continue}let[c,l]=m.split(/\s+as\s+/),u=(l??c).trim();a.push({importedName:c.trim(),localName:u,sourcePath:i,kind:"named",used:h(n,u),usedMembers:[]})}return a}import{basename as ht}from"path";function _e(t,r,e){return I(t,r,s=>yt(t,r,s),()=>xt(t,r,e))}function xt(t,r,e){return N(e,/^[ \t]*(require_relative|require)\s+["']([^"']+)["']\s*$/gm,(s,n)=>{let o=s[1],i=s[2];if(!o||!i)return[];let a=o==="require_relative"?V(t,r,i):null;if(a){let p=Ee(i);return[$(p,p,a,h(n,p))]}return[D(i,a)]})}function yt(t,r,e){let s=g(e,new Set([])),n=[],o=new Set(["require","require_relative","load"]);for(let i of e.rootNode.descendantsOfType("call")){let a=i.namedChild(0);if(!a||a.type!=="identifier"||!o.has(a.text))continue;let m=i.namedChildren.find(d=>d.type==="argument_list")?.namedChild(0);if(!m||m.type!=="string")continue;let l=m.namedChildren.find(d=>d.type==="string_content")?.text;if(!l)continue;let u=a.text==="require_relative"?V(t,r,l):null;if(u){let d=Ee(l);n.push(f(d,d,u,s))}else n.push(D(l,u))}return n}function Ee(t){return le(ht(t).replace(/\.[^.]+$/,""),/_/)}function Te(t,r,e){return I(t,r,s=>Nt(t,r,s),()=>N(e,/^[ \t]*use\s+(.+?)\s*;$/gm,(s,n)=>{let o=s[1]?.trim();return o?It(t,r,o,n):[]}))}function Nt(t,r,e){let s=g(e,new Set(["use_declaration"])),n=[];for(let o of e.rootNode.descendantsOfType("use_declaration")){let i=o.namedChild(0);if(i)for(let a of F(i,"")){if(!a.importedName||a.importedName==="*")continue;let p=T(t,r,a.qualifiedName)??T(t,r,a.qualifiedName.split("::").slice(0,-1).join("::"));n.push(f(a.importedName,a.localName,p,s))}}return n}function F(t,r){switch(t.type){case"identifier":case"super":case"self":case"crate":{let e=t.text;return[{qualifiedName:B(r,e),importedName:e,localName:e}]}case"scoped_identifier":{let e=t.text,s=e.split("::").pop()??e;return[{qualifiedName:B(r,e),importedName:s,localName:s}]}case"scoped_use_list":{let e=t.namedChild(0),s=t.namedChild(1);if(!e||!s)return[];let n=B(r,e.text),o=[];for(let i of s.namedChildren)o.push(...F(i,n));return o}case"use_list":{let e=[];for(let s of t.namedChildren)e.push(...F(s,r));return e}case"use_as_clause":{let e=t.namedChild(0),s=t.namedChild(1);if(!e||!s)return[];let n=F(e,r),o=s.text;return n.map(i=>({...i,localName:o}))}case"use_wildcard":{let e=t.namedChild(0),s=e?e.text:"";return[{qualifiedName:B(r,`${s}::*`),importedName:"*",localName:"*"}]}default:return[]}}function B(t,r){return t?r?`${t}::${r}`:t:r}function It(t,r,e,s){let n=e.trim();if(n.includes("{")&&n.includes("}")){let c=n.slice(0,n.indexOf("{")).replace(/::$/,"").trim(),l=n.slice(n.indexOf("{")+1,n.lastIndexOf("}")).trim();return x(l).flatMap(u=>{let d=u.trim();if(!d||d==="self")return[];let[_,A]=d.split(/\s+as\s+/),w=_?.trim();if(!w)return[];let De=(A??w.split("::").pop()??w).trim(),Oe=`${c}::${w}`.replace(/::::/g,"::");return[P(t,r,s,Oe,w.split("::").pop()??w,De,T(t,r,c))]})}let[o,i]=n.split(/\s+as\s+/),a=o?.trim()??n,p=(i??a.split("::").pop()??a).trim(),m=T(t,r,a)??T(t,r,a.split("::").slice(0,-1).join("::"));return[P(t,r,s,a,a.split("::").pop()??a,p,m)]}function Re(t,r,e){let s=C(t,r);if(s)return bt(t,r,s);let n=[];for(let o of e.matchAll(/^[ \t]*pub\s+use\s+(.+?)\s*;$/gm)){let i=o[1]?.trim();i&&n.push(..._t(t,r,i))}return n}function bt(t,r,e){let s=[];for(let n of e.rootNode.descendantsOfType("use_declaration")){if(!Pt(n))continue;let o=n.namedChildren.find(i=>i.type!=="visibility_modifier");if(o)for(let i of F(o,""))i.importedName&&s.push(Z(t,r,i.qualifiedName))}return s}function Pt(t){for(let r of t.children)if(r.type==="visibility_modifier"&&r.text.startsWith("pub"))return!0;return!1}function _t(t,r,e){let s=e.trim();if(s.includes("{")&&s.includes("}")){let n=s.slice(0,s.indexOf("{")).replace(/::$/,"").trim(),o=s.slice(s.indexOf("{")+1,s.lastIndexOf("}")).trim();return x(o).flatMap(i=>{let a=i.trim();if(!a||a==="self")return[];let[p]=a.split(/\s+as\s+/),m=`${n}::${p?.trim()??a}`.replace(/::::/g,"::");return[Z(t,r,m)]})}return[Z(t,r,s)]}function Z(t,r,e){return{specifier:e,sourcePath:T(t,r,e)??T(t,r,e.split("::").slice(0,-1).join("::"))}}function k({language:t,extensions:r,imports:e,parseImports:s}){return{language:t,extensions:r,capabilities:{imports:e},parseImports:s}}function Ce(t,r){let e=r.toLowerCase();for(let s of t)for(let n of s.extensions)if(e.endsWith(n))return s;return null}var Et={language:"javascript",extensions:te,capabilities:{imports:"ast-with-regex-fallback",reExports:"ast-with-regex-fallback"},parseImports:Y,parseReExports:K},Tt=k({language:"python",extensions:re,imports:"ast-with-regex-fallback",parseImports:Pe}),Rt=k({language:"jvm",extensions:b,imports:"ast-dispatch-with-regex-fallback",parseImports:ye}),Ct={language:"rust",extensions:se,capabilities:{imports:"ast-with-regex-fallback",exports:"ast-with-regex-fallback"},parseImports:Te,parseExports:Re},Dt=k({language:"ruby",extensions:ne,imports:"ast-with-regex-fallback",parseImports:_e}),Ot=k({language:"c/cpp",extensions:oe,imports:"ast-with-regex-fallback",parseImports:de}),kt=k({language:"dotnet",extensions:j,imports:"ast-dispatch-with-regex-fallback",parseImports:Se}),At={language:"dart",extensions:ie,capabilities:{imports:"regex-only",exports:"regex-only"},parseImports:fe,parseExports:ge},wt=k({language:"php",extensions:U,imports:"ast-with-regex-fallback",parseImports:Ie}),Lt=[Et,Tt,Rt,Ct,Dt,Ot,kt,At,wt];function H(t){return Ce(Lt,t)}var ee={clearGroups:["whole-project","source-file"]},jt=L("source-imports",ee),vt=L("source-exports",ee),Mt=L("source-reexports",ee);function Zr(t,r){let e=J(r);return Mt.get(t,e,()=>{let s=H(e);if(!s?.parseReExports)return[];let n=v(t,e);return n?s.parseReExports(t,e,n):[]})}function es(t,r){let e=J(r);return jt.get(t,e,()=>{let s=H(e);if(!s)return[];let n=v(t,e);return n?s.parseImports(t,e,n):[]})}function ts(t,r){let e=J(r);return vt.get(t,e,()=>{let s=H(e);if(!s?.parseExports)return[];let n=v(t,e);return n?s.parseExports(t,e,n):[]})}export{Zr as a,es as b,ts as c};
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
4
|
+
//# sourceMappingURL=chunk-FOQHUKNZ.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as S}from"./chunk-O4L4AB3T.js";import{a as g}from"./chunk-GS33KGAY.js";import{a as f}from"./chunk-UMNENNTX.js";import{a as p}from"./chunk-TO54DY4O.js";import{b as y}from"./chunk-MHTDOFV7.js";import{e as h}from"./chunk-DRAZH77R.js";var v=.7,C=.62,R=.45;function H(i,t={}){let{windowCommits:e=100,limit:n=30,scope:a,scanLimit:l}=t,s=h(i);if(!s)return{available:!1,windowCommits:e,findings:[]};if(n<=0)return{available:!0,windowCommits:e,findings:[]};let d=A(i,{limit:n,minSimilarity:t.minSimilarity,scanLimit:l,scope:a,semantic:t.semantic}).map(o=>I(o,s,e)).filter(o=>o!==null);d.sort((o,r)=>(o.kind===r.kind?0:o.kind==="echo"?-1:1)||r.similarity-o.similarity||o.echoFile.localeCompare(r.echoFile)||o.echoSymbol.localeCompare(r.echoSymbol)||o.domain.localeCompare(r.domain));let b=d.slice(0,n).map(x);return{available:!0,windowCommits:e,findings:b,rootCauseGroups:w(b)}}function A(i,t){let e=K(t.limit);return[...F(i,{scope:t.scope,minSimilarity:t.minSimilarity??v,limit:e,scanLimit:t.scanLimit,semantic:t.semantic}),...B(i,{scope:t.scope,minSimilarity:t.minSimilarity??C,limit:e,scanLimit:t.scanLimit}),...L(i,{scope:t.scope,minSimilarity:t.minSimilarity??R,limit:e,scanLimit:t.scanLimit}),...E(i,{scope:t.scope,minSimilarity:t.minSimilarity??C,limit:e,scanLimit:t.scanLimit}),...k(i,{scope:t.scope,minSimilarity:t.minSimilarity??R,limit:e,scanLimit:t.scanLimit})]}function F(i,t){return y(i,{scope:t.scope,minSimilarity:t.minSimilarity,limit:t.limit,crossFileOnly:!0,scanLimit:t.scanLimit,semantic:t.semantic}).map(e=>({domain:"callable",basis:e.similarityBasis??"callees",symbolA:e.shortNameA,fileA:e.fileA,symbolB:e.shortNameB,fileB:e.fileB,similarity:e.similarity,sharedEvidence:e.sharedCallees,sharedCallees:e.sharedCallees}))}function B(i,t){return f(i,{scope:t.scope,minSimilarity:t.minSimilarity,limit:t.limit,scanLimit:t.scanLimit}).filter(e=>e.fileA!==e.fileB).map(e=>({domain:"react-component",basis:"jsx-structure",symbolA:e.componentA,fileA:e.fileA,symbolB:e.componentB,fileB:e.fileB,similarity:e.similarity,sharedEvidence:u(["component",e.sharedComponents],["tag",e.sharedNativeTags],["prop",e.sharedProps],["event",e.sharedEvents],["binding",e.sharedBindings]),sharedCallees:[]}))}function L(i,t){return p(i,{scope:t.scope,minSimilarity:t.minSimilarity,limit:t.limit,scanLimit:t.scanLimit}).filter(e=>e.fileA!==e.fileB).map(e=>({domain:"react-hook",basis:"react-behavior",symbolA:e.componentA,fileA:e.fileA,symbolB:e.componentB,fileB:e.fileB,similarity:e.similarity,sharedEvidence:u(["hook",e.sharedHooks],["react-hook",e.sharedReactHooks],["effect",e.sharedEffects],["state",e.sharedState],["request",e.sharedRequests],["handler",e.sharedHandlers],["action",e.sharedHandlerVerbs]),sharedCallees:[]}))}function E(i,t){return g(i,{scope:t.scope,minSimilarity:t.minSimilarity,limit:t.limit,scanLimit:t.scanLimit}).filter(e=>e.fileA!==e.fileB).map(e=>({domain:"vue-component",basis:"vue-template",symbolA:c(e.fileA),fileA:e.fileA,symbolB:c(e.fileB),fileB:e.fileB,similarity:e.similarity,sharedEvidence:u(["component",e.sharedComponents],["prop",e.sharedProps],["event",e.sharedEvents],["directive",e.sharedDirectives],["slot",e.sharedSlots],["identifier",e.sharedIdentifiers]),sharedCallees:[]}))}function k(i,t){return S(i,{scope:t.scope,minSimilarity:t.minSimilarity,limit:t.limit,scanLimit:t.scanLimit}).filter(e=>e.fileA!==e.fileB).map(e=>({domain:"vue-composable",basis:"vue-behavior",symbolA:c(e.fileA),fileA:e.fileA,symbolB:c(e.fileB),fileB:e.fileB,similarity:e.similarity,sharedEvidence:u(["composable",e.sharedComposables],["store",e.sharedStores],["reactivity",e.sharedReactivity],["lifecycle",e.sharedLifecycle],["request",e.sharedRequests],["function",e.sharedFunctions],["action",e.sharedFunctionVerbs],["binding",e.sharedBindings],["template-event",e.sharedTemplateEvents]),sharedCallees:[]}))}function I(i,t,e){let n=t.get(i.fileA)?.commitsAgo??null,a=t.get(i.fileB)?.commitsAgo??null,l=n!==null&&n<=e,s=a!==null&&a<=e;if(!l&&!s)return null;if(l&&s){let m=(n??0)<=(a??0);return{kind:"twin",domain:i.domain,basis:i.basis,echoSymbol:m?i.symbolA:i.symbolB,echoFile:m?i.fileA:i.fileB,echoAgeCommits:(m?n:a)??0,establishedSymbol:m?i.symbolB:i.symbolA,establishedFile:m?i.fileB:i.fileA,establishedAgeCommits:m?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}return{kind:"echo",domain:i.domain,basis:i.basis,echoSymbol:l?i.symbolA:i.symbolB,echoFile:l?i.fileA:i.fileB,echoAgeCommits:(l?n:a)??0,establishedSymbol:l?i.symbolB:i.symbolA,establishedFile:l?i.fileB:i.fileA,establishedAgeCommits:l?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}function x(i){let t=D(i);return{...i,rootCauseKey:t,groupKey:`recent-duplicate:${t}`}}function D(i){if(i.kind==="echo")return["echo",i.domain,i.basis,i.establishedSymbol].join(":");let t=i.sharedEvidence.slice().sort().join("|"),e=[i.echoSymbol,i.establishedSymbol].sort().join("|");return["twin",i.domain,i.basis,t||e].join(":")}function w(i){let t=new Map;for(let[e,n]of i.entries()){let a=n.rootCauseKey??D(n),l=n.groupKey??`recent-duplicate:${a}`,s=t.get(l);s||(s={groupKey:l,rootCauseKey:a,kind:n.kind,domain:n.domain,basis:n.basis,count:0,maxSimilarity:n.similarity,findingIndexes:[],echoFiles:new Set,establishedFile:n.kind==="echo"?n.establishedFile:void 0,establishedSymbol:n.kind==="echo"?n.establishedSymbol:void 0,relatedFiles:new Set,sharedEvidence:new Set,recommendation:N(n)},t.set(l,s)),s.count+=1,s.maxSimilarity=Math.max(s.maxSimilarity,n.similarity),s.findingIndexes.push(e),s.echoFiles.add(n.echoFile),s.relatedFiles.add(n.echoFile),s.relatedFiles.add(n.establishedFile);for(let m of n.sharedEvidence)s.sharedEvidence.add(m)}return[...t.values()].map(e=>({...e,echoFiles:[...e.echoFiles].sort(),relatedFiles:[...e.relatedFiles].sort(),sharedEvidence:[...e.sharedEvidence].sort().slice(0,16)})).sort((e,n)=>n.count-e.count||n.maxSimilarity-e.maxSimilarity||e.groupKey.localeCompare(n.groupKey))}function N(i){return i.kind==="echo"?"Review the established side once, then migrate or delete every echo in this group.":"Pick one owner for the new twins and consolidate the group before the copies diverge."}function K(i){return Number.isFinite(i)?i*5:Number.POSITIVE_INFINITY}function u(...i){let t=[],e=new Set;for(let[n,a]of i)for(let l of a){let s=`${n}:${l}`;e.has(s)||(e.add(s),t.push(s))}return t}function c(i){return(i.split("/").pop()??i).replace(/\.[^.]+$/,"")}export{H as a};
|
|
2
|
+
//# sourceMappingURL=chunk-FPMVCDIJ.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{l as T}from"./chunk-
|
|
1
|
+
import{l as T}from"./chunk-CRU42NJU.js";import{f as g}from"./chunk-3UW7VM4H.js";import{d as h}from"./chunk-JM72FNGA.js";import{a as k}from"./chunk-64MNV6AB.js";import{a as U,c as W}from"./chunk-7S5E7KWT.js";function p(i,e,t){if(i.has(e))return i.get(e);let n=t();return i.set(e,n),n}import $ from"path";function le(i,e){return i.getReferences().map(t=>{let n=t.getNode();return V(n,e)})}function fe(i){let e=i;return typeof e.findReferences=="function"?e.findReferences():[]}function _(i,e,t,n){let r=[];for(let o of fe(i))for(let s of le(o,n))s.file===e.relativePath&&s.line>=e.startLine&&s.line<=e.endLine||r.push(s);for(let o of t)r.push(o);return N(r)}function B(i,e,t,n){let r=[],o=t?.getStart();for(let s of i.getReferences()){let a=s.getNode();S(n,a.getSourceFile().getFilePath())===e&&(o!==void 0&&a.getStart()===o||r.push({location:V(a,n),node:a}))}return r}function V(i,e){let t=i.getSourceFile(),n=t.getLineAndColumnAtPos(i.getStart());return{file:S(e,t.getFilePath())??t.getBaseName(),line:n.line-1,column:n.column-1}}function z(i,e,t){let n=i.getSourceFile(),r=y(n,i),o=i.getText(),s=new RegExp(`\\b${pe(o)}\\b`,"g"),a=n.getFullText().split(`
|
|
2
2
|
`),l=[];for(let c=0;c<a.length;c++){if(c===r)continue;let d=a[c]??"";s.lastIndex=0;let u;for(;(u=s.exec(d))!==null;)l.push({file:e,line:c,column:u.index})}return N(l.filter(c=>S(t,$.join(t,c.file))===e))}function R(i){for(let e=i;e;e=e.getParent()){let t=e.getKindName();if(t.includes("Type")||t==="InterfaceDeclaration"||t==="TypeAliasDeclaration")return!0;if(t==="CallExpression"||t==="NewExpression"||t==="ExpressionStatement")return!1}return!1}function y(i,e){return i.getLineAndColumnAtPos(e.getStart()).line-1}function N(i){let e=new Set,t=[];for(let n of i){let r=`${n.file}:${n.line}:${n.column}`;e.has(r)||(e.add(r),t.push(n))}return t}function S(i,e){let t=$.relative(i||process.cwd(),e).replace(/\\/g,"/");return!t||t.startsWith("..")?null:t}function pe(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function J(i,e,t,n){let r=de(e,n);return r.size===0?new Map:ue(i,t,r)}function de(i,e){let t=new Map;for(let n of g(i,e)){let r=h(n.symbol)??n.leaf;if(!r)continue;let o=t.get(r);o||(o=[],t.set(r,o)),o.push(n)}return t}function ue(i,e,t){let n=new Map,r=new Map;return e.forEachDescendant(o=>{for(let s of me(i,o)){let a=t.get(s);if(!a)continue;let l=y(e,o);for(let c of a){if(l<c.startLine-1||l>c.endLine+1)continue;let d=Math.abs(l-c.startLine),u=r.get(c.symbolId);u!==void 0&&u<=d||(r.set(c.symbolId,d),n.set(c.symbolId,o))}}}),n}function me(i,e){let t=[],n=r=>{r&&!t.includes(r)&&t.push(r)};if("getNameNode"in e&&typeof e.getNameNode=="function"){let r=e.getNameNode();n(r?.getText())}if("getName"in e&&typeof e.getName=="function"){let r=e.getName();n(r)}return i.Node.isIdentifier(e)&&n(e.getText()),t}var ge=W("ts-definition-leaf-candidates",{clearGroups:["definition-catalog"]});function Y(i,e,t,n){let r=q(i,e),o=K(r.get(n)??[],t);if(o)return o;let s=[];for(let a of r.values())for(let l of a)((l.leaf||h(l.symbol)||"").includes(n)||l.symbol.includes(n))&&s.push(l);return K(s,t)}function X(i,e){let t=new Map;for(let[n,r]of q(i,e)){let o=r[0];o&&t.set(n,o)}return t}function q(i,e){return ge.get(i,e,()=>{let t=new Map;for(let n of g(i,e)){let r=n.leaf||h(n.symbol);if(!r)continue;let o=t.get(r);o||(o=[],t.set(r,o)),o.push({...n,leaf:r})}for(let n of t.values())n.sort((r,o)=>r.startLine-o.startLine||r.endLine-o.endLine||r.symbolId-o.symbolId);return t})}function K(i,e){let t=null,n=Number.POSITIVE_INFINITY;for(let r of i){let o=Math.abs(r.startLine-e);(o<n||o===n&&t&&r.startLine<t.startLine)&&(t=r,n=o)}return t}import ye from"path";var x=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"];function M(i){let e=i.toLowerCase();return x.some(t=>e.endsWith(t))}function G(i,e){let t=new Map,n=r=>M(r)?p(t,r,()=>{let o=ye.join(i.config.projectRoot,r);for(let{project:s}of e){let a=s.getSourceFile(o)??s.addSourceFileAtPathIfExists(o)??null;if(a)return{project:s,sourceFile:a}}return null}):null;return{sourceFile:r=>n(r)?.sourceFile??null,sourceFileMatch:n,indexedTypeScriptLikeDocuments:()=>k(i,{extensions:x})}}import m from"path";import{existsSync as F,readdirSync as he,readFileSync as H}from"fs";function Q(i){let e=m.join(i,"package.json");if(!F(e))return[];let t;try{t=JSON.parse(H(e,"utf8"))}catch{return[]}return(Array.isArray(t.workspaces)?t.workspaces:t.workspaces?.packages??[]).flatMap(r=>Se(i,r)).flatMap(r=>xe(i,r))}function Se(i,e){if(!e||e.startsWith("!")||e.includes("node_modules"))return[];if(!e.includes("*")){let s=m.join(i,e);return F(m.join(s,"package.json"))?[s]:[]}let t=e.indexOf("*"),n=e.slice(0,t).replace(/\/$/,""),r=e.slice(t+1).replace(/^\//,""),o=m.join(i,n||".");if(!F(o))return[];try{return he(o).map(s=>m.join(o,s,r)).filter(s=>F(m.join(s,"package.json")))}catch{return[]}}function xe(i,e){try{let t=JSON.parse(H(m.join(e,"package.json"),"utf8"));if(!t.name)return[];let n=m.relative(i,e).replace(/\\/g,"/");return[{name:t.name,rootRelative:n,sourceRootRelative:`${n}/src`}]}catch{return[]}}function Z(i,e){for(let t of i)if(e===t.name||e.startsWith(`${t.name}/`))return t.name;return null}function ee(i){return[`${i.sourceRootRelative}/index.ts`,`${i.sourceRootRelative}/index.tsx`,`${i.sourceRootRelative}/index.mts`,`${i.sourceRootRelative}/index.cts`]}import{existsSync as I,readFileSync as Ie,readdirSync as be,statSync as De}from"fs";import f from"path";var j=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"];function E(i,e){let n=e?f.dirname(f.join(i,e)):i,r=f.resolve(i);for(;n.startsWith(r);){for(let s of j){let a=f.join(n,s);if(I(a))return a}let o=f.dirname(n);if(o===n)break;n=o}for(let o of j){let s=f.join(i,o);if(I(s))return s}return null}function te(i){let e=i.config.projectRoot,t=new Set(ke(e,i.config.semantic?.typescript?.tsconfigs)),n=k(i,{includeIgnored:!1,extensions:x});for(let r of n){let o=E(e,r);o&&t.add(f.resolve(o))}if(t.size===0){let r=E(e);r&&t.add(f.resolve(r))}return[...t].filter(r=>!ne(e,r)).sort((r,o)=>r.localeCompare(o))}function ke(i,e=[]){let t=new Set;for(let n of e){let r=f.isAbsolute(n)?n:f.join(i,n);I(r)&&t.add(f.resolve(r))}for(let n of Ne(i))for(let r of j){let o=f.join(n,r);I(o)&&t.add(f.resolve(o))}if(t.size===0){let n=E(i);n&&t.add(f.resolve(n))}return[...t].filter(n=>!ne(i,n)).sort((n,r)=>n.localeCompare(r))}function Ne(i){let e=f.join(i,"package.json");if(!I(e))return[];let t;try{t=JSON.parse(Ie(e,"utf8"))}catch{return[]}return(Array.isArray(t.workspaces)?t.workspaces:t.workspaces?.packages??[]).flatMap(r=>Me(i,r))}function Me(i,e){if(!e||e.startsWith("!")||e.includes("node_modules"))return[];if(!e.includes("*")){let s=f.join(i,e);return C(s)?[s]:[]}let t=e.indexOf("*"),n=e.slice(0,t).replace(/\/$/,""),r=e.slice(t+1).replace(/^\//,""),o=f.join(i,n||".");return C(o)?be(o).map(s=>f.join(o,s,r)).filter(C):[]}function C(i){try{return De(i).isDirectory()}catch{return!1}}function ne(i,e){let t=f.relative(i,e).replace(/\\/g,"/");return t.startsWith("..")||t.includes("/node_modules/")||t.startsWith("node_modules/")||t.includes("/dist/")||t.startsWith("dist/")}import{createRequire as Fe}from"module";var ve=Fe(import.meta.url),b;function re(){if(b!==void 0)return b;try{b=ve("ts-morph")}catch{b=null}return b}function ie(i,e){return e.map(t=>({tsconfigPath:t,project:new i.Project({tsConfigFilePath:t,skipFileDependencyResolution:!1})}))}function v(i,e,t){return{language:"typescript",availability:()=>({available:!1,reason:i,tsconfigPath:e,tsconfigPaths:t}),importUsage:()=>[],referencesFor:()=>[],calleesFor:()=>[],signatureFor:()=>null}}function ae(i,e){let t=re();if(!t)return v("ts-morph is not installed");let n=te(i);if(n.length===0)return v("no tsconfig found");try{let r=ie(t,n);return new w(i,t,r)}catch(r){return v(r instanceof Error?r.message:String(r),n[0],n)}}var w=class{constructor(e,t,n){this.db=e;this.tsMorph=t;this.projects=n;this.workspacePackages=Q(e.config.projectRoot),this.sourceFiles=G(e,n)}db;tsMorph;projects;language="typescript";importUsageCache=new Map;referencesCache=new Map;calleesCache=new Map;fileCalleesCache=new Map;signatureCache=new Map;definitionNodeCache=new Map;fileDefinitionNodeCache=new Map;indexedDefinitionLeafCache=new Map;packageImportReferenceIndex=null;packageExportIndex=null;workspacePackages;sourceFiles;availability(){return{available:!0,tsconfigPath:this.projects[0]?.tsconfigPath,tsconfigPaths:this.projects.map(e=>e.tsconfigPath)}}importUsage(e){return p(this.importUsageCache,e,()=>{let t=this.sourceFiles.sourceFile(e);if(!t)return[];let n=[];for(let r of t.getImportDeclarations())for(let o of this.importUsageForDeclaration(e,r))n.push(o);return n})}referencesFor(e){return p(this.referencesCache,e.symbolId,()=>{let t=this.nodeForDefinition(e),n=this.packageImportReferencesForDefinition(e);return t?_(t,e,n,this.db.config.projectRoot):n})}calleesFor(e){return p(this.calleesCache,e.symbolId,()=>p(this.fileCalleesCache,e.relativePath,()=>this.calleeMapForFile(e.relativePath)).get(e.symbolId)??[])}signatureFor(e){return p(this.signatureCache,e.symbolId,()=>{let t=this.nodeForDefinition(e);if(!t||!this.tsMorph.Node.isFunctionDeclaration(t)&&!this.tsMorph.Node.isMethodDeclaration(t)&&!this.tsMorph.Node.isArrowFunction(t)&&!this.tsMorph.Node.isFunctionExpression(t)&&!this.tsMorph.Node.isConstructorDeclaration(t))return null;let n=t.getType().getCallSignatures()[0];if(!n)return null;let r=n.getParameters().map(s=>{let a=s.getDeclarations()[0],l=a?s.getTypeAtLocation(a).getText(a):s.getValueDeclaration()?.getType().getText()??"unknown";return se(l)}),o=n.getReturnType().getText(t);return`(${r.join(",")})=>${se(o)}`})}importUsageForDeclaration(e,t){let n=T(this.db,e,t.getModuleSpecifierValue()),r=oe(t);return t.getImportClause()?.isTypeOnly()?r.map(o=>Pe(e,n,o)):r.map(o=>this.valueImportUsageForEntry(e,n,o))}valueImportUsageForEntry(e,t,n){let r=n.identifier?n.identifier.findReferences():[],o=[];for(let c of r)for(let d of B(c,e,n.identifier,this.db.config.projectRoot))o.push(d);let s=o.some(c=>!R(c.node)),a=o.some(c=>R(c.node)),l=n.isTypeOnly;return{importer:e,sourcePath:t,importedName:n.importedName,localName:n.localName,kind:n.kind,isTypeOnly:l,isUsed:l||o.length>0,isTypeUsed:l||a,isValueUsed:s,references:o.map(c=>c.location)}}packageImportReferencesForDefinition(e){return this.packageImportReferences().get(e.symbolId)??[]}packageImportReferences(){if(this.packageImportReferenceIndex)return this.packageImportReferenceIndex;let e=new Map,t=this.packageExports();for(let n of this.sourceFiles.indexedTypeScriptLikeDocuments())this.addPackageImportReferencesForDocument(e,t,n);for(let[n,r]of e)e.set(n,N(r));return this.packageImportReferenceIndex=e,e}addPackageImportReferencesForDocument(e,t,n){if(this.db.isIgnored(n))return;let r=this.sourceFiles.sourceFileMatch(n);if(r)for(let o of r.sourceFile.getImportDeclarations())this.addPackageImportReferencesForDeclaration(e,t,n,o)}addPackageImportReferencesForDeclaration(e,t,n,r){let o=Z(this.workspacePackages,r.getModuleSpecifierValue());if(!o)return;let s=t.get(o);if(s)for(let a of oe(r)){if(a.kind!=="named"||!a.identifier)continue;let l=s.get(a.importedName);if(!l||l.size===0)continue;let c=z(a.identifier,n,this.db.config.projectRoot);c.length>0&&Ce(e,l,c)}}packageExports(){if(this.packageExportIndex)return this.packageExportIndex;let e=new Map;for(let t of this.workspacePackages){let n=new Map;for(let r of ee(t))this.collectPackageExports(t,r,n,new Set);n.size>0&&e.set(t.name,n)}return this.packageExportIndex=e,e}collectPackageExports(e,t,n,r){if(r.has(t))return;r.add(t);let o=this.sourceFiles.sourceFile(t);if(o)for(let s of o.getExportDeclarations()){let a=s.getModuleSpecifierValue(),l=a?T(this.db,t,a):t;if(!l||!l.startsWith(`${e.sourceRootRelative}/`))continue;let c=s.getNamedExports();if(c.length===0){if(s.isNamespaceExport())continue;this.collectPackageExports(e,l,n,r);continue}for(let d of c){let u=d.getNameNode().getText(),A=d.getAliasNode()?.getText()??u,O=this.indexedDefinitionByLeaf(l,u);if(!O)continue;let D=n.get(A);D||(D=new Set,n.set(A,D)),D.add(O.symbolId)}}}indexedDefinitionByLeaf(e,t){return p(this.indexedDefinitionLeafCache,e,()=>X(this.db,e)).get(t)??null}nodeForDefinition(e){return p(this.definitionNodeCache,e.symbolId,()=>this.definitionNodesForFile(e.relativePath).get(e.symbolId)??null)}definitionNodesForFile(e){return p(this.fileDefinitionNodeCache,e,()=>{let t=this.sourceFiles.sourceFile(e);return t?J(this.tsMorph,this.db,t,e):new Map})}definitionFromSymbol(e){let t=e.getDeclarations();for(let n of t){let r=n.getSourceFile(),o=S(this.db.config.projectRoot,r.getFilePath());if(!o||this.db.isIgnored(o))continue;let s=y(r,n),a=Y(this.db,o,s,e.getName());if(a)return{symbol:a.symbol,file:a.relativePath,line:a.startLine}}return null}calleeMapForFile(e){let t=this.sourceFiles.sourceFile(e);if(!t)return new Map;let n=g(this.db,e).sort((o,s)=>o.startLine-s.startLine||s.endLine-o.endLine);if(n.length===0)return new Map;let r=new Map;t.forEachDescendant(o=>{if(!this.tsMorph.Node.isCallExpression(o)&&!this.tsMorph.Node.isNewExpression(o))return;let s=this.semanticCalleeForCallNode(t,n,o);s&&Te(r,s.callerId,s.target)});for(let[o,s]of r)r.set(o,je(s));return r}semanticCalleeForCallNode(e,t,n){let r=Re(t,y(e,n));if(!r)return null;let o=n.getExpression(),s=o.getSymbol()??o.getType().getSymbol(),a=s?this.definitionFromSymbol(s):null;return a?{callerId:r.symbolId,target:{symbol:a.symbol,file:a.file,line:a.line}}:null}};function oe(i){let e=[],t=i.getDefaultImport();t&&e.push({identifier:t,importedName:"default",localName:t.getText(),kind:"default",isTypeOnly:i.getImportClause()?.isTypeOnly()??!1});let n=i.getNamespaceImport();n&&e.push({identifier:n,importedName:"*",localName:n.getText(),kind:"namespace",isTypeOnly:i.getImportClause()?.isTypeOnly()??!1});for(let r of i.getNamedImports()){let o=r.getNameNode(),a=r.getAliasNode()??(o.getKindName()==="Identifier"?o:null);e.push({identifier:a,importedName:o.getText(),localName:a?.getText()??o.getText(),kind:"named",isTypeOnly:r.isTypeOnly()||(i.getImportClause()?.isTypeOnly()??!1)})}return e.length===0&&e.push({identifier:null,importedName:"*",localName:null,kind:"side-effect",isTypeOnly:!1}),e}function Pe(i,e,t){return{importer:i,sourcePath:e,importedName:t.importedName,localName:t.localName,kind:t.kind,isTypeOnly:!0,isUsed:!0,isTypeUsed:!0,isValueUsed:!1,references:[]}}function Te(i,e,t){let n=i.get(e);n||(n=[],i.set(e,n)),n.push(t)}function Re(i,e){let t=null;for(let n of i)e<n.startLine||e>n.endLine||(!t||n.startLine>=t.startLine)&&(t=n);return t}function Ce(i,e,t){for(let n of e){let r=i.get(n)??[];r.push(...t),i.set(n,r)}}function je(i){let e=new Set,t=[];for(let n of i){let r=`${n.symbol}|${n.file}|${n.line}`;e.has(r)||(e.add(r),t.push(n))}return t}function se(i){return i.replace(/\s+/g," ").replace(/\bimport\("[^"]+"\)\./g,"").trim()}var L=new WeakMap;U({name:"semantic-provider",groups:["semantic-provider"],clearAll:i=>L.delete(i)});function ce(i,e){let t=`${i.config.projectRoot}:typescript-workspace`,n=L.get(i);n||(n=new Map,L.set(i,n));let r=n.get(t);if(r)return r;let o=ae(i,e);return n.set(t,o),o}function kt(i,e){let t=P(i,e);return t?t.importUsage(e):[]}function Ee(i,e){let t=P(i,e.relativePath);return t?t.referencesFor(e):[]}function Nt(i,e){let t=new Map;for(let n of e)for(let r of Ee(i,n)){if(r.file===n.relativePath||i.isIgnored(r.file))continue;let o=t.get(n.symbolId);o||(o=new Set,t.set(n.symbolId,o)),o.add(r.file)}return t}function Mt(i,e){let t=new Map;for(let n of e){let r=P(i,n.relativePath);if(!r)continue;let o=r.calleesFor(n);o.length>0&&t.set(n.symbolId,o)}return t}function Ft(i,e){let t=P(i,e.relativePath);return t?t.signatureFor(e):null}function P(i,e){if(!M(e))return null;let t=ce(i,e);return t.availability().available?t:null}export{M as a,ce as b,kt as c,Ee as d,Nt as e,Mt as f,Ft as g};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-FUPDW5AC.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as p}from"./chunk-B75HZHUP.js";import{a as y}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as p}from"./chunk-B75HZHUP.js";import{a as y}from"./chunk-3ZYF3ELZ.js";import{a as o}from"./chunk-BGBBVSH4.js";import{c as b}from"./chunk-JM72FNGA.js";function P(u,c={}){let{scope:f,minLoc:L=3,scanLimit:l}=c,s=new y(u),r=c.semantic!==!1,t=p(s.productionCallableDefinitions({scope:f,minLoc:L,excludeEntrySurfaces:!0,excludeRustTraitImplMembers:!0,includeSuppressed:!0,sortByLocDesc:typeof l=="number"&&l>0}),l),h=s.crossFileCallerMap(t,{semantic:r}),a=new Set(h.keys());for(let e of s.frameworkReferencedSymbolIds(t))a.add(e);let n=s.symbolsWithNonSelfCallees(t,{additive:!1,semantic:r}),m=t.filter(e=>!a.has(e.symbolId)).filter(e=>!n.has(e.symbolId)),I=s.sourceFallbackCallerFiles(m);for(let e of I.keys())a.add(e);let d=m.filter(e=>!a.has(e.symbolId)),C=s.symbolsWithNonSelfCallees(d,{additive:!0,semantic:r});for(let e of C)n.add(e);return d.filter(e=>!n.has(e.symbolId)).sort((e,i)=>o(i)-o(e)||e.relativePath.localeCompare(i.relativePath)||e.startLine-i.startLine).map(e=>({symbol:e.symbol,shortName:b(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:o(e)}))}export{P as a};
|
|
2
|
+
//# sourceMappingURL=chunk-G3WGZU5Q.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as p}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as p}from"./chunk-PVZMPG5I.js";import{a as c,b as a,c as f}from"./chunk-3UVJJ6Z7.js";import{c as m}from"./chunk-ERHOS6AW.js";function B(e,t={}){let{minSimilarity:n=.62,minTokens:i=8,limit:l=20,scope:d,scanLimit:h,filePattern:g}=t,k=P(e,{scope:d,minTokens:i,scanLimit:h});return p({profiles:k,limit:l,filePattern:g,compare:(o,s)=>v(o,s,n),sort:(o,s)=>s.similarity-o.similarity||o.fileA.localeCompare(s.fileA)||o.fileB.localeCompare(s.fileB)})}function P(e,t){return m(e,{scope:t.scope,minTemplateTokens:t.minTokens,scanLimit:t.scanLimit}).map(n=>({file:n.file,tokens:n.templateTokens,loc:C(n)}))}function C(e){return e.totalLines}function v(e,t,n){let i=c(e.tokens,t.tokens);if(i.size<6||!T(i))return null;let l=f(e.tokens,t.tokens);return l<n?null:{fileA:e.file,fileB:t.file,similarity:l,sharedTokens:u(i),sharedComponents:r(i,"component:"),sharedProps:r(i,"prop:"),sharedEvents:r(i,"event:"),sharedDirectives:r(i,"directive:"),sharedSlots:r(i,"slot:"),sharedIdentifiers:r(i,"id:"),uniqueToA:u(a(e.tokens,t.tokens)).slice(0,25),uniqueToB:u(a(t.tokens,e.tokens)).slice(0,25),locA:e.loc,locB:t.loc}}function T(e){let t=0,n=0;for(let i of e)i.startsWith("component:")&&(t+=1),(i.startsWith("prop:")||i.startsWith("event:")||i.startsWith("directive:")||i.startsWith("slot:"))&&(n+=1);return t>=1||n>=3}function r(e,t){return[...e].filter(n=>n.startsWith(t)).map(n=>n.slice(t.length)).sort()}function u(e){return[...e].sort()}export{B as a};
|
|
2
|
+
//# sourceMappingURL=chunk-GS33KGAY.js.map
|