UNPKG

@plugjs/plug

Version:
46 lines (45 loc) 2.04 kB
import type { AbsolutePath } from './paths'; /** The {@link FilesBuilder} interface defines a builder for {@link Files}. */ export interface FilesBuilder { /** The (resolved) directory the {@link Files} will be associated with */ readonly directory: AbsolutePath; /** * Push files into the {@link Files} instance being built. * * This method will not check that files actually exist on disk. */ add(...files: string[]): this; /** Merge orther {@link Files} instance to the {@link Files} being built */ merge(...files: Files[]): this; /** Write a file and add it to the {@link Files} instance being built */ write(file: string, content: string | Uint8Array): Promise<AbsolutePath>; /** Build and return a {@link Files} instance */ build(): Files; } /** * The {@link Files} class represents a collection of relative path names * identifying some _files_ rooted in a given _directory_. */ export declare class Files { private readonly _directory; private readonly _files; /** * Create a new {@link Files} instance rooted in the specified `directory` * relative to the specified {@link Run}'s directory. */ constructor(directory?: AbsolutePath); /** Return the _directory_ where this {@link Files} is rooted */ get directory(): AbsolutePath; /** Return the number of files tracked by this instance. */ get length(): number; /** Return an iterator over all _relative_ files of this instance */ [Symbol.iterator](): Generator<string>; /** Return an iterator over all _absolute_ files of this instance */ absolutePaths(): Generator<AbsolutePath>; /** Return an iterator over all _relative_ to _absolute_ mappings */ pathMappings(): Generator<[relative: string, absolute: AbsolutePath]>; /** Create a new {@link FilesBuilder} creating {@link Files} instances. */ static builder(): FilesBuilder; static builder(files: Files): FilesBuilder; static builder(directory: AbsolutePath): FilesBuilder; }