FSWatcher Class — vite Architecture
Architecture documentation for the FSWatcher class in chokidar.d.ts from the vite codebase.
Entity Profile
Dependency Diagram
graph TD 4fb934fd_5557_0d16_a062_0443c4f5b90e["FSWatcher"] f279c802_1870_ac62_8d1a_1bc76a30dc8e["chokidar.d.ts"] 4fb934fd_5557_0d16_a062_0443c4f5b90e -->|defined in| f279c802_1870_ac62_8d1a_1bc76a30dc8e 08119893_4d08_e63d_7d61_1e1b1437740d["constructor()"] 4fb934fd_5557_0d16_a062_0443c4f5b90e -->|method| 08119893_4d08_e63d_7d61_1e1b1437740d dedfff98_d8a3_948d_caa6_97361a8278bf["ref()"] 4fb934fd_5557_0d16_a062_0443c4f5b90e -->|method| dedfff98_d8a3_948d_caa6_97361a8278bf 7800f299_ff16_b536_759d_811c671686db["unref()"] 4fb934fd_5557_0d16_a062_0443c4f5b90e -->|method| 7800f299_ff16_b536_759d_811c671686db 8b30fc73_61da_1b55_7bba_2bc7c5c2bd6c["add()"] 4fb934fd_5557_0d16_a062_0443c4f5b90e -->|method| 8b30fc73_61da_1b55_7bba_2bc7c5c2bd6c 06e95559_bc42_99bc_00a6_9a57e9f9c08f["unwatch()"] 4fb934fd_5557_0d16_a062_0443c4f5b90e -->|method| 06e95559_bc42_99bc_00a6_9a57e9f9c08f c73047f9_e410_a9f1_888e_cba2b31da308["getWatched()"] 4fb934fd_5557_0d16_a062_0443c4f5b90e -->|method| c73047f9_e410_a9f1_888e_cba2b31da308 ff9ab43c_e0f4_8e0c_f7a9_1dd8dc17897b["close()"] 4fb934fd_5557_0d16_a062_0443c4f5b90e -->|method| ff9ab43c_e0f4_8e0c_f7a9_1dd8dc17897b 5a2dee0c_3621_1217_feeb_a0cd7ebf70e1["on()"] 4fb934fd_5557_0d16_a062_0443c4f5b90e -->|method| 5a2dee0c_3621_1217_feeb_a0cd7ebf70e1
Relationship Graph
Source Code
packages/vite/src/types/chokidar.d.ts lines 12–95
export class FSWatcher extends EventEmitter implements fs.FSWatcher {
options: WatchOptions
/**
* Constructs a new FSWatcher instance with optional WatchOptions parameter.
*/
constructor(options?: WatchOptions)
/**
* When called, requests that the Node.js event loop not exit so long as the fs.FSWatcher is active.
* Calling watcher.ref() multiple times will have no effect.
*/
ref(): this
/**
* When called, the active fs.FSWatcher object will not require the Node.js event loop to remain active.
* If there is no other activity keeping the event loop running, the process may exit before the fs.FSWatcher object's callback is invoked.
* Calling watcher.unref() multiple times will have no effect.
*/
unref(): this
/**
* Add files, directories, or glob patterns for tracking. Takes an array of strings or just one
* string.
*/
add(paths: string | ReadonlyArray<string>): this
/**
* Stop watching files, directories, or glob patterns. Takes an array of strings or just one
* string.
*/
unwatch(paths: string | ReadonlyArray<string>): this
/**
* Returns an object representing all the paths on the file system being watched by this
* `FSWatcher` instance. The object's keys are all the directories (using absolute paths unless
* the `cwd` option was used), and the values are arrays of the names of the items contained in
* each directory.
*/
getWatched(): {
[directory: string]: string[]
}
/**
* Removes all listeners from watched files.
*/
close(): Promise<void>
on(
event: 'add' | 'addDir' | 'change',
listener: (path: string, stats?: fs.Stats) => void,
): this
on(
event: 'all',
listener: (
eventName: 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir',
path: string,
stats?: fs.Stats,
) => void,
): this
/**
* Error occurred
*/
on(event: 'error', listener: (error: Error) => void): this
/**
* Exposes the native Node `fs.FSWatcher events`
*/
on(
event: 'raw',
listener: (eventName: string, path: string, details: any) => void,
): this
/**
* Fires when the initial scan is complete
*/
on(event: 'ready', listener: () => void): this
on(event: 'unlink' | 'unlinkDir', listener: (path: string) => void): this
Domain
Defined In
Source
Frequently Asked Questions
What is the FSWatcher class?
FSWatcher is a class in the vite codebase, defined in packages/vite/src/types/chokidar.d.ts.
Where is FSWatcher defined?
FSWatcher is defined in packages/vite/src/types/chokidar.d.ts at line 12.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free