Comparing version 1.0.0-rc4 to 1.0.0-rc5
@@ -182,3 +182,4 @@ 'use strict'; | ||
if (fd) fs.close(fd); | ||
error ? handleEvent('unlink') : addOrChange(); | ||
error && error.code !== 'EACCES' ? | ||
handleEvent('unlink') : addOrChange(); | ||
}); | ||
@@ -281,8 +282,8 @@ } | ||
// ensure empty dirs get tracked | ||
if (isDir) this._getWatchedDir(pp); | ||
if (dirObj.has(base)) return; | ||
dirObj.add(base); | ||
// ensure empty dirs get tracked | ||
if (isDir) this._getWatchedDir(pp); | ||
if (!this.options.ignoreInitial || forceAdd === true) { | ||
@@ -297,9 +298,3 @@ this._emit(isDir ? 'addDir' : 'add', pp, stats); | ||
fs[wh.statMethod](wh.watchPath, function(error, stats) { | ||
var permError = this.options.ignorePermissionErrors && | ||
!this._hasReadPermissions(stats); | ||
if ( | ||
this._handleError(error) || | ||
permError || | ||
this._isIgnored(wh.watchPath, stats) | ||
) { | ||
if (this._handleError(error) || this._isIgnored(wh.watchPath, stats)) { | ||
this._emitReady(); | ||
@@ -370,2 +365,1 @@ return this._emitReady(); | ||
module.exports.canUse = canUse; | ||
@@ -171,3 +171,3 @@ 'use strict'; | ||
var currmtime = curr.mtime.getTime(); | ||
if (currmtime > prev.mtime.getTime() || currmtime === 0) { | ||
if (curr.size !== prev.size || currmtime > prev.mtime.getTime() || currmtime === 0) { | ||
container.listeners.forEach(function(listener) { | ||
@@ -333,6 +333,8 @@ listener(path, curr); | ||
this._emit('addDir', dir, stats); | ||
} else { | ||
this._getWatchedDir(sysPath.dirname(dir)).add(sysPath.basename(dir)); | ||
} | ||
// ensure dir is tracked | ||
this._getWatchedDir(sysPath.dirname(dir)).add(sysPath.basename(dir)); | ||
this._getWatchedDir(dir); | ||
var read = function(directory, initialAdd, done) { | ||
@@ -384,11 +386,17 @@ // Normalize the directory name on Windows | ||
previous.children().filter(function(item) { | ||
return item !== directory && current.indexOf(item) === -1; | ||
return item !== directory && | ||
current.indexOf(item) === -1 && | ||
// in case of intersecting globs; | ||
// a path may have been filtered out of this readdir, but | ||
// shouldn't be removed because it matches a different glob | ||
(!wh.hasGlob || wh.filterPath({ | ||
fullPath: sysPath.resolve(directory, item) | ||
})); | ||
}).forEach(function(item) { | ||
this._remove(directory, item); | ||
}, this); | ||
}.bind(this)).on('error', this._handleError.bind(this)); | ||
}.bind(this); | ||
if (this.options.depth === undefined || depth <= this.options.depth) { | ||
if (this.options.depth == null || depth <= this.options.depth) { | ||
if (!target) read(dir, initialAdd, callback); | ||
@@ -436,5 +444,3 @@ var closer = this._watchWithNodeFs(dir, function(dirPath, stats) { | ||
if (this._handleError(error)) return callback(null, path); | ||
var permError = this.options.ignorePermissionErrors && | ||
!this._hasReadPermissions(stats); | ||
if (permError || this._isIgnored(wh.watchPath, stats)) { | ||
if (this._isIgnored(wh.watchPath, stats)) { | ||
ready(); | ||
@@ -441,0 +447,0 @@ return callback(null, false); |
{ | ||
"name": "chokidar", | ||
"description": "A neat wrapper around node.js fs.watch / fs.watchFile / fsevents.", | ||
"version": "1.0.0-rc4", | ||
"version": "1.0.0-rc5", | ||
"keywords": [ | ||
@@ -33,4 +33,4 @@ "fs", | ||
}, | ||
"main": "lib", | ||
"files": [ | ||
"index.js", | ||
"lib/" | ||
@@ -51,7 +51,9 @@ ], | ||
"anymatch": "^1.1.0", | ||
"arrify": "^1.0.0", | ||
"async-each": "^0.1.5", | ||
"glob-parent": "^1.0.0", | ||
"is-binary-path": "^1.0.0", | ||
"is-glob": "^1.1.3", | ||
"readdirp": "^1.3.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# Chokidar [![Mac/Linux Build Status](https://travis-ci.org/paulmillr/chokidar.svg?branch=master)](https://travis-ci.org/paulmillr/chokidar) [![Windows Build status](https://ci.appveyor.com/api/projects/status/jvv568xm6xsow034/branch/master?svg=true)](https://ci.appveyor.com/project/es128/chokidar/branch/master) [![Coverage Status](https://coveralls.io/repos/paulmillr/chokidar/badge.svg)](https://coveralls.io/r/paulmillr/chokidar) | ||
# Chokidar [![Mac/Linux Build Status](https://img.shields.io/travis/paulmillr/chokidar/master.svg?label=Mac%20OSX%20%26%20Linux)](https://travis-ci.org/paulmillr/chokidar) [![Windows Build status](https://img.shields.io/appveyor/ci/es128/chokidar/master.svg?label=Windows)](https://ci.appveyor.com/project/es128/chokidar/branch/master) [![Coverage Status](https://coveralls.io/repos/paulmillr/chokidar/badge.svg)](https://coveralls.io/r/paulmillr/chokidar) | ||
A neat wrapper around node.js fs.watch / fs.watchFile / fsevents. | ||
@@ -49,2 +49,8 @@ | ||
```javascript | ||
// One-liner | ||
require('chokidar').watch('.', {ignored: /[\/\\]\./}).on('all', function(event, path) { | ||
console.log(event, path); | ||
}); | ||
var chokidar = require('chokidar'); | ||
@@ -84,7 +90,2 @@ | ||
// One-liner | ||
require('chokidar').watch('.', {ignored: /[\/\\]\./}).on('all', function(event, path) { | ||
console.log(event, path); | ||
}); | ||
``` | ||
@@ -107,6 +108,7 @@ | ||
* `ignored` ([anymatch](https://github.com/es128/anymatch)-compatible definition) | ||
Defines files/paths to be ignored. The **whole path** is tested, not just | ||
filename. If a function with two arguments is provided, it gets called | ||
twice per path - once with a single argument (the path), second time with | ||
two arguments (the path and the [`fs.Stats`](http://nodejs.org/api/fs.html#fs_class_fs_stats) | ||
Defines files/paths to be ignored. The whole relative or absolute path is | ||
tested, not just filename. If a function with two arguments is provided, it | ||
gets called twice per path - once with a single argument (the path), second | ||
time with two arguments (the path and the | ||
[`fs.Stats`](http://nodejs.org/api/fs.html#fs_class_fs_stats) | ||
object of that path). | ||
@@ -148,4 +150,5 @@ * `ignoreInitial` (default: `false`). Indicates whether chokidar | ||
#### Errors | ||
* `ignorePermissionErrors` (default: `false`). Indicates | ||
whether to watch files that don't have read permissions. | ||
* `ignorePermissionErrors` (default: `false`). Indicates whether to watch files | ||
that don't have read permissions if possible. If watching fails due to `EPERM` | ||
or `EACCES` with this set to `true`, the errors will be suppressed silently. | ||
* `atomic` (default: `true` if `useFsEvents` and `usePolling` are `false`). | ||
@@ -152,0 +155,0 @@ Automatically filters out artifacts that occur when using editors that use |
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
61839
6
1137
204
8
+ Addedarrify@^1.0.0
+ Addedis-glob@^1.1.3
+ Addedarrify@1.0.1(transitive)
+ Addedis-glob@1.1.3(transitive)