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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [3.8.1](https://github.com/eliotstocker/Brsh-JS/compare/v3.8.0...v3.8.1) (2026-11-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **wasm:** prevent duplicate keystroke delivery in interactive tty mode ([#32](https://github.com/eliotstocker/Brsh-JS/issues/32)) ([7a55dbe](https://github.com/eliotstocker/Brsh-JS/commit/7a55dbe345c9bdfb1081121ddcbfa839142b3026))
|
|
7
|
+
|
|
1
8
|
# [3.8.0](https://github.com/eliotstocker/Brsh-JS/compare/v3.7.0...v3.8.0) (2026-11-10)
|
|
2
9
|
|
|
3
10
|
|
package/dist/shell.es.js
CHANGED
|
@@ -1240,10 +1240,24 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
|
|
|
1240
1240
|
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;
|
|
1241
1241
|
}
|
|
1242
1242
|
write(e, t, n) {
|
|
1243
|
-
|
|
1243
|
+
if (e == null) return !0;
|
|
1244
|
+
typeof this._onWrite == "function" && this._onWrite(e), this._isPushing = !0;
|
|
1245
|
+
try {
|
|
1246
|
+
this.emit("data", this._formatChunk(e));
|
|
1247
|
+
} finally {
|
|
1248
|
+
this._isPushing = !1;
|
|
1249
|
+
}
|
|
1250
|
+
return typeof t == "function" ? t() : typeof n == "function" && n(), !0;
|
|
1244
1251
|
}
|
|
1245
1252
|
pushData(e) {
|
|
1246
|
-
e != null
|
|
1253
|
+
if (e != null) {
|
|
1254
|
+
this._isPushing = !0;
|
|
1255
|
+
try {
|
|
1256
|
+
this.emit("data", this._formatChunk(e));
|
|
1257
|
+
} finally {
|
|
1258
|
+
this._isPushing = !1;
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1247
1261
|
}
|
|
1248
1262
|
_formatChunk(e) {
|
|
1249
1263
|
return this._encoding ? typeof e == "string" ? e : e instanceof Uint8Array || y !== void 0 && y.isBuffer(e) ? new TextDecoder().decode(e) : String(e) : e;
|
|
@@ -1304,11 +1318,11 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
|
|
|
1304
1318
|
columns: n,
|
|
1305
1319
|
rows: o,
|
|
1306
1320
|
onWrite: (e) => this.emit("stderr", e)
|
|
1307
|
-
}), this.
|
|
1321
|
+
}), this._onStdinStreamData = (e) => {
|
|
1308
1322
|
if (!this.captureInput) return;
|
|
1309
1323
|
let t = a(e);
|
|
1310
1324
|
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);
|
|
1311
|
-
});
|
|
1325
|
+
}, this.stdinStream.on("data", this._onStdinStreamData);
|
|
1312
1326
|
}
|
|
1313
1327
|
get name() {
|
|
1314
1328
|
return "unnamed";
|
|
@@ -2740,7 +2754,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
|
|
|
2740
2754
|
return n[e] ? new TextEncoder().encode(n[e]) : new TextEncoder().encode(e);
|
|
2741
2755
|
}
|
|
2742
2756
|
onInput(e) {
|
|
2743
|
-
if (!this._handlingStreamData) {
|
|
2757
|
+
if (!this._handlingStreamData && !(this.stdinStream && this.stdinStream._isPushing)) {
|
|
2744
2758
|
if (typeof this._externalKeyHandler == "function") {
|
|
2745
2759
|
this._externalKeyHandler(e);
|
|
2746
2760
|
return;
|
|
@@ -2863,7 +2877,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
|
|
|
2863
2877
|
if (this._handlingStreamData) return;
|
|
2864
2878
|
let t = this._keyToBytes(e);
|
|
2865
2879
|
t && B(t);
|
|
2866
|
-
}, F && this.stdinStream && typeof this.stdinStream.on == "function" && this.stdinStream.on("data", P), F && this.stdin && this.stdin !== this.stdinStream && typeof this.stdin.on == "function" && this.stdin.on("data", P);
|
|
2880
|
+
}, 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", P), F && this.stdin && this.stdin !== this.stdinStream && typeof this.stdin.on == "function" && this.stdin.on("data", P);
|
|
2867
2881
|
let V = !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(), H = 0, U = this.context && this.context.fs ? this.context.fs : this.fs, te = 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") || U && U.cwd || "/", W = te.length > 1 && te.endsWith("/") ? te.slice(0, -1) : te, ne = 5, G = new Map([[3, {
|
|
2868
2882
|
type: "preopen",
|
|
2869
2883
|
path: "/",
|
|
@@ -3437,7 +3451,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
|
|
|
3437
3451
|
} catch (e) {
|
|
3438
3452
|
(!e || !e._wasmExit) && (this.stdErr = `${this.script}: ${e?.message || String(e)}`, this.exitCode = 1);
|
|
3439
3453
|
} finally {
|
|
3440
|
-
I && this._exitAltScreen(),
|
|
3454
|
+
I && this._exitAltScreen(), P && (this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("data", P), this.stdin && typeof this.stdin.off == "function" && this.stdin.off("data", P)), this._onStdinStreamData && this.stdinStream && typeof this.stdinStream.on == "function" && this.stdinStream.on("data", this._onStdinStreamData), N && (this.stdout && typeof this.stdout.off == "function" && this.stdout.off("resize", N), this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("resize", N)), this._externalKeyHandler = null;
|
|
3441
3455
|
for (let e of G.values()) Y(e);
|
|
3442
3456
|
}
|
|
3443
3457
|
ee();
|