@candriajs/simple-git
Version:
一些常用包以及常用函数进行封装,并打包优化, 此包为simple-git封装
1,880 lines • 97.2 kB
JavaScript
import { Buffer as Ns } from "node:buffer";
import Gs from "fs";
import { spawn as Us } from "child_process";
import { EventEmitter as qs } from "node:events";
var je = {}, se = {}, de = { exports: {} }, Be, Mt;
function zs() {
if (Mt) return Be;
Mt = 1;
var e = 1e3, t = e * 60, r = t * 60, n = r * 24, s = n * 7, i = n * 365.25;
Be = function(f, o) {
o = o || {};
var h = typeof f;
if (h === "string" && f.length > 0)
return u(f);
if (h === "number" && isFinite(f))
return o.long ? c(f) : a(f);
throw new Error(
"val is not a non-empty string or a valid number. val=" + JSON.stringify(f)
);
};
function u(f) {
if (f = String(f), !(f.length > 100)) {
var o = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
f
);
if (o) {
var h = parseFloat(o[1]), d = (o[2] || "ms").toLowerCase();
switch (d) {
case "years":
case "year":
case "yrs":
case "yr":
case "y":
return h * i;
case "weeks":
case "week":
case "w":
return h * s;
case "days":
case "day":
case "d":
return h * n;
case "hours":
case "hour":
case "hrs":
case "hr":
case "h":
return h * r;
case "minutes":
case "minute":
case "mins":
case "min":
case "m":
return h * t;
case "seconds":
case "second":
case "secs":
case "sec":
case "s":
return h * e;
case "milliseconds":
case "millisecond":
case "msecs":
case "msec":
case "ms":
return h;
default:
return;
}
}
}
}
function a(f) {
var o = Math.abs(f);
return o >= n ? Math.round(f / n) + "d" : o >= r ? Math.round(f / r) + "h" : o >= t ? Math.round(f / t) + "m" : o >= e ? Math.round(f / e) + "s" : f + "ms";
}
function c(f) {
var o = Math.abs(f);
return o >= n ? m(f, o, n, "day") : o >= r ? m(f, o, r, "hour") : o >= t ? m(f, o, t, "minute") : o >= e ? m(f, o, e, "second") : f + " ms";
}
function m(f, o, h, d) {
var w = o >= h * 1.5;
return Math.round(f / h) + " " + d + (w ? "s" : "");
}
return Be;
}
var $e, Lt;
function Ws() {
if (Lt) return $e;
Lt = 1;
function e(t) {
n.debug = n, n.default = n, n.coerce = m, n.disable = a, n.enable = i, n.enabled = c, n.humanize = zs(), n.destroy = f, Object.keys(t).forEach((o) => {
n[o] = t[o];
}), n.names = [], n.skips = [], n.formatters = {};
function r(o) {
let h = 0;
for (let d = 0; d < o.length; d++)
h = (h << 5) - h + o.charCodeAt(d), h |= 0;
return n.colors[Math.abs(h) % n.colors.length];
}
n.selectColor = r;
function n(o) {
let h, d = null, w, B;
function O(...P) {
if (!O.enabled)
return;
const U = O, Y = Number(/* @__PURE__ */ new Date()), Me = Y - (h || Y);
U.diff = Me, U.prev = h, U.curr = Y, h = Y, P[0] = n.coerce(P[0]), typeof P[0] != "string" && P.unshift("%O");
let J = 0;
P[0] = P[0].replace(/%([a-zA-Z%])/g, (ne, Le) => {
if (ne === "%%")
return "%";
J++;
const pe = n.formatters[Le];
if (typeof pe == "function") {
const De = P[J];
ne = pe.call(U, De), P.splice(J, 1), J--;
}
return ne;
}), n.formatArgs.call(U, P), (U.log || n.log).apply(U, P);
}
return O.namespace = o, O.useColors = n.useColors(), O.color = n.selectColor(o), O.extend = s, O.destroy = n.destroy, Object.defineProperty(O, "enabled", {
enumerable: !0,
configurable: !1,
get: () => d !== null ? d : (w !== n.namespaces && (w = n.namespaces, B = n.enabled(o)), B),
set: (P) => {
d = P;
}
}), typeof n.init == "function" && n.init(O), O;
}
function s(o, h) {
const d = n(this.namespace + (typeof h > "u" ? ":" : h) + o);
return d.log = this.log, d;
}
function i(o) {
n.save(o), n.namespaces = o, n.names = [], n.skips = [];
const h = (typeof o == "string" ? o : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
for (const d of h)
d[0] === "-" ? n.skips.push(d.slice(1)) : n.names.push(d);
}
function u(o, h) {
let d = 0, w = 0, B = -1, O = 0;
for (; d < o.length; )
if (w < h.length && (h[w] === o[d] || h[w] === "*"))
h[w] === "*" ? (B = w, O = d, w++) : (d++, w++);
else if (B !== -1)
w = B + 1, O++, d = O;
else
return !1;
for (; w < h.length && h[w] === "*"; )
w++;
return w === h.length;
}
function a() {
const o = [
...n.names,
...n.skips.map((h) => "-" + h)
].join(",");
return n.enable(""), o;
}
function c(o) {
for (const h of n.skips)
if (u(o, h))
return !1;
for (const h of n.names)
if (u(o, h))
return !0;
return !1;
}
function m(o) {
return o instanceof Error ? o.stack || o.message : o;
}
function f() {
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
}
return n.enable(n.load()), n;
}
return $e = e, $e;
}
var Dt;
function br() {
return Dt || (Dt = 1, function(e, t) {
t.formatArgs = n, t.save = s, t.load = i, t.useColors = r, t.storage = u(), t.destroy = /* @__PURE__ */ (() => {
let c = !1;
return () => {
c || (c = !0, console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."));
};
})(), t.colors = [
"#0000CC",
"#0000FF",
"#0033CC",
"#0033FF",
"#0066CC",
"#0066FF",
"#0099CC",
"#0099FF",
"#00CC00",
"#00CC33",
"#00CC66",
"#00CC99",
"#00CCCC",
"#00CCFF",
"#3300CC",
"#3300FF",
"#3333CC",
"#3333FF",
"#3366CC",
"#3366FF",
"#3399CC",
"#3399FF",
"#33CC00",
"#33CC33",
"#33CC66",
"#33CC99",
"#33CCCC",
"#33CCFF",
"#6600CC",
"#6600FF",
"#6633CC",
"#6633FF",
"#66CC00",
"#66CC33",
"#9900CC",
"#9900FF",
"#9933CC",
"#9933FF",
"#99CC00",
"#99CC33",
"#CC0000",
"#CC0033",
"#CC0066",
"#CC0099",
"#CC00CC",
"#CC00FF",
"#CC3300",
"#CC3333",
"#CC3366",
"#CC3399",
"#CC33CC",
"#CC33FF",
"#CC6600",
"#CC6633",
"#CC9900",
"#CC9933",
"#CCCC00",
"#CCCC33",
"#FF0000",
"#FF0033",
"#FF0066",
"#FF0099",
"#FF00CC",
"#FF00FF",
"#FF3300",
"#FF3333",
"#FF3366",
"#FF3399",
"#FF33CC",
"#FF33FF",
"#FF6600",
"#FF6633",
"#FF9900",
"#FF9933",
"#FFCC00",
"#FFCC33"
];
function r() {
if (typeof window < "u" && window.process && (window.process.type === "renderer" || window.process.__nwjs))
return !0;
if (typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))
return !1;
let c;
return typeof document < "u" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
typeof window < "u" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
typeof navigator < "u" && navigator.userAgent && (c = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(c[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
}
function n(c) {
if (c[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + c[0] + (this.useColors ? "%c " : " ") + "+" + e.exports.humanize(this.diff), !this.useColors)
return;
const m = "color: " + this.color;
c.splice(1, 0, m, "color: inherit");
let f = 0, o = 0;
c[0].replace(/%[a-zA-Z%]/g, (h) => {
h !== "%%" && (f++, h === "%c" && (o = f));
}), c.splice(o, 0, m);
}
t.log = console.debug || console.log || (() => {
});
function s(c) {
try {
c ? t.storage.setItem("debug", c) : t.storage.removeItem("debug");
} catch {
}
}
function i() {
let c;
try {
c = t.storage.getItem("debug") || t.storage.getItem("DEBUG");
} catch {
}
return !c && typeof process < "u" && "env" in process && (c = process.env.DEBUG), c;
}
function u() {
try {
return localStorage;
} catch {
}
}
e.exports = Ws()(t);
const { formatters: a } = e.exports;
a.j = function(c) {
try {
return JSON.stringify(c);
} catch (m) {
return "[UnexpectedJSONParseError]: " + m.message;
}
};
}(de, de.exports)), de.exports;
}
var It;
function Hs() {
return It || (It = 1, function(e) {
var t = se && se.__importDefault || function(a) {
return a && a.__esModule ? a : { default: a };
};
Object.defineProperty(e, "__esModule", { value: !0 });
const r = Gs, s = t(br()).default("@kwsites/file-exists");
function i(a, c, m) {
s("checking %s", a);
try {
const f = r.statSync(a);
return f.isFile() && c ? (s("[OK] path represents a file"), !0) : f.isDirectory() && m ? (s("[OK] path represents a directory"), !0) : (s("[FAIL] path represents something other than a file or directory"), !1);
} catch (f) {
if (f.code === "ENOENT")
return s("[FAIL] path is not accessible: %o", f), !1;
throw s("[FATAL] %o", f), f;
}
}
function u(a, c = e.READABLE) {
return i(a, (c & e.FILE) > 0, (c & e.FOLDER) > 0);
}
e.exists = u, e.FILE = 1, e.FOLDER = 2, e.READABLE = e.FILE + e.FOLDER;
}(se)), se;
}
var jt;
function Qs() {
return jt || (jt = 1, function(e) {
function t(r) {
for (var n in r) e.hasOwnProperty(n) || (e[n] = r[n]);
}
Object.defineProperty(e, "__esModule", { value: !0 }), t(Hs());
}(je)), je;
}
var Bt = Qs(), He = br(), W = {}, $t;
function Ks() {
if ($t) return W;
$t = 1, Object.defineProperty(W, "__esModule", { value: !0 }), W.createDeferred = W.deferred = void 0;
function e() {
let t, r, n = "pending";
return {
promise: new Promise((i, u) => {
t = i, r = u;
}),
done(i) {
n === "pending" && (n = "resolved", t(i));
},
fail(i) {
n === "pending" && (n = "rejected", r(i));
},
get fulfilled() {
return n !== "pending";
},
get status() {
return n;
}
};
}
return W.deferred = e, W.createDeferred = e, W.default = e, W;
}
var Z = Ks(), ot = Object.defineProperty, Vs = Object.getOwnPropertyDescriptor, ut = Object.getOwnPropertyNames, Xs = Object.prototype.hasOwnProperty, p = (e, t) => function() {
return e && (t = (0, e[ut(e)[0]])(e = 0)), t;
}, Ys = (e, t) => function() {
return t || (0, e[ut(e)[0]])((t = { exports: {} }).exports, t), t.exports;
}, E = (e, t) => {
for (var r in t)
ot(e, r, { get: t[r], enumerable: !0 });
}, Js = (e, t, r, n) => {
if (t && typeof t == "object" || typeof t == "function")
for (let s of ut(t))
!Xs.call(e, s) && s !== r && ot(e, s, { get: () => t[s], enumerable: !(n = Vs(t, s)) || n.enumerable });
return e;
}, C = (e) => Js(ot({}, "__esModule", { value: !0 }), e);
function Zs(...e) {
const t = new String(e);
return Ce.set(t, e), t;
}
function _e(e) {
return e instanceof String && Ce.has(e);
}
function Nt(e) {
return Ce.get(e) || [];
}
var Ce, ue = p({
"src/lib/args/pathspec.ts"() {
Ce = /* @__PURE__ */ new WeakMap();
}
}), z, Q = p({
"src/lib/errors/git-error.ts"() {
z = class extends Error {
constructor(e, t) {
super(t), this.task = e, Object.setPrototypeOf(this, new.target.prototype);
}
};
}
}), te, re = p({
"src/lib/errors/git-response-error.ts"() {
Q(), te = class extends z {
constructor(e, t) {
super(void 0, t || String(e)), this.git = e;
}
};
}
}), yr, _r = p({
"src/lib/errors/task-configuration-error.ts"() {
Q(), yr = class extends z {
constructor(e) {
super(void 0, e);
}
};
}
});
function kr(e) {
return typeof e != "function" ? X : e;
}
function Tr(e) {
return typeof e == "function" && e !== X;
}
function wr(e, t) {
const r = e.indexOf(t);
return r <= 0 ? [e, ""] : [e.substr(0, r), e.substr(r + 1)];
}
function Cr(e, t = 0) {
return Sr(e) && e.length > t ? e[t] : void 0;
}
function V(e, t = 0) {
if (Sr(e) && e.length > t)
return e[e.length - 1 - t];
}
function Sr(e) {
return !!(e && typeof e.length == "number");
}
function ce(e = "", t = !0, r = `
`) {
return e.split(r).reduce((n, s) => {
const i = t ? s.trim() : s;
return i && n.push(i), n;
}, []);
}
function ct(e, t) {
return ce(e, !0).map((r) => t(r));
}
function lt(e) {
return Bt.exists(e, Bt.FOLDER);
}
function _(e, t) {
return Array.isArray(e) ? e.includes(t) || e.push(t) : e.add(t), t;
}
function Rr(e, t) {
return Array.isArray(e) && !e.includes(t) && e.push(t), e;
}
function Se(e, t) {
if (Array.isArray(e)) {
const r = e.indexOf(t);
r >= 0 && e.splice(r, 1);
} else
e.delete(t);
return t;
}
function N(e) {
return Array.isArray(e) ? e : [e];
}
function Er(e) {
return e.replace(/[\s-]+(.)/g, (t, r) => r.toUpperCase());
}
function Or(e) {
return N(e).map(String);
}
function T(e, t = 0) {
if (e == null)
return t;
const r = parseInt(e, 10);
return isNaN(r) ? t : r;
}
function ae(e, t) {
const r = [];
for (let n = 0, s = e.length; n < s; n++)
r.push(t, e[n]);
return r;
}
function oe(e) {
return (Array.isArray(e) ? Ns.concat(e) : e).toString("utf-8");
}
function Fr(e, t) {
return Object.assign(
{},
...t.map((r) => r in e ? { [r]: e[r] } : {})
);
}
function Qe(e = 0) {
return new Promise((t) => setTimeout(t, e));
}
function Ke(e) {
if (e !== !1)
return e;
}
var ee, X, le, Re = p({
"src/lib/utils/util.ts"() {
ee = "\0", X = () => {
}, le = Object.prototype.toString.call.bind(Object.prototype.toString);
}
});
function G(e, t, r) {
return t(e) ? e : arguments.length > 2 ? r : void 0;
}
function Ve(e, t) {
const r = _e(e) ? "string" : typeof e;
return /number|string|boolean/.test(r) && (!t || !t.includes(r));
}
function Ee(e) {
return !!e && le(e) === "[object Object]";
}
function xr(e) {
return typeof e == "function";
}
var fe, F, Ar, ke, ft, Pr = p({
"src/lib/utils/argument-filters.ts"() {
Re(), ue(), fe = (e) => Array.isArray(e), F = (e) => typeof e == "string", Ar = (e) => Array.isArray(e) && e.every(F), ke = (e) => F(e) || Array.isArray(e) && e.every(F), ft = (e) => e == null || "number|boolean|function".includes(typeof e) ? !1 : Array.isArray(e) || typeof e == "string" || typeof e.length == "number";
}
}), Xe, ei = p({
"src/lib/utils/exit-codes.ts"() {
Xe = /* @__PURE__ */ ((e) => (e[e.SUCCESS = 0] = "SUCCESS", e[e.ERROR = 1] = "ERROR", e[e.NOT_FOUND = -2] = "NOT_FOUND", e[e.UNCLEAN = 128] = "UNCLEAN", e))(Xe || {});
}
}), Te, ti = p({
"src/lib/utils/git-output-streams.ts"() {
Te = class Mr {
constructor(t, r) {
this.stdOut = t, this.stdErr = r;
}
asStrings() {
return new Mr(this.stdOut.toString("utf8"), this.stdErr.toString("utf8"));
}
};
}
}), y, H, ri = p({
"src/lib/utils/line-parser.ts"() {
y = class {
constructor(e, t) {
this.matches = [], this.parse = (r, n) => (this.resetMatches(), this._regExp.every((s, i) => this.addMatch(s, i, r(i))) ? this.useMatches(n, this.prepareMatches()) !== !1 : !1), this._regExp = Array.isArray(e) ? e : [e], t && (this.useMatches = t);
}
// @ts-ignore
useMatches(e, t) {
throw new Error("LineParser:useMatches not implemented");
}
resetMatches() {
this.matches.length = 0;
}
prepareMatches() {
return this.matches;
}
addMatch(e, t, r) {
const n = r && e.exec(r);
return n && this.pushMatch(t, n), !!n;
}
pushMatch(e, t) {
this.matches.push(...t.slice(1));
}
}, H = class extends y {
addMatch(e, t, r) {
return /^remote:\s/.test(String(r)) && super.addMatch(e, t, r);
}
pushMatch(e, t) {
(e > 0 || t.length > 1) && super.pushMatch(e, t);
}
};
}
});
function Lr(...e) {
const t = process.cwd(), r = Object.assign(
{ baseDir: t, ...Dr },
...e.filter((n) => typeof n == "object" && n)
);
return r.baseDir = r.baseDir || t, r.trimmed = r.trimmed === !0, r;
}
var Dr, ni = p({
"src/lib/utils/simple-git-options.ts"() {
Dr = {
binary: "git",
maxConcurrentProcesses: 5,
config: [],
trimmed: !1
};
}
});
function ht(e, t = []) {
return Ee(e) ? Object.keys(e).reduce((r, n) => {
const s = e[n];
if (_e(s))
r.push(s);
else if (Ve(s, ["boolean"]))
r.push(n + "=" + s);
else if (Array.isArray(s))
for (const i of s)
Ve(i, ["string", "number"]) || r.push(n + "=" + i);
else
r.push(n);
return r;
}, t) : t;
}
function M(e, t = 0, r = !1) {
const n = [];
for (let s = 0, i = t < 0 ? e.length : t; s < i; s++)
"string|number".includes(typeof e[s]) && n.push(String(e[s]));
return ht(pt(e), n), r || n.push(...si(e)), n;
}
function si(e) {
const t = typeof V(e) == "function";
return G(V(e, t ? 1 : 0), fe, []);
}
function pt(e) {
const t = xr(V(e));
return G(V(e, t ? 1 : 0), Ee);
}
function S(e, t = !0) {
const r = kr(V(e));
return t || Tr(r) ? r : void 0;
}
var ii = p({
"src/lib/utils/task-options.ts"() {
Pr(), Re(), ue();
}
});
function Ye(e, t) {
return e(t.stdOut, t.stdErr);
}
function D(e, t, r, n = !0) {
return N(r).forEach((s) => {
for (let i = ce(s, n), u = 0, a = i.length; u < a; u++) {
const c = (m = 0) => {
if (!(u + m >= a))
return i[u + m];
};
t.some(({ parse: m }) => m(c, e));
}
}), e;
}
var ai = p({
"src/lib/utils/task-parser.ts"() {
Re();
}
}), Ir = {};
E(Ir, {
ExitCodes: () => Xe,
GitOutputStreams: () => Te,
LineParser: () => y,
NOOP: () => X,
NULL: () => ee,
RemoteLineParser: () => H,
append: () => _,
appendTaskOptions: () => ht,
asArray: () => N,
asCamelCase: () => Er,
asFunction: () => kr,
asNumber: () => T,
asStringArray: () => Or,
bufferToString: () => oe,
callTaskParser: () => Ye,
createInstanceConfig: () => Lr,
delay: () => Qe,
filterArray: () => fe,
filterFunction: () => xr,
filterHasLength: () => ft,
filterPlainObject: () => Ee,
filterPrimitives: () => Ve,
filterString: () => F,
filterStringArray: () => Ar,
filterStringOrStringArray: () => ke,
filterType: () => G,
first: () => Cr,
folderExists: () => lt,
forEachLineWithContent: () => ct,
getTrailingOptions: () => M,
including: () => Rr,
isUserFunction: () => Tr,
last: () => V,
objectToString: () => le,
orVoid: () => Ke,
parseStringResponse: () => D,
pick: () => Fr,
prefixedArray: () => ae,
remove: () => Se,
splitOn: () => wr,
toLinesWithContent: () => ce,
trailingFunctionArgument: () => S,
trailingOptionsArgument: () => pt
});
var b = p({
"src/lib/utils/index.ts"() {
Pr(), ei(), ti(), ri(), ni(), ii(), ai(), Re();
}
}), jr = {};
E(jr, {
CheckRepoActions: () => Je,
checkIsBareRepoTask: () => $r,
checkIsRepoRootTask: () => Br,
checkIsRepoTask: () => oi
});
function oi(e) {
switch (e) {
case "bare":
return $r();
case "root":
return Br();
}
return {
commands: ["rev-parse", "--is-inside-work-tree"],
format: "utf-8",
onError: Oe,
parser: dt
};
}
function Br() {
return {
commands: ["rev-parse", "--git-dir"],
format: "utf-8",
onError: Oe,
parser(t) {
return /^\.(git)?$/.test(t.trim());
}
};
}
function $r() {
return {
commands: ["rev-parse", "--is-bare-repository"],
format: "utf-8",
onError: Oe,
parser: dt
};
}
function ui(e) {
return /(Not a git repository|Kein Git-Repository)/i.test(String(e));
}
var Je, Oe, dt, Nr = p({
"src/lib/tasks/check-is-repo.ts"() {
b(), Je = /* @__PURE__ */ ((e) => (e.BARE = "bare", e.IN_TREE = "tree", e.IS_REPO_ROOT = "root", e))(Je || {}), Oe = ({ exitCode: e }, t, r, n) => {
if (e === 128 && ui(t))
return r(Buffer.from("false"));
n(t);
}, dt = (e) => e.trim() === "true";
}
});
function ci(e, t) {
const r = new Gr(e), n = e ? qr : Ur;
return ce(t).forEach((s) => {
const i = s.replace(n, "");
r.paths.push(i), (zr.test(i) ? r.folders : r.files).push(i);
}), r;
}
var Gr, Ur, qr, zr, li = p({
"src/lib/responses/CleanSummary.ts"() {
b(), Gr = class {
constructor(e) {
this.dryRun = e, this.paths = [], this.files = [], this.folders = [];
}
}, Ur = /^[a-z]+\s*/i, qr = /^[a-z]+\s+[a-z]+\s*/i, zr = /\/$/;
}
}), Ze = {};
E(Ze, {
EMPTY_COMMANDS: () => Fe,
adhocExecTask: () => Wr,
configurationErrorTask: () => L,
isBufferTask: () => Qr,
isEmptyTask: () => Kr,
straightThroughBufferTask: () => Hr,
straightThroughStringTask: () => A
});
function Wr(e) {
return {
commands: Fe,
format: "empty",
parser: e
};
}
function L(e) {
return {
commands: Fe,
format: "empty",
parser() {
throw typeof e == "string" ? new yr(e) : e;
}
};
}
function A(e, t = !1) {
return {
commands: e,
format: "utf-8",
parser(r) {
return t ? String(r).trim() : r;
}
};
}
function Hr(e) {
return {
commands: e,
format: "buffer",
parser(t) {
return t;
}
};
}
function Qr(e) {
return e.format === "buffer";
}
function Kr(e) {
return e.format === "empty" || !e.commands.length;
}
var Fe, R = p({
"src/lib/tasks/task.ts"() {
_r(), Fe = [];
}
}), Vr = {};
E(Vr, {
CONFIG_ERROR_INTERACTIVE_MODE: () => mt,
CONFIG_ERROR_MODE_REQUIRED: () => gt,
CONFIG_ERROR_UNKNOWN_OPTION: () => vt,
CleanOptions: () => ge,
cleanTask: () => Xr,
cleanWithOptionsTask: () => fi,
isCleanOptionsArray: () => hi
});
function fi(e, t) {
const { cleanMode: r, options: n, valid: s } = pi(e);
return r ? s.options ? (n.push(...t), n.some(gi) ? L(mt) : Xr(r, n)) : L(vt + JSON.stringify(e)) : L(gt);
}
function Xr(e, t) {
return {
commands: ["clean", `-${e}`, ...t],
format: "utf-8",
parser(n) {
return ci(e === "n", n);
}
};
}
function hi(e) {
return Array.isArray(e) && e.every((t) => bt.has(t));
}
function pi(e) {
let t, r = [], n = { cleanMode: !1, options: !0 };
return e.replace(/[^a-z]i/g, "").split("").forEach((s) => {
di(s) ? (t = s, n.cleanMode = !0) : n.options = n.options && mi(r[r.length] = `-${s}`);
}), {
cleanMode: t,
options: r,
valid: n
};
}
function di(e) {
return e === "f" || e === "n";
}
function mi(e) {
return /^-[a-z]$/i.test(e) && bt.has(e.charAt(1));
}
function gi(e) {
return /^-[^\-]/.test(e) ? e.indexOf("i") > 0 : e === "--interactive";
}
var mt, gt, vt, ge, bt, Yr = p({
"src/lib/tasks/clean.ts"() {
li(), b(), R(), mt = "Git clean interactive mode is not supported", gt = 'Git clean mode parameter ("n" or "f") is required', vt = "Git clean unknown option found in: ", ge = /* @__PURE__ */ ((e) => (e.DRY_RUN = "n", e.FORCE = "f", e.IGNORED_INCLUDED = "x", e.IGNORED_ONLY = "X", e.EXCLUDING = "e", e.QUIET = "q", e.RECURSIVE = "d", e))(ge || {}), bt = /* @__PURE__ */ new Set([
"i",
...Or(Object.values(ge))
]);
}
});
function vi(e) {
const t = new Zr();
for (const r of Jr(e))
t.addValue(r.file, String(r.key), r.value);
return t;
}
function bi(e, t) {
let r = null;
const n = [], s = /* @__PURE__ */ new Map();
for (const i of Jr(e, t))
i.key === t && (n.push(r = i.value), s.has(i.file) || s.set(i.file, []), s.get(i.file).push(r));
return {
key: t,
paths: Array.from(s.keys()),
scopes: s,
value: r,
values: n
};
}
function yi(e) {
return e.replace(/^(file):/, "");
}
function* Jr(e, t = null) {
const r = e.split("\0");
for (let n = 0, s = r.length - 1; n < s; ) {
const i = yi(r[n++]);
let u = r[n++], a = t;
if (u.includes(`
`)) {
const c = wr(u, `
`);
a = c[0], u = c[1];
}
yield { file: i, key: a, value: u };
}
}
var Zr, _i = p({
"src/lib/responses/ConfigList.ts"() {
b(), Zr = class {
constructor() {
this.files = [], this.values = /* @__PURE__ */ Object.create(null);
}
get all() {
return this._all || (this._all = this.files.reduce((e, t) => Object.assign(e, this.values[t]), {})), this._all;
}
addFile(e) {
if (!(e in this.values)) {
const t = V(this.files);
this.values[e] = t ? Object.create(this.values[t]) : {}, this.files.push(e);
}
return this.values[e];
}
addValue(e, t, r) {
const n = this.addFile(e);
n.hasOwnProperty(t) ? Array.isArray(n[t]) ? n[t].push(r) : n[t] = [n[t], r] : n[t] = r, this._all = void 0;
}
};
}
});
function Ne(e, t) {
return typeof e == "string" && et.hasOwnProperty(e) ? e : t;
}
function ki(e, t, r, n) {
const s = ["config", `--${n}`];
return r && s.push("--add"), s.push(e, t), {
commands: s,
format: "utf-8",
parser(i) {
return i;
}
};
}
function Ti(e, t) {
const r = ["config", "--null", "--show-origin", "--get-all", e];
return t && r.splice(1, 0, `--${t}`), {
commands: r,
format: "utf-8",
parser(n) {
return bi(n, e);
}
};
}
function wi(e) {
const t = ["config", "--list", "--show-origin", "--null"];
return e && t.push(`--${e}`), {
commands: t,
format: "utf-8",
parser(r) {
return vi(r);
}
};
}
function Ci() {
return {
addConfig(e, t, ...r) {
return this._runTask(
ki(
e,
t,
r[0] === !0,
Ne(
r[1],
"local"
/* local */
)
),
S(arguments)
);
},
getConfig(e, t) {
return this._runTask(
Ti(e, Ne(t, void 0)),
S(arguments)
);
},
listConfig(...e) {
return this._runTask(
wi(Ne(e[0], void 0)),
S(arguments)
);
}
};
}
var et, en = p({
"src/lib/tasks/config.ts"() {
_i(), b(), et = /* @__PURE__ */ ((e) => (e.system = "system", e.global = "global", e.local = "local", e.worktree = "worktree", e))(et || {});
}
});
function Si(e) {
return tn.has(e);
}
var Ge, tn, rn = p({
"src/lib/tasks/diff-name-status.ts"() {
Ge = /* @__PURE__ */ ((e) => (e.ADDED = "A", e.COPIED = "C", e.DELETED = "D", e.MODIFIED = "M", e.RENAMED = "R", e.CHANGED = "T", e.UNMERGED = "U", e.UNKNOWN = "X", e.BROKEN = "B", e))(Ge || {}), tn = new Set(Object.values(Ge));
}
});
function Ri(...e) {
return new sn().param(...e);
}
function Ei(e) {
const t = /* @__PURE__ */ new Set(), r = {};
return ct(e, (n) => {
const [s, i, u] = n.split(ee);
t.add(s), (r[s] = r[s] || []).push({
line: T(i),
path: s,
preview: u
});
}), {
paths: t,
results: r
};
}
function Oi() {
return {
grep(e) {
const t = S(arguments), r = M(arguments);
for (const s of nn)
if (r.includes(s))
return this._runTask(
L(`git.grep: use of "${s}" is not supported.`),
t
);
typeof e == "string" && (e = Ri().param(e));
const n = ["grep", "--null", "-n", "--full-name", ...r, ...e];
return this._runTask(
{
commands: n,
format: "utf-8",
parser(s) {
return Ei(s);
}
},
t
);
}
};
}
var nn, ie, Gt, sn, an = p({
"src/lib/tasks/grep.ts"() {
b(), R(), nn = ["-h"], ie = Symbol("grepQuery"), sn = class {
constructor() {
this[Gt] = [];
}
*[(Gt = ie, Symbol.iterator)]() {
for (const e of this[ie])
yield e;
}
and(...e) {
return e.length && this[ie].push("--and", "(", ...ae(e, "-e"), ")"), this;
}
param(...e) {
return this[ie].push(...ae(e, "-e")), this;
}
};
}
}), on = {};
E(on, {
ResetMode: () => ve,
getResetMode: () => xi,
resetTask: () => Fi
});
function Fi(e, t) {
const r = ["reset"];
return un(e) && r.push(`--${e}`), r.push(...t), A(r);
}
function xi(e) {
if (un(e))
return e;
switch (typeof e) {
case "string":
case "undefined":
return "soft";
}
}
function un(e) {
return cn.includes(e);
}
var ve, cn, ln = p({
"src/lib/tasks/reset.ts"() {
R(), ve = /* @__PURE__ */ ((e) => (e.MIXED = "mixed", e.SOFT = "soft", e.HARD = "hard", e.MERGE = "merge", e.KEEP = "keep", e))(ve || {}), cn = Array.from(Object.values(ve));
}
});
function Ai() {
return He("simple-git");
}
function Ut(e, t, r) {
return !t || !String(t).replace(/\s*/, "") ? r ? (n, ...s) => {
e(n, ...s), r(n, ...s);
} : e : (n, ...s) => {
e(`%s ${n}`, t, ...s), r && r(n, ...s);
};
}
function Pi(e, t, { namespace: r }) {
if (typeof e == "string")
return e;
const n = t && t.namespace || "";
return n.startsWith(r) ? n.substr(r.length + 1) : n || r;
}
function yt(e, t, r, n = Ai()) {
const s = e && `[${e}]` || "", i = [], u = typeof t == "string" ? n.extend(t) : t, a = Pi(G(t, F), u, n);
return m(r);
function c(f, o) {
return _(
i,
yt(e, a.replace(/^[^:]+/, f), o, n)
);
}
function m(f) {
const o = f && `[${f}]` || "", h = u && Ut(u, o) || X, d = Ut(n, `${s} ${o}`, h);
return Object.assign(u ? h : d, {
label: e,
sibling: c,
info: d,
step: m
});
}
}
var fn = p({
"src/lib/git-logger.ts"() {
b(), He.formatters.L = (e) => String(ft(e) ? e.length : "-"), He.formatters.B = (e) => Buffer.isBuffer(e) ? e.toString("utf8") : le(e);
}
}), hn, Mi = p({
"src/lib/runners/tasks-pending-queue.ts"() {
Q(), fn(), hn = class tt {
constructor(t = "GitExecutor") {
this.logLabel = t, this._queue = /* @__PURE__ */ new Map();
}
withProgress(t) {
return this._queue.get(t);
}
createProgress(t) {
const r = tt.getName(t.commands[0]), n = yt(this.logLabel, r);
return {
task: t,
logger: n,
name: r
};
}
push(t) {
const r = this.createProgress(t);
return r.logger("Adding task to the queue, commands = %o", t.commands), this._queue.set(t, r), r;
}
fatal(t) {
for (const [r, { logger: n }] of Array.from(this._queue.entries()))
r === t.task ? (n.info("Failed %o", t), n(
"Fatal exception, any as-yet un-started tasks run through this executor will not be attempted"
)) : n.info(
"A fatal exception occurred in a previous task, the queue has been purged: %o",
t.message
), this.complete(r);
if (this._queue.size !== 0)
throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`);
}
complete(t) {
this.withProgress(t) && this._queue.delete(t);
}
attempt(t) {
const r = this.withProgress(t);
if (!r)
throw new z(void 0, "TasksPendingQueue: attempt called for an unknown task");
return r.logger("Starting task"), r;
}
static getName(t = "empty") {
return `task:${t}:${++tt.counter}`;
}
static {
this.counter = 0;
}
};
}
});
function K(e, t) {
return {
method: Cr(e.commands) || "",
commands: t
};
}
function Li(e, t) {
return (r) => {
t("[ERROR] child process exception %o", r), e.push(Buffer.from(String(r.stack), "ascii"));
};
}
function qt(e, t, r, n) {
return (s) => {
r("%s received %L bytes", t, s), n("%B", s), e.push(s);
};
}
var rt, Di = p({
"src/lib/runners/git-executor-chain.ts"() {
Q(), R(), b(), Mi(), rt = class {
constructor(e, t, r) {
this._executor = e, this._scheduler = t, this._plugins = r, this._chain = Promise.resolve(), this._queue = new hn();
}
get cwd() {
return this._cwd || this._executor.cwd;
}
set cwd(e) {
this._cwd = e;
}
get env() {
return this._executor.env;
}
get outputHandler() {
return this._executor.outputHandler;
}
chain() {
return this;
}
push(e) {
return this._queue.push(e), this._chain = this._chain.then(() => this.attemptTask(e));
}
async attemptTask(e) {
const t = await this._scheduler.next(), r = () => this._queue.complete(e);
try {
const { logger: n } = this._queue.attempt(e);
return await (Kr(e) ? this.attemptEmptyTask(e, n) : this.attemptRemoteTask(e, n));
} catch (n) {
throw this.onFatalException(e, n);
} finally {
r(), t();
}
}
onFatalException(e, t) {
const r = t instanceof z ? Object.assign(t, { task: e }) : new z(e, t && String(t));
return this._chain = Promise.resolve(), this._queue.fatal(r), r;
}
async attemptRemoteTask(e, t) {
const r = this._plugins.exec("spawn.binary", "", K(e, e.commands)), n = this._plugins.exec(
"spawn.args",
[...e.commands],
K(e, e.commands)
), s = await this.gitResponse(
e,
r,
n,
this.outputHandler,
t.step("SPAWN")
), i = await this.handleTaskData(e, n, s, t.step("HANDLE"));
return t("passing response to task's parser as a %s", e.format), Qr(e) ? Ye(e.parser, i) : Ye(e.parser, i.asStrings());
}
async attemptEmptyTask(e, t) {
return t("empty task bypassing child process to call to task's parser"), e.parser(this);
}
handleTaskData(e, t, r, n) {
const { exitCode: s, rejection: i, stdOut: u, stdErr: a } = r;
return new Promise((c, m) => {
n("Preparing to handle process response exitCode=%d stdOut=", s);
const { error: f } = this._plugins.exec(
"task.error",
{ error: i },
{
...K(e, t),
...r
}
);
if (f && e.onError)
return n.info("exitCode=%s handling with custom error handler"), e.onError(
r,
f,
(o) => {
n.info("custom error handler treated as success"), n("custom error returned a %s", le(o)), c(
new Te(
Array.isArray(o) ? Buffer.concat(o) : o,
Buffer.concat(a)
)
);
},
m
);
if (f)
return n.info(
"handling as error: exitCode=%s stdErr=%s rejection=%o",
s,
a.length,
i
), m(f);
n.info("retrieving task output complete"), c(new Te(Buffer.concat(u), Buffer.concat(a)));
});
}
async gitResponse(e, t, r, n, s) {
const i = s.sibling("output"), u = this._plugins.exec(
"spawn.options",
{
cwd: this.cwd,
env: this.env,
windowsHide: !0
},
K(e, e.commands)
);
return new Promise((a) => {
const c = [], m = [];
s.info("%s %o", t, r), s("%O", u);
let f = this._beforeSpawn(e, r);
if (f)
return a({
stdOut: c,
stdErr: m,
exitCode: 9901,
rejection: f
});
this._plugins.exec("spawn.before", void 0, {
...K(e, r),
kill(h) {
f = h || f;
}
});
const o = Us(t, r, u);
o.stdout.on(
"data",
qt(c, "stdOut", s, i.step("stdOut"))
), o.stderr.on(
"data",
qt(m, "stdErr", s, i.step("stdErr"))
), o.on("error", Li(m, s)), n && (s("Passing child process stdOut/stdErr to custom outputHandler"), n(t, o.stdout, o.stderr, [...r])), this._plugins.exec("spawn.after", void 0, {
...K(e, r),
spawned: o,
close(h, d) {
a({
stdOut: c,
stdErr: m,
exitCode: h,
rejection: f || d
});
},
kill(h) {
o.killed || (f = h, o.kill("SIGINT"));
}
});
});
}
_beforeSpawn(e, t) {
let r;
return this._plugins.exec("spawn.before", void 0, {
...K(e, t),
kill(n) {
r = n || r;
}
}), r;
}
};
}
}), pn = {};
E(pn, {
GitExecutor: () => dn
});
var dn, Ii = p({
"src/lib/runners/git-executor.ts"() {
Di(), dn = class {
constructor(e, t, r) {
this.cwd = e, this._scheduler = t, this._plugins = r, this._chain = new rt(this, this._scheduler, this._plugins);
}
chain() {
return new rt(this, this._scheduler, this._plugins);
}
push(e) {
return this._chain.push(e);
}
};
}
});
function ji(e, t, r = X) {
const n = (i) => {
r(null, i);
}, s = (i) => {
i?.task === e && r(
i instanceof te ? Bi(i) : i,
void 0
);
};
t.then(n, s);
}
function Bi(e) {
let t = (n) => {
console.warn(
`simple-git deprecation notice: accessing GitResponseError.${n} should be GitResponseError.git.${n}, this will no longer be available in version 3`
), t = X;
};
return Object.create(e, Object.getOwnPropertyNames(e.git).reduce(r, {}));
function r(n, s) {
return s in e || (n[s] = {
enumerable: !1,
configurable: !1,
get() {
return t(s), e.git[s];
}
}), n;
}
}
var $i = p({
"src/lib/task-callback.ts"() {
re(), b();
}
});
function zt(e, t) {
return Wr((r) => {
if (!lt(e))
throw new Error(`Git.cwd: cannot change to non-directory "${e}"`);
return (t || r).cwd = e;
});
}
var Ni = p({
"src/lib/tasks/change-working-directory.ts"() {
b(), R();
}
});
function Ue(e) {
const t = ["checkout", ...e];
return t[1] === "-b" && t.includes("-B") && (t[1] = Se(t, "-B")), A(t);
}
function Gi() {
return {
checkout() {
return this._runTask(
Ue(M(arguments, 1)),
S(arguments)
);
},
checkoutBranch(e, t) {
return this._runTask(
Ue(["-b", e, t, ...M(arguments)]),
S(arguments)
);
},
checkoutLocalBranch(e) {
return this._runTask(
Ue(["-b", e, ...M(arguments)]),
S(arguments)
);
}
};
}
var Ui = p({
"src/lib/tasks/checkout.ts"() {
b(), R();
}
});
function qi() {
return {
count: 0,
garbage: 0,
inPack: 0,
packs: 0,
prunePackable: 0,
size: 0,
sizeGarbage: 0,
sizePack: 0
};
}
function zi() {
return {
countObjects() {
return this._runTask({
commands: ["count-objects", "--verbose"],
format: "utf-8",
parser(e) {
return D(qi(), [mn], e);
}
});
}
};
}
var mn, Wi = p({
"src/lib/tasks/count-objects.ts"() {
b(), mn = new y(
/([a-z-]+): (\d+)$/,
(e, [t, r]) => {
const n = Er(t);
e.hasOwnProperty(n) && (e[n] = T(r));
}
);
}
});
function Hi(e) {
return D({
author: null,
branch: "",
commit: "",
root: !1,
summary: {
changes: 0,
insertions: 0,
deletions: 0
}
}, gn, e);
}
var gn, Qi = p({
"src/lib/parsers/parse-commit.ts"() {
b(), gn = [
new y(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/, (e, [t, r, n]) => {
e.branch = t, e.commit = n, e.root = !!r;
}),
new y(/\s*Author:\s(.+)/i, (e, [t]) => {
const r = t.split("<"), n = r.pop();
!n || !n.includes("@") || (e.author = {
email: n.substr(0, n.length - 1),
name: r.join("<").trim()
});
}),
new y(
/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,
(e, [t, r, n]) => {
e.summary.changes = parseInt(t, 10) || 0, e.summary.insertions = parseInt(r, 10) || 0, e.summary.deletions = parseInt(n, 10) || 0;
}
),
new y(
/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,
(e, [t, r, n]) => {
e.summary.changes = parseInt(t, 10) || 0;
const s = parseInt(r, 10) || 0;
n === "-" ? e.summary.deletions = s : n === "+" && (e.summary.insertions = s);
}
)
];
}
});
function Ki(e, t, r) {
return {
commands: [
"-c",
"core.abbrev=40",
"commit",
...ae(e, "-m"),
...t,
...r
],
format: "utf-8",
parser: Hi
};
}
function Vi() {
return {
commit(t, ...r) {
const n = S(arguments), s = e(t) || Ki(
N(t),
N(G(r[0], ke, [])),
[...G(r[1], fe, []), ...M(arguments, 0, !0)]
);
return this._runTask(s, n);
}
};
function e(t) {
return !ke(t) && L(
"git.commit: requires the commit message to be supplied as a string/string[]"
);
}
}
var Xi = p({
"src/lib/tasks/commit.ts"() {
Qi(), b(), R();
}
});
function Yi() {
return {
firstCommit() {
return this._runTask(
A(["rev-list", "--max-parents=0", "HEAD"], !0),
S(arguments)
);
}
};
}
var Ji = p({
"src/lib/tasks/first-commit.ts"() {
b(), R();
}
});
function Zi(e, t) {
const r = ["hash-object", e];
return t && r.push("-w"), A(r, !0);
}
var ea = p({
"src/lib/tasks/hash-object.ts"() {
R();
}
});
function ta(e, t, r) {
const n = String(r).trim();
let s;
if (s = vn.exec(n))
return new be(e, t, !1, s[1]);
if (s = bn.exec(n))
return new be(e, t, !0, s[1]);
let i = "";
const u = n.split(" ");
for (; u.length; )
if (u.shift() === "in") {
i = u.join(" ");
break;
}
return new be(e, t, /^re/i.test(n), i);
}
var be, vn, bn, ra = p({
"src/lib/responses/InitSummary.ts"() {
be = class {
constructor(e, t, r, n) {
this.bare = e, this.path = t, this.existing = r, this.gitDir = n;
}
}, vn = /^Init.+ repository in (.+)$/, bn = /^Rein.+ in (.+)$/;
}
});
function na(e) {
return e.includes(_t);
}
function sa(e = !1, t, r) {
const n = ["init", ...r];
return e && !na(n) && n.splice(1, 0, _t), {
commands: n,
format: "utf-8",
parser(s) {
return ta(n.includes("--bare"), t, s);
}
};
}
var _t, ia = p({
"src/lib/tasks/init.ts"() {
ra(), _t = "--bare";
}
});
function kt(e) {
for (let t = 0; t < e.length; t++) {
const r = Tt.exec(e[t]);
if (r)
return `--${r[1]}`;
}
return "";
}
function aa(e) {
return Tt.test(e);
}
var Tt, he = p({
"src/lib/args/log-format.ts"() {
Tt = /^--(stat|numstat|name-only|name-status)(=|$)/;
}
}), yn, oa = p({
"src/lib/responses/DiffSummary.ts"() {
yn = class {
constructor() {
this.changed = 0, this.deletions = 0, this.insertions = 0, this.files = [];
}
};
}
});
function _n(e = "") {
const t = kn[e];
return (r) => D(new yn(), t, r, !1);
}
var qe, Wt, Ht, Qt, kn, Tn = p({
"src/lib/parsers/parse-diff-summary.ts"() {
he(), oa(), rn(), b(), qe = [
new y(
/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,
(e, [t, r, n = ""]) => {
e.files.push({
file: t.trim(),
changes: T(r),
insertions: n.replace(/[^+]/g, "").length,
deletions: n.replace(/[^-]/g, "").length,
binary: !1
});
}
),
new y(
/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,
(e, [t, r, n]) => {
e.files.push({
file: t.trim(),
before: T(r),
after: T(n),
binary: !0
});
}
),
new y(
/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,
(e, [t, r]) => {
const n = /(\d+) i/.exec(r), s = /(\d+) d/.exec(r);
e.changed = T(t), e.insertions = T(n?.[1]), e.deletions = T(s?.[1]);
}
)
], Wt = [
new y(
/(\d+)\t(\d+)\t(.+)$/,
(e, [t, r, n]) => {
const s = T(t), i = T(r);
e.changed++, e.insertions += s, e.deletions += i, e.files.push({
file: n,
changes: s + i,
insertions: s,
deletions: i,
binary: !1
});
}
),
new y(/-\t-\t(.+)$/, (e, [t]) => {
e.changed++, e.files.push({
file: t,
after: 0,
before: 0,
binary: !0
});
})
], Ht = [
new y(/(.+)$/, (e, [t]) => {
e.changed++, e.files.push({
file: t,
changes: 0,
insertions: 0,
deletions: 0,
binary: !1
});
})
], Qt = [
new y(
/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,
(e, [t, r, n, s, i]) => {
e.changed++, e.files.push({
file: i ?? n,
changes: 0,
insertions: 0,
deletions: 0,
binary: !1,
status: Ke(Si(t) && t),
from: Ke(!!i && n !== i && n),
similarity: T(r)
});
}
)
], kn = {
"": qe,
"--stat": qe,
"--numstat": Wt,
"--name-status": Qt,
"--name-only": Ht
};
}
});
function ua(e, t) {
return t.reduce(
(r, n, s) => (r[n] = e[s] || "", r),
/* @__PURE__ */ Object.create({ diff: null })
);
}
function wn(e = St, t = Cn, r = "") {
const n = _n(r);
return function(s) {
const i = ce(
s.trim(),
!1,
wt
).map(function(u) {
const a = u.split(Ct), c = ua(a[0].split(e), t);
return a.length > 1 && a[1].trim() && (c.diff = n(a[1])), c;
});
return {
all: i,
latest: i.length && i[0] || null,
total: i.length
};
};
}
var wt, Ct, St, Cn, Sn = p({
"src/lib/parsers/parse-list-log-summary.ts"() {
b(), Tn(), he(), wt = "òòòòòò ", Ct = " òò", St = " ò ", Cn = ["hash", "date", "message", "refs", "author_name", "author_email"];
}
}), Rn = {};
E(Rn, {
diffSummaryTask: () => ca,
validateLogFormatConfig: () => xe
});
function ca(e) {
let t = kt(e);
const r = ["diff"];
return t === "" && (t = "--stat", r.push("--stat=4096")), r.push(...e), xe(r) || {
commands: r,
format: "utf-8",
parser: _n(t)
};
}
function xe(e) {
const t = e.filter(aa);
if (t.length > 1)
return L(
`Summary flags are mutually exclusive - pick one of ${t.join(",")}`
);
if (t.length && e.includes("-z"))
return L(
`Summary flag ${t} parsing is not compatible with null termination option '-z'`
);
}
var Rt = p({
"src/lib/tasks/diff.ts"() {
he(), Tn(), R();
}
});
function la(e, t) {
const r = [], n = [];
return Object.keys(e).forEach((s) => {
r.push(s), n.push(String(e[s]));
}), [r, n.join(t)];
}
function fa(e) {
return Object.keys(e).reduce((t, r) => (r in nt || (t[r] = e[r]), t), {});
}
function En(e = {}, t = []) {
const r = G(e.splitter, F, St), n = Ee(e.format) ? e.format : {
hash: "%H",
date: e.strictDate === !1 ? "%ai" : "%aI",
message: "%s",
refs: "%D",
body: e.multiLine ? "%B" : "%b",
author_name: e.mailMap !== !1 ? "%aN" : "%an",
author_email: e.mailMap !== !1 ? "%aE" : "%ae"
}, [s, i] = la(n, r), u = [], a = [
`--pretty=format:${wt}${i}${Ct}`,
...t
], c = e.n || e["max-count"] || e.maxCount;
if (c && a.push(`--max-count=${c}`), e.from || e.to) {
const m = e.symmetric !== !1 ? "..." : "..";
u.push(`${e.from || ""}${m}${e.to || ""}`);
}
return F(e.file) && a.push("--follow", Zs(e.file)), ht(fa(e), a), {
fields: s,
splitter: r,
commands: [...a, ...u]
};
}
function ha(e, t, r) {
const n = wn(e, t, kt(r));
return {
commands: ["log", ...r],
format: "utf-8",
parser: n
};
}
function pa() {
return {
log(...r) {
const n = S(arguments), s = En(
pt(arguments),
G(arguments[0], fe)
), i = t(...r) || xe(s.commands) || e(s);
return this._runTask(i, n);
}
};
function e(r) {
return ha(r.splitter, r.fields, r.commands);
}
function t(r, n) {
return F(r) && F(n) && L(
"git.log(string, string) should be replaced with git.log({ from: string, to: string })"
);
}
}
var nt, On = p({
"src/lib/tasks/log.ts"() {
he(), ue(), Sn(), b(), R(), Rt(), nt = /* @__PURE__ */ ((e) => (e[e["--pretty"] = 0] = "--pretty", e[e["max-count"] = 1] = "max-count", e[e.maxCount = 2] = "maxCount", e[e.n = 3] = "n", e[e.file = 4] = "file", e[e.format = 5] = "format", e[e.from = 6] = "from", e[e.to = 7] = "to", e[e.splitter = 8] = "splitter", e[e.symmetric = 9] = "symmetric", e[e.mailMap = 10] = "mailMap", e[e.multiLine = 11] = "multiLine", e[e.strictDate = 12] = "st