@rushstack/heft
Version:
Build all your JavaScript projects the same way: A way that works.
71 lines • 2.32 kB
TypeScript
import type { FileSystemAdapter } from 'fast-glob';
/**
* Information about the state of a watched file.
* @public
*/
export interface IWatchedFileState {
/**
* If the file has changed since the last invocation.
*/
changed: boolean;
}
/**
* Interface contract for `WatchFileSystemAdapter` for cross-version compatibility
*/
export interface IWatchFileSystemAdapter extends FileSystemAdapter {
/**
* Prepares for incoming glob requests. Any file changed after this method is called
* will trigger teh watch callback in the next invocation.
* File mtimes will be recorded at this time for any files that do not receive explicit
* stat() or lstat() calls.
*/
setBaseline(): void;
/**
* Watches all files that have been accessed since `prepare()` was called.
* Clears the tracked file lists.
*/
watch(onChange: () => void): void;
/**
* Tells the adapter to track the specified file (or folder) as used.
* Returns an object containing data about the state of said file (or folder).
*/
getStateAndTrackAsync(filePath: string): Promise<IWatchedFileState>;
}
/**
* A filesystem adapter for use with the "fast-glob" package. This adapter tracks file system accesses
* to initialize `watchpack`.
*/
export declare class WatchFileSystemAdapter implements IWatchFileSystemAdapter {
private _files;
private _contexts;
private _missing;
private _watcher;
private _lastFiles;
private _lastQueryTime;
private _times;
/** { @inheritdoc fs.readdirSync } */
readdirSync: FileSystemAdapter['readdirSync'];
/** { @inheritdoc fs.readdir } */
readdir: FileSystemAdapter['readdir'];
/** { @inheritdoc fs.lstat } */
lstat: FileSystemAdapter['lstat'];
/** { @inheritdoc fs.lstatSync } */
lstatSync: FileSystemAdapter['lstatSync'];
/** { @inheritdoc fs.stat } */
stat: FileSystemAdapter['stat'];
/** { @inheritdoc fs.statSync } */
statSync: FileSystemAdapter['statSync'];
/**
* @inheritdoc
*/
setBaseline(): void;
/**
* @inheritdoc
*/
watch(onChange: () => void): void;
/**
* @inheritdoc
*/
getStateAndTrackAsync(filePath: string): Promise<IWatchedFileState>;
}
//# sourceMappingURL=WatchFileSystemAdapter.d.ts.map