import { Comment } from './comment.js'; import { Output } from './output.js'; import { Value } from './value.js'; import { Declaration } from './decl.js'; type Content = Comment | Declaration | Value; type Header = Comment; export interface ProgramOptions { rootDirectory: string; constructFileSuffix: string; constructHeaders?: Header[]; specFileSuffix: string; language: 'typescript' | 'javascript'; } export declare class Program { #private; constructor(options: ProgramOptions); get paths(): string[]; /** * The files declaring constructs, in the order they were first asked for. * * Support and static auxiliary files are not included: a caller that wants * the construct a single `gencode` call produced has no other way to tell * that file apart from the script, snippet and stylesheet files the same * call may register beside it. */ get generatedConstructFiles(): GeneratedFile[]; generatedConstructFile(path: string): GeneratedFile; generatedSupportFile(path: string): GeneratedFile; staticSpecFile(path: string, content: string | Buffer): StaticAuxiliaryFile; staticStyleFile(path: string, content: string | Buffer): StaticAuxiliaryFile; staticSupportFile(path: string, content: string | Buffer): StaticAuxiliaryFile; /** * Renders every file of the program in memory, in the order `realize()` * writes them: generated files first, then static auxiliary files. Paths * are relative to the program's root directory, as the program holds them. */ render(): RenderedFile[]; realize(): Promise; } /** A file of a program rendered to its final content. */ export interface RenderedFile { /** Relative to the program's root directory. */ path: string; content: string | Buffer; } export declare abstract class ProgramFile { readonly path: string; constructor(path: string); get dirname(): string; get basename(): string; relativePath(to: ProgramFile): string; } export interface ImportOptions { relativeTo?: string; relativeToSelf?: boolean; alias?: string; } export interface NamedImport { identifier: string; alias?: string; } export declare class GeneratedFile extends ProgramFile { #private; namedImport(identifier: string, from: string, options?: ImportOptions): void; plainImport(from: string, options?: ImportOptions): void; header(header: Header): void; section(content: Content): void; /** * @param options `scaffolding` defaults to true, so writing a file to disk * needs no options. A caller rendering one construct for a reader — a diff * of what a deploy would change, say — passes false: the generated-file * header and the import list belong to the file, not to the construct, and * an import path invented for an in-memory render would be noise. */ render(output: Output, options?: { scaffolding?: boolean; }): void; } export declare class StaticAuxiliaryFile extends ProgramFile { readonly content: string | Buffer; constructor(path: string, content: string | Buffer); } export {};