import { r as DevframeDefinition } from "../devframe-BuR6n9ZD.mjs"; import { n as StartedServer } from "../server-wHlpcdZ9.mjs"; import { H3 } from "h3"; //#region src/adapters/dev.d.ts interface CreateDevServerOptions { /** Bind host. Default: `def.cli?.host ?? 'localhost'`. */ host?: string; /** * Port to listen on. When omitted, falls back to * {@link resolveDevServerPort}, which respects `def.cli?.port` / * `portRange` / `random`. */ port?: number; /** * Parsed flag bag forwarded to `setup(ctx, { flags })`. The dev * server itself only reads `flags.open` from this bag, and only when * {@link CreateDevServerOptions.openBrowser} is left undefined. */ flags?: Record; /** * Override `def.cli?.distDir`. When neither this option nor * `def.cli?.distDir` is set, the dev server runs in **bridge mode** — * only `__connection.json` and the WS endpoint are mounted; the SPA * is expected to be hosted elsewhere (e.g. by a parent Vite/Nuxt * dev server via `viteDevBridge({ devMiddleware })`). */ distDir?: string; /** * Override the SPA mount path. Defaults to * `resolveBasePath(def, 'standalone')` (i.e. `def.basePath` or `/`). */ basePath?: string; /** * h3 app to mount the SPA + connection-meta routes on. When omitted * a fresh app is created. Pass a pre-configured app to attach custom * middleware (auth, logging, extra static assets) before devframe's * own handlers. */ app?: H3; /** * Auto-open the browser. When `undefined` the resolution falls * through to `flags.open` (incl. string path) and finally * `def.cli?.open`. `false` disables the open regardless of the other * sources; a string opens that relative path. */ openBrowser?: boolean | string; /** * Called once the WS server is bound. Devframe stays headless * otherwise — wire this if you want a startup banner. */ onReady?: (info: { origin: string; port: number; app: H3; }) => void | Promise; } interface ResolveDevServerPortOptions { /** Bind host (passed to `get-port-please` for in-use detection). */ host?: string; /** Override the preferred port. Default: `def.cli?.port ?? 9999`. */ defaultPort?: number; } /** * Resolve the listening port for {@link createDevServer}, honoring the * definition's `cli.port` / `cli.portRange` / `cli.random` settings. * Exposed separately so authors who run their own argv parsing can * resolve a port up-front (to print it, log it, etc.) before starting * the server. */ declare function resolveDevServerPort(def: DevframeDefinition, options?: ResolveDevServerPortOptions): Promise; /** * Start a devframe dev server for a {@link DevframeDefinition} — * h3 + WebSocket RPC + (optionally) the author's SPA mounted at the * resolved base path. * * When `distDir` is omitted (and `def.cli?.distDir` is unset) the * server runs in **bridge mode**: only `__connection.json` and the WS * endpoint are mounted, with no SPA mount. The SPA is expected to be * hosted elsewhere (e.g. by a parent Vite/Nuxt dev server) — see * `viteDevBridge({ devMiddleware })`. * * Returns the underlying {@link StartedServer} handle so callers can * close it gracefully (SIGINT, hot-reload, test teardown). * * Use this directly when integrating devframe into an existing CLI * framework (commander, yargs, hand-rolled CAC). For the all-in-one * `dev` / `build` / `mcp` shell, reach for {@link createCli} instead. */ declare function createDevServer(def: DevframeDefinition, options?: CreateDevServerOptions): Promise; //#endregion export { CreateDevServerOptions, ResolveDevServerPortOptions, createDevServer, resolveDevServerPort };