From 03e123cdab56c901752c58889ecbb58f7e160847 Mon Sep 17 00:00:00 2001 From: Elan Shanker Date: Mon, 9 Nov 2015 17:43:53 -0500 Subject: [PATCH 1/3] Use micromatch & glob-parent instead of minimatch & glob2base --- index.js | 12 ++++++------ package.json | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index a78a062..cbeb158 100644 --- a/index.js +++ b/index.js @@ -5,9 +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 globParent = require('glob-parent'); var path = require('path'); var extend = require('extend'); @@ -24,7 +24,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 +108,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 +149,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", From 441448bb3e07300be59e6a78b38351f0e01bc936 Mon Sep 17 00:00:00 2001 From: Elan Shanker Date: Mon, 9 Nov 2015 17:52:13 -0500 Subject: [PATCH 2/3] Remove unused require('path') --- index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/index.js b/index.js index cbeb158..a396c83 100644 --- a/index.js +++ b/index.js @@ -8,7 +8,6 @@ var glob = require('glob'); var micromatch = require('micromatch'); var resolveGlob = require('to-absolute-glob'); var globParent = require('glob-parent'); -var path = require('path'); var extend = require('extend'); var gs = { From 48acf33cd47bbb46d0a7b51ab2355c27f63db019 Mon Sep 17 00:00:00 2001 From: Elan Shanker Date: Mon, 9 Nov 2015 18:16:30 -0500 Subject: [PATCH 3/3] Replace glob2base reference in readme with glob-parent --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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