stax-monorepo
    Preparing search index...

    Interface StaxAdapter

    Describes a deploy target for a Stax app.

    The adapter contributes code at build time via ssrEntryModule, which returns a string of JavaScript the vite-plugin feeds into Vite's SSR build as the entry. The resulting bundle is self-contained and environment-specific (e.g. a Node HTTP server for nodeAdapter).

    interface StaxAdapter {
        afterSsrBuild?: (ctx: AfterSsrBuildContext) => Promise<void>;
        clientBuildOptions?: ClientBuildOptions;
        name: string;
        ssrEntryModule: (ctx: SsrEntryContext) => string;
    }
    Index
    afterSsrBuild?: (ctx: AfterSsrBuildContext) => Promise<void>

    Called by the plugin after the SSR build completes. Lets the adapter run post-build work (e.g. SSG writing HTML files) when the synthesized entry can't do everything inside the SSR bundle itself. Optional — the Node adapter doesn't need this.

    clientBuildOptions?: ClientBuildOptions

    Build-time preferences for the CLIENT bundle step. See ClientBuildOptions. Leave unset to accept the Node-adapter defaults.

    name: string

    Short identifier for logs and diagnostics, e.g. "node", "ssg".

    ssrEntryModule: (ctx: SsrEntryContext) => string

    Synthesize the SSR entry's module source. Returns a complete JavaScript module string the vite-plugin registers as a virtual entry module.

    The returned module conventionally:

    • imports the user's app namespace via ctx.appModuleId to get makeApp and optionally AppLayer;
    • calls makeApp({ scripts: ctx.scripts, styles: ctx.styles });
    • wraps the resulting HttpApp with environment-specific bootstrap (static file serving, HTTP server, serverless handler, etc.);
    • provides userApp.AppLayer if present.