@create-node-app/core 0.4.0 → 0.5.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/dist/chunk-TMTYXZIP.js +4799 -0
- package/dist/esm-SPIVR2WR.js +34 -0
- package/dist/index.cjs +3794 -0
- package/dist/index.d.cts +23 -0
- package/dist/index.d.mts +37 -0
- package/dist/index.d.ts +1 -15
- package/dist/index.js +598 -4821
- package/dist/index.mjs +1573 -1169
- package/package.json +37 -27
package/dist/index.mjs
CHANGED
|
@@ -7,9 +7,8 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
7
7
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
8
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
9
|
}) : x)(function(x) {
|
|
10
|
-
if (typeof require !== "undefined")
|
|
11
|
-
|
|
12
|
-
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
10
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
12
|
});
|
|
14
13
|
var __commonJS = (cb, mod) => function __require2() {
|
|
15
14
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
@@ -80,9 +79,7 @@ var require_dist = __commonJS({
|
|
|
80
79
|
"../../node_modules/@kwsites/file-exists/dist/index.js"(exports) {
|
|
81
80
|
"use strict";
|
|
82
81
|
function __export2(m) {
|
|
83
|
-
for (var p in m)
|
|
84
|
-
if (!exports.hasOwnProperty(p))
|
|
85
|
-
exports[p] = m[p];
|
|
82
|
+
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
86
83
|
}
|
|
87
84
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88
85
|
__export2(require_src());
|
|
@@ -137,13 +134,11 @@ var require_universalify = __commonJS({
|
|
|
137
134
|
"use strict";
|
|
138
135
|
exports.fromCallback = function(fn) {
|
|
139
136
|
return Object.defineProperty(function() {
|
|
140
|
-
if (typeof arguments[arguments.length - 1] === "function")
|
|
141
|
-
fn.apply(this, arguments);
|
|
137
|
+
if (typeof arguments[arguments.length - 1] === "function") fn.apply(this, arguments);
|
|
142
138
|
else {
|
|
143
139
|
return new Promise((resolve, reject) => {
|
|
144
140
|
arguments[arguments.length] = (err, res) => {
|
|
145
|
-
if (err)
|
|
146
|
-
return reject(err);
|
|
141
|
+
if (err) return reject(err);
|
|
147
142
|
resolve(res);
|
|
148
143
|
};
|
|
149
144
|
arguments.length++;
|
|
@@ -155,10 +150,8 @@ var require_universalify = __commonJS({
|
|
|
155
150
|
exports.fromPromise = function(fn) {
|
|
156
151
|
return Object.defineProperty(function() {
|
|
157
152
|
const cb = arguments[arguments.length - 1];
|
|
158
|
-
if (typeof cb !== "function")
|
|
159
|
-
|
|
160
|
-
else
|
|
161
|
-
fn.apply(this, arguments).then((r) => cb(null, r), cb);
|
|
153
|
+
if (typeof cb !== "function") return fn.apply(this, arguments);
|
|
154
|
+
else fn.apply(this, arguments).then((r) => cb(null, r), cb);
|
|
162
155
|
}, "name", { value: fn.name });
|
|
163
156
|
};
|
|
164
157
|
}
|
|
@@ -167,6 +160,7 @@ var require_universalify = __commonJS({
|
|
|
167
160
|
// ../../node_modules/graceful-fs/polyfills.js
|
|
168
161
|
var require_polyfills = __commonJS({
|
|
169
162
|
"../../node_modules/graceful-fs/polyfills.js"(exports, module) {
|
|
163
|
+
"use strict";
|
|
170
164
|
var constants = __require("constants");
|
|
171
165
|
var origCwd = process.cwd;
|
|
172
166
|
var cwd = null;
|
|
@@ -186,8 +180,7 @@ var require_polyfills = __commonJS({
|
|
|
186
180
|
cwd = null;
|
|
187
181
|
chdir.call(process, d);
|
|
188
182
|
};
|
|
189
|
-
if (Object.setPrototypeOf)
|
|
190
|
-
Object.setPrototypeOf(process.chdir, chdir);
|
|
183
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
|
|
191
184
|
}
|
|
192
185
|
var chdir;
|
|
193
186
|
module.exports = patch;
|
|
@@ -218,22 +211,20 @@ var require_polyfills = __commonJS({
|
|
|
218
211
|
fs5.lstatSync = statFixSync(fs5.lstatSync);
|
|
219
212
|
if (fs5.chmod && !fs5.lchmod) {
|
|
220
213
|
fs5.lchmod = function(path4, mode, cb) {
|
|
221
|
-
if (cb)
|
|
222
|
-
process.nextTick(cb);
|
|
214
|
+
if (cb) process.nextTick(cb);
|
|
223
215
|
};
|
|
224
216
|
fs5.lchmodSync = function() {
|
|
225
217
|
};
|
|
226
218
|
}
|
|
227
219
|
if (fs5.chown && !fs5.lchown) {
|
|
228
220
|
fs5.lchown = function(path4, uid, gid, cb) {
|
|
229
|
-
if (cb)
|
|
230
|
-
process.nextTick(cb);
|
|
221
|
+
if (cb) process.nextTick(cb);
|
|
231
222
|
};
|
|
232
223
|
fs5.lchownSync = function() {
|
|
233
224
|
};
|
|
234
225
|
}
|
|
235
226
|
if (platform === "win32") {
|
|
236
|
-
fs5.rename = typeof fs5.rename !== "function" ? fs5.rename : function(fs$rename) {
|
|
227
|
+
fs5.rename = typeof fs5.rename !== "function" ? fs5.rename : (function(fs$rename) {
|
|
237
228
|
function rename(from, to, cb) {
|
|
238
229
|
var start = Date.now();
|
|
239
230
|
var backoff = 0;
|
|
@@ -251,16 +242,14 @@ var require_polyfills = __commonJS({
|
|
|
251
242
|
backoff += 10;
|
|
252
243
|
return;
|
|
253
244
|
}
|
|
254
|
-
if (cb)
|
|
255
|
-
cb(er);
|
|
245
|
+
if (cb) cb(er);
|
|
256
246
|
});
|
|
257
247
|
}
|
|
258
|
-
if (Object.setPrototypeOf)
|
|
259
|
-
Object.setPrototypeOf(rename, fs$rename);
|
|
248
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
|
|
260
249
|
return rename;
|
|
261
|
-
}(fs5.rename);
|
|
250
|
+
})(fs5.rename);
|
|
262
251
|
}
|
|
263
|
-
fs5.read = typeof fs5.read !== "function" ? fs5.read : function(fs$read) {
|
|
252
|
+
fs5.read = typeof fs5.read !== "function" ? fs5.read : (function(fs$read) {
|
|
264
253
|
function read(fd, buffer, offset, length, position, callback_) {
|
|
265
254
|
var callback;
|
|
266
255
|
if (callback_ && typeof callback_ === "function") {
|
|
@@ -275,11 +264,10 @@ var require_polyfills = __commonJS({
|
|
|
275
264
|
}
|
|
276
265
|
return fs$read.call(fs5, fd, buffer, offset, length, position, callback);
|
|
277
266
|
}
|
|
278
|
-
if (Object.setPrototypeOf)
|
|
279
|
-
Object.setPrototypeOf(read, fs$read);
|
|
267
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
|
|
280
268
|
return read;
|
|
281
|
-
}(fs5.read);
|
|
282
|
-
fs5.readSync = typeof fs5.readSync !== "function" ? fs5.readSync : function(fs$readSync) {
|
|
269
|
+
})(fs5.read);
|
|
270
|
+
fs5.readSync = typeof fs5.readSync !== "function" ? fs5.readSync : /* @__PURE__ */ (function(fs$readSync) {
|
|
283
271
|
return function(fd, buffer, offset, length, position) {
|
|
284
272
|
var eagCounter = 0;
|
|
285
273
|
while (true) {
|
|
@@ -294,7 +282,7 @@ var require_polyfills = __commonJS({
|
|
|
294
282
|
}
|
|
295
283
|
}
|
|
296
284
|
};
|
|
297
|
-
}(fs5.readSync);
|
|
285
|
+
})(fs5.readSync);
|
|
298
286
|
function patchLchmod(fs6) {
|
|
299
287
|
fs6.lchmod = function(path4, mode, callback) {
|
|
300
288
|
fs6.open(
|
|
@@ -303,14 +291,12 @@ var require_polyfills = __commonJS({
|
|
|
303
291
|
mode,
|
|
304
292
|
function(err, fd) {
|
|
305
293
|
if (err) {
|
|
306
|
-
if (callback)
|
|
307
|
-
callback(err);
|
|
294
|
+
if (callback) callback(err);
|
|
308
295
|
return;
|
|
309
296
|
}
|
|
310
297
|
fs6.fchmod(fd, mode, function(err2) {
|
|
311
298
|
fs6.close(fd, function(err22) {
|
|
312
|
-
if (callback)
|
|
313
|
-
callback(err2 || err22);
|
|
299
|
+
if (callback) callback(err2 || err22);
|
|
314
300
|
});
|
|
315
301
|
});
|
|
316
302
|
}
|
|
@@ -341,14 +327,12 @@ var require_polyfills = __commonJS({
|
|
|
341
327
|
fs6.lutimes = function(path4, at, mt, cb) {
|
|
342
328
|
fs6.open(path4, constants.O_SYMLINK, function(er, fd) {
|
|
343
329
|
if (er) {
|
|
344
|
-
if (cb)
|
|
345
|
-
cb(er);
|
|
330
|
+
if (cb) cb(er);
|
|
346
331
|
return;
|
|
347
332
|
}
|
|
348
333
|
fs6.futimes(fd, at, mt, function(er2) {
|
|
349
334
|
fs6.close(fd, function(er22) {
|
|
350
|
-
if (cb)
|
|
351
|
-
cb(er2 || er22);
|
|
335
|
+
if (cb) cb(er2 || er22);
|
|
352
336
|
});
|
|
353
337
|
});
|
|
354
338
|
});
|
|
@@ -374,64 +358,52 @@ var require_polyfills = __commonJS({
|
|
|
374
358
|
};
|
|
375
359
|
} else if (fs6.futimes) {
|
|
376
360
|
fs6.lutimes = function(_a2, _b, _c, cb) {
|
|
377
|
-
if (cb)
|
|
378
|
-
process.nextTick(cb);
|
|
361
|
+
if (cb) process.nextTick(cb);
|
|
379
362
|
};
|
|
380
363
|
fs6.lutimesSync = function() {
|
|
381
364
|
};
|
|
382
365
|
}
|
|
383
366
|
}
|
|
384
367
|
function chmodFix(orig) {
|
|
385
|
-
if (!orig)
|
|
386
|
-
return orig;
|
|
368
|
+
if (!orig) return orig;
|
|
387
369
|
return function(target, mode, cb) {
|
|
388
370
|
return orig.call(fs5, target, mode, function(er) {
|
|
389
|
-
if (chownErOk(er))
|
|
390
|
-
|
|
391
|
-
if (cb)
|
|
392
|
-
cb.apply(this, arguments);
|
|
371
|
+
if (chownErOk(er)) er = null;
|
|
372
|
+
if (cb) cb.apply(this, arguments);
|
|
393
373
|
});
|
|
394
374
|
};
|
|
395
375
|
}
|
|
396
376
|
function chmodFixSync(orig) {
|
|
397
|
-
if (!orig)
|
|
398
|
-
return orig;
|
|
377
|
+
if (!orig) return orig;
|
|
399
378
|
return function(target, mode) {
|
|
400
379
|
try {
|
|
401
380
|
return orig.call(fs5, target, mode);
|
|
402
381
|
} catch (er) {
|
|
403
|
-
if (!chownErOk(er))
|
|
404
|
-
throw er;
|
|
382
|
+
if (!chownErOk(er)) throw er;
|
|
405
383
|
}
|
|
406
384
|
};
|
|
407
385
|
}
|
|
408
386
|
function chownFix(orig) {
|
|
409
|
-
if (!orig)
|
|
410
|
-
return orig;
|
|
387
|
+
if (!orig) return orig;
|
|
411
388
|
return function(target, uid, gid, cb) {
|
|
412
389
|
return orig.call(fs5, target, uid, gid, function(er) {
|
|
413
|
-
if (chownErOk(er))
|
|
414
|
-
|
|
415
|
-
if (cb)
|
|
416
|
-
cb.apply(this, arguments);
|
|
390
|
+
if (chownErOk(er)) er = null;
|
|
391
|
+
if (cb) cb.apply(this, arguments);
|
|
417
392
|
});
|
|
418
393
|
};
|
|
419
394
|
}
|
|
420
395
|
function chownFixSync(orig) {
|
|
421
|
-
if (!orig)
|
|
422
|
-
return orig;
|
|
396
|
+
if (!orig) return orig;
|
|
423
397
|
return function(target, uid, gid) {
|
|
424
398
|
try {
|
|
425
399
|
return orig.call(fs5, target, uid, gid);
|
|
426
400
|
} catch (er) {
|
|
427
|
-
if (!chownErOk(er))
|
|
428
|
-
throw er;
|
|
401
|
+
if (!chownErOk(er)) throw er;
|
|
429
402
|
}
|
|
430
403
|
};
|
|
431
404
|
}
|
|
432
405
|
function statFix(orig) {
|
|
433
|
-
if (!orig)
|
|
434
|
-
return orig;
|
|
406
|
+
if (!orig) return orig;
|
|
435
407
|
return function(target, options, cb) {
|
|
436
408
|
if (typeof options === "function") {
|
|
437
409
|
cb = options;
|
|
@@ -439,27 +411,21 @@ var require_polyfills = __commonJS({
|
|
|
439
411
|
}
|
|
440
412
|
function callback(er, stats) {
|
|
441
413
|
if (stats) {
|
|
442
|
-
if (stats.uid < 0)
|
|
443
|
-
|
|
444
|
-
if (stats.gid < 0)
|
|
445
|
-
stats.gid += 4294967296;
|
|
414
|
+
if (stats.uid < 0) stats.uid += 4294967296;
|
|
415
|
+
if (stats.gid < 0) stats.gid += 4294967296;
|
|
446
416
|
}
|
|
447
|
-
if (cb)
|
|
448
|
-
cb.apply(this, arguments);
|
|
417
|
+
if (cb) cb.apply(this, arguments);
|
|
449
418
|
}
|
|
450
419
|
return options ? orig.call(fs5, target, options, callback) : orig.call(fs5, target, callback);
|
|
451
420
|
};
|
|
452
421
|
}
|
|
453
422
|
function statFixSync(orig) {
|
|
454
|
-
if (!orig)
|
|
455
|
-
return orig;
|
|
423
|
+
if (!orig) return orig;
|
|
456
424
|
return function(target, options) {
|
|
457
425
|
var stats = options ? orig.call(fs5, target, options) : orig.call(fs5, target);
|
|
458
426
|
if (stats) {
|
|
459
|
-
if (stats.uid < 0)
|
|
460
|
-
|
|
461
|
-
if (stats.gid < 0)
|
|
462
|
-
stats.gid += 4294967296;
|
|
427
|
+
if (stats.uid < 0) stats.uid += 4294967296;
|
|
428
|
+
if (stats.gid < 0) stats.gid += 4294967296;
|
|
463
429
|
}
|
|
464
430
|
return stats;
|
|
465
431
|
};
|
|
@@ -483,6 +449,7 @@ var require_polyfills = __commonJS({
|
|
|
483
449
|
// ../../node_modules/graceful-fs/legacy-streams.js
|
|
484
450
|
var require_legacy_streams = __commonJS({
|
|
485
451
|
"../../node_modules/graceful-fs/legacy-streams.js"(exports, module) {
|
|
452
|
+
"use strict";
|
|
486
453
|
var Stream = __require("stream").Stream;
|
|
487
454
|
module.exports = legacy;
|
|
488
455
|
function legacy(fs5) {
|
|
@@ -491,8 +458,7 @@ var require_legacy_streams = __commonJS({
|
|
|
491
458
|
WriteStream
|
|
492
459
|
};
|
|
493
460
|
function ReadStream(path4, options) {
|
|
494
|
-
if (!(this instanceof ReadStream))
|
|
495
|
-
return new ReadStream(path4, options);
|
|
461
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path4, options);
|
|
496
462
|
Stream.call(this);
|
|
497
463
|
var self = this;
|
|
498
464
|
this.path = path4;
|
|
@@ -508,8 +474,7 @@ var require_legacy_streams = __commonJS({
|
|
|
508
474
|
var key = keys[index];
|
|
509
475
|
this[key] = options[key];
|
|
510
476
|
}
|
|
511
|
-
if (this.encoding)
|
|
512
|
-
this.setEncoding(this.encoding);
|
|
477
|
+
if (this.encoding) this.setEncoding(this.encoding);
|
|
513
478
|
if (this.start !== void 0) {
|
|
514
479
|
if ("number" !== typeof this.start) {
|
|
515
480
|
throw TypeError("start must be a Number");
|
|
@@ -542,8 +507,7 @@ var require_legacy_streams = __commonJS({
|
|
|
542
507
|
});
|
|
543
508
|
}
|
|
544
509
|
function WriteStream(path4, options) {
|
|
545
|
-
if (!(this instanceof WriteStream))
|
|
546
|
-
return new WriteStream(path4, options);
|
|
510
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path4, options);
|
|
547
511
|
Stream.call(this);
|
|
548
512
|
this.path = path4;
|
|
549
513
|
this.fd = null;
|
|
@@ -605,6 +569,7 @@ var require_clone = __commonJS({
|
|
|
605
569
|
// ../../node_modules/graceful-fs/graceful-fs.js
|
|
606
570
|
var require_graceful_fs = __commonJS({
|
|
607
571
|
"../../node_modules/graceful-fs/graceful-fs.js"(exports, module) {
|
|
572
|
+
"use strict";
|
|
608
573
|
var fs5 = __require("fs");
|
|
609
574
|
var polyfills = require_polyfills();
|
|
610
575
|
var legacy = require_legacy_streams();
|
|
@@ -640,7 +605,7 @@ var require_graceful_fs = __commonJS({
|
|
|
640
605
|
if (!fs5[gracefulQueue]) {
|
|
641
606
|
queue = global[gracefulQueue] || [];
|
|
642
607
|
publishQueue(fs5, queue);
|
|
643
|
-
fs5.close = function(fs$close) {
|
|
608
|
+
fs5.close = (function(fs$close) {
|
|
644
609
|
function close(fd, cb) {
|
|
645
610
|
return fs$close.call(fs5, fd, function(err) {
|
|
646
611
|
if (!err) {
|
|
@@ -654,8 +619,8 @@ var require_graceful_fs = __commonJS({
|
|
|
654
619
|
value: fs$close
|
|
655
620
|
});
|
|
656
621
|
return close;
|
|
657
|
-
}(fs5.close);
|
|
658
|
-
fs5.closeSync = function(fs$closeSync) {
|
|
622
|
+
})(fs5.close);
|
|
623
|
+
fs5.closeSync = (function(fs$closeSync) {
|
|
659
624
|
function closeSync(fd) {
|
|
660
625
|
fs$closeSync.apply(fs5, arguments);
|
|
661
626
|
resetQueue();
|
|
@@ -664,7 +629,7 @@ var require_graceful_fs = __commonJS({
|
|
|
664
629
|
value: fs$closeSync
|
|
665
630
|
});
|
|
666
631
|
return closeSync;
|
|
667
|
-
}(fs5.closeSync);
|
|
632
|
+
})(fs5.closeSync);
|
|
668
633
|
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
|
|
669
634
|
process.on("exit", function() {
|
|
670
635
|
debug3(fs5[gracefulQueue]);
|
|
@@ -1037,8 +1002,7 @@ var require_fs = __commonJS({
|
|
|
1037
1002
|
}
|
|
1038
1003
|
return new Promise((resolve, reject) => {
|
|
1039
1004
|
fs5.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => {
|
|
1040
|
-
if (err)
|
|
1041
|
-
return reject(err);
|
|
1005
|
+
if (err) return reject(err);
|
|
1042
1006
|
resolve({ bytesRead, buffer: buffer2 });
|
|
1043
1007
|
});
|
|
1044
1008
|
});
|
|
@@ -1049,8 +1013,7 @@ var require_fs = __commonJS({
|
|
|
1049
1013
|
}
|
|
1050
1014
|
return new Promise((resolve, reject) => {
|
|
1051
1015
|
fs5.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => {
|
|
1052
|
-
if (err)
|
|
1053
|
-
return reject(err);
|
|
1016
|
+
if (err) return reject(err);
|
|
1054
1017
|
resolve({ bytesWritten, buffer: buffer2 });
|
|
1055
1018
|
});
|
|
1056
1019
|
});
|
|
@@ -1065,8 +1028,7 @@ var require_win32 = __commonJS({
|
|
|
1065
1028
|
var path4 = __require("path");
|
|
1066
1029
|
function getRootPath(p) {
|
|
1067
1030
|
p = path4.normalize(path4.resolve(p)).split(path4.sep);
|
|
1068
|
-
if (p.length > 0)
|
|
1069
|
-
return p[0];
|
|
1031
|
+
if (p.length > 0) return p[0];
|
|
1070
1032
|
return null;
|
|
1071
1033
|
}
|
|
1072
1034
|
var INVALID_PATH_CHARS = /[<>:"|?*]/;
|
|
@@ -1107,8 +1069,7 @@ var require_mkdirs = __commonJS({
|
|
|
1107
1069
|
if (mode === void 0) {
|
|
1108
1070
|
mode = o777 & ~process.umask();
|
|
1109
1071
|
}
|
|
1110
|
-
if (!made)
|
|
1111
|
-
made = null;
|
|
1072
|
+
if (!made) made = null;
|
|
1112
1073
|
callback = callback || function() {
|
|
1113
1074
|
};
|
|
1114
1075
|
p = path4.resolve(p);
|
|
@@ -1119,21 +1080,19 @@ var require_mkdirs = __commonJS({
|
|
|
1119
1080
|
}
|
|
1120
1081
|
switch (er.code) {
|
|
1121
1082
|
case "ENOENT":
|
|
1122
|
-
if (path4.dirname(p) === p)
|
|
1123
|
-
return callback(er);
|
|
1083
|
+
if (path4.dirname(p) === p) return callback(er);
|
|
1124
1084
|
mkdirs(path4.dirname(p), opts, (er2, made2) => {
|
|
1125
|
-
if (er2)
|
|
1126
|
-
|
|
1127
|
-
else
|
|
1128
|
-
mkdirs(p, opts, callback, made2);
|
|
1085
|
+
if (er2) callback(er2, made2);
|
|
1086
|
+
else mkdirs(p, opts, callback, made2);
|
|
1129
1087
|
});
|
|
1130
1088
|
break;
|
|
1089
|
+
// In the case of any other error, just see if there's a dir
|
|
1090
|
+
// there already. If so, then hooray! If not, then something
|
|
1091
|
+
// is borked.
|
|
1131
1092
|
default:
|
|
1132
1093
|
xfs.stat(p, (er2, stat) => {
|
|
1133
|
-
if (er2 || !stat.isDirectory())
|
|
1134
|
-
|
|
1135
|
-
else
|
|
1136
|
-
callback(null, made);
|
|
1094
|
+
if (er2 || !stat.isDirectory()) callback(er, made);
|
|
1095
|
+
else callback(null, made);
|
|
1137
1096
|
});
|
|
1138
1097
|
break;
|
|
1139
1098
|
}
|
|
@@ -1165,16 +1124,14 @@ var require_mkdirs_sync = __commonJS({
|
|
|
1165
1124
|
if (mode === void 0) {
|
|
1166
1125
|
mode = o777 & ~process.umask();
|
|
1167
1126
|
}
|
|
1168
|
-
if (!made)
|
|
1169
|
-
made = null;
|
|
1127
|
+
if (!made) made = null;
|
|
1170
1128
|
p = path4.resolve(p);
|
|
1171
1129
|
try {
|
|
1172
1130
|
xfs.mkdirSync(p, mode);
|
|
1173
1131
|
made = made || p;
|
|
1174
1132
|
} catch (err0) {
|
|
1175
1133
|
if (err0.code === "ENOENT") {
|
|
1176
|
-
if (path4.dirname(p) === p)
|
|
1177
|
-
throw err0;
|
|
1134
|
+
if (path4.dirname(p) === p) throw err0;
|
|
1178
1135
|
made = mkdirsSync(path4.dirname(p), opts, made);
|
|
1179
1136
|
mkdirsSync(p, opts, made);
|
|
1180
1137
|
} else {
|
|
@@ -1184,8 +1141,7 @@ var require_mkdirs_sync = __commonJS({
|
|
|
1184
1141
|
} catch (err1) {
|
|
1185
1142
|
throw err0;
|
|
1186
1143
|
}
|
|
1187
|
-
if (!stat.isDirectory())
|
|
1188
|
-
throw err0;
|
|
1144
|
+
if (!stat.isDirectory()) throw err0;
|
|
1189
1145
|
}
|
|
1190
1146
|
}
|
|
1191
1147
|
return made;
|
|
@@ -1235,20 +1191,15 @@ var require_utimes = __commonJS({
|
|
|
1235
1191
|
tmpfile = path4.join(os4.tmpdir(), tmpfile);
|
|
1236
1192
|
const d = /* @__PURE__ */ new Date(1435410243862);
|
|
1237
1193
|
fs5.writeFile(tmpfile, "https://github.com/jprichardson/node-fs-extra/pull/141", (err) => {
|
|
1238
|
-
if (err)
|
|
1239
|
-
return callback(err);
|
|
1194
|
+
if (err) return callback(err);
|
|
1240
1195
|
fs5.open(tmpfile, "r+", (err2, fd) => {
|
|
1241
|
-
if (err2)
|
|
1242
|
-
return callback(err2);
|
|
1196
|
+
if (err2) return callback(err2);
|
|
1243
1197
|
fs5.futimes(fd, d, d, (err3) => {
|
|
1244
|
-
if (err3)
|
|
1245
|
-
return callback(err3);
|
|
1198
|
+
if (err3) return callback(err3);
|
|
1246
1199
|
fs5.close(fd, (err4) => {
|
|
1247
|
-
if (err4)
|
|
1248
|
-
return callback(err4);
|
|
1200
|
+
if (err4) return callback(err4);
|
|
1249
1201
|
fs5.stat(tmpfile, (err5, stats) => {
|
|
1250
|
-
if (err5)
|
|
1251
|
-
return callback(err5);
|
|
1202
|
+
if (err5) return callback(err5);
|
|
1252
1203
|
callback(null, stats.mtime > 1435410243e3);
|
|
1253
1204
|
});
|
|
1254
1205
|
});
|
|
@@ -1267,12 +1218,10 @@ var require_utimes = __commonJS({
|
|
|
1267
1218
|
}
|
|
1268
1219
|
function utimesMillis(path5, atime, mtime, callback) {
|
|
1269
1220
|
fs5.open(path5, "r+", (err, fd) => {
|
|
1270
|
-
if (err)
|
|
1271
|
-
return callback(err);
|
|
1221
|
+
if (err) return callback(err);
|
|
1272
1222
|
fs5.futimes(fd, atime, mtime, (futimesErr) => {
|
|
1273
1223
|
fs5.close(fd, (closeErr) => {
|
|
1274
|
-
if (callback)
|
|
1275
|
-
callback(futimesErr || closeErr);
|
|
1224
|
+
if (callback) callback(futimesErr || closeErr);
|
|
1276
1225
|
});
|
|
1277
1226
|
});
|
|
1278
1227
|
});
|
|
@@ -1331,31 +1280,24 @@ var require_copy_sync = __commonJS({
|
|
|
1331
1280
|
see https://github.com/jprichardson/node-fs-extra/issues/269`);
|
|
1332
1281
|
}
|
|
1333
1282
|
const destStat = checkPaths(src, dest);
|
|
1334
|
-
if (opts.filter && !opts.filter(src, dest))
|
|
1335
|
-
return;
|
|
1283
|
+
if (opts.filter && !opts.filter(src, dest)) return;
|
|
1336
1284
|
const destParent = path4.dirname(dest);
|
|
1337
|
-
if (!fs5.existsSync(destParent))
|
|
1338
|
-
mkdirpSync(destParent);
|
|
1285
|
+
if (!fs5.existsSync(destParent)) mkdirpSync(destParent);
|
|
1339
1286
|
return startCopy(destStat, src, dest, opts);
|
|
1340
1287
|
}
|
|
1341
1288
|
function startCopy(destStat, src, dest, opts) {
|
|
1342
|
-
if (opts.filter && !opts.filter(src, dest))
|
|
1343
|
-
return;
|
|
1289
|
+
if (opts.filter && !opts.filter(src, dest)) return;
|
|
1344
1290
|
return getStats(destStat, src, dest, opts);
|
|
1345
1291
|
}
|
|
1346
1292
|
function getStats(destStat, src, dest, opts) {
|
|
1347
1293
|
const statSync = opts.dereference ? fs5.statSync : fs5.lstatSync;
|
|
1348
1294
|
const srcStat = statSync(src);
|
|
1349
|
-
if (srcStat.isDirectory())
|
|
1350
|
-
|
|
1351
|
-
else if (srcStat.
|
|
1352
|
-
return onFile(srcStat, destStat, src, dest, opts);
|
|
1353
|
-
else if (srcStat.isSymbolicLink())
|
|
1354
|
-
return onLink(destStat, src, dest, opts);
|
|
1295
|
+
if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);
|
|
1296
|
+
else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);
|
|
1297
|
+
else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts);
|
|
1355
1298
|
}
|
|
1356
1299
|
function onFile(srcStat, destStat, src, dest, opts) {
|
|
1357
|
-
if (destStat === notExist)
|
|
1358
|
-
return copyFile(srcStat, src, dest, opts);
|
|
1300
|
+
if (destStat === notExist) return copyFile(srcStat, src, dest, opts);
|
|
1359
1301
|
return mayCopyFile(srcStat, src, dest, opts);
|
|
1360
1302
|
}
|
|
1361
1303
|
function mayCopyFile(srcStat, src, dest, opts) {
|
|
@@ -1388,14 +1330,12 @@ var require_copy_sync = __commonJS({
|
|
|
1388
1330
|
fs5.writeSync(fdw, _buff, 0, bytesRead);
|
|
1389
1331
|
pos += bytesRead;
|
|
1390
1332
|
}
|
|
1391
|
-
if (opts.preserveTimestamps)
|
|
1392
|
-
fs5.futimesSync(fdw, srcStat.atime, srcStat.mtime);
|
|
1333
|
+
if (opts.preserveTimestamps) fs5.futimesSync(fdw, srcStat.atime, srcStat.mtime);
|
|
1393
1334
|
fs5.closeSync(fdr);
|
|
1394
1335
|
fs5.closeSync(fdw);
|
|
1395
1336
|
}
|
|
1396
1337
|
function onDir(srcStat, destStat, src, dest, opts) {
|
|
1397
|
-
if (destStat === notExist)
|
|
1398
|
-
return mkDirAndCopy(srcStat, src, dest, opts);
|
|
1338
|
+
if (destStat === notExist) return mkDirAndCopy(srcStat, src, dest, opts);
|
|
1399
1339
|
if (destStat && !destStat.isDirectory()) {
|
|
1400
1340
|
throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
|
|
1401
1341
|
}
|
|
@@ -1427,8 +1367,7 @@ var require_copy_sync = __commonJS({
|
|
|
1427
1367
|
try {
|
|
1428
1368
|
resolvedDest = fs5.readlinkSync(dest);
|
|
1429
1369
|
} catch (err) {
|
|
1430
|
-
if (err.code === "EINVAL" || err.code === "UNKNOWN")
|
|
1431
|
-
return fs5.symlinkSync(resolvedSrc, dest);
|
|
1370
|
+
if (err.code === "EINVAL" || err.code === "UNKNOWN") return fs5.symlinkSync(resolvedSrc, dest);
|
|
1432
1371
|
throw err;
|
|
1433
1372
|
}
|
|
1434
1373
|
if (opts.dereference) {
|
|
@@ -1458,8 +1397,7 @@ var require_copy_sync = __commonJS({
|
|
|
1458
1397
|
try {
|
|
1459
1398
|
destStat = fs5.statSync(dest);
|
|
1460
1399
|
} catch (err) {
|
|
1461
|
-
if (err.code === "ENOENT")
|
|
1462
|
-
return { srcStat, destStat: notExist };
|
|
1400
|
+
if (err.code === "ENOENT") return { srcStat, destStat: notExist };
|
|
1463
1401
|
throw err;
|
|
1464
1402
|
}
|
|
1465
1403
|
return { srcStat, destStat };
|
|
@@ -1532,23 +1470,18 @@ var require_copy = __commonJS({
|
|
|
1532
1470
|
see https://github.com/jprichardson/node-fs-extra/issues/269`);
|
|
1533
1471
|
}
|
|
1534
1472
|
checkPaths(src, dest, (err, destStat) => {
|
|
1535
|
-
if (err)
|
|
1536
|
-
|
|
1537
|
-
if (opts.filter)
|
|
1538
|
-
return handleFilter(checkParentDir, destStat, src, dest, opts, cb);
|
|
1473
|
+
if (err) return cb(err);
|
|
1474
|
+
if (opts.filter) return handleFilter(checkParentDir, destStat, src, dest, opts, cb);
|
|
1539
1475
|
return checkParentDir(destStat, src, dest, opts, cb);
|
|
1540
1476
|
});
|
|
1541
1477
|
}
|
|
1542
1478
|
function checkParentDir(destStat, src, dest, opts, cb) {
|
|
1543
1479
|
const destParent = path4.dirname(dest);
|
|
1544
1480
|
pathExists(destParent, (err, dirExists) => {
|
|
1545
|
-
if (err)
|
|
1546
|
-
|
|
1547
|
-
if (dirExists)
|
|
1548
|
-
return startCopy(destStat, src, dest, opts, cb);
|
|
1481
|
+
if (err) return cb(err);
|
|
1482
|
+
if (dirExists) return startCopy(destStat, src, dest, opts, cb);
|
|
1549
1483
|
mkdirp(destParent, (err2) => {
|
|
1550
|
-
if (err2)
|
|
1551
|
-
return cb(err2);
|
|
1484
|
+
if (err2) return cb(err2);
|
|
1552
1485
|
return startCopy(destStat, src, dest, opts, cb);
|
|
1553
1486
|
});
|
|
1554
1487
|
});
|
|
@@ -1556,53 +1489,43 @@ var require_copy = __commonJS({
|
|
|
1556
1489
|
function handleFilter(onInclude, destStat, src, dest, opts, cb) {
|
|
1557
1490
|
Promise.resolve(opts.filter(src, dest)).then((include) => {
|
|
1558
1491
|
if (include) {
|
|
1559
|
-
if (destStat)
|
|
1560
|
-
return onInclude(destStat, src, dest, opts, cb);
|
|
1492
|
+
if (destStat) return onInclude(destStat, src, dest, opts, cb);
|
|
1561
1493
|
return onInclude(src, dest, opts, cb);
|
|
1562
1494
|
}
|
|
1563
1495
|
return cb();
|
|
1564
1496
|
}, (error) => cb(error));
|
|
1565
1497
|
}
|
|
1566
1498
|
function startCopy(destStat, src, dest, opts, cb) {
|
|
1567
|
-
if (opts.filter)
|
|
1568
|
-
return handleFilter(getStats, destStat, src, dest, opts, cb);
|
|
1499
|
+
if (opts.filter) return handleFilter(getStats, destStat, src, dest, opts, cb);
|
|
1569
1500
|
return getStats(destStat, src, dest, opts, cb);
|
|
1570
1501
|
}
|
|
1571
1502
|
function getStats(destStat, src, dest, opts, cb) {
|
|
1572
1503
|
const stat = opts.dereference ? fs5.stat : fs5.lstat;
|
|
1573
1504
|
stat(src, (err, srcStat) => {
|
|
1574
|
-
if (err)
|
|
1575
|
-
|
|
1576
|
-
if (srcStat.
|
|
1577
|
-
|
|
1578
|
-
else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice())
|
|
1579
|
-
return onFile(srcStat, destStat, src, dest, opts, cb);
|
|
1580
|
-
else if (srcStat.isSymbolicLink())
|
|
1581
|
-
return onLink(destStat, src, dest, opts, cb);
|
|
1505
|
+
if (err) return cb(err);
|
|
1506
|
+
if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts, cb);
|
|
1507
|
+
else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts, cb);
|
|
1508
|
+
else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts, cb);
|
|
1582
1509
|
});
|
|
1583
1510
|
}
|
|
1584
1511
|
function onFile(srcStat, destStat, src, dest, opts, cb) {
|
|
1585
|
-
if (destStat === notExist)
|
|
1586
|
-
return copyFile(srcStat, src, dest, opts, cb);
|
|
1512
|
+
if (destStat === notExist) return copyFile(srcStat, src, dest, opts, cb);
|
|
1587
1513
|
return mayCopyFile(srcStat, src, dest, opts, cb);
|
|
1588
1514
|
}
|
|
1589
1515
|
function mayCopyFile(srcStat, src, dest, opts, cb) {
|
|
1590
1516
|
if (opts.overwrite) {
|
|
1591
1517
|
fs5.unlink(dest, (err) => {
|
|
1592
|
-
if (err)
|
|
1593
|
-
return cb(err);
|
|
1518
|
+
if (err) return cb(err);
|
|
1594
1519
|
return copyFile(srcStat, src, dest, opts, cb);
|
|
1595
1520
|
});
|
|
1596
1521
|
} else if (opts.errorOnExist) {
|
|
1597
1522
|
return cb(new Error(`'${dest}' already exists`));
|
|
1598
|
-
} else
|
|
1599
|
-
return cb();
|
|
1523
|
+
} else return cb();
|
|
1600
1524
|
}
|
|
1601
1525
|
function copyFile(srcStat, src, dest, opts, cb) {
|
|
1602
1526
|
if (typeof fs5.copyFile === "function") {
|
|
1603
1527
|
return fs5.copyFile(src, dest, (err) => {
|
|
1604
|
-
if (err)
|
|
1605
|
-
return cb(err);
|
|
1528
|
+
if (err) return cb(err);
|
|
1606
1529
|
return setDestModeAndTimestamps(srcStat, dest, opts, cb);
|
|
1607
1530
|
});
|
|
1608
1531
|
}
|
|
@@ -1617,8 +1540,7 @@ var require_copy = __commonJS({
|
|
|
1617
1540
|
}
|
|
1618
1541
|
function setDestModeAndTimestamps(srcStat, dest, opts, cb) {
|
|
1619
1542
|
fs5.chmod(dest, srcStat.mode, (err) => {
|
|
1620
|
-
if (err)
|
|
1621
|
-
return cb(err);
|
|
1543
|
+
if (err) return cb(err);
|
|
1622
1544
|
if (opts.preserveTimestamps) {
|
|
1623
1545
|
return utimes(dest, srcStat.atime, srcStat.mtime, cb);
|
|
1624
1546
|
}
|
|
@@ -1626,8 +1548,7 @@ var require_copy = __commonJS({
|
|
|
1626
1548
|
});
|
|
1627
1549
|
}
|
|
1628
1550
|
function onDir(srcStat, destStat, src, dest, opts, cb) {
|
|
1629
|
-
if (destStat === notExist)
|
|
1630
|
-
return mkDirAndCopy(srcStat, src, dest, opts, cb);
|
|
1551
|
+
if (destStat === notExist) return mkDirAndCopy(srcStat, src, dest, opts, cb);
|
|
1631
1552
|
if (destStat && !destStat.isDirectory()) {
|
|
1632
1553
|
return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`));
|
|
1633
1554
|
}
|
|
@@ -1635,45 +1556,38 @@ var require_copy = __commonJS({
|
|
|
1635
1556
|
}
|
|
1636
1557
|
function mkDirAndCopy(srcStat, src, dest, opts, cb) {
|
|
1637
1558
|
fs5.mkdir(dest, (err) => {
|
|
1638
|
-
if (err)
|
|
1639
|
-
return cb(err);
|
|
1559
|
+
if (err) return cb(err);
|
|
1640
1560
|
copyDir(src, dest, opts, (err2) => {
|
|
1641
|
-
if (err2)
|
|
1642
|
-
return cb(err2);
|
|
1561
|
+
if (err2) return cb(err2);
|
|
1643
1562
|
return fs5.chmod(dest, srcStat.mode, cb);
|
|
1644
1563
|
});
|
|
1645
1564
|
});
|
|
1646
1565
|
}
|
|
1647
1566
|
function copyDir(src, dest, opts, cb) {
|
|
1648
1567
|
fs5.readdir(src, (err, items) => {
|
|
1649
|
-
if (err)
|
|
1650
|
-
return cb(err);
|
|
1568
|
+
if (err) return cb(err);
|
|
1651
1569
|
return copyDirItems(items, src, dest, opts, cb);
|
|
1652
1570
|
});
|
|
1653
1571
|
}
|
|
1654
1572
|
function copyDirItems(items, src, dest, opts, cb) {
|
|
1655
1573
|
const item = items.pop();
|
|
1656
|
-
if (!item)
|
|
1657
|
-
return cb();
|
|
1574
|
+
if (!item) return cb();
|
|
1658
1575
|
return copyDirItem(items, item, src, dest, opts, cb);
|
|
1659
1576
|
}
|
|
1660
1577
|
function copyDirItem(items, item, src, dest, opts, cb) {
|
|
1661
1578
|
const srcItem = path4.join(src, item);
|
|
1662
1579
|
const destItem = path4.join(dest, item);
|
|
1663
1580
|
checkPaths(srcItem, destItem, (err, destStat) => {
|
|
1664
|
-
if (err)
|
|
1665
|
-
return cb(err);
|
|
1581
|
+
if (err) return cb(err);
|
|
1666
1582
|
startCopy(destStat, srcItem, destItem, opts, (err2) => {
|
|
1667
|
-
if (err2)
|
|
1668
|
-
return cb(err2);
|
|
1583
|
+
if (err2) return cb(err2);
|
|
1669
1584
|
return copyDirItems(items, src, dest, opts, cb);
|
|
1670
1585
|
});
|
|
1671
1586
|
});
|
|
1672
1587
|
}
|
|
1673
1588
|
function onLink(destStat, src, dest, opts, cb) {
|
|
1674
1589
|
fs5.readlink(src, (err, resolvedSrc) => {
|
|
1675
|
-
if (err)
|
|
1676
|
-
return cb(err);
|
|
1590
|
+
if (err) return cb(err);
|
|
1677
1591
|
if (opts.dereference) {
|
|
1678
1592
|
resolvedSrc = path4.resolve(process.cwd(), resolvedSrc);
|
|
1679
1593
|
}
|
|
@@ -1682,8 +1596,7 @@ var require_copy = __commonJS({
|
|
|
1682
1596
|
} else {
|
|
1683
1597
|
fs5.readlink(dest, (err2, resolvedDest) => {
|
|
1684
1598
|
if (err2) {
|
|
1685
|
-
if (err2.code === "EINVAL" || err2.code === "UNKNOWN")
|
|
1686
|
-
return fs5.symlink(resolvedSrc, dest, cb);
|
|
1599
|
+
if (err2.code === "EINVAL" || err2.code === "UNKNOWN") return fs5.symlink(resolvedSrc, dest, cb);
|
|
1687
1600
|
return cb(err2);
|
|
1688
1601
|
}
|
|
1689
1602
|
if (opts.dereference) {
|
|
@@ -1702,8 +1615,7 @@ var require_copy = __commonJS({
|
|
|
1702
1615
|
}
|
|
1703
1616
|
function copyLink(resolvedSrc, dest, cb) {
|
|
1704
1617
|
fs5.unlink(dest, (err) => {
|
|
1705
|
-
if (err)
|
|
1706
|
-
return cb(err);
|
|
1618
|
+
if (err) return cb(err);
|
|
1707
1619
|
return fs5.symlink(resolvedSrc, dest, cb);
|
|
1708
1620
|
});
|
|
1709
1621
|
}
|
|
@@ -1714,12 +1626,10 @@ var require_copy = __commonJS({
|
|
|
1714
1626
|
}
|
|
1715
1627
|
function checkStats(src, dest, cb) {
|
|
1716
1628
|
fs5.stat(src, (err, srcStat) => {
|
|
1717
|
-
if (err)
|
|
1718
|
-
return cb(err);
|
|
1629
|
+
if (err) return cb(err);
|
|
1719
1630
|
fs5.stat(dest, (err2, destStat) => {
|
|
1720
1631
|
if (err2) {
|
|
1721
|
-
if (err2.code === "ENOENT")
|
|
1722
|
-
return cb(null, { srcStat, destStat: notExist });
|
|
1632
|
+
if (err2.code === "ENOENT") return cb(null, { srcStat, destStat: notExist });
|
|
1723
1633
|
return cb(err2);
|
|
1724
1634
|
}
|
|
1725
1635
|
return cb(null, { srcStat, destStat });
|
|
@@ -1728,8 +1638,7 @@ var require_copy = __commonJS({
|
|
|
1728
1638
|
}
|
|
1729
1639
|
function checkPaths(src, dest, cb) {
|
|
1730
1640
|
checkStats(src, dest, (err, stats) => {
|
|
1731
|
-
if (err)
|
|
1732
|
-
return cb(err);
|
|
1641
|
+
if (err) return cb(err);
|
|
1733
1642
|
const { srcStat, destStat } = stats;
|
|
1734
1643
|
if (destStat.ino && destStat.ino === srcStat.ino) {
|
|
1735
1644
|
return cb(new Error("Source and destination must not be the same."));
|
|
@@ -1798,8 +1707,7 @@ var require_rimraf = __commonJS({
|
|
|
1798
1707
|
const time = busyTries * 100;
|
|
1799
1708
|
return setTimeout(() => rimraf_(p, options, CB), time);
|
|
1800
1709
|
}
|
|
1801
|
-
if (er.code === "ENOENT")
|
|
1802
|
-
er = null;
|
|
1710
|
+
if (er.code === "ENOENT") er = null;
|
|
1803
1711
|
}
|
|
1804
1712
|
cb(er);
|
|
1805
1713
|
});
|
|
@@ -1910,19 +1818,16 @@ var require_rimraf = __commonJS({
|
|
|
1910
1818
|
assert(options);
|
|
1911
1819
|
assert(typeof cb === "function");
|
|
1912
1820
|
options.readdir(p, (er, files) => {
|
|
1913
|
-
if (er)
|
|
1914
|
-
return cb(er);
|
|
1821
|
+
if (er) return cb(er);
|
|
1915
1822
|
let n = files.length;
|
|
1916
1823
|
let errState;
|
|
1917
|
-
if (n === 0)
|
|
1918
|
-
return options.rmdir(p, cb);
|
|
1824
|
+
if (n === 0) return options.rmdir(p, cb);
|
|
1919
1825
|
files.forEach((f) => {
|
|
1920
1826
|
rimraf(path4.join(p, f), options, (er2) => {
|
|
1921
1827
|
if (errState) {
|
|
1922
1828
|
return;
|
|
1923
1829
|
}
|
|
1924
|
-
if (er2)
|
|
1925
|
-
return cb(errState = er2);
|
|
1830
|
+
if (er2) return cb(errState = er2);
|
|
1926
1831
|
if (--n === 0) {
|
|
1927
1832
|
options.rmdir(p, cb);
|
|
1928
1833
|
}
|
|
@@ -2032,17 +1937,14 @@ var require_empty = __commonJS({
|
|
|
2032
1937
|
callback = callback || function() {
|
|
2033
1938
|
};
|
|
2034
1939
|
fs5.readdir(dir, (err, items) => {
|
|
2035
|
-
if (err)
|
|
2036
|
-
return mkdir.mkdirs(dir, callback);
|
|
1940
|
+
if (err) return mkdir.mkdirs(dir, callback);
|
|
2037
1941
|
items = items.map((item) => path4.join(dir, item));
|
|
2038
1942
|
deleteItem();
|
|
2039
1943
|
function deleteItem() {
|
|
2040
1944
|
const item = items.pop();
|
|
2041
|
-
if (!item)
|
|
2042
|
-
return callback();
|
|
1945
|
+
if (!item) return callback();
|
|
2043
1946
|
remove2.remove(item, (err2) => {
|
|
2044
|
-
if (err2)
|
|
2045
|
-
return callback(err2);
|
|
1947
|
+
if (err2) return callback(err2);
|
|
2046
1948
|
deleteItem();
|
|
2047
1949
|
});
|
|
2048
1950
|
}
|
|
@@ -2081,23 +1983,18 @@ var require_file = __commonJS({
|
|
|
2081
1983
|
function createFile(file, callback) {
|
|
2082
1984
|
function makeFile() {
|
|
2083
1985
|
fs5.writeFile(file, "", (err) => {
|
|
2084
|
-
if (err)
|
|
2085
|
-
return callback(err);
|
|
1986
|
+
if (err) return callback(err);
|
|
2086
1987
|
callback();
|
|
2087
1988
|
});
|
|
2088
1989
|
}
|
|
2089
1990
|
fs5.stat(file, (err, stats) => {
|
|
2090
|
-
if (!err && stats.isFile())
|
|
2091
|
-
return callback();
|
|
1991
|
+
if (!err && stats.isFile()) return callback();
|
|
2092
1992
|
const dir = path4.dirname(file);
|
|
2093
1993
|
pathExists(dir, (err2, dirExists) => {
|
|
2094
|
-
if (err2)
|
|
2095
|
-
|
|
2096
|
-
if (dirExists)
|
|
2097
|
-
return makeFile();
|
|
1994
|
+
if (err2) return callback(err2);
|
|
1995
|
+
if (dirExists) return makeFile();
|
|
2098
1996
|
mkdir.mkdirs(dir, (err3) => {
|
|
2099
|
-
if (err3)
|
|
2100
|
-
return callback(err3);
|
|
1997
|
+
if (err3) return callback(err3);
|
|
2101
1998
|
makeFile();
|
|
2102
1999
|
});
|
|
2103
2000
|
});
|
|
@@ -2109,8 +2006,7 @@ var require_file = __commonJS({
|
|
|
2109
2006
|
stats = fs5.statSync(file);
|
|
2110
2007
|
} catch (e) {
|
|
2111
2008
|
}
|
|
2112
|
-
if (stats && stats.isFile())
|
|
2113
|
-
return;
|
|
2009
|
+
if (stats && stats.isFile()) return;
|
|
2114
2010
|
const dir = path4.dirname(file);
|
|
2115
2011
|
if (!fs5.existsSync(dir)) {
|
|
2116
2012
|
mkdir.mkdirsSync(dir);
|
|
@@ -2136,16 +2032,13 @@ var require_link = __commonJS({
|
|
|
2136
2032
|
function createLink(srcpath, dstpath, callback) {
|
|
2137
2033
|
function makeLink(srcpath2, dstpath2) {
|
|
2138
2034
|
fs5.link(srcpath2, dstpath2, (err) => {
|
|
2139
|
-
if (err)
|
|
2140
|
-
return callback(err);
|
|
2035
|
+
if (err) return callback(err);
|
|
2141
2036
|
callback(null);
|
|
2142
2037
|
});
|
|
2143
2038
|
}
|
|
2144
2039
|
pathExists(dstpath, (err, destinationExists) => {
|
|
2145
|
-
if (err)
|
|
2146
|
-
|
|
2147
|
-
if (destinationExists)
|
|
2148
|
-
return callback(null);
|
|
2040
|
+
if (err) return callback(err);
|
|
2041
|
+
if (destinationExists) return callback(null);
|
|
2149
2042
|
fs5.lstat(srcpath, (err2) => {
|
|
2150
2043
|
if (err2) {
|
|
2151
2044
|
err2.message = err2.message.replace("lstat", "ensureLink");
|
|
@@ -2153,13 +2046,10 @@ var require_link = __commonJS({
|
|
|
2153
2046
|
}
|
|
2154
2047
|
const dir = path4.dirname(dstpath);
|
|
2155
2048
|
pathExists(dir, (err3, dirExists) => {
|
|
2156
|
-
if (err3)
|
|
2157
|
-
|
|
2158
|
-
if (dirExists)
|
|
2159
|
-
return makeLink(srcpath, dstpath);
|
|
2049
|
+
if (err3) return callback(err3);
|
|
2050
|
+
if (dirExists) return makeLink(srcpath, dstpath);
|
|
2160
2051
|
mkdir.mkdirs(dir, (err4) => {
|
|
2161
|
-
if (err4)
|
|
2162
|
-
return callback(err4);
|
|
2052
|
+
if (err4) return callback(err4);
|
|
2163
2053
|
makeLink(srcpath, dstpath);
|
|
2164
2054
|
});
|
|
2165
2055
|
});
|
|
@@ -2168,8 +2058,7 @@ var require_link = __commonJS({
|
|
|
2168
2058
|
}
|
|
2169
2059
|
function createLinkSync(srcpath, dstpath) {
|
|
2170
2060
|
const destinationExists = fs5.existsSync(dstpath);
|
|
2171
|
-
if (destinationExists)
|
|
2172
|
-
return void 0;
|
|
2061
|
+
if (destinationExists) return void 0;
|
|
2173
2062
|
try {
|
|
2174
2063
|
fs5.lstatSync(srcpath);
|
|
2175
2064
|
} catch (err) {
|
|
@@ -2178,8 +2067,7 @@ var require_link = __commonJS({
|
|
|
2178
2067
|
}
|
|
2179
2068
|
const dir = path4.dirname(dstpath);
|
|
2180
2069
|
const dirExists = fs5.existsSync(dir);
|
|
2181
|
-
if (dirExists)
|
|
2182
|
-
return fs5.linkSync(srcpath, dstpath);
|
|
2070
|
+
if (dirExists) return fs5.linkSync(srcpath, dstpath);
|
|
2183
2071
|
mkdir.mkdirsSync(dir);
|
|
2184
2072
|
return fs5.linkSync(srcpath, dstpath);
|
|
2185
2073
|
}
|
|
@@ -2213,8 +2101,7 @@ var require_symlink_paths = __commonJS({
|
|
|
2213
2101
|
const dstdir = path4.dirname(dstpath);
|
|
2214
2102
|
const relativeToDst = path4.join(dstdir, srcpath);
|
|
2215
2103
|
return pathExists(relativeToDst, (err, exists2) => {
|
|
2216
|
-
if (err)
|
|
2217
|
-
return callback(err);
|
|
2104
|
+
if (err) return callback(err);
|
|
2218
2105
|
if (exists2) {
|
|
2219
2106
|
return callback(null, {
|
|
2220
2107
|
"toCwd": relativeToDst,
|
|
@@ -2239,8 +2126,7 @@ var require_symlink_paths = __commonJS({
|
|
|
2239
2126
|
let exists2;
|
|
2240
2127
|
if (path4.isAbsolute(srcpath)) {
|
|
2241
2128
|
exists2 = fs5.existsSync(srcpath);
|
|
2242
|
-
if (!exists2)
|
|
2243
|
-
throw new Error("absolute srcpath does not exist");
|
|
2129
|
+
if (!exists2) throw new Error("absolute srcpath does not exist");
|
|
2244
2130
|
return {
|
|
2245
2131
|
"toCwd": srcpath,
|
|
2246
2132
|
"toDst": srcpath
|
|
@@ -2256,8 +2142,7 @@ var require_symlink_paths = __commonJS({
|
|
|
2256
2142
|
};
|
|
2257
2143
|
} else {
|
|
2258
2144
|
exists2 = fs5.existsSync(srcpath);
|
|
2259
|
-
if (!exists2)
|
|
2260
|
-
throw new Error("relative srcpath does not exist");
|
|
2145
|
+
if (!exists2) throw new Error("relative srcpath does not exist");
|
|
2261
2146
|
return {
|
|
2262
2147
|
"toCwd": srcpath,
|
|
2263
2148
|
"toDst": path4.relative(dstdir, srcpath)
|
|
@@ -2280,19 +2165,16 @@ var require_symlink_type = __commonJS({
|
|
|
2280
2165
|
function symlinkType(srcpath, type, callback) {
|
|
2281
2166
|
callback = typeof type === "function" ? type : callback;
|
|
2282
2167
|
type = typeof type === "function" ? false : type;
|
|
2283
|
-
if (type)
|
|
2284
|
-
return callback(null, type);
|
|
2168
|
+
if (type) return callback(null, type);
|
|
2285
2169
|
fs5.lstat(srcpath, (err, stats) => {
|
|
2286
|
-
if (err)
|
|
2287
|
-
return callback(null, "file");
|
|
2170
|
+
if (err) return callback(null, "file");
|
|
2288
2171
|
type = stats && stats.isDirectory() ? "dir" : "file";
|
|
2289
2172
|
callback(null, type);
|
|
2290
2173
|
});
|
|
2291
2174
|
}
|
|
2292
2175
|
function symlinkTypeSync(srcpath, type) {
|
|
2293
2176
|
let stats;
|
|
2294
|
-
if (type)
|
|
2295
|
-
return type;
|
|
2177
|
+
if (type) return type;
|
|
2296
2178
|
try {
|
|
2297
2179
|
stats = fs5.lstatSync(srcpath);
|
|
2298
2180
|
} catch (e) {
|
|
@@ -2328,26 +2210,19 @@ var require_symlink = __commonJS({
|
|
|
2328
2210
|
callback = typeof type === "function" ? type : callback;
|
|
2329
2211
|
type = typeof type === "function" ? false : type;
|
|
2330
2212
|
pathExists(dstpath, (err, destinationExists) => {
|
|
2331
|
-
if (err)
|
|
2332
|
-
|
|
2333
|
-
if (destinationExists)
|
|
2334
|
-
return callback(null);
|
|
2213
|
+
if (err) return callback(err);
|
|
2214
|
+
if (destinationExists) return callback(null);
|
|
2335
2215
|
symlinkPaths(srcpath, dstpath, (err2, relative) => {
|
|
2336
|
-
if (err2)
|
|
2337
|
-
return callback(err2);
|
|
2216
|
+
if (err2) return callback(err2);
|
|
2338
2217
|
srcpath = relative.toDst;
|
|
2339
2218
|
symlinkType(relative.toCwd, type, (err3, type2) => {
|
|
2340
|
-
if (err3)
|
|
2341
|
-
return callback(err3);
|
|
2219
|
+
if (err3) return callback(err3);
|
|
2342
2220
|
const dir = path4.dirname(dstpath);
|
|
2343
2221
|
pathExists(dir, (err4, dirExists) => {
|
|
2344
|
-
if (err4)
|
|
2345
|
-
|
|
2346
|
-
if (dirExists)
|
|
2347
|
-
return fs5.symlink(srcpath, dstpath, type2, callback);
|
|
2222
|
+
if (err4) return callback(err4);
|
|
2223
|
+
if (dirExists) return fs5.symlink(srcpath, dstpath, type2, callback);
|
|
2348
2224
|
mkdirs(dir, (err5) => {
|
|
2349
|
-
if (err5)
|
|
2350
|
-
return callback(err5);
|
|
2225
|
+
if (err5) return callback(err5);
|
|
2351
2226
|
fs5.symlink(srcpath, dstpath, type2, callback);
|
|
2352
2227
|
});
|
|
2353
2228
|
});
|
|
@@ -2357,15 +2232,13 @@ var require_symlink = __commonJS({
|
|
|
2357
2232
|
}
|
|
2358
2233
|
function createSymlinkSync(srcpath, dstpath, type) {
|
|
2359
2234
|
const destinationExists = fs5.existsSync(dstpath);
|
|
2360
|
-
if (destinationExists)
|
|
2361
|
-
return void 0;
|
|
2235
|
+
if (destinationExists) return void 0;
|
|
2362
2236
|
const relative = symlinkPathsSync(srcpath, dstpath);
|
|
2363
2237
|
srcpath = relative.toDst;
|
|
2364
2238
|
type = symlinkTypeSync(relative.toCwd, type);
|
|
2365
2239
|
const dir = path4.dirname(dstpath);
|
|
2366
2240
|
const exists2 = fs5.existsSync(dir);
|
|
2367
|
-
if (exists2)
|
|
2368
|
-
return fs5.symlinkSync(srcpath, dstpath, type);
|
|
2241
|
+
if (exists2) return fs5.symlinkSync(srcpath, dstpath, type);
|
|
2369
2242
|
mkdirsSync(dir);
|
|
2370
2243
|
return fs5.symlinkSync(srcpath, dstpath, type);
|
|
2371
2244
|
}
|
|
@@ -2406,6 +2279,7 @@ var require_ensure = __commonJS({
|
|
|
2406
2279
|
// ../../node_modules/jsonfile/index.js
|
|
2407
2280
|
var require_jsonfile = __commonJS({
|
|
2408
2281
|
"../../node_modules/jsonfile/index.js"(exports, module) {
|
|
2282
|
+
"use strict";
|
|
2409
2283
|
var _fs;
|
|
2410
2284
|
try {
|
|
2411
2285
|
_fs = require_graceful_fs();
|
|
@@ -2427,8 +2301,7 @@ var require_jsonfile = __commonJS({
|
|
|
2427
2301
|
shouldThrow = options.throws;
|
|
2428
2302
|
}
|
|
2429
2303
|
fs5.readFile(file, options, function(err, data) {
|
|
2430
|
-
if (err)
|
|
2431
|
-
return callback(err);
|
|
2304
|
+
if (err) return callback(err);
|
|
2432
2305
|
data = stripBom(data);
|
|
2433
2306
|
var obj;
|
|
2434
2307
|
try {
|
|
@@ -2492,8 +2365,7 @@ var require_jsonfile = __commonJS({
|
|
|
2492
2365
|
try {
|
|
2493
2366
|
str = stringify(obj, options);
|
|
2494
2367
|
} catch (err) {
|
|
2495
|
-
if (callback)
|
|
2496
|
-
callback(err, null);
|
|
2368
|
+
if (callback) callback(err, null);
|
|
2497
2369
|
return;
|
|
2498
2370
|
}
|
|
2499
2371
|
fs5.writeFile(file, str, options, callback);
|
|
@@ -2505,8 +2377,7 @@ var require_jsonfile = __commonJS({
|
|
|
2505
2377
|
return fs5.writeFileSync(file, str, options);
|
|
2506
2378
|
}
|
|
2507
2379
|
function stripBom(content) {
|
|
2508
|
-
if (Buffer.isBuffer(content))
|
|
2509
|
-
content = content.toString("utf8");
|
|
2380
|
+
if (Buffer.isBuffer(content)) content = content.toString("utf8");
|
|
2510
2381
|
content = content.replace(/^\uFEFF/, "");
|
|
2511
2382
|
return content;
|
|
2512
2383
|
}
|
|
@@ -2551,13 +2422,10 @@ var require_output_json = __commonJS({
|
|
|
2551
2422
|
}
|
|
2552
2423
|
const dir = path4.dirname(file);
|
|
2553
2424
|
pathExists(dir, (err, itDoes) => {
|
|
2554
|
-
if (err)
|
|
2555
|
-
|
|
2556
|
-
if (itDoes)
|
|
2557
|
-
return jsonFile.writeJson(file, data, options, callback);
|
|
2425
|
+
if (err) return callback(err);
|
|
2426
|
+
if (itDoes) return jsonFile.writeJson(file, data, options, callback);
|
|
2558
2427
|
mkdir.mkdirs(dir, (err2) => {
|
|
2559
|
-
if (err2)
|
|
2560
|
-
return callback(err2);
|
|
2428
|
+
if (err2) return callback(err2);
|
|
2561
2429
|
jsonFile.writeJson(file, data, options, callback);
|
|
2562
2430
|
});
|
|
2563
2431
|
});
|
|
@@ -2618,10 +2486,8 @@ var require_move_sync = __commonJS({
|
|
|
2618
2486
|
const overwrite = options.overwrite || options.clobber || false;
|
|
2619
2487
|
src = path4.resolve(src);
|
|
2620
2488
|
dest = path4.resolve(dest);
|
|
2621
|
-
if (src === dest)
|
|
2622
|
-
|
|
2623
|
-
if (isSrcSubdir(src, dest))
|
|
2624
|
-
throw new Error(`Cannot move '${src}' into itself '${dest}'.`);
|
|
2489
|
+
if (src === dest) return fs5.accessSync(src);
|
|
2490
|
+
if (isSrcSubdir(src, dest)) throw new Error(`Cannot move '${src}' into itself '${dest}'.`);
|
|
2625
2491
|
mkdirpSync(path4.dirname(dest));
|
|
2626
2492
|
tryRenameSync();
|
|
2627
2493
|
function tryRenameSync() {
|
|
@@ -2634,8 +2500,7 @@ var require_move_sync = __commonJS({
|
|
|
2634
2500
|
options.overwrite = false;
|
|
2635
2501
|
return moveSync(src, dest, options);
|
|
2636
2502
|
}
|
|
2637
|
-
if (err.code !== "EXDEV")
|
|
2638
|
-
throw err;
|
|
2503
|
+
if (err.code !== "EXDEV") throw err;
|
|
2639
2504
|
return moveSyncAcrossDevice(src, dest, overwrite);
|
|
2640
2505
|
}
|
|
2641
2506
|
} else {
|
|
@@ -2723,17 +2588,14 @@ var require_move = __commonJS({
|
|
|
2723
2588
|
const overwrite = opts.overwrite || opts.clobber || false;
|
|
2724
2589
|
src = path4.resolve(src);
|
|
2725
2590
|
dest = path4.resolve(dest);
|
|
2726
|
-
if (src === dest)
|
|
2727
|
-
return fs5.access(src, cb);
|
|
2591
|
+
if (src === dest) return fs5.access(src, cb);
|
|
2728
2592
|
fs5.stat(src, (err, st) => {
|
|
2729
|
-
if (err)
|
|
2730
|
-
return cb(err);
|
|
2593
|
+
if (err) return cb(err);
|
|
2731
2594
|
if (st.isDirectory() && isSrcSubdir(src, dest)) {
|
|
2732
2595
|
return cb(new Error(`Cannot move '${src}' to a subdirectory of itself, '${dest}'.`));
|
|
2733
2596
|
}
|
|
2734
2597
|
mkdirp(path4.dirname(dest), (err2) => {
|
|
2735
|
-
if (err2)
|
|
2736
|
-
return cb(err2);
|
|
2598
|
+
if (err2) return cb(err2);
|
|
2737
2599
|
return doRename(src, dest, overwrite, cb);
|
|
2738
2600
|
});
|
|
2739
2601
|
});
|
|
@@ -2741,25 +2603,20 @@ var require_move = __commonJS({
|
|
|
2741
2603
|
function doRename(src, dest, overwrite, cb) {
|
|
2742
2604
|
if (overwrite) {
|
|
2743
2605
|
return remove2(dest, (err) => {
|
|
2744
|
-
if (err)
|
|
2745
|
-
return cb(err);
|
|
2606
|
+
if (err) return cb(err);
|
|
2746
2607
|
return rename(src, dest, overwrite, cb);
|
|
2747
2608
|
});
|
|
2748
2609
|
}
|
|
2749
2610
|
pathExists(dest, (err, destExists) => {
|
|
2750
|
-
if (err)
|
|
2751
|
-
|
|
2752
|
-
if (destExists)
|
|
2753
|
-
return cb(new Error("dest already exists."));
|
|
2611
|
+
if (err) return cb(err);
|
|
2612
|
+
if (destExists) return cb(new Error("dest already exists."));
|
|
2754
2613
|
return rename(src, dest, overwrite, cb);
|
|
2755
2614
|
});
|
|
2756
2615
|
}
|
|
2757
2616
|
function rename(src, dest, overwrite, cb) {
|
|
2758
2617
|
fs5.rename(src, dest, (err) => {
|
|
2759
|
-
if (!err)
|
|
2760
|
-
|
|
2761
|
-
if (err.code !== "EXDEV")
|
|
2762
|
-
return cb(err);
|
|
2618
|
+
if (!err) return cb();
|
|
2619
|
+
if (err.code !== "EXDEV") return cb(err);
|
|
2763
2620
|
return moveAcrossDevice(src, dest, overwrite, cb);
|
|
2764
2621
|
});
|
|
2765
2622
|
}
|
|
@@ -2769,8 +2626,7 @@ var require_move = __commonJS({
|
|
|
2769
2626
|
errorOnExist: true
|
|
2770
2627
|
};
|
|
2771
2628
|
copy2(src, dest, opts, (err) => {
|
|
2772
|
-
if (err)
|
|
2773
|
-
return cb(err);
|
|
2629
|
+
if (err) return cb(err);
|
|
2774
2630
|
return remove2(src, cb);
|
|
2775
2631
|
});
|
|
2776
2632
|
}
|
|
@@ -2803,13 +2659,10 @@ var require_output = __commonJS({
|
|
|
2803
2659
|
}
|
|
2804
2660
|
const dir = path4.dirname(file);
|
|
2805
2661
|
pathExists(dir, (err, itDoes) => {
|
|
2806
|
-
if (err)
|
|
2807
|
-
|
|
2808
|
-
if (itDoes)
|
|
2809
|
-
return fs5.writeFile(file, data, encoding, callback);
|
|
2662
|
+
if (err) return callback(err);
|
|
2663
|
+
if (itDoes) return fs5.writeFile(file, data, encoding, callback);
|
|
2810
2664
|
mkdir.mkdirs(dir, (err2) => {
|
|
2811
|
-
if (err2)
|
|
2812
|
-
return callback(err2);
|
|
2665
|
+
if (err2) return callback(err2);
|
|
2813
2666
|
fs5.writeFile(file, data, encoding, callback);
|
|
2814
2667
|
});
|
|
2815
2668
|
});
|
|
@@ -2867,43 +2720,36 @@ import envinfo from "envinfo";
|
|
|
2867
2720
|
import semver3 from "semver";
|
|
2868
2721
|
import { execSync as execSync3 } from "child_process";
|
|
2869
2722
|
|
|
2870
|
-
//
|
|
2871
|
-
import
|
|
2872
|
-
import
|
|
2873
|
-
import
|
|
2874
|
-
import
|
|
2875
|
-
import
|
|
2876
|
-
|
|
2877
|
-
|
|
2723
|
+
// loaders.ts
|
|
2724
|
+
import _ from "underscore";
|
|
2725
|
+
import fs3 from "fs";
|
|
2726
|
+
import chalk from "chalk";
|
|
2727
|
+
import readdirp from "readdirp";
|
|
2728
|
+
import { dirname } from "path";
|
|
2729
|
+
|
|
2730
|
+
// paths.ts
|
|
2731
|
+
import fs2 from "fs";
|
|
2732
|
+
import os2 from "os";
|
|
2733
|
+
import path2 from "path";
|
|
2734
|
+
|
|
2735
|
+
// git.ts
|
|
2736
|
+
import os from "os";
|
|
2737
|
+
import path from "path";
|
|
2738
|
+
import fs from "fs";
|
|
2739
|
+
import debug2 from "debug";
|
|
2878
2740
|
|
|
2879
2741
|
// ../../node_modules/simple-git/dist/esm/index.js
|
|
2880
2742
|
var import_file_exists = __toESM(require_dist(), 1);
|
|
2881
2743
|
var import_promise_deferred = __toESM(require_dist2(), 1);
|
|
2882
2744
|
var import_promise_deferred2 = __toESM(require_dist2(), 1);
|
|
2745
|
+
import { Buffer as Buffer2 } from "buffer";
|
|
2883
2746
|
import debug from "debug";
|
|
2884
2747
|
import { spawn } from "child_process";
|
|
2748
|
+
import { EventEmitter } from "events";
|
|
2885
2749
|
var __defProp2 = Object.defineProperty;
|
|
2886
|
-
var __defProps = Object.defineProperties;
|
|
2887
2750
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
2888
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
2889
2751
|
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
2890
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
2891
2752
|
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
2892
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
2893
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2894
|
-
var __spreadValues = (a, b) => {
|
|
2895
|
-
for (var prop in b || (b = {}))
|
|
2896
|
-
if (__hasOwnProp2.call(b, prop))
|
|
2897
|
-
__defNormalProp(a, prop, b[prop]);
|
|
2898
|
-
if (__getOwnPropSymbols)
|
|
2899
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
2900
|
-
if (__propIsEnum.call(b, prop))
|
|
2901
|
-
__defNormalProp(a, prop, b[prop]);
|
|
2902
|
-
}
|
|
2903
|
-
return a;
|
|
2904
|
-
};
|
|
2905
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
2906
|
-
var __markAsModule = (target) => __defProp2(target, "__esModule", { value: true });
|
|
2907
2753
|
var __esm = (fn, res) => function __init() {
|
|
2908
2754
|
return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
|
|
2909
2755
|
};
|
|
@@ -2914,39 +2760,15 @@ var __export = (target, all) => {
|
|
|
2914
2760
|
for (var name in all)
|
|
2915
2761
|
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
2916
2762
|
};
|
|
2917
|
-
var
|
|
2918
|
-
if (
|
|
2919
|
-
for (let key of __getOwnPropNames2(
|
|
2920
|
-
if (!__hasOwnProp2.call(
|
|
2921
|
-
__defProp2(
|
|
2763
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
2764
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
2765
|
+
for (let key of __getOwnPropNames2(from))
|
|
2766
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
2767
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
2922
2768
|
}
|
|
2923
|
-
return
|
|
2924
|
-
};
|
|
2925
|
-
var __toCommonJS = /* @__PURE__ */ ((cache2) => {
|
|
2926
|
-
return (module, temp) => {
|
|
2927
|
-
return cache2 && cache2.get(module) || (temp = __reExport(__markAsModule({}), module, 1), cache2 && cache2.set(module, temp), temp);
|
|
2928
|
-
};
|
|
2929
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
2930
|
-
var __async = (__this, __arguments, generator) => {
|
|
2931
|
-
return new Promise((resolve, reject) => {
|
|
2932
|
-
var fulfilled = (value) => {
|
|
2933
|
-
try {
|
|
2934
|
-
step(generator.next(value));
|
|
2935
|
-
} catch (e) {
|
|
2936
|
-
reject(e);
|
|
2937
|
-
}
|
|
2938
|
-
};
|
|
2939
|
-
var rejected = (value) => {
|
|
2940
|
-
try {
|
|
2941
|
-
step(generator.throw(value));
|
|
2942
|
-
} catch (e) {
|
|
2943
|
-
reject(e);
|
|
2944
|
-
}
|
|
2945
|
-
};
|
|
2946
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
2947
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
2948
|
-
});
|
|
2769
|
+
return to;
|
|
2949
2770
|
};
|
|
2771
|
+
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
2950
2772
|
function pathspec(...paths) {
|
|
2951
2773
|
const key = new String(paths);
|
|
2952
2774
|
cache.set(key, paths);
|
|
@@ -2961,12 +2783,14 @@ function toPaths(pathSpec) {
|
|
|
2961
2783
|
var cache;
|
|
2962
2784
|
var init_pathspec = __esm({
|
|
2963
2785
|
"src/lib/args/pathspec.ts"() {
|
|
2786
|
+
"use strict";
|
|
2964
2787
|
cache = /* @__PURE__ */ new WeakMap();
|
|
2965
2788
|
}
|
|
2966
2789
|
});
|
|
2967
2790
|
var GitError;
|
|
2968
2791
|
var init_git_error = __esm({
|
|
2969
2792
|
"src/lib/errors/git-error.ts"() {
|
|
2793
|
+
"use strict";
|
|
2970
2794
|
GitError = class extends Error {
|
|
2971
2795
|
constructor(task, message) {
|
|
2972
2796
|
super(message);
|
|
@@ -2979,6 +2803,7 @@ var init_git_error = __esm({
|
|
|
2979
2803
|
var GitResponseError;
|
|
2980
2804
|
var init_git_response_error = __esm({
|
|
2981
2805
|
"src/lib/errors/git-response-error.ts"() {
|
|
2806
|
+
"use strict";
|
|
2982
2807
|
init_git_error();
|
|
2983
2808
|
GitResponseError = class extends GitError {
|
|
2984
2809
|
constructor(git, message) {
|
|
@@ -2991,6 +2816,7 @@ var init_git_response_error = __esm({
|
|
|
2991
2816
|
var TaskConfigurationError;
|
|
2992
2817
|
var init_task_configuration_error = __esm({
|
|
2993
2818
|
"src/lib/errors/task-configuration-error.ts"() {
|
|
2819
|
+
"use strict";
|
|
2994
2820
|
init_git_error();
|
|
2995
2821
|
TaskConfigurationError = class extends GitError {
|
|
2996
2822
|
constructor(message) {
|
|
@@ -3000,7 +2826,10 @@ var init_task_configuration_error = __esm({
|
|
|
3000
2826
|
}
|
|
3001
2827
|
});
|
|
3002
2828
|
function asFunction(source) {
|
|
3003
|
-
|
|
2829
|
+
if (typeof source !== "function") {
|
|
2830
|
+
return NOOP;
|
|
2831
|
+
}
|
|
2832
|
+
return source;
|
|
3004
2833
|
}
|
|
3005
2834
|
function isUserFunction(source) {
|
|
3006
2835
|
return typeof source === "function" && source !== NOOP;
|
|
@@ -3068,6 +2897,11 @@ function remove(target, item) {
|
|
|
3068
2897
|
function asArray(source) {
|
|
3069
2898
|
return Array.isArray(source) ? source : [source];
|
|
3070
2899
|
}
|
|
2900
|
+
function asCamelCase(str) {
|
|
2901
|
+
return str.replace(/[\s-]+(.)/g, (_all, chr) => {
|
|
2902
|
+
return chr.toUpperCase();
|
|
2903
|
+
});
|
|
2904
|
+
}
|
|
3071
2905
|
function asStringArray(source) {
|
|
3072
2906
|
return asArray(source).map(String);
|
|
3073
2907
|
}
|
|
@@ -3086,10 +2920,13 @@ function prefixedArray(input, prefix) {
|
|
|
3086
2920
|
return output;
|
|
3087
2921
|
}
|
|
3088
2922
|
function bufferToString(input) {
|
|
3089
|
-
return (Array.isArray(input) ?
|
|
2923
|
+
return (Array.isArray(input) ? Buffer2.concat(input) : input).toString("utf-8");
|
|
3090
2924
|
}
|
|
3091
2925
|
function pick(source, properties) {
|
|
3092
|
-
return Object.assign(
|
|
2926
|
+
return Object.assign(
|
|
2927
|
+
{},
|
|
2928
|
+
...properties.map((property) => property in source ? { [property]: source[property] } : {})
|
|
2929
|
+
);
|
|
3093
2930
|
}
|
|
3094
2931
|
function delay(duration = 0) {
|
|
3095
2932
|
return new Promise((done) => setTimeout(done, duration));
|
|
@@ -3105,6 +2942,7 @@ var NOOP;
|
|
|
3105
2942
|
var objectToString;
|
|
3106
2943
|
var init_util = __esm({
|
|
3107
2944
|
"src/lib/utils/util.ts"() {
|
|
2945
|
+
"use strict";
|
|
3108
2946
|
NULL = "\0";
|
|
3109
2947
|
NOOP = () => {
|
|
3110
2948
|
};
|
|
@@ -3134,6 +2972,7 @@ var filterStringOrStringArray;
|
|
|
3134
2972
|
var filterHasLength;
|
|
3135
2973
|
var init_argument_filters = __esm({
|
|
3136
2974
|
"src/lib/utils/argument-filters.ts"() {
|
|
2975
|
+
"use strict";
|
|
3137
2976
|
init_util();
|
|
3138
2977
|
init_pathspec();
|
|
3139
2978
|
filterArray = (input) => {
|
|
@@ -3159,6 +2998,7 @@ var init_argument_filters = __esm({
|
|
|
3159
2998
|
var ExitCodes;
|
|
3160
2999
|
var init_exit_codes = __esm({
|
|
3161
3000
|
"src/lib/utils/exit-codes.ts"() {
|
|
3001
|
+
"use strict";
|
|
3162
3002
|
ExitCodes = /* @__PURE__ */ ((ExitCodes2) => {
|
|
3163
3003
|
ExitCodes2[ExitCodes2["SUCCESS"] = 0] = "SUCCESS";
|
|
3164
3004
|
ExitCodes2[ExitCodes2["ERROR"] = 1] = "ERROR";
|
|
@@ -3171,13 +3011,14 @@ var init_exit_codes = __esm({
|
|
|
3171
3011
|
var GitOutputStreams;
|
|
3172
3012
|
var init_git_output_streams = __esm({
|
|
3173
3013
|
"src/lib/utils/git-output-streams.ts"() {
|
|
3174
|
-
|
|
3014
|
+
"use strict";
|
|
3015
|
+
GitOutputStreams = class _GitOutputStreams {
|
|
3175
3016
|
constructor(stdOut, stdErr) {
|
|
3176
3017
|
this.stdOut = stdOut;
|
|
3177
3018
|
this.stdErr = stdErr;
|
|
3178
3019
|
}
|
|
3179
3020
|
asStrings() {
|
|
3180
|
-
return new
|
|
3021
|
+
return new _GitOutputStreams(this.stdOut.toString("utf8"), this.stdErr.toString("utf8"));
|
|
3181
3022
|
}
|
|
3182
3023
|
};
|
|
3183
3024
|
}
|
|
@@ -3186,6 +3027,7 @@ var LineParser;
|
|
|
3186
3027
|
var RemoteLineParser;
|
|
3187
3028
|
var init_line_parser = __esm({
|
|
3188
3029
|
"src/lib/utils/line-parser.ts"() {
|
|
3030
|
+
"use strict";
|
|
3189
3031
|
LineParser = class {
|
|
3190
3032
|
constructor(regExp, useMatches) {
|
|
3191
3033
|
this.matches = [];
|
|
@@ -3201,6 +3043,7 @@ var init_line_parser = __esm({
|
|
|
3201
3043
|
this.useMatches = useMatches;
|
|
3202
3044
|
}
|
|
3203
3045
|
}
|
|
3046
|
+
// @ts-ignore
|
|
3204
3047
|
useMatches(target, match) {
|
|
3205
3048
|
throw new Error(`LineParser:useMatches not implemented`);
|
|
3206
3049
|
}
|
|
@@ -3235,7 +3078,10 @@ var init_line_parser = __esm({
|
|
|
3235
3078
|
});
|
|
3236
3079
|
function createInstanceConfig(...options) {
|
|
3237
3080
|
const baseDir = process.cwd();
|
|
3238
|
-
const config = Object.assign(
|
|
3081
|
+
const config = Object.assign(
|
|
3082
|
+
{ baseDir, ...defaultOptions },
|
|
3083
|
+
...options.filter((o) => typeof o === "object" && o)
|
|
3084
|
+
);
|
|
3239
3085
|
config.baseDir = config.baseDir || baseDir;
|
|
3240
3086
|
config.trimmed = config.trimmed === true;
|
|
3241
3087
|
return config;
|
|
@@ -3243,6 +3089,7 @@ function createInstanceConfig(...options) {
|
|
|
3243
3089
|
var defaultOptions;
|
|
3244
3090
|
var init_simple_git_options = __esm({
|
|
3245
3091
|
"src/lib/utils/simple-git-options.ts"() {
|
|
3092
|
+
"use strict";
|
|
3246
3093
|
defaultOptions = {
|
|
3247
3094
|
binary: "git",
|
|
3248
3095
|
maxConcurrentProcesses: 5,
|
|
@@ -3261,6 +3108,12 @@ function appendTaskOptions(options, commands = []) {
|
|
|
3261
3108
|
commands2.push(value);
|
|
3262
3109
|
} else if (filterPrimitives(value, ["boolean"])) {
|
|
3263
3110
|
commands2.push(key + "=" + value);
|
|
3111
|
+
} else if (Array.isArray(value)) {
|
|
3112
|
+
for (const v of value) {
|
|
3113
|
+
if (!filterPrimitives(v, ["string", "number"])) {
|
|
3114
|
+
commands2.push(key + "=" + v);
|
|
3115
|
+
}
|
|
3116
|
+
}
|
|
3264
3117
|
} else {
|
|
3265
3118
|
commands2.push(key);
|
|
3266
3119
|
}
|
|
@@ -3294,13 +3147,14 @@ function trailingFunctionArgument(args, includeNoop = true) {
|
|
|
3294
3147
|
}
|
|
3295
3148
|
var init_task_options = __esm({
|
|
3296
3149
|
"src/lib/utils/task-options.ts"() {
|
|
3150
|
+
"use strict";
|
|
3297
3151
|
init_argument_filters();
|
|
3298
3152
|
init_util();
|
|
3299
3153
|
init_pathspec();
|
|
3300
3154
|
}
|
|
3301
3155
|
});
|
|
3302
|
-
function callTaskParser(
|
|
3303
|
-
return
|
|
3156
|
+
function callTaskParser(parser4, streams) {
|
|
3157
|
+
return parser4(streams.stdOut, streams.stdErr);
|
|
3304
3158
|
}
|
|
3305
3159
|
function parseStringResponse(result, parsers12, texts, trim = true) {
|
|
3306
3160
|
asArray(texts).forEach((text) => {
|
|
@@ -3318,6 +3172,7 @@ function parseStringResponse(result, parsers12, texts, trim = true) {
|
|
|
3318
3172
|
}
|
|
3319
3173
|
var init_task_parser = __esm({
|
|
3320
3174
|
"src/lib/utils/task-parser.ts"() {
|
|
3175
|
+
"use strict";
|
|
3321
3176
|
init_util();
|
|
3322
3177
|
}
|
|
3323
3178
|
});
|
|
@@ -3332,6 +3187,7 @@ __export(utils_exports, {
|
|
|
3332
3187
|
append: () => append,
|
|
3333
3188
|
appendTaskOptions: () => appendTaskOptions,
|
|
3334
3189
|
asArray: () => asArray,
|
|
3190
|
+
asCamelCase: () => asCamelCase,
|
|
3335
3191
|
asFunction: () => asFunction,
|
|
3336
3192
|
asNumber: () => asNumber,
|
|
3337
3193
|
asStringArray: () => asStringArray,
|
|
@@ -3368,6 +3224,7 @@ __export(utils_exports, {
|
|
|
3368
3224
|
});
|
|
3369
3225
|
var init_utils = __esm({
|
|
3370
3226
|
"src/lib/utils/index.ts"() {
|
|
3227
|
+
"use strict";
|
|
3371
3228
|
init_argument_filters();
|
|
3372
3229
|
init_exit_codes();
|
|
3373
3230
|
init_git_output_streams();
|
|
@@ -3428,6 +3285,7 @@ var onError;
|
|
|
3428
3285
|
var parser;
|
|
3429
3286
|
var init_check_is_repo = __esm({
|
|
3430
3287
|
"src/lib/tasks/check-is-repo.ts"() {
|
|
3288
|
+
"use strict";
|
|
3431
3289
|
init_utils();
|
|
3432
3290
|
CheckRepoActions = /* @__PURE__ */ ((CheckRepoActions2) => {
|
|
3433
3291
|
CheckRepoActions2["BARE"] = "bare";
|
|
@@ -3462,6 +3320,7 @@ var dryRunRemovalRegexp;
|
|
|
3462
3320
|
var isFolderRegexp;
|
|
3463
3321
|
var init_CleanSummary = __esm({
|
|
3464
3322
|
"src/lib/responses/CleanSummary.ts"() {
|
|
3323
|
+
"use strict";
|
|
3465
3324
|
init_utils();
|
|
3466
3325
|
CleanResponse = class {
|
|
3467
3326
|
constructor(dryRun) {
|
|
@@ -3486,11 +3345,11 @@ __export(task_exports, {
|
|
|
3486
3345
|
straightThroughBufferTask: () => straightThroughBufferTask,
|
|
3487
3346
|
straightThroughStringTask: () => straightThroughStringTask
|
|
3488
3347
|
});
|
|
3489
|
-
function adhocExecTask(
|
|
3348
|
+
function adhocExecTask(parser4) {
|
|
3490
3349
|
return {
|
|
3491
3350
|
commands: EMPTY_COMMANDS,
|
|
3492
3351
|
format: "empty",
|
|
3493
|
-
parser:
|
|
3352
|
+
parser: parser4
|
|
3494
3353
|
};
|
|
3495
3354
|
}
|
|
3496
3355
|
function configurationErrorTask(error) {
|
|
@@ -3529,6 +3388,7 @@ function isEmptyTask(task) {
|
|
|
3529
3388
|
var EMPTY_COMMANDS;
|
|
3530
3389
|
var init_task = __esm({
|
|
3531
3390
|
"src/lib/tasks/task.ts"() {
|
|
3391
|
+
"use strict";
|
|
3532
3392
|
init_task_configuration_error();
|
|
3533
3393
|
EMPTY_COMMANDS = [];
|
|
3534
3394
|
}
|
|
@@ -3607,6 +3467,7 @@ var CleanOptions;
|
|
|
3607
3467
|
var CleanOptionValues;
|
|
3608
3468
|
var init_clean = __esm({
|
|
3609
3469
|
"src/lib/tasks/clean.ts"() {
|
|
3470
|
+
"use strict";
|
|
3610
3471
|
init_CleanSummary();
|
|
3611
3472
|
init_utils();
|
|
3612
3473
|
init_task();
|
|
@@ -3678,6 +3539,7 @@ function* configParser(text, requestedKey = null) {
|
|
|
3678
3539
|
var ConfigList;
|
|
3679
3540
|
var init_ConfigList = __esm({
|
|
3680
3541
|
"src/lib/responses/ConfigList.ts"() {
|
|
3542
|
+
"use strict";
|
|
3681
3543
|
init_utils();
|
|
3682
3544
|
ConfigList = class {
|
|
3683
3545
|
constructor() {
|
|
@@ -3763,23 +3625,38 @@ function listConfigTask(scope) {
|
|
|
3763
3625
|
function config_default() {
|
|
3764
3626
|
return {
|
|
3765
3627
|
addConfig(key, value, ...rest) {
|
|
3766
|
-
return this._runTask(
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3628
|
+
return this._runTask(
|
|
3629
|
+
addConfigTask(
|
|
3630
|
+
key,
|
|
3631
|
+
value,
|
|
3632
|
+
rest[0] === true,
|
|
3633
|
+
asConfigScope(
|
|
3634
|
+
rest[1],
|
|
3635
|
+
"local"
|
|
3636
|
+
/* local */
|
|
3637
|
+
)
|
|
3638
|
+
),
|
|
3639
|
+
trailingFunctionArgument(arguments)
|
|
3640
|
+
);
|
|
3771
3641
|
},
|
|
3772
3642
|
getConfig(key, scope) {
|
|
3773
|
-
return this._runTask(
|
|
3643
|
+
return this._runTask(
|
|
3644
|
+
getConfigTask(key, asConfigScope(scope, void 0)),
|
|
3645
|
+
trailingFunctionArgument(arguments)
|
|
3646
|
+
);
|
|
3774
3647
|
},
|
|
3775
3648
|
listConfig(...rest) {
|
|
3776
|
-
return this._runTask(
|
|
3649
|
+
return this._runTask(
|
|
3650
|
+
listConfigTask(asConfigScope(rest[0], void 0)),
|
|
3651
|
+
trailingFunctionArgument(arguments)
|
|
3652
|
+
);
|
|
3777
3653
|
}
|
|
3778
3654
|
};
|
|
3779
3655
|
}
|
|
3780
3656
|
var GitConfigScope;
|
|
3781
3657
|
var init_config = __esm({
|
|
3782
3658
|
"src/lib/tasks/config.ts"() {
|
|
3659
|
+
"use strict";
|
|
3783
3660
|
init_ConfigList();
|
|
3784
3661
|
init_utils();
|
|
3785
3662
|
GitConfigScope = /* @__PURE__ */ ((GitConfigScope2) => {
|
|
@@ -3798,6 +3675,7 @@ var DiffNameStatus;
|
|
|
3798
3675
|
var diffNameStatus;
|
|
3799
3676
|
var init_diff_name_status = __esm({
|
|
3800
3677
|
"src/lib/tasks/diff-name-status.ts"() {
|
|
3678
|
+
"use strict";
|
|
3801
3679
|
DiffNameStatus = /* @__PURE__ */ ((DiffNameStatus2) => {
|
|
3802
3680
|
DiffNameStatus2["ADDED"] = "A";
|
|
3803
3681
|
DiffNameStatus2["COPIED"] = "C";
|
|
@@ -3840,20 +3718,26 @@ function grep_default() {
|
|
|
3840
3718
|
const options = getTrailingOptions(arguments);
|
|
3841
3719
|
for (const option of disallowedOptions) {
|
|
3842
3720
|
if (options.includes(option)) {
|
|
3843
|
-
return this._runTask(
|
|
3721
|
+
return this._runTask(
|
|
3722
|
+
configurationErrorTask(`git.grep: use of "${option}" is not supported.`),
|
|
3723
|
+
then
|
|
3724
|
+
);
|
|
3844
3725
|
}
|
|
3845
3726
|
}
|
|
3846
3727
|
if (typeof searchTerm === "string") {
|
|
3847
3728
|
searchTerm = grepQueryBuilder().param(searchTerm);
|
|
3848
3729
|
}
|
|
3849
3730
|
const commands = ["grep", "--null", "-n", "--full-name", ...options, ...searchTerm];
|
|
3850
|
-
return this._runTask(
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3731
|
+
return this._runTask(
|
|
3732
|
+
{
|
|
3733
|
+
commands,
|
|
3734
|
+
format: "utf-8",
|
|
3735
|
+
parser(stdOut) {
|
|
3736
|
+
return parseGrep(stdOut);
|
|
3737
|
+
}
|
|
3738
|
+
},
|
|
3739
|
+
then
|
|
3740
|
+
);
|
|
3857
3741
|
}
|
|
3858
3742
|
};
|
|
3859
3743
|
}
|
|
@@ -3863,6 +3747,7 @@ var _a;
|
|
|
3863
3747
|
var GrepQuery;
|
|
3864
3748
|
var init_grep = __esm({
|
|
3865
3749
|
"src/lib/tasks/grep.ts"() {
|
|
3750
|
+
"use strict";
|
|
3866
3751
|
init_utils();
|
|
3867
3752
|
init_task();
|
|
3868
3753
|
disallowedOptions = ["-h"];
|
|
@@ -3919,6 +3804,7 @@ var ResetMode;
|
|
|
3919
3804
|
var ResetModes;
|
|
3920
3805
|
var init_reset = __esm({
|
|
3921
3806
|
"src/lib/tasks/reset.ts"() {
|
|
3807
|
+
"use strict";
|
|
3922
3808
|
init_task();
|
|
3923
3809
|
ResetMode = /* @__PURE__ */ ((ResetMode2) => {
|
|
3924
3810
|
ResetMode2["MIXED"] = "mixed";
|
|
@@ -3965,7 +3851,10 @@ function createLogger(label, verbose, initialStep, infoDebugger = createLog()) {
|
|
|
3965
3851
|
const key = childLoggerName(filterType(verbose, filterString), debugDebugger, infoDebugger);
|
|
3966
3852
|
return step(initialStep);
|
|
3967
3853
|
function sibling(name, initial) {
|
|
3968
|
-
return append(
|
|
3854
|
+
return append(
|
|
3855
|
+
spawned,
|
|
3856
|
+
createLogger(label, key.replace(/^[^:]+/, name), initial, infoDebugger)
|
|
3857
|
+
);
|
|
3969
3858
|
}
|
|
3970
3859
|
function step(phase) {
|
|
3971
3860
|
const stepPrefix = phase && `[${phase}]` || "";
|
|
@@ -3981,6 +3870,7 @@ function createLogger(label, verbose, initialStep, infoDebugger = createLog()) {
|
|
|
3981
3870
|
}
|
|
3982
3871
|
var init_git_logger = __esm({
|
|
3983
3872
|
"src/lib/git-logger.ts"() {
|
|
3873
|
+
"use strict";
|
|
3984
3874
|
init_utils();
|
|
3985
3875
|
debug.formatters.L = (value) => String(filterHasLength(value) ? value.length : "-");
|
|
3986
3876
|
debug.formatters.B = (value) => {
|
|
@@ -3991,13 +3881,13 @@ var init_git_logger = __esm({
|
|
|
3991
3881
|
};
|
|
3992
3882
|
}
|
|
3993
3883
|
});
|
|
3994
|
-
var _TasksPendingQueue;
|
|
3995
3884
|
var TasksPendingQueue;
|
|
3996
3885
|
var init_tasks_pending_queue = __esm({
|
|
3997
3886
|
"src/lib/runners/tasks-pending-queue.ts"() {
|
|
3887
|
+
"use strict";
|
|
3998
3888
|
init_git_error();
|
|
3999
3889
|
init_git_logger();
|
|
4000
|
-
|
|
3890
|
+
TasksPendingQueue = class _TasksPendingQueue {
|
|
4001
3891
|
constructor(logLabel = "GitExecutor") {
|
|
4002
3892
|
this.logLabel = logLabel;
|
|
4003
3893
|
this._queue = /* @__PURE__ */ new Map();
|
|
@@ -4024,9 +3914,14 @@ var init_tasks_pending_queue = __esm({
|
|
|
4024
3914
|
for (const [task, { logger }] of Array.from(this._queue.entries())) {
|
|
4025
3915
|
if (task === err.task) {
|
|
4026
3916
|
logger.info(`Failed %o`, err);
|
|
4027
|
-
logger(
|
|
3917
|
+
logger(
|
|
3918
|
+
`Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`
|
|
3919
|
+
);
|
|
4028
3920
|
} else {
|
|
4029
|
-
logger.info(
|
|
3921
|
+
logger.info(
|
|
3922
|
+
`A fatal exception occurred in a previous task, the queue has been purged: %o`,
|
|
3923
|
+
err.message
|
|
3924
|
+
);
|
|
4030
3925
|
}
|
|
4031
3926
|
this.complete(task);
|
|
4032
3927
|
}
|
|
@@ -4051,9 +3946,10 @@ var init_tasks_pending_queue = __esm({
|
|
|
4051
3946
|
static getName(name = "empty") {
|
|
4052
3947
|
return `task:${name}:${++_TasksPendingQueue.counter}`;
|
|
4053
3948
|
}
|
|
3949
|
+
static {
|
|
3950
|
+
this.counter = 0;
|
|
3951
|
+
}
|
|
4054
3952
|
};
|
|
4055
|
-
TasksPendingQueue = _TasksPendingQueue;
|
|
4056
|
-
TasksPendingQueue.counter = 0;
|
|
4057
3953
|
}
|
|
4058
3954
|
});
|
|
4059
3955
|
function pluginContext(task, commands) {
|
|
@@ -4078,6 +3974,7 @@ function onDataReceived(target, name, logger, output) {
|
|
|
4078
3974
|
var GitExecutorChain;
|
|
4079
3975
|
var init_git_executor_chain = __esm({
|
|
4080
3976
|
"src/lib/runners/git-executor-chain.ts"() {
|
|
3977
|
+
"use strict";
|
|
4081
3978
|
init_git_error();
|
|
4082
3979
|
init_task();
|
|
4083
3980
|
init_utils();
|
|
@@ -4090,9 +3987,6 @@ var init_git_executor_chain = __esm({
|
|
|
4090
3987
|
this._chain = Promise.resolve();
|
|
4091
3988
|
this._queue = new TasksPendingQueue();
|
|
4092
3989
|
}
|
|
4093
|
-
get binary() {
|
|
4094
|
-
return this._executor.binary;
|
|
4095
|
-
}
|
|
4096
3990
|
get cwd() {
|
|
4097
3991
|
return this._cwd || this._executor.cwd;
|
|
4098
3992
|
}
|
|
@@ -4112,20 +4006,18 @@ var init_git_executor_chain = __esm({
|
|
|
4112
4006
|
this._queue.push(task);
|
|
4113
4007
|
return this._chain = this._chain.then(() => this.attemptTask(task));
|
|
4114
4008
|
}
|
|
4115
|
-
attemptTask(task) {
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
}
|
|
4128
|
-
});
|
|
4009
|
+
async attemptTask(task) {
|
|
4010
|
+
const onScheduleComplete = await this._scheduler.next();
|
|
4011
|
+
const onQueueComplete = () => this._queue.complete(task);
|
|
4012
|
+
try {
|
|
4013
|
+
const { logger } = this._queue.attempt(task);
|
|
4014
|
+
return await (isEmptyTask(task) ? this.attemptEmptyTask(task, logger) : this.attemptRemoteTask(task, logger));
|
|
4015
|
+
} catch (e) {
|
|
4016
|
+
throw this.onFatalException(task, e);
|
|
4017
|
+
} finally {
|
|
4018
|
+
onQueueComplete();
|
|
4019
|
+
onScheduleComplete();
|
|
4020
|
+
}
|
|
4129
4021
|
}
|
|
4130
4022
|
onFatalException(task, e) {
|
|
4131
4023
|
const gitError = e instanceof GitError ? Object.assign(e, { task }) : new GitError(task, e && String(e));
|
|
@@ -4133,108 +4025,148 @@ var init_git_executor_chain = __esm({
|
|
|
4133
4025
|
this._queue.fatal(gitError);
|
|
4134
4026
|
return gitError;
|
|
4135
4027
|
}
|
|
4136
|
-
attemptRemoteTask(task, logger) {
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4028
|
+
async attemptRemoteTask(task, logger) {
|
|
4029
|
+
const binary = this._plugins.exec("spawn.binary", "", pluginContext(task, task.commands));
|
|
4030
|
+
const args = this._plugins.exec(
|
|
4031
|
+
"spawn.args",
|
|
4032
|
+
[...task.commands],
|
|
4033
|
+
pluginContext(task, task.commands)
|
|
4034
|
+
);
|
|
4035
|
+
const raw = await this.gitResponse(
|
|
4036
|
+
task,
|
|
4037
|
+
binary,
|
|
4038
|
+
args,
|
|
4039
|
+
this.outputHandler,
|
|
4040
|
+
logger.step("SPAWN")
|
|
4041
|
+
);
|
|
4042
|
+
const outputStreams = await this.handleTaskData(task, args, raw, logger.step("HANDLE"));
|
|
4043
|
+
logger(`passing response to task's parser as a %s`, task.format);
|
|
4044
|
+
if (isBufferTask(task)) {
|
|
4045
|
+
return callTaskParser(task.parser, outputStreams);
|
|
4046
|
+
}
|
|
4047
|
+
return callTaskParser(task.parser, outputStreams.asStrings());
|
|
4147
4048
|
}
|
|
4148
|
-
attemptEmptyTask(task, logger) {
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
return task.parser(this);
|
|
4152
|
-
});
|
|
4049
|
+
async attemptEmptyTask(task, logger) {
|
|
4050
|
+
logger(`empty task bypassing child process to call to task's parser`);
|
|
4051
|
+
return task.parser(this);
|
|
4153
4052
|
}
|
|
4154
4053
|
handleTaskData(task, args, result, logger) {
|
|
4155
4054
|
const { exitCode, rejection, stdOut, stdErr } = result;
|
|
4156
4055
|
return new Promise((done, fail) => {
|
|
4157
4056
|
logger(`Preparing to handle process response exitCode=%d stdOut=`, exitCode);
|
|
4158
|
-
const { error } = this._plugins.exec(
|
|
4057
|
+
const { error } = this._plugins.exec(
|
|
4058
|
+
"task.error",
|
|
4059
|
+
{ error: rejection },
|
|
4060
|
+
{
|
|
4061
|
+
...pluginContext(task, args),
|
|
4062
|
+
...result
|
|
4063
|
+
}
|
|
4064
|
+
);
|
|
4159
4065
|
if (error && task.onError) {
|
|
4160
4066
|
logger.info(`exitCode=%s handling with custom error handler`);
|
|
4161
|
-
return task.onError(
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4067
|
+
return task.onError(
|
|
4068
|
+
result,
|
|
4069
|
+
error,
|
|
4070
|
+
(newStdOut) => {
|
|
4071
|
+
logger.info(`custom error handler treated as success`);
|
|
4072
|
+
logger(`custom error returned a %s`, objectToString(newStdOut));
|
|
4073
|
+
done(
|
|
4074
|
+
new GitOutputStreams(
|
|
4075
|
+
Array.isArray(newStdOut) ? Buffer.concat(newStdOut) : newStdOut,
|
|
4076
|
+
Buffer.concat(stdErr)
|
|
4077
|
+
)
|
|
4078
|
+
);
|
|
4079
|
+
},
|
|
4080
|
+
fail
|
|
4081
|
+
);
|
|
4166
4082
|
}
|
|
4167
4083
|
if (error) {
|
|
4168
|
-
logger.info(
|
|
4084
|
+
logger.info(
|
|
4085
|
+
`handling as error: exitCode=%s stdErr=%s rejection=%o`,
|
|
4086
|
+
exitCode,
|
|
4087
|
+
stdErr.length,
|
|
4088
|
+
rejection
|
|
4089
|
+
);
|
|
4169
4090
|
return fail(error);
|
|
4170
4091
|
}
|
|
4171
4092
|
logger.info(`retrieving task output complete`);
|
|
4172
4093
|
done(new GitOutputStreams(Buffer.concat(stdOut), Buffer.concat(stdErr)));
|
|
4173
4094
|
});
|
|
4174
4095
|
}
|
|
4175
|
-
gitResponse(task, command, args, outputHandler, logger) {
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4096
|
+
async gitResponse(task, command, args, outputHandler, logger) {
|
|
4097
|
+
const outputLogger = logger.sibling("output");
|
|
4098
|
+
const spawnOptions = this._plugins.exec(
|
|
4099
|
+
"spawn.options",
|
|
4100
|
+
{
|
|
4179
4101
|
cwd: this.cwd,
|
|
4180
4102
|
env: this.env,
|
|
4181
4103
|
windowsHide: true
|
|
4182
|
-
},
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4104
|
+
},
|
|
4105
|
+
pluginContext(task, task.commands)
|
|
4106
|
+
);
|
|
4107
|
+
return new Promise((done) => {
|
|
4108
|
+
const stdOut = [];
|
|
4109
|
+
const stdErr = [];
|
|
4110
|
+
logger.info(`%s %o`, command, args);
|
|
4111
|
+
logger("%O", spawnOptions);
|
|
4112
|
+
let rejection = this._beforeSpawn(task, args);
|
|
4113
|
+
if (rejection) {
|
|
4114
|
+
return done({
|
|
4115
|
+
stdOut,
|
|
4116
|
+
stdErr,
|
|
4117
|
+
exitCode: 9901,
|
|
4118
|
+
rejection
|
|
4119
|
+
});
|
|
4120
|
+
}
|
|
4121
|
+
this._plugins.exec("spawn.before", void 0, {
|
|
4122
|
+
...pluginContext(task, args),
|
|
4123
|
+
kill(reason) {
|
|
4124
|
+
rejection = reason || rejection;
|
|
4125
|
+
}
|
|
4126
|
+
});
|
|
4127
|
+
const spawned = spawn(command, args, spawnOptions);
|
|
4128
|
+
spawned.stdout.on(
|
|
4129
|
+
"data",
|
|
4130
|
+
onDataReceived(stdOut, "stdOut", logger, outputLogger.step("stdOut"))
|
|
4131
|
+
);
|
|
4132
|
+
spawned.stderr.on(
|
|
4133
|
+
"data",
|
|
4134
|
+
onDataReceived(stdErr, "stdErr", logger, outputLogger.step("stdErr"))
|
|
4135
|
+
);
|
|
4136
|
+
spawned.on("error", onErrorReceived(stdErr, logger));
|
|
4137
|
+
if (outputHandler) {
|
|
4138
|
+
logger(`Passing child process stdOut/stdErr to custom outputHandler`);
|
|
4139
|
+
outputHandler(command, spawned.stdout, spawned.stderr, [...args]);
|
|
4140
|
+
}
|
|
4141
|
+
this._plugins.exec("spawn.after", void 0, {
|
|
4142
|
+
...pluginContext(task, args),
|
|
4143
|
+
spawned,
|
|
4144
|
+
close(exitCode, reason) {
|
|
4145
|
+
done({
|
|
4191
4146
|
stdOut,
|
|
4192
4147
|
stdErr,
|
|
4193
|
-
exitCode
|
|
4194
|
-
rejection
|
|
4148
|
+
exitCode,
|
|
4149
|
+
rejection: rejection || reason
|
|
4195
4150
|
});
|
|
4196
|
-
}
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4151
|
+
},
|
|
4152
|
+
kill(reason) {
|
|
4153
|
+
if (spawned.killed) {
|
|
4154
|
+
return;
|
|
4200
4155
|
}
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
spawned.stdout.on("data", onDataReceived(stdOut, "stdOut", logger, outputLogger.step("stdOut")));
|
|
4204
|
-
spawned.stderr.on("data", onDataReceived(stdErr, "stdErr", logger, outputLogger.step("stdErr")));
|
|
4205
|
-
spawned.on("error", onErrorReceived(stdErr, logger));
|
|
4206
|
-
if (outputHandler) {
|
|
4207
|
-
logger(`Passing child process stdOut/stdErr to custom outputHandler`);
|
|
4208
|
-
outputHandler(command, spawned.stdout, spawned.stderr, [...args]);
|
|
4156
|
+
rejection = reason;
|
|
4157
|
+
spawned.kill("SIGINT");
|
|
4209
4158
|
}
|
|
4210
|
-
this._plugins.exec("spawn.after", void 0, __spreadProps(__spreadValues({}, pluginContext(task, args)), {
|
|
4211
|
-
spawned,
|
|
4212
|
-
close(exitCode, reason) {
|
|
4213
|
-
done({
|
|
4214
|
-
stdOut,
|
|
4215
|
-
stdErr,
|
|
4216
|
-
exitCode,
|
|
4217
|
-
rejection: rejection || reason
|
|
4218
|
-
});
|
|
4219
|
-
},
|
|
4220
|
-
kill(reason) {
|
|
4221
|
-
if (spawned.killed) {
|
|
4222
|
-
return;
|
|
4223
|
-
}
|
|
4224
|
-
rejection = reason;
|
|
4225
|
-
spawned.kill("SIGINT");
|
|
4226
|
-
}
|
|
4227
|
-
}));
|
|
4228
4159
|
});
|
|
4229
4160
|
});
|
|
4230
4161
|
}
|
|
4231
4162
|
_beforeSpawn(task, args) {
|
|
4232
4163
|
let rejection;
|
|
4233
|
-
this._plugins.exec("spawn.before", void 0,
|
|
4164
|
+
this._plugins.exec("spawn.before", void 0, {
|
|
4165
|
+
...pluginContext(task, args),
|
|
4234
4166
|
kill(reason) {
|
|
4235
4167
|
rejection = reason || rejection;
|
|
4236
4168
|
}
|
|
4237
|
-
})
|
|
4169
|
+
});
|
|
4238
4170
|
return rejection;
|
|
4239
4171
|
}
|
|
4240
4172
|
};
|
|
@@ -4247,10 +4179,10 @@ __export(git_executor_exports, {
|
|
|
4247
4179
|
var GitExecutor;
|
|
4248
4180
|
var init_git_executor = __esm({
|
|
4249
4181
|
"src/lib/runners/git-executor.ts"() {
|
|
4182
|
+
"use strict";
|
|
4250
4183
|
init_git_executor_chain();
|
|
4251
4184
|
GitExecutor = class {
|
|
4252
|
-
constructor(
|
|
4253
|
-
this.binary = binary;
|
|
4185
|
+
constructor(cwd, _scheduler, _plugins) {
|
|
4254
4186
|
this.cwd = cwd;
|
|
4255
4187
|
this._scheduler = _scheduler;
|
|
4256
4188
|
this._plugins = _plugins;
|
|
@@ -4270,15 +4202,20 @@ function taskCallback(task, response, callback = NOOP) {
|
|
|
4270
4202
|
callback(null, data);
|
|
4271
4203
|
};
|
|
4272
4204
|
const onError2 = (err) => {
|
|
4273
|
-
if (
|
|
4274
|
-
callback(
|
|
4205
|
+
if (err?.task === task) {
|
|
4206
|
+
callback(
|
|
4207
|
+
err instanceof GitResponseError ? addDeprecationNoticeToError(err) : err,
|
|
4208
|
+
void 0
|
|
4209
|
+
);
|
|
4275
4210
|
}
|
|
4276
4211
|
};
|
|
4277
4212
|
response.then(onSuccess, onError2);
|
|
4278
4213
|
}
|
|
4279
4214
|
function addDeprecationNoticeToError(err) {
|
|
4280
4215
|
let log2 = (name) => {
|
|
4281
|
-
console.warn(
|
|
4216
|
+
console.warn(
|
|
4217
|
+
`simple-git deprecation notice: accessing GitResponseError.${name} should be GitResponseError.git.${name}, this will no longer be available in version 3`
|
|
4218
|
+
);
|
|
4282
4219
|
log2 = NOOP;
|
|
4283
4220
|
};
|
|
4284
4221
|
return Object.create(err, Object.getOwnPropertyNames(err.git).reduce(descriptorReducer, {}));
|
|
@@ -4299,6 +4236,7 @@ function addDeprecationNoticeToError(err) {
|
|
|
4299
4236
|
}
|
|
4300
4237
|
var init_task_callback = __esm({
|
|
4301
4238
|
"src/lib/task-callback.ts"() {
|
|
4239
|
+
"use strict";
|
|
4302
4240
|
init_git_response_error();
|
|
4303
4241
|
init_utils();
|
|
4304
4242
|
}
|
|
@@ -4313,6 +4251,7 @@ function changeWorkingDirectoryTask(directory, root) {
|
|
|
4313
4251
|
}
|
|
4314
4252
|
var init_change_working_directory = __esm({
|
|
4315
4253
|
"src/lib/tasks/change-working-directory.ts"() {
|
|
4254
|
+
"use strict";
|
|
4316
4255
|
init_utils();
|
|
4317
4256
|
init_task();
|
|
4318
4257
|
}
|
|
@@ -4327,22 +4266,73 @@ function checkoutTask(args) {
|
|
|
4327
4266
|
function checkout_default() {
|
|
4328
4267
|
return {
|
|
4329
4268
|
checkout() {
|
|
4330
|
-
return this._runTask(
|
|
4269
|
+
return this._runTask(
|
|
4270
|
+
checkoutTask(getTrailingOptions(arguments, 1)),
|
|
4271
|
+
trailingFunctionArgument(arguments)
|
|
4272
|
+
);
|
|
4331
4273
|
},
|
|
4332
4274
|
checkoutBranch(branchName, startPoint) {
|
|
4333
|
-
return this._runTask(
|
|
4275
|
+
return this._runTask(
|
|
4276
|
+
checkoutTask(["-b", branchName, startPoint, ...getTrailingOptions(arguments)]),
|
|
4277
|
+
trailingFunctionArgument(arguments)
|
|
4278
|
+
);
|
|
4334
4279
|
},
|
|
4335
4280
|
checkoutLocalBranch(branchName) {
|
|
4336
|
-
return this._runTask(
|
|
4281
|
+
return this._runTask(
|
|
4282
|
+
checkoutTask(["-b", branchName, ...getTrailingOptions(arguments)]),
|
|
4283
|
+
trailingFunctionArgument(arguments)
|
|
4284
|
+
);
|
|
4337
4285
|
}
|
|
4338
4286
|
};
|
|
4339
4287
|
}
|
|
4340
4288
|
var init_checkout = __esm({
|
|
4341
4289
|
"src/lib/tasks/checkout.ts"() {
|
|
4290
|
+
"use strict";
|
|
4342
4291
|
init_utils();
|
|
4343
4292
|
init_task();
|
|
4344
4293
|
}
|
|
4345
4294
|
});
|
|
4295
|
+
function countObjectsResponse() {
|
|
4296
|
+
return {
|
|
4297
|
+
count: 0,
|
|
4298
|
+
garbage: 0,
|
|
4299
|
+
inPack: 0,
|
|
4300
|
+
packs: 0,
|
|
4301
|
+
prunePackable: 0,
|
|
4302
|
+
size: 0,
|
|
4303
|
+
sizeGarbage: 0,
|
|
4304
|
+
sizePack: 0
|
|
4305
|
+
};
|
|
4306
|
+
}
|
|
4307
|
+
function count_objects_default() {
|
|
4308
|
+
return {
|
|
4309
|
+
countObjects() {
|
|
4310
|
+
return this._runTask({
|
|
4311
|
+
commands: ["count-objects", "--verbose"],
|
|
4312
|
+
format: "utf-8",
|
|
4313
|
+
parser(stdOut) {
|
|
4314
|
+
return parseStringResponse(countObjectsResponse(), [parser2], stdOut);
|
|
4315
|
+
}
|
|
4316
|
+
});
|
|
4317
|
+
}
|
|
4318
|
+
};
|
|
4319
|
+
}
|
|
4320
|
+
var parser2;
|
|
4321
|
+
var init_count_objects = __esm({
|
|
4322
|
+
"src/lib/tasks/count-objects.ts"() {
|
|
4323
|
+
"use strict";
|
|
4324
|
+
init_utils();
|
|
4325
|
+
parser2 = new LineParser(
|
|
4326
|
+
/([a-z-]+): (\d+)$/,
|
|
4327
|
+
(result, [key, value]) => {
|
|
4328
|
+
const property = asCamelCase(key);
|
|
4329
|
+
if (result.hasOwnProperty(property)) {
|
|
4330
|
+
result[property] = asNumber(value);
|
|
4331
|
+
}
|
|
4332
|
+
}
|
|
4333
|
+
);
|
|
4334
|
+
}
|
|
4335
|
+
});
|
|
4346
4336
|
function parseCommitResult(stdOut) {
|
|
4347
4337
|
const result = {
|
|
4348
4338
|
author: null,
|
|
@@ -4360,6 +4350,7 @@ function parseCommitResult(stdOut) {
|
|
|
4360
4350
|
var parsers;
|
|
4361
4351
|
var init_parse_commit = __esm({
|
|
4362
4352
|
"src/lib/parsers/parse-commit.ts"() {
|
|
4353
|
+
"use strict";
|
|
4363
4354
|
init_utils();
|
|
4364
4355
|
parsers = [
|
|
4365
4356
|
new LineParser(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/, (result, [branch, root, commit]) => {
|
|
@@ -4378,20 +4369,26 @@ var init_parse_commit = __esm({
|
|
|
4378
4369
|
name: parts.join("<").trim()
|
|
4379
4370
|
};
|
|
4380
4371
|
}),
|
|
4381
|
-
new LineParser(
|
|
4382
|
-
|
|
4383
|
-
result
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
result.summary.changes = parseInt(changes, 10) || 0;
|
|
4388
|
-
const count = parseInt(lines, 10) || 0;
|
|
4389
|
-
if (direction === "-") {
|
|
4390
|
-
result.summary.deletions = count;
|
|
4391
|
-
} else if (direction === "+") {
|
|
4392
|
-
result.summary.insertions = count;
|
|
4372
|
+
new LineParser(
|
|
4373
|
+
/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,
|
|
4374
|
+
(result, [changes, insertions, deletions]) => {
|
|
4375
|
+
result.summary.changes = parseInt(changes, 10) || 0;
|
|
4376
|
+
result.summary.insertions = parseInt(insertions, 10) || 0;
|
|
4377
|
+
result.summary.deletions = parseInt(deletions, 10) || 0;
|
|
4393
4378
|
}
|
|
4394
|
-
|
|
4379
|
+
),
|
|
4380
|
+
new LineParser(
|
|
4381
|
+
/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,
|
|
4382
|
+
(result, [changes, lines, direction]) => {
|
|
4383
|
+
result.summary.changes = parseInt(changes, 10) || 0;
|
|
4384
|
+
const count = parseInt(lines, 10) || 0;
|
|
4385
|
+
if (direction === "-") {
|
|
4386
|
+
result.summary.deletions = count;
|
|
4387
|
+
} else if (direction === "+") {
|
|
4388
|
+
result.summary.insertions = count;
|
|
4389
|
+
}
|
|
4390
|
+
}
|
|
4391
|
+
)
|
|
4395
4392
|
];
|
|
4396
4393
|
}
|
|
4397
4394
|
});
|
|
@@ -4414,16 +4411,23 @@ function commit_default() {
|
|
|
4414
4411
|
return {
|
|
4415
4412
|
commit(message, ...rest) {
|
|
4416
4413
|
const next = trailingFunctionArgument(arguments);
|
|
4417
|
-
const task = rejectDeprecatedSignatures(message) || commitTask(
|
|
4414
|
+
const task = rejectDeprecatedSignatures(message) || commitTask(
|
|
4415
|
+
asArray(message),
|
|
4416
|
+
asArray(filterType(rest[0], filterStringOrStringArray, [])),
|
|
4417
|
+
[...filterType(rest[1], filterArray, []), ...getTrailingOptions(arguments, 0, true)]
|
|
4418
|
+
);
|
|
4418
4419
|
return this._runTask(task, next);
|
|
4419
4420
|
}
|
|
4420
4421
|
};
|
|
4421
4422
|
function rejectDeprecatedSignatures(message) {
|
|
4422
|
-
return !filterStringOrStringArray(message) && configurationErrorTask(
|
|
4423
|
+
return !filterStringOrStringArray(message) && configurationErrorTask(
|
|
4424
|
+
`git.commit: requires the commit message to be supplied as a string/string[]`
|
|
4425
|
+
);
|
|
4423
4426
|
}
|
|
4424
4427
|
}
|
|
4425
4428
|
var init_commit = __esm({
|
|
4426
4429
|
"src/lib/tasks/commit.ts"() {
|
|
4430
|
+
"use strict";
|
|
4427
4431
|
init_parse_commit();
|
|
4428
4432
|
init_utils();
|
|
4429
4433
|
init_task();
|
|
@@ -4432,12 +4436,16 @@ var init_commit = __esm({
|
|
|
4432
4436
|
function first_commit_default() {
|
|
4433
4437
|
return {
|
|
4434
4438
|
firstCommit() {
|
|
4435
|
-
return this._runTask(
|
|
4439
|
+
return this._runTask(
|
|
4440
|
+
straightThroughStringTask(["rev-list", "--max-parents=0", "HEAD"], true),
|
|
4441
|
+
trailingFunctionArgument(arguments)
|
|
4442
|
+
);
|
|
4436
4443
|
}
|
|
4437
4444
|
};
|
|
4438
4445
|
}
|
|
4439
4446
|
var init_first_commit = __esm({
|
|
4440
4447
|
"src/lib/tasks/first-commit.ts"() {
|
|
4448
|
+
"use strict";
|
|
4441
4449
|
init_utils();
|
|
4442
4450
|
init_task();
|
|
4443
4451
|
}
|
|
@@ -4451,6 +4459,7 @@ function hashObjectTask(filePath, write) {
|
|
|
4451
4459
|
}
|
|
4452
4460
|
var init_hash_object = __esm({
|
|
4453
4461
|
"src/lib/tasks/hash-object.ts"() {
|
|
4462
|
+
"use strict";
|
|
4454
4463
|
init_task();
|
|
4455
4464
|
}
|
|
4456
4465
|
});
|
|
@@ -4479,6 +4488,7 @@ var initResponseRegex;
|
|
|
4479
4488
|
var reInitResponseRegex;
|
|
4480
4489
|
var init_InitSummary = __esm({
|
|
4481
4490
|
"src/lib/responses/InitSummary.ts"() {
|
|
4491
|
+
"use strict";
|
|
4482
4492
|
InitSummary = class {
|
|
4483
4493
|
constructor(bare, path4, existing, gitDir) {
|
|
4484
4494
|
this.bare = bare;
|
|
@@ -4510,6 +4520,7 @@ function initTask(bare = false, path4, customArgs) {
|
|
|
4510
4520
|
var bareCommand;
|
|
4511
4521
|
var init_init = __esm({
|
|
4512
4522
|
"src/lib/tasks/init.ts"() {
|
|
4523
|
+
"use strict";
|
|
4513
4524
|
init_InitSummary();
|
|
4514
4525
|
bareCommand = "--bare";
|
|
4515
4526
|
}
|
|
@@ -4529,12 +4540,14 @@ function isLogFormat(customArg) {
|
|
|
4529
4540
|
var logFormatRegex;
|
|
4530
4541
|
var init_log_format = __esm({
|
|
4531
4542
|
"src/lib/args/log-format.ts"() {
|
|
4543
|
+
"use strict";
|
|
4532
4544
|
logFormatRegex = /^--(stat|numstat|name-only|name-status)(=|$)/;
|
|
4533
4545
|
}
|
|
4534
4546
|
});
|
|
4535
4547
|
var DiffSummary;
|
|
4536
4548
|
var init_DiffSummary = __esm({
|
|
4537
4549
|
"src/lib/responses/DiffSummary.ts"() {
|
|
4550
|
+
"use strict";
|
|
4538
4551
|
DiffSummary = class {
|
|
4539
4552
|
constructor() {
|
|
4540
4553
|
this.changed = 0;
|
|
@@ -4546,8 +4559,8 @@ var init_DiffSummary = __esm({
|
|
|
4546
4559
|
}
|
|
4547
4560
|
});
|
|
4548
4561
|
function getDiffParser(format = "") {
|
|
4549
|
-
const
|
|
4550
|
-
return (stdOut) => parseStringResponse(new DiffSummary(),
|
|
4562
|
+
const parser4 = diffSummaryParsers[format];
|
|
4563
|
+
return (stdOut) => parseStringResponse(new DiffSummary(), parser4, stdOut, false);
|
|
4551
4564
|
}
|
|
4552
4565
|
var statParser;
|
|
4553
4566
|
var numStatParser;
|
|
@@ -4556,51 +4569,64 @@ var nameStatusParser;
|
|
|
4556
4569
|
var diffSummaryParsers;
|
|
4557
4570
|
var init_parse_diff_summary = __esm({
|
|
4558
4571
|
"src/lib/parsers/parse-diff-summary.ts"() {
|
|
4572
|
+
"use strict";
|
|
4559
4573
|
init_log_format();
|
|
4560
4574
|
init_DiffSummary();
|
|
4561
4575
|
init_diff_name_status();
|
|
4562
4576
|
init_utils();
|
|
4563
4577
|
statParser = [
|
|
4564
|
-
new LineParser(
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4578
|
+
new LineParser(
|
|
4579
|
+
/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,
|
|
4580
|
+
(result, [file, changes, alterations = ""]) => {
|
|
4581
|
+
result.files.push({
|
|
4582
|
+
file: file.trim(),
|
|
4583
|
+
changes: asNumber(changes),
|
|
4584
|
+
insertions: alterations.replace(/[^+]/g, "").length,
|
|
4585
|
+
deletions: alterations.replace(/[^-]/g, "").length,
|
|
4586
|
+
binary: false
|
|
4587
|
+
});
|
|
4588
|
+
}
|
|
4589
|
+
),
|
|
4590
|
+
new LineParser(
|
|
4591
|
+
/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,
|
|
4592
|
+
(result, [file, before, after]) => {
|
|
4593
|
+
result.files.push({
|
|
4594
|
+
file: file.trim(),
|
|
4595
|
+
before: asNumber(before),
|
|
4596
|
+
after: asNumber(after),
|
|
4597
|
+
binary: true
|
|
4598
|
+
});
|
|
4599
|
+
}
|
|
4600
|
+
),
|
|
4601
|
+
new LineParser(
|
|
4602
|
+
/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,
|
|
4603
|
+
(result, [changed, summary]) => {
|
|
4604
|
+
const inserted = /(\d+) i/.exec(summary);
|
|
4605
|
+
const deleted = /(\d+) d/.exec(summary);
|
|
4606
|
+
result.changed = asNumber(changed);
|
|
4607
|
+
result.insertions = asNumber(inserted?.[1]);
|
|
4608
|
+
result.deletions = asNumber(deleted?.[1]);
|
|
4609
|
+
}
|
|
4610
|
+
)
|
|
4588
4611
|
];
|
|
4589
4612
|
numStatParser = [
|
|
4590
|
-
new LineParser(
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4613
|
+
new LineParser(
|
|
4614
|
+
/(\d+)\t(\d+)\t(.+)$/,
|
|
4615
|
+
(result, [changesInsert, changesDelete, file]) => {
|
|
4616
|
+
const insertions = asNumber(changesInsert);
|
|
4617
|
+
const deletions = asNumber(changesDelete);
|
|
4618
|
+
result.changed++;
|
|
4619
|
+
result.insertions += insertions;
|
|
4620
|
+
result.deletions += deletions;
|
|
4621
|
+
result.files.push({
|
|
4622
|
+
file,
|
|
4623
|
+
changes: insertions + deletions,
|
|
4624
|
+
insertions,
|
|
4625
|
+
deletions,
|
|
4626
|
+
binary: false
|
|
4627
|
+
});
|
|
4628
|
+
}
|
|
4629
|
+
),
|
|
4604
4630
|
new LineParser(/-\t-\t(.+)$/, (result, [file]) => {
|
|
4605
4631
|
result.changed++;
|
|
4606
4632
|
result.files.push({
|
|
@@ -4624,17 +4650,22 @@ var init_parse_diff_summary = __esm({
|
|
|
4624
4650
|
})
|
|
4625
4651
|
];
|
|
4626
4652
|
nameStatusParser = [
|
|
4627
|
-
new LineParser(
|
|
4628
|
-
|
|
4629
|
-
result
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4653
|
+
new LineParser(
|
|
4654
|
+
/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,
|
|
4655
|
+
(result, [status, similarity, from, _to, to]) => {
|
|
4656
|
+
result.changed++;
|
|
4657
|
+
result.files.push({
|
|
4658
|
+
file: to ?? from,
|
|
4659
|
+
changes: 0,
|
|
4660
|
+
insertions: 0,
|
|
4661
|
+
deletions: 0,
|
|
4662
|
+
binary: false,
|
|
4663
|
+
status: orVoid(isDiffNameStatus(status) && status),
|
|
4664
|
+
from: orVoid(!!to && from !== to && from),
|
|
4665
|
+
similarity: asNumber(similarity)
|
|
4666
|
+
});
|
|
4667
|
+
}
|
|
4668
|
+
)
|
|
4638
4669
|
];
|
|
4639
4670
|
diffSummaryParsers = {
|
|
4640
4671
|
[
|
|
@@ -4661,17 +4692,24 @@ var init_parse_diff_summary = __esm({
|
|
|
4661
4692
|
}
|
|
4662
4693
|
});
|
|
4663
4694
|
function lineBuilder(tokens, fields) {
|
|
4664
|
-
return fields.reduce(
|
|
4665
|
-
line
|
|
4666
|
-
|
|
4667
|
-
|
|
4695
|
+
return fields.reduce(
|
|
4696
|
+
(line, field, index) => {
|
|
4697
|
+
line[field] = tokens[index] || "";
|
|
4698
|
+
return line;
|
|
4699
|
+
},
|
|
4700
|
+
/* @__PURE__ */ Object.create({ diff: null })
|
|
4701
|
+
);
|
|
4668
4702
|
}
|
|
4669
4703
|
function createListLogSummaryParser(splitter = SPLITTER, fields = defaultFieldNames, logFormat = "") {
|
|
4670
4704
|
const parseDiffResult = getDiffParser(logFormat);
|
|
4671
4705
|
return function(stdOut) {
|
|
4672
|
-
const all = toLinesWithContent(
|
|
4673
|
-
|
|
4674
|
-
|
|
4706
|
+
const all = toLinesWithContent(
|
|
4707
|
+
stdOut.trim(),
|
|
4708
|
+
false,
|
|
4709
|
+
START_BOUNDARY
|
|
4710
|
+
).map(function(item) {
|
|
4711
|
+
const lineDetail = item.split(COMMIT_BOUNDARY);
|
|
4712
|
+
const listLogLine = lineBuilder(lineDetail[0].split(splitter), fields);
|
|
4675
4713
|
if (lineDetail.length > 1 && !!lineDetail[1].trim()) {
|
|
4676
4714
|
listLogLine.diff = parseDiffResult(lineDetail[1]);
|
|
4677
4715
|
}
|
|
@@ -4690,6 +4728,7 @@ var SPLITTER;
|
|
|
4690
4728
|
var defaultFieldNames;
|
|
4691
4729
|
var init_parse_list_log_summary = __esm({
|
|
4692
4730
|
"src/lib/parsers/parse-list-log-summary.ts"() {
|
|
4731
|
+
"use strict";
|
|
4693
4732
|
init_utils();
|
|
4694
4733
|
init_parse_diff_summary();
|
|
4695
4734
|
init_log_format();
|
|
@@ -4721,14 +4760,19 @@ function diffSummaryTask(customArgs) {
|
|
|
4721
4760
|
function validateLogFormatConfig(customArgs) {
|
|
4722
4761
|
const flags = customArgs.filter(isLogFormat);
|
|
4723
4762
|
if (flags.length > 1) {
|
|
4724
|
-
return configurationErrorTask(
|
|
4763
|
+
return configurationErrorTask(
|
|
4764
|
+
`Summary flags are mutually exclusive - pick one of ${flags.join(",")}`
|
|
4765
|
+
);
|
|
4725
4766
|
}
|
|
4726
4767
|
if (flags.length && customArgs.includes("-z")) {
|
|
4727
|
-
return configurationErrorTask(
|
|
4768
|
+
return configurationErrorTask(
|
|
4769
|
+
`Summary flag ${flags} parsing is not compatible with null termination option '-z'`
|
|
4770
|
+
);
|
|
4728
4771
|
}
|
|
4729
4772
|
}
|
|
4730
4773
|
var init_diff = __esm({
|
|
4731
4774
|
"src/lib/tasks/diff.ts"() {
|
|
4775
|
+
"use strict";
|
|
4732
4776
|
init_log_format();
|
|
4733
4777
|
init_parse_diff_summary();
|
|
4734
4778
|
init_task();
|
|
@@ -4753,7 +4797,7 @@ function userOptions(input) {
|
|
|
4753
4797
|
}
|
|
4754
4798
|
function parseLogOptions(opt = {}, customArgs = []) {
|
|
4755
4799
|
const splitter = filterType(opt.splitter, filterString, SPLITTER);
|
|
4756
|
-
const format =
|
|
4800
|
+
const format = filterPlainObject(opt.format) ? opt.format : {
|
|
4757
4801
|
hash: "%H",
|
|
4758
4802
|
date: opt.strictDate === false ? "%ai" : "%aI",
|
|
4759
4803
|
message: "%s",
|
|
@@ -4787,18 +4831,21 @@ function parseLogOptions(opt = {}, customArgs = []) {
|
|
|
4787
4831
|
};
|
|
4788
4832
|
}
|
|
4789
4833
|
function logTask(splitter, fields, customArgs) {
|
|
4790
|
-
const
|
|
4834
|
+
const parser4 = createListLogSummaryParser(splitter, fields, logFormatFromCommand(customArgs));
|
|
4791
4835
|
return {
|
|
4792
4836
|
commands: ["log", ...customArgs],
|
|
4793
4837
|
format: "utf-8",
|
|
4794
|
-
parser:
|
|
4838
|
+
parser: parser4
|
|
4795
4839
|
};
|
|
4796
4840
|
}
|
|
4797
4841
|
function log_default() {
|
|
4798
4842
|
return {
|
|
4799
4843
|
log(...rest) {
|
|
4800
4844
|
const next = trailingFunctionArgument(arguments);
|
|
4801
|
-
const options = parseLogOptions(
|
|
4845
|
+
const options = parseLogOptions(
|
|
4846
|
+
trailingOptionsArgument(arguments),
|
|
4847
|
+
filterType(arguments[0], filterArray)
|
|
4848
|
+
);
|
|
4802
4849
|
const task = rejectDeprecatedSignatures(...rest) || validateLogFormatConfig(options.commands) || createLogTask(options);
|
|
4803
4850
|
return this._runTask(task, next);
|
|
4804
4851
|
}
|
|
@@ -4807,12 +4854,15 @@ function log_default() {
|
|
|
4807
4854
|
return logTask(options.splitter, options.fields, options.commands);
|
|
4808
4855
|
}
|
|
4809
4856
|
function rejectDeprecatedSignatures(from, to) {
|
|
4810
|
-
return filterString(from) && filterString(to) && configurationErrorTask(
|
|
4857
|
+
return filterString(from) && filterString(to) && configurationErrorTask(
|
|
4858
|
+
`git.log(string, string) should be replaced with git.log({ from: string, to: string })`
|
|
4859
|
+
);
|
|
4811
4860
|
}
|
|
4812
4861
|
}
|
|
4813
4862
|
var excludeOptions;
|
|
4814
4863
|
var init_log = __esm({
|
|
4815
4864
|
"src/lib/tasks/log.ts"() {
|
|
4865
|
+
"use strict";
|
|
4816
4866
|
init_log_format();
|
|
4817
4867
|
init_pathspec();
|
|
4818
4868
|
init_parse_list_log_summary();
|
|
@@ -4841,6 +4891,7 @@ var MergeSummaryConflict;
|
|
|
4841
4891
|
var MergeSummaryDetail;
|
|
4842
4892
|
var init_MergeSummary = __esm({
|
|
4843
4893
|
"src/lib/responses/MergeSummary.ts"() {
|
|
4894
|
+
"use strict";
|
|
4844
4895
|
MergeSummaryConflict = class {
|
|
4845
4896
|
constructor(reason, file = null, meta) {
|
|
4846
4897
|
this.reason = reason;
|
|
@@ -4876,6 +4927,7 @@ var PullSummary;
|
|
|
4876
4927
|
var PullFailedSummary;
|
|
4877
4928
|
var init_PullSummary = __esm({
|
|
4878
4929
|
"src/lib/responses/PullSummary.ts"() {
|
|
4930
|
+
"use strict";
|
|
4879
4931
|
PullSummary = class {
|
|
4880
4932
|
constructor() {
|
|
4881
4933
|
this.remoteMessages = {
|
|
@@ -4933,24 +4985,34 @@ function asObjectCount(source) {
|
|
|
4933
4985
|
var remoteMessagesObjectParsers;
|
|
4934
4986
|
var init_parse_remote_objects = __esm({
|
|
4935
4987
|
"src/lib/parsers/parse-remote-objects.ts"() {
|
|
4988
|
+
"use strict";
|
|
4936
4989
|
init_utils();
|
|
4937
4990
|
remoteMessagesObjectParsers = [
|
|
4938
|
-
new RemoteLineParser(
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4991
|
+
new RemoteLineParser(
|
|
4992
|
+
/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,
|
|
4993
|
+
(result, [action, count]) => {
|
|
4994
|
+
const key = action.toLowerCase();
|
|
4995
|
+
const enumeration = objectEnumerationResult(result.remoteMessages);
|
|
4996
|
+
Object.assign(enumeration, { [key]: asNumber(count) });
|
|
4997
|
+
}
|
|
4998
|
+
),
|
|
4999
|
+
new RemoteLineParser(
|
|
5000
|
+
/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,
|
|
5001
|
+
(result, [action, count]) => {
|
|
5002
|
+
const key = action.toLowerCase();
|
|
5003
|
+
const enumeration = objectEnumerationResult(result.remoteMessages);
|
|
5004
|
+
Object.assign(enumeration, { [key]: asNumber(count) });
|
|
5005
|
+
}
|
|
5006
|
+
),
|
|
5007
|
+
new RemoteLineParser(
|
|
5008
|
+
/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,
|
|
5009
|
+
(result, [total, reused, packReused]) => {
|
|
5010
|
+
const objects = objectEnumerationResult(result.remoteMessages);
|
|
5011
|
+
objects.total = asObjectCount(total);
|
|
5012
|
+
objects.reused = asObjectCount(reused);
|
|
5013
|
+
objects.packReused = asNumber(packReused);
|
|
5014
|
+
}
|
|
5015
|
+
)
|
|
4954
5016
|
];
|
|
4955
5017
|
}
|
|
4956
5018
|
});
|
|
@@ -4961,6 +5023,7 @@ var parsers2;
|
|
|
4961
5023
|
var RemoteMessageSummary;
|
|
4962
5024
|
var init_parse_remote_messages = __esm({
|
|
4963
5025
|
"src/lib/parsers/parse-remote-messages.ts"() {
|
|
5026
|
+
"use strict";
|
|
4964
5027
|
init_utils();
|
|
4965
5028
|
init_parse_remote_objects();
|
|
4966
5029
|
parsers2 = [
|
|
@@ -4969,16 +5032,22 @@ var init_parse_remote_messages = __esm({
|
|
|
4969
5032
|
return false;
|
|
4970
5033
|
}),
|
|
4971
5034
|
...remoteMessagesObjectParsers,
|
|
4972
|
-
new RemoteLineParser(
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
5035
|
+
new RemoteLineParser(
|
|
5036
|
+
[/create a (?:pull|merge) request/i, /\s(https?:\/\/\S+)$/],
|
|
5037
|
+
(result, [pullRequestUrl]) => {
|
|
5038
|
+
result.remoteMessages.pullRequestUrl = pullRequestUrl;
|
|
5039
|
+
}
|
|
5040
|
+
),
|
|
5041
|
+
new RemoteLineParser(
|
|
5042
|
+
[/found (\d+) vulnerabilities.+\(([^)]+)\)/i, /\s(https?:\/\/\S+)$/],
|
|
5043
|
+
(result, [count, summary, url]) => {
|
|
5044
|
+
result.remoteMessages.vulnerabilities = {
|
|
5045
|
+
count: asNumber(count),
|
|
5046
|
+
summary,
|
|
5047
|
+
url
|
|
5048
|
+
};
|
|
5049
|
+
}
|
|
5050
|
+
)
|
|
4982
5051
|
];
|
|
4983
5052
|
RemoteMessageSummary = class {
|
|
4984
5053
|
constructor() {
|
|
@@ -5000,6 +5069,7 @@ var parsePullDetail;
|
|
|
5000
5069
|
var parsePullResult;
|
|
5001
5070
|
var init_parse_pull = __esm({
|
|
5002
5071
|
"src/lib/parsers/parse-pull.ts"() {
|
|
5072
|
+
"use strict";
|
|
5003
5073
|
init_PullSummary();
|
|
5004
5074
|
init_utils();
|
|
5005
5075
|
init_parse_remote_messages();
|
|
@@ -5033,18 +5103,25 @@ var init_parse_pull = __esm({
|
|
|
5033
5103
|
errorParsers = [
|
|
5034
5104
|
new LineParser(/^from\s(.+)$/i, (result, [remote]) => void (result.remote = remote)),
|
|
5035
5105
|
new LineParser(/^fatal:\s(.+)$/, (result, [message]) => void (result.message = message)),
|
|
5036
|
-
new LineParser(
|
|
5037
|
-
|
|
5038
|
-
result
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5106
|
+
new LineParser(
|
|
5107
|
+
/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,
|
|
5108
|
+
(result, [hashLocal, hashRemote, branchLocal, branchRemote]) => {
|
|
5109
|
+
result.branch.local = branchLocal;
|
|
5110
|
+
result.hash.local = hashLocal;
|
|
5111
|
+
result.branch.remote = branchRemote;
|
|
5112
|
+
result.hash.remote = hashRemote;
|
|
5113
|
+
}
|
|
5114
|
+
)
|
|
5042
5115
|
];
|
|
5043
5116
|
parsePullDetail = (stdOut, stdErr) => {
|
|
5044
5117
|
return parseStringResponse(new PullSummary(), parsers3, [stdOut, stdErr]);
|
|
5045
5118
|
};
|
|
5046
5119
|
parsePullResult = (stdOut, stdErr) => {
|
|
5047
|
-
return Object.assign(
|
|
5120
|
+
return Object.assign(
|
|
5121
|
+
new PullSummary(),
|
|
5122
|
+
parsePullDetail(stdOut, stdErr),
|
|
5123
|
+
parseRemoteMessages(stdOut, stdErr)
|
|
5124
|
+
);
|
|
5048
5125
|
};
|
|
5049
5126
|
}
|
|
5050
5127
|
});
|
|
@@ -5053,6 +5130,7 @@ var parseMergeResult;
|
|
|
5053
5130
|
var parseMergeDetail;
|
|
5054
5131
|
var init_parse_merge = __esm({
|
|
5055
5132
|
"src/lib/parsers/parse-merge.ts"() {
|
|
5133
|
+
"use strict";
|
|
5056
5134
|
init_MergeSummary();
|
|
5057
5135
|
init_utils();
|
|
5058
5136
|
init_parse_pull();
|
|
@@ -5063,9 +5141,12 @@ var init_parse_merge = __esm({
|
|
|
5063
5141
|
new LineParser(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/, (summary, [reason, file]) => {
|
|
5064
5142
|
summary.conflicts.push(new MergeSummaryConflict(reason, file));
|
|
5065
5143
|
}),
|
|
5066
|
-
new LineParser(
|
|
5067
|
-
|
|
5068
|
-
|
|
5144
|
+
new LineParser(
|
|
5145
|
+
/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,
|
|
5146
|
+
(summary, [reason, file, deleteRef]) => {
|
|
5147
|
+
summary.conflicts.push(new MergeSummaryConflict(reason, file, { deleteRef }));
|
|
5148
|
+
}
|
|
5149
|
+
),
|
|
5069
5150
|
new LineParser(/^CONFLICT\s+\((.+)\):/, (summary, [reason]) => {
|
|
5070
5151
|
summary.conflicts.push(new MergeSummaryConflict(reason, null));
|
|
5071
5152
|
}),
|
|
@@ -5099,6 +5180,7 @@ function mergeTask(customArgs) {
|
|
|
5099
5180
|
}
|
|
5100
5181
|
var init_merge = __esm({
|
|
5101
5182
|
"src/lib/tasks/merge.ts"() {
|
|
5183
|
+
"use strict";
|
|
5102
5184
|
init_git_response_error();
|
|
5103
5185
|
init_parse_merge();
|
|
5104
5186
|
init_task();
|
|
@@ -5123,6 +5205,7 @@ var parsePushResult;
|
|
|
5123
5205
|
var parsePushDetail;
|
|
5124
5206
|
var init_parse_push = __esm({
|
|
5125
5207
|
"src/lib/parsers/parse-push.ts"() {
|
|
5208
|
+
"use strict";
|
|
5126
5209
|
init_utils();
|
|
5127
5210
|
init_parse_remote_messages();
|
|
5128
5211
|
parsers5 = [
|
|
@@ -5130,37 +5213,48 @@ var init_parse_push = __esm({
|
|
|
5130
5213
|
result.repo = repo;
|
|
5131
5214
|
}),
|
|
5132
5215
|
new LineParser(/^updating local tracking ref '(.+)'/, (result, [local]) => {
|
|
5133
|
-
result.ref =
|
|
5216
|
+
result.ref = {
|
|
5217
|
+
...result.ref || {},
|
|
5134
5218
|
local
|
|
5135
|
-
}
|
|
5219
|
+
};
|
|
5136
5220
|
}),
|
|
5137
5221
|
new LineParser(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/, (result, [local, remote, type]) => {
|
|
5138
5222
|
result.pushed.push(pushResultPushedItem(local, remote, type));
|
|
5139
5223
|
}),
|
|
5140
|
-
new LineParser(
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
});
|
|
5146
|
-
}),
|
|
5147
|
-
new LineParser(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/, (result, [local, remote, from, to]) => {
|
|
5148
|
-
result.update = {
|
|
5149
|
-
head: {
|
|
5224
|
+
new LineParser(
|
|
5225
|
+
/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,
|
|
5226
|
+
(result, [local, remote, remoteName]) => {
|
|
5227
|
+
result.branch = {
|
|
5228
|
+
...result.branch || {},
|
|
5150
5229
|
local,
|
|
5151
|
-
remote
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5230
|
+
remote,
|
|
5231
|
+
remoteName
|
|
5232
|
+
};
|
|
5233
|
+
}
|
|
5234
|
+
),
|
|
5235
|
+
new LineParser(
|
|
5236
|
+
/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,
|
|
5237
|
+
(result, [local, remote, from, to]) => {
|
|
5238
|
+
result.update = {
|
|
5239
|
+
head: {
|
|
5240
|
+
local,
|
|
5241
|
+
remote
|
|
5242
|
+
},
|
|
5243
|
+
hash: {
|
|
5244
|
+
from,
|
|
5245
|
+
to
|
|
5246
|
+
}
|
|
5247
|
+
};
|
|
5248
|
+
}
|
|
5249
|
+
)
|
|
5159
5250
|
];
|
|
5160
5251
|
parsePushResult = (stdOut, stdErr) => {
|
|
5161
5252
|
const pushDetail = parsePushDetail(stdOut, stdErr);
|
|
5162
5253
|
const responseDetail = parseRemoteMessages(stdOut, stdErr);
|
|
5163
|
-
return
|
|
5254
|
+
return {
|
|
5255
|
+
...pushDetail,
|
|
5256
|
+
...responseDetail
|
|
5257
|
+
};
|
|
5164
5258
|
};
|
|
5165
5259
|
parsePushDetail = (stdOut, stdErr) => {
|
|
5166
5260
|
return parseStringResponse({ pushed: [] }, parsers5, [stdOut, stdErr]);
|
|
@@ -5195,6 +5289,7 @@ function pushTask(ref = {}, customArgs) {
|
|
|
5195
5289
|
}
|
|
5196
5290
|
var init_push = __esm({
|
|
5197
5291
|
"src/lib/tasks/push.ts"() {
|
|
5292
|
+
"use strict";
|
|
5198
5293
|
init_parse_push();
|
|
5199
5294
|
init_utils();
|
|
5200
5295
|
}
|
|
@@ -5206,16 +5301,23 @@ function show_default() {
|
|
|
5206
5301
|
if (!commands.includes("--binary")) {
|
|
5207
5302
|
commands.splice(1, 0, "--binary");
|
|
5208
5303
|
}
|
|
5209
|
-
return this._runTask(
|
|
5304
|
+
return this._runTask(
|
|
5305
|
+
straightThroughBufferTask(commands),
|
|
5306
|
+
trailingFunctionArgument(arguments)
|
|
5307
|
+
);
|
|
5210
5308
|
},
|
|
5211
5309
|
show() {
|
|
5212
5310
|
const commands = ["show", ...getTrailingOptions(arguments, 1)];
|
|
5213
|
-
return this._runTask(
|
|
5311
|
+
return this._runTask(
|
|
5312
|
+
straightThroughStringTask(commands),
|
|
5313
|
+
trailingFunctionArgument(arguments)
|
|
5314
|
+
);
|
|
5214
5315
|
}
|
|
5215
5316
|
};
|
|
5216
5317
|
}
|
|
5217
5318
|
var init_show = __esm({
|
|
5218
5319
|
"src/lib/tasks/show.ts"() {
|
|
5320
|
+
"use strict";
|
|
5219
5321
|
init_utils();
|
|
5220
5322
|
init_task();
|
|
5221
5323
|
}
|
|
@@ -5224,16 +5326,17 @@ var fromPathRegex;
|
|
|
5224
5326
|
var FileStatusSummary;
|
|
5225
5327
|
var init_FileStatusSummary = __esm({
|
|
5226
5328
|
"src/lib/responses/FileStatusSummary.ts"() {
|
|
5227
|
-
|
|
5329
|
+
"use strict";
|
|
5330
|
+
fromPathRegex = /^(.+)\0(.+)$/;
|
|
5228
5331
|
FileStatusSummary = class {
|
|
5229
5332
|
constructor(path4, index, working_dir) {
|
|
5230
5333
|
this.path = path4;
|
|
5231
5334
|
this.index = index;
|
|
5232
5335
|
this.working_dir = working_dir;
|
|
5233
|
-
if (index
|
|
5336
|
+
if (index === "R" || working_dir === "R") {
|
|
5234
5337
|
const detail = fromPathRegex.exec(path4) || [null, path4, path4];
|
|
5235
|
-
this.from = detail[
|
|
5236
|
-
this.path = detail[
|
|
5338
|
+
this.from = detail[2] || "";
|
|
5339
|
+
this.path = detail[1] || "";
|
|
5237
5340
|
}
|
|
5238
5341
|
}
|
|
5239
5342
|
};
|
|
@@ -5246,11 +5349,11 @@ function renamedFile(line) {
|
|
|
5246
5349
|
to
|
|
5247
5350
|
};
|
|
5248
5351
|
}
|
|
5249
|
-
function
|
|
5352
|
+
function parser3(indexX, indexY, handler) {
|
|
5250
5353
|
return [`${indexX}${indexY}`, handler];
|
|
5251
5354
|
}
|
|
5252
5355
|
function conflicts(indexX, ...indexY) {
|
|
5253
|
-
return indexY.map((y) =>
|
|
5356
|
+
return indexY.map((y) => parser3(indexX, y, (result, file) => append(result.conflicted, file)));
|
|
5254
5357
|
}
|
|
5255
5358
|
function splitLine(result, lineStr) {
|
|
5256
5359
|
const trimmed2 = lineStr.trim();
|
|
@@ -5269,7 +5372,7 @@ function splitLine(result, lineStr) {
|
|
|
5269
5372
|
handler(result, path4);
|
|
5270
5373
|
}
|
|
5271
5374
|
if (raw !== "##" && raw !== "!!") {
|
|
5272
|
-
result.files.push(new FileStatusSummary(path4
|
|
5375
|
+
result.files.push(new FileStatusSummary(path4, index, workingDir));
|
|
5273
5376
|
}
|
|
5274
5377
|
}
|
|
5275
5378
|
}
|
|
@@ -5278,6 +5381,7 @@ var parsers6;
|
|
|
5278
5381
|
var parseStatusSummary;
|
|
5279
5382
|
var init_StatusSummary = __esm({
|
|
5280
5383
|
"src/lib/responses/StatusSummary.ts"() {
|
|
5384
|
+
"use strict";
|
|
5281
5385
|
init_utils();
|
|
5282
5386
|
init_FileStatusSummary();
|
|
5283
5387
|
StatusSummary = class {
|
|
@@ -5302,26 +5406,62 @@ var init_StatusSummary = __esm({
|
|
|
5302
5406
|
}
|
|
5303
5407
|
};
|
|
5304
5408
|
parsers6 = new Map([
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5409
|
+
parser3(
|
|
5410
|
+
" ",
|
|
5411
|
+
"A",
|
|
5412
|
+
(result, file) => append(result.created, file)
|
|
5413
|
+
),
|
|
5414
|
+
parser3(
|
|
5415
|
+
" ",
|
|
5416
|
+
"D",
|
|
5417
|
+
(result, file) => append(result.deleted, file)
|
|
5418
|
+
),
|
|
5419
|
+
parser3(
|
|
5420
|
+
" ",
|
|
5421
|
+
"M",
|
|
5422
|
+
(result, file) => append(result.modified, file)
|
|
5423
|
+
),
|
|
5424
|
+
parser3(
|
|
5425
|
+
"A",
|
|
5426
|
+
" ",
|
|
5427
|
+
(result, file) => append(result.created, file) && append(result.staged, file)
|
|
5428
|
+
),
|
|
5429
|
+
parser3(
|
|
5430
|
+
"A",
|
|
5431
|
+
"M",
|
|
5432
|
+
(result, file) => append(result.created, file) && append(result.staged, file) && append(result.modified, file)
|
|
5433
|
+
),
|
|
5434
|
+
parser3(
|
|
5435
|
+
"D",
|
|
5436
|
+
" ",
|
|
5437
|
+
(result, file) => append(result.deleted, file) && append(result.staged, file)
|
|
5438
|
+
),
|
|
5439
|
+
parser3(
|
|
5440
|
+
"M",
|
|
5441
|
+
" ",
|
|
5442
|
+
(result, file) => append(result.modified, file) && append(result.staged, file)
|
|
5443
|
+
),
|
|
5444
|
+
parser3(
|
|
5445
|
+
"M",
|
|
5446
|
+
"M",
|
|
5447
|
+
(result, file) => append(result.modified, file) && append(result.staged, file)
|
|
5448
|
+
),
|
|
5449
|
+
parser3("R", " ", (result, file) => {
|
|
5314
5450
|
append(result.renamed, renamedFile(file));
|
|
5315
5451
|
}),
|
|
5316
|
-
|
|
5452
|
+
parser3("R", "M", (result, file) => {
|
|
5317
5453
|
const renamed = renamedFile(file);
|
|
5318
5454
|
append(result.renamed, renamed);
|
|
5319
5455
|
append(result.modified, renamed.to);
|
|
5320
5456
|
}),
|
|
5321
|
-
|
|
5457
|
+
parser3("!", "!", (_result, _file) => {
|
|
5322
5458
|
append(_result.ignored = _result.ignored || [], _file);
|
|
5323
5459
|
}),
|
|
5324
|
-
|
|
5460
|
+
parser3(
|
|
5461
|
+
"?",
|
|
5462
|
+
"?",
|
|
5463
|
+
(result, file) => append(result.not_added, file)
|
|
5464
|
+
),
|
|
5325
5465
|
...conflicts(
|
|
5326
5466
|
"A",
|
|
5327
5467
|
"A",
|
|
@@ -5401,24 +5541,29 @@ function statusTask(customArgs) {
|
|
|
5401
5541
|
var ignoredOptions;
|
|
5402
5542
|
var init_status = __esm({
|
|
5403
5543
|
"src/lib/tasks/status.ts"() {
|
|
5544
|
+
"use strict";
|
|
5404
5545
|
init_StatusSummary();
|
|
5405
5546
|
ignoredOptions = ["--null", "-z"];
|
|
5406
5547
|
}
|
|
5407
5548
|
});
|
|
5408
5549
|
function versionResponse(major = 0, minor = 0, patch = 0, agent = "", installed = true) {
|
|
5409
|
-
return Object.defineProperty(
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
value() {
|
|
5417
|
-
return `${this.major}.${this.minor}.${this.patch}`;
|
|
5550
|
+
return Object.defineProperty(
|
|
5551
|
+
{
|
|
5552
|
+
major,
|
|
5553
|
+
minor,
|
|
5554
|
+
patch,
|
|
5555
|
+
agent,
|
|
5556
|
+
installed
|
|
5418
5557
|
},
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5558
|
+
"toString",
|
|
5559
|
+
{
|
|
5560
|
+
value() {
|
|
5561
|
+
return `${this.major}.${this.minor}.${this.patch}`;
|
|
5562
|
+
},
|
|
5563
|
+
configurable: false,
|
|
5564
|
+
enumerable: false
|
|
5565
|
+
}
|
|
5566
|
+
);
|
|
5422
5567
|
}
|
|
5423
5568
|
function notInstalledResponse() {
|
|
5424
5569
|
return versionResponse(0, 0, 0, "", false);
|
|
@@ -5450,15 +5595,25 @@ var NOT_INSTALLED;
|
|
|
5450
5595
|
var parsers7;
|
|
5451
5596
|
var init_version = __esm({
|
|
5452
5597
|
"src/lib/tasks/version.ts"() {
|
|
5598
|
+
"use strict";
|
|
5453
5599
|
init_utils();
|
|
5454
5600
|
NOT_INSTALLED = "installed=false";
|
|
5455
5601
|
parsers7 = [
|
|
5456
|
-
new LineParser(
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5602
|
+
new LineParser(
|
|
5603
|
+
/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,
|
|
5604
|
+
(result, [major, minor, patch, agent = ""]) => {
|
|
5605
|
+
Object.assign(
|
|
5606
|
+
result,
|
|
5607
|
+
versionResponse(asNumber(major), asNumber(minor), asNumber(patch), agent)
|
|
5608
|
+
);
|
|
5609
|
+
}
|
|
5610
|
+
),
|
|
5611
|
+
new LineParser(
|
|
5612
|
+
/version (\d+)\.(\d+)\.(\D+)(.+)?$/,
|
|
5613
|
+
(result, [major, minor, patch, agent = ""]) => {
|
|
5614
|
+
Object.assign(result, versionResponse(asNumber(major), asNumber(minor), patch, agent));
|
|
5615
|
+
}
|
|
5616
|
+
)
|
|
5462
5617
|
];
|
|
5463
5618
|
}
|
|
5464
5619
|
});
|
|
@@ -5469,9 +5624,11 @@ __export(simple_git_api_exports, {
|
|
|
5469
5624
|
var SimpleGitApi;
|
|
5470
5625
|
var init_simple_git_api = __esm({
|
|
5471
5626
|
"src/lib/simple-git-api.ts"() {
|
|
5627
|
+
"use strict";
|
|
5472
5628
|
init_task_callback();
|
|
5473
5629
|
init_change_working_directory();
|
|
5474
5630
|
init_checkout();
|
|
5631
|
+
init_count_objects();
|
|
5475
5632
|
init_commit();
|
|
5476
5633
|
init_config();
|
|
5477
5634
|
init_first_commit();
|
|
@@ -5503,52 +5660,100 @@ var init_simple_git_api = __esm({
|
|
|
5503
5660
|
});
|
|
5504
5661
|
}
|
|
5505
5662
|
add(files) {
|
|
5506
|
-
return this._runTask(
|
|
5663
|
+
return this._runTask(
|
|
5664
|
+
straightThroughStringTask(["add", ...asArray(files)]),
|
|
5665
|
+
trailingFunctionArgument(arguments)
|
|
5666
|
+
);
|
|
5507
5667
|
}
|
|
5508
5668
|
cwd(directory) {
|
|
5509
5669
|
const next = trailingFunctionArgument(arguments);
|
|
5510
5670
|
if (typeof directory === "string") {
|
|
5511
5671
|
return this._runTask(changeWorkingDirectoryTask(directory, this._executor), next);
|
|
5512
5672
|
}
|
|
5513
|
-
if (typeof
|
|
5514
|
-
return this._runTask(
|
|
5673
|
+
if (typeof directory?.path === "string") {
|
|
5674
|
+
return this._runTask(
|
|
5675
|
+
changeWorkingDirectoryTask(
|
|
5676
|
+
directory.path,
|
|
5677
|
+
directory.root && this._executor || void 0
|
|
5678
|
+
),
|
|
5679
|
+
next
|
|
5680
|
+
);
|
|
5515
5681
|
}
|
|
5516
|
-
return this._runTask(
|
|
5682
|
+
return this._runTask(
|
|
5683
|
+
configurationErrorTask("Git.cwd: workingDirectory must be supplied as a string"),
|
|
5684
|
+
next
|
|
5685
|
+
);
|
|
5517
5686
|
}
|
|
5518
5687
|
hashObject(path4, write) {
|
|
5519
|
-
return this._runTask(
|
|
5688
|
+
return this._runTask(
|
|
5689
|
+
hashObjectTask(path4, write === true),
|
|
5690
|
+
trailingFunctionArgument(arguments)
|
|
5691
|
+
);
|
|
5520
5692
|
}
|
|
5521
5693
|
init(bare) {
|
|
5522
|
-
return this._runTask(
|
|
5694
|
+
return this._runTask(
|
|
5695
|
+
initTask(bare === true, this._executor.cwd, getTrailingOptions(arguments)),
|
|
5696
|
+
trailingFunctionArgument(arguments)
|
|
5697
|
+
);
|
|
5523
5698
|
}
|
|
5524
5699
|
merge() {
|
|
5525
|
-
return this._runTask(
|
|
5700
|
+
return this._runTask(
|
|
5701
|
+
mergeTask(getTrailingOptions(arguments)),
|
|
5702
|
+
trailingFunctionArgument(arguments)
|
|
5703
|
+
);
|
|
5526
5704
|
}
|
|
5527
5705
|
mergeFromTo(remote, branch) {
|
|
5528
5706
|
if (!(filterString(remote) && filterString(branch))) {
|
|
5529
|
-
return this._runTask(
|
|
5707
|
+
return this._runTask(
|
|
5708
|
+
configurationErrorTask(
|
|
5709
|
+
`Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`
|
|
5710
|
+
)
|
|
5711
|
+
);
|
|
5530
5712
|
}
|
|
5531
|
-
return this._runTask(
|
|
5713
|
+
return this._runTask(
|
|
5714
|
+
mergeTask([remote, branch, ...getTrailingOptions(arguments)]),
|
|
5715
|
+
trailingFunctionArgument(arguments, false)
|
|
5716
|
+
);
|
|
5532
5717
|
}
|
|
5533
5718
|
outputHandler(handler) {
|
|
5534
5719
|
this._executor.outputHandler = handler;
|
|
5535
5720
|
return this;
|
|
5536
5721
|
}
|
|
5537
5722
|
push() {
|
|
5538
|
-
const task = pushTask(
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5723
|
+
const task = pushTask(
|
|
5724
|
+
{
|
|
5725
|
+
remote: filterType(arguments[0], filterString),
|
|
5726
|
+
branch: filterType(arguments[1], filterString)
|
|
5727
|
+
},
|
|
5728
|
+
getTrailingOptions(arguments)
|
|
5729
|
+
);
|
|
5542
5730
|
return this._runTask(task, trailingFunctionArgument(arguments));
|
|
5543
5731
|
}
|
|
5544
5732
|
stash() {
|
|
5545
|
-
return this._runTask(
|
|
5733
|
+
return this._runTask(
|
|
5734
|
+
straightThroughStringTask(["stash", ...getTrailingOptions(arguments)]),
|
|
5735
|
+
trailingFunctionArgument(arguments)
|
|
5736
|
+
);
|
|
5546
5737
|
}
|
|
5547
5738
|
status() {
|
|
5548
|
-
return this._runTask(
|
|
5739
|
+
return this._runTask(
|
|
5740
|
+
statusTask(getTrailingOptions(arguments)),
|
|
5741
|
+
trailingFunctionArgument(arguments)
|
|
5742
|
+
);
|
|
5549
5743
|
}
|
|
5550
5744
|
};
|
|
5551
|
-
Object.assign(
|
|
5745
|
+
Object.assign(
|
|
5746
|
+
SimpleGitApi.prototype,
|
|
5747
|
+
checkout_default(),
|
|
5748
|
+
commit_default(),
|
|
5749
|
+
config_default(),
|
|
5750
|
+
count_objects_default(),
|
|
5751
|
+
first_commit_default(),
|
|
5752
|
+
grep_default(),
|
|
5753
|
+
log_default(),
|
|
5754
|
+
show_default(),
|
|
5755
|
+
version_default()
|
|
5756
|
+
);
|
|
5552
5757
|
}
|
|
5553
5758
|
});
|
|
5554
5759
|
var scheduler_exports = {};
|
|
@@ -5559,9 +5764,10 @@ var createScheduledTask;
|
|
|
5559
5764
|
var Scheduler;
|
|
5560
5765
|
var init_scheduler = __esm({
|
|
5561
5766
|
"src/lib/runners/scheduler.ts"() {
|
|
5767
|
+
"use strict";
|
|
5562
5768
|
init_utils();
|
|
5563
5769
|
init_git_logger();
|
|
5564
|
-
createScheduledTask = (() => {
|
|
5770
|
+
createScheduledTask = /* @__PURE__ */ (() => {
|
|
5565
5771
|
let id = 0;
|
|
5566
5772
|
return () => {
|
|
5567
5773
|
id++;
|
|
@@ -5583,7 +5789,12 @@ var init_scheduler = __esm({
|
|
|
5583
5789
|
}
|
|
5584
5790
|
schedule() {
|
|
5585
5791
|
if (!this.pending.length || this.running.length >= this.concurrency) {
|
|
5586
|
-
this.logger(
|
|
5792
|
+
this.logger(
|
|
5793
|
+
`Schedule attempt ignored, pending=%s running=%s concurrency=%s`,
|
|
5794
|
+
this.pending.length,
|
|
5795
|
+
this.running.length,
|
|
5796
|
+
this.concurrency
|
|
5797
|
+
);
|
|
5587
5798
|
return;
|
|
5588
5799
|
}
|
|
5589
5800
|
const task = append(this.running, this.pending.shift());
|
|
@@ -5612,6 +5823,7 @@ function applyPatchTask(patches, customArgs) {
|
|
|
5612
5823
|
}
|
|
5613
5824
|
var init_apply_patch = __esm({
|
|
5614
5825
|
"src/lib/tasks/apply-patch.ts"() {
|
|
5826
|
+
"use strict";
|
|
5615
5827
|
init_task();
|
|
5616
5828
|
}
|
|
5617
5829
|
});
|
|
@@ -5632,6 +5844,7 @@ function branchDeletionFailure(branch) {
|
|
|
5632
5844
|
var BranchDeletionBatch;
|
|
5633
5845
|
var init_BranchDeleteSummary = __esm({
|
|
5634
5846
|
"src/lib/responses/BranchDeleteSummary.ts"() {
|
|
5847
|
+
"use strict";
|
|
5635
5848
|
BranchDeletionBatch = class {
|
|
5636
5849
|
constructor() {
|
|
5637
5850
|
this.all = [];
|
|
@@ -5653,6 +5866,7 @@ var parsers8;
|
|
|
5653
5866
|
var parseBranchDeletions;
|
|
5654
5867
|
var init_parse_branch_delete = __esm({
|
|
5655
5868
|
"src/lib/parsers/parse-branch-delete.ts"() {
|
|
5869
|
+
"use strict";
|
|
5656
5870
|
init_BranchDeleteSummary();
|
|
5657
5871
|
init_utils();
|
|
5658
5872
|
deleteSuccessRegex = /(\S+)\s+\(\S+\s([^)]+)\)/;
|
|
@@ -5678,6 +5892,7 @@ var init_parse_branch_delete = __esm({
|
|
|
5678
5892
|
var BranchSummaryResult;
|
|
5679
5893
|
var init_BranchSummary = __esm({
|
|
5680
5894
|
"src/lib/responses/BranchSummary.ts"() {
|
|
5895
|
+
"use strict";
|
|
5681
5896
|
BranchSummaryResult = class {
|
|
5682
5897
|
constructor() {
|
|
5683
5898
|
this.all = [];
|
|
@@ -5711,15 +5926,22 @@ function parseBranchSummary(stdOut) {
|
|
|
5711
5926
|
var parsers9;
|
|
5712
5927
|
var init_parse_branch = __esm({
|
|
5713
5928
|
"src/lib/parsers/parse-branch.ts"() {
|
|
5929
|
+
"use strict";
|
|
5714
5930
|
init_BranchSummary();
|
|
5715
5931
|
init_utils();
|
|
5716
5932
|
parsers9 = [
|
|
5717
|
-
new LineParser(
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5933
|
+
new LineParser(
|
|
5934
|
+
/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,
|
|
5935
|
+
(result, [current, name, commit, label]) => {
|
|
5936
|
+
result.push(branchStatus(current), true, name, commit, label);
|
|
5937
|
+
}
|
|
5938
|
+
),
|
|
5939
|
+
new LineParser(
|
|
5940
|
+
/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,
|
|
5941
|
+
(result, [current, name, commit, label]) => {
|
|
5942
|
+
result.push(branchStatus(current), false, name, commit, label);
|
|
5943
|
+
}
|
|
5944
|
+
)
|
|
5723
5945
|
];
|
|
5724
5946
|
}
|
|
5725
5947
|
});
|
|
@@ -5756,11 +5978,11 @@ function branchTask(customArgs) {
|
|
|
5756
5978
|
};
|
|
5757
5979
|
}
|
|
5758
5980
|
function branchLocalTask() {
|
|
5759
|
-
const
|
|
5981
|
+
const parser4 = parseBranchSummary;
|
|
5760
5982
|
return {
|
|
5761
5983
|
format: "utf-8",
|
|
5762
5984
|
commands: ["branch", "-v"],
|
|
5763
|
-
parser:
|
|
5985
|
+
parser: parser4
|
|
5764
5986
|
};
|
|
5765
5987
|
}
|
|
5766
5988
|
function deleteBranchesTask(branches, forceDelete = false) {
|
|
@@ -5789,13 +6011,17 @@ function deleteBranchTask(branch, forceDelete = false) {
|
|
|
5789
6011
|
if (!hasBranchDeletionError(String(error), exitCode)) {
|
|
5790
6012
|
return fail(error);
|
|
5791
6013
|
}
|
|
5792
|
-
throw new GitResponseError(
|
|
6014
|
+
throw new GitResponseError(
|
|
6015
|
+
task.parser(bufferToString(stdOut), bufferToString(stdErr)),
|
|
6016
|
+
String(error)
|
|
6017
|
+
);
|
|
5793
6018
|
}
|
|
5794
6019
|
};
|
|
5795
6020
|
return task;
|
|
5796
6021
|
}
|
|
5797
6022
|
var init_branch = __esm({
|
|
5798
6023
|
"src/lib/tasks/branch.ts"() {
|
|
6024
|
+
"use strict";
|
|
5799
6025
|
init_git_response_error();
|
|
5800
6026
|
init_parse_branch_delete();
|
|
5801
6027
|
init_parse_branch();
|
|
@@ -5805,6 +6031,7 @@ var init_branch = __esm({
|
|
|
5805
6031
|
var parseCheckIgnore;
|
|
5806
6032
|
var init_CheckIgnore = __esm({
|
|
5807
6033
|
"src/lib/responses/CheckIgnore.ts"() {
|
|
6034
|
+
"use strict";
|
|
5808
6035
|
parseCheckIgnore = (text) => {
|
|
5809
6036
|
return text.split(/\n/g).map((line) => line.trim()).filter((file) => !!file);
|
|
5810
6037
|
};
|
|
@@ -5823,6 +6050,7 @@ function checkIgnoreTask(paths) {
|
|
|
5823
6050
|
}
|
|
5824
6051
|
var init_check_ignore = __esm({
|
|
5825
6052
|
"src/lib/tasks/check-ignore.ts"() {
|
|
6053
|
+
"use strict";
|
|
5826
6054
|
init_CheckIgnore();
|
|
5827
6055
|
}
|
|
5828
6056
|
});
|
|
@@ -5850,6 +6078,7 @@ function cloneMirrorTask(repo, directory, customArgs) {
|
|
|
5850
6078
|
}
|
|
5851
6079
|
var init_clone = __esm({
|
|
5852
6080
|
"src/lib/tasks/clone.ts"() {
|
|
6081
|
+
"use strict";
|
|
5853
6082
|
init_task();
|
|
5854
6083
|
init_utils();
|
|
5855
6084
|
}
|
|
@@ -5868,6 +6097,7 @@ function parseFetchResult(stdOut, stdErr) {
|
|
|
5868
6097
|
var parsers10;
|
|
5869
6098
|
var init_parse_fetch = __esm({
|
|
5870
6099
|
"src/lib/parsers/parse-fetch.ts"() {
|
|
6100
|
+
"use strict";
|
|
5871
6101
|
init_utils();
|
|
5872
6102
|
parsers10 = [
|
|
5873
6103
|
new LineParser(/From (.+)$/, (result, [remote]) => {
|
|
@@ -5890,14 +6120,17 @@ var init_parse_fetch = __esm({
|
|
|
5890
6120
|
tracking
|
|
5891
6121
|
});
|
|
5892
6122
|
}),
|
|
5893
|
-
new LineParser(
|
|
5894
|
-
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
|
|
6123
|
+
new LineParser(
|
|
6124
|
+
/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,
|
|
6125
|
+
(result, [from, to, name, tracking]) => {
|
|
6126
|
+
result.updated.push({
|
|
6127
|
+
name,
|
|
6128
|
+
tracking,
|
|
6129
|
+
to,
|
|
6130
|
+
from
|
|
6131
|
+
});
|
|
6132
|
+
}
|
|
6133
|
+
)
|
|
5901
6134
|
];
|
|
5902
6135
|
}
|
|
5903
6136
|
});
|
|
@@ -5925,6 +6158,7 @@ function fetchTask(remote, branch, customArgs) {
|
|
|
5925
6158
|
}
|
|
5926
6159
|
var init_fetch = __esm({
|
|
5927
6160
|
"src/lib/tasks/fetch.ts"() {
|
|
6161
|
+
"use strict";
|
|
5928
6162
|
init_parse_fetch();
|
|
5929
6163
|
init_task();
|
|
5930
6164
|
}
|
|
@@ -5935,6 +6169,7 @@ function parseMoveResult(stdOut) {
|
|
|
5935
6169
|
var parsers11;
|
|
5936
6170
|
var init_parse_move = __esm({
|
|
5937
6171
|
"src/lib/parsers/parse-move.ts"() {
|
|
6172
|
+
"use strict";
|
|
5938
6173
|
init_utils();
|
|
5939
6174
|
parsers11 = [
|
|
5940
6175
|
new LineParser(/^Renaming (.+) to (.+)$/, (result, [from, to]) => {
|
|
@@ -5956,6 +6191,7 @@ function moveTask(from, to) {
|
|
|
5956
6191
|
}
|
|
5957
6192
|
var init_move = __esm({
|
|
5958
6193
|
"src/lib/tasks/move.ts"() {
|
|
6194
|
+
"use strict";
|
|
5959
6195
|
init_parse_move();
|
|
5960
6196
|
init_utils();
|
|
5961
6197
|
}
|
|
@@ -5976,7 +6212,10 @@ function pullTask(remote, branch, customArgs) {
|
|
|
5976
6212
|
return parsePullResult(stdOut, stdErr);
|
|
5977
6213
|
},
|
|
5978
6214
|
onError(result, _error, _done, fail) {
|
|
5979
|
-
const pullError = parsePullErrorResult(
|
|
6215
|
+
const pullError = parsePullErrorResult(
|
|
6216
|
+
bufferToString(result.stdOut),
|
|
6217
|
+
bufferToString(result.stdErr)
|
|
6218
|
+
);
|
|
5980
6219
|
if (pullError) {
|
|
5981
6220
|
return fail(new GitResponseError(pullError));
|
|
5982
6221
|
}
|
|
@@ -5986,6 +6225,7 @@ function pullTask(remote, branch, customArgs) {
|
|
|
5986
6225
|
}
|
|
5987
6226
|
var init_pull = __esm({
|
|
5988
6227
|
"src/lib/tasks/pull.ts"() {
|
|
6228
|
+
"use strict";
|
|
5989
6229
|
init_git_response_error();
|
|
5990
6230
|
init_parse_pull();
|
|
5991
6231
|
init_utils();
|
|
@@ -6016,6 +6256,7 @@ function forEach(text, handler) {
|
|
|
6016
6256
|
}
|
|
6017
6257
|
var init_GetRemoteSummary = __esm({
|
|
6018
6258
|
"src/lib/responses/GetRemoteSummary.ts"() {
|
|
6259
|
+
"use strict";
|
|
6019
6260
|
init_utils();
|
|
6020
6261
|
}
|
|
6021
6262
|
});
|
|
@@ -6027,7 +6268,7 @@ __export(remote_exports, {
|
|
|
6027
6268
|
remoteTask: () => remoteTask,
|
|
6028
6269
|
removeRemoteTask: () => removeRemoteTask
|
|
6029
6270
|
});
|
|
6030
|
-
function addRemoteTask(remoteName, remoteRepo, customArgs
|
|
6271
|
+
function addRemoteTask(remoteName, remoteRepo, customArgs) {
|
|
6031
6272
|
return straightThroughStringTask(["remote", "add", ...customArgs, remoteName, remoteRepo]);
|
|
6032
6273
|
}
|
|
6033
6274
|
function getRemotesTask(verbose) {
|
|
@@ -6041,14 +6282,14 @@ function getRemotesTask(verbose) {
|
|
|
6041
6282
|
parser: verbose ? parseGetRemotesVerbose : parseGetRemotes
|
|
6042
6283
|
};
|
|
6043
6284
|
}
|
|
6044
|
-
function listRemotesTask(customArgs
|
|
6285
|
+
function listRemotesTask(customArgs) {
|
|
6045
6286
|
const commands = [...customArgs];
|
|
6046
6287
|
if (commands[0] !== "ls-remote") {
|
|
6047
6288
|
commands.unshift("ls-remote");
|
|
6048
6289
|
}
|
|
6049
6290
|
return straightThroughStringTask(commands);
|
|
6050
6291
|
}
|
|
6051
|
-
function remoteTask(customArgs
|
|
6292
|
+
function remoteTask(customArgs) {
|
|
6052
6293
|
const commands = [...customArgs];
|
|
6053
6294
|
if (commands[0] !== "remote") {
|
|
6054
6295
|
commands.unshift("remote");
|
|
@@ -6060,6 +6301,7 @@ function removeRemoteTask(remoteName) {
|
|
|
6060
6301
|
}
|
|
6061
6302
|
var init_remote = __esm({
|
|
6062
6303
|
"src/lib/tasks/remote.ts"() {
|
|
6304
|
+
"use strict";
|
|
6063
6305
|
init_GetRemoteSummary();
|
|
6064
6306
|
init_task();
|
|
6065
6307
|
}
|
|
@@ -6071,15 +6313,20 @@ __export(stash_list_exports, {
|
|
|
6071
6313
|
function stashListTask(opt = {}, customArgs) {
|
|
6072
6314
|
const options = parseLogOptions(opt);
|
|
6073
6315
|
const commands = ["stash", "list", ...options.commands, ...customArgs];
|
|
6074
|
-
const
|
|
6316
|
+
const parser4 = createListLogSummaryParser(
|
|
6317
|
+
options.splitter,
|
|
6318
|
+
options.fields,
|
|
6319
|
+
logFormatFromCommand(commands)
|
|
6320
|
+
);
|
|
6075
6321
|
return validateLogFormatConfig(commands) || {
|
|
6076
6322
|
commands,
|
|
6077
6323
|
format: "utf-8",
|
|
6078
|
-
parser:
|
|
6324
|
+
parser: parser4
|
|
6079
6325
|
};
|
|
6080
6326
|
}
|
|
6081
6327
|
var init_stash_list = __esm({
|
|
6082
6328
|
"src/lib/tasks/stash-list.ts"() {
|
|
6329
|
+
"use strict";
|
|
6083
6330
|
init_log_format();
|
|
6084
6331
|
init_parse_list_log_summary();
|
|
6085
6332
|
init_diff();
|
|
@@ -6111,6 +6358,7 @@ function updateSubModuleTask(customArgs) {
|
|
|
6111
6358
|
}
|
|
6112
6359
|
var init_sub_module = __esm({
|
|
6113
6360
|
"src/lib/tasks/sub-module.ts"() {
|
|
6361
|
+
"use strict";
|
|
6114
6362
|
init_task();
|
|
6115
6363
|
}
|
|
6116
6364
|
});
|
|
@@ -6138,6 +6386,7 @@ var TagList;
|
|
|
6138
6386
|
var parseTagList;
|
|
6139
6387
|
var init_TagList = __esm({
|
|
6140
6388
|
"src/lib/responses/TagList.ts"() {
|
|
6389
|
+
"use strict";
|
|
6141
6390
|
TagList = class {
|
|
6142
6391
|
constructor(all, latest) {
|
|
6143
6392
|
this.all = all;
|
|
@@ -6203,11 +6452,13 @@ function addAnnotatedTagTask(name, tagMessage) {
|
|
|
6203
6452
|
}
|
|
6204
6453
|
var init_tag = __esm({
|
|
6205
6454
|
"src/lib/tasks/tag.ts"() {
|
|
6455
|
+
"use strict";
|
|
6206
6456
|
init_TagList();
|
|
6207
6457
|
}
|
|
6208
6458
|
});
|
|
6209
6459
|
var require_git = __commonJS2({
|
|
6210
6460
|
"src/git.js"(exports, module) {
|
|
6461
|
+
"use strict";
|
|
6211
6462
|
var { GitExecutor: GitExecutor2 } = (init_git_executor(), __toCommonJS(git_executor_exports));
|
|
6212
6463
|
var { SimpleGitApi: SimpleGitApi2 } = (init_simple_git_api(), __toCommonJS(simple_git_api_exports));
|
|
6213
6464
|
var { Scheduler: Scheduler2 } = (init_scheduler(), __toCommonJS(scheduler_exports));
|
|
@@ -6257,12 +6508,17 @@ var require_git = __commonJS2({
|
|
|
6257
6508
|
var { addAnnotatedTagTask: addAnnotatedTagTask2, addTagTask: addTagTask2, tagListTask: tagListTask2 } = (init_tag(), __toCommonJS(tag_exports));
|
|
6258
6509
|
var { straightThroughBufferTask: straightThroughBufferTask2, straightThroughStringTask: straightThroughStringTask2 } = (init_task(), __toCommonJS(task_exports));
|
|
6259
6510
|
function Git2(options, plugins) {
|
|
6260
|
-
this.
|
|
6511
|
+
this._plugins = plugins;
|
|
6512
|
+
this._executor = new GitExecutor2(
|
|
6513
|
+
options.baseDir,
|
|
6514
|
+
new Scheduler2(options.maxConcurrentProcesses),
|
|
6515
|
+
plugins
|
|
6516
|
+
);
|
|
6261
6517
|
this._trimmed = options.trimmed;
|
|
6262
6518
|
}
|
|
6263
6519
|
(Git2.prototype = Object.create(SimpleGitApi2.prototype)).constructor = Git2;
|
|
6264
6520
|
Git2.prototype.customBinary = function(command) {
|
|
6265
|
-
this.
|
|
6521
|
+
this._plugins.reconfigure("binary", command);
|
|
6266
6522
|
return this;
|
|
6267
6523
|
};
|
|
6268
6524
|
Git2.prototype.env = function(name, value) {
|
|
@@ -6274,7 +6530,13 @@ var require_git = __commonJS2({
|
|
|
6274
6530
|
return this;
|
|
6275
6531
|
};
|
|
6276
6532
|
Git2.prototype.stashList = function(options) {
|
|
6277
|
-
return this._runTask(
|
|
6533
|
+
return this._runTask(
|
|
6534
|
+
stashListTask2(
|
|
6535
|
+
trailingOptionsArgument2(arguments) || {},
|
|
6536
|
+
filterArray2(options) && options || []
|
|
6537
|
+
),
|
|
6538
|
+
trailingFunctionArgument2(arguments)
|
|
6539
|
+
);
|
|
6278
6540
|
};
|
|
6279
6541
|
function createCloneTask(api, task, repoPath, localPath) {
|
|
6280
6542
|
if (typeof repoPath !== "string") {
|
|
@@ -6283,10 +6545,16 @@ var require_git = __commonJS2({
|
|
|
6283
6545
|
return task(repoPath, filterType2(localPath, filterString2), getTrailingOptions2(arguments));
|
|
6284
6546
|
}
|
|
6285
6547
|
Git2.prototype.clone = function() {
|
|
6286
|
-
return this._runTask(
|
|
6548
|
+
return this._runTask(
|
|
6549
|
+
createCloneTask("clone", cloneTask2, ...arguments),
|
|
6550
|
+
trailingFunctionArgument2(arguments)
|
|
6551
|
+
);
|
|
6287
6552
|
};
|
|
6288
6553
|
Git2.prototype.mirror = function() {
|
|
6289
|
-
return this._runTask(
|
|
6554
|
+
return this._runTask(
|
|
6555
|
+
createCloneTask("mirror", cloneMirrorTask2, ...arguments),
|
|
6556
|
+
trailingFunctionArgument2(arguments)
|
|
6557
|
+
);
|
|
6290
6558
|
};
|
|
6291
6559
|
Git2.prototype.mv = function(from, to) {
|
|
6292
6560
|
return this._runTask(moveTask2(from, to), trailingFunctionArgument2(arguments));
|
|
@@ -6300,46 +6568,86 @@ var require_git = __commonJS2({
|
|
|
6300
6568
|
});
|
|
6301
6569
|
};
|
|
6302
6570
|
Git2.prototype.pull = function(remote, branch, options, then) {
|
|
6303
|
-
return this._runTask(
|
|
6571
|
+
return this._runTask(
|
|
6572
|
+
pullTask2(
|
|
6573
|
+
filterType2(remote, filterString2),
|
|
6574
|
+
filterType2(branch, filterString2),
|
|
6575
|
+
getTrailingOptions2(arguments)
|
|
6576
|
+
),
|
|
6577
|
+
trailingFunctionArgument2(arguments)
|
|
6578
|
+
);
|
|
6304
6579
|
};
|
|
6305
6580
|
Git2.prototype.fetch = function(remote, branch) {
|
|
6306
|
-
return this._runTask(
|
|
6581
|
+
return this._runTask(
|
|
6582
|
+
fetchTask2(
|
|
6583
|
+
filterType2(remote, filterString2),
|
|
6584
|
+
filterType2(branch, filterString2),
|
|
6585
|
+
getTrailingOptions2(arguments)
|
|
6586
|
+
),
|
|
6587
|
+
trailingFunctionArgument2(arguments)
|
|
6588
|
+
);
|
|
6307
6589
|
};
|
|
6308
6590
|
Git2.prototype.silent = function(silence) {
|
|
6309
|
-
console.warn(
|
|
6591
|
+
console.warn(
|
|
6592
|
+
"simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3"
|
|
6593
|
+
);
|
|
6310
6594
|
return this;
|
|
6311
6595
|
};
|
|
6312
6596
|
Git2.prototype.tags = function(options, then) {
|
|
6313
|
-
return this._runTask(
|
|
6597
|
+
return this._runTask(
|
|
6598
|
+
tagListTask2(getTrailingOptions2(arguments)),
|
|
6599
|
+
trailingFunctionArgument2(arguments)
|
|
6600
|
+
);
|
|
6314
6601
|
};
|
|
6315
6602
|
Git2.prototype.rebase = function() {
|
|
6316
|
-
return this._runTask(
|
|
6603
|
+
return this._runTask(
|
|
6604
|
+
straightThroughStringTask2(["rebase", ...getTrailingOptions2(arguments)]),
|
|
6605
|
+
trailingFunctionArgument2(arguments)
|
|
6606
|
+
);
|
|
6317
6607
|
};
|
|
6318
6608
|
Git2.prototype.reset = function(mode) {
|
|
6319
|
-
return this._runTask(
|
|
6609
|
+
return this._runTask(
|
|
6610
|
+
resetTask2(getResetMode2(mode), getTrailingOptions2(arguments)),
|
|
6611
|
+
trailingFunctionArgument2(arguments)
|
|
6612
|
+
);
|
|
6320
6613
|
};
|
|
6321
6614
|
Git2.prototype.revert = function(commit) {
|
|
6322
6615
|
const next = trailingFunctionArgument2(arguments);
|
|
6323
6616
|
if (typeof commit !== "string") {
|
|
6324
6617
|
return this._runTask(configurationErrorTask2("Commit must be a string"), next);
|
|
6325
6618
|
}
|
|
6326
|
-
return this._runTask(
|
|
6619
|
+
return this._runTask(
|
|
6620
|
+
straightThroughStringTask2(["revert", ...getTrailingOptions2(arguments, 0, true), commit]),
|
|
6621
|
+
next
|
|
6622
|
+
);
|
|
6327
6623
|
};
|
|
6328
6624
|
Git2.prototype.addTag = function(name) {
|
|
6329
6625
|
const task = typeof name === "string" ? addTagTask2(name) : configurationErrorTask2("Git.addTag requires a tag name");
|
|
6330
6626
|
return this._runTask(task, trailingFunctionArgument2(arguments));
|
|
6331
6627
|
};
|
|
6332
6628
|
Git2.prototype.addAnnotatedTag = function(tagName, tagMessage) {
|
|
6333
|
-
return this._runTask(
|
|
6629
|
+
return this._runTask(
|
|
6630
|
+
addAnnotatedTagTask2(tagName, tagMessage),
|
|
6631
|
+
trailingFunctionArgument2(arguments)
|
|
6632
|
+
);
|
|
6334
6633
|
};
|
|
6335
6634
|
Git2.prototype.deleteLocalBranch = function(branchName, forceDelete, then) {
|
|
6336
|
-
return this._runTask(
|
|
6635
|
+
return this._runTask(
|
|
6636
|
+
deleteBranchTask2(branchName, typeof forceDelete === "boolean" ? forceDelete : false),
|
|
6637
|
+
trailingFunctionArgument2(arguments)
|
|
6638
|
+
);
|
|
6337
6639
|
};
|
|
6338
6640
|
Git2.prototype.deleteLocalBranches = function(branchNames, forceDelete, then) {
|
|
6339
|
-
return this._runTask(
|
|
6641
|
+
return this._runTask(
|
|
6642
|
+
deleteBranchesTask2(branchNames, typeof forceDelete === "boolean" ? forceDelete : false),
|
|
6643
|
+
trailingFunctionArgument2(arguments)
|
|
6644
|
+
);
|
|
6340
6645
|
};
|
|
6341
6646
|
Git2.prototype.branch = function(options, then) {
|
|
6342
|
-
return this._runTask(
|
|
6647
|
+
return this._runTask(
|
|
6648
|
+
branchTask2(getTrailingOptions2(arguments)),
|
|
6649
|
+
trailingFunctionArgument2(arguments)
|
|
6650
|
+
);
|
|
6343
6651
|
};
|
|
6344
6652
|
Git2.prototype.branchLocal = function(then) {
|
|
6345
6653
|
return this._runTask(branchLocalTask2(), trailingFunctionArgument2(arguments));
|
|
@@ -6356,7 +6664,10 @@ var require_git = __commonJS2({
|
|
|
6356
6664
|
command.push(...getTrailingOptions2(arguments, 0, true));
|
|
6357
6665
|
var next = trailingFunctionArgument2(arguments);
|
|
6358
6666
|
if (!command.length) {
|
|
6359
|
-
return this._runTask(
|
|
6667
|
+
return this._runTask(
|
|
6668
|
+
configurationErrorTask2("Raw: must supply one or more command to execute"),
|
|
6669
|
+
next
|
|
6670
|
+
);
|
|
6360
6671
|
}
|
|
6361
6672
|
return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
|
|
6362
6673
|
};
|
|
@@ -6364,19 +6675,34 @@ var require_git = __commonJS2({
|
|
|
6364
6675
|
return this._runTask(addSubModuleTask2(repo, path4), trailingFunctionArgument2(arguments));
|
|
6365
6676
|
};
|
|
6366
6677
|
Git2.prototype.submoduleUpdate = function(args, then) {
|
|
6367
|
-
return this._runTask(
|
|
6678
|
+
return this._runTask(
|
|
6679
|
+
updateSubModuleTask2(getTrailingOptions2(arguments, true)),
|
|
6680
|
+
trailingFunctionArgument2(arguments)
|
|
6681
|
+
);
|
|
6368
6682
|
};
|
|
6369
6683
|
Git2.prototype.submoduleInit = function(args, then) {
|
|
6370
|
-
return this._runTask(
|
|
6684
|
+
return this._runTask(
|
|
6685
|
+
initSubModuleTask2(getTrailingOptions2(arguments, true)),
|
|
6686
|
+
trailingFunctionArgument2(arguments)
|
|
6687
|
+
);
|
|
6371
6688
|
};
|
|
6372
6689
|
Git2.prototype.subModule = function(options, then) {
|
|
6373
|
-
return this._runTask(
|
|
6690
|
+
return this._runTask(
|
|
6691
|
+
subModuleTask2(getTrailingOptions2(arguments)),
|
|
6692
|
+
trailingFunctionArgument2(arguments)
|
|
6693
|
+
);
|
|
6374
6694
|
};
|
|
6375
6695
|
Git2.prototype.listRemote = function() {
|
|
6376
|
-
return this._runTask(
|
|
6696
|
+
return this._runTask(
|
|
6697
|
+
listRemotesTask2(getTrailingOptions2(arguments)),
|
|
6698
|
+
trailingFunctionArgument2(arguments)
|
|
6699
|
+
);
|
|
6377
6700
|
};
|
|
6378
6701
|
Git2.prototype.addRemote = function(remoteName, remoteRepo, then) {
|
|
6379
|
-
return this._runTask(
|
|
6702
|
+
return this._runTask(
|
|
6703
|
+
addRemoteTask2(remoteName, remoteRepo, getTrailingOptions2(arguments)),
|
|
6704
|
+
trailingFunctionArgument2(arguments)
|
|
6705
|
+
);
|
|
6380
6706
|
};
|
|
6381
6707
|
Git2.prototype.removeRemote = function(remoteName, then) {
|
|
6382
6708
|
return this._runTask(removeRemoteTask2(remoteName), trailingFunctionArgument2(arguments));
|
|
@@ -6385,7 +6711,10 @@ var require_git = __commonJS2({
|
|
|
6385
6711
|
return this._runTask(getRemotesTask2(verbose === true), trailingFunctionArgument2(arguments));
|
|
6386
6712
|
};
|
|
6387
6713
|
Git2.prototype.remote = function(options, then) {
|
|
6388
|
-
return this._runTask(
|
|
6714
|
+
return this._runTask(
|
|
6715
|
+
remoteTask2(getTrailingOptions2(arguments)),
|
|
6716
|
+
trailingFunctionArgument2(arguments)
|
|
6717
|
+
);
|
|
6389
6718
|
};
|
|
6390
6719
|
Git2.prototype.tag = function(options, then) {
|
|
6391
6720
|
const command = getTrailingOptions2(arguments);
|
|
@@ -6395,17 +6724,29 @@ var require_git = __commonJS2({
|
|
|
6395
6724
|
return this._runTask(straightThroughStringTask2(command), trailingFunctionArgument2(arguments));
|
|
6396
6725
|
};
|
|
6397
6726
|
Git2.prototype.updateServerInfo = function(then) {
|
|
6398
|
-
return this._runTask(
|
|
6727
|
+
return this._runTask(
|
|
6728
|
+
straightThroughStringTask2(["update-server-info"]),
|
|
6729
|
+
trailingFunctionArgument2(arguments)
|
|
6730
|
+
);
|
|
6399
6731
|
};
|
|
6400
6732
|
Git2.prototype.pushTags = function(remote, then) {
|
|
6401
|
-
const task = pushTagsTask2(
|
|
6733
|
+
const task = pushTagsTask2(
|
|
6734
|
+
{ remote: filterType2(remote, filterString2) },
|
|
6735
|
+
getTrailingOptions2(arguments)
|
|
6736
|
+
);
|
|
6402
6737
|
return this._runTask(task, trailingFunctionArgument2(arguments));
|
|
6403
6738
|
};
|
|
6404
6739
|
Git2.prototype.rm = function(files) {
|
|
6405
|
-
return this._runTask(
|
|
6740
|
+
return this._runTask(
|
|
6741
|
+
straightThroughStringTask2(["rm", "-f", ...asArray2(files)]),
|
|
6742
|
+
trailingFunctionArgument2(arguments)
|
|
6743
|
+
);
|
|
6406
6744
|
};
|
|
6407
6745
|
Git2.prototype.rmKeepLocal = function(files) {
|
|
6408
|
-
return this._runTask(
|
|
6746
|
+
return this._runTask(
|
|
6747
|
+
straightThroughStringTask2(["rm", "--cached", ...asArray2(files)]),
|
|
6748
|
+
trailingFunctionArgument2(arguments)
|
|
6749
|
+
);
|
|
6409
6750
|
};
|
|
6410
6751
|
Git2.prototype.catFile = function(options, then) {
|
|
6411
6752
|
return this._catFile("utf-8", arguments);
|
|
@@ -6418,7 +6759,10 @@ var require_git = __commonJS2({
|
|
|
6418
6759
|
var command = ["cat-file"];
|
|
6419
6760
|
var options = args[0];
|
|
6420
6761
|
if (typeof options === "string") {
|
|
6421
|
-
return this._runTask(
|
|
6762
|
+
return this._runTask(
|
|
6763
|
+
configurationErrorTask2("Git.catFile: options must be supplied as an array of strings"),
|
|
6764
|
+
handler
|
|
6765
|
+
);
|
|
6422
6766
|
}
|
|
6423
6767
|
if (Array.isArray(options)) {
|
|
6424
6768
|
command.push.apply(command, options);
|
|
@@ -6427,25 +6771,38 @@ var require_git = __commonJS2({
|
|
|
6427
6771
|
return this._runTask(task, handler);
|
|
6428
6772
|
};
|
|
6429
6773
|
Git2.prototype.diff = function(options, then) {
|
|
6430
|
-
const task = filterString2(options) ? configurationErrorTask2(
|
|
6774
|
+
const task = filterString2(options) ? configurationErrorTask2(
|
|
6775
|
+
"git.diff: supplying options as a single string is no longer supported, switch to an array of strings"
|
|
6776
|
+
) : straightThroughStringTask2(["diff", ...getTrailingOptions2(arguments)]);
|
|
6431
6777
|
return this._runTask(task, trailingFunctionArgument2(arguments));
|
|
6432
6778
|
};
|
|
6433
6779
|
Git2.prototype.diffSummary = function() {
|
|
6434
|
-
return this._runTask(
|
|
6780
|
+
return this._runTask(
|
|
6781
|
+
diffSummaryTask2(getTrailingOptions2(arguments, 1)),
|
|
6782
|
+
trailingFunctionArgument2(arguments)
|
|
6783
|
+
);
|
|
6435
6784
|
};
|
|
6436
6785
|
Git2.prototype.applyPatch = function(patches) {
|
|
6437
|
-
const task = !filterStringOrStringArray2(patches) ? configurationErrorTask2(
|
|
6786
|
+
const task = !filterStringOrStringArray2(patches) ? configurationErrorTask2(
|
|
6787
|
+
`git.applyPatch requires one or more string patches as the first argument`
|
|
6788
|
+
) : applyPatchTask2(asArray2(patches), getTrailingOptions2([].slice.call(arguments, 1)));
|
|
6438
6789
|
return this._runTask(task, trailingFunctionArgument2(arguments));
|
|
6439
6790
|
};
|
|
6440
6791
|
Git2.prototype.revparse = function() {
|
|
6441
6792
|
const commands = ["rev-parse", ...getTrailingOptions2(arguments, true)];
|
|
6442
|
-
return this._runTask(
|
|
6793
|
+
return this._runTask(
|
|
6794
|
+
straightThroughStringTask2(commands, true),
|
|
6795
|
+
trailingFunctionArgument2(arguments)
|
|
6796
|
+
);
|
|
6443
6797
|
};
|
|
6444
6798
|
Git2.prototype.clean = function(mode, options, then) {
|
|
6445
6799
|
const usingCleanOptionsArray = isCleanOptionsArray2(mode);
|
|
6446
6800
|
const cleanMode = usingCleanOptionsArray && mode.join("") || filterType2(mode, filterString2) || "";
|
|
6447
6801
|
const customArgs = getTrailingOptions2([].slice.call(arguments, usingCleanOptionsArray ? 1 : 0));
|
|
6448
|
-
return this._runTask(
|
|
6802
|
+
return this._runTask(
|
|
6803
|
+
cleanWithOptionsTask2(cleanMode, customArgs),
|
|
6804
|
+
trailingFunctionArgument2(arguments)
|
|
6805
|
+
);
|
|
6449
6806
|
};
|
|
6450
6807
|
Git2.prototype.exec = function(then) {
|
|
6451
6808
|
const task = {
|
|
@@ -6463,10 +6820,16 @@ var require_git = __commonJS2({
|
|
|
6463
6820
|
return this;
|
|
6464
6821
|
};
|
|
6465
6822
|
Git2.prototype.checkIgnore = function(pathnames, then) {
|
|
6466
|
-
return this._runTask(
|
|
6823
|
+
return this._runTask(
|
|
6824
|
+
checkIgnoreTask2(asArray2(filterType2(pathnames, filterStringOrStringArray2, []))),
|
|
6825
|
+
trailingFunctionArgument2(arguments)
|
|
6826
|
+
);
|
|
6467
6827
|
};
|
|
6468
6828
|
Git2.prototype.checkIsRepo = function(checkType, then) {
|
|
6469
|
-
return this._runTask(
|
|
6829
|
+
return this._runTask(
|
|
6830
|
+
checkIsRepoTask2(filterType2(checkType, filterString2)),
|
|
6831
|
+
trailingFunctionArgument2(arguments)
|
|
6832
|
+
);
|
|
6470
6833
|
};
|
|
6471
6834
|
module.exports = Git2;
|
|
6472
6835
|
}
|
|
@@ -6531,17 +6894,33 @@ function preventProtocolOverride(arg, next) {
|
|
|
6531
6894
|
if (!/^\s*protocol(.[a-z]+)?.allow/.test(next)) {
|
|
6532
6895
|
return;
|
|
6533
6896
|
}
|
|
6534
|
-
throw new GitPluginError(
|
|
6897
|
+
throw new GitPluginError(
|
|
6898
|
+
void 0,
|
|
6899
|
+
"unsafe",
|
|
6900
|
+
"Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol"
|
|
6901
|
+
);
|
|
6535
6902
|
}
|
|
6536
6903
|
function preventUploadPack(arg, method) {
|
|
6537
6904
|
if (/^\s*--(upload|receive)-pack/.test(arg)) {
|
|
6538
|
-
throw new GitPluginError(
|
|
6905
|
+
throw new GitPluginError(
|
|
6906
|
+
void 0,
|
|
6907
|
+
"unsafe",
|
|
6908
|
+
`Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack`
|
|
6909
|
+
);
|
|
6539
6910
|
}
|
|
6540
6911
|
if (method === "clone" && /^\s*-u\b/.test(arg)) {
|
|
6541
|
-
throw new GitPluginError(
|
|
6912
|
+
throw new GitPluginError(
|
|
6913
|
+
void 0,
|
|
6914
|
+
"unsafe",
|
|
6915
|
+
`Use of clone with option -u is not permitted without enabling allowUnsafePack`
|
|
6916
|
+
);
|
|
6542
6917
|
}
|
|
6543
6918
|
if (method === "push" && /^\s*--exec\b/.test(arg)) {
|
|
6544
|
-
throw new GitPluginError(
|
|
6919
|
+
throw new GitPluginError(
|
|
6920
|
+
void 0,
|
|
6921
|
+
"unsafe",
|
|
6922
|
+
`Use of push with option --exec is not permitted without enabling allowUnsafePack`
|
|
6923
|
+
);
|
|
6545
6924
|
}
|
|
6546
6925
|
}
|
|
6547
6926
|
function blockUnsafeOperationsPlugin({
|
|
@@ -6613,30 +6992,63 @@ function completionDetectionPlugin({
|
|
|
6613
6992
|
}
|
|
6614
6993
|
return {
|
|
6615
6994
|
type: "spawn.after",
|
|
6616
|
-
action(
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
if (deferClose) {
|
|
6630
|
-
yield delay(50);
|
|
6631
|
-
}
|
|
6632
|
-
close(events.exitCode);
|
|
6633
|
-
} catch (err) {
|
|
6634
|
-
close(events.exitCode, err);
|
|
6995
|
+
async action(_data, { spawned, close }) {
|
|
6996
|
+
const events = createEvents();
|
|
6997
|
+
let deferClose = true;
|
|
6998
|
+
let quickClose = () => void (deferClose = false);
|
|
6999
|
+
spawned.stdout?.on("data", quickClose);
|
|
7000
|
+
spawned.stderr?.on("data", quickClose);
|
|
7001
|
+
spawned.on("error", quickClose);
|
|
7002
|
+
spawned.on("close", (code) => events.close(code));
|
|
7003
|
+
spawned.on("exit", (code) => events.exit(code));
|
|
7004
|
+
try {
|
|
7005
|
+
await events.result;
|
|
7006
|
+
if (deferClose) {
|
|
7007
|
+
await delay(50);
|
|
6635
7008
|
}
|
|
6636
|
-
|
|
7009
|
+
close(events.exitCode);
|
|
7010
|
+
} catch (err) {
|
|
7011
|
+
close(events.exitCode, err);
|
|
7012
|
+
}
|
|
7013
|
+
}
|
|
7014
|
+
};
|
|
7015
|
+
}
|
|
7016
|
+
init_utils();
|
|
7017
|
+
var WRONG_NUMBER_ERR = `Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings`;
|
|
7018
|
+
var WRONG_CHARS_ERR = `Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option`;
|
|
7019
|
+
function isBadArgument(arg) {
|
|
7020
|
+
return !arg || !/^([a-z]:)?([a-z0-9/.\\_-]+)$/i.test(arg);
|
|
7021
|
+
}
|
|
7022
|
+
function toBinaryConfig(input, allowUnsafe) {
|
|
7023
|
+
if (input.length < 1 || input.length > 2) {
|
|
7024
|
+
throw new GitPluginError(void 0, "binary", WRONG_NUMBER_ERR);
|
|
7025
|
+
}
|
|
7026
|
+
const isBad = input.some(isBadArgument);
|
|
7027
|
+
if (isBad) {
|
|
7028
|
+
if (allowUnsafe) {
|
|
7029
|
+
console.warn(WRONG_CHARS_ERR);
|
|
7030
|
+
} else {
|
|
7031
|
+
throw new GitPluginError(void 0, "binary", WRONG_CHARS_ERR);
|
|
6637
7032
|
}
|
|
7033
|
+
}
|
|
7034
|
+
const [binary, prefix] = input;
|
|
7035
|
+
return {
|
|
7036
|
+
binary,
|
|
7037
|
+
prefix
|
|
6638
7038
|
};
|
|
6639
7039
|
}
|
|
7040
|
+
function customBinaryPlugin(plugins, input = ["git"], allowUnsafe = false) {
|
|
7041
|
+
let config = toBinaryConfig(asArray(input), allowUnsafe);
|
|
7042
|
+
plugins.on("binary", (input2) => {
|
|
7043
|
+
config = toBinaryConfig(asArray(input2), allowUnsafe);
|
|
7044
|
+
});
|
|
7045
|
+
plugins.append("spawn.binary", () => {
|
|
7046
|
+
return config.binary;
|
|
7047
|
+
});
|
|
7048
|
+
plugins.append("spawn.args", (data) => {
|
|
7049
|
+
return config.prefix ? [config.prefix, ...data] : data;
|
|
7050
|
+
});
|
|
7051
|
+
}
|
|
6640
7052
|
init_git_error();
|
|
6641
7053
|
function isTaskError(result) {
|
|
6642
7054
|
return !!(result.exitCode && result.stdErr.length);
|
|
@@ -6674,6 +7086,17 @@ init_utils();
|
|
|
6674
7086
|
var PluginStore = class {
|
|
6675
7087
|
constructor() {
|
|
6676
7088
|
this.plugins = /* @__PURE__ */ new Set();
|
|
7089
|
+
this.events = new EventEmitter();
|
|
7090
|
+
}
|
|
7091
|
+
on(type, listener) {
|
|
7092
|
+
this.events.on(type, listener);
|
|
7093
|
+
}
|
|
7094
|
+
reconfigure(type, data) {
|
|
7095
|
+
this.events.emit(type, data);
|
|
7096
|
+
}
|
|
7097
|
+
append(type, action) {
|
|
7098
|
+
const plugin = append(this.plugins, { type, action });
|
|
7099
|
+
return () => this.plugins.delete(plugin);
|
|
6677
7100
|
}
|
|
6678
7101
|
add(plugin) {
|
|
6679
7102
|
const plugins = [];
|
|
@@ -6700,11 +7123,10 @@ function progressMonitorPlugin(progress) {
|
|
|
6700
7123
|
const onProgress = {
|
|
6701
7124
|
type: "spawn.after",
|
|
6702
7125
|
action(_data, context) {
|
|
6703
|
-
var _a2;
|
|
6704
7126
|
if (!context.commands.includes(progressCommand)) {
|
|
6705
7127
|
return;
|
|
6706
7128
|
}
|
|
6707
|
-
|
|
7129
|
+
context.spawned.stderr?.on("data", (chunk) => {
|
|
6708
7130
|
const message = /^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(chunk.toString("utf8"));
|
|
6709
7131
|
if (!message) {
|
|
6710
7132
|
return;
|
|
@@ -6739,7 +7161,7 @@ function spawnOptionsPlugin(spawnOptions) {
|
|
|
6739
7161
|
return {
|
|
6740
7162
|
type: "spawn.options",
|
|
6741
7163
|
action(data) {
|
|
6742
|
-
return
|
|
7164
|
+
return { ...options, ...data };
|
|
6743
7165
|
}
|
|
6744
7166
|
};
|
|
6745
7167
|
}
|
|
@@ -6752,16 +7174,14 @@ function timeoutPlugin({
|
|
|
6752
7174
|
return {
|
|
6753
7175
|
type: "spawn.after",
|
|
6754
7176
|
action(_data, context) {
|
|
6755
|
-
var _a2, _b;
|
|
6756
7177
|
let timeout;
|
|
6757
7178
|
function wait() {
|
|
6758
7179
|
timeout && clearTimeout(timeout);
|
|
6759
7180
|
timeout = setTimeout(kill, block);
|
|
6760
7181
|
}
|
|
6761
7182
|
function stop() {
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
(_b2 = context.spawned.stderr) == null ? void 0 : _b2.off("data", wait);
|
|
7183
|
+
context.spawned.stdout?.off("data", wait);
|
|
7184
|
+
context.spawned.stderr?.off("data", wait);
|
|
6765
7185
|
context.spawned.off("exit", stop);
|
|
6766
7186
|
context.spawned.off("close", stop);
|
|
6767
7187
|
timeout && clearTimeout(timeout);
|
|
@@ -6770,8 +7190,8 @@ function timeoutPlugin({
|
|
|
6770
7190
|
stop();
|
|
6771
7191
|
context.kill(new GitPluginError(void 0, "timeout", `block timeout reached`));
|
|
6772
7192
|
}
|
|
6773
|
-
stdOut &&
|
|
6774
|
-
stdErr &&
|
|
7193
|
+
stdOut && context.spawned.stdout?.on("data", wait);
|
|
7194
|
+
stdErr && context.spawned.stderr?.on("data", wait);
|
|
6775
7195
|
context.spawned.on("exit", stop);
|
|
6776
7196
|
context.spawned.on("close", stop);
|
|
6777
7197
|
wait();
|
|
@@ -6796,7 +7216,9 @@ function suffixPathsPlugin() {
|
|
|
6796
7216
|
continue;
|
|
6797
7217
|
}
|
|
6798
7218
|
if (param === "--") {
|
|
6799
|
-
append2(
|
|
7219
|
+
append2(
|
|
7220
|
+
data.slice(i + 1).flatMap((item) => isPathSpec(item) && toPaths(item) || item)
|
|
7221
|
+
);
|
|
6800
7222
|
break;
|
|
6801
7223
|
}
|
|
6802
7224
|
prefix.push(param);
|
|
@@ -6809,9 +7231,15 @@ init_utils();
|
|
|
6809
7231
|
var Git = require_git();
|
|
6810
7232
|
function gitInstanceFactory(baseDir, options) {
|
|
6811
7233
|
const plugins = new PluginStore();
|
|
6812
|
-
const config = createInstanceConfig(
|
|
7234
|
+
const config = createInstanceConfig(
|
|
7235
|
+
baseDir && (typeof baseDir === "string" ? { baseDir } : baseDir) || {},
|
|
7236
|
+
options
|
|
7237
|
+
);
|
|
6813
7238
|
if (!folderExists(config.baseDir)) {
|
|
6814
|
-
throw new GitConstructError(
|
|
7239
|
+
throw new GitConstructError(
|
|
7240
|
+
config,
|
|
7241
|
+
`Cannot use simple-git on a directory that does not exist`
|
|
7242
|
+
);
|
|
6815
7243
|
}
|
|
6816
7244
|
if (Array.isArray(config.config)) {
|
|
6817
7245
|
plugins.add(commandConfigPrefixingPlugin(config.config));
|
|
@@ -6825,248 +7253,52 @@ function gitInstanceFactory(baseDir, options) {
|
|
|
6825
7253
|
config.spawnOptions && plugins.add(spawnOptionsPlugin(config.spawnOptions));
|
|
6826
7254
|
plugins.add(errorDetectionPlugin(errorDetectionHandler(true)));
|
|
6827
7255
|
config.errors && plugins.add(errorDetectionPlugin(config.errors));
|
|
7256
|
+
customBinaryPlugin(plugins, config.binary, config.unsafe?.allowUnsafeCustomBinary);
|
|
6828
7257
|
return new Git(config, plugins);
|
|
6829
7258
|
}
|
|
6830
7259
|
init_git_response_error();
|
|
6831
7260
|
var esm_default = gitInstanceFactory;
|
|
6832
7261
|
|
|
6833
|
-
//
|
|
6834
|
-
|
|
6835
|
-
|
|
6836
|
-
|
|
6837
|
-
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
var
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
|
|
6845
|
-
|
|
6846
|
-
|
|
6847
|
-
|
|
6848
|
-
|
|
6849
|
-
|
|
6850
|
-
|
|
6851
|
-
}
|
|
6852
|
-
|
|
6853
|
-
|
|
6854
|
-
|
|
6855
|
-
|
|
6856
|
-
|
|
7262
|
+
// git.ts
|
|
7263
|
+
var fse = __toESM(require_lib());
|
|
7264
|
+
var log = debug2("cna:git");
|
|
7265
|
+
var filterGit = (src) => {
|
|
7266
|
+
return !/(\\|\/)\.git\b/.test(src);
|
|
7267
|
+
};
|
|
7268
|
+
var gitOperationMap = /* @__PURE__ */ new Map();
|
|
7269
|
+
var completedTargetIds = /* @__PURE__ */ new Map();
|
|
7270
|
+
var downloadRepository = async ({
|
|
7271
|
+
url = "",
|
|
7272
|
+
offline = false,
|
|
7273
|
+
target = "./",
|
|
7274
|
+
branch = "main",
|
|
7275
|
+
targetId,
|
|
7276
|
+
cacheDir: optsCacheDir
|
|
7277
|
+
}) => {
|
|
7278
|
+
const absoluteTarget = path.isAbsolute(target) ? target : path.resolve(target);
|
|
7279
|
+
const isGithub = /^[^/]+\/[^/]+$/.test(url);
|
|
7280
|
+
const gitUrl = isGithub ? `https://github.com/${url}` : url;
|
|
7281
|
+
const id = targetId || Buffer.from(`${gitUrl}@${branch}`).toString("base64");
|
|
7282
|
+
let cacheDir = optsCacheDir || path.join(os.homedir(), ".cache", "cna", id);
|
|
7283
|
+
cacheDir = path.isAbsolute(cacheDir) ? cacheDir : path.resolve(cacheDir);
|
|
7284
|
+
log("cache folder: %s", cacheDir);
|
|
7285
|
+
if (completedTargetIds.has(id)) {
|
|
7286
|
+
log(
|
|
7287
|
+
`Git checkout for target ID '${id}' has already been completed. Skipping.`
|
|
6857
7288
|
);
|
|
6858
|
-
|
|
7289
|
+
await fse.copy(cacheDir, absoluteTarget, {
|
|
7290
|
+
overwrite: true,
|
|
7291
|
+
filter: filterGit
|
|
7292
|
+
});
|
|
7293
|
+
return;
|
|
6859
7294
|
}
|
|
6860
|
-
|
|
6861
|
-
|
|
6862
|
-
|
|
6863
|
-
const { hasMinPnpm, pnpmVersion } = checkPnpmVersion();
|
|
6864
|
-
if (!hasMinPnpm) {
|
|
6865
|
-
console.log(
|
|
6866
|
-
chalk.yellow(
|
|
6867
|
-
`You are using pnpm version ${chalk.bold(
|
|
6868
|
-
pnpmVersion
|
|
6869
|
-
)} which is not supported yet. To use pnpm, install v5.0.0 or higher. See https://pnpm.js.org for instructions on how to update.`
|
|
6870
|
-
)
|
|
7295
|
+
if (gitOperationMap.has(id)) {
|
|
7296
|
+
log(
|
|
7297
|
+
`Git operation for target ID '${id}' is already in progress. Waiting...`
|
|
6871
7298
|
);
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
|
|
6875
|
-
};
|
|
6876
|
-
var checkThatNpmCanReadCwd = () => {
|
|
6877
|
-
const cwd = process.cwd();
|
|
6878
|
-
let childOutput = null;
|
|
6879
|
-
try {
|
|
6880
|
-
childOutput = spawn2.sync("npm", ["config", "list"]).output.join("");
|
|
6881
|
-
} catch (err) {
|
|
6882
|
-
return true;
|
|
6883
|
-
}
|
|
6884
|
-
if (typeof childOutput !== "string") {
|
|
6885
|
-
return true;
|
|
6886
|
-
}
|
|
6887
|
-
const lines = childOutput.split("\n");
|
|
6888
|
-
const prefix = "; cwd = ";
|
|
6889
|
-
const line = lines.find((line2) => line2.startsWith(prefix));
|
|
6890
|
-
if (typeof line !== "string") {
|
|
6891
|
-
return true;
|
|
6892
|
-
}
|
|
6893
|
-
const npmCWD = line.substring(prefix.length);
|
|
6894
|
-
if (npmCWD === cwd) {
|
|
6895
|
-
return true;
|
|
6896
|
-
}
|
|
6897
|
-
console.error(
|
|
6898
|
-
chalk.red(
|
|
6899
|
-
`Could not start an npm process in the right directory.
|
|
6900
|
-
|
|
6901
|
-
The current directory is: ${chalk.bold(cwd)}
|
|
6902
|
-
However, a newly started npm process runs in: ${chalk.bold(
|
|
6903
|
-
npmCWD
|
|
6904
|
-
)}
|
|
6905
|
-
|
|
6906
|
-
This is probably caused by a misconfigured system terminal shell.`
|
|
6907
|
-
)
|
|
6908
|
-
);
|
|
6909
|
-
if (process.platform === "win32") {
|
|
6910
|
-
console.error(
|
|
6911
|
-
chalk.red(`On Windows, this can usually be fixed by running:
|
|
6912
|
-
|
|
6913
|
-
`) + ` ${chalk.cyan(
|
|
6914
|
-
"reg"
|
|
6915
|
-
)} delete "HKCU\\Software\\Microsoft\\Command Processor" /v AutoRun /f
|
|
6916
|
-
${chalk.cyan(
|
|
6917
|
-
"reg"
|
|
6918
|
-
)} delete "HKLM\\Software\\Microsoft\\Command Processor" /v AutoRun /f
|
|
6919
|
-
|
|
6920
|
-
` + chalk.red(`Try to run the above two lines in the terminal.
|
|
6921
|
-
`) + chalk.red(
|
|
6922
|
-
`To learn more about this problem, read: https://blogs.msdn.microsoft.com/oldnewthing/20071121-00/?p=24433/`
|
|
6923
|
-
)
|
|
6924
|
-
);
|
|
6925
|
-
}
|
|
6926
|
-
return false;
|
|
6927
|
-
};
|
|
6928
|
-
var checkPnpmVersion = () => {
|
|
6929
|
-
const minPnpm = "5.0.0";
|
|
6930
|
-
let hasMinPnpm = false;
|
|
6931
|
-
let pnpmVersion = null;
|
|
6932
|
-
try {
|
|
6933
|
-
pnpmVersion = execSync("pnpm --version").toString().trim();
|
|
6934
|
-
if (semver.valid(pnpmVersion)) {
|
|
6935
|
-
hasMinPnpm = semver.gte(pnpmVersion, minPnpm);
|
|
6936
|
-
} else {
|
|
6937
|
-
const trimmedPnpmVersionMatch = /^(.+?)[-+].+$/.exec(pnpmVersion);
|
|
6938
|
-
if (trimmedPnpmVersionMatch) {
|
|
6939
|
-
hasMinPnpm = semver.gte(trimmedPnpmVersionMatch[1], minPnpm);
|
|
6940
|
-
}
|
|
6941
|
-
}
|
|
6942
|
-
} catch (e) {
|
|
6943
|
-
}
|
|
6944
|
-
return { hasMinPnpm, pnpmVersion };
|
|
6945
|
-
};
|
|
6946
|
-
var checkYarnVersion = () => {
|
|
6947
|
-
const minYarnPnp = "1.12.0";
|
|
6948
|
-
const maxYarnPnp = "2.0.0";
|
|
6949
|
-
let hasMinYarnPnp = false;
|
|
6950
|
-
let hasMaxYarnPnp = false;
|
|
6951
|
-
let yarnVersion = null;
|
|
6952
|
-
try {
|
|
6953
|
-
yarnVersion = execSync("yarnpkg --version").toString().trim();
|
|
6954
|
-
if (semver.valid(yarnVersion)) {
|
|
6955
|
-
hasMinYarnPnp = semver.gte(yarnVersion, minYarnPnp);
|
|
6956
|
-
hasMaxYarnPnp = semver.lt(yarnVersion, maxYarnPnp);
|
|
6957
|
-
} else {
|
|
6958
|
-
const trimmedYarnVersionMatch = /^(.+?)[-+].+$/.exec(yarnVersion);
|
|
6959
|
-
if (trimmedYarnVersionMatch) {
|
|
6960
|
-
const trimmedYarnVersion = trimmedYarnVersionMatch.pop();
|
|
6961
|
-
if (trimmedYarnVersion) {
|
|
6962
|
-
hasMinYarnPnp = semver.gte(trimmedYarnVersion, minYarnPnp);
|
|
6963
|
-
hasMaxYarnPnp = semver.lt(trimmedYarnVersion, maxYarnPnp);
|
|
6964
|
-
}
|
|
6965
|
-
}
|
|
6966
|
-
}
|
|
6967
|
-
} catch (err) {
|
|
6968
|
-
}
|
|
6969
|
-
return {
|
|
6970
|
-
hasMinYarnPnp,
|
|
6971
|
-
hasMaxYarnPnp,
|
|
6972
|
-
yarnVersion
|
|
6973
|
-
};
|
|
6974
|
-
};
|
|
6975
|
-
var checkNpmVersion = () => {
|
|
6976
|
-
let hasMinNpm = false;
|
|
6977
|
-
let npmVersion = null;
|
|
6978
|
-
try {
|
|
6979
|
-
npmVersion = execSync("npm --version").toString().trim();
|
|
6980
|
-
hasMinNpm = semver.gte(npmVersion, "6.0.0");
|
|
6981
|
-
} catch (err) {
|
|
6982
|
-
}
|
|
6983
|
-
return {
|
|
6984
|
-
hasMinNpm,
|
|
6985
|
-
npmVersion
|
|
6986
|
-
};
|
|
6987
|
-
};
|
|
6988
|
-
var getProxy = () => {
|
|
6989
|
-
if (process.env.HTTPS_PROXY) {
|
|
6990
|
-
return process.env.HTTPS_PROXY;
|
|
6991
|
-
}
|
|
6992
|
-
try {
|
|
6993
|
-
const httpsProxy = execSync("npm config get https-proxy").toString().trim();
|
|
6994
|
-
return httpsProxy !== "null" ? httpsProxy : void 0;
|
|
6995
|
-
} catch (e) {
|
|
6996
|
-
}
|
|
6997
|
-
return "";
|
|
6998
|
-
};
|
|
6999
|
-
var checkIfOnline = (useYarn) => {
|
|
7000
|
-
if (!useYarn) {
|
|
7001
|
-
return Promise.resolve(true);
|
|
7002
|
-
}
|
|
7003
|
-
return new Promise((resolve) => {
|
|
7004
|
-
dns.lookup("registry.yarnpkg.com", (err) => {
|
|
7005
|
-
let proxy;
|
|
7006
|
-
if (err != null && (proxy = getProxy())) {
|
|
7007
|
-
dns.lookup(new URL2(proxy).hostname, (proxyErr) => {
|
|
7008
|
-
resolve(!proxyErr);
|
|
7009
|
-
});
|
|
7010
|
-
} else {
|
|
7011
|
-
resolve(!err);
|
|
7012
|
-
}
|
|
7013
|
-
});
|
|
7014
|
-
});
|
|
7015
|
-
};
|
|
7016
|
-
|
|
7017
|
-
// package.ts
|
|
7018
|
-
import { existsSync } from "fs";
|
|
7019
|
-
import merge from "lodash.merge";
|
|
7020
|
-
|
|
7021
|
-
// paths.ts
|
|
7022
|
-
import fs2 from "fs";
|
|
7023
|
-
import os2 from "os";
|
|
7024
|
-
import path2 from "path";
|
|
7025
|
-
|
|
7026
|
-
// git.ts
|
|
7027
|
-
import os from "os";
|
|
7028
|
-
import path from "path";
|
|
7029
|
-
import fs from "fs";
|
|
7030
|
-
import debug2 from "debug";
|
|
7031
|
-
var fse = __toESM(require_lib());
|
|
7032
|
-
var log = debug2("cna:git");
|
|
7033
|
-
var filterGit = (src) => {
|
|
7034
|
-
return !/(\\|\/)\.git\b/.test(src);
|
|
7035
|
-
};
|
|
7036
|
-
var gitOperationMap = /* @__PURE__ */ new Map();
|
|
7037
|
-
var completedTargetIds = /* @__PURE__ */ new Map();
|
|
7038
|
-
var downloadRepository = async ({
|
|
7039
|
-
url = "",
|
|
7040
|
-
offline = false,
|
|
7041
|
-
target = "./",
|
|
7042
|
-
branch = "main",
|
|
7043
|
-
targetId,
|
|
7044
|
-
cacheDir: optsCacheDir
|
|
7045
|
-
}) => {
|
|
7046
|
-
const absoluteTarget = path.isAbsolute(target) ? target : path.resolve(target);
|
|
7047
|
-
const isGithub = /^[^/]+\/[^/]+$/.test(url);
|
|
7048
|
-
const gitUrl = isGithub ? `https://github.com/${url}` : url;
|
|
7049
|
-
const id = targetId || Buffer.from(`${gitUrl}@${branch}`).toString("base64");
|
|
7050
|
-
let cacheDir = optsCacheDir || path.join(os.homedir(), ".cache", "cna", id);
|
|
7051
|
-
cacheDir = path.isAbsolute(cacheDir) ? cacheDir : path.resolve(cacheDir);
|
|
7052
|
-
log("cache folder: %s", cacheDir);
|
|
7053
|
-
if (completedTargetIds.has(id)) {
|
|
7054
|
-
log(
|
|
7055
|
-
`Git checkout for target ID '${id}' has already been completed. Skipping.`
|
|
7056
|
-
);
|
|
7057
|
-
await fse.copy(cacheDir, absoluteTarget, {
|
|
7058
|
-
overwrite: true,
|
|
7059
|
-
filter: filterGit
|
|
7060
|
-
});
|
|
7061
|
-
return;
|
|
7062
|
-
}
|
|
7063
|
-
if (gitOperationMap.has(id)) {
|
|
7064
|
-
log(
|
|
7065
|
-
`Git operation for target ID '${id}' is already in progress. Waiting...`
|
|
7066
|
-
);
|
|
7067
|
-
await gitOperationMap.get(id);
|
|
7068
|
-
log(`Git operation for target ID '${id}' has completed.`);
|
|
7069
|
-
return;
|
|
7299
|
+
await gitOperationMap.get(id);
|
|
7300
|
+
log(`Git operation for target ID '${id}' has completed.`);
|
|
7301
|
+
return;
|
|
7070
7302
|
}
|
|
7071
7303
|
const gitOperationPromise = (async () => {
|
|
7072
7304
|
let git = esm_default();
|
|
@@ -7203,136 +7435,49 @@ var getTemplateDirPath = async (templateOrExtensionUrl) => {
|
|
|
7203
7435
|
});
|
|
7204
7436
|
};
|
|
7205
7437
|
|
|
7206
|
-
//
|
|
7207
|
-
|
|
7208
|
-
|
|
7209
|
-
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
|
|
7213
|
-
|
|
7214
|
-
|
|
7215
|
-
|
|
7216
|
-
|
|
7217
|
-
};
|
|
7438
|
+
// loaders.ts
|
|
7439
|
+
import { promisify } from "util";
|
|
7440
|
+
var writeFileAsync = promisify(fs3.writeFile);
|
|
7441
|
+
var copyFileAsync = promisify(fs3.copyFile);
|
|
7442
|
+
var SRC_PATH_PATTERN = "[src]/";
|
|
7443
|
+
var DEFAULT_SRC_PATH = "src/";
|
|
7444
|
+
var getSrcDirPattern = (srcDir) => srcDir === "." ? "" : srcDir + "/";
|
|
7445
|
+
var makeDirectory = (dirPath) => {
|
|
7446
|
+
if (!fs3.existsSync(dirPath)) {
|
|
7447
|
+
fs3.mkdirSync(dirPath, { recursive: true });
|
|
7448
|
+
}
|
|
7218
7449
|
};
|
|
7219
|
-
var
|
|
7220
|
-
|
|
7221
|
-
|
|
7450
|
+
var getModeFromPath = (path4 = "") => {
|
|
7451
|
+
const matchExts = (...exts) => exts.find((ext) => path4.endsWith(ext));
|
|
7452
|
+
if (matchExts(".append")) {
|
|
7453
|
+
return "append";
|
|
7222
7454
|
}
|
|
7223
|
-
|
|
7455
|
+
if (matchExts(".append.template", ".template.append")) {
|
|
7456
|
+
return "appendTemplate";
|
|
7457
|
+
}
|
|
7458
|
+
if (matchExts(".template")) {
|
|
7459
|
+
return "copyTemplate";
|
|
7460
|
+
}
|
|
7461
|
+
return "copy";
|
|
7224
7462
|
};
|
|
7225
|
-
var
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
|
|
7231
|
-
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7235
|
-
);
|
|
7236
|
-
return template.package || {};
|
|
7237
|
-
} catch {
|
|
7238
|
-
return {};
|
|
7239
|
-
}
|
|
7240
|
-
})
|
|
7241
|
-
);
|
|
7242
|
-
const mergedSetup = merge(
|
|
7243
|
-
{
|
|
7244
|
-
name: config.appName,
|
|
7245
|
-
dependencies: {},
|
|
7246
|
-
devDependencies: {},
|
|
7247
|
-
scripts: {}
|
|
7248
|
-
},
|
|
7249
|
-
...setup
|
|
7250
|
-
);
|
|
7251
|
-
const finalSetup = await Promise.all(
|
|
7252
|
-
templatesOrExtensions.map(
|
|
7253
|
-
async ({ url: templateOrExtension, ignorePackage }) => {
|
|
7254
|
-
try {
|
|
7255
|
-
const templateOrExtensionPackageJson = requireIfExists(
|
|
7256
|
-
await getPackagePath(
|
|
7257
|
-
templateOrExtension,
|
|
7258
|
-
"package.json",
|
|
7259
|
-
globalIgnorePackage || ignorePackage
|
|
7260
|
-
)
|
|
7261
|
-
);
|
|
7262
|
-
return templateOrExtensionPackageJson;
|
|
7263
|
-
} catch {
|
|
7264
|
-
return {};
|
|
7265
|
-
}
|
|
7266
|
-
}
|
|
7267
|
-
)
|
|
7268
|
-
);
|
|
7269
|
-
const resolvedSetup = await Promise.all(
|
|
7270
|
-
templatesOrExtensions.map(async ({ url: templateOrExtension }) => {
|
|
7271
|
-
try {
|
|
7272
|
-
const resolveTemplateOrExtensionPackage = requireIfExists(
|
|
7273
|
-
await getPackagePath(templateOrExtension)
|
|
7274
|
-
);
|
|
7275
|
-
return resolveTemplateOrExtensionPackage(mergedSetup, config);
|
|
7276
|
-
} catch {
|
|
7277
|
-
return {};
|
|
7278
|
-
}
|
|
7279
|
-
})
|
|
7280
|
-
);
|
|
7281
|
-
const packageJson = merge(mergedSetup, ...finalSetup, ...resolvedSetup);
|
|
7282
|
-
return getInstallableSetup({
|
|
7283
|
-
...packageJson,
|
|
7284
|
-
name: config.appName
|
|
7285
|
-
});
|
|
7286
|
-
};
|
|
7287
|
-
|
|
7288
|
-
// loaders.ts
|
|
7289
|
-
import _ from "underscore";
|
|
7290
|
-
import fs3 from "fs";
|
|
7291
|
-
import chalk2 from "chalk";
|
|
7292
|
-
import readdirp from "readdirp";
|
|
7293
|
-
import { dirname } from "path";
|
|
7294
|
-
import { promisify } from "util";
|
|
7295
|
-
var writeFileAsync = promisify(fs3.writeFile);
|
|
7296
|
-
var copyFileAsync = promisify(fs3.copyFile);
|
|
7297
|
-
var SRC_PATH_PATTERN = "[src]/";
|
|
7298
|
-
var DEFAULT_SRC_PATH = "src/";
|
|
7299
|
-
var getSrcDirPattern = (srcDir) => srcDir === "." ? "" : srcDir + "/";
|
|
7300
|
-
var makeDirectory = (dirPath) => {
|
|
7301
|
-
if (!fs3.existsSync(dirPath)) {
|
|
7302
|
-
fs3.mkdirSync(dirPath, { recursive: true });
|
|
7303
|
-
}
|
|
7304
|
-
};
|
|
7305
|
-
var getModeFromPath = (path4 = "") => {
|
|
7306
|
-
const matchExts = (...exts) => exts.find((ext) => path4.endsWith(ext));
|
|
7307
|
-
if (matchExts(".append")) {
|
|
7308
|
-
return "append";
|
|
7309
|
-
}
|
|
7310
|
-
if (matchExts(".append.template", ".template.append")) {
|
|
7311
|
-
return "appendTemplate";
|
|
7312
|
-
}
|
|
7313
|
-
if (matchExts(".template")) {
|
|
7314
|
-
return "copyTemplate";
|
|
7315
|
-
}
|
|
7316
|
-
return "copy";
|
|
7317
|
-
};
|
|
7318
|
-
var batchedCopyFiles = async (operations) => {
|
|
7319
|
-
const batchedPromises = operations.map(async (operation) => {
|
|
7320
|
-
try {
|
|
7321
|
-
makeDirectory(dirname(operation.dest));
|
|
7322
|
-
await copyFileAsync(operation.src, operation.dest);
|
|
7323
|
-
if (operation.verbose) {
|
|
7324
|
-
console.log(
|
|
7325
|
-
chalk2.green(
|
|
7326
|
-
`Added "${operation.dest}" from "${operation.src}" successfully`
|
|
7327
|
-
)
|
|
7463
|
+
var batchedCopyFiles = async (operations) => {
|
|
7464
|
+
const batchedPromises = operations.map(async (operation) => {
|
|
7465
|
+
try {
|
|
7466
|
+
makeDirectory(dirname(operation.dest));
|
|
7467
|
+
await copyFileAsync(operation.src, operation.dest);
|
|
7468
|
+
if (operation.verbose) {
|
|
7469
|
+
console.log(
|
|
7470
|
+
chalk.green(
|
|
7471
|
+
`Added "${operation.dest}" from "${operation.src}" successfully`
|
|
7472
|
+
)
|
|
7328
7473
|
);
|
|
7329
7474
|
}
|
|
7330
7475
|
} catch (err) {
|
|
7331
7476
|
console.log(
|
|
7332
|
-
|
|
7477
|
+
chalk.red(`Cannot copy file ${operation.src} to ${operation.dest}`)
|
|
7333
7478
|
);
|
|
7334
7479
|
if (operation.verbose) {
|
|
7335
|
-
console.log(
|
|
7480
|
+
console.log(chalk.red(err));
|
|
7336
7481
|
}
|
|
7337
7482
|
throw err;
|
|
7338
7483
|
}
|
|
@@ -7348,12 +7493,12 @@ var batchedWriteFiles = async (operations) => {
|
|
|
7348
7493
|
mode: operation.mode
|
|
7349
7494
|
});
|
|
7350
7495
|
if (operation.verbose) {
|
|
7351
|
-
console.log(
|
|
7496
|
+
console.log(chalk.green(`Added "${operation.path}" successfully`));
|
|
7352
7497
|
}
|
|
7353
7498
|
} catch (err) {
|
|
7354
|
-
console.log(
|
|
7499
|
+
console.log(chalk.red(`Cannot write file ${operation.path}`));
|
|
7355
7500
|
if (operation.verbose) {
|
|
7356
|
-
console.log(
|
|
7501
|
+
console.log(chalk.red(err));
|
|
7357
7502
|
}
|
|
7358
7503
|
throw err;
|
|
7359
7504
|
}
|
|
@@ -7376,29 +7521,16 @@ var batchedAppendFiles = async (operations) => {
|
|
|
7376
7521
|
]);
|
|
7377
7522
|
} catch (err) {
|
|
7378
7523
|
console.log(
|
|
7379
|
-
|
|
7524
|
+
chalk.red(`Cannot append file ${operation.src} to ${operation.dest}`)
|
|
7380
7525
|
);
|
|
7381
7526
|
if (operation.verbose) {
|
|
7382
|
-
console.log(
|
|
7527
|
+
console.log(chalk.red(err));
|
|
7383
7528
|
}
|
|
7384
7529
|
throw err;
|
|
7385
7530
|
}
|
|
7386
7531
|
});
|
|
7387
7532
|
await Promise.all(batchedPromises);
|
|
7388
7533
|
};
|
|
7389
|
-
var getAiToolFilters = (aiTool) => {
|
|
7390
|
-
const filters = [];
|
|
7391
|
-
if (aiTool !== "cursor") {
|
|
7392
|
-
filters.push("!.cursorrules", "!**/.cursorrules");
|
|
7393
|
-
}
|
|
7394
|
-
if (aiTool !== "copilot") {
|
|
7395
|
-
filters.push(
|
|
7396
|
-
"!.github/copilot-instructions.md",
|
|
7397
|
-
"!**/.github/copilot-instructions.md"
|
|
7398
|
-
);
|
|
7399
|
-
}
|
|
7400
|
-
return filters;
|
|
7401
|
-
};
|
|
7402
7534
|
var copyLoader = ({ root, templateDir, verbose, srcDir }) => async ({ path: path4 }) => {
|
|
7403
7535
|
const operations = [];
|
|
7404
7536
|
try {
|
|
@@ -7535,9 +7667,6 @@ var loadFiles = async ({
|
|
|
7535
7667
|
for await (const { url: templateOrExtensionUrl } of templatesOrExtensions) {
|
|
7536
7668
|
const templateDir = await getTemplateDirPath(templateOrExtensionUrl);
|
|
7537
7669
|
if (fs3.existsSync(templateDir) && fs3.statSync(templateDir).isDirectory()) {
|
|
7538
|
-
const aiToolFilters = getAiToolFilters(
|
|
7539
|
-
String(customOptions.aiTool || "none")
|
|
7540
|
-
);
|
|
7541
7670
|
for await (const entry of readdirp(templateDir, {
|
|
7542
7671
|
fileFilter: [
|
|
7543
7672
|
"!package.js",
|
|
@@ -7546,8 +7675,6 @@ var loadFiles = async ({
|
|
|
7546
7675
|
"!template.json",
|
|
7547
7676
|
"!yarn.lock",
|
|
7548
7677
|
"!pnpm-lock.yaml",
|
|
7549
|
-
// AI tool filters - exclude files not needed
|
|
7550
|
-
...aiToolFilters,
|
|
7551
7678
|
// based on the package manager we want to ignore files containing
|
|
7552
7679
|
// the other package as condition.
|
|
7553
7680
|
// For example, if `usePnpm` is true, the we need to ignore
|
|
@@ -7584,6 +7711,283 @@ var loadFiles = async ({
|
|
|
7584
7711
|
}
|
|
7585
7712
|
};
|
|
7586
7713
|
|
|
7714
|
+
// installer.ts
|
|
7715
|
+
import _2 from "underscore";
|
|
7716
|
+
import path3 from "path";
|
|
7717
|
+
import fs4 from "fs";
|
|
7718
|
+
import chalk3 from "chalk";
|
|
7719
|
+
import os3 from "os";
|
|
7720
|
+
import semver2 from "semver";
|
|
7721
|
+
import { execSync as execSync2 } from "child_process";
|
|
7722
|
+
|
|
7723
|
+
// helpers.ts
|
|
7724
|
+
import { execSync } from "child_process";
|
|
7725
|
+
import spawn2 from "cross-spawn";
|
|
7726
|
+
import chalk2 from "chalk";
|
|
7727
|
+
import semver from "semver";
|
|
7728
|
+
import dns from "dns";
|
|
7729
|
+
import { URL as URL2 } from "url";
|
|
7730
|
+
var shouldUseYarn = () => {
|
|
7731
|
+
const { hasMinYarnPnp, hasMaxYarnPnp, yarnVersion } = checkYarnVersion();
|
|
7732
|
+
if (!hasMinYarnPnp) {
|
|
7733
|
+
console.log(
|
|
7734
|
+
chalk2.yellow(
|
|
7735
|
+
`You are using yarn version ${chalk2.bold(
|
|
7736
|
+
yarnVersion
|
|
7737
|
+
)} which is not supported yet. To use Yarn, install v1.12.0 or higher and lower than v2.0.0. See https://yarnpkg.com for instructions on how to update.`
|
|
7738
|
+
)
|
|
7739
|
+
);
|
|
7740
|
+
return false;
|
|
7741
|
+
}
|
|
7742
|
+
if (!hasMaxYarnPnp) {
|
|
7743
|
+
console.log(
|
|
7744
|
+
chalk2.yellow(
|
|
7745
|
+
`You are using a pre-release version of Yarn which is not supported yet. To use Yarn, install v1.12.0 or higher and lower than v2.0.0. See https://yarnpkg.com for instructions on how to update.`
|
|
7746
|
+
)
|
|
7747
|
+
);
|
|
7748
|
+
return false;
|
|
7749
|
+
}
|
|
7750
|
+
return true;
|
|
7751
|
+
};
|
|
7752
|
+
var shouldUsePnpm = () => {
|
|
7753
|
+
const { hasMinPnpm, pnpmVersion } = checkPnpmVersion();
|
|
7754
|
+
if (!hasMinPnpm) {
|
|
7755
|
+
console.log(
|
|
7756
|
+
chalk2.yellow(
|
|
7757
|
+
`You are using pnpm version ${chalk2.bold(
|
|
7758
|
+
pnpmVersion
|
|
7759
|
+
)} which is not supported yet. To use pnpm, install v5.0.0 or higher. See https://pnpm.js.org for instructions on how to update.`
|
|
7760
|
+
)
|
|
7761
|
+
);
|
|
7762
|
+
return false;
|
|
7763
|
+
}
|
|
7764
|
+
return true;
|
|
7765
|
+
};
|
|
7766
|
+
var checkThatNpmCanReadCwd = () => {
|
|
7767
|
+
const cwd = process.cwd();
|
|
7768
|
+
let childOutput = null;
|
|
7769
|
+
try {
|
|
7770
|
+
childOutput = spawn2.sync("npm", ["config", "list"]).output.join("");
|
|
7771
|
+
} catch (err) {
|
|
7772
|
+
return true;
|
|
7773
|
+
}
|
|
7774
|
+
if (typeof childOutput !== "string") {
|
|
7775
|
+
return true;
|
|
7776
|
+
}
|
|
7777
|
+
const lines = childOutput.split("\n");
|
|
7778
|
+
const prefix = "; cwd = ";
|
|
7779
|
+
const line = lines.find((line2) => line2.startsWith(prefix));
|
|
7780
|
+
if (typeof line !== "string") {
|
|
7781
|
+
return true;
|
|
7782
|
+
}
|
|
7783
|
+
const npmCWD = line.substring(prefix.length);
|
|
7784
|
+
if (npmCWD === cwd) {
|
|
7785
|
+
return true;
|
|
7786
|
+
}
|
|
7787
|
+
console.error(
|
|
7788
|
+
chalk2.red(
|
|
7789
|
+
`Could not start an npm process in the right directory.
|
|
7790
|
+
|
|
7791
|
+
The current directory is: ${chalk2.bold(cwd)}
|
|
7792
|
+
However, a newly started npm process runs in: ${chalk2.bold(
|
|
7793
|
+
npmCWD
|
|
7794
|
+
)}
|
|
7795
|
+
|
|
7796
|
+
This is probably caused by a misconfigured system terminal shell.`
|
|
7797
|
+
)
|
|
7798
|
+
);
|
|
7799
|
+
if (process.platform === "win32") {
|
|
7800
|
+
console.error(
|
|
7801
|
+
chalk2.red(`On Windows, this can usually be fixed by running:
|
|
7802
|
+
|
|
7803
|
+
`) + ` ${chalk2.cyan(
|
|
7804
|
+
"reg"
|
|
7805
|
+
)} delete "HKCU\\Software\\Microsoft\\Command Processor" /v AutoRun /f
|
|
7806
|
+
${chalk2.cyan(
|
|
7807
|
+
"reg"
|
|
7808
|
+
)} delete "HKLM\\Software\\Microsoft\\Command Processor" /v AutoRun /f
|
|
7809
|
+
|
|
7810
|
+
` + chalk2.red(`Try to run the above two lines in the terminal.
|
|
7811
|
+
`) + chalk2.red(
|
|
7812
|
+
`To learn more about this problem, read: https://blogs.msdn.microsoft.com/oldnewthing/20071121-00/?p=24433/`
|
|
7813
|
+
)
|
|
7814
|
+
);
|
|
7815
|
+
}
|
|
7816
|
+
return false;
|
|
7817
|
+
};
|
|
7818
|
+
var checkPnpmVersion = () => {
|
|
7819
|
+
const minPnpm = "5.0.0";
|
|
7820
|
+
let hasMinPnpm = false;
|
|
7821
|
+
let pnpmVersion = null;
|
|
7822
|
+
try {
|
|
7823
|
+
pnpmVersion = execSync("pnpm --version").toString().trim();
|
|
7824
|
+
if (semver.valid(pnpmVersion)) {
|
|
7825
|
+
hasMinPnpm = semver.gte(pnpmVersion, minPnpm);
|
|
7826
|
+
} else {
|
|
7827
|
+
const trimmedPnpmVersionMatch = /^(.+?)[-+].+$/.exec(pnpmVersion);
|
|
7828
|
+
if (trimmedPnpmVersionMatch) {
|
|
7829
|
+
hasMinPnpm = semver.gte(trimmedPnpmVersionMatch[1], minPnpm);
|
|
7830
|
+
}
|
|
7831
|
+
}
|
|
7832
|
+
} catch (e) {
|
|
7833
|
+
}
|
|
7834
|
+
return { hasMinPnpm, pnpmVersion };
|
|
7835
|
+
};
|
|
7836
|
+
var checkYarnVersion = () => {
|
|
7837
|
+
const minYarnPnp = "1.12.0";
|
|
7838
|
+
const maxYarnPnp = "2.0.0";
|
|
7839
|
+
let hasMinYarnPnp = false;
|
|
7840
|
+
let hasMaxYarnPnp = false;
|
|
7841
|
+
let yarnVersion = null;
|
|
7842
|
+
try {
|
|
7843
|
+
yarnVersion = execSync("yarnpkg --version").toString().trim();
|
|
7844
|
+
if (semver.valid(yarnVersion)) {
|
|
7845
|
+
hasMinYarnPnp = semver.gte(yarnVersion, minYarnPnp);
|
|
7846
|
+
hasMaxYarnPnp = semver.lt(yarnVersion, maxYarnPnp);
|
|
7847
|
+
} else {
|
|
7848
|
+
const trimmedYarnVersionMatch = /^(.+?)[-+].+$/.exec(yarnVersion);
|
|
7849
|
+
if (trimmedYarnVersionMatch) {
|
|
7850
|
+
const trimmedYarnVersion = trimmedYarnVersionMatch.pop();
|
|
7851
|
+
if (trimmedYarnVersion) {
|
|
7852
|
+
hasMinYarnPnp = semver.gte(trimmedYarnVersion, minYarnPnp);
|
|
7853
|
+
hasMaxYarnPnp = semver.lt(trimmedYarnVersion, maxYarnPnp);
|
|
7854
|
+
}
|
|
7855
|
+
}
|
|
7856
|
+
}
|
|
7857
|
+
} catch (err) {
|
|
7858
|
+
}
|
|
7859
|
+
return {
|
|
7860
|
+
hasMinYarnPnp,
|
|
7861
|
+
hasMaxYarnPnp,
|
|
7862
|
+
yarnVersion
|
|
7863
|
+
};
|
|
7864
|
+
};
|
|
7865
|
+
var checkNpmVersion = () => {
|
|
7866
|
+
let hasMinNpm = false;
|
|
7867
|
+
let npmVersion = null;
|
|
7868
|
+
try {
|
|
7869
|
+
npmVersion = execSync("npm --version").toString().trim();
|
|
7870
|
+
hasMinNpm = semver.gte(npmVersion, "6.0.0");
|
|
7871
|
+
} catch (err) {
|
|
7872
|
+
}
|
|
7873
|
+
return {
|
|
7874
|
+
hasMinNpm,
|
|
7875
|
+
npmVersion
|
|
7876
|
+
};
|
|
7877
|
+
};
|
|
7878
|
+
var getProxy = () => {
|
|
7879
|
+
if (process.env.HTTPS_PROXY) {
|
|
7880
|
+
return process.env.HTTPS_PROXY;
|
|
7881
|
+
}
|
|
7882
|
+
try {
|
|
7883
|
+
const httpsProxy = execSync("npm config get https-proxy").toString().trim();
|
|
7884
|
+
return httpsProxy !== "null" ? httpsProxy : void 0;
|
|
7885
|
+
} catch (e) {
|
|
7886
|
+
}
|
|
7887
|
+
return "";
|
|
7888
|
+
};
|
|
7889
|
+
var checkIfOnline = (useYarn) => {
|
|
7890
|
+
if (!useYarn) {
|
|
7891
|
+
return Promise.resolve(true);
|
|
7892
|
+
}
|
|
7893
|
+
return new Promise((resolve) => {
|
|
7894
|
+
dns.lookup("registry.yarnpkg.com", (err) => {
|
|
7895
|
+
let proxy;
|
|
7896
|
+
if (err != null && (proxy = getProxy())) {
|
|
7897
|
+
dns.lookup(new URL2(proxy).hostname, (proxyErr) => {
|
|
7898
|
+
resolve(!proxyErr);
|
|
7899
|
+
});
|
|
7900
|
+
} else {
|
|
7901
|
+
resolve(!err);
|
|
7902
|
+
}
|
|
7903
|
+
});
|
|
7904
|
+
});
|
|
7905
|
+
};
|
|
7906
|
+
|
|
7907
|
+
// package.ts
|
|
7908
|
+
import { existsSync } from "fs";
|
|
7909
|
+
import merge from "lodash.merge";
|
|
7910
|
+
var getInstallableSetup = ({
|
|
7911
|
+
dependencies,
|
|
7912
|
+
devDependencies,
|
|
7913
|
+
...packageJson
|
|
7914
|
+
}) => {
|
|
7915
|
+
const getInstallableDeps = (deps = {}) => Object.entries(deps).map(([dep, version]) => `${dep}@${version}`);
|
|
7916
|
+
return {
|
|
7917
|
+
packageJson,
|
|
7918
|
+
dependencies: getInstallableDeps(dependencies),
|
|
7919
|
+
devDependencies: getInstallableDeps(devDependencies)
|
|
7920
|
+
};
|
|
7921
|
+
};
|
|
7922
|
+
var requireIfExists = (path4) => {
|
|
7923
|
+
if (existsSync(path4)) {
|
|
7924
|
+
return __require(path4);
|
|
7925
|
+
}
|
|
7926
|
+
throw new Error(`File ${path4} does not exist`);
|
|
7927
|
+
};
|
|
7928
|
+
var loadPackages = async ({
|
|
7929
|
+
templatesOrExtensions = [],
|
|
7930
|
+
ignorePackage: globalIgnorePackage = false,
|
|
7931
|
+
...config
|
|
7932
|
+
}) => {
|
|
7933
|
+
const setup = await Promise.all(
|
|
7934
|
+
templatesOrExtensions.map(async ({ url: templateOrExtension }) => {
|
|
7935
|
+
try {
|
|
7936
|
+
const template = requireIfExists(
|
|
7937
|
+
await getPackagePath(templateOrExtension, "template.json")
|
|
7938
|
+
);
|
|
7939
|
+
return template.package || {};
|
|
7940
|
+
} catch {
|
|
7941
|
+
return {};
|
|
7942
|
+
}
|
|
7943
|
+
})
|
|
7944
|
+
);
|
|
7945
|
+
const mergedSetup = merge(
|
|
7946
|
+
{
|
|
7947
|
+
name: config.appName,
|
|
7948
|
+
dependencies: {},
|
|
7949
|
+
devDependencies: {},
|
|
7950
|
+
scripts: {}
|
|
7951
|
+
},
|
|
7952
|
+
...setup
|
|
7953
|
+
);
|
|
7954
|
+
const finalSetup = await Promise.all(
|
|
7955
|
+
templatesOrExtensions.map(
|
|
7956
|
+
async ({ url: templateOrExtension, ignorePackage }) => {
|
|
7957
|
+
try {
|
|
7958
|
+
const templateOrExtensionPackageJson = requireIfExists(
|
|
7959
|
+
await getPackagePath(
|
|
7960
|
+
templateOrExtension,
|
|
7961
|
+
"package.json",
|
|
7962
|
+
globalIgnorePackage || ignorePackage
|
|
7963
|
+
)
|
|
7964
|
+
);
|
|
7965
|
+
return templateOrExtensionPackageJson;
|
|
7966
|
+
} catch {
|
|
7967
|
+
return {};
|
|
7968
|
+
}
|
|
7969
|
+
}
|
|
7970
|
+
)
|
|
7971
|
+
);
|
|
7972
|
+
const resolvedSetup = await Promise.all(
|
|
7973
|
+
templatesOrExtensions.map(async ({ url: templateOrExtension }) => {
|
|
7974
|
+
try {
|
|
7975
|
+
const resolveTemplateOrExtensionPackage = requireIfExists(
|
|
7976
|
+
await getPackagePath(templateOrExtension)
|
|
7977
|
+
);
|
|
7978
|
+
return resolveTemplateOrExtensionPackage(mergedSetup, config);
|
|
7979
|
+
} catch {
|
|
7980
|
+
return {};
|
|
7981
|
+
}
|
|
7982
|
+
})
|
|
7983
|
+
);
|
|
7984
|
+
const packageJson = merge(mergedSetup, ...finalSetup, ...resolvedSetup);
|
|
7985
|
+
return getInstallableSetup({
|
|
7986
|
+
...packageJson,
|
|
7987
|
+
name: config.appName
|
|
7988
|
+
});
|
|
7989
|
+
};
|
|
7990
|
+
|
|
7587
7991
|
// installer.ts
|
|
7588
7992
|
var install = async (root, useYarn = false, usePnpm = false, dependencies = [], verbose = false, isOnline = true, isDevDependencies = false) => {
|
|
7589
7993
|
let command;
|