import Runner from 'mini-runner'; import { ITags, ITransformed, ITree } from './Bulldog'; import { Process } from './processes/Process'; /** * Manages processes and changes in assets */ export declare class Processor { /** * Directory to be processed */ inputDir: string; /** * Directory to place processed assets */ outputDir: string; /** * Array of processes to be called */ processes: Process[]; /** * An object of transformed trees */ transformHash: { [x: string]: ITransformed[]; }; /** * An object of trees */ hash: { [x: string]: ITree; }; /** * A runner that calls the start function of a process */ onStart: Runner; /** * A runner that calls the finish function of a process */ onFinish: Runner; /** * If true will copy file into output * @defaultValue true */ copy: boolean; /** * Time a tree was modified */ modifiedTime: number; /** * A count used to determine if all processes have resolved */ count: number; /** * @param inputDir - Directory to be processed * @param outputDir - Directory to output processed files * @param copy - If true will copy file into output */ constructor(inputDir: string, outputDir: string, copy?: boolean); /** * Adds a plugin * * @param process - A Bulldog compatible plugin. Gets added to onStart and onFinish runners */ addProcess(process: T): void; /** * Processes the tree and calls the plugins * * @param tree - The tree to be processed * @returns Empty promise */ run(tree: ITree): Promise; /** * Creates a promise that resolves when all processes have completed. * * @param tree - Tre to be processed. * @param treeProcess - Function to be called that processes the tree. * @returns A promise that completes once all the processes have completed. */ runTreeProcess(tree: ITree, treeProcess: (tree: ITree, complete: () => void) => void): Promise; /** * Converts the inputPath into the relevant outputPath. * If desired, you can also swap the file extension. * * @param inputPath - the original file path. * @param extension - an optional extension to swap with the input path. * @returns The converted input. */ convertToOutput(inputPath: string, extension?: string): string; /** * Adds files that have been transformed into the tree. * * @param outputName - Path of the file. * @param tree - Tree that will have transformed files added too. * @param isFolder - Whether transformed file is a folder. * @param tags - Tags that are associated with the folder. * @param transformId - Unique id for the transformed file. * @param transformData - any optional data you want to pass in with the transform. */ addTransformedFileToTree(outputName: string, tree: ITree, isFolder?: boolean, tags?: ITags, transformId?: string, transformData?: Record): void; /** * Recursively checks for the deleted state of the files in a tree. If found then its removed from the tree and process.delete() is called. * @param tree - Tree to be processed. * @param complete - Callback for when processing has completed. */ cleanTree(tree: ITree, complete?: () => void): void; /** * Recursively loops through a tree and called the transform function on a process if the tree was added or modified * @param tree - Tree to be processed * @param complete - Callback for when processing has completed. */ transformTree(tree: ITree, complete: () => void): void; /** * Recursively loops through a tree and called the test and post function on a process if the tree was added or modified * @param tree - Tree to be processed. * @param complete - Callback for when processing has completed. */ postTree(tree: ITree, complete: () => void): void; /** * Runs the test and post functions of processes. * * @param processList - Array of plugins. * @param outfile - File to be processed. * @param complete - callback fired when al processes have finished. */ asyncPostProcess(processList: Process[], outfile: ITransformed, complete: () => void): void; } //# sourceMappingURL=Processor.d.ts.map