import { IFile } from "./file.types"; import { BuildLogger } from "../build-logger"; import { IFileMap } from "./file-map.types"; /** * Legacy name: ModuleMap */ /** * A map of files * @typeParam T The type of the file content */ export declare class FileMap implements IFileMap { protected readonly logger: BuildLogger; private map; constructor(logger: BuildLogger); /** * Merge another map into this map * * @param anotherMap The map to merge into this map * @returns This map */ merge(anotherMap: FileMap): Promise>; /** * Merge many maps into this map * @param maps The maps to merge into this map * @returns This map * @see merge */ mergeMany(maps: FileMap[]): Promise; /** * Set a file in the map. If the file already exists, it will be overwritten and a log message will be printed. * @param file The file to add to the set */ set(file: IFile): Promise; /** * @returns A file for the given path, or undefined if no file exists for the path */ get(path: string): IFile | null; /** * Replace a file in the map. If the file does not exist, it will be added to the set. * @param oldFile The file to replace * @param newFile The new file to replace the old file with */ replace(oldFile: IFile, newFile: IFile): void; /** * Replace all files paths using a function * @param fn A function that receives a file path and returns a new path */ replaceFilesPath(fn: (path: string) => string): void; /** * Remove files from the map * @param paths An array of file paths to remove */ removeMany(paths: string[]): void; /** * Replace all files code using a function * @param fn A function that receives a file code and returns a new code */ replaceFilesCode(fn: (path: string, code: T) => T): Promise; /** * @returns All files in the map */ getAll(): IterableIterator>; }