/** * The five build entries a site scaffold ships, emitted from one shape. * * These were 25 files - five deploy targets copied across five framework directories - and the * difference between any two of them is mechanical: which runtime it targets, and which compiler * plugin, resolve conditions and defines the framework needs. Nothing else. So the target owns its * own prose (what it emits, how to run it) and the framework contributes its injections, and the 25 * files come out of one function. * * The emitted text is asserted byte-for-byte against the templates that used to be checked in, so * this is a refactor whose correctness is decided by a test rather than by reading. */ import type { FrameworkSpec } from "./frameworks.js"; /** * Where the framework's own resolve conditions sit inside a target's server list. * * The edge targets end theirs with `browser` (the worker has no Node builtins, so packages must be * asked for their browser build); Bun and Node do not. The framework's conditions go in the middle, * which is the order every checked-in template used. */ export interface ServerConditionSlots { readonly before: readonly string[]; readonly after: readonly string[]; } export interface BuildTarget { /** File name, e.g. `build-bun.ts`. */ readonly file: string; /** Leading comment block, without the trailing newline. */ readonly header: string; /** * Frameworks whose header says something extra here - what their plugin does, or how to run the * output once their compiler is in the picture. * * These are the one genuinely non-mechanical part of a build entry, and they are the reason this * table exists rather than a pure `{framework, runtime}` function: the prose a framework needs to * explain itself is written, not derived. Keeping them beside the target they belong to is the * closest thing to having them in the file without having five copies of the file. */ readonly headerOverrides?: Readonly>; /** Runtime conditions this target's SERVER build resolves with. */ readonly serverConditions: ServerConditionSlots; /** Extra `node:fs` named imports beyond `cpSync, mkdirSync, rmSync`. */ readonly extraFsImports?: readonly string[]; /** Lines between the imports and the first build call, `dir` already declared. */ readonly setup: string; /** Where `buildClient` writes assets, as a template expression. */ readonly clientOutDir: string; /** The server entry this target boots from. */ readonly serverEntry: string; /** Scratch directory for the server build. */ readonly serverOutDir: string; /** `target:` line for `buildServer`, or empty for the default (workerd). */ readonly serverTarget: string; /** Everything after the `buildServer` call. */ readonly tail: string; } export declare const BUILD_TARGETS: readonly BuildTarget[]; /** Emit one target's build entry for one framework. */ export declare function renderBuildFile(target: BuildTarget, framework: FrameworkSpec): string; //# sourceMappingURL=site-build.d.ts.map