@docvia/ssr
v0.2.1
Published
Request-time SSR rendering for docvia — Node and edge content providers with an LRU render cache
Maintainers
Readme
@docvia/ssr
Request-time server rendering for docvia.
createDocviaSSR() turns an IR document into a renderable page tree on demand,
backed by an in-memory LRU cache keyed by content hash. Content is supplied by
a ContentProvider:
BundledContentProvider(@docvia/ssr) — edge-safe. Serves pre-built per-route IR chunks (emitted to.docvia/ir/at build time). Nonode:fs, no markdown parsing at request time. Use on Cloudflare Workers / edge.FsContentProvider(@docvia/ssr/node) — Node only. Wraps a liveCompileService, compiling markdown from disk. Use for Node servers and dev.
import {
createDocviaSSR,
BundledContentProvider,
createGlobChunkLoader,
} from "@docvia/ssr";
// `createGlobChunkLoader` turns a Vite `import.meta.glob` of the build's IR
// chunks into a `ChunkLoader` — statically code-split, edge-safe.
const ssr = createDocviaSSR({
provider: BundledContentProvider(
createGlobChunkLoader(import.meta.glob("/.docvia/ir/**/*.json")),
),
});
const page = await ssr.render("docs", "getting-started");The render path is the same @docvia/renderer-core pipeline used by the
build, so SSR output matches build output. With @docvia/plugin-shiki the IR
is already highlighted, so no syntax highlighter ships to the edge bundle.
