import { BaseOptions, FilterOptions, OverwriteOptions, CrossHookOptions, CrossOperationResult } from './types.js'; type ParserPluginParams = { files: Record; map: Record; parser: Parser | FileParser; }; type ParserPlugin = (options: ParserPluginParams) => void; type ParserOptions = { /** * Source directory. */ source: string; /** * Destination directory. */ destination: string; /** * Clear destination directory or not before operation. */ clean: boolean; /** * Parser plugins. */ plugins: ParserPlugin[]; } & BaseOptions & FilterOptions & OverwriteOptions & CrossHookOptions; type ParseResult = CrossOperationResult; /** * Parser template with data. * {@link https://kythuen.github.io/ephemeras/parser/Parser | View Details} * * @param options See {@link ParserOptions }. * * @examples * ``` * import { Parser, prettier } from '@ephemeras/parser' * * const parser = new Parser({ * source: '/src', * destination: '/dest' * }) * * parser.context(process.cwd()) * * parser.set('clean', true) * * parser.set({ * relativize: true, * overwrite: true, * includes: [], * excludes: [], * filter: (path, stat) => stat.isFile() && path.includes('1.txt'), * beforeEach: (src, dest) => { console.log(src, dest) } * afterEach: (src, dest) => { console.log(src, dest) } * plugins: [] * }) * * parser.use(prettier()) * * const { src, dest, add, update, skip } = await parser.build() * ``` */ declare class Parser { options: ParserOptions; tasks: (() => Promise)[]; result: Record; constructor(options: Partial); set(prop: keyof ParserOptions, value: any): this; set(props: Partial): this; context(context: string): this; source(src: string): this; destination(dest: string): this; clean(clean: boolean): this; includes(patterns: string[]): this; excludes(patterns: string[]): this; use(plugin: ParserPlugin): this; read(src: string): Promise; build(): Promise; } type FileParserOptions = { /** * Source file. */ source: string; /** * Destination file. */ destination: string; /** * Parser plugins. */ plugins: ParserPlugin[]; } & OverwriteOptions & Pick; /** * Parser template with data. * {@link https://kythuen.github.io/ephemeras/parser/FileParser | View Details} * * @param options See {@link FileParserOptions }. * * @examples * ``` * import { FileParser, prettier } from '@ephemeras/parser' * * const parser = new FileParser({ * source: '/src/1.txt', * destination: '/dest/2.txt' * }) * * parser.set({ * overwrite: true, * plugins: [] * }) * * parser.use(prettier()) * * const result = await parser.build() * ``` */ declare class FileParser { options: FileParserOptions; constructor(options: Partial); set(prop: keyof FileParserOptions, value: any): this; set(props: Partial): this; source(src: string): this; destination(dest: string): this; use(plugin: ParserPlugin): this; build(): Promise; } export { FileParser, type FileParserOptions, type ParseResult, Parser, type ParserOptions, type ParserPlugin, type ParserPluginParams };