type ChangeOrigin = string;
type ChangeTimestamp = number;
type ChangeContents = string;
interface ChangeMeta {
    origin: ChangeOrigin;
    timestamp: ChangeTimestamp;
}
interface Change extends ChangeMeta {
    contents: ChangeContents;
}
type DiffTuple = [-1 | 0 | 1, string[]];
type FlatDiffTuple = [-1 | 0 | 1, string];
declare class ChangeLog {
    changes: Map<string, FileChanges>;
    add(path: string, contents: ChangeContents, origin?: ChangeOrigin): void;
    get(path: string): FileChanges | undefined;
}

declare class FileChanges {
    path: string;
    private log;
    constructor(path: string);
    list(): {
        index: number;
        timestamp: ChangeTimestamp;
        origin: ChangeOrigin;
    }[];
    stackChange(contents: ChangeContents, origin?: ChangeOrigin): void;
    get(index: number): Change;
    diff(prevIndex: number, nextIndex: number): {
        diff: FlatDiffTuple[];
        flat: string[];
        formatted: string[];
        log(): void;
    };
}

interface OutputCollectionOptions {
    outDir: string;
    dry: boolean;
    logChanges: boolean;
}
interface OutputCollectionEventMap {
    'file:stacked': {
        path: string;
        origin: string;
        contents: string;
    };
    'write:start': {
        index: number;
        total: number;
    };
    'write:file-written': {
        path: string;
        index: number;
        total: number;
    };
    'write:file-error': {
        path: string;
        index: number;
        total: number;
        error: Error;
    };
    'write:done': {
        index: number;
        total: number;
    };
}
declare class Writepool {
    static instance: Writepool;
    private emitter;
    private changeLog;
    files: Map<string, string>;
    origin?: string;
    rootCollection: this;
    private options;
    on: <E extends keyof OutputCollectionEventMap>(name: E, listener: (payload: OutputCollectionEventMap[E]) => void) => void;
    once: <E extends keyof OutputCollectionEventMap>(name: E, listener: (payload: OutputCollectionEventMap[E]) => void) => void;
    constructor(options?: Partial<OutputCollectionOptions>);
    get size(): number;
    static getInstance(options?: Partial<OutputCollectionOptions>): Writepool;
    withOrigin(name: string): Writepool;
    get(path: string): [string, string];
    get(predicate: (path: string, contents: string) => boolean): [string, string];
    write(path: string, contents: string, origin?: string): void;
    getChanges(path: string): FileChanges;
    writeFilesToDisk(options?: Partial<OutputCollectionOptions>): Generator<{
        path: string;
        index: number;
        total: number;
    }, void, unknown>;
}

export { type Change, type ChangeContents, ChangeLog, type ChangeMeta, type ChangeOrigin, type ChangeTimestamp, type DiffTuple, FileChanges, type FlatDiffTuple, Writepool };
