stax-monorepo
    Preparing search index...

    Interface StaxPlatformOptions

    Options for the Stax Platform Vite plugin.

    Two config shapes supported:

    Pass app, client, and adapter. The plugin owns both dev and prod HTTP server lifecycles. The user writes src/app.ts exporting a makeApp({ scripts, styles }) factory and optional AppLayer.

    staxPlatform({
    app: "src/app.ts",
    client: "src/client.ts",
    adapter: nodeAdapter({ port: 3000 }),
    });

    See issue #169 for the architecture.

    Pass entry. Keeps the current behavior where the user writes src/vite-entry.ts (dev) + src/server.ts (prod) and the plugin drives dev-mode SSR via a render(request) export. SSG mode (mode: "ssg") also uses this shape. Emits a deprecation warning on dev startup; will be removed in a future minor.

    interface StaxPlatformOptions {
        adapter?: StaxAdapter;
        app?: string;
        client?: string;
        entry?: string;
        exclude?: RegExp;
        include?: RegExp;
        mode?: "ssr" | "ssg";
    }
    Index
    adapter?: StaxAdapter

    The deploy-target adapter. Chooses how vite build --ssr emits the server bundle: nodeAdapter() for a Node HTTP server, ssgAdapter() for static site generation (follow-up PR), etc.

    app?: string

    Path to the user's app module. Must export:

    • makeApp(opts: { scripts: readonly string[]; styles: readonly string[] }): HttpRouter
    • optionally AppLayer: Layer<unknown, unknown, unknown>

    The plugin loads this module via Vite's SSR loader in dev, and bundles it as the server-side input in prod.

    "src/app.ts"
    
    client?: string

    Path to the user's client entry module. Used as the Rollup input for the client bundle, which lands at dist/client/client.js.

    "src/client.ts"
    

    Optional Readonlyentry

    entry?: string

    Deprecated — use app + client + adapter instead.

    Path to the SSR/SSG entry module.

    In SSR mode: exports a render(request: Request) => Promise<Response> function. In SSG mode: exports { router, app?, document?, layers? } for static site generation.

    exclude?: RegExp

    File patterns to exclude from the transform.

    include?: RegExp

    File patterns to apply the server-code stripping transform to. Defaults to all .ts/.tsx/.js/.jsx files.

    mode?: "ssr" | "ssg"

    Deprecated — only honored with legacy entry config.

    Build mode.

    • "ssr" (default) — Standard SSR with live server
    • "ssg" — Static site generation. After vite build, runs Platform.buildStaticSite() to pre-render all Route.static routes.