[]previous and next page

DuskRuntimeManifest

The runtime manifest the build emits for the server entry.

The runtime manifest the build emits for the server entry.

Import#

ts
import type { DuskRuntimeManifest } from "@shadow-js/dusk/server";

Signature#

ts
interface DuskRuntimeManifest {
  /** Generated by `@shadow-js/router/vite`: route definitions for `createRouter({ routes })`. */
  readonly routes: readonly RouteDefinition[];
  /** API routes: file-based HTTP-method modules, matched before pages. */
  readonly apiRoutes: readonly {
    readonly id: string;
    readonly path: string;
    /**
     * The module's `matchFilters` (the same rules as a page's): a value that fails is not a match. Read at build time,
     * so the matcher can use it at startup; the module itself is loaded lazily.
     */
    readonly matchFilters?: Readonly<Record<string, ParamFilter>>;
    load(): Promise<ApiModule>;
  }[];
  /** Server functions by stable id (hash of file + export). `load` is lazy and server-only. */
  readonly serverFns: Readonly<Record<string, { load(): Promise<ServerFnDefinition> }>>;
  /**
   * Built client assets. `entry`, `css` and `preloads` are URLs: a value starting with `/` or an
   * absolute `http(s)` URL is used as is, anything else is joined to `base`.
   */
  readonly assets: {
    readonly entry: string;
    readonly css: readonly string[];
    readonly preloads: Readonly<Record<string, readonly string[]>>;
    readonly base: string;
  };
  /** Root component of the app. */
  readonly App: AppComponent;
  /**
   * The build's `router.caseSensitive`: static route segments compare ASCII case exactly, so `/About` and `/about`
   * are two routes. Absent or false: case folds (the default). Every server router and matcher reads it.
   */
  readonly caseSensitive?: boolean;
  /**
   * Stream routes: files that export `SSE` and/or `WS`. Answered before pages. Absent in a manifest
   * built without streams.
   */
  readonly streams?: readonly {
    readonly id: string;
    readonly path: string;
    readonly kinds: readonly ("SSE" | "WS")[];
    load(): Promise<StreamModule>;
  }[];
  /**
   * Server-only middleware of the routes (`middleware` exports and `_middleware` folders). Absent in a
   * manifest built without any. See {@link RouteMiddlewareManifest}.
   */
  readonly middleware?: RouteMiddlewareManifest;
  /**
   * The `prerender` export of each route that has one, loaded on demand (the server entry exports the same list as
   * `prerenderRoutes`). The server reads it for a route that sets `dynamicParams = false`: a param the export does not
   * list is not found. A route that sets `false` without an entry here makes the handler refuse to start.
   */
  readonly prerenderRoutes?: readonly {
    readonly id: string;
    /** Loads the export: a list of paths, or a function that returns the params. */
    load(): Promise<unknown>;
  }[];
}

Members#

Name Type Description
routes readonly routes: readonly RouteDefinition[] Generated by @shadow-js/router/vite: route definitions for createRouter({ routes }).
apiRoutes readonly apiRoutes: readonly { readonly id: string; readonly path: string; /** * The module's `matchFilters` (the same rules as a page's): a value that fails is not a match. Read at build time, * so the matcher can use it at startup; the module itself is loaded lazily. */ readonly matchFilters?: Readonly<Record<string, ParamFilter>>; load(): Promise<ApiModule>; }[] API routes: file-based HTTP-method modules, matched before pages.
serverFns readonly serverFns: Readonly<Record<string, { load(): Promise<ServerFnDefinition> }>> Server functions by stable id (hash of file + export). load is lazy and server-only.
assets readonly assets: { readonly entry: string; readonly css: readonly string[]; readonly preloads: Readonly<Record<string, readonly string[]>>; readonly base: string; } Built client assets. entry, css and preloads are URLs: a value starting with / or an absolute http(s) URL is used as is, anything else is joined to base.
App readonly App: AppComponent Root component of the app.
caseSensitive? readonly caseSensitive?: boolean The build's router.caseSensitive: static route segments compare ASCII case exactly, so /About and /about are two routes. Absent or false: case folds (the default). Every server router and matcher reads it.
streams? readonly streams?: readonly { readonly id: string; readonly path: string; readonly kinds: readonly ("SSE" | "WS")[]; load(): Promise<StreamModule>; }[] Stream routes: files that export SSE and/or WS. Answered before pages. Absent in a manifest built without streams.
middleware? readonly middleware?: RouteMiddlewareManifest Server-only middleware of the routes (middleware exports and _middleware folders). Absent in a manifest built without any. See RouteMiddlewareManifest.
prerenderRoutes? readonly prerenderRoutes?: readonly { readonly id: string; /** Loads the export: a list of paths, or a function that returns the params. */ load(): Promise<unknown>; }[] The prerender export of each route that has one, loaded on demand (the server entry exports the same list as prerenderRoutes). The server reads it for a route that sets dynamicParams = false: a param the export does not list is not found. A route that sets false without an entry here makes the handler refuse to start.