import Watchpack, { type WatchOptions } from 'watchpack'; import type { Compiler, RspackPluginInstance, WatchFileSystem } from '@rspack/core'; export interface InputFileSystem { readFile: (...args: any[]) => void; readlink: (...args: any[]) => void; readdir: (...args: any[]) => void; stat: (...args: any[]) => void; purge?: (files?: string | string[] | Set) => void; [key: string]: any; } export type WatchCallback = Parameters[5]; export type WatchUndelayedCallback = Parameters[6]; export type Watcher = ReturnType; export type WatcherInfo = ReturnType['getInfo']>; export declare class DeferredWatchFileSystem implements WatchFileSystem { #private; readonly inputFileSystem: InputFileSystem; readonly watcherOptions: WatchOptions; watcher: Watchpack | undefined; constructor(inputFileSystem: InputFileSystem, onChange: () => void); flush(): boolean; /** * Like {@link DeferredWatchFileSystem.flush}, but first lets watchpack finish recording the file system events * that it has already received. * * @remarks * Watchpack records a changed file only after an asynchronous `fs.lstat()` of it, so a file that an upstream * task wrote just before a call to `flush()` can be missing from the changes. This method waits until the * directory watchers have no events or scans in progress, for up to 1 second. If there are changes, it then * waits for the clock to pass the time when they were recorded. The compilation that the callback starts takes * its start time from the clock, and the next `watch()` call reports every change recorded at or after that * start time again, as "outdated on attach". * * While this method waits, it keeps the changes that the watcher reports for the flush, and doesn't call * `onChange` for them. */ flushAsync(): Promise; watch(files: Iterable, directories: Iterable, missing: Iterable, startTime: number, options: WatchOptions, callback: WatchCallback, callbackUndelayed: WatchUndelayedCallback): Watcher; } export declare class OverrideNodeWatchFSPlugin implements RspackPluginInstance { #private; readonly fileSystems: Set; constructor(onChange: () => void); apply(compiler: Compiler): void; } //# sourceMappingURL=DeferredWatchFileSystem.d.ts.map