Comparing version 2.3.5 to 2.3.6
## History | ||
- v2.3.6 February 6, 2013 | ||
- Fixed fallback when preferredMethod is `watchFile` | ||
- v2.3.5 February 6, 2013 | ||
@@ -4,0 +7,0 @@ - Fixed uncaught exceptions when intialising watchers under certain circumstances |
@@ -70,4 +70,2 @@ // Generated by CoffeeScript 1.4.0 | ||
function _Class(config, next) { | ||
this.isIgnoredPath = __bind(this.isIgnoredPath, this); | ||
this.listener = __bind(this.listener, this); | ||
@@ -79,2 +77,4 @@ | ||
this.isIgnoredPath = __bind(this.isIgnoredPath, this); | ||
this.log = __bind(this.log, this); | ||
@@ -109,2 +109,17 @@ this.children = {}; | ||
_Class.prototype.isIgnoredPath = function(path, opts) { | ||
var ignore, _ref, _ref1, _ref2, _ref3; | ||
if (opts == null) { | ||
opts = {}; | ||
} | ||
ignore = balUtil.isIgnoredPath(path, { | ||
ignorePaths: (_ref = opts.ignorePaths) != null ? _ref : this.config.ignorePaths, | ||
ignoreHiddenFiles: (_ref1 = opts.ignoreHiddenFiles) != null ? _ref1 : this.config.ignoreHiddenFiles, | ||
ignoreCommonPatterns: (_ref2 = opts.ignoreCommonPatterns) != null ? _ref2 : this.config.ignoreCommonPatterns, | ||
ignoreCustomPatterns: (_ref3 = opts.ignoreCustomPatterns) != null ? _ref3 : this.config.ignoreCustomPatterns | ||
}); | ||
this.log('debug', "ignore: " + path + " " + (ignore ? 'yes' : 'no')); | ||
return ignore; | ||
}; | ||
/* | ||
@@ -410,2 +425,3 @@ Setup our Instance | ||
Also instantiate the child with our instance's configuration where applicable | ||
next(err,watcher) | ||
*/ | ||
@@ -448,20 +464,5 @@ | ||
_Class.prototype.isIgnoredPath = function(path, opts) { | ||
var ignore, _ref, _ref1, _ref2, _ref3; | ||
if (opts == null) { | ||
opts = {}; | ||
} | ||
ignore = balUtil.isIgnoredPath(path, { | ||
ignorePaths: (_ref = opts.ignorePaths) != null ? _ref : this.config.ignorePaths, | ||
ignoreHiddenFiles: (_ref1 = opts.ignoreHiddenFiles) != null ? _ref1 : this.config.ignoreHiddenFiles, | ||
ignoreCommonPatterns: (_ref2 = opts.ignoreCommonPatterns) != null ? _ref2 : this.config.ignoreCommonPatterns, | ||
ignoreCustomPatterns: (_ref3 = opts.ignoreCustomPatterns) != null ? _ref3 : this.config.ignoreCustomPatterns | ||
}); | ||
this.log('debug', "ignore: " + path + " " + (ignore ? 'yes' : 'no')); | ||
return ignore; | ||
}; | ||
/* | ||
Watch Children | ||
next(err,result) | ||
next(err,watching) | ||
*/ | ||
@@ -483,3 +484,5 @@ | ||
next: function(err) { | ||
return next(err, (err != null) === false); | ||
var watching; | ||
watching = !err; | ||
return next(err, watching); | ||
}, | ||
@@ -490,3 +493,3 @@ action: function(fileFullPath, fileRelativePath, nextFile, fileStat) { | ||
} | ||
return me.watchChild(fileFullPath, fileRelativePath, fileStat, function(err) { | ||
return me.watchChild(fileFullPath, fileRelativePath, fileStat, function(err, watcher) { | ||
return nextFile(err); | ||
@@ -508,3 +511,3 @@ }); | ||
_Class.prototype.watchSelf = function(next) { | ||
var complete, config, me, methods; | ||
var complete, config, me, methodOne, methodTwo, methods; | ||
me = this; | ||
@@ -544,45 +547,34 @@ config = this.config; | ||
}; | ||
complete = function(success) { | ||
if (success == null) { | ||
success = true; | ||
} | ||
if (success) { | ||
me.state = 'active'; | ||
return next(null, true); | ||
} else { | ||
complete = function(watching) { | ||
if (!watching) { | ||
me.close('failure'); | ||
return next(null, false); | ||
} | ||
me.state = 'active'; | ||
return next(null, true); | ||
}; | ||
if (config.preferredMethod === 'watch') { | ||
methods.watch(function(err, success) { | ||
if (err) { | ||
me.emit('error', err); | ||
methodOne = methods.watch; | ||
methodTwo = methods.watchFile; | ||
} else { | ||
methodOne = methods.watchFile; | ||
methodTwo = methods.watch; | ||
} | ||
methodOne(function(err1, watching) { | ||
if (watching) { | ||
return complete(watching); | ||
} | ||
return methodTwo(function(err2, watching) { | ||
if (watching) { | ||
return complete(watching); | ||
} | ||
if (success) { | ||
return complete(success); | ||
if (err1) { | ||
me.emit('error', err1); | ||
} | ||
return methods.watchFile(function(err, success) { | ||
if (err) { | ||
me.emit('error', err); | ||
} | ||
return complete(success); | ||
}); | ||
}); | ||
} else { | ||
methods.watchFile(function(err, success) { | ||
if (err) { | ||
me.emit('error', err); | ||
if (err2) { | ||
me.emit('error', err2); | ||
} | ||
if (success) { | ||
return complete(success); | ||
} | ||
return methods.watchFile(function(err, success) { | ||
if (err) { | ||
me.emit('error', err); | ||
} | ||
return complete(success); | ||
}); | ||
return complete(false); | ||
}); | ||
} | ||
}); | ||
return this; | ||
@@ -642,8 +634,8 @@ }; | ||
} | ||
return me.watchSelf(function(err, result) { | ||
if (err || !result) { | ||
return complete(err, result); | ||
return me.watchSelf(function(err, watching) { | ||
if (err || !watching) { | ||
return complete(err, watching); | ||
} | ||
return me.watchChildren(function(err, result) { | ||
return complete(err, result); | ||
return me.watchChildren(function(err, watching) { | ||
return complete(err, watching); | ||
}); | ||
@@ -650,0 +642,0 @@ }); |
{ | ||
"name": "watchr", | ||
"version": "2.3.5", | ||
"version": "2.3.6", | ||
"description": "Better file system watching for Node.js", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/bevry/watchr", |
@@ -1,2 +0,2 @@ | ||
## Watchr: better file system watching for Node.js | ||
## Watchr: better file system watching for Node.js [![Build Status](https://secure.travis-ci.org/bevry/watchr.png?branch=master)](http://travis-ci.org/bevry/watchr) | ||
@@ -3,0 +3,0 @@ Watchr provides a normalised API the file watching APIs of different node versions, nested/recursive file and directory watching, and accurate detailed events for file/directory creations, updates, and deletions. |
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
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
41996
0
675