@markw65/monkeyc-optimizer 1.0.38 → 1.0.39
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 +30 -0
- package/build/api.cjs +385 -131
- package/build/optimizer.cjs +375 -6913
- package/build/sdk-util.cjs +211 -7146
- package/build/src/api.d.ts +4 -3
- package/build/src/jungles.d.ts +4 -0
- package/build/src/launch.d.ts +1 -1
- package/build/src/manifest.d.ts +2 -63
- package/build/src/mc-rewrite.d.ts +4 -2
- package/build/src/optimizer-types.d.ts +0 -5
- package/build/src/optimizer.d.ts +16 -3
- package/build/src/resources.d.ts +5 -0
- package/build/src/sdk-util.d.ts +5 -1
- package/build/src/visitor.d.ts +1 -0
- package/build/src/xml-util.d.ts +139 -0
- package/build/util.cjs +1491 -1565
- package/package.json +9 -11
package/build/util.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/******/ (() => { // webpackBootstrap
|
|
3
3
|
/******/ var __webpack_modules__ = ({
|
|
4
4
|
|
|
5
|
-
/***/
|
|
5
|
+
/***/ 623:
|
|
6
6
|
/***/ ((module) => {
|
|
7
7
|
|
|
8
8
|
"use strict";
|
|
@@ -72,235 +72,7 @@ function range(a, b, str) {
|
|
|
72
72
|
|
|
73
73
|
/***/ }),
|
|
74
74
|
|
|
75
|
-
/***/
|
|
76
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
77
|
-
|
|
78
|
-
var concatMap = __webpack_require__(1048);
|
|
79
|
-
var balanced = __webpack_require__(5623);
|
|
80
|
-
|
|
81
|
-
module.exports = expandTop;
|
|
82
|
-
|
|
83
|
-
var escSlash = '\0SLASH'+Math.random()+'\0';
|
|
84
|
-
var escOpen = '\0OPEN'+Math.random()+'\0';
|
|
85
|
-
var escClose = '\0CLOSE'+Math.random()+'\0';
|
|
86
|
-
var escComma = '\0COMMA'+Math.random()+'\0';
|
|
87
|
-
var escPeriod = '\0PERIOD'+Math.random()+'\0';
|
|
88
|
-
|
|
89
|
-
function numeric(str) {
|
|
90
|
-
return parseInt(str, 10) == str
|
|
91
|
-
? parseInt(str, 10)
|
|
92
|
-
: str.charCodeAt(0);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function escapeBraces(str) {
|
|
96
|
-
return str.split('\\\\').join(escSlash)
|
|
97
|
-
.split('\\{').join(escOpen)
|
|
98
|
-
.split('\\}').join(escClose)
|
|
99
|
-
.split('\\,').join(escComma)
|
|
100
|
-
.split('\\.').join(escPeriod);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function unescapeBraces(str) {
|
|
104
|
-
return str.split(escSlash).join('\\')
|
|
105
|
-
.split(escOpen).join('{')
|
|
106
|
-
.split(escClose).join('}')
|
|
107
|
-
.split(escComma).join(',')
|
|
108
|
-
.split(escPeriod).join('.');
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
// Basically just str.split(","), but handling cases
|
|
113
|
-
// where we have nested braced sections, which should be
|
|
114
|
-
// treated as individual members, like {a,{b,c},d}
|
|
115
|
-
function parseCommaParts(str) {
|
|
116
|
-
if (!str)
|
|
117
|
-
return [''];
|
|
118
|
-
|
|
119
|
-
var parts = [];
|
|
120
|
-
var m = balanced('{', '}', str);
|
|
121
|
-
|
|
122
|
-
if (!m)
|
|
123
|
-
return str.split(',');
|
|
124
|
-
|
|
125
|
-
var pre = m.pre;
|
|
126
|
-
var body = m.body;
|
|
127
|
-
var post = m.post;
|
|
128
|
-
var p = pre.split(',');
|
|
129
|
-
|
|
130
|
-
p[p.length-1] += '{' + body + '}';
|
|
131
|
-
var postParts = parseCommaParts(post);
|
|
132
|
-
if (post.length) {
|
|
133
|
-
p[p.length-1] += postParts.shift();
|
|
134
|
-
p.push.apply(p, postParts);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
parts.push.apply(parts, p);
|
|
138
|
-
|
|
139
|
-
return parts;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function expandTop(str) {
|
|
143
|
-
if (!str)
|
|
144
|
-
return [];
|
|
145
|
-
|
|
146
|
-
// I don't know why Bash 4.3 does this, but it does.
|
|
147
|
-
// Anything starting with {} will have the first two bytes preserved
|
|
148
|
-
// but *only* at the top level, so {},a}b will not expand to anything,
|
|
149
|
-
// but a{},b}c will be expanded to [a}c,abc].
|
|
150
|
-
// One could argue that this is a bug in Bash, but since the goal of
|
|
151
|
-
// this module is to match Bash's rules, we escape a leading {}
|
|
152
|
-
if (str.substr(0, 2) === '{}') {
|
|
153
|
-
str = '\\{\\}' + str.substr(2);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
return expand(escapeBraces(str), true).map(unescapeBraces);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function identity(e) {
|
|
160
|
-
return e;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
function embrace(str) {
|
|
164
|
-
return '{' + str + '}';
|
|
165
|
-
}
|
|
166
|
-
function isPadded(el) {
|
|
167
|
-
return /^-?0\d/.test(el);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
function lte(i, y) {
|
|
171
|
-
return i <= y;
|
|
172
|
-
}
|
|
173
|
-
function gte(i, y) {
|
|
174
|
-
return i >= y;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
function expand(str, isTop) {
|
|
178
|
-
var expansions = [];
|
|
179
|
-
|
|
180
|
-
var m = balanced('{', '}', str);
|
|
181
|
-
if (!m || /\$$/.test(m.pre)) return [str];
|
|
182
|
-
|
|
183
|
-
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
184
|
-
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
185
|
-
var isSequence = isNumericSequence || isAlphaSequence;
|
|
186
|
-
var isOptions = m.body.indexOf(',') >= 0;
|
|
187
|
-
if (!isSequence && !isOptions) {
|
|
188
|
-
// {a},b}
|
|
189
|
-
if (m.post.match(/,.*\}/)) {
|
|
190
|
-
str = m.pre + '{' + m.body + escClose + m.post;
|
|
191
|
-
return expand(str);
|
|
192
|
-
}
|
|
193
|
-
return [str];
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
var n;
|
|
197
|
-
if (isSequence) {
|
|
198
|
-
n = m.body.split(/\.\./);
|
|
199
|
-
} else {
|
|
200
|
-
n = parseCommaParts(m.body);
|
|
201
|
-
if (n.length === 1) {
|
|
202
|
-
// x{{a,b}}y ==> x{a}y x{b}y
|
|
203
|
-
n = expand(n[0], false).map(embrace);
|
|
204
|
-
if (n.length === 1) {
|
|
205
|
-
var post = m.post.length
|
|
206
|
-
? expand(m.post, false)
|
|
207
|
-
: [''];
|
|
208
|
-
return post.map(function(p) {
|
|
209
|
-
return m.pre + n[0] + p;
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// at this point, n is the parts, and we know it's not a comma set
|
|
216
|
-
// with a single entry.
|
|
217
|
-
|
|
218
|
-
// no need to expand pre, since it is guaranteed to be free of brace-sets
|
|
219
|
-
var pre = m.pre;
|
|
220
|
-
var post = m.post.length
|
|
221
|
-
? expand(m.post, false)
|
|
222
|
-
: [''];
|
|
223
|
-
|
|
224
|
-
var N;
|
|
225
|
-
|
|
226
|
-
if (isSequence) {
|
|
227
|
-
var x = numeric(n[0]);
|
|
228
|
-
var y = numeric(n[1]);
|
|
229
|
-
var width = Math.max(n[0].length, n[1].length)
|
|
230
|
-
var incr = n.length == 3
|
|
231
|
-
? Math.abs(numeric(n[2]))
|
|
232
|
-
: 1;
|
|
233
|
-
var test = lte;
|
|
234
|
-
var reverse = y < x;
|
|
235
|
-
if (reverse) {
|
|
236
|
-
incr *= -1;
|
|
237
|
-
test = gte;
|
|
238
|
-
}
|
|
239
|
-
var pad = n.some(isPadded);
|
|
240
|
-
|
|
241
|
-
N = [];
|
|
242
|
-
|
|
243
|
-
for (var i = x; test(i, y); i += incr) {
|
|
244
|
-
var c;
|
|
245
|
-
if (isAlphaSequence) {
|
|
246
|
-
c = String.fromCharCode(i);
|
|
247
|
-
if (c === '\\')
|
|
248
|
-
c = '';
|
|
249
|
-
} else {
|
|
250
|
-
c = String(i);
|
|
251
|
-
if (pad) {
|
|
252
|
-
var need = width - c.length;
|
|
253
|
-
if (need > 0) {
|
|
254
|
-
var z = new Array(need + 1).join('0');
|
|
255
|
-
if (i < 0)
|
|
256
|
-
c = '-' + z + c.slice(1);
|
|
257
|
-
else
|
|
258
|
-
c = z + c;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
N.push(c);
|
|
263
|
-
}
|
|
264
|
-
} else {
|
|
265
|
-
N = concatMap(n, function(el) { return expand(el, false) });
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
for (var j = 0; j < N.length; j++) {
|
|
269
|
-
for (var k = 0; k < post.length; k++) {
|
|
270
|
-
var expansion = pre + N[j] + post[k];
|
|
271
|
-
if (!isTop || isSequence || expansion)
|
|
272
|
-
expansions.push(expansion);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
return expansions;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
/***/ }),
|
|
282
|
-
|
|
283
|
-
/***/ 1048:
|
|
284
|
-
/***/ ((module) => {
|
|
285
|
-
|
|
286
|
-
module.exports = function (xs, fn) {
|
|
287
|
-
var res = [];
|
|
288
|
-
for (var i = 0; i < xs.length; i++) {
|
|
289
|
-
var x = fn(xs[i], i);
|
|
290
|
-
if (isArray(x)) res.push.apply(res, x);
|
|
291
|
-
else res.push(x);
|
|
292
|
-
}
|
|
293
|
-
return res;
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
var isArray = Array.isArray || function (xs) {
|
|
297
|
-
return Object.prototype.toString.call(xs) === '[object Array]';
|
|
298
|
-
};
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
/***/ }),
|
|
302
|
-
|
|
303
|
-
/***/ 7187:
|
|
75
|
+
/***/ 187:
|
|
304
76
|
/***/ ((module) => {
|
|
305
77
|
|
|
306
78
|
"use strict";
|
|
@@ -805,7 +577,7 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
|
|
|
805
577
|
|
|
806
578
|
/***/ }),
|
|
807
579
|
|
|
808
|
-
/***/
|
|
580
|
+
/***/ 334:
|
|
809
581
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
810
582
|
|
|
811
583
|
module.exports = realpath
|
|
@@ -815,13 +587,13 @@ realpath.realpathSync = realpathSync
|
|
|
815
587
|
realpath.monkeypatch = monkeypatch
|
|
816
588
|
realpath.unmonkeypatch = unmonkeypatch
|
|
817
589
|
|
|
818
|
-
var fs = __webpack_require__(
|
|
590
|
+
var fs = __webpack_require__(231)
|
|
819
591
|
var origRealpath = fs.realpath
|
|
820
592
|
var origRealpathSync = fs.realpathSync
|
|
821
593
|
|
|
822
594
|
var version = process.version
|
|
823
595
|
var ok = /^v[0-5]\./.test(version)
|
|
824
|
-
var old = __webpack_require__(
|
|
596
|
+
var old = __webpack_require__(59)
|
|
825
597
|
|
|
826
598
|
function newError (er) {
|
|
827
599
|
return er && er.syscall === 'realpath' && (
|
|
@@ -878,7 +650,7 @@ function unmonkeypatch () {
|
|
|
878
650
|
|
|
879
651
|
/***/ }),
|
|
880
652
|
|
|
881
|
-
/***/
|
|
653
|
+
/***/ 59:
|
|
882
654
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
883
655
|
|
|
884
656
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
@@ -902,9 +674,9 @@ function unmonkeypatch () {
|
|
|
902
674
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
903
675
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
904
676
|
|
|
905
|
-
var pathModule = __webpack_require__(
|
|
677
|
+
var pathModule = __webpack_require__(423);
|
|
906
678
|
var isWindows = process.platform === 'win32';
|
|
907
|
-
var fs = __webpack_require__(
|
|
679
|
+
var fs = __webpack_require__(231);
|
|
908
680
|
|
|
909
681
|
// JavaScript implementation of realpath, ported from node pre-v6
|
|
910
682
|
|
|
@@ -1188,7 +960,7 @@ exports.realpath = function realpath(p, cache, cb) {
|
|
|
1188
960
|
|
|
1189
961
|
/***/ }),
|
|
1190
962
|
|
|
1191
|
-
/***/
|
|
963
|
+
/***/ 772:
|
|
1192
964
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1193
965
|
|
|
1194
966
|
exports.setopts = setopts
|
|
@@ -1203,10 +975,10 @@ function ownProp (obj, field) {
|
|
|
1203
975
|
return Object.prototype.hasOwnProperty.call(obj, field)
|
|
1204
976
|
}
|
|
1205
977
|
|
|
1206
|
-
var fs = __webpack_require__(
|
|
1207
|
-
var path = __webpack_require__(
|
|
1208
|
-
var minimatch = __webpack_require__(
|
|
1209
|
-
var isAbsolute = __webpack_require__(
|
|
978
|
+
var fs = __webpack_require__(231)
|
|
979
|
+
var path = __webpack_require__(423)
|
|
980
|
+
var minimatch = __webpack_require__(522)
|
|
981
|
+
var isAbsolute = (__webpack_require__(423).isAbsolute)
|
|
1210
982
|
var Minimatch = minimatch.Minimatch
|
|
1211
983
|
|
|
1212
984
|
function alphasort (a, b) {
|
|
@@ -1281,7 +1053,7 @@ function setopts (self, pattern, options) {
|
|
|
1281
1053
|
self.changedCwd = false
|
|
1282
1054
|
var cwd = process.cwd()
|
|
1283
1055
|
if (!ownProp(options, "cwd"))
|
|
1284
|
-
self.cwd = cwd
|
|
1056
|
+
self.cwd = path.resolve(cwd)
|
|
1285
1057
|
else {
|
|
1286
1058
|
self.cwd = path.resolve(options.cwd)
|
|
1287
1059
|
self.changedCwd = self.cwd !== cwd
|
|
@@ -1289,22 +1061,24 @@ function setopts (self, pattern, options) {
|
|
|
1289
1061
|
|
|
1290
1062
|
self.root = options.root || path.resolve(self.cwd, "/")
|
|
1291
1063
|
self.root = path.resolve(self.root)
|
|
1292
|
-
if (process.platform === "win32")
|
|
1293
|
-
self.root = self.root.replace(/\\/g, "/")
|
|
1294
1064
|
|
|
1295
1065
|
// TODO: is an absolute `cwd` supposed to be resolved against `root`?
|
|
1296
1066
|
// e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test')
|
|
1297
1067
|
self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd)
|
|
1298
|
-
if (process.platform === "win32")
|
|
1299
|
-
self.cwdAbs = self.cwdAbs.replace(/\\/g, "/")
|
|
1300
1068
|
self.nomount = !!options.nomount
|
|
1301
1069
|
|
|
1070
|
+
if (process.platform === "win32") {
|
|
1071
|
+
self.root = self.root.replace(/\\/g, "/")
|
|
1072
|
+
self.cwd = self.cwd.replace(/\\/g, "/")
|
|
1073
|
+
self.cwdAbs = self.cwdAbs.replace(/\\/g, "/")
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1302
1076
|
// disable comments and negation in Minimatch.
|
|
1303
1077
|
// Note that they are not supported in Glob itself anyway.
|
|
1304
1078
|
options.nonegate = true
|
|
1305
1079
|
options.nocomment = true
|
|
1306
1080
|
// always treat \ in patterns as escapes, not path separators
|
|
1307
|
-
options.allowWindowsEscape =
|
|
1081
|
+
options.allowWindowsEscape = true
|
|
1308
1082
|
|
|
1309
1083
|
self.minimatch = new Minimatch(pattern, options)
|
|
1310
1084
|
self.options = self.minimatch.options
|
|
@@ -1433,7 +1207,7 @@ function childrenIgnored (self, path) {
|
|
|
1433
1207
|
|
|
1434
1208
|
/***/ }),
|
|
1435
1209
|
|
|
1436
|
-
/***/
|
|
1210
|
+
/***/ 668:
|
|
1437
1211
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1438
1212
|
|
|
1439
1213
|
// Approach:
|
|
@@ -1478,20 +1252,20 @@ function childrenIgnored (self, path) {
|
|
|
1478
1252
|
|
|
1479
1253
|
module.exports = glob
|
|
1480
1254
|
|
|
1481
|
-
var rp = __webpack_require__(
|
|
1482
|
-
var minimatch = __webpack_require__(
|
|
1255
|
+
var rp = __webpack_require__(334)
|
|
1256
|
+
var minimatch = __webpack_require__(522)
|
|
1483
1257
|
var Minimatch = minimatch.Minimatch
|
|
1484
|
-
var inherits = __webpack_require__(
|
|
1485
|
-
var EE = (__webpack_require__(
|
|
1486
|
-
var path = __webpack_require__(
|
|
1487
|
-
var assert = __webpack_require__(
|
|
1488
|
-
var isAbsolute = __webpack_require__(
|
|
1489
|
-
var globSync = __webpack_require__(
|
|
1490
|
-
var common = __webpack_require__(
|
|
1258
|
+
var inherits = __webpack_require__(717)
|
|
1259
|
+
var EE = (__webpack_require__(187).EventEmitter)
|
|
1260
|
+
var path = __webpack_require__(423)
|
|
1261
|
+
var assert = __webpack_require__(84)
|
|
1262
|
+
var isAbsolute = (__webpack_require__(423).isAbsolute)
|
|
1263
|
+
var globSync = __webpack_require__(751)
|
|
1264
|
+
var common = __webpack_require__(772)
|
|
1491
1265
|
var setopts = common.setopts
|
|
1492
1266
|
var ownProp = common.ownProp
|
|
1493
|
-
var inflight = __webpack_require__(
|
|
1494
|
-
var util = __webpack_require__(
|
|
1267
|
+
var inflight = __webpack_require__(844)
|
|
1268
|
+
var util = __webpack_require__(464)
|
|
1495
1269
|
var childrenIgnored = common.childrenIgnored
|
|
1496
1270
|
var isIgnored = common.isIgnored
|
|
1497
1271
|
|
|
@@ -2230,1543 +2004,1723 @@ Glob.prototype._stat2 = function (f, abs, er, stat, cb) {
|
|
|
2230
2004
|
|
|
2231
2005
|
/***/ }),
|
|
2232
2006
|
|
|
2233
|
-
/***/
|
|
2007
|
+
/***/ 146:
|
|
2234
2008
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2235
2009
|
|
|
2236
|
-
|
|
2237
|
-
globSync.GlobSync = GlobSync
|
|
2010
|
+
var balanced = __webpack_require__(623);
|
|
2238
2011
|
|
|
2239
|
-
|
|
2240
|
-
var minimatch = __webpack_require__(1171)
|
|
2241
|
-
var Minimatch = minimatch.Minimatch
|
|
2242
|
-
var Glob = (__webpack_require__(2884).Glob)
|
|
2243
|
-
var util = __webpack_require__(6464)
|
|
2244
|
-
var path = __webpack_require__(1423)
|
|
2245
|
-
var assert = __webpack_require__(9084)
|
|
2246
|
-
var isAbsolute = __webpack_require__(4095)
|
|
2247
|
-
var common = __webpack_require__(6772)
|
|
2248
|
-
var setopts = common.setopts
|
|
2249
|
-
var ownProp = common.ownProp
|
|
2250
|
-
var childrenIgnored = common.childrenIgnored
|
|
2251
|
-
var isIgnored = common.isIgnored
|
|
2012
|
+
module.exports = expandTop;
|
|
2252
2013
|
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2014
|
+
var escSlash = '\0SLASH'+Math.random()+'\0';
|
|
2015
|
+
var escOpen = '\0OPEN'+Math.random()+'\0';
|
|
2016
|
+
var escClose = '\0CLOSE'+Math.random()+'\0';
|
|
2017
|
+
var escComma = '\0COMMA'+Math.random()+'\0';
|
|
2018
|
+
var escPeriod = '\0PERIOD'+Math.random()+'\0';
|
|
2257
2019
|
|
|
2258
|
-
|
|
2020
|
+
function numeric(str) {
|
|
2021
|
+
return parseInt(str, 10) == str
|
|
2022
|
+
? parseInt(str, 10)
|
|
2023
|
+
: str.charCodeAt(0);
|
|
2259
2024
|
}
|
|
2260
2025
|
|
|
2261
|
-
function
|
|
2262
|
-
|
|
2263
|
-
|
|
2026
|
+
function escapeBraces(str) {
|
|
2027
|
+
return str.split('\\\\').join(escSlash)
|
|
2028
|
+
.split('\\{').join(escOpen)
|
|
2029
|
+
.split('\\}').join(escClose)
|
|
2030
|
+
.split('\\,').join(escComma)
|
|
2031
|
+
.split('\\.').join(escPeriod);
|
|
2032
|
+
}
|
|
2264
2033
|
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2034
|
+
function unescapeBraces(str) {
|
|
2035
|
+
return str.split(escSlash).join('\\')
|
|
2036
|
+
.split(escOpen).join('{')
|
|
2037
|
+
.split(escClose).join('}')
|
|
2038
|
+
.split(escComma).join(',')
|
|
2039
|
+
.split(escPeriod).join('.');
|
|
2040
|
+
}
|
|
2268
2041
|
|
|
2269
|
-
if (!(this instanceof GlobSync))
|
|
2270
|
-
return new GlobSync(pattern, options)
|
|
2271
2042
|
|
|
2272
|
-
|
|
2043
|
+
// Basically just str.split(","), but handling cases
|
|
2044
|
+
// where we have nested braced sections, which should be
|
|
2045
|
+
// treated as individual members, like {a,{b,c},d}
|
|
2046
|
+
function parseCommaParts(str) {
|
|
2047
|
+
if (!str)
|
|
2048
|
+
return [''];
|
|
2273
2049
|
|
|
2274
|
-
|
|
2275
|
-
|
|
2050
|
+
var parts = [];
|
|
2051
|
+
var m = balanced('{', '}', str);
|
|
2276
2052
|
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
for (var i = 0; i < n; i ++) {
|
|
2280
|
-
this._process(this.minimatch.set[i], i, false)
|
|
2281
|
-
}
|
|
2282
|
-
this._finish()
|
|
2283
|
-
}
|
|
2053
|
+
if (!m)
|
|
2054
|
+
return str.split(',');
|
|
2284
2055
|
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
set[real] = true
|
|
2296
|
-
} catch (er) {
|
|
2297
|
-
if (er.syscall === 'stat')
|
|
2298
|
-
set[self._makeAbs(p)] = true
|
|
2299
|
-
else
|
|
2300
|
-
throw er
|
|
2301
|
-
}
|
|
2302
|
-
}
|
|
2303
|
-
})
|
|
2056
|
+
var pre = m.pre;
|
|
2057
|
+
var body = m.body;
|
|
2058
|
+
var post = m.post;
|
|
2059
|
+
var p = pre.split(',');
|
|
2060
|
+
|
|
2061
|
+
p[p.length-1] += '{' + body + '}';
|
|
2062
|
+
var postParts = parseCommaParts(post);
|
|
2063
|
+
if (post.length) {
|
|
2064
|
+
p[p.length-1] += postParts.shift();
|
|
2065
|
+
p.push.apply(p, postParts);
|
|
2304
2066
|
}
|
|
2305
|
-
common.finish(this)
|
|
2306
|
-
}
|
|
2307
2067
|
|
|
2068
|
+
parts.push.apply(parts, p);
|
|
2308
2069
|
|
|
2309
|
-
|
|
2310
|
-
|
|
2070
|
+
return parts;
|
|
2071
|
+
}
|
|
2311
2072
|
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2073
|
+
function expandTop(str) {
|
|
2074
|
+
if (!str)
|
|
2075
|
+
return [];
|
|
2076
|
+
|
|
2077
|
+
// I don't know why Bash 4.3 does this, but it does.
|
|
2078
|
+
// Anything starting with {} will have the first two bytes preserved
|
|
2079
|
+
// but *only* at the top level, so {},a}b will not expand to anything,
|
|
2080
|
+
// but a{},b}c will be expanded to [a}c,abc].
|
|
2081
|
+
// One could argue that this is a bug in Bash, but since the goal of
|
|
2082
|
+
// this module is to match Bash's rules, we escape a leading {}
|
|
2083
|
+
if (str.substr(0, 2) === '{}') {
|
|
2084
|
+
str = '\\{\\}' + str.substr(2);
|
|
2316
2085
|
}
|
|
2317
|
-
// now n is the index of the first one that is *not* a string.
|
|
2318
2086
|
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
switch (n) {
|
|
2322
|
-
// if not, then this is rather simple
|
|
2323
|
-
case pattern.length:
|
|
2324
|
-
this._processSimple(pattern.join('/'), index)
|
|
2325
|
-
return
|
|
2087
|
+
return expand(escapeBraces(str), true).map(unescapeBraces);
|
|
2088
|
+
}
|
|
2326
2089
|
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2090
|
+
function embrace(str) {
|
|
2091
|
+
return '{' + str + '}';
|
|
2092
|
+
}
|
|
2093
|
+
function isPadded(el) {
|
|
2094
|
+
return /^-?0\d/.test(el);
|
|
2095
|
+
}
|
|
2332
2096
|
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
}
|
|
2097
|
+
function lte(i, y) {
|
|
2098
|
+
return i <= y;
|
|
2099
|
+
}
|
|
2100
|
+
function gte(i, y) {
|
|
2101
|
+
return i >= y;
|
|
2102
|
+
}
|
|
2340
2103
|
|
|
2341
|
-
|
|
2104
|
+
function expand(str, isTop) {
|
|
2105
|
+
var expansions = [];
|
|
2342
2106
|
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
if (prefix === null)
|
|
2346
|
-
read = '.'
|
|
2347
|
-
else if (isAbsolute(prefix) ||
|
|
2348
|
-
isAbsolute(pattern.map(function (p) {
|
|
2349
|
-
return typeof p === 'string' ? p : '[*]'
|
|
2350
|
-
}).join('/'))) {
|
|
2351
|
-
if (!prefix || !isAbsolute(prefix))
|
|
2352
|
-
prefix = '/' + prefix
|
|
2353
|
-
read = prefix
|
|
2354
|
-
} else
|
|
2355
|
-
read = prefix
|
|
2107
|
+
var m = balanced('{', '}', str);
|
|
2108
|
+
if (!m) return [str];
|
|
2356
2109
|
|
|
2357
|
-
|
|
2110
|
+
// no need to expand pre, since it is guaranteed to be free of brace-sets
|
|
2111
|
+
var pre = m.pre;
|
|
2112
|
+
var post = m.post.length
|
|
2113
|
+
? expand(m.post, false)
|
|
2114
|
+
: [''];
|
|
2358
2115
|
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2116
|
+
if (/\$$/.test(m.pre)) {
|
|
2117
|
+
for (var k = 0; k < post.length; k++) {
|
|
2118
|
+
var expansion = pre+ '{' + m.body + '}' + post[k];
|
|
2119
|
+
expansions.push(expansion);
|
|
2120
|
+
}
|
|
2121
|
+
} else {
|
|
2122
|
+
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
2123
|
+
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
2124
|
+
var isSequence = isNumericSequence || isAlphaSequence;
|
|
2125
|
+
var isOptions = m.body.indexOf(',') >= 0;
|
|
2126
|
+
if (!isSequence && !isOptions) {
|
|
2127
|
+
// {a},b}
|
|
2128
|
+
if (m.post.match(/,.*\}/)) {
|
|
2129
|
+
str = m.pre + '{' + m.body + escClose + m.post;
|
|
2130
|
+
return expand(str);
|
|
2131
|
+
}
|
|
2132
|
+
return [str];
|
|
2133
|
+
}
|
|
2362
2134
|
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2135
|
+
var n;
|
|
2136
|
+
if (isSequence) {
|
|
2137
|
+
n = m.body.split(/\.\./);
|
|
2138
|
+
} else {
|
|
2139
|
+
n = parseCommaParts(m.body);
|
|
2140
|
+
if (n.length === 1) {
|
|
2141
|
+
// x{{a,b}}y ==> x{a}y x{b}y
|
|
2142
|
+
n = expand(n[0], false).map(embrace);
|
|
2143
|
+
if (n.length === 1) {
|
|
2144
|
+
return post.map(function(p) {
|
|
2145
|
+
return m.pre + n[0] + p;
|
|
2146
|
+
});
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2149
|
+
}
|
|
2369
2150
|
|
|
2151
|
+
// at this point, n is the parts, and we know it's not a comma set
|
|
2152
|
+
// with a single entry.
|
|
2153
|
+
var N;
|
|
2154
|
+
|
|
2155
|
+
if (isSequence) {
|
|
2156
|
+
var x = numeric(n[0]);
|
|
2157
|
+
var y = numeric(n[1]);
|
|
2158
|
+
var width = Math.max(n[0].length, n[1].length)
|
|
2159
|
+
var incr = n.length == 3
|
|
2160
|
+
? Math.abs(numeric(n[2]))
|
|
2161
|
+
: 1;
|
|
2162
|
+
var test = lte;
|
|
2163
|
+
var reverse = y < x;
|
|
2164
|
+
if (reverse) {
|
|
2165
|
+
incr *= -1;
|
|
2166
|
+
test = gte;
|
|
2167
|
+
}
|
|
2168
|
+
var pad = n.some(isPadded);
|
|
2370
2169
|
|
|
2371
|
-
|
|
2372
|
-
var entries = this._readdir(abs, inGlobStar)
|
|
2170
|
+
N = [];
|
|
2373
2171
|
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2172
|
+
for (var i = x; test(i, y); i += incr) {
|
|
2173
|
+
var c;
|
|
2174
|
+
if (isAlphaSequence) {
|
|
2175
|
+
c = String.fromCharCode(i);
|
|
2176
|
+
if (c === '\\')
|
|
2177
|
+
c = '';
|
|
2178
|
+
} else {
|
|
2179
|
+
c = String(i);
|
|
2180
|
+
if (pad) {
|
|
2181
|
+
var need = width - c.length;
|
|
2182
|
+
if (need > 0) {
|
|
2183
|
+
var z = new Array(need + 1).join('0');
|
|
2184
|
+
if (i < 0)
|
|
2185
|
+
c = '-' + z + c.slice(1);
|
|
2186
|
+
else
|
|
2187
|
+
c = z + c;
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2190
|
+
}
|
|
2191
|
+
N.push(c);
|
|
2192
|
+
}
|
|
2193
|
+
} else {
|
|
2194
|
+
N = [];
|
|
2377
2195
|
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
var rawGlob = pn._glob
|
|
2383
|
-
var dotOk = this.dot || rawGlob.charAt(0) === '.'
|
|
2196
|
+
for (var j = 0; j < n.length; j++) {
|
|
2197
|
+
N.push.apply(N, expand(n[j], false));
|
|
2198
|
+
}
|
|
2199
|
+
}
|
|
2384
2200
|
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
if (negate && !prefix) {
|
|
2391
|
-
m = !e.match(pn)
|
|
2392
|
-
} else {
|
|
2393
|
-
m = e.match(pn)
|
|
2201
|
+
for (var j = 0; j < N.length; j++) {
|
|
2202
|
+
for (var k = 0; k < post.length; k++) {
|
|
2203
|
+
var expansion = pre + N[j] + post[k];
|
|
2204
|
+
if (!isTop || isSequence || expansion)
|
|
2205
|
+
expansions.push(expansion);
|
|
2394
2206
|
}
|
|
2395
|
-
if (m)
|
|
2396
|
-
matchedEntries.push(e)
|
|
2397
2207
|
}
|
|
2398
2208
|
}
|
|
2399
2209
|
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
if (len === 0)
|
|
2403
|
-
return
|
|
2210
|
+
return expansions;
|
|
2211
|
+
}
|
|
2404
2212
|
|
|
2405
|
-
// if this is the last remaining pattern bit, then no need for
|
|
2406
|
-
// an additional stat *unless* the user has specified mark or
|
|
2407
|
-
// stat explicitly. We know they exist, since readdir returned
|
|
2408
|
-
// them.
|
|
2409
2213
|
|
|
2410
|
-
if (remain.length === 1 && !this.mark && !this.stat) {
|
|
2411
|
-
if (!this.matches[index])
|
|
2412
|
-
this.matches[index] = Object.create(null)
|
|
2413
2214
|
|
|
2414
|
-
|
|
2415
|
-
var e = matchedEntries[i]
|
|
2416
|
-
if (prefix) {
|
|
2417
|
-
if (prefix.slice(-1) !== '/')
|
|
2418
|
-
e = prefix + '/' + e
|
|
2419
|
-
else
|
|
2420
|
-
e = prefix + e
|
|
2421
|
-
}
|
|
2215
|
+
/***/ }),
|
|
2422
2216
|
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2217
|
+
/***/ 340:
|
|
2218
|
+
/***/ ((module) => {
|
|
2219
|
+
|
|
2220
|
+
const isWindows = typeof process === 'object' &&
|
|
2221
|
+
process &&
|
|
2222
|
+
process.platform === 'win32'
|
|
2223
|
+
module.exports = isWindows ? { sep: '\\' } : { sep: '/' }
|
|
2224
|
+
|
|
2225
|
+
|
|
2226
|
+
/***/ }),
|
|
2227
|
+
|
|
2228
|
+
/***/ 522:
|
|
2229
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2230
|
+
|
|
2231
|
+
const minimatch = module.exports = (p, pattern, options = {}) => {
|
|
2232
|
+
assertValidPattern(pattern)
|
|
2233
|
+
|
|
2234
|
+
// shortcut: comments match nothing.
|
|
2235
|
+
if (!options.nocomment && pattern.charAt(0) === '#') {
|
|
2236
|
+
return false
|
|
2430
2237
|
}
|
|
2431
2238
|
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2239
|
+
return new Minimatch(pattern, options).match(p)
|
|
2240
|
+
}
|
|
2241
|
+
|
|
2242
|
+
module.exports = minimatch
|
|
2243
|
+
|
|
2244
|
+
const path = __webpack_require__(340)
|
|
2245
|
+
minimatch.sep = path.sep
|
|
2246
|
+
|
|
2247
|
+
const GLOBSTAR = Symbol('globstar **')
|
|
2248
|
+
minimatch.GLOBSTAR = GLOBSTAR
|
|
2249
|
+
const expand = __webpack_require__(146)
|
|
2250
|
+
|
|
2251
|
+
const plTypes = {
|
|
2252
|
+
'!': { open: '(?:(?!(?:', close: '))[^/]*?)'},
|
|
2253
|
+
'?': { open: '(?:', close: ')?' },
|
|
2254
|
+
'+': { open: '(?:', close: ')+' },
|
|
2255
|
+
'*': { open: '(?:', close: ')*' },
|
|
2256
|
+
'@': { open: '(?:', close: ')' }
|
|
2257
|
+
}
|
|
2258
|
+
|
|
2259
|
+
// any single thing other than /
|
|
2260
|
+
// don't need to escape / when using new RegExp()
|
|
2261
|
+
const qmark = '[^/]'
|
|
2262
|
+
|
|
2263
|
+
// * => any number of characters
|
|
2264
|
+
const star = qmark + '*?'
|
|
2265
|
+
|
|
2266
|
+
// ** when dots are allowed. Anything goes, except .. and .
|
|
2267
|
+
// not (^ or / followed by one or two dots followed by $ or /),
|
|
2268
|
+
// followed by anything, any number of times.
|
|
2269
|
+
const twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?'
|
|
2270
|
+
|
|
2271
|
+
// not a ^ or / followed by a dot,
|
|
2272
|
+
// followed by anything, any number of times.
|
|
2273
|
+
const twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?'
|
|
2274
|
+
|
|
2275
|
+
// "abc" -> { a:true, b:true, c:true }
|
|
2276
|
+
const charSet = s => s.split('').reduce((set, c) => {
|
|
2277
|
+
set[c] = true
|
|
2278
|
+
return set
|
|
2279
|
+
}, {})
|
|
2280
|
+
|
|
2281
|
+
// characters that need to be escaped in RegExp.
|
|
2282
|
+
const reSpecials = charSet('().*{}+?[]^$\\!')
|
|
2283
|
+
|
|
2284
|
+
// characters that indicate we have to add the pattern start
|
|
2285
|
+
const addPatternStartSet = charSet('[.(')
|
|
2286
|
+
|
|
2287
|
+
// normalizes slashes.
|
|
2288
|
+
const slashSplit = /\/+/
|
|
2289
|
+
|
|
2290
|
+
minimatch.filter = (pattern, options = {}) =>
|
|
2291
|
+
(p, i, list) => minimatch(p, pattern, options)
|
|
2292
|
+
|
|
2293
|
+
const ext = (a, b = {}) => {
|
|
2294
|
+
const t = {}
|
|
2295
|
+
Object.keys(a).forEach(k => t[k] = a[k])
|
|
2296
|
+
Object.keys(b).forEach(k => t[k] = b[k])
|
|
2297
|
+
return t
|
|
2298
|
+
}
|
|
2299
|
+
|
|
2300
|
+
minimatch.defaults = def => {
|
|
2301
|
+
if (!def || typeof def !== 'object' || !Object.keys(def).length) {
|
|
2302
|
+
return minimatch
|
|
2443
2303
|
}
|
|
2304
|
+
|
|
2305
|
+
const orig = minimatch
|
|
2306
|
+
|
|
2307
|
+
const m = (p, pattern, options) => orig(p, pattern, ext(def, options))
|
|
2308
|
+
m.Minimatch = class Minimatch extends orig.Minimatch {
|
|
2309
|
+
constructor (pattern, options) {
|
|
2310
|
+
super(pattern, ext(def, options))
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
m.Minimatch.defaults = options => orig.defaults(ext(def, options)).Minimatch
|
|
2314
|
+
m.filter = (pattern, options) => orig.filter(pattern, ext(def, options))
|
|
2315
|
+
m.defaults = options => orig.defaults(ext(def, options))
|
|
2316
|
+
m.makeRe = (pattern, options) => orig.makeRe(pattern, ext(def, options))
|
|
2317
|
+
m.braceExpand = (pattern, options) => orig.braceExpand(pattern, ext(def, options))
|
|
2318
|
+
m.match = (list, pattern, options) => orig.match(list, pattern, ext(def, options))
|
|
2319
|
+
|
|
2320
|
+
return m
|
|
2444
2321
|
}
|
|
2445
2322
|
|
|
2446
2323
|
|
|
2447
|
-
GlobSync.prototype._emitMatch = function (index, e) {
|
|
2448
|
-
if (isIgnored(this, e))
|
|
2449
|
-
return
|
|
2450
2324
|
|
|
2451
|
-
var abs = this._makeAbs(e)
|
|
2452
2325
|
|
|
2453
|
-
if (this.mark)
|
|
2454
|
-
e = this._mark(e)
|
|
2455
2326
|
|
|
2456
|
-
|
|
2457
|
-
|
|
2327
|
+
// Brace expansion:
|
|
2328
|
+
// a{b,c}d -> abd acd
|
|
2329
|
+
// a{b,}c -> abc ac
|
|
2330
|
+
// a{0..3}d -> a0d a1d a2d a3d
|
|
2331
|
+
// a{b,c{d,e}f}g -> abg acdfg acefg
|
|
2332
|
+
// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
|
|
2333
|
+
//
|
|
2334
|
+
// Invalid sets are not expanded.
|
|
2335
|
+
// a{2..}b -> a{2..}b
|
|
2336
|
+
// a{b}c -> a{b}c
|
|
2337
|
+
minimatch.braceExpand = (pattern, options) => braceExpand(pattern, options)
|
|
2338
|
+
|
|
2339
|
+
const braceExpand = (pattern, options = {}) => {
|
|
2340
|
+
assertValidPattern(pattern)
|
|
2341
|
+
|
|
2342
|
+
// Thanks to Yeting Li <https://github.com/yetingli> for
|
|
2343
|
+
// improving this regexp to avoid a ReDOS vulnerability.
|
|
2344
|
+
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
|
|
2345
|
+
// shortcut. no need to expand.
|
|
2346
|
+
return [pattern]
|
|
2458
2347
|
}
|
|
2459
2348
|
|
|
2460
|
-
|
|
2461
|
-
|
|
2349
|
+
return expand(pattern)
|
|
2350
|
+
}
|
|
2462
2351
|
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2352
|
+
const MAX_PATTERN_LENGTH = 1024 * 64
|
|
2353
|
+
const assertValidPattern = pattern => {
|
|
2354
|
+
if (typeof pattern !== 'string') {
|
|
2355
|
+
throw new TypeError('invalid pattern')
|
|
2467
2356
|
}
|
|
2468
2357
|
|
|
2469
|
-
|
|
2358
|
+
if (pattern.length > MAX_PATTERN_LENGTH) {
|
|
2359
|
+
throw new TypeError('pattern is too long')
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
|
|
2363
|
+
// parse a component of the expanded set.
|
|
2364
|
+
// At this point, no pattern may contain "/" in it
|
|
2365
|
+
// so we're going to return a 2d array, where each entry is the full
|
|
2366
|
+
// pattern, split on '/', and then turned into a regular expression.
|
|
2367
|
+
// A regexp is made at the end which joins each array with an
|
|
2368
|
+
// escaped /, and another full one which joins each regexp with |.
|
|
2369
|
+
//
|
|
2370
|
+
// Following the lead of Bash 4.1, note that "**" only has special meaning
|
|
2371
|
+
// when it is the *only* thing in a path portion. Otherwise, any series
|
|
2372
|
+
// of * is equivalent to a single *. Globstar behavior is enabled by
|
|
2373
|
+
// default, and can be disabled by setting options.noglobstar.
|
|
2374
|
+
const SUBPARSE = Symbol('subparse')
|
|
2375
|
+
|
|
2376
|
+
minimatch.makeRe = (pattern, options) =>
|
|
2377
|
+
new Minimatch(pattern, options || {}).makeRe()
|
|
2378
|
+
|
|
2379
|
+
minimatch.match = (list, pattern, options = {}) => {
|
|
2380
|
+
const mm = new Minimatch(pattern, options)
|
|
2381
|
+
list = list.filter(f => mm.match(f))
|
|
2382
|
+
if (mm.options.nonull && !list.length) {
|
|
2383
|
+
list.push(pattern)
|
|
2384
|
+
}
|
|
2385
|
+
return list
|
|
2386
|
+
}
|
|
2387
|
+
|
|
2388
|
+
// replace stuff like \* with *
|
|
2389
|
+
const globUnescape = s => s.replace(/\\(.)/g, '$1')
|
|
2390
|
+
const regExpEscape = s => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
|
|
2391
|
+
|
|
2392
|
+
class Minimatch {
|
|
2393
|
+
constructor (pattern, options) {
|
|
2394
|
+
assertValidPattern(pattern)
|
|
2395
|
+
|
|
2396
|
+
if (!options) options = {}
|
|
2397
|
+
|
|
2398
|
+
this.options = options
|
|
2399
|
+
this.set = []
|
|
2400
|
+
this.pattern = pattern
|
|
2401
|
+
this.windowsPathsNoEscape = !!options.windowsPathsNoEscape ||
|
|
2402
|
+
options.allowWindowsEscape === false
|
|
2403
|
+
if (this.windowsPathsNoEscape) {
|
|
2404
|
+
this.pattern = this.pattern.replace(/\\/g, '/')
|
|
2405
|
+
}
|
|
2406
|
+
this.regexp = null
|
|
2407
|
+
this.negate = false
|
|
2408
|
+
this.comment = false
|
|
2409
|
+
this.empty = false
|
|
2410
|
+
this.partial = !!options.partial
|
|
2470
2411
|
|
|
2471
|
-
|
|
2472
|
-
this.
|
|
2473
|
-
}
|
|
2412
|
+
// make the set of regexps etc.
|
|
2413
|
+
this.make()
|
|
2414
|
+
}
|
|
2474
2415
|
|
|
2416
|
+
debug () {}
|
|
2475
2417
|
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
if (this.follow)
|
|
2480
|
-
return this._readdir(abs, false)
|
|
2418
|
+
make () {
|
|
2419
|
+
const pattern = this.pattern
|
|
2420
|
+
const options = this.options
|
|
2481
2421
|
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
return null
|
|
2422
|
+
// empty patterns and comments match nothing.
|
|
2423
|
+
if (!options.nocomment && pattern.charAt(0) === '#') {
|
|
2424
|
+
this.comment = true
|
|
2425
|
+
return
|
|
2426
|
+
}
|
|
2427
|
+
if (!pattern) {
|
|
2428
|
+
this.empty = true
|
|
2429
|
+
return
|
|
2491
2430
|
}
|
|
2492
|
-
}
|
|
2493
2431
|
|
|
2494
|
-
|
|
2495
|
-
|
|
2432
|
+
// step 1: figure out negation, etc.
|
|
2433
|
+
this.parseNegate()
|
|
2496
2434
|
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
if (!isSym && lstat && !lstat.isDirectory())
|
|
2500
|
-
this.cache[abs] = 'FILE'
|
|
2501
|
-
else
|
|
2502
|
-
entries = this._readdir(abs, false)
|
|
2435
|
+
// step 2: expand braces
|
|
2436
|
+
let set = this.globSet = this.braceExpand()
|
|
2503
2437
|
|
|
2504
|
-
|
|
2505
|
-
}
|
|
2438
|
+
if (options.debug) this.debug = (...args) => console.error(...args)
|
|
2506
2439
|
|
|
2507
|
-
|
|
2508
|
-
var entries
|
|
2440
|
+
this.debug(this.pattern, set)
|
|
2509
2441
|
|
|
2510
|
-
|
|
2511
|
-
|
|
2442
|
+
// step 3: now we have a set, so turn each one into a series of path-portion
|
|
2443
|
+
// matching patterns.
|
|
2444
|
+
// These will be regexps, except in the case of "**", which is
|
|
2445
|
+
// set to the GLOBSTAR object for globstar behavior,
|
|
2446
|
+
// and will not contain any / characters
|
|
2447
|
+
set = this.globParts = set.map(s => s.split(slashSplit))
|
|
2512
2448
|
|
|
2513
|
-
|
|
2514
|
-
var c = this.cache[abs]
|
|
2515
|
-
if (!c || c === 'FILE')
|
|
2516
|
-
return null
|
|
2449
|
+
this.debug(this.pattern, set)
|
|
2517
2450
|
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
}
|
|
2451
|
+
// glob --> regexps
|
|
2452
|
+
set = set.map((s, si, set) => s.map(this.parse, this))
|
|
2521
2453
|
|
|
2522
|
-
|
|
2523
|
-
return this._readdirEntries(abs, this.fs.readdirSync(abs))
|
|
2524
|
-
} catch (er) {
|
|
2525
|
-
this._readdirError(abs, er)
|
|
2526
|
-
return null
|
|
2527
|
-
}
|
|
2528
|
-
}
|
|
2454
|
+
this.debug(this.pattern, set)
|
|
2529
2455
|
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
// assume that everything in there exists, so we can avoid
|
|
2533
|
-
// having to stat it a second time.
|
|
2534
|
-
if (!this.mark && !this.stat) {
|
|
2535
|
-
for (var i = 0; i < entries.length; i ++) {
|
|
2536
|
-
var e = entries[i]
|
|
2537
|
-
if (abs === '/')
|
|
2538
|
-
e = abs + e
|
|
2539
|
-
else
|
|
2540
|
-
e = abs + '/' + e
|
|
2541
|
-
this.cache[e] = true
|
|
2542
|
-
}
|
|
2543
|
-
}
|
|
2456
|
+
// filter out everything that didn't compile properly.
|
|
2457
|
+
set = set.filter(s => s.indexOf(false) === -1)
|
|
2544
2458
|
|
|
2545
|
-
|
|
2459
|
+
this.debug(this.pattern, set)
|
|
2546
2460
|
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
}
|
|
2461
|
+
this.set = set
|
|
2462
|
+
}
|
|
2550
2463
|
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
switch (er.code) {
|
|
2554
|
-
case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
|
|
2555
|
-
case 'ENOTDIR': // totally normal. means it *does* exist.
|
|
2556
|
-
var abs = this._makeAbs(f)
|
|
2557
|
-
this.cache[abs] = 'FILE'
|
|
2558
|
-
if (abs === this.cwdAbs) {
|
|
2559
|
-
var error = new Error(er.code + ' invalid cwd ' + this.cwd)
|
|
2560
|
-
error.path = this.cwd
|
|
2561
|
-
error.code = er.code
|
|
2562
|
-
throw error
|
|
2563
|
-
}
|
|
2564
|
-
break
|
|
2464
|
+
parseNegate () {
|
|
2465
|
+
if (this.options.nonegate) return
|
|
2565
2466
|
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
case 'UNKNOWN':
|
|
2570
|
-
this.cache[this._makeAbs(f)] = false
|
|
2571
|
-
break
|
|
2467
|
+
const pattern = this.pattern
|
|
2468
|
+
let negate = false
|
|
2469
|
+
let negateOffset = 0
|
|
2572
2470
|
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2471
|
+
for (let i = 0; i < pattern.length && pattern.charAt(i) === '!'; i++) {
|
|
2472
|
+
negate = !negate
|
|
2473
|
+
negateOffset++
|
|
2474
|
+
}
|
|
2475
|
+
|
|
2476
|
+
if (negateOffset) this.pattern = pattern.substr(negateOffset)
|
|
2477
|
+
this.negate = negate
|
|
2580
2478
|
}
|
|
2581
|
-
}
|
|
2582
2479
|
|
|
2583
|
-
|
|
2480
|
+
// set partial to true to test if, for example,
|
|
2481
|
+
// "/a/b" matches the start of "/*/b/*/d"
|
|
2482
|
+
// Partial means, if you run out of file before you run
|
|
2483
|
+
// out of pattern, then that's fine, as long as all
|
|
2484
|
+
// the parts match.
|
|
2485
|
+
matchOne (file, pattern, partial) {
|
|
2486
|
+
var options = this.options
|
|
2584
2487
|
|
|
2585
|
-
|
|
2488
|
+
this.debug('matchOne',
|
|
2489
|
+
{ 'this': this, file: file, pattern: pattern })
|
|
2586
2490
|
|
|
2587
|
-
|
|
2588
|
-
// foo.txt/** doesn't match foo.txt
|
|
2589
|
-
if (!entries)
|
|
2590
|
-
return
|
|
2491
|
+
this.debug('matchOne', file.length, pattern.length)
|
|
2591
2492
|
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2493
|
+
for (var fi = 0,
|
|
2494
|
+
pi = 0,
|
|
2495
|
+
fl = file.length,
|
|
2496
|
+
pl = pattern.length
|
|
2497
|
+
; (fi < fl) && (pi < pl)
|
|
2498
|
+
; fi++, pi++) {
|
|
2499
|
+
this.debug('matchOne loop')
|
|
2500
|
+
var p = pattern[pi]
|
|
2501
|
+
var f = file[fi]
|
|
2597
2502
|
|
|
2598
|
-
|
|
2599
|
-
this._process(noGlobStar, index, false)
|
|
2503
|
+
this.debug(pattern, p, f)
|
|
2600
2504
|
|
|
2601
|
-
|
|
2602
|
-
|
|
2505
|
+
// should be impossible.
|
|
2506
|
+
// some invalid regexp stuff in the set.
|
|
2507
|
+
/* istanbul ignore if */
|
|
2508
|
+
if (p === false) return false
|
|
2509
|
+
|
|
2510
|
+
if (p === GLOBSTAR) {
|
|
2511
|
+
this.debug('GLOBSTAR', [pattern, p, f])
|
|
2512
|
+
|
|
2513
|
+
// "**"
|
|
2514
|
+
// a/**/b/**/c would match the following:
|
|
2515
|
+
// a/b/x/y/z/c
|
|
2516
|
+
// a/x/y/z/b/c
|
|
2517
|
+
// a/b/x/b/x/c
|
|
2518
|
+
// a/b/c
|
|
2519
|
+
// To do this, take the rest of the pattern after
|
|
2520
|
+
// the **, and see if it would match the file remainder.
|
|
2521
|
+
// If so, return success.
|
|
2522
|
+
// If not, the ** "swallows" a segment, and try again.
|
|
2523
|
+
// This is recursively awful.
|
|
2524
|
+
//
|
|
2525
|
+
// a/**/b/**/c matching a/b/x/y/z/c
|
|
2526
|
+
// - a matches a
|
|
2527
|
+
// - doublestar
|
|
2528
|
+
// - matchOne(b/x/y/z/c, b/**/c)
|
|
2529
|
+
// - b matches b
|
|
2530
|
+
// - doublestar
|
|
2531
|
+
// - matchOne(x/y/z/c, c) -> no
|
|
2532
|
+
// - matchOne(y/z/c, c) -> no
|
|
2533
|
+
// - matchOne(z/c, c) -> no
|
|
2534
|
+
// - matchOne(c, c) yes, hit
|
|
2535
|
+
var fr = fi
|
|
2536
|
+
var pr = pi + 1
|
|
2537
|
+
if (pr === pl) {
|
|
2538
|
+
this.debug('** at the end')
|
|
2539
|
+
// a ** at the end will just swallow the rest.
|
|
2540
|
+
// We have found a match.
|
|
2541
|
+
// however, it will not swallow /.x, unless
|
|
2542
|
+
// options.dot is set.
|
|
2543
|
+
// . and .. are *never* matched by **, for explosively
|
|
2544
|
+
// exponential reasons.
|
|
2545
|
+
for (; fi < fl; fi++) {
|
|
2546
|
+
if (file[fi] === '.' || file[fi] === '..' ||
|
|
2547
|
+
(!options.dot && file[fi].charAt(0) === '.')) return false
|
|
2548
|
+
}
|
|
2549
|
+
return true
|
|
2550
|
+
}
|
|
2603
2551
|
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2552
|
+
// ok, let's see if we can swallow whatever we can.
|
|
2553
|
+
while (fr < fl) {
|
|
2554
|
+
var swallowee = file[fr]
|
|
2555
|
+
|
|
2556
|
+
this.debug('\nglobstar while', file, fr, pattern, pr, swallowee)
|
|
2557
|
+
|
|
2558
|
+
// XXX remove this slice. Just pass the start index.
|
|
2559
|
+
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
|
2560
|
+
this.debug('globstar found match!', fr, fl, swallowee)
|
|
2561
|
+
// found a match.
|
|
2562
|
+
return true
|
|
2563
|
+
} else {
|
|
2564
|
+
// can't swallow "." or ".." ever.
|
|
2565
|
+
// can only swallow ".foo" when explicitly asked.
|
|
2566
|
+
if (swallowee === '.' || swallowee === '..' ||
|
|
2567
|
+
(!options.dot && swallowee.charAt(0) === '.')) {
|
|
2568
|
+
this.debug('dot detected!', file, fr, pattern, pr)
|
|
2569
|
+
break
|
|
2570
|
+
}
|
|
2607
2571
|
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2572
|
+
// ** swallows a segment, and continue.
|
|
2573
|
+
this.debug('globstar swallow a segment, and continue')
|
|
2574
|
+
fr++
|
|
2575
|
+
}
|
|
2576
|
+
}
|
|
2612
2577
|
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2578
|
+
// no match was found.
|
|
2579
|
+
// However, in partial mode, we can't say this is necessarily over.
|
|
2580
|
+
// If there's more *pattern* left, then
|
|
2581
|
+
/* istanbul ignore if */
|
|
2582
|
+
if (partial) {
|
|
2583
|
+
// ran out of file
|
|
2584
|
+
this.debug('\n>>> no match, partial?', file, fr, pattern, pr)
|
|
2585
|
+
if (fr === fl) return true
|
|
2586
|
+
}
|
|
2587
|
+
return false
|
|
2588
|
+
}
|
|
2616
2589
|
|
|
2617
|
-
|
|
2618
|
-
|
|
2590
|
+
// something other than **
|
|
2591
|
+
// non-magic patterns just have to match exactly
|
|
2592
|
+
// patterns with magic have been turned into regexps.
|
|
2593
|
+
var hit
|
|
2594
|
+
if (typeof p === 'string') {
|
|
2595
|
+
hit = f === p
|
|
2596
|
+
this.debug('string match', p, f, hit)
|
|
2597
|
+
} else {
|
|
2598
|
+
hit = f.match(p)
|
|
2599
|
+
this.debug('pattern match', p, f, hit)
|
|
2600
|
+
}
|
|
2601
|
+
|
|
2602
|
+
if (!hit) return false
|
|
2603
|
+
}
|
|
2604
|
+
|
|
2605
|
+
// Note: ending in / means that we'll get a final ""
|
|
2606
|
+
// at the end of the pattern. This can only match a
|
|
2607
|
+
// corresponding "" at the end of the file.
|
|
2608
|
+
// If the file ends in /, then it can only match a
|
|
2609
|
+
// a pattern that ends in /, unless the pattern just
|
|
2610
|
+
// doesn't have any more for it. But, a/b/ should *not*
|
|
2611
|
+
// match "a/b/*", even though "" matches against the
|
|
2612
|
+
// [^/]*? pattern, except in partial mode, where it might
|
|
2613
|
+
// simply not be reached yet.
|
|
2614
|
+
// However, a/b/ should still satisfy a/*
|
|
2615
|
+
|
|
2616
|
+
// now either we fell off the end of the pattern, or we're done.
|
|
2617
|
+
if (fi === fl && pi === pl) {
|
|
2618
|
+
// ran out of pattern and filename at the same time.
|
|
2619
|
+
// an exact hit!
|
|
2620
|
+
return true
|
|
2621
|
+
} else if (fi === fl) {
|
|
2622
|
+
// ran out of file, but still had pattern left.
|
|
2623
|
+
// this is ok if we're doing the match as part of
|
|
2624
|
+
// a glob fs traversal.
|
|
2625
|
+
return partial
|
|
2626
|
+
} else /* istanbul ignore else */ if (pi === pl) {
|
|
2627
|
+
// ran out of pattern, still have file left.
|
|
2628
|
+
// this is only acceptable if we're on the very last
|
|
2629
|
+
// empty segment of a file with a trailing slash.
|
|
2630
|
+
// a/* should match a/b/
|
|
2631
|
+
return (fi === fl - 1) && (file[fi] === '')
|
|
2632
|
+
}
|
|
2633
|
+
|
|
2634
|
+
// should be unreachable.
|
|
2635
|
+
/* istanbul ignore next */
|
|
2636
|
+
throw new Error('wtf?')
|
|
2619
2637
|
}
|
|
2620
|
-
}
|
|
2621
2638
|
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
var exists = this._stat(prefix)
|
|
2639
|
+
braceExpand () {
|
|
2640
|
+
return braceExpand(this.pattern, this.options)
|
|
2641
|
+
}
|
|
2626
2642
|
|
|
2627
|
-
|
|
2628
|
-
|
|
2643
|
+
parse (pattern, isSub) {
|
|
2644
|
+
assertValidPattern(pattern)
|
|
2629
2645
|
|
|
2630
|
-
|
|
2631
|
-
if (!exists)
|
|
2632
|
-
return
|
|
2646
|
+
const options = this.options
|
|
2633
2647
|
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2648
|
+
// shortcuts
|
|
2649
|
+
if (pattern === '**') {
|
|
2650
|
+
if (!options.noglobstar)
|
|
2651
|
+
return GLOBSTAR
|
|
2652
|
+
else
|
|
2653
|
+
pattern = '*'
|
|
2654
|
+
}
|
|
2655
|
+
if (pattern === '') return ''
|
|
2656
|
+
|
|
2657
|
+
let re = ''
|
|
2658
|
+
let hasMagic = !!options.nocase
|
|
2659
|
+
let escaping = false
|
|
2660
|
+
// ? => one single character
|
|
2661
|
+
const patternListStack = []
|
|
2662
|
+
const negativeLists = []
|
|
2663
|
+
let stateChar
|
|
2664
|
+
let inClass = false
|
|
2665
|
+
let reClassStart = -1
|
|
2666
|
+
let classStart = -1
|
|
2667
|
+
let cs
|
|
2668
|
+
let pl
|
|
2669
|
+
let sp
|
|
2670
|
+
// . and .. never match anything that doesn't start with .,
|
|
2671
|
+
// even when options.dot is set.
|
|
2672
|
+
const patternStart = pattern.charAt(0) === '.' ? '' // anything
|
|
2673
|
+
// not (start or / followed by . or .. followed by / or end)
|
|
2674
|
+
: options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))'
|
|
2675
|
+
: '(?!\\.)'
|
|
2676
|
+
|
|
2677
|
+
const clearStateChar = () => {
|
|
2678
|
+
if (stateChar) {
|
|
2679
|
+
// we had some state-tracking character
|
|
2680
|
+
// that wasn't consumed by this pass.
|
|
2681
|
+
switch (stateChar) {
|
|
2682
|
+
case '*':
|
|
2683
|
+
re += star
|
|
2684
|
+
hasMagic = true
|
|
2685
|
+
break
|
|
2686
|
+
case '?':
|
|
2687
|
+
re += qmark
|
|
2688
|
+
hasMagic = true
|
|
2689
|
+
break
|
|
2690
|
+
default:
|
|
2691
|
+
re += '\\' + stateChar
|
|
2692
|
+
break
|
|
2693
|
+
}
|
|
2694
|
+
this.debug('clearStateChar %j %j', stateChar, re)
|
|
2695
|
+
stateChar = false
|
|
2696
|
+
}
|
|
2642
2697
|
}
|
|
2643
|
-
}
|
|
2644
2698
|
|
|
2645
|
-
|
|
2646
|
-
|
|
2699
|
+
for (let i = 0, c; (i < pattern.length) && (c = pattern.charAt(i)); i++) {
|
|
2700
|
+
this.debug('%s\t%s %s %j', pattern, i, re, c)
|
|
2647
2701
|
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2702
|
+
// skip over any that are escaped.
|
|
2703
|
+
if (escaping) {
|
|
2704
|
+
/* istanbul ignore next - completely not allowed, even escaped. */
|
|
2705
|
+
if (c === '/') {
|
|
2706
|
+
return false
|
|
2707
|
+
}
|
|
2651
2708
|
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2709
|
+
if (reSpecials[c]) {
|
|
2710
|
+
re += '\\'
|
|
2711
|
+
}
|
|
2712
|
+
re += c
|
|
2713
|
+
escaping = false
|
|
2714
|
+
continue
|
|
2715
|
+
}
|
|
2656
2716
|
|
|
2657
|
-
|
|
2658
|
-
|
|
2717
|
+
switch (c) {
|
|
2718
|
+
/* istanbul ignore next */
|
|
2719
|
+
case '/': {
|
|
2720
|
+
// Should already be path-split by now.
|
|
2721
|
+
return false
|
|
2722
|
+
}
|
|
2659
2723
|
|
|
2660
|
-
|
|
2661
|
-
|
|
2724
|
+
case '\\':
|
|
2725
|
+
clearStateChar()
|
|
2726
|
+
escaping = true
|
|
2727
|
+
continue
|
|
2662
2728
|
|
|
2663
|
-
|
|
2664
|
-
|
|
2729
|
+
// the various stateChar values
|
|
2730
|
+
// for the "extglob" stuff.
|
|
2731
|
+
case '?':
|
|
2732
|
+
case '*':
|
|
2733
|
+
case '+':
|
|
2734
|
+
case '@':
|
|
2735
|
+
case '!':
|
|
2736
|
+
this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c)
|
|
2737
|
+
|
|
2738
|
+
// all of those are literals inside a class, except that
|
|
2739
|
+
// the glob [!a] means [^a] in regexp
|
|
2740
|
+
if (inClass) {
|
|
2741
|
+
this.debug(' in class')
|
|
2742
|
+
if (c === '!' && i === classStart + 1) c = '^'
|
|
2743
|
+
re += c
|
|
2744
|
+
continue
|
|
2745
|
+
}
|
|
2665
2746
|
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2747
|
+
// if we already have a stateChar, then it means
|
|
2748
|
+
// that there was something like ** or +? in there.
|
|
2749
|
+
// Handle the stateChar, then proceed with this one.
|
|
2750
|
+
this.debug('call clearStateChar %j', stateChar)
|
|
2751
|
+
clearStateChar()
|
|
2752
|
+
stateChar = c
|
|
2753
|
+
// if extglob is disabled, then +(asdf|foo) isn't a thing.
|
|
2754
|
+
// just clear the statechar *now*, rather than even diving into
|
|
2755
|
+
// the patternList stuff.
|
|
2756
|
+
if (options.noext) clearStateChar()
|
|
2757
|
+
continue
|
|
2758
|
+
|
|
2759
|
+
case '(':
|
|
2760
|
+
if (inClass) {
|
|
2761
|
+
re += '('
|
|
2762
|
+
continue
|
|
2763
|
+
}
|
|
2669
2764
|
|
|
2670
|
-
|
|
2671
|
-
|
|
2765
|
+
if (!stateChar) {
|
|
2766
|
+
re += '\\('
|
|
2767
|
+
continue
|
|
2768
|
+
}
|
|
2672
2769
|
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2770
|
+
patternListStack.push({
|
|
2771
|
+
type: stateChar,
|
|
2772
|
+
start: i - 1,
|
|
2773
|
+
reStart: re.length,
|
|
2774
|
+
open: plTypes[stateChar].open,
|
|
2775
|
+
close: plTypes[stateChar].close
|
|
2776
|
+
})
|
|
2777
|
+
// negation is (?:(?!js)[^/]*)
|
|
2778
|
+
re += stateChar === '!' ? '(?:(?!(?:' : '(?:'
|
|
2779
|
+
this.debug('plType %j %j', stateChar, re)
|
|
2780
|
+
stateChar = false
|
|
2781
|
+
continue
|
|
2782
|
+
|
|
2783
|
+
case ')':
|
|
2784
|
+
if (inClass || !patternListStack.length) {
|
|
2785
|
+
re += '\\)'
|
|
2786
|
+
continue
|
|
2787
|
+
}
|
|
2676
2788
|
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
}
|
|
2789
|
+
clearStateChar()
|
|
2790
|
+
hasMagic = true
|
|
2791
|
+
pl = patternListStack.pop()
|
|
2792
|
+
// negation is (?:(?!js)[^/]*)
|
|
2793
|
+
// The others are (?:<pattern>)<type>
|
|
2794
|
+
re += pl.close
|
|
2795
|
+
if (pl.type === '!') {
|
|
2796
|
+
negativeLists.push(pl)
|
|
2797
|
+
}
|
|
2798
|
+
pl.reEnd = re.length
|
|
2799
|
+
continue
|
|
2689
2800
|
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
}
|
|
2696
|
-
} else {
|
|
2697
|
-
stat = lstat
|
|
2698
|
-
}
|
|
2699
|
-
}
|
|
2801
|
+
case '|':
|
|
2802
|
+
if (inClass || !patternListStack.length) {
|
|
2803
|
+
re += '\\|'
|
|
2804
|
+
continue
|
|
2805
|
+
}
|
|
2700
2806
|
|
|
2701
|
-
|
|
2807
|
+
clearStateChar()
|
|
2808
|
+
re += '|'
|
|
2809
|
+
continue
|
|
2702
2810
|
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2811
|
+
// these are mostly the same in regexp and glob
|
|
2812
|
+
case '[':
|
|
2813
|
+
// swallow any state-tracking char before the [
|
|
2814
|
+
clearStateChar()
|
|
2706
2815
|
|
|
2707
|
-
|
|
2816
|
+
if (inClass) {
|
|
2817
|
+
re += '\\' + c
|
|
2818
|
+
continue
|
|
2819
|
+
}
|
|
2708
2820
|
|
|
2709
|
-
|
|
2710
|
-
|
|
2821
|
+
inClass = true
|
|
2822
|
+
classStart = i
|
|
2823
|
+
reClassStart = re.length
|
|
2824
|
+
re += c
|
|
2825
|
+
continue
|
|
2826
|
+
|
|
2827
|
+
case ']':
|
|
2828
|
+
// a right bracket shall lose its special
|
|
2829
|
+
// meaning and represent itself in
|
|
2830
|
+
// a bracket expression if it occurs
|
|
2831
|
+
// first in the list. -- POSIX.2 2.8.3.2
|
|
2832
|
+
if (i === classStart + 1 || !inClass) {
|
|
2833
|
+
re += '\\' + c
|
|
2834
|
+
continue
|
|
2835
|
+
}
|
|
2836
|
+
|
|
2837
|
+
// handle the case where we left a class open.
|
|
2838
|
+
// "[z-a]" is valid, equivalent to "\[z-a\]"
|
|
2839
|
+
// split where the last [ was, make sure we don't have
|
|
2840
|
+
// an invalid re. if so, re-walk the contents of the
|
|
2841
|
+
// would-be class to re-translate any characters that
|
|
2842
|
+
// were passed through as-is
|
|
2843
|
+
// TODO: It would probably be faster to determine this
|
|
2844
|
+
// without a try/catch and a new RegExp, but it's tricky
|
|
2845
|
+
// to do safely. For now, this is safe and works.
|
|
2846
|
+
cs = pattern.substring(classStart + 1, i)
|
|
2847
|
+
try {
|
|
2848
|
+
RegExp('[' + cs + ']')
|
|
2849
|
+
} catch (er) {
|
|
2850
|
+
// not a valid class!
|
|
2851
|
+
sp = this.parse(cs, SUBPARSE)
|
|
2852
|
+
re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'
|
|
2853
|
+
hasMagic = hasMagic || sp[1]
|
|
2854
|
+
inClass = false
|
|
2855
|
+
continue
|
|
2856
|
+
}
|
|
2857
|
+
|
|
2858
|
+
// finish up the class.
|
|
2859
|
+
hasMagic = true
|
|
2860
|
+
inClass = false
|
|
2861
|
+
re += c
|
|
2862
|
+
continue
|
|
2863
|
+
|
|
2864
|
+
default:
|
|
2865
|
+
// swallow any state char that wasn't consumed
|
|
2866
|
+
clearStateChar()
|
|
2867
|
+
|
|
2868
|
+
if (reSpecials[c] && !(c === '^' && inClass)) {
|
|
2869
|
+
re += '\\'
|
|
2870
|
+
}
|
|
2871
|
+
|
|
2872
|
+
re += c
|
|
2873
|
+
break
|
|
2874
|
+
|
|
2875
|
+
} // switch
|
|
2876
|
+
} // for
|
|
2877
|
+
|
|
2878
|
+
// handle the case where we left a class open.
|
|
2879
|
+
// "[abc" is valid, equivalent to "\[abc"
|
|
2880
|
+
if (inClass) {
|
|
2881
|
+
// split where the last [ was, and escape it
|
|
2882
|
+
// this is a huge pita. We now have to re-walk
|
|
2883
|
+
// the contents of the would-be class to re-translate
|
|
2884
|
+
// any characters that were passed through as-is
|
|
2885
|
+
cs = pattern.substr(classStart + 1)
|
|
2886
|
+
sp = this.parse(cs, SUBPARSE)
|
|
2887
|
+
re = re.substr(0, reClassStart) + '\\[' + sp[0]
|
|
2888
|
+
hasMagic = hasMagic || sp[1]
|
|
2889
|
+
}
|
|
2890
|
+
|
|
2891
|
+
// handle the case where we had a +( thing at the *end*
|
|
2892
|
+
// of the pattern.
|
|
2893
|
+
// each pattern list stack adds 3 chars, and we need to go through
|
|
2894
|
+
// and escape any | chars that were passed through as-is for the regexp.
|
|
2895
|
+
// Go through and escape them, taking care not to double-escape any
|
|
2896
|
+
// | chars that were already escaped.
|
|
2897
|
+
for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
|
|
2898
|
+
let tail
|
|
2899
|
+
tail = re.slice(pl.reStart + pl.open.length)
|
|
2900
|
+
this.debug('setting tail', re, pl)
|
|
2901
|
+
// maybe some even number of \, then maybe 1 \, followed by a |
|
|
2902
|
+
tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, (_, $1, $2) => {
|
|
2903
|
+
/* istanbul ignore else - should already be done */
|
|
2904
|
+
if (!$2) {
|
|
2905
|
+
// the | isn't already escaped, so escape it.
|
|
2906
|
+
$2 = '\\'
|
|
2907
|
+
}
|
|
2711
2908
|
|
|
2712
|
-
|
|
2713
|
-
|
|
2909
|
+
// need to escape all those slashes *again*, without escaping the
|
|
2910
|
+
// one that we need for escaping the | character. As it works out,
|
|
2911
|
+
// escaping an even number of slashes can be done by simply repeating
|
|
2912
|
+
// it exactly after itself. That's why this trick works.
|
|
2913
|
+
//
|
|
2914
|
+
// I am sorry that you have to see this.
|
|
2915
|
+
return $1 + $1 + $2 + '|'
|
|
2916
|
+
})
|
|
2714
2917
|
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2918
|
+
this.debug('tail=%j\n %s', tail, tail, pl, re)
|
|
2919
|
+
const t = pl.type === '*' ? star
|
|
2920
|
+
: pl.type === '?' ? qmark
|
|
2921
|
+
: '\\' + pl.type
|
|
2718
2922
|
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
}
|
|
2923
|
+
hasMagic = true
|
|
2924
|
+
re = re.slice(0, pl.reStart) + t + '\\(' + tail
|
|
2925
|
+
}
|
|
2722
2926
|
|
|
2927
|
+
// handle trailing things that only matter at the very end.
|
|
2928
|
+
clearStateChar()
|
|
2929
|
+
if (escaping) {
|
|
2930
|
+
// trailing \\
|
|
2931
|
+
re += '\\\\'
|
|
2932
|
+
}
|
|
2723
2933
|
|
|
2724
|
-
|
|
2934
|
+
// only need to apply the nodot start if the re starts with
|
|
2935
|
+
// something that could conceivably capture a dot
|
|
2936
|
+
const addPatternStart = addPatternStartSet[re.charAt(0)]
|
|
2937
|
+
|
|
2938
|
+
// Hack to work around lack of negative lookbehind in JS
|
|
2939
|
+
// A pattern like: *.!(x).!(y|z) needs to ensure that a name
|
|
2940
|
+
// like 'a.xyz.yz' doesn't match. So, the first negative
|
|
2941
|
+
// lookahead, has to look ALL the way ahead, to the end of
|
|
2942
|
+
// the pattern.
|
|
2943
|
+
for (let n = negativeLists.length - 1; n > -1; n--) {
|
|
2944
|
+
const nl = negativeLists[n]
|
|
2945
|
+
|
|
2946
|
+
const nlBefore = re.slice(0, nl.reStart)
|
|
2947
|
+
const nlFirst = re.slice(nl.reStart, nl.reEnd - 8)
|
|
2948
|
+
let nlAfter = re.slice(nl.reEnd)
|
|
2949
|
+
const nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + nlAfter
|
|
2950
|
+
|
|
2951
|
+
// Handle nested stuff like *(*.js|!(*.json)), where open parens
|
|
2952
|
+
// mean that we should *not* include the ) in the bit that is considered
|
|
2953
|
+
// "after" the negated section.
|
|
2954
|
+
const openParensBefore = nlBefore.split('(').length - 1
|
|
2955
|
+
let cleanAfter = nlAfter
|
|
2956
|
+
for (let i = 0; i < openParensBefore; i++) {
|
|
2957
|
+
cleanAfter = cleanAfter.replace(/\)[+*?]?/, '')
|
|
2958
|
+
}
|
|
2959
|
+
nlAfter = cleanAfter
|
|
2725
2960
|
|
|
2726
|
-
|
|
2727
|
-
|
|
2961
|
+
const dollar = nlAfter === '' && isSub !== SUBPARSE ? '$' : ''
|
|
2962
|
+
re = nlBefore + nlFirst + nlAfter + dollar + nlLast
|
|
2963
|
+
}
|
|
2728
2964
|
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2965
|
+
// if the re is not "" at this point, then we need to make sure
|
|
2966
|
+
// it doesn't match against an empty path part.
|
|
2967
|
+
// Otherwise a/* will match a/, which it should not.
|
|
2968
|
+
if (re !== '' && hasMagic) {
|
|
2969
|
+
re = '(?=.)' + re
|
|
2970
|
+
}
|
|
2732
2971
|
|
|
2733
|
-
|
|
2972
|
+
if (addPatternStart) {
|
|
2973
|
+
re = patternStart + re
|
|
2974
|
+
}
|
|
2734
2975
|
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
} else {
|
|
2740
|
-
reqs[key] = [cb]
|
|
2741
|
-
return makeres(key)
|
|
2742
|
-
}
|
|
2743
|
-
}
|
|
2976
|
+
// parsing just a piece of a larger pattern.
|
|
2977
|
+
if (isSub === SUBPARSE) {
|
|
2978
|
+
return [re, hasMagic]
|
|
2979
|
+
}
|
|
2744
2980
|
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2981
|
+
// skip the regexp for non-magical patterns
|
|
2982
|
+
// unescape anything in it, though, so that it'll be
|
|
2983
|
+
// an exact match against a file etc.
|
|
2984
|
+
if (!hasMagic) {
|
|
2985
|
+
return globUnescape(pattern)
|
|
2986
|
+
}
|
|
2750
2987
|
|
|
2751
|
-
|
|
2752
|
-
// pass should be queued for later execution if something in the
|
|
2753
|
-
// list of callbacks throws, or if it should just be discarded.
|
|
2754
|
-
// However, it's such an edge case that it hardly matters, and either
|
|
2755
|
-
// choice is likely as surprising as the other.
|
|
2756
|
-
// As it happens, we do go ahead and schedule it for later execution.
|
|
2988
|
+
const flags = options.nocase ? 'i' : ''
|
|
2757
2989
|
try {
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
})
|
|
2769
|
-
} else {
|
|
2770
|
-
delete reqs[key]
|
|
2771
|
-
}
|
|
2990
|
+
return Object.assign(new RegExp('^' + re + '$', flags), {
|
|
2991
|
+
_glob: pattern,
|
|
2992
|
+
_src: re,
|
|
2993
|
+
})
|
|
2994
|
+
} catch (er) /* istanbul ignore next - should be impossible */ {
|
|
2995
|
+
// If it was an invalid regular expression, then it can't match
|
|
2996
|
+
// anything. This trick looks for a character after the end of
|
|
2997
|
+
// the string, which is of course impossible, except in multi-line
|
|
2998
|
+
// mode, but it's not a /m regex.
|
|
2999
|
+
return new RegExp('$.')
|
|
2772
3000
|
}
|
|
2773
|
-
}
|
|
2774
|
-
}
|
|
3001
|
+
}
|
|
2775
3002
|
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
var array = []
|
|
3003
|
+
makeRe () {
|
|
3004
|
+
if (this.regexp || this.regexp === false) return this.regexp
|
|
2779
3005
|
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
3006
|
+
// at this point, this.set is a 2d array of partial
|
|
3007
|
+
// pattern strings, or "**".
|
|
3008
|
+
//
|
|
3009
|
+
// It's better to use .match(). This function shouldn't
|
|
3010
|
+
// be used, really, but it's pretty convenient sometimes,
|
|
3011
|
+
// when you just want to work with a regex.
|
|
3012
|
+
const set = this.set
|
|
2783
3013
|
|
|
3014
|
+
if (!set.length) {
|
|
3015
|
+
this.regexp = false
|
|
3016
|
+
return this.regexp
|
|
3017
|
+
}
|
|
3018
|
+
const options = this.options
|
|
3019
|
+
|
|
3020
|
+
const twoStar = options.noglobstar ? star
|
|
3021
|
+
: options.dot ? twoStarDot
|
|
3022
|
+
: twoStarNoDot
|
|
3023
|
+
const flags = options.nocase ? 'i' : ''
|
|
3024
|
+
|
|
3025
|
+
// coalesce globstars and regexpify non-globstar patterns
|
|
3026
|
+
// if it's the only item, then we just do one twoStar
|
|
3027
|
+
// if it's the first, and there are more, prepend (\/|twoStar\/)? to next
|
|
3028
|
+
// if it's the last, append (\/twoStar|) to previous
|
|
3029
|
+
// if it's in the middle, append (\/|\/twoStar\/) to previous
|
|
3030
|
+
// then filter out GLOBSTAR symbols
|
|
3031
|
+
let re = set.map(pattern => {
|
|
3032
|
+
pattern = pattern.map(p =>
|
|
3033
|
+
typeof p === 'string' ? regExpEscape(p)
|
|
3034
|
+
: p === GLOBSTAR ? GLOBSTAR
|
|
3035
|
+
: p._src
|
|
3036
|
+
).reduce((set, p) => {
|
|
3037
|
+
if (!(set[set.length - 1] === GLOBSTAR && p === GLOBSTAR)) {
|
|
3038
|
+
set.push(p)
|
|
3039
|
+
}
|
|
3040
|
+
return set
|
|
3041
|
+
}, [])
|
|
3042
|
+
pattern.forEach((p, i) => {
|
|
3043
|
+
if (p !== GLOBSTAR || pattern[i-1] === GLOBSTAR) {
|
|
3044
|
+
return
|
|
3045
|
+
}
|
|
3046
|
+
if (i === 0) {
|
|
3047
|
+
if (pattern.length > 1) {
|
|
3048
|
+
pattern[i+1] = '(?:\\\/|' + twoStar + '\\\/)?' + pattern[i+1]
|
|
3049
|
+
} else {
|
|
3050
|
+
pattern[i] = twoStar
|
|
3051
|
+
}
|
|
3052
|
+
} else if (i === pattern.length - 1) {
|
|
3053
|
+
pattern[i-1] += '(?:\\\/|' + twoStar + ')?'
|
|
3054
|
+
} else {
|
|
3055
|
+
pattern[i-1] += '(?:\\\/|\\\/' + twoStar + '\\\/)' + pattern[i+1]
|
|
3056
|
+
pattern[i+1] = GLOBSTAR
|
|
3057
|
+
}
|
|
3058
|
+
})
|
|
3059
|
+
return pattern.filter(p => p !== GLOBSTAR).join('/')
|
|
3060
|
+
}).join('|')
|
|
2784
3061
|
|
|
2785
|
-
|
|
3062
|
+
// must match entire pattern
|
|
3063
|
+
// ending in a * or ** will make it less strict.
|
|
3064
|
+
re = '^(?:' + re + ')$'
|
|
2786
3065
|
|
|
2787
|
-
|
|
2788
|
-
|
|
3066
|
+
// can match anything, as long as it's not this.
|
|
3067
|
+
if (this.negate) re = '^(?!' + re + ').*$'
|
|
2789
3068
|
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
ctor.super_ = superCtor
|
|
2795
|
-
ctor.prototype = Object.create(superCtor.prototype, {
|
|
2796
|
-
constructor: {
|
|
2797
|
-
value: ctor,
|
|
2798
|
-
enumerable: false,
|
|
2799
|
-
writable: true,
|
|
2800
|
-
configurable: true
|
|
2801
|
-
}
|
|
2802
|
-
})
|
|
2803
|
-
}
|
|
2804
|
-
};
|
|
2805
|
-
} else {
|
|
2806
|
-
// old school shim for old browsers
|
|
2807
|
-
module.exports = function inherits(ctor, superCtor) {
|
|
2808
|
-
if (superCtor) {
|
|
2809
|
-
ctor.super_ = superCtor
|
|
2810
|
-
var TempCtor = function () {}
|
|
2811
|
-
TempCtor.prototype = superCtor.prototype
|
|
2812
|
-
ctor.prototype = new TempCtor()
|
|
2813
|
-
ctor.prototype.constructor = ctor
|
|
3069
|
+
try {
|
|
3070
|
+
this.regexp = new RegExp(re, flags)
|
|
3071
|
+
} catch (ex) /* istanbul ignore next - should be impossible */ {
|
|
3072
|
+
this.regexp = false
|
|
2814
3073
|
}
|
|
3074
|
+
return this.regexp
|
|
2815
3075
|
}
|
|
2816
|
-
}
|
|
2817
3076
|
|
|
3077
|
+
match (f, partial = this.partial) {
|
|
3078
|
+
this.debug('match', f, this.pattern)
|
|
3079
|
+
// short-circuit in the case of busted things.
|
|
3080
|
+
// comments, etc.
|
|
3081
|
+
if (this.comment) return false
|
|
3082
|
+
if (this.empty) return f === ''
|
|
2818
3083
|
|
|
2819
|
-
|
|
3084
|
+
if (f === '/' && partial) return true
|
|
2820
3085
|
|
|
2821
|
-
|
|
2822
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
3086
|
+
const options = this.options
|
|
2823
3087
|
|
|
2824
|
-
|
|
2825
|
-
|
|
3088
|
+
// windows: need to use /, not \
|
|
3089
|
+
if (path.sep !== '/') {
|
|
3090
|
+
f = f.split(path.sep).join('/')
|
|
3091
|
+
}
|
|
2826
3092
|
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
minimatch.sep = path.sep
|
|
3093
|
+
// treat the test path as a set of pathparts.
|
|
3094
|
+
f = f.split(slashSplit)
|
|
3095
|
+
this.debug(this.pattern, 'split', f)
|
|
2831
3096
|
|
|
2832
|
-
|
|
2833
|
-
|
|
3097
|
+
// just ONE of the pattern sets in this.set needs to match
|
|
3098
|
+
// in order for it to be valid. If negating, then just one
|
|
3099
|
+
// match means that we have failed.
|
|
3100
|
+
// Either way, return on the first hit.
|
|
2834
3101
|
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
'?': { open: '(?:', close: ')?' },
|
|
2838
|
-
'+': { open: '(?:', close: ')+' },
|
|
2839
|
-
'*': { open: '(?:', close: ')*' },
|
|
2840
|
-
'@': { open: '(?:', close: ')' }
|
|
2841
|
-
}
|
|
3102
|
+
const set = this.set
|
|
3103
|
+
this.debug(this.pattern, 'set', set)
|
|
2842
3104
|
|
|
2843
|
-
//
|
|
2844
|
-
|
|
2845
|
-
|
|
3105
|
+
// Find the basename of the path by looking for the last non-empty segment
|
|
3106
|
+
let filename
|
|
3107
|
+
for (let i = f.length - 1; i >= 0; i--) {
|
|
3108
|
+
filename = f[i]
|
|
3109
|
+
if (filename) break
|
|
3110
|
+
}
|
|
2846
3111
|
|
|
2847
|
-
|
|
2848
|
-
|
|
3112
|
+
for (let i = 0; i < set.length; i++) {
|
|
3113
|
+
const pattern = set[i]
|
|
3114
|
+
let file = f
|
|
3115
|
+
if (options.matchBase && pattern.length === 1) {
|
|
3116
|
+
file = [filename]
|
|
3117
|
+
}
|
|
3118
|
+
const hit = this.matchOne(file, pattern, partial)
|
|
3119
|
+
if (hit) {
|
|
3120
|
+
if (options.flipNegate) return true
|
|
3121
|
+
return !this.negate
|
|
3122
|
+
}
|
|
3123
|
+
}
|
|
2849
3124
|
|
|
2850
|
-
//
|
|
2851
|
-
//
|
|
2852
|
-
|
|
2853
|
-
|
|
3125
|
+
// didn't get any hits. this is success if it's a negative
|
|
3126
|
+
// pattern, failure otherwise.
|
|
3127
|
+
if (options.flipNegate) return false
|
|
3128
|
+
return this.negate
|
|
3129
|
+
}
|
|
2854
3130
|
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
3131
|
+
static defaults (def) {
|
|
3132
|
+
return minimatch.defaults(def).Minimatch
|
|
3133
|
+
}
|
|
3134
|
+
}
|
|
2858
3135
|
|
|
2859
|
-
|
|
2860
|
-
var reSpecials = charSet('().*{}+?[]^$\\!')
|
|
3136
|
+
minimatch.Minimatch = Minimatch
|
|
2861
3137
|
|
|
2862
|
-
// "abc" -> { a:true, b:true, c:true }
|
|
2863
|
-
function charSet (s) {
|
|
2864
|
-
return s.split('').reduce(function (set, c) {
|
|
2865
|
-
set[c] = true
|
|
2866
|
-
return set
|
|
2867
|
-
}, {})
|
|
2868
|
-
}
|
|
2869
3138
|
|
|
2870
|
-
|
|
2871
|
-
var slashSplit = /\/+/
|
|
3139
|
+
/***/ }),
|
|
2872
3140
|
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
options = options || {}
|
|
2876
|
-
return function (p, i, list) {
|
|
2877
|
-
return minimatch(p, pattern, options)
|
|
2878
|
-
}
|
|
2879
|
-
}
|
|
3141
|
+
/***/ 751:
|
|
3142
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2880
3143
|
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
var t = {}
|
|
2884
|
-
Object.keys(a).forEach(function (k) {
|
|
2885
|
-
t[k] = a[k]
|
|
2886
|
-
})
|
|
2887
|
-
Object.keys(b).forEach(function (k) {
|
|
2888
|
-
t[k] = b[k]
|
|
2889
|
-
})
|
|
2890
|
-
return t
|
|
2891
|
-
}
|
|
3144
|
+
module.exports = globSync
|
|
3145
|
+
globSync.GlobSync = GlobSync
|
|
2892
3146
|
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
3147
|
+
var rp = __webpack_require__(334)
|
|
3148
|
+
var minimatch = __webpack_require__(522)
|
|
3149
|
+
var Minimatch = minimatch.Minimatch
|
|
3150
|
+
var Glob = (__webpack_require__(668).Glob)
|
|
3151
|
+
var util = __webpack_require__(464)
|
|
3152
|
+
var path = __webpack_require__(423)
|
|
3153
|
+
var assert = __webpack_require__(84)
|
|
3154
|
+
var isAbsolute = (__webpack_require__(423).isAbsolute)
|
|
3155
|
+
var common = __webpack_require__(772)
|
|
3156
|
+
var setopts = common.setopts
|
|
3157
|
+
var ownProp = common.ownProp
|
|
3158
|
+
var childrenIgnored = common.childrenIgnored
|
|
3159
|
+
var isIgnored = common.isIgnored
|
|
2897
3160
|
|
|
2898
|
-
|
|
3161
|
+
function globSync (pattern, options) {
|
|
3162
|
+
if (typeof options === 'function' || arguments.length === 3)
|
|
3163
|
+
throw new TypeError('callback provided to sync glob\n'+
|
|
3164
|
+
'See: https://github.com/isaacs/node-glob/issues/167')
|
|
2899
3165
|
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
}
|
|
3166
|
+
return new GlobSync(pattern, options).found
|
|
3167
|
+
}
|
|
2903
3168
|
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
m.Minimatch.defaults = function defaults (options) {
|
|
2908
|
-
return orig.defaults(ext(def, options)).Minimatch
|
|
2909
|
-
}
|
|
3169
|
+
function GlobSync (pattern, options) {
|
|
3170
|
+
if (!pattern)
|
|
3171
|
+
throw new Error('must provide pattern')
|
|
2910
3172
|
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
3173
|
+
if (typeof options === 'function' || arguments.length === 3)
|
|
3174
|
+
throw new TypeError('callback provided to sync glob\n'+
|
|
3175
|
+
'See: https://github.com/isaacs/node-glob/issues/167')
|
|
2914
3176
|
|
|
2915
|
-
|
|
2916
|
-
return
|
|
2917
|
-
}
|
|
3177
|
+
if (!(this instanceof GlobSync))
|
|
3178
|
+
return new GlobSync(pattern, options)
|
|
2918
3179
|
|
|
2919
|
-
|
|
2920
|
-
return orig.makeRe(pattern, ext(def, options))
|
|
2921
|
-
}
|
|
3180
|
+
setopts(this, pattern, options)
|
|
2922
3181
|
|
|
2923
|
-
|
|
2924
|
-
return
|
|
2925
|
-
}
|
|
3182
|
+
if (this.noprocess)
|
|
3183
|
+
return this
|
|
2926
3184
|
|
|
2927
|
-
|
|
2928
|
-
|
|
3185
|
+
var n = this.minimatch.set.length
|
|
3186
|
+
this.matches = new Array(n)
|
|
3187
|
+
for (var i = 0; i < n; i ++) {
|
|
3188
|
+
this._process(this.minimatch.set[i], i, false)
|
|
2929
3189
|
}
|
|
2930
|
-
|
|
2931
|
-
return m
|
|
3190
|
+
this._finish()
|
|
2932
3191
|
}
|
|
2933
3192
|
|
|
2934
|
-
|
|
2935
|
-
|
|
3193
|
+
GlobSync.prototype._finish = function () {
|
|
3194
|
+
assert.ok(this instanceof GlobSync)
|
|
3195
|
+
if (this.realpath) {
|
|
3196
|
+
var self = this
|
|
3197
|
+
this.matches.forEach(function (matchset, index) {
|
|
3198
|
+
var set = self.matches[index] = Object.create(null)
|
|
3199
|
+
for (var p in matchset) {
|
|
3200
|
+
try {
|
|
3201
|
+
p = self._makeAbs(p)
|
|
3202
|
+
var real = rp.realpathSync(p, self.realpathCache)
|
|
3203
|
+
set[real] = true
|
|
3204
|
+
} catch (er) {
|
|
3205
|
+
if (er.syscall === 'stat')
|
|
3206
|
+
set[self._makeAbs(p)] = true
|
|
3207
|
+
else
|
|
3208
|
+
throw er
|
|
3209
|
+
}
|
|
3210
|
+
}
|
|
3211
|
+
})
|
|
3212
|
+
}
|
|
3213
|
+
common.finish(this)
|
|
2936
3214
|
}
|
|
2937
3215
|
|
|
2938
|
-
function minimatch (p, pattern, options) {
|
|
2939
|
-
assertValidPattern(pattern)
|
|
2940
3216
|
|
|
2941
|
-
|
|
3217
|
+
GlobSync.prototype._process = function (pattern, index, inGlobStar) {
|
|
3218
|
+
assert.ok(this instanceof GlobSync)
|
|
2942
3219
|
|
|
2943
|
-
//
|
|
2944
|
-
|
|
2945
|
-
|
|
3220
|
+
// Get the first [n] parts of pattern that are all strings.
|
|
3221
|
+
var n = 0
|
|
3222
|
+
while (typeof pattern[n] === 'string') {
|
|
3223
|
+
n ++
|
|
2946
3224
|
}
|
|
3225
|
+
// now n is the index of the first one that is *not* a string.
|
|
2947
3226
|
|
|
2948
|
-
|
|
2949
|
-
|
|
3227
|
+
// See if there's anything else
|
|
3228
|
+
var prefix
|
|
3229
|
+
switch (n) {
|
|
3230
|
+
// if not, then this is rather simple
|
|
3231
|
+
case pattern.length:
|
|
3232
|
+
this._processSimple(pattern.join('/'), index)
|
|
3233
|
+
return
|
|
3234
|
+
|
|
3235
|
+
case 0:
|
|
3236
|
+
// pattern *starts* with some non-trivial item.
|
|
3237
|
+
// going to readdir(cwd), but not include the prefix in matches.
|
|
3238
|
+
prefix = null
|
|
3239
|
+
break
|
|
2950
3240
|
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
3241
|
+
default:
|
|
3242
|
+
// pattern has some string bits in the front.
|
|
3243
|
+
// whatever it starts with, whether that's 'absolute' like /foo/bar,
|
|
3244
|
+
// or 'relative' like '../baz'
|
|
3245
|
+
prefix = pattern.slice(0, n).join('/')
|
|
3246
|
+
break
|
|
2954
3247
|
}
|
|
2955
3248
|
|
|
2956
|
-
|
|
3249
|
+
var remain = pattern.slice(n)
|
|
2957
3250
|
|
|
2958
|
-
|
|
3251
|
+
// get the list of entries.
|
|
3252
|
+
var read
|
|
3253
|
+
if (prefix === null)
|
|
3254
|
+
read = '.'
|
|
3255
|
+
else if (isAbsolute(prefix) ||
|
|
3256
|
+
isAbsolute(pattern.map(function (p) {
|
|
3257
|
+
return typeof p === 'string' ? p : '[*]'
|
|
3258
|
+
}).join('/'))) {
|
|
3259
|
+
if (!prefix || !isAbsolute(prefix))
|
|
3260
|
+
prefix = '/' + prefix
|
|
3261
|
+
read = prefix
|
|
3262
|
+
} else
|
|
3263
|
+
read = prefix
|
|
2959
3264
|
|
|
2960
|
-
|
|
3265
|
+
var abs = this._makeAbs(read)
|
|
2961
3266
|
|
|
2962
|
-
//
|
|
2963
|
-
if (
|
|
2964
|
-
|
|
2965
|
-
}
|
|
3267
|
+
//if ignored, skip processing
|
|
3268
|
+
if (childrenIgnored(this, read))
|
|
3269
|
+
return
|
|
2966
3270
|
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
this.comment = false
|
|
2973
|
-
this.empty = false
|
|
2974
|
-
this.partial = !!options.partial
|
|
2975
|
-
|
|
2976
|
-
// make the set of regexps etc.
|
|
2977
|
-
this.make()
|
|
3271
|
+
var isGlobStar = remain[0] === minimatch.GLOBSTAR
|
|
3272
|
+
if (isGlobStar)
|
|
3273
|
+
this._processGlobStar(prefix, read, abs, remain, index, inGlobStar)
|
|
3274
|
+
else
|
|
3275
|
+
this._processReaddir(prefix, read, abs, remain, index, inGlobStar)
|
|
2978
3276
|
}
|
|
2979
3277
|
|
|
2980
|
-
Minimatch.prototype.debug = function () {}
|
|
2981
3278
|
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
var pattern = this.pattern
|
|
2985
|
-
var options = this.options
|
|
3279
|
+
GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) {
|
|
3280
|
+
var entries = this._readdir(abs, inGlobStar)
|
|
2986
3281
|
|
|
2987
|
-
//
|
|
2988
|
-
if (!
|
|
2989
|
-
this.comment = true
|
|
2990
|
-
return
|
|
2991
|
-
}
|
|
2992
|
-
if (!pattern) {
|
|
2993
|
-
this.empty = true
|
|
3282
|
+
// if the abs isn't a dir, then nothing can match!
|
|
3283
|
+
if (!entries)
|
|
2994
3284
|
return
|
|
2995
|
-
}
|
|
2996
3285
|
|
|
2997
|
-
//
|
|
2998
|
-
|
|
3286
|
+
// It will only match dot entries if it starts with a dot, or if
|
|
3287
|
+
// dot is set. Stuff like @(.foo|.bar) isn't allowed.
|
|
3288
|
+
var pn = remain[0]
|
|
3289
|
+
var negate = !!this.minimatch.negate
|
|
3290
|
+
var rawGlob = pn._glob
|
|
3291
|
+
var dotOk = this.dot || rawGlob.charAt(0) === '.'
|
|
3292
|
+
|
|
3293
|
+
var matchedEntries = []
|
|
3294
|
+
for (var i = 0; i < entries.length; i++) {
|
|
3295
|
+
var e = entries[i]
|
|
3296
|
+
if (e.charAt(0) !== '.' || dotOk) {
|
|
3297
|
+
var m
|
|
3298
|
+
if (negate && !prefix) {
|
|
3299
|
+
m = !e.match(pn)
|
|
3300
|
+
} else {
|
|
3301
|
+
m = e.match(pn)
|
|
3302
|
+
}
|
|
3303
|
+
if (m)
|
|
3304
|
+
matchedEntries.push(e)
|
|
3305
|
+
}
|
|
3306
|
+
}
|
|
2999
3307
|
|
|
3000
|
-
|
|
3001
|
-
|
|
3308
|
+
var len = matchedEntries.length
|
|
3309
|
+
// If there are no matched entries, then nothing matches.
|
|
3310
|
+
if (len === 0)
|
|
3311
|
+
return
|
|
3002
3312
|
|
|
3003
|
-
if
|
|
3313
|
+
// if this is the last remaining pattern bit, then no need for
|
|
3314
|
+
// an additional stat *unless* the user has specified mark or
|
|
3315
|
+
// stat explicitly. We know they exist, since readdir returned
|
|
3316
|
+
// them.
|
|
3004
3317
|
|
|
3005
|
-
this.
|
|
3318
|
+
if (remain.length === 1 && !this.mark && !this.stat) {
|
|
3319
|
+
if (!this.matches[index])
|
|
3320
|
+
this.matches[index] = Object.create(null)
|
|
3006
3321
|
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3322
|
+
for (var i = 0; i < len; i ++) {
|
|
3323
|
+
var e = matchedEntries[i]
|
|
3324
|
+
if (prefix) {
|
|
3325
|
+
if (prefix.slice(-1) !== '/')
|
|
3326
|
+
e = prefix + '/' + e
|
|
3327
|
+
else
|
|
3328
|
+
e = prefix + e
|
|
3329
|
+
}
|
|
3015
3330
|
|
|
3016
|
-
|
|
3331
|
+
if (e.charAt(0) === '/' && !this.nomount) {
|
|
3332
|
+
e = path.join(this.root, e)
|
|
3333
|
+
}
|
|
3334
|
+
this._emitMatch(index, e)
|
|
3335
|
+
}
|
|
3336
|
+
// This was the last one, and no stats were needed
|
|
3337
|
+
return
|
|
3338
|
+
}
|
|
3017
3339
|
|
|
3018
|
-
//
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3340
|
+
// now test all matched entries as stand-ins for that part
|
|
3341
|
+
// of the pattern.
|
|
3342
|
+
remain.shift()
|
|
3343
|
+
for (var i = 0; i < len; i ++) {
|
|
3344
|
+
var e = matchedEntries[i]
|
|
3345
|
+
var newPattern
|
|
3346
|
+
if (prefix)
|
|
3347
|
+
newPattern = [prefix, e]
|
|
3348
|
+
else
|
|
3349
|
+
newPattern = [e]
|
|
3350
|
+
this._process(newPattern.concat(remain), index, inGlobStar)
|
|
3351
|
+
}
|
|
3352
|
+
}
|
|
3022
3353
|
|
|
3023
|
-
this.debug(this.pattern, set)
|
|
3024
3354
|
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
return
|
|
3028
|
-
})
|
|
3355
|
+
GlobSync.prototype._emitMatch = function (index, e) {
|
|
3356
|
+
if (isIgnored(this, e))
|
|
3357
|
+
return
|
|
3029
3358
|
|
|
3030
|
-
this.
|
|
3359
|
+
var abs = this._makeAbs(e)
|
|
3031
3360
|
|
|
3032
|
-
this.
|
|
3033
|
-
|
|
3361
|
+
if (this.mark)
|
|
3362
|
+
e = this._mark(e)
|
|
3034
3363
|
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
var negate = false
|
|
3039
|
-
var options = this.options
|
|
3040
|
-
var negateOffset = 0
|
|
3364
|
+
if (this.absolute) {
|
|
3365
|
+
e = abs
|
|
3366
|
+
}
|
|
3041
3367
|
|
|
3042
|
-
if (
|
|
3368
|
+
if (this.matches[index][e])
|
|
3369
|
+
return
|
|
3043
3370
|
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
negateOffset++
|
|
3371
|
+
if (this.nodir) {
|
|
3372
|
+
var c = this.cache[abs]
|
|
3373
|
+
if (c === 'DIR' || Array.isArray(c))
|
|
3374
|
+
return
|
|
3049
3375
|
}
|
|
3050
3376
|
|
|
3051
|
-
|
|
3052
|
-
this.negate = negate
|
|
3053
|
-
}
|
|
3377
|
+
this.matches[index][e] = true
|
|
3054
3378
|
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
// a{b,}c -> abc ac
|
|
3058
|
-
// a{0..3}d -> a0d a1d a2d a3d
|
|
3059
|
-
// a{b,c{d,e}f}g -> abg acdfg acefg
|
|
3060
|
-
// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
|
|
3061
|
-
//
|
|
3062
|
-
// Invalid sets are not expanded.
|
|
3063
|
-
// a{2..}b -> a{2..}b
|
|
3064
|
-
// a{b}c -> a{b}c
|
|
3065
|
-
minimatch.braceExpand = function (pattern, options) {
|
|
3066
|
-
return braceExpand(pattern, options)
|
|
3379
|
+
if (this.stat)
|
|
3380
|
+
this._stat(e)
|
|
3067
3381
|
}
|
|
3068
3382
|
|
|
3069
|
-
Minimatch.prototype.braceExpand = braceExpand
|
|
3070
3383
|
|
|
3071
|
-
function
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3384
|
+
GlobSync.prototype._readdirInGlobStar = function (abs) {
|
|
3385
|
+
// follow all symlinked directories forever
|
|
3386
|
+
// just proceed as if this is a non-globstar situation
|
|
3387
|
+
if (this.follow)
|
|
3388
|
+
return this._readdir(abs, false)
|
|
3389
|
+
|
|
3390
|
+
var entries
|
|
3391
|
+
var lstat
|
|
3392
|
+
var stat
|
|
3393
|
+
try {
|
|
3394
|
+
lstat = this.fs.lstatSync(abs)
|
|
3395
|
+
} catch (er) {
|
|
3396
|
+
if (er.code === 'ENOENT') {
|
|
3397
|
+
// lstat failed, doesn't exist
|
|
3398
|
+
return null
|
|
3077
3399
|
}
|
|
3078
3400
|
}
|
|
3079
3401
|
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
assertValidPattern(pattern)
|
|
3402
|
+
var isSym = lstat && lstat.isSymbolicLink()
|
|
3403
|
+
this.symlinks[abs] = isSym
|
|
3084
3404
|
|
|
3085
|
-
//
|
|
3086
|
-
//
|
|
3087
|
-
if (
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3405
|
+
// If it's not a symlink or a dir, then it's definitely a regular file.
|
|
3406
|
+
// don't bother doing a readdir in that case.
|
|
3407
|
+
if (!isSym && lstat && !lstat.isDirectory())
|
|
3408
|
+
this.cache[abs] = 'FILE'
|
|
3409
|
+
else
|
|
3410
|
+
entries = this._readdir(abs, false)
|
|
3091
3411
|
|
|
3092
|
-
return
|
|
3412
|
+
return entries
|
|
3093
3413
|
}
|
|
3094
3414
|
|
|
3095
|
-
|
|
3096
|
-
var
|
|
3097
|
-
if (typeof pattern !== 'string') {
|
|
3098
|
-
throw new TypeError('invalid pattern')
|
|
3099
|
-
}
|
|
3415
|
+
GlobSync.prototype._readdir = function (abs, inGlobStar) {
|
|
3416
|
+
var entries
|
|
3100
3417
|
|
|
3101
|
-
if (
|
|
3102
|
-
|
|
3103
|
-
}
|
|
3104
|
-
}
|
|
3418
|
+
if (inGlobStar && !ownProp(this.symlinks, abs))
|
|
3419
|
+
return this._readdirInGlobStar(abs)
|
|
3105
3420
|
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
// A regexp is made at the end which joins each array with an
|
|
3111
|
-
// escaped /, and another full one which joins each regexp with |.
|
|
3112
|
-
//
|
|
3113
|
-
// Following the lead of Bash 4.1, note that "**" only has special meaning
|
|
3114
|
-
// when it is the *only* thing in a path portion. Otherwise, any series
|
|
3115
|
-
// of * is equivalent to a single *. Globstar behavior is enabled by
|
|
3116
|
-
// default, and can be disabled by setting options.noglobstar.
|
|
3117
|
-
Minimatch.prototype.parse = parse
|
|
3118
|
-
var SUBPARSE = {}
|
|
3119
|
-
function parse (pattern, isSub) {
|
|
3120
|
-
assertValidPattern(pattern)
|
|
3421
|
+
if (ownProp(this.cache, abs)) {
|
|
3422
|
+
var c = this.cache[abs]
|
|
3423
|
+
if (!c || c === 'FILE')
|
|
3424
|
+
return null
|
|
3121
3425
|
|
|
3122
|
-
|
|
3426
|
+
if (Array.isArray(c))
|
|
3427
|
+
return c
|
|
3428
|
+
}
|
|
3123
3429
|
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
pattern = '*'
|
|
3430
|
+
try {
|
|
3431
|
+
return this._readdirEntries(abs, this.fs.readdirSync(abs))
|
|
3432
|
+
} catch (er) {
|
|
3433
|
+
this._readdirError(abs, er)
|
|
3434
|
+
return null
|
|
3130
3435
|
}
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
var re = ''
|
|
3134
|
-
var hasMagic = !!options.nocase
|
|
3135
|
-
var escaping = false
|
|
3136
|
-
// ? => one single character
|
|
3137
|
-
var patternListStack = []
|
|
3138
|
-
var negativeLists = []
|
|
3139
|
-
var stateChar
|
|
3140
|
-
var inClass = false
|
|
3141
|
-
var reClassStart = -1
|
|
3142
|
-
var classStart = -1
|
|
3143
|
-
// . and .. never match anything that doesn't start with .,
|
|
3144
|
-
// even when options.dot is set.
|
|
3145
|
-
var patternStart = pattern.charAt(0) === '.' ? '' // anything
|
|
3146
|
-
// not (start or / followed by . or .. followed by / or end)
|
|
3147
|
-
: options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))'
|
|
3148
|
-
: '(?!\\.)'
|
|
3149
|
-
var self = this
|
|
3436
|
+
}
|
|
3150
3437
|
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
break
|
|
3164
|
-
default:
|
|
3165
|
-
re += '\\' + stateChar
|
|
3166
|
-
break
|
|
3167
|
-
}
|
|
3168
|
-
self.debug('clearStateChar %j %j', stateChar, re)
|
|
3169
|
-
stateChar = false
|
|
3438
|
+
GlobSync.prototype._readdirEntries = function (abs, entries) {
|
|
3439
|
+
// if we haven't asked to stat everything, then just
|
|
3440
|
+
// assume that everything in there exists, so we can avoid
|
|
3441
|
+
// having to stat it a second time.
|
|
3442
|
+
if (!this.mark && !this.stat) {
|
|
3443
|
+
for (var i = 0; i < entries.length; i ++) {
|
|
3444
|
+
var e = entries[i]
|
|
3445
|
+
if (abs === '/')
|
|
3446
|
+
e = abs + e
|
|
3447
|
+
else
|
|
3448
|
+
e = abs + '/' + e
|
|
3449
|
+
this.cache[e] = true
|
|
3170
3450
|
}
|
|
3171
3451
|
}
|
|
3172
3452
|
|
|
3173
|
-
|
|
3174
|
-
; (i < len) && (c = pattern.charAt(i))
|
|
3175
|
-
; i++) {
|
|
3176
|
-
this.debug('%s\t%s %s %j', pattern, i, re, c)
|
|
3453
|
+
this.cache[abs] = entries
|
|
3177
3454
|
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
escaping = false
|
|
3182
|
-
continue
|
|
3183
|
-
}
|
|
3455
|
+
// mark and cache dir-ness
|
|
3456
|
+
return entries
|
|
3457
|
+
}
|
|
3184
3458
|
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3459
|
+
GlobSync.prototype._readdirError = function (f, er) {
|
|
3460
|
+
// handle errors, and cache the information
|
|
3461
|
+
switch (er.code) {
|
|
3462
|
+
case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
|
|
3463
|
+
case 'ENOTDIR': // totally normal. means it *does* exist.
|
|
3464
|
+
var abs = this._makeAbs(f)
|
|
3465
|
+
this.cache[abs] = 'FILE'
|
|
3466
|
+
if (abs === this.cwdAbs) {
|
|
3467
|
+
var error = new Error(er.code + ' invalid cwd ' + this.cwd)
|
|
3468
|
+
error.path = this.cwd
|
|
3469
|
+
error.code = er.code
|
|
3470
|
+
throw error
|
|
3191
3471
|
}
|
|
3472
|
+
break
|
|
3192
3473
|
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
// for the "extglob" stuff.
|
|
3200
|
-
case '?':
|
|
3201
|
-
case '*':
|
|
3202
|
-
case '+':
|
|
3203
|
-
case '@':
|
|
3204
|
-
case '!':
|
|
3205
|
-
this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c)
|
|
3206
|
-
|
|
3207
|
-
// all of those are literals inside a class, except that
|
|
3208
|
-
// the glob [!a] means [^a] in regexp
|
|
3209
|
-
if (inClass) {
|
|
3210
|
-
this.debug(' in class')
|
|
3211
|
-
if (c === '!' && i === classStart + 1) c = '^'
|
|
3212
|
-
re += c
|
|
3213
|
-
continue
|
|
3214
|
-
}
|
|
3215
|
-
|
|
3216
|
-
// if we already have a stateChar, then it means
|
|
3217
|
-
// that there was something like ** or +? in there.
|
|
3218
|
-
// Handle the stateChar, then proceed with this one.
|
|
3219
|
-
self.debug('call clearStateChar %j', stateChar)
|
|
3220
|
-
clearStateChar()
|
|
3221
|
-
stateChar = c
|
|
3222
|
-
// if extglob is disabled, then +(asdf|foo) isn't a thing.
|
|
3223
|
-
// just clear the statechar *now*, rather than even diving into
|
|
3224
|
-
// the patternList stuff.
|
|
3225
|
-
if (options.noext) clearStateChar()
|
|
3226
|
-
continue
|
|
3227
|
-
|
|
3228
|
-
case '(':
|
|
3229
|
-
if (inClass) {
|
|
3230
|
-
re += '('
|
|
3231
|
-
continue
|
|
3232
|
-
}
|
|
3233
|
-
|
|
3234
|
-
if (!stateChar) {
|
|
3235
|
-
re += '\\('
|
|
3236
|
-
continue
|
|
3237
|
-
}
|
|
3238
|
-
|
|
3239
|
-
patternListStack.push({
|
|
3240
|
-
type: stateChar,
|
|
3241
|
-
start: i - 1,
|
|
3242
|
-
reStart: re.length,
|
|
3243
|
-
open: plTypes[stateChar].open,
|
|
3244
|
-
close: plTypes[stateChar].close
|
|
3245
|
-
})
|
|
3246
|
-
// negation is (?:(?!js)[^/]*)
|
|
3247
|
-
re += stateChar === '!' ? '(?:(?!(?:' : '(?:'
|
|
3248
|
-
this.debug('plType %j %j', stateChar, re)
|
|
3249
|
-
stateChar = false
|
|
3250
|
-
continue
|
|
3251
|
-
|
|
3252
|
-
case ')':
|
|
3253
|
-
if (inClass || !patternListStack.length) {
|
|
3254
|
-
re += '\\)'
|
|
3255
|
-
continue
|
|
3256
|
-
}
|
|
3257
|
-
|
|
3258
|
-
clearStateChar()
|
|
3259
|
-
hasMagic = true
|
|
3260
|
-
var pl = patternListStack.pop()
|
|
3261
|
-
// negation is (?:(?!js)[^/]*)
|
|
3262
|
-
// The others are (?:<pattern>)<type>
|
|
3263
|
-
re += pl.close
|
|
3264
|
-
if (pl.type === '!') {
|
|
3265
|
-
negativeLists.push(pl)
|
|
3266
|
-
}
|
|
3267
|
-
pl.reEnd = re.length
|
|
3268
|
-
continue
|
|
3269
|
-
|
|
3270
|
-
case '|':
|
|
3271
|
-
if (inClass || !patternListStack.length || escaping) {
|
|
3272
|
-
re += '\\|'
|
|
3273
|
-
escaping = false
|
|
3274
|
-
continue
|
|
3275
|
-
}
|
|
3276
|
-
|
|
3277
|
-
clearStateChar()
|
|
3278
|
-
re += '|'
|
|
3279
|
-
continue
|
|
3280
|
-
|
|
3281
|
-
// these are mostly the same in regexp and glob
|
|
3282
|
-
case '[':
|
|
3283
|
-
// swallow any state-tracking char before the [
|
|
3284
|
-
clearStateChar()
|
|
3285
|
-
|
|
3286
|
-
if (inClass) {
|
|
3287
|
-
re += '\\' + c
|
|
3288
|
-
continue
|
|
3289
|
-
}
|
|
3290
|
-
|
|
3291
|
-
inClass = true
|
|
3292
|
-
classStart = i
|
|
3293
|
-
reClassStart = re.length
|
|
3294
|
-
re += c
|
|
3295
|
-
continue
|
|
3474
|
+
case 'ENOENT': // not terribly unusual
|
|
3475
|
+
case 'ELOOP':
|
|
3476
|
+
case 'ENAMETOOLONG':
|
|
3477
|
+
case 'UNKNOWN':
|
|
3478
|
+
this.cache[this._makeAbs(f)] = false
|
|
3479
|
+
break
|
|
3296
3480
|
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
}
|
|
3481
|
+
default: // some unusual error. Treat as failure.
|
|
3482
|
+
this.cache[this._makeAbs(f)] = false
|
|
3483
|
+
if (this.strict)
|
|
3484
|
+
throw er
|
|
3485
|
+
if (!this.silent)
|
|
3486
|
+
console.error('glob error', er)
|
|
3487
|
+
break
|
|
3488
|
+
}
|
|
3489
|
+
}
|
|
3307
3490
|
|
|
3308
|
-
|
|
3309
|
-
// "[z-a]" is valid, equivalent to "\[z-a\]"
|
|
3310
|
-
// split where the last [ was, make sure we don't have
|
|
3311
|
-
// an invalid re. if so, re-walk the contents of the
|
|
3312
|
-
// would-be class to re-translate any characters that
|
|
3313
|
-
// were passed through as-is
|
|
3314
|
-
// TODO: It would probably be faster to determine this
|
|
3315
|
-
// without a try/catch and a new RegExp, but it's tricky
|
|
3316
|
-
// to do safely. For now, this is safe and works.
|
|
3317
|
-
var cs = pattern.substring(classStart + 1, i)
|
|
3318
|
-
try {
|
|
3319
|
-
RegExp('[' + cs + ']')
|
|
3320
|
-
} catch (er) {
|
|
3321
|
-
// not a valid class!
|
|
3322
|
-
var sp = this.parse(cs, SUBPARSE)
|
|
3323
|
-
re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'
|
|
3324
|
-
hasMagic = hasMagic || sp[1]
|
|
3325
|
-
inClass = false
|
|
3326
|
-
continue
|
|
3327
|
-
}
|
|
3491
|
+
GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) {
|
|
3328
3492
|
|
|
3329
|
-
|
|
3330
|
-
hasMagic = true
|
|
3331
|
-
inClass = false
|
|
3332
|
-
re += c
|
|
3333
|
-
continue
|
|
3493
|
+
var entries = this._readdir(abs, inGlobStar)
|
|
3334
3494
|
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3495
|
+
// no entries means not a dir, so it can never have matches
|
|
3496
|
+
// foo.txt/** doesn't match foo.txt
|
|
3497
|
+
if (!entries)
|
|
3498
|
+
return
|
|
3338
3499
|
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
re += '\\'
|
|
3345
|
-
}
|
|
3500
|
+
// test without the globstar, and with every child both below
|
|
3501
|
+
// and replacing the globstar.
|
|
3502
|
+
var remainWithoutGlobStar = remain.slice(1)
|
|
3503
|
+
var gspref = prefix ? [ prefix ] : []
|
|
3504
|
+
var noGlobStar = gspref.concat(remainWithoutGlobStar)
|
|
3346
3505
|
|
|
3347
|
-
|
|
3506
|
+
// the noGlobStar pattern exits the inGlobStar state
|
|
3507
|
+
this._process(noGlobStar, index, false)
|
|
3348
3508
|
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
// handle the case where we left a class open.
|
|
3353
|
-
// "[abc" is valid, equivalent to "\[abc"
|
|
3354
|
-
if (inClass) {
|
|
3355
|
-
// split where the last [ was, and escape it
|
|
3356
|
-
// this is a huge pita. We now have to re-walk
|
|
3357
|
-
// the contents of the would-be class to re-translate
|
|
3358
|
-
// any characters that were passed through as-is
|
|
3359
|
-
cs = pattern.substr(classStart + 1)
|
|
3360
|
-
sp = this.parse(cs, SUBPARSE)
|
|
3361
|
-
re = re.substr(0, reClassStart) + '\\[' + sp[0]
|
|
3362
|
-
hasMagic = hasMagic || sp[1]
|
|
3363
|
-
}
|
|
3509
|
+
var len = entries.length
|
|
3510
|
+
var isSym = this.symlinks[abs]
|
|
3364
3511
|
|
|
3365
|
-
//
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
// and escape any | chars that were passed through as-is for the regexp.
|
|
3369
|
-
// Go through and escape them, taking care not to double-escape any
|
|
3370
|
-
// | chars that were already escaped.
|
|
3371
|
-
for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
|
|
3372
|
-
var tail = re.slice(pl.reStart + pl.open.length)
|
|
3373
|
-
this.debug('setting tail', re, pl)
|
|
3374
|
-
// maybe some even number of \, then maybe 1 \, followed by a |
|
|
3375
|
-
tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) {
|
|
3376
|
-
if (!$2) {
|
|
3377
|
-
// the | isn't already escaped, so escape it.
|
|
3378
|
-
$2 = '\\'
|
|
3379
|
-
}
|
|
3512
|
+
// If it's a symlink, and we're in a globstar, then stop
|
|
3513
|
+
if (isSym && inGlobStar)
|
|
3514
|
+
return
|
|
3380
3515
|
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
//
|
|
3386
|
-
// I am sorry that you have to see this.
|
|
3387
|
-
return $1 + $1 + $2 + '|'
|
|
3388
|
-
})
|
|
3516
|
+
for (var i = 0; i < len; i++) {
|
|
3517
|
+
var e = entries[i]
|
|
3518
|
+
if (e.charAt(0) === '.' && !this.dot)
|
|
3519
|
+
continue
|
|
3389
3520
|
|
|
3390
|
-
|
|
3391
|
-
var
|
|
3392
|
-
|
|
3393
|
-
: '\\' + pl.type
|
|
3521
|
+
// these two cases enter the inGlobStar state
|
|
3522
|
+
var instead = gspref.concat(entries[i], remainWithoutGlobStar)
|
|
3523
|
+
this._process(instead, index, true)
|
|
3394
3524
|
|
|
3395
|
-
|
|
3396
|
-
|
|
3525
|
+
var below = gspref.concat(entries[i], remain)
|
|
3526
|
+
this._process(below, index, true)
|
|
3397
3527
|
}
|
|
3528
|
+
}
|
|
3398
3529
|
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
re += '\\\\'
|
|
3404
|
-
}
|
|
3530
|
+
GlobSync.prototype._processSimple = function (prefix, index) {
|
|
3531
|
+
// XXX review this. Shouldn't it be doing the mounting etc
|
|
3532
|
+
// before doing stat? kinda weird?
|
|
3533
|
+
var exists = this._stat(prefix)
|
|
3405
3534
|
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
var addPatternStart = false
|
|
3409
|
-
switch (re.charAt(0)) {
|
|
3410
|
-
case '[': case '.': case '(': addPatternStart = true
|
|
3411
|
-
}
|
|
3535
|
+
if (!this.matches[index])
|
|
3536
|
+
this.matches[index] = Object.create(null)
|
|
3412
3537
|
|
|
3413
|
-
//
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
// lookahead, has to look ALL the way ahead, to the end of
|
|
3417
|
-
// the pattern.
|
|
3418
|
-
for (var n = negativeLists.length - 1; n > -1; n--) {
|
|
3419
|
-
var nl = negativeLists[n]
|
|
3420
|
-
|
|
3421
|
-
var nlBefore = re.slice(0, nl.reStart)
|
|
3422
|
-
var nlFirst = re.slice(nl.reStart, nl.reEnd - 8)
|
|
3423
|
-
var nlLast = re.slice(nl.reEnd - 8, nl.reEnd)
|
|
3424
|
-
var nlAfter = re.slice(nl.reEnd)
|
|
3425
|
-
|
|
3426
|
-
nlLast += nlAfter
|
|
3427
|
-
|
|
3428
|
-
// Handle nested stuff like *(*.js|!(*.json)), where open parens
|
|
3429
|
-
// mean that we should *not* include the ) in the bit that is considered
|
|
3430
|
-
// "after" the negated section.
|
|
3431
|
-
var openParensBefore = nlBefore.split('(').length - 1
|
|
3432
|
-
var cleanAfter = nlAfter
|
|
3433
|
-
for (i = 0; i < openParensBefore; i++) {
|
|
3434
|
-
cleanAfter = cleanAfter.replace(/\)[+*?]?/, '')
|
|
3435
|
-
}
|
|
3436
|
-
nlAfter = cleanAfter
|
|
3538
|
+
// If it doesn't exist, then just mark the lack of results
|
|
3539
|
+
if (!exists)
|
|
3540
|
+
return
|
|
3437
3541
|
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3542
|
+
if (prefix && isAbsolute(prefix) && !this.nomount) {
|
|
3543
|
+
var trail = /[\/\\]$/.test(prefix)
|
|
3544
|
+
if (prefix.charAt(0) === '/') {
|
|
3545
|
+
prefix = path.join(this.root, prefix)
|
|
3546
|
+
} else {
|
|
3547
|
+
prefix = path.resolve(this.root, prefix)
|
|
3548
|
+
if (trail)
|
|
3549
|
+
prefix += '/'
|
|
3441
3550
|
}
|
|
3442
|
-
var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast
|
|
3443
|
-
re = newRe
|
|
3444
3551
|
}
|
|
3445
3552
|
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
// Otherwise a/* will match a/, which it should not.
|
|
3449
|
-
if (re !== '' && hasMagic) {
|
|
3450
|
-
re = '(?=.)' + re
|
|
3451
|
-
}
|
|
3553
|
+
if (process.platform === 'win32')
|
|
3554
|
+
prefix = prefix.replace(/\\/g, '/')
|
|
3452
3555
|
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3556
|
+
// Mark this as a match
|
|
3557
|
+
this._emitMatch(index, prefix)
|
|
3558
|
+
}
|
|
3456
3559
|
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3560
|
+
// Returns either 'DIR', 'FILE', or false
|
|
3561
|
+
GlobSync.prototype._stat = function (f) {
|
|
3562
|
+
var abs = this._makeAbs(f)
|
|
3563
|
+
var needDir = f.slice(-1) === '/'
|
|
3461
3564
|
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
// an exact match against a file etc.
|
|
3465
|
-
if (!hasMagic) {
|
|
3466
|
-
return globUnescape(pattern)
|
|
3467
|
-
}
|
|
3565
|
+
if (f.length > this.maxLength)
|
|
3566
|
+
return false
|
|
3468
3567
|
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
var regExp = new RegExp('^' + re + '$', flags)
|
|
3472
|
-
} catch (er) /* istanbul ignore next - should be impossible */ {
|
|
3473
|
-
// If it was an invalid regular expression, then it can't match
|
|
3474
|
-
// anything. This trick looks for a character after the end of
|
|
3475
|
-
// the string, which is of course impossible, except in multi-line
|
|
3476
|
-
// mode, but it's not a /m regex.
|
|
3477
|
-
return new RegExp('$.')
|
|
3478
|
-
}
|
|
3568
|
+
if (!this.stat && ownProp(this.cache, abs)) {
|
|
3569
|
+
var c = this.cache[abs]
|
|
3479
3570
|
|
|
3480
|
-
|
|
3481
|
-
|
|
3571
|
+
if (Array.isArray(c))
|
|
3572
|
+
c = 'DIR'
|
|
3482
3573
|
|
|
3483
|
-
|
|
3484
|
-
|
|
3574
|
+
// It exists, but maybe not how we need it
|
|
3575
|
+
if (!needDir || c === 'DIR')
|
|
3576
|
+
return c
|
|
3485
3577
|
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
}
|
|
3578
|
+
if (needDir && c === 'FILE')
|
|
3579
|
+
return false
|
|
3489
3580
|
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3581
|
+
// otherwise we have to stat, because maybe c=true
|
|
3582
|
+
// if we know it exists, but not what it is.
|
|
3583
|
+
}
|
|
3493
3584
|
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3585
|
+
var exists
|
|
3586
|
+
var stat = this.statCache[abs]
|
|
3587
|
+
if (!stat) {
|
|
3588
|
+
var lstat
|
|
3589
|
+
try {
|
|
3590
|
+
lstat = this.fs.lstatSync(abs)
|
|
3591
|
+
} catch (er) {
|
|
3592
|
+
if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
|
|
3593
|
+
this.statCache[abs] = false
|
|
3594
|
+
return false
|
|
3595
|
+
}
|
|
3596
|
+
}
|
|
3501
3597
|
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3598
|
+
if (lstat && lstat.isSymbolicLink()) {
|
|
3599
|
+
try {
|
|
3600
|
+
stat = this.fs.statSync(abs)
|
|
3601
|
+
} catch (er) {
|
|
3602
|
+
stat = lstat
|
|
3603
|
+
}
|
|
3604
|
+
} else {
|
|
3605
|
+
stat = lstat
|
|
3606
|
+
}
|
|
3505
3607
|
}
|
|
3506
|
-
var options = this.options
|
|
3507
3608
|
|
|
3508
|
-
|
|
3509
|
-
: options.dot ? twoStarDot
|
|
3510
|
-
: twoStarNoDot
|
|
3511
|
-
var flags = options.nocase ? 'i' : ''
|
|
3609
|
+
this.statCache[abs] = stat
|
|
3512
3610
|
|
|
3513
|
-
var
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
: (typeof p === 'string') ? regExpEscape(p)
|
|
3517
|
-
: p._src
|
|
3518
|
-
}).join('\\\/')
|
|
3519
|
-
}).join('|')
|
|
3611
|
+
var c = true
|
|
3612
|
+
if (stat)
|
|
3613
|
+
c = stat.isDirectory() ? 'DIR' : 'FILE'
|
|
3520
3614
|
|
|
3521
|
-
|
|
3522
|
-
// ending in a * or ** will make it less strict.
|
|
3523
|
-
re = '^(?:' + re + ')$'
|
|
3615
|
+
this.cache[abs] = this.cache[abs] || c
|
|
3524
3616
|
|
|
3525
|
-
|
|
3526
|
-
|
|
3617
|
+
if (needDir && c === 'FILE')
|
|
3618
|
+
return false
|
|
3527
3619
|
|
|
3528
|
-
|
|
3529
|
-
this.regexp = new RegExp(re, flags)
|
|
3530
|
-
} catch (ex) /* istanbul ignore next - should be impossible */ {
|
|
3531
|
-
this.regexp = false
|
|
3532
|
-
}
|
|
3533
|
-
return this.regexp
|
|
3620
|
+
return c
|
|
3534
3621
|
}
|
|
3535
3622
|
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
var mm = new Minimatch(pattern, options)
|
|
3539
|
-
list = list.filter(function (f) {
|
|
3540
|
-
return mm.match(f)
|
|
3541
|
-
})
|
|
3542
|
-
if (mm.options.nonull && !list.length) {
|
|
3543
|
-
list.push(pattern)
|
|
3544
|
-
}
|
|
3545
|
-
return list
|
|
3623
|
+
GlobSync.prototype._mark = function (p) {
|
|
3624
|
+
return common.mark(this, p)
|
|
3546
3625
|
}
|
|
3547
3626
|
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
// short-circuit in the case of busted things.
|
|
3552
|
-
// comments, etc.
|
|
3553
|
-
if (this.comment) return false
|
|
3554
|
-
if (this.empty) return f === ''
|
|
3555
|
-
|
|
3556
|
-
if (f === '/' && partial) return true
|
|
3557
|
-
|
|
3558
|
-
var options = this.options
|
|
3627
|
+
GlobSync.prototype._makeAbs = function (f) {
|
|
3628
|
+
return common.makeAbs(this, f)
|
|
3629
|
+
}
|
|
3559
3630
|
|
|
3560
|
-
// windows: need to use /, not \
|
|
3561
|
-
if (path.sep !== '/') {
|
|
3562
|
-
f = f.split(path.sep).join('/')
|
|
3563
|
-
}
|
|
3564
3631
|
|
|
3565
|
-
|
|
3566
|
-
f = f.split(slashSplit)
|
|
3567
|
-
this.debug(this.pattern, 'split', f)
|
|
3632
|
+
/***/ }),
|
|
3568
3633
|
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
// match means that we have failed.
|
|
3572
|
-
// Either way, return on the first hit.
|
|
3634
|
+
/***/ 844:
|
|
3635
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
3573
3636
|
|
|
3574
|
-
|
|
3575
|
-
|
|
3637
|
+
var wrappy = __webpack_require__(479)
|
|
3638
|
+
var reqs = Object.create(null)
|
|
3639
|
+
var once = __webpack_require__(778)
|
|
3576
3640
|
|
|
3577
|
-
|
|
3578
|
-
var filename
|
|
3579
|
-
var i
|
|
3580
|
-
for (i = f.length - 1; i >= 0; i--) {
|
|
3581
|
-
filename = f[i]
|
|
3582
|
-
if (filename) break
|
|
3583
|
-
}
|
|
3641
|
+
module.exports = wrappy(inflight)
|
|
3584
3642
|
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
if (hit) {
|
|
3593
|
-
if (options.flipNegate) return true
|
|
3594
|
-
return !this.negate
|
|
3595
|
-
}
|
|
3643
|
+
function inflight (key, cb) {
|
|
3644
|
+
if (reqs[key]) {
|
|
3645
|
+
reqs[key].push(cb)
|
|
3646
|
+
return null
|
|
3647
|
+
} else {
|
|
3648
|
+
reqs[key] = [cb]
|
|
3649
|
+
return makeres(key)
|
|
3596
3650
|
}
|
|
3597
|
-
|
|
3598
|
-
// didn't get any hits. this is success if it's a negative
|
|
3599
|
-
// pattern, failure otherwise.
|
|
3600
|
-
if (options.flipNegate) return false
|
|
3601
|
-
return this.negate
|
|
3602
3651
|
}
|
|
3603
3652
|
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
Minimatch.prototype.matchOne = function (file, pattern, partial) {
|
|
3610
|
-
var options = this.options
|
|
3611
|
-
|
|
3612
|
-
this.debug('matchOne',
|
|
3613
|
-
{ 'this': this, file: file, pattern: pattern })
|
|
3614
|
-
|
|
3615
|
-
this.debug('matchOne', file.length, pattern.length)
|
|
3616
|
-
|
|
3617
|
-
for (var fi = 0,
|
|
3618
|
-
pi = 0,
|
|
3619
|
-
fl = file.length,
|
|
3620
|
-
pl = pattern.length
|
|
3621
|
-
; (fi < fl) && (pi < pl)
|
|
3622
|
-
; fi++, pi++) {
|
|
3623
|
-
this.debug('matchOne loop')
|
|
3624
|
-
var p = pattern[pi]
|
|
3625
|
-
var f = file[fi]
|
|
3626
|
-
|
|
3627
|
-
this.debug(pattern, p, f)
|
|
3628
|
-
|
|
3629
|
-
// should be impossible.
|
|
3630
|
-
// some invalid regexp stuff in the set.
|
|
3631
|
-
/* istanbul ignore if */
|
|
3632
|
-
if (p === false) return false
|
|
3633
|
-
|
|
3634
|
-
if (p === GLOBSTAR) {
|
|
3635
|
-
this.debug('GLOBSTAR', [pattern, p, f])
|
|
3636
|
-
|
|
3637
|
-
// "**"
|
|
3638
|
-
// a/**/b/**/c would match the following:
|
|
3639
|
-
// a/b/x/y/z/c
|
|
3640
|
-
// a/x/y/z/b/c
|
|
3641
|
-
// a/b/x/b/x/c
|
|
3642
|
-
// a/b/c
|
|
3643
|
-
// To do this, take the rest of the pattern after
|
|
3644
|
-
// the **, and see if it would match the file remainder.
|
|
3645
|
-
// If so, return success.
|
|
3646
|
-
// If not, the ** "swallows" a segment, and try again.
|
|
3647
|
-
// This is recursively awful.
|
|
3648
|
-
//
|
|
3649
|
-
// a/**/b/**/c matching a/b/x/y/z/c
|
|
3650
|
-
// - a matches a
|
|
3651
|
-
// - doublestar
|
|
3652
|
-
// - matchOne(b/x/y/z/c, b/**/c)
|
|
3653
|
-
// - b matches b
|
|
3654
|
-
// - doublestar
|
|
3655
|
-
// - matchOne(x/y/z/c, c) -> no
|
|
3656
|
-
// - matchOne(y/z/c, c) -> no
|
|
3657
|
-
// - matchOne(z/c, c) -> no
|
|
3658
|
-
// - matchOne(c, c) yes, hit
|
|
3659
|
-
var fr = fi
|
|
3660
|
-
var pr = pi + 1
|
|
3661
|
-
if (pr === pl) {
|
|
3662
|
-
this.debug('** at the end')
|
|
3663
|
-
// a ** at the end will just swallow the rest.
|
|
3664
|
-
// We have found a match.
|
|
3665
|
-
// however, it will not swallow /.x, unless
|
|
3666
|
-
// options.dot is set.
|
|
3667
|
-
// . and .. are *never* matched by **, for explosively
|
|
3668
|
-
// exponential reasons.
|
|
3669
|
-
for (; fi < fl; fi++) {
|
|
3670
|
-
if (file[fi] === '.' || file[fi] === '..' ||
|
|
3671
|
-
(!options.dot && file[fi].charAt(0) === '.')) return false
|
|
3672
|
-
}
|
|
3673
|
-
return true
|
|
3674
|
-
}
|
|
3675
|
-
|
|
3676
|
-
// ok, let's see if we can swallow whatever we can.
|
|
3677
|
-
while (fr < fl) {
|
|
3678
|
-
var swallowee = file[fr]
|
|
3679
|
-
|
|
3680
|
-
this.debug('\nglobstar while', file, fr, pattern, pr, swallowee)
|
|
3681
|
-
|
|
3682
|
-
// XXX remove this slice. Just pass the start index.
|
|
3683
|
-
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
|
3684
|
-
this.debug('globstar found match!', fr, fl, swallowee)
|
|
3685
|
-
// found a match.
|
|
3686
|
-
return true
|
|
3687
|
-
} else {
|
|
3688
|
-
// can't swallow "." or ".." ever.
|
|
3689
|
-
// can only swallow ".foo" when explicitly asked.
|
|
3690
|
-
if (swallowee === '.' || swallowee === '..' ||
|
|
3691
|
-
(!options.dot && swallowee.charAt(0) === '.')) {
|
|
3692
|
-
this.debug('dot detected!', file, fr, pattern, pr)
|
|
3693
|
-
break
|
|
3694
|
-
}
|
|
3653
|
+
function makeres (key) {
|
|
3654
|
+
return once(function RES () {
|
|
3655
|
+
var cbs = reqs[key]
|
|
3656
|
+
var len = cbs.length
|
|
3657
|
+
var args = slice(arguments)
|
|
3695
3658
|
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3659
|
+
// XXX It's somewhat ambiguous whether a new callback added in this
|
|
3660
|
+
// pass should be queued for later execution if something in the
|
|
3661
|
+
// list of callbacks throws, or if it should just be discarded.
|
|
3662
|
+
// However, it's such an edge case that it hardly matters, and either
|
|
3663
|
+
// choice is likely as surprising as the other.
|
|
3664
|
+
// As it happens, we do go ahead and schedule it for later execution.
|
|
3665
|
+
try {
|
|
3666
|
+
for (var i = 0; i < len; i++) {
|
|
3667
|
+
cbs[i].apply(null, args)
|
|
3700
3668
|
}
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3669
|
+
} finally {
|
|
3670
|
+
if (cbs.length > len) {
|
|
3671
|
+
// added more in the interim.
|
|
3672
|
+
// de-zalgo, just in case, but don't call again.
|
|
3673
|
+
cbs.splice(0, len)
|
|
3674
|
+
process.nextTick(function () {
|
|
3675
|
+
RES.apply(null, args)
|
|
3676
|
+
})
|
|
3677
|
+
} else {
|
|
3678
|
+
delete reqs[key]
|
|
3710
3679
|
}
|
|
3711
|
-
return false
|
|
3712
3680
|
}
|
|
3681
|
+
})
|
|
3682
|
+
}
|
|
3713
3683
|
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
var hit
|
|
3718
|
-
if (typeof p === 'string') {
|
|
3719
|
-
hit = f === p
|
|
3720
|
-
this.debug('string match', p, f, hit)
|
|
3721
|
-
} else {
|
|
3722
|
-
hit = f.match(p)
|
|
3723
|
-
this.debug('pattern match', p, f, hit)
|
|
3724
|
-
}
|
|
3684
|
+
function slice (args) {
|
|
3685
|
+
var length = args.length
|
|
3686
|
+
var array = []
|
|
3725
3687
|
|
|
3726
|
-
|
|
3727
|
-
|
|
3688
|
+
for (var i = 0; i < length; i++) array[i] = args[i]
|
|
3689
|
+
return array
|
|
3690
|
+
}
|
|
3728
3691
|
|
|
3729
|
-
// Note: ending in / means that we'll get a final ""
|
|
3730
|
-
// at the end of the pattern. This can only match a
|
|
3731
|
-
// corresponding "" at the end of the file.
|
|
3732
|
-
// If the file ends in /, then it can only match a
|
|
3733
|
-
// a pattern that ends in /, unless the pattern just
|
|
3734
|
-
// doesn't have any more for it. But, a/b/ should *not*
|
|
3735
|
-
// match "a/b/*", even though "" matches against the
|
|
3736
|
-
// [^/]*? pattern, except in partial mode, where it might
|
|
3737
|
-
// simply not be reached yet.
|
|
3738
|
-
// However, a/b/ should still satisfy a/*
|
|
3739
|
-
|
|
3740
|
-
// now either we fell off the end of the pattern, or we're done.
|
|
3741
|
-
if (fi === fl && pi === pl) {
|
|
3742
|
-
// ran out of pattern and filename at the same time.
|
|
3743
|
-
// an exact hit!
|
|
3744
|
-
return true
|
|
3745
|
-
} else if (fi === fl) {
|
|
3746
|
-
// ran out of file, but still had pattern left.
|
|
3747
|
-
// this is ok if we're doing the match as part of
|
|
3748
|
-
// a glob fs traversal.
|
|
3749
|
-
return partial
|
|
3750
|
-
} else /* istanbul ignore else */ if (pi === pl) {
|
|
3751
|
-
// ran out of pattern, still have file left.
|
|
3752
|
-
// this is only acceptable if we're on the very last
|
|
3753
|
-
// empty segment of a file with a trailing slash.
|
|
3754
|
-
// a/* should match a/b/
|
|
3755
|
-
return (fi === fl - 1) && (file[fi] === '')
|
|
3756
|
-
}
|
|
3757
3692
|
|
|
3758
|
-
|
|
3759
|
-
/* istanbul ignore next */
|
|
3760
|
-
throw new Error('wtf?')
|
|
3761
|
-
}
|
|
3693
|
+
/***/ }),
|
|
3762
3694
|
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
return s.replace(/\\(.)/g, '$1')
|
|
3766
|
-
}
|
|
3695
|
+
/***/ 717:
|
|
3696
|
+
/***/ ((module) => {
|
|
3767
3697
|
|
|
3768
|
-
|
|
3769
|
-
|
|
3698
|
+
if (typeof Object.create === 'function') {
|
|
3699
|
+
// implementation from standard node.js 'util' module
|
|
3700
|
+
module.exports = function inherits(ctor, superCtor) {
|
|
3701
|
+
if (superCtor) {
|
|
3702
|
+
ctor.super_ = superCtor
|
|
3703
|
+
ctor.prototype = Object.create(superCtor.prototype, {
|
|
3704
|
+
constructor: {
|
|
3705
|
+
value: ctor,
|
|
3706
|
+
enumerable: false,
|
|
3707
|
+
writable: true,
|
|
3708
|
+
configurable: true
|
|
3709
|
+
}
|
|
3710
|
+
})
|
|
3711
|
+
}
|
|
3712
|
+
};
|
|
3713
|
+
} else {
|
|
3714
|
+
// old school shim for old browsers
|
|
3715
|
+
module.exports = function inherits(ctor, superCtor) {
|
|
3716
|
+
if (superCtor) {
|
|
3717
|
+
ctor.super_ = superCtor
|
|
3718
|
+
var TempCtor = function () {}
|
|
3719
|
+
TempCtor.prototype = superCtor.prototype
|
|
3720
|
+
ctor.prototype = new TempCtor()
|
|
3721
|
+
ctor.prototype.constructor = ctor
|
|
3722
|
+
}
|
|
3723
|
+
}
|
|
3770
3724
|
}
|
|
3771
3725
|
|
|
3772
3726
|
|
|
@@ -3775,7 +3729,7 @@ function regExpEscape (s) {
|
|
|
3775
3729
|
/***/ 778:
|
|
3776
3730
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
3777
3731
|
|
|
3778
|
-
var wrappy = __webpack_require__(
|
|
3732
|
+
var wrappy = __webpack_require__(479)
|
|
3779
3733
|
module.exports = wrappy(once)
|
|
3780
3734
|
module.exports.strict = wrappy(onceStrict)
|
|
3781
3735
|
|
|
@@ -3821,35 +3775,7 @@ function onceStrict (fn) {
|
|
|
3821
3775
|
|
|
3822
3776
|
/***/ }),
|
|
3823
3777
|
|
|
3824
|
-
/***/
|
|
3825
|
-
/***/ ((module) => {
|
|
3826
|
-
|
|
3827
|
-
"use strict";
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
function posix(path) {
|
|
3831
|
-
return path.charAt(0) === '/';
|
|
3832
|
-
}
|
|
3833
|
-
|
|
3834
|
-
function win32(path) {
|
|
3835
|
-
// https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56
|
|
3836
|
-
var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
|
|
3837
|
-
var result = splitDeviceRe.exec(path);
|
|
3838
|
-
var device = result[1] || '';
|
|
3839
|
-
var isUnc = Boolean(device && device.charAt(1) !== ':');
|
|
3840
|
-
|
|
3841
|
-
// UNC paths are always absolute
|
|
3842
|
-
return Boolean(result[2] || isUnc);
|
|
3843
|
-
}
|
|
3844
|
-
|
|
3845
|
-
module.exports = process.platform === 'win32' ? win32 : posix;
|
|
3846
|
-
module.exports.posix = posix;
|
|
3847
|
-
module.exports.win32 = win32;
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
/***/ }),
|
|
3851
|
-
|
|
3852
|
-
/***/ 2479:
|
|
3778
|
+
/***/ 479:
|
|
3853
3779
|
/***/ ((module) => {
|
|
3854
3780
|
|
|
3855
3781
|
// Returns a wrapper function that returns a wrapped callback
|
|
@@ -3889,7 +3815,7 @@ function wrappy (fn, cb) {
|
|
|
3889
3815
|
|
|
3890
3816
|
/***/ }),
|
|
3891
3817
|
|
|
3892
|
-
/***/
|
|
3818
|
+
/***/ 84:
|
|
3893
3819
|
/***/ ((module) => {
|
|
3894
3820
|
|
|
3895
3821
|
"use strict";
|
|
@@ -3897,7 +3823,7 @@ module.exports = require("assert");
|
|
|
3897
3823
|
|
|
3898
3824
|
/***/ }),
|
|
3899
3825
|
|
|
3900
|
-
/***/
|
|
3826
|
+
/***/ 231:
|
|
3901
3827
|
/***/ ((module) => {
|
|
3902
3828
|
|
|
3903
3829
|
"use strict";
|
|
@@ -3905,7 +3831,7 @@ module.exports = require("fs");
|
|
|
3905
3831
|
|
|
3906
3832
|
/***/ }),
|
|
3907
3833
|
|
|
3908
|
-
/***/
|
|
3834
|
+
/***/ 423:
|
|
3909
3835
|
/***/ ((module) => {
|
|
3910
3836
|
|
|
3911
3837
|
"use strict";
|
|
@@ -3913,7 +3839,7 @@ module.exports = require("path");
|
|
|
3913
3839
|
|
|
3914
3840
|
/***/ }),
|
|
3915
3841
|
|
|
3916
|
-
/***/
|
|
3842
|
+
/***/ 464:
|
|
3917
3843
|
/***/ ((module) => {
|
|
3918
3844
|
|
|
3919
3845
|
"use strict";
|
|
@@ -4012,13 +3938,13 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
4012
3938
|
;// CONCATENATED MODULE: external "child_process"
|
|
4013
3939
|
const external_child_process_namespaceObject = require("child_process");
|
|
4014
3940
|
// EXTERNAL MODULE: external "fs"
|
|
4015
|
-
var external_fs_ = __webpack_require__(
|
|
3941
|
+
var external_fs_ = __webpack_require__(231);
|
|
4016
3942
|
;// CONCATENATED MODULE: external "fs/promises"
|
|
4017
3943
|
const promises_namespaceObject = require("fs/promises");
|
|
4018
3944
|
// EXTERNAL MODULE: ./node_modules/glob/glob.js
|
|
4019
|
-
var glob = __webpack_require__(
|
|
3945
|
+
var glob = __webpack_require__(668);
|
|
4020
3946
|
// EXTERNAL MODULE: external "path"
|
|
4021
|
-
var external_path_ = __webpack_require__(
|
|
3947
|
+
var external_path_ = __webpack_require__(423);
|
|
4022
3948
|
;// CONCATENATED MODULE: external "readline"
|
|
4023
3949
|
const external_readline_namespaceObject = require("readline");
|
|
4024
3950
|
;// CONCATENATED MODULE: ./src/util.ts
|
|
@@ -4034,7 +3960,7 @@ const external_readline_namespaceObject = require("readline");
|
|
|
4034
3960
|
__webpack_require__.g["lastModifiedSource" + ""] = 0;
|
|
4035
3961
|
function globa(pattern, options) {
|
|
4036
3962
|
return new Promise((resolve, reject) => {
|
|
4037
|
-
glob.glob(pattern, options || {}, (er, files) => {
|
|
3963
|
+
glob.glob(pattern.replace(/\\/g, "/"), options || {}, (er, files) => {
|
|
4038
3964
|
if (er) {
|
|
4039
3965
|
reject(files);
|
|
4040
3966
|
}
|