just-bash 2.8.0 → 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/banned-patterns-test.d.ts +8 -0
  2. package/dist/bin/chunks/awk2-OKD2P6CM.js +21 -0
  3. package/dist/bin/{shell/chunks/chunk-VHH2M5JC.js → chunks/chunk-CQZVMYQ3.js} +2 -2
  4. package/dist/bin/chunks/chunk-G43H2WGH.js +17 -0
  5. package/dist/bin/chunks/chunk-OBI37ZY4.js +9 -0
  6. package/dist/bin/{shell/chunks/chunk-XI5LBYFX.js → chunks/chunk-W2KVOOMM.js} +1 -1
  7. package/dist/bin/chunks/{expansion-LVCGISX6.js → expansion-D4M4UY4T.js} +1 -1
  8. package/dist/bin/chunks/{file-6PCTL3MH.js → file-MWSA2WYI.js} +12 -12
  9. package/dist/bin/chunks/{grep-X7UU5FD6.js → grep-BD56656Z.js} +1 -1
  10. package/dist/bin/chunks/help-L43ENI4H.js +16 -0
  11. package/dist/bin/{shell/chunks/jq-QR3PX7FE.js → chunks/jq-TJPN2INT.js} +1 -1
  12. package/dist/bin/chunks/{md5sum-2VAAFCTS.js → md5sum-VHPDBIVV.js} +1 -1
  13. package/dist/bin/chunks/{printf-XPBSFXJE.js → printf-4W7NDLLV.js} +1 -1
  14. package/dist/bin/{shell/chunks/rg-RSJPHAP5.js → chunks/rg-IZR5557M.js} +9 -9
  15. package/dist/bin/{shell/chunks/sed-356P4DZB.js → chunks/sed-E4QAUCYQ.js} +1 -1
  16. package/dist/bin/chunks/{sha1sum-67P4ME4N.js → sha1sum-4SVNPPXZ.js} +1 -1
  17. package/dist/bin/{shell/chunks/sha256sum-MV3WQ4QF.js → chunks/sha256sum-BM3AFTIE.js} +1 -1
  18. package/dist/bin/chunks/sort-QF3YLXRW.js +16 -0
  19. package/dist/bin/chunks/{split-JJFZRWRC.js → split-7UP7EATZ.js} +1 -1
  20. package/dist/bin/{shell/chunks/tr-FMT6JWLE.js → chunks/tr-IAUNBQKH.js} +3 -3
  21. package/dist/bin/chunks/xan-OR7RSXSZ.js +140 -0
  22. package/dist/bin/chunks/{yq-T255J4ZP.js → yq-WS7WDP36.js} +1 -1
  23. package/dist/bin/just-bash.js +63 -63
  24. package/dist/bin/shell/chunks/awk2-OKD2P6CM.js +21 -0
  25. package/dist/bin/{chunks/chunk-VHH2M5JC.js → shell/chunks/chunk-CQZVMYQ3.js} +2 -2
  26. package/dist/bin/shell/chunks/chunk-G43H2WGH.js +17 -0
  27. package/dist/bin/shell/chunks/chunk-OBI37ZY4.js +9 -0
  28. package/dist/bin/{chunks/chunk-XI5LBYFX.js → shell/chunks/chunk-W2KVOOMM.js} +1 -1
  29. package/dist/bin/shell/chunks/{expansion-LVCGISX6.js → expansion-D4M4UY4T.js} +1 -1
  30. package/dist/bin/shell/chunks/{file-6PCTL3MH.js → file-MWSA2WYI.js} +12 -12
  31. package/dist/bin/shell/chunks/{grep-X7UU5FD6.js → grep-BD56656Z.js} +1 -1
  32. package/dist/bin/shell/chunks/help-L43ENI4H.js +16 -0
  33. package/dist/bin/{chunks/jq-QR3PX7FE.js → shell/chunks/jq-TJPN2INT.js} +1 -1
  34. package/dist/bin/shell/chunks/{md5sum-2VAAFCTS.js → md5sum-VHPDBIVV.js} +1 -1
  35. package/dist/bin/shell/chunks/{printf-XPBSFXJE.js → printf-4W7NDLLV.js} +1 -1
  36. package/dist/bin/{chunks/rg-RSJPHAP5.js → shell/chunks/rg-IZR5557M.js} +9 -9
  37. package/dist/bin/{chunks/sed-356P4DZB.js → shell/chunks/sed-E4QAUCYQ.js} +1 -1
  38. package/dist/bin/shell/chunks/{sha1sum-67P4ME4N.js → sha1sum-4SVNPPXZ.js} +1 -1
  39. package/dist/bin/{chunks/sha256sum-MV3WQ4QF.js → shell/chunks/sha256sum-BM3AFTIE.js} +1 -1
  40. package/dist/bin/shell/chunks/sort-QF3YLXRW.js +16 -0
  41. package/dist/bin/shell/chunks/{split-JJFZRWRC.js → split-7UP7EATZ.js} +1 -1
  42. package/dist/bin/{chunks/tr-FMT6JWLE.js → shell/chunks/tr-IAUNBQKH.js} +3 -3
  43. package/dist/bin/shell/chunks/xan-OR7RSXSZ.js +140 -0
  44. package/dist/bin/shell/chunks/{yq-T255J4ZP.js → yq-WS7WDP36.js} +1 -1
  45. package/dist/bin/shell/shell.js +63 -63
  46. package/dist/bundle/browser.js +319 -319
  47. package/dist/bundle/chunks/awk2-YNEKUV4T.js +20 -0
  48. package/dist/bundle/chunks/chunk-EIZGF4BS.js +8 -0
  49. package/dist/bundle/chunks/chunk-VLGZJRPG.js +16 -0
  50. package/dist/bundle/chunks/{chunk-GMMICOEF.js → chunk-ZRCBN2U4.js} +2 -2
  51. package/dist/bundle/chunks/{chunk-PHXIZ5A4.js → chunk-ZWYFK7P5.js} +1 -1
  52. package/dist/bundle/chunks/{expansion-OP223NMV.js → expansion-6T6M7TZI.js} +1 -1
  53. package/dist/bundle/chunks/{file-NQP3CKRV.js → file-APPTAFMI.js} +12 -12
  54. package/dist/bundle/chunks/{grep-F7ILPL2H.js → grep-UTH3KDWL.js} +1 -1
  55. package/dist/bundle/chunks/help-UD3E73G5.js +15 -0
  56. package/dist/bundle/chunks/{jq-RIXCOULU.js → jq-2LEQ2SZJ.js} +1 -1
  57. package/dist/bundle/chunks/{md5sum-KLHZSRUA.js → md5sum-TGZPGVOK.js} +1 -1
  58. package/dist/bundle/chunks/{printf-OAPYPRGV.js → printf-4U5V2VHK.js} +1 -1
  59. package/dist/bundle/chunks/{rg-O3ZIRBAJ.js → rg-JNKRPEYR.js} +9 -9
  60. package/dist/bundle/chunks/{sed-P5OTD3EL.js → sed-4K5HXNXE.js} +1 -1
  61. package/dist/bundle/chunks/{sha1sum-WKWTIZGQ.js → sha1sum-37LOTSQP.js} +1 -1
  62. package/dist/bundle/chunks/{sha256sum-IUVNMBTA.js → sha256sum-I4J5BPZA.js} +1 -1
  63. package/dist/bundle/chunks/sort-LT2PE47K.js +15 -0
  64. package/dist/bundle/chunks/{split-YBTFW7MT.js → split-LGSGJHV5.js} +1 -1
  65. package/dist/bundle/chunks/{tr-P43NRVKL.js → tr-UJSEBPIQ.js} +3 -3
  66. package/dist/bundle/chunks/xan-I4Y5DD3C.js +139 -0
  67. package/dist/bundle/chunks/{yq-6SPP5BHS.js → yq-6RVO6I5Q.js} +1 -1
  68. package/dist/bundle/index.js +63 -63
  69. package/dist/commands/awk/builtins.d.ts +1 -1
  70. package/package.json +3 -2
  71. package/dist/bin/chunks/awk2-TV3KCXON.js +0 -21
  72. package/dist/bin/chunks/chunk-GANRM5LO.js +0 -17
  73. package/dist/bin/chunks/chunk-Y5QKO4KO.js +0 -9
  74. package/dist/bin/chunks/help-7C5JICNL.js +0 -16
  75. package/dist/bin/chunks/sort-KUHOCH5S.js +0 -16
  76. package/dist/bin/chunks/xan-UZG3SZON.js +0 -140
  77. package/dist/bin/shell/chunks/awk2-TV3KCXON.js +0 -21
  78. package/dist/bin/shell/chunks/chunk-GANRM5LO.js +0 -17
  79. package/dist/bin/shell/chunks/chunk-Y5QKO4KO.js +0 -9
  80. package/dist/bin/shell/chunks/help-7C5JICNL.js +0 -16
  81. package/dist/bin/shell/chunks/sort-KUHOCH5S.js +0 -16
  82. package/dist/bin/shell/chunks/xan-UZG3SZON.js +0 -140
  83. package/dist/bundle/chunks/awk2-PTU7M2NS.js +0 -20
  84. package/dist/bundle/chunks/chunk-GFLIVSUW.js +0 -8
  85. package/dist/bundle/chunks/chunk-TMKMSBKB.js +0 -16
  86. package/dist/bundle/chunks/help-75YOGKM4.js +0 -15
  87. package/dist/bundle/chunks/sort-EJUT5LXD.js +0 -15
  88. package/dist/bundle/chunks/xan-HKCQ46BH.js +0 -139
