@askrjs/askr/ssg
Exports from the declarations published in @askrjs/askr. Signatures reflect the published artifact.
Exports
This entrypoint publishes 13 exports. Use the anchored symbol rows for direct links. Type-only exports are labeled separately from runtime values.
createStaticGentype
createStaticGen: (options: SSGOptions) => { generate(generateOptions?: SSGGenerateOptions): Promise<SSGResult>; getConfig(): { routeCount: number; outputDir: string; seed: number; concurrency: number; parallelism: number; hasDataOverrides: boolean; assetCount: number; }; getResult(): SSGResult | null; }Create a Static Site Generator
Usage:
``ts
const ssg = createStaticGen({
registry,
outputDir: './dist',
dataOverrides: {
'/api/posts': { posts: [...] }
}
});
const result = await ssg.generate();
console.log(Generated ${result.successful}/${result.totalRoutes} routes);
DocumentRenderArgstype
DocumentRenderArgs: anyArguments passed to a {@link DocumentRenderer}: the rendered app HTML and its context.
appHtml- appHtml: string;
context- context: DocumentRenderContext;
DocumentRenderContexttype
DocumentRenderContext: anyRequest/render metadata passed to a {@link DocumentRenderer}.
mode- mode: 'ssr' | 'ssg';
url- url: string;
pathname- pathname: string;
search- search: string;
hash- hash: string;
params- params: Record<string, string>;
data- data?: SSRData;
seed- seed: number;
route- route: DocumentRenderRoute;
cspNonce- cspNonce?: string;
styles- styles?: readonly SSRStyleRegistration[];
DocumentRenderertype
DocumentRenderer: (args: DocumentRenderArgs) => stringWraps rendered app HTML in a full document (<html>, <head>, etc.) for SSR/SSG output.
RouteRenderReasontype
RouteRenderReason: | 'full'
| 'changed-key'
| 'changed-route'
| 'new-route'
| 'no-keys'
| 'unchanged'
| 'deleted'
| 'runtime-only'Why a route was rendered, skipped, or removed during generation.
RouteRenderResulttype
RouteRenderResult: anyResult of rendering a single route
path- URL path
filePath- Output file path relative to outputDir
html- Generated HTML content
fileSize- File size in bytes
renderDuration- Render duration in milliseconds
resourceCount- Number of resources discovered and rendered
status- Render or generation status
reason- Why this route was rendered, skipped, or removed
written- Whether the output file was written during this run
error- Error message if rendering failed
errorCause- Original exception preserved for programmatic diagnostics.
errorContext- Route and phase context for the original exception.
RouteRenderStatustype
RouteRenderStatus: 'success' | 'error' | 'skipped' | 'removed'Outcome of generating a single route's static HTML.
SSGAssetSourcetype
SSGAssetSource: anyA static file or directory to copy alongside generated routes.
from- Source file or directory. Relative paths resolve from the current working directory.
to- Destination relative to outputDir. Defaults to the source basename.
SSGGenerateOptionstype
SSGGenerateOptions: anyOptions for a single generation run
mode- Generation mode
changedKeys- Changed invalidation keys for incremental runs
changedRoutes- Changed concrete route paths for incremental runs
forceFull- Force a full rebuild even when incremental mode was requested
SSGMetadatatype
SSGMetadata: anyMetadata to write to metadata.json
generatedAt- ISO timestamp of generation
totalRoutes- Total number of routes processed
successful- Number of successfully generated routes
failed- Number of failed routes
totalDuration- Total generation duration in milliseconds
mode- Effective generation mode
rebuilt- Number of routes rendered during this run
skipped- Number of current routes skipped as unchanged
removed- Number of stale routes removed from output
cacheHits- Number of rendered routes whose HTML bytes were unchanged
invalidatedKeys- Invalidation keys applied to this run
invalidatedRoutes- Concrete route paths applied to this run
routes- Per-route details
SSGModetype
SSGMode: 'full' | 'incremental'Whether an SSG run rebuilds every route (full) or only changed ones (incremental).
SSGOptionstype
SSGOptions: SSGBaseOptions & {
/** Explicit route registry captured with `createRouteRegistry()`. */
registry: RouteRegistry;
}Options for createStaticGen
SSGResulttype
SSGResult: anyOverall result from SSG generation
generatedAt- ISO timestamp of generation
totalRoutes- Total number of routes processed
successful- Number of successfully generated routes
failed- Number of failed routes
totalDuration- Total generation duration in milliseconds
mode- Effective generation mode
rebuilt- Number of routes rendered during this run
skipped- Number of current routes skipped as unchanged
removed- Number of stale routes removed from output
cacheHits- Number of rendered routes whose HTML bytes were unchanged
invalidatedKeys- Invalidation keys applied to this run
invalidatedRoutes- Concrete route paths applied to this run
routes- Per-route results