import { onWatchedDataAddHandler, onWatchedDataChangeHandler, onWatchedDataRemoveHandler, onWatchedDataRenameHandler, OnWatchedDataUpdateHandler, WatchOptions } from "../docs/docs"; export declare class Watcher { #private; constructor(path_: string, type: 'File' | 'Directory', watchOptions?: WatchOptions); /** * Returns a read-only object containing the include and exclude filters for the watched directory. * If the watched object is a file, the returned object will contain empty arrays for both `include` and `exclude`. * @returns A read-only object containing the include and exclude filters. * @private */ get _filters(): { include: (string | RegExp)[]; exclude: (string | RegExp)[]; }; /** * A read-only object containing the user-provided handlers for the watched file or directory. * The properties of this object are: * - `onUpdate`: Triggered when the watched object has been updated. * - `onRemove`: Triggered when the watched object has been removed. * - `onRename`: Triggered when the watched object has been renamed. * - `onAdd`: Triggered when the watched object has been added. * - `onChange`: Triggered when the watched object has been changed (includes all other events). * @returns A read-only object containing the user-provided handlers. * @private */ get _handlers(): { onUpdate: OnWatchedDataUpdateHandler; onRemove: onWatchedDataRemoveHandler; onRename: onWatchedDataRenameHandler; onAdd: onWatchedDataAddHandler; onChange: onWatchedDataChangeHandler; onRootRemoved: () => void; }; /** * The type of the watched object, either `File` or `Directory`. * @returns The type of the watched object. */ get type(): "File" | "Directory"; /** * The path of the watched object. * @returns The path of the watched object. */ get path(): string; /** * Sets the handler for the "rootRemoved" event, which is called when the watched * directory or file is removed. The handler will be called with no arguments. * @param handler The handler to call when the watched directory or file is removed. */ onRootRemoved(handler: () => void): void; /** * Sets the handler for the "update" event, which is called whenever the watched files are modified. * @param handler The handler to call when the watched files are modified. The handler must take a single argument, which is the path of the file that was modified. */ onUpdate(handler: OnWatchedDataUpdateHandler): void; /** * Sets the handler for the "remove" event, which is called whenever a watched file or directory is removed. * @param handler The handler to call when a watched file or directory is removed. The handler must take a single argument, which is the path of the file or directory that was removed. */ onRemove(handler: onWatchedDataRemoveHandler): void; /** * Sets the handler for the "rename" event, which is called whenever a watched file or directory is renamed. * @param handler The handler to call when a watched file or directory is renamed. The handler must take two arguments, which are the old path and the new path of the renamed file or directory. */ onRename(handler: onWatchedDataRenameHandler): void; /** * Sets the handler for the "add" event, which is called whenever a file or directory is added to a watched directory. * @param handler The handler to call when a file or directory is added to a watched directory. The handler must take a single argument, which is the path of the added file or directory. */ onAdd(handler: onWatchedDataRemoveHandler): void; /** * Sets the handler for the "change" event, which is called whenever a watched file or directory is changed. * @param handler The handler to call when a watched file or directory is changed. The handler must take a single argument, which is the path of the file or directory that was changed. */ onChange(handler: onWatchedDataChangeHandler): void; /** * Renames the currently watched path to the specified new path. * * **Note:** This method is called internally when a file or directory is renamed. * @param path_ The new path to rename the watched object to. * @private Do NOT call this method. */ _renameTo(path_: string): void; } export default Watcher;