@jerryan/just-bash 3.6.1 → 3.8.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 +79 -0
- package/README.md +15 -5
- package/dist/AGENTS.md +2 -2
- package/dist/Bash.d.ts +4 -2
- package/dist/bin/chunks/{awk2-KO7ZE3P7.js → awk2-NTRVFXRA.js} +1 -1
- package/dist/bin/chunks/chmod-GX5SYTRL.js +3 -0
- package/dist/bin/chunks/chunk-2NJJXU4K.js +27 -0
- package/dist/bin/{shell/chunks/chunk-ZMGLTHSU.js → chunks/chunk-3ROYEBJI.js} +1 -1
- package/dist/bin/chunks/chunk-6FGMEZZP.js +20 -0
- package/dist/bin/chunks/chunk-6JUPBMCR.js +13 -0
- package/dist/bin/{shell/chunks/chunk-3DWQCLNP.js → chunks/chunk-7WBCA2BB.js} +1 -1
- package/dist/bin/chunks/{chunk-LE2XKKGQ.js → chunk-ABP4OLJV.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-7PUOS2OO.js → chunks/chunk-ANX7U57Q.js} +1 -1
- package/dist/bin/chunks/{chunk-B2GCIQI2.js → chunk-BB5VTPMQ.js} +1 -1
- package/dist/bin/chunks/chunk-CN4JKMTR.js +8 -0
- package/dist/bin/chunks/{chunk-WFHYGSLJ.js → chunk-CNVNOT67.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-6ESRNSO7.js → chunks/chunk-DRPHNXG7.js} +1 -1
- package/dist/bin/chunks/chunk-F2PYTUMR.js +9 -0
- package/dist/bin/{shell/chunks/chunk-OXLC2WWX.js → chunks/chunk-H7PD6FLC.js} +10 -10
- package/dist/bin/chunks/chunk-HWK7KFGB.js +3 -0
- package/dist/bin/{shell/chunks/chunk-QYZN33JA.js → chunks/chunk-IOKQFPM6.js} +1 -1
- package/dist/bin/chunks/{chunk-M7SIPZZZ.js → chunk-KMYJMEON.js} +1 -1
- package/dist/bin/chunks/chunk-KNTDFP7X.js +12 -0
- package/dist/bin/{shell/chunks/chunk-RPUFEP5O.js → chunks/chunk-M3Z5NZXT.js} +1 -1
- package/dist/bin/chunks/chunk-MBREBDZQ.js +3 -0
- package/dist/bin/{shell/chunks/chunk-L345YZ6R.js → chunks/chunk-MF3GVFLC.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-YCOJCFGU.js → chunks/chunk-MPFNZYEA.js} +1 -1
- package/dist/bin/chunks/chunk-OHFB3M3X.js +3 -0
- package/dist/bin/{shell/chunks/chunk-F3UDTTI7.js → chunks/chunk-ONF4KUYV.js} +1 -1
- package/dist/bin/chunks/chunk-PPVF2N6C.js +3 -0
- package/dist/bin/chunks/{chunk-V2XF3TTW.js → chunk-PRVPFKTC.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-7VWOECJ3.js → chunks/chunk-PTUQEN6I.js} +1 -1
- package/dist/bin/chunks/{chunk-R2J5MJOM.js → chunk-QFOXSCOD.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-6TUILMPB.js → chunks/chunk-QFTZKD5O.js} +1 -1
- package/dist/bin/chunks/{chunk-HQ63MFHG.js → chunk-QJWFCA7P.js} +1 -1
- package/dist/bin/chunks/chunk-RTN6X652.js +11 -0
- package/dist/bin/chunks/{chunk-67XYNGRV.js → chunk-T6OIISUC.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-JELR4642.js → chunks/chunk-U5JLGI56.js} +13 -13
- package/dist/bin/chunks/{chunk-7PPAWLUI.js → chunk-V4S4A7M6.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-DZAFUADN.js → chunks/chunk-VPSBWWXM.js} +1 -1
- package/dist/bin/chunks/{chunk-GA5TPRMF.js → chunk-YXPSX3SI.js} +11 -11
- package/dist/bin/chunks/{chunk-472JZJ2D.js → chunk-ZVG47PYA.js} +1 -1
- package/dist/bin/chunks/cp-YLP7ULVT.js +3 -0
- package/dist/bin/{shell/chunks/diff-YXZZCUSQ.js → chunks/diff-JSJ56EOK.js} +1 -1
- package/dist/bin/chunks/du-DH76GZJ3.js +3 -0
- package/dist/bin/chunks/{expr-NNMDHOCN.js → expr-PQEPO5TE.js} +1 -1
- package/dist/bin/chunks/{file-4T64QNLS.js → file-JA7QI2YT.js} +1 -1
- package/dist/bin/chunks/find-MHC4QV6H.js +3 -0
- package/dist/bin/chunks/flag-coverage-2H5CPEM6.js +3 -0
- package/dist/bin/chunks/{grep-CVU5V66H.js → grep-VXWNMIDD.js} +1 -1
- package/dist/bin/chunks/gzip-UQZL4R74.js +3 -0
- package/dist/bin/chunks/{jq-V7OTAVU5.js → jq-YS4PR46D.js} +1 -1
- package/dist/bin/chunks/js-exec-T3SAB2B6.js +1651 -0
- package/dist/bin/chunks/ln-XVC53673.js +3 -0
- package/dist/bin/chunks/ls-5Z45FV4U.js +3 -0
- package/dist/bin/chunks/mkdir-YJ3SOVRP.js +3 -0
- package/dist/bin/chunks/mv-EOOP2TO3.js +3 -0
- package/dist/bin/chunks/python3-3ERN3L6S.js +23 -0
- package/dist/bin/chunks/readlink-EJ3IKLWW.js +3 -0
- package/dist/bin/chunks/rg-WHVR3YDT.js +3 -0
- package/dist/bin/chunks/rm-B4LVIG7A.js +3 -0
- package/dist/bin/chunks/rmdir-PRNISPBA.js +3 -0
- package/dist/bin/{shell/chunks/sed-4LVDFHIJ.js → chunks/sed-SY63U2YX.js} +1 -1
- package/dist/bin/{shell/chunks/sleep-MOJQBZMY.js → chunks/sleep-DVFE2GSF.js} +1 -1
- package/dist/bin/chunks/split-HIFKSV2A.js +3 -0
- package/dist/bin/chunks/sqlite3-KNN6V2W6.js +3 -0
- package/dist/bin/{shell/chunks/tar-7HGZIMZD.js → chunks/tar-7XOP7VOX.js} +1 -1
- package/dist/bin/chunks/{timeout-RQOWSWYG.js → timeout-YGFHQJKX.js} +1 -1
- package/dist/bin/chunks/worker.js +120 -109
- package/dist/bin/chunks/{xan-WW53ETXT.js → xan-RMH6JEXM.js} +1 -1
- package/dist/bin/chunks/{yq-MYZOS2WN.js → yq-CWBZMGUV.js} +1 -1
- package/dist/bin/just-bash.js +355 -350
- package/dist/bin/shell/chunks/{awk2-KO7ZE3P7.js → awk2-NTRVFXRA.js} +1 -1
- package/dist/bin/shell/chunks/chmod-GX5SYTRL.js +3 -0
- package/dist/bin/shell/chunks/chunk-2NJJXU4K.js +27 -0
- package/dist/bin/{chunks/chunk-ZMGLTHSU.js → shell/chunks/chunk-3ROYEBJI.js} +1 -1
- package/dist/bin/shell/chunks/chunk-6FGMEZZP.js +20 -0
- package/dist/bin/shell/chunks/chunk-6JUPBMCR.js +13 -0
- package/dist/bin/{chunks/chunk-3DWQCLNP.js → shell/chunks/chunk-7WBCA2BB.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-LE2XKKGQ.js → chunk-ABP4OLJV.js} +1 -1
- package/dist/bin/{chunks/chunk-7PUOS2OO.js → shell/chunks/chunk-ANX7U57Q.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-B2GCIQI2.js → chunk-BB5VTPMQ.js} +1 -1
- package/dist/bin/shell/chunks/chunk-CN4JKMTR.js +8 -0
- package/dist/bin/shell/chunks/{chunk-WFHYGSLJ.js → chunk-CNVNOT67.js} +1 -1
- package/dist/bin/{chunks/chunk-6ESRNSO7.js → shell/chunks/chunk-DRPHNXG7.js} +1 -1
- package/dist/bin/shell/chunks/chunk-F2PYTUMR.js +9 -0
- package/dist/bin/{chunks/chunk-OXLC2WWX.js → shell/chunks/chunk-H7PD6FLC.js} +10 -10
- package/dist/bin/shell/chunks/chunk-HWK7KFGB.js +3 -0
- package/dist/bin/{chunks/chunk-QYZN33JA.js → shell/chunks/chunk-IOKQFPM6.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-M7SIPZZZ.js → chunk-KMYJMEON.js} +1 -1
- package/dist/bin/shell/chunks/chunk-KNTDFP7X.js +12 -0
- package/dist/bin/{chunks/chunk-RPUFEP5O.js → shell/chunks/chunk-M3Z5NZXT.js} +1 -1
- package/dist/bin/shell/chunks/chunk-MBREBDZQ.js +3 -0
- package/dist/bin/{chunks/chunk-L345YZ6R.js → shell/chunks/chunk-MF3GVFLC.js} +1 -1
- package/dist/bin/{chunks/chunk-YCOJCFGU.js → shell/chunks/chunk-MPFNZYEA.js} +1 -1
- package/dist/bin/shell/chunks/chunk-OHFB3M3X.js +3 -0
- package/dist/bin/{chunks/chunk-F3UDTTI7.js → shell/chunks/chunk-ONF4KUYV.js} +1 -1
- package/dist/bin/shell/chunks/chunk-PPVF2N6C.js +3 -0
- package/dist/bin/shell/chunks/{chunk-V2XF3TTW.js → chunk-PRVPFKTC.js} +1 -1
- package/dist/bin/{chunks/chunk-7VWOECJ3.js → shell/chunks/chunk-PTUQEN6I.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-R2J5MJOM.js → chunk-QFOXSCOD.js} +1 -1
- package/dist/bin/{chunks/chunk-6TUILMPB.js → shell/chunks/chunk-QFTZKD5O.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-HQ63MFHG.js → chunk-QJWFCA7P.js} +1 -1
- package/dist/bin/shell/chunks/chunk-RTN6X652.js +11 -0
- package/dist/bin/shell/chunks/{chunk-67XYNGRV.js → chunk-T6OIISUC.js} +1 -1
- package/dist/bin/{chunks/chunk-JELR4642.js → shell/chunks/chunk-U5JLGI56.js} +13 -13
- package/dist/bin/shell/chunks/{chunk-7PPAWLUI.js → chunk-V4S4A7M6.js} +1 -1
- package/dist/bin/{chunks/chunk-DZAFUADN.js → shell/chunks/chunk-VPSBWWXM.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-GA5TPRMF.js → chunk-YXPSX3SI.js} +11 -11
- package/dist/bin/shell/chunks/{chunk-472JZJ2D.js → chunk-ZVG47PYA.js} +1 -1
- package/dist/bin/shell/chunks/cp-YLP7ULVT.js +3 -0
- package/dist/bin/{chunks/diff-YXZZCUSQ.js → shell/chunks/diff-JSJ56EOK.js} +1 -1
- package/dist/bin/shell/chunks/du-DH76GZJ3.js +3 -0
- package/dist/bin/shell/chunks/{expr-NNMDHOCN.js → expr-PQEPO5TE.js} +1 -1
- package/dist/bin/shell/chunks/{file-4T64QNLS.js → file-JA7QI2YT.js} +1 -1
- package/dist/bin/shell/chunks/find-MHC4QV6H.js +3 -0
- package/dist/bin/shell/chunks/flag-coverage-2H5CPEM6.js +3 -0
- package/dist/bin/shell/chunks/{grep-CVU5V66H.js → grep-VXWNMIDD.js} +1 -1
- package/dist/bin/shell/chunks/gzip-UQZL4R74.js +3 -0
- package/dist/bin/shell/chunks/{jq-V7OTAVU5.js → jq-YS4PR46D.js} +1 -1
- package/dist/bin/shell/chunks/js-exec-T3SAB2B6.js +1651 -0
- package/dist/bin/shell/chunks/ln-XVC53673.js +3 -0
- package/dist/bin/shell/chunks/ls-5Z45FV4U.js +3 -0
- package/dist/bin/shell/chunks/mkdir-YJ3SOVRP.js +3 -0
- package/dist/bin/shell/chunks/mv-EOOP2TO3.js +3 -0
- package/dist/bin/shell/chunks/python3-3ERN3L6S.js +23 -0
- package/dist/bin/shell/chunks/readlink-EJ3IKLWW.js +3 -0
- package/dist/bin/shell/chunks/rg-WHVR3YDT.js +3 -0
- package/dist/bin/shell/chunks/rm-B4LVIG7A.js +3 -0
- package/dist/bin/shell/chunks/rmdir-PRNISPBA.js +3 -0
- package/dist/bin/{chunks/sed-4LVDFHIJ.js → shell/chunks/sed-SY63U2YX.js} +1 -1
- package/dist/bin/{chunks/sleep-MOJQBZMY.js → shell/chunks/sleep-DVFE2GSF.js} +1 -1
- package/dist/bin/shell/chunks/split-HIFKSV2A.js +3 -0
- package/dist/bin/shell/chunks/sqlite3-KNN6V2W6.js +3 -0
- package/dist/bin/{chunks/tar-7HGZIMZD.js → shell/chunks/tar-7XOP7VOX.js} +1 -1
- package/dist/bin/shell/chunks/{timeout-RQOWSWYG.js → timeout-YGFHQJKX.js} +1 -1
- package/dist/bin/shell/chunks/{xan-WW53ETXT.js → xan-RMH6JEXM.js} +1 -1
- package/dist/bin/shell/chunks/{yq-MYZOS2WN.js → yq-CWBZMGUV.js} +1 -1
- package/dist/bin/shell/shell.js +397 -392
- package/dist/bundle/browser.js +693 -669
- package/dist/bundle/chunks/{awk2-W6BNZEJN.js → awk2-VS5QVYHU.js} +1 -1
- package/dist/bundle/chunks/chmod-TEY5MD2W.js +2 -0
- package/dist/bundle/chunks/{chunk-26GP3ACY.js → chunk-35MBA3VY.js} +1 -1
- package/dist/bundle/chunks/chunk-3CIDHL5V.js +11 -0
- package/dist/bundle/chunks/chunk-3OBCZP7T.js +12 -0
- package/dist/bundle/chunks/{chunk-F6XU52K3.js → chunk-45QZRGYF.js} +1 -1
- package/dist/bundle/chunks/chunk-4CC3OZPU.js +2 -0
- package/dist/bundle/chunks/{chunk-73JQKNZT.js → chunk-4KZT23KR.js} +11 -11
- package/dist/bundle/chunks/{chunk-PJM5C3HZ.js → chunk-5EI7WSRV.js} +10 -10
- package/dist/bundle/chunks/{chunk-T6DNSPYO.js → chunk-6BSOPPZH.js} +1 -1
- package/dist/bundle/chunks/{chunk-DAKEIWT3.js → chunk-6HO6HX7V.js} +1 -1
- package/dist/bundle/chunks/{chunk-XVSR5HHH.js → chunk-6QAM55HM.js} +1 -1
- package/dist/bundle/chunks/chunk-A257L6QO.js +7 -0
- package/dist/bundle/chunks/{chunk-UC76ZOWM.js → chunk-ATGOUOX2.js} +1 -1
- package/dist/bundle/chunks/chunk-B6OSJB22.js +26 -0
- package/dist/bundle/chunks/{chunk-2TSZPVPI.js → chunk-BLPYR4TN.js} +1 -1
- package/dist/bundle/chunks/{chunk-VJ6UXG2R.js → chunk-CH7SUFFO.js} +1 -1
- package/dist/bundle/chunks/{chunk-FQUVK4Q5.js → chunk-DDPD7SIB.js} +1 -1
- package/dist/bundle/chunks/{chunk-TLPMB3FO.js → chunk-DMWNBCXJ.js} +1 -1
- package/dist/bundle/chunks/{chunk-ZXFELXJH.js → chunk-FSKXIFYT.js} +1 -1
- package/dist/bundle/chunks/{chunk-KEMO3CBM.js → chunk-GNPLDVBD.js} +1 -1
- package/dist/bundle/chunks/{chunk-FZZL53S2.js → chunk-GRUZ4SBY.js} +1 -1
- package/dist/bundle/chunks/{chunk-RPKJJFGZ.js → chunk-HCKTU6IR.js} +1 -1
- package/dist/bundle/chunks/{chunk-4EDQZIAN.js → chunk-LGIJSCWH.js} +1 -1
- package/dist/bundle/chunks/chunk-LRFR25IP.js +8 -0
- package/dist/bundle/chunks/chunk-MWL2I5BV.js +19 -0
- package/dist/bundle/chunks/{chunk-6IA4DXG2.js → chunk-N3A4JVFJ.js} +1 -1
- package/dist/bundle/chunks/{chunk-PPEXVPHR.js → chunk-O452S4KX.js} +1 -1
- package/dist/bundle/chunks/chunk-RWQWFXMH.js +10 -0
- package/dist/bundle/chunks/chunk-S6DNKKUL.js +2 -0
- package/dist/bundle/chunks/{chunk-NBNI7G66.js → chunk-SE23TEGG.js} +1 -1
- package/dist/bundle/chunks/chunk-T5ZEIOJ3.js +2 -0
- package/dist/bundle/chunks/{chunk-ULXTDFQC.js → chunk-U57DSHID.js} +1 -1
- package/dist/bundle/chunks/{chunk-6DDRR56B.js → chunk-WE7BJ7YU.js} +1 -1
- package/dist/bundle/chunks/chunk-WXPNKIIH.js +2 -0
- package/dist/bundle/chunks/{chunk-5I5U6IYI.js → chunk-XQ2ZZFO6.js} +1 -1
- package/dist/bundle/chunks/{chunk-YFFU74KY.js → chunk-XV2V56NQ.js} +1 -1
- package/dist/bundle/chunks/{chunk-FIMF2TLE.js → chunk-Y6JBSHCM.js} +13 -13
- package/dist/bundle/chunks/cp-UR762VVT.js +2 -0
- package/dist/bundle/chunks/{diff-CSARC7WF.js → diff-VDB6RXHO.js} +1 -1
- package/dist/bundle/chunks/du-EQKH3UNA.js +2 -0
- package/dist/bundle/chunks/{expr-XSBELPAC.js → expr-A5XITHQD.js} +1 -1
- package/dist/bundle/chunks/{file-URNAD6FQ.js → file-6AYYTULJ.js} +1 -1
- package/dist/bundle/chunks/find-RLKBCGJR.js +2 -0
- package/dist/bundle/chunks/flag-coverage-UMQ3BWDP.js +2 -0
- package/dist/bundle/chunks/{grep-4AYF3A5J.js → grep-Q2O5EIXQ.js} +1 -1
- package/dist/bundle/chunks/gzip-KC5ENBD2.js +2 -0
- package/dist/bundle/chunks/{jq-NY7PCVMH.js → jq-UKAA3QWU.js} +1 -1
- package/dist/bundle/chunks/js-exec-ZQMIYQTH.js +1650 -0
- package/dist/bundle/chunks/ln-CEM7GDB5.js +2 -0
- package/dist/bundle/chunks/ls-WH5S4PPL.js +2 -0
- package/dist/bundle/chunks/mkdir-Z6MMWH3D.js +2 -0
- package/dist/bundle/chunks/mv-WE7DBLEK.js +2 -0
- package/dist/bundle/chunks/python3-QB7OE256.js +22 -0
- package/dist/bundle/chunks/readlink-JSRKXLLQ.js +2 -0
- package/dist/bundle/chunks/rg-JKB7DR66.js +2 -0
- package/dist/bundle/chunks/rm-IGPLE632.js +2 -0
- package/dist/bundle/chunks/rmdir-3WTXMVKI.js +2 -0
- package/dist/bundle/chunks/{sed-LIRH26EA.js → sed-6G32B25J.js} +1 -1
- package/dist/bundle/chunks/{sleep-25QUPVDK.js → sleep-PPRBTSVR.js} +1 -1
- package/dist/bundle/chunks/split-HUKVGJTW.js +2 -0
- package/dist/bundle/chunks/sqlite3-KB3MXTTM.js +2 -0
- package/dist/bundle/chunks/{tar-B72KU357.js → tar-LE7LAAIX.js} +1 -1
- package/dist/bundle/chunks/{timeout-37GM7IIL.js → timeout-C6WDYPLV.js} +1 -1
- package/dist/bundle/chunks/worker.js +120 -109
- package/dist/bundle/chunks/{xan-UIGVJCMA.js → xan-UIL24CGT.js} +1 -1
- package/dist/bundle/chunks/{yq-FGNXZCGX.js → yq-ZRNZKDLE.js} +1 -1
- package/dist/bundle/index.cjs +2677 -1101
- package/dist/bundle/index.js +346 -341
- package/dist/commands/diff/format.d.ts +46 -0
- package/dist/commands/js-exec/js-exec.d.ts +1 -14
- package/dist/commands/js-exec/run-runtime.d.ts +10 -0
- package/dist/commands/worker-bridge/bridge-handler.d.ts +0 -3
- package/dist/commands/worker-bridge/protocol.d.ts +57 -23
- package/dist/fs/fs-error.d.ts +43 -0
- package/dist/fs/interface.d.ts +13 -0
- package/dist/fs/mountable-fs/mountable-fs.d.ts +20 -0
- package/dist/fs/overlay-fs/apply.d.ts +2 -1
- package/dist/fs/overlay-fs/index.d.ts +0 -1
- package/dist/fs/overlay-fs/overlay-fs.d.ts +14 -0
- package/dist/fs/path-utils.d.ts +5 -0
- package/dist/fs/traversal.d.ts +9 -0
- package/dist/fs/vfs-template.d.ts +38 -15
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/interpreter/builtin-dispatch.d.ts +10 -0
- package/dist/interpreter/builtin-manifest.d.ts +273 -0
- package/dist/interpreter/builtins/help.d.ts +6 -0
- package/dist/interpreter/builtins/shopt.d.ts +3 -0
- package/dist/interpreter/helpers/shell-constants.d.ts +0 -20
- package/dist/interpreter/helpers/substitution-status.d.ts +34 -0
- package/dist/interpreter/interpreter.d.ts +1 -1
- package/dist/interpreter/types.d.ts +8 -1
- package/dist/limits.d.ts +2 -0
- package/dist/timers.d.ts +0 -9
- package/dist/types.d.ts +4 -3
- package/package.json +8 -8
- package/dist/bin/chunks/chmod-WYYTXGVB.js +0 -3
- package/dist/bin/chunks/chunk-23OI2XDJ.js +0 -20
- package/dist/bin/chunks/chunk-43E7AR6A.js +0 -3
- package/dist/bin/chunks/chunk-AI7JUA46.js +0 -13
- package/dist/bin/chunks/chunk-CL7IYCGG.js +0 -20
- package/dist/bin/chunks/chunk-GQKQEK5N.js +0 -11
- package/dist/bin/chunks/chunk-JHEAT7AR.js +0 -12
- package/dist/bin/chunks/chunk-OLEQNRKX.js +0 -8
- package/dist/bin/chunks/chunk-QKJAAJ7J.js +0 -3
- package/dist/bin/chunks/chunk-SE7JHGP3.js +0 -9
- package/dist/bin/chunks/chunk-WEHA3JFD.js +0 -3
- package/dist/bin/chunks/chunk-YQEKKZTU.js +0 -12
- package/dist/bin/chunks/cp-OMVKM35F.js +0 -3
- package/dist/bin/chunks/du-LUFPVLNW.js +0 -3
- package/dist/bin/chunks/find-AWH2KOY7.js +0 -3
- package/dist/bin/chunks/flag-coverage-FYJ2V7J4.js +0 -3
- package/dist/bin/chunks/gzip-FDPA6EKG.js +0 -3
- package/dist/bin/chunks/js-exec-5QZZCOR7.js +0 -99
- package/dist/bin/chunks/js-exec-worker.js +0 -4931
- package/dist/bin/chunks/ln-B35EKC2Q.js +0 -3
- package/dist/bin/chunks/ls-Q6ZZ6SQ2.js +0 -3
- package/dist/bin/chunks/mkdir-74BP5NTG.js +0 -3
- package/dist/bin/chunks/mv-76LAHXFR.js +0 -3
- package/dist/bin/chunks/python3-TMFYDQAP.js +0 -14
- package/dist/bin/chunks/readlink-EHXJNW62.js +0 -3
- package/dist/bin/chunks/rg-PXNKNIMY.js +0 -3
- package/dist/bin/chunks/rm-NLG5344W.js +0 -3
- package/dist/bin/chunks/rmdir-7ZIVFZJX.js +0 -3
- package/dist/bin/chunks/split-ZNNNHKSP.js +0 -3
- package/dist/bin/chunks/sqlite3-3EUPHVEZ.js +0 -3
- package/dist/bin/shell/chunks/chmod-WYYTXGVB.js +0 -3
- package/dist/bin/shell/chunks/chunk-23OI2XDJ.js +0 -20
- package/dist/bin/shell/chunks/chunk-43E7AR6A.js +0 -3
- package/dist/bin/shell/chunks/chunk-AI7JUA46.js +0 -13
- package/dist/bin/shell/chunks/chunk-CL7IYCGG.js +0 -20
- package/dist/bin/shell/chunks/chunk-GQKQEK5N.js +0 -11
- package/dist/bin/shell/chunks/chunk-JHEAT7AR.js +0 -12
- package/dist/bin/shell/chunks/chunk-OLEQNRKX.js +0 -8
- package/dist/bin/shell/chunks/chunk-QKJAAJ7J.js +0 -3
- package/dist/bin/shell/chunks/chunk-SE7JHGP3.js +0 -9
- package/dist/bin/shell/chunks/chunk-WEHA3JFD.js +0 -3
- package/dist/bin/shell/chunks/chunk-YQEKKZTU.js +0 -12
- package/dist/bin/shell/chunks/cp-OMVKM35F.js +0 -3
- package/dist/bin/shell/chunks/du-LUFPVLNW.js +0 -3
- package/dist/bin/shell/chunks/find-AWH2KOY7.js +0 -3
- package/dist/bin/shell/chunks/flag-coverage-FYJ2V7J4.js +0 -3
- package/dist/bin/shell/chunks/gzip-FDPA6EKG.js +0 -3
- package/dist/bin/shell/chunks/js-exec-5QZZCOR7.js +0 -99
- package/dist/bin/shell/chunks/ln-B35EKC2Q.js +0 -3
- package/dist/bin/shell/chunks/ls-Q6ZZ6SQ2.js +0 -3
- package/dist/bin/shell/chunks/mkdir-74BP5NTG.js +0 -3
- package/dist/bin/shell/chunks/mv-76LAHXFR.js +0 -3
- package/dist/bin/shell/chunks/python3-TMFYDQAP.js +0 -14
- package/dist/bin/shell/chunks/readlink-EHXJNW62.js +0 -3
- package/dist/bin/shell/chunks/rg-PXNKNIMY.js +0 -3
- package/dist/bin/shell/chunks/rm-NLG5344W.js +0 -3
- package/dist/bin/shell/chunks/rmdir-7ZIVFZJX.js +0 -3
- package/dist/bin/shell/chunks/split-ZNNNHKSP.js +0 -3
- package/dist/bin/shell/chunks/sqlite3-3EUPHVEZ.js +0 -3
- package/dist/bundle/chunks/chmod-WM2JFFQC.js +0 -2
- package/dist/bundle/chunks/chunk-7IJWBG4I.js +0 -2
- package/dist/bundle/chunks/chunk-FSJ6TTCC.js +0 -19
- package/dist/bundle/chunks/chunk-G3IRZ4FN.js +0 -8
- package/dist/bundle/chunks/chunk-MLIO3BK2.js +0 -7
- package/dist/bundle/chunks/chunk-PS2RJNZZ.js +0 -2
- package/dist/bundle/chunks/chunk-TBVD66LC.js +0 -10
- package/dist/bundle/chunks/chunk-ULXGGWAD.js +0 -11
- package/dist/bundle/chunks/chunk-UTKGYVUZ.js +0 -7
- package/dist/bundle/chunks/chunk-W2Z6LYL6.js +0 -11
- package/dist/bundle/chunks/chunk-WN54B5NQ.js +0 -12
- package/dist/bundle/chunks/chunk-YUSFCOM7.js +0 -2
- package/dist/bundle/chunks/cp-2KZIPZJS.js +0 -2
- package/dist/bundle/chunks/du-7AZCLKR6.js +0 -2
- package/dist/bundle/chunks/find-END3EAHV.js +0 -2
- package/dist/bundle/chunks/flag-coverage-XSPWRCVG.js +0 -2
- package/dist/bundle/chunks/gzip-RQOBR22H.js +0 -2
- package/dist/bundle/chunks/js-exec-57QMXJG5.js +0 -98
- package/dist/bundle/chunks/js-exec-worker.js +0 -4931
- package/dist/bundle/chunks/ln-OPY2ZVGQ.js +0 -2
- package/dist/bundle/chunks/ls-ZPXGZX63.js +0 -2
- package/dist/bundle/chunks/mkdir-WDDKK2P3.js +0 -2
- package/dist/bundle/chunks/mv-ZF6UBVRB.js +0 -2
- package/dist/bundle/chunks/python3-NNONJINM.js +0 -13
- package/dist/bundle/chunks/readlink-U5OM5A3M.js +0 -2
- package/dist/bundle/chunks/rg-NAMXBYKS.js +0 -2
- package/dist/bundle/chunks/rm-R2ZENNSN.js +0 -2
- package/dist/bundle/chunks/rmdir-YJKPQVCK.js +0 -2
- package/dist/bundle/chunks/split-JICLAMP6.js +0 -2
- package/dist/bundle/chunks/sqlite3-M4UZPXDO.js +0 -2
- package/dist/commands/js-exec/js-exec-worker.d.ts +0 -33
- package/dist/fs/overlay-fs/merge.d.ts +0 -24
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single source of truth for shell builtins: every name `type` and
|
|
3
|
+
* `command -v` display as a builtin, classified as:
|
|
4
|
+
*
|
|
5
|
+
* - `handler`: executed by dispatchBuiltin (phase "early" handlers run
|
|
6
|
+
* before user-defined functions — special builtins functions cannot
|
|
7
|
+
* override; phase "late" handlers run after).
|
|
8
|
+
* - `registry`: executed as a registry command (echo, printf, ...) —
|
|
9
|
+
* displayed as builtins for bash parity, resolved externally.
|
|
10
|
+
* - `unimplemented`: displayed as builtins (bash implements them) but
|
|
11
|
+
* just-bash has no implementation; at runtime they fall through to
|
|
12
|
+
* external resolution and fail with exit 127. Static analysis
|
|
13
|
+
* (Bash.analyzeCommands) subtracts these structurally.
|
|
14
|
+
*
|
|
15
|
+
* This module is a LEAF: it imports nothing, so every consumer
|
|
16
|
+
* (dispatch, compgen, type, analysis) can import it without cycles.
|
|
17
|
+
* The handler functions live in builtin-dispatch.ts, keyed by a mapped
|
|
18
|
+
* type derived from this manifest — a manifest `handler` entry without
|
|
19
|
+
* a handler function (or vice versa) is a COMPILE ERROR, which makes
|
|
20
|
+
* the old display-set/dispatch dual truth unrepresentable.
|
|
21
|
+
*/
|
|
22
|
+
/** Discriminated union: a handler entry MUST carry its dispatch phase —
|
|
23
|
+
* an optional `phase?` would let a phaseless handler compile and fall
|
|
24
|
+
* silently through to external resolution (exit 127). */
|
|
25
|
+
export type BuiltinManifestEntry = {
|
|
26
|
+
kind: "handler";
|
|
27
|
+
phase: "early" | "late";
|
|
28
|
+
/** Bash special case: dispatch EARLY in POSIX mode even though
|
|
29
|
+
* functions may override in normal mode (eval). */
|
|
30
|
+
posixEarly?: boolean;
|
|
31
|
+
} | {
|
|
32
|
+
kind: "registry";
|
|
33
|
+
} | {
|
|
34
|
+
kind: "unimplemented";
|
|
35
|
+
};
|
|
36
|
+
declare const manifest: {
|
|
37
|
+
readonly export: {
|
|
38
|
+
readonly kind: "handler";
|
|
39
|
+
readonly phase: "early";
|
|
40
|
+
};
|
|
41
|
+
readonly unset: {
|
|
42
|
+
readonly kind: "handler";
|
|
43
|
+
readonly phase: "early";
|
|
44
|
+
};
|
|
45
|
+
readonly exit: {
|
|
46
|
+
readonly kind: "handler";
|
|
47
|
+
readonly phase: "early";
|
|
48
|
+
};
|
|
49
|
+
readonly local: {
|
|
50
|
+
readonly kind: "handler";
|
|
51
|
+
readonly phase: "early";
|
|
52
|
+
};
|
|
53
|
+
readonly set: {
|
|
54
|
+
readonly kind: "handler";
|
|
55
|
+
readonly phase: "early";
|
|
56
|
+
};
|
|
57
|
+
readonly break: {
|
|
58
|
+
readonly kind: "handler";
|
|
59
|
+
readonly phase: "early";
|
|
60
|
+
};
|
|
61
|
+
readonly continue: {
|
|
62
|
+
readonly kind: "handler";
|
|
63
|
+
readonly phase: "early";
|
|
64
|
+
};
|
|
65
|
+
readonly return: {
|
|
66
|
+
readonly kind: "handler";
|
|
67
|
+
readonly phase: "early";
|
|
68
|
+
};
|
|
69
|
+
readonly shift: {
|
|
70
|
+
readonly kind: "handler";
|
|
71
|
+
readonly phase: "early";
|
|
72
|
+
};
|
|
73
|
+
readonly getopts: {
|
|
74
|
+
readonly kind: "handler";
|
|
75
|
+
readonly phase: "early";
|
|
76
|
+
};
|
|
77
|
+
readonly compgen: {
|
|
78
|
+
readonly kind: "handler";
|
|
79
|
+
readonly phase: "early";
|
|
80
|
+
};
|
|
81
|
+
readonly complete: {
|
|
82
|
+
readonly kind: "handler";
|
|
83
|
+
readonly phase: "early";
|
|
84
|
+
};
|
|
85
|
+
readonly compopt: {
|
|
86
|
+
readonly kind: "handler";
|
|
87
|
+
readonly phase: "early";
|
|
88
|
+
};
|
|
89
|
+
readonly pushd: {
|
|
90
|
+
readonly kind: "handler";
|
|
91
|
+
readonly phase: "early";
|
|
92
|
+
};
|
|
93
|
+
readonly popd: {
|
|
94
|
+
readonly kind: "handler";
|
|
95
|
+
readonly phase: "early";
|
|
96
|
+
};
|
|
97
|
+
readonly dirs: {
|
|
98
|
+
readonly kind: "handler";
|
|
99
|
+
readonly phase: "early";
|
|
100
|
+
};
|
|
101
|
+
readonly source: {
|
|
102
|
+
readonly kind: "handler";
|
|
103
|
+
readonly phase: "early";
|
|
104
|
+
};
|
|
105
|
+
readonly ".": {
|
|
106
|
+
readonly kind: "handler";
|
|
107
|
+
readonly phase: "early";
|
|
108
|
+
};
|
|
109
|
+
readonly read: {
|
|
110
|
+
readonly kind: "handler";
|
|
111
|
+
readonly phase: "early";
|
|
112
|
+
};
|
|
113
|
+
readonly mapfile: {
|
|
114
|
+
readonly kind: "handler";
|
|
115
|
+
readonly phase: "early";
|
|
116
|
+
};
|
|
117
|
+
readonly readarray: {
|
|
118
|
+
readonly kind: "handler";
|
|
119
|
+
readonly phase: "early";
|
|
120
|
+
};
|
|
121
|
+
readonly declare: {
|
|
122
|
+
readonly kind: "handler";
|
|
123
|
+
readonly phase: "early";
|
|
124
|
+
};
|
|
125
|
+
readonly typeset: {
|
|
126
|
+
readonly kind: "handler";
|
|
127
|
+
readonly phase: "early";
|
|
128
|
+
};
|
|
129
|
+
readonly readonly: {
|
|
130
|
+
readonly kind: "handler";
|
|
131
|
+
readonly phase: "early";
|
|
132
|
+
};
|
|
133
|
+
readonly eval: {
|
|
134
|
+
readonly kind: "handler";
|
|
135
|
+
readonly phase: "late";
|
|
136
|
+
readonly posixEarly: true;
|
|
137
|
+
};
|
|
138
|
+
readonly cd: {
|
|
139
|
+
readonly kind: "handler";
|
|
140
|
+
readonly phase: "late";
|
|
141
|
+
};
|
|
142
|
+
readonly ":": {
|
|
143
|
+
readonly kind: "handler";
|
|
144
|
+
readonly phase: "late";
|
|
145
|
+
};
|
|
146
|
+
readonly true: {
|
|
147
|
+
readonly kind: "handler";
|
|
148
|
+
readonly phase: "late";
|
|
149
|
+
};
|
|
150
|
+
readonly false: {
|
|
151
|
+
readonly kind: "handler";
|
|
152
|
+
readonly phase: "late";
|
|
153
|
+
};
|
|
154
|
+
readonly let: {
|
|
155
|
+
readonly kind: "handler";
|
|
156
|
+
readonly phase: "late";
|
|
157
|
+
};
|
|
158
|
+
readonly command: {
|
|
159
|
+
readonly kind: "handler";
|
|
160
|
+
readonly phase: "late";
|
|
161
|
+
};
|
|
162
|
+
readonly builtin: {
|
|
163
|
+
readonly kind: "handler";
|
|
164
|
+
readonly phase: "late";
|
|
165
|
+
};
|
|
166
|
+
readonly shopt: {
|
|
167
|
+
readonly kind: "handler";
|
|
168
|
+
readonly phase: "late";
|
|
169
|
+
};
|
|
170
|
+
readonly exec: {
|
|
171
|
+
readonly kind: "handler";
|
|
172
|
+
readonly phase: "late";
|
|
173
|
+
};
|
|
174
|
+
readonly wait: {
|
|
175
|
+
readonly kind: "handler";
|
|
176
|
+
readonly phase: "late";
|
|
177
|
+
};
|
|
178
|
+
readonly type: {
|
|
179
|
+
readonly kind: "handler";
|
|
180
|
+
readonly phase: "late";
|
|
181
|
+
};
|
|
182
|
+
readonly hash: {
|
|
183
|
+
readonly kind: "handler";
|
|
184
|
+
readonly phase: "late";
|
|
185
|
+
};
|
|
186
|
+
readonly help: {
|
|
187
|
+
readonly kind: "handler";
|
|
188
|
+
readonly phase: "late";
|
|
189
|
+
};
|
|
190
|
+
readonly "[": {
|
|
191
|
+
readonly kind: "handler";
|
|
192
|
+
readonly phase: "late";
|
|
193
|
+
};
|
|
194
|
+
readonly test: {
|
|
195
|
+
readonly kind: "handler";
|
|
196
|
+
readonly phase: "late";
|
|
197
|
+
};
|
|
198
|
+
readonly echo: {
|
|
199
|
+
readonly kind: "registry";
|
|
200
|
+
};
|
|
201
|
+
readonly printf: {
|
|
202
|
+
readonly kind: "registry";
|
|
203
|
+
};
|
|
204
|
+
readonly pwd: {
|
|
205
|
+
readonly kind: "registry";
|
|
206
|
+
};
|
|
207
|
+
readonly alias: {
|
|
208
|
+
readonly kind: "registry";
|
|
209
|
+
};
|
|
210
|
+
readonly unalias: {
|
|
211
|
+
readonly kind: "registry";
|
|
212
|
+
};
|
|
213
|
+
readonly history: {
|
|
214
|
+
readonly kind: "registry";
|
|
215
|
+
};
|
|
216
|
+
readonly bg: {
|
|
217
|
+
readonly kind: "unimplemented";
|
|
218
|
+
};
|
|
219
|
+
readonly caller: {
|
|
220
|
+
readonly kind: "unimplemented";
|
|
221
|
+
};
|
|
222
|
+
readonly disown: {
|
|
223
|
+
readonly kind: "unimplemented";
|
|
224
|
+
};
|
|
225
|
+
readonly enable: {
|
|
226
|
+
readonly kind: "unimplemented";
|
|
227
|
+
};
|
|
228
|
+
readonly fc: {
|
|
229
|
+
readonly kind: "unimplemented";
|
|
230
|
+
};
|
|
231
|
+
readonly fg: {
|
|
232
|
+
readonly kind: "unimplemented";
|
|
233
|
+
};
|
|
234
|
+
readonly jobs: {
|
|
235
|
+
readonly kind: "unimplemented";
|
|
236
|
+
};
|
|
237
|
+
readonly kill: {
|
|
238
|
+
readonly kind: "unimplemented";
|
|
239
|
+
};
|
|
240
|
+
readonly suspend: {
|
|
241
|
+
readonly kind: "unimplemented";
|
|
242
|
+
};
|
|
243
|
+
readonly times: {
|
|
244
|
+
readonly kind: "unimplemented";
|
|
245
|
+
};
|
|
246
|
+
readonly trap: {
|
|
247
|
+
readonly kind: "unimplemented";
|
|
248
|
+
};
|
|
249
|
+
readonly ulimit: {
|
|
250
|
+
readonly kind: "unimplemented";
|
|
251
|
+
};
|
|
252
|
+
readonly umask: {
|
|
253
|
+
readonly kind: "unimplemented";
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
export declare const BUILTIN_MANIFEST: typeof manifest;
|
|
257
|
+
/** Names displayed as shell builtins (type, command -v, coverage). */
|
|
258
|
+
export declare const SHELL_BUILTINS: Set<string>;
|
|
259
|
+
/** Manifest keys whose kind is "handler", as a type (for the dispatch
|
|
260
|
+
* handler map's bidirectional coverage check). */
|
|
261
|
+
export type ManifestHandlerName = {
|
|
262
|
+
[K in keyof typeof BUILTIN_MANIFEST]: (typeof BUILTIN_MANIFEST)[K] extends {
|
|
263
|
+
kind: "handler";
|
|
264
|
+
} ? K : never;
|
|
265
|
+
}[keyof typeof BUILTIN_MANIFEST];
|
|
266
|
+
/** Names with no implementation (analysis subtracts these). */
|
|
267
|
+
export declare const UNIMPLEMENTED_BUILTIN_NAMES: ReadonlySet<string>;
|
|
268
|
+
/** Dispatch order for a handler name (undefined for non-handlers). */
|
|
269
|
+
export declare function builtinPhase(name: string): "early" | "late" | undefined;
|
|
270
|
+
/** True when a handler dispatches early in POSIX mode despite a "late"
|
|
271
|
+
* phase (eval — the only such builtin). */
|
|
272
|
+
export declare function builtinPosixEarly(name: string): boolean;
|
|
273
|
+
export {};
|
|
@@ -9,4 +9,10 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { ExecResult } from "../../types.js";
|
|
11
11
|
import type { InterpreterContext } from "../types.js";
|
|
12
|
+
/**
|
|
13
|
+
* Builtin help information: [synopsis, description]
|
|
14
|
+
* The synopsis is the short form shown with -s and in the list.
|
|
15
|
+
* The description is the detailed help text.
|
|
16
|
+
*/
|
|
17
|
+
export declare const BUILTIN_HELP: Map<string, [string, string]>;
|
|
12
18
|
export declare function handleHelp(_ctx: InterpreterContext, args: string[]): ExecResult;
|
|
@@ -4,4 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { ExecResult } from "../../types.js";
|
|
6
6
|
import type { InterpreterContext } from "../types.js";
|
|
7
|
+
/** Every option name shopt recognizes (implemented ∪ stub) — the
|
|
8
|
+
* completion universe for `compgen -A shopt` / `complete -A shopt`. */
|
|
9
|
+
export declare const ALL_SHOPT_OPTIONS: readonly string[];
|
|
7
10
|
export declare function handleShopt(ctx: InterpreterContext, args: string[]): ExecResult;
|
|
@@ -19,23 +19,3 @@ export declare function isPosixSpecialBuiltin(name: string): boolean;
|
|
|
19
19
|
* Shell keywords (for type, command -v, etc.)
|
|
20
20
|
*/
|
|
21
21
|
export declare const SHELL_KEYWORDS: Set<string>;
|
|
22
|
-
/**
|
|
23
|
-
* Shell builtins (for type, command -v, builtin, etc.)
|
|
24
|
-
*/
|
|
25
|
-
export declare const SHELL_BUILTINS: Set<string>;
|
|
26
|
-
/**
|
|
27
|
-
* Names in the builtin display sets that have NO implementation: dispatch
|
|
28
|
-
* has no handler for them, so at runtime they fall through to external
|
|
29
|
-
* resolution and fail with "command not found" (exit 127). Real bash
|
|
30
|
-
* implements these; just-bash does not (yet).
|
|
31
|
-
*
|
|
32
|
-
* Membership in POSIX_SPECIAL_BUILTINS / SHELL_BUILTINS is about DISPLAY
|
|
33
|
-
* (type, command -v) and POSIX mode behavior — not about resolvability.
|
|
34
|
-
* Static analysis (Bash.analyzeCommands) subtracts this set so its
|
|
35
|
-
* results match dispatch. Keep this honest: the parity test in
|
|
36
|
-
* command-analysis.test.ts runs every display-set name through both
|
|
37
|
-
* runtime dispatch and analysis and fails on any divergence — both when
|
|
38
|
-
* a name here gets implemented (remove it) and when a new unimplemented
|
|
39
|
-
* name joins a display set (add it).
|
|
40
|
-
*/
|
|
41
|
-
export declare const UNIMPLEMENTED_BUILTIN_NAMES: ReadonlySet<string>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exit-status bookkeeping for command substitutions.
|
|
3
|
+
*/
|
|
4
|
+
import type { RedirectionNode } from "../../ast/types.js";
|
|
5
|
+
import type { InterpreterState } from "../types.js";
|
|
6
|
+
/**
|
|
7
|
+
* Record the exit status of a command substitution.
|
|
8
|
+
*
|
|
9
|
+
* `$?` and the "a substitution ran here" marker have to move together: a
|
|
10
|
+
* command with no command word (`x=1`, `> file`, an expansion that came out
|
|
11
|
+
* empty) reports the status of the last substitution that ran inside it, and
|
|
12
|
+
* 0 when none did. Setting `lastExitCode` without the marker leaves such a
|
|
13
|
+
* command reporting the *previous* command's status instead.
|
|
14
|
+
*/
|
|
15
|
+
export declare function recordSubstitutionExit(state: InterpreterState, exitCode: number): void;
|
|
16
|
+
/**
|
|
17
|
+
* The status bash gives a command that has no command word.
|
|
18
|
+
*
|
|
19
|
+
* It is the status of the last command substitution performed while expanding
|
|
20
|
+
* the command — assigned values and redirection words alike, in that order —
|
|
21
|
+
* and 0 when no substitution ran. A bare `x=1` is therefore 0 rather than
|
|
22
|
+
* whatever the previous command left in `$?`.
|
|
23
|
+
*
|
|
24
|
+
* A redirection onto fd 0 overrides all of that with 0. bash performs the
|
|
25
|
+
* redirections of a null command in a forked child when one of them reads
|
|
26
|
+
* stdin (`execute_null_command`'s `forcefork`), so the shell reports the
|
|
27
|
+
* child's status and any substitution in the words is discarded:
|
|
28
|
+
* `x=$(exit 7) < /dev/null` is 0, while `x=$(exit 7) 3< /dev/null` is 7.
|
|
29
|
+
*
|
|
30
|
+
* Verified against GNU bash 5.3. bash 3.2 predates the fork and reports 7 for
|
|
31
|
+
* both; this follows 5.x, which is what the comparison fixtures are recorded
|
|
32
|
+
* against.
|
|
33
|
+
*/
|
|
34
|
+
export declare function nullCommandExitStatus(state: InterpreterState, redirections: readonly RedirectionNode[]): number;
|
|
@@ -38,7 +38,7 @@ export interface InterpreterOptions {
|
|
|
38
38
|
/** Bootstrap JavaScript code for js-exec */
|
|
39
39
|
jsBootstrapCode?: string;
|
|
40
40
|
/** Tool invoker hook for js-exec's `tools` proxy */
|
|
41
|
-
invokeTool?: (path: string, argsJson: string) => Promise<string>;
|
|
41
|
+
invokeTool?: (path: string, argsJson: string, abortSignal: AbortSignal) => Promise<string>;
|
|
42
42
|
}
|
|
43
43
|
export declare class Interpreter {
|
|
44
44
|
private ctx;
|
|
@@ -320,6 +320,13 @@ export interface InterpreterState extends VariableAttributeState, LocalScopingSt
|
|
|
320
320
|
previousDir: string;
|
|
321
321
|
/** Exit code of last executed command */
|
|
322
322
|
lastExitCode: number;
|
|
323
|
+
/**
|
|
324
|
+
* Exit status of the most recent command substitution, or `null` when none
|
|
325
|
+
* has run since the current simple command began expanding. A command with
|
|
326
|
+
* no command word takes its status from this, not from `lastExitCode`:
|
|
327
|
+
* `x=$(exit 7)` is 7, while a plain `x=1` is 0 no matter what ran before it.
|
|
328
|
+
*/
|
|
329
|
+
lastSubstitutionExitCode: number | null;
|
|
323
330
|
/** Last argument of previous command, for $_ expansion */
|
|
324
331
|
lastArg: string;
|
|
325
332
|
/** Current line number being executed (for $LINENO) */
|
|
@@ -398,5 +405,5 @@ export interface InterpreterContext {
|
|
|
398
405
|
* Tool invoker hook. When present, js-exec sets up a `tools` proxy that
|
|
399
406
|
* routes calls through this callback.
|
|
400
407
|
*/
|
|
401
|
-
invokeTool?: (path: string, argsJson: string) => Promise<string>;
|
|
408
|
+
invokeTool?: (path: string, argsJson: string, abortSignal: AbortSignal) => Promise<string>;
|
|
402
409
|
}
|
package/dist/limits.d.ts
CHANGED
|
@@ -82,6 +82,8 @@ export interface ExecutionLimits {
|
|
|
82
82
|
maxPythonTimeoutMs?: number;
|
|
83
83
|
/** Maximum JavaScript execution time in milliseconds (normal default: 30000) */
|
|
84
84
|
maxJsTimeoutMs?: number;
|
|
85
|
+
/** Maximum JavaScript host-bridge operations (normal default: 1000000) */
|
|
86
|
+
maxJsBridgeRequests?: number;
|
|
85
87
|
/** Maximum glob filesystem operations (normal default: 1000000) */
|
|
86
88
|
maxGlobOperations?: number;
|
|
87
89
|
/** Maximum string length in bytes (normal default: 64 MiB) */
|
package/dist/timers.d.ts
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
export declare const _setTimeout: typeof globalThis.setTimeout;
|
|
2
2
|
export declare const _clearTimeout: typeof globalThis.clearTimeout;
|
|
3
|
-
/**
|
|
4
|
-
* Native setTimeout WITHOUT execution-context binding. `_setTimeout`
|
|
5
|
-
* binds callbacks to the scheduling execution's defense context, which
|
|
6
|
-
* DefenseInDepthBox suppresses once that execution deactivates — correct
|
|
7
|
-
* for intra-execution timers (sleep, fetch deadlines), fatal for host
|
|
8
|
-
* infrastructure callbacks that must fire AFTER the execution ends
|
|
9
|
-
* (e.g. idle teardown of a shared worker). Use this for the latter.
|
|
10
|
-
*/
|
|
11
|
-
export declare const _setTimeoutUnbound: typeof globalThis.setTimeout;
|
|
12
3
|
export interface FiniteTimeoutHandle {
|
|
13
4
|
cleared: boolean;
|
|
14
5
|
remainingMs: number;
|
package/dist/types.d.ts
CHANGED
|
@@ -283,10 +283,11 @@ export interface RuntimeCommandContext {
|
|
|
283
283
|
jsBootstrapCode?: string;
|
|
284
284
|
/**
|
|
285
285
|
* Tool invoker hook. When present, js-exec sets up a `tools` proxy that
|
|
286
|
-
* routes calls through this callback. Receives `(path, argsJson
|
|
287
|
-
* returns a JSON result string.
|
|
286
|
+
* routes calls through this callback. Receives `(path, argsJson,
|
|
287
|
+
* abortSignal)` and returns a JSON result string. Implementations should
|
|
288
|
+
* forward the signal to cancelable work.
|
|
288
289
|
*/
|
|
289
|
-
invokeTool?: (path: string, argsJson: string) => Promise<string>;
|
|
290
|
+
invokeTool?: (path: string, argsJson: string, abortSignal: AbortSignal) => Promise<string>;
|
|
290
291
|
}
|
|
291
292
|
/** Legacy standalone context shape used by direct command invocations. */
|
|
292
293
|
export type CommandContext = Omit<RuntimeCommandContext, "limits" | "executionScope"> & {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jerryan/just-bash",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "A simulated bash environment with virtual filesystem",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -77,7 +77,6 @@
|
|
|
77
77
|
"fast-check": "^3.23.2",
|
|
78
78
|
"knip": "^5.88.1",
|
|
79
79
|
"tsx": "^4.23.12",
|
|
80
|
-
"typescript": "^5.9.3",
|
|
81
80
|
"vitest": "^4.1.10"
|
|
82
81
|
},
|
|
83
82
|
"dependencies": {
|
|
@@ -88,13 +87,14 @@
|
|
|
88
87
|
"ini": "^6.0.0",
|
|
89
88
|
"modern-tar": "^0.7.7",
|
|
90
89
|
"papaparse": "^5.6.0",
|
|
91
|
-
"quickjs-emscripten": "^0.32.0",
|
|
92
90
|
"re2js": "^1.3.3",
|
|
91
|
+
"run": "2.1.3",
|
|
93
92
|
"seek-bzip": "^2.0.0",
|
|
94
93
|
"smol-toml": "^1.8.0",
|
|
95
94
|
"sprintf-js": "^1.1.3",
|
|
96
95
|
"sql.js": "^1.14.1",
|
|
97
96
|
"turndown": "^7.2.4",
|
|
97
|
+
"typescript": "^5.9.3",
|
|
98
98
|
"undici": "^7.29.0",
|
|
99
99
|
"yaml": "^2.9.0"
|
|
100
100
|
},
|
|
@@ -105,12 +105,12 @@
|
|
|
105
105
|
"scripts": {
|
|
106
106
|
"build": "rm -rf dist && tsc && pnpm build:lib && pnpm build:lib:cjs && pnpm build:browser && pnpm build:cli && pnpm build:shell && pnpm build:worker && pnpm build:clean && cp dist/index.d.ts dist/index.d.cts && sed '1,/^-->/d' AGENTS.npm.md > dist/AGENTS.md",
|
|
107
107
|
"build:clean": "find dist -name '*.test.js' -delete && find dist -name '*.test.d.ts' -delete",
|
|
108
|
-
"build:worker": "esbuild src/commands/python3/worker.ts --bundle --platform=node --format=esm --outfile=src/commands/python3/worker.js --external:../../../vendor/cpython-emscripten/* && cp src/commands/python3/worker.js dist/commands/python3/worker.js && mkdir -p dist/bin/chunks && cp src/commands/python3/worker.js dist/bin/chunks/worker.js && mkdir -p dist/bundle/chunks && cp src/commands/python3/worker.js dist/bundle/chunks/worker.js && esbuild src/commands/
|
|
109
|
-
"build:lib": "esbuild dist/index.js --bundle --splitting --platform=node --format=esm --minify --outdir=dist/bundle --chunk-names=chunks/[name]-[hash] --banner:js='import{createRequire} from\"node:module\";const require=createRequire(import.meta.url);' --external:diff --external:sprintf-js --external:turndown --external:sql.js --external:
|
|
110
|
-
"build:lib:cjs": "esbuild dist/index.js --bundle --platform=node --format=cjs --minify --outfile=dist/bundle/index.cjs --external:diff --external:sprintf-js --external:turndown --external:sql.js --external:
|
|
108
|
+
"build:worker": "esbuild src/commands/python3/worker.ts --bundle --platform=node --format=esm --outfile=src/commands/python3/worker.js --external:../../../vendor/cpython-emscripten/* && cp src/commands/python3/worker.js dist/commands/python3/worker.js && mkdir -p dist/bin/chunks && cp src/commands/python3/worker.js dist/bin/chunks/worker.js && mkdir -p dist/bundle/chunks && cp src/commands/python3/worker.js dist/bundle/chunks/worker.js && esbuild src/commands/sqlite3/worker.ts --bundle --platform=node --format=esm --outfile=src/commands/sqlite3/worker.js --external:sql.js && mkdir -p dist/commands/sqlite3 && cp src/commands/sqlite3/worker.js dist/commands/sqlite3/worker.js && cp src/commands/sqlite3/worker.js dist/bin/chunks/sqlite3-worker.js && cp src/commands/sqlite3/worker.js dist/bundle/chunks/sqlite3-worker.js",
|
|
109
|
+
"build:lib": "esbuild dist/index.js --bundle --splitting --platform=node --format=esm --minify --outdir=dist/bundle --chunk-names=chunks/[name]-[hash] --banner:js='import{createRequire} from\"node:module\";const require=createRequire(import.meta.url);' --external:diff --external:sprintf-js --external:turndown --external:sql.js --external:run --external:@mongodb-js/zstd --external:node-liblzma --external:seek-bzip --external:guarded-fetch",
|
|
110
|
+
"build:lib:cjs": "esbuild dist/index.js --bundle --platform=node --format=cjs --minify --outfile=dist/bundle/index.cjs --external:diff --external:sprintf-js --external:turndown --external:sql.js --external:run --external:@mongodb-js/zstd --external:node-liblzma --external:seek-bzip --external:guarded-fetch",
|
|
111
111
|
"build:browser": "esbuild dist/browser.js --bundle --platform=browser --format=esm --minify --outfile=dist/bundle/browser.js --external:diff --external:sprintf-js --external:turndown --external:undici --external:guarded-fetch --external:node:zlib --external:@mongodb-js/zstd --external:node-liblzma --external:seek-bzip --define:__BROWSER__=true --alias:node:async_hooks=./src/shims/browser-unsupported.js --alias:node:dns=./src/shims/browser-unsupported.js --alias:node:module=./src/shims/browser-unsupported.js",
|
|
112
|
-
"build:cli": "esbuild dist/cli/just-bash.js --bundle --splitting --platform=node --format=esm --minify --outdir=dist/bin --entry-names=[name] --chunk-names=chunks/[name]-[hash] --banner:js='#!/usr/bin/env node\nimport{createRequire} from\"node:module\";const require=createRequire(import.meta.url);' --external:sql.js --external:
|
|
113
|
-
"build:shell": "esbuild dist/cli/shell.js --bundle --splitting --platform=node --format=esm --minify --outdir=dist/bin/shell --entry-names=[name] --chunk-names=chunks/[name]-[hash] --banner:js='#!/usr/bin/env node\nimport{createRequire} from\"node:module\";const require=createRequire(import.meta.url);' --external:sql.js --external:
|
|
112
|
+
"build:cli": "esbuild dist/cli/just-bash.js --bundle --splitting --platform=node --format=esm --minify --outdir=dist/bin --entry-names=[name] --chunk-names=chunks/[name]-[hash] --banner:js='#!/usr/bin/env node\nimport{createRequire} from\"node:module\";const require=createRequire(import.meta.url);' --external:sql.js --external:run --external:@mongodb-js/zstd --external:node-liblzma --external:seek-bzip",
|
|
113
|
+
"build:shell": "esbuild dist/cli/shell.js --bundle --splitting --platform=node --format=esm --minify --outdir=dist/bin/shell --entry-names=[name] --chunk-names=chunks/[name]-[hash] --banner:js='#!/usr/bin/env node\nimport{createRequire} from\"node:module\";const require=createRequire(import.meta.url);' --external:sql.js --external:run --external:@mongodb-js/zstd --external:node-liblzma --external:seek-bzip",
|
|
114
114
|
"validate": "pnpm lint && pnpm knip && pnpm typecheck && pnpm build && pnpm check:worker-sync && pnpm test:run && pnpm test:wasm && pnpm test:dist",
|
|
115
115
|
"typecheck": "tsc --noEmit",
|
|
116
116
|
"lint": "pnpm lint:banned",
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{a,b}from"./chunk-67XYNGRV.js";import"./chunk-GR4ZHKXI.js";import"./chunk-HWI42GQO.js";import"./chunk-I57EACSL.js";import"./chunk-WEHA3JFD.js";import"./chunk-43E7AR6A.js";import"./chunk-FUT3X2GJ.js";import"./chunk-CPKBPQ2C.js";import"./chunk-PBOVSFTJ.js";import"./chunk-MUFNRCMY.js";import"./chunk-DN2YCFOR.js";export{a as chmodCommand,b as flagsForFuzzing};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{b as D}from"./chunk-CPKBPQ2C.js";import{a as N}from"./chunk-NE4R2FVV.js";import{a as H,b as A}from"./chunk-MUFNRCMY.js";var b=class{diff(e,n,t={}){let i;typeof t=="function"?(i=t,t={}):"callback"in t&&(i=t.callback);let d=this.castInput(e,t),o=this.castInput(n,t),s=this.removeEmpty(this.tokenize(d,t)),a=this.removeEmpty(this.tokenize(o,t));return this.diffWithOptionsObj(s,a,t,i)}diffWithOptionsObj(e,n,t,i){var d;let o=l=>{if(l=this.postProcess(l,t),i){setTimeout(function(){i(l)},0);return}else return l},s=n.length,a=e.length,u=1,r=s+a;t.maxEditLength!=null&&(r=Math.min(r,t.maxEditLength));let g=(d=t.timeout)!==null&&d!==void 0?d:1/0,w=Date.now()+g,m=[{oldPos:-1,lastComponent:void 0}],C=this.extractCommon(m[0],n,e,0,t);if(m[0].oldPos+1>=a&&C+1>=s)return o(this.buildValues(m[0].lastComponent,n,e));let P=-1/0,x=1/0,L=()=>{for(let l=Math.max(P,-u);l<=Math.min(x,u);l+=2){let c,h=m[l-1],p=m[l+1];h&&(m[l-1]=void 0);let y=!1;if(p){let S=p.oldPos-l;y=p&&0<=S&&S<s}let v=h&&h.oldPos+1<a;if(!y&&!v){m[l]=void 0;continue}if(!v||y&&h.oldPos<p.oldPos?c=this.addToPath(p,!0,!1,0,t):c=this.addToPath(h,!1,!0,1,t),C=this.extractCommon(c,n,e,l,t),c.oldPos+1>=a&&C+1>=s)return o(this.buildValues(c.lastComponent,n,e))||!0;m[l]=c,c.oldPos+1>=a&&(x=Math.min(x,l-1)),C+1>=s&&(P=Math.max(P,l+1))}u++};if(i)(function l(){setTimeout(function(){if(u>r||Date.now()>w)return i(void 0);L()||l()},0)})();else for(;u<=r&&Date.now()<=w;){let l=L();if(l)return l}}addToPath(e,n,t,i,d){let o=e.lastComponent;return o&&!d.oneChangePerToken&&o.added===n&&o.removed===t?{oldPos:e.oldPos+i,lastComponent:{count:o.count+1,added:n,removed:t,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:n,removed:t,previousComponent:o}}}extractCommon(e,n,t,i,d){let o=n.length,s=t.length,a=e.oldPos,u=a-i,r=0;for(;u+1<o&&a+1<s&&this.equals(t[a+1],n[u+1],d);)u++,a++,r++,d.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return r&&!d.oneChangePerToken&&(e.lastComponent={count:r,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=a,u}equals(e,n,t){return t.comparator?t.comparator(e,n):e===n||!!t.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){let n=[];for(let t=0;t<e.length;t++)e[t]&&n.push(e[t]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,t){let i=[],d;for(;e;)i.push(e),d=e.previousComponent,delete e.previousComponent,e=d;i.reverse();let o=i.length,s=0,a=0,u=0;for(;s<o;s++){let r=i[s];if(r.removed)r.value=this.join(t.slice(u,u+r.count)),u+=r.count;else{if(!r.added&&this.useLongestToken){let g=n.slice(a,a+r.count);g=g.map(function(w,m){let C=t[u+m];return C.length>w.length?C:w}),r.value=this.join(g)}else r.value=this.join(n.slice(a,a+r.count));a+=r.count,r.added||(u+=r.count)}}return i}};var I=class extends b{constructor(){super(...arguments),this.tokenize=W}equals(e,n,t){return t.ignoreWhitespace?((!t.newlineIsToken||!e.includes(`
|
|
4
|
-
`))&&(e=e.trim()),(!t.newlineIsToken||!n.includes(`
|
|
5
|
-
`))&&(n=n.trim())):t.ignoreNewlineAtEof&&!t.newlineIsToken&&(e.endsWith(`
|
|
6
|
-
`)&&(e=e.slice(0,-1)),n.endsWith(`
|
|
7
|
-
`)&&(n=n.slice(0,-1))),super.equals(e,n,t)}},O=new I;function T(f,e,n){return O.diff(f,e,n)}function W(f,e){e.stripTrailingCr&&(f=f.replace(/\r\n/g,`
|
|
8
|
-
`));let n=[],t=f.split(/(\n|\r\n)/);t[t.length-1]||t.pop();for(let i=0;i<t.length;i++){let d=t[i];i%2&&!e.newlineIsToken?n[n.length-1]+=d:n.push(d)}return n}var j={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function F(f,e,n,t,i,d,o){let s;o?typeof o=="function"?s={callback:o}:s=o:s={},typeof s.context>"u"&&(s.context=4);let a=s.context;if(s.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(s.callback){let{callback:r}=s;T(n,t,Object.assign(Object.assign({},s),{callback:g=>{let w=u(g);r(w)}}))}else return u(T(n,t,s));function u(r){if(!r)return;r.push({value:"",lines:[]});function g(l){return l.map(function(c){return" "+c})}let w=[],m=0,C=0,P=[],x=1,L=1;for(let l=0;l<r.length;l++){let c=r[l],h=c.lines||R(c.value);if(c.lines=h,c.added||c.removed){if(!m){let p=r[l-1];m=x,C=L,p&&(P=a>0?g(p.lines.slice(-a)):[],m-=P.length,C-=P.length)}for(let p of h)P.push((c.added?"+":"-")+p);c.added?L+=h.length:x+=h.length}else{if(m)if(h.length<=a*2&&l<r.length-2)for(let p of g(h))P.push(p);else{let p=Math.min(h.length,a);for(let v of g(h.slice(0,p)))P.push(v);let y={oldStart:m,oldLines:x-m+p,newStart:C,newLines:L-C+p,lines:P};w.push(y),m=0,C=0,P=[]}x+=h.length,L+=h.length}}for(let l of w)for(let c=0;c<l.lines.length;c++)l.lines[c].endsWith(`
|
|
9
|
-
`)?l.lines[c]=l.lines[c].slice(0,-1):(l.lines.splice(c+1,0,"\"),c++);return{oldFileName:f,newFileName:e,oldHeader:i,newHeader:d,hunks:w}}}function E(f,e){if(e||(e=j),Array.isArray(f)){if(f.length>1&&!e.includeFileHeaders)throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return f.map(t=>E(t,e)).join(`
|
|
10
|
-
`)}let n=[];e.includeIndex&&f.oldFileName==f.newFileName&&n.push("Index: "+f.oldFileName),e.includeUnderline&&n.push("==================================================================="),e.includeFileHeaders&&(n.push("--- "+f.oldFileName+(typeof f.oldHeader>"u"?"":" "+f.oldHeader)),n.push("+++ "+f.newFileName+(typeof f.newHeader>"u"?"":" "+f.newHeader)));for(let t=0;t<f.hunks.length;t++){let i=f.hunks[t];i.oldLines===0&&(i.oldStart-=1),i.newLines===0&&(i.newStart-=1),n.push("@@ -"+i.oldStart+","+i.oldLines+" +"+i.newStart+","+i.newLines+" @@");for(let d of i.lines)n.push(d)}return n.join(`
|
|
11
|
-
`)+`
|
|
12
|
-
`}function k(f,e,n,t,i,d,o){if(typeof o=="function"&&(o={callback:o}),o?.callback){let{callback:s}=o;F(f,e,n,t,i,d,Object.assign(Object.assign({},o),{callback:a=>{s(a?E(a,o.headerOptions):void 0)}}))}else{let s=F(f,e,n,t,i,d,o);return s?E(s,o?.headerOptions):void 0}}function R(f){let e=f.endsWith(`
|
|
13
|
-
`),n=f.split(`
|
|
14
|
-
`).map(t=>t+`
|
|
15
|
-
`);return e?n.pop():n.push(n.pop().slice(0,-1)),n}var z={name:"diff",summary:"compare files line by line",usage:"diff [OPTION]... FILE1 FILE2",options:["-u, --unified output unified diff format (default)","-q, --brief report only whether files differ","-s, --report-identical-files report when files are the same","-i, --ignore-case ignore case differences"," --help display this help and exit"]},_={unified:{short:"u",long:"unified",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"}},ee={name:"diff",async execute(f,e){if(A(f))return H(z);let n=N("diff",f,_);if(!n.ok)return n.error;let t=n.result.flags.brief,i=n.result.flags.reportSame,d=n.result.flags.ignoreCase,o=n.result.positional;if(n.result.flags.unified,o.length<2)return{stdout:"",stderr:`diff: missing operand
|
|
16
|
-
`,exitCode:2};let s,a,[u,r]=o;try{s=u==="-"?D(e.stdin):await e.fs.readFile(e.fs.resolvePath(e.cwd,u))}catch{return{stdout:"",stderr:`diff: ${u}: No such file or directory
|
|
17
|
-
`,exitCode:2}}try{a=r==="-"?D(e.stdin):await e.fs.readFile(e.fs.resolvePath(e.cwd,r))}catch{return{stdout:"",stderr:`diff: ${r}: No such file or directory
|
|
18
|
-
`,exitCode:2}}let g=s,w=a;return d&&(g=g.toLowerCase(),w=w.toLowerCase()),g===w?i?{stdout:`Files ${u} and ${r} are identical
|
|
19
|
-
`,stderr:"",exitCode:0}:{stdout:"",stderr:"",exitCode:0}:t?{stdout:`Files ${u} and ${r} differ
|
|
20
|
-
`,stderr:"",exitCode:1}:{stdout:k(u,r,s,a,"","",{context:3}),stderr:"",exitCode:1}}},ne={name:"diff",flags:[{flag:"-u",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-i",type:"boolean"}],needsArgs:!0,minArgs:2};export{ee as a,ne as b};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
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 l(n,t){let r=o(n),e=o(t);return e===r||r==="/"||e.startsWith(`${r}/`)}function u(n,t){if(n.includes("\0"))throw new Error(`ENOENT: path contains null byte, ${t} '${n}'`)}function s(n){let t=o(n);if(t==="/")return"/";let r=t.lastIndexOf("/");return r===0?"/":t.slice(0,r)}function f(n,t){if(t.startsWith("/"))return o(t);let r=n==="/"?`/${t}`:`${n}/${t}`;return o(r)}function c(n,t){return n==="/"?`/${t}`:`${n}/${t}`}function a(n,t){if(t.startsWith("/"))return o(t);let r=s(n);return o(c(r,t))}export{o as a,l as b,u as c,s as d,f as e,c as f,a as g};
|
|
@@ -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 F,d as O,e as T}from"./chunk-WEHA3JFD.js";import{b as S}from"./chunk-43E7AR6A.js";import{l as v,m as w}from"./chunk-FUT3X2GJ.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 R={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"]},H={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"}},j={name:"cp",async execute(u,e){if(C(u))return $(R);let s=E("cp",u,H);if(!s.ok)return s.error;let d=s.result.flags.recursive||s.result.flags.recursiveUpper,k=s.result.flags.noClobber,A=s.result.flags.preserve,N=s.result.flags.verbose,p=s.result.positional;if(p.length<2)return{stdout:"",stderr:`cp: missing destination file operand
|
|
4
|
-
`,exitCode:1};let g=p.pop()??"",m=p,l=e.fs.resolvePath(e.cwd,g),y="",n="",i=0,h=new O({limits:e.limits,signal:e.signal,executionScope:e.executionScope,site:"cp"}),f=!1;try{f=(await e.fs.stat(l)).isDirectory}catch{}if(m.length>1&&!f)return{stdout:"",stderr:`cp: target '${g}' is not a directory
|
|
5
|
-
`,exitCode:1};for(let t of m)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 F(e.fs,o,r,h);if(S(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(k)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 T({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}),N&&(y+=`'${t}' -> '${r}'
|
|
11
|
-
`)}catch(o){if(o instanceof v||o instanceof w)throw o;let a=D(o);a.includes("ENOENT")||a.includes("no such file")?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}}},q={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{j as a,q as b};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{d as V}from"./chunk-I57EACSL.js";import{d as B}from"./chunk-WEHA3JFD.js";import{l as _,m as Y}from"./chunk-FUT3X2GJ.js";import{a as J}from"./chunk-CPKBPQ2C.js";import{a as Q}from"./chunk-NE4R2FVV.js";import{a as Z,b as q}from"./chunk-MUFNRCMY.js";function h(s,t,e){if(J(e)>s.limits.maxOutputSize-J(t))throw new _(`ls: output size limit exceeded (${s.limits.maxOutputSize} bytes)`,"output_size");return t+e}function X(s,t){let e=new V(s.limits.maxOutputSize,"ls");for(let l=0;l<t.length;l++)l>0&&e.append(`
|
|
4
|
-
`),e.append(t[l]);return t.length>0&&e.append(`
|
|
5
|
-
`),e.build()}function I(s){if(s<1024)return String(s);if(s<1024*1024){let e=s/1024;return e<10?`${e.toFixed(1)}K`:`${Math.round(e)}K`}if(s<1024*1024*1024){let e=s/1048576;return e<10?`${e.toFixed(1)}M`:`${Math.round(e)}M`}let t=s/(1024*1024*1024);return t<10?`${t.toFixed(1)}G`:`${Math.round(t)}G`}function K(s){let e=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][s.getMonth()],l=String(s.getDate()).padStart(2," "),p=new Date,g=new Date(p.getTime()-4320*60*60*1e3);if(s>g){let z=String(s.getHours()).padStart(2,"0"),d=String(s.getMinutes()).padStart(2,"0");return`${e} ${l} ${z}:${d}`}let b=s.getFullYear();return`${e} ${l} ${b}`}function W(s){return s.isDirectory?"/":s.isSymbolicLink?"@":(s.mode&73)!==0?"*":""}var nt={name:"ls",summary:"list directory contents",usage:"ls [OPTION]... [FILE]...",options:["-a, --all do not ignore entries starting with .","-A, --almost-all do not list . and ..","-d, --directory list directories themselves, not their contents","-F, --classify append indicator (one of */=>@) to entries","-h, --human-readable with -l, print sizes like 1K 234M 2G etc.","-l use a long listing format","-r, --reverse reverse order while sorting","-R, --recursive list subdirectories recursively","-S sort by file size, largest first","-t sort by time, newest first","-1 list one file per line"," --help display this help and exit"]},ot={showAll:{short:"a",long:"all",type:"boolean"},showAlmostAll:{short:"A",long:"almost-all",type:"boolean"},longFormat:{short:"l",type:"boolean"},humanReadable:{short:"h",long:"human-readable",type:"boolean"},recursive:{short:"R",long:"recursive",type:"boolean"},reverse:{short:"r",long:"reverse",type:"boolean"},sortBySize:{short:"S",type:"boolean"},classifyFiles:{short:"F",long:"classify",type:"boolean"},directoryOnly:{short:"d",long:"directory",type:"boolean"},sortByTime:{short:"t",type:"boolean"},onePerLine:{short:"1",type:"boolean"}},pt={name:"ls",async execute(s,t){if(q(s))return Z(nt);let e=Q("ls",s,ot);if(!e.ok)return e.error;let l=e.result.flags.showAll,p=e.result.flags.showAlmostAll,g=e.result.flags.longFormat,b=e.result.flags.humanReadable,z=e.result.flags.recursive,d=e.result.flags.reverse,$=e.result.flags.classifyFiles,O=e.result.flags.directoryOnly,R=it(s,e.result.flags.sortBySize,e.result.flags.sortByTime);e.result.flags.onePerLine;let F=e.result.positional;F.length===0&&F.push(".");let S="",P="",C=0,M=new B({limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"ls"});if(O){for(let n of await G(F,t,R,d,M)){M.visit(0);let i=t.fs.resolvePath(t.cwd,n);try{let D=await t.fs.stat(i);if(g){let L=D.isDirectory?"drwxr-xr-x":"-rw-r--r--",c=$?W(await t.fs.lstat(i)):"",u=D.size??0,A=b?I(u).padStart(5):String(u).padStart(5),a=D.mtime??new Date(0),o=K(a);S=h(t,S,`${L} 1 user user ${A} ${o} ${n}${c}
|
|
6
|
-
`)}else{let L=$?W(await t.fs.lstat(i)):"";S=h(t,S,`${n}${L}
|
|
7
|
-
`)}}catch{P=h(t,P,`ls: cannot access '${n}': No such file or directory
|
|
8
|
-
`),C=2}}return{stdout:S,stderr:P,exitCode:C}}let m=[],y=[];for(let n of F){M.visit(0);try{((await t.fs.stat(t.fs.resolvePath(t.cwd,n))).isDirectory?y:m).push(n)}catch{P=h(t,P,`ls: ${n}: No such file or directory
|
|
9
|
-
`),C=2}}let T=async(n,i)=>{let D=await x(n,t,l,p,g,z,i,d,b,R,$,!1,M,0,new Set,!0);S=h(t,S,D.stdout),P=h(t,P,D.stderr),D.exitCode!==0&&(C=D.exitCode)};for(let n of await G(m,t,R,d,M))await T(n,!1);let N=F.length>1;for(let n of await G(y,t,R,d,M))S&&(S=h(t,S,`
|
|
10
|
-
`)),await T(n,N);return{stdout:S,stderr:P,exitCode:C}}};function it(s,t,e){if(!t&&!e)return"name";if(t!==e)return t?"size":"time";let l="name";for(let p of s){if(p==="--")break;if(!(!p.startsWith("-")||p.startsWith("--")))for(let g of p.slice(1))g==="S"?l="size":g==="t"&&(l="time")}return l}async function G(s,t,e,l,p){return await j(s,g=>t.fs.resolvePath(t.cwd,g),t,e,l,p)}async function j(s,t,e,l,p,g){let b=[...s];if(l==="name")b.sort();else{g?.checkpoint(b.length);let z=new Map;for(let d of b)try{let $=await e.fs.lstat(t(d));z.set(d,l==="size"?$.size??0:($.mtime??new Date(0)).getTime())}catch{z.set(d,0)}b.sort((d,$)=>{let O=(z.get($)??0)-(z.get(d)??0);return O!==0?O:d<$?-1:d>$?1:0})}return p&&b.reverse(),b}async function x(s,t,e,l,p,g,b,z=!1,d=!1,$="name",O=!1,R=!1,F=new B({limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"ls"}),S=0,P=new Set,C=!1){let M=e||l,m=t.fs.resolvePath(t.cwd,s);try{C||F.visit(S);let y=await t.fs.stat(m);if(!y.isDirectory){let c=O?W(await t.fs.lstat(m)):"";if(p){let u=y.size??0,A=d?I(u).padStart(5):String(u).padStart(5),a=y.mtime??new Date(0),o=K(a);return{stdout:`-rw-r--r-- 1 user user ${A} ${o} ${s}${c}
|
|
11
|
-
`,stderr:"",exitCode:0}}return{stdout:`${s}${c}
|
|
12
|
-
`,stderr:"",exitCode:0}}let T=y.identity??(y.dev!==void 0&&y.ino!==void 0?`${String(y.dev)}:${String(y.ino)}`:await t.fs.realpath(m).catch(()=>{}));if(T!==void 0&&P.has(T))return{stdout:"",stderr:`ls: ${s}: symbolic link cycle detected
|
|
13
|
-
`,exitCode:2};let N=new Set(P);T!==void 0&&N.add(T);let n=await t.fs.readdir(m);F.checkpoint(),M||(n=n.filter(c=>!c.startsWith("."))),n=await j(n,c=>m==="/"?`/${c}`:`${m}/${c}`,t,$,!1,F),e&&(n=[".","..",...n]),z&&n.reverse();let i="",D="",L=0;if((g||b)&&(i=h(t,i,`${s}:
|
|
14
|
-
`)),p){i=h(t,i,`total ${n.length}
|
|
15
|
-
`);let c=n.filter(o=>o==="."||o===".."),u=n.filter(o=>o!=="."&&o!=="..");for(let o of c)i=h(t,i,`drwxr-xr-x 1 user user 0 Jan 1 00:00 ${o}
|
|
16
|
-
`);let A=[];for(let o=0;o<u.length;o+=100){let r=u.slice(o,o+100),f=await Promise.all(r.map(async v=>{let w=m==="/"?`/${v}`:`${m}/${v}`;try{let k=await t.fs.stat(w),H=k.isDirectory?"drwxr-xr-x":"-rw-r--r--",tt=O?W(await t.fs.lstat(w)):"",U=k.size??0,et=d?I(U).padStart(5):String(U).padStart(5),st=k.mtime??new Date(0),rt=K(st);return{name:v,line:`${H} 1 user user ${et} ${rt} ${v}${tt}
|
|
17
|
-
`}}catch{return{name:v,line:`-rw-r--r-- 1 user user 0 Jan 1 00:00 ${v}
|
|
18
|
-
`}}}));A.push(...f)}let a=new Map(u.map((o,r)=>[o,r]));A.sort((o,r)=>(a.get(o.name)??0)-(a.get(r.name)??0));for(let{line:o}of A)i=h(t,i,o)}else if(O){let c=[],u=n.filter(a=>a!=="."&&a!==".."),A=n.filter(a=>a==="."||a==="..");for(let a of A)c.push(`${a}/`);for(let a=0;a<u.length;a+=100){let o=u.slice(a,a+100),r=await Promise.all(o.map(async f=>{let v=m==="/"?`/${f}`:`${m}/${f}`;try{let w=await t.fs.lstat(v);return`${f}${W(w)}`}catch{return f}}));c.push(...r)}i=h(t,i,X(t,c))}else i=h(t,i,X(t,n));if(g){let c=n.filter(r=>r!=="."&&r!==".."),u=[];if(t.fs.readdirWithFileTypes)u=(await t.fs.readdirWithFileTypes(m)).filter(f=>f.isDirectory&&c.includes(f.name)).map(f=>({name:f.name,isDirectory:!0}));else for(let r=0;r<c.length;r+=100){let f=c.slice(r,r+100),v=await Promise.all(f.map(async w=>{let k=m==="/"?`/${w}`:`${m}/${w}`;try{let H=await t.fs.stat(k);return{name:w,isDirectory:H.isDirectory}}catch{return{name:w,isDirectory:!1}}}));u.push(...v.filter(w=>w.isDirectory))}let A=await j(u.map(r=>r.name),r=>m==="/"?`/${r}`:`${m}/${r}`,t,$,z,F),a=new Map(A.map((r,f)=>[r,f]));u.sort((r,f)=>(a.get(r.name)??0)-(a.get(f.name)??0));let o=[];for(let r=0;r<u.length;r+=100){let f=u.slice(r,r+100),v=await Promise.all(f.map(async w=>{let k=s==="."?`./${w.name}`:`${s}/${w.name}`,H=await x(k,t,e,l,p,g,!1,z,d,$,O,!0,F,S+1,N);return{name:w.name,result:H}}));o.push(...v)}o.sort((r,f)=>(a.get(r.name)??0)-(a.get(f.name)??0));for(let{result:r}of o)i=h(t,i,`
|
|
19
|
-
`),i=h(t,i,r.stdout),D=h(t,D,r.stderr),r.exitCode!==0&&(L=r.exitCode)}return{stdout:i,stderr:D,exitCode:L}}catch(y){if(y instanceof _||y instanceof Y)throw y;return{stdout:"",stderr:`ls: ${s}: No such file or directory
|
|
20
|
-
`,exitCode:2}}}var ht={name:"ls",flags:[{flag:"-a",type:"boolean"},{flag:"-A",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-h",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-S",type:"boolean"},{flag:"-F",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-1",type:"boolean"}],needsFiles:!0};export{pt as a,ht as b};
|
|
@@ -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 F,c as N,d as O,e as T}from"./chunk-WEHA3JFD.js";import{b as P}from"./chunk-43E7AR6A.js";import{l as w,m as $}from"./chunk-FUT3X2GJ.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 A={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"]},H={force:{short:"f",long:"force",type:"boolean"},noClobber:{short:"n",long:"no-clobber",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},U={name:"mv",async execute(p,e){if(E(p))return C(A);let r=S("mv",p,H);if(!r.ok)return r.error;let u=r.result.flags.force,v=r.result.flags.noClobber,k=r.result.flags.verbose,d=r.result.positional;if(v&&(u=!1),d.length<2)return{stdout:"",stderr:`mv: missing destination file operand
|
|
4
|
-
`,exitCode:1};let f=d.pop()??"",g=d,c=e.fs.resolvePath(e.cwd,f),h="",i="",l=0,b=new O({limits:e.limits,signal:e.signal,executionScope:e.executionScope,site:"mv"}),m=!1;try{m=(await e.fs.stat(c)).isDirectory}catch{}if(g.length>1&&!m)return{stdout:"",stderr:`mv: target '${f}' 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),n=c;if(m){let s=t.split("/").pop()||t;n=c==="/"?`/${s}`:`${c}/${s}`}if(a.isDirectory){let s=await N(e.fs,o,n,b);if(P(o,n)||s==="inside"){i+=`mv: cannot move '${t}' into itself, '${n}'
|
|
6
|
-
`,l=1;continue}if(s==="unknown"){i+=`mv: cannot safely determine whether '${n}' is inside '${t}'
|
|
7
|
-
`,l=1;continue}}if(v)try{await e.fs.stat(n);continue}catch{}let y=await F(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
|
-
`,l=1;continue}if(a.isDirectory&&await T({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),k){let s=m?`${f}/${t.split("/").pop()||t}`:f;h+=`renamed '${t}' -> '${s}'
|
|
9
|
-
`}}catch(o){if(o instanceof w||o instanceof $)throw o;let a=D(o);a.includes("ENOENT")||a.includes("no such file")?i+=`mv: cannot stat '${t}': No such file or directory
|
|
10
|
-
`:i+=`mv: cannot move '${t}': ${a}
|
|
11
|
-
`,l=1}return{stdout:h,stderr:i,exitCode:l}}},j={name:"mv",flags:[{flag:"-f",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2};export{U as a,j as b};
|