brsh 3.1.3 → 3.1.4

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 CHANGED
@@ -1,3 +1,10 @@
1
+ ## [3.1.4](https://github.com/eliotstocker/Brsh-JS/compare/v3.1.3...v3.1.4) (2026-11-09)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **scripts:** support script positional parameters and $@, $*, $# ([21745f5](https://github.com/eliotstocker/Brsh-JS/commit/21745f5f9938d9728e575d16eb65b0a5b5f972c0))
7
+
1
8
  ## [3.1.3](https://github.com/eliotstocker/Brsh-JS/compare/v3.1.2...v3.1.3) (2026-11-09)
2
9
 
3
10
 
package/dist/shell.es.js CHANGED
@@ -2317,7 +2317,7 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
2317
2317
  cwd: e && e.cwd || "/",
2318
2318
  ...t,
2319
2319
  subshell: !0
2320
- }), this.sandbox.context.source(this.context), this.sandbox.on("stdOut", (e) => {
2320
+ }), this.sandbox.context.source(this.context), 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.sandbox.on("stdOut", (e) => {
2321
2321
  this.stdOut = e, this.flush();
2322
2322
  }), this.sandbox.on("stdErr", (e) => {
2323
2323
  this.stdErr = e, this.flush();
@@ -7646,7 +7646,7 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
7646
7646
  f.createReplWasmCommand = p, f.createCommand = p, t.exports = f;
7647
7647
  })), cr = /* @__PURE__ */ t(((e, t) => {
7648
7648
  b();
7649
- var r = ae(), i = J(), a = oe(), o = se(), s = W(), c = ne(), { TtyStream: l } = te(), u = "/.brsh_history", d = xe(), f = Ue(), p = H(), m = x(), { isAsyncFilesystemSource: h, resolveFilesystemSource: g } = re(), _ = /\$(?:\{([\w\d?#-]+)\}|([\w\d]+|[?#-]))/g, v = p.EventEmitter || p.default || p;
7649
+ var r = ae(), i = J(), a = oe(), o = se(), s = W(), c = ne(), { TtyStream: l } = te(), u = "/.brsh_history", d = xe(), f = Ue(), p = H(), m = x(), { isAsyncFilesystemSource: h, resolveFilesystemSource: g } = re(), _ = /\$(?:\{([\w\d?#@*-]+)\}|([\w\d]+|[?#@*-]))/g, v = p.EventEmitter || p.default || p;
7650
7650
  String.prototype.regexIndexOf = function(e, t) {
7651
7651
  let n = this.substring(t || 0).search(e);
7652
7652
  return n >= 0 ? n + (t || 0) : n;
@@ -8118,8 +8118,7 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
8118
8118
  r.length === 1 ? (e.push(`${i == null ? "" : i.concat("/")}${r[0]}`), this._lineBuffer = e.join(" ").split(""), this._cursorPos = this._lineBuffer.length, this._redrawPromptLine()) : r.length > 1 && (this.stdout.write("\r\n" + r.join(" ") + "\r\n"), this._redrawPromptLine());
8119
8119
  }
8120
8120
  _splitInput(e) {
8121
- let t = e.split("#")[0];
8122
- return this._parseOperators(t);
8121
+ return this._parseOperators(e);
8123
8122
  }
8124
8123
  _parseOperators(e) {
8125
8124
  let t = [], n = "", r = 0, i = !1, a = !1;
@@ -8134,6 +8133,12 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
8134
8133
  continue;
8135
8134
  }
8136
8135
  if (!i && !a) {
8136
+ if (o === "#" && (n.trim() === "" || /\s/.test(e[r - 1]))) {
8137
+ let t = e.indexOf("\n", r);
8138
+ if (t === -1) break;
8139
+ r = t;
8140
+ continue;
8141
+ }
8137
8142
  if (o === "&" && e[r + 1] === "&") {
8138
8143
  t.push({
8139
8144
  command: n.trim(),