@lifo-sh/core 0.4.0 → 0.4.2

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.
Files changed (47) hide show
  1. package/dist/{awk-CI8X5kVy.js → awk-C6CYe7-Y.js} +1 -1
  2. package/dist/{basename-D8VowKZK.js → basename-DWmNG86a.js} +1 -1
  3. package/dist/{cat-BPj_LHfi.js → cat-CJGzb2e3.js} +1 -1
  4. package/dist/{chmod-pNQSdBnq.js → chmod-jxQWlanu.js} +1 -1
  5. package/dist/{chown-BzpeyVqg.js → chown-B1-u84Sk.js} +1 -1
  6. package/dist/commands/registry.d.ts +1 -0
  7. package/dist/commands/registry.d.ts.map +1 -1
  8. package/dist/commands/system/lifo.d.ts +1 -1
  9. package/dist/commands/system/lifo.d.ts.map +1 -1
  10. package/dist/commands/system/npm.d.ts +7 -0
  11. package/dist/commands/system/npm.d.ts.map +1 -1
  12. package/dist/{cp-_rhci8W9.js → cp-DfLycDOs.js} +1 -1
  13. package/dist/{cut-Q5nQyrUo.js → cut-Cx3rJJBs.js} +1 -1
  14. package/dist/{diff-Dvc96Xgm.js → diff-BNTf3WBA.js} +1 -1
  15. package/dist/{dirname-B9Rm-O9I.js → dirname-BAkBrBEd.js} +1 -1
  16. package/dist/{du-Cv4zAsqm.js → du-z_BgTafK.js} +1 -1
  17. package/dist/{file-Cxgmm1Vo.js → file-BcMiRsYy.js} +1 -1
  18. package/dist/{find-BJNOna6S.js → find-CnuafYlN.js} +1 -1
  19. package/dist/{grep-vdjjGK6g.js → grep-CRKDa1ht.js} +1 -1
  20. package/dist/{gunzip-AmY9PUj2.js → gunzip-CQPu5wlU.js} +1 -1
  21. package/dist/{gzip-C_08tX3p.js → gzip-5Z4ubCZY.js} +1 -1
  22. package/dist/{head-DGXxKqPE.js → head-CHtqgY7i.js} +1 -1
  23. package/dist/{index-CvsPTm3-.js → index-CfhPq6Ru.js} +703 -655
  24. package/dist/index.js +1 -1
  25. package/dist/{ls-BOMe19Ls.js → ls-KhZ3RDtV.js} +1 -1
  26. package/dist/{mkdir-DE5ZBdl1.js → mkdir-CyaDOAjy.js} +1 -1
  27. package/dist/{mktemp-De1K5WCb.js → mktemp-BdOMKqeO.js} +1 -1
  28. package/dist/{mv-Cw8pg9wR.js → mv-BKse5fAw.js} +1 -1
  29. package/dist/{nl-C-osPl2N.js → nl-CR1TwNHf.js} +1 -1
  30. package/dist/{realpath-BSWdZLjf.js → realpath-Bn-E4jFG.js} +1 -1
  31. package/dist/{rev-3C5MtCkc.js → rev-zIT5u7gK.js} +1 -1
  32. package/dist/{rm-CR560cHz.js → rm-CwcGV_yP.js} +1 -1
  33. package/dist/{rmdir-BO4Jz3r5.js → rmdir-C0n1UKoB.js} +1 -1
  34. package/dist/{sed-DCUgJWcA.js → sed-Dpeoa9n0.js} +1 -1
  35. package/dist/{sort-or-F_iEY.js → sort-B0CyoWxT.js} +1 -1
  36. package/dist/{stat-MGHvbiS7.js → stat-CRPxoOhV.js} +1 -1
  37. package/dist/{tail-DheqHGe2.js → tail-X6H5EAuw.js} +1 -1
  38. package/dist/{tar-DhLtWtBV.js → tar-B8rlvBTm.js} +1 -1
  39. package/dist/{tee-D47GOzfR.js → tee-BNSgK_iU.js} +1 -1
  40. package/dist/{touch-D7Xd2vNM.js → touch-BePpbvnW.js} +1 -1
  41. package/dist/{tree-CRpLFDhe.js → tree-CgYdJHGr.js} +1 -1
  42. package/dist/{uniq-DwHCe--v.js → uniq-BCe-YCgo.js} +1 -1
  43. package/dist/{unzip-DPEg74Aq.js → unzip-ByMOFz0R.js} +1 -1
  44. package/dist/{wc-BUIoLfSN.js → wc-BoOwcYXR.js} +1 -1
  45. package/dist/{wget-BwmpusXQ.js → wget-D9TxbSi0.js} +1 -1
  46. package/dist/{zip-B4jRyQ7B.js → zip-ZGFNiBLk.js} +1 -1
  47. package/package.json +9 -9
@@ -9,39 +9,39 @@ function fe(r) {
9
9
  let n = s.join("/");
10
10
  return e && (n = "/" + n), n || (e ? "/" : ".");
11
11
  }
