@askrjs/askr/ssg
Exports from the declarations published in @askrjs/askr. Signatures reflect the published artifact.
Exports
This entrypoint publishes 16 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`); ```
DiscoveredResourcestype
DiscoveredResources: anyResource discovery result for a single route
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.
RouteConfigtype
RouteConfig: anyRoute config accepted by SSG. The handler is defined by the route registry and matches router/SSR naming.
path- URL path to generate (e.g., "/blog/post-1", "/")
handler- Route handler compatible with router/SSR
props- Optional base props merged with route params during render
namespace- Optional namespace for router compatibility
auth- Routes with request-auth requirements are runtime-only by default.
policies- Advanced runtime access checks disable prerendering by default
params- Optional path parameter map for template paths like "/blog/{slug}"
invalidationKeys- Optional explicit invalidation keys for incremental generation
loader- Route loader resolved completely before static HTML is rendered.
dehydrate- Select the loader data transported for initial hydration.
basePath- basePath?: string;
entries- SSG entry generator for parameterized routes. Return one param map per page to be generated. The path template is expanded with each map to produce a concrete URL, e.g.: ```ts route('/posts/{slug}', PostPage, { entries: async () => getPosts().map(p => ({ slug: p.slug })), }); ```
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
SSRStyleRegistrationValidationtype
SSRStyleRegistrationValidation: 'warn' | 'error' | 'off'How to react when SSR styles were registered but not included in the rendered document.