diff --git a/README.md b/README.md index fc66dc8..7b95c3f 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ options: * `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). +For the glob pattern documentation, see [micromatch](https://github.com/micromatch/micromatch). 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). diff --git a/package.json b/package.json index 4690e74..516bc1d 100644 --- a/package.json +++ b/package.json @@ -28,10 +28,10 @@ "author": "amasad", "license": "MIT", "dependencies": { - "anymatch": "^1.3.0", + "anymatch": "^2.0.0", "exec-sh": "^0.2.0", "fb-watchman": "^2.0.0", - "minimatch": "^3.0.2", + "micromatch": "^3.1.4", "minimist": "^1.1.1", "walker": "~1.0.5", "watch": "~0.18.0" diff --git a/src/common.js b/src/common.js index 899b88c..e1cbb0a 100644 --- a/src/common.js +++ b/src/common.js @@ -2,7 +2,7 @@ var walker = require('walker'); var anymatch = require('anymatch'); -var minimatch = require('minimatch'); +var micromatch = require('micromatch'); var path = require('path'); var platform = require('os').platform(); @@ -59,23 +59,12 @@ exports.assignOptions = function(watcher, opts) { */ exports.isFileIncluded = function(globs, dot, doIgnore, relativePath) { - var matched; - if (globs.length) { - for (var i = 0; i < globs.length; i++) { - if ( - minimatch(relativePath, globs[i], { dot: dot }) && - !doIgnore(relativePath) - ) { - matched = true; - break; - } - } - } else { - // Make sure we honor the dot option if even we're not using globs. - matched = - (dot || minimatch(relativePath, '**/*')) && !doIgnore(relativePath); + if (doIgnore(relativePath)) { + return false; } - return matched; + return globs.length + ? micromatch.some(relativePath, globs, { dot: dot }) + : dot || micromatch.some(relativePath, '**/*'); }; /**