UNPKG

statigen

Version:

A static site generator that supports html, ejs, and markdown source files

69 lines (68 loc) 1.95 kB
import type { Diagnostic, File } from './interfaces'; import type { Options } from './StaticSiteGenerator'; import type { TextFile } from './files/TextFile'; import { Tree } from './Tree'; export declare class Project { constructor(options: Options); options: Options; private pluginManager; /** * Get the diagnostics from all files */ getDiagnostics(): Diagnostic[]; /** * Map of all files in the project, indexed by absolute path */ files: Map<string, File>; /** * Get the file with the specified path */ getFile<T extends File = File>(filePath: string): T; /** * Get a tree of all the html files based on their output paths */ getTree(): Tree; /** * Add or replace a file in the project */ setFile(srcPath: string): File; setFile(fileEntry: { src: string; dest: string; }): File; /** * Remove a file from the project */ removeFile(srcPath: string): void; /** * Validate the entire project */ validate(): void; /** * Determine if the given file exists somewhere within the sourceDir */ private fileResidesInSourceDir; /** * Get the template file for a given file */ getTemplateFile(file: TextFile): File; /** * Given a file, look up its template and then generate the output text * using the ejs templating engine. * If the template could not be found, the content is returned as-is */ generateWithTemplate(file: TextFile, content: string): any; /** * A cache that can be used by templates and plugins. This is cleared before every publish */ cache: Record<string, any>; publish(): void; /** * Sanitize the given options in-place */ private setOptions; /** * Given a path, convert to an absolute path and use the current OS path.sep */ private resolvePath; }