import{ServerRoutes as n}from"../../constants/common.js";import{logger as c}from"../tools/notifiers/logger.js";import{telemetry as o}from"../telemetry/index.js";import{installDevRoutes as p,installProdRoutes as f}from"./routes/index.js";import{createRouter as u}from"./router.js";import{readStaticAsset as l}from"./node-asset-reader.js";import{startHttpServer as v}from"./http.js";import{listenStore as D}from"./store-ws.js";import{ejectComponentDataHandler as S}from"./routes/eject.js";import{attachWsServer as g}from"./ws.js";import{DatabasePreconnectService as C}from"../providers/database/database-preconnect-service.js";async function _(t,a,i){o.initialize(!0);const{port:m=4e3}=i,r=u();r.get(n.EJECT_COMPONENT,S(t)),p(r,t),f(r,t,{readStaticAsset:l,resolveRouteData:e=>t.resolveRouteStaticData(e,a)}),process.env.NEW_CATALOG_ENABLED==="true"&&await C.init(t.serverOutDir);try{await t.userCodeReady;const e=await v(r,m),s=g(e);D(t,s)}catch(e){o.sendCliErrorCaughtMessage({message:e.message}),c.panic(e)}}export{_ as startDevServer};
