brsh 3.10.2 → 3.10.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/CHANGELOG.md +7 -0
- package/dist/shell.es.js +604 -535
- package/dist/shell.es.js.map +1 -1
- package/dist/shell.min.js +15 -14
- package/dist/shell.min.js.map +1 -1
- package/dist/wbt.es.js +150 -80
- package/dist/wbt.es.js.map +1 -1
- package/dist/wbt.min.js +10 -10
- package/dist/wbt.min.js.map +1 -1
- package/index.js +21 -4
- package/lib/Command.js +3 -2
- package/lib/ScriptCommand.js +28 -10
- package/lib/WasmCommand.js +79 -12
- package/lib/wbt/index.js +22 -4
- package/package.json +1 -1
- package/test/devices-signals.test.js +194 -0
- package/test/doom.test.js +62 -3
- package/test/fixtures/nano.wasm +0 -0
- package/test/wbt.test.js +41 -0
package/dist/wbt.es.js
CHANGED
|
@@ -1440,11 +1440,12 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
1440
1440
|
if (!this.captureInput) return;
|
|
1441
1441
|
let t = a(e);
|
|
1442
1442
|
for (let e of t) {
|
|
1443
|
-
|
|
1443
|
+
let t = !!(this.isRaw || this.stdinStream && this.stdinStream.isRaw);
|
|
1444
|
+
if (e === "^C" && !t) {
|
|
1444
1445
|
this.kill("SIGINT");
|
|
1445
1446
|
return;
|
|
1446
1447
|
}
|
|
1447
|
-
!this.interactive && !
|
|
1448
|
+
!this.interactive && !t && (e === "Enter" ? this.stdout.write("\r\n") : e === "Backspace" ? this.stdout.write("\b \b") : e.length === 1 && this.stdout.write(e)), this.onInput(e);
|
|
1448
1449
|
}
|
|
1449
1450
|
}, this.stdinStream.on("data", this._onStdinStreamData);
|
|
1450
1451
|
}
|
|
@@ -1502,6 +1503,7 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
1502
1503
|
}
|
|
1503
1504
|
};
|
|
1504
1505
|
})), re = /* @__PURE__ */ t(((e, t) => {
|
|
1506
|
+
b();
|
|
1505
1507
|
var n = ne(), { parseVtKeys: r, hasCustomStdinListener: i } = te();
|
|
1506
1508
|
function a(e) {
|
|
1507
1509
|
return /^#!\/(sh\.js|bin\/(sh|brsh))/.test(e);
|
|
@@ -1519,7 +1521,11 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
1519
1521
|
return !!(this.sandbox && this.sandbox.runningCommand && this.sandbox.runningCommand.interactive);
|
|
1520
1522
|
}
|
|
1521
1523
|
get isRaw() {
|
|
1522
|
-
|
|
1524
|
+
if (this.sandbox && this.sandbox.runningCommand) {
|
|
1525
|
+
let e = this.sandbox.runningCommand;
|
|
1526
|
+
return !!(e.isRaw || e.stdinStream && e.stdinStream.isRaw);
|
|
1527
|
+
}
|
|
1528
|
+
return !!(this.stdinStream && this.stdinStream.isRaw);
|
|
1523
1529
|
}
|
|
1524
1530
|
get _inAltScreen() {
|
|
1525
1531
|
return !!(this.__inAltScreen || this.sandbox && this.sandbox.runningCommand && this.sandbox.runningCommand._inAltScreen);
|
|
@@ -1528,10 +1534,14 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
1528
1534
|
this.__inAltScreen = !!e;
|
|
1529
1535
|
}
|
|
1530
1536
|
onInput(e) {
|
|
1537
|
+
if ((e === "^C" || e === "") && !this.isRaw) {
|
|
1538
|
+
this.kill("SIGINT");
|
|
1539
|
+
return;
|
|
1540
|
+
}
|
|
1531
1541
|
this.sandbox && this.sandbox.onInput(e);
|
|
1532
1542
|
}
|
|
1533
1543
|
kill(e = "SIGINT") {
|
|
1534
|
-
this.sandbox && this.sandbox.runningCommand && typeof this.sandbox.runningCommand.kill == "function" && this.sandbox.runningCommand.kill(e), this.sandbox && typeof this.sandbox.destroy == "function" && this.sandbox.destroy(130), super.kill(e);
|
|
1544
|
+
this._killed = !0, this.sandbox && this.sandbox.runningCommand && typeof this.sandbox.runningCommand.kill == "function" && this.sandbox.runningCommand.kill(e), this.sandbox && typeof this.sandbox.destroy == "function" && this.sandbox.destroy(130), super.kill(e);
|
|
1535
1545
|
}
|
|
1536
1546
|
run() {
|
|
1537
1547
|
this._managesOwnStdinCapture = !0;
|
|
@@ -1548,20 +1558,22 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
1548
1558
|
typeof this.sandbox.setTerminalSize == "function" && this.sandbox.setTerminalSize(o, s), Array.isArray(this.arguments) && (this.arguments.forEach((e, t) => this.sandbox.context.setVar(String(t + 1), e)), this.sandbox.context.setVar("#", String(this.arguments.length)), this.sandbox.context.setVar("@", this.arguments.join(" ")), this.sandbox.context.setVar("*", this.arguments.join(" "))), this._onStdinStreamData && this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("data", this._onStdinStreamData);
|
|
1549
1559
|
let c = (e) => {
|
|
1550
1560
|
if (!this.sandbox || !this.sandbox.runningCommand) return;
|
|
1551
|
-
let t = this.sandbox.runningCommand, n =
|
|
1552
|
-
if (
|
|
1561
|
+
let t = this.sandbox.runningCommand, n = !!(t.isRaw || t.stdinStream && t.stdinStream.isRaw);
|
|
1562
|
+
if ((typeof e == "string" && e === "" || e instanceof Uint8Array && e.length === 1 && e[0] === 3 || y !== void 0 && y.isBuffer(e) && e.length === 1 && e[0] === 3) && !n) {
|
|
1563
|
+
this.kill("SIGINT");
|
|
1564
|
+
return;
|
|
1565
|
+
}
|
|
1566
|
+
let a = i(t);
|
|
1567
|
+
if (t.interactive || t._inAltScreen || a) {
|
|
1553
1568
|
t.stdinStream && t.stdinStream.pushData(e);
|
|
1554
1569
|
return;
|
|
1555
1570
|
}
|
|
1556
|
-
if (t.captureInput && typeof t.onInput == "function") {
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
this.kill("SIGINT");
|
|
1561
|
-
return;
|
|
1562
|
-
}
|
|
1563
|
-
n || (i === "Enter" ? this.stdout.write("\r\n") : i === "Backspace" ? this.stdout.write("\b \b") : i.length === 1 && this.stdout.write(i)), t.onInput(i);
|
|
1571
|
+
if (t.captureInput && typeof t.onInput == "function") for (let i of r(e)) {
|
|
1572
|
+
if (i === "^C" && !n) {
|
|
1573
|
+
this.kill("SIGINT");
|
|
1574
|
+
return;
|
|
1564
1575
|
}
|
|
1576
|
+
n || (i === "Enter" ? this.stdout.write("\r\n") : i === "Backspace" ? this.stdout.write("\b \b") : i.length === 1 && this.stdout.write(i)), t.onInput(i);
|
|
1565
1577
|
}
|
|
1566
1578
|
}, l = () => {
|
|
1567
1579
|
this.sandbox && typeof this.sandbox.setTerminalSize == "function" && this.stdinStream && this.sandbox.setTerminalSize(this.stdinStream.columns, this.stdinStream.rows);
|
|
@@ -1741,9 +1753,13 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
1741
1753
|
};
|
|
1742
1754
|
}
|
|
1743
1755
|
async _executeNodes(e) {
|
|
1744
|
-
for (let t of e)
|
|
1756
|
+
for (let t of e) {
|
|
1757
|
+
if (this._killed || this.sandbox && this.sandbox.destroyed) break;
|
|
1758
|
+
await this._executeNode(t);
|
|
1759
|
+
}
|
|
1745
1760
|
}
|
|
1746
1761
|
_executeNode(e) {
|
|
1762
|
+
if (this._killed || this.sandbox && this.sandbox.destroyed) return Promise.resolve();
|
|
1747
1763
|
if (e.type === "function") {
|
|
1748
1764
|
let t = e.name, n = e.bodyLines, r = this, i = ne(), a = class extends i {
|
|
1749
1765
|
static get name() {
|
|
@@ -1813,11 +1829,14 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
1813
1829
|
return e.type === "if" ? this._executeIf(e) : e.type === "while" ? this._executeWhile(e) : e.type === "for" ? this._executeFor(e) : e.type === "case" ? this._executeCase(e) : Promise.resolve();
|
|
1814
1830
|
}
|
|
1815
1831
|
async _executeIf(e) {
|
|
1816
|
-
for (let t of e.clauses)
|
|
1817
|
-
|
|
1832
|
+
for (let t of e.clauses) {
|
|
1833
|
+
if (this._killed || this.sandbox && this.sandbox.destroyed || (await this.sandbox.onCommand(t.condition, !1), this._killed || this.sandbox && this.sandbox.destroyed)) return;
|
|
1834
|
+
if (this.sandbox.lastCode === 0) return this._executeNodes(this._parseLines(t.bodyLines));
|
|
1835
|
+
}
|
|
1836
|
+
if (e.elseLines.length > 0 && !this._killed && !(this.sandbox && this.sandbox.destroyed)) return this._executeNodes(this._parseLines(e.elseLines));
|
|
1818
1837
|
}
|
|
1819
1838
|
async _executeWhile(e) {
|
|
1820
|
-
for (; await this.sandbox.onCommand(e.condition, !1), this.sandbox.lastCode
|
|
1839
|
+
for (; !this._killed && !(this.sandbox && this.sandbox.destroyed) && (await this.sandbox.onCommand(e.condition, !1), !(this._killed || this.sandbox && this.sandbox.destroyed || this.sandbox.lastCode !== 0));) try {
|
|
1821
1840
|
await this._executeNodes(this._parseLines(e.bodyLines));
|
|
1822
1841
|
} catch (e) {
|
|
1823
1842
|
if (e && e.__type === "break") {
|
|
@@ -1845,6 +1864,7 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
1845
1864
|
for (let n = 1; n <= e; n++) t.push(this.sandbox.context.getVar(String(n)) || "");
|
|
1846
1865
|
} else t = (await this.sandbox._replaceVariables(e.list)).split(/\s+/).filter(Boolean);
|
|
1847
1866
|
for (let n of t) {
|
|
1867
|
+
if (this._killed || this.sandbox && this.sandbox.destroyed) break;
|
|
1848
1868
|
this.sandbox.context.setVar(e.variable, n);
|
|
1849
1869
|
try {
|
|
1850
1870
|
await this._executeNodes(this._parseLines(e.bodyLines));
|
|
@@ -2986,14 +3006,14 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
2986
3006
|
t.exports = null;
|
|
2987
3007
|
})), X = /* @__PURE__ */ t(((e, t) => {
|
|
2988
3008
|
b();
|
|
2989
|
-
var n = re(), { BinaryFile: r } = J(), i = 0, a = 6, o = 8, s = 20, c = 27, l = 28, u = 31, d = 44, f = 54, p = 70, m = 0, h = 2, g = 3, _ = 4, v = 1, x = 2, S = 4, C = 8, w = 1, T = 4, E = class extends n {
|
|
3009
|
+
var n = re(), { BinaryFile: r } = J(), i = 0, a = 6, o = 8, s = 20, c = 27, l = 28, u = 31, d = 44, f = 54, p = 70, m = 0, h = 2, g = 3, _ = 4, v = 1, x = 2, S = 4, C = 8, w = 1, T = 4, E = 1, D = class extends n {
|
|
2990
3010
|
constructor(e, t, n) {
|
|
2991
3011
|
super(e, t, n), this._ensurePkgMeta();
|
|
2992
3012
|
}
|
|
2993
3013
|
_ensurePkgMeta() {
|
|
2994
3014
|
if (this._pkgMeta === void 0 && this.script) {
|
|
2995
3015
|
let e = this.context && this.context.fs || this.fs;
|
|
2996
|
-
e && (this._pkgMeta =
|
|
3016
|
+
e && (this._pkgMeta = L(e, this.script));
|
|
2997
3017
|
}
|
|
2998
3018
|
return this._pkgMeta || null;
|
|
2999
3019
|
}
|
|
@@ -3013,6 +3033,32 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
3013
3033
|
get captureInput() {
|
|
3014
3034
|
return this.interactive;
|
|
3015
3035
|
}
|
|
3036
|
+
get isRaw() {
|
|
3037
|
+
if (typeof this._getTermiosLflag == "function") try {
|
|
3038
|
+
let e = (this._getTermiosLflag() >>> 0 & E) == 0;
|
|
3039
|
+
return this._inAltScreen && this.stdinStream && typeof this.stdinStream.setRawMode == "function" && this.stdinStream.isRaw !== e && this.stdinStream.setRawMode(e), e;
|
|
3040
|
+
} catch {}
|
|
3041
|
+
let e = this._ensurePkgMeta();
|
|
3042
|
+
return e && (e.raw !== void 0 || e.wasm?.raw !== void 0) ? !!(e.raw ?? e.wasm?.raw) : !!(this.stdinStream && this.stdinStream.isRaw);
|
|
3043
|
+
}
|
|
3044
|
+
_syncRawMode() {
|
|
3045
|
+
if (!this.stdinStream || typeof this.stdinStream.setRawMode != "function") return;
|
|
3046
|
+
if (!this._inAltScreen && !this._isInteractive) {
|
|
3047
|
+
this.stdinStream.isRaw && this.stdinStream.setRawMode(!1);
|
|
3048
|
+
return;
|
|
3049
|
+
}
|
|
3050
|
+
if (typeof this._getTermiosLflag == "function") try {
|
|
3051
|
+
let e = (this._getTermiosLflag() >>> 0 & E) == 0;
|
|
3052
|
+
this.stdinStream.setRawMode(e);
|
|
3053
|
+
return;
|
|
3054
|
+
} catch {}
|
|
3055
|
+
let e = this._ensurePkgMeta();
|
|
3056
|
+
if (e && (e.raw !== void 0 || e.wasm?.raw !== void 0)) {
|
|
3057
|
+
this.stdinStream.setRawMode(!!(e.raw ?? e.wasm?.raw));
|
|
3058
|
+
return;
|
|
3059
|
+
}
|
|
3060
|
+
this.stdinStream.setRawMode(!1);
|
|
3061
|
+
}
|
|
3016
3062
|
kill(e = "SIGINT") {
|
|
3017
3063
|
if (this._killed = !0, this.exitCode = 130, this._exitAltScreen(), this._asyncifyReject) {
|
|
3018
3064
|
try {
|
|
@@ -3030,7 +3076,7 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
3030
3076
|
super.kill(e);
|
|
3031
3077
|
}
|
|
3032
3078
|
_enterAltScreen() {
|
|
3033
|
-
this._inAltScreen || (this._inAltScreen = !0, this.
|
|
3079
|
+
this._inAltScreen || (this._inAltScreen = !0, this._syncRawMode(), this.stdout && typeof this.stdout.write == "function" && this.stdout.write("\x1B[?1049h\x1B[2J\x1B[H"));
|
|
3034
3080
|
}
|
|
3035
3081
|
_exitAltScreen() {
|
|
3036
3082
|
this._inAltScreen && (this._inAltScreen = !1, this.stdinStream && typeof this.stdinStream.setRawMode == "function" && this.stdinStream.setRawMode(!1), this.stdout && typeof this.stdout.write == "function" && this.stdout.write("\x1B[0m\x1B[?1l\x1B[?1000l\x1B[?1002l\x1B[?1003l\x1B[?1006l\x1B[?1049l\x1B[?25h"));
|
|
@@ -3142,7 +3188,7 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
3142
3188
|
isWat: this._isWat(e, i)
|
|
3143
3189
|
});
|
|
3144
3190
|
}
|
|
3145
|
-
return r.then((e) => (!e.isWat && e.bytes && (this._inspectedWasm =
|
|
3191
|
+
return r.then((e) => (!e.isWat && e.bytes && (this._inspectedWasm = N(e.bytes), this._inspectedWasm.isInteractive && (this._isInteractive = !0)), e));
|
|
3146
3192
|
}
|
|
3147
3193
|
_isWat(e, t) {
|
|
3148
3194
|
return e.endsWith(".wat") ? !0 : t.length > 0 && t[0] === 40;
|
|
@@ -3183,10 +3229,10 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
3183
3229
|
let t = {
|
|
3184
3230
|
1: "",
|
|
3185
3231
|
2: ""
|
|
3186
|
-
}, n = new TextDecoder(), b = new TextEncoder(), E = null, D = null, O = !1, k = 0, A = null, j = null,
|
|
3232
|
+
}, n = new TextDecoder(), b = new TextEncoder(), E = null, D = null, O = !1, k = 0, A = null, j = null, M = null, F = !1, I = !1, L = !1, ee = null, R = null, z = null, B = this.stdin === void 0 || this.stdin === null || this.stdin === this.stdinStream || this.stdin && this.stdin.isTTY, V = !!(this.interactive && B);
|
|
3187
3233
|
V && (this.emit("interactive"), this.context && typeof this.context.emit == "function" && this.context.emit("interactive"));
|
|
3188
3234
|
let H = () => {
|
|
3189
|
-
V || !B || (V = !0, this._isInteractive = !0, this.emit("interactive"), this.context && typeof this.context.emit == "function" && this.context.emit("interactive"), this._enterAltScreen(), t[1] &&= (this.stdout && typeof this.stdout.write == "function" && this.stdout.write(t[1]), ""), t[2] &&= (this.stderr && typeof this.stderr.write == "function" && this.stderr.write(t[2]), ""), this.
|
|
3235
|
+
V || !B || (V = !0, this._isInteractive = !0, this.emit("interactive"), this.context && typeof this.context.emit == "function" && this.context.emit("interactive"), this._enterAltScreen(), t[1] &&= (this.stdout && typeof this.stdout.write == "function" && this.stdout.write(t[1]), ""), t[2] &&= (this.stderr && typeof this.stderr.write == "function" && this.stderr.write(t[2]), ""), this._syncRawMode());
|
|
3190
3236
|
}, U = (e, n) => {
|
|
3191
3237
|
if (V && (e === 1 || e === 2)) {
|
|
3192
3238
|
if (e === 1 && this.stdout) {
|
|
@@ -3205,12 +3251,18 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
3205
3251
|
}, te = () => {
|
|
3206
3252
|
t[1] &&= (V && this.stdout ? this.stdout.write(t[1]) : this.stdOut = t[1], ""), t[2] &&= (V && this.stderr ? this.stderr.write(t[2]) : this.stdErr = t[2], "");
|
|
3207
3253
|
}, W = [], ne = (e) => {
|
|
3208
|
-
if (!
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3254
|
+
if (!e || e.length === 0) return;
|
|
3255
|
+
let t = this.isRaw;
|
|
3256
|
+
for (let n = 0; n < e.length; n++) {
|
|
3257
|
+
if (e[n] === 3 && !t) {
|
|
3258
|
+
this.kill("SIGINT");
|
|
3259
|
+
return;
|
|
3213
3260
|
}
|
|
3261
|
+
W.push(e[n]);
|
|
3262
|
+
}
|
|
3263
|
+
if (j) {
|
|
3264
|
+
let e = j;
|
|
3265
|
+
j = null, e();
|
|
3214
3266
|
}
|
|
3215
3267
|
};
|
|
3216
3268
|
z = (e) => {
|
|
@@ -3325,7 +3377,7 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
3325
3377
|
if (!E) return o;
|
|
3326
3378
|
let s = new DataView(E.buffer), l = Y.get(e), u = !!(l && l.type === "dev_tty");
|
|
3327
3379
|
if (e === 0 || V && e === 2 || u) {
|
|
3328
|
-
(u || e === 2) && H();
|
|
3380
|
+
(u || e === 2) && H(), this._syncRawMode();
|
|
3329
3381
|
let o = !!((X.get(e) || 0) & T);
|
|
3330
3382
|
if (O) {
|
|
3331
3383
|
if ((typeof D?.exports?.asyncify_get_state == "function" ? D.exports.asyncify_get_state() : 0) === 2) {
|
|
@@ -3348,10 +3400,10 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
3348
3400
|
}
|
|
3349
3401
|
return o ? (s.setUint32(r, 0, !0), a) : (L = !1, D.exports.asyncify_start_unwind(k), A = new Promise((e, t) => {
|
|
3350
3402
|
let n = () => {
|
|
3351
|
-
L = !1, j = null,
|
|
3403
|
+
L = !1, j = null, M = null, this._pendingReadResolve = null, this._asyncifyReject = null, e();
|
|
3352
3404
|
};
|
|
3353
|
-
j = n, this._pendingReadResolve = n,
|
|
3354
|
-
L = !0, j = null,
|
|
3405
|
+
j = n, this._pendingReadResolve = n, M = () => {
|
|
3406
|
+
L = !0, j = null, M = null, this._pendingReadResolve = null, this._asyncifyReject = null, e();
|
|
3355
3407
|
}, this._asyncifyReject = t;
|
|
3356
3408
|
}), s.setUint32(r, 0, !0), i);
|
|
3357
3409
|
}
|
|
@@ -3659,12 +3711,19 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
3659
3711
|
let e = BigInt(Date.now()) * 1000000n;
|
|
3660
3712
|
c = s > e ? Number((s - e) / 1000000n) : 0;
|
|
3661
3713
|
} else c = Number(s / 1000000n);
|
|
3662
|
-
return O && c > 0 ? (typeof D?.exports?.asyncify_get_state == "function" ? D.exports.asyncify_get_state() : 0) === 2 ? (D.exports.asyncify_stop_rewind(), i) : (D.exports.asyncify_start_unwind(k), A = new Promise((e
|
|
3714
|
+
return O && c > 0 ? (typeof D?.exports?.asyncify_get_state == "function" ? D.exports.asyncify_get_state() : 0) === 2 ? (D.exports.asyncify_stop_rewind(), i) : (D.exports.asyncify_start_unwind(k), A = new Promise((e, t) => {
|
|
3715
|
+
let n = setTimeout(() => {
|
|
3716
|
+
this._asyncifyReject = null, e();
|
|
3717
|
+
}, Math.max(1, c));
|
|
3718
|
+
this._asyncifyReject = (e) => {
|
|
3719
|
+
clearTimeout(n), this._asyncifyReject = null, t(e);
|
|
3720
|
+
};
|
|
3721
|
+
}), i) : i;
|
|
3663
3722
|
},
|
|
3664
3723
|
poll_oneoff: (e, t, n, r) => {
|
|
3665
3724
|
if (!E) return o;
|
|
3666
3725
|
let a = new DataView(E.buffer);
|
|
3667
|
-
if (O) {
|
|
3726
|
+
if (this._syncRawMode(), O) {
|
|
3668
3727
|
if ((typeof D?.exports?.asyncify_get_state == "function" ? D.exports.asyncify_get_state() : 0) === 2) {
|
|
3669
3728
|
if (D.exports.asyncify_stop_rewind(), I && W.length === 0) return I = !1, a.setUint32(r, 0, !0), c;
|
|
3670
3729
|
I = !1;
|
|
@@ -3721,14 +3780,16 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
3721
3780
|
}
|
|
3722
3781
|
return F = !1, I = !1, D.exports.asyncify_start_unwind(k), A = new Promise((e, t) => {
|
|
3723
3782
|
let n = null;
|
|
3724
|
-
this._asyncifyReject =
|
|
3783
|
+
this._asyncifyReject = (e) => {
|
|
3784
|
+
n && clearTimeout(n), j = null, M = null, this._pendingReadResolve = null, this._asyncifyReject = null, t(e);
|
|
3785
|
+
};
|
|
3725
3786
|
let r = () => {
|
|
3726
|
-
n && clearTimeout(n), F = !1, I = !1, j = null,
|
|
3787
|
+
n && clearTimeout(n), F = !1, I = !1, j = null, M = null, this._pendingReadResolve = null, this._asyncifyReject = null, e();
|
|
3727
3788
|
};
|
|
3728
|
-
s && (j = r, this._pendingReadResolve = r,
|
|
3729
|
-
n && clearTimeout(n), F = !1, I = !0, j = null,
|
|
3789
|
+
s && (j = r, this._pendingReadResolve = r, M = () => {
|
|
3790
|
+
n && clearTimeout(n), F = !1, I = !0, j = null, M = null, this._pendingReadResolve = null, this._asyncifyReject = null, e();
|
|
3730
3791
|
}), l !== Infinity && (n = setTimeout(() => {
|
|
3731
|
-
F = !0, I = !1, j = null,
|
|
3792
|
+
F = !0, I = !1, j = null, M = null, this._pendingReadResolve = null, this._asyncifyReject = null, e();
|
|
3732
3793
|
}, Math.max(1, l)));
|
|
3733
3794
|
}), a.setUint32(r, 0, !0), i;
|
|
3734
3795
|
}
|
|
@@ -3788,7 +3849,7 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
3788
3849
|
});
|
|
3789
3850
|
E = t, $[e.module] || ($[e.module] = {}), $[e.module][e.name] = t;
|
|
3790
3851
|
}
|
|
3791
|
-
if (D = await WebAssembly.instantiate(t, $), D.exports.memory && (E = D.exports.memory), O = !!(D.exports.asyncify_start_unwind && D.exports.asyncify_stop_unwind), O && E) {
|
|
3852
|
+
if (D = await WebAssembly.instantiate(t, $), D.exports.memory && (E = D.exports.memory), this._getTermiosLflag = typeof D.exports.get_termios_lflag == "function" ? D.exports.get_termios_lflag : null, O = !!(D.exports.asyncify_start_unwind && D.exports.asyncify_stop_unwind), O && E) {
|
|
3792
3853
|
try {
|
|
3793
3854
|
k = E.grow(1) * 65536;
|
|
3794
3855
|
} catch {
|
|
@@ -3797,7 +3858,7 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
3797
3858
|
let e = k + 8, t = k + 65536 - 8;
|
|
3798
3859
|
new Int32Array(E.buffer, k, 2).set([e, t]);
|
|
3799
3860
|
}
|
|
3800
|
-
typeof D.exports.set_terminal_size == "function" && H(), V && this._enterAltScreen();
|
|
3861
|
+
typeof D.exports.set_terminal_size == "function" && H(), V && (this._enterAltScreen(), this._syncRawMode());
|
|
3801
3862
|
let n = this.stdout && this.stdout.columns || this.stdinStream && this.stdinStream.columns || this.context && typeof this.context.getVar == "function" && parseInt(this.context.getVar("COLUMNS"), 10) || 80, r = this.stdout && this.stdout.rows || this.stdinStream && this.stdinStream.rows || this.context && typeof this.context.getVar == "function" && parseInt(this.context.getVar("LINES"), 10) || 24;
|
|
3802
3863
|
if (typeof D.exports.set_terminal_size == "function") try {
|
|
3803
3864
|
D.exports.set_terminal_size(n, r);
|
|
@@ -3811,9 +3872,9 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
3811
3872
|
if (i = e, a = t, typeof D?.exports?.set_terminal_size == "function") try {
|
|
3812
3873
|
D.exports.set_terminal_size(e, t);
|
|
3813
3874
|
} catch {}
|
|
3814
|
-
if (
|
|
3815
|
-
let e =
|
|
3816
|
-
|
|
3875
|
+
if (M) {
|
|
3876
|
+
let e = M;
|
|
3877
|
+
M = null, e();
|
|
3817
3878
|
}
|
|
3818
3879
|
}
|
|
3819
3880
|
}
|
|
@@ -3858,7 +3919,7 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
3858
3919
|
} catch (e) {
|
|
3859
3920
|
this._killed ? this.exitCode = 130 : (!e || !e._wasmExit) && (this.stdErr = `${this.script}: ${e?.message || String(e)}`, this.exitCode = 1);
|
|
3860
3921
|
} finally {
|
|
3861
|
-
V && this._exitAltScreen(), z && (this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("data", z), this.stdin && typeof this.stdin.off == "function" && this.stdin.off("data", z)), re && this._onStdinStreamData && this.stdinStream && typeof this.stdinStream.on == "function" && this.stdinStream.on("data", this._onStdinStreamData), ee && this.stdout && typeof this.stdout.off == "function" && this.stdout.off("resize", ee), R && this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("resize", R), this._externalKeyHandler = null;
|
|
3922
|
+
V && this._exitAltScreen(), z && (this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("data", z), this.stdin && typeof this.stdin.off == "function" && this.stdin.off("data", z)), re && this._onStdinStreamData && this.stdinStream && typeof this.stdinStream.on == "function" && this.stdinStream.on("data", this._onStdinStreamData), ee && this.stdout && typeof this.stdout.off == "function" && this.stdout.off("resize", ee), R && this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("resize", R), this._externalKeyHandler = null, this._getTermiosLflag = null;
|
|
3862
3923
|
for (let e of Y.values()) se(e);
|
|
3863
3924
|
}
|
|
3864
3925
|
te();
|
|
@@ -3870,13 +3931,13 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
3870
3931
|
description: `WebAssembly WASI binary (${this.script})`
|
|
3871
3932
|
}, t || {});
|
|
3872
3933
|
if (pe.includes("--help") || pe.includes("-h")) {
|
|
3873
|
-
let t =
|
|
3874
|
-
for (let e of
|
|
3934
|
+
let t = N(e);
|
|
3935
|
+
for (let e of P(n, r, t)) this.stdOut = e;
|
|
3875
3936
|
} else (pe.includes("--version") || pe.includes("-V") || pe.includes("-v")) && (this.stdOut = `${n} (${r.name} ${r.version} wasm)`);
|
|
3876
3937
|
}
|
|
3877
3938
|
}
|
|
3878
|
-
},
|
|
3879
|
-
function
|
|
3939
|
+
}, O = /* @__PURE__ */ new Map();
|
|
3940
|
+
function k(e, t) {
|
|
3880
3941
|
if (!e || !e.exists(t)) return null;
|
|
3881
3942
|
if (e.isRealFilesystem) try {
|
|
3882
3943
|
let n = Y();
|
|
@@ -3903,7 +3964,7 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
3903
3964
|
}
|
|
3904
3965
|
return null;
|
|
3905
3966
|
}
|
|
3906
|
-
function
|
|
3967
|
+
function A(e, t, n, i = "application/octet-stream") {
|
|
3907
3968
|
let a = n instanceof Uint8Array ? n : new Uint8Array(n);
|
|
3908
3969
|
if (e && e.isRealFilesystem) {
|
|
3909
3970
|
e.setFileByPath(t, a, !0);
|
|
@@ -3918,7 +3979,7 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
3918
3979
|
}
|
|
3919
3980
|
e.setFileByPath(t, s, !0);
|
|
3920
3981
|
}
|
|
3921
|
-
async function
|
|
3982
|
+
async function j(e, t, n = null) {
|
|
3922
3983
|
if (typeof n == "function") {
|
|
3923
3984
|
let r = await n(e, t);
|
|
3924
3985
|
if (r) return r;
|
|
@@ -3946,7 +4007,7 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
3946
4007
|
}
|
|
3947
4008
|
throw Error(`Package '${e}' could not be loaded`);
|
|
3948
4009
|
}
|
|
3949
|
-
function
|
|
4010
|
+
function M(e, t = !1) {
|
|
3950
4011
|
let n = {
|
|
3951
4012
|
usage: null,
|
|
3952
4013
|
options: []
|
|
@@ -3963,7 +4024,7 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
3963
4024
|
}
|
|
3964
4025
|
return n;
|
|
3965
4026
|
}
|
|
3966
|
-
function
|
|
4027
|
+
function N(e) {
|
|
3967
4028
|
let t = {
|
|
3968
4029
|
usage: null,
|
|
3969
4030
|
options: [],
|
|
@@ -3988,12 +4049,12 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
3988
4049
|
r.length >= 4 && n.push(r);
|
|
3989
4050
|
let i = n.join("\n");
|
|
3990
4051
|
t.isInteractive || (i.includes("/dev/tty") || i.includes("\x1B[?1049h") || i.includes("smcup") || i.includes("xterm")) && (t.isInteractive = !0);
|
|
3991
|
-
let a =
|
|
4052
|
+
let a = M(i, !0);
|
|
3992
4053
|
t.usage = a.usage, t.options = a.options;
|
|
3993
4054
|
} catch {}
|
|
3994
4055
|
return t;
|
|
3995
4056
|
}
|
|
3996
|
-
function
|
|
4057
|
+
function P(e, t = {}, n = null) {
|
|
3997
4058
|
let r = t.name || e, i = t.version || "wasm", a = t.description || "WebAssembly binary", o = t && typeof t.repl == "object" ? t.repl : t.repl ? {} : null, s = n && n.usage || t.usage, c = s ? s.replace(/%s/g, e) : null, l = o ? `${e} [options] ${o.evalFlag ? `[${o.evalFlag} <code>] ` : ""}[file] [args...]` : `${e} [options] [args...]`, u = [`${e} (${r} ${i} wasm) — ${a}`, `Usage: ${c || l}`];
|
|
3998
4059
|
t.details && u.push("", t.details), u.push("", "Options:");
|
|
3999
4060
|
let d = n && n.options && n.options.length > 0 ? n.options : Array.isArray(t.options) ? t.options : [];
|
|
@@ -4001,7 +4062,7 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
4001
4062
|
else o && (o.evalFlag && u.push(` ${o.evalFlag.padEnd(20)}Evaluate inline code and print result`), u.push(` (no arguments) Start interactive ${e} REPL shell`));
|
|
4002
4063
|
return u.push(" -h, --help Show this help message and exit"), u.push(" -V, --version Show WebAssembly binary version and exit"), n && n.exports && n.exports.length > 0 && u.push("", `WASM Exports: ${n.exports.join(", ")}`), Array.isArray(t.aliases) && t.aliases.length > 0 && u.push("", `Aliases: ${t.aliases.join(", ")}`), (t.homepage || t.cdnUrl || t.wasmUrl) && u.push(`Source: ${t.homepage || t.cdnUrl || t.wasmUrl}`), u;
|
|
4003
4064
|
}
|
|
4004
|
-
function
|
|
4065
|
+
function F(e, t = {}, n = null) {
|
|
4005
4066
|
let r = W(), i = (n || e.bin || e.name).toLowerCase();
|
|
4006
4067
|
class a extends r {
|
|
4007
4068
|
static get name() {
|
|
@@ -4020,7 +4081,7 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
4020
4081
|
return this._subCommand ? !!this._subCommand.captureInput : this.interactive;
|
|
4021
4082
|
}
|
|
4022
4083
|
get isRaw() {
|
|
4023
|
-
return
|
|
4084
|
+
return this._subCommand ? !!(this._subCommand.isRaw || this._subCommand.stdinStream && this._subCommand.stdinStream.isRaw) : !!(this.stdinStream && this.stdinStream.isRaw);
|
|
4024
4085
|
}
|
|
4025
4086
|
get _inAltScreen() {
|
|
4026
4087
|
return !!(this.__inAltScreen || this._subCommand && this._subCommand._inAltScreen);
|
|
@@ -4036,7 +4097,7 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
4036
4097
|
}
|
|
4037
4098
|
async run() {
|
|
4038
4099
|
let n = [...this.arguments || []], r = n.includes("--help") || n.includes("-h"), a = !r && (n.includes("--version") || n.includes("-V") || n.includes("-v")), o = this.fs || this.context && this.context.fs;
|
|
4039
|
-
this._inspectedWasm = null, this._persistedWasmBytes = e.wasmPath ?
|
|
4100
|
+
this._inspectedWasm = null, this._persistedWasmBytes = e.wasmPath ? k(o, e.wasmPath) : null, r && this._persistedWasmBytes && this._persistedWasmBytes.byteLength > 0 && (this._inspectedWasm = N(this._persistedWasmBytes));
|
|
4040
4101
|
try {
|
|
4041
4102
|
if ((e.type === "wasm" || e.type === "custom-wasm") && (this._persistedWasmBytes || e.wasmUrl)) {
|
|
4042
4103
|
let i = this._persistedWasmBytes;
|
|
@@ -4045,7 +4106,7 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
4045
4106
|
n instanceof Uint8Array || n instanceof ArrayBuffer ? i = n instanceof Uint8Array ? n : new Uint8Array(n) : n && (n.wasmBytes || n.wasm || n.wasmBinary) && (i = n.wasmBytes || n.wasm || n.wasmBinary);
|
|
4046
4107
|
} catch {}
|
|
4047
4108
|
if (!i && e.wasmUrl && (i = await this._fetchWasmBytes(e.wasmUrl)), i) {
|
|
4048
|
-
r && (this._inspectedWasm =
|
|
4109
|
+
r && (this._inspectedWasm = N(i)), await this._runRawWasmBytes(i, n);
|
|
4049
4110
|
return;
|
|
4050
4111
|
}
|
|
4051
4112
|
} else {
|
|
@@ -4062,19 +4123,19 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
4062
4123
|
}
|
|
4063
4124
|
let c, l;
|
|
4064
4125
|
try {
|
|
4065
|
-
c = await
|
|
4126
|
+
c = await j(e.name, o, t.moduleLoader), l = c && c.default !== void 0 ? c.default : c, l && typeof l.then == "function" && (l = await l);
|
|
4066
4127
|
} finally {
|
|
4067
4128
|
s && (globalThis.fetch = s);
|
|
4068
4129
|
}
|
|
4069
4130
|
if (l instanceof Uint8Array || l instanceof ArrayBuffer) {
|
|
4070
4131
|
let e = l instanceof Uint8Array ? l : new Uint8Array(l);
|
|
4071
|
-
r && (this._inspectedWasm =
|
|
4132
|
+
r && (this._inspectedWasm = N(e)), await this._runRawWasmBytes(e, n);
|
|
4072
4133
|
} else if (l && (l.wasmBytes instanceof Uint8Array || l.wasm instanceof Uint8Array)) {
|
|
4073
4134
|
let e = l.wasmBytes || l.wasm;
|
|
4074
|
-
r && (this._inspectedWasm =
|
|
4135
|
+
r && (this._inspectedWasm = N(e)), await this._runRawWasmBytes(e, n);
|
|
4075
4136
|
} else if (typeof l == "function") await this._runFunctionOrEmscripten(l, n, r, a);
|
|
4076
4137
|
else if (l && typeof l == "object") {
|
|
4077
|
-
l.ready && await l.ready, r && (l.HEAPU8 instanceof Uint8Array || l.wasmBinary instanceof Uint8Array) && (this._inspectedWasm =
|
|
4138
|
+
l.ready && await l.ready, r && (l.HEAPU8 instanceof Uint8Array || l.wasmBinary instanceof Uint8Array) && (this._inspectedWasm = N(l.wasmBinary || l.HEAPU8));
|
|
4078
4139
|
let t = l.main || l.run || l.callMain || l.exec;
|
|
4079
4140
|
if (typeof t == "function") await this._invokeCliFunction(t.bind(l), n);
|
|
4080
4141
|
else if (l.promised || typeof l.raw == "function" || typeof l.json == "function") {
|
|
@@ -4102,29 +4163,29 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
4102
4163
|
}
|
|
4103
4164
|
}
|
|
4104
4165
|
if (r || a) {
|
|
4105
|
-
let t = this.result && this.result.getStdOutput ? this.result.getStdOutput() : [], n = t.map((e) => e.string).join("\n"), o = r ?
|
|
4166
|
+
let t = this.result && this.result.getStdOutput ? this.result.getStdOutput() : [], n = t.map((e) => e.string).join("\n"), o = r ? M(n) : null, s = r && !!(o && (o.usage || o.options.length > 0) || t.some((e) => /\b(usage|options):/i.test(e.string))), c = t.filter((e) => e.type === "out").map((e) => e.string), l = a && c.length > 0 && (this.exitCode === 0 || this.exitCode === void 0);
|
|
4106
4167
|
if (r) if (s) {
|
|
4107
4168
|
let e = t.map((e) => e.string);
|
|
4108
4169
|
this.result && Array.isArray(this.result.std) && (this.result.std.length = 0), this.exitCode = 0;
|
|
4109
4170
|
for (let t of e) this.stdOut = t;
|
|
4110
4171
|
} else {
|
|
4111
4172
|
this.result && Array.isArray(this.result.std) && (this.result.std.length = 0), this.exitCode = 0;
|
|
4112
|
-
for (let t of
|
|
4173
|
+
for (let t of P(i, e, this._inspectedWasm)) this.stdOut = t;
|
|
4113
4174
|
}
|
|
4114
4175
|
else a && !l ? (this.result && Array.isArray(this.result.std) && (this.result.std.length = 0), this.exitCode = 0, this.stdOut = `${i} (${e.name} ${e.version || "wasm"} wasm)`) : this.exitCode = 0;
|
|
4115
4176
|
}
|
|
4116
4177
|
}
|
|
4117
4178
|
async _fetchWasmBytes(e) {
|
|
4118
|
-
if (
|
|
4179
|
+
if (O.has(e)) return O.get(e);
|
|
4119
4180
|
let n = t.fetch || (typeof fetch == "function" ? fetch : null);
|
|
4120
4181
|
if (!n) throw Error("fetch is not available in this environment");
|
|
4121
4182
|
let r = await n(e);
|
|
4122
4183
|
if (!r || !r.ok) throw Error(`HTTP ${r ? r.status : "error"} fetching ${e}`);
|
|
4123
4184
|
let i = new Uint8Array(await r.arrayBuffer());
|
|
4124
|
-
return
|
|
4185
|
+
return O.set(e, i), i;
|
|
4125
4186
|
}
|
|
4126
4187
|
async _runRawWasmBytes(t, n) {
|
|
4127
|
-
let r = new
|
|
4188
|
+
let r = new D(i, n, this.context);
|
|
4128
4189
|
r.script = i, r.arguments = n, r.context = this.context, r.fs = this.fs, r._pkgMeta = e, r.stdinStream = this.stdinStream, r.stdout = this.stdout, r.stderr = this.stderr, r.stdin = this.stdin && !this.stdin.isTTY ? this.stdin : this.stdinStream, this._onStdinStreamData && this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("data", this._onStdinStreamData);
|
|
4129
4190
|
let a = () => {
|
|
4130
4191
|
this.emit("interactive"), this.context && typeof this.context.emit == "function" && this.context.emit("interactive");
|
|
@@ -4157,13 +4218,13 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
4157
4218
|
let n = t && t !== "." && !e.startsWith("/") ? `${t.replace(/\/+$/, "")}/${e}` : e, r = this.fs.getFileByPath(n) ?? this.fs.getFileByPath(e);
|
|
4158
4219
|
return r == null ? null : typeof r == "string" ? r : new TextDecoder().decode(r);
|
|
4159
4220
|
},
|
|
4160
|
-
readBytes: (e) =>
|
|
4221
|
+
readBytes: (e) => k(this.fs, e),
|
|
4161
4222
|
writeFile: (e, t, n) => {
|
|
4162
4223
|
if (!this.fs) return;
|
|
4163
4224
|
let r = n && n !== "." && !e.startsWith("/") ? `${n.replace(/\/+$/, "")}/${e}` : e;
|
|
4164
4225
|
if (t instanceof Uint8Array || ArrayBuffer.isView(t)) {
|
|
4165
4226
|
let e = r.endsWith(".wasm") ? "application/wasm" : "application/octet-stream";
|
|
4166
|
-
|
|
4227
|
+
A(this.fs, r, t, e);
|
|
4167
4228
|
} else this.fs.setFileByPath(r, String(t), !0);
|
|
4168
4229
|
if (r.endsWith(".wasm") || r.endsWith(".wat")) try {
|
|
4169
4230
|
this.fs.setMode(r, 493);
|
|
@@ -4199,7 +4260,7 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
4199
4260
|
if (e && typeof e.status == "number") this.exitCode = e.status;
|
|
4200
4261
|
else throw e;
|
|
4201
4262
|
}
|
|
4202
|
-
if (f && typeof f == "object") if (r && (f.wasmBinary instanceof Uint8Array || f.HEAPU8 instanceof Uint8Array) && (this._inspectedWasm =
|
|
4263
|
+
if (f && typeof f == "object") if (r && (f.wasmBinary instanceof Uint8Array || f.HEAPU8 instanceof Uint8Array) && (this._inspectedWasm = N(f.wasmBinary || f.HEAPU8)), typeof f.callMain == "function") {
|
|
4203
4264
|
f.FS && l.size === 0 && (l = this._syncBrshToEmscriptenFs(f.FS, n));
|
|
4204
4265
|
try {
|
|
4205
4266
|
let e = await f.callMain(n);
|
|
@@ -4262,14 +4323,14 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
4262
4323
|
}), !t.loaded && typeof t.load == "function" && await t.load(e.coreUrl ? { coreURL: e.coreUrl } : void 0);
|
|
4263
4324
|
let a = /* @__PURE__ */ new Set(), o = [];
|
|
4264
4325
|
for (let e of n) if (!e.startsWith("-") && (o.push(e), this.fs.exists(e))) {
|
|
4265
|
-
let n =
|
|
4326
|
+
let n = k(this.fs, e);
|
|
4266
4327
|
n && (await t.writeFile(e, n), a.add(e));
|
|
4267
4328
|
}
|
|
4268
4329
|
let s = await t.exec(n);
|
|
4269
4330
|
for (let e of o) if (!a.has(e)) try {
|
|
4270
4331
|
if (typeof t.readFile == "function") {
|
|
4271
4332
|
let n = await t.readFile(e);
|
|
4272
|
-
n &&
|
|
4333
|
+
n && A(this.fs, e, n);
|
|
4273
4334
|
}
|
|
4274
4335
|
} catch {}
|
|
4275
4336
|
typeof s == "number" && s !== 0 && (this.exitCode = s, i.length === 0 && r.length > 0 && i.push(...r.splice(0, r.length)));
|
|
@@ -4286,7 +4347,7 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
4286
4347
|
let n = /* @__PURE__ */ new Set();
|
|
4287
4348
|
if (!this.fs || !e || typeof e.writeFile != "function") return n;
|
|
4288
4349
|
for (let r of t) if (!r.startsWith("-") && this.fs.exists(r)) {
|
|
4289
|
-
let t =
|
|
4350
|
+
let t = k(this.fs, r);
|
|
4290
4351
|
if (t) try {
|
|
4291
4352
|
e.writeFile(r, t), n.add(r);
|
|
4292
4353
|
} catch {}
|
|
@@ -4299,7 +4360,7 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
4299
4360
|
let t = e.readFile(r);
|
|
4300
4361
|
if (t) {
|
|
4301
4362
|
let e = r.endsWith(".wasm") ? "application/wasm" : "application/octet-stream";
|
|
4302
|
-
if (
|
|
4363
|
+
if (A(this.fs, r, t, e), r.endsWith(".wasm") || r.endsWith(".wat")) try {
|
|
4303
4364
|
this.fs.setMode(r, 493);
|
|
4304
4365
|
} catch {}
|
|
4305
4366
|
}
|
|
@@ -4309,10 +4370,10 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
4309
4370
|
}
|
|
4310
4371
|
return a;
|
|
4311
4372
|
}
|
|
4312
|
-
function
|
|
4373
|
+
function I(e, t) {
|
|
4313
4374
|
return e && (e.endsWith(".wasm") || e.endsWith(".wat")) ? !0 : t instanceof Uint8Array ? t.length >= 4 && t[0] === 0 && t[1] === 97 && t[2] === 115 && t[3] === 109 : typeof t == "string" ? t.charCodeAt(0) === 0 && t.slice(1, 4) === "asm" ? !0 : t.trimStart().startsWith("(module") : !1;
|
|
4314
4375
|
}
|
|
4315
|
-
function
|
|
4376
|
+
function L(e, t) {
|
|
4316
4377
|
if (!e || !t || typeof e.exists != "function" || typeof e.getFileByPath != "function") return null;
|
|
4317
4378
|
try {
|
|
4318
4379
|
let n = t.split("/").filter(Boolean);
|
|
@@ -4325,7 +4386,7 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
4325
4386
|
} catch {}
|
|
4326
4387
|
return null;
|
|
4327
4388
|
}
|
|
4328
|
-
|
|
4389
|
+
D.isWasmFile = I, D.readSiblingPkgMeta = L, D.readBytesFromFs = k, D.writeBytesToFs = A, D.loadModule = j, D.extractHelpFromText = M, D.inspectWasmBytes = N, D.formatWasmHelp = P, D.createGenericWasmCommand = F, D.createCommand = F, t.exports = D;
|
|
4329
4390
|
})), oe = /* @__PURE__ */ t(((e, t) => {
|
|
4330
4391
|
var n = {
|
|
4331
4392
|
sqlite3: {
|
|
@@ -5594,7 +5655,16 @@ var A, j, M, N, P, F, I, L, ee, R, z = e((() => {
|
|
|
5594
5655
|
return this._activeSubCommand && this._activeSubCommand.captureInput !== void 0 ? !!this._activeSubCommand.captureInput : this.interactive;
|
|
5595
5656
|
}
|
|
5596
5657
|
get isRaw() {
|
|
5597
|
-
return
|
|
5658
|
+
return this._activeSubCommand ? !!(this._activeSubCommand.isRaw || this._activeSubCommand.stdinStream && this._activeSubCommand.stdinStream.isRaw) : !!(this.stdinStream && this.stdinStream.isRaw);
|
|
5659
|
+
}
|
|
5660
|
+
get _inAltScreen() {
|
|
5661
|
+
return !!(this.__inAltScreen || this._activeSubCommand && this._activeSubCommand._inAltScreen);
|
|
5662
|
+
}
|
|
5663
|
+
set _inAltScreen(e) {
|
|
5664
|
+
this.__inAltScreen = !!e;
|
|
5665
|
+
}
|
|
5666
|
+
kill(e = "SIGINT") {
|
|
5667
|
+
this._activeSubCommand && typeof this._activeSubCommand.kill == "function" && this._activeSubCommand.kill(e), super.kill(e);
|
|
5598
5668
|
}
|
|
5599
5669
|
onInput(e) {
|
|
5600
5670
|
this._activeSubCommand && typeof this._activeSubCommand.onInput == "function" && this._activeSubCommand.onInput(e);
|