forked from parcel-bundler/parcel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparcel-watcher.js.flow
43 lines (40 loc) · 1.16 KB
/
parcel-watcher.js.flow
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// @flow
// Derived from the README and source of @parcel/watcher located at
// https://github.com/parcel-bundler/watcher and
// https://github.com/parcel-bundler/watcher/blob/411903f55462dd93350edb18088476f775381921/index.js
// Which is licensed MIT
declare module '@parcel/watcher' {
declare type FilePath = string;
declare type Options = {|
ignore?: Array<FilePath>,
backend?: 'fs-events' | 'watchman' | 'inotify' | 'windows' | 'brute-force'
|};
declare type AsyncSubscription = {|unsubscribe: () => Promise<mixed>|};
declare type Event = {|
+path: FilePath,
+type: 'create' | 'update' | 'delete'
|};
declare module.exports: {
getEventsSince(
dir: FilePath,
snapshot: FilePath,
opts: Options
): Promise<Array<Event>>,
subscribe(
dir: FilePath,
fn: (err: Error, events: Array<Event>) => mixed,
opts: Options
): Promise<AsyncSubscription>,
unsubscribe(
dir: FilePath,
fn: (err: Error, events: Array<Event>) => mixed,
opts: Options
): Promise<mixed>,
writeSnapshot(
dir: FilePath,
snapshot: FilePath,
opts: Options
): Promise<FilePath>,
...
};
}