source: imaps-frontend/node_modules/chokidar/handler.d.ts@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 3.8 KB
Line 
1import type { WatchEventType, Stats, FSWatcher as NativeFsWatcher } from 'fs';
2import type { FSWatcher, WatchHelper, Throttler } from './index.js';
3import type { EntryInfo } from 'readdirp';
4export type Path = string;
5export declare const STR_DATA = "data";
6export declare const STR_END = "end";
7export declare const STR_CLOSE = "close";
8export declare const EMPTY_FN: () => void;
9export declare const IDENTITY_FN: (val: unknown) => unknown;
10export declare const isWindows: boolean;
11export declare const isMacos: boolean;
12export declare const isLinux: boolean;
13export declare const isFreeBSD: boolean;
14export declare const isIBMi: boolean;
15export declare const EVENTS: {
16 readonly ALL: "all";
17 readonly READY: "ready";
18 readonly ADD: "add";
19 readonly CHANGE: "change";
20 readonly ADD_DIR: "addDir";
21 readonly UNLINK: "unlink";
22 readonly UNLINK_DIR: "unlinkDir";
23 readonly RAW: "raw";
24 readonly ERROR: "error";
25};
26export type EventName = (typeof EVENTS)[keyof typeof EVENTS];
27export type FsWatchContainer = {
28 listeners: (path: string) => void | Set<any>;
29 errHandlers: (err: unknown) => void | Set<any>;
30 rawEmitters: (ev: WatchEventType, path: string, opts: unknown) => void | Set<any>;
31 watcher: NativeFsWatcher;
32 watcherUnusable?: boolean;
33};
34export interface WatchHandlers {
35 listener: (path: string) => void;
36 errHandler: (err: unknown) => void;
37 rawEmitter: (ev: WatchEventType, path: string, opts: unknown) => void;
38}
39/**
40 * @mixin
41 */
42export declare class NodeFsHandler {
43 fsw: FSWatcher;
44 _boundHandleError: (error: unknown) => void;
45 constructor(fsW: FSWatcher);
46 /**
47 * Watch file for changes with fs_watchFile or fs_watch.
48 * @param path to file or dir
49 * @param listener on fs change
50 * @returns closer for the watcher instance
51 */
52 _watchWithNodeFs(path: string, listener: (path: string, newStats?: any) => void | Promise<void>): (() => void) | undefined;
53 /**
54 * Watch a file and emit add event if warranted.
55 * @returns closer for the watcher instance
56 */
57 _handleFile(file: Path, stats: Stats, initialAdd: boolean): (() => void) | undefined;
58 /**
59 * Handle symlinks encountered while reading a dir.
60 * @param entry returned by readdirp
61 * @param directory path of dir being read
62 * @param path of this item
63 * @param item basename of this item
64 * @returns true if no more processing is needed for this entry.
65 */
66 _handleSymlink(entry: EntryInfo, directory: string, path: Path, item: string): Promise<boolean | undefined>;
67 _handleRead(directory: string, initialAdd: boolean, wh: WatchHelper, target: Path, dir: Path, depth: number, throttler: Throttler): Promise<unknown> | undefined;
68 /**
69 * Read directory to add / remove files from `@watched` list and re-read it on change.
70 * @param dir fs path
71 * @param stats
72 * @param initialAdd
73 * @param depth relative to user-supplied path
74 * @param target child path targeted for watch
75 * @param wh Common watch helpers for this path
76 * @param realpath
77 * @returns closer for the watcher instance.
78 */
79 _handleDir(dir: string, stats: Stats, initialAdd: boolean, depth: number, target: string, wh: WatchHelper, realpath: string): Promise<(() => void) | undefined>;
80 /**
81 * Handle added file, directory, or glob pattern.
82 * Delegates call to _handleFile / _handleDir after checks.
83 * @param path to file or ir
84 * @param initialAdd was the file added at watch instantiation?
85 * @param priorWh depth relative to user-supplied path
86 * @param depth Child path actually targeted for watch
87 * @param target Child path actually targeted for watch
88 */
89 _addToNodeFs(path: string, initialAdd: boolean, priorWh: WatchHelper | undefined, depth: number, target?: string): Promise<string | false | undefined>;
90}
Note: See TracBrowser for help on using the repository browser.