SSR / foldkit-ssr/vite

StaticSite

interface · packages/ssr/src/vite.ts:65

interface StaticSite<
  Model,
  Fields extends Schema.Struct.Fields,
  Message,
  Resolved = ResumableConfig<Model, Message>,
> {
  readonly config: Resolved | ((path: string) => Resolved | Promise<Resolved>)
  readonly plan:
    ResumePlan<Model, Fields> | ((path: string) => ResumePlan<Model, Fields>)
  readonly buildId?: string | undefined
  readonly origin: string
  readonly paths:
    | ReadonlyArray<SitePath>
    | (() => ReadonlyArray<SitePath> | Promise<ReadonlyArray<SitePath>>)
  readonly template: string
  readonly head?: Head | undefined
  readonly flags?: ((path: string) => unknown) | undefined
  readonly files?: 'directory' | 'flat' | undefined
  readonly sitemap?: boolean | undefined
  readonly robots?: boolean | undefined
  readonly emit?:
    | ((pages: ReadonlyArray<BuiltPage>) => Promise<ReadonlyArray<EmittedFile>>)
    | undefined
}

What a static site is: everything SSR.generate takes, plus where its pages land. config may read the path (a site whose Model is prepared per page satisfies and returns its own config for it); paths may close over what the site serves (a thunk that seeds and lists, evaluated when the build runs). template is the built shell the pages are rendered into; files is the host's layout; sitemap and robots write their files from the generated pages; emit adds files of its own made from them.

Members

StaticSite.config

property · packages/ssr/src/vite.ts:75

readonly config: Resolved | ((path: string) => Resolved | Promise<Resolved>)

StaticSite.plan

property · packages/ssr/src/vite.ts:82

readonly plan:
  ResumePlan<Model, Fields> | ((path: string) => ResumePlan<Model, Fields>)

The plan every page resumes with, or a function of the path for a site of more than one application: each path then resumes with the plan of the application config returns for it. A function that throws fails the build, naming the path.

StaticSite.buildId

property · packages/ssr/src/vite.ts:83

readonly buildId?: string | undefined

StaticSite.origin

property · packages/ssr/src/vite.ts:84

readonly origin: string

StaticSite.paths

property · packages/ssr/src/vite.ts:85

readonly paths:
  | ReadonlyArray<SitePath>
  | (() => ReadonlyArray<SitePath> | Promise<ReadonlyArray<SitePath>>)

StaticSite.template

property · packages/ssr/src/vite.ts:88

readonly template: string

property · packages/ssr/src/vite.ts:89

readonly head?: Head | undefined

StaticSite.flags

property · packages/ssr/src/vite.ts:90

readonly flags?: ((path: string) => unknown) | undefined

StaticSite.files

property · packages/ssr/src/vite.ts:91

readonly files?: 'directory' | 'flat' | undefined

StaticSite.sitemap

property · packages/ssr/src/vite.ts:92

readonly sitemap?: boolean | undefined

StaticSite.robots

property · packages/ssr/src/vite.ts:93

readonly robots?: boolean | undefined

StaticSite.emit

property · packages/ssr/src/vite.ts:99

readonly emit?:
  | ((pages: ReadonlyArray<BuiltPage>) => Promise<ReadonlyArray<EmittedFile>>)
  | undefined

Files made from the generated pages, written beside them: what the pages reference and the build must also serve, such as the image variants their srcsets name (foldkit-media's materialize).