just-bash 3.4.2 → 3.6.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 +242 -0
- package/README.md +22 -9
- package/dist/AGENTS.md +58 -2
- package/dist/Bash.d.ts +4 -2
- package/dist/abort-signals.d.ts +10 -0
- package/dist/bin/chunks/awk2-U22OR5B5.js +3 -0
- package/dist/bin/{shell/chunks/base64-FLJ4YPHB.js → chunks/base64-2KKH5BCT.js} +1 -1
- package/dist/bin/chunks/{cat-2J5MA5PY.js → cat-V45MVNBT.js} +1 -1
- package/dist/bin/{shell/chunks/chmod-ZM5WLMZI.js → chunks/chmod-A54R4UUQ.js} +1 -1
- package/dist/bin/chunks/chunk-2NJJXU4K.js +27 -0
- package/dist/bin/{shell/chunks/chunk-BJRT4VKD.js → chunks/chunk-3LKMI5IX.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-4APSDE57.js → chunks/chunk-44SKMHU6.js} +1 -1
- package/dist/bin/chunks/{chunk-GRP7L2EL.js → chunk-6DAR25KN.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-VGR3NA3H.js → chunks/chunk-723HNGID.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-MRPJL3ZK.js → chunks/chunk-7X4QBCFW.js} +1 -1
- package/dist/bin/chunks/{chunk-42AMF6EE.js → chunk-ABM5WFEO.js} +1 -1
- package/dist/bin/chunks/{chunk-2HFDEZUY.js → chunk-AINNAQBQ.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-BPWZ7ADB.js → chunks/chunk-AL7RVSF4.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-MHAGHCSO.js → chunks/chunk-ARYCSNJJ.js} +7 -7
- package/dist/bin/{shell/chunks/chunk-2INNLNI5.js → chunks/chunk-BJF6B4YW.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-BZWGVRFA.js → chunks/chunk-BOXG6XBN.js} +2 -2
- package/dist/bin/chunks/chunk-DA3RFNKK.js +17 -0
- package/dist/bin/chunks/chunk-DH7M46D3.js +20 -0
- package/dist/bin/chunks/{chunk-2ND6MMXN.js → chunk-DTGQQKI2.js} +1 -1
- package/dist/bin/chunks/{chunk-YOIFOOGX.js → chunk-ECZAFQ22.js} +1 -1
- package/dist/bin/chunks/{chunk-PPVF2N6C.js → chunk-EFS34UUR.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-TW2IJRUF.js → chunks/chunk-ENEHPI32.js} +1 -1
- package/dist/bin/chunks/chunk-HFW2LXQV.js +13 -0
- package/dist/bin/{shell/chunks/chunk-UHNV55NF.js → chunks/chunk-HRKG3ZK2.js} +1 -1
- package/dist/bin/chunks/{chunk-74TZ7ZF7.js → chunk-IKUY74NG.js} +1 -1
- package/dist/bin/chunks/chunk-ILXMFIYG.js +7 -0
- package/dist/bin/chunks/chunk-IMVXTSPG.js +275 -0
- package/dist/bin/chunks/chunk-J5L5DJWL.js +3 -0
- package/dist/bin/{shell/chunks/chunk-MF3GVFLC.js → chunks/chunk-JKS7WXGR.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-XBX7KFWK.js → chunks/chunk-LG6IN6SW.js} +11 -11
- package/dist/bin/chunks/chunk-LMFAALLO.js +21 -0
- package/dist/bin/{shell/chunks/chunk-DYIBFLS3.js → chunks/chunk-LOU52GPJ.js} +2 -2
- package/dist/bin/chunks/{chunk-FB44CW33.js → chunk-M5ZBECGM.js} +1 -1
- package/dist/bin/chunks/chunk-MA6BMA4M.js +3 -0
- package/dist/bin/chunks/{chunk-Z7QCL4IA.js → chunk-MPQMTLXN.js} +1 -1
- package/dist/bin/chunks/{chunk-TIHFGNPS.js → chunk-MUIYG2RB.js} +1 -1
- package/dist/bin/chunks/{chunk-PUZGSIMN.js → chunk-NGMFI3RH.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-RYQB6GQ7.js → chunks/chunk-NLMTGTSG.js} +1 -1
- package/dist/bin/chunks/{chunk-QAYU7HPM.js → chunk-OBVTFHVP.js} +1 -1
- package/dist/bin/chunks/{chunk-MNSMZU47.js → chunk-OOKVPG5D.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-O2BCKSMK.js → chunks/chunk-PEJXCXSY.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-MYEPQX6Y.js → chunks/chunk-PL4EU7Y2.js} +1 -1
- package/dist/bin/chunks/{chunk-QFTZKD5O.js → chunk-QCGH2ZOW.js} +1 -1
- package/dist/bin/chunks/chunk-QKWMWSV3.js +3 -0
- package/dist/bin/{shell/chunks/chunk-ISOWCECJ.js → chunks/chunk-S5Z7DMIE.js} +10 -10
- package/dist/bin/{shell/chunks/chunk-OLEQNRKX.js → chunks/chunk-SQ7SZZMW.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-44MQ5AXA.js → chunks/chunk-SQUH76NP.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-BOYPCOSV.js → chunks/chunk-TGRZ42DS.js} +1 -1
- package/dist/bin/chunks/{chunk-LUHU7UUN.js → chunk-THTKNRO6.js} +1 -1
- package/dist/bin/chunks/{chunk-VKTV45AP.js → chunk-TQXLQEIT.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-2OQ5HPZE.js → chunks/chunk-U6BXPMLD.js} +1 -1
- package/dist/bin/chunks/chunk-U6DBRMD5.js +5 -0
- package/dist/bin/{shell/chunks/chunk-CC2AQ6B7.js → chunks/chunk-U6JTVQU6.js} +1 -1
- package/dist/bin/chunks/chunk-UPUFWGHR.js +3 -0
- package/dist/bin/chunks/{chunk-E5VZGTZ6.js → chunk-URRH3GPG.js} +1 -1
- package/dist/bin/chunks/{chunk-EXGPMLIE.js → chunk-VBU3UEG5.js} +1 -1
- package/dist/bin/chunks/chunk-VGSRQOLD.js +7 -0
- package/dist/bin/chunks/{chunk-GTULZ3ZD.js → chunk-WBST7XJW.js} +1 -1
- package/dist/bin/chunks/{chunk-ROFYAVPF.js → chunk-WEQ5WM2M.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-BCQSUELK.js → chunks/chunk-WZ7MIBLR.js} +1 -1
- package/dist/bin/chunks/{chunk-H4BRFPKY.js → chunk-X45GP3AQ.js} +1 -1
- package/dist/bin/chunks/chunk-YQEKKZTU.js +12 -0
- package/dist/bin/chunks/{chunk-UNKX6YM6.js → chunk-Z3KAV6YJ.js} +1 -1
- package/dist/bin/chunks/{chunk-3SCW7PD5.js → chunk-Z5KICK5X.js} +1 -1
- package/dist/bin/chunks/{column-7VBJL757.js → column-LHHS4D3K.js} +1 -1
- package/dist/bin/{shell/chunks/cp-MF5GADQN.js → chunks/cp-HPLQA35N.js} +1 -1
- package/dist/bin/chunks/curl-FIRG3RB6.js +31 -0
- package/dist/bin/chunks/{cut-QOTYBJJJ.js → cut-KP3S36XS.js} +1 -1
- package/dist/bin/{shell/chunks/diff-YXZZCUSQ.js → chunks/diff-JSJ56EOK.js} +1 -1
- package/dist/bin/chunks/dist-4NZ74CRE.js +141 -0
- package/dist/bin/chunks/{du-A3UGHIKJ.js → du-WEF5YWQK.js} +1 -1
- package/dist/bin/chunks/{expr-TDF3B6QJ.js → expr-FLWT4OCO.js} +1 -1
- package/dist/bin/chunks/{file-AJGG7RYT.js → file-JLUCGBCB.js} +1 -1
- package/dist/bin/chunks/{find-6DH6TRDN.js → find-XGVQ6N6L.js} +1 -1
- package/dist/bin/chunks/flag-coverage-4JYKIAVV.js +3 -0
- package/dist/bin/chunks/{grep-WUZMZDGY.js → grep-DCPCPQOS.js} +1 -1
- package/dist/bin/chunks/{gzip-JA7JQBUS.js → gzip-6DZIKNBW.js} +1 -1
- package/dist/bin/{shell/chunks/head-YGKW3HS4.js → chunks/head-TLFXMM2T.js} +1 -1
- package/dist/bin/{shell/chunks/help-HVIDHJ6M.js → chunks/help-EXVKU23F.js} +1 -1
- package/dist/bin/chunks/{html-to-markdown-ZWL7LZIP.js → html-to-markdown-E22RLT2U.js} +1 -1
- package/dist/bin/chunks/{jq-5MI4V3G5.js → jq-GDM3OBBK.js} +1 -1
- package/dist/bin/chunks/js-exec-VU6F6WLS.js +1578 -0
- package/dist/bin/chunks/{ln-XSDIE6SU.js → ln-B35EKC2Q.js} +1 -1
- package/dist/bin/chunks/{ls-R6DAGGBH.js → ls-67NUUIYT.js} +1 -1
- package/dist/bin/chunks/{mkdir-74BP5NTG.js → mkdir-AWDWRBKC.js} +1 -1
- package/dist/bin/chunks/mktemp-L6OGMDUO.js +3 -0
- package/dist/bin/chunks/{mv-YG75IRRE.js → mv-4BJSOT4Y.js} +1 -1
- package/dist/bin/{shell/chunks/od-YCY27MMO.js → chunks/od-SI75GLRE.js} +1 -1
- package/dist/bin/chunks/{paste-ACKOG3XS.js → paste-5TSIBDF7.js} +1 -1
- package/dist/bin/chunks/python3-GUWCSSDP.js +23 -0
- package/dist/bin/{shell/chunks/readlink-HMHVGSAM.js → chunks/readlink-URO5XTBB.js} +1 -1
- package/dist/bin/{shell/chunks/rg-A3E7YM2A.js → chunks/rg-RVULUPDH.js} +1 -1
- package/dist/bin/{shell/chunks/rm-3PLW4O4B.js → chunks/rm-UCUTHC3I.js} +1 -1
- package/dist/bin/chunks/{rmdir-DCJ3XJRR.js → rmdir-J3HM7GGM.js} +1 -1
- package/dist/bin/{shell/chunks/sed-KJWKB22J.js → chunks/sed-MCLGHZOI.js} +1 -1
- package/dist/bin/chunks/{seq-Q4LZ6EXV.js → seq-I54NZE75.js} +1 -1
- package/dist/bin/{shell/chunks/sleep-DVFE2GSF.js → chunks/sleep-CV6B4M6W.js} +1 -1
- package/dist/bin/chunks/{split-XMXBXL5Q.js → split-VZO7223N.js} +1 -1
- package/dist/bin/chunks/{sqlite3-DNH2VLVN.js → sqlite3-HXVFVP4Z.js} +1 -1
- package/dist/bin/chunks/sqlite3-worker.js +75 -11
- package/dist/bin/chunks/{stat-5PUSTPTK.js → stat-UJ37RBMM.js} +1 -1
- package/dist/bin/chunks/{tail-4MB7HHIZ.js → tail-5TSF5YM4.js} +1 -1
- package/dist/bin/{shell/chunks/tar-FRDUJZDN.js → chunks/tar-ZGZZDQXO.js} +1 -1
- package/dist/bin/chunks/{time-LF7BTSK5.js → time-J2DAZUIN.js} +1 -1
- package/dist/bin/chunks/timeout-ATTDYXLX.js +3 -0
- package/dist/bin/chunks/{tr-Z6N34HZM.js → tr-6RPFASYV.js} +1 -1
- package/dist/bin/chunks/worker.js +88 -15
- package/dist/bin/chunks/{xan-VSF6ZQGZ.js → xan-CCS53B7D.js} +1 -1
- package/dist/bin/chunks/{xan-view-UEFBHYVN.js → xan-view-KOXASOEV.js} +1 -1
- package/dist/bin/chunks/yes-ELH3XQWY.js +3 -0
- package/dist/bin/chunks/yq-GSCDUHGM.js +3 -0
- package/dist/bin/just-bash.js +333 -328
- package/dist/bin/shell/chunks/awk2-U22OR5B5.js +3 -0
- package/dist/bin/{chunks/base64-FLJ4YPHB.js → shell/chunks/base64-2KKH5BCT.js} +1 -1
- package/dist/bin/shell/chunks/{cat-2J5MA5PY.js → cat-V45MVNBT.js} +1 -1
- package/dist/bin/{chunks/chmod-ZM5WLMZI.js → shell/chunks/chmod-A54R4UUQ.js} +1 -1
- package/dist/bin/shell/chunks/chunk-2NJJXU4K.js +27 -0
- package/dist/bin/{chunks/chunk-BJRT4VKD.js → shell/chunks/chunk-3LKMI5IX.js} +1 -1
- package/dist/bin/{chunks/chunk-4APSDE57.js → shell/chunks/chunk-44SKMHU6.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-GRP7L2EL.js → chunk-6DAR25KN.js} +1 -1
- package/dist/bin/{chunks/chunk-VGR3NA3H.js → shell/chunks/chunk-723HNGID.js} +1 -1
- package/dist/bin/{chunks/chunk-MRPJL3ZK.js → shell/chunks/chunk-7X4QBCFW.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-42AMF6EE.js → chunk-ABM5WFEO.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-2HFDEZUY.js → chunk-AINNAQBQ.js} +1 -1
- package/dist/bin/{chunks/chunk-BPWZ7ADB.js → shell/chunks/chunk-AL7RVSF4.js} +1 -1
- package/dist/bin/{chunks/chunk-MHAGHCSO.js → shell/chunks/chunk-ARYCSNJJ.js} +7 -7
- package/dist/bin/{chunks/chunk-2INNLNI5.js → shell/chunks/chunk-BJF6B4YW.js} +1 -1
- package/dist/bin/{chunks/chunk-BZWGVRFA.js → shell/chunks/chunk-BOXG6XBN.js} +2 -2
- package/dist/bin/shell/chunks/chunk-DA3RFNKK.js +17 -0
- package/dist/bin/shell/chunks/chunk-DH7M46D3.js +20 -0
- package/dist/bin/shell/chunks/{chunk-2ND6MMXN.js → chunk-DTGQQKI2.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-YOIFOOGX.js → chunk-ECZAFQ22.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-PPVF2N6C.js → chunk-EFS34UUR.js} +1 -1
- package/dist/bin/{chunks/chunk-TW2IJRUF.js → shell/chunks/chunk-ENEHPI32.js} +1 -1
- package/dist/bin/shell/chunks/chunk-HFW2LXQV.js +13 -0
- package/dist/bin/{chunks/chunk-UHNV55NF.js → shell/chunks/chunk-HRKG3ZK2.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-74TZ7ZF7.js → chunk-IKUY74NG.js} +1 -1
- package/dist/bin/shell/chunks/chunk-ILXMFIYG.js +7 -0
- package/dist/bin/shell/chunks/chunk-IMVXTSPG.js +275 -0
- package/dist/bin/shell/chunks/chunk-J5L5DJWL.js +3 -0
- package/dist/bin/{chunks/chunk-MF3GVFLC.js → shell/chunks/chunk-JKS7WXGR.js} +1 -1
- package/dist/bin/{chunks/chunk-XBX7KFWK.js → shell/chunks/chunk-LG6IN6SW.js} +11 -11
- package/dist/bin/shell/chunks/chunk-LMFAALLO.js +21 -0
- package/dist/bin/{chunks/chunk-DYIBFLS3.js → shell/chunks/chunk-LOU52GPJ.js} +2 -2
- package/dist/bin/shell/chunks/{chunk-FB44CW33.js → chunk-M5ZBECGM.js} +1 -1
- package/dist/bin/shell/chunks/chunk-MA6BMA4M.js +3 -0
- package/dist/bin/shell/chunks/{chunk-Z7QCL4IA.js → chunk-MPQMTLXN.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-TIHFGNPS.js → chunk-MUIYG2RB.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-PUZGSIMN.js → chunk-NGMFI3RH.js} +1 -1
- package/dist/bin/{chunks/chunk-RYQB6GQ7.js → shell/chunks/chunk-NLMTGTSG.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-QAYU7HPM.js → chunk-OBVTFHVP.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-MNSMZU47.js → chunk-OOKVPG5D.js} +1 -1
- package/dist/bin/{chunks/chunk-O2BCKSMK.js → shell/chunks/chunk-PEJXCXSY.js} +1 -1
- package/dist/bin/{chunks/chunk-MYEPQX6Y.js → shell/chunks/chunk-PL4EU7Y2.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-QFTZKD5O.js → chunk-QCGH2ZOW.js} +1 -1
- package/dist/bin/shell/chunks/chunk-QKWMWSV3.js +3 -0
- package/dist/bin/{chunks/chunk-ISOWCECJ.js → shell/chunks/chunk-S5Z7DMIE.js} +10 -10
- package/dist/bin/{chunks/chunk-OLEQNRKX.js → shell/chunks/chunk-SQ7SZZMW.js} +1 -1
- package/dist/bin/{chunks/chunk-44MQ5AXA.js → shell/chunks/chunk-SQUH76NP.js} +1 -1
- package/dist/bin/{chunks/chunk-BOYPCOSV.js → shell/chunks/chunk-TGRZ42DS.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-LUHU7UUN.js → chunk-THTKNRO6.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-VKTV45AP.js → chunk-TQXLQEIT.js} +1 -1
- package/dist/bin/{chunks/chunk-2OQ5HPZE.js → shell/chunks/chunk-U6BXPMLD.js} +1 -1
- package/dist/bin/shell/chunks/chunk-U6DBRMD5.js +5 -0
- package/dist/bin/{chunks/chunk-CC2AQ6B7.js → shell/chunks/chunk-U6JTVQU6.js} +1 -1
- package/dist/bin/shell/chunks/chunk-UPUFWGHR.js +3 -0
- package/dist/bin/shell/chunks/{chunk-E5VZGTZ6.js → chunk-URRH3GPG.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-EXGPMLIE.js → chunk-VBU3UEG5.js} +1 -1
- package/dist/bin/shell/chunks/chunk-VGSRQOLD.js +7 -0
- package/dist/bin/shell/chunks/{chunk-GTULZ3ZD.js → chunk-WBST7XJW.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-ROFYAVPF.js → chunk-WEQ5WM2M.js} +1 -1
- package/dist/bin/{chunks/chunk-BCQSUELK.js → shell/chunks/chunk-WZ7MIBLR.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-H4BRFPKY.js → chunk-X45GP3AQ.js} +1 -1
- package/dist/bin/shell/chunks/chunk-YQEKKZTU.js +12 -0
- package/dist/bin/shell/chunks/{chunk-UNKX6YM6.js → chunk-Z3KAV6YJ.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-3SCW7PD5.js → chunk-Z5KICK5X.js} +1 -1
- package/dist/bin/shell/chunks/{column-7VBJL757.js → column-LHHS4D3K.js} +1 -1
- package/dist/bin/{chunks/cp-MF5GADQN.js → shell/chunks/cp-HPLQA35N.js} +1 -1
- package/dist/bin/shell/chunks/curl-FIRG3RB6.js +31 -0
- package/dist/bin/shell/chunks/{cut-QOTYBJJJ.js → cut-KP3S36XS.js} +1 -1
- package/dist/bin/{chunks/diff-YXZZCUSQ.js → shell/chunks/diff-JSJ56EOK.js} +1 -1
- package/dist/bin/shell/chunks/dist-4NZ74CRE.js +141 -0
- package/dist/bin/shell/chunks/{du-A3UGHIKJ.js → du-WEF5YWQK.js} +1 -1
- package/dist/bin/shell/chunks/{expr-TDF3B6QJ.js → expr-FLWT4OCO.js} +1 -1
- package/dist/bin/shell/chunks/{file-AJGG7RYT.js → file-JLUCGBCB.js} +1 -1
- package/dist/bin/shell/chunks/{find-6DH6TRDN.js → find-XGVQ6N6L.js} +1 -1
- package/dist/bin/shell/chunks/flag-coverage-4JYKIAVV.js +3 -0
- package/dist/bin/shell/chunks/{grep-WUZMZDGY.js → grep-DCPCPQOS.js} +1 -1
- package/dist/bin/shell/chunks/{gzip-JA7JQBUS.js → gzip-6DZIKNBW.js} +1 -1
- package/dist/bin/{chunks/head-YGKW3HS4.js → shell/chunks/head-TLFXMM2T.js} +1 -1
- package/dist/bin/{chunks/help-HVIDHJ6M.js → shell/chunks/help-EXVKU23F.js} +1 -1
- package/dist/bin/shell/chunks/{html-to-markdown-ZWL7LZIP.js → html-to-markdown-E22RLT2U.js} +1 -1
- package/dist/bin/shell/chunks/{jq-5MI4V3G5.js → jq-GDM3OBBK.js} +1 -1
- package/dist/bin/shell/chunks/js-exec-VU6F6WLS.js +1578 -0
- package/dist/bin/shell/chunks/{ln-XSDIE6SU.js → ln-B35EKC2Q.js} +1 -1
- package/dist/bin/shell/chunks/{ls-R6DAGGBH.js → ls-67NUUIYT.js} +1 -1
- package/dist/bin/shell/chunks/{mkdir-74BP5NTG.js → mkdir-AWDWRBKC.js} +1 -1
- package/dist/bin/shell/chunks/mktemp-L6OGMDUO.js +3 -0
- package/dist/bin/shell/chunks/{mv-YG75IRRE.js → mv-4BJSOT4Y.js} +1 -1
- package/dist/bin/{chunks/od-YCY27MMO.js → shell/chunks/od-SI75GLRE.js} +1 -1
- package/dist/bin/shell/chunks/{paste-ACKOG3XS.js → paste-5TSIBDF7.js} +1 -1
- package/dist/bin/shell/chunks/python3-GUWCSSDP.js +23 -0
- package/dist/bin/{chunks/readlink-HMHVGSAM.js → shell/chunks/readlink-URO5XTBB.js} +1 -1
- package/dist/bin/{chunks/rg-A3E7YM2A.js → shell/chunks/rg-RVULUPDH.js} +1 -1
- package/dist/bin/{chunks/rm-3PLW4O4B.js → shell/chunks/rm-UCUTHC3I.js} +1 -1
- package/dist/bin/shell/chunks/{rmdir-DCJ3XJRR.js → rmdir-J3HM7GGM.js} +1 -1
- package/dist/bin/{chunks/sed-KJWKB22J.js → shell/chunks/sed-MCLGHZOI.js} +1 -1
- package/dist/bin/shell/chunks/{seq-Q4LZ6EXV.js → seq-I54NZE75.js} +1 -1
- package/dist/bin/{chunks/sleep-DVFE2GSF.js → shell/chunks/sleep-CV6B4M6W.js} +1 -1
- package/dist/bin/shell/chunks/{split-XMXBXL5Q.js → split-VZO7223N.js} +1 -1
- package/dist/bin/shell/chunks/{sqlite3-DNH2VLVN.js → sqlite3-HXVFVP4Z.js} +1 -1
- package/dist/bin/shell/chunks/{stat-5PUSTPTK.js → stat-UJ37RBMM.js} +1 -1
- package/dist/bin/shell/chunks/{tail-4MB7HHIZ.js → tail-5TSF5YM4.js} +1 -1
- package/dist/bin/{chunks/tar-FRDUJZDN.js → shell/chunks/tar-ZGZZDQXO.js} +1 -1
- package/dist/bin/shell/chunks/{time-LF7BTSK5.js → time-J2DAZUIN.js} +1 -1
- package/dist/bin/shell/chunks/timeout-ATTDYXLX.js +3 -0
- package/dist/bin/shell/chunks/{tr-Z6N34HZM.js → tr-6RPFASYV.js} +1 -1
- package/dist/bin/shell/chunks/{xan-VSF6ZQGZ.js → xan-CCS53B7D.js} +1 -1
- package/dist/bin/shell/chunks/{xan-view-UEFBHYVN.js → xan-view-KOXASOEV.js} +1 -1
- package/dist/bin/shell/chunks/yes-ELH3XQWY.js +3 -0
- package/dist/bin/shell/chunks/yq-GSCDUHGM.js +3 -0
- package/dist/bin/shell/shell.js +334 -329
- package/dist/browser.d.ts +1 -1
- package/dist/bundle/browser.js +866 -836
- package/dist/bundle/chunks/awk2-V7KYQWCD.js +2 -0
- package/dist/bundle/chunks/{base64-2BAITDZF.js → base64-QPSYZAAJ.js} +1 -1
- package/dist/bundle/chunks/{cat-33KGN4MZ.js → cat-54BXBS6X.js} +1 -1
- package/dist/bundle/chunks/{chmod-APOXUPXW.js → chmod-4OPV4QKK.js} +1 -1
- package/dist/bundle/chunks/{chunk-IBRT3OJS.js → chunk-2WBUTDF5.js} +1 -1
- package/dist/bundle/chunks/{chunk-WNH3HOQA.js → chunk-353VO5TF.js} +1 -1
- package/dist/bundle/chunks/chunk-3HDTNUL3.js +6 -0
- package/dist/bundle/chunks/{chunk-XV2V56NQ.js → chunk-3KWM4FFA.js} +1 -1
- package/dist/bundle/chunks/{chunk-WXPNKIIH.js → chunk-43OP7DFL.js} +1 -1
- package/dist/bundle/chunks/{chunk-DMWNBCXJ.js → chunk-4GEHRJMD.js} +1 -1
- package/dist/bundle/chunks/{chunk-3CBCABOZ.js → chunk-4IMUNIUJ.js} +1 -1
- package/dist/bundle/chunks/chunk-5BMPT6SF.js +19 -0
- package/dist/bundle/chunks/{chunk-XPDOK3XY.js → chunk-5QWGR2WA.js} +1 -1
- package/dist/bundle/chunks/{chunk-X3TZEFQG.js → chunk-5UTZMNI5.js} +1 -1
- package/dist/bundle/chunks/{chunk-QPZVR6ZN.js → chunk-65LVAUWW.js} +1 -1
- package/dist/bundle/chunks/{chunk-YDR2IWKO.js → chunk-72JHTO7E.js} +1 -1
- package/dist/bundle/chunks/{chunk-KVG5FR5F.js → chunk-7GA3QWJJ.js} +11 -11
- package/dist/bundle/chunks/{chunk-ICQYTW7W.js → chunk-7M672HB6.js} +1 -1
- package/dist/bundle/chunks/chunk-B6OSJB22.js +26 -0
- package/dist/bundle/chunks/{chunk-N3FZSEG7.js → chunk-BM3X75NC.js} +1 -1
- package/dist/bundle/chunks/chunk-CBM6J4AL.js +6 -0
- package/dist/bundle/chunks/{chunk-FNEG7DFQ.js → chunk-CGI6V2HW.js} +1 -1
- package/dist/bundle/chunks/{chunk-BKUWXPEM.js → chunk-CHWP6GRK.js} +1 -1
- package/dist/bundle/chunks/{chunk-UL6YJ7FT.js → chunk-D5ZJISRS.js} +1 -1
- package/dist/bundle/chunks/{chunk-TUNYNC46.js → chunk-DIRWTBKE.js} +1 -1
- package/dist/bundle/chunks/chunk-DIWMSSQY.js +2 -0
- package/dist/bundle/chunks/{chunk-273265WK.js → chunk-DPZVOEUP.js} +1 -1
- package/dist/bundle/chunks/chunk-EGTVQWAP.js +20 -0
- package/dist/bundle/chunks/{chunk-SI5VPVOA.js → chunk-EXXOLIVE.js} +1 -1
- package/dist/bundle/chunks/chunk-GLAFXDZC.js +4 -0
- package/dist/bundle/chunks/{chunk-PMYUC5JF.js → chunk-H42OAUJL.js} +1 -1
- package/dist/bundle/chunks/chunk-H53EPEGD.js +12 -0
- package/dist/bundle/chunks/{chunk-QE275OWT.js → chunk-HDOXCDVK.js} +1 -1
- package/dist/bundle/chunks/{chunk-USNDURQI.js → chunk-HIQEVPXM.js} +1 -1
- package/dist/bundle/chunks/{chunk-G4SEENI7.js → chunk-M4LDT7V7.js} +1 -1
- package/dist/bundle/chunks/{chunk-MHY57JTL.js → chunk-MDE25PQK.js} +1 -1
- package/dist/bundle/chunks/{chunk-Q6JV5CBB.js → chunk-MHDZERK4.js} +1 -1
- package/dist/bundle/chunks/{chunk-5ELNHAAJ.js → chunk-MHZF23KB.js} +1 -1
- package/dist/bundle/chunks/{chunk-LPJEKUCB.js → chunk-N6W6FM4N.js} +1 -1
- package/dist/bundle/chunks/{chunk-POIWRLUV.js → chunk-NRLE7KYI.js} +1 -1
- package/dist/bundle/chunks/{chunk-MQKGGNPS.js → chunk-NXBUT5V2.js} +2 -2
- package/dist/bundle/chunks/{chunk-4HMWZAP7.js → chunk-OB46N7Q7.js} +1 -1
- package/dist/bundle/chunks/{chunk-ALOFNPKY.js → chunk-PPHGMG47.js} +2 -2
- package/dist/bundle/chunks/{chunk-UXHSH7BM.js → chunk-R6ZGLVXI.js} +1 -1
- package/dist/bundle/chunks/chunk-RCRHDT54.js +274 -0
- package/dist/bundle/chunks/{chunk-N4TGZ6H7.js → chunk-RIIUVFUS.js} +1 -1
- package/dist/bundle/chunks/chunk-RK2WBVP4.js +2 -0
- package/dist/bundle/chunks/{chunk-MLIO3BK2.js → chunk-SQX6WQXB.js} +1 -1
- package/dist/bundle/chunks/chunk-SRB6FXRH.js +2 -0
- package/dist/bundle/chunks/{chunk-7IFSXTCJ.js → chunk-T4INBNHX.js} +1 -1
- package/dist/bundle/chunks/{chunk-TVJ6JVK4.js → chunk-TUQG2YRH.js} +1 -1
- package/dist/bundle/chunks/{chunk-JA6EY7US.js → chunk-U7UNEMLJ.js} +1 -1
- package/dist/bundle/chunks/{chunk-GVKYQN5J.js → chunk-UK2K3DHN.js} +1 -1
- package/dist/bundle/chunks/{chunk-HW6ZCMM5.js → chunk-VDJ53ESK.js} +1 -1
- package/dist/bundle/chunks/{chunk-WHHRIZS3.js → chunk-VGCXKMXN.js} +1 -1
- package/dist/bundle/chunks/chunk-VOQZ5TSL.js +2 -0
- package/dist/bundle/chunks/{chunk-R2FBRMDU.js → chunk-VWUMR4IC.js} +1 -1
- package/dist/bundle/chunks/chunk-W2Z6LYL6.js +11 -0
- package/dist/bundle/chunks/{chunk-CFBEDNHJ.js → chunk-W5J5ADJF.js} +7 -7
- package/dist/bundle/chunks/{chunk-V2SOLEQN.js → chunk-XHFP44Y4.js} +1 -1
- package/dist/bundle/chunks/{chunk-KIGPB52X.js → chunk-XZ34OGNM.js} +1 -1
- package/dist/bundle/chunks/{chunk-A3D7NRT6.js → chunk-Y32R7EZP.js} +10 -10
- package/dist/bundle/chunks/chunk-YUFU7O6I.js +16 -0
- package/dist/bundle/chunks/{chunk-MFGH46GH.js → chunk-YZH7FUSY.js} +1 -1
- package/dist/bundle/chunks/{column-LKMDIDCH.js → column-F5JDBRV6.js} +1 -1
- package/dist/bundle/chunks/{cp-FKTQRFYJ.js → cp-LTFB4EUA.js} +1 -1
- package/dist/bundle/chunks/curl-XCX2ZQEA.js +30 -0
- package/dist/bundle/chunks/{cut-RWPUW5FY.js → cut-IRSHL3BB.js} +1 -1
- package/dist/bundle/chunks/{diff-CSARC7WF.js → diff-VDB6RXHO.js} +1 -1
- package/dist/bundle/chunks/{du-PR3M44X6.js → du-DOWSRLXR.js} +1 -1
- package/dist/bundle/chunks/{expr-UMT2OHZ7.js → expr-GZ4DABKB.js} +1 -1
- package/dist/bundle/chunks/{file-VEGKTTSF.js → file-UI6QJAAU.js} +1 -1
- package/dist/bundle/chunks/{find-PM3TD7V4.js → find-JTXDH3MR.js} +1 -1
- package/dist/bundle/chunks/flag-coverage-EDO3VM43.js +2 -0
- package/dist/bundle/chunks/{grep-5UPEO42U.js → grep-OZCR76FT.js} +1 -1
- package/dist/bundle/chunks/{gzip-ZINVK3M6.js → gzip-GQC6CWVL.js} +1 -1
- package/dist/bundle/chunks/{head-CFENJILH.js → head-J6RVJFRS.js} +1 -1
- package/dist/bundle/chunks/{help-QDDMBDU7.js → help-62M75TSG.js} +1 -1
- package/dist/bundle/chunks/{html-to-markdown-GGVR4YGL.js → html-to-markdown-7OG5VWYG.js} +1 -1
- package/dist/bundle/chunks/{jq-X2P7Q64K.js → jq-FCG2IUBK.js} +1 -1
- package/dist/bundle/chunks/js-exec-NDLXDUBN.js +1577 -0
- package/dist/bundle/chunks/{ln-VYDFOFNO.js → ln-OPY2ZVGQ.js} +1 -1
- package/dist/bundle/chunks/{ls-R5CQLZQM.js → ls-MQTYWW4T.js} +1 -1
- package/dist/bundle/chunks/{mkdir-WDDKK2P3.js → mkdir-4A5W3RXH.js} +1 -1
- package/dist/bundle/chunks/mktemp-XKIE5N3X.js +2 -0
- package/dist/bundle/chunks/{mv-XSJA2FNL.js → mv-ZPIATQJL.js} +1 -1
- package/dist/bundle/chunks/{od-BI6XJPXY.js → od-LUHOH7CG.js} +1 -1
- package/dist/bundle/chunks/{paste-LLZ3ZQR2.js → paste-U57ZU47S.js} +1 -1
- package/dist/bundle/chunks/python3-SDFCGIU4.js +22 -0
- package/dist/bundle/chunks/{readlink-IY6QKK2P.js → readlink-YNNS6F7K.js} +1 -1
- package/dist/bundle/chunks/{rg-UQE6KUBP.js → rg-F4SX2PHI.js} +1 -1
- package/dist/bundle/chunks/{rm-JQ4GDKDD.js → rm-3XUUYAXQ.js} +1 -1
- package/dist/bundle/chunks/{rmdir-WZKAT6M5.js → rmdir-OGSEXEF4.js} +1 -1
- package/dist/bundle/chunks/{sed-JW2JDLSI.js → sed-MBB5SXGD.js} +1 -1
- package/dist/bundle/chunks/{seq-5R2GKXC6.js → seq-IN77HD3S.js} +1 -1
- package/dist/bundle/chunks/{sleep-PPRBTSVR.js → sleep-3QNP3BGR.js} +1 -1
- package/dist/bundle/chunks/{split-2SD6EP72.js → split-6R2TSQY6.js} +1 -1
- package/dist/bundle/chunks/{sqlite3-UVVRYDAL.js → sqlite3-7MBPFI6W.js} +1 -1
- package/dist/bundle/chunks/sqlite3-worker.js +75 -11
- package/dist/bundle/chunks/{stat-6KILP5AL.js → stat-YLVJ4L67.js} +1 -1
- package/dist/bundle/chunks/{tail-BDNMS4FR.js → tail-UGFWX3YY.js} +1 -1
- package/dist/bundle/chunks/{tar-6365WH6H.js → tar-BNHPWTOY.js} +1 -1
- package/dist/bundle/chunks/{time-NERE2JJ2.js → time-N6J6DC6C.js} +1 -1
- package/dist/bundle/chunks/timeout-ZHCL5KTP.js +2 -0
- package/dist/bundle/chunks/{tr-3I4MDKIF.js → tr-4NGL47UU.js} +1 -1
- package/dist/bundle/chunks/worker.js +88 -15
- package/dist/bundle/chunks/{xan-HUOXKUQA.js → xan-7R3I2DJO.js} +1 -1
- package/dist/bundle/chunks/xan-view-S4ZILLPU.js +2 -0
- package/dist/bundle/chunks/yes-I7SAR7XX.js +2 -0
- package/dist/bundle/chunks/yq-IOMBQYB2.js +2 -0
- package/dist/bundle/index.cjs +2862 -1489
- package/dist/bundle/index.js +349 -344
- package/dist/commands/curl/response-formatting.d.ts +2 -2
- package/dist/commands/curl/types.d.ts +5 -0
- package/dist/commands/diff/format.d.ts +46 -0
- package/dist/commands/js-exec/js-exec.d.ts +1 -10
- package/dist/commands/js-exec/run-runtime.d.ts +10 -0
- package/dist/commands/mktemp/mktemp.d.ts +4 -0
- package/dist/commands/registry.d.ts +1 -1
- package/dist/commands/sqlite3/worker.js +75 -11
- package/dist/commands/worker-request-controller.d.ts +3 -23
- package/dist/commands/yes/yes.d.ts +4 -0
- package/dist/custom-commands.d.ts +7 -0
- package/dist/fs/create-exclusive.d.ts +30 -0
- package/dist/fs/in-memory-fs/in-memory-fs.d.ts +8 -1
- package/dist/fs/interface.d.ts +37 -0
- package/dist/fs/mountable-fs/mountable-fs.d.ts +20 -1
- package/dist/fs/overlay-fs/overlay-fs.d.ts +9 -1
- package/dist/fs/read-write-fs/read-write-fs.d.ts +27 -1
- package/dist/fs/traversal.d.ts +9 -0
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/interpreter/expansion/array-prefix-suffix.d.ts +2 -1
- package/dist/interpreter/expansion/parameter-ops.d.ts +1 -0
- package/dist/interpreter/expansion/pattern-removal.d.ts +3 -0
- package/dist/interpreter/expansion/variable.d.ts +1 -1
- package/dist/interpreter/helpers/loop.d.ts +32 -0
- 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/network/allow-list/shared.d.ts +0 -8
- package/dist/network/dns-pin.d.ts +1 -35
- package/dist/network/fetch.d.ts +4 -6
- package/dist/network/types.d.ts +20 -2
- package/dist/security/defense-in-depth-box.d.ts +7 -0
- package/dist/security/trusted-globals.d.ts +8 -0
- package/dist/security/worker-defense-in-depth.d.ts +7 -0
- package/dist/types.d.ts +4 -3
- package/dist/worker-lifecycle.d.ts +27 -0
- package/package.json +12 -13
- package/dist/bin/chunks/awk2-C4A37H5N.js +0 -3
- package/dist/bin/chunks/chunk-23OI2XDJ.js +0 -20
- package/dist/bin/chunks/chunk-2ORJ5HTY.js +0 -276
- package/dist/bin/chunks/chunk-3PCPQIUD.js +0 -3
- package/dist/bin/chunks/chunk-7WBCA2BB.js +0 -3
- package/dist/bin/chunks/chunk-APV27ZZW.js +0 -21
- package/dist/bin/chunks/chunk-CPTQXTBJ.js +0 -3
- package/dist/bin/chunks/chunk-FE6GSISP.js +0 -22
- package/dist/bin/chunks/chunk-HL7NFZVQ.js +0 -13
- package/dist/bin/chunks/chunk-HWI42GQO.js +0 -7
- package/dist/bin/chunks/chunk-JQM3DKCH.js +0 -12
- package/dist/bin/chunks/chunk-TOTKK2XI.js +0 -16
- package/dist/bin/chunks/chunk-YTL6DXBO.js +0 -11
- package/dist/bin/chunks/curl-FS5LAEYI.js +0 -30
- package/dist/bin/chunks/flag-coverage-DOLZIUQ7.js +0 -3
- package/dist/bin/chunks/js-exec-DJQLXWCS.js +0 -99
- package/dist/bin/chunks/js-exec-worker.js +0 -4809
- package/dist/bin/chunks/python3-JCJHSX4Z.js +0 -14
- package/dist/bin/chunks/timeout-YGFHQJKX.js +0 -3
- package/dist/bin/chunks/undici-CKF2L2IP.js +0 -141
- package/dist/bin/chunks/yq-K5N5JD4N.js +0 -3
- package/dist/bin/shell/chunks/awk2-C4A37H5N.js +0 -3
- package/dist/bin/shell/chunks/chunk-23OI2XDJ.js +0 -20
- package/dist/bin/shell/chunks/chunk-2ORJ5HTY.js +0 -276
- package/dist/bin/shell/chunks/chunk-3PCPQIUD.js +0 -3
- package/dist/bin/shell/chunks/chunk-7WBCA2BB.js +0 -3
- package/dist/bin/shell/chunks/chunk-APV27ZZW.js +0 -21
- package/dist/bin/shell/chunks/chunk-CPTQXTBJ.js +0 -3
- package/dist/bin/shell/chunks/chunk-FE6GSISP.js +0 -22
- package/dist/bin/shell/chunks/chunk-HL7NFZVQ.js +0 -13
- package/dist/bin/shell/chunks/chunk-HWI42GQO.js +0 -7
- package/dist/bin/shell/chunks/chunk-JQM3DKCH.js +0 -12
- package/dist/bin/shell/chunks/chunk-TOTKK2XI.js +0 -16
- package/dist/bin/shell/chunks/chunk-YTL6DXBO.js +0 -11
- package/dist/bin/shell/chunks/curl-FS5LAEYI.js +0 -30
- package/dist/bin/shell/chunks/flag-coverage-DOLZIUQ7.js +0 -3
- package/dist/bin/shell/chunks/js-exec-DJQLXWCS.js +0 -99
- package/dist/bin/shell/chunks/python3-JCJHSX4Z.js +0 -14
- package/dist/bin/shell/chunks/timeout-YGFHQJKX.js +0 -3
- package/dist/bin/shell/chunks/undici-CKF2L2IP.js +0 -141
- package/dist/bin/shell/chunks/yq-K5N5JD4N.js +0 -3
- package/dist/bundle/chunks/awk2-NPLZQ3K7.js +0 -2
- package/dist/bundle/chunks/chunk-6DTD75TR.js +0 -275
- package/dist/bundle/chunks/chunk-6KK46B7Q.js +0 -12
- package/dist/bundle/chunks/chunk-AH7VTVWU.js +0 -2
- package/dist/bundle/chunks/chunk-BRJERIF4.js +0 -2
- package/dist/bundle/chunks/chunk-ELHOZMBD.js +0 -10
- package/dist/bundle/chunks/chunk-INDA53JL.js +0 -21
- package/dist/bundle/chunks/chunk-KBXRZGTY.js +0 -15
- package/dist/bundle/chunks/chunk-N3A4JVFJ.js +0 -2
- package/dist/bundle/chunks/chunk-UTKGYVUZ.js +0 -7
- package/dist/bundle/chunks/chunk-XMMV24SP.js +0 -20
- package/dist/bundle/chunks/chunk-YJKHREBZ.js +0 -11
- package/dist/bundle/chunks/chunk-ZBUZKIPX.js +0 -6
- package/dist/bundle/chunks/curl-DEHFBW27.js +0 -29
- package/dist/bundle/chunks/flag-coverage-I6UJUKQ4.js +0 -2
- package/dist/bundle/chunks/js-exec-XKF2B7C3.js +0 -98
- package/dist/bundle/chunks/js-exec-worker.js +0 -4809
- package/dist/bundle/chunks/python3-F5S5TYGS.js +0 -13
- package/dist/bundle/chunks/timeout-C6WDYPLV.js +0 -2
- package/dist/bundle/chunks/undici-PSPBDOYF.js +0 -140
- package/dist/bundle/chunks/xan-view-RT2WKDOQ.js +0 -2
- package/dist/bundle/chunks/yq-MI27NZ2U.js +0 -2
- package/dist/commands/js-exec/js-exec-worker.d.ts +0 -33
|
@@ -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{b as P,c as F,d as O,e as T}from"./chunk-
|
|
3
|
+
import{b as P,c as F,d as O,e as T}from"./chunk-X45GP3AQ.js";import{b as S}from"./chunk-43E7AR6A.js";import{l as v,m as w}from"./chunk-LCP3IKI7.js";import{a as D}from"./chunk-I4IRHQDW.js";import{a as E}from"./chunk-NE4R2FVV.js";import{a as $,b as C}from"./chunk-MUFNRCMY.js";var R={name:"cp",summary:"copy files and directories",usage:"cp [OPTION]... SOURCE... DEST",options:["-r, -R, --recursive copy directories recursively","-n, --no-clobber do not overwrite an existing file","-p, --preserve preserve file attributes","-v, --verbose explain what is being done"," --help display this help and exit"]},H={recursive:{short:"r",long:"recursive",type:"boolean"},recursiveUpper:{short:"R",type:"boolean"},noClobber:{short:"n",long:"no-clobber",type:"boolean"},preserve:{short:"p",long:"preserve",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},j={name:"cp",async execute(u,e){if(C(u))return $(R);let s=E("cp",u,H);if(!s.ok)return s.error;let d=s.result.flags.recursive||s.result.flags.recursiveUpper,k=s.result.flags.noClobber,A=s.result.flags.preserve,N=s.result.flags.verbose,p=s.result.positional;if(p.length<2)return{stdout:"",stderr:`cp: missing destination file operand
|
|
4
4
|
`,exitCode:1};let g=p.pop()??"",m=p,l=e.fs.resolvePath(e.cwd,g),y="",n="",i=0,h=new O({limits:e.limits,signal:e.signal,executionScope:e.executionScope,site:"cp"}),f=!1;try{f=(await e.fs.stat(l)).isDirectory}catch{}if(m.length>1&&!f)return{stdout:"",stderr:`cp: target '${g}' is not a directory
|
|
5
5
|
`,exitCode:1};for(let t of m)try{let o=e.fs.resolvePath(e.cwd,t),a=await e.fs.stat(o),r=l;if(f){let c=t.split("/").pop()||t;r=l==="/"?`/${c}`:`${l}/${c}`}if(a.isDirectory&&!d){n+=`cp: -r not specified; omitting directory '${t}'
|
|
6
6
|
`,i=1;continue}if(a.isDirectory){let c=await F(e.fs,o,r,h);if(S(o,r)||c==="inside"){n+=`cp: cannot copy '${t}' into itself, '${r}'
|
|
@@ -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{f as Y}from"./chunk-WDV2ECOC.js";import{a as K}from"./chunk-3MRB66F4.js";import{a as P,b as J,c as D}from"./chunk-
|
|
3
|
+
import{f as Y}from"./chunk-WDV2ECOC.js";import{a as K}from"./chunk-3MRB66F4.js";import{a as P,b as J,c as D}from"./chunk-WEQ5WM2M.js";import{a as W}from"./chunk-LG6IN6SW.js";import{a as N}from"./chunk-IKUY74NG.js";import{e as V}from"./chunk-QKWMWSV3.js";import{d as Z}from"./chunk-X45GP3AQ.js";import{l as M}from"./chunk-LCP3IKI7.js";import{a as G,b as T,e as _}from"./chunk-CPKBPQ2C.js";import{a as q,b as H,c as O}from"./chunk-MUFNRCMY.js";var X=Y({js:{extensions:[".js",".mjs",".cjs",".jsx"],globs:[]},ts:{extensions:[".ts",".tsx",".mts",".cts"],globs:[]},html:{extensions:[".html",".htm",".xhtml"],globs:[]},css:{extensions:[".css",".scss",".sass",".less"],globs:[]},json:{extensions:[".json",".jsonc",".json5"],globs:[]},xml:{extensions:[".xml",".xsl",".xslt"],globs:[]},c:{extensions:[".c",".h"],globs:[]},cpp:{extensions:[".cpp",".cc",".cxx",".hpp",".hh",".hxx",".h"],globs:[]},rust:{extensions:[".rs"],globs:[]},go:{extensions:[".go"],globs:[]},zig:{extensions:[".zig"],globs:[]},java:{extensions:[".java"],globs:[]},kotlin:{extensions:[".kt",".kts"],globs:[]},scala:{extensions:[".scala",".sc"],globs:[]},clojure:{extensions:[".clj",".cljc",".cljs",".edn"],globs:[]},py:{extensions:[".py",".pyi",".pyw"],globs:[]},rb:{extensions:[".rb",".rake",".gemspec"],globs:["Rakefile","Gemfile"]},php:{extensions:[".php",".phtml",".php3",".php4",".php5"],globs:[]},perl:{extensions:[".pl",".pm",".pod",".t"],globs:[]},lua:{extensions:[".lua"],globs:[]},sh:{extensions:[".sh",".bash",".zsh",".fish"],globs:[".bashrc",".zshrc",".profile"]},bat:{extensions:[".bat",".cmd"],globs:[]},ps:{extensions:[".ps1",".psm1",".psd1"],globs:[]},yaml:{extensions:[".yaml",".yml"],globs:[]},toml:{extensions:[".toml"],globs:["Cargo.toml","pyproject.toml"]},ini:{extensions:[".ini",".cfg",".conf"],globs:[]},csv:{extensions:[".csv",".tsv"],globs:[]},md:{extensions:[".md",".mdx",".markdown",".mdown",".mkd"],globs:[]},markdown:{extensions:[".md",".mdx",".markdown",".mdown",".mkd"],globs:[]},rst:{extensions:[".rst"],globs:[]},txt:{extensions:[".txt",".text"],globs:[]},tex:{extensions:[".tex",".ltx",".sty",".cls"],globs:[]},sql:{extensions:[".sql"],globs:[]},graphql:{extensions:[".graphql",".gql"],globs:[]},proto:{extensions:[".proto"],globs:[]},make:{extensions:[".mk",".mak"],globs:["Makefile","GNUmakefile","makefile"]},docker:{extensions:[],globs:["Dockerfile","Dockerfile.*","*.dockerfile"]},tf:{extensions:[".tf",".tfvars"],globs:[]}}),A=class{types;constructor(){this.types=new Map(Object.entries(X).map(([t,s])=>[t,{extensions:[...s.extensions],globs:[...s.globs]}]))}addType(t){let s=t.indexOf(":");if(s===-1)return;let n=t.slice(0,s),r=t.slice(s+1);if(r.startsWith("include:")){let i=r.slice(8),l=this.types.get(i);if(l){let o=this.types.get(n)||{extensions:[],globs:[]};o.extensions.push(...l.extensions),o.globs.push(...l.globs),this.types.set(n,o)}}else{let i=this.types.get(n)||{extensions:[],globs:[]};if(r.startsWith("*.")&&!r.slice(2).includes("*")){let l=r.slice(1);i.extensions.includes(l)||i.extensions.push(l)}else i.globs.includes(r)||i.globs.push(r);this.types.set(n,i)}}clearType(t){let s=this.types.get(t);s&&(s.extensions=[],s.globs=[])}getType(t){return this.types.get(t)}getAllTypes(){return this.types}matchesType(t,s){let n=t.toLowerCase();for(let r of s){if(r==="all"){if(this.matchesAnyType(t))return!0;continue}let i=this.types.get(r);if(i){for(let l of i.extensions)if(n.endsWith(l))return!0;for(let l of i.globs)if(l.includes("*")){let o=l.replace(/\./g,"\\.").replace(/\*/g,".*");if(W(`^${o}$`,"i").test(t))return!0}else if(n===l.toLowerCase())return!0}}return!1}matchesAnyType(t){let s=t.toLowerCase();for(let n of this.types.values()){for(let r of n.extensions)if(s.endsWith(r))return!0;for(let r of n.globs)if(r.includes("*")){let i=r.replace(/\./g,"\\.").replace(/\*/g,".*");if(W(`^${i}$`,"i").test(t))return!0}else if(s===r.toLowerCase())return!0}return!1}};function Q(){let e=[];for(let[t,s]of Object.entries(X).sort()){let n=[];for(let r of s.extensions)n.push(`*${r}`);for(let r of s.globs)n.push(r);e.push(`${t}: ${n.join(", ")}`)}return`${e.join(`
|
|
4
4
|
`)}
|
|
5
5
|
`}function ee(){return{ignoreCase:!1,caseSensitive:!1,smartCase:!0,fixedStrings:!1,wordRegexp:!1,lineRegexp:!1,invertMatch:!1,multiline:!1,multilineDotall:!1,patterns:[],patternFiles:[],count:!1,countMatches:!1,files:!1,filesWithMatches:!1,filesWithoutMatch:!1,stats:!1,onlyMatching:!1,maxCount:0,lineNumber:!0,noFilename:!1,withFilename:!1,nullSeparator:!1,byteOffset:!1,column:!1,vimgrep:!1,replace:null,afterContext:0,beforeContext:0,contextSeparator:"--",quiet:!1,heading:!1,passthru:!1,includeZero:!1,sort:"path",json:!1,globs:[],iglobs:[],globCaseInsensitive:!1,types:[],typesNot:[],typeAdd:[],typeClear:[],hidden:!1,noIgnore:!1,noIgnoreDot:!1,noIgnoreVcs:!1,ignoreFiles:[],maxDepth:256,maxFilesize:512*1024*1024,followSymlinks:!1,searchZip:!1,searchBinary:!1,preprocessor:null,preprocessorGlobs:[]}}function ue(e){let t=e.match(/^(\d+)([KMG])?$/i);if(!t)return 0;let s=parseInt(t[1],10);switch((t[2]||"").toUpperCase()){case"K":return s*1024;case"M":return s*1024*1024;case"G":return s*1024*1024*1024;default:return s}}function fe(e){return/^\d+[KMG]?$/i.test(e)?null:{stdout:"",stderr:`rg: invalid --max-filesize value: ${e}
|
|
6
6
|
`,exitCode:1}}function he(e,t){return!/^\d+$/.test(t)||!Number.isSafeInteger(Number(t))?{stdout:"",stderr:`rg: invalid --${e} value: ${t}
|
|
@@ -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 as s,b as i}from"./chunk-
|
|
3
|
+
import{a as s,b as i}from"./chunk-VGSRQOLD.js";function a(t,e,n){if(!t||i.isInSandboxedContext())return;let r=`${e} ${n} attempted outside defense context`;throw new s(r,{timestamp:Date.now(),type:"missing_defense_context",message:r,path:"DefenseInDepthBox.context",stack:new Error().stack,executionId:i.getCurrentExecutionId()})}async function x(t,e,n,r){a(t,e,`${n} (pre-await)`);let o=await r();return a(t,e,`${n} (post-await)`),o}function d(t,e,n,r){let o=((...c)=>(a(t,e,n),r(...c)));return t?i.bindCurrentContext(o):o}export{a,x as b,d as c};
|
|
@@ -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-LG6IN6SW.js";import{a as x}from"./chunk-IKUY74NG.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{a as u,b as O,
|
|
3
|
+
import{a as u,b as O,d as W}from"./chunk-QKWMWSV3.js";import{l as g}from"./chunk-LCP3IKI7.js";import{a as y}from"./chunk-CPKBPQ2C.js";var k={name:"seq",async execute(r,p){let m=`
|
|
4
4
|
`,x=!1,i=[],e=0;for(;e<r.length;){let t=r[e];if(t==="-s"&&e+1<r.length){m=r[e+1],e+=2;continue}if(t==="-w"){x=!0,e++;continue}if(t==="--"){e++;break}if(t.startsWith("-")&&t!=="-"){if(t.startsWith("-s")&&t.length>2){m=t.slice(2),e++;continue}if((t==="-ws"||t==="-sw")&&(x=!0,e+1<r.length)){m=r[e+1],e+=2;continue}}i.push(t),e++}for(;e<r.length;)i.push(r[e]),e++;if(i.length===0)return{stdout:"",stderr:`seq: missing operand
|
|
5
5
|
`,exitCode:1};let d=1,a=1,l;if(i.length===1?l=parseFloat(i[0]):i.length===2?(d=parseFloat(i[0]),l=parseFloat(i[1])):(d=parseFloat(i[0]),a=parseFloat(i[1]),l=parseFloat(i[2])),!Number.isFinite(d)||!Number.isFinite(a)||!Number.isFinite(l))return{stdout:"",stderr:`seq: invalid floating point argument: '${i.find(o=>!Number.isFinite(parseFloat(o)))}'
|
|
6
6
|
`,exitCode:1};if(a===0)return{stdout:"",stderr:`seq: invalid Zero increment value: '0'
|
|
@@ -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 U,b as z}from"./chunk-
|
|
3
|
+
import{a as U,b as z}from"./chunk-ABM5WFEO.js";import{a as A}from"./chunk-LG6IN6SW.js";import{a as I}from"./chunk-VGSRQOLD.js";import{l as x}from"./chunk-LCP3IKI7.js";import{a as te,b as P}from"./chunk-CPKBPQ2C.js";import{a as N}from"./chunk-PBOVSFTJ.js";import{a as ne,b as ie,c as W}from"./chunk-MUFNRCMY.js";var H=new Map([["alnum","a-zA-Z0-9"],["alpha","a-zA-Z"],["ascii","\\x00-\\x7F"],["blank"," \\t"],["cntrl","\\x00-\\x1F\\x7F"],["digit","0-9"],["graph","!-~"],["lower","a-z"],["print"," -~"],["punct","!-/:-@\\[-`{-~"],["space"," \\t\\n\\r\\f\\v"],["upper","A-Z"],["word","a-zA-Z0-9_"],["xdigit","0-9A-Fa-f"]]);function V(i){let e="",t=0,n=!1;for(;t<i.length;){if(i[t]==="["&&!n){if(i[t+1]==="["&&i[t+2]===":"){let s=i.indexOf(":]]",t+3);if(s!==-1){let a=i.slice(t+3,s),r=H.get(a);if(r){e+=`[${r}]`,t=s+3;continue}}}if(i[t+1]==="^"&&i[t+2]==="["&&i[t+3]===":"){let s=i.indexOf(":]]",t+4);if(s!==-1){let a=i.slice(t+4,s),r=H.get(a);if(r){e+=`[^${r}]`,t=s+3;continue}}}e+="[",t++,n=!0,t<i.length&&i[t]==="^"&&(e+="^",t++),t<i.length&&i[t]==="]"&&(e+="\\]",t++);continue}if(n){if(i[t]==="]"){e+="]",t++,n=!1;continue}if(i[t]==="["&&i[t+1]===":"){let s=i.indexOf(":]",t+2);if(s!==-1){let a=i.slice(t+2,s),r=H.get(a);if(r){e+=r,t=s+2;continue}}}if(i[t]==="\\"&&t+1<i.length){e+=i[t]+i[t+1],t+=2;continue}e+=i[t],t++;continue}if(i[t]==="\\"&&t+1<i.length){let s=i[t+1];if(s==="+"||s==="?"||s==="|"){e+=s,t+=2;continue}if(s==="("||s===")"){e+=s,t+=2;continue}if(s==="{"||s==="}"){e+=s,t+=2;continue}if(s==="t"){e+=" ",t+=2;continue}if(s==="n"){e+=`
|
|
4
4
|
`,t+=2;continue}if(s==="r"){e+="\r",t+=2;continue}e+=i[t]+s,t+=2;continue}if(i[t]==="+"||i[t]==="?"||i[t]==="|"||i[t]==="("||i[t]===")"){e+=`\\${i[t]}`,t++;continue}if(i[t]==="^"&&!(e===""||e.endsWith("("))){e+="\\^",t++;continue}if(i[t]==="$"){let s=t===i.length-1,a=t+2<i.length&&i[t+1]==="\\"&&i[t+2]===")";if(!s&&!a){e+="\\$",t++;continue}}e+=i[t],t++}return e}function X(i){let e="",t=!1;for(let n=0;n<i.length;n++)i[n]==="["&&!t?(t=!0,e+="[",n++,n<i.length&&i[n]==="^"&&(e+="^",n++),n<i.length&&i[n]==="]"&&(e+="]",n++),n--):i[n]==="]"&&t?(t=!1,e+="]"):!t&&i[n]==="{"&&i[n+1]===","?(e+="{0,",n++):e+=i[n];return e}function se(i){let e="";for(let t=0;t<i.length;t++){let n=i[t],s=n.charCodeAt(0);n==="\\"?e+="\\\\":n===" "?e+="\\t":n===`
|
|
5
5
|
`?e+=`$
|
|
6
6
|
`:n==="\r"?e+="\\r":n==="\x07"?e+="\\a":n==="\b"?e+="\\b":n==="\f"?e+="\\f":n==="\v"?e+="\\v":s<32||s>=127?e+=`\\${s.toString(8).padStart(3,"0")}`:e+=n}return`${e}$`}var me=1e4;function ae(i,e,t){return{patternSpace:"",holdSpace:"",lineNumber:0,totalLines:i,deleted:!1,printed:!1,quit:!1,quitSilent:!1,exitCode:void 0,errorMessage:void 0,appendBuffer:[],substitutionMade:!1,lineNumberOutput:[],nCommandOutput:[],restartCycle:!1,inDRestartedCycle:!1,currentFilename:e,pendingFileReads:[],pendingFileWrites:[],rangeStates:t||new Map,linesConsumedInCycle:0}}function ge(i){return typeof i=="object"&&"first"in i&&"step"in i}function be(i){return typeof i=="object"&&"offset"in i}function L(i,e,t,n,s){if(i==="$")return e===t;if(typeof i=="number")return e===i;if(ge(i)){let{first:a,step:r}=i;return r===0?e===a:(e-a)%r===0&&e>=a}if(typeof i=="object"&&"pattern"in i)try{let a=i.pattern;a===""&&s?.lastPattern?a=s.lastPattern:a!==""&&s&&(s.lastPattern=a);let r=X(V(a));return A(r).test(n)}catch{return!1}return!1}function G(i){let e=t=>t===void 0?"undefined":t==="$"?"$":typeof t=="number"?String(t):"pattern"in t?`/${t.pattern}/`:"first"in t?`${t.first}~${t.step}`:"unknown";return`${e(i.start)},${e(i.end)}`}function Ee(i,e,t,n,s,a){if(!i||!i.start&&!i.end)return!0;let r=i.start,u=i.end;if(r!==void 0&&u===void 0)return L(r,e,t,n,a);if(r!==void 0&&u!==void 0){let o=typeof r=="object"&&"pattern"in r,h=typeof u=="object"&&"pattern"in u,p=be(u);if(p&&s){let m=G(i),d=s.get(m);if(d||(d={active:!1},s.set(m,d)),d.active){let E=d.startLine||e;return e>=E+u.offset&&(d.active=!1,s.set(m,d)),!0}else return L(r,e,t,n,a)?(d.active=!0,d.startLine=e,s.set(m,d),u.offset===0&&(d.active=!1,s.set(m,d)),!0):!1}if(!o&&!h&&!p){let m=typeof r=="number"?r:r==="$"?t:1,d=typeof u=="number"?u:t;if(m<=d)return e>=m&&e<=d;if(s){let E=G(i),l=s.get(E);return l||(l={active:!1},s.set(E,l)),!l.completed&&e>=m?(l.completed=!0,s.set(E,l),!0):!1}return!1}if(s){let m=G(i),d=s.get(m);if(d||(d={active:!1},s.set(m,d)),d.active)return L(u,e,t,n,a)&&(d.active=!1,typeof r=="number"&&(d.completed=!0),s.set(m,d)),!0;{if(d.completed)return!1;let E=!1;return typeof r=="number"?E=e>=r:E=L(r,e,t,n,a),E?(d.active=!0,d.startLine=e,s.set(m,d),L(u,e,t,n,a)&&(d.active=!1,typeof r=="number"&&(d.completed=!0),s.set(m,d)),!0):!1}}return L(r,e,t,n,a)}return!0}function O(i,e,t,n,s,a){let r=Ee(i,e,t,n,s,a);return i?.negated?!r:r}function ve(i,e,t,n){let s="",a=0,r=!1;for(;a<=i.length;){e.lastIndex=a;let u=e.exec(i);if(!u){s+=i.slice(a);break}if(u.index!==a){s+=i.slice(a,u.index),a=u.index,r=!1;continue}let o=u[0],h=u.slice(1);if(r&&o.length===0){if(a<i.length)s+=i[a],a++;else break;r=!1;continue}if(s+=n(o,h),r=!1,o.length===0)if(a<i.length)s+=i[a],a++;else break;else a+=o.length,r=!0}return s}function j(i,e,t){let n="",s=0;for(;s<i.length;){if(i[s]==="\\"&&s+1<i.length){let a=i[s+1];if(a==="&"){n+="&",s+=2;continue}if(a==="n"){n+=`
|
|
@@ -31,12 +31,12 @@ ${h}`,e.lineNumber=t.currentLineIndex+e.linesConsumedInCycle+1}else{e.quit=!0;br
|
|
|
31
31
|
`,this.advance()):r+=`\\${this.advance()}`}else r+="\\";else{if(this.peek()===`
|
|
32
32
|
`)break;r+=this.advance()}this.peek()===n&&this.advance();let u="";for(;this.pos<this.input.length;){let o=this.peek();if(o==="g"||o==="i"||o==="p"||o==="I"||this.isDigit(o))u+=this.advance();else break}return{type:c.SUBSTITUTE,value:`s${n}${s}${n}${r}${n}${u}`,pattern:s,replacement:r,flags:u,line:e,column:t}}readTransliterate(e,t){let n=this.advance();if(!n||n===`
|
|
33
33
|
`)return{type:c.ERROR,value:"y",line:e,column:t};let s=this.readEscapedString(n);if(s===null||this.peek()!==n)return{type:c.ERROR,value:"unterminated transliteration source",line:e,column:t};this.advance();let a=this.readEscapedString(n);if(a===null||this.peek()!==n)return{type:c.ERROR,value:"unterminated transliteration dest",line:e,column:t};this.advance();let r=this.peek();for(;r===" "||r===" ";)this.advance(),r=this.peek();return r!==""&&r!==";"&&r!==`
|
|
34
|
-
`&&r!=="}"?{type:c.ERROR,value:"extra text at the end of a transform command",line:e,column:t}:{type:c.TRANSLITERATE,value:`y${n}${s}${n}${a}${n}`,source:s,dest:a,line:e,column:t}}readTextCommand(e,t,n){
|
|
35
|
-
`||this.input[this.pos+1]===" "||this.input[this.pos+1]===" ")&&(
|
|
36
|
-
`&&this.advance();let
|
|
37
|
-
`){if(
|
|
38
|
-
`,this.advance();continue}break}if(
|
|
39
|
-
`,this.advance(),this.advance();continue}if(
|
|
34
|
+
`&&r!=="}"?{type:c.ERROR,value:"extra text at the end of a transform command",line:e,column:t}:{type:c.TRANSLITERATE,value:`y${n}${s}${n}${a}${n}`,source:s,dest:a,line:e,column:t}}readTextCommand(e,t,n){for(;this.peek()===" "||this.peek()===" ";)this.advance();this.peek()==="\\"&&this.pos+1<this.input.length&&(this.input[this.pos+1]===`
|
|
35
|
+
`||this.input[this.pos+1]===" "||this.input[this.pos+1]===" ")&&(this.advance(),this.peek()===`
|
|
36
|
+
`&&this.advance());let s="";for(;this.pos<this.input.length;){let a=this.peek();if(a===`
|
|
37
|
+
`){if(s.endsWith("\\")){s=`${s.slice(0,-1)}
|
|
38
|
+
`,this.advance();continue}break}if(a==="\\"&&this.pos+1<this.input.length){let r=this.input[this.pos+1];if(r==="n"){s+=`
|
|
39
|
+
`,this.advance(),this.advance();continue}if(r==="t"){s+=" ",this.advance(),this.advance();continue}if(r==="r"){s+="\r",this.advance(),this.advance();continue}if(r===" "||r===" "){s+=r,this.advance(),this.advance();continue}}s+=this.advance()}return{type:c.TEXT_CMD,value:e,text:s,line:t,column:n}}readBranch(e,t,n,s){for(;this.peek()===" "||this.peek()===" ";)this.advance();let a="";for(;this.pos<this.input.length;){let r=this.peek();if(r===" "||r===" "||r===`
|
|
40
40
|
`||r===";"||r==="}"||r==="{")break;a+=this.advance()}return{type:e,value:t,label:a||void 0,line:n,column:s}}readVersion(e,t){for(;this.peek()===" "||this.peek()===" ";)this.advance();let n="";for(;this.pos<this.input.length;){let s=this.peek();if(s===" "||s===" "||s===`
|
|
41
41
|
`||s===";"||s==="}"||s==="{")break;n+=this.advance()}return{type:c.VERSION,value:"v",label:n||void 0,line:e,column:t}}readFileCommand(e,t,n,s){for(;this.peek()===" "||this.peek()===" ";)this.advance();let a="";for(;this.pos<this.input.length;){let r=this.peek();if(r===`
|
|
42
42
|
`||r===";")break;a+=this.advance()}return{type:e,value:t,filename:a.trim(),line:n,column:s}}readExecute(e,t){for(;this.peek()===" "||this.peek()===" ";)this.advance();let n="";for(;this.pos<this.input.length;){let s=this.peek();if(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 A}from"./chunk-
|
|
3
|
+
import{a as A}from"./chunk-IKUY74NG.js";import{l as f}from"./chunk-LCP3IKI7.js";import{a as z,b as T}from"./chunk-CPKBPQ2C.js";import{a as _}from"./chunk-PBOVSFTJ.js";import{a as B}from"./chunk-NE4R2FVV.js";import{a as M,b as q}from"./chunk-MUFNRCMY.js";var L={name:"tr",summary:"translate or delete characters",usage:"tr [OPTION]... SET1 [SET2]",options:["-c, -C, --complement use the complement of SET1","-d, --delete delete characters in SET1","-s, --squeeze-repeats squeeze repeated characters"," --help display this help and exit"],description:`SET syntax:
|
|
4
4
|
a-z character range
|
|
5
5
|
[:alnum:] all letters and digits
|
|
6
6
|
[:alpha:] all letters
|
|
@@ -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-
|
|
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-44SKMHU6.js";import{b as V,d as Qe}from"./chunk-HFW2LXQV.js";import{d as Ge,f as Xe,g as oe}from"./chunk-WDV2ECOC.js";import{a as Z}from"./chunk-LG6IN6SW.js";import{b as Ye}from"./chunk-O74FSWB4.js";import{a as q}from"./chunk-IKUY74NG.js";import{a as W,d as se,e as re}from"./chunk-QKWMWSV3.js";import{l as E}from"./chunk-LCP3IKI7.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
|
|
@@ -62,7 +62,7 @@ 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
|
|
|
62
62
|
`,exitCode:1};i=o[0].headers}let m=[];for(let{headers:c,data:a}of o)for(let d of a){let u=F();for(let l of i)b(u,l,c.includes(l)?d[l]:"");m.push(u)}return{stdout:C(i,m,t),stderr:"",exitCode:0}}async function Be(e,t){let n="",s=[],r=!1,o=!1,i=[];for(let u=0;u<e.length;u++){let l=e[u];(l==="-s"||l==="--select")&&u+1<e.length?s=e[++u].split(","):l==="-v"||l==="--invert"?r=!0:l==="-i"||l==="--ignore-case"?o=!0:l==="-r"||l==="--regex"||l.startsWith("-")||(n?i.push(l):n=l)}if(!n)return{stdout:"",stderr:`xan search: no pattern specified
|
|
63
63
|
`,exitCode:1};let{headers:p,data:h,error:m}=await k(i,t);if(m)return m;let c=s.length>0?s:p,a;try{a=Z(n,o?"i":"")}catch{return{stdout:"",stderr:`xan search: invalid regex pattern '${n}'
|
|
64
64
|
`,exitCode:1}}let d=h.filter(u=>{let l=c.some(f=>{let x=u[f];return x!=null&&a.test(String(x))});return r?!l:l});return{stdout:C(p,d,t),stderr:"",exitCode:0}}async function He(e,t){let n="",s=[];for(let l of e)l.startsWith("-")||(n?s.push(l):n=l);if(!n)return{stdout:"",stderr:`xan flatmap: no expression specified
|
|
65
|
-
`,exitCode:1};let{headers:r,data:o,error:i}=await k(s,t);if(i)return i;let p=z(t),m=X(n,p).map(({expr:l,name:f})=>({alias:typeof f=="string"?f:f[0],ast:U(l,!0,p)})),c={limits:t.limits?{maxIterations:t.limits.maxJqIterations,maxStringLength:t.limits.maxStringLength}:void 0};if(W(r.length,m.length,"xan flatmap")>t.limits.maxArrayElements)throw new E(`xan flatmap: output column limit exceeded (${t.limits.maxArrayElements})`,"array_elements");let a=[...r,...m.map(l=>l.alias)],d=[],u=new $(t,"xan flatmap");for(let l of o){let f=[],x=1;for(let g of m){u.consumeWork();let y=V(l,g.ast,c),w=y.length>0&&Array.isArray(y[0])?y[0]:y;if(w.length>t.limits.maxArrayElements)throw new E(`xan flatmap: expression result limit exceeded (${t.limits.maxArrayElements})`,"array_elements");f.push(w),x=Math.max(x,w.length)}for(let g=0;g<x;g++){u.addRow(a.length);let y=j(l);for(let w=0;w<m.length;w++){let A=f[w][g]??null;b(y,m[w].alias,A)}d.push(y)}}return{stdout:C(a,d,t),stderr:"",exitCode:0}}async function Ke(e,t){let{cmdView:n}=await import("./xan-view-
|
|
65
|
+
`,exitCode:1};let{headers:r,data:o,error:i}=await k(s,t);if(i)return i;let p=z(t),m=X(n,p).map(({expr:l,name:f})=>({alias:typeof f=="string"?f:f[0],ast:U(l,!0,p)})),c={limits:t.limits?{maxIterations:t.limits.maxJqIterations,maxStringLength:t.limits.maxStringLength}:void 0};if(W(r.length,m.length,"xan flatmap")>t.limits.maxArrayElements)throw new E(`xan flatmap: output column limit exceeded (${t.limits.maxArrayElements})`,"array_elements");let a=[...r,...m.map(l=>l.alias)],d=[],u=new $(t,"xan flatmap");for(let l of o){let f=[],x=1;for(let g of m){u.consumeWork();let y=V(l,g.ast,c),w=y.length>0&&Array.isArray(y[0])?y[0]:y;if(w.length>t.limits.maxArrayElements)throw new E(`xan flatmap: expression result limit exceeded (${t.limits.maxArrayElements})`,"array_elements");f.push(w),x=Math.max(x,w.length)}for(let g=0;g<x;g++){u.addRow(a.length);let y=j(l);for(let w=0;w<m.length;w++){let A=f[w][g]??null;b(y,m[w].alias,A)}d.push(y)}}return{stdout:C(a,d,t),stderr:"",exitCode:0}}async function Ke(e,t){let{cmdView:n}=await import("./xan-view-KOXASOEV.js");return n(e,t)}var dt=new Set(["fuzzy-join","glob","hist","input","parallel","plot","progress","range","scrape","tokenize","union-find"]),St=new Set(["agg","behead","cat","count","dedup","drop","enum","explode","f","filter","fixlengths","flatmap","flatten","fmt","frequency","freq","from","groupby","head","headers","implode","join","map","merge","partition","pivot","rename","reverse","sample","search","select","shuffle","slice","sort","split","stats","tail","to","top","transform","transpose","view",...dt]),pt={name:"xan",summary:"CSV toolkit for data manipulation",usage:"xan <COMMAND> [OPTIONS] [FILE]",description:`xan is a collection of commands for working with CSV data.
|
|
66
66
|
It provides a simple, ergonomic interface for common data operations.
|
|
67
67
|
|
|
68
68
|
COMMANDS:
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
+
import{a as be}from"./chunk-BIJXTWZ4.js";import{a as Z}from"./chunk-MPQMTLXN.js";import{a as oe}from"./chunk-3MRB66F4.js";import{a as Te}from"./chunk-6D75E4LV.js";import{a as le}from"./chunk-LG6IN6SW.js";import{b as de,c as he,d as me}from"./chunk-VLWZ6L7C.js";import{d as we}from"./chunk-X45GP3AQ.js";import{l as ae}from"./chunk-LCP3IKI7.js";import{a as ie}from"./chunk-CPKBPQ2C.js";import{a as ye,b as ge}from"./chunk-MUFNRCMY.js";function R(e,t){switch(e.type){case"name":{let n=e.pattern,s=n.match(/^\*(\.[a-zA-Z0-9]+)$/);if(s){let a=s[1],l=t.name;if(e.ignoreCase){if(!l.toLowerCase().endsWith(a.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!l.endsWith(a))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Z(t.name,n,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let n=e.pattern,s=t.relativePath,a=n.split("/");for(let d=0;d<a.length-1;d++){let r=a[d];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 l=n.match(/\*(\.[a-zA-Z0-9]+)$/);if(l){let d=l[1];if(e.ignoreCase){if(!s.toLowerCase().endsWith(d.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!s.endsWith(d))return{matches:!1,pruned:!1,printed:!1}}return{matches:Z(s,n,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let n=e.ignoreCase?"i":"";return{matches:le(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=R(e.expr,t);return{matches:!n.matches,pruned:n.pruned,printed:!1,actions:n.actions}}case"and":{let n=R(e.left,t);if(!n.matches)return{matches:!1,pruned:n.pruned,printed:!1,actions:n.actions};let s=R(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=R(e.left,t);if(n.matches)return n;let s=R(e.right,t);return{matches:s.matches,pruned:n.pruned||s.pruned,printed:s.printed,actions:[...n.actions??[],...s.actions??[]]}}}}function _(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 _(e.expr);case"and":case"or":return _(e.left)||_(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 J(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 J(e.expr);case"and":case"or":return J(e.left)&&J(e.right)}}function B(e,t,n,s,a){switch(e.type){case"name":{let l=e.pattern,d=l.match(/^\*(\.[a-zA-Z0-9]+)$/);if(d){let r=d[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:Z(t,l,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let l=e.pattern,d=l.split("/");for(let i=0;i<d.length-1;i++){let o=d[i];if(o&&o!=="."&&o!==".."&&!o.includes("*")&&!o.includes("?")&&!o.includes("[")){let u=`/${o}/`;if(e.ignoreCase){if(!n.toLowerCase().includes(u.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.includes(u))return{matches:!1,pruned:!1,printed:!1}}}let r=l.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:Z(n,l,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let l=e.ignoreCase?"i":"";return{matches:le(e.pattern,l).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 l=B(e.expr,t,n,s,a);return{matches:!l.matches,pruned:l.pruned,printed:!1,actions:l.actions}}case"and":{let l=B(e.left,t,n,s,a);if(!l.matches)return{matches:!1,pruned:l.pruned,printed:!1,actions:l.actions};let d=B(e.right,t,n,s,a);return{matches:d.matches,pruned:l.pruned||d.pruned,printed:l.printed||d.printed,actions:[...l.actions??[],...d.actions??[]]}}case"or":{let l=B(e.left,t,n,s,a);if(l.matches)return l;let d=B(e.right,t,n,s,a);return{matches:d.matches,pruned:l.pruned||d.pruned,printed:d.printed,actions:[...l.actions??[],...d.actions??[]]}}default:return{matches:!1,pruned:!1,printed:!1}}}function U(e){if(!e)return!1;switch(e.type){case"prune":return!0;case"not":return U(e.expr);case"and":case"or":return U(e.left)||U(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 Ce(e,t){if(!e||!t.isDirectory)return{shouldPrune:!1};if(!L(e))return ce(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:R(e,n).pruned}}function ce(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(R(e.left,n).pruned)return{shouldPrune:!0}}return ce(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:R(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 R(e.left,n).matches?ce(e.right,t):{shouldPrune:!1}}return{shouldPrune:!1}}case"not":return{shouldPrune:!1};default:return{shouldPrune:!1}}}function Ee(e,t){let n=[],s=t,a=r=>({expr:null,pathIndex:s,error:`find: missing argument to \`${r}'
|
|
4
|
+
`}),l=(r,i)=>({expr:null,pathIndex:s,error:`find: invalid argument \`${i}' to \`${r}'
|
|
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
|
+
`}}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],o="exact",u=i;if(i.startsWith("+")?(o="more",u=i.slice(1)):i.startsWith("-")&&(o="less",u=i.slice(1)),!/^\d+$/.test(u))return l(r,i);let N=Number(u);if(!Number.isSafeInteger(N))return l(r,i);n.push({type:"expr",expr:{type:"mtime",days:N,comparison:o}})}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],o="exact",u=i;i.startsWith("+")?(o="more",u=i.slice(1)):i.startsWith("-")&&(o="less",u=i.slice(1));let N=u.match(/^(\d+)([ckMGb])?$/);if(!N)return l(r,i);let F=Number(N[1]);if(!Number.isSafeInteger(F))return l(r,i);let M=N[2]||"b",V=M==="G"?1024**3:M==="M"?1024**2:M==="k"?1024:M==="b"?512:1;if(!Number.isSafeInteger(F*V))return l(r,i);n.push({type:"expr",expr:{type:"size",value:F,unit:M,comparison:o}})}else if(r==="-perm"){if(s+1>=e.length)return a(r);let i=e[++s],o="exact",u=i;if(i.startsWith("-")?(o="all",u=i.slice(1)):i.startsWith("/")&&(o="any",u=i.slice(1)),!/^[0-7]{1,4}$/.test(u))return l(r,i);let N=Number.parseInt(u,8);n.push({type:"expr",expr:{type:"perm",mode:N,matchType:o}})}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 o=e[s]==="+";if(o&&(i.at(-1)!=="{}"||i.filter(u=>u==="{}").length!==1))return l("-exec","+");n.push({type:"expr",expr:{type:"action",action:{type:"exec",command:i,batchMode:o}}})}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}'
|
|
7
|
+
`}:{expr:null,pathIndex:s,error:`find: paths must precede expression: \`${r}'
|
|
8
|
+
`};s++}if(n.length===0)return{expr:null,pathIndex:s};let d=Ne(n);return d.error?{expr:null,pathIndex:s,error:d.error}:{expr:d.expr,pathIndex:s}}function Ne(e){let t=0,n;function s(){let i=a();if(!i)return null;for(;t<e.length;){let o=e[t];if(o.type==="op"&&o.op==="or"){t++;let u=a();if(!u)return n="find: expected an expression after `-o'\n",null;i={type:"or",left:i,right:u}}else break}return i}function a(){let i=l();if(!i)return null;for(;t<e.length;){let o=e[t];if(o.type==="op"&&o.op==="and"){t++;let u=l();if(!u)return n="find: expected an expression after `-a'\n",null;i={type:"and",left:i,right:u}}else if(o.type==="expr"||o.type==="not"||o.type==="lparen"){let u=l();if(!u)return i;i={type:"and",left:i,right:u}}else break}return i}function l(){if(t<e.length&&e[t].type==="not"){t++;let i=l();return i?{type:"not",expr:i}:(n="find: expected an expression after `!'\n",null)}return d()}function d(){if(t>=e.length)return null;let i=e[t];if(i.type==="lparen"){t++;let o=s();return!o||t>=e.length||e[t].type!=="rparen"?(n="find: missing closing `)'\n",null):(t++,o)}return i.type==="expr"?(t++,i.expr):(i.type==="rparen",null)}let r=s();return!n&&t<e.length&&(n=e[t].type==="rparen"?"find: unexpected `)'\n":`find: invalid expression
|
|
9
|
+
`),!n&&r&&ee(r)&&(n="find: refusing to evaluate `-delete' under negation\n"),{expr:n?null:r,error:n}}function ee(e,t=!1){return e.type==="action"?t&&e.action.type==="delete":e.type==="not"?ee(e.expr,!t):e.type==="and"||e.type==="or"?ee(e.left,t)||ee(e.right,t):!1}var ve=500;function Re(){return{readdirCalls:0,readdirTime:0,statCalls:0,statTime:0,evalCalls:0,evalTime:0,nodeCount:0,batchCount:0,batchTime:0,earlyPrunes:0}}function Fe(e,t,n){e({category:"find",name:"summary",durationMs:n,details:{readdirCalls:t.readdirCalls,readdirTimeMs:t.readdirTime,statCalls:t.statCalls,statTimeMs:t.statTime,evalCalls:t.evalCalls,evalTimeMs:t.evalTime,nodeCount:t.nodeCount,batchCount:t.batchCount,batchTimeMs:t.batchTime,earlyPrunes:t.earlyPrunes,otherTimeMs:n-t.readdirTime-t.statTime-t.evalTime-t.batchTime}})}var ze={name:"find",summary:"search for files in a directory hierarchy",usage:"find [path...] [expression]",options:["-name PATTERN file name matches shell pattern PATTERN","-iname PATTERN like -name but case insensitive","-path PATTERN file path matches shell pattern PATTERN","-ipath PATTERN like -path but case insensitive","-regex PATTERN file path matches regular expression PATTERN","-iregex PATTERN like -regex but case insensitive","-type TYPE file is of type: f (regular file), d (directory)","-empty file is empty or directory is empty","-mtime N file's data was modified N*24 hours ago","-newer FILE file was modified more recently than FILE","-size N[ckMGb] file uses N units of space (c=bytes, k=KB, M=MB, G=GB, b=512B blocks)","-perm MODE file's permission bits are exactly MODE (octal)","-perm -MODE all permission bits MODE are set","-perm /MODE any permission bits MODE are set","-maxdepth LEVELS descend at most LEVELS directories","-mindepth LEVELS do not apply tests at levels less than LEVELS","-depth process directory contents before directory itself","-prune do not descend into this directory","-not, ! negate the following expression","-a, -and logical AND (default)","-o, -or logical OR","-exec CMD {} ; execute CMD on each file ({} is replaced by filename)","-exec CMD {} + execute CMD with multiple files at once","-print print the full file name (default action)","-print0 print the full file name followed by a null character","-printf FORMAT print FORMAT with directives: %f %h %p %P %s %d %m %M %t","-delete delete found files/directories"," --help display this help and exit"]},nt={name:"find",async execute(e,t){if(ge(e))return ye(ze);let n=[],s=null,a=null,l=!1,d=e.length;for(let c=0;c<e.length;c++){let f=e[c];if(f.startsWith("-")||f==="("||f==="\\("||f===")"||f==="\\)"||f==="!"){d=c;break}n.push(f)}n.length===0&&n.push(".");for(let c=d;c<e.length;c++){let f=e[c];if(f==="-exec")for(c++;c<e.length&&e[c]!==";"&&e[c]!=="+";)c++;else if(f==="-maxdepth"||f==="-mindepth"){let p=e[c+1];if(p===void 0||!/^\d+$/.test(p))return{stdout:"",stderr:p===void 0?`find: missing argument to \`${f}'
|
|
10
|
+
`:`find: invalid argument \`${p}' to \`${f}'
|
|
11
|
+
`,exitCode:1};let v=Number(p);if(!Number.isSafeInteger(v))return{stdout:"",stderr:`find: invalid argument \`${p}' to \`${f}'
|
|
12
|
+
`,exitCode:1};f==="-maxdepth"?s=v:a=v,c++}else f==="-depth"&&(l=!0)}let{expr:r,error:i}=Ee(e,d);if(i)return{stdout:"",stderr:i,exitCode:1};let o=te(r),u=o.length>0;o.some(c=>c.type==="delete")&&(l=!0);let N=[],F=0,M=t.executionScope?new Te(t.executionScope,"find"):void 0,V=[],fe=[],Q=0,O=new we({limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"find"}),G=c=>{if(M)M.append("stdout",c);else{let f=ie(c);if(f>t.limits.maxOutputSize-Q)throw new ae(`find: output size limit exceeded (${t.limits.maxOutputSize} bytes)`,"output_size");c&&V.push(c),Q+=f}},q=c=>{if(M)M.append("stderr",c);else{let f=ie(c);if(f>t.limits.maxOutputSize-Q)throw new ae(`find: output size limit exceeded (${t.limits.maxOutputSize} bytes)`,"output_size");c&&fe.push(c),Q+=f}},De=Se(r),ne=new Map;for(let c of De){let f=t.fs.resolvePath(t.cwd,c);try{let p=await t.fs.stat(f);ne.set(c,p.mtime?.getTime()??Date.now())}catch{}}let Me=o.some(c=>{if(c.type!=="printf")return!1;let f=c.format.replace(/%%/g,"");return/%[-+]?[0-9]*\.?[0-9]*(s|m|M|t|T)/.test(f)}),Pe=_(r)||Me,xe=j(r),ue=U(r),$e=J(r),Ie=typeof t.fs.readdirWithFileTypes=="function";for(let c of n){let z=function(h){let y={path:h.relativePath,name:h.name,size:h.stat?.size??0,mtime:h.stat?.mtime?.getTime()??Date.now(),mode:h.stat?.mode??420,isDirectory:h.isDirectory,depth:h.depth,startingPoint:c},C=h.unreadable===void 0?[]:[{action:{type:"diagnostic",message:`find: ${h.relativePath}: ${h.unreadable}
|
|
13
|
+
`},path:h.relativePath,printfData:y}],I=w=>l?[...C,...w]:[...w,...C];if(!(a===null||h.depth>=a))return C;let g=!0,m=[];if(r!==null){let w=Date.now(),T;if($e)T=B(r,h.name,h.relativePath,h.isFile,h.isDirectory);else{let S={name:h.name,relativePath:h.relativePath,isFile:h.isFile,isDirectory:h.isDirectory,isEmpty:h.isEmpty,mtime:h.stat?.mtime?.getTime()??Date.now(),size:h.stat?.size??0,mode:h.stat?.mode??420,newerRefTimes:ne};T=R(r,S)}g=T.matches,m=T.actions??[],p.evalCalls++,p.evalTime+=Date.now()-w}if(!u&&g&&(m=[{type:"print"}]),m.length===0)return C;O.checkpoint(m.length);let b=[];for(let w of m)b.push({action:w,path:h.relativePath,printfData:y});return I(b)};var He=z;c.length>1&&c.endsWith("/")&&(c=c.slice(0,-1));let f=t.fs.resolvePath(t.cwd,c);try{await t.fs.stat(f)}catch{q(`find: ${c}: No such file or directory
|
|
14
|
+
`),F=1;continue}let p=Re(),v=Date.now();async function P(h){let{path:y,depth:C,typeInfo:I}=h;if(O.visit(C),p.nodeCount++,C>(s??t.limits.maxTraversalDepth))return null;let x,g,m;if(I&&!Pe)x=I.isFile,g=I.isDirectory;else{try{let W=Date.now();m=await t.fs.lstat(y),p.statCalls++,p.statTime+=Date.now()-W}catch{return null}if(!m)return null;x=m.isFile,g=m.isDirectory}let b;y===f?b=c.split("/").pop()||c:b=y.split("/").pop()||"";let w=y===f?c:c==="."?`./${y.slice(f==="/"?f.length:f.length+1)}`:c+y.slice(f.length),T=[],S=null,E=null,$=!1;g&&ue&&!l&&($=Ce(r,{name:b,relativePath:w,isFile:x,isDirectory:g}).shouldPrune,$&&p.earlyPrunes++);let H=!(C>=(s??t.limits.maxTraversalDepth))&&!$,K=(H||xe)&&!$,X;if(g&&K){let W=Date.now();try{Ie&&t.fs.readdirWithFileTypes?S=await t.fs.readdirWithFileTypes(y):E=await t.fs.readdir(y)}catch(D){let A=Le(D);if(A===null)throw D;X=A,p.readdirCalls++,p.readdirTime+=Date.now()-W}if(S!==null){O.checkpoint(),O.discover(S.length),E=[];for(let D of S)E.push(D.name);if(p.readdirCalls++,p.readdirTime+=Date.now()-W,H)for(let D=0;D<S.length;D++){let A=S[D];T.push({path:y==="/"?`/${A.name}`:`${y}/${A.name}`,depth:C+1,typeInfo:{isFile:A.isFile,isDirectory:A.isDirectory},resultIndex:D})}}else if(E!==null&&(O.checkpoint(),O.discover(E.length),p.readdirCalls++,p.readdirTime+=Date.now()-W,H))for(let D=0;D<E.length;D++){let A=E[D];T.push({path:y==="/"?`/${A}`:`${y}/${A}`,depth:C+1,resultIndex:D})}}let Y=x?(m?.size??0)===0:E!==null&&E.length===0,re=$;if(!l&&r!==null&&!$&&ue){let W=Date.now(),D={name:b,relativePath:w,isFile:x,isDirectory:g,isEmpty:Y,mtime:m?.mtime?.getTime()??Date.now(),size:m?.size??0,mode:m?.mode??420,newerRefTimes:ne};re=R(r,D).pruned,p.evalCalls++,p.evalTime+=Date.now()-W}return{relativePath:w,name:b,isFile:x,isDirectory:g,isEmpty:Y,stat:m,depth:C,children:re?[]:T,pruned:re,unreadable:X}}async function ke(){let h={effects:[]};if(l){let y=[],C=[{item:{path:f,depth:0,resultIndex:0},parentIndex:-1,childOrderInParent:0}],I=new Map,x=0;for(;x<C.length;){let g=Date.now(),m=Math.min(C.length,x+ve),b=C.slice(x,m);x=m;let w=await Promise.all(b.map(T=>P(T.item)));p.batchCount++,p.batchTime+=Date.now()-g;for(let T=0;T<b.length;T++){let S=w[T],E=b[T];if(!S)continue;let $=y.length;if(E.parentIndex>=0){let k=I.get(E.parentIndex)||[];k.push($),I.set(E.parentIndex,k)}y.push({node:S,parentIndex:E.parentIndex,childIndices:[]});for(let k=0;k<S.children.length;k++)C.push({item:S.children[k],parentIndex:$,childOrderInParent:k})}}for(let[g,m]of I)g>=0&&g<y.length&&(y[g].childIndices=m);if(y.length>0){let g=[{index:0,visited:!1}];for(;g.length>0;){O.checkpoint();let m=g.pop();if(!m)break;let b=y[m.index];if(b){if(m.visited){for(let w of z(b.node))h.effects.push(w);continue}g.push({index:m.index,visited:!0});for(let w=b.childIndices.length-1;w>=0;w--)g.push({index:b.childIndices[w],visited:!1})}}}}else{let y=new Map,C=0,I=[{item:{path:f,depth:0,resultIndex:0},orderIndex:C++}],x=new Map,g=0;for(;g<I.length;){let b=Date.now(),w=Math.min(I.length,g+ve),T=I.slice(g,w);g=w;let S=await Promise.all(T.map(async({item:E,orderIndex:$})=>{let k=await P(E);return k?{node:k,orderIndex:$}:null}));p.batchCount++,p.batchTime+=Date.now()-b;for(let E of S){if(!E)continue;let{node:$,orderIndex:k}=E,H=z($);if(H.length>0&&y.set(k,H),$.children.length>0){let K=[];for(let X of $.children){let Y=C++;K.push(Y),I.push({item:X,orderIndex:Y})}x.set(k,K)}}}let m=[0];for(;m.length>0;){O.checkpoint();let b=m.pop();if(b===void 0)break;let w=y.get(b);if(w)for(let S of w)h.effects.push(S);let T=x.get(b);if(T)for(let S=T.length-1;S>=0;S--)m.push(T[S])}}return h}let pe=await ke();for(let h of pe.effects)N.push(h);if(t.trace){let h=Date.now()-v;Fe(t.trace,p,h),t.trace({category:"find",name:"searchPath",durationMs:h,details:{path:c,resultsFound:pe.effects.filter(y=>y.action.type!=="diagnostic").length}})}}let se=new Map;for(let c of N){let{action:f,path:p}=c;switch(f.type){case"diagnostic":q(f.message),F=1;break;case"print":G(`${p}
|
|
15
|
+
`);break;case"print0":G(`${p}\0`);break;case"printf":G(Ae(f.format,c.printfData));break;case"delete":{let v=t.fs.resolvePath(t.cwd,p);try{await t.fs.rm(v,{recursive:!1})}catch(P){let z=P instanceof Error?P.message:String(P);q(`find: cannot delete '${p}': ${z}
|
|
16
|
+
`),F=1}break}case"exec":{if(!t.exec)return{stdout:"",stderr:`find: -exec not supported in this context
|
|
17
|
+
`,exitCode:1};if(f.batchMode){let z=se.get(f)??[];z.push(p),se.set(f,z);break}let v=f.command.map(z=>z==="{}"?p:z),P=await t.exec(oe([v[0]]),{cwd:t.cwd,signal:t.signal,args:v.slice(1)});M?M.appendResult(P):(G(P.stdout),q(P.stderr)),P.exitCode!==0&&(F=P.exitCode);break}}}for(let[c,f]of se){if(c.type!=="exec"||!t.exec||f.length===0)continue;let p=[];for(let P of c.command)P==="{}"?p.push(...f):p.push(P);let v=await t.exec(oe([p[0]]),{cwd:t.cwd,signal:t.signal,args:p.slice(1)});M?M.appendResult(v):(G(v.stdout),q(v.stderr)),v.exitCode!==0&&(F=v.exitCode)}return M?.build(F)??{stdout:V.join(""),stderr:fe.join(""),exitCode:F}}};function te(e){return e?e.type==="action"?[e.action]:e.type==="not"?te(e.expr):e.type==="and"||e.type==="or"?[...te(e.left),...te(e.right)]:[]:[]}function Ae(e,t){let n=me(e),s="",a=0;for(;a<n.length;)if(n[a]==="%"&&a+1<n.length){if(a++,n[a]==="%"){s+="%",a++;continue}let[l,d,r]=he(n,a);if(a+=r,a>=n.length){s+="%";break}let i=n[a],o;switch(i){case"f":o=t.name,a++;break;case"h":{let u=t.path.lastIndexOf("/");o=u>0?t.path.slice(0,u):".",a++;break}case"p":o=t.path,a++;break;case"P":{let u=t.startingPoint;t.path===u?o="":t.path.startsWith(`${u}/`)?o=t.path.slice(u.length+1):u==="."&&t.path.startsWith("./")?o=t.path.slice(2):o=t.path,a++;break}case"s":o=String(t.size),a++;break;case"d":o=String(t.depth),a++;break;case"m":o=(t.mode&511).toString(8),a++;break;case"M":o=be(t.mode,t.isDirectory),a++;break;case"t":{let u=new Date(t.mtime);o=Oe(u),a++;break}case"T":{if(a+1<n.length){let u=n[a+1],N=new Date(t.mtime);o=Be(N,u),a+=2}else o="%T",a++;break}default:s+=`%${l!==0||d!==-1?`${l}.${d}`:""}${i}`,a++;continue}s+=de(o,l,d)}else s+=n[a],a++;return s}function Oe(e){let t=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],s=t[e.getDay()],a=n[e.getMonth()],l=String(e.getDate()).padStart(2," "),d=String(e.getHours()).padStart(2,"0"),r=String(e.getMinutes()).padStart(2,"0"),i=String(e.getSeconds()).padStart(2,"0"),o=e.getFullYear();return`${s} ${a} ${l} ${d}:${r}:${i} ${o}`}var We=new Map([["EACCES","Permission denied"],["EIO","Input/output error"],["ELOOP","Too many levels of symbolic links"],["ENAMETOOLONG","File name too long"],["ENOENT","No such file or directory"],["ENOTDIR","Not a directory"],["EPERM","Permission denied"]]);function Le(e){let t=typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="string"?e.code:e instanceof Error?/^(E[A-Z]+)\b/.exec(e.message)?.[1]:void 0;return t===void 0?null:We.get(t)??null}function Be(e,t){switch(t){case"@":return String(e.getTime()/1e3);case"Y":return String(e.getFullYear());case"m":return String(e.getMonth()+1).padStart(2,"0");case"d":return String(e.getDate()).padStart(2,"0");case"H":return String(e.getHours()).padStart(2,"0");case"M":return String(e.getMinutes()).padStart(2,"0");case"S":return String(e.getSeconds()).padStart(2,"0");case"T":return`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}:${String(e.getSeconds()).padStart(2,"0")}`;case"F":return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`;default:return`%T${t}`}}var st={name:"find",flags:[{flag:"-name",type:"value",valueHint:"pattern"},{flag:"-iname",type:"value",valueHint:"pattern"},{flag:"-type",type:"value",valueHint:"string"},{flag:"-maxdepth",type:"value",valueHint:"number"},{flag:"-mindepth",type:"value",valueHint:"number"},{flag:"-empty",type:"boolean"},{flag:"-print",type:"boolean"},{flag:"-print0",type:"boolean"}],needsFiles:!0};export{nt as a,st as b};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
+
import{e as X}from"./chunk-QKWMWSV3.js";import{d as I}from"./chunk-X45GP3AQ.js";import{l as W,m as Z}from"./chunk-LCP3IKI7.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};
|