@oclif/plugin-test-esbuild 0.3.0 → 0.4.0
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 +276 -1
- package/dist/chunk-CKYVUCCZ.js +63 -0
- package/dist/{chunk-5PYTI2PW.js → chunk-G3X4TLKI.js} +5 -3
- package/dist/{chunk-VXI4PM45.js → chunk-L5EKG6PO.js} +5 -3
- package/dist/{chunk-WOI45AUT.js → chunk-OPAM43C4.js} +5 -3
- package/dist/{chunk-6MP3HI3C.js → chunk-SP5LIBJJ.js} +1236 -1280
- package/dist/{chunk-KIJSKMIE.js → chunk-UY7CILNM.js} +5 -3
- package/dist/commands/esbuild.js +3 -2
- package/dist/commands/hello/index.js +3 -2
- package/dist/commands/hello/world.js +3 -2
- package/dist/hooks/init/init.js +3 -2
- package/dist/index.js +4325 -19
- package/dist/shell-FHVZNOYW.js +4899 -0
- package/oclif.manifest.json +294 -1
- package/package.json +8 -3
|
@@ -0,0 +1,4899 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__commonJS,
|
|
3
|
+
__esm,
|
|
4
|
+
__glob,
|
|
5
|
+
__require,
|
|
6
|
+
init_cjs_shims
|
|
7
|
+
} from "./chunk-CKYVUCCZ.js";
|
|
8
|
+
|
|
9
|
+
// node_modules/fs.realpath/old.js
|
|
10
|
+
var require_old = __commonJS({
|
|
11
|
+
"node_modules/fs.realpath/old.js"(exports) {
|
|
12
|
+
init_cjs_shims();
|
|
13
|
+
var pathModule = __require("path");
|
|
14
|
+
var isWindows = process.platform === "win32";
|
|
15
|
+
var fs = __require("fs");
|
|
16
|
+
var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
|
|
17
|
+
function rethrow() {
|
|
18
|
+
var callback;
|
|
19
|
+
if (DEBUG) {
|
|
20
|
+
var backtrace = new Error();
|
|
21
|
+
callback = debugCallback;
|
|
22
|
+
} else
|
|
23
|
+
callback = missingCallback;
|
|
24
|
+
return callback;
|
|
25
|
+
function debugCallback(err) {
|
|
26
|
+
if (err) {
|
|
27
|
+
backtrace.message = err.message;
|
|
28
|
+
err = backtrace;
|
|
29
|
+
missingCallback(err);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function missingCallback(err) {
|
|
33
|
+
if (err) {
|
|
34
|
+
if (process.throwDeprecation)
|
|
35
|
+
throw err;
|
|
36
|
+
else if (!process.noDeprecation) {
|
|
37
|
+
var msg = "fs: missing callback " + (err.stack || err.message);
|
|
38
|
+
if (process.traceDeprecation)
|
|
39
|
+
console.trace(msg);
|
|
40
|
+
else
|
|
41
|
+
console.error(msg);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function maybeCallback(cb) {
|
|
47
|
+
return typeof cb === "function" ? cb : rethrow();
|
|
48
|
+
}
|
|
49
|
+
var normalize = pathModule.normalize;
|
|
50
|
+
if (isWindows) {
|
|
51
|
+
nextPartRe = /(.*?)(?:[\/\\]+|$)/g;
|
|
52
|
+
} else {
|
|
53
|
+
nextPartRe = /(.*?)(?:[\/]+|$)/g;
|
|
54
|
+
}
|
|
55
|
+
var nextPartRe;
|
|
56
|
+
if (isWindows) {
|
|
57
|
+
splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;
|
|
58
|
+
} else {
|
|
59
|
+
splitRootRe = /^[\/]*/;
|
|
60
|
+
}
|
|
61
|
+
var splitRootRe;
|
|
62
|
+
exports.realpathSync = function realpathSync(p, cache) {
|
|
63
|
+
p = pathModule.resolve(p);
|
|
64
|
+
if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
|
|
65
|
+
return cache[p];
|
|
66
|
+
}
|
|
67
|
+
var original = p, seenLinks = {}, knownHard = {};
|
|
68
|
+
var pos;
|
|
69
|
+
var current;
|
|
70
|
+
var base;
|
|
71
|
+
var previous;
|
|
72
|
+
start();
|
|
73
|
+
function start() {
|
|
74
|
+
var m = splitRootRe.exec(p);
|
|
75
|
+
pos = m[0].length;
|
|
76
|
+
current = m[0];
|
|
77
|
+
base = m[0];
|
|
78
|
+
previous = "";
|
|
79
|
+
if (isWindows && !knownHard[base]) {
|
|
80
|
+
fs.lstatSync(base);
|
|
81
|
+
knownHard[base] = true;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
while (pos < p.length) {
|
|
85
|
+
nextPartRe.lastIndex = pos;
|
|
86
|
+
var result = nextPartRe.exec(p);
|
|
87
|
+
previous = current;
|
|
88
|
+
current += result[0];
|
|
89
|
+
base = previous + result[1];
|
|
90
|
+
pos = nextPartRe.lastIndex;
|
|
91
|
+
if (knownHard[base] || cache && cache[base] === base) {
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
var resolvedLink;
|
|
95
|
+
if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
|
|
96
|
+
resolvedLink = cache[base];
|
|
97
|
+
} else {
|
|
98
|
+
var stat = fs.lstatSync(base);
|
|
99
|
+
if (!stat.isSymbolicLink()) {
|
|
100
|
+
knownHard[base] = true;
|
|
101
|
+
if (cache)
|
|
102
|
+
cache[base] = base;
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
var linkTarget = null;
|
|
106
|
+
if (!isWindows) {
|
|
107
|
+
var id = stat.dev.toString(32) + ":" + stat.ino.toString(32);
|
|
108
|
+
if (seenLinks.hasOwnProperty(id)) {
|
|
109
|
+
linkTarget = seenLinks[id];
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (linkTarget === null) {
|
|
113
|
+
fs.statSync(base);
|
|
114
|
+
linkTarget = fs.readlinkSync(base);
|
|
115
|
+
}
|
|
116
|
+
resolvedLink = pathModule.resolve(previous, linkTarget);
|
|
117
|
+
if (cache)
|
|
118
|
+
cache[base] = resolvedLink;
|
|
119
|
+
if (!isWindows)
|
|
120
|
+
seenLinks[id] = linkTarget;
|
|
121
|
+
}
|
|
122
|
+
p = pathModule.resolve(resolvedLink, p.slice(pos));
|
|
123
|
+
start();
|
|
124
|
+
}
|
|
125
|
+
if (cache)
|
|
126
|
+
cache[original] = p;
|
|
127
|
+
return p;
|
|
128
|
+
};
|
|
129
|
+
exports.realpath = function realpath(p, cache, cb) {
|
|
130
|
+
if (typeof cb !== "function") {
|
|
131
|
+
cb = maybeCallback(cache);
|
|
132
|
+
cache = null;
|
|
133
|
+
}
|
|
134
|
+
p = pathModule.resolve(p);
|
|
135
|
+
if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
|
|
136
|
+
return process.nextTick(cb.bind(null, null, cache[p]));
|
|
137
|
+
}
|
|
138
|
+
var original = p, seenLinks = {}, knownHard = {};
|
|
139
|
+
var pos;
|
|
140
|
+
var current;
|
|
141
|
+
var base;
|
|
142
|
+
var previous;
|
|
143
|
+
start();
|
|
144
|
+
function start() {
|
|
145
|
+
var m = splitRootRe.exec(p);
|
|
146
|
+
pos = m[0].length;
|
|
147
|
+
current = m[0];
|
|
148
|
+
base = m[0];
|
|
149
|
+
previous = "";
|
|
150
|
+
if (isWindows && !knownHard[base]) {
|
|
151
|
+
fs.lstat(base, function(err) {
|
|
152
|
+
if (err)
|
|
153
|
+
return cb(err);
|
|
154
|
+
knownHard[base] = true;
|
|
155
|
+
LOOP();
|
|
156
|
+
});
|
|
157
|
+
} else {
|
|
158
|
+
process.nextTick(LOOP);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function LOOP() {
|
|
162
|
+
if (pos >= p.length) {
|
|
163
|
+
if (cache)
|
|
164
|
+
cache[original] = p;
|
|
165
|
+
return cb(null, p);
|
|
166
|
+
}
|
|
167
|
+
nextPartRe.lastIndex = pos;
|
|
168
|
+
var result = nextPartRe.exec(p);
|
|
169
|
+
previous = current;
|
|
170
|
+
current += result[0];
|
|
171
|
+
base = previous + result[1];
|
|
172
|
+
pos = nextPartRe.lastIndex;
|
|
173
|
+
if (knownHard[base] || cache && cache[base] === base) {
|
|
174
|
+
return process.nextTick(LOOP);
|
|
175
|
+
}
|
|
176
|
+
if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
|
|
177
|
+
return gotResolvedLink(cache[base]);
|
|
178
|
+
}
|
|
179
|
+
return fs.lstat(base, gotStat);
|
|
180
|
+
}
|
|
181
|
+
function gotStat(err, stat) {
|
|
182
|
+
if (err)
|
|
183
|
+
return cb(err);
|
|
184
|
+
if (!stat.isSymbolicLink()) {
|
|
185
|
+
knownHard[base] = true;
|
|
186
|
+
if (cache)
|
|
187
|
+
cache[base] = base;
|
|
188
|
+
return process.nextTick(LOOP);
|
|
189
|
+
}
|
|
190
|
+
if (!isWindows) {
|
|
191
|
+
var id = stat.dev.toString(32) + ":" + stat.ino.toString(32);
|
|
192
|
+
if (seenLinks.hasOwnProperty(id)) {
|
|
193
|
+
return gotTarget(null, seenLinks[id], base);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
fs.stat(base, function(err2) {
|
|
197
|
+
if (err2)
|
|
198
|
+
return cb(err2);
|
|
199
|
+
fs.readlink(base, function(err3, target) {
|
|
200
|
+
if (!isWindows)
|
|
201
|
+
seenLinks[id] = target;
|
|
202
|
+
gotTarget(err3, target);
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
function gotTarget(err, target, base2) {
|
|
207
|
+
if (err)
|
|
208
|
+
return cb(err);
|
|
209
|
+
var resolvedLink = pathModule.resolve(previous, target);
|
|
210
|
+
if (cache)
|
|
211
|
+
cache[base2] = resolvedLink;
|
|
212
|
+
gotResolvedLink(resolvedLink);
|
|
213
|
+
}
|
|
214
|
+
function gotResolvedLink(resolvedLink) {
|
|
215
|
+
p = pathModule.resolve(resolvedLink, p.slice(pos));
|
|
216
|
+
start();
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
// node_modules/fs.realpath/index.js
|
|
223
|
+
var require_fs = __commonJS({
|
|
224
|
+
"node_modules/fs.realpath/index.js"(exports, module) {
|
|
225
|
+
init_cjs_shims();
|
|
226
|
+
module.exports = realpath;
|
|
227
|
+
realpath.realpath = realpath;
|
|
228
|
+
realpath.sync = realpathSync;
|
|
229
|
+
realpath.realpathSync = realpathSync;
|
|
230
|
+
realpath.monkeypatch = monkeypatch;
|
|
231
|
+
realpath.unmonkeypatch = unmonkeypatch;
|
|
232
|
+
var fs = __require("fs");
|
|
233
|
+
var origRealpath = fs.realpath;
|
|
234
|
+
var origRealpathSync = fs.realpathSync;
|
|
235
|
+
var version = process.version;
|
|
236
|
+
var ok = /^v[0-5]\./.test(version);
|
|
237
|
+
var old = require_old();
|
|
238
|
+
function newError(er) {
|
|
239
|
+
return er && er.syscall === "realpath" && (er.code === "ELOOP" || er.code === "ENOMEM" || er.code === "ENAMETOOLONG");
|
|
240
|
+
}
|
|
241
|
+
function realpath(p, cache, cb) {
|
|
242
|
+
if (ok) {
|
|
243
|
+
return origRealpath(p, cache, cb);
|
|
244
|
+
}
|
|
245
|
+
if (typeof cache === "function") {
|
|
246
|
+
cb = cache;
|
|
247
|
+
cache = null;
|
|
248
|
+
}
|
|
249
|
+
origRealpath(p, cache, function(er, result) {
|
|
250
|
+
if (newError(er)) {
|
|
251
|
+
old.realpath(p, cache, cb);
|
|
252
|
+
} else {
|
|
253
|
+
cb(er, result);
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
function realpathSync(p, cache) {
|
|
258
|
+
if (ok) {
|
|
259
|
+
return origRealpathSync(p, cache);
|
|
260
|
+
}
|
|
261
|
+
try {
|
|
262
|
+
return origRealpathSync(p, cache);
|
|
263
|
+
} catch (er) {
|
|
264
|
+
if (newError(er)) {
|
|
265
|
+
return old.realpathSync(p, cache);
|
|
266
|
+
} else {
|
|
267
|
+
throw er;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
function monkeypatch() {
|
|
272
|
+
fs.realpath = realpath;
|
|
273
|
+
fs.realpathSync = realpathSync;
|
|
274
|
+
}
|
|
275
|
+
function unmonkeypatch() {
|
|
276
|
+
fs.realpath = origRealpath;
|
|
277
|
+
fs.realpathSync = origRealpathSync;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
// node_modules/concat-map/index.js
|
|
283
|
+
var require_concat_map = __commonJS({
|
|
284
|
+
"node_modules/concat-map/index.js"(exports, module) {
|
|
285
|
+
init_cjs_shims();
|
|
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))
|
|
291
|
+
res.push.apply(res, x);
|
|
292
|
+
else
|
|
293
|
+
res.push(x);
|
|
294
|
+
}
|
|
295
|
+
return res;
|
|
296
|
+
};
|
|
297
|
+
var isArray = Array.isArray || function(xs) {
|
|
298
|
+
return Object.prototype.toString.call(xs) === "[object Array]";
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
// node_modules/balanced-match/index.js
|
|
304
|
+
var require_balanced_match = __commonJS({
|
|
305
|
+
"node_modules/balanced-match/index.js"(exports, module) {
|
|
306
|
+
"use strict";
|
|
307
|
+
init_cjs_shims();
|
|
308
|
+
module.exports = balanced;
|
|
309
|
+
function balanced(a, b, str) {
|
|
310
|
+
if (a instanceof RegExp)
|
|
311
|
+
a = maybeMatch(a, str);
|
|
312
|
+
if (b instanceof RegExp)
|
|
313
|
+
b = maybeMatch(b, str);
|
|
314
|
+
var r = range(a, b, str);
|
|
315
|
+
return r && {
|
|
316
|
+
start: r[0],
|
|
317
|
+
end: r[1],
|
|
318
|
+
pre: str.slice(0, r[0]),
|
|
319
|
+
body: str.slice(r[0] + a.length, r[1]),
|
|
320
|
+
post: str.slice(r[1] + b.length)
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
function maybeMatch(reg, str) {
|
|
324
|
+
var m = str.match(reg);
|
|
325
|
+
return m ? m[0] : null;
|
|
326
|
+
}
|
|
327
|
+
balanced.range = range;
|
|
328
|
+
function range(a, b, str) {
|
|
329
|
+
var begs, beg, left, right, result;
|
|
330
|
+
var ai = str.indexOf(a);
|
|
331
|
+
var bi = str.indexOf(b, ai + 1);
|
|
332
|
+
var i = ai;
|
|
333
|
+
if (ai >= 0 && bi > 0) {
|
|
334
|
+
if (a === b) {
|
|
335
|
+
return [ai, bi];
|
|
336
|
+
}
|
|
337
|
+
begs = [];
|
|
338
|
+
left = str.length;
|
|
339
|
+
while (i >= 0 && !result) {
|
|
340
|
+
if (i == ai) {
|
|
341
|
+
begs.push(i);
|
|
342
|
+
ai = str.indexOf(a, i + 1);
|
|
343
|
+
} else if (begs.length == 1) {
|
|
344
|
+
result = [begs.pop(), bi];
|
|
345
|
+
} else {
|
|
346
|
+
beg = begs.pop();
|
|
347
|
+
if (beg < left) {
|
|
348
|
+
left = beg;
|
|
349
|
+
right = bi;
|
|
350
|
+
}
|
|
351
|
+
bi = str.indexOf(b, i + 1);
|
|
352
|
+
}
|
|
353
|
+
i = ai < bi && ai >= 0 ? ai : bi;
|
|
354
|
+
}
|
|
355
|
+
if (begs.length) {
|
|
356
|
+
result = [left, right];
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
return result;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
// node_modules/minimatch/node_modules/brace-expansion/index.js
|
|
365
|
+
var require_brace_expansion = __commonJS({
|
|
366
|
+
"node_modules/minimatch/node_modules/brace-expansion/index.js"(exports, module) {
|
|
367
|
+
init_cjs_shims();
|
|
368
|
+
var concatMap = require_concat_map();
|
|
369
|
+
var balanced = require_balanced_match();
|
|
370
|
+
module.exports = expandTop;
|
|
371
|
+
var escSlash = "\0SLASH" + Math.random() + "\0";
|
|
372
|
+
var escOpen = "\0OPEN" + Math.random() + "\0";
|
|
373
|
+
var escClose = "\0CLOSE" + Math.random() + "\0";
|
|
374
|
+
var escComma = "\0COMMA" + Math.random() + "\0";
|
|
375
|
+
var escPeriod = "\0PERIOD" + Math.random() + "\0";
|
|
376
|
+
function numeric(str) {
|
|
377
|
+
return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
|
|
378
|
+
}
|
|
379
|
+
function escapeBraces(str) {
|
|
380
|
+
return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
|
|
381
|
+
}
|
|
382
|
+
function unescapeBraces(str) {
|
|
383
|
+
return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
|
|
384
|
+
}
|
|
385
|
+
function parseCommaParts(str) {
|
|
386
|
+
if (!str)
|
|
387
|
+
return [""];
|
|
388
|
+
var parts = [];
|
|
389
|
+
var m = balanced("{", "}", str);
|
|
390
|
+
if (!m)
|
|
391
|
+
return str.split(",");
|
|
392
|
+
var pre = m.pre;
|
|
393
|
+
var body = m.body;
|
|
394
|
+
var post = m.post;
|
|
395
|
+
var p = pre.split(",");
|
|
396
|
+
p[p.length - 1] += "{" + body + "}";
|
|
397
|
+
var postParts = parseCommaParts(post);
|
|
398
|
+
if (post.length) {
|
|
399
|
+
p[p.length - 1] += postParts.shift();
|
|
400
|
+
p.push.apply(p, postParts);
|
|
401
|
+
}
|
|
402
|
+
parts.push.apply(parts, p);
|
|
403
|
+
return parts;
|
|
404
|
+
}
|
|
405
|
+
function expandTop(str) {
|
|
406
|
+
if (!str)
|
|
407
|
+
return [];
|
|
408
|
+
if (str.substr(0, 2) === "{}") {
|
|
409
|
+
str = "\\{\\}" + str.substr(2);
|
|
410
|
+
}
|
|
411
|
+
return expand(escapeBraces(str), true).map(unescapeBraces);
|
|
412
|
+
}
|
|
413
|
+
function embrace(str) {
|
|
414
|
+
return "{" + str + "}";
|
|
415
|
+
}
|
|
416
|
+
function isPadded(el) {
|
|
417
|
+
return /^-?0\d/.test(el);
|
|
418
|
+
}
|
|
419
|
+
function lte(i, y) {
|
|
420
|
+
return i <= y;
|
|
421
|
+
}
|
|
422
|
+
function gte(i, y) {
|
|
423
|
+
return i >= y;
|
|
424
|
+
}
|
|
425
|
+
function expand(str, isTop) {
|
|
426
|
+
var expansions = [];
|
|
427
|
+
var m = balanced("{", "}", str);
|
|
428
|
+
if (!m || /\$$/.test(m.pre))
|
|
429
|
+
return [str];
|
|
430
|
+
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
431
|
+
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
432
|
+
var isSequence = isNumericSequence || isAlphaSequence;
|
|
433
|
+
var isOptions = m.body.indexOf(",") >= 0;
|
|
434
|
+
if (!isSequence && !isOptions) {
|
|
435
|
+
if (m.post.match(/,.*\}/)) {
|
|
436
|
+
str = m.pre + "{" + m.body + escClose + m.post;
|
|
437
|
+
return expand(str);
|
|
438
|
+
}
|
|
439
|
+
return [str];
|
|
440
|
+
}
|
|
441
|
+
var n;
|
|
442
|
+
if (isSequence) {
|
|
443
|
+
n = m.body.split(/\.\./);
|
|
444
|
+
} else {
|
|
445
|
+
n = parseCommaParts(m.body);
|
|
446
|
+
if (n.length === 1) {
|
|
447
|
+
n = expand(n[0], false).map(embrace);
|
|
448
|
+
if (n.length === 1) {
|
|
449
|
+
var post = m.post.length ? expand(m.post, false) : [""];
|
|
450
|
+
return post.map(function(p) {
|
|
451
|
+
return m.pre + n[0] + p;
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
var pre = m.pre;
|
|
457
|
+
var post = m.post.length ? expand(m.post, false) : [""];
|
|
458
|
+
var N;
|
|
459
|
+
if (isSequence) {
|
|
460
|
+
var x = numeric(n[0]);
|
|
461
|
+
var y = numeric(n[1]);
|
|
462
|
+
var width = Math.max(n[0].length, n[1].length);
|
|
463
|
+
var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
|
|
464
|
+
var test = lte;
|
|
465
|
+
var reverse = y < x;
|
|
466
|
+
if (reverse) {
|
|
467
|
+
incr *= -1;
|
|
468
|
+
test = gte;
|
|
469
|
+
}
|
|
470
|
+
var pad = n.some(isPadded);
|
|
471
|
+
N = [];
|
|
472
|
+
for (var i = x; test(i, y); i += incr) {
|
|
473
|
+
var c;
|
|
474
|
+
if (isAlphaSequence) {
|
|
475
|
+
c = String.fromCharCode(i);
|
|
476
|
+
if (c === "\\")
|
|
477
|
+
c = "";
|
|
478
|
+
} else {
|
|
479
|
+
c = String(i);
|
|
480
|
+
if (pad) {
|
|
481
|
+
var need = width - c.length;
|
|
482
|
+
if (need > 0) {
|
|
483
|
+
var z = new Array(need + 1).join("0");
|
|
484
|
+
if (i < 0)
|
|
485
|
+
c = "-" + z + c.slice(1);
|
|
486
|
+
else
|
|
487
|
+
c = z + c;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
N.push(c);
|
|
492
|
+
}
|
|
493
|
+
} else {
|
|
494
|
+
N = concatMap(n, function(el) {
|
|
495
|
+
return expand(el, false);
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
for (var j = 0; j < N.length; j++) {
|
|
499
|
+
for (var k = 0; k < post.length; k++) {
|
|
500
|
+
var expansion = pre + N[j] + post[k];
|
|
501
|
+
if (!isTop || isSequence || expansion)
|
|
502
|
+
expansions.push(expansion);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
return expansions;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
// node_modules/minimatch/minimatch.js
|
|
511
|
+
var require_minimatch = __commonJS({
|
|
512
|
+
"node_modules/minimatch/minimatch.js"(exports, module) {
|
|
513
|
+
init_cjs_shims();
|
|
514
|
+
module.exports = minimatch;
|
|
515
|
+
minimatch.Minimatch = Minimatch;
|
|
516
|
+
var path = function() {
|
|
517
|
+
try {
|
|
518
|
+
return __require("path");
|
|
519
|
+
} catch (e) {
|
|
520
|
+
}
|
|
521
|
+
}() || {
|
|
522
|
+
sep: "/"
|
|
523
|
+
};
|
|
524
|
+
minimatch.sep = path.sep;
|
|
525
|
+
var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {};
|
|
526
|
+
var expand = require_brace_expansion();
|
|
527
|
+
var plTypes = {
|
|
528
|
+
"!": { open: "(?:(?!(?:", close: "))[^/]*?)" },
|
|
529
|
+
"?": { open: "(?:", close: ")?" },
|
|
530
|
+
"+": { open: "(?:", close: ")+" },
|
|
531
|
+
"*": { open: "(?:", close: ")*" },
|
|
532
|
+
"@": { open: "(?:", close: ")" }
|
|
533
|
+
};
|
|
534
|
+
var qmark = "[^/]";
|
|
535
|
+
var star = qmark + "*?";
|
|
536
|
+
var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
|
|
537
|
+
var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
|
|
538
|
+
var reSpecials = charSet("().*{}+?[]^$\\!");
|
|
539
|
+
function charSet(s) {
|
|
540
|
+
return s.split("").reduce(function(set, c) {
|
|
541
|
+
set[c] = true;
|
|
542
|
+
return set;
|
|
543
|
+
}, {});
|
|
544
|
+
}
|
|
545
|
+
var slashSplit = /\/+/;
|
|
546
|
+
minimatch.filter = filter;
|
|
547
|
+
function filter(pattern, options) {
|
|
548
|
+
options = options || {};
|
|
549
|
+
return function(p, i, list) {
|
|
550
|
+
return minimatch(p, pattern, options);
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
function ext(a, b) {
|
|
554
|
+
b = b || {};
|
|
555
|
+
var t = {};
|
|
556
|
+
Object.keys(a).forEach(function(k) {
|
|
557
|
+
t[k] = a[k];
|
|
558
|
+
});
|
|
559
|
+
Object.keys(b).forEach(function(k) {
|
|
560
|
+
t[k] = b[k];
|
|
561
|
+
});
|
|
562
|
+
return t;
|
|
563
|
+
}
|
|
564
|
+
minimatch.defaults = function(def) {
|
|
565
|
+
if (!def || typeof def !== "object" || !Object.keys(def).length) {
|
|
566
|
+
return minimatch;
|
|
567
|
+
}
|
|
568
|
+
var orig = minimatch;
|
|
569
|
+
var m = function minimatch2(p, pattern, options) {
|
|
570
|
+
return orig(p, pattern, ext(def, options));
|
|
571
|
+
};
|
|
572
|
+
m.Minimatch = function Minimatch2(pattern, options) {
|
|
573
|
+
return new orig.Minimatch(pattern, ext(def, options));
|
|
574
|
+
};
|
|
575
|
+
m.Minimatch.defaults = function defaults(options) {
|
|
576
|
+
return orig.defaults(ext(def, options)).Minimatch;
|
|
577
|
+
};
|
|
578
|
+
m.filter = function filter2(pattern, options) {
|
|
579
|
+
return orig.filter(pattern, ext(def, options));
|
|
580
|
+
};
|
|
581
|
+
m.defaults = function defaults(options) {
|
|
582
|
+
return orig.defaults(ext(def, options));
|
|
583
|
+
};
|
|
584
|
+
m.makeRe = function makeRe2(pattern, options) {
|
|
585
|
+
return orig.makeRe(pattern, ext(def, options));
|
|
586
|
+
};
|
|
587
|
+
m.braceExpand = function braceExpand2(pattern, options) {
|
|
588
|
+
return orig.braceExpand(pattern, ext(def, options));
|
|
589
|
+
};
|
|
590
|
+
m.match = function(list, pattern, options) {
|
|
591
|
+
return orig.match(list, pattern, ext(def, options));
|
|
592
|
+
};
|
|
593
|
+
return m;
|
|
594
|
+
};
|
|
595
|
+
Minimatch.defaults = function(def) {
|
|
596
|
+
return minimatch.defaults(def).Minimatch;
|
|
597
|
+
};
|
|
598
|
+
function minimatch(p, pattern, options) {
|
|
599
|
+
assertValidPattern(pattern);
|
|
600
|
+
if (!options)
|
|
601
|
+
options = {};
|
|
602
|
+
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
603
|
+
return false;
|
|
604
|
+
}
|
|
605
|
+
return new Minimatch(pattern, options).match(p);
|
|
606
|
+
}
|
|
607
|
+
function Minimatch(pattern, options) {
|
|
608
|
+
if (!(this instanceof Minimatch)) {
|
|
609
|
+
return new Minimatch(pattern, options);
|
|
610
|
+
}
|
|
611
|
+
assertValidPattern(pattern);
|
|
612
|
+
if (!options)
|
|
613
|
+
options = {};
|
|
614
|
+
pattern = pattern.trim();
|
|
615
|
+
if (!options.allowWindowsEscape && path.sep !== "/") {
|
|
616
|
+
pattern = pattern.split(path.sep).join("/");
|
|
617
|
+
}
|
|
618
|
+
this.options = options;
|
|
619
|
+
this.set = [];
|
|
620
|
+
this.pattern = pattern;
|
|
621
|
+
this.regexp = null;
|
|
622
|
+
this.negate = false;
|
|
623
|
+
this.comment = false;
|
|
624
|
+
this.empty = false;
|
|
625
|
+
this.partial = !!options.partial;
|
|
626
|
+
this.make();
|
|
627
|
+
}
|
|
628
|
+
Minimatch.prototype.debug = function() {
|
|
629
|
+
};
|
|
630
|
+
Minimatch.prototype.make = make;
|
|
631
|
+
function make() {
|
|
632
|
+
var pattern = this.pattern;
|
|
633
|
+
var options = this.options;
|
|
634
|
+
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
635
|
+
this.comment = true;
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
if (!pattern) {
|
|
639
|
+
this.empty = true;
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
this.parseNegate();
|
|
643
|
+
var set = this.globSet = this.braceExpand();
|
|
644
|
+
if (options.debug)
|
|
645
|
+
this.debug = function debug() {
|
|
646
|
+
console.error.apply(console, arguments);
|
|
647
|
+
};
|
|
648
|
+
this.debug(this.pattern, set);
|
|
649
|
+
set = this.globParts = set.map(function(s) {
|
|
650
|
+
return s.split(slashSplit);
|
|
651
|
+
});
|
|
652
|
+
this.debug(this.pattern, set);
|
|
653
|
+
set = set.map(function(s, si, set2) {
|
|
654
|
+
return s.map(this.parse, this);
|
|
655
|
+
}, this);
|
|
656
|
+
this.debug(this.pattern, set);
|
|
657
|
+
set = set.filter(function(s) {
|
|
658
|
+
return s.indexOf(false) === -1;
|
|
659
|
+
});
|
|
660
|
+
this.debug(this.pattern, set);
|
|
661
|
+
this.set = set;
|
|
662
|
+
}
|
|
663
|
+
Minimatch.prototype.parseNegate = parseNegate;
|
|
664
|
+
function parseNegate() {
|
|
665
|
+
var pattern = this.pattern;
|
|
666
|
+
var negate = false;
|
|
667
|
+
var options = this.options;
|
|
668
|
+
var negateOffset = 0;
|
|
669
|
+
if (options.nonegate)
|
|
670
|
+
return;
|
|
671
|
+
for (var i = 0, l = pattern.length; i < l && pattern.charAt(i) === "!"; i++) {
|
|
672
|
+
negate = !negate;
|
|
673
|
+
negateOffset++;
|
|
674
|
+
}
|
|
675
|
+
if (negateOffset)
|
|
676
|
+
this.pattern = pattern.substr(negateOffset);
|
|
677
|
+
this.negate = negate;
|
|
678
|
+
}
|
|
679
|
+
minimatch.braceExpand = function(pattern, options) {
|
|
680
|
+
return braceExpand(pattern, options);
|
|
681
|
+
};
|
|
682
|
+
Minimatch.prototype.braceExpand = braceExpand;
|
|
683
|
+
function braceExpand(pattern, options) {
|
|
684
|
+
if (!options) {
|
|
685
|
+
if (this instanceof Minimatch) {
|
|
686
|
+
options = this.options;
|
|
687
|
+
} else {
|
|
688
|
+
options = {};
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
pattern = typeof pattern === "undefined" ? this.pattern : pattern;
|
|
692
|
+
assertValidPattern(pattern);
|
|
693
|
+
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
|
|
694
|
+
return [pattern];
|
|
695
|
+
}
|
|
696
|
+
return expand(pattern);
|
|
697
|
+
}
|
|
698
|
+
var MAX_PATTERN_LENGTH = 1024 * 64;
|
|
699
|
+
var assertValidPattern = function(pattern) {
|
|
700
|
+
if (typeof pattern !== "string") {
|
|
701
|
+
throw new TypeError("invalid pattern");
|
|
702
|
+
}
|
|
703
|
+
if (pattern.length > MAX_PATTERN_LENGTH) {
|
|
704
|
+
throw new TypeError("pattern is too long");
|
|
705
|
+
}
|
|
706
|
+
};
|
|
707
|
+
Minimatch.prototype.parse = parse;
|
|
708
|
+
var SUBPARSE = {};
|
|
709
|
+
function parse(pattern, isSub) {
|
|
710
|
+
assertValidPattern(pattern);
|
|
711
|
+
var options = this.options;
|
|
712
|
+
if (pattern === "**") {
|
|
713
|
+
if (!options.noglobstar)
|
|
714
|
+
return GLOBSTAR;
|
|
715
|
+
else
|
|
716
|
+
pattern = "*";
|
|
717
|
+
}
|
|
718
|
+
if (pattern === "")
|
|
719
|
+
return "";
|
|
720
|
+
var re = "";
|
|
721
|
+
var hasMagic = !!options.nocase;
|
|
722
|
+
var escaping = false;
|
|
723
|
+
var patternListStack = [];
|
|
724
|
+
var negativeLists = [];
|
|
725
|
+
var stateChar;
|
|
726
|
+
var inClass = false;
|
|
727
|
+
var reClassStart = -1;
|
|
728
|
+
var classStart = -1;
|
|
729
|
+
var patternStart = pattern.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
|
|
730
|
+
var self = this;
|
|
731
|
+
function clearStateChar() {
|
|
732
|
+
if (stateChar) {
|
|
733
|
+
switch (stateChar) {
|
|
734
|
+
case "*":
|
|
735
|
+
re += star;
|
|
736
|
+
hasMagic = true;
|
|
737
|
+
break;
|
|
738
|
+
case "?":
|
|
739
|
+
re += qmark;
|
|
740
|
+
hasMagic = true;
|
|
741
|
+
break;
|
|
742
|
+
default:
|
|
743
|
+
re += "\\" + stateChar;
|
|
744
|
+
break;
|
|
745
|
+
}
|
|
746
|
+
self.debug("clearStateChar %j %j", stateChar, re);
|
|
747
|
+
stateChar = false;
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
for (var i = 0, len = pattern.length, c; i < len && (c = pattern.charAt(i)); i++) {
|
|
751
|
+
this.debug("%s %s %s %j", pattern, i, re, c);
|
|
752
|
+
if (escaping && reSpecials[c]) {
|
|
753
|
+
re += "\\" + c;
|
|
754
|
+
escaping = false;
|
|
755
|
+
continue;
|
|
756
|
+
}
|
|
757
|
+
switch (c) {
|
|
758
|
+
case "/": {
|
|
759
|
+
return false;
|
|
760
|
+
}
|
|
761
|
+
case "\\":
|
|
762
|
+
clearStateChar();
|
|
763
|
+
escaping = true;
|
|
764
|
+
continue;
|
|
765
|
+
case "?":
|
|
766
|
+
case "*":
|
|
767
|
+
case "+":
|
|
768
|
+
case "@":
|
|
769
|
+
case "!":
|
|
770
|
+
this.debug("%s %s %s %j <-- stateChar", pattern, i, re, c);
|
|
771
|
+
if (inClass) {
|
|
772
|
+
this.debug(" in class");
|
|
773
|
+
if (c === "!" && i === classStart + 1)
|
|
774
|
+
c = "^";
|
|
775
|
+
re += c;
|
|
776
|
+
continue;
|
|
777
|
+
}
|
|
778
|
+
self.debug("call clearStateChar %j", stateChar);
|
|
779
|
+
clearStateChar();
|
|
780
|
+
stateChar = c;
|
|
781
|
+
if (options.noext)
|
|
782
|
+
clearStateChar();
|
|
783
|
+
continue;
|
|
784
|
+
case "(":
|
|
785
|
+
if (inClass) {
|
|
786
|
+
re += "(";
|
|
787
|
+
continue;
|
|
788
|
+
}
|
|
789
|
+
if (!stateChar) {
|
|
790
|
+
re += "\\(";
|
|
791
|
+
continue;
|
|
792
|
+
}
|
|
793
|
+
patternListStack.push({
|
|
794
|
+
type: stateChar,
|
|
795
|
+
start: i - 1,
|
|
796
|
+
reStart: re.length,
|
|
797
|
+
open: plTypes[stateChar].open,
|
|
798
|
+
close: plTypes[stateChar].close
|
|
799
|
+
});
|
|
800
|
+
re += stateChar === "!" ? "(?:(?!(?:" : "(?:";
|
|
801
|
+
this.debug("plType %j %j", stateChar, re);
|
|
802
|
+
stateChar = false;
|
|
803
|
+
continue;
|
|
804
|
+
case ")":
|
|
805
|
+
if (inClass || !patternListStack.length) {
|
|
806
|
+
re += "\\)";
|
|
807
|
+
continue;
|
|
808
|
+
}
|
|
809
|
+
clearStateChar();
|
|
810
|
+
hasMagic = true;
|
|
811
|
+
var pl = patternListStack.pop();
|
|
812
|
+
re += pl.close;
|
|
813
|
+
if (pl.type === "!") {
|
|
814
|
+
negativeLists.push(pl);
|
|
815
|
+
}
|
|
816
|
+
pl.reEnd = re.length;
|
|
817
|
+
continue;
|
|
818
|
+
case "|":
|
|
819
|
+
if (inClass || !patternListStack.length || escaping) {
|
|
820
|
+
re += "\\|";
|
|
821
|
+
escaping = false;
|
|
822
|
+
continue;
|
|
823
|
+
}
|
|
824
|
+
clearStateChar();
|
|
825
|
+
re += "|";
|
|
826
|
+
continue;
|
|
827
|
+
case "[":
|
|
828
|
+
clearStateChar();
|
|
829
|
+
if (inClass) {
|
|
830
|
+
re += "\\" + c;
|
|
831
|
+
continue;
|
|
832
|
+
}
|
|
833
|
+
inClass = true;
|
|
834
|
+
classStart = i;
|
|
835
|
+
reClassStart = re.length;
|
|
836
|
+
re += c;
|
|
837
|
+
continue;
|
|
838
|
+
case "]":
|
|
839
|
+
if (i === classStart + 1 || !inClass) {
|
|
840
|
+
re += "\\" + c;
|
|
841
|
+
escaping = false;
|
|
842
|
+
continue;
|
|
843
|
+
}
|
|
844
|
+
var cs = pattern.substring(classStart + 1, i);
|
|
845
|
+
try {
|
|
846
|
+
RegExp("[" + cs + "]");
|
|
847
|
+
} catch (er) {
|
|
848
|
+
var sp = this.parse(cs, SUBPARSE);
|
|
849
|
+
re = re.substr(0, reClassStart) + "\\[" + sp[0] + "\\]";
|
|
850
|
+
hasMagic = hasMagic || sp[1];
|
|
851
|
+
inClass = false;
|
|
852
|
+
continue;
|
|
853
|
+
}
|
|
854
|
+
hasMagic = true;
|
|
855
|
+
inClass = false;
|
|
856
|
+
re += c;
|
|
857
|
+
continue;
|
|
858
|
+
default:
|
|
859
|
+
clearStateChar();
|
|
860
|
+
if (escaping) {
|
|
861
|
+
escaping = false;
|
|
862
|
+
} else if (reSpecials[c] && !(c === "^" && inClass)) {
|
|
863
|
+
re += "\\";
|
|
864
|
+
}
|
|
865
|
+
re += c;
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
if (inClass) {
|
|
869
|
+
cs = pattern.substr(classStart + 1);
|
|
870
|
+
sp = this.parse(cs, SUBPARSE);
|
|
871
|
+
re = re.substr(0, reClassStart) + "\\[" + sp[0];
|
|
872
|
+
hasMagic = hasMagic || sp[1];
|
|
873
|
+
}
|
|
874
|
+
for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
|
|
875
|
+
var tail = re.slice(pl.reStart + pl.open.length);
|
|
876
|
+
this.debug("setting tail", re, pl);
|
|
877
|
+
tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function(_, $1, $2) {
|
|
878
|
+
if (!$2) {
|
|
879
|
+
$2 = "\\";
|
|
880
|
+
}
|
|
881
|
+
return $1 + $1 + $2 + "|";
|
|
882
|
+
});
|
|
883
|
+
this.debug("tail=%j\n %s", tail, tail, pl, re);
|
|
884
|
+
var t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
|
|
885
|
+
hasMagic = true;
|
|
886
|
+
re = re.slice(0, pl.reStart) + t + "\\(" + tail;
|
|
887
|
+
}
|
|
888
|
+
clearStateChar();
|
|
889
|
+
if (escaping) {
|
|
890
|
+
re += "\\\\";
|
|
891
|
+
}
|
|
892
|
+
var addPatternStart = false;
|
|
893
|
+
switch (re.charAt(0)) {
|
|
894
|
+
case "[":
|
|
895
|
+
case ".":
|
|
896
|
+
case "(":
|
|
897
|
+
addPatternStart = true;
|
|
898
|
+
}
|
|
899
|
+
for (var n = negativeLists.length - 1; n > -1; n--) {
|
|
900
|
+
var nl = negativeLists[n];
|
|
901
|
+
var nlBefore = re.slice(0, nl.reStart);
|
|
902
|
+
var nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
|
|
903
|
+
var nlLast = re.slice(nl.reEnd - 8, nl.reEnd);
|
|
904
|
+
var nlAfter = re.slice(nl.reEnd);
|
|
905
|
+
nlLast += nlAfter;
|
|
906
|
+
var openParensBefore = nlBefore.split("(").length - 1;
|
|
907
|
+
var cleanAfter = nlAfter;
|
|
908
|
+
for (i = 0; i < openParensBefore; i++) {
|
|
909
|
+
cleanAfter = cleanAfter.replace(/\)[+*?]?/, "");
|
|
910
|
+
}
|
|
911
|
+
nlAfter = cleanAfter;
|
|
912
|
+
var dollar = "";
|
|
913
|
+
if (nlAfter === "" && isSub !== SUBPARSE) {
|
|
914
|
+
dollar = "$";
|
|
915
|
+
}
|
|
916
|
+
var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast;
|
|
917
|
+
re = newRe;
|
|
918
|
+
}
|
|
919
|
+
if (re !== "" && hasMagic) {
|
|
920
|
+
re = "(?=.)" + re;
|
|
921
|
+
}
|
|
922
|
+
if (addPatternStart) {
|
|
923
|
+
re = patternStart + re;
|
|
924
|
+
}
|
|
925
|
+
if (isSub === SUBPARSE) {
|
|
926
|
+
return [re, hasMagic];
|
|
927
|
+
}
|
|
928
|
+
if (!hasMagic) {
|
|
929
|
+
return globUnescape(pattern);
|
|
930
|
+
}
|
|
931
|
+
var flags = options.nocase ? "i" : "";
|
|
932
|
+
try {
|
|
933
|
+
var regExp = new RegExp("^" + re + "$", flags);
|
|
934
|
+
} catch (er) {
|
|
935
|
+
return new RegExp("$.");
|
|
936
|
+
}
|
|
937
|
+
regExp._glob = pattern;
|
|
938
|
+
regExp._src = re;
|
|
939
|
+
return regExp;
|
|
940
|
+
}
|
|
941
|
+
minimatch.makeRe = function(pattern, options) {
|
|
942
|
+
return new Minimatch(pattern, options || {}).makeRe();
|
|
943
|
+
};
|
|
944
|
+
Minimatch.prototype.makeRe = makeRe;
|
|
945
|
+
function makeRe() {
|
|
946
|
+
if (this.regexp || this.regexp === false)
|
|
947
|
+
return this.regexp;
|
|
948
|
+
var set = this.set;
|
|
949
|
+
if (!set.length) {
|
|
950
|
+
this.regexp = false;
|
|
951
|
+
return this.regexp;
|
|
952
|
+
}
|
|
953
|
+
var options = this.options;
|
|
954
|
+
var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
|
|
955
|
+
var flags = options.nocase ? "i" : "";
|
|
956
|
+
var re = set.map(function(pattern) {
|
|
957
|
+
return pattern.map(function(p) {
|
|
958
|
+
return p === GLOBSTAR ? twoStar : typeof p === "string" ? regExpEscape(p) : p._src;
|
|
959
|
+
}).join("\\/");
|
|
960
|
+
}).join("|");
|
|
961
|
+
re = "^(?:" + re + ")$";
|
|
962
|
+
if (this.negate)
|
|
963
|
+
re = "^(?!" + re + ").*$";
|
|
964
|
+
try {
|
|
965
|
+
this.regexp = new RegExp(re, flags);
|
|
966
|
+
} catch (ex) {
|
|
967
|
+
this.regexp = false;
|
|
968
|
+
}
|
|
969
|
+
return this.regexp;
|
|
970
|
+
}
|
|
971
|
+
minimatch.match = function(list, pattern, options) {
|
|
972
|
+
options = options || {};
|
|
973
|
+
var mm = new Minimatch(pattern, options);
|
|
974
|
+
list = list.filter(function(f) {
|
|
975
|
+
return mm.match(f);
|
|
976
|
+
});
|
|
977
|
+
if (mm.options.nonull && !list.length) {
|
|
978
|
+
list.push(pattern);
|
|
979
|
+
}
|
|
980
|
+
return list;
|
|
981
|
+
};
|
|
982
|
+
Minimatch.prototype.match = function match(f, partial) {
|
|
983
|
+
if (typeof partial === "undefined")
|
|
984
|
+
partial = this.partial;
|
|
985
|
+
this.debug("match", f, this.pattern);
|
|
986
|
+
if (this.comment)
|
|
987
|
+
return false;
|
|
988
|
+
if (this.empty)
|
|
989
|
+
return f === "";
|
|
990
|
+
if (f === "/" && partial)
|
|
991
|
+
return true;
|
|
992
|
+
var options = this.options;
|
|
993
|
+
if (path.sep !== "/") {
|
|
994
|
+
f = f.split(path.sep).join("/");
|
|
995
|
+
}
|
|
996
|
+
f = f.split(slashSplit);
|
|
997
|
+
this.debug(this.pattern, "split", f);
|
|
998
|
+
var set = this.set;
|
|
999
|
+
this.debug(this.pattern, "set", set);
|
|
1000
|
+
var filename;
|
|
1001
|
+
var i;
|
|
1002
|
+
for (i = f.length - 1; i >= 0; i--) {
|
|
1003
|
+
filename = f[i];
|
|
1004
|
+
if (filename)
|
|
1005
|
+
break;
|
|
1006
|
+
}
|
|
1007
|
+
for (i = 0; i < set.length; i++) {
|
|
1008
|
+
var pattern = set[i];
|
|
1009
|
+
var file = f;
|
|
1010
|
+
if (options.matchBase && pattern.length === 1) {
|
|
1011
|
+
file = [filename];
|
|
1012
|
+
}
|
|
1013
|
+
var hit = this.matchOne(file, pattern, partial);
|
|
1014
|
+
if (hit) {
|
|
1015
|
+
if (options.flipNegate)
|
|
1016
|
+
return true;
|
|
1017
|
+
return !this.negate;
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
if (options.flipNegate)
|
|
1021
|
+
return false;
|
|
1022
|
+
return this.negate;
|
|
1023
|
+
};
|
|
1024
|
+
Minimatch.prototype.matchOne = function(file, pattern, partial) {
|
|
1025
|
+
var options = this.options;
|
|
1026
|
+
this.debug(
|
|
1027
|
+
"matchOne",
|
|
1028
|
+
{ "this": this, file, pattern }
|
|
1029
|
+
);
|
|
1030
|
+
this.debug("matchOne", file.length, pattern.length);
|
|
1031
|
+
for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
|
1032
|
+
this.debug("matchOne loop");
|
|
1033
|
+
var p = pattern[pi];
|
|
1034
|
+
var f = file[fi];
|
|
1035
|
+
this.debug(pattern, p, f);
|
|
1036
|
+
if (p === false)
|
|
1037
|
+
return false;
|
|
1038
|
+
if (p === GLOBSTAR) {
|
|
1039
|
+
this.debug("GLOBSTAR", [pattern, p, f]);
|
|
1040
|
+
var fr = fi;
|
|
1041
|
+
var pr = pi + 1;
|
|
1042
|
+
if (pr === pl) {
|
|
1043
|
+
this.debug("** at the end");
|
|
1044
|
+
for (; fi < fl; fi++) {
|
|
1045
|
+
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
|
|
1046
|
+
return false;
|
|
1047
|
+
}
|
|
1048
|
+
return true;
|
|
1049
|
+
}
|
|
1050
|
+
while (fr < fl) {
|
|
1051
|
+
var swallowee = file[fr];
|
|
1052
|
+
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
|
1053
|
+
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
|
1054
|
+
this.debug("globstar found match!", fr, fl, swallowee);
|
|
1055
|
+
return true;
|
|
1056
|
+
} else {
|
|
1057
|
+
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
|
1058
|
+
this.debug("dot detected!", file, fr, pattern, pr);
|
|
1059
|
+
break;
|
|
1060
|
+
}
|
|
1061
|
+
this.debug("globstar swallow a segment, and continue");
|
|
1062
|
+
fr++;
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
if (partial) {
|
|
1066
|
+
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
|
1067
|
+
if (fr === fl)
|
|
1068
|
+
return true;
|
|
1069
|
+
}
|
|
1070
|
+
return false;
|
|
1071
|
+
}
|
|
1072
|
+
var hit;
|
|
1073
|
+
if (typeof p === "string") {
|
|
1074
|
+
hit = f === p;
|
|
1075
|
+
this.debug("string match", p, f, hit);
|
|
1076
|
+
} else {
|
|
1077
|
+
hit = f.match(p);
|
|
1078
|
+
this.debug("pattern match", p, f, hit);
|
|
1079
|
+
}
|
|
1080
|
+
if (!hit)
|
|
1081
|
+
return false;
|
|
1082
|
+
}
|
|
1083
|
+
if (fi === fl && pi === pl) {
|
|
1084
|
+
return true;
|
|
1085
|
+
} else if (fi === fl) {
|
|
1086
|
+
return partial;
|
|
1087
|
+
} else if (pi === pl) {
|
|
1088
|
+
return fi === fl - 1 && file[fi] === "";
|
|
1089
|
+
}
|
|
1090
|
+
throw new Error("wtf?");
|
|
1091
|
+
};
|
|
1092
|
+
function globUnescape(s) {
|
|
1093
|
+
return s.replace(/\\(.)/g, "$1");
|
|
1094
|
+
}
|
|
1095
|
+
function regExpEscape(s) {
|
|
1096
|
+
return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
});
|
|
1100
|
+
|
|
1101
|
+
// node_modules/inherits/inherits_browser.js
|
|
1102
|
+
var require_inherits_browser = __commonJS({
|
|
1103
|
+
"node_modules/inherits/inherits_browser.js"(exports, module) {
|
|
1104
|
+
init_cjs_shims();
|
|
1105
|
+
if (typeof Object.create === "function") {
|
|
1106
|
+
module.exports = function inherits(ctor, superCtor) {
|
|
1107
|
+
if (superCtor) {
|
|
1108
|
+
ctor.super_ = superCtor;
|
|
1109
|
+
ctor.prototype = Object.create(superCtor.prototype, {
|
|
1110
|
+
constructor: {
|
|
1111
|
+
value: ctor,
|
|
1112
|
+
enumerable: false,
|
|
1113
|
+
writable: true,
|
|
1114
|
+
configurable: true
|
|
1115
|
+
}
|
|
1116
|
+
});
|
|
1117
|
+
}
|
|
1118
|
+
};
|
|
1119
|
+
} else {
|
|
1120
|
+
module.exports = function inherits(ctor, superCtor) {
|
|
1121
|
+
if (superCtor) {
|
|
1122
|
+
ctor.super_ = superCtor;
|
|
1123
|
+
var TempCtor = function() {
|
|
1124
|
+
};
|
|
1125
|
+
TempCtor.prototype = superCtor.prototype;
|
|
1126
|
+
ctor.prototype = new TempCtor();
|
|
1127
|
+
ctor.prototype.constructor = ctor;
|
|
1128
|
+
}
|
|
1129
|
+
};
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
});
|
|
1133
|
+
|
|
1134
|
+
// node_modules/inherits/inherits.js
|
|
1135
|
+
var require_inherits = __commonJS({
|
|
1136
|
+
"node_modules/inherits/inherits.js"(exports, module) {
|
|
1137
|
+
init_cjs_shims();
|
|
1138
|
+
try {
|
|
1139
|
+
util = __require("util");
|
|
1140
|
+
if (typeof util.inherits !== "function")
|
|
1141
|
+
throw "";
|
|
1142
|
+
module.exports = util.inherits;
|
|
1143
|
+
} catch (e) {
|
|
1144
|
+
module.exports = require_inherits_browser();
|
|
1145
|
+
}
|
|
1146
|
+
var util;
|
|
1147
|
+
}
|
|
1148
|
+
});
|
|
1149
|
+
|
|
1150
|
+
// node_modules/path-is-absolute/index.js
|
|
1151
|
+
var require_path_is_absolute = __commonJS({
|
|
1152
|
+
"node_modules/path-is-absolute/index.js"(exports, module) {
|
|
1153
|
+
"use strict";
|
|
1154
|
+
init_cjs_shims();
|
|
1155
|
+
function posix(path) {
|
|
1156
|
+
return path.charAt(0) === "/";
|
|
1157
|
+
}
|
|
1158
|
+
function win32(path) {
|
|
1159
|
+
var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
|
|
1160
|
+
var result = splitDeviceRe.exec(path);
|
|
1161
|
+
var device = result[1] || "";
|
|
1162
|
+
var isUnc = Boolean(device && device.charAt(1) !== ":");
|
|
1163
|
+
return Boolean(result[2] || isUnc);
|
|
1164
|
+
}
|
|
1165
|
+
module.exports = process.platform === "win32" ? win32 : posix;
|
|
1166
|
+
module.exports.posix = posix;
|
|
1167
|
+
module.exports.win32 = win32;
|
|
1168
|
+
}
|
|
1169
|
+
});
|
|
1170
|
+
|
|
1171
|
+
// node_modules/glob/common.js
|
|
1172
|
+
var require_common = __commonJS({
|
|
1173
|
+
"node_modules/glob/common.js"(exports) {
|
|
1174
|
+
init_cjs_shims();
|
|
1175
|
+
exports.setopts = setopts;
|
|
1176
|
+
exports.ownProp = ownProp;
|
|
1177
|
+
exports.makeAbs = makeAbs;
|
|
1178
|
+
exports.finish = finish;
|
|
1179
|
+
exports.mark = mark;
|
|
1180
|
+
exports.isIgnored = isIgnored;
|
|
1181
|
+
exports.childrenIgnored = childrenIgnored;
|
|
1182
|
+
function ownProp(obj, field) {
|
|
1183
|
+
return Object.prototype.hasOwnProperty.call(obj, field);
|
|
1184
|
+
}
|
|
1185
|
+
var fs = __require("fs");
|
|
1186
|
+
var path = __require("path");
|
|
1187
|
+
var minimatch = require_minimatch();
|
|
1188
|
+
var isAbsolute = require_path_is_absolute();
|
|
1189
|
+
var Minimatch = minimatch.Minimatch;
|
|
1190
|
+
function alphasort(a, b) {
|
|
1191
|
+
return a.localeCompare(b, "en");
|
|
1192
|
+
}
|
|
1193
|
+
function setupIgnores(self, options) {
|
|
1194
|
+
self.ignore = options.ignore || [];
|
|
1195
|
+
if (!Array.isArray(self.ignore))
|
|
1196
|
+
self.ignore = [self.ignore];
|
|
1197
|
+
if (self.ignore.length) {
|
|
1198
|
+
self.ignore = self.ignore.map(ignoreMap);
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
function ignoreMap(pattern) {
|
|
1202
|
+
var gmatcher = null;
|
|
1203
|
+
if (pattern.slice(-3) === "/**") {
|
|
1204
|
+
var gpattern = pattern.replace(/(\/\*\*)+$/, "");
|
|
1205
|
+
gmatcher = new Minimatch(gpattern, { dot: true });
|
|
1206
|
+
}
|
|
1207
|
+
return {
|
|
1208
|
+
matcher: new Minimatch(pattern, { dot: true }),
|
|
1209
|
+
gmatcher
|
|
1210
|
+
};
|
|
1211
|
+
}
|
|
1212
|
+
function setopts(self, pattern, options) {
|
|
1213
|
+
if (!options)
|
|
1214
|
+
options = {};
|
|
1215
|
+
if (options.matchBase && -1 === pattern.indexOf("/")) {
|
|
1216
|
+
if (options.noglobstar) {
|
|
1217
|
+
throw new Error("base matching requires globstar");
|
|
1218
|
+
}
|
|
1219
|
+
pattern = "**/" + pattern;
|
|
1220
|
+
}
|
|
1221
|
+
self.silent = !!options.silent;
|
|
1222
|
+
self.pattern = pattern;
|
|
1223
|
+
self.strict = options.strict !== false;
|
|
1224
|
+
self.realpath = !!options.realpath;
|
|
1225
|
+
self.realpathCache = options.realpathCache || /* @__PURE__ */ Object.create(null);
|
|
1226
|
+
self.follow = !!options.follow;
|
|
1227
|
+
self.dot = !!options.dot;
|
|
1228
|
+
self.mark = !!options.mark;
|
|
1229
|
+
self.nodir = !!options.nodir;
|
|
1230
|
+
if (self.nodir)
|
|
1231
|
+
self.mark = true;
|
|
1232
|
+
self.sync = !!options.sync;
|
|
1233
|
+
self.nounique = !!options.nounique;
|
|
1234
|
+
self.nonull = !!options.nonull;
|
|
1235
|
+
self.nosort = !!options.nosort;
|
|
1236
|
+
self.nocase = !!options.nocase;
|
|
1237
|
+
self.stat = !!options.stat;
|
|
1238
|
+
self.noprocess = !!options.noprocess;
|
|
1239
|
+
self.absolute = !!options.absolute;
|
|
1240
|
+
self.fs = options.fs || fs;
|
|
1241
|
+
self.maxLength = options.maxLength || Infinity;
|
|
1242
|
+
self.cache = options.cache || /* @__PURE__ */ Object.create(null);
|
|
1243
|
+
self.statCache = options.statCache || /* @__PURE__ */ Object.create(null);
|
|
1244
|
+
self.symlinks = options.symlinks || /* @__PURE__ */ Object.create(null);
|
|
1245
|
+
setupIgnores(self, options);
|
|
1246
|
+
self.changedCwd = false;
|
|
1247
|
+
var cwd = process.cwd();
|
|
1248
|
+
if (!ownProp(options, "cwd"))
|
|
1249
|
+
self.cwd = cwd;
|
|
1250
|
+
else {
|
|
1251
|
+
self.cwd = path.resolve(options.cwd);
|
|
1252
|
+
self.changedCwd = self.cwd !== cwd;
|
|
1253
|
+
}
|
|
1254
|
+
self.root = options.root || path.resolve(self.cwd, "/");
|
|
1255
|
+
self.root = path.resolve(self.root);
|
|
1256
|
+
if (process.platform === "win32")
|
|
1257
|
+
self.root = self.root.replace(/\\/g, "/");
|
|
1258
|
+
self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd);
|
|
1259
|
+
if (process.platform === "win32")
|
|
1260
|
+
self.cwdAbs = self.cwdAbs.replace(/\\/g, "/");
|
|
1261
|
+
self.nomount = !!options.nomount;
|
|
1262
|
+
options.nonegate = true;
|
|
1263
|
+
options.nocomment = true;
|
|
1264
|
+
self.minimatch = new Minimatch(pattern, options);
|
|
1265
|
+
self.options = self.minimatch.options;
|
|
1266
|
+
}
|
|
1267
|
+
function finish(self) {
|
|
1268
|
+
var nou = self.nounique;
|
|
1269
|
+
var all = nou ? [] : /* @__PURE__ */ Object.create(null);
|
|
1270
|
+
for (var i = 0, l = self.matches.length; i < l; i++) {
|
|
1271
|
+
var matches = self.matches[i];
|
|
1272
|
+
if (!matches || Object.keys(matches).length === 0) {
|
|
1273
|
+
if (self.nonull) {
|
|
1274
|
+
var literal = self.minimatch.globSet[i];
|
|
1275
|
+
if (nou)
|
|
1276
|
+
all.push(literal);
|
|
1277
|
+
else
|
|
1278
|
+
all[literal] = true;
|
|
1279
|
+
}
|
|
1280
|
+
} else {
|
|
1281
|
+
var m = Object.keys(matches);
|
|
1282
|
+
if (nou)
|
|
1283
|
+
all.push.apply(all, m);
|
|
1284
|
+
else
|
|
1285
|
+
m.forEach(function(m2) {
|
|
1286
|
+
all[m2] = true;
|
|
1287
|
+
});
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
if (!nou)
|
|
1291
|
+
all = Object.keys(all);
|
|
1292
|
+
if (!self.nosort)
|
|
1293
|
+
all = all.sort(alphasort);
|
|
1294
|
+
if (self.mark) {
|
|
1295
|
+
for (var i = 0; i < all.length; i++) {
|
|
1296
|
+
all[i] = self._mark(all[i]);
|
|
1297
|
+
}
|
|
1298
|
+
if (self.nodir) {
|
|
1299
|
+
all = all.filter(function(e) {
|
|
1300
|
+
var notDir = !/\/$/.test(e);
|
|
1301
|
+
var c = self.cache[e] || self.cache[makeAbs(self, e)];
|
|
1302
|
+
if (notDir && c)
|
|
1303
|
+
notDir = c !== "DIR" && !Array.isArray(c);
|
|
1304
|
+
return notDir;
|
|
1305
|
+
});
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
if (self.ignore.length)
|
|
1309
|
+
all = all.filter(function(m2) {
|
|
1310
|
+
return !isIgnored(self, m2);
|
|
1311
|
+
});
|
|
1312
|
+
self.found = all;
|
|
1313
|
+
}
|
|
1314
|
+
function mark(self, p) {
|
|
1315
|
+
var abs = makeAbs(self, p);
|
|
1316
|
+
var c = self.cache[abs];
|
|
1317
|
+
var m = p;
|
|
1318
|
+
if (c) {
|
|
1319
|
+
var isDir = c === "DIR" || Array.isArray(c);
|
|
1320
|
+
var slash = p.slice(-1) === "/";
|
|
1321
|
+
if (isDir && !slash)
|
|
1322
|
+
m += "/";
|
|
1323
|
+
else if (!isDir && slash)
|
|
1324
|
+
m = m.slice(0, -1);
|
|
1325
|
+
if (m !== p) {
|
|
1326
|
+
var mabs = makeAbs(self, m);
|
|
1327
|
+
self.statCache[mabs] = self.statCache[abs];
|
|
1328
|
+
self.cache[mabs] = self.cache[abs];
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
return m;
|
|
1332
|
+
}
|
|
1333
|
+
function makeAbs(self, f) {
|
|
1334
|
+
var abs = f;
|
|
1335
|
+
if (f.charAt(0) === "/") {
|
|
1336
|
+
abs = path.join(self.root, f);
|
|
1337
|
+
} else if (isAbsolute(f) || f === "") {
|
|
1338
|
+
abs = f;
|
|
1339
|
+
} else if (self.changedCwd) {
|
|
1340
|
+
abs = path.resolve(self.cwd, f);
|
|
1341
|
+
} else {
|
|
1342
|
+
abs = path.resolve(f);
|
|
1343
|
+
}
|
|
1344
|
+
if (process.platform === "win32")
|
|
1345
|
+
abs = abs.replace(/\\/g, "/");
|
|
1346
|
+
return abs;
|
|
1347
|
+
}
|
|
1348
|
+
function isIgnored(self, path2) {
|
|
1349
|
+
if (!self.ignore.length)
|
|
1350
|
+
return false;
|
|
1351
|
+
return self.ignore.some(function(item) {
|
|
1352
|
+
return item.matcher.match(path2) || !!(item.gmatcher && item.gmatcher.match(path2));
|
|
1353
|
+
});
|
|
1354
|
+
}
|
|
1355
|
+
function childrenIgnored(self, path2) {
|
|
1356
|
+
if (!self.ignore.length)
|
|
1357
|
+
return false;
|
|
1358
|
+
return self.ignore.some(function(item) {
|
|
1359
|
+
return !!(item.gmatcher && item.gmatcher.match(path2));
|
|
1360
|
+
});
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
});
|
|
1364
|
+
|
|
1365
|
+
// node_modules/glob/sync.js
|
|
1366
|
+
var require_sync = __commonJS({
|
|
1367
|
+
"node_modules/glob/sync.js"(exports, module) {
|
|
1368
|
+
init_cjs_shims();
|
|
1369
|
+
module.exports = globSync;
|
|
1370
|
+
globSync.GlobSync = GlobSync;
|
|
1371
|
+
var rp = require_fs();
|
|
1372
|
+
var minimatch = require_minimatch();
|
|
1373
|
+
var Minimatch = minimatch.Minimatch;
|
|
1374
|
+
var Glob = require_glob().Glob;
|
|
1375
|
+
var util = __require("util");
|
|
1376
|
+
var path = __require("path");
|
|
1377
|
+
var assert = __require("assert");
|
|
1378
|
+
var isAbsolute = require_path_is_absolute();
|
|
1379
|
+
var common = require_common();
|
|
1380
|
+
var setopts = common.setopts;
|
|
1381
|
+
var ownProp = common.ownProp;
|
|
1382
|
+
var childrenIgnored = common.childrenIgnored;
|
|
1383
|
+
var isIgnored = common.isIgnored;
|
|
1384
|
+
function globSync(pattern, options) {
|
|
1385
|
+
if (typeof options === "function" || arguments.length === 3)
|
|
1386
|
+
throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");
|
|
1387
|
+
return new GlobSync(pattern, options).found;
|
|
1388
|
+
}
|
|
1389
|
+
function GlobSync(pattern, options) {
|
|
1390
|
+
if (!pattern)
|
|
1391
|
+
throw new Error("must provide pattern");
|
|
1392
|
+
if (typeof options === "function" || arguments.length === 3)
|
|
1393
|
+
throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");
|
|
1394
|
+
if (!(this instanceof GlobSync))
|
|
1395
|
+
return new GlobSync(pattern, options);
|
|
1396
|
+
setopts(this, pattern, options);
|
|
1397
|
+
if (this.noprocess)
|
|
1398
|
+
return this;
|
|
1399
|
+
var n = this.minimatch.set.length;
|
|
1400
|
+
this.matches = new Array(n);
|
|
1401
|
+
for (var i = 0; i < n; i++) {
|
|
1402
|
+
this._process(this.minimatch.set[i], i, false);
|
|
1403
|
+
}
|
|
1404
|
+
this._finish();
|
|
1405
|
+
}
|
|
1406
|
+
GlobSync.prototype._finish = function() {
|
|
1407
|
+
assert(this instanceof GlobSync);
|
|
1408
|
+
if (this.realpath) {
|
|
1409
|
+
var self = this;
|
|
1410
|
+
this.matches.forEach(function(matchset, index) {
|
|
1411
|
+
var set = self.matches[index] = /* @__PURE__ */ Object.create(null);
|
|
1412
|
+
for (var p in matchset) {
|
|
1413
|
+
try {
|
|
1414
|
+
p = self._makeAbs(p);
|
|
1415
|
+
var real = rp.realpathSync(p, self.realpathCache);
|
|
1416
|
+
set[real] = true;
|
|
1417
|
+
} catch (er) {
|
|
1418
|
+
if (er.syscall === "stat")
|
|
1419
|
+
set[self._makeAbs(p)] = true;
|
|
1420
|
+
else
|
|
1421
|
+
throw er;
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
});
|
|
1425
|
+
}
|
|
1426
|
+
common.finish(this);
|
|
1427
|
+
};
|
|
1428
|
+
GlobSync.prototype._process = function(pattern, index, inGlobStar) {
|
|
1429
|
+
assert(this instanceof GlobSync);
|
|
1430
|
+
var n = 0;
|
|
1431
|
+
while (typeof pattern[n] === "string") {
|
|
1432
|
+
n++;
|
|
1433
|
+
}
|
|
1434
|
+
var prefix;
|
|
1435
|
+
switch (n) {
|
|
1436
|
+
case pattern.length:
|
|
1437
|
+
this._processSimple(pattern.join("/"), index);
|
|
1438
|
+
return;
|
|
1439
|
+
case 0:
|
|
1440
|
+
prefix = null;
|
|
1441
|
+
break;
|
|
1442
|
+
default:
|
|
1443
|
+
prefix = pattern.slice(0, n).join("/");
|
|
1444
|
+
break;
|
|
1445
|
+
}
|
|
1446
|
+
var remain = pattern.slice(n);
|
|
1447
|
+
var read;
|
|
1448
|
+
if (prefix === null)
|
|
1449
|
+
read = ".";
|
|
1450
|
+
else if (isAbsolute(prefix) || isAbsolute(pattern.join("/"))) {
|
|
1451
|
+
if (!prefix || !isAbsolute(prefix))
|
|
1452
|
+
prefix = "/" + prefix;
|
|
1453
|
+
read = prefix;
|
|
1454
|
+
} else
|
|
1455
|
+
read = prefix;
|
|
1456
|
+
var abs = this._makeAbs(read);
|
|
1457
|
+
if (childrenIgnored(this, read))
|
|
1458
|
+
return;
|
|
1459
|
+
var isGlobStar = remain[0] === minimatch.GLOBSTAR;
|
|
1460
|
+
if (isGlobStar)
|
|
1461
|
+
this._processGlobStar(prefix, read, abs, remain, index, inGlobStar);
|
|
1462
|
+
else
|
|
1463
|
+
this._processReaddir(prefix, read, abs, remain, index, inGlobStar);
|
|
1464
|
+
};
|
|
1465
|
+
GlobSync.prototype._processReaddir = function(prefix, read, abs, remain, index, inGlobStar) {
|
|
1466
|
+
var entries = this._readdir(abs, inGlobStar);
|
|
1467
|
+
if (!entries)
|
|
1468
|
+
return;
|
|
1469
|
+
var pn = remain[0];
|
|
1470
|
+
var negate = !!this.minimatch.negate;
|
|
1471
|
+
var rawGlob = pn._glob;
|
|
1472
|
+
var dotOk = this.dot || rawGlob.charAt(0) === ".";
|
|
1473
|
+
var matchedEntries = [];
|
|
1474
|
+
for (var i = 0; i < entries.length; i++) {
|
|
1475
|
+
var e = entries[i];
|
|
1476
|
+
if (e.charAt(0) !== "." || dotOk) {
|
|
1477
|
+
var m;
|
|
1478
|
+
if (negate && !prefix) {
|
|
1479
|
+
m = !e.match(pn);
|
|
1480
|
+
} else {
|
|
1481
|
+
m = e.match(pn);
|
|
1482
|
+
}
|
|
1483
|
+
if (m)
|
|
1484
|
+
matchedEntries.push(e);
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
var len = matchedEntries.length;
|
|
1488
|
+
if (len === 0)
|
|
1489
|
+
return;
|
|
1490
|
+
if (remain.length === 1 && !this.mark && !this.stat) {
|
|
1491
|
+
if (!this.matches[index])
|
|
1492
|
+
this.matches[index] = /* @__PURE__ */ Object.create(null);
|
|
1493
|
+
for (var i = 0; i < len; i++) {
|
|
1494
|
+
var e = matchedEntries[i];
|
|
1495
|
+
if (prefix) {
|
|
1496
|
+
if (prefix.slice(-1) !== "/")
|
|
1497
|
+
e = prefix + "/" + e;
|
|
1498
|
+
else
|
|
1499
|
+
e = prefix + e;
|
|
1500
|
+
}
|
|
1501
|
+
if (e.charAt(0) === "/" && !this.nomount) {
|
|
1502
|
+
e = path.join(this.root, e);
|
|
1503
|
+
}
|
|
1504
|
+
this._emitMatch(index, e);
|
|
1505
|
+
}
|
|
1506
|
+
return;
|
|
1507
|
+
}
|
|
1508
|
+
remain.shift();
|
|
1509
|
+
for (var i = 0; i < len; i++) {
|
|
1510
|
+
var e = matchedEntries[i];
|
|
1511
|
+
var newPattern;
|
|
1512
|
+
if (prefix)
|
|
1513
|
+
newPattern = [prefix, e];
|
|
1514
|
+
else
|
|
1515
|
+
newPattern = [e];
|
|
1516
|
+
this._process(newPattern.concat(remain), index, inGlobStar);
|
|
1517
|
+
}
|
|
1518
|
+
};
|
|
1519
|
+
GlobSync.prototype._emitMatch = function(index, e) {
|
|
1520
|
+
if (isIgnored(this, e))
|
|
1521
|
+
return;
|
|
1522
|
+
var abs = this._makeAbs(e);
|
|
1523
|
+
if (this.mark)
|
|
1524
|
+
e = this._mark(e);
|
|
1525
|
+
if (this.absolute) {
|
|
1526
|
+
e = abs;
|
|
1527
|
+
}
|
|
1528
|
+
if (this.matches[index][e])
|
|
1529
|
+
return;
|
|
1530
|
+
if (this.nodir) {
|
|
1531
|
+
var c = this.cache[abs];
|
|
1532
|
+
if (c === "DIR" || Array.isArray(c))
|
|
1533
|
+
return;
|
|
1534
|
+
}
|
|
1535
|
+
this.matches[index][e] = true;
|
|
1536
|
+
if (this.stat)
|
|
1537
|
+
this._stat(e);
|
|
1538
|
+
};
|
|
1539
|
+
GlobSync.prototype._readdirInGlobStar = function(abs) {
|
|
1540
|
+
if (this.follow)
|
|
1541
|
+
return this._readdir(abs, false);
|
|
1542
|
+
var entries;
|
|
1543
|
+
var lstat;
|
|
1544
|
+
var stat;
|
|
1545
|
+
try {
|
|
1546
|
+
lstat = this.fs.lstatSync(abs);
|
|
1547
|
+
} catch (er) {
|
|
1548
|
+
if (er.code === "ENOENT") {
|
|
1549
|
+
return null;
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
var isSym = lstat && lstat.isSymbolicLink();
|
|
1553
|
+
this.symlinks[abs] = isSym;
|
|
1554
|
+
if (!isSym && lstat && !lstat.isDirectory())
|
|
1555
|
+
this.cache[abs] = "FILE";
|
|
1556
|
+
else
|
|
1557
|
+
entries = this._readdir(abs, false);
|
|
1558
|
+
return entries;
|
|
1559
|
+
};
|
|
1560
|
+
GlobSync.prototype._readdir = function(abs, inGlobStar) {
|
|
1561
|
+
var entries;
|
|
1562
|
+
if (inGlobStar && !ownProp(this.symlinks, abs))
|
|
1563
|
+
return this._readdirInGlobStar(abs);
|
|
1564
|
+
if (ownProp(this.cache, abs)) {
|
|
1565
|
+
var c = this.cache[abs];
|
|
1566
|
+
if (!c || c === "FILE")
|
|
1567
|
+
return null;
|
|
1568
|
+
if (Array.isArray(c))
|
|
1569
|
+
return c;
|
|
1570
|
+
}
|
|
1571
|
+
try {
|
|
1572
|
+
return this._readdirEntries(abs, this.fs.readdirSync(abs));
|
|
1573
|
+
} catch (er) {
|
|
1574
|
+
this._readdirError(abs, er);
|
|
1575
|
+
return null;
|
|
1576
|
+
}
|
|
1577
|
+
};
|
|
1578
|
+
GlobSync.prototype._readdirEntries = function(abs, entries) {
|
|
1579
|
+
if (!this.mark && !this.stat) {
|
|
1580
|
+
for (var i = 0; i < entries.length; i++) {
|
|
1581
|
+
var e = entries[i];
|
|
1582
|
+
if (abs === "/")
|
|
1583
|
+
e = abs + e;
|
|
1584
|
+
else
|
|
1585
|
+
e = abs + "/" + e;
|
|
1586
|
+
this.cache[e] = true;
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
this.cache[abs] = entries;
|
|
1590
|
+
return entries;
|
|
1591
|
+
};
|
|
1592
|
+
GlobSync.prototype._readdirError = function(f, er) {
|
|
1593
|
+
switch (er.code) {
|
|
1594
|
+
case "ENOTSUP":
|
|
1595
|
+
case "ENOTDIR":
|
|
1596
|
+
var abs = this._makeAbs(f);
|
|
1597
|
+
this.cache[abs] = "FILE";
|
|
1598
|
+
if (abs === this.cwdAbs) {
|
|
1599
|
+
var error = new Error(er.code + " invalid cwd " + this.cwd);
|
|
1600
|
+
error.path = this.cwd;
|
|
1601
|
+
error.code = er.code;
|
|
1602
|
+
throw error;
|
|
1603
|
+
}
|
|
1604
|
+
break;
|
|
1605
|
+
case "ENOENT":
|
|
1606
|
+
case "ELOOP":
|
|
1607
|
+
case "ENAMETOOLONG":
|
|
1608
|
+
case "UNKNOWN":
|
|
1609
|
+
this.cache[this._makeAbs(f)] = false;
|
|
1610
|
+
break;
|
|
1611
|
+
default:
|
|
1612
|
+
this.cache[this._makeAbs(f)] = false;
|
|
1613
|
+
if (this.strict)
|
|
1614
|
+
throw er;
|
|
1615
|
+
if (!this.silent)
|
|
1616
|
+
console.error("glob error", er);
|
|
1617
|
+
break;
|
|
1618
|
+
}
|
|
1619
|
+
};
|
|
1620
|
+
GlobSync.prototype._processGlobStar = function(prefix, read, abs, remain, index, inGlobStar) {
|
|
1621
|
+
var entries = this._readdir(abs, inGlobStar);
|
|
1622
|
+
if (!entries)
|
|
1623
|
+
return;
|
|
1624
|
+
var remainWithoutGlobStar = remain.slice(1);
|
|
1625
|
+
var gspref = prefix ? [prefix] : [];
|
|
1626
|
+
var noGlobStar = gspref.concat(remainWithoutGlobStar);
|
|
1627
|
+
this._process(noGlobStar, index, false);
|
|
1628
|
+
var len = entries.length;
|
|
1629
|
+
var isSym = this.symlinks[abs];
|
|
1630
|
+
if (isSym && inGlobStar)
|
|
1631
|
+
return;
|
|
1632
|
+
for (var i = 0; i < len; i++) {
|
|
1633
|
+
var e = entries[i];
|
|
1634
|
+
if (e.charAt(0) === "." && !this.dot)
|
|
1635
|
+
continue;
|
|
1636
|
+
var instead = gspref.concat(entries[i], remainWithoutGlobStar);
|
|
1637
|
+
this._process(instead, index, true);
|
|
1638
|
+
var below = gspref.concat(entries[i], remain);
|
|
1639
|
+
this._process(below, index, true);
|
|
1640
|
+
}
|
|
1641
|
+
};
|
|
1642
|
+
GlobSync.prototype._processSimple = function(prefix, index) {
|
|
1643
|
+
var exists = this._stat(prefix);
|
|
1644
|
+
if (!this.matches[index])
|
|
1645
|
+
this.matches[index] = /* @__PURE__ */ Object.create(null);
|
|
1646
|
+
if (!exists)
|
|
1647
|
+
return;
|
|
1648
|
+
if (prefix && isAbsolute(prefix) && !this.nomount) {
|
|
1649
|
+
var trail = /[\/\\]$/.test(prefix);
|
|
1650
|
+
if (prefix.charAt(0) === "/") {
|
|
1651
|
+
prefix = path.join(this.root, prefix);
|
|
1652
|
+
} else {
|
|
1653
|
+
prefix = path.resolve(this.root, prefix);
|
|
1654
|
+
if (trail)
|
|
1655
|
+
prefix += "/";
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
if (process.platform === "win32")
|
|
1659
|
+
prefix = prefix.replace(/\\/g, "/");
|
|
1660
|
+
this._emitMatch(index, prefix);
|
|
1661
|
+
};
|
|
1662
|
+
GlobSync.prototype._stat = function(f) {
|
|
1663
|
+
var abs = this._makeAbs(f);
|
|
1664
|
+
var needDir = f.slice(-1) === "/";
|
|
1665
|
+
if (f.length > this.maxLength)
|
|
1666
|
+
return false;
|
|
1667
|
+
if (!this.stat && ownProp(this.cache, abs)) {
|
|
1668
|
+
var c = this.cache[abs];
|
|
1669
|
+
if (Array.isArray(c))
|
|
1670
|
+
c = "DIR";
|
|
1671
|
+
if (!needDir || c === "DIR")
|
|
1672
|
+
return c;
|
|
1673
|
+
if (needDir && c === "FILE")
|
|
1674
|
+
return false;
|
|
1675
|
+
}
|
|
1676
|
+
var exists;
|
|
1677
|
+
var stat = this.statCache[abs];
|
|
1678
|
+
if (!stat) {
|
|
1679
|
+
var lstat;
|
|
1680
|
+
try {
|
|
1681
|
+
lstat = this.fs.lstatSync(abs);
|
|
1682
|
+
} catch (er) {
|
|
1683
|
+
if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) {
|
|
1684
|
+
this.statCache[abs] = false;
|
|
1685
|
+
return false;
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
if (lstat && lstat.isSymbolicLink()) {
|
|
1689
|
+
try {
|
|
1690
|
+
stat = this.fs.statSync(abs);
|
|
1691
|
+
} catch (er) {
|
|
1692
|
+
stat = lstat;
|
|
1693
|
+
}
|
|
1694
|
+
} else {
|
|
1695
|
+
stat = lstat;
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
this.statCache[abs] = stat;
|
|
1699
|
+
var c = true;
|
|
1700
|
+
if (stat)
|
|
1701
|
+
c = stat.isDirectory() ? "DIR" : "FILE";
|
|
1702
|
+
this.cache[abs] = this.cache[abs] || c;
|
|
1703
|
+
if (needDir && c === "FILE")
|
|
1704
|
+
return false;
|
|
1705
|
+
return c;
|
|
1706
|
+
};
|
|
1707
|
+
GlobSync.prototype._mark = function(p) {
|
|
1708
|
+
return common.mark(this, p);
|
|
1709
|
+
};
|
|
1710
|
+
GlobSync.prototype._makeAbs = function(f) {
|
|
1711
|
+
return common.makeAbs(this, f);
|
|
1712
|
+
};
|
|
1713
|
+
}
|
|
1714
|
+
});
|
|
1715
|
+
|
|
1716
|
+
// node_modules/wrappy/wrappy.js
|
|
1717
|
+
var require_wrappy = __commonJS({
|
|
1718
|
+
"node_modules/wrappy/wrappy.js"(exports, module) {
|
|
1719
|
+
init_cjs_shims();
|
|
1720
|
+
module.exports = wrappy;
|
|
1721
|
+
function wrappy(fn, cb) {
|
|
1722
|
+
if (fn && cb)
|
|
1723
|
+
return wrappy(fn)(cb);
|
|
1724
|
+
if (typeof fn !== "function")
|
|
1725
|
+
throw new TypeError("need wrapper function");
|
|
1726
|
+
Object.keys(fn).forEach(function(k) {
|
|
1727
|
+
wrapper[k] = fn[k];
|
|
1728
|
+
});
|
|
1729
|
+
return wrapper;
|
|
1730
|
+
function wrapper() {
|
|
1731
|
+
var args = new Array(arguments.length);
|
|
1732
|
+
for (var i = 0; i < args.length; i++) {
|
|
1733
|
+
args[i] = arguments[i];
|
|
1734
|
+
}
|
|
1735
|
+
var ret = fn.apply(this, args);
|
|
1736
|
+
var cb2 = args[args.length - 1];
|
|
1737
|
+
if (typeof ret === "function" && ret !== cb2) {
|
|
1738
|
+
Object.keys(cb2).forEach(function(k) {
|
|
1739
|
+
ret[k] = cb2[k];
|
|
1740
|
+
});
|
|
1741
|
+
}
|
|
1742
|
+
return ret;
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
});
|
|
1747
|
+
|
|
1748
|
+
// node_modules/once/once.js
|
|
1749
|
+
var require_once = __commonJS({
|
|
1750
|
+
"node_modules/once/once.js"(exports, module) {
|
|
1751
|
+
init_cjs_shims();
|
|
1752
|
+
var wrappy = require_wrappy();
|
|
1753
|
+
module.exports = wrappy(once);
|
|
1754
|
+
module.exports.strict = wrappy(onceStrict);
|
|
1755
|
+
once.proto = once(function() {
|
|
1756
|
+
Object.defineProperty(Function.prototype, "once", {
|
|
1757
|
+
value: function() {
|
|
1758
|
+
return once(this);
|
|
1759
|
+
},
|
|
1760
|
+
configurable: true
|
|
1761
|
+
});
|
|
1762
|
+
Object.defineProperty(Function.prototype, "onceStrict", {
|
|
1763
|
+
value: function() {
|
|
1764
|
+
return onceStrict(this);
|
|
1765
|
+
},
|
|
1766
|
+
configurable: true
|
|
1767
|
+
});
|
|
1768
|
+
});
|
|
1769
|
+
function once(fn) {
|
|
1770
|
+
var f = function() {
|
|
1771
|
+
if (f.called)
|
|
1772
|
+
return f.value;
|
|
1773
|
+
f.called = true;
|
|
1774
|
+
return f.value = fn.apply(this, arguments);
|
|
1775
|
+
};
|
|
1776
|
+
f.called = false;
|
|
1777
|
+
return f;
|
|
1778
|
+
}
|
|
1779
|
+
function onceStrict(fn) {
|
|
1780
|
+
var f = function() {
|
|
1781
|
+
if (f.called)
|
|
1782
|
+
throw new Error(f.onceError);
|
|
1783
|
+
f.called = true;
|
|
1784
|
+
return f.value = fn.apply(this, arguments);
|
|
1785
|
+
};
|
|
1786
|
+
var name = fn.name || "Function wrapped with `once`";
|
|
1787
|
+
f.onceError = name + " shouldn't be called more than once";
|
|
1788
|
+
f.called = false;
|
|
1789
|
+
return f;
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1792
|
+
});
|
|
1793
|
+
|
|
1794
|
+
// node_modules/inflight/inflight.js
|
|
1795
|
+
var require_inflight = __commonJS({
|
|
1796
|
+
"node_modules/inflight/inflight.js"(exports, module) {
|
|
1797
|
+
init_cjs_shims();
|
|
1798
|
+
var wrappy = require_wrappy();
|
|
1799
|
+
var reqs = /* @__PURE__ */ Object.create(null);
|
|
1800
|
+
var once = require_once();
|
|
1801
|
+
module.exports = wrappy(inflight);
|
|
1802
|
+
function inflight(key, cb) {
|
|
1803
|
+
if (reqs[key]) {
|
|
1804
|
+
reqs[key].push(cb);
|
|
1805
|
+
return null;
|
|
1806
|
+
} else {
|
|
1807
|
+
reqs[key] = [cb];
|
|
1808
|
+
return makeres(key);
|
|
1809
|
+
}
|
|
1810
|
+
}
|
|
1811
|
+
function makeres(key) {
|
|
1812
|
+
return once(function RES() {
|
|
1813
|
+
var cbs = reqs[key];
|
|
1814
|
+
var len = cbs.length;
|
|
1815
|
+
var args = slice(arguments);
|
|
1816
|
+
try {
|
|
1817
|
+
for (var i = 0; i < len; i++) {
|
|
1818
|
+
cbs[i].apply(null, args);
|
|
1819
|
+
}
|
|
1820
|
+
} finally {
|
|
1821
|
+
if (cbs.length > len) {
|
|
1822
|
+
cbs.splice(0, len);
|
|
1823
|
+
process.nextTick(function() {
|
|
1824
|
+
RES.apply(null, args);
|
|
1825
|
+
});
|
|
1826
|
+
} else {
|
|
1827
|
+
delete reqs[key];
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
});
|
|
1831
|
+
}
|
|
1832
|
+
function slice(args) {
|
|
1833
|
+
var length = args.length;
|
|
1834
|
+
var array = [];
|
|
1835
|
+
for (var i = 0; i < length; i++)
|
|
1836
|
+
array[i] = args[i];
|
|
1837
|
+
return array;
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
});
|
|
1841
|
+
|
|
1842
|
+
// node_modules/glob/glob.js
|
|
1843
|
+
var require_glob = __commonJS({
|
|
1844
|
+
"node_modules/glob/glob.js"(exports, module) {
|
|
1845
|
+
init_cjs_shims();
|
|
1846
|
+
module.exports = glob;
|
|
1847
|
+
var rp = require_fs();
|
|
1848
|
+
var minimatch = require_minimatch();
|
|
1849
|
+
var Minimatch = minimatch.Minimatch;
|
|
1850
|
+
var inherits = require_inherits();
|
|
1851
|
+
var EE = __require("events").EventEmitter;
|
|
1852
|
+
var path = __require("path");
|
|
1853
|
+
var assert = __require("assert");
|
|
1854
|
+
var isAbsolute = require_path_is_absolute();
|
|
1855
|
+
var globSync = require_sync();
|
|
1856
|
+
var common = require_common();
|
|
1857
|
+
var setopts = common.setopts;
|
|
1858
|
+
var ownProp = common.ownProp;
|
|
1859
|
+
var inflight = require_inflight();
|
|
1860
|
+
var util = __require("util");
|
|
1861
|
+
var childrenIgnored = common.childrenIgnored;
|
|
1862
|
+
var isIgnored = common.isIgnored;
|
|
1863
|
+
var once = require_once();
|
|
1864
|
+
function glob(pattern, options, cb) {
|
|
1865
|
+
if (typeof options === "function")
|
|
1866
|
+
cb = options, options = {};
|
|
1867
|
+
if (!options)
|
|
1868
|
+
options = {};
|
|
1869
|
+
if (options.sync) {
|
|
1870
|
+
if (cb)
|
|
1871
|
+
throw new TypeError("callback provided to sync glob");
|
|
1872
|
+
return globSync(pattern, options);
|
|
1873
|
+
}
|
|
1874
|
+
return new Glob(pattern, options, cb);
|
|
1875
|
+
}
|
|
1876
|
+
glob.sync = globSync;
|
|
1877
|
+
var GlobSync = glob.GlobSync = globSync.GlobSync;
|
|
1878
|
+
glob.glob = glob;
|
|
1879
|
+
function extend(origin, add) {
|
|
1880
|
+
if (add === null || typeof add !== "object") {
|
|
1881
|
+
return origin;
|
|
1882
|
+
}
|
|
1883
|
+
var keys = Object.keys(add);
|
|
1884
|
+
var i = keys.length;
|
|
1885
|
+
while (i--) {
|
|
1886
|
+
origin[keys[i]] = add[keys[i]];
|
|
1887
|
+
}
|
|
1888
|
+
return origin;
|
|
1889
|
+
}
|
|
1890
|
+
glob.hasMagic = function(pattern, options_) {
|
|
1891
|
+
var options = extend({}, options_);
|
|
1892
|
+
options.noprocess = true;
|
|
1893
|
+
var g = new Glob(pattern, options);
|
|
1894
|
+
var set = g.minimatch.set;
|
|
1895
|
+
if (!pattern)
|
|
1896
|
+
return false;
|
|
1897
|
+
if (set.length > 1)
|
|
1898
|
+
return true;
|
|
1899
|
+
for (var j = 0; j < set[0].length; j++) {
|
|
1900
|
+
if (typeof set[0][j] !== "string")
|
|
1901
|
+
return true;
|
|
1902
|
+
}
|
|
1903
|
+
return false;
|
|
1904
|
+
};
|
|
1905
|
+
glob.Glob = Glob;
|
|
1906
|
+
inherits(Glob, EE);
|
|
1907
|
+
function Glob(pattern, options, cb) {
|
|
1908
|
+
if (typeof options === "function") {
|
|
1909
|
+
cb = options;
|
|
1910
|
+
options = null;
|
|
1911
|
+
}
|
|
1912
|
+
if (options && options.sync) {
|
|
1913
|
+
if (cb)
|
|
1914
|
+
throw new TypeError("callback provided to sync glob");
|
|
1915
|
+
return new GlobSync(pattern, options);
|
|
1916
|
+
}
|
|
1917
|
+
if (!(this instanceof Glob))
|
|
1918
|
+
return new Glob(pattern, options, cb);
|
|
1919
|
+
setopts(this, pattern, options);
|
|
1920
|
+
this._didRealPath = false;
|
|
1921
|
+
var n = this.minimatch.set.length;
|
|
1922
|
+
this.matches = new Array(n);
|
|
1923
|
+
if (typeof cb === "function") {
|
|
1924
|
+
cb = once(cb);
|
|
1925
|
+
this.on("error", cb);
|
|
1926
|
+
this.on("end", function(matches) {
|
|
1927
|
+
cb(null, matches);
|
|
1928
|
+
});
|
|
1929
|
+
}
|
|
1930
|
+
var self = this;
|
|
1931
|
+
this._processing = 0;
|
|
1932
|
+
this._emitQueue = [];
|
|
1933
|
+
this._processQueue = [];
|
|
1934
|
+
this.paused = false;
|
|
1935
|
+
if (this.noprocess)
|
|
1936
|
+
return this;
|
|
1937
|
+
if (n === 0)
|
|
1938
|
+
return done();
|
|
1939
|
+
var sync = true;
|
|
1940
|
+
for (var i = 0; i < n; i++) {
|
|
1941
|
+
this._process(this.minimatch.set[i], i, false, done);
|
|
1942
|
+
}
|
|
1943
|
+
sync = false;
|
|
1944
|
+
function done() {
|
|
1945
|
+
--self._processing;
|
|
1946
|
+
if (self._processing <= 0) {
|
|
1947
|
+
if (sync) {
|
|
1948
|
+
process.nextTick(function() {
|
|
1949
|
+
self._finish();
|
|
1950
|
+
});
|
|
1951
|
+
} else {
|
|
1952
|
+
self._finish();
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
}
|
|
1957
|
+
Glob.prototype._finish = function() {
|
|
1958
|
+
assert(this instanceof Glob);
|
|
1959
|
+
if (this.aborted)
|
|
1960
|
+
return;
|
|
1961
|
+
if (this.realpath && !this._didRealpath)
|
|
1962
|
+
return this._realpath();
|
|
1963
|
+
common.finish(this);
|
|
1964
|
+
this.emit("end", this.found);
|
|
1965
|
+
};
|
|
1966
|
+
Glob.prototype._realpath = function() {
|
|
1967
|
+
if (this._didRealpath)
|
|
1968
|
+
return;
|
|
1969
|
+
this._didRealpath = true;
|
|
1970
|
+
var n = this.matches.length;
|
|
1971
|
+
if (n === 0)
|
|
1972
|
+
return this._finish();
|
|
1973
|
+
var self = this;
|
|
1974
|
+
for (var i = 0; i < this.matches.length; i++)
|
|
1975
|
+
this._realpathSet(i, next);
|
|
1976
|
+
function next() {
|
|
1977
|
+
if (--n === 0)
|
|
1978
|
+
self._finish();
|
|
1979
|
+
}
|
|
1980
|
+
};
|
|
1981
|
+
Glob.prototype._realpathSet = function(index, cb) {
|
|
1982
|
+
var matchset = this.matches[index];
|
|
1983
|
+
if (!matchset)
|
|
1984
|
+
return cb();
|
|
1985
|
+
var found = Object.keys(matchset);
|
|
1986
|
+
var self = this;
|
|
1987
|
+
var n = found.length;
|
|
1988
|
+
if (n === 0)
|
|
1989
|
+
return cb();
|
|
1990
|
+
var set = this.matches[index] = /* @__PURE__ */ Object.create(null);
|
|
1991
|
+
found.forEach(function(p, i) {
|
|
1992
|
+
p = self._makeAbs(p);
|
|
1993
|
+
rp.realpath(p, self.realpathCache, function(er, real) {
|
|
1994
|
+
if (!er)
|
|
1995
|
+
set[real] = true;
|
|
1996
|
+
else if (er.syscall === "stat")
|
|
1997
|
+
set[p] = true;
|
|
1998
|
+
else
|
|
1999
|
+
self.emit("error", er);
|
|
2000
|
+
if (--n === 0) {
|
|
2001
|
+
self.matches[index] = set;
|
|
2002
|
+
cb();
|
|
2003
|
+
}
|
|
2004
|
+
});
|
|
2005
|
+
});
|
|
2006
|
+
};
|
|
2007
|
+
Glob.prototype._mark = function(p) {
|
|
2008
|
+
return common.mark(this, p);
|
|
2009
|
+
};
|
|
2010
|
+
Glob.prototype._makeAbs = function(f) {
|
|
2011
|
+
return common.makeAbs(this, f);
|
|
2012
|
+
};
|
|
2013
|
+
Glob.prototype.abort = function() {
|
|
2014
|
+
this.aborted = true;
|
|
2015
|
+
this.emit("abort");
|
|
2016
|
+
};
|
|
2017
|
+
Glob.prototype.pause = function() {
|
|
2018
|
+
if (!this.paused) {
|
|
2019
|
+
this.paused = true;
|
|
2020
|
+
this.emit("pause");
|
|
2021
|
+
}
|
|
2022
|
+
};
|
|
2023
|
+
Glob.prototype.resume = function() {
|
|
2024
|
+
if (this.paused) {
|
|
2025
|
+
this.emit("resume");
|
|
2026
|
+
this.paused = false;
|
|
2027
|
+
if (this._emitQueue.length) {
|
|
2028
|
+
var eq = this._emitQueue.slice(0);
|
|
2029
|
+
this._emitQueue.length = 0;
|
|
2030
|
+
for (var i = 0; i < eq.length; i++) {
|
|
2031
|
+
var e = eq[i];
|
|
2032
|
+
this._emitMatch(e[0], e[1]);
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
if (this._processQueue.length) {
|
|
2036
|
+
var pq = this._processQueue.slice(0);
|
|
2037
|
+
this._processQueue.length = 0;
|
|
2038
|
+
for (var i = 0; i < pq.length; i++) {
|
|
2039
|
+
var p = pq[i];
|
|
2040
|
+
this._processing--;
|
|
2041
|
+
this._process(p[0], p[1], p[2], p[3]);
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
};
|
|
2046
|
+
Glob.prototype._process = function(pattern, index, inGlobStar, cb) {
|
|
2047
|
+
assert(this instanceof Glob);
|
|
2048
|
+
assert(typeof cb === "function");
|
|
2049
|
+
if (this.aborted)
|
|
2050
|
+
return;
|
|
2051
|
+
this._processing++;
|
|
2052
|
+
if (this.paused) {
|
|
2053
|
+
this._processQueue.push([pattern, index, inGlobStar, cb]);
|
|
2054
|
+
return;
|
|
2055
|
+
}
|
|
2056
|
+
var n = 0;
|
|
2057
|
+
while (typeof pattern[n] === "string") {
|
|
2058
|
+
n++;
|
|
2059
|
+
}
|
|
2060
|
+
var prefix;
|
|
2061
|
+
switch (n) {
|
|
2062
|
+
case pattern.length:
|
|
2063
|
+
this._processSimple(pattern.join("/"), index, cb);
|
|
2064
|
+
return;
|
|
2065
|
+
case 0:
|
|
2066
|
+
prefix = null;
|
|
2067
|
+
break;
|
|
2068
|
+
default:
|
|
2069
|
+
prefix = pattern.slice(0, n).join("/");
|
|
2070
|
+
break;
|
|
2071
|
+
}
|
|
2072
|
+
var remain = pattern.slice(n);
|
|
2073
|
+
var read;
|
|
2074
|
+
if (prefix === null)
|
|
2075
|
+
read = ".";
|
|
2076
|
+
else if (isAbsolute(prefix) || isAbsolute(pattern.join("/"))) {
|
|
2077
|
+
if (!prefix || !isAbsolute(prefix))
|
|
2078
|
+
prefix = "/" + prefix;
|
|
2079
|
+
read = prefix;
|
|
2080
|
+
} else
|
|
2081
|
+
read = prefix;
|
|
2082
|
+
var abs = this._makeAbs(read);
|
|
2083
|
+
if (childrenIgnored(this, read))
|
|
2084
|
+
return cb();
|
|
2085
|
+
var isGlobStar = remain[0] === minimatch.GLOBSTAR;
|
|
2086
|
+
if (isGlobStar)
|
|
2087
|
+
this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb);
|
|
2088
|
+
else
|
|
2089
|
+
this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb);
|
|
2090
|
+
};
|
|
2091
|
+
Glob.prototype._processReaddir = function(prefix, read, abs, remain, index, inGlobStar, cb) {
|
|
2092
|
+
var self = this;
|
|
2093
|
+
this._readdir(abs, inGlobStar, function(er, entries) {
|
|
2094
|
+
return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb);
|
|
2095
|
+
});
|
|
2096
|
+
};
|
|
2097
|
+
Glob.prototype._processReaddir2 = function(prefix, read, abs, remain, index, inGlobStar, entries, cb) {
|
|
2098
|
+
if (!entries)
|
|
2099
|
+
return cb();
|
|
2100
|
+
var pn = remain[0];
|
|
2101
|
+
var negate = !!this.minimatch.negate;
|
|
2102
|
+
var rawGlob = pn._glob;
|
|
2103
|
+
var dotOk = this.dot || rawGlob.charAt(0) === ".";
|
|
2104
|
+
var matchedEntries = [];
|
|
2105
|
+
for (var i = 0; i < entries.length; i++) {
|
|
2106
|
+
var e = entries[i];
|
|
2107
|
+
if (e.charAt(0) !== "." || dotOk) {
|
|
2108
|
+
var m;
|
|
2109
|
+
if (negate && !prefix) {
|
|
2110
|
+
m = !e.match(pn);
|
|
2111
|
+
} else {
|
|
2112
|
+
m = e.match(pn);
|
|
2113
|
+
}
|
|
2114
|
+
if (m)
|
|
2115
|
+
matchedEntries.push(e);
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
var len = matchedEntries.length;
|
|
2119
|
+
if (len === 0)
|
|
2120
|
+
return cb();
|
|
2121
|
+
if (remain.length === 1 && !this.mark && !this.stat) {
|
|
2122
|
+
if (!this.matches[index])
|
|
2123
|
+
this.matches[index] = /* @__PURE__ */ Object.create(null);
|
|
2124
|
+
for (var i = 0; i < len; i++) {
|
|
2125
|
+
var e = matchedEntries[i];
|
|
2126
|
+
if (prefix) {
|
|
2127
|
+
if (prefix !== "/")
|
|
2128
|
+
e = prefix + "/" + e;
|
|
2129
|
+
else
|
|
2130
|
+
e = prefix + e;
|
|
2131
|
+
}
|
|
2132
|
+
if (e.charAt(0) === "/" && !this.nomount) {
|
|
2133
|
+
e = path.join(this.root, e);
|
|
2134
|
+
}
|
|
2135
|
+
this._emitMatch(index, e);
|
|
2136
|
+
}
|
|
2137
|
+
return cb();
|
|
2138
|
+
}
|
|
2139
|
+
remain.shift();
|
|
2140
|
+
for (var i = 0; i < len; i++) {
|
|
2141
|
+
var e = matchedEntries[i];
|
|
2142
|
+
var newPattern;
|
|
2143
|
+
if (prefix) {
|
|
2144
|
+
if (prefix !== "/")
|
|
2145
|
+
e = prefix + "/" + e;
|
|
2146
|
+
else
|
|
2147
|
+
e = prefix + e;
|
|
2148
|
+
}
|
|
2149
|
+
this._process([e].concat(remain), index, inGlobStar, cb);
|
|
2150
|
+
}
|
|
2151
|
+
cb();
|
|
2152
|
+
};
|
|
2153
|
+
Glob.prototype._emitMatch = function(index, e) {
|
|
2154
|
+
if (this.aborted)
|
|
2155
|
+
return;
|
|
2156
|
+
if (isIgnored(this, e))
|
|
2157
|
+
return;
|
|
2158
|
+
if (this.paused) {
|
|
2159
|
+
this._emitQueue.push([index, e]);
|
|
2160
|
+
return;
|
|
2161
|
+
}
|
|
2162
|
+
var abs = isAbsolute(e) ? e : this._makeAbs(e);
|
|
2163
|
+
if (this.mark)
|
|
2164
|
+
e = this._mark(e);
|
|
2165
|
+
if (this.absolute)
|
|
2166
|
+
e = abs;
|
|
2167
|
+
if (this.matches[index][e])
|
|
2168
|
+
return;
|
|
2169
|
+
if (this.nodir) {
|
|
2170
|
+
var c = this.cache[abs];
|
|
2171
|
+
if (c === "DIR" || Array.isArray(c))
|
|
2172
|
+
return;
|
|
2173
|
+
}
|
|
2174
|
+
this.matches[index][e] = true;
|
|
2175
|
+
var st = this.statCache[abs];
|
|
2176
|
+
if (st)
|
|
2177
|
+
this.emit("stat", e, st);
|
|
2178
|
+
this.emit("match", e);
|
|
2179
|
+
};
|
|
2180
|
+
Glob.prototype._readdirInGlobStar = function(abs, cb) {
|
|
2181
|
+
if (this.aborted)
|
|
2182
|
+
return;
|
|
2183
|
+
if (this.follow)
|
|
2184
|
+
return this._readdir(abs, false, cb);
|
|
2185
|
+
var lstatkey = "lstat\0" + abs;
|
|
2186
|
+
var self = this;
|
|
2187
|
+
var lstatcb = inflight(lstatkey, lstatcb_);
|
|
2188
|
+
if (lstatcb)
|
|
2189
|
+
self.fs.lstat(abs, lstatcb);
|
|
2190
|
+
function lstatcb_(er, lstat) {
|
|
2191
|
+
if (er && er.code === "ENOENT")
|
|
2192
|
+
return cb();
|
|
2193
|
+
var isSym = lstat && lstat.isSymbolicLink();
|
|
2194
|
+
self.symlinks[abs] = isSym;
|
|
2195
|
+
if (!isSym && lstat && !lstat.isDirectory()) {
|
|
2196
|
+
self.cache[abs] = "FILE";
|
|
2197
|
+
cb();
|
|
2198
|
+
} else
|
|
2199
|
+
self._readdir(abs, false, cb);
|
|
2200
|
+
}
|
|
2201
|
+
};
|
|
2202
|
+
Glob.prototype._readdir = function(abs, inGlobStar, cb) {
|
|
2203
|
+
if (this.aborted)
|
|
2204
|
+
return;
|
|
2205
|
+
cb = inflight("readdir\0" + abs + "\0" + inGlobStar, cb);
|
|
2206
|
+
if (!cb)
|
|
2207
|
+
return;
|
|
2208
|
+
if (inGlobStar && !ownProp(this.symlinks, abs))
|
|
2209
|
+
return this._readdirInGlobStar(abs, cb);
|
|
2210
|
+
if (ownProp(this.cache, abs)) {
|
|
2211
|
+
var c = this.cache[abs];
|
|
2212
|
+
if (!c || c === "FILE")
|
|
2213
|
+
return cb();
|
|
2214
|
+
if (Array.isArray(c))
|
|
2215
|
+
return cb(null, c);
|
|
2216
|
+
}
|
|
2217
|
+
var self = this;
|
|
2218
|
+
self.fs.readdir(abs, readdirCb(this, abs, cb));
|
|
2219
|
+
};
|
|
2220
|
+
function readdirCb(self, abs, cb) {
|
|
2221
|
+
return function(er, entries) {
|
|
2222
|
+
if (er)
|
|
2223
|
+
self._readdirError(abs, er, cb);
|
|
2224
|
+
else
|
|
2225
|
+
self._readdirEntries(abs, entries, cb);
|
|
2226
|
+
};
|
|
2227
|
+
}
|
|
2228
|
+
Glob.prototype._readdirEntries = function(abs, entries, cb) {
|
|
2229
|
+
if (this.aborted)
|
|
2230
|
+
return;
|
|
2231
|
+
if (!this.mark && !this.stat) {
|
|
2232
|
+
for (var i = 0; i < entries.length; i++) {
|
|
2233
|
+
var e = entries[i];
|
|
2234
|
+
if (abs === "/")
|
|
2235
|
+
e = abs + e;
|
|
2236
|
+
else
|
|
2237
|
+
e = abs + "/" + e;
|
|
2238
|
+
this.cache[e] = true;
|
|
2239
|
+
}
|
|
2240
|
+
}
|
|
2241
|
+
this.cache[abs] = entries;
|
|
2242
|
+
return cb(null, entries);
|
|
2243
|
+
};
|
|
2244
|
+
Glob.prototype._readdirError = function(f, er, cb) {
|
|
2245
|
+
if (this.aborted)
|
|
2246
|
+
return;
|
|
2247
|
+
switch (er.code) {
|
|
2248
|
+
case "ENOTSUP":
|
|
2249
|
+
case "ENOTDIR":
|
|
2250
|
+
var abs = this._makeAbs(f);
|
|
2251
|
+
this.cache[abs] = "FILE";
|
|
2252
|
+
if (abs === this.cwdAbs) {
|
|
2253
|
+
var error = new Error(er.code + " invalid cwd " + this.cwd);
|
|
2254
|
+
error.path = this.cwd;
|
|
2255
|
+
error.code = er.code;
|
|
2256
|
+
this.emit("error", error);
|
|
2257
|
+
this.abort();
|
|
2258
|
+
}
|
|
2259
|
+
break;
|
|
2260
|
+
case "ENOENT":
|
|
2261
|
+
case "ELOOP":
|
|
2262
|
+
case "ENAMETOOLONG":
|
|
2263
|
+
case "UNKNOWN":
|
|
2264
|
+
this.cache[this._makeAbs(f)] = false;
|
|
2265
|
+
break;
|
|
2266
|
+
default:
|
|
2267
|
+
this.cache[this._makeAbs(f)] = false;
|
|
2268
|
+
if (this.strict) {
|
|
2269
|
+
this.emit("error", er);
|
|
2270
|
+
this.abort();
|
|
2271
|
+
}
|
|
2272
|
+
if (!this.silent)
|
|
2273
|
+
console.error("glob error", er);
|
|
2274
|
+
break;
|
|
2275
|
+
}
|
|
2276
|
+
return cb();
|
|
2277
|
+
};
|
|
2278
|
+
Glob.prototype._processGlobStar = function(prefix, read, abs, remain, index, inGlobStar, cb) {
|
|
2279
|
+
var self = this;
|
|
2280
|
+
this._readdir(abs, inGlobStar, function(er, entries) {
|
|
2281
|
+
self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb);
|
|
2282
|
+
});
|
|
2283
|
+
};
|
|
2284
|
+
Glob.prototype._processGlobStar2 = function(prefix, read, abs, remain, index, inGlobStar, entries, cb) {
|
|
2285
|
+
if (!entries)
|
|
2286
|
+
return cb();
|
|
2287
|
+
var remainWithoutGlobStar = remain.slice(1);
|
|
2288
|
+
var gspref = prefix ? [prefix] : [];
|
|
2289
|
+
var noGlobStar = gspref.concat(remainWithoutGlobStar);
|
|
2290
|
+
this._process(noGlobStar, index, false, cb);
|
|
2291
|
+
var isSym = this.symlinks[abs];
|
|
2292
|
+
var len = entries.length;
|
|
2293
|
+
if (isSym && inGlobStar)
|
|
2294
|
+
return cb();
|
|
2295
|
+
for (var i = 0; i < len; i++) {
|
|
2296
|
+
var e = entries[i];
|
|
2297
|
+
if (e.charAt(0) === "." && !this.dot)
|
|
2298
|
+
continue;
|
|
2299
|
+
var instead = gspref.concat(entries[i], remainWithoutGlobStar);
|
|
2300
|
+
this._process(instead, index, true, cb);
|
|
2301
|
+
var below = gspref.concat(entries[i], remain);
|
|
2302
|
+
this._process(below, index, true, cb);
|
|
2303
|
+
}
|
|
2304
|
+
cb();
|
|
2305
|
+
};
|
|
2306
|
+
Glob.prototype._processSimple = function(prefix, index, cb) {
|
|
2307
|
+
var self = this;
|
|
2308
|
+
this._stat(prefix, function(er, exists) {
|
|
2309
|
+
self._processSimple2(prefix, index, er, exists, cb);
|
|
2310
|
+
});
|
|
2311
|
+
};
|
|
2312
|
+
Glob.prototype._processSimple2 = function(prefix, index, er, exists, cb) {
|
|
2313
|
+
if (!this.matches[index])
|
|
2314
|
+
this.matches[index] = /* @__PURE__ */ Object.create(null);
|
|
2315
|
+
if (!exists)
|
|
2316
|
+
return cb();
|
|
2317
|
+
if (prefix && isAbsolute(prefix) && !this.nomount) {
|
|
2318
|
+
var trail = /[\/\\]$/.test(prefix);
|
|
2319
|
+
if (prefix.charAt(0) === "/") {
|
|
2320
|
+
prefix = path.join(this.root, prefix);
|
|
2321
|
+
} else {
|
|
2322
|
+
prefix = path.resolve(this.root, prefix);
|
|
2323
|
+
if (trail)
|
|
2324
|
+
prefix += "/";
|
|
2325
|
+
}
|
|
2326
|
+
}
|
|
2327
|
+
if (process.platform === "win32")
|
|
2328
|
+
prefix = prefix.replace(/\\/g, "/");
|
|
2329
|
+
this._emitMatch(index, prefix);
|
|
2330
|
+
cb();
|
|
2331
|
+
};
|
|
2332
|
+
Glob.prototype._stat = function(f, cb) {
|
|
2333
|
+
var abs = this._makeAbs(f);
|
|
2334
|
+
var needDir = f.slice(-1) === "/";
|
|
2335
|
+
if (f.length > this.maxLength)
|
|
2336
|
+
return cb();
|
|
2337
|
+
if (!this.stat && ownProp(this.cache, abs)) {
|
|
2338
|
+
var c = this.cache[abs];
|
|
2339
|
+
if (Array.isArray(c))
|
|
2340
|
+
c = "DIR";
|
|
2341
|
+
if (!needDir || c === "DIR")
|
|
2342
|
+
return cb(null, c);
|
|
2343
|
+
if (needDir && c === "FILE")
|
|
2344
|
+
return cb();
|
|
2345
|
+
}
|
|
2346
|
+
var exists;
|
|
2347
|
+
var stat = this.statCache[abs];
|
|
2348
|
+
if (stat !== void 0) {
|
|
2349
|
+
if (stat === false)
|
|
2350
|
+
return cb(null, stat);
|
|
2351
|
+
else {
|
|
2352
|
+
var type = stat.isDirectory() ? "DIR" : "FILE";
|
|
2353
|
+
if (needDir && type === "FILE")
|
|
2354
|
+
return cb();
|
|
2355
|
+
else
|
|
2356
|
+
return cb(null, type, stat);
|
|
2357
|
+
}
|
|
2358
|
+
}
|
|
2359
|
+
var self = this;
|
|
2360
|
+
var statcb = inflight("stat\0" + abs, lstatcb_);
|
|
2361
|
+
if (statcb)
|
|
2362
|
+
self.fs.lstat(abs, statcb);
|
|
2363
|
+
function lstatcb_(er, lstat) {
|
|
2364
|
+
if (lstat && lstat.isSymbolicLink()) {
|
|
2365
|
+
return self.fs.stat(abs, function(er2, stat2) {
|
|
2366
|
+
if (er2)
|
|
2367
|
+
self._stat2(f, abs, null, lstat, cb);
|
|
2368
|
+
else
|
|
2369
|
+
self._stat2(f, abs, er2, stat2, cb);
|
|
2370
|
+
});
|
|
2371
|
+
} else {
|
|
2372
|
+
self._stat2(f, abs, er, lstat, cb);
|
|
2373
|
+
}
|
|
2374
|
+
}
|
|
2375
|
+
};
|
|
2376
|
+
Glob.prototype._stat2 = function(f, abs, er, stat, cb) {
|
|
2377
|
+
if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) {
|
|
2378
|
+
this.statCache[abs] = false;
|
|
2379
|
+
return cb();
|
|
2380
|
+
}
|
|
2381
|
+
var needDir = f.slice(-1) === "/";
|
|
2382
|
+
this.statCache[abs] = stat;
|
|
2383
|
+
if (abs.slice(-1) === "/" && stat && !stat.isDirectory())
|
|
2384
|
+
return cb(null, false, stat);
|
|
2385
|
+
var c = true;
|
|
2386
|
+
if (stat)
|
|
2387
|
+
c = stat.isDirectory() ? "DIR" : "FILE";
|
|
2388
|
+
this.cache[abs] = this.cache[abs] || c;
|
|
2389
|
+
if (needDir && c === "FILE")
|
|
2390
|
+
return cb();
|
|
2391
|
+
return cb(null, c, stat);
|
|
2392
|
+
};
|
|
2393
|
+
}
|
|
2394
|
+
});
|
|
2395
|
+
|
|
2396
|
+
// node_modules/shelljs/src/common.js
|
|
2397
|
+
var require_common2 = __commonJS({
|
|
2398
|
+
"node_modules/shelljs/src/common.js"(exports) {
|
|
2399
|
+
"use strict";
|
|
2400
|
+
init_cjs_shims();
|
|
2401
|
+
var os = __require("os");
|
|
2402
|
+
var fs = __require("fs");
|
|
2403
|
+
var glob = require_glob();
|
|
2404
|
+
var shell = require_shell();
|
|
2405
|
+
var shellMethods = Object.create(shell);
|
|
2406
|
+
exports.extend = Object.assign;
|
|
2407
|
+
var isElectron = Boolean(process.versions.electron);
|
|
2408
|
+
var DEFAULT_CONFIG = {
|
|
2409
|
+
fatal: false,
|
|
2410
|
+
globOptions: {},
|
|
2411
|
+
maxdepth: 255,
|
|
2412
|
+
noglob: false,
|
|
2413
|
+
silent: false,
|
|
2414
|
+
verbose: false,
|
|
2415
|
+
execPath: null,
|
|
2416
|
+
bufLength: 64 * 1024
|
|
2417
|
+
// 64KB
|
|
2418
|
+
};
|
|
2419
|
+
var config = {
|
|
2420
|
+
reset: function() {
|
|
2421
|
+
Object.assign(this, DEFAULT_CONFIG);
|
|
2422
|
+
if (!isElectron) {
|
|
2423
|
+
this.execPath = process.execPath;
|
|
2424
|
+
}
|
|
2425
|
+
},
|
|
2426
|
+
resetForTesting: function() {
|
|
2427
|
+
this.reset();
|
|
2428
|
+
this.silent = true;
|
|
2429
|
+
}
|
|
2430
|
+
};
|
|
2431
|
+
config.reset();
|
|
2432
|
+
exports.config = config;
|
|
2433
|
+
var state = {
|
|
2434
|
+
error: null,
|
|
2435
|
+
errorCode: 0,
|
|
2436
|
+
currentCmd: "shell.js"
|
|
2437
|
+
};
|
|
2438
|
+
exports.state = state;
|
|
2439
|
+
delete process.env.OLDPWD;
|
|
2440
|
+
function isObject(a) {
|
|
2441
|
+
return typeof a === "object" && a !== null;
|
|
2442
|
+
}
|
|
2443
|
+
exports.isObject = isObject;
|
|
2444
|
+
function log() {
|
|
2445
|
+
if (!config.silent) {
|
|
2446
|
+
console.error.apply(console, arguments);
|
|
2447
|
+
}
|
|
2448
|
+
}
|
|
2449
|
+
exports.log = log;
|
|
2450
|
+
function convertErrorOutput(msg) {
|
|
2451
|
+
if (typeof msg !== "string") {
|
|
2452
|
+
throw new TypeError("input must be a string");
|
|
2453
|
+
}
|
|
2454
|
+
return msg.replace(/\\/g, "/");
|
|
2455
|
+
}
|
|
2456
|
+
exports.convertErrorOutput = convertErrorOutput;
|
|
2457
|
+
function error(msg, _code, options) {
|
|
2458
|
+
if (typeof msg !== "string")
|
|
2459
|
+
throw new Error("msg must be a string");
|
|
2460
|
+
var DEFAULT_OPTIONS = {
|
|
2461
|
+
continue: false,
|
|
2462
|
+
code: 1,
|
|
2463
|
+
prefix: state.currentCmd + ": ",
|
|
2464
|
+
silent: false
|
|
2465
|
+
};
|
|
2466
|
+
if (typeof _code === "number" && isObject(options)) {
|
|
2467
|
+
options.code = _code;
|
|
2468
|
+
} else if (isObject(_code)) {
|
|
2469
|
+
options = _code;
|
|
2470
|
+
} else if (typeof _code === "number") {
|
|
2471
|
+
options = { code: _code };
|
|
2472
|
+
} else if (typeof _code !== "number") {
|
|
2473
|
+
options = {};
|
|
2474
|
+
}
|
|
2475
|
+
options = Object.assign({}, DEFAULT_OPTIONS, options);
|
|
2476
|
+
if (!state.errorCode)
|
|
2477
|
+
state.errorCode = options.code;
|
|
2478
|
+
var logEntry = convertErrorOutput(options.prefix + msg);
|
|
2479
|
+
state.error = state.error ? state.error + "\n" : "";
|
|
2480
|
+
state.error += logEntry;
|
|
2481
|
+
if (config.fatal)
|
|
2482
|
+
throw new Error(logEntry);
|
|
2483
|
+
if (msg.length > 0 && !options.silent)
|
|
2484
|
+
log(logEntry);
|
|
2485
|
+
if (!options.continue) {
|
|
2486
|
+
throw {
|
|
2487
|
+
msg: "earlyExit",
|
|
2488
|
+
retValue: new ShellString("", state.error, state.errorCode)
|
|
2489
|
+
};
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2492
|
+
exports.error = error;
|
|
2493
|
+
function ShellString(stdout, stderr, code) {
|
|
2494
|
+
var that;
|
|
2495
|
+
if (stdout instanceof Array) {
|
|
2496
|
+
that = stdout;
|
|
2497
|
+
that.stdout = stdout.join("\n");
|
|
2498
|
+
if (stdout.length > 0)
|
|
2499
|
+
that.stdout += "\n";
|
|
2500
|
+
} else {
|
|
2501
|
+
that = new String(stdout);
|
|
2502
|
+
that.stdout = stdout;
|
|
2503
|
+
}
|
|
2504
|
+
that.stderr = stderr;
|
|
2505
|
+
that.code = code;
|
|
2506
|
+
pipeMethods.forEach(function(cmd) {
|
|
2507
|
+
that[cmd] = shellMethods[cmd].bind(that);
|
|
2508
|
+
});
|
|
2509
|
+
return that;
|
|
2510
|
+
}
|
|
2511
|
+
exports.ShellString = ShellString;
|
|
2512
|
+
function parseOptions(opt, map, errorOptions) {
|
|
2513
|
+
if (typeof opt !== "string" && !isObject(opt)) {
|
|
2514
|
+
throw new Error("options must be strings or key-value pairs");
|
|
2515
|
+
} else if (!isObject(map)) {
|
|
2516
|
+
throw new Error("parseOptions() internal error: map must be an object");
|
|
2517
|
+
} else if (errorOptions && !isObject(errorOptions)) {
|
|
2518
|
+
throw new Error("parseOptions() internal error: errorOptions must be object");
|
|
2519
|
+
}
|
|
2520
|
+
if (opt === "--") {
|
|
2521
|
+
return {};
|
|
2522
|
+
}
|
|
2523
|
+
var options = {};
|
|
2524
|
+
Object.keys(map).forEach(function(letter) {
|
|
2525
|
+
var optName = map[letter];
|
|
2526
|
+
if (optName[0] !== "!") {
|
|
2527
|
+
options[optName] = false;
|
|
2528
|
+
}
|
|
2529
|
+
});
|
|
2530
|
+
if (opt === "")
|
|
2531
|
+
return options;
|
|
2532
|
+
if (typeof opt === "string") {
|
|
2533
|
+
if (opt[0] !== "-") {
|
|
2534
|
+
throw new Error("Options string must start with a '-'");
|
|
2535
|
+
}
|
|
2536
|
+
var chars = opt.slice(1).split("");
|
|
2537
|
+
chars.forEach(function(c) {
|
|
2538
|
+
if (c in map) {
|
|
2539
|
+
var optionName = map[c];
|
|
2540
|
+
if (optionName[0] === "!") {
|
|
2541
|
+
options[optionName.slice(1)] = false;
|
|
2542
|
+
} else {
|
|
2543
|
+
options[optionName] = true;
|
|
2544
|
+
}
|
|
2545
|
+
} else {
|
|
2546
|
+
error("option not recognized: " + c, errorOptions || {});
|
|
2547
|
+
}
|
|
2548
|
+
});
|
|
2549
|
+
} else {
|
|
2550
|
+
Object.keys(opt).forEach(function(key) {
|
|
2551
|
+
var c = key[1];
|
|
2552
|
+
if (c in map) {
|
|
2553
|
+
var optionName = map[c];
|
|
2554
|
+
options[optionName] = opt[key];
|
|
2555
|
+
} else {
|
|
2556
|
+
error("option not recognized: " + c, errorOptions || {});
|
|
2557
|
+
}
|
|
2558
|
+
});
|
|
2559
|
+
}
|
|
2560
|
+
return options;
|
|
2561
|
+
}
|
|
2562
|
+
exports.parseOptions = parseOptions;
|
|
2563
|
+
function expand(list) {
|
|
2564
|
+
if (!Array.isArray(list)) {
|
|
2565
|
+
throw new TypeError("must be an array");
|
|
2566
|
+
}
|
|
2567
|
+
var expanded = [];
|
|
2568
|
+
list.forEach(function(listEl) {
|
|
2569
|
+
if (typeof listEl !== "string") {
|
|
2570
|
+
expanded.push(listEl);
|
|
2571
|
+
} else {
|
|
2572
|
+
var ret;
|
|
2573
|
+
try {
|
|
2574
|
+
ret = glob.sync(listEl, config.globOptions);
|
|
2575
|
+
ret = ret.length > 0 ? ret : [listEl];
|
|
2576
|
+
} catch (e) {
|
|
2577
|
+
ret = [listEl];
|
|
2578
|
+
}
|
|
2579
|
+
expanded = expanded.concat(ret);
|
|
2580
|
+
}
|
|
2581
|
+
});
|
|
2582
|
+
return expanded;
|
|
2583
|
+
}
|
|
2584
|
+
exports.expand = expand;
|
|
2585
|
+
var buffer = typeof Buffer.alloc === "function" ? function(len) {
|
|
2586
|
+
return Buffer.alloc(len || config.bufLength);
|
|
2587
|
+
} : function(len) {
|
|
2588
|
+
return new Buffer(len || config.bufLength);
|
|
2589
|
+
};
|
|
2590
|
+
exports.buffer = buffer;
|
|
2591
|
+
function unlinkSync(file) {
|
|
2592
|
+
try {
|
|
2593
|
+
fs.unlinkSync(file);
|
|
2594
|
+
} catch (e) {
|
|
2595
|
+
if (e.code === "EPERM") {
|
|
2596
|
+
fs.chmodSync(file, "0666");
|
|
2597
|
+
fs.unlinkSync(file);
|
|
2598
|
+
} else {
|
|
2599
|
+
throw e;
|
|
2600
|
+
}
|
|
2601
|
+
}
|
|
2602
|
+
}
|
|
2603
|
+
exports.unlinkSync = unlinkSync;
|
|
2604
|
+
function statFollowLinks() {
|
|
2605
|
+
return fs.statSync.apply(fs, arguments);
|
|
2606
|
+
}
|
|
2607
|
+
exports.statFollowLinks = statFollowLinks;
|
|
2608
|
+
function statNoFollowLinks() {
|
|
2609
|
+
return fs.lstatSync.apply(fs, arguments);
|
|
2610
|
+
}
|
|
2611
|
+
exports.statNoFollowLinks = statNoFollowLinks;
|
|
2612
|
+
function randomFileName() {
|
|
2613
|
+
function randomHash(count) {
|
|
2614
|
+
if (count === 1) {
|
|
2615
|
+
return parseInt(16 * Math.random(), 10).toString(16);
|
|
2616
|
+
}
|
|
2617
|
+
var hash = "";
|
|
2618
|
+
for (var i = 0; i < count; i++) {
|
|
2619
|
+
hash += randomHash(1);
|
|
2620
|
+
}
|
|
2621
|
+
return hash;
|
|
2622
|
+
}
|
|
2623
|
+
return "shelljs_" + randomHash(20);
|
|
2624
|
+
}
|
|
2625
|
+
exports.randomFileName = randomFileName;
|
|
2626
|
+
function wrap(cmd, fn, options) {
|
|
2627
|
+
options = options || {};
|
|
2628
|
+
return function() {
|
|
2629
|
+
var retValue = null;
|
|
2630
|
+
state.currentCmd = cmd;
|
|
2631
|
+
state.error = null;
|
|
2632
|
+
state.errorCode = 0;
|
|
2633
|
+
try {
|
|
2634
|
+
var args = [].slice.call(arguments, 0);
|
|
2635
|
+
if (config.verbose) {
|
|
2636
|
+
console.error.apply(console, [cmd].concat(args));
|
|
2637
|
+
}
|
|
2638
|
+
state.pipedValue = this && typeof this.stdout === "string" ? this.stdout : "";
|
|
2639
|
+
if (options.unix === false) {
|
|
2640
|
+
retValue = fn.apply(this, args);
|
|
2641
|
+
} else {
|
|
2642
|
+
if (isObject(args[0]) && args[0].constructor.name === "Object") {
|
|
2643
|
+
} else if (args.length === 0 || typeof args[0] !== "string" || args[0].length <= 1 || args[0][0] !== "-") {
|
|
2644
|
+
args.unshift("");
|
|
2645
|
+
}
|
|
2646
|
+
args = args.reduce(function(accum, cur) {
|
|
2647
|
+
if (Array.isArray(cur)) {
|
|
2648
|
+
return accum.concat(cur);
|
|
2649
|
+
}
|
|
2650
|
+
accum.push(cur);
|
|
2651
|
+
return accum;
|
|
2652
|
+
}, []);
|
|
2653
|
+
args = args.map(function(arg) {
|
|
2654
|
+
if (isObject(arg) && arg.constructor.name === "String") {
|
|
2655
|
+
return arg.toString();
|
|
2656
|
+
}
|
|
2657
|
+
return arg;
|
|
2658
|
+
});
|
|
2659
|
+
var homeDir = os.homedir();
|
|
2660
|
+
args = args.map(function(arg) {
|
|
2661
|
+
if (typeof arg === "string" && arg.slice(0, 2) === "~/" || arg === "~") {
|
|
2662
|
+
return arg.replace(/^~/, homeDir);
|
|
2663
|
+
}
|
|
2664
|
+
return arg;
|
|
2665
|
+
});
|
|
2666
|
+
if (!config.noglob && options.allowGlobbing === true) {
|
|
2667
|
+
args = args.slice(0, options.globStart).concat(expand(args.slice(options.globStart)));
|
|
2668
|
+
}
|
|
2669
|
+
try {
|
|
2670
|
+
if (isObject(options.cmdOptions)) {
|
|
2671
|
+
args[0] = parseOptions(args[0], options.cmdOptions);
|
|
2672
|
+
}
|
|
2673
|
+
retValue = fn.apply(this, args);
|
|
2674
|
+
} catch (e) {
|
|
2675
|
+
if (e.msg === "earlyExit") {
|
|
2676
|
+
retValue = e.retValue;
|
|
2677
|
+
} else {
|
|
2678
|
+
throw e;
|
|
2679
|
+
}
|
|
2680
|
+
}
|
|
2681
|
+
}
|
|
2682
|
+
} catch (e) {
|
|
2683
|
+
if (!state.error) {
|
|
2684
|
+
e.name = "ShellJSInternalError";
|
|
2685
|
+
throw e;
|
|
2686
|
+
}
|
|
2687
|
+
if (config.fatal)
|
|
2688
|
+
throw e;
|
|
2689
|
+
}
|
|
2690
|
+
if (options.wrapOutput && (typeof retValue === "string" || Array.isArray(retValue))) {
|
|
2691
|
+
retValue = new ShellString(retValue, state.error, state.errorCode);
|
|
2692
|
+
}
|
|
2693
|
+
state.currentCmd = "shell.js";
|
|
2694
|
+
return retValue;
|
|
2695
|
+
};
|
|
2696
|
+
}
|
|
2697
|
+
exports.wrap = wrap;
|
|
2698
|
+
function _readFromPipe() {
|
|
2699
|
+
return state.pipedValue;
|
|
2700
|
+
}
|
|
2701
|
+
exports.readFromPipe = _readFromPipe;
|
|
2702
|
+
var DEFAULT_WRAP_OPTIONS = {
|
|
2703
|
+
allowGlobbing: true,
|
|
2704
|
+
canReceivePipe: false,
|
|
2705
|
+
cmdOptions: null,
|
|
2706
|
+
globStart: 1,
|
|
2707
|
+
pipeOnly: false,
|
|
2708
|
+
wrapOutput: true,
|
|
2709
|
+
unix: true
|
|
2710
|
+
};
|
|
2711
|
+
var pipeMethods = [];
|
|
2712
|
+
function _register(name, implementation, wrapOptions) {
|
|
2713
|
+
wrapOptions = wrapOptions || {};
|
|
2714
|
+
Object.keys(wrapOptions).forEach(function(option) {
|
|
2715
|
+
if (!DEFAULT_WRAP_OPTIONS.hasOwnProperty(option)) {
|
|
2716
|
+
throw new Error("Unknown option '" + option + "'");
|
|
2717
|
+
}
|
|
2718
|
+
if (typeof wrapOptions[option] !== typeof DEFAULT_WRAP_OPTIONS[option]) {
|
|
2719
|
+
throw new TypeError("Unsupported type '" + typeof wrapOptions[option] + "' for option '" + option + "'");
|
|
2720
|
+
}
|
|
2721
|
+
});
|
|
2722
|
+
wrapOptions = Object.assign({}, DEFAULT_WRAP_OPTIONS, wrapOptions);
|
|
2723
|
+
if (shell.hasOwnProperty(name)) {
|
|
2724
|
+
throw new Error("Command `" + name + "` already exists");
|
|
2725
|
+
}
|
|
2726
|
+
if (wrapOptions.pipeOnly) {
|
|
2727
|
+
wrapOptions.canReceivePipe = true;
|
|
2728
|
+
shellMethods[name] = wrap(name, implementation, wrapOptions);
|
|
2729
|
+
} else {
|
|
2730
|
+
shell[name] = wrap(name, implementation, wrapOptions);
|
|
2731
|
+
}
|
|
2732
|
+
if (wrapOptions.canReceivePipe) {
|
|
2733
|
+
pipeMethods.push(name);
|
|
2734
|
+
}
|
|
2735
|
+
}
|
|
2736
|
+
exports.register = _register;
|
|
2737
|
+
}
|
|
2738
|
+
});
|
|
2739
|
+
|
|
2740
|
+
// node_modules/shelljs/src/cat.js
|
|
2741
|
+
var require_cat = __commonJS({
|
|
2742
|
+
"node_modules/shelljs/src/cat.js"(exports, module) {
|
|
2743
|
+
init_cjs_shims();
|
|
2744
|
+
var common = require_common2();
|
|
2745
|
+
var fs = __require("fs");
|
|
2746
|
+
common.register("cat", _cat, {
|
|
2747
|
+
canReceivePipe: true,
|
|
2748
|
+
cmdOptions: {
|
|
2749
|
+
"n": "number"
|
|
2750
|
+
}
|
|
2751
|
+
});
|
|
2752
|
+
function _cat(options, files) {
|
|
2753
|
+
var cat = common.readFromPipe();
|
|
2754
|
+
if (!files && !cat)
|
|
2755
|
+
common.error("no paths given");
|
|
2756
|
+
files = [].slice.call(arguments, 1);
|
|
2757
|
+
files.forEach(function(file) {
|
|
2758
|
+
if (!fs.existsSync(file)) {
|
|
2759
|
+
common.error("no such file or directory: " + file);
|
|
2760
|
+
} else if (common.statFollowLinks(file).isDirectory()) {
|
|
2761
|
+
common.error(file + ": Is a directory");
|
|
2762
|
+
}
|
|
2763
|
+
cat += fs.readFileSync(file, "utf8");
|
|
2764
|
+
});
|
|
2765
|
+
if (options.number) {
|
|
2766
|
+
cat = addNumbers(cat);
|
|
2767
|
+
}
|
|
2768
|
+
return cat;
|
|
2769
|
+
}
|
|
2770
|
+
module.exports = _cat;
|
|
2771
|
+
function addNumbers(cat) {
|
|
2772
|
+
var lines = cat.split("\n");
|
|
2773
|
+
var lastLine = lines.pop();
|
|
2774
|
+
lines = lines.map(function(line, i) {
|
|
2775
|
+
return numberedLine(i + 1, line);
|
|
2776
|
+
});
|
|
2777
|
+
if (lastLine.length) {
|
|
2778
|
+
lastLine = numberedLine(lines.length + 1, lastLine);
|
|
2779
|
+
}
|
|
2780
|
+
lines.push(lastLine);
|
|
2781
|
+
return lines.join("\n");
|
|
2782
|
+
}
|
|
2783
|
+
function numberedLine(n, line) {
|
|
2784
|
+
var number = (" " + n).slice(-6) + " ";
|
|
2785
|
+
return number + line;
|
|
2786
|
+
}
|
|
2787
|
+
}
|
|
2788
|
+
});
|
|
2789
|
+
|
|
2790
|
+
// node_modules/shelljs/src/cd.js
|
|
2791
|
+
var require_cd = __commonJS({
|
|
2792
|
+
"node_modules/shelljs/src/cd.js"(exports, module) {
|
|
2793
|
+
init_cjs_shims();
|
|
2794
|
+
var os = __require("os");
|
|
2795
|
+
var common = require_common2();
|
|
2796
|
+
common.register("cd", _cd, {});
|
|
2797
|
+
function _cd(options, dir) {
|
|
2798
|
+
if (!dir)
|
|
2799
|
+
dir = os.homedir();
|
|
2800
|
+
if (dir === "-") {
|
|
2801
|
+
if (!process.env.OLDPWD) {
|
|
2802
|
+
common.error("could not find previous directory");
|
|
2803
|
+
} else {
|
|
2804
|
+
dir = process.env.OLDPWD;
|
|
2805
|
+
}
|
|
2806
|
+
}
|
|
2807
|
+
try {
|
|
2808
|
+
var curDir = process.cwd();
|
|
2809
|
+
process.chdir(dir);
|
|
2810
|
+
process.env.OLDPWD = curDir;
|
|
2811
|
+
} catch (e) {
|
|
2812
|
+
var err;
|
|
2813
|
+
try {
|
|
2814
|
+
common.statFollowLinks(dir);
|
|
2815
|
+
err = "not a directory: " + dir;
|
|
2816
|
+
} catch (e2) {
|
|
2817
|
+
err = "no such file or directory: " + dir;
|
|
2818
|
+
}
|
|
2819
|
+
if (err)
|
|
2820
|
+
common.error(err);
|
|
2821
|
+
}
|
|
2822
|
+
return "";
|
|
2823
|
+
}
|
|
2824
|
+
module.exports = _cd;
|
|
2825
|
+
}
|
|
2826
|
+
});
|
|
2827
|
+
|
|
2828
|
+
// node_modules/shelljs/src/chmod.js
|
|
2829
|
+
var require_chmod = __commonJS({
|
|
2830
|
+
"node_modules/shelljs/src/chmod.js"(exports, module) {
|
|
2831
|
+
init_cjs_shims();
|
|
2832
|
+
var common = require_common2();
|
|
2833
|
+
var fs = __require("fs");
|
|
2834
|
+
var path = __require("path");
|
|
2835
|
+
var PERMS = function(base) {
|
|
2836
|
+
return {
|
|
2837
|
+
OTHER_EXEC: base.EXEC,
|
|
2838
|
+
OTHER_WRITE: base.WRITE,
|
|
2839
|
+
OTHER_READ: base.READ,
|
|
2840
|
+
GROUP_EXEC: base.EXEC << 3,
|
|
2841
|
+
GROUP_WRITE: base.WRITE << 3,
|
|
2842
|
+
GROUP_READ: base.READ << 3,
|
|
2843
|
+
OWNER_EXEC: base.EXEC << 6,
|
|
2844
|
+
OWNER_WRITE: base.WRITE << 6,
|
|
2845
|
+
OWNER_READ: base.READ << 6,
|
|
2846
|
+
// Literal octal numbers are apparently not allowed in "strict" javascript.
|
|
2847
|
+
STICKY: parseInt("01000", 8),
|
|
2848
|
+
SETGID: parseInt("02000", 8),
|
|
2849
|
+
SETUID: parseInt("04000", 8),
|
|
2850
|
+
TYPE_MASK: parseInt("0770000", 8)
|
|
2851
|
+
};
|
|
2852
|
+
}({
|
|
2853
|
+
EXEC: 1,
|
|
2854
|
+
WRITE: 2,
|
|
2855
|
+
READ: 4
|
|
2856
|
+
});
|
|
2857
|
+
common.register("chmod", _chmod, {});
|
|
2858
|
+
function _chmod(options, mode, filePattern) {
|
|
2859
|
+
if (!filePattern) {
|
|
2860
|
+
if (options.length > 0 && options.charAt(0) === "-") {
|
|
2861
|
+
[].unshift.call(arguments, "");
|
|
2862
|
+
} else {
|
|
2863
|
+
common.error("You must specify a file.");
|
|
2864
|
+
}
|
|
2865
|
+
}
|
|
2866
|
+
options = common.parseOptions(options, {
|
|
2867
|
+
"R": "recursive",
|
|
2868
|
+
"c": "changes",
|
|
2869
|
+
"v": "verbose"
|
|
2870
|
+
});
|
|
2871
|
+
filePattern = [].slice.call(arguments, 2);
|
|
2872
|
+
var files;
|
|
2873
|
+
if (options.recursive) {
|
|
2874
|
+
files = [];
|
|
2875
|
+
filePattern.forEach(function addFile(expandedFile) {
|
|
2876
|
+
var stat = common.statNoFollowLinks(expandedFile);
|
|
2877
|
+
if (!stat.isSymbolicLink()) {
|
|
2878
|
+
files.push(expandedFile);
|
|
2879
|
+
if (stat.isDirectory()) {
|
|
2880
|
+
fs.readdirSync(expandedFile).forEach(function(child) {
|
|
2881
|
+
addFile(expandedFile + "/" + child);
|
|
2882
|
+
});
|
|
2883
|
+
}
|
|
2884
|
+
}
|
|
2885
|
+
});
|
|
2886
|
+
} else {
|
|
2887
|
+
files = filePattern;
|
|
2888
|
+
}
|
|
2889
|
+
files.forEach(function innerChmod(file) {
|
|
2890
|
+
file = path.resolve(file);
|
|
2891
|
+
if (!fs.existsSync(file)) {
|
|
2892
|
+
common.error("File not found: " + file);
|
|
2893
|
+
}
|
|
2894
|
+
if (options.recursive && common.statNoFollowLinks(file).isSymbolicLink()) {
|
|
2895
|
+
return;
|
|
2896
|
+
}
|
|
2897
|
+
var stat = common.statFollowLinks(file);
|
|
2898
|
+
var isDir = stat.isDirectory();
|
|
2899
|
+
var perms = stat.mode;
|
|
2900
|
+
var type = perms & PERMS.TYPE_MASK;
|
|
2901
|
+
var newPerms = perms;
|
|
2902
|
+
if (isNaN(parseInt(mode, 8))) {
|
|
2903
|
+
mode.split(",").forEach(function(symbolicMode) {
|
|
2904
|
+
var pattern = /([ugoa]*)([=\+-])([rwxXst]*)/i;
|
|
2905
|
+
var matches = pattern.exec(symbolicMode);
|
|
2906
|
+
if (matches) {
|
|
2907
|
+
var applyTo = matches[1];
|
|
2908
|
+
var operator = matches[2];
|
|
2909
|
+
var change = matches[3];
|
|
2910
|
+
var changeOwner = applyTo.indexOf("u") !== -1 || applyTo === "a" || applyTo === "";
|
|
2911
|
+
var changeGroup = applyTo.indexOf("g") !== -1 || applyTo === "a" || applyTo === "";
|
|
2912
|
+
var changeOther = applyTo.indexOf("o") !== -1 || applyTo === "a" || applyTo === "";
|
|
2913
|
+
var changeRead = change.indexOf("r") !== -1;
|
|
2914
|
+
var changeWrite = change.indexOf("w") !== -1;
|
|
2915
|
+
var changeExec = change.indexOf("x") !== -1;
|
|
2916
|
+
var changeExecDir = change.indexOf("X") !== -1;
|
|
2917
|
+
var changeSticky = change.indexOf("t") !== -1;
|
|
2918
|
+
var changeSetuid = change.indexOf("s") !== -1;
|
|
2919
|
+
if (changeExecDir && isDir) {
|
|
2920
|
+
changeExec = true;
|
|
2921
|
+
}
|
|
2922
|
+
var mask = 0;
|
|
2923
|
+
if (changeOwner) {
|
|
2924
|
+
mask |= (changeRead ? PERMS.OWNER_READ : 0) + (changeWrite ? PERMS.OWNER_WRITE : 0) + (changeExec ? PERMS.OWNER_EXEC : 0) + (changeSetuid ? PERMS.SETUID : 0);
|
|
2925
|
+
}
|
|
2926
|
+
if (changeGroup) {
|
|
2927
|
+
mask |= (changeRead ? PERMS.GROUP_READ : 0) + (changeWrite ? PERMS.GROUP_WRITE : 0) + (changeExec ? PERMS.GROUP_EXEC : 0) + (changeSetuid ? PERMS.SETGID : 0);
|
|
2928
|
+
}
|
|
2929
|
+
if (changeOther) {
|
|
2930
|
+
mask |= (changeRead ? PERMS.OTHER_READ : 0) + (changeWrite ? PERMS.OTHER_WRITE : 0) + (changeExec ? PERMS.OTHER_EXEC : 0);
|
|
2931
|
+
}
|
|
2932
|
+
if (changeSticky) {
|
|
2933
|
+
mask |= PERMS.STICKY;
|
|
2934
|
+
}
|
|
2935
|
+
switch (operator) {
|
|
2936
|
+
case "+":
|
|
2937
|
+
newPerms |= mask;
|
|
2938
|
+
break;
|
|
2939
|
+
case "-":
|
|
2940
|
+
newPerms &= ~mask;
|
|
2941
|
+
break;
|
|
2942
|
+
case "=":
|
|
2943
|
+
newPerms = type + mask;
|
|
2944
|
+
if (common.statFollowLinks(file).isDirectory()) {
|
|
2945
|
+
newPerms |= PERMS.SETUID + PERMS.SETGID & perms;
|
|
2946
|
+
}
|
|
2947
|
+
break;
|
|
2948
|
+
default:
|
|
2949
|
+
common.error("Could not recognize operator: `" + operator + "`");
|
|
2950
|
+
}
|
|
2951
|
+
if (options.verbose) {
|
|
2952
|
+
console.log(file + " -> " + newPerms.toString(8));
|
|
2953
|
+
}
|
|
2954
|
+
if (perms !== newPerms) {
|
|
2955
|
+
if (!options.verbose && options.changes) {
|
|
2956
|
+
console.log(file + " -> " + newPerms.toString(8));
|
|
2957
|
+
}
|
|
2958
|
+
fs.chmodSync(file, newPerms);
|
|
2959
|
+
perms = newPerms;
|
|
2960
|
+
}
|
|
2961
|
+
} else {
|
|
2962
|
+
common.error("Invalid symbolic mode change: " + symbolicMode);
|
|
2963
|
+
}
|
|
2964
|
+
});
|
|
2965
|
+
} else {
|
|
2966
|
+
newPerms = type + parseInt(mode, 8);
|
|
2967
|
+
if (common.statFollowLinks(file).isDirectory()) {
|
|
2968
|
+
newPerms |= PERMS.SETUID + PERMS.SETGID & perms;
|
|
2969
|
+
}
|
|
2970
|
+
fs.chmodSync(file, newPerms);
|
|
2971
|
+
}
|
|
2972
|
+
});
|
|
2973
|
+
return "";
|
|
2974
|
+
}
|
|
2975
|
+
module.exports = _chmod;
|
|
2976
|
+
}
|
|
2977
|
+
});
|
|
2978
|
+
|
|
2979
|
+
// node_modules/shelljs/src/cp.js
|
|
2980
|
+
var require_cp = __commonJS({
|
|
2981
|
+
"node_modules/shelljs/src/cp.js"(exports, module) {
|
|
2982
|
+
init_cjs_shims();
|
|
2983
|
+
var fs = __require("fs");
|
|
2984
|
+
var path = __require("path");
|
|
2985
|
+
var common = require_common2();
|
|
2986
|
+
common.register("cp", _cp, {
|
|
2987
|
+
cmdOptions: {
|
|
2988
|
+
"f": "!no_force",
|
|
2989
|
+
"n": "no_force",
|
|
2990
|
+
"u": "update",
|
|
2991
|
+
"R": "recursive",
|
|
2992
|
+
"r": "recursive",
|
|
2993
|
+
"L": "followsymlink",
|
|
2994
|
+
"P": "noFollowsymlink"
|
|
2995
|
+
},
|
|
2996
|
+
wrapOutput: false
|
|
2997
|
+
});
|
|
2998
|
+
function copyFileSync(srcFile, destFile, options) {
|
|
2999
|
+
if (!fs.existsSync(srcFile)) {
|
|
3000
|
+
common.error("copyFileSync: no such file or directory: " + srcFile);
|
|
3001
|
+
}
|
|
3002
|
+
var isWindows = process.platform === "win32";
|
|
3003
|
+
try {
|
|
3004
|
+
if (options.update && common.statFollowLinks(srcFile).mtime < fs.statSync(destFile).mtime) {
|
|
3005
|
+
return;
|
|
3006
|
+
}
|
|
3007
|
+
} catch (e) {
|
|
3008
|
+
}
|
|
3009
|
+
if (common.statNoFollowLinks(srcFile).isSymbolicLink() && !options.followsymlink) {
|
|
3010
|
+
try {
|
|
3011
|
+
common.statNoFollowLinks(destFile);
|
|
3012
|
+
common.unlinkSync(destFile);
|
|
3013
|
+
} catch (e) {
|
|
3014
|
+
}
|
|
3015
|
+
var symlinkFull = fs.readlinkSync(srcFile);
|
|
3016
|
+
fs.symlinkSync(symlinkFull, destFile, isWindows ? "junction" : null);
|
|
3017
|
+
} else {
|
|
3018
|
+
var buf = common.buffer();
|
|
3019
|
+
var bufLength = buf.length;
|
|
3020
|
+
var bytesRead = bufLength;
|
|
3021
|
+
var pos = 0;
|
|
3022
|
+
var fdr = null;
|
|
3023
|
+
var fdw = null;
|
|
3024
|
+
try {
|
|
3025
|
+
fdr = fs.openSync(srcFile, "r");
|
|
3026
|
+
} catch (e) {
|
|
3027
|
+
common.error("copyFileSync: could not read src file (" + srcFile + ")");
|
|
3028
|
+
}
|
|
3029
|
+
try {
|
|
3030
|
+
fdw = fs.openSync(destFile, "w");
|
|
3031
|
+
} catch (e) {
|
|
3032
|
+
common.error("copyFileSync: could not write to dest file (code=" + e.code + "):" + destFile);
|
|
3033
|
+
}
|
|
3034
|
+
while (bytesRead === bufLength) {
|
|
3035
|
+
bytesRead = fs.readSync(fdr, buf, 0, bufLength, pos);
|
|
3036
|
+
fs.writeSync(fdw, buf, 0, bytesRead);
|
|
3037
|
+
pos += bytesRead;
|
|
3038
|
+
}
|
|
3039
|
+
fs.closeSync(fdr);
|
|
3040
|
+
fs.closeSync(fdw);
|
|
3041
|
+
fs.chmodSync(destFile, common.statFollowLinks(srcFile).mode);
|
|
3042
|
+
}
|
|
3043
|
+
}
|
|
3044
|
+
function cpdirSyncRecursive(sourceDir, destDir, currentDepth, opts) {
|
|
3045
|
+
if (!opts)
|
|
3046
|
+
opts = {};
|
|
3047
|
+
if (currentDepth >= common.config.maxdepth)
|
|
3048
|
+
return;
|
|
3049
|
+
currentDepth++;
|
|
3050
|
+
var isWindows = process.platform === "win32";
|
|
3051
|
+
try {
|
|
3052
|
+
fs.mkdirSync(destDir);
|
|
3053
|
+
} catch (e) {
|
|
3054
|
+
if (e.code !== "EEXIST")
|
|
3055
|
+
throw e;
|
|
3056
|
+
}
|
|
3057
|
+
var files = fs.readdirSync(sourceDir);
|
|
3058
|
+
for (var i = 0; i < files.length; i++) {
|
|
3059
|
+
var srcFile = sourceDir + "/" + files[i];
|
|
3060
|
+
var destFile = destDir + "/" + files[i];
|
|
3061
|
+
var srcFileStat = common.statNoFollowLinks(srcFile);
|
|
3062
|
+
var symlinkFull;
|
|
3063
|
+
if (opts.followsymlink) {
|
|
3064
|
+
if (cpcheckcycle(sourceDir, srcFile)) {
|
|
3065
|
+
console.error("Cycle link found.");
|
|
3066
|
+
symlinkFull = fs.readlinkSync(srcFile);
|
|
3067
|
+
fs.symlinkSync(symlinkFull, destFile, isWindows ? "junction" : null);
|
|
3068
|
+
continue;
|
|
3069
|
+
}
|
|
3070
|
+
}
|
|
3071
|
+
if (srcFileStat.isDirectory()) {
|
|
3072
|
+
cpdirSyncRecursive(srcFile, destFile, currentDepth, opts);
|
|
3073
|
+
} else if (srcFileStat.isSymbolicLink() && !opts.followsymlink) {
|
|
3074
|
+
symlinkFull = fs.readlinkSync(srcFile);
|
|
3075
|
+
try {
|
|
3076
|
+
common.statNoFollowLinks(destFile);
|
|
3077
|
+
common.unlinkSync(destFile);
|
|
3078
|
+
} catch (e) {
|
|
3079
|
+
}
|
|
3080
|
+
fs.symlinkSync(symlinkFull, destFile, isWindows ? "junction" : null);
|
|
3081
|
+
} else if (srcFileStat.isSymbolicLink() && opts.followsymlink) {
|
|
3082
|
+
srcFileStat = common.statFollowLinks(srcFile);
|
|
3083
|
+
if (srcFileStat.isDirectory()) {
|
|
3084
|
+
cpdirSyncRecursive(srcFile, destFile, currentDepth, opts);
|
|
3085
|
+
} else {
|
|
3086
|
+
copyFileSync(srcFile, destFile, opts);
|
|
3087
|
+
}
|
|
3088
|
+
} else {
|
|
3089
|
+
if (fs.existsSync(destFile) && opts.no_force) {
|
|
3090
|
+
common.log("skipping existing file: " + files[i]);
|
|
3091
|
+
} else {
|
|
3092
|
+
copyFileSync(srcFile, destFile, opts);
|
|
3093
|
+
}
|
|
3094
|
+
}
|
|
3095
|
+
}
|
|
3096
|
+
var checkDir = common.statFollowLinks(sourceDir);
|
|
3097
|
+
fs.chmodSync(destDir, checkDir.mode);
|
|
3098
|
+
}
|
|
3099
|
+
function checkRecentCreated(sources, index) {
|
|
3100
|
+
var lookedSource = sources[index];
|
|
3101
|
+
return sources.slice(0, index).some(function(src) {
|
|
3102
|
+
return path.basename(src) === path.basename(lookedSource);
|
|
3103
|
+
});
|
|
3104
|
+
}
|
|
3105
|
+
function cpcheckcycle(sourceDir, srcFile) {
|
|
3106
|
+
var srcFileStat = common.statNoFollowLinks(srcFile);
|
|
3107
|
+
if (srcFileStat.isSymbolicLink()) {
|
|
3108
|
+
var cyclecheck = common.statFollowLinks(srcFile);
|
|
3109
|
+
if (cyclecheck.isDirectory()) {
|
|
3110
|
+
var sourcerealpath = fs.realpathSync(sourceDir);
|
|
3111
|
+
var symlinkrealpath = fs.realpathSync(srcFile);
|
|
3112
|
+
var re = new RegExp(symlinkrealpath);
|
|
3113
|
+
if (re.test(sourcerealpath)) {
|
|
3114
|
+
return true;
|
|
3115
|
+
}
|
|
3116
|
+
}
|
|
3117
|
+
}
|
|
3118
|
+
return false;
|
|
3119
|
+
}
|
|
3120
|
+
function _cp(options, sources, dest) {
|
|
3121
|
+
if (options.followsymlink) {
|
|
3122
|
+
options.noFollowsymlink = false;
|
|
3123
|
+
}
|
|
3124
|
+
if (!options.recursive && !options.noFollowsymlink) {
|
|
3125
|
+
options.followsymlink = true;
|
|
3126
|
+
}
|
|
3127
|
+
if (arguments.length < 3) {
|
|
3128
|
+
common.error("missing <source> and/or <dest>");
|
|
3129
|
+
} else {
|
|
3130
|
+
sources = [].slice.call(arguments, 1, arguments.length - 1);
|
|
3131
|
+
dest = arguments[arguments.length - 1];
|
|
3132
|
+
}
|
|
3133
|
+
var destExists = fs.existsSync(dest);
|
|
3134
|
+
var destStat = destExists && common.statFollowLinks(dest);
|
|
3135
|
+
if ((!destExists || !destStat.isDirectory()) && sources.length > 1) {
|
|
3136
|
+
common.error("dest is not a directory (too many sources)");
|
|
3137
|
+
}
|
|
3138
|
+
if (destExists && destStat.isFile() && options.no_force) {
|
|
3139
|
+
return new common.ShellString("", "", 0);
|
|
3140
|
+
}
|
|
3141
|
+
sources.forEach(function(src, srcIndex) {
|
|
3142
|
+
if (!fs.existsSync(src)) {
|
|
3143
|
+
if (src === "")
|
|
3144
|
+
src = "''";
|
|
3145
|
+
common.error("no such file or directory: " + src, { continue: true });
|
|
3146
|
+
return;
|
|
3147
|
+
}
|
|
3148
|
+
var srcStat = common.statFollowLinks(src);
|
|
3149
|
+
if (!options.noFollowsymlink && srcStat.isDirectory()) {
|
|
3150
|
+
if (!options.recursive) {
|
|
3151
|
+
common.error("omitting directory '" + src + "'", { continue: true });
|
|
3152
|
+
} else {
|
|
3153
|
+
var newDest = destStat && destStat.isDirectory() ? path.join(dest, path.basename(src)) : dest;
|
|
3154
|
+
try {
|
|
3155
|
+
common.statFollowLinks(path.dirname(dest));
|
|
3156
|
+
cpdirSyncRecursive(src, newDest, 0, { no_force: options.no_force, followsymlink: options.followsymlink });
|
|
3157
|
+
} catch (e) {
|
|
3158
|
+
common.error("cannot create directory '" + dest + "': No such file or directory");
|
|
3159
|
+
}
|
|
3160
|
+
}
|
|
3161
|
+
} else {
|
|
3162
|
+
var thisDest = dest;
|
|
3163
|
+
if (destStat && destStat.isDirectory()) {
|
|
3164
|
+
thisDest = path.normalize(dest + "/" + path.basename(src));
|
|
3165
|
+
}
|
|
3166
|
+
var thisDestExists = fs.existsSync(thisDest);
|
|
3167
|
+
if (thisDestExists && checkRecentCreated(sources, srcIndex)) {
|
|
3168
|
+
if (!options.no_force) {
|
|
3169
|
+
common.error("will not overwrite just-created '" + thisDest + "' with '" + src + "'", { continue: true });
|
|
3170
|
+
}
|
|
3171
|
+
return;
|
|
3172
|
+
}
|
|
3173
|
+
if (thisDestExists && options.no_force) {
|
|
3174
|
+
return;
|
|
3175
|
+
}
|
|
3176
|
+
if (path.relative(src, thisDest) === "") {
|
|
3177
|
+
common.error("'" + thisDest + "' and '" + src + "' are the same file", { continue: true });
|
|
3178
|
+
return;
|
|
3179
|
+
}
|
|
3180
|
+
copyFileSync(src, thisDest, options);
|
|
3181
|
+
}
|
|
3182
|
+
});
|
|
3183
|
+
return new common.ShellString("", common.state.error, common.state.errorCode);
|
|
3184
|
+
}
|
|
3185
|
+
module.exports = _cp;
|
|
3186
|
+
}
|
|
3187
|
+
});
|
|
3188
|
+
|
|
3189
|
+
// node_modules/shelljs/src/dirs.js
|
|
3190
|
+
var require_dirs = __commonJS({
|
|
3191
|
+
"node_modules/shelljs/src/dirs.js"(exports) {
|
|
3192
|
+
init_cjs_shims();
|
|
3193
|
+
var common = require_common2();
|
|
3194
|
+
var _cd = require_cd();
|
|
3195
|
+
var path = __require("path");
|
|
3196
|
+
common.register("dirs", _dirs, {
|
|
3197
|
+
wrapOutput: false
|
|
3198
|
+
});
|
|
3199
|
+
common.register("pushd", _pushd, {
|
|
3200
|
+
wrapOutput: false
|
|
3201
|
+
});
|
|
3202
|
+
common.register("popd", _popd, {
|
|
3203
|
+
wrapOutput: false
|
|
3204
|
+
});
|
|
3205
|
+
var _dirStack = [];
|
|
3206
|
+
function _isStackIndex(index) {
|
|
3207
|
+
return /^[\-+]\d+$/.test(index);
|
|
3208
|
+
}
|
|
3209
|
+
function _parseStackIndex(index) {
|
|
3210
|
+
if (_isStackIndex(index)) {
|
|
3211
|
+
if (Math.abs(index) < _dirStack.length + 1) {
|
|
3212
|
+
return /^-/.test(index) ? Number(index) - 1 : Number(index);
|
|
3213
|
+
}
|
|
3214
|
+
common.error(index + ": directory stack index out of range");
|
|
3215
|
+
} else {
|
|
3216
|
+
common.error(index + ": invalid number");
|
|
3217
|
+
}
|
|
3218
|
+
}
|
|
3219
|
+
function _actualDirStack() {
|
|
3220
|
+
return [process.cwd()].concat(_dirStack);
|
|
3221
|
+
}
|
|
3222
|
+
function _pushd(options, dir) {
|
|
3223
|
+
if (_isStackIndex(options)) {
|
|
3224
|
+
dir = options;
|
|
3225
|
+
options = "";
|
|
3226
|
+
}
|
|
3227
|
+
options = common.parseOptions(options, {
|
|
3228
|
+
"n": "no-cd",
|
|
3229
|
+
"q": "quiet"
|
|
3230
|
+
});
|
|
3231
|
+
var dirs = _actualDirStack();
|
|
3232
|
+
if (dir === "+0") {
|
|
3233
|
+
return dirs;
|
|
3234
|
+
} else if (!dir) {
|
|
3235
|
+
if (dirs.length > 1) {
|
|
3236
|
+
dirs = dirs.splice(1, 1).concat(dirs);
|
|
3237
|
+
} else {
|
|
3238
|
+
return common.error("no other directory");
|
|
3239
|
+
}
|
|
3240
|
+
} else if (_isStackIndex(dir)) {
|
|
3241
|
+
var n = _parseStackIndex(dir);
|
|
3242
|
+
dirs = dirs.slice(n).concat(dirs.slice(0, n));
|
|
3243
|
+
} else {
|
|
3244
|
+
if (options["no-cd"]) {
|
|
3245
|
+
dirs.splice(1, 0, dir);
|
|
3246
|
+
} else {
|
|
3247
|
+
dirs.unshift(dir);
|
|
3248
|
+
}
|
|
3249
|
+
}
|
|
3250
|
+
if (options["no-cd"]) {
|
|
3251
|
+
dirs = dirs.slice(1);
|
|
3252
|
+
} else {
|
|
3253
|
+
dir = path.resolve(dirs.shift());
|
|
3254
|
+
_cd("", dir);
|
|
3255
|
+
}
|
|
3256
|
+
_dirStack = dirs;
|
|
3257
|
+
return _dirs(options.quiet ? "-q" : "");
|
|
3258
|
+
}
|
|
3259
|
+
exports.pushd = _pushd;
|
|
3260
|
+
function _popd(options, index) {
|
|
3261
|
+
if (_isStackIndex(options)) {
|
|
3262
|
+
index = options;
|
|
3263
|
+
options = "";
|
|
3264
|
+
}
|
|
3265
|
+
options = common.parseOptions(options, {
|
|
3266
|
+
"n": "no-cd",
|
|
3267
|
+
"q": "quiet"
|
|
3268
|
+
});
|
|
3269
|
+
if (!_dirStack.length) {
|
|
3270
|
+
return common.error("directory stack empty");
|
|
3271
|
+
}
|
|
3272
|
+
index = _parseStackIndex(index || "+0");
|
|
3273
|
+
if (options["no-cd"] || index > 0 || _dirStack.length + index === 0) {
|
|
3274
|
+
index = index > 0 ? index - 1 : index;
|
|
3275
|
+
_dirStack.splice(index, 1);
|
|
3276
|
+
} else {
|
|
3277
|
+
var dir = path.resolve(_dirStack.shift());
|
|
3278
|
+
_cd("", dir);
|
|
3279
|
+
}
|
|
3280
|
+
return _dirs(options.quiet ? "-q" : "");
|
|
3281
|
+
}
|
|
3282
|
+
exports.popd = _popd;
|
|
3283
|
+
function _dirs(options, index) {
|
|
3284
|
+
if (_isStackIndex(options)) {
|
|
3285
|
+
index = options;
|
|
3286
|
+
options = "";
|
|
3287
|
+
}
|
|
3288
|
+
options = common.parseOptions(options, {
|
|
3289
|
+
"c": "clear",
|
|
3290
|
+
"q": "quiet"
|
|
3291
|
+
});
|
|
3292
|
+
if (options.clear) {
|
|
3293
|
+
_dirStack = [];
|
|
3294
|
+
return _dirStack;
|
|
3295
|
+
}
|
|
3296
|
+
var stack = _actualDirStack();
|
|
3297
|
+
if (index) {
|
|
3298
|
+
index = _parseStackIndex(index);
|
|
3299
|
+
if (index < 0) {
|
|
3300
|
+
index = stack.length + index;
|
|
3301
|
+
}
|
|
3302
|
+
if (!options.quiet) {
|
|
3303
|
+
common.log(stack[index]);
|
|
3304
|
+
}
|
|
3305
|
+
return stack[index];
|
|
3306
|
+
}
|
|
3307
|
+
if (!options.quiet) {
|
|
3308
|
+
common.log(stack.join(" "));
|
|
3309
|
+
}
|
|
3310
|
+
return stack;
|
|
3311
|
+
}
|
|
3312
|
+
exports.dirs = _dirs;
|
|
3313
|
+
}
|
|
3314
|
+
});
|
|
3315
|
+
|
|
3316
|
+
// node_modules/shelljs/src/echo.js
|
|
3317
|
+
var require_echo = __commonJS({
|
|
3318
|
+
"node_modules/shelljs/src/echo.js"(exports, module) {
|
|
3319
|
+
init_cjs_shims();
|
|
3320
|
+
var format = __require("util").format;
|
|
3321
|
+
var common = require_common2();
|
|
3322
|
+
common.register("echo", _echo, {
|
|
3323
|
+
allowGlobbing: false
|
|
3324
|
+
});
|
|
3325
|
+
function _echo(opts) {
|
|
3326
|
+
var messages = [].slice.call(arguments, opts ? 0 : 1);
|
|
3327
|
+
var options = {};
|
|
3328
|
+
try {
|
|
3329
|
+
options = common.parseOptions(messages[0], {
|
|
3330
|
+
"e": "escapes",
|
|
3331
|
+
"n": "no_newline"
|
|
3332
|
+
}, {
|
|
3333
|
+
silent: true
|
|
3334
|
+
});
|
|
3335
|
+
if (messages[0]) {
|
|
3336
|
+
messages.shift();
|
|
3337
|
+
}
|
|
3338
|
+
} catch (_) {
|
|
3339
|
+
common.state.error = null;
|
|
3340
|
+
}
|
|
3341
|
+
var output = format.apply(null, messages);
|
|
3342
|
+
if (!options.no_newline) {
|
|
3343
|
+
output += "\n";
|
|
3344
|
+
}
|
|
3345
|
+
process.stdout.write(output);
|
|
3346
|
+
return output;
|
|
3347
|
+
}
|
|
3348
|
+
module.exports = _echo;
|
|
3349
|
+
}
|
|
3350
|
+
});
|
|
3351
|
+
|
|
3352
|
+
// node_modules/shelljs/src/error.js
|
|
3353
|
+
var require_error = __commonJS({
|
|
3354
|
+
"node_modules/shelljs/src/error.js"(exports, module) {
|
|
3355
|
+
init_cjs_shims();
|
|
3356
|
+
var common = require_common2();
|
|
3357
|
+
function error() {
|
|
3358
|
+
return common.state.error;
|
|
3359
|
+
}
|
|
3360
|
+
module.exports = error;
|
|
3361
|
+
}
|
|
3362
|
+
});
|
|
3363
|
+
|
|
3364
|
+
// node_modules/shelljs/src/exec-child.js
|
|
3365
|
+
var require_exec_child = __commonJS({
|
|
3366
|
+
"node_modules/shelljs/src/exec-child.js"(exports, module) {
|
|
3367
|
+
init_cjs_shims();
|
|
3368
|
+
if (__require.main !== module) {
|
|
3369
|
+
throw new Error("This file should not be required");
|
|
3370
|
+
}
|
|
3371
|
+
var childProcess = __require("child_process");
|
|
3372
|
+
var fs = __require("fs");
|
|
3373
|
+
var paramFilePath = process.argv[2];
|
|
3374
|
+
var serializedParams = fs.readFileSync(paramFilePath, "utf8");
|
|
3375
|
+
var params = JSON.parse(serializedParams);
|
|
3376
|
+
var cmd = params.command;
|
|
3377
|
+
var execOptions = params.execOptions;
|
|
3378
|
+
var pipe = params.pipe;
|
|
3379
|
+
var stdoutFile = params.stdoutFile;
|
|
3380
|
+
var stderrFile = params.stderrFile;
|
|
3381
|
+
var c = childProcess.exec(cmd, execOptions, function(err) {
|
|
3382
|
+
if (!err) {
|
|
3383
|
+
process.exitCode = 0;
|
|
3384
|
+
} else if (err.code === void 0) {
|
|
3385
|
+
process.exitCode = 1;
|
|
3386
|
+
} else {
|
|
3387
|
+
process.exitCode = err.code;
|
|
3388
|
+
}
|
|
3389
|
+
});
|
|
3390
|
+
var stdoutStream = fs.createWriteStream(stdoutFile);
|
|
3391
|
+
var stderrStream = fs.createWriteStream(stderrFile);
|
|
3392
|
+
c.stdout.pipe(stdoutStream);
|
|
3393
|
+
c.stderr.pipe(stderrStream);
|
|
3394
|
+
c.stdout.pipe(process.stdout);
|
|
3395
|
+
c.stderr.pipe(process.stderr);
|
|
3396
|
+
if (pipe) {
|
|
3397
|
+
c.stdin.end(pipe);
|
|
3398
|
+
}
|
|
3399
|
+
}
|
|
3400
|
+
});
|
|
3401
|
+
|
|
3402
|
+
// node_modules/shelljs/src/tempdir.js
|
|
3403
|
+
var require_tempdir = __commonJS({
|
|
3404
|
+
"node_modules/shelljs/src/tempdir.js"(exports, module) {
|
|
3405
|
+
init_cjs_shims();
|
|
3406
|
+
var common = require_common2();
|
|
3407
|
+
var os = __require("os");
|
|
3408
|
+
var fs = __require("fs");
|
|
3409
|
+
common.register("tempdir", _tempDir, {
|
|
3410
|
+
allowGlobbing: false,
|
|
3411
|
+
wrapOutput: false
|
|
3412
|
+
});
|
|
3413
|
+
function writeableDir(dir) {
|
|
3414
|
+
if (!dir || !fs.existsSync(dir))
|
|
3415
|
+
return false;
|
|
3416
|
+
if (!common.statFollowLinks(dir).isDirectory())
|
|
3417
|
+
return false;
|
|
3418
|
+
var testFile = dir + "/" + common.randomFileName();
|
|
3419
|
+
try {
|
|
3420
|
+
fs.writeFileSync(testFile, " ");
|
|
3421
|
+
common.unlinkSync(testFile);
|
|
3422
|
+
return dir;
|
|
3423
|
+
} catch (e) {
|
|
3424
|
+
return false;
|
|
3425
|
+
}
|
|
3426
|
+
}
|
|
3427
|
+
var cachedTempDir;
|
|
3428
|
+
function _tempDir() {
|
|
3429
|
+
if (cachedTempDir)
|
|
3430
|
+
return cachedTempDir;
|
|
3431
|
+
cachedTempDir = writeableDir(os.tmpdir()) || writeableDir(process.env.TMPDIR) || writeableDir(process.env.TEMP) || writeableDir(process.env.TMP) || writeableDir(process.env.Wimp$ScrapDir) || // RiscOS
|
|
3432
|
+
writeableDir("C:\\TEMP") || // Windows
|
|
3433
|
+
writeableDir("C:\\TMP") || // Windows
|
|
3434
|
+
writeableDir("\\TEMP") || // Windows
|
|
3435
|
+
writeableDir("\\TMP") || // Windows
|
|
3436
|
+
writeableDir("/tmp") || writeableDir("/var/tmp") || writeableDir("/usr/tmp") || writeableDir(".");
|
|
3437
|
+
return cachedTempDir;
|
|
3438
|
+
}
|
|
3439
|
+
function isCached() {
|
|
3440
|
+
return cachedTempDir;
|
|
3441
|
+
}
|
|
3442
|
+
function clearCache() {
|
|
3443
|
+
cachedTempDir = void 0;
|
|
3444
|
+
}
|
|
3445
|
+
module.exports.tempDir = _tempDir;
|
|
3446
|
+
module.exports.isCached = isCached;
|
|
3447
|
+
module.exports.clearCache = clearCache;
|
|
3448
|
+
}
|
|
3449
|
+
});
|
|
3450
|
+
|
|
3451
|
+
// node_modules/shelljs/src/pwd.js
|
|
3452
|
+
var require_pwd = __commonJS({
|
|
3453
|
+
"node_modules/shelljs/src/pwd.js"(exports, module) {
|
|
3454
|
+
init_cjs_shims();
|
|
3455
|
+
var path = __require("path");
|
|
3456
|
+
var common = require_common2();
|
|
3457
|
+
common.register("pwd", _pwd, {
|
|
3458
|
+
allowGlobbing: false
|
|
3459
|
+
});
|
|
3460
|
+
function _pwd() {
|
|
3461
|
+
var pwd = path.resolve(process.cwd());
|
|
3462
|
+
return pwd;
|
|
3463
|
+
}
|
|
3464
|
+
module.exports = _pwd;
|
|
3465
|
+
}
|
|
3466
|
+
});
|
|
3467
|
+
|
|
3468
|
+
// node_modules/shelljs/src/exec.js
|
|
3469
|
+
var require_exec = __commonJS({
|
|
3470
|
+
"node_modules/shelljs/src/exec.js"(exports, module) {
|
|
3471
|
+
init_cjs_shims();
|
|
3472
|
+
var common = require_common2();
|
|
3473
|
+
var _tempDir = require_tempdir().tempDir;
|
|
3474
|
+
var _pwd = require_pwd();
|
|
3475
|
+
var path = __require("path");
|
|
3476
|
+
var fs = __require("fs");
|
|
3477
|
+
var child = __require("child_process");
|
|
3478
|
+
var DEFAULT_MAXBUFFER_SIZE = 20 * 1024 * 1024;
|
|
3479
|
+
var DEFAULT_ERROR_CODE = 1;
|
|
3480
|
+
common.register("exec", _exec, {
|
|
3481
|
+
unix: false,
|
|
3482
|
+
canReceivePipe: true,
|
|
3483
|
+
wrapOutput: false
|
|
3484
|
+
});
|
|
3485
|
+
function execSync(cmd, opts, pipe) {
|
|
3486
|
+
if (!common.config.execPath) {
|
|
3487
|
+
common.error("Unable to find a path to the node binary. Please manually set config.execPath");
|
|
3488
|
+
}
|
|
3489
|
+
var tempDir = _tempDir();
|
|
3490
|
+
var paramsFile = path.resolve(tempDir + "/" + common.randomFileName());
|
|
3491
|
+
var stderrFile = path.resolve(tempDir + "/" + common.randomFileName());
|
|
3492
|
+
var stdoutFile = path.resolve(tempDir + "/" + common.randomFileName());
|
|
3493
|
+
opts = common.extend({
|
|
3494
|
+
silent: common.config.silent,
|
|
3495
|
+
cwd: _pwd().toString(),
|
|
3496
|
+
env: process.env,
|
|
3497
|
+
maxBuffer: DEFAULT_MAXBUFFER_SIZE,
|
|
3498
|
+
encoding: "utf8"
|
|
3499
|
+
}, opts);
|
|
3500
|
+
if (fs.existsSync(paramsFile))
|
|
3501
|
+
common.unlinkSync(paramsFile);
|
|
3502
|
+
if (fs.existsSync(stderrFile))
|
|
3503
|
+
common.unlinkSync(stderrFile);
|
|
3504
|
+
if (fs.existsSync(stdoutFile))
|
|
3505
|
+
common.unlinkSync(stdoutFile);
|
|
3506
|
+
opts.cwd = path.resolve(opts.cwd);
|
|
3507
|
+
var paramsToSerialize = {
|
|
3508
|
+
command: cmd,
|
|
3509
|
+
execOptions: opts,
|
|
3510
|
+
pipe,
|
|
3511
|
+
stdoutFile,
|
|
3512
|
+
stderrFile
|
|
3513
|
+
};
|
|
3514
|
+
function writeFileLockedDown(filePath, data) {
|
|
3515
|
+
fs.writeFileSync(filePath, data, {
|
|
3516
|
+
encoding: "utf8",
|
|
3517
|
+
mode: parseInt("600", 8)
|
|
3518
|
+
});
|
|
3519
|
+
}
|
|
3520
|
+
writeFileLockedDown(stdoutFile, "");
|
|
3521
|
+
writeFileLockedDown(stderrFile, "");
|
|
3522
|
+
writeFileLockedDown(paramsFile, JSON.stringify(paramsToSerialize));
|
|
3523
|
+
var execArgs = [
|
|
3524
|
+
path.join(__dirname, "exec-child.js"),
|
|
3525
|
+
paramsFile
|
|
3526
|
+
];
|
|
3527
|
+
if (opts.silent) {
|
|
3528
|
+
opts.stdio = "ignore";
|
|
3529
|
+
} else {
|
|
3530
|
+
opts.stdio = [0, 1, 2];
|
|
3531
|
+
}
|
|
3532
|
+
var code = 0;
|
|
3533
|
+
try {
|
|
3534
|
+
delete opts.shell;
|
|
3535
|
+
child.execFileSync(common.config.execPath, execArgs, opts);
|
|
3536
|
+
} catch (e) {
|
|
3537
|
+
code = e.status || DEFAULT_ERROR_CODE;
|
|
3538
|
+
}
|
|
3539
|
+
var stdout = "";
|
|
3540
|
+
var stderr = "";
|
|
3541
|
+
if (opts.encoding === "buffer") {
|
|
3542
|
+
stdout = fs.readFileSync(stdoutFile);
|
|
3543
|
+
stderr = fs.readFileSync(stderrFile);
|
|
3544
|
+
} else {
|
|
3545
|
+
stdout = fs.readFileSync(stdoutFile, opts.encoding);
|
|
3546
|
+
stderr = fs.readFileSync(stderrFile, opts.encoding);
|
|
3547
|
+
}
|
|
3548
|
+
try {
|
|
3549
|
+
common.unlinkSync(paramsFile);
|
|
3550
|
+
} catch (e) {
|
|
3551
|
+
}
|
|
3552
|
+
try {
|
|
3553
|
+
common.unlinkSync(stderrFile);
|
|
3554
|
+
} catch (e) {
|
|
3555
|
+
}
|
|
3556
|
+
try {
|
|
3557
|
+
common.unlinkSync(stdoutFile);
|
|
3558
|
+
} catch (e) {
|
|
3559
|
+
}
|
|
3560
|
+
if (code !== 0) {
|
|
3561
|
+
common.error(stderr, code, { continue: true, silent: true });
|
|
3562
|
+
}
|
|
3563
|
+
var obj = common.ShellString(stdout, stderr, code);
|
|
3564
|
+
return obj;
|
|
3565
|
+
}
|
|
3566
|
+
function execAsync(cmd, opts, pipe, callback) {
|
|
3567
|
+
opts = common.extend({
|
|
3568
|
+
silent: common.config.silent,
|
|
3569
|
+
cwd: _pwd().toString(),
|
|
3570
|
+
env: process.env,
|
|
3571
|
+
maxBuffer: DEFAULT_MAXBUFFER_SIZE,
|
|
3572
|
+
encoding: "utf8"
|
|
3573
|
+
}, opts);
|
|
3574
|
+
var c = child.exec(cmd, opts, function(err, stdout, stderr) {
|
|
3575
|
+
if (callback) {
|
|
3576
|
+
if (!err) {
|
|
3577
|
+
callback(0, stdout, stderr);
|
|
3578
|
+
} else if (err.code === void 0) {
|
|
3579
|
+
callback(1, stdout, stderr);
|
|
3580
|
+
} else {
|
|
3581
|
+
callback(err.code, stdout, stderr);
|
|
3582
|
+
}
|
|
3583
|
+
}
|
|
3584
|
+
});
|
|
3585
|
+
if (pipe)
|
|
3586
|
+
c.stdin.end(pipe);
|
|
3587
|
+
if (!opts.silent) {
|
|
3588
|
+
c.stdout.pipe(process.stdout);
|
|
3589
|
+
c.stderr.pipe(process.stderr);
|
|
3590
|
+
}
|
|
3591
|
+
return c;
|
|
3592
|
+
}
|
|
3593
|
+
function _exec(command, options, callback) {
|
|
3594
|
+
options = options || {};
|
|
3595
|
+
if (!command)
|
|
3596
|
+
common.error("must specify command");
|
|
3597
|
+
var pipe = common.readFromPipe();
|
|
3598
|
+
if (typeof options === "function") {
|
|
3599
|
+
callback = options;
|
|
3600
|
+
options = { async: true };
|
|
3601
|
+
}
|
|
3602
|
+
if (typeof options === "object" && typeof callback === "function") {
|
|
3603
|
+
options.async = true;
|
|
3604
|
+
}
|
|
3605
|
+
options = common.extend({
|
|
3606
|
+
silent: common.config.silent,
|
|
3607
|
+
async: false
|
|
3608
|
+
}, options);
|
|
3609
|
+
if (options.async) {
|
|
3610
|
+
return execAsync(command, options, pipe, callback);
|
|
3611
|
+
} else {
|
|
3612
|
+
return execSync(command, options, pipe);
|
|
3613
|
+
}
|
|
3614
|
+
}
|
|
3615
|
+
module.exports = _exec;
|
|
3616
|
+
}
|
|
3617
|
+
});
|
|
3618
|
+
|
|
3619
|
+
// node_modules/shelljs/src/ls.js
|
|
3620
|
+
var require_ls = __commonJS({
|
|
3621
|
+
"node_modules/shelljs/src/ls.js"(exports, module) {
|
|
3622
|
+
init_cjs_shims();
|
|
3623
|
+
var path = __require("path");
|
|
3624
|
+
var fs = __require("fs");
|
|
3625
|
+
var common = require_common2();
|
|
3626
|
+
var glob = require_glob();
|
|
3627
|
+
var globPatternRecursive = path.sep + "**";
|
|
3628
|
+
common.register("ls", _ls, {
|
|
3629
|
+
cmdOptions: {
|
|
3630
|
+
"R": "recursive",
|
|
3631
|
+
"A": "all",
|
|
3632
|
+
"L": "link",
|
|
3633
|
+
"a": "all_deprecated",
|
|
3634
|
+
"d": "directory",
|
|
3635
|
+
"l": "long"
|
|
3636
|
+
}
|
|
3637
|
+
});
|
|
3638
|
+
function _ls(options, paths) {
|
|
3639
|
+
if (options.all_deprecated) {
|
|
3640
|
+
common.log("ls: Option -a is deprecated. Use -A instead");
|
|
3641
|
+
options.all = true;
|
|
3642
|
+
}
|
|
3643
|
+
if (!paths) {
|
|
3644
|
+
paths = ["."];
|
|
3645
|
+
} else {
|
|
3646
|
+
paths = [].slice.call(arguments, 1);
|
|
3647
|
+
}
|
|
3648
|
+
var list = [];
|
|
3649
|
+
function pushFile(abs, relName, stat) {
|
|
3650
|
+
if (process.platform === "win32") {
|
|
3651
|
+
relName = relName.replace(/\\/g, "/");
|
|
3652
|
+
}
|
|
3653
|
+
if (options.long) {
|
|
3654
|
+
stat = stat || (options.link ? common.statFollowLinks(abs) : common.statNoFollowLinks(abs));
|
|
3655
|
+
list.push(addLsAttributes(relName, stat));
|
|
3656
|
+
} else {
|
|
3657
|
+
list.push(relName);
|
|
3658
|
+
}
|
|
3659
|
+
}
|
|
3660
|
+
paths.forEach(function(p) {
|
|
3661
|
+
var stat;
|
|
3662
|
+
try {
|
|
3663
|
+
stat = options.link ? common.statFollowLinks(p) : common.statNoFollowLinks(p);
|
|
3664
|
+
if (stat.isSymbolicLink()) {
|
|
3665
|
+
try {
|
|
3666
|
+
var _stat = common.statFollowLinks(p);
|
|
3667
|
+
if (_stat.isDirectory()) {
|
|
3668
|
+
stat = _stat;
|
|
3669
|
+
}
|
|
3670
|
+
} catch (_) {
|
|
3671
|
+
}
|
|
3672
|
+
}
|
|
3673
|
+
} catch (e) {
|
|
3674
|
+
common.error("no such file or directory: " + p, 2, { continue: true });
|
|
3675
|
+
return;
|
|
3676
|
+
}
|
|
3677
|
+
if (stat.isDirectory() && !options.directory) {
|
|
3678
|
+
if (options.recursive) {
|
|
3679
|
+
glob.sync(p + globPatternRecursive, { dot: options.all, follow: options.link }).forEach(function(item) {
|
|
3680
|
+
if (path.relative(p, item)) {
|
|
3681
|
+
pushFile(item, path.relative(p, item));
|
|
3682
|
+
}
|
|
3683
|
+
});
|
|
3684
|
+
} else if (options.all) {
|
|
3685
|
+
fs.readdirSync(p).forEach(function(item) {
|
|
3686
|
+
pushFile(path.join(p, item), item);
|
|
3687
|
+
});
|
|
3688
|
+
} else {
|
|
3689
|
+
fs.readdirSync(p).forEach(function(item) {
|
|
3690
|
+
if (item[0] !== ".") {
|
|
3691
|
+
pushFile(path.join(p, item), item);
|
|
3692
|
+
}
|
|
3693
|
+
});
|
|
3694
|
+
}
|
|
3695
|
+
} else {
|
|
3696
|
+
pushFile(p, p, stat);
|
|
3697
|
+
}
|
|
3698
|
+
});
|
|
3699
|
+
return list;
|
|
3700
|
+
}
|
|
3701
|
+
function addLsAttributes(pathName, stats) {
|
|
3702
|
+
stats.name = pathName;
|
|
3703
|
+
stats.toString = function() {
|
|
3704
|
+
return [this.mode, this.nlink, this.uid, this.gid, this.size, this.mtime, this.name].join(" ");
|
|
3705
|
+
};
|
|
3706
|
+
return stats;
|
|
3707
|
+
}
|
|
3708
|
+
module.exports = _ls;
|
|
3709
|
+
}
|
|
3710
|
+
});
|
|
3711
|
+
|
|
3712
|
+
// node_modules/shelljs/src/find.js
|
|
3713
|
+
var require_find = __commonJS({
|
|
3714
|
+
"node_modules/shelljs/src/find.js"(exports, module) {
|
|
3715
|
+
init_cjs_shims();
|
|
3716
|
+
var path = __require("path");
|
|
3717
|
+
var common = require_common2();
|
|
3718
|
+
var _ls = require_ls();
|
|
3719
|
+
common.register("find", _find, {});
|
|
3720
|
+
function _find(options, paths) {
|
|
3721
|
+
if (!paths) {
|
|
3722
|
+
common.error("no path specified");
|
|
3723
|
+
} else if (typeof paths === "string") {
|
|
3724
|
+
paths = [].slice.call(arguments, 1);
|
|
3725
|
+
}
|
|
3726
|
+
var list = [];
|
|
3727
|
+
function pushFile(file) {
|
|
3728
|
+
if (process.platform === "win32") {
|
|
3729
|
+
file = file.replace(/\\/g, "/");
|
|
3730
|
+
}
|
|
3731
|
+
list.push(file);
|
|
3732
|
+
}
|
|
3733
|
+
paths.forEach(function(file) {
|
|
3734
|
+
var stat;
|
|
3735
|
+
try {
|
|
3736
|
+
stat = common.statFollowLinks(file);
|
|
3737
|
+
} catch (e) {
|
|
3738
|
+
common.error("no such file or directory: " + file);
|
|
3739
|
+
}
|
|
3740
|
+
pushFile(file);
|
|
3741
|
+
if (stat.isDirectory()) {
|
|
3742
|
+
_ls({ recursive: true, all: true }, file).forEach(function(subfile) {
|
|
3743
|
+
pushFile(path.join(file, subfile));
|
|
3744
|
+
});
|
|
3745
|
+
}
|
|
3746
|
+
});
|
|
3747
|
+
return list;
|
|
3748
|
+
}
|
|
3749
|
+
module.exports = _find;
|
|
3750
|
+
}
|
|
3751
|
+
});
|
|
3752
|
+
|
|
3753
|
+
// node_modules/shelljs/src/grep.js
|
|
3754
|
+
var require_grep = __commonJS({
|
|
3755
|
+
"node_modules/shelljs/src/grep.js"(exports, module) {
|
|
3756
|
+
init_cjs_shims();
|
|
3757
|
+
var common = require_common2();
|
|
3758
|
+
var fs = __require("fs");
|
|
3759
|
+
common.register("grep", _grep, {
|
|
3760
|
+
globStart: 2,
|
|
3761
|
+
// don't glob-expand the regex
|
|
3762
|
+
canReceivePipe: true,
|
|
3763
|
+
cmdOptions: {
|
|
3764
|
+
"v": "inverse",
|
|
3765
|
+
"l": "nameOnly",
|
|
3766
|
+
"i": "ignoreCase"
|
|
3767
|
+
}
|
|
3768
|
+
});
|
|
3769
|
+
function _grep(options, regex, files) {
|
|
3770
|
+
var pipe = common.readFromPipe();
|
|
3771
|
+
if (!files && !pipe)
|
|
3772
|
+
common.error("no paths given", 2);
|
|
3773
|
+
files = [].slice.call(arguments, 2);
|
|
3774
|
+
if (pipe) {
|
|
3775
|
+
files.unshift("-");
|
|
3776
|
+
}
|
|
3777
|
+
var grep = [];
|
|
3778
|
+
if (options.ignoreCase) {
|
|
3779
|
+
regex = new RegExp(regex, "i");
|
|
3780
|
+
}
|
|
3781
|
+
files.forEach(function(file) {
|
|
3782
|
+
if (!fs.existsSync(file) && file !== "-") {
|
|
3783
|
+
common.error("no such file or directory: " + file, 2, { continue: true });
|
|
3784
|
+
return;
|
|
3785
|
+
}
|
|
3786
|
+
var contents = file === "-" ? pipe : fs.readFileSync(file, "utf8");
|
|
3787
|
+
if (options.nameOnly) {
|
|
3788
|
+
if (contents.match(regex)) {
|
|
3789
|
+
grep.push(file);
|
|
3790
|
+
}
|
|
3791
|
+
} else {
|
|
3792
|
+
var lines = contents.split("\n");
|
|
3793
|
+
lines.forEach(function(line) {
|
|
3794
|
+
var matched = line.match(regex);
|
|
3795
|
+
if (options.inverse && !matched || !options.inverse && matched) {
|
|
3796
|
+
grep.push(line);
|
|
3797
|
+
}
|
|
3798
|
+
});
|
|
3799
|
+
}
|
|
3800
|
+
});
|
|
3801
|
+
return grep.join("\n") + "\n";
|
|
3802
|
+
}
|
|
3803
|
+
module.exports = _grep;
|
|
3804
|
+
}
|
|
3805
|
+
});
|
|
3806
|
+
|
|
3807
|
+
// node_modules/shelljs/src/head.js
|
|
3808
|
+
var require_head = __commonJS({
|
|
3809
|
+
"node_modules/shelljs/src/head.js"(exports, module) {
|
|
3810
|
+
init_cjs_shims();
|
|
3811
|
+
var common = require_common2();
|
|
3812
|
+
var fs = __require("fs");
|
|
3813
|
+
common.register("head", _head, {
|
|
3814
|
+
canReceivePipe: true,
|
|
3815
|
+
cmdOptions: {
|
|
3816
|
+
"n": "numLines"
|
|
3817
|
+
}
|
|
3818
|
+
});
|
|
3819
|
+
function readSomeLines(file, numLines) {
|
|
3820
|
+
var buf = common.buffer();
|
|
3821
|
+
var bufLength = buf.length;
|
|
3822
|
+
var bytesRead = bufLength;
|
|
3823
|
+
var pos = 0;
|
|
3824
|
+
var fdr = fs.openSync(file, "r");
|
|
3825
|
+
var numLinesRead = 0;
|
|
3826
|
+
var ret = "";
|
|
3827
|
+
while (bytesRead === bufLength && numLinesRead < numLines) {
|
|
3828
|
+
bytesRead = fs.readSync(fdr, buf, 0, bufLength, pos);
|
|
3829
|
+
var bufStr = buf.toString("utf8", 0, bytesRead);
|
|
3830
|
+
numLinesRead += bufStr.split("\n").length - 1;
|
|
3831
|
+
ret += bufStr;
|
|
3832
|
+
pos += bytesRead;
|
|
3833
|
+
}
|
|
3834
|
+
fs.closeSync(fdr);
|
|
3835
|
+
return ret;
|
|
3836
|
+
}
|
|
3837
|
+
function _head(options, files) {
|
|
3838
|
+
var head = [];
|
|
3839
|
+
var pipe = common.readFromPipe();
|
|
3840
|
+
if (!files && !pipe)
|
|
3841
|
+
common.error("no paths given");
|
|
3842
|
+
var idx = 1;
|
|
3843
|
+
if (options.numLines === true) {
|
|
3844
|
+
idx = 2;
|
|
3845
|
+
options.numLines = Number(arguments[1]);
|
|
3846
|
+
} else if (options.numLines === false) {
|
|
3847
|
+
options.numLines = 10;
|
|
3848
|
+
}
|
|
3849
|
+
files = [].slice.call(arguments, idx);
|
|
3850
|
+
if (pipe) {
|
|
3851
|
+
files.unshift("-");
|
|
3852
|
+
}
|
|
3853
|
+
var shouldAppendNewline = false;
|
|
3854
|
+
files.forEach(function(file) {
|
|
3855
|
+
if (file !== "-") {
|
|
3856
|
+
if (!fs.existsSync(file)) {
|
|
3857
|
+
common.error("no such file or directory: " + file, { continue: true });
|
|
3858
|
+
return;
|
|
3859
|
+
} else if (common.statFollowLinks(file).isDirectory()) {
|
|
3860
|
+
common.error("error reading '" + file + "': Is a directory", {
|
|
3861
|
+
continue: true
|
|
3862
|
+
});
|
|
3863
|
+
return;
|
|
3864
|
+
}
|
|
3865
|
+
}
|
|
3866
|
+
var contents;
|
|
3867
|
+
if (file === "-") {
|
|
3868
|
+
contents = pipe;
|
|
3869
|
+
} else if (options.numLines < 0) {
|
|
3870
|
+
contents = fs.readFileSync(file, "utf8");
|
|
3871
|
+
} else {
|
|
3872
|
+
contents = readSomeLines(file, options.numLines);
|
|
3873
|
+
}
|
|
3874
|
+
var lines = contents.split("\n");
|
|
3875
|
+
var hasTrailingNewline = lines[lines.length - 1] === "";
|
|
3876
|
+
if (hasTrailingNewline) {
|
|
3877
|
+
lines.pop();
|
|
3878
|
+
}
|
|
3879
|
+
shouldAppendNewline = hasTrailingNewline || options.numLines < lines.length;
|
|
3880
|
+
head = head.concat(lines.slice(0, options.numLines));
|
|
3881
|
+
});
|
|
3882
|
+
if (shouldAppendNewline) {
|
|
3883
|
+
head.push("");
|
|
3884
|
+
}
|
|
3885
|
+
return head.join("\n");
|
|
3886
|
+
}
|
|
3887
|
+
module.exports = _head;
|
|
3888
|
+
}
|
|
3889
|
+
});
|
|
3890
|
+
|
|
3891
|
+
// node_modules/shelljs/src/ln.js
|
|
3892
|
+
var require_ln = __commonJS({
|
|
3893
|
+
"node_modules/shelljs/src/ln.js"(exports, module) {
|
|
3894
|
+
init_cjs_shims();
|
|
3895
|
+
var fs = __require("fs");
|
|
3896
|
+
var path = __require("path");
|
|
3897
|
+
var common = require_common2();
|
|
3898
|
+
common.register("ln", _ln, {
|
|
3899
|
+
cmdOptions: {
|
|
3900
|
+
"s": "symlink",
|
|
3901
|
+
"f": "force"
|
|
3902
|
+
}
|
|
3903
|
+
});
|
|
3904
|
+
function _ln(options, source, dest) {
|
|
3905
|
+
if (!source || !dest) {
|
|
3906
|
+
common.error("Missing <source> and/or <dest>");
|
|
3907
|
+
}
|
|
3908
|
+
source = String(source);
|
|
3909
|
+
var sourcePath = path.normalize(source).replace(RegExp(path.sep + "$"), "");
|
|
3910
|
+
var isAbsolute = path.resolve(source) === sourcePath;
|
|
3911
|
+
dest = path.resolve(process.cwd(), String(dest));
|
|
3912
|
+
if (fs.existsSync(dest)) {
|
|
3913
|
+
if (!options.force) {
|
|
3914
|
+
common.error("Destination file exists", { continue: true });
|
|
3915
|
+
}
|
|
3916
|
+
fs.unlinkSync(dest);
|
|
3917
|
+
}
|
|
3918
|
+
if (options.symlink) {
|
|
3919
|
+
var isWindows = process.platform === "win32";
|
|
3920
|
+
var linkType = isWindows ? "file" : null;
|
|
3921
|
+
var resolvedSourcePath = isAbsolute ? sourcePath : path.resolve(process.cwd(), path.dirname(dest), source);
|
|
3922
|
+
if (!fs.existsSync(resolvedSourcePath)) {
|
|
3923
|
+
common.error("Source file does not exist", { continue: true });
|
|
3924
|
+
} else if (isWindows && common.statFollowLinks(resolvedSourcePath).isDirectory()) {
|
|
3925
|
+
linkType = "junction";
|
|
3926
|
+
}
|
|
3927
|
+
try {
|
|
3928
|
+
fs.symlinkSync(linkType === "junction" ? resolvedSourcePath : source, dest, linkType);
|
|
3929
|
+
} catch (err) {
|
|
3930
|
+
common.error(err.message);
|
|
3931
|
+
}
|
|
3932
|
+
} else {
|
|
3933
|
+
if (!fs.existsSync(source)) {
|
|
3934
|
+
common.error("Source file does not exist", { continue: true });
|
|
3935
|
+
}
|
|
3936
|
+
try {
|
|
3937
|
+
fs.linkSync(source, dest);
|
|
3938
|
+
} catch (err) {
|
|
3939
|
+
common.error(err.message);
|
|
3940
|
+
}
|
|
3941
|
+
}
|
|
3942
|
+
return "";
|
|
3943
|
+
}
|
|
3944
|
+
module.exports = _ln;
|
|
3945
|
+
}
|
|
3946
|
+
});
|
|
3947
|
+
|
|
3948
|
+
// node_modules/shelljs/src/mkdir.js
|
|
3949
|
+
var require_mkdir = __commonJS({
|
|
3950
|
+
"node_modules/shelljs/src/mkdir.js"(exports, module) {
|
|
3951
|
+
init_cjs_shims();
|
|
3952
|
+
var common = require_common2();
|
|
3953
|
+
var fs = __require("fs");
|
|
3954
|
+
var path = __require("path");
|
|
3955
|
+
common.register("mkdir", _mkdir, {
|
|
3956
|
+
cmdOptions: {
|
|
3957
|
+
"p": "fullpath"
|
|
3958
|
+
}
|
|
3959
|
+
});
|
|
3960
|
+
function mkdirSyncRecursive(dir) {
|
|
3961
|
+
var baseDir = path.dirname(dir);
|
|
3962
|
+
if (baseDir === dir) {
|
|
3963
|
+
common.error("dirname() failed: [" + dir + "]");
|
|
3964
|
+
}
|
|
3965
|
+
if (fs.existsSync(baseDir)) {
|
|
3966
|
+
fs.mkdirSync(dir, parseInt("0777", 8));
|
|
3967
|
+
return;
|
|
3968
|
+
}
|
|
3969
|
+
mkdirSyncRecursive(baseDir);
|
|
3970
|
+
fs.mkdirSync(dir, parseInt("0777", 8));
|
|
3971
|
+
}
|
|
3972
|
+
function _mkdir(options, dirs) {
|
|
3973
|
+
if (!dirs)
|
|
3974
|
+
common.error("no paths given");
|
|
3975
|
+
if (typeof dirs === "string") {
|
|
3976
|
+
dirs = [].slice.call(arguments, 1);
|
|
3977
|
+
}
|
|
3978
|
+
dirs.forEach(function(dir) {
|
|
3979
|
+
try {
|
|
3980
|
+
var stat = common.statNoFollowLinks(dir);
|
|
3981
|
+
if (!options.fullpath) {
|
|
3982
|
+
common.error("path already exists: " + dir, { continue: true });
|
|
3983
|
+
} else if (stat.isFile()) {
|
|
3984
|
+
common.error("cannot create directory " + dir + ": File exists", { continue: true });
|
|
3985
|
+
}
|
|
3986
|
+
return;
|
|
3987
|
+
} catch (e) {
|
|
3988
|
+
}
|
|
3989
|
+
var baseDir = path.dirname(dir);
|
|
3990
|
+
if (!fs.existsSync(baseDir) && !options.fullpath) {
|
|
3991
|
+
common.error("no such file or directory: " + baseDir, { continue: true });
|
|
3992
|
+
return;
|
|
3993
|
+
}
|
|
3994
|
+
try {
|
|
3995
|
+
if (options.fullpath) {
|
|
3996
|
+
mkdirSyncRecursive(path.resolve(dir));
|
|
3997
|
+
} else {
|
|
3998
|
+
fs.mkdirSync(dir, parseInt("0777", 8));
|
|
3999
|
+
}
|
|
4000
|
+
} catch (e) {
|
|
4001
|
+
var reason;
|
|
4002
|
+
if (e.code === "EACCES") {
|
|
4003
|
+
reason = "Permission denied";
|
|
4004
|
+
} else if (e.code === "ENOTDIR" || e.code === "ENOENT") {
|
|
4005
|
+
reason = "Not a directory";
|
|
4006
|
+
} else {
|
|
4007
|
+
throw e;
|
|
4008
|
+
}
|
|
4009
|
+
common.error("cannot create directory " + dir + ": " + reason, { continue: true });
|
|
4010
|
+
}
|
|
4011
|
+
});
|
|
4012
|
+
return "";
|
|
4013
|
+
}
|
|
4014
|
+
module.exports = _mkdir;
|
|
4015
|
+
}
|
|
4016
|
+
});
|
|
4017
|
+
|
|
4018
|
+
// node_modules/shelljs/src/rm.js
|
|
4019
|
+
var require_rm = __commonJS({
|
|
4020
|
+
"node_modules/shelljs/src/rm.js"(exports, module) {
|
|
4021
|
+
init_cjs_shims();
|
|
4022
|
+
var common = require_common2();
|
|
4023
|
+
var fs = __require("fs");
|
|
4024
|
+
common.register("rm", _rm, {
|
|
4025
|
+
cmdOptions: {
|
|
4026
|
+
"f": "force",
|
|
4027
|
+
"r": "recursive",
|
|
4028
|
+
"R": "recursive"
|
|
4029
|
+
}
|
|
4030
|
+
});
|
|
4031
|
+
function rmdirSyncRecursive(dir, force, fromSymlink) {
|
|
4032
|
+
var files;
|
|
4033
|
+
files = fs.readdirSync(dir);
|
|
4034
|
+
for (var i = 0; i < files.length; i++) {
|
|
4035
|
+
var file = dir + "/" + files[i];
|
|
4036
|
+
var currFile = common.statNoFollowLinks(file);
|
|
4037
|
+
if (currFile.isDirectory()) {
|
|
4038
|
+
rmdirSyncRecursive(file, force);
|
|
4039
|
+
} else {
|
|
4040
|
+
if (force || isWriteable(file)) {
|
|
4041
|
+
try {
|
|
4042
|
+
common.unlinkSync(file);
|
|
4043
|
+
} catch (e) {
|
|
4044
|
+
common.error("could not remove file (code " + e.code + "): " + file, {
|
|
4045
|
+
continue: true
|
|
4046
|
+
});
|
|
4047
|
+
}
|
|
4048
|
+
}
|
|
4049
|
+
}
|
|
4050
|
+
}
|
|
4051
|
+
if (fromSymlink)
|
|
4052
|
+
return;
|
|
4053
|
+
var result;
|
|
4054
|
+
try {
|
|
4055
|
+
var start = Date.now();
|
|
4056
|
+
for (; ; ) {
|
|
4057
|
+
try {
|
|
4058
|
+
result = fs.rmdirSync(dir);
|
|
4059
|
+
if (fs.existsSync(dir))
|
|
4060
|
+
throw { code: "EAGAIN" };
|
|
4061
|
+
break;
|
|
4062
|
+
} catch (er) {
|
|
4063
|
+
if (process.platform === "win32" && (er.code === "ENOTEMPTY" || er.code === "EBUSY" || er.code === "EPERM" || er.code === "EAGAIN")) {
|
|
4064
|
+
if (Date.now() - start > 1e3)
|
|
4065
|
+
throw er;
|
|
4066
|
+
} else if (er.code === "ENOENT") {
|
|
4067
|
+
break;
|
|
4068
|
+
} else {
|
|
4069
|
+
throw er;
|
|
4070
|
+
}
|
|
4071
|
+
}
|
|
4072
|
+
}
|
|
4073
|
+
} catch (e) {
|
|
4074
|
+
common.error("could not remove directory (code " + e.code + "): " + dir, { continue: true });
|
|
4075
|
+
}
|
|
4076
|
+
return result;
|
|
4077
|
+
}
|
|
4078
|
+
function isWriteable(file) {
|
|
4079
|
+
var writePermission = true;
|
|
4080
|
+
try {
|
|
4081
|
+
var __fd = fs.openSync(file, "a");
|
|
4082
|
+
fs.closeSync(__fd);
|
|
4083
|
+
} catch (e) {
|
|
4084
|
+
writePermission = false;
|
|
4085
|
+
}
|
|
4086
|
+
return writePermission;
|
|
4087
|
+
}
|
|
4088
|
+
function handleFile(file, options) {
|
|
4089
|
+
if (options.force || isWriteable(file)) {
|
|
4090
|
+
common.unlinkSync(file);
|
|
4091
|
+
} else {
|
|
4092
|
+
common.error("permission denied: " + file, { continue: true });
|
|
4093
|
+
}
|
|
4094
|
+
}
|
|
4095
|
+
function handleDirectory(file, options) {
|
|
4096
|
+
if (options.recursive) {
|
|
4097
|
+
rmdirSyncRecursive(file, options.force);
|
|
4098
|
+
} else {
|
|
4099
|
+
common.error("path is a directory", { continue: true });
|
|
4100
|
+
}
|
|
4101
|
+
}
|
|
4102
|
+
function handleSymbolicLink(file, options) {
|
|
4103
|
+
var stats;
|
|
4104
|
+
try {
|
|
4105
|
+
stats = common.statFollowLinks(file);
|
|
4106
|
+
} catch (e) {
|
|
4107
|
+
common.unlinkSync(file);
|
|
4108
|
+
return;
|
|
4109
|
+
}
|
|
4110
|
+
if (stats.isFile()) {
|
|
4111
|
+
common.unlinkSync(file);
|
|
4112
|
+
} else if (stats.isDirectory()) {
|
|
4113
|
+
if (file[file.length - 1] === "/") {
|
|
4114
|
+
if (options.recursive) {
|
|
4115
|
+
var fromSymlink = true;
|
|
4116
|
+
rmdirSyncRecursive(file, options.force, fromSymlink);
|
|
4117
|
+
} else {
|
|
4118
|
+
common.error("path is a directory", { continue: true });
|
|
4119
|
+
}
|
|
4120
|
+
} else {
|
|
4121
|
+
common.unlinkSync(file);
|
|
4122
|
+
}
|
|
4123
|
+
}
|
|
4124
|
+
}
|
|
4125
|
+
function handleFIFO(file) {
|
|
4126
|
+
common.unlinkSync(file);
|
|
4127
|
+
}
|
|
4128
|
+
function _rm(options, files) {
|
|
4129
|
+
if (!files)
|
|
4130
|
+
common.error("no paths given");
|
|
4131
|
+
files = [].slice.call(arguments, 1);
|
|
4132
|
+
files.forEach(function(file) {
|
|
4133
|
+
var lstats;
|
|
4134
|
+
try {
|
|
4135
|
+
var filepath = file[file.length - 1] === "/" ? file.slice(0, -1) : file;
|
|
4136
|
+
lstats = common.statNoFollowLinks(filepath);
|
|
4137
|
+
} catch (e) {
|
|
4138
|
+
if (!options.force) {
|
|
4139
|
+
common.error("no such file or directory: " + file, { continue: true });
|
|
4140
|
+
}
|
|
4141
|
+
return;
|
|
4142
|
+
}
|
|
4143
|
+
if (lstats.isFile()) {
|
|
4144
|
+
handleFile(file, options);
|
|
4145
|
+
} else if (lstats.isDirectory()) {
|
|
4146
|
+
handleDirectory(file, options);
|
|
4147
|
+
} else if (lstats.isSymbolicLink()) {
|
|
4148
|
+
handleSymbolicLink(file, options);
|
|
4149
|
+
} else if (lstats.isFIFO()) {
|
|
4150
|
+
handleFIFO(file);
|
|
4151
|
+
}
|
|
4152
|
+
});
|
|
4153
|
+
return "";
|
|
4154
|
+
}
|
|
4155
|
+
module.exports = _rm;
|
|
4156
|
+
}
|
|
4157
|
+
});
|
|
4158
|
+
|
|
4159
|
+
// node_modules/shelljs/src/mv.js
|
|
4160
|
+
var require_mv = __commonJS({
|
|
4161
|
+
"node_modules/shelljs/src/mv.js"(exports, module) {
|
|
4162
|
+
init_cjs_shims();
|
|
4163
|
+
var fs = __require("fs");
|
|
4164
|
+
var path = __require("path");
|
|
4165
|
+
var common = require_common2();
|
|
4166
|
+
var cp = require_cp();
|
|
4167
|
+
var rm = require_rm();
|
|
4168
|
+
common.register("mv", _mv, {
|
|
4169
|
+
cmdOptions: {
|
|
4170
|
+
"f": "!no_force",
|
|
4171
|
+
"n": "no_force"
|
|
4172
|
+
}
|
|
4173
|
+
});
|
|
4174
|
+
function checkRecentCreated(sources, index) {
|
|
4175
|
+
var lookedSource = sources[index];
|
|
4176
|
+
return sources.slice(0, index).some(function(src) {
|
|
4177
|
+
return path.basename(src) === path.basename(lookedSource);
|
|
4178
|
+
});
|
|
4179
|
+
}
|
|
4180
|
+
function _mv(options, sources, dest) {
|
|
4181
|
+
if (arguments.length < 3) {
|
|
4182
|
+
common.error("missing <source> and/or <dest>");
|
|
4183
|
+
} else if (arguments.length > 3) {
|
|
4184
|
+
sources = [].slice.call(arguments, 1, arguments.length - 1);
|
|
4185
|
+
dest = arguments[arguments.length - 1];
|
|
4186
|
+
} else if (typeof sources === "string") {
|
|
4187
|
+
sources = [sources];
|
|
4188
|
+
} else {
|
|
4189
|
+
common.error("invalid arguments");
|
|
4190
|
+
}
|
|
4191
|
+
var exists = fs.existsSync(dest);
|
|
4192
|
+
var stats = exists && common.statFollowLinks(dest);
|
|
4193
|
+
if ((!exists || !stats.isDirectory()) && sources.length > 1) {
|
|
4194
|
+
common.error("dest is not a directory (too many sources)");
|
|
4195
|
+
}
|
|
4196
|
+
if (exists && stats.isFile() && options.no_force) {
|
|
4197
|
+
common.error("dest file already exists: " + dest);
|
|
4198
|
+
}
|
|
4199
|
+
sources.forEach(function(src, srcIndex) {
|
|
4200
|
+
if (!fs.existsSync(src)) {
|
|
4201
|
+
common.error("no such file or directory: " + src, { continue: true });
|
|
4202
|
+
return;
|
|
4203
|
+
}
|
|
4204
|
+
var thisDest = dest;
|
|
4205
|
+
if (fs.existsSync(dest) && common.statFollowLinks(dest).isDirectory()) {
|
|
4206
|
+
thisDest = path.normalize(dest + "/" + path.basename(src));
|
|
4207
|
+
}
|
|
4208
|
+
var thisDestExists = fs.existsSync(thisDest);
|
|
4209
|
+
if (thisDestExists && checkRecentCreated(sources, srcIndex)) {
|
|
4210
|
+
if (!options.no_force) {
|
|
4211
|
+
common.error("will not overwrite just-created '" + thisDest + "' with '" + src + "'", { continue: true });
|
|
4212
|
+
}
|
|
4213
|
+
return;
|
|
4214
|
+
}
|
|
4215
|
+
if (fs.existsSync(thisDest) && options.no_force) {
|
|
4216
|
+
common.error("dest file already exists: " + thisDest, { continue: true });
|
|
4217
|
+
return;
|
|
4218
|
+
}
|
|
4219
|
+
if (path.resolve(src) === path.dirname(path.resolve(thisDest))) {
|
|
4220
|
+
common.error("cannot move to self: " + src, { continue: true });
|
|
4221
|
+
return;
|
|
4222
|
+
}
|
|
4223
|
+
try {
|
|
4224
|
+
fs.renameSync(src, thisDest);
|
|
4225
|
+
} catch (e) {
|
|
4226
|
+
if (e.code === "EXDEV") {
|
|
4227
|
+
cp("-r", src, thisDest);
|
|
4228
|
+
rm("-rf", src);
|
|
4229
|
+
}
|
|
4230
|
+
}
|
|
4231
|
+
});
|
|
4232
|
+
return "";
|
|
4233
|
+
}
|
|
4234
|
+
module.exports = _mv;
|
|
4235
|
+
}
|
|
4236
|
+
});
|
|
4237
|
+
|
|
4238
|
+
// node_modules/shelljs/src/popd.js
|
|
4239
|
+
var require_popd = __commonJS({
|
|
4240
|
+
"node_modules/shelljs/src/popd.js"() {
|
|
4241
|
+
init_cjs_shims();
|
|
4242
|
+
}
|
|
4243
|
+
});
|
|
4244
|
+
|
|
4245
|
+
// node_modules/shelljs/src/pushd.js
|
|
4246
|
+
var require_pushd = __commonJS({
|
|
4247
|
+
"node_modules/shelljs/src/pushd.js"() {
|
|
4248
|
+
init_cjs_shims();
|
|
4249
|
+
}
|
|
4250
|
+
});
|
|
4251
|
+
|
|
4252
|
+
// node_modules/shelljs/src/sed.js
|
|
4253
|
+
var require_sed = __commonJS({
|
|
4254
|
+
"node_modules/shelljs/src/sed.js"(exports, module) {
|
|
4255
|
+
init_cjs_shims();
|
|
4256
|
+
var common = require_common2();
|
|
4257
|
+
var fs = __require("fs");
|
|
4258
|
+
common.register("sed", _sed, {
|
|
4259
|
+
globStart: 3,
|
|
4260
|
+
// don't glob-expand regexes
|
|
4261
|
+
canReceivePipe: true,
|
|
4262
|
+
cmdOptions: {
|
|
4263
|
+
"i": "inplace"
|
|
4264
|
+
}
|
|
4265
|
+
});
|
|
4266
|
+
function _sed(options, regex, replacement, files) {
|
|
4267
|
+
var pipe = common.readFromPipe();
|
|
4268
|
+
if (typeof replacement !== "string" && typeof replacement !== "function") {
|
|
4269
|
+
if (typeof replacement === "number") {
|
|
4270
|
+
replacement = replacement.toString();
|
|
4271
|
+
} else {
|
|
4272
|
+
common.error("invalid replacement string");
|
|
4273
|
+
}
|
|
4274
|
+
}
|
|
4275
|
+
if (typeof regex === "string") {
|
|
4276
|
+
regex = RegExp(regex);
|
|
4277
|
+
}
|
|
4278
|
+
if (!files && !pipe) {
|
|
4279
|
+
common.error("no files given");
|
|
4280
|
+
}
|
|
4281
|
+
files = [].slice.call(arguments, 3);
|
|
4282
|
+
if (pipe) {
|
|
4283
|
+
files.unshift("-");
|
|
4284
|
+
}
|
|
4285
|
+
var sed = [];
|
|
4286
|
+
files.forEach(function(file) {
|
|
4287
|
+
if (!fs.existsSync(file) && file !== "-") {
|
|
4288
|
+
common.error("no such file or directory: " + file, 2, { continue: true });
|
|
4289
|
+
return;
|
|
4290
|
+
}
|
|
4291
|
+
var contents = file === "-" ? pipe : fs.readFileSync(file, "utf8");
|
|
4292
|
+
var lines = contents.split("\n");
|
|
4293
|
+
var result = lines.map(function(line) {
|
|
4294
|
+
return line.replace(regex, replacement);
|
|
4295
|
+
}).join("\n");
|
|
4296
|
+
sed.push(result);
|
|
4297
|
+
if (options.inplace) {
|
|
4298
|
+
fs.writeFileSync(file, result, "utf8");
|
|
4299
|
+
}
|
|
4300
|
+
});
|
|
4301
|
+
return sed.join("\n");
|
|
4302
|
+
}
|
|
4303
|
+
module.exports = _sed;
|
|
4304
|
+
}
|
|
4305
|
+
});
|
|
4306
|
+
|
|
4307
|
+
// node_modules/shelljs/src/set.js
|
|
4308
|
+
var require_set = __commonJS({
|
|
4309
|
+
"node_modules/shelljs/src/set.js"(exports, module) {
|
|
4310
|
+
init_cjs_shims();
|
|
4311
|
+
var common = require_common2();
|
|
4312
|
+
common.register("set", _set, {
|
|
4313
|
+
allowGlobbing: false,
|
|
4314
|
+
wrapOutput: false
|
|
4315
|
+
});
|
|
4316
|
+
function _set(options) {
|
|
4317
|
+
if (!options) {
|
|
4318
|
+
var args = [].slice.call(arguments, 0);
|
|
4319
|
+
if (args.length < 2)
|
|
4320
|
+
common.error("must provide an argument");
|
|
4321
|
+
options = args[1];
|
|
4322
|
+
}
|
|
4323
|
+
var negate = options[0] === "+";
|
|
4324
|
+
if (negate) {
|
|
4325
|
+
options = "-" + options.slice(1);
|
|
4326
|
+
}
|
|
4327
|
+
options = common.parseOptions(options, {
|
|
4328
|
+
"e": "fatal",
|
|
4329
|
+
"v": "verbose",
|
|
4330
|
+
"f": "noglob"
|
|
4331
|
+
});
|
|
4332
|
+
if (negate) {
|
|
4333
|
+
Object.keys(options).forEach(function(key) {
|
|
4334
|
+
options[key] = !options[key];
|
|
4335
|
+
});
|
|
4336
|
+
}
|
|
4337
|
+
Object.keys(options).forEach(function(key) {
|
|
4338
|
+
if (negate !== options[key]) {
|
|
4339
|
+
common.config[key] = options[key];
|
|
4340
|
+
}
|
|
4341
|
+
});
|
|
4342
|
+
return;
|
|
4343
|
+
}
|
|
4344
|
+
module.exports = _set;
|
|
4345
|
+
}
|
|
4346
|
+
});
|
|
4347
|
+
|
|
4348
|
+
// node_modules/shelljs/src/sort.js
|
|
4349
|
+
var require_sort = __commonJS({
|
|
4350
|
+
"node_modules/shelljs/src/sort.js"(exports, module) {
|
|
4351
|
+
init_cjs_shims();
|
|
4352
|
+
var common = require_common2();
|
|
4353
|
+
var fs = __require("fs");
|
|
4354
|
+
common.register("sort", _sort, {
|
|
4355
|
+
canReceivePipe: true,
|
|
4356
|
+
cmdOptions: {
|
|
4357
|
+
"r": "reverse",
|
|
4358
|
+
"n": "numerical"
|
|
4359
|
+
}
|
|
4360
|
+
});
|
|
4361
|
+
function parseNumber(str) {
|
|
4362
|
+
var match = str.match(/^\s*(\d*)\s*(.*)$/);
|
|
4363
|
+
return { num: Number(match[1]), value: match[2] };
|
|
4364
|
+
}
|
|
4365
|
+
function unixCmp(a, b) {
|
|
4366
|
+
var aLower = a.toLowerCase();
|
|
4367
|
+
var bLower = b.toLowerCase();
|
|
4368
|
+
return aLower === bLower ? -1 * a.localeCompare(b) : (
|
|
4369
|
+
// unix sort treats case opposite how javascript does
|
|
4370
|
+
aLower.localeCompare(bLower)
|
|
4371
|
+
);
|
|
4372
|
+
}
|
|
4373
|
+
function numericalCmp(a, b) {
|
|
4374
|
+
var objA = parseNumber(a);
|
|
4375
|
+
var objB = parseNumber(b);
|
|
4376
|
+
if (objA.hasOwnProperty("num") && objB.hasOwnProperty("num")) {
|
|
4377
|
+
return objA.num !== objB.num ? objA.num - objB.num : unixCmp(objA.value, objB.value);
|
|
4378
|
+
} else {
|
|
4379
|
+
return unixCmp(objA.value, objB.value);
|
|
4380
|
+
}
|
|
4381
|
+
}
|
|
4382
|
+
function _sort(options, files) {
|
|
4383
|
+
var pipe = common.readFromPipe();
|
|
4384
|
+
if (!files && !pipe)
|
|
4385
|
+
common.error("no files given");
|
|
4386
|
+
files = [].slice.call(arguments, 1);
|
|
4387
|
+
if (pipe) {
|
|
4388
|
+
files.unshift("-");
|
|
4389
|
+
}
|
|
4390
|
+
var lines = files.reduce(function(accum, file) {
|
|
4391
|
+
if (file !== "-") {
|
|
4392
|
+
if (!fs.existsSync(file)) {
|
|
4393
|
+
common.error("no such file or directory: " + file, { continue: true });
|
|
4394
|
+
return accum;
|
|
4395
|
+
} else if (common.statFollowLinks(file).isDirectory()) {
|
|
4396
|
+
common.error("read failed: " + file + ": Is a directory", {
|
|
4397
|
+
continue: true
|
|
4398
|
+
});
|
|
4399
|
+
return accum;
|
|
4400
|
+
}
|
|
4401
|
+
}
|
|
4402
|
+
var contents = file === "-" ? pipe : fs.readFileSync(file, "utf8");
|
|
4403
|
+
return accum.concat(contents.trimRight().split("\n"));
|
|
4404
|
+
}, []);
|
|
4405
|
+
var sorted = lines.sort(options.numerical ? numericalCmp : unixCmp);
|
|
4406
|
+
if (options.reverse) {
|
|
4407
|
+
sorted = sorted.reverse();
|
|
4408
|
+
}
|
|
4409
|
+
return sorted.join("\n") + "\n";
|
|
4410
|
+
}
|
|
4411
|
+
module.exports = _sort;
|
|
4412
|
+
}
|
|
4413
|
+
});
|
|
4414
|
+
|
|
4415
|
+
// node_modules/shelljs/src/tail.js
|
|
4416
|
+
var require_tail = __commonJS({
|
|
4417
|
+
"node_modules/shelljs/src/tail.js"(exports, module) {
|
|
4418
|
+
init_cjs_shims();
|
|
4419
|
+
var common = require_common2();
|
|
4420
|
+
var fs = __require("fs");
|
|
4421
|
+
common.register("tail", _tail, {
|
|
4422
|
+
canReceivePipe: true,
|
|
4423
|
+
cmdOptions: {
|
|
4424
|
+
"n": "numLines"
|
|
4425
|
+
}
|
|
4426
|
+
});
|
|
4427
|
+
function _tail(options, files) {
|
|
4428
|
+
var tail = [];
|
|
4429
|
+
var pipe = common.readFromPipe();
|
|
4430
|
+
if (!files && !pipe)
|
|
4431
|
+
common.error("no paths given");
|
|
4432
|
+
var idx = 1;
|
|
4433
|
+
if (options.numLines === true) {
|
|
4434
|
+
idx = 2;
|
|
4435
|
+
options.numLines = Number(arguments[1]);
|
|
4436
|
+
} else if (options.numLines === false) {
|
|
4437
|
+
options.numLines = 10;
|
|
4438
|
+
}
|
|
4439
|
+
options.numLines = -1 * Math.abs(options.numLines);
|
|
4440
|
+
files = [].slice.call(arguments, idx);
|
|
4441
|
+
if (pipe) {
|
|
4442
|
+
files.unshift("-");
|
|
4443
|
+
}
|
|
4444
|
+
var shouldAppendNewline = false;
|
|
4445
|
+
files.forEach(function(file) {
|
|
4446
|
+
if (file !== "-") {
|
|
4447
|
+
if (!fs.existsSync(file)) {
|
|
4448
|
+
common.error("no such file or directory: " + file, { continue: true });
|
|
4449
|
+
return;
|
|
4450
|
+
} else if (common.statFollowLinks(file).isDirectory()) {
|
|
4451
|
+
common.error("error reading '" + file + "': Is a directory", {
|
|
4452
|
+
continue: true
|
|
4453
|
+
});
|
|
4454
|
+
return;
|
|
4455
|
+
}
|
|
4456
|
+
}
|
|
4457
|
+
var contents = file === "-" ? pipe : fs.readFileSync(file, "utf8");
|
|
4458
|
+
var lines = contents.split("\n");
|
|
4459
|
+
if (lines[lines.length - 1] === "") {
|
|
4460
|
+
lines.pop();
|
|
4461
|
+
shouldAppendNewline = true;
|
|
4462
|
+
} else {
|
|
4463
|
+
shouldAppendNewline = false;
|
|
4464
|
+
}
|
|
4465
|
+
tail = tail.concat(lines.slice(options.numLines));
|
|
4466
|
+
});
|
|
4467
|
+
if (shouldAppendNewline) {
|
|
4468
|
+
tail.push("");
|
|
4469
|
+
}
|
|
4470
|
+
return tail.join("\n");
|
|
4471
|
+
}
|
|
4472
|
+
module.exports = _tail;
|
|
4473
|
+
}
|
|
4474
|
+
});
|
|
4475
|
+
|
|
4476
|
+
// node_modules/shelljs/src/test.js
|
|
4477
|
+
var require_test = __commonJS({
|
|
4478
|
+
"node_modules/shelljs/src/test.js"(exports, module) {
|
|
4479
|
+
init_cjs_shims();
|
|
4480
|
+
var common = require_common2();
|
|
4481
|
+
var fs = __require("fs");
|
|
4482
|
+
common.register("test", _test, {
|
|
4483
|
+
cmdOptions: {
|
|
4484
|
+
"b": "block",
|
|
4485
|
+
"c": "character",
|
|
4486
|
+
"d": "directory",
|
|
4487
|
+
"e": "exists",
|
|
4488
|
+
"f": "file",
|
|
4489
|
+
"L": "link",
|
|
4490
|
+
"p": "pipe",
|
|
4491
|
+
"S": "socket"
|
|
4492
|
+
},
|
|
4493
|
+
wrapOutput: false,
|
|
4494
|
+
allowGlobbing: false
|
|
4495
|
+
});
|
|
4496
|
+
function _test(options, path) {
|
|
4497
|
+
if (!path)
|
|
4498
|
+
common.error("no path given");
|
|
4499
|
+
var canInterpret = false;
|
|
4500
|
+
Object.keys(options).forEach(function(key) {
|
|
4501
|
+
if (options[key] === true) {
|
|
4502
|
+
canInterpret = true;
|
|
4503
|
+
}
|
|
4504
|
+
});
|
|
4505
|
+
if (!canInterpret)
|
|
4506
|
+
common.error("could not interpret expression");
|
|
4507
|
+
if (options.link) {
|
|
4508
|
+
try {
|
|
4509
|
+
return common.statNoFollowLinks(path).isSymbolicLink();
|
|
4510
|
+
} catch (e) {
|
|
4511
|
+
return false;
|
|
4512
|
+
}
|
|
4513
|
+
}
|
|
4514
|
+
if (!fs.existsSync(path))
|
|
4515
|
+
return false;
|
|
4516
|
+
if (options.exists)
|
|
4517
|
+
return true;
|
|
4518
|
+
var stats = common.statFollowLinks(path);
|
|
4519
|
+
if (options.block)
|
|
4520
|
+
return stats.isBlockDevice();
|
|
4521
|
+
if (options.character)
|
|
4522
|
+
return stats.isCharacterDevice();
|
|
4523
|
+
if (options.directory)
|
|
4524
|
+
return stats.isDirectory();
|
|
4525
|
+
if (options.file)
|
|
4526
|
+
return stats.isFile();
|
|
4527
|
+
if (options.pipe)
|
|
4528
|
+
return stats.isFIFO();
|
|
4529
|
+
if (options.socket)
|
|
4530
|
+
return stats.isSocket();
|
|
4531
|
+
return false;
|
|
4532
|
+
}
|
|
4533
|
+
module.exports = _test;
|
|
4534
|
+
}
|
|
4535
|
+
});
|
|
4536
|
+
|
|
4537
|
+
// node_modules/shelljs/src/to.js
|
|
4538
|
+
var require_to = __commonJS({
|
|
4539
|
+
"node_modules/shelljs/src/to.js"(exports, module) {
|
|
4540
|
+
init_cjs_shims();
|
|
4541
|
+
var common = require_common2();
|
|
4542
|
+
var fs = __require("fs");
|
|
4543
|
+
var path = __require("path");
|
|
4544
|
+
common.register("to", _to, {
|
|
4545
|
+
pipeOnly: true,
|
|
4546
|
+
wrapOutput: false
|
|
4547
|
+
});
|
|
4548
|
+
function _to(options, file) {
|
|
4549
|
+
if (!file)
|
|
4550
|
+
common.error("wrong arguments");
|
|
4551
|
+
if (!fs.existsSync(path.dirname(file))) {
|
|
4552
|
+
common.error("no such file or directory: " + path.dirname(file));
|
|
4553
|
+
}
|
|
4554
|
+
try {
|
|
4555
|
+
fs.writeFileSync(file, this.stdout || this.toString(), "utf8");
|
|
4556
|
+
return this;
|
|
4557
|
+
} catch (e) {
|
|
4558
|
+
common.error("could not write to file (code " + e.code + "): " + file, { continue: true });
|
|
4559
|
+
}
|
|
4560
|
+
}
|
|
4561
|
+
module.exports = _to;
|
|
4562
|
+
}
|
|
4563
|
+
});
|
|
4564
|
+
|
|
4565
|
+
// node_modules/shelljs/src/toEnd.js
|
|
4566
|
+
var require_toEnd = __commonJS({
|
|
4567
|
+
"node_modules/shelljs/src/toEnd.js"(exports, module) {
|
|
4568
|
+
init_cjs_shims();
|
|
4569
|
+
var common = require_common2();
|
|
4570
|
+
var fs = __require("fs");
|
|
4571
|
+
var path = __require("path");
|
|
4572
|
+
common.register("toEnd", _toEnd, {
|
|
4573
|
+
pipeOnly: true,
|
|
4574
|
+
wrapOutput: false
|
|
4575
|
+
});
|
|
4576
|
+
function _toEnd(options, file) {
|
|
4577
|
+
if (!file)
|
|
4578
|
+
common.error("wrong arguments");
|
|
4579
|
+
if (!fs.existsSync(path.dirname(file))) {
|
|
4580
|
+
common.error("no such file or directory: " + path.dirname(file));
|
|
4581
|
+
}
|
|
4582
|
+
try {
|
|
4583
|
+
fs.appendFileSync(file, this.stdout || this.toString(), "utf8");
|
|
4584
|
+
return this;
|
|
4585
|
+
} catch (e) {
|
|
4586
|
+
common.error("could not append to file (code " + e.code + "): " + file, { continue: true });
|
|
4587
|
+
}
|
|
4588
|
+
}
|
|
4589
|
+
module.exports = _toEnd;
|
|
4590
|
+
}
|
|
4591
|
+
});
|
|
4592
|
+
|
|
4593
|
+
// node_modules/shelljs/src/touch.js
|
|
4594
|
+
var require_touch = __commonJS({
|
|
4595
|
+
"node_modules/shelljs/src/touch.js"(exports, module) {
|
|
4596
|
+
init_cjs_shims();
|
|
4597
|
+
var common = require_common2();
|
|
4598
|
+
var fs = __require("fs");
|
|
4599
|
+
common.register("touch", _touch, {
|
|
4600
|
+
cmdOptions: {
|
|
4601
|
+
"a": "atime_only",
|
|
4602
|
+
"c": "no_create",
|
|
4603
|
+
"d": "date",
|
|
4604
|
+
"m": "mtime_only",
|
|
4605
|
+
"r": "reference"
|
|
4606
|
+
}
|
|
4607
|
+
});
|
|
4608
|
+
function _touch(opts, files) {
|
|
4609
|
+
if (!files) {
|
|
4610
|
+
common.error("no files given");
|
|
4611
|
+
} else if (typeof files === "string") {
|
|
4612
|
+
files = [].slice.call(arguments, 1);
|
|
4613
|
+
} else {
|
|
4614
|
+
common.error("file arg should be a string file path or an Array of string file paths");
|
|
4615
|
+
}
|
|
4616
|
+
files.forEach(function(f) {
|
|
4617
|
+
touchFile(opts, f);
|
|
4618
|
+
});
|
|
4619
|
+
return "";
|
|
4620
|
+
}
|
|
4621
|
+
function touchFile(opts, file) {
|
|
4622
|
+
var stat = tryStatFile(file);
|
|
4623
|
+
if (stat && stat.isDirectory()) {
|
|
4624
|
+
return;
|
|
4625
|
+
}
|
|
4626
|
+
if (!stat && opts.no_create) {
|
|
4627
|
+
return;
|
|
4628
|
+
}
|
|
4629
|
+
fs.closeSync(fs.openSync(file, "a"));
|
|
4630
|
+
var now = /* @__PURE__ */ new Date();
|
|
4631
|
+
var mtime = opts.date || now;
|
|
4632
|
+
var atime = opts.date || now;
|
|
4633
|
+
if (opts.reference) {
|
|
4634
|
+
var refStat = tryStatFile(opts.reference);
|
|
4635
|
+
if (!refStat) {
|
|
4636
|
+
common.error("failed to get attributess of " + opts.reference);
|
|
4637
|
+
}
|
|
4638
|
+
mtime = refStat.mtime;
|
|
4639
|
+
atime = refStat.atime;
|
|
4640
|
+
} else if (opts.date) {
|
|
4641
|
+
mtime = opts.date;
|
|
4642
|
+
atime = opts.date;
|
|
4643
|
+
}
|
|
4644
|
+
if (opts.atime_only && opts.mtime_only) {
|
|
4645
|
+
} else if (opts.atime_only) {
|
|
4646
|
+
mtime = stat.mtime;
|
|
4647
|
+
} else if (opts.mtime_only) {
|
|
4648
|
+
atime = stat.atime;
|
|
4649
|
+
}
|
|
4650
|
+
fs.utimesSync(file, atime, mtime);
|
|
4651
|
+
}
|
|
4652
|
+
module.exports = _touch;
|
|
4653
|
+
function tryStatFile(filePath) {
|
|
4654
|
+
try {
|
|
4655
|
+
return common.statFollowLinks(filePath);
|
|
4656
|
+
} catch (e) {
|
|
4657
|
+
return null;
|
|
4658
|
+
}
|
|
4659
|
+
}
|
|
4660
|
+
}
|
|
4661
|
+
});
|
|
4662
|
+
|
|
4663
|
+
// node_modules/shelljs/src/uniq.js
|
|
4664
|
+
var require_uniq = __commonJS({
|
|
4665
|
+
"node_modules/shelljs/src/uniq.js"(exports, module) {
|
|
4666
|
+
init_cjs_shims();
|
|
4667
|
+
var common = require_common2();
|
|
4668
|
+
var fs = __require("fs");
|
|
4669
|
+
function lpad(c, str) {
|
|
4670
|
+
var res = "" + str;
|
|
4671
|
+
if (res.length < c) {
|
|
4672
|
+
res = Array(c - res.length + 1).join(" ") + res;
|
|
4673
|
+
}
|
|
4674
|
+
return res;
|
|
4675
|
+
}
|
|
4676
|
+
common.register("uniq", _uniq, {
|
|
4677
|
+
canReceivePipe: true,
|
|
4678
|
+
cmdOptions: {
|
|
4679
|
+
"i": "ignoreCase",
|
|
4680
|
+
"c": "count",
|
|
4681
|
+
"d": "duplicates"
|
|
4682
|
+
}
|
|
4683
|
+
});
|
|
4684
|
+
function _uniq(options, input, output) {
|
|
4685
|
+
var pipe = common.readFromPipe();
|
|
4686
|
+
if (!pipe) {
|
|
4687
|
+
if (!input)
|
|
4688
|
+
common.error("no input given");
|
|
4689
|
+
if (!fs.existsSync(input)) {
|
|
4690
|
+
common.error(input + ": No such file or directory");
|
|
4691
|
+
} else if (common.statFollowLinks(input).isDirectory()) {
|
|
4692
|
+
common.error("error reading '" + input + "'");
|
|
4693
|
+
}
|
|
4694
|
+
}
|
|
4695
|
+
if (output && fs.existsSync(output) && common.statFollowLinks(output).isDirectory()) {
|
|
4696
|
+
common.error(output + ": Is a directory");
|
|
4697
|
+
}
|
|
4698
|
+
var lines = (input ? fs.readFileSync(input, "utf8") : pipe).trimRight().split("\n");
|
|
4699
|
+
var compare = function(a, b) {
|
|
4700
|
+
return options.ignoreCase ? a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase()) : a.localeCompare(b);
|
|
4701
|
+
};
|
|
4702
|
+
var uniqed = lines.reduceRight(function(res, e) {
|
|
4703
|
+
if (res.length === 0) {
|
|
4704
|
+
return [{ count: 1, ln: e }];
|
|
4705
|
+
} else if (compare(res[0].ln, e) === 0) {
|
|
4706
|
+
return [{ count: res[0].count + 1, ln: e }].concat(res.slice(1));
|
|
4707
|
+
} else {
|
|
4708
|
+
return [{ count: 1, ln: e }].concat(res);
|
|
4709
|
+
}
|
|
4710
|
+
}, []).filter(function(obj) {
|
|
4711
|
+
return options.duplicates ? obj.count > 1 : true;
|
|
4712
|
+
}).map(function(obj) {
|
|
4713
|
+
return (options.count ? lpad(7, obj.count) + " " : "") + obj.ln;
|
|
4714
|
+
}).join("\n") + "\n";
|
|
4715
|
+
if (output) {
|
|
4716
|
+
new common.ShellString(uniqed).to(output);
|
|
4717
|
+
return "";
|
|
4718
|
+
} else {
|
|
4719
|
+
return uniqed;
|
|
4720
|
+
}
|
|
4721
|
+
}
|
|
4722
|
+
module.exports = _uniq;
|
|
4723
|
+
}
|
|
4724
|
+
});
|
|
4725
|
+
|
|
4726
|
+
// node_modules/shelljs/src/which.js
|
|
4727
|
+
var require_which = __commonJS({
|
|
4728
|
+
"node_modules/shelljs/src/which.js"(exports, module) {
|
|
4729
|
+
init_cjs_shims();
|
|
4730
|
+
var common = require_common2();
|
|
4731
|
+
var fs = __require("fs");
|
|
4732
|
+
var path = __require("path");
|
|
4733
|
+
common.register("which", _which, {
|
|
4734
|
+
allowGlobbing: false,
|
|
4735
|
+
cmdOptions: {
|
|
4736
|
+
"a": "all"
|
|
4737
|
+
}
|
|
4738
|
+
});
|
|
4739
|
+
var XP_DEFAULT_PATHEXT = ".com;.exe;.bat;.cmd;.vbs;.vbe;.js;.jse;.wsf;.wsh";
|
|
4740
|
+
var FILE_EXECUTABLE_MODE = 1;
|
|
4741
|
+
function isWindowsPlatform() {
|
|
4742
|
+
return process.platform === "win32";
|
|
4743
|
+
}
|
|
4744
|
+
function splitPath(p) {
|
|
4745
|
+
return p ? p.split(path.delimiter) : [];
|
|
4746
|
+
}
|
|
4747
|
+
function isExecutable(pathName) {
|
|
4748
|
+
try {
|
|
4749
|
+
fs.accessSync(pathName, FILE_EXECUTABLE_MODE);
|
|
4750
|
+
} catch (err) {
|
|
4751
|
+
return false;
|
|
4752
|
+
}
|
|
4753
|
+
return true;
|
|
4754
|
+
}
|
|
4755
|
+
function checkPath(pathName) {
|
|
4756
|
+
return fs.existsSync(pathName) && !common.statFollowLinks(pathName).isDirectory() && (isWindowsPlatform() || isExecutable(pathName));
|
|
4757
|
+
}
|
|
4758
|
+
function _which(options, cmd) {
|
|
4759
|
+
if (!cmd)
|
|
4760
|
+
common.error("must specify command");
|
|
4761
|
+
var isWindows = isWindowsPlatform();
|
|
4762
|
+
var pathArray = splitPath(process.env.PATH);
|
|
4763
|
+
var queryMatches = [];
|
|
4764
|
+
if (cmd.indexOf("/") === -1) {
|
|
4765
|
+
var pathExtArray = [""];
|
|
4766
|
+
if (isWindows) {
|
|
4767
|
+
var pathExtEnv = process.env.PATHEXT || XP_DEFAULT_PATHEXT;
|
|
4768
|
+
pathExtArray = splitPath(pathExtEnv.toUpperCase());
|
|
4769
|
+
}
|
|
4770
|
+
for (var k = 0; k < pathArray.length; k++) {
|
|
4771
|
+
if (queryMatches.length > 0 && !options.all)
|
|
4772
|
+
break;
|
|
4773
|
+
var attempt = path.resolve(pathArray[k], cmd);
|
|
4774
|
+
if (isWindows) {
|
|
4775
|
+
attempt = attempt.toUpperCase();
|
|
4776
|
+
}
|
|
4777
|
+
var match = attempt.match(/\.[^<>:"/\|?*.]+$/);
|
|
4778
|
+
if (match && pathExtArray.indexOf(match[0]) >= 0) {
|
|
4779
|
+
if (checkPath(attempt)) {
|
|
4780
|
+
queryMatches.push(attempt);
|
|
4781
|
+
break;
|
|
4782
|
+
}
|
|
4783
|
+
} else {
|
|
4784
|
+
for (var i = 0; i < pathExtArray.length; i++) {
|
|
4785
|
+
var ext = pathExtArray[i];
|
|
4786
|
+
var newAttempt = attempt + ext;
|
|
4787
|
+
if (checkPath(newAttempt)) {
|
|
4788
|
+
queryMatches.push(newAttempt);
|
|
4789
|
+
break;
|
|
4790
|
+
}
|
|
4791
|
+
}
|
|
4792
|
+
}
|
|
4793
|
+
}
|
|
4794
|
+
} else if (checkPath(cmd)) {
|
|
4795
|
+
queryMatches.push(path.resolve(cmd));
|
|
4796
|
+
}
|
|
4797
|
+
if (queryMatches.length > 0) {
|
|
4798
|
+
return options.all ? queryMatches : queryMatches[0];
|
|
4799
|
+
}
|
|
4800
|
+
return options.all ? [] : null;
|
|
4801
|
+
}
|
|
4802
|
+
module.exports = _which;
|
|
4803
|
+
}
|
|
4804
|
+
});
|
|
4805
|
+
|
|
4806
|
+
// require("./src/**/*") in node_modules/shelljs/shell.js
|
|
4807
|
+
var globRequire_src;
|
|
4808
|
+
var init_ = __esm({
|
|
4809
|
+
'require("./src/**/*") in node_modules/shelljs/shell.js'() {
|
|
4810
|
+
globRequire_src = __glob({
|
|
4811
|
+
"./src/cat.js": () => require_cat(),
|
|
4812
|
+
"./src/cd.js": () => require_cd(),
|
|
4813
|
+
"./src/chmod.js": () => require_chmod(),
|
|
4814
|
+
"./src/common.js": () => require_common2(),
|
|
4815
|
+
"./src/cp.js": () => require_cp(),
|
|
4816
|
+
"./src/dirs.js": () => require_dirs(),
|
|
4817
|
+
"./src/echo.js": () => require_echo(),
|
|
4818
|
+
"./src/error.js": () => require_error(),
|
|
4819
|
+
"./src/exec-child.js": () => require_exec_child(),
|
|
4820
|
+
"./src/exec.js": () => require_exec(),
|
|
4821
|
+
"./src/find.js": () => require_find(),
|
|
4822
|
+
"./src/grep.js": () => require_grep(),
|
|
4823
|
+
"./src/head.js": () => require_head(),
|
|
4824
|
+
"./src/ln.js": () => require_ln(),
|
|
4825
|
+
"./src/ls.js": () => require_ls(),
|
|
4826
|
+
"./src/mkdir.js": () => require_mkdir(),
|
|
4827
|
+
"./src/mv.js": () => require_mv(),
|
|
4828
|
+
"./src/popd.js": () => require_popd(),
|
|
4829
|
+
"./src/pushd.js": () => require_pushd(),
|
|
4830
|
+
"./src/pwd.js": () => require_pwd(),
|
|
4831
|
+
"./src/rm.js": () => require_rm(),
|
|
4832
|
+
"./src/sed.js": () => require_sed(),
|
|
4833
|
+
"./src/set.js": () => require_set(),
|
|
4834
|
+
"./src/sort.js": () => require_sort(),
|
|
4835
|
+
"./src/tail.js": () => require_tail(),
|
|
4836
|
+
"./src/tempdir.js": () => require_tempdir(),
|
|
4837
|
+
"./src/test.js": () => require_test(),
|
|
4838
|
+
"./src/to.js": () => require_to(),
|
|
4839
|
+
"./src/toEnd.js": () => require_toEnd(),
|
|
4840
|
+
"./src/touch.js": () => require_touch(),
|
|
4841
|
+
"./src/uniq.js": () => require_uniq(),
|
|
4842
|
+
"./src/which.js": () => require_which()
|
|
4843
|
+
});
|
|
4844
|
+
}
|
|
4845
|
+
});
|
|
4846
|
+
|
|
4847
|
+
// node_modules/shelljs/commands.js
|
|
4848
|
+
var require_commands = __commonJS({
|
|
4849
|
+
"node_modules/shelljs/commands.js"(exports, module) {
|
|
4850
|
+
init_cjs_shims();
|
|
4851
|
+
module.exports = [
|
|
4852
|
+
"cat",
|
|
4853
|
+
"cd",
|
|
4854
|
+
"chmod",
|
|
4855
|
+
"cp",
|
|
4856
|
+
"dirs",
|
|
4857
|
+
"echo",
|
|
4858
|
+
"exec",
|
|
4859
|
+
"find",
|
|
4860
|
+
"grep",
|
|
4861
|
+
"head",
|
|
4862
|
+
"ln",
|
|
4863
|
+
"ls",
|
|
4864
|
+
"mkdir",
|
|
4865
|
+
"mv",
|
|
4866
|
+
"pwd",
|
|
4867
|
+
"rm",
|
|
4868
|
+
"sed",
|
|
4869
|
+
"set",
|
|
4870
|
+
"sort",
|
|
4871
|
+
"tail",
|
|
4872
|
+
"tempdir",
|
|
4873
|
+
"test",
|
|
4874
|
+
"to",
|
|
4875
|
+
"toEnd",
|
|
4876
|
+
"touch",
|
|
4877
|
+
"uniq",
|
|
4878
|
+
"which"
|
|
4879
|
+
];
|
|
4880
|
+
}
|
|
4881
|
+
});
|
|
4882
|
+
|
|
4883
|
+
// node_modules/shelljs/shell.js
|
|
4884
|
+
var require_shell = __commonJS({
|
|
4885
|
+
"node_modules/shelljs/shell.js"(exports) {
|
|
4886
|
+
init_cjs_shims();
|
|
4887
|
+
init_();
|
|
4888
|
+
var common = require_common2();
|
|
4889
|
+
require_commands().forEach(function(command) {
|
|
4890
|
+
globRequire_src("./src/" + command);
|
|
4891
|
+
});
|
|
4892
|
+
exports.exit = process.exit;
|
|
4893
|
+
exports.error = require_error();
|
|
4894
|
+
exports.ShellString = common.ShellString;
|
|
4895
|
+
exports.env = process.env;
|
|
4896
|
+
exports.config = common.config;
|
|
4897
|
+
}
|
|
4898
|
+
});
|
|
4899
|
+
export default require_shell();
|