micromatch 2.3.11 → 3.0.3

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/package.json CHANGED
@@ -1,12 +1,25 @@
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": "2.3.11",
5
- "homepage": "https://github.com/jonschlinkert/micromatch",
4
+ "version": "3.0.3",
5
+ "homepage": "https://github.com/micromatch/micromatch",
6
6
  "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
7
- "repository": "jonschlinkert/micromatch",
7
+ "contributors": [
8
+ "Amila Welihinda (amilajack.com)",
9
+ "Bogdan Chadkin (https://github.com/TrySound)",
10
+ "Brian Woodward (https://twitter.com/doowb)",
11
+ "Charlike Mike Reagent (https://i.am.charlike.online)",
12
+ "Elan Shanker (https://github.com/es128)",
13
+ "Fabrício Matté (http://ultcombo.js.org)",
14
+ "Jon Schlinkert (http://twitter.com/jonschlinkert)",
15
+ "Martin Kolárik (https://kolarik.sk)",
16
+ "Paul Miller (paulmillr.com)",
17
+ "Tom Byrer (https://github.com/tomByrer)",
18
+ "(https://github.com/DianeLooney)"
19
+ ],
20
+ "repository": "micromatch/micromatch",
8
21
  "bugs": {
9
- "url": "https://github.com/jonschlinkert/micromatch/issues"
22
+ "url": "https://github.com/micromatch/micromatch/issues"
10
23
  },
11
24
  "license": "MIT",
12
25
  "files": [
@@ -21,34 +34,33 @@
21
34
  "test": "mocha"
22
35
  },
23
36
  "dependencies": {
24
- "arr-diff": "^2.0.0",
25
- "array-unique": "^0.2.1",
26
- "braces": "^1.8.2",
27
- "expand-brackets": "^0.1.4",
28
- "extglob": "^0.3.1",
29
- "filename-regex": "^2.0.0",
30
- "is-extglob": "^1.0.0",
31
- "is-glob": "^2.0.1",
32
- "kind-of": "^3.0.2",
33
- "normalize-path": "^2.0.1",
34
- "object.omit": "^2.0.0",
35
- "parse-glob": "^3.0.4",
36
- "regex-cache": "^0.4.2"
37
+ "arr-diff": "^4.0.0",
38
+ "array-unique": "^0.3.2",
39
+ "braces": "^2.2.2",
40
+ "define-property": "^1.0.0",
41
+ "extend-shallow": "^2.0.1",
42
+ "extglob": "^1.1.0",
43
+ "fragment-cache": "^0.2.1",
44
+ "kind-of": "^4.0.0",
45
+ "nanomatch": "^1.2.0",
46
+ "object.pick": "^1.2.0",
47
+ "regex-not": "^1.0.0",
48
+ "snapdragon": "^0.8.1",
49
+ "to-regex": "^3.0.1"
37
50
  },
38
51
  "devDependencies": {
39
- "benchmarked": "^0.1.4",
40
- "chalk": "^1.1.1",
41
- "gulp": "^3.9.0",
42
- "gulp-eslint": "^1.1.1",
43
- "gulp-format-md": "^0.1.8",
44
- "gulp-istanbul": "^0.10.1",
45
- "gulp-mocha": "^2.1.3",
46
- "minimatch": "^3.0.0",
52
+ "bash-match": "^1.0.2",
53
+ "for-own": "^1.0.0",
54
+ "gulp": "^3.9.1",
55
+ "gulp-format-md": "^0.1.12",
56
+ "gulp-istanbul": "^1.1.1",
57
+ "gulp-mocha": "^4.3.1",
58
+ "gulp-unused": "^0.2.1",
59
+ "is-windows": "^1.0.1",
60
+ "minimatch": "^3.0.4",
47
61
  "minimist": "^1.2.0",
48
- "mocha": "^2",
49
- "multimatch": "^2.0.0",
50
- "should": "^8",
51
- "write": "^0.2.1"
62
+ "mocha": "^3.4.2",
63
+ "multimatch": "^2.1.0"
52
64
  },
