SSR / API

foldkit-ssr/vite

foldkit-ssr/vite: the static half of a build, as a Vite plugin. After Vite writes the client bundle, staticSite renders every path with SSR.generate and writes each page where a static host serves its address, with the sitemap and robots.txt beside them. It owns no build: it runs as a closeBundle step on the application's own client build, with the application's own template.

The application describes its site in a module the plugin evaluates through a server (workspace packages resolve to source, as the build does), so vite.config.ts names a file, never application code.

Functions

checkEmittedThe files emit returned, refused when one would land outside the output (an absolute path, a ..) or on a file the build writes itself: a page, the sitemap,…
defineManifestConstruct a verified Manifest<Tag> where every tag in tags is present exactly once. Fails at compile time if any tag is missing or duplicated in tags, and…
fileForThe file a static host serves for a path. directory is the package's own layout (/about as about/index.html); flat writes about.html, for hosts with clean…
generateStaticSiteRenders a static site: every path through SSR.generate, one page per path in order, with the sitemap and robots text the options ask for. A build id must…
manifestFromChunksBuild a Manifest<Tag> from chunk groupings { chunk, tags, with? }, refusing any tag claimed by two chunks or any expected tag left unclaimed.
manifestPluginVite plugin that emits the runtime entry chunk (absorbing runtimeChunk) and any declared per-Message / per-Surface chunks, exposing the resulting Manifest…
runtimeChunkEmits entry, the module the loader's runtime imports, as a chunk of the client build, and writes that chunk's address into the loader. The chunk is the one…
staticSiteA static site as a Vite plugin: after the client bundle is written, the site module is evaluated, every path is rendered into the built shell, and the pages…
writeEmittedWrites what emit returned into outDir, refusing a file the client build already wrote there: a file from public/ is not emit's to replace.

Interfaces

BuiltPageOne generated page, with the file the host serves it from.
BuiltSiteWhat a static site build produced: its pages, and its sitemap and robots text.
EmittedFileA file emit adds: its path in the output, and its contents.
ManifestEntryOne tag's home chunk and any companion chunks (e.g. Command Effects) loaded alongside it.
ManifestPluginOptions
SiteModuleA site description as a module exports it, for the plugin to evaluate.
StaticSiteWhat 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…

Types

HeadWhat a page adds to its head, given what it rendered and the compiled classes it drew: such as a stylesheet of those classes (Style.usedDrawn in…
ManifestExhaustive map from every Message tag in Tag to its single chunk home.
SitePathA path the site generates, with the date its sitemap names when it has one.
UniqueTupleCompile-time check that a tuple of tag names contains no duplicates.