import { Config } from "./config.js"; import { DiagnosticFormatter, Diagnostics } from "./diagnostics.js"; import { LocaleData } from "./locale-data.js"; import { Source } from "./source.js"; import { TranslationData } from "./translation-data.js"; export declare class Project { #private; constructor(options: ProjectOptions); get config(): Config; get diagnostics(): Diagnostics; get diagnosticFormatter(): DiagnosticFormatter; get development(): boolean; /** * Get or set translation data. * A task runner should set this property before processing sources if translation data exists on disk. */ get translationData(): TranslationData; set translationData(data: TranslationData); getPrefix(filename: string): string; /** * Should be called by a task runner to update or add a source file. */ updateSource(source: Source): void; /** * Can be called by a task runner to delete a source. */ deleteSource(filename: string): void; /** * Should be called by a task runner to process updated sources. */ processSources(): void; /** * Handle modified sources and translation data. * * This should be called by a task runner after sources have been processed. * * In prorudction, no hooks will be invoked and diagnostics * are reported if anything has been modified. */ handleModified(hooks: ProjectHandleModifiedHooks): Promise; /** * Add external locale data. */ addExternalLocale(localeId: string, filename: string, data: LocaleData): void; /** * Compile translation data and external locales. * @returns A map of locale ids to compiled locale data. */ compileLocales(): Map; /** * Report all future diagnostics from this project to the console output. * * This will also set the process exit code to 1 if any errors are reported. */ reportDiagnosticsToConsole(): void; /** * Run the standard production or development workflow for this project. */ run(options?: ProjectRunOptions): Promise; } export interface ProjectOptions { /** The project config. */ readonly config: Config; /** True, to use the development workflow. */ readonly development?: boolean; } export interface ProjectHandleModifiedHooks { readonly writeSource?: (source: Source) => void | Promise; readonly writeTranslationData?: (data: TranslationData) => void | Promise; } export interface ProjectRunOptions { /** * If true, sources, translation data and external locales are watched for changes. * * Default is true in development mode and false in production mode. */ watch?: boolean; /** * If false, external locales are not included in the output. * * @default true */ externals?: boolean; }