gitea push
This commit is contained in:
+126
-134
@@ -1,75 +1,75 @@
|
||||
import { createRequire as e } from "node:module";
|
||||
import { spawn as t, spawnSync as n } from "node:child_process";
|
||||
import { delimiter as r, dirname as i, normalize as a, resolve as o } from "node:path";
|
||||
import { cwd as s } from "node:process";
|
||||
import { pipeline as c } from "node:stream/promises";
|
||||
import { PassThrough as l } from "node:stream";
|
||||
import u from "node:readline";
|
||||
import { cwd as r } from "node:process";
|
||||
import { delimiter as i, dirname as a, resolve as o } from "node:path";
|
||||
import { pipeline as s } from "node:stream/promises";
|
||||
import { PassThrough as c } from "node:stream";
|
||||
import l from "node:readline";
|
||||
//#region \0rolldown/runtime.js
|
||||
var d = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports);
|
||||
var f = /* @__PURE__ */ e(import.meta.url);
|
||||
var u = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports);
|
||||
var d = /* @__PURE__ */ e(import.meta.url);
|
||||
//#endregion
|
||||
//#region src/env.ts
|
||||
const p = /^path$/i;
|
||||
const m = {
|
||||
const f = /^path$/i;
|
||||
const p = {
|
||||
key: "PATH",
|
||||
value: ""
|
||||
};
|
||||
function h(e) {
|
||||
function m(e) {
|
||||
for (const t in e) {
|
||||
if (!Object.prototype.hasOwnProperty.call(e, t) || !p.test(t)) continue;
|
||||
if (!Object.prototype.hasOwnProperty.call(e, t) || !f.test(t)) continue;
|
||||
const n = e[t];
|
||||
if (!n) return m;
|
||||
if (!n) return p;
|
||||
return {
|
||||
key: t,
|
||||
value: n
|
||||
};
|
||||
}
|
||||
return m;
|
||||
return p;
|
||||
}
|
||||
function g(e, t) {
|
||||
const n = t.value.split(r);
|
||||
const a = [];
|
||||
function h(e, t) {
|
||||
const n = t.value.split(i);
|
||||
const r = [];
|
||||
let s = e;
|
||||
let c;
|
||||
do {
|
||||
a.push(o(s, "node_modules", ".bin"));
|
||||
r.push(o(s, "node_modules", ".bin"));
|
||||
c = s;
|
||||
s = i(s);
|
||||
s = a(s);
|
||||
} while (s !== c);
|
||||
a.push(i(process.execPath));
|
||||
const l = a.concat(n).join(r);
|
||||
r.push(a(process.execPath));
|
||||
const l = r.concat(n).join(i);
|
||||
return {
|
||||
key: t.key,
|
||||
value: l
|
||||
};
|
||||
}
|
||||
function _(e, t) {
|
||||
function g(e, t) {
|
||||
const n = {
|
||||
...process.env,
|
||||
...t
|
||||
};
|
||||
const r = g(e, h(n));
|
||||
const r = h(e, m(n));
|
||||
n[r.key] = r.value;
|
||||
return n;
|
||||
}
|
||||
//#endregion
|
||||
//#region src/stream.ts
|
||||
const v = (e) => {
|
||||
const _ = (e) => {
|
||||
let t = e.length;
|
||||
const n = new l();
|
||||
const n = new c();
|
||||
const r = () => {
|
||||
if (--t === 0) n.end();
|
||||
};
|
||||
for (const t of e) c(t, n, { end: false }).then(r).catch(r);
|
||||
for (const t of e) s(t, n, { end: false }).then(r).catch(r);
|
||||
return n;
|
||||
};
|
||||
//#endregion
|
||||
//#region node_modules/isexe/windows.js
|
||||
var y = /* @__PURE__ */ d(((e, t) => {
|
||||
var v = /* @__PURE__ */ u(((e, t) => {
|
||||
t.exports = a;
|
||||
a.sync = o;
|
||||
var n = f("fs");
|
||||
var n = d("fs");
|
||||
function r(e, t) {
|
||||
var n = t.pathExt !== void 0 ? t.pathExt : process.env.PATHEXT;
|
||||
if (!n) return true;
|
||||
@@ -96,10 +96,10 @@ var y = /* @__PURE__ */ d(((e, t) => {
|
||||
}));
|
||||
//#endregion
|
||||
//#region node_modules/isexe/mode.js
|
||||
var b = /* @__PURE__ */ d(((e, t) => {
|
||||
var y = /* @__PURE__ */ u(((e, t) => {
|
||||
t.exports = r;
|
||||
r.sync = i;
|
||||
var n = f("fs");
|
||||
var n = d("fs");
|
||||
function r(e, t, r) {
|
||||
n.stat(e, function(e, n) {
|
||||
r(e, e ? false : a(n, t));
|
||||
@@ -126,11 +126,11 @@ var b = /* @__PURE__ */ d(((e, t) => {
|
||||
}));
|
||||
//#endregion
|
||||
//#region node_modules/isexe/index.js
|
||||
var x = /* @__PURE__ */ d(((e, t) => {
|
||||
f("fs");
|
||||
var b = /* @__PURE__ */ u(((e, t) => {
|
||||
d("fs");
|
||||
var n;
|
||||
if (process.platform === "win32" || global.TESTING_WINDOWS) n = y();
|
||||
else n = b();
|
||||
if (process.platform === "win32" || global.TESTING_WINDOWS) n = v();
|
||||
else n = y();
|
||||
t.exports = r;
|
||||
r.sync = i;
|
||||
function r(e, t, i) {
|
||||
@@ -168,11 +168,11 @@ var x = /* @__PURE__ */ d(((e, t) => {
|
||||
}));
|
||||
//#endregion
|
||||
//#region node_modules/which/which.js
|
||||
var S = /* @__PURE__ */ d(((e, t) => {
|
||||
var x = /* @__PURE__ */ u(((e, t) => {
|
||||
const n = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
||||
const r = f("path");
|
||||
const r = d("path");
|
||||
const i = n ? ";" : ":";
|
||||
const a = x();
|
||||
const a = b();
|
||||
const o = (e) => Object.assign(/* @__PURE__ */ new Error(`not found: ${e}`), { code: "ENOENT" });
|
||||
const s = (e, t) => {
|
||||
const r = t.colon || i;
|
||||
@@ -240,7 +240,7 @@ var S = /* @__PURE__ */ d(((e, t) => {
|
||||
}));
|
||||
//#endregion
|
||||
//#region node_modules/path-key/index.js
|
||||
var C = /* @__PURE__ */ d(((e, t) => {
|
||||
var S = /* @__PURE__ */ u(((e, t) => {
|
||||
const n = (e = {}) => {
|
||||
const t = e.env || process.env;
|
||||
if ((e.platform || process.platform) !== "win32") return "PATH";
|
||||
@@ -251,10 +251,10 @@ var C = /* @__PURE__ */ d(((e, t) => {
|
||||
}));
|
||||
//#endregion
|
||||
//#region node_modules/cross-spawn/lib/util/resolveCommand.js
|
||||
var w = /* @__PURE__ */ d(((e, t) => {
|
||||
const n = f("path");
|
||||
const r = S();
|
||||
const i = C();
|
||||
var C = /* @__PURE__ */ u(((e, t) => {
|
||||
const n = d("path");
|
||||
const r = x();
|
||||
const i = S();
|
||||
function a(e, t) {
|
||||
const a = e.options.env || process.env;
|
||||
const o = process.cwd();
|
||||
@@ -282,7 +282,7 @@ var w = /* @__PURE__ */ d(((e, t) => {
|
||||
}));
|
||||
//#endregion
|
||||
//#region node_modules/cross-spawn/lib/util/escape.js
|
||||
var T = /* @__PURE__ */ d(((e, t) => {
|
||||
var w = /* @__PURE__ */ u(((e, t) => {
|
||||
const n = /([()\][%!^"`<>&|;, *?])/g;
|
||||
function r(e) {
|
||||
e = e.replace(n, "^$1");
|
||||
@@ -302,13 +302,13 @@ var T = /* @__PURE__ */ d(((e, t) => {
|
||||
}));
|
||||
//#endregion
|
||||
//#region node_modules/shebang-regex/index.js
|
||||
var E = /* @__PURE__ */ d(((e, t) => {
|
||||
var T = /* @__PURE__ */ u(((e, t) => {
|
||||
t.exports = /^#!(.*)/;
|
||||
}));
|
||||
//#endregion
|
||||
//#region node_modules/shebang-command/index.js
|
||||
var D = /* @__PURE__ */ d(((e, t) => {
|
||||
const n = E();
|
||||
var E = /* @__PURE__ */ u(((e, t) => {
|
||||
const n = T();
|
||||
t.exports = (e = "") => {
|
||||
const t = e.match(n);
|
||||
if (!t) return null;
|
||||
@@ -320,9 +320,9 @@ var D = /* @__PURE__ */ d(((e, t) => {
|
||||
}));
|
||||
//#endregion
|
||||
//#region node_modules/cross-spawn/lib/util/readShebang.js
|
||||
var O = /* @__PURE__ */ d(((e, t) => {
|
||||
const n = f("fs");
|
||||
const r = D();
|
||||
var D = /* @__PURE__ */ u(((e, t) => {
|
||||
const n = d("fs");
|
||||
const r = E();
|
||||
function i(e) {
|
||||
const t = 150;
|
||||
const i = Buffer.alloc(t);
|
||||
@@ -338,11 +338,11 @@ var O = /* @__PURE__ */ d(((e, t) => {
|
||||
}));
|
||||
//#endregion
|
||||
//#region node_modules/cross-spawn/lib/parse.js
|
||||
var k = /* @__PURE__ */ d(((e, t) => {
|
||||
const n = f("path");
|
||||
const r = w();
|
||||
const i = T();
|
||||
const a = O();
|
||||
var O = /* @__PURE__ */ u(((e, t) => {
|
||||
const n = d("path");
|
||||
const r = C();
|
||||
const i = w();
|
||||
const a = D();
|
||||
const o = process.platform === "win32";
|
||||
const s = /\.(?:com|exe)$/i;
|
||||
const c = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
||||
@@ -376,7 +376,7 @@ var k = /* @__PURE__ */ d(((e, t) => {
|
||||
}
|
||||
return e;
|
||||
}
|
||||
function d(e, t, n) {
|
||||
function f(e, t, n) {
|
||||
if (t && !Array.isArray(t)) {
|
||||
n = t;
|
||||
t = null;
|
||||
@@ -395,11 +395,11 @@ var k = /* @__PURE__ */ d(((e, t) => {
|
||||
};
|
||||
return n.shell ? r : u(r);
|
||||
}
|
||||
t.exports = d;
|
||||
t.exports = f;
|
||||
}));
|
||||
//#endregion
|
||||
//#region node_modules/cross-spawn/lib/enoent.js
|
||||
var A = /* @__PURE__ */ d(((e, t) => {
|
||||
var k = /* @__PURE__ */ u(((e, t) => {
|
||||
const n = process.platform === "win32";
|
||||
function r(e, t) {
|
||||
return Object.assign(/* @__PURE__ */ new Error(`${t} ${e.command} ENOENT`), {
|
||||
@@ -438,10 +438,10 @@ var A = /* @__PURE__ */ d(((e, t) => {
|
||||
}));
|
||||
//#endregion
|
||||
//#region node_modules/cross-spawn/index.js
|
||||
var j = /* @__PURE__ */ d(((e, t) => {
|
||||
const n = f("child_process");
|
||||
const r = k();
|
||||
const i = A();
|
||||
var A = /* @__PURE__ */ u(((e, t) => {
|
||||
const n = d("child_process");
|
||||
const r = O();
|
||||
const i = k();
|
||||
function a(e, t, a) {
|
||||
const o = r(e, t, a);
|
||||
const s = n.spawn(o.command, o.args, o.options);
|
||||
@@ -462,8 +462,8 @@ var j = /* @__PURE__ */ d(((e, t) => {
|
||||
}));
|
||||
//#endregion
|
||||
//#region src/non-zero-exit-error.ts
|
||||
var M = j();
|
||||
var N = class extends Error {
|
||||
var j = A();
|
||||
var M = class extends Error {
|
||||
get exitCode() {
|
||||
if (this.result.exitCode !== null) return this.result.exitCode;
|
||||
}
|
||||
@@ -475,20 +475,14 @@ var N = class extends Error {
|
||||
};
|
||||
//#endregion
|
||||
//#region src/main.ts
|
||||
const P = /\r?\n/;
|
||||
const F = {
|
||||
const N = /\r?\n/;
|
||||
const P = {
|
||||
timeout: void 0,
|
||||
persist: false
|
||||
};
|
||||
const I = { timeout: void 0 };
|
||||
const L = { windowsHide: true };
|
||||
function R(e, t) {
|
||||
return {
|
||||
command: a(e),
|
||||
args: t ?? []
|
||||
};
|
||||
}
|
||||
function z(e) {
|
||||
const F = { timeout: void 0 };
|
||||
const I = { windowsHide: true };
|
||||
function L(e) {
|
||||
const t = new AbortController();
|
||||
for (const n of e) {
|
||||
if (n.aborted) {
|
||||
@@ -502,14 +496,14 @@ function z(e) {
|
||||
}
|
||||
return t.signal;
|
||||
}
|
||||
async function B(e) {
|
||||
async function R(e) {
|
||||
let t = "";
|
||||
try {
|
||||
for await (const n of e) t += n.toString();
|
||||
} catch {}
|
||||
return t;
|
||||
}
|
||||
var V = class {
|
||||
var z = class {
|
||||
_process;
|
||||
_aborted = false;
|
||||
_options;
|
||||
@@ -529,7 +523,7 @@ var V = class {
|
||||
}
|
||||
constructor(e, t, n) {
|
||||
this._options = {
|
||||
...F,
|
||||
...P,
|
||||
...n
|
||||
};
|
||||
this._command = e;
|
||||
@@ -548,7 +542,7 @@ var V = class {
|
||||
return this._process?.killed === true;
|
||||
}
|
||||
pipe(e, t, n) {
|
||||
return W(e, t, {
|
||||
return H(e, t, {
|
||||
...n,
|
||||
stdin: this
|
||||
});
|
||||
@@ -559,18 +553,18 @@ var V = class {
|
||||
const t = [];
|
||||
if (this._streamErr) t.push(this._streamErr);
|
||||
if (this._streamOut) t.push(this._streamOut);
|
||||
const n = v(t);
|
||||
const r = u.createInterface({ input: n });
|
||||
const n = _(t);
|
||||
const r = l.createInterface({ input: n });
|
||||
for await (const e of r) yield e.toString();
|
||||
await this._processClosed;
|
||||
e.removeAllListeners();
|
||||
if (this._thrownError) throw this._thrownError;
|
||||
if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new N(this);
|
||||
if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new M(this);
|
||||
}
|
||||
async _waitForOutput() {
|
||||
const e = this._process;
|
||||
if (!e) throw new Error("No process was started");
|
||||
const [t, n] = await Promise.all([this._streamOut ? B(this._streamOut) : "", this._streamErr ? B(this._streamErr) : ""]);
|
||||
const [t, n] = await Promise.all([this._streamOut ? R(this._streamOut) : "", this._streamErr ? R(this._streamErr) : ""]);
|
||||
await this._processClosed;
|
||||
const { stdin: r } = this._options;
|
||||
if (r && typeof r !== "string") await r;
|
||||
@@ -581,7 +575,7 @@ var V = class {
|
||||
stdout: t,
|
||||
exitCode: this.exitCode
|
||||
};
|
||||
if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new N(this, i);
|
||||
if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new M(this, i);
|
||||
return i;
|
||||
}
|
||||
then(e, t) {
|
||||
@@ -590,31 +584,30 @@ var V = class {
|
||||
_streamOut;
|
||||
_streamErr;
|
||||
spawn() {
|
||||
const e = s();
|
||||
const e = r();
|
||||
const n = this._options;
|
||||
const r = {
|
||||
...L,
|
||||
const i = {
|
||||
...I,
|
||||
...n.nodeOptions
|
||||
};
|
||||
const i = [];
|
||||
const a = [];
|
||||
this._resetState();
|
||||
if (n.timeout !== void 0) i.push(AbortSignal.timeout(n.timeout));
|
||||
if (n.signal !== void 0) i.push(n.signal);
|
||||
if (n.persist === true) r.detached = true;
|
||||
if (i.length > 0) r.signal = z(i);
|
||||
r.env = _(e, r.env);
|
||||
const { command: a, args: o } = R(this._command, this._args);
|
||||
const c = (0, M._parse)(a, o, r);
|
||||
const l = t(c.command, c.args, c.options);
|
||||
if (l.stderr) this._streamErr = l.stderr;
|
||||
if (l.stdout) this._streamOut = l.stdout;
|
||||
this._process = l;
|
||||
l.once("error", this._onError);
|
||||
l.once("close", this._onClose);
|
||||
if (l.stdin) {
|
||||
if (n.timeout !== void 0) a.push(AbortSignal.timeout(n.timeout));
|
||||
if (n.signal !== void 0) a.push(n.signal);
|
||||
if (n.persist === true) i.detached = true;
|
||||
if (a.length > 0) i.signal = L(a);
|
||||
i.env = g(e, i.env);
|
||||
const o = (0, j._parse)(this._command, this._args, i);
|
||||
const s = t(o.command, o.args, o.options);
|
||||
if (s.stderr) this._streamErr = s.stderr;
|
||||
if (s.stdout) this._streamOut = s.stdout;
|
||||
this._process = s;
|
||||
s.once("error", this._onError);
|
||||
s.once("close", this._onClose);
|
||||
if (s.stdin) {
|
||||
const { stdin: e } = n;
|
||||
if (typeof e === "string") l.stdin.end(e);
|
||||
else e?.process?.stdout?.pipe(l.stdin);
|
||||
if (typeof e === "string") s.stdin.end(e);
|
||||
else e?.process?.stdout?.pipe(s.stdin);
|
||||
}
|
||||
}
|
||||
_resetState() {
|
||||
@@ -635,56 +628,55 @@ var V = class {
|
||||
if (this._resolveClose) this._resolveClose();
|
||||
};
|
||||
};
|
||||
function H(e, t, r) {
|
||||
const i = {
|
||||
...I,
|
||||
...r
|
||||
function B(e, t, i) {
|
||||
const a = {
|
||||
...F,
|
||||
...i
|
||||
};
|
||||
const a = s();
|
||||
const o = {
|
||||
const o = r();
|
||||
const s = {
|
||||
windowsHide: true,
|
||||
...i.nodeOptions
|
||||
...a.nodeOptions
|
||||
};
|
||||
if (i.timeout !== void 0) o.timeout = i.timeout;
|
||||
o.env = _(a, o.env);
|
||||
const { command: c, args: l } = R(e, t);
|
||||
const u = (0, M._parse)(c, l, o);
|
||||
const d = n(u.command, u.args, u.options);
|
||||
if (d.error) throw d.error;
|
||||
const f = d.stdout?.toString() ?? "";
|
||||
const p = d.stderr?.toString() ?? "";
|
||||
const m = d.status ?? void 0;
|
||||
const h = d.signal != null;
|
||||
const g = {
|
||||
stdout: f,
|
||||
stderr: p,
|
||||
if (a.timeout !== void 0) s.timeout = a.timeout;
|
||||
s.env = g(o, s.env);
|
||||
const c = (0, j._parse)(e, t ?? [], s);
|
||||
const l = n(c.command, c.args, c.options);
|
||||
if (l.error) throw l.error;
|
||||
const u = l.stdout?.toString() ?? "";
|
||||
const d = l.stderr?.toString() ?? "";
|
||||
const f = l.status ?? void 0;
|
||||
const p = l.signal != null;
|
||||
const m = {
|
||||
stdout: u,
|
||||
stderr: d,
|
||||
get exitCode() {
|
||||
return m;
|
||||
return f;
|
||||
},
|
||||
get pid() {
|
||||
return d.pid;
|
||||
return l.pid;
|
||||
},
|
||||
get killed() {
|
||||
return h;
|
||||
return p;
|
||||
},
|
||||
*[Symbol.iterator]() {
|
||||
for (const e of [f, p]) {
|
||||
for (const e of [u, d]) {
|
||||
if (!e) continue;
|
||||
const t = e.split(P);
|
||||
const t = e.split(N);
|
||||
if (t[t.length - 1] === "") t.pop();
|
||||
yield* t;
|
||||
}
|
||||
}
|
||||
};
|
||||
if (i.throwOnError && m !== 0 && m !== void 0) throw new N(g, g);
|
||||
return g;
|
||||
if (a.throwOnError && f !== 0 && f !== void 0) throw new M(m, m);
|
||||
return m;
|
||||
}
|
||||
const U = (e, t, n) => {
|
||||
const r = new V(e, t, n);
|
||||
const V = (e, t, n) => {
|
||||
const r = new z(e, t, n);
|
||||
r.spawn();
|
||||
return r;
|
||||
};
|
||||
const W = U;
|
||||
const G = H;
|
||||
const H = V;
|
||||
const U = B;
|
||||
//#endregion
|
||||
export { V as ExecProcess, N as NonZeroExitError, W as exec, G as execSync, U as x, H as xSync };
|
||||
export { z as ExecProcess, M as NonZeroExitError, H as exec, U as execSync, V as x, B as xSync };
|
||||
|
||||
Reference in New Issue
Block a user