diff --git a/README.md b/README.md index a8a0379..1e6d649 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ You can pass any combination of globs. One caveat is that you can not only pass - cwd - Default is `process.cwd()` - base - - Default is everything before a glob starts (see [glob2base](https://github.com/wearefractal/glob2base)) + - Default is everything before a glob starts (see [glob-parent](https://github.com/es128/glob-parent)) - cwdbase - Default is `false` - When true it is the same as saying opt.base = opt.cwd diff --git a/index.js b/index.js index a78a062..a396c83 100644 --- a/index.js +++ b/index.js @@ -5,10 +5,9 @@ var Combine = require('ordered-read-streams'); var unique = require('unique-stream'); var glob = require('glob'); -var Minimatch = require('minimatch').Minimatch; +var micromatch = require('micromatch'); var resolveGlob = require('to-absolute-glob'); -var glob2base = require('glob2base'); -var path = require('path'); +var globParent = require('glob-parent'); var extend = require('extend'); var gs = { @@ -24,7 +23,7 @@ var gs = { var globber = new glob.Glob(ourGlob, ourOpt); // Extract base path from glob - var basePath = opt.base || glob2base(globber); + var basePath = opt.base || globParent(ourGlob) + '/'; // Create stream and map events from globber to it var stream = through2.obj(opt, @@ -108,7 +107,7 @@ var gs = { // Create Minimatch instances for negative glob patterns if (globArray === negatives && typeof glob === 'string') { var ourGlob = resolveGlob(glob, opt); - glob = new Minimatch(ourGlob, ourOpt); + glob = micromatch.matcher(ourGlob, ourOpt); } globArray.push({ @@ -149,8 +148,8 @@ var gs = { }; function isMatch(file, matcher) { - if (matcher instanceof Minimatch) { - return matcher.match(file.path); + if (typeof matcher === 'function') { + return matcher(file.path); } if (matcher instanceof RegExp) { return matcher.test(file.path); diff --git a/package.json b/package.json index b01fe2c..9741acd 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,8 @@ "dependencies": { "extend": "^3.0.0", "glob": "^5.0.3", - "glob2base": "^0.0.12", - "minimatch": "^2.0.1", + "glob-parent": "^2.0.0", + "micromatch": "^2.3.0", "ordered-read-streams": "^0.3.0", "through2": "^0.6.0", "to-absolute-glob": "^0.1.1",