brsh 2.5.2 → 2.5.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.
@@ -1800,8 +1800,8 @@ var ee, P, F, I, L, R, z, te, B, V, ne = e((() => {
1800
1800
  })), W = /* @__PURE__ */ t(((e, t) => {
1801
1801
  var n = U(), r = se(), i = n.EventEmitter || n.default || n;
1802
1802
  t.exports = class extends i {
1803
- constructor(e) {
1804
- super(), this.arguments = e, this.result = new r();
1803
+ constructor(e, t) {
1804
+ super(), this.arguments = e, this.result = new r(), this.context = t || null;
1805
1805
  }
1806
1806
  get name() {
1807
1807
  return "unnamed";
@@ -1833,7 +1833,7 @@ var ee, P, F, I, L, R, z, te, B, V, ne = e((() => {
1833
1833
  var n = W();
1834
1834
  t.exports = class extends n {
1835
1835
  constructor(e, t) {
1836
- super(e), this.context = t;
1836
+ super(e, t);
1837
1837
  }
1838
1838
  };
1839
1839
  })), K = /* @__PURE__ */ t(((e, t) => {
@@ -2402,7 +2402,7 @@ var ee, P, F, I, L, R, z, te, B, V, ne = e((() => {
2402
2402
  }
2403
2403
  };
2404
2404
  })), ce = /* @__PURE__ */ t(((e, t) => {
2405
- var n = G();
2405
+ var n = W();
2406
2406
  t.exports = class extends n {
2407
2407
  get captureInput() {
2408
2408
  return !0;
@@ -6274,7 +6274,11 @@ var ee, P, F, I, L, R, z, te, B, V, ne = e((() => {
6274
6274
  clearFn: this.clear.bind(this),
6275
6275
  destroyFn: this.destroy.bind(this),
6276
6276
  onFsChange: typeof l == "function" ? l : null
6277
- })), this.context.setVar("PATH", n), this.context.setVar("HOST", i), u ? this.context.setNodeFilesystem(c) : this.context.setFilesystem(o, s), this.context.setCwd(c);
6277
+ })), this._readonlyContext = Object.freeze({
6278
+ getVar: (e) => this.context.getVar(e),
6279
+ getAlias: (e) => this.context.getAlias(e),
6280
+ getCommand: (e) => this.context.getCommand(e)
6281
+ }), this.context.setVar("PATH", n), this.context.setVar("HOST", i), u ? this.context.setNodeFilesystem(c) : this.context.setFilesystem(o, s), this.context.setCwd(c);
6278
6282
  let d = u || this.context.fs.exists(this.context.getVar("PATH"));
6279
6283
  this._loadDefaultCommands(), this._loadBuiltinCommands(d), this._lastCode = 0, r ? this._loadProfile(r) : setTimeout(() => this.emit("status", e.STATUS_READY), 0);
6280
6284
  }
@@ -6372,7 +6376,7 @@ var ee, P, F, I, L, R, z, te, B, V, ne = e((() => {
6372
6376
  }
6373
6377
  let d = (e) => typeof e == "function" && typeof e.prototype.run == "function" && typeof e.prototype.runCommand == "function", f;
6374
6378
  if (u.prototype instanceof o || new u() instanceof s) f = new u(n, this.context);
6375
- else if (d(u)) f = new u(n);
6379
+ else if (d(u)) f = new u(n, this._readonlyContext);
6376
6380
  else {
6377
6381
  this.emit("stdErr", `${r}: Command not found`), this.lastCode = 1, this.emit("exitCode", this.lastCode);
6378
6382
  return;
@@ -7029,7 +7033,7 @@ var ee, P, F, I, L, R, z, te, B, V, ne = e((() => {
7029
7033
  }
7030
7034
  _setupDom(e, t = "Roboto Mono") {
7031
7035
  let n = document.createElement("link");
7032
- n.href = `https://fonts.googleapis.com/css?family=${encodeURIComponent(t)}:ital,wght@0,400;0,700;1,400;1,700&display=swap`, n.rel = "stylesheet", document.head.appendChild(n), this._cmdList = document.createElement("ul"), this._cmdList.style.fontFamily = `'${t}', monospace`, this._cmdList.style.listStyle = "none", this._cmdList.style.padding = "0", this._lineWrap && this._cmdList.classList.add("terminal--wrap"), e.appendChild(this._cmdList), this._screen = document.createElement("pre"), this._screen.className = "terminal__screen", this._screen.style.fontFamily = `'${t}', monospace`, e.appendChild(this._screen), this._charMeasure = document.createElement("span"), this._charMeasure.className = "terminal__char-measure", this._charMeasure.textContent = "X", this._charMeasure.setAttribute("aria-hidden", "true"), e.appendChild(this._charMeasure), setTimeout(() => this._measureAndSetSize(), 0), typeof ResizeObserver < "u" && new ResizeObserver(() => this._measureAndSetSize()).observe(e);
7036
+ n.href = `https://fonts.googleapis.com/css?family=${encodeURIComponent(t)}:ital,wght@0,400;0,700;1,400;1,700&display=swap`, n.rel = "stylesheet", document.head.appendChild(n), this._cmdList = document.createElement("ul"), this._cmdList.style.fontFamily = `'${t}', monospace`, this._cmdList.style.listStyle = "none", this._cmdList.style.padding = "0", this._lineWrap && this._cmdList.classList.add("terminal--wrap"), e.appendChild(this._cmdList), this._screen = document.createElement("pre"), this._screen.className = "terminal__screen", this._screen.style.fontFamily = `'${t}', monospace`, e.appendChild(this._screen), this._charMeasure = document.createElement("span"), this._charMeasure.className = "terminal__char-measure", this._charMeasure.style.fontFamily = `'${t}', monospace`, this._charMeasure.textContent = "X", this._charMeasure.setAttribute("aria-hidden", "true"), e.appendChild(this._charMeasure), setTimeout(() => this._measureAndSetSize(), 0), document.fonts && document.fonts.ready.then(() => this._measureAndSetSize()), typeof ResizeObserver < "u" && new ResizeObserver(() => this._measureAndSetSize()).observe(e);
7033
7037
  }
7034
7038
  _newPrompt(e) {
7035
7039
  this._clearCursor(), this._currentLine = document.createElement("li"), this._cmdList.appendChild(this._currentLine), e && e(), this._autoScroll();