source: imaps-frontend/node_modules/chokidar/handler.d.ts@ 0c6b92a

main
Last change on this file since 0c6b92a was 0c6b92a, checked in by stefan toskovski <stefantoska84@…>, 5 weeks ago

Pred finalna verzija

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