node-watch
Advanced tools
Comparing version 0.7.3 to 0.7.4
@@ -63,3 +63,3 @@ import { FSWatcher } from 'fs'; | ||
declare interface Watcher extends FSWatcher { | ||
export declare interface Watcher extends FSWatcher { | ||
/** | ||
@@ -66,0 +66,0 @@ * Returns `true` if the watcher has been closed. |
@@ -129,2 +129,12 @@ var fs = require('fs'); | ||
function tryWatch(watcher, dir, opts) { | ||
try { | ||
return fs.watch(dir, opts); | ||
} catch (e) { | ||
process.nextTick(function() { | ||
watcher.emit('error', e); | ||
}); | ||
} | ||
} | ||
function getSubDirectories(dir, fn, done = function() {}) { | ||
@@ -361,3 +371,7 @@ if (is.directory(dir)) { | ||
var watcher = fs.watch(parent, opts); | ||
var watcher = tryWatch(this, parent, opts); | ||
if (!watcher) { | ||
return; | ||
} | ||
this.add(watcher, { | ||
@@ -400,3 +414,7 @@ type: 'file', | ||
var watcher = fs.watch(dir, opts); | ||
var watcher = tryWatch(self, dir, opts); | ||
if (!watcher) { | ||
done(); | ||
return; | ||
} | ||
@@ -477,5 +495,7 @@ self.add(watcher, { | ||
if (!is.array(fpath) && !is.exists(fpath)) { | ||
watcher.emit('error', | ||
new Error(fpath + ' does not exist.') | ||
); | ||
process.nextTick(function() { | ||
watcher.emit('error', | ||
new Error(fpath + ' does not exist.') | ||
); | ||
}); | ||
} | ||
@@ -482,0 +502,0 @@ |
@@ -14,3 +14,3 @@ { | ||
], | ||
"version": "0.7.3", | ||
"version": "0.7.4", | ||
"bugs": { | ||
@@ -35,4 +35,4 @@ "url": "https://github.com/yuanchuan/node-watch/issues" | ||
"fs-extra": "^7.0.1", | ||
"mocha": "^5.2.0" | ||
"mocha": "^10.2.0" | ||
} | ||
} |
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
26063
724