Static site generation
@tagna/udiot/ssg exports SSGBuilder, buildStaticSite and the types
SSGPageRegistry, SSGConfig, StaticProps, StaticPaths,
GenerationResult and BuildStats. This surface is experimental.
Applications supply a structural registry with getAllPages() and
matchRoute(urlPath); importing the internal PageRegistry class is not
required. Page metadata includes route, absolute module path, render mode,
dynamic-route flag and parameter names.
import assert from 'node:assert/strict';
import { SSGBuilder, type SSGPageRegistry } from '@tagna/udiot/ssg';
const registry: SSGPageRegistry = {
getAllPages: () => [],
matchRoute: () => null,
};
const builder = new SSGBuilder(registry, {
outputDir: './build/site-output',
baseUrl: 'https://example.com',
cleanUrls: true,
concurrency: 4,
});
assert.equal(typeof builder.build, 'function');
This checks construction only. A real registry must list compiled page modules
that the renderer can load. Call await builder.build() to generate output and
inspect failedPages and results in the returned statistics.
Output safety: a full build cleans its output directory. Use a dedicated generated-output directory, never a source directory, repository root or shared asset directory containing irreplaceable data.
Dynamic static pages need paths and data appropriate to the generator's page contract. Do not assume that an ISR-related option starts an HTTP regeneration service. For typed page discovery and manifests, prefer the web application layer. Validate generated pages, assets, redirects and error pages with your deployment target.