scip-query 0.6.6 → 0.6.9

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.
Files changed (177) hide show
  1. package/README.md +20 -1
  2. package/dist/chunk-2OP63JQQ.js +2 -0
  3. package/dist/chunk-33Z6HQBX.js +5 -0
  4. package/dist/chunk-3F453KPT.js +2 -0
  5. package/dist/{chunk-7PRMSA4Z.js → chunk-3JGBAAP7.js} +2 -2
  6. package/dist/chunk-3PKPUCIJ.js +11 -0
  7. package/dist/chunk-42BWO2NN.js +2 -0
  8. package/dist/chunk-4MDCFY3E.js +2 -0
  9. package/dist/chunk-4QWTQ6YV.js +2 -0
  10. package/dist/{chunk-Y4DS3MDC.js → chunk-5IRX5I64.js} +2 -2
  11. package/dist/chunk-5MPZ2A7J.js +2 -0
  12. package/dist/chunk-67OMD56K.js +90 -0
  13. package/dist/chunk-6UVVA5I4.js +7 -0
  14. package/dist/{chunk-OQZF2DQJ.js → chunk-AXHDRSRI.js} +2 -2
  15. package/dist/{chunk-TLRA5TR6.js → chunk-BAA4EJRX.js} +2 -2
  16. package/dist/{chunk-ZHHMG4UC.js → chunk-BT36WY5B.js} +2 -2
  17. package/dist/chunk-CLKFDBS6.js +39 -0
  18. package/dist/{chunk-CSRPJCWO.js → chunk-CWMWTHV3.js} +2 -2
  19. package/dist/chunk-DXO2ECRF.js +7 -0
  20. package/dist/chunk-EHEZLULQ.js +85 -0
  21. package/dist/{chunk-PIRXZGV6.js → chunk-GRAEZYYU.js} +2 -2
  22. package/dist/chunk-GWBRU65E.js +2 -0
  23. package/dist/chunk-I2KUHGMX.js +16 -0
  24. package/dist/chunk-I5BB33E6.js +10 -0
  25. package/dist/{chunk-YXMHTJYY.js → chunk-IIKNAXAE.js} +2 -2
  26. package/dist/{chunk-MXWC53GJ.js → chunk-IX45SWX5.js} +2 -2
  27. package/dist/{chunk-ERRUE5G4.js → chunk-JLFAQ2E2.js} +2 -2
  28. package/dist/chunk-JMASYYSW.js +2 -0
  29. package/dist/{chunk-E2V5SE6M.js → chunk-LBWLO7NA.js} +2 -2
  30. package/dist/{chunk-MO65UK5V.js → chunk-LLDPR3DG.js} +2 -2
  31. package/dist/chunk-LNUZWWWL.js +2 -0
  32. package/dist/{chunk-QFZE73XF.js → chunk-NLJCXHFU.js} +8 -8
  33. package/dist/chunk-NRAJIFQA.js +2 -0
  34. package/dist/chunk-OYRGWW6Z.js +2 -0
  35. package/dist/chunk-PVMRIOM6.js +33 -0
  36. package/dist/chunk-SF2HYG53.js +4 -0
  37. package/dist/chunk-SHGPRVWH.js +2 -0
  38. package/dist/chunk-SMOUOKAO.js +2 -0
  39. package/dist/chunk-TPXWXKL6.js +2 -0
  40. package/dist/chunk-TTCUMJ43.js +19 -0
  41. package/dist/chunk-TYR7QY5G.js +2 -0
  42. package/dist/{chunk-HVNVO6UW.js → chunk-U3GYMGBX.js} +2 -2
  43. package/dist/{chunk-Q2ALKKSE.js → chunk-UIM4WALN.js} +2 -2
  44. package/dist/chunk-UZG3QXTG.js +2 -0
  45. package/dist/{chunk-7LSCW7NF.js → chunk-V4WRHJU3.js} +2 -2
  46. package/dist/chunk-VDMRAGBK.js +6 -0
  47. package/dist/chunk-W6SRVK2Y.js +5 -0
  48. package/dist/{chunk-QFBJZHMV.js → chunk-WGYJDGBI.js} +2 -2
  49. package/dist/{chunk-KBGFYKOJ.js → chunk-WYX3RU2K.js} +2 -2
  50. package/dist/chunk-WZYA234B.js +2 -0
  51. package/dist/{chunk-O6VBAW7P.js → chunk-Y6ZFXZ7B.js} +2 -2
  52. package/dist/chunk-YCN5XEST.js +7 -0
  53. package/dist/{chunk-DLWRLPKO.js → chunk-ZO5IFJRM.js} +2 -2
  54. package/dist/cli.js +198 -166
  55. package/dist/{db-BZPa7dzJ.d.ts → db-Rx8Ho_JF.d.ts} +4 -0
  56. package/dist/index.d.ts +13 -6
  57. package/dist/index.js +23 -23
  58. package/dist/queries/affected.d.ts +1 -1
  59. package/dist/queries/affected.js +1 -1
  60. package/dist/queries/bottlenecks.d.ts +3 -1
  61. package/dist/queries/bottlenecks.js +1 -1
  62. package/dist/queries/by-kind.d.ts +1 -1
  63. package/dist/queries/by-kind.js +1 -1
  64. package/dist/queries/call-graph.d.ts +4 -2
  65. package/dist/queries/call-graph.js +1 -1
  66. package/dist/queries/change-surface.d.ts +4 -2
  67. package/dist/queries/change-surface.js +1 -1
  68. package/dist/queries/code.d.ts +1 -1
  69. package/dist/queries/code.js +1 -1
  70. package/dist/queries/complexity-hotspots.d.ts +3 -1
  71. package/dist/queries/complexity-hotspots.js +1 -1
  72. package/dist/queries/complexity.d.ts +4 -2
  73. package/dist/queries/complexity.js +1 -1
  74. package/dist/queries/convergence.d.ts +4 -2
  75. package/dist/queries/convergence.js +1 -1
  76. package/dist/queries/coupling.d.ts +1 -1
  77. package/dist/queries/coupling.js +1 -1
  78. package/dist/queries/cycles.d.ts +1 -1
  79. package/dist/queries/cycles.js +1 -1
  80. package/dist/queries/dataflow.d.ts +4 -2
  81. package/dist/queries/dataflow.js +1 -1
  82. package/dist/queries/dead.d.ts +1 -1
  83. package/dist/queries/dead.js +1 -1
  84. package/dist/queries/deep-chains.d.ts +1 -1
  85. package/dist/queries/deep-chains.js +1 -1
  86. package/dist/queries/deps.d.ts +1 -1
  87. package/dist/queries/deps.js +1 -1
  88. package/dist/queries/diff-impact.d.ts +20 -2
  89. package/dist/queries/diff-impact.js +1 -1
  90. package/dist/queries/drift.d.ts +2 -1
  91. package/dist/queries/drift.js +1 -1
  92. package/dist/queries/extract-candidates.d.ts +3 -1
  93. package/dist/queries/extract-candidates.js +1 -1
  94. package/dist/queries/fan.d.ts +1 -1
  95. package/dist/queries/fan.js +1 -1
  96. package/dist/queries/files.d.ts +1 -1
  97. package/dist/queries/health-cache-control.d.ts +15 -0
  98. package/dist/queries/health-cache-control.js +2 -0
  99. package/dist/queries/health.d.ts +66 -2
  100. package/dist/queries/health.js +1 -1
  101. package/dist/queries/hierarchy.d.ts +1 -1
  102. package/dist/queries/hierarchy.js +1 -1
  103. package/dist/queries/hotspots.d.ts +1 -1
  104. package/dist/queries/hotspots.js +1 -1
  105. package/dist/queries/imports.d.ts +7 -3
  106. package/dist/queries/imports.js +1 -1
  107. package/dist/queries/index.d.ts +3 -3
  108. package/dist/queries/index.js +1 -1
  109. package/dist/queries/isolated.d.ts +3 -1
  110. package/dist/queries/isolated.js +1 -1
  111. package/dist/queries/members.d.ts +1 -1
  112. package/dist/queries/members.js +1 -1
  113. package/dist/queries/methods.d.ts +1 -1
  114. package/dist/queries/methods.js +1 -1
  115. package/dist/queries/outline.d.ts +1 -1
  116. package/dist/queries/outline.js +1 -1
  117. package/dist/queries/passthrough-candidates.d.ts +3 -1
  118. package/dist/queries/passthrough-candidates.js +1 -1
  119. package/dist/queries/redundant-reexports.d.ts +1 -1
  120. package/dist/queries/redundant-reexports.js +1 -1
  121. package/dist/queries/refs.d.ts +4 -2
  122. package/dist/queries/refs.js +1 -1
  123. package/dist/queries/similar-chains.d.ts +1 -1
  124. package/dist/queries/similar-chains.js +1 -1
  125. package/dist/queries/similar-files.d.ts +1 -1
  126. package/dist/queries/similar-files.js +1 -1
  127. package/dist/queries/similar-signatures.d.ts +3 -1
  128. package/dist/queries/similar-signatures.js +1 -1
  129. package/dist/queries/similar.d.ts +5 -1
  130. package/dist/queries/similar.js +1 -1
  131. package/dist/queries/slice.d.ts +2 -1
  132. package/dist/queries/slice.js +1 -1
  133. package/dist/queries/stale-abstractions.d.ts +5 -2
  134. package/dist/queries/stale-abstractions.js +1 -1
  135. package/dist/queries/stats.d.ts +1 -1
  136. package/dist/queries/surface.d.ts +1 -1
  137. package/dist/queries/surface.js +1 -1
  138. package/dist/queries/symbols.d.ts +1 -1
  139. package/dist/queries/symbols.js +1 -1
  140. package/dist/queries/system.d.ts +1 -1
  141. package/dist/queries/system.js +1 -1
  142. package/dist/queries/trace.d.ts +4 -2
  143. package/dist/queries/trace.js +1 -1
  144. package/dist/queries/wrapper-candidates.d.ts +3 -1
  145. package/dist/queries/wrapper-candidates.js +1 -1
  146. package/package.json +1 -1
  147. package/dist/chunk-25HOGELX.js +0 -2
  148. package/dist/chunk-2TLYCK2L.js +0 -11
  149. package/dist/chunk-3PVIYZ74.js +0 -84
  150. package/dist/chunk-4TX5IMMK.js +0 -12
  151. package/dist/chunk-6DVA22YE.js +0 -2
  152. package/dist/chunk-6GPFHZP3.js +0 -2
  153. package/dist/chunk-7X7FLQC5.js +0 -2
  154. package/dist/chunk-7YI2M2AQ.js +0 -2
  155. package/dist/chunk-AADJ7MCQ.js +0 -2
  156. package/dist/chunk-AV7BOODV.js +0 -4
  157. package/dist/chunk-AXP4H62Q.js +0 -6
  158. package/dist/chunk-C4C3T4K3.js +0 -2
  159. package/dist/chunk-CYJMOTIH.js +0 -2
  160. package/dist/chunk-GBDZY73J.js +0 -2
  161. package/dist/chunk-GPY33RTH.js +0 -19
  162. package/dist/chunk-I377UMS2.js +0 -2
  163. package/dist/chunk-IKQYNTW3.js +0 -2
  164. package/dist/chunk-IZ4KV37N.js +0 -7
  165. package/dist/chunk-KW2F3WSV.js +0 -5
  166. package/dist/chunk-NIN762LD.js +0 -5
  167. package/dist/chunk-Q4R2IYA3.js +0 -7
  168. package/dist/chunk-QPJG6VRT.js +0 -16
  169. package/dist/chunk-TUV2VI7D.js +0 -7
  170. package/dist/chunk-UAPNU7UP.js +0 -2
  171. package/dist/chunk-URCJTFOD.js +0 -2
  172. package/dist/chunk-UUIWMLDX.js +0 -39
  173. package/dist/chunk-VEXS3I3N.js +0 -2
  174. package/dist/chunk-VRC3WKKE.js +0 -2
  175. package/dist/chunk-WFDTS7XL.js +0 -2
  176. package/dist/chunk-YJODB2F5.js +0 -2
  177. package/dist/chunk-Z4AMQWVY.js +0 -90
