micromatch 3.0.0 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of micromatch might be problematic. Click here for more details.
- package/CHANGELOG.md +1 -1
- package/README.md +58 -58
- package/index.js +15 -15
- package/lib/utils.js +1 -1
- package/package.json +20 -14
package/CHANGELOG.md
CHANGED
@@ -13,7 +13,7 @@ Changelog entries are classified using the following labels _(from [keep-a-chang
|
|
13
13
|
|
14
14
|
### [3.0.0] - 2017-04-11
|
15
15
|
|
16
|
-
TODO
|
16
|
+
TODO. There should be no breaking changes. Please report any regressions. I will [reformat these release notes](https://github.com/micromatch/micromatch/pull/76) and add them to the changelog as soon as I have a chance.
|
17
17
|
|
18
18
|
### [1.0.1] - 2016-12-12
|
19
19
|
|
package/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# micromatch [](https://www.npmjs.com/package/micromatch) [](https://npmjs.org/package/micromatch)
|
1
|
+
# micromatch [](https://www.npmjs.com/package/micromatch) [](https://npmjs.org/package/micromatch) [](https://npmjs.org/package/micromatch) [](https://travis-ci.org/micromatch/micromatch) [](https://ci.appveyor.com/project/micromatch/micromatch)
|
2
2
|
|
3
3
|
> Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.
|
4
4
|
|
@@ -87,8 +87,8 @@ console.log(mm.isMatch('foo', 'f*'));
|
|
87
87
|
|
88
88
|
* Supports all of the same matching features as [minimatch](https://github.com/isaacs/minimatch) and [multimatch](https://github.com/sindresorhus/multimatch)
|
89
89
|
* Micromatch uses [snapdragon](https://github.com/jonschlinkert/snapdragon) for parsing and compiling globs, which provides granular control over the entire conversion process in a way that is easy to understand, reason about, and maintain.
|
90
|
-
* More accurate, with more than 36,000 [test assertions](./test) to prove it.
|
91
|
-
* More complete support for the Bash 4.3 specification than minimatch and multimatch.
|
90
|
+
* More consistently accurate matching [than minimatch](https://github.com/yarnpkg/yarn/pull/3339), with more than 36,000 [test assertions](./test) to prove it.
|
91
|
+
* More complete support for the Bash 4.3 specification than minimatch and multimatch. In fact, micromatch passes _all of the spec tests_ from bash, including some that bash still fails.
|
92
92
|
* [Faster matching](#benchmarks), from a combination of optimized glob patterns, faster algorithms, and regex caching.
|
93
93
|
* [Micromatch is safer](https://github.com/micromatch/braces#braces-is-safe), and is not subject to DoS with brace patterns, like minimatch and multimatch.
|
94
94
|
* More reliable windows support than minimatch and multimatch.
|
@@ -158,7 +158,7 @@ console.log(mm(['a.js', 'a.txt'], ['*.js']));
|
|
158
158
|
//=> [ 'a.js' ]
|
159
159
|
```
|
160
160
|
|
161
|
-
### [.match](index.js#
|
161
|
+
### [.match](index.js#L95)
|
162
162
|
|
163
163
|
Similar to the main function, but `pattern` must be a string.
|
164
164
|
|
@@ -179,7 +179,7 @@ console.log(mm.match(['a.a', 'a.aa', 'a.b', 'a.c'], '*.a'));
|
|
179
179
|
//=> ['a.a', 'a.aa']
|
180
180
|
```
|
181
181
|
|
182
|
-
### [.isMatch](index.js#
|
182
|
+
### [.isMatch](index.js#L156)
|
183
183
|
|
184
184
|
Returns true if the specified `string` matches the given glob `pattern`.
|
185
185
|
|
@@ -202,7 +202,7 @@ console.log(mm.isMatch('a.b', '*.a'));
|
|
202
202
|
//=> false
|
203
203
|
```
|
204
204
|
|
205
|
-
### [.some](index.js#
|
205
|
+
### [.some](index.js#L194)
|
206
206
|
|
207
207
|
Returns true if some of the strings in the given `list` match any of the given glob `patterns`.
|
208
208
|
|
@@ -225,7 +225,7 @@ console.log(mm.some(['foo.js'], ['*.js', '!foo.js']));
|
|
225
225
|
// false
|
226
226
|
```
|
227
227
|
|
228
|
-
### [.every](index.js#
|
228
|
+
### [.every](index.js#L230)
|
229
229
|
|
230
230
|
Returns true if every string in the given `list` matches any of the given glob `patterns`.
|
231
231
|
|
@@ -252,7 +252,7 @@ console.log(mm.every(['foo.js'], ['*.js', '!foo.js']));
|
|
252
252
|
// false
|
253
253
|
```
|
254
254
|
|
255
|
-
### [.any](index.js#
|
255
|
+
### [.any](index.js#L262)
|
256
256
|
|
257
257
|
Returns true if **any** of the given glob `patterns` match the specified `string`.
|
258
258
|
|
@@ -275,7 +275,7 @@ console.log(mm.any('a.a', 'b.*'));
|
|
275
275
|
//=> false
|
276
276
|
```
|
277
277
|
|
278
|
-
### [.all](index.js#
|
278
|
+
### [.all](index.js#L310)
|
279
279
|
|
280
280
|
Returns true if **all** of the given `patterns` match the specified string.
|
281
281
|
|
@@ -305,7 +305,7 @@ console.log(mm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js']));
|
|
305
305
|
// true
|
306
306
|
```
|
307
307
|
|
308
|
-
### [.not](index.js#
|
308
|
+
### [.not](index.js#L342)
|
309
309
|
|
310
310
|
Returns a list of strings that _**do not match any**_ of the given `patterns`.
|
311
311
|
|
@@ -326,7 +326,7 @@ console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a'));
|
|
326
326
|
//=> ['b.b', 'c.c']
|
327
327
|
```
|
328
328
|
|
329
|
-
### [.contains](index.js#
|
329
|
+
### [.contains](index.js#L378)
|
330
330
|
|
331
331
|
Returns true if the given `string` contains the given pattern. Similar to [.isMatch](#isMatch) but the pattern can match any part of the string.
|
332
332
|
|
@@ -349,7 +349,7 @@ console.log(mm.contains('aa/bb/cc', '*d'));
|
|
349
349
|
//=> false
|
350
350
|
```
|
351
351
|
|
352
|
-
### [.matchKeys](index.js#
|
352
|
+
### [.matchKeys](index.js#L434)
|
353
353
|
|
354
354
|
Filter the keys of the given object with the given `glob` pattern and `options`. Does not attempt to match nested keys. If you need this feature, use [glob-object](https://github.com/jonschlinkert/glob-object) instead.
|
355
355
|
|
@@ -371,7 +371,7 @@ console.log(mm.matchKeys(obj, '*b'));
|
|
371
371
|
//=> { ab: 'b' }
|
372
372
|
```
|
373
373
|
|
374
|
-
### [.matcher](index.js#
|
374
|
+
### [.matcher](index.js#L463)
|
375
375
|
|
376
376
|
Returns a memoized matcher function from the given glob `pattern` and `options`. The returned function takes a string to match as its only argument and returns true if the string is a match.
|
377
377
|
|
@@ -394,7 +394,7 @@ console.log(isMatch('a.b'));
|
|
394
394
|
//=> true
|
395
395
|
```
|
396
396
|
|
397
|
-
### [.makeRe](index.js#
|
397
|
+
### [.makeRe](index.js#L535)
|
398
398
|
|
399
399
|
Create a regular expression from the given glob `pattern`.
|
400
400
|
|
@@ -414,7 +414,7 @@ console.log(mm.makeRe('*.js'));
|
|
414
414
|
//=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/
|
415
415
|
```
|
416
416
|
|
417
|
-
### [.braces](index.js#
|
417
|
+
### [.braces](index.js#L582)
|
418
418
|
|
419
419
|
Expand the given brace `pattern`.
|
420
420
|
|
@@ -832,7 +832,7 @@ Micromatch also supports extended globbing features.
|
|
832
832
|
|
833
833
|
Extended globbing, as described by the bash man page:
|
834
834
|
|
835
|
-
| **pattern** | **regex equivalent** | **description** |
|
835
|
+
| **pattern** | **regex equivalent** | **description** |
|
836
836
|
| --- | --- | --- |
|
837
837
|
| `?(pattern)` | `(pattern)?` | Matches zero or one occurrence of the given patterns |
|
838
838
|
| `*(pattern)` | `(pattern)*` | Matches zero or more occurrences of the given patterns |
|
@@ -953,58 +953,58 @@ npm i -d && npm run benchmark
|
|
953
953
|
|
954
954
|
### Latest results
|
955
955
|
|
956
|
-
As of
|
956
|
+
As of July 11, 2017 (longer bars are better):
|
957
957
|
|
958
958
|
```sh
|
959
959
|
# braces-globstar-large-list
|
960
|
-
micromatch
|
960
|
+
micromatch ██████████████████████████████████████████████████ (595 ops/sec)
|
961
961
|
minimatch █ (13.95 ops/sec)
|
962
962
|
multimatch █ (14.09 ops/sec)
|
963
963
|
|
964
964
|
# braces-multiple
|
965
|
-
micromatch
|
965
|
+
micromatch ██████████████████████████████████████████████████ (48,362 ops/sec)
|
966
966
|
minimatch (2.18 ops/sec)
|
967
967
|
multimatch (2.15 ops/sec)
|
968
968
|
|
969
969
|
# braces-range
|
970
|
-
micromatch
|
971
|
-
minimatch
|
972
|
-
multimatch
|
970
|
+
micromatch ██████████████████████████████████████████████████ (187,481 ops/sec)
|
971
|
+
minimatch ███ (12,366 ops/sec)
|
972
|
+
multimatch ███ (11,841 ops/sec)
|
973
973
|
|
974
974
|
# braces-set
|
975
|
-
micromatch
|
976
|
-
minimatch
|
977
|
-
multimatch
|
975
|
+
micromatch ██████████████████████████████████████████████████ (24,344 ops/sec)
|
976
|
+
minimatch ████ (2,255 ops/sec)
|
977
|
+
multimatch ████ (2,199 ops/sec)
|
978
978
|
|
979
979
|
# globstar-large-list
|
980
|
-
micromatch
|
981
|
-
minimatch
|
982
|
-
multimatch
|
980
|
+
micromatch ██████████████████████████████████████████████████ (561 ops/sec)
|
981
|
+
minimatch ██ (25.43 ops/sec)
|
982
|
+
multimatch ██ (25.27 ops/sec)
|
983
983
|
|
984
984
|
# globstar-long-list
|
985
|
-
micromatch
|
986
|
-
minimatch
|
987
|
-
multimatch
|
985
|
+
micromatch ██████████████████████████████████████████████████ (3,257 ops/sec)
|
986
|
+
minimatch ███████ (485 ops/sec)
|
987
|
+
multimatch ███████ (485 ops/sec)
|
988
988
|
|
989
989
|
# globstar-short-list
|
990
|
-
micromatch
|
991
|
-
minimatch
|
992
|
-
multimatch
|
990
|
+
micromatch ██████████████████████████████████████████████████ (359,991 ops/sec)
|
991
|
+
minimatch ██████ (44,763 ops/sec)
|
992
|
+
multimatch █████ (39,977 ops/sec)
|
993
993
|
|
994
994
|
# no-glob
|
995
|
-
micromatch
|
996
|
-
minimatch
|
997
|
-
multimatch
|
995
|
+
micromatch ██████████████████████████████████████████████████ (443,740 ops/sec)
|
996
|
+
minimatch ████ (44,152 ops/sec)
|
997
|
+
multimatch ████ (41,077 ops/sec)
|
998
998
|
|
999
999
|
# star-basename
|
1000
|
-
micromatch
|
1001
|
-
minimatch
|
1002
|
-
multimatch
|
1000
|
+
micromatch ██████████████████████████████████████████████████ (10,286 ops/sec)
|
1001
|
+
minimatch ██████████████ (3,059 ops/sec)
|
1002
|
+
multimatch ███████████████ (3,129 ops/sec)
|
1003
1003
|
|
1004
1004
|
# star
|
1005
|
-
micromatch
|
1006
|
-
minimatch
|
1007
|
-
multimatch
|
1005
|
+
micromatch ██████████████████████████████████████████████████ (9,756 ops/sec)
|
1006
|
+
minimatch ███████████████ (2,978 ops/sec)
|
1007
|
+
multimatch ███████████████ (2,970 ops/sec)
|
1008
1008
|
|
1009
1009
|
```
|
1010
1010
|
|
@@ -1016,7 +1016,7 @@ multimatch █████████████████████ (2,97
|
|
1016
1016
|
* [expand-brackets](https://www.npmjs.com/package/expand-brackets): Expand POSIX bracket expressions (character classes) in glob patterns. | [homepage](https://github.com/jonschlinkert/expand-brackets "Expand POSIX bracket expressions (character classes) in glob patterns.")
|
1017
1017
|
* [extglob](https://www.npmjs.com/package/extglob): Extended glob support for JavaScript. Adds (almost) the expressive power of regular expressions to glob… [more](https://github.com/jonschlinkert/extglob) | [homepage](https://github.com/jonschlinkert/extglob "Extended glob support for JavaScript. Adds (almost) the expressive power of regular expressions to glob patterns.")
|
1018
1018
|
* [fill-range](https://www.npmjs.com/package/fill-range): Fill in a range of numbers or letters, optionally passing an increment or `step` to… [more](https://github.com/jonschlinkert/fill-range) | [homepage](https://github.com/jonschlinkert/fill-range "Fill in a range of numbers or letters, optionally passing an increment or `step` to use, or create a regex-compatible range with `options.toRegex`")
|
1019
|
-
* [nanomatch](https://www.npmjs.com/package/nanomatch): Fast, minimal glob matcher for node.js. Similar to micromatch, minimatch and multimatch, but complete Bash… [more](https://github.com/
|
1019
|
+
* [nanomatch](https://www.npmjs.com/package/nanomatch): Fast, minimal glob matcher for node.js. Similar to micromatch, minimatch and multimatch, but complete Bash… [more](https://github.com/micromatch/nanomatch) | [homepage](https://github.com/micromatch/nanomatch "Fast, minimal glob matcher for node.js. Similar to micromatch, minimatch and multimatch, but complete Bash 4.3 wildcard support only (no support for exglobs, posix brackets or braces)")
|
1020
1020
|
|
1021
1021
|
### Contributing
|
1022
1022
|
|
@@ -1026,19 +1026,19 @@ Please read the [contributing guide](.github/contributing.md) for advice on open
|
|
1026
1026
|
|
1027
1027
|
### Contributors
|
1028
1028
|
|
1029
|
-
| **Commits** | **Contributor** |
|
1030
|
-
| --- | --- |
|
1031
|
-
|
|
1032
|
-
| 12
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
| 2
|
1036
|
-
| 2
|
1037
|
-
| 2
|
1038
|
-
| 1
|
1039
|
-
| 1
|
1040
|
-
| 1
|
1041
|
-
| 1
|
1029
|
+
| **Commits** | **Contributor** |
|
1030
|
+
| --- | --- |
|
1031
|
+
| 429 | [jonschlinkert](https://github.com/jonschlinkert) |
|
1032
|
+
| 12 | [es128](https://github.com/es128) |
|
1033
|
+
| 4 | [doowb](https://github.com/doowb) |
|
1034
|
+
| 3 | [paulmillr](https://github.com/paulmillr) |
|
1035
|
+
| 2 | [TrySound](https://github.com/TrySound) |
|
1036
|
+
| 2 | [MartinKolarik](https://github.com/MartinKolarik) |
|
1037
|
+
| 2 | [tunnckoCore](https://github.com/tunnckoCore) |
|
1038
|
+
| 1 | [amilajack](https://github.com/amilajack) |
|
1039
|
+
| 1 | [DianeLooney](https://github.com/DianeLooney) |
|
1040
|
+
| 1 | [UltCombo](https://github.com/UltCombo) |
|
1041
|
+
| 1 | [tomByrer](https://github.com/tomByrer) |
|
1042
1042
|
|
1043
1043
|
### Building docs
|
1044
1044
|
|
@@ -1072,4 +1072,4 @@ Released under the [MIT License](LICENSE).
|
|
1072
1072
|
|
1073
1073
|
***
|
1074
1074
|
|
1075
|
-
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on
|
1075
|
+
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on July 11, 2017._
|
package/index.js
CHANGED
@@ -67,18 +67,6 @@ function micromatch(list, patterns, options) {
|
|
67
67
|
}
|
68
68
|
}
|
69
69
|
|
70
|
-
// minimatch.match parity
|
71
|
-
if (negated && keep.length === 0) {
|
72
|
-
if (options && options.unixify === false) {
|
73
|
-
keep = list.slice();
|
74
|
-
} else {
|
75
|
-
var unixify = utils.unixify(options);
|
76
|
-
for (var i = 0; i < list.length; i++) {
|
77
|
-
keep.push(unixify(list[i]));
|
78
|
-
}
|
79
|
-
}
|
80
|
-
}
|
81
|
-
|
82
70
|
var matches = utils.diff(keep, omit);
|
83
71
|
if (!options || options.nodupes !== false) {
|
84
72
|
return utils.unique(matches);
|
@@ -356,7 +344,8 @@ micromatch.not = function(list, patterns, options) {
|
|
356
344
|
var ignore = opts.ignore;
|
357
345
|
delete opts.ignore;
|
358
346
|
|
359
|
-
|
347
|
+
var unixify = utils.unixify(opts);
|
348
|
+
list = utils.arrayify(list).map(unixify);
|
360
349
|
|
361
350
|
var matches = utils.diff(list, micromatch(list, patterns, opts));
|
362
351
|
if (ignore) {
|
@@ -519,7 +508,11 @@ micromatch.matcher = function matcher(pattern, options) {
|
|
519
508
|
}
|
520
509
|
|
521
510
|
var fn = test(re);
|
522
|
-
fn
|
511
|
+
Object.defineProperty(fn, 'result', {
|
512
|
+
configurable: true,
|
513
|
+
enumerable: false,
|
514
|
+
value: re.result
|
515
|
+
});
|
523
516
|
return fn;
|
524
517
|
};
|
525
518
|
|
@@ -558,7 +551,11 @@ micromatch.makeRe = function(pattern, options) {
|
|
558
551
|
});
|
559
552
|
|
560
553
|
var regex = toRegex(output.join('|'), options);
|
561
|
-
regex
|
554
|
+
Object.defineProperty(regex, 'result', {
|
555
|
+
configurable: true,
|
556
|
+
enumerable: false,
|
557
|
+
value: asts
|
558
|
+
});
|
562
559
|
return regex;
|
563
560
|
}
|
564
561
|
|
@@ -590,6 +587,9 @@ micromatch.braces = function(pattern, options) {
|
|
590
587
|
function expand() {
|
591
588
|
if (options && options.nobrace === true) return [pattern];
|
592
589
|
if (!/\{.*\}/.test(pattern)) return [pattern];
|
590
|
+
// if (/[!@*?+]\{/.test(pattern)) {
|
591
|
+
// options = utils.extend({}, options, {expand: true});
|
592
|
+
// }
|
593
593
|
return braces(pattern, options);
|
594
594
|
}
|
595
595
|
|
package/lib/utils.js
CHANGED
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "micromatch",
|
3
3
|
"description": "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.",
|
4
|
-
"version": "3.0.
|
4
|
+
"version": "3.0.4",
|
5
5
|
"homepage": "https://github.com/micromatch/micromatch",
|
6
6
|
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
|
7
7
|
"contributors": [
|
@@ -34,30 +34,30 @@
|
|
34
34
|
"test": "mocha"
|
35
35
|
},
|
36
36
|
"dependencies": {
|
37
|
-
"arr-diff": "^
|
37
|
+
"arr-diff": "^4.0.0",
|
38
38
|
"array-unique": "^0.3.2",
|
39
|
-
"braces": "^2.
|
40
|
-
"define-property": "^0.
|
39
|
+
"braces": "^2.2.2",
|
40
|
+
"define-property": "^1.0.0",
|
41
41
|
"extend-shallow": "^2.0.1",
|
42
42
|
"extglob": "^1.1.0",
|
43
43
|
"fragment-cache": "^0.2.1",
|
44
|
-
"kind-of": "^
|
45
|
-
"nanomatch": "^1.
|
44
|
+
"kind-of": "^4.0.0",
|
45
|
+
"nanomatch": "^1.2.0",
|
46
46
|
"object.pick": "^1.2.0",
|
47
47
|
"regex-not": "^1.0.0",
|
48
48
|
"snapdragon": "^0.8.1",
|
49
49
|
"to-regex": "^3.0.1"
|
50
50
|
},
|
51
51
|
"devDependencies": {
|
52
|
-
"bash-match": "^0.2
|
53
|
-
"extend-shallow": "^2.0.1",
|
52
|
+
"bash-match": "^1.0.2",
|
54
53
|
"for-own": "^1.0.0",
|
55
54
|
"gulp": "^3.9.1",
|
55
|
+
"gulp-format-md": "^0.1.12",
|
56
56
|
"gulp-istanbul": "^1.1.1",
|
57
|
-
"gulp-mocha": "^3.
|
57
|
+
"gulp-mocha": "^4.3.1",
|
58
58
|
"gulp-unused": "^0.2.1",
|
59
59
|
"is-windows": "^1.0.1",
|
60
|
-
"minimatch": "^3.0.
|
60
|
+
"minimatch": "^3.0.4",
|
61
61
|
"minimist": "^1.2.0",
|
62
62
|
"mocha": "^3.4.2",
|
63
63
|
"multimatch": "^2.1.0"
|
@@ -93,8 +93,14 @@
|
|
93
93
|
],
|
94
94
|
"lintDeps": {
|
95
95
|
"dependencies": {
|
96
|
-
"
|
97
|
-
"
|
96
|
+
"files": [
|
97
|
+
"index.js",
|
98
|
+
"lib/**"
|
99
|
+
],
|
100
|
+
"options": {
|
101
|
+
"lock": {
|
102
|
+
"snapdragon": "^0.8.1"
|
103
|
+
}
|
98
104
|
}
|
99
105
|
},
|
100
106
|
"devDependencies": {
|
@@ -135,12 +141,12 @@
|
|
135
141
|
"reflinks": true
|
136
142
|
},
|
137
143
|
"reflinks": [
|
144
|
+
"expand-brackets",
|
138
145
|
"extglob",
|
139
146
|
"glob-object",
|
140
147
|
"minimatch",
|
141
148
|
"multimatch",
|
142
|
-
"snapdragon"
|
143
|
-
"expand-brackets"
|
149
|
+
"snapdragon"
|
144
150
|
]
|
145
151
|
}
|
146
152
|
}
|