brsh 3.8.0 → 3.8.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 +21 -7
- package/dist/shell.es.js.map +1 -1
- package/dist/shell.min.js +5 -5
- package/dist/shell.min.js.map +1 -1
- package/dist/wbt.es.js +21 -7
- 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/Command.js +3 -2
- package/lib/TtyStream.js +12 -2
- package/lib/WasmCommand.js +10 -1
- package/package.json +1 -1
- package/test/wbt.test.js +39 -0
package/dist/wbt.es.js
CHANGED
|
@@ -1079,10 +1079,24 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
|
|
|
1079
1079
|
super(), this.isTTY = e.isTTY !== !1, this.readable = !0, this.writable = !0, this.columns = e.columns || 80, this.rows = e.rows || 24, this.isRaw = !1, this._encoding = null, this._onWrite = e.onWrite || null;
|
|
1080
1080
|
}
|
|
1081
1081
|
write(e, t, n) {
|
|
1082
|
-
|
|
1082
|
+
if (e == null) return !0;
|
|
1083
|
+
typeof this._onWrite == "function" && this._onWrite(e), this._isPushing = !0;
|
|
1084
|
+
try {
|
|
1085
|
+
this.emit("data", this._formatChunk(e));
|
|
1086
|
+
} finally {
|
|
1087
|
+
this._isPushing = !1;
|
|
1088
|
+
}
|
|
1089
|
+
return typeof t == "function" ? t() : typeof n == "function" && n(), !0;
|
|
1083
1090
|
}
|
|
1084
1091
|
pushData(e) {
|
|
1085
|
-
e != null
|
|
1092
|
+
if (e != null) {
|
|
1093
|
+
this._isPushing = !0;
|
|
1094
|
+
try {
|
|
1095
|
+
this.emit("data", this._formatChunk(e));
|
|
1096
|
+
} finally {
|
|
1097
|
+
this._isPushing = !1;
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1086
1100
|
}
|
|
1087
1101
|
_formatChunk(e) {
|
|
1088
1102
|
return this._encoding ? typeof e == "string" ? e : e instanceof Uint8Array || y !== void 0 && y.isBuffer(e) ? new TextDecoder().decode(e) : String(e) : e;
|
|
@@ -1143,11 +1157,11 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
|
|
|
1143
1157
|
columns: n,
|
|
1144
1158
|
rows: o,
|
|
1145
1159
|
onWrite: (e) => this.emit("stderr", e)
|
|
1146
|
-
}), this.
|
|
1160
|
+
}), this._onStdinStreamData = (e) => {
|
|
1147
1161
|
if (!this.captureInput) return;
|
|
1148
1162
|
let t = a(e);
|
|
1149
1163
|
for (let e of t) !this.interactive && !this.stdinStream.isRaw && (e === "Enter" ? this.stdout.write("\r\n") : e === "Backspace" ? this.stdout.write("\b \b") : e.length === 1 && this.stdout.write(e)), this.onInput(e);
|
|
1150
|
-
});
|
|
1164
|
+
}, this.stdinStream.on("data", this._onStdinStreamData);
|
|
1151
1165
|
}
|
|
1152
1166
|
get name() {
|
|
1153
1167
|
return "unnamed";
|
|
@@ -2476,7 +2490,7 @@ var R, z, B, V, H, U, W, G, ee, K, q = e((() => {
|
|
|
2476
2490
|
return n[e] ? new TextEncoder().encode(n[e]) : new TextEncoder().encode(e);
|
|
2477
2491
|
}
|
|
2478
2492
|
onInput(e) {
|
|
2479
|
-
if (!this._handlingStreamData) {
|
|
2493
|
+
if (!this._handlingStreamData && !(this.stdinStream && this.stdinStream._isPushing)) {
|
|
2480
2494
|
if (typeof this._externalKeyHandler == "function") {
|
|
2481
2495
|
this._externalKeyHandler(e);
|
|
2482
2496
|
return;
|
|
@@ -2599,7 +2613,7 @@ var R, z, B, V, H, U, W, G, ee, K, q = e((() => {
|
|
|
2599
2613
|
if (this._handlingStreamData) return;
|
|
2600
2614
|
let t = this._keyToBytes(e);
|
|
2601
2615
|
t && V(t);
|
|
2602
|
-
}, F && this.stdinStream && typeof this.stdinStream.on == "function" && this.stdinStream.on("data", M), F && this.stdin && this.stdin !== this.stdinStream && typeof this.stdin.on == "function" && this.stdin.on("data", M);
|
|
2616
|
+
}, this._onStdinStreamData && this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("data", this._onStdinStreamData), F && this.stdinStream && typeof this.stdinStream.on == "function" && this.stdinStream.on("data", M), F && this.stdin && this.stdin !== this.stdinStream && typeof this.stdin.on == "function" && this.stdin.on("data", M);
|
|
2603
2617
|
let H = !F && typeof this.stdin == "string" ? b.encode(this.stdin) : !F && this.stdin instanceof Uint8Array ? this.stdin : !F && y !== void 0 && y.isBuffer(this.stdin) ? new Uint8Array(this.stdin) : new Uint8Array(), U = 0, W = this.context && this.context.fs ? this.context.fs : this.fs, G = this.context && this.context.fs && this.context.fs.cwd || this.fs && this.fs.cwd || this.context && typeof this.context.getVar == "function" && this.context.getVar("PWD") || W && W.cwd || "/", ee = G.length > 1 && G.endsWith("/") ? G.slice(0, -1) : G, K = 5, q = new Map([[3, {
|
|
2604
2618
|
type: "preopen",
|
|
2605
2619
|
path: "/",
|
|
@@ -3173,7 +3187,7 @@ var R, z, B, V, H, U, W, G, ee, K, q = e((() => {
|
|
|
3173
3187
|
} catch (e) {
|
|
3174
3188
|
(!e || !e._wasmExit) && (this.stdErr = `${this.script}: ${e?.message || String(e)}`, this.exitCode = 1);
|
|
3175
3189
|
} finally {
|
|
3176
|
-
I && this._exitAltScreen(),
|
|
3190
|
+
I && this._exitAltScreen(), M && (this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("data", M), this.stdin && typeof this.stdin.off == "function" && this.stdin.off("data", M)), this._onStdinStreamData && this.stdinStream && typeof this.stdinStream.on == "function" && this.stdinStream.on("data", this._onStdinStreamData), j && (this.stdout && typeof this.stdout.off == "function" && this.stdout.off("resize", j), this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("resize", j)), this._externalKeyHandler = null;
|
|
3177
3191
|
for (let e of q.values()) Z(e);
|
|
3178
3192
|
}
|
|
3179
3193
|
z();
|