import { scanRoutes, type PageRoute, type ScannedRoutes } from "../router/route-scanner.js"; import { type IslandModule } from "../island/scan.js"; import { type ImageFormat } from "../image/index.js"; import { type NixKitIntegration } from "../integrations/index.js"; export interface BuildConfig { /** Absolute path to the app directory (e.g. /project/src/app). */ appDir: string; /** Absolute path to the output directory (e.g. /project/dist). */ outDir: string; /** Absolute path to the project root (e.g. /project). When provided, action * paths in the serialized HTML shell are made relative to this root. */ root?: string; /** Base path for the client entry module, e.g. "/_nix-js/entry-client.js". */ clientEntry?: string; /** Default language for the HTML shell. */ lang?: string; /** * Absolute path to the islands directory (e.g. /project/src/islands). * When set, `build` scans it and generates a client entry module listing * every island so you don't have to maintain `entry-client.ts` by hand. */ islandsDir?: string; /** * Absolute path where the generated client entry module is written * (e.g. /project/.nix-js/entry-client.ts). Required when `islandsDir` is set. */ generatedEntry?: string; /** * Import specifier the generated entry uses for `hydrateIslands`. * Defaults to the published subpath `@deijose/nix-js-kit/island`. */ hydrateImport?: string; /** * Import specifier the generated entry uses for `startClientRouter`. * Defaults to the published subpath `@deijose/nix-js-kit/router`. */ routerImport?: string; /** Absolute path to the public directory for static assets (optional). */ publicDir?: string; /** Image formats to generate when sharp is available. Defaults to ["webp", "avif"]. */ imageFormats?: ImageFormat[]; /** * Whether the SSR render endpoint (`/__nix-js/render`) exists at runtime. * Defaults to `true` (dev, preview and SSR deployments). Set to `false` for * fully static outputs so the emitted HTML tells the client router to skip * the endpoint (no 404 storms on static hosts like Vercel). */ renderEndpoint?: boolean; /** * Integrations to invoke during the build lifecycle. When provided, the * `build` hook fires after all pages and image variants are generated, * giving integrations a chance to write post-build artifacts (sitemaps, * robots.txt, search indexes, etc.) into the output directory. */ integrations?: NixKitIntegration[]; } export interface BuildResult { /** Number of static HTML pages generated. */ pages: number; /** Paths that were skipped because they are dynamic without a static param list. */ skipped: string[]; /** Absolute paths to the generated HTML files. */ files: string[]; /** Islands discovered when `islandsDir` is set. */ islands: IslandModule[]; /** Absolute path to the generated client entry, if one was written. */ generatedEntry?: string; /** Number of image variants generated (0 if sharp is not installed). */ imagesProcessed: number; /** Absolute path to the output directory where build artifacts were written. * When called via the CLI, this is the atomic staging directory (not the * final `dist/`). Integration `build` hooks should write post-build * artifacts here so they survive the atomic swap. */ outDir: string; } /** * Builds a static site from a scanned route tree. * * @param config Build configuration. * @returns Summary of generated files. */ export declare function build(config: BuildConfig): Promise; export { scanRoutes, type PageRoute, type ScannedRoutes };