@@ -1,5 +0,0 @@
1
- import{a as b,b as w,c as q,d as X,e as Z,f as T,g as O,h as _,i as U,j as B,k as h,l as W,m as J}from"./chunk-Z4AMQWVY.js";import{a as $,c as H,d as k,f as j,g as Q,h as g}from"./chunk-QFZE73XF.js";function Y(e){return e.replace(/'''[\s\S]*?'''/g,C).replace(/"""[\s\S]*?"""/g,C).replace(/#.*$/gm,C).replace(/\/\/.*$/gm,C).replace(/\/\*[\s\S]*?\*\//g,C).replace(/`(?:\\[\s\S]|[^`])*`/g,C).replace(/'(?:\\.|[^'\\\r\n])*'/g,C).replace(/"(?:\\.|[^"\\\r\n])*"/g,C)}function C(e){return e.replace(/[^\r\n]/g," ")}var Ie=H("stripped-lines");function Dt(e,r,t){return Ie.get(e,r,t,()=>Y(t).split(`
2
- `))}var K=null,z="";function Pe(e){return K===e||(K=e,z=Y(e)),z}function E(e,r,t){let s=Pe(e);return`${s.slice(0,r)}${" ".repeat(t-r)}${s.slice(t)}`}function S(e,r){return new RegExp(`\\b${G(r)}\\b`,"m").test(e)}function A(e,r){let t=new Set,s=new RegExp(`\\b${G(r)}\\s*\\.\\s*([A-Za-z_$][\\w$]*)`,"g");for(let n of e.matchAll(s)){let i=n[1];i&&t.add(i)}return[...t]}function G(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var be=new Set(["identifier","type_identifier","property_identifier","shorthand_property_identifier","field_identifier"]);function x(e){let r=[],t=0,s=0;for(let n=0;n<e.length;n++){let i=e[n];(i==="{"||i==="["||i==="(")&&t++,(i==="}"||i==="]"||i===")")&&t--,i===","&&t===0&&(r.push(e.slice(s,n)),s=n+1)}return r.push(e.slice(s)),r}function y(e,r){for(let t of e.namedChildren)if(t.type===r)return t;return null}function f(e,r){let t=new Set,s=(n,i)=>{let o=i||r.has(n.type);!o&&be.has(n.type)&&t.add(n.text);for(let a of n.children)s(a,o)};return s(e.rootNode,!1),t}function P(e,r,t,s,n,i,o){return{importedName:n,localName:i,sourcePath:o??h(e,s,Z(r)),kind:"named",used:S(t,i),usedMembers:[]}}function N(e,r,t){let s=[];for(let n of e.matchAll(r)){let i=n[0];if(!i||typeof n.index!="number")continue;let o=E(e,n.index,n.index+i.length);for(let a of t(n,o))s.push(a)}return s}function te(e,r,t){let s=g(e,r);return s?_e(e,r,s):je(t).flatMap(n=>we(e,r,n.clause,n.specifier,n.start,n.end,t))}function _e(e,r,t){let s=Ce(e,r,t),n=[];for(let i of t.rootNode.descendantsOfType("import_statement"))n.push(...Ee(e,r,t,i,s));return n}function Ce(e,r,t){let s=f(t,new Set(["import_statement"]));if(Q(r))for(let n of Xe(e,r))s.add(n);return s}function Ee(e,r,t,s,n){let i=Me(s);if(!i)return[];let o=T(e,r,i),a=y(s,"import_clause");return a?Re(t,a,o,n,$e(s.text)):[Te(o)]}function Re(e,r,t,s,n){let i=[];for(let o of r.namedChildren)if(o.type==="identifier")i.push(De(o.text,t,s,n));else if(o.type==="namespace_import"){let a=ke(e,o,t,s,n);a&&i.push(a)}else o.type==="named_imports"&&i.push(...Ae(o,t,s,n));return i}function Te(e){return{importedName:"*",localName:null,sourcePath:e,kind:"side-effect",used:!0,usedMembers:[]}}function De(e,r,t,s){return{importedName:"default",localName:e,sourcePath:r,kind:"default",used:t.has(e),usedMembers:[],isTypeOnly:s}}function ke(e,r,t,s,n){let o=y(r,"identifier")?.text??"";if(!o)return null;let a=Le(e,o);return{importedName:"*",localName:o,sourcePath:t,kind:"namespace",used:a.length>0||s.has(o),usedMembers:a,isTypeOnly:n}}function Ae(e,r,t,s){let n=[];for(let i of e.namedChildren){if(i.type!=="import_specifier")continue;let o=i.namedChild(0),a=i.namedChild(1);if(!o)continue;let c=o.text,p=a?.text??c;n.push({importedName:c,localName:p,sourcePath:r,kind:"named",used:t.has(p),usedMembers:[],isTypeOnly:s||Oe(i.text)})}return n}function Me(e){let r=y(e,"string");if(!r)return null;let t=y(r,"string_fragment");return t?t.text:null}function $e(e){return/^\s*import\s+type\b/.test(e)}function Oe(e){return/^\s*type\b/.test(e.trim())}function Le(e,r){let t=new Set;for(let s of e.rootNode.descendantsOfType("member_expression")){let n=s.namedChild(0),i=s.namedChild(1);!n||!i||n.type!=="identifier"||n.text!==r||(i.type==="property_identifier"||i.type==="identifier")&&t.add(i.text)}return[...t]}function je(e){let r=[],t=/^[ \t]*import\s+([\s\S]*?)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let n of e.matchAll(t)){let i=n[0],o=n[1],a=n[2];!i||!a||typeof n.index!="number"||r.push({clause:o,specifier:a,start:n.index,end:n.index+i.length})}let s=/^[ \t]*import\s+['"]([^'"]+)['"]\s*;?/gm;for(let n of e.matchAll(s)){let i=n[0],o=n[1];!i||!o||typeof n.index!="number"||r.push({clause:null,specifier:o,start:n.index,end:n.index+i.length})}return r.sort((n,i)=>n.start-i.start)}function we(e,r,t,s,n,i,o){let a=T(e,r,s),c=E(o,n,i);return t?ve(t).map(u=>({...u,sourcePath:a})).map(u=>{if(u.kind==="namespace"){let m=A(c,u.localName);return{...u,used:m.length>0||S(c,u.localName),usedMembers:m}}return u.kind==="side-effect"?{...u,used:!0,usedMembers:[]}:{...u,used:u.localName?S(c,u.localName):!1,usedMembers:[]}}):[{importedName:"*",localName:null,sourcePath:a,kind:"side-effect",used:!0,usedMembers:[]}]}function ve(e){let r=e.trim(),t=/^type\b/.test(r),s=r.replace(/^type\s+/,""),[n,i]=qe(s),o=[];return n&&o.push(...ee(n,t)),i&&o.push(...ee(i,t)),o}function ee(e,r){let t=e.trim();if(!t)return[];if(t.startsWith("{")){let s=t.slice(1,-1).trim();return s?x(s).map(n=>{let i=n.trim(),o=r||/^type\b/.test(i),a=i.replace(/^type\s+/,""),[c,p]=a.split(/\s+as\s+/);return{importedName:c.trim(),localName:(p??c).trim(),kind:"named",isTypeOnly:o}}):[]}return t.startsWith("* as ")?[{importedName:"*",localName:t.slice(5).trim(),kind:"namespace",isTypeOnly:r}]:[{importedName:"default",localName:t,kind:"default",isTypeOnly:r}]}function qe(e){let r=0;for(let t=0;t<e.length;t++){let s=e[t];if(s==="{"&&r++,s==="}"&&r--,s===","&&r===0)return[e.slice(0,t).trim(),e.slice(t+1).trim()]}return[e.trim(),null]}function re(e,r){let t=g(e,r);if(t)return Fe(e,r,t);let s=k(e,r);return s?Ue(e,r,s):[]}function Ue(e,r,t){return[...Be(e,r,t),...We(e,r,t),...Je(e,r,t)]}function Be(e,r,t){let s=[],n=/^[ \t]*export\s+(?:type\s+)?\{([\s\S]*?)\}\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let i of t.matchAll(n)){if(typeof i.index!="number")continue;let o=i[1]??"",a=i[2]??"",c=x(o).map(m=>ze(m.trim())).filter(m=>!!m),p=M(t,i.index),u=M(t,i.index+i[0].length-1);s.push({kind:"named",sourcePath:T(e,r,a),names:c,startLine:p,endLine:u})}return s}function We(e,r,t){let s=[],n=/^[ \t]*export\s+\*\s+as\s+(\w+)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let i of t.matchAll(n)){if(typeof i.index!="number")continue;let o=i[2]??"",a=M(t,i.index),c=M(t,i.index+i[0].length-1);s.push({kind:"star-as",sourcePath:T(e,r,o),names:[],startLine:a,endLine:c})}return s}function Je(e,r,t){let s=[],n=/^[ \t]*export\s+\*\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let i of t.matchAll(n)){if(typeof i.index!="number")continue;let o=i[1]??"",a=M(t,i.index),c=M(t,i.index+i[0].length-1);s.push({kind:"star",sourcePath:T(e,r,o),names:[],startLine:a,endLine:c})}return s}function ze(e){if(!e)return null;let r=e.replace(/^type\s+/,"").trim();if(!r)return null;let t=r.match(/^(\w+)\s+as\s+(\w+)$/);if(t)return t[2]??null;let s=r.match(/^(\w+)$/);return s?s[1]??null:null}function M(e,r){let t=0;for(let s=0;s<r&&s<e.length;s++)e.charCodeAt(s)===10&&t++;return t}function Fe(e,r,t){let s=[];for(let n of t.rootNode.descendantsOfType("export_statement")){let i=Ve(e,r,n);if(i===void 0)continue;let o=n.startPosition.row,a=n.endPosition.row,c=He(n,i,o,a);s.push(c)}return s}function Ve(e,r,t){let s=y(t,"string");if(!s)return;let n=y(s,"string_fragment");if(n)return T(e,r,n.text)}function He(e,r,t,s){let n=y(e,"export_clause");if(n){let o=[];for(let a of n.namedChildren){if(a.type!=="export_specifier")continue;let c=a.namedChild(0),p=a.namedChild(1);c&&o.push((p??c).text)}return{kind:"named",sourcePath:r,names:o,startLine:t,endLine:s}}return y(e,"namespace_export")?{kind:"star-as",sourcePath:r,names:[],startLine:t,endLine:s}:{kind:"star",sourcePath:r,names:[],startLine:t,endLine:s}}var Qe=$("vue-non-script-identifiers");function Xe(e,r){return Qe.get(e,r,()=>{let t=new Set,s=k(e,r);if(!s)return t;let i=s.replace(/<script\b[^>]*>[\s\S]*?<\/script>/g,o=>o.replace(/[^\r\n]/g," ")).replace(/<!--[\s\S]*?-->/g,o=>o.replace(/[^\r\n]/g," ")).replace(/\/\*[\s\S]*?\*\//g,o=>o.replace(/[^\r\n]/g," "));for(let o of i.matchAll(/[A-Za-z_$][\w$]*/g))t.add(o[0]);return t})}import{basename as se}from"path";function ne(e,r,t){let s=g(e,r);return s?Ze(e,r,s):N(t,/^[ \t]*#include\s+[<"]([^">]+)[">]\s*$/gm,(n,i)=>{let o=n[1]?.trim();if(!o)return[];let a=se(o).replace(/\.[^.]+$/,"");return[{importedName:o,localName:a,sourcePath:B(e,r,o),kind:"named",used:S(i,a),usedMembers:[]}]})}function Ze(e,r,t){let s=f(t,new Set(["preproc_include"])),n=[];for(let i of t.rootNode.descendantsOfType("preproc_include")){let o=null;for(let c of i.namedChildren){if(c.type==="system_lib_string"){o=c.text.replace(/^<|>$/g,"");break}if(c.type==="string_literal"){o=c.namedChildren.find(u=>u.type==="string_content")?.text??c.text.replace(/^"|"$/g,"");break}}if(!o)continue;let a=se(o).replace(/\.[^.]+$/,"");n.push({importedName:o,localName:a,sourcePath:B(e,r,o),kind:"named",used:s.has(a),usedMembers:[]})}return n}function oe(e,r,t){let s=[];for(let n of t.matchAll(/^[ \t]*import\s+['"]([^'"]+)['"](?:\s+as\s+([A-Za-z_]\w*))?[\s\S]*?;$/gm)){let i=n[1]?.trim(),o=n[2]?.trim()??null,a=n[0];if(!i||!a||typeof n.index!="number")continue;let c=E(t,n.index,n.index+a.length);s.push({importedName:i,localName:o,sourcePath:W(e,r,i),kind:o?"namespace":"side-effect",used:o?S(c,o):!0,usedMembers:o?A(c,o):[]})}return s}function ie(e,r,t){let s=[];for(let n of t.matchAll(/^[ \t]*export\s+['"]([^'"]+)['"][\s\S]*?;$/gm)){let i=n[1]?.trim();i&&s.push({specifier:i,sourcePath:W(e,r,i)})}return s}function ae(e,r,t){let s=g(e,r),n=j(r);if(s&&n==="csharp")return Ye(e,r,s);if(s&&n==="vb")return Ke(e,r,s);let i=X(r)?/^[ \t]*Imports\s+(.+?)\s*$/gm:/^[ \t]*using\s+(.+?)\s*;$/gm;return N(t,i,(o,a)=>{let c=o[1]?.trim();if(!c)return[];let[p,u]=c.split(/\s*=\s*/),m=!!u,l=(m?u:p)?.trim()??c,d=l.split(".").pop()??l,I=m?p?.trim()??d:d;return[P(e,r,a,l,d,I,h(e,l,w))]})}function Ke(e,r,t){let s=f(t,new Set(["imports_statement"])),n=[];for(let i of t.rootNode.descendantsOfType("imports_statement")){let o=i.namedChildren.filter(l=>l.type==="namespace_name");if(o.length===0)continue;let a=o[o.length-1],c=o.length>1?o[0]:null,p=a.text,u=p.split(".").pop()??p,m=c?.text??u;n.push({importedName:u,localName:m,sourcePath:h(e,p,w),kind:c?"namespace":"named",used:s.has(m),usedMembers:[]})}return n}function Ye(e,r,t){let s=f(t,new Set(["using_directive"])),n=[];for(let i of t.rootNode.descendantsOfType("using_directive")){let o=i.namedChildren;if(o.length===0)continue;let a=null,c;o.length>=2&&o[0].type==="identifier"&&(o[1].type==="qualified_name"||o[1].type==="identifier")?(a=o[0],c=o[1]):c=o[o.length-1];let p=c.text,u=p.split(".").pop()??p,m=a?.text??u;n.push({importedName:u,localName:m,sourcePath:h(e,p,w),kind:a?"namespace":"named",used:s.has(m),usedMembers:[]})}return n}function ce(e,r,t){let s=g(e,r),n=j(r);return s&&n==="java"?Ge(e,r,s):s&&n==="kotlin"?et(e,r,s):s&&n==="scala"?tt(e,r,s):N(t,/^[ \t]*import\s+(?:static\s+)?(.+?)\s*;?$/gm,(i,o)=>{let a=i[1]?.trim();return a?rt(e,r,a,o):[]})}function Ge(e,r,t){let s=f(t,new Set(["import_declaration"])),n=[];for(let i of t.rootNode.descendantsOfType("import_declaration")){let o=i.children.some(m=>m.type==="asterisk"),c=i.namedChildren.find(m=>m.type==="scoped_identifier")??i.namedChildren.find(m=>m.type==="identifier");if(!c)continue;let p=c.text;if(o){n.push({importedName:"*",localName:null,sourcePath:h(e,p,b),kind:"namespace",used:!0,usedMembers:[]});continue}let u=p.split(".").pop()??p;n.push({importedName:u,localName:u,sourcePath:h(e,p,b),kind:"named",used:s.has(u),usedMembers:[]})}return n}function et(e,r,t){let s=f(t,new Set(["import_header","import_list"])),n=[];for(let i of t.rootNode.descendantsOfType("import_header")){let o=i.namedChildren.find(d=>d.type==="identifier");if(!o)continue;let a=i.namedChildren.some(d=>d.type==="wildcard_import"),c=i.namedChildren.find(d=>d.type==="import_alias");if(a){n.push({importedName:"*",localName:null,sourcePath:h(e,o.text,b),kind:"namespace",used:!0,usedMembers:[]});continue}let p=o.text,u=p.split(".").pop()??p,l=c?.namedChild(0)?.text??u;n.push({importedName:u,localName:l,sourcePath:h(e,p,b),kind:"named",used:s.has(l),usedMembers:[]})}return n}function tt(e,r,t){let s=f(t,new Set(["import_declaration"])),n=[];for(let i of t.rootNode.descendantsOfType("import_declaration")){let o=i.namedChildren.find(m=>m.type==="namespace_selectors"||m.type==="namespace_wildcard"),a=i.namedChildren.filter(m=>m!==o&&(m.type==="identifier"||m.type==="stable_identifier")),c=a.map(m=>m.text).join(".");if(!c)continue;if(o?.type==="namespace_wildcard"){n.push({importedName:"*",localName:null,sourcePath:h(e,c,b),kind:"namespace",used:!0,usedMembers:[]});continue}if(o?.type==="namespace_selectors"){for(let m of o.namedChildren)if(m.type==="arrow_renamed_identifier"){let[l,d]=m.namedChildren;if(!l)continue;let I=l.text,R=d?.text??I;if(I==="_")continue;n.push({importedName:I,localName:R,sourcePath:h(e,`${c}.${I}`,b),kind:"named",used:s.has(R),usedMembers:[]})}else if(m.type==="identifier"){let l=m.text;n.push({importedName:l,localName:l,sourcePath:h(e,`${c}.${l}`,b),kind:"named",used:s.has(l),usedMembers:[]})}continue}let p=a[a.length-1]?.text??c,u=a.slice(0,-1).map(m=>m.text).join(".")||c;n.push({importedName:p,localName:p,sourcePath:h(e,u&&a.length>1?`${u}.${p}`:c,b),kind:"named",used:s.has(p),usedMembers:[]})}return n}function rt(e,r,t,s){if(t.includes("{")&&t.includes("}")){let n=t.slice(0,t.indexOf("{")).replace(/\.$/,"").trim(),i=t.slice(t.indexOf("{")+1,t.lastIndexOf("}")).trim();return x(i).flatMap(o=>{let a=o.trim();if(!a)return[];let[c,p]=a.includes("=>")?a.split(/\s*=>\s*/):a.split(/\s+as\s+/),u=c?.trim();if(!u||u==="_")return[];let m=(p??u.split(".").pop()??u).trim(),l=u==="_"?n:`${n}.${u}`.replace(/\.\./g,".");return[P(e,r,s,l,u,m)]})}return[P(e,r,s,t,t.split(".").pop()??t,t.split(".").pop()??t)]}function me(e,r,t){let s=g(e,r);return s?st(e,r,s):N(t,/^[ \t]*use\s+(.+?)\s*;$/gm,(n,i)=>{let o=n[1]?.trim();return o?x(o).flatMap(a=>{let c=a.trim();if(!c)return[];let[p,u]=c.split(/\s+as\s+/i),m=p?.trim()??c,l=m.split("\\").pop()??m,d=(u??l).trim();return[P(e,r,i,m,l,d,h(e,m.replace(/\\/g,"."),q))]}):[]})}function st(e,r,t){let s=f(t,new Set(["namespace_use_declaration"])),n=[],i=(o,a,c)=>{n.push({importedName:a,localName:c,sourcePath:h(e,o.replace(/\\/g,"."),q),kind:"named",used:s.has(c),usedMembers:[]})};for(let o of t.rootNode.descendantsOfType("namespace_use_declaration")){let a=o.namedChildren.find(c=>c.type==="namespace_use_group");if(a){let c=o.namedChildren.find(p=>p.type==="namespace_name")?.text??"";for(let p of a.namedChildren){if(p.type!=="namespace_use_clause")continue;let{importedName:u,localName:m,qualified:l}=pe(p,c);u&&i(l,u,m)}continue}for(let c of o.namedChildren){if(c.type!=="namespace_use_clause")continue;let{importedName:p,localName:u,qualified:m}=pe(c,"");p&&i(m,p,u)}}return n}function pe(e,r){let t=e.namedChildren.find(p=>p.type==="qualified_name"),s=e.namedChildren.filter(p=>p.type==="name"),n="";t?n=t.text:s.length>=1&&(n=s[0].text);let i=t&&s.length>0?s[s.length-1]:null,o=n.split("\\").pop()??n,a=i?.text??o,c=r?`${r}\\${n}`:n;return{importedName:o,localName:a,qualified:c}}function de(e,r,t){let s=g(e,r);return s?nt(e,r,s):it(t).flatMap(n=>ct(e,r,n,t))}function nt(e,r,t){let s=f(t,new Set(["import_statement","import_from_statement"])),n=[];for(let i of t.rootNode.descendantsOfType("import_statement"))for(let o of i.namedChildren){let a=ue(o);if(!a)continue;let c=O(e,r,a.qualifiedName);n.push({importedName:a.qualifiedName,localName:a.localName,sourcePath:c,kind:"namespace",used:s.has(a.localName),usedMembers:[]})}for(let i of t.rootNode.descendantsOfType("import_from_statement")){let o=i.namedChild(0);if(!o)continue;let a=ot(o);if(a===null)continue;let c=O(e,r,a);for(let p=1;p<i.namedChildCount;p+=1){let u=i.namedChild(p);if(u.type==="wildcard_import"){n.push({importedName:"*",localName:null,sourcePath:c,kind:"side-effect",used:!0,usedMembers:[]});continue}let m=ue(u);m&&n.push({importedName:m.qualifiedName,localName:m.localName,sourcePath:c,kind:"named",used:s.has(m.localName),usedMembers:[]})}}return n}function ue(e){if(e.type==="aliased_import"){let r=e.namedChild(0),t=e.namedChild(1);return!r||!t?null:{qualifiedName:r.text,localName:t.text}}if(e.type==="dotted_name"){let r=e.text;return{qualifiedName:r,localName:r.split(".")[0]??r}}return e.type==="identifier"?{qualifiedName:e.text,localName:e.text}:null}function ot(e){if(e.type==="dotted_name")return e.text;if(e.type==="relative_import"){let r=y(e,"import_prefix")?.text??"",t=y(e,"dotted_name")?.text??"";return`${r}${t}`}return null}function it(e){let r=e.split(`
3
- `),t=[],s=0;for(let n=0;n<r.length;n++){let i=r[n],o=i.trimStart(),a=s;if(s+=i.length+1,!o.startsWith("import ")&&!o.startsWith("from "))continue;let c=i,p=a+i.length,u=le(i);for(;n+1<r.length&&(u>0||c.trimEnd().endsWith("\\"));){n++;let l=r[n];c+=`
4
- ${l}`,p+=1+l.length,u+=le(l),s+=l.length+1}let m=at(c);m&&t.push({...m,start:a,end:p})}return t}function at(e){let r=e.replace(/\\\s*\n/g," ").trim();if(r.startsWith("import "))return{kind:"import",module:null,clause:r.slice(7).trim()};let t=r.match(/^from\s+([.\w]+)\s+import\s+([\s\S]+)$/);if(!t)return null;let s=t[2].trim();return s.startsWith("(")&&s.endsWith(")")&&(s=s.slice(1,-1).trim()),{kind:"from",module:t[1],clause:s}}function ct(e,r,t,s){let n=E(s,t.start,t.end),i=t.clause.replace(/\n/g," ").trim();if(t.kind==="import")return x(i).flatMap(c=>{let p=c.trim().replace(/,$/,"");if(!p)return[];let[u,m]=p.split(/\s+as\s+/),l=u.trim(),d=(m??l.split(".")[0]??l).trim(),I=O(e,r,l),R=A(n,d);return[{importedName:l,localName:d,sourcePath:I,kind:"namespace",used:S(n,d)||R.length>0,usedMembers:R}]});let o=t.module?O(e,r,t.module):null,a=[];for(let c of x(i)){let p=c.trim().replace(/,$/,"");if(!p)continue;if(p==="*"){a.push({importedName:"*",localName:null,sourcePath:o,kind:"side-effect",used:!0,usedMembers:[]});continue}let[u,m]=p.split(/\s+as\s+/),l=(m??u).trim();a.push({importedName:u.trim(),localName:l,sourcePath:o,kind:"named",used:S(n,l),usedMembers:[]})}return a}function le(e){let r=0;for(let t of e)t==="("&&r++,t===")"&&r--;return r}import{basename as pt}from"path";function fe(e,r,t){let s=g(e,r);return s?mt(e,r,s):N(t,/^[ \t]*(require_relative|require)\s+["']([^"']+)["']\s*$/gm,(n,i)=>{let o=n[1],a=n[2];if(!o||!a)return[];let c=o==="require_relative"?U(e,r,a):null;if(c){let p=ge(a);return[{importedName:p,localName:p,sourcePath:c,kind:"named",used:S(i,p),usedMembers:[]}]}return[{importedName:a,localName:null,sourcePath:c,kind:"side-effect",used:!0,usedMembers:[]}]})}function mt(e,r,t){let s=f(t,new Set([])),n=[],i=new Set(["require","require_relative","load"]);for(let o of t.rootNode.descendantsOfType("call")){let a=o.namedChild(0);if(!a||a.type!=="identifier"||!i.has(a.text))continue;let p=o.namedChildren.find(d=>d.type==="argument_list")?.namedChild(0);if(!p||p.type!=="string")continue;let m=p.namedChildren.find(d=>d.type==="string_content")?.text;if(!m)continue;let l=a.text==="require_relative"?U(e,r,m):null;if(l){let d=ge(m);n.push({importedName:d,localName:d,sourcePath:l,kind:"named",used:s.has(d),usedMembers:[]})}else n.push({importedName:m,localName:null,sourcePath:l,kind:"side-effect",used:!0,usedMembers:[]})}return n}function ge(e){return pt(e).replace(/\.[^.]+$/,"").split("_").filter(Boolean).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")}function he(e,r,t){let s=g(e,r);return s?ut(e,r,s):N(t,/^[ \t]*use\s+(.+?)\s*;$/gm,(n,i)=>{let o=n[1]?.trim();return o?lt(e,r,o,i):[]})}function ut(e,r,t){let s=f(t,new Set(["use_declaration"])),n=[];for(let i of t.rootNode.descendantsOfType("use_declaration")){let o=i.namedChild(0);if(o)for(let a of L(o,"")){if(!a.importedName||a.importedName==="*")continue;let c=_(e,r,a.qualifiedName)??_(e,r,a.qualifiedName.split("::").slice(0,-1).join("::"));n.push({importedName:a.importedName,localName:a.localName,sourcePath:c,kind:"named",used:s.has(a.localName),usedMembers:[]})}}return n}function L(e,r){switch(e.type){case"identifier":case"super":case"self":case"crate":{let t=e.text;return[{qualifiedName:v(r,t),importedName:t,localName:t}]}case"scoped_identifier":{let t=e.text,s=t.split("::").pop()??t;return[{qualifiedName:v(r,t),importedName:s,localName:s}]}case"scoped_use_list":{let t=e.namedChild(0),s=e.namedChild(1);if(!t||!s)return[];let n=v(r,t.text),i=[];for(let o of s.namedChildren)i.push(...L(o,n));return i}case"use_list":{let t=[];for(let s of e.namedChildren)t.push(...L(s,r));return t}case"use_as_clause":{let t=e.namedChild(0),s=e.namedChild(1);if(!t||!s)return[];let n=L(t,r),i=s.text;return n.map(o=>({...o,localName:i}))}case"use_wildcard":{let t=e.namedChild(0),s=t?t.text:"";return[{qualifiedName:v(r,`${s}::*`),importedName:"*",localName:"*"}]}default:return[]}}function v(e,r){return e?r?`${e}::${r}`:e:r}function lt(e,r,t,s){let n=t.trim();if(n.includes("{")&&n.includes("}")){let u=n.slice(0,n.indexOf("{")).replace(/::$/,"").trim(),m=n.slice(n.indexOf("{")+1,n.lastIndexOf("}")).trim();return x(m).flatMap(l=>{let d=l.trim();if(!d||d==="self")return[];let[I,R]=d.split(/\s+as\s+/),D=I?.trim();if(!D)return[];let ye=(R??D.split("::").pop()??D).trim(),Ne=`${u}::${D}`.replace(/::::/g,"::");return[P(e,r,s,Ne,D.split("::").pop()??D,ye,_(e,r,u))]})}let[i,o]=n.split(/\s+as\s+/),a=i?.trim()??n,c=(o??a.split("::").pop()??a).trim(),p=_(e,r,a)??_(e,r,a.split("::").slice(0,-1).join("::"));return[P(e,r,s,a,a.split("::").pop()??a,c,p)]}function Se(e,r,t){let s=g(e,r);if(s)return dt(e,r,s);let n=[];for(let i of t.matchAll(/^[ \t]*pub\s+use\s+(.+?)\s*;$/gm)){let o=i[1]?.trim();o&&n.push(...gt(e,r,o))}return n}function dt(e,r,t){let s=[];for(let n of t.rootNode.descendantsOfType("use_declaration")){if(!ft(n))continue;let i=n.namedChildren.find(o=>o.type!=="visibility_modifier");if(i)for(let o of L(i,""))o.importedName&&s.push(F(e,r,o.qualifiedName))}return s}function ft(e){for(let r of e.children)if(r.type==="visibility_modifier"&&r.text.startsWith("pub"))return!0;return!1}function gt(e,r,t){let s=t.trim();if(s.includes("{")&&s.includes("}")){let n=s.slice(0,s.indexOf("{")).replace(/::$/,"").trim(),i=s.slice(s.indexOf("{")+1,s.lastIndexOf("}")).trim();return x(i).flatMap(o=>{let a=o.trim();if(!a||a==="self")return[];let[c]=a.split(/\s+as\s+/),p=`${n}::${c?.trim()??a}`.replace(/::::/g,"::");return[F(e,r,p)]})}return[F(e,r,s)]}function F(e,r,t){return{specifier:t,sourcePath:_(e,r,t)??_(e,r,t.split("::").slice(0,-1).join("::"))}}function xe(e,r){let t=r.toLowerCase();for(let s of e)for(let n of s.extensions)if(t.endsWith(n))return s;return null}var ht={language:"javascript",extensions:[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue"],parseImports:te},St={language:"python",extensions:[".py",".pyi"],parseImports:de},xt={language:"jvm",extensions:[".java",".scala",".kt",".kts"],parseImports:ce},yt={language:"rust",extensions:[".rs"],parseImports:he,parseExports:Se},Nt={language:"ruby",extensions:[".rb"],parseImports:fe},It={language:"c/cpp",extensions:[".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx"],parseImports:ne},Pt={language:"dotnet",extensions:[".cs",".vb"],parseImports:ae},bt={language:"dart",extensions:[".dart"],parseImports:oe,parseExports:ie},_t={language:"php",extensions:[".php"],parseImports:me},Ct=[ht,St,xt,yt,Nt,It,Pt,bt,_t];function V(e){return xe(Ct,e)}function Ur(e,r){return re(e,r)}var Et=$("source-imports"),Rt=$("source-exports");function Br(e,r){let t=J(r);return Et.get(e,t,()=>{let s=V(t);if(!s)return[];let n=k(e,t);return n?s.parseImports(e,t,n):[]})}function Wr(e,r){let t=J(r);return Rt.get(e,t,()=>{let s=V(t);if(!s?.parseExports)return[];let n=k(e,t);return n?s.parseExports(e,t,n):[]})}export{Y as a,Dt as b,G as c,Ur as d,Br as e,Wr as f};
5
- //# sourceMappingURL=chunk-KW2F3WSV.js.map
@@ -1,5 +0,0 @@
1
- import{a as w}from"./chunk-UAPNU7UP.js";import{d as D}from"./chunk-KW2F3WSV.js";import{a as S,d as p,f as C,h as x,j as I,n as L,o as v,p as d}from"./chunk-QFZE73XF.js";function le(n,e){let{scope:t,minLoc:i=3,maxLoc:s=80,limit:r=30,includeLowConfidence:a=!1}=e??{},o=new w(n),l=o.scopedDefinitions(t),u=K(o,t),f=A(n,o,l,{minLoc:i,maxLoc:s}),m=$(o,f),g=E(n,o,l,f),T=_(f);return B(n,f,m,T).filter(c=>!g.has(c.definition.symbolId)).filter(c=>!c.transitivelyReachable).filter(c=>c.realConsumers.length<=1).filter(c=>!(c.realConsumers.length===0&&c.barrelConsumers>0)).filter(c=>W(c.definition,c.realConsumers.length,u)).map(c=>N(n,c)).filter(c=>a||c.confidence!=="low").sort((c,b)=>{let h={high:0,medium:1,low:2};return h[c.confidence]-h[b.confidence]||b.loc-c.loc||c.file.localeCompare(b.file)||c.startLine-b.startLine}).slice(0,r)}function A(n,e,t,i){return t.filter(s=>s.isTypeLike&&y(s)>=i.minLoc).filter(s=>y(s)<=i.maxLoc).filter(s=>!n.isIgnored(s.relativePath)).filter(s=>!V(s.symbol)).filter(s=>!e.hasSuppressionComment(s))}function $(n,e){return R(n.crossFileCallerMap(e),n.sourceFallbackCallerFiles(e))}function _(n){let e=new Map;for(let t of n){let i=e.get(t.relativePath);i||(i=new Map,e.set(t.relativePath,i));let s=d(t.symbol);s&&i.set(s,t)}return e}function B(n,e,t,i){return e.map(s=>{let a=[...t.get(s.symbolId)??new Set].filter(f=>f!==s.relativePath&&!n.isIgnored(f)),{realConsumers:o,barrelConsumers:l}=G(n,s.relativePath,s.symbol,a),u=Z(n,s,t,i);return{definition:s,realConsumers:o,barrelConsumers:l,transitivelyReachable:u}})}function N(n,e){let t=k(n,e.definition.relativePath,e.definition.startLine),i=P(e.definition.relativePath)?!0:X(n,e.definition),{confidence:s,reason:r}=Y(e.realConsumers.length,t,i);return{symbol:e.definition.symbol,shortName:v(e.definition.symbol),file:e.definition.relativePath,startLine:e.definition.startLine,endLine:e.definition.endLine,loc:y(e.definition),consumers:e.realConsumers.length,barrelConsumers:e.barrelConsumers,kind:t,definerUsesType:i,confidence:s,reason:r}}function E(n,e,t,i){let s=O(n,j(t),i),r=s.map(l=>l.singleton);if(s.length===0)return new Set;let a=R(e.crossFileCallerMap(r),e.sourceFallbackCallerFiles(r)),o=new Set;for(let{singleton:l,classId:u}of s)z(n,l,a)&&o.add(u);return o}function j(n){let e=new Map;for(let t of n){let i=d(t.symbol);i&&e.set(M(t.relativePath,i),t)}return e}function O(n,e,t){let i=[];for(let s of t){let r=U(n,e,s);r&&i.push({singleton:r,classId:s.symbolId})}return i}function U(n,e,t){if(k(n,t.relativePath,t.startLine)!=="class")return null;let i=d(t.symbol);if(!i)return null;let s=H(n,t.relativePath,i);return s?e.get(M(t.relativePath,s))??null:null}function z(n,e,t){let i=d(e.symbol),s=t.get(e.symbolId);return!i||!s?!1:[...s].some(r=>r!==e.relativePath&&!n.isIgnored(r)&&!F(n,r,i))}function M(n,e){return`${n}\0${e}`}function H(n,e,t){let i=p(n,e);if(!i)return null;let s=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\bexport\\s+const\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*new\\s+${s}\\s*\\(`);return i.match(r)?.[1]??null}function K(n,e){return new Set(n.scopedDefinitions(e).filter(t=>t.isFunctionLike).map(t=>t.relativePath))}function V(n){let e=L(n);if("kind"in e)return!1;let t=e.descriptors;if(t.length<2)return!1;let i=t[t.length-1],s=t[t.length-2];return i?.suffix==="type"&&s?.suffix==="type"}function P(n){let t=(n.split("/").pop()??"").replace(/\.[^.]+$/,"");return!!(t==="types"||t==="models"||t==="schema"||t==="common"||t==="protocol"||t==="proto"||t==="dto"||t==="mod"||/(^|\/)types(\/|\.)/.test(n)||/(^|\/)models?(\/|\.)/.test(n)||/(^|\/)proto(?:col)?(\/|\.)/.test(n)||/(^|\/)schema(\/|\.)/.test(n))}function W(n,e,t){return!(P(n.relativePath)&&e>0||e===0&&t.has(n.relativePath))}function G(n,e,t,i){let s=[],r=0,a=d(t);for(let o of i)Q(n,o,e,a)||F(n,o,a)?r++:s.push(o);return{realConsumers:s,barrelConsumers:r}}function Z(n,e,t,i){let s=I(n,e.relativePath),r=d(e.symbol);if(!r)return!1;let a=s.get(r);if(!a||a.size===0)return!1;let o=i.get(e.relativePath);if(!o)return!1;for(let l of a){let u=o.get(l);if(!u)continue;let f=t.get(u.symbolId);if(f){for(let m of f)if(m!==e.relativePath&&!n.isIgnored(m))return!0}}return!1}var q=S("stale-abs-file-usage");function F(n,e,t){if(!t)return!1;let i=C(e);if(!i)return!1;let s=q.get(n,e,()=>J(n,e,i));return s.importedLeaves.has(t)&&!s.usedLeaves.has(t)}function J(n,e,t){let i=new Set,s=new Set,r=x(n,e);if(!r)return{importedLeaves:i,usedLeaves:s};let a=t==="rust"?new Set(["use_declaration"]):t==="python"?new Set(["import_statement","import_from_statement"]):new Set(["import_statement"]),o=(l,u)=>{let f=u||a.has(l.type);(l.type==="identifier"||l.type==="type_identifier"||l.type==="property_identifier"||l.type==="field_identifier")&&(f?i.add(l.text):s.add(l.text));for(let m of l.children)o(m,f)};return o(r.rootNode,!1),{importedLeaves:i,usedLeaves:s}}function Q(n,e,t,i){if(!i)return!1;let s=p(n,e);if(!s)return!1;let r=D(n,e);if(r.length===0)return!1;let a=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`\\b${a}\\b`),l=s.split(`
2
- `),u=0;for(let f=0;f<l.length;f++){if(!o.test(l[f]??""))continue;if(u++,!r.find(g=>g.startLine<=f&&f<=g.endLine))return!1}return u>0}function k(n,e,t){let i=p(n,e);if(!i)return"other";let s=i.split(`
3
- `),r=Math.max(0,t-2),a=Math.min(s.length-1,t+2);for(let o=r;o<=a;o++){let u=(s[o]??"").replace(/^\s*\/\/.*$/g,"");if(/\b(?:export\s+)?(?:abstract\s+)?class\s+\w/.test(u))return"class";if(/\b(?:export\s+)?interface\s+\w/.test(u))return"interface";if(/\b(?:export\s+)?type\s+\w/.test(u))return"type";if(/\b(?:export\s+)?(?:const\s+)?enum\s+\w/.test(u))return"enum"}return"other"}function X(n,e){let t=p(n,e.relativePath);if(!t)return!1;let i=d(e.symbol);if(!i)return!1;let s=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\b${s}\\b`),a=t.split(`
4
- `);for(let o=0;o<a.length;o++)if(!(o>=e.startLine&&o<=e.endLine)&&r.test(a[o]??""))return!0;return!1}function Y(n,e,t){return n===0?{confidence:"high",reason:"unused \u2014 no consumers and defining file has no real usage"}:n===1&&e==="class"?{confidence:"low",reason:"1 consumer + class kind \u2014 likely 1:1 encapsulation, not over-abstraction"}:n===1&&!t?{confidence:"high",reason:"1 consumer + defining file never uses it \u2014 type belongs with its consumer"}:{confidence:"medium",reason:"1 consumer \u2014 single-use abstraction"}}function y(n){return n.endLine-n.startLine+1}function R(...n){let e=new Map;for(let t of n)for(let[i,s]of t){let r=e.get(i);r||(r=new Set,e.set(i,r));for(let a of s)r.add(a)}return e}export{le as a};
5
- //# sourceMappingURL=chunk-NIN762LD.js.map
@@ -1,7 +0,0 @@
1
- import{a as m}from"./chunk-UAPNU7UP.js";import{a as l}from"./chunk-ZHHMG4UC.js";import{o as a}from"./chunk-QFZE73XF.js";import{readFileSync as f}from"fs";import{join as u}from"path";function I(e,n){let t=l(e,n);if(!t)return null;let i=new m(e),c=S(h(e,t.relativePath,t.startLine,t.endLine),p(e,t.relativePath)),o=t.endLine-t.startLine+1,r=i.calleeMap([t],{additive:!0}).get(t.symbolId)??[],b=new Set(r.map(g=>g.symbol));return{symbol:t.symbol,shortName:a(t.symbol),relativePath:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:o,branches:c,cyclomaticEstimate:c+1,calleeCount:b.size,fanIn:y(e,t.symbolId),fanOut:d(r,t.relativePath)}}function p(e,n){return e.get("SELECT language FROM documents WHERE relative_path = ?",n)?.language??"unknown"}function h(e,n,t,i){try{return f(u(e.config.projectRoot,n),"utf-8").split(`
2
- `).slice(t,i+1).join(`
3
- `)}catch{return""}}function y(e,n){return e.get(`SELECT COUNT(DISTINCT c.document_id) AS c
4
- FROM mentions m
5
- JOIN chunks c ON m.chunk_id = c.id
6
- WHERE m.symbol_id = ? AND m.role != 1`,n)?.c??0}function d(e,n){return new Set(e.filter(t=>t.file!==n).map(t=>t.symbol)).size}function S(e,n){let t=P(e),i=0,c=[/\bif\b/g,/\belse\s+if\b/g,/\belse\b/g,/\bfor\b/g,/\bwhile\b/g,/\bswitch\b/g,/\bcase\b/g,/\bcatch\b/g,/\?\s*[^?]/g,/&&/g,/\|\|/g];for(let o of c){let s=t.match(o);s&&(i+=s.length)}if(n==="python"){let o=[/\belif\b/g,/\bexcept\b/g,/\bfinally\b/g];for(let s of o){let r=t.match(s);r&&(i+=r.length)}}else if(n==="rust"){let o=[/\bmatch\b/g,/=>/g,/\bloop\b/g];for(let s of o){let r=t.match(s);r&&(i+=r.length)}}else if(n==="ruby"){let o=[/\belsif\b/g,/\bunless\b/g,/\brescue\b/g,/\bwhen\b/g];for(let s of o){let r=t.match(s);r&&(i+=r.length)}}else if(n==="go"){let o=[/\bselect\b/g,/\bdefer\b/g];for(let s of o){let r=t.match(s);r&&(i+=r.length)}}return i}function P(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/.*/g,"").replace(/#.*/g,"").replace(/"(?:[^"\\]|\\.)*"/g,'""').replace(/'(?:[^'\\]|\\.)*'/g,"''").replace(/`(?:[^`\\]|\\.)*`/g,"``")}export{I as a};
7
- //# sourceMappingURL=chunk-Q4R2IYA3.js.map
@@ -1,16 +0,0 @@
1
- import{a as h}from"./chunk-UAPNU7UP.js";import{p}from"./chunk-Z4AMQWVY.js";import{o as u,r as c,t as g}from"./chunk-QFZE73XF.js";import{execFileSync as f}from"child_process";function O(e,t={}){let{base:n="HEAD"}=t,s;try{s=b(e.config.projectRoot,n)}catch{return y("Unable to compute git diff.")}if(s.length===0)return y("No changed files found.");let o=I(e,s);if(o.length===0)return{changedFiles:s,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:s.length,totalChangedSymbols:0,totalAffectedFiles:0,note:"Changed files are not present in the current SCIP index."}};let a=new h(e),l=new Set(o),m=D(a,o),r=[],i=new Map;for(let C of m)_(e,C,o,l,r,i);let d=R(i);return{changedFiles:o,changedSymbols:r,affectedConsumers:d,summary:{totalChangedFiles:o.length,totalChangedSymbols:r.length,totalAffectedFiles:d.length}}}function y(e){return{changedFiles:[],changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:0,totalChangedSymbols:0,totalAffectedFiles:0,note:e}}}function b(e,t){let n=f("git",["diff","--name-only",t],{encoding:"utf-8",cwd:e,timeout:1e4}),s=f("git",["diff","--name-only","--cached",t],{encoding:"utf-8",cwd:e,timeout:1e4}),o=f("git",["ls-files","--others","--exclude-standard"],{encoding:"utf-8",cwd:e,timeout:1e4});return[...new Set([n,s,o].flatMap(a=>a.split(`
2
- `)).map(a=>a.trim()).filter(a=>a.length>0))]}function I(e,t){let n=[];for(let s of t){let o=e.get(`SELECT relative_path FROM documents
3
- WHERE relative_path LIKE ?
4
- LIMIT 1`,`%${s}`);o&&!e.isIgnored(o.relative_path)&&n.push(o.relative_path)}return n}function D(e,t){return t.flatMap(n=>e.definitionsForFile(n)).filter(x).sort((n,s)=>n.relativePath.localeCompare(s.relativePath)||n.startLine-s.startLine)}function _(e,t,n,s,o,a){let l=p(e,[t]).get(t.symbolId)??new Set,m=Math.max(F(e,t.symbolId),l.size);if(!E(t,m))return;let r=u(t.symbol);o.push({symbol:t.symbol,shortName:r,file:t.relativePath,fanIn:m});for(let i of N(e,t.symbolId,n))S(e,s,a,i,r);for(let i of l)S(e,s,a,i,r)}function F(e,t){return e.get(`SELECT COUNT(DISTINCT c.document_id) AS fan_in
5
- FROM mentions m
6
- JOIN chunks c ON m.chunk_id = c.id
7
- WHERE m.symbol_id = ?
8
- AND m.role != 1`,t)?.fan_in??0}function N(e,t,n){return n.length===0?[]:e.all(`SELECT DISTINCT ref_d.relative_path
9
- FROM mentions m
10
- JOIN chunks c ON m.chunk_id = c.id
11
- JOIN documents ref_d ON c.document_id = ref_d.id
12
- WHERE m.symbol_id = ?
13
- AND m.role != 1
14
- AND ref_d.relative_path NOT IN (${n.map(()=>"?").join(",")})
15
- ${e.pathExclusionsFor("ref_d")}`,t,...n).map(o=>o.relative_path)}function S(e,t,n,s,o){if(e.isIgnored(s)||t.has(s))return;let a=n.get(s);a||(a=new Set,n.set(s,a)),a.add(o)}function R(e){return[...e.entries()].map(([t,n])=>({file:t,consumedSymbols:n.size})).sort((t,n)=>n.consumedSymbols-t.consumedSymbols)}function x(e){return!(g(e.symbol)||e.parentTypeName!==null&&!c(e.symbol))}function E(e,t){return c(e.symbol)||e.isTypeLike?!0:e.parentTypeName===null&&t>0}export{O as a};
16
- //# sourceMappingURL=chunk-QPJG6VRT.js.map
@@ -1,7 +0,0 @@
1
- import{a as M}from"./chunk-UAPNU7UP.js";import{f as b}from"./chunk-3PVIYZ74.js";import{E as C,o as p,p as g,v as I}from"./chunk-QFZE73XF.js";import{basename as c,extname as d}from"path";function R(i,e){let{scope:n,maxLoc:o=15,limit:r=30}=e??{},t=new M(i),a=P(t.fileDependencyGraph(n)),s=x(t,n,o),u=v(t.crossFileCallerMap(s),t.sourceFallbackCallerFiles(s)),m=[];for(let f of s){let l=F(i,t,f,{callerFileMap:u,reverseFanIn:a});l&&m.push(l)}return m.sort((f,l)=>l.callerFanIn-f.callerFanIn||l.loc-f.loc),m.slice(0,r)}function F(i,e,n,o){let r=D(e,n,o.callerFileMap);if(r.length!==1)return null;let t=r[0],a=S(i,n.symbolId,t);if(!a)return null;let s=L(e,i,t,n.symbol,a);if(s&&I(s.symbol))return null;let u=y(o.callerFileMap,o.reverseFanIn,t,s);return u<=3?null:{symbol:n.symbol,shortName:p(n.symbol),file:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:h(n),singleCaller:s?.symbol??"",singleCallerShort:s?.isFunctionLike?p(s.symbol):c(t),callerFanIn:u}}function h(i){return i.endLine-i.startLine+1}function x(i,e,n){return i.productionCallableDefinitions({scope:e,minLoc:2,maxLoc:n,requireFunctionLikeSymbol:!0})}function D(i,e,n){let o=c(e.relativePath,d(e.relativePath));return[...n.get(e.symbolId)??[]].filter(r=>r!==e.relativePath).filter(r=>c(r,d(r))!==o).filter(r=>{let t=i.fileKind(r);return t!=="barrel"&&t!=="entry"&&t!=="test"})}function S(i,e,n){return i.get(`SELECT c.start_line, c.end_line
2
- FROM mentions m
3
- JOIN chunks c ON m.chunk_id = c.id
4
- JOIN documents d ON c.document_id = d.id
5
- WHERE m.symbol_id = ? AND m.role != 1 AND d.relative_path = ?
6
- LIMIT 1`,e,n)}function L(i,e,n,o,r){let t=i.definitionsForFile(n),a=k(e,n,o,r.start_line,r.end_line);return C(t,a)}function y(i,e,n,o){if(o?.isFunctionLike){let r=[...i.get(o.symbolId)??[]].filter(t=>t!==o.relativePath);if(r.length>0)return r.length}return _(e,n)}function k(i,e,n,o,r){let t=g(n);if(!t)return o;let a=b(i,e).get(t);if(!a||a.length===0)return o;for(let s of a)if(s>=o&&s<=r)return s;return o}function v(...i){let e=new Map;for(let n of i)for(let[o,r]of n){let t=e.get(o);t||(t=new Set,e.set(o,t));for(let a of r)t.add(a)}return e}function P(i){let e=new Map;for(let[n,o]of i){e.has(n)||e.set(n,e.get(n)??0);for(let r of o)e.set(r,(e.get(r)??0)+1)}return e}function _(i,e){let n=i.get(e)??0;if(n>0)return n;let o=c(e,d(e)),r=0;for(let[t,a]of i)t!==e&&c(t,d(t))===o&&a>r&&(r=a);return r}export{R as a};
7
- //# sourceMappingURL=chunk-TUV2VI7D.js.map
@@ -1,2 +0,0 @@
1
- import{a as b,e as A}from"./chunk-YXMHTJYY.js";import{a as m,b as O,d as E}from"./chunk-VEXS3I3N.js";import{c as q}from"./chunk-Y4DS3MDC.js";import{b as F,c as L,f as D,g as M,k as v,m as N}from"./chunk-3PVIYZ74.js";import{A as P,C as T,e as p,f as g,g as h,l as R,r as C,s as I,u as x,v as k}from"./chunk-QFZE73XF.js";function V(i,e,o){let c=e.identifierResolution==="strict"?m:O;for(let t of e.paths){let l=g(t);if(!l&&!(e.includeVueSfc&&h(t))||i.isIgnored(t)||e.skipPath?.(t))continue;let u=D(i,t);for(let[n,s]of u)for(let f of c(i,t,n))o({sourceFile:t,name:n,target:f,occurrences:s.length,kind:"identifier"});if(e.includeCrossLanguageDispatchNames)for(let n of L(i,t))for(let s of m(i,t,n))o({sourceFile:t,name:n,target:s,occurrences:1,kind:"cross-language-dispatch"});if(e.includeRustAttributeNames&&l==="rust")for(let n of F(i,t))for(let s of c(i,t,n))o({sourceFile:t,name:n,target:s,occurrences:1,kind:"rust-attribute"})}}var G=class{constructor(e){this.db=e}db;scopedDefinitions(e){return T(this.db,e)}definitionsForFile(e){return P(this.db,e)}productionCallableDefinitions(e={}){let{scope:o,minLoc:c=1,maxLoc:t=Number.POSITIVE_INFINITY,excludeSymbol:l,excludeEntrySurfaces:u=!1,excludeTypesFiles:n=!1,requireFunctionLikeSymbol:s=!1,requireCallableSymbol:f=!1,excludeRustTraitImplMembers:K=!1,includeSuppressed:j=!1,sortByLocDesc:B=!1}=e,d=[];for(let r of this.scopedDefinitions(o)){let a=r.relativePath;if(this.db.isIgnored(a)||u&&A(this.db,a)||!H(r,{requireFunctionLikeSymbol:s,requireCallableSymbol:f})||l!==void 0&&r.symbol===l)continue;let S=y(r);S<c||S>t||n&&Y(a)||K&&x(r.symbol)||b(a)!=="test"&&(k(r.symbol)||!j&&p(this.db,a,r.startLine)||d.push(r))}return B?d.sort((r,a)=>y(a)-y(r)):d}calleeMap(e,o={}){return v(this.db,e,o)}crossFileCallerMap(e){return N(this.db,e)}sourceFallbackCallerFiles(e){return E(this.db,e)}fileDependencyGraph(e){return M(this.db,e)}fileKind(e){return b(e)}hasSuppressionComment(e){return p(this.db,e.relativePath,e.startLine)}sourceFiles(){return q(this.db)}scanSourceReferences(e,o){V(this.db,e,o)}callableSignature(e){return R(this.db,e.relativePath,e.startLine,e.endLine)}};function y(i){return i.endLine-i.startLine+1}function H(i,e){return e.requireCallableSymbol?C(i.symbol):e.requireFunctionLikeSymbol?I(i.symbol):i.isFunctionLike}function Y(i){return(i.split("/").pop()??"").includes("types")}export{G as a};
2
- //# sourceMappingURL=chunk-UAPNU7UP.js.map
@@ -1,2 +0,0 @@
1
- import{a as m}from"./chunk-UAPNU7UP.js";import{o as p}from"./chunk-QFZE73XF.js";function L(s,r){let{scope:l,minLoc:o=10,limit:u=30}=r??{},{definitions:d,callerMap:y,calleeMap:b}=f(s,l);return d.map(e=>{let a=e.endLine-e.startLine+1,n=y.get(e.symbolId)?.size??0,c=b.get(e.symbolId)??[],x=c.filter(t=>t.file!==e.relativePath),i=new Set(x.map(t=>`${t.symbol}|${t.file}`)).size,M=new Set(c.map(t=>`${t.symbol}|${t.file}`)).size;return{symbol:e.symbol,shortName:p(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:a,fanIn:n,fanOut:i,calleeCount:M,score:Math.round(a/50*(n/5)*Math.max(i/5,1)*100)/100}}).filter(e=>e.loc>=o).sort((e,a)=>a.score-e.score||a.loc-e.loc).slice(0,u)}function f(s,r){let l=new m(s),o=l.productionCallableDefinitions({scope:r,requireCallableSymbol:!0,includeSuppressed:!0});return{definitions:o,callerMap:l.crossFileCallerMap(o),calleeMap:l.calleeMap(o)}}export{L as a};
2
- //# sourceMappingURL=chunk-URCJTFOD.js.map
@@ -1,39 +0,0 @@
1
- import{a as g}from"./chunk-MO65UK5V.js";import{e as a}from"./chunk-KW2F3WSV.js";import{n as u}from"./chunk-Z4AMQWVY.js";import{a as p}from"./chunk-ZHHMG4UC.js";import{o as l,p as c,t as f}from"./chunk-QFZE73XF.js";function T(t,r){return h(t,r)?.map(e=>({symbol:e.symbol,shortName:e.shortName,fromFile:e.fromFile}))??[]}function M(t,r){let e=E(t,r);return e.length>0?e:N(t,r)}function J(t,r){return h(t,r)?.filter(e=>!e.used).map(e=>({symbol:e.symbol,shortName:e.shortName,importedIn:e.importer}))??[]}function E(t,r){return t.all(`SELECT DISTINCT gs.symbol, d.relative_path AS importer
2
- FROM mentions m
3
- JOIN chunks c ON m.chunk_id = c.id
4
- JOIN documents d ON c.document_id = d.id
5
- JOIN global_symbols gs ON m.symbol_id = gs.id
6
- WHERE gs.symbol LIKE ?
7
- AND m.role = 2
8
- ORDER BY d.relative_path`,`%${r}%`).filter(s=>!t.isIgnored(s.importer)).map(s=>({symbol:s.symbol,shortName:l(s.symbol),fromFile:s.importer}))}function N(t,r){let e=p(t,r),s=e?.relativePath??null,o=e?c(e.symbol):r.replace(/\(\)$/,""),i=e?f(e.symbol):!1,m=t.all(`SELECT relative_path
9
- FROM documents
10
- WHERE 1 = 1
11
- ${t.pathExclusionsFor("documents")}
12
- ORDER BY relative_path`),d=new Set;for(let n of m)if(!t.isIgnored(n.relative_path))for(let b of a(t,n.relative_path))S(b,n.relative_path,{targetFile:s,targetLeaf:o,targetIsModule:i})&&d.add(n.relative_path);return[...d].sort().map(n=>({symbol:e?.symbol??o,shortName:e?l(e.symbol):o,fromFile:n}))}function S(t,r,e){return!t.sourcePath||e.targetFile&&_(t.sourcePath)!==_(e.targetFile)?!1:t.kind==="side-effect"||e.targetFile&&R(r)||e.targetIsModule||t.kind==="named"&&t.importedName===e.targetLeaf?!0:t.kind==="namespace"&&t.usedMembers.includes(e.targetLeaf)}function h(t,r){let e=g(t,r);return e?O(t,e)??F(t,e)??y(t,e):null}function O(t,r){let s=t.all(`SELECT DISTINCT
13
- gs.symbol,
14
- def_d.relative_path AS from_file,
15
- imp_d.relative_path AS importer,
16
- EXISTS (
17
- SELECT 1
18
- FROM mentions ref_m
19
- JOIN chunks ref_c ON ref_m.chunk_id = ref_c.id
20
- WHERE ref_m.symbol_id = gs.id
21
- AND ref_m.role != 1
22
- AND ref_c.document_id = imp_d.id
23
- ) AS used
24
- FROM mentions m
25
- JOIN chunks c ON m.chunk_id = c.id
26
- JOIN documents imp_d ON c.document_id = imp_d.id
27
- JOIN global_symbols gs ON m.symbol_id = gs.id
28
- LEFT JOIN (
29
- SELECT m2.symbol_id, c2.document_id
30
- FROM mentions m2
31
- JOIN chunks c2 ON m2.chunk_id = c2.id
32
- WHERE m2.role = 1
33
- GROUP BY m2.symbol_id
34
- ) sym_def ON sym_def.symbol_id = gs.id
35
- LEFT JOIN documents def_d ON sym_def.document_id = def_d.id
36
- WHERE imp_d.relative_path = ?
37
- AND m.role = 2
38
- ORDER BY def_d.relative_path, gs.symbol`,r).filter(o=>!t.isIgnored(o.importer));if(s.length>0){let o=u(t,r);return s.map(i=>({symbol:i.symbol,shortName:l(i.symbol),fromFile:i.from_file??"(external)",importer:i.importer,used:i.used!==0||o.some(m=>m.isUsed&&m.sourcePath===i.from_file)}))}return null}function F(t,r){let e=u(t,r);return e.length>0?e.map(s=>{let o=I(s.importedName,s.localName,s.kind);return{symbol:o,shortName:o,fromFile:s.sourcePath??"(external)",importer:r,used:s.kind==="side-effect"?!0:s.isUsed}}):null}function y(t,r){return a(t,r).map(e=>{let s=I(e.importedName,e.localName,e.kind),o=e.kind==="side-effect"?!0:e.used;return{symbol:s,shortName:s,fromFile:e.sourcePath??"(external)",importer:r,used:o}})}function I(t,r,e){return e==="namespace"&&t==="*"&&r?`* as ${r}`:e==="default"&&r?`default as ${r}`:e==="side-effect"?"(side effect import)":r&&r!==t?`${t} as ${r}`:t}function _(t){return t.replace(/\\/g,"/")}function R(t){return/\.(?:c|h|cc|cpp|cxx|hpp|hh|hxx)$/i.test(t)}export{T as a,M as b,J as c};
39
- //# sourceMappingURL=chunk-UUIWMLDX.js.map
@@ -1,2 +0,0 @@
1
- import{c as p}from"./chunk-Y4DS3MDC.js";import{d as b,e as S,l as u}from"./chunk-3PVIYZ74.js";import{e as y}from"./chunk-KW2F3WSV.js";import{o as L}from"./chunk-Z4AMQWVY.js";import{c as x}from"./chunk-ZHHMG4UC.js";import{A as I,E as R,d,p as h}from"./chunk-QFZE73XF.js";function g(n,a,t){let e=u(n).get(t);if(!e||e.length===0)return[];if(e.length===1)return[m(e[0])];let s=e.filter(r=>r.file===a);if(s.length>0)return s.map(m);let i=F(n,a),o=i.get(t);if(o)for(let r of o){let f=e.filter(l=>w(r,l.file));if(f.length>0)return f.map(m)}let c=new Set;for(let r of i.values())for(let f of r)c.add(f);for(let r of c){let f=e.filter(l=>w(r,l.file));if(f.length>0&&f.length===e.length)return f.map(m)}return[]}function C(n,a,t){let e=g(n,a,t);if(e.length>0)return e;let s=u(n).get(t);return!s||s.length===0?[]:s.map(m)}function E(n,a){let t=x(n,a);if(!t)return[];let e=h(t.symbol);if(!e)return[];let s=L(n,{...t,leaf:e,parentTypeName:null,isFunctionLike:!1,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:null});if(s.length>0){let o=new Map;for(let c of s){let r=o.get(c.file)??[];r.push(c.line),o.set(c.file,r)}return D(n,o)}let i=new Map;for(let o of p(n)){let c=d(n,o);if(!c||c.indexOf(e)===-1||o!==t.relativePath&&!g(n,o,e).some(l=>l.symbolId===t.symbolId))continue;let r=b(n,o,e,o===t.relativePath?{excludeStartLine:t.startLine,excludeEndLine:t.endLine}:{});r.length>0&&i.set(o,r)}return D(n,i)}function A(n,a){let t=new Map;for(let i of a){if(!i.leaf)continue;let o=t.get(i.leaf)??[];o.push(i),t.set(i.leaf,o)}if(t.size===0)return new Map;let e=new Set(a.map(i=>i.symbolId)),s=new Map;for(let i of p(n)){let o=S(n,i);if(o.size!==0){for(let c of o)if(t.has(c))for(let r of g(n,i,c)){if(!e.has(r.symbolId)||i===r.relativePath)continue;let f=s.get(r.symbolId);f||(f=new Set,s.set(r.symbolId,f)),f.add(i)}}}return s}function F(n,a){let t=new Map;for(let e of y(n,a)){if(!e.sourcePath)continue;let s=e.localName??e.importedName;if(s){let i=t.get(s);i||(i=new Set,t.set(s,i)),i.add(e.sourcePath)}if(e.kind==="namespace")for(let i of e.usedMembers){let o=t.get(i);o||(o=new Set,t.set(i,o)),o.add(e.sourcePath)}}return t}function w(n,a){let t=e=>e.replace(/\\/g,"/").replace(/^\.\//,"");return t(n)===t(a)}function m(n){return{symbolId:n.symbolId,symbol:n.symbol,relativePath:n.file}}function D(n,a){let t=[],e=new Set;for(let[s,i]of a){let o=I(n,s);for(let c of i){let r=R(o,c),f=`${s}|${c}|${r?.symbol??""}`;e.has(f)||(e.add(f),t.push({file:s,line:c,enclosingSymbol:r?.symbol??null}))}}return t}export{g as a,C as b,E as c,A as d};
2
- //# sourceMappingURL=chunk-VEXS3I3N.js.map
@@ -1,2 +0,0 @@
1
- import{a as c}from"./chunk-UAPNU7UP.js";import{h as a,i}from"./chunk-3PVIYZ74.js";import{o as m}from"./chunk-QFZE73XF.js";function d(o,e={}){let{limit:r=20,scope:s,minFanIn:t=2,minFanOut:p=2}=e;return new c(o).productionCallableDefinitions({scope:s,requireCallableSymbol:!0,includeSuppressed:!0}).map(n=>u(o,n)).filter(n=>n.fanIn>=t&&n.fanOut>=p).sort((n,l)=>l.score-n.score||l.fanIn-n.fanIn).slice(0,r)}function u(o,e){let r=new Set(i(o,e,{limit:500}).map(t=>t.file)).size,s=new Set(a(o,e,{limit:500}).filter(t=>t.file!==e.relativePath).map(t=>`${t.symbol}|${t.file}`)).size;return{symbol:e.symbol,shortName:m(e.symbol),fanIn:r,fanOut:s,score:r*s,definedIn:e.relativePath}}export{d as a};
2
- //# sourceMappingURL=chunk-VRC3WKKE.js.map
@@ -1,2 +0,0 @@
1
- import{r as S}from"./chunk-Z4AMQWVY.js";import{B as x,d as g,o as d,y as h,z as b}from"./chunk-QFZE73XF.js";function B(t,e={}){let{scope:s,minLoc:o=1,limit:i}=e,c=new Map;for(let r of x(t,{scope:s})){if(!r.isFunctionLike||t.isIgnored(r.relativePath))continue;let n=r.endLine-r.startLine+1;if(n<o)continue;let m=L(t,r);if(!m)continue;let u={symbol:r.symbol,shortName:d(r.symbol),file:r.relativePath,startLine:r.startLine,endLine:r.endLine,loc:n},l=c.get(m);l?l.push(u):c.set(m,[u])}let a=[];for(let[r,n]of c)n.length<2||a.push({signature:r,functions:n});return a.sort((r,n)=>{let m=n.functions.length-r.functions.length;if(m!==0)return m;let u=r.functions.reduce((f,p)=>f+p.loc,0);return n.functions.reduce((f,p)=>f+p.loc,0)-u}),i?a.slice(0,i):a}function L(t,e){let s=S(t,e);if(s)return s;let o=$(e.documentation),i=o?v(o):null;return i||w(D(t,e.relativePath,e.startLine,e.endLine,e.leaf),e.leaf)}function $(t){return h(b(t))}function D(t,e,s,o,i){let c=g(t,e);if(!c)return null;let a=c.split(/\r?\n/),r=I(a,s,o,i);for(let n of r){let m=Math.min(a.length-1,Math.max(n,n+4)),u="";for(let l=n;l<=m;l+=1){let f=a[l]?.trim();if(f&&(u=u?`${u} ${f}`:f,M(u)))return u}if(u&&u.includes("("))return u}return null}function M(t){let e=t.replace(/\s+/g," ").trim();return!e.includes("(")||P(e)>0?!1:/[;{]$/.test(e)||/\)\s*(?::\s*[^={]+)?\s*(?:=>|=|throws\b|where\b|$)/i.test(e)||/\)\s*As\s+.+$/i.test(e)}function v(t){if(!t||!t.trim())return null;let e=t.replace(/^```\w*\s*/,"").replace(/\s*```$/,"").replace(/^\(method\)\s*/,"").replace(/^\(property\)\s*/,"").replace(/^\(function\)\s*/,"").replace(/^\(class\)\s*/,"").replace(/^\(interface\)\s*/,"").replace(/^\(enum\)\s*/,"").replace(/^\(type alias\)\s*/,"").replace(/^\(const\)\s*/,"").replace(/^\(var\)\s*/,"").trim(),s=e.indexOf("(");return s===-1||(e=e.slice(s),e=e.replace(/\s+/g,"").toLowerCase(),e.length<3)?null:e}function w(t,e){if(!t||!t.trim())return null;let s=t.replace(/\s+/g," ").trim(),o=s.indexOf("(");if(o===-1)return null;let i=s.slice(0,o),a=new RegExp(`\\b${y(e)}\\b`,"i").exec(i);a&&typeof a.index=="number"&&(i=i.slice(0,a.index)),i=i.replace(/\b(public|private|protected|internal|final|static|abstract|sealed|virtual|override|async|suspend|inline|constexpr|consteval|constinit|const|pub|fn|function|def|sub|friend|shared|readonly|new|open|partial|export)\b/gi," ").replace(/\s+/g," ").trim();let r=z(s.slice(o)).replace(/\)\s*=\s*[\s\S]*$/,")").replace(/\s+throws\s+[^={]+$/i,"").replace(/\s+where\s+.+$/i,"").replace(/\s+/g," ").trim();if(!r.startsWith("("))return null;let n=`${i?`${i} `:""}${r}`.replace(/\s+/g,"").toLowerCase();return n.length>=3?n:null}function z(t){let e=0,s=0,o=0,i=0,c=null,a=!1;for(let r=0;r<t.length;r+=1){let n=t[r];if(c){if(a){a=!1;continue}if(n==="\\"){a=!0;continue}n===c&&(c=null);continue}if(n==='"'||n==="'"||n==="`"){c=n;continue}if(n==="(")e+=1;else if(n===")")e=Math.max(0,e-1);else if(n==="[")o+=1;else if(n==="]")o=Math.max(0,o-1);else if(n==="<")i+=1;else if(n===">")i=Math.max(0,i-1);else if(n==="{"){if(e===0&&o===0&&i===0)return t.slice(0,r);s+=1}else if(n==="}")s=Math.max(0,s-1);else if(n==="="&&t[r+1]===">"&&e===0&&s===0&&o===0&&i===0)return t.slice(0,r)}return t}function I(t,e,s,o){let i=y(o),c=new RegExp(`\\b${i}\\b\\s*\\(`,"i"),a=new RegExp(`\\bdef\\s+${i}\\b`,"i"),r=[],n=new Set,m=Math.max(0,Math.min(e,t.length-1)),u=Math.max(m,Math.min(t.length-1,Math.max(s,e+4)));for(let l=m;l<=u;l+=1){let f=t[l]??"";(c.test(f)||a.test(f))&&!n.has(l)&&(n.add(l),r.push(l))}for(let l=0;l<t.length;l+=1){let f=t[l]??"";(c.test(f)||a.test(f))&&!n.has(l)&&(n.add(l),r.push(l))}return r}function P(t){let e=0;for(let s of t)s==="("&&(e+=1),s===")"&&(e-=1);return e}function y(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{B as a};
2
- //# sourceMappingURL=chunk-WFDTS7XL.js.map
@@ -1,2 +0,0 @@
1
- import{h as a,i as n}from"./chunk-3PVIYZ74.js";import{a as m}from"./chunk-ZHHMG4UC.js";import{o as i}from"./chunk-QFZE73XF.js";function p(e,s){let o=m(e,s);if(!o)return null;let t=n(e,o,{limit:50}),r=y(a(e,o,{limit:50,additive:!0,callableOnly:!0}));return{symbol:o.symbol,shortName:i(o.symbol),callers:t.map(l=>({symbol:l.symbol,shortName:i(l.symbol),file:l.file})),callees:r.map(l=>({symbol:l.symbol,shortName:i(l.symbol),file:l.file}))}}function y(e){let s=new Set,o=[];for(let t of e){let r=`${t.symbol}|${t.file}`;s.has(r)||(s.add(r),o.push(t))}return o}export{p as a};
2
- //# sourceMappingURL=chunk-YJODB2F5.js.map
@@ -1,90 +0,0 @@
1
- import{A as F,b as z,p as C}from"./chunk-QFZE73XF.js";import g from"path";import{createRequire as Ye}from"module";import{existsSync as T,readdirSync as Ge,readFileSync as fe}from"fs";import{existsSync as D}from"fs";import{basename as he,dirname as y,extname as S,join as p,relative as E,resolve as f}from"path";var ye=z("indexed-paths"),N=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue"],Y=[".py",".pyi"],G=[".java",".scala",".kt",".kts"],q=[".rs"],Q=[".rb"],Z=[".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx"],ee=[".cs",".vb"],te=[".dart"],ne=[".php"],Ie=new Set(N),O=new Set(Y),re=new Set(G),P=new Set(q),A=new Set(Q),ie=new Set(Z),oe=new Set(ee),j=new Set(te),se=new Set(ne),xe=[{extensions:N,lookup:Ie},{extensions:Y,lookup:O},{extensions:G,lookup:re},{extensions:q,lookup:P},{extensions:Q,lookup:A},{extensions:Z,lookup:ie},{extensions:ee,lookup:oe},{extensions:te,lookup:j},{extensions:ne,lookup:se}];function I(n,e){return e.has(S(n).toLowerCase())}function Ee(n){return I(n,O)}function Ne(n){return I(n,re)}function be(n){return I(n,P)}function ve(n){return I(n,A)}function ke(n){return I(n,ie)}function Re(n){return I(n,oe)}function Rt(n){return S(n).toLowerCase()===".vb"}function De(n){return I(n,j)}function Te(n){return I(n,se)}function Le(n){let e=S(n).toLowerCase();for(let t of xe)if(t.lookup.has(e))return t.extensions;return N}function _e(n){return Ne(n)||Re(n)||Te(n)}function w(n,e,t){return Ee(e)?Ce(n,e,t):be(e)?Fe(n,e,t):ve(e)?Oe(n,e,t):ke(e)?Pe(n,e,t):_e(e)?Ae(n,t.replace(/\\/g,"."),Le(e)):De(e)?je(n,e,t):Me(n,e,t)}function Me(n,e,t){if(!t.startsWith(".")&&!t.startsWith("/"))return null;let r=y(p(n.config.projectRoot,e)),i=f(r,t),o=b(n);for(let s of Ke(i)){let a=x(E(n.config.projectRoot,s));if(o.has(a)||D(s))return a}return x(E(n.config.projectRoot,i))}function Ce(n,e,t){let r=b(n),i;if(t.startsWith(".")){let o=t.match(/^(\.+)(.*)$/);if(!o)return null;let s=o[1].length,a=o[2].replace(/^\./,""),c=y(p(n.config.projectRoot,e));for(let l=1;l<s;l++)c=y(c);i=a?f(c,a.replace(/\./g,"/")):c}else i=f(n.config.projectRoot,t.replace(/\./g,"/"));for(let o of we(i)){let s=x(E(n.config.projectRoot,o));if(r.has(s)||D(o))return s}return null}function Fe(n,e,t){if(!t)return null;let r=t.replace(/\s+as\s+.+$/,"").trim();if(!r.startsWith("crate::")&&!r.startsWith("self::")&&!r.startsWith("super::"))return null;let i=y(p(n.config.projectRoot,e)),o;return r.startsWith("crate::")?o=f(n.config.projectRoot,"src",r.slice(7).replace(/::/g,"/")):r.startsWith("self::")?o=f(i,r.slice(6).replace(/::/g,"/")):o=f(y(i),r.slice(7).replace(/::/g,"/")),W(n,We(o))}function Oe(n,e,t){let r=y(p(n.config.projectRoot,e)),i=f(r,t);return W(n,$e(i))}function Pe(n,e,t){let r=y(p(n.config.projectRoot,e)),i=[f(r,t),f(n.config.projectRoot,t),f(n.config.projectRoot,"include",t),f(n.config.projectRoot,"src",t)];return W(n,i)}function Ae(n,e,t){let r=b(n),i=e.replace(/\\/g,".").replace(/::/g,".").replace(/^global::/,""),o=i.replace(/\./g,"/"),s=i.split(".").pop()??i;for(let c of t){let l=`${o}${c}`,d=[...r].find(m=>m.endsWith(l));if(d)return d}for(let c of t){let l=[...r].find(d=>he(d)===`${s}${c}`);if(l)return l}let a=[...r].filter(c=>t.includes(S(c).toLowerCase())).filter(c=>c.includes(`/${o}/`)||c.includes(`/${s}/`)).sort((c,l)=>c.localeCompare(l));return a.length===1?a[0]:null}function je(n,e,t){let r=b(n);if(t.startsWith("package:")){let s=t.slice(8),a=s.indexOf("/");if(a<0)return null;let c=s.slice(a+1),l=x(c.startsWith("lib/")?c:`lib/${c}`);return r.has(l)?l:null}let i=y(p(n.config.projectRoot,e)),o=f(i,t);for(let s of Ue(o)){let a=x(E(n.config.projectRoot,s));if(r.has(a)||D(s))return a}return null}function we(n){let e=S(n);return O.has(e)?[n]:[`${n}.py`,`${n}.pyi`,p(n,"__init__.py"),p(n,"__init__.pyi")]}function W(n,e){let t=b(n);for(let r of e){let i=x(E(n.config.projectRoot,r));if(t.has(i)||D(r))return i}return null}function We(n){let e=S(n);return P.has(e)?[n]:[`${n}.rs`,p(n,"mod.rs")]}function $e(n){let e=S(n);return A.has(e)?[n]:[`${n}.rb`,p(n,"index.rb")]}function Ue(n){let e=S(n);return j.has(e)?[n]:[`${n}.dart`,n]}function Ke(n){let e=S(n),t=new Set;if(e){t.add(n);for(let r of N)t.add(n.slice(0,-e.length)+r)}else for(let r of N)t.add(`${n}${r}`),t.add(p(n,`index${r}`));return[...t]}function b(n){return ye.get(n,()=>new Set(n.all(`SELECT relative_path
2
- FROM documents
3
- WHERE 1 = 1
4
- ${n.pathExclusionsFor("documents")}`).map(e=>x(e.relative_path)).filter(e=>!n.isIgnored(e))))}function x(n){return n.replace(/\\/g,"/")}import{existsSync as v,readFileSync as He,readdirSync as Xe,statSync as Je}from"fs";import u from"path";var U=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"];function K(n,e){let r=e?u.dirname(u.join(n,e)):n,i=u.resolve(n);for(;r.startsWith(i);){for(let s of U){let a=u.join(r,s);if(v(a))return a}let o=u.dirname(r);if(o===r)break;r=o}for(let o of U){let s=u.join(n,o);if(v(s))return s}return null}function ae(n){let e=n.config.projectRoot,t=new Set(Be(e,n.config.semantic?.typescript?.tsconfigs)),r=n.all(`SELECT relative_path
5
- FROM documents
6
- WHERE (
7
- relative_path LIKE '%.ts'
8
- OR relative_path LIKE '%.tsx'
9
- OR relative_path LIKE '%.mts'
10
- OR relative_path LIKE '%.cts'
11
- OR relative_path LIKE '%.js'
12
- OR relative_path LIKE '%.jsx'
13
- OR relative_path LIKE '%.mjs'
14
- OR relative_path LIKE '%.cjs'
15
- )
16
- ${n.pathExclusionsFor("documents")}`);for(let i of r){if(n.isIgnored(i.relative_path))continue;let o=K(e,i.relative_path);o&&t.add(u.resolve(o))}if(t.size===0){let i=K(e);i&&t.add(u.resolve(i))}return[...t].filter(i=>!ce(e,i)).sort((i,o)=>i.localeCompare(o))}function Be(n,e=[]){let t=new Set;for(let r of e){let i=u.isAbsolute(r)?r:u.join(n,r);v(i)&&t.add(u.resolve(i))}for(let r of Ve(n))for(let i of U){let o=u.join(r,i);v(o)&&t.add(u.resolve(o))}if(t.size===0){let r=K(n);r&&t.add(u.resolve(r))}return[...t].filter(r=>!ce(n,r)).sort((r,i)=>r.localeCompare(i))}function Ve(n){let e=u.join(n,"package.json");if(!v(e))return[];let t;try{t=JSON.parse(He(e,"utf8"))}catch{return[]}return(Array.isArray(t.workspaces)?t.workspaces:t.workspaces?.packages??[]).flatMap(i=>ze(n,i))}function ze(n,e){if(!e||e.startsWith("!")||e.includes("node_modules"))return[];if(!e.includes("*")){let s=u.join(n,e);return $(s)?[s]:[]}let t=e.indexOf("*"),r=e.slice(0,t).replace(/\/$/,""),i=e.slice(t+1).replace(/^\//,""),o=u.join(n,r||".");return $(o)?Xe(o).map(s=>u.join(o,s,i)).filter($):[]}function $(n){try{return Je(n).isDirectory()}catch{return!1}}function ce(n,e){let t=u.relative(n,e).replace(/\\/g,"/");return t.startsWith("..")||t.includes("/node_modules/")||t.startsWith("node_modules/")||t.includes("/dist/")||t.startsWith("dist/")}var qe=Ye(import.meta.url),k;function pe(n,e){let t=Qe();if(!t)return H("ts-morph is not installed");let r=ae(n);if(r.length===0)return H("no tsconfig found");try{let i=r.map(o=>({tsconfigPath:o,project:new t.Project({tsConfigFilePath:o,skipFileDependencyResolution:!1})}));return new X(n,t,i)}catch(i){return H(i instanceof Error?i.message:String(i),r[0],r)}}function Qe(){if(k!==void 0)return k;try{k=qe("ts-morph")}catch{k=null}return k}function H(n,e,t){return{language:"typescript",availability:()=>({available:!1,reason:n,tsconfigPath:e,tsconfigPaths:t}),importUsage:()=>[],referencesFor:()=>[],calleesFor:()=>[],signatureFor:()=>null}}var X=class{constructor(e,t,r){this.db=e;this.tsMorph=t;this.projects=r;this.workspacePackages=rt(e.config.projectRoot)}db;tsMorph;projects;language="typescript";importUsageCache=new Map;referencesCache=new Map;calleesCache=new Map;fileCalleesCache=new Map;signatureCache=new Map;sourceFileCache=new Map;definitionNodeCache=new Map;fileDefinitionNodeCache=new Map;indexedDefinitionLeafCache=new Map;packageImportReferenceIndex=null;packageExportIndex=null;workspacePackages;availability(){return{available:!0,tsconfigPath:this.projects[0]?.tsconfigPath,tsconfigPaths:this.projects.map(e=>e.tsconfigPath)}}importUsage(e){return h(this.importUsageCache,e,()=>{let t=this.sourceFile(e);if(!t)return[];let r=[];for(let i of t.getImportDeclarations())for(let o of this.importUsageForDeclaration(e,i))r.push(o);return r})}referencesFor(e){return h(this.referencesCache,e.symbolId,()=>{let t=this.nodeForDefinition(e),r=this.packageImportReferencesForDefinition(e);return t?ut(t,e,r,this.db.config.projectRoot):r})}calleesFor(e){return h(this.calleesCache,e.symbolId,()=>h(this.fileCalleesCache,e.relativePath,()=>this.calleeMapForFile(e.relativePath)).get(e.symbolId)??[])}signatureFor(e){return h(this.signatureCache,e.symbolId,()=>{let t=this.nodeForDefinition(e);if(!t||!this.tsMorph.Node.isFunctionDeclaration(t)&&!this.tsMorph.Node.isMethodDeclaration(t)&&!this.tsMorph.Node.isArrowFunction(t)&&!this.tsMorph.Node.isFunctionExpression(t)&&!this.tsMorph.Node.isConstructorDeclaration(t))return null;let r=t.getType().getCallSignatures()[0];if(!r)return null;let i=r.getParameters().map(s=>{let a=s.getDeclarations()[0],c=a?s.getTypeAtLocation(a).getText(a):s.getValueDeclaration()?.getType().getText()??"unknown";return de(c)}),o=r.getReturnType().getText(t);return`(${i.join(",")})=>${de(o)}`})}importUsageForDeclaration(e,t){let r=w(this.db,e,t.getModuleSpecifierValue()),i=le(t);return t.getImportClause()?.isTypeOnly()?i.map(o=>tt(e,r,o)):i.map(o=>this.valueImportUsageForEntry(e,r,o))}valueImportUsageForEntry(e,t,r){let i=r.identifier?r.identifier.findReferences():[],o=[];for(let l of i)for(let d of dt(l,e,r.identifier,this.db.config.projectRoot))o.push(d);let s=o.some(l=>!ue(l.node)),a=o.some(l=>ue(l.node)),c=r.isTypeOnly;return{importer:e,sourcePath:t,importedName:r.importedName,localName:r.localName,kind:r.kind,isTypeOnly:c,isUsed:c||o.length>0,isTypeUsed:c||a,isValueUsed:s,references:o.map(l=>l.location)}}sourceFile(e){return this.sourceFileMatch(e)?.sourceFile??null}sourceFileMatch(e){return It(e)?h(this.sourceFileCache,e,()=>{let t=g.join(this.db.config.projectRoot,e);for(let{project:r}of this.projects){let i=r.getSourceFile(t)??r.addSourceFileAtPathIfExists(t)??null;if(i)return{project:r,sourceFile:i}}return null}):null}packageImportReferencesForDefinition(e){return this.packageImportReferences().get(e.symbolId)??[]}packageImportReferences(){if(this.packageImportReferenceIndex)return this.packageImportReferenceIndex;let e=new Map,t=this.packageExports();for(let r of this.indexedTypeScriptLikeDocuments())this.addPackageImportReferencesForDocument(e,t,r);for(let[r,i]of e)e.set(r,J(i));return this.packageImportReferenceIndex=e,e}indexedTypeScriptLikeDocuments(){return this.db.all(`SELECT relative_path
17
- FROM documents
18
- WHERE (
19
- relative_path LIKE '%.ts'
20
- OR relative_path LIKE '%.tsx'
21
- OR relative_path LIKE '%.mts'
22
- OR relative_path LIKE '%.cts'
23
- OR relative_path LIKE '%.js'
24
- OR relative_path LIKE '%.jsx'
25
- OR relative_path LIKE '%.mjs'
26
- OR relative_path LIKE '%.cjs'
27
- )
28
- ${this.db.pathExclusionsFor("documents")}`).map(e=>e.relative_path)}addPackageImportReferencesForDocument(e,t,r){if(this.db.isIgnored(r))return;let i=this.sourceFileMatch(r);if(i)for(let o of i.sourceFile.getImportDeclarations())this.addPackageImportReferencesForDeclaration(e,t,r,o)}addPackageImportReferencesForDeclaration(e,t,r,i){let o=st(this.workspacePackages,i.getModuleSpecifierValue());if(!o)return;let s=t.get(o);if(s)for(let a of le(i)){if(a.kind!=="named"||!a.identifier)continue;let c=s.get(a.importedName);if(!c||c.size===0)continue;let l=ft(a.identifier,r,this.db.config.projectRoot);l.length>0&&ht(e,c,l)}}packageExports(){if(this.packageExportIndex)return this.packageExportIndex;let e=new Map;for(let t of this.workspacePackages){let r=new Map;for(let i of at(t))this.collectPackageExports(t,i,r,new Set);r.size>0&&e.set(t.name,r)}return this.packageExportIndex=e,e}collectPackageExports(e,t,r,i){if(i.has(t))return;i.add(t);let o=this.sourceFile(t);if(o)for(let s of o.getExportDeclarations()){let a=s.getModuleSpecifierValue(),c=a?w(this.db,t,a):t;if(!c||!c.startsWith(`${e.sourceRootRelative}/`))continue;let l=s.getNamedExports();if(l.length===0){if(s.isNamespaceExport())continue;this.collectPackageExports(e,c,r,i);continue}for(let d of l){let m=d.getNameNode().getText(),B=d.getAliasNode()?.getText()??m,V=this.indexedDefinitionByLeaf(c,m);if(!V)continue;let R=r.get(B);R||(R=new Set,r.set(B,R)),R.add(V.symbolId)}}}indexedDefinitionByLeaf(e,t){return h(this.indexedDefinitionLeafCache,e,()=>mt(this.db,e)).get(t)??null}nodeForDefinition(e){return h(this.definitionNodeCache,e.symbolId,()=>this.definitionNodesForFile(e.relativePath).get(e.symbolId)??null)}definitionNodesForFile(e){return h(this.fileDefinitionNodeCache,e,()=>{let t=this.sourceFile(e);if(!t)return new Map;let r=Ze(this.db,e);return r.size===0?new Map:et(this.tsMorph,t,r)})}definitionFromSymbol(e){let t=e.getDeclarations();for(let r of t){let i=r.getSourceFile(),o=_(this.db.config.projectRoot,i.getFilePath());if(!o||this.db.isIgnored(o))continue;let s=L(i,r),a=gt(this.db,o,s,e.getName());if(a)return{symbol:a.symbol,file:a.relativePath,line:a.startLine}}return null}calleeMapForFile(e){let t=this.sourceFile(e);if(!t)return new Map;let r=F(this.db,e).sort((o,s)=>o.startLine-s.startLine||s.endLine-o.endLine);if(r.length===0)return new Map;let i=new Map;t.forEachDescendant(o=>{if(!this.tsMorph.Node.isCallExpression(o)&&!this.tsMorph.Node.isNewExpression(o))return;let s=this.semanticCalleeForCallNode(t,r,o);s&&nt(i,s.callerId,s.target)});for(let[o,s]of i)i.set(o,yt(s));return i}semanticCalleeForCallNode(e,t,r){let i=St(t,L(e,r));if(!i)return null;let o=r.getExpression(),s=o.getSymbol()??o.getType().getSymbol(),a=s?this.definitionFromSymbol(s):null;return a?{callerId:i.symbolId,target:{symbol:a.symbol,file:a.file,line:a.line}}:null}};function le(n){let e=[],t=n.getDefaultImport();t&&e.push({identifier:t,importedName:"default",localName:t.getText(),kind:"default",isTypeOnly:n.getImportClause()?.isTypeOnly()??!1});let r=n.getNamespaceImport();r&&e.push({identifier:r,importedName:"*",localName:r.getText(),kind:"namespace",isTypeOnly:n.getImportClause()?.isTypeOnly()??!1});for(let i of n.getNamedImports()){let o=i.getNameNode(),a=i.getAliasNode()??(o.getKindName()==="Identifier"?o:null);e.push({identifier:a,importedName:o.getText(),localName:a?.getText()??o.getText(),kind:"named",isTypeOnly:i.isTypeOnly()||(n.getImportClause()?.isTypeOnly()??!1)})}return e.length===0&&e.push({identifier:null,importedName:"*",localName:null,kind:"side-effect",isTypeOnly:!1}),e}function Ze(n,e){let t=new Map;for(let r of F(n,e)){let i=C(r.symbol)??r.leaf;if(!i)continue;let o=t.get(i);o||(o=[],t.set(i,o)),o.push(r)}return t}function et(n,e,t){let r=new Map,i=new Map;return e.forEachDescendant(o=>{for(let s of pt(n,o)){let a=t.get(s);if(!a)continue;let c=L(e,o);for(let l of a){if(c<l.startLine-1||c>l.endLine+1)continue;let d=Math.abs(c-l.startLine),m=i.get(l.symbolId);m!==void 0&&m<=d||(i.set(l.symbolId,d),r.set(l.symbolId,o))}}}),r}function tt(n,e,t){return{importer:n,sourcePath:e,importedName:t.importedName,localName:t.localName,kind:t.kind,isTypeOnly:!0,isUsed:!0,isTypeUsed:!0,isValueUsed:!1,references:[]}}function nt(n,e,t){let r=n.get(e);r||(r=[],n.set(e,r)),r.push(t)}function rt(n){let e=g.join(n,"package.json");if(!T(e))return[];let t;try{t=JSON.parse(fe(e,"utf8"))}catch{return[]}return(Array.isArray(t.workspaces)?t.workspaces:t.workspaces?.packages??[]).flatMap(i=>it(n,i)).flatMap(i=>ot(n,i))}function it(n,e){if(!e||e.startsWith("!")||e.includes("node_modules"))return[];if(!e.includes("*")){let s=g.join(n,e);return T(g.join(s,"package.json"))?[s]:[]}let t=e.indexOf("*"),r=e.slice(0,t).replace(/\/$/,""),i=e.slice(t+1).replace(/^\//,""),o=g.join(n,r||".");if(!T(o))return[];try{return Ge(o).map(s=>g.join(o,s,i)).filter(s=>T(g.join(s,"package.json")))}catch{return[]}}function ot(n,e){try{let t=JSON.parse(fe(g.join(e,"package.json"),"utf8"));if(!t.name)return[];let r=g.relative(n,e).replace(/\\/g,"/");return[{name:t.name,rootRelative:r,sourceRootRelative:`${r}/src`}]}catch{return[]}}function st(n,e){for(let t of n)if(e===t.name||e.startsWith(`${t.name}/`))return t.name;return null}function at(n){return[`${n.sourceRootRelative}/index.ts`,`${n.sourceRootRelative}/index.tsx`,`${n.sourceRootRelative}/index.mts`,`${n.sourceRootRelative}/index.cts`]}function ct(n,e){return n.getReferences().map(t=>{let r=t.getNode();return ge(r,e)})}function lt(n){let e=n;return typeof e.findReferences=="function"?e.findReferences():[]}function ut(n,e,t,r){let i=[];for(let o of lt(n))for(let s of ct(o,r))s.file===e.relativePath&&s.line>=e.startLine&&s.line<=e.endLine||i.push(s);for(let o of t)i.push(o);return J(i)}function dt(n,e,t,r){let i=[],o=t?.getStart();for(let s of n.getReferences()){let a=s.getNode();_(r,a.getSourceFile().getFilePath())===e&&(o!==void 0&&a.getStart()===o||i.push({location:ge(a,r),node:a}))}return i}function ge(n,e){let t=n.getSourceFile(),r=t.getLineAndColumnAtPos(n.getStart());return{file:_(e,t.getFilePath())??t.getBaseName(),line:r.line-1,column:r.column-1}}function ft(n,e,t){let r=n.getSourceFile(),i=L(r,n),o=n.getText(),s=new RegExp(`\\b${xt(o)}\\b`,"g"),a=r.getFullText().split(`
29
- `),c=[];for(let l=0;l<a.length;l++){if(l===i)continue;let d=a[l]??"";s.lastIndex=0;let m;for(;(m=s.exec(d))!==null;)c.push({file:e,line:l,column:m.index})}return J(c.filter(l=>_(t,g.join(t,l.file))===e))}function ue(n){for(let e=n;e;e=e.getParent()){let t=e.getKindName();if(t.includes("Type")||t==="InterfaceDeclaration"||t==="TypeAliasDeclaration")return!0;if(t==="CallExpression"||t==="NewExpression"||t==="ExpressionStatement")return!1}return!1}function pt(n,e){let t=[],r=i=>{i&&!t.includes(i)&&t.push(i)};if("getNameNode"in e&&typeof e.getNameNode=="function"){let i=e.getNameNode();r(i?.getText())}if("getName"in e&&typeof e.getName=="function"){let i=e.getName();r(i)}return n.Node.isIdentifier(e)&&r(e.getText()),t}function gt(n,e,t,r){return n.all(`SELECT
30
- gs.id AS symbolId,
31
- gs.symbol,
32
- d.relative_path AS relativePath,
33
- COALESCE(der.start_line, c.start_line) AS startLine,
34
- COALESCE(der.end_line, c.end_line) AS endLine,
35
- COALESCE(gs.display_name, '') AS leaf,
36
- NULL AS parentTypeName,
37
- CASE WHEN gs.kind IN (6, 12, 13) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
38
- CASE WHEN gs.kind IN (5, 8, 11) THEN 1 ELSE 0 END AS isTypeLike,
39
- gs.kind AS kind,
40
- gs.documentation AS documentation,
41
- gs.enclosing_symbol AS enclosingSymbol
42
- FROM global_symbols gs
43
- LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
44
- LEFT JOIN chunks c ON c.document_id = der.document_id
45
- JOIN documents d ON d.id = der.document_id
46
- WHERE d.relative_path = ?
47
- AND COALESCE(gs.display_name, gs.symbol) LIKE ?
48
- ORDER BY ABS(COALESCE(der.start_line, c.start_line) - ?)
49
- LIMIT 5`,e,`%${r}%`,t)[0]??null}function mt(n,e){let t=n.all(`SELECT
50
- d.id AS documentId,
51
- gs.id AS symbolId,
52
- gs.symbol,
53
- d.relative_path AS relativePath,
54
- der.start_line AS startLine,
55
- der.end_line AS endLine,
56
- COALESCE(gs.display_name, '') AS leaf,
57
- NULL AS parentTypeName,
58
- CASE WHEN gs.kind IN (6, 12, 13) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
59
- CASE WHEN gs.kind IN (5, 8, 11) THEN 1 ELSE 0 END AS isTypeLike,
60
- gs.kind AS kind,
61
- gs.documentation AS documentation,
62
- gs.enclosing_symbol AS enclosingSymbol
63
- FROM global_symbols gs
64
- JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
65
- JOIN documents d ON d.id = der.document_id
66
- WHERE d.relative_path = ?
67
- UNION ALL
68
- SELECT
69
- d.id AS documentId,
70
- gs.id AS symbolId,
71
- gs.symbol,
72
- d.relative_path AS relativePath,
73
- MIN(c.start_line) AS startLine,
74
- MAX(c.end_line) AS endLine,
75
- COALESCE(gs.display_name, '') AS leaf,
76
- NULL AS parentTypeName,
77
- CASE WHEN gs.kind IN (6, 12, 13) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
78
- CASE WHEN gs.kind IN (5, 8, 11) THEN 1 ELSE 0 END AS isTypeLike,
79
- gs.kind AS kind,
80
- gs.documentation AS documentation,
81
- gs.enclosing_symbol AS enclosingSymbol
82
- FROM global_symbols gs
83
- JOIN mentions m ON m.symbol_id = gs.id
84
- JOIN chunks c ON c.id = m.chunk_id
85
- JOIN documents d ON d.id = c.document_id
86
- WHERE d.relative_path = ?
87
- AND m.role = 1
88
- GROUP BY gs.id, gs.symbol, d.id, d.relative_path, gs.display_name, gs.kind, gs.documentation, gs.enclosing_symbol
89
- ORDER BY startLine, endLine`,e,e),r=new Set,i=new Map;for(let o of t){if(r.has(o.symbolId))continue;r.add(o.symbolId);let s=o.leaf||C(o.symbol);!s||i.has(s)||i.set(s,{...o,leaf:s})}return i}function St(n,e){let t=null;for(let r of n)e<r.startLine||e>r.endLine||(!t||r.startLine>=t.startLine)&&(t=r);return t}function L(n,e){return n.getLineAndColumnAtPos(e.getStart()).line-1}function J(n){let e=new Set,t=[];for(let r of n){let i=`${r.file}:${r.line}:${r.column}`;e.has(i)||(e.add(i),t.push(r))}return t}function ht(n,e,t){for(let r of e){let i=n.get(r)??[];i.push(...t),n.set(r,i)}}function yt(n){let e=new Set,t=[];for(let r of n){let i=`${r.symbol}|${r.file}|${r.line}`;e.has(i)||(e.add(i),t.push(r))}return t}function h(n,e,t){if(n.has(e))return n.get(e);let r=t();return n.set(e,r),r}function _(n,e){let t=g.relative(n||process.cwd(),e).replace(/\\/g,"/");return!t||t.startsWith("..")?null:t}function It(n){return/\.(?:ts|tsx|mts|cts|js|jsx|mjs|cjs)$/.test(n)}function de(n){return n.replace(/\s+/g," ").replace(/\bimport\("[^"]+"\)\./g,"").trim()}function xt(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var me=new WeakMap;function Se(n,e){let t=`${n.config.projectRoot}:typescript-workspace`,r=me.get(n);r||(r=new Map,me.set(n,r));let i=r.get(t);if(i)return i;let o=pe(n,e);return r.set(t,o),o}function Kt(n,e){let t=M(n,e);return t?t.importUsage(e):[]}function Et(n,e){let t=M(n,e.relativePath);return t?t.referencesFor(e):[]}function Ht(n,e){let t=new Map;for(let r of e)for(let i of Et(n,r)){if(i.file===r.relativePath||n.isIgnored(i.file))continue;let o=t.get(r.symbolId);o||(o=new Set,t.set(r.symbolId,o)),o.add(i.file)}return t}function Xt(n,e){let t=new Map;for(let r of e){let i=M(n,r.relativePath);if(!i)continue;let o=i.calleesFor(r);o.length>0&&t.set(r.symbolId,o)}return t}function Jt(n,e){let t=M(n,e.relativePath);return t?t.signatureFor(e):null}function M(n,e){if(!Nt(e))return null;let t=Se(n,e);return t.availability().available?t:null}function Nt(n){return/\.(?:ts|tsx|mts|cts|js|jsx|mjs|cjs)$/.test(n)}export{G as a,ee as b,ne as c,Rt as d,Le as e,w as f,Ce as g,Fe as h,Oe as i,Pe as j,Ae as k,je as l,x as m,Kt as n,Et as o,Ht as p,Xt as q,Jt as r};
90
- //# sourceMappingURL=chunk-Z4AMQWVY.js.map