minimatch 3.0.0 → 3.0.2
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.
- package/README.md +2 -9
- package/minimatch.js +15 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A minimal matching utility.
|
|
4
4
|
|
|
5
|
-
[](http://travis-ci.org/isaacs/minimatch)
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
This is the matching library used internally by npm.
|
|
@@ -37,7 +37,7 @@ See:
|
|
|
37
37
|
|
|
38
38
|
## Minimatch Class
|
|
39
39
|
|
|
40
|
-
Create a minimatch object by
|
|
40
|
+
Create a minimatch object by instantiating the `minimatch.Minimatch` class.
|
|
41
41
|
|
|
42
42
|
```javascript
|
|
43
43
|
var Minimatch = require("minimatch").Minimatch
|
|
@@ -82,13 +82,6 @@ var mm = new Minimatch(pattern, options)
|
|
|
82
82
|
|
|
83
83
|
All other methods are internal, and will be called as necessary.
|
|
84
84
|
|
|
85
|
-
## Functions
|
|
86
|
-
|
|
87
|
-
The top-level exported function has a `cache` property, which is an LRU
|
|
88
|
-
cache set to store 100 items. So, calling these methods repeatedly
|
|
89
|
-
with the same pattern and options will use the same Minimatch object,
|
|
90
|
-
saving the cost of parsing it multiple times.
|
|
91
|
-
|
|
92
85
|
### minimatch(path, pattern, options)
|
|
93
86
|
|
|
94
87
|
Main export. Tests a path against the pattern using the options.
|
package/minimatch.js
CHANGED
|
@@ -235,7 +235,7 @@ function braceExpand (pattern, options) {
|
|
|
235
235
|
? this.pattern : pattern
|
|
236
236
|
|
|
237
237
|
if (typeof pattern === 'undefined') {
|
|
238
|
-
throw new
|
|
238
|
+
throw new TypeError('undefined pattern')
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
if (options.nobrace ||
|
|
@@ -261,6 +261,10 @@ function braceExpand (pattern, options) {
|
|
|
261
261
|
Minimatch.prototype.parse = parse
|
|
262
262
|
var SUBPARSE = {}
|
|
263
263
|
function parse (pattern, isSub) {
|
|
264
|
+
if (pattern.length > 1024 * 64) {
|
|
265
|
+
throw new TypeError('pattern is too long')
|
|
266
|
+
}
|
|
267
|
+
|
|
264
268
|
var options = this.options
|
|
265
269
|
|
|
266
270
|
// shortcuts
|
|
@@ -518,7 +522,7 @@ function parse (pattern, isSub) {
|
|
|
518
522
|
for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
|
|
519
523
|
var tail = re.slice(pl.reStart + 3)
|
|
520
524
|
// maybe some even number of \, then maybe 1 \, followed by a |
|
|
521
|
-
tail = tail.replace(/((?:\\{2})
|
|
525
|
+
tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) {
|
|
522
526
|
if (!$2) {
|
|
523
527
|
// the | isn't already escaped, so escape it.
|
|
524
528
|
$2 = '\\'
|
|
@@ -615,7 +619,15 @@ function parse (pattern, isSub) {
|
|
|
615
619
|
}
|
|
616
620
|
|
|
617
621
|
var flags = options.nocase ? 'i' : ''
|
|
618
|
-
|
|
622
|
+
try {
|
|
623
|
+
var regExp = new RegExp('^' + re + '$', flags)
|
|
624
|
+
} catch (er) {
|
|
625
|
+
// If it was an invalid regular expression, then it can't match
|
|
626
|
+
// anything. This trick looks for a character after the end of
|
|
627
|
+
// the string, which is of course impossible, except in multi-line
|
|
628
|
+
// mode, but it's not a /m regex.
|
|
629
|
+
return new RegExp('$.')
|
|
630
|
+
}
|
|
619
631
|
|
|
620
632
|
regExp._glob = pattern
|
|
621
633
|
regExp._src = re
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)",
|
|
3
3
|
"name": "minimatch",
|
|
4
4
|
"description": "a glob matcher in javascript",
|
|
5
|
-
"version": "3.0.
|
|
5
|
+
"version": "3.0.2",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git://github.com/isaacs/minimatch.git"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"standard": "^3.7.2",
|
|
23
|
-
"tap": "^
|
|
23
|
+
"tap": "^5.6.0"
|
|
24
24
|
},
|
|
25
25
|
"license": "ISC",
|
|
26
26
|
"files": [
|