Skip to content

lit-ui-router-ssr / PrerenderOptions

Interface: PrerenderOptions ​

Defined in: packages/lit-ui-router-ssr/src/prerender.ts:57

Options for prerender.

Properties ​

PropertyTypeDescriptionDefined in
document?(body, context) => string | Promise<string>Wraps a rendered body in the page document — the shell html, its <title>, its head. Defaults to the body unchanged. This package never parses or rewrites html.packages/lit-ui-router-ssr/src/prerender.ts:87
dryRun?booleanPlans everything and writes nothing — neither pages nor the rules file.packages/lit-ui-router-ssr/src/prerender.ts:146
elementRenderers?ElementRendererConstructor[]Element renderers passed through to @lit-labs/ssr, verbatim. Defaults to [UiViewRenderer] — not @lit-labs/ssr's [LitElementRenderer], which wraps every custom element in a declarative shadow root it never asked for. Pass [] for a render with no <ui-view> to fill.packages/lit-ui-router-ssr/src/prerender.ts:142
extraRules?RedirectLine[]Lines prepended to the generated ones, verbatim — a site's own legacy redirects.packages/lit-ui-router-ssr/src/prerender.ts:117
mounts?Record<string, MountConfig>The mount table, compiled here — or pass an already-compiled resolver.packages/lit-ui-router-ssr/src/prerender.ts:59
notFound?| false | { file?: string; probe?: string; }The 404 document, emitted once from the otherwise projection. false emits none, and nothing is emitted when the probed mount declares no projection.packages/lit-ui-router-ssr/src/prerender.ts:93
outDirstringDirectory the files are written under.packages/lit-ui-router-ssr/src/prerender.ts:71
paths| Iterable<string, any, any> | AsyncIterable<string, any, any>Every path to ask for a verdict. Redirect and notFound paths belong here too.packages/lit-ui-router-ssr/src/prerender.ts:69
renderShell(verdict, context) => string | TemplateResult | Promise<string | TemplateResult>Renders one shell verdict. Return a template and this package renders it, behind the hydration signature; return a string and it is written as-is. Async, so a hook may drive router to the path before it returns.packages/lit-ui-router-ssr/src/prerender.ts:78
resolver?ServerRouterA resolver from createServerRouter, instead of mounts.packages/lit-ui-router-ssr/src/prerender.ts:61
root?EventTargetThe render's root event target. A bare new EventTarget() is created when none is passed; either way router is provided on it, it reaches every render on eventTargetStack, and it is returned on the result so the caller can attach providers of its own before the call.packages/lit-ui-router-ssr/src/prerender.ts:135
routerUIRouterLitThe router the render reads: provided on root for context-request and scoped with withRouterSync around every render, so <ui-router> descendants and the sref attribute directives both find it.packages/lit-ui-router-ssr/src/prerender.ts:67
rules?"none" | "_redirects" | ((lines) => void | Promise<void>)'_redirects' (default) writes the Cloudflare Pages / Netlify file; 'none' writes nothing and leaves PrerenderResult.rules to the caller; a function receives the lines and writes whatever the host reads. No SPA catch-all is ever written — one turns every 404 into a 200.packages/lit-ui-router-ssr/src/prerender.ts:112
trailingSlash?"both" | "exact"'both' (default) emits every generated redirect line twice, with and without the trailing slash: a static host that appends one would otherwise miss the rule. Shell verdicts need no rules line — they are written as <subpath>/index.html, which both spellings reach — but a host that reaches it by redirecting <subpath> to <subpath>/ boots the client at the slashed url, so the client's strictMode(false) and the mount's config: { strict: false } must both admit it.packages/lit-ui-router-ssr/src/prerender.ts:127
write?FileWriterWrites a file. Defaults to node:fs, imported lazily on first write.packages/lit-ui-router-ssr/src/prerender.ts:144