UNPKG

958 BTypeScriptView Raw
1/// <reference types="node" />
2import { Filename, PortablePath, Watcher, WatchCallback } from '@yarnpkg/fslib';
3import { EventEmitter } from 'events';
4import { ResolvedPath } from './resolveNodeModulesPath';
5declare class WatchEventEmitter extends EventEmitter {
6 private dirWatchers;
7 private watchPath;
8 private watcherId;
9 constructor(dirWatchers: DirectoryWatcherMap, watchPath: PortablePath, watcherId: number);
10 close(): void;
11}
12type DirectoryWatcherMap = Map<PortablePath, DirectoryWatcher>;
13interface DirectoryWatcher {
14 eventEmitters: Map<number, Watcher & EventEmitter>;
15 dirEntries: Set<Filename>;
16}
17export declare class WatchManager extends EventEmitter {
18 private readonly dirWatchers;
19 private lastWatcherId;
20 registerWatcher(watchPath: PortablePath, dirList: Set<Filename>, callback: WatchCallback): WatchEventEmitter;
21 notifyWatchers(resolvePath: (nodePath: PortablePath) => ResolvedPath): void;
22}
23export {};