just-bash 2.12.5 → 2.12.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/banned-patterns-test.d.ts +0 -7
- package/dist/bin/chunks/{awk2-4MK3F3NZ.js → awk2-EB5SCHVW.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-ZRRNCS7N.js → chunks/chunk-5MUD3WB2.js} +1 -1
- package/dist/bin/chunks/{chunk-EMSJEY2U.js → chunk-BBRVF6XE.js} +1 -1
- package/dist/bin/chunks/chunk-DHFZMFUW.js +36 -0
- package/dist/bin/{shell/chunks/chunk-5ATRLST6.js → chunks/chunk-IRCLOW32.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-UT6LUTWP.js → chunks/chunk-JX6YLHDX.js} +1 -1
- package/dist/bin/chunks/chunk-NTKUVXEL.js +5 -0
- package/dist/bin/chunks/{chunk-RDGXTKIB.js → chunk-OLN6BSO3.js} +1 -1
- package/dist/bin/chunks/chunk-PIBXJ3VX.js +13 -0
- package/dist/bin/chunks/chunk-PLKGKTIS.js +6 -0
- package/dist/bin/{shell/chunks/chunk-WWVVJW3F.js → chunks/chunk-QTII62YM.js} +1 -1
- package/dist/bin/chunks/{chunk-RS2PRILS.js → chunk-ROMKUVHI.js} +1 -1
- package/dist/bin/chunks/{chunk-2HDH5VPF.js → chunk-VCKKRS7V.js} +1 -1
- package/dist/bin/chunks/chunk-ZJGIBTWD.js +2 -0
- package/dist/bin/{shell/chunks/chunk-6W7JTG6A.js → chunks/chunk-ZNPXCE5B.js} +99 -99
- package/dist/bin/{shell/chunks/curl-GIQ5S66Y.js → chunks/curl-3GMIPMCI.js} +1 -1
- package/dist/bin/{shell/chunks/flag-coverage-NDF6MQAO.js → chunks/flag-coverage-7GOZYXJT.js} +1 -1
- package/dist/bin/{shell/chunks/jq-F7FJ46VM.js → chunks/jq-P457LMHU.js} +1 -1
- package/dist/bin/chunks/{python3-QBGIYRFR.js → python3-45TMCI4M.js} +7 -7
- package/dist/bin/{shell/chunks/sed-ENUQOCBB.js → chunks/sed-UV2LTNVK.js} +1 -1
- package/dist/bin/chunks/sleep-3WHM7JMW.js +2 -0
- package/dist/bin/{shell/chunks/sqlite3-4SBQACEE.js → chunks/sqlite3-B3P3OMPI.js} +1 -1
- package/dist/bin/chunks/tar-SO3XDDIW.js +2 -0
- package/dist/bin/chunks/timeout-BYB3L2JA.js +2 -0
- package/dist/bin/chunks/worker.js +155 -14
- package/dist/bin/chunks/xan-FZB7FHX3.js +2 -0
- package/dist/bin/chunks/yq-H7D2U3HS.js +2 -0
- package/dist/bin/just-bash.js +1 -1
- package/dist/bin/shell/chunks/{awk2-4MK3F3NZ.js → awk2-EB5SCHVW.js} +1 -1
- package/dist/bin/{chunks/chunk-ZRRNCS7N.js → shell/chunks/chunk-5MUD3WB2.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-EMSJEY2U.js → chunk-BBRVF6XE.js} +1 -1
- package/dist/bin/shell/chunks/chunk-DHFZMFUW.js +36 -0
- package/dist/bin/{chunks/chunk-5ATRLST6.js → shell/chunks/chunk-IRCLOW32.js} +1 -1
- package/dist/bin/{chunks/chunk-UT6LUTWP.js → shell/chunks/chunk-JX6YLHDX.js} +1 -1
- package/dist/bin/shell/chunks/chunk-NTKUVXEL.js +5 -0
- package/dist/bin/shell/chunks/{chunk-RDGXTKIB.js → chunk-OLN6BSO3.js} +1 -1
- package/dist/bin/shell/chunks/chunk-PIBXJ3VX.js +13 -0
- package/dist/bin/shell/chunks/chunk-PLKGKTIS.js +6 -0
- package/dist/bin/{chunks/chunk-WWVVJW3F.js → shell/chunks/chunk-QTII62YM.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-RS2PRILS.js → chunk-ROMKUVHI.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-2HDH5VPF.js → chunk-VCKKRS7V.js} +1 -1
- package/dist/bin/shell/chunks/chunk-ZJGIBTWD.js +2 -0
- package/dist/bin/{chunks/chunk-6W7JTG6A.js → shell/chunks/chunk-ZNPXCE5B.js} +99 -99
- package/dist/bin/{chunks/curl-GIQ5S66Y.js → shell/chunks/curl-3GMIPMCI.js} +1 -1
- package/dist/bin/{chunks/flag-coverage-NDF6MQAO.js → shell/chunks/flag-coverage-7GOZYXJT.js} +1 -1
- package/dist/bin/{chunks/jq-F7FJ46VM.js → shell/chunks/jq-P457LMHU.js} +1 -1
- package/dist/bin/shell/chunks/{python3-XN7O5X3A.js → python3-IV3DBMHM.js} +7 -7
- package/dist/bin/{chunks/sed-ENUQOCBB.js → shell/chunks/sed-UV2LTNVK.js} +1 -1
- package/dist/bin/shell/chunks/sleep-3WHM7JMW.js +2 -0
- package/dist/bin/{chunks/sqlite3-4SBQACEE.js → shell/chunks/sqlite3-B3P3OMPI.js} +1 -1
- package/dist/bin/shell/chunks/tar-SO3XDDIW.js +2 -0
- package/dist/bin/shell/chunks/timeout-BYB3L2JA.js +2 -0
- package/dist/bin/shell/chunks/xan-FZB7FHX3.js +2 -0
- package/dist/bin/shell/chunks/yq-H7D2U3HS.js +2 -0
- package/dist/bin/shell/shell.js +1 -1
- package/dist/bundle/browser.js +503 -503
- package/dist/bundle/chunks/{awk2-ID6QVUYU.js → awk2-VPBKDCSO.js} +1 -1
- package/dist/bundle/chunks/{chunk-CBAJ47B3.js → chunk-4YPFHVJJ.js} +1 -1
- package/dist/bundle/chunks/{chunk-3ZBKQKTX.js → chunk-6HBBXB3L.js} +1 -1
- package/dist/bundle/chunks/chunk-72EQZSVH.js +4 -0
- package/dist/bundle/chunks/{chunk-SJ5LXPUH.js → chunk-7YDOWJ75.js} +1 -1
- package/dist/bundle/chunks/chunk-AUD37QB3.js +35 -0
- package/dist/bundle/chunks/{chunk-TVHAURH5.js → chunk-BED5HSP2.js} +1 -1
- package/dist/bundle/chunks/{chunk-3J4BCKUH.js → chunk-C7ZTXK5C.js} +99 -99
- package/dist/bundle/chunks/chunk-DZZS6SJP.js +1 -0
- package/dist/bundle/chunks/chunk-KZ7BI7TV.js +5 -0
- package/dist/bundle/chunks/chunk-U5FWK6IA.js +12 -0
- package/dist/bundle/chunks/{chunk-HOFSUCIB.js → chunk-VBF2GWEM.js} +1 -1
- package/dist/bundle/chunks/{chunk-AYQ5FKKK.js → chunk-VSWTMNI3.js} +1 -1
- package/dist/bundle/chunks/{chunk-L75XCEQX.js → chunk-X36DXRVC.js} +1 -1
- package/dist/bundle/chunks/{chunk-2OZNLYX4.js → chunk-X3CVFNQZ.js} +1 -1
- package/dist/bundle/chunks/{curl-743M564K.js → curl-KM2ZAUR6.js} +1 -1
- package/dist/bundle/chunks/{flag-coverage-4M54QHNZ.js → flag-coverage-NT32EG6Q.js} +1 -1
- package/dist/bundle/chunks/{jq-5FRYP6YP.js → jq-NLRWI2Q6.js} +1 -1
- package/dist/bundle/chunks/{python3-WANWDR22.js → python3-G2ZUJAQL.js} +7 -7
- package/dist/bundle/chunks/{sed-TS7M7I25.js → sed-2BILOGNL.js} +1 -1
- package/dist/bundle/chunks/sleep-IUBP5GMH.js +1 -0
- package/dist/bundle/chunks/{sqlite3-IH5QMEIK.js → sqlite3-VEDNWJL6.js} +1 -1
- package/dist/bundle/chunks/tar-LKO7DKAK.js +1 -0
- package/dist/bundle/chunks/timeout-TL4Q5YKZ.js +1 -0
- package/dist/bundle/chunks/worker.js +155 -14
- package/dist/bundle/chunks/xan-KSDYKKEK.js +1 -0
- package/dist/bundle/chunks/yq-HIQ4WMDY.js +1 -0
- package/dist/bundle/index.cjs +717 -717
- package/dist/bundle/index.js +1 -1
- package/dist/commands/python3/worker.d.ts +1 -0
- package/dist/commands/query-engine/safe-object.d.ts +13 -0
- package/dist/commands/sqlite3/worker.d.ts +1 -0
- package/package.json +34 -34
- package/vendor/cpython-emscripten/python.wasm +0 -0
- package/dist/bin/chunks/chunk-DERQIX2O.js +0 -36
- package/dist/bin/chunks/chunk-LWKIHJ5L.js +0 -13
- package/dist/bin/chunks/chunk-Q5MYEU7X.js +0 -5
- package/dist/bin/chunks/chunk-UYBH3FNE.js +0 -2
- package/dist/bin/chunks/chunk-W752QGNZ.js +0 -6
- package/dist/bin/chunks/sleep-5T34UFNF.js +0 -2
- package/dist/bin/chunks/tar-3UIZ4IRM.js +0 -2
- package/dist/bin/chunks/timeout-7ECKKPNP.js +0 -2
- package/dist/bin/chunks/xan-5QTBTP4U.js +0 -2
- package/dist/bin/chunks/yq-O5RSLLA3.js +0 -2
- package/dist/bin/shell/chunks/chunk-DERQIX2O.js +0 -36
- package/dist/bin/shell/chunks/chunk-LWKIHJ5L.js +0 -13
- package/dist/bin/shell/chunks/chunk-Q5MYEU7X.js +0 -5
- package/dist/bin/shell/chunks/chunk-UYBH3FNE.js +0 -2
- package/dist/bin/shell/chunks/chunk-W752QGNZ.js +0 -6
- package/dist/bin/shell/chunks/sleep-5T34UFNF.js +0 -2
- package/dist/bin/shell/chunks/tar-3UIZ4IRM.js +0 -2
- package/dist/bin/shell/chunks/timeout-7ECKKPNP.js +0 -2
- package/dist/bin/shell/chunks/xan-5QTBTP4U.js +0 -2
- package/dist/bin/shell/chunks/yq-O5RSLLA3.js +0 -2
- package/dist/bundle/chunks/chunk-7MKBHGLS.js +0 -1
- package/dist/bundle/chunks/chunk-C764MECG.js +0 -35
- package/dist/bundle/chunks/chunk-FD7SFJNJ.js +0 -4
- package/dist/bundle/chunks/chunk-QI4EPYAT.js +0 -5
- package/dist/bundle/chunks/chunk-R5XRHEZH.js +0 -12
- package/dist/bundle/chunks/sleep-RRZXXEW2.js +0 -1
- package/dist/bundle/chunks/tar-JCULQ5J2.js +0 -1
- package/dist/bundle/chunks/timeout-DNGO7OHT.js +0 -1
- package/dist/bundle/chunks/xan-LAW2EMOM.js +0 -1
- package/dist/bundle/chunks/yq-MFJEXB7R.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
2
|
+
import{f as w}from"./chunk-ZJGIBTWD.js";import{a as b}from"./chunk-4VDEBYW7.js";import{a as y,b as T,c as d}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";function f(s){let t=s.indexOf("=");if(t>=0){let a=s.slice(0,t),r=s.slice(t+1);return a?`${encodeURIComponent(a)}=${encodeURIComponent(r)}`:encodeURIComponent(r)}return encodeURIComponent(s)}function c(s){let t=s.indexOf("=");if(t<0)return null;let a=s.slice(0,t),r=s.slice(t+1),e,i,o=r.match(/;type=([^;]+)$/);o&&(i=o[1],r=r.slice(0,-o[0].length));let n=r.match(/;filename=([^;]+)/);return n&&(e=n[1],r=r.replace(n[0],"")),(r.startsWith("@")||r.startsWith("<"))&&(e=e??r.slice(1).split("/").pop()),{name:a,value:r,filename:e,contentType:i}}function O(s,t){let a=`----CurlFormBoundary${Date.now().toString(36)}`,r=[];for(let e of s){let i=e.value;if(i.startsWith("@")||i.startsWith("<")){let n=i.slice(1);i=t.get(n)??""}let o=`--${a}\r
|
|
3
3
|
`;e.filename?(o+=`Content-Disposition: form-data; name="${e.name}"; filename="${e.filename}"\r
|
|
4
4
|
`,e.contentType&&(o+=`Content-Type: ${e.contentType}\r
|
|
5
5
|
`)):o+=`Content-Disposition: form-data; name="${e.name}"\r
|
package/dist/bin/{chunks/flag-coverage-NDF6MQAO.js → shell/chunks/flag-coverage-7GOZYXJT.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{b as yr}from"./chunk-
|
|
2
|
+
import{b as yr}from"./chunk-QTII62YM.js";import{b as Ar}from"./chunk-ZNPXCE5B.js";import{b as $r}from"./chunk-BBRVF6XE.js";import"./chunk-GZHFXDDO.js";import"./chunk-QSDVMMYI.js";import{c as Sr}from"./chunk-DHFZMFUW.js";import{b as wr}from"./chunk-XKPFI566.js";import{b as xr}from"./chunk-2BC3N3L2.js";import{b as vr}from"./chunk-IDGH4PGU.js";import{b as kr}from"./chunk-F3LGZXLQ.js";import{b as qr}from"./chunk-BYDV4VEF.js";import{b as Cr}from"./chunk-JLX6YWGA.js";import{b as br}from"./chunk-FLPVVSN5.js";import{d as Ir,e as Mr,f as jr}from"./chunk-54G6AE72.js";import{b as tr}from"./chunk-VCKKRS7V.js";import{b as lr}from"./chunk-VIYJJTN2.js";import{b as ur}from"./chunk-THALLNXT.js";import{b as pr}from"./chunk-EZS766DD.js";import{b as er}from"./chunk-3Y32LPNT.js";import{b as dr}from"./chunk-7BORMNPQ.js";import{b as cr}from"./chunk-N43DJTSI.js";import"./chunk-OBI37ZY4.js";import{b as hr}from"./chunk-N5OTVT4F.js";import{c as or,d as ar}from"./chunk-MAVV76T4.js";import{b as sr}from"./chunk-JTF74J6E.js";import{c as ir,d as gr}from"./chunk-GO6FXSC4.js";import{b as mr}from"./chunk-PIBXJ3VX.js";import"./chunk-PLKGKTIS.js";import"./chunk-ZJGIBTWD.js";import{b as Fr}from"./chunk-GOJZHH3L.js";import{b as zr}from"./chunk-P6GNZPVW.js";import{b as fr}from"./chunk-LOJMXC4F.js";import{b as nr}from"./chunk-ROMKUVHI.js";import"./chunk-YTIURC67.js";import{b as R}from"./chunk-PQNTKMH3.js";import{b as U}from"./chunk-PPBQJBC2.js";import{b as V}from"./chunk-NSUMEERA.js";import{b as W}from"./chunk-XY5HGZW5.js";import{c as X,d as Y}from"./chunk-N4EU64Y4.js";import{c as Z,d as _}from"./chunk-3MBAUIBB.js";import{b as N}from"./chunk-RT7TRQVZ.js";import{b as rr}from"./chunk-47HZU3SY.js";import{b as G}from"./chunk-RJSAGJQJ.js";import{b as H}from"./chunk-YEKSVVRC.js";import{b as J}from"./chunk-26NO42TF.js";import{b as K}from"./chunk-LGJM5YFT.js";import{b as L}from"./chunk-LMK6G2HH.js";import{b as O}from"./chunk-ZKC5HQYO.js";import{b as P}from"./chunk-ROJPSS6N.js";import{b as Q}from"./chunk-STOAUD75.js";import{b as y}from"./chunk-CGE2EHYP.js";import{b as A}from"./chunk-ZA4HUKJ3.js";import{b as $}from"./chunk-WWZVR5NN.js";import{b as S}from"./chunk-JQBC3FXE.js";import{b as T}from"./chunk-SYL34GE7.js";import{b as B}from"./chunk-5G2VOPPJ.js";import{b as D}from"./chunk-SGA7Y45Z.js";import{b as E}from"./chunk-EUXCM6C4.js";import{b as w}from"./chunk-YLE2OYY6.js";import{b as x}from"./chunk-S7OHMN3F.js";import{b as v}from"./chunk-YWZOGBFE.js";import"./chunk-YMMJLYIX.js";import{d as k,e as q,f as C}from"./chunk-YFPDB4PH.js";import"./chunk-SXB55JOI.js";import{b}from"./chunk-35JD7YEM.js";import"./chunk-4OALHZXB.js";import"./chunk-G43H2WGH.js";import{b as I}from"./chunk-IRCLOW32.js";import{b as M}from"./chunk-OLN6BSO3.js";import{b as j}from"./chunk-FA2CHD73.js";import{b as t}from"./chunk-R2LDP472.js";import{b as l}from"./chunk-PS4LOXE5.js";import{b as u}from"./chunk-VNER2XXL.js";import{b as p}from"./chunk-YX7OOTPO.js";import{b as e}from"./chunk-7ADG3DNO.js";import{b as d}from"./chunk-TEFXEYX3.js";import{b as c}from"./chunk-ZSVBYEY4.js";import{b as h}from"./chunk-SXRVLCZ4.js";import"./chunk-FSZWFMB4.js";import"./chunk-QZNF3Y3J.js";import"./chunk-JX6YLHDX.js";import"./chunk-4PRVMER6.js";import"./chunk-5MUD3WB2.js";import"./chunk-NTKUVXEL.js";import"./chunk-SE4C7FJY.js";import{b as i}from"./chunk-LJKIWB5F.js";import{b as g}from"./chunk-MRP4ZCD7.js";import"./chunk-5WFYIUU2.js";import{b as m}from"./chunk-ND23BJUM.js";import"./chunk-D5WP4CKS.js";import"./chunk-6KZRLMG3.js";import{b as F}from"./chunk-MXVNCVD6.js";import"./chunk-OBH7XN5N.js";import{b as z}from"./chunk-OQV5J23L.js";import"./chunk-SYG3IW7P.js";import{b as f}from"./chunk-EJQKHROT.js";import"./chunk-JBABAK44.js";import{b as n}from"./chunk-ITA43A73.js";import"./chunk-4VDEBYW7.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var Er=[i,g,m,F,z,f,n,t,l,u,p,e,d,c,h,w,x,v,k,q,C,b,I,M,j,y,A,$,S,T,B,D,E,G,H,J,K,L,O,P,Q,R,U,V,W,X,Y,Z,_,N,rr,or,ar,sr,ir,gr,mr,Fr,zr,fr,nr,tr,lr,ur,pr,er,dr,cr,hr,wr,xr,vr,kr,qr,Cr,br,Ir,Mr,jr,yr,Ar,$r,Sr];function Tr(){return Er}var Br=new Map;for(let r of Tr())Br.set(r.name,new Set(r.flags.map(o=>o.flag)));function Fa(r,o,Dr){let a=Br.get(o);if(!(!a||a.size===0))for(let s of Dr)a.has(s)&&r.hit(`cmd:flag:${o}:${s}`)}export{Fa as emitFlagCoverage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a,b}from"./chunk-
|
|
2
|
+
import{a,b}from"./chunk-PIBXJ3VX.js";import"./chunk-PLKGKTIS.js";import"./chunk-ZJGIBTWD.js";import"./chunk-4PRVMER6.js";import"./chunk-5MUD3WB2.js";import"./chunk-NTKUVXEL.js";import"./chunk-SE4C7FJY.js";import"./chunk-5WFYIUU2.js";import"./chunk-6KZRLMG3.js";import"./chunk-OBH7XN5N.js";import"./chunk-SYG3IW7P.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as jqCommand};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"./chunk-D64U2VGQ.js";import{a as M,b as c}from"./chunk-QZNF3Y3J.js";import{a as P,b as U}from"./chunk-
|
|
2
|
+
import"./chunk-D64U2VGQ.js";import{a as M,b as c}from"./chunk-QZNF3Y3J.js";import{a as P,b as U}from"./chunk-JX6YLHDX.js";import{a as N}from"./chunk-4PRVMER6.js";import{c as y}from"./chunk-5MUD3WB2.js";import{b as I}from"./chunk-NTKUVXEL.js";import{a as l}from"./chunk-SYG3IW7P.js";import{a as L,b as k}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";import{randomBytes as H}from"node:crypto";import{fileURLToPath as W}from"node:url";import{Worker as z}from"node:worker_threads";var u={NOOP:0,READ_FILE:1,WRITE_FILE:2,STAT:3,READDIR:4,MKDIR:5,RM:6,EXISTS:7,APPEND_FILE:8,SYMLINK:9,READLINK:10,LSTAT:11,CHMOD:12,REALPATH:13,WRITE_STDOUT:100,WRITE_STDERR:101,EXIT:102,HTTP_REQUEST:200},a={PENDING:0,READY:1,SUCCESS:2,ERROR:3},E={NONE:0,NOT_FOUND:1,IS_DIRECTORY:2,NOT_DIRECTORY:3,EXISTS:4,PERMISSION_DENIED:5,INVALID_PATH:6,IO_ERROR:7,TIMEOUT:8,NETWORK_ERROR:9,NETWORK_NOT_CONFIGURED:10},i={OP_CODE:0,STATUS:4,PATH_LENGTH:8,DATA_LENGTH:12,RESULT_LENGTH:16,ERROR_CODE:20,FLAGS:24,MODE:28,PATH_BUFFER:32,DATA_BUFFER:4128},w={CONTROL_REGION:32,PATH_BUFFER:4096,DATA_BUFFER:1048576,TOTAL:1052704},F={NONE:0,RECURSIVE:1,FORCE:2,MKDIR_RECURSIVE:1},p={IS_FILE:0,IS_DIRECTORY:1,IS_SYMLINK:2,MODE:4,SIZE:8,MTIME:16,TOTAL:24};function V(){return new M(w.TOTAL)}var A=class{int32View;uint8View;dataView;constructor(t){this.int32View=new Int32Array(t),this.uint8View=new Uint8Array(t),this.dataView=new DataView(t)}getOpCode(){return c.load(this.int32View,i.OP_CODE/4)}setOpCode(t){c.store(this.int32View,i.OP_CODE/4,t)}getStatus(){return c.load(this.int32View,i.STATUS/4)}setStatus(t){c.store(this.int32View,i.STATUS/4,t)}getPathLength(){return c.load(this.int32View,i.PATH_LENGTH/4)}setPathLength(t){c.store(this.int32View,i.PATH_LENGTH/4,t)}getDataLength(){return c.load(this.int32View,i.DATA_LENGTH/4)}setDataLength(t){c.store(this.int32View,i.DATA_LENGTH/4,t)}getResultLength(){return c.load(this.int32View,i.RESULT_LENGTH/4)}setResultLength(t){c.store(this.int32View,i.RESULT_LENGTH/4,t)}getErrorCode(){return c.load(this.int32View,i.ERROR_CODE/4)}setErrorCode(t){c.store(this.int32View,i.ERROR_CODE/4,t)}getFlags(){return c.load(this.int32View,i.FLAGS/4)}setFlags(t){c.store(this.int32View,i.FLAGS/4,t)}getMode(){return c.load(this.int32View,i.MODE/4)}setMode(t){c.store(this.int32View,i.MODE/4,t)}getPath(){let t=this.getPathLength(),e=this.uint8View.slice(i.PATH_BUFFER,i.PATH_BUFFER+t);return new TextDecoder().decode(e)}setPath(t){let e=new TextEncoder().encode(t);if(e.length>w.PATH_BUFFER)throw new Error(`Path too long: ${e.length} > ${w.PATH_BUFFER}`);this.uint8View.set(e,i.PATH_BUFFER),this.setPathLength(e.length)}getData(){let t=this.getDataLength();return this.uint8View.slice(i.DATA_BUFFER,i.DATA_BUFFER+t)}setData(t){if(t.length>w.DATA_BUFFER)throw new Error(`Data too large: ${t.length} > ${w.DATA_BUFFER}`);this.uint8View.set(t,i.DATA_BUFFER),this.setDataLength(t.length)}getDataAsString(){let t=this.getData();return new TextDecoder().decode(t)}setDataFromString(t){let e=new TextEncoder().encode(t);this.setData(e)}getResult(){let t=this.getResultLength();return this.uint8View.slice(i.DATA_BUFFER,i.DATA_BUFFER+t)}setResult(t){if(t.length>w.DATA_BUFFER)throw new Error(`Result too large: ${t.length} > ${w.DATA_BUFFER}`);this.uint8View.set(t,i.DATA_BUFFER),this.setResultLength(t.length)}getResultAsString(){let t=this.getResult();return new TextDecoder().decode(t)}setResultFromString(t){let e=new TextEncoder().encode(t);this.setResult(e)}encodeStat(t){this.uint8View[i.DATA_BUFFER+p.IS_FILE]=t.isFile?1:0,this.uint8View[i.DATA_BUFFER+p.IS_DIRECTORY]=t.isDirectory?1:0,this.uint8View[i.DATA_BUFFER+p.IS_SYMLINK]=t.isSymbolicLink?1:0,this.dataView.setInt32(i.DATA_BUFFER+p.MODE,t.mode,!0);let e=Math.min(t.size,Number.MAX_SAFE_INTEGER);this.dataView.setFloat64(i.DATA_BUFFER+p.SIZE,e,!0),this.dataView.setFloat64(i.DATA_BUFFER+p.MTIME,t.mtime.getTime(),!0),this.setResultLength(p.TOTAL)}decodeStat(){return{isFile:this.uint8View[i.DATA_BUFFER+p.IS_FILE]===1,isDirectory:this.uint8View[i.DATA_BUFFER+p.IS_DIRECTORY]===1,isSymbolicLink:this.uint8View[i.DATA_BUFFER+p.IS_SYMLINK]===1,mode:this.dataView.getInt32(i.DATA_BUFFER+p.MODE,!0),size:this.dataView.getFloat64(i.DATA_BUFFER+p.SIZE,!0),mtime:new Date(this.dataView.getFloat64(i.DATA_BUFFER+p.MTIME,!0))}}waitForReady(t){return c.wait(this.int32View,i.STATUS/4,a.PENDING,t)}waitForReadyAsync(t){return c.waitAsync(this.int32View,i.STATUS/4,a.PENDING,t)}async waitUntilReady(t){let e=Date.now();for(;;){let s=this.getStatus();if(s===a.READY)return!0;let r=Date.now()-e;if(r>=t)return!1;let n=t-r,m=c.waitAsync(this.int32View,i.STATUS/4,s,n);if(m.async&&await m.value==="timed-out")return!1}}waitForResult(t){return c.wait(this.int32View,i.STATUS/4,a.READY,t)}notify(){return c.notify(this.int32View,i.STATUS/4)}reset(){this.setOpCode(u.NOOP),this.setStatus(a.PENDING),this.setPathLength(0),this.setDataLength(0),this.setResultLength(0),this.setErrorCode(E.NONE),this.setFlags(F.NONE),this.setMode(0)}};var x=class{fs;cwd;secureFetch;maxOutputSize;protocol;running=!1;output={stdout:"",stderr:"",exitCode:0};outputLimitExceeded=!1;constructor(t,e,s,r=void 0,n=0){this.fs=e,this.cwd=s,this.secureFetch=r,this.maxOutputSize=n,this.protocol=new A(t)}async run(t){this.running=!0;let e=Date.now();for(;this.running;){let s=Date.now()-e;if(s>=t){this.output.stderr+=`
|
|
3
3
|
python3: execution timeout exceeded
|
|
4
4
|
`,this.output.exitCode=124;break}let r=t-s;if(!await this.protocol.waitUntilReady(r)){this.output.stderr+=`
|
|
5
5
|
python3: execution timeout exceeded
|
|
6
|
-
`,this.output.exitCode=124;break}let m=this.protocol.getOpCode();await this.handleOperation(m),this.protocol.notify()}return this.output}stop(){this.running=!1}async handleOperation(t){try{switch(t){case u.READ_FILE:await this.handleReadFile();break;case u.WRITE_FILE:await this.handleWriteFile();break;case u.STAT:await this.handleStat();break;case u.LSTAT:await this.handleLstat();break;case u.READDIR:await this.handleReaddir();break;case u.MKDIR:await this.handleMkdir();break;case u.RM:await this.handleRm();break;case u.EXISTS:await this.handleExists();break;case u.APPEND_FILE:await this.handleAppendFile();break;case u.SYMLINK:await this.handleSymlink();break;case u.READLINK:await this.handleReadlink();break;case u.CHMOD:await this.handleChmod();break;case u.REALPATH:await this.handleRealpath();break;case u.WRITE_STDOUT:this.handleWriteStdout();break;case u.WRITE_STDERR:this.handleWriteStderr();break;case u.EXIT:this.handleExit();break;case u.HTTP_REQUEST:await this.handleHttpRequest();break;default:this.protocol.setErrorCode(E.IO_ERROR),this.protocol.setStatus(a.ERROR)}}catch(e){this.setErrorFromException(e)}}resolvePath(t){return this.fs.resolvePath(this.cwd,t)}async handleReadFile(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readFileBuffer(t);this.protocol.setResult(e),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleWriteFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.writeFile(t,e),this.protocol.setStatus(a.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleStat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.stat(t);this.protocol.encodeStat(e),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleLstat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.lstat(t);this.protocol.encodeStat(e),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleReaddir(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readdir(t);this.protocol.setResultFromString(JSON.stringify(e)),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleMkdir(){let t=this.resolvePath(this.protocol.getPath()),s=(this.protocol.getFlags()&
|
|
7
|
-
`,e=t.length>this.maxOutputSize?t.slice(0,this.maxOutputSize):t;if(this.output.stderr.includes("total output size exceeded"))return;let r=this.output.stdout.length+this.output.stderr.length+e.length-this.maxOutputSize;if(r>0)if(this.output.stdout.length>=r)this.output.stdout=this.output.stdout.slice(0,this.output.stdout.length-r);else{let n=r-this.output.stdout.length;this.output.stdout="",n>=this.output.stderr.length?this.output.stderr="":this.output.stderr=this.output.stderr.slice(0,this.output.stderr.length-n)}this.output.stderr+=e}async handleHttpRequest(){if(!this.secureFetch){this.protocol.setErrorCode(E.NETWORK_NOT_CONFIGURED),this.protocol.setResultFromString("Network access not configured. Enable network in Bash options."),this.protocol.setStatus(a.ERROR);return}let t=this.protocol.getPath(),e=this.protocol.getDataAsString();try{let s=e?JSON.parse(e):{},r=await this.secureFetch(t,{method:s.method,headers:s.headers,body:s.body}),n=JSON.stringify({status:r.status,statusText:r.statusText,headers:r.headers,body:r.body,url:r.url});this.protocol.setResultFromString(n),this.protocol.setStatus(a.SUCCESS)}catch(s){let r=l(s instanceof Error?s.message:String(s));this.protocol.setErrorCode(E.NETWORK_ERROR),this.protocol.setResultFromString(r),this.protocol.setStatus(a.ERROR)}}setErrorFromException(t){let e=t instanceof Error?t.message:String(t),s=l(e),r=E.IO_ERROR,n=e.toLowerCase();n.includes("no such file")||n.includes("not found")||n.includes("enoent")?r=E.NOT_FOUND:n.includes("is a directory")||n.includes("eisdir")?r=E.IS_DIRECTORY:n.includes("not a directory")||n.includes("enotdir")?r=E.NOT_DIRECTORY:n.includes("already exists")||n.includes("eexist")?r=E.EXISTS:(n.includes("permission")||n.includes("eperm")||n.includes("eacces"))&&(r=E.PERMISSION_DENIED),this.protocol.setErrorCode(r),this.protocol.setResultFromString(s),this.protocol.setStatus(a.ERROR)}};var
|
|
6
|
+
`,this.output.exitCode=124;break}let m=this.protocol.getOpCode();await this.handleOperation(m),this.protocol.notify()}return this.output}stop(){this.running=!1}async handleOperation(t){try{switch(t){case u.READ_FILE:await this.handleReadFile();break;case u.WRITE_FILE:await this.handleWriteFile();break;case u.STAT:await this.handleStat();break;case u.LSTAT:await this.handleLstat();break;case u.READDIR:await this.handleReaddir();break;case u.MKDIR:await this.handleMkdir();break;case u.RM:await this.handleRm();break;case u.EXISTS:await this.handleExists();break;case u.APPEND_FILE:await this.handleAppendFile();break;case u.SYMLINK:await this.handleSymlink();break;case u.READLINK:await this.handleReadlink();break;case u.CHMOD:await this.handleChmod();break;case u.REALPATH:await this.handleRealpath();break;case u.WRITE_STDOUT:this.handleWriteStdout();break;case u.WRITE_STDERR:this.handleWriteStderr();break;case u.EXIT:this.handleExit();break;case u.HTTP_REQUEST:await this.handleHttpRequest();break;default:this.protocol.setErrorCode(E.IO_ERROR),this.protocol.setStatus(a.ERROR)}}catch(e){this.setErrorFromException(e)}}resolvePath(t){return this.fs.resolvePath(this.cwd,t)}async handleReadFile(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readFileBuffer(t);this.protocol.setResult(e),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleWriteFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.writeFile(t,e),this.protocol.setStatus(a.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleStat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.stat(t);this.protocol.encodeStat(e),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleLstat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.lstat(t);this.protocol.encodeStat(e),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleReaddir(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readdir(t);this.protocol.setResultFromString(JSON.stringify(e)),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleMkdir(){let t=this.resolvePath(this.protocol.getPath()),s=(this.protocol.getFlags()&F.MKDIR_RECURSIVE)!==0;try{await this.fs.mkdir(t,{recursive:s}),this.protocol.setStatus(a.SUCCESS)}catch(r){this.setErrorFromException(r)}}async handleRm(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getFlags(),s=(e&F.RECURSIVE)!==0,r=(e&F.FORCE)!==0;try{await this.fs.rm(t,{recursive:s,force:r}),this.protocol.setStatus(a.SUCCESS)}catch(n){this.setErrorFromException(n)}}async handleExists(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.exists(t);this.protocol.setResult(new Uint8Array([e?1:0])),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleAppendFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.appendFile(t,e),this.protocol.setStatus(a.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleSymlink(){let t=this.protocol.getPath(),e=this.protocol.getDataAsString(),s=this.resolvePath(t);try{await this.fs.symlink(e,s),this.protocol.setStatus(a.SUCCESS)}catch(r){this.setErrorFromException(r)}}async handleReadlink(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readlink(t);this.protocol.setResultFromString(e),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleChmod(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getMode();try{await this.fs.chmod(t,e),this.protocol.setStatus(a.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleRealpath(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.realpath(t);this.protocol.setResultFromString(e),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}handleWriteStdout(){let t=this.protocol.getDataAsString();if(!this.tryAppendOutput("stdout",t)){this.outputLimitExceeded=!0,this.output.exitCode=1,this.appendOutputLimitError(),this.protocol.setErrorCode(E.IO_ERROR),this.protocol.setResultFromString("Output size limit exceeded"),this.protocol.setStatus(a.ERROR);return}this.protocol.setStatus(a.SUCCESS)}handleWriteStderr(){let t=this.protocol.getDataAsString();if(!this.tryAppendOutput("stderr",t)){this.outputLimitExceeded=!0,this.output.exitCode=1,this.appendOutputLimitError(),this.protocol.setErrorCode(E.IO_ERROR),this.protocol.setResultFromString("Output size limit exceeded"),this.protocol.setStatus(a.ERROR);return}this.protocol.setStatus(a.SUCCESS)}handleExit(){let t=this.protocol.getFlags();this.outputLimitExceeded?this.output.exitCode===0&&(this.output.exitCode=1):this.output.exitCode=t,this.protocol.setStatus(a.SUCCESS),this.running=!1}tryAppendOutput(t,e){return this.outputLimitExceeded?!1:this.maxOutputSize<=0?(t==="stdout"?this.output.stdout+=e:this.output.stderr+=e,!0):this.output.stdout.length+this.output.stderr.length+e.length>this.maxOutputSize?!1:(t==="stdout"?this.output.stdout+=e:this.output.stderr+=e,!0)}appendOutputLimitError(){if(this.maxOutputSize<=0)return;let t=`python3: total output size exceeded (>${this.maxOutputSize} bytes), increase executionLimits.maxOutputSize
|
|
7
|
+
`,e=t.length>this.maxOutputSize?t.slice(0,this.maxOutputSize):t;if(this.output.stderr.includes("total output size exceeded"))return;let r=this.output.stdout.length+this.output.stderr.length+e.length-this.maxOutputSize;if(r>0)if(this.output.stdout.length>=r)this.output.stdout=this.output.stdout.slice(0,this.output.stdout.length-r);else{let n=r-this.output.stdout.length;this.output.stdout="",n>=this.output.stderr.length?this.output.stderr="":this.output.stderr=this.output.stderr.slice(0,this.output.stderr.length-n)}this.output.stderr+=e}async handleHttpRequest(){if(!this.secureFetch){this.protocol.setErrorCode(E.NETWORK_NOT_CONFIGURED),this.protocol.setResultFromString("Network access not configured. Enable network in Bash options."),this.protocol.setStatus(a.ERROR);return}let t=this.protocol.getPath(),e=this.protocol.getDataAsString();try{let s=e?JSON.parse(e):{},r=await this.secureFetch(t,{method:s.method,headers:s.headers,body:s.body}),n=JSON.stringify({status:r.status,statusText:r.statusText,headers:r.headers,body:r.body,url:r.url});this.protocol.setResultFromString(n),this.protocol.setStatus(a.SUCCESS)}catch(s){let r=l(s instanceof Error?s.message:String(s));this.protocol.setErrorCode(E.NETWORK_ERROR),this.protocol.setResultFromString(r),this.protocol.setStatus(a.ERROR)}}setErrorFromException(t){let e=t instanceof Error?t.message:String(t),s=l(e),r=E.IO_ERROR,n=e.toLowerCase();n.includes("no such file")||n.includes("not found")||n.includes("enoent")?r=E.NOT_FOUND:n.includes("is a directory")||n.includes("eisdir")?r=E.IS_DIRECTORY:n.includes("not a directory")||n.includes("enotdir")?r=E.NOT_DIRECTORY:n.includes("already exists")||n.includes("eexist")?r=E.EXISTS:(n.includes("permission")||n.includes("eperm")||n.includes("eacces"))&&(r=E.PERMISSION_DENIED),this.protocol.setErrorCode(r),this.protocol.setResultFromString(s),this.protocol.setStatus(a.ERROR)}};var G=3e4,$={name:"python3",summary:"Execute Python code via CPython Emscripten",usage:"python3 [OPTIONS] [-c CODE | -m MODULE | FILE] [ARGS...]",description:["Execute Python code using CPython compiled to WebAssembly via Emscripten.","","This command runs Python in an isolated environment with access to","the virtual filesystem. Standard library modules are available."],options:["-c CODE Execute CODE as Python script","-m MODULE Run library module as a script","--version Show Python version","--help Show this help"],examples:['python3 -c "print(1 + 2)"','python3 -c "import sys; print(sys.version)"',"python3 script.py","python3 script.py arg1 arg2",`echo 'print("hello")' | python3`],notes:["CPython runs in WebAssembly, so execution may be slower than native Python.","Standard library modules are available (no pip install).","Maximum execution time is 30 seconds by default."]};function Y(o){let t={code:null,module:null,scriptFile:null,showVersion:!1,scriptArgs:[]};if(o.length===0)return t;let e=o.findIndex(s=>!s.startsWith("-")||s==="-"||s==="--");for(let s=0;s<(e===-1?o.length:e);s++){let r=o[s];if(r==="-c")return s+1>=o.length?{stdout:"",stderr:`python3: option requires an argument -- 'c'
|
|
8
8
|
`,exitCode:2}:(t.code=o[s+1],t.scriptArgs=o.slice(s+2),t);if(r==="-m")return s+1>=o.length?{stdout:"",stderr:`python3: option requires an argument -- 'm'
|
|
9
9
|
`,exitCode:2}:(t.module=o[s+1],t.scriptArgs=o.slice(s+2),t);if(r==="--version"||r==="-V")return t.showVersion=!0,t;if(r.startsWith("-")&&r!=="-")return{stdout:"",stderr:`python3: unrecognized option '${r}'
|
|
10
|
-
`,exitCode:2}}if(e!==-1){let s=o[e];s==="--"?e+1<o.length&&(t.scriptFile=o[e+1],t.scriptArgs=o.slice(e+2)):(t.scriptFile=s,t.scriptArgs=o.slice(e+1))}return t}var _=new WeakMap;function
|
|
10
|
+
`,exitCode:2}}if(e!==-1){let s=o[e];s==="--"?e+1<o.length&&(t.scriptFile=o[e+1],t.scriptArgs=o.slice(e+2)):(t.scriptFile=s,t.scriptArgs=o.slice(e+1))}return t}var _=new WeakMap;function K(o){let t=_.get(o);return t||(t={executionQueue:[],isExecuting:!1},_.set(o,t)),t}function Rt(){_=new WeakMap}var Q=W(new URL("./worker.js",import.meta.url));function X(){return H(16).toString("hex")}function Z(o,t){if(!o||typeof o!="object")return{success:!1,error:"Malformed worker response"};let e=o;return typeof e.protocolToken!="string"||e.protocolToken!==t?{success:!1,error:"Malformed worker response: invalid protocol token"}:e.type==="security-violation"?{success:!1,error:`Security violation: ${typeof e.violation?.type=="string"?e.violation.type:"unknown"}`}:typeof e.success!="boolean"?{success:!1,error:"Malformed worker response: missing success flag"}:e.success?{success:!0}:{success:!1,error:typeof e.error=="string"&&e.error.length>0?e.error:"Worker execution failed"}}function f(o){if(o.isExecuting||o.executionQueue.length===0)return;for(;o.executionQueue.length>0&&o.executionQueue[0].canceled;)o.executionQueue.shift();if(o.executionQueue.length===0)return;let t=o.executionQueue.shift();if(!t)return;o.isExecuting=!0;let e;try{e=I.runTrusted(()=>new z(Q,{workerData:t.input}))}catch(h){let d=h instanceof Error?h.message:String(h);t.resolve({success:!1,error:l(d)}),o.isExecuting=!1,f(o);return}t.workerRef&&(t.workerRef.current=e);let s=y(t.requireDefenseContext,"python3","worker message callback",h=>{t.resolve(Z(h,t.input.protocolToken)),o.isExecuting=!1,e.terminate(),f(o)}),r=y(t.requireDefenseContext,"python3","worker error callback",h=>{t.resolve({success:!1,error:l(h.message)}),o.isExecuting=!1,f(o)}),n=y(t.requireDefenseContext,"python3","worker exit callback",()=>{o.isExecuting&&(t.resolve({success:!1,error:"Worker exited unexpectedly"}),o.isExecuting=!1,f(o))}),m=h=>{try{s(h)}catch(d){let g=d instanceof Error?d.message:String(d);t.resolve({success:!1,error:l(g)}),o.isExecuting=!1,e.terminate(),f(o)}},S=h=>{try{r(h)}catch(d){let g=d instanceof Error?d.message:String(d);t.resolve({success:!1,error:l(g)}),o.isExecuting=!1,f(o)}},D=()=>{try{n()}catch(h){let d=h instanceof Error?h.message:String(h);t.resolve({success:!1,error:l(d)}),o.isExecuting=!1,f(o)}};e.on("message",m),e.on("error",S),e.on("exit",D)}async function J(o,t,e,s=[]){let r=V(),n=new x(r,t.fs,t.cwd,t.fetch,t.limits?.maxOutputSize??0),m=t.limits?.maxPythonTimeoutMs??G,S=K(t.fs),D={protocolToken:X(),sharedBuffer:r,pythonCode:o,cwd:t.cwd,env:N(t.env),args:s,scriptPath:e},h={current:null},d=new Promise(R=>{let C={input:D,resolve:()=>{},workerRef:h,requireDefenseContext:t.requireDefenseContext},b=y(t.requireDefenseContext,"python3","worker timeout callback",()=>{h.current?h.current.terminate():C.canceled=!0,R({success:!1,error:`Execution timeout: exceeded ${m}ms limit`})}),v=P(()=>{try{b()}catch(T){let B=T instanceof Error?T.message:String(T);R({success:!1,error:l(B)})}},m);C.resolve=T=>{U(v),R(T)},S.executionQueue.push(C),f(S)}),[g,O]=await Promise.all([n.run(m).catch(R=>({stdout:"",stderr:`python3: bridge error: ${l(R.message)}
|
|
11
11
|
`,exitCode:1})),d.catch(R=>({success:!1,error:l(R.message)}))]);if(!O.success&&O.error){let R=l(O.error);return{stdout:g.stdout,stderr:`${g.stderr}python3: ${R}
|
|
12
|
-
`,exitCode:g.exitCode||1}}return g}var
|
|
12
|
+
`,exitCode:g.exitCode||1}}return g}var j={name:"python3",async execute(o,t){if(k(o))return L($);let e=Y(o);if("exitCode"in e)return e;if(e.showVersion)return{stdout:`Python 3.13.2 (Emscripten)
|
|
13
13
|
`,stderr:"",exitCode:0};let s,r;if(e.code!==null)s=e.code,r="-c";else if(e.module!==null){if(!/^[a-zA-Z_][a-zA-Z0-9_.]*$/.test(e.module))return{stdout:"",stderr:`python3: No module named '${e.module.slice(0,200)}'
|
|
14
14
|
`,exitCode:1};s=`import runpy; runpy.run_module('${e.module}', run_name='__main__')`,r=e.module}else if(e.scriptFile!==null){let n=t.fs.resolvePath(t.cwd,e.scriptFile);if(!await t.fs.exists(n))return{stdout:"",stderr:`python3: can't open file '${e.scriptFile}': [Errno 2] No such file or directory
|
|
15
|
-
`,exitCode:2};try{s=await t.fs.readFile(n),r=e.scriptFile}catch(m){let
|
|
15
|
+
`,exitCode:2};try{s=await t.fs.readFile(n),r=e.scriptFile}catch(m){let S=l(m.message);return{stdout:"",stderr:`python3: can't open file '${e.scriptFile}': ${S}
|
|
16
16
|
`,exitCode:2}}}else if(t.stdin.trim())s=t.stdin,r="<stdin>";else return{stdout:"",stderr:`python3: no input provided (use -c CODE, -m MODULE, or provide a script file)
|
|
17
|
-
`,exitCode:2};return
|
|
17
|
+
`,exitCode:2};return J(s,t,r,e.scriptArgs)}},gt={name:"python",async execute(o,t){return j.execute(o,t)}};export{Rt as _resetExecutionQueue,j as python3Command,gt as pythonCommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a,b}from"./chunk-
|
|
2
|
+
import{a,b}from"./chunk-IRCLOW32.js";import"./chunk-5MUD3WB2.js";import"./chunk-NTKUVXEL.js";import"./chunk-SE4C7FJY.js";import"./chunk-6KZRLMG3.js";import"./chunk-SYG3IW7P.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as sedCommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a,b,c}from"./chunk-
|
|
2
|
+
import{a,b,c}from"./chunk-DHFZMFUW.js";import"./chunk-JX6YLHDX.js";import"./chunk-5MUD3WB2.js";import"./chunk-NTKUVXEL.js";import"./chunk-SYG3IW7P.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{a as _internals,c as flagsForFuzzing,b as sqlite3Command};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a,b}from"./chunk-BBRVF6XE.js";import"./chunk-GZHFXDDO.js";import"./chunk-QSDVMMYI.js";import"./chunk-PLKGKTIS.js";import"./chunk-ZJGIBTWD.js";import"./chunk-4PRVMER6.js";import"./chunk-5MUD3WB2.js";import"./chunk-NTKUVXEL.js";import"./chunk-SE4C7FJY.js";import"./chunk-5WFYIUU2.js";import"./chunk-6KZRLMG3.js";import"./chunk-OBH7XN5N.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as xanCommand};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a,b}from"./chunk-ZNPXCE5B.js";import"./chunk-QSDVMMYI.js";import"./chunk-PLKGKTIS.js";import"./chunk-ZJGIBTWD.js";import"./chunk-4PRVMER6.js";import"./chunk-5MUD3WB2.js";import"./chunk-NTKUVXEL.js";import"./chunk-SE4C7FJY.js";import"./chunk-6KZRLMG3.js";import"./chunk-SYG3IW7P.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as yqCommand};
|
package/dist/bin/shell/shell.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{B as Fn,C as Mn,D as ce,E as Be,F as ee,G as Ee,H as Ot,I as Wn,J as I,K as zn,L as Vn,M as _e,N as ys,O as Dt,P as H,a as kn,b as us,c as On,d as Nt,e as Q,f as V,g as be,h as se,i as Ae,j as Re,k as fs,l as kt,m as Dn,n as ds,o as Tn,p as me,q as ke,r as In,s as xn,t as hs,u as ps,v as Le,w as Rn,x as Ln,y as $e,z as ms}from"./chunks/chunk-O5B6WWQQ.js";import{a as M,b as W,c as Xe,d as Ct,e as Pt,f as Ye,g as cs,h as An,i as _n,j as Cn,k as Pn,l as Nn}from"./chunks/chunk-D64U2VGQ.js";import{c as ls}from"./chunks/chunk-QZNF3Y3J.js";import{a as vn,b as bn}from"./chunks/chunk-UT6LUTWP.js";import{a as xe,b as pe,c as os}from"./chunks/chunk-4PRVMER6.js";import{a as ut,b as Sn}from"./chunks/chunk-ZRRNCS7N.js";import{a as Ke,b as ge}from"./chunks/chunk-Q5MYEU7X.js";import{a as ct}from"./chunks/chunk-SE4C7FJY.js";import{a as fe,b as de,c as le,d as he,e as $n,f as B,g as Ve,h as Et,i as St,j as En,k as Y,l as At,m as Te,n as _t,o as we}from"./chunks/chunk-6KZRLMG3.js";import"./chunks/chunk-OBH7XN5N.js";import{a as Ie}from"./chunks/chunk-SYG3IW7P.js";import{a as ve}from"./chunks/chunk-4VDEBYW7.js";import"./chunks/chunk-KGOUQS5A.js";import*as Ni from"node:fs";import*as ki from"node:readline";var Qe=[{name:"echo",load:async()=>(await import("./chunks/echo-2MUAOGUE.js")).echoCommand},{name:"cat",load:async()=>(await import("./chunks/cat-XZIJZXKP.js")).catCommand},{name:"printf",load:async()=>(await import("./chunks/printf-P3QVL4IO.js")).printfCommand},{name:"ls",load:async()=>(await import("./chunks/ls-G2PXHSNX.js")).lsCommand},{name:"mkdir",load:async()=>(await import("./chunks/mkdir-CH7JGW4N.js")).mkdirCommand},{name:"rmdir",load:async()=>(await import("./chunks/rmdir-5KLM4EA6.js")).rmdirCommand},{name:"touch",load:async()=>(await import("./chunks/touch-DWKSZGOQ.js")).touchCommand},{name:"rm",load:async()=>(await import("./chunks/rm-GWYJO4W7.js")).rmCommand},{name:"cp",load:async()=>(await import("./chunks/cp-XH2ZB7WT.js")).cpCommand},{name:"mv",load:async()=>(await import("./chunks/mv-OY7X62QC.js")).mvCommand},{name:"ln",load:async()=>(await import("./chunks/ln-VAOSD4HK.js")).lnCommand},{name:"chmod",load:async()=>(await import("./chunks/chmod-N5CQATDW.js")).chmodCommand},{name:"pwd",load:async()=>(await import("./chunks/pwd-6VBAPL3Y.js")).pwdCommand},{name:"readlink",load:async()=>(await import("./chunks/readlink-BD5VFOC5.js")).readlinkCommand},{name:"head",load:async()=>(await import("./chunks/head-YMNRW3F3.js")).headCommand},{name:"tail",load:async()=>(await import("./chunks/tail-V537TDFR.js")).tailCommand},{name:"wc",load:async()=>(await import("./chunks/wc-ZIV3TFVG.js")).wcCommand},{name:"stat",load:async()=>(await import("./chunks/stat-XS2LXYS2.js")).statCommand},{name:"grep",load:async()=>(await import("./chunks/grep-OZJTRD4D.js")).grepCommand},{name:"fgrep",load:async()=>(await import("./chunks/grep-OZJTRD4D.js")).fgrepCommand},{name:"egrep",load:async()=>(await import("./chunks/grep-OZJTRD4D.js")).egrepCommand},{name:"rg",load:async()=>(await import("./chunks/rg-34GE6REQ.js")).rgCommand},{name:"sed",load:async()=>(await import("./chunks/sed-ENUQOCBB.js")).sedCommand},{name:"awk",load:async()=>(await import("./chunks/awk2-4MK3F3NZ.js")).awkCommand2},{name:"sort",load:async()=>(await import("./chunks/sort-7GENYU2I.js")).sortCommand},{name:"uniq",load:async()=>(await import("./chunks/uniq-TMSAIZM3.js")).uniqCommand},{name:"comm",load:async()=>(await import("./chunks/comm-R3F3Z5DX.js")).commCommand},{name:"cut",load:async()=>(await import("./chunks/cut-5EY2XPXX.js")).cutCommand},{name:"paste",load:async()=>(await import("./chunks/paste-3UVLMQ2K.js")).pasteCommand},{name:"tr",load:async()=>(await import("./chunks/tr-LZF57GYP.js")).trCommand},{name:"rev",load:async()=>(await import("./chunks/rev-UHEPS2UL.js")).rev},{name:"nl",load:async()=>(await import("./chunks/nl-XH3L75DR.js")).nl},{name:"fold",load:async()=>(await import("./chunks/fold-XSVNTAWH.js")).fold},{name:"expand",load:async()=>(await import("./chunks/expand-26XPP5KB.js")).expand},{name:"unexpand",load:async()=>(await import("./chunks/unexpand-OYZ7KOYR.js")).unexpand},{name:"strings",load:async()=>(await import("./chunks/strings-XXKZCWY5.js")).strings},{name:"split",load:async()=>(await import("./chunks/split-YWV64TJH.js")).split},{name:"column",load:async()=>(await import("./chunks/column-XGV32UPN.js")).column},{name:"join",load:async()=>(await import("./chunks/join-Y4Q5WVVE.js")).join},{name:"tee",load:async()=>(await import("./chunks/tee-HK2SYCAR.js")).teeCommand},{name:"find",load:async()=>(await import("./chunks/find-MTLF23HX.js")).findCommand},{name:"basename",load:async()=>(await import("./chunks/basename-KBUKWB2E.js")).basenameCommand},{name:"dirname",load:async()=>(await import("./chunks/dirname-5FAOMLBL.js")).dirnameCommand},{name:"tree",load:async()=>(await import("./chunks/tree-HEKABARE.js")).treeCommand},{name:"du",load:async()=>(await import("./chunks/du-LDAPXSGF.js")).duCommand},{name:"env",load:async()=>(await import("./chunks/env-HOVBNLUR.js")).envCommand},{name:"printenv",load:async()=>(await import("./chunks/env-HOVBNLUR.js")).printenvCommand},{name:"alias",load:async()=>(await import("./chunks/alias-3GODYSFD.js")).aliasCommand},{name:"unalias",load:async()=>(await import("./chunks/alias-3GODYSFD.js")).unaliasCommand},{name:"history",load:async()=>(await import("./chunks/history-UUKG55YW.js")).historyCommand},{name:"xargs",load:async()=>(await import("./chunks/xargs-GBL6PZ2K.js")).xargsCommand},{name:"true",load:async()=>(await import("./chunks/true-DP5UZP52.js")).trueCommand},{name:"false",load:async()=>(await import("./chunks/true-DP5UZP52.js")).falseCommand},{name:"clear",load:async()=>(await import("./chunks/clear-KRGKPFOI.js")).clearCommand},{name:"bash",load:async()=>(await import("./chunks/bash-6ZHZ6BX7.js")).bashCommand},{name:"sh",load:async()=>(await import("./chunks/bash-6ZHZ6BX7.js")).shCommand},{name:"jq",load:async()=>(await import("./chunks/jq-F7FJ46VM.js")).jqCommand},{name:"base64",load:async()=>(await import("./chunks/base64-43M2R3GA.js")).base64Command},{name:"diff",load:async()=>(await import("./chunks/diff-LE7GMFZD.js")).diffCommand},{name:"date",load:async()=>(await import("./chunks/date-WUPBL2TL.js")).dateCommand},{name:"sleep",load:async()=>(await import("./chunks/sleep-5T34UFNF.js")).sleepCommand},{name:"timeout",load:async()=>(await import("./chunks/timeout-7ECKKPNP.js")).timeoutCommand},{name:"time",load:async()=>(await import("./chunks/time-GZSHCM77.js")).timeCommand},{name:"seq",load:async()=>(await import("./chunks/seq-V7KBLSQ7.js")).seqCommand},{name:"expr",load:async()=>(await import("./chunks/expr-VEFRBJT4.js")).exprCommand},{name:"md5sum",load:async()=>(await import("./chunks/md5sum-NCLXV2S3.js")).md5sumCommand},{name:"sha1sum",load:async()=>(await import("./chunks/sha1sum-BHNJ5ALF.js")).sha1sumCommand},{name:"sha256sum",load:async()=>(await import("./chunks/sha256sum-HJJ3NJ5L.js")).sha256sumCommand},{name:"file",load:async()=>(await import("./chunks/file-D5YKS5NV.js")).fileCommand},{name:"html-to-markdown",load:async()=>(await import("./chunks/html-to-markdown-WVZA3MCP.js")).htmlToMarkdownCommand},{name:"help",load:async()=>(await import("./chunks/help-4H52JYYC.js")).helpCommand},{name:"which",load:async()=>(await import("./chunks/which-5PO4LAOG.js")).whichCommand},{name:"tac",load:async()=>(await import("./chunks/tac-T42SKDDI.js")).tac},{name:"hostname",load:async()=>(await import("./chunks/hostname-WY6RKE32.js")).hostname},{name:"whoami",load:async()=>(await import("./chunks/whoami-E7PN2UWC.js")).whoami},{name:"od",load:async()=>(await import("./chunks/od-52FBC34W.js")).od},{name:"gzip",load:async()=>(await import("./chunks/gzip-LHOO65AN.js")).gzipCommand},{name:"gunzip",load:async()=>(await import("./chunks/gzip-LHOO65AN.js")).gunzipCommand},{name:"zcat",load:async()=>(await import("./chunks/gzip-LHOO65AN.js")).zcatCommand}];(typeof __BROWSER__>"u"||!__BROWSER__)&&(Qe.push({name:"tar",load:async()=>(await import("./chunks/tar-3UIZ4IRM.js")).tarCommand}),Qe.push({name:"yq",load:async()=>(await import("./chunks/yq-O5RSLLA3.js")).yqCommand}),Qe.push({name:"xan",load:async()=>(await import("./chunks/xan-5QTBTP4U.js")).xanCommand}),Qe.push({name:"sqlite3",load:async()=>(await import("./chunks/sqlite3-4SBQACEE.js")).sqlite3Command}));var gs=[];(typeof __BROWSER__>"u"||!__BROWSER__)&&(gs.push({name:"python3",load:async()=>(await import("./chunks/python3-XN7O5X3A.js")).python3Command}),gs.push({name:"python",load:async()=>(await import("./chunks/python3-XN7O5X3A.js")).pythonCommand}));var Ii=[{name:"curl",load:async()=>(await import("./chunks/curl-GIQ5S66Y.js")).curlCommand}],Bn=new Map;function ws(e){return{name:e.name,async execute(t,s){let n=Bn.get(e.name);if(n||(n=await ge.runTrustedAsync(()=>e.load()),Bn.set(e.name,n)),s.coverage&&(typeof __BROWSER__>"u"||!__BROWSER__)){let{emitFlagCoverage:r}=await import("./chunks/flag-coverage-NDF6MQAO.js");r(s.coverage,e.name,t)}return n.execute(t,s)}}}function Hn(e){return(e?Qe.filter(s=>e.includes(s.name)):Qe).map(ws)}function jn(){return Ii.map(ws)}function Un(){return gs.map(ws)}function Zn(e){return"load"in e&&typeof e.load=="function"}function qn(e){let t=null;return{name:e.name,trusted:!0,async execute(s,n){return t||(t=await e.load()),t.execute(s,n)}}}var xi=new TextEncoder,Ri=new TextDecoder;function Je(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}if(t==="binary"||t==="latin1"){if(e.length<=65536)return Uint8Array.from(e,r=>r.charCodeAt(0));let n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return n}return xi.encode(e)}function Tt(e,t){if(t==="base64"){if(typeof Buffer<"u")return Buffer.from(e).toString("base64");let s=65536,n="";for(let r=0;r<e.length;r+=s){let i=e.subarray(r,r+s);n+=String.fromCharCode(...i)}return btoa(n)}if(t==="hex")return Array.from(e).map(s=>s.toString(16).padStart(2,"0")).join("");if(t==="binary"||t==="latin1"){if(typeof Buffer<"u")return Buffer.from(e).toString(t);let s=65536;if(e.length<=s)return String.fromCharCode(...e);let n="";for(let r=0;r<e.length;r+=s){let i=e.subarray(r,r+s);n+=String.fromCharCode(...i)}return n}return Ri.decode(e)}function Fe(e){if(e!=null)return typeof e=="string"?e:e.encoding??void 0}var et=new TextEncoder;function Li(e){return typeof e=="object"&&e!==null&&!(e instanceof Uint8Array)&&"content"in e}var ft=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))typeof n=="function"?this.writeFileLazy(s,n):Li(n)?this.writeFileSync(s,n.content,void 0,{mode:n.mode,mtime:n.mtime}):this.writeFileSync(s,n)}ensureParentDirs(t){let s=Xe(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){W(t,"write");let i=M(t);this.ensureParentDirs(i);let a=Fe(n),o=Je(s,a);this.data.set(i,{type:"file",content:o,mode:r?.mode??420,mtime:r?.mtime??new Date})}writeFileLazy(t,s,n){W(t,"write");let r=M(t);this.ensureParentDirs(r),this.data.set(r,{type:"file",lazy:s,mode:n?.mode??420,mtime:n?.mtime??new Date})}async materializeLazy(t,s){let n=await s.lazy(),i={type:"file",content:typeof n=="string"?et.encode(n):n,mode:s.mode,mtime:s.mtime};return this.data.set(t,i),i}async readFile(t,s){let n=await this.readFileBuffer(t),r=Fe(s);return Tt(n,r)}async readFileBuffer(t){W(t,"open");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}'`);if("lazy"in n){let r=await this.materializeLazy(s,n);return r.content instanceof Uint8Array?r.content:et.encode(r.content)}return n.content instanceof Uint8Array?n.content:et.encode(n.content)}async writeFile(t,s,n){this.writeFileSync(t,s,n)}async appendFile(t,s,n){W(t,"append");let r=M(t),i=this.data.get(r);if(i&&i.type==="directory")throw new Error(`EISDIR: illegal operation on a directory, write '${t}'`);let a=Fe(n),o=Je(s,a);if(i?.type==="file"){let l=i;"lazy"in l&&(l=await this.materializeLazy(r,l));let u="content"in l&&l.content instanceof Uint8Array?l.content:et.encode("content"in l?l.content:""),c=new Uint8Array(u.length+o.length);c.set(u),c.set(o,u.length),this.data.set(r,{type:"file",content:c,mode:l.mode,mtime:new Date})}else this.writeFileSync(t,s,n)}async exists(t){if(t.includes("\0"))return!1;try{let s=this.resolvePathWithSymlinks(t);return this.data.has(s)}catch{return!1}}async stat(t){W(t,"stat");let s=this.resolvePathWithSymlinks(t),n=this.data.get(s);if(!n)throw new Error(`ENOENT: no such file or directory, stat '${t}'`);n.type==="file"&&"lazy"in n&&(n=await this.materializeLazy(s,n));let r=0;return n.type==="file"&&"content"in n&&n.content&&(n.content instanceof Uint8Array?r=n.content.length:r=et.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){W(t,"lstat");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};n.type==="file"&&"lazy"in n&&(n=await this.materializeLazy(s,n));let r=0;return n.type==="file"&&"content"in n&&n.content&&(n.content instanceof Uint8Array?r=n.content.length:r=et.encode(n.content).length),{isFile:n.type==="file",isDirectory:n.type==="directory",isSymbolicLink:!1,mode:n.mode,size:r,mtime:n.mtime||new Date}}resolveIntermediateSymlinks(t){let s=M(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 l=this.data.get(r),u=0,c=40;for(;l&&l.type==="symlink"&&u<c;){if(i.has(r))throw new Error(`ELOOP: too many levels of symbolic links, lstat '${t}'`);i.add(r),r=Ye(r,l.target),l=this.data.get(r),u++}if(u>=c)throw new Error(`ELOOP: too many levels of symbolic links, lstat '${t}'`)}return`${r}/${n[n.length-1]}`}resolvePathWithSymlinks(t){let s=M(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),l=0,u=40;for(;o&&o.type==="symlink"&&l<u;){if(i.has(r))throw new Error(`ELOOP: too many levels of symbolic links, open '${t}'`);i.add(r),r=Ye(r,o.target),o=this.data.get(r),l++}if(l>=u)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){W(t,"mkdir");let n=M(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=Xe(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){W(t,"scandir");let s=M(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=Ye(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,l]of this.data.entries())if(o!==s&&o.startsWith(i)){let u=o.slice(i.length),c=u.split("/")[0];c&&!u.includes("/",c.length)&&!a.has(c)&&a.set(c,{name:c,isFile:l.type==="file",isDirectory:l.type==="directory",isSymbolicLink:l.type==="symlink"})}return Array.from(a.values()).sort((o,l)=>o.name<l.name?-1:o.name>l.name?1:0)}async rm(t,s){W(t,"rm");let n=M(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=Pt(n,a);await this.rm(o,s)}}}this.data.delete(n)}async cp(t,s,n){W(t,"cp"),W(s,"cp");let r=M(t),i=M(s),a=this.data.get(r);if(!a)throw new Error(`ENOENT: no such file or directory, cp '${t}'`);if(a.type==="file")if(this.ensureParentDirs(i),"content"in a){let o=a.content instanceof Uint8Array?new Uint8Array(a.content):a.content;this.data.set(i,{...a,content:o})}else this.data.set(i,{...a});else if(a.type==="symlink")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 l of o){let u=Pt(r,l),c=Pt(i,l);await this.cp(u,c,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){return Ct(t,s)}async chmod(t,s){W(t,"chmod");let n=M(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){W(s,"symlink");let n=M(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){W(t,"link"),W(s,"link");let n=M(t),r=M(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}'`);let a=i;"lazy"in a&&(a=await this.materializeLazy(n,a)),this.ensureParentDirs(r),this.data.set(r,{type:"file",content:a.content,mode:a.mode,mtime:a.mtime})}async readlink(t){W(t,"readlink");let s=M(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){W(t,"realpath");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){W(t,"utimes");let r=M(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 Fi(e){let t=e;return typeof t.mkdirSync=="function"&&typeof t.writeFileSync=="function"}function Mi(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 Wi(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 zi(e,t){e.mkdirSync("/proc/self/fd",{recursive:!0}),e.writeFileSync("/proc/version",`${kn}
|
|
2
|
+
import{B as Fn,C as Mn,D as ce,E as Be,F as ee,G as Ee,H as Ot,I as Wn,J as I,K as zn,L as Vn,M as _e,N as ys,O as Dt,P as H,a as kn,b as us,c as On,d as Nt,e as Q,f as V,g as be,h as se,i as Ae,j as Re,k as fs,l as kt,m as Dn,n as ds,o as Tn,p as me,q as ke,r as In,s as xn,t as hs,u as ps,v as Le,w as Rn,x as Ln,y as $e,z as ms}from"./chunks/chunk-O5B6WWQQ.js";import{a as M,b as W,c as Xe,d as Ct,e as Pt,f as Ye,g as cs,h as An,i as _n,j as Cn,k as Pn,l as Nn}from"./chunks/chunk-D64U2VGQ.js";import{c as ls}from"./chunks/chunk-QZNF3Y3J.js";import{a as vn,b as bn}from"./chunks/chunk-JX6YLHDX.js";import{a as xe,b as pe,c as os}from"./chunks/chunk-4PRVMER6.js";import{a as ut,b as Sn}from"./chunks/chunk-5MUD3WB2.js";import{a as Ke,b as ge}from"./chunks/chunk-NTKUVXEL.js";import{a as ct}from"./chunks/chunk-SE4C7FJY.js";import{a as fe,b as de,c as le,d as he,e as $n,f as B,g as Ve,h as Et,i as St,j as En,k as Y,l as At,m as Te,n as _t,o as we}from"./chunks/chunk-6KZRLMG3.js";import"./chunks/chunk-OBH7XN5N.js";import{a as Ie}from"./chunks/chunk-SYG3IW7P.js";import{a as ve}from"./chunks/chunk-4VDEBYW7.js";import"./chunks/chunk-KGOUQS5A.js";import*as Ni from"node:fs";import*as ki from"node:readline";var Qe=[{name:"echo",load:async()=>(await import("./chunks/echo-2MUAOGUE.js")).echoCommand},{name:"cat",load:async()=>(await import("./chunks/cat-XZIJZXKP.js")).catCommand},{name:"printf",load:async()=>(await import("./chunks/printf-P3QVL4IO.js")).printfCommand},{name:"ls",load:async()=>(await import("./chunks/ls-G2PXHSNX.js")).lsCommand},{name:"mkdir",load:async()=>(await import("./chunks/mkdir-CH7JGW4N.js")).mkdirCommand},{name:"rmdir",load:async()=>(await import("./chunks/rmdir-5KLM4EA6.js")).rmdirCommand},{name:"touch",load:async()=>(await import("./chunks/touch-DWKSZGOQ.js")).touchCommand},{name:"rm",load:async()=>(await import("./chunks/rm-GWYJO4W7.js")).rmCommand},{name:"cp",load:async()=>(await import("./chunks/cp-XH2ZB7WT.js")).cpCommand},{name:"mv",load:async()=>(await import("./chunks/mv-OY7X62QC.js")).mvCommand},{name:"ln",load:async()=>(await import("./chunks/ln-VAOSD4HK.js")).lnCommand},{name:"chmod",load:async()=>(await import("./chunks/chmod-N5CQATDW.js")).chmodCommand},{name:"pwd",load:async()=>(await import("./chunks/pwd-6VBAPL3Y.js")).pwdCommand},{name:"readlink",load:async()=>(await import("./chunks/readlink-BD5VFOC5.js")).readlinkCommand},{name:"head",load:async()=>(await import("./chunks/head-YMNRW3F3.js")).headCommand},{name:"tail",load:async()=>(await import("./chunks/tail-V537TDFR.js")).tailCommand},{name:"wc",load:async()=>(await import("./chunks/wc-ZIV3TFVG.js")).wcCommand},{name:"stat",load:async()=>(await import("./chunks/stat-XS2LXYS2.js")).statCommand},{name:"grep",load:async()=>(await import("./chunks/grep-OZJTRD4D.js")).grepCommand},{name:"fgrep",load:async()=>(await import("./chunks/grep-OZJTRD4D.js")).fgrepCommand},{name:"egrep",load:async()=>(await import("./chunks/grep-OZJTRD4D.js")).egrepCommand},{name:"rg",load:async()=>(await import("./chunks/rg-34GE6REQ.js")).rgCommand},{name:"sed",load:async()=>(await import("./chunks/sed-UV2LTNVK.js")).sedCommand},{name:"awk",load:async()=>(await import("./chunks/awk2-EB5SCHVW.js")).awkCommand2},{name:"sort",load:async()=>(await import("./chunks/sort-7GENYU2I.js")).sortCommand},{name:"uniq",load:async()=>(await import("./chunks/uniq-TMSAIZM3.js")).uniqCommand},{name:"comm",load:async()=>(await import("./chunks/comm-R3F3Z5DX.js")).commCommand},{name:"cut",load:async()=>(await import("./chunks/cut-5EY2XPXX.js")).cutCommand},{name:"paste",load:async()=>(await import("./chunks/paste-3UVLMQ2K.js")).pasteCommand},{name:"tr",load:async()=>(await import("./chunks/tr-LZF57GYP.js")).trCommand},{name:"rev",load:async()=>(await import("./chunks/rev-UHEPS2UL.js")).rev},{name:"nl",load:async()=>(await import("./chunks/nl-XH3L75DR.js")).nl},{name:"fold",load:async()=>(await import("./chunks/fold-XSVNTAWH.js")).fold},{name:"expand",load:async()=>(await import("./chunks/expand-26XPP5KB.js")).expand},{name:"unexpand",load:async()=>(await import("./chunks/unexpand-OYZ7KOYR.js")).unexpand},{name:"strings",load:async()=>(await import("./chunks/strings-XXKZCWY5.js")).strings},{name:"split",load:async()=>(await import("./chunks/split-YWV64TJH.js")).split},{name:"column",load:async()=>(await import("./chunks/column-XGV32UPN.js")).column},{name:"join",load:async()=>(await import("./chunks/join-Y4Q5WVVE.js")).join},{name:"tee",load:async()=>(await import("./chunks/tee-HK2SYCAR.js")).teeCommand},{name:"find",load:async()=>(await import("./chunks/find-MTLF23HX.js")).findCommand},{name:"basename",load:async()=>(await import("./chunks/basename-KBUKWB2E.js")).basenameCommand},{name:"dirname",load:async()=>(await import("./chunks/dirname-5FAOMLBL.js")).dirnameCommand},{name:"tree",load:async()=>(await import("./chunks/tree-HEKABARE.js")).treeCommand},{name:"du",load:async()=>(await import("./chunks/du-LDAPXSGF.js")).duCommand},{name:"env",load:async()=>(await import("./chunks/env-HOVBNLUR.js")).envCommand},{name:"printenv",load:async()=>(await import("./chunks/env-HOVBNLUR.js")).printenvCommand},{name:"alias",load:async()=>(await import("./chunks/alias-3GODYSFD.js")).aliasCommand},{name:"unalias",load:async()=>(await import("./chunks/alias-3GODYSFD.js")).unaliasCommand},{name:"history",load:async()=>(await import("./chunks/history-UUKG55YW.js")).historyCommand},{name:"xargs",load:async()=>(await import("./chunks/xargs-GBL6PZ2K.js")).xargsCommand},{name:"true",load:async()=>(await import("./chunks/true-DP5UZP52.js")).trueCommand},{name:"false",load:async()=>(await import("./chunks/true-DP5UZP52.js")).falseCommand},{name:"clear",load:async()=>(await import("./chunks/clear-KRGKPFOI.js")).clearCommand},{name:"bash",load:async()=>(await import("./chunks/bash-6ZHZ6BX7.js")).bashCommand},{name:"sh",load:async()=>(await import("./chunks/bash-6ZHZ6BX7.js")).shCommand},{name:"jq",load:async()=>(await import("./chunks/jq-P457LMHU.js")).jqCommand},{name:"base64",load:async()=>(await import("./chunks/base64-43M2R3GA.js")).base64Command},{name:"diff",load:async()=>(await import("./chunks/diff-LE7GMFZD.js")).diffCommand},{name:"date",load:async()=>(await import("./chunks/date-WUPBL2TL.js")).dateCommand},{name:"sleep",load:async()=>(await import("./chunks/sleep-3WHM7JMW.js")).sleepCommand},{name:"timeout",load:async()=>(await import("./chunks/timeout-BYB3L2JA.js")).timeoutCommand},{name:"time",load:async()=>(await import("./chunks/time-GZSHCM77.js")).timeCommand},{name:"seq",load:async()=>(await import("./chunks/seq-V7KBLSQ7.js")).seqCommand},{name:"expr",load:async()=>(await import("./chunks/expr-VEFRBJT4.js")).exprCommand},{name:"md5sum",load:async()=>(await import("./chunks/md5sum-NCLXV2S3.js")).md5sumCommand},{name:"sha1sum",load:async()=>(await import("./chunks/sha1sum-BHNJ5ALF.js")).sha1sumCommand},{name:"sha256sum",load:async()=>(await import("./chunks/sha256sum-HJJ3NJ5L.js")).sha256sumCommand},{name:"file",load:async()=>(await import("./chunks/file-D5YKS5NV.js")).fileCommand},{name:"html-to-markdown",load:async()=>(await import("./chunks/html-to-markdown-WVZA3MCP.js")).htmlToMarkdownCommand},{name:"help",load:async()=>(await import("./chunks/help-4H52JYYC.js")).helpCommand},{name:"which",load:async()=>(await import("./chunks/which-5PO4LAOG.js")).whichCommand},{name:"tac",load:async()=>(await import("./chunks/tac-T42SKDDI.js")).tac},{name:"hostname",load:async()=>(await import("./chunks/hostname-WY6RKE32.js")).hostname},{name:"whoami",load:async()=>(await import("./chunks/whoami-E7PN2UWC.js")).whoami},{name:"od",load:async()=>(await import("./chunks/od-52FBC34W.js")).od},{name:"gzip",load:async()=>(await import("./chunks/gzip-LHOO65AN.js")).gzipCommand},{name:"gunzip",load:async()=>(await import("./chunks/gzip-LHOO65AN.js")).gunzipCommand},{name:"zcat",load:async()=>(await import("./chunks/gzip-LHOO65AN.js")).zcatCommand}];(typeof __BROWSER__>"u"||!__BROWSER__)&&(Qe.push({name:"tar",load:async()=>(await import("./chunks/tar-SO3XDDIW.js")).tarCommand}),Qe.push({name:"yq",load:async()=>(await import("./chunks/yq-H7D2U3HS.js")).yqCommand}),Qe.push({name:"xan",load:async()=>(await import("./chunks/xan-FZB7FHX3.js")).xanCommand}),Qe.push({name:"sqlite3",load:async()=>(await import("./chunks/sqlite3-B3P3OMPI.js")).sqlite3Command}));var gs=[];(typeof __BROWSER__>"u"||!__BROWSER__)&&(gs.push({name:"python3",load:async()=>(await import("./chunks/python3-IV3DBMHM.js")).python3Command}),gs.push({name:"python",load:async()=>(await import("./chunks/python3-IV3DBMHM.js")).pythonCommand}));var Ii=[{name:"curl",load:async()=>(await import("./chunks/curl-3GMIPMCI.js")).curlCommand}],Bn=new Map;function ws(e){return{name:e.name,async execute(t,s){let n=Bn.get(e.name);if(n||(n=await ge.runTrustedAsync(()=>e.load()),Bn.set(e.name,n)),s.coverage&&(typeof __BROWSER__>"u"||!__BROWSER__)){let{emitFlagCoverage:r}=await import("./chunks/flag-coverage-7GOZYXJT.js");r(s.coverage,e.name,t)}return n.execute(t,s)}}}function Hn(e){return(e?Qe.filter(s=>e.includes(s.name)):Qe).map(ws)}function jn(){return Ii.map(ws)}function Un(){return gs.map(ws)}function Zn(e){return"load"in e&&typeof e.load=="function"}function qn(e){let t=null;return{name:e.name,trusted:!0,async execute(s,n){return t||(t=await e.load()),t.execute(s,n)}}}var xi=new TextEncoder,Ri=new TextDecoder;function Je(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}if(t==="binary"||t==="latin1"){if(e.length<=65536)return Uint8Array.from(e,r=>r.charCodeAt(0));let n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return n}return xi.encode(e)}function Tt(e,t){if(t==="base64"){if(typeof Buffer<"u")return Buffer.from(e).toString("base64");let s=65536,n="";for(let r=0;r<e.length;r+=s){let i=e.subarray(r,r+s);n+=String.fromCharCode(...i)}return btoa(n)}if(t==="hex")return Array.from(e).map(s=>s.toString(16).padStart(2,"0")).join("");if(t==="binary"||t==="latin1"){if(typeof Buffer<"u")return Buffer.from(e).toString(t);let s=65536;if(e.length<=s)return String.fromCharCode(...e);let n="";for(let r=0;r<e.length;r+=s){let i=e.subarray(r,r+s);n+=String.fromCharCode(...i)}return n}return Ri.decode(e)}function Fe(e){if(e!=null)return typeof e=="string"?e:e.encoding??void 0}var et=new TextEncoder;function Li(e){return typeof e=="object"&&e!==null&&!(e instanceof Uint8Array)&&"content"in e}var ft=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))typeof n=="function"?this.writeFileLazy(s,n):Li(n)?this.writeFileSync(s,n.content,void 0,{mode:n.mode,mtime:n.mtime}):this.writeFileSync(s,n)}ensureParentDirs(t){let s=Xe(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){W(t,"write");let i=M(t);this.ensureParentDirs(i);let a=Fe(n),o=Je(s,a);this.data.set(i,{type:"file",content:o,mode:r?.mode??420,mtime:r?.mtime??new Date})}writeFileLazy(t,s,n){W(t,"write");let r=M(t);this.ensureParentDirs(r),this.data.set(r,{type:"file",lazy:s,mode:n?.mode??420,mtime:n?.mtime??new Date})}async materializeLazy(t,s){let n=await s.lazy(),i={type:"file",content:typeof n=="string"?et.encode(n):n,mode:s.mode,mtime:s.mtime};return this.data.set(t,i),i}async readFile(t,s){let n=await this.readFileBuffer(t),r=Fe(s);return Tt(n,r)}async readFileBuffer(t){W(t,"open");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}'`);if("lazy"in n){let r=await this.materializeLazy(s,n);return r.content instanceof Uint8Array?r.content:et.encode(r.content)}return n.content instanceof Uint8Array?n.content:et.encode(n.content)}async writeFile(t,s,n){this.writeFileSync(t,s,n)}async appendFile(t,s,n){W(t,"append");let r=M(t),i=this.data.get(r);if(i&&i.type==="directory")throw new Error(`EISDIR: illegal operation on a directory, write '${t}'`);let a=Fe(n),o=Je(s,a);if(i?.type==="file"){let l=i;"lazy"in l&&(l=await this.materializeLazy(r,l));let u="content"in l&&l.content instanceof Uint8Array?l.content:et.encode("content"in l?l.content:""),c=new Uint8Array(u.length+o.length);c.set(u),c.set(o,u.length),this.data.set(r,{type:"file",content:c,mode:l.mode,mtime:new Date})}else this.writeFileSync(t,s,n)}async exists(t){if(t.includes("\0"))return!1;try{let s=this.resolvePathWithSymlinks(t);return this.data.has(s)}catch{return!1}}async stat(t){W(t,"stat");let s=this.resolvePathWithSymlinks(t),n=this.data.get(s);if(!n)throw new Error(`ENOENT: no such file or directory, stat '${t}'`);n.type==="file"&&"lazy"in n&&(n=await this.materializeLazy(s,n));let r=0;return n.type==="file"&&"content"in n&&n.content&&(n.content instanceof Uint8Array?r=n.content.length:r=et.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){W(t,"lstat");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};n.type==="file"&&"lazy"in n&&(n=await this.materializeLazy(s,n));let r=0;return n.type==="file"&&"content"in n&&n.content&&(n.content instanceof Uint8Array?r=n.content.length:r=et.encode(n.content).length),{isFile:n.type==="file",isDirectory:n.type==="directory",isSymbolicLink:!1,mode:n.mode,size:r,mtime:n.mtime||new Date}}resolveIntermediateSymlinks(t){let s=M(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 l=this.data.get(r),u=0,c=40;for(;l&&l.type==="symlink"&&u<c;){if(i.has(r))throw new Error(`ELOOP: too many levels of symbolic links, lstat '${t}'`);i.add(r),r=Ye(r,l.target),l=this.data.get(r),u++}if(u>=c)throw new Error(`ELOOP: too many levels of symbolic links, lstat '${t}'`)}return`${r}/${n[n.length-1]}`}resolvePathWithSymlinks(t){let s=M(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),l=0,u=40;for(;o&&o.type==="symlink"&&l<u;){if(i.has(r))throw new Error(`ELOOP: too many levels of symbolic links, open '${t}'`);i.add(r),r=Ye(r,o.target),o=this.data.get(r),l++}if(l>=u)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){W(t,"mkdir");let n=M(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=Xe(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){W(t,"scandir");let s=M(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=Ye(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,l]of this.data.entries())if(o!==s&&o.startsWith(i)){let u=o.slice(i.length),c=u.split("/")[0];c&&!u.includes("/",c.length)&&!a.has(c)&&a.set(c,{name:c,isFile:l.type==="file",isDirectory:l.type==="directory",isSymbolicLink:l.type==="symlink"})}return Array.from(a.values()).sort((o,l)=>o.name<l.name?-1:o.name>l.name?1:0)}async rm(t,s){W(t,"rm");let n=M(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=Pt(n,a);await this.rm(o,s)}}}this.data.delete(n)}async cp(t,s,n){W(t,"cp"),W(s,"cp");let r=M(t),i=M(s),a=this.data.get(r);if(!a)throw new Error(`ENOENT: no such file or directory, cp '${t}'`);if(a.type==="file")if(this.ensureParentDirs(i),"content"in a){let o=a.content instanceof Uint8Array?new Uint8Array(a.content):a.content;this.data.set(i,{...a,content:o})}else this.data.set(i,{...a});else if(a.type==="symlink")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 l of o){let u=Pt(r,l),c=Pt(i,l);await this.cp(u,c,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){return Ct(t,s)}async chmod(t,s){W(t,"chmod");let n=M(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){W(s,"symlink");let n=M(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){W(t,"link"),W(s,"link");let n=M(t),r=M(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}'`);let a=i;"lazy"in a&&(a=await this.materializeLazy(n,a)),this.ensureParentDirs(r),this.data.set(r,{type:"file",content:a.content,mode:a.mode,mtime:a.mtime})}async readlink(t){W(t,"readlink");let s=M(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){W(t,"realpath");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){W(t,"utimes");let r=M(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 Fi(e){let t=e;return typeof t.mkdirSync=="function"&&typeof t.writeFileSync=="function"}function Mi(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 Wi(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 zi(e,t){e.mkdirSync("/proc/self/fd",{recursive:!0}),e.writeFileSync("/proc/version",`${kn}
|
|
3
3
|
`),e.writeFileSync("/proc/self/exe","/bin/bash"),e.writeFileSync("/proc/self/cmdline","bash\0"),e.writeFileSync("/proc/self/comm",`bash
|
|
4
4
|
`),e.writeFileLazy?e.writeFileLazy("/proc/self/status",()=>us(t)):e.writeFileSync("/proc/self/status",us(t)),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 Gn(e,t,s={pid:1,ppid:0,uid:1e3,gid:1e3}){Fi(e)&&(Mi(e,t),Wi(e),zi(e,s))}var Vi=["allexport","errexit","noglob","noclobber","noexec","nounset","pipefail","posix","verbose","xtrace"],Bi=["braceexpand","hashall","interactive-comments"];function bs(e){let t=[],s=[...Bi.map(n=>({name:n,enabled:!0})),...Vi.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 st(e){e.state.env.set("SHELLOPTS",bs(e.state.options))}var Hi=["dotglob","expand_aliases","extglob","failglob","globskipdots","globstar","lastpipe","nocaseglob","nocasematch","nullglob","xpg_echo"];function $s(e){let t=[];for(let s of Hi)e[s]&&t.push(s);return t.join(":")}function Es(e){e.state.env.set("BASHOPTS",$s(e.state.shoptOptions))}var ji="BASH_ALIAS_";function Kn(e){return e.parts.length!==1?!1:e.parts[0].type==="Literal"}function Xn(e){if(e.parts.length!==1)return null;let t=e.parts[0];return t.type==="Literal"?t.value:null}function Yn(e,t){return e.env.get(`${ji}${t}`)}function Ss(e,t,s){if(!t.name||!Kn(t.name))return t;let n=Xn(t.name);if(!n)return t;let r=Yn(e,n);if(!r||s.has(n))return t;try{s.add(n);let i=new V,a=r,o=r.endsWith(" ");if(!o)for(let f of t.args){let d=Jn(f);a+=` ${d}`}let l;try{l=i.parse(a)}catch(f){if(f instanceof Nt)throw f;return t}if(l.statements.length!==1||l.statements[0].pipelines.length!==1||l.statements[0].pipelines[0].commands.length!==1)return Qn(t,r);let u=l.statements[0].pipelines[0].commands[0];if(u.type!=="SimpleCommand")return Qn(t,r);let c={...u,assignments:[...t.assignments,...u.assignments],redirections:[...u.redirections,...t.redirections],line:t.line};if(o&&t.args.length>0&&(c={...c,args:[...c.args,...t.args]},c.args.length>0)){let f=c.args[0];if(Kn(f)){let d=Xn(f);if(d&&Yn(e,d)){let h={type:"SimpleCommand",name:f,args:c.args.slice(1),assignments:[],redirections:[]},y=Ss(e,h,s);y!==h&&(c={...c,name:y.name,args:[...y.args]})}}}return c}catch(i){throw s.delete(n),i}}function Qn(e,t){let s=t;for(let a of e.args){let o=Jn(a);s+=` ${o}`}let n=new V,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 Jn(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 er(e,t){let s=t.parts.map(c=>c.type==="Literal"?c.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="",l=!1;for(let c of t.parts)if(c.type==="Literal"){let f=c.value;if(!a){let d=f.indexOf("=(");d!==-1&&(a=!0,f=f.slice(d+2))}if(a){f.endsWith(")")&&(f=f.slice(0,-1));let d=f.split(/(\s+)/);for(let h of d)/^\s+$/.test(h)?(o||l)&&(i.push(o),o="",l=!1):h&&(o+=h)}}else if(a)if(c.type==="BraceExpansion")if(/^\[.+\]=/.test(o))o+=kt({type:"Word",parts:[c]});else{(o||l)&&(i.push(o),o="",l=!1);let d=await _e(e,{type:"Word",parts:[c]});i.push(...d.values)}else{(c.type==="SingleQuoted"||c.type==="DoubleQuoted"||c.type==="Escaped")&&(l=!0);let f=await I(e,{type:"Word",parts:[c]});o+=f}(o||l)&&i.push(o);let u=i.map(c=>/^\[.+\]=/.test(c)?c:c===""?"''":/[\s"'\\$`!*?[\]{}|&;<>()]/.test(c)&&!c.startsWith("'")&&!c.startsWith('"')?`'${c.replace(/'/g,"'\\''")}'`:c);return`${r}=(${u.join(" ")})`}async function tr(e,t){let s=-1,n=-1,r=!1;for(let p=0;p<t.parts.length;p++){let m=t.parts[p];if(m.type==="Literal"){let b=m.value.indexOf("+=");if(b!==-1){let A=m.value.slice(0,b);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(A)){s=p,n=b,r=!0;break}if(/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(A)){s=p,n=b,r=!0;break}}let v=m.value.indexOf("=");if(v!==-1&&(v===0||m.value[v-1]!=="+")){let A=m.value.slice(0,v);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(A)||/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(A)){s=p,n=v;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,l=a.value.slice(0,n),u=a.value.slice(n+o),c=t.parts.slice(s+1),f="";for(let p of i)f+=await I(e,{type:"Word",parts:[p]});f+=l;let d={type:"Word",parts:u!==""?[{type:"Literal",value:u},...c]:c},h=d.parts.length>0?await I(e,d):"";return`${f}${r?"+=":"="}${h}`}var Ui=["tar","yq","xan","sqlite3","python3","python"];function sr(e){return Ui.includes(e)}var L=Object.freeze({stdout:"",stderr:"",exitCode:0});function F(e=""){return{stdout:e,stderr:"",exitCode:0}}function _(e,t=1){return{stdout:"",stderr:e,exitCode:t}}function P(e,t,s){return{stdout:e,stderr:t,exitCode:s}}function X(e){return{stdout:"",stderr:"",exitCode:e?0:1}}function Ce(e,t,s="",n=""){throw new Y(e,t,s,n)}function ae(e){let t=e.state.fileDescriptors;if(t&&t.size>=e.limits.maxFileDescriptors)throw new Y(`too many open file descriptors (max ${e.limits.maxFileDescriptors})`,"file_descriptors")}function As(e,t){if(e.state.loopDepth===0){if(e.state.parentHasLoopContext)throw new Te;return L}if(t.length>1)throw new B(1,"",`bash: break: too many arguments
|
|
5
5
|
`);let s=1;if(t.length>0){let n=Number.parseInt(t[0],10);if(Number.isNaN(n)||n<1)throw new B(128,"",`bash: break: ${t[0]}: numeric argument required
|