UNPKG

@push.rocks/smartchok

Version:

A smart wrapper for chokidar 4.x with glob pattern support and enhanced features.

46 lines (45 loc) 1.31 kB
import * as plugins from './smartchok.plugins.js'; export type TSmartchokStatus = 'idle' | 'starting' | 'watching'; export type TFsEvent = 'add' | 'addDir' | 'change' | 'error' | 'unlink' | 'unlinkDir' | 'ready' | 'raw'; /** * Smartchok allows easy wathcing of files */ export declare class Smartchok { watchStringmap: plugins.lik.Stringmap; status: TSmartchokStatus; private watcher; private globPatterns; private globMatchers; private watchingDeferred; private eventObservablemap; /** * constructor of class smartchok */ constructor(watchArrayArg: string[]); private getGlobBase; /** * adds files to the list of watched files */ add(pathArrayArg: string[]): void; /** * removes files from the list of watched files */ remove(pathArg: string): void; /** * gets an observable for a certain event */ getObservableFor(fsEvent: TFsEvent): Promise<plugins.smartrx.rxjs.Observable<[string, plugins.fs.Stats]>>; /** * starts the watcher * @returns Promise<void> */ start(): Promise<void>; /** * stop the watcher process if watching */ stop(): Promise<void>; /** * Checks if a path should be watched based on glob patterns */ private shouldWatchPath; }