export = FileSystemInfo; /** * Used to access information about the filesystem in a cached way */ declare class FileSystemInfo { /** * @param {InputFileSystem} fs file system * @param {Object} options options * @param {Iterable=} options.managedPaths paths that are only managed by a package manager * @param {Iterable=} options.immutablePaths paths that are immutable * @param {Logger=} options.logger logger used to log invalid snapshots * @param {string | Hash=} options.hashFunction the hash function to use */ constructor( fs: InputFileSystem, { managedPaths, immutablePaths, logger, hashFunction, }?: { managedPaths?: Iterable | undefined; immutablePaths?: Iterable | undefined; logger?: Logger | undefined; hashFunction?: (string | Hash) | undefined; }, ); fs: import('./util/fs').InputFileSystem; logger: import('./logging/Logger').Logger; _remainingLogs: number; _loggedPaths: Set; _hashFunction: string | typeof import('./util/Hash'); /** @type {WeakMap} */ _snapshotCache: WeakMap< Snapshot, | boolean | ((arg0?: WebpackError | undefined, arg1?: boolean | undefined) => void)[] >; _fileTimestampsOptimization: SnapshotOptimization; _fileHashesOptimization: SnapshotOptimization; _fileTshsOptimization: SnapshotOptimization; _contextTimestampsOptimization: SnapshotOptimization; _contextHashesOptimization: SnapshotOptimization; _contextTshsOptimization: SnapshotOptimization; _missingExistenceOptimization: SnapshotOptimization; _managedItemInfoOptimization: SnapshotOptimization; _managedFilesOptimization: SnapshotOptimization; _managedContextsOptimization: SnapshotOptimization; _managedMissingOptimization: SnapshotOptimization; /** @type {StackedCacheMap} */ _fileTimestamps: StackedCacheMap< string, FileSystemInfoEntry | 'ignore' | null >; /** @type {Map} */ _fileHashes: Map; /** @type {Map} */ _fileTshs: Map; /** @type {StackedCacheMap} */ _contextTimestamps: StackedCacheMap< string, ContextFileSystemInfoEntry | 'ignore' | null >; /** @type {Map} */ _contextHashes: Map; /** @type {Map} */ _contextTshs: Map; /** @type {Map} */ _managedItems: Map; /** @type {AsyncQueue} */ fileTimestampQueue: AsyncQueue; /** @type {AsyncQueue} */ fileHashQueue: AsyncQueue; /** @type {AsyncQueue} */ contextTimestampQueue: AsyncQueue< string, string, ContextFileSystemInfoEntry | null >; /** @type {AsyncQueue} */ contextHashQueue: AsyncQueue; /** @type {AsyncQueue} */ contextTshQueue: AsyncQueue; /** @type {AsyncQueue} */ managedItemQueue: AsyncQueue; /** @type {AsyncQueue>} */ managedItemDirectoryQueue: AsyncQueue>; managedPaths: (string | RegExp)[]; managedPathsWithSlash: string[]; managedPathsRegExps: RegExp[]; immutablePaths: (string | RegExp)[]; immutablePathsWithSlash: string[]; immutablePathsRegExps: RegExp[]; _cachedDeprecatedFileTimestamps: Map; _cachedDeprecatedContextTimestamps: Map; _warnAboutExperimentalEsmTracking: boolean; _statCreatedSnapshots: number; _statTestedSnapshotsCached: number; _statTestedSnapshotsNotCached: number; _statTestedChildrenCached: number; _statTestedChildrenNotCached: number; _statTestedEntries: number; logStatistics(): void; /** * @param {string} path path * @param {string} reason reason * @param {any[]} args arguments */ _log(path: string, reason: string, ...args: any[]): void; clear(): void; /** * @param {ReadonlyMap} map timestamps * @param {boolean=} immutable if 'map' is immutable and FileSystemInfo can keep referencing it * @returns {void} */ addFileTimestamps( map: ReadonlyMap, immutable?: boolean | undefined, ): void; /** * @param {ReadonlyMap} map timestamps * @param {boolean=} immutable if 'map' is immutable and FileSystemInfo can keep referencing it * @returns {void} */ addContextTimestamps( map: ReadonlyMap, immutable?: boolean | undefined, ): void; /** * @param {string} path file path * @param {function((WebpackError | null)=, (FileSystemInfoEntry | "ignore" | null)=): void} callback callback function * @returns {void} */ getFileTimestamp( path: string, callback: ( arg0: (WebpackError | null) | undefined, arg1: (FileSystemInfoEntry | 'ignore' | null) | undefined, ) => void, ): void; /** * @param {string} path context path * @param {function((WebpackError | null)=, (ResolvedContextFileSystemInfoEntry | "ignore" | null)=): void} callback callback function * @returns {void} */ getContextTimestamp( path: string, callback: ( arg0: (WebpackError | null) | undefined, arg1: (ResolvedContextFileSystemInfoEntry | 'ignore' | null) | undefined, ) => void, ): void; /** * @param {string} path context path * @param {function((WebpackError | null)=, (ContextFileSystemInfoEntry | "ignore" | null)=): void} callback callback function * @returns {void} */ _getUnresolvedContextTimestamp( path: string, callback: ( arg0: (WebpackError | null) | undefined, arg1: (ContextFileSystemInfoEntry | 'ignore' | null) | undefined, ) => void, ): void; /** * @param {string} path file path * @param {function((WebpackError | null)=, (string | null)=): void} callback callback function * @returns {void} */ getFileHash( path: string, callback: ( arg0: (WebpackError | null) | undefined, arg1: (string | null) | undefined, ) => void, ): void; /** * @param {string} path context path * @param {function((WebpackError | null)=, string=): void} callback callback function * @returns {void} */ getContextHash( path: string, callback: ( arg0: (WebpackError | null) | undefined, arg1: string | undefined, ) => void, ): void; /** * @param {string} path context path * @param {function((WebpackError | null)=, (ContextHash | null)=): void} callback callback function * @returns {void} */ _getUnresolvedContextHash( path: string, callback: ( arg0: (WebpackError | null) | undefined, arg1: (ContextHash | null) | undefined, ) => void, ): void; /** * @param {string} path context path * @param {function((WebpackError | null)=, ResolvedContextTimestampAndHash=): void} callback callback function * @returns {void} */ getContextTsh( path: string, callback: ( arg0: (WebpackError | null) | undefined, arg1: ResolvedContextTimestampAndHash | undefined, ) => void, ): void; /** * @param {string} path context path * @param {function((WebpackError | null)=, (ContextTimestampAndHash | null)=): void} callback callback function * @returns {void} */ _getUnresolvedContextTsh( path: string, callback: ( arg0: (WebpackError | null) | undefined, arg1: (ContextTimestampAndHash | null) | undefined, ) => void, ): void; _createBuildDependenciesResolvers(): { resolveContext: import('enhanced-resolve').ResolveFunctionAsync; resolveEsm: import('enhanced-resolve').ResolveFunctionAsync; resolveCjs: import('enhanced-resolve').ResolveFunctionAsync; resolveCjsAsChild: import('enhanced-resolve').ResolveFunctionAsync; }; /** * @param {string} context context directory * @param {Iterable} deps dependencies * @param {function((Error | null)=, ResolveBuildDependenciesResult=): void} callback callback function * @returns {void} */ resolveBuildDependencies( context: string, deps: Iterable, callback: ( arg0: (Error | null) | undefined, arg1: ResolveBuildDependenciesResult | undefined, ) => void, ): void; /** * @param {Map} resolveResults results from resolving * @param {function((Error | null)=, boolean=): void} callback callback with true when resolveResults resolve the same way * @returns {void} */ checkResolveResultsValid( resolveResults: Map, callback: ( arg0: (Error | null) | undefined, arg1: boolean | undefined, ) => void, ): void; /** * * @param {number | null | undefined} startTime when processing the files has started * @param {Iterable} files all files * @param {Iterable} directories all directories * @param {Iterable} missing all missing files or directories * @param {SnapshotOptions | null | undefined} options options object (for future extensions) * @param {function((WebpackError | null)=, (Snapshot | null)=): void} callback callback function * @returns {void} */ createSnapshot( startTime: number | null | undefined, files: Iterable, directories: Iterable, missing: Iterable, options: SnapshotOptions | null | undefined, callback: ( arg0: (WebpackError | null) | undefined, arg1: (Snapshot | null) | undefined, ) => void, ): void; /** * @param {Snapshot} snapshot1 a snapshot * @param {Snapshot} snapshot2 a snapshot * @returns {Snapshot} merged snapshot */ mergeSnapshots(snapshot1: Snapshot, snapshot2: Snapshot): Snapshot; /** * @param {Snapshot} snapshot the snapshot made * @param {function((WebpackError | null)=, boolean=): void} callback callback function * @returns {void} */ checkSnapshotValid( snapshot: Snapshot, callback: ( arg0: (WebpackError | null) | undefined, arg1: boolean | undefined, ) => void, ): void; /** * @param {Snapshot} snapshot the snapshot made * @param {function((WebpackError | null)=, boolean=): void} callback callback function * @returns {void} */ _checkSnapshotValidNoCache( snapshot: Snapshot, callback: ( arg0: (WebpackError | null) | undefined, arg1: boolean | undefined, ) => void, ): void; _readFileTimestamp(path: any, callback: any): void; _readFileHash(path: any, callback: any): void; _getFileTimestampAndHash(path: any, callback: any): void; /** * @template T * @template ItemType * @param {Object} options options * @param {string} options.path path * @param {function(string): ItemType} options.fromImmutablePath called when context item is an immutable path * @param {function(string): ItemType} options.fromManagedItem called when context item is a managed path * @param {function(string, string, function(Error=, ItemType=): void): void} options.fromSymlink called when context item is a symlink * @param {function(string, IStats, function(Error=, ItemType=): void): void} options.fromFile called when context item is a file * @param {function(string, IStats, function(Error=, ItemType=): void): void} options.fromDirectory called when context item is a directory * @param {function(string[], ItemType[]): T} options.reduce called from all context items * @param {function((Error | null)=, (T | null)=): void} callback callback */ _readContext( { path, fromImmutablePath, fromManagedItem, fromSymlink, fromFile, fromDirectory, reduce, }: { path: string; fromImmutablePath: (arg0: string) => ItemType; fromManagedItem: (arg0: string) => ItemType; fromSymlink: ( arg0: string, arg1: string, arg2: (arg0?: Error | undefined, arg1?: ItemType) => void, ) => void; fromFile: ( arg0: string, arg1: IStats, arg2: (arg0?: Error | undefined, arg1?: ItemType) => void, ) => void; fromDirectory: ( arg0: string, arg1: IStats, arg2: (arg0?: Error | undefined, arg1?: ItemType) => void, ) => void; reduce: (arg0: string[], arg1: ItemType[]) => T; }, callback: (arg0?: (Error | null) | undefined, arg1?: T) => void, ): void; _readContextTimestamp(path: any, callback: any): void; /** * @param {ContextFileSystemInfoEntry} entry entry * @param {function((Error | null)=, ResolvedContextFileSystemInfoEntry=): void} callback callback * @returns {void} */ _resolveContextTimestamp( entry: ContextFileSystemInfoEntry, callback: ( arg0: (Error | null) | undefined, arg1: ResolvedContextFileSystemInfoEntry | undefined, ) => void, ): void; _readContextHash(path: any, callback: any): void; /** * @param {ContextHash} entry context hash * @param {function((Error | null)=, string=): void} callback callback * @returns {void} */ _resolveContextHash( entry: ContextHash, callback: ( arg0: (Error | null) | undefined, arg1: string | undefined, ) => void, ): void; _readContextTimestampAndHash(path: any, callback: any): void; /** * @param {ContextTimestampAndHash} entry entry * @param {function((Error | null)=, ResolvedContextTimestampAndHash=): void} callback callback * @returns {void} */ _resolveContextTsh( entry: ContextTimestampAndHash, callback: ( arg0: (Error | null) | undefined, arg1: ResolvedContextTimestampAndHash | undefined, ) => void, ): void; _getManagedItemDirectoryInfo(path: any, callback: any): void; _getManagedItemInfo(path: any, callback: any): void; getDeprecatedFileTimestamps(): Map; getDeprecatedContextTimestamps(): Map; } declare namespace FileSystemInfo { export { Snapshot, WebpackError, Logger, ObjectDeserializerContext, ObjectSerializerContext, Hash, IStats, InputFileSystem, FileSystemInfoEntry, ResolvedContextFileSystemInfoEntry, ContextFileSystemInfoEntry, TimestampAndHash, ResolvedContextTimestampAndHash, ContextTimestampAndHash, ContextHash, SnapshotOptimizationEntry, ResolveBuildDependenciesResult, SnapshotOptions, }; } declare class Snapshot { _flags: number; /** @type {Iterable | undefined} */ _cachedFileIterable: Iterable | undefined; /** @type {Iterable | undefined} */ _cachedContextIterable: Iterable | undefined; /** @type {Iterable | undefined} */ _cachedMissingIterable: Iterable | undefined; /** @type {number | undefined} */ startTime: number | undefined; /** @type {Map | undefined} */ fileTimestamps: Map | undefined; /** @type {Map | undefined} */ fileHashes: Map | undefined; /** @type {Map | undefined} */ fileTshs: Map | undefined; /** @type {Map | undefined} */ contextTimestamps: | Map | undefined; /** @type {Map | undefined} */ contextHashes: Map | undefined; /** @type {Map | undefined} */ contextTshs: Map | undefined; /** @type {Map | undefined} */ missingExistence: Map | undefined; /** @type {Map | undefined} */ managedItemInfo: Map | undefined; /** @type {Set | undefined} */ managedFiles: Set | undefined; /** @type {Set | undefined} */ managedContexts: Set | undefined; /** @type {Set | undefined} */ managedMissing: Set | undefined; /** @type {Set | undefined} */ children: Set | undefined; hasStartTime(): boolean; setStartTime(value: any): void; setMergedStartTime(value: any, snapshot: any): void; hasFileTimestamps(): boolean; setFileTimestamps(value: any): void; hasFileHashes(): boolean; setFileHashes(value: any): void; hasFileTshs(): boolean; setFileTshs(value: any): void; hasContextTimestamps(): boolean; setContextTimestamps(value: any): void; hasContextHashes(): boolean; setContextHashes(value: any): void; hasContextTshs(): boolean; setContextTshs(value: any): void; hasMissingExistence(): boolean; setMissingExistence(value: any): void; hasManagedItemInfo(): boolean; setManagedItemInfo(value: any): void; hasManagedFiles(): boolean; setManagedFiles(value: any): void; hasManagedContexts(): boolean; setManagedContexts(value: any): void; hasManagedMissing(): boolean; setManagedMissing(value: any): void; hasChildren(): boolean; setChildren(value: any): void; addChild(child: any): void; /** * @param {ObjectSerializerContext} context context */ serialize({ write }: ObjectSerializerContext): void; /** * @param {ObjectDeserializerContext} context context */ deserialize({ read }: ObjectDeserializerContext): void; /** * @param {function(Snapshot): (ReadonlyMap | ReadonlySet)[]} getMaps first * @returns {Iterable} iterable */ _createIterable( getMaps: ( arg0: Snapshot, ) => (ReadonlyMap | ReadonlySet)[], ): Iterable; /** * @returns {Iterable} iterable */ getFileIterable(): Iterable; /** * @returns {Iterable} iterable */ getContextIterable(): Iterable; /** * @returns {Iterable} iterable */ getMissingIterable(): Iterable; } type WebpackError = import('./WebpackError'); type FileSystemInfoEntry = { safeTime: number; timestamp?: number | undefined; }; /** * @template T */ declare class SnapshotOptimization { /** * @param {function(Snapshot): boolean} has has value * @param {function(Snapshot): Map | Set} get get value * @param {function(Snapshot, Map | Set): void} set set value * @param {boolean=} useStartTime use the start time of snapshots * @param {boolean=} isSet value is an Set instead of a Map */ constructor( has: (arg0: Snapshot) => boolean, get: (arg0: Snapshot) => Map | Set, set: (arg0: Snapshot, arg1: Map | Set) => void, useStartTime?: boolean | undefined, isSet?: boolean | undefined, ); _has: (arg0: Snapshot) => boolean; _get: (arg0: Snapshot) => Map | Set; _set: (arg0: Snapshot, arg1: Map | Set) => void; _useStartTime: boolean; _isSet: boolean; /** @type {Map} */ _map: Map; _statItemsShared: number; _statItemsUnshared: number; _statSharedSnapshots: number; _statReusedSharedSnapshots: number; getStatisticMessage(): string; clear(): void; /** * @param {Snapshot} newSnapshot snapshot * @param {Set} capturedFiles files to snapshot/share * @returns {void} */ optimize(newSnapshot: Snapshot, capturedFiles: Set): void; } type TimestampAndHash = { safeTime: number; timestamp?: number | undefined; hash: string; }; type ResolvedContextFileSystemInfoEntry = { safeTime: number; timestampHash?: string | undefined; }; type ResolvedContextTimestampAndHash = { safeTime: number; timestampHash?: string | undefined; hash: string; }; import StackedCacheMap = require('./util/StackedCacheMap'); type ContextFileSystemInfoEntry = { safeTime: number; timestampHash?: string | undefined; resolved?: ResolvedContextFileSystemInfoEntry | undefined; symlinks?: Set | undefined; }; type ContextHash = { hash: string; resolved?: string | undefined; symlinks?: Set | undefined; }; type ContextTimestampAndHash = { safeTime: number; timestampHash?: string | undefined; hash: string; resolved?: ResolvedContextTimestampAndHash | undefined; symlinks?: Set | undefined; }; import AsyncQueue = require('./util/AsyncQueue'); type ResolveBuildDependenciesResult = { /** * list of files */ files: Set; /** * list of directories */ directories: Set; /** * list of missing entries */ missing: Set; /** * stored resolve results */ resolveResults: Map; /** * dependencies of the resolving */ resolveDependencies: { files: Set; directories: Set; missing: Set; }; }; type SnapshotOptions = { /** * should use hash to snapshot */ hash?: boolean | undefined; /** * should use timestamp to snapshot */ timestamp?: boolean | undefined; }; type IStats = import('./util/fs').IStats; type InputFileSystem = import('./util/fs').InputFileSystem; type Logger = import('./logging/Logger').Logger; type Hash = typeof import('./util/Hash'); type ObjectDeserializerContext = import('./serialization/ObjectMiddleware').ObjectDeserializerContext; type ObjectSerializerContext = import('./serialization/ObjectMiddleware').ObjectSerializerContext; type SnapshotOptimizationEntry = { snapshot: Snapshot; shared: number; snapshotContent: Set | undefined; children: Set | undefined; };