@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
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{a,b}from"./chunk-
|
|
3
|
+
import{a,b}from"./chunk-ZVG47PYA.js";import"./chunk-MROECM42.js";import"./chunk-42AMF6EE.js";import"./chunk-YXPSX3SI.js";import"./chunk-GR4ZHKXI.js";import"./chunk-HWI42GQO.js";import"./chunk-YERKK5B3.js";import"./chunk-I57EACSL.js";import"./chunk-FUT3X2GJ.js";import"./chunk-CPKBPQ2C.js";import"./chunk-MUFNRCMY.js";import"./chunk-DN2YCFOR.js";export{a as awkCommand2,b as flagsForFuzzing};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
+
import{a,b}from"./chunk-T6OIISUC.js";import"./chunk-GR4ZHKXI.js";import"./chunk-HWI42GQO.js";import"./chunk-I57EACSL.js";import"./chunk-MBREBDZQ.js";import"./chunk-HWK7KFGB.js";import"./chunk-FUT3X2GJ.js";import"./chunk-CPKBPQ2C.js";import"./chunk-OHFB3M3X.js";import"./chunk-PBOVSFTJ.js";import"./chunk-MUFNRCMY.js";import"./chunk-DN2YCFOR.js";export{a as chmodCommand,b as flagsForFuzzing};
|
|
@@ -0,0 +1,27 @@
|
|
|
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,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{d as C}from"./chunk-
|
|
3
|
+
import{d as C}from"./chunk-MBREBDZQ.js";import{a as g}from"./chunk-NE4R2FVV.js";import{a as v}from"./chunk-I4IRHQDW.js";var y=`Usage: rmdir [-pv] DIRECTORY...
|
|
4
4
|
Remove empty directories.
|
|
5
5
|
|
|
6
6
|
Options:
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
+
import{d as X}from"./chunk-I57EACSL.js";import{d as I}from"./chunk-MBREBDZQ.js";import{l as W,m as Z}from"./chunk-FUT3X2GJ.js";import{a as G}from"./chunk-CPKBPQ2C.js";import{a as V}from"./chunk-NE4R2FVV.js";import{a as q,b as Q}from"./chunk-MUFNRCMY.js";function h(s,t,e){if(G(e)>s.limits.maxOutputSize-G(t))throw new W(`ls: output size limit exceeded (${s.limits.maxOutputSize} bytes)`,"output_size");return t+e}function tt(s,t){if(t>s.limits.maxArrayElements)throw new W(`ls: array element limit exceeded (${s.limits.maxArrayElements})`,"array_elements")}function ot(s,t,e){tt(s,e),t.reserve(e)}function x(s,t){let e=new X(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 j(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 B(s){let e=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][s.getMonth()],l=String(s.getDate()).padStart(2," "),m=new Date,g=new Date(m.getTime()-4320*60*60*1e3);if(s>g){let D=String(s.getHours()).padStart(2,"0"),u=String(s.getMinutes()).padStart(2,"0");return`${e} ${l} ${D}:${u}`}let b=s.getFullYear();return`${e} ${l} ${b}`}function H(s){return s.isDirectory?"/":s.isSymbolicLink?"@":(s.mode&73)!==0?"*":""}var it={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"]},at={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"}},gt={name:"ls",async execute(s,t){if(Q(s))return q(it);let e=V("ls",s,at);if(!e.ok)return e.error;let l=e.result.flags.showAll,m=e.result.flags.showAlmostAll,g=e.result.flags.longFormat,b=e.result.flags.humanReadable,D=e.result.flags.recursive,u=e.result.flags.reverse,w=e.result.flags.classifyFiles,P=e.result.flags.directoryOnly,R=lt(s,e.result.flags.sortBySize,e.result.flags.sortByTime);e.result.flags.onePerLine;let z=e.result.positional;z.length===0&&z.push(".");let $="",E="",C=0,O=new I({limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"ls"});if(P){for(let n of await K(z,t,R,u,O)){O.visit(0);let i=t.fs.resolvePath(t.cwd,n);try{let v=await t.fs.stat(i);if(g){let L=v.isDirectory?"drwxr-xr-x":"-rw-r--r--",c=w?H(await t.fs.lstat(i)):"",S=v.size??0,y=b?j(S).padStart(5):String(S).padStart(5),f=v.mtime??new Date(0),o=B(f);$=h(t,$,`${L} 1 user user ${y} ${o} ${n}${c}
|
|
6
|
+
`)}else{let L=w?H(await t.fs.lstat(i)):"";$=h(t,$,`${n}${L}
|
|
7
|
+
`)}}catch{E=h(t,E,`ls: cannot access '${n}': No such file or directory
|
|
8
|
+
`),C=2}}return{stdout:$,stderr:E,exitCode:C}}let d=[],p=[];for(let n of z){O.visit(0);try{(await t.fs.stat(t.fs.resolvePath(t.cwd,n))).isDirectory?(p.length>0&&O.reserve(1),p.push(n)):d.push(n)}catch{E=h(t,E,`ls: ${n}: No such file or directory
|
|
9
|
+
`),C=2}}let k=async(n,i)=>{let v=await et(n,t,l,m,g,D,i,u,b,R,w,!1,O,0,new Set,!0);$=h(t,$,v.stdout),E=h(t,E,v.stderr),v.exitCode!==0&&(C=v.exitCode)};for(let n of await K(d,t,R,u,O))await k(n,!1);let N=z.length>1;for(let n of await K(p,t,R,u,O))$&&($=h(t,$,`
|
|
10
|
+
`)),await k(n,N);return{stdout:$,stderr:E,exitCode:C}}};function lt(s,t,e){if(!t&&!e)return"name";if(t!==e)return t?"size":"time";let l="name";for(let m of s){if(m==="--")break;if(!(!m.startsWith("-")||m.startsWith("--")))for(let g of m.slice(1))g==="S"?l="size":g==="t"&&(l="time")}return l}async function K(s,t,e,l,m){return await U(s,g=>t.fs.resolvePath(t.cwd,g),t,e,l,m)}async function U(s,t,e,l,m,g){let b=[...s];if(l==="name")b.sort();else{g?.checkpoint(b.length);let D=new Map;for(let u of b)try{let w=await e.fs.lstat(t(u));D.set(u,l==="size"?w.size??0:(w.mtime??new Date(0)).getTime())}catch{D.set(u,0)}b.sort((u,w)=>{let P=(D.get(w)??0)-(D.get(u)??0);return P!==0?P:u<w?-1:u>w?1:0})}return m&&b.reverse(),b}async function et(s,t,e,l,m,g,b,D=!1,u=!1,w="name",P=!1,R=!1,z=new I({limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"ls"}),$=0,E=new Set,C=!1){let O=e||l,d=t.fs.resolvePath(t.cwd,s);try{C||z.visit($);let p=await t.fs.stat(d);if(!p.isDirectory){let c=P?H(await t.fs.lstat(d)):"";if(m){let S=p.size??0,y=u?j(S).padStart(5):String(S).padStart(5),f=p.mtime??new Date(0),o=B(f);return{stdout:`-rw-r--r-- 1 user user ${y} ${o} ${s}${c}
|
|
11
|
+
`,stderr:"",exitCode:0}}return{stdout:`${s}${c}
|
|
12
|
+
`,stderr:"",exitCode:0}}let k=p.identity??(p.dev!==void 0&&p.ino!==void 0?`${String(p.dev)}:${String(p.ino)}`:await t.fs.realpath(d).catch(()=>{}));if(k!==void 0&&E.has(k))return{stdout:"",stderr:`ls: ${s}: symbolic link cycle detected
|
|
13
|
+
`,exitCode:2};let N=new Set(E);k!==void 0&&N.add(k);let n=await t.fs.readdir(d);z.checkpoint(),ot(t,z,n.length+(e?2:0)),O||(n=n.filter(c=>!c.startsWith("."))),n=await U(n,c=>d==="/"?`/${c}`:`${d}/${c}`,t,w,!1,z),e&&(n=[".","..",...n]),D&&n.reverse();let i="",v="",L=0;if((g||b)&&(i=h(t,i,`${s}:
|
|
14
|
+
`)),m){i=h(t,i,`total ${n.length}
|
|
15
|
+
`);let c=n.filter(o=>o==="."||o===".."),S=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 y=[];for(let o=0;o<S.length;o+=100){let F=S.slice(o,o+100),r=await Promise.all(F.map(async a=>{let M=d==="/"?`/${a}`:`${d}/${a}`;try{let A=await t.fs.stat(M),J=A.isDirectory?"drwxr-xr-x":"-rw-r--r--",_=P?H(await t.fs.lstat(M)):"",Y=A.size??0,st=u?j(Y).padStart(5):String(Y).padStart(5),rt=A.mtime??new Date(0),nt=B(rt);return{name:a,line:`${J} 1 user user ${st} ${nt} ${a}${_}
|
|
17
|
+
`}}catch{return{name:a,line:`-rw-r--r-- 1 user user 0 Jan 1 00:00 ${a}
|
|
18
|
+
`}}}));y.push(...r)}let f=new Map(S.map((o,F)=>[o,F]));y.sort((o,F)=>(f.get(o.name)??0)-(f.get(F.name)??0));for(let{line:o}of y)i=h(t,i,o)}else if(P){let c=[],S=n.filter(f=>f!=="."&&f!==".."),y=n.filter(f=>f==="."||f==="..");for(let f of y)c.push(`${f}/`);for(let f=0;f<S.length;f+=100){let o=S.slice(f,f+100),F=await Promise.all(o.map(async r=>{let a=d==="/"?`/${r}`:`${d}/${r}`;try{let M=await t.fs.lstat(a);return`${r}${H(M)}`}catch{return r}}));c.push(...F)}i=h(t,i,x(t,c))}else i=h(t,i,x(t,n));if(g){let c=n.filter(r=>r!=="."&&r!==".."),S=new Set(c),y=[];if(t.fs.readdirWithFileTypes){let r=await t.fs.readdirWithFileTypes(d);z.checkpoint(),tt(t,r.length),y=r.filter(a=>a.isDirectory&&S.has(a.name)).map(a=>({name:a.name,isDirectory:!0}))}else for(let r=0;r<c.length;r+=100){let a=c.slice(r,r+100),M=await Promise.all(a.map(async A=>{let J=d==="/"?`/${A}`:`${d}/${A}`;try{let _=await t.fs.stat(J);return{name:A,isDirectory:_.isDirectory}}catch{return{name:A,isDirectory:!1}}}));y.push(...M.filter(A=>A.isDirectory))}let f=await U(y.map(r=>r.name),r=>d==="/"?`/${r}`:`${d}/${r}`,t,w,D,z),o=new Map(f.map((r,a)=>[r,a]));y.sort((r,a)=>(o.get(r.name)??0)-(o.get(a.name)??0));let F=[];for(let r of y){let a=s==="."?`./${r.name}`:`${s}/${r.name}`,M=await et(a,t,e,l,m,g,!1,D,u,w,P,!0,z,$+1,N);F.push({name:r.name,result:M})}F.sort((r,a)=>(o.get(r.name)??0)-(o.get(a.name)??0));for(let{result:r}of F)i=h(t,i,`
|
|
19
|
+
`),i=h(t,i,r.stdout),v=h(t,v,r.stderr),r.exitCode!==0&&(L=r.exitCode)}return{stdout:i,stderr:v,exitCode:L}}catch(p){if(p instanceof W||p instanceof Z)throw p;return{stdout:"",stderr:`ls: ${s}: No such file or directory
|
|
20
|
+
`,exitCode:2}}}var yt={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{gt as a,yt as b};
|
|
@@ -0,0 +1,13 @@
|
|
|
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,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{
|
|
3
|
+
import{c as l,d as u}from"./chunk-PPVF2N6C.js";import{randomBytes as h}from"node:crypto";var d=class{options;protocolToken=h(16).toString("hex");deadline;cleanups=[];cancelHandler;canceledReason;closed=!1;constructor(t){this.options=t,this.deadline=Date.now()+t.timeoutMs}arm(t){if(this.cancelHandler)throw new Error("worker request is already armed");this.cancelHandler=t;let a=this.options.signal;if(a){let i=()=>this.cancel("abort");a.addEventListener("abort",i,{once:!0}),this.cleanups.push(()=>a.removeEventListener("abort",i)),a.aborted&&this.cancel("abort")}if(!this.canceledReason){let i=l(()=>this.cancel("timeout"),Math.max(0,this.options.timeoutMs));i!==void 0&&this.cleanups.push(()=>u(i))}}get isCanceled(){return this.canceledReason!==void 0}remainingTimeMs(){return Math.max(0,this.deadline-Date.now())}timeoutMessage(t="Execution"){return`${t} timeout: exceeded ${this.options.timeoutMs}ms limit`}abortMessage(){return"Execution aborted"}assertMessageSize(t,a){if(f(t,this.options.maxMessageBytes)>this.options.maxMessageBytes)throw new Error(`${this.options.commandName}: worker ${a} exceeds ${this.options.maxMessageBytes} byte limit`)}async terminate(t){if(!t)return!0;try{return await t.terminate(),!0}catch{return!1}}close(){if(!this.closed){this.closed=!0;for(let t=this.cleanups.length-1;t>=0;t--)this.cleanups[t]();this.cleanups.length=0,this.cancelHandler=void 0}}cancel(t){this.closed||this.canceledReason||(this.canceledReason=t,this.cancelHandler?.(t))}};function f(o,t){let a=function*(n){for(let e in n)Object.hasOwn(n,e)&&(yield[e,n[e]])},i=[{kind:"value",value:o}],c=new WeakSet,s=0;for(;i.length>0&&s<=t;){let n=i.pop();if(!n)break;if(n.kind==="array"){n.index<n.value.length&&(i.push({...n,index:n.index+1}),i.push({kind:"value",value:n.value[n.index]}));continue}if(n.kind==="object"){let r=n.iterator.next();r.done||(s+=8+Buffer.byteLength(r.value[0],"utf8"),i.push(n),i.push({kind:"value",value:r.value[1]}));continue}let e=n.value;if(e==null)s+=4;else if(typeof e=="string")s+=Buffer.byteLength(e,"utf8");else if(typeof e=="number"||typeof e=="bigint")s+=8;else if(typeof e=="boolean")s+=1;else if(typeof e=="object"){if(c.has(e))continue;if(c.add(e),ArrayBuffer.isView(e))s+=e.byteLength;else if(e instanceof ArrayBuffer||e instanceof SharedArrayBuffer)s+=e.byteLength;else if(Array.isArray(e)){if(e.length>Math.floor((t-s)/8))return t+1;s+=e.length*8,i.push({kind:"array",value:e,index:0})}else i.push({kind:"object",iterator:a(e)})}}return s}export{d as a};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{d as k}from"./chunk-
|
|
3
|
+
import{d as k}from"./chunk-MBREBDZQ.js";import{l as u,m}from"./chunk-FUT3X2GJ.js";import{a as h,b as p,c as g}from"./chunk-MUFNRCMY.js";var w={name:"readlink",summary:"print resolved symbolic links or canonical file names",usage:"readlink [OPTIONS] FILE...",options:["-f canonicalize by following every symlink in every component of the given name recursively"," --help display this help and exit"]},x={name:"readlink",async execute(r,n){if(p(r))return h(w);let l=!1,t=0;for(;t<r.length&&r[t].startsWith("-");){let i=r[t];if(i==="-f"||i==="--canonicalize")l=!0,t++;else if(i==="--"){t++;break}else return g("readlink",i)}let c=r.slice(t);if(c.length===0)return{stdout:"",stderr:`readlink: missing operand
|
|
4
4
|
`,exitCode:1};let a="",d=!1,y=new k({limits:n.limits,signal:n.signal,executionScope:n.executionScope,site:"readlink",label:"symlink traversal"});for(let i of c){let s=n.fs.resolvePath(n.cwd,i);try{if(l){let e=s,o=new Set;for(;y.visit(o.size),!o.has(e);){o.add(e);try{let f=await n.fs.readlink(e);if(f.startsWith("/"))e=f;else{let b=e.substring(0,e.lastIndexOf("/"))||"/";e=n.fs.resolvePath(b,f)}}catch{break}}a+=`${e}
|
|
5
5
|
`}else{let e=await n.fs.readlink(s);a+=`${e}
|
|
6
6
|
`}}catch(e){if(e instanceof u||e instanceof m)throw e;l?a+=`${s}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{a as $,b as F,c as b,d as j,e as Ze,f as et,g as C,h as tt,i as nt,j as k,k as ie,l as ae}from"./chunk-V4U26ZWL.js";import{b as V,d as Qe}from"./chunk-
|
|
3
|
+
import{a as $,b as F,c as b,d as j,e as Ze,f as et,g as C,h as tt,i as nt,j as k,k as ie,l as ae}from"./chunk-V4U26ZWL.js";import{b as V,d as Qe}from"./chunk-ONF4KUYV.js";import{d as Ge,f as Xe,g as oe}from"./chunk-47IFMQYS.js";import{a as Z}from"./chunk-YXPSX3SI.js";import{b as Ye}from"./chunk-2UV6ZFHK.js";import{b as q}from"./chunk-GR4ZHKXI.js";import{a as W,c as se,d as re}from"./chunk-I57EACSL.js";import{l as E}from"./chunk-FUT3X2GJ.js";import{a as K,b as Y}from"./chunk-CPKBPQ2C.js";import{a as J,b as ne}from"./chunk-MUFNRCMY.js";var G=class{input;pos=0;tokens=[];maxSourceLength;maxTokens;constructor(t,n={}){this.input=t,this.maxSourceLength=n.maxSourceLength??1024*1024,this.maxTokens=n.maxTokens??1e5}tokenize(){if(this.input.length>this.maxSourceLength)throw new E(`xan: expression length limit exceeded (${this.maxSourceLength})`,"string_length");for(;this.pos<this.input.length&&(this.skipWhitespace(),!(this.pos>=this.input.length));){let t=this.nextToken();t&&(this.assertTokenCapacity(),this.tokens.push(t))}return this.assertTokenCapacity(),this.tokens.push({type:"eof",value:"",pos:this.pos}),this.tokens}assertTokenCapacity(){if(this.tokens.length>=this.maxTokens)throw new E(`xan: expression token limit exceeded (${this.maxTokens})`,"array_elements")}skipWhitespace(){for(;this.pos<this.input.length;){let t=this.input[this.pos];if(t===" "||t===" "||t===`
|
|
4
4
|
`||t==="\r")this.pos++;else if(t==="#")for(;this.pos<this.input.length&&this.input[this.pos]!==`
|
|
5
5
|
`;)this.pos++;else break}}nextToken(){let t=this.pos,n=this.input[this.pos];if(n>="0"&&n<="9")return this.readNumber();if(n==='"'||n==="'"||n==="`")return this.readString(n);if(n==="b"&&this.pos+1<this.input.length){let o=this.input[this.pos+1];if(o==='"'||o==="'"||o==="`")return this.pos++,this.readString(o)}if(n==="/"){let o=this.tokens[this.tokens.length-1];return o&&(o.type==="int"||o.type==="float"||o.type==="string"||o.type==="ident"||o.type===")"||o.type==="]")?this.input[this.pos+1]==="/"?(this.pos+=2,{type:"//",value:"//",pos:t}):(this.pos++,{type:"/",value:"/",pos:t}):this.readRegex()}if(this.match("not in"))return{type:"not in",value:"not in",pos:t};if(this.match("=>"))return{type:"=>",value:"=>",pos:t};if(this.match("**"))return{type:"**",value:"**",pos:t};if(this.match("++"))return{type:"++",value:"++",pos:t};if(this.match("//"))return{type:"//",value:"//",pos:t};if(this.match("=="))return{type:"==",value:"==",pos:t};if(this.match("!="))return{type:"!=",value:"!=",pos:t};if(this.match("<="))return{type:"<=",value:"<=",pos:t};if(this.match(">="))return{type:">=",value:">=",pos:t};if(this.match("&&"))return{type:"&&",value:"&&",pos:t};if(this.match("||"))return{type:"||",value:"||",pos:t};let r=new Map([["(","("],[")",")"],["[","["],["]","]"],["{","{"],["}","}"],[",",","],[":",":"],[";",";"],["+","+"],["-","-"],["*","*"],["%","%"],["<","<"],[">",">"],["!","!"],[".","."],["|","|"],["=","="]]).get(n);if(r!==void 0)return this.pos++,{type:r,value:n,pos:t};if(this.isIdentStart(n))return this.readIdentifier();throw new Error(`Unexpected character '${n}' at position ${this.pos}`)}match(t){if(this.input.slice(this.pos,this.pos+t.length)===t){if(/^[a-zA-Z]/.test(t)){let n=this.input[this.pos+t.length];if(n&&this.isIdentChar(n))return!1}return this.pos+=t.length,!0}return!1}isIdentStart(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"||t==="_"}isIdentChar(t){return this.isIdentStart(t)||t>="0"&&t<="9"}readNumber(){let t=this.pos,n=!1,s=!1;for(;this.pos<this.input.length;){let o=this.input[this.pos];if(o>="0"&&o<="9")this.pos++;else if(o==="_")this.pos++;else if(o==="."&&!n&&!s)n=!0,this.pos++;else if((o==="e"||o==="E")&&!s)s=!0,n=!0,this.pos++,this.pos<this.input.length&&(this.input[this.pos]==="+"||this.input[this.pos]==="-")&&this.pos++;else break}let r=this.input.slice(t,this.pos).replace(/_/g,"");return{type:n?"float":"int",value:r,pos:t}}readString(t){let n=this.pos;this.pos++;let s="";for(;this.pos<this.input.length;){let r=this.input[this.pos];if(r===t)return this.pos++,{type:"string",value:s,pos:n};if(r==="\\"){if(this.pos++,this.pos<this.input.length){let o=this.input[this.pos];switch(o){case"n":s+=`
|
|
6
6
|
`;break;case"r":s+="\r";break;case"t":s+=" ";break;case"\\":s+="\\";break;case'"':s+='"';break;case"'":s+="'";break;case"`":s+="`";break;case"0":s+="\0";break;default:s+=o}this.pos++}}else s+=r,this.pos++}throw new Error(`Unterminated string starting at position ${n}`)}readRegex(){let t=this.pos;this.pos++;let n="",s="";for(;this.pos<this.input.length;){let r=this.input[this.pos];if(r==="/"){for(this.pos++;this.pos<this.input.length&&this.input[this.pos]==="i";)s+=this.input[this.pos],this.pos++;return{type:"regex",value:n+(s?`/${s}`:""),pos:t}}r==="\\"?(n+=r,this.pos++,this.pos<this.input.length&&(n+=this.input[this.pos],this.pos++)):(n+=r,this.pos++)}throw new Error(`Unterminated regex starting at position ${t}`)}readIdentifier(){let t=this.pos;for(;this.pos<this.input.length&&this.isIdentChar(this.input[this.pos]);)this.pos++;let n=!1;this.pos<this.input.length&&this.input[this.pos]==="?"&&(n=!0,this.pos++);let s=this.input.slice(t,n?this.pos-1:this.pos);n&&(s+="?");let r=new Map([["true","true"],["false","false"],["null","null"],["and","and"],["or","or"],["eq","eq"],["ne","ne"],["lt","lt"],["le","le"],["gt","gt"],["ge","ge"],["in","in"],["as","as"],["_","_"]]),o=s.replace(/\?$/,""),i=r.get(o);return i!==void 0&&!n?{type:i,value:o,pos:t}:{type:"ident",value:s,pos:t}}};function z(e){return{maxSourceLength:e.limits.maxStringLength,maxTokens:e.limits.maxQueryTokens,maxAstNodes:e.limits.maxQueryElements,maxOperations:e.limits.maxJqIterations,maxDepth:e.limits.maxQueryDepth}}var D={PIPE:1,OR:2,AND:3,EQUALITY:4,COMPARISON:5,ADDITIVE:6,MULTIPLICATIVE:7,POWER:8,UNARY:9,POSTFIX:10},ee=class{pos=0;tokens;depth=0;operations=0;astNodes=0;limits;constructor(t,n={}){this.tokens=t,this.limits={maxSourceLength:n.maxSourceLength??1024*1024,maxTokens:n.maxTokens??1e5,maxDepth:n.maxDepth??100,maxOperations:n.maxOperations??1e5,maxAstNodes:n.maxAstNodes??1e5};let s=0;for(let r of t)this.useOperation(),r.type==="("||r.type==="["||r.type==="{"?(s++,s>this.limits.maxDepth&&this.throwDepthLimit()):(r.type===")"||r.type==="]"||r.type==="}")&&(s=Math.max(0,s-1))}parse(){let t=this.parseExpr(0);if(this.peek().type!=="eof")throw new Error(`Unexpected token: ${this.peek().value}`);return t}parseExpr(t){return this.withDepth(()=>this.parseExprInner(t))}parseExprInner(t){let n=this.parsePrefix();for(;;){let s=this.peek(),r=this.getInfixPrec(s.type);if(r<t)break;n=this.parseInfix(n,r)}return n}useOperation(t=1){if(t>this.limits.maxOperations-this.operations)throw new E(`xan: expression parser operation limit exceeded (${this.limits.maxOperations})`,"iterations");this.operations+=t}withDepth(t){this.depth>=this.limits.maxDepth&&this.throwDepthLimit(),this.depth++;try{return t()}finally{this.depth--}}throwDepthLimit(){throw new E(`xan: expression parser depth limit exceeded (${this.limits.maxDepth})`,"recursion")}addAstNode(){if(this.astNodes>=this.limits.maxAstNodes)throw new E(`xan: expression AST node limit exceeded (${this.limits.maxAstNodes})`,"array_elements");this.astNodes++}parsePrefix(){let t=this.peek();switch(t.type){case"int":return this.advance(),{type:"int",value:Number.parseInt(t.value,10)};case"float":return this.advance(),{type:"float",value:Number.parseFloat(t.value)};case"string":return this.advance(),{type:"string",value:t.value};case"regex":{this.advance();let n=t.value.split("/"),s=n.length>1?n[n.length-1]:"";return{type:"regex",pattern:n.slice(0,-1).join("/")||t.value,caseInsensitive:s.includes("i")}}case"true":return this.advance(),{type:"bool",value:!0};case"false":return this.advance(),{type:"bool",value:!1};case"null":return this.advance(),{type:"null"};case"_":return this.advance(),{type:"underscore"};case"ident":{let n=t.value,s=n.endsWith("?"),r=s?n.slice(0,-1):n;if(this.advance(),this.peek().type==="(")return this.parseFunctionCall(r);if(this.peek().type==="=>"){this.advance();let o=this.parseExpr(0);return this.bindLambdaArgs({type:"lambda",params:[r],body:o},[r])}return{type:"identifier",name:r,unsure:s}}case"(":{this.advance();let n=this.pos;if(this.peek().type===")"){if(this.advance(),this.peek().type==="=>"){this.advance();let r=this.parseExpr(0);return{type:"lambda",params:[],body:r}}throw new Error("Empty parentheses not allowed")}if(this.peek().type==="ident"){let r=[this.peek().value];this.advance();let o=!0;for(;this.peek().type===",";)if(this.advance(),this.peek().type==="ident")r.push(this.peek().value),this.advance();else{o=!1;break}if(o&&this.peek().type===")"&&this.peekAt(1).type==="=>"){this.advance(),this.advance();let i=this.parseExpr(0);return this.bindLambdaArgs({type:"lambda",params:r,body:i},r)}this.pos=n}let s=this.parseExpr(0);return this.expect(")"),s}case"[":return this.parseList();case"{":return this.parseMap();case"-":{this.advance();let n=this.parseExpr(D.UNARY);return n.type==="int"?{type:"int",value:-n.value}:n.type==="float"?{type:"float",value:-n.value}:{type:"func",name:"neg",args:[{expr:n}]}}case"!":return this.advance(),{type:"func",name:"not",args:[{expr:this.parseExpr(D.UNARY)}]};default:throw new Error(`Unexpected token: ${t.type} (${t.value})`)}}parseFunctionCall(t){this.expect("(");let n=[];if(this.peek().type!==")")do{n.length>0&&this.peek().type===","&&this.advance();let s;if(this.peek().type==="ident"){let o=this.peek().value,i=this.pos+1;i<this.tokens.length&&this.tokens[i].type==="="&&(s=o,this.advance(),this.advance())}let r=this.parseExpr(0);n.push({name:s,expr:r})}while(this.peek().type===",");return this.expect(")"),{type:"func",name:t.toLowerCase(),args:n}}parseList(){this.expect("[");let t=[];if(this.peek().type!=="]")do t.length>0&&this.peek().type===","&&this.advance(),t.push(this.parseExpr(0));while(this.peek().type===",");return this.expect("]"),{type:"list",elements:t}}parseMap(){this.expect("{");let t=[];if(this.peek().type!=="}")do{t.length>0&&this.peek().type===","&&this.advance();let n;if(this.peek().type==="ident")n=this.peek().value,this.advance();else if(this.peek().type==="string")n=this.peek().value,this.advance();else throw new Error(`Expected map key, got ${this.peek().type}`);this.expect(":");let s=this.parseExpr(0);t.push({key:n,value:s})}while(this.peek().type===",");return this.expect("}"),{type:"map",entries:t}}parseInfix(t,n){let s=this.peek(),o=new Map([["+","add"],["-","sub"],["*","mul"],["/","div"],["//","idiv"],["%","mod"],["**","pow"],["++","concat"],["==","=="],["!=","!="],["<","<"],["<=","<="],[">",">"],[">=",">="],["eq","eq"],["ne","ne"],["lt","lt"],["le","le"],["gt","gt"],["ge","ge"],["&&","and"],["and","and"],["||","or"],["or","or"]]).get(s.type);if(o!==void 0){this.advance();let i=this.parseExpr(n+(this.isRightAssoc(s.type)?0:1));return{type:"func",name:o,args:[{expr:t},{expr:i}]}}if(s.type==="|"){this.advance();let i=this.parseExpr(n);return this.handlePipe(t,i)}if(s.type===".")return this.advance(),this.handleDot(t);if(s.type==="[")return this.advance(),this.handleIndexing(t);if(s.type==="in")return this.advance(),{type:"func",name:"contains",args:[{expr:this.parseExpr(n+1)},{expr:t}]};if(s.type==="not in")return this.advance(),{type:"func",name:"not",args:[{expr:{type:"func",name:"contains",args:[{expr:this.parseExpr(n+1)},{expr:t}]}}]};throw new Error(`Unexpected infix token: ${s.type}`)}handlePipe(t,n){if(n.type==="identifier")return{type:"func",name:n.name,args:[{expr:t}]};if(n.type==="func"){let s=this.countUnderscores(n);return s===0?n:s===1?this.fillUnderscore(n,t):{type:"pipeline",exprs:[t,n]}}return this.countUnderscores(n)===1?this.fillUnderscore(n,t):n}handleDot(t){let n=this.peek();if(n.type==="ident"){let s=n.value;if(this.advance(),this.peek().type==="("){let r=this.parseFunctionCall(s);return r.type==="func"&&r.args.unshift({expr:t}),r}return{type:"func",name:"get",args:[{expr:t},{expr:{type:"string",value:s}}]}}if(n.type==="int"){let s=Number.parseInt(n.value,10);return this.advance(),{type:"func",name:"get",args:[{expr:t},{expr:{type:"int",value:s}}]}}if(n.type==="string"){let s=n.value;return this.advance(),{type:"func",name:"get",args:[{expr:t},{expr:{type:"string",value:s}}]}}throw new Error(`Expected identifier, number, or string after dot, got ${n.type}`)}handleIndexing(t){if(this.peek().type===":"){if(this.advance(),this.peek().type==="]")return this.advance(),{type:"func",name:"slice",args:[{expr:t}]};let s=this.parseExpr(0);return this.expect("]"),{type:"func",name:"slice",args:[{expr:t},{expr:{type:"int",value:0}},{expr:s}]}}let n=this.parseExpr(0);if(this.peek().type===":"){if(this.advance(),this.peek().type==="]")return this.advance(),{type:"func",name:"slice",args:[{expr:t},{expr:n}]};let s=this.parseExpr(0);return this.expect("]"),{type:"func",name:"slice",args:[{expr:t},{expr:n},{expr:s}]}}return this.expect("]"),{type:"func",name:"get",args:[{expr:t},{expr:n}]}}countUnderscores(t){let n=[t],s=0;for(;n.length>0;){this.useOperation();let r=n.pop();if(!r)break;if(r.type==="underscore")s++;else if(r.type==="func")for(let o of r.args)n.push(o.expr);else if(r.type==="list")n.push(...r.elements);else if(r.type==="map")for(let o of r.entries)n.push(o.value);if(n.length>this.limits.maxAstNodes)throw new E(`xan: expression AST node limit exceeded (${this.limits.maxAstNodes})`,"array_elements")}return s}fillUnderscore(t,n){return this.withDepth(()=>this.fillUnderscoreInner(t,n))}fillUnderscoreInner(t,n){return this.useOperation(),t.type==="underscore"?n:t.type==="func"?{...t,args:t.args.map(s=>({...s,expr:this.fillUnderscore(s.expr,n)}))}:t.type==="list"?{...t,elements:t.elements.map(s=>this.fillUnderscore(s,n))}:t.type==="map"?{...t,entries:t.entries.map(s=>({...s,value:this.fillUnderscore(s.value,n)}))}:t}bindLambdaArgs(t,n){return{...t,body:this.bindLambdaArgsInExpr(t.body,n)}}bindLambdaArgsInExpr(t,n){return this.withDepth(()=>this.bindLambdaArgsInExprInner(t,n))}bindLambdaArgsInExprInner(t,n){return this.useOperation(),t.type==="identifier"&&n.includes(t.name)?{type:"lambdaBinding",name:t.name}:t.type==="func"?{...t,args:t.args.map(s=>({...s,expr:this.bindLambdaArgsInExpr(s.expr,n)}))}:t.type==="list"?{...t,elements:t.elements.map(s=>this.bindLambdaArgsInExpr(s,n))}:t.type==="map"?{...t,entries:t.entries.map(s=>({...s,value:this.bindLambdaArgsInExpr(s.value,n)}))}:t}getInfixPrec(t){switch(t){case"|":return D.PIPE;case"||":case"or":return D.OR;case"&&":case"and":return D.AND;case"==":case"!=":case"eq":case"ne":return D.EQUALITY;case"<":case"<=":case">":case">=":case"lt":case"le":case"gt":case"ge":case"in":case"not in":return D.COMPARISON;case"+":case"-":case"++":return D.ADDITIVE;case"*":case"/":case"//":case"%":return D.MULTIPLICATIVE;case"**":return D.POWER;case".":case"[":return D.POSTFIX;default:return-1}}isRightAssoc(t){return t==="**"}peek(){return this.tokens[this.pos]||{type:"eof",value:"",pos:0}}peekAt(t){return this.tokens[this.pos+t]||{type:"eof",value:"",pos:0}}advance(){return this.useOperation(),this.addAstNode(),this.tokens[this.pos++]}expect(t){let n=this.peek();if(n.type!==t)throw new Error(`Expected ${t}, got ${n.type}`);return this.advance()}};function X(e,t={}){let n=[],r=new G(e,{maxSourceLength:t.maxSourceLength,maxTokens:t.maxTokens}).tokenize(),o=0,i=()=>r[o]||{type:"eof",value:"",pos:0},p=()=>r[o++];for(;i().type!=="eof";){if(i().type===","&&n.length>0){p();continue}let h=[],m=0,c=o;for(;i().type!=="eof";){let l=i();if((l.type===","||l.type==="as")&&m===0)break;(l.type==="("||l.type==="["||l.type==="{")&&m++,(l.type===")"||l.type==="]"||l.type==="}")&&m--,h.push(p())}h.push({type:"eof",value:"",pos:0});let d=new ee(h,t).parse(),u;if(i().type==="as")if(p(),i().type==="("){p();let l=[];for(;i().type!==")"&&i().type!=="eof";)if((i().type==="ident"||i().type==="string")&&(l.push(i().value),p()),i().type===",")p();else if(i().type!==")"&&i().type!=="eof")throw new Error(`Expected tuple alias, got ${i().type}`);if(i().type!==")")throw new Error("Expected ')' after tuple alias");p(),u=l}else if(i().type==="ident"||i().type==="string")u=i().value,p();else throw new Error(`Expected name after 'as', got ${i().type}`);else u=e.slice(r[c].pos,r[o-1]?.pos||e.length).trim(),d.type==="identifier"&&(u=d.name);n.push({expr:d,name:u})}return n}function B(e,t={}){let s=new G(e,{maxSourceLength:t.maxSourceLength,maxTokens:t.maxTokens}).tokenize();return new ee(s,t).parse()}function R(e,t){return t.length===0?O(e,[]):t.length===1?{type:"Pipe",left:t[0],right:O(e,[])}:{type:"Pipe",left:t[0],right:O(e,t.slice(1))}}var le={add:e=>L("+",e[0],e[1]),sub:e=>L("-",e[0],e[1]),mul:e=>L("*",e[0],e[1]),div:e=>L("/",e[0],e[1]),mod:e=>L("%",e[0],e[1]),idiv:e=>O("floor",[L("/",e[0],e[1])]),pow:e=>R("pow",e),neg:e=>({type:"UnaryOp",op:"-",operand:e[0]}),"==":e=>L("==",e[0],e[1]),"!=":e=>L("!=",e[0],e[1]),"<":e=>L("<",e[0],e[1]),"<=":e=>L("<=",e[0],e[1]),">":e=>L(">",e[0],e[1]),">=":e=>L(">=",e[0],e[1]),eq:e=>L("==",M(e[0]),M(e[1])),ne:e=>L("!=",M(e[0]),M(e[1])),lt:e=>L("<",M(e[0]),M(e[1])),le:e=>L("<=",M(e[0]),M(e[1])),gt:e=>L(">",M(e[0]),M(e[1])),ge:e=>L(">=",M(e[0]),M(e[1])),and:e=>L("and",e[0],e[1]),or:e=>L("or",e[0],e[1]),not:e=>({type:"UnaryOp",op:"not",operand:e[0]}),len:e=>R("length",e),length:e=>R("length",e),upper:e=>R("ascii_upcase",e),lower:e=>R("ascii_downcase",e),trim:e=>R("trim",e),ltrim:e=>e.length===0?O("ltrimstr",[{type:"Literal",value:" "}]):{type:"Pipe",left:e[0],right:O("ltrimstr",[{type:"Literal",value:" "}])},rtrim:e=>e.length===0?O("rtrimstr",[{type:"Literal",value:" "}]):{type:"Pipe",left:e[0],right:O("rtrimstr",[{type:"Literal",value:" "}])},split:e=>R("split",e),join:e=>e.length===1?O("join",[{type:"Literal",value:""}]):R("join",e),concat:e=>L("+",e[0],e[1]),startswith:e=>R("startswith",e),endswith:e=>R("endswith",e),contains:e=>R("contains",e),replace:e=>R("gsub",e),substr:e=>e.length===2?{type:"Slice",base:e[0],start:e[1]}:{type:"Slice",base:e[0],start:e[1],end:L("+",e[1],e[2])},abs:e=>R("fabs",e),floor:e=>R("floor",e),ceil:e=>R("ceil",e),round:e=>R("round",e),sqrt:e=>R("sqrt",e),log:e=>R("log",e),log10:e=>R("log10",e),log2:e=>R("log2",e),exp:e=>R("exp",e),sin:e=>R("sin",e),cos:e=>R("cos",e),tan:e=>R("tan",e),asin:e=>R("asin",e),acos:e=>R("acos",e),atan:e=>R("atan",e),min:e=>R("min",e),max:e=>R("max",e),first:e=>e.length===0?{type:"Index",index:{type:"Literal",value:0}}:{type:"Index",index:{type:"Literal",value:0},base:e[0]},last:e=>e.length===0?{type:"Index",index:{type:"Literal",value:-1}}:{type:"Index",index:{type:"Literal",value:-1},base:e[0]},get:e=>e.length===1?{type:"Index",index:e[0]}:{type:"Index",index:e[1],base:e[0]},slice:e=>e.length===1?{type:"Slice",base:e[0]}:e.length===2?{type:"Slice",base:e[0],start:e[1]}:{type:"Slice",base:e[0],start:e[1],end:e[2]},keys:"keys",values:"values",entries:e=>O("to_entries",e),from_entries:"from_entries",reverse:"reverse",sort:"sort",sort_by:"sort_by",group_by:"group_by",unique:"unique",unique_by:"unique_by",flatten:"flatten",map:e=>({type:"Pipe",left:e[0],right:{type:"Array",elements:e[1]}}),select:e=>O("select",e),empty:()=>O("empty",[]),count:()=>O("length",[]),sum:e=>e.length===0?O("add",[]):{type:"Pipe",left:{type:"Array",elements:e[0]},right:O("add",[])},mean:e=>e.length===0?{type:"Pipe",left:{type:"Identity"},right:L("/",O("add",[]),O("length",[]))}:{type:"Pipe",left:{type:"Array",elements:e[0]},right:L("/",O("add",[]),O("length",[]))},avg:e=>e.length===0?{type:"Pipe",left:{type:"Identity"},right:L("/",O("add",[]),O("length",[]))}:{type:"Pipe",left:{type:"Array",elements:e[0]},right:L("/",O("add",[]),O("length",[]))},type:"type",isnull:e=>e.length===0?L("==",{type:"Identity"},{type:"Literal",value:null}):L("==",e[0],{type:"Literal",value:null}),isempty:e=>e.length===0?L("==",{type:"Identity"},{type:"Literal",value:""}):L("==",e[0],{type:"Literal",value:""}),tonumber:e=>e.length===0?O("tonumber",[]):O("tonumber",e),tostring:e=>e.length===0?O("tostring",[]):O("tostring",e),if:e=>st(e[0],e[1],e[2]),coalesce:e=>{if(e.length===0)return{type:"Literal",value:null};if(e.length===1)return e[0];let t=e[e.length-1];for(let n=e.length-2;n>=0;n--){let s=e[n],r=L("and",L("!=",s,{type:"Literal",value:null}),L("!=",s,{type:"Literal",value:""}));t=st(r,s,t)}return t},index:()=>({type:"Field",name:"_row_index"}),now:()=>O("now",[]),fmt:e=>O("tostring",e),format:e=>O("tostring",e)};Object.setPrototypeOf(le,null);function L(e,t,n){return{type:"BinaryOp",op:e,left:t,right:n}}function O(e,t){return{type:"Call",name:e,args:t}}var mt="then";function st(e,t,n){let s=Xe({type:"Cond",cond:e,elifs:[],else:n||{type:"Literal",value:null}});return s[mt]=t,s}function M(e){return{type:"Pipe",left:e,right:{type:"Call",name:"tostring",args:[]}}}function U(e,t=!0,n={}){let s={nodes:0,operations:0,maxNodes:n.maxAstNodes??1e5,maxOperations:n.maxOperations??1e5,maxDepth:n.maxDepth??100};return rt(e,t,s,0)}function rt(e,t,n,s){if(s>=n.maxDepth)throw new E(`xan: expression conversion depth limit exceeded (${n.maxDepth})`,"recursion");if(++n.nodes>n.maxNodes)throw new E(`xan: expression conversion AST limit exceeded (${n.maxNodes})`,"array_elements");if(++n.operations>n.maxOperations)throw new E(`xan: expression conversion operation limit exceeded (${n.maxOperations})`,"iterations");let r=o=>rt(o,t,n,s+1);switch(e.type){case"int":case"float":return{type:"Literal",value:e.value};case"string":return{type:"Literal",value:e.value};case"bool":return{type:"Literal",value:e.value};case"null":return{type:"Literal",value:null};case"underscore":return{type:"Index",base:{type:"Identity"},index:{type:"Literal",value:"_"}};case"identifier":return t?{type:"Field",name:e.name}:{type:"VarRef",name:e.name};case"lambdaBinding":return{type:"VarRef",name:e.name};case"func":{if(e.args.length>n.maxNodes-n.nodes)throw new E(`xan: expression conversion AST limit exceeded (${n.maxNodes})`,"array_elements");let o=e.args.map(p=>r(p.expr));if(e.name==="coalesce"){let p=Math.max(0,o.length-1)*7;if(p>n.maxNodes-n.nodes)throw new E(`xan: expression conversion AST limit exceeded (${n.maxNodes})`,"array_elements");if(n.nodes+=p,n.operations+=o.length,n.operations>n.maxOperations)throw new E(`xan: expression conversion operation limit exceeded (${n.maxOperations})`,"iterations")}let i=Object.hasOwn(le,e.name)?le[e.name]:void 0;return typeof i=="function"?i(o):O(typeof i=="string"?i:e.name,o)}case"list":return e.elements.length===0?{type:"Array"}:{type:"Array",elements:e.elements.reduce((o,i,p)=>{let h=r(i);return p===0?h:{type:"Comma",left:o,right:h}},null)};case"map":return{type:"Object",entries:e.entries.map(o=>({key:o.key,value:r(o.value)}))};case"regex":return{type:"Literal",value:e.pattern};case"slice":return{type:"Slice",start:e.start?r(e.start):void 0,end:e.end?r(e.end):void 0};case"lambda":return r(e.body);case"pipeline":return{type:"Identity"};default:throw new Error(`Unknown moonblade expression type: ${e.type}`)}}function Q(e){return e<2?0:Math.ceil(e*Math.log2(e))}function ue(e,t={}){let n=t.maxArrayElements??1e5,s=t.maxStringLength??10*1024*1024,r=t.maxIterations??1e5,o=t.maxDepth??100;if(K(e)>s)throw new E(`xan: aggregation expression length limit exceeded (${s} bytes)`,"string_length");let i=[],p=0,h=0,m=()=>{if(t.consumeWork?.(),++h>r)throw new E(`xan: aggregation parser operation limit exceeded (${r})`,"iterations")};for(;p<e.length;){for(m();p<e.length&&(e[p]===" "||e[p]===",");)p++;if(p>=e.length)break;let c=p;for(;p<e.length&&/\w/.test(e[p]);)p++;let a=e.slice(c,p);for(;p<e.length&&e[p]===" ";)p++;if(e[p]!=="(")break;p++;let d=1,u=p;for(;p<e.length&&d>0;){if(m(),e[p]==="("?d++:e[p]===")"&&d--,d>o)throw new E(`xan: aggregation parser depth limit exceeded (${o})`,"recursion");d>0&&p++}let l=e.slice(u,p).trim();for(p++;p<e.length&&e[p]===" ";)p++;let f="";if(e.slice(p,p+3).toLowerCase()==="as "){for(p+=3;p<e.length&&e[p]===" ";)p++;let x=p;for(;p<e.length&&/\w/.test(e[p]);)p++;f=e.slice(x,p)}if(f||(f=l?`${a}(${l})`:`${a}()`),i.length>=n)throw new E(`xan: aggregation specification limit exceeded (${n})`,"array_elements");i.push({func:a,expr:l,alias:f})}return i}function ft(e){return/^\w+$/.test(e)}function ht(e,t,n){let s=V(e,t,n);return s.length>0?s[0]:null}function ce(e,t,n={},s={}){let{func:r,expr:o}=t,i=s.maxArrayElements??1e5,p=s.maxStringLength??10*1024*1024,h=s.maxIterations??1e5,m={maxSourceLength:p,maxTokens:i,maxAstNodes:i,maxOperations:h,maxDepth:s.maxDepth??100};if(e.length>i)throw new E(`xan: aggregation input limit exceeded (${i})`,"array_elements");if(r==="count"&&!o)return e.length;let c=ft(o),a=c?null:U(B(o,m),!0,m),d;if(c)d=f=>f[o];else{if(a===null)throw new Error("xan: missing compiled aggregation expression");d=f=>ht(f,a,n)}if(r==="all"||r==="any"){let f=0;for(let x of e){if(s.consumeWork?.(),++f>h)throw new E(`xan: aggregation iteration limit exceeded (${h})`,"iterations");let g=!!d(x);if(r==="all"&&!g)return!1;if(r==="any"&&g)return!0}return r==="all"}let u=[],l=0;for(let f of e){if(s.consumeWork?.(),++l>h)throw new E(`xan: aggregation iteration limit exceeded (${h})`,"iterations");let x=d(f);if(x!=null){if(u.length>=i)throw new E(`xan: aggregation value limit exceeded (${i})`,"array_elements");u.push(x)}}switch(r){case"count":{if(c)return u.length;let f=0;for(let x of u)s.consumeWork?.(),x&&f++;return f}case"sum":{let f=0;for(let x of u)s.consumeWork?.(),f+=typeof x=="number"?x:Number.parseFloat(String(x));return f}case"mean":case"avg":{let f=0;for(let x of u)s.consumeWork?.(),f+=typeof x=="number"?x:Number.parseFloat(String(x));return u.length>0?f/u.length:0}case"min":{let f=null;for(let x of u){s.consumeWork?.();let g=typeof x=="number"?x:Number.parseFloat(String(x));f=f===null?g:Math.min(f,g)}return f}case"max":{let f=null;for(let x of u){s.consumeWork?.();let g=typeof x=="number"?x:Number.parseFloat(String(x));f=f===null?g:Math.max(f,g)}return f}case"first":return u.length>0?u[0]:null;case"last":return u.length>0?u[u.length-1]:null;case"median":{let f=[];for(let g of u){s.consumeWork?.();let y=typeof g=="number"?g:Number.parseFloat(String(g));Number.isNaN(y)||f.push(y)}if(s.consumeWork?.(Q(f.length)),f.sort((g,y)=>g-y),f.length===0)return null;let x=Math.floor(f.length/2);return f.length%2===0?(f[x-1]+f[x])/2:f[x]}case"mode":{let f=new Map;for(let y of u){s.consumeWork?.();let w=String(y);f.set(w,(f.get(w)||0)+1)}let x=0,g=null;for(let[y,w]of f)s.consumeWork?.(),w>x&&(x=w,g=y);return g}case"cardinality":{let f=new Set;for(let x of u)s.consumeWork?.(),f.add(String(x));return f.size}case"values":return ot(u,!1,p,s);case"distinct_values":return ot(u,!0,p,s);default:return null}}function it(e,t,n={},s={}){let r=F();for(let o of t)b(r,o.alias,ce(e,o,n,s));return r}function ot(e,t,n,s){let r=[],o=t?new Set:null,i=0;for(let p of e){s.consumeWork?.();let h=String(p);if(o?.has(h))continue;o?.add(h);let m=K(h)+(r.length>0?1:0);if(m>n-i)throw new E(`xan: aggregation string limit exceeded (${n} bytes)`,"string_length");r.push(h),i+=m}return t&&(s.consumeWork?.(Q(r.length)),r.sort()),r.join("|")}function lt(e,t){return{maxArrayElements:e.limits.maxArrayElements,maxStringLength:e.limits.maxStringLength,maxIterations:e.limits.maxJqIterations,maxDepth:e.limits.maxQueryDepth,consumeWork:(n=1)=>t.consumeWork(n)}}function at(e,t,n){let s=e.size-(t&&e.has("")?1:0);return n>0?Math.min(s,n):s}async function pe(e,t){let n="",s=[];for(let d of e)d.startsWith("-")||(n?s.push(d):n=d);if(!n)return{stdout:"",stderr:`xan agg: no aggregation expression
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{a as we}from"./chunk-BIJXTWZ4.js";import{a as Y}from"./chunk-
|
|
3
|
+
import{a as we}from"./chunk-BIJXTWZ4.js";import{a as Y}from"./chunk-IOKQFPM6.js";import{a as le}from"./chunk-3MRB66F4.js";import{a as be}from"./chunk-K27FY3ES.js";import{a as ae}from"./chunk-YXPSX3SI.js";import{b as ue,c as de,d as he}from"./chunk-YERKK5B3.js";import{d as ge}from"./chunk-MBREBDZQ.js";import{l as ie}from"./chunk-FUT3X2GJ.js";import{a as re}from"./chunk-CPKBPQ2C.js";import{a as me,b as ye}from"./chunk-MUFNRCMY.js";function z(e,t){switch(e.type){case"name":{let n=e.pattern,s=n.match(/^\*(\.[a-zA-Z0-9]+)$/);if(s){let a=s[1],o=t.name;if(e.ignoreCase){if(!o.toLowerCase().endsWith(a.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!o.endsWith(a))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Y(t.name,n,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let n=e.pattern,s=t.relativePath,a=n.split("/");for(let u=0;u<a.length-1;u++){let r=a[u];if(r&&r!=="."&&r!==".."&&!r.includes("*")&&!r.includes("?")&&!r.includes("[")){let i=`/${r}/`;if(e.ignoreCase){if(!s.toLowerCase().includes(i.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!s.includes(i))return{matches:!1,pruned:!1,printed:!1}}}let o=n.match(/\*(\.[a-zA-Z0-9]+)$/);if(o){let u=o[1];if(e.ignoreCase){if(!s.toLowerCase().endsWith(u.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!s.endsWith(u))return{matches:!1,pruned:!1,printed:!1}}return{matches:Y(s,n,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let n=e.ignoreCase?"i":"";return{matches:ae(e.pattern,n).test(t.relativePath),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case"type":return e.fileType==="f"?{matches:t.isFile,pruned:!1,printed:!1}:e.fileType==="d"?{matches:t.isDirectory,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case"empty":return{matches:t.isEmpty,pruned:!1,printed:!1};case"mtime":{let s=(Date.now()-t.mtime)/(1e3*60*60*24),a;return e.comparison==="more"?a=s>e.days:e.comparison==="less"?a=s<e.days:a=Math.floor(s)===e.days,{matches:a,pruned:!1,printed:!1}}case"newer":{let n=t.newerRefTimes.get(e.refPath);return n===void 0?{matches:!1,pruned:!1,printed:!1}:{matches:t.mtime>n,pruned:!1,printed:!1}}case"size":{let n=e.value;switch(e.unit){case"c":n=e.value;break;case"k":n=e.value*1024;break;case"M":n=e.value*1024*1024;break;case"G":n=e.value*1024*1024*1024;break;case"b":n=e.value*512;break}let s;return e.comparison==="more"?s=t.size>n:e.comparison==="less"?s=t.size<n:e.unit==="b"?s=Math.ceil(t.size/512)===e.value:s=t.size===n,{matches:s,pruned:!1,printed:!1}}case"perm":{let n=t.mode&511,s=e.mode&511,a;return e.matchType==="exact"?a=n===s:e.matchType==="all"?a=(n&s)===s:a=(n&s)!==0,{matches:a,pruned:!1,printed:!1}}case"prune":return{matches:!0,pruned:!0,printed:!1};case"action":return{matches:!0,pruned:!1,printed:!1,actions:[e.action]};case"not":{let n=z(e.expr,t);return{matches:!n.matches,pruned:n.pruned,printed:!1,actions:n.actions}}case"and":{let n=z(e.left,t);if(!n.matches)return{matches:!1,pruned:n.pruned,printed:!1,actions:n.actions};let s=z(e.right,t);return{matches:s.matches,pruned:n.pruned||s.pruned,printed:n.printed||s.printed,actions:[...n.actions??[],...s.actions??[]]}}case"or":{let n=z(e.left,t);if(n.matches)return n;let s=z(e.right,t);return{matches:s.matches,pruned:n.pruned||s.pruned,printed:s.printed,actions:[...n.actions??[],...s.actions??[]]}}}}function Z(e){if(!e)return!1;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":return!1;case"action":return!1;case"empty":case"mtime":case"newer":case"size":case"perm":return!0;case"not":return Z(e.expr);case"and":case"or":return Z(e.left)||Z(e.right)}}function J(e){if(!e)return!1;switch(e.type){case"empty":return!0;case"not":return J(e.expr);case"and":case"or":return J(e.left)||J(e.right);default:return!1}}function Se(e){let t=[],n=s=>{s&&(s.type==="newer"?t.push(s.refPath):s.type==="not"?n(s.expr):(s.type==="and"||s.type==="or")&&(n(s.left),n(s.right)))};return n(e),t}function V(e){if(!e)return!0;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":return!0;case"action":return!1;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return V(e.expr);case"and":case"or":return V(e.left)&&V(e.right)}}function B(e,t,n,s,a){switch(e.type){case"name":{let o=e.pattern,u=o.match(/^\*(\.[a-zA-Z0-9]+)$/);if(u){let r=u[1];if(e.ignoreCase){if(!t.toLowerCase().endsWith(r.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!t.endsWith(r))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Y(t,o,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let o=e.pattern,u=o.split("/");for(let i=0;i<u.length-1;i++){let l=u[i];if(l&&l!=="."&&l!==".."&&!l.includes("*")&&!l.includes("?")&&!l.includes("[")){let p=`/${l}/`;if(e.ignoreCase){if(!n.toLowerCase().includes(p.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.includes(p))return{matches:!1,pruned:!1,printed:!1}}}let r=o.match(/\*(\.[a-zA-Z0-9]+)$/);if(r){let i=r[1];if(e.ignoreCase){if(!n.toLowerCase().endsWith(i.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.endsWith(i))return{matches:!1,pruned:!1,printed:!1}}return{matches:Y(n,o,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let o=e.ignoreCase?"i":"";return{matches:ae(e.pattern,o).test(n),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case"type":return e.fileType==="f"?{matches:s,pruned:!1,printed:!1}:e.fileType==="d"?{matches:a,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case"prune":return{matches:!0,pruned:!0,printed:!1};case"action":return{matches:!0,pruned:!1,printed:!1,actions:[e.action]};case"not":{let o=B(e.expr,t,n,s,a);return{matches:!o.matches,pruned:o.pruned,printed:!1,actions:o.actions}}case"and":{let o=B(e.left,t,n,s,a);if(!o.matches)return{matches:!1,pruned:o.pruned,printed:!1,actions:o.actions};let u=B(e.right,t,n,s,a);return{matches:u.matches,pruned:o.pruned||u.pruned,printed:o.printed||u.printed,actions:[...o.actions??[],...u.actions??[]]}}case"or":{let o=B(e.left,t,n,s,a);if(o.matches)return o;let u=B(e.right,t,n,s,a);return{matches:u.matches,pruned:o.pruned||u.pruned,printed:u.printed,actions:[...o.actions??[],...u.actions??[]]}}default:return{matches:!1,pruned:!1,printed:!1}}}function _(e){if(!e)return!1;switch(e.type){case"prune":return!0;case"not":return _(e.expr);case"and":case"or":return _(e.left)||_(e.right);default:return!1}}function L(e){switch(e.type){case"name":case"path":case"regex":case"type":case"prune":return!0;case"action":return!1;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return L(e.expr);case"and":case"or":return L(e.left)&&L(e.right)}}function Te(e,t){if(!e||!t.isDirectory)return{shouldPrune:!1};if(!L(e))return oe(e,t);let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return{shouldPrune:z(e,n).pruned}}function oe(e,t){switch(e.type){case"or":{if(L(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};if(z(e.left,n).pruned)return{shouldPrune:!0}}return oe(e.right,t)}case"and":{if(L(e.left)&&L(e.right)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return{shouldPrune:z(e,n).pruned}}if(L(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return z(e.left,n).matches?oe(e.right,t):{shouldPrune:!1}}return{shouldPrune:!1}}case"not":return{shouldPrune:!1};default:return{shouldPrune:!1}}}function Ce(e,t){let n=[],s=t,a=r=>({expr:null,pathIndex:s,error:`find: missing argument to \`${r}'
|
|
4
4
|
`}),o=(r,i)=>({expr:null,pathIndex:s,error:`find: invalid argument \`${i}' to \`${r}'
|
|
5
5
|
`});for(;s<e.length;){let r=e[s];if(r==="("||r==="\\("){n.push({type:"lparen"}),s++;continue}if(r===")"||r==="\\)"){n.push({type:"rparen"}),s++;continue}if(r==="-name"){if(s+1>=e.length)return a(r);n.push({type:"expr",expr:{type:"name",pattern:e[++s]}})}else if(r==="-iname"){if(s+1>=e.length)return a(r);n.push({type:"expr",expr:{type:"name",pattern:e[++s],ignoreCase:!0}})}else if(r==="-path"){if(s+1>=e.length)return a(r);n.push({type:"expr",expr:{type:"path",pattern:e[++s]}})}else if(r==="-ipath"){if(s+1>=e.length)return a(r);n.push({type:"expr",expr:{type:"path",pattern:e[++s],ignoreCase:!0}})}else if(r==="-regex"){if(s+1>=e.length)return a(r);n.push({type:"expr",expr:{type:"regex",pattern:e[++s]}})}else if(r==="-iregex"){if(s+1>=e.length)return a(r);n.push({type:"expr",expr:{type:"regex",pattern:e[++s],ignoreCase:!0}})}else if(r==="-type"){if(s+1>=e.length)return a(r);let i=e[++s];if(i==="f"||i==="d")n.push({type:"expr",expr:{type:"type",fileType:i}});else return{expr:null,pathIndex:s,error:`find: Unknown argument to -type: ${i}
|
|
6
6
|
`}}else if(r==="-empty")n.push({type:"expr",expr:{type:"empty"}});else if(r==="-mtime"){if(s+1>=e.length)return a(r);let i=e[++s],l="exact",p=i;if(i.startsWith("+")?(l="more",p=i.slice(1)):i.startsWith("-")&&(l="less",p=i.slice(1)),!/^\d+$/.test(p))return o(r,i);let I=Number(p);if(!Number.isSafeInteger(I))return o(r,i);n.push({type:"expr",expr:{type:"mtime",days:I,comparison:l}})}else if(r==="-newer"){if(s+1>=e.length)return a(r);let i=e[++s];n.push({type:"expr",expr:{type:"newer",refPath:i}})}else if(r==="-size"){if(s+1>=e.length)return a(r);let i=e[++s],l="exact",p=i;i.startsWith("+")?(l="more",p=i.slice(1)):i.startsWith("-")&&(l="less",p=i.slice(1));let I=p.match(/^(\d+)([ckMGb])?$/);if(!I)return o(r,i);let N=Number(I[1]);if(!Number.isSafeInteger(N))return o(r,i);let P=I[2]||"b",j=P==="G"?1024**3:P==="M"?1024**2:P==="k"?1024:P==="b"?512:1;if(!Number.isSafeInteger(N*j))return o(r,i);n.push({type:"expr",expr:{type:"size",value:N,unit:P,comparison:l}})}else if(r==="-perm"){if(s+1>=e.length)return a(r);let i=e[++s],l="exact",p=i;if(i.startsWith("-")?(l="all",p=i.slice(1)):i.startsWith("/")&&(l="any",p=i.slice(1)),!/^[0-7]{1,4}$/.test(p))return o(r,i);let I=Number.parseInt(p,8);n.push({type:"expr",expr:{type:"perm",mode:I,matchType:l}})}else if(r==="-prune")n.push({type:"expr",expr:{type:"prune"}});else if(r==="-not"||r==="!")n.push({type:"not"});else if(r==="-o"||r==="-or")n.push({type:"op",op:"or"});else if(r==="-a"||r==="-and")n.push({type:"op",op:"and"});else if(r==="-maxdepth"||r==="-mindepth"){if(s+1>=e.length)return a(r);s++}else if(r!=="-depth")if(r==="-exec"){let i=[];for(s++;s<e.length&&e[s]!==";"&&e[s]!=="+";)i.push(e[s]),s++;if(s>=e.length)return{expr:null,pathIndex:s,error:"find: missing argument to `-exec'\n"};if(i.length===0)return a("-exec");let l=e[s]==="+";if(l&&(i.at(-1)!=="{}"||i.filter(p=>p==="{}").length!==1))return o("-exec","+");n.push({type:"expr",expr:{type:"action",action:{type:"exec",command:i,batchMode:l}}})}else if(r==="-print")n.push({type:"expr",expr:{type:"action",action:{type:"print"}}});else if(r==="-print0")n.push({type:"expr",expr:{type:"action",action:{type:"print0"}}});else if(r==="-printf"){if(s+1>=e.length)return a(r);let i=e[++s];n.push({type:"expr",expr:{type:"action",action:{type:"printf",format:i}}})}else if(r==="-delete")n.push({type:"expr",expr:{type:"action",action:{type:"delete"}}});else return r.startsWith("-")?{expr:null,pathIndex:s,error:`find: unknown predicate '${r}'
|
|
@@ -0,0 +1,8 @@
|
|
|
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,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{a as m}from"./chunk-
|
|
3
|
+
import{a as m}from"./chunk-YXPSX3SI.js";import{b as x}from"./chunk-GR4ZHKXI.js";import{a as w}from"./chunk-PBOVSFTJ.js";var k={name:"expr",async execute(i,a){if(i.length===0)return{stdout:"",stderr:`expr: missing operand
|
|
4
4
|
`,exitCode:2};try{let t=S(i,h=>a.executionScope?.consumeWork(h,"expr index")),f=t==="0"||t===""?1:0;return{stdout:`${t}
|
|
5
5
|
`,stderr:"",exitCode:f}}catch(t){return x(t),{stdout:"",stderr:`expr: ${w(t.message)}
|
|
6
6
|
`,exitCode:2}}}};function S(i,a){if(i.length===1)return i[0];let t=0;function f(){let e=h();for(;t<i.length&&i[t]==="|";){t++;let r=h();if(e!=="0"&&e!=="")return e;e=r}return e}function h(){let e=g();for(;t<i.length&&i[t]==="&";){t++;let r=g();(e==="0"||e===""||r==="0"||r==="")&&(e="0")}return e}function g(){let e=p();for(;t<i.length;){let r=i[t];if(["=","!=","<",">","<=",">="].includes(r)){t++;let s=p(),o=parseInt(e,10),n=parseInt(s,10),l=!Number.isNaN(o)&&!Number.isNaN(n),c;r==="="?c=l?o===n:e===s:r==="!="?c=l?o!==n:e!==s:r==="<"?c=l?o<n:e<s:r===">"?c=l?o>n:e>s:r==="<="?c=l?o<=n:e<=s:c=l?o>=n:e>=s,e=c?"1":"0"}else break}return e}function p(){let e=N();for(;t<i.length;){let r=i[t];if(r==="+"||r==="-"){t++;let s=N(),o=parseInt(e,10),n=parseInt(s,10);if(Number.isNaN(o)||Number.isNaN(n))throw new Error("non-integer argument");e=String(r==="+"?o+n:o-n)}else break}return e}function N(){let e=d();for(;t<i.length;){let r=i[t];if(r==="*"||r==="/"||r==="%"){t++;let s=d(),o=parseInt(e,10),n=parseInt(s,10);if(Number.isNaN(o)||Number.isNaN(n))throw new Error("non-integer argument");if((r==="/"||r==="%")&&n===0)throw new Error("division by zero");r==="*"?e=String(o*n):r==="/"?e=String(Math.trunc(o/n)):e=String(o%n)}else break}return e}function d(){let e=u();for(;t<i.length&&i[t]===":";){t++;let r=u(),o=m(`^${r}`).match(e);o?e=o[1]!==void 0?o[1]:String(o[0].length):e="0"}return e}function u(){if(t>=i.length)throw new Error("syntax error");let e=i[t];if(e==="match"){t++;let r=u(),s=u(),n=m(s).match(r);return n?n[1]!==void 0?n[1]:String(n[0].length):"0"}if(e==="substr"){t++;let r=u(),s=parseInt(u(),10),o=parseInt(u(),10);if(Number.isNaN(s)||Number.isNaN(o))throw new Error("non-integer argument");return r.substring(s-1,s-1+o)}if(e==="index"){t++;let r=u(),s=u();a(s.length+r.length);let o=new Set;for(let n=0;n<s.length;n++)o.add(s[n]);for(let n=0;n<r.length;n++)if(o.has(r[n]))return String(n+1);return"0"}if(e==="length"){t++;let r=u();return String(r.length)}if(e==="("){t++;let r=f();if(t>=i.length||i[t]!==")")throw new Error("syntax error");return t++,r}return t++,e}let b=f();if(t!==i.length)throw new Error("syntax error");return b}var C={name:"expr",flags:[],needsArgs:!0};export{k as a,C as b};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{e as F}from"./chunk-
|
|
3
|
+
import{e as F}from"./chunk-MBREBDZQ.js";import{l as d,m as h}from"./chunk-FUT3X2GJ.js";import{a as x}from"./chunk-NE4R2FVV.js";import{a as g,b as z}from"./chunk-MUFNRCMY.js";var $={name:"du",summary:"estimate file space usage",usage:"du [OPTION]... [FILE]...",options:["-a write counts for all files, not just directories","-h print sizes in human readable format","-s display only a total for each argument","-c produce a grand total","--max-depth=N print total for directory only if N or fewer levels deep"," --help display this help and exit"]},b={allFiles:{short:"a",type:"boolean"},humanReadable:{short:"h",type:"boolean"},summarize:{short:"s",type:"boolean"},grandTotal:{short:"c",type:"boolean"},maxDepth:{long:"max-depth",type:"number"}},R={name:"du",async execute(t,s){if(z(t))return g($);let a=x("du",t,b);if(!a.ok)return a.error;let l={allFiles:a.result.flags.allFiles,humanReadable:a.result.flags.humanReadable,summarize:a.result.flags.summarize,grandTotal:a.result.flags.grandTotal,maxDepth:a.result.flags.maxDepth??null},i=a.result.positional;i.length===0&&i.push(".");let n="",o="",e=0;for(let u of i){let f=s.fs.resolvePath(s.cwd,u);try{await s.fs.stat(f);let r=await w(s,f,u,l,0);n+=r.output,e+=r.totalSize,o+=r.stderr}catch(r){if(r instanceof d||r instanceof h)throw r;o+=`du: cannot access '${u}': No such file or directory
|
|
4
4
|
`}}return l.grandTotal&&i.length>0&&(n+=`${p(e,l.humanReadable)} total
|
|
5
5
|
`),{stdout:n,stderr:o,exitCode:o?1:0}}};async function w(t,s,a,l,i){let n={output:"",totalSize:0,stderr:""},o=new Map;return await F({fs:t.fs,root:s,limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"du",symlinks:"never",includeLeave:!0},e=>{let u=e.path.slice(s.length).replace(/^\//,""),f=u?a==="."?u:`${a}/${u}`:a,r=e.path==="/"?"/":e.path.slice(0,e.path.lastIndexOf("/"))||"/";if(e.phase==="enter"){if(e.stat.isDirectory){o.set(e.path,0);return}o.set(r,(o.get(r)??0)+e.stat.size),(l.allFiles||e.depth===i)&&!l.summarize&&(n.output+=`${p(e.stat.size,l.humanReadable)} ${f}
|
|
6
6
|
`),e.depth===i&&(n.totalSize=e.stat.size);return}let m=o.get(e.path)??0;e.depth>i?o.set(r,(o.get(r)??0)+m):n.totalSize=m;let c=e.depth-i;(l.summarize&&c===0||!l.summarize&&(l.maxDepth===null||c<=l.maxDepth))&&(n.output+=`${p(m,l.humanReadable)} ${f}
|
|
@@ -0,0 +1,9 @@
|
|
|
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 d}from"./chunk-PBOVSFTJ.js";import{a as u}from"./chunk-NE4R2FVV.js";import{a as g}from"./chunk-I4IRHQDW.js";var b={recursive:{short:"r",long:"recursive",type:"boolean"},recursiveUpper:{short:"R",type:"boolean"},force:{short:"f",long:"force",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},C={name:"rm",async execute(v,s){let e=u("rm",v,b);if(!e.ok)return e.error;let l=e.result.flags.recursive||e.result.flags.recursiveUpper,n=e.result.flags.force,y=e.result.flags.verbose,c=e.result.positional;if(c.length===0)return n?{stdout:"",stderr:"",exitCode:0}:{stdout:"",stderr:`rm: missing operand
|
|
4
|
+
`,exitCode:1};let f="",t="",a=0;for(let r of c)try{let o=s.fs.resolvePath(s.cwd,r);if((await s.fs.stat(o)).isDirectory&&!l){t+=`rm: cannot remove '${r}': Is a directory
|
|
5
|
+
`,a=1;continue}await s.fs.rm(o,{recursive:l,force:n}),y&&(f+=`removed '${r}'
|
|
6
|
+
`)}catch(o){let m=g(o),p=i(o,"ENOENT");if(n&&p)continue;p?t+=`rm: cannot remove '${r}': No such file or directory
|
|
7
|
+
`:i(o,"ENOTEMPTY")?t+=`rm: cannot remove '${r}': Directory not empty
|
|
8
|
+
`:t+=`rm: cannot remove '${r}': ${d(m)}
|
|
9
|
+
`,a=1}return{stdout:f,stderr:t,exitCode:a}}},w={name:"rm",flags:[{flag:"-r",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0};export{C as a,w as b};
|