12
- function Je(r) {
12
+ function Ye(r) {
13
13
  return r.startsWith("/");
14
14
  }
15
- function L(...r) {
15
+ function C(...r) {
16
16
  return fe(r.filter(Boolean).join("/"));
17
17
  }
18
18
  function D(r, ...e) {
19
19
  let t = r;
20
20
  for (const s of e)
21
- Je(s) ? t = s : t = t + "/" + s;
21
+ Ye(s) ? t = s : t = t + "/" + s;
22
22
  return fe(t);
23
23
  }
24
24
  function te(r) {
25
25
  const e = fe(r), t = e.lastIndexOf("/");
26
26
  return t === -1 ? "." : t === 0 ? "/" : e.slice(0, t);
27
27
  }
28
- function Ee(r, e) {
28
+ function xe(r, e) {
29
29
  const t = fe(r), s = t.lastIndexOf("/");
30
30
  let n = s === -1 ? t : t.slice(s + 1);
31
31
  return e && n.endsWith(e) && (n = n.slice(0, -e.length)), n;
32
32
  }
33
- function Ie(r) {
34
- const e = Ee(r), t = e.lastIndexOf(".");
33
+ function Fe(r) {
34
+ const e = xe(r), t = e.lastIndexOf(".");
35
35
  return t <= 0 ? "" : e.slice(t);
36
36
  }
37
37
  const dr = new TextEncoder(), fr = new TextDecoder();
38
38
  function ge(r) {
39
39
  return dr.encode(r);
40
40
  }
41
- function Ne(r) {
41
+ function je(r) {
42
42
  return fr.decode(r);
43
43
  }
44
- function Ye(...r) {
44
+ function Xe(...r) {
45
45
  const e = r.reduce((n, i) => n + i.length, 0), t = new Uint8Array(e);
46
46
  let s = 0;
47
47
  for (const n of r)
@@ -135,7 +135,7 @@ function mr(r) {
135
135
  function gr(r) {
136
136
  return r.startsWith("text/") || r === "application/json" ? "text" : r.startsWith("image/") ? "image" : r.startsWith("video/") ? "video" : r.startsWith("audio/") ? "audio" : r === "application/zip" || r === "application/x-tar" || r === "application/gzip" || r === "application/x-bzip2" || r === "application/x-7z-compressed" || r === "application/vnd.rar" ? "archive" : "binary";
137
137
  }
138
- function Xi(r) {
138
+ function Qi(r) {
139
139
  return gr(r) !== "text";
140
140
  }
141
141
  const N = {
@@ -146,25 +146,25 @@ const N = {
146
146
  ENOTEMPTY: "ENOTEMPTY",
147
147
  EINVAL: "EINVAL"
148
148
  };
149
- class T extends Error {
149
+ class _ extends Error {
150
150
  constructor(t, s) {
151
151
  super(`${t}: ${s}`);
152
152
  m(this, "code");
153
153
  this.code = t, this.name = "VFSError";
154
154
  }
155
155
  }
156
- const wr = 3421674724, yr = 2216829733, st = 435, vr = 1;
157
- function wt(r) {
156
+ const wr = 3421674724, yr = 2216829733, nt = 435, vr = 1;
157
+ function yt(r) {
158
158
  let e = wr, t = yr;
159
159
  for (let i = 0; i < r.length; i++) {
160
160
  t ^= r[i];
161
- const o = t & 65535, a = t >>> 16 & 65535, c = o * st, l = a * st, d = c & 65535, h = (c >>> 16) + (l & 65535), f = h & 65535, g = (h >>> 16) + (l >>> 16), I = (f << 16 | d) >>> 0, k = (Math.imul(e, st) + Math.imul(t, vr << 8) + g | 0) >>> 0;
162
- t = I, e = k;
161
+ const o = t & 65535, a = t >>> 16 & 65535, c = o * nt, l = a * nt, d = c & 65535, h = (c >>> 16) + (l & 65535), f = h & 65535, g = (h >>> 16) + (l >>> 16), A = (f << 16 | d) >>> 0, k = (Math.imul(e, nt) + Math.imul(t, vr << 8) + g | 0) >>> 0;
162
+ t = A, e = k;
163
163
  }
164
164
  const s = e.toString(16).padStart(8, "0"), n = t.toString(16).padStart(8, "0");
165
165
  return s + n;
166
166
  }
167
- class Qi {
167
+ class Ki {
168
168
  constructor() {
169
169
  m(this, "blobs", /* @__PURE__ */ new Map());
170
170
  }
@@ -173,7 +173,7 @@ class Qi {
173
173
  return t ? new Uint8Array(t) : null;
174
174
  }
175
175
  async put(e) {
176
- const t = wt(e);
176
+ const t = yt(e);
177
177
  return this.blobs.has(t) || this.blobs.set(t, new Uint8Array(e)), t;
178
178
  }
179
179
  async delete(e) {
@@ -184,7 +184,7 @@ class Qi {
184
184
  }
185
185
  }
186
186
  const br = "lifo-blobs", ne = "blobs";
187
- class Ki {
187
+ class eo {
188
188
  constructor() {
189
189
  m(this, "db", null);
190
190
  }
@@ -216,7 +216,7 @@ class Ki {
216
216
  }) : null;
217
217
  }
218
218
  async put(e) {
219
- const t = wt(e);
219
+ const t = yt(e);
220
220
  return this.db ? new Promise((s) => {
221
221
  try {
222
222
  const n = this.db.transaction(ne, "readwrite");
@@ -267,7 +267,7 @@ class $r {
267
267
  }
268
268
  /** Store a blob. Returns its content hash. Deduplicates by hash. */
269
269
  put(e) {
270
- const t = wt(e);
270
+ const t = yt(e);
271
271
  return this.cache.has(t) ? (this.cache.get(t).lastAccess = ++this.accessCounter, t) : (this.cache.set(t, { data: e, lastAccess: ++this.accessCounter }), this.totalBytes += e.byteLength, this.evict(), t);
272
272
  }
273
273
  /** Remove a blob from the cache. */
@@ -330,7 +330,7 @@ class $r {
330
330
  }
331
331
  }
332
332
  }
333
- class ie {
333
+ class oe {
334
334
  constructor() {
335
335
  m(this, "_events", /* @__PURE__ */ new Map());
336
336
  m(this, "_maxListeners", 10);
@@ -391,7 +391,7 @@ class ie {
391
391
  return s || (s = [], this._events.set(e, s)), s.unshift(t), this;
392
392
  }
393
393
  }
394
- function Le(r) {
394
+ function Te(r) {
395
395
  return typeof r.unlink == "function" && typeof r.mkdir == "function" && typeof r.rmdir == "function" && typeof r.rename == "function" && typeof r.copyFile == "function";
396
396
  }
397
397
  class kr {
@@ -402,7 +402,7 @@ class kr {
402
402
  * during lookup is always the most specific.
403
403
  */
404
404
  m(this, "mounts", []);
405
- m(this, "emitter", new ie());
405
+ m(this, "emitter", new oe());
406
406
  m(this, "onChange");
407
407
  /** Content store for chunked large files. Optional -- without it all data stays inline. */
408
408
  m(this, "contentStore");
@@ -437,7 +437,7 @@ class kr {
437
437
  unmount(e) {
438
438
  const t = this.toAbsolute(e), s = this.mounts.findIndex((n) => n.path === t);
439
439
  if (s === -1)
440
- throw new T(N.EINVAL, `'${e}': not mounted`);
440
+ throw new _(N.EINVAL, `'${e}': not mounted`);
441
441
  this.mounts.splice(s, 1);
442
442
  }
443
443
  /**
@@ -483,18 +483,18 @@ class kr {
483
483
  let n = this.root;
484
484
  for (const i of s) {
485
485
  if (n.type !== "directory")
486
- throw new T(N.ENOTDIR, `'${e}': not a directory`);
486
+ throw new _(N.ENOTDIR, `'${e}': not a directory`);
487
487
  const o = n.children.get(i);
488
488
  if (!o)
489
- throw new T(N.ENOENT, `'${e}': no such file or directory`);
489
+ throw new _(N.ENOENT, `'${e}': no such file or directory`);
490
490
  n = o;
491
491
  }
492
492
  return n;
493
493
  }
494
494
  resolveParent(e) {
495
- const t = this.toAbsolute(e), s = te(t), n = Ee(t), i = this.resolveNode(s);
495
+ const t = this.toAbsolute(e), s = te(t), n = xe(t), i = this.resolveNode(s);
496
496
  if (i.type !== "directory")
497
- throw new T(N.ENOTDIR, `'${s}': not a directory`);
497
+ throw new _(N.ENOTDIR, `'${s}': not a directory`);
498
498
  return { parent: i, name: n };
499
499
  }
500
500
  toAbsolute(e) {
@@ -506,7 +506,7 @@ class kr {
506
506
  if (t) return t.provider.readFile(t.subpath);
507
507
  const s = this.resolveNode(e);
508
508
  if (s.type === "directory")
509
- throw new T(N.EISDIR, `'${e}': is a directory`);
509
+ throw new _(N.EISDIR, `'${e}': is a directory`);
510
510
  if (s.chunks) {
511
511
  const n = this.contentStore.loadChunked(s.chunks);
512
512
  return n || new Uint8Array(0);
@@ -515,7 +515,7 @@ class kr {
515
515
  }
516
516
  readFileString(e) {
517
517
  const t = this.getProvider(e);
518
- return t ? t.provider.readFileString(t.subpath) : Ne(this.readFile(e));
518
+ return t ? t.provider.readFileString(t.subpath) : je(this.readFile(e));
519
519
  }
520
520
  writeFile(e, t) {
521
521
  const s = this.getProvider(e);
@@ -524,12 +524,12 @@ class kr {
524
524
  s.provider.writeFile(s.subpath, t);
525
525
  return;
526
526
  }
527
- throw new T(N.EINVAL, `'${e}': read-only virtual filesystem`);
527
+ throw new _(N.EINVAL, `'${e}': read-only virtual filesystem`);
528
528
  }
529
529
  const n = typeof t == "string" ? ge(t) : t, i = this.toAbsolute(e), { parent: o, name: a } = this.resolveParent(e), c = mr(a), l = o.children.get(a);
530
530
  if (l) {
531
531
  if (l.type === "directory")
532
- throw new T(N.EISDIR, `'${e}': is a directory`);
532
+ throw new _(N.EISDIR, `'${e}': is a directory`);
533
533
  l.chunks && this.contentStore.deleteChunked(l.chunks), this.applyFileContent(l, n), l.mtime = Date.now(), l.mime = c, this.notify({ type: "modify", path: i, fileType: "file" });
534
534
  } else {
535
535
  const d = this.createNode("file", a);
@@ -547,7 +547,7 @@ class kr {
547
547
  try {
548
548
  const n = this.resolveNode(e);
549
549
  if (n.type === "directory")
550
- throw new T(N.EISDIR, `'${e}': is a directory`);
550
+ throw new _(N.EISDIR, `'${e}': is a directory`);
551
551
  if (n.chunks) {
552
552
  const i = this.contentStore.loadChunked(n.chunks) ?? new Uint8Array(0), o = new Uint8Array(i.byteLength + s.byteLength);
553
553
  o.set(i, 0), o.set(s, i.byteLength), this.contentStore.deleteChunked(n.chunks), this.applyFileContent(n, o);
@@ -557,7 +557,7 @@ class kr {
557
557
  }
558
558
  n.mtime = Date.now(), this.notify({ type: "modify", path: this.toAbsolute(e), fileType: "file" });
559
559
  } catch (n) {
560
- if (n instanceof T && n.code === "ENOENT")
560
+ if (n instanceof _ && n.code === "ENOENT")
561
561
  this.writeFile(e, s);
562
562
  else
563
563
  throw n;
@@ -587,38 +587,38 @@ class kr {
587
587
  unlink(e) {
588
588
  const t = this.toAbsolute(e), s = this.getProvider(e);
589
589
  if (s) {
590
- if (Le(s.provider)) {
590
+ if (Te(s.provider)) {
591
591
  s.provider.unlink(s.subpath);
592
592
  return;
593
593
  }
594
- throw new T(N.EINVAL, `'${e}': read-only virtual filesystem`);
594
+ throw new _(N.EINVAL, `'${e}': read-only virtual filesystem`);
595
595
  }
596
596
  const { parent: n, name: i } = this.resolveParent(e), o = n.children.get(i);
597
597
  if (!o)
598
- throw new T(N.ENOENT, `'${e}': no such file or directory`);
598
+ throw new _(N.ENOENT, `'${e}': no such file or directory`);
599
599
  if (o.type === "directory")
600
- throw new T(N.EISDIR, `'${e}': is a directory`);
600
+ throw new _(N.EISDIR, `'${e}': is a directory`);
601
601
  o.chunks && this.contentStore.deleteChunked(o.chunks), n.children.delete(i), this.notify({ type: "delete", path: t, fileType: "file" });
602
602
  }
603
603
  rename(e, t) {
604
604
  const s = this.toAbsolute(e), n = this.toAbsolute(t), i = this.getProvider(e), o = this.getProvider(t);
605
- if (i && o && i.provider === o.provider && Le(i.provider)) {
605
+ if (i && o && i.provider === o.provider && Te(i.provider)) {
606
606
  i.provider.rename(i.subpath, o.subpath);
607
607
  return;
608
608
  }
609
609
  if (i)
610
- throw new T(N.EINVAL, `'${e}': cannot rename across mount boundaries`);
610
+ throw new _(N.EINVAL, `'${e}': cannot rename across mount boundaries`);
611
611
  const { parent: a, name: c } = this.resolveParent(e), l = a.children.get(c);
612
612
  if (!l)
613
- throw new T(N.ENOENT, `'${e}': no such file or directory`);
613
+ throw new _(N.ENOENT, `'${e}': no such file or directory`);
614
614
  if (o)
615
- throw new T(N.EINVAL, `'${t}': cannot rename across mount boundaries`);
615
+ throw new _(N.EINVAL, `'${t}': cannot rename across mount boundaries`);
616
616
  const { parent: d, name: h } = this.resolveParent(t);
617
617
  l.name = h, l.mtime = Date.now(), d.children.set(h, l), a.children.delete(c), this.notify({ type: "rename", path: n, oldPath: s, fileType: l.type });
618
618
  }
619
619
  copyFile(e, t) {
620
620
  const s = this.getProvider(e), n = this.getProvider(t);
621
- if (s && n && s.provider === n.provider && Le(s.provider)) {
621
+ if (s && n && s.provider === n.provider && Te(s.provider)) {
622
622
  s.provider.copyFile(s.subpath, n.subpath);
623
623
  return;
624
624
  }
@@ -630,7 +630,7 @@ class kr {
630
630
  const t = this.resolveNode(e);
631
631
  t.mtime = Date.now(), this.notify({ type: "modify", path: this.toAbsolute(e), fileType: t.type });
632
632
  } catch (t) {
633
- if (t instanceof T && t.code === "ENOENT")
633
+ if (t instanceof _ && t.code === "ENOENT")
634
634
  this.writeFile(e, "");
635
635
  else
636
636
  throw t;
@@ -640,11 +640,11 @@ class kr {
640
640
  mkdir(e, t) {
641
641
  const s = this.getProvider(e);
642
642
  if (s) {
643
- if (Le(s.provider)) {
643
+ if (Te(s.provider)) {
644
644
  s.provider.mkdir(s.subpath, t);
645
645
  return;
646
646
  }
647
- throw new T(N.EINVAL, `'${e}': read-only virtual filesystem`);
647
+ throw new _(N.EINVAL, `'${e}': read-only virtual filesystem`);
648
648
  }
649
649
  if (t != null && t.recursive) {
650
650
  const l = this.toAbsolute(e).split("/").filter(Boolean);
@@ -655,33 +655,33 @@ class kr {
655
655
  if (!g)
656
656
  g = this.createNode("directory", f), d.children.set(f, g), this.notify({ type: "create", path: h, fileType: "directory" });
657
657
  else if (g.type !== "directory")
658
- throw new T(N.ENOTDIR, `'${f}': not a directory`);
658
+ throw new _(N.ENOTDIR, `'${f}': not a directory`);
659
659
  d = g;
660
660
  }
661
661
  return;
662
662
  }
663
663
  const n = this.toAbsolute(e), { parent: i, name: o } = this.resolveParent(e);
664
664
  if (i.children.has(o))
665
- throw new T(N.EEXIST, `'${e}': file exists`);
665
+ throw new _(N.EEXIST, `'${e}': file exists`);
666
666
  const a = this.createNode("directory", o);
667
667
  i.children.set(o, a), this.notify({ type: "create", path: n, fileType: "directory" });
668
668
  }
669
669
  rmdir(e) {
670
670
  const t = this.toAbsolute(e), s = this.getProvider(e);
671
671
  if (s) {
672
- if (Le(s.provider)) {
672
+ if (Te(s.provider)) {
673
673
  s.provider.rmdir(s.subpath);
674
674
  return;
675
675
  }
676
- throw new T(N.EINVAL, `'${e}': read-only virtual filesystem`);
676
+ throw new _(N.EINVAL, `'${e}': read-only virtual filesystem`);
677
677
  }
678
678
  const { parent: n, name: i } = this.resolveParent(e), o = n.children.get(i);
679
679
  if (!o)
680
- throw new T(N.ENOENT, `'${e}': no such file or directory`);
680
+ throw new _(N.ENOENT, `'${e}': no such file or directory`);
681
681
  if (o.type !== "directory")
682
- throw new T(N.ENOTDIR, `'${e}': not a directory`);
682
+ throw new _(N.ENOTDIR, `'${e}': not a directory`);
683
683
  if (o.children.size > 0)
684
- throw new T(N.ENOTEMPTY, `'${e}': directory not empty`);
684
+ throw new _(N.ENOTEMPTY, `'${e}': directory not empty`);
685
685
  n.children.delete(i), this.notify({ type: "delete", path: t, fileType: "directory" });
686
686
  }
687
687
  readdir(e) {
@@ -689,7 +689,7 @@ class kr {
689
689
  if (t) return t.provider.readdir(t.subpath);
690
690
  const s = this.resolveNode(e);
691
691
  if (s.type !== "directory")
692
- throw new T(N.ENOTDIR, `'${e}': not a directory`);
692
+ throw new _(N.ENOTDIR, `'${e}': not a directory`);
693
693
  const n = Array.from(s.children.values()).map((a) => ({
694
694
  name: a.name,
695
695
  type: a.type
@@ -709,7 +709,7 @@ class kr {
709
709
  });
710
710
  const s = this.resolveNode(e);
711
711
  if (s.type !== "directory")
712
- throw new T(N.ENOTDIR, `'${e}': not a directory`);
712
+ throw new _(N.ENOTDIR, `'${e}': not a directory`);
713
713
  return Array.from(s.children.values()).map((n) => {
714
714
  const i = {
715
715
  name: n.name,
@@ -728,7 +728,7 @@ class kr {
728
728
  rmdirRecursive(e) {
729
729
  const t = this.resolveNode(e);
730
730
  if (t.type !== "directory")
731
- throw new T(N.ENOTDIR, `'${e}': not a directory`);
731
+ throw new _(N.ENOTDIR, `'${e}': not a directory`);
732
732
  const s = this.toAbsolute(e);
733
733
  for (const n of t.children.values()) {
734
734
  const i = s === "/" ? `/${n.name}` : `${s}/${n.name}`;
@@ -751,7 +751,7 @@ class Er {
751
751
  if (o !== ".")
752
752
  if (o === "..") {
753
753
  if (n.length === 0)
754
- throw new T(N.EINVAL, `path '${e}' escapes mount root`);
754
+ throw new _(N.EINVAL, `path '${e}' escapes mount root`);
755
755
  n.pop();
756
756
  } else
757
757
  n.push(o);
@@ -760,7 +760,7 @@ class Er {
760
760
  }
761
761
  assertWritable() {
762
762
  if (this.readOnly)
763
- throw new T(N.EINVAL, "filesystem is mounted read-only");
763
+ throw new _(N.EINVAL, "filesystem is mounted read-only");
764
764
  }
765
765
  // ─── Read operations ───
766
766
  readFile(e) {
@@ -862,9 +862,9 @@ class Er {
862
862
  }
863
863
  // ─── Error mapping ───
864
864
  wrapError(e, t) {
865
- if (e instanceof T) return e;
865
+ if (e instanceof _) return e;
866
866
  const s = e instanceof Error ? e.message : String(e), n = e == null ? void 0 : e.code;
867
- return n === "ENOENT" ? new T(N.ENOENT, `'${t}': ${s}`) : n === "EEXIST" ? new T(N.EEXIST, `'${t}': ${s}`) : n === "EISDIR" ? new T(N.EISDIR, `'${t}': ${s}`) : n === "ENOTDIR" ? new T(N.ENOTDIR, `'${t}': ${s}`) : n === "ENOTEMPTY" ? new T(N.ENOTEMPTY, `'${t}': ${s}`) : new T(N.EINVAL, `'${t}': ${s}`);
867
+ return n === "ENOENT" ? new _(N.ENOENT, `'${t}': ${s}`) : n === "EEXIST" ? new _(N.EEXIST, `'${t}': ${s}`) : n === "EISDIR" ? new _(N.EISDIR, `'${t}': ${s}`) : n === "ENOTDIR" ? new _(N.ENOTDIR, `'${t}': ${s}`) : n === "ENOTEMPTY" ? new _(N.ENOTEMPTY, `'${t}': ${s}`) : new _(N.EINVAL, `'${t}': ${s}`);
868
868
  }
869
869
  }
870
870
  class xr {
@@ -924,7 +924,7 @@ class xr {
924
924
  return this.getNetInfo();
925
925
  const s = this.generators.get(t);
926
926
  if (!s)
927
- throw new T(N.ENOENT, `'/proc${e}': no such file`);
927
+ throw new _(N.ENOENT, `'/proc${e}': no such file`);
928
928
  return s();
929
929
  }
930
930
  readFile(e) {
@@ -940,7 +940,7 @@ class xr {
940
940
  }
941
941
  stat(e) {
942
942
  if (!this.exists(e))
943
- throw new T(N.ENOENT, `'/proc${e}': no such file`);
943
+ throw new _(N.ENOENT, `'/proc${e}': no such file`);
944
944
  return e === "/" || e === "/net" ? { type: "directory", size: 0, ctime: 0, mtime: Date.now(), mode: 365 } : {
945
945
  type: "file",
946
946
  size: this.generate(e).length,
@@ -958,10 +958,10 @@ class xr {
958
958
  }
959
959
  if (e === "/net")
960
960
  return [{ name: "info", type: "file" }];
961
- throw new T(N.ENOTDIR, `'/proc${e}': not a directory`);
961
+ throw new _(N.ENOTDIR, `'/proc${e}': not a directory`);
962
962
  }
963
963
  }
964
- const rt = ["null", "zero", "random", "urandom", "clipboard"];
964
+ const it = ["null", "zero", "random", "urandom", "clipboard"];
965
965
  class Cr {
966
966
  constructor() {
967
967
  m(this, "clipboardCache", "");
@@ -980,7 +980,7 @@ class Cr {
980
980
  case "clipboard":
981
981
  return ge(this.clipboardCache);
982
982
  default:
983
- throw new T(N.ENOENT, `'/dev${e}': no such device`);
983
+ throw new _(N.ENOENT, `'/dev${e}': no such device`);
984
984
  }
985
985
  }
986
986
  readFileString(e) {
@@ -997,7 +997,7 @@ class Cr {
997
997
  case "clipboard":
998
998
  return this.clipboardCache;
999
999
  default:
1000
- throw new T(N.ENOENT, `'/dev${e}': no such device`);
1000
+ throw new _(N.ENOENT, `'/dev${e}': no such device`);
1001
1001
  }
1002
1002
  }
1003
1003
  writeFile(e, t) {
@@ -1012,23 +1012,23 @@ class Cr {
1012
1012
  return;
1013
1013
  }
1014
1014
  default:
1015
- throw new T(N.EINVAL, `'/dev${e}': cannot write to device`);
1015
+ throw new _(N.EINVAL, `'/dev${e}': cannot write to device`);
1016
1016
  }
1017
1017
  }
1018
1018
  exists(e) {
1019
1019
  if (e === "/") return !0;
1020
1020
  const t = e.startsWith("/") ? e.slice(1) : e;
1021
- return rt.includes(t);
1021
+ return it.includes(t);
1022
1022
  }
1023
1023
  stat(e) {
1024
1024
  if (!this.exists(e))
1025
- throw new T(N.ENOENT, `'/dev${e}': no such device`);
1026
- return e === "/" ? { type: "directory", size: rt.length, ctime: 0, mtime: 0, mode: 493 } : { type: "file", size: 0, ctime: 0, mtime: 0, mode: 438 };
1025
+ throw new _(N.ENOENT, `'/dev${e}': no such device`);
1026
+ return e === "/" ? { type: "directory", size: it.length, ctime: 0, mtime: 0, mode: 493 } : { type: "file", size: 0, ctime: 0, mtime: 0, mode: 438 };
1027
1027
  }
1028
1028
  readdir(e) {
1029
1029
  if (e === "/")
1030
- return rt.map((t) => ({ name: t, type: "file" }));
1031
- throw new T(N.ENOTDIR, `'/dev${e}': not a directory`);
1030
+ return it.map((t) => ({ name: t, type: "file" }));
1031
+ throw new _(N.ENOTDIR, `'/dev${e}': not a directory`);
1032
1032
  }
1033
1033
  }
1034
1034
  const Lr = ["proc", "dev"];
@@ -1038,13 +1038,13 @@ function Rr(r) {
1038
1038
  e += String.fromCharCode(r[t]);
1039
1039
  return btoa(e);
1040
1040
  }
1041
- function Pr(r) {
1041
+ function Tr(r) {
1042
1042
  const e = atob(r), t = new Uint8Array(e.length);
1043
1043
  for (let s = 0; s < e.length; s++)
1044
1044
  t[s] = e.charCodeAt(s);
1045
1045
  return t;
1046
1046
  }
1047
- function Tr(r) {
1047
+ function _r(r) {
1048
1048
  return Qt(r, !0);
1049
1049
  }
1050
1050
  function Qt(r, e) {
@@ -1070,7 +1070,7 @@ function Qt(r, e) {
1070
1070
  };
1071
1071
  return t.length > 0 && (s.c = t), s;
1072
1072
  }
1073
- function _r(r) {
1073
+ function Pr(r) {
1074
1074
  return Kt(r);
1075
1075
  }
1076
1076
  function Kt(r) {
@@ -1083,7 +1083,7 @@ function Kt(r) {
1083
1083
  const t = {
1084
1084
  type: r.t === "f" ? "file" : "directory",
1085
1085
  name: r.n,
1086
- data: r.d ? Pr(r.d) : new Uint8Array(0),
1086
+ data: r.d ? Tr(r.d) : new Uint8Array(0),
1087
1087
  children: e,
1088
1088
  ctime: r.ct,
1089
1089
  mtime: r.mt,
@@ -1091,8 +1091,8 @@ function Kt(r) {
1091
1091
  };
1092
1092
  return r.mi && (t.mime = r.mi), r.br && (t.blobRef = r.br), r.ch && (t.chunks = r.ch.map((s) => ({ hash: s.h, size: s.s }))), r.sz !== void 0 && (t.storedSize = r.sz), t;
1093
1093
  }
1094
- const Ar = 1e3;
1095
- class Ir {
1094
+ const Ir = 1e3;
1095
+ class Ar {
1096
1096
  constructor(e) {
1097
1097
  m(this, "timer", null);
1098
1098
  this.backend = e;
@@ -1105,7 +1105,7 @@ class Ir {
1105
1105
  const e = await this.backend.loadTree();
1106
1106
  if (e)
1107
1107
  try {
1108
- return _r(e);
1108
+ return Pr(e);
1109
1109
  } catch {
1110
1110
  return null;
1111
1111
  }
@@ -1116,7 +1116,7 @@ class Ir {
1116
1116
  }
1117
1117
  async save(e) {
1118
1118
  try {
1119
- const t = Tr(e);
1119
+ const t = _r(e);
1120
1120
  await this.backend.saveTree(t);
1121
1121
  } catch {
1122
1122
  }
@@ -1125,7 +1125,7 @@ class Ir {
1125
1125
  this.timer && clearTimeout(this.timer), this.timer = setTimeout(() => {
1126
1126
  this.save(e).catch(() => {
1127
1127
  }), this.timer = null;
1128
- }, Ar);
1128
+ }, Ir);
1129
1129
  }
1130
1130
  }
1131
1131
  const Nr = "lifo", ve = "filesystem", Lt = "root";
@@ -1174,7 +1174,7 @@ class Fr {
1174
1174
  this.db && (this.db.close(), this.db = null);
1175
1175
  }
1176
1176
  }
1177
- class eo {
1177
+ class to {
1178
1178
  constructor() {
1179
1179
  m(this, "tree", null);
1180
1180
  }
@@ -2116,7 +2116,7 @@ tree /home/user -L 2
2116
2116
 
2117
2117
  echo "Done."
2118
2118
  `
2119
- }, Br = `\x1B[1;36m
2119
+ }, zr = `\x1B[1;36m
2120
2120
  _ _ __
2121
2121
  | | (_)/ _| ___
2122
2122
  | | | | |_ / _ \\
@@ -2126,7 +2126,7 @@ echo "Done."
2126
2126
  \x1B[2mA Linux-like OS running natively in your browser.\x1B[0m
2127
2127
  \x1B[2mType 'help' or try: ls, cd, cat, mkdir, touch\x1B[0m
2128
2128
  \x1B[2mExplore examples: ls ~/examples/scripts\x1B[0m
2129
- `, zr = `export PATH=/usr/bin:/bin
2129
+ `, Br = `export PATH=/usr/bin:/bin
2130
2130
  export EDITOR=nano
2131
2131
  `, Mr = `# Aliases
2132
2132
  alias ll='ls -la'
@@ -2141,7 +2141,7 @@ class Dr {
2141
2141
  m(this, "vfs");
2142
2142
  m(this, "portRegistry", /* @__PURE__ */ new Map());
2143
2143
  m(this, "persistence");
2144
- this.vfs = new kr(), this.persistence = new Ir(
2144
+ this.vfs = new kr(), this.persistence = new Ar(
2145
2145
  e ?? new Fr()
2146
2146
  );
2147
2147
  }
@@ -2176,8 +2176,8 @@ class Dr {
2176
2176
  this.vfs.mkdir(t, { recursive: !0 });
2177
2177
  } catch {
2178
2178
  }
2179
- this.vfs.writeFile("/etc/motd", Br), this.vfs.writeFile("/etc/hostname", `lifo
2180
- `), this.vfs.exists("/etc/profile") || this.vfs.writeFile("/etc/profile", zr), this.vfs.exists("/home/user/.bashrc") || this.vfs.writeFile("/home/user/.bashrc", Mr), jr(this.vfs);
2179
+ this.vfs.writeFile("/etc/motd", zr), this.vfs.writeFile("/etc/hostname", `lifo
2180
+ `), this.vfs.exists("/etc/profile") || this.vfs.writeFile("/etc/profile", Br), this.vfs.exists("/home/user/.bashrc") || this.vfs.writeFile("/home/user/.bashrc", Mr), jr(this.vfs);
2181
2181
  }
2182
2182
  getDefaultEnv() {
2183
2183
  return {
@@ -2191,29 +2191,29 @@ class Dr {
2191
2191
  };
2192
2192
  }
2193
2193
  }
2194
- const ee = "\x1B[0m", Te = "\x1B[1m", Wr = "\x1B[2m", to = "\x1B[3m", so = "\x1B[4m", Ur = "\x1B[31m", lt = "\x1B[32m", qr = "\x1B[33m", ht = "\x1B[34m", Hr = "\x1B[35m", Vr = "\x1B[36m", ro = "\x1B[37m", no = "\x1B[91m", io = "\x1B[92m", oo = "\x1B[93m", ao = "\x1B[94m", co = "\x1B[95m", lo = "\x1B[96m";
2195
- function ho(r) {
2196
- return Ur + r + ee;
2197
- }
2194
+ const ee = "\x1B[0m", Ie = "\x1B[1m", Wr = "\x1B[2m", so = "\x1B[3m", ro = "\x1B[4m", Ur = "\x1B[31m", ut = "\x1B[32m", qr = "\x1B[33m", dt = "\x1B[34m", Hr = "\x1B[35m", Vr = "\x1B[36m", no = "\x1B[37m", io = "\x1B[91m", oo = "\x1B[92m", ao = "\x1B[93m", co = "\x1B[94m", lo = "\x1B[95m", ho = "\x1B[96m";
2198
2195
  function uo(r) {
2199
- return lt + r + ee;
2196
+ return Ur + r + ee;
2200
2197
  }
2201
2198
  function fo(r) {
2202
- return qr + r + ee;
2199
+ return ut + r + ee;
2203
2200
  }
2204
2201
  function po(r) {
2205
- return ht + r + ee;
2202
+ return qr + r + ee;
2206
2203
  }
2207
2204
  function mo(r) {
2208
- return Hr + r + ee;
2205
+ return dt + r + ee;
2209
2206
  }
2210
2207
  function go(r) {
2211
- return Vr + r + ee;
2208
+ return Hr + r + ee;
2212
2209
  }
2213
2210
  function wo(r) {
2214
- return Te + r + ee;
2211
+ return Vr + r + ee;
2215
2212
  }
2216
2213
  function yo(r) {
2214
+ return Ie + r + ee;
2215
+ }
2216
+ function vo(r) {
2217
2217
  return Wr + r + ee;
2218
2218
  }
2219
2219
  var b = /* @__PURE__ */ ((r) => (r[r.Word = 0] = "Word", r[r.Pipe = 1] = "Pipe", r[r.And = 2] = "And", r[r.Or = 3] = "Or", r[r.Semi = 4] = "Semi", r[r.Amp = 5] = "Amp", r[r.RedirectOut = 6] = "RedirectOut", r[r.RedirectAppend = 7] = "RedirectAppend", r[r.RedirectIn = 8] = "RedirectIn", r[r.RedirectErr = 9] = "RedirectErr", r[r.RedirectErrAppend = 10] = "RedirectErrAppend", r[r.RedirectAll = 11] = "RedirectAll", r[r.DoubleSemi = 12] = "DoubleSemi", r[r.LParen = 13] = "LParen", r[r.RParen = 14] = "RParen", r[r.Newline = 15] = "Newline", r[r.EOF = 16] = "EOF", r))(b || {});
@@ -2288,7 +2288,7 @@ function Yr(r, e) {
2288
2288
  const l = r[s + 1];
2289
2289
  l === '"' || l === "\\" || l === "$" || l === "`" ? (c += l, s += 2) : (c += "\\", s++);
2290
2290
  } else if (r[s] === "$" && r[s + 1] === "(") {
2291
- const l = Pt(r, s);
2291
+ const l = Tt(r, s);
2292
2292
  c += l.text, s = l.end;
2293
2293
  } else
2294
2294
  c += r[s], s++;
@@ -2296,7 +2296,7 @@ function Yr(r, e) {
2296
2296
  continue;
2297
2297
  }
2298
2298
  if (a === "$" && r[s + 1] === "(") {
2299
- const c = Pt(r, s);
2299
+ const c = Tt(r, s);
2300
2300
  n += c.text, s = c.end, i = !0;
2301
2301
  continue;
2302
2302
  }
@@ -2327,7 +2327,7 @@ function Yr(r, e) {
2327
2327
  end: s
2328
2328
  };
2329
2329
  }
2330
- function Pt(r, e) {
2330
+ function Tt(r, e) {
2331
2331
  let t = e + 1;
2332
2332
  if (r[t] !== "(")
2333
2333
  return { text: "$", end: e + 1 };
@@ -2358,12 +2358,12 @@ function Pt(r, e) {
2358
2358
  }
2359
2359
  return { text: n, end: t };
2360
2360
  }
2361
- class Tt extends Error {
2361
+ class _t extends Error {
2362
2362
  constructor(e, t) {
2363
2363
  super(e), this.pos = t, this.name = "ParseError";
2364
2364
  }
2365
2365
  }
2366
- function _t(r) {
2366
+ function Pt(r) {
2367
2367
  return new Qr(r).parseScript();
2368
2368
  }
2369
2369
  const Xr = /* @__PURE__ */ new Set([
@@ -2400,7 +2400,7 @@ class Qr {
2400
2400
  expect(e) {
2401
2401
  const t = this.peek();
2402
2402
  if (t.kind !== e)
2403
- throw new Tt(
2403
+ throw new _t(
2404
2404
  `Expected ${b[e]} but got ${b[t.kind]} ('${t.value}')`,
2405
2405
  t.pos
2406
2406
  );
@@ -2409,7 +2409,7 @@ class Qr {
2409
2409
  expectWord(e) {
2410
2410
  const t = this.peek();
2411
2411
  if (t.kind !== b.Word || t.value !== e)
2412
- throw new Tt(
2412
+ throw new _t(
2413
2413
  `Expected '${e}' but got '${t.value}'`,
2414
2414
  t.pos
2415
2415
  );
@@ -2683,13 +2683,13 @@ function Kr(r, e, t) {
2683
2683
  return s < r.length && r[s] === "]" && s++, { matched: n ? !i : i, end: s };
2684
2684
  }
2685
2685
  function en(r, e, t) {
2686
- if (!At(r))
2686
+ if (!It(r))
2687
2687
  return [r];
2688
2688
  const n = (r.startsWith("/") ? r : D(e, r)).split("/").filter(Boolean), i = r.startsWith("/");
2689
2689
  let o = ["/"];
2690
2690
  for (const c of n) {
2691
2691
  const l = [];
2692
- if (At(c))
2692
+ if (It(c))
2693
2693
  for (const d of o)
2694
2694
  try {
2695
2695
  const h = t.readdir(d);
@@ -2718,10 +2718,10 @@ function en(r, e, t) {
2718
2718
  }
2719
2719
  return a.sort();
2720
2720
  }
2721
- function At(r) {
2721
+ function It(r) {
2722
2722
  return r.includes("*") || r.includes("?") || r.includes("[");
2723
2723
  }
2724
- async function It(r, e) {
2724
+ async function At(r, e) {
2725
2725
  const t = [];
2726
2726
  for (const s of r) {
2727
2727
  const n = await es(s, e);
@@ -2733,7 +2733,7 @@ async function It(r, e) {
2733
2733
  }
2734
2734
  return t;
2735
2735
  }
2736
- async function Re(r, e) {
2736
+ async function _e(r, e) {
2737
2737
  return es(r, e);
2738
2738
  }
2739
2739
  async function es(r, e) {
@@ -3268,7 +3268,7 @@ class ue {
3268
3268
  this.levels = e;
3269
3269
  }
3270
3270
  }
3271
- class nt {
3271
+ class ot {
3272
3272
  constructor(e) {
3273
3273
  this.exitCode = e;
3274
3274
  }
@@ -3291,10 +3291,10 @@ class hn {
3291
3291
  }
3292
3292
  async executeLine(e, t) {
3293
3293
  try {
3294
- const s = Rt(e), n = _t(s);
3294
+ const s = Rt(e), n = Pt(s);
3295
3295
  return await this.executeScript(n, t);
3296
3296
  } catch (s) {
3297
- if (s instanceof he || s instanceof ue || s instanceof nt)
3297
+ if (s instanceof he || s instanceof ue || s instanceof ot)
3298
3298
  throw s;
3299
3299
  return s instanceof Error && this.config.writeToTerminal(`${s.message}
3300
3300
  `), this.lastExitCode = 2, 2;
@@ -3373,7 +3373,7 @@ class hn {
3373
3373
  const s = this.createExpandContext();
3374
3374
  let n = 0, i;
3375
3375
  if (e.words !== null)
3376
- i = await It(e.words, s);
3376
+ i = await At(e.words, s);
3377
3377
  else {
3378
3378
  const o = this.config.env["@"] ?? "";
3379
3379
  i = o ? o.split(" ") : [];
@@ -3433,11 +3433,11 @@ class hn {
3433
3433
  return this.lastExitCode = s, s;
3434
3434
  }
3435
3435
  async executeCase(e, t) {
3436
- const s = this.createExpandContext(), n = await Re(e.word, s);
3436
+ const s = this.createExpandContext(), n = await _e(e.word, s);
3437
3437
  let i = 0;
3438
3438
  for (const o of e.items)
3439
3439
  for (const a of o.patterns) {
3440
- const c = await Re(a, s);
3440
+ const c = await _e(a, s);
3441
3441
  if (de(c, n))
3442
3442
  return i = await this.executeCompoundList(o.body, t), this.lastExitCode = i, i;
3443
3443
  }
@@ -3457,12 +3457,12 @@ class hn {
3457
3457
  return s;
3458
3458
  }
3459
3459
  async executeSimpleCommand(e, t, s, n) {
3460
- var k, _;
3461
- const i = this.createExpandContext(), o = await It(e.words, i);
3460
+ var k, P;
3461
+ const i = this.createExpandContext(), o = await At(e.words, i);
3462
3462
  if (o.length === 0 && e.assignments.length > 0) {
3463
- for (const C of e.assignments) {
3464
- const A = await Re(C.value, i);
3465
- this.config.env[C.name] = A;
3463
+ for (const L of e.assignments) {
3464
+ const I = await _e(L.value, i);
3465
+ this.config.env[L.name] = I;
3466
3466
  }
3467
3467
  return 0;
3468
3468
  }
@@ -3470,25 +3470,25 @@ class hn {
3470
3470
  return 0;
3471
3471
  const [a, ...c] = o, l = this.config.aliases;
3472
3472
  if (l) {
3473
- const C = l.get(a);
3474
- if (C !== void 0) {
3475
- const A = C + (c.length > 0 ? " " + c.join(" ") : "");
3476
- return this.executeLine(A);
3473
+ const L = l.get(a);
3474
+ if (L !== void 0) {
3475
+ const I = L + (c.length > 0 ? " " + c.join(" ") : "");
3476
+ return this.executeLine(I);
3477
3477
  }
3478
3478
  }
3479
3479
  const d = {};
3480
- for (const C of e.assignments) {
3481
- const A = await Re(C.value, i);
3482
- d[C.name] = this.config.env[C.name], this.config.env[C.name] = A;
3480
+ for (const L of e.assignments) {
3481
+ const I = await _e(L.value, i);
3482
+ d[L.name] = this.config.env[L.name], this.config.env[L.name] = I;
3483
3483
  }
3484
3484
  let h = s ?? this.config.defaultStdout ?? {
3485
- write: (C) => this.config.writeToTerminal(C)
3485
+ write: (L) => this.config.writeToTerminal(L)
3486
3486
  }, f = this.config.defaultStderr ?? {
3487
- write: (C) => this.config.writeToTerminal(C)
3487
+ write: (L) => this.config.writeToTerminal(L)
3488
3488
  }, g = t;
3489
- for (const C of e.redirections) {
3490
- const A = await Re(C.target, i), $ = D(this.config.getCwd(), A);
3491
- switch (C.operator) {
3489
+ for (const L of e.redirections) {
3490
+ const I = await _e(L.target, i), $ = D(this.config.getCwd(), I);
3491
+ switch (L.operator) {
3492
3492
  case ">":
3493
3493
  this.config.vfs.writeFile($, ""), h = this.createFileWriter($);
3494
3494
  break;
@@ -3510,34 +3510,34 @@ class hn {
3510
3510
  }
3511
3511
  }
3512
3512
  !g && n && (g = n);
3513
- let I;
3513
+ let A;
3514
3514
  try {
3515
3515
  if (a === "break") {
3516
- const A = c[0] ? parseInt(c[0], 10) : 1;
3517
- throw new he(A);
3516
+ const I = c[0] ? parseInt(c[0], 10) : 1;
3517
+ throw new he(I);
3518
3518
  }
3519
3519
  if (a === "continue") {
3520
- const A = c[0] ? parseInt(c[0], 10) : 1;
3521
- throw new ue(A);
3520
+ const I = c[0] ? parseInt(c[0], 10) : 1;
3521
+ throw new ue(I);
3522
3522
  }
3523
3523
  if (a === "return") {
3524
- const A = c[0] ? parseInt(c[0], 10) : this.lastExitCode;
3525
- throw new nt(A);
3524
+ const I = c[0] ? parseInt(c[0], 10) : this.lastExitCode;
3525
+ throw new ot(I);
3526
3526
  }
3527
- const C = this.functions.get(a);
3528
- if (C)
3529
- I = await this.executeFunction(C, c);
3527
+ const L = this.functions.get(a);
3528
+ if (L)
3529
+ A = await this.executeFunction(L, c);
3530
3530
  else {
3531
- const A = this.config.builtins.get(a);
3532
- if (A)
3533
- I = await A(c, h, f, g);
3531
+ const I = this.config.builtins.get(a);
3532
+ if (I)
3533
+ A = await I(c, h, f, g);
3534
3534
  else {
3535
3535
  const $ = await this.config.registry.resolve(a);
3536
3536
  if (!$)
3537
3537
  this.config.writeToTerminal(`${a}: command not found
3538
- `), I = 127;
3538
+ `), A = 127;
3539
3539
  else {
3540
- const j = ((_ = (k = this.config).getAbortSignal) == null ? void 0 : _.call(k)) ?? new AbortController().signal, v = {
3540
+ const j = ((P = (k = this.config).getAbortSignal) == null ? void 0 : P.call(k)) ?? new AbortController().signal, v = {
3541
3541
  args: c,
3542
3542
  env: { ...this.config.env },
3543
3543
  cwd: this.config.getCwd(),
@@ -3548,19 +3548,19 @@ class hn {
3548
3548
  stdin: g
3549
3549
  };
3550
3550
  try {
3551
- I = await $(v);
3551
+ A = await $(v);
3552
3552
  } catch (x) {
3553
- x instanceof Error && x.name === "AbortError" ? I = 130 : (f.write(`${a}: ${x instanceof Error ? x.message : String(x)}
3554
- `), I = 1);
3553
+ x instanceof Error && x.name === "AbortError" ? A = 130 : (f.write(`${a}: ${x instanceof Error ? x.message : String(x)}
3554
+ `), A = 1);
3555
3555
  }
3556
3556
  }
3557
3557
  }
3558
3558
  }
3559
3559
  } finally {
3560
- for (const [C, A] of Object.entries(d))
3561
- A === void 0 ? delete this.config.env[C] : this.config.env[C] = A;
3560
+ for (const [L, I] of Object.entries(d))
3561
+ I === void 0 ? delete this.config.env[L] : this.config.env[L] = I;
3562
3562
  }
3563
- return this.lastExitCode = I, I;
3563
+ return this.lastExitCode = A, A;
3564
3564
  }
3565
3565
  async executeFunction(e, t) {
3566
3566
  const s = {}, n = ["@", "#"];
@@ -3575,7 +3575,7 @@ class hn {
3575
3575
  try {
3576
3576
  i = await this.executeCommand(e);
3577
3577
  } catch (o) {
3578
- if (o instanceof nt)
3578
+ if (o instanceof ot)
3579
3579
  i = o.exitCode;
3580
3580
  else
3581
3581
  throw o;
@@ -3591,7 +3591,7 @@ class hn {
3591
3591
  write: (o) => {
3592
3592
  t += o;
3593
3593
  }
3594
- }, n = Rt(e), i = _t(n);
3594
+ }, n = Rt(e), i = Pt(n);
3595
3595
  for (const o of i.lists)
3596
3596
  for (const a of o.entries)
3597
3597
  for (const c of a.pipeline.commands)
@@ -3833,7 +3833,7 @@ function bn(r) {
3833
3833
  }
3834
3834
  return e;
3835
3835
  }
3836
- function Bt(r, e, t) {
3836
+ function zt(r, e, t) {
3837
3837
  if (r.length > 0 && r[r.length - 1] === "]" && (r = r.slice(0, -1)), r.length === 0)
3838
3838
  return 1;
3839
3839
  try {
@@ -3849,27 +3849,27 @@ function ss(r, e, t) {
3849
3849
  return Sn(r, e, t);
3850
3850
  }
3851
3851
  function Sn(r, e, t) {
3852
- let s = zt(r, e, t);
3852
+ let s = Bt(r, e, t);
3853
3853
  for (; s.pos < r.length && r[s.pos] === "-o"; ) {
3854
- const n = zt(r, s.pos + 1, t);
3854
+ const n = Bt(r, s.pos + 1, t);
3855
3855
  s = { value: s.value || n.value, pos: n.pos };
3856
3856
  }
3857
3857
  return s;
3858
3858
  }
3859
- function zt(r, e, t) {
3860
- let s = ut(r, e, t);
3859
+ function Bt(r, e, t) {
3860
+ let s = ft(r, e, t);
3861
3861
  for (; s.pos < r.length && r[s.pos] === "-a"; ) {
3862
- const n = ut(r, s.pos + 1, t);
3862
+ const n = ft(r, s.pos + 1, t);
3863
3863
  s = { value: s.value && n.value, pos: n.pos };
3864
3864
  }
3865
3865
  return s;
3866
3866
  }
3867
- function ut(r, e, t) {
3867
+ function ft(r, e, t) {
3868
3868
  if (e >= r.length)
3869
3869
  return { value: !1, pos: e };
3870
3870
  const s = r[e];
3871
3871
  if (s === "!") {
3872
- const n = ut(r, e + 1, t);
3872
+ const n = ft(r, e + 1, t);
3873
3873
  return { value: !n.value, pos: n.pos };
3874
3874
  }
3875
3875
  if (s === "(") {
@@ -4048,7 +4048,7 @@ class kn {
4048
4048
  }, this.interpreter = new hn(this.interpreterConfig);
4049
4049
  }
4050
4050
  registerBuiltins() {
4051
- this.builtins.set("cd", (e, t, s) => this.builtinCd(e, s)), this.builtins.set("pwd", (e, t) => this.builtinPwd(t)), this.builtins.set("echo", (e, t) => this.builtinEcho(e, t)), this.builtins.set("clear", () => this.builtinClear()), this.builtins.set("export", (e) => this.builtinExport(e)), this.builtins.set("exit", (e, t) => this.builtinExit(t)), this.builtins.set("true", () => Promise.resolve(0)), this.builtins.set("false", () => Promise.resolve(1)), this.builtins.set("jobs", (e, t) => this.builtinJobs(t)), this.builtins.set("fg", (e, t, s) => this.builtinFg(e, t, s)), this.builtins.set("bg", (e, t, s) => this.builtinBg(e, t, s)), this.builtins.set("history", (e, t) => this.builtinHistory(t)), this.builtins.set("source", (e, t, s) => this.builtinSource(e, s)), this.builtins.set(".", (e, t, s) => this.builtinSource(e, s)), this.builtins.set("alias", (e, t) => this.builtinAlias(e, t)), this.builtins.set("unalias", (e, t, s) => this.builtinUnalias(e, s)), this.builtins.set("test", (e, t, s) => Promise.resolve(Bt(e, this.vfs, s))), this.builtins.set("[", (e, t, s) => Promise.resolve(Bt(e, this.vfs, s)));
4051
+ this.builtins.set("cd", (e, t, s) => this.builtinCd(e, s)), this.builtins.set("pwd", (e, t) => this.builtinPwd(t)), this.builtins.set("echo", (e, t) => this.builtinEcho(e, t)), this.builtins.set("clear", () => this.builtinClear()), this.builtins.set("export", (e) => this.builtinExport(e)), this.builtins.set("exit", (e, t) => this.builtinExit(t)), this.builtins.set("true", () => Promise.resolve(0)), this.builtins.set("false", () => Promise.resolve(1)), this.builtins.set("jobs", (e, t) => this.builtinJobs(t)), this.builtins.set("fg", (e, t, s) => this.builtinFg(e, t, s)), this.builtins.set("bg", (e, t, s) => this.builtinBg(e, t, s)), this.builtins.set("history", (e, t) => this.builtinHistory(t)), this.builtins.set("source", (e, t, s) => this.builtinSource(e, s)), this.builtins.set(".", (e, t, s) => this.builtinSource(e, s)), this.builtins.set("alias", (e, t) => this.builtinAlias(e, t)), this.builtins.set("unalias", (e, t, s) => this.builtinUnalias(e, s)), this.builtins.set("test", (e, t, s) => Promise.resolve(zt(e, this.vfs, s))), this.builtins.set("[", (e, t, s) => Promise.resolve(zt(e, this.vfs, s)));
4052
4052
  }
4053
4053
  getJobTable() {
4054
4054
  return this.jobTable;
@@ -4114,7 +4114,7 @@ class kn {
4114
4114
  let s = this.cwd;
4115
4115
  this.cwd === t ? s = "~" : this.cwd.startsWith(t + "/") && (s = "~" + this.cwd.slice(t.length));
4116
4116
  const n = this.env.USER ?? "user", i = this.env.HOSTNAME ?? "lifo";
4117
- this.terminal.write(`${Te}${lt}${n}@${i}${ee}:${Te}${ht}${s}${ee}$ `);
4117
+ this.terminal.write(`${Ie}${ut}${n}@${i}${ee}:${Ie}${dt}${s}${ee}$ `);
4118
4118
  }
4119
4119
  handleInput(e) {
4120
4120
  var t, s, n;
@@ -4282,7 +4282,7 @@ class kn {
4282
4282
  let t = this.cwd;
4283
4283
  this.cwd === e ? t = "~" : this.cwd.startsWith(e + "/") && (t = "~" + this.cwd.slice(e.length));
4284
4284
  const s = this.env.USER ?? "user", n = this.env.HOSTNAME ?? "lifo";
4285
- this.terminal.write(`${Te}${lt}${s}@${n}${ee}:${Te}${ht}${t}${ee}$ `), this.terminal.write(this.lineBuffer), this.terminal.write("\x1B[K");
4285
+ this.terminal.write(`${Ie}${ut}${s}@${n}${ee}:${Ie}${dt}${t}${ee}$ `), this.terminal.write(this.lineBuffer), this.terminal.write("\x1B[K");
4286
4286
  const i = this.lineBuffer.length - this.cursorPos;
4287
4287
  i > 0 && this.terminal.write(`\x1B[${i}D`);
4288
4288
  }
@@ -4340,7 +4340,7 @@ class kn {
4340
4340
  return this.vfs.stat(n).type !== "directory" ? (t.write(`cd: ${s}: Not a directory
4341
4341
  `), 1) : (this.env.OLDPWD = this.cwd, this.cwd = n, 0);
4342
4342
  } catch (i) {
4343
- if (i instanceof T)
4343
+ if (i instanceof _)
4344
4344
  return t.write(`cd: ${s}: ${i.message}
4345
4345
  `), 1;
4346
4346
  throw i;
@@ -4511,6 +4511,9 @@ class En {
4511
4511
  registerLazy(e, t) {
4512
4512
  this.lazy.set(e, t);
4513
4513
  }
4514
+ unregister(e) {
4515
+ this.commands.delete(e), this.lazy.delete(e);
4516
+ }
4514
4517
  async resolve(e) {
4515
4518
  const t = this.commands.get(e);
4516
4519
  if (t) return t;
@@ -4526,7 +4529,7 @@ class En {
4526
4529
  }
4527
4530
  function xn() {
4528
4531
  const r = new En();
4529
- return r.registerLazy("ls", () => import("./ls-BOMe19Ls.js")), r.registerLazy("cat", () => import("./cat-BPj_LHfi.js")), r.registerLazy("mkdir", () => import("./mkdir-DE5ZBdl1.js")), r.registerLazy("rm", () => import("./rm-CR560cHz.js")), r.registerLazy("cp", () => import("./cp-_rhci8W9.js")), r.registerLazy("mv", () => import("./mv-Cw8pg9wR.js")), r.registerLazy("touch", () => import("./touch-D7Xd2vNM.js")), r.registerLazy("find", () => import("./find-BJNOna6S.js")), r.registerLazy("tree", () => import("./tree-CRpLFDhe.js")), r.registerLazy("stat", () => import("./stat-MGHvbiS7.js")), r.registerLazy("ln", () => import("./ln-Bf3f3jVA.js")), r.registerLazy("du", () => import("./du-Cv4zAsqm.js")), r.registerLazy("df", () => import("./df-CeZb4WOr.js")), r.registerLazy("chmod", () => import("./chmod-pNQSdBnq.js")), r.registerLazy("file", () => import("./file-Cxgmm1Vo.js")), r.registerLazy("grep", () => import("./grep-vdjjGK6g.js")), r.registerLazy("head", () => import("./head-DGXxKqPE.js")), r.registerLazy("tail", () => import("./tail-DheqHGe2.js")), r.registerLazy("wc", () => import("./wc-BUIoLfSN.js")), r.registerLazy("sort", () => import("./sort-or-F_iEY.js")), r.registerLazy("uniq", () => import("./uniq-DwHCe--v.js")), r.registerLazy("cut", () => import("./cut-Q5nQyrUo.js")), r.registerLazy("tr", () => import("./tr-DsCiwSIu.js")), r.registerLazy("sed", () => import("./sed-DCUgJWcA.js")), r.registerLazy("awk", () => import("./awk-CI8X5kVy.js")), r.registerLazy("tee", () => import("./tee-D47GOzfR.js")), r.registerLazy("xargs", () => import("./xargs-DfbCRFFd.js")), r.registerLazy("yes", () => import("./yes-DXEyHHD2.js")), r.registerLazy("printf", () => import("./printf-Cc2o7KZx.js")), r.registerLazy("env", () => import("./env-DXzvDKsN.js")), r.registerLazy("uname", () => import("./uname-BCn8HlJD.js")), r.registerLazy("date", () => import("./date-C8NB8v8G.js")), r.registerLazy("sleep", () => import("./sleep-B4C3fZiR.js")), r.registerLazy("uptime", () => import("./uptime-CgBJegqU.js")), r.registerLazy("whoami", () => import("./whoami-B1237V5e.js")), r.registerLazy("hostname", () => import("./hostname-BxU2S3nT.js")), r.registerLazy("free", () => import("./free-DAxE4b2U.js")), r.registerLazy("which", () => import("./which-D3u0cwyh.js")), r.registerLazy("curl", () => Promise.resolve().then(() => ci)), r.registerLazy("wget", () => import("./wget-BwmpusXQ.js")), r.registerLazy("ping", () => import("./ping-DtVEwwda.js")), r.registerLazy("dig", () => import("./dig-BEJ8Ky96.js")), r.registerLazy("tar", () => import("./tar-DhLtWtBV.js")), r.registerLazy("gzip", () => import("./gzip-C_08tX3p.js")), r.registerLazy("gunzip", () => import("./gunzip-AmY9PUj2.js")), r.registerLazy("zip", () => import("./zip-B4jRyQ7B.js")), r.registerLazy("unzip", () => import("./unzip-DPEg74Aq.js")), r.registerLazy("node", () => Promise.resolve().then(() => Ds)), r.registerLazy("rmdir", () => import("./rmdir-BO4Jz3r5.js")), r.registerLazy("realpath", () => import("./realpath-BSWdZLjf.js")), r.registerLazy("basename", () => import("./basename-D8VowKZK.js")), r.registerLazy("dirname", () => import("./dirname-B9Rm-O9I.js")), r.registerLazy("mktemp", () => import("./mktemp-De1K5WCb.js")), r.registerLazy("chown", () => import("./chown-BzpeyVqg.js")), r.registerLazy("diff", () => import("./diff-Dvc96Xgm.js")), r.registerLazy("nl", () => import("./nl-C-osPl2N.js")), r.registerLazy("rev", () => import("./rev-3C5MtCkc.js")), r.registerLazy("cal", () => import("./cal-DPULSAhj.js")), r.registerLazy("bc", () => import("./bc-BYiKVTNg.js")), r.registerLazy("man", () => import("./man-CJ5pI0_W.js")), r;
4532
+ return r.registerLazy("ls", () => import("./ls-KhZ3RDtV.js")), r.registerLazy("cat", () => import("./cat-CJGzb2e3.js")), r.registerLazy("mkdir", () => import("./mkdir-CyaDOAjy.js")), r.registerLazy("rm", () => import("./rm-CwcGV_yP.js")), r.registerLazy("cp", () => import("./cp-DfLycDOs.js")), r.registerLazy("mv", () => import("./mv-BKse5fAw.js")), r.registerLazy("touch", () => import("./touch-BePpbvnW.js")), r.registerLazy("find", () => import("./find-CnuafYlN.js")), r.registerLazy("tree", () => import("./tree-CgYdJHGr.js")), r.registerLazy("stat", () => import("./stat-CRPxoOhV.js")), r.registerLazy("ln", () => import("./ln-Bf3f3jVA.js")), r.registerLazy("du", () => import("./du-z_BgTafK.js")), r.registerLazy("df", () => import("./df-CeZb4WOr.js")), r.registerLazy("chmod", () => import("./chmod-jxQWlanu.js")), r.registerLazy("file", () => import("./file-BcMiRsYy.js")), r.registerLazy("grep", () => import("./grep-CRKDa1ht.js")), r.registerLazy("head", () => import("./head-CHtqgY7i.js")), r.registerLazy("tail", () => import("./tail-X6H5EAuw.js")), r.registerLazy("wc", () => import("./wc-BoOwcYXR.js")), r.registerLazy("sort", () => import("./sort-B0CyoWxT.js")), r.registerLazy("uniq", () => import("./uniq-BCe-YCgo.js")), r.registerLazy("cut", () => import("./cut-Cx3rJJBs.js")), r.registerLazy("tr", () => import("./tr-DsCiwSIu.js")), r.registerLazy("sed", () => import("./sed-Dpeoa9n0.js")), r.registerLazy("awk", () => import("./awk-C6CYe7-Y.js")), r.registerLazy("tee", () => import("./tee-BNSgK_iU.js")), r.registerLazy("xargs", () => import("./xargs-DfbCRFFd.js")), r.registerLazy("yes", () => import("./yes-DXEyHHD2.js")), r.registerLazy("printf", () => import("./printf-Cc2o7KZx.js")), r.registerLazy("env", () => import("./env-DXzvDKsN.js")), r.registerLazy("uname", () => import("./uname-BCn8HlJD.js")), r.registerLazy("date", () => import("./date-C8NB8v8G.js")), r.registerLazy("sleep", () => import("./sleep-B4C3fZiR.js")), r.registerLazy("uptime", () => import("./uptime-CgBJegqU.js")), r.registerLazy("whoami", () => import("./whoami-B1237V5e.js")), r.registerLazy("hostname", () => import("./hostname-BxU2S3nT.js")), r.registerLazy("free", () => import("./free-DAxE4b2U.js")), r.registerLazy("which", () => import("./which-D3u0cwyh.js")), r.registerLazy("curl", () => Promise.resolve().then(() => ci)), r.registerLazy("wget", () => import("./wget-D9TxbSi0.js")), r.registerLazy("ping", () => import("./ping-DtVEwwda.js")), r.registerLazy("dig", () => import("./dig-BEJ8Ky96.js")), r.registerLazy("tar", () => import("./tar-B8rlvBTm.js")), r.registerLazy("gzip", () => import("./gzip-5Z4ubCZY.js")), r.registerLazy("gunzip", () => import("./gunzip-CQPu5wlU.js")), r.registerLazy("zip", () => import("./zip-ZGFNiBLk.js")), r.registerLazy("unzip", () => import("./unzip-ByMOFz0R.js")), r.registerLazy("node", () => Promise.resolve().then(() => Ds)), r.registerLazy("rmdir", () => import("./rmdir-C0n1UKoB.js")), r.registerLazy("realpath", () => import("./realpath-Bn-E4jFG.js")), r.registerLazy("basename", () => import("./basename-DWmNG86a.js")), r.registerLazy("dirname", () => import("./dirname-BAkBrBEd.js")), r.registerLazy("mktemp", () => import("./mktemp-BdOMKqeO.js")), r.registerLazy("chown", () => import("./chown-B1-u84Sk.js")), r.registerLazy("diff", () => import("./diff-BNTf3WBA.js")), r.registerLazy("nl", () => import("./nl-CR1TwNHf.js")), r.registerLazy("rev", () => import("./rev-zIT5u7gK.js")), r.registerLazy("cal", () => import("./cal-DPULSAhj.js")), r.registerLazy("bc", () => import("./bc-BYiKVTNg.js")), r.registerLazy("man", () => import("./man-CJ5pI0_W.js")), r;
4530
4533
  }
4531
4534
  function Cn(r) {
4532
4535
  return async (e) => {
@@ -4546,22 +4549,22 @@ function Cn(r) {
4546
4549
  }
4547
4550
  function Ln(r) {
4548
4551
  return async (e) => {
4549
- const t = /* @__PURE__ */ new Date(), s = String(t.getHours()).padStart(2, "0"), n = String(t.getMinutes()).padStart(2, "0"), i = String(t.getSeconds()).padStart(2, "0"), o = typeof performance < "u" ? performance.now() : 0, a = Math.floor(o / 6e4), c = typeof navigator < "u" && navigator.hardwareConcurrency || 1, l = typeof performance < "u" ? performance.memory : void 0, d = l ? Math.round(l.jsHeapSizeLimit / (1024 * 1024)) : 256, h = l ? Math.round(l.usedJSHeapSize / (1024 * 1024)) : 16, f = d - h, g = r.list(), I = g.filter((A) => A.status === "running").length, k = g.filter((A) => A.status === "stopped").length, _ = g.length + 2;
4552
+ const t = /* @__PURE__ */ new Date(), s = String(t.getHours()).padStart(2, "0"), n = String(t.getMinutes()).padStart(2, "0"), i = String(t.getSeconds()).padStart(2, "0"), o = typeof performance < "u" ? performance.now() : 0, a = Math.floor(o / 6e4), c = typeof navigator < "u" && navigator.hardwareConcurrency || 1, l = typeof performance < "u" ? performance.memory : void 0, d = l ? Math.round(l.jsHeapSizeLimit / (1024 * 1024)) : 256, h = l ? Math.round(l.usedJSHeapSize / (1024 * 1024)) : 16, f = d - h, g = r.list(), A = g.filter((I) => I.status === "running").length, k = g.filter((I) => I.status === "stopped").length, P = g.length + 2;
4550
4553
  e.stdout.write(`top - ${s}:${n}:${i} up ${a} min, 1 user
4551
- `), e.stdout.write(`Tasks: ${String(_).padStart(3, " ")} total, ${String(I + 2).padStart(3, " ")} running, ${String(k).padStart(3, " ")} stopped
4554
+ `), e.stdout.write(`Tasks: ${String(P).padStart(3, " ")} total, ${String(A + 2).padStart(3, " ")} running, ${String(k).padStart(3, " ")} stopped
4552
4555
  `), e.stdout.write(`%Cpu(s): ${c} cores
4553
4556
  `), e.stdout.write(`MiB Mem: ${String(d).padStart(7, " ")} total ${String(h).padStart(7, " ")} used ${String(f).padStart(7, " ")} free
4554
4557
  `), e.stdout.write(`
4555
4558
  `), e.stdout.write(` PID CMD STATUS
4556
4559
  `), e.stdout.write(` 1 sh running
4557
4560
  `);
4558
- for (const A of g) {
4559
- const $ = String(A.id + 1).padStart(5, " "), j = A.command.split(/\s+/)[0].padEnd(15, " ");
4560
- e.stdout.write(`${$} ${j}${A.status}
4561
+ for (const I of g) {
4562
+ const $ = String(I.id + 1).padStart(5, " "), j = I.command.split(/\s+/)[0].padEnd(15, " ");
4563
+ e.stdout.write(`${$} ${j}${I.status}
4561
4564
  `);
4562
4565
  }
4563
- const C = String(g.length + 2).padStart(5, " ");
4564
- return e.stdout.write(`${C} top running
4566
+ const L = String(g.length + 2).padStart(5, " ");
4567
+ return e.stdout.write(`${L} top running
4565
4568
  `), 0;
4566
4569
  };
4567
4570
  }
@@ -4589,7 +4592,7 @@ const Rn = {
4589
4592
  19: "STOP",
4590
4593
  18: "CONT"
4591
4594
  };
4592
- function Pn(r) {
4595
+ function Tn(r) {
4593
4596
  return async (e) => {
4594
4597
  const t = e.args;
4595
4598
  if (t.length === 0)
@@ -4649,7 +4652,7 @@ function Pn(r) {
4649
4652
  return n;
4650
4653
  };
4651
4654
  }
4652
- function Tn(r) {
4655
+ function _n(r) {
4653
4656
  return async (e) => {
4654
4657
  let t = 2, s = 0;
4655
4658
  if (e.args[0] === "-n" && e.args.length > 1) {
@@ -4696,7 +4699,7 @@ function Tn(r) {
4696
4699
  });
4697
4700
  };
4698
4701
  }
4699
- const _n = [
4702
+ const Pn = [
4700
4703
  "cd",
4701
4704
  "pwd",
4702
4705
  "echo",
@@ -4713,8 +4716,8 @@ const _n = [
4713
4716
  ".",
4714
4717
  "alias",
4715
4718
  "unalias"
4716
- ], An = {
4717
- "Shell builtins": _n,
4719
+ ], In = {
4720
+ "Shell builtins": Pn,
4718
4721
  "File system": [
4719
4722
  "ls",
4720
4723
  "cat",
@@ -4777,13 +4780,13 @@ const _n = [
4777
4780
  Archive: ["tar", "gzip", "gunzip", "zip", "unzip"],
4778
4781
  "Node.js": ["node", "pkg"]
4779
4782
  };
4780
- function In(r) {
4783
+ function An(r) {
4781
4784
  return async (e) => {
4782
4785
  e.stdout.write(`Lifo Commands
4783
4786
  `), e.stdout.write(`==================
4784
4787
 
4785
4788
  `);
4786
- for (const [t, s] of Object.entries(An)) {
4789
+ for (const [t, s] of Object.entries(In)) {
4787
4790
  e.stdout.write(`${t}:
4788
4791
  `);
4789
4792
  const n = 6;
@@ -4799,7 +4802,7 @@ function In(r) {
4799
4802
  `), 0;
4800
4803
  };
4801
4804
  }
4802
- class Xe extends ie {
4805
+ class Qe extends oe {
4803
4806
  constructor() {
4804
4807
  super(...arguments);
4805
4808
  m(this, "_buffer", []);
@@ -4828,7 +4831,7 @@ class Xe extends ie {
4828
4831
  return this;
4829
4832
  }
4830
4833
  }
4831
- class yt extends ie {
4834
+ class vt extends oe {
4832
4835
  constructor() {
4833
4836
  super(...arguments);
4834
4837
  m(this, "_ended", !1);
@@ -4844,7 +4847,7 @@ class yt extends ie {
4844
4847
  return this._ended = !0, this.writable = !1, this.emit("close"), this;
4845
4848
  }
4846
4849
  }
4847
- class vt extends Xe {
4850
+ class bt extends Qe {
4848
4851
  constructor() {
4849
4852
  super(...arguments);
4850
4853
  m(this, "writable", !0);
@@ -4857,14 +4860,14 @@ class vt extends Xe {
4857
4860
  t && this.write(t), this._writableEnded = !0, this.writable = !1, this.emit("finish");
4858
4861
  }
4859
4862
  }
4860
- class rs extends vt {
4863
+ class rs extends bt {
4861
4864
  }
4862
- const Nn = { Readable: Xe, Writable: yt, Duplex: vt, PassThrough: rs }, Fn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4865
+ const Nn = { Readable: Qe, Writable: vt, Duplex: bt, PassThrough: rs }, Fn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4863
4866
  __proto__: null,
4864
- Duplex: vt,
4867
+ Duplex: bt,
4865
4868
  PassThrough: rs,
4866
- Readable: Xe,
4867
- Writable: yt,
4869
+ Readable: Qe,
4870
+ Writable: vt,
4868
4871
  default: Nn
4869
4872
  }, Symbol.toStringTag, { value: "Module" }));
4870
4873
  function Wt(r) {
@@ -4901,7 +4904,7 @@ function jn(r, e, t) {
4901
4904
  const s = new Error(r.message);
4902
4905
  return s.code = r.code, s.errno = -2, s.syscall = e, s.path = t, s.name = "Error", s;
4903
4906
  }
4904
- function it(r, e) {
4907
+ function at(r, e) {
4905
4908
  const t = new Error(`ENOENT: no such file or directory, ${r} '${e}'`);
4906
4909
  return t.code = "ENOENT", t.errno = -2, t.syscall = r, t.path = e, t;
4907
4910
  }
@@ -4913,26 +4916,26 @@ function U(r, e) {
4913
4916
  const t = typeof e == "string" ? e : e.pathname;
4914
4917
  return D(r, t);
4915
4918
  }
4916
- const dt = 0, Me = 1, De = 2, me = 64, Ue = 512, _e = 1024;
4917
- function Bn(r) {
4919
+ const pt = 0, We = 1, Ue = 2, me = 64, He = 512, Ae = 1024;
4920
+ function zn(r) {
4918
4921
  if (typeof r == "number") return r;
4919
4922
  switch (r) {
4920
4923
  case "r":
4921
- return dt;
4924
+ return pt;
4922
4925
  case "r+":
4923
- return De;
4926
+ return Ue;
4924
4927
  case "w":
4925
- return Me | me | Ue;
4928
+ return We | me | He;
4926
4929
  case "w+":
4927
- return De | me | Ue;
4930
+ return Ue | me | He;
4928
4931
  case "a":
4929
- return Me | me | _e;
4932
+ return We | me | Ae;
4930
4933
  case "a+":
4931
- return De | me | _e;
4934
+ return Ue | me | Ae;
4932
4935
  case "ax":
4933
- return Me | me | _e;
4936
+ return We | me | Ae;
4934
4937
  default:
4935
- return dt;
4938
+ return pt;
4936
4939
  }
4937
4940
  }
4938
4941
  function Ut(r, e) {
@@ -4972,13 +4975,13 @@ function Ut(r, e) {
4972
4975
  }
4973
4976
  function f(p, u) {
4974
4977
  const w = U(e, p);
4975
- return r.readdir(w).map((P) => P.name);
4978
+ return r.readdir(w).map((T) => T.name);
4976
4979
  }
4977
4980
  function g(p) {
4978
4981
  const u = U(e, p);
4979
4982
  r.unlink(u);
4980
4983
  }
4981
- function I(p, u) {
4984
+ function A(p, u) {
4982
4985
  const w = U(e, p);
4983
4986
  u != null && u.recursive ? r.rmdirRecursive(w) : r.rmdir(w);
4984
4987
  }
@@ -4986,37 +4989,37 @@ function Ut(r, e) {
4986
4989
  const w = U(e, p), S = U(e, u);
4987
4990
  r.rename(w, S);
4988
4991
  }
4989
- function _(p, u) {
4992
+ function P(p, u) {
4990
4993
  const w = U(e, p), S = U(e, u);
4991
4994
  r.copyFile(w, S);
4992
4995
  }
4993
- function C(p, u) {
4996
+ function L(p, u) {
4994
4997
  }
4995
- function A(p, u, w) {
4998
+ function I(p, u, w) {
4996
4999
  }
4997
5000
  function $(p, u) {
4998
5001
  const w = U(e, p);
4999
5002
  if (!r.exists(w))
5000
- throw it("access", w);
5003
+ throw at("access", w);
5001
5004
  }
5002
5005
  function j(p) {
5003
5006
  const u = U(e, p);
5004
5007
  if (!r.exists(u))
5005
- throw it("realpath", u);
5008
+ throw at("realpath", u);
5006
5009
  return u;
5007
5010
  }
5008
5011
  function v(p, u) {
5009
- const w = U(e, p), S = r.readFile(w), P = u ?? 0;
5010
- P >= S.length || r.writeFile(w, S.slice(0, P));
5012
+ const w = U(e, p), S = r.readFile(w), T = u ?? 0;
5013
+ T >= S.length || r.writeFile(w, S.slice(0, T));
5011
5014
  }
5012
5015
  function x(p, u, w) {
5013
- const S = U(e, p), P = Bn(u ?? "r");
5014
- if (P & me && (r.exists(S) || r.writeFile(S, "")), P & Ue && r.writeFile(S, ""), !r.exists(S))
5015
- throw it("open", S);
5016
+ const S = U(e, p), T = zn(u ?? "r");
5017
+ if (T & me && (r.exists(S) || r.writeFile(S, "")), T & He && r.writeFile(S, ""), !r.exists(S))
5018
+ throw at("open", S);
5016
5019
  const F = s++;
5017
5020
  return t.set(F, {
5018
5021
  path: S,
5019
- position: P & _e ? r.readFile(S).length : 0,
5022
+ position: T & Ae ? r.readFile(S).length : 0,
5020
5023
  flags: typeof u == "string" ? u : "r",
5021
5024
  closed: !1
5022
5025
  }), F;
@@ -5025,21 +5028,21 @@ function Ut(r, e) {
5025
5028
  const u = n(p);
5026
5029
  u.closed = !0, t.delete(p);
5027
5030
  }
5028
- function E(p, u, w, S, P) {
5029
- const F = n(p), B = r.readFile(F.path), H = P !== null ? P : F.position, re = Math.max(0, B.length - H), ae = Math.min(S, re);
5030
- return ae === 0 ? 0 : (u.set(B.subarray(H, H + ae), w), P === null && (F.position = H + ae), ae);
5031
+ function E(p, u, w, S, T) {
5032
+ const F = n(p), z = r.readFile(F.path), H = T !== null ? T : F.position, re = Math.max(0, z.length - H), ce = Math.min(S, re);
5033
+ return ce === 0 ? 0 : (u.set(z.subarray(H, H + ce), w), T === null && (F.position = H + ce), ce);
5031
5034
  }
5032
- function R(p, u, w, S, P) {
5035
+ function R(p, u, w, S, T) {
5033
5036
  const F = n(p);
5034
- let B, H;
5037
+ let z, H;
5035
5038
  if (typeof u == "string")
5036
- B = ge(u), H = typeof w == "number" ? w : F.position;
5039
+ z = ge(u), H = typeof w == "number" ? w : F.position;
5037
5040
  else {
5038
- const tt = w ?? 0, lr = typeof S == "number" ? S : u.length - tt;
5039
- B = u.subarray(tt, tt + lr), H = P ?? F.position;
5041
+ const rt = w ?? 0, lr = typeof S == "number" ? S : u.length - rt;
5042
+ z = u.subarray(rt, rt + lr), H = T ?? F.position;
5040
5043
  }
5041
- const re = r.readFile(F.path), ae = H + B.length, cr = Math.max(re.length, ae), et = new Uint8Array(cr);
5042
- return et.set(re, 0), et.set(B, H), r.writeFile(F.path, et), F.position = ae, B.length;
5044
+ const re = r.readFile(F.path), ce = H + z.length, cr = Math.max(re.length, ce), st = new Uint8Array(cr);
5045
+ return st.set(re, 0), st.set(z, H), r.writeFile(F.path, st), F.position = ce, z.length;
5043
5046
  }
5044
5047
  function O(p) {
5045
5048
  const u = n(p);
@@ -5049,7 +5052,7 @@ function Ut(r, e) {
5049
5052
  const w = n(p);
5050
5053
  v(w.path, u);
5051
5054
  }
5052
- function z(p) {
5055
+ function B(p) {
5053
5056
  }
5054
5057
  function pe(p) {
5055
5058
  }
@@ -5057,7 +5060,7 @@ function Ut(r, e) {
5057
5060
  }
5058
5061
  function le(p, u) {
5059
5062
  }
5060
- function Be(p) {
5063
+ function Me(p) {
5061
5064
  return U(e, p);
5062
5065
  }
5063
5066
  function q(p, u) {
@@ -5066,7 +5069,7 @@ function Ut(r, e) {
5066
5069
  const w = p();
5067
5070
  u(null, w);
5068
5071
  } catch (w) {
5069
- if (w instanceof T)
5072
+ if (w instanceof _)
5070
5073
  u(jn(w, "", ""));
5071
5074
  else if (w.code)
5072
5075
  u(w);
@@ -5076,10 +5079,10 @@ function Ut(r, e) {
5076
5079
  });
5077
5080
  }
5078
5081
  function J(p, u, w) {
5079
- const S = typeof u == "function" ? u : w, P = typeof u == "function" ? void 0 : u;
5080
- q(() => i(p, P), S);
5082
+ const S = typeof u == "function" ? u : w, T = typeof u == "function" ? void 0 : u;
5083
+ q(() => i(p, T), S);
5081
5084
  }
5082
- function xe(p, u, w, S) {
5085
+ function Le(p, u, w, S) {
5083
5086
  q(() => o(p, u), typeof w == "function" ? w : S);
5084
5087
  }
5085
5088
  function V(p, u) {
@@ -5089,21 +5092,21 @@ function Ut(r, e) {
5089
5092
  q(() => d(p), u);
5090
5093
  }
5091
5094
  function G(p, u, w) {
5092
- const S = typeof u == "function" ? u : w, P = typeof u == "function" ? void 0 : u;
5093
- q(() => h(p, P), S);
5095
+ const S = typeof u == "function" ? u : w, T = typeof u == "function" ? void 0 : u;
5096
+ q(() => h(p, T), S);
5094
5097
  }
5095
- function oe(p, u, w) {
5098
+ function ae(p, u, w) {
5096
5099
  q(() => f(p), typeof u == "function" ? u : w);
5097
5100
  }
5098
- function Ce(p, u) {
5101
+ function Re(p, u) {
5099
5102
  q(() => g(p), u);
5100
5103
  }
5101
5104
  function ye(p, u, w) {
5102
5105
  q(() => k(p, u), w);
5103
5106
  }
5104
- function ze(p, u, w) {
5105
- const S = typeof u == "function" ? u : w, P = typeof u == "function" ? void 0 : u;
5106
- q(() => $(p, P), S);
5107
+ function De(p, u, w) {
5108
+ const S = typeof u == "function" ? u : w, T = typeof u == "function" ? void 0 : u;
5109
+ q(() => $(p, T), S);
5107
5110
  }
5108
5111
  function er(p, u) {
5109
5112
  queueMicrotask(() => {
@@ -5111,57 +5114,57 @@ function Ut(r, e) {
5111
5114
  });
5112
5115
  }
5113
5116
  function tr(p, u, w, S) {
5114
- let P, F, B;
5115
- typeof u == "function" ? (P = u, F = "r") : typeof w == "function" ? (P = w, F = u) : (P = S, F = u, B = w), q(() => x(p, F, B), P);
5117
+ let T, F, z;
5118
+ typeof u == "function" ? (T = u, F = "r") : typeof w == "function" ? (T = w, F = u) : (T = S, F = u, z = w), q(() => x(p, F, z), T);
5116
5119
  }
5117
5120
  function sr(p, u) {
5118
5121
  q(() => y(p), u);
5119
5122
  }
5120
- function rr(p, u, w, S, P, F) {
5121
- q(() => E(p, u, w, S, P), F);
5123
+ function rr(p, u, w, S, T, F) {
5124
+ q(() => E(p, u, w, S, T), F);
5122
5125
  }
5123
5126
  function nr(p, u) {
5124
5127
  q(() => O(p), u);
5125
5128
  }
5126
5129
  function ir(p, u) {
5127
- const w = U(e, p), S = new Xe();
5130
+ const w = U(e, p), S = new Qe();
5128
5131
  return queueMicrotask(() => {
5129
5132
  try {
5130
- const P = r.readFile(w), F = (u == null ? void 0 : u.start) ?? 0, B = (u == null ? void 0 : u.end) !== void 0 ? u.end + 1 : P.length, H = P.subarray(F, B);
5131
- u != null && u.encoding, S.push(Ne(H)), S.push(null);
5132
- } catch (P) {
5133
- S.emit("error", P);
5133
+ const T = r.readFile(w), F = (u == null ? void 0 : u.start) ?? 0, z = (u == null ? void 0 : u.end) !== void 0 ? u.end + 1 : T.length, H = T.subarray(F, z);
5134
+ u != null && u.encoding, S.push(je(H)), S.push(null);
5135
+ } catch (T) {
5136
+ S.emit("error", T);
5134
5137
  }
5135
5138
  }), S;
5136
5139
  }
5137
5140
  function or(p, u) {
5138
- const w = U(e, p), S = (u == null ? void 0 : u.flags) ?? "w", P = [];
5141
+ const w = U(e, p), S = (u == null ? void 0 : u.flags) ?? "w", T = [];
5139
5142
  if (S.includes("w"))
5140
5143
  try {
5141
5144
  r.writeFile(w, "");
5142
5145
  } catch {
5143
5146
  }
5144
- const F = new yt();
5145
- return F.write = (B, H, re) => {
5146
- P.push(B);
5147
+ const F = new vt();
5148
+ return F.write = (z, H, re) => {
5149
+ T.push(z);
5147
5150
  try {
5148
- S.includes("a") ? r.appendFile(w, B) : r.writeFile(w, P.join(""));
5149
- } catch (ae) {
5150
- return F.emit("error", ae), !1;
5151
+ S.includes("a") ? r.appendFile(w, z) : r.writeFile(w, T.join(""));
5152
+ } catch (ce) {
5153
+ return F.emit("error", ce), !1;
5151
5154
  }
5152
5155
  return re && re(), !0;
5153
- }, F.end = (B) => {
5154
- B && F.write(B), F.emit("finish"), F.emit("close");
5156
+ }, F.end = (z) => {
5157
+ z && F.write(z), F.emit("finish"), F.emit("close");
5155
5158
  }, F;
5156
5159
  }
5157
5160
  function ar(p, u, w) {
5158
- const S = U(e, p), P = typeof u == "function" ? u : w, F = new ie(), B = r.onChange;
5161
+ const S = U(e, p), T = typeof u == "function" ? u : w, F = new oe(), z = r.onChange;
5159
5162
  return r.onChange = () => {
5160
- B == null || B();
5161
- const H = "change", re = Ee(S);
5162
- P && P(H, re), F.emit("change", H, re);
5163
+ z == null || z();
5164
+ const H = "change", re = xe(S);
5165
+ T && T(H, re), F.emit("change", H, re);
5163
5166
  }, F.close = () => {
5164
- r.onChange = B;
5167
+ r.onChange = z;
5165
5168
  }, F;
5166
5169
  }
5167
5170
  return {
@@ -5175,11 +5178,11 @@ function Ut(r, e) {
5175
5178
  mkdirSync: h,
5176
5179
  readdirSync: f,
5177
5180
  unlinkSync: g,
5178
- rmdirSync: I,
5181
+ rmdirSync: A,
5179
5182
  renameSync: k,
5180
- copyFileSync: _,
5181
- chmodSync: C,
5182
- chownSync: A,
5183
+ copyFileSync: P,
5184
+ chmodSync: L,
5185
+ chownSync: I,
5183
5186
  accessSync: $,
5184
5187
  realpathSync: j,
5185
5188
  truncateSync: v,
@@ -5189,21 +5192,21 @@ function Ut(r, e) {
5189
5192
  writeSync: R,
5190
5193
  fstatSync: O,
5191
5194
  ftruncateSync: Z,
5192
- fsyncSync: z,
5195
+ fsyncSync: B,
5193
5196
  fdatasyncSync: pe,
5194
5197
  symlinkSync: X,
5195
5198
  linkSync: le,
5196
- readlinkSync: Be,
5199
+ readlinkSync: Me,
5197
5200
  // Callback
5198
5201
  readFile: J,
5199
- writeFile: xe,
5202
+ writeFile: Le,
5200
5203
  stat: V,
5201
5204
  lstat: se,
5202
5205
  mkdir: G,
5203
- readdir: oe,
5204
- unlink: Ce,
5206
+ readdir: ae,
5207
+ unlink: Re,
5205
5208
  rename: ye,
5206
- access: ze,
5209
+ access: De,
5207
5210
  exists: er,
5208
5211
  open: tr,
5209
5212
  close: sr,
@@ -5226,9 +5229,9 @@ function Ut(r, e) {
5226
5229
  },
5227
5230
  readdir: async (p) => f(p),
5228
5231
  unlink: async (p) => g(p),
5229
- rmdir: async (p, u) => I(p, u),
5232
+ rmdir: async (p, u) => A(p, u),
5230
5233
  rename: async (p, u) => k(p, u),
5231
- copyFile: async (p, u) => _(p, u),
5234
+ copyFile: async (p, u) => P(p, u),
5232
5235
  access: async (p, u) => $(p),
5233
5236
  realpath: async (p) => j(p),
5234
5237
  truncate: async (p, u) => v(p, u),
@@ -5241,15 +5244,15 @@ function Ut(r, e) {
5241
5244
  return {
5242
5245
  fd: S,
5243
5246
  close: async () => y(S),
5244
- read: async (P, F, B, H) => ({
5245
- bytesRead: E(S, P, F, B, H),
5246
- buffer: P
5247
+ read: async (T, F, z, H) => ({
5248
+ bytesRead: E(S, T, F, z, H),
5249
+ buffer: T
5247
5250
  }),
5248
- write: async (P) => ({
5249
- bytesWritten: R(S, P)
5251
+ write: async (T) => ({
5252
+ bytesWritten: R(S, T)
5250
5253
  }),
5251
5254
  stat: async () => O(S),
5252
- truncate: async (P) => Z(S, P)
5255
+ truncate: async (T) => Z(S, T)
5253
5256
  };
5254
5257
  },
5255
5258
  rm: async (p, u) => {
@@ -5257,7 +5260,7 @@ function Ut(r, e) {
5257
5260
  try {
5258
5261
  r.stat(w).type === "directory" ? u != null && u.recursive ? r.rmdirRecursive(w) : r.rmdir(w) : r.unlink(w);
5259
5262
  } catch (S) {
5260
- if (u != null && u.force && S instanceof T && S.code === "ENOENT") return;
5263
+ if (u != null && u.force && S instanceof _ && S.code === "ENOENT") return;
5261
5264
  throw S;
5262
5265
  }
5263
5266
  }
@@ -5268,12 +5271,12 @@ function Ut(r, e) {
5268
5271
  R_OK: 4,
5269
5272
  W_OK: 2,
5270
5273
  X_OK: 1,
5271
- O_RDONLY: dt,
5272
- O_WRONLY: Me,
5273
- O_RDWR: De,
5274
+ O_RDONLY: pt,
5275
+ O_WRONLY: We,
5276
+ O_RDWR: Ue,
5274
5277
  O_CREAT: me,
5275
- O_TRUNC: Ue,
5276
- O_APPEND: _e,
5278
+ O_TRUNC: He,
5279
+ O_APPEND: Ae,
5277
5280
  COPYFILE_EXCL: 1,
5278
5281
  COPYFILE_FICLONE: 2,
5279
5282
  COPYFILE_FICLONE_FORCE: 4
@@ -5289,21 +5292,21 @@ function ns(r, e) {
5289
5292
  return [...Array(i).fill(".."), ...o].join("/") || ".";
5290
5293
  }
5291
5294
  function is(r) {
5292
- const e = Je(r) ? "/" : "", t = te(r), s = Ee(r), n = Ie(r), i = n ? s.slice(0, -n.length) : s;
5295
+ const e = Ye(r) ? "/" : "", t = te(r), s = xe(r), n = Fe(r), i = n ? s.slice(0, -n.length) : s;
5293
5296
  return { root: e, dir: t, base: s, ext: n, name: i };
5294
5297
  }
5295
5298
  function os(r) {
5296
5299
  const e = r.dir || r.root || "", t = r.base || (r.name || "") + (r.ext || "");
5297
5300
  return e ? e.endsWith("/") ? e + t : e + "/" + t : t;
5298
5301
  }
5299
- const as = "/", cs = ":", zn = {
5302
+ const as = "/", cs = ":", Bn = {
5300
5303
  normalize: fe,
5301
- isAbsolute: Je,
5302
- join: L,
5304
+ isAbsolute: Ye,
5305
+ join: C,
5303
5306
  resolve: (...r) => D("/", ...r),
5304
5307
  dirname: te,
5305
- basename: Ee,
5306
- extname: Ie,
5308
+ basename: xe,
5309
+ extname: Fe,
5307
5310
  relative: ns,
5308
5311
  parse: is,
5309
5312
  format: os,
@@ -5311,18 +5314,18 @@ const as = "/", cs = ":", zn = {
5311
5314
  delimiter: cs
5312
5315
  }, Mn = {
5313
5316
  normalize: fe,
5314
- isAbsolute: Je,
5315
- join: L,
5317
+ isAbsolute: Ye,
5318
+ join: C,
5316
5319
  resolve: (...r) => D("/", ...r),
5317
5320
  dirname: te,
5318
- basename: Ee,
5319
- extname: Ie,
5321
+ basename: xe,
5322
+ extname: Fe,
5320
5323
  relative: ns,
5321
5324
  parse: is,
5322
5325
  format: os,
5323
5326
  sep: as,
5324
5327
  delimiter: cs,
5325
- posix: zn
5328
+ posix: Bn
5326
5329
  };
5327
5330
  function Dn(r) {
5328
5331
  return {
@@ -5368,14 +5371,14 @@ function Dn(r) {
5368
5371
  }
5369
5372
  };
5370
5373
  }
5371
- class bt extends Error {
5374
+ class St extends Error {
5372
5375
  constructor(t) {
5373
5376
  super(`process.exit(${t})`);
5374
5377
  m(this, "exitCode");
5375
5378
  this.name = "ProcessExitError", this.exitCode = t;
5376
5379
  }
5377
5380
  }
5378
- function Fe(r) {
5381
+ function Oe(r) {
5379
5382
  const e = Date.now();
5380
5383
  return {
5381
5384
  argv: ["/usr/bin/node", ...r.argv],
@@ -5386,7 +5389,7 @@ function Fe(r) {
5386
5389
  throw new Error("process.chdir() is not supported in Lifo");
5387
5390
  },
5388
5391
  exit: (t = 0) => {
5389
- throw new bt(t);
5392
+ throw new St(t);
5390
5393
  },
5391
5394
  stdout: {
5392
5395
  write: (t) => (r.stdout.write(t), !0),
@@ -5445,7 +5448,7 @@ function Fe(r) {
5445
5448
  }
5446
5449
  };
5447
5450
  }
5448
- const ot = new TextEncoder(), Wn = new TextDecoder();
5451
+ const ct = new TextEncoder(), Wn = new TextDecoder();
5449
5452
  class M extends Uint8Array {
5450
5453
  // Use overloaded signatures to satisfy Uint8Array's static from
5451
5454
  static from(e, t, s) {
@@ -5462,7 +5465,7 @@ class M extends Uint8Array {
5462
5465
  l[d / 2] = parseInt(e.substring(d, d + 2), 16);
5463
5466
  return l;
5464
5467
  }
5465
- const a = ot.encode(e), c = new M(a.length);
5468
+ const a = ct.encode(e), c = new M(a.length);
5466
5469
  return c.set(a), c;
5467
5470
  }
5468
5471
  if (e instanceof ArrayBuffer) {
@@ -5501,7 +5504,7 @@ class M extends Uint8Array {
5501
5504
  const s = e.replace(/[^A-Za-z0-9+/]/g, "");
5502
5505
  return Math.floor(s.length * 3 / 4);
5503
5506
  }
5504
- return t === "hex" ? e.length / 2 : ot.encode(e).length;
5507
+ return t === "hex" ? e.length / 2 : ct.encode(e).length;
5505
5508
  }
5506
5509
  toString(e, t, s) {
5507
5510
  const n = t !== void 0 || s !== void 0 ? this.subarray(t ?? 0, s ?? this.length) : this;
@@ -5530,7 +5533,7 @@ class M extends Uint8Array {
5530
5533
  a = new Uint8Array(d);
5531
5534
  for (let h = 0; h < d; h++) a[h] = l.charCodeAt(h);
5532
5535
  } else
5533
- a = ot.encode(e);
5536
+ a = ct.encode(e);
5534
5537
  const c = Math.min(a.length, o);
5535
5538
  return this.set(a.subarray(0, c), i), c;
5536
5539
  }
@@ -5678,7 +5681,7 @@ class M extends Uint8Array {
5678
5681
  }
5679
5682
  function K(r, ...e) {
5680
5683
  if (typeof r != "string")
5681
- return [r, ...e].map((n) => Ae(n)).join(" ");
5684
+ return [r, ...e].map((n) => Ne(n)).join(" ");
5682
5685
  let t = 0, s = r.replace(/%([sdjoO%])/g, (n, i) => {
5683
5686
  if (i === "%") return "%";
5684
5687
  if (t >= e.length) return n;
@@ -5696,20 +5699,20 @@ function K(r, ...e) {
5696
5699
  }
5697
5700
  case "o":
5698
5701
  case "O":
5699
- return Ae(o);
5702
+ return Ne(o);
5700
5703
  default:
5701
5704
  return n;
5702
5705
  }
5703
5706
  });
5704
5707
  for (; t < e.length; )
5705
- s += " " + Ae(e[t++]);
5708
+ s += " " + Ne(e[t++]);
5706
5709
  return s;
5707
5710
  }
5708
- function Ae(r, e) {
5711
+ function Ne(r, e) {
5709
5712
  const t = (e == null ? void 0 : e.depth) ?? 2;
5710
- return ft(r, t);
5713
+ return mt(r, t);
5711
5714
  }
5712
- function ft(r, e) {
5715
+ function mt(r, e) {
5713
5716
  if (r === null) return "null";
5714
5717
  if (r === void 0) return "undefined";
5715
5718
  const t = typeof r;
@@ -5721,13 +5724,13 @@ function ft(r, e) {
5721
5724
  if (r instanceof RegExp) return r.toString();
5722
5725
  if (r instanceof Error) return `${r.name}: ${r.message}`;
5723
5726
  if (Array.isArray(r))
5724
- return e < 0 ? "[Array]" : `[ ${r.map((n) => ft(n, e - 1)).join(", ")} ]`;
5727
+ return e < 0 ? "[Array]" : `[ ${r.map((n) => mt(n, e - 1)).join(", ")} ]`;
5725
5728
  if (r instanceof Uint8Array)
5726
5729
  return `<Buffer ${Array.from(r.slice(0, 50)).map((s) => s.toString(16).padStart(2, "0")).join(" ")}${r.length > 50 ? " ..." : ""}>`;
5727
5730
  if (typeof r == "object") {
5728
5731
  if (e < 0) return "[Object]";
5729
5732
  const s = Object.entries(r);
5730
- return s.length === 0 ? "{}" : `{ ${s.map(([i, o]) => `${i}: ${ft(o, e - 1)}`).join(", ")} }`;
5733
+ return s.length === 0 ? "{}" : `{ ${s.map(([i, o]) => `${i}: ${mt(o, e - 1)}`).join(", ")} }`;
5731
5734
  }
5732
5735
  return String(r);
5733
5736
  }
@@ -5752,17 +5755,17 @@ function ds() {
5752
5755
  isArray: Array.isArray
5753
5756
  };
5754
5757
  }
5755
- const Un = { format: K, inspect: Ae, promisify: ls, inherits: hs, deprecate: us, types: ds }, qn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5758
+ const Un = { format: K, inspect: Ne, promisify: ls, inherits: hs, deprecate: us, types: ds }, qn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5756
5759
  __proto__: null,
5757
5760
  default: Un,
5758
5761
  deprecate: us,
5759
5762
  format: K,
5760
5763
  inherits: hs,
5761
- inspect: Ae,
5764
+ inspect: Ne,
5762
5765
  promisify: ls,
5763
5766
  types: ds
5764
5767
  }, Symbol.toStringTag, { value: "Module" }));
5765
- class qe extends ie {
5768
+ class Ve extends oe {
5766
5769
  constructor(t, s, n) {
5767
5770
  super();
5768
5771
  m(this, "statusCode");
@@ -5776,7 +5779,7 @@ class qe extends ie {
5776
5779
  return this;
5777
5780
  }
5778
5781
  }
5779
- class qt extends ie {
5782
+ class qt extends oe {
5780
5783
  constructor(t, s, n) {
5781
5784
  super();
5782
5785
  m(this, "options");
@@ -5812,7 +5815,7 @@ class qt extends ie {
5812
5815
  };
5813
5816
  try {
5814
5817
  c(l, d);
5815
- const h = new qe(d.statusCode, "OK", d.headers);
5818
+ const h = new Ve(d.statusCode, "OK", d.headers);
5816
5819
  this.emit("response", h), queueMicrotask(() => {
5817
5820
  h.emit("data", d.body), h.emit("end");
5818
5821
  });
@@ -5832,7 +5835,7 @@ class qt extends ie {
5832
5835
  c.headers.forEach((f, g) => {
5833
5836
  l[g] = f;
5834
5837
  });
5835
- const d = new qe(c.status, c.statusText, l);
5838
+ const d = new Ve(c.status, c.statusText, l);
5836
5839
  this.emit("response", d);
5837
5840
  const h = await c.text();
5838
5841
  d.emit("data", h), d.emit("end");
@@ -5869,7 +5872,7 @@ class fs {
5869
5872
  }
5870
5873
  }
5871
5874
  const ps = Symbol.for("lifo.http.activeServers");
5872
- class Ht extends ie {
5875
+ class Ht extends oe {
5873
5876
  constructor(t, s, n) {
5874
5877
  super();
5875
5878
  m(this, "portRegistry");
@@ -5890,7 +5893,7 @@ class Ht extends ie {
5890
5893
  this._closeResolve = o;
5891
5894
  });
5892
5895
  const i = (o, a) => {
5893
- const c = new qe(0, "", o.headers);
5896
+ const c = new Ve(0, "", o.headers);
5894
5897
  c.method = o.method, c.url = o.url;
5895
5898
  const l = new fs(a);
5896
5899
  this.emit("request", c, l);
@@ -5938,7 +5941,7 @@ function Vt(r) {
5938
5941
  request: t,
5939
5942
  get: s,
5940
5943
  createServer: n,
5941
- IncomingMessage: qe,
5944
+ IncomingMessage: Ve,
5942
5945
  ClientRequest: qt,
5943
5946
  Server: Ht,
5944
5947
  ServerResponse: fs,
@@ -5947,7 +5950,7 @@ function Vt(r) {
5947
5950
  }
5948
5951
  function Hn(r) {
5949
5952
  function e(i, o, a) {
5950
- const c = typeof o == "function" ? o : a, l = new ie();
5953
+ const c = typeof o == "function" ? o : a, l = new oe();
5951
5954
  if (!r)
5952
5955
  return queueMicrotask(() => {
5953
5956
  const h = new Error("child_process.exec() requires shell interpreter");
@@ -6021,26 +6024,26 @@ const Zn = { URL, URLSearchParams, parse: ms, format: gs, resolve: ws }, Jn = /*
6021
6024
  format: gs,
6022
6025
  parse: ms,
6023
6026
  resolve: ws
6024
- }, Symbol.toStringTag, { value: "Module" })), St = globalThis.setTimeout, ys = globalThis.setInterval, $t = globalThis.clearTimeout, vs = globalThis.clearInterval;
6027
+ }, Symbol.toStringTag, { value: "Module" })), $t = globalThis.setTimeout, ys = globalThis.setInterval, kt = globalThis.clearTimeout, vs = globalThis.clearInterval;
6025
6028
  function bs(r, ...e) {
6026
- return St(() => r(...e), 0);
6029
+ return $t(() => r(...e), 0);
6027
6030
  }
6028
6031
  function Ss(r) {
6029
- $t(r);
6032
+ kt(r);
6030
6033
  }
6031
6034
  const Yn = {
6032
- setTimeout: St,
6035
+ setTimeout: $t,
6033
6036
  setInterval: ys,
6034
- clearTimeout: $t,
6037
+ clearTimeout: kt,
6035
6038
  clearInterval: vs,
6036
6039
  setImmediate: bs,
6037
6040
  clearImmediate: Ss
6038
6041
  }, Xn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6039
6042
  __proto__: null,
6040
6043
  _clearInterval: vs,
6041
- _clearTimeout: $t,
6044
+ _clearTimeout: kt,
6042
6045
  _setInterval: ys,
6043
- _setTimeout: St,
6046
+ _setTimeout: $t,
6044
6047
  clearImmediate: Ss,
6045
6048
  default: Yn,
6046
6049
  setImmediate: bs
@@ -6118,8 +6121,8 @@ function we(r, e) {
6118
6121
  ei(a, r, e).then((c) => i(null, c)).catch((c) => i(c instanceof Error ? c : new Error(String(c))));
6119
6122
  };
6120
6123
  }
6121
- const Cs = we("gzip", "compress"), Ls = we("gzip", "decompress"), Rs = we("deflate", "compress"), Ps = we("deflate", "decompress"), Ts = we("deflate-raw", "compress"), _s = we("deflate-raw", "decompress"), As = we("gzip", "decompress");
6122
- function Is() {
6124
+ const Cs = we("gzip", "compress"), Ls = we("gzip", "decompress"), Rs = we("deflate", "compress"), Ts = we("deflate", "decompress"), _s = we("deflate-raw", "compress"), Ps = we("deflate-raw", "decompress"), Is = we("gzip", "decompress");
6125
+ function As() {
6123
6126
  throw new Error("zlib sync operations are not supported in Lifo");
6124
6127
  }
6125
6128
  function Ns() {
@@ -6153,11 +6156,11 @@ const Os = {
6153
6156
  gzip: Cs,
6154
6157
  gunzip: Ls,
6155
6158
  deflate: Rs,
6156
- inflate: Ps,
6157
- deflateRaw: Ts,
6158
- inflateRaw: _s,
6159
- unzip: As,
6160
- gzipSync: Is,
6159
+ inflate: Ts,
6160
+ deflateRaw: _s,
6161
+ inflateRaw: Ps,
6162
+ unzip: Is,
6163
+ gzipSync: As,
6161
6164
  gunzipSync: Ns,
6162
6165
  deflateSync: Fs,
6163
6166
  inflateSync: js,
@@ -6167,18 +6170,18 @@ const Os = {
6167
6170
  constants: Os,
6168
6171
  default: ti,
6169
6172
  deflate: Rs,
6170
- deflateRaw: Ts,
6173
+ deflateRaw: _s,
6171
6174
  deflateSync: Fs,
6172
6175
  gunzip: Ls,
6173
6176
  gunzipSync: Ns,
6174
6177
  gzip: Cs,
6175
- gzipSync: Is,
6176
- inflate: Ps,
6177
- inflateRaw: _s,
6178
+ gzipSync: As,
6179
+ inflate: Ts,
6180
+ inflateRaw: Ps,
6178
6181
  inflateSync: js,
6179
- unzip: As
6182
+ unzip: Is
6180
6183
  }, Symbol.toStringTag, { value: "Module" }));
6181
- class Bs {
6184
+ class zs {
6182
6185
  constructor(e) {
6183
6186
  m(this, "decoder");
6184
6187
  const t = (e || "utf8").toLowerCase().replace("-", ""), s = {
@@ -6197,25 +6200,25 @@ class Bs {
6197
6200
  return e ? this.decoder.decode(e) : this.decoder.decode();
6198
6201
  }
6199
6202
  }
6200
- const ri = { StringDecoder: Bs }, ni = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6203
+ const ri = { StringDecoder: zs }, ni = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6201
6204
  __proto__: null,
6202
- StringDecoder: Bs,
6205
+ StringDecoder: zs,
6203
6206
  default: ri
6204
6207
  }, Symbol.toStringTag, { value: "Module" }));
6205
- function pt(r) {
6208
+ function gt(r) {
6206
6209
  return {
6207
6210
  fs: () => Ut(r.vfs, r.cwd),
6208
6211
  "fs/promises": () => Ut(r.vfs, r.cwd).promises,
6209
6212
  path: () => Mn,
6210
6213
  os: () => Dn(r.env),
6211
- process: () => Fe({
6214
+ process: () => Oe({
6212
6215
  argv: r.argv,
6213
6216
  env: r.env,
6214
6217
  cwd: r.cwd,
6215
6218
  stdout: r.stdout,
6216
6219
  stderr: r.stderr
6217
6220
  }),
6218
- events: () => ({ EventEmitter: ie, default: ie }),
6221
+ events: () => ({ EventEmitter: oe, default: oe }),
6219
6222
  buffer: () => ({ Buffer: M }),
6220
6223
  util: () => qn,
6221
6224
  http: () => Vt(r.portRegistry),
@@ -6257,7 +6260,7 @@ function pt(r) {
6257
6260
  }
6258
6261
  };
6259
6262
  }
6260
- function He(r, e) {
6263
+ function Ge(r, e) {
6261
6264
  const t = /* @__PURE__ */ new Map();
6262
6265
  return {
6263
6266
  log: (...s) => {
@@ -6345,7 +6348,7 @@ function Gt(r) {
6345
6348
  }
6346
6349
  return r;
6347
6350
  }
6348
- function zs(r) {
6351
+ function Bs(r) {
6349
6352
  return async (e) => {
6350
6353
  if (e.args.length > 0 && (e.args[0] === "-v" || e.args[0] === "--version"))
6351
6354
  return e.stdout.write(ii + `
@@ -6375,7 +6378,7 @@ function zs(r) {
6375
6378
  try {
6376
6379
  t = e.vfs.readFileString(v);
6377
6380
  } catch (x) {
6378
- if (x instanceof T)
6381
+ if (x instanceof _)
6379
6382
  return e.stderr.write(`node: ${e.args[0]}: ${x.message}
6380
6383
  `), 1;
6381
6384
  throw x;
@@ -6395,7 +6398,7 @@ function zs(r) {
6395
6398
  dirname: i,
6396
6399
  signal: e.signal,
6397
6400
  portRegistry: r
6398
- }, a = pt(o), c = /* @__PURE__ */ new Map();
6401
+ }, a = gt(o), c = /* @__PURE__ */ new Map();
6399
6402
  function l(v) {
6400
6403
  if (c.has(v)) return c.get(v);
6401
6404
  if (a[v]) {
@@ -6434,49 +6437,49 @@ function zs(r) {
6434
6437
  if (e.vfs.exists(y))
6435
6438
  try {
6436
6439
  if (e.vfs.stat(y).type === "file") return { path: y };
6437
- const R = L(y, "index.js");
6440
+ const R = C(y, "index.js");
6438
6441
  if (e.vfs.exists(R)) return { path: R };
6439
6442
  } catch {
6440
6443
  }
6441
- return !Ie(y) && e.vfs.exists(y + ".js") ? { path: y + ".js" } : !Ie(y) && e.vfs.exists(y + ".json") ? { path: y + ".json" } : null;
6444
+ return !Fe(y) && e.vfs.exists(y + ".js") ? { path: y + ".js" } : !Fe(y) && e.vfs.exists(y + ".json") ? { path: y + ".json" } : null;
6442
6445
  }
6443
6446
  function h(v, x) {
6444
6447
  let y, E = null;
6445
6448
  if (v.startsWith("@")) {
6446
- const z = v.split("/");
6447
- if (z.length < 2) return null;
6448
- y = z[0] + "/" + z[1], z.length > 2 && (E = z.slice(2).join("/"));
6449
+ const B = v.split("/");
6450
+ if (B.length < 2) return null;
6451
+ y = B[0] + "/" + B[1], B.length > 2 && (E = B.slice(2).join("/"));
6449
6452
  } else {
6450
- const z = v.indexOf("/");
6451
- z !== -1 ? (y = v.slice(0, z), E = v.slice(z + 1)) : y = v;
6453
+ const B = v.indexOf("/");
6454
+ B !== -1 ? (y = v.slice(0, B), E = v.slice(B + 1)) : y = v;
6452
6455
  }
6453
6456
  let R = x;
6454
6457
  for (; ; ) {
6455
- const z = L(R, "node_modules", y);
6456
- if (e.vfs.exists(z)) {
6457
- const X = f(z, E);
6458
+ const B = C(R, "node_modules", y);
6459
+ if (e.vfs.exists(B)) {
6460
+ const X = f(B, E);
6458
6461
  if (X) return X;
6459
6462
  }
6460
6463
  const pe = te(R);
6461
6464
  if (pe === R) break;
6462
6465
  R = pe;
6463
6466
  }
6464
- const O = L("/usr/lib/node_modules", y);
6467
+ const O = C("/usr/lib/node_modules", y);
6465
6468
  if (e.vfs.exists(O)) {
6466
- const z = f(O, E);
6467
- if (z) return z;
6469
+ const B = f(O, E);
6470
+ if (B) return B;
6468
6471
  }
6469
- const Z = L("/usr/share/pkg/node_modules", y);
6472
+ const Z = C("/usr/share/pkg/node_modules", y);
6470
6473
  if (e.vfs.exists(Z)) {
6471
- const z = f(Z, E);
6472
- if (z) return z;
6474
+ const B = f(Z, E);
6475
+ if (B) return B;
6473
6476
  }
6474
6477
  return null;
6475
6478
  }
6476
6479
  function f(v, x) {
6477
6480
  if (x)
6478
6481
  return d("./" + x, v);
6479
- const y = L(v, "package.json");
6482
+ const y = C(v, "package.json");
6480
6483
  if (e.vfs.exists(y))
6481
6484
  try {
6482
6485
  const R = JSON.parse(e.vfs.readFileString(y));
@@ -6486,37 +6489,37 @@ function zs(r) {
6486
6489
  }
6487
6490
  } catch {
6488
6491
  }
6489
- const E = L(v, "index.js");
6492
+ const E = C(v, "index.js");
6490
6493
  return e.vfs.exists(E) ? { path: E } : null;
6491
6494
  }
6492
6495
  function g(v, x, y) {
6493
6496
  const E = te(x), R = { exports: {} }, O = R.exports;
6494
6497
  y && c.set(y, O);
6495
- const Z = { ...o }, z = pt(Z), pe = Fe({
6498
+ const Z = { ...o }, B = gt(Z), pe = Oe({
6496
6499
  argv: o.argv,
6497
6500
  env: o.env,
6498
6501
  cwd: o.cwd,
6499
6502
  stdout: e.stdout,
6500
6503
  stderr: e.stderr
6501
- }), X = He(e.stdout, e.stderr);
6504
+ }), X = Ge(e.stdout, e.stderr);
6502
6505
  function le(V) {
6503
- if (z[V]) {
6506
+ if (B[V]) {
6504
6507
  const G = c.get(V);
6505
6508
  if (G) return G;
6506
- const oe = z[V]();
6507
- return c.set(V, oe), oe;
6509
+ const ae = B[V]();
6510
+ return c.set(V, ae), ae;
6508
6511
  }
6509
6512
  if (V.startsWith("./") || V.startsWith("../") || V.startsWith("/")) {
6510
6513
  const G = d(V, E);
6511
6514
  if (G) {
6512
- const oe = c.get(G.path);
6513
- if (oe) return oe;
6515
+ const ae = c.get(G.path);
6516
+ if (ae) return ae;
6514
6517
  if (G.path.endsWith(".json")) {
6515
- const ye = e.vfs.readFileString(G.path), ze = JSON.parse(ye);
6516
- return c.set(G.path, ze), ze;
6518
+ const ye = e.vfs.readFileString(G.path), De = JSON.parse(ye);
6519
+ return c.set(G.path, De), De;
6517
6520
  }
6518
- const Ce = e.vfs.readFileString(G.path);
6519
- return g(Ce, G.path, G.path);
6521
+ const Re = e.vfs.readFileString(G.path);
6522
+ return g(Re, G.path, G.path);
6520
6523
  }
6521
6524
  throw new Error(`Cannot find module '${V}'`);
6522
6525
  }
@@ -6525,17 +6528,17 @@ function zs(r) {
6525
6528
  const G = c.get(se.path);
6526
6529
  if (G) return G;
6527
6530
  if (se.path.endsWith(".json")) {
6528
- const Ce = e.vfs.readFileString(se.path), ye = JSON.parse(Ce);
6531
+ const Re = e.vfs.readFileString(se.path), ye = JSON.parse(Re);
6529
6532
  return c.set(se.path, ye), ye;
6530
6533
  }
6531
- const oe = e.vfs.readFileString(se.path);
6532
- return g(oe, se.path, se.path);
6534
+ const ae = e.vfs.readFileString(se.path);
6535
+ return g(ae, se.path, se.path);
6533
6536
  }
6534
6537
  throw new Error(`Cannot find module '${V}'`);
6535
6538
  }
6536
6539
  const q = `(function(exports, require, module, __filename, __dirname, console, process, Buffer, setTimeout, setInterval, clearTimeout, clearInterval, global) {
6537
6540
  ${Gt(v)}
6538
- })`, J = new Function("return " + q)(), xe = {};
6541
+ })`, J = new Function("return " + q)(), Le = {};
6539
6542
  return J(
6540
6543
  O,
6541
6544
  le,
@@ -6549,33 +6552,33 @@ ${Gt(v)}
6549
6552
  globalThis.setInterval,
6550
6553
  globalThis.clearTimeout,
6551
6554
  globalThis.clearInterval,
6552
- xe
6555
+ Le
6553
6556
  ), y && R.exports !== O && c.set(y, R.exports), R.exports;
6554
6557
  }
6555
- const I = Fe({
6558
+ const A = Oe({
6556
6559
  argv: o.argv,
6557
6560
  env: o.env,
6558
6561
  cwd: o.cwd,
6559
6562
  stdout: e.stdout,
6560
6563
  stderr: e.stderr
6561
- }), k = He(e.stdout, e.stderr), _ = { exports: {} }, C = _.exports, A = {}, j = `(function(exports, require, module, __filename, __dirname, console, process, Buffer, setTimeout, setInterval, clearTimeout, clearInterval, global) {
6564
+ }), k = Ge(e.stdout, e.stderr), P = { exports: {} }, L = P.exports, I = {}, j = `(function(exports, require, module, __filename, __dirname, console, process, Buffer, setTimeout, setInterval, clearTimeout, clearInterval, global) {
6562
6565
  ${Gt(t)}
6563
6566
  })`;
6564
6567
  try {
6565
6568
  new Function("return " + j)()(
6566
- C,
6569
+ L,
6567
6570
  l,
6568
- _,
6571
+ P,
6569
6572
  s,
6570
6573
  i,
6571
6574
  k,
6572
- I,
6575
+ A,
6573
6576
  M,
6574
6577
  globalThis.setTimeout,
6575
6578
  globalThis.setInterval,
6576
6579
  globalThis.clearTimeout,
6577
6580
  globalThis.clearInterval,
6578
- A
6581
+ I
6579
6582
  );
6580
6583
  const x = c.get("http"), y = x == null ? void 0 : x[ps];
6581
6584
  if (y && y.length > 0) {
@@ -6598,16 +6601,16 @@ ${Gt(t)}
6598
6601
  }
6599
6602
  return 0;
6600
6603
  } catch (v) {
6601
- return v instanceof bt ? v.exitCode : (v instanceof Error ? e.stderr.write(`${v.stack || v.message}
6604
+ return v instanceof St ? v.exitCode : (v instanceof Error ? e.stderr.write(`${v.stack || v.message}
6602
6605
  `) : e.stderr.write(`${String(v)}
6603
6606
  `), 1);
6604
6607
  }
6605
6608
  };
6606
6609
  }
6607
6610
  function Ms(r) {
6608
- return zs(r);
6611
+ return Bs(r);
6609
6612
  }
6610
- const oi = zs(), Ds = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6613
+ const oi = Bs(), Ds = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6611
6614
  __proto__: null,
6612
6615
  createNodeCommand: Ms,
6613
6616
  default: oi
@@ -6625,8 +6628,8 @@ function Ws(r) {
6625
6628
  t = d[++h] ?? "GET";
6626
6629
  break;
6627
6630
  case "-H": {
6628
- const g = d[++h] ?? "", I = g.indexOf(":");
6629
- I !== -1 && (s[g.slice(0, I).trim()] = g.slice(I + 1).trim());
6631
+ const g = d[++h] ?? "", A = g.indexOf(":");
6632
+ A !== -1 && (s[g.slice(0, A).trim()] = g.slice(A + 1).trim());
6630
6633
  break;
6631
6634
  }
6632
6635
  case "-d":
@@ -6660,35 +6663,35 @@ function Ws(r) {
6660
6663
  try {
6661
6664
  const h = new URL(l), f = h.hostname, g = h.port ? Number(h.port) : h.protocol === "http:" ? 80 : 443;
6662
6665
  if ((f === "localhost" || f === "127.0.0.1") && r.has(g)) {
6663
- const I = r.get(g), k = {
6666
+ const A = r.get(g), k = {
6664
6667
  method: t,
6665
6668
  url: h.pathname + h.search,
6666
6669
  headers: s,
6667
6670
  body: n || ""
6668
- }, _ = {
6671
+ }, P = {
6669
6672
  statusCode: 200,
6670
6673
  headers: {},
6671
6674
  body: ""
6672
6675
  };
6673
- if (I(k, _), c) {
6674
- e.stdout.write(`HTTP/${_.statusCode} OK
6676
+ if (A(k, P), c) {
6677
+ e.stdout.write(`HTTP/${P.statusCode} OK
6675
6678
  `);
6676
- for (const [A, $] of Object.entries(_.headers))
6677
- e.stdout.write(`${A}: ${$}
6679
+ for (const [I, $] of Object.entries(P.headers))
6680
+ e.stdout.write(`${I}: ${$}
6678
6681
  `);
6679
6682
  return 0;
6680
6683
  }
6681
- const C = _.body;
6684
+ const L = P.body;
6682
6685
  if (i) {
6683
- const A = D(e.cwd, i);
6684
- e.vfs.writeFile(A, C), o || (e.stderr.write(` % Total % Received
6685
- `), e.stderr.write(` ${C.length} ${C.length}
6686
+ const I = D(e.cwd, i);
6687
+ e.vfs.writeFile(I, L), o || (e.stderr.write(` % Total % Received
6688
+ `), e.stderr.write(` ${L.length} ${L.length}
6686
6689
  `));
6687
6690
  } else
6688
- e.stdout.write(C), C.endsWith(`
6691
+ e.stdout.write(L), L.endsWith(`
6689
6692
  `) || e.stdout.write(`
6690
6693
  `);
6691
- return _.statusCode >= 200 && _.statusCode < 400 ? 0 : 22;
6694
+ return P.statusCode >= 200 && P.statusCode < 400 ? 0 : 22;
6692
6695
  }
6693
6696
  } catch {
6694
6697
  }
@@ -6702,14 +6705,14 @@ function Ws(r) {
6702
6705
  }, f = await fetch(l, h);
6703
6706
  if (c)
6704
6707
  return e.stdout.write(`HTTP/${f.status} ${f.statusText}
6705
- `), f.headers.forEach((I, k) => {
6706
- e.stdout.write(`${k}: ${I}
6708
+ `), f.headers.forEach((A, k) => {
6709
+ e.stdout.write(`${k}: ${A}
6707
6710
  `);
6708
6711
  }), 0;
6709
6712
  const g = await f.text();
6710
6713
  if (i) {
6711
- const I = D(e.cwd, i);
6712
- e.vfs.writeFile(I, g), o || (e.stderr.write(` % Total % Received
6714
+ const A = D(e.cwd, i);
6715
+ e.vfs.writeFile(A, g), o || (e.stderr.write(` % Total % Received
6713
6716
  `), e.stderr.write(` ${g.length} ${g.length}
6714
6717
  `));
6715
6718
  } else
@@ -6755,7 +6758,7 @@ async function hi(r) {
6755
6758
  if (i) break;
6756
6759
  n.push(o);
6757
6760
  }
6758
- return Ye(...n);
6761
+ return Xe(...n);
6759
6762
  }
6760
6763
  async function Hs(r) {
6761
6764
  const e = new DecompressionStream("gzip"), t = e.writable.getWriter();
@@ -6766,7 +6769,7 @@ async function Hs(r) {
6766
6769
  if (i) break;
6767
6770
  n.push(o);
6768
6771
  }
6769
- return Ye(...n);
6772
+ return Xe(...n);
6770
6773
  }
6771
6774
  function $e(r, e, t, s) {
6772
6775
  const n = ge(t);
@@ -6786,9 +6789,9 @@ function Vs(r, e, t) {
6786
6789
  let s = e;
6787
6790
  const n = e + t;
6788
6791
  for (; s < n && r[s] !== 0; ) s++;
6789
- return Ne(r.subarray(e, s));
6792
+ return je(r.subarray(e, s));
6790
6793
  }
6791
- function at(r, e, t) {
6794
+ function lt(r, e, t) {
6792
6795
  const s = Vs(r, e, t).trim();
6793
6796
  return s ? parseInt(s, 8) : 0;
6794
6797
  }
@@ -6804,7 +6807,7 @@ function di(r) {
6804
6807
  a.set(t.data), e.push(a);
6805
6808
  }
6806
6809
  }
6807
- return e.push(new Uint8Array(1024)), Ye(...e);
6810
+ return e.push(new Uint8Array(1024)), Xe(...e);
6808
6811
  }
6809
6812
  function Gs(r) {
6810
6813
  const e = [];
@@ -6819,7 +6822,7 @@ function Gs(r) {
6819
6822
  }
6820
6823
  if (n) break;
6821
6824
  let i = Vs(s, 0, 100);
6822
- const o = at(s, 100, 8), a = at(s, 124, 12), c = at(s, 136, 12) * 1e3, d = s[156] === 53 || i.endsWith("/");
6825
+ const o = lt(s, 100, 8), a = lt(s, 124, 12), c = lt(s, 136, 12) * 1e3, d = s[156] === 53 || i.endsWith("/");
6823
6826
  i.endsWith("/") && (i = i.slice(0, -1)), t += 512;
6824
6827
  let h = new Uint8Array(0);
6825
6828
  a > 0 && (h = r.slice(t, t + a), t += Math.ceil(a / 512) * 512), e.push({
@@ -6844,7 +6847,7 @@ function Se(r, e) {
6844
6847
  function Pe(r, e) {
6845
6848
  return (r[e] | r[e + 1] << 8 | r[e + 2] << 16 | r[e + 3] << 24) >>> 0;
6846
6849
  }
6847
- function vo(r) {
6850
+ function bo(r) {
6848
6851
  const e = [], t = [];
6849
6852
  let s = 0;
6850
6853
  for (const a of r) {
@@ -6860,9 +6863,9 @@ function vo(r) {
6860
6863
  for (const a of t)
6861
6864
  e.push(a), i += a.length;
6862
6865
  const o = new Uint8Array(22);
6863
- return Y(o, 0, 101010256), W(o, 4, 0), W(o, 6, 0), W(o, 8, r.length), W(o, 10, r.length), Y(o, 12, i), Y(o, 16, n), W(o, 20, 0), e.push(o), Ye(...e);
6866
+ return Y(o, 0, 101010256), W(o, 4, 0), W(o, 6, 0), W(o, 8, r.length), W(o, 10, r.length), Y(o, 12, i), Y(o, 16, n), W(o, 20, 0), e.push(o), Xe(...e);
6864
6867
  }
6865
- function bo(r) {
6868
+ function So(r) {
6866
6869
  const e = [];
6867
6870
  let t = -1;
6868
6871
  for (let i = r.length - 22; i >= 0; i--)
@@ -6875,15 +6878,15 @@ function bo(r) {
6875
6878
  let n = Pe(r, t + 16);
6876
6879
  for (let i = 0; i < s && Pe(r, n) === 33639248; i++) {
6877
6880
  const o = Se(r, n + 28), a = Se(r, n + 30), c = Se(r, n + 32), l = Pe(r, n + 42), d = r.subarray(n + 46, n + 46 + o);
6878
- let h = Ne(d);
6881
+ let h = je(d);
6879
6882
  const f = h.endsWith("/");
6880
6883
  f && (h = h.slice(0, -1));
6881
- const g = Se(r, l + 26), I = Se(r, l + 28), k = Pe(r, l + 18), _ = l + 30 + g + I, C = f ? new Uint8Array(0) : r.slice(_, _ + k);
6882
- e.push({ path: h, data: C, isDirectory: f }), n += 46 + o + a + c;
6884
+ const g = Se(r, l + 26), A = Se(r, l + 28), k = Pe(r, l + 18), P = l + 30 + g + A, L = f ? new Uint8Array(0) : r.slice(P, P + k);
6885
+ e.push({ path: h, data: L, isDirectory: f }), n += 46 + o + a + c;
6883
6886
  }
6884
6887
  return e;
6885
6888
  }
6886
- function So(r, e, t) {
6889
+ function $o(r, e, t) {
6887
6890
  const s = [];
6888
6891
  function n(i, o) {
6889
6892
  const a = r.stat(i);
@@ -6915,8 +6918,8 @@ function So(r, e, t) {
6915
6918
  }
6916
6919
  return s;
6917
6920
  }
6918
- const Ve = "/usr/lib/node_modules", Ge = "/usr/bin", fi = "https://registry.npmjs.org", pi = "10.0.0";
6919
- function kt(r) {
6921
+ const Ee = "/usr/lib/node_modules", ze = "/usr/bin", fi = "https://registry.npmjs.org", pi = "10.0.0";
6922
+ function Ke(r) {
6920
6923
  return r.NPM_REGISTRY || fi;
6921
6924
  }
6922
6925
  function Zs(r) {
@@ -6936,7 +6939,7 @@ function ke(r) {
6936
6939
  const e = r.match(/^(\d+)\.(\d+)\.(\d+)/);
6937
6940
  return e ? [parseInt(e[1]), parseInt(e[2]), parseInt(e[3])] : null;
6938
6941
  }
6939
- function We(r, e) {
6942
+ function qe(r, e) {
6940
6943
  return r[0] !== e[0] ? r[0] - e[0] : r[1] !== e[1] ? r[1] - e[1] : r[2] - e[2];
6941
6944
  }
6942
6945
  function mi(r) {
@@ -6951,7 +6954,7 @@ function gi(r, e) {
6951
6954
  }
6952
6955
  if (e.startsWith("^")) {
6953
6956
  const s = ke(e.slice(1));
6954
- return s ? s[0] > 0 ? t[0] === s[0] && We(t, s) >= 0 : s[1] > 0 ? t[0] === 0 && t[1] === s[1] && We(t, s) >= 0 : t[0] === 0 && t[1] === 0 && t[2] === s[2] : !1;
6957
+ return s ? s[0] > 0 ? t[0] === s[0] && qe(t, s) >= 0 : s[1] > 0 ? t[0] === 0 && t[1] === s[1] && qe(t, s) >= 0 : t[0] === 0 && t[1] === 0 && t[2] === s[2] : !1;
6955
6958
  }
6956
6959
  if (e.startsWith("~")) {
6957
6960
  const s = ke(e.slice(1));
@@ -6959,7 +6962,7 @@ function gi(r, e) {
6959
6962
  }
6960
6963
  if (e.startsWith(">=")) {
6961
6964
  const s = ke(e.slice(2).trim());
6962
- return s ? We(t, s) >= 0 : !1;
6965
+ return s ? qe(t, s) >= 0 : !1;
6963
6966
  }
6964
6967
  return !0;
6965
6968
  }
@@ -6981,7 +6984,7 @@ async function wi(r, e, t, s) {
6981
6984
  });
6982
6985
  if (!i.ok)
6983
6986
  throw new Error(`Package '${e}' not found in registry`);
6984
- const o = await i.json(), c = Object.keys(o.versions || {}).filter((l) => gi(l, t)).map((l) => ({ version: l, parsed: ke(l) })).filter((l) => l.parsed !== null).sort((l, d) => We(d.parsed, l.parsed));
6987
+ const o = await i.json(), c = Object.keys(o.versions || {}).filter((l) => gi(l, t)).map((l) => ({ version: l, parsed: ke(l) })).filter((l) => l.parsed !== null).sort((l, d) => qe(d.parsed, l.parsed));
6985
6988
  if (c.length === 0)
6986
6989
  throw new Error(`No version of '${e}' satisfies '${t}'`);
6987
6990
  return o.versions[c[0].version];
@@ -7000,7 +7003,7 @@ async function yi(r, e, t, s) {
7000
7003
  if (d === -1) continue;
7001
7004
  const h = l.path.slice(d + 1);
7002
7005
  if (!h) continue;
7003
- const f = L(e, h);
7006
+ const f = C(e, h);
7004
7007
  if (l.type === "directory")
7005
7008
  try {
7006
7009
  t.mkdir(f, { recursive: !0 });
@@ -7017,8 +7020,8 @@ async function yi(r, e, t, s) {
7017
7020
  }
7018
7021
  }
7019
7022
  }
7020
- function je(r, e) {
7021
- const t = L(e, "package.json");
7023
+ function Be(r, e) {
7024
+ const t = C(e, "package.json");
7022
7025
  try {
7023
7026
  return JSON.parse(r.readFileString(t));
7024
7027
  } catch {
@@ -7026,7 +7029,7 @@ function je(r, e) {
7026
7029
  }
7027
7030
  }
7028
7031
  function Et(r, e, t) {
7029
- const s = L(e, "package.json");
7032
+ const s = C(e, "package.json");
7030
7033
  r.writeFile(s, JSON.stringify(t, null, 2) + `
7031
7034
  `);
7032
7035
  }
@@ -7044,11 +7047,11 @@ function vi(r, e, t) {
7044
7047
  }))
7045
7048
  );
7046
7049
  }
7047
- async function mt(r, e, t, s, n, i, o, a, c, l, d) {
7050
+ async function Ze(r, e, t, s, n, i, o, a, c, l, d) {
7048
7051
  if (d.has(r)) return 0;
7049
7052
  d.add(r);
7050
- const h = L(t, r);
7051
- if (s.exists(L(h, "package.json")))
7053
+ const h = C(t, r);
7054
+ if (s.exists(C(h, "package.json")))
7052
7055
  return 0;
7053
7056
  o.write(` ${r}${e ? "@" + e : ""}...
7054
7057
  `);
@@ -7056,27 +7059,27 @@ async function mt(r, e, t, s, n, i, o, a, c, l, d) {
7056
7059
  await yi(f.dist.tarball, h, s, i);
7057
7060
  let g = 1;
7058
7061
  if (c) {
7059
- const I = xt(f);
7060
- for (const [k, _] of Object.entries(I)) {
7061
- const C = D(h, _);
7062
- vi(l, k, C);
7062
+ const A = xt(f);
7063
+ for (const [k, P] of Object.entries(A)) {
7064
+ const L = D(h, P);
7065
+ vi(l, k, L);
7063
7066
  try {
7064
- s.mkdir(Ge, { recursive: !0 });
7067
+ s.mkdir(ze, { recursive: !0 });
7065
7068
  } catch {
7066
7069
  }
7067
7070
  s.writeFile(
7068
- L(Ge, k),
7071
+ C(ze, k),
7069
7072
  `#!/usr/bin/env node
7070
- require('${C}');
7073
+ require('${L}');
7071
7074
  `
7072
7075
  );
7073
7076
  }
7074
7077
  }
7075
7078
  if (f.dependencies)
7076
- for (const [I, k] of Object.entries(f.dependencies))
7079
+ for (const [A, k] of Object.entries(f.dependencies))
7077
7080
  try {
7078
- g += await mt(
7079
- I,
7081
+ g += await Ze(
7082
+ A,
7080
7083
  k,
7081
7084
  t,
7082
7085
  s,
@@ -7088,8 +7091,8 @@ require('${C}');
7088
7091
  l,
7089
7092
  d
7090
7093
  );
7091
- } catch (_) {
7092
- a.write(` warn: could not install ${I}: ${_ instanceof Error ? _.message : String(_)}
7094
+ } catch (P) {
7095
+ a.write(` warn: could not install ${A}: ${P instanceof Error ? P.message : String(P)}
7093
7096
  `);
7094
7097
  }
7095
7098
  return g;
@@ -7111,7 +7114,7 @@ function bi(r) {
7111
7114
  `);
7112
7115
  }
7113
7116
  async function Si(r) {
7114
- const e = L(r.cwd, "package.json");
7117
+ const e = C(r.cwd, "package.json");
7115
7118
  if (r.vfs.exists(e))
7116
7119
  return r.stderr.write(`package.json already exists
7117
7120
  `), 1;
@@ -7136,16 +7139,16 @@ async function $i(r, e) {
7136
7139
  const i = [];
7137
7140
  for (const h of t)
7138
7141
  h === "-g" || h === "--global" ? s = !0 : h === "-D" || h === "--save-dev" ? n = !0 : h === "--save" || h === "-S" || h.startsWith("-") || i.push(h);
7139
- const o = kt(r.env), a = Date.now();
7142
+ const o = Ke(r.env), a = Date.now();
7140
7143
  let c = 0;
7141
- const l = s ? Ve : L(r.cwd, "node_modules");
7144
+ const l = s ? Ee : C(r.cwd, "node_modules");
7142
7145
  if (s) {
7143
7146
  try {
7144
- r.vfs.mkdir(Ve, { recursive: !0 });
7147
+ r.vfs.mkdir(Ee, { recursive: !0 });
7145
7148
  } catch {
7146
7149
  }
7147
7150
  try {
7148
- r.vfs.mkdir(Ge, { recursive: !0 });
7151
+ r.vfs.mkdir(ze, { recursive: !0 });
7149
7152
  } catch {
7150
7153
  }
7151
7154
  }
@@ -7153,7 +7156,7 @@ async function $i(r, e) {
7153
7156
  if (s)
7154
7157
  return r.stderr.write(`npm: install with no args cannot be used with -g
7155
7158
  `), 1;
7156
- const h = je(r.vfs, r.cwd);
7159
+ const h = Be(r.vfs, r.cwd);
7157
7160
  if (!h)
7158
7161
  return r.stderr.write(`npm ERR! no package.json found in this directory
7159
7162
  `), 1;
@@ -7163,12 +7166,12 @@ async function $i(r, e) {
7163
7166
  `), 0;
7164
7167
  r.stdout.write(`Installing dependencies...
7165
7168
  `);
7166
- const I = /* @__PURE__ */ new Set();
7167
- for (const [k, _] of Object.entries(f))
7169
+ const A = /* @__PURE__ */ new Set();
7170
+ for (const [k, P] of Object.entries(f))
7168
7171
  try {
7169
- c += await mt(
7172
+ c += await Ze(
7170
7173
  k,
7171
- _,
7174
+ P,
7172
7175
  l,
7173
7176
  r.vfs,
7174
7177
  o,
@@ -7177,10 +7180,10 @@ async function $i(r, e) {
7177
7180
  r.stderr,
7178
7181
  !1,
7179
7182
  e,
7180
- I
7183
+ A
7181
7184
  );
7182
- } catch (C) {
7183
- r.stderr.write(`npm ERR! ${k}: ${C instanceof Error ? C.message : String(C)}
7185
+ } catch (L) {
7186
+ r.stderr.write(`npm ERR! ${k}: ${L instanceof Error ? L.message : String(L)}
7184
7187
  `);
7185
7188
  }
7186
7189
  } else {
@@ -7188,11 +7191,11 @@ async function $i(r, e) {
7188
7191
  `);
7189
7192
  const h = /* @__PURE__ */ new Set();
7190
7193
  for (const f of i) {
7191
- const { name: g, version: I } = Zs(f);
7194
+ const { name: g, version: A } = Zs(f);
7192
7195
  try {
7193
- if (c += await mt(
7196
+ if (c += await Ze(
7194
7197
  g,
7195
- I,
7198
+ A,
7196
7199
  l,
7197
7200
  r.vfs,
7198
7201
  o,
@@ -7203,22 +7206,22 @@ async function $i(r, e) {
7203
7206
  e,
7204
7207
  h
7205
7208
  ), !s) {
7206
- const k = je(r.vfs, r.cwd);
7209
+ const k = Be(r.vfs, r.cwd);
7207
7210
  if (k) {
7208
- const _ = L(l, g, "package.json");
7209
- let C = "latest";
7211
+ const P = C(l, g, "package.json");
7212
+ let L = "latest";
7210
7213
  try {
7211
- C = "^" + JSON.parse(r.vfs.readFileString(_)).version;
7214
+ L = "^" + JSON.parse(r.vfs.readFileString(P)).version;
7212
7215
  } catch {
7213
7216
  }
7214
- n ? (k.devDependencies = k.devDependencies || {}, k.devDependencies[g] = C) : (k.dependencies = k.dependencies || {}, k.dependencies[g] = C), Et(r.vfs, r.cwd, k);
7217
+ n ? (k.devDependencies = k.devDependencies || {}, k.devDependencies[g] = L) : (k.dependencies = k.dependencies || {}, k.dependencies[g] = L), Et(r.vfs, r.cwd, k);
7215
7218
  }
7216
7219
  }
7217
7220
  } catch (k) {
7218
- const _ = k instanceof Error ? k.message : String(k);
7219
- return _.includes("Failed to fetch") || _.includes("NetworkError") || _.includes("CORS") ? (r.stderr.write(`npm ERR! network error fetching ${g}
7221
+ const P = k instanceof Error ? k.message : String(k);
7222
+ return P.includes("Failed to fetch") || P.includes("NetworkError") || P.includes("CORS") ? (r.stderr.write(`npm ERR! network error fetching ${g}
7220
7223
  `), r.stderr.write(`This may be a CORS restriction. Try: export NPM_REGISTRY=<proxy-url>
7221
- `)) : r.stderr.write(`npm ERR! ${_}
7224
+ `)) : r.stderr.write(`npm ERR! ${P}
7222
7225
  `), 1;
7223
7226
  }
7224
7227
  }
@@ -7237,9 +7240,9 @@ async function ki(r, e) {
7237
7240
  if (n.length === 0)
7238
7241
  return r.stderr.write(`npm uninstall requires at least one package name
7239
7242
  `), 1;
7240
- const i = s ? Ve : L(r.cwd, "node_modules");
7243
+ const i = s ? Ee : C(r.cwd, "node_modules");
7241
7244
  for (const o of n) {
7242
- const a = L(i, o);
7245
+ const a = C(i, o);
7243
7246
  if (!r.vfs.exists(a)) {
7244
7247
  r.stderr.write(`npm warn: ${o} is not installed
7245
7248
  `);
@@ -7247,10 +7250,10 @@ async function ki(r, e) {
7247
7250
  }
7248
7251
  if (s)
7249
7252
  try {
7250
- const c = JSON.parse(r.vfs.readFileString(L(a, "package.json")));
7253
+ const c = JSON.parse(r.vfs.readFileString(C(a, "package.json")));
7251
7254
  for (const l of Object.keys(xt(c)))
7252
7255
  try {
7253
- r.vfs.unlink(L(Ge, l));
7256
+ r.vfs.unlink(C(ze, l));
7254
7257
  } catch {
7255
7258
  }
7256
7259
  } catch {
@@ -7262,7 +7265,7 @@ async function ki(r, e) {
7262
7265
  `), 1;
7263
7266
  }
7264
7267
  if (!s) {
7265
- const c = je(r.vfs, r.cwd);
7268
+ const c = Be(r.vfs, r.cwd);
7266
7269
  c && (c.dependencies && delete c.dependencies[o], c.devDependencies && delete c.devDependencies[o], Et(r.vfs, r.cwd, c));
7267
7270
  }
7268
7271
  r.stdout.write(`removed ${o}
@@ -7272,7 +7275,7 @@ async function ki(r, e) {
7272
7275
  }
7273
7276
  async function Ei(r) {
7274
7277
  var a;
7275
- const e = r.args.slice(1), t = e.includes("-g") || e.includes("--global"), s = t ? Ve : L(r.cwd, "node_modules"), n = t ? "/usr/lib" : ((a = je(r.vfs, r.cwd)) == null ? void 0 : a.name) || r.cwd;
7278
+ const e = r.args.slice(1), t = e.includes("-g") || e.includes("--global"), s = t ? Ee : C(r.cwd, "node_modules"), n = t ? "/usr/lib" : ((a = Be(r.vfs, r.cwd)) == null ? void 0 : a.name) || r.cwd;
7276
7279
  if (r.stdout.write(`${n}
7277
7280
  `), !r.vfs.exists(s))
7278
7281
  return r.stdout.write(`└── (empty)
@@ -7282,16 +7285,16 @@ async function Ei(r) {
7282
7285
  if (c.type === "directory")
7283
7286
  if (c.name.startsWith("@"))
7284
7287
  try {
7285
- const l = r.vfs.readdir(L(s, c.name));
7288
+ const l = r.vfs.readdir(C(s, c.name));
7286
7289
  for (const d of l) {
7287
7290
  if (d.type !== "directory") continue;
7288
- const h = Zt(r.vfs, L(s, c.name, d.name));
7291
+ const h = Zt(r.vfs, C(s, c.name, d.name));
7289
7292
  o.push({ name: `${c.name}/${d.name}`, version: h });
7290
7293
  }
7291
7294
  } catch {
7292
7295
  }
7293
7296
  else {
7294
- const l = Zt(r.vfs, L(s, c.name));
7297
+ const l = Zt(r.vfs, C(s, c.name));
7295
7298
  o.push({ name: c.name, version: l });
7296
7299
  }
7297
7300
  if (o.length === 0)
@@ -7307,13 +7310,13 @@ async function Ei(r) {
7307
7310
  }
7308
7311
  function Zt(r, e) {
7309
7312
  try {
7310
- return JSON.parse(r.readFileString(L(e, "package.json"))).version || "?";
7313
+ return JSON.parse(r.readFileString(C(e, "package.json"))).version || "?";
7311
7314
  } catch {
7312
7315
  return "?";
7313
7316
  }
7314
7317
  }
7315
- async function ct(r, e) {
7316
- const s = r.args.slice(1)[0], n = je(r.vfs, r.cwd);
7318
+ async function ht(r, e) {
7319
+ const s = r.args.slice(1)[0], n = Be(r.vfs, r.cwd);
7317
7320
  if (!n)
7318
7321
  return r.stderr.write(`npm ERR! no package.json found
7319
7322
  `), 1;
@@ -7354,7 +7357,7 @@ async function xi(r) {
7354
7357
  if (!t)
7355
7358
  return r.stderr.write(`Usage: npm info <package>
7356
7359
  `), 1;
7357
- const { name: s, version: n } = Zs(t), i = kt(r.env);
7360
+ const { name: s, version: n } = Zs(t), i = Ke(r.env);
7358
7361
  try {
7359
7362
  const o = await Ys(i, s, n, r.signal);
7360
7363
  r.stdout.write(`
@@ -7390,7 +7393,7 @@ async function Ci(r) {
7390
7393
  if (!t)
7391
7394
  return r.stderr.write(`Usage: npm search <term>
7392
7395
  `), 1;
7393
- const n = `${kt(r.env)}/-/v1/search?text=${encodeURIComponent(t)}&size=10`;
7396
+ const n = `${Ke(r.env)}/-/v1/search?text=${encodeURIComponent(t)}&size=10`;
7394
7397
  try {
7395
7398
  const i = await fetch(n, { signal: r.signal });
7396
7399
  if (!i.ok)
@@ -7435,11 +7438,11 @@ function Li(r, e) {
7435
7438
  return Ei(t);
7436
7439
  case "run":
7437
7440
  case "run-script":
7438
- return ct(t, e);
7441
+ return ht(t, e);
7439
7442
  case "start":
7440
- return ct({ ...t, args: ["run", "start", ...t.args.slice(1)] }, e);
7443
+ return ht({ ...t, args: ["run", "start", ...t.args.slice(1)] }, e);
7441
7444
  case "test":
7442
- return ct({ ...t, args: ["run", "test", ...t.args.slice(1)] }, e);
7445
+ return ht({ ...t, args: ["run", "test", ...t.args.slice(1)] }, e);
7443
7446
  case "info":
7444
7447
  case "view":
7445
7448
  case "show":
@@ -7457,12 +7460,47 @@ function Li(r, e) {
7457
7460
  }
7458
7461
  };
7459
7462
  }
7460
- const Ri = "https://esm.sh", Jt = /* @__PURE__ */ new Map(), Yt = /* @__PURE__ */ new Map();
7461
- function Pi(r) {
7462
- return r.LIFO_CDN || Ri;
7463
+ async function Ri(r, e, t) {
7464
+ const s = Ke(e.env), n = Date.now(), i = /* @__PURE__ */ new Set();
7465
+ try {
7466
+ e.vfs.mkdir(Ee, { recursive: !0 });
7467
+ } catch {
7468
+ }
7469
+ try {
7470
+ e.vfs.mkdir(ze, { recursive: !0 });
7471
+ } catch {
7472
+ }
7473
+ try {
7474
+ const o = await Ze(
7475
+ r,
7476
+ null,
7477
+ Ee,
7478
+ e.vfs,
7479
+ s,
7480
+ e.signal,
7481
+ e.stdout,
7482
+ e.stderr,
7483
+ !0,
7484
+ t,
7485
+ i
7486
+ ), a = ((Date.now() - n) / 1e3).toFixed(1);
7487
+ return e.stdout.write(`
7488
+ added ${o} package${o !== 1 ? "s" : ""} in ${a}s
7489
+ `), 0;
7490
+ } catch (o) {
7491
+ const a = o instanceof Error ? o.message : String(o);
7492
+ return a.includes("Failed to fetch") || a.includes("NetworkError") || a.includes("CORS") ? (e.stderr.write(`npm ERR! network error fetching ${r}
7493
+ `), e.stderr.write(`This may be a CORS restriction. Try: export NPM_REGISTRY=<proxy-url>
7494
+ `)) : e.stderr.write(`npm ERR! ${a}
7495
+ `), 1;
7496
+ }
7497
+ }
7498
+ const Ti = "https://esm.sh", Jt = /* @__PURE__ */ new Map(), Yt = /* @__PURE__ */ new Map();
7499
+ function _i(r) {
7500
+ return r.LIFO_CDN || Ti;
7463
7501
  }
7464
- function Ti(r) {
7465
- const e = Pi(r.env);
7502
+ function Pi(r) {
7503
+ const e = _i(r.env);
7466
7504
  return {
7467
7505
  cdn: e,
7468
7506
  async import(t) {
@@ -7497,9 +7535,9 @@ function Xt(r) {
7497
7535
  }
7498
7536
  return r;
7499
7537
  }
7500
- function Qe(r, e) {
7538
+ function et(r, e) {
7501
7539
  return async (t) => {
7502
- const s = e.readFileString(r), n = Ti(t), i = te(r), o = {
7540
+ const s = e.readFileString(r), n = Pi(t), i = te(r), o = {
7503
7541
  vfs: t.vfs,
7504
7542
  cwd: t.cwd,
7505
7543
  env: t.env,
@@ -7507,7 +7545,7 @@ function Qe(r, e) {
7507
7545
  stderr: t.stderr,
7508
7546
  argv: [r, ...t.args],
7509
7547
  signal: t.signal
7510
- }, a = pt(o), c = /* @__PURE__ */ new Map();
7548
+ }, a = gt(o), c = /* @__PURE__ */ new Map();
7511
7549
  function l($) {
7512
7550
  if (c.has($)) return c.get($);
7513
7551
  if (a[$]) {
@@ -7525,7 +7563,7 @@ function Qe(r, e) {
7525
7563
  const R = e.readFileString(E), O = f(R, E);
7526
7564
  return c.set($, O), O;
7527
7565
  }
7528
- const y = L(v, "index.js");
7566
+ const y = C(v, "index.js");
7529
7567
  if (e.exists(y)) {
7530
7568
  const E = e.readFileString(y), R = f(E, y);
7531
7569
  return c.set($, R), R;
@@ -7556,7 +7594,7 @@ function Qe(r, e) {
7556
7594
  }
7557
7595
  let y = j;
7558
7596
  for (; ; ) {
7559
- const E = L(y, "node_modules", v);
7597
+ const E = C(y, "node_modules", v);
7560
7598
  if (e.exists(E))
7561
7599
  return h(E, x);
7562
7600
  const R = te(y);
@@ -7564,7 +7602,7 @@ function Qe(r, e) {
7564
7602
  y = R;
7565
7603
  }
7566
7604
  for (const E of ["/usr/lib/node_modules", "/usr/share/pkg/node_modules"]) {
7567
- const R = L(E, v);
7605
+ const R = C(E, v);
7568
7606
  if (e.exists(R))
7569
7607
  return h(R, x);
7570
7608
  }
@@ -7575,10 +7613,10 @@ function Qe(r, e) {
7575
7613
  const y = D($, j);
7576
7614
  for (const R of [y, y + ".js", y + ".json"])
7577
7615
  if (e.exists(R)) return R;
7578
- const E = L(y, "index.js");
7616
+ const E = C(y, "index.js");
7579
7617
  return e.exists(E) ? E : null;
7580
7618
  }
7581
- const v = L($, "package.json");
7619
+ const v = C($, "package.json");
7582
7620
  if (e.exists(v))
7583
7621
  try {
7584
7622
  const y = JSON.parse(e.readFileString(v));
@@ -7589,31 +7627,31 @@ function Qe(r, e) {
7589
7627
  }
7590
7628
  } catch {
7591
7629
  }
7592
- const x = L($, "index.js");
7630
+ const x = C($, "index.js");
7593
7631
  return e.exists(x) ? x : null;
7594
7632
  }
7595
7633
  function f($, j) {
7596
- const v = te(j), x = { exports: {} }, y = x.exports, E = Fe({
7634
+ const v = te(j), x = { exports: {} }, y = x.exports, E = Oe({
7597
7635
  argv: o.argv,
7598
7636
  env: o.env,
7599
7637
  cwd: o.cwd,
7600
7638
  stdout: t.stdout,
7601
7639
  stderr: t.stderr
7602
- }), R = He(t.stdout, t.stderr);
7640
+ }), R = Ge(t.stdout, t.stderr);
7603
7641
  function O(X) {
7604
7642
  if (X.startsWith("./") || X.startsWith("../")) {
7605
- const le = D(v, X), Be = [le, le + ".js", le + ".json"];
7606
- for (const J of Be)
7643
+ const le = D(v, X), Me = [le, le + ".js", le + ".json"];
7644
+ for (const J of Me)
7607
7645
  if (e.exists(J)) {
7608
7646
  if (c.has(J)) return c.get(J);
7609
7647
  if (J.endsWith(".json")) {
7610
7648
  const V = JSON.parse(e.readFileString(J));
7611
7649
  return c.set(J, V), V;
7612
7650
  }
7613
- const xe = e.readFileString(J);
7614
- return f(xe, J);
7651
+ const Le = e.readFileString(J);
7652
+ return f(Le, J);
7615
7653
  }
7616
- const q = L(le, "index.js");
7654
+ const q = C(le, "index.js");
7617
7655
  if (e.exists(q)) {
7618
7656
  if (c.has(q)) return c.get(q);
7619
7657
  const J = e.readFileString(q);
@@ -7623,10 +7661,10 @@ function Qe(r, e) {
7623
7661
  }
7624
7662
  return l(X);
7625
7663
  }
7626
- const z = `(function(exports,require,module,__filename,__dirname,console,process,Buffer,setTimeout,setInterval,clearTimeout,clearInterval,global){
7664
+ const B = `(function(exports,require,module,__filename,__dirname,console,process,Buffer,setTimeout,setInterval,clearTimeout,clearInterval,global){
7627
7665
  ${Xt($)}
7628
7666
  })`;
7629
- return new Function("return " + z)()(
7667
+ return new Function("return " + B)()(
7630
7668
  y,
7631
7669
  O,
7632
7670
  x,
@@ -7642,23 +7680,23 @@ ${Xt($)}
7642
7680
  {}
7643
7681
  ), x.exports !== y ? x.exports : y;
7644
7682
  }
7645
- const g = Fe({
7683
+ const g = Oe({
7646
7684
  argv: o.argv,
7647
7685
  env: o.env,
7648
7686
  cwd: o.cwd,
7649
7687
  stdout: t.stdout,
7650
7688
  stderr: t.stderr
7651
- }), I = He(t.stdout, t.stderr), k = { exports: {} }, _ = k.exports, A = `(function(exports,require,module,__filename,__dirname,console,process,Buffer,setTimeout,setInterval,clearTimeout,clearInterval,global){
7689
+ }), A = Ge(t.stdout, t.stderr), k = { exports: {} }, P = k.exports, I = `(function(exports,require,module,__filename,__dirname,console,process,Buffer,setTimeout,setInterval,clearTimeout,clearInterval,global){
7652
7690
  ${Xt(s)}
7653
7691
  })`;
7654
7692
  try {
7655
- new Function("return " + A)()(
7656
- _,
7693
+ new Function("return " + I)()(
7694
+ P,
7657
7695
  l,
7658
7696
  k,
7659
7697
  r,
7660
7698
  i,
7661
- I,
7699
+ A,
7662
7700
  g,
7663
7701
  M,
7664
7702
  globalThis.setTimeout,
@@ -7674,14 +7712,14 @@ ${Xt(s)}
7674
7712
  const v = await j(t, n);
7675
7713
  return typeof v == "number" ? v : 0;
7676
7714
  } catch ($) {
7677
- return $ instanceof bt ? $.exitCode : ($ instanceof Error ? t.stderr.write(`${$.stack || $.message}
7715
+ return $ instanceof St ? $.exitCode : ($ instanceof Error ? t.stderr.write(`${$.stack || $.message}
7678
7716
  `) : t.stderr.write(`${String($)}
7679
7717
  `), 1);
7680
7718
  }
7681
7719
  };
7682
7720
  }
7683
- function Oe(r, e) {
7684
- const t = L(e, "package.json");
7721
+ function Ce(r, e) {
7722
+ const t = C(e, "package.json");
7685
7723
  try {
7686
7724
  return JSON.parse(r.readFileString(t)).lifo || null;
7687
7725
  } catch {
@@ -7689,7 +7727,7 @@ function Oe(r, e) {
7689
7727
  }
7690
7728
  }
7691
7729
  const Xs = "/etc/lifo/dev-links.json";
7692
- function Ke(r) {
7730
+ function tt(r) {
7693
7731
  try {
7694
7732
  return JSON.parse(r.readFileString(Xs));
7695
7733
  } catch {
@@ -7704,49 +7742,49 @@ function Qs(r, e) {
7704
7742
  r.writeFile(Xs, JSON.stringify(e, null, 2) + `
7705
7743
  `);
7706
7744
  }
7707
- function _i(r, e, t) {
7708
- const s = Oe(r, t);
7745
+ function Ii(r, e, t) {
7746
+ const s = Ce(r, t);
7709
7747
  if (!s)
7710
7748
  throw new Error(
7711
- `No "lifo" field found in ${L(t, "package.json")}. Is this a lifo package?`
7749
+ `No "lifo" field found in ${C(t, "package.json")}. Is this a lifo package?`
7712
7750
  );
7713
7751
  let n;
7714
7752
  try {
7715
- n = JSON.parse(r.readFileString(L(t, "package.json"))).name || t.split("/").pop() || "unknown";
7753
+ n = JSON.parse(r.readFileString(C(t, "package.json"))).name || t.split("/").pop() || "unknown";
7716
7754
  } catch {
7717
7755
  n = t.split("/").pop() || "unknown";
7718
7756
  }
7719
- const i = Ke(r);
7757
+ const i = tt(r);
7720
7758
  i[n] = {
7721
7759
  path: t,
7722
7760
  commands: s.commands
7723
7761
  }, Qs(r, i);
7724
7762
  const o = [];
7725
7763
  for (const [a, c] of Object.entries(s.commands)) {
7726
- const l = L(t, c);
7727
- e.register(a, Qe(l, r)), o.push(a);
7764
+ const l = C(t, c);
7765
+ e.register(a, et(l, r)), o.push(a);
7728
7766
  }
7729
7767
  return o;
7730
7768
  }
7731
7769
  function Ai(r, e) {
7732
- const t = Ke(r), s = t[e];
7770
+ const t = tt(r), s = t[e];
7733
7771
  if (!s) return null;
7734
7772
  const n = Object.keys(s.commands);
7735
7773
  return delete t[e], Qs(r, t), n;
7736
7774
  }
7737
- function Ii(r, e) {
7738
- const t = Ke(r);
7775
+ function Ni(r, e) {
7776
+ const t = tt(r);
7739
7777
  for (const s of Object.values(t)) {
7740
- const n = Oe(r, s.path);
7778
+ const n = Ce(r, s.path);
7741
7779
  if (n)
7742
7780
  for (const [i, o] of Object.entries(n.commands)) {
7743
- const a = L(s.path, o);
7744
- r.exists(a) && e.register(i, Qe(a, r));
7781
+ const a = C(s.path, o);
7782
+ r.exists(a) && e.register(i, et(a, r));
7745
7783
  }
7746
7784
  }
7747
7785
  }
7748
- const ce = "/usr/lib/node_modules";
7749
- function Ni(r) {
7786
+ const ie = "/usr/lib/node_modules";
7787
+ function Fi(r) {
7750
7788
  r.write(`Usage: lifo <command> [args]
7751
7789
 
7752
7790
  `), r.write(`Commands:
@@ -7762,24 +7800,21 @@ Environment:
7762
7800
  `), r.write(` LIFO_CDN CDN for ESM imports (default: https://esm.sh)
7763
7801
  `);
7764
7802
  }
7765
- async function Fi(r, e, t) {
7766
- const s = r.args[1];
7767
- if (!s)
7803
+ async function ji(r, e) {
7804
+ const t = r.args[1];
7805
+ if (!t)
7768
7806
  return r.stderr.write(`lifo install: package name required
7769
7807
  `), 1;
7770
- const n = s.startsWith("lifo-pkg-") ? s : `lifo-pkg-${s}`;
7771
- if (r.stdout.write(`Installing ${n} globally...
7772
- `), t) {
7773
- const a = await t(`npm install -g ${n}`, r);
7774
- if (a !== 0) return a;
7775
- } else
7776
- return r.stderr.write("lifo: shell integration unavailable, run: npm install -g " + n + `
7777
- `), 1;
7778
- const i = L(ce, n), o = Oe(r.vfs, i);
7808
+ const s = t.startsWith("lifo-pkg-") ? t : `lifo-pkg-${t}`;
7809
+ r.stdout.write(`Installing ${s} globally...
7810
+ `);
7811
+ const n = await Ri(s, r, e);
7812
+ if (n !== 0) return n;
7813
+ const i = C(ie, s), o = Ce(r.vfs, i);
7779
7814
  if (o)
7780
7815
  for (const [a, c] of Object.entries(o.commands)) {
7781
- const l = L(i, c);
7782
- r.vfs.exists(l) && (e.register(a, Qe(l, r.vfs)), r.stdout.write(` registered command: ${a}
7816
+ const l = C(i, c);
7817
+ r.vfs.exists(l) && (e.register(a, et(l, r.vfs)), r.stdout.write(` registered command: ${a}
7783
7818
  `));
7784
7819
  }
7785
7820
  else
@@ -7787,33 +7822,46 @@ async function Fi(r, e, t) {
7787
7822
  `);
7788
7823
  return 0;
7789
7824
  }
7790
- async function ji(r, e) {
7825
+ async function Oi(r, e) {
7791
7826
  const t = r.args[1];
7792
7827
  if (!t)
7793
7828
  return r.stderr.write(`lifo remove: package name required
7794
7829
  `), 1;
7795
- const s = t.startsWith("lifo-pkg-") ? t : `lifo-pkg-${t}`;
7796
- return e ? e(`npm uninstall -g ${s}`, r) : (r.stderr.write("lifo: shell integration unavailable, run: npm uninstall -g " + s + `
7797
- `), 1);
7830
+ const s = t.startsWith("lifo-pkg-") ? t : `lifo-pkg-${t}`, n = C(ie, s);
7831
+ if (!r.vfs.exists(n))
7832
+ return r.stderr.write(`lifo: ${s} is not installed
7833
+ `), 1;
7834
+ const i = Ce(r.vfs, n);
7835
+ if (i)
7836
+ for (const o of Object.keys(i.commands))
7837
+ e.unregister(o);
7838
+ try {
7839
+ r.vfs.rmdirRecursive(n);
7840
+ } catch (o) {
7841
+ return r.stderr.write(`lifo: could not remove ${s}: ${o instanceof Error ? o.message : String(o)}
7842
+ `), 1;
7843
+ }
7844
+ return r.stdout.write(`removed ${s}
7845
+ `), 0;
7798
7846
  }
7799
- function Oi(r) {
7847
+ function zi(r) {
7800
7848
  const { vfs: e, stdout: t } = r, s = [];
7801
- if (e.exists(ce))
7802
- for (const o of e.readdir(ce)) {
7849
+ if (e.exists(ie))
7850
+ for (const o of e.readdir(ie)) {
7803
7851
  if (o.type !== "directory") continue;
7804
7852
  const a = o.name.startsWith("@") ? (() => {
7805
7853
  try {
7806
- return e.readdir(L(ce, o.name)).filter((c) => c.type === "directory").map((c) => L(o.name, c.name));
7854
+ return e.readdir(C(ie, o.name)).filter((c) => c.type === "directory").map((c) => C(o.name, c.name));
7807
7855
  } catch {
7808
7856
  return [];
7809
7857
  }
7810
7858
  })() : [o.name];
7811
7859
  for (const c of a) {
7812
- const l = L(ce, c), d = Oe(e, l);
7860
+ const l = C(ie, c), d = Ce(e, l);
7813
7861
  if (!d) continue;
7814
7862
  let h = "?";
7815
7863
  try {
7816
- h = JSON.parse(e.readFileString(L(l, "package.json"))).version || "?";
7864
+ h = JSON.parse(e.readFileString(C(l, "package.json"))).version || "?";
7817
7865
  } catch {
7818
7866
  }
7819
7867
  s.push({
@@ -7823,7 +7871,7 @@ function Oi(r) {
7823
7871
  });
7824
7872
  }
7825
7873
  }
7826
- const n = Ke(e), i = Object.entries(n);
7874
+ const n = tt(e), i = Object.entries(n);
7827
7875
  if (s.length === 0 && i.length === 0)
7828
7876
  return t.write(`No lifo packages installed
7829
7877
  `), 0;
@@ -7873,7 +7921,7 @@ async function Bi(r) {
7873
7921
  }
7874
7922
  return 0;
7875
7923
  }
7876
- function zi(r) {
7924
+ function Mi(r) {
7877
7925
  const e = r.args[1];
7878
7926
  if (!e)
7879
7927
  return r.stderr.write(`Usage: lifo init <name>
@@ -7882,7 +7930,7 @@ function zi(r) {
7882
7930
  if (r.vfs.exists(t))
7883
7931
  return r.stderr.write(`lifo init: ${t} already exists
7884
7932
  `), 1;
7885
- r.vfs.mkdir(t, { recursive: !0 }), r.vfs.mkdir(L(t, "commands"), { recursive: !0 });
7933
+ r.vfs.mkdir(t, { recursive: !0 }), r.vfs.mkdir(C(t, "commands"), { recursive: !0 });
7886
7934
  const i = {
7887
7935
  name: s,
7888
7936
  version: "0.1.0",
@@ -7896,7 +7944,7 @@ function zi(r) {
7896
7944
  license: "MIT"
7897
7945
  };
7898
7946
  r.vfs.writeFile(
7899
- L(t, "package.json"),
7947
+ C(t, "package.json"),
7900
7948
  JSON.stringify(i, null, 2) + `
7901
7949
  `
7902
7950
  );
@@ -7931,7 +7979,7 @@ module.exports = async function(ctx, lifo) {
7931
7979
  return 0;
7932
7980
  };
7933
7981
  `;
7934
- r.vfs.writeFile(L(t, "commands", `${n}.js`), o);
7982
+ r.vfs.writeFile(C(t, "commands", `${n}.js`), o);
7935
7983
  const a = `# ${s}
7936
7984
 
7937
7985
  A lifo package providing the \`${n}\` command.
@@ -7954,7 +8002,7 @@ npm publish
7954
8002
 
7955
8003
  Users install with: \`lifo install ${n}\`
7956
8004
  `;
7957
- return r.vfs.writeFile(L(t, "README.md"), a), r.stdout.write(`Created ${t}/
8005
+ return r.vfs.writeFile(C(t, "README.md"), a), r.stdout.write(`Created ${t}/
7958
8006
  `), r.stdout.write(` package.json
7959
8007
  `), r.stdout.write(` commands/${n}.js
7960
8008
  `), r.stdout.write(` README.md
@@ -7967,13 +8015,13 @@ For a full TypeScript project, run on your host:
7967
8015
  `), r.stdout.write(` npm create lifo-pkg ${n}
7968
8016
  `), 0;
7969
8017
  }
7970
- function Mi(r, e) {
8018
+ function Di(r, e) {
7971
8019
  const t = r.args[1] || ".", s = D(r.cwd, t);
7972
- if (!r.vfs.exists(L(s, "package.json")))
8020
+ if (!r.vfs.exists(C(s, "package.json")))
7973
8021
  return r.stderr.write(`lifo link: no package.json found in ${s}
7974
8022
  `), 1;
7975
8023
  try {
7976
- const n = _i(r.vfs, e, s);
8024
+ const n = Ii(r.vfs, e, s);
7977
8025
  r.stdout.write(`Linked ${s}
7978
8026
  `);
7979
8027
  for (const i of n)
@@ -7985,7 +8033,7 @@ function Mi(r, e) {
7985
8033
  }
7986
8034
  return 0;
7987
8035
  }
7988
- function Di(r) {
8036
+ function Wi(r) {
7989
8037
  const e = r.args[1];
7990
8038
  if (!e)
7991
8039
  return r.stderr.write(`Usage: lifo unlink <name>
@@ -8001,30 +8049,30 @@ function Di(r) {
8001
8049
  `);
8002
8050
  return 0;
8003
8051
  }
8004
- function Wi(r, e) {
8052
+ function Ui(r, e) {
8005
8053
  return async (t) => {
8006
8054
  const s = t.args[0];
8007
8055
  if (!s || s === "--help" || s === "-h")
8008
- return Ni(t.stdout), s ? 0 : 1;
8056
+ return Fi(t.stdout), s ? 0 : 1;
8009
8057
  switch (s) {
8010
8058
  case "install":
8011
8059
  case "i":
8012
- return Fi(t, r, e);
8060
+ return ji(t, r);
8013
8061
  case "remove":
8014
8062
  case "rm":
8015
8063
  case "uninstall":
8016
- return ji(t, e);
8064
+ return Oi(t, r);
8017
8065
  case "list":
8018
8066
  case "ls":
8019
- return Oi(t);
8067
+ return zi(t);
8020
8068
  case "search":
8021
8069
  return Bi(t);
8022
8070
  case "init":
8023
- return zi(t);
8071
+ return Mi(t);
8024
8072
  case "link":
8025
- return Mi(t, r);
8073
+ return Di(t, r);
8026
8074
  case "unlink":
8027
- return Di(t);
8075
+ return Wi(t);
8028
8076
  default:
8029
8077
  return t.stderr.write(`lifo: unknown command '${s}'
8030
8078
  `), t.stderr.write(`Run lifo --help for usage
@@ -8032,28 +8080,28 @@ function Wi(r, e) {
8032
8080
  }
8033
8081
  };
8034
8082
  }
8035
- function Ui(r, e) {
8036
- if (Ii(r, e), !!r.exists(ce))
8037
- for (const t of r.readdir(ce)) {
8083
+ function qi(r, e) {
8084
+ if (Ni(r, e), !!r.exists(ie))
8085
+ for (const t of r.readdir(ie)) {
8038
8086
  if (t.type !== "directory") continue;
8039
8087
  const s = t.name.startsWith("@") ? (() => {
8040
8088
  try {
8041
- return r.readdir(L(ce, t.name)).filter((n) => n.type === "directory").map((n) => L(t.name, n.name));
8089
+ return r.readdir(C(ie, t.name)).filter((n) => n.type === "directory").map((n) => C(t.name, n.name));
8042
8090
  } catch {
8043
8091
  return [];
8044
8092
  }
8045
8093
  })() : [t.name];
8046
8094
  for (const n of s) {
8047
- const i = L(ce, n), o = Oe(r, i);
8095
+ const i = C(ie, n), o = Ce(r, i);
8048
8096
  if (o)
8049
8097
  for (const [a, c] of Object.entries(o.commands)) {
8050
- const l = L(i, c);
8051
- r.exists(l) && e.register(a, Qe(l, r));
8098
+ const l = C(i, c);
8099
+ r.exists(l) && e.register(a, et(l, r));
8052
8100
  }
8053
8101
  }
8054
8102
  }
8055
8103
  }
8056
- const Ze = class Ze {
8104
+ const Je = class Je {
8057
8105
  constructor(e, t) {
8058
8106
  this.vfs = e, this.getCwd = t;
8059
8107
  }
@@ -8102,7 +8150,7 @@ const Ze = class Ze {
8102
8150
  }
8103
8151
  async exportSnapshot() {
8104
8152
  const e = [], t = (n) => {
8105
- if (Ze.SKIP_DIRS.has(n)) return;
8153
+ if (Je.SKIP_DIRS.has(n)) return;
8106
8154
  const i = this.vfs.stat(n);
8107
8155
  if (i.type === "directory") {
8108
8156
  n !== "/" && e.push({
@@ -8143,9 +8191,9 @@ const Ze = class Ze {
8143
8191
  }
8144
8192
  };
8145
8193
  /** Directories to skip during export (virtual providers) */
8146
- m(Ze, "SKIP_DIRS", /* @__PURE__ */ new Set(["/proc", "/dev"]));
8147
- let gt = Ze;
8148
- class qi {
8194
+ m(Je, "SKIP_DIRS", /* @__PURE__ */ new Set(["/proc", "/dev"]));
8195
+ let wt = Je;
8196
+ class Hi {
8149
8197
  constructor(e, t) {
8150
8198
  m(this, "queue", Promise.resolve());
8151
8199
  this.shell = e, this.registry = t;
@@ -8188,7 +8236,7 @@ class qi {
8188
8236
  }
8189
8237
  }
8190
8238
  }
8191
- class Hi {
8239
+ class Vi {
8192
8240
  constructor() {
8193
8241
  m(this, "dataCallback", null);
8194
8242
  }
@@ -8244,37 +8292,37 @@ class Ks {
8244
8292
  const t = new Dr();
8245
8293
  await t.boot({ persist: (e == null ? void 0 : e.persist) ?? !1 });
8246
8294
  const s = xn();
8247
- if (Ui(t.vfs, s), e != null && e.files)
8248
- for (const [k, _] of Object.entries(e.files))
8249
- Gi(t.vfs, k), t.vfs.writeFile(k, _);
8295
+ if (qi(t.vfs, s), e != null && e.files)
8296
+ for (const [k, P] of Object.entries(e.files))
8297
+ Zi(t.vfs, k), t.vfs.writeFile(k, P);
8250
8298
  const i = { ...t.getDefaultEnv(), ...e == null ? void 0 : e.env };
8251
8299
  e != null && e.cwd && (i.PWD = e.cwd);
8252
8300
  let o, a = !1;
8253
8301
  if (typeof (e == null ? void 0 : e.terminal) == "string" || typeof HTMLElement < "u" && (e == null ? void 0 : e.terminal) instanceof HTMLElement) {
8254
- const { Terminal: k } = await import("@lifo-sh/ui"), _ = Vi(e.terminal), C = new k(_);
8255
- o = C, a = !0;
8256
- const A = t.vfs.readFileString("/etc/motd");
8257
- C.write(A.replace(/\r\n/g, `
8302
+ const { Terminal: k } = await import("@lifo-sh/ui"), P = Gi(e.terminal), L = new k(P);
8303
+ o = L, a = !0;
8304
+ const I = t.vfs.readFileString("/etc/motd");
8305
+ L.write(I.replace(/\r\n/g, `
8258
8306
  `).replace(/\n/g, `\r
8259
8307
  `));
8260
- } else e != null && e.terminal && typeof e.terminal == "object" ? (o = e.terminal, a = !0) : o = new Hi();
8308
+ } else e != null && e.terminal && typeof e.terminal == "object" ? (o = e.terminal, a = !0) : o = new Vi();
8261
8309
  const c = new kn(o, t.vfs, s, i), l = c.getJobTable();
8262
- s.register("ps", Cn(l)), s.register("top", Ln(l)), s.register("kill", Pn(l)), s.register("watch", Tn(s)), s.register("help", In()), s.register("node", Ms(t.portRegistry)), s.register("curl", Us(t.portRegistry));
8263
- const d = async (k, _) => (await c.execute(k, {
8264
- cwd: _.cwd,
8265
- env: _.env,
8266
- onStdout: (A) => _.stdout.write(A),
8267
- onStderr: (A) => _.stderr.write(A)
8310
+ s.register("ps", Cn(l)), s.register("top", Ln(l)), s.register("kill", Tn(l)), s.register("watch", _n(s)), s.register("help", An()), s.register("node", Ms(t.portRegistry)), s.register("curl", Us(t.portRegistry));
8311
+ const d = async (k, P) => (await c.execute(k, {
8312
+ cwd: P.cwd,
8313
+ env: P.env,
8314
+ onStdout: (I) => P.stdout.write(I),
8315
+ onStderr: (I) => P.stderr.write(I)
8268
8316
  })).exitCode;
8269
- s.register("npm", Li(s, d)), s.register("lifo", Wi(s, d)), await c.sourceFile("/etc/profile"), await c.sourceFile(i.HOME + "/.bashrc"), e != null && e.cwd && c.setCwd(e.cwd), a && (c.start(), o.focus());
8270
- const h = () => c.getCwd(), f = new gt(t.vfs, h), g = new qi(c, s), I = new Ks(t, c, g, f, i);
8317
+ s.register("npm", Li(s, d)), s.register("lifo", Ui(s)), await c.sourceFile("/etc/profile"), await c.sourceFile(i.HOME + "/.bashrc"), e != null && e.cwd && c.setCwd(e.cwd), a && (c.start(), o.focus());
8318
+ const h = () => c.getCwd(), f = new wt(t.vfs, h), g = new Hi(c, s), A = new Ks(t, c, g, f, i);
8271
8319
  if (e != null && e.mounts)
8272
8320
  for (const k of e.mounts)
8273
- I.mountNative(k.virtualPath, k.hostPath, {
8321
+ A.mountNative(k.virtualPath, k.hostPath, {
8274
8322
  readOnly: k.readOnly,
8275
8323
  fsModule: k.fsModule
8276
8324
  });
8277
- return I;
8325
+ return A;
8278
8326
  }
8279
8327
  /**
8280
8328
  * Mount a native filesystem directory into the virtual filesystem.
@@ -8350,7 +8398,7 @@ class Ks {
8350
8398
  this._destroyed = !0;
8351
8399
  }
8352
8400
  }
8353
- function Vi(r) {
8401
+ function Gi(r) {
8354
8402
  if (typeof r == "string") {
8355
8403
  const e = document.querySelector(r);
8356
8404
  if (!e) throw new Error(`Sandbox: element not found: ${r}`);
@@ -8358,7 +8406,7 @@ function Vi(r) {
8358
8406
  }
8359
8407
  return r;
8360
8408
  }
8361
- function Gi(r, e) {
8409
+ function Zi(r, e) {
8362
8410
  const t = e.split("/").filter(Boolean);
8363
8411
  t.pop();
8364
8412
  let s = "";
@@ -8366,82 +8414,82 @@ function Gi(r, e) {
8366
8414
  s += "/" + n, r.exists(s) || r.mkdir(s, { recursive: !0 });
8367
8415
  }
8368
8416
  export {
8369
- wo as $,
8370
- Ki as A,
8371
- Te as B,
8417
+ yo as $,
8418
+ eo as A,
8419
+ Ie as B,
8372
8420
  Ct as C,
8373
8421
  Wr as D,
8374
8422
  N as E,
8375
8423
  Fr as F,
8376
- lt as G,
8377
- Hi as H,
8378
- to as I,
8424
+ ut as G,
8425
+ Vi as H,
8426
+ so as I,
8379
8427
  dn as J,
8380
8428
  Dr as K,
8381
- Qi as L,
8429
+ Ki as L,
8382
8430
  Hr as M,
8383
- eo as N,
8431
+ to as N,
8384
8432
  Er as O,
8385
- Ir as P,
8386
- bt as Q,
8433
+ Ar as P,
8434
+ St as Q,
8387
8435
  ee as R,
8388
8436
  Ur as S,
8389
8437
  Ks as T,
8390
8438
  kn as U,
8391
- T as V,
8392
- so as W,
8439
+ _ as V,
8440
+ ro as W,
8393
8441
  kr as X,
8394
- ro as Y,
8442
+ no as Y,
8395
8443
  qr as Z,
8396
- po as _,
8397
- ht as a,
8398
- Ui as a0,
8444
+ mo as _,
8445
+ dt as a,
8446
+ qi as a0,
8399
8447
  Us as a1,
8400
8448
  xn as a2,
8401
- In as a3,
8402
- Pn as a4,
8403
- Qe as a5,
8404
- Wi as a6,
8405
- pt as a7,
8449
+ An as a3,
8450
+ Tn as a4,
8451
+ et as a5,
8452
+ Ui as a6,
8453
+ gt as a7,
8406
8454
  Ms as a8,
8407
8455
  Li as a9,
8408
8456
  Cn as aa,
8409
8457
  Ln as ab,
8410
- Tn as ac,
8411
- go as ad,
8412
- yo as ae,
8458
+ _n as ac,
8459
+ wo as ad,
8460
+ vo as ae,
8413
8461
  gr as af,
8414
- uo as ag,
8415
- wt as ah,
8416
- L as ai,
8417
- _i as aj,
8418
- Ii as ak,
8419
- mo as al,
8462
+ fo as ag,
8463
+ yt as ah,
8464
+ C as ai,
8465
+ Ii as aj,
8466
+ Ni as ak,
8467
+ go as al,
8420
8468
  fe as am,
8421
- Oe as an,
8422
- ho as ao,
8469
+ Ce as an,
8470
+ uo as ao,
8423
8471
  Ai as ap,
8424
- fo as aq,
8425
- Ee as b,
8472
+ po as aq,
8473
+ xe as b,
8426
8474
  mr as c,
8427
- So as d,
8428
- Ie as e,
8475
+ $o as d,
8476
+ Fe as e,
8429
8477
  di as f,
8430
8478
  de as g,
8431
8479
  hi as h,
8432
- Xi as i,
8480
+ Qi as i,
8433
8481
  Hs as j,
8434
8482
  te as k,
8435
- vo as l,
8436
- bo as m,
8437
- ao as n,
8438
- lo as o,
8483
+ bo as l,
8484
+ So as m,
8485
+ co as n,
8486
+ ho as o,
8439
8487
  Gs as p,
8440
- io as q,
8488
+ oo as q,
8441
8489
  D as r,
8442
- co as s,
8443
- no as t,
8444
- oo as u,
8490
+ lo as s,
8491
+ io as t,
8492
+ ao as u,
8445
8493
  M as v,
8446
8494
  Sr as w,
8447
8495
  Vr as x,