/** * Same-origin SPA serving for production. * * In dev the SPA is served by Vite (:5173) which proxies API paths to the * server (:4111) — this module is effectively idle there. In production the * built SPA (vite output) is served by the API server itself at `/`, so the * app is a single origin and no CORS / separate static host is required. * * The middleware is mounted via the Mastra entry's `server.middleware`, which * the deployer applies before routes: real file hits and SPA navigations are * answered here, everything else falls through to the API routes. */ import type { Context } from 'hono'; /** * Locate the built SPA (a dir containing `index.html`). Checked in order: * 1. `MASTRACODE_UI_DIST` — explicit override for custom layouts. * 2. `factory/` under cwd — both `mastra dev` (cwd is the Mastra public dir) * and `mastra start` (cwd is `.mastra/output`) expose assets this way. * 3. `factory/` next to the bundled server module. * 4. Source-layout fallbacks under `MASTRA_PROJECT_ROOT` or cwd. * Returns `undefined` when no build is found (e.g. plain `mastra dev` without * a prior vite build), in which case the middleware is simply not mounted. */ export declare function resolveUiDistDir(): string | undefined; /** * Hono middleware serving the built SPA from `uiDist`: * - exact file hits (js/css/assets) are served directly, * - GET navigations to non-server paths fall back to `index.html` (SPA * client-side routing), * - `/api`, `/web`, `/auth` and non-GET requests always pass through. */ export declare function createSpaStaticMiddleware(uiDist: string): (c: Context, next: () => Promise) => Promise; //# sourceMappingURL=spa-static.d.ts.map