UNPKG

@rushstack/heft

Version:

Build all your JavaScript projects the same way: A way that works.

75 lines 3.28 kB
/** * Information about an incremental build. This information is used to determine which files need to be rebuilt. * @beta */ export interface IIncrementalBuildInfo { /** * A string that represents the configuration inputs for the build. * If the configuration changes, the old build info object should be discarded. */ configHash: string; /** * A map of absolute input file paths to their version strings. * The version string should change if the file changes. */ inputFileVersions: Map<string, string>; /** * A map of absolute output file paths to the input files they were computed from. */ fileDependencies?: Map<string, string[]>; } /** * Serialized version of {@link IIncrementalBuildInfo}. * @beta */ export interface ISerializedIncrementalBuildInfo { /** * A string that represents the configuration inputs for the build. * If the configuration changes, the old build info object should be discarded. */ configHash: string; /** * A map of input files to their version strings. * File paths are specified relative to the folder containing the build info file. */ inputFileVersions: Record<string, string>; /** * Map of output file names to the corresponding index in `Object.entries(inputFileVersions)`. * File paths are specified relative to the folder containing the build info file. */ fileDependencies?: Record<string, number[]>; } /** * Converts an absolute path to a path relative to a base path. */ export declare const makePathRelative: (absolutePath: string, basePath: string) => string; /** * Serializes a build info object to a portable format that can be written to disk. * @param state - The build info to serialize * @param makePathPortable - A function that converts an absolute path to a portable path. This is a separate argument to support cross-platform tests. * @returns The serialized build info * @beta */ export declare function serializeBuildInfo(state: IIncrementalBuildInfo, makePathPortable: (absolutePath: string) => string): ISerializedIncrementalBuildInfo; /** * Deserializes a build info object from its portable format. * @param serializedBuildInfo - The build info to deserialize * @param makePathAbsolute - A function that converts a portable path to an absolute path. This is a separate argument to support cross-platform tests. * @returns The deserialized build info */ export declare function deserializeBuildInfo(serializedBuildInfo: ISerializedIncrementalBuildInfo, makePathAbsolute: (relativePath: string) => string): IIncrementalBuildInfo; /** * Writes a build info object to disk. * @param state - The build info to write * @param filePath - The file path to write the build info to * @beta */ export declare function writeBuildInfoAsync(state: IIncrementalBuildInfo, filePath: string): Promise<void>; /** * Reads a build info object from disk. * @param filePath - The file path to read the build info from * @returns The build info object, or undefined if the file does not exist or cannot be parsed * @beta */ export declare function tryReadBuildInfoAsync(filePath: string): Promise<IIncrementalBuildInfo | undefined>; //# sourceMappingURL=IncrementalBuildInfo.d.ts.map