Media / foldkit-media/server

materialize

function · packages/media/src/server/materialize.ts:42

function materialize(options: {
  readonly pages: ReadonlyArray<{
    readonly html: string
  }>
  readonly fetch: (request: Request) => Promise<Response>
  readonly maxFiles?: number
  readonly headersFile?: string
  readonly concurrency?: number
}): Promise<ReadonlyArray<Materialized>>

Every hosted variant the built pages name, made through fetch (the media server's own handler, serveFetch) and returned as files at their own paths, for foldkit-ssr's emit. Provider.hosted then works on a static host with no server at all. With a Variants store on disk, a second build writes without encoding.

It fails the build, naming every one, when a variant cannot be made (a page would show a broken image), when there would be more than maxFiles, and, given the site's _headers text, when that file has no rule for the variants, which a static host would otherwise serve uncached.