scip-query 0.8.2 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.md +21 -8
  2. package/dist/{chunk-2EC4JTHC.js → chunk-2DVVHNC3.js} +2 -2
  3. package/dist/{chunk-HVGNOUYP.js → chunk-2Y2WIJI4.js} +2 -2
  4. package/dist/{chunk-GMEBYEMU.js → chunk-3YQO3S5D.js} +2 -2
  5. package/dist/chunk-44G4P3GJ.js +2 -0
  6. package/dist/{chunk-ZIIQ55VK.js → chunk-6HP3BKIP.js} +2 -2
  7. package/dist/chunk-B32FX5KB.js +2 -0
  8. package/dist/{chunk-MKE7SEEX.js → chunk-FYT2PE7C.js} +2 -2
  9. package/dist/{chunk-66ORT3LS.js → chunk-HDA2V5DC.js} +2 -2
  10. package/dist/{chunk-4A4JFNWG.js → chunk-I66MQD5U.js} +2 -2
  11. package/dist/chunk-IBM6FXOQ.js +3 -0
  12. package/dist/{chunk-4B7YLRXX.js → chunk-ITUU3VE3.js} +2 -2
  13. package/dist/{chunk-QYQXPPDI.js → chunk-K3V6XUTL.js} +2 -2
  14. package/dist/{chunk-XSZ5NC4O.js → chunk-L6TOEQ2M.js} +2 -2
  15. package/dist/{chunk-JAMU6FLN.js → chunk-LBAMALDV.js} +2 -2
  16. package/dist/chunk-LR7E2ATW.js +8 -0
  17. package/dist/chunk-NM3BZXHA.js +2 -0
  18. package/dist/{chunk-NOVKLH2F.js → chunk-NO2TPMCQ.js} +1 -1
  19. package/dist/{chunk-SSINY7HL.js → chunk-OMNT7E2T.js} +2 -2
  20. package/dist/chunk-R3G6ERW7.js +7 -0
  21. package/dist/{chunk-7UZWNW4E.js → chunk-SEZZ24IG.js} +2 -2
  22. package/dist/{chunk-DJTJ3DLZ.js → chunk-SLX5XBCD.js} +2 -2
  23. package/dist/{chunk-K4Z3FCUJ.js → chunk-SQ6VENQY.js} +3 -3
  24. package/dist/chunk-T4AK46CM.js +16 -0
  25. package/dist/{chunk-FIPE5AQT.js → chunk-TA4DDU7J.js} +2 -2
  26. package/dist/{chunk-UQE3DSXY.js → chunk-TCCUWKH4.js} +2 -2
  27. package/dist/{chunk-HVXIXDLV.js → chunk-U254PV4S.js} +2 -2
  28. package/dist/chunk-UIWAZ2NT.js +2 -0
  29. package/dist/{chunk-K6YIGVL7.js → chunk-VHENVDS2.js} +2 -2
  30. package/dist/{chunk-SB6I6O3P.js → chunk-VQGQHIAT.js} +2 -2
  31. package/dist/{chunk-FTBT4RP2.js → chunk-VTF5EH22.js} +2 -2
  32. package/dist/{chunk-SLOIQKY7.js → chunk-Y3RUPPIU.js} +2 -2
  33. package/dist/{chunk-OIMM7KMI.js → chunk-YO6DU7QZ.js} +2 -2
  34. package/dist/{chunk-EM2PPDN7.js → chunk-YSSTUCNS.js} +2 -2
  35. package/dist/cli.js +167 -149
  36. package/dist/index.js +1 -1
  37. package/dist/postinstall.js +2 -2
  38. package/dist/queries/bottlenecks.js +1 -1
  39. package/dist/queries/change-surface.js +1 -1
  40. package/dist/queries/cleanup-plan.js +1 -1
  41. package/dist/queries/co-change.js +1 -1
  42. package/dist/queries/complexity-hotspots.js +1 -1
  43. package/dist/queries/complexity.js +1 -1
  44. package/dist/queries/dead.js +1 -1
  45. package/dist/queries/diff-gate.d.ts +4 -1
  46. package/dist/queries/diff-gate.js +1 -1
  47. package/dist/queries/diff-impact.d.ts +3 -1
  48. package/dist/queries/diff-impact.js +1 -1
  49. package/dist/queries/doc-drift.js +1 -1
  50. package/dist/queries/drift.js +1 -1
  51. package/dist/queries/extract-candidates.js +1 -1
  52. package/dist/queries/health.js +1 -1
  53. package/dist/queries/incomplete-migration.d.ts +71 -0
  54. package/dist/queries/incomplete-migration.js +2 -0
  55. package/dist/queries/index.d.ts +1 -0
  56. package/dist/queries/index.js +1 -1
  57. package/dist/queries/isolated.js +1 -1
  58. package/dist/queries/members.js +1 -1
  59. package/dist/queries/methods.js +1 -1
  60. package/dist/queries/passthrough-candidates.js +1 -1
  61. package/dist/queries/plan-context.js +1 -1
  62. package/dist/queries/recent-duplicates.js +1 -1
  63. package/dist/queries/redundant-reexports.js +1 -1
  64. package/dist/queries/self-audit.js +1 -1
  65. package/dist/queries/similar-files.js +1 -1
  66. package/dist/queries/similar.d.ts +15 -1
  67. package/dist/queries/similar.js +1 -1
  68. package/dist/queries/slice.js +1 -1
  69. package/dist/queries/stale-abstractions.js +1 -1
  70. package/dist/queries/surface.js +1 -1
  71. package/dist/queries/unused-params.js +1 -1
  72. package/dist/queries/wrapper-candidates.js +1 -1
  73. package/dist/runtime.js +1 -1
  74. package/package.json +5 -1
  75. package/skills/scip-query/SKILL.md +79 -0
  76. package/dist/chunk-6P5W4U6G.js +0 -16
  77. package/dist/chunk-GTZAU7OL.js +0 -2
  78. package/dist/chunk-N5D5ZCBW.js +0 -7
  79. package/dist/chunk-OQSV6OS2.js +0 -2
  80. package/dist/chunk-RKTDEIHF.js +0 -2
  81. package/dist/chunk-XBFLIGWU.js +0 -3
