@scriptdb/storage 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -4852
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4859 +1,8 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
-
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
-
for (let key of __getOwnPropNames(mod))
|
|
11
|
-
if (!__hasOwnProp.call(to, key))
|
|
12
|
-
__defProp(to, key, {
|
|
13
|
-
get: () => mod[key],
|
|
14
|
-
enumerable: true
|
|
15
|
-
});
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
19
|
-
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
20
|
-
|
|
21
|
-
// ../../node_modules/.bun/ms@2.1.3/node_modules/ms/index.js
|
|
22
|
-
var require_ms = __commonJS((exports, module) => {
|
|
23
|
-
var s = 1000;
|
|
24
|
-
var m = s * 60;
|
|
25
|
-
var h = m * 60;
|
|
26
|
-
var d = h * 24;
|
|
27
|
-
var w = d * 7;
|
|
28
|
-
var y = d * 365.25;
|
|
29
|
-
module.exports = function(val, options) {
|
|
30
|
-
options = options || {};
|
|
31
|
-
var type = typeof val;
|
|
32
|
-
if (type === "string" && val.length > 0) {
|
|
33
|
-
return parse(val);
|
|
34
|
-
} else if (type === "number" && isFinite(val)) {
|
|
35
|
-
return options.long ? fmtLong(val) : fmtShort(val);
|
|
36
|
-
}
|
|
37
|
-
throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));
|
|
38
|
-
};
|
|
39
|
-
function parse(str) {
|
|
40
|
-
str = String(str);
|
|
41
|
-
if (str.length > 100) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);
|
|
45
|
-
if (!match) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
var n = parseFloat(match[1]);
|
|
49
|
-
var type = (match[2] || "ms").toLowerCase();
|
|
50
|
-
switch (type) {
|
|
51
|
-
case "years":
|
|
52
|
-
case "year":
|
|
53
|
-
case "yrs":
|
|
54
|
-
case "yr":
|
|
55
|
-
case "y":
|
|
56
|
-
return n * y;
|
|
57
|
-
case "weeks":
|
|
58
|
-
case "week":
|
|
59
|
-
case "w":
|
|
60
|
-
return n * w;
|
|
61
|
-
case "days":
|
|
62
|
-
case "day":
|
|
63
|
-
case "d":
|
|
64
|
-
return n * d;
|
|
65
|
-
case "hours":
|
|
66
|
-
case "hour":
|
|
67
|
-
case "hrs":
|
|
68
|
-
case "hr":
|
|
69
|
-
case "h":
|
|
70
|
-
return n * h;
|
|
71
|
-
case "minutes":
|
|
72
|
-
case "minute":
|
|
73
|
-
case "mins":
|
|
74
|
-
case "min":
|
|
75
|
-
case "m":
|
|
76
|
-
return n * m;
|
|
77
|
-
case "seconds":
|
|
78
|
-
case "second":
|
|
79
|
-
case "secs":
|
|
80
|
-
case "sec":
|
|
81
|
-
case "s":
|
|
82
|
-
return n * s;
|
|
83
|
-
case "milliseconds":
|
|
84
|
-
case "millisecond":
|
|
85
|
-
case "msecs":
|
|
86
|
-
case "msec":
|
|
87
|
-
case "ms":
|
|
88
|
-
return n;
|
|
89
|
-
default:
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
function fmtShort(ms) {
|
|
94
|
-
var msAbs = Math.abs(ms);
|
|
95
|
-
if (msAbs >= d) {
|
|
96
|
-
return Math.round(ms / d) + "d";
|
|
97
|
-
}
|
|
98
|
-
if (msAbs >= h) {
|
|
99
|
-
return Math.round(ms / h) + "h";
|
|
100
|
-
}
|
|
101
|
-
if (msAbs >= m) {
|
|
102
|
-
return Math.round(ms / m) + "m";
|
|
103
|
-
}
|
|
104
|
-
if (msAbs >= s) {
|
|
105
|
-
return Math.round(ms / s) + "s";
|
|
106
|
-
}
|
|
107
|
-
return ms + "ms";
|
|
108
|
-
}
|
|
109
|
-
function fmtLong(ms) {
|
|
110
|
-
var msAbs = Math.abs(ms);
|
|
111
|
-
if (msAbs >= d) {
|
|
112
|
-
return plural(ms, msAbs, d, "day");
|
|
113
|
-
}
|
|
114
|
-
if (msAbs >= h) {
|
|
115
|
-
return plural(ms, msAbs, h, "hour");
|
|
116
|
-
}
|
|
117
|
-
if (msAbs >= m) {
|
|
118
|
-
return plural(ms, msAbs, m, "minute");
|
|
119
|
-
}
|
|
120
|
-
if (msAbs >= s) {
|
|
121
|
-
return plural(ms, msAbs, s, "second");
|
|
122
|
-
}
|
|
123
|
-
return ms + " ms";
|
|
124
|
-
}
|
|
125
|
-
function plural(ms, msAbs, n, name) {
|
|
126
|
-
var isPlural = msAbs >= n * 1.5;
|
|
127
|
-
return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
// ../../node_modules/.bun/debug@4.4.3/node_modules/debug/src/common.js
|
|
132
|
-
var require_common = __commonJS((exports, module) => {
|
|
133
|
-
function setup(env) {
|
|
134
|
-
createDebug.debug = createDebug;
|
|
135
|
-
createDebug.default = createDebug;
|
|
136
|
-
createDebug.coerce = coerce;
|
|
137
|
-
createDebug.disable = disable;
|
|
138
|
-
createDebug.enable = enable;
|
|
139
|
-
createDebug.enabled = enabled;
|
|
140
|
-
createDebug.humanize = require_ms();
|
|
141
|
-
createDebug.destroy = destroy;
|
|
142
|
-
Object.keys(env).forEach((key) => {
|
|
143
|
-
createDebug[key] = env[key];
|
|
144
|
-
});
|
|
145
|
-
createDebug.names = [];
|
|
146
|
-
createDebug.skips = [];
|
|
147
|
-
createDebug.formatters = {};
|
|
148
|
-
function selectColor(namespace) {
|
|
149
|
-
let hash = 0;
|
|
150
|
-
for (let i = 0;i < namespace.length; i++) {
|
|
151
|
-
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
152
|
-
hash |= 0;
|
|
153
|
-
}
|
|
154
|
-
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
155
|
-
}
|
|
156
|
-
createDebug.selectColor = selectColor;
|
|
157
|
-
function createDebug(namespace) {
|
|
158
|
-
let prevTime;
|
|
159
|
-
let enableOverride = null;
|
|
160
|
-
let namespacesCache;
|
|
161
|
-
let enabledCache;
|
|
162
|
-
function debug(...args) {
|
|
163
|
-
if (!debug.enabled) {
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
const self = debug;
|
|
167
|
-
const curr = Number(new Date);
|
|
168
|
-
const ms = curr - (prevTime || curr);
|
|
169
|
-
self.diff = ms;
|
|
170
|
-
self.prev = prevTime;
|
|
171
|
-
self.curr = curr;
|
|
172
|
-
prevTime = curr;
|
|
173
|
-
args[0] = createDebug.coerce(args[0]);
|
|
174
|
-
if (typeof args[0] !== "string") {
|
|
175
|
-
args.unshift("%O");
|
|
176
|
-
}
|
|
177
|
-
let index = 0;
|
|
178
|
-
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
179
|
-
if (match === "%%") {
|
|
180
|
-
return "%";
|
|
181
|
-
}
|
|
182
|
-
index++;
|
|
183
|
-
const formatter = createDebug.formatters[format];
|
|
184
|
-
if (typeof formatter === "function") {
|
|
185
|
-
const val = args[index];
|
|
186
|
-
match = formatter.call(self, val);
|
|
187
|
-
args.splice(index, 1);
|
|
188
|
-
index--;
|
|
189
|
-
}
|
|
190
|
-
return match;
|
|
191
|
-
});
|
|
192
|
-
createDebug.formatArgs.call(self, args);
|
|
193
|
-
const logFn = self.log || createDebug.log;
|
|
194
|
-
logFn.apply(self, args);
|
|
195
|
-
}
|
|
196
|
-
debug.namespace = namespace;
|
|
197
|
-
debug.useColors = createDebug.useColors();
|
|
198
|
-
debug.color = createDebug.selectColor(namespace);
|
|
199
|
-
debug.extend = extend;
|
|
200
|
-
debug.destroy = createDebug.destroy;
|
|
201
|
-
Object.defineProperty(debug, "enabled", {
|
|
202
|
-
enumerable: true,
|
|
203
|
-
configurable: false,
|
|
204
|
-
get: () => {
|
|
205
|
-
if (enableOverride !== null) {
|
|
206
|
-
return enableOverride;
|
|
207
|
-
}
|
|
208
|
-
if (namespacesCache !== createDebug.namespaces) {
|
|
209
|
-
namespacesCache = createDebug.namespaces;
|
|
210
|
-
enabledCache = createDebug.enabled(namespace);
|
|
211
|
-
}
|
|
212
|
-
return enabledCache;
|
|
213
|
-
},
|
|
214
|
-
set: (v) => {
|
|
215
|
-
enableOverride = v;
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
if (typeof createDebug.init === "function") {
|
|
219
|
-
createDebug.init(debug);
|
|
220
|
-
}
|
|
221
|
-
return debug;
|
|
222
|
-
}
|
|
223
|
-
function extend(namespace, delimiter) {
|
|
224
|
-
const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
225
|
-
newDebug.log = this.log;
|
|
226
|
-
return newDebug;
|
|
227
|
-
}
|
|
228
|
-
function enable(namespaces) {
|
|
229
|
-
createDebug.save(namespaces);
|
|
230
|
-
createDebug.namespaces = namespaces;
|
|
231
|
-
createDebug.names = [];
|
|
232
|
-
createDebug.skips = [];
|
|
233
|
-
const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
|
|
234
|
-
for (const ns of split) {
|
|
235
|
-
if (ns[0] === "-") {
|
|
236
|
-
createDebug.skips.push(ns.slice(1));
|
|
237
|
-
} else {
|
|
238
|
-
createDebug.names.push(ns);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
function matchesTemplate(search, template) {
|
|
243
|
-
let searchIndex = 0;
|
|
244
|
-
let templateIndex = 0;
|
|
245
|
-
let starIndex = -1;
|
|
246
|
-
let matchIndex = 0;
|
|
247
|
-
while (searchIndex < search.length) {
|
|
248
|
-
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
|
|
249
|
-
if (template[templateIndex] === "*") {
|
|
250
|
-
starIndex = templateIndex;
|
|
251
|
-
matchIndex = searchIndex;
|
|
252
|
-
templateIndex++;
|
|
253
|
-
} else {
|
|
254
|
-
searchIndex++;
|
|
255
|
-
templateIndex++;
|
|
256
|
-
}
|
|
257
|
-
} else if (starIndex !== -1) {
|
|
258
|
-
templateIndex = starIndex + 1;
|
|
259
|
-
matchIndex++;
|
|
260
|
-
searchIndex = matchIndex;
|
|
261
|
-
} else {
|
|
262
|
-
return false;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
while (templateIndex < template.length && template[templateIndex] === "*") {
|
|
266
|
-
templateIndex++;
|
|
267
|
-
}
|
|
268
|
-
return templateIndex === template.length;
|
|
269
|
-
}
|
|
270
|
-
function disable() {
|
|
271
|
-
const namespaces = [
|
|
272
|
-
...createDebug.names,
|
|
273
|
-
...createDebug.skips.map((namespace) => "-" + namespace)
|
|
274
|
-
].join(",");
|
|
275
|
-
createDebug.enable("");
|
|
276
|
-
return namespaces;
|
|
277
|
-
}
|
|
278
|
-
function enabled(name) {
|
|
279
|
-
for (const skip of createDebug.skips) {
|
|
280
|
-
if (matchesTemplate(name, skip)) {
|
|
281
|
-
return false;
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
for (const ns of createDebug.names) {
|
|
285
|
-
if (matchesTemplate(name, ns)) {
|
|
286
|
-
return true;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
return false;
|
|
290
|
-
}
|
|
291
|
-
function coerce(val) {
|
|
292
|
-
if (val instanceof Error) {
|
|
293
|
-
return val.stack || val.message;
|
|
294
|
-
}
|
|
295
|
-
return val;
|
|
296
|
-
}
|
|
297
|
-
function destroy() {
|
|
298
|
-
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
299
|
-
}
|
|
300
|
-
createDebug.enable(createDebug.load());
|
|
301
|
-
return createDebug;
|
|
302
|
-
}
|
|
303
|
-
module.exports = setup;
|
|
304
|
-
});
|
|
305
|
-
|
|
306
|
-
// ../../node_modules/.bun/debug@4.4.3/node_modules/debug/src/browser.js
|
|
307
|
-
var require_browser = __commonJS((exports, module) => {
|
|
308
|
-
exports.formatArgs = formatArgs;
|
|
309
|
-
exports.save = save;
|
|
310
|
-
exports.load = load;
|
|
311
|
-
exports.useColors = useColors;
|
|
312
|
-
exports.storage = localstorage();
|
|
313
|
-
exports.destroy = (() => {
|
|
314
|
-
let warned = false;
|
|
315
|
-
return () => {
|
|
316
|
-
if (!warned) {
|
|
317
|
-
warned = true;
|
|
318
|
-
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
319
|
-
}
|
|
320
|
-
};
|
|
321
|
-
})();
|
|
322
|
-
exports.colors = [
|
|
323
|
-
"#0000CC",
|
|
324
|
-
"#0000FF",
|
|
325
|
-
"#0033CC",
|
|
326
|
-
"#0033FF",
|
|
327
|
-
"#0066CC",
|
|
328
|
-
"#0066FF",
|
|
329
|
-
"#0099CC",
|
|
330
|
-
"#0099FF",
|
|
331
|
-
"#00CC00",
|
|
332
|
-
"#00CC33",
|
|
333
|
-
"#00CC66",
|
|
334
|
-
"#00CC99",
|
|
335
|
-
"#00CCCC",
|
|
336
|
-
"#00CCFF",
|
|
337
|
-
"#3300CC",
|
|
338
|
-
"#3300FF",
|
|
339
|
-
"#3333CC",
|
|
340
|
-
"#3333FF",
|
|
341
|
-
"#3366CC",
|
|
342
|
-
"#3366FF",
|
|
343
|
-
"#3399CC",
|
|
344
|
-
"#3399FF",
|
|
345
|
-
"#33CC00",
|
|
346
|
-
"#33CC33",
|
|
347
|
-
"#33CC66",
|
|
348
|
-
"#33CC99",
|
|
349
|
-
"#33CCCC",
|
|
350
|
-
"#33CCFF",
|
|
351
|
-
"#6600CC",
|
|
352
|
-
"#6600FF",
|
|
353
|
-
"#6633CC",
|
|
354
|
-
"#6633FF",
|
|
355
|
-
"#66CC00",
|
|
356
|
-
"#66CC33",
|
|
357
|
-
"#9900CC",
|
|
358
|
-
"#9900FF",
|
|
359
|
-
"#9933CC",
|
|
360
|
-
"#9933FF",
|
|
361
|
-
"#99CC00",
|
|
362
|
-
"#99CC33",
|
|
363
|
-
"#CC0000",
|
|
364
|
-
"#CC0033",
|
|
365
|
-
"#CC0066",
|
|
366
|
-
"#CC0099",
|
|
367
|
-
"#CC00CC",
|
|
368
|
-
"#CC00FF",
|
|
369
|
-
"#CC3300",
|
|
370
|
-
"#CC3333",
|
|
371
|
-
"#CC3366",
|
|
372
|
-
"#CC3399",
|
|
373
|
-
"#CC33CC",
|
|
374
|
-
"#CC33FF",
|
|
375
|
-
"#CC6600",
|
|
376
|
-
"#CC6633",
|
|
377
|
-
"#CC9900",
|
|
378
|
-
"#CC9933",
|
|
379
|
-
"#CCCC00",
|
|
380
|
-
"#CCCC33",
|
|
381
|
-
"#FF0000",
|
|
382
|
-
"#FF0033",
|
|
383
|
-
"#FF0066",
|
|
384
|
-
"#FF0099",
|
|
385
|
-
"#FF00CC",
|
|
386
|
-
"#FF00FF",
|
|
387
|
-
"#FF3300",
|
|
388
|
-
"#FF3333",
|
|
389
|
-
"#FF3366",
|
|
390
|
-
"#FF3399",
|
|
391
|
-
"#FF33CC",
|
|
392
|
-
"#FF33FF",
|
|
393
|
-
"#FF6600",
|
|
394
|
-
"#FF6633",
|
|
395
|
-
"#FF9900",
|
|
396
|
-
"#FF9933",
|
|
397
|
-
"#FFCC00",
|
|
398
|
-
"#FFCC33"
|
|
399
|
-
];
|
|
400
|
-
function useColors() {
|
|
401
|
-
if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
|
|
402
|
-
return true;
|
|
403
|
-
}
|
|
404
|
-
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
405
|
-
return false;
|
|
406
|
-
}
|
|
407
|
-
let m;
|
|
408
|
-
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
409
|
-
}
|
|
410
|
-
function formatArgs(args) {
|
|
411
|
-
args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
|
|
412
|
-
if (!this.useColors) {
|
|
413
|
-
return;
|
|
414
|
-
}
|
|
415
|
-
const c = "color: " + this.color;
|
|
416
|
-
args.splice(1, 0, c, "color: inherit");
|
|
417
|
-
let index = 0;
|
|
418
|
-
let lastC = 0;
|
|
419
|
-
args[0].replace(/%[a-zA-Z%]/g, (match) => {
|
|
420
|
-
if (match === "%%") {
|
|
421
|
-
return;
|
|
422
|
-
}
|
|
423
|
-
index++;
|
|
424
|
-
if (match === "%c") {
|
|
425
|
-
lastC = index;
|
|
426
|
-
}
|
|
427
|
-
});
|
|
428
|
-
args.splice(lastC, 0, c);
|
|
429
|
-
}
|
|
430
|
-
exports.log = console.debug || console.log || (() => {});
|
|
431
|
-
function save(namespaces) {
|
|
432
|
-
try {
|
|
433
|
-
if (namespaces) {
|
|
434
|
-
exports.storage.setItem("debug", namespaces);
|
|
435
|
-
} else {
|
|
436
|
-
exports.storage.removeItem("debug");
|
|
437
|
-
}
|
|
438
|
-
} catch (error) {}
|
|
439
|
-
}
|
|
440
|
-
function load() {
|
|
441
|
-
let r;
|
|
442
|
-
try {
|
|
443
|
-
r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
|
|
444
|
-
} catch (error) {}
|
|
445
|
-
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
446
|
-
r = process.env.DEBUG;
|
|
447
|
-
}
|
|
448
|
-
return r;
|
|
449
|
-
}
|
|
450
|
-
function localstorage() {
|
|
451
|
-
try {
|
|
452
|
-
return localStorage;
|
|
453
|
-
} catch (error) {}
|
|
454
|
-
}
|
|
455
|
-
module.exports = require_common()(exports);
|
|
456
|
-
var { formatters } = module.exports;
|
|
457
|
-
formatters.j = function(v) {
|
|
458
|
-
try {
|
|
459
|
-
return JSON.stringify(v);
|
|
460
|
-
} catch (error) {
|
|
461
|
-
return "[UnexpectedJSONParseError]: " + error.message;
|
|
462
|
-
}
|
|
463
|
-
};
|
|
464
|
-
});
|
|
465
|
-
|
|
466
|
-
// ../../node_modules/.bun/has-flag@4.0.0/node_modules/has-flag/index.js
|
|
467
|
-
var require_has_flag = __commonJS((exports, module) => {
|
|
468
|
-
module.exports = (flag, argv = process.argv) => {
|
|
469
|
-
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
470
|
-
const position = argv.indexOf(prefix + flag);
|
|
471
|
-
const terminatorPosition = argv.indexOf("--");
|
|
472
|
-
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
473
|
-
};
|
|
474
|
-
});
|
|
475
|
-
|
|
476
|
-
// ../../node_modules/.bun/supports-color@7.2.0/node_modules/supports-color/index.js
|
|
477
|
-
var require_supports_color = __commonJS((exports, module) => {
|
|
478
|
-
var os = __require("os");
|
|
479
|
-
var tty = __require("tty");
|
|
480
|
-
var hasFlag = require_has_flag();
|
|
481
|
-
var { env } = process;
|
|
482
|
-
var forceColor;
|
|
483
|
-
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
484
|
-
forceColor = 0;
|
|
485
|
-
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
486
|
-
forceColor = 1;
|
|
487
|
-
}
|
|
488
|
-
if ("FORCE_COLOR" in env) {
|
|
489
|
-
if (env.FORCE_COLOR === "true") {
|
|
490
|
-
forceColor = 1;
|
|
491
|
-
} else if (env.FORCE_COLOR === "false") {
|
|
492
|
-
forceColor = 0;
|
|
493
|
-
} else {
|
|
494
|
-
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
function translateLevel(level) {
|
|
498
|
-
if (level === 0) {
|
|
499
|
-
return false;
|
|
500
|
-
}
|
|
501
|
-
return {
|
|
502
|
-
level,
|
|
503
|
-
hasBasic: true,
|
|
504
|
-
has256: level >= 2,
|
|
505
|
-
has16m: level >= 3
|
|
506
|
-
};
|
|
507
|
-
}
|
|
508
|
-
function supportsColor(haveStream, streamIsTTY) {
|
|
509
|
-
if (forceColor === 0) {
|
|
510
|
-
return 0;
|
|
511
|
-
}
|
|
512
|
-
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
513
|
-
return 3;
|
|
514
|
-
}
|
|
515
|
-
if (hasFlag("color=256")) {
|
|
516
|
-
return 2;
|
|
517
|
-
}
|
|
518
|
-
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|
519
|
-
return 0;
|
|
520
|
-
}
|
|
521
|
-
const min = forceColor || 0;
|
|
522
|
-
if (env.TERM === "dumb") {
|
|
523
|
-
return min;
|
|
524
|
-
}
|
|
525
|
-
if (process.platform === "win32") {
|
|
526
|
-
const osRelease = os.release().split(".");
|
|
527
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
528
|
-
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
529
|
-
}
|
|
530
|
-
return 1;
|
|
531
|
-
}
|
|
532
|
-
if ("CI" in env) {
|
|
533
|
-
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => (sign in env)) || env.CI_NAME === "codeship") {
|
|
534
|
-
return 1;
|
|
535
|
-
}
|
|
536
|
-
return min;
|
|
537
|
-
}
|
|
538
|
-
if ("TEAMCITY_VERSION" in env) {
|
|
539
|
-
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
540
|
-
}
|
|
541
|
-
if (env.COLORTERM === "truecolor") {
|
|
542
|
-
return 3;
|
|
543
|
-
}
|
|
544
|
-
if ("TERM_PROGRAM" in env) {
|
|
545
|
-
const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
546
|
-
switch (env.TERM_PROGRAM) {
|
|
547
|
-
case "iTerm.app":
|
|
548
|
-
return version >= 3 ? 3 : 2;
|
|
549
|
-
case "Apple_Terminal":
|
|
550
|
-
return 2;
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
if (/-256(color)?$/i.test(env.TERM)) {
|
|
554
|
-
return 2;
|
|
555
|
-
}
|
|
556
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
557
|
-
return 1;
|
|
558
|
-
}
|
|
559
|
-
if ("COLORTERM" in env) {
|
|
560
|
-
return 1;
|
|
561
|
-
}
|
|
562
|
-
return min;
|
|
563
|
-
}
|
|
564
|
-
function getSupportLevel(stream) {
|
|
565
|
-
const level = supportsColor(stream, stream && stream.isTTY);
|
|
566
|
-
return translateLevel(level);
|
|
567
|
-
}
|
|
568
|
-
module.exports = {
|
|
569
|
-
supportsColor: getSupportLevel,
|
|
570
|
-
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
|
|
571
|
-
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
|
|
572
|
-
};
|
|
573
|
-
});
|
|
574
|
-
|
|
575
|
-
// ../../node_modules/.bun/debug@4.4.3/node_modules/debug/src/node.js
|
|
576
|
-
var require_node = __commonJS((exports, module) => {
|
|
577
|
-
var tty = __require("tty");
|
|
578
|
-
var util = __require("util");
|
|
579
|
-
exports.init = init;
|
|
580
|
-
exports.log = log;
|
|
581
|
-
exports.formatArgs = formatArgs;
|
|
582
|
-
exports.save = save;
|
|
583
|
-
exports.load = load;
|
|
584
|
-
exports.useColors = useColors;
|
|
585
|
-
exports.destroy = util.deprecate(() => {}, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
586
|
-
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
587
|
-
try {
|
|
588
|
-
const supportsColor = require_supports_color();
|
|
589
|
-
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
|
590
|
-
exports.colors = [
|
|
591
|
-
20,
|
|
592
|
-
21,
|
|
593
|
-
26,
|
|
594
|
-
27,
|
|
595
|
-
32,
|
|
596
|
-
33,
|
|
597
|
-
38,
|
|
598
|
-
39,
|
|
599
|
-
40,
|
|
600
|
-
41,
|
|
601
|
-
42,
|
|
602
|
-
43,
|
|
603
|
-
44,
|
|
604
|
-
45,
|
|
605
|
-
56,
|
|
606
|
-
57,
|
|
607
|
-
62,
|
|
608
|
-
63,
|
|
609
|
-
68,
|
|
610
|
-
69,
|
|
611
|
-
74,
|
|
612
|
-
75,
|
|
613
|
-
76,
|
|
614
|
-
77,
|
|
615
|
-
78,
|
|
616
|
-
79,
|
|
617
|
-
80,
|
|
618
|
-
81,
|
|
619
|
-
92,
|
|
620
|
-
93,
|
|
621
|
-
98,
|
|
622
|
-
99,
|
|
623
|
-
112,
|
|
624
|
-
113,
|
|
625
|
-
128,
|
|
626
|
-
129,
|
|
627
|
-
134,
|
|
628
|
-
135,
|
|
629
|
-
148,
|
|
630
|
-
149,
|
|
631
|
-
160,
|
|
632
|
-
161,
|
|
633
|
-
162,
|
|
634
|
-
163,
|
|
635
|
-
164,
|
|
636
|
-
165,
|
|
637
|
-
166,
|
|
638
|
-
167,
|
|
639
|
-
168,
|
|
640
|
-
169,
|
|
641
|
-
170,
|
|
642
|
-
171,
|
|
643
|
-
172,
|
|
644
|
-
173,
|
|
645
|
-
178,
|
|
646
|
-
179,
|
|
647
|
-
184,
|
|
648
|
-
185,
|
|
649
|
-
196,
|
|
650
|
-
197,
|
|
651
|
-
198,
|
|
652
|
-
199,
|
|
653
|
-
200,
|
|
654
|
-
201,
|
|
655
|
-
202,
|
|
656
|
-
203,
|
|
657
|
-
204,
|
|
658
|
-
205,
|
|
659
|
-
206,
|
|
660
|
-
207,
|
|
661
|
-
208,
|
|
662
|
-
209,
|
|
663
|
-
214,
|
|
664
|
-
215,
|
|
665
|
-
220,
|
|
666
|
-
221
|
|
667
|
-
];
|
|
668
|
-
}
|
|
669
|
-
} catch (error) {}
|
|
670
|
-
exports.inspectOpts = Object.keys(process.env).filter((key) => {
|
|
671
|
-
return /^debug_/i.test(key);
|
|
672
|
-
}).reduce((obj, key) => {
|
|
673
|
-
const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
|
|
674
|
-
return k.toUpperCase();
|
|
675
|
-
});
|
|
676
|
-
let val = process.env[key];
|
|
677
|
-
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
|
678
|
-
val = true;
|
|
679
|
-
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
|
680
|
-
val = false;
|
|
681
|
-
} else if (val === "null") {
|
|
682
|
-
val = null;
|
|
683
|
-
} else {
|
|
684
|
-
val = Number(val);
|
|
685
|
-
}
|
|
686
|
-
obj[prop] = val;
|
|
687
|
-
return obj;
|
|
688
|
-
}, {});
|
|
689
|
-
function useColors() {
|
|
690
|
-
return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
|
|
691
|
-
}
|
|
692
|
-
function formatArgs(args) {
|
|
693
|
-
const { namespace: name, useColors: useColors2 } = this;
|
|
694
|
-
if (useColors2) {
|
|
695
|
-
const c = this.color;
|
|
696
|
-
const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
|
|
697
|
-
const prefix = ` ${colorCode};1m${name} \x1B[0m`;
|
|
698
|
-
args[0] = prefix + args[0].split(`
|
|
699
|
-
`).join(`
|
|
700
|
-
` + prefix);
|
|
701
|
-
args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
|
|
702
|
-
} else {
|
|
703
|
-
args[0] = getDate() + name + " " + args[0];
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
function getDate() {
|
|
707
|
-
if (exports.inspectOpts.hideDate) {
|
|
708
|
-
return "";
|
|
709
|
-
}
|
|
710
|
-
return new Date().toISOString() + " ";
|
|
711
|
-
}
|
|
712
|
-
function log(...args) {
|
|
713
|
-
return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + `
|
|
714
|
-
`);
|
|
715
|
-
}
|
|
716
|
-
function save(namespaces) {
|
|
717
|
-
if (namespaces) {
|
|
718
|
-
process.env.DEBUG = namespaces;
|
|
719
|
-
} else {
|
|
720
|
-
delete process.env.DEBUG;
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
function load() {
|
|
724
|
-
return process.env.DEBUG;
|
|
725
|
-
}
|
|
726
|
-
function init(debug) {
|
|
727
|
-
debug.inspectOpts = {};
|
|
728
|
-
const keys = Object.keys(exports.inspectOpts);
|
|
729
|
-
for (let i = 0;i < keys.length; i++) {
|
|
730
|
-
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
module.exports = require_common()(exports);
|
|
734
|
-
var { formatters } = module.exports;
|
|
735
|
-
formatters.o = function(v) {
|
|
736
|
-
this.inspectOpts.colors = this.useColors;
|
|
737
|
-
return util.inspect(v, this.inspectOpts).split(`
|
|
738
|
-
`).map((str) => str.trim()).join(" ");
|
|
739
|
-
};
|
|
740
|
-
formatters.O = function(v) {
|
|
741
|
-
this.inspectOpts.colors = this.useColors;
|
|
742
|
-
return util.inspect(v, this.inspectOpts);
|
|
743
|
-
};
|
|
744
|
-
});
|
|
745
|
-
|
|
746
|
-
// ../../node_modules/.bun/debug@4.4.3/node_modules/debug/src/index.js
|
|
747
|
-
var require_src = __commonJS((exports, module) => {
|
|
748
|
-
if (typeof process === "undefined" || process.type === "renderer" || false || process.__nwjs) {
|
|
749
|
-
module.exports = require_browser();
|
|
750
|
-
} else {
|
|
751
|
-
module.exports = require_node();
|
|
752
|
-
}
|
|
753
|
-
});
|
|
754
|
-
|
|
755
|
-
// ../../node_modules/.bun/@kwsites+file-exists@1.1.1/node_modules/@kwsites/file-exists/dist/src/index.js
|
|
756
|
-
var require_src2 = __commonJS((exports) => {
|
|
757
|
-
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
758
|
-
return mod && mod.__esModule ? mod : { default: mod };
|
|
759
|
-
};
|
|
760
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
761
|
-
var fs_1 = __require("fs");
|
|
762
|
-
var debug_1 = __importDefault(require_src());
|
|
763
|
-
var log = debug_1.default("@kwsites/file-exists");
|
|
764
|
-
function check(path, isFile, isDirectory) {
|
|
765
|
-
log(`checking %s`, path);
|
|
766
|
-
try {
|
|
767
|
-
const stat = fs_1.statSync(path);
|
|
768
|
-
if (stat.isFile() && isFile) {
|
|
769
|
-
log(`[OK] path represents a file`);
|
|
770
|
-
return true;
|
|
771
|
-
}
|
|
772
|
-
if (stat.isDirectory() && isDirectory) {
|
|
773
|
-
log(`[OK] path represents a directory`);
|
|
774
|
-
return true;
|
|
775
|
-
}
|
|
776
|
-
log(`[FAIL] path represents something other than a file or directory`);
|
|
777
|
-
return false;
|
|
778
|
-
} catch (e) {
|
|
779
|
-
if (e.code === "ENOENT") {
|
|
780
|
-
log(`[FAIL] path is not accessible: %o`, e);
|
|
781
|
-
return false;
|
|
782
|
-
}
|
|
783
|
-
log(`[FATAL] %o`, e);
|
|
784
|
-
throw e;
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
function exists(path, type = exports.READABLE) {
|
|
788
|
-
return check(path, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
|
|
789
|
-
}
|
|
790
|
-
exports.exists = exists;
|
|
791
|
-
exports.FILE = 1;
|
|
792
|
-
exports.FOLDER = 2;
|
|
793
|
-
exports.READABLE = exports.FILE + exports.FOLDER;
|
|
794
|
-
});
|
|
795
|
-
|
|
796
|
-
// ../../node_modules/.bun/@kwsites+file-exists@1.1.1/node_modules/@kwsites/file-exists/dist/index.js
|
|
797
|
-
var require_dist = __commonJS((exports) => {
|
|
798
|
-
function __export(m) {
|
|
799
|
-
for (var p in m)
|
|
800
|
-
if (!exports.hasOwnProperty(p))
|
|
801
|
-
exports[p] = m[p];
|
|
802
|
-
}
|
|
803
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
804
|
-
__export(require_src2());
|
|
805
|
-
});
|
|
806
|
-
|
|
807
|
-
// ../../node_modules/.bun/@kwsites+promise-deferred@1.1.1/node_modules/@kwsites/promise-deferred/dist/index.js
|
|
808
|
-
var require_dist2 = __commonJS((exports) => {
|
|
809
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
810
|
-
exports.createDeferred = exports.deferred = undefined;
|
|
811
|
-
function deferred() {
|
|
812
|
-
let done;
|
|
813
|
-
let fail;
|
|
814
|
-
let status = "pending";
|
|
815
|
-
const promise = new Promise((_done, _fail) => {
|
|
816
|
-
done = _done;
|
|
817
|
-
fail = _fail;
|
|
818
|
-
});
|
|
819
|
-
return {
|
|
820
|
-
promise,
|
|
821
|
-
done(result) {
|
|
822
|
-
if (status === "pending") {
|
|
823
|
-
status = "resolved";
|
|
824
|
-
done(result);
|
|
825
|
-
}
|
|
826
|
-
},
|
|
827
|
-
fail(error) {
|
|
828
|
-
if (status === "pending") {
|
|
829
|
-
status = "rejected";
|
|
830
|
-
fail(error);
|
|
831
|
-
}
|
|
832
|
-
},
|
|
833
|
-
get fulfilled() {
|
|
834
|
-
return status !== "pending";
|
|
835
|
-
},
|
|
836
|
-
get status() {
|
|
837
|
-
return status;
|
|
838
|
-
}
|
|
839
|
-
};
|
|
840
|
-
}
|
|
841
|
-
exports.deferred = deferred;
|
|
842
|
-
exports.createDeferred = deferred;
|
|
843
|
-
exports.default = deferred;
|
|
844
|
-
});
|
|
845
|
-
|
|
846
1
|
// src/index.ts
|
|
847
2
|
import * as fs from "fs";
|
|
848
3
|
import * as path from "path";
|
|
4
|
+
import { simpleGit } from "simple-git";
|
|
849
5
|
|
|
850
|
-
// ../../node_modules/.bun/simple-git@3.30.0/node_modules/simple-git/dist/esm/index.js
|
|
851
|
-
var import_file_exists = __toESM(require_dist(), 1);
|
|
852
|
-
var import_debug = __toESM(require_src(), 1);
|
|
853
|
-
var import_promise_deferred = __toESM(require_dist2(), 1);
|
|
854
|
-
var import_promise_deferred2 = __toESM(require_dist2(), 1);
|
|
855
|
-
import { Buffer as Buffer2 } from "node:buffer";
|
|
856
|
-
import { spawn } from "child_process";
|
|
857
|
-
import { normalize } from "node:path";
|
|
858
|
-
import { EventEmitter } from "node:events";
|
|
859
|
-
var __defProp2 = Object.defineProperty;
|
|
860
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
861
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
862
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
863
|
-
var __esm = (fn, res) => function __init() {
|
|
864
|
-
return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
|
|
865
|
-
};
|
|
866
|
-
var __commonJS2 = (cb, mod) => function __require() {
|
|
867
|
-
return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
868
|
-
};
|
|
869
|
-
var __export = (target, all) => {
|
|
870
|
-
for (var name in all)
|
|
871
|
-
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
872
|
-
};
|
|
873
|
-
var __copyProps = (to, from, except, desc) => {
|
|
874
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
875
|
-
for (let key of __getOwnPropNames2(from))
|
|
876
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
877
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
878
|
-
}
|
|
879
|
-
return to;
|
|
880
|
-
};
|
|
881
|
-
var __toCommonJS = (mod) => __copyProps(__defProp2({}, "__esModule", { value: true }), mod);
|
|
882
|
-
function pathspec(...paths) {
|
|
883
|
-
const key = new String(paths);
|
|
884
|
-
cache.set(key, paths);
|
|
885
|
-
return key;
|
|
886
|
-
}
|
|
887
|
-
function isPathSpec(path) {
|
|
888
|
-
return path instanceof String && cache.has(path);
|
|
889
|
-
}
|
|
890
|
-
function toPaths(pathSpec) {
|
|
891
|
-
return cache.get(pathSpec) || [];
|
|
892
|
-
}
|
|
893
|
-
var cache;
|
|
894
|
-
var init_pathspec = __esm({
|
|
895
|
-
"src/lib/args/pathspec.ts"() {
|
|
896
|
-
cache = /* @__PURE__ */ new WeakMap;
|
|
897
|
-
}
|
|
898
|
-
});
|
|
899
|
-
var GitError;
|
|
900
|
-
var init_git_error = __esm({
|
|
901
|
-
"src/lib/errors/git-error.ts"() {
|
|
902
|
-
GitError = class extends Error {
|
|
903
|
-
constructor(task, message) {
|
|
904
|
-
super(message);
|
|
905
|
-
this.task = task;
|
|
906
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
907
|
-
}
|
|
908
|
-
};
|
|
909
|
-
}
|
|
910
|
-
});
|
|
911
|
-
var GitResponseError;
|
|
912
|
-
var init_git_response_error = __esm({
|
|
913
|
-
"src/lib/errors/git-response-error.ts"() {
|
|
914
|
-
init_git_error();
|
|
915
|
-
GitResponseError = class extends GitError {
|
|
916
|
-
constructor(git, message) {
|
|
917
|
-
super(undefined, message || String(git));
|
|
918
|
-
this.git = git;
|
|
919
|
-
}
|
|
920
|
-
};
|
|
921
|
-
}
|
|
922
|
-
});
|
|
923
|
-
var TaskConfigurationError;
|
|
924
|
-
var init_task_configuration_error = __esm({
|
|
925
|
-
"src/lib/errors/task-configuration-error.ts"() {
|
|
926
|
-
init_git_error();
|
|
927
|
-
TaskConfigurationError = class extends GitError {
|
|
928
|
-
constructor(message) {
|
|
929
|
-
super(undefined, message);
|
|
930
|
-
}
|
|
931
|
-
};
|
|
932
|
-
}
|
|
933
|
-
});
|
|
934
|
-
function asFunction(source) {
|
|
935
|
-
if (typeof source !== "function") {
|
|
936
|
-
return NOOP;
|
|
937
|
-
}
|
|
938
|
-
return source;
|
|
939
|
-
}
|
|
940
|
-
function isUserFunction(source) {
|
|
941
|
-
return typeof source === "function" && source !== NOOP;
|
|
942
|
-
}
|
|
943
|
-
function splitOn(input, char) {
|
|
944
|
-
const index = input.indexOf(char);
|
|
945
|
-
if (index <= 0) {
|
|
946
|
-
return [input, ""];
|
|
947
|
-
}
|
|
948
|
-
return [input.substr(0, index), input.substr(index + 1)];
|
|
949
|
-
}
|
|
950
|
-
function first(input, offset = 0) {
|
|
951
|
-
return isArrayLike(input) && input.length > offset ? input[offset] : undefined;
|
|
952
|
-
}
|
|
953
|
-
function last(input, offset = 0) {
|
|
954
|
-
if (isArrayLike(input) && input.length > offset) {
|
|
955
|
-
return input[input.length - 1 - offset];
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
function isArrayLike(input) {
|
|
959
|
-
return filterHasLength(input);
|
|
960
|
-
}
|
|
961
|
-
function toLinesWithContent(input = "", trimmed2 = true, separator = `
|
|
962
|
-
`) {
|
|
963
|
-
return input.split(separator).reduce((output, line) => {
|
|
964
|
-
const lineContent = trimmed2 ? line.trim() : line;
|
|
965
|
-
if (lineContent) {
|
|
966
|
-
output.push(lineContent);
|
|
967
|
-
}
|
|
968
|
-
return output;
|
|
969
|
-
}, []);
|
|
970
|
-
}
|
|
971
|
-
function forEachLineWithContent(input, callback) {
|
|
972
|
-
return toLinesWithContent(input, true).map((line) => callback(line));
|
|
973
|
-
}
|
|
974
|
-
function folderExists(path) {
|
|
975
|
-
return import_file_exists.exists(path, import_file_exists.FOLDER);
|
|
976
|
-
}
|
|
977
|
-
function append(target, item) {
|
|
978
|
-
if (Array.isArray(target)) {
|
|
979
|
-
if (!target.includes(item)) {
|
|
980
|
-
target.push(item);
|
|
981
|
-
}
|
|
982
|
-
} else {
|
|
983
|
-
target.add(item);
|
|
984
|
-
}
|
|
985
|
-
return item;
|
|
986
|
-
}
|
|
987
|
-
function including(target, item) {
|
|
988
|
-
if (Array.isArray(target) && !target.includes(item)) {
|
|
989
|
-
target.push(item);
|
|
990
|
-
}
|
|
991
|
-
return target;
|
|
992
|
-
}
|
|
993
|
-
function remove(target, item) {
|
|
994
|
-
if (Array.isArray(target)) {
|
|
995
|
-
const index = target.indexOf(item);
|
|
996
|
-
if (index >= 0) {
|
|
997
|
-
target.splice(index, 1);
|
|
998
|
-
}
|
|
999
|
-
} else {
|
|
1000
|
-
target.delete(item);
|
|
1001
|
-
}
|
|
1002
|
-
return item;
|
|
1003
|
-
}
|
|
1004
|
-
function asArray(source) {
|
|
1005
|
-
return Array.isArray(source) ? source : [source];
|
|
1006
|
-
}
|
|
1007
|
-
function asCamelCase(str) {
|
|
1008
|
-
return str.replace(/[\s-]+(.)/g, (_all, chr) => {
|
|
1009
|
-
return chr.toUpperCase();
|
|
1010
|
-
});
|
|
1011
|
-
}
|
|
1012
|
-
function asStringArray(source) {
|
|
1013
|
-
return asArray(source).map((item) => {
|
|
1014
|
-
return item instanceof String ? item : String(item);
|
|
1015
|
-
});
|
|
1016
|
-
}
|
|
1017
|
-
function asNumber(source, onNaN = 0) {
|
|
1018
|
-
if (source == null) {
|
|
1019
|
-
return onNaN;
|
|
1020
|
-
}
|
|
1021
|
-
const num = parseInt(source, 10);
|
|
1022
|
-
return Number.isNaN(num) ? onNaN : num;
|
|
1023
|
-
}
|
|
1024
|
-
function prefixedArray(input, prefix) {
|
|
1025
|
-
const output = [];
|
|
1026
|
-
for (let i = 0, max = input.length;i < max; i++) {
|
|
1027
|
-
output.push(prefix, input[i]);
|
|
1028
|
-
}
|
|
1029
|
-
return output;
|
|
1030
|
-
}
|
|
1031
|
-
function bufferToString(input) {
|
|
1032
|
-
return (Array.isArray(input) ? Buffer2.concat(input) : input).toString("utf-8");
|
|
1033
|
-
}
|
|
1034
|
-
function pick(source, properties) {
|
|
1035
|
-
const out = {};
|
|
1036
|
-
properties.forEach((key) => {
|
|
1037
|
-
if (source[key] !== undefined) {
|
|
1038
|
-
out[key] = source[key];
|
|
1039
|
-
}
|
|
1040
|
-
});
|
|
1041
|
-
return out;
|
|
1042
|
-
}
|
|
1043
|
-
function delay(duration = 0) {
|
|
1044
|
-
return new Promise((done) => setTimeout(done, duration));
|
|
1045
|
-
}
|
|
1046
|
-
function orVoid(input) {
|
|
1047
|
-
if (input === false) {
|
|
1048
|
-
return;
|
|
1049
|
-
}
|
|
1050
|
-
return input;
|
|
1051
|
-
}
|
|
1052
|
-
var NULL;
|
|
1053
|
-
var NOOP;
|
|
1054
|
-
var objectToString;
|
|
1055
|
-
var init_util = __esm({
|
|
1056
|
-
"src/lib/utils/util.ts"() {
|
|
1057
|
-
init_argument_filters();
|
|
1058
|
-
NULL = "\x00";
|
|
1059
|
-
NOOP = () => {};
|
|
1060
|
-
objectToString = Object.prototype.toString.call.bind(Object.prototype.toString);
|
|
1061
|
-
}
|
|
1062
|
-
});
|
|
1063
|
-
function filterType(input, filter, def) {
|
|
1064
|
-
if (filter(input)) {
|
|
1065
|
-
return input;
|
|
1066
|
-
}
|
|
1067
|
-
return arguments.length > 2 ? def : undefined;
|
|
1068
|
-
}
|
|
1069
|
-
function filterPrimitives(input, omit) {
|
|
1070
|
-
const type = isPathSpec(input) ? "string" : typeof input;
|
|
1071
|
-
return /number|string|boolean/.test(type) && (!omit || !omit.includes(type));
|
|
1072
|
-
}
|
|
1073
|
-
function filterPlainObject(input) {
|
|
1074
|
-
return !!input && objectToString(input) === "[object Object]";
|
|
1075
|
-
}
|
|
1076
|
-
function filterFunction(input) {
|
|
1077
|
-
return typeof input === "function";
|
|
1078
|
-
}
|
|
1079
|
-
var filterArray;
|
|
1080
|
-
var filterNumber;
|
|
1081
|
-
var filterString;
|
|
1082
|
-
var filterStringOrStringArray;
|
|
1083
|
-
var filterHasLength;
|
|
1084
|
-
var init_argument_filters = __esm({
|
|
1085
|
-
"src/lib/utils/argument-filters.ts"() {
|
|
1086
|
-
init_pathspec();
|
|
1087
|
-
init_util();
|
|
1088
|
-
filterArray = (input) => {
|
|
1089
|
-
return Array.isArray(input);
|
|
1090
|
-
};
|
|
1091
|
-
filterNumber = (input) => {
|
|
1092
|
-
return typeof input === "number";
|
|
1093
|
-
};
|
|
1094
|
-
filterString = (input) => {
|
|
1095
|
-
return typeof input === "string";
|
|
1096
|
-
};
|
|
1097
|
-
filterStringOrStringArray = (input) => {
|
|
1098
|
-
return filterString(input) || Array.isArray(input) && input.every(filterString);
|
|
1099
|
-
};
|
|
1100
|
-
filterHasLength = (input) => {
|
|
1101
|
-
if (input == null || "number|boolean|function".includes(typeof input)) {
|
|
1102
|
-
return false;
|
|
1103
|
-
}
|
|
1104
|
-
return typeof input.length === "number";
|
|
1105
|
-
};
|
|
1106
|
-
}
|
|
1107
|
-
});
|
|
1108
|
-
var ExitCodes;
|
|
1109
|
-
var init_exit_codes = __esm({
|
|
1110
|
-
"src/lib/utils/exit-codes.ts"() {
|
|
1111
|
-
ExitCodes = /* @__PURE__ */ ((ExitCodes2) => {
|
|
1112
|
-
ExitCodes2[ExitCodes2["SUCCESS"] = 0] = "SUCCESS";
|
|
1113
|
-
ExitCodes2[ExitCodes2["ERROR"] = 1] = "ERROR";
|
|
1114
|
-
ExitCodes2[ExitCodes2["NOT_FOUND"] = -2] = "NOT_FOUND";
|
|
1115
|
-
ExitCodes2[ExitCodes2["UNCLEAN"] = 128] = "UNCLEAN";
|
|
1116
|
-
return ExitCodes2;
|
|
1117
|
-
})(ExitCodes || {});
|
|
1118
|
-
}
|
|
1119
|
-
});
|
|
1120
|
-
var GitOutputStreams;
|
|
1121
|
-
var init_git_output_streams = __esm({
|
|
1122
|
-
"src/lib/utils/git-output-streams.ts"() {
|
|
1123
|
-
GitOutputStreams = class _GitOutputStreams {
|
|
1124
|
-
constructor(stdOut, stdErr) {
|
|
1125
|
-
this.stdOut = stdOut;
|
|
1126
|
-
this.stdErr = stdErr;
|
|
1127
|
-
}
|
|
1128
|
-
asStrings() {
|
|
1129
|
-
return new _GitOutputStreams(this.stdOut.toString("utf8"), this.stdErr.toString("utf8"));
|
|
1130
|
-
}
|
|
1131
|
-
};
|
|
1132
|
-
}
|
|
1133
|
-
});
|
|
1134
|
-
function useMatchesDefault() {
|
|
1135
|
-
throw new Error(`LineParser:useMatches not implemented`);
|
|
1136
|
-
}
|
|
1137
|
-
var LineParser;
|
|
1138
|
-
var RemoteLineParser;
|
|
1139
|
-
var init_line_parser = __esm({
|
|
1140
|
-
"src/lib/utils/line-parser.ts"() {
|
|
1141
|
-
LineParser = class {
|
|
1142
|
-
constructor(regExp, useMatches) {
|
|
1143
|
-
this.matches = [];
|
|
1144
|
-
this.useMatches = useMatchesDefault;
|
|
1145
|
-
this.parse = (line, target) => {
|
|
1146
|
-
this.resetMatches();
|
|
1147
|
-
if (!this._regExp.every((reg, index) => this.addMatch(reg, index, line(index)))) {
|
|
1148
|
-
return false;
|
|
1149
|
-
}
|
|
1150
|
-
return this.useMatches(target, this.prepareMatches()) !== false;
|
|
1151
|
-
};
|
|
1152
|
-
this._regExp = Array.isArray(regExp) ? regExp : [regExp];
|
|
1153
|
-
if (useMatches) {
|
|
1154
|
-
this.useMatches = useMatches;
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
resetMatches() {
|
|
1158
|
-
this.matches.length = 0;
|
|
1159
|
-
}
|
|
1160
|
-
prepareMatches() {
|
|
1161
|
-
return this.matches;
|
|
1162
|
-
}
|
|
1163
|
-
addMatch(reg, index, line) {
|
|
1164
|
-
const matched = line && reg.exec(line);
|
|
1165
|
-
if (matched) {
|
|
1166
|
-
this.pushMatch(index, matched);
|
|
1167
|
-
}
|
|
1168
|
-
return !!matched;
|
|
1169
|
-
}
|
|
1170
|
-
pushMatch(_index, matched) {
|
|
1171
|
-
this.matches.push(...matched.slice(1));
|
|
1172
|
-
}
|
|
1173
|
-
};
|
|
1174
|
-
RemoteLineParser = class extends LineParser {
|
|
1175
|
-
addMatch(reg, index, line) {
|
|
1176
|
-
return /^remote:\s/.test(String(line)) && super.addMatch(reg, index, line);
|
|
1177
|
-
}
|
|
1178
|
-
pushMatch(index, matched) {
|
|
1179
|
-
if (index > 0 || matched.length > 1) {
|
|
1180
|
-
super.pushMatch(index, matched);
|
|
1181
|
-
}
|
|
1182
|
-
}
|
|
1183
|
-
};
|
|
1184
|
-
}
|
|
1185
|
-
});
|
|
1186
|
-
function createInstanceConfig(...options) {
|
|
1187
|
-
const baseDir = process.cwd();
|
|
1188
|
-
const config = Object.assign({ baseDir, ...defaultOptions }, ...options.filter((o) => typeof o === "object" && o));
|
|
1189
|
-
config.baseDir = config.baseDir || baseDir;
|
|
1190
|
-
config.trimmed = config.trimmed === true;
|
|
1191
|
-
return config;
|
|
1192
|
-
}
|
|
1193
|
-
var defaultOptions;
|
|
1194
|
-
var init_simple_git_options = __esm({
|
|
1195
|
-
"src/lib/utils/simple-git-options.ts"() {
|
|
1196
|
-
defaultOptions = {
|
|
1197
|
-
binary: "git",
|
|
1198
|
-
maxConcurrentProcesses: 5,
|
|
1199
|
-
config: [],
|
|
1200
|
-
trimmed: false
|
|
1201
|
-
};
|
|
1202
|
-
}
|
|
1203
|
-
});
|
|
1204
|
-
function appendTaskOptions(options, commands = []) {
|
|
1205
|
-
if (!filterPlainObject(options)) {
|
|
1206
|
-
return commands;
|
|
1207
|
-
}
|
|
1208
|
-
return Object.keys(options).reduce((commands2, key) => {
|
|
1209
|
-
const value = options[key];
|
|
1210
|
-
if (isPathSpec(value)) {
|
|
1211
|
-
commands2.push(value);
|
|
1212
|
-
} else if (filterPrimitives(value, ["boolean"])) {
|
|
1213
|
-
commands2.push(key + "=" + value);
|
|
1214
|
-
} else if (Array.isArray(value)) {
|
|
1215
|
-
for (const v of value) {
|
|
1216
|
-
if (!filterPrimitives(v, ["string", "number"])) {
|
|
1217
|
-
commands2.push(key + "=" + v);
|
|
1218
|
-
}
|
|
1219
|
-
}
|
|
1220
|
-
} else {
|
|
1221
|
-
commands2.push(key);
|
|
1222
|
-
}
|
|
1223
|
-
return commands2;
|
|
1224
|
-
}, commands);
|
|
1225
|
-
}
|
|
1226
|
-
function getTrailingOptions(args, initialPrimitive = 0, objectOnly = false) {
|
|
1227
|
-
const command = [];
|
|
1228
|
-
for (let i = 0, max = initialPrimitive < 0 ? args.length : initialPrimitive;i < max; i++) {
|
|
1229
|
-
if ("string|number".includes(typeof args[i])) {
|
|
1230
|
-
command.push(String(args[i]));
|
|
1231
|
-
}
|
|
1232
|
-
}
|
|
1233
|
-
appendTaskOptions(trailingOptionsArgument(args), command);
|
|
1234
|
-
if (!objectOnly) {
|
|
1235
|
-
command.push(...trailingArrayArgument(args));
|
|
1236
|
-
}
|
|
1237
|
-
return command;
|
|
1238
|
-
}
|
|
1239
|
-
function trailingArrayArgument(args) {
|
|
1240
|
-
const hasTrailingCallback = typeof last(args) === "function";
|
|
1241
|
-
return asStringArray(filterType(last(args, hasTrailingCallback ? 1 : 0), filterArray, []));
|
|
1242
|
-
}
|
|
1243
|
-
function trailingOptionsArgument(args) {
|
|
1244
|
-
const hasTrailingCallback = filterFunction(last(args));
|
|
1245
|
-
return filterType(last(args, hasTrailingCallback ? 1 : 0), filterPlainObject);
|
|
1246
|
-
}
|
|
1247
|
-
function trailingFunctionArgument(args, includeNoop = true) {
|
|
1248
|
-
const callback = asFunction(last(args));
|
|
1249
|
-
return includeNoop || isUserFunction(callback) ? callback : undefined;
|
|
1250
|
-
}
|
|
1251
|
-
var init_task_options = __esm({
|
|
1252
|
-
"src/lib/utils/task-options.ts"() {
|
|
1253
|
-
init_argument_filters();
|
|
1254
|
-
init_util();
|
|
1255
|
-
init_pathspec();
|
|
1256
|
-
}
|
|
1257
|
-
});
|
|
1258
|
-
function callTaskParser(parser4, streams) {
|
|
1259
|
-
return parser4(streams.stdOut, streams.stdErr);
|
|
1260
|
-
}
|
|
1261
|
-
function parseStringResponse(result, parsers12, texts, trim = true) {
|
|
1262
|
-
asArray(texts).forEach((text) => {
|
|
1263
|
-
for (let lines = toLinesWithContent(text, trim), i = 0, max = lines.length;i < max; i++) {
|
|
1264
|
-
const line = (offset = 0) => {
|
|
1265
|
-
if (i + offset >= max) {
|
|
1266
|
-
return;
|
|
1267
|
-
}
|
|
1268
|
-
return lines[i + offset];
|
|
1269
|
-
};
|
|
1270
|
-
parsers12.some(({ parse }) => parse(line, result));
|
|
1271
|
-
}
|
|
1272
|
-
});
|
|
1273
|
-
return result;
|
|
1274
|
-
}
|
|
1275
|
-
var init_task_parser = __esm({
|
|
1276
|
-
"src/lib/utils/task-parser.ts"() {
|
|
1277
|
-
init_util();
|
|
1278
|
-
}
|
|
1279
|
-
});
|
|
1280
|
-
var utils_exports = {};
|
|
1281
|
-
__export(utils_exports, {
|
|
1282
|
-
ExitCodes: () => ExitCodes,
|
|
1283
|
-
GitOutputStreams: () => GitOutputStreams,
|
|
1284
|
-
LineParser: () => LineParser,
|
|
1285
|
-
NOOP: () => NOOP,
|
|
1286
|
-
NULL: () => NULL,
|
|
1287
|
-
RemoteLineParser: () => RemoteLineParser,
|
|
1288
|
-
append: () => append,
|
|
1289
|
-
appendTaskOptions: () => appendTaskOptions,
|
|
1290
|
-
asArray: () => asArray,
|
|
1291
|
-
asCamelCase: () => asCamelCase,
|
|
1292
|
-
asFunction: () => asFunction,
|
|
1293
|
-
asNumber: () => asNumber,
|
|
1294
|
-
asStringArray: () => asStringArray,
|
|
1295
|
-
bufferToString: () => bufferToString,
|
|
1296
|
-
callTaskParser: () => callTaskParser,
|
|
1297
|
-
createInstanceConfig: () => createInstanceConfig,
|
|
1298
|
-
delay: () => delay,
|
|
1299
|
-
filterArray: () => filterArray,
|
|
1300
|
-
filterFunction: () => filterFunction,
|
|
1301
|
-
filterHasLength: () => filterHasLength,
|
|
1302
|
-
filterNumber: () => filterNumber,
|
|
1303
|
-
filterPlainObject: () => filterPlainObject,
|
|
1304
|
-
filterPrimitives: () => filterPrimitives,
|
|
1305
|
-
filterString: () => filterString,
|
|
1306
|
-
filterStringOrStringArray: () => filterStringOrStringArray,
|
|
1307
|
-
filterType: () => filterType,
|
|
1308
|
-
first: () => first,
|
|
1309
|
-
folderExists: () => folderExists,
|
|
1310
|
-
forEachLineWithContent: () => forEachLineWithContent,
|
|
1311
|
-
getTrailingOptions: () => getTrailingOptions,
|
|
1312
|
-
including: () => including,
|
|
1313
|
-
isUserFunction: () => isUserFunction,
|
|
1314
|
-
last: () => last,
|
|
1315
|
-
objectToString: () => objectToString,
|
|
1316
|
-
orVoid: () => orVoid,
|
|
1317
|
-
parseStringResponse: () => parseStringResponse,
|
|
1318
|
-
pick: () => pick,
|
|
1319
|
-
prefixedArray: () => prefixedArray,
|
|
1320
|
-
remove: () => remove,
|
|
1321
|
-
splitOn: () => splitOn,
|
|
1322
|
-
toLinesWithContent: () => toLinesWithContent,
|
|
1323
|
-
trailingFunctionArgument: () => trailingFunctionArgument,
|
|
1324
|
-
trailingOptionsArgument: () => trailingOptionsArgument
|
|
1325
|
-
});
|
|
1326
|
-
var init_utils = __esm({
|
|
1327
|
-
"src/lib/utils/index.ts"() {
|
|
1328
|
-
init_argument_filters();
|
|
1329
|
-
init_exit_codes();
|
|
1330
|
-
init_git_output_streams();
|
|
1331
|
-
init_line_parser();
|
|
1332
|
-
init_simple_git_options();
|
|
1333
|
-
init_task_options();
|
|
1334
|
-
init_task_parser();
|
|
1335
|
-
init_util();
|
|
1336
|
-
}
|
|
1337
|
-
});
|
|
1338
|
-
var check_is_repo_exports = {};
|
|
1339
|
-
__export(check_is_repo_exports, {
|
|
1340
|
-
CheckRepoActions: () => CheckRepoActions,
|
|
1341
|
-
checkIsBareRepoTask: () => checkIsBareRepoTask,
|
|
1342
|
-
checkIsRepoRootTask: () => checkIsRepoRootTask,
|
|
1343
|
-
checkIsRepoTask: () => checkIsRepoTask
|
|
1344
|
-
});
|
|
1345
|
-
function checkIsRepoTask(action) {
|
|
1346
|
-
switch (action) {
|
|
1347
|
-
case "bare":
|
|
1348
|
-
return checkIsBareRepoTask();
|
|
1349
|
-
case "root":
|
|
1350
|
-
return checkIsRepoRootTask();
|
|
1351
|
-
}
|
|
1352
|
-
const commands = ["rev-parse", "--is-inside-work-tree"];
|
|
1353
|
-
return {
|
|
1354
|
-
commands,
|
|
1355
|
-
format: "utf-8",
|
|
1356
|
-
onError,
|
|
1357
|
-
parser
|
|
1358
|
-
};
|
|
1359
|
-
}
|
|
1360
|
-
function checkIsRepoRootTask() {
|
|
1361
|
-
const commands = ["rev-parse", "--git-dir"];
|
|
1362
|
-
return {
|
|
1363
|
-
commands,
|
|
1364
|
-
format: "utf-8",
|
|
1365
|
-
onError,
|
|
1366
|
-
parser(path) {
|
|
1367
|
-
return /^\.(git)?$/.test(path.trim());
|
|
1368
|
-
}
|
|
1369
|
-
};
|
|
1370
|
-
}
|
|
1371
|
-
function checkIsBareRepoTask() {
|
|
1372
|
-
const commands = ["rev-parse", "--is-bare-repository"];
|
|
1373
|
-
return {
|
|
1374
|
-
commands,
|
|
1375
|
-
format: "utf-8",
|
|
1376
|
-
onError,
|
|
1377
|
-
parser
|
|
1378
|
-
};
|
|
1379
|
-
}
|
|
1380
|
-
function isNotRepoMessage(error) {
|
|
1381
|
-
return /(Not a git repository|Kein Git-Repository)/i.test(String(error));
|
|
1382
|
-
}
|
|
1383
|
-
var CheckRepoActions;
|
|
1384
|
-
var onError;
|
|
1385
|
-
var parser;
|
|
1386
|
-
var init_check_is_repo = __esm({
|
|
1387
|
-
"src/lib/tasks/check-is-repo.ts"() {
|
|
1388
|
-
init_utils();
|
|
1389
|
-
CheckRepoActions = /* @__PURE__ */ ((CheckRepoActions2) => {
|
|
1390
|
-
CheckRepoActions2["BARE"] = "bare";
|
|
1391
|
-
CheckRepoActions2["IN_TREE"] = "tree";
|
|
1392
|
-
CheckRepoActions2["IS_REPO_ROOT"] = "root";
|
|
1393
|
-
return CheckRepoActions2;
|
|
1394
|
-
})(CheckRepoActions || {});
|
|
1395
|
-
onError = ({ exitCode }, error, done, fail) => {
|
|
1396
|
-
if (exitCode === 128 && isNotRepoMessage(error)) {
|
|
1397
|
-
return done(Buffer.from("false"));
|
|
1398
|
-
}
|
|
1399
|
-
fail(error);
|
|
1400
|
-
};
|
|
1401
|
-
parser = (text) => {
|
|
1402
|
-
return text.trim() === "true";
|
|
1403
|
-
};
|
|
1404
|
-
}
|
|
1405
|
-
});
|
|
1406
|
-
function cleanSummaryParser(dryRun, text) {
|
|
1407
|
-
const summary = new CleanResponse(dryRun);
|
|
1408
|
-
const regexp = dryRun ? dryRunRemovalRegexp : removalRegexp;
|
|
1409
|
-
toLinesWithContent(text).forEach((line) => {
|
|
1410
|
-
const removed = line.replace(regexp, "");
|
|
1411
|
-
summary.paths.push(removed);
|
|
1412
|
-
(isFolderRegexp.test(removed) ? summary.folders : summary.files).push(removed);
|
|
1413
|
-
});
|
|
1414
|
-
return summary;
|
|
1415
|
-
}
|
|
1416
|
-
var CleanResponse;
|
|
1417
|
-
var removalRegexp;
|
|
1418
|
-
var dryRunRemovalRegexp;
|
|
1419
|
-
var isFolderRegexp;
|
|
1420
|
-
var init_CleanSummary = __esm({
|
|
1421
|
-
"src/lib/responses/CleanSummary.ts"() {
|
|
1422
|
-
init_utils();
|
|
1423
|
-
CleanResponse = class {
|
|
1424
|
-
constructor(dryRun) {
|
|
1425
|
-
this.dryRun = dryRun;
|
|
1426
|
-
this.paths = [];
|
|
1427
|
-
this.files = [];
|
|
1428
|
-
this.folders = [];
|
|
1429
|
-
}
|
|
1430
|
-
};
|
|
1431
|
-
removalRegexp = /^[a-z]+\s*/i;
|
|
1432
|
-
dryRunRemovalRegexp = /^[a-z]+\s+[a-z]+\s*/i;
|
|
1433
|
-
isFolderRegexp = /\/$/;
|
|
1434
|
-
}
|
|
1435
|
-
});
|
|
1436
|
-
var task_exports = {};
|
|
1437
|
-
__export(task_exports, {
|
|
1438
|
-
EMPTY_COMMANDS: () => EMPTY_COMMANDS,
|
|
1439
|
-
adhocExecTask: () => adhocExecTask,
|
|
1440
|
-
configurationErrorTask: () => configurationErrorTask,
|
|
1441
|
-
isBufferTask: () => isBufferTask,
|
|
1442
|
-
isEmptyTask: () => isEmptyTask,
|
|
1443
|
-
straightThroughBufferTask: () => straightThroughBufferTask,
|
|
1444
|
-
straightThroughStringTask: () => straightThroughStringTask
|
|
1445
|
-
});
|
|
1446
|
-
function adhocExecTask(parser4) {
|
|
1447
|
-
return {
|
|
1448
|
-
commands: EMPTY_COMMANDS,
|
|
1449
|
-
format: "empty",
|
|
1450
|
-
parser: parser4
|
|
1451
|
-
};
|
|
1452
|
-
}
|
|
1453
|
-
function configurationErrorTask(error) {
|
|
1454
|
-
return {
|
|
1455
|
-
commands: EMPTY_COMMANDS,
|
|
1456
|
-
format: "empty",
|
|
1457
|
-
parser() {
|
|
1458
|
-
throw typeof error === "string" ? new TaskConfigurationError(error) : error;
|
|
1459
|
-
}
|
|
1460
|
-
};
|
|
1461
|
-
}
|
|
1462
|
-
function straightThroughStringTask(commands, trimmed2 = false) {
|
|
1463
|
-
return {
|
|
1464
|
-
commands,
|
|
1465
|
-
format: "utf-8",
|
|
1466
|
-
parser(text) {
|
|
1467
|
-
return trimmed2 ? String(text).trim() : text;
|
|
1468
|
-
}
|
|
1469
|
-
};
|
|
1470
|
-
}
|
|
1471
|
-
function straightThroughBufferTask(commands) {
|
|
1472
|
-
return {
|
|
1473
|
-
commands,
|
|
1474
|
-
format: "buffer",
|
|
1475
|
-
parser(buffer) {
|
|
1476
|
-
return buffer;
|
|
1477
|
-
}
|
|
1478
|
-
};
|
|
1479
|
-
}
|
|
1480
|
-
function isBufferTask(task) {
|
|
1481
|
-
return task.format === "buffer";
|
|
1482
|
-
}
|
|
1483
|
-
function isEmptyTask(task) {
|
|
1484
|
-
return task.format === "empty" || !task.commands.length;
|
|
1485
|
-
}
|
|
1486
|
-
var EMPTY_COMMANDS;
|
|
1487
|
-
var init_task = __esm({
|
|
1488
|
-
"src/lib/tasks/task.ts"() {
|
|
1489
|
-
init_task_configuration_error();
|
|
1490
|
-
EMPTY_COMMANDS = [];
|
|
1491
|
-
}
|
|
1492
|
-
});
|
|
1493
|
-
var clean_exports = {};
|
|
1494
|
-
__export(clean_exports, {
|
|
1495
|
-
CONFIG_ERROR_INTERACTIVE_MODE: () => CONFIG_ERROR_INTERACTIVE_MODE,
|
|
1496
|
-
CONFIG_ERROR_MODE_REQUIRED: () => CONFIG_ERROR_MODE_REQUIRED,
|
|
1497
|
-
CONFIG_ERROR_UNKNOWN_OPTION: () => CONFIG_ERROR_UNKNOWN_OPTION,
|
|
1498
|
-
CleanOptions: () => CleanOptions,
|
|
1499
|
-
cleanTask: () => cleanTask,
|
|
1500
|
-
cleanWithOptionsTask: () => cleanWithOptionsTask,
|
|
1501
|
-
isCleanOptionsArray: () => isCleanOptionsArray
|
|
1502
|
-
});
|
|
1503
|
-
function cleanWithOptionsTask(mode, customArgs) {
|
|
1504
|
-
const { cleanMode, options, valid } = getCleanOptions(mode);
|
|
1505
|
-
if (!cleanMode) {
|
|
1506
|
-
return configurationErrorTask(CONFIG_ERROR_MODE_REQUIRED);
|
|
1507
|
-
}
|
|
1508
|
-
if (!valid.options) {
|
|
1509
|
-
return configurationErrorTask(CONFIG_ERROR_UNKNOWN_OPTION + JSON.stringify(mode));
|
|
1510
|
-
}
|
|
1511
|
-
options.push(...customArgs);
|
|
1512
|
-
if (options.some(isInteractiveMode)) {
|
|
1513
|
-
return configurationErrorTask(CONFIG_ERROR_INTERACTIVE_MODE);
|
|
1514
|
-
}
|
|
1515
|
-
return cleanTask(cleanMode, options);
|
|
1516
|
-
}
|
|
1517
|
-
function cleanTask(mode, customArgs) {
|
|
1518
|
-
const commands = ["clean", `-${mode}`, ...customArgs];
|
|
1519
|
-
return {
|
|
1520
|
-
commands,
|
|
1521
|
-
format: "utf-8",
|
|
1522
|
-
parser(text) {
|
|
1523
|
-
return cleanSummaryParser(mode === "n", text);
|
|
1524
|
-
}
|
|
1525
|
-
};
|
|
1526
|
-
}
|
|
1527
|
-
function isCleanOptionsArray(input) {
|
|
1528
|
-
return Array.isArray(input) && input.every((test) => CleanOptionValues.has(test));
|
|
1529
|
-
}
|
|
1530
|
-
function getCleanOptions(input) {
|
|
1531
|
-
let cleanMode;
|
|
1532
|
-
let options = [];
|
|
1533
|
-
let valid = { cleanMode: false, options: true };
|
|
1534
|
-
input.replace(/[^a-z]i/g, "").split("").forEach((char) => {
|
|
1535
|
-
if (isCleanMode(char)) {
|
|
1536
|
-
cleanMode = char;
|
|
1537
|
-
valid.cleanMode = true;
|
|
1538
|
-
} else {
|
|
1539
|
-
valid.options = valid.options && isKnownOption(options[options.length] = `-${char}`);
|
|
1540
|
-
}
|
|
1541
|
-
});
|
|
1542
|
-
return {
|
|
1543
|
-
cleanMode,
|
|
1544
|
-
options,
|
|
1545
|
-
valid
|
|
1546
|
-
};
|
|
1547
|
-
}
|
|
1548
|
-
function isCleanMode(cleanMode) {
|
|
1549
|
-
return cleanMode === "f" || cleanMode === "n";
|
|
1550
|
-
}
|
|
1551
|
-
function isKnownOption(option) {
|
|
1552
|
-
return /^-[a-z]$/i.test(option) && CleanOptionValues.has(option.charAt(1));
|
|
1553
|
-
}
|
|
1554
|
-
function isInteractiveMode(option) {
|
|
1555
|
-
if (/^-[^\-]/.test(option)) {
|
|
1556
|
-
return option.indexOf("i") > 0;
|
|
1557
|
-
}
|
|
1558
|
-
return option === "--interactive";
|
|
1559
|
-
}
|
|
1560
|
-
var CONFIG_ERROR_INTERACTIVE_MODE;
|
|
1561
|
-
var CONFIG_ERROR_MODE_REQUIRED;
|
|
1562
|
-
var CONFIG_ERROR_UNKNOWN_OPTION;
|
|
1563
|
-
var CleanOptions;
|
|
1564
|
-
var CleanOptionValues;
|
|
1565
|
-
var init_clean = __esm({
|
|
1566
|
-
"src/lib/tasks/clean.ts"() {
|
|
1567
|
-
init_CleanSummary();
|
|
1568
|
-
init_utils();
|
|
1569
|
-
init_task();
|
|
1570
|
-
CONFIG_ERROR_INTERACTIVE_MODE = "Git clean interactive mode is not supported";
|
|
1571
|
-
CONFIG_ERROR_MODE_REQUIRED = 'Git clean mode parameter ("n" or "f") is required';
|
|
1572
|
-
CONFIG_ERROR_UNKNOWN_OPTION = "Git clean unknown option found in: ";
|
|
1573
|
-
CleanOptions = /* @__PURE__ */ ((CleanOptions2) => {
|
|
1574
|
-
CleanOptions2["DRY_RUN"] = "n";
|
|
1575
|
-
CleanOptions2["FORCE"] = "f";
|
|
1576
|
-
CleanOptions2["IGNORED_INCLUDED"] = "x";
|
|
1577
|
-
CleanOptions2["IGNORED_ONLY"] = "X";
|
|
1578
|
-
CleanOptions2["EXCLUDING"] = "e";
|
|
1579
|
-
CleanOptions2["QUIET"] = "q";
|
|
1580
|
-
CleanOptions2["RECURSIVE"] = "d";
|
|
1581
|
-
return CleanOptions2;
|
|
1582
|
-
})(CleanOptions || {});
|
|
1583
|
-
CleanOptionValues = /* @__PURE__ */ new Set([
|
|
1584
|
-
"i",
|
|
1585
|
-
...asStringArray(Object.values(CleanOptions))
|
|
1586
|
-
]);
|
|
1587
|
-
}
|
|
1588
|
-
});
|
|
1589
|
-
function configListParser(text) {
|
|
1590
|
-
const config = new ConfigList;
|
|
1591
|
-
for (const item of configParser(text)) {
|
|
1592
|
-
config.addValue(item.file, String(item.key), item.value);
|
|
1593
|
-
}
|
|
1594
|
-
return config;
|
|
1595
|
-
}
|
|
1596
|
-
function configGetParser(text, key) {
|
|
1597
|
-
let value = null;
|
|
1598
|
-
const values = [];
|
|
1599
|
-
const scopes = /* @__PURE__ */ new Map;
|
|
1600
|
-
for (const item of configParser(text, key)) {
|
|
1601
|
-
if (item.key !== key) {
|
|
1602
|
-
continue;
|
|
1603
|
-
}
|
|
1604
|
-
values.push(value = item.value);
|
|
1605
|
-
if (!scopes.has(item.file)) {
|
|
1606
|
-
scopes.set(item.file, []);
|
|
1607
|
-
}
|
|
1608
|
-
scopes.get(item.file).push(value);
|
|
1609
|
-
}
|
|
1610
|
-
return {
|
|
1611
|
-
key,
|
|
1612
|
-
paths: Array.from(scopes.keys()),
|
|
1613
|
-
scopes,
|
|
1614
|
-
value,
|
|
1615
|
-
values
|
|
1616
|
-
};
|
|
1617
|
-
}
|
|
1618
|
-
function configFilePath(filePath) {
|
|
1619
|
-
return filePath.replace(/^(file):/, "");
|
|
1620
|
-
}
|
|
1621
|
-
function* configParser(text, requestedKey = null) {
|
|
1622
|
-
const lines = text.split("\x00");
|
|
1623
|
-
for (let i = 0, max = lines.length - 1;i < max; ) {
|
|
1624
|
-
const file = configFilePath(lines[i++]);
|
|
1625
|
-
let value = lines[i++];
|
|
1626
|
-
let key = requestedKey;
|
|
1627
|
-
if (value.includes(`
|
|
1628
|
-
`)) {
|
|
1629
|
-
const line = splitOn(value, `
|
|
1630
|
-
`);
|
|
1631
|
-
key = line[0];
|
|
1632
|
-
value = line[1];
|
|
1633
|
-
}
|
|
1634
|
-
yield { file, key, value };
|
|
1635
|
-
}
|
|
1636
|
-
}
|
|
1637
|
-
var ConfigList;
|
|
1638
|
-
var init_ConfigList = __esm({
|
|
1639
|
-
"src/lib/responses/ConfigList.ts"() {
|
|
1640
|
-
init_utils();
|
|
1641
|
-
ConfigList = class {
|
|
1642
|
-
constructor() {
|
|
1643
|
-
this.files = [];
|
|
1644
|
-
this.values = /* @__PURE__ */ Object.create(null);
|
|
1645
|
-
}
|
|
1646
|
-
get all() {
|
|
1647
|
-
if (!this._all) {
|
|
1648
|
-
this._all = this.files.reduce((all, file) => {
|
|
1649
|
-
return Object.assign(all, this.values[file]);
|
|
1650
|
-
}, {});
|
|
1651
|
-
}
|
|
1652
|
-
return this._all;
|
|
1653
|
-
}
|
|
1654
|
-
addFile(file) {
|
|
1655
|
-
if (!(file in this.values)) {
|
|
1656
|
-
const latest = last(this.files);
|
|
1657
|
-
this.values[file] = latest ? Object.create(this.values[latest]) : {};
|
|
1658
|
-
this.files.push(file);
|
|
1659
|
-
}
|
|
1660
|
-
return this.values[file];
|
|
1661
|
-
}
|
|
1662
|
-
addValue(file, key, value) {
|
|
1663
|
-
const values = this.addFile(file);
|
|
1664
|
-
if (!Object.hasOwn(values, key)) {
|
|
1665
|
-
values[key] = value;
|
|
1666
|
-
} else if (Array.isArray(values[key])) {
|
|
1667
|
-
values[key].push(value);
|
|
1668
|
-
} else {
|
|
1669
|
-
values[key] = [values[key], value];
|
|
1670
|
-
}
|
|
1671
|
-
this._all = undefined;
|
|
1672
|
-
}
|
|
1673
|
-
};
|
|
1674
|
-
}
|
|
1675
|
-
});
|
|
1676
|
-
function asConfigScope(scope, fallback) {
|
|
1677
|
-
if (typeof scope === "string" && Object.hasOwn(GitConfigScope, scope)) {
|
|
1678
|
-
return scope;
|
|
1679
|
-
}
|
|
1680
|
-
return fallback;
|
|
1681
|
-
}
|
|
1682
|
-
function addConfigTask(key, value, append2, scope) {
|
|
1683
|
-
const commands = ["config", `--${scope}`];
|
|
1684
|
-
if (append2) {
|
|
1685
|
-
commands.push("--add");
|
|
1686
|
-
}
|
|
1687
|
-
commands.push(key, value);
|
|
1688
|
-
return {
|
|
1689
|
-
commands,
|
|
1690
|
-
format: "utf-8",
|
|
1691
|
-
parser(text) {
|
|
1692
|
-
return text;
|
|
1693
|
-
}
|
|
1694
|
-
};
|
|
1695
|
-
}
|
|
1696
|
-
function getConfigTask(key, scope) {
|
|
1697
|
-
const commands = ["config", "--null", "--show-origin", "--get-all", key];
|
|
1698
|
-
if (scope) {
|
|
1699
|
-
commands.splice(1, 0, `--${scope}`);
|
|
1700
|
-
}
|
|
1701
|
-
return {
|
|
1702
|
-
commands,
|
|
1703
|
-
format: "utf-8",
|
|
1704
|
-
parser(text) {
|
|
1705
|
-
return configGetParser(text, key);
|
|
1706
|
-
}
|
|
1707
|
-
};
|
|
1708
|
-
}
|
|
1709
|
-
function listConfigTask(scope) {
|
|
1710
|
-
const commands = ["config", "--list", "--show-origin", "--null"];
|
|
1711
|
-
if (scope) {
|
|
1712
|
-
commands.push(`--${scope}`);
|
|
1713
|
-
}
|
|
1714
|
-
return {
|
|
1715
|
-
commands,
|
|
1716
|
-
format: "utf-8",
|
|
1717
|
-
parser(text) {
|
|
1718
|
-
return configListParser(text);
|
|
1719
|
-
}
|
|
1720
|
-
};
|
|
1721
|
-
}
|
|
1722
|
-
function config_default() {
|
|
1723
|
-
return {
|
|
1724
|
-
addConfig(key, value, ...rest) {
|
|
1725
|
-
return this._runTask(addConfigTask(key, value, rest[0] === true, asConfigScope(rest[1], "local")), trailingFunctionArgument(arguments));
|
|
1726
|
-
},
|
|
1727
|
-
getConfig(key, scope) {
|
|
1728
|
-
return this._runTask(getConfigTask(key, asConfigScope(scope, undefined)), trailingFunctionArgument(arguments));
|
|
1729
|
-
},
|
|
1730
|
-
listConfig(...rest) {
|
|
1731
|
-
return this._runTask(listConfigTask(asConfigScope(rest[0], undefined)), trailingFunctionArgument(arguments));
|
|
1732
|
-
}
|
|
1733
|
-
};
|
|
1734
|
-
}
|
|
1735
|
-
var GitConfigScope;
|
|
1736
|
-
var init_config = __esm({
|
|
1737
|
-
"src/lib/tasks/config.ts"() {
|
|
1738
|
-
init_ConfigList();
|
|
1739
|
-
init_utils();
|
|
1740
|
-
GitConfigScope = /* @__PURE__ */ ((GitConfigScope2) => {
|
|
1741
|
-
GitConfigScope2["system"] = "system";
|
|
1742
|
-
GitConfigScope2["global"] = "global";
|
|
1743
|
-
GitConfigScope2["local"] = "local";
|
|
1744
|
-
GitConfigScope2["worktree"] = "worktree";
|
|
1745
|
-
return GitConfigScope2;
|
|
1746
|
-
})(GitConfigScope || {});
|
|
1747
|
-
}
|
|
1748
|
-
});
|
|
1749
|
-
function isDiffNameStatus(input) {
|
|
1750
|
-
return diffNameStatus.has(input);
|
|
1751
|
-
}
|
|
1752
|
-
var DiffNameStatus;
|
|
1753
|
-
var diffNameStatus;
|
|
1754
|
-
var init_diff_name_status = __esm({
|
|
1755
|
-
"src/lib/tasks/diff-name-status.ts"() {
|
|
1756
|
-
DiffNameStatus = /* @__PURE__ */ ((DiffNameStatus2) => {
|
|
1757
|
-
DiffNameStatus2["ADDED"] = "A";
|
|
1758
|
-
DiffNameStatus2["COPIED"] = "C";
|
|
1759
|
-
DiffNameStatus2["DELETED"] = "D";
|
|
1760
|
-
DiffNameStatus2["MODIFIED"] = "M";
|
|
1761
|
-
DiffNameStatus2["RENAMED"] = "R";
|
|
1762
|
-
DiffNameStatus2["CHANGED"] = "T";
|
|
1763
|
-
DiffNameStatus2["UNMERGED"] = "U";
|
|
1764
|
-
DiffNameStatus2["UNKNOWN"] = "X";
|
|
1765
|
-
DiffNameStatus2["BROKEN"] = "B";
|
|
1766
|
-
return DiffNameStatus2;
|
|
1767
|
-
})(DiffNameStatus || {});
|
|
1768
|
-
diffNameStatus = new Set(Object.values(DiffNameStatus));
|
|
1769
|
-
}
|
|
1770
|
-
});
|
|
1771
|
-
function grepQueryBuilder(...params) {
|
|
1772
|
-
return new GrepQuery().param(...params);
|
|
1773
|
-
}
|
|
1774
|
-
function parseGrep(grep) {
|
|
1775
|
-
const paths = /* @__PURE__ */ new Set;
|
|
1776
|
-
const results = {};
|
|
1777
|
-
forEachLineWithContent(grep, (input) => {
|
|
1778
|
-
const [path, line, preview] = input.split(NULL);
|
|
1779
|
-
paths.add(path);
|
|
1780
|
-
(results[path] = results[path] || []).push({
|
|
1781
|
-
line: asNumber(line),
|
|
1782
|
-
path,
|
|
1783
|
-
preview
|
|
1784
|
-
});
|
|
1785
|
-
});
|
|
1786
|
-
return {
|
|
1787
|
-
paths,
|
|
1788
|
-
results
|
|
1789
|
-
};
|
|
1790
|
-
}
|
|
1791
|
-
function grep_default() {
|
|
1792
|
-
return {
|
|
1793
|
-
grep(searchTerm) {
|
|
1794
|
-
const then = trailingFunctionArgument(arguments);
|
|
1795
|
-
const options = getTrailingOptions(arguments);
|
|
1796
|
-
for (const option of disallowedOptions) {
|
|
1797
|
-
if (options.includes(option)) {
|
|
1798
|
-
return this._runTask(configurationErrorTask(`git.grep: use of "${option}" is not supported.`), then);
|
|
1799
|
-
}
|
|
1800
|
-
}
|
|
1801
|
-
if (typeof searchTerm === "string") {
|
|
1802
|
-
searchTerm = grepQueryBuilder().param(searchTerm);
|
|
1803
|
-
}
|
|
1804
|
-
const commands = ["grep", "--null", "-n", "--full-name", ...options, ...searchTerm];
|
|
1805
|
-
return this._runTask({
|
|
1806
|
-
commands,
|
|
1807
|
-
format: "utf-8",
|
|
1808
|
-
parser(stdOut) {
|
|
1809
|
-
return parseGrep(stdOut);
|
|
1810
|
-
}
|
|
1811
|
-
}, then);
|
|
1812
|
-
}
|
|
1813
|
-
};
|
|
1814
|
-
}
|
|
1815
|
-
var disallowedOptions;
|
|
1816
|
-
var Query;
|
|
1817
|
-
var _a;
|
|
1818
|
-
var GrepQuery;
|
|
1819
|
-
var init_grep = __esm({
|
|
1820
|
-
"src/lib/tasks/grep.ts"() {
|
|
1821
|
-
init_utils();
|
|
1822
|
-
init_task();
|
|
1823
|
-
disallowedOptions = ["-h"];
|
|
1824
|
-
Query = Symbol("grepQuery");
|
|
1825
|
-
GrepQuery = class {
|
|
1826
|
-
constructor() {
|
|
1827
|
-
this[_a] = [];
|
|
1828
|
-
}
|
|
1829
|
-
*[(_a = Query, Symbol.iterator)]() {
|
|
1830
|
-
for (const query of this[Query]) {
|
|
1831
|
-
yield query;
|
|
1832
|
-
}
|
|
1833
|
-
}
|
|
1834
|
-
and(...and) {
|
|
1835
|
-
and.length && this[Query].push("--and", "(", ...prefixedArray(and, "-e"), ")");
|
|
1836
|
-
return this;
|
|
1837
|
-
}
|
|
1838
|
-
param(...param) {
|
|
1839
|
-
this[Query].push(...prefixedArray(param, "-e"));
|
|
1840
|
-
return this;
|
|
1841
|
-
}
|
|
1842
|
-
};
|
|
1843
|
-
}
|
|
1844
|
-
});
|
|
1845
|
-
var reset_exports = {};
|
|
1846
|
-
__export(reset_exports, {
|
|
1847
|
-
ResetMode: () => ResetMode,
|
|
1848
|
-
getResetMode: () => getResetMode,
|
|
1849
|
-
resetTask: () => resetTask
|
|
1850
|
-
});
|
|
1851
|
-
function resetTask(mode, customArgs) {
|
|
1852
|
-
const commands = ["reset"];
|
|
1853
|
-
if (isValidResetMode(mode)) {
|
|
1854
|
-
commands.push(`--${mode}`);
|
|
1855
|
-
}
|
|
1856
|
-
commands.push(...customArgs);
|
|
1857
|
-
return straightThroughStringTask(commands);
|
|
1858
|
-
}
|
|
1859
|
-
function getResetMode(mode) {
|
|
1860
|
-
if (isValidResetMode(mode)) {
|
|
1861
|
-
return mode;
|
|
1862
|
-
}
|
|
1863
|
-
switch (typeof mode) {
|
|
1864
|
-
case "string":
|
|
1865
|
-
case "undefined":
|
|
1866
|
-
return "soft";
|
|
1867
|
-
}
|
|
1868
|
-
return;
|
|
1869
|
-
}
|
|
1870
|
-
function isValidResetMode(mode) {
|
|
1871
|
-
return typeof mode === "string" && validResetModes.includes(mode);
|
|
1872
|
-
}
|
|
1873
|
-
var ResetMode;
|
|
1874
|
-
var validResetModes;
|
|
1875
|
-
var init_reset = __esm({
|
|
1876
|
-
"src/lib/tasks/reset.ts"() {
|
|
1877
|
-
init_utils();
|
|
1878
|
-
init_task();
|
|
1879
|
-
ResetMode = /* @__PURE__ */ ((ResetMode2) => {
|
|
1880
|
-
ResetMode2["MIXED"] = "mixed";
|
|
1881
|
-
ResetMode2["SOFT"] = "soft";
|
|
1882
|
-
ResetMode2["HARD"] = "hard";
|
|
1883
|
-
ResetMode2["MERGE"] = "merge";
|
|
1884
|
-
ResetMode2["KEEP"] = "keep";
|
|
1885
|
-
return ResetMode2;
|
|
1886
|
-
})(ResetMode || {});
|
|
1887
|
-
validResetModes = asStringArray(Object.values(ResetMode));
|
|
1888
|
-
}
|
|
1889
|
-
});
|
|
1890
|
-
function createLog() {
|
|
1891
|
-
return import_debug.default("simple-git");
|
|
1892
|
-
}
|
|
1893
|
-
function prefixedLogger(to, prefix, forward) {
|
|
1894
|
-
if (!prefix || !String(prefix).replace(/\s*/, "")) {
|
|
1895
|
-
return !forward ? to : (message, ...args) => {
|
|
1896
|
-
to(message, ...args);
|
|
1897
|
-
forward(message, ...args);
|
|
1898
|
-
};
|
|
1899
|
-
}
|
|
1900
|
-
return (message, ...args) => {
|
|
1901
|
-
to(`%s ${message}`, prefix, ...args);
|
|
1902
|
-
if (forward) {
|
|
1903
|
-
forward(message, ...args);
|
|
1904
|
-
}
|
|
1905
|
-
};
|
|
1906
|
-
}
|
|
1907
|
-
function childLoggerName(name, childDebugger, { namespace: parentNamespace }) {
|
|
1908
|
-
if (typeof name === "string") {
|
|
1909
|
-
return name;
|
|
1910
|
-
}
|
|
1911
|
-
const childNamespace = childDebugger && childDebugger.namespace || "";
|
|
1912
|
-
if (childNamespace.startsWith(parentNamespace)) {
|
|
1913
|
-
return childNamespace.substr(parentNamespace.length + 1);
|
|
1914
|
-
}
|
|
1915
|
-
return childNamespace || parentNamespace;
|
|
1916
|
-
}
|
|
1917
|
-
function createLogger(label, verbose, initialStep, infoDebugger = createLog()) {
|
|
1918
|
-
const labelPrefix = label && `[${label}]` || "";
|
|
1919
|
-
const spawned = [];
|
|
1920
|
-
const debugDebugger = typeof verbose === "string" ? infoDebugger.extend(verbose) : verbose;
|
|
1921
|
-
const key = childLoggerName(filterType(verbose, filterString), debugDebugger, infoDebugger);
|
|
1922
|
-
return step(initialStep);
|
|
1923
|
-
function sibling(name, initial) {
|
|
1924
|
-
return append(spawned, createLogger(label, key.replace(/^[^:]+/, name), initial, infoDebugger));
|
|
1925
|
-
}
|
|
1926
|
-
function step(phase) {
|
|
1927
|
-
const stepPrefix = phase && `[${phase}]` || "";
|
|
1928
|
-
const debug2 = debugDebugger && prefixedLogger(debugDebugger, stepPrefix) || NOOP;
|
|
1929
|
-
const info = prefixedLogger(infoDebugger, `${labelPrefix} ${stepPrefix}`, debug2);
|
|
1930
|
-
return Object.assign(debugDebugger ? debug2 : info, {
|
|
1931
|
-
label,
|
|
1932
|
-
sibling,
|
|
1933
|
-
info,
|
|
1934
|
-
step
|
|
1935
|
-
});
|
|
1936
|
-
}
|
|
1937
|
-
}
|
|
1938
|
-
var init_git_logger = __esm({
|
|
1939
|
-
"src/lib/git-logger.ts"() {
|
|
1940
|
-
init_utils();
|
|
1941
|
-
import_debug.default.formatters.L = (value) => String(filterHasLength(value) ? value.length : "-");
|
|
1942
|
-
import_debug.default.formatters.B = (value) => {
|
|
1943
|
-
if (Buffer.isBuffer(value)) {
|
|
1944
|
-
return value.toString("utf8");
|
|
1945
|
-
}
|
|
1946
|
-
return objectToString(value);
|
|
1947
|
-
};
|
|
1948
|
-
}
|
|
1949
|
-
});
|
|
1950
|
-
var TasksPendingQueue;
|
|
1951
|
-
var init_tasks_pending_queue = __esm({
|
|
1952
|
-
"src/lib/runners/tasks-pending-queue.ts"() {
|
|
1953
|
-
init_git_error();
|
|
1954
|
-
init_git_logger();
|
|
1955
|
-
TasksPendingQueue = class _TasksPendingQueue {
|
|
1956
|
-
constructor(logLabel = "GitExecutor") {
|
|
1957
|
-
this.logLabel = logLabel;
|
|
1958
|
-
this._queue = /* @__PURE__ */ new Map;
|
|
1959
|
-
}
|
|
1960
|
-
withProgress(task) {
|
|
1961
|
-
return this._queue.get(task);
|
|
1962
|
-
}
|
|
1963
|
-
createProgress(task) {
|
|
1964
|
-
const name = _TasksPendingQueue.getName(task.commands[0]);
|
|
1965
|
-
const logger = createLogger(this.logLabel, name);
|
|
1966
|
-
return {
|
|
1967
|
-
task,
|
|
1968
|
-
logger,
|
|
1969
|
-
name
|
|
1970
|
-
};
|
|
1971
|
-
}
|
|
1972
|
-
push(task) {
|
|
1973
|
-
const progress = this.createProgress(task);
|
|
1974
|
-
progress.logger("Adding task to the queue, commands = %o", task.commands);
|
|
1975
|
-
this._queue.set(task, progress);
|
|
1976
|
-
return progress;
|
|
1977
|
-
}
|
|
1978
|
-
fatal(err) {
|
|
1979
|
-
for (const [task, { logger }] of Array.from(this._queue.entries())) {
|
|
1980
|
-
if (task === err.task) {
|
|
1981
|
-
logger.info(`Failed %o`, err);
|
|
1982
|
-
logger(`Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`);
|
|
1983
|
-
} else {
|
|
1984
|
-
logger.info(`A fatal exception occurred in a previous task, the queue has been purged: %o`, err.message);
|
|
1985
|
-
}
|
|
1986
|
-
this.complete(task);
|
|
1987
|
-
}
|
|
1988
|
-
if (this._queue.size !== 0) {
|
|
1989
|
-
throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`);
|
|
1990
|
-
}
|
|
1991
|
-
}
|
|
1992
|
-
complete(task) {
|
|
1993
|
-
const progress = this.withProgress(task);
|
|
1994
|
-
if (progress) {
|
|
1995
|
-
this._queue.delete(task);
|
|
1996
|
-
}
|
|
1997
|
-
}
|
|
1998
|
-
attempt(task) {
|
|
1999
|
-
const progress = this.withProgress(task);
|
|
2000
|
-
if (!progress) {
|
|
2001
|
-
throw new GitError(undefined, "TasksPendingQueue: attempt called for an unknown task");
|
|
2002
|
-
}
|
|
2003
|
-
progress.logger("Starting task");
|
|
2004
|
-
return progress;
|
|
2005
|
-
}
|
|
2006
|
-
static getName(name = "empty") {
|
|
2007
|
-
return `task:${name}:${++_TasksPendingQueue.counter}`;
|
|
2008
|
-
}
|
|
2009
|
-
static {
|
|
2010
|
-
this.counter = 0;
|
|
2011
|
-
}
|
|
2012
|
-
};
|
|
2013
|
-
}
|
|
2014
|
-
});
|
|
2015
|
-
function pluginContext(task, commands) {
|
|
2016
|
-
return {
|
|
2017
|
-
method: first(task.commands) || "",
|
|
2018
|
-
commands
|
|
2019
|
-
};
|
|
2020
|
-
}
|
|
2021
|
-
function onErrorReceived(target, logger) {
|
|
2022
|
-
return (err) => {
|
|
2023
|
-
logger(`[ERROR] child process exception %o`, err);
|
|
2024
|
-
target.push(Buffer.from(String(err.stack), "ascii"));
|
|
2025
|
-
};
|
|
2026
|
-
}
|
|
2027
|
-
function onDataReceived(target, name, logger, output) {
|
|
2028
|
-
return (buffer) => {
|
|
2029
|
-
logger(`%s received %L bytes`, name, buffer);
|
|
2030
|
-
output(`%B`, buffer);
|
|
2031
|
-
target.push(buffer);
|
|
2032
|
-
};
|
|
2033
|
-
}
|
|
2034
|
-
var GitExecutorChain;
|
|
2035
|
-
var init_git_executor_chain = __esm({
|
|
2036
|
-
"src/lib/runners/git-executor-chain.ts"() {
|
|
2037
|
-
init_git_error();
|
|
2038
|
-
init_task();
|
|
2039
|
-
init_utils();
|
|
2040
|
-
init_tasks_pending_queue();
|
|
2041
|
-
GitExecutorChain = class {
|
|
2042
|
-
constructor(_executor, _scheduler, _plugins) {
|
|
2043
|
-
this._executor = _executor;
|
|
2044
|
-
this._scheduler = _scheduler;
|
|
2045
|
-
this._plugins = _plugins;
|
|
2046
|
-
this._chain = Promise.resolve();
|
|
2047
|
-
this._queue = new TasksPendingQueue;
|
|
2048
|
-
}
|
|
2049
|
-
get cwd() {
|
|
2050
|
-
return this._cwd || this._executor.cwd;
|
|
2051
|
-
}
|
|
2052
|
-
set cwd(cwd) {
|
|
2053
|
-
this._cwd = cwd;
|
|
2054
|
-
}
|
|
2055
|
-
get env() {
|
|
2056
|
-
return this._executor.env;
|
|
2057
|
-
}
|
|
2058
|
-
get outputHandler() {
|
|
2059
|
-
return this._executor.outputHandler;
|
|
2060
|
-
}
|
|
2061
|
-
chain() {
|
|
2062
|
-
return this;
|
|
2063
|
-
}
|
|
2064
|
-
push(task) {
|
|
2065
|
-
this._queue.push(task);
|
|
2066
|
-
return this._chain = this._chain.then(() => this.attemptTask(task));
|
|
2067
|
-
}
|
|
2068
|
-
async attemptTask(task) {
|
|
2069
|
-
const onScheduleComplete = await this._scheduler.next();
|
|
2070
|
-
const onQueueComplete = () => this._queue.complete(task);
|
|
2071
|
-
try {
|
|
2072
|
-
const { logger } = this._queue.attempt(task);
|
|
2073
|
-
return await (isEmptyTask(task) ? this.attemptEmptyTask(task, logger) : this.attemptRemoteTask(task, logger));
|
|
2074
|
-
} catch (e) {
|
|
2075
|
-
throw this.onFatalException(task, e);
|
|
2076
|
-
} finally {
|
|
2077
|
-
onQueueComplete();
|
|
2078
|
-
onScheduleComplete();
|
|
2079
|
-
}
|
|
2080
|
-
}
|
|
2081
|
-
onFatalException(task, e) {
|
|
2082
|
-
const gitError = e instanceof GitError ? Object.assign(e, { task }) : new GitError(task, e && String(e));
|
|
2083
|
-
this._chain = Promise.resolve();
|
|
2084
|
-
this._queue.fatal(gitError);
|
|
2085
|
-
return gitError;
|
|
2086
|
-
}
|
|
2087
|
-
async attemptRemoteTask(task, logger) {
|
|
2088
|
-
const binary = this._plugins.exec("spawn.binary", "", pluginContext(task, task.commands));
|
|
2089
|
-
const args = this._plugins.exec("spawn.args", [...task.commands], pluginContext(task, task.commands));
|
|
2090
|
-
const raw = await this.gitResponse(task, binary, args, this.outputHandler, logger.step("SPAWN"));
|
|
2091
|
-
const outputStreams = await this.handleTaskData(task, args, raw, logger.step("HANDLE"));
|
|
2092
|
-
logger(`passing response to task's parser as a %s`, task.format);
|
|
2093
|
-
if (isBufferTask(task)) {
|
|
2094
|
-
return callTaskParser(task.parser, outputStreams);
|
|
2095
|
-
}
|
|
2096
|
-
return callTaskParser(task.parser, outputStreams.asStrings());
|
|
2097
|
-
}
|
|
2098
|
-
async attemptEmptyTask(task, logger) {
|
|
2099
|
-
logger(`empty task bypassing child process to call to task's parser`);
|
|
2100
|
-
return task.parser(this);
|
|
2101
|
-
}
|
|
2102
|
-
handleTaskData(task, args, result, logger) {
|
|
2103
|
-
const { exitCode, rejection, stdOut, stdErr } = result;
|
|
2104
|
-
return new Promise((done, fail) => {
|
|
2105
|
-
logger(`Preparing to handle process response exitCode=%d stdOut=`, exitCode);
|
|
2106
|
-
const { error } = this._plugins.exec("task.error", { error: rejection }, {
|
|
2107
|
-
...pluginContext(task, args),
|
|
2108
|
-
...result
|
|
2109
|
-
});
|
|
2110
|
-
if (error && task.onError) {
|
|
2111
|
-
logger.info(`exitCode=%s handling with custom error handler`);
|
|
2112
|
-
return task.onError(result, error, (newStdOut) => {
|
|
2113
|
-
logger.info(`custom error handler treated as success`);
|
|
2114
|
-
logger(`custom error returned a %s`, objectToString(newStdOut));
|
|
2115
|
-
done(new GitOutputStreams(Array.isArray(newStdOut) ? Buffer.concat(newStdOut) : newStdOut, Buffer.concat(stdErr)));
|
|
2116
|
-
}, fail);
|
|
2117
|
-
}
|
|
2118
|
-
if (error) {
|
|
2119
|
-
logger.info(`handling as error: exitCode=%s stdErr=%s rejection=%o`, exitCode, stdErr.length, rejection);
|
|
2120
|
-
return fail(error);
|
|
2121
|
-
}
|
|
2122
|
-
logger.info(`retrieving task output complete`);
|
|
2123
|
-
done(new GitOutputStreams(Buffer.concat(stdOut), Buffer.concat(stdErr)));
|
|
2124
|
-
});
|
|
2125
|
-
}
|
|
2126
|
-
async gitResponse(task, command, args, outputHandler, logger) {
|
|
2127
|
-
const outputLogger = logger.sibling("output");
|
|
2128
|
-
const spawnOptions = this._plugins.exec("spawn.options", {
|
|
2129
|
-
cwd: this.cwd,
|
|
2130
|
-
env: this.env,
|
|
2131
|
-
windowsHide: true
|
|
2132
|
-
}, pluginContext(task, task.commands));
|
|
2133
|
-
return new Promise((done) => {
|
|
2134
|
-
const stdOut = [];
|
|
2135
|
-
const stdErr = [];
|
|
2136
|
-
logger.info(`%s %o`, command, args);
|
|
2137
|
-
logger("%O", spawnOptions);
|
|
2138
|
-
let rejection = this._beforeSpawn(task, args);
|
|
2139
|
-
if (rejection) {
|
|
2140
|
-
return done({
|
|
2141
|
-
stdOut,
|
|
2142
|
-
stdErr,
|
|
2143
|
-
exitCode: 9901,
|
|
2144
|
-
rejection
|
|
2145
|
-
});
|
|
2146
|
-
}
|
|
2147
|
-
this._plugins.exec("spawn.before", undefined, {
|
|
2148
|
-
...pluginContext(task, args),
|
|
2149
|
-
kill(reason) {
|
|
2150
|
-
rejection = reason || rejection;
|
|
2151
|
-
}
|
|
2152
|
-
});
|
|
2153
|
-
const spawned = spawn(command, args, spawnOptions);
|
|
2154
|
-
spawned.stdout.on("data", onDataReceived(stdOut, "stdOut", logger, outputLogger.step("stdOut")));
|
|
2155
|
-
spawned.stderr.on("data", onDataReceived(stdErr, "stdErr", logger, outputLogger.step("stdErr")));
|
|
2156
|
-
spawned.on("error", onErrorReceived(stdErr, logger));
|
|
2157
|
-
if (outputHandler) {
|
|
2158
|
-
logger(`Passing child process stdOut/stdErr to custom outputHandler`);
|
|
2159
|
-
outputHandler(command, spawned.stdout, spawned.stderr, [...args]);
|
|
2160
|
-
}
|
|
2161
|
-
this._plugins.exec("spawn.after", undefined, {
|
|
2162
|
-
...pluginContext(task, args),
|
|
2163
|
-
spawned,
|
|
2164
|
-
close(exitCode, reason) {
|
|
2165
|
-
done({
|
|
2166
|
-
stdOut,
|
|
2167
|
-
stdErr,
|
|
2168
|
-
exitCode,
|
|
2169
|
-
rejection: rejection || reason
|
|
2170
|
-
});
|
|
2171
|
-
},
|
|
2172
|
-
kill(reason) {
|
|
2173
|
-
if (spawned.killed) {
|
|
2174
|
-
return;
|
|
2175
|
-
}
|
|
2176
|
-
rejection = reason;
|
|
2177
|
-
spawned.kill("SIGINT");
|
|
2178
|
-
}
|
|
2179
|
-
});
|
|
2180
|
-
});
|
|
2181
|
-
}
|
|
2182
|
-
_beforeSpawn(task, args) {
|
|
2183
|
-
let rejection;
|
|
2184
|
-
this._plugins.exec("spawn.before", undefined, {
|
|
2185
|
-
...pluginContext(task, args),
|
|
2186
|
-
kill(reason) {
|
|
2187
|
-
rejection = reason || rejection;
|
|
2188
|
-
}
|
|
2189
|
-
});
|
|
2190
|
-
return rejection;
|
|
2191
|
-
}
|
|
2192
|
-
};
|
|
2193
|
-
}
|
|
2194
|
-
});
|
|
2195
|
-
var git_executor_exports = {};
|
|
2196
|
-
__export(git_executor_exports, {
|
|
2197
|
-
GitExecutor: () => GitExecutor
|
|
2198
|
-
});
|
|
2199
|
-
var GitExecutor;
|
|
2200
|
-
var init_git_executor = __esm({
|
|
2201
|
-
"src/lib/runners/git-executor.ts"() {
|
|
2202
|
-
init_git_executor_chain();
|
|
2203
|
-
GitExecutor = class {
|
|
2204
|
-
constructor(cwd, _scheduler, _plugins) {
|
|
2205
|
-
this.cwd = cwd;
|
|
2206
|
-
this._scheduler = _scheduler;
|
|
2207
|
-
this._plugins = _plugins;
|
|
2208
|
-
this._chain = new GitExecutorChain(this, this._scheduler, this._plugins);
|
|
2209
|
-
}
|
|
2210
|
-
chain() {
|
|
2211
|
-
return new GitExecutorChain(this, this._scheduler, this._plugins);
|
|
2212
|
-
}
|
|
2213
|
-
push(task) {
|
|
2214
|
-
return this._chain.push(task);
|
|
2215
|
-
}
|
|
2216
|
-
};
|
|
2217
|
-
}
|
|
2218
|
-
});
|
|
2219
|
-
function taskCallback(task, response, callback = NOOP) {
|
|
2220
|
-
const onSuccess = (data) => {
|
|
2221
|
-
callback(null, data);
|
|
2222
|
-
};
|
|
2223
|
-
const onError2 = (err) => {
|
|
2224
|
-
if (err?.task === task) {
|
|
2225
|
-
callback(err instanceof GitResponseError ? addDeprecationNoticeToError(err) : err, undefined);
|
|
2226
|
-
}
|
|
2227
|
-
};
|
|
2228
|
-
response.then(onSuccess, onError2);
|
|
2229
|
-
}
|
|
2230
|
-
function addDeprecationNoticeToError(err) {
|
|
2231
|
-
let log = (name) => {
|
|
2232
|
-
console.warn(`simple-git deprecation notice: accessing GitResponseError.${name} should be GitResponseError.git.${name}, this will no longer be available in version 3`);
|
|
2233
|
-
log = NOOP;
|
|
2234
|
-
};
|
|
2235
|
-
return Object.create(err, Object.getOwnPropertyNames(err.git).reduce(descriptorReducer, {}));
|
|
2236
|
-
function descriptorReducer(all, name) {
|
|
2237
|
-
if (name in err) {
|
|
2238
|
-
return all;
|
|
2239
|
-
}
|
|
2240
|
-
all[name] = {
|
|
2241
|
-
enumerable: false,
|
|
2242
|
-
configurable: false,
|
|
2243
|
-
get() {
|
|
2244
|
-
log(name);
|
|
2245
|
-
return err.git[name];
|
|
2246
|
-
}
|
|
2247
|
-
};
|
|
2248
|
-
return all;
|
|
2249
|
-
}
|
|
2250
|
-
}
|
|
2251
|
-
var init_task_callback = __esm({
|
|
2252
|
-
"src/lib/task-callback.ts"() {
|
|
2253
|
-
init_git_response_error();
|
|
2254
|
-
init_utils();
|
|
2255
|
-
}
|
|
2256
|
-
});
|
|
2257
|
-
function changeWorkingDirectoryTask(directory, root) {
|
|
2258
|
-
return adhocExecTask((instance) => {
|
|
2259
|
-
if (!folderExists(directory)) {
|
|
2260
|
-
throw new Error(`Git.cwd: cannot change to non-directory "${directory}"`);
|
|
2261
|
-
}
|
|
2262
|
-
return (root || instance).cwd = directory;
|
|
2263
|
-
});
|
|
2264
|
-
}
|
|
2265
|
-
var init_change_working_directory = __esm({
|
|
2266
|
-
"src/lib/tasks/change-working-directory.ts"() {
|
|
2267
|
-
init_utils();
|
|
2268
|
-
init_task();
|
|
2269
|
-
}
|
|
2270
|
-
});
|
|
2271
|
-
function checkoutTask(args) {
|
|
2272
|
-
const commands = ["checkout", ...args];
|
|
2273
|
-
if (commands[1] === "-b" && commands.includes("-B")) {
|
|
2274
|
-
commands[1] = remove(commands, "-B");
|
|
2275
|
-
}
|
|
2276
|
-
return straightThroughStringTask(commands);
|
|
2277
|
-
}
|
|
2278
|
-
function checkout_default() {
|
|
2279
|
-
return {
|
|
2280
|
-
checkout() {
|
|
2281
|
-
return this._runTask(checkoutTask(getTrailingOptions(arguments, 1)), trailingFunctionArgument(arguments));
|
|
2282
|
-
},
|
|
2283
|
-
checkoutBranch(branchName, startPoint) {
|
|
2284
|
-
return this._runTask(checkoutTask(["-b", branchName, startPoint, ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments));
|
|
2285
|
-
},
|
|
2286
|
-
checkoutLocalBranch(branchName) {
|
|
2287
|
-
return this._runTask(checkoutTask(["-b", branchName, ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments));
|
|
2288
|
-
}
|
|
2289
|
-
};
|
|
2290
|
-
}
|
|
2291
|
-
var init_checkout = __esm({
|
|
2292
|
-
"src/lib/tasks/checkout.ts"() {
|
|
2293
|
-
init_utils();
|
|
2294
|
-
init_task();
|
|
2295
|
-
}
|
|
2296
|
-
});
|
|
2297
|
-
function countObjectsResponse() {
|
|
2298
|
-
return {
|
|
2299
|
-
count: 0,
|
|
2300
|
-
garbage: 0,
|
|
2301
|
-
inPack: 0,
|
|
2302
|
-
packs: 0,
|
|
2303
|
-
prunePackable: 0,
|
|
2304
|
-
size: 0,
|
|
2305
|
-
sizeGarbage: 0,
|
|
2306
|
-
sizePack: 0
|
|
2307
|
-
};
|
|
2308
|
-
}
|
|
2309
|
-
function count_objects_default() {
|
|
2310
|
-
return {
|
|
2311
|
-
countObjects() {
|
|
2312
|
-
return this._runTask({
|
|
2313
|
-
commands: ["count-objects", "--verbose"],
|
|
2314
|
-
format: "utf-8",
|
|
2315
|
-
parser(stdOut) {
|
|
2316
|
-
return parseStringResponse(countObjectsResponse(), [parser2], stdOut);
|
|
2317
|
-
}
|
|
2318
|
-
});
|
|
2319
|
-
}
|
|
2320
|
-
};
|
|
2321
|
-
}
|
|
2322
|
-
var parser2;
|
|
2323
|
-
var init_count_objects = __esm({
|
|
2324
|
-
"src/lib/tasks/count-objects.ts"() {
|
|
2325
|
-
init_utils();
|
|
2326
|
-
parser2 = new LineParser(/([a-z-]+): (\d+)$/, (result, [key, value]) => {
|
|
2327
|
-
const property = asCamelCase(key);
|
|
2328
|
-
if (Object.hasOwn(result, property)) {
|
|
2329
|
-
result[property] = asNumber(value);
|
|
2330
|
-
}
|
|
2331
|
-
});
|
|
2332
|
-
}
|
|
2333
|
-
});
|
|
2334
|
-
function parseCommitResult(stdOut) {
|
|
2335
|
-
const result = {
|
|
2336
|
-
author: null,
|
|
2337
|
-
branch: "",
|
|
2338
|
-
commit: "",
|
|
2339
|
-
root: false,
|
|
2340
|
-
summary: {
|
|
2341
|
-
changes: 0,
|
|
2342
|
-
insertions: 0,
|
|
2343
|
-
deletions: 0
|
|
2344
|
-
}
|
|
2345
|
-
};
|
|
2346
|
-
return parseStringResponse(result, parsers, stdOut);
|
|
2347
|
-
}
|
|
2348
|
-
var parsers;
|
|
2349
|
-
var init_parse_commit = __esm({
|
|
2350
|
-
"src/lib/parsers/parse-commit.ts"() {
|
|
2351
|
-
init_utils();
|
|
2352
|
-
parsers = [
|
|
2353
|
-
new LineParser(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/, (result, [branch, root, commit]) => {
|
|
2354
|
-
result.branch = branch;
|
|
2355
|
-
result.commit = commit;
|
|
2356
|
-
result.root = !!root;
|
|
2357
|
-
}),
|
|
2358
|
-
new LineParser(/\s*Author:\s(.+)/i, (result, [author]) => {
|
|
2359
|
-
const parts = author.split("<");
|
|
2360
|
-
const email = parts.pop();
|
|
2361
|
-
if (!email || !email.includes("@")) {
|
|
2362
|
-
return;
|
|
2363
|
-
}
|
|
2364
|
-
result.author = {
|
|
2365
|
-
email: email.substr(0, email.length - 1),
|
|
2366
|
-
name: parts.join("<").trim()
|
|
2367
|
-
};
|
|
2368
|
-
}),
|
|
2369
|
-
new LineParser(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g, (result, [changes, insertions, deletions]) => {
|
|
2370
|
-
result.summary.changes = parseInt(changes, 10) || 0;
|
|
2371
|
-
result.summary.insertions = parseInt(insertions, 10) || 0;
|
|
2372
|
-
result.summary.deletions = parseInt(deletions, 10) || 0;
|
|
2373
|
-
}),
|
|
2374
|
-
new LineParser(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/, (result, [changes, lines, direction]) => {
|
|
2375
|
-
result.summary.changes = parseInt(changes, 10) || 0;
|
|
2376
|
-
const count = parseInt(lines, 10) || 0;
|
|
2377
|
-
if (direction === "-") {
|
|
2378
|
-
result.summary.deletions = count;
|
|
2379
|
-
} else if (direction === "+") {
|
|
2380
|
-
result.summary.insertions = count;
|
|
2381
|
-
}
|
|
2382
|
-
})
|
|
2383
|
-
];
|
|
2384
|
-
}
|
|
2385
|
-
});
|
|
2386
|
-
function commitTask(message, files, customArgs) {
|
|
2387
|
-
const commands = [
|
|
2388
|
-
"-c",
|
|
2389
|
-
"core.abbrev=40",
|
|
2390
|
-
"commit",
|
|
2391
|
-
...prefixedArray(message, "-m"),
|
|
2392
|
-
...files,
|
|
2393
|
-
...customArgs
|
|
2394
|
-
];
|
|
2395
|
-
return {
|
|
2396
|
-
commands,
|
|
2397
|
-
format: "utf-8",
|
|
2398
|
-
parser: parseCommitResult
|
|
2399
|
-
};
|
|
2400
|
-
}
|
|
2401
|
-
function commit_default() {
|
|
2402
|
-
return {
|
|
2403
|
-
commit(message, ...rest) {
|
|
2404
|
-
const next = trailingFunctionArgument(arguments);
|
|
2405
|
-
const task = rejectDeprecatedSignatures(message) || commitTask(asArray(message), asArray(filterType(rest[0], filterStringOrStringArray, [])), [
|
|
2406
|
-
...asStringArray(filterType(rest[1], filterArray, [])),
|
|
2407
|
-
...getTrailingOptions(arguments, 0, true)
|
|
2408
|
-
]);
|
|
2409
|
-
return this._runTask(task, next);
|
|
2410
|
-
}
|
|
2411
|
-
};
|
|
2412
|
-
function rejectDeprecatedSignatures(message) {
|
|
2413
|
-
return !filterStringOrStringArray(message) && configurationErrorTask(`git.commit: requires the commit message to be supplied as a string/string[]`);
|
|
2414
|
-
}
|
|
2415
|
-
}
|
|
2416
|
-
var init_commit = __esm({
|
|
2417
|
-
"src/lib/tasks/commit.ts"() {
|
|
2418
|
-
init_parse_commit();
|
|
2419
|
-
init_utils();
|
|
2420
|
-
init_task();
|
|
2421
|
-
}
|
|
2422
|
-
});
|
|
2423
|
-
function first_commit_default() {
|
|
2424
|
-
return {
|
|
2425
|
-
firstCommit() {
|
|
2426
|
-
return this._runTask(straightThroughStringTask(["rev-list", "--max-parents=0", "HEAD"], true), trailingFunctionArgument(arguments));
|
|
2427
|
-
}
|
|
2428
|
-
};
|
|
2429
|
-
}
|
|
2430
|
-
var init_first_commit = __esm({
|
|
2431
|
-
"src/lib/tasks/first-commit.ts"() {
|
|
2432
|
-
init_utils();
|
|
2433
|
-
init_task();
|
|
2434
|
-
}
|
|
2435
|
-
});
|
|
2436
|
-
function hashObjectTask(filePath, write) {
|
|
2437
|
-
const commands = ["hash-object", filePath];
|
|
2438
|
-
if (write) {
|
|
2439
|
-
commands.push("-w");
|
|
2440
|
-
}
|
|
2441
|
-
return straightThroughStringTask(commands, true);
|
|
2442
|
-
}
|
|
2443
|
-
var init_hash_object = __esm({
|
|
2444
|
-
"src/lib/tasks/hash-object.ts"() {
|
|
2445
|
-
init_task();
|
|
2446
|
-
}
|
|
2447
|
-
});
|
|
2448
|
-
function parseInit(bare, path, text) {
|
|
2449
|
-
const response = String(text).trim();
|
|
2450
|
-
let result;
|
|
2451
|
-
if (result = initResponseRegex.exec(response)) {
|
|
2452
|
-
return new InitSummary(bare, path, false, result[1]);
|
|
2453
|
-
}
|
|
2454
|
-
if (result = reInitResponseRegex.exec(response)) {
|
|
2455
|
-
return new InitSummary(bare, path, true, result[1]);
|
|
2456
|
-
}
|
|
2457
|
-
let gitDir = "";
|
|
2458
|
-
const tokens = response.split(" ");
|
|
2459
|
-
while (tokens.length) {
|
|
2460
|
-
const token = tokens.shift();
|
|
2461
|
-
if (token === "in") {
|
|
2462
|
-
gitDir = tokens.join(" ");
|
|
2463
|
-
break;
|
|
2464
|
-
}
|
|
2465
|
-
}
|
|
2466
|
-
return new InitSummary(bare, path, /^re/i.test(response), gitDir);
|
|
2467
|
-
}
|
|
2468
|
-
var InitSummary;
|
|
2469
|
-
var initResponseRegex;
|
|
2470
|
-
var reInitResponseRegex;
|
|
2471
|
-
var init_InitSummary = __esm({
|
|
2472
|
-
"src/lib/responses/InitSummary.ts"() {
|
|
2473
|
-
InitSummary = class {
|
|
2474
|
-
constructor(bare, path, existing, gitDir) {
|
|
2475
|
-
this.bare = bare;
|
|
2476
|
-
this.path = path;
|
|
2477
|
-
this.existing = existing;
|
|
2478
|
-
this.gitDir = gitDir;
|
|
2479
|
-
}
|
|
2480
|
-
};
|
|
2481
|
-
initResponseRegex = /^Init.+ repository in (.+)$/;
|
|
2482
|
-
reInitResponseRegex = /^Rein.+ in (.+)$/;
|
|
2483
|
-
}
|
|
2484
|
-
});
|
|
2485
|
-
function hasBareCommand(command) {
|
|
2486
|
-
return command.includes(bareCommand);
|
|
2487
|
-
}
|
|
2488
|
-
function initTask(bare = false, path, customArgs) {
|
|
2489
|
-
const commands = ["init", ...customArgs];
|
|
2490
|
-
if (bare && !hasBareCommand(commands)) {
|
|
2491
|
-
commands.splice(1, 0, bareCommand);
|
|
2492
|
-
}
|
|
2493
|
-
return {
|
|
2494
|
-
commands,
|
|
2495
|
-
format: "utf-8",
|
|
2496
|
-
parser(text) {
|
|
2497
|
-
return parseInit(commands.includes("--bare"), path, text);
|
|
2498
|
-
}
|
|
2499
|
-
};
|
|
2500
|
-
}
|
|
2501
|
-
var bareCommand;
|
|
2502
|
-
var init_init = __esm({
|
|
2503
|
-
"src/lib/tasks/init.ts"() {
|
|
2504
|
-
init_InitSummary();
|
|
2505
|
-
bareCommand = "--bare";
|
|
2506
|
-
}
|
|
2507
|
-
});
|
|
2508
|
-
function logFormatFromCommand(customArgs) {
|
|
2509
|
-
for (let i = 0;i < customArgs.length; i++) {
|
|
2510
|
-
const format = logFormatRegex.exec(customArgs[i]);
|
|
2511
|
-
if (format) {
|
|
2512
|
-
return `--${format[1]}`;
|
|
2513
|
-
}
|
|
2514
|
-
}
|
|
2515
|
-
return "";
|
|
2516
|
-
}
|
|
2517
|
-
function isLogFormat(customArg) {
|
|
2518
|
-
return logFormatRegex.test(customArg);
|
|
2519
|
-
}
|
|
2520
|
-
var logFormatRegex;
|
|
2521
|
-
var init_log_format = __esm({
|
|
2522
|
-
"src/lib/args/log-format.ts"() {
|
|
2523
|
-
logFormatRegex = /^--(stat|numstat|name-only|name-status)(=|$)/;
|
|
2524
|
-
}
|
|
2525
|
-
});
|
|
2526
|
-
var DiffSummary;
|
|
2527
|
-
var init_DiffSummary = __esm({
|
|
2528
|
-
"src/lib/responses/DiffSummary.ts"() {
|
|
2529
|
-
DiffSummary = class {
|
|
2530
|
-
constructor() {
|
|
2531
|
-
this.changed = 0;
|
|
2532
|
-
this.deletions = 0;
|
|
2533
|
-
this.insertions = 0;
|
|
2534
|
-
this.files = [];
|
|
2535
|
-
}
|
|
2536
|
-
};
|
|
2537
|
-
}
|
|
2538
|
-
});
|
|
2539
|
-
function getDiffParser(format = "") {
|
|
2540
|
-
const parser4 = diffSummaryParsers[format];
|
|
2541
|
-
return (stdOut) => parseStringResponse(new DiffSummary, parser4, stdOut, false);
|
|
2542
|
-
}
|
|
2543
|
-
var statParser;
|
|
2544
|
-
var numStatParser;
|
|
2545
|
-
var nameOnlyParser;
|
|
2546
|
-
var nameStatusParser;
|
|
2547
|
-
var diffSummaryParsers;
|
|
2548
|
-
var init_parse_diff_summary = __esm({
|
|
2549
|
-
"src/lib/parsers/parse-diff-summary.ts"() {
|
|
2550
|
-
init_log_format();
|
|
2551
|
-
init_DiffSummary();
|
|
2552
|
-
init_diff_name_status();
|
|
2553
|
-
init_utils();
|
|
2554
|
-
statParser = [
|
|
2555
|
-
new LineParser(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/, (result, [file, changes, alterations = ""]) => {
|
|
2556
|
-
result.files.push({
|
|
2557
|
-
file: file.trim(),
|
|
2558
|
-
changes: asNumber(changes),
|
|
2559
|
-
insertions: alterations.replace(/[^+]/g, "").length,
|
|
2560
|
-
deletions: alterations.replace(/[^-]/g, "").length,
|
|
2561
|
-
binary: false
|
|
2562
|
-
});
|
|
2563
|
-
}),
|
|
2564
|
-
new LineParser(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/, (result, [file, before, after]) => {
|
|
2565
|
-
result.files.push({
|
|
2566
|
-
file: file.trim(),
|
|
2567
|
-
before: asNumber(before),
|
|
2568
|
-
after: asNumber(after),
|
|
2569
|
-
binary: true
|
|
2570
|
-
});
|
|
2571
|
-
}),
|
|
2572
|
-
new LineParser(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/, (result, [changed, summary]) => {
|
|
2573
|
-
const inserted = /(\d+) i/.exec(summary);
|
|
2574
|
-
const deleted = /(\d+) d/.exec(summary);
|
|
2575
|
-
result.changed = asNumber(changed);
|
|
2576
|
-
result.insertions = asNumber(inserted?.[1]);
|
|
2577
|
-
result.deletions = asNumber(deleted?.[1]);
|
|
2578
|
-
})
|
|
2579
|
-
];
|
|
2580
|
-
numStatParser = [
|
|
2581
|
-
new LineParser(/(\d+)\t(\d+)\t(.+)$/, (result, [changesInsert, changesDelete, file]) => {
|
|
2582
|
-
const insertions = asNumber(changesInsert);
|
|
2583
|
-
const deletions = asNumber(changesDelete);
|
|
2584
|
-
result.changed++;
|
|
2585
|
-
result.insertions += insertions;
|
|
2586
|
-
result.deletions += deletions;
|
|
2587
|
-
result.files.push({
|
|
2588
|
-
file,
|
|
2589
|
-
changes: insertions + deletions,
|
|
2590
|
-
insertions,
|
|
2591
|
-
deletions,
|
|
2592
|
-
binary: false
|
|
2593
|
-
});
|
|
2594
|
-
}),
|
|
2595
|
-
new LineParser(/-\t-\t(.+)$/, (result, [file]) => {
|
|
2596
|
-
result.changed++;
|
|
2597
|
-
result.files.push({
|
|
2598
|
-
file,
|
|
2599
|
-
after: 0,
|
|
2600
|
-
before: 0,
|
|
2601
|
-
binary: true
|
|
2602
|
-
});
|
|
2603
|
-
})
|
|
2604
|
-
];
|
|
2605
|
-
nameOnlyParser = [
|
|
2606
|
-
new LineParser(/(.+)$/, (result, [file]) => {
|
|
2607
|
-
result.changed++;
|
|
2608
|
-
result.files.push({
|
|
2609
|
-
file,
|
|
2610
|
-
changes: 0,
|
|
2611
|
-
insertions: 0,
|
|
2612
|
-
deletions: 0,
|
|
2613
|
-
binary: false
|
|
2614
|
-
});
|
|
2615
|
-
})
|
|
2616
|
-
];
|
|
2617
|
-
nameStatusParser = [
|
|
2618
|
-
new LineParser(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/, (result, [status, similarity, from, _to, to]) => {
|
|
2619
|
-
result.changed++;
|
|
2620
|
-
result.files.push({
|
|
2621
|
-
file: to ?? from,
|
|
2622
|
-
changes: 0,
|
|
2623
|
-
insertions: 0,
|
|
2624
|
-
deletions: 0,
|
|
2625
|
-
binary: false,
|
|
2626
|
-
status: orVoid(isDiffNameStatus(status) && status),
|
|
2627
|
-
from: orVoid(!!to && from !== to && from),
|
|
2628
|
-
similarity: asNumber(similarity)
|
|
2629
|
-
});
|
|
2630
|
-
})
|
|
2631
|
-
];
|
|
2632
|
-
diffSummaryParsers = {
|
|
2633
|
-
[""]: statParser,
|
|
2634
|
-
["--stat"]: statParser,
|
|
2635
|
-
["--numstat"]: numStatParser,
|
|
2636
|
-
["--name-status"]: nameStatusParser,
|
|
2637
|
-
["--name-only"]: nameOnlyParser
|
|
2638
|
-
};
|
|
2639
|
-
}
|
|
2640
|
-
});
|
|
2641
|
-
function lineBuilder(tokens, fields) {
|
|
2642
|
-
return fields.reduce((line, field, index) => {
|
|
2643
|
-
line[field] = tokens[index] || "";
|
|
2644
|
-
return line;
|
|
2645
|
-
}, /* @__PURE__ */ Object.create({ diff: null }));
|
|
2646
|
-
}
|
|
2647
|
-
function createListLogSummaryParser(splitter = SPLITTER, fields = defaultFieldNames, logFormat = "") {
|
|
2648
|
-
const parseDiffResult = getDiffParser(logFormat);
|
|
2649
|
-
return function(stdOut) {
|
|
2650
|
-
const all = toLinesWithContent(stdOut.trim(), false, START_BOUNDARY).map(function(item) {
|
|
2651
|
-
const lineDetail = item.split(COMMIT_BOUNDARY);
|
|
2652
|
-
const listLogLine = lineBuilder(lineDetail[0].split(splitter), fields);
|
|
2653
|
-
if (lineDetail.length > 1 && !!lineDetail[1].trim()) {
|
|
2654
|
-
listLogLine.diff = parseDiffResult(lineDetail[1]);
|
|
2655
|
-
}
|
|
2656
|
-
return listLogLine;
|
|
2657
|
-
});
|
|
2658
|
-
return {
|
|
2659
|
-
all,
|
|
2660
|
-
latest: all.length && all[0] || null,
|
|
2661
|
-
total: all.length
|
|
2662
|
-
};
|
|
2663
|
-
};
|
|
2664
|
-
}
|
|
2665
|
-
var START_BOUNDARY;
|
|
2666
|
-
var COMMIT_BOUNDARY;
|
|
2667
|
-
var SPLITTER;
|
|
2668
|
-
var defaultFieldNames;
|
|
2669
|
-
var init_parse_list_log_summary = __esm({
|
|
2670
|
-
"src/lib/parsers/parse-list-log-summary.ts"() {
|
|
2671
|
-
init_utils();
|
|
2672
|
-
init_parse_diff_summary();
|
|
2673
|
-
init_log_format();
|
|
2674
|
-
START_BOUNDARY = "òòòòòò ";
|
|
2675
|
-
COMMIT_BOUNDARY = " òò";
|
|
2676
|
-
SPLITTER = " ò ";
|
|
2677
|
-
defaultFieldNames = ["hash", "date", "message", "refs", "author_name", "author_email"];
|
|
2678
|
-
}
|
|
2679
|
-
});
|
|
2680
|
-
var diff_exports = {};
|
|
2681
|
-
__export(diff_exports, {
|
|
2682
|
-
diffSummaryTask: () => diffSummaryTask,
|
|
2683
|
-
validateLogFormatConfig: () => validateLogFormatConfig
|
|
2684
|
-
});
|
|
2685
|
-
function diffSummaryTask(customArgs) {
|
|
2686
|
-
let logFormat = logFormatFromCommand(customArgs);
|
|
2687
|
-
const commands = ["diff"];
|
|
2688
|
-
if (logFormat === "") {
|
|
2689
|
-
logFormat = "--stat";
|
|
2690
|
-
commands.push("--stat=4096");
|
|
2691
|
-
}
|
|
2692
|
-
commands.push(...customArgs);
|
|
2693
|
-
return validateLogFormatConfig(commands) || {
|
|
2694
|
-
commands,
|
|
2695
|
-
format: "utf-8",
|
|
2696
|
-
parser: getDiffParser(logFormat)
|
|
2697
|
-
};
|
|
2698
|
-
}
|
|
2699
|
-
function validateLogFormatConfig(customArgs) {
|
|
2700
|
-
const flags = customArgs.filter(isLogFormat);
|
|
2701
|
-
if (flags.length > 1) {
|
|
2702
|
-
return configurationErrorTask(`Summary flags are mutually exclusive - pick one of ${flags.join(",")}`);
|
|
2703
|
-
}
|
|
2704
|
-
if (flags.length && customArgs.includes("-z")) {
|
|
2705
|
-
return configurationErrorTask(`Summary flag ${flags} parsing is not compatible with null termination option '-z'`);
|
|
2706
|
-
}
|
|
2707
|
-
}
|
|
2708
|
-
var init_diff = __esm({
|
|
2709
|
-
"src/lib/tasks/diff.ts"() {
|
|
2710
|
-
init_log_format();
|
|
2711
|
-
init_parse_diff_summary();
|
|
2712
|
-
init_task();
|
|
2713
|
-
}
|
|
2714
|
-
});
|
|
2715
|
-
function prettyFormat(format, splitter) {
|
|
2716
|
-
const fields = [];
|
|
2717
|
-
const formatStr = [];
|
|
2718
|
-
Object.keys(format).forEach((field) => {
|
|
2719
|
-
fields.push(field);
|
|
2720
|
-
formatStr.push(String(format[field]));
|
|
2721
|
-
});
|
|
2722
|
-
return [fields, formatStr.join(splitter)];
|
|
2723
|
-
}
|
|
2724
|
-
function userOptions(input) {
|
|
2725
|
-
return Object.keys(input).reduce((out, key) => {
|
|
2726
|
-
if (!(key in excludeOptions)) {
|
|
2727
|
-
out[key] = input[key];
|
|
2728
|
-
}
|
|
2729
|
-
return out;
|
|
2730
|
-
}, {});
|
|
2731
|
-
}
|
|
2732
|
-
function parseLogOptions(opt = {}, customArgs = []) {
|
|
2733
|
-
const splitter = filterType(opt.splitter, filterString, SPLITTER);
|
|
2734
|
-
const format = filterPlainObject(opt.format) ? opt.format : {
|
|
2735
|
-
hash: "%H",
|
|
2736
|
-
date: opt.strictDate === false ? "%ai" : "%aI",
|
|
2737
|
-
message: "%s",
|
|
2738
|
-
refs: "%D",
|
|
2739
|
-
body: opt.multiLine ? "%B" : "%b",
|
|
2740
|
-
author_name: opt.mailMap !== false ? "%aN" : "%an",
|
|
2741
|
-
author_email: opt.mailMap !== false ? "%aE" : "%ae"
|
|
2742
|
-
};
|
|
2743
|
-
const [fields, formatStr] = prettyFormat(format, splitter);
|
|
2744
|
-
const suffix = [];
|
|
2745
|
-
const command = [
|
|
2746
|
-
`--pretty=format:${START_BOUNDARY}${formatStr}${COMMIT_BOUNDARY}`,
|
|
2747
|
-
...customArgs
|
|
2748
|
-
];
|
|
2749
|
-
const maxCount = opt.n || opt["max-count"] || opt.maxCount;
|
|
2750
|
-
if (maxCount) {
|
|
2751
|
-
command.push(`--max-count=${maxCount}`);
|
|
2752
|
-
}
|
|
2753
|
-
if (opt.from || opt.to) {
|
|
2754
|
-
const rangeOperator = opt.symmetric !== false ? "..." : "..";
|
|
2755
|
-
suffix.push(`${opt.from || ""}${rangeOperator}${opt.to || ""}`);
|
|
2756
|
-
}
|
|
2757
|
-
if (filterString(opt.file)) {
|
|
2758
|
-
command.push("--follow", pathspec(opt.file));
|
|
2759
|
-
}
|
|
2760
|
-
appendTaskOptions(userOptions(opt), command);
|
|
2761
|
-
return {
|
|
2762
|
-
fields,
|
|
2763
|
-
splitter,
|
|
2764
|
-
commands: [...command, ...suffix]
|
|
2765
|
-
};
|
|
2766
|
-
}
|
|
2767
|
-
function logTask(splitter, fields, customArgs) {
|
|
2768
|
-
const parser4 = createListLogSummaryParser(splitter, fields, logFormatFromCommand(customArgs));
|
|
2769
|
-
return {
|
|
2770
|
-
commands: ["log", ...customArgs],
|
|
2771
|
-
format: "utf-8",
|
|
2772
|
-
parser: parser4
|
|
2773
|
-
};
|
|
2774
|
-
}
|
|
2775
|
-
function log_default() {
|
|
2776
|
-
return {
|
|
2777
|
-
log(...rest) {
|
|
2778
|
-
const next = trailingFunctionArgument(arguments);
|
|
2779
|
-
const options = parseLogOptions(trailingOptionsArgument(arguments), asStringArray(filterType(arguments[0], filterArray, [])));
|
|
2780
|
-
const task = rejectDeprecatedSignatures(...rest) || validateLogFormatConfig(options.commands) || createLogTask(options);
|
|
2781
|
-
return this._runTask(task, next);
|
|
2782
|
-
}
|
|
2783
|
-
};
|
|
2784
|
-
function createLogTask(options) {
|
|
2785
|
-
return logTask(options.splitter, options.fields, options.commands);
|
|
2786
|
-
}
|
|
2787
|
-
function rejectDeprecatedSignatures(from, to) {
|
|
2788
|
-
return filterString(from) && filterString(to) && configurationErrorTask(`git.log(string, string) should be replaced with git.log({ from: string, to: string })`);
|
|
2789
|
-
}
|
|
2790
|
-
}
|
|
2791
|
-
var excludeOptions;
|
|
2792
|
-
var init_log = __esm({
|
|
2793
|
-
"src/lib/tasks/log.ts"() {
|
|
2794
|
-
init_log_format();
|
|
2795
|
-
init_pathspec();
|
|
2796
|
-
init_parse_list_log_summary();
|
|
2797
|
-
init_utils();
|
|
2798
|
-
init_task();
|
|
2799
|
-
init_diff();
|
|
2800
|
-
excludeOptions = /* @__PURE__ */ ((excludeOptions2) => {
|
|
2801
|
-
excludeOptions2[excludeOptions2["--pretty"] = 0] = "--pretty";
|
|
2802
|
-
excludeOptions2[excludeOptions2["max-count"] = 1] = "max-count";
|
|
2803
|
-
excludeOptions2[excludeOptions2["maxCount"] = 2] = "maxCount";
|
|
2804
|
-
excludeOptions2[excludeOptions2["n"] = 3] = "n";
|
|
2805
|
-
excludeOptions2[excludeOptions2["file"] = 4] = "file";
|
|
2806
|
-
excludeOptions2[excludeOptions2["format"] = 5] = "format";
|
|
2807
|
-
excludeOptions2[excludeOptions2["from"] = 6] = "from";
|
|
2808
|
-
excludeOptions2[excludeOptions2["to"] = 7] = "to";
|
|
2809
|
-
excludeOptions2[excludeOptions2["splitter"] = 8] = "splitter";
|
|
2810
|
-
excludeOptions2[excludeOptions2["symmetric"] = 9] = "symmetric";
|
|
2811
|
-
excludeOptions2[excludeOptions2["mailMap"] = 10] = "mailMap";
|
|
2812
|
-
excludeOptions2[excludeOptions2["multiLine"] = 11] = "multiLine";
|
|
2813
|
-
excludeOptions2[excludeOptions2["strictDate"] = 12] = "strictDate";
|
|
2814
|
-
return excludeOptions2;
|
|
2815
|
-
})(excludeOptions || {});
|
|
2816
|
-
}
|
|
2817
|
-
});
|
|
2818
|
-
var MergeSummaryConflict;
|
|
2819
|
-
var MergeSummaryDetail;
|
|
2820
|
-
var init_MergeSummary = __esm({
|
|
2821
|
-
"src/lib/responses/MergeSummary.ts"() {
|
|
2822
|
-
MergeSummaryConflict = class {
|
|
2823
|
-
constructor(reason, file = null, meta) {
|
|
2824
|
-
this.reason = reason;
|
|
2825
|
-
this.file = file;
|
|
2826
|
-
this.meta = meta;
|
|
2827
|
-
}
|
|
2828
|
-
toString() {
|
|
2829
|
-
return `${this.file}:${this.reason}`;
|
|
2830
|
-
}
|
|
2831
|
-
};
|
|
2832
|
-
MergeSummaryDetail = class {
|
|
2833
|
-
constructor() {
|
|
2834
|
-
this.conflicts = [];
|
|
2835
|
-
this.merges = [];
|
|
2836
|
-
this.result = "success";
|
|
2837
|
-
}
|
|
2838
|
-
get failed() {
|
|
2839
|
-
return this.conflicts.length > 0;
|
|
2840
|
-
}
|
|
2841
|
-
get reason() {
|
|
2842
|
-
return this.result;
|
|
2843
|
-
}
|
|
2844
|
-
toString() {
|
|
2845
|
-
if (this.conflicts.length) {
|
|
2846
|
-
return `CONFLICTS: ${this.conflicts.join(", ")}`;
|
|
2847
|
-
}
|
|
2848
|
-
return "OK";
|
|
2849
|
-
}
|
|
2850
|
-
};
|
|
2851
|
-
}
|
|
2852
|
-
});
|
|
2853
|
-
var PullSummary;
|
|
2854
|
-
var PullFailedSummary;
|
|
2855
|
-
var init_PullSummary = __esm({
|
|
2856
|
-
"src/lib/responses/PullSummary.ts"() {
|
|
2857
|
-
PullSummary = class {
|
|
2858
|
-
constructor() {
|
|
2859
|
-
this.remoteMessages = {
|
|
2860
|
-
all: []
|
|
2861
|
-
};
|
|
2862
|
-
this.created = [];
|
|
2863
|
-
this.deleted = [];
|
|
2864
|
-
this.files = [];
|
|
2865
|
-
this.deletions = {};
|
|
2866
|
-
this.insertions = {};
|
|
2867
|
-
this.summary = {
|
|
2868
|
-
changes: 0,
|
|
2869
|
-
deletions: 0,
|
|
2870
|
-
insertions: 0
|
|
2871
|
-
};
|
|
2872
|
-
}
|
|
2873
|
-
};
|
|
2874
|
-
PullFailedSummary = class {
|
|
2875
|
-
constructor() {
|
|
2876
|
-
this.remote = "";
|
|
2877
|
-
this.hash = {
|
|
2878
|
-
local: "",
|
|
2879
|
-
remote: ""
|
|
2880
|
-
};
|
|
2881
|
-
this.branch = {
|
|
2882
|
-
local: "",
|
|
2883
|
-
remote: ""
|
|
2884
|
-
};
|
|
2885
|
-
this.message = "";
|
|
2886
|
-
}
|
|
2887
|
-
toString() {
|
|
2888
|
-
return this.message;
|
|
2889
|
-
}
|
|
2890
|
-
};
|
|
2891
|
-
}
|
|
2892
|
-
});
|
|
2893
|
-
function objectEnumerationResult(remoteMessages) {
|
|
2894
|
-
return remoteMessages.objects = remoteMessages.objects || {
|
|
2895
|
-
compressing: 0,
|
|
2896
|
-
counting: 0,
|
|
2897
|
-
enumerating: 0,
|
|
2898
|
-
packReused: 0,
|
|
2899
|
-
reused: { count: 0, delta: 0 },
|
|
2900
|
-
total: { count: 0, delta: 0 }
|
|
2901
|
-
};
|
|
2902
|
-
}
|
|
2903
|
-
function asObjectCount(source) {
|
|
2904
|
-
const count = /^\s*(\d+)/.exec(source);
|
|
2905
|
-
const delta = /delta (\d+)/i.exec(source);
|
|
2906
|
-
return {
|
|
2907
|
-
count: asNumber(count && count[1] || "0"),
|
|
2908
|
-
delta: asNumber(delta && delta[1] || "0")
|
|
2909
|
-
};
|
|
2910
|
-
}
|
|
2911
|
-
var remoteMessagesObjectParsers;
|
|
2912
|
-
var init_parse_remote_objects = __esm({
|
|
2913
|
-
"src/lib/parsers/parse-remote-objects.ts"() {
|
|
2914
|
-
init_utils();
|
|
2915
|
-
remoteMessagesObjectParsers = [
|
|
2916
|
-
new RemoteLineParser(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i, (result, [action, count]) => {
|
|
2917
|
-
const key = action.toLowerCase();
|
|
2918
|
-
const enumeration = objectEnumerationResult(result.remoteMessages);
|
|
2919
|
-
Object.assign(enumeration, { [key]: asNumber(count) });
|
|
2920
|
-
}),
|
|
2921
|
-
new RemoteLineParser(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i, (result, [action, count]) => {
|
|
2922
|
-
const key = action.toLowerCase();
|
|
2923
|
-
const enumeration = objectEnumerationResult(result.remoteMessages);
|
|
2924
|
-
Object.assign(enumeration, { [key]: asNumber(count) });
|
|
2925
|
-
}),
|
|
2926
|
-
new RemoteLineParser(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i, (result, [total, reused, packReused]) => {
|
|
2927
|
-
const objects = objectEnumerationResult(result.remoteMessages);
|
|
2928
|
-
objects.total = asObjectCount(total);
|
|
2929
|
-
objects.reused = asObjectCount(reused);
|
|
2930
|
-
objects.packReused = asNumber(packReused);
|
|
2931
|
-
})
|
|
2932
|
-
];
|
|
2933
|
-
}
|
|
2934
|
-
});
|
|
2935
|
-
function parseRemoteMessages(_stdOut, stdErr) {
|
|
2936
|
-
return parseStringResponse({ remoteMessages: new RemoteMessageSummary }, parsers2, stdErr);
|
|
2937
|
-
}
|
|
2938
|
-
var parsers2;
|
|
2939
|
-
var RemoteMessageSummary;
|
|
2940
|
-
var init_parse_remote_messages = __esm({
|
|
2941
|
-
"src/lib/parsers/parse-remote-messages.ts"() {
|
|
2942
|
-
init_utils();
|
|
2943
|
-
init_parse_remote_objects();
|
|
2944
|
-
parsers2 = [
|
|
2945
|
-
new RemoteLineParser(/^remote:\s*(.+)$/, (result, [text]) => {
|
|
2946
|
-
result.remoteMessages.all.push(text.trim());
|
|
2947
|
-
return false;
|
|
2948
|
-
}),
|
|
2949
|
-
...remoteMessagesObjectParsers,
|
|
2950
|
-
new RemoteLineParser([/create a (?:pull|merge) request/i, /\s(https?:\/\/\S+)$/], (result, [pullRequestUrl]) => {
|
|
2951
|
-
result.remoteMessages.pullRequestUrl = pullRequestUrl;
|
|
2952
|
-
}),
|
|
2953
|
-
new RemoteLineParser([/found (\d+) vulnerabilities.+\(([^)]+)\)/i, /\s(https?:\/\/\S+)$/], (result, [count, summary, url]) => {
|
|
2954
|
-
result.remoteMessages.vulnerabilities = {
|
|
2955
|
-
count: asNumber(count),
|
|
2956
|
-
summary,
|
|
2957
|
-
url
|
|
2958
|
-
};
|
|
2959
|
-
})
|
|
2960
|
-
];
|
|
2961
|
-
RemoteMessageSummary = class {
|
|
2962
|
-
constructor() {
|
|
2963
|
-
this.all = [];
|
|
2964
|
-
}
|
|
2965
|
-
};
|
|
2966
|
-
}
|
|
2967
|
-
});
|
|
2968
|
-
function parsePullErrorResult(stdOut, stdErr) {
|
|
2969
|
-
const pullError = parseStringResponse(new PullFailedSummary, errorParsers, [stdOut, stdErr]);
|
|
2970
|
-
return pullError.message && pullError;
|
|
2971
|
-
}
|
|
2972
|
-
var FILE_UPDATE_REGEX;
|
|
2973
|
-
var SUMMARY_REGEX;
|
|
2974
|
-
var ACTION_REGEX;
|
|
2975
|
-
var parsers3;
|
|
2976
|
-
var errorParsers;
|
|
2977
|
-
var parsePullDetail;
|
|
2978
|
-
var parsePullResult;
|
|
2979
|
-
var init_parse_pull = __esm({
|
|
2980
|
-
"src/lib/parsers/parse-pull.ts"() {
|
|
2981
|
-
init_PullSummary();
|
|
2982
|
-
init_utils();
|
|
2983
|
-
init_parse_remote_messages();
|
|
2984
|
-
FILE_UPDATE_REGEX = /^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/;
|
|
2985
|
-
SUMMARY_REGEX = /(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/;
|
|
2986
|
-
ACTION_REGEX = /^(create|delete) mode \d+ (.+)/;
|
|
2987
|
-
parsers3 = [
|
|
2988
|
-
new LineParser(FILE_UPDATE_REGEX, (result, [file, insertions, deletions]) => {
|
|
2989
|
-
result.files.push(file);
|
|
2990
|
-
if (insertions) {
|
|
2991
|
-
result.insertions[file] = insertions.length;
|
|
2992
|
-
}
|
|
2993
|
-
if (deletions) {
|
|
2994
|
-
result.deletions[file] = deletions.length;
|
|
2995
|
-
}
|
|
2996
|
-
}),
|
|
2997
|
-
new LineParser(SUMMARY_REGEX, (result, [changes, , insertions, , deletions]) => {
|
|
2998
|
-
if (insertions !== undefined || deletions !== undefined) {
|
|
2999
|
-
result.summary.changes = +changes || 0;
|
|
3000
|
-
result.summary.insertions = +insertions || 0;
|
|
3001
|
-
result.summary.deletions = +deletions || 0;
|
|
3002
|
-
return true;
|
|
3003
|
-
}
|
|
3004
|
-
return false;
|
|
3005
|
-
}),
|
|
3006
|
-
new LineParser(ACTION_REGEX, (result, [action, file]) => {
|
|
3007
|
-
append(result.files, file);
|
|
3008
|
-
append(action === "create" ? result.created : result.deleted, file);
|
|
3009
|
-
})
|
|
3010
|
-
];
|
|
3011
|
-
errorParsers = [
|
|
3012
|
-
new LineParser(/^from\s(.+)$/i, (result, [remote]) => void (result.remote = remote)),
|
|
3013
|
-
new LineParser(/^fatal:\s(.+)$/, (result, [message]) => void (result.message = message)),
|
|
3014
|
-
new LineParser(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/, (result, [hashLocal, hashRemote, branchLocal, branchRemote]) => {
|
|
3015
|
-
result.branch.local = branchLocal;
|
|
3016
|
-
result.hash.local = hashLocal;
|
|
3017
|
-
result.branch.remote = branchRemote;
|
|
3018
|
-
result.hash.remote = hashRemote;
|
|
3019
|
-
})
|
|
3020
|
-
];
|
|
3021
|
-
parsePullDetail = (stdOut, stdErr) => {
|
|
3022
|
-
return parseStringResponse(new PullSummary, parsers3, [stdOut, stdErr]);
|
|
3023
|
-
};
|
|
3024
|
-
parsePullResult = (stdOut, stdErr) => {
|
|
3025
|
-
return Object.assign(new PullSummary, parsePullDetail(stdOut, stdErr), parseRemoteMessages(stdOut, stdErr));
|
|
3026
|
-
};
|
|
3027
|
-
}
|
|
3028
|
-
});
|
|
3029
|
-
var parsers4;
|
|
3030
|
-
var parseMergeResult;
|
|
3031
|
-
var parseMergeDetail;
|
|
3032
|
-
var init_parse_merge = __esm({
|
|
3033
|
-
"src/lib/parsers/parse-merge.ts"() {
|
|
3034
|
-
init_MergeSummary();
|
|
3035
|
-
init_utils();
|
|
3036
|
-
init_parse_pull();
|
|
3037
|
-
parsers4 = [
|
|
3038
|
-
new LineParser(/^Auto-merging\s+(.+)$/, (summary, [autoMerge]) => {
|
|
3039
|
-
summary.merges.push(autoMerge);
|
|
3040
|
-
}),
|
|
3041
|
-
new LineParser(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/, (summary, [reason, file]) => {
|
|
3042
|
-
summary.conflicts.push(new MergeSummaryConflict(reason, file));
|
|
3043
|
-
}),
|
|
3044
|
-
new LineParser(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/, (summary, [reason, file, deleteRef]) => {
|
|
3045
|
-
summary.conflicts.push(new MergeSummaryConflict(reason, file, { deleteRef }));
|
|
3046
|
-
}),
|
|
3047
|
-
new LineParser(/^CONFLICT\s+\((.+)\):/, (summary, [reason]) => {
|
|
3048
|
-
summary.conflicts.push(new MergeSummaryConflict(reason, null));
|
|
3049
|
-
}),
|
|
3050
|
-
new LineParser(/^Automatic merge failed;\s+(.+)$/, (summary, [result]) => {
|
|
3051
|
-
summary.result = result;
|
|
3052
|
-
})
|
|
3053
|
-
];
|
|
3054
|
-
parseMergeResult = (stdOut, stdErr) => {
|
|
3055
|
-
return Object.assign(parseMergeDetail(stdOut, stdErr), parsePullResult(stdOut, stdErr));
|
|
3056
|
-
};
|
|
3057
|
-
parseMergeDetail = (stdOut) => {
|
|
3058
|
-
return parseStringResponse(new MergeSummaryDetail, parsers4, stdOut);
|
|
3059
|
-
};
|
|
3060
|
-
}
|
|
3061
|
-
});
|
|
3062
|
-
function mergeTask(customArgs) {
|
|
3063
|
-
if (!customArgs.length) {
|
|
3064
|
-
return configurationErrorTask("Git.merge requires at least one option");
|
|
3065
|
-
}
|
|
3066
|
-
return {
|
|
3067
|
-
commands: ["merge", ...customArgs],
|
|
3068
|
-
format: "utf-8",
|
|
3069
|
-
parser(stdOut, stdErr) {
|
|
3070
|
-
const merge = parseMergeResult(stdOut, stdErr);
|
|
3071
|
-
if (merge.failed) {
|
|
3072
|
-
throw new GitResponseError(merge);
|
|
3073
|
-
}
|
|
3074
|
-
return merge;
|
|
3075
|
-
}
|
|
3076
|
-
};
|
|
3077
|
-
}
|
|
3078
|
-
var init_merge = __esm({
|
|
3079
|
-
"src/lib/tasks/merge.ts"() {
|
|
3080
|
-
init_git_response_error();
|
|
3081
|
-
init_parse_merge();
|
|
3082
|
-
init_task();
|
|
3083
|
-
}
|
|
3084
|
-
});
|
|
3085
|
-
function pushResultPushedItem(local, remote, status) {
|
|
3086
|
-
const deleted = status.includes("deleted");
|
|
3087
|
-
const tag = status.includes("tag") || /^refs\/tags/.test(local);
|
|
3088
|
-
const alreadyUpdated = !status.includes("new");
|
|
3089
|
-
return {
|
|
3090
|
-
deleted,
|
|
3091
|
-
tag,
|
|
3092
|
-
branch: !tag,
|
|
3093
|
-
new: !alreadyUpdated,
|
|
3094
|
-
alreadyUpdated,
|
|
3095
|
-
local,
|
|
3096
|
-
remote
|
|
3097
|
-
};
|
|
3098
|
-
}
|
|
3099
|
-
var parsers5;
|
|
3100
|
-
var parsePushResult;
|
|
3101
|
-
var parsePushDetail;
|
|
3102
|
-
var init_parse_push = __esm({
|
|
3103
|
-
"src/lib/parsers/parse-push.ts"() {
|
|
3104
|
-
init_utils();
|
|
3105
|
-
init_parse_remote_messages();
|
|
3106
|
-
parsers5 = [
|
|
3107
|
-
new LineParser(/^Pushing to (.+)$/, (result, [repo]) => {
|
|
3108
|
-
result.repo = repo;
|
|
3109
|
-
}),
|
|
3110
|
-
new LineParser(/^updating local tracking ref '(.+)'/, (result, [local]) => {
|
|
3111
|
-
result.ref = {
|
|
3112
|
-
...result.ref || {},
|
|
3113
|
-
local
|
|
3114
|
-
};
|
|
3115
|
-
}),
|
|
3116
|
-
new LineParser(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/, (result, [local, remote, type]) => {
|
|
3117
|
-
result.pushed.push(pushResultPushedItem(local, remote, type));
|
|
3118
|
-
}),
|
|
3119
|
-
new LineParser(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/, (result, [local, remote, remoteName]) => {
|
|
3120
|
-
result.branch = {
|
|
3121
|
-
...result.branch || {},
|
|
3122
|
-
local,
|
|
3123
|
-
remote,
|
|
3124
|
-
remoteName
|
|
3125
|
-
};
|
|
3126
|
-
}),
|
|
3127
|
-
new LineParser(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/, (result, [local, remote, from, to]) => {
|
|
3128
|
-
result.update = {
|
|
3129
|
-
head: {
|
|
3130
|
-
local,
|
|
3131
|
-
remote
|
|
3132
|
-
},
|
|
3133
|
-
hash: {
|
|
3134
|
-
from,
|
|
3135
|
-
to
|
|
3136
|
-
}
|
|
3137
|
-
};
|
|
3138
|
-
})
|
|
3139
|
-
];
|
|
3140
|
-
parsePushResult = (stdOut, stdErr) => {
|
|
3141
|
-
const pushDetail = parsePushDetail(stdOut, stdErr);
|
|
3142
|
-
const responseDetail = parseRemoteMessages(stdOut, stdErr);
|
|
3143
|
-
return {
|
|
3144
|
-
...pushDetail,
|
|
3145
|
-
...responseDetail
|
|
3146
|
-
};
|
|
3147
|
-
};
|
|
3148
|
-
parsePushDetail = (stdOut, stdErr) => {
|
|
3149
|
-
return parseStringResponse({ pushed: [] }, parsers5, [stdOut, stdErr]);
|
|
3150
|
-
};
|
|
3151
|
-
}
|
|
3152
|
-
});
|
|
3153
|
-
var push_exports = {};
|
|
3154
|
-
__export(push_exports, {
|
|
3155
|
-
pushTagsTask: () => pushTagsTask,
|
|
3156
|
-
pushTask: () => pushTask
|
|
3157
|
-
});
|
|
3158
|
-
function pushTagsTask(ref = {}, customArgs) {
|
|
3159
|
-
append(customArgs, "--tags");
|
|
3160
|
-
return pushTask(ref, customArgs);
|
|
3161
|
-
}
|
|
3162
|
-
function pushTask(ref = {}, customArgs) {
|
|
3163
|
-
const commands = ["push", ...customArgs];
|
|
3164
|
-
if (ref.branch) {
|
|
3165
|
-
commands.splice(1, 0, ref.branch);
|
|
3166
|
-
}
|
|
3167
|
-
if (ref.remote) {
|
|
3168
|
-
commands.splice(1, 0, ref.remote);
|
|
3169
|
-
}
|
|
3170
|
-
remove(commands, "-v");
|
|
3171
|
-
append(commands, "--verbose");
|
|
3172
|
-
append(commands, "--porcelain");
|
|
3173
|
-
return {
|
|
3174
|
-
commands,
|
|
3175
|
-
format: "utf-8",
|
|
3176
|
-
parser: parsePushResult
|
|
3177
|
-
};
|
|
3178
|
-
}
|
|
3179
|
-
var init_push = __esm({
|
|
3180
|
-
"src/lib/tasks/push.ts"() {
|
|
3181
|
-
init_parse_push();
|
|
3182
|
-
init_utils();
|
|
3183
|
-
}
|
|
3184
|
-
});
|
|
3185
|
-
function show_default() {
|
|
3186
|
-
return {
|
|
3187
|
-
showBuffer() {
|
|
3188
|
-
const commands = ["show", ...getTrailingOptions(arguments, 1)];
|
|
3189
|
-
if (!commands.includes("--binary")) {
|
|
3190
|
-
commands.splice(1, 0, "--binary");
|
|
3191
|
-
}
|
|
3192
|
-
return this._runTask(straightThroughBufferTask(commands), trailingFunctionArgument(arguments));
|
|
3193
|
-
},
|
|
3194
|
-
show() {
|
|
3195
|
-
const commands = ["show", ...getTrailingOptions(arguments, 1)];
|
|
3196
|
-
return this._runTask(straightThroughStringTask(commands), trailingFunctionArgument(arguments));
|
|
3197
|
-
}
|
|
3198
|
-
};
|
|
3199
|
-
}
|
|
3200
|
-
var init_show = __esm({
|
|
3201
|
-
"src/lib/tasks/show.ts"() {
|
|
3202
|
-
init_utils();
|
|
3203
|
-
init_task();
|
|
3204
|
-
}
|
|
3205
|
-
});
|
|
3206
|
-
var fromPathRegex;
|
|
3207
|
-
var FileStatusSummary;
|
|
3208
|
-
var init_FileStatusSummary = __esm({
|
|
3209
|
-
"src/lib/responses/FileStatusSummary.ts"() {
|
|
3210
|
-
fromPathRegex = /^(.+)\0(.+)$/;
|
|
3211
|
-
FileStatusSummary = class {
|
|
3212
|
-
constructor(path, index, working_dir) {
|
|
3213
|
-
this.path = path;
|
|
3214
|
-
this.index = index;
|
|
3215
|
-
this.working_dir = working_dir;
|
|
3216
|
-
if (index === "R" || working_dir === "R") {
|
|
3217
|
-
const detail = fromPathRegex.exec(path) || [null, path, path];
|
|
3218
|
-
this.from = detail[2] || "";
|
|
3219
|
-
this.path = detail[1] || "";
|
|
3220
|
-
}
|
|
3221
|
-
}
|
|
3222
|
-
};
|
|
3223
|
-
}
|
|
3224
|
-
});
|
|
3225
|
-
function renamedFile(line) {
|
|
3226
|
-
const [to, from] = line.split(NULL);
|
|
3227
|
-
return {
|
|
3228
|
-
from: from || to,
|
|
3229
|
-
to
|
|
3230
|
-
};
|
|
3231
|
-
}
|
|
3232
|
-
function parser3(indexX, indexY, handler) {
|
|
3233
|
-
return [`${indexX}${indexY}`, handler];
|
|
3234
|
-
}
|
|
3235
|
-
function conflicts(indexX, ...indexY) {
|
|
3236
|
-
return indexY.map((y) => parser3(indexX, y, (result, file) => append(result.conflicted, file)));
|
|
3237
|
-
}
|
|
3238
|
-
function splitLine(result, lineStr) {
|
|
3239
|
-
const trimmed2 = lineStr.trim();
|
|
3240
|
-
switch (" ") {
|
|
3241
|
-
case trimmed2.charAt(2):
|
|
3242
|
-
return data(trimmed2.charAt(0), trimmed2.charAt(1), trimmed2.substr(3));
|
|
3243
|
-
case trimmed2.charAt(1):
|
|
3244
|
-
return data(" ", trimmed2.charAt(0), trimmed2.substr(2));
|
|
3245
|
-
default:
|
|
3246
|
-
return;
|
|
3247
|
-
}
|
|
3248
|
-
function data(index, workingDir, path) {
|
|
3249
|
-
const raw = `${index}${workingDir}`;
|
|
3250
|
-
const handler = parsers6.get(raw);
|
|
3251
|
-
if (handler) {
|
|
3252
|
-
handler(result, path);
|
|
3253
|
-
}
|
|
3254
|
-
if (raw !== "##" && raw !== "!!") {
|
|
3255
|
-
result.files.push(new FileStatusSummary(path, index, workingDir));
|
|
3256
|
-
}
|
|
3257
|
-
}
|
|
3258
|
-
}
|
|
3259
|
-
var StatusSummary;
|
|
3260
|
-
var parsers6;
|
|
3261
|
-
var parseStatusSummary;
|
|
3262
|
-
var init_StatusSummary = __esm({
|
|
3263
|
-
"src/lib/responses/StatusSummary.ts"() {
|
|
3264
|
-
init_utils();
|
|
3265
|
-
init_FileStatusSummary();
|
|
3266
|
-
StatusSummary = class {
|
|
3267
|
-
constructor() {
|
|
3268
|
-
this.not_added = [];
|
|
3269
|
-
this.conflicted = [];
|
|
3270
|
-
this.created = [];
|
|
3271
|
-
this.deleted = [];
|
|
3272
|
-
this.ignored = undefined;
|
|
3273
|
-
this.modified = [];
|
|
3274
|
-
this.renamed = [];
|
|
3275
|
-
this.files = [];
|
|
3276
|
-
this.staged = [];
|
|
3277
|
-
this.ahead = 0;
|
|
3278
|
-
this.behind = 0;
|
|
3279
|
-
this.current = null;
|
|
3280
|
-
this.tracking = null;
|
|
3281
|
-
this.detached = false;
|
|
3282
|
-
this.isClean = () => {
|
|
3283
|
-
return !this.files.length;
|
|
3284
|
-
};
|
|
3285
|
-
}
|
|
3286
|
-
};
|
|
3287
|
-
parsers6 = new Map([
|
|
3288
|
-
parser3(" ", "A", (result, file) => append(result.created, file)),
|
|
3289
|
-
parser3(" ", "D", (result, file) => append(result.deleted, file)),
|
|
3290
|
-
parser3(" ", "M", (result, file) => append(result.modified, file)),
|
|
3291
|
-
parser3("A", " ", (result, file) => append(result.created, file) && append(result.staged, file)),
|
|
3292
|
-
parser3("A", "M", (result, file) => append(result.created, file) && append(result.staged, file) && append(result.modified, file)),
|
|
3293
|
-
parser3("D", " ", (result, file) => append(result.deleted, file) && append(result.staged, file)),
|
|
3294
|
-
parser3("M", " ", (result, file) => append(result.modified, file) && append(result.staged, file)),
|
|
3295
|
-
parser3("M", "M", (result, file) => append(result.modified, file) && append(result.staged, file)),
|
|
3296
|
-
parser3("R", " ", (result, file) => {
|
|
3297
|
-
append(result.renamed, renamedFile(file));
|
|
3298
|
-
}),
|
|
3299
|
-
parser3("R", "M", (result, file) => {
|
|
3300
|
-
const renamed = renamedFile(file);
|
|
3301
|
-
append(result.renamed, renamed);
|
|
3302
|
-
append(result.modified, renamed.to);
|
|
3303
|
-
}),
|
|
3304
|
-
parser3("!", "!", (_result, _file) => {
|
|
3305
|
-
append(_result.ignored = _result.ignored || [], _file);
|
|
3306
|
-
}),
|
|
3307
|
-
parser3("?", "?", (result, file) => append(result.not_added, file)),
|
|
3308
|
-
...conflicts("A", "A", "U"),
|
|
3309
|
-
...conflicts("D", "D", "U"),
|
|
3310
|
-
...conflicts("U", "A", "D", "U"),
|
|
3311
|
-
[
|
|
3312
|
-
"##",
|
|
3313
|
-
(result, line) => {
|
|
3314
|
-
const aheadReg = /ahead (\d+)/;
|
|
3315
|
-
const behindReg = /behind (\d+)/;
|
|
3316
|
-
const currentReg = /^(.+?(?=(?:\.{3}|\s|$)))/;
|
|
3317
|
-
const trackingReg = /\.{3}(\S*)/;
|
|
3318
|
-
const onEmptyBranchReg = /\son\s(\S+?)(?=\.{3}|$)/;
|
|
3319
|
-
let regexResult = aheadReg.exec(line);
|
|
3320
|
-
result.ahead = regexResult && +regexResult[1] || 0;
|
|
3321
|
-
regexResult = behindReg.exec(line);
|
|
3322
|
-
result.behind = regexResult && +regexResult[1] || 0;
|
|
3323
|
-
regexResult = currentReg.exec(line);
|
|
3324
|
-
result.current = filterType(regexResult?.[1], filterString, null);
|
|
3325
|
-
regexResult = trackingReg.exec(line);
|
|
3326
|
-
result.tracking = filterType(regexResult?.[1], filterString, null);
|
|
3327
|
-
regexResult = onEmptyBranchReg.exec(line);
|
|
3328
|
-
if (regexResult) {
|
|
3329
|
-
result.current = filterType(regexResult?.[1], filterString, result.current);
|
|
3330
|
-
}
|
|
3331
|
-
result.detached = /\(no branch\)/.test(line);
|
|
3332
|
-
}
|
|
3333
|
-
]
|
|
3334
|
-
]);
|
|
3335
|
-
parseStatusSummary = function(text) {
|
|
3336
|
-
const lines = text.split(NULL);
|
|
3337
|
-
const status = new StatusSummary;
|
|
3338
|
-
for (let i = 0, l = lines.length;i < l; ) {
|
|
3339
|
-
let line = lines[i++].trim();
|
|
3340
|
-
if (!line) {
|
|
3341
|
-
continue;
|
|
3342
|
-
}
|
|
3343
|
-
if (line.charAt(0) === "R") {
|
|
3344
|
-
line += NULL + (lines[i++] || "");
|
|
3345
|
-
}
|
|
3346
|
-
splitLine(status, line);
|
|
3347
|
-
}
|
|
3348
|
-
return status;
|
|
3349
|
-
};
|
|
3350
|
-
}
|
|
3351
|
-
});
|
|
3352
|
-
function statusTask(customArgs) {
|
|
3353
|
-
const commands = [
|
|
3354
|
-
"status",
|
|
3355
|
-
"--porcelain",
|
|
3356
|
-
"-b",
|
|
3357
|
-
"-u",
|
|
3358
|
-
"--null",
|
|
3359
|
-
...customArgs.filter((arg) => !ignoredOptions.includes(arg))
|
|
3360
|
-
];
|
|
3361
|
-
return {
|
|
3362
|
-
format: "utf-8",
|
|
3363
|
-
commands,
|
|
3364
|
-
parser(text) {
|
|
3365
|
-
return parseStatusSummary(text);
|
|
3366
|
-
}
|
|
3367
|
-
};
|
|
3368
|
-
}
|
|
3369
|
-
var ignoredOptions;
|
|
3370
|
-
var init_status = __esm({
|
|
3371
|
-
"src/lib/tasks/status.ts"() {
|
|
3372
|
-
init_StatusSummary();
|
|
3373
|
-
ignoredOptions = ["--null", "-z"];
|
|
3374
|
-
}
|
|
3375
|
-
});
|
|
3376
|
-
function versionResponse(major = 0, minor = 0, patch = 0, agent = "", installed = true) {
|
|
3377
|
-
return Object.defineProperty({
|
|
3378
|
-
major,
|
|
3379
|
-
minor,
|
|
3380
|
-
patch,
|
|
3381
|
-
agent,
|
|
3382
|
-
installed
|
|
3383
|
-
}, "toString", {
|
|
3384
|
-
value() {
|
|
3385
|
-
return `${this.major}.${this.minor}.${this.patch}`;
|
|
3386
|
-
},
|
|
3387
|
-
configurable: false,
|
|
3388
|
-
enumerable: false
|
|
3389
|
-
});
|
|
3390
|
-
}
|
|
3391
|
-
function notInstalledResponse() {
|
|
3392
|
-
return versionResponse(0, 0, 0, "", false);
|
|
3393
|
-
}
|
|
3394
|
-
function version_default() {
|
|
3395
|
-
return {
|
|
3396
|
-
version() {
|
|
3397
|
-
return this._runTask({
|
|
3398
|
-
commands: ["--version"],
|
|
3399
|
-
format: "utf-8",
|
|
3400
|
-
parser: versionParser,
|
|
3401
|
-
onError(result, error, done, fail) {
|
|
3402
|
-
if (result.exitCode === -2) {
|
|
3403
|
-
return done(Buffer.from(NOT_INSTALLED));
|
|
3404
|
-
}
|
|
3405
|
-
fail(error);
|
|
3406
|
-
}
|
|
3407
|
-
});
|
|
3408
|
-
}
|
|
3409
|
-
};
|
|
3410
|
-
}
|
|
3411
|
-
function versionParser(stdOut) {
|
|
3412
|
-
if (stdOut === NOT_INSTALLED) {
|
|
3413
|
-
return notInstalledResponse();
|
|
3414
|
-
}
|
|
3415
|
-
return parseStringResponse(versionResponse(0, 0, 0, stdOut), parsers7, stdOut);
|
|
3416
|
-
}
|
|
3417
|
-
var NOT_INSTALLED;
|
|
3418
|
-
var parsers7;
|
|
3419
|
-
var init_version = __esm({
|
|
3420
|
-
"src/lib/tasks/version.ts"() {
|
|
3421
|
-
init_utils();
|
|
3422
|
-
NOT_INSTALLED = "installed=false";
|
|
3423
|
-
parsers7 = [
|
|
3424
|
-
new LineParser(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/, (result, [major, minor, patch, agent = ""]) => {
|
|
3425
|
-
Object.assign(result, versionResponse(asNumber(major), asNumber(minor), asNumber(patch), agent));
|
|
3426
|
-
}),
|
|
3427
|
-
new LineParser(/version (\d+)\.(\d+)\.(\D+)(.+)?$/, (result, [major, minor, patch, agent = ""]) => {
|
|
3428
|
-
Object.assign(result, versionResponse(asNumber(major), asNumber(minor), patch, agent));
|
|
3429
|
-
})
|
|
3430
|
-
];
|
|
3431
|
-
}
|
|
3432
|
-
});
|
|
3433
|
-
var simple_git_api_exports = {};
|
|
3434
|
-
__export(simple_git_api_exports, {
|
|
3435
|
-
SimpleGitApi: () => SimpleGitApi
|
|
3436
|
-
});
|
|
3437
|
-
var SimpleGitApi;
|
|
3438
|
-
var init_simple_git_api = __esm({
|
|
3439
|
-
"src/lib/simple-git-api.ts"() {
|
|
3440
|
-
init_task_callback();
|
|
3441
|
-
init_change_working_directory();
|
|
3442
|
-
init_checkout();
|
|
3443
|
-
init_count_objects();
|
|
3444
|
-
init_commit();
|
|
3445
|
-
init_config();
|
|
3446
|
-
init_first_commit();
|
|
3447
|
-
init_grep();
|
|
3448
|
-
init_hash_object();
|
|
3449
|
-
init_init();
|
|
3450
|
-
init_log();
|
|
3451
|
-
init_merge();
|
|
3452
|
-
init_push();
|
|
3453
|
-
init_show();
|
|
3454
|
-
init_status();
|
|
3455
|
-
init_task();
|
|
3456
|
-
init_version();
|
|
3457
|
-
init_utils();
|
|
3458
|
-
SimpleGitApi = class {
|
|
3459
|
-
constructor(_executor) {
|
|
3460
|
-
this._executor = _executor;
|
|
3461
|
-
}
|
|
3462
|
-
_runTask(task, then) {
|
|
3463
|
-
const chain = this._executor.chain();
|
|
3464
|
-
const promise = chain.push(task);
|
|
3465
|
-
if (then) {
|
|
3466
|
-
taskCallback(task, promise, then);
|
|
3467
|
-
}
|
|
3468
|
-
return Object.create(this, {
|
|
3469
|
-
then: { value: promise.then.bind(promise) },
|
|
3470
|
-
catch: { value: promise.catch.bind(promise) },
|
|
3471
|
-
_executor: { value: chain }
|
|
3472
|
-
});
|
|
3473
|
-
}
|
|
3474
|
-
add(files) {
|
|
3475
|
-
return this._runTask(straightThroughStringTask(["add", ...asArray(files)]), trailingFunctionArgument(arguments));
|
|
3476
|
-
}
|
|
3477
|
-
cwd(directory) {
|
|
3478
|
-
const next = trailingFunctionArgument(arguments);
|
|
3479
|
-
if (typeof directory === "string") {
|
|
3480
|
-
return this._runTask(changeWorkingDirectoryTask(directory, this._executor), next);
|
|
3481
|
-
}
|
|
3482
|
-
if (typeof directory?.path === "string") {
|
|
3483
|
-
return this._runTask(changeWorkingDirectoryTask(directory.path, directory.root && this._executor || undefined), next);
|
|
3484
|
-
}
|
|
3485
|
-
return this._runTask(configurationErrorTask("Git.cwd: workingDirectory must be supplied as a string"), next);
|
|
3486
|
-
}
|
|
3487
|
-
hashObject(path, write) {
|
|
3488
|
-
return this._runTask(hashObjectTask(path, write === true), trailingFunctionArgument(arguments));
|
|
3489
|
-
}
|
|
3490
|
-
init(bare) {
|
|
3491
|
-
return this._runTask(initTask(bare === true, this._executor.cwd, getTrailingOptions(arguments)), trailingFunctionArgument(arguments));
|
|
3492
|
-
}
|
|
3493
|
-
merge() {
|
|
3494
|
-
return this._runTask(mergeTask(getTrailingOptions(arguments)), trailingFunctionArgument(arguments));
|
|
3495
|
-
}
|
|
3496
|
-
mergeFromTo(remote, branch) {
|
|
3497
|
-
if (!(filterString(remote) && filterString(branch))) {
|
|
3498
|
-
return this._runTask(configurationErrorTask(`Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`));
|
|
3499
|
-
}
|
|
3500
|
-
return this._runTask(mergeTask([remote, branch, ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments, false));
|
|
3501
|
-
}
|
|
3502
|
-
outputHandler(handler) {
|
|
3503
|
-
this._executor.outputHandler = handler;
|
|
3504
|
-
return this;
|
|
3505
|
-
}
|
|
3506
|
-
push() {
|
|
3507
|
-
const task = pushTask({
|
|
3508
|
-
remote: filterType(arguments[0], filterString),
|
|
3509
|
-
branch: filterType(arguments[1], filterString)
|
|
3510
|
-
}, getTrailingOptions(arguments));
|
|
3511
|
-
return this._runTask(task, trailingFunctionArgument(arguments));
|
|
3512
|
-
}
|
|
3513
|
-
stash() {
|
|
3514
|
-
return this._runTask(straightThroughStringTask(["stash", ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments));
|
|
3515
|
-
}
|
|
3516
|
-
status() {
|
|
3517
|
-
return this._runTask(statusTask(getTrailingOptions(arguments)), trailingFunctionArgument(arguments));
|
|
3518
|
-
}
|
|
3519
|
-
};
|
|
3520
|
-
Object.assign(SimpleGitApi.prototype, checkout_default(), commit_default(), config_default(), count_objects_default(), first_commit_default(), grep_default(), log_default(), show_default(), version_default());
|
|
3521
|
-
}
|
|
3522
|
-
});
|
|
3523
|
-
var scheduler_exports = {};
|
|
3524
|
-
__export(scheduler_exports, {
|
|
3525
|
-
Scheduler: () => Scheduler
|
|
3526
|
-
});
|
|
3527
|
-
var createScheduledTask;
|
|
3528
|
-
var Scheduler;
|
|
3529
|
-
var init_scheduler = __esm({
|
|
3530
|
-
"src/lib/runners/scheduler.ts"() {
|
|
3531
|
-
init_utils();
|
|
3532
|
-
init_git_logger();
|
|
3533
|
-
createScheduledTask = /* @__PURE__ */ (() => {
|
|
3534
|
-
let id = 0;
|
|
3535
|
-
return () => {
|
|
3536
|
-
id++;
|
|
3537
|
-
const { promise, done } = import_promise_deferred.createDeferred();
|
|
3538
|
-
return {
|
|
3539
|
-
promise,
|
|
3540
|
-
done,
|
|
3541
|
-
id
|
|
3542
|
-
};
|
|
3543
|
-
};
|
|
3544
|
-
})();
|
|
3545
|
-
Scheduler = class {
|
|
3546
|
-
constructor(concurrency = 2) {
|
|
3547
|
-
this.concurrency = concurrency;
|
|
3548
|
-
this.logger = createLogger("", "scheduler");
|
|
3549
|
-
this.pending = [];
|
|
3550
|
-
this.running = [];
|
|
3551
|
-
this.logger(`Constructed, concurrency=%s`, concurrency);
|
|
3552
|
-
}
|
|
3553
|
-
schedule() {
|
|
3554
|
-
if (!this.pending.length || this.running.length >= this.concurrency) {
|
|
3555
|
-
this.logger(`Schedule attempt ignored, pending=%s running=%s concurrency=%s`, this.pending.length, this.running.length, this.concurrency);
|
|
3556
|
-
return;
|
|
3557
|
-
}
|
|
3558
|
-
const task = append(this.running, this.pending.shift());
|
|
3559
|
-
this.logger(`Attempting id=%s`, task.id);
|
|
3560
|
-
task.done(() => {
|
|
3561
|
-
this.logger(`Completing id=`, task.id);
|
|
3562
|
-
remove(this.running, task);
|
|
3563
|
-
this.schedule();
|
|
3564
|
-
});
|
|
3565
|
-
}
|
|
3566
|
-
next() {
|
|
3567
|
-
const { promise, id } = append(this.pending, createScheduledTask());
|
|
3568
|
-
this.logger(`Scheduling id=%s`, id);
|
|
3569
|
-
this.schedule();
|
|
3570
|
-
return promise;
|
|
3571
|
-
}
|
|
3572
|
-
};
|
|
3573
|
-
}
|
|
3574
|
-
});
|
|
3575
|
-
var apply_patch_exports = {};
|
|
3576
|
-
__export(apply_patch_exports, {
|
|
3577
|
-
applyPatchTask: () => applyPatchTask
|
|
3578
|
-
});
|
|
3579
|
-
function applyPatchTask(patches, customArgs) {
|
|
3580
|
-
return straightThroughStringTask(["apply", ...customArgs, ...patches]);
|
|
3581
|
-
}
|
|
3582
|
-
var init_apply_patch = __esm({
|
|
3583
|
-
"src/lib/tasks/apply-patch.ts"() {
|
|
3584
|
-
init_task();
|
|
3585
|
-
}
|
|
3586
|
-
});
|
|
3587
|
-
function branchDeletionSuccess(branch, hash) {
|
|
3588
|
-
return {
|
|
3589
|
-
branch,
|
|
3590
|
-
hash,
|
|
3591
|
-
success: true
|
|
3592
|
-
};
|
|
3593
|
-
}
|
|
3594
|
-
function branchDeletionFailure(branch) {
|
|
3595
|
-
return {
|
|
3596
|
-
branch,
|
|
3597
|
-
hash: null,
|
|
3598
|
-
success: false
|
|
3599
|
-
};
|
|
3600
|
-
}
|
|
3601
|
-
var BranchDeletionBatch;
|
|
3602
|
-
var init_BranchDeleteSummary = __esm({
|
|
3603
|
-
"src/lib/responses/BranchDeleteSummary.ts"() {
|
|
3604
|
-
BranchDeletionBatch = class {
|
|
3605
|
-
constructor() {
|
|
3606
|
-
this.all = [];
|
|
3607
|
-
this.branches = {};
|
|
3608
|
-
this.errors = [];
|
|
3609
|
-
}
|
|
3610
|
-
get success() {
|
|
3611
|
-
return !this.errors.length;
|
|
3612
|
-
}
|
|
3613
|
-
};
|
|
3614
|
-
}
|
|
3615
|
-
});
|
|
3616
|
-
function hasBranchDeletionError(data, processExitCode) {
|
|
3617
|
-
return processExitCode === 1 && deleteErrorRegex.test(data);
|
|
3618
|
-
}
|
|
3619
|
-
var deleteSuccessRegex;
|
|
3620
|
-
var deleteErrorRegex;
|
|
3621
|
-
var parsers8;
|
|
3622
|
-
var parseBranchDeletions;
|
|
3623
|
-
var init_parse_branch_delete = __esm({
|
|
3624
|
-
"src/lib/parsers/parse-branch-delete.ts"() {
|
|
3625
|
-
init_BranchDeleteSummary();
|
|
3626
|
-
init_utils();
|
|
3627
|
-
deleteSuccessRegex = /(\S+)\s+\(\S+\s([^)]+)\)/;
|
|
3628
|
-
deleteErrorRegex = /^error[^']+'([^']+)'/m;
|
|
3629
|
-
parsers8 = [
|
|
3630
|
-
new LineParser(deleteSuccessRegex, (result, [branch, hash]) => {
|
|
3631
|
-
const deletion = branchDeletionSuccess(branch, hash);
|
|
3632
|
-
result.all.push(deletion);
|
|
3633
|
-
result.branches[branch] = deletion;
|
|
3634
|
-
}),
|
|
3635
|
-
new LineParser(deleteErrorRegex, (result, [branch]) => {
|
|
3636
|
-
const deletion = branchDeletionFailure(branch);
|
|
3637
|
-
result.errors.push(deletion);
|
|
3638
|
-
result.all.push(deletion);
|
|
3639
|
-
result.branches[branch] = deletion;
|
|
3640
|
-
})
|
|
3641
|
-
];
|
|
3642
|
-
parseBranchDeletions = (stdOut, stdErr) => {
|
|
3643
|
-
return parseStringResponse(new BranchDeletionBatch, parsers8, [stdOut, stdErr]);
|
|
3644
|
-
};
|
|
3645
|
-
}
|
|
3646
|
-
});
|
|
3647
|
-
var BranchSummaryResult;
|
|
3648
|
-
var init_BranchSummary = __esm({
|
|
3649
|
-
"src/lib/responses/BranchSummary.ts"() {
|
|
3650
|
-
BranchSummaryResult = class {
|
|
3651
|
-
constructor() {
|
|
3652
|
-
this.all = [];
|
|
3653
|
-
this.branches = {};
|
|
3654
|
-
this.current = "";
|
|
3655
|
-
this.detached = false;
|
|
3656
|
-
}
|
|
3657
|
-
push(status, detached, name, commit, label) {
|
|
3658
|
-
if (status === "*") {
|
|
3659
|
-
this.detached = detached;
|
|
3660
|
-
this.current = name;
|
|
3661
|
-
}
|
|
3662
|
-
this.all.push(name);
|
|
3663
|
-
this.branches[name] = {
|
|
3664
|
-
current: status === "*",
|
|
3665
|
-
linkedWorkTree: status === "+",
|
|
3666
|
-
name,
|
|
3667
|
-
commit,
|
|
3668
|
-
label
|
|
3669
|
-
};
|
|
3670
|
-
}
|
|
3671
|
-
};
|
|
3672
|
-
}
|
|
3673
|
-
});
|
|
3674
|
-
function branchStatus(input) {
|
|
3675
|
-
return input ? input.charAt(0) : "";
|
|
3676
|
-
}
|
|
3677
|
-
function parseBranchSummary(stdOut, currentOnly = false) {
|
|
3678
|
-
return parseStringResponse(new BranchSummaryResult, currentOnly ? [currentBranchParser] : parsers9, stdOut);
|
|
3679
|
-
}
|
|
3680
|
-
var parsers9;
|
|
3681
|
-
var currentBranchParser;
|
|
3682
|
-
var init_parse_branch = __esm({
|
|
3683
|
-
"src/lib/parsers/parse-branch.ts"() {
|
|
3684
|
-
init_BranchSummary();
|
|
3685
|
-
init_utils();
|
|
3686
|
-
parsers9 = [
|
|
3687
|
-
new LineParser(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/, (result, [current, name, commit, label]) => {
|
|
3688
|
-
result.push(branchStatus(current), true, name, commit, label);
|
|
3689
|
-
}),
|
|
3690
|
-
new LineParser(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s, (result, [current, name, commit, label]) => {
|
|
3691
|
-
result.push(branchStatus(current), false, name, commit, label);
|
|
3692
|
-
})
|
|
3693
|
-
];
|
|
3694
|
-
currentBranchParser = new LineParser(/^(\S+)$/s, (result, [name]) => {
|
|
3695
|
-
result.push("*", false, name, "", "");
|
|
3696
|
-
});
|
|
3697
|
-
}
|
|
3698
|
-
});
|
|
3699
|
-
var branch_exports = {};
|
|
3700
|
-
__export(branch_exports, {
|
|
3701
|
-
branchLocalTask: () => branchLocalTask,
|
|
3702
|
-
branchTask: () => branchTask,
|
|
3703
|
-
containsDeleteBranchCommand: () => containsDeleteBranchCommand,
|
|
3704
|
-
deleteBranchTask: () => deleteBranchTask,
|
|
3705
|
-
deleteBranchesTask: () => deleteBranchesTask
|
|
3706
|
-
});
|
|
3707
|
-
function containsDeleteBranchCommand(commands) {
|
|
3708
|
-
const deleteCommands = ["-d", "-D", "--delete"];
|
|
3709
|
-
return commands.some((command) => deleteCommands.includes(command));
|
|
3710
|
-
}
|
|
3711
|
-
function branchTask(customArgs) {
|
|
3712
|
-
const isDelete = containsDeleteBranchCommand(customArgs);
|
|
3713
|
-
const isCurrentOnly = customArgs.includes("--show-current");
|
|
3714
|
-
const commands = ["branch", ...customArgs];
|
|
3715
|
-
if (commands.length === 1) {
|
|
3716
|
-
commands.push("-a");
|
|
3717
|
-
}
|
|
3718
|
-
if (!commands.includes("-v")) {
|
|
3719
|
-
commands.splice(1, 0, "-v");
|
|
3720
|
-
}
|
|
3721
|
-
return {
|
|
3722
|
-
format: "utf-8",
|
|
3723
|
-
commands,
|
|
3724
|
-
parser(stdOut, stdErr) {
|
|
3725
|
-
if (isDelete) {
|
|
3726
|
-
return parseBranchDeletions(stdOut, stdErr).all[0];
|
|
3727
|
-
}
|
|
3728
|
-
return parseBranchSummary(stdOut, isCurrentOnly);
|
|
3729
|
-
}
|
|
3730
|
-
};
|
|
3731
|
-
}
|
|
3732
|
-
function branchLocalTask() {
|
|
3733
|
-
return {
|
|
3734
|
-
format: "utf-8",
|
|
3735
|
-
commands: ["branch", "-v"],
|
|
3736
|
-
parser(stdOut) {
|
|
3737
|
-
return parseBranchSummary(stdOut);
|
|
3738
|
-
}
|
|
3739
|
-
};
|
|
3740
|
-
}
|
|
3741
|
-
function deleteBranchesTask(branches, forceDelete = false) {
|
|
3742
|
-
return {
|
|
3743
|
-
format: "utf-8",
|
|
3744
|
-
commands: ["branch", "-v", forceDelete ? "-D" : "-d", ...branches],
|
|
3745
|
-
parser(stdOut, stdErr) {
|
|
3746
|
-
return parseBranchDeletions(stdOut, stdErr);
|
|
3747
|
-
},
|
|
3748
|
-
onError({ exitCode, stdOut }, error, done, fail) {
|
|
3749
|
-
if (!hasBranchDeletionError(String(error), exitCode)) {
|
|
3750
|
-
return fail(error);
|
|
3751
|
-
}
|
|
3752
|
-
done(stdOut);
|
|
3753
|
-
}
|
|
3754
|
-
};
|
|
3755
|
-
}
|
|
3756
|
-
function deleteBranchTask(branch, forceDelete = false) {
|
|
3757
|
-
const task = {
|
|
3758
|
-
format: "utf-8",
|
|
3759
|
-
commands: ["branch", "-v", forceDelete ? "-D" : "-d", branch],
|
|
3760
|
-
parser(stdOut, stdErr) {
|
|
3761
|
-
return parseBranchDeletions(stdOut, stdErr).branches[branch];
|
|
3762
|
-
},
|
|
3763
|
-
onError({ exitCode, stdErr, stdOut }, error, _, fail) {
|
|
3764
|
-
if (!hasBranchDeletionError(String(error), exitCode)) {
|
|
3765
|
-
return fail(error);
|
|
3766
|
-
}
|
|
3767
|
-
throw new GitResponseError(task.parser(bufferToString(stdOut), bufferToString(stdErr)), String(error));
|
|
3768
|
-
}
|
|
3769
|
-
};
|
|
3770
|
-
return task;
|
|
3771
|
-
}
|
|
3772
|
-
var init_branch = __esm({
|
|
3773
|
-
"src/lib/tasks/branch.ts"() {
|
|
3774
|
-
init_git_response_error();
|
|
3775
|
-
init_parse_branch_delete();
|
|
3776
|
-
init_parse_branch();
|
|
3777
|
-
init_utils();
|
|
3778
|
-
}
|
|
3779
|
-
});
|
|
3780
|
-
function toPath(input) {
|
|
3781
|
-
const path = input.trim().replace(/^["']|["']$/g, "");
|
|
3782
|
-
return path && normalize(path);
|
|
3783
|
-
}
|
|
3784
|
-
var parseCheckIgnore;
|
|
3785
|
-
var init_CheckIgnore = __esm({
|
|
3786
|
-
"src/lib/responses/CheckIgnore.ts"() {
|
|
3787
|
-
parseCheckIgnore = (text) => {
|
|
3788
|
-
return text.split(/\n/g).map(toPath).filter(Boolean);
|
|
3789
|
-
};
|
|
3790
|
-
}
|
|
3791
|
-
});
|
|
3792
|
-
var check_ignore_exports = {};
|
|
3793
|
-
__export(check_ignore_exports, {
|
|
3794
|
-
checkIgnoreTask: () => checkIgnoreTask
|
|
3795
|
-
});
|
|
3796
|
-
function checkIgnoreTask(paths) {
|
|
3797
|
-
return {
|
|
3798
|
-
commands: ["check-ignore", ...paths],
|
|
3799
|
-
format: "utf-8",
|
|
3800
|
-
parser: parseCheckIgnore
|
|
3801
|
-
};
|
|
3802
|
-
}
|
|
3803
|
-
var init_check_ignore = __esm({
|
|
3804
|
-
"src/lib/tasks/check-ignore.ts"() {
|
|
3805
|
-
init_CheckIgnore();
|
|
3806
|
-
}
|
|
3807
|
-
});
|
|
3808
|
-
var clone_exports = {};
|
|
3809
|
-
__export(clone_exports, {
|
|
3810
|
-
cloneMirrorTask: () => cloneMirrorTask,
|
|
3811
|
-
cloneTask: () => cloneTask
|
|
3812
|
-
});
|
|
3813
|
-
function disallowedCommand(command) {
|
|
3814
|
-
return /^--upload-pack(=|$)/.test(command);
|
|
3815
|
-
}
|
|
3816
|
-
function cloneTask(repo, directory, customArgs) {
|
|
3817
|
-
const commands = ["clone", ...customArgs];
|
|
3818
|
-
filterString(repo) && commands.push(repo);
|
|
3819
|
-
filterString(directory) && commands.push(directory);
|
|
3820
|
-
const banned = commands.find(disallowedCommand);
|
|
3821
|
-
if (banned) {
|
|
3822
|
-
return configurationErrorTask(`git.fetch: potential exploit argument blocked.`);
|
|
3823
|
-
}
|
|
3824
|
-
return straightThroughStringTask(commands);
|
|
3825
|
-
}
|
|
3826
|
-
function cloneMirrorTask(repo, directory, customArgs) {
|
|
3827
|
-
append(customArgs, "--mirror");
|
|
3828
|
-
return cloneTask(repo, directory, customArgs);
|
|
3829
|
-
}
|
|
3830
|
-
var init_clone = __esm({
|
|
3831
|
-
"src/lib/tasks/clone.ts"() {
|
|
3832
|
-
init_task();
|
|
3833
|
-
init_utils();
|
|
3834
|
-
}
|
|
3835
|
-
});
|
|
3836
|
-
function parseFetchResult(stdOut, stdErr) {
|
|
3837
|
-
const result = {
|
|
3838
|
-
raw: stdOut,
|
|
3839
|
-
remote: null,
|
|
3840
|
-
branches: [],
|
|
3841
|
-
tags: [],
|
|
3842
|
-
updated: [],
|
|
3843
|
-
deleted: []
|
|
3844
|
-
};
|
|
3845
|
-
return parseStringResponse(result, parsers10, [stdOut, stdErr]);
|
|
3846
|
-
}
|
|
3847
|
-
var parsers10;
|
|
3848
|
-
var init_parse_fetch = __esm({
|
|
3849
|
-
"src/lib/parsers/parse-fetch.ts"() {
|
|
3850
|
-
init_utils();
|
|
3851
|
-
parsers10 = [
|
|
3852
|
-
new LineParser(/From (.+)$/, (result, [remote]) => {
|
|
3853
|
-
result.remote = remote;
|
|
3854
|
-
}),
|
|
3855
|
-
new LineParser(/\* \[new branch]\s+(\S+)\s*-> (.+)$/, (result, [name, tracking]) => {
|
|
3856
|
-
result.branches.push({
|
|
3857
|
-
name,
|
|
3858
|
-
tracking
|
|
3859
|
-
});
|
|
3860
|
-
}),
|
|
3861
|
-
new LineParser(/\* \[new tag]\s+(\S+)\s*-> (.+)$/, (result, [name, tracking]) => {
|
|
3862
|
-
result.tags.push({
|
|
3863
|
-
name,
|
|
3864
|
-
tracking
|
|
3865
|
-
});
|
|
3866
|
-
}),
|
|
3867
|
-
new LineParser(/- \[deleted]\s+\S+\s*-> (.+)$/, (result, [tracking]) => {
|
|
3868
|
-
result.deleted.push({
|
|
3869
|
-
tracking
|
|
3870
|
-
});
|
|
3871
|
-
}),
|
|
3872
|
-
new LineParser(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/, (result, [from, to, name, tracking]) => {
|
|
3873
|
-
result.updated.push({
|
|
3874
|
-
name,
|
|
3875
|
-
tracking,
|
|
3876
|
-
to,
|
|
3877
|
-
from
|
|
3878
|
-
});
|
|
3879
|
-
})
|
|
3880
|
-
];
|
|
3881
|
-
}
|
|
3882
|
-
});
|
|
3883
|
-
var fetch_exports = {};
|
|
3884
|
-
__export(fetch_exports, {
|
|
3885
|
-
fetchTask: () => fetchTask
|
|
3886
|
-
});
|
|
3887
|
-
function disallowedCommand2(command) {
|
|
3888
|
-
return /^--upload-pack(=|$)/.test(command);
|
|
3889
|
-
}
|
|
3890
|
-
function fetchTask(remote, branch, customArgs) {
|
|
3891
|
-
const commands = ["fetch", ...customArgs];
|
|
3892
|
-
if (remote && branch) {
|
|
3893
|
-
commands.push(remote, branch);
|
|
3894
|
-
}
|
|
3895
|
-
const banned = commands.find(disallowedCommand2);
|
|
3896
|
-
if (banned) {
|
|
3897
|
-
return configurationErrorTask(`git.fetch: potential exploit argument blocked.`);
|
|
3898
|
-
}
|
|
3899
|
-
return {
|
|
3900
|
-
commands,
|
|
3901
|
-
format: "utf-8",
|
|
3902
|
-
parser: parseFetchResult
|
|
3903
|
-
};
|
|
3904
|
-
}
|
|
3905
|
-
var init_fetch = __esm({
|
|
3906
|
-
"src/lib/tasks/fetch.ts"() {
|
|
3907
|
-
init_parse_fetch();
|
|
3908
|
-
init_task();
|
|
3909
|
-
}
|
|
3910
|
-
});
|
|
3911
|
-
function parseMoveResult(stdOut) {
|
|
3912
|
-
return parseStringResponse({ moves: [] }, parsers11, stdOut);
|
|
3913
|
-
}
|
|
3914
|
-
var parsers11;
|
|
3915
|
-
var init_parse_move = __esm({
|
|
3916
|
-
"src/lib/parsers/parse-move.ts"() {
|
|
3917
|
-
init_utils();
|
|
3918
|
-
parsers11 = [
|
|
3919
|
-
new LineParser(/^Renaming (.+) to (.+)$/, (result, [from, to]) => {
|
|
3920
|
-
result.moves.push({ from, to });
|
|
3921
|
-
})
|
|
3922
|
-
];
|
|
3923
|
-
}
|
|
3924
|
-
});
|
|
3925
|
-
var move_exports = {};
|
|
3926
|
-
__export(move_exports, {
|
|
3927
|
-
moveTask: () => moveTask
|
|
3928
|
-
});
|
|
3929
|
-
function moveTask(from, to) {
|
|
3930
|
-
return {
|
|
3931
|
-
commands: ["mv", "-v", ...asArray(from), to],
|
|
3932
|
-
format: "utf-8",
|
|
3933
|
-
parser: parseMoveResult
|
|
3934
|
-
};
|
|
3935
|
-
}
|
|
3936
|
-
var init_move = __esm({
|
|
3937
|
-
"src/lib/tasks/move.ts"() {
|
|
3938
|
-
init_parse_move();
|
|
3939
|
-
init_utils();
|
|
3940
|
-
}
|
|
3941
|
-
});
|
|
3942
|
-
var pull_exports = {};
|
|
3943
|
-
__export(pull_exports, {
|
|
3944
|
-
pullTask: () => pullTask
|
|
3945
|
-
});
|
|
3946
|
-
function pullTask(remote, branch, customArgs) {
|
|
3947
|
-
const commands = ["pull", ...customArgs];
|
|
3948
|
-
if (remote && branch) {
|
|
3949
|
-
commands.splice(1, 0, remote, branch);
|
|
3950
|
-
}
|
|
3951
|
-
return {
|
|
3952
|
-
commands,
|
|
3953
|
-
format: "utf-8",
|
|
3954
|
-
parser(stdOut, stdErr) {
|
|
3955
|
-
return parsePullResult(stdOut, stdErr);
|
|
3956
|
-
},
|
|
3957
|
-
onError(result, _error, _done, fail) {
|
|
3958
|
-
const pullError = parsePullErrorResult(bufferToString(result.stdOut), bufferToString(result.stdErr));
|
|
3959
|
-
if (pullError) {
|
|
3960
|
-
return fail(new GitResponseError(pullError));
|
|
3961
|
-
}
|
|
3962
|
-
fail(_error);
|
|
3963
|
-
}
|
|
3964
|
-
};
|
|
3965
|
-
}
|
|
3966
|
-
var init_pull = __esm({
|
|
3967
|
-
"src/lib/tasks/pull.ts"() {
|
|
3968
|
-
init_git_response_error();
|
|
3969
|
-
init_parse_pull();
|
|
3970
|
-
init_utils();
|
|
3971
|
-
}
|
|
3972
|
-
});
|
|
3973
|
-
function parseGetRemotes(text) {
|
|
3974
|
-
const remotes = {};
|
|
3975
|
-
forEach(text, ([name]) => remotes[name] = { name });
|
|
3976
|
-
return Object.values(remotes);
|
|
3977
|
-
}
|
|
3978
|
-
function parseGetRemotesVerbose(text) {
|
|
3979
|
-
const remotes = {};
|
|
3980
|
-
forEach(text, ([name, url, purpose]) => {
|
|
3981
|
-
if (!Object.hasOwn(remotes, name)) {
|
|
3982
|
-
remotes[name] = {
|
|
3983
|
-
name,
|
|
3984
|
-
refs: { fetch: "", push: "" }
|
|
3985
|
-
};
|
|
3986
|
-
}
|
|
3987
|
-
if (purpose && url) {
|
|
3988
|
-
remotes[name].refs[purpose.replace(/[^a-z]/g, "")] = url;
|
|
3989
|
-
}
|
|
3990
|
-
});
|
|
3991
|
-
return Object.values(remotes);
|
|
3992
|
-
}
|
|
3993
|
-
function forEach(text, handler) {
|
|
3994
|
-
forEachLineWithContent(text, (line) => handler(line.split(/\s+/)));
|
|
3995
|
-
}
|
|
3996
|
-
var init_GetRemoteSummary = __esm({
|
|
3997
|
-
"src/lib/responses/GetRemoteSummary.ts"() {
|
|
3998
|
-
init_utils();
|
|
3999
|
-
}
|
|
4000
|
-
});
|
|
4001
|
-
var remote_exports = {};
|
|
4002
|
-
__export(remote_exports, {
|
|
4003
|
-
addRemoteTask: () => addRemoteTask,
|
|
4004
|
-
getRemotesTask: () => getRemotesTask,
|
|
4005
|
-
listRemotesTask: () => listRemotesTask,
|
|
4006
|
-
remoteTask: () => remoteTask,
|
|
4007
|
-
removeRemoteTask: () => removeRemoteTask
|
|
4008
|
-
});
|
|
4009
|
-
function addRemoteTask(remoteName, remoteRepo, customArgs) {
|
|
4010
|
-
return straightThroughStringTask(["remote", "add", ...customArgs, remoteName, remoteRepo]);
|
|
4011
|
-
}
|
|
4012
|
-
function getRemotesTask(verbose) {
|
|
4013
|
-
const commands = ["remote"];
|
|
4014
|
-
if (verbose) {
|
|
4015
|
-
commands.push("-v");
|
|
4016
|
-
}
|
|
4017
|
-
return {
|
|
4018
|
-
commands,
|
|
4019
|
-
format: "utf-8",
|
|
4020
|
-
parser: verbose ? parseGetRemotesVerbose : parseGetRemotes
|
|
4021
|
-
};
|
|
4022
|
-
}
|
|
4023
|
-
function listRemotesTask(customArgs) {
|
|
4024
|
-
const commands = [...customArgs];
|
|
4025
|
-
if (commands[0] !== "ls-remote") {
|
|
4026
|
-
commands.unshift("ls-remote");
|
|
4027
|
-
}
|
|
4028
|
-
return straightThroughStringTask(commands);
|
|
4029
|
-
}
|
|
4030
|
-
function remoteTask(customArgs) {
|
|
4031
|
-
const commands = [...customArgs];
|
|
4032
|
-
if (commands[0] !== "remote") {
|
|
4033
|
-
commands.unshift("remote");
|
|
4034
|
-
}
|
|
4035
|
-
return straightThroughStringTask(commands);
|
|
4036
|
-
}
|
|
4037
|
-
function removeRemoteTask(remoteName) {
|
|
4038
|
-
return straightThroughStringTask(["remote", "remove", remoteName]);
|
|
4039
|
-
}
|
|
4040
|
-
var init_remote = __esm({
|
|
4041
|
-
"src/lib/tasks/remote.ts"() {
|
|
4042
|
-
init_GetRemoteSummary();
|
|
4043
|
-
init_task();
|
|
4044
|
-
}
|
|
4045
|
-
});
|
|
4046
|
-
var stash_list_exports = {};
|
|
4047
|
-
__export(stash_list_exports, {
|
|
4048
|
-
stashListTask: () => stashListTask
|
|
4049
|
-
});
|
|
4050
|
-
function stashListTask(opt = {}, customArgs) {
|
|
4051
|
-
const options = parseLogOptions(opt);
|
|
4052
|
-
const commands = ["stash", "list", ...options.commands, ...customArgs];
|
|
4053
|
-
const parser4 = createListLogSummaryParser(options.splitter, options.fields, logFormatFromCommand(commands));
|
|
4054
|
-
return validateLogFormatConfig(commands) || {
|
|
4055
|
-
commands,
|
|
4056
|
-
format: "utf-8",
|
|
4057
|
-
parser: parser4
|
|
4058
|
-
};
|
|
4059
|
-
}
|
|
4060
|
-
var init_stash_list = __esm({
|
|
4061
|
-
"src/lib/tasks/stash-list.ts"() {
|
|
4062
|
-
init_log_format();
|
|
4063
|
-
init_parse_list_log_summary();
|
|
4064
|
-
init_diff();
|
|
4065
|
-
init_log();
|
|
4066
|
-
}
|
|
4067
|
-
});
|
|
4068
|
-
var sub_module_exports = {};
|
|
4069
|
-
__export(sub_module_exports, {
|
|
4070
|
-
addSubModuleTask: () => addSubModuleTask,
|
|
4071
|
-
initSubModuleTask: () => initSubModuleTask,
|
|
4072
|
-
subModuleTask: () => subModuleTask,
|
|
4073
|
-
updateSubModuleTask: () => updateSubModuleTask
|
|
4074
|
-
});
|
|
4075
|
-
function addSubModuleTask(repo, path) {
|
|
4076
|
-
return subModuleTask(["add", repo, path]);
|
|
4077
|
-
}
|
|
4078
|
-
function initSubModuleTask(customArgs) {
|
|
4079
|
-
return subModuleTask(["init", ...customArgs]);
|
|
4080
|
-
}
|
|
4081
|
-
function subModuleTask(customArgs) {
|
|
4082
|
-
const commands = [...customArgs];
|
|
4083
|
-
if (commands[0] !== "submodule") {
|
|
4084
|
-
commands.unshift("submodule");
|
|
4085
|
-
}
|
|
4086
|
-
return straightThroughStringTask(commands);
|
|
4087
|
-
}
|
|
4088
|
-
function updateSubModuleTask(customArgs) {
|
|
4089
|
-
return subModuleTask(["update", ...customArgs]);
|
|
4090
|
-
}
|
|
4091
|
-
var init_sub_module = __esm({
|
|
4092
|
-
"src/lib/tasks/sub-module.ts"() {
|
|
4093
|
-
init_task();
|
|
4094
|
-
}
|
|
4095
|
-
});
|
|
4096
|
-
function singleSorted(a, b) {
|
|
4097
|
-
const aIsNum = Number.isNaN(a);
|
|
4098
|
-
const bIsNum = Number.isNaN(b);
|
|
4099
|
-
if (aIsNum !== bIsNum) {
|
|
4100
|
-
return aIsNum ? 1 : -1;
|
|
4101
|
-
}
|
|
4102
|
-
return aIsNum ? sorted(a, b) : 0;
|
|
4103
|
-
}
|
|
4104
|
-
function sorted(a, b) {
|
|
4105
|
-
return a === b ? 0 : a > b ? 1 : -1;
|
|
4106
|
-
}
|
|
4107
|
-
function trimmed(input) {
|
|
4108
|
-
return input.trim();
|
|
4109
|
-
}
|
|
4110
|
-
function toNumber(input) {
|
|
4111
|
-
if (typeof input === "string") {
|
|
4112
|
-
return parseInt(input.replace(/^\D+/g, ""), 10) || 0;
|
|
4113
|
-
}
|
|
4114
|
-
return 0;
|
|
4115
|
-
}
|
|
4116
|
-
var TagList;
|
|
4117
|
-
var parseTagList;
|
|
4118
|
-
var init_TagList = __esm({
|
|
4119
|
-
"src/lib/responses/TagList.ts"() {
|
|
4120
|
-
TagList = class {
|
|
4121
|
-
constructor(all, latest) {
|
|
4122
|
-
this.all = all;
|
|
4123
|
-
this.latest = latest;
|
|
4124
|
-
}
|
|
4125
|
-
};
|
|
4126
|
-
parseTagList = function(data, customSort = false) {
|
|
4127
|
-
const tags = data.split(`
|
|
4128
|
-
`).map(trimmed).filter(Boolean);
|
|
4129
|
-
if (!customSort) {
|
|
4130
|
-
tags.sort(function(tagA, tagB) {
|
|
4131
|
-
const partsA = tagA.split(".");
|
|
4132
|
-
const partsB = tagB.split(".");
|
|
4133
|
-
if (partsA.length === 1 || partsB.length === 1) {
|
|
4134
|
-
return singleSorted(toNumber(partsA[0]), toNumber(partsB[0]));
|
|
4135
|
-
}
|
|
4136
|
-
for (let i = 0, l = Math.max(partsA.length, partsB.length);i < l; i++) {
|
|
4137
|
-
const diff = sorted(toNumber(partsA[i]), toNumber(partsB[i]));
|
|
4138
|
-
if (diff) {
|
|
4139
|
-
return diff;
|
|
4140
|
-
}
|
|
4141
|
-
}
|
|
4142
|
-
return 0;
|
|
4143
|
-
});
|
|
4144
|
-
}
|
|
4145
|
-
const latest = customSort ? tags[0] : [...tags].reverse().find((tag) => tag.indexOf(".") >= 0);
|
|
4146
|
-
return new TagList(tags, latest);
|
|
4147
|
-
};
|
|
4148
|
-
}
|
|
4149
|
-
});
|
|
4150
|
-
var tag_exports = {};
|
|
4151
|
-
__export(tag_exports, {
|
|
4152
|
-
addAnnotatedTagTask: () => addAnnotatedTagTask,
|
|
4153
|
-
addTagTask: () => addTagTask,
|
|
4154
|
-
tagListTask: () => tagListTask
|
|
4155
|
-
});
|
|
4156
|
-
function tagListTask(customArgs = []) {
|
|
4157
|
-
const hasCustomSort = customArgs.some((option) => /^--sort=/.test(option));
|
|
4158
|
-
return {
|
|
4159
|
-
format: "utf-8",
|
|
4160
|
-
commands: ["tag", "-l", ...customArgs],
|
|
4161
|
-
parser(text) {
|
|
4162
|
-
return parseTagList(text, hasCustomSort);
|
|
4163
|
-
}
|
|
4164
|
-
};
|
|
4165
|
-
}
|
|
4166
|
-
function addTagTask(name) {
|
|
4167
|
-
return {
|
|
4168
|
-
format: "utf-8",
|
|
4169
|
-
commands: ["tag", name],
|
|
4170
|
-
parser() {
|
|
4171
|
-
return { name };
|
|
4172
|
-
}
|
|
4173
|
-
};
|
|
4174
|
-
}
|
|
4175
|
-
function addAnnotatedTagTask(name, tagMessage) {
|
|
4176
|
-
return {
|
|
4177
|
-
format: "utf-8",
|
|
4178
|
-
commands: ["tag", "-a", "-m", tagMessage, name],
|
|
4179
|
-
parser() {
|
|
4180
|
-
return { name };
|
|
4181
|
-
}
|
|
4182
|
-
};
|
|
4183
|
-
}
|
|
4184
|
-
var init_tag = __esm({
|
|
4185
|
-
"src/lib/tasks/tag.ts"() {
|
|
4186
|
-
init_TagList();
|
|
4187
|
-
}
|
|
4188
|
-
});
|
|
4189
|
-
var require_git = __commonJS2({
|
|
4190
|
-
"src/git.js"(exports, module) {
|
|
4191
|
-
var { GitExecutor: GitExecutor2 } = (init_git_executor(), __toCommonJS(git_executor_exports));
|
|
4192
|
-
var { SimpleGitApi: SimpleGitApi2 } = (init_simple_git_api(), __toCommonJS(simple_git_api_exports));
|
|
4193
|
-
var { Scheduler: Scheduler2 } = (init_scheduler(), __toCommonJS(scheduler_exports));
|
|
4194
|
-
var { configurationErrorTask: configurationErrorTask2 } = (init_task(), __toCommonJS(task_exports));
|
|
4195
|
-
var {
|
|
4196
|
-
asArray: asArray2,
|
|
4197
|
-
filterArray: filterArray2,
|
|
4198
|
-
filterPrimitives: filterPrimitives2,
|
|
4199
|
-
filterString: filterString2,
|
|
4200
|
-
filterStringOrStringArray: filterStringOrStringArray2,
|
|
4201
|
-
filterType: filterType2,
|
|
4202
|
-
getTrailingOptions: getTrailingOptions2,
|
|
4203
|
-
trailingFunctionArgument: trailingFunctionArgument2,
|
|
4204
|
-
trailingOptionsArgument: trailingOptionsArgument2
|
|
4205
|
-
} = (init_utils(), __toCommonJS(utils_exports));
|
|
4206
|
-
var { applyPatchTask: applyPatchTask2 } = (init_apply_patch(), __toCommonJS(apply_patch_exports));
|
|
4207
|
-
var {
|
|
4208
|
-
branchTask: branchTask2,
|
|
4209
|
-
branchLocalTask: branchLocalTask2,
|
|
4210
|
-
deleteBranchesTask: deleteBranchesTask2,
|
|
4211
|
-
deleteBranchTask: deleteBranchTask2
|
|
4212
|
-
} = (init_branch(), __toCommonJS(branch_exports));
|
|
4213
|
-
var { checkIgnoreTask: checkIgnoreTask2 } = (init_check_ignore(), __toCommonJS(check_ignore_exports));
|
|
4214
|
-
var { checkIsRepoTask: checkIsRepoTask2 } = (init_check_is_repo(), __toCommonJS(check_is_repo_exports));
|
|
4215
|
-
var { cloneTask: cloneTask2, cloneMirrorTask: cloneMirrorTask2 } = (init_clone(), __toCommonJS(clone_exports));
|
|
4216
|
-
var { cleanWithOptionsTask: cleanWithOptionsTask2, isCleanOptionsArray: isCleanOptionsArray2 } = (init_clean(), __toCommonJS(clean_exports));
|
|
4217
|
-
var { diffSummaryTask: diffSummaryTask2 } = (init_diff(), __toCommonJS(diff_exports));
|
|
4218
|
-
var { fetchTask: fetchTask2 } = (init_fetch(), __toCommonJS(fetch_exports));
|
|
4219
|
-
var { moveTask: moveTask2 } = (init_move(), __toCommonJS(move_exports));
|
|
4220
|
-
var { pullTask: pullTask2 } = (init_pull(), __toCommonJS(pull_exports));
|
|
4221
|
-
var { pushTagsTask: pushTagsTask2 } = (init_push(), __toCommonJS(push_exports));
|
|
4222
|
-
var {
|
|
4223
|
-
addRemoteTask: addRemoteTask2,
|
|
4224
|
-
getRemotesTask: getRemotesTask2,
|
|
4225
|
-
listRemotesTask: listRemotesTask2,
|
|
4226
|
-
remoteTask: remoteTask2,
|
|
4227
|
-
removeRemoteTask: removeRemoteTask2
|
|
4228
|
-
} = (init_remote(), __toCommonJS(remote_exports));
|
|
4229
|
-
var { getResetMode: getResetMode2, resetTask: resetTask2 } = (init_reset(), __toCommonJS(reset_exports));
|
|
4230
|
-
var { stashListTask: stashListTask2 } = (init_stash_list(), __toCommonJS(stash_list_exports));
|
|
4231
|
-
var {
|
|
4232
|
-
addSubModuleTask: addSubModuleTask2,
|
|
4233
|
-
initSubModuleTask: initSubModuleTask2,
|
|
4234
|
-
subModuleTask: subModuleTask2,
|
|
4235
|
-
updateSubModuleTask: updateSubModuleTask2
|
|
4236
|
-
} = (init_sub_module(), __toCommonJS(sub_module_exports));
|
|
4237
|
-
var { addAnnotatedTagTask: addAnnotatedTagTask2, addTagTask: addTagTask2, tagListTask: tagListTask2 } = (init_tag(), __toCommonJS(tag_exports));
|
|
4238
|
-
var { straightThroughBufferTask: straightThroughBufferTask2, straightThroughStringTask: straightThroughStringTask2 } = (init_task(), __toCommonJS(task_exports));
|
|
4239
|
-
function Git2(options, plugins) {
|
|
4240
|
-
this._plugins = plugins;
|
|
4241
|
-
this._executor = new GitExecutor2(options.baseDir, new Scheduler2(options.maxConcurrentProcesses), plugins);
|
|
4242
|
-
this._trimmed = options.trimmed;
|
|
4243
|
-
}
|
|
4244
|
-
(Git2.prototype = Object.create(SimpleGitApi2.prototype)).constructor = Git2;
|
|
4245
|
-
Git2.prototype.customBinary = function(command) {
|
|
4246
|
-
this._plugins.reconfigure("binary", command);
|
|
4247
|
-
return this;
|
|
4248
|
-
};
|
|
4249
|
-
Git2.prototype.env = function(name, value) {
|
|
4250
|
-
if (arguments.length === 1 && typeof name === "object") {
|
|
4251
|
-
this._executor.env = name;
|
|
4252
|
-
} else {
|
|
4253
|
-
(this._executor.env = this._executor.env || {})[name] = value;
|
|
4254
|
-
}
|
|
4255
|
-
return this;
|
|
4256
|
-
};
|
|
4257
|
-
Git2.prototype.stashList = function(options) {
|
|
4258
|
-
return this._runTask(stashListTask2(trailingOptionsArgument2(arguments) || {}, filterArray2(options) && options || []), trailingFunctionArgument2(arguments));
|
|
4259
|
-
};
|
|
4260
|
-
function createCloneTask(api, task, repoPath, localPath) {
|
|
4261
|
-
if (typeof repoPath !== "string") {
|
|
4262
|
-
return configurationErrorTask2(`git.${api}() requires a string 'repoPath'`);
|
|
4263
|
-
}
|
|
4264
|
-
return task(repoPath, filterType2(localPath, filterString2), getTrailingOptions2(arguments));
|
|
4265
|
-
}
|
|
4266
|
-
Git2.prototype.clone = function() {
|
|
4267
|
-
return this._runTask(createCloneTask("clone", cloneTask2, ...arguments), trailingFunctionArgument2(arguments));
|
|
4268
|
-
};
|
|
4269
|
-
Git2.prototype.mirror = function() {
|
|
4270
|
-
return this._runTask(createCloneTask("mirror", cloneMirrorTask2, ...arguments), trailingFunctionArgument2(arguments));
|
|
4271
|
-
};
|
|
4272
|
-
Git2.prototype.mv = function(from, to) {
|
|
4273
|
-
return this._runTask(moveTask2(from, to), trailingFunctionArgument2(arguments));
|
|
4274
|
-
};
|
|
4275
|
-
Git2.prototype.checkoutLatestTag = function(then) {
|
|
4276
|
-
var git = this;
|
|
4277
|
-
return this.pull(function() {
|
|
4278
|
-
git.tags(function(err, tags) {
|
|
4279
|
-
git.checkout(tags.latest, then);
|
|
4280
|
-
});
|
|
4281
|
-
});
|
|
4282
|
-
};
|
|
4283
|
-
Git2.prototype.pull = function(remote, branch, options, then) {
|
|
4284
|
-
return this._runTask(pullTask2(filterType2(remote, filterString2), filterType2(branch, filterString2), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
|
|
4285
|
-
};
|
|
4286
|
-
Git2.prototype.fetch = function(remote, branch) {
|
|
4287
|
-
return this._runTask(fetchTask2(filterType2(remote, filterString2), filterType2(branch, filterString2), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
|
|
4288
|
-
};
|
|
4289
|
-
Git2.prototype.silent = function(silence) {
|
|
4290
|
-
console.warn("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");
|
|
4291
|
-
return this;
|
|
4292
|
-
};
|
|
4293
|
-
Git2.prototype.tags = function(options, then) {
|
|
4294
|
-
return this._runTask(tagListTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
|
|
4295
|
-
};
|
|
4296
|
-
Git2.prototype.rebase = function() {
|
|
4297
|
-
return this._runTask(straightThroughStringTask2(["rebase", ...getTrailingOptions2(arguments)]), trailingFunctionArgument2(arguments));
|
|
4298
|
-
};
|
|
4299
|
-
Git2.prototype.reset = function(mode) {
|
|
4300
|
-
return this._runTask(resetTask2(getResetMode2(mode), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
|
|
4301
|
-
};
|
|
4302
|
-
Git2.prototype.revert = function(commit) {
|
|
4303
|
-
const next = trailingFunctionArgument2(arguments);
|
|
4304
|
-
if (typeof commit !== "string") {
|
|
4305
|
-
return this._runTask(configurationErrorTask2("Commit must be a string"), next);
|
|
4306
|
-
}
|
|
4307
|
-
return this._runTask(straightThroughStringTask2(["revert", ...getTrailingOptions2(arguments, 0, true), commit]), next);
|
|
4308
|
-
};
|
|
4309
|
-
Git2.prototype.addTag = function(name) {
|
|
4310
|
-
const task = typeof name === "string" ? addTagTask2(name) : configurationErrorTask2("Git.addTag requires a tag name");
|
|
4311
|
-
return this._runTask(task, trailingFunctionArgument2(arguments));
|
|
4312
|
-
};
|
|
4313
|
-
Git2.prototype.addAnnotatedTag = function(tagName, tagMessage) {
|
|
4314
|
-
return this._runTask(addAnnotatedTagTask2(tagName, tagMessage), trailingFunctionArgument2(arguments));
|
|
4315
|
-
};
|
|
4316
|
-
Git2.prototype.deleteLocalBranch = function(branchName, forceDelete, then) {
|
|
4317
|
-
return this._runTask(deleteBranchTask2(branchName, typeof forceDelete === "boolean" ? forceDelete : false), trailingFunctionArgument2(arguments));
|
|
4318
|
-
};
|
|
4319
|
-
Git2.prototype.deleteLocalBranches = function(branchNames, forceDelete, then) {
|
|
4320
|
-
return this._runTask(deleteBranchesTask2(branchNames, typeof forceDelete === "boolean" ? forceDelete : false), trailingFunctionArgument2(arguments));
|
|
4321
|
-
};
|
|
4322
|
-
Git2.prototype.branch = function(options, then) {
|
|
4323
|
-
return this._runTask(branchTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
|
|
4324
|
-
};
|
|
4325
|
-
Git2.prototype.branchLocal = function(then) {
|
|
4326
|
-
return this._runTask(branchLocalTask2(), trailingFunctionArgument2(arguments));
|
|
4327
|
-
};
|
|
4328
|
-
Git2.prototype.raw = function(commands) {
|
|
4329
|
-
const createRestCommands = !Array.isArray(commands);
|
|
4330
|
-
const command = [].slice.call(createRestCommands ? arguments : commands, 0);
|
|
4331
|
-
for (let i = 0;i < command.length && createRestCommands; i++) {
|
|
4332
|
-
if (!filterPrimitives2(command[i])) {
|
|
4333
|
-
command.splice(i, command.length - i);
|
|
4334
|
-
break;
|
|
4335
|
-
}
|
|
4336
|
-
}
|
|
4337
|
-
command.push(...getTrailingOptions2(arguments, 0, true));
|
|
4338
|
-
var next = trailingFunctionArgument2(arguments);
|
|
4339
|
-
if (!command.length) {
|
|
4340
|
-
return this._runTask(configurationErrorTask2("Raw: must supply one or more command to execute"), next);
|
|
4341
|
-
}
|
|
4342
|
-
return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
|
|
4343
|
-
};
|
|
4344
|
-
Git2.prototype.submoduleAdd = function(repo, path, then) {
|
|
4345
|
-
return this._runTask(addSubModuleTask2(repo, path), trailingFunctionArgument2(arguments));
|
|
4346
|
-
};
|
|
4347
|
-
Git2.prototype.submoduleUpdate = function(args, then) {
|
|
4348
|
-
return this._runTask(updateSubModuleTask2(getTrailingOptions2(arguments, true)), trailingFunctionArgument2(arguments));
|
|
4349
|
-
};
|
|
4350
|
-
Git2.prototype.submoduleInit = function(args, then) {
|
|
4351
|
-
return this._runTask(initSubModuleTask2(getTrailingOptions2(arguments, true)), trailingFunctionArgument2(arguments));
|
|
4352
|
-
};
|
|
4353
|
-
Git2.prototype.subModule = function(options, then) {
|
|
4354
|
-
return this._runTask(subModuleTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
|
|
4355
|
-
};
|
|
4356
|
-
Git2.prototype.listRemote = function() {
|
|
4357
|
-
return this._runTask(listRemotesTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
|
|
4358
|
-
};
|
|
4359
|
-
Git2.prototype.addRemote = function(remoteName, remoteRepo, then) {
|
|
4360
|
-
return this._runTask(addRemoteTask2(remoteName, remoteRepo, getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
|
|
4361
|
-
};
|
|
4362
|
-
Git2.prototype.removeRemote = function(remoteName, then) {
|
|
4363
|
-
return this._runTask(removeRemoteTask2(remoteName), trailingFunctionArgument2(arguments));
|
|
4364
|
-
};
|
|
4365
|
-
Git2.prototype.getRemotes = function(verbose, then) {
|
|
4366
|
-
return this._runTask(getRemotesTask2(verbose === true), trailingFunctionArgument2(arguments));
|
|
4367
|
-
};
|
|
4368
|
-
Git2.prototype.remote = function(options, then) {
|
|
4369
|
-
return this._runTask(remoteTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
|
|
4370
|
-
};
|
|
4371
|
-
Git2.prototype.tag = function(options, then) {
|
|
4372
|
-
const command = getTrailingOptions2(arguments);
|
|
4373
|
-
if (command[0] !== "tag") {
|
|
4374
|
-
command.unshift("tag");
|
|
4375
|
-
}
|
|
4376
|
-
return this._runTask(straightThroughStringTask2(command), trailingFunctionArgument2(arguments));
|
|
4377
|
-
};
|
|
4378
|
-
Git2.prototype.updateServerInfo = function(then) {
|
|
4379
|
-
return this._runTask(straightThroughStringTask2(["update-server-info"]), trailingFunctionArgument2(arguments));
|
|
4380
|
-
};
|
|
4381
|
-
Git2.prototype.pushTags = function(remote, then) {
|
|
4382
|
-
const task = pushTagsTask2({ remote: filterType2(remote, filterString2) }, getTrailingOptions2(arguments));
|
|
4383
|
-
return this._runTask(task, trailingFunctionArgument2(arguments));
|
|
4384
|
-
};
|
|
4385
|
-
Git2.prototype.rm = function(files) {
|
|
4386
|
-
return this._runTask(straightThroughStringTask2(["rm", "-f", ...asArray2(files)]), trailingFunctionArgument2(arguments));
|
|
4387
|
-
};
|
|
4388
|
-
Git2.prototype.rmKeepLocal = function(files) {
|
|
4389
|
-
return this._runTask(straightThroughStringTask2(["rm", "--cached", ...asArray2(files)]), trailingFunctionArgument2(arguments));
|
|
4390
|
-
};
|
|
4391
|
-
Git2.prototype.catFile = function(options, then) {
|
|
4392
|
-
return this._catFile("utf-8", arguments);
|
|
4393
|
-
};
|
|
4394
|
-
Git2.prototype.binaryCatFile = function() {
|
|
4395
|
-
return this._catFile("buffer", arguments);
|
|
4396
|
-
};
|
|
4397
|
-
Git2.prototype._catFile = function(format, args) {
|
|
4398
|
-
var handler = trailingFunctionArgument2(args);
|
|
4399
|
-
var command = ["cat-file"];
|
|
4400
|
-
var options = args[0];
|
|
4401
|
-
if (typeof options === "string") {
|
|
4402
|
-
return this._runTask(configurationErrorTask2("Git.catFile: options must be supplied as an array of strings"), handler);
|
|
4403
|
-
}
|
|
4404
|
-
if (Array.isArray(options)) {
|
|
4405
|
-
command.push.apply(command, options);
|
|
4406
|
-
}
|
|
4407
|
-
const task = format === "buffer" ? straightThroughBufferTask2(command) : straightThroughStringTask2(command);
|
|
4408
|
-
return this._runTask(task, handler);
|
|
4409
|
-
};
|
|
4410
|
-
Git2.prototype.diff = function(options, then) {
|
|
4411
|
-
const task = filterString2(options) ? configurationErrorTask2("git.diff: supplying options as a single string is no longer supported, switch to an array of strings") : straightThroughStringTask2(["diff", ...getTrailingOptions2(arguments)]);
|
|
4412
|
-
return this._runTask(task, trailingFunctionArgument2(arguments));
|
|
4413
|
-
};
|
|
4414
|
-
Git2.prototype.diffSummary = function() {
|
|
4415
|
-
return this._runTask(diffSummaryTask2(getTrailingOptions2(arguments, 1)), trailingFunctionArgument2(arguments));
|
|
4416
|
-
};
|
|
4417
|
-
Git2.prototype.applyPatch = function(patches) {
|
|
4418
|
-
const task = !filterStringOrStringArray2(patches) ? configurationErrorTask2(`git.applyPatch requires one or more string patches as the first argument`) : applyPatchTask2(asArray2(patches), getTrailingOptions2([].slice.call(arguments, 1)));
|
|
4419
|
-
return this._runTask(task, trailingFunctionArgument2(arguments));
|
|
4420
|
-
};
|
|
4421
|
-
Git2.prototype.revparse = function() {
|
|
4422
|
-
const commands = ["rev-parse", ...getTrailingOptions2(arguments, true)];
|
|
4423
|
-
return this._runTask(straightThroughStringTask2(commands, true), trailingFunctionArgument2(arguments));
|
|
4424
|
-
};
|
|
4425
|
-
Git2.prototype.clean = function(mode, options, then) {
|
|
4426
|
-
const usingCleanOptionsArray = isCleanOptionsArray2(mode);
|
|
4427
|
-
const cleanMode = usingCleanOptionsArray && mode.join("") || filterType2(mode, filterString2) || "";
|
|
4428
|
-
const customArgs = getTrailingOptions2([].slice.call(arguments, usingCleanOptionsArray ? 1 : 0));
|
|
4429
|
-
return this._runTask(cleanWithOptionsTask2(cleanMode, customArgs), trailingFunctionArgument2(arguments));
|
|
4430
|
-
};
|
|
4431
|
-
Git2.prototype.exec = function(then) {
|
|
4432
|
-
const task = {
|
|
4433
|
-
commands: [],
|
|
4434
|
-
format: "utf-8",
|
|
4435
|
-
parser() {
|
|
4436
|
-
if (typeof then === "function") {
|
|
4437
|
-
then();
|
|
4438
|
-
}
|
|
4439
|
-
}
|
|
4440
|
-
};
|
|
4441
|
-
return this._runTask(task);
|
|
4442
|
-
};
|
|
4443
|
-
Git2.prototype.clearQueue = function() {
|
|
4444
|
-
return this;
|
|
4445
|
-
};
|
|
4446
|
-
Git2.prototype.checkIgnore = function(pathnames, then) {
|
|
4447
|
-
return this._runTask(checkIgnoreTask2(asArray2(filterType2(pathnames, filterStringOrStringArray2, []))), trailingFunctionArgument2(arguments));
|
|
4448
|
-
};
|
|
4449
|
-
Git2.prototype.checkIsRepo = function(checkType, then) {
|
|
4450
|
-
return this._runTask(checkIsRepoTask2(filterType2(checkType, filterString2)), trailingFunctionArgument2(arguments));
|
|
4451
|
-
};
|
|
4452
|
-
module.exports = Git2;
|
|
4453
|
-
}
|
|
4454
|
-
});
|
|
4455
|
-
init_pathspec();
|
|
4456
|
-
init_git_error();
|
|
4457
|
-
var GitConstructError = class extends GitError {
|
|
4458
|
-
constructor(config, message) {
|
|
4459
|
-
super(undefined, message);
|
|
4460
|
-
this.config = config;
|
|
4461
|
-
}
|
|
4462
|
-
};
|
|
4463
|
-
init_git_error();
|
|
4464
|
-
init_git_error();
|
|
4465
|
-
var GitPluginError = class extends GitError {
|
|
4466
|
-
constructor(task, plugin, message) {
|
|
4467
|
-
super(task, message);
|
|
4468
|
-
this.task = task;
|
|
4469
|
-
this.plugin = plugin;
|
|
4470
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
4471
|
-
}
|
|
4472
|
-
};
|
|
4473
|
-
init_git_response_error();
|
|
4474
|
-
init_task_configuration_error();
|
|
4475
|
-
init_check_is_repo();
|
|
4476
|
-
init_clean();
|
|
4477
|
-
init_config();
|
|
4478
|
-
init_diff_name_status();
|
|
4479
|
-
init_grep();
|
|
4480
|
-
init_reset();
|
|
4481
|
-
function abortPlugin(signal) {
|
|
4482
|
-
if (!signal) {
|
|
4483
|
-
return;
|
|
4484
|
-
}
|
|
4485
|
-
const onSpawnAfter = {
|
|
4486
|
-
type: "spawn.after",
|
|
4487
|
-
action(_data, context) {
|
|
4488
|
-
function kill() {
|
|
4489
|
-
context.kill(new GitPluginError(undefined, "abort", "Abort signal received"));
|
|
4490
|
-
}
|
|
4491
|
-
signal.addEventListener("abort", kill);
|
|
4492
|
-
context.spawned.on("close", () => signal.removeEventListener("abort", kill));
|
|
4493
|
-
}
|
|
4494
|
-
};
|
|
4495
|
-
const onSpawnBefore = {
|
|
4496
|
-
type: "spawn.before",
|
|
4497
|
-
action(_data, context) {
|
|
4498
|
-
if (signal.aborted) {
|
|
4499
|
-
context.kill(new GitPluginError(undefined, "abort", "Abort already signaled"));
|
|
4500
|
-
}
|
|
4501
|
-
}
|
|
4502
|
-
};
|
|
4503
|
-
return [onSpawnBefore, onSpawnAfter];
|
|
4504
|
-
}
|
|
4505
|
-
function isConfigSwitch(arg) {
|
|
4506
|
-
return typeof arg === "string" && arg.trim().toLowerCase() === "-c";
|
|
4507
|
-
}
|
|
4508
|
-
function preventProtocolOverride(arg, next) {
|
|
4509
|
-
if (!isConfigSwitch(arg)) {
|
|
4510
|
-
return;
|
|
4511
|
-
}
|
|
4512
|
-
if (!/^\s*protocol(.[a-z]+)?.allow/.test(next)) {
|
|
4513
|
-
return;
|
|
4514
|
-
}
|
|
4515
|
-
throw new GitPluginError(undefined, "unsafe", "Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol");
|
|
4516
|
-
}
|
|
4517
|
-
function preventUploadPack(arg, method) {
|
|
4518
|
-
if (/^\s*--(upload|receive)-pack/.test(arg)) {
|
|
4519
|
-
throw new GitPluginError(undefined, "unsafe", `Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack`);
|
|
4520
|
-
}
|
|
4521
|
-
if (method === "clone" && /^\s*-u\b/.test(arg)) {
|
|
4522
|
-
throw new GitPluginError(undefined, "unsafe", `Use of clone with option -u is not permitted without enabling allowUnsafePack`);
|
|
4523
|
-
}
|
|
4524
|
-
if (method === "push" && /^\s*--exec\b/.test(arg)) {
|
|
4525
|
-
throw new GitPluginError(undefined, "unsafe", `Use of push with option --exec is not permitted without enabling allowUnsafePack`);
|
|
4526
|
-
}
|
|
4527
|
-
}
|
|
4528
|
-
function blockUnsafeOperationsPlugin({
|
|
4529
|
-
allowUnsafeProtocolOverride = false,
|
|
4530
|
-
allowUnsafePack = false
|
|
4531
|
-
} = {}) {
|
|
4532
|
-
return {
|
|
4533
|
-
type: "spawn.args",
|
|
4534
|
-
action(args, context) {
|
|
4535
|
-
args.forEach((current, index) => {
|
|
4536
|
-
const next = index < args.length ? args[index + 1] : "";
|
|
4537
|
-
allowUnsafeProtocolOverride || preventProtocolOverride(current, next);
|
|
4538
|
-
allowUnsafePack || preventUploadPack(current, context.method);
|
|
4539
|
-
});
|
|
4540
|
-
return args;
|
|
4541
|
-
}
|
|
4542
|
-
};
|
|
4543
|
-
}
|
|
4544
|
-
init_utils();
|
|
4545
|
-
function commandConfigPrefixingPlugin(configuration) {
|
|
4546
|
-
const prefix = prefixedArray(configuration, "-c");
|
|
4547
|
-
return {
|
|
4548
|
-
type: "spawn.args",
|
|
4549
|
-
action(data) {
|
|
4550
|
-
return [...prefix, ...data];
|
|
4551
|
-
}
|
|
4552
|
-
};
|
|
4553
|
-
}
|
|
4554
|
-
init_utils();
|
|
4555
|
-
var never = import_promise_deferred2.deferred().promise;
|
|
4556
|
-
function completionDetectionPlugin({
|
|
4557
|
-
onClose = true,
|
|
4558
|
-
onExit = 50
|
|
4559
|
-
} = {}) {
|
|
4560
|
-
function createEvents() {
|
|
4561
|
-
let exitCode = -1;
|
|
4562
|
-
const events = {
|
|
4563
|
-
close: import_promise_deferred2.deferred(),
|
|
4564
|
-
closeTimeout: import_promise_deferred2.deferred(),
|
|
4565
|
-
exit: import_promise_deferred2.deferred(),
|
|
4566
|
-
exitTimeout: import_promise_deferred2.deferred()
|
|
4567
|
-
};
|
|
4568
|
-
const result = Promise.race([
|
|
4569
|
-
onClose === false ? never : events.closeTimeout.promise,
|
|
4570
|
-
onExit === false ? never : events.exitTimeout.promise
|
|
4571
|
-
]);
|
|
4572
|
-
configureTimeout(onClose, events.close, events.closeTimeout);
|
|
4573
|
-
configureTimeout(onExit, events.exit, events.exitTimeout);
|
|
4574
|
-
return {
|
|
4575
|
-
close(code) {
|
|
4576
|
-
exitCode = code;
|
|
4577
|
-
events.close.done();
|
|
4578
|
-
},
|
|
4579
|
-
exit(code) {
|
|
4580
|
-
exitCode = code;
|
|
4581
|
-
events.exit.done();
|
|
4582
|
-
},
|
|
4583
|
-
get exitCode() {
|
|
4584
|
-
return exitCode;
|
|
4585
|
-
},
|
|
4586
|
-
result
|
|
4587
|
-
};
|
|
4588
|
-
}
|
|
4589
|
-
function configureTimeout(flag, event, timeout) {
|
|
4590
|
-
if (flag === false) {
|
|
4591
|
-
return;
|
|
4592
|
-
}
|
|
4593
|
-
(flag === true ? event.promise : event.promise.then(() => delay(flag))).then(timeout.done);
|
|
4594
|
-
}
|
|
4595
|
-
return {
|
|
4596
|
-
type: "spawn.after",
|
|
4597
|
-
async action(_data, { spawned, close }) {
|
|
4598
|
-
const events = createEvents();
|
|
4599
|
-
let deferClose = true;
|
|
4600
|
-
let quickClose = () => void (deferClose = false);
|
|
4601
|
-
spawned.stdout?.on("data", quickClose);
|
|
4602
|
-
spawned.stderr?.on("data", quickClose);
|
|
4603
|
-
spawned.on("error", quickClose);
|
|
4604
|
-
spawned.on("close", (code) => events.close(code));
|
|
4605
|
-
spawned.on("exit", (code) => events.exit(code));
|
|
4606
|
-
try {
|
|
4607
|
-
await events.result;
|
|
4608
|
-
if (deferClose) {
|
|
4609
|
-
await delay(50);
|
|
4610
|
-
}
|
|
4611
|
-
close(events.exitCode);
|
|
4612
|
-
} catch (err) {
|
|
4613
|
-
close(events.exitCode, err);
|
|
4614
|
-
}
|
|
4615
|
-
}
|
|
4616
|
-
};
|
|
4617
|
-
}
|
|
4618
|
-
init_utils();
|
|
4619
|
-
var WRONG_NUMBER_ERR = `Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings`;
|
|
4620
|
-
var WRONG_CHARS_ERR = `Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option`;
|
|
4621
|
-
function isBadArgument(arg) {
|
|
4622
|
-
return !arg || !/^([a-z]:)?([a-z0-9/.\\_-]+)$/i.test(arg);
|
|
4623
|
-
}
|
|
4624
|
-
function toBinaryConfig(input, allowUnsafe) {
|
|
4625
|
-
if (input.length < 1 || input.length > 2) {
|
|
4626
|
-
throw new GitPluginError(undefined, "binary", WRONG_NUMBER_ERR);
|
|
4627
|
-
}
|
|
4628
|
-
const isBad = input.some(isBadArgument);
|
|
4629
|
-
if (isBad) {
|
|
4630
|
-
if (allowUnsafe) {
|
|
4631
|
-
console.warn(WRONG_CHARS_ERR);
|
|
4632
|
-
} else {
|
|
4633
|
-
throw new GitPluginError(undefined, "binary", WRONG_CHARS_ERR);
|
|
4634
|
-
}
|
|
4635
|
-
}
|
|
4636
|
-
const [binary, prefix] = input;
|
|
4637
|
-
return {
|
|
4638
|
-
binary,
|
|
4639
|
-
prefix
|
|
4640
|
-
};
|
|
4641
|
-
}
|
|
4642
|
-
function customBinaryPlugin(plugins, input = ["git"], allowUnsafe = false) {
|
|
4643
|
-
let config = toBinaryConfig(asArray(input), allowUnsafe);
|
|
4644
|
-
plugins.on("binary", (input2) => {
|
|
4645
|
-
config = toBinaryConfig(asArray(input2), allowUnsafe);
|
|
4646
|
-
});
|
|
4647
|
-
plugins.append("spawn.binary", () => {
|
|
4648
|
-
return config.binary;
|
|
4649
|
-
});
|
|
4650
|
-
plugins.append("spawn.args", (data) => {
|
|
4651
|
-
return config.prefix ? [config.prefix, ...data] : data;
|
|
4652
|
-
});
|
|
4653
|
-
}
|
|
4654
|
-
init_git_error();
|
|
4655
|
-
function isTaskError(result) {
|
|
4656
|
-
return !!(result.exitCode && result.stdErr.length);
|
|
4657
|
-
}
|
|
4658
|
-
function getErrorMessage(result) {
|
|
4659
|
-
return Buffer.concat([...result.stdOut, ...result.stdErr]);
|
|
4660
|
-
}
|
|
4661
|
-
function errorDetectionHandler(overwrite = false, isError = isTaskError, errorMessage = getErrorMessage) {
|
|
4662
|
-
return (error, result) => {
|
|
4663
|
-
if (!overwrite && error || !isError(result)) {
|
|
4664
|
-
return error;
|
|
4665
|
-
}
|
|
4666
|
-
return errorMessage(result);
|
|
4667
|
-
};
|
|
4668
|
-
}
|
|
4669
|
-
function errorDetectionPlugin(config) {
|
|
4670
|
-
return {
|
|
4671
|
-
type: "task.error",
|
|
4672
|
-
action(data, context) {
|
|
4673
|
-
const error = config(data.error, {
|
|
4674
|
-
stdErr: context.stdErr,
|
|
4675
|
-
stdOut: context.stdOut,
|
|
4676
|
-
exitCode: context.exitCode
|
|
4677
|
-
});
|
|
4678
|
-
if (Buffer.isBuffer(error)) {
|
|
4679
|
-
return { error: new GitError(undefined, error.toString("utf-8")) };
|
|
4680
|
-
}
|
|
4681
|
-
return {
|
|
4682
|
-
error
|
|
4683
|
-
};
|
|
4684
|
-
}
|
|
4685
|
-
};
|
|
4686
|
-
}
|
|
4687
|
-
init_utils();
|
|
4688
|
-
var PluginStore = class {
|
|
4689
|
-
constructor() {
|
|
4690
|
-
this.plugins = /* @__PURE__ */ new Set;
|
|
4691
|
-
this.events = new EventEmitter;
|
|
4692
|
-
}
|
|
4693
|
-
on(type, listener) {
|
|
4694
|
-
this.events.on(type, listener);
|
|
4695
|
-
}
|
|
4696
|
-
reconfigure(type, data) {
|
|
4697
|
-
this.events.emit(type, data);
|
|
4698
|
-
}
|
|
4699
|
-
append(type, action) {
|
|
4700
|
-
const plugin = append(this.plugins, { type, action });
|
|
4701
|
-
return () => this.plugins.delete(plugin);
|
|
4702
|
-
}
|
|
4703
|
-
add(plugin) {
|
|
4704
|
-
const plugins = [];
|
|
4705
|
-
asArray(plugin).forEach((plugin2) => plugin2 && this.plugins.add(append(plugins, plugin2)));
|
|
4706
|
-
return () => {
|
|
4707
|
-
plugins.forEach((plugin2) => this.plugins.delete(plugin2));
|
|
4708
|
-
};
|
|
4709
|
-
}
|
|
4710
|
-
exec(type, data, context) {
|
|
4711
|
-
let output = data;
|
|
4712
|
-
const contextual = Object.freeze(Object.create(context));
|
|
4713
|
-
for (const plugin of this.plugins) {
|
|
4714
|
-
if (plugin.type === type) {
|
|
4715
|
-
output = plugin.action(output, contextual);
|
|
4716
|
-
}
|
|
4717
|
-
}
|
|
4718
|
-
return output;
|
|
4719
|
-
}
|
|
4720
|
-
};
|
|
4721
|
-
init_utils();
|
|
4722
|
-
function progressMonitorPlugin(progress) {
|
|
4723
|
-
const progressCommand = "--progress";
|
|
4724
|
-
const progressMethods = ["checkout", "clone", "fetch", "pull", "push"];
|
|
4725
|
-
const onProgress = {
|
|
4726
|
-
type: "spawn.after",
|
|
4727
|
-
action(_data, context) {
|
|
4728
|
-
if (!context.commands.includes(progressCommand)) {
|
|
4729
|
-
return;
|
|
4730
|
-
}
|
|
4731
|
-
context.spawned.stderr?.on("data", (chunk) => {
|
|
4732
|
-
const message = /^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(chunk.toString("utf8"));
|
|
4733
|
-
if (!message) {
|
|
4734
|
-
return;
|
|
4735
|
-
}
|
|
4736
|
-
progress({
|
|
4737
|
-
method: context.method,
|
|
4738
|
-
stage: progressEventStage(message[1]),
|
|
4739
|
-
progress: asNumber(message[2]),
|
|
4740
|
-
processed: asNumber(message[3]),
|
|
4741
|
-
total: asNumber(message[4])
|
|
4742
|
-
});
|
|
4743
|
-
});
|
|
4744
|
-
}
|
|
4745
|
-
};
|
|
4746
|
-
const onArgs = {
|
|
4747
|
-
type: "spawn.args",
|
|
4748
|
-
action(args, context) {
|
|
4749
|
-
if (!progressMethods.includes(context.method)) {
|
|
4750
|
-
return args;
|
|
4751
|
-
}
|
|
4752
|
-
return including(args, progressCommand);
|
|
4753
|
-
}
|
|
4754
|
-
};
|
|
4755
|
-
return [onArgs, onProgress];
|
|
4756
|
-
}
|
|
4757
|
-
function progressEventStage(input) {
|
|
4758
|
-
return String(input.toLowerCase().split(" ", 1)) || "unknown";
|
|
4759
|
-
}
|
|
4760
|
-
init_utils();
|
|
4761
|
-
function spawnOptionsPlugin(spawnOptions) {
|
|
4762
|
-
const options = pick(spawnOptions, ["uid", "gid"]);
|
|
4763
|
-
return {
|
|
4764
|
-
type: "spawn.options",
|
|
4765
|
-
action(data) {
|
|
4766
|
-
return { ...options, ...data };
|
|
4767
|
-
}
|
|
4768
|
-
};
|
|
4769
|
-
}
|
|
4770
|
-
function timeoutPlugin({
|
|
4771
|
-
block,
|
|
4772
|
-
stdErr = true,
|
|
4773
|
-
stdOut = true
|
|
4774
|
-
}) {
|
|
4775
|
-
if (block > 0) {
|
|
4776
|
-
return {
|
|
4777
|
-
type: "spawn.after",
|
|
4778
|
-
action(_data, context) {
|
|
4779
|
-
let timeout;
|
|
4780
|
-
function wait() {
|
|
4781
|
-
timeout && clearTimeout(timeout);
|
|
4782
|
-
timeout = setTimeout(kill, block);
|
|
4783
|
-
}
|
|
4784
|
-
function stop() {
|
|
4785
|
-
context.spawned.stdout?.off("data", wait);
|
|
4786
|
-
context.spawned.stderr?.off("data", wait);
|
|
4787
|
-
context.spawned.off("exit", stop);
|
|
4788
|
-
context.spawned.off("close", stop);
|
|
4789
|
-
timeout && clearTimeout(timeout);
|
|
4790
|
-
}
|
|
4791
|
-
function kill() {
|
|
4792
|
-
stop();
|
|
4793
|
-
context.kill(new GitPluginError(undefined, "timeout", `block timeout reached`));
|
|
4794
|
-
}
|
|
4795
|
-
stdOut && context.spawned.stdout?.on("data", wait);
|
|
4796
|
-
stdErr && context.spawned.stderr?.on("data", wait);
|
|
4797
|
-
context.spawned.on("exit", stop);
|
|
4798
|
-
context.spawned.on("close", stop);
|
|
4799
|
-
wait();
|
|
4800
|
-
}
|
|
4801
|
-
};
|
|
4802
|
-
}
|
|
4803
|
-
}
|
|
4804
|
-
init_pathspec();
|
|
4805
|
-
function suffixPathsPlugin() {
|
|
4806
|
-
return {
|
|
4807
|
-
type: "spawn.args",
|
|
4808
|
-
action(data) {
|
|
4809
|
-
const prefix = [];
|
|
4810
|
-
let suffix;
|
|
4811
|
-
function append2(args) {
|
|
4812
|
-
(suffix = suffix || []).push(...args);
|
|
4813
|
-
}
|
|
4814
|
-
for (let i = 0;i < data.length; i++) {
|
|
4815
|
-
const param = data[i];
|
|
4816
|
-
if (isPathSpec(param)) {
|
|
4817
|
-
append2(toPaths(param));
|
|
4818
|
-
continue;
|
|
4819
|
-
}
|
|
4820
|
-
if (param === "--") {
|
|
4821
|
-
append2(data.slice(i + 1).flatMap((item) => isPathSpec(item) && toPaths(item) || item));
|
|
4822
|
-
break;
|
|
4823
|
-
}
|
|
4824
|
-
prefix.push(param);
|
|
4825
|
-
}
|
|
4826
|
-
return !suffix ? prefix : [...prefix, "--", ...suffix.map(String)];
|
|
4827
|
-
}
|
|
4828
|
-
};
|
|
4829
|
-
}
|
|
4830
|
-
init_utils();
|
|
4831
|
-
var Git = require_git();
|
|
4832
|
-
function gitInstanceFactory(baseDir, options) {
|
|
4833
|
-
const plugins = new PluginStore;
|
|
4834
|
-
const config = createInstanceConfig(baseDir && (typeof baseDir === "string" ? { baseDir } : baseDir) || {}, options);
|
|
4835
|
-
if (!folderExists(config.baseDir)) {
|
|
4836
|
-
throw new GitConstructError(config, `Cannot use simple-git on a directory that does not exist`);
|
|
4837
|
-
}
|
|
4838
|
-
if (Array.isArray(config.config)) {
|
|
4839
|
-
plugins.add(commandConfigPrefixingPlugin(config.config));
|
|
4840
|
-
}
|
|
4841
|
-
plugins.add(blockUnsafeOperationsPlugin(config.unsafe));
|
|
4842
|
-
plugins.add(suffixPathsPlugin());
|
|
4843
|
-
plugins.add(completionDetectionPlugin(config.completion));
|
|
4844
|
-
config.abort && plugins.add(abortPlugin(config.abort));
|
|
4845
|
-
config.progress && plugins.add(progressMonitorPlugin(config.progress));
|
|
4846
|
-
config.timeout && plugins.add(timeoutPlugin(config.timeout));
|
|
4847
|
-
config.spawnOptions && plugins.add(spawnOptionsPlugin(config.spawnOptions));
|
|
4848
|
-
plugins.add(errorDetectionPlugin(errorDetectionHandler(true)));
|
|
4849
|
-
config.errors && plugins.add(errorDetectionPlugin(config.errors));
|
|
4850
|
-
customBinaryPlugin(plugins, config.binary, config.unsafe?.allowUnsafeCustomBinary);
|
|
4851
|
-
return new Git(config, plugins);
|
|
4852
|
-
}
|
|
4853
|
-
init_git_response_error();
|
|
4854
|
-
var simpleGit = gitInstanceFactory;
|
|
4855
|
-
|
|
4856
|
-
// src/index.ts
|
|
4857
6
|
class Storage {
|
|
4858
7
|
repoPath;
|
|
4859
8
|
gitRoot;
|