import{generateApiRequestHandlersEntry as i}from"./codegen/index.js";import{getServerRebuildTriggerPath as l}from"../generate.js";const s="api-request-handlers-ns",p=e=>({name:"esbuild-redocly-api-request-handlers-resolver",setup:r=>{r.onResolve({filter:/@portal\/api-request-handlers/},async a=>{e.buildRevision>0&&await e.waitForPluginsRun();const t=Array.from(e.apiRoutesRequestHandlers.values()),n=l(e.serverOutDir);return{namespace:s,path:a.path,watchFiles:[...t,n]}}),r.onLoad({filter:/@portal\/api-request-handlers/,namespace:s},async()=>(e.buildRevision>0&&await e.waitForPluginsRun(),{contents:i(Array.from(e.apiRoutesRequestHandlers.entries())),resolveDir:"/",loader:"ts"}))}});export{p as ApiRequestHandlersResolver};