@@ -1,4 +1,4 @@
1
- import{B as nn,C as rn,D as se,E as Te,F as K,G as ue,H as ut,I as an,J as I,K as on,L as ln,M as me,N as Zt,O as dt,P as V,a as Gs,b as Xs,c as Ks,d as ct,e as Z,f as W,g as he,h as Q,i as pe,j as Ce,k as Bt,l as ft,m as Ys,n as Ht,o as Qs,p as oe,q as Ee,r as Js,s as en,t as jt,u as Ut,v as Ne,w as tn,x as sn,y as fe,z as qt}from"./chunks/chunk-GMMICOEF.js";import{a as _e,b as de}from"./chunks/chunk-OJDRYQWQ.js";import{a as re,b as ie,c as te,d as ae,e as qs,f as z,g as De,h as at,i as ot,j as Zs,k as ee,l as Pe,m as lt,n as ce}from"./chunks/chunk-PSW6BMXW.js";import{a as Ke}from"./chunks/chunk-YNYSPYQ5.js";import"./chunks/chunk-NUFRM6SI.js";import{a as ve}from"./chunks/chunk-44UOCSGV.js";import"./chunks/chunk-DXB73IDG.js";var Ie=[{name:"echo",load:async()=>(await import("./chunks/echo-6S7WE7XB.js")).echoCommand},{name:"cat",load:async()=>(await import("./chunks/cat-GPKR7D6K.js")).catCommand},{name:"printf",load:async()=>(await import("./chunks/printf-OAPYPRGV.js")).printfCommand},{name:"ls",load:async()=>(await import("./chunks/ls-PUJHEPXS.js")).lsCommand},{name:"mkdir",load:async()=>(await import("./chunks/mkdir-SF2UE4KB.js")).mkdirCommand},{name:"rmdir",load:async()=>(await import("./chunks/rmdir-DU6C7ZEO.js")).rmdirCommand},{name:"touch",load:async()=>(await import("./chunks/touch-TDTEBHHI.js")).touchCommand},{name:"rm",load:async()=>(await import("./chunks/rm-MJFRIDNT.js")).rmCommand},{name:"cp",load:async()=>(await import("./chunks/cp-NJSENVKC.js")).cpCommand},{name:"mv",load:async()=>(await import("./chunks/mv-JPBZPM4O.js")).mvCommand},{name:"ln",load:async()=>(await import("./chunks/ln-Y7YB677N.js")).lnCommand},{name:"chmod",load:async()=>(await import("./chunks/chmod-ODWUR7E6.js")).chmodCommand},{name:"pwd",load:async()=>(await import("./chunks/pwd-S4NVAMC4.js")).pwdCommand},{name:"readlink",load:async()=>(await import("./chunks/readlink-EM4O3U4P.js")).readlinkCommand},{name:"head",load:async()=>(await import("./chunks/head-SA7P5NJ7.js")).headCommand},{name:"tail",load:async()=>(await import("./chunks/tail-52LRAWXT.js")).tailCommand},{name:"wc",load:async()=>(await import("./chunks/wc-VDPK3LVS.js")).wcCommand},{name:"stat",load:async()=>(await import("./chunks/stat-IOLJTP7U.js")).statCommand},{name:"grep",load:async()=>(await import("./chunks/grep-F7ILPL2H.js")).grepCommand},{name:"fgrep",load:async()=>(await import("./chunks/grep-F7ILPL2H.js")).fgrepCommand},{name:"egrep",load:async()=>(await import("./chunks/grep-F7ILPL2H.js")).egrepCommand},{name:"rg",load:async()=>(await import("./chunks/rg-O3ZIRBAJ.js")).rgCommand},{name:"sed",load:async()=>(await import("./chunks/sed-P5OTD3EL.js")).sedCommand},{name:"awk",load:async()=>(await import("./chunks/awk2-PTU7M2NS.js")).awkCommand2},{name:"sort",load:async()=>(await import("./chunks/sort-EJUT5LXD.js")).sortCommand},{name:"uniq",load:async()=>(await import("./chunks/uniq-XBP4SJA3.js")).uniqCommand},{name:"comm",load:async()=>(await import("./chunks/comm-AXQM7FFF.js")).commCommand},{name:"cut",load:async()=>(await import("./chunks/cut-NVKWEAZF.js")).cutCommand},{name:"paste",load:async()=>(await import("./chunks/paste-QAP6Y75J.js")).pasteCommand},{name:"tr",load:async()=>(await import("./chunks/tr-P43NRVKL.js")).trCommand},{name:"rev",load:async()=>(await import("./chunks/rev-FKUV5GH5.js")).rev},{name:"nl",load:async()=>(await import("./chunks/nl-KWQGFZH5.js")).nl},{name:"fold",load:async()=>(await import("./chunks/fold-6CFXIPYZ.js")).fold},{name:"expand",load:async()=>(await import("./chunks/expand-VSTNOVF5.js")).expand},{name:"unexpand",load:async()=>(await import("./chunks/unexpand-I7A2VXFD.js")).unexpand},{name:"strings",load:async()=>(await import("./chunks/strings-LRU5XCFP.js")).strings},{name:"split",load:async()=>(await import("./chunks/split-YBTFW7MT.js")).split},{name:"column",load:async()=>(await import("./chunks/column-R6OLMEUA.js")).column},{name:"join",load:async()=>(await import("./chunks/join-X3QYPZUA.js")).join},{name:"tee",load:async()=>(await import("./chunks/tee-4KHTWVWB.js")).teeCommand},{name:"find",load:async()=>(await import("./chunks/find-WTVSUXL3.js")).findCommand},{name:"basename",load:async()=>(await import("./chunks/basename-CFA5ZIGT.js")).basenameCommand},{name:"dirname",load:async()=>(await import("./chunks/dirname-YPJLCQYA.js")).dirnameCommand},{name:"tree",load:async()=>(await import("./chunks/tree-UFVZH4SS.js")).treeCommand},{name:"du",load:async()=>(await import("./chunks/du-T4JUAAB2.js")).duCommand},{name:"env",load:async()=>(await import("./chunks/env-M3AXY56V.js")).envCommand},{name:"printenv",load:async()=>(await import("./chunks/env-M3AXY56V.js")).printenvCommand},{name:"alias",load:async()=>(await import("./chunks/alias-YGOORMWI.js")).aliasCommand},{name:"unalias",load:async()=>(await import("./chunks/alias-YGOORMWI.js")).unaliasCommand},{name:"history",load:async()=>(await import("./chunks/history-TMBGOQO6.js")).historyCommand},{name:"xargs",load:async()=>(await import("./chunks/xargs-4FRA6OJ7.js")).xargsCommand},{name:"true",load:async()=>(await import("./chunks/true-CNJ54NE6.js")).trueCommand},{name:"false",load:async()=>(await import("./chunks/true-CNJ54NE6.js")).falseCommand},{name:"clear",load:async()=>(await import("./chunks/clear-VT2LJIDX.js")).clearCommand},{name:"bash",load:async()=>(await import("./chunks/bash-BYWM5OPC.js")).bashCommand},{name:"sh",load:async()=>(await import("./chunks/bash-BYWM5OPC.js")).shCommand},{name:"jq",load:async()=>(await import("./chunks/jq-RIXCOULU.js")).jqCommand},{name:"base64",load:async()=>(await import("./chunks/base64-2JFR3HGT.js")).base64Command},{name:"diff",load:async()=>(await import("./chunks/diff-ELUS3RW7.js")).diffCommand},{name:"date",load:async()=>(await import("./chunks/date-PN3CMG7K.js")).dateCommand},{name:"sleep",load:async()=>(await import("./chunks/sleep-AK4QE4WR.js")).sleepCommand},{name:"timeout",load:async()=>(await import("./chunks/timeout-X3X3N6IE.js")).timeoutCommand},{name:"time",load:async()=>(await import("./chunks/time-EGF4KTWV.js")).timeCommand},{name:"seq",load:async()=>(await import("./chunks/seq-5VRIVQYP.js")).seqCommand},{name:"expr",load:async()=>(await import("./chunks/expr-YSFDPKPV.js")).exprCommand},{name:"md5sum",load:async()=>(await import("./chunks/md5sum-KLHZSRUA.js")).md5sumCommand},{name:"sha1sum",load:async()=>(await import("./chunks/sha1sum-WKWTIZGQ.js")).sha1sumCommand},{name:"sha256sum",load:async()=>(await import("./chunks/sha256sum-IUVNMBTA.js")).sha256sumCommand},{name:"file",load:async()=>(await import("./chunks/file-NQP3CKRV.js")).fileCommand},{name:"html-to-markdown",load:async()=>(await import("./chunks/html-to-markdown-ZK6GQVSL.js")).htmlToMarkdownCommand},{name:"help",load:async()=>(await import("./chunks/help-75YOGKM4.js")).helpCommand},{name:"which",load:async()=>(await import("./chunks/which-GF77XMJD.js")).whichCommand},{name:"tac",load:async()=>(await import("./chunks/tac-2X4JLF4W.js")).tac},{name:"hostname",load:async()=>(await import("./chunks/hostname-NWR32CGF.js")).hostname},{name:"whoami",load:async()=>(await import("./chunks/whoami-YUDAIS32.js")).whoami},{name:"od",load:async()=>(await import("./chunks/od-3FPDPLWJ.js")).od},{name:"gzip",load:async()=>(await import("./chunks/gzip-4P4KGYT5.js")).gzipCommand},{name:"gunzip",load:async()=>(await import("./chunks/gzip-4P4KGYT5.js")).gunzipCommand},{name:"zcat",load:async()=>(await import("./chunks/gzip-4P4KGYT5.js")).zcatCommand}];(typeof __BROWSER__>"u"||!__BROWSER__)&&(Ie.push({name:"tar",load:async()=>(await import("./chunks/tar-5V4PGBFL.js")).tarCommand}),Ie.push({name:"yq",load:async()=>(await import("./chunks/yq-6SPP5BHS.js")).yqCommand}),Ie.push({name:"xan",load:async()=>(await import("./chunks/xan-HKCQ46BH.js")).xanCommand}),Ie.push({name:"sqlite3",load:async()=>(await import("./chunks/sqlite3-5QVZOGER.js")).sqlite3Command}));var ht=[];(typeof __BROWSER__>"u"||!__BROWSER__)&&(ht.push({name:"python3",load:async()=>(await import("./chunks/python3-SKZGHYDO.js")).python3Command}),ht.push({name:"python",load:async()=>(await import("./chunks/python3-SKZGHYDO.js")).pythonCommand}));var fn=[{name:"curl",load:async()=>(await import("./chunks/curl-QDCXHQMX.js")).curlCommand}],cn=new Map;function Gt(e){return{name:e.name,async execute(t,s){let n=cn.get(e.name);return n||(n=await e.load(),cn.set(e.name,n)),n.execute(t,s)}}}function zr(){return Ie.map(e=>e.name)}function Vr(){return fn.map(e=>e.name)}function un(e){return(e?Ie.filter(s=>e.includes(s.name)):Ie).map(Gt)}function dn(){return fn.map(Gt)}function Br(){return ht.map(e=>e.name)}function hn(){return ht.map(Gt)}function pn(e){return"load"in e&&typeof e.load=="function"}function Hr(e,t){return{name:e,execute:t}}function mn(e){let t=null;return{name:e.name,async execute(s,n){return t||(t=await e.load()),t.execute(s,n)}}}var jr=new TextEncoder,Ur=new TextDecoder;function be(e,t){if(e instanceof Uint8Array)return e;if(t==="base64")return Uint8Array.from(atob(e),s=>s.charCodeAt(0));if(t==="hex"){let s=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)s[n/2]=parseInt(e.slice(n,n+2),16);return s}return t==="binary"||t==="latin1"?Uint8Array.from(e,s=>s.charCodeAt(0)):jr.encode(e)}function Fe(e,t){return t==="base64"?btoa(String.fromCharCode(...e)):t==="hex"?Array.from(e).map(s=>s.toString(16).padStart(2,"0")).join(""):t==="binary"||t==="latin1"?String.fromCharCode(...e):Ur.decode(e)}function le(e){if(e!=null)return typeof e=="string"?e:e.encoding??void 0}var pt=new TextEncoder;function qr(e){return typeof e=="object"&&e!==null&&!(e instanceof Uint8Array)&&"content"in e}var $e=class{data=new Map;constructor(t){if(this.data.set("/",{type:"directory",mode:493,mtime:new Date}),t)for(let[s,n]of Object.entries(t))qr(n)?this.writeFileSync(s,n.content,void 0,{mode:n.mode,mtime:n.mtime}):this.writeFileSync(s,n)}normalizePath(t){if(!t||t==="/")return"/";let s=t.endsWith("/")&&t!=="/"?t.slice(0,-1):t;s.startsWith("/")||(s=`/${s}`);let n=s.split("/").filter(i=>i&&i!=="."),r=[];for(let i of n)i===".."?r.pop():r.push(i);return`/${r.join("/")}`||"/"}dirname(t){let s=this.normalizePath(t);if(s==="/")return"/";let n=s.lastIndexOf("/");return n===0?"/":s.slice(0,n)}ensureParentDirs(t){let s=this.dirname(t);s!=="/"&&(this.data.has(s)||(this.ensureParentDirs(s),this.data.set(s,{type:"directory",mode:493,mtime:new Date})))}writeFileSync(t,s,n,r){let i=this.normalizePath(t);this.ensureParentDirs(i);let a=le(n),o=be(s,a);this.data.set(i,{type:"file",content:o,mode:r?.mode??420,mtime:r?.mtime??new Date})}async readFile(t,s){let n=await this.readFileBuffer(t),r=le(s);return Fe(n,r)}async readFileBuffer(t){let s=this.resolvePathWithSymlinks(t),n=this.data.get(s);if(!n)throw new Error(`ENOENT: no such file or directory, open '${t}'`);if(n.type!=="file")throw new Error(`EISDIR: illegal operation on a directory, read '${t}'`);return n.content instanceof Uint8Array?n.content:pt.encode(n.content)}async writeFile(t,s,n){this.writeFileSync(t,s,n)}async appendFile(t,s,n){let r=this.normalizePath(t),i=this.data.get(r);if(i&&i.type==="directory")throw new Error(`EISDIR: illegal operation on a directory, write '${t}'`);let a=le(n),o=be(s,a);if(i?.type==="file"){let c=i.content instanceof Uint8Array?i.content:pt.encode(i.content),l=new Uint8Array(c.length+o.length);l.set(c),l.set(o,c.length),this.data.set(r,{type:"file",content:l,mode:i.mode,mtime:new Date})}else this.writeFileSync(t,s,n)}async exists(t){try{let s=this.resolvePathWithSymlinks(t);return this.data.has(s)}catch{return!1}}async stat(t){let s=this.resolvePathWithSymlinks(t),n=this.data.get(s);if(!n)throw new Error(`ENOENT: no such file or directory, stat '${t}'`);let r=0;return n.type==="file"&&n.content&&(n.content instanceof Uint8Array?r=n.content.length:r=pt.encode(n.content).length),{isFile:n.type==="file",isDirectory:n.type==="directory",isSymbolicLink:!1,mode:n.mode,size:r,mtime:n.mtime||new Date}}async lstat(t){let s=this.resolveIntermediateSymlinks(t),n=this.data.get(s);if(!n)throw new Error(`ENOENT: no such file or directory, lstat '${t}'`);if(n.type==="symlink")return{isFile:!1,isDirectory:!1,isSymbolicLink:!0,mode:n.mode,size:n.target.length,mtime:n.mtime||new Date};let r=0;return n.type==="file"&&n.content&&(n.content instanceof Uint8Array?r=n.content.length:r=pt.encode(n.content).length),{isFile:n.type==="file",isDirectory:n.type==="directory",isSymbolicLink:!1,mode:n.mode,size:r,mtime:n.mtime||new Date}}resolveSymlink(t,s){if(s.startsWith("/"))return this.normalizePath(s);let n=this.dirname(t);return this.normalizePath(n==="/"?`/${s}`:`${n}/${s}`)}resolveIntermediateSymlinks(t){let s=this.normalizePath(t);if(s==="/")return"/";let n=s.slice(1).split("/");if(n.length<=1)return s;let r="",i=new Set;for(let a=0;a<n.length-1;a++){let o=n[a];r=`${r}/${o}`;let c=this.data.get(r),l=0,f=40;for(;c&&c.type==="symlink"&&l<f;){if(i.has(r))throw new Error(`ELOOP: too many levels of symbolic links, lstat '${t}'`);i.add(r),r=this.resolveSymlink(r,c.target),c=this.data.get(r),l++}if(l>=f)throw new Error(`ELOOP: too many levels of symbolic links, lstat '${t}'`)}return`${r}/${n[n.length-1]}`}resolvePathWithSymlinks(t){let s=this.normalizePath(t);if(s==="/")return"/";let n=s.slice(1).split("/"),r="",i=new Set;for(let a of n){r=`${r}/${a}`;let o=this.data.get(r),c=0,l=40;for(;o&&o.type==="symlink"&&c<l;){if(i.has(r))throw new Error(`ELOOP: too many levels of symbolic links, open '${t}'`);i.add(r),r=this.resolveSymlink(r,o.target),o=this.data.get(r),c++}if(c>=l)throw new Error(`ELOOP: too many levels of symbolic links, open '${t}'`)}return r}async mkdir(t,s){this.mkdirSync(t,s)}mkdirSync(t,s){let n=this.normalizePath(t);if(this.data.has(n)){if(this.data.get(n)?.type==="file")throw new Error(`EEXIST: file already exists, mkdir '${t}'`);if(!s?.recursive)throw new Error(`EEXIST: directory already exists, mkdir '${t}'`);return}let r=this.dirname(n);if(r!=="/"&&!this.data.has(r))if(s?.recursive)this.mkdirSync(r,{recursive:!0});else throw new Error(`ENOENT: no such file or directory, mkdir '${t}'`);this.data.set(n,{type:"directory",mode:493,mtime:new Date})}async readdir(t){return(await this.readdirWithFileTypes(t)).map(n=>n.name)}async readdirWithFileTypes(t){let s=this.normalizePath(t),n=this.data.get(s);if(!n)throw new Error(`ENOENT: no such file or directory, scandir '${t}'`);let r=new Set;for(;n&&n.type==="symlink";){if(r.has(s))throw new Error(`ELOOP: too many levels of symbolic links, scandir '${t}'`);r.add(s),s=this.resolveSymlink(s,n.target),n=this.data.get(s)}if(!n)throw new Error(`ENOENT: no such file or directory, scandir '${t}'`);if(n.type!=="directory")throw new Error(`ENOTDIR: not a directory, scandir '${t}'`);let i=s==="/"?"/":`${s}/`,a=new Map;for(let[o,c]of this.data.entries())if(o!==s&&o.startsWith(i)){let l=o.slice(i.length),f=l.split("/")[0];f&&!l.includes("/",f.length)&&!a.has(f)&&a.set(f,{name:f,isFile:c.type==="file",isDirectory:c.type==="directory",isSymbolicLink:c.type==="symlink"})}return Array.from(a.values()).sort((o,c)=>o.name<c.name?-1:o.name>c.name?1:0)}async rm(t,s){let n=this.normalizePath(t),r=this.data.get(n);if(!r){if(s?.force)return;throw new Error(`ENOENT: no such file or directory, rm '${t}'`)}if(r.type==="directory"){let i=await this.readdir(n);if(i.length>0){if(!s?.recursive)throw new Error(`ENOTEMPTY: directory not empty, rm '${t}'`);for(let a of i){let o=n==="/"?`/${a}`:`${n}/${a}`;await this.rm(o,s)}}}this.data.delete(n)}async cp(t,s,n){let r=this.normalizePath(t),i=this.normalizePath(s),a=this.data.get(r);if(!a)throw new Error(`ENOENT: no such file or directory, cp '${t}'`);if(a.type==="file")this.ensureParentDirs(i),this.data.set(i,{...a});else if(a.type==="directory"){if(!n?.recursive)throw new Error(`EISDIR: is a directory, cp '${t}'`);await this.mkdir(i,{recursive:!0});let o=await this.readdir(r);for(let c of o){let l=r==="/"?`/${c}`:`${r}/${c}`,f=i==="/"?`/${c}`:`${i}/${c}`;await this.cp(l,f,n)}}}async mv(t,s){await this.cp(t,s,{recursive:!0}),await this.rm(t,{recursive:!0})}getAllPaths(){return Array.from(this.data.keys())}resolvePath(t,s){if(s.startsWith("/"))return this.normalizePath(s);let n=t==="/"?`/${s}`:`${t}/${s}`;return this.normalizePath(n)}async chmod(t,s){let n=this.normalizePath(t),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, chmod '${t}'`);r.mode=s}async symlink(t,s){let n=this.normalizePath(s);if(this.data.has(n))throw new Error(`EEXIST: file already exists, symlink '${s}'`);this.ensureParentDirs(n),this.data.set(n,{type:"symlink",target:t,mode:511,mtime:new Date})}async link(t,s){let n=this.normalizePath(t),r=this.normalizePath(s),i=this.data.get(n);if(!i)throw new Error(`ENOENT: no such file or directory, link '${t}'`);if(i.type!=="file")throw new Error(`EPERM: operation not permitted, link '${t}'`);if(this.data.has(r))throw new Error(`EEXIST: file already exists, link '${s}'`);this.ensureParentDirs(r),this.data.set(r,{type:"file",content:i.content,mode:i.mode,mtime:i.mtime})}async readlink(t){let s=this.normalizePath(t),n=this.data.get(s);if(!n)throw new Error(`ENOENT: no such file or directory, readlink '${t}'`);if(n.type!=="symlink")throw new Error(`EINVAL: invalid argument, readlink '${t}'`);return n.target}async realpath(t){let s=this.resolvePathWithSymlinks(t);if(!this.data.has(s))throw new Error(`ENOENT: no such file or directory, realpath '${t}'`);return s}async utimes(t,s,n){let r=this.normalizePath(t),i=this.resolvePathWithSymlinks(r),a=this.data.get(i);if(!a)throw new Error(`ENOENT: no such file or directory, utimes '${t}'`);a.mtime=n}};function Zr(e){let t=e;return typeof t.mkdirSync=="function"&&typeof t.writeFileSync=="function"}function Gr(e,t){e.mkdirSync("/bin",{recursive:!0}),e.mkdirSync("/usr/bin",{recursive:!0}),t&&(e.mkdirSync("/home/user",{recursive:!0}),e.mkdirSync("/tmp",{recursive:!0}))}function Xr(e){e.mkdirSync("/dev",{recursive:!0}),e.writeFileSync("/dev/null",""),e.writeFileSync("/dev/zero",new Uint8Array(0)),e.writeFileSync("/dev/stdin",""),e.writeFileSync("/dev/stdout",""),e.writeFileSync("/dev/stderr","")}function Kr(e){e.mkdirSync("/proc/self/fd",{recursive:!0}),e.writeFileSync("/proc/version",`${Gs}
1
+ import{B as nn,C as rn,D as se,E as Te,F as K,G as ue,H as ut,I as an,J as I,K as on,L as ln,M as me,N as Zt,O as dt,P as V,a as Gs,b as Xs,c as Ks,d as ct,e as Z,f as W,g as he,h as Q,i as pe,j as Ce,k as Bt,l as ft,m as Ys,n as Ht,o as Qs,p as oe,q as Ee,r as Js,s as en,t as jt,u as Ut,v as Ne,w as tn,x as sn,y as fe,z as qt}from"./chunks/chunk-ZRCBN2U4.js";import{a as _e,b as de}from"./chunks/chunk-OJDRYQWQ.js";import{a as re,b as ie,c as te,d as ae,e as qs,f as z,g as De,h as at,i as ot,j as Zs,k as ee,l as Pe,m as lt,n as ce}from"./chunks/chunk-PSW6BMXW.js";import{a as Ke}from"./chunks/chunk-YNYSPYQ5.js";import"./chunks/chunk-NUFRM6SI.js";import{a as ve}from"./chunks/chunk-44UOCSGV.js";import"./chunks/chunk-DXB73IDG.js";var Ie=[{name:"echo",load:async()=>(await import("./chunks/echo-6S7WE7XB.js")).echoCommand},{name:"cat",load:async()=>(await import("./chunks/cat-GPKR7D6K.js")).catCommand},{name:"printf",load:async()=>(await import("./chunks/printf-4U5V2VHK.js")).printfCommand},{name:"ls",load:async()=>(await import("./chunks/ls-PUJHEPXS.js")).lsCommand},{name:"mkdir",load:async()=>(await import("./chunks/mkdir-SF2UE4KB.js")).mkdirCommand},{name:"rmdir",load:async()=>(await import("./chunks/rmdir-DU6C7ZEO.js")).rmdirCommand},{name:"touch",load:async()=>(await import("./chunks/touch-TDTEBHHI.js")).touchCommand},{name:"rm",load:async()=>(await import("./chunks/rm-MJFRIDNT.js")).rmCommand},{name:"cp",load:async()=>(await import("./chunks/cp-NJSENVKC.js")).cpCommand},{name:"mv",load:async()=>(await import("./chunks/mv-JPBZPM4O.js")).mvCommand},{name:"ln",load:async()=>(await import("./chunks/ln-Y7YB677N.js")).lnCommand},{name:"chmod",load:async()=>(await import("./chunks/chmod-ODWUR7E6.js")).chmodCommand},{name:"pwd",load:async()=>(await import("./chunks/pwd-S4NVAMC4.js")).pwdCommand},{name:"readlink",load:async()=>(await import("./chunks/readlink-EM4O3U4P.js")).readlinkCommand},{name:"head",load:async()=>(await import("./chunks/head-SA7P5NJ7.js")).headCommand},{name:"tail",load:async()=>(await import("./chunks/tail-52LRAWXT.js")).tailCommand},{name:"wc",load:async()=>(await import("./chunks/wc-VDPK3LVS.js")).wcCommand},{name:"stat",load:async()=>(await import("./chunks/stat-IOLJTP7U.js")).statCommand},{name:"grep",load:async()=>(await import("./chunks/grep-UTH3KDWL.js")).grepCommand},{name:"fgrep",load:async()=>(await import("./chunks/grep-UTH3KDWL.js")).fgrepCommand},{name:"egrep",load:async()=>(await import("./chunks/grep-UTH3KDWL.js")).egrepCommand},{name:"rg",load:async()=>(await import("./chunks/rg-JNKRPEYR.js")).rgCommand},{name:"sed",load:async()=>(await import("./chunks/sed-4K5HXNXE.js")).sedCommand},{name:"awk",load:async()=>(await import("./chunks/awk2-YNEKUV4T.js")).awkCommand2},{name:"sort",load:async()=>(await import("./chunks/sort-LT2PE47K.js")).sortCommand},{name:"uniq",load:async()=>(await import("./chunks/uniq-XBP4SJA3.js")).uniqCommand},{name:"comm",load:async()=>(await import("./chunks/comm-AXQM7FFF.js")).commCommand},{name:"cut",load:async()=>(await import("./chunks/cut-NVKWEAZF.js")).cutCommand},{name:"paste",load:async()=>(await import("./chunks/paste-QAP6Y75J.js")).pasteCommand},{name:"tr",load:async()=>(await import("./chunks/tr-UJSEBPIQ.js")).trCommand},{name:"rev",load:async()=>(await import("./chunks/rev-FKUV5GH5.js")).rev},{name:"nl",load:async()=>(await import("./chunks/nl-KWQGFZH5.js")).nl},{name:"fold",load:async()=>(await import("./chunks/fold-6CFXIPYZ.js")).fold},{name:"expand",load:async()=>(await import("./chunks/expand-VSTNOVF5.js")).expand},{name:"unexpand",load:async()=>(await import("./chunks/unexpand-I7A2VXFD.js")).unexpand},{name:"strings",load:async()=>(await import("./chunks/strings-LRU5XCFP.js")).strings},{name:"split",load:async()=>(await import("./chunks/split-LGSGJHV5.js")).split},{name:"column",load:async()=>(await import("./chunks/column-R6OLMEUA.js")).column},{name:"join",load:async()=>(await import("./chunks/join-X3QYPZUA.js")).join},{name:"tee",load:async()=>(await import("./chunks/tee-4KHTWVWB.js")).teeCommand},{name:"find",load:async()=>(await import("./chunks/find-WTVSUXL3.js")).findCommand},{name:"basename",load:async()=>(await import("./chunks/basename-CFA5ZIGT.js")).basenameCommand},{name:"dirname",load:async()=>(await import("./chunks/dirname-YPJLCQYA.js")).dirnameCommand},{name:"tree",load:async()=>(await import("./chunks/tree-UFVZH4SS.js")).treeCommand},{name:"du",load:async()=>(await import("./chunks/du-T4JUAAB2.js")).duCommand},{name:"env",load:async()=>(await import("./chunks/env-M3AXY56V.js")).envCommand},{name:"printenv",load:async()=>(await import("./chunks/env-M3AXY56V.js")).printenvCommand},{name:"alias",load:async()=>(await import("./chunks/alias-YGOORMWI.js")).aliasCommand},{name:"unalias",load:async()=>(await import("./chunks/alias-YGOORMWI.js")).unaliasCommand},{name:"history",load:async()=>(await import("./chunks/history-TMBGOQO6.js")).historyCommand},{name:"xargs",load:async()=>(await import("./chunks/xargs-4FRA6OJ7.js")).xargsCommand},{name:"true",load:async()=>(await import("./chunks/true-CNJ54NE6.js")).trueCommand},{name:"false",load:async()=>(await import("./chunks/true-CNJ54NE6.js")).falseCommand},{name:"clear",load:async()=>(await import("./chunks/clear-VT2LJIDX.js")).clearCommand},{name:"bash",load:async()=>(await import("./chunks/bash-BYWM5OPC.js")).bashCommand},{name:"sh",load:async()=>(await import("./chunks/bash-BYWM5OPC.js")).shCommand},{name:"jq",load:async()=>(await import("./chunks/jq-2LEQ2SZJ.js")).jqCommand},{name:"base64",load:async()=>(await import("./chunks/base64-2JFR3HGT.js")).base64Command},{name:"diff",load:async()=>(await import("./chunks/diff-ELUS3RW7.js")).diffCommand},{name:"date",load:async()=>(await import("./chunks/date-PN3CMG7K.js")).dateCommand},{name:"sleep",load:async()=>(await import("./chunks/sleep-AK4QE4WR.js")).sleepCommand},{name:"timeout",load:async()=>(await import("./chunks/timeout-X3X3N6IE.js")).timeoutCommand},{name:"time",load:async()=>(await import("./chunks/time-EGF4KTWV.js")).timeCommand},{name:"seq",load:async()=>(await import("./chunks/seq-5VRIVQYP.js")).seqCommand},{name:"expr",load:async()=>(await import("./chunks/expr-YSFDPKPV.js")).exprCommand},{name:"md5sum",load:async()=>(await import("./chunks/md5sum-TGZPGVOK.js")).md5sumCommand},{name:"sha1sum",load:async()=>(await import("./chunks/sha1sum-37LOTSQP.js")).sha1sumCommand},{name:"sha256sum",load:async()=>(await import("./chunks/sha256sum-I4J5BPZA.js")).sha256sumCommand},{name:"file",load:async()=>(await import("./chunks/file-APPTAFMI.js")).fileCommand},{name:"html-to-markdown",load:async()=>(await import("./chunks/html-to-markdown-ZK6GQVSL.js")).htmlToMarkdownCommand},{name:"help",load:async()=>(await import("./chunks/help-UD3E73G5.js")).helpCommand},{name:"which",load:async()=>(await import("./chunks/which-GF77XMJD.js")).whichCommand},{name:"tac",load:async()=>(await import("./chunks/tac-2X4JLF4W.js")).tac},{name:"hostname",load:async()=>(await import("./chunks/hostname-NWR32CGF.js")).hostname},{name:"whoami",load:async()=>(await import("./chunks/whoami-YUDAIS32.js")).whoami},{name:"od",load:async()=>(await import("./chunks/od-3FPDPLWJ.js")).od},{name:"gzip",load:async()=>(await import("./chunks/gzip-4P4KGYT5.js")).gzipCommand},{name:"gunzip",load:async()=>(await import("./chunks/gzip-4P4KGYT5.js")).gunzipCommand},{name:"zcat",load:async()=>(await import("./chunks/gzip-4P4KGYT5.js")).zcatCommand}];(typeof __BROWSER__>"u"||!__BROWSER__)&&(Ie.push({name:"tar",load:async()=>(await import("./chunks/tar-5V4PGBFL.js")).tarCommand}),Ie.push({name:"yq",load:async()=>(await import("./chunks/yq-6RVO6I5Q.js")).yqCommand}),Ie.push({name:"xan",load:async()=>(await import("./chunks/xan-I4Y5DD3C.js")).xanCommand}),Ie.push({name:"sqlite3",load:async()=>(await import("./chunks/sqlite3-5QVZOGER.js")).sqlite3Command}));var ht=[];(typeof __BROWSER__>"u"||!__BROWSER__)&&(ht.push({name:"python3",load:async()=>(await import("./chunks/python3-SKZGHYDO.js")).python3Command}),ht.push({name:"python",load:async()=>(await import("./chunks/python3-SKZGHYDO.js")).pythonCommand}));var fn=[{name:"curl",load:async()=>(await import("./chunks/curl-QDCXHQMX.js")).curlCommand}],cn=new Map;function Gt(e){return{name:e.name,async execute(t,s){let n=cn.get(e.name);return n||(n=await e.load(),cn.set(e.name,n)),n.execute(t,s)}}}function zr(){return Ie.map(e=>e.name)}function Vr(){return fn.map(e=>e.name)}function un(e){return(e?Ie.filter(s=>e.includes(s.name)):Ie).map(Gt)}function dn(){return fn.map(Gt)}function Br(){return ht.map(e=>e.name)}function hn(){return ht.map(Gt)}function pn(e){return"load"in e&&typeof e.load=="function"}function Hr(e,t){return{name:e,execute:t}}function mn(e){let t=null;return{name:e.name,async execute(s,n){return t||(t=await e.load()),t.execute(s,n)}}}var jr=new TextEncoder,Ur=new TextDecoder;function be(e,t){if(e instanceof Uint8Array)return e;if(t==="base64")return Uint8Array.from(atob(e),s=>s.charCodeAt(0));if(t==="hex"){let s=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)s[n/2]=parseInt(e.slice(n,n+2),16);return s}return t==="binary"||t==="latin1"?Uint8Array.from(e,s=>s.charCodeAt(0)):jr.encode(e)}function Fe(e,t){return t==="base64"?btoa(String.fromCharCode(...e)):t==="hex"?Array.from(e).map(s=>s.toString(16).padStart(2,"0")).join(""):t==="binary"||t==="latin1"?String.fromCharCode(...e):Ur.decode(e)}function le(e){if(e!=null)return typeof e=="string"?e:e.encoding??void 0}var pt=new TextEncoder;function qr(e){return typeof e=="object"&&e!==null&&!(e instanceof Uint8Array)&&"content"in e}var $e=class{data=new Map;constructor(t){if(this.data.set("/",{type:"directory",mode:493,mtime:new Date}),t)for(let[s,n]of Object.entries(t))qr(n)?this.writeFileSync(s,n.content,void 0,{mode:n.mode,mtime:n.mtime}):this.writeFileSync(s,n)}normalizePath(t){if(!t||t==="/")return"/";let s=t.endsWith("/")&&t!=="/"?t.slice(0,-1):t;s.startsWith("/")||(s=`/${s}`);let n=s.split("/").filter(i=>i&&i!=="."),r=[];for(let i of n)i===".."?r.pop():r.push(i);return`/${r.join("/")}`||"/"}dirname(t){let s=this.normalizePath(t);if(s==="/")return"/";let n=s.lastIndexOf("/");return n===0?"/":s.slice(0,n)}ensureParentDirs(t){let s=this.dirname(t);s!=="/"&&(this.data.has(s)||(this.ensureParentDirs(s),this.data.set(s,{type:"directory",mode:493,mtime:new Date})))}writeFileSync(t,s,n,r){let i=this.normalizePath(t);this.ensureParentDirs(i);let a=le(n),o=be(s,a);this.data.set(i,{type:"file",content:o,mode:r?.mode??420,mtime:r?.mtime??new Date})}async readFile(t,s){let n=await this.readFileBuffer(t),r=le(s);return Fe(n,r)}async readFileBuffer(t){let s=this.resolvePathWithSymlinks(t),n=this.data.get(s);if(!n)throw new Error(`ENOENT: no such file or directory, open '${t}'`);if(n.type!=="file")throw new Error(`EISDIR: illegal operation on a directory, read '${t}'`);return n.content instanceof Uint8Array?n.content:pt.encode(n.content)}async writeFile(t,s,n){this.writeFileSync(t,s,n)}async appendFile(t,s,n){let r=this.normalizePath(t),i=this.data.get(r);if(i&&i.type==="directory")throw new Error(`EISDIR: illegal operation on a directory, write '${t}'`);let a=le(n),o=be(s,a);if(i?.type==="file"){let c=i.content instanceof Uint8Array?i.content:pt.encode(i.content),l=new Uint8Array(c.length+o.length);l.set(c),l.set(o,c.length),this.data.set(r,{type:"file",content:l,mode:i.mode,mtime:new Date})}else this.writeFileSync(t,s,n)}async exists(t){try{let s=this.resolvePathWithSymlinks(t);return this.data.has(s)}catch{return!1}}async stat(t){let s=this.resolvePathWithSymlinks(t),n=this.data.get(s);if(!n)throw new Error(`ENOENT: no such file or directory, stat '${t}'`);let r=0;return n.type==="file"&&n.content&&(n.content instanceof Uint8Array?r=n.content.length:r=pt.encode(n.content).length),{isFile:n.type==="file",isDirectory:n.type==="directory",isSymbolicLink:!1,mode:n.mode,size:r,mtime:n.mtime||new Date}}async lstat(t){let s=this.resolveIntermediateSymlinks(t),n=this.data.get(s);if(!n)throw new Error(`ENOENT: no such file or directory, lstat '${t}'`);if(n.type==="symlink")return{isFile:!1,isDirectory:!1,isSymbolicLink:!0,mode:n.mode,size:n.target.length,mtime:n.mtime||new Date};let r=0;return n.type==="file"&&n.content&&(n.content instanceof Uint8Array?r=n.content.length:r=pt.encode(n.content).length),{isFile:n.type==="file",isDirectory:n.type==="directory",isSymbolicLink:!1,mode:n.mode,size:r,mtime:n.mtime||new Date}}resolveSymlink(t,s){if(s.startsWith("/"))return this.normalizePath(s);let n=this.dirname(t);return this.normalizePath(n==="/"?`/${s}`:`${n}/${s}`)}resolveIntermediateSymlinks(t){let s=this.normalizePath(t);if(s==="/")return"/";let n=s.slice(1).split("/");if(n.length<=1)return s;let r="",i=new Set;for(let a=0;a<n.length-1;a++){let o=n[a];r=`${r}/${o}`;let c=this.data.get(r),l=0,f=40;for(;c&&c.type==="symlink"&&l<f;){if(i.has(r))throw new Error(`ELOOP: too many levels of symbolic links, lstat '${t}'`);i.add(r),r=this.resolveSymlink(r,c.target),c=this.data.get(r),l++}if(l>=f)throw new Error(`ELOOP: too many levels of symbolic links, lstat '${t}'`)}return`${r}/${n[n.length-1]}`}resolvePathWithSymlinks(t){let s=this.normalizePath(t);if(s==="/")return"/";let n=s.slice(1).split("/"),r="",i=new Set;for(let a of n){r=`${r}/${a}`;let o=this.data.get(r),c=0,l=40;for(;o&&o.type==="symlink"&&c<l;){if(i.has(r))throw new Error(`ELOOP: too many levels of symbolic links, open '${t}'`);i.add(r),r=this.resolveSymlink(r,o.target),o=this.data.get(r),c++}if(c>=l)throw new Error(`ELOOP: too many levels of symbolic links, open '${t}'`)}return r}async mkdir(t,s){this.mkdirSync(t,s)}mkdirSync(t,s){let n=this.normalizePath(t);if(this.data.has(n)){if(this.data.get(n)?.type==="file")throw new Error(`EEXIST: file already exists, mkdir '${t}'`);if(!s?.recursive)throw new Error(`EEXIST: directory already exists, mkdir '${t}'`);return}let r=this.dirname(n);if(r!=="/"&&!this.data.has(r))if(s?.recursive)this.mkdirSync(r,{recursive:!0});else throw new Error(`ENOENT: no such file or directory, mkdir '${t}'`);this.data.set(n,{type:"directory",mode:493,mtime:new Date})}async readdir(t){return(await this.readdirWithFileTypes(t)).map(n=>n.name)}async readdirWithFileTypes(t){let s=this.normalizePath(t),n=this.data.get(s);if(!n)throw new Error(`ENOENT: no such file or directory, scandir '${t}'`);let r=new Set;for(;n&&n.type==="symlink";){if(r.has(s))throw new Error(`ELOOP: too many levels of symbolic links, scandir '${t}'`);r.add(s),s=this.resolveSymlink(s,n.target),n=this.data.get(s)}if(!n)throw new Error(`ENOENT: no such file or directory, scandir '${t}'`);if(n.type!=="directory")throw new Error(`ENOTDIR: not a directory, scandir '${t}'`);let i=s==="/"?"/":`${s}/`,a=new Map;for(let[o,c]of this.data.entries())if(o!==s&&o.startsWith(i)){let l=o.slice(i.length),f=l.split("/")[0];f&&!l.includes("/",f.length)&&!a.has(f)&&a.set(f,{name:f,isFile:c.type==="file",isDirectory:c.type==="directory",isSymbolicLink:c.type==="symlink"})}return Array.from(a.values()).sort((o,c)=>o.name<c.name?-1:o.name>c.name?1:0)}async rm(t,s){let n=this.normalizePath(t),r=this.data.get(n);if(!r){if(s?.force)return;throw new Error(`ENOENT: no such file or directory, rm '${t}'`)}if(r.type==="directory"){let i=await this.readdir(n);if(i.length>0){if(!s?.recursive)throw new Error(`ENOTEMPTY: directory not empty, rm '${t}'`);for(let a of i){let o=n==="/"?`/${a}`:`${n}/${a}`;await this.rm(o,s)}}}this.data.delete(n)}async cp(t,s,n){let r=this.normalizePath(t),i=this.normalizePath(s),a=this.data.get(r);if(!a)throw new Error(`ENOENT: no such file or directory, cp '${t}'`);if(a.type==="file")this.ensureParentDirs(i),this.data.set(i,{...a});else if(a.type==="directory"){if(!n?.recursive)throw new Error(`EISDIR: is a directory, cp '${t}'`);await this.mkdir(i,{recursive:!0});let o=await this.readdir(r);for(let c of o){let l=r==="/"?`/${c}`:`${r}/${c}`,f=i==="/"?`/${c}`:`${i}/${c}`;await this.cp(l,f,n)}}}async mv(t,s){await this.cp(t,s,{recursive:!0}),await this.rm(t,{recursive:!0})}getAllPaths(){return Array.from(this.data.keys())}resolvePath(t,s){if(s.startsWith("/"))return this.normalizePath(s);let n=t==="/"?`/${s}`:`${t}/${s}`;return this.normalizePath(n)}async chmod(t,s){let n=this.normalizePath(t),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, chmod '${t}'`);r.mode=s}async symlink(t,s){let n=this.normalizePath(s);if(this.data.has(n))throw new Error(`EEXIST: file already exists, symlink '${s}'`);this.ensureParentDirs(n),this.data.set(n,{type:"symlink",target:t,mode:511,mtime:new Date})}async link(t,s){let n=this.normalizePath(t),r=this.normalizePath(s),i=this.data.get(n);if(!i)throw new Error(`ENOENT: no such file or directory, link '${t}'`);if(i.type!=="file")throw new Error(`EPERM: operation not permitted, link '${t}'`);if(this.data.has(r))throw new Error(`EEXIST: file already exists, link '${s}'`);this.ensureParentDirs(r),this.data.set(r,{type:"file",content:i.content,mode:i.mode,mtime:i.mtime})}async readlink(t){let s=this.normalizePath(t),n=this.data.get(s);if(!n)throw new Error(`ENOENT: no such file or directory, readlink '${t}'`);if(n.type!=="symlink")throw new Error(`EINVAL: invalid argument, readlink '${t}'`);return n.target}async realpath(t){let s=this.resolvePathWithSymlinks(t);if(!this.data.has(s))throw new Error(`ENOENT: no such file or directory, realpath '${t}'`);return s}async utimes(t,s,n){let r=this.normalizePath(t),i=this.resolvePathWithSymlinks(r),a=this.data.get(i);if(!a)throw new Error(`ENOENT: no such file or directory, utimes '${t}'`);a.mtime=n}};function Zr(e){let t=e;return typeof t.mkdirSync=="function"&&typeof t.writeFileSync=="function"}function Gr(e,t){e.mkdirSync("/bin",{recursive:!0}),e.mkdirSync("/usr/bin",{recursive:!0}),t&&(e.mkdirSync("/home/user",{recursive:!0}),e.mkdirSync("/tmp",{recursive:!0}))}function Xr(e){e.mkdirSync("/dev",{recursive:!0}),e.writeFileSync("/dev/null",""),e.writeFileSync("/dev/zero",new Uint8Array(0)),e.writeFileSync("/dev/stdin",""),e.writeFileSync("/dev/stdout",""),e.writeFileSync("/dev/stderr","")}function Kr(e){e.mkdirSync("/proc/self/fd",{recursive:!0}),e.writeFileSync("/proc/version",`${Gs}
2
2
  `),e.writeFileSync("/proc/self/exe","/bin/bash"),e.writeFileSync("/proc/self/cmdline","bash\0"),e.writeFileSync("/proc/self/comm",`bash
3
3
  `),e.writeFileSync("/proc/self/status",Xs()),e.writeFileSync("/proc/self/fd/0","/dev/stdin"),e.writeFileSync("/proc/self/fd/1","/dev/stdout"),e.writeFileSync("/proc/self/fd/2","/dev/stderr")}function yn(e,t){Zr(e)&&(Gr(e,t),Xr(e),Kr(e))}var Yr=["allexport","errexit","noglob","noclobber","noexec","nounset","pipefail","posix","verbose","xtrace"],Qr=["braceexpand","hashall","interactive-comments"];function Xt(e){let t=[],s=[...Qr.map(n=>({name:n,enabled:!0})),...Yr.map(n=>({name:n,enabled:e[n]}))].sort((n,r)=>n.name.localeCompare(r.name));for(let n of s)n.enabled&&t.push(n.name);return t.join(":")}function Me(e){e.state.env.set("SHELLOPTS",Xt(e.state.options))}var Jr=["dotglob","expand_aliases","extglob","failglob","globskipdots","globstar","lastpipe","nocaseglob","nocasematch","nullglob","xpg_echo"];function Kt(e){let t=[];for(let s of Jr)e[s]&&t.push(s);return t.join(":")}function Yt(e){e.state.env.set("BASHOPTS",Kt(e.state.shoptOptions))}var ei="BASH_ALIAS_";function gn(e){return e.parts.length!==1?!1:e.parts[0].type==="Literal"}function wn(e){if(e.parts.length!==1)return null;let t=e.parts[0];return t.type==="Literal"?t.value:null}function vn(e,t){return e.env.get(`${ei}${t}`)}function Qt(e,t,s){if(!t.name||!gn(t.name))return t;let n=wn(t.name);if(!n)return t;let r=vn(e,n);if(!r||s.has(n))return t;try{s.add(n);let i=new W,a=r,o=r.endsWith(" ");if(!o)for(let u of t.args){let d=bn(u);a+=` ${d}`}let c;try{c=i.parse(a)}catch(u){if(u instanceof ct)throw u;return t}if(c.statements.length!==1||c.statements[0].pipelines.length!==1||c.statements[0].pipelines[0].commands.length!==1)return En(t,r);let l=c.statements[0].pipelines[0].commands[0];if(l.type!=="SimpleCommand")return En(t,r);let f={...l,assignments:[...t.assignments,...l.assignments],redirections:[...l.redirections,...t.redirections],line:t.line};if(o&&t.args.length>0&&(f={...f,args:[...f.args,...t.args]},f.args.length>0)){let u=f.args[0];if(gn(u)){let d=wn(u);if(d&&vn(e,d)){let h={type:"SimpleCommand",name:u,args:f.args.slice(1),assignments:[],redirections:[]},m=Qt(e,h,s);m!==h&&(f={...f,name:m.name,args:[...m.args]})}}}return f}catch(i){throw s.delete(n),i}}function En(e,t){let s=t;for(let a of e.args){let o=bn(a);s+=` ${o}`}let n=new W,r=n.parseWordFromString("eval",!1,!1),i=n.parseWordFromString(`'${s.replace(/'/g,"'\\''")}'`,!1,!1);return{type:"SimpleCommand",name:r,args:[i],assignments:e.assignments,redirections:e.redirections,line:e.line}}function bn(e){let t="";for(let s of e.parts)switch(s.type){case"Literal":t+=s.value.replace(/([\s"'$`\\*?[\]{}()<>|&;#!])/g,"\\$1");break;case"SingleQuoted":t+=`'${s.value}'`;break;case"DoubleQuoted":t+=`"${s.parts.map(n=>n.type==="Literal"?n.value:`$${n.type}`).join("")}"`;break;case"ParameterExpansion":t+=`\${${s.parameter}}`;break;case"CommandSubstitution":t+="$(...)";break;case"ArithmeticExpansion":t+=`$((${s.expression}))`;break;case"Glob":t+=s.pattern;break;default:break}return t}async function $n(e,t){let s=t.parts.map(f=>f.type==="Literal"?f.value:"\0").join(""),n=s.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\(/);if(!n||!s.endsWith(")"))return null;let r=n[1],i=[],a=!1,o="",c=!1;for(let f of t.parts)if(f.type==="Literal"){let u=f.value;if(!a){let d=u.indexOf("=(");d!==-1&&(a=!0,u=u.slice(d+2))}if(a){u.endsWith(")")&&(u=u.slice(0,-1));let d=u.split(/(\s+)/);for(let h of d)/^\s+$/.test(h)?(o||c)&&(i.push(o),o="",c=!1):h&&(o+=h)}}else if(a)if(f.type==="BraceExpansion")if(/^\[.+\]=/.test(o))o+=ft({type:"Word",parts:[f]});else{(o||c)&&(i.push(o),o="",c=!1);let d=await me(e,{type:"Word",parts:[f]});i.push(...d.values)}else{(f.type==="SingleQuoted"||f.type==="DoubleQuoted"||f.type==="Escaped")&&(c=!0);let u=await I(e,{type:"Word",parts:[f]});o+=u}(o||c)&&i.push(o);let l=i.map(f=>/^\[.+\]=/.test(f)?f:f===""?"''":/[\s"'\\$`!*?[\]{}|&;<>()]/.test(f)&&!f.startsWith("'")&&!f.startsWith('"')?`'${f.replace(/'/g,"'\\''")}'`:f);return`${r}=(${l.join(" ")})`}async function Sn(e,t){let s=-1,n=-1,r=!1;for(let p=0;p<t.parts.length;p++){let g=t.parts[p];if(g.type==="Literal"){let v=g.value.indexOf("+=");if(v!==-1){let N=g.value.slice(0,v);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(N)){s=p,n=v,r=!0;break}if(/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(N)){s=p,n=v,r=!0;break}}let $=g.value.indexOf("=");if($!==-1&&($===0||g.value[$-1]!=="+")){let N=g.value.slice(0,$);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(N)||/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(N)){s=p,n=$;break}}}}if(s===-1)return null;let i=t.parts.slice(0,s),a=t.parts[s];if(a.type!=="Literal")return null;let o=r?2:1,c=a.value.slice(0,n),l=a.value.slice(n+o),f=t.parts.slice(s+1),u="";for(let p of i)u+=await I(e,{type:"Word",parts:[p]});u+=c;let d={type:"Word",parts:l!==""?[{type:"Literal",value:l},...f]:f},h=d.parts.length>0?await I(e,d):"";return`${u}${r?"+=":"="}${h}`}var ti=["tar","yq","xan","sqlite3","python3","python"];function An(e){return ti.includes(e)}var L=Object.freeze({stdout:"",stderr:"",exitCode:0});function F(e=""){return{stdout:e,stderr:"",exitCode:0}}function S(e,t=1){return{stdout:"",stderr:e,exitCode:t}}function P(e,t,s){return{stdout:e,stderr:t,exitCode:s}}function q(e){return{stdout:"",stderr:"",exitCode:e?0:1}}function Se(e,t,s="",n=""){throw new ee(e,t,s,n)}function Jt(e,t){if(e.state.loopDepth===0){if(e.state.parentHasLoopContext)throw new Pe;return L}if(t.length>1)throw new z(1,"",`bash: break: too many arguments
4
4
  `);let s=1;if(t.length>0){let n=Number.parseInt(t[0],10);if(Number.isNaN(n)||n<1)throw new z(128,"",`bash: break: ${t[0]}: numeric argument required
@@ -149,39 +149,39 @@ eval: usage: eval [arg ...]
149
149
  `;for(let[,p]of e.state.hashTable)m+=` 1 ${p}
150
150
  `}return F(m)}let f=!1,u="",h=(e.state.env.get("PATH")||"/usr/bin:/bin").split(":");for(let m of c){if(m.includes("/")){u+=`bash: hash: ${m}: cannot use / in name
151
151
  `,f=!0;continue}let p=!1;for(let g of h){if(!g)continue;let v=`${g}/${m}`;if(await e.fs.exists(v)){e.state.hashTable.set(m,v),p=!0;break}}p||(u+=`bash: hash: ${m}: not found
152
- `,f=!0)}return f?S(u,1):L}var Kn={":":[": [arguments]",`Null command.
152
+ `,f=!0)}return f?S(u,1):L}var Kn=new Map([[":",[": [arguments]",`Null command.
153
153
  No effect; the command does nothing.
154
154
  Exit Status:
155
- Always succeeds.`],".":[". filename [arguments]",`Execute commands from a file in the current shell.
155
+ Always succeeds.`]],[".",[". filename [arguments]",`Execute commands from a file in the current shell.
156
156
  Read and execute commands from FILENAME in the current shell.
157
157
  The entries in $PATH are used to find the directory containing FILENAME.
158
158
  Exit Status:
159
- Returns the status of the last command executed in FILENAME.`],"[":["[ arg... ]",`Evaluate conditional expression.
159
+ Returns the status of the last command executed in FILENAME.`]],["[",["[ arg... ]",`Evaluate conditional expression.
160
160
  This is a synonym for the "test" builtin, but the last argument must
161
- be a literal \`]', to match the opening \`['.`],alias:["alias [-p] [name[=value] ... ]",`Define or display aliases.
161
+ be a literal \`]', to match the opening \`['.`]],["alias",["alias [-p] [name[=value] ... ]",`Define or display aliases.
162
162
  Without arguments, \`alias' prints the list of aliases in the reusable
163
163
  form \`alias NAME=VALUE' on standard output.
164
164
  Exit Status:
165
165
  alias returns true unless a NAME is supplied for which no alias has been
166
- defined.`],bg:["bg [job_spec ...]",`Move jobs to the background.
166
+ defined.`]],["bg",["bg [job_spec ...]",`Move jobs to the background.
167
167
  Place the jobs identified by each JOB_SPEC in the background, as if they
168
- had been started with \`&'.`],break:["break [n]",`Exit for, while, or until loops.
168
+ had been started with \`&'.`]],["break",["break [n]",`Exit for, while, or until loops.
169
169
  Exit a FOR, WHILE or UNTIL loop. If N is specified, break N enclosing
170
170
  loops.
171
171
  Exit Status:
172
- The exit status is 0 unless N is not greater than or equal to 1.`],builtin:["builtin [shell-builtin [arg ...]]",`Execute shell builtins.
172
+ The exit status is 0 unless N is not greater than or equal to 1.`]],["builtin",["builtin [shell-builtin [arg ...]]",`Execute shell builtins.
173
173
  Execute SHELL-BUILTIN with arguments ARGs without performing command
174
174
  lookup. This is useful when you wish to reimplement a shell builtin
175
175
  as a shell function, but need to execute the builtin within the function.
176
176
  Exit Status:
177
177
  Returns the exit status of SHELL-BUILTIN, or false if SHELL-BUILTIN is
178
- not a shell builtin.`],caller:["caller [expr]",`Return the context of the current subroutine call.
178
+ not a shell builtin.`]],["caller",["caller [expr]",`Return the context of the current subroutine call.
179
179
  Without EXPR, returns "$line $filename". With EXPR, returns
180
180
  "$line $subroutine $filename"; this extra information can be used to
181
181
  provide a stack trace.
182
182
  Exit Status:
183
183
  Returns 0 unless the shell is not executing a subroutine call or
184
- EXPR is invalid.`],cd:["cd [-L|-P] [dir]",`Change the shell working directory.
184
+ EXPR is invalid.`]],["cd",["cd [-L|-P] [dir]",`Change the shell working directory.
185
185
  Change the current directory to DIR. The default DIR is the value of the
186
186
  HOME shell variable.
187
187
 
@@ -202,7 +202,7 @@ eval: usage: eval [arg ...]
202
202
  The default is to follow symbolic links, as if \`-L' were specified.
203
203
 
204
204
  Exit Status:
205
- Returns 0 if the directory is changed; non-zero otherwise.`],command:["command [-pVv] command [arg ...]",`Execute a simple command or display information about commands.
205
+ Returns 0 if the directory is changed; non-zero otherwise.`]],["command",["command [-pVv] command [arg ...]",`Execute a simple command or display information about commands.
206
206
  Runs COMMAND with ARGS suppressing shell function lookup, or display
207
207
  information about the specified COMMANDs.
208
208
 
@@ -213,19 +213,19 @@ eval: usage: eval [arg ...]
213
213
  -V print a more verbose description of each COMMAND
214
214
 
215
215
  Exit Status:
216
- Returns exit status of COMMAND, or failure if COMMAND is not found.`],compgen:["compgen [-abcdefgjksuv] [-o option] [-A action] [-G globpat] [-W wordlist] [-F function] [-C command] [-X filterpat] [-P prefix] [-S suffix] [word]",`Display possible completions depending on the options.
216
+ Returns exit status of COMMAND, or failure if COMMAND is not found.`]],["compgen",["compgen [-abcdefgjksuv] [-o option] [-A action] [-G globpat] [-W wordlist] [-F function] [-C command] [-X filterpat] [-P prefix] [-S suffix] [word]",`Display possible completions depending on the options.
217
217
  Intended to be used from within a shell function generating possible
218
218
  completions. If the optional WORD argument is supplied, matches against
219
219
  WORD are generated.
220
220
  Exit Status:
221
- Returns success unless an invalid option is supplied or an error occurs.`],complete:["complete [-abcdefgjksuv] [-pr] [-DEI] [-o option] [-A action] [-G globpat] [-W wordlist] [-F function] [-C command] [-X filterpat] [-P prefix] [-S suffix] [name ...]",`Specify how arguments are to be completed.
221
+ Returns success unless an invalid option is supplied or an error occurs.`]],["complete",["complete [-abcdefgjksuv] [-pr] [-DEI] [-o option] [-A action] [-G globpat] [-W wordlist] [-F function] [-C command] [-X filterpat] [-P prefix] [-S suffix] [name ...]",`Specify how arguments are to be completed.
222
222
  For each NAME, specify how arguments are to be completed.
223
223
  Exit Status:
224
- Returns success unless an invalid option is supplied or an error occurs.`],continue:["continue [n]",`Resume for, while, or until loops.
224
+ Returns success unless an invalid option is supplied or an error occurs.`]],["continue",["continue [n]",`Resume for, while, or until loops.
225
225
  Resumes the next iteration of the enclosing FOR, WHILE or UNTIL loop.
226
226
  If N is specified, resumes the Nth enclosing loop.
227
227
  Exit Status:
228
- The exit status is 0 unless N is not greater than or equal to 1.`],declare:["declare [-aAfFgilnrtux] [-p] [name[=value] ...]",`Set variable values and attributes.
228
+ The exit status is 0 unless N is not greater than or equal to 1.`]],["declare",["declare [-aAfFgilnrtux] [-p] [name[=value] ...]",`Set variable values and attributes.
229
229
  Declare variables and give them attributes. If no NAMEs are given,
230
230
  display the attributes and values of all variables.
231
231
 
@@ -242,13 +242,13 @@ eval: usage: eval [arg ...]
242
242
 
243
243
  Exit Status:
244
244
  Returns success unless an invalid option is supplied or a variable
245
- assignment error occurs.`],dirs:["dirs [-clpv] [+N] [-N]",`Display directory stack.
245
+ assignment error occurs.`]],["dirs",["dirs [-clpv] [+N] [-N]",`Display directory stack.
246
246
  Display the list of currently remembered directories. Directories
247
247
  find their way onto the list with the \`pushd' command; you can get
248
248
  back up through the list with the \`popd' command.
249
249
  Exit Status:
250
- Returns success unless an invalid option is supplied or an error occurs.`],disown:["disown [-h] [-ar] [jobspec ...]",`Remove jobs from current shell.
251
- Without any JOBSPECs, remove the current job.`],echo:["echo [-neE] [arg ...]",`Write arguments to the standard output.
250
+ Returns success unless an invalid option is supplied or an error occurs.`]],["disown",["disown [-h] [-ar] [jobspec ...]",`Remove jobs from current shell.
251
+ Without any JOBSPECs, remove the current job.`]],["echo",["echo [-neE] [arg ...]",`Write arguments to the standard output.
252
252
  Display the ARGs, separated by a single space character and followed by a
253
253
  newline, on the standard output.
254
254
 
@@ -258,21 +258,21 @@ eval: usage: eval [arg ...]
258
258
  -E explicitly suppress interpretation of backslash escapes
259
259
 
260
260
  Exit Status:
261
- Returns success unless a write error occurs.`],enable:["enable [-a] [-dnps] [-f filename] [name ...]",`Enable and disable shell builtins.
261
+ Returns success unless a write error occurs.`]],["enable",["enable [-a] [-dnps] [-f filename] [name ...]",`Enable and disable shell builtins.
262
262
  Enables and disables builtin shell commands.
263
263
  Exit Status:
264
- Returns success unless NAME is not a shell builtin or an error occurs.`],eval:["eval [arg ...]",`Execute arguments as a shell command.
264
+ Returns success unless NAME is not a shell builtin or an error occurs.`]],["eval",["eval [arg ...]",`Execute arguments as a shell command.
265
265
  Combine ARGs into a single string, use the result as input to the shell,
266
266
  and execute the resulting commands.
267
267
  Exit Status:
268
- Returns exit status of command or success if command is null.`],exec:["exec [-cl] [-a name] [command [arguments ...]] [redirection ...]",`Replace the shell with the given command.
268
+ Returns exit status of command or success if command is null.`]],["exec",["exec [-cl] [-a name] [command [arguments ...]] [redirection ...]",`Replace the shell with the given command.
269
269
  Execute COMMAND, replacing this shell with the specified program.
270
270
  ARGUMENTS become the arguments to COMMAND. If COMMAND is not specified,
271
271
  any redirections take effect in the current shell.
272
272
  Exit Status:
273
- Returns success unless COMMAND is not found or a redirection error occurs.`],exit:["exit [n]",`Exit the shell.
273
+ Returns success unless COMMAND is not found or a redirection error occurs.`]],["exit",["exit [n]",`Exit the shell.
274
274
  Exits the shell with a status of N. If N is omitted, the exit status
275
- is that of the last command executed.`],export:["export [-fn] [name[=value] ...] or export -p",`Set export attribute for shell variables.
275
+ is that of the last command executed.`]],["export",["export [-fn] [name[=value] ...] or export -p",`Set export attribute for shell variables.
276
276
  Marks each NAME for automatic export to the environment of subsequently
277
277
  executed commands. If VALUE is supplied, assign VALUE before exporting.
278
278
 
@@ -282,13 +282,13 @@ eval: usage: eval [arg ...]
282
282
  -p display a list of all exported variables and functions
283
283
 
284
284
  Exit Status:
285
- Returns success unless an invalid option is given or NAME is invalid.`],false:["false",`Return an unsuccessful result.
285
+ Returns success unless an invalid option is given or NAME is invalid.`]],["false",["false",`Return an unsuccessful result.
286
286
  Exit Status:
287
- Always fails.`],fc:["fc [-e ename] [-lnr] [first] [last] or fc -s [pat=rep] [command]",`Display or execute commands from the history list.
287
+ Always fails.`]],["fc",["fc [-e ename] [-lnr] [first] [last] or fc -s [pat=rep] [command]",`Display or execute commands from the history list.
288
288
  Exit Status:
289
- Returns success or status of executed command.`],fg:["fg [job_spec]",`Move job to the foreground.
289
+ Returns success or status of executed command.`]],["fg",["fg [job_spec]",`Move job to the foreground.
290
290
  Place the job identified by JOB_SPEC in the foreground, making it the
291
- current job.`],getopts:["getopts optstring name [arg]",`Parse option arguments.
291
+ current job.`]],["getopts",["getopts optstring name [arg]",`Parse option arguments.
292
292
  Getopts is used by shell procedures to parse positional parameters
293
293
  as options.
294
294
 
@@ -297,10 +297,10 @@ eval: usage: eval [arg ...]
297
297
  which should be separated from it by white space.
298
298
  Exit Status:
299
299
  Returns success if an option is found; fails if the end of options is
300
- encountered or an error occurs.`],hash:["hash [-lr] [-p pathname] [-dt] [name ...]",`Remember or display program locations.
300
+ encountered or an error occurs.`]],["hash",["hash [-lr] [-p pathname] [-dt] [name ...]",`Remember or display program locations.
301
301
  Determine and remember the full pathname of each command NAME.
302
302
  Exit Status:
303
- Returns success unless NAME is not found or an invalid option is given.`],help:["help [-s] [pattern ...]",`Display information about builtin commands.
303
+ Returns success unless NAME is not found or an invalid option is given.`]],["help",["help [-s] [pattern ...]",`Display information about builtin commands.
304
304
  Displays brief summaries of builtin commands. If PATTERN is
305
305
  specified, gives detailed help on all commands matching PATTERN,
306
306
  otherwise the list of help topics is printed.
@@ -310,23 +310,23 @@ eval: usage: eval [arg ...]
310
310
  PATTERN
311
311
 
312
312
  Exit Status:
313
- Returns success unless PATTERN is not found.`],history:["history [-c] [-d offset] [n] or history -anrw [filename] or history -ps arg [arg...]",`Display or manipulate the history list.
313
+ Returns success unless PATTERN is not found.`]],["history",["history [-c] [-d offset] [n] or history -anrw [filename] or history -ps arg [arg...]",`Display or manipulate the history list.
314
314
  Display the history list with line numbers, prefixing each modified
315
315
  entry with a \`*'.
316
316
  Exit Status:
317
- Returns success unless an invalid option is given or an error occurs.`],jobs:["jobs [-lnprs] [jobspec ...] or jobs -x command [args]",`Display status of jobs.
317
+ Returns success unless an invalid option is given or an error occurs.`]],["jobs",["jobs [-lnprs] [jobspec ...] or jobs -x command [args]",`Display status of jobs.
318
318
  Lists the active jobs.
319
319
  Exit Status:
320
- Returns success unless an invalid option is given or an error occurs.`],kill:["kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]",`Send a signal to a job.
320
+ Returns success unless an invalid option is given or an error occurs.`]],["kill",["kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]",`Send a signal to a job.
321
321
  Send the processes identified by PID or JOBSPEC the signal named by
322
322
  SIGSPEC or SIGNUM.
323
323
  Exit Status:
324
- Returns success unless an invalid option is given or an error occurs.`],let:["let arg [arg ...]",`Evaluate arithmetic expressions.
324
+ Returns success unless an invalid option is given or an error occurs.`]],["let",["let arg [arg ...]",`Evaluate arithmetic expressions.
325
325
  Evaluate each ARG as an arithmetic expression. Evaluation is done in
326
326
  fixed-width integers with no check for overflow, though division by 0
327
327
  is trapped and flagged as an error.
328
328
  Exit Status:
329
- If the last ARG evaluates to 0, let returns 1; 0 is returned otherwise.`],local:["local [option] name[=value] ...",`Define local variables.
329
+ If the last ARG evaluates to 0, let returns 1; 0 is returned otherwise.`]],["local",["local [option] name[=value] ...",`Define local variables.
330
330
  Create a local variable called NAME, and give it VALUE. OPTION can
331
331
  be any option accepted by \`declare'.
332
332
 
@@ -334,9 +334,9 @@ eval: usage: eval [arg ...]
334
334
  have a visible scope restricted to that function and its children.
335
335
  Exit Status:
336
336
  Returns success unless an invalid option is supplied, a variable
337
- assignment error occurs, or the shell is not executing a function.`],logout:["logout [n]",`Exit a login shell.
337
+ assignment error occurs, or the shell is not executing a function.`]],["logout",["logout [n]",`Exit a login shell.
338
338
  Exits a login shell with exit status N. Returns an error if not executed
339
- in a login shell.`],mapfile:["mapfile [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]",`Read lines from the standard input into an indexed array variable.
339
+ in a login shell.`]],["mapfile",["mapfile [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]",`Read lines from the standard input into an indexed array variable.
340
340
  Read lines from the standard input into the indexed array variable ARRAY,
341
341
  or from file descriptor FD if the -u option is supplied.
342
342
 
@@ -349,11 +349,11 @@ eval: usage: eval [arg ...]
349
349
  -u fd Read lines from file descriptor FD instead of standard input
350
350
 
351
351
  Exit Status:
352
- Returns success unless an invalid option is given or ARRAY is readonly.`],popd:["popd [-n] [+N | -N]",`Remove directories from stack.
352
+ Returns success unless an invalid option is given or ARRAY is readonly.`]],["popd",["popd [-n] [+N | -N]",`Remove directories from stack.
353
353
  Removes entries from the directory stack.
354
354
  Exit Status:
355
355
  Returns success unless an invalid argument is supplied or the directory
356
- change fails.`],printf:["printf [-v var] format [arguments]",`Formats and prints ARGUMENTS under control of the FORMAT.
356
+ change fails.`]],["printf",["printf [-v var] format [arguments]",`Formats and prints ARGUMENTS under control of the FORMAT.
357
357
 
358
358
  Options:
359
359
  -v var assign the output to shell variable VAR rather than
@@ -366,13 +366,13 @@ eval: usage: eval [arg ...]
366
366
  argument.
367
367
  Exit Status:
368
368
  Returns success unless an invalid option is given or a write or assignment
369
- error occurs.`],pushd:["pushd [-n] [+N | -N | dir]",`Add directories to stack.
369
+ error occurs.`]],["pushd",["pushd [-n] [+N | -N | dir]",`Add directories to stack.
370
370
  Adds a directory to the top of the directory stack, or rotates
371
371
  the stack, making the new top of the stack the current working
372
372
  directory.
373
373
  Exit Status:
374
374
  Returns success unless an invalid argument is supplied or the directory
375
- change fails.`],pwd:["pwd [-LP]",`Print the name of the current working directory.
375
+ change fails.`]],["pwd",["pwd [-LP]",`Print the name of the current working directory.
376
376
 
377
377
  Options:
378
378
  -L print the value of $PWD if it names the current working
@@ -382,7 +382,7 @@ eval: usage: eval [arg ...]
382
382
  By default, \`pwd' behaves as if \`-L' were specified.
383
383
  Exit Status:
384
384
  Returns 0 unless an invalid option is given or the current directory
385
- cannot be read.`],read:["read [-ers] [-a array] [-d delim] [-i text] [-n nchars] [-N nchars] [-p prompt] [-t timeout] [-u fd] [name ...]",`Read a line from the standard input and split it into fields.
385
+ cannot be read.`]],["read",["read [-ers] [-a array] [-d delim] [-i text] [-n nchars] [-N nchars] [-p prompt] [-t timeout] [-u fd] [name ...]",`Read a line from the standard input and split it into fields.
386
386
  Reads a single line from the standard input, or from file descriptor FD
387
387
  if the -u option is supplied. The line is split into fields as with word
388
388
  splitting, and the first word is assigned to the first NAME, the second
@@ -390,16 +390,16 @@ eval: usage: eval [arg ...]
390
390
  the last NAME.
391
391
  Exit Status:
392
392
  The return code is zero, unless end-of-file is encountered, read times out,
393
- or an invalid file descriptor is supplied as the argument to -u.`],readarray:["readarray [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]","Read lines from a file into an array variable.\n A synonym for `mapfile'."],readonly:["readonly [-aAf] [name[=value] ...] or readonly -p",`Mark shell variables as unchangeable.
393
+ or an invalid file descriptor is supplied as the argument to -u.`]],["readarray",["readarray [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]","Read lines from a file into an array variable.\n A synonym for `mapfile'."]],["readonly",["readonly [-aAf] [name[=value] ...] or readonly -p",`Mark shell variables as unchangeable.
394
394
  Mark each NAME as read-only; the values of these NAMEs may not be
395
395
  changed by subsequent assignment.
396
396
  Exit Status:
397
- Returns success unless an invalid option is given or NAME is invalid.`],return:["return [n]",`Return from a shell function.
397
+ Returns success unless an invalid option is given or NAME is invalid.`]],["return",["return [n]",`Return from a shell function.
398
398
  Causes a function or sourced script to exit with the return value
399
399
  specified by N. If N is omitted, the return status is that of the
400
400
  last command executed within the function or script.
401
401
  Exit Status:
402
- Returns N, or failure if the shell is not executing a function or script.`],set:["set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]",`Set or unset values of shell options and positional parameters.
402
+ Returns N, or failure if the shell is not executing a function or script.`]],["set",["set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]",`Set or unset values of shell options and positional parameters.
403
403
  Change the value of shell attributes and positional parameters, or
404
404
  display the names and values of shell variables.
405
405
 
@@ -411,11 +411,11 @@ eval: usage: eval [arg ...]
411
411
  Set the variable corresponding to option-name
412
412
 
413
413
  Exit Status:
414
- Returns success unless an invalid option is given.`],shift:["shift [n]",`Shift positional parameters.
414
+ Returns success unless an invalid option is given.`]],["shift",["shift [n]",`Shift positional parameters.
415
415
  Rename the positional parameters $N+1,$N+2 ... to $1,$2 ... If N is
416
416
  not given, it is assumed to be 1.
417
417
  Exit Status:
418
- Returns success unless N is negative or greater than $#.`],shopt:["shopt [-pqsu] [-o] [optname ...]",`Set and unset shell options.
418
+ Returns success unless N is negative or greater than $#.`]],["shopt",["shopt [-pqsu] [-o] [optname ...]",`Set and unset shell options.
419
419
  Change the setting of each shell option OPTNAME. Without any option
420
420
  arguments, list each supplied OPTNAME, or all shell options if no
421
421
  OPTNAMEs are given, with an indication of whether or not each is set.
@@ -429,27 +429,27 @@ eval: usage: eval [arg ...]
429
429
 
430
430
  Exit Status:
431
431
  Returns success if OPTNAME is enabled; fails if an invalid option is
432
- given or OPTNAME is disabled.`],source:["source filename [arguments]",`Execute commands from a file in the current shell.
432
+ given or OPTNAME is disabled.`]],["source",["source filename [arguments]",`Execute commands from a file in the current shell.
433
433
  Read and execute commands from FILENAME in the current shell.
434
434
  The entries in $PATH are used to find the directory containing FILENAME.
435
435
  Exit Status:
436
- Returns the status of the last command executed in FILENAME.`],suspend:["suspend [-f]",`Suspend shell execution.
437
- Suspend the execution of this shell until it receives a SIGCONT signal.`],test:["test [expr]",`Evaluate conditional expression.
436
+ Returns the status of the last command executed in FILENAME.`]],["suspend",["suspend [-f]",`Suspend shell execution.
437
+ Suspend the execution of this shell until it receives a SIGCONT signal.`]],["test",["test [expr]",`Evaluate conditional expression.
438
438
  Exits with a status of 0 (true) or 1 (false) depending on
439
439
  the evaluation of EXPR. Expressions may be unary or binary.
440
440
  Exit Status:
441
441
  Returns success if EXPR evaluates to true; fails if EXPR evaluates to
442
- false or an invalid argument is given.`],times:["times",`Display process times.
442
+ false or an invalid argument is given.`]],["times",["times",`Display process times.
443
443
  Prints the accumulated user and system times for the shell and all of its
444
444
  child processes.
445
445
  Exit Status:
446
- Always succeeds.`],trap:["trap [-lp] [[arg] signal_spec ...]",`Trap signals and other events.
446
+ Always succeeds.`]],["trap",["trap [-lp] [[arg] signal_spec ...]",`Trap signals and other events.
447
447
  Defines and activates handlers to be run when the shell receives signals
448
448
  or other conditions.
449
449
  Exit Status:
450
- Returns success unless a SIGSPEC is invalid or an invalid option is given.`],true:["true",`Return a successful result.
450
+ Returns success unless a SIGSPEC is invalid or an invalid option is given.`]],["true",["true",`Return a successful result.
451
451
  Exit Status:
452
- Always succeeds.`],type:["type [-afptP] name [name ...]",`Display information about command type.
452
+ Always succeeds.`]],["type",["type [-afptP] name [name ...]",`Display information about command type.
453
453
  For each NAME, indicate how it would be interpreted if used as a
454
454
  command name.
455
455
 
@@ -467,17 +467,17 @@ eval: usage: eval [arg ...]
467
467
  or not found, respectively
468
468
 
469
469
  Exit Status:
470
- Returns success if all of the NAMEs are found; fails if any are not found.`],typeset:["typeset [-aAfFgilnrtux] [-p] name[=value] ...","Set variable values and attributes.\n A synonym for `declare'."],ulimit:["ulimit [-SHabcdefiklmnpqrstuvxPT] [limit]",`Modify shell resource limits.
470
+ Returns success if all of the NAMEs are found; fails if any are not found.`]],["typeset",["typeset [-aAfFgilnrtux] [-p] name[=value] ...","Set variable values and attributes.\n A synonym for `declare'."]],["ulimit",["ulimit [-SHabcdefiklmnpqrstuvxPT] [limit]",`Modify shell resource limits.
471
471
  Provides control over the resources available to the shell and processes
472
472
  it creates, on systems that allow such control.
473
473
  Exit Status:
474
- Returns success unless an invalid option is supplied or an error occurs.`],umask:["umask [-p] [-S] [mode]",`Display or set file mode mask.
474
+ Returns success unless an invalid option is supplied or an error occurs.`]],["umask",["umask [-p] [-S] [mode]",`Display or set file mode mask.
475
475
  Sets the user file-creation mask to MODE. If MODE is omitted, prints
476
476
  the current value of the mask.
477
477
  Exit Status:
478
- Returns success unless MODE is invalid or an invalid option is given.`],unalias:["unalias [-a] name [name ...]",`Remove each NAME from the list of defined aliases.
478
+ Returns success unless MODE is invalid or an invalid option is given.`]],["unalias",["unalias [-a] name [name ...]",`Remove each NAME from the list of defined aliases.
479
479
  Exit Status:
480
- Returns success unless a NAME is not an existing alias.`],unset:["unset [-f] [-v] [-n] [name ...]",`Unset values and attributes of shell variables and functions.
480
+ Returns success unless a NAME is not an existing alias.`]],["unset",["unset [-f] [-v] [-n] [name ...]",`Unset values and attributes of shell variables and functions.
481
481
  For each NAME, remove the corresponding variable or function.
482
482
 
483
483
  Options:
@@ -489,16 +489,16 @@ eval: usage: eval [arg ...]
489
489
  Without options, unset first tries to unset a variable, and if that fails,
490
490
  tries to unset a function.
491
491
  Exit Status:
492
- Returns success unless an invalid option is given or a NAME is read-only.`],wait:["wait [-fn] [id ...]",`Wait for job completion and return exit status.
492
+ Returns success unless an invalid option is given or a NAME is read-only.`]],["wait",["wait [-fn] [id ...]",`Wait for job completion and return exit status.
493
493
  Waits for each process identified by an ID, which may be a process ID or a
494
494
  job specification, and reports its termination status.
495
495
  Exit Status:
496
496
  Returns the status of the last ID; fails if ID is invalid or an invalid
497
- option is given.`]},Yn=Object.keys(Kn).sort();function ks(e,t){let s=!1,n=[],r=0;for(;r<t.length;){let c=t[r];if(c==="--"){for(r++;r<t.length;)n.push(t[r]),r++;break}if(c.startsWith("-")&&c.length>1){for(let l=1;l<c.length;l++){let f=c[l];if(f==="s")s=!0;else return S(`bash: help: -${f}: invalid option
497
+ option is given.`]]]),Yn=[...Kn.keys()].sort();function ks(e,t){let s=!1,n=[],r=0;for(;r<t.length;){let c=t[r];if(c==="--"){for(r++;r<t.length;)n.push(t[r]),r++;break}if(c.startsWith("-")&&c.length>1){for(let l=1;l<c.length;l++){let f=c[l];if(f==="s")s=!0;else return S(`bash: help: -${f}: invalid option
498
498
  `,2)}r++}else n.push(c),r++}if(n.length===0)return Fi();let i="",a=!1,o="";for(let c of n){let l=Li(c);if(l.length===0){o+=`bash: help: no help topics match \`${c}'. Try \`help help' or \`man -k ${c}' or \`info ${c}'.
499
- `,a=!0;continue}for(let f of l){let[u,d]=Kn[f];s?i+=`${f}: ${u}
500
- `:i+=`${f}: ${u}
501
- ${d}
499
+ `,a=!0;continue}for(let f of l){let u=Kn.get(f);if(!u)continue;let[d,h]=u;s?i+=`${f}: ${d}
500
+ `:i+=`${f}: ${d}
501
+ ${h}
502
502
  `}}return{exitCode:a?1:0,stdout:i,stderr:o}}function Li(e){let t=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,"."),s=Ke(`^${t}$`);return Yn.filter(n=>s.test(n))}function Fi(){let e=[];e.push("just-bash shell builtins"),e.push("These shell commands are defined internally. Type `help' to see this list."),e.push("Type `help name' to find out more about the function `name'."),e.push("");let t=36,s=Yn.slice(),n=Math.ceil(s.length/2);for(let r=0;r<n;r++){let i=s[r]||"",a=s[r+n]||"",o=i.padEnd(t);e.push(a?`${o}${a}`:i)}return F(`${e.join(`
503
503
  `)}
504
504
  `)}function Mi(e){let t=[],s="",n=0;for(let r of e){for(let i of r)i==="("?n++:i===")"&&n--;s?s+=` ${r}`:s=r,n===0&&(t.push(s),s="")}return s&&t.push(s),t}async function Os(e,t){if(t.length===0)return S(`bash: let: expression expected
@@ -646,7 +646,7 @@ sys 0m0.000s
646
646
  `,1)}}if(r=Math.max(...i.map(([o])=>typeof o=="number"?o:0))+1+r,r<0){let o=e.state.currentLine;return{index:0,error:P("",`bash: line ${o}: ${t}[${s}]: bad array subscript
647
647
  `,1)}}}return{index:r}}async function ca(e,t,s,n,r,i){let a="",o=s,c=null;if(oe(e,s)){let u=sn(e,s,n);if(u===void 0)return{continueToNext:!1,xtraceOutput:"",error:P("",`bash: ${s}: circular name reference
648
648
  `,1)};if(u===null)return{continueToNext:!0,xtraceOutput:""};o=u;let d=o.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);d&&(c={arrayName:d[1],subscriptExpr:d[2]},o=d[1])}if(Te(e,o)){if(t.name)return a+=`bash: ${o}: readonly variable
649
- `,{continueToNext:!0,xtraceOutput:a};let u=K(e,o);if(u)return{continueToNext:!1,xtraceOutput:"",error:u}}let l;if(et(e,o))try{let u=new W;if(r){let h=`(${e.state.env.get(o)||"0"}) + (${n})`,m=Z(u,h);l=String(await V(e,m.expression))}else{let d=Z(u,n);l=String(await V(e,d.expression))}}catch{l="0"}else{let{isArray:u}=await import("./chunks/expansion-OP223NMV.js"),d=u(e,o)?`${o}_0`:o;l=r?(e.state.env.get(d)||"")+n:n}l=Be(e,o,l),a+=await Cr(e,o,l);let f=o;if(c)f=await fa(e,c);else{let{isArray:u}=await import("./chunks/expansion-OP223NMV.js");u(e,o)&&(f=`${o}_0`)}return t.name?(i.set(f,e.state.env.get(f)),e.state.env.set(f,l)):(e.state.env.set(f,l),e.state.options.allexport&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(o)),e.state.tempEnvBindings?.some(u=>u.has(o))&&(e.state.mutatedTempEnvVars=e.state.mutatedTempEnvVars||new Set,e.state.mutatedTempEnvVars.add(o))),{continueToNext:!1,xtraceOutput:a}}async function fa(e,t){let{arrayName:s,subscriptExpr:n}=t;if(e.state.associativeArrays?.has(s))return Or(e,s,n);let i;if(/^-?\d+$/.test(n))i=Number.parseInt(n,10);else{try{let a=new W,o=Z(a,n);i=await V(e,o.expression,!1)}catch{let a=e.state.env.get(n);i=a?Number.parseInt(a,10):0}Number.isNaN(i)&&(i=0)}if(i<0){let a=fe(e,s);a.length>0&&(i=Math.max(...a.map(c=>c[0]))+1+i)}return`${s}_${i}`}async function Dr(e,t,s,n){let r=await ge(e,t.redirections);if(r)return r;let i=new Map(e.state.env),a=e.state.cwd,o={...e.state.options},c=e.state.localScopes,l=e.state.localVarStack,f=e.state.localVarDepth,u=e.state.fullyUnsetLocals;if(e.state.localScopes=c.map(E=>new Map(E)),l){e.state.localVarStack=new Map;for(let[E,_]of l.entries())e.state.localVarStack.set(E,_.map(O=>({...O})))}f&&(e.state.localVarDepth=new Map(f)),u&&(e.state.fullyUnsetLocals=new Map(u));let d=e.state.loopDepth,h=e.state.parentHasLoopContext;e.state.parentHasLoopContext=d>0,e.state.loopDepth=0;let m=e.state.lastArg,p=e.state.bashPid;e.state.bashPid=e.state.nextVirtualPid++;let g=e.state.groupStdin;s&&(e.state.groupStdin=s);let v="",$="",N=0,y=()=>{e.state.env=i,e.state.cwd=a,e.state.options=o,e.state.localScopes=c,e.state.localVarStack=l,e.state.localVarDepth=f,e.state.fullyUnsetLocals=u,e.state.loopDepth=d,e.state.parentHasLoopContext=h,e.state.groupStdin=g,e.state.bashPid=p,e.state.lastArg=m};try{for(let E of t.body){let _=await n(E);v+=_.stdout,$+=_.stderr,N=_.exitCode}}catch(E){if(y(),E instanceof ee)throw E;if(E instanceof Pe){v+=E.stdout,$+=E.stderr;let O=P(v,$,0);return H(e,O,t.redirections)}if(E instanceof re||E instanceof ie){v+=E.stdout,$+=E.stderr;let O=P(v,$,0);return H(e,O,t.redirections)}if(E instanceof z){v+=E.stdout,$+=E.stderr;let O=P(v,$,E.exitCode);return H(e,O,t.redirections)}if(E instanceof te){v+=E.stdout,$+=E.stderr;let O=P(v,$,E.exitCode);return H(e,O,t.redirections)}if(E instanceof ae){let O=P(v+E.stdout,$+E.stderr,E.exitCode);return H(e,O,t.redirections)}let _=P(v,`${$}${ve(E)}
649
+ `,{continueToNext:!0,xtraceOutput:a};let u=K(e,o);if(u)return{continueToNext:!1,xtraceOutput:"",error:u}}let l;if(et(e,o))try{let u=new W;if(r){let h=`(${e.state.env.get(o)||"0"}) + (${n})`,m=Z(u,h);l=String(await V(e,m.expression))}else{let d=Z(u,n);l=String(await V(e,d.expression))}}catch{l="0"}else{let{isArray:u}=await import("./chunks/expansion-6T6M7TZI.js"),d=u(e,o)?`${o}_0`:o;l=r?(e.state.env.get(d)||"")+n:n}l=Be(e,o,l),a+=await Cr(e,o,l);let f=o;if(c)f=await fa(e,c);else{let{isArray:u}=await import("./chunks/expansion-6T6M7TZI.js");u(e,o)&&(f=`${o}_0`)}return t.name?(i.set(f,e.state.env.get(f)),e.state.env.set(f,l)):(e.state.env.set(f,l),e.state.options.allexport&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(o)),e.state.tempEnvBindings?.some(u=>u.has(o))&&(e.state.mutatedTempEnvVars=e.state.mutatedTempEnvVars||new Set,e.state.mutatedTempEnvVars.add(o))),{continueToNext:!1,xtraceOutput:a}}async function fa(e,t){let{arrayName:s,subscriptExpr:n}=t;if(e.state.associativeArrays?.has(s))return Or(e,s,n);let i;if(/^-?\d+$/.test(n))i=Number.parseInt(n,10);else{try{let a=new W,o=Z(a,n);i=await V(e,o.expression,!1)}catch{let a=e.state.env.get(n);i=a?Number.parseInt(a,10):0}Number.isNaN(i)&&(i=0)}if(i<0){let a=fe(e,s);a.length>0&&(i=Math.max(...a.map(c=>c[0]))+1+i)}return`${s}_${i}`}async function Dr(e,t,s,n){let r=await ge(e,t.redirections);if(r)return r;let i=new Map(e.state.env),a=e.state.cwd,o={...e.state.options},c=e.state.localScopes,l=e.state.localVarStack,f=e.state.localVarDepth,u=e.state.fullyUnsetLocals;if(e.state.localScopes=c.map(E=>new Map(E)),l){e.state.localVarStack=new Map;for(let[E,_]of l.entries())e.state.localVarStack.set(E,_.map(O=>({...O})))}f&&(e.state.localVarDepth=new Map(f)),u&&(e.state.fullyUnsetLocals=new Map(u));let d=e.state.loopDepth,h=e.state.parentHasLoopContext;e.state.parentHasLoopContext=d>0,e.state.loopDepth=0;let m=e.state.lastArg,p=e.state.bashPid;e.state.bashPid=e.state.nextVirtualPid++;let g=e.state.groupStdin;s&&(e.state.groupStdin=s);let v="",$="",N=0,y=()=>{e.state.env=i,e.state.cwd=a,e.state.options=o,e.state.localScopes=c,e.state.localVarStack=l,e.state.localVarDepth=f,e.state.fullyUnsetLocals=u,e.state.loopDepth=d,e.state.parentHasLoopContext=h,e.state.groupStdin=g,e.state.bashPid=p,e.state.lastArg=m};try{for(let E of t.body){let _=await n(E);v+=_.stdout,$+=_.stderr,N=_.exitCode}}catch(E){if(y(),E instanceof ee)throw E;if(E instanceof Pe){v+=E.stdout,$+=E.stderr;let O=P(v,$,0);return H(e,O,t.redirections)}if(E instanceof re||E instanceof ie){v+=E.stdout,$+=E.stderr;let O=P(v,$,0);return H(e,O,t.redirections)}if(E instanceof z){v+=E.stdout,$+=E.stderr;let O=P(v,$,E.exitCode);return H(e,O,t.redirections)}if(E instanceof te){v+=E.stdout,$+=E.stderr;let O=P(v,$,E.exitCode);return H(e,O,t.redirections)}if(E instanceof ae){let O=P(v+E.stdout,$+E.stderr,E.exitCode);return H(e,O,t.redirections)}let _=P(v,`${$}${ve(E)}
650
650
  `,1);return H(e,_,t.redirections)}y();let w=P(v,$,N);return H(e,w,t.redirections)}async function Tr(e,t,s,n){let r="",i="",a=0,o=await kt(e,t.redirections);if(o)return o;let c=s;for(let u of t.redirections)if((u.operator==="<<"||u.operator==="<<-")&&u.target.type==="HereDoc"){let d=u.target,h=await I(e,d.content);d.stripTabs&&(h=h.split(`
651
651
  `).map(p=>p.replace(/^\t+/,"")).join(`
652
652
  `));let m=u.fd??0;m!==0?(e.state.fileDescriptors||(e.state.fileDescriptors=new Map),e.state.fileDescriptors.set(m,h)):c=h}else if(u.operator==="<<<"&&u.target.type==="Word")c=`${await I(e,u.target)}
@@ -14,4 +14,4 @@ export interface AwkEvaluator {
14
14
  }
15
15
  export type AwkBuiltinFn = (args: AwkExpr[], ctx: AwkRuntimeContext, evaluator: AwkEvaluator) => AwkValue | Promise<AwkValue>;
16
16
  export declare function formatPrintf(format: string, values: AwkValue[]): string;
17
- export declare const awkBuiltins: Record<string, AwkBuiltinFn>;
17
+ export declare const awkBuiltins: Map<string, AwkBuiltinFn>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "just-bash",
3
- "version": "2.8.0",
3
+ "version": "2.8.1",
4
4
  "description": "A simulated bash environment with virtual filesystem",
5
5
  "repository": {
6
6
  "type": "git",
@@ -93,9 +93,10 @@
93
93
  "build:browser": "esbuild dist/browser.js --bundle --platform=browser --format=esm --minify --outfile=dist/bundle/browser.js --external:diff --external:minimatch --external:sprintf-js --external:turndown --external:node:* --external:@mongodb-js/zstd --external:node-liblzma --external:compressjs --define:__BROWSER__=true",
94
94
  "build:cli": "esbuild dist/cli/just-bash.js --bundle --splitting --platform=node --format=esm --minify --outdir=dist/bin --entry-names=[name] --chunk-names=chunks/[name]-[hash] --banner:js='#!/usr/bin/env node' --external:sql.js --external:pyodide --external:@mongodb-js/zstd --external:node-liblzma --external:compressjs",
95
95
  "build:shell": "esbuild dist/cli/shell.js --bundle --splitting --platform=node --format=esm --minify --outdir=dist/bin/shell --entry-names=[name] --chunk-names=chunks/[name]-[hash] --banner:js='#!/usr/bin/env node' --external:sql.js --external:pyodide --external:@mongodb-js/zstd --external:node-liblzma --external:compressjs",
96
- "validate": "pnpm lint && pnpm knip && pnpm typecheck && pnpm build && pnpm test:run && pnpm test:dist",
96
+ "validate": "pnpm lint && pnpm lint:record && pnpm knip && pnpm typecheck && pnpm build && pnpm test:run && pnpm test:dist",
97
97
  "typecheck": "tsc --noEmit",
98
98
  "lint": "biome check .",
99
+ "lint:record": "node scripts/check-banned-patterns.js",
99
100
  "lint:fix": "biome check --write .",
100
101
  "knip": "knip",
101
102
  "test": "vitest",