scip-query 0.17.1 → 0.17.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/CHANGELOG.md +13 -0
- package/dist/{chunk-HZVG4KID.js → chunk-2A7LUMZP.js} +2 -2
- package/dist/{chunk-WENI5ZDR.js → chunk-4H7T7FIM.js} +2 -2
- package/dist/{chunk-V7MX6YUF.js → chunk-4QBRVI7D.js} +2 -2
- package/dist/chunk-4XTPZ5CR.js +9 -0
- package/dist/chunk-6AITNECC.js +928 -0
- package/dist/chunk-6JSTKSZH.js +3 -0
- package/dist/{chunk-2DUWNJKE.js → chunk-7LERNHDG.js} +2 -2
- package/dist/{chunk-75H6GOND.js → chunk-7ROLM67J.js} +2 -2
- package/dist/{chunk-RPPV6Y4K.js → chunk-7VR5TNOI.js} +2 -2
- package/dist/chunk-A2GX3PYV.js +5 -0
- package/dist/{chunk-E5HPTSRD.js → chunk-APCXCRED.js} +2 -2
- package/dist/{chunk-5QSMW5IO.js → chunk-ATC4MEVA.js} +2 -2
- package/dist/chunk-AWYKDRYV.js +2 -0
- package/dist/{chunk-QYBCGCY5.js → chunk-AY44MGWS.js} +2 -2
- package/dist/{chunk-WT34AUWL.js → chunk-BEGHYHOQ.js} +2 -2
- package/dist/{chunk-JYBP5ZIR.js → chunk-BPMBOZAN.js} +2 -2
- package/dist/{chunk-BW4VDICR.js → chunk-C7MBQSIC.js} +2 -2
- package/dist/{chunk-KWQKWY6M.js → chunk-CHJ3QROR.js} +2 -2
- package/dist/{chunk-BBTVIIOI.js → chunk-CVWX24IY.js} +2 -2
- package/dist/chunk-DJI446FQ.js +18 -0
- package/dist/{chunk-CSMPXDYE.js → chunk-ELLPMCWA.js} +2 -2
- package/dist/{chunk-35DURZXI.js → chunk-FVLZB54V.js} +2 -2
- package/dist/{chunk-WGDIA2TU.js → chunk-G6DDSHMD.js} +2 -2
- package/dist/{chunk-OP5JXGDV.js → chunk-IG6X65MG.js} +2 -2
- package/dist/{chunk-KZ2LZBQT.js → chunk-IKMOYFUM.js} +2 -2
- package/dist/{chunk-G4IUQW27.js → chunk-IS7DZ7TB.js} +2 -2
- package/dist/{chunk-HGO3D2JD.js → chunk-J7IMQRCU.js} +2 -2
- package/dist/{chunk-OBPR6E5Z.js → chunk-K4XL4HOK.js} +2 -2
- package/dist/{chunk-W3HSUCRG.js → chunk-K53GNKY3.js} +2 -2
- package/dist/{chunk-5N5ZC566.js → chunk-K65T4TJS.js} +2 -2
- package/dist/{chunk-OC7XDK62.js → chunk-KA7RMBVU.js} +2 -2
- package/dist/{chunk-IKAJI4SI.js → chunk-KJOKTZUE.js} +2 -2
- package/dist/chunk-KSD6IWF4.js +38 -0
- package/dist/{chunk-SQJ72PQW.js → chunk-LEKXKHIQ.js} +4 -4
- package/dist/{chunk-2TM23JYJ.js → chunk-LFPQFRCX.js} +2 -2
- package/dist/{chunk-Y5BOEWAE.js → chunk-LL5NQB5V.js} +2 -2
- package/dist/{chunk-FY6RCFDH.js → chunk-MBVHEPHQ.js} +2 -2
- package/dist/{chunk-SSH2NPYS.js → chunk-MFIA6EIT.js} +2 -2
- package/dist/{chunk-HYRSGWFX.js → chunk-N3JH45WR.js} +2 -2
- package/dist/{chunk-KWMRY4RN.js → chunk-NJD4C5G5.js} +3 -3
- package/dist/{chunk-UKUISUS6.js → chunk-NJTIAQY7.js} +2 -2
- package/dist/{chunk-LG33DNTZ.js → chunk-NX2YAXVQ.js} +2 -2
- package/dist/{chunk-VDHEX6YO.js → chunk-O5A7BTMA.js} +2 -2
- package/dist/{chunk-FZXN37RN.js → chunk-O7NA5FCA.js} +2 -2
- package/dist/{chunk-U3JW5AYG.js → chunk-OINSINYW.js} +2 -2
- package/dist/{chunk-CKRVVBM6.js → chunk-OQFA2SUQ.js} +2 -2
- package/dist/{chunk-DQYG5JHT.js → chunk-OQFPCIXO.js} +2 -2
- package/dist/{chunk-PPAT3XUL.js → chunk-P6FOIU7O.js} +2 -2
- package/dist/{chunk-7H37Z4UO.js → chunk-PQD7P6WB.js} +2 -2
- package/dist/{chunk-Y4BBVPRK.js → chunk-Q4GKL4CC.js} +2 -2
- package/dist/{chunk-IZLWLO4X.js → chunk-ROMKXEUM.js} +2 -2
- package/dist/{chunk-BTYDBDX5.js → chunk-RUV4KHWA.js} +2 -2
- package/dist/{chunk-O56VBJKB.js → chunk-S22ICAWV.js} +2 -2
- package/dist/chunk-SALRDXWM.js +121 -0
- package/dist/{chunk-MON5XXTG.js → chunk-SON6DQNK.js} +2 -2
- package/dist/{chunk-W2I4QAW7.js → chunk-SSGACGAD.js} +2 -2
- package/dist/{chunk-PA2MQKXD.js → chunk-SUYCF4SX.js} +2 -2
- package/dist/chunk-SXDXR5FH.js +2 -0
- package/dist/{chunk-TR7C5HOC.js → chunk-T4P27T6S.js} +2 -2
- package/dist/{chunk-O27267B6.js → chunk-U4G4UYLB.js} +2 -2
- package/dist/{chunk-MBDBNQBW.js → chunk-W7FNZKX5.js} +2 -2
- package/dist/chunk-WD3PAQJT.js +10 -0
- package/dist/{chunk-623AZLTE.js → chunk-XLJORP6N.js} +2 -2
- package/dist/chunk-XTF6ELXT.js +3 -0
- package/dist/{chunk-7Z5UT44B.js → chunk-YMFHC5J2.js} +2 -2
- package/dist/{chunk-HJYHSTCP.js → chunk-YYYERNQL.js} +2 -2
- package/dist/chunk-Z4MCFCGX.js +3 -0
- package/dist/cli.js +3 -1528
- package/dist/command-descriptors-7UUURHWT.js +599 -0
- package/dist/direct-navigation-CVCFER5G.js +3 -0
- package/dist/index.js +1 -1
- package/dist/queries/affected.js +1 -1
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.d.ts +2 -0
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.js +1 -1
- package/dist/queries/decorative-checkers.js +1 -1
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-gate.js +1 -1
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.js +1 -1
- package/dist/queries/duplicate-bodies.js +1 -1
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.js +1 -1
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/locality-candidates.js +1 -1
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.js +1 -1
- package/dist/queries/not-implemented.js +1 -1
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.d.ts +2 -0
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system.js +1 -1
- package/dist/queries/test-quality.js +1 -1
- package/dist/queries/trace.js +1 -1
- package/dist/queries/twin-ab.js +1 -1
- package/dist/queries/twin-drift.js +1 -1
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +1 -1
- package/dist/reindex.js +1 -1
- package/dist/runtime.js +1 -1
- package/dist/watch-server.js +4 -4
- package/docs/COMMAND_REFERENCE.md +3 -0
- package/package.json +1 -1
- package/dist/chunk-2HCWAL42.js +0 -3
- package/dist/chunk-3YEBIYXL.js +0 -38
- package/dist/chunk-6TJERPN3.js +0 -2
- package/dist/chunk-E7BTIEAY.js +0 -2
- package/dist/chunk-EUMETOTD.js +0 -21
- package/dist/chunk-GRHA5NGF.js +0 -2
- package/dist/chunk-IHD2CHMX.js +0 -10
- package/dist/chunk-U267E6YN.js +0 -120
- package/dist/chunk-X566NT42.js +0 -9
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as F,b as A}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as F,b as A}from"./chunk-4QBRVI7D.js";import{a as C}from"./chunk-RUV4KHWA.js";import{a as k}from"./chunk-6JSTKSZH.js";import{d as S}from"./chunk-7XP7ZRSI.js";import{a as y}from"./chunk-TLTLJ4SW.js";import{a as p}from"./chunk-64MNV6AB.js";import{posix as h}from"path";var _=20,G=1,O=new Map([["app","app"],["apps","app"],["component","component"],["components","component"],["composable","composable"],["composables","composable"],["contract","contract"],["contracts","contract"],["domain","domain"],["domains","domain"],["feature","feature"],["features","feature"],["hook","hook"],["hooks","hook"],["lib","library"],["module","module"],["modules","module"],["package","package"],["packages","package"],["page","page"],["pages","page"],["route","route"],["routes","route"],["screen","screen"],["screens","screen"],["service","service"],["services","service"],["shared","shared"],["src","source-root"],["store","state"],["stores","state"],["test","test"],["tests","test"],["util","utility"],["utils","utility"],["view","view"],["views","view"]]),q=new Set(["components","contracts","hooks","lib","services","shared","stores","utils"]),Y=new Set(["access","api","auth","config","db","effect","errors","hooks","lib","middleware","permissions","routes","schemas","servicetasks","services","startup","store","stores","test-utils","repository","repositories","tests","types","ui","utils","workflow","workflows"]);function Ce(e,n={}){let t=L(n.limit,_),i=L(n.minConsumers,G),r=new C(e),s=r.fileDependencyGraph(n.scope),o=ge(p(e,{includeIgnored:!1})),a=pe(e.config.locality?.architecturalBoundarySegments,n.architecturalBoundarySegments);return(n.target?K(e,r,n.target):J(e,n.scope,n.scanLimit)).map(c=>Q(e,r,s,c,n,o,a)).filter(c=>c.consumerFiles.length>=i||n.target).sort(me).slice(0,t)}function K(e,n,t){let i=Z(e,t);if(i)return[I(i)];let r=k(e,t);if(!r)return[];let s=n.definitionsForFile(r.relativePath).find(o=>o.symbolId===r.symbolId);return s?[ee(s)]:[{unit:{kind:"symbol",file:r.relativePath,shortName:S(r.symbol),symbol:r.symbol,startLine:r.startLine,endLine:r.endLine}}]}function J(e,n,t){let i=p(e,{scope:n,includeIgnored:!1}),r=L(t,i.length);return i.slice(0,r).map(s=>I(s))}function Q(e,n,t,i,r,s,o){let a=i.definition?V(e,n,i.definition,r.semantic):X(t,i.unit.file),d=i.definition?a.length>0?"exact":"none":a.length>0?"file-level":"none",f=i.unit.file,c=l(h.dirname(f)),u=te(a),B=ne(c),W=w([...T(c),...u?T(u):[]]),b=ie(i.unit,c,u,a),g=re(b,i.unit,c,u,a,s,o),j=le(i.unit,d,u,a,c,g.whyNoSuggestedHome),z=ue(i.unit,c,u,a,g.suggestedHome,g.whyNoSuggestedHome);return{actionTier:"signal",sourceUnit:i.unit,candidatePath:f,currentDirectory:c,directoryAncestry:B,consumerFiles:a,consumerCoverage:d,nearestCommonOwner:u,boundaryMarkers:W,recommendedTier:b,suggestedHome:g.suggestedHome,destinationConfidence:g.confidence,whyNoSuggestedHome:g.whyNoSuggestedHome,counterevidence:j,reasons:z,recommendation:de(b,g.suggestedHome,d)}}function V(e,n,t,i){let r=A(F(e,n).forDefinitions([t],{semantic:i!==!1,sourceFallback:!0}));return E(r.get(t.symbolId)??[])}function X(e,n){let t=[];for(let[i,r]of e.entries())i!==n&&r.has(n)&&t.push(i);return E(t)}function Z(e,n){let t=y(n),i=p(e,{includeIgnored:!1}),r=i.find(o=>o===t);if(r)return r;let s=i.find(o=>o.endsWith(`/${t}`));return s||(i.find(o=>o.includes(t))??null)}function ee(e){return{definition:e,unit:{kind:"symbol",file:e.relativePath,shortName:S(e.symbol),symbol:e.symbol,startLine:e.startLine,endLine:e.endLine}}}function I(e){return{unit:{kind:"file",file:e,shortName:h.basename(e)}}}function ne(e){if(e===".")return[{path:".",depth:0,markers:[]}];let n=[],t=e.split("/").filter(Boolean);for(let i=0;i<t.length;i+=1){let r=t.slice(0,i+1).join("/");n.push({path:r,depth:i,markers:D(r)})}return n}function T(e){return e==="."?[]:$(e).map(({marker:n,prefix:t})=>`${n}: ${t}`)}function D(e){return w($(e).map(({marker:n})=>n))}function $(e){let n=e.split("/").filter(Boolean),t=[];for(let i=0;i<n.length;i+=1){let r=O.get(n[i]);r&&t.push({marker:r,prefix:n.slice(0,i+1).join("/")})}return t}function te(e){if(e.length===0)return null;let n=e.map(i=>l(h.dirname(i))),t=n[0].split("/").filter(Boolean);for(let i of n.slice(1)){let r=i.split("/").filter(Boolean),s=[],o=Math.min(t.length,r.length);for(let a=0;a<o&&t[a]===r[a];a+=1)s.push(t[a]);t=s}return t.length===0?".":t.join("/")}function ie(e,n,t,i){return t?e.kind==="symbol"&&i.length===1?i[0]===e.file?"same-file":"sibling-folder":t==="."||t==="src"?"repository-level-review":U(t,"package")?"package-level-shared":U(t,"app")?"app-level-shared":N(t,["feature","domain","module"])||N(n,["feature","domain","module"])?"feature-local-shared":"sibling-folder":"no-exact-consumers"}function re(e,n,t,i,r,s,o){let a=oe(e,i);if(a)return m(a);let d=fe(n.file),f=se(e,t,d,r,o);if(f)return f;let c=i;if(l(t)===l(c))return m(`${t} is already the nearest common owner for its consumers.`);let u=ae(c,t,d,o);return u||ce(c,t,d,s,o)}function oe(e,n){return n?e==="no-exact-consumers"||e==="repository-level-review"?"The inferred owner is too broad or unsupported for an exact destination.":null:"No consumer owner could be inferred from the current index."}function se(e,n,t,i,r){if(e==="same-file"){let s=i[0]??null;return s?v(s):m("No same-file consumer path was available.")}if(e==="sibling-folder"&&i.length===1){let s=l(h.dirname(i[0])),o=H(n,t,s,r);return o?m(o):v(s)}return null}function ae(e,n,t,i){return be(e)?P(e,n,t,i,`Nearest shared owner ${e} is outside source root ${t}.`):null}function ce(e,n,t,i,r){if(e===".")return m("The nearest common owner is the repository root.");let s=`${e}/shared`,o=P(s,n,t,r,`Proposed home ${s} is outside source root ${t}.`);return o.confidence==="withheld"||i.has(s)?o:m(`${s} does not exist in the indexed project.`)}function P(e,n,t,i,r){if(!M(e,t))return m(r);let s=H(n,t,e,i);return s?m(s):v(e)}function v(e){return{suggestedHome:e,confidence:"exact",whyNoSuggestedHome:null}}function m(e){return{suggestedHome:null,confidence:"withheld",whyNoSuggestedHome:e}}function le(e,n,t,i,r,s){let o=["Report-only signal; review ownership before moving files."];return n==="none"&&o.push("No consumers were found in the current index."),n==="file-level"&&o.push("File-level import evidence can hide which exported unit is actually used."),(t==="."||t==="src")&&o.push("Nearest common owner is broad, so this is not enough evidence for automatic placement."),i.length===1&&o.push("Only one consumer was found; inlining or same-folder placement may be better than shared extraction."),e.kind==="file"&&o.push("File targets describe module locality, not symbol-level usage."),t&&r.startsWith(`${t}/`)&&o.push("Candidate already lives under the nearest common owner."),s&&o.push(`No exact suggested home: ${s}`),o}function ue(e,n,t,i,r,s){let o=[];return o.push(`${e.shortName} currently lives in ${n}.`),t?o.push(`${i.length} consumer file(s) share ${t} as their nearest common owner.`):o.push("No consumer owner could be inferred from the current index."),r?o.push(`Suggested home is ${r}.`):s&&o.push(`No exact suggested home: ${s}`),o}function de(e,n,t){return e==="no-exact-consumers"?"Review references before moving; no consumers were found.":e==="repository-level-review"?"Keep this as a broad locality signal; the inferred owner is too general for automatic relocation.":n?`Review whether ${t==="exact"?"symbol usage":"module import"} supports moving or extracting toward ${n}.`:"Review ownership manually before changing structure."}function me(e,n){return R(n)-R(e)||e.candidatePath.localeCompare(n.candidatePath)}function R(e){let n=e.consumerFiles.length*10;return e.consumerCoverage==="exact"&&(n+=5),e.suggestedHome&&(n+=3),e.recommendedTier==="repository-level-review"&&(n*=.1),e.recommendedTier==="no-exact-consumers"&&(n*=.05),n}function ge(e){let n=new Set(["."]);for(let t of e){let i=l(h.dirname(t));for(;!n.has(i)&&(n.add(i),i!==".");)i=l(h.dirname(i))}return n}function fe(e){let n=x(e),t=n.indexOf("src");return t>=0?n.slice(0,t+1).join("/"):n.length<=1?".":n[0]}function M(e,n){let t=l(e),i=l(n);return i==="."||t===i||t.startsWith(`${i}/`)}function he(e,n,t){let i=x(e),r=x(n);return(M(e,n)?i.slice(r.length):i).some(o=>t.has(o.toLowerCase()))}function H(e,n,t,i){return l(e)===l(t)||!he(e,n,i)?null:`${e} is a named architectural boundary; an exact move to ${t} needs human design.`}function pe(...e){let n=new Set(Y);for(let t of e)for(let i of t??[]){let r=ye(i);r&&n.add(r)}return n}function ye(e){let n=e.trim().toLowerCase();return n===""?null:n}function U(e,n){return D(e).includes(n)}function N(e,n){let t=D(e);return n.some(i=>t.includes(i))}function be(e){let n=e.split("/").filter(Boolean),t=n[n.length-1];return t?q.has(t):!1}function l(e){let n=y(e);return n===""?".":n}function x(e){let n=y(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 E(e){return w([...e]).sort((n,t)=>n.localeCompare(t))}function w(e){return[...new Set(e)]}export{Ce as a};
|
|
2
|
+
//# sourceMappingURL=chunk-N3JH45WR.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{D as G,F as W,G as Z,k as te,l as ie,m as re,n as $,w as B,x}from"./chunk-
|
|
1
|
+
import{D as G,F as W,G as Z,k as te,l as ie,m as re,n as $,w as B,x}from"./chunk-LEKXKHIQ.js";import{a as J}from"./chunk-JLZUM476.js";import{d as X,g as U,i as z,k as ee,m as ne,q as O,s as P,v as L,w as j,x as F}from"./chunk-M2TRDR25.js";import{existsSync as Re,readFileSync as Ie}from"fs";import{resolve as De}from"path";function Je(n,e){return N(n,e,t=>{let i=t?`AND m.symbol_id IN (${t.map(()=>"?").join(",")})`:"";return n.all(`SELECT
|
|
2
2
|
m.symbol_id,
|
|
3
3
|
d.relative_path,
|
|
4
4
|
COUNT(*) AS ref_count
|
|
@@ -25,5 +25,5 @@ import{D as G,F as W,G as Z,k as te,l as ie,m as re,n as $,w as B,x}from"./chunk
|
|
|
25
25
|
WHERE m.role != 1
|
|
26
26
|
${i}
|
|
27
27
|
${n.pathExclusionsFor("d")}
|
|
28
|
-
ORDER BY d.relative_path, c.start_line`,...t??[])})}function N(n,e,t){if(!e)return t();if(e.length===0)return[];let i=[];for(let r=0;r<e.length;r+=750)i.push(...t(e.slice(r,r+750)));return i}var ve=/^[A-Za-z_][A-Za-z0-9_]*$/,oe=/\bDefault::default\b/g,Me=/^\.\.\s*Default::default\b/;function se(n,e){let t=new Map,i=new Map;for(let r of e){let a=Y(n,r,i);a!==null&&t.set(r.symbolId,a)}return t}function Y(n,e,t=new Map){let i=xe(e.symbol);if(!i)return null;let r=ae(n,[e.symbolId]);if(r.length===0)return null;let a=new RegExp(`(^|[^A-Za-z0-9_])${J(i)}::default\\b`,"g"),o=new RegExp(`(^|[^A-Za-z0-9_])${J(i)}\\s*$`),f=Ce(n,e.symbolId),m=[];for(let S of r){let d=Ee(n,S.relative_path,t);if(d===null)return null;let l=d.split(/\r?\n/),u=0,p=[],b=0;for(let R=S.chunk_start;R<=S.chunk_end&&R<l.length;R+=1){let D=l[R]??"",w=new Set;a.lastIndex=0;let M;for(;M=a.exec(D);)m.push({file:S.relative_path,line:R,column:M.index+M[1].length+i.length+2}),b+=1;for(let c=0;c<D.length;c+=1){let y=Me.exec(D.slice(c));if(y){if(f&&p.includes(u)){let g=c+y[0].lastIndexOf("default");m.push({file:S.relative_path,line:R,column:g}),w.add(g),b+=1}c+=y[0].length-1;continue}let h=D[c];if(h==="{"){let g=o.test(D.slice(0,c));u+=1,g&&p.push(u);continue}if(h==="}")for(u=Math.max(0,u-1);p.length>0&&p[p.length-1]>u;)p.pop()}for(oe.lastIndex=0;M=oe.exec(D);){let c=M.index+9;if(!w.has(c))return null}}if(b===0)return null}return te(m)}function Ce(n,e){return n.get("SELECT 1 AS present FROM mentions WHERE symbol_id = ? AND role = 1 LIMIT 1",e)?.present===1}function xe(n){let e=/impl#\[([^\]]+)\]\[Default\]default\(\)\./.exec(n)?.[1]??null;return!e||!ve.test(e)?null:e}function Ee(n,e,t){if(t.has(e))return t.get(e)??null;let i=n.get("SELECT text FROM documents WHERE relative_path = ?",e),r=typeof i?.text=="string"?i.text:_e(n,e);return t.set(e,r),r}function _e(n,e){let t=De(n.config.projectRoot,e);if(!Re(t))return null;try{return Ie(t,"utf8")}catch{return null}}function ce(n){let e=new Map;for(let t of n){let i=e.get(t.relativePath)??[];i.push(t),e.set(t.relativePath,i)}return e}var Pe="typescript-import-usage-v1",we="typescript-signatures-v1",Q=X("semantic-prefetched-callees",{clearGroups:["whole-project","source-file","semantic-provider"]}),le=j({kind:"semantic-import-usage",invalidation:F("semantic-import-usage"),serialize:n=>JSON.stringify(n),deserialize:he}),ue=j({kind:"semantic-signatures",invalidation:F("semantic-signatures"),serialize:n=>JSON.stringify(n),deserialize:Le}),fe=L({kind:"typescript-import-usage",invalidation:F("typescript-import-usage"),serialize:n=>JSON.stringify(n),deserialize:he}),me=L({kind:"typescript-signatures",invalidation:F("typescript-signatures"),serialize:n=>JSON.stringify(n),deserialize:je});function k(n){let e=new Map,t=new Set;return{capability:(i,r)=>ye(n,i,r),importUsage:i=>Fe(n,i),references:i=>de(n,i),materializeReferences:(i,r)=>ge(n,i,e,t,r),callerMap:i=>Ae(n,i,e,t),calleeMap:i=>He(n,i),signature:i=>Ue(n,i)}}function Te(n,e){if(e.size===0)return;let t=Q.get(n,()=>new Map);for(let[i,r]of e)t.set(i,[...r])}function fn(n,e){if(!Q.has(n))return{hits:[],misses:[...e]};let t=Q.get(n,()=>new Map),i=[],r=[];for(let a of e)t.has(a.symbolId)?i.push({definition:a,callees:t.get(a.symbolId)??[]}):r.push(a);return{hits:i,misses:r}}function mn(n,e){return k(n).importUsage(e)}function Fe(n,e){if(x(e)==="typescript"){let a="fallback",o=0,f=0,m=0,S=0;return P("typescript.import-usage.materialize",()=>{let d=G(n,e,Pe);if(d?.key){o=1;let u=fe.read(n,e,d.key);if(u)return a="hit",f=1,u;m=1;let p=E(n,e);if(!p)return a="unavailable",[];let b=p.importUsage(e);return fe.write(n,e,d.key,b),a="computed",b}S=1;let l=E(n,e);return l?(a="direct-fallback",l.importUsage(e)):(a="unavailable",[])},()=>({state:a,eligible:o,cacheHits:f,cacheMisses:m,fallbacks:S}))}let t=Se(n,"semantic-import-usage",e);if(t){let a=le.read(n,e,t);if(a)return a}let i=E(n,e);if(!i)return[];let r=i.importUsage(e);return t&&le.write(n,e,t,r),r}function pn(n,e){return k(n).references(e)}function de(n,e){let t=Y(n,e);if(t)return t;let i=re(n,e);if(i)return i;let r=E(n,e.relativePath);return r?r.referencesFor(e):[]}function dn(n,e){return k(n).callerMap(e)}function gn(n,e){let t=new Map,i=new Map;for(let r of e){if(x(r.relativePath)==="typescript"){let a=E(n,r.relativePath);if(!a)continue;let o=i.get(a)??[];o.push(r),i.set(a,o);continue}K(n,t,r,de(n,r))}for(let[r,a]of i){let o=Z(n,a),f=o?.references??(r.referencesForDefinitions?r.referencesForDefinitions(a,{exact:!0}):new Map(a.map(m=>[m.symbolId,r.referencesFor(m)])));!o&&O()&&W(n,a,f);for(let m of a)K(n,t,m,f.get(m.symbolId)??[])}return t}function Ae(n,e,t=new Map,i=new Set){let r=new Map,a=ge(n,e,t,i),o=0;return P("semantic.callers.from-references",()=>{for(let f of e)o+=K(n,r,f,t.get(f.symbolId)??[])},()=>({definitions:e.length,materialized:a.definitions,inMemoryHits:a.inMemoryHits,incompleteInMemoryHits:a.incompleteInMemoryHits,resultRows:r.size,callerFiles:o})),r}function ge(n,e,t,i,r={}){let a=z(n),o=[],f=[],m=[],S=0,d=0,l=0,u=0,p=0,b=0,R=0,_=0,D=0,w=0,M=0,c=0,y=[],h=new Map,g=e.filter(s=>x(s.relativePath)==="typescript"&&!t.has(s.symbolId)&&!i.has(s.symbolId)),v=Z(n,g);if(v){D=g.length,w=v.cacheHits,M=v.cacheMisses,c=v.computedFiles;for(let s of g)t.set(s.symbolId,v.references.get(s.symbolId)??[])}if(P("semantic.references.cache-scan",()=>{for(let[s,I]of ce(e)){let T=[];for(let C of I)t.has(C.symbolId)?d+=1:i.has(C.symbolId)?_+=1:T.push(C);if(T.length===0){R+=1;continue}let H=ke(n,a,s);if(!H){for(let C of T)x(C.relativePath)||(S+=1),m.push(C);continue}b+=1;let be=ee(n,s,H);for(let C of T){let V=be.get(C.symbol)??null;if(V!==null){let q=Ne(V);if(q){l+=1,t.set(C.symbolId,q);continue}u+=1}f.push({definition:C,cacheFingerprint:H})}}},()=>({definitions:e.length,skippedUnsupportedLanguage:S,cacheHits:l,parseFailures:u,misses:f.length,unkeyed:m.length,inMemoryHits:d,incompleteInMemoryHits:_,fullyInMemoryFiles:R,cacheReadFiles:b})),f.length>0||m.length>0){y=[...m,...f.map(s=>s.definition)],h=P("semantic.references.compute-misses",()=>{let s=Oe(n,y,r);return p=s.size,s},()=>({definitions:y.length,misses:f.length,unkeyed:m.length,rows:p}));for(let s of y)h.has(s.symbolId)?(t.set(s.symbolId,h.get(s.symbolId)??[]),i.delete(s.symbolId)):i.add(s.symbolId);for(let{definition:s,cacheFingerprint:I}of f)h.has(s.symbolId)&&ye(n,"semantic-references",s.relativePath).available&&o.push({relativePath:s.relativePath,symbol:s.symbol,projectFingerprint:I,payload:JSON.stringify(h.get(s.symbolId)??[])})}return o.length>0&&P("semantic.references.cache-write",()=>ne(n,o),()=>({entries:o.length})),h.size>0&&W(n,y,h),{definitions:e.length,inMemoryHits:d,incompleteInMemoryHits:_,cacheHits:l,misses:f.length,unkeyed:m.length,skippedUnsupportedLanguage:S,parseFailures:u,computed:p,incomplete:i.size,cacheWrites:o.length,fragmentDefinitions:D,fragmentCacheHits:w,fragmentCacheMisses:M,fragmentComputedFiles:c}}function ke(n,e,t){if(!e)return null;let i=x(t);return i==="typescript"?e:i==="rust"?U(JSON.stringify({kind:"semantic-references",language:i,engine:$(n.config.projectRoot),projectFingerprint:e})):null}function Oe(n,e,t={}){let i=O(),r=new Map,a=0,o=0,f=0,m=0,S=0,d=0,l=0,u=0,p=0;return P("semantic.references.provider-loop",()=>{let b=se(n,e),R=ie(n,e),_=new Map,D=t.prefetchCallees?new Map:null,w=[];for(let c of e){let y,h=()=>(y??=E(n,c.relativePath),y);if(D){let I=h();if(I?.referencesAndCalleesForDefinitions){let T=D.get(I);T?T.push(c):D.set(I,[c]),p+=1}}let g=b.get(c.symbolId);if(g){f+=1,m+=g.length,A(r,c.symbolId,g,i,I=>{l+=1,u+=I});continue}let v=R.get(c.symbolId);if(v){S+=1,d+=v.length,A(r,c.symbolId,v,i,I=>{l+=1,u+=I});continue}let s=h();if(!s){i&&(o+=1);continue}if(i&&(a+=1),s.referencesForDefinitions){let I=_.get(s);I?I.push(c):_.set(s,[c])}else w.push({provider:s,definition:c})}let M=new Set;if(D)for(let[c,y]of D){if(!c.referencesAndCalleesForDefinitions)continue;let h=_.get(c)??[],g=c.referencesAndCalleesForDefinitions(h,y);M.add(c),Te(n,g.callees);for(let v of h){if(!g.references.has(v.symbolId))continue;let s=g.references.get(v.symbolId)??[];A(r,v.symbolId,s,i,I=>{l+=1,u+=I})}}for(let[c,y]of _){if(M.has(c))continue;let h=c.referencesForDefinitions(y);for(let g of y){if(!h.has(g.symbolId))continue;let v=h.get(g.symbolId)??[];A(r,g.symbolId,v,i,s=>{l+=1,u+=s})}}for(let{provider:c,definition:y}of w){let h=c.referencesFor(y);A(r,y.symbolId,h,i,g=>{l+=1,u+=g})}return r},()=>({definitions:e.length,providerHits:a,providerMisses:o,rustDefaultFastPathRows:f,rustDefaultFastPathReferences:m,rustScipOccurrenceFastPathRows:S,rustScipOccurrenceFastPathReferences:d,prefetchCalleeDefinitions:p,definitionsWithReferences:l,referenceCount:u,rows:r.size}))}function A(n,e,t,i,r){n.set(e,t),i&&t.length>0&&r(t.length)}function K(n,e,t,i){let r=0;for(let a of i){if(a.file===t.relativePath||n.isIgnored(a.file))continue;let o=e.get(t.symbolId);o||(o=new Set,e.set(t.symbolId,o));let f=o.size;o.add(a.file),o.size!==f&&(r+=1)}return r}function Ne(n){try{return JSON.parse(n)}catch{return null}}function Sn(n,e){return k(n).calleeMap(e)}function He(n,e){let t=O(),i=new Map,r=0,a=0,o=0,f=0;return P("semantic.callees.provider-loop",()=>{let m=new Map,S=[];for(let d of e){let l=E(n,d.relativePath);if(!l){t&&(a+=1);continue}t&&(r+=1);let u=d;if(l.calleesForDefinitions){let p=m.get(l);p?p.push(u):m.set(l,[u])}else S.push({provider:l,definition:u})}for(let[d,l]of m){let u=d.calleesForDefinitions(l);for(let p of l){let b=u.get(p.symbolId)??[];pe(i,p.symbolId,b,t,R=>{o+=1,f+=R})}}for(let{provider:d,definition:l}of S){let u=d.calleesFor(l);pe(i,l.symbolId,u,t,p=>{o+=1,f+=p})}return i},()=>({definitions:e.length,providerHits:r,providerMisses:a,definitionsWithCallees:o,calleeCount:f,rows:i.size}))}function pe(n,e,t,i,r){t.length>0&&(n.set(e,t),i&&r(t.length))}function hn(n,e){return k(n).signature(e)}function Ue(n,e){if(x(e.relativePath)==="typescript"){let o="fallback",f=0,m=0,S=0,d=0;return P("typescript.signature.materialize",()=>{let l=G(n,e.relativePath,we);if(l?.key){f=1;let p=me.read(n,e.relativePath,l.key)??{};if(Object.prototype.hasOwnProperty.call(p,e.symbol))return o="hit",m=1,p[e.symbol]??null;S=1;let b=E(n,e.relativePath);if(!b)return o="unavailable",null;let R=b.signatureFor(e);return me.write(n,e.relativePath,l.key,{...p,[e.symbol]:R}),o="computed",R}d=1;let u=E(n,e.relativePath);return u?(o="direct-fallback",u.signatureFor(e)):(o="unavailable",null)},()=>({state:o,eligible:f,cacheHits:m,cacheMisses:S,fallbacks:d}))}let t=Se(n,"semantic-signatures",e.relativePath),i=ze(e);if(t){let o=ue.read(n,i,t);if(o)return o.signature}let r=E(n,e.relativePath);if(!r)return null;let a=r.signatureFor(e);return t&&ue.write(n,i,t,{signature:a}),a}function Se(n,e,t){let i=z(n);if(!i)return null;let r=x(t);return r!=="rust"?null:U(JSON.stringify({kind:e,language:r,engine:$(n.config.projectRoot),projectFingerprint:i}))}function ze(n){return`${n.relativePath}\0${n.symbol}`}function he(n){try{let e=JSON.parse(n);return Array.isArray(e)?e:null}catch{return null}}function Le(n){try{let e=JSON.parse(n);if(!e||typeof e!="object")return null;let t=e.signature;return t!==null&&typeof t!="string"?null:{signature:t}}catch{return null}}function je(n){try{let e=JSON.parse(n);if(!e||typeof e!="object"||Array.isArray(e))return null;for(let t of Object.values(e))if(t!==null&&typeof t!="string")return null;return e}catch{return null}}function ye(n,e,t){let i=x(t);if(!i)return{slot:e,language:"typescript",available:!1,reason:"semantic evidence is only available for TypeScript or Rust files"};try{return{slot:e,language:i,...B(n,t).availability()}}catch(r){return{slot:e,language:i,available:!1,reason:r instanceof Error?r.message:String(r)}}}function E(n,e){if(!x(e))return null;let t=B(n,e);return t.availability().available?t:null}export{Je as a,$e as b,Be as c,ae as d,ce as e,k as f,fn as g,mn as h,pn as i,dn as j,gn as k,Sn as l,hn as m};
|
|
29
|
-
//# sourceMappingURL=chunk-
|
|
28
|
+
ORDER BY d.relative_path, c.start_line`,...t??[])})}function N(n,e,t){if(!e)return t();if(e.length===0)return[];let i=[];for(let r=0;r<e.length;r+=750)i.push(...t(e.slice(r,r+750)));return i}var ve=/^[A-Za-z_][A-Za-z0-9_]*$/,oe=/\bDefault::default\b/g,Me=/^\.\.\s*Default::default\b/;function se(n,e){let t=new Map,i=new Map;for(let r of e){let a=Y(n,r,i);a!==null&&t.set(r.symbolId,a)}return t}function Y(n,e,t=new Map){let i=xe(e.symbol);if(!i)return null;let r=ae(n,[e.symbolId]);if(r.length===0)return null;let a=new RegExp(`(^|[^A-Za-z0-9_])${J(i)}::default\\b`,"g"),o=new RegExp(`(^|[^A-Za-z0-9_])${J(i)}\\s*$`),f=Ce(n,e.symbolId),m=[];for(let S of r){let d=Ee(n,S.relative_path,t);if(d===null)return null;let l=d.split(/\r?\n/),u=0,p=[],b=0;for(let R=S.chunk_start;R<=S.chunk_end&&R<l.length;R+=1){let D=l[R]??"",w=new Set;a.lastIndex=0;let M;for(;M=a.exec(D);)m.push({file:S.relative_path,line:R,column:M.index+M[1].length+i.length+2}),b+=1;for(let c=0;c<D.length;c+=1){let y=Me.exec(D.slice(c));if(y){if(f&&p.includes(u)){let g=c+y[0].lastIndexOf("default");m.push({file:S.relative_path,line:R,column:g}),w.add(g),b+=1}c+=y[0].length-1;continue}let h=D[c];if(h==="{"){let g=o.test(D.slice(0,c));u+=1,g&&p.push(u);continue}if(h==="}")for(u=Math.max(0,u-1);p.length>0&&p[p.length-1]>u;)p.pop()}for(oe.lastIndex=0;M=oe.exec(D);){let c=M.index+9;if(!w.has(c))return null}}if(b===0)return null}return te(m)}function Ce(n,e){return n.get("SELECT 1 AS present FROM mentions WHERE symbol_id = ? AND role = 1 LIMIT 1",e)?.present===1}function xe(n){let e=/impl#\[([^\]]+)\]\[Default\]default\(\)\./.exec(n)?.[1]??null;return!e||!ve.test(e)?null:e}function Ee(n,e,t){if(t.has(e))return t.get(e)??null;let i=n.get("SELECT text FROM documents WHERE relative_path = ?",e),r=typeof i?.text=="string"?i.text:_e(n,e);return t.set(e,r),r}function _e(n,e){let t=De(n.config.projectRoot,e);if(!Re(t))return null;try{return Ie(t,"utf8")}catch{return null}}function ce(n){let e=new Map;for(let t of n){let i=e.get(t.relativePath)??[];i.push(t),e.set(t.relativePath,i)}return e}var Pe="typescript-import-usage-v1",we="typescript-signatures-v1",Q=X("semantic-prefetched-callees",{clearGroups:["whole-project","source-file","semantic-provider"]}),le=j({kind:"semantic-import-usage",invalidation:F("semantic-import-usage"),serialize:n=>JSON.stringify(n),deserialize:he}),ue=j({kind:"semantic-signatures",invalidation:F("semantic-signatures"),serialize:n=>JSON.stringify(n),deserialize:Le}),fe=L({kind:"typescript-import-usage",invalidation:F("typescript-import-usage"),serialize:n=>JSON.stringify(n),deserialize:he}),me=L({kind:"typescript-signatures",invalidation:F("typescript-signatures"),serialize:n=>JSON.stringify(n),deserialize:je});function k(n){let e=new Map,t=new Set;return{capability:(i,r)=>ye(n,i,r),importUsage:i=>Fe(n,i),references:i=>de(n,i),materializeReferences:(i,r)=>ge(n,i,e,t,r),callerMap:i=>Ae(n,i,e,t),calleeMap:i=>He(n,i),signature:i=>Ue(n,i)}}function Te(n,e){if(e.size===0)return;let t=Q.get(n,()=>new Map);for(let[i,r]of e)t.set(i,[...r])}function fn(n,e){if(!Q.has(n))return{hits:[],misses:[...e]};let t=Q.get(n,()=>new Map),i=[],r=[];for(let a of e)t.has(a.symbolId)?i.push({definition:a,callees:t.get(a.symbolId)??[]}):r.push(a);return{hits:i,misses:r}}function mn(n,e){return k(n).importUsage(e)}function Fe(n,e){if(x(e)==="typescript"){let a="fallback",o=0,f=0,m=0,S=0;return P("typescript.import-usage.materialize",()=>{let d=G(n,e,Pe);if(d?.key){o=1;let u=fe.read(n,e,d.key);if(u)return a="hit",f=1,u;m=1;let p=E(n,e);if(!p)return a="unavailable",[];let b=p.importUsage(e);return fe.write(n,e,d.key,b),a="computed",b}S=1;let l=E(n,e);return l?(a="direct-fallback",l.importUsage(e)):(a="unavailable",[])},()=>({state:a,eligible:o,cacheHits:f,cacheMisses:m,fallbacks:S}))}let t=Se(n,"semantic-import-usage",e);if(t){let a=le.read(n,e,t);if(a)return a}let i=E(n,e);if(!i)return[];let r=i.importUsage(e);return t&&le.write(n,e,t,r),r}function pn(n,e){return k(n).references(e)}function de(n,e){let t=Y(n,e);if(t)return t;let i=re(n,e);if(i)return i;let r=E(n,e.relativePath);return r?r.referencesFor(e):[]}function dn(n,e){return k(n).callerMap(e)}function gn(n,e){let t=new Map,i=new Map;for(let r of e){if(x(r.relativePath)==="typescript"){let a=E(n,r.relativePath);if(!a)continue;let o=i.get(a)??[];o.push(r),i.set(a,o);continue}K(n,t,r,de(n,r))}for(let[r,a]of i){let o=Z(n,a),f=o?.references??(r.referencesForDefinitions?r.referencesForDefinitions(a,{exact:!0}):new Map(a.map(m=>[m.symbolId,r.referencesFor(m)])));!o&&O()&&W(n,a,f);for(let m of a)K(n,t,m,f.get(m.symbolId)??[])}return t}function Ae(n,e,t=new Map,i=new Set){let r=new Map,a=ge(n,e,t,i),o=0;return P("semantic.callers.from-references",()=>{for(let f of e)o+=K(n,r,f,t.get(f.symbolId)??[])},()=>({definitions:e.length,materialized:a.definitions,inMemoryHits:a.inMemoryHits,incompleteInMemoryHits:a.incompleteInMemoryHits,resultRows:r.size,callerFiles:o})),r}function ge(n,e,t,i,r={}){let a=z(n),o=[],f=[],m=[],S=0,d=0,l=0,u=0,p=0,b=0,R=0,_=0,D=0,w=0,M=0,c=0,y=[],h=new Map,g=e.filter(s=>x(s.relativePath)==="typescript"&&!t.has(s.symbolId)&&!i.has(s.symbolId)),v=Z(n,g);if(v){D=g.length,w=v.cacheHits,M=v.cacheMisses,c=v.computedFiles;for(let s of g)t.set(s.symbolId,v.references.get(s.symbolId)??[])}if(P("semantic.references.cache-scan",()=>{for(let[s,I]of ce(e)){let T=[];for(let C of I)t.has(C.symbolId)?d+=1:i.has(C.symbolId)?_+=1:T.push(C);if(T.length===0){R+=1;continue}let H=ke(n,a,s);if(!H){for(let C of T)x(C.relativePath)||(S+=1),m.push(C);continue}b+=1;let be=ee(n,s,H);for(let C of T){let V=be.get(C.symbol)??null;if(V!==null){let q=Ne(V);if(q){l+=1,t.set(C.symbolId,q);continue}u+=1}f.push({definition:C,cacheFingerprint:H})}}},()=>({definitions:e.length,skippedUnsupportedLanguage:S,cacheHits:l,parseFailures:u,misses:f.length,unkeyed:m.length,inMemoryHits:d,incompleteInMemoryHits:_,fullyInMemoryFiles:R,cacheReadFiles:b})),f.length>0||m.length>0){y=[...m,...f.map(s=>s.definition)],h=P("semantic.references.compute-misses",()=>{let s=Oe(n,y,r);return p=s.size,s},()=>({definitions:y.length,misses:f.length,unkeyed:m.length,rows:p}));for(let s of y)h.has(s.symbolId)?(t.set(s.symbolId,h.get(s.symbolId)??[]),i.delete(s.symbolId)):i.add(s.symbolId);for(let{definition:s,cacheFingerprint:I}of f)h.has(s.symbolId)&&ye(n,"semantic-references",s.relativePath).available&&o.push({relativePath:s.relativePath,symbol:s.symbol,projectFingerprint:I,payload:JSON.stringify(h.get(s.symbolId)??[])})}return o.length>0&&P("semantic.references.cache-write",()=>ne(n,o),()=>({entries:o.length})),h.size>0&&W(n,y,h),{definitions:e.length,inMemoryHits:d,incompleteInMemoryHits:_,cacheHits:l,misses:f.length,unkeyed:m.length,skippedUnsupportedLanguage:S,parseFailures:u,computed:p,incomplete:i.size,cacheWrites:o.length,fragmentDefinitions:D,fragmentCacheHits:w,fragmentCacheMisses:M,fragmentComputedFiles:c}}function ke(n,e,t){if(!e)return null;let i=x(t);return i==="typescript"?e:i==="rust"?U(JSON.stringify({kind:"semantic-references",language:i,engine:$(n.config.projectRoot),projectFingerprint:e})):null}function Oe(n,e,t={}){let i=O(),r=new Map,a=0,o=0,f=0,m=0,S=0,d=0,l=0,u=0,p=0;return P("semantic.references.provider-loop",()=>{let b=se(n,e),R=ie(n,e),_=new Map,D=t.prefetchCallees?new Map:null,w=[];for(let c of e){let y,h=()=>(y??=E(n,c.relativePath),y);if(D){let I=h();if(I?.referencesAndCalleesForDefinitions){let T=D.get(I);T?T.push(c):D.set(I,[c]),p+=1}}let g=b.get(c.symbolId);if(g){f+=1,m+=g.length,A(r,c.symbolId,g,i,I=>{l+=1,u+=I});continue}let v=R.get(c.symbolId);if(v){S+=1,d+=v.length,A(r,c.symbolId,v,i,I=>{l+=1,u+=I});continue}let s=h();if(!s){i&&(o+=1);continue}if(i&&(a+=1),s.referencesForDefinitions){let I=_.get(s);I?I.push(c):_.set(s,[c])}else w.push({provider:s,definition:c})}let M=new Set;if(D)for(let[c,y]of D){if(!c.referencesAndCalleesForDefinitions)continue;let h=_.get(c)??[],g=c.referencesAndCalleesForDefinitions(h,y);M.add(c),Te(n,g.callees);for(let v of h){if(!g.references.has(v.symbolId))continue;let s=g.references.get(v.symbolId)??[];A(r,v.symbolId,s,i,I=>{l+=1,u+=I})}}for(let[c,y]of _){if(M.has(c))continue;let h=c.referencesForDefinitions(y);for(let g of y){if(!h.has(g.symbolId))continue;let v=h.get(g.symbolId)??[];A(r,g.symbolId,v,i,s=>{l+=1,u+=s})}}for(let{provider:c,definition:y}of w){let h=c.referencesFor(y);A(r,y.symbolId,h,i,g=>{l+=1,u+=g})}return r},()=>({definitions:e.length,providerHits:a,providerMisses:o,rustDefaultFastPathRows:f,rustDefaultFastPathReferences:m,rustScipOccurrenceFastPathRows:S,rustScipOccurrenceFastPathReferences:d,prefetchCalleeDefinitions:p,definitionsWithReferences:l,referenceCount:u,rows:r.size}))}function A(n,e,t,i,r){n.set(e,t),i&&t.length>0&&r(t.length)}function K(n,e,t,i){let r=0;for(let a of i){if(a.file===t.relativePath||n.isIgnored(a.file))continue;let o=e.get(t.symbolId);o||(o=new Set,e.set(t.symbolId,o));let f=o.size;o.add(a.file),o.size!==f&&(r+=1)}return r}function Ne(n){try{return JSON.parse(n)}catch{return null}}function Sn(n,e){return k(n).calleeMap(e)}function He(n,e){let t=O(),i=new Map,r=0,a=0,o=0,f=0;return P("semantic.callees.provider-loop",()=>{let m=new Map,S=[];for(let d of e){let l=E(n,d.relativePath);if(!l){t&&(a+=1);continue}t&&(r+=1);let u=d;if(l.calleesForDefinitions){let p=m.get(l);p?p.push(u):m.set(l,[u])}else S.push({provider:l,definition:u})}for(let[d,l]of m){let u=d.calleesForDefinitions(l);for(let p of l){let b=u.get(p.symbolId)??[];pe(i,p.symbolId,b,t,R=>{o+=1,f+=R})}}for(let{provider:d,definition:l}of S){let u=d.calleesFor(l);pe(i,l.symbolId,u,t,p=>{o+=1,f+=p})}return i},()=>({definitions:e.length,providerHits:r,providerMisses:a,definitionsWithCallees:o,calleeCount:f,rows:i.size}))}function pe(n,e,t,i,r){t.length>0&&(n.set(e,t),i&&r(t.length))}function hn(n,e){return k(n).signature(e)}function Ue(n,e){if(x(e.relativePath)==="typescript"){let o="fallback",f=0,m=0,S=0,d=0;return P("typescript.signature.materialize",()=>{let l=G(n,e.relativePath,we);if(l?.key){f=1;let p=me.read(n,e.relativePath,l.key)??{};if(Object.prototype.hasOwnProperty.call(p,e.symbol))return o="hit",m=1,p[e.symbol]??null;S=1;let b=E(n,e.relativePath);if(!b)return o="unavailable",null;let R=b.signatureFor(e);return me.write(n,e.relativePath,l.key,{...p,[e.symbol]:R}),o="computed",R}d=1;let u=E(n,e.relativePath);return u?(o="direct-fallback",u.signatureFor(e)):(o="unavailable",null)},()=>({state:o,eligible:f,cacheHits:m,cacheMisses:S,fallbacks:d}))}let t=Se(n,"semantic-signatures",e.relativePath),i=ze(e);if(t){let o=ue.read(n,i,t);if(o)return o.signature}let r=E(n,e.relativePath);if(!r)return null;let a=r.signatureFor(e);return t&&ue.write(n,i,t,{signature:a}),a}function Se(n,e,t){let i=z(n);if(!i)return null;let r=x(t);return r!=="rust"?null:U(JSON.stringify({kind:e,language:r,engine:$(n.config.projectRoot),projectFingerprint:i}))}function ze(n){return`${n.relativePath}\0${n.symbol}`}function he(n){try{let e=JSON.parse(n);return Array.isArray(e)?e:null}catch{return null}}function Le(n){try{let e=JSON.parse(n);if(!e||typeof e!="object")return null;let t=e.signature;return t!==null&&typeof t!="string"?null:{signature:t}}catch{return null}}function je(n){try{let e=JSON.parse(n);if(!e||typeof e!="object"||Array.isArray(e))return null;for(let t of Object.values(e))if(t!==null&&typeof t!="string")return null;return e}catch{return null}}function ye(n,e,t){let i=x(t);if(!i)return{slot:e,language:"typescript",available:!1,reason:"semantic evidence is only available for TypeScript or Rust files"};try{return{slot:e,language:i,...B(n,t).availability()}}catch(r){return{slot:e,language:i,available:!1,reason:r instanceof Error?r.message:String(r)}}}function E(n,e){if(!x(e))return null;let t=B(n,e);return t.availability().available?t:null}export{Je as a,$e as b,Be as c,ae as d,ce as e,k as f,fn as g,mn as h,pn as i,dn as j,gn as k,Oe as l,Sn as m,hn as n};
|
|
29
|
+
//# sourceMappingURL=chunk-NJD4C5G5.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as ce}from"./chunk-UWR52GNZ.js";import{b as ae}from"./chunk-B75HZHUP.js";import{a as N}from"./chunk-BTYDBDX5.js";import{b as Y,e as Q,f as ee,g as te}from"./chunk-5CJ6AQN7.js";import{c as P}from"./chunk-3YEBIYXL.js";import{h as oe}from"./chunk-FY6RCFDH.js";import{a as ne,b as ie,c as re,k as se}from"./chunk-KWMRY4RN.js";import{B as E,d as Z,e as $,g as J,h as K,i as q,j as G,k as V,w as X}from"./chunk-7XP7ZRSI.js";import{p as H}from"./chunk-JLZUM476.js";import{B as z,E as x,c as w}from"./chunk-TLTLJ4SW.js";import{a as S}from"./chunk-64MNV6AB.js";import{b as L,h as B,s as b,v as U,x as j,y as I,z as W}from"./chunk-M2TRDR25.js";var _=new WeakMap,le=U({kind:"definition-exclusions",invalidation:j("definition-exclusions"),serialize:e=>JSON.stringify(e),deserialize:we});function de(e,t){let n=z(t);if(!(n==="rust"||n==="typescript"||n==="tsx"||n==="javascript"))return[];let r=I(e,t);if(!r)return[];let o=B(e,t,r),c=le.read(e,t,o);if(c)return c;let u=n==="rust"?Me(e,t):Te(e,t);return le.write(e,t,o,u),u}function we(e){try{let t=JSON.parse(e);if(!Array.isArray(t))return null;let n=t.map(Ie);return n.some(i=>i===null)?null:n}catch{return null}}function Ie(e){if(!e||typeof e!="object")return null;let t=e;if(typeof t.startLine!="number"||!Number.isFinite(t.startLine)||typeof t.endLine!="number"||!Number.isFinite(t.endLine)||typeof t.reason!="string"||t.containerName!==void 0&&typeof t.containerName!="string")return null;let n=t.disposition===void 0?qe(t.reason):t.disposition;return n!=="exclude"&&n!=="implicit-usage"?null:{startLine:t.startLine,endLine:t.endLine,reason:t.reason,disposition:n,...t.containerName?{containerName:t.containerName}:{}}}var fe=new Set(["describe","it","test","fdescribe","fit","xdescribe","xit","beforeEach","afterEach","beforeAll","afterAll","before","after","suite","bench","benchmark"]),Pe=/\b(?:describe|it|test|fdescribe|fit|xdescribe|xit|beforeEach|afterEach|beforeAll|afterAll|before|after|suite|bench|benchmark)\s*\(/,Ne=/\b(?:export\s+)?(?:async\s+)?function\s+use[A-Z][A-Za-z0-9_$]*\b|\b(?:const|let|var)\s+use[A-Z][A-Za-z0-9_$]*\s*(?::[^=;]+)?=\s*(?:async\s*)?(?:function\b|(?:<[^=;{]+>\s*)?(?:\([^)]*\)|[A-Za-z_$][\w$]*)\s*=>)/;function Te(e,t){let n=I(e,t);if(!n||!ke(n))return[];let i=x(e,t);if(!i)return[];let r=_.get(i);if(r)return r;let o=!1,c=i.rootNode;for(let l of c.namedChildren){if(l.type!=="expression_statement")continue;let d=l.namedChild(0);if(!d||d.type!=="call_expression")continue;let s=d.namedChild(0);if(!s)continue;let a=s.type==="member_expression"?s.namedChild(s.namedChildCount-1)?.text:s.text;if(a&&fe.has(a)){o=!0;break}}let u=[];o&&u.push({startLine:0,endLine:c.endPosition.row,reason:"TS/JS test file (describe/it/test at top level)",disposition:"exclude"});for(let l of c.namedChildren){let d=null,s=null;if(l.type==="function_declaration")d=l.namedChild(0)?.text??null,s=l;else if(l.type==="export_statement"){let a=l.namedChild(0);a?.type==="function_declaration"&&(d=a.namedChild(0)?.text??null,s=a)}else if(l.type==="lexical_declaration"){let a=l.namedChild(0);if(a?.type==="variable_declarator"){let m=a.namedChild(0)?.text,p=a.namedChild(1);m&&(p?.type==="arrow_function"||p?.type==="function_expression")&&(d=m,s=a)}}d&&/^use[A-Z]/.test(d)&&s&&u.push({startLine:s.startPosition.row,endLine:s.endPosition.row,reason:"React custom hook (use*)",disposition:"exclude"})}return u.push(...me(i,new Set(["function_declaration","method_definition","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","variable_declarator","export_statement"]),new Set(["comment"]))),_.set(i,u),u}function ke(e){if(e.includes("scip-query"))return!0;let t=!1;for(let n of fe)if(e.includes(n)){t=!0;break}return t&&Pe.test(e)?!0:e.includes("use")&&Ne.test(e)}var Ae=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale)?/i;function Fe(e){return Ae.test(e)}function me(e,t,n){let i=[],r=o=>{if(t.has(o.type)&&o.parent){let u=o.parent.children,l=-1;for(let d=0;d<u.length;d+=1)if(u[d].startIndex===o.startIndex&&u[d].type===o.type){l=d;break}if(l>0)for(let d=l-1;d>=0;d-=1){let s=u[d];if(n.has(s.type)){if(Fe(s.text)){i.push({startLine:o.startPosition.row,endLine:o.endPosition.row,reason:"scip-query suppression comment",disposition:"exclude"});break}continue}if(!(s.type==="attribute_item"||s.type==="inner_attribute_item"))break}}for(let c of o.namedChildren)r(c)};return r(e.rootNode),i}function Me(e,t){let n=x(e,t);if(!n)return[];let i=_.get(n);if(i)return i;let r=[],o=Oe(n);return o?(_.set(n,o),o):(pe(n.rootNode,r,!1,!1),r.push(...me(n,new Set(["function_item","function_signature_item","struct_item","enum_item","union_item","impl_item","mod_item","static_item","const_item"]),new Set(["line_comment","block_comment"]))),r.push(...Je(n.rootNode)),_.set(n,r),r)}function Oe(e){return Ge(e.rootNode)?[{startLine:0,endLine:e.rootNode.endPosition.row,reason:"generated file (@generated header)",disposition:"exclude"}]:null}function pe(e,t,n,i){let r=n,o=i;e.type==="trait_item"&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait declaration body (dynamic dispatch)",disposition:"implicit-usage"}),e.type==="impl_item"&&e.childForFieldName("trait")&&(o=!0,t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl block (dynamic dispatch)",disposition:"implicit-usage"})),e.type==="function_item"||e.type==="function_signature_item"?Be(e,t,n,i):i&&$e(e)?t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl associated item (dynamic dispatch)",disposition:"implicit-usage"}):e.type==="struct_item"||e.type==="enum_item"||e.type==="union_item"?Ue(e,t,n):e.type==="mod_item"&&T(e).some(c=>/#\[\s*cfg\s*\(\s*test\s*\)/.test(c))&&(r=!0);for(let c of e.namedChildren)pe(c,t,r,o)}function Be(e,t,n,i){let r=T(e),o=null;i?o={reason:"trait impl method (dynamic dispatch)",disposition:"implicit-usage"}:n&&(o={reason:"inside #[cfg(test)] mod",disposition:"exclude"});for(let c of r){if(ye(c)){o={reason:"#[allow(dead_code)]",disposition:"exclude"};break}let u=He(c);if(u){o=u;break}}o&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:o.reason,disposition:o.disposition})}function Ue(e,t,n){let i=T(e),r=e.namedChildren.find(o=>o.type==="type_identifier")?.text;i.some(Ze)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[derive(...)] - generated impl may access fields",disposition:"implicit-usage",containerName:r}),i.some(ye)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[allow(dead_code)]",disposition:"exclude",containerName:r}),n&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"inside #[cfg(test)] mod",disposition:"exclude",containerName:r})}function T(e){let t=e.parent;if(!t)return[];let n=t.children,i=-1;for(let o=0;o<n.length;o+=1)if(n[o].startIndex===e.startIndex&&n[o].type===e.type){i=o;break}if(i<=0)return[];let r=[];for(let o=i-1;o>=0;o-=1){let c=n[o];if(c.type==="attribute_item"||c.type==="inner_attribute_item")r.push(c.text);else{if(c.type==="line_comment"||c.type==="block_comment")continue;break}}return r}var je=new Set(["test","bench","tokio::test","async_std::test"]),We=new Set(["no_mangle","export_name","link_name","used","macro_export","proc_macro","proc_macro_derive","proc_macro_attribute"]),ze=new Set(["allow","warn","deny","forbid","cfg","cfg_attr","doc","inline","cold","must_use","deprecated","repr","derive","automatically_derived","non_exhaustive","path","link","link_section","global_allocator","panic_handler"]);function He(e){if(/#\[\s*cfg\s*\(\s*test\s*\)/.test(e))return{reason:"#[cfg(test)]",disposition:"exclude"};let t=Ke(e);return t?je.has(t)?{reason:`#[${t}]`,disposition:"exclude"}:We.has(t)?{reason:`Rust ABI/export attribute #[${t}]`,disposition:"implicit-usage"}:ze.has(t)?null:{reason:`Rust attribute macro #[${t}]`,disposition:"implicit-usage"}:null}function Ze(e){return/#\[\s*derive\s*\(/.test(e)}function ye(e){return/#\[\s*allow\s*\(\s*dead_code\s*\)/.test(e)}function $e(e){return e.type==="const_item"||e.type==="type_item"||e.type==="static_item"||e.type==="associated_type"}function Je(e){let t=Ve(e);if(t.size===0)return[];let n=[];for(let i of e.descendantsOfType("mod_item")){let r=i.childForFieldName("name")?.text;r&&t.has(r)&&n.push({startLine:i.startPosition.row,endLine:i.endPosition.row,reason:'attribute `with = "..."` module - body may be invoked via reflection',disposition:"implicit-usage",containerName:r})}return n}function Ke(e){let t=/^#!?\[\s*([A-Za-z_][A-Za-z0-9_]*(?:\s*::\s*[A-Za-z_][A-Za-z0-9_]*)*)/.exec(e);return t?t[1].replace(/\s+/g,""):null}function qe(e){return e==="#[tauri::command]"||e==="#[command]"||e==="#[wasm_bindgen]"||e==="#[no_mangle]"||e==="#[napi]"||e==="#[pyfunction]"||e==="#[pymethod]"||e==="#[pyo3]"||e==="#[doc(hidden)]"||e.startsWith("trait ")||e.startsWith("#[derive(<reflective>)]")||e.startsWith("#[derive(...)]")||e.startsWith('serde `with = "')||e.startsWith('attribute `with = "')||e.startsWith("Rust attribute macro #[")||e.startsWith("Rust ABI/export attribute #[")?"implicit-usage":"exclude"}function Ge(e){for(let t=0;t<Math.min(e.namedChildCount,12);t+=1){let n=e.namedChild(t);if(!n||n.type!=="line_comment"&&n.type!=="block_comment")break;if(/@generated\b/.test(n.text)||/This file is .*generated\b/i.test(n.text)||/Code generated by/i.test(n.text)||/Generated by:\s*https?:\/\/openapi-generator/i.test(n.text)||/openapi-generator/i.test(n.text)&&/Generated by/i.test(n.text))return!0}return!1}var ue=/\bwith\s*=\s*"([^"]+)"/g;function Ve(e){let t=new Set;for(let n of e.descendantsOfType("attribute_item")){ue.lastIndex=0;let i;for(;(i=ue.exec(n.text))!==null;){let r=i[1],o=r.split("::").pop()??r;o&&t.add(o)}}return t}function be(e){let t=k(e);return(n,i,r,o)=>t(n,i,r,o)?.disposition==="exclude"}function k(e){let t=new Map,n=i=>{let r=t.get(i);if(r)return r;let o=de(e,i),c=new Map;for(let u of o){if(!u.containerName)continue;let l=c.get(u.containerName)??[];l.push(u),c.set(u.containerName,l)}return r={ranges:o,containers:c},t.set(i,r),r};return(i,r,o,c)=>{let u=n(i),l=[];for(let s of u.ranges)r>=s.startLine&&r<=s.endLine&&l.push(s);let d=new Set;c&&d.add(c);for(let s of E(o))d.add(s);for(let s of d){let a=u.containers.get(s);a&&l.push(...a)}return Xe(l)}}function Xe(e){if(e.length===0)return null;let n=e.find(i=>i.disposition==="exclude")??e[0];return{disposition:n.disposition,reason:n.reason}}function Ct(e,t={}){L(e,{groups:t.semanticProvider===!0?["whole-project","semantic-provider"]:["whole-project"]})}function ge(e,t,n={}){L(e,{groups:n.definitions===!0?["source-file","definition-catalog"]:["source-file"],file:t.replace(/\\/g,"/")})}function he(e,t){if(t.isIgnoredPath(e.relativePath))return y("ignored-file");if(q(e.symbol))return y("module-like-symbol");if(!R(e.symbol))return y("non-value-symbol");if(!e.isFunctionLike&&e.enclosingSymbol&&R(e.enclosingSymbol))return y("nested-non-callable-value");if(!t.includeTests&&!Ye(e.relativePath))return y("test-file");if(!t.includeTests&&t.isExcludedRegion(e.relativePath,e.startLine,e.symbol,e.parentTypeName))return y("excluded-file-region");let n=$(e.symbol);if(n==="<constructor>")return y("implicit-constructor");if(e.symbol.startsWith("scip-python ")){if(n==="__all__")return y("python-runtime-metadata");if(/^__[^_].*__$/.test(n))return y("python-protocol-member")}return t.isDeclarationOnlyCallable()?y("declaration-only-callable"):t.isFrameworkContractCallable()?y("framework-contract-member"):G(e.symbol)?y("rust-trait-impl-member"):V(e.symbol)?y("rust-test-module"):!t.includeMembers&&!Qe(e)?y("member"):e.endLine-e.startLine+1<t.minLoc?y("below-min-loc"):{accepted:!0}}function Ye(e){return Y(e)!=="test"}function y(e){return{accepted:!1,rejectionReason:e}}function R(e){return K(e)||e.endsWith("().")||e.endsWith(".")}function Qe(e){return J(e.symbol)||E(e.symbol).length===0}function xe(){return new Map}function _e(e,t,n){let i=new Map;for(let r of ne(e,n))e.isIgnored(r.relative_path)||t.has(r.relative_path)||v(i,r.symbol_id,r.relative_path,r.ref_count,"scip-mention");return i}function Se(e,t,n,i={}){let r=new Set;if(i.conservative||n.size===0){for(let o of re(e,t))r.add(o.symbol_id);return r}for(let o of ie(e,t))e.isIgnored(o.relative_path)||n.has(o.relative_path)||r.add(o.symbol_id);return r}function A(e,t){let n=e.get(t);if(!n)return!1;for(let i of n.values())if(i.occurrences>0)return!0;return!1}function C(e,t,n){let i=e.get(t);if(!i)return!1;for(let[r,o]of i)if(r!==n&&o.occurrences>0)return!0;return!1}function Ee(e){return e?.occurrences??0}function v(e,t,n,i,r="source-fallback"){if(i<=0)return;let o=Ce(e,t,n);o.occurrences+=i,o.sources.add(r)}function Re(e,t,n,i,r){if(i<=0)return;let o=Ce(e,t,n);o.occurrences=Math.max(i,o.occurrences),o.sources.add(r)}function Ce(e,t,n){let i=e.get(t);i||(i=new Map,e.set(t,i));let r=i.get(n);return r||(r={occurrences:0,sources:new Set},i.set(n,r)),r}var et=1e3,tt=300;function Xt(e,t={}){let{scope:n,minLoc:i=1,includeTests:r=!1,skipBarrels:o=!1,includeMembers:c=!1,deadCodeOnly:u=!1,scanLimit:l,semantic:d=!0}=t,s=0,a=b("dead.candidates",()=>{let f=ae(nt(e,{scope:n,minLoc:i,includeTests:r,includeMembers:c}),l);return s=f.length,f},()=>({definitions:s})),m=0,p=o?b("dead.inactive-barrels",()=>{let f=new Set(Q(e));return m=f.size,f},()=>({paths:m})):new Set,F=0,g=u?xe():b("dead.mention-reference-counts",()=>{let f=_e(e,p,a.map(D=>D.symbolId));return F=f.size,f},()=>({definitions:a.length,symbolsWithReferences:F})),M=0,De=u?b("dead.mentioned-symbol-ids",()=>{let f=Se(e,a.map(D=>D.symbolId),p,{conservative:p.size===0});return M=f.size,f},()=>({definitions:a.length,referencedSymbols:M})):new Set,h=u?a.filter(f=>!De.has(f.symbolId)):a.filter(f=>!C(g,f.symbolId,f.relativePath));u?b("dead.source-fallback.dead-code-only",()=>lt(e,h,g,{inactiveBarrelPaths:p}),()=>({definitions:h.length,testReferencesIncluded:!0})):b("dead.source-fallback.ast",()=>ct(e,h,g,{inactiveBarrelPaths:p}),()=>({definitions:h.length,testReferencesIncluded:!0}));let O=u?h.filter(f=>!A(g,f.symbolId)):h.filter(f=>!C(g,f.symbolId,f.relativePath));b("dead.caller-map-supplement",()=>pt(e,O,g,{inactiveBarrelPaths:p,includeSemantic:!u&&d}),()=>({definitions:O.length,semantic:!u&&d}));let Le=u?h.filter(f=>!A(g,f.symbolId)):a;return at(e,st(Le,g))}function nt(e,t){let n=be(e),i=[];for(let r of X(e,{scope:t.scope,symbolMatches:R,sqlPrefilter:"function-like"}))he(r,{minLoc:t.minLoc,includeTests:t.includeTests,includeMembers:t.includeMembers,isIgnoredPath:c=>e.isIgnored(c),isExcludedRegion:n,isDeclarationOnlyCallable:()=>rt(e,r),isFrameworkContractCallable:()=>ce(e,r)}).accepted&&i.push(r);return i}var it=["method_signature","abstract_method_signature","call_signature","construct_signature"];function rt(e,t){if(!t.parentTypeName||!/\.[cm]?[jt]sx?$/.test(t.relativePath))return!1;let n=x(e,t.relativePath);if(n)return n.rootNode.descendantsOfType([...it]).some(r=>r.startPosition.row<=t.startLine&&r.endPosition.row>=t.endLine);let i=W(e,t.relativePath).slice(t.startLine,t.endLine+1).join(`
|
|
1
|
+
import{a as ce}from"./chunk-UWR52GNZ.js";import{b as ae}from"./chunk-B75HZHUP.js";import{a as N}from"./chunk-RUV4KHWA.js";import{b as Y,e as Q,f as ee,g as te}from"./chunk-5CJ6AQN7.js";import{c as P}from"./chunk-KSD6IWF4.js";import{h as oe}from"./chunk-MBVHEPHQ.js";import{a as ne,b as ie,c as re,k as se}from"./chunk-NJD4C5G5.js";import{B as E,d as Z,e as $,g as J,h as K,i as q,j as G,k as V,w as X}from"./chunk-7XP7ZRSI.js";import{p as H}from"./chunk-JLZUM476.js";import{B as z,E as x,c as w}from"./chunk-TLTLJ4SW.js";import{a as S}from"./chunk-64MNV6AB.js";import{b as L,h as B,s as b,v as U,x as j,y as I,z as W}from"./chunk-M2TRDR25.js";var _=new WeakMap,le=U({kind:"definition-exclusions",invalidation:j("definition-exclusions"),serialize:e=>JSON.stringify(e),deserialize:we});function de(e,t){let n=z(t);if(!(n==="rust"||n==="typescript"||n==="tsx"||n==="javascript"))return[];let r=I(e,t);if(!r)return[];let o=B(e,t,r),c=le.read(e,t,o);if(c)return c;let u=n==="rust"?Me(e,t):Te(e,t);return le.write(e,t,o,u),u}function we(e){try{let t=JSON.parse(e);if(!Array.isArray(t))return null;let n=t.map(Ie);return n.some(i=>i===null)?null:n}catch{return null}}function Ie(e){if(!e||typeof e!="object")return null;let t=e;if(typeof t.startLine!="number"||!Number.isFinite(t.startLine)||typeof t.endLine!="number"||!Number.isFinite(t.endLine)||typeof t.reason!="string"||t.containerName!==void 0&&typeof t.containerName!="string")return null;let n=t.disposition===void 0?qe(t.reason):t.disposition;return n!=="exclude"&&n!=="implicit-usage"?null:{startLine:t.startLine,endLine:t.endLine,reason:t.reason,disposition:n,...t.containerName?{containerName:t.containerName}:{}}}var fe=new Set(["describe","it","test","fdescribe","fit","xdescribe","xit","beforeEach","afterEach","beforeAll","afterAll","before","after","suite","bench","benchmark"]),Pe=/\b(?:describe|it|test|fdescribe|fit|xdescribe|xit|beforeEach|afterEach|beforeAll|afterAll|before|after|suite|bench|benchmark)\s*\(/,Ne=/\b(?:export\s+)?(?:async\s+)?function\s+use[A-Z][A-Za-z0-9_$]*\b|\b(?:const|let|var)\s+use[A-Z][A-Za-z0-9_$]*\s*(?::[^=;]+)?=\s*(?:async\s*)?(?:function\b|(?:<[^=;{]+>\s*)?(?:\([^)]*\)|[A-Za-z_$][\w$]*)\s*=>)/;function Te(e,t){let n=I(e,t);if(!n||!ke(n))return[];let i=x(e,t);if(!i)return[];let r=_.get(i);if(r)return r;let o=!1,c=i.rootNode;for(let l of c.namedChildren){if(l.type!=="expression_statement")continue;let d=l.namedChild(0);if(!d||d.type!=="call_expression")continue;let s=d.namedChild(0);if(!s)continue;let a=s.type==="member_expression"?s.namedChild(s.namedChildCount-1)?.text:s.text;if(a&&fe.has(a)){o=!0;break}}let u=[];o&&u.push({startLine:0,endLine:c.endPosition.row,reason:"TS/JS test file (describe/it/test at top level)",disposition:"exclude"});for(let l of c.namedChildren){let d=null,s=null;if(l.type==="function_declaration")d=l.namedChild(0)?.text??null,s=l;else if(l.type==="export_statement"){let a=l.namedChild(0);a?.type==="function_declaration"&&(d=a.namedChild(0)?.text??null,s=a)}else if(l.type==="lexical_declaration"){let a=l.namedChild(0);if(a?.type==="variable_declarator"){let m=a.namedChild(0)?.text,p=a.namedChild(1);m&&(p?.type==="arrow_function"||p?.type==="function_expression")&&(d=m,s=a)}}d&&/^use[A-Z]/.test(d)&&s&&u.push({startLine:s.startPosition.row,endLine:s.endPosition.row,reason:"React custom hook (use*)",disposition:"exclude"})}return u.push(...me(i,new Set(["function_declaration","method_definition","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","variable_declarator","export_statement"]),new Set(["comment"]))),_.set(i,u),u}function ke(e){if(e.includes("scip-query"))return!0;let t=!1;for(let n of fe)if(e.includes(n)){t=!0;break}return t&&Pe.test(e)?!0:e.includes("use")&&Ne.test(e)}var Ae=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale)?/i;function Fe(e){return Ae.test(e)}function me(e,t,n){let i=[],r=o=>{if(t.has(o.type)&&o.parent){let u=o.parent.children,l=-1;for(let d=0;d<u.length;d+=1)if(u[d].startIndex===o.startIndex&&u[d].type===o.type){l=d;break}if(l>0)for(let d=l-1;d>=0;d-=1){let s=u[d];if(n.has(s.type)){if(Fe(s.text)){i.push({startLine:o.startPosition.row,endLine:o.endPosition.row,reason:"scip-query suppression comment",disposition:"exclude"});break}continue}if(!(s.type==="attribute_item"||s.type==="inner_attribute_item"))break}}for(let c of o.namedChildren)r(c)};return r(e.rootNode),i}function Me(e,t){let n=x(e,t);if(!n)return[];let i=_.get(n);if(i)return i;let r=[],o=Oe(n);return o?(_.set(n,o),o):(pe(n.rootNode,r,!1,!1),r.push(...me(n,new Set(["function_item","function_signature_item","struct_item","enum_item","union_item","impl_item","mod_item","static_item","const_item"]),new Set(["line_comment","block_comment"]))),r.push(...Je(n.rootNode)),_.set(n,r),r)}function Oe(e){return Ge(e.rootNode)?[{startLine:0,endLine:e.rootNode.endPosition.row,reason:"generated file (@generated header)",disposition:"exclude"}]:null}function pe(e,t,n,i){let r=n,o=i;e.type==="trait_item"&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait declaration body (dynamic dispatch)",disposition:"implicit-usage"}),e.type==="impl_item"&&e.childForFieldName("trait")&&(o=!0,t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl block (dynamic dispatch)",disposition:"implicit-usage"})),e.type==="function_item"||e.type==="function_signature_item"?Be(e,t,n,i):i&&$e(e)?t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl associated item (dynamic dispatch)",disposition:"implicit-usage"}):e.type==="struct_item"||e.type==="enum_item"||e.type==="union_item"?Ue(e,t,n):e.type==="mod_item"&&T(e).some(c=>/#\[\s*cfg\s*\(\s*test\s*\)/.test(c))&&(r=!0);for(let c of e.namedChildren)pe(c,t,r,o)}function Be(e,t,n,i){let r=T(e),o=null;i?o={reason:"trait impl method (dynamic dispatch)",disposition:"implicit-usage"}:n&&(o={reason:"inside #[cfg(test)] mod",disposition:"exclude"});for(let c of r){if(ye(c)){o={reason:"#[allow(dead_code)]",disposition:"exclude"};break}let u=He(c);if(u){o=u;break}}o&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:o.reason,disposition:o.disposition})}function Ue(e,t,n){let i=T(e),r=e.namedChildren.find(o=>o.type==="type_identifier")?.text;i.some(Ze)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[derive(...)] - generated impl may access fields",disposition:"implicit-usage",containerName:r}),i.some(ye)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[allow(dead_code)]",disposition:"exclude",containerName:r}),n&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"inside #[cfg(test)] mod",disposition:"exclude",containerName:r})}function T(e){let t=e.parent;if(!t)return[];let n=t.children,i=-1;for(let o=0;o<n.length;o+=1)if(n[o].startIndex===e.startIndex&&n[o].type===e.type){i=o;break}if(i<=0)return[];let r=[];for(let o=i-1;o>=0;o-=1){let c=n[o];if(c.type==="attribute_item"||c.type==="inner_attribute_item")r.push(c.text);else{if(c.type==="line_comment"||c.type==="block_comment")continue;break}}return r}var je=new Set(["test","bench","tokio::test","async_std::test"]),We=new Set(["no_mangle","export_name","link_name","used","macro_export","proc_macro","proc_macro_derive","proc_macro_attribute"]),ze=new Set(["allow","warn","deny","forbid","cfg","cfg_attr","doc","inline","cold","must_use","deprecated","repr","derive","automatically_derived","non_exhaustive","path","link","link_section","global_allocator","panic_handler"]);function He(e){if(/#\[\s*cfg\s*\(\s*test\s*\)/.test(e))return{reason:"#[cfg(test)]",disposition:"exclude"};let t=Ke(e);return t?je.has(t)?{reason:`#[${t}]`,disposition:"exclude"}:We.has(t)?{reason:`Rust ABI/export attribute #[${t}]`,disposition:"implicit-usage"}:ze.has(t)?null:{reason:`Rust attribute macro #[${t}]`,disposition:"implicit-usage"}:null}function Ze(e){return/#\[\s*derive\s*\(/.test(e)}function ye(e){return/#\[\s*allow\s*\(\s*dead_code\s*\)/.test(e)}function $e(e){return e.type==="const_item"||e.type==="type_item"||e.type==="static_item"||e.type==="associated_type"}function Je(e){let t=Ve(e);if(t.size===0)return[];let n=[];for(let i of e.descendantsOfType("mod_item")){let r=i.childForFieldName("name")?.text;r&&t.has(r)&&n.push({startLine:i.startPosition.row,endLine:i.endPosition.row,reason:'attribute `with = "..."` module - body may be invoked via reflection',disposition:"implicit-usage",containerName:r})}return n}function Ke(e){let t=/^#!?\[\s*([A-Za-z_][A-Za-z0-9_]*(?:\s*::\s*[A-Za-z_][A-Za-z0-9_]*)*)/.exec(e);return t?t[1].replace(/\s+/g,""):null}function qe(e){return e==="#[tauri::command]"||e==="#[command]"||e==="#[wasm_bindgen]"||e==="#[no_mangle]"||e==="#[napi]"||e==="#[pyfunction]"||e==="#[pymethod]"||e==="#[pyo3]"||e==="#[doc(hidden)]"||e.startsWith("trait ")||e.startsWith("#[derive(<reflective>)]")||e.startsWith("#[derive(...)]")||e.startsWith('serde `with = "')||e.startsWith('attribute `with = "')||e.startsWith("Rust attribute macro #[")||e.startsWith("Rust ABI/export attribute #[")?"implicit-usage":"exclude"}function Ge(e){for(let t=0;t<Math.min(e.namedChildCount,12);t+=1){let n=e.namedChild(t);if(!n||n.type!=="line_comment"&&n.type!=="block_comment")break;if(/@generated\b/.test(n.text)||/This file is .*generated\b/i.test(n.text)||/Code generated by/i.test(n.text)||/Generated by:\s*https?:\/\/openapi-generator/i.test(n.text)||/openapi-generator/i.test(n.text)&&/Generated by/i.test(n.text))return!0}return!1}var ue=/\bwith\s*=\s*"([^"]+)"/g;function Ve(e){let t=new Set;for(let n of e.descendantsOfType("attribute_item")){ue.lastIndex=0;let i;for(;(i=ue.exec(n.text))!==null;){let r=i[1],o=r.split("::").pop()??r;o&&t.add(o)}}return t}function be(e){let t=k(e);return(n,i,r,o)=>t(n,i,r,o)?.disposition==="exclude"}function k(e){let t=new Map,n=i=>{let r=t.get(i);if(r)return r;let o=de(e,i),c=new Map;for(let u of o){if(!u.containerName)continue;let l=c.get(u.containerName)??[];l.push(u),c.set(u.containerName,l)}return r={ranges:o,containers:c},t.set(i,r),r};return(i,r,o,c)=>{let u=n(i),l=[];for(let s of u.ranges)r>=s.startLine&&r<=s.endLine&&l.push(s);let d=new Set;c&&d.add(c);for(let s of E(o))d.add(s);for(let s of d){let a=u.containers.get(s);a&&l.push(...a)}return Xe(l)}}function Xe(e){if(e.length===0)return null;let n=e.find(i=>i.disposition==="exclude")??e[0];return{disposition:n.disposition,reason:n.reason}}function Ct(e,t={}){L(e,{groups:t.semanticProvider===!0?["whole-project","semantic-provider"]:["whole-project"]})}function ge(e,t,n={}){L(e,{groups:n.definitions===!0?["source-file","definition-catalog"]:["source-file"],file:t.replace(/\\/g,"/")})}function he(e,t){if(t.isIgnoredPath(e.relativePath))return y("ignored-file");if(q(e.symbol))return y("module-like-symbol");if(!R(e.symbol))return y("non-value-symbol");if(!e.isFunctionLike&&e.enclosingSymbol&&R(e.enclosingSymbol))return y("nested-non-callable-value");if(!t.includeTests&&!Ye(e.relativePath))return y("test-file");if(!t.includeTests&&t.isExcludedRegion(e.relativePath,e.startLine,e.symbol,e.parentTypeName))return y("excluded-file-region");let n=$(e.symbol);if(n==="<constructor>")return y("implicit-constructor");if(e.symbol.startsWith("scip-python ")){if(n==="__all__")return y("python-runtime-metadata");if(/^__[^_].*__$/.test(n))return y("python-protocol-member")}return t.isDeclarationOnlyCallable()?y("declaration-only-callable"):t.isFrameworkContractCallable()?y("framework-contract-member"):G(e.symbol)?y("rust-trait-impl-member"):V(e.symbol)?y("rust-test-module"):!t.includeMembers&&!Qe(e)?y("member"):e.endLine-e.startLine+1<t.minLoc?y("below-min-loc"):{accepted:!0}}function Ye(e){return Y(e)!=="test"}function y(e){return{accepted:!1,rejectionReason:e}}function R(e){return K(e)||e.endsWith("().")||e.endsWith(".")}function Qe(e){return J(e.symbol)||E(e.symbol).length===0}function xe(){return new Map}function _e(e,t,n){let i=new Map;for(let r of ne(e,n))e.isIgnored(r.relative_path)||t.has(r.relative_path)||v(i,r.symbol_id,r.relative_path,r.ref_count,"scip-mention");return i}function Se(e,t,n,i={}){let r=new Set;if(i.conservative||n.size===0){for(let o of re(e,t))r.add(o.symbol_id);return r}for(let o of ie(e,t))e.isIgnored(o.relative_path)||n.has(o.relative_path)||r.add(o.symbol_id);return r}function A(e,t){let n=e.get(t);if(!n)return!1;for(let i of n.values())if(i.occurrences>0)return!0;return!1}function C(e,t,n){let i=e.get(t);if(!i)return!1;for(let[r,o]of i)if(r!==n&&o.occurrences>0)return!0;return!1}function Ee(e){return e?.occurrences??0}function v(e,t,n,i,r="source-fallback"){if(i<=0)return;let o=Ce(e,t,n);o.occurrences+=i,o.sources.add(r)}function Re(e,t,n,i,r){if(i<=0)return;let o=Ce(e,t,n);o.occurrences=Math.max(i,o.occurrences),o.sources.add(r)}function Ce(e,t,n){let i=e.get(t);i||(i=new Map,e.set(t,i));let r=i.get(n);return r||(r={occurrences:0,sources:new Set},i.set(n,r)),r}var et=1e3,tt=300;function Xt(e,t={}){let{scope:n,minLoc:i=1,includeTests:r=!1,skipBarrels:o=!1,includeMembers:c=!1,deadCodeOnly:u=!1,scanLimit:l,semantic:d=!0}=t,s=0,a=b("dead.candidates",()=>{let f=ae(nt(e,{scope:n,minLoc:i,includeTests:r,includeMembers:c}),l);return s=f.length,f},()=>({definitions:s})),m=0,p=o?b("dead.inactive-barrels",()=>{let f=new Set(Q(e));return m=f.size,f},()=>({paths:m})):new Set,F=0,g=u?xe():b("dead.mention-reference-counts",()=>{let f=_e(e,p,a.map(D=>D.symbolId));return F=f.size,f},()=>({definitions:a.length,symbolsWithReferences:F})),M=0,De=u?b("dead.mentioned-symbol-ids",()=>{let f=Se(e,a.map(D=>D.symbolId),p,{conservative:p.size===0});return M=f.size,f},()=>({definitions:a.length,referencedSymbols:M})):new Set,h=u?a.filter(f=>!De.has(f.symbolId)):a.filter(f=>!C(g,f.symbolId,f.relativePath));u?b("dead.source-fallback.dead-code-only",()=>lt(e,h,g,{inactiveBarrelPaths:p}),()=>({definitions:h.length,testReferencesIncluded:!0})):b("dead.source-fallback.ast",()=>ct(e,h,g,{inactiveBarrelPaths:p}),()=>({definitions:h.length,testReferencesIncluded:!0}));let O=u?h.filter(f=>!A(g,f.symbolId)):h.filter(f=>!C(g,f.symbolId,f.relativePath));b("dead.caller-map-supplement",()=>pt(e,O,g,{inactiveBarrelPaths:p,includeSemantic:!u&&d}),()=>({definitions:O.length,semantic:!u&&d}));let Le=u?h.filter(f=>!A(g,f.symbolId)):a;return at(e,st(Le,g))}function nt(e,t){let n=be(e),i=[];for(let r of X(e,{scope:t.scope,symbolMatches:R,sqlPrefilter:"function-like"}))he(r,{minLoc:t.minLoc,includeTests:t.includeTests,includeMembers:t.includeMembers,isIgnoredPath:c=>e.isIgnored(c),isExcludedRegion:n,isDeclarationOnlyCallable:()=>rt(e,r),isFrameworkContractCallable:()=>ce(e,r)}).accepted&&i.push(r);return i}var it=["method_signature","abstract_method_signature","call_signature","construct_signature"];function rt(e,t){if(!t.parentTypeName||!/\.[cm]?[jt]sx?$/.test(t.relativePath))return!1;let n=x(e,t.relativePath);if(n)return n.rootNode.descendantsOfType([...it]).some(r=>r.startPosition.row<=t.startLine&&r.endPosition.row>=t.endLine);let i=W(e,t.relativePath).slice(t.startLine,t.endLine+1).join(`
|
|
2
2
|
`).trim();return i.endsWith(";")&&!i.includes("=>")&&!i.includes("{")}function st(e,t){return e.map(n=>ot(n,t)).filter(n=>n.cross_file_refs===0).sort((n,i)=>i.loc-n.loc||n.relative_path.localeCompare(i.relative_path)||n.start_line-i.start_line)}function ot(e,t){let n=t.get(e.symbolId)??new Map,i=Ee(n.get(e.relativePath)),r=0;for(let[o,c]of n)o!==e.relativePath&&(r+=c.occurrences);return{relative_path:e.relativePath,start_line:e.startLine,end_line:e.endLine,loc:e.endLine-e.startLine+1,symbol:e.symbol,parent_type_name:e.parentTypeName,same_file_refs:i,cross_file_refs:r}}function at(e,t){let n=k(e),i=[],r=0,o=0,c=0,u=0,l=0,d=0;for(let s of t){if(e.isIgnored(s.relative_path))continue;if(ee(e,s.relative_path)){u++;continue}if(te(e,s.symbol,s.relative_path)){l++;continue}let a=n(s.relative_path,s.start_line,s.symbol,s.parent_type_name),m=a?.disposition==="implicit-usage"?a.reason:void 0,p=m?"implicit-usage":s.same_file_refs===0?"dead-code":"file-internal";p==="dead-code"?r++:p==="file-internal"?o++:c++,d+=s.loc,i.push({relativePath:s.relative_path,startLine:s.start_line,endLine:s.end_line,loc:s.loc,symbol:s.symbol,shortName:Z(s.symbol),sameFileRefs:s.same_file_refs,kind:p,...m?{implicitUsageReason:m}:{}})}return{symbols:i,counts:{total:i.length,deadCode:r,fileInternal:o,implicitUsage:c,loc:d},applicability:{entrySurfaceExcluded:u,externalRootExcluded:l,implicitUsageSignals:c},totalCount:i.length,deadCodeCount:r,fileInternalCount:o,implicitUsageCount:c,totalLoc:d}}function ct(e,t,n,i){if(t.length===0)return;let r=new N(e),o=new Set(t.map(l=>l.symbolId)),c=new Set(t.map(l=>l.leaf).filter(Boolean)),u=new Set(r.sourceFiles());for(let l of S(e))u.add(l);r.scanSourceReferences({paths:u,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:c,skipPath:l=>i.inactiveBarrelPaths.has(l)},l=>{o.has(l.target.symbolId)&&(ft(e,l)||v(n,l.target.symbolId,l.sourceFile,mt(l),"source-fallback"))})}function lt(e,t,n,i){if(t.length===0)return;let r=new N(e),o=ut(t),c=new Set(r.sourceFiles());for(let s of S(e))c.add(s);let u=new Set(o.keys()),l=new Map,d=s=>{let a=l.get(s);return a||(a=oe(e,s),l.set(s,a)),a};r.scanSourceReferences({paths:c,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:u,skipPath:s=>i.inactiveBarrelPaths.has(s),resolveTargets:({sourceFile:s,name:a,kind:m})=>{let p=o.get(a);return p?dt(s,a,p,()=>d(s),{permissive:m!=="cross-language-dispatch"}):[]},afterPath:s=>{l.delete(s),ge(e,s)}},s=>{let a=s.kind==="identifier"&&s.sourceFile===s.target.relativePath?Math.max(0,s.occurrences-1):s.occurrences;s.kind==="identifier"&&ve(e,{sourceFile:s.sourceFile,name:s.name,target:s.target,occurrences:a})||v(n,s.target.symbolId,s.sourceFile,a,"source-fallback")})}function ut(e){let t=new Map;for(let n of e){if(!n.leaf)continue;let i=t.get(n.leaf)??[];i.push(n),t.set(n.leaf,i)}return t}function dt(e,t,n,i,r){let o=n.filter(d=>d.relativePath===e);if(o.length>0)return o;if(!r.permissive&&n.length===1)return[...n];let c=i(),u=c.get(t);if(u)for(let d of u){let s=n.filter(a=>w(d,a.relativePath));if(s.length>0)return s}let l=new Set;for(let d of c.values())for(let s of d)l.add(s);for(let d of l){let s=n.filter(a=>w(d,a.relativePath));if(s.length>0&&s.length===n.length)return s}return r.permissive?[...n]:[]}function ft(e,t){return t.kind==="cross-language-dispatch"&&t.target.relativePath===t.sourceFile?!0:t.kind==="identifier"&&ve(e,t)}function mt(e){return e.kind==="identifier"&&e.target.relativePath===e.sourceFile?Math.max(0,e.occurrences-1):e.occurrences}function ve(e,t){return t.occurrences>1?!1:H(e,t.sourceFile).some(n=>n.used||n.sourcePath!==t.target.relativePath?!1:n.importedName===t.name||n.localName===t.name)}function pt(e,t,n,i){let r=i.includeSemantic!==!1,o=r&&t.length>=et&&S(e).length>=tt,c=(s,a)=>{a===s.relativePath||e.isIgnored(a)||i.inactiveBarrelPaths.has(a)||Re(n,s.symbolId,a,1,"caller-map")};if(o?b("dead.caller-map.per-symbol-non-semantic",()=>{for(let s of t){let a=P(e,s,{semantic:!1});for(let m of a)c(s,m.file)}},()=>({definitions:t.length,semantic:!1})):b("dead.caller-map.per-symbol",()=>{for(let s of t){let a=P(e,s,{semantic:r});if(a.length!==0)for(let m of a)c(s,m.file)}},()=>({definitions:t.length,semantic:r})),!o)return;let u=0,l=b("dead.caller-map.semantic-candidates",()=>{let s=t.filter(a=>!C(n,a.symbolId,a.relativePath));return u=s.length,s},()=>({definitions:t.length,semanticCandidates:u}));if(l.length===0)return;let d=se(e,l);for(let s of l){let a=d.get(s.symbolId);if(a)for(let m of a)c(s,m)}}export{Ct as a,Xt as b};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-NJTIAQY7.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as r}from"./chunk-
|
|
1
|
+
import{a as r}from"./chunk-K65T4TJS.js";function _(e,n,d){let i=r(e,n)??n,o=r(e,d)??d,t=e.get(`SELECT COUNT(DISTINCT gs.id) AS shared
|
|
2
2
|
FROM global_symbols gs
|
|
3
3
|
WHERE (
|
|
4
4
|
-- Defined in file1, referenced in file2
|
|
@@ -53,4 +53,4 @@ import{a as r}from"./chunk-5N5ZC566.js";function _(e,n,d){let i=r(e,n)??n,o=r(e,
|
|
|
53
53
|
GROUP BY def_d.id, ref_d.id
|
|
54
54
|
ORDER BY shared DESC
|
|
55
55
|
LIMIT ?`,...t,d).filter(s=>!e.isIgnored(s.file1)&&!e.isIgnored(s.file2)).map(s=>c(s.file1,s.file2,s.shared))}function c(e,n,d){return{file1:e,file2:n,sharedSymbols:d,actionTier:"signal",couplingKind:"shared-symbol-coupling",evidenceReasons:[`${d} symbol(s) are defined in one file and referenced by the other`],recommendation:"Review whether the shared symbol surface is an intentional boundary or hidden coordination pressure before moving code."}}export{_ as a,a as b};
|
|
56
|
-
//# sourceMappingURL=chunk-
|
|
56
|
+
//# sourceMappingURL=chunk-NX2YAXVQ.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{c as p}from"./chunk-
|
|
1
|
+
import{c as p}from"./chunk-4XTPZ5CR.js";import{b as B}from"./chunk-B75HZHUP.js";import{a as m}from"./chunk-BGBBVSH4.js";import{d as f,t as g}from"./chunk-7XP7ZRSI.js";import{b as y}from"./chunk-JLZUM476.js";import{z as d}from"./chunk-M2TRDR25.js";import{createHash as C}from"crypto";var b=3;function w(n,t={}){let{scope:e,maxLoc:o=15,minLoc:i=b,limit:r,scanLimit:a}=t,l=p(n),u=L(n,{scope:e,maxLoc:o,scanLimit:a}).map(s=>h(n,s,l,i)).filter(s=>s!==null),c=I(u);return r?c.slice(0,r):c}function H(n,t,e={}){let{scope:o,maxLoc:i=15,minLoc:r=b,scanLimit:a}=e,l=p(n),u=L(n,{scope:o,maxLoc:i,scanLimit:a}).map(s=>h(n,s,l,r)).filter(s=>s!==null),c=u.find(s=>s.symbol===t);return c?u.filter(s=>s.symbol!==c.symbol&&s.normalizedBody===c.normalizedBody&&s.file!==c.file).sort(z).map(({normalizedBody:s,...S})=>S):[]}function A(n){let t=E(n);return y(t).replace(/\s+/g,"")}function I(n){let t=new Map;for(let o of n){if(o.normalizedBody.length<8)continue;let i=W(o.normalizedBody),r=t.get(i)??[];r.push(o),t.set(i,r)}let e=[];for(let[o,i]of t){let r=new Set(i.map(l=>l.file));if(i.length<2||r.size<2)continue;let a=[...i].sort(z).map(({normalizedBody:l,...u})=>u);e.push({hash:o,canonical:a[0],functions:a})}return e.sort((o,i)=>{let r=i.functions.length-o.functions.length;if(r!==0)return r;let a=D(i)-D(o);return a!==0?a:o.canonical.file.localeCompare(i.canonical.file)}),e}function L(n,t){let e=g(n,{scope:t.scope}).filter(o=>o.isFunctionLike&&!n.isIgnored(o.relativePath)).filter(o=>m(o)<=t.maxLoc);return e.sort((o,i)=>m(i)-m(o)||o.relativePath.localeCompare(i.relativePath)),B(e,t.scanLimit)}function h(n,t,e,o){let i=x(n,t);if(!i||P(i)<o)return null;let r=v(n,t);return r?{symbol:t.symbol,shortName:f(t.symbol),file:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:m(t),ageCommits:e?.get(t.relativePath)?.commitsAgo??null,normalizedBody:r}:null}function v(n,t){let e=x(n,t);return e&&A(e)||null}function x(n,t){let e=d(n,t.relativePath);return e.length===0?null:e.slice(t.startLine,t.endLine+1).join(`
|
|
2
2
|
`)}function E(n){let t=n.indexOf("{"),e=n.lastIndexOf("}");if(t>=0&&e>t)return n.slice(t+1,e);let o=n.indexOf("=>");return o>=0?n.slice(o+2).replace(/;+\s*$/,""):n}function P(n){return E(n).split(/\r?\n/).map(e=>e.trim()).filter(e=>e.length>0).length}function W(n){return C("sha256").update(n).digest("hex").slice(0,16)}function z(n,t){let e=n.ageCommits??-1;return(t.ageCommits??-1)-e||n.file.localeCompare(t.file)||n.startLine-t.startLine}function D(n){return n.functions.reduce((t,e)=>t+e.loc,0)}export{w as a,H as b,A as c,I as d,v as e,x as f,E as g};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-O5A7BTMA.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as l}from"./chunk-
|
|
1
|
+
import{b as l}from"./chunk-K65T4TJS.js";import{a}from"./chunk-RUV4KHWA.js";import{d as i,g as n}from"./chunk-7XP7ZRSI.js";function _(e,r){let t=l(e,r);return t.length===0?[]:m([...d(e,t),...c(e,t)]).filter(o=>!e.isIgnored(o.relative_path)).map(u)}function d(e,r){let t=r.map(()=>"?").join(", ");return e.all(`SELECT DISTINCT d1.relative_path, gs.symbol
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
JOIN documents d1 ON c.document_id = d1.id
|
|
@@ -26,4 +26,4 @@ import{b as l}from"./chunk-5N5ZC566.js";import{a}from"./chunk-BTYDBDX5.js";impor
|
|
|
26
26
|
AND ${e.localSymbolPredicate}
|
|
27
27
|
${e.pathExclusionsFor("d1")}
|
|
28
28
|
ORDER BY d1.relative_path`,...r,...r,...r)}function c(e,r){let t=new a(e);return r.flatMap(o=>t.definitionsForFile(o).filter(s=>n(s.symbol)).map(s=>({relative_path:o,symbol:s.symbol})))}function m(e){let r=new Set;return e.filter(t=>{let o=`${t.relative_path}|${t.symbol}`;return r.has(o)?!1:(r.add(o),!0)})}function u(e){return{consumer:e.relative_path,symbol:e.symbol,shortName:i(e.symbol)}}export{_ as a};
|
|
29
|
-
//# sourceMappingURL=chunk-
|
|
29
|
+
//# sourceMappingURL=chunk-O7NA5FCA.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as r}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as r}from"./chunk-K65T4TJS.js";import{x as e}from"./chunk-7XP7ZRSI.js";function l(t,s){let o=r(t,s);return e(t,o).map(({relativePath:n,...a})=>a)}export{l as a};
|
|
2
|
+
//# sourceMappingURL=chunk-OINSINYW.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{b as k}from"./chunk-
|
|
1
|
+
import{b as k}from"./chunk-NJTIAQY7.js";import{a as D}from"./chunk-RUV4KHWA.js";import{f as v,g as L}from"./chunk-5CJ6AQN7.js";import{l as S}from"./chunk-MBVHEPHQ.js";import{d as h,s as y}from"./chunk-7XP7ZRSI.js";function z(e,n={}){let{scope:s,minLoc:c=1,maxDepth:a=5,scanLimit:f}=n,t=new D(e),i=_(e,s,c,f),o=new P;for(let r of i)o.add(r);let m=[],I=[];i.length>0&&m.push(C(e,0,i,o));let b=i.map(r=>r.definition).filter(r=>r!==null),x=new Set(i.map(r=>r.symbol));for(let r=1;r<=a&&b.length>0;r++){let u=t.calleeMap(b,{semantic:!1}),E=new Set;for(let d of b)for(let l of u.get(d.symbolId)??[])x.has(l.symbol)||E.add(l.symbol);let p=[];for(let d of E){x.add(d);let l=F(e,d);if(!l||e.isIgnored(l.relativePath)||v(e,l.relativePath)||L(e,l.symbol,l.relativePath)||t.fileKind(l.relativePath)==="test"||t.hasSuppressionComment(l))continue;let g=B(e,l,o);g.removable?p.push(w(l,"cascade")):g.blockingFiles.length>0&&I.push({shortName:h(l.symbol),file:l.relativePath,blockingFiles:g.blockingFiles.slice(0,3)})}if(p.length===0)break;for(let d of p)o.add(d);m.push(C(e,r,p,o)),b=p.map(d=>d.definition).filter(d=>d!==null)}let N=m.reduce((r,u)=>r+u.loc,0),R=m.reduce((r,u)=>r+u.entries.length,0);return{batches:m,totalSymbols:R,totalLoc:N,blocked:I}}function _(e,n,s,c){let a=k(e,{scope:n,minLoc:s,skipBarrels:!0,deadCodeOnly:!0,scanLimit:c,semantic:!1}),f=[];for(let t of a.symbols)t.kind==="dead-code"&&(v(e,t.relativePath)||L(e,t.symbol,t.relativePath)||f.push({symbol:t.symbol,shortName:t.shortName,file:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:t.loc,evidence:"graph-fact",definition:F(e,t.symbol)}));return f}function w(e,n){return{symbol:e.symbol,shortName:h(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:e.endLine-e.startLine+1,evidence:n,definition:e}}function F(e,n){let s=e.get(`SELECT d.relative_path
|
|
2
2
|
FROM global_symbols gs
|
|
3
3
|
JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
4
4
|
JOIN documents d ON d.id = der.document_id
|
|
5
5
|
WHERE gs.symbol = ?
|
|
6
6
|
LIMIT 1`,n);return s?y(e,s.relative_path).find(c=>c.symbol===n)??null:null}function B(e,n,s){let c=S(e,n);if(c.length===0)return{removable:!1,blockingFiles:[]};let a=new Set;for(let f of c)f.file===n.relativePath&&f.line>=n.startLine&&f.line<=n.endLine||s.contains(f.file,f.line)||a.add(f.file);return{removable:a.size===0,blockingFiles:[...a]}}function C(e,n,s,c){let a=[...s].sort((i,o)=>i.file.localeCompare(o.file)||i.startLine-o.startLine),f=new Set(a.map(i=>i.file)),t=[];for(let i of f){let o=y(e,i);o.length>0&&o.every(m=>c.contains(i,m.startLine))&&t.push(i)}return{depth:n,entries:a.map(({definition:i,...o})=>o),loc:a.reduce((i,o)=>i+o.loc,0),filesEmptied:t.sort()}}var P=class{ranges=new Map;add(n){let s=this.ranges.get(n.file)??[];s.push({start:n.startLine,end:n.endLine}),this.ranges.set(n.file,s)}contains(n,s){let c=this.ranges.get(n);return c?c.some(a=>s>=a.start&&s<=a.end):!1}};export{z as a,P as b};
|
|
7
|
-
//# sourceMappingURL=chunk-
|
|
7
|
+
//# sourceMappingURL=chunk-OQFA2SUQ.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{a as m}from"./chunk-
|
|
1
|
+
import{a as m}from"./chunk-K65T4TJS.js";import{a as h}from"./chunk-6JSTKSZH.js";import{d as g}from"./chunk-7XP7ZRSI.js";import{readFileSync as f}from"fs";import{extname as y,join as d}from"path";function M(t,e,a={}){let{context:s=0}=a,r=L(e);if(r)return j(t,r.filePath,r.startLine,r.endLine,s);let i=h(t,e);return i?R(t,i,s):null}function L(t){let e=t.match(/^(.+\.\w+):(\d+)-(\d+)$/);return e?{filePath:e[1],startLine:parseInt(e[2],10),endLine:parseInt(e[3],10)}:null}function R(t,e,a){let s=t.get("SELECT language FROM documents WHERE relative_path = ?",e.relativePath),r=d(t.config.projectRoot,e.relativePath),i;try{i=f(r,"utf-8")}catch{return null}let n=i.split(`
|
|
2
2
|
`),c=Math.max(0,e.startLine-a),l=Math.min(n.length-1,e.endLine+a),u=n.slice(c,l+1).join(`
|
|
3
3
|
`);return{symbol:e.symbol,shortName:g(e.symbol),relativePath:e.relativePath,startLine:c,endLine:l,language:s?.language??v(e.relativePath),source:u}}function j(t,e,a,s,r){let i=m(t,e);if(!i)return null;let n=t.get("SELECT relative_path, language FROM documents WHERE relative_path = ?",i);if(!n)return null;let c=d(t.config.projectRoot,n.relative_path),l;try{l=f(c,"utf-8")}catch{return null}let u=l.split(`
|
|
4
4
|
`),o=Math.max(0,a-1-r),p=Math.min(u.length-1,s-1+r),b=u.slice(o,p+1).join(`
|
|
5
5
|
`);return{symbol:`${n.relative_path}:${a}-${s}`,shortName:`${n.relative_path}:${a}-${s}`,relativePath:n.relative_path,startLine:o,endLine:p,language:n.language??v(n.relative_path),source:b}}function v(t){switch(y(t).toLowerCase()){case".ts":case".tsx":case".mts":case".cts":return"typescript";case".js":case".jsx":case".mjs":case".cjs":return"javascript";case".py":case".pyi":return"python";case".rs":return"rust";case".go":return"go";case".java":return"java";case".kt":case".kts":return"kotlin";case".scala":return"scala";case".rb":return"ruby";case".php":return"php";case".cs":return"csharp";case".vb":return"vb";case".dart":return"dart";case".c":case".h":return"c";case".cc":case".cpp":case".cxx":case".hpp":case".hh":case".hxx":return"cpp";case".vue":return"vue";default:return null}}export{M as a};
|
|
6
|
-
//# sourceMappingURL=chunk-
|
|
6
|
+
//# sourceMappingURL=chunk-OQFPCIXO.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as d}from"./chunk-
|
|
1
|
+
import{a as d}from"./chunk-RUV4KHWA.js";import{a as h}from"./chunk-6JSTKSZH.js";import{d as f}from"./chunk-7XP7ZRSI.js";import{b as u}from"./chunk-JLZUM476.js";import{E as l}from"./chunk-TLTLJ4SW.js";import{readFileSync as E}from"fs";import{join as B}from"path";function j(t,e,s={}){let n=h(t,e);if(!n)return null;let a=new d(t),o=N(t,n),r=n.endLine-n.startLine+1,m=a.calleeMap([n],{additive:!0,semantic:s.semantic}).get(n.symbolId)??[],c=new Set(m.map(x=>x.symbol));return{symbol:n.symbol,shortName:f(n.symbol),relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:r,branches:o.branches,estimateBasis:o.estimateBasis,cyclomaticEstimate:o.branches+1,calleeCount:c.size,fanIn:P(t,n.symbolId),fanOut:w(m,n.relativePath)}}function N(t,e){let s=l(t,e.relativePath);if(s){let n=g(s.rootNode,e.startLine,e.endLine);if(n)return{branches:v(n),estimateBasis:"ast"}}return{branches:_(p(t,e.relativePath,e.startLine,e.endLine),y(t,e.relativePath)),estimateBasis:"regex-fallback"}}function H(t,e){let s=new Map,n=new Map;for(let a of e){let o=n.get(a.relativePath)??[];o.push(a),n.set(a.relativePath,o)}for(let[a,o]of n){let r=l(t,a),i=r===null?[]:o.filter(c=>r.rootNode.startPosition.row<=c.startLine&&r.rootNode.endPosition.row>=c.endLine),m=new Set(i.map(c=>c.symbolId));if(r&&i.length>0){for(let c of i)s.set(c.symbolId,{branches:0,estimateBasis:"ast"});C(r.rootNode,i,s)}for(let c of o)m.has(c.symbolId)||s.set(c.symbolId,L(t,c))}return s}function L(t,e){return{branches:_(p(t,e.relativePath,e.startLine,e.endLine),y(t,e.relativePath)),estimateBasis:"regex-fallback"}}function y(t,e){return t.get("SELECT language FROM documents WHERE relative_path = ?",e)?.language??"unknown"}function p(t,e,s,n){try{return E(B(t.config.projectRoot,e),"utf-8").split(`
|
|
2
2
|
`).slice(s,n+1).join(`
|
|
3
3
|
`)}catch{return""}}function P(t,e){return t.get(`SELECT COUNT(DISTINCT c.document_id) AS c
|
|
4
4
|
FROM mentions m
|
|
@@ -13,4 +13,4 @@ import{a as d}from"./chunk-BTYDBDX5.js";import{a as h}from"./chunk-2HCWAL42.js";
|
|
|
13
13
|
WHERE m.symbol_id = ?
|
|
14
14
|
AND m.role != 1
|
|
15
15
|
AND sym_def.document_id != c.document_id`,e)?.c??0}function w(t,e){return new Set(t.filter(s=>s.file!==e).map(s=>s.symbol)).size}function v(t){let e=0;return b(t,s=>{e+=S(s)}),e}function C(t,e,s){let n=[...e].sort((a,o)=>a.startLine-o.startLine||o.endLine-a.endLine);b(t,a=>{let o=S(a);if(o===0)return;let r=a.startPosition.row,i=a.endPosition.row;for(let m of n){if(m.startLine>r)break;if(m.endLine<i)continue;let c=s.get(m.symbolId);c&&(c.branches+=o)}})}function b(t,e){e(t);for(let s of t.namedChildren)b(s,e)}function g(t,e,s){if(t.startPosition.row>e||t.endPosition.row<s)return null;for(let n of t.namedChildren){let a=g(n,e,s);if(a)return a}return t}var D=new Set(["if_statement","conditional_expression","ternary_expression","for_statement","for_in_statement","for_of_statement","while_statement","do_statement","switch_case","case_statement","catch_clause","except_clause","elif_clause","match_arm"]);function S(t){return D.has(t.type)?1:t.type==="binary_expression"&&t.parent?.type!=="binary_expression"&&(t.text.includes("&&")||t.text.includes("||"))?I(t.text):0}function I(t){return(t.match(/&&|\|\|/g)??[]).length}function _(t,e){let s=u(t),n=0,a=[/\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 a){let r=s.match(o);r&&(n+=r.length)}if(e==="python"){let o=[/\belif\b/g,/\bexcept\b/g,/\bfinally\b/g];for(let r of o){let i=s.match(r);i&&(n+=i.length)}}else if(e==="rust"){let o=[/\bmatch\b/g,/=>/g,/\bloop\b/g];for(let r of o){let i=s.match(r);i&&(n+=i.length)}}else if(e==="ruby"){let o=[/\belsif\b/g,/\bunless\b/g,/\brescue\b/g,/\bwhen\b/g];for(let r of o){let i=s.match(r);i&&(n+=i.length)}}else if(e==="go"){let o=[/\bselect\b/g,/\bdefer\b/g];for(let r of o){let i=s.match(r);i&&(n+=i.length)}}return n}export{j as a,N as b,H as c,v as d};
|
|
16
|
-
//# sourceMappingURL=chunk-
|
|
16
|
+
//# sourceMappingURL=chunk-P6FOIU7O.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as f}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as f}from"./chunk-RUV4KHWA.js";import{a as L}from"./chunk-6JSTKSZH.js";import{d as i,e as b,f as u,l as c}from"./chunk-7XP7ZRSI.js";import{f as l}from"./chunk-JLZUM476.js";import{B as a}from"./chunk-TLTLJ4SW.js";function S(o,s){let t=L(o,s);if(!t)return[];let e=new f(o).definitionsForFile(t.relativePath).filter(r=>r.symbol!==t.symbol).filter(r=>c(t.symbol,r.symbol)).sort((r,m)=>r.startLine-m.startLine||r.endLine-m.endLine).map(r=>({symbol:r.symbol,shortName:i(r.symbol),startLine:r.startLine,endLine:r.endLine,kind:u(r.symbol)??"unknown"}));return a(t.relativePath)!=="clojure"?e:d(e,y(o,t))}function y(o,s){let t=b(s.symbol);if(!t)return[];let n=i(s.symbol);return(l(o,s.relativePath)?.clojureMembers??[]).filter(e=>e.ownerName===t).map(e=>({symbol:`${s.symbol}${e.memberName}().`,shortName:`${n}:${e.memberName}()`,startLine:e.startLine,endLine:e.endLine,kind:e.memberKind}))}function d(o,s){let t=new Map;for(let n of[...o,...s])t.set(`${n.shortName}:${n.startLine}:${n.endLine}`,n);return[...t.values()].sort((n,e)=>n.startLine-e.startLine||n.endLine-e.endLine)}export{S as a};
|
|
2
|
+
//# sourceMappingURL=chunk-PQD7P6WB.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as i}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as i}from"./chunk-7LERNHDG.js";function l(n,o,s,t={}){let e=i(n,o,s,t);return e?{symbolA:e.symbolA,symbolB:e.symbolB,similarity:e.similarity,sharedCallees:e.sharedEvidence,uniqueToA:e.uniqueToA,uniqueToB:e.uniqueToB,consolidationStrategy:e.consolidationStrategy}:null}export{l as a};
|
|
2
|
+
//# sourceMappingURL=chunk-Q4GKL4CC.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as R}from"./chunk-
|
|
1
|
+
import{a as R}from"./chunk-RUV4KHWA.js";import{a as _,d as f}from"./chunk-5CJ6AQN7.js";import{d as l}from"./chunk-7XP7ZRSI.js";import{o as u,p,q as a}from"./chunk-JLZUM476.js";import{a as d}from"./chunk-64MNV6AB.js";import{y as m}from"./chunk-M2TRDR25.js";function $(e,o={}){let{scope:n,limit:r}=o,i=new R(e),t=D([...x(e,n),...O(e,i,n)]);return y(t),r?t.slice(0,r):t}function x(e,o){let n=[];for(let r of S(e,o)){if(e.isIgnored(r.barrel_path)||e.isIgnored(r.original_path)||f(e,r.barrel_path)||m(e,r.barrel_path)&&a(e,r.barrel_path).length===0)continue;let i=N(e,r),t=i?.barrel_consumers??0,s=i?.direct_consumers??0;t!==0||s!==0||n.push({barrelFile:r.barrel_path,symbol:r.symbol,shortName:l(r.symbol),originalFile:r.original_path,barrelConsumers:t,directConsumers:s,...b(e,r.barrel_path)})}return n}function S(e,o){let n=o?"AND barrel_d.relative_path LIKE ?":"",r=o?[`%${o}%`]:[];return e.all(`SELECT DISTINCT
|
|
2
2
|
barrel_d.id AS barrel_doc_id,
|
|
3
3
|
barrel_d.relative_path AS barrel_path,
|
|
4
4
|
gs.id AS symbol_id,
|
|
@@ -58,4 +58,4 @@ import{a as R}from"./chunk-BTYDBDX5.js";import{a as _,d as f}from"./chunk-5CJ6AQ
|
|
|
58
58
|
${e.pathExclusionsFor("consumer_d")}
|
|
59
59
|
GROUP BY consumer_d.id
|
|
60
60
|
)`,o.barrel_doc_id,o.symbol_id,o.barrel_doc_id,o.original_doc_id)}function O(e,o,n){let r=[];for(let i of C(e,n))h(e,i,i)>0||r.push(...I(e,o,i));return r}function C(e,o){return d(e,{scope:o,includeIgnored:!1}).filter(n=>a(e,n).length>0||u(e,n).length>0)}function I(e,o,n){let r=a(e,n).filter(t=>t.sourcePath&&!e.isIgnored(t.sourcePath)).flatMap(t=>g(e,o,n,t.sourcePath,[A(t.specifier)])),i=u(e,n).filter(t=>t.sourcePath&&!e.isIgnored(t.sourcePath)).flatMap(t=>g(e,o,n,t.sourcePath,t.kind==="named"&&t.names.length>0?t.names:[t.kind==="star"?`* from ${t.sourcePath}`:`* namespace from ${t.sourcePath}`]));return[...r,...i]}function g(e,o,n,r,i){let t=o.definitionsForFile(r);return i.map(s=>{let c=t.find(E=>E.leaf===s);return{barrelFile:n,symbol:c?.symbol??`source-reexport:${n}:${s}`,shortName:c?l(c.symbol):s,originalFile:r,barrelConsumers:0,directConsumers:h(e,r,n),...b(e,n)}})}function A(e){return e.split("::").at(-1)?.split("/").at(-1)?.replace(/\.[^.]+$/,"")??e}function b(e,o){return _(e,o)?{actionTier:"signal",surfaceEvidence:["barrel file is declared on the package public surface"],recommendation:"Review the package API before removing this re-export; local consumers are zero, but external consumers may import through the public barrel."}:{actionTier:"direct",surfaceEvidence:[],recommendation:"Remove this unused re-export when the barrel is not part of an external API surface."}}function h(e,o,n){let r=new Set;for(let i of d(e,{includeIgnored:!1}))if(i!==n)for(let t of p(e,i))t.sourcePath===o&&r.add(i);return r.size}function D(e){let o=new Set,n=[];for(let r of e){let i=`${r.barrelFile}|${r.symbol}|${r.originalFile}`;o.has(i)||(o.add(i),n.push(r))}return n}function y(e){e.sort((o,n)=>n.directConsumers-o.directConsumers||o.barrelFile.localeCompare(n.barrelFile)||o.shortName.localeCompare(n.shortName))}export{$ as a};
|
|
61
|
-
//# sourceMappingURL=chunk-
|
|
61
|
+
//# sourceMappingURL=chunk-ROMKXEUM.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as I,f as W,g as Y}from"./chunk-5CJ6AQN7.js";import{a as x}from"./chunk-BGBBVSH4.js";import{b as U,
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as I,f as W,g as Y}from"./chunk-5CJ6AQN7.js";import{a as x}from"./chunk-BGBBVSH4.js";import{b as U,e as X,f as Z,g as $}from"./chunk-KSD6IWF4.js";import{a as _,f as z,g as J,i as N,j as Q}from"./chunk-MBVHEPHQ.js";import{a as B}from"./chunk-QEIGJJBC.js";import{a as j,g as k,h as T,j as V,k as G,s as D,u as H,v as O,w as P}from"./chunk-7XP7ZRSI.js";import{m as F}from"./chunk-JLZUM476.js";import{B as R,C as E,L as K}from"./chunk-TLTLJ4SW.js";import{a as q}from"./chunk-64MNV6AB.js";import{B as h,s as w,y as A}from"./chunk-M2TRDR25.js";function ee(n,e,t){let r=e.identifierResolution==="strict"?N:Q,l=e.candidateNames?z(e.candidateNames):null,o=0,f=0,m=0,p=0,y="";for(let a of e.paths)if(o+=1,y=a,!(!R(a)&&!(e.includeVueSfc&&E(a)))&&!n.isIgnored(a)&&!e.skipPath?.(a))try{if(l&&!J(A(n,a),l))continue;f+=1;let S=(s,u,v,b)=>{if(e.candidateNames&&!e.candidateNames.has(s))return;m+=1;let g=e.resolveTargets?e.resolveTargets({sourceFile:a,name:s,kind:u,defaultTargets:b}):b();for(let L of g)p+=1,t({sourceFile:a,name:s,target:L,occurrences:v,kind:u})},M=_(n,a);for(let[s,u]of M)S(s,"identifier",u.length,()=>r(n,a,s));for(let s of F(n,a,{includeCrossLanguageDispatchNames:e.includeCrossLanguageDispatchNames,includeRustAttributeNames:e.includeRustAttributeNames})){let u=s.kind==="cross-language-dispatch"?()=>N(n,a,s.name):()=>r(n,a,s.name);S(s.name,s.kind,s.occurrences,u)}}finally{e.afterPath?.(a),o%10===0&&w("source-reference-scan.progress",()=>{},()=>({scannedPaths:o,currentPath:y,candidateMatchedPaths:f,visitedNames:m,visitedHits:p}))}}function ne(n,e={}){let{scope:t,files:r,minLoc:l=1,maxLoc:o=Number.POSITIVE_INFINITY,excludeSymbol:f,excludeEntrySurfaces:m=!1,excludeTypesFiles:p=!1,excludeRootedSymbols:y=!1,requireFunctionLikeSymbol:a=!1,requireCallableSymbol:C=!1,excludeRustTraitImplMembers:S=!1,includeSuppressed:M=!1,sortByLocDesc:s=!1}=e,u=[],v=re(n,{scope:t,files:r,requireFunctionLikeSymbol:a,requireCallableSymbol:C}),b=new Map,g=new Map,L=i=>{let c=b.get(i);if(c!==void 0)return c;let d=W(n,i);return b.set(i,d),d},ie=i=>{let c=g.get(i);if(c!==void 0)return c;let d=I(i);return g.set(i,d),d};for(let i of v){let c=i.relativePath;if(n.isIgnored(c)||m&&L(c)||!oe(i,{requireFunctionLikeSymbol:a,requireCallableSymbol:C})||f!==void 0&&i.symbol===f)continue;let d=x(i);d<l||d>o||p&&ae(c)||y&&Y(n,i.symbol,c)||S&&V(i.symbol)||ie(c)!=="test"&&(G(i.symbol)||!M&&h(n,c,i.startLine)||u.push(i))}return s?u.sort((i,c)=>x(c)-x(i)):u}function re(n,e){return e.files!==void 0?[...new Set(e.files.map(r=>r.replace(/\\/g,"/")))].sort().filter(r=>!e.scope||r.includes(e.scope)).flatMap(r=>D(n,r)):e.requireCallableSymbol?P(n,{scope:e.scope,symbolMatches:k,sqlPrefilter:"callable"}):e.requireFunctionLikeSymbol?P(n,{scope:e.scope,symbolMatches:T,sqlPrefilter:"function-like"}):O(n,e.scope)}function oe(n,e){return e.requireCallableSymbol?k(n.symbol):e.requireFunctionLikeSymbol?T(n.symbol):n.isFunctionLike}function ae(n){return(n.split("/").pop()??"").includes("types")}var te=class{constructor(e){this.db=e}db;scopedDefinitions(e){return H(this.db,e)}definitionsForFile(e){return D(this.db,e)}productionCallableDefinitions(e={}){return ne(this.db,e)}calleeMap(e,t={}){return U(this.db,e,t)}crossFileCallerMap(e,t={}){return X(this.db,e,t)}sourceFallbackCallerFiles(e,t={}){return Z(this.db,e,t)}callerFileMap(e,t={}){return $(this.db,e,t)}frameworkReferencedSymbolIds(e){let t=new Map;for(let l of e){if(!l.leaf)continue;let o=t.get(l.leaf)??[];o.push(l.symbolId),t.set(l.leaf,o)}let r=new Set;for(let l of q(this.db,{includeIgnored:!1}))if(R(l)==="rust")for(let{name:o}of F(this.db,l,{includeRustAttributeNames:!0}))for(let f of t.get(o)??[])r.add(f);return r}symbolsWithNonSelfCallees(e,t={}){if(e.length===0)return new Set;let r=new Map(e.map(o=>[o.symbolId,o.symbol])),l=this.calleeMap(e,t);return new Set([...l.entries()].filter(([o,f])=>{let m=r.get(o);return f.some(p=>p.symbol!==m)}).map(([o])=>o))}fileDependencyGraph(e){return B(this.db,e)}fileKind(e){return I(e)}hasSuppressionComment(e){return h(this.db,e.relativePath,e.startLine)}sourceFiles(){return K(this.db)}scanSourceReferences(e,t){ee(this.db,e,t)}callableSignature(e){let t=j(this.db).forFile(e.relativePath,{facts:!0}).facts?.callables.find(r=>r.startLine===e.startLine&&r.endLine===e.endLine);return t?{paramCount:t.paramCount}:null}};export{te as a};
|
|
2
|
+
//# sourceMappingURL=chunk-RUV4KHWA.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{a as j}from"./chunk-TAB7AWKO.js";import{a as N,b as g,c as R}from"./chunk-
|
|
1
|
+
import{a as j}from"./chunk-TAB7AWKO.js";import{a as N,b as g,c as R}from"./chunk-4QBRVI7D.js";import{a as _}from"./chunk-BGUYAA3Q.js";import{a as E}from"./chunk-B75HZHUP.js";import{a as P}from"./chunk-RUV4KHWA.js";import{a as k}from"./chunk-BGBBVSH4.js";import{h as C}from"./chunk-KSD6IWF4.js";import{a as w}from"./chunk-MBVHEPHQ.js";import{d,e as y,k as v,z as L}from"./chunk-7XP7ZRSI.js";import{i as S}from"./chunk-JLZUM476.js";import{s as x}from"./chunk-M2TRDR25.js";import{basename as m,extname as b}from"path";function ae(t,n){let{scope:e,maxLoc:i=15,limit:a=30,scanLimit:o}=n??{},r=new P(t),s=z(r.fileDependencyGraph(e));return _({candidates:()=>B(t,r,e,i),orderCandidates:E,scanLimit:o,profile:{name:"wrapper-candidates"},prepare:l=>({callerFileMap:A(t,r,l,{semantic:n?.semantic!==!1}),reverseFanIn:s}),evaluate:(l,u)=>O(t,r,l,u),orderResults:(l,u)=>u.callerFanIn-l.callerFanIn||u.loc-l.loc,limit:a})}function A(t,n,e,i){let a=N(t,n),o=g(a.forDefinitions(e,{semantic:!1,sourceFallback:!1})),r=[];i.semantic&&x("wrapper.semantic-candidates",()=>{r=e.filter(c=>F(t,n,c,o).length<=1)},()=>({symbols:e.length,semanticCandidates:r.length}));let s=r.length===0?new Map:g(a.forDefinitions(r,{semantic:!0,sourceFallback:!1})),l=s.size===0?o:C(o,s),u=new Map(e.map(c=>[c.symbolId,c])),f=new Map;for(let c of e){let I=F(t,n,c,l);if(I.length>1||(f.set(c.symbolId,c),I.length!==1))continue;let D=I[0],M=T(t,c.symbolId,D);if(!M)continue;let p=W(n,t,D,c.symbol,M);p?.isFunctionLike&&u.has(p.symbolId)&&f.set(p.symbolId,u.get(p.symbolId))}let h=[...f.values()];return h.length===0?l:C(l,g(a.forDefinitions(h,{semantic:!1,sourceFallback:!0})))}function O(t,n,e,i){let a=F(t,n,e,i.callerFileMap);if(a.length!==1)return null;let o=a[0],r=T(t,e.symbolId,o);if(!r)return null;let s=W(n,t,o,e.symbol,r);if(s&&v(s.symbol))return null;let{fanIn:l,source:u}=J(i.callerFileMap,i.reverseFanIn,o,s);if(u==="function"?l<=3:l<=5)return null;let f=H(t,e,o,s);return{symbol:e.symbol,shortName:d(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:k(e),singleCaller:s?.symbol??"",singleCallerShort:s?.isFunctionLike?d(s.symbol):m(o),callerFanIn:l,actionTier:f.length>0?"signal":"direct",boundaryEvidence:f}}function B(t,n,e,i){return n.productionCallableDefinitions({scope:e,minLoc:2,maxLoc:i,requireFunctionLikeSymbol:!0,excludeRootedSymbols:!0,excludeRustTraitImplMembers:!0}).filter(a=>!S(t,a))}function F(t,n,e,i){let a=m(e.relativePath,b(e.relativePath)),o=[...i.get(e.symbolId)??[]].filter(r=>r!==e.relativePath).filter(r=>m(r,b(r))!==a).filter(r=>{let s=n.fileKind(r);return s!=="barrel"&&s!=="entry"&&s!=="test"});return R(t,e,o).realConsumers}function T(t,n,e){return t.get(`SELECT c.start_line, c.end_line
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
JOIN documents d ON c.document_id = d.id
|
|
5
5
|
WHERE m.symbol_id = ? AND m.role != 1 AND d.relative_path = ?
|
|
6
6
|
LIMIT 1`,n,e)}function W(t,n,e,i,a){let o=t.definitionsForFile(e),r=q(n,e,i,a.start_line,a.end_line);return L(o,r)}function J(t,n,e,i){if(i?.isFunctionLike){let a=[...t.get(i.symbolId)??[]].filter(o=>o!==i.relativePath);if(a.length>0)return{fanIn:a.length,source:"function"}}return{fanIn:G(n,e),source:"file"}}function q(t,n,e,i,a){let o=y(e);if(!o)return i;let r=w(t,n).get(o);if(!r||r.length===0)return i;for(let s of r)if(s>=i&&s<=a)return s;return i}function z(t){let n=new Map;for(let[e,i]of t){n.has(e)||n.set(e,n.get(e)??0);for(let a of i)n.set(a,(n.get(a)??0)+1)}return n}function G(t,n){let e=t.get(n)??0;if(e>0)return e;let i=m(n,b(n)),a=0;for(let[o,r]of t)o!==n&&m(o,b(o))===i&&r>a&&(a=r);return a}function H(t,n,e,i){return j(t,n.relativePath,n.startLine,"wrapper","explicit ignore-wrapper comment",[{label:"wrapper name",value:d(n.symbol)},{label:"caller name",value:i?.symbol?d(i.symbol):m(e)},{label:"wrapper path",value:n.relativePath},{label:"caller path",value:e}])}export{ae as a};
|
|
7
|
-
//# sourceMappingURL=chunk-
|
|
7
|
+
//# sourceMappingURL=chunk-S22ICAWV.js.map
|