Comparing version 1.5.0 to 1.6.0
{ | ||
"name": "sane", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"description": "Sane aims to be fast, small, and reliable file system watcher.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -55,5 +55,7 @@ [![CircleCI](https://circleci.com/gh/amasad/sane.svg?style=svg)](https://circleci.com/gh/amasad/sane) | ||
* `dot`: enables watching files/directories that start with a dot. | ||
* `ignored`: a glob, regex, function, or array of any combination. | ||
For the glob pattern documentation, see [minimatch](https://github.com/isaacs/minimatch). | ||
If you choose to use `watchman` you'll have to [install watchman yourself](https://facebook.github.io/watchman/docs/install.html)). | ||
For the ignored options, see [anymatch](https://github.com/es128/anymatch). | ||
@@ -60,0 +62,0 @@ ### sane.NodeWatcher(dir, options) |
@@ -29,2 +29,4 @@ 'use strict'; | ||
watcher.dot = opts.dot || false; | ||
watcher.ignored = opts.ignored || false; | ||
if (!Array.isArray(watcher.globs)) { | ||
@@ -31,0 +33,0 @@ watcher.globs = [watcher.globs]; |
@@ -9,2 +9,3 @@ 'use strict'; | ||
var EventEmitter = require('events').EventEmitter; | ||
var anymatch = require('anymatch'); | ||
@@ -31,3 +32,3 @@ /** | ||
* @class NodeWatcher | ||
* @param String dir | ||
* @param {String} dir | ||
* @param {Object} opts | ||
@@ -52,3 +53,4 @@ * @public | ||
this.register, | ||
this.emit.bind(this, 'ready') | ||
this.emit.bind(this, 'ready'), | ||
this.ignored | ||
); | ||
@@ -323,2 +325,8 @@ } | ||
var key = type + '-' + file; | ||
var addKey = ADD_EVENT + '-' + file; | ||
if (type === CHANGE_EVENT && this.changeTimers[addKey]) { | ||
// Ignore the change event that is immediately fired after an add event. | ||
// (This happens on Linux). | ||
return; | ||
} | ||
clearTimeout(this.changeTimers[key]); | ||
@@ -336,9 +344,14 @@ this.changeTimers[key] = setTimeout(function() { | ||
* @param {string} dir | ||
* @param {function} callback | ||
* @param {function} dirCallback | ||
* @param {function} fileCallback | ||
* @param {function} endCallback | ||
* @param {*} ignored | ||
* @private | ||
*/ | ||
function recReaddir(dir, dirCallback, fileCallback, endCallback) { | ||
function recReaddir(dir, dirCallback, fileCallback, endCallback, ignored) { | ||
walker(dir) | ||
.filterDir(function(currentDir) { | ||
return !anymatch(ignored, currentDir); | ||
}) | ||
.on('dir', normalizeProxy(dirCallback)) | ||
@@ -345,0 +358,0 @@ .on('file', normalizeProxy(fileCallback)) |
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
28760
853
130