fsevents 2.1.1 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -30,13 +30,13 @@ stop(); // To end observation
30
30
  The callback passed as the second parameter to `.watch` get's called whenever the operating system detects a
31
31
  a change in the file system. It takes three arguments:
32
32
 
33
- ###### `fsevents.watch(dirname: string, (path: string, flags: number, id: string) => void): Function`
33
+ ###### `fsevents.watch(dirname: string, (path: string, flags: number, id: string) => void): () => Promise<undefined>`
34
34
 
35
35
  * `path: string` - the item in the filesystem that have been changed
36
36
  * `flags: number` - a numeric value describing what the change was
37
37
  * `id: string` - an unique-id identifying this specific event
38
-
39
- Returns closer callback.
38
+
39
+ Returns closer callback which when called returns a Promise resolving when the watcher process has been shut down.
40
40
 
41
41
  ###### `fsevents.getInfo(path: string, flags: number, id: string): FsEventInfo`
42
42
 
@@ -47,7 +47,7 @@ The `FsEventsInfo` has the following shape:
47
47
 
48
48
  ```js
49
49
  /**
50
- * @typedef {'created'|'modified'|'deleted'|'moved'|'root-changed'|'unknown'} FsEventsEvent
50
+ * @typedef {'created'|'modified'|'deleted'|'moved'|'root-changed'|'cloned'|'unknown'} FsEventsEvent
51
51
  * @typedef {'file'|'directory'|'symlink'} FsEventsType
52
52
  */
53
53
  {
@@ -64,6 +64,12 @@ The `FsEventsInfo` has the following shape:
64
64
  }
65
65
  ```
66
66
 
67
+ ## Engine compatibility
68
+
69
+ - v2 supports node 8.16+
70
+ - v1.2.8 supports node 6+
71
+ - v1.2.7 supports node 4+
72
+
67
73
  ## License
68
74
 
69
75
  The MIT License Copyright (C) 2010-2019 by Philipp Dunkel, Ben Noordhuis, Elan Shankar, Paul Miller — see LICENSE file.
package/fsevents.d.ts ADDED
@@ -0,0 +1,55 @@
1
+ declare type Event =
2
+ | 'created'
3
+ | 'cloned'
4
+ | 'modified'
5
+ | 'deleted'
6
+ | 'moved'
7
+ | 'root-changed'
8
+ | 'unknown';
9
+ declare type Type = 'file' | 'directory' | 'symlink';
10
+ declare type FileChanges = {
11
+ inode: boolean;
12
+ finder: boolean;
13
+ access: boolean;
14
+ xattrs: boolean;
15
+ };
16
+ declare type Info = {
17
+ event: Event;
18
+ path: string;
19
+ type: Type;
20
+ changes: FileChanges;
21
+ flags: number;
22
+ };
23
+ declare type WatchHandler = (path: string, flags: number, id: string) => void;
24
+ export declare function watch(
25
+ path: string,
26
+ handler: WatchHandler,
27
+ ): () => Promise<void>;
28
+ export declare function getInfo(path: string, flags: number): Info;
29
+ export declare const constants: {
30
+ None: 0x00000000;
31
+ MustScanSubDirs: 0x00000001;
32
+ UserDropped: 0x00000002;
33
+ KernelDropped: 0x00000004;
34
+ EventIdsWrapped: 0x00000008;
35
+ HistoryDone: 0x00000010;
36
+ RootChanged: 0x00000020;
37
+ Mount: 0x00000040;
38
+ Unmount: 0x00000080;
39
+ ItemCreated: 0x00000100;
40
+ ItemRemoved: 0x00000200;
41
+ ItemInodeMetaMod: 0x00000400;
42
+ ItemRenamed: 0x00000800;
43
+ ItemModified: 0x00001000;
44
+ ItemFinderInfoMod: 0x00002000;
45
+ ItemChangeOwner: 0x00004000;
46
+ ItemXattrMod: 0x00008000;
47
+ ItemIsFile: 0x00010000;
48
+ ItemIsDir: 0x00020000;
49
+ ItemIsSymlink: 0x00040000;
50
+ ItemIsHardlink: 0x00100000;
51
+ ItemIsLastHardlink: 0x00200000;
52
+ OwnEvent: 0x00080000;
53
+ ItemCloned: 0x00400000;
54
+ };
55
+ export {}
package/fsevents.js CHANGED
@@ -24,8 +24,10 @@ function watch(path, handler) {
24
24
  let instance = Native.start(path, handler);
25
25
  if (!instance) throw new Error(`could not watch: ${path}`);
26
26
  return () => {
27
- const result = instance ? Promise.resolve(instance).then(Native.stop) : null;
28
- instance = null;
27
+ const result = instance
28
+ ? Promise.resolve(instance).then(Native.stop)
29
+ : Promise.resolve(undefined);
30
+ instance = undefined;
29
31
  return result;
30
32
  };
31
33
  }
package/fsevents.node CHANGED
Binary file
package/package.json CHANGED
@@ -1,12 +1,17 @@
1
1
  {
2
2
  "name": "fsevents",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "Native Access to MacOS FSEvents",
5
5
  "main": "fsevents.js",
6
+ "types": "fsevents.d.ts",
6
7
  "os": [
7
8
  "darwin"
8
9
  ],
9
- "files": ["fsevents.js", "fsevents.node"],
10
+ "files": [
11
+ "fsevents.d.ts",
12
+ "fsevents.js",
13
+ "fsevents.node"
14
+ ],
10
15
  "engines": {
11
16
  "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
12
17
  },