Comparing version 3.2.3 to 3.3.0
18
index.js
@@ -120,4 +120,4 @@ 'use strict'; | ||
} | ||
if (path[0] === BANG) { | ||
return BANG + sysPath.join(cwd, path.substring(1)); | ||
if (path.startsWith(BANG)) { | ||
return BANG + sysPath.join(cwd, path.slice(1)); | ||
} | ||
@@ -410,4 +410,4 @@ return sysPath.join(cwd, path); | ||
paths = paths.filter((path) => { | ||
if (path[0] === BANG) { | ||
this._ignoredPaths.add(path.substring(1)); | ||
if (path.startsWith(BANG)) { | ||
this._ignoredPaths.add(path.slice(1)); | ||
return false; | ||
@@ -485,3 +485,3 @@ } | ||
* Close watchers and remove all listeners from watched paths. | ||
* @returns {FSWatcher} for chaining. | ||
* @returns {Promise<void>}. | ||
*/ | ||
@@ -494,3 +494,7 @@ close() { | ||
this.removeAllListeners(); | ||
this._closers.forEach(closerList => closerList.forEach(closer => closer())); | ||
const closers = []; | ||
this._closers.forEach(closerList => closerList.forEach(closer => { | ||
const promise = closer(); | ||
if (promise instanceof Promise) closers.push(promise); | ||
})); | ||
this._streams.forEach(stream => stream.destroy()); | ||
@@ -504,3 +508,3 @@ this._userIgnored = undefined; | ||
}); | ||
return this; | ||
return closers.length ? Promise.all(closers).then(() => undefined) : Promise.resolve(); | ||
} | ||
@@ -507,0 +511,0 @@ |
@@ -8,3 +8,5 @@ 'use strict'; | ||
let fsevents; | ||
try { fsevents = require('fsevents'); } catch (error) { | ||
try { | ||
fsevents = require('fsevents'); | ||
} catch (error) { | ||
if (process.env.CHOKIDAR_PRINT_FSEVENTS_REQUIRE_ERROR) console.error(error); | ||
@@ -170,5 +172,6 @@ } | ||
FSEventsWatchers.delete(watchPath); | ||
cont.watcher.stop(); | ||
cont.rawEmitter = cont.watcher = undefined; | ||
Object.freeze(cont); | ||
if (cont.watcher) return cont.watcher.stop().then(() => { | ||
cont.rawEmitter = cont.watcher = undefined; | ||
Object.freeze(cont); | ||
}); | ||
} | ||
@@ -175,0 +178,0 @@ }; |
@@ -63,6 +63,6 @@ 'use strict'; | ||
const container = main[prop]; | ||
if (!(container instanceof Set)) { | ||
if (container === item) delete main[prop]; | ||
} else { | ||
if (container instanceof Set) { | ||
container.delete(item); | ||
} else if (container === item) { | ||
delete main[prop]; | ||
} | ||
@@ -69,0 +69,0 @@ }; |
{ | ||
"name": "chokidar", | ||
"description": "A neat wrapper around node.js fs.watch / fs.watchFile / fsevents.", | ||
"version": "3.2.3", | ||
"version": "3.3.0", | ||
"homepage": "https://github.com/paulmillr/chokidar", | ||
@@ -30,3 +30,3 @@ "author": "Paul Miller (https://paulmillr.com)", | ||
"chai": "^4.2", | ||
"dtslint": "0.9.9", | ||
"dtslint": "1.0.2", | ||
"eslint": "^6.6.0", | ||
@@ -56,3 +56,3 @@ "mocha": "^6.2.2", | ||
"lint": "eslint --report-unused-disable-directives --ignore-path .gitignore .", | ||
"mocha": "mocha --exit", | ||
"mocha": "mocha --exit --timeout 60000", | ||
"test": "npm run lint && npm run mocha" | ||
@@ -88,2 +88,4 @@ }, | ||
], | ||
"no-lonely-if": "error", | ||
"no-var": "error", | ||
"object-shorthand": "error", | ||
@@ -116,4 +118,3 @@ "prefer-arrow-callback": [ | ||
"single" | ||
], | ||
"no-var": "error" | ||
] | ||
} | ||
@@ -120,0 +121,0 @@ }, |
@@ -289,2 +289,3 @@ # Chokidar [![Weekly downloads](https://img.shields.io/npm/dw/chokidar.svg)](https://github.com/paulmillr/chokidar) [![Yearly downloads](https://img.shields.io/npm/dy/chokidar.svg)](https://github.com/paulmillr/chokidar) | ||
- **v3.3 (Nov 2, 2019):** `FSWatcher#close()` method became async. | ||
- **v3.2 (Oct 1, 2019):** Improve Linux RAM usage by 50%. Race condition fixes. Windows glob fixes. Improve stability by using tight range of dependency versions. | ||
@@ -299,2 +300,2 @@ - **v3.1 (Sep 16, 2019):** dotfiles are no longer filtered out by default. Use `ignored` option if needed. Improve initial Linux scan time by 50%. | ||
MIT (c) Paul Miller <https://paulmillr.com>, see LICENSE file. | ||
MIT (c) Paul Miller (<https://paulmillr.com>), see [LICENSE](LICENSE) file. |
@@ -41,3 +41,3 @@ // TypeScript Version: 3.0 | ||
*/ | ||
close(): void; | ||
close(): Promise<void>; | ||
@@ -44,0 +44,0 @@ on(event: 'add'|'addDir'|'change', listener: (path: string, stats?: fs.Stats) => void): this; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
87947
2046
300