@jerryan/just-bash 3.8.0 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/README.md +5 -15
- package/dist/AGENTS.md +2 -2
- package/dist/Bash.d.ts +2 -4
- package/dist/bin/chunks/builtin-manifest-ORBIZM7I.js +3 -0
- package/dist/bin/chunks/{chmod-GX5SYTRL.js → chmod-S4ARARR4.js} +1 -1
- package/dist/bin/chunks/chunk-3ASHUC7C.js +44 -0
- package/dist/bin/{shell/chunks/chunk-7WBCA2BB.js → chunks/chunk-3DWQCLNP.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-3ROYEBJI.js → chunks/chunk-4JPWP5WS.js} +1 -1
- package/dist/bin/chunks/{chunk-QFTZKD5O.js → chunk-6TUILMPB.js} +1 -1
- package/dist/bin/chunks/{chunk-DRPHNXG7.js → chunk-7LGT4LHQ.js} +1 -1
- package/dist/bin/chunks/{chunk-MBREBDZQ.js → chunk-AIWBN36Z.js} +1 -1
- package/dist/bin/chunks/chunk-AQKIHX3Q.js +3 -0
- package/dist/bin/chunks/chunk-E2O6S35K.js +10 -0
- package/dist/bin/chunks/chunk-E54Z6VIE.js +12 -0
- package/dist/bin/{shell/chunks/chunk-F2PYTUMR.js → chunks/chunk-F4ACJZIY.js} +7 -6
- package/dist/bin/{shell/chunks/chunk-MPFNZYEA.js → chunks/chunk-GKJD4ULC.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-QJWFCA7P.js → chunks/chunk-HARVZWUX.js} +1 -1
- package/dist/bin/chunks/chunk-IRCAXXH6.js +14 -0
- package/dist/bin/chunks/{chunk-T6OIISUC.js → chunk-K65FCSAT.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-MF3GVFLC.js → chunks/chunk-L345YZ6R.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-6FGMEZZP.js → chunks/chunk-MWQMHODV.js} +1 -1
- package/dist/bin/chunks/{chunk-BB5VTPMQ.js → chunk-NSI6LMDS.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-ABP4OLJV.js → chunks/chunk-OXEDIWNZ.js} +1 -1
- package/dist/bin/chunks/chunk-QKJAAJ7J.js +3 -0
- package/dist/bin/chunks/{chunk-KMYJMEON.js → chunk-R7THHH4J.js} +1 -1
- package/dist/bin/chunks/chunk-UBA7DOWE.js +3 -0
- package/dist/bin/chunks/{chunk-VPSBWWXM.js → chunk-UNCYBFWT.js} +7 -6
- package/dist/bin/chunks/chunk-VMVXACZ5.js +6 -0
- package/dist/bin/chunks/chunk-Z3TCELKN.js +12 -0
- package/dist/bin/chunks/{cp-YLP7ULVT.js → cp-WRBRHVVD.js} +1 -1
- package/dist/bin/chunks/{diff-JSJ56EOK.js → diff-YLVT27CZ.js} +1 -1
- package/dist/bin/{shell/chunks/du-DH76GZJ3.js → chunks/du-YNAJTGCR.js} +1 -1
- package/dist/bin/{shell/chunks/find-MHC4QV6H.js → chunks/find-T3JZPTUX.js} +1 -1
- package/dist/bin/chunks/{flag-coverage-2H5CPEM6.js → flag-coverage-LVKHEUTL.js} +1 -1
- package/dist/bin/chunks/{gzip-UQZL4R74.js → gzip-EXJSFNCU.js} +1 -1
- package/dist/bin/chunks/js-exec-PLUMFEX6.js +99 -0
- package/dist/bin/chunks/js-exec-worker.js +4995 -0
- package/dist/bin/chunks/{ls-5Z45FV4U.js → ls-LOCOWLZ3.js} +1 -1
- package/dist/bin/chunks/{mkdir-YJ3SOVRP.js → mkdir-VHLJ3E65.js} +1 -1
- package/dist/bin/chunks/{mv-EOOP2TO3.js → mv-NAMOL2HF.js} +1 -1
- package/dist/bin/chunks/python3-J5GXF27H.js +14 -0
- package/dist/bin/{shell/chunks/readlink-EJ3IKLWW.js → chunks/readlink-BF435HNQ.js} +1 -1
- package/dist/bin/chunks/{rg-WHVR3YDT.js → rg-XF5U7GS2.js} +1 -1
- package/dist/bin/{shell/chunks/rm-B4LVIG7A.js → chunks/rm-L4RHENMV.js} +1 -1
- package/dist/bin/{shell/chunks/rmdir-PRNISPBA.js → chunks/rmdir-W73C4GEA.js} +1 -1
- package/dist/bin/{shell/chunks/sleep-DVFE2GSF.js → chunks/sleep-MOJQBZMY.js} +1 -1
- package/dist/bin/{shell/chunks/split-HIFKSV2A.js → chunks/split-2VXPZJJ4.js} +1 -1
- package/dist/bin/chunks/{sqlite3-KNN6V2W6.js → sqlite3-3S5HIA5W.js} +1 -1
- package/dist/bin/chunks/{timeout-YGFHQJKX.js → timeout-RQOWSWYG.js} +1 -1
- package/dist/bin/chunks/{which-4TPGVSBZ.js → which-G7X54RZL.js} +1 -1
- package/dist/bin/just-bash.js +243 -242
- package/dist/bin/shell/chunks/builtin-manifest-ORBIZM7I.js +3 -0
- package/dist/bin/shell/chunks/{chmod-GX5SYTRL.js → chmod-S4ARARR4.js} +1 -1
- package/dist/bin/shell/chunks/chunk-3ASHUC7C.js +44 -0
- package/dist/bin/{chunks/chunk-7WBCA2BB.js → shell/chunks/chunk-3DWQCLNP.js} +1 -1
- package/dist/bin/{chunks/chunk-3ROYEBJI.js → shell/chunks/chunk-4JPWP5WS.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-QFTZKD5O.js → chunk-6TUILMPB.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-DRPHNXG7.js → chunk-7LGT4LHQ.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-MBREBDZQ.js → chunk-AIWBN36Z.js} +1 -1
- package/dist/bin/shell/chunks/chunk-AQKIHX3Q.js +3 -0
- package/dist/bin/shell/chunks/chunk-E2O6S35K.js +10 -0
- package/dist/bin/shell/chunks/chunk-E54Z6VIE.js +12 -0
- package/dist/bin/{chunks/chunk-F2PYTUMR.js → shell/chunks/chunk-F4ACJZIY.js} +7 -6
- package/dist/bin/{chunks/chunk-MPFNZYEA.js → shell/chunks/chunk-GKJD4ULC.js} +1 -1
- package/dist/bin/{chunks/chunk-QJWFCA7P.js → shell/chunks/chunk-HARVZWUX.js} +1 -1
- package/dist/bin/shell/chunks/chunk-IRCAXXH6.js +14 -0
- package/dist/bin/shell/chunks/{chunk-T6OIISUC.js → chunk-K65FCSAT.js} +1 -1
- package/dist/bin/{chunks/chunk-MF3GVFLC.js → shell/chunks/chunk-L345YZ6R.js} +1 -1
- package/dist/bin/{chunks/chunk-6FGMEZZP.js → shell/chunks/chunk-MWQMHODV.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-BB5VTPMQ.js → chunk-NSI6LMDS.js} +1 -1
- package/dist/bin/{chunks/chunk-ABP4OLJV.js → shell/chunks/chunk-OXEDIWNZ.js} +1 -1
- package/dist/bin/shell/chunks/chunk-QKJAAJ7J.js +3 -0
- package/dist/bin/shell/chunks/{chunk-KMYJMEON.js → chunk-R7THHH4J.js} +1 -1
- package/dist/bin/shell/chunks/chunk-UBA7DOWE.js +3 -0
- package/dist/bin/shell/chunks/{chunk-VPSBWWXM.js → chunk-UNCYBFWT.js} +7 -6
- package/dist/bin/shell/chunks/chunk-VMVXACZ5.js +6 -0
- package/dist/bin/shell/chunks/chunk-Z3TCELKN.js +12 -0
- package/dist/bin/shell/chunks/{cp-YLP7ULVT.js → cp-WRBRHVVD.js} +1 -1
- package/dist/bin/shell/chunks/{diff-JSJ56EOK.js → diff-YLVT27CZ.js} +1 -1
- package/dist/bin/{chunks/du-DH76GZJ3.js → shell/chunks/du-YNAJTGCR.js} +1 -1
- package/dist/bin/{chunks/find-MHC4QV6H.js → shell/chunks/find-T3JZPTUX.js} +1 -1
- package/dist/bin/shell/chunks/{flag-coverage-2H5CPEM6.js → flag-coverage-LVKHEUTL.js} +1 -1
- package/dist/bin/shell/chunks/{gzip-UQZL4R74.js → gzip-EXJSFNCU.js} +1 -1
- package/dist/bin/shell/chunks/js-exec-PLUMFEX6.js +99 -0
- package/dist/bin/shell/chunks/{ls-5Z45FV4U.js → ls-LOCOWLZ3.js} +1 -1
- package/dist/bin/shell/chunks/{mkdir-YJ3SOVRP.js → mkdir-VHLJ3E65.js} +1 -1
- package/dist/bin/shell/chunks/{mv-EOOP2TO3.js → mv-NAMOL2HF.js} +1 -1
- package/dist/bin/shell/chunks/python3-J5GXF27H.js +14 -0
- package/dist/bin/{chunks/readlink-EJ3IKLWW.js → shell/chunks/readlink-BF435HNQ.js} +1 -1
- package/dist/bin/shell/chunks/{rg-WHVR3YDT.js → rg-XF5U7GS2.js} +1 -1
- package/dist/bin/{chunks/rm-B4LVIG7A.js → shell/chunks/rm-L4RHENMV.js} +1 -1
- package/dist/bin/{chunks/rmdir-PRNISPBA.js → shell/chunks/rmdir-W73C4GEA.js} +1 -1
- package/dist/bin/{chunks/sleep-DVFE2GSF.js → shell/chunks/sleep-MOJQBZMY.js} +1 -1
- package/dist/bin/{chunks/split-HIFKSV2A.js → shell/chunks/split-2VXPZJJ4.js} +1 -1
- package/dist/bin/shell/chunks/{sqlite3-KNN6V2W6.js → sqlite3-3S5HIA5W.js} +1 -1
- package/dist/bin/shell/chunks/{timeout-YGFHQJKX.js → timeout-RQOWSWYG.js} +1 -1
- package/dist/bin/shell/chunks/{which-4TPGVSBZ.js → which-G7X54RZL.js} +1 -1
- package/dist/bin/shell/shell.js +305 -304
- package/dist/bundle/browser.js +637 -611
- package/dist/bundle/chunks/builtin-manifest-7MJJDZ2T.js +2 -0
- package/dist/bundle/chunks/{chmod-TEY5MD2W.js → chmod-KMFNCMRX.js} +1 -1
- package/dist/bundle/chunks/chunk-2A4OZBCS.js +43 -0
- package/dist/bundle/chunks/{chunk-SE23TEGG.js → chunk-4CDTAUYP.js} +1 -1
- package/dist/bundle/chunks/chunk-4OKRFRMS.js +13 -0
- package/dist/bundle/chunks/{chunk-ATGOUOX2.js → chunk-4WRO2G22.js} +1 -1
- package/dist/bundle/chunks/{chunk-45QZRGYF.js → chunk-5KOWUQOZ.js} +7 -6
- package/dist/bundle/chunks/{chunk-6HO6HX7V.js → chunk-5NUTFEEG.js} +1 -1
- package/dist/bundle/chunks/{chunk-N3A4JVFJ.js → chunk-6IA4DXG2.js} +1 -1
- package/dist/bundle/chunks/{chunk-WE7BJ7YU.js → chunk-6IFH67ZB.js} +1 -1
- package/dist/bundle/chunks/chunk-6L6OYVLY.js +2 -0
- package/dist/bundle/chunks/chunk-BMBITA6Y.js +2 -0
- package/dist/bundle/chunks/chunk-BS6EJR2R.js +11 -0
- package/dist/bundle/chunks/{chunk-S6DNKKUL.js → chunk-CM4T4GB4.js} +1 -1
- package/dist/bundle/chunks/{chunk-MWL2I5BV.js → chunk-FXAKF2QS.js} +1 -1
- package/dist/bundle/chunks/chunk-H4AFUSSQ.js +9 -0
- package/dist/bundle/chunks/{chunk-GNPLDVBD.js → chunk-MMXJJCAE.js} +1 -1
- package/dist/bundle/chunks/{chunk-6QAM55HM.js → chunk-NFODJFHN.js} +1 -1
- package/dist/bundle/chunks/{chunk-LRFR25IP.js → chunk-O5OYOY3C.js} +7 -6
- package/dist/bundle/chunks/{chunk-HCKTU6IR.js → chunk-PASYAXFP.js} +1 -1
- package/dist/bundle/chunks/chunk-PS2RJNZZ.js +2 -0
- package/dist/bundle/chunks/chunk-THDUQVY3.js +11 -0
- package/dist/bundle/chunks/{chunk-DMWNBCXJ.js → chunk-TLPMB3FO.js} +1 -1
- package/dist/bundle/chunks/{chunk-FSKXIFYT.js → chunk-Y6UHNLT5.js} +1 -1
- package/dist/bundle/chunks/{chunk-XV2V56NQ.js → chunk-YFFU74KY.js} +1 -1
- package/dist/bundle/chunks/chunk-ZIQS5QAW.js +5 -0
- package/dist/bundle/chunks/{cp-UR762VVT.js → cp-P2D2L6PC.js} +1 -1
- package/dist/bundle/chunks/{diff-VDB6RXHO.js → diff-Z3XOLW44.js} +1 -1
- package/dist/bundle/chunks/{du-EQKH3UNA.js → du-YBSJVBXP.js} +1 -1
- package/dist/bundle/chunks/{find-RLKBCGJR.js → find-IUWEB4XQ.js} +1 -1
- package/dist/bundle/chunks/{flag-coverage-UMQ3BWDP.js → flag-coverage-SZ4AUPRQ.js} +1 -1
- package/dist/bundle/chunks/{gzip-KC5ENBD2.js → gzip-VUJBDHZ5.js} +1 -1
- package/dist/bundle/chunks/js-exec-6RW7WZCG.js +98 -0
- package/dist/bundle/chunks/js-exec-worker.js +4995 -0
- package/dist/bundle/chunks/{ls-WH5S4PPL.js → ls-ECKG2XHZ.js} +1 -1
- package/dist/bundle/chunks/{mkdir-Z6MMWH3D.js → mkdir-YL7XGMD7.js} +1 -1
- package/dist/bundle/chunks/{mv-WE7DBLEK.js → mv-IF55A2UD.js} +1 -1
- package/dist/bundle/chunks/python3-XHTOW7VA.js +13 -0
- package/dist/bundle/chunks/{readlink-JSRKXLLQ.js → readlink-7XGQ3PL7.js} +1 -1
- package/dist/bundle/chunks/{rg-JKB7DR66.js → rg-E6H2HACA.js} +1 -1
- package/dist/bundle/chunks/{rm-IGPLE632.js → rm-CWLMERIO.js} +1 -1
- package/dist/bundle/chunks/{rmdir-3WTXMVKI.js → rmdir-WKKBLZ54.js} +1 -1
- package/dist/bundle/chunks/{sleep-PPRBTSVR.js → sleep-25QUPVDK.js} +1 -1
- package/dist/bundle/chunks/{split-HUKVGJTW.js → split-NEU2K2YN.js} +1 -1
- package/dist/bundle/chunks/{sqlite3-KB3MXTTM.js → sqlite3-KJ5NMKBM.js} +1 -1
- package/dist/bundle/chunks/{timeout-C6WDYPLV.js → timeout-37GM7IIL.js} +1 -1
- package/dist/bundle/chunks/{which-UWVKETYW.js → which-BP5YY5BR.js} +1 -1
- package/dist/bundle/index.cjs +1134 -2660
- package/dist/bundle/index.js +210 -209
- package/dist/commands/js-exec/js-exec-worker.d.ts +35 -0
- package/dist/commands/js-exec/js-exec.d.ts +14 -1
- package/dist/commands/which/which.d.ts +10 -0
- package/dist/custom-commands.d.ts +5 -0
- package/dist/fs/path-utils.d.ts +0 -4
- package/dist/fs/vfs-template.d.ts +6 -0
- package/dist/interpreter/interpreter.d.ts +1 -1
- package/dist/interpreter/types.d.ts +1 -1
- package/dist/limits.d.ts +2 -5
- package/dist/timers.d.ts +9 -0
- package/dist/types.d.ts +9 -4
- package/package.json +8 -8
- package/dist/bin/chunks/chunk-2NJJXU4K.js +0 -27
- package/dist/bin/chunks/chunk-6JUPBMCR.js +0 -13
- package/dist/bin/chunks/chunk-CN4JKMTR.js +0 -8
- package/dist/bin/chunks/chunk-HWK7KFGB.js +0 -3
- package/dist/bin/chunks/chunk-PPVF2N6C.js +0 -3
- package/dist/bin/chunks/chunk-RTN6X652.js +0 -11
- package/dist/bin/chunks/chunk-RVPTAYDS.js +0 -4
- package/dist/bin/chunks/js-exec-T3SAB2B6.js +0 -1651
- package/dist/bin/chunks/python3-3ERN3L6S.js +0 -23
- package/dist/bin/shell/chunks/chunk-2NJJXU4K.js +0 -27
- package/dist/bin/shell/chunks/chunk-6JUPBMCR.js +0 -13
- package/dist/bin/shell/chunks/chunk-CN4JKMTR.js +0 -8
- package/dist/bin/shell/chunks/chunk-HWK7KFGB.js +0 -3
- package/dist/bin/shell/chunks/chunk-PPVF2N6C.js +0 -3
- package/dist/bin/shell/chunks/chunk-RTN6X652.js +0 -11
- package/dist/bin/shell/chunks/chunk-RVPTAYDS.js +0 -4
- package/dist/bin/shell/chunks/js-exec-T3SAB2B6.js +0 -1651
- package/dist/bin/shell/chunks/python3-3ERN3L6S.js +0 -23
- package/dist/bundle/chunks/chunk-2SMD2AUA.js +0 -3
- package/dist/bundle/chunks/chunk-3OBCZP7T.js +0 -12
- package/dist/bundle/chunks/chunk-4CC3OZPU.js +0 -2
- package/dist/bundle/chunks/chunk-A257L6QO.js +0 -7
- package/dist/bundle/chunks/chunk-B6OSJB22.js +0 -26
- package/dist/bundle/chunks/chunk-RWQWFXMH.js +0 -10
- package/dist/bundle/chunks/chunk-WXPNKIIH.js +0 -2
- package/dist/bundle/chunks/js-exec-ZQMIYQTH.js +0 -1650
- package/dist/bundle/chunks/python3-QB7OE256.js +0 -22
- package/dist/commands/js-exec/run-runtime.d.ts +0 -10
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{a as K}from"./chunk-7WBCA2BB.js";import{a as G}from"./chunk-3MRB66F4.js";import{b as q}from"./chunk-O2BCKSMK.js";import{a as Y,b as E}from"./chunk-TW2IJRUF.js";import{c as B,d as v}from"./chunk-PPVF2N6C.js";import{a as Q}from"./chunk-MROECM42.js";import{c as _}from"./chunk-42AMF6EE.js";import{b as N}from"./chunk-HWI42GQO.js";import{b as U}from"./chunk-CPKBPQ2C.js";import{a as z,b as $}from"./chunk-OHFB3M3X.js";import{a as D,b as g}from"./chunk-PBOVSFTJ.js";import{a as C}from"./chunk-I4IRHQDW.js";import{a as W,b as H}from"./chunk-MUFNRCMY.js";import"./chunk-DN2YCFOR.js";import{fileURLToPath as st}from"node:url";import{Worker as ot}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,RENAME:14,COPY_FILE:15,WRITE_FILE_RANGE:17,READ_RESULT_RANGE:18,WRITE_STDOUT:100,WRITE_STDERR:101,EXIT:102,HTTP_REQUEST:200,EXEC_COMMAND:300,INVOKE_TOOL:400},y={IDLE:0,REQUEST:1,CANCELLED:2},a={NONE:0,SUCCESS:1,ERROR:2},h={NONE:0,NOT_FOUND:1,IS_DIRECTORY:2,NOT_DIRECTORY:3,EXISTS:4,PERMISSION_DENIED:5,INVALID_PATH:6,IO_ERROR:7,NETWORK_ERROR:9,NETWORK_NOT_CONFIGURED:10,NOT_EMPTY:11,LOOP:12,FILE_TOO_LARGE:13,NO_SPACE:14,BUSY:15,READ_ONLY:16,CROSS_DEVICE:17},M=Object.assign(Object.create(null),{ENOENT:h.NOT_FOUND,EISDIR:h.IS_DIRECTORY,ENOTDIR:h.NOT_DIRECTORY,ENOTEMPTY:h.NOT_EMPTY,EEXIST:h.EXISTS,EPERM:h.PERMISSION_DENIED,EACCES:h.PERMISSION_DENIED,EINVAL:h.INVALID_PATH,ELOOP:h.LOOP,EFBIG:h.FILE_TOO_LARGE,ENOSPC:h.NO_SPACE,EBUSY:h.BUSY,EROFS:h.READ_ONLY,EXDEV:h.CROSS_DEVICE}),tt=Object.create(null);for(let[o,t]of Object.entries(M))tt[t]=o;var i={OP_CODE:0,REQUEST:4,PATH_LENGTH:8,DATA_LENGTH:12,RESULT_LENGTH:16,ERROR_CODE:20,FLAGS:24,MODE:28,RESULT_STATE:32,PATH_BUFFER:36,DATA_BUFFER:4132},O={PATH_BUFFER:4096,DATA_BUFFER:8388608,TOTAL:8392740},I={NONE:0,RECURSIVE:1,FORCE:2,MKDIR_RECURSIVE:1},f={IS_FILE:0,IS_DIRECTORY:1,IS_SYMLINK:2,MODE:4,SIZE:8,MTIME:16,TOTAL:24};function X(){return new Y(O.TOTAL)}var k=class{int32View;uint8View;dataView;constructor(t){this.int32View=new Int32Array(t),this.uint8View=new Uint8Array(t),this.dataView=new DataView(t)}getOpCode(){return E.load(this.int32View,i.OP_CODE/4)}setOpCode(t){E.store(this.int32View,i.OP_CODE/4,t)}getRequest(){return E.load(this.int32View,i.REQUEST/4)}setRequest(t){E.store(this.int32View,i.REQUEST/4,t)}getResultState(){return E.load(this.int32View,i.RESULT_STATE/4)}setResultState(t){E.store(this.int32View,i.RESULT_STATE/4,t)}getPathLength(){return E.load(this.int32View,i.PATH_LENGTH/4)}setPathLength(t){E.store(this.int32View,i.PATH_LENGTH/4,t)}getDataLength(){return E.load(this.int32View,i.DATA_LENGTH/4)}setDataLength(t){E.store(this.int32View,i.DATA_LENGTH/4,t)}getResultLength(){return E.load(this.int32View,i.RESULT_LENGTH/4)}setResultLength(t){E.store(this.int32View,i.RESULT_LENGTH/4,t)}getErrorCode(){return E.load(this.int32View,i.ERROR_CODE/4)}setErrorCode(t){E.store(this.int32View,i.ERROR_CODE/4,t)}getFlags(){return E.load(this.int32View,i.FLAGS/4)}setFlags(t){E.store(this.int32View,i.FLAGS/4,t)}getMode(){return E.load(this.int32View,i.MODE/4)}setMode(t){E.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>O.PATH_BUFFER)throw new Error(`Path too long: ${e.length} > ${O.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>O.DATA_BUFFER)throw new Error(`Data too large: ${t.length} > ${O.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>O.DATA_BUFFER)throw new Error(`Result too large: ${t.length} > ${O.DATA_BUFFER}`);this.uint8View.set(t,i.DATA_BUFFER),this.setResultLength(t.length)}setResultPrefix(t){if(t.length>2147483647)throw new Error(`Result too large: ${t.length} exceeds int32`);let e=Math.min(t.length,O.DATA_BUFFER);this.uint8View.set(t.subarray(0,e),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+f.IS_FILE]=t.isFile?1:0,this.uint8View[i.DATA_BUFFER+f.IS_DIRECTORY]=t.isDirectory?1:0,this.uint8View[i.DATA_BUFFER+f.IS_SYMLINK]=t.isSymbolicLink?1:0,this.dataView.setInt32(i.DATA_BUFFER+f.MODE,t.mode,!0);let e=Math.min(t.size,Number.MAX_SAFE_INTEGER);this.dataView.setFloat64(i.DATA_BUFFER+f.SIZE,e,!0),this.dataView.setFloat64(i.DATA_BUFFER+f.MTIME,t.mtime.getTime(),!0),this.setResultLength(f.TOTAL)}decodeStat(){return{isFile:this.uint8View[i.DATA_BUFFER+f.IS_FILE]===1,isDirectory:this.uint8View[i.DATA_BUFFER+f.IS_DIRECTORY]===1,isSymbolicLink:this.uint8View[i.DATA_BUFFER+f.IS_SYMLINK]===1,mode:this.dataView.getInt32(i.DATA_BUFFER+f.MODE,!0),size:this.dataView.getFloat64(i.DATA_BUFFER+f.SIZE,!0),mtime:new Date(this.dataView.getFloat64(i.DATA_BUFFER+f.MTIME,!0))}}async waitUntilReady(t){let e=Date.now();for(;;){let s=this.getRequest();if(s===y.REQUEST)return!0;if(s!==y.IDLE)return!1;let r=Date.now()-e;if(r>=t)return!1;let n=t-r,l=E.waitAsync(this.int32View,i.REQUEST/4,y.IDLE,n);if(l.async&&await l.value==="timed-out")return!1}}waitForResult(t){return E.wait(this.int32View,i.RESULT_STATE/4,a.NONE,t)}notifyRequest(){return E.notify(this.int32View,i.REQUEST/4)}notifyResult(){return E.notify(this.int32View,i.RESULT_STATE/4)}reset(){this.setOpCode(u.NOOP),this.setRequest(y.IDLE),this.setResultState(a.NONE),this.setPathLength(0),this.setDataLength(0),this.setResultLength(0),this.setErrorCode(h.NONE),this.setFlags(I.NONE),this.setMode(0)}};function et(o){return o!==void 0&&Object.hasOwn(M,o)?M[o]:h.IO_ERROR}var b=class{fs;cwd;commandName;secureFetch;maxOutputSize;exec;invokeTool;protocol;running=!1;output={stdout:"",stderr:"",exitCode:0};outputLimitExceeded=!1;startTime=0;timeoutMs=0;lastResult=null;constructor(t,e,s,r,n=void 0,l=0,R=void 0,p=void 0){this.fs=e,this.cwd=s,this.commandName=r,this.secureFetch=n,this.maxOutputSize=l,this.exec=R,this.invokeTool=p,this.protocol=new k(t)}remainingMs(){return Math.max(0,this.timeoutMs-(Date.now()-this.startTime))}raceDeadline(t){let e=this.remainingMs();if(e<=0)return this.running=!1,this.output.exitCode=124,this.output.stderr+=`
|
|
4
|
-
${this.commandName}: execution timeout exceeded
|
|
5
|
-
`,Promise.reject(new Error("Operation timed out"));let s=t();return e===Number.POSITIVE_INFINITY?s:new Promise((r,n)=>{let l=B(()=>{this.running=!1,this.output.exitCode=124,this.output.stderr+=`
|
|
6
|
-
${this.commandName}: execution timeout exceeded
|
|
7
|
-
`,n(new Error("Operation timed out"))},e);s.then(R=>{v(l),r(R)},R=>{v(l),n(R)})})}async run(t){for(this.running=!0,this.startTime=Date.now(),this.timeoutMs=t;this.running;){if(Date.now()-this.startTime>=t){this.output.stderr+=`
|
|
8
|
-
${this.commandName}: execution timeout exceeded
|
|
9
|
-
`,this.output.exitCode=124;break}let s=this.remainingMs();if(!await this.protocol.waitUntilReady(s)){if(!this.running)break;this.output.stderr+=`
|
|
10
|
-
${this.commandName}: execution timeout exceeded
|
|
11
|
-
`,this.output.exitCode=124;break}if(!this.running)break;this.protocol.setRequest(y.IDLE);let n=this.protocol.getOpCode();await this.handleOperation(n),this.protocol.notifyResult()}return this.output}stop(){this.running=!1,this.lastResult=null,this.protocol.setRequest(y.CANCELLED),this.protocol.notifyRequest()}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.READ_RESULT_RANGE:this.handleReadResultRange();break;case u.WRITE_FILE_RANGE:await this.handleWriteFileRange();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.RENAME:await this.handleRename();break;case u.COPY_FILE:await this.handleCopyFile();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;case u.EXEC_COMMAND:await this.handleExecCommand();break;case u.INVOKE_TOOL:await this.handleInvokeTool();break;default:this.protocol.setErrorCode(h.IO_ERROR),this.protocol.setResultState(a.ERROR)}}catch(e){this.setErrorFromException(e)}}publishResult(t){let e=typeof t=="string"?new TextEncoder().encode(t):t;this.lastResult=e,this.protocol.setResultPrefix(e),this.protocol.setResultState(a.SUCCESS)}handleReadResultRange(){let t=this.protocol.getFlags(),e=this.protocol.getMode(),s=this.lastResult;if(!s||t>=s.length){this.protocol.setErrorCode(h.IO_ERROR),this.protocol.setResultFromString(`No retained result for range read (offset=${t}, length=${e}, retained=${s?.length??"none"})`),this.protocol.setResultState(a.ERROR);return}this.protocol.setResult(s.subarray(t,t+e)),this.protocol.setResultState(a.SUCCESS)}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.publishResult(e)}catch(e){this.setErrorFromException(e)}}async handleWriteFileRange(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getFlags(),s=this.protocol.getData();try{if(e===0)await this.fs.writeFile(t,s);else{let r=await this.fs.stat(t);if(r.size!==e)throw new z("EIO",`non-sequential range write to '${t}': offset ${e} != size ${r.size}`);await this.fs.appendFile(t,s)}this.protocol.setResultState(a.SUCCESS)}catch(r){this.setErrorFromException(r)}}async handleWriteFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.writeFile(t,e),this.protocol.setResultState(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.setResultState(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.setResultState(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.publishResult(JSON.stringify(e))}catch(e){this.setErrorFromException(e)}}async handleMkdir(){let t=this.resolvePath(this.protocol.getPath()),s=(this.protocol.getFlags()&I.MKDIR_RECURSIVE)!==0;try{await this.fs.mkdir(t,{recursive:s}),this.protocol.setResultState(a.SUCCESS)}catch(r){this.setErrorFromException(r)}}async handleRm(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getFlags(),s=(e&I.RECURSIVE)!==0,r=(e&I.FORCE)!==0;try{await this.fs.rm(t,{recursive:s,force:r}),this.protocol.setResultState(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.setResultState(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.setResultState(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.setResultState(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.setResultState(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.setResultState(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.setResultState(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleRename(){let t=this.resolvePath(this.protocol.getPath()),e=this.resolvePath(this.protocol.getDataAsString());try{await this.fs.mv(t,e),this.protocol.setResultState(a.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleCopyFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.resolvePath(this.protocol.getDataAsString());try{await this.fs.cp(t,e),this.protocol.setResultState(a.SUCCESS)}catch(s){this.setErrorFromException(s)}}handleWriteStdout(){let t=this.protocol.getDataAsString();if(!this.tryAppendOutput("stdout",t)){this.outputLimitExceeded=!0,this.output.exitCode=1,this.appendOutputLimitError(),this.protocol.setErrorCode(h.IO_ERROR),this.protocol.setResultFromString("Output size limit exceeded"),this.protocol.setResultState(a.ERROR);return}this.protocol.setResultState(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(h.IO_ERROR),this.protocol.setResultFromString("Output size limit exceeded"),this.protocol.setResultState(a.ERROR);return}this.protocol.setResultState(a.SUCCESS)}handleExit(){let t=this.protocol.getFlags();this.outputLimitExceeded?this.output.exitCode===0&&(this.output.exitCode=1):this.output.exitCode=t,this.protocol.setResultState(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=`${this.commandName}: total output size exceeded (>${this.maxOutputSize} bytes), increase executionLimits.maxOutputSize
|
|
12
|
-
`,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(){let t=this.secureFetch;if(!t){this.protocol.setErrorCode(h.NETWORK_NOT_CONFIGURED),this.protocol.setResultFromString("Network access not configured. Enable network in Bash options."),this.protocol.setResultState(a.ERROR);return}let e=this.protocol.getPath(),s=this.protocol.getDataAsString();try{let r=s?JSON.parse(s):{},n=this.remainingMs(),l=await this.raceDeadline(()=>t(e,{method:r.method,headers:r.headers,body:r.body,timeoutMs:n})),R=JSON.stringify({status:l.status,statusText:l.statusText,headers:l.headers,bodyBase64:q(l.body,"base64"),url:l.url});this.publishResult(R)}catch(r){let n=D(r instanceof Error?r.message:String(r));this.protocol.setErrorCode(h.NETWORK_ERROR),this.protocol.setResultFromString(n),this.protocol.setResultState(a.ERROR)}}async handleExecCommand(){let t=this.exec;if(!t){this.protocol.setErrorCode(h.IO_ERROR),this.protocol.setResultFromString("Command execution not available in this context."),this.protocol.setResultState(a.ERROR);return}let e=this.protocol.getPath(),s=this.protocol.getDataAsString(),r=new AbortController;try{let n={cwd:this.cwd,signal:r.signal};if(s){let p=JSON.parse(s);p.stdin&&(n.stdin=p.stdin),p.args&&Array.isArray(p.args)&&(n.args=p.args.map(m=>String(m)),e=G([e]))}let l=await this.raceDeadline(()=>t(e,n)),R=JSON.stringify({stdout:l.stdout,stderr:l.stderr,exitCode:l.exitCode});this.publishResult(R)}catch(n){r.abort();let l=n instanceof Error?n.message:String(n);this.protocol.setErrorCode(h.IO_ERROR),this.protocol.setResultFromString(l),this.protocol.setResultState(a.ERROR)}}async handleInvokeTool(){let t=this.invokeTool;if(!t){this.protocol.setErrorCode(h.IO_ERROR),this.protocol.setResultFromString("Tool invocation not available in this context."),this.protocol.setResultState(a.ERROR);return}let e=this.protocol.getPath(),s=this.protocol.getDataAsString();try{let r=await this.raceDeadline(()=>N.runTrustedAsync(()=>t(e,s)));this.publishResult(r)}catch(r){let n=g(r instanceof Error?r.message:String(r));this.protocol.setErrorCode(h.IO_ERROR),this.protocol.setResultFromString(n),this.protocol.setResultState(a.ERROR)}}setErrorFromException(t){let e=t instanceof Error?t.message:String(t),s=D(e);this.protocol.setErrorCode(et($(t))),this.protocol.setResultFromString(s),this.protocol.setResultState(a.ERROR)}};var rt={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 it(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'
|
|
13
|
-
`,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'
|
|
14
|
-
`,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}'
|
|
15
|
-
`,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 V=new WeakMap;function nt(o){let t=V.get(o);return t||(t={executionQueue:[],activeExecution:null,poisonedError:null},V.set(o,t)),t}function Ut(){V=new WeakMap}var at=st(new URL("./worker.js",import.meta.url));function ct(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 P(o){if(o.poisonedError!==null){for(let c of o.executionQueue.splice(0))c.state==="queued"&&(c.state="settled",c.stopBridge(),c.settle({success:!1,error:o.poisonedError}));return}if(o.activeExecution!==null||o.executionQueue.length===0)return;for(;o.executionQueue.length>0&&o.executionQueue[0]?.state!=="queued";)o.executionQueue.shift();if(o.executionQueue.length===0)return;let t=o.executionQueue.shift();if(!t)return;t.state="running",o.activeExecution=t;let e;try{e=N.runTrusted(()=>new ot(at,{workerData:t.input}))}catch(c){let d=c instanceof Error?c.message:String(c);t.state="settled",t.settle({success:!1,error:g(d)}),o.activeExecution===t&&(o.activeExecution=null,P(o));return}t.worker=e;let s=!0,r=()=>{s&&(s=!1,e.removeListener("message",m),e.removeListener("error",A),e.removeListener("exit",L))},n=async(c,d)=>{if(!(o.activeExecution?.executionId!==t.executionId||t.state!=="running")){if(t.state="terminating",r(),t.settle(c),d&&!await t.controller.terminate(e)){let w="Worker termination was not acknowledged";t.worker=null,t.state="settled",o.poisonedError=w,o.activeExecution?.executionId===t.executionId&&(o.activeExecution=null),P(o);return}t.worker=null,t.state="settled",o.activeExecution?.executionId===t.executionId&&(o.activeExecution=null,P(o))}};t.cancel=c=>{n(c,!0)};let l=_(t.requireDefenseContext,"python3","worker message callback",c=>{try{t.controller.assertMessageSize(c,"response")}catch(d){n({success:!1,error:g(C(d))},!0);return}n(ct(c,t.input.protocolToken),!0)}),R=_(t.requireDefenseContext,"python3","worker error callback",c=>{let d=g(C(c));n({success:!1,error:d},!0)}),p=_(t.requireDefenseContext,"python3","worker exit callback",()=>{n({success:!1,error:"Worker exited unexpectedly"},!1)}),m=c=>{try{l(c)}catch(d){let S=d instanceof Error?d.message:String(d);n({success:!1,error:g(S)},!0)}},A=c=>{try{R(c)}catch(d){let S=d instanceof Error?d.message:String(d);n({success:!1,error:g(S)},!0)}},L=()=>{try{p()}catch(c){let d=c instanceof Error?c.message:String(c);n({success:!1,error:g(d)},!0)}};e.on("message",m),e.on("error",A),e.on("exit",L)}async function lt(o,t,e,s,r=[]){let n=X(),l=new b(n,e.fs,e.cwd,"python3",e.fetch,e.limits.maxOutputSize),R=e.limits.maxPythonTimeoutMs,p=nt(e.fs);if(p.poisonedError!==null)return{stdout:"",stderr:`python3: ${p.poisonedError}
|
|
16
|
-
`,exitCode:1};let m=new K({commandName:"python3",timeoutMs:R,signal:e.signal,maxMessageBytes:e.limits.maxWorkerMessageBytes}),A={protocolToken:m.protocolToken,sharedBuffer:n,pythonCode:o,stdin:t,cwd:e.cwd,env:Q(e.env),args:r,scriptPath:s,timeoutMs:R,maxFileSize:e.limits.maxStringLength};m.assertMessageSize({...A,sharedBuffer:void 0},"request");let L=new Promise(S=>{let w=!1,T={executionId:Symbol("python3 execution"),input:A,settle:F=>{w||(w=!0,m.close(),S(F))},requireDefenseContext:e.requireDefenseContext,state:"queued",worker:null,controller:m,stopBridge:()=>l.stop?.(),cancel:()=>{}};T.cancel=F=>{if(T.state!=="queued")return;T.state="settled";let x=p.executionQueue.indexOf(T);x!==-1&&p.executionQueue.splice(x,1),T.settle(F),P(p)};let J=_(e.requireDefenseContext,"python3","worker cancellation callback",F=>{l.stop?.(),T.cancel({success:!1,error:F==="abort"?m.abortMessage():m.timeoutMessage()})}),j=F=>{try{J(F)}catch(x){let Z=x instanceof Error?x.message:String(x);T.cancel({success:!1,error:g(Z)})}};m.arm(j),m.isCanceled||(p.executionQueue.push(T),P(p))}),[c,d]=await Promise.all([l.run(R).catch(S=>({stdout:"",stderr:`python3: bridge error: ${g(C(S))}
|
|
17
|
-
`,exitCode:1})),L.catch(S=>({success:!1,error:g(C(S))}))]);if(!d.success&&d.error){let S=g(d.error),w=d.error===m.timeoutMessage()||d.error===m.abortMessage();return{stdout:c.stdout,stderr:`${c.stderr}python3: ${S}
|
|
18
|
-
`,exitCode:c.exitCode||(w?124:1)}}return{...c}}var ht={name:"python3",async execute(o,t){if(H(o))return W(rt);let e=it(o);if("exitCode"in e)return e;if(e.showVersion)return{stdout:`Python 3.13.2 (Emscripten)
|
|
19
|
-
`,stderr:"",exitCode:0};let s,r,n=t.stdin;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)}'
|
|
20
|
-
`,exitCode:1};s=`import runpy; runpy.run_module('${e.module}', run_name='__main__')`,r=e.module}else if(e.scriptFile==="-")s=U(t.stdin),n="",r="-";else if(e.scriptFile!==null){let l=t.fs.resolvePath(t.cwd,e.scriptFile);if(!await t.fs.exists(l))return{stdout:"",stderr:`python3: can't open file '${e.scriptFile}': [Errno 2] No such file or directory
|
|
21
|
-
`,exitCode:2};try{s=await t.fs.readFile(l),r=e.scriptFile}catch(R){let p=D(R.message);return{stdout:"",stderr:`python3: can't open file '${e.scriptFile}': ${p}
|
|
22
|
-
`,exitCode:2}}}else if(U(t.stdin).trim())s=U(t.stdin),n="",r="<stdin>";else return{stdout:"",stderr:`python3: no input provided (use -c CODE, -m MODULE, or provide a script file)
|
|
23
|
-
`,exitCode:2};return lt(s,n,t,r,e.scriptArgs)}},kt={name:"python",async execute(o,t){return ht.execute(o,t)}};export{Ut as _resetExecutionQueue,ht as python3Command,kt as pythonCommand};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{b as E}from"./chunk-CPKBPQ2C.js";import{a as M}from"./chunk-NE4R2FVV.js";import{a as A,b as j}from"./chunk-MUFNRCMY.js";var S=class{diff(t,o,e={}){let i;typeof e=="function"?(i=e,e={}):"callback"in e&&(i=e.callback);let s=this.castInput(t,e),f=this.castInput(o,e),a=this.removeEmpty(this.tokenize(s,e)),n=this.removeEmpty(this.tokenize(f,e));return this.diffWithOptionsObj(a,n,e,i)}diffWithOptionsObj(t,o,e,i){var s;let f=d=>{if(d=this.postProcess(d,e),i){setTimeout(function(){i(d)},0);return}else return d},a=o.length,n=t.length,u=1,l=a+n;e.maxEditLength!=null&&(l=Math.min(l,e.maxEditLength));let c=(s=e.timeout)!==null&&s!==void 0?s:1/0,m=Date.now()+c,h=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(h[0],o,t,0,e);if(h[0].oldPos+1>=n&&p+1>=a)return f(this.buildValues(h[0].lastComponent,o,t));let C=-1/0,w=1/0,P=()=>{for(let d=Math.max(C,-u);d<=Math.min(w,u);d+=2){let x,y=h[d-1],v=h[d+1];y&&(h[d-1]=void 0);let $=!1;if(v){let I=v.oldPos-d;$=v&&0<=I&&I<a}let N=y&&y.oldPos+1<n;if(!$&&!N){h[d]=void 0;continue}if(!N||$&&y.oldPos<v.oldPos?x=this.addToPath(v,!0,!1,0,e):x=this.addToPath(y,!1,!0,1,e),p=this.extractCommon(x,o,t,d,e),x.oldPos+1>=n&&p+1>=a)return f(this.buildValues(x.lastComponent,o,t))||!0;h[d]=x,x.oldPos+1>=n&&(w=Math.min(w,d-1)),p+1>=a&&(C=Math.max(C,d+1))}u++};if(i)(function d(){setTimeout(function(){if(u>l||Date.now()>m)return i(void 0);P()||d()},0)})();else for(;u<=l&&Date.now()<=m;){let d=P();if(d)return d}}addToPath(t,o,e,i,s){let f=t.lastComponent;return f&&!s.oneChangePerToken&&f.added===o&&f.removed===e?{oldPos:t.oldPos+i,lastComponent:{count:f.count+1,added:o,removed:e,previousComponent:f.previousComponent}}:{oldPos:t.oldPos+i,lastComponent:{count:1,added:o,removed:e,previousComponent:f}}}extractCommon(t,o,e,i,s){let f=o.length,a=e.length,n=t.oldPos,u=n-i,l=0;for(;u+1<f&&n+1<a&&this.equals(e[n+1],o[u+1],s);)u++,n++,l++,s.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return l&&!s.oneChangePerToken&&(t.lastComponent={count:l,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=n,u}equals(t,o,e){return e.comparator?e.comparator(t,o):t===o||!!e.ignoreCase&&t.toLowerCase()===o.toLowerCase()}removeEmpty(t){let o=[];for(let e=0;e<t.length;e++)t[e]&&o.push(t[e]);return o}castInput(t,o){return t}tokenize(t,o){return Array.from(t)}join(t){return t.join("")}postProcess(t,o){return t}get useLongestToken(){return!1}buildValues(t,o,e){let i=[],s;for(;t;)i.push(t),s=t.previousComponent,delete t.previousComponent,t=s;i.reverse();let f=i.length,a=0,n=0,u=0;for(;a<f;a++){let l=i[a];if(l.removed)l.value=this.join(e.slice(u,u+l.count)),u+=l.count;else{if(!l.added&&this.useLongestToken){let c=o.slice(n,n+l.count);c=c.map(function(m,h){let p=e[u+h];return p.length>m.length?p:m}),l.value=this.join(c)}else l.value=this.join(o.slice(n,n+l.count));n+=l.count,l.added||(u+=l.count)}}return i}};var b=class extends S{tokenize(t){return t.slice()}join(t){return t}removeEmpty(t){return t}},z=new b;function T(r,t,o){return z.diff(r,t,o)}var Y=`\
|
|
4
|
-
`,D=3;function F(r){if(r==="")return{lines:[],noEol:!1};let t=!r.endsWith(`
|
|
5
|
-
`),o=r.split(`
|
|
6
|
-
`);return t||o.pop(),{lines:o,noEol:t}}function O(r,t){let o=r.lines.length-1;return r.lines.map((e,i)=>{let s=i===o&&r.noEol?e:`${e}
|
|
7
|
-
`;return t?s.toLowerCase():s})}function q(r,t,o){let e=T(O(r,o),O(t,o)),i=[],s=0,f=0,a=0;for(;a<e.length;){let n=e[a];if(!n.added&&!n.removed){s+=n.count??n.value.length,f+=n.count??n.value.length,a++;continue}let u={oldStart:s,oldCount:0,newStart:f,newCount:0};for(;a<e.length&&(e[a].added||e[a].removed);){let l=e[a].count??e[a].value.length;e[a].removed?(u.oldCount+=l,s+=l):(u.newCount+=l,f+=l),a++}i.push(u)}return i}function L(r){if(!/[\s"\u0000-\u001f\u007f]/.test(r))return r;let t='"';for(let o of r)o==='"'||o==="\\"?t+=`\\${o}`:o===" "?t+="\\t":o===`
|
|
8
|
-
`?t+="\\n":o==="\r"?t+="\\r":o<" "||o==="\x7F"?t+=`\\${o.charCodeAt(0).toString(8).padStart(3,"0")}`:t+=o;return`${t}"`}function g(r,t,o,e){r.push(`${e}${t.lines[o]}
|
|
9
|
-
`),t.noEol&&o===t.lines.length-1&&r.push(Y)}function W(r,t){return t===0?String(r):t===1?String(r+1):`${r+1},${r+t}`}function U(r,t,o){let e=[];for(let i of o){let s=i.oldCount===0?"a":i.newCount===0?"d":"c";e.push(`${W(i.oldStart,i.oldCount)}${s}${W(i.newStart,i.newCount)}
|
|
10
|
-
`);for(let f=0;f<i.oldCount;f++)g(e,r,i.oldStart+f,"< ");s==="c"&&e.push(`---
|
|
11
|
-
`);for(let f=0;f<i.newCount;f++)g(e,t,i.newStart+f,"> ")}return e.join("")}function k(r,t){let o=[],e=[];for(let i of r){let s=e[e.length-1];s&&i.oldStart-(s.oldStart+s.oldCount)>2*t&&(o.push(e),e=[]),e.push(i)}return e.length>0&&o.push(e),o}function V(r,t,o,e){let i=r[0],s=r[r.length-1];return{oldFrom:Math.max(0,i.oldStart-e),oldTo:Math.min(t.lines.length,s.oldStart+s.oldCount+e),newFrom:Math.max(0,i.newStart-e),newTo:Math.min(o.lines.length,s.newStart+s.newCount+e)}}function _(r,t){let o=t-r;return o===0?`${r},0`:o===1?String(r+1):`${r+1},${o}`}function X(r,t,o,e,i,s){let f=[`--- ${L(r)}
|
|
12
|
-
`,`+++ ${L(t)}
|
|
13
|
-
`];for(let a of k(i,s)){let n=V(a,o,e,s);f.push(`@@ -${_(n.oldFrom,n.oldTo)} +${_(n.newFrom,n.newTo)} @@
|
|
14
|
-
`);let u=n.oldFrom;for(let l of a){for(;u<l.oldStart;u++)g(f,o,u," ");for(let c=0;c<l.oldCount;c++)g(f,o,l.oldStart+c,"-");for(let c=0;c<l.newCount;c++)g(f,e,l.newStart+c,"+");u=l.oldStart+l.oldCount}for(;u<n.oldTo;u++)g(f,o,u," ")}return f.join("")}function H(r,t){let o=t-r;return o===0?String(r):o===1?String(r+1):`${r+1},${t}`}function R(r,t,o,e,i,s){if(!o.some(n=>(s?n.oldCount:n.newCount)>0))return;let a=e;for(let n of o){let u=s?n.oldStart:n.newStart,l=s?n.oldCount:n.newCount;for(;a<u;a++)g(r,t,a," ");let c=n.oldCount>0&&n.newCount>0?"! ":s?"- ":"+ ";for(let m=0;m<l;m++)g(r,t,u+m,c);a=u+l}for(;a<i;a++)g(r,t,a," ")}function B(r,t,o,e,i,s){let f=[`*** ${L(r)}
|
|
15
|
-
`,`--- ${L(t)}
|
|
16
|
-
`];for(let a of k(i,s)){let n=V(a,o,e,s);f.push(`***************
|
|
17
|
-
`),f.push(`*** ${H(n.oldFrom,n.oldTo)} ****
|
|
18
|
-
`),R(f,o,a,n.oldFrom,n.oldTo,!0),f.push(`--- ${H(n.newFrom,n.newTo)} ----
|
|
19
|
-
`),R(f,e,a,n.newFrom,n.newTo,!1)}return f.join("")}var G={name:"diff",summary:"compare files line by line",usage:"diff [OPTION]... FILE1 FILE2",options:[" --normal output a normal diff (default)","-u, --unified output a unified diff","-c, --context output a context diff","-q, --brief report only whether files differ","-s, --report-identical-files report when files are the same","-i, --ignore-case ignore case differences"," --version output version information and exit"," --help display this help and exit"]},K={normal:{long:"normal",type:"boolean"},unified:{short:"u",long:"unified",type:"boolean"},context:{short:"c",long:"context",type:"boolean"},brief:{short:"q",long:"brief",type:"boolean"},reportSame:{short:"s",long:"report-identical-files",type:"boolean"},ignoreCase:{short:"i",long:"ignore-case",type:"boolean"},version:{long:"version",type:"boolean"}},ft={name:"diff",async execute(r,t){if(j(r))return A(G);let o=M("diff",r,K);if(!o.ok)return o.error;let e=o.result.flags;if(e.version)return{stdout:`diff (just-bash)
|
|
20
|
-
`,stderr:"",exitCode:0};if(Number(e.normal)+Number(e.unified)+Number(e.context)>1)return{stdout:"",stderr:`diff: conflicting output style options
|
|
21
|
-
diff: Try 'diff --help' for more information.
|
|
22
|
-
`,exitCode:2};let s=e.brief,f=e.reportSame,a=e.ignoreCase,n=o.result.positional;if(n.length<2)return{stdout:"",stderr:`diff: missing operand
|
|
23
|
-
`,exitCode:2};let u,l,[c,m]=n;try{u=c==="-"?E(t.stdin):await t.fs.readFile(t.fs.resolvePath(t.cwd,c))}catch{return{stdout:"",stderr:`diff: ${c}: No such file or directory
|
|
24
|
-
`,exitCode:2}}try{l=m==="-"?E(t.stdin):await t.fs.readFile(t.fs.resolvePath(t.cwd,m))}catch{return{stdout:"",stderr:`diff: ${m}: No such file or directory
|
|
25
|
-
`,exitCode:2}}let h=u,p=l;if(a&&(h=h.toLowerCase(),p=p.toLowerCase()),h===p)return f?{stdout:`Files ${c} and ${m} are identical
|
|
26
|
-
`,stderr:"",exitCode:0}:{stdout:"",stderr:"",exitCode:0};if(s)return{stdout:`Files ${c} and ${m} differ
|
|
27
|
-
`,stderr:"",exitCode:1};let C=F(u),w=F(l),P=q(C,w,a),d;return e.unified?d=X(c,m,C,w,P,D):e.context?d=B(c,m,C,w,P,D):d=U(C,w,P),{stdout:d,stderr:"",exitCode:1}}},at={name:"diff",flags:[{flag:"--normal",type:"boolean"},{flag:"-u",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-i",type:"boolean"}],needsArgs:!0,minArgs:2};export{ft as a,at as b};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{b as P,c as O,d as T,e as k}from"./chunk-MBREBDZQ.js";import{f as F}from"./chunk-HWK7KFGB.js";import{l as v,m as w}from"./chunk-FUT3X2GJ.js";import{c as S}from"./chunk-OHFB3M3X.js";import{a as E}from"./chunk-NE4R2FVV.js";import{a as D}from"./chunk-I4IRHQDW.js";import{a as $,b as C}from"./chunk-MUFNRCMY.js";var H={name:"cp",summary:"copy files and directories",usage:"cp [OPTION]... SOURCE... DEST",options:["-r, -R, --recursive copy directories recursively","-n, --no-clobber do not overwrite an existing file","-p, --preserve preserve file attributes","-v, --verbose explain what is being done"," --help display this help and exit"]},I={recursive:{short:"r",long:"recursive",type:"boolean"},recursiveUpper:{short:"R",type:"boolean"},noClobber:{short:"n",long:"no-clobber",type:"boolean"},preserve:{short:"p",long:"preserve",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},q={name:"cp",async execute(u,e){if(C(u))return $(H);let s=E("cp",u,I);if(!s.ok)return s.error;let d=s.result.flags.recursive||s.result.flags.recursiveUpper,A=s.result.flags.noClobber,N=s.result.flags.preserve,R=s.result.flags.verbose,p=s.result.positional;if(p.length<2)return{stdout:"",stderr:`cp: missing destination file operand
|
|
4
|
-
`,exitCode:1};let m=p.pop()??"",g=p,l=e.fs.resolvePath(e.cwd,m),y="",n="",i=0,h=new T({limits:e.limits,signal:e.signal,executionScope:e.executionScope,site:"cp"}),f=!1;try{f=(await e.fs.stat(l)).isDirectory}catch{}if(g.length>1&&!f)return{stdout:"",stderr:`cp: target '${m}' is not a directory
|
|
5
|
-
`,exitCode:1};for(let t of g)try{let o=e.fs.resolvePath(e.cwd,t),a=await e.fs.stat(o),r=l;if(f){let c=t.split("/").pop()||t;r=l==="/"?`/${c}`:`${l}/${c}`}if(a.isDirectory&&!d){n+=`cp: -r not specified; omitting directory '${t}'
|
|
6
|
-
`,i=1;continue}if(a.isDirectory){let c=await O(e.fs,o,r,h);if(F(o,r)||c==="inside"){n+=`cp: cannot copy '${t}' into itself, '${r}'
|
|
7
|
-
`,i=1;continue}if(c==="unknown"){n+=`cp: cannot safely determine whether '${r}' is inside '${t}'
|
|
8
|
-
`,i=1;continue}}if(A)try{await e.fs.stat(r);continue}catch{}let b=await P(e.fs,o,r);if(b==="same"){n+=`cp: '${t}' and '${r}' are the same file
|
|
9
|
-
`,i=1;continue}if(b==="unknown"){n+=`cp: cannot safely determine whether '${t}' and '${r}' are the same file
|
|
10
|
-
`,i=1;continue}a.isDirectory&&await k({fs:e.fs,root:o,limits:e.limits,signal:e.signal,executionScope:e.executionScope,site:"cp",symlinks:"never",budget:h},()=>{}),await e.fs.cp(o,r,{recursive:d}),R&&(y+=`'${t}' -> '${r}'
|
|
11
|
-
`)}catch(o){if(o instanceof v||o instanceof w)throw o;let a=D(o);S(o,"ENOENT")?n+=`cp: cannot stat '${t}': No such file or directory
|
|
12
|
-
`:n+=`cp: cannot copy '${t}': ${a}
|
|
13
|
-
`,i=1}return{stdout:y,stderr:n,exitCode:i}}},J={name:"cp",flags:[{flag:"-r",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-p",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2};export{q as a,J as b};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{c as i}from"./chunk-OHFB3M3X.js";import{a as m}from"./chunk-PBOVSFTJ.js";import{a as c}from"./chunk-NE4R2FVV.js";import{a as l}from"./chunk-I4IRHQDW.js";var k={recursive:{short:"p",long:"parents",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},h={name:"mkdir",async execute(f,s){let r=c("mkdir",f,k);if(!r.ok)return r.error;let g=r.result.flags.recursive,p=r.result.flags.verbose,n=r.result.positional;if(n.length===0)return{stdout:"",stderr:`mkdir: missing operand
|
|
4
|
-
`,exitCode:1};let a="",t="",d=0;for(let e of n)try{let o=s.fs.resolvePath(s.cwd,e);await s.fs.mkdir(o,{recursive:g}),p&&(a+=`mkdir: created directory '${e}'
|
|
5
|
-
`)}catch(o){let u=l(o);i(o,"ENOENT")?t+=`mkdir: cannot create directory '${e}': No such file or directory
|
|
6
|
-
`:i(o,"EEXIST")?t+=`mkdir: cannot create directory '${e}': File exists
|
|
7
|
-
`:t+=`mkdir: cannot create directory '${e}': ${m(u)}
|
|
8
|
-
`,d=1}return{stdout:a,stderr:t,exitCode:d}}},$={name:"mkdir",flags:[{flag:"-p",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0};export{h as a,$ as b};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{a as s}from"./chunk-OHFB3M3X.js";var a=40,f=493,d=420,x=511;function o(n){if(!n||n==="/")return"/";let t=n.endsWith("/")&&n!=="/"?n.slice(0,-1):n;t.startsWith("/")||(t=`/${t}`);let r=t.split("/").filter(i=>i&&i!=="."),e=[];for(let i of r)i===".."?e.pop():e.push(i);return`/${e.join("/")}`||"/"}function m(n,t){let r=o(n),e=o(t);return e===r||r==="/"||e.startsWith(`${r}/`)}function $(n,t){if(n.includes("\0"))throw new s("ENOENT",`path contains null byte, ${t} '${n}'`)}function c(n){let t=o(n);if(t==="/")return"/";let r=t.lastIndexOf("/");return r===0?"/":t.slice(0,r)}function p(n,t){if(t.startsWith("/"))return o(t);let r=n==="/"?`/${t}`:`${n}/${t}`;return o(r)}function E(n){return n.replace(/\\/g,"/")}function l(n,t){return n==="/"?`/${t}`:`${n}/${t}`}function D(n,t){if(t.startsWith("/"))return o(t);let r=c(n);return o(l(r,t))}export{a,f as b,d as c,x as d,o as e,m as f,$ as g,c as h,p as i,E as j,l as k,D as l};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{b as a}from"./chunk-HWI42GQO.js";var s=globalThis.setTimeout.bind(globalThis),l=globalThis.clearTimeout.bind(globalThis),T=globalThis.setInterval.bind(globalThis),f=globalThis.clearInterval.bind(globalThis);function u(e){return typeof e!="function"?e:a.bindCurrentContext(e)}var b=((e,n,...i)=>s(u(e),n,...i)),d=l,c=2147483647;function I(e,n){if(n===Number.POSITIVE_INFINITY)return;let i=u(e),t={cleared:!1,remainingMs:Math.max(0,n),timer:void 0},r=()=>{if(t.cleared)return;let o=Math.min(t.remainingMs,c);t.timer=s(()=>{t.cleared||(t.remainingMs-=o,t.remainingMs>0?r():i())},o)};return r(),t}function _(e){e&&(e.cleared=!0,e.timer!==void 0&&l(e.timer))}export{b as a,d as b,I as c,_ as d};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{b as N,c as O,d as T,e as k}from"./chunk-MBREBDZQ.js";import{f as P}from"./chunk-HWK7KFGB.js";import{l as w,m as $}from"./chunk-FUT3X2GJ.js";import{c as F}from"./chunk-OHFB3M3X.js";import{a as S}from"./chunk-NE4R2FVV.js";import{a as D}from"./chunk-I4IRHQDW.js";import{a as C,b as E}from"./chunk-MUFNRCMY.js";var H={name:"mv",summary:"move (rename) files",usage:"mv [OPTION]... SOURCE... DEST",options:["-f, --force do not prompt before overwriting","-n, --no-clobber do not overwrite an existing file","-v, --verbose explain what is being done"," --help display this help and exit"]},I={force:{short:"f",long:"force",type:"boolean"},noClobber:{short:"n",long:"no-clobber",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},j={name:"mv",async execute(d,e){if(E(d))return C(H);let r=S("mv",d,I);if(!r.ok)return r.error;let v=r.result.flags.force,g=r.result.flags.noClobber,A=r.result.flags.verbose,p=r.result.positional;if(g&&(v=!1),p.length<2)return{stdout:"",stderr:`mv: missing destination file operand
|
|
4
|
-
`,exitCode:1};let l=p.pop()??"",u=p,f=e.fs.resolvePath(e.cwd,l),h="",i="",a=0,b=new T({limits:e.limits,signal:e.signal,executionScope:e.executionScope,site:"mv"}),m=!1;try{m=(await e.fs.stat(f)).isDirectory}catch{}if(u.length>1&&!m)return{stdout:"",stderr:`mv: target '${l}' is not a directory
|
|
5
|
-
`,exitCode:1};for(let t of u)try{let o=e.fs.resolvePath(e.cwd,t),c=await e.fs.stat(o),n=f;if(m){let s=t.split("/").pop()||t;n=f==="/"?`/${s}`:`${f}/${s}`}if(c.isDirectory){let s=await O(e.fs,o,n,b);if(P(o,n)||s==="inside"){i+=`mv: cannot move '${t}' into itself, '${n}'
|
|
6
|
-
`,a=1;continue}if(s==="unknown"){i+=`mv: cannot safely determine whether '${n}' is inside '${t}'
|
|
7
|
-
`,a=1;continue}}if(g)try{await e.fs.stat(n);continue}catch{}let y=await N(e.fs,o,n);if(y==="same")continue;if(y==="unknown"){i+=`mv: cannot safely determine whether '${t}' and '${n}' are the same file
|
|
8
|
-
`,a=1;continue}if(c.isDirectory&&await k({fs:e.fs,root:o,limits:e.limits,signal:e.signal,executionScope:e.executionScope,site:"mv",symlinks:"never",budget:b},()=>{}),await e.fs.mv(o,n),A){let s=m?`${l}/${t.split("/").pop()||t}`:l;h+=`renamed '${t}' -> '${s}'
|
|
9
|
-
`}}catch(o){if(o instanceof w||o instanceof $)throw o;let c=D(o);F(o,"ENOENT")?i+=`mv: cannot stat '${t}': No such file or directory
|
|
10
|
-
`:i+=`mv: cannot move '${t}': ${c}
|
|
11
|
-
`,a=1}return{stdout:h,stderr:i,exitCode:a}}},G={name:"mv",flags:[{flag:"-f",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2};export{j as a,G as b};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{a as u}from"./chunk-NE4R2FVV.js";import{a as f,b as h}from"./chunk-MUFNRCMY.js";var g={name:"which",summary:"locate a command",usage:"which [-as] program ...",options:["-a List all instances of executables found","-s No output, just return 0 if found, 1 if not","--help display this help and exit"]},w={showAll:{short:"a",type:"boolean"},silent:{short:"s",type:"boolean"}},A={name:"which",async execute(s,e){if(h(s))return f(g);let t=u("which",s,w);if(!t.ok)return t.error;let c=t.result.flags.showAll,p=t.result.flags.silent,o=t.result.positional;if(o.length===0)return{stdout:"",stderr:"",exitCode:1};let d=(e.env.get("PATH")||"/usr/bin:/bin").split(":"),n="",a=!0;for(let m of o){let l=!1;for(let r of d){if(!r)continue;let i=e.fs.resolvePath(r,m);if(await e.fs.exists(i)&&(l=!0,p||(n+=`${i}
|
|
4
|
-
`),!c))break}l||(a=!1)}return{stdout:n,stderr:"",exitCode:a?0:1}}},v={name:"which",flags:[{flag:"-a",type:"boolean"},{flag:"-s",type:"boolean"}],needsArgs:!0};export{A as a,v as b};
|