import{loadConfig as c}from"@redocly/openapi-core";import g from"path";import{ExternalResolver as l}from"../../../../server/fs/utils/external-ref-resolver.js";const v=async({store:t,context:e})=>{const s=[];for(const{relativePath:o,isVirtual:a}of await e.fs.scan(/redocly\.yaml$/)){if(a)continue;const r=await p(o,t,e.fs);s.push(...r)}return{version:"1",name:"refsUsageStats",value:JSON.stringify(s)}};async function p(t,e,s){const o=[],a=new l(s);return await c({configPath:g.join(e.contentDir,t),externalRefResolver:a,processRawConfig:r=>{r.resolvedRefMap.forEach((h,n)=>{const[f,i]=n.split("::");o.push({configPath:f,refPath:i})})}}),o}export{v as getRefsUsage};