@@ -1,7 +1,7 @@
1
- import{b as k}from"./chunk-OIMM7KMI.js";import{a as D}from"./chunk-NOVKLH2F.js";import{e as h,f as y}from"./chunk-TQTVM27C.js";import{n as S}from"./chunk-6ZFKI5EP.js";import{c as v,r as L}from"./chunk-SOGLYIJ4.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)||h(e,l.relativePath)||y(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:v(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"&&(h(e,t.relativePath)||y(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:v(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
1
+ import{b as k}from"./chunk-YO6DU7QZ.js";import{a as D}from"./chunk-NO2TPMCQ.js";import{e as h,f as y}from"./chunk-TQTVM27C.js";import{n as S}from"./chunk-6ZFKI5EP.js";import{c as v,r as L}from"./chunk-SOGLYIJ4.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)||h(e,l.relativePath)||y(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:v(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"&&(h(e,t.relativePath)||y(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:v(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?L(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=L(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-FTBT4RP2.js.map
7
+ //# sourceMappingURL=chunk-VTF5EH22.js.map
@@ -1,2 +1,2 @@
1
- import{a as b}from"./chunk-V76FCF5F.js";import{a as c,b as f}from"./chunk-MX6F756F.js";import{a as u}from"./chunk-NOVKLH2F.js";import{c as a,g as l}from"./chunk-SOGLYIJ4.js";import{g as d}from"./chunk-WQFOZIID.js";function D(i,e){let{scope:n,maxLoc:t=15,limit:r=30,scanLimit:g}=e??{},m=new u(i);return b({candidates:()=>y(m,n,t),orderCandidates:f,scanLimit:g,prepare:o=>m.calleeMap(o,{semantic:e?.semantic!==!1}),evaluate:(o,s)=>p(i,o,s.get(o.symbolId)??[]),orderResults:(o,s)=>o.loc-s.loc||o.file.localeCompare(s.file),limit:r})}function p(i,e,n){let t=h(n);if(t.size!==1||!d(i,e.relativePath,e.startLine,e.endLine))return null;let[,r]=[...t.entries()][0];return{symbol:e.symbol,shortName:a(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:c(e),forwardsTo:r.symbol,forwardsToShort:a(r.symbol),forwardsToFile:r.file}}function h(i){let e=i.some(t=>l(t.symbol))?i.filter(t=>l(t.symbol)):i,n=new Map;for(let t of e)n.has(t.symbol)||n.set(t.symbol,t);return n}function y(i,e,n){return i.productionCallableDefinitions({scope:e,minLoc:3,maxLoc:n,requireFunctionLikeSymbol:!0,excludeRootedSymbols:!0,excludeRustTraitImplMembers:!0})}export{D as a};
2
- //# sourceMappingURL=chunk-SLOIQKY7.js.map
1
+ import{a as b}from"./chunk-V76FCF5F.js";import{a as c,b as f}from"./chunk-MX6F756F.js";import{a as u}from"./chunk-NO2TPMCQ.js";import{c as a,g as l}from"./chunk-SOGLYIJ4.js";import{g as d}from"./chunk-WQFOZIID.js";function D(i,e){let{scope:n,maxLoc:t=15,limit:r=30,scanLimit:g}=e??{},m=new u(i);return b({candidates:()=>y(m,n,t),orderCandidates:f,scanLimit:g,prepare:o=>m.calleeMap(o,{semantic:e?.semantic!==!1}),evaluate:(o,s)=>p(i,o,s.get(o.symbolId)??[]),orderResults:(o,s)=>o.loc-s.loc||o.file.localeCompare(s.file),limit:r})}function p(i,e,n){let t=h(n);if(t.size!==1||!d(i,e.relativePath,e.startLine,e.endLine))return null;let[,r]=[...t.entries()][0];return{symbol:e.symbol,shortName:a(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:c(e),forwardsTo:r.symbol,forwardsToShort:a(r.symbol),forwardsToFile:r.file}}function h(i){let e=i.some(t=>l(t.symbol))?i.filter(t=>l(t.symbol)):i,n=new Map;for(let t of e)n.has(t.symbol)||n.set(t.symbol,t);return n}function y(i,e,n){return i.productionCallableDefinitions({scope:e,minLoc:3,maxLoc:n,requireFunctionLikeSymbol:!0,excludeRootedSymbols:!0,excludeRustTraitImplMembers:!0})}export{D as a};
2
+ //# sourceMappingURL=chunk-Y3RUPPIU.js.map
@@ -1,2 +1,2 @@
1
- import{c as G}from"./chunk-MX6F756F.js";import{a as E}from"./chunk-NOVKLH2F.js";import{a as F,d as N,e as k,f as T}from"./chunk-TQTVM27C.js";import{a as z}from"./chunk-EAU4RDFG.js";import{c as H,d as U,f as v,j as q}from"./chunk-6ZFKI5EP.js";import{b as I}from"./chunk-APLCSDXL.js";import{c as M,f as A,g as j,h as O,i as B,j as W,r as V,x}from"./chunk-SOGLYIJ4.js";import{c as P,e as _}from"./chunk-WQFOZIID.js";import{a as h}from"./chunk-NN3O7TPH.js";import{b as S}from"./chunk-VDZL45XI.js";var g=new WeakMap;function J(e,n){let t=P(n);return t==="rust"?pe(e,n):t==="typescript"||t==="tsx"||t==="javascript"?de(e,n):[]}var ue=new Set(["describe","it","test","fdescribe","fit","xdescribe","xit","beforeEach","afterEach","beforeAll","afterAll","before","after","suite","bench","benchmark"]);function de(e,n){let t=_(e,n);if(!t)return[];let i=g.get(t);if(i)return i;let r=/(^|\/)(pages|app)\/.+\.(tsx?|jsx?)$/.test(n)||/(^|\/)(layout|page|loading|error|not-found|head|template|default)\.(tsx?|jsx?)$/.test(n),o=/(^|\/)src\/(pages|views|routes)\/.+\.(tsx?|jsx?|vue)$/.test(n),s=!1,c=t.rootNode;for(let u of c.namedChildren){if(u.type!=="expression_statement")continue;let a=u.namedChild(0);if(!a||a.type!=="call_expression")continue;let d=a.namedChild(0);if(!d)continue;let f=d.type==="member_expression"?d.namedChild(d.namedChildCount-1)?.text:d.text;if(f&&ue.has(f)){s=!0;break}}let l=[];s&&l.push({startLine:0,endLine:c.endPosition.row,reason:"TS/JS test file (describe/it/test at top level)"}),(r||o)&&l.push({startLine:0,endLine:c.endPosition.row,reason:r?"Next.js / Remix route file":"Vite/Vue route component"});for(let u of c.namedChildren){let a=null,d=null;if(u.type==="function_declaration")a=u.namedChild(0)?.text??null,d=u;else if(u.type==="export_statement"){let f=u.namedChild(0);f?.type==="function_declaration"&&(a=f.namedChild(0)?.text??null,d=f)}else if(u.type==="lexical_declaration"){let f=u.namedChild(0);if(f?.type==="variable_declarator"){let b=f.namedChild(0)?.text,y=f.namedChild(1);b&&(y?.type==="arrow_function"||y?.type==="function_expression")&&(a=b,d=f)}}a&&/^use[A-Z]/.test(a)&&d&&l.push({startLine:d.startPosition.row,endLine:d.endPosition.row,reason:"React custom hook (use*)"})}return l.push(...K(t,new Set(["function_declaration","method_definition","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","variable_declarator","export_statement"]),new Set(["comment"]))),g.set(t,l),l}var fe=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale)?/i;function me(e){return fe.test(e)}function K(e,n,t){let i=[],r=o=>{if(n.has(o.type)&&o.parent){let c=o.parent.children,l=-1;for(let u=0;u<c.length;u+=1)if(c[u].startIndex===o.startIndex&&c[u].type===o.type){l=u;break}if(l>0)for(let u=l-1;u>=0;u-=1){let a=c[u];if(t.has(a.type)){if(me(a.text)){i.push({startLine:o.startPosition.row,endLine:o.endPosition.row,reason:"scip-query suppression comment"});break}continue}if(!(a.type==="attribute_item"||a.type==="inner_attribute_item"))break}}for(let s of o.namedChildren)r(s)};return r(e.rootNode),i}function pe(e,n){let t=_(e,n);if(!t)return[];let i=g.get(t);if(i)return i;let r=[],o=be(t);return o?(g.set(t,o),o):(X(t.rootNode,r,!1,!1),r.push(...K(t,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(...ve(t.rootNode)),g.set(t,r),r)}function be(e){return Ee(e.rootNode)?[{startLine:0,endLine:e.rootNode.endPosition.row,reason:"generated file (@generated header)"}]:null}function X(e,n,t,i){let r=t,o=i;e.type==="trait_item"&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait declaration body (dynamic dispatch)"}),e.type==="impl_item"&&e.childForFieldName("trait")&&(o=!0,n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl block (dynamic dispatch)"})),e.type==="function_item"||e.type==="function_signature_item"?ye(e,n,t,i):i&&_e(e)?n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl associated item (dynamic dispatch)"}):e.type==="struct_item"||e.type==="enum_item"||e.type==="union_item"?ge(e,n,t):e.type==="mod_item"&&C(e).some(s=>/#\[\s*cfg\s*\(\s*test\s*\)/.test(s))&&(r=!0);for(let s of e.namedChildren)X(s,n,r,o)}function ye(e,n,t,i){let r=C(e),o=null;i?o="trait impl method (dynamic dispatch)":t&&(o="inside #[cfg(test)] mod");for(let s of r){let c=xe(s);if(c){o=c;break}if(Z(s)){o="#[allow(dead_code)]";break}}o&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:o})}function ge(e,n,t){let i=C(e),r=e.namedChildren.find(o=>o.type==="type_identifier")?.text;i.some(Se)&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[derive(<reflective>)] \u2014 fields accessed via macro/reflection",containerName:r}),i.some(Z)&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[allow(dead_code)]",containerName:r}),t&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"inside #[cfg(test)] mod",containerName:r})}function C(e){let n=e.parent;if(!n)return[];let t=n.children,i=-1;for(let o=0;o<t.length;o+=1)if(t[o].startIndex===e.startIndex&&t[o].type===e.type){i=o;break}if(i<=0)return[];let r=[];for(let o=i-1;o>=0;o-=1){let s=t[o];if(s.type==="attribute_item"||s.type==="inner_attribute_item")r.push(s.text);else{if(s.type==="line_comment"||s.type==="block_comment")continue;break}}return r}var he=[{re:/#\[\s*tauri::command\b/,reason:"#[tauri::command]"},{re:/#\[\s*command\b/,reason:"#[command]"},{re:/#\[\s*test\b/,reason:"#[test]"},{re:/#\[\s*bench\b/,reason:"#[bench]"},{re:/#\[\s*tokio::test\b/,reason:"#[tokio::test]"},{re:/#\[\s*async_std::test\b/,reason:"#[async_std::test]"},{re:/#\[\s*wasm_bindgen\b/,reason:"#[wasm_bindgen]"},{re:/#\[\s*no_mangle\b/,reason:"#[no_mangle]"},{re:/#\[\s*napi\b/,reason:"#[napi]"},{re:/#\[\s*pyfunction\b/,reason:"#[pyfunction]"},{re:/#\[\s*pymethod\b/,reason:"#[pymethod]"},{re:/#\[\s*pyo3\b/,reason:"#[pyo3]"},{re:/#\[\s*cfg\s*\(\s*test\s*\)/,reason:"#[cfg(test)]"},{re:/#\[\s*doc\s*\(\s*hidden\s*\)/,reason:"#[doc(hidden)]"}];function xe(e){return he.find(({re:n})=>n.test(e))?.reason??null}var Re=[/\bSerialize\b/,/\bDeserialize\b/,/\bFromRow\b/,/\bsqlx::FromRow\b/,/\bDeriveEntityModel\b/,/\bIntoSchema\b/,/\bToSchema\b/,/\bDeriveValueType\b/,/\bError\b/,/\bthiserror::Error\b/];function Se(e){return/#\[\s*derive\s*\(/.test(e)?Re.some(n=>n.test(e)):!1}function Z(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 ve(e){let n=De(e);if(n.size===0)return[];let t=[];for(let i of e.descendantsOfType("mod_item")){let r=i.childForFieldName("name")?.text;r&&n.has(r)&&t.push({startLine:i.startPosition.row,endLine:i.endPosition.row,reason:'serde `with = "..."` module \u2014 body invoked via reflection',containerName:r})}return t}function Ee(e){for(let n=0;n<Math.min(e.namedChildCount,12);n+=1){let t=e.namedChild(n);if(!t||t.type!=="line_comment"&&t.type!=="block_comment")break;if(/@generated\b/.test(t.text)||/This file is .*generated\b/i.test(t.text)||/Code generated by/i.test(t.text)||/Generated by:\s*https?:\/\/openapi-generator/i.test(t.text)||/openapi-generator/i.test(t.text)&&/Generated by/i.test(t.text))return!0}return!1}var Ce=/^#!?\[\s*serde\s*\(/,$=/\bwith\s*=\s*"([^"]+)"/g;function De(e){let n=new Set;for(let t of e.descendantsOfType("attribute_item")){if(!Ce.test(t.text))continue;$.lastIndex=0;let i;for(;(i=$.exec(t.text))!==null;){let r=i[1],o=r.split("::").pop()??r;o&&n.add(o)}}return n}function Q(e){let n=new Map,t=i=>{let r=n.get(i);if(r)return r;let o=J(e,i);return r={ranges:o.map(s=>({startLine:s.startLine,endLine:s.endLine})),containers:new Set(o.map(s=>s.containerName).filter(s=>!!s))},n.set(i,r),r};return(i,r,o,s)=>{let c=t(i);for(let l of c.ranges)if(r>=l.startLine&&r<=l.endLine)return!0;if(s&&c.containers.has(s))return!0;for(let l of x(o))if(c.containers.has(l))return!0;return!1}}function ze(e,n={}){S(e,{groups:n.semanticProvider===!0?["whole-project","semantic-provider"]:["whole-project"]})}function D(e,n,t={}){S(e,{groups:t.definitions===!0?["source-file","definition-catalog"]:["source-file"],file:n.replace(/\\/g,"/")})}function ee(e,n){return n.isIgnoredPath(e.relativePath)?m("ignored-file"):O(e.symbol)?m("module-like-symbol"):Y(e.symbol)?!e.isFunctionLike&&e.enclosingSymbol&&Y(e.enclosingSymbol)?m("nested-non-callable-value"):!n.includeTests&&!w(e.relativePath)?m("test-file"):!n.includeTests&&n.isExcludedRegion(e.relativePath,e.startLine,e.symbol,e.parentTypeName)?m("excluded-file-region"):B(e.symbol)?m("rust-trait-impl-member"):W(e.symbol)?m("rust-test-module"):!n.includeMembers&&!we(e)?m("member"):e.endLine-e.startLine+1<n.minLoc?m("below-min-loc"):{accepted:!0}:m("non-value-symbol")}function w(e){return F(e)!=="test"}function m(e){return{accepted:!1,rejectionReason:e}}function Y(e){return j(e)||e.endsWith("().")||e.endsWith(".")}function we(e){return A(e.symbol)||x(e.symbol).length===0}function te(){return new Map}function ne(e,n,t){let i=new Map;for(let r of H(e,t))e.isIgnored(r.relative_path)||n.has(r.relative_path)||R(i,r.symbol_id,r.relative_path,r.ref_count,"scip-mention");return i}function re(e,n,t){let i=new Set;for(let r of U(e,n))e.isIgnored(r.relative_path)||t.has(r.relative_path)||i.add(r.symbol_id);return i}function L(e,n){let t=e.get(n);if(!t)return!1;for(let i of t.values())if(i.occurrences>0)return!0;return!1}function ie(e){return e?.occurrences??0}function R(e,n,t,i,r="source-fallback"){if(i<=0)return;let o=se(e,n,t);o.occurrences+=i,o.sources.add(r)}function oe(e,n,t,i,r){if(i<=0)return;let o=se(e,n,t);o.occurrences=Math.max(i,o.occurrences),o.sources.add(r)}function se(e,n,t){let i=e.get(n);i||(i=new Map,e.set(n,i));let r=i.get(t);return r||(r={occurrences:0,sources:new Set},i.set(t,r)),r}function mt(e,n={}){let{scope:t,minLoc:i=1,includeTests:r=!1,skipBarrels:o=!1,includeMembers:s=!1,deadCodeOnly:c=!1,scanLimit:l,semantic:u=!0}=n,a=G(Le(e,{scope:t,minLoc:i,includeTests:r,includeMembers:s}),l),d=o?new Set(N(e)):new Set,f=c?te():ne(e,d,a.map(p=>p.symbolId)),b=c?re(e,a.map(p=>p.symbolId),d):new Set,y=c?a.filter(p=>!b.has(p.symbolId)):a;c?ke(e,y,f,d):Ne(e,y,f,d);let ce=c?y.filter(p=>!L(f,p.symbolId)):a;Oe(e,ce,f,{includeTests:r,inactiveBarrelPaths:d,includeSemantic:!c&&u});let le=c?y.filter(p=>!L(f,p.symbolId)):a;return Fe(e,Pe(le,f))}function Le(e,n){let t=Q(e),i=[];for(let r of h(e,{scope:n.scope}))try{for(let o of V(e,r))ee(o,{minLoc:n.minLoc,includeTests:n.includeTests,includeMembers:n.includeMembers,isIgnoredPath:c=>e.isIgnored(c),isExcludedRegion:t}).accepted&&i.push(o)}finally{D(e,r,{definitions:!0})}return i}function Pe(e,n){return e.map(t=>Ie(t,n)).filter(t=>t.cross_file_refs===0).sort((t,i)=>i.loc-t.loc||t.relative_path.localeCompare(i.relative_path)||t.start_line-i.start_line)}function Ie(e,n){let t=n.get(e.symbolId)??new Map,i=ie(t.get(e.relativePath)),r=0;for(let[o,s]of t)o!==e.relativePath&&(r+=s.occurrences);return{relative_path:e.relativePath,start_line:e.startLine,end_line:e.endLine,loc:e.endLine-e.startLine+1,symbol:e.symbol,same_file_refs:i,cross_file_refs:r}}function Fe(e,n){let t=[],i=0,r=0,o=0;for(let s of n){if(e.isIgnored(s.relative_path)||k(e,s.relative_path)||T(e,s.symbol,s.relative_path))continue;let c=s.same_file_refs===0?"dead-code":"file-internal";c==="dead-code"?i++:r++,o+=s.loc,t.push({relativePath:s.relative_path,startLine:s.start_line,endLine:s.end_line,loc:s.loc,symbol:s.symbol,shortName:M(s.symbol),sameFileRefs:s.same_file_refs,kind:c})}return{symbols:t,totalCount:t.length,deadCodeCount:i,fileInternalCount:r,totalLoc:o}}function Ne(e,n,t,i){if(n.length===0)return;let r=new E(e),o=new Set(n.map(l=>l.symbolId)),s=new Set(n.map(l=>l.leaf).filter(Boolean)),c=new Set(r.sourceFiles());for(let l of h(e))c.add(l);r.scanSourceReferences({paths:c,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:s,skipPath:l=>i.has(l)},l=>{o.has(l.target.symbolId)&&(Ae(e,l)||R(t,l.target.symbolId,l.sourceFile,je(l),"source-fallback"))})}function ke(e,n,t,i){if(n.length===0)return;let r=new E(e),o=Te(n),s=new Set(r.sourceFiles());for(let a of h(e))s.add(a);let c=new Set(o.keys()),l=new Map,u=a=>{let d=l.get(a);return d||(d=q(e,a),l.set(a,d)),d};r.scanSourceReferences({paths:s,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:c,skipPath:a=>i.has(a),resolveTargets:({sourceFile:a,name:d,kind:f})=>{let b=o.get(d);return b?Me(a,d,b,u(a),{permissive:f!=="cross-language-dispatch"}):[]},afterPath:a=>{l.delete(a),D(e,a)}},a=>{let d=a.kind==="identifier"&&a.sourceFile===a.target.relativePath?Math.max(0,a.occurrences-1):a.occurrences;a.kind==="identifier"&&ae(e,{sourceFile:a.sourceFile,name:a.name,target:a.target,occurrences:d})||R(t,a.target.symbolId,a.sourceFile,d,"source-fallback")})}function Te(e){let n=new Map;for(let t of e){if(!t.leaf)continue;let i=n.get(t.leaf)??[];i.push(t),n.set(t.leaf,i)}return n}function Me(e,n,t,i,r){let o=t.filter(l=>l.relativePath===e);if(o.length>0)return o;if(!r.permissive&&t.length===1)return[...t];let s=i.get(n);if(s)for(let l of s){let u=t.filter(a=>v(l,a.relativePath));if(u.length>0)return u}let c=new Set;for(let l of i.values())for(let u of l)c.add(u);for(let l of c){let u=t.filter(a=>v(l,a.relativePath));if(u.length>0&&u.length===t.length)return u}return r.permissive?[...t]:[]}function Ae(e,n){return n.kind==="cross-language-dispatch"&&n.target.relativePath===n.sourceFile?!0:n.kind==="identifier"&&ae(e,n)}function je(e){return e.kind==="identifier"&&e.target.relativePath===e.sourceFile?Math.max(0,e.occurrences-1):e.occurrences}function ae(e,n){return n.occurrences>1?!1:I(e,n.sourceFile).some(t=>t.used||t.sourcePath!==n.target.relativePath?!1:t.importedName===n.name||t.localName===n.name)}function Oe(e,n,t,i){for(let r of n){let o=z(e,r,{semantic:i.includeSemantic!==!1});if(o.length!==0)for(let s of o){let c=s.file;c===r.relativePath||e.isIgnored(c)||i.inactiveBarrelPaths.has(c)||!i.includeTests&&!w(c)||oe(t,r.symbolId,c,1,"caller-map")}}}export{ze as a,mt as b};
2
- //# sourceMappingURL=chunk-OIMM7KMI.js.map
1
+ import{c as G}from"./chunk-MX6F756F.js";import{a as E}from"./chunk-NO2TPMCQ.js";import{a as F,d as N,e as k,f as T}from"./chunk-TQTVM27C.js";import{a as z}from"./chunk-EAU4RDFG.js";import{c as H,d as U,f as v,j as q}from"./chunk-6ZFKI5EP.js";import{b as I}from"./chunk-APLCSDXL.js";import{c as M,f as A,g as j,h as O,i as B,j as W,r as V,x}from"./chunk-SOGLYIJ4.js";import{c as P,e as _}from"./chunk-WQFOZIID.js";import{a as h}from"./chunk-NN3O7TPH.js";import{b as S}from"./chunk-VDZL45XI.js";var g=new WeakMap;function J(e,n){let t=P(n);return t==="rust"?pe(e,n):t==="typescript"||t==="tsx"||t==="javascript"?de(e,n):[]}var ue=new Set(["describe","it","test","fdescribe","fit","xdescribe","xit","beforeEach","afterEach","beforeAll","afterAll","before","after","suite","bench","benchmark"]);function de(e,n){let t=_(e,n);if(!t)return[];let i=g.get(t);if(i)return i;let r=/(^|\/)(pages|app)\/.+\.(tsx?|jsx?)$/.test(n)||/(^|\/)(layout|page|loading|error|not-found|head|template|default)\.(tsx?|jsx?)$/.test(n),o=/(^|\/)src\/(pages|views|routes)\/.+\.(tsx?|jsx?|vue)$/.test(n),s=!1,c=t.rootNode;for(let u of c.namedChildren){if(u.type!=="expression_statement")continue;let a=u.namedChild(0);if(!a||a.type!=="call_expression")continue;let d=a.namedChild(0);if(!d)continue;let f=d.type==="member_expression"?d.namedChild(d.namedChildCount-1)?.text:d.text;if(f&&ue.has(f)){s=!0;break}}let l=[];s&&l.push({startLine:0,endLine:c.endPosition.row,reason:"TS/JS test file (describe/it/test at top level)"}),(r||o)&&l.push({startLine:0,endLine:c.endPosition.row,reason:r?"Next.js / Remix route file":"Vite/Vue route component"});for(let u of c.namedChildren){let a=null,d=null;if(u.type==="function_declaration")a=u.namedChild(0)?.text??null,d=u;else if(u.type==="export_statement"){let f=u.namedChild(0);f?.type==="function_declaration"&&(a=f.namedChild(0)?.text??null,d=f)}else if(u.type==="lexical_declaration"){let f=u.namedChild(0);if(f?.type==="variable_declarator"){let b=f.namedChild(0)?.text,y=f.namedChild(1);b&&(y?.type==="arrow_function"||y?.type==="function_expression")&&(a=b,d=f)}}a&&/^use[A-Z]/.test(a)&&d&&l.push({startLine:d.startPosition.row,endLine:d.endPosition.row,reason:"React custom hook (use*)"})}return l.push(...K(t,new Set(["function_declaration","method_definition","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","variable_declarator","export_statement"]),new Set(["comment"]))),g.set(t,l),l}var fe=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale)?/i;function me(e){return fe.test(e)}function K(e,n,t){let i=[],r=o=>{if(n.has(o.type)&&o.parent){let c=o.parent.children,l=-1;for(let u=0;u<c.length;u+=1)if(c[u].startIndex===o.startIndex&&c[u].type===o.type){l=u;break}if(l>0)for(let u=l-1;u>=0;u-=1){let a=c[u];if(t.has(a.type)){if(me(a.text)){i.push({startLine:o.startPosition.row,endLine:o.endPosition.row,reason:"scip-query suppression comment"});break}continue}if(!(a.type==="attribute_item"||a.type==="inner_attribute_item"))break}}for(let s of o.namedChildren)r(s)};return r(e.rootNode),i}function pe(e,n){let t=_(e,n);if(!t)return[];let i=g.get(t);if(i)return i;let r=[],o=be(t);return o?(g.set(t,o),o):(X(t.rootNode,r,!1,!1),r.push(...K(t,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(...ve(t.rootNode)),g.set(t,r),r)}function be(e){return Ee(e.rootNode)?[{startLine:0,endLine:e.rootNode.endPosition.row,reason:"generated file (@generated header)"}]:null}function X(e,n,t,i){let r=t,o=i;e.type==="trait_item"&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait declaration body (dynamic dispatch)"}),e.type==="impl_item"&&e.childForFieldName("trait")&&(o=!0,n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl block (dynamic dispatch)"})),e.type==="function_item"||e.type==="function_signature_item"?ye(e,n,t,i):i&&_e(e)?n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl associated item (dynamic dispatch)"}):e.type==="struct_item"||e.type==="enum_item"||e.type==="union_item"?ge(e,n,t):e.type==="mod_item"&&C(e).some(s=>/#\[\s*cfg\s*\(\s*test\s*\)/.test(s))&&(r=!0);for(let s of e.namedChildren)X(s,n,r,o)}function ye(e,n,t,i){let r=C(e),o=null;i?o="trait impl method (dynamic dispatch)":t&&(o="inside #[cfg(test)] mod");for(let s of r){let c=xe(s);if(c){o=c;break}if(Z(s)){o="#[allow(dead_code)]";break}}o&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:o})}function ge(e,n,t){let i=C(e),r=e.namedChildren.find(o=>o.type==="type_identifier")?.text;i.some(Se)&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[derive(<reflective>)] \u2014 fields accessed via macro/reflection",containerName:r}),i.some(Z)&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[allow(dead_code)]",containerName:r}),t&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"inside #[cfg(test)] mod",containerName:r})}function C(e){let n=e.parent;if(!n)return[];let t=n.children,i=-1;for(let o=0;o<t.length;o+=1)if(t[o].startIndex===e.startIndex&&t[o].type===e.type){i=o;break}if(i<=0)return[];let r=[];for(let o=i-1;o>=0;o-=1){let s=t[o];if(s.type==="attribute_item"||s.type==="inner_attribute_item")r.push(s.text);else{if(s.type==="line_comment"||s.type==="block_comment")continue;break}}return r}var he=[{re:/#\[\s*tauri::command\b/,reason:"#[tauri::command]"},{re:/#\[\s*command\b/,reason:"#[command]"},{re:/#\[\s*test\b/,reason:"#[test]"},{re:/#\[\s*bench\b/,reason:"#[bench]"},{re:/#\[\s*tokio::test\b/,reason:"#[tokio::test]"},{re:/#\[\s*async_std::test\b/,reason:"#[async_std::test]"},{re:/#\[\s*wasm_bindgen\b/,reason:"#[wasm_bindgen]"},{re:/#\[\s*no_mangle\b/,reason:"#[no_mangle]"},{re:/#\[\s*napi\b/,reason:"#[napi]"},{re:/#\[\s*pyfunction\b/,reason:"#[pyfunction]"},{re:/#\[\s*pymethod\b/,reason:"#[pymethod]"},{re:/#\[\s*pyo3\b/,reason:"#[pyo3]"},{re:/#\[\s*cfg\s*\(\s*test\s*\)/,reason:"#[cfg(test)]"},{re:/#\[\s*doc\s*\(\s*hidden\s*\)/,reason:"#[doc(hidden)]"}];function xe(e){return he.find(({re:n})=>n.test(e))?.reason??null}var Re=[/\bSerialize\b/,/\bDeserialize\b/,/\bFromRow\b/,/\bsqlx::FromRow\b/,/\bDeriveEntityModel\b/,/\bIntoSchema\b/,/\bToSchema\b/,/\bDeriveValueType\b/,/\bError\b/,/\bthiserror::Error\b/];function Se(e){return/#\[\s*derive\s*\(/.test(e)?Re.some(n=>n.test(e)):!1}function Z(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 ve(e){let n=De(e);if(n.size===0)return[];let t=[];for(let i of e.descendantsOfType("mod_item")){let r=i.childForFieldName("name")?.text;r&&n.has(r)&&t.push({startLine:i.startPosition.row,endLine:i.endPosition.row,reason:'serde `with = "..."` module \u2014 body invoked via reflection',containerName:r})}return t}function Ee(e){for(let n=0;n<Math.min(e.namedChildCount,12);n+=1){let t=e.namedChild(n);if(!t||t.type!=="line_comment"&&t.type!=="block_comment")break;if(/@generated\b/.test(t.text)||/This file is .*generated\b/i.test(t.text)||/Code generated by/i.test(t.text)||/Generated by:\s*https?:\/\/openapi-generator/i.test(t.text)||/openapi-generator/i.test(t.text)&&/Generated by/i.test(t.text))return!0}return!1}var Ce=/^#!?\[\s*serde\s*\(/,$=/\bwith\s*=\s*"([^"]+)"/g;function De(e){let n=new Set;for(let t of e.descendantsOfType("attribute_item")){if(!Ce.test(t.text))continue;$.lastIndex=0;let i;for(;(i=$.exec(t.text))!==null;){let r=i[1],o=r.split("::").pop()??r;o&&n.add(o)}}return n}function Q(e){let n=new Map,t=i=>{let r=n.get(i);if(r)return r;let o=J(e,i);return r={ranges:o.map(s=>({startLine:s.startLine,endLine:s.endLine})),containers:new Set(o.map(s=>s.containerName).filter(s=>!!s))},n.set(i,r),r};return(i,r,o,s)=>{let c=t(i);for(let l of c.ranges)if(r>=l.startLine&&r<=l.endLine)return!0;if(s&&c.containers.has(s))return!0;for(let l of x(o))if(c.containers.has(l))return!0;return!1}}function ze(e,n={}){S(e,{groups:n.semanticProvider===!0?["whole-project","semantic-provider"]:["whole-project"]})}function D(e,n,t={}){S(e,{groups:t.definitions===!0?["source-file","definition-catalog"]:["source-file"],file:n.replace(/\\/g,"/")})}function ee(e,n){return n.isIgnoredPath(e.relativePath)?m("ignored-file"):O(e.symbol)?m("module-like-symbol"):Y(e.symbol)?!e.isFunctionLike&&e.enclosingSymbol&&Y(e.enclosingSymbol)?m("nested-non-callable-value"):!n.includeTests&&!w(e.relativePath)?m("test-file"):!n.includeTests&&n.isExcludedRegion(e.relativePath,e.startLine,e.symbol,e.parentTypeName)?m("excluded-file-region"):B(e.symbol)?m("rust-trait-impl-member"):W(e.symbol)?m("rust-test-module"):!n.includeMembers&&!we(e)?m("member"):e.endLine-e.startLine+1<n.minLoc?m("below-min-loc"):{accepted:!0}:m("non-value-symbol")}function w(e){return F(e)!=="test"}function m(e){return{accepted:!1,rejectionReason:e}}function Y(e){return j(e)||e.endsWith("().")||e.endsWith(".")}function we(e){return A(e.symbol)||x(e.symbol).length===0}function te(){return new Map}function ne(e,n,t){let i=new Map;for(let r of H(e,t))e.isIgnored(r.relative_path)||n.has(r.relative_path)||R(i,r.symbol_id,r.relative_path,r.ref_count,"scip-mention");return i}function re(e,n,t){let i=new Set;for(let r of U(e,n))e.isIgnored(r.relative_path)||t.has(r.relative_path)||i.add(r.symbol_id);return i}function L(e,n){let t=e.get(n);if(!t)return!1;for(let i of t.values())if(i.occurrences>0)return!0;return!1}function ie(e){return e?.occurrences??0}function R(e,n,t,i,r="source-fallback"){if(i<=0)return;let o=se(e,n,t);o.occurrences+=i,o.sources.add(r)}function oe(e,n,t,i,r){if(i<=0)return;let o=se(e,n,t);o.occurrences=Math.max(i,o.occurrences),o.sources.add(r)}function se(e,n,t){let i=e.get(n);i||(i=new Map,e.set(n,i));let r=i.get(t);return r||(r={occurrences:0,sources:new Set},i.set(t,r)),r}function mt(e,n={}){let{scope:t,minLoc:i=1,includeTests:r=!1,skipBarrels:o=!1,includeMembers:s=!1,deadCodeOnly:c=!1,scanLimit:l,semantic:u=!0}=n,a=G(Le(e,{scope:t,minLoc:i,includeTests:r,includeMembers:s}),l),d=o?new Set(N(e)):new Set,f=c?te():ne(e,d,a.map(p=>p.symbolId)),b=c?re(e,a.map(p=>p.symbolId),d):new Set,y=c?a.filter(p=>!b.has(p.symbolId)):a;c?ke(e,y,f,d):Ne(e,y,f,d);let ce=c?y.filter(p=>!L(f,p.symbolId)):a;Oe(e,ce,f,{includeTests:r,inactiveBarrelPaths:d,includeSemantic:!c&&u});let le=c?y.filter(p=>!L(f,p.symbolId)):a;return Fe(e,Pe(le,f))}function Le(e,n){let t=Q(e),i=[];for(let r of h(e,{scope:n.scope}))try{for(let o of V(e,r))ee(o,{minLoc:n.minLoc,includeTests:n.includeTests,includeMembers:n.includeMembers,isIgnoredPath:c=>e.isIgnored(c),isExcludedRegion:t}).accepted&&i.push(o)}finally{D(e,r,{definitions:!0})}return i}function Pe(e,n){return e.map(t=>Ie(t,n)).filter(t=>t.cross_file_refs===0).sort((t,i)=>i.loc-t.loc||t.relative_path.localeCompare(i.relative_path)||t.start_line-i.start_line)}function Ie(e,n){let t=n.get(e.symbolId)??new Map,i=ie(t.get(e.relativePath)),r=0;for(let[o,s]of t)o!==e.relativePath&&(r+=s.occurrences);return{relative_path:e.relativePath,start_line:e.startLine,end_line:e.endLine,loc:e.endLine-e.startLine+1,symbol:e.symbol,same_file_refs:i,cross_file_refs:r}}function Fe(e,n){let t=[],i=0,r=0,o=0;for(let s of n){if(e.isIgnored(s.relative_path)||k(e,s.relative_path)||T(e,s.symbol,s.relative_path))continue;let c=s.same_file_refs===0?"dead-code":"file-internal";c==="dead-code"?i++:r++,o+=s.loc,t.push({relativePath:s.relative_path,startLine:s.start_line,endLine:s.end_line,loc:s.loc,symbol:s.symbol,shortName:M(s.symbol),sameFileRefs:s.same_file_refs,kind:c})}return{symbols:t,totalCount:t.length,deadCodeCount:i,fileInternalCount:r,totalLoc:o}}function Ne(e,n,t,i){if(n.length===0)return;let r=new E(e),o=new Set(n.map(l=>l.symbolId)),s=new Set(n.map(l=>l.leaf).filter(Boolean)),c=new Set(r.sourceFiles());for(let l of h(e))c.add(l);r.scanSourceReferences({paths:c,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:s,skipPath:l=>i.has(l)},l=>{o.has(l.target.symbolId)&&(Ae(e,l)||R(t,l.target.symbolId,l.sourceFile,je(l),"source-fallback"))})}function ke(e,n,t,i){if(n.length===0)return;let r=new E(e),o=Te(n),s=new Set(r.sourceFiles());for(let a of h(e))s.add(a);let c=new Set(o.keys()),l=new Map,u=a=>{let d=l.get(a);return d||(d=q(e,a),l.set(a,d)),d};r.scanSourceReferences({paths:s,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:c,skipPath:a=>i.has(a),resolveTargets:({sourceFile:a,name:d,kind:f})=>{let b=o.get(d);return b?Me(a,d,b,u(a),{permissive:f!=="cross-language-dispatch"}):[]},afterPath:a=>{l.delete(a),D(e,a)}},a=>{let d=a.kind==="identifier"&&a.sourceFile===a.target.relativePath?Math.max(0,a.occurrences-1):a.occurrences;a.kind==="identifier"&&ae(e,{sourceFile:a.sourceFile,name:a.name,target:a.target,occurrences:d})||R(t,a.target.symbolId,a.sourceFile,d,"source-fallback")})}function Te(e){let n=new Map;for(let t of e){if(!t.leaf)continue;let i=n.get(t.leaf)??[];i.push(t),n.set(t.leaf,i)}return n}function Me(e,n,t,i,r){let o=t.filter(l=>l.relativePath===e);if(o.length>0)return o;if(!r.permissive&&t.length===1)return[...t];let s=i.get(n);if(s)for(let l of s){let u=t.filter(a=>v(l,a.relativePath));if(u.length>0)return u}let c=new Set;for(let l of i.values())for(let u of l)c.add(u);for(let l of c){let u=t.filter(a=>v(l,a.relativePath));if(u.length>0&&u.length===t.length)return u}return r.permissive?[...t]:[]}function Ae(e,n){return n.kind==="cross-language-dispatch"&&n.target.relativePath===n.sourceFile?!0:n.kind==="identifier"&&ae(e,n)}function je(e){return e.kind==="identifier"&&e.target.relativePath===e.sourceFile?Math.max(0,e.occurrences-1):e.occurrences}function ae(e,n){return n.occurrences>1?!1:I(e,n.sourceFile).some(t=>t.used||t.sourcePath!==n.target.relativePath?!1:t.importedName===n.name||t.localName===n.name)}function Oe(e,n,t,i){for(let r of n){let o=z(e,r,{semantic:i.includeSemantic!==!1});if(o.length!==0)for(let s of o){let c=s.file;c===r.relativePath||e.isIgnored(c)||i.inactiveBarrelPaths.has(c)||!i.includeTests&&!w(c)||oe(t,r.symbolId,c,1,"caller-map")}}}export{ze as a,mt as b};
2
+ //# sourceMappingURL=chunk-YO6DU7QZ.js.map
@@ -1,7 +1,7 @@
1
- import{a as u}from"./chunk-NOVKLH2F.js";import{a as b}from"./chunk-7I6KNKE3.js";import{t as l}from"./chunk-WEJYUS5O.js";import{c as m}from"./chunk-SOGLYIJ4.js";import{readFileSync as p}from"fs";import{join as h}from"path";function O(e,n,r={}){let t=b(e,n);if(!t)return null;let c=new u(e),o=P(d(e,t.relativePath,t.startLine,t.endLine),y(e,t.relativePath)),s=t.endLine-t.startLine+1,a=c.calleeMap([t],{additive:!0,semantic:r.semantic}).get(t.symbolId)??[],f=new Set(a.map(g=>g.symbol));return{symbol:t.symbol,shortName:m(t.symbol),relativePath:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:s,branches:o,cyclomaticEstimate:o+1,calleeCount:f.size,fanIn:S(e,t.symbolId),fanOut:L(a,t.relativePath)}}function y(e,n){return e.get("SELECT language FROM documents WHERE relative_path = ?",n)?.language??"unknown"}function d(e,n,r,t){try{return p(h(e.config.projectRoot,n),"utf-8").split(`
1
+ import{a as u}from"./chunk-NO2TPMCQ.js";import{a as b}from"./chunk-7I6KNKE3.js";import{t as l}from"./chunk-WEJYUS5O.js";import{c as m}from"./chunk-SOGLYIJ4.js";import{readFileSync as p}from"fs";import{join as h}from"path";function O(e,n,r={}){let t=b(e,n);if(!t)return null;let c=new u(e),o=P(d(e,t.relativePath,t.startLine,t.endLine),y(e,t.relativePath)),s=t.endLine-t.startLine+1,a=c.calleeMap([t],{additive:!0,semantic:r.semantic}).get(t.symbolId)??[],f=new Set(a.map(g=>g.symbol));return{symbol:t.symbol,shortName:m(t.symbol),relativePath:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:s,branches:o,cyclomaticEstimate:o+1,calleeCount:f.size,fanIn:S(e,t.symbolId),fanOut:L(a,t.relativePath)}}function y(e,n){return e.get("SELECT language FROM documents WHERE relative_path = ?",n)?.language??"unknown"}function d(e,n,r,t){try{return p(h(e.config.projectRoot,n),"utf-8").split(`
2
2
  `).slice(r,t+1).join(`
3
3
  `)}catch{return""}}function S(e,n){return e.get(`SELECT COUNT(DISTINCT c.document_id) AS c
4
4
  FROM mentions m
5
5
  JOIN chunks c ON m.chunk_id = c.id
6
6
  WHERE m.symbol_id = ? AND m.role != 1`,n)?.c??0}function L(e,n){return new Set(e.filter(r=>r.file!==n).map(r=>r.symbol)).size}function P(e,n){let r=l(e),t=0,c=[/\bif\b/g,/\belse\s+if\b/g,/\belse\b/g,/\bfor\b/g,/\bwhile\b/g,/\bswitch\b/g,/\bcase\b/g,/\bcatch\b/g,/\?\s*[^?]/g,/&&/g,/\|\|/g];for(let o of c){let s=r.match(o);s&&(t+=s.length)}if(n==="python"){let o=[/\belif\b/g,/\bexcept\b/g,/\bfinally\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}else if(n==="rust"){let o=[/\bmatch\b/g,/=>/g,/\bloop\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}else if(n==="ruby"){let o=[/\belsif\b/g,/\bunless\b/g,/\brescue\b/g,/\bwhen\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}else if(n==="go"){let o=[/\bselect\b/g,/\bdefer\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}return t}export{O as a};
7
- //# sourceMappingURL=chunk-EM2PPDN7.js.map
7
+ //# sourceMappingURL=chunk-YSSTUCNS.js.map