brsh 3.6.0 → 3.6.1
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 +3 -3
- package/dist/shell.es.js.map +1 -1
- package/dist/shell.min.js +3 -3
- package/dist/shell.min.js.map +1 -1
- package/dist/wbt.es.js +40 -8
- package/dist/wbt.es.js.map +1 -1
- package/dist/wbt.min.js +5 -5
- package/dist/wbt.min.js.map +1 -1
- package/lib/WasmCommand.js +7 -3
- package/lib/wbt/index.js +77 -7
- package/lib/wbt/registry.js +1 -1
- package/package.json +1 -1
- package/test/terminal.test.js +30 -0
- package/test/wbt.test.js +2 -2
package/dist/wbt.es.js
CHANGED
|
@@ -2559,7 +2559,7 @@ var R, z, B, V, H, U, W, G, K, q, J = e((() => {
|
|
|
2559
2559
|
let t = {
|
|
2560
2560
|
1: "",
|
|
2561
2561
|
2: ""
|
|
2562
|
-
}, n = new TextDecoder(), b = new TextEncoder(), C = null, w = null, T = !1, E = 0, D = null, O = null, k = null, A = null, N = !!(this.interactive && (this.stdin === void 0 || this.stdin === null || this.stdin === this.stdinStream)), P = (e, n) => {
|
|
2562
|
+
}, n = new TextDecoder(), b = new TextEncoder(), C = null, w = null, T = !1, E = 0, D = null, O = null, k = null, A = null, N = !!(this.interactive && (this.stdin === void 0 || this.stdin === null || this.stdin === this.stdinStream || this.stdin && this.stdin.isTTY)), P = (e, n) => {
|
|
2563
2563
|
if (N && (e === 1 || e === 2)) {
|
|
2564
2564
|
if (e === 1 && this.stdout) {
|
|
2565
2565
|
this.stdout.write(n);
|
|
@@ -2596,7 +2596,7 @@ var R, z, B, V, H, U, W, G, K, q, J = e((() => {
|
|
|
2596
2596
|
if (this._handlingStreamData) return;
|
|
2597
2597
|
let t = this._keyToBytes(e);
|
|
2598
2598
|
t && L(t);
|
|
2599
|
-
}, N && this.stdinStream && typeof this.stdinStream.on == "function" && this.stdinStream.on("data", A);
|
|
2599
|
+
}, N && this.stdinStream && typeof this.stdinStream.on == "function" && this.stdinStream.on("data", A), N && this.stdin && this.stdin !== this.stdinStream && typeof this.stdin.on == "function" && this.stdin.on("data", A);
|
|
2600
2600
|
let R = !N && typeof this.stdin == "string" ? b.encode(this.stdin) : !N && this.stdin instanceof Uint8Array ? this.stdin : !N && y !== void 0 && y.isBuffer(this.stdin) ? new Uint8Array(this.stdin) : new Uint8Array(), z = 0, B = this.context && this.context.fs ? this.context.fs : this.fs, V = 5, H = new Map([[3, {
|
|
2601
2601
|
type: "preopen",
|
|
2602
2602
|
path: "/",
|
|
@@ -3000,7 +3000,7 @@ var R, z, B, V, H, U, W, G, K, q, J = e((() => {
|
|
|
3000
3000
|
} catch (e) {
|
|
3001
3001
|
(!e || !e._wasmExit) && (this.stdErr = `${this.script}: ${e?.message || String(e)}`, this.exitCode = 1);
|
|
3002
3002
|
} finally {
|
|
3003
|
-
N && this._exitAltScreen(), N && A && this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("data", A), k && (this.stdout && typeof this.stdout.off == "function" && this.stdout.off("resize", k), this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("resize", k)), this._externalKeyHandler = null;
|
|
3003
|
+
N && this._exitAltScreen(), N && A && (this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("data", A), this.stdin && typeof this.stdin.off == "function" && this.stdin.off("data", A)), k && (this.stdout && typeof this.stdout.off == "function" && this.stdout.off("resize", k), this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("resize", k)), this._externalKeyHandler = null;
|
|
3004
3004
|
for (let e of H.values()) W(e);
|
|
3005
3005
|
}
|
|
3006
3006
|
F();
|
|
@@ -3874,7 +3874,7 @@ var R, z, B, V, H, U, W, G, K, q, J = e((() => {
|
|
|
3874
3874
|
name: "nano",
|
|
3875
3875
|
bin: "nano",
|
|
3876
3876
|
aliases: ["nano-wasm"],
|
|
3877
|
-
version: "8.0.
|
|
3877
|
+
version: "8.0.1",
|
|
3878
3878
|
description: "GNU nano 8.0 text editor compiled to WebAssembly (wasm32-wasip1) with ncurses",
|
|
3879
3879
|
details: "GNU nano is a small, user-friendly command-line text editor compiled to WebAssembly with wide-character ncurses 6.5, built-in terminfo fallbacks (xterm-256color, vt100, etc.), dynamic terminal dimensions (TIOCGWINSZ / LINES & COLUMNS), and zero custom imports (standard wasi_snapshot_preview1).",
|
|
3880
3880
|
homepage: "https://github.com/eliotstocker/nano-wasm",
|
|
@@ -4892,6 +4892,20 @@ var R, z, B, V, H, U, W, G, K, q, J = e((() => {
|
|
|
4892
4892
|
get requiresFilesystem() {
|
|
4893
4893
|
return !0;
|
|
4894
4894
|
}
|
|
4895
|
+
get interactive() {
|
|
4896
|
+
if (this._activeSubCommand && this._activeSubCommand.interactive !== void 0) return !!this._activeSubCommand.interactive;
|
|
4897
|
+
if (this.arguments && this.arguments[0] === "run" && this.arguments[1]) {
|
|
4898
|
+
let e = this.arguments[1].toLowerCase(), t = this._getRegistry()[e];
|
|
4899
|
+
if (t && t.interactive) return !this.arguments.slice(2).some((e) => e === "--help" || e === "-h" || e === "--version" || e === "-V" || e === "-v");
|
|
4900
|
+
}
|
|
4901
|
+
return !1;
|
|
4902
|
+
}
|
|
4903
|
+
get captureInput() {
|
|
4904
|
+
return this._activeSubCommand && this._activeSubCommand.captureInput !== void 0 ? !!this._activeSubCommand.captureInput : this.interactive;
|
|
4905
|
+
}
|
|
4906
|
+
onInput(e) {
|
|
4907
|
+
this._activeSubCommand && typeof this._activeSubCommand.onInput == "function" && this._activeSubCommand.onInput(e);
|
|
4908
|
+
}
|
|
4895
4909
|
static get _config() {
|
|
4896
4910
|
return this.__wbtConfig || {};
|
|
4897
4911
|
}
|
|
@@ -5475,11 +5489,29 @@ var R, z, B, V, H, U, W, G, K, q, J = e((() => {
|
|
|
5475
5489
|
this.stdErr = `E: Unable to locate package ${t}`, this.exitCode = 100;
|
|
5476
5490
|
return;
|
|
5477
5491
|
}
|
|
5492
|
+
if ((i.type === "custom-wasm" || i.type === "wasm") && !i.wasmPath) try {
|
|
5493
|
+
let e = await this._pullPackageWasm(i, !0);
|
|
5494
|
+
e && (i = Object.assign({}, i, { wasmPath: e }));
|
|
5495
|
+
} catch (e) {
|
|
5496
|
+
this.stdErr = `E: Failed to fetch ${i.name}: ${e.message || e}`, this.exitCode = 1;
|
|
5497
|
+
return;
|
|
5498
|
+
}
|
|
5478
5499
|
let a = this._buildCommandsForPackage(i), o = (a.find((e) => e.bin === t.toLowerCase()) || a[0]).Cmd, c = new o(e, this.context);
|
|
5479
|
-
c.requiresFilesystem && (c.fs = this.context.fs.sandbox()), this.
|
|
5480
|
-
let l =
|
|
5481
|
-
|
|
5482
|
-
|
|
5500
|
+
c.requiresFilesystem && (c.fs = this.context.fs.sandbox()), this._activeSubCommand = c, c.stdinStream = this.stdinStream, c.stdin = this.stdin && !this.stdin.isTTY ? this.stdin : this.stdinStream;
|
|
5501
|
+
let l = (e) => {
|
|
5502
|
+
this.stdout && typeof this.stdout.write == "function" && this.stdout.write(e);
|
|
5503
|
+
}, u = (e) => {
|
|
5504
|
+
this.stderr && typeof this.stderr.write == "function" && this.stderr.write(e);
|
|
5505
|
+
};
|
|
5506
|
+
c.stdout && typeof c.stdout.on == "function" && c.stdout.on("data", l), c.stderr && typeof c.stderr.on == "function" && c.stderr.on("data", u);
|
|
5507
|
+
let d;
|
|
5508
|
+
try {
|
|
5509
|
+
d = await c.runCommand();
|
|
5510
|
+
} finally {
|
|
5511
|
+
this._activeSubCommand = null, c.stdout && typeof c.stdout.off == "function" && c.stdout.off("data", l), c.stderr && typeof c.stderr.off == "function" && c.stderr.off("data", u);
|
|
5512
|
+
}
|
|
5513
|
+
if (!c.interactive && d) for (let e of d.getStdOutput()) e.type === "out" ? this.stdOut = e.string : e.type === "err" && (this.stdErr = e.string);
|
|
5514
|
+
this.exitCode = d ? d.getExitCode() : 0;
|
|
5483
5515
|
}
|
|
5484
5516
|
_printHelp() {
|
|
5485
5517
|
[
|