@omfalos/mokosh 0.1.0 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -22
- package/dist/cli.js +21 -21
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +21 -21
- package/dist/cli.mjs.map +1 -1
- package/dist/index.js +15 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -15
- package/dist/index.mjs.map +1 -1
- package/dist/mcp.js +15 -15
- package/dist/mcp.js.map +1 -1
- package/dist/mcp.mjs +15 -15
- package/dist/mcp.mjs.map +1 -1
- package/package.json +9 -10
package/dist/cli.mjs
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
3
|
-
`)}}});var ur=l(()=>{"use strict";fr()});import mr from"fs";import Mo from"path";function st(t,e){let r=t.replace(/^\.\//,"");if(e.nodes.has(r))return r;let s=r.replace(/^dist\//,"src/").replace(/\.(js|mjs|cjs)$/,".ts");return e.nodes.has(s)?s:null}function gr(t,e){if(typeof t=="string")return st(t,e);if(t&&typeof t=="object"){let r=t;for(let s of["import","require","default"]){let n=gr(r[s],e);if(n)return n}}return null}function Do(t){if(!t)return"unknown";let e=t.trimStart();return e.startsWith("interface ")?"interface":e.startsWith("class ")?"class":e.startsWith("enum ")?"enum":e.startsWith("type ")?"type":e.startsWith("namespace ")?"namespace":e.startsWith("const ")||e.startsWith("let ")||e.startsWith("var ")||e.startsWith("readonly ")?"const":e.startsWith("(")||e.startsWith("async ")||e.startsWith("function ")||e.includes("=>")?"function":"unknown"}function Ro(t,e){let r=new Set,s=new Set,n=[...e];for(;n.length;){let o=n.shift();if(s.has(o))continue;s.add(o);let i=t.nodes.get(o);if(i){for(let a of i.exports)r.add(a.name);for(let a of i.imports){if(a.type!=="re-export"||a.isExternal||!a.toPath)continue;if(!a.symbols?.length||a.symbols.includes("*")){let p=t.nodes.get(a.toPath);if(p)for(let u of p.exports)r.add(u.name);n.push(a.toPath)}else for(let p of a.symbols)r.add(p)}}}return r}function nt(t,e){let r=[],s=Mo.join(e,"package.json");if(mr.existsSync(s))try{let n=JSON.parse(mr.readFileSync(s,"utf8"));if(n.exports&&typeof n.exports=="object"&&!Array.isArray(n.exports))for(let o of Object.values(n.exports)){let i=gr(o,t);i&&!r.includes(i)&&r.push(i)}else if(typeof n.exports=="string"){let o=st(n.exports,t);o&&r.push(o)}if(r.length===0)for(let o of[n.main,n.module].filter(Boolean)){let i=st(o,t);i&&!r.includes(i)&&r.push(i)}}catch{}if(r.length===0){for(let n of["src/index.ts","src/index.js","index.ts","index.js"])if(t.nodes.has(n)){r.push(n);break}}return r}function Ao(t,e){let r=new Set(e);for(let s of e)t.traverse(s,n=>(r.add(n.path),!0),{direction:"outgoing"});return r}function Lo(t,e,r){let s=new Map;for(let n of e){if(r.includes(n))continue;let o=t.nodes.get(n);if(!o)continue;let i=o.category==="barrel";for(let a of o.exports){let c=s.get(a.name),p=!!(a.signature||a.doc);(!c||p&&!i)&&s.set(a.name,{file:n,symbol:a})}}return s}function Go(t,e,r,s){let n=[];for(let o of t){let i=e.get(o),a=s.flatMap(m=>r.nodes.get(m)?.exports??[]).find(m=>m.name===o),c=i?.symbol??a,p=i?.file??s.find(m=>r.nodes.get(m)?.exports.some(h=>h.name===o))??s[0],u={name:o,definedIn:p,kind:Do(c?.signature)};c?.doc&&(u.doc=c.doc),c?.signature&&(u.signature=c.signature),n.push(u)}return n.sort((o,i)=>o.name.localeCompare(i.name)),n}function Oo(t,e,r){let s=c=>t.nodes.get(c)?.category==="test",n=[...e].filter(c=>!r.includes(c)&&!s(c)),o=[...t.nodes.keys()].filter(c=>!e.has(c)),i=o.filter(c=>!s(c)),a=o.filter(c=>s(c));return{internalFiles:n,unreachableFromEntry:i,testFiles:a}}function ot(t,e){if(e.length===0)throw new Error("buildApiSurface requires at least one entry point");for(let p of e)if(!t.nodes.has(p))throw new Error(`Entry point not found in graph: ${p}`);let r=Ao(t,e),s=Lo(t,r,e),n=Ro(t,e),o=Go(n,s,t,e),{internalFiles:i,unreachableFromEntry:a,testFiles:c}=Oo(t,r,e);return{entryPoints:e,publicExports:o,internalFiles:i,unreachableFromEntry:a,testFiles:c}}var it=l(()=>{"use strict"});function at(t,e){let r=null,s=[];for(let o of t.nodes.values()){o.exports.some(i=>i.name===e)&&(r=o.path);for(let i of o.callEdges??[])i.to===e&&s.push({file:o.path,callerFunction:i.from})}let n=[];if(r){let o=t.nodes.get(r);for(let i of o?.callEdges??[])i.from===e&&n.push({file:i.toFile,calleeFunction:i.to})}return{functionName:e,definedIn:r,callers:s,callees:n}}var ct=l(()=>{"use strict"});import fp from"fs";import mp from"path";var pt=l(()=>{"use strict"});import Se from"path";function jo(t){let e=new Map;for(let[r,s]of t){let n=s.imports.filter(o=>o.toPath&&!o.isExternal).length;n>0&&e.set(r,n)}return e}function _o(t,e,r){let s=new Map;for(let[n,o]of e){if(o<r)continue;let i=t.get(n);if(!i||i.category==="test"||i.category==="barrel")continue;let a=Se.extname(n),c=Se.basename(n,a),p=c==="index"?Se.basename(Se.dirname(n)):c;s.set(n,{path:n,outDegree:o,tag:`feature:${p}`})}return s}function A(t,e){let r=e?.minOutDegree??5;return _o(t,jo(t),r)}var be=l(()=>{"use strict"});function zo(t,e){let r=new Map;for(let s of e.values()){let n=new Set;t.traverse(s.path,o=>(o.path!==s.path&&n.add(o.path),!0),{direction:"outgoing"}),r.set(s.path,n)}return r}function $o(t,e,r,s){let n=new Map;for(let[o]of t){if(e.has(o))continue;let i=null;for(let a of e.values())r.get(a.path)?.has(o)&&(!i||s(a,i)<0)&&(i=a);i&&n.set(o,i.path)}return n}function Uo(t,e){let r=new Map;for(let s of t.values()){let n=s.tag.replace("feature:",""),o=[];for(let[i,a]of e)a===s.path&&o.push(i);r.set(n,{hub:s.path,outDegree:s.outDegree,files:o})}return r}function Bo(t,e,r){let s=[];for(let n of t.keys())!e.has(n)&&!r.has(n)&&s.push(n);return s}function Z(t,e){let r=e?.detectFn??A,s=e?.hubComparator??Wo,n=r(t.nodes,e),o=zo(t,n),i=$o(t.nodes,n,o,s);return{features:Uo(n,i),unassigned:Bo(t.nodes,n,i)}}var Wo,ve=l(()=>{"use strict";be();Wo=(t,e)=>t.outDegree-e.outDegree});var Y,dr=l(()=>{"use strict";Y=class{constructor(e){this.nodes=e}nodes;findUnusedFiles(e){let r=new Set(this.nodes.keys());return e.filter(s=>!r.has(s))}findHighExportUsage(e){let r=[];for(let s of this.nodes.values()){if(s.maxExportUsage===void 0||s.maxExportUsage<e)continue;let n=s.imports.reduce((o,i)=>(i.exportUsageRatio??0)>(o?.exportUsageRatio??0)?i:o,null);r.push({path:s.path,maxExportUsage:s.maxExportUsage,tightestDep:n?.toPath??""})}return r.sort((s,n)=>n.maxExportUsage-s.maxExportUsage)}findCycles(){let e=[],r=new Set,s=new Set,n=[],o=i=>{r.add(i),s.add(i),n.push(i);let a=this.nodes.get(i);if(a){for(let c of a.imports)if(!(!c.toPath||c.isExternal))if(s.has(c.toPath)){let p=n.indexOf(c.toPath);e.push([...n.slice(p),c.toPath])}else r.has(c.toPath)||o(c.toPath)}s.delete(i),n.pop()};for(let i of this.nodes.keys())r.has(i)||o(i);return e}}});var F,ee=l(()=>{"use strict";dr();F=class t{constructor(e){this.nodes=e}nodes;_incomingEdgesCache=null;_callIncomingCache=null;serialize(){return{nodes:Array.from(this.nodes.values())}}static deserialize(e){let r=new Map;for(let s of e.nodes)r.set(s.path,s);return new t(r)}getIncomingEdgesMap(){if(this._incomingEdgesCache)return this._incomingEdgesCache;let e=new Map;for(let r of this.nodes.values())for(let s of r.imports)if(s.toPath){let n=e.get(s.toPath)||[];n.push(r.path),e.set(s.toPath,n)}return this._incomingEdgesCache=e,e}dfs(e,r,s,n){let o=new Set,i=s.maxDepth??1/0,a=(c,p,u)=>{if(p>i||o.has(c))return;let m=this.nodes.get(c);if(m&&(o.add(c),r(m,p,u)!==!1))for(let h of n(c))a(h,p+1,c)};a(e,0,null)}traverse(e,r,s={}){let n=s.direction??"outgoing",o=n==="incoming"?this.getIncomingEdgesMap():null;this.dfs(e,r,s,i=>n==="outgoing"?this.nodes.get(i)?.imports.map(a=>a.toPath).filter(Boolean)??[]:o?.get(i)??[])}getCallIncomingCache(){if(this._callIncomingCache)return this._callIncomingCache;let e=new Map;for(let r of this.nodes.values())for(let s of r.callEdges??[]){let n=e.get(s.toFile)??[];n.push(r.path),e.set(s.toFile,n)}return this._callIncomingCache=e,e}traverseCalls(e,r,s={}){let n=s.direction??"outgoing",o=n==="incoming"?this.getCallIncomingCache():null;this.dfs(e,r,s,i=>n==="outgoing"?this.nodes.get(i)?.callEdges?.map(a=>a.toFile)??[]:o?.get(i)??[])}getCallers(e){let r=[];return this.traverseCalls(e,s=>(s.path!==e&&r.push(s.path),!0),{direction:"incoming",maxDepth:1}),r}getCallEdgesFor(e){return this.nodes.get(e)?.callEdges??[]}getNeighbors(e){let r=this.nodes.get(e);return r?r.imports.map(s=>this.nodes.get(s.toPath)).filter(s=>s!==void 0):[]}findUnusedFiles(e){return new Y(this.nodes).findUnusedFiles(e)}findCycles(){return new Y(this.nodes).findCycles()}}});function hr(t){if(t.category==="test")return"test";if(t.category==="config")return"config";if(t.category==="type-only")return"types";let e=t.path;return d(e,"component")||d(e,"components")?"component":d(e,"controller")||d(e,"controllers")?"controller":d(e,"middleware")?"middleware":d(e,"router")||d(e,"routes")||d(e,"route")?"router":d(e,"store")||d(e,"stores")?"store":d(e,"service")||d(e,"services")?"service":d(e,"handler")||d(e,"handlers")?"handler":d(e,"adapter")||d(e,"adapters")?"adapter":d(e,"plugin")||d(e,"plugins")?"plugin":d(e,"api")?"api":d(e,"cli")||d(e,"commands")||te(e)==="cli"?"cli":d(e,"util")||d(e,"utils")||d(e,"helper")||d(e,"helpers")?"util":d(e,"model")||d(e,"models")||te(e)==="model"?"model":d(e,"parser")||d(e,"parsers")||te(e)==="parser"?"parser":te(e)==="builder"?"builder":te(e)==="resolver"?"resolver":"other"}function d(t,e){return t.includes(`/${e}/`)||t.includes(`/${e}.`)}function te(t){let e=t.slice(t.lastIndexOf("/")+1);return e.slice(0,e.lastIndexOf("."))||e}var yr=l(()=>{"use strict"});function lt(t,e){let r=Z(t,e),s=new Map;for(let[o,i]of r.features){for(let a of i.files)s.set(a,o);s.set(i.hub,o)}let n=new Map;for(let o of t.nodes.values()){let i=s.get(o.path);n.set(o.path,{path:o.path,role:hr(o),...o.description?{description:o.description}:{},exports:o.exports.map(a=>a.name),...i?{featureHub:i}:{}})}return n}var ft=l(()=>{"use strict";ve();yr()});var re,ut=l(()=>{"use strict";re=class{affectedSymbols=new Map;constructor(e,r){this.affectedSymbols.set(e,new Set(["default",...r]))}updateAffectedSymbols(e,r){let s=this.affectedSymbols.get(r)||new Set,n=e.imports.find(c=>c.toPath===r);if(!n)return!1;let o=n.symbols||["*"],i=new Set;for(let c of o)(c==="*"||s.has("*")||s.has(c))&&i.add("*");if(i.size===0)return!1;let a=this.affectedSymbols.get(e.path)||new Set;for(let c of i)a.add(c);return this.affectedSymbols.set(e.path,a),!0}}});function Jo(t){return t?t.startsWith("interface ")?"interface":t.startsWith("class ")?"class":t.startsWith("enum ")?"enum":"type":"type"}function Ko(t,e){if(e==="type-only")return!0;let r=t.signature??"";return r.startsWith("interface ")||r.startsWith("class ")||r.startsWith("enum ")}function mt(t){let e=new Map;for(let s of t.nodes.values())if(!(s.type!=="typescript"&&s.type!=="javascript"))for(let n of s.exports){if(!Ko(n,s.category))continue;let o=`${s.path}::${n.name}`;e.set(o,{name:n.name,file:s.path,kind:Jo(n.signature),...n.doc?{doc:n.doc}:{}})}let r=[];for(let s of t.nodes.values())if(!(s.type!=="typescript"&&s.type!=="javascript")){for(let n of s.imports)if(!(!n.toPath||n.isExternal||!n.symbols?.length))for(let o of n.symbols)e.has(`${n.toPath}::${o}`)&&r.push({fromFile:s.path,toType:o,toFile:n.toPath})}return{types:e,edges:r}}function gt(t,e){let r=null;for(let o of t.types.values())if(o.name===e){r=o;break}if(!r)return{type:null,usedByFiles:[],uses:[]};let s=new Set,n=new Map;for(let o of t.edges)if(o.toType===e&&o.toFile===r.file&&s.add(o.fromFile),o.fromFile===r.file){let i=t.types.get(`${o.toFile}::${o.toType}`);i&&n.set(`${i.file}::${i.name}`,i)}return{type:r,usedByFiles:Array.from(s),uses:Array.from(n.values())}}var dt=l(()=>{"use strict"});import xr from"fs";import Ip from"path";function Sr(t){try{return xr.statSync(t,{throwIfNoEntry:!1})?.isDirectory()===!0}catch{return!1}}function Ce(t){try{return xr.statSync(t,{throwIfNoEntry:!1})?.isFile()===!0}catch{return!1}}var Ee=l(()=>{"use strict"});import se from"fs";import E from"path";function ht(t,e){let r=E.join(e,"package.json");if(!se.existsSync(r))return null;let s={};try{s=JSON.parse(se.readFileSync(r,"utf-8"))}catch{return null}let n=s.name;return n?{name:n,root:e,relativeRoot:E.relative(t,e),entryPoints:Ho(e,s)}:null}function Ho(t,e){let r=[];if(e.exports){let n=e.exports;if(typeof n=="string")r.push(E.join(t,n));else if(typeof n=="object"&&n!==null){let o=n["."];if(typeof o=="string")r.push(E.join(t,o));else if(typeof o=="object"&&o!==null){let i=o.import??o.require??o.default;typeof i=="string"&&r.push(E.join(t,i))}}}e.main&&r.push(E.join(t,e.main));for(let n of["src/index.ts","src/index.tsx","index.ts","index.tsx","index.js"])r.push(E.join(t,n));let s=r.filter(Ce);return s.length>0?s.slice(0,1):r.slice(0,1)}function j(t,e){let r=[],s=new Set;for(let n of e){let o=n.replace(/\/$/,"").replace(/^\.\//,"");qo(t,o,s,r)}return r}function qo(t,e,r,s){if(!e.includes("*")){Vo(t,e,r,s);return}let n=e.split("/");n.includes("**")?Qo(t,n,r,s):Xo(t,n,r,s)}function Vo(t,e,r,s){let n=E.join(t,e);if(r.has(n)||!Sr(n))return;r.add(n);let o=ht(t,n);o&&s.push(o)}function Qo(t,e,r,s){let n=E.join(t,e[0]==="**"?"":e[0]??"");br(t,n,r,s)}function Xo(t,e,r,s){let n=e.findIndex(a=>a.includes("*")),o=E.join(t,...e.slice(0,n)),i;try{i=se.readdirSync(o,{withFileTypes:!0})}catch{return}for(let a of i){if(!a.isDirectory())continue;let c=E.join(o,a.name);if(r.has(c))continue;r.add(c);let p=ht(t,c);p&&s.push(p)}}function br(t,e,r,s){let n;try{n=se.readdirSync(e,{withFileTypes:!0})}catch{return}for(let o of n){if(!o.isDirectory()||o.name==="node_modules"||o.name.startsWith("."))continue;let i=E.join(e,o.name);if(se.existsSync(E.join(i,"package.json"))&&!r.has(i)){r.add(i);let a=ht(t,i);a&&s.push(a)}else br(t,i,r,s)}}var ke=l(()=>{"use strict";Ee();Ee()});import yt from"fs";import vr from"path";var Cr,Er=l(()=>{"use strict";ke();Cr={type:"npm",detect(t){let e=vr.join(t,"package.json");if(!yt.existsSync(e))return null;let r;try{r=JSON.parse(yt.readFileSync(e,"utf-8")).workspaces}catch{return null}if(!r||yt.existsSync(vr.join(t,"yarn.lock")))return null;let s=Array.isArray(r)?r:r.packages??[];return s.length===0?null:j(t,s)}}});import _ from"fs";import S from"path";function Fr(t,e,r,s){if(s>4)return[];let n;try{n=_.readdirSync(e,{withFileTypes:!0})}catch{return[]}let o=[];for(let i of n){if(!i.isDirectory())continue;let a=i.name;if(a.startsWith(".")||a==="node_modules"||a==="dist"||a===".nx")continue;let c=S.join(e,a);_.existsSync(S.join(c,"project.json"))&&!r.has(c)?(r.add(c),o.push(c)):o.push(...Fr(t,c,r,s+1))}return o}function Zo(t,e,r){let s={};try{s=JSON.parse(_.readFileSync(r,"utf-8"))}catch{return null}let n=s.name,o,i,a=S.join(e,"package.json");if(_.existsSync(a))try{let c=JSON.parse(_.readFileSync(a,"utf-8"));n=c.name??n,o=c.main,i=c.exports}catch{}return n?{name:n,root:e,relativeRoot:S.relative(t,e),entryPoints:Yo(e,s,o,i)}:null}function Yo(t,e,r,s){let n=[],o=e.targets?.build?.options?.main??e.targets?.build?.options?.entryFile;if(o){let a=S.resolve(t,"../..");n.push(S.resolve(a,o)),n.push(S.resolve(t,o))}if(s){let a=s;if(typeof a=="string")n.push(S.join(t,a));else if(typeof a=="object"&&a!==null){let c=a["."];typeof c=="string"&&n.push(S.join(t,c))}}if(r&&n.push(S.join(t,r)),e.sourceRoot){let a=S.resolve(t,"../.."),c=S.resolve(a,e.sourceRoot);n.push(S.join(c,"index.ts"),S.join(c,"index.tsx"))}for(let a of["src/index.ts","src/index.tsx","index.ts","index.tsx"])n.push(S.join(t,a));let i=n.filter(Ce);return i.length>0?i.slice(0,1):n.slice(0,1)}var kr,wr=l(()=>{"use strict";Ee();kr={type:"nx",detect(t){return _.existsSync(S.join(t,"nx.json"))?Fr(t,t,new Set,0).map(r=>Zo(t,r,S.join(r,"project.json"))).filter(r=>r!==null):null}}});import Tr from"fs";import ei from"path";import ti from"js-yaml";var Pr,Nr=l(()=>{"use strict";ke();Pr={type:"pnpm",detect(t){let e=ei.join(t,"pnpm-workspace.yaml");if(!Tr.existsSync(e))return null;let r=[];try{r=ti.load(Tr.readFileSync(e,"utf-8"))?.packages??[]}catch{return null}return j(t,r)}}});import ri from"fs";import si from"path";var Ir,Mr=l(()=>{"use strict";Ir={type:"turborepo",detect(t){return ri.existsSync(si.join(t,"turbo.json"))?[]:null}}});import xt from"fs";import Dr from"path";var Rr,Ar=l(()=>{"use strict";ke();Rr={type:"yarn",detect(t){if(!xt.existsSync(Dr.join(t,"yarn.lock")))return null;let e=Dr.join(t,"package.json");if(!xt.existsSync(e))return null;let r;try{r=JSON.parse(xt.readFileSync(e,"utf-8")).workspaces}catch{return null}if(!r)return null;let s=Array.isArray(r)?r:r.packages??[];return s.length===0?null:j(t,s)}}});function I(t){ni.push(t)}var ni,Fe=l(()=>{"use strict";ni=[]});import al from"path";var St=l(()=>{"use strict";Er();wr();Nr();Mr();Ar();Fe();Fe();I(Ir);I(kr);I(Pr);I(Rr);I(Cr)});var bt=l(()=>{"use strict";ee()});function W(t,e){Lr.set(t,e)}function Gr(t){return Lr.get(t)}var Lr,ne=l(()=>{"use strict";Lr=new Map});function Or(t,e){return e.startsWith("!")?t!==e.slice(1):t===e}function oi(t,e){return e.startsWith("!")?!t.includes(e.slice(1)):t.includes(e)}var ii,ai,ci,pi,li,fi,ui,mi,gi,di,hi,yi,xi,Si,bi,vi,Ci,jr,_r=l(()=>{"use strict";ii=(t,e)=>!e.category||Or(t.category,e.category),ai=(t,e)=>!e.type||Or(t.type,e.type),ci=(t,e)=>!e.path||oi(t.path,e.path),pi=(t,e)=>e.isExternal===void 0?!0:t.imports.some(s=>s.isExternal)===e.isExternal,li=(t,e)=>{if(!e.tags||e.tags.length===0)return!0;let r=e.tags.filter(n=>!n.startsWith("!")),s=e.tags.filter(n=>n.startsWith("!")).map(n=>n.slice(1));return!(r.length>0&&!r.some(n=>t.tags.some(o=>o.name===n))||s.some(n=>t.tags.some(o=>o.name===n)))},fi=(t,e)=>!e.allTags?.length||e.allTags.every(r=>t.tags.some(s=>s.name===r)),ui=(t,e)=>!e.importsFile||t.imports.some(r=>r.toPath?.includes(e.importsFile)),mi=(t,e,r)=>e.importedBy===void 0?!0:(r?.get(t.path)??[]).some(n=>n.includes(e.importedBy)),gi=(t,e)=>e.minImports===void 0||t.imports.length>=e.minImports,di=(t,e)=>e.maxImports===void 0||t.imports.length<=e.maxImports,hi=(t,e)=>e.minSize===void 0||t.size>=e.minSize,yi=(t,e)=>e.maxSize===void 0||t.size<=e.maxSize,xi=(t,e)=>e.hasDocstring===void 0||!!t.description===e.hasDocstring,Si=(t,e)=>e.minCoverage===void 0||(t.coveragePct??101)>=e.minCoverage,bi=(t,e)=>e.maxCoverage===void 0||(t.coveragePct??0)<=e.maxCoverage,vi=(t,e)=>e.minExportUsage===void 0||(t.avgExportUsage??-1)>=e.minExportUsage,Ci=(t,e)=>e.maxExportUsage===void 0||(t.avgExportUsage??0)<=e.maxExportUsage,jr=[ii,ai,ci,pi,li,fi,ui,mi,gi,di,hi,yi,xi,Si,bi,vi,Ci]});function Wr(t,e,r){return jr.every(s=>s(t,e,r))}function we(t,e){let r=new Map;if(e.importedBy!==void 0){for(let i of t.nodes)for(let a of i.imports)if(a.toPath){let c=r.get(a.toPath)??[];c.push(i.path),r.set(a.toPath,c)}}let s=t.nodes.filter(i=>Wr(i,e,r)),n=new Set(s.map(i=>i.path)),o=s.map(i=>({...i,imports:i.imports.filter(a=>!a.toPath||n.has(a.toPath))}));return e.sort&&o.sort((i,a)=>e.sort==="size"?a.size-i.size:e.sort==="imports"?a.imports.length-i.imports.length:e.sort==="commitCount90d"?(a.commitCount90d??0)-(i.commitCount90d??0):e.sort==="exportUsage"?(a.avgExportUsage??0)-(i.avgExportUsage??0):0),e.limit!==void 0&&o.splice(e.limit),{nodes:o,cycles:t.cycles?.filter(i=>i.every(a=>n.has(a)))??void 0}}var zr=l(()=>{"use strict";_r()});function Te(t){let e={},r=t.split(",");for(let s of r){let n=s.indexOf(":");if(n===-1)continue;let o=s.slice(0,n).trim().toLowerCase(),i=s.slice(n+1).trim();if(!(!o||!i))switch(o){case"category":e.category=i;break;case"type":e.type=i;break;case"tag":case"tags":i.includes("+")?e.allTags=[...e.allTags??[],...i.split("+")]:e.tags=[...e.tags??[],i];break;case"path":e.path=i;break;case"external":e.isExternal=i.toLowerCase()==="true";break;case"importsfile":e.importsFile=i;break;case"importedby":e.importedBy=i;break;case"minimports":e.minImports=parseInt(i,10);break;case"maximports":e.maxImports=parseInt(i,10);break;case"minsize":e.minSize=parseInt(i,10);break;case"maxsize":e.maxSize=parseInt(i,10);break;case"sort":e.sort=i;break;case"limit":e.limit=parseInt(i,10);break;case"hasdocstring":e.hasDocstring=i.toLowerCase()!=="false";break;case"mincoverage":e.minCoverage=parseInt(i,10);break;case"maxcoverage":e.maxCoverage=parseInt(i,10);break;case"minexportusage":e.minExportUsage=parseFloat(i);break;case"maxexportusage":e.maxExportUsage=parseFloat(i);break}}return e}var $r=l(()=>{"use strict"});var Ur=l(()=>{"use strict";zr();$r()});import b from"typescript";function z(t){let e=[];for(let r of t.statements){if(!b.isExpressionStatement(r))continue;let s=r.expression;if(!b.isCallExpression(s))continue;let n=s.expression;b.isIdentifier(n)&&Br.has(n.text)&&e.push(s),b.isPropertyAccessExpression(n)&&b.isIdentifier(n.expression)&&Br.has(n.expression.text)&&e.push(s)}return e}function $(t,e,r){for(let s of t.arguments){if(!b.isObjectLiteralExpression(s))continue;let n=s.properties.find(o=>b.isPropertyAssignment(o)&&b.isIdentifier(o.name)&&o.name.text===e);if(!(!n||!b.isArrayLiteralExpression(n.initializer)))return n.initializer.elements.filter(b.isStringLiteral).map(o=>o.text)}return null}function U(t,e,r,s){if(t.arguments.length===0)return null;for(let o=1;o<t.arguments.length;o++){let i=t.arguments[o];if(!b.isObjectLiteralExpression(i))continue;let a=i.properties.find(p=>b.isPropertyAssignment(p)&&b.isIdentifier(p.name)&&p.name.text===e);if(a)return{start:a.initializer.getStart(s),end:a.initializer.getEnd(),text:r};let c=i.getEnd()-1;return{start:c,end:c,text:`${i.properties.length>0?", ":""}${e}: ${r}`}}let n=t.arguments[t.arguments.length-1];return{start:n.getStart(s),end:n.getStart(s),text:`{ ${e}: ${r} }, `}}function B(t,e,r){let s=t.arguments;for(let n=1;n<s.length;n++){let o=s[n];if(!b.isObjectLiteralExpression(o))continue;let i=o.properties.findIndex(c=>b.isPropertyAssignment(c)&&b.isIdentifier(c.name)&&c.name.text===e);if(i<0)continue;if(o.properties.length===1)return{start:s[n-1].getEnd(),end:o.getEnd(),text:""};let a=o.properties[i];return i===o.properties.length-1?{start:o.properties[i-1].getEnd(),end:a.getEnd(),text:""}:{start:a.getStart(r),end:o.properties[i+1].getStart(r),text:""}}return null}function J(t,e){let r=[...e].sort((n,o)=>o.start-n.start),s=t;for(let n of r)s=s.slice(0,n.start)+n.text+s.slice(n.end);return s}function K(t){return`[${t.map(e=>JSON.stringify(e)).join(", ")}]`}var Br,P,H=l(()=>{"use strict";Br=new Set(["describe","test","it"]);P=new Set([".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"])});import Jr from"path";import Kr from"typescript";function Ei(t){return K(t.map(e=>`@${e}`))}function ki(t){return t.map(e=>e.startsWith("@")?e.slice(1):e)}var Pe,Hr=l(()=>{"use strict";H();Pe=class{name="cypress";canHandle(e){return P.has(Jr.extname(e).toLowerCase())}apply(e,r,s){let n=Kr.createSourceFile(Jr.basename(e),r,Kr.ScriptTarget.Latest,!0),o=z(n);if(o.length===0)return r;let i=$(o[0],"tags",n),a=[...s].sort();if(i!==null&&JSON.stringify(ki(i).sort())===JSON.stringify(a))return r;let c=o.flatMap(p=>{let u=s.length===0?B(p,"tags",n):U(p,"tags",Ei(a),n);return u?[u]:[]});return c.length>0?J(r,c):r}}});import Fi from"path";function wi(t){return["# <mokosh-tags>",...t.map(e=>`@${e}`),"# </mokosh-tags>"].join(`
|
|
2
|
+
var qe=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var l=(t,e)=>()=>(t&&(e=t(t=0)),e);var Po=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);function de(t){sr.push(t)}function nr(t){return[...Io,...sr].some(e=>typeof e=="string"?t.includes(e):e instanceof RegExp?e.test(t):e(t))}function he(t){or.push(t)}function X(){return[...No,...or]}function ye(t){ir.push(t)}function Ve(){return[...Mo,...ir]}function Qe(t){ar=t}function Xe(){return ar}var Io,sr,No,or,Mo,ir,ar,G=l(()=>{"use strict";Io=[".config.","biome.json","tsconfig.json","package.json",".prettierrc",".eslintrc"],sr=[];No=[".test.",".spec.","-test.","-spec."],or=[];Mo=["jest","vitest","playwright","cypress","@testing-library/"],ir=[];ar=.8});import Ze from"fs";import cr from"path";function O(t,{allowJs:e=!0,isExplicitPath:r=!1}={}){if(r){let s=cr.resolve(t);return Ze.existsSync(s)?s.endsWith(".json")?pr(s):e?lr(s):{}:{}}for(let s of Do){let n=cr.resolve(t,s);if(Ze.existsSync(n)){if(s.endsWith(".json"))return pr(n);if(e)return lr(n)}}return{}}function pr(t){return JSON.parse(Ze.readFileSync(t,"utf-8"))}function lr(t){let e=qe(t);return e&&typeof e=="object"&&"default"in e&&(e=e.default),typeof e=="function"?e({}):e}function Ye(t){for(let e of t.configMatchers??[])de(e);for(let e of t.testPatterns??[])he(e);for(let e of t.testLibraries??[])ye(e);t.barrelThreshold!==void 0&&Qe(t.barrelThreshold)}var Do,et=l(()=>{"use strict";G();Do=["mokosh.config.js","mokosh.config.cjs","mokosh.config.json"]});var tt,rt,st=l(()=>{"use strict";tt=["node_modules",".git","dist","build",".next",".cache","mokosh-cache","coverage"],rt=[".ts",".tsx",".js",".jsx",".mjs",".cjs",".css",".scss",".sass",".less",".styl",".coffee",".ls",".lua",".py",".go",".feature"]});import np from"fs";import ip from"path";var fr=l(()=>{"use strict"});var xe,ur=l(()=>{"use strict";xe={serialize(t){let e=["graph TD"],r=new Set;for(let s of t.nodes.values()){let n=`"${s.path}"`;for(let o of s.imports){if(!o.toPath)continue;let i=`"${o.toPath}"`,a=`${s.path} -> ${o.toPath}`;if(!r.has(a)){let c=o.isStyle?"-- styles -->":"-->";e.push(` ${n} ${c} ${i}`),r.add(a)}}}return e.join(`
|
|
3
|
+
`)}}});var mr=l(()=>{"use strict";ur()});import gr from"fs";import Ao from"path";function nt(t,e){let r=t.replace(/^\.\//,"");if(e.nodes.has(r))return r;let s=r.replace(/^dist\//,"src/").replace(/\.(js|mjs|cjs)$/,".ts");return e.nodes.has(s)?s:null}function dr(t,e){if(typeof t=="string")return nt(t,e);if(t&&typeof t=="object"){let r=t;for(let s of["import","require","default"]){let n=dr(r[s],e);if(n)return n}}return null}function Lo(t){if(!t)return"unknown";let e=t.trimStart();return e.startsWith("interface ")?"interface":e.startsWith("class ")?"class":e.startsWith("enum ")?"enum":e.startsWith("type ")?"type":e.startsWith("namespace ")?"namespace":e.startsWith("const ")||e.startsWith("let ")||e.startsWith("var ")||e.startsWith("readonly ")?"const":e.startsWith("(")||e.startsWith("async ")||e.startsWith("function ")||e.includes("=>")?"function":"unknown"}function Go(t,e){let r=new Set,s=new Set,n=[...e];for(;n.length;){let o=n.shift();if(s.has(o))continue;s.add(o);let i=t.nodes.get(o);if(i){for(let a of i.exports)r.add(a.name);for(let a of i.imports){if(a.type!=="re-export"||a.isExternal||!a.toPath)continue;if(!a.symbols?.length||a.symbols.includes("*")){let p=t.nodes.get(a.toPath);if(p)for(let u of p.exports)r.add(u.name);n.push(a.toPath)}else for(let p of a.symbols)r.add(p)}}}return r}function ot(t,e){let r=[],s=Ao.join(e,"package.json");if(gr.existsSync(s))try{let n=JSON.parse(gr.readFileSync(s,"utf8"));if(n.exports&&typeof n.exports=="object"&&!Array.isArray(n.exports))for(let o of Object.values(n.exports)){let i=dr(o,t);i&&!r.includes(i)&&r.push(i)}else if(typeof n.exports=="string"){let o=nt(n.exports,t);o&&r.push(o)}if(r.length===0)for(let o of[n.main,n.module].filter(Boolean)){let i=nt(o,t);i&&!r.includes(i)&&r.push(i)}}catch{}if(r.length===0){for(let n of["src/index.ts","src/index.js","index.ts","index.js"])if(t.nodes.has(n)){r.push(n);break}}return r}function Oo(t,e){let r=new Set(e);for(let s of e)t.traverse(s,n=>(r.add(n.path),!0),{direction:"outgoing"});return r}function jo(t,e,r){let s=new Map;for(let n of e){if(r.includes(n))continue;let o=t.nodes.get(n);if(!o)continue;let i=o.category==="barrel";for(let a of o.exports){let c=s.get(a.name),p=!!(a.signature||a.doc);(!c||p&&!i)&&s.set(a.name,{file:n,symbol:a})}}return s}function _o(t,e,r,s){let n=[];for(let o of t){let i=e.get(o),a=s.flatMap(m=>r.nodes.get(m)?.exports??[]).find(m=>m.name===o),c=i?.symbol??a,p=i?.file??s.find(m=>r.nodes.get(m)?.exports.some(h=>h.name===o))??s[0],u={name:o,definedIn:p,kind:Lo(c?.signature)};c?.doc&&(u.doc=c.doc),c?.signature&&(u.signature=c.signature),n.push(u)}return n.sort((o,i)=>o.name.localeCompare(i.name)),n}function Wo(t,e,r){let s=c=>t.nodes.get(c)?.category==="test",n=[...e].filter(c=>!r.includes(c)&&!s(c)),o=[...t.nodes.keys()].filter(c=>!e.has(c)),i=o.filter(c=>!s(c)),a=o.filter(c=>s(c));return{internalFiles:n,unreachableFromEntry:i,testFiles:a}}function it(t,e){if(e.length===0)throw new Error("buildApiSurface requires at least one entry point");for(let p of e)if(!t.nodes.has(p))throw new Error(`Entry point not found in graph: ${p}`);let r=Oo(t,e),s=jo(t,r,e),n=Go(t,e),o=_o(n,s,t,e),{internalFiles:i,unreachableFromEntry:a,testFiles:c}=Wo(t,r,e);return{entryPoints:e,publicExports:o,internalFiles:i,unreachableFromEntry:a,testFiles:c}}var at=l(()=>{"use strict"});function ct(t,e){let r=null,s=[];for(let o of t.nodes.values()){o.exports.some(i=>i.name===e)&&(r=o.path);for(let i of o.callEdges??[])i.to===e&&s.push({file:o.path,callerFunction:i.from})}let n=[];if(r){let o=t.nodes.get(r);for(let i of o?.callEdges??[])i.from===e&&n.push({file:i.toFile,calleeFunction:i.to})}return{functionName:e,definedIn:r,callers:s,callees:n}}var pt=l(()=>{"use strict"});import hp from"fs";import xp from"path";var lt=l(()=>{"use strict"});import Se from"path";function zo(t){let e=new Map;for(let[r,s]of t){let n=s.imports.filter(o=>o.toPath&&!o.isExternal).length;n>0&&e.set(r,n)}return e}function $o(t,e,r){let s=new Map;for(let[n,o]of e){if(o<r)continue;let i=t.get(n);if(!i||i.category==="test"||i.category==="barrel")continue;let a=Se.extname(n),c=Se.basename(n,a),p=c==="index"?Se.basename(Se.dirname(n)):c;s.set(n,{path:n,outDegree:o,tag:`feature:${p}`})}return s}function A(t,e){let r=e?.minOutDegree??5;return $o(t,zo(t),r)}var be=l(()=>{"use strict"});function Bo(t,e){let r=new Map;for(let s of e.values()){let n=new Set;t.traverse(s.path,o=>(o.path!==s.path&&n.add(o.path),!0),{direction:"outgoing"}),r.set(s.path,n)}return r}function Jo(t,e,r,s){let n=new Map;for(let[o]of t){if(e.has(o))continue;let i=null;for(let a of e.values())r.get(a.path)?.has(o)&&(!i||s(a,i)<0)&&(i=a);i&&n.set(o,i.path)}return n}function Ko(t,e){let r=new Map;for(let s of t.values()){let n=s.tag.replace("feature:",""),o=[];for(let[i,a]of e)a===s.path&&o.push(i);r.set(n,{hub:s.path,outDegree:s.outDegree,files:o})}return r}function Ho(t,e,r){let s=[];for(let n of t.keys())!e.has(n)&&!r.has(n)&&s.push(n);return s}function Z(t,e){let r=e?.detectFn??A,s=e?.hubComparator??Uo,n=r(t.nodes,e),o=Bo(t,n),i=Jo(t.nodes,n,o,s);return{features:Ko(n,i),unassigned:Ho(t.nodes,n,i)}}var Uo,ve=l(()=>{"use strict";be();Uo=(t,e)=>t.outDegree-e.outDegree});var Y,hr=l(()=>{"use strict";Y=class{constructor(e){this.nodes=e}nodes;findUnusedFiles(e){let r=new Set(this.nodes.keys());return e.filter(s=>!r.has(s))}findHighExportUsage(e){let r=[];for(let s of this.nodes.values()){if(s.maxExportUsage===void 0||s.maxExportUsage<e)continue;let n=s.imports.reduce((o,i)=>(i.exportUsageRatio??0)>(o?.exportUsageRatio??0)?i:o,null);r.push({path:s.path,maxExportUsage:s.maxExportUsage,tightestDep:n?.toPath??""})}return r.sort((s,n)=>n.maxExportUsage-s.maxExportUsage)}findCycles(){let e=[],r=new Set,s=new Set,n=[],o=i=>{r.add(i),s.add(i),n.push(i);let a=this.nodes.get(i);if(a){for(let c of a.imports)if(!(!c.toPath||c.isExternal))if(s.has(c.toPath)){let p=n.indexOf(c.toPath);e.push([...n.slice(p),c.toPath])}else r.has(c.toPath)||o(c.toPath)}s.delete(i),n.pop()};for(let i of this.nodes.keys())r.has(i)||o(i);return e}}});var F,ee=l(()=>{"use strict";hr();F=class t{constructor(e){this.nodes=e}nodes;_incomingEdgesCache=null;_callIncomingCache=null;serialize(){return{nodes:Array.from(this.nodes.values())}}static deserialize(e){let r=new Map;for(let s of e.nodes)r.set(s.path,s);return new t(r)}getIncomingEdgesMap(){if(this._incomingEdgesCache)return this._incomingEdgesCache;let e=new Map;for(let r of this.nodes.values())for(let s of r.imports)if(s.toPath){let n=e.get(s.toPath)||[];n.push(r.path),e.set(s.toPath,n)}return this._incomingEdgesCache=e,e}dfs(e,r,s,n){let o=new Set,i=s.maxDepth??1/0,a=(c,p,u)=>{if(p>i||o.has(c))return;let m=this.nodes.get(c);if(m&&(o.add(c),r(m,p,u)!==!1))for(let h of n(c))a(h,p+1,c)};a(e,0,null)}traverse(e,r,s={}){let n=s.direction??"outgoing",o=n==="incoming"?this.getIncomingEdgesMap():null;this.dfs(e,r,s,i=>n==="outgoing"?this.nodes.get(i)?.imports.map(a=>a.toPath).filter(Boolean)??[]:o?.get(i)??[])}getCallIncomingCache(){if(this._callIncomingCache)return this._callIncomingCache;let e=new Map;for(let r of this.nodes.values())for(let s of r.callEdges??[]){let n=e.get(s.toFile)??[];n.push(r.path),e.set(s.toFile,n)}return this._callIncomingCache=e,e}traverseCalls(e,r,s={}){let n=s.direction??"outgoing",o=n==="incoming"?this.getCallIncomingCache():null;this.dfs(e,r,s,i=>n==="outgoing"?this.nodes.get(i)?.callEdges?.map(a=>a.toFile)??[]:o?.get(i)??[])}getCallers(e){let r=[];return this.traverseCalls(e,s=>(s.path!==e&&r.push(s.path),!0),{direction:"incoming",maxDepth:1}),r}getCallEdgesFor(e){return this.nodes.get(e)?.callEdges??[]}getNeighbors(e){let r=this.nodes.get(e);return r?r.imports.map(s=>this.nodes.get(s.toPath)).filter(s=>s!==void 0):[]}findUnusedFiles(e){return new Y(this.nodes).findUnusedFiles(e)}findCycles(){return new Y(this.nodes).findCycles()}}});function yr(t){if(t.category==="test")return"test";if(t.category==="config")return"config";if(t.category==="type-only")return"types";let e=t.path;return d(e,"component")||d(e,"components")?"component":d(e,"controller")||d(e,"controllers")?"controller":d(e,"middleware")?"middleware":d(e,"router")||d(e,"routes")||d(e,"route")?"router":d(e,"store")||d(e,"stores")?"store":d(e,"service")||d(e,"services")?"service":d(e,"handler")||d(e,"handlers")?"handler":d(e,"adapter")||d(e,"adapters")?"adapter":d(e,"plugin")||d(e,"plugins")?"plugin":d(e,"api")?"api":d(e,"cli")||d(e,"commands")||te(e)==="cli"?"cli":d(e,"util")||d(e,"utils")||d(e,"helper")||d(e,"helpers")?"util":d(e,"model")||d(e,"models")||te(e)==="model"?"model":d(e,"parser")||d(e,"parsers")||te(e)==="parser"?"parser":te(e)==="builder"?"builder":te(e)==="resolver"?"resolver":"other"}function d(t,e){return t.includes(`/${e}/`)||t.includes(`/${e}.`)}function te(t){let e=t.slice(t.lastIndexOf("/")+1);return e.slice(0,e.lastIndexOf("."))||e}var xr=l(()=>{"use strict"});function ft(t,e){let r=Z(t,e),s=new Map;for(let[o,i]of r.features){for(let a of i.files)s.set(a,o);s.set(i.hub,o)}let n=new Map;for(let o of t.nodes.values()){let i=s.get(o.path);n.set(o.path,{path:o.path,role:yr(o),...o.description?{description:o.description}:{},exports:o.exports.map(a=>a.name),...i?{featureHub:i}:{}})}return n}var ut=l(()=>{"use strict";ve();xr()});var re,mt=l(()=>{"use strict";re=class{affectedSymbols=new Map;constructor(e,r){this.affectedSymbols.set(e,new Set(["default",...r]))}updateAffectedSymbols(e,r){let s=this.affectedSymbols.get(r)||new Set,n=e.imports.find(c=>c.toPath===r);if(!n)return!1;let o=n.symbols||["*"],i=new Set;for(let c of o)(c==="*"||s.has("*")||s.has(c))&&i.add("*");if(i.size===0)return!1;let a=this.affectedSymbols.get(e.path)||new Set;for(let c of i)a.add(c);return this.affectedSymbols.set(e.path,a),!0}}});function qo(t){return t?t.startsWith("interface ")?"interface":t.startsWith("class ")?"class":t.startsWith("enum ")?"enum":"type":"type"}function Vo(t,e){if(e==="type-only")return!0;let r=t.signature??"";return r.startsWith("interface ")||r.startsWith("class ")||r.startsWith("enum ")}function gt(t){let e=new Map;for(let s of t.nodes.values())if(!(s.type!=="typescript"&&s.type!=="javascript"))for(let n of s.exports){if(!Vo(n,s.category))continue;let o=`${s.path}::${n.name}`;e.set(o,{name:n.name,file:s.path,kind:qo(n.signature),...n.doc?{doc:n.doc}:{}})}let r=[];for(let s of t.nodes.values())if(!(s.type!=="typescript"&&s.type!=="javascript")){for(let n of s.imports)if(!(!n.toPath||n.isExternal||!n.symbols?.length))for(let o of n.symbols)e.has(`${n.toPath}::${o}`)&&r.push({fromFile:s.path,toType:o,toFile:n.toPath})}return{types:e,edges:r}}function dt(t,e){let r=null;for(let o of t.types.values())if(o.name===e){r=o;break}if(!r)return{type:null,usedByFiles:[],uses:[]};let s=new Set,n=new Map;for(let o of t.edges)if(o.toType===e&&o.toFile===r.file&&s.add(o.fromFile),o.fromFile===r.file){let i=t.types.get(`${o.toFile}::${o.toType}`);i&&n.set(`${i.file}::${i.name}`,i)}return{type:r,usedByFiles:Array.from(s),uses:Array.from(n.values())}}var ht=l(()=>{"use strict"});import Sr from"fs";import Lp from"path";function br(t){try{return Sr.statSync(t,{throwIfNoEntry:!1})?.isDirectory()===!0}catch{return!1}}function Ce(t){try{return Sr.statSync(t,{throwIfNoEntry:!1})?.isFile()===!0}catch{return!1}}var Ee=l(()=>{"use strict"});import se from"fs";import E from"path";function yt(t,e){let r=E.join(e,"package.json");if(!se.existsSync(r))return null;let s={};try{s=JSON.parse(se.readFileSync(r,"utf-8"))}catch{return null}let n=s.name;return n?{name:n,root:e,relativeRoot:E.relative(t,e),entryPoints:Qo(e,s)}:null}function Qo(t,e){let r=[];if(e.exports){let n=e.exports;if(typeof n=="string")r.push(E.join(t,n));else if(typeof n=="object"&&n!==null){let o=n["."];if(typeof o=="string")r.push(E.join(t,o));else if(typeof o=="object"&&o!==null){let i=o.import??o.require??o.default;typeof i=="string"&&r.push(E.join(t,i))}}}e.main&&r.push(E.join(t,e.main));for(let n of["src/index.ts","src/index.tsx","index.ts","index.tsx","index.js"])r.push(E.join(t,n));let s=r.filter(Ce);return s.length>0?s.slice(0,1):r.slice(0,1)}function j(t,e){let r=[],s=new Set;for(let n of e){let o=n.replace(/\/$/,"").replace(/^\.\//,"");Xo(t,o,s,r)}return r}function Xo(t,e,r,s){if(!e.includes("*")){Zo(t,e,r,s);return}let n=e.split("/");n.includes("**")?Yo(t,n,r,s):ei(t,n,r,s)}function Zo(t,e,r,s){let n=E.join(t,e);if(r.has(n)||!br(n))return;r.add(n);let o=yt(t,n);o&&s.push(o)}function Yo(t,e,r,s){let n=E.join(t,e[0]==="**"?"":e[0]??"");vr(t,n,r,s)}function ei(t,e,r,s){let n=e.findIndex(a=>a.includes("*")),o=E.join(t,...e.slice(0,n)),i;try{i=se.readdirSync(o,{withFileTypes:!0})}catch{return}for(let a of i){if(!a.isDirectory())continue;let c=E.join(o,a.name);if(r.has(c))continue;r.add(c);let p=yt(t,c);p&&s.push(p)}}function vr(t,e,r,s){let n;try{n=se.readdirSync(e,{withFileTypes:!0})}catch{return}for(let o of n){if(!o.isDirectory()||o.name==="node_modules"||o.name.startsWith("."))continue;let i=E.join(e,o.name);if(se.existsSync(E.join(i,"package.json"))&&!r.has(i)){r.add(i);let a=yt(t,i);a&&s.push(a)}else vr(t,i,r,s)}}var ke=l(()=>{"use strict";Ee();Ee()});import xt from"fs";import Cr from"path";var Er,kr=l(()=>{"use strict";ke();Er={type:"npm",detect(t){let e=Cr.join(t,"package.json");if(!xt.existsSync(e))return null;let r;try{r=JSON.parse(xt.readFileSync(e,"utf-8")).workspaces}catch{return null}if(!r||xt.existsSync(Cr.join(t,"yarn.lock")))return null;let s=Array.isArray(r)?r:r.packages??[];return s.length===0?null:j(t,s)}}});import _ from"fs";import S from"path";function wr(t,e,r,s){if(s>4)return[];let n;try{n=_.readdirSync(e,{withFileTypes:!0})}catch{return[]}let o=[];for(let i of n){if(!i.isDirectory())continue;let a=i.name;if(a.startsWith(".")||a==="node_modules"||a==="dist"||a===".nx")continue;let c=S.join(e,a);_.existsSync(S.join(c,"project.json"))&&!r.has(c)?(r.add(c),o.push(c)):o.push(...wr(t,c,r,s+1))}return o}function ti(t,e,r){let s={};try{s=JSON.parse(_.readFileSync(r,"utf-8"))}catch{return null}let n=s.name,o,i,a=S.join(e,"package.json");if(_.existsSync(a))try{let c=JSON.parse(_.readFileSync(a,"utf-8"));n=c.name??n,o=c.main,i=c.exports}catch{}return n?{name:n,root:e,relativeRoot:S.relative(t,e),entryPoints:ri(e,s,o,i)}:null}function ri(t,e,r,s){let n=[],o=e.targets?.build?.options?.main??e.targets?.build?.options?.entryFile;if(o){let a=S.resolve(t,"../..");n.push(S.resolve(a,o)),n.push(S.resolve(t,o))}if(s){let a=s;if(typeof a=="string")n.push(S.join(t,a));else if(typeof a=="object"&&a!==null){let c=a["."];typeof c=="string"&&n.push(S.join(t,c))}}if(r&&n.push(S.join(t,r)),e.sourceRoot){let a=S.resolve(t,"../.."),c=S.resolve(a,e.sourceRoot);n.push(S.join(c,"index.ts"),S.join(c,"index.tsx"))}for(let a of["src/index.ts","src/index.tsx","index.ts","index.tsx"])n.push(S.join(t,a));let i=n.filter(Ce);return i.length>0?i.slice(0,1):n.slice(0,1)}var Fr,Tr=l(()=>{"use strict";Ee();Fr={type:"nx",detect(t){return _.existsSync(S.join(t,"nx.json"))?wr(t,t,new Set,0).map(r=>ti(t,r,S.join(r,"project.json"))).filter(r=>r!==null):null}}});import Pr from"fs";import si from"path";import ni from"js-yaml";var Ir,Nr=l(()=>{"use strict";ke();Ir={type:"pnpm",detect(t){let e=si.join(t,"pnpm-workspace.yaml");if(!Pr.existsSync(e))return null;let r=[];try{r=ni.load(Pr.readFileSync(e,"utf-8"))?.packages??[]}catch{return null}return j(t,r)}}});import oi from"fs";import ii from"path";var Mr,Dr=l(()=>{"use strict";Mr={type:"turborepo",detect(t){return oi.existsSync(ii.join(t,"turbo.json"))?[]:null}}});import St from"fs";import Rr from"path";var Ar,Lr=l(()=>{"use strict";ke();Ar={type:"yarn",detect(t){if(!St.existsSync(Rr.join(t,"yarn.lock")))return null;let e=Rr.join(t,"package.json");if(!St.existsSync(e))return null;let r;try{r=JSON.parse(St.readFileSync(e,"utf-8")).workspaces}catch{return null}if(!r)return null;let s=Array.isArray(r)?r:r.packages??[];return s.length===0?null:j(t,s)}}});function N(t){ai.push(t)}var ai,Fe=l(()=>{"use strict";ai=[]});import ul from"path";var bt=l(()=>{"use strict";kr();Tr();Nr();Dr();Lr();Fe();Fe();N(Mr);N(Fr);N(Ir);N(Ar);N(Er)});var vt=l(()=>{"use strict";ee()});function W(t,e){Gr.set(t,e)}function Or(t){return Gr.get(t)}var Gr,ne=l(()=>{"use strict";Gr=new Map});function jr(t,e){return e.startsWith("!")?t!==e.slice(1):t===e}function ci(t,e){return e.startsWith("!")?!t.includes(e.slice(1)):t.includes(e)}var pi,li,fi,ui,mi,gi,di,hi,yi,xi,Si,bi,vi,Ci,Ei,ki,Fi,_r,Wr=l(()=>{"use strict";pi=(t,e)=>!e.category||jr(t.category,e.category),li=(t,e)=>!e.type||jr(t.type,e.type),fi=(t,e)=>!e.path||ci(t.path,e.path),ui=(t,e)=>e.isExternal===void 0?!0:t.imports.some(s=>s.isExternal)===e.isExternal,mi=(t,e)=>{if(!e.tags||e.tags.length===0)return!0;let r=e.tags.filter(n=>!n.startsWith("!")),s=e.tags.filter(n=>n.startsWith("!")).map(n=>n.slice(1));return!(r.length>0&&!r.some(n=>t.tags.some(o=>o.name===n))||s.some(n=>t.tags.some(o=>o.name===n)))},gi=(t,e)=>!e.allTags?.length||e.allTags.every(r=>t.tags.some(s=>s.name===r)),di=(t,e)=>!e.importsFile||t.imports.some(r=>r.toPath?.includes(e.importsFile)),hi=(t,e,r)=>e.importedBy===void 0?!0:(r?.get(t.path)??[]).some(n=>n.includes(e.importedBy)),yi=(t,e)=>e.minImports===void 0||t.imports.length>=e.minImports,xi=(t,e)=>e.maxImports===void 0||t.imports.length<=e.maxImports,Si=(t,e)=>e.minSize===void 0||t.size>=e.minSize,bi=(t,e)=>e.maxSize===void 0||t.size<=e.maxSize,vi=(t,e)=>e.hasDocstring===void 0||!!t.description===e.hasDocstring,Ci=(t,e)=>e.minCoverage===void 0||(t.coveragePct??101)>=e.minCoverage,Ei=(t,e)=>e.maxCoverage===void 0||(t.coveragePct??0)<=e.maxCoverage,ki=(t,e)=>e.minExportUsage===void 0||(t.avgExportUsage??-1)>=e.minExportUsage,Fi=(t,e)=>e.maxExportUsage===void 0||(t.avgExportUsage??0)<=e.maxExportUsage,_r=[pi,li,fi,ui,mi,gi,di,hi,yi,xi,Si,bi,vi,Ci,Ei,ki,Fi]});function zr(t,e,r){return _r.every(s=>s(t,e,r))}function we(t,e){let r=new Map;if(e.importedBy!==void 0){for(let i of t.nodes)for(let a of i.imports)if(a.toPath){let c=r.get(a.toPath)??[];c.push(i.path),r.set(a.toPath,c)}}let s=t.nodes.filter(i=>zr(i,e,r)),n=new Set(s.map(i=>i.path)),o=s.map(i=>({...i,imports:i.imports.filter(a=>!a.toPath||n.has(a.toPath))}));return e.sort&&o.sort((i,a)=>e.sort==="size"?a.size-i.size:e.sort==="imports"?a.imports.length-i.imports.length:e.sort==="commitCount90d"?(a.commitCount90d??0)-(i.commitCount90d??0):e.sort==="exportUsage"?(a.avgExportUsage??0)-(i.avgExportUsage??0):0),e.limit!==void 0&&o.splice(e.limit),{nodes:o,cycles:t.cycles?.filter(i=>i.every(a=>n.has(a)))??void 0}}var $r=l(()=>{"use strict";Wr()});function Te(t){let e={},r=t.split(",");for(let s of r){let n=s.indexOf(":");if(n===-1)continue;let o=s.slice(0,n).trim().toLowerCase(),i=s.slice(n+1).trim();if(!(!o||!i))switch(o){case"category":e.category=i;break;case"type":e.type=i;break;case"tag":case"tags":i.includes("+")?e.allTags=[...e.allTags??[],...i.split("+")]:e.tags=[...e.tags??[],i];break;case"path":e.path=i;break;case"external":e.isExternal=i.toLowerCase()==="true";break;case"importsfile":e.importsFile=i;break;case"importedby":e.importedBy=i;break;case"minimports":e.minImports=parseInt(i,10);break;case"maximports":e.maxImports=parseInt(i,10);break;case"minsize":e.minSize=parseInt(i,10);break;case"maxsize":e.maxSize=parseInt(i,10);break;case"sort":e.sort=i;break;case"limit":e.limit=parseInt(i,10);break;case"hasdocstring":e.hasDocstring=i.toLowerCase()!=="false";break;case"mincoverage":e.minCoverage=parseInt(i,10);break;case"maxcoverage":e.maxCoverage=parseInt(i,10);break;case"minexportusage":e.minExportUsage=parseFloat(i);break;case"maxexportusage":e.maxExportUsage=parseFloat(i);break}}return e}var Ur=l(()=>{"use strict"});var Br=l(()=>{"use strict";$r();Ur()});import b from"typescript";function z(t){let e=[];for(let r of t.statements){if(!b.isExpressionStatement(r))continue;let s=r.expression;if(!b.isCallExpression(s))continue;let n=s.expression;b.isIdentifier(n)&&Jr.has(n.text)&&e.push(s),b.isPropertyAccessExpression(n)&&b.isIdentifier(n.expression)&&Jr.has(n.expression.text)&&e.push(s)}return e}function $(t,e,r){for(let s of t.arguments){if(!b.isObjectLiteralExpression(s))continue;let n=s.properties.find(o=>b.isPropertyAssignment(o)&&b.isIdentifier(o.name)&&o.name.text===e);if(!(!n||!b.isArrayLiteralExpression(n.initializer)))return n.initializer.elements.filter(b.isStringLiteral).map(o=>o.text)}return null}function U(t,e,r,s){if(t.arguments.length===0)return null;for(let o=1;o<t.arguments.length;o++){let i=t.arguments[o];if(!b.isObjectLiteralExpression(i))continue;let a=i.properties.find(p=>b.isPropertyAssignment(p)&&b.isIdentifier(p.name)&&p.name.text===e);if(a)return{start:a.initializer.getStart(s),end:a.initializer.getEnd(),text:r};let c=i.getEnd()-1;return{start:c,end:c,text:`${i.properties.length>0?", ":""}${e}: ${r}`}}let n=t.arguments[t.arguments.length-1];return{start:n.getStart(s),end:n.getStart(s),text:`{ ${e}: ${r} }, `}}function B(t,e,r){let s=t.arguments;for(let n=1;n<s.length;n++){let o=s[n];if(!b.isObjectLiteralExpression(o))continue;let i=o.properties.findIndex(c=>b.isPropertyAssignment(c)&&b.isIdentifier(c.name)&&c.name.text===e);if(i<0)continue;if(o.properties.length===1)return{start:s[n-1].getEnd(),end:o.getEnd(),text:""};let a=o.properties[i];return i===o.properties.length-1?{start:o.properties[i-1].getEnd(),end:a.getEnd(),text:""}:{start:a.getStart(r),end:o.properties[i+1].getStart(r),text:""}}return null}function J(t,e){let r=[...e].sort((n,o)=>o.start-n.start),s=t;for(let n of r)s=s.slice(0,n.start)+n.text+s.slice(n.end);return s}function K(t){return`[${t.map(e=>JSON.stringify(e)).join(", ")}]`}var Jr,P,H=l(()=>{"use strict";Jr=new Set(["describe","test","it"]);P=new Set([".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"])});import Kr from"path";import Hr from"typescript";function wi(t){return K(t.map(e=>`@${e}`))}function Ti(t){return t.map(e=>e.startsWith("@")?e.slice(1):e)}var Pe,qr=l(()=>{"use strict";H();Pe=class{name="cypress";canHandle(e){return P.has(Kr.extname(e).toLowerCase())}apply(e,r,s){let n=Hr.createSourceFile(Kr.basename(e),r,Hr.ScriptTarget.Latest,!0),o=z(n);if(o.length===0)return r;let i=$(o[0],"tags",n),a=[...s].sort();if(i!==null&&JSON.stringify(Ti(i).sort())===JSON.stringify(a))return r;let c=o.flatMap(p=>{let u=s.length===0?B(p,"tags",n):U(p,"tags",wi(a),n);return u?[u]:[]});return c.length>0?J(r,c):r}}});import Pi from"path";function Ii(t){return["# <mokosh-tags>",...t.map(e=>`@${e}`),"# </mokosh-tags>"].join(`
|
|
4
4
|
`)+`
|
|
5
5
|
|
|
6
|
-
`}function
|
|
7
|
-
`}function
|
|
8
|
-
`+r.slice(c)}}});import
|
|
6
|
+
`}function Ni(t){let e=new Set;Et.lastIndex=0;let r=Et.exec(t);for(;r!==null;)r[1]&&e.add(r[1]),r=Et.exec(t);return e}var Ct,Et,Ie,Vr=l(()=>{"use strict";Ct=/# <mokosh-tags>[\s\S]*?# <\/mokosh-tags>\n*/,Et=/^@([a-zA-Z0-9_-]+)/gm;Ie=class{name="gherkin";canHandle(e){return Pi.extname(e).toLowerCase()===".feature"}apply(e,r,s){let n=r.replace(Ct,""),o=Ni(n),i=s.filter(c=>!o.has(c)),a=i.length>0?Ii(i):"";return Ct.test(r)?r.replace(Ct,a):a?r.replace(/^(Feature:)/m,`${a}$1`):r}}});function Qr(t,e){let r=t.replace(/\\/g,"/"),s=e.replace(/\\/g,"/"),n="";for(let o=0;o<r.length;o++){let i=r[o];i==="*"?r[o+1]==="*"?(n+=".*",o++):n+="[^/]*":i==="?"?n+="[^/]":i!==void 0&&(n+=i.replace(/[.+^${}()|[\]\\]/g,"\\$&"))}return new RegExp(`^${n}$`).test(s)}var Xr=l(()=>{"use strict"});import Mi from"path";function Ri(t){return`//go:build ${t.map(r=>`mokosh_${r}`).join(" || ")}
|
|
7
|
+
`}function Ai(t){let e=kt.exec(t);if(!e)return null;let r=e[0],s=/mokosh_([a-zA-Z0-9_-]+)/g,n=[],o=s.exec(r);for(;o!==null;)o[1]&&n.push(o[1]),o=s.exec(r);return n}var kt,Di,Ne,Zr=l(()=>{"use strict";kt=/^\/\/go:build mokosh_[^\n]+\n/m,Di=/^package\s+\S+/m;Ne=class{name="go";canHandle(e){return Mi.basename(e).endsWith("_test.go")}apply(e,r,s){let n=Ai(r),o=[...s].sort();if(n!==null&&JSON.stringify([...n].sort())===JSON.stringify(o))return r;if(s.length===0)return r.replace(kt,"");let i=Ri(o);if(n!==null)return r.replace(kt,i);let a=Di.exec(r);if(!a)return r;let c=a.index;return r.slice(0,c)+i+`
|
|
8
|
+
`+r.slice(c)}}});import Li from"path";function Oi(t){return["/**",...t.map(e=>` * @group ${e}`)," */"].join(`
|
|
9
9
|
`)+`
|
|
10
10
|
|
|
11
|
-
`}function
|
|
12
|
-
`),r=-1;for(let n=0;n<e.length;n++){let o=e[n].trimStart();(o.startsWith("import ")||o.startsWith("from "))&&(r=n)}if(r<0)return 0;let s=0;for(let n=0;n<=r;n++)s+=e[n].length+1;return s}var
|
|
11
|
+
`}function ji(t){let e=[];Ft.lastIndex=0;let r=Ft.exec(t);for(;r!==null;)r[1]&&e.push(r[1]),r=Ft.exec(t);return e}var Gi,Ft,Me,Yr=l(()=>{"use strict";H();Gi=/^\/\*\*\n(?: \* @group .+\n)+ \*\/\n+/,Ft=/^ \* @group (.+)$/gm;Me=class{name="jest";canHandle(e){return P.has(Li.extname(e).toLowerCase())}apply(e,r,s){let n=Gi.exec(r),o=n?ji(n[0]):null,i=[...s].sort();if(o!==null&&JSON.stringify([...o].sort())===JSON.stringify(i))return r;let a=n?r.slice(n[0].length):r;return s.length===0?a:Oi(i)+a}}});import es from"path";import ts from"typescript";function _i(t){return K(t.map(e=>`@${e}`))}function Wi(t){return t.map(e=>e.startsWith("@")?e.slice(1):e)}var De,rs=l(()=>{"use strict";H();De=class{name="playwright";canHandle(e){return P.has(es.extname(e).toLowerCase())}apply(e,r,s){let n=ts.createSourceFile(es.basename(e),r,ts.ScriptTarget.Latest,!0),o=z(n);if(o.length===0)return r;let i=$(o[0],"tag",n),a=[...s].sort();if(i!==null&&JSON.stringify(Wi(i).sort())===JSON.stringify(a))return r;let c=o.flatMap(p=>{let u=s.length===0?B(p,"tag",n):U(p,"tag",_i(a),n);return u?[u]:[]});return c.length>0?J(r,c):r}}});import zi from"path";function Ui(t){let e=t.map(r=>`pytest.mark.${r}`).join(", ");return t.length===1?`pytestmark = pytest.mark.${t[0]}`:`pytestmark = [${e}]`}function Bi(t){let e=wt.exec(t);if(!e)return null;let r=e[0],s=[],n=/pytest\.mark\.([a-zA-Z0-9_-]+)/g,o=n.exec(r);for(;o!==null;)o[1]&&s.push(o[1]),o=n.exec(r);return s}function Ji(t){let e=t.split(`
|
|
12
|
+
`),r=-1;for(let n=0;n<e.length;n++){let o=e[n].trimStart();(o.startsWith("import ")||o.startsWith("from "))&&(r=n)}if(r<0)return 0;let s=0;for(let n=0;n<=r;n++)s+=e[n].length+1;return s}var wt,$i,Re,ss=l(()=>{"use strict";wt=/^pytestmark\s*=\s*.+$/m,$i=/^import pytest\s*$/m;Re=class{name="pytest";canHandle(e){return zi.extname(e).toLowerCase()===".py"}apply(e,r,s){let n=Bi(r),o=[...s].sort();if(n!==null&&JSON.stringify([...n].sort())===JSON.stringify(o))return r;if(s.length===0)return r.replace(wt,"").replace(/\n{3,}/g,`
|
|
13
13
|
|
|
14
|
-
`);let i=
|
|
14
|
+
`);let i=Ui(o);if(n!==null)return r.replace(wt,i);let a=$i.test(r),c=Ji(r),p=r.slice(0,c),u=r.slice(c),m=a?"":`import pytest
|
|
15
15
|
`,h=p.endsWith(`
|
|
16
16
|
|
|
17
17
|
`)?"":`
|
|
18
18
|
`;return p+h+m+i+`
|
|
19
|
-
`+u}}});import
|
|
20
|
-
`).filter(Boolean);return{commitCount90d:s.length,lastAuthor:s[0]}}var Oe,
|
|
21
|
-
`).map(o=>o.trim()).filter(o=>o!=="")}catch{return[]}});return Array.from(new Set(r))}catch(e){return console.error("Error getting git diff:",e),[]}}}});import je from"fs";import
|
|
22
|
-
`).filter(c=>c.trim().length>0&&!c.trim().startsWith("#"));if(s.length<2)continue;let n=s[0];if(!n||n.startsWith(" "))continue;let o=Zi(n);if(o.length===0)continue;let a=s.find(c=>c.trim().startsWith('version "'))?.match(/version "(.*?)"/)?.[1]??"";for(let c of o)e.dependencies[c]={version:a}}return e}function ra(t){let e=je.readFileSync(t,"utf-8"),r=JSON.parse(e),s={dependencies:{}};if(r.packages)for(let[n,o]of Object.entries(r.packages)){if(!n.startsWith("node_modules/"))continue;let i=n.replace("node_modules/","");i.includes("node_modules/")||(s.dependencies[i]={version:o.version,...o.dependencies!==void 0&&{dependencies:o.dependencies}})}else if(r.dependencies)for(let[n,o]of Object.entries(r.dependencies))s.dependencies[n]={version:o.version,...o.dependencies!==void 0&&{dependencies:o.dependencies}};return s}function sa(t){let e=je.readFileSync(t,"utf-8");if(e.includes("__metadata:")){let r=ea(e);if(r!==null)return r}return ta(e)}function na(t){let e=je.readFileSync(t,"utf-8"),r={dependencies:{}};try{let s=gs.load(e);if(s.packages)for(let[n,o]of Object.entries(s.packages)){let{name:i,version:a}=Yi(n,o.version);i&&(r.dependencies[i]={version:a,...o.dependencies!==void 0&&{dependencies:o.dependencies}})}if(s.dependencies)for(let[n,o]of Object.entries(s.dependencies)){if(r.dependencies[n])continue;let i=typeof o=="string"?o:o.version;r.dependencies[n]={version:i||""}}}catch{}return r}function hs(t){let e=[["package-lock.json",ra],["yarn.lock",sa],["pnpm-lock.yaml",na]];for(let[r,s]of e){let n=Xi.join(t,r);if(je.existsSync(n))return s(n)}return null}var ys=l(()=>{"use strict"});import xs from"path";function M(t){switch(xs.extname(t).toLowerCase()){case".js":case".jsx":case".mjs":case".cjs":return"javascript";case".ts":case".tsx":return"typescript";case".css":return"css";case".scss":case".sass":return"scss";case".less":return"less";case".styl":return"stylus";case".coffee":return"coffeescript";case".ls":return"livescript";case".lua":return"lua";case".py":return"python";case".go":return"go";case".java":case".cpp":case".cc":case".cxx":case".c":return"unknown";case".feature":return"gherkin";default:return"unknown"}}function k(t){let e=xs.extname(t).toLowerCase();return[".css",".scss",".sass",".less",".styl"].includes(e)}var D=l(()=>{"use strict"});import oa from"coffeescript";function ia(t){let e=new Set,r=/@tag\s+([a-zA-Z0-9_-]+)/g,s=r.exec(t);for(;s!==null;)s[1]&&e.add(s[1]),s=r.exec(t);return e}function aa(t,e){let r=t.toLowerCase();return r.includes(".test.")||r.includes(".spec.")||e.has("test")?"test":"logic"}function ca(t,e){let r=e.source?.value;return r?{fromPath:t,toPath:"",rawSpecifier:r,isStyle:k(r),type:"static"}:null}function pa(t,e){let r=e.variable?.base?.value==="require",s=e.args?.[0]?.base?.value;return!r||!s?null:{fromPath:t,toPath:"",rawSpecifier:s,isStyle:k(s),type:"require"}}function la(t,e,r){let s=e.constructor?.name;if(s==="ImportDeclaration"){let n=ca(t,e);n&&r.push(n)}else if(s==="Call"){let n=pa(t,e);n&&r.push(n)}}function Mt(t,e,r){if(!(!e||typeof e!="object")){la(t,e,r);for(let s in e){if(s==="locationData")continue;let n=e[s];if(!(!n||typeof n!="object"))if(Array.isArray(n))for(let o of n)Mt(t,o,r);else Mt(t,n,r)}}}function Ss(t,e){let r=ia(e),s=aa(t,r),n=[];try{Mt(t,oa.nodes(e),n)}catch{}return{imports:n,exports:[],tags:Array.from(r).map(o=>({name:o,kind:"comment-marker"})),category:s}}var bs=l(()=>{"use strict";D()});import{AstBuilder as fa,GherkinClassicTokenMatcher as ua,Parser as ma}from"@cucumber/gherkin";import{IdGenerator as ga}from"@cucumber/messages";function Dt(t,e){let r=new Set;try{let s=new fa(da),n=new ua,i=new ma(s,n).parse(e);i.feature&&(i.feature.tags.forEach(a=>{r.add(a.name.startsWith("@")?a.name.slice(1):a.name)}),i.feature.children.forEach(a=>{a.scenario&&(a.scenario.tags.forEach(c=>{r.add(c.name.startsWith("@")?c.name.slice(1):c.name)}),a.scenario.examples.forEach(c=>{c.tags.forEach(p=>{r.add(p.name.startsWith("@")?p.name.slice(1):p.name)})})),a.rule&&a.rule.children.forEach(c=>{c.scenario&&c.scenario.tags.forEach(p=>{r.add(p.name.startsWith("@")?p.name.slice(1):p.name)})})}))}catch(s){console.warn(`[GherkinParser] Failed to parse ${t}:`,s)}return{imports:[],exports:[],tags:Array.from(r).map(s=>({name:s,kind:"comment-marker"})),category:"test"}}var da,vs=l(()=>{"use strict";ne();da=ga.uuid();W("gherkin",Dt)});import ha from"path";import{parser as ya}from"@lezer/go";function Es(t,e){let r=[],s=new Map,n=new Set,o=new Set,a=ya.parse(e).cursor();do switch(a.name){case"LineComment":{let m=e.slice(a.from,a.to),h=m.match(xa);h?.[1]&&n.add(h[1]);let x=m.match(Sa);x&&Cs(x[1],o);let N=m.match(ba);N&&Cs(N[1],o);break}case"ImportSpec":{let m=a.node.getChild("String");if(m){let x=e.slice(m.from,m.to).slice(1,-1);r.push({fromPath:t,toPath:"",rawSpecifier:x,isExternal:!0,isStyle:!1,type:"static"})}break}case"FunctionDecl":case"TypeDecl":case"VarDecl":case"ConstDecl":{let m=a.node.getChild("DefName")??a.node.getChild("TypeSpec")?.getChild("DefName")??a.node.getChild("VarSpec")?.getChild("DefName")??a.node.getChild("ConstSpec")?.getChild("DefName");if(m){let h=e.slice(m.from,m.to);h!=="_"&&/^[A-Z]/.test(h)&&!s.has(h)&&s.set(h,{name:h})}break}}while(a.next());let c=r.some(m=>m.rawSpecifier==="testing"),p=ha.basename(t).endsWith("_test.go")||n.has("test")||c?"test":"logic",u=new Set([...n,...o]);return{imports:r,exports:Array.from(s.values()),tags:Array.from(u).map(m=>({name:m,kind:"comment-marker"})),category:p}}function Cs(t,e){for(let r of t.split(/[\s,&|!()]+/)){let s=r.trim();s&&s!=="ignore"&&e.add(s)}}var xa,Sa,ba,ks=l(()=>{"use strict";xa=/\/\/\s*@tag\s+([a-zA-Z0-9_-]+)/,Sa=/^\/\/go:build\s+(.+)$/,ba=/^\/\/\s*\+build\s+(.+)$/});function q(t){return t.startsWith("'")||t.startsWith('"')?t.slice(1,-1):t}var Rt=l(()=>{"use strict"});import va from"livescript";function Ca(t){let e=new Set,r=/@tag\s+([a-zA-Z0-9_-]+)/g,s=r.exec(t);for(;s!==null;)s[1]&&e.add(s[1]),s=r.exec(t);return e}function Ea(t,e){let r=t.toLowerCase();return r.includes(".test.")||r.includes(".spec.")||e.has("test")?"test":"logic"}function Fa(t,e){let r=t.constructor?.name||t.type;if(r==="Import"){let s=t.right?.value;if(typeof s=="string"){let n=q(s);return{fromPath:e,toPath:"",rawSpecifier:n,isStyle:k(n),type:"static"}}}if(r==="Chain"&&t.head?.value==="require"){let s=t.tails?.[0];if(s?.constructor?.name==="Call"||s?.type==="Call"){let n=s.args?.[0]?.value;if(typeof n=="string"){let o=q(n);return{fromPath:e,toPath:"",rawSpecifier:o,isStyle:k(o),type:"require"}}}}return null}function At(t,e){if(!t||typeof t!="object")return[];let r=[],s=Fa(t,e);s&&r.push(s);for(let n in t){if(ka.has(n))continue;let o=t[n];if(!(!o||typeof o!="object"))if(Array.isArray(o))for(let i of o)r.push(...At(i,e));else r.push(...At(o,e))}return r}function Fs(t,e){let r=Ca(e),s=Ea(t,r),n=[];try{n=At(va.ast(e),t)}catch{}return{imports:n,exports:[],tags:Array.from(r).map(o=>({name:o,kind:"comment-marker"})),category:s}}var ka,ws=l(()=>{"use strict";D();Rt();ka=new Set(["first_line","first_column","last_line","last_column","line","column"])});import wa from"luaparse";function Ta(t){let e=new Set,r=/@tag\s+([a-zA-Z0-9_-]+)/g,s=r.exec(t);for(;s!==null;)s[1]&&e.add(s[1]),s=r.exec(t);return e}function Pa(t,e){let r=t.toLowerCase();return r.includes(".test.")||r.includes(".spec.")||e.has("test")?"test":"logic"}function Na(t,e){let r=[];function s(n){if(!(!n||typeof n!="object")){if((n.type==="CallExpression"||n.type==="StringCallExpression")&&n.base?.type==="Identifier"&&n.base?.name==="require"){let o;if(n.type==="CallExpression"){let i=n.arguments?.[0];i?.type==="StringLiteral"&&(o=q(i.raw))}else if(n.type==="StringCallExpression"){let i=n.argument;i?.type==="StringLiteral"&&(o=q(i.raw))}o&&r.push({fromPath:e,toPath:"",rawSpecifier:o,isStyle:k(o),type:"require"})}for(let o in n){if(o==="loc")continue;let i=n[o];if(i&&typeof i=="object")if(Array.isArray(i))for(let a of i)s(a);else s(i)}}}return s(t),r}function Ts(t,e){let r=Ta(e),s=Pa(t,r),n=[];try{let o=wa.parse(e);n=Na(o,t)}catch{}return{imports:n,exports:[],tags:Array.from(r).map(o=>({name:o,kind:"comment-marker"})),category:s}}var Ps=l(()=>{"use strict";D();Rt()});import Ia from"path";import{parser as Ma}from"@lezer/python";function Ns(t,e){let r=[],s=[],n=new Set,o=Ia.basename(t).toLowerCase(),a=Ma.parse(e).cursor();do switch(a.name){case"Comment":{let p=e.slice(a.from,a.to).match(/#\s*@tag\s+([a-zA-Z0-9_-]+)/);p?.[1]&&n.add(p[1]);break}case"ImportStatement":{for(let p of Ra(a.node,e,t))r.push(p);break}case"FunctionDefinition":case"ClassDefinition":{let p=a.node.parent;if(p?.name==="Script"||p?.name==="DecoratedStatement"&&p.parent?.name==="Script"){let m=a.node.getChild("VariableName");m&&s.push({name:e.slice(m.from,m.to)})}break}case"AssignStatement":{if(a.node.parent?.name==="Script"){let p=a.node.firstChild;p?.name==="VariableName"&&s.push({name:e.slice(p.from,p.to)})}break}}while(a.next());let c=Oa(o,r,n);return c==="test"&&n.add("test"),{imports:r,exports:s,tags:Array.from(n).map(p=>({name:p,kind:"comment-marker"})),category:c}}function Ra(t,e,r){let s=t.firstChild;return s?s.name==="from"?Aa(t,e,r):La(t,e,r):[]}function Aa(t,e,r){let s=t.firstChild;if(!s)return[];let n=s.nextSibling;for(;n&&n.name!=="import";)n=n.nextSibling;if(!n)return[];let o=e.slice(s.to,n.from).trim(),i=Ga(n.nextSibling,e);if(!i.length)return[];let a=0;for(;a<o.length&&o[a]===".";)a++;let c=o.slice(a);if(a===0)return[oe(r,o,i,!0)];let p=a===1?"./":"../".repeat(a-1);return c?[oe(r,p+c.replace(/\./g,"/"),i,!1)]:i[0]==="*"?[oe(r,p.slice(0,-1),["*"],!1)]:i.map(u=>oe(r,p+u,[u],!1))}function La(t,e,r){let s=[],n=t.firstChild?.nextSibling??null;for(;n;){if(n.name==="VariableName"){let o=e.slice(n.from,n.to);for(;n.nextSibling?.name==="."&&n.nextSibling.nextSibling?.name==="VariableName";)n=n.nextSibling.nextSibling,o+=`.${e.slice(n.from,n.to)}`;n.nextSibling?.name==="as"&&(n=n.nextSibling.nextSibling??n.nextSibling),s.push(oe(r,o,["*"],!0))}n=n.nextSibling}return s}function Ga(t,e){let r=[],s=t;for(;s;)s.name==="*"?r.push("*"):s.name==="VariableName"&&(r.push(e.slice(s.from,s.to)),s.nextSibling?.name==="as"&&(s=s.nextSibling.nextSibling??s.nextSibling)),s=s.nextSibling;return r}function oe(t,e,r,s){return{fromPath:t,toPath:"",rawSpecifier:e,isStyle:!1,isExternal:s,type:"static",symbols:r.length>0?r:void 0}}function Oa(t,e,r){return t.startsWith("test_")||t.endsWith("_test.py")?"test":t==="conftest.py"||t==="setup.py"?"config":r.has("test")||e.some(s=>Da.has(s.rawSpecifier))?"test":"logic"}var Da,Is=l(()=>{"use strict";Da=new Set(["pytest","unittest","nose","hypothesis"])});import g from"typescript";function ja(t){let e=1;function r(s){switch(s.kind){case g.SyntaxKind.IfStatement:case g.SyntaxKind.ConditionalExpression:case g.SyntaxKind.ForStatement:case g.SyntaxKind.ForInStatement:case g.SyntaxKind.ForOfStatement:case g.SyntaxKind.WhileStatement:case g.SyntaxKind.DoStatement:case g.SyntaxKind.CatchClause:case g.SyntaxKind.CaseClause:e++;break;case g.SyntaxKind.BinaryExpression:{let n=s.operatorToken.kind;(n===g.SyntaxKind.AmpersandAmpersandToken||n===g.SyntaxKind.BarBarToken||n===g.SyntaxKind.QuestionQuestionToken)&&e++;break}}g.forEachChild(s,r)}return r(t),e}function _a(t){let e=0;function r(s,n,o){if(g.isIfStatement(s)){e+=o?1:1+n;let a=o?n:n+1;r(s.expression,a,!1),r(s.thenStatement,a,!1),s.elseStatement&&(g.isIfStatement(s.elseStatement)?r(s.elseStatement,n,!0):(e+=1,r(s.elseStatement,n+1,!1)));return}if(g.isForStatement(s)||g.isForInStatement(s)||g.isForOfStatement(s)||g.isWhileStatement(s)||g.isDoStatement(s)||g.isSwitchStatement(s)){e+=1+n,g.forEachChild(s,a=>r(a,n+1,!1));return}if(g.isCatchClause(s)){e+=1+n,g.forEachChild(s,a=>r(a,n,!1));return}if(g.isConditionalExpression(s)&&(e+=1),g.isBinaryExpression(s)){let a=s.operatorToken.kind;(a===g.SyntaxKind.AmpersandAmpersandToken||a===g.SyntaxKind.BarBarToken||a===g.SyntaxKind.QuestionQuestionToken)&&(e+=1)}if(n>0&&(g.isFunctionDeclaration(s)||g.isFunctionExpression(s)||g.isArrowFunction(s))){e+=1+n,g.forEachChild(s,a=>r(a,n+1,!1));return}g.forEachChild(s,a=>r(a,n,!1))}return r(t,0,!1),e}function Lt(t){return{complexity:ja(t),cognitiveComplexity:_a(t)}}var Ms=l(()=>{"use strict"});import y from"typescript";function Ds(t,e){Wa(t,e),$a(t,e),Ua(t,e),Ba(t,e)}function Wa(t,e){if((y.isFunctionDeclaration(t)||y.isVariableDeclaration(t))&&t.name&&y.isIdentifier(t.name)&&za(t)){let r;if(y.isFunctionDeclaration(t))r="function";else{let s=t.initializer;r=s&&(y.isArrowFunction(s)||y.isFunctionExpression(s))?"function":"variable"}e.tags.add({name:t.name.text,kind:r})}}function za(t){if(y.isFunctionDeclaration(t))return y.isSourceFile(t.parent);let e=t.parent?.parent;return!!e&&y.isSourceFile(e.parent)}function $a(t,e){if(!y.isStringLiteral(t))return;let r=t.text.match(/@[\w-]+/g);if(r)for(let s of r)e.tags.add({name:s.substring(1),kind:"comment-marker"})}function Ua(t,e){if(!y.isSourceFile(t))return;let r=/@tag\s+([a-zA-Z0-9_-]+)/g,s=t.getFullText(),n=r.exec(s);for(;n!==null;)n[1]&&e.tags.add({name:n[1],kind:"comment-marker"}),n=r.exec(s)}function Ba(t,e){if(y.isCallExpression(t)&&Ja(t.expression))for(let r of t.arguments)y.isObjectLiteralExpression(r)&&Ka(r,e)}function Ja(t){return y.isIdentifier(t)?Gt.has(t.text):!!(y.isPropertyAccessExpression(t)&&(Gt.has(t.name.text)||y.isIdentifier(t.expression)&&Gt.has(t.expression.text)))}function Ka(t,e){for(let r of t.properties){if(!y.isPropertyAssignment(r)||!y.isIdentifier(r.name)||r.name.text!=="tags"&&r.name.text!=="tag")continue;let{initializer:s}=r,n=y.isArrayLiteralExpression(s)?s.elements.filter(y.isStringLiteral):r.name.text==="tag"&&y.isStringLiteral(s)?[s]:[];for(let o of n)e.tags.add({name:o.text.replace(/^@/,""),kind:"comment-marker"})}}var Gt,Rs=l(()=>{"use strict";Gt=new Set(["test","describe","it"])});import As from"path";import f from"typescript";function Ot(t,e,r){let s=[],n=new Map,o=new Set,i=f.createSourceFile(t,e,f.ScriptTarget.Latest,!0,r==="typescript"?f.ScriptKind.TSX:f.ScriptKind.JSX),a={filePath:t,imports:s,exports:n,tags:o,rawCallEdges:[],sourceFile:i,hasUI:!1,hasTypesOnly:!0,totalStatements:0,exportStatements:0},c=Q=>{Qa(Q,a),f.forEachChild(Q,c)};c(i);let p=ac(t,a);(p==="test"||p==="barrel")&&o.add({name:p,kind:"comment-marker"}),p!=="test"&&cc(a,i);let u=i.statements[0],m=u?Gs(u):void 0,{complexity:h,cognitiveComplexity:x}=Lt(i),N=Ha(i);return{imports:s,exports:Array.from(n.values()),tags:Array.from(o),category:p,rawCallEdges:a.rawCallEdges??[],complexity:h,cognitiveComplexity:x,...N.length>0?{functions:N}:{},...m!==void 0?{description:m}:{}}}function Ha(t){let e=[],r=(n,o)=>{let{complexity:i,cognitiveComplexity:a}=Lt(o),c=t.getLineAndCharacterOfPosition(o.getStart(t)).line+1;e.push({name:n,line:c,complexity:i,cognitiveComplexity:a})},s=(n,o)=>{if(f.isFunctionDeclaration(n)&&n.name&&n.body?r(n.name.text,n):f.isVariableDeclaration(n)&&f.isIdentifier(n.name)&&n.initializer&&(f.isArrowFunction(n.initializer)||f.isFunctionExpression(n.initializer))?r(n.name.text,n.initializer):o&&f.isMethodDeclaration(n)&&f.isIdentifier(n.name)&&n.body?r(`${o}.${n.name.text}`,n):o&&f.isConstructorDeclaration(n)&&n.body?r(`${o}.constructor`,n):o&&f.isGetAccessorDeclaration(n)&&f.isIdentifier(n.name)&&n.body?r(`${o}.get ${n.name.text}`,n):o&&f.isSetAccessorDeclaration(n)&&f.isIdentifier(n.name)&&n.body&&r(`${o}.set ${n.name.text}`,n),f.isClassDeclaration(n)&&n.name){let i=n.name.text;f.forEachChild(n,a=>s(a,i));return}f.forEachChild(n,i=>s(i,o))};return s(t,void 0),e}function Ls(t,e,r,s){let n={name:t},o=Gs(r);o!==void 0&&(n.doc=o);let i=qa(e);i!==void 0&&(n.flags=i);let a=Va(e,s);return a!==void 0&&(n.signature=a),n}function Gs(t){let e=f.getJSDocCommentsAndTags(t);for(let r of e)if(f.isJSDoc(r)&&r.comment)return f.getTextOfJSDocComment(r.comment)||void 0}function qa(t){let e=new Set(["deprecated","internal","public","alpha","beta"]),r=f.getJSDocTags(t).map(s=>s.tagName.text).filter(s=>e.has(s));return r.length>0?r:void 0}function Va(t,e){let r=f.createPrinter({removeComments:!0}),s=n=>r.printNode(f.EmitHint.Unspecified,n,e);if(f.isFunctionDeclaration(t)||f.isMethodDeclaration(t)){let n=t.parameters.map(s).join(", "),o=t.type?s(t.type):"void";return`${t.typeParameters?`<${t.typeParameters.map(a=>a.name.text).join(", ")}>`:""}(${n}) => ${o}`}if(f.isVariableDeclaration(t)){if(t.type)return s(t.type);if(t.initializer&&(f.isArrowFunction(t.initializer)||f.isFunctionExpression(t.initializer))){let n=t.initializer,o=n.parameters.map(s).join(", "),i=n.type?s(n.type):"unknown";return`(${o}) => ${i}`}return}if(f.isClassDeclaration(t)&&t.name)return`class ${t.name.text}`;if(f.isInterfaceDeclaration(t))return`interface ${t.name.text}`;if(f.isTypeAliasDeclaration(t))return s(t.type);if(f.isEnumDeclaration(t))return`enum ${t.name.text}`}function Qa(t,e){Xa(t,e),Za(t,e),ec(t,e),tc(t,e),ic(t,e),Ds(t,e)}function Xa(t,e){if(!f.isSourceFile(t))return;let r=t.statements.filter(s=>!f.isEmptyStatement(s));e.totalStatements=r.length,e.exportStatements=r.filter(s=>f.isExportDeclaration(s)||f.isExportAssignment(s)||jt(s)).length}function Za(t,e){if(f.isJsxElement(t)||f.isJsxSelfClosingElement(t)||f.isJsxFragment(t)){e.hasUI=!0,e.hasTypesOnly=!1;return}if(f.isFunctionDeclaration(t)||f.isMethodDeclaration(t)||f.isArrowFunction(t)||f.isClassDeclaration(t)||f.isVariableStatement(t)||f.isEnumDeclaration(t)){e.hasTypesOnly=!1;return}f.isExportDeclaration(t)&&!Ya(t)&&(e.hasTypesOnly=!1)}function Ya(t){return t.isTypeOnly?!0:!t.exportClause||!f.isNamedExports(t.exportClause)?!1:t.exportClause.elements.every(e=>e.isTypeOnly)}function ec(t,e){if(!f.isImportDeclaration(t)||!t.moduleSpecifier||!f.isStringLiteral(t.moduleSpecifier))return;let r=[];if(t.importClause&&(t.importClause.name&&r.push("default"),t.importClause.namedBindings))if(f.isNamedImports(t.importClause.namedBindings))for(let n of t.importClause.namedBindings.elements)r.push(n.name.text);else f.isNamespaceImport(t.importClause.namedBindings)&&r.push("*");let s=r.length>0?"static":"side-effect";e.imports.push({fromPath:e.filePath,toPath:"",rawSpecifier:t.moduleSpecifier.text,isStyle:k(t.moduleSpecifier.text),type:s,symbols:r.length>0?r:void 0})}function tc(t,e){f.isExportDeclaration(t)?rc(t,e):f.isExportAssignment(t)?e.exports.set("default",{name:"default"}):jt(t)&&oc(t,e)}function rc(t,e){if(t.moduleSpecifier&&f.isStringLiteral(t.moduleSpecifier))sc(t,t.moduleSpecifier.text,e);else if(t.exportClause&&f.isNamedExports(t.exportClause))for(let r of t.exportClause.elements){let s=r.name.text;e.exports.set(s,{name:s})}}function sc(t,e,r){let s=nc(t),n={fromPath:r.filePath,toPath:"",rawSpecifier:e,isStyle:k(e),type:"re-export"};s.length>0&&(n.symbols=s),r.imports.push(n)}function nc(t){return t.exportClause?f.isNamedExports(t.exportClause)?t.exportClause.elements.map(e=>e.name.text):[]:["*"]}function oc(t,e){if((f.isFunctionDeclaration(t)||f.isClassDeclaration(t)||f.isInterfaceDeclaration(t)||f.isTypeAliasDeclaration(t)||f.isEnumDeclaration(t))&&t.name){let s=t.name.text;e.exports.set(s,Ls(s,t,t,e.sourceFile));return}if(f.isVariableStatement(t)){for(let s of t.declarationList.declarations)if(f.isIdentifier(s.name)){let n=s.name.text;e.exports.set(n,Ls(n,s,t,e.sourceFile))}}}function ic(t,e){if(!f.isCallExpression(t))return;let r=t.arguments[0];!r||!f.isStringLiteral(r)||(t.expression.kind===f.SyntaxKind.ImportKeyword?e.imports.push({fromPath:e.filePath,toPath:"",rawSpecifier:r.text,isStyle:k(r.text),type:"dynamic"}):f.isIdentifier(t.expression)&&t.expression.text==="require"&&e.imports.push({fromPath:e.filePath,toPath:"",rawSpecifier:r.text,isStyle:k(r.text),type:"require"}))}function ac(t,e){let r=As.basename(t).toLowerCase(),s=As.extname(t).toLowerCase();return X().some(o=>r.includes(o))?"test":sr(r)?"config":e.imports.some(o=>qe().some(i=>o.rawSpecifier.includes(i)))?"test":s===".tsx"||s===".jsx"||e.hasUI?"ui":e.hasTypesOnly&&e.totalStatements>0?"type-only":e.totalStatements>0&&e.exportStatements/e.totalStatements>Qe()?"barrel":"logic"}function jt(t){return f.canHaveModifiers(t)&&f.getModifiers(t)?.some(e=>e.kind===f.SyntaxKind.ExportKeyword)===!0}function cc(t,e){let r=t.rawCallEdges??[];t.rawCallEdges=r;let s=new Map;for(let n of e.statements){if(!f.isImportDeclaration(n)||!f.isStringLiteral(n.moduleSpecifier))continue;let o=n.moduleSpecifier.text,i=n.importClause;if(i&&(i.name&&s.set(i.name.text,o),i.namedBindings&&f.isNamedImports(i.namedBindings)))for(let a of i.namedBindings.elements)s.set(a.name.text,o)}if(s.size!==0)for(let n of e.statements){let o=lc(n);if(o){let i=fc(n);i&&_e(i,o,s,r);continue}f.isClassDeclaration(n)&&n.name&&pc(n,s,r)}}function pc(t,e,r){let s=t.name.text;for(let n of t.members)f.isMethodDeclaration(n)&&n.body&&f.isIdentifier(n.name)?_e(n.body,`${s}.${n.name.text}`,e,r):f.isConstructorDeclaration(n)&&n.body&&_e(n.body,`${s}.constructor`,e,r)}function lc(t){if(jt(t)){if(f.isFunctionDeclaration(t)&&t.name)return t.name.text;if(f.isVariableStatement(t)){for(let e of t.declarationList.declarations)if(f.isIdentifier(e.name)&&e.initializer&&(f.isArrowFunction(e.initializer)||f.isFunctionExpression(e.initializer)))return e.name.text}}}function fc(t){if(f.isFunctionDeclaration(t))return t.body;if(f.isVariableStatement(t)){for(let e of t.declarationList.declarations)if(e.initializer&&(f.isArrowFunction(e.initializer)||f.isFunctionExpression(e.initializer)))return e.initializer}}function _e(t,e,r,s){if(f.isCallExpression(t)&&f.isIdentifier(t.expression)){let n=t.expression.text,o=r.get(n);o&&!s.some(i=>i.from===e&&i.to===n&&i.toSpecifier===o)&&s.push({from:e,to:n,toSpecifier:o})}f.forEachChild(t,n=>_e(n,e,r,s))}var Os=l(()=>{"use strict";G();Ms();D();Rs()});function We(t,e){if(e.length===0)return"ui";let r=!1;return t.walk(s=>{if(s.type==="rule")return r=!0,!1}),r?"ui":"barrel"}var js=l(()=>{"use strict"});import Ws from"postcss";function _s(t){return t.startsWith("~")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("data:")}function mc(t){let e=t.trim();return e.length>0&&!e.startsWith("http://")&&!e.startsWith("https://")&&!e.startsWith("//")&&!e.startsWith("data:")&&!e.startsWith("#")}function gc(t,e){let r=t.match(/^\(([^)]+)\)\s+['"]([^'"]+)['"]/);if(r){let o=r[1]?.trim()??"",i=r[2]??"";if(!i)return null;let a=zs.has(o)?"side-effect":"static";return{fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:a,..._s(i)?{isExternal:!0}:{}}}let s=t.match(/^url\(['"]?([^'")]+)['"]?\)/),n=s?s[1]?.trim()??"":t.match(/^['"]([^'"]+)['"]/)?.[1]??"";return n?{fromPath:e,toPath:"",rawSpecifier:n,isStyle:!0,type:"static",..._s(n)?{isExternal:!0}:{}}:null}function dc(t,e){let r=[],s=/url\(['"]?([^'")]+)['"]?\)/g,n=s.exec(t);for(;n!==null;){let o=n[1]?.trim()??"";mc(o)&&r.push({fromPath:e,toPath:"",rawSpecifier:o,isStyle:!0,type:"static"}),n=s.exec(t)}return r}function $s(t,e){let r=[];return t.walk(s=>{if(s.type==="atrule"&&s.name==="import"){let n=gc(s.params,e);n&&r.push(n)}s.type==="decl"&&r.push(...dc(s.value,e))}),r}function hc(t){return t.replace(/(?<!:)\/\/.*/g,"")}function yc(t,e){let r=[],s=/@import\s+(?:\(([^)]+)\)\s+)?['"]([^'"]+)['"]/g,n=s.exec(t);for(;n!==null;){let o=n[1]?.trim()??"",i=n[2]??"";if(i){let a=zs.has(o)?"side-effect":"static";r.push({fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:a})}n=s.exec(t)}return r}function Us(t,e){let r=Ws.parse(hc(t));return{imports:$s(r,e),root:r}}function Bs(t,e){try{let r=uc.parse(t);return{imports:$s(r,e),root:r}}catch{return{imports:yc(t,e),root:Ws.parse("")}}}var uc,zs,Js=l(()=>{"use strict";uc=ge("postcss-less"),zs=new Set(["reference","inline"])});import{parse as xc}from"postcss-scss";function Sc(t){return!!(t.startsWith("sass:")||t.startsWith("~")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||!t.startsWith(".")&&!t.startsWith("/")&&!t.startsWith("_"))}function bc(t){let e=t.match(/^['"]([^'"]+)['"]/);if(!e?.[1])return{specifier:""};let r=e[1],n=t.match(/\bas\s+(\S+)/)?.[1];return n!==void 0?{specifier:r,alias:n}:{specifier:r}}function Ks(t,e){let r=xc(t),s=[];return r.walk(n=>{if(n.type!=="atrule")return;let{name:o,params:i}=n;if(o!=="import"&&o!=="use"&&o!=="forward")return;let{specifier:a,alias:c}=bc(i);if(!a)return;let p={fromPath:e,toPath:"",rawSpecifier:a,isStyle:!0,type:o==="forward"?"re-export":"static",...Sc(a)?{isExternal:!0}:{}};c&&(p.symbols=[c]),s.push(p)}),{imports:s,root:r}}var Hs=l(()=>{"use strict"});function qs(t,e){let r=[],s=/@require\s+['"]([^'"]+)['"]/g,n=s.exec(t);for(;n!==null;){let i=n[1];i&&r.push({fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:"require"}),n=s.exec(t)}let o=/(?<!@)(?:import|require)\s*\(?\s*['"]([^'"]+)['"]/g;for(n=o.exec(t);n!==null;){let i=n[1];i&&r.push({fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:"static"}),n=o.exec(t)}return r}function Vs(t,e){if(e.length===0)return"ui";try{let r=ge("stylus");return new r.Parser(t).parse().nodes.some(o=>o.constructor.name!=="Import")?"ui":"barrel"}catch{return t.replace(/^\s*@?(?:require|import)\b.*/gm,"").trim().length>0?"ui":"barrel"}}var Qs=l(()=>{"use strict"});function ie(t,e){let r=M(t);if(r==="stylus"){let o=qs(e,t);return{imports:o,exports:[],tags:[],category:Vs(e,o)}}if(r==="scss"){let{imports:o,root:i}=Ks(e,t);return{imports:o,exports:[],tags:[],category:We(i,o)}}if(r==="less"){let{imports:o,root:i}=Bs(e,t);return{imports:o,exports:[],tags:[],category:We(i,o)}}let{imports:s,root:n}=Us(e,t);return{imports:s,exports:[],tags:[],category:We(n,s)}}var Xs=l(()=>{"use strict";D();js();Js();Hs();Qs()});async function Zs(t,e){let r=M(t),s=Gr(r);return s?s(t,e):{imports:[],exports:[],tags:[],category:"other"}}var Ys=l(()=>{"use strict";D();bs();vs();ks();ws();Ps();Is();Os();ne();Xs();G();D();ne();for(let[t,e]of[["javascript",(r,s)=>Ot(r,s,"javascript")],["typescript",(r,s)=>Ot(r,s,"typescript")],["css",ie],["scss",ie],["less",ie],["stylus",ie],["coffeescript",Ss],["livescript",Fs],["lua",Ts],["python",Ns],["go",Es],["gherkin",Dt]])W(t,e)});import _t from"path";function tn(t,e){for(let r of t.values()){let s=e.get(r.path);s!==void 0&&(r.coveragePct=s)}}function rn(t,e){for(let r of t)if(!r.rawSpecifier.startsWith(".")&&!_t.isAbsolute(r.rawSpecifier)){let s=r.rawSpecifier.startsWith("@")?r.rawSpecifier.split("/").slice(0,2).join("/"):r.rawSpecifier.split("/")[0];s&&!e.some(n=>n.name===s)&&e.push({name:s,kind:"library"})}}function sn(t){for(let e of t.values())if(e.category==="test")for(let r of e.imports){if(r.isExternal||!r.toPath)continue;let s=t.get(r.toPath);s&&(s.category!=="logic"&&s.category!=="barrel"||(s.testedBy??=[],s.testedBy.includes(e.path)||s.testedBy.push(e.path)))}}function en(t){return Math.round(t*1e4)/1e4}function nn(t){for(let e of t.values()){let r=[];for(let s of e.imports){if(s.isExternal||!s.toPath)continue;let n=t.get(s.toPath);if(!n||n.exports.length===0)continue;let o;if(s.symbols===void 0){if(s.type==="side-effect")continue;o=1}else s.symbols.includes("*")?o=1:o=s.symbols.length/n.exports.length;s.exportUsageRatio=en(Math.min(1,o)),r.push(s.exportUsageRatio)}r.length>0&&(e.avgExportUsage=en(r.reduce((s,n)=>s+n,0)/r.length),e.maxExportUsage=Math.max(...r))}}function Wt(t,e,r){e&&(t.some(s=>s.name===e&&s.kind===r)||t.push({name:e,kind:r}))}function vc(t,e){let r=e.toPath,s=_t.basename(r,_t.extname(r)).replace(/\.(test|spec)$/,"");Wt(t.tags,s,"import")}function Cc(t,e){if(!(!e.symbols||e.symbols.includes("*")))for(let r of e.symbols)Wt(t.tags,r,"import")}function Ec(t,e,r){let s=r.get(e.toPath);if(!(!s||s.category==="test"))for(let n of s.tags)n.kind==="comment-marker"&&Wt(t.tags,n.name,"comment-marker")}function on(t){for(let e of t.values())if(e.category==="test")for(let r of e.imports)!r.toPath||r.isExternal||(vc(e,r),Cc(e,r),Ec(e,r,t))}var an=l(()=>{"use strict"});import ln from"fs";import V from"path";function kc(t,e){let r=t.split(`
|
|
23
|
-
`),s=null,n=new Map,o=!1;for(let i of r){let a=i.trim();if(a.startsWith("module ")){s=a.slice(7).trim();continue}if(/^replace\s*\(/.test(a)){o=!0;continue}if(o&&a===")"){o=!1;continue}if(o&&a.includes("=>")){
|
|
19
|
+
`+u}}});import ns from"path";import os from"typescript";var Ki,Ae,is=l(()=>{"use strict";H();Ki=/\/\/ <mokosh-tags>[\s\S]*?\/\/ <\/mokosh-tags>\n*/,Ae=class{name="vitest";canHandle(e){return P.has(ns.extname(e).toLowerCase())}apply(e,r,s){let n=r.replace(Ki,""),o=os.createSourceFile(ns.basename(e),n,os.ScriptTarget.Latest,!0),i=z(o);if(i.length===0)return n;let a=$(i[0],"tags",o),c=[...s].sort();if(a!==null&&JSON.stringify([...a].sort())===JSON.stringify(c))return n;let p=i.flatMap(u=>{let m=s.length===0?B(u,"tags",o):U(u,"tags",K(c),o);return m?[m]:[]});return p.length>0?J(n,p):n}}});import Tt from"path";import Le from"typescript";function qi(t){let e=Le.createSourceFile("detect.ts",t,Le.ScriptTarget.Latest,!0);for(let r of e.statements){if(!Le.isImportDeclaration(r)||!Le.isStringLiteral(r.moduleSpecifier))continue;let s=Hi[r.moduleSpecifier.text];if(s)return s}return null}function cs(t="vitest",e={},r=process.cwd()){return[new Ie,new Re,new Ne,new Pt(r,t,Object.entries(e))]}function ps(t,e){return e.find(r=>r.canHandle(t))??null}var as,Hi,Pt,ls=l(()=>{"use strict";qr();Vr();Xr();Zr();Yr();rs();ss();H();is();as={vitest:()=>new Ae,playwright:()=>new De,cypress:()=>new Pe,jest:()=>new Me},Hi={"@playwright/test":"playwright",cypress:"cypress","@jest/globals":"jest",vitest:"vitest"};Pt=class{constructor(e,r,s){this.rootDir=e;this.defaultFramework=r;this.frameworkOverrides=s}rootDir;defaultFramework;frameworkOverrides;name="auto";canHandle(e){return P.has(Tt.extname(e).toLowerCase())}apply(e,r,s){let n=qi(r)??this.matchOverride(e)??this.defaultFramework;return(as[n]??as.vitest)().apply(e,r,s)}matchOverride(e){let r=Tt.relative(this.rootDir,e).split(Tt.sep).join("/");for(let[s,n]of this.frameworkOverrides)if(Qr(s,r))return n;return null}}});import fs from"fs/promises";import Vi from"path";async function Yi(t,e,r,s){let n;try{n=await fs.readFile(t,"utf8")}catch(a){return{path:t,status:"error",error:String(a)}}let o=ps(t,s);if(!o)return{path:t,status:"unchanged"};let i=o.apply(t,n,e);return i===n?{path:t,status:"unchanged"}:(r||await fs.writeFile(t,i,"utf8"),{path:t,status:"updated"})}async function It(t,e,r){let s=O(e),n=s.tagApplier?.framework??"vitest",o=s.tagApplier?.frameworkOverrides??{},i=cs(n,o,e),a={updated:0,unchanged:0,errors:0,files:[]};for(let c of t.nodes.values()){if(c.category!=="test")continue;let p=new Set,u=[];for(let x of c.tags)Xi.has(x.kind)&&Qi.test(x.name)&&(Zi.has(x.name.toLowerCase())||p.has(x.name)||(p.add(x.name),u.push(x.name)));u.sort();let m=Vi.resolve(e,c.path),h=await Yi(m,u,r.dryRun,i);h.path=c.path,a.files.push(h),h.status==="updated"?a.updated++:h.status==="unchanged"?a.unchanged++:a.errors++}return a}var Qi,Xi,Zi,us=l(()=>{"use strict";et();ls();Qi=/^[a-zA-Z][a-zA-Z0-9_-]{1,}$/,Xi=new Set(["import"]),Zi=new Set(["common","fixture","fixtures","helper","helpers","index","main","mock","mocks","setup","shared","spec","test","tests","types","util","utils"])});var Ge,Nt=l(()=>{"use strict";Ge=class{isTestNode(e){return e.category==="test"||e.tags.some(r=>r.name==="test")}}});import{execSync as ms}from"child_process";function gs(t,e){let s=ms(`git -C "${t}" log --follow --format="%ae" --since="90 days ago" -- "${e}"`,{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).split(`
|
|
20
|
+
`).filter(Boolean);return{commitCount90d:s.length,lastAuthor:s[0]}}var Oe,Mt=l(()=>{"use strict";Oe=class{getChangedFiles(){try{let r=["git diff --name-only","git diff --cached --name-only","git ls-files --others --exclude-standard"].flatMap(s=>{try{return ms(s,{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).split(`
|
|
21
|
+
`).map(o=>o.trim()).filter(o=>o!=="")}catch{return[]}});return Array.from(new Set(r))}catch(e){return console.error("Error getting git diff:",e),[]}}}});import je from"fs";import ea from"path";import ds from"js-yaml";function hs(t){let e=t.lastIndexOf("@");return e>0?t.substring(0,e):t}function ta(t){return t.replace(/:$/,"").split(",").map(e=>{let r=e.trim();return r.startsWith('"')&&(r=r.slice(1)),r.endsWith('"')&&(r=r.slice(0,-1)),hs(r)}).filter(Boolean)}function ra(t,e){let r=t.startsWith("/")?t.slice(1):t,s=r.lastIndexOf("@");return s>0?{name:r.substring(0,s),version:e||r.substring(s+1)}:{name:r,version:e}}function sa(t){try{let e=ds.load(t),r={dependencies:{}};for(let[s,n]of Object.entries(e))if(!(s==="__metadata"||!n?.version))for(let o of s.split(", ")){let i=hs(o);i&&(r.dependencies[i]={version:n.version,...n.dependencies!==void 0&&{dependencies:n.dependencies}})}return r}catch{return null}}function na(t){let e={dependencies:{}};for(let r of t.split(/\n\n+/)){let s=r.split(`
|
|
22
|
+
`).filter(c=>c.trim().length>0&&!c.trim().startsWith("#"));if(s.length<2)continue;let n=s[0];if(!n||n.startsWith(" "))continue;let o=ta(n);if(o.length===0)continue;let a=s.find(c=>c.trim().startsWith('version "'))?.match(/version "(.*?)"/)?.[1]??"";for(let c of o)e.dependencies[c]={version:a}}return e}function oa(t){let e=je.readFileSync(t,"utf-8"),r=JSON.parse(e),s={dependencies:{}};if(r.packages)for(let[n,o]of Object.entries(r.packages)){if(!n.startsWith("node_modules/"))continue;let i=n.replace("node_modules/","");i.includes("node_modules/")||(s.dependencies[i]={version:o.version,...o.dependencies!==void 0&&{dependencies:o.dependencies}})}else if(r.dependencies)for(let[n,o]of Object.entries(r.dependencies))s.dependencies[n]={version:o.version,...o.dependencies!==void 0&&{dependencies:o.dependencies}};return s}function ia(t){let e=je.readFileSync(t,"utf-8");if(e.includes("__metadata:")){let r=sa(e);if(r!==null)return r}return na(e)}function aa(t){let e=je.readFileSync(t,"utf-8"),r={dependencies:{}};try{let s=ds.load(e);if(s.packages)for(let[n,o]of Object.entries(s.packages)){let{name:i,version:a}=ra(n,o.version);i&&(r.dependencies[i]={version:a,...o.dependencies!==void 0&&{dependencies:o.dependencies}})}if(s.dependencies)for(let[n,o]of Object.entries(s.dependencies)){if(r.dependencies[n])continue;let i=typeof o=="string"?o:o.version;r.dependencies[n]={version:i||""}}}catch{}return r}function ys(t){let e=[["package-lock.json",oa],["yarn.lock",ia],["pnpm-lock.yaml",aa]];for(let[r,s]of e){let n=ea.join(t,r);if(je.existsSync(n))return s(n)}return null}var xs=l(()=>{"use strict"});import Ss from"path";function M(t){switch(Ss.extname(t).toLowerCase()){case".js":case".jsx":case".mjs":case".cjs":return"javascript";case".ts":case".tsx":return"typescript";case".css":return"css";case".scss":case".sass":return"scss";case".less":return"less";case".styl":return"stylus";case".coffee":return"coffeescript";case".ls":return"livescript";case".lua":return"lua";case".py":return"python";case".go":return"go";case".java":case".cpp":case".cc":case".cxx":case".c":return"unknown";case".feature":return"gherkin";default:return"unknown"}}function k(t){let e=Ss.extname(t).toLowerCase();return[".css",".scss",".sass",".less",".styl"].includes(e)}var D=l(()=>{"use strict"});import ca from"coffeescript";function pa(t){let e=new Set,r=/@tag\s+([a-zA-Z0-9_-]+)/g,s=r.exec(t);for(;s!==null;)s[1]&&e.add(s[1]),s=r.exec(t);return e}function la(t,e){let r=t.toLowerCase();return r.includes(".test.")||r.includes(".spec.")||e.has("test")?"test":"logic"}function fa(t,e){let r=e.source?.value;return r?{fromPath:t,toPath:"",rawSpecifier:r,isStyle:k(r),type:"static"}:null}function ua(t,e){let r=e.variable?.base?.value==="require",s=e.args?.[0]?.base?.value;return!r||!s?null:{fromPath:t,toPath:"",rawSpecifier:s,isStyle:k(s),type:"require"}}function ma(t,e,r){let s=e.constructor?.name;if(s==="ImportDeclaration"){let n=fa(t,e);n&&r.push(n)}else if(s==="Call"){let n=ua(t,e);n&&r.push(n)}}function Dt(t,e,r){if(!(!e||typeof e!="object")){ma(t,e,r);for(let s in e){if(s==="locationData")continue;let n=e[s];if(!(!n||typeof n!="object"))if(Array.isArray(n))for(let o of n)Dt(t,o,r);else Dt(t,n,r)}}}function bs(t,e){let r=pa(e),s=la(t,r),n=[];try{Dt(t,ca.nodes(e),n)}catch{}return{imports:n,exports:[],tags:Array.from(r).map(o=>({name:o,kind:"comment-marker"})),category:s}}var vs=l(()=>{"use strict";D()});import{AstBuilder as ga,GherkinClassicTokenMatcher as da,Parser as ha}from"@cucumber/gherkin";import{IdGenerator as ya}from"@cucumber/messages";function Rt(t,e){let r=new Set;try{let s=new ga(xa),n=new da,i=new ha(s,n).parse(e);i.feature&&(i.feature.tags.forEach(a=>{r.add(a.name.startsWith("@")?a.name.slice(1):a.name)}),i.feature.children.forEach(a=>{a.scenario&&(a.scenario.tags.forEach(c=>{r.add(c.name.startsWith("@")?c.name.slice(1):c.name)}),a.scenario.examples.forEach(c=>{c.tags.forEach(p=>{r.add(p.name.startsWith("@")?p.name.slice(1):p.name)})})),a.rule&&a.rule.children.forEach(c=>{c.scenario&&c.scenario.tags.forEach(p=>{r.add(p.name.startsWith("@")?p.name.slice(1):p.name)})})}))}catch(s){console.warn(`[GherkinParser] Failed to parse ${t}:`,s)}return{imports:[],exports:[],tags:Array.from(r).map(s=>({name:s,kind:"comment-marker"})),category:"test"}}var xa,Cs=l(()=>{"use strict";ne();xa=ya.uuid();W("gherkin",Rt)});import Sa from"path";import{parser as ba}from"@lezer/go";function ks(t,e){let r=[],s=new Map,n=new Set,o=new Set,a=ba.parse(e).cursor();do switch(a.name){case"LineComment":{let m=e.slice(a.from,a.to),h=m.match(va);h?.[1]&&n.add(h[1]);let x=m.match(Ca);x&&Es(x[1],o);let I=m.match(Ea);I&&Es(I[1],o);break}case"ImportSpec":{let m=a.node.getChild("String");if(m){let x=e.slice(m.from,m.to).slice(1,-1);r.push({fromPath:t,toPath:"",rawSpecifier:x,isExternal:!0,isStyle:!1,type:"static"})}break}case"FunctionDecl":case"TypeDecl":case"VarDecl":case"ConstDecl":{let m=a.node.getChild("DefName")??a.node.getChild("TypeSpec")?.getChild("DefName")??a.node.getChild("VarSpec")?.getChild("DefName")??a.node.getChild("ConstSpec")?.getChild("DefName");if(m){let h=e.slice(m.from,m.to);h!=="_"&&/^[A-Z]/.test(h)&&!s.has(h)&&s.set(h,{name:h})}break}}while(a.next());let c=r.some(m=>m.rawSpecifier==="testing"),p=Sa.basename(t).endsWith("_test.go")||n.has("test")||c?"test":"logic",u=new Set([...n,...o]);return{imports:r,exports:Array.from(s.values()),tags:Array.from(u).map(m=>({name:m,kind:"comment-marker"})),category:p}}function Es(t,e){for(let r of t.split(/[\s,&|!()]+/)){let s=r.trim();s&&s!=="ignore"&&e.add(s)}}var va,Ca,Ea,Fs=l(()=>{"use strict";va=/\/\/\s*@tag\s+([a-zA-Z0-9_-]+)/,Ca=/^\/\/go:build\s+(.+)$/,Ea=/^\/\/\s*\+build\s+(.+)$/});function q(t){return t.startsWith("'")||t.startsWith('"')?t.slice(1,-1):t}var At=l(()=>{"use strict"});import ka from"livescript";function Fa(t){let e=new Set,r=/@tag\s+([a-zA-Z0-9_-]+)/g,s=r.exec(t);for(;s!==null;)s[1]&&e.add(s[1]),s=r.exec(t);return e}function wa(t,e){let r=t.toLowerCase();return r.includes(".test.")||r.includes(".spec.")||e.has("test")?"test":"logic"}function Pa(t,e){let r=t.constructor?.name||t.type;if(r==="Import"){let s=t.right?.value;if(typeof s=="string"){let n=q(s);return{fromPath:e,toPath:"",rawSpecifier:n,isStyle:k(n),type:"static"}}}if(r==="Chain"&&t.head?.value==="require"){let s=t.tails?.[0];if(s?.constructor?.name==="Call"||s?.type==="Call"){let n=s.args?.[0]?.value;if(typeof n=="string"){let o=q(n);return{fromPath:e,toPath:"",rawSpecifier:o,isStyle:k(o),type:"require"}}}}return null}function Lt(t,e){if(!t||typeof t!="object")return[];let r=[],s=Pa(t,e);s&&r.push(s);for(let n in t){if(Ta.has(n))continue;let o=t[n];if(!(!o||typeof o!="object"))if(Array.isArray(o))for(let i of o)r.push(...Lt(i,e));else r.push(...Lt(o,e))}return r}function ws(t,e){let r=Fa(e),s=wa(t,r),n=[];try{n=Lt(ka.ast(e),t)}catch{}return{imports:n,exports:[],tags:Array.from(r).map(o=>({name:o,kind:"comment-marker"})),category:s}}var Ta,Ts=l(()=>{"use strict";D();At();Ta=new Set(["first_line","first_column","last_line","last_column","line","column"])});import Ia from"luaparse";function Na(t){let e=new Set,r=/@tag\s+([a-zA-Z0-9_-]+)/g,s=r.exec(t);for(;s!==null;)s[1]&&e.add(s[1]),s=r.exec(t);return e}function Ma(t,e){let r=t.toLowerCase();return r.includes(".test.")||r.includes(".spec.")||e.has("test")?"test":"logic"}function Da(t,e){let r=[];function s(n){if(!(!n||typeof n!="object")){if((n.type==="CallExpression"||n.type==="StringCallExpression")&&n.base?.type==="Identifier"&&n.base?.name==="require"){let o;if(n.type==="CallExpression"){let i=n.arguments?.[0];i?.type==="StringLiteral"&&(o=q(i.raw))}else if(n.type==="StringCallExpression"){let i=n.argument;i?.type==="StringLiteral"&&(o=q(i.raw))}o&&r.push({fromPath:e,toPath:"",rawSpecifier:o,isStyle:k(o),type:"require"})}for(let o in n){if(o==="loc")continue;let i=n[o];if(i&&typeof i=="object")if(Array.isArray(i))for(let a of i)s(a);else s(i)}}}return s(t),r}function Ps(t,e){let r=Na(e),s=Ma(t,r),n=[];try{let o=Ia.parse(e);n=Da(o,t)}catch{}return{imports:n,exports:[],tags:Array.from(r).map(o=>({name:o,kind:"comment-marker"})),category:s}}var Is=l(()=>{"use strict";D();At()});import Ra from"path";import{parser as Aa}from"@lezer/python";function Ns(t,e){let r=[],s=[],n=new Set,o=Ra.basename(t).toLowerCase(),a=Aa.parse(e).cursor();do switch(a.name){case"Comment":{let p=e.slice(a.from,a.to).match(/#\s*@tag\s+([a-zA-Z0-9_-]+)/);p?.[1]&&n.add(p[1]);break}case"ImportStatement":{for(let p of Ga(a.node,e,t))r.push(p);break}case"FunctionDefinition":case"ClassDefinition":{let p=a.node.parent;if(p?.name==="Script"||p?.name==="DecoratedStatement"&&p.parent?.name==="Script"){let m=a.node.getChild("VariableName");m&&s.push({name:e.slice(m.from,m.to)})}break}case"AssignStatement":{if(a.node.parent?.name==="Script"){let p=a.node.firstChild;p?.name==="VariableName"&&s.push({name:e.slice(p.from,p.to)})}break}}while(a.next());let c=Wa(o,r,n);return c==="test"&&n.add("test"),{imports:r,exports:s,tags:Array.from(n).map(p=>({name:p,kind:"comment-marker"})),category:c}}function Ga(t,e,r){let s=t.firstChild;return s?s.name==="from"?Oa(t,e,r):ja(t,e,r):[]}function Oa(t,e,r){let s=t.firstChild;if(!s)return[];let n=s.nextSibling;for(;n&&n.name!=="import";)n=n.nextSibling;if(!n)return[];let o=e.slice(s.to,n.from).trim(),i=_a(n.nextSibling,e);if(!i.length)return[];let a=0;for(;a<o.length&&o[a]===".";)a++;let c=o.slice(a);if(a===0)return[oe(r,o,i,!0)];let p=a===1?"./":"../".repeat(a-1);return c?[oe(r,p+c.replace(/\./g,"/"),i,!1)]:i[0]==="*"?[oe(r,p.slice(0,-1),["*"],!1)]:i.map(u=>oe(r,p+u,[u],!1))}function ja(t,e,r){let s=[],n=t.firstChild?.nextSibling??null;for(;n;){if(n.name==="VariableName"){let o=e.slice(n.from,n.to);for(;n.nextSibling?.name==="."&&n.nextSibling.nextSibling?.name==="VariableName";)n=n.nextSibling.nextSibling,o+=`.${e.slice(n.from,n.to)}`;n.nextSibling?.name==="as"&&(n=n.nextSibling.nextSibling??n.nextSibling),s.push(oe(r,o,["*"],!0))}n=n.nextSibling}return s}function _a(t,e){let r=[],s=t;for(;s;)s.name==="*"?r.push("*"):s.name==="VariableName"&&(r.push(e.slice(s.from,s.to)),s.nextSibling?.name==="as"&&(s=s.nextSibling.nextSibling??s.nextSibling)),s=s.nextSibling;return r}function oe(t,e,r,s){return{fromPath:t,toPath:"",rawSpecifier:e,isStyle:!1,isExternal:s,type:"static",symbols:r.length>0?r:void 0}}function Wa(t,e,r){return t.startsWith("test_")||t.endsWith("_test.py")?"test":t==="conftest.py"||t==="setup.py"?"config":r.has("test")||e.some(s=>La.has(s.rawSpecifier))?"test":"logic"}var La,Ms=l(()=>{"use strict";La=new Set(["pytest","unittest","nose","hypothesis"])});import g from"typescript";function za(t){let e=1;function r(s){switch(s.kind){case g.SyntaxKind.IfStatement:case g.SyntaxKind.ConditionalExpression:case g.SyntaxKind.ForStatement:case g.SyntaxKind.ForInStatement:case g.SyntaxKind.ForOfStatement:case g.SyntaxKind.WhileStatement:case g.SyntaxKind.DoStatement:case g.SyntaxKind.CatchClause:case g.SyntaxKind.CaseClause:e++;break;case g.SyntaxKind.BinaryExpression:{let n=s.operatorToken.kind;(n===g.SyntaxKind.AmpersandAmpersandToken||n===g.SyntaxKind.BarBarToken||n===g.SyntaxKind.QuestionQuestionToken)&&e++;break}}g.forEachChild(s,r)}return r(t),e}function $a(t){let e=0;function r(s,n,o){if(g.isIfStatement(s)){e+=o?1:1+n;let a=o?n:n+1;r(s.expression,a,!1),r(s.thenStatement,a,!1),s.elseStatement&&(g.isIfStatement(s.elseStatement)?r(s.elseStatement,n,!0):(e+=1,r(s.elseStatement,n+1,!1)));return}if(g.isForStatement(s)||g.isForInStatement(s)||g.isForOfStatement(s)||g.isWhileStatement(s)||g.isDoStatement(s)||g.isSwitchStatement(s)){e+=1+n,g.forEachChild(s,a=>r(a,n+1,!1));return}if(g.isCatchClause(s)){e+=1+n,g.forEachChild(s,a=>r(a,n,!1));return}if(g.isConditionalExpression(s)&&(e+=1),g.isBinaryExpression(s)){let a=s.operatorToken.kind;(a===g.SyntaxKind.AmpersandAmpersandToken||a===g.SyntaxKind.BarBarToken||a===g.SyntaxKind.QuestionQuestionToken)&&(e+=1)}if(n>0&&(g.isFunctionDeclaration(s)||g.isFunctionExpression(s)||g.isArrowFunction(s))){e+=1+n,g.forEachChild(s,a=>r(a,n+1,!1));return}g.forEachChild(s,a=>r(a,n,!1))}return r(t,0,!1),e}function Gt(t){return{complexity:za(t),cognitiveComplexity:$a(t)}}var Ds=l(()=>{"use strict"});import y from"typescript";function Rs(t,e){Ua(t,e),Ja(t,e),Ka(t,e),Ha(t,e)}function Ua(t,e){if((y.isFunctionDeclaration(t)||y.isVariableDeclaration(t))&&t.name&&y.isIdentifier(t.name)&&Ba(t)){let r;if(y.isFunctionDeclaration(t))r="function";else{let s=t.initializer;r=s&&(y.isArrowFunction(s)||y.isFunctionExpression(s))?"function":"variable"}e.tags.add({name:t.name.text,kind:r})}}function Ba(t){if(y.isFunctionDeclaration(t))return y.isSourceFile(t.parent);let e=t.parent?.parent;return!!e&&y.isSourceFile(e.parent)}function Ja(t,e){if(!y.isStringLiteral(t))return;let r=t.text.match(/@[\w-]+/g);if(r)for(let s of r)e.tags.add({name:s.substring(1),kind:"comment-marker"})}function Ka(t,e){if(!y.isSourceFile(t))return;let r=/@tag\s+([a-zA-Z0-9_-]+)/g,s=t.getFullText(),n=r.exec(s);for(;n!==null;)n[1]&&e.tags.add({name:n[1],kind:"comment-marker"}),n=r.exec(s)}function Ha(t,e){if(y.isCallExpression(t)&&qa(t.expression))for(let r of t.arguments)y.isObjectLiteralExpression(r)&&Va(r,e)}function qa(t){return y.isIdentifier(t)?Ot.has(t.text):!!(y.isPropertyAccessExpression(t)&&(Ot.has(t.name.text)||y.isIdentifier(t.expression)&&Ot.has(t.expression.text)))}function Va(t,e){for(let r of t.properties){if(!y.isPropertyAssignment(r)||!y.isIdentifier(r.name)||r.name.text!=="tags"&&r.name.text!=="tag")continue;let{initializer:s}=r,n=y.isArrayLiteralExpression(s)?s.elements.filter(y.isStringLiteral):r.name.text==="tag"&&y.isStringLiteral(s)?[s]:[];for(let o of n)e.tags.add({name:o.text.replace(/^@/,""),kind:"comment-marker"})}}var Ot,As=l(()=>{"use strict";Ot=new Set(["test","describe","it"])});import Ls from"path";import f from"typescript";function jt(t,e,r){let s=[],n=new Map,o=new Set,i=f.createSourceFile(t,e,f.ScriptTarget.Latest,!0,r==="typescript"?f.ScriptKind.TSX:f.ScriptKind.JSX),a={filePath:t,imports:s,exports:n,tags:o,rawCallEdges:[],sourceFile:i,hasUI:!1,hasTypesOnly:!0,totalStatements:0,exportStatements:0},c=Q=>{Ya(Q,a),f.forEachChild(Q,c)};c(i);let p=lc(t,a);(p==="test"||p==="barrel")&&o.add({name:p,kind:"comment-marker"}),p!=="test"&&fc(a,i);let u=i.statements[0],m=u?Os(u):void 0,{complexity:h,cognitiveComplexity:x}=Gt(i),I=Qa(i);return{imports:s,exports:Array.from(n.values()),tags:Array.from(o),category:p,rawCallEdges:a.rawCallEdges??[],complexity:h,cognitiveComplexity:x,...I.length>0?{functions:I}:{},...m!==void 0?{description:m}:{}}}function Qa(t){let e=[],r=(n,o)=>{let{complexity:i,cognitiveComplexity:a}=Gt(o),c=t.getLineAndCharacterOfPosition(o.getStart(t)).line+1;e.push({name:n,line:c,complexity:i,cognitiveComplexity:a})},s=(n,o)=>{if(f.isFunctionDeclaration(n)&&n.name&&n.body?r(n.name.text,n):f.isVariableDeclaration(n)&&f.isIdentifier(n.name)&&n.initializer&&(f.isArrowFunction(n.initializer)||f.isFunctionExpression(n.initializer))?r(n.name.text,n.initializer):o&&f.isMethodDeclaration(n)&&f.isIdentifier(n.name)&&n.body?r(`${o}.${n.name.text}`,n):o&&f.isConstructorDeclaration(n)&&n.body?r(`${o}.constructor`,n):o&&f.isGetAccessorDeclaration(n)&&f.isIdentifier(n.name)&&n.body?r(`${o}.get ${n.name.text}`,n):o&&f.isSetAccessorDeclaration(n)&&f.isIdentifier(n.name)&&n.body&&r(`${o}.set ${n.name.text}`,n),f.isClassDeclaration(n)&&n.name){let i=n.name.text;f.forEachChild(n,a=>s(a,i));return}f.forEachChild(n,i=>s(i,o))};return s(t,void 0),e}function Gs(t,e,r,s){let n={name:t},o=Os(r);o!==void 0&&(n.doc=o);let i=Xa(e);i!==void 0&&(n.flags=i);let a=Za(e,s);return a!==void 0&&(n.signature=a),n}function Os(t){let e=f.getJSDocCommentsAndTags(t);for(let r of e)if(f.isJSDoc(r)&&r.comment)return f.getTextOfJSDocComment(r.comment)||void 0}function Xa(t){let e=new Set(["deprecated","internal","public","alpha","beta"]),r=f.getJSDocTags(t).map(s=>s.tagName.text).filter(s=>e.has(s));return r.length>0?r:void 0}function Za(t,e){let r=f.createPrinter({removeComments:!0}),s=n=>r.printNode(f.EmitHint.Unspecified,n,e);if(f.isFunctionDeclaration(t)||f.isMethodDeclaration(t)){let n=t.parameters.map(s).join(", "),o=t.type?s(t.type):"void";return`${t.typeParameters?`<${t.typeParameters.map(a=>a.name.text).join(", ")}>`:""}(${n}) => ${o}`}if(f.isVariableDeclaration(t)){if(t.type)return s(t.type);if(t.initializer&&(f.isArrowFunction(t.initializer)||f.isFunctionExpression(t.initializer))){let n=t.initializer,o=n.parameters.map(s).join(", "),i=n.type?s(n.type):"unknown";return`(${o}) => ${i}`}return}if(f.isClassDeclaration(t)&&t.name)return`class ${t.name.text}`;if(f.isInterfaceDeclaration(t))return`interface ${t.name.text}`;if(f.isTypeAliasDeclaration(t))return s(t.type);if(f.isEnumDeclaration(t))return`enum ${t.name.text}`}function Ya(t,e){ec(t,e),tc(t,e),sc(t,e),nc(t,e),pc(t,e),Rs(t,e)}function ec(t,e){if(!f.isSourceFile(t))return;let r=t.statements.filter(s=>!f.isEmptyStatement(s));e.totalStatements=r.length,e.exportStatements=r.filter(s=>f.isExportDeclaration(s)||f.isExportAssignment(s)||_t(s)).length}function tc(t,e){if(f.isJsxElement(t)||f.isJsxSelfClosingElement(t)||f.isJsxFragment(t)){e.hasUI=!0,e.hasTypesOnly=!1;return}if(f.isFunctionDeclaration(t)||f.isMethodDeclaration(t)||f.isArrowFunction(t)||f.isClassDeclaration(t)||f.isVariableStatement(t)||f.isEnumDeclaration(t)){e.hasTypesOnly=!1;return}f.isExportDeclaration(t)&&!rc(t)&&(e.hasTypesOnly=!1)}function rc(t){return t.isTypeOnly?!0:!t.exportClause||!f.isNamedExports(t.exportClause)?!1:t.exportClause.elements.every(e=>e.isTypeOnly)}function sc(t,e){if(!f.isImportDeclaration(t)||!t.moduleSpecifier||!f.isStringLiteral(t.moduleSpecifier))return;let r=[];if(t.importClause&&(t.importClause.name&&r.push("default"),t.importClause.namedBindings))if(f.isNamedImports(t.importClause.namedBindings))for(let n of t.importClause.namedBindings.elements)r.push(n.name.text);else f.isNamespaceImport(t.importClause.namedBindings)&&r.push("*");let s=r.length>0?"static":"side-effect";e.imports.push({fromPath:e.filePath,toPath:"",rawSpecifier:t.moduleSpecifier.text,isStyle:k(t.moduleSpecifier.text),type:s,symbols:r.length>0?r:void 0})}function nc(t,e){f.isExportDeclaration(t)?oc(t,e):f.isExportAssignment(t)?e.exports.set("default",{name:"default"}):_t(t)&&cc(t,e)}function oc(t,e){if(t.moduleSpecifier&&f.isStringLiteral(t.moduleSpecifier))ic(t,t.moduleSpecifier.text,e);else if(t.exportClause&&f.isNamedExports(t.exportClause))for(let r of t.exportClause.elements){let s=r.name.text;e.exports.set(s,{name:s})}}function ic(t,e,r){let s=ac(t),n={fromPath:r.filePath,toPath:"",rawSpecifier:e,isStyle:k(e),type:"re-export"};s.length>0&&(n.symbols=s),r.imports.push(n)}function ac(t){return t.exportClause?f.isNamedExports(t.exportClause)?t.exportClause.elements.map(e=>e.name.text):[]:["*"]}function cc(t,e){if((f.isFunctionDeclaration(t)||f.isClassDeclaration(t)||f.isInterfaceDeclaration(t)||f.isTypeAliasDeclaration(t)||f.isEnumDeclaration(t))&&t.name){let s=t.name.text;e.exports.set(s,Gs(s,t,t,e.sourceFile));return}if(f.isVariableStatement(t)){for(let s of t.declarationList.declarations)if(f.isIdentifier(s.name)){let n=s.name.text;e.exports.set(n,Gs(n,s,t,e.sourceFile))}}}function pc(t,e){if(!f.isCallExpression(t))return;let r=t.arguments[0];!r||!f.isStringLiteral(r)||(t.expression.kind===f.SyntaxKind.ImportKeyword?e.imports.push({fromPath:e.filePath,toPath:"",rawSpecifier:r.text,isStyle:k(r.text),type:"dynamic"}):f.isIdentifier(t.expression)&&t.expression.text==="require"&&e.imports.push({fromPath:e.filePath,toPath:"",rawSpecifier:r.text,isStyle:k(r.text),type:"require"}))}function lc(t,e){let r=Ls.basename(t).toLowerCase(),s=Ls.extname(t).toLowerCase();return X().some(o=>r.includes(o))?"test":nr(r)?"config":e.imports.some(o=>Ve().some(i=>o.rawSpecifier.includes(i)))?"test":s===".tsx"||s===".jsx"||e.hasUI?"ui":e.hasTypesOnly&&e.totalStatements>0?"type-only":e.totalStatements>0&&e.exportStatements/e.totalStatements>Xe()?"barrel":"logic"}function _t(t){return f.canHaveModifiers(t)&&f.getModifiers(t)?.some(e=>e.kind===f.SyntaxKind.ExportKeyword)===!0}function fc(t,e){let r=t.rawCallEdges??[];t.rawCallEdges=r;let s=new Map;for(let n of e.statements){if(!f.isImportDeclaration(n)||!f.isStringLiteral(n.moduleSpecifier))continue;let o=n.moduleSpecifier.text,i=n.importClause;if(i&&(i.name&&s.set(i.name.text,o),i.namedBindings&&f.isNamedImports(i.namedBindings)))for(let a of i.namedBindings.elements)s.set(a.name.text,o)}if(s.size!==0)for(let n of e.statements){let o=mc(n);if(o){let i=gc(n);i&&_e(i,o,s,r);continue}f.isClassDeclaration(n)&&n.name&&uc(n,s,r)}}function uc(t,e,r){let s=t.name.text;for(let n of t.members)f.isMethodDeclaration(n)&&n.body&&f.isIdentifier(n.name)?_e(n.body,`${s}.${n.name.text}`,e,r):f.isConstructorDeclaration(n)&&n.body&&_e(n.body,`${s}.constructor`,e,r)}function mc(t){if(_t(t)){if(f.isFunctionDeclaration(t)&&t.name)return t.name.text;if(f.isVariableStatement(t)){for(let e of t.declarationList.declarations)if(f.isIdentifier(e.name)&&e.initializer&&(f.isArrowFunction(e.initializer)||f.isFunctionExpression(e.initializer)))return e.name.text}}}function gc(t){if(f.isFunctionDeclaration(t))return t.body;if(f.isVariableStatement(t)){for(let e of t.declarationList.declarations)if(e.initializer&&(f.isArrowFunction(e.initializer)||f.isFunctionExpression(e.initializer)))return e.initializer}}function _e(t,e,r,s){if(f.isCallExpression(t)&&f.isIdentifier(t.expression)){let n=t.expression.text,o=r.get(n);o&&!s.some(i=>i.from===e&&i.to===n&&i.toSpecifier===o)&&s.push({from:e,to:n,toSpecifier:o})}f.forEachChild(t,n=>_e(n,e,r,s))}var js=l(()=>{"use strict";G();Ds();D();As()});function We(t,e){if(e.length===0)return"ui";let r=!1;return t.walk(s=>{if(s.type==="rule")return r=!0,!1}),r?"ui":"barrel"}var _s=l(()=>{"use strict"});import zs from"postcss";import*as dc from"postcss-less";function Ws(t){return t.startsWith("~")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("data:")}function yc(t){let e=t.trim();return e.length>0&&!e.startsWith("http://")&&!e.startsWith("https://")&&!e.startsWith("//")&&!e.startsWith("data:")&&!e.startsWith("#")}function xc(t,e){let r=t.match(/^\(([^)]+)\)\s+['"]([^'"]+)['"]/);if(r){let o=r[1]?.trim()??"",i=r[2]??"";if(!i)return null;let a=$s.has(o)?"side-effect":"static";return{fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:a,...Ws(i)?{isExternal:!0}:{}}}let s=t.match(/^url\(['"]?([^'")]+)['"]?\)/),n=s?s[1]?.trim()??"":t.match(/^['"]([^'"]+)['"]/)?.[1]??"";return n?{fromPath:e,toPath:"",rawSpecifier:n,isStyle:!0,type:"static",...Ws(n)?{isExternal:!0}:{}}:null}function Sc(t,e){let r=[],s=/url\(['"]?([^'")]+)['"]?\)/g,n=s.exec(t);for(;n!==null;){let o=n[1]?.trim()??"";yc(o)&&r.push({fromPath:e,toPath:"",rawSpecifier:o,isStyle:!0,type:"static"}),n=s.exec(t)}return r}function Us(t,e){let r=[];return t.walk(s=>{if(s.type==="atrule"&&s.name==="import"){let n=xc(s.params,e);n&&r.push(n)}s.type==="decl"&&r.push(...Sc(s.value,e))}),r}function bc(t){return t.replace(/(?<!:)\/\/.*/g,"")}function vc(t,e){let r=[],s=/@import\s+(?:\(([^)]+)\)\s+)?['"]([^'"]+)['"]/g,n=s.exec(t);for(;n!==null;){let o=n[1]?.trim()??"",i=n[2]??"";if(i){let a=$s.has(o)?"side-effect":"static";r.push({fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:a})}n=s.exec(t)}return r}function Bs(t,e){let r=zs.parse(bc(t));return{imports:Us(r,e),root:r}}function Js(t,e){try{let r=hc.parse(t);return{imports:Us(r,e),root:r}}catch{return{imports:vc(t,e),root:zs.parse("")}}}var hc,$s,Ks=l(()=>{"use strict";hc=dc,$s=new Set(["reference","inline"])});import{parse as Cc}from"postcss-scss";function Ec(t){return!!(t.startsWith("sass:")||t.startsWith("~")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||!t.startsWith(".")&&!t.startsWith("/")&&!t.startsWith("_"))}function kc(t){let e=t.match(/^['"]([^'"]+)['"]/);if(!e?.[1])return{specifier:""};let r=e[1],n=t.match(/\bas\s+(\S+)/)?.[1];return n!==void 0?{specifier:r,alias:n}:{specifier:r}}function Hs(t,e){let r=Cc(t),s=[];return r.walk(n=>{if(n.type!=="atrule")return;let{name:o,params:i}=n;if(o!=="import"&&o!=="use"&&o!=="forward")return;let{specifier:a,alias:c}=kc(i);if(!a)return;let p={fromPath:e,toPath:"",rawSpecifier:a,isStyle:!0,type:o==="forward"?"re-export":"static",...Ec(a)?{isExternal:!0}:{}};c&&(p.symbols=[c]),s.push(p)}),{imports:s,root:r}}var qs=l(()=>{"use strict"});function Vs(t,e){let r=[],s=/@require\s+['"]([^'"]+)['"]/g,n=s.exec(t);for(;n!==null;){let i=n[1];i&&r.push({fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:"require"}),n=s.exec(t)}let o=/(?<!@)(?:import|require)\s*\(?\s*['"]([^'"]+)['"]/g;for(n=o.exec(t);n!==null;){let i=n[1];i&&r.push({fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:"static"}),n=o.exec(t)}return r}function Qs(t,e){if(e.length===0)return"ui";try{let r=qe("stylus");return new r.Parser(t).parse().nodes.some(o=>o.constructor.name!=="Import")?"ui":"barrel"}catch{return t.replace(/^\s*@?(?:require|import)\b.*/gm,"").trim().length>0?"ui":"barrel"}}var Xs=l(()=>{"use strict"});function ie(t,e){let r=M(t);if(r==="stylus"){let o=Vs(e,t);return{imports:o,exports:[],tags:[],category:Qs(e,o)}}if(r==="scss"){let{imports:o,root:i}=Hs(e,t);return{imports:o,exports:[],tags:[],category:We(i,o)}}if(r==="less"){let{imports:o,root:i}=Js(e,t);return{imports:o,exports:[],tags:[],category:We(i,o)}}let{imports:s,root:n}=Bs(e,t);return{imports:s,exports:[],tags:[],category:We(n,s)}}var Zs=l(()=>{"use strict";D();_s();Ks();qs();Xs()});async function Ys(t,e){let r=M(t),s=Or(r);return s?s(t,e):{imports:[],exports:[],tags:[],category:"other"}}var en=l(()=>{"use strict";D();vs();Cs();Fs();Ts();Is();Ms();js();ne();Zs();G();D();ne();for(let[t,e]of[["javascript",(r,s)=>jt(r,s,"javascript")],["typescript",(r,s)=>jt(r,s,"typescript")],["css",ie],["scss",ie],["less",ie],["stylus",ie],["coffeescript",bs],["livescript",ws],["lua",Ps],["python",Ns],["go",ks],["gherkin",Rt]])W(t,e)});import Wt from"path";function rn(t,e){for(let r of t.values()){let s=e.get(r.path);s!==void 0&&(r.coveragePct=s)}}function sn(t,e){for(let r of t)if(!r.rawSpecifier.startsWith(".")&&!Wt.isAbsolute(r.rawSpecifier)){let s=r.rawSpecifier.startsWith("@")?r.rawSpecifier.split("/").slice(0,2).join("/"):r.rawSpecifier.split("/")[0];s&&!e.some(n=>n.name===s)&&e.push({name:s,kind:"library"})}}function nn(t){for(let e of t.values())if(e.category==="test")for(let r of e.imports){if(r.isExternal||!r.toPath)continue;let s=t.get(r.toPath);s&&(s.category!=="logic"&&s.category!=="barrel"||(s.testedBy??=[],s.testedBy.includes(e.path)||s.testedBy.push(e.path)))}}function tn(t){return Math.round(t*1e4)/1e4}function on(t){for(let e of t.values()){let r=[];for(let s of e.imports){if(s.isExternal||!s.toPath)continue;let n=t.get(s.toPath);if(!n||n.exports.length===0)continue;let o;if(s.symbols===void 0){if(s.type==="side-effect")continue;o=1}else s.symbols.includes("*")?o=1:o=s.symbols.length/n.exports.length;s.exportUsageRatio=tn(Math.min(1,o)),r.push(s.exportUsageRatio)}r.length>0&&(e.avgExportUsage=tn(r.reduce((s,n)=>s+n,0)/r.length),e.maxExportUsage=Math.max(...r))}}function zt(t,e,r){e&&(t.some(s=>s.name===e&&s.kind===r)||t.push({name:e,kind:r}))}function Fc(t,e){let r=e.toPath,s=Wt.basename(r,Wt.extname(r)).replace(/\.(test|spec)$/,"");zt(t.tags,s,"import")}function wc(t,e){if(!(!e.symbols||e.symbols.includes("*")))for(let r of e.symbols)zt(t.tags,r,"import")}function Tc(t,e,r){let s=r.get(e.toPath);if(!(!s||s.category==="test"))for(let n of s.tags)n.kind==="comment-marker"&&zt(t.tags,n.name,"comment-marker")}function an(t){for(let e of t.values())if(e.category==="test")for(let r of e.imports)!r.toPath||r.isExternal||(Fc(e,r),wc(e,r),Tc(e,r,t))}var cn=l(()=>{"use strict"});import fn from"fs";import V from"path";function Pc(t,e){let r=t.split(`
|
|
23
|
+
`),s=null,n=new Map,o=!1;for(let i of r){let a=i.trim();if(a.startsWith("module ")){s=a.slice(7).trim();continue}if(/^replace\s*\(/.test(a)){o=!0;continue}if(o&&a===")"){o=!1;continue}if(o&&a.includes("=>")){pn(a,e,n);continue}!o&&/^replace\s+/.test(a)&&a.includes("=>")&&pn(a.replace(/^replace\s+/,""),e,n)}return{mod:s,replaces:n}}function pn(t,e,r){let[s,n]=t.split("=>").map(a=>a.trim());if(!s||!n)return;let o=s.split(/\s+/)[0];if(!n.startsWith(".")&&!n.startsWith("/"))return;let i=V.isAbsolute(n)?n:V.resolve(e,n);r.set(o,i)}function ln(t){let e;try{e=fn.readdirSync(t,{withFileTypes:!0})}catch{return null}let r=e.filter(s=>s.isFile()&&s.name.endsWith(".go")&&!s.name.endsWith("_test.go")).map(s=>({path:V.join(t,s.name),isExternal:!1})).sort((s,n)=>s.path.localeCompare(n.path));return r.length>0?r:null}var ae,un=l(()=>{"use strict";ae=class{extensions=[".go"];goModCache=new Map;resolve(e,r,s,n){let{mod:o,replaces:i}=this.readGoMod(s);if(!o)return null;let a=this.applyReplace(r,i,s);if(a!==void 0)return ln(a);if(r!==o&&!r.startsWith(`${o}/`))return null;let c=r.slice(o.length).replace(/^\//,"");return c?ln(V.join(s,c)):null}readGoMod(e){let r=this.goModCache.get(e);if(r!==void 0)return r;let s={mod:null,replaces:new Map};try{let n=fn.readFileSync(V.join(e,"go.mod"),"utf-8"),o=Pc(n,e);return this.goModCache.set(e,o),o}catch{return this.goModCache.set(e,s),s}}applyReplace(e,r,s){for(let[n,o]of r){if(e===n)return o;if(e.startsWith(`${n}/`)){let i=e.slice(n.length+1);return V.join(o,i)}}}}});import Ic from"fs";import $t from"path";var ce,mn=l(()=>{"use strict";ce=class{extensions=[".lua"];resolve(e,r,s,n){let o=r.replace(/\./g,$t.sep),i=[s,$t.join(s,"lib")];for(let a of i){if(!Ic.existsSync(a))continue;let c=n($t.join(a,"_dummy.lua"),o);if(c)return[c]}return null}}});import Nc from"fs";import Ut from"path";function gn(t){try{return Nc.statSync(t,{throwIfNoEntry:!1})?.isFile()===!0}catch{return!1}}var pe,dn=l(()=>{"use strict";pe=class{extensions=[".py"];resolve(e,r,s,n){let o=r.replace(/\./g,Ut.sep),i=Ut.join(s,`${o}.py`);if(gn(i))return[{path:i,isExternal:!1}];let a=Ut.join(s,o,"__init__.py");return gn(a)?[{path:a,isExternal:!1}]:null}}});import hn from"path";var Mc,le,yn=l(()=>{"use strict";Mc=["~","http://","https://","//","data:","sass:"],le=class{extensions=[".css",".scss",".sass",".less",".styl"];resolve(e,r,s,n){if(Mc.some(u=>r.startsWith(u)))return null;let o=n(e,r);if(o)return[o];let i=hn.dirname(r),a=hn.basename(r),c=i==="."?`_${a}`:`${i}/_${a}`,p=n(e,c);return p?[p]:null}}});var xn=l(()=>{"use strict";un();mn();dn();yn()});import ze from"fs";import R from"path";var fe,Bt=l(()=>{"use strict";xn();fe=class{constructor(e,r={}){this.rootDir=e;this.workspaceMap=r.workspaceMap??new Map,this.tsconfigSearchPaths=r.tsconfigSearchPaths??[e],this.langResolvers=r.langResolvers??[new pe,new ce,new ae,new le]}rootDir;workspaceMap;tsconfigSearchPaths;langResolvers;resolveAll(e,r){let s=this.resolvePathAlias(r);if(s)return[s];if(r.startsWith(".")||r.startsWith("/")){let i=this.resolveLocalPath(e,r);return i?[i]:[]}let n=(i,a)=>this.resolveLocalPath(i,a);for(let i of this.langResolvers)if(i.extensions.some(a=>e.endsWith(a))){let a=i.resolve(e,r,this.rootDir,n);if(a)return a}let o=this.resolveWorkspaceImport(r);return o?[o]:[{path:r,isExternal:!0}]}resolve(e,r){let s=this.resolvePathAlias(r);if(s)return s;if(r.startsWith(".")||r.startsWith("/"))return this.resolveLocalPath(e,r);let n=(i,a)=>this.resolveLocalPath(i,a);for(let i of this.langResolvers)if(i.extensions.some(a=>e.endsWith(a))){let a=i.resolve(e,r,this.rootDir,n);if(a)return a[0]??null}let o=this.resolveWorkspaceImport(r);return o||{path:r,isExternal:!0}}resolveLocalPath(e,r){let s=R.dirname(e),n=r.startsWith("/")?r:R.resolve(s,r),o=!n.startsWith(this.rootDir),i=["",".ts",".tsx",".js",".jsx",".mjs",".cjs",".css",".scss",".sass",".less",".styl",".coffee",".ls",".lua",".py",".feature"],a=n.match(/\.(js|mjs|cjs)$/);if(a){let c=n.slice(0,-a[0].length);for(let p of[".ts",".tsx"]){let u=this.tryExtensions(c,p,o);if(u)return u}}for(let c of i){let p=this.tryExtensions(n,c,o);if(p)return p}return o?{path:n,isExternal:!0}:null}tryExtensions(e,r,s){let n=e+r;if(this.isFile(n))return{path:n,isExternal:s};let o=R.join(e,`index${r}`);if(this.isFile(o))return{path:o,isExternal:s};if(r===".py"){let i=R.join(e,"__init__.py");if(this.isFile(i))return{path:i,isExternal:s}}return null}isFile(e){try{return ze.statSync(e,{throwIfNoEntry:!1})?.isFile()===!0}catch{return!1}}resolvePathAlias(e){for(let r of this.tsconfigSearchPaths){let s=R.join(r,"tsconfig.json");if(ze.existsSync(s))try{let o=JSON.parse(ze.readFileSync(s,"utf-8")).compilerOptions?.paths;if(!o)continue;for(let i in o){let a=this.matchAliasPattern(i,e);if(a){let c=this.tryAliasSubstitutions(o[i],a[1]||"",r);if(c)return c}}}catch{}}return null}aliasRegexCache=new Map;matchAliasPattern(e,r){let s=this.aliasRegexCache.get(e);if(!s){let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace("\\*","(.*)");s=new RegExp(`^${n}$`),this.aliasRegexCache.set(e,s)}return r.match(s)}tryAliasSubstitutions(e,r,s=this.rootDir){let n=["",".ts",".tsx",".js",".jsx",".coffee",".ls",".lua",".feature"];for(let o of e){let i=o.replace("*",r),a=R.resolve(s,i);for(let c of n){let p=this.tryExtensions(a,c,!1);if(p)return p}}return null}resolveWorkspaceImport(e){if(this.workspaceMap.size===0)return null;for(let[r,s]of this.workspaceMap){if(e!==r&&!e.startsWith(`${r}/`))continue;let n=e.slice(r.length),o={path:"",isExternal:!1,isWorkspace:!0,workspacePackage:r};if(!n){for(let a of["src/index.ts","src/index.tsx","index.ts","index.tsx","index.js"]){let c=R.join(s,a);try{if(ze.statSync(c,{throwIfNoEntry:!1})?.isFile())return{...o,path:c}}catch{}}return{...o,path:s}}let i=this.resolveLocalPath(R.join(s,"_dummy"),n.slice(1));return i?{...o,path:i.path}:null}return null}}});import $e from"fs";import C from"path";function Rc(t,e){if(t.length===0)return e;let r=t.map(i=>C.dirname(i).split(C.sep)),s=r[0];for(let i of r.slice(1)){let a=0;for(;a<s.length&&a<i.length&&s[a]===i[a];)a++;s=s.slice(0,a)}let n=s.join(C.sep)||C.sep,o=C.relative(e,n);return o.startsWith("..")||C.isAbsolute(o)?e:n}var Dc,Ue,Sn=l(()=>{"use strict";Mt();G();xs();en();cn();ee();Bt();Dc=["tests","test","__tests__","specs","spec"];Ue=class{constructor(e,r=null,s,n,o=!1,i=new Map){this.rootDir=e;this.enableGitStats=o;this.coverageMap=i;this.previousGraph=r,this.resolver=s||new fe(e),this.lockFile=ys(e),n&&(this.progressCallback=n)}rootDir;enableGitStats;coverageMap;graph={nodes:new Map};visited=new Set;previousGraph=null;resolver;lockFile=null;progressCallback;async build(e){let r=e.map(s=>C.isAbsolute(s)?s:C.resolve(this.rootDir,s));for(let s of r)await this.processFile(s);return await this.processTestFiles(Rc(r,this.rootDir)),this.progressCallback&&this.visited.size>=100&&process.stderr.write(`
|
|
24
24
|
Done. Total processed: ${this.visited.size} nodes.
|
|
25
|
-
`),
|
|
25
|
+
`),an(this.graph.nodes),nn(this.graph.nodes),on(this.graph.nodes),this.coverageMap.size>0&&rn(this.graph.nodes,this.coverageMap),new F(this.graph.nodes)}async processTestFiles(e){let r=X(),s=new Set(["node_modules",".git","dist","build",".next",".cache","mokosh-cache","coverage"]),n=async i=>{let a;try{a=$e.readdirSync(i,{withFileTypes:!0})}catch{return}for(let c of a){let p=C.join(i,c.name);c.isDirectory()?s.has(c.name)||await n(p):c.isFile()&&r.some(u=>c.name.includes(u))&&await this.processFile(p)}};await n(e);let o=e;for(;o!==this.rootDir;){let i=C.dirname(o);if(i===o)break;for(let a of Dc){let c=C.join(i,a);try{$e.statSync(c).isDirectory()&&await n(c)}catch{}}o=i}}async processFile(e){if(this.visited.has(e))return;this.visited.add(e),this.showProgress();let r=$e.statSync(e,{throwIfNoEntry:!1});if(!r?.isFile())return;let s=C.relative(this.rootDir,e),n=await this.getNode(e,s,r);n.imports=await this.resolveImports(e,n.imports),this.graph.nodes.set(n.path,n)}async getNode(e,r,s){let n=this.previousGraph?.nodes.get(r);if(n&&n.mtime===s.mtimeMs&&n.size===s.size)return{...n};let o=await this.tryParse(e,r);if(!o)return this.makeStubNode(e,r,s);sn(o.imports,o.tags);let i=this.resolveCallEdges(e,o.rawCallEdges),a=this.buildNode(e,r,s,o,i);return this.attachGitStats(a,r),a}async tryParse(e,r){let s=$e.readFileSync(e,"utf-8");try{return await Ys(e,s)}catch(n){return process.stderr.write(`
|
|
26
26
|
Warning: failed to parse ${r}: ${n}
|
|
27
|
-
`),null}}makeStubNode(e,r,s){return{path:r,type:M(e),category:"other",imports:[],exports:[],tags:[],mtime:s.mtimeMs,size:s.size}}resolveCallEdges(e,r){let s=[];for(let n of r??[])try{let o=this.resolver.resolve(e,n.toSpecifier);o&&!o.isExternal&&s.push({from:n.from,to:n.to,toFile:C.relative(this.rootDir,o.path)})}catch{}return s}buildNode(e,r,s,n,o){let{imports:i,exports:a,tags:c,category:p,description:u,complexity:m,cognitiveComplexity:h,functions:x}=n;return{path:r,type:M(e),category:p,imports:i,exports:a,tags:c,mtime:s.mtimeMs,size:s.size,...u!==void 0?{description:u}:{},...o.length>0?{callEdges:o}:{},...m!==void 0?{complexity:m}:{},...h!==void 0?{cognitiveComplexity:h}:{},...x!==void 0?{functions:x}:{}}}attachGitStats(e,r){if(this.enableGitStats)try{let s=
|
|
28
|
-
`))}var
|
|
29
|
-
`):JSON.stringify({file:r,callers:n,count:n.length},null,2))}var
|
|
27
|
+
`),null}}makeStubNode(e,r,s){return{path:r,type:M(e),category:"other",imports:[],exports:[],tags:[],mtime:s.mtimeMs,size:s.size}}resolveCallEdges(e,r){let s=[];for(let n of r??[])try{let o=this.resolver.resolve(e,n.toSpecifier);o&&!o.isExternal&&s.push({from:n.from,to:n.to,toFile:C.relative(this.rootDir,o.path)})}catch{}return s}buildNode(e,r,s,n,o){let{imports:i,exports:a,tags:c,category:p,description:u,complexity:m,cognitiveComplexity:h,functions:x}=n;return{path:r,type:M(e),category:p,imports:i,exports:a,tags:c,mtime:s.mtimeMs,size:s.size,...u!==void 0?{description:u}:{},...o.length>0?{callEdges:o}:{},...m!==void 0?{complexity:m}:{},...h!==void 0?{cognitiveComplexity:h}:{},...x!==void 0?{functions:x}:{}}}attachGitStats(e,r){if(this.enableGitStats)try{let s=gs(this.rootDir,r);e.commitCount90d=s.commitCount90d,s.lastAuthor!==void 0&&(e.lastAuthor=s.lastAuthor)}catch{}}async resolveImports(e,r){let s=[];for(let n of r){let o=this.resolver.resolveAll(e,n.rawSpecifier);if(o.length!==0)for(let i of o){let a={...n,toPath:i.isExternal?i.path:C.relative(this.rootDir,i.path),isExternal:i.isExternal};i.isWorkspace&&(a.isWorkspace=!0,a.workspacePackage=i.workspacePackage),i.isExternal?this.attachLockfileVersion(a):await this.processFile(i.path),s.push(a)}}return s}attachLockfileVersion(e){if(!this.lockFile)return;let r=e.rawSpecifier.startsWith("@")?e.rawSpecifier.split("/").slice(0,2).join("/"):e.rawSpecifier.split("/")[0],s=r?this.lockFile.dependencies[r]:void 0;s&&(e.version=s.version)}showProgress(){this.progressCallback&&this.visited.size%100===0&&this.progressCallback(this.visited.size)}}});var bn=l(()=>{"use strict";at();Sn();pt();lt();be();ve();ee();Bt();ut();mt();ht();bt();vt()});var Jt=l(()=>{"use strict";bn()});function vn(t,e){return{identifier:e?.identifier??new Ge,featureMap:e?.featureDetection===!1?new Map:A(t.nodes,e?.featureDetection??void 0)}}function Cn(t,e,r,s,n){for(let o of e){let i=t.nodes.get(o);if(!i)continue;let a=new re(o,["*",...i.exports.map(c=>c.name)]);t.traverse(o,(c,p,u)=>{if(!u)return!0;if(!a.updateAffectedSymbols(c,u))return!1;if(p>0){let m=r.get(c.path);if(m)return s(m),!1}return n(c),!0},{direction:"incoming"})}}function Kt(t,e,r){let{identifier:s,featureMap:n}=vn(t,r),o=new Set;for(let i of e){let a=n.get(i);a&&o.add(a.tag)}return Cn(t,e,n,i=>o.add(i.tag),i=>{if(s.isTestNode(i))for(let a of i.tags)o.add(a.name)}),Array.from(o)}function Ht(t,e,r){let{identifier:s,featureMap:n}=vn(t,r),o=new Set;return Cn(t,e,n,()=>{},i=>{s.isTestNode(i)&&o.add(i.path)}),Array.from(o)}var En=l(()=>{"use strict";Jt();Nt()});var kn=l(()=>{"use strict";us();Nt();En()});import Gc from"fs";import Be from"path";async function w(t,e,r=null,s={}){let n=s.silent?void 0:i=>{process.stderr.write(`Processed ${i} files...\r`)};return await new Ue(Be.resolve(t),r,void 0,n,s.gitStats??!1,s.coverageMap??new Map).build(e)}function T(t,e={}){let r=[],s=new Set([...e.ignoreDirs??tt,...e.additionalIgnoreDirs??[]]),n=new Set([...e.extensions??rt,...e.additionalExtensions??[]]);function o(i){try{let a=Gc.readdirSync(i,{withFileTypes:!0});for(let c of a){let p=Be.join(i,c.name);c.isDirectory()?s.has(c.name)||o(p):c.isFile()&&n.has(Be.extname(c.name).toLowerCase())&&r.push(Be.relative(t,p))}}catch{}}return o(t),r}var v=l(()=>{"use strict";et();st();fr();mr();at();pt();lt();be();ve();ee();ut();mt();ht();bt();Fe();vt();G();ne();Br();kn();st();Jt()});var Fn,wn,Tn=l(()=>{"use strict";Fn="mokosh-cache",wn="graph.json"});import ue from"path";import{parseArgs as Oc}from"util";function jc(t){for(let e=0;e<t.length;e++)if(t[e]==="--root"&&t[e+1])return ue.resolve(t[e+1]);return process.cwd()}function Wc(t){let e=[];for(let r=0;r<t.length;r++){let s=t[r];if(!s.startsWith("--"))e.push(s);else if(_c.has(s)){let n=t[r+1];n!==void 0&&!n.startsWith("--")&&(e.push(s,n),r++)}else s.slice(2)in qt&&e.push(s)}return e}function Pn(t){let e=jc(t),r=ue.join(ue.resolve(e,Fn),wn),{values:s,positionals:n}=Oc({args:Wc(t),allowPositionals:!0,options:qt}),o=s["feature-threshold"],i=s["min-out-degree"],a=s.paths,c=s.cache,p=s.config;return{rootDir:e,cachePath:c?ue.resolve(e,c):r,configPath:p?ue.resolve(e,p):void 0,query:s.query,file:s.file,typeFilter:s.type,functionName:s.function,filterPaths:a?a.split(",").map(u=>u.trim()):void 0,featureThreshold:o?parseInt(o,10):void 0,minOutDegree:i?parseInt(i,10):void 0,mermaid:s.mermaid??!1,proposeTags:s["propose-tags"]??!1,plain:s.plain??!1,affectedTests:s["affected-tests"]??!1,detectFeatures:s["detect-features"]??!1,findUnused:s["find-unused"]??!1,excludeTests:s["exclude-tests"]??!1,checkCycles:s["check-cycles"]??!1,findUncovered:s["find-uncovered"]??!1,callers:s.callers??!1,silent:s.silent??!1,queryHelp:s["query-help"]??!1,help:t.length===0||(s.help??!1),typeGraph:s["type-graph"]??!1,moduleResponsibility:s["module-responsibility"]??!1,featureGraph:s["feature-graph"]??!1,callGraph:s["call-graph"]??!1,apiSurface:s["api-surface"]??!1,applyTags:s["apply-tags"]??!1,dryRun:s["dry-run"]??!1,entryPoints:n}}var qt,_c,In=l(()=>{"use strict";Tn();qt={root:{type:"string"},cache:{type:"string"},config:{type:"string"},query:{type:"string"},file:{type:"string"},type:{type:"string"},paths:{type:"string"},function:{type:"string"},"feature-threshold":{type:"string"},"min-out-degree":{type:"string"},mermaid:{type:"boolean"},"propose-tags":{type:"boolean"},plain:{type:"boolean"},"affected-tests":{type:"boolean"},"detect-features":{type:"boolean"},"find-unused":{type:"boolean"},"exclude-tests":{type:"boolean"},"check-cycles":{type:"boolean"},"find-uncovered":{type:"boolean"},callers:{type:"boolean"},silent:{type:"boolean"},"query-help":{type:"boolean"},help:{type:"boolean"},"type-graph":{type:"boolean"},"module-responsibility":{type:"boolean"},"feature-graph":{type:"boolean"},"call-graph":{type:"boolean"},"api-surface":{type:"boolean"},"apply-tags":{type:"boolean"},"dry-run":{type:"boolean"}},_c=new Set(Object.entries(qt).filter(([,t])=>t.type==="string").map(([t])=>`--${t}`))});import Vt from"path";function L(t){return t.filter(e=>{let r=Vt.basename(e).toLowerCase();return zc.some(s=>r.includes(s))})}function Je(t){return new Oe().getChangedFiles().map(e=>Vt.relative(t,Vt.resolve(t,e)))}var zc,Ke=l(()=>{"use strict";Mt();zc=[".test.",".spec.","-test.","-spec."]});async function Nn(t){let{graph:e}=t,{rootDir:r,scanOptions:s,featureThreshold:n}=t,o=Je(r);if(![...e.nodes.values()].some(c=>L([c.path]).length>0)){let c=T(r,s);e=await w(r,L(c),e)}let a=Ht(e,o,{...n!==void 0&&{featureDetection:{minOutDegree:n}}});console.log(a.join(`
|
|
28
|
+
`))}var Mn=l(()=>{"use strict";v();Ke()});async function Dn(t){let{graph:e,rootDir:r,entryPoints:s}=t,n=s.length?s:ot(e,r);n.length===0&&(console.error("Error: No entry points found. Pass entry points as positional args or ensure package.json has a main/exports field."),process.exit(1));let o=it(e,n);console.log(JSON.stringify(o,null,2))}var Rn=l(()=>{"use strict";v()});async function An(t){let{graph:e}=t,{rootDir:r,scanOptions:s,dryRun:n,plain:o}=t;if(o||console.log(n?"Dry run: computing tag changes...":"Applying tags to test files..."),e.nodes.size===0){let a=T(r,s);e=await w(r,L(a),e)}let i=await It(e,r,{dryRun:n});console.log(JSON.stringify(i,null,2))}var Ln=l(()=>{"use strict";v();Ke()});async function Gn(t){let{graph:e,functionName:r}=t;r||(console.error("Error: --call-graph requires --function <name>"),process.exit(1));let s=ct(e,r);console.log(JSON.stringify(s,null,2))}var On=l(()=>{"use strict";v()});async function jn(t){let{graph:e,file:r,plain:s}=t;r||(console.error("Error: --callers requires --file <path>"),process.exit(1));let n=e.getCallers(r);console.log(s?n.join(`
|
|
29
|
+
`):JSON.stringify({file:r,callers:n,count:n.length},null,2))}var _n=l(()=>{"use strict"});async function Wn(t){let{graph:e}=t,r=e.findCycles();if(r.length>0){process.stderr.write(`Found ${r.length} cycle(s):
|
|
30
30
|
`);for(let s of r)process.stderr.write(` ${s.join(" \u2192 ")}
|
|
31
|
-
`);process.exit(1)}console.log("No cycles detected.")}var
|
|
32
|
-
`):JSON.stringify({threshold:o,uncovered:i,count:i.length},null,2))}var
|
|
31
|
+
`);process.exit(1)}console.log("No cycles detected.")}var zn=l(()=>{"use strict"});async function $n(t){let{graph:e}=t,{rootDir:r,scanOptions:s,featureThreshold:n}=t;if(e.nodes.size===0){let a=T(r,s);e=await w(r,a,e)}let o=A(e.nodes,n!==void 0?{minOutDegree:n}:void 0),i=Array.from(o.values()).sort((a,c)=>c.outDegree-a.outDegree);console.log(JSON.stringify({features:i},null,2))}var Un=l(()=>{"use strict";v()});async function Bn(t){let{graph:e}=t,{rootDir:r,scanOptions:s,minOutDegree:n}=t;if(e.nodes.size===0){let a=T(r,s);e=await w(r,a,e)}let o=Z(e,n!==void 0?{minOutDegree:n}:void 0),i=Object.fromEntries(o.features);console.log(JSON.stringify({features:i,unassigned:o.unassigned},null,2))}var Jn=l(()=>{"use strict";v()});async function Kn(t){let{graph:e,featureThreshold:r,rawConfig:s,plain:n}=t,o=r??s.coverageThreshold??80,i=[...e.nodes.values()].filter(a=>a.category!=="test"&&a.category!=="config").filter(a=>(a.coveragePct??0)<o).map(a=>({file:a.path,coveragePct:a.coveragePct??null}));console.log(n?i.map(a=>a.file).join(`
|
|
32
|
+
`):JSON.stringify({threshold:o,uncovered:i,count:i.length},null,2))}var Hn=l(()=>{"use strict"});import $c from"path";function Bc(t){let e=$c.basename(t).toLowerCase();return Uc.some(r=>e.includes(r))}async function qn(t){let{graph:e,rootDir:r,scanOptions:s,excludeTests:n}=t,o=T(r,s),i=e.findUnusedFiles(o);n&&(i=i.filter(a=>!Bc(a))),console.log(JSON.stringify({unusedFiles:i},null,2))}var Uc,Vn=l(()=>{"use strict";v();Uc=[".test.",".spec.","-test.","-spec.",".stories."]});async function Qn(t){let{graph:e,queryStr:r,mermaidOutput:s}=t,n=e.serialize();if(r){let o=Te(r);n=we(n,o)}if(s){let o=F.deserialize(n);console.log(xe.serialize(o))}else{let o=e.findCycles();o.length>0&&(n.cycles=o),console.log(JSON.stringify(n,null,2))}}var Xn=l(()=>{"use strict";v()});async function Zn(t){let{graph:e,filterPaths:r,minOutDegree:s}=t,n=ft(e,s!==void 0?{minOutDegree:s}:void 0);if(r?.length){let o=r.map(i=>n.get(i)).filter(Boolean);console.log(JSON.stringify({count:o.length,modules:o},null,2))}else{let o=Array.from(n.values());console.log(JSON.stringify({count:o.length,modules:o},null,2))}}var Yn=l(()=>{"use strict";v()});async function eo(t){let{graph:e}=t,{rootDir:r,scanOptions:s,featureThreshold:n,plain:o}=t;o||console.log("Proposing test tags based on git diff...");let i=Je(r);if(e.nodes.size===0){let c=T(r,s);e=await w(r,L(c),e)}let a=Kt(e,i,{...n!==void 0&&{featureDetection:{minOutDegree:n}}});console.log(o?a.join(" "):JSON.stringify({proposedTags:a},null,2))}var to=l(()=>{"use strict";v();Ke()});async function ro(t){let{graph:e,typeFilter:r}=t,s=gt(e);if(r){let n=dt(s,r);console.log(JSON.stringify(n,null,2))}else{let n=Array.from(s.types.values());console.log(JSON.stringify({count:n.length,types:n},null,2))}}var so=l(()=>{"use strict";v()});import Qt from"path";function no(t){let{rootDir:e,entryPoints:r,cachePath:s,configPath:n}=t,o=n?O(n,{isExplicitPath:!0}):O(e),i=Qt.join(Qt.resolve(e,"mokosh-cache"),"graph.json"),a=r.length>0?r:o.entryPoints??[],c=s!==i?s??i:o.cachePath?Qt.resolve(e,o.cachePath):s??i,p={...o.ignoreDirs!==void 0&&{additionalIgnoreDirs:o.ignoreDirs},...o.extensions!==void 0&&{additionalExtensions:o.extensions}};return{rootDir:e,resolvedEntryPoints:a,resolvedCachePath:c,scanOptions:p,rawConfig:o}}var oo=l(()=>{"use strict";v()});import me from"fs";import Jc from"path";function io(t){if(!me.existsSync(t))return null;let e=me.readFileSync(t,"utf-8");return F.deserialize(JSON.parse(e))}function ao(t,e){let r=Jc.dirname(e);me.existsSync(r)||me.mkdirSync(r,{recursive:!0}),me.writeFileSync(e,JSON.stringify(t.serialize(),null,2))}async function co(t,e,r,s=!1,n=!1){return w(t,e,r,{silent:s,gitStats:n})}var po=l(()=>{"use strict";v()});var lo,fo,uo=l(()=>{"use strict";lo=`
|
|
33
33
|
Usage: mokosh [options] <entry-point1> <entry-point2> ...
|
|
34
34
|
|
|
35
35
|
Options:
|
|
@@ -63,7 +63,7 @@ Options:
|
|
|
63
63
|
|
|
64
64
|
Notes:
|
|
65
65
|
Add mokosh-cache/ to your .gitignore to avoid committing the cache directory.
|
|
66
|
-
`,
|
|
66
|
+
`,fo=`
|
|
67
67
|
Query filter reference (--query "key:value,key:value,...")
|
|
68
68
|
All keys are case-insensitive. Multiple keys are AND'd together.
|
|
69
69
|
|
|
@@ -135,5 +135,5 @@ COMMON PATTERNS
|
|
|
135
135
|
|
|
136
136
|
Large TypeScript logic files:
|
|
137
137
|
--query "type:typescript,category:logic,sort:size,limit:5"
|
|
138
|
-
`});async function
|
|
138
|
+
`});async function mo(){let t=process.argv.slice(2),e=Pn(t);e.help&&(console.log(lo),process.exit(0)),e.queryHelp&&(console.log(fo),process.exit(0));let r=no(e);Ye(r.rawConfig);let{rootDir:s,resolvedEntryPoints:n,resolvedCachePath:o,scanOptions:i}=r,{proposeTags:a,plain:c,affectedTests:p,detectFeatures:u,findUnused:m,findUncovered:h,excludeTests:x,checkCycles:I,callers:Q,file:ho,silent:yo,featureThreshold:xo,query:So,mermaid:bo,typeGraph:Xt,typeFilter:vo,moduleResponsibility:Zt,filterPaths:Co,minOutDegree:Eo,featureGraph:ko,callGraph:Yt,functionName:Fo,apiSurface:er,applyTags:tr,dryRun:wo}=e,rr=a||p||tr||Q||h||Xt||Zt||Yt||er,ge=io(o)??new F(new Map);(n.length>0||!rr)&&(n.length===0&&!rr&&!m&&!u&&!I&&(console.error("Error: No entry points provided"),process.exit(1)),ge=await co(s,n,ge,yo,r.rawConfig.gitStats??!1),ao(ge,o));let To={graph:ge,rootDir:s,entryPoints:n.map(He=>He.replace(s+"/","")),scanOptions:i,rawConfig:r.rawConfig,featureThreshold:xo,queryStr:So,mermaidOutput:bo,plain:c,excludeTests:x,file:ho,typeFilter:vo,filterPaths:Co,minOutDegree:Eo,functionName:Fo,dryRun:wo};await([[a,eo],[tr,An],[p,Nn],[u,$n],[m,qn],[I,Wn],[h,Kn],[Q,jn],[Xt,ro],[Zt,Zn],[ko,Bn],[Yt,Gn],[er,Dn]].find(([He])=>He)?.[1]??Qn)(To)}var go=l(()=>{"use strict";v();In();Mn();Rn();Ln();On();_n();zn();Un();Jn();Hn();Vn();Xn();Yn();to();so();oo();po();uo()});var Kc=Po(()=>{go();mo().catch(t=>{console.error(t),process.exit(1)})});export default Kc();
|
|
139
139
|
//# sourceMappingURL=cli.mjs.map
|