Comparing version 2.0.0 to 2.1.0
{ | ||
"name": "sane", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Sane aims to be fast, small, and reliable file system watcher.", | ||
@@ -37,3 +37,3 @@ "main": "index.js", | ||
"walker": "~1.0.5", | ||
"watch": "~0.10.0" | ||
"watch": "~0.18.0" | ||
}, | ||
@@ -40,0 +40,0 @@ "devDependencies": { |
@@ -92,2 +92,3 @@ 'use strict'; | ||
endCallback, | ||
errorCallback, | ||
ignored | ||
@@ -101,2 +102,3 @@ ) { | ||
.on('file', normalizeProxy(fileCallback)) | ||
.on('error', errorCallback) | ||
.on('end', function() { | ||
@@ -103,0 +105,0 @@ if (platform === 'win32') { |
@@ -59,2 +59,3 @@ 'use strict'; | ||
this.emit.bind(this, 'ready'), | ||
this.emit.bind(this, 'error'), | ||
this.ignored | ||
@@ -61,0 +62,0 @@ ); |
@@ -43,2 +43,3 @@ 'use strict'; | ||
this.register = this.register.bind(this); | ||
this.checkedEmitError = this.checkedEmitError.bind(this); | ||
@@ -51,2 +52,3 @@ this.watchdir(this.root); | ||
this.emit.bind(this, 'ready'), | ||
this.checkedEmitError, | ||
this.ignored | ||
@@ -139,2 +141,27 @@ ); | ||
/** | ||
* Determine if a given FS error can be ignored | ||
* | ||
* @private | ||
*/ | ||
function isIgnorableFileError(error) { | ||
return ( | ||
error.code === 'ENOENT' || | ||
// Workaround Windows node issue #4337. | ||
(error.code === 'EPERM' && platform === 'win32') | ||
); | ||
} | ||
/** | ||
* Emit "error" event if it's not an ignorable event | ||
* | ||
* @param error | ||
* @private | ||
*/ | ||
NodeWatcher.prototype.checkedEmitError = function(error) { | ||
if (!isIgnorableFileError(error)) { | ||
this.emit('error', error); | ||
} | ||
}; | ||
/** | ||
* Watch a directory. | ||
@@ -158,10 +185,3 @@ * | ||
// Workaround Windows node issue #4337. | ||
if (platform === 'win32') { | ||
watcher.on('error', function(error) { | ||
if (error.code !== 'EPERM') { | ||
throw error; | ||
} | ||
}); | ||
} | ||
watcher.on('error', this.checkedEmitError); | ||
@@ -229,6 +249,3 @@ if (this.root !== dir) { | ||
if (error) { | ||
if ( | ||
error.code === 'ENOENT' || | ||
(platform === 'win32' && error.code === 'EPERM') | ||
) { | ||
if (isIgnorableFileError(error)) { | ||
found = true; | ||
@@ -363,2 +380,3 @@ callback(file); | ||
function endCallback() {}, | ||
this.checkedEmitError, | ||
this.ignored | ||
@@ -365,0 +383,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
33380
1058
+ Addedwatch@0.18.0(transitive)
- Removedwatch@0.10.0(transitive)
Updatedwatch@~0.18.0