53
65
  "keywords": [
54
66
  "bash",
@@ -67,6 +79,7 @@
67
79
  "matcher",
68
80
  "matches",
69
81
  "matching",
82
+ "micromatch",
70
83
  "minimatch",
71
84
  "multimatch",
72
85
  "path",
@@ -78,37 +91,62 @@
78
91
  "shell",
79
92
  "wildcard"
80
93
  ],
94
+ "lintDeps": {
95
+ "dependencies": {
96
+ "files": [
97
+ "index.js",
98
+ "lib/**"
99
+ ],
100
+ "options": {
101
+ "lock": {
102
+ "snapdragon": "^0.8.1"
103
+ }
104
+ }
105
+ },
106
+ "devDependencies": {
107
+ "options": {
108
+ "ignore": [
109
+ "benchmark/**"
110
+ ]
111
+ },
112
+ "files": [
113
+ "examples/*.js",
114
+ "gulpfile.js",
115
+ "test/**/*.js"
116
+ ]
117
+ }
118
+ },
81
119
  "verb": {
120
+ "toc": "collapsible",
121
+ "layout": "default",
122
+ "tasks": [
123
+ "readme"
124
+ ],
125
+ "plugins": [
126
+ "gulp-format-md"
127
+ ],
128
+ "helpers": [
129
+ "./benchmark/helper.js"
130
+ ],
82
131
  "related": {
83
132
  "list": [
84
133
  "braces",
85
134
  "expand-brackets",
86
- "expand-range",
87
135
  "extglob",
88
136
  "fill-range",
89
- "gulp-micromatch",
90
- "is-glob",
91
- "parse-glob"
137
+ "nanomatch"
92
138
  ]
93
139
  },
140
+ "lint": {
141
+ "reflinks": true
142
+ },
94
143
  "reflinks": [
95
- "braces",
96
144
  "expand-brackets",
97
145
  "extglob",
146
+ "glob-object",
98
147
  "minimatch",
99
148
  "multimatch",
100
- "verb"
101
- ],
102
- "toc": false,
103
- "layout": false,
104
- "tasks": [
105
- "readme"
106
- ],
107
- "plugins": [
108
- "gulp-format-md"
109
- ],
110
- "lint": {
111
- "reflinks": true
112
- }
149
+ "snapdragon"
150
+ ]
113
151
  }
114
152
  }
package/lib/chars.js DELETED
@@ -1,67 +0,0 @@
1
- 'use strict';
2
-
3
- var chars = {}, unesc, temp;
4
-
5
- function reverse(object, prepender) {
6
- return Object.keys(object).reduce(function(reversed, key) {
7
- var newKey = prepender ? prepender + key : key; // Optionally prepend a string to key.
8
- reversed[object[key]] = newKey; // Swap key and value.
9
- return reversed; // Return the result.
10
- }, {});
11
- }
12
-
13
- /**
14
- * Regex for common characters
15
- */
16
-
17
- chars.escapeRegex = {
18
- '?': /\?/g,
19
- '@': /\@/g,
20
- '!': /\!/g,
21
- '+': /\+/g,
22
- '*': /\*/g,
23
- '(': /\(/g,
24
- ')': /\)/g,
25
- '[': /\[/g,
26
- ']': /\]/g
27
- };
28
-
29
- /**
30
- * Escape characters
31
- */
32
-
33
- chars.ESC = {
34
- '?': '__UNESC_QMRK__',
35
- '@': '__UNESC_AMPE__',
36
- '!': '__UNESC_EXCL__',
37
- '+': '__UNESC_PLUS__',
38
- '*': '__UNESC_STAR__',
39
- ',': '__UNESC_COMMA__',
40
- '(': '__UNESC_LTPAREN__',
41
- ')': '__UNESC_RTPAREN__',
42
- '[': '__UNESC_LTBRACK__',
43
- ']': '__UNESC_RTBRACK__'
44
- };
45
-
46
- /**
47
- * Unescape characters
48
- */
49
-
50
- chars.UNESC = unesc || (unesc = reverse(chars.ESC, '\\'));
51
-
52
- chars.ESC_TEMP = {
53
- '?': '__TEMP_QMRK__',
54
- '@': '__TEMP_AMPE__',
55
- '!': '__TEMP_EXCL__',
56
- '*': '__TEMP_STAR__',
57
- '+': '__TEMP_PLUS__',
58
- ',': '__TEMP_COMMA__',
59
- '(': '__TEMP_LTPAREN__',
60
- ')': '__TEMP_RTPAREN__',
61
- '[': '__TEMP_LTBRACK__',
62
- ']': '__TEMP_RTBRACK__'
63
- };
64
-
65
- chars.TEMP = temp || (temp = reverse(chars.ESC_TEMP));
66
-
67
- module.exports = chars;
package/lib/expand.js DELETED
@@ -1,304 +0,0 @@
1
- /*!
2
- * micromatch <https://github.com/jonschlinkert/micromatch>
3
- *
4
- * Copyright (c) 2014-2015, Jon Schlinkert.
5
- * Licensed under the MIT License.
6
- */
7
-
8
- 'use strict';
9
-
10
- var utils = require('./utils');
11
- var Glob = require('./glob');
12
-
13
- /**
14
- * Expose `expand`
15
- */
16
-
17
- module.exports = expand;
18
-
19
- /**
20
- * Expand a glob pattern to resolve braces and
21
- * similar patterns before converting to regex.
22
- *
23
- * @param {String|Array} `pattern`
24
- * @param {Array} `files`
25
- * @param {Options} `opts`
26
- * @return {Array}
27
- */
28
-
29
- function expand(pattern, options) {
30
- if (typeof pattern !== 'string') {
31
- throw new TypeError('micromatch.expand(): argument should be a string.');
32
- }
33
-
34
- var glob = new Glob(pattern, options || {});
35
- var opts = glob.options;
36
-
37
- if (!utils.isGlob(pattern)) {
38
- glob.pattern = glob.pattern.replace(/([\/.])/g, '\\$1');
39
- return glob;
40
- }
41
-
42
- glob.pattern = glob.pattern.replace(/(\+)(?!\()/g, '\\$1');
43
- glob.pattern = glob.pattern.split('$').join('\\$');
44
-
45
- if (typeof opts.braces !== 'boolean' && typeof opts.nobraces !== 'boolean') {
46
- opts.braces = true;
47
- }
48
-
49
- if (glob.pattern === '.*') {
50
- return {
51
- pattern: '\\.' + star,
52
- tokens: tok,
53
- options: opts
54
- };
55
- }
56
-
57
- if (glob.pattern === '*') {
58
- return {
59
- pattern: oneStar(opts.dot),
60
- tokens: tok,
61
- options: opts
62
- };
63
- }
64
-
65
- // parse the glob pattern into tokens
66
- glob.parse();
67
- var tok = glob.tokens;
68
- tok.is.negated = opts.negated;
69
-
70
- // dotfile handling
71
- if ((opts.dotfiles === true || tok.is.dotfile) && opts.dot !== false) {
72
- opts.dotfiles = true;
73
- opts.dot = true;
74
- }
75
-
76
- if ((opts.dotdirs === true || tok.is.dotdir) && opts.dot !== false) {
77
- opts.dotdirs = true;
78
- opts.dot = true;
79
- }
80
-
81
- // check for braces with a dotfile pattern
82
- if (/[{,]\./.test(glob.pattern)) {
83
- opts.makeRe = false;
84
- opts.dot = true;
85
- }
86
-
87
- if (opts.nonegate !== true) {
88
- opts.negated = glob.negated;
89
- }
90
-
91
- // if the leading character is a dot or a slash, escape it
92
- if (glob.pattern.charAt(0) === '.' && glob.pattern.charAt(1) !== '/') {
93
- glob.pattern = '\\' + glob.pattern;
94
- }
95
-
96
- /**
97
- * Extended globs
98
- */
99
-
100
- // expand braces, e.g `{1..5}`
101
- glob.track('before braces');
102
- if (tok.is.braces) {
103
- glob.braces();
104
- }
105
- glob.track('after braces');
106
-
107
- // expand extglobs, e.g `foo/!(a|b)`
108
- glob.track('before extglob');
109
- if (tok.is.extglob) {
110
- glob.extglob();
111
- }
112
- glob.track('after extglob');
113
-
114
- // expand brackets, e.g `[[:alpha:]]`
115
- glob.track('before brackets');
116
- if (tok.is.brackets) {
117
- glob.brackets();
118
- }
119
- glob.track('after brackets');
120
-
121
- // special patterns
122
- glob._replace('[!', '[^');
123
- glob._replace('(?', '(%~');
124
- glob._replace(/\[\]/, '\\[\\]');
125
- glob._replace('/[', '/' + (opts.dot ? dotfiles : nodot) + '[', true);
126
- glob._replace('/?', '/' + (opts.dot ? dotfiles : nodot) + '[^/]', true);
127
- glob._replace('/.', '/(?=.)\\.', true);
128
-
129
- // windows drives
130
- glob._replace(/^(\w):([\\\/]+?)/gi, '(?=.)$1:$2', true);
131
-
132
- // negate slashes in exclusion ranges
133
- if (glob.pattern.indexOf('[^') !== -1) {
134
- glob.pattern = negateSlash(glob.pattern);
135
- }
136
-
137
- if (opts.globstar !== false && glob.pattern === '**') {
138
- glob.pattern = globstar(opts.dot);
139
-
140
- } else {
141
- glob.pattern = balance(glob.pattern, '[', ']');
142
- glob.escape(glob.pattern);
143
-
144
- // if the pattern has `**`
145
- if (tok.is.globstar) {
146
- glob.pattern = collapse(glob.pattern, '/**');
147
- glob.pattern = collapse(glob.pattern, '**/');
148
- glob._replace('/**/', '(?:/' + globstar(opts.dot) + '/|/)', true);
149
- glob._replace(/\*{2,}/g, '**');
150
-
151
- // 'foo/*'
152
- glob._replace(/(\w+)\*(?!\/)/g, '$1[^/]*?', true);
153
- glob._replace(/\*\*\/\*(\w)/g, globstar(opts.dot) + '\\/' + (opts.dot ? dotfiles : nodot) + '[^/]*?$1', true);
154
-
155
- if (opts.dot !== true) {
156
- glob._replace(/\*\*\/(.)/g, '(?:**\\/|)$1');
157
- }
158
-
159
- // 'foo/**' or '{**,*}', but not 'foo**'
160
- if (tok.path.dirname !== '' || /,\*\*|\*\*,/.test(glob.orig)) {
161
- glob._replace('**', globstar(opts.dot), true);
162
- }
163
- }
164
-
165
- // ends with /*
166
- glob._replace(/\/\*$/, '\\/' + oneStar(opts.dot), true);
167
- // ends with *, no slashes
168
- glob._replace(/(?!\/)\*$/, star, true);
169
- // has 'n*.' (partial wildcard w/ file extension)
170
- glob._replace(/([^\/]+)\*/, '$1' + oneStar(true), true);
171
- // has '*'
172
- glob._replace('*', oneStar(opts.dot), true);
173
- glob._replace('?.', '?\\.', true);
174
- glob._replace('?:', '?:', true);
175
-
176
- glob._replace(/\?+/g, function(match) {
177
- var len = match.length;
178
- if (len === 1) {
179
- return qmark;
180
- }
181
- return qmark + '{' + len + '}';
182
- });
183
-
184
- // escape '.abc' => '\\.abc'
185
- glob._replace(/\.([*\w]+)/g, '\\.$1');
186
- // fix '[^\\\\/]'
187
- glob._replace(/\[\^[\\\/]+\]/g, qmark);
188
- // '///' => '\/'
189
- glob._replace(/\/+/g, '\\/');
190
- // '\\\\\\' => '\\'
191
- glob._replace(/\\{2,}/g, '\\');
192
- }
193
-
194
- // unescape previously escaped patterns
195
- glob.unescape(glob.pattern);
196
- glob._replace('__UNESC_STAR__', '*');
197
-
198
- // escape dots that follow qmarks
199
- glob._replace('?.', '?\\.');
200
-
201
- // remove unnecessary slashes in character classes
202
- glob._replace('[^\\/]', qmark);
203
-
204
- if (glob.pattern.length > 1) {
205
- if (/^[\[?*]/.test(glob.pattern)) {
206
- // only prepend the string if we don't want to match dotfiles
207
- glob.pattern = (opts.dot ? dotfiles : nodot) + glob.pattern;
208
- }
209
- }
210
-
211
- return glob;
212
- }
213
-
214
- /**
215
- * Collapse repeated character sequences.
216
- *
217
- * ```js
218
- * collapse('a/../../../b', '../');
219
- * //=> 'a/../b'
220
- * ```
221
- *
222
- * @param {String} `str`
223
- * @param {String} `ch` Character sequence to collapse
224
- * @return {String}
225
- */
226
-
227
- function collapse(str, ch) {
228
- var res = str.split(ch);
229
- var isFirst = res[0] === '';
230
- var isLast = res[res.length - 1] === '';
231
- res = res.filter(Boolean);
232
- if (isFirst) res.unshift('');
233
- if (isLast) res.push('');
234
- return res.join(ch);
235
- }
236
-
237
- /**
238
- * Negate slashes in exclusion ranges, per glob spec:
239
- *
240
- * ```js
241
- * negateSlash('[^foo]');
242
- * //=> '[^\\/foo]'
243
- * ```
244
- *
245
- * @param {String} `str` glob pattern
246
- * @return {String}
247
- */
248
-
249
- function negateSlash(str) {
250
- return str.replace(/\[\^([^\]]*?)\]/g, function(match, inner) {
251
- if (inner.indexOf('/') === -1) {
252
- inner = '\\/' + inner;
253
- }
254
- return '[^' + inner + ']';
255
- });
256
- }
257
-
258
- /**
259
- * Escape imbalanced braces/bracket. This is a very
260
- * basic, naive implementation that only does enough
261
- * to serve the purpose.
262
- */
263
-
264
- function balance(str, a, b) {
265
- var aarr = str.split(a);
266
- var alen = aarr.join('').length;
267
- var blen = str.split(b).join('').length;
268
-
269
- if (alen !== blen) {
270
- str = aarr.join('\\' + a);
271
- return str.split(b).join('\\' + b);
272
- }
273
- return str;
274
- }
275
-
276
- /**
277
- * Special patterns to be converted to regex.
278
- * Heuristics are used to simplify patterns
279
- * and speed up processing.
280
- */
281
-
282
- /* eslint no-multi-spaces: 0 */
283
- var qmark = '[^/]';
284
- var star = qmark + '*?';
285
- var nodot = '(?!\\.)(?=.)';
286
- var dotfileGlob = '(?:\\/|^)\\.{1,2}($|\\/)';
287
- var dotfiles = '(?!' + dotfileGlob + ')(?=.)';
288
- var twoStarDot = '(?:(?!' + dotfileGlob + ').)*?';
289
-
290
- /**
291
- * Create a regex for `*`.
292
- *
293
- * If `dot` is true, or the pattern does not begin with
294
- * a leading star, then return the simpler regex.
295
- */
296
-
297
- function oneStar(dotfile) {
298
- return dotfile ? '(?!' + dotfileGlob + ')(?=.)' + star : (nodot + star);
299
- }
300
-
301
- function globstar(dotfile) {
302
- if (dotfile) { return twoStarDot; }
303
- return '(?:(?!(?:\\/|^)\\.).)*?';
304
- }