UNPKG

1.46 kBTypeScriptView Raw
1// Type definitions for watchpack 1.1
2// Project: https://github.com/webpack/watchpack
3// Definitions by: e-cloud <https://github.com/e-cloud>
4// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5// Minimum TypeScript Version: 3.9
6
7/// <reference types="node" />
8
9import { EventEmitter } from 'events';
10import Watcher = require('./Watcher');
11
12declare class Watchpack extends EventEmitter {
13 aggregatedChanges: string[];
14 aggregateTimeout: NodeJS.Timer;
15 dirWatchers: Watcher[];
16 fileWatchers: Watcher[];
17 mtimes: {
18 [path: string]: number;
19 };
20 options: Watchpack.WatchOptions;
21 paused: boolean;
22 watcherOptions: Watchpack.WatcherOptions;
23
24 constructor(options: Watchpack.WatchOptions);
25
26 watch(files: string[], directories: string[], startTime?: number): void;
27
28 close(): void;
29
30 pause(): void;
31
32 getTimes(): {
33 [path: string]: number;
34 };
35
36 _fileWatcher(file: string, watcher: Watcher): Watcher;
37
38 _dirWatcher(item: string, watcher: Watcher): Watcher;
39
40 _onChange(item: string, mtime: number, file?: string): void;
41
42 _onTimeout(): void;
43}
44
45declare namespace Watchpack {
46 interface WatcherOptions {
47 ignored?: string[] | string | RegExp | ((path: string) => boolean) | undefined;
48 poll?: boolean | number | undefined;
49 }
50 interface WatchOptions extends WatcherOptions {
51 aggregateTimeout?: number | undefined;
52 }
53}
54
55export = Watchpack;
56
\No newline at end of file