@jerryan/just-bash 3.5.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 +308 -0
- package/LICENSE +201 -0
- package/README.md +827 -0
- package/dist/AGENTS.md +383 -0
- package/dist/Bash.d.ts +317 -0
- package/dist/abort-signals.d.ts +10 -0
- package/dist/agent-sandbox.d.ts +104 -0
- package/dist/ast/types.d.ts +612 -0
- package/dist/banned-patterns-test.d.ts +1 -0
- package/dist/bin/chunks/alias-3R4G6HQY.js +3 -0
- package/dist/bin/chunks/awk2-KO7ZE3P7.js +3 -0
- package/dist/bin/chunks/base64-TQ5KOCNW.js +3 -0
- package/dist/bin/chunks/basename-C4CRGDXP.js +3 -0
- package/dist/bin/chunks/bash-CFCBBWVH.js +3 -0
- package/dist/bin/chunks/cat-BQ7FQTN5.js +3 -0
- package/dist/bin/chunks/chmod-WYYTXGVB.js +3 -0
- package/dist/bin/chunks/chunk-23OI2XDJ.js +20 -0
- package/dist/bin/chunks/chunk-2ETT4ELS.js +4 -0
- package/dist/bin/chunks/chunk-2UV6ZFHK.js +4 -0
- package/dist/bin/chunks/chunk-2YLY6FJA.js +10 -0
- package/dist/bin/chunks/chunk-3FQBUEB6.js +3 -0
- package/dist/bin/chunks/chunk-3MRB66F4.js +3 -0
- package/dist/bin/chunks/chunk-3PCPQIUD.js +3 -0
- package/dist/bin/chunks/chunk-42AMF6EE.js +3 -0
- package/dist/bin/chunks/chunk-43E7AR6A.js +3 -0
- package/dist/bin/chunks/chunk-45DUHCXR.js +7 -0
- package/dist/bin/chunks/chunk-472JZJ2D.js +22 -0
- package/dist/bin/chunks/chunk-47IFMQYS.js +3 -0
- package/dist/bin/chunks/chunk-4JF56A3P.js +15 -0
- package/dist/bin/chunks/chunk-5SKEZPTU.js +12 -0
- package/dist/bin/chunks/chunk-67XYNGRV.js +9 -0
- package/dist/bin/chunks/chunk-6ESRNSO7.js +7 -0
- package/dist/bin/chunks/chunk-6KHZX4HU.js +12 -0
- package/dist/bin/chunks/chunk-7FGDUBSN.js +14 -0
- package/dist/bin/chunks/chunk-7JZKVC3F.js +2 -0
- package/dist/bin/chunks/chunk-7PPAWLUI.js +12 -0
- package/dist/bin/chunks/chunk-7PUOS2OO.js +143 -0
- package/dist/bin/chunks/chunk-7VWOECJ3.js +101 -0
- package/dist/bin/chunks/chunk-7WBCA2BB.js +3 -0
- package/dist/bin/chunks/chunk-AGKL4LDL.js +4 -0
- package/dist/bin/chunks/chunk-AI7JUA46.js +13 -0
- package/dist/bin/chunks/chunk-AJF3OBTR.js +4 -0
- package/dist/bin/chunks/chunk-B2DRBHGQ.js +3 -0
- package/dist/bin/chunks/chunk-B2GCIQI2.js +16 -0
- package/dist/bin/chunks/chunk-B6WWC6K3.js +9 -0
- package/dist/bin/chunks/chunk-BIJXTWZ4.js +3 -0
- package/dist/bin/chunks/chunk-CC2AQ6B7.js +15 -0
- package/dist/bin/chunks/chunk-CL7IYCGG.js +20 -0
- package/dist/bin/chunks/chunk-CMTQFWZK.js +5 -0
- package/dist/bin/chunks/chunk-CPKBPQ2C.js +3 -0
- package/dist/bin/chunks/chunk-DJAX3ZRG.js +8 -0
- package/dist/bin/chunks/chunk-DN2YCFOR.js +3 -0
- package/dist/bin/chunks/chunk-DYIBFLS3.js +17 -0
- package/dist/bin/chunks/chunk-DZAFUADN.js +36 -0
- package/dist/bin/chunks/chunk-F3UDTTI7.js +13 -0
- package/dist/bin/chunks/chunk-FHMIEBRM.js +6 -0
- package/dist/bin/chunks/chunk-FONAGXRJ.js +17 -0
- package/dist/bin/chunks/chunk-FPWHWWXO.js +8 -0
- package/dist/bin/chunks/chunk-FUT3X2GJ.js +9 -0
- package/dist/bin/chunks/chunk-G4AUMZUY.js +4 -0
- package/dist/bin/chunks/chunk-GA5TPRMF.js +34 -0
- package/dist/bin/chunks/chunk-GOWX7VPU.js +7 -0
- package/dist/bin/chunks/chunk-GQKQEK5N.js +11 -0
- package/dist/bin/chunks/chunk-GR4ZHKXI.js +3 -0
- package/dist/bin/chunks/chunk-HDWHYM2T.js +18 -0
- package/dist/bin/chunks/chunk-HQ63MFHG.js +34 -0
- package/dist/bin/chunks/chunk-HW2VJKFH.js +4 -0
- package/dist/bin/chunks/chunk-HWI42GQO.js +7 -0
- package/dist/bin/chunks/chunk-HZGHQZSY.js +10 -0
- package/dist/bin/chunks/chunk-I4IRHQDW.js +3 -0
- package/dist/bin/chunks/chunk-I57EACSL.js +3 -0
- package/dist/bin/chunks/chunk-JELR4642.js +21 -0
- package/dist/bin/chunks/chunk-JQM3DKCH.js +12 -0
- package/dist/bin/chunks/chunk-K27FY3ES.js +3 -0
- package/dist/bin/chunks/chunk-KG2KXL4Y.js +3 -0
- package/dist/bin/chunks/chunk-KI54R2QB.js +3 -0
- package/dist/bin/chunks/chunk-KP2UH5CJ.js +22 -0
- package/dist/bin/chunks/chunk-KUMHQGUR.js +3 -0
- package/dist/bin/chunks/chunk-LE2XKKGQ.js +7 -0
- package/dist/bin/chunks/chunk-LJQIAFWS.js +5 -0
- package/dist/bin/chunks/chunk-LXFMIXGA.js +3 -0
- package/dist/bin/chunks/chunk-M7SIPZZZ.js +22 -0
- package/dist/bin/chunks/chunk-MF3GVFLC.js +11 -0
- package/dist/bin/chunks/chunk-MROECM42.js +3 -0
- package/dist/bin/chunks/chunk-MUFNRCMY.js +24 -0
- package/dist/bin/chunks/chunk-MVBK66TR.js +22 -0
- package/dist/bin/chunks/chunk-MYTNZ7MA.js +7 -0
- package/dist/bin/chunks/chunk-N26Y42L6.js +10 -0
- package/dist/bin/chunks/chunk-NE4R2FVV.js +5 -0
- package/dist/bin/chunks/chunk-NLU5LALY.js +37 -0
- package/dist/bin/chunks/chunk-NXUXZWS5.js +7 -0
- package/dist/bin/chunks/chunk-O2BCKSMK.js +3 -0
- package/dist/bin/chunks/chunk-OLEQNRKX.js +8 -0
- package/dist/bin/chunks/chunk-OUQKFRVR.js +6 -0
- package/dist/bin/chunks/chunk-OXLC2WWX.js +26 -0
- package/dist/bin/chunks/chunk-OYXHOZZ4.js +15 -0
- package/dist/bin/chunks/chunk-PBOVSFTJ.js +3 -0
- package/dist/bin/chunks/chunk-PPVF2N6C.js +3 -0
- package/dist/bin/chunks/chunk-PQ2INDRF.js +87 -0
- package/dist/bin/chunks/chunk-PXP4YYZA.js +13 -0
- package/dist/bin/chunks/chunk-PZQVSQX6.js +4 -0
- package/dist/bin/chunks/chunk-Q2GOPGDA.js +6 -0
- package/dist/bin/chunks/chunk-Q3LE3Y66.js +13 -0
- package/dist/bin/chunks/chunk-QES5OSUC.js +3 -0
- package/dist/bin/chunks/chunk-QFTZKD5O.js +13 -0
- package/dist/bin/chunks/chunk-QL33F2W6.js +8 -0
- package/dist/bin/chunks/chunk-QMPZXXEK.js +8 -0
- package/dist/bin/chunks/chunk-QYZN33JA.js +3 -0
- package/dist/bin/chunks/chunk-R2J5MJOM.js +20 -0
- package/dist/bin/chunks/chunk-RPUFEP5O.js +65 -0
- package/dist/bin/chunks/chunk-RVPTAYDS.js +4 -0
- package/dist/bin/chunks/chunk-SC5TEGMM.js +12 -0
- package/dist/bin/chunks/chunk-SDGPS6XI.js +10 -0
- package/dist/bin/chunks/chunk-TW2IJRUF.js +3 -0
- package/dist/bin/chunks/chunk-TYBXHT6W.js +10 -0
- package/dist/bin/chunks/chunk-V2XF3TTW.js +276 -0
- package/dist/bin/chunks/chunk-V4U26ZWL.js +16 -0
- package/dist/bin/chunks/chunk-VTAMGD42.js +3 -0
- package/dist/bin/chunks/chunk-WAJVRK5B.js +16 -0
- package/dist/bin/chunks/chunk-WEHA3JFD.js +3 -0
- package/dist/bin/chunks/chunk-WFHYGSLJ.js +6 -0
- package/dist/bin/chunks/chunk-WFVCEB5T.js +3 -0
- package/dist/bin/chunks/chunk-YERKK5B3.js +4 -0
- package/dist/bin/chunks/chunk-YIANER7Y.js +8 -0
- package/dist/bin/chunks/chunk-YJ5OCPSK.js +7 -0
- package/dist/bin/chunks/chunk-YOIFOOGX.js +9 -0
- package/dist/bin/chunks/chunk-YQEKKZTU.js +12 -0
- package/dist/bin/chunks/chunk-YUZRUF5F.js +10 -0
- package/dist/bin/chunks/chunk-ZMGLTHSU.js +15 -0
- package/dist/bin/chunks/clear-OE52K3TM.js +3 -0
- package/dist/bin/chunks/column-AJFK3TWF.js +3 -0
- package/dist/bin/chunks/comm-URDMZCXL.js +3 -0
- package/dist/bin/chunks/cp-OMVKM35F.js +3 -0
- package/dist/bin/chunks/curl-NHNZ46BU.js +31 -0
- package/dist/bin/chunks/cut-42X6363P.js +3 -0
- package/dist/bin/chunks/date-6MQGVWDY.js +3 -0
- package/dist/bin/chunks/diff-YXZZCUSQ.js +3 -0
- package/dist/bin/chunks/dirname-TPUFCYF6.js +3 -0
- package/dist/bin/chunks/dist-5MWO25Y4.js +141 -0
- package/dist/bin/chunks/du-LUFPVLNW.js +3 -0
- package/dist/bin/chunks/echo-NYDCCFWB.js +3 -0
- package/dist/bin/chunks/env-2TSVF4W7.js +3 -0
- package/dist/bin/chunks/expand-IQRKKT7D.js +3 -0
- package/dist/bin/chunks/expr-NNMDHOCN.js +3 -0
- package/dist/bin/chunks/file-4T64QNLS.js +3 -0
- package/dist/bin/chunks/find-AWH2KOY7.js +3 -0
- package/dist/bin/chunks/flag-coverage-J2ZHA465.js +3 -0
- package/dist/bin/chunks/fold-YEY7X54W.js +3 -0
- package/dist/bin/chunks/grep-CVU5V66H.js +3 -0
- package/dist/bin/chunks/gzip-FDPA6EKG.js +3 -0
- package/dist/bin/chunks/head-QKVY3SIO.js +3 -0
- package/dist/bin/chunks/help-HVIDHJ6M.js +3 -0
- package/dist/bin/chunks/history-3HAU45KT.js +3 -0
- package/dist/bin/chunks/hostname-2I76DUQL.js +3 -0
- package/dist/bin/chunks/html-to-markdown-XUMA42ZC.js +3 -0
- package/dist/bin/chunks/join-34DX7YK5.js +3 -0
- package/dist/bin/chunks/jq-V7OTAVU5.js +3 -0
- package/dist/bin/chunks/js-exec-DJQLXWCS.js +99 -0
- package/dist/bin/chunks/js-exec-worker.js +4809 -0
- package/dist/bin/chunks/ln-B35EKC2Q.js +3 -0
- package/dist/bin/chunks/ls-Q6ZZ6SQ2.js +3 -0
- package/dist/bin/chunks/md5sum-Z6KAYGDK.js +3 -0
- package/dist/bin/chunks/mkdir-74BP5NTG.js +3 -0
- package/dist/bin/chunks/mv-76LAHXFR.js +3 -0
- package/dist/bin/chunks/nl-4IZRRT7U.js +3 -0
- package/dist/bin/chunks/od-2GXD4D5K.js +3 -0
- package/dist/bin/chunks/paste-DWWA3JTW.js +3 -0
- package/dist/bin/chunks/printf-YXCSED2H.js +3 -0
- package/dist/bin/chunks/pwd-YKLNXWZI.js +3 -0
- package/dist/bin/chunks/python3-JCJHSX4Z.js +14 -0
- package/dist/bin/chunks/readlink-EHXJNW62.js +3 -0
- package/dist/bin/chunks/rev-CZTQCNOZ.js +3 -0
- package/dist/bin/chunks/rg-PXNKNIMY.js +3 -0
- package/dist/bin/chunks/rm-3PLW4O4B.js +3 -0
- package/dist/bin/chunks/rmdir-7ZIVFZJX.js +3 -0
- package/dist/bin/chunks/sed-4LVDFHIJ.js +3 -0
- package/dist/bin/chunks/seq-X2EAOGV5.js +3 -0
- package/dist/bin/chunks/sha1sum-CATBXX76.js +3 -0
- package/dist/bin/chunks/sha256sum-YGSNBVY3.js +3 -0
- package/dist/bin/chunks/sleep-DVFE2GSF.js +3 -0
- package/dist/bin/chunks/sort-HBOCBBJQ.js +3 -0
- package/dist/bin/chunks/split-ZNNNHKSP.js +3 -0
- package/dist/bin/chunks/sqlite3-KP42NNIY.js +3 -0
- package/dist/bin/chunks/sqlite3-worker.js +1928 -0
- package/dist/bin/chunks/stat-LROLDXHH.js +3 -0
- package/dist/bin/chunks/strings-CNUK76JL.js +3 -0
- package/dist/bin/chunks/tac-DG4BMYM5.js +3 -0
- package/dist/bin/chunks/tail-UOTUV25D.js +3 -0
- package/dist/bin/chunks/tar-7HGZIMZD.js +3 -0
- package/dist/bin/chunks/tee-L4HKV5PD.js +3 -0
- package/dist/bin/chunks/time-LF7BTSK5.js +3 -0
- package/dist/bin/chunks/timeout-YGFHQJKX.js +3 -0
- package/dist/bin/chunks/touch-TVQAUQOG.js +3 -0
- package/dist/bin/chunks/tr-PVFO6FRY.js +3 -0
- package/dist/bin/chunks/tree-ZGP6NPGS.js +3 -0
- package/dist/bin/chunks/true-KFTJGQLQ.js +3 -0
- package/dist/bin/chunks/unexpand-JPOQORZF.js +3 -0
- package/dist/bin/chunks/uniq-JMHDIJXT.js +3 -0
- package/dist/bin/chunks/wc-3KLVOCI2.js +3 -0
- package/dist/bin/chunks/which-4TPGVSBZ.js +3 -0
- package/dist/bin/chunks/whoami-B5HDVKW6.js +3 -0
- package/dist/bin/chunks/worker.js +3330 -0
- package/dist/bin/chunks/xan-WW53ETXT.js +3 -0
- package/dist/bin/chunks/xan-view-PD26QEFN.js +3 -0
- package/dist/bin/chunks/xargs-4AMMXFXL.js +3 -0
- package/dist/bin/chunks/yq-MYZOS2WN.js +3 -0
- package/dist/bin/just-bash.js +858 -0
- package/dist/bin/shell/chunks/alias-3R4G6HQY.js +3 -0
- package/dist/bin/shell/chunks/awk2-KO7ZE3P7.js +3 -0
- package/dist/bin/shell/chunks/base64-TQ5KOCNW.js +3 -0
- package/dist/bin/shell/chunks/basename-C4CRGDXP.js +3 -0
- package/dist/bin/shell/chunks/bash-CFCBBWVH.js +3 -0
- package/dist/bin/shell/chunks/cat-BQ7FQTN5.js +3 -0
- package/dist/bin/shell/chunks/chmod-WYYTXGVB.js +3 -0
- package/dist/bin/shell/chunks/chunk-23OI2XDJ.js +20 -0
- package/dist/bin/shell/chunks/chunk-2ETT4ELS.js +4 -0
- package/dist/bin/shell/chunks/chunk-2UV6ZFHK.js +4 -0
- package/dist/bin/shell/chunks/chunk-2YLY6FJA.js +10 -0
- package/dist/bin/shell/chunks/chunk-3FQBUEB6.js +3 -0
- package/dist/bin/shell/chunks/chunk-3MRB66F4.js +3 -0
- package/dist/bin/shell/chunks/chunk-3PCPQIUD.js +3 -0
- package/dist/bin/shell/chunks/chunk-42AMF6EE.js +3 -0
- package/dist/bin/shell/chunks/chunk-43E7AR6A.js +3 -0
- package/dist/bin/shell/chunks/chunk-45DUHCXR.js +7 -0
- package/dist/bin/shell/chunks/chunk-472JZJ2D.js +22 -0
- package/dist/bin/shell/chunks/chunk-47IFMQYS.js +3 -0
- package/dist/bin/shell/chunks/chunk-4JF56A3P.js +15 -0
- package/dist/bin/shell/chunks/chunk-5SKEZPTU.js +12 -0
- package/dist/bin/shell/chunks/chunk-67XYNGRV.js +9 -0
- package/dist/bin/shell/chunks/chunk-6ESRNSO7.js +7 -0
- package/dist/bin/shell/chunks/chunk-6KHZX4HU.js +12 -0
- package/dist/bin/shell/chunks/chunk-7FGDUBSN.js +14 -0
- package/dist/bin/shell/chunks/chunk-7JZKVC3F.js +2 -0
- package/dist/bin/shell/chunks/chunk-7PPAWLUI.js +12 -0
- package/dist/bin/shell/chunks/chunk-7PUOS2OO.js +143 -0
- package/dist/bin/shell/chunks/chunk-7VWOECJ3.js +101 -0
- package/dist/bin/shell/chunks/chunk-7WBCA2BB.js +3 -0
- package/dist/bin/shell/chunks/chunk-AGKL4LDL.js +4 -0
- package/dist/bin/shell/chunks/chunk-AI7JUA46.js +13 -0
- package/dist/bin/shell/chunks/chunk-AJF3OBTR.js +4 -0
- package/dist/bin/shell/chunks/chunk-B2DRBHGQ.js +3 -0
- package/dist/bin/shell/chunks/chunk-B2GCIQI2.js +16 -0
- package/dist/bin/shell/chunks/chunk-B6WWC6K3.js +9 -0
- package/dist/bin/shell/chunks/chunk-BIJXTWZ4.js +3 -0
- package/dist/bin/shell/chunks/chunk-CC2AQ6B7.js +15 -0
- package/dist/bin/shell/chunks/chunk-CL7IYCGG.js +20 -0
- package/dist/bin/shell/chunks/chunk-CMTQFWZK.js +5 -0
- package/dist/bin/shell/chunks/chunk-CPKBPQ2C.js +3 -0
- package/dist/bin/shell/chunks/chunk-DJAX3ZRG.js +8 -0
- package/dist/bin/shell/chunks/chunk-DN2YCFOR.js +3 -0
- package/dist/bin/shell/chunks/chunk-DYIBFLS3.js +17 -0
- package/dist/bin/shell/chunks/chunk-DZAFUADN.js +36 -0
- package/dist/bin/shell/chunks/chunk-F3UDTTI7.js +13 -0
- package/dist/bin/shell/chunks/chunk-FHMIEBRM.js +6 -0
- package/dist/bin/shell/chunks/chunk-FONAGXRJ.js +17 -0
- package/dist/bin/shell/chunks/chunk-FPWHWWXO.js +8 -0
- package/dist/bin/shell/chunks/chunk-FUT3X2GJ.js +9 -0
- package/dist/bin/shell/chunks/chunk-G4AUMZUY.js +4 -0
- package/dist/bin/shell/chunks/chunk-GA5TPRMF.js +34 -0
- package/dist/bin/shell/chunks/chunk-GOWX7VPU.js +7 -0
- package/dist/bin/shell/chunks/chunk-GQKQEK5N.js +11 -0
- package/dist/bin/shell/chunks/chunk-GR4ZHKXI.js +3 -0
- package/dist/bin/shell/chunks/chunk-HDWHYM2T.js +18 -0
- package/dist/bin/shell/chunks/chunk-HQ63MFHG.js +34 -0
- package/dist/bin/shell/chunks/chunk-HW2VJKFH.js +4 -0
- package/dist/bin/shell/chunks/chunk-HWI42GQO.js +7 -0
- package/dist/bin/shell/chunks/chunk-HZGHQZSY.js +10 -0
- package/dist/bin/shell/chunks/chunk-I4IRHQDW.js +3 -0
- package/dist/bin/shell/chunks/chunk-I57EACSL.js +3 -0
- package/dist/bin/shell/chunks/chunk-JELR4642.js +21 -0
- package/dist/bin/shell/chunks/chunk-JQM3DKCH.js +12 -0
- package/dist/bin/shell/chunks/chunk-K27FY3ES.js +3 -0
- package/dist/bin/shell/chunks/chunk-KG2KXL4Y.js +3 -0
- package/dist/bin/shell/chunks/chunk-KI54R2QB.js +3 -0
- package/dist/bin/shell/chunks/chunk-KP2UH5CJ.js +22 -0
- package/dist/bin/shell/chunks/chunk-KUMHQGUR.js +3 -0
- package/dist/bin/shell/chunks/chunk-LE2XKKGQ.js +7 -0
- package/dist/bin/shell/chunks/chunk-LJQIAFWS.js +5 -0
- package/dist/bin/shell/chunks/chunk-LXFMIXGA.js +3 -0
- package/dist/bin/shell/chunks/chunk-M7SIPZZZ.js +22 -0
- package/dist/bin/shell/chunks/chunk-MF3GVFLC.js +11 -0
- package/dist/bin/shell/chunks/chunk-MROECM42.js +3 -0
- package/dist/bin/shell/chunks/chunk-MUFNRCMY.js +24 -0
- package/dist/bin/shell/chunks/chunk-MVBK66TR.js +22 -0
- package/dist/bin/shell/chunks/chunk-MYTNZ7MA.js +7 -0
- package/dist/bin/shell/chunks/chunk-N26Y42L6.js +10 -0
- package/dist/bin/shell/chunks/chunk-NE4R2FVV.js +5 -0
- package/dist/bin/shell/chunks/chunk-NLU5LALY.js +37 -0
- package/dist/bin/shell/chunks/chunk-NXUXZWS5.js +7 -0
- package/dist/bin/shell/chunks/chunk-O2BCKSMK.js +3 -0
- package/dist/bin/shell/chunks/chunk-OLEQNRKX.js +8 -0
- package/dist/bin/shell/chunks/chunk-OUQKFRVR.js +6 -0
- package/dist/bin/shell/chunks/chunk-OXLC2WWX.js +26 -0
- package/dist/bin/shell/chunks/chunk-OYXHOZZ4.js +15 -0
- package/dist/bin/shell/chunks/chunk-PBOVSFTJ.js +3 -0
- package/dist/bin/shell/chunks/chunk-PPVF2N6C.js +3 -0
- package/dist/bin/shell/chunks/chunk-PQ2INDRF.js +87 -0
- package/dist/bin/shell/chunks/chunk-PXP4YYZA.js +13 -0
- package/dist/bin/shell/chunks/chunk-PZQVSQX6.js +4 -0
- package/dist/bin/shell/chunks/chunk-Q2GOPGDA.js +6 -0
- package/dist/bin/shell/chunks/chunk-Q3LE3Y66.js +13 -0
- package/dist/bin/shell/chunks/chunk-QES5OSUC.js +3 -0
- package/dist/bin/shell/chunks/chunk-QFTZKD5O.js +13 -0
- package/dist/bin/shell/chunks/chunk-QL33F2W6.js +8 -0
- package/dist/bin/shell/chunks/chunk-QMPZXXEK.js +8 -0
- package/dist/bin/shell/chunks/chunk-QYZN33JA.js +3 -0
- package/dist/bin/shell/chunks/chunk-R2J5MJOM.js +20 -0
- package/dist/bin/shell/chunks/chunk-RPUFEP5O.js +65 -0
- package/dist/bin/shell/chunks/chunk-RVPTAYDS.js +4 -0
- package/dist/bin/shell/chunks/chunk-SC5TEGMM.js +12 -0
- package/dist/bin/shell/chunks/chunk-SDGPS6XI.js +10 -0
- package/dist/bin/shell/chunks/chunk-TW2IJRUF.js +3 -0
- package/dist/bin/shell/chunks/chunk-TYBXHT6W.js +10 -0
- package/dist/bin/shell/chunks/chunk-V2XF3TTW.js +276 -0
- package/dist/bin/shell/chunks/chunk-V4U26ZWL.js +16 -0
- package/dist/bin/shell/chunks/chunk-VTAMGD42.js +3 -0
- package/dist/bin/shell/chunks/chunk-WAJVRK5B.js +16 -0
- package/dist/bin/shell/chunks/chunk-WEHA3JFD.js +3 -0
- package/dist/bin/shell/chunks/chunk-WFHYGSLJ.js +6 -0
- package/dist/bin/shell/chunks/chunk-WFVCEB5T.js +3 -0
- package/dist/bin/shell/chunks/chunk-YERKK5B3.js +4 -0
- package/dist/bin/shell/chunks/chunk-YIANER7Y.js +8 -0
- package/dist/bin/shell/chunks/chunk-YJ5OCPSK.js +7 -0
- package/dist/bin/shell/chunks/chunk-YOIFOOGX.js +9 -0
- package/dist/bin/shell/chunks/chunk-YQEKKZTU.js +12 -0
- package/dist/bin/shell/chunks/chunk-YUZRUF5F.js +10 -0
- package/dist/bin/shell/chunks/chunk-ZMGLTHSU.js +15 -0
- package/dist/bin/shell/chunks/clear-OE52K3TM.js +3 -0
- package/dist/bin/shell/chunks/column-AJFK3TWF.js +3 -0
- package/dist/bin/shell/chunks/comm-URDMZCXL.js +3 -0
- package/dist/bin/shell/chunks/cp-OMVKM35F.js +3 -0
- package/dist/bin/shell/chunks/curl-NHNZ46BU.js +31 -0
- package/dist/bin/shell/chunks/cut-42X6363P.js +3 -0
- package/dist/bin/shell/chunks/date-6MQGVWDY.js +3 -0
- package/dist/bin/shell/chunks/diff-YXZZCUSQ.js +3 -0
- package/dist/bin/shell/chunks/dirname-TPUFCYF6.js +3 -0
- package/dist/bin/shell/chunks/dist-5MWO25Y4.js +141 -0
- package/dist/bin/shell/chunks/du-LUFPVLNW.js +3 -0
- package/dist/bin/shell/chunks/echo-NYDCCFWB.js +3 -0
- package/dist/bin/shell/chunks/env-2TSVF4W7.js +3 -0
- package/dist/bin/shell/chunks/expand-IQRKKT7D.js +3 -0
- package/dist/bin/shell/chunks/expr-NNMDHOCN.js +3 -0
- package/dist/bin/shell/chunks/file-4T64QNLS.js +3 -0
- package/dist/bin/shell/chunks/find-AWH2KOY7.js +3 -0
- package/dist/bin/shell/chunks/flag-coverage-J2ZHA465.js +3 -0
- package/dist/bin/shell/chunks/fold-YEY7X54W.js +3 -0
- package/dist/bin/shell/chunks/grep-CVU5V66H.js +3 -0
- package/dist/bin/shell/chunks/gzip-FDPA6EKG.js +3 -0
- package/dist/bin/shell/chunks/head-QKVY3SIO.js +3 -0
- package/dist/bin/shell/chunks/help-HVIDHJ6M.js +3 -0
- package/dist/bin/shell/chunks/history-3HAU45KT.js +3 -0
- package/dist/bin/shell/chunks/hostname-2I76DUQL.js +3 -0
- package/dist/bin/shell/chunks/html-to-markdown-XUMA42ZC.js +3 -0
- package/dist/bin/shell/chunks/join-34DX7YK5.js +3 -0
- package/dist/bin/shell/chunks/jq-V7OTAVU5.js +3 -0
- package/dist/bin/shell/chunks/js-exec-DJQLXWCS.js +99 -0
- package/dist/bin/shell/chunks/ln-B35EKC2Q.js +3 -0
- package/dist/bin/shell/chunks/ls-Q6ZZ6SQ2.js +3 -0
- package/dist/bin/shell/chunks/md5sum-Z6KAYGDK.js +3 -0
- package/dist/bin/shell/chunks/mkdir-74BP5NTG.js +3 -0
- package/dist/bin/shell/chunks/mv-76LAHXFR.js +3 -0
- package/dist/bin/shell/chunks/nl-4IZRRT7U.js +3 -0
- package/dist/bin/shell/chunks/od-2GXD4D5K.js +3 -0
- package/dist/bin/shell/chunks/paste-DWWA3JTW.js +3 -0
- package/dist/bin/shell/chunks/printf-YXCSED2H.js +3 -0
- package/dist/bin/shell/chunks/pwd-YKLNXWZI.js +3 -0
- package/dist/bin/shell/chunks/python3-JCJHSX4Z.js +14 -0
- package/dist/bin/shell/chunks/readlink-EHXJNW62.js +3 -0
- package/dist/bin/shell/chunks/rev-CZTQCNOZ.js +3 -0
- package/dist/bin/shell/chunks/rg-PXNKNIMY.js +3 -0
- package/dist/bin/shell/chunks/rm-3PLW4O4B.js +3 -0
- package/dist/bin/shell/chunks/rmdir-7ZIVFZJX.js +3 -0
- package/dist/bin/shell/chunks/sed-4LVDFHIJ.js +3 -0
- package/dist/bin/shell/chunks/seq-X2EAOGV5.js +3 -0
- package/dist/bin/shell/chunks/sha1sum-CATBXX76.js +3 -0
- package/dist/bin/shell/chunks/sha256sum-YGSNBVY3.js +3 -0
- package/dist/bin/shell/chunks/sleep-DVFE2GSF.js +3 -0
- package/dist/bin/shell/chunks/sort-HBOCBBJQ.js +3 -0
- package/dist/bin/shell/chunks/split-ZNNNHKSP.js +3 -0
- package/dist/bin/shell/chunks/sqlite3-KP42NNIY.js +3 -0
- package/dist/bin/shell/chunks/stat-LROLDXHH.js +3 -0
- package/dist/bin/shell/chunks/strings-CNUK76JL.js +3 -0
- package/dist/bin/shell/chunks/tac-DG4BMYM5.js +3 -0
- package/dist/bin/shell/chunks/tail-UOTUV25D.js +3 -0
- package/dist/bin/shell/chunks/tar-7HGZIMZD.js +3 -0
- package/dist/bin/shell/chunks/tee-L4HKV5PD.js +3 -0
- package/dist/bin/shell/chunks/time-LF7BTSK5.js +3 -0
- package/dist/bin/shell/chunks/timeout-YGFHQJKX.js +3 -0
- package/dist/bin/shell/chunks/touch-TVQAUQOG.js +3 -0
- package/dist/bin/shell/chunks/tr-PVFO6FRY.js +3 -0
- package/dist/bin/shell/chunks/tree-ZGP6NPGS.js +3 -0
- package/dist/bin/shell/chunks/true-KFTJGQLQ.js +3 -0
- package/dist/bin/shell/chunks/unexpand-JPOQORZF.js +3 -0
- package/dist/bin/shell/chunks/uniq-JMHDIJXT.js +3 -0
- package/dist/bin/shell/chunks/wc-3KLVOCI2.js +3 -0
- package/dist/bin/shell/chunks/which-4TPGVSBZ.js +3 -0
- package/dist/bin/shell/chunks/whoami-B5HDVKW6.js +3 -0
- package/dist/bin/shell/chunks/xan-WW53ETXT.js +3 -0
- package/dist/bin/shell/chunks/xan-view-PD26QEFN.js +3 -0
- package/dist/bin/shell/chunks/xargs-4AMMXFXL.js +3 -0
- package/dist/bin/shell/chunks/yq-MYZOS2WN.js +3 -0
- package/dist/bin/shell/shell.js +834 -0
- package/dist/bounded-builder.d.ts +37 -0
- package/dist/browser.d.ts +23 -0
- package/dist/bundle/browser.js +1576 -0
- package/dist/bundle/chunks/alias-T5TO5GWK.js +2 -0
- package/dist/bundle/chunks/awk2-W6BNZEJN.js +2 -0
- package/dist/bundle/chunks/base64-MHVQ5XHI.js +2 -0
- package/dist/bundle/chunks/basename-SJZQ5W65.js +2 -0
- package/dist/bundle/chunks/bash-HIEWVHJ2.js +2 -0
- package/dist/bundle/chunks/cat-VZBWBIJB.js +2 -0
- package/dist/bundle/chunks/chmod-WM2JFFQC.js +2 -0
- package/dist/bundle/chunks/chunk-24NLAR7R.js +36 -0
- package/dist/bundle/chunks/chunk-26GP3ACY.js +12 -0
- package/dist/bundle/chunks/chunk-2KNTH3KH.js +9 -0
- package/dist/bundle/chunks/chunk-2SMD2AUA.js +3 -0
- package/dist/bundle/chunks/chunk-2TSZPVPI.js +21 -0
- package/dist/bundle/chunks/chunk-2VWG4LDT.js +11 -0
- package/dist/bundle/chunks/chunk-3WASQYTF.js +11 -0
- package/dist/bundle/chunks/chunk-44YCJWNC.js +6 -0
- package/dist/bundle/chunks/chunk-4EDQZIAN.js +5 -0
- package/dist/bundle/chunks/chunk-4MJ7VJG4.js +21 -0
- package/dist/bundle/chunks/chunk-4MZPEZTU.js +3 -0
- package/dist/bundle/chunks/chunk-57LGFT4S.js +3 -0
- package/dist/bundle/chunks/chunk-5I5U6IYI.js +142 -0
- package/dist/bundle/chunks/chunk-6DDRR56B.js +33 -0
- package/dist/bundle/chunks/chunk-6QF3PCMO.js +8 -0
- package/dist/bundle/chunks/chunk-6RK4AAB7.js +21 -0
- package/dist/bundle/chunks/chunk-6WGIZV3E.js +13 -0
- package/dist/bundle/chunks/chunk-73JQKNZT.js +33 -0
- package/dist/bundle/chunks/chunk-7AISL3XV.js +12 -0
- package/dist/bundle/chunks/chunk-7EUWTCWK.js +2 -0
- package/dist/bundle/chunks/chunk-7IJWBG4I.js +2 -0
- package/dist/bundle/chunks/chunk-7O2RDO2R.js +14 -0
- package/dist/bundle/chunks/chunk-A4R2GWRF.js +9 -0
- package/dist/bundle/chunks/chunk-AGH5UJJI.js +4 -0
- package/dist/bundle/chunks/chunk-ANCQ4SCV.js +2 -0
- package/dist/bundle/chunks/chunk-ASE6AYV3.js +17 -0
- package/dist/bundle/chunks/chunk-AYSZ5MAE.js +2 -0
- package/dist/bundle/chunks/chunk-BKUWXPEM.js +2 -0
- package/dist/bundle/chunks/chunk-BRJERIF4.js +2 -0
- package/dist/bundle/chunks/chunk-DAKEIWT3.js +21 -0
- package/dist/bundle/chunks/chunk-DLL7UR66.js +2 -0
- package/dist/bundle/chunks/chunk-DMWNBCXJ.js +10 -0
- package/dist/bundle/chunks/chunk-DVSA72LH.js +2 -0
- package/dist/bundle/chunks/chunk-EJFBIRMD.js +6 -0
- package/dist/bundle/chunks/chunk-EZNS4GF7.js +9 -0
- package/dist/bundle/chunks/chunk-F6XU52K3.js +35 -0
- package/dist/bundle/chunks/chunk-FHC24QSK.js +7 -0
- package/dist/bundle/chunks/chunk-FIMF2TLE.js +20 -0
- package/dist/bundle/chunks/chunk-FOCWZZDE.js +2 -0
- package/dist/bundle/chunks/chunk-FQUVK4Q5.js +11 -0
- package/dist/bundle/chunks/chunk-FSJ6TTCC.js +19 -0
- package/dist/bundle/chunks/chunk-FT6ODGOU.js +2 -0
- package/dist/bundle/chunks/chunk-FTET43KM.js +2 -0
- package/dist/bundle/chunks/chunk-FX4RBUYU.js +5 -0
- package/dist/bundle/chunks/chunk-FZRQOL3C.js +7 -0
- package/dist/bundle/chunks/chunk-FZZL53S2.js +275 -0
- package/dist/bundle/chunks/chunk-GN6CQ3J4.js +2 -0
- package/dist/bundle/chunks/chunk-HDRAUQK2.js +2 -0
- package/dist/bundle/chunks/chunk-HP7HWZ2S.js +15 -0
- package/dist/bundle/chunks/chunk-HRIJVWZS.js +14 -0
- package/dist/bundle/chunks/chunk-HXWB4Z5X.js +7 -0
- package/dist/bundle/chunks/chunk-ICLA3MUR.js +3 -0
- package/dist/bundle/chunks/chunk-IXFQXNL4.js +7 -0
- package/dist/bundle/chunks/chunk-KIGPB52X.js +2 -0
- package/dist/bundle/chunks/chunk-L2UW7DWF.js +2 -0
- package/dist/bundle/chunks/chunk-LI6PTSPD.js +9 -0
- package/dist/bundle/chunks/chunk-LPJEKUCB.js +8 -0
- package/dist/bundle/chunks/chunk-LSLPJOYM.js +3 -0
- package/dist/bundle/chunks/chunk-LVDUF74R.js +7 -0
- package/dist/bundle/chunks/chunk-MLIO3BK2.js +7 -0
- package/dist/bundle/chunks/chunk-MQKGGNPS.js +16 -0
- package/dist/bundle/chunks/chunk-N3A4JVFJ.js +2 -0
- package/dist/bundle/chunks/chunk-NBNI7G66.js +8 -0
- package/dist/bundle/chunks/chunk-NCUTH6QL.js +2 -0
- package/dist/bundle/chunks/chunk-OQ7C4FYO.js +2 -0
- package/dist/bundle/chunks/chunk-P57S6Z6R.js +6 -0
- package/dist/bundle/chunks/chunk-PCPW54JH.js +7 -0
- package/dist/bundle/chunks/chunk-PJM5C3HZ.js +25 -0
- package/dist/bundle/chunks/chunk-PPEXVPHR.js +19 -0
- package/dist/bundle/chunks/chunk-Q4JSJ3KQ.js +4 -0
- package/dist/bundle/chunks/chunk-QAYAQNCG.js +23 -0
- package/dist/bundle/chunks/chunk-QHDBQA5N.js +9 -0
- package/dist/bundle/chunks/chunk-QIQMJJZ4.js +4 -0
- package/dist/bundle/chunks/chunk-QJ7OXJAZ.js +6 -0
- package/dist/bundle/chunks/chunk-QJFYYEFV.js +11 -0
- package/dist/bundle/chunks/chunk-R2FBRMDU.js +14 -0
- package/dist/bundle/chunks/chunk-ROAWFE6V.js +5 -0
- package/dist/bundle/chunks/chunk-RPKJJFGZ.js +14 -0
- package/dist/bundle/chunks/chunk-S3ENGQML.js +15 -0
- package/dist/bundle/chunks/chunk-SBBYKIYU.js +3 -0
- package/dist/bundle/chunks/chunk-SGX4WOAM.js +2 -0
- package/dist/bundle/chunks/chunk-SHKOQWO4.js +3 -0
- package/dist/bundle/chunks/chunk-SIOONII3.js +2 -0
- package/dist/bundle/chunks/chunk-STHBFACM.js +1 -0
- package/dist/bundle/chunks/chunk-SX2HC7SO.js +2 -0
- package/dist/bundle/chunks/chunk-T6DNSPYO.js +100 -0
- package/dist/bundle/chunks/chunk-TBVD66LC.js +10 -0
- package/dist/bundle/chunks/chunk-TDD4NFYE.js +2 -0
- package/dist/bundle/chunks/chunk-TVCZIH6M.js +8 -0
- package/dist/bundle/chunks/chunk-U4K5ZDWK.js +9 -0
- package/dist/bundle/chunks/chunk-UC76ZOWM.js +15 -0
- package/dist/bundle/chunks/chunk-UIJUTQPH.js +3 -0
- package/dist/bundle/chunks/chunk-ULXTDFQC.js +2 -0
- package/dist/bundle/chunks/chunk-UTKGYVUZ.js +7 -0
- package/dist/bundle/chunks/chunk-UUIYAOD4.js +2 -0
- package/dist/bundle/chunks/chunk-VJ6UXG2R.js +64 -0
- package/dist/bundle/chunks/chunk-W2Z6LYL6.js +11 -0
- package/dist/bundle/chunks/chunk-W5DWRFSU.js +2 -0
- package/dist/bundle/chunks/chunk-WN54B5NQ.js +12 -0
- package/dist/bundle/chunks/chunk-WNH3HOQA.js +2 -0
- package/dist/bundle/chunks/chunk-WXPNKIIH.js +2 -0
- package/dist/bundle/chunks/chunk-WZQNMEQW.js +2 -0
- package/dist/bundle/chunks/chunk-XV2V56NQ.js +12 -0
- package/dist/bundle/chunks/chunk-XVSR5HHH.js +6 -0
- package/dist/bundle/chunks/chunk-XXBIOG4R.js +5 -0
- package/dist/bundle/chunks/chunk-Y62SXZKJ.js +12 -0
- package/dist/bundle/chunks/chunk-YEYSCLSJ.js +3 -0
- package/dist/bundle/chunks/chunk-YJKHREBZ.js +11 -0
- package/dist/bundle/chunks/chunk-YUSFCOM7.js +2 -0
- package/dist/bundle/chunks/chunk-ZBUZKIPX.js +6 -0
- package/dist/bundle/chunks/chunk-ZDPFA4L3.js +6 -0
- package/dist/bundle/chunks/chunk-ZT3WF5R7.js +16 -0
- package/dist/bundle/chunks/chunk-ZXFELXJH.js +6 -0
- package/dist/bundle/chunks/clear-KPIUNI6K.js +2 -0
- package/dist/bundle/chunks/column-QJI65SH2.js +2 -0
- package/dist/bundle/chunks/comm-DTWKU2MC.js +2 -0
- package/dist/bundle/chunks/cp-2KZIPZJS.js +2 -0
- package/dist/bundle/chunks/curl-K4WT7UPN.js +30 -0
- package/dist/bundle/chunks/cut-FMDNVWQN.js +2 -0
- package/dist/bundle/chunks/date-7OEDRA27.js +2 -0
- package/dist/bundle/chunks/diff-CSARC7WF.js +2 -0
- package/dist/bundle/chunks/dirname-Z2ZMOOW2.js +2 -0
- package/dist/bundle/chunks/du-7AZCLKR6.js +2 -0
- package/dist/bundle/chunks/echo-PLLZYM2L.js +2 -0
- package/dist/bundle/chunks/env-VUUMB47B.js +2 -0
- package/dist/bundle/chunks/expand-J3VOSOMK.js +2 -0
- package/dist/bundle/chunks/expr-XSBELPAC.js +2 -0
- package/dist/bundle/chunks/file-URNAD6FQ.js +2 -0
- package/dist/bundle/chunks/find-END3EAHV.js +2 -0
- package/dist/bundle/chunks/flag-coverage-DPSAPFXA.js +2 -0
- package/dist/bundle/chunks/fold-QJBPHRFJ.js +2 -0
- package/dist/bundle/chunks/grep-4AYF3A5J.js +2 -0
- package/dist/bundle/chunks/gzip-RQOBR22H.js +2 -0
- package/dist/bundle/chunks/head-6UIPFWVJ.js +2 -0
- package/dist/bundle/chunks/help-QDDMBDU7.js +2 -0
- package/dist/bundle/chunks/history-3N762S3K.js +2 -0
- package/dist/bundle/chunks/hostname-CESD3CQR.js +2 -0
- package/dist/bundle/chunks/html-to-markdown-PE6BPRPA.js +2 -0
- package/dist/bundle/chunks/join-C2B6NGXH.js +2 -0
- package/dist/bundle/chunks/jq-NY7PCVMH.js +2 -0
- package/dist/bundle/chunks/js-exec-XKF2B7C3.js +98 -0
- package/dist/bundle/chunks/js-exec-worker.js +4809 -0
- package/dist/bundle/chunks/ln-OPY2ZVGQ.js +2 -0
- package/dist/bundle/chunks/ls-ZPXGZX63.js +2 -0
- package/dist/bundle/chunks/md5sum-JEDX55KS.js +2 -0
- package/dist/bundle/chunks/mkdir-WDDKK2P3.js +2 -0
- package/dist/bundle/chunks/mv-ZF6UBVRB.js +2 -0
- package/dist/bundle/chunks/nl-IELOWYJG.js +2 -0
- package/dist/bundle/chunks/od-Z4AIL3P4.js +2 -0
- package/dist/bundle/chunks/paste-ZNHNSRBW.js +2 -0
- package/dist/bundle/chunks/printf-B2NSYQ3N.js +2 -0
- package/dist/bundle/chunks/pwd-76BPYV5F.js +2 -0
- package/dist/bundle/chunks/python3-F5S5TYGS.js +13 -0
- package/dist/bundle/chunks/readlink-U5OM5A3M.js +2 -0
- package/dist/bundle/chunks/rev-EPOS3MFH.js +2 -0
- package/dist/bundle/chunks/rg-NAMXBYKS.js +2 -0
- package/dist/bundle/chunks/rm-JQ4GDKDD.js +2 -0
- package/dist/bundle/chunks/rmdir-YJKPQVCK.js +2 -0
- package/dist/bundle/chunks/sed-LIRH26EA.js +2 -0
- package/dist/bundle/chunks/seq-B6KDLMYQ.js +2 -0
- package/dist/bundle/chunks/sha1sum-BLPZJ6MP.js +2 -0
- package/dist/bundle/chunks/sha256sum-VJZ4PHQ4.js +2 -0
- package/dist/bundle/chunks/sleep-PPRBTSVR.js +2 -0
- package/dist/bundle/chunks/sort-CB5GO7XH.js +2 -0
- package/dist/bundle/chunks/split-JICLAMP6.js +2 -0
- package/dist/bundle/chunks/sqlite3-4EZ4GXVD.js +2 -0
- package/dist/bundle/chunks/sqlite3-worker.js +1928 -0
- package/dist/bundle/chunks/stat-LXFZND2P.js +2 -0
- package/dist/bundle/chunks/strings-VLFTYX2Z.js +2 -0
- package/dist/bundle/chunks/tac-YXC4HBTR.js +2 -0
- package/dist/bundle/chunks/tail-UBGSN4JF.js +2 -0
- package/dist/bundle/chunks/tar-B72KU357.js +2 -0
- package/dist/bundle/chunks/tee-OOWSWHRQ.js +2 -0
- package/dist/bundle/chunks/time-NERE2JJ2.js +2 -0
- package/dist/bundle/chunks/timeout-C6WDYPLV.js +2 -0
- package/dist/bundle/chunks/touch-W4DF6Z4T.js +2 -0
- package/dist/bundle/chunks/tr-UI2LA3GA.js +2 -0
- package/dist/bundle/chunks/tree-7OOL2MH6.js +2 -0
- package/dist/bundle/chunks/true-QUBPEGGU.js +2 -0
- package/dist/bundle/chunks/unexpand-YD5BWFH4.js +2 -0
- package/dist/bundle/chunks/uniq-PAEPA27E.js +2 -0
- package/dist/bundle/chunks/wc-7WVM7GV4.js +2 -0
- package/dist/bundle/chunks/which-UWVKETYW.js +2 -0
- package/dist/bundle/chunks/whoami-KR6E7UIR.js +2 -0
- package/dist/bundle/chunks/worker.js +3330 -0
- package/dist/bundle/chunks/xan-UIGVJCMA.js +2 -0
- package/dist/bundle/chunks/xan-view-FOCYCKZQ.js +2 -0
- package/dist/bundle/chunks/xargs-VQEXRD3C.js +2 -0
- package/dist/bundle/chunks/yq-FGNXZCGX.js +2 -0
- package/dist/bundle/index.cjs +2237 -0
- package/dist/bundle/index.js +809 -0
- package/dist/commands/alias/alias.d.ts +6 -0
- package/dist/commands/awk/ast.d.ts +202 -0
- package/dist/commands/awk/awk2.d.ts +9 -0
- package/dist/commands/awk/builtins.d.ts +17 -0
- package/dist/commands/awk/interpreter/context.d.ts +88 -0
- package/dist/commands/awk/interpreter/expressions.d.ts +17 -0
- package/dist/commands/awk/interpreter/fields.d.ts +25 -0
- package/dist/commands/awk/interpreter/index.d.ts +8 -0
- package/dist/commands/awk/interpreter/interpreter.d.ts +54 -0
- package/dist/commands/awk/interpreter/statements.d.ts +11 -0
- package/dist/commands/awk/interpreter/type-coercion.d.ts +32 -0
- package/dist/commands/awk/interpreter/types.d.ts +13 -0
- package/dist/commands/awk/interpreter/variables.d.ts +35 -0
- package/dist/commands/awk/lexer.d.ts +101 -0
- package/dist/commands/awk/parser2-print.d.ts +38 -0
- package/dist/commands/awk/parser2.d.ts +96 -0
- package/dist/commands/base64/base64.d.ts +7 -0
- package/dist/commands/basename/basename.d.ts +4 -0
- package/dist/commands/bash/bash.d.ts +6 -0
- package/dist/commands/browser-excluded.d.ts +16 -0
- package/dist/commands/cat/cat.d.ts +4 -0
- package/dist/commands/chmod/chmod.d.ts +4 -0
- package/dist/commands/clear/clear.d.ts +4 -0
- package/dist/commands/column/column.d.ts +11 -0
- package/dist/commands/comm/comm.d.ts +12 -0
- package/dist/commands/compression/codec-budget.d.ts +35 -0
- package/dist/commands/cp/cp.d.ts +4 -0
- package/dist/commands/curl/curl.d.ts +8 -0
- package/dist/commands/curl/form.d.ts +23 -0
- package/dist/commands/curl/help.d.ts +9 -0
- package/dist/commands/curl/parse.d.ts +9 -0
- package/dist/commands/curl/response-formatting.d.ts +20 -0
- package/dist/commands/curl/types.d.ts +70 -0
- package/dist/commands/cut/cut.d.ts +4 -0
- package/dist/commands/date/date.d.ts +7 -0
- package/dist/commands/diff/diff.d.ts +7 -0
- package/dist/commands/dirname/dirname.d.ts +4 -0
- package/dist/commands/du/du.d.ts +4 -0
- package/dist/commands/duration.d.ts +5 -0
- package/dist/commands/echo/echo.d.ts +4 -0
- package/dist/commands/env/env.d.ts +6 -0
- package/dist/commands/expand/expand.d.ts +12 -0
- package/dist/commands/expand/unexpand.d.ts +12 -0
- package/dist/commands/expr/expr.d.ts +9 -0
- package/dist/commands/file/file.d.ts +9 -0
- package/dist/commands/find/find.d.ts +4 -0
- package/dist/commands/find/matcher.d.ts +53 -0
- package/dist/commands/find/parser.d.ts +2 -0
- package/dist/commands/find/types.d.ts +89 -0
- package/dist/commands/flag-coverage.d.ts +2 -0
- package/dist/commands/fold/fold.d.ts +12 -0
- package/dist/commands/format-mode.d.ts +4 -0
- package/dist/commands/fuzz-flags-types.d.ts +17 -0
- package/dist/commands/fuzz-flags.d.ts +8 -0
- package/dist/commands/grep/grep.d.ts +8 -0
- package/dist/commands/gzip/gzip.d.ts +13 -0
- package/dist/commands/head/head-tail-shared.d.ts +38 -0
- package/dist/commands/head/head.d.ts +4 -0
- package/dist/commands/help/help.d.ts +4 -0
- package/dist/commands/help.d.ts +16 -0
- package/dist/commands/history/history.d.ts +4 -0
- package/dist/commands/hostname/hostname.d.ts +11 -0
- package/dist/commands/html-to-markdown/html-to-markdown.d.ts +9 -0
- package/dist/commands/join/join.d.ts +12 -0
- package/dist/commands/jq/jq.d.ts +9 -0
- package/dist/commands/js-exec/fetch-polyfill.d.ts +6 -0
- package/dist/commands/js-exec/js-exec-worker.d.ts +33 -0
- package/dist/commands/js-exec/js-exec.d.ts +13 -0
- package/dist/commands/js-exec/module-shims.d.ts +29 -0
- package/dist/commands/js-exec/path-polyfill.d.ts +6 -0
- package/dist/commands/ln/ln.d.ts +4 -0
- package/dist/commands/ls/ls.d.ts +4 -0
- package/dist/commands/md5sum/checksum.d.ts +7 -0
- package/dist/commands/md5sum/md5sum.d.ts +4 -0
- package/dist/commands/md5sum/sha1sum.d.ts +4 -0
- package/dist/commands/md5sum/sha256sum.d.ts +4 -0
- package/dist/commands/mkdir/mkdir.d.ts +4 -0
- package/dist/commands/mv/mv.d.ts +4 -0
- package/dist/commands/nl/nl.d.ts +12 -0
- package/dist/commands/od/od.d.ts +12 -0
- package/dist/commands/paste/paste.d.ts +4 -0
- package/dist/commands/printf/escapes.d.ts +27 -0
- package/dist/commands/printf/printf.d.ts +4 -0
- package/dist/commands/printf/strftime.d.ts +14 -0
- package/dist/commands/pwd/pwd.d.ts +4 -0
- package/dist/commands/python3/python3.d.ts +16 -0
- package/dist/commands/python3/worker.d.ts +31 -0
- package/dist/commands/query-engine/builtins/array-builtins.d.ts +20 -0
- package/dist/commands/query-engine/builtins/control-builtins.d.ts +18 -0
- package/dist/commands/query-engine/builtins/date-builtins.d.ts +15 -0
- package/dist/commands/query-engine/builtins/format-builtins.d.ts +11 -0
- package/dist/commands/query-engine/builtins/index-builtins.d.ts +16 -0
- package/dist/commands/query-engine/builtins/index.d.ts +17 -0
- package/dist/commands/query-engine/builtins/math-builtins.d.ts +15 -0
- package/dist/commands/query-engine/builtins/navigation-builtins.d.ts +18 -0
- package/dist/commands/query-engine/builtins/object-builtins.d.ts +15 -0
- package/dist/commands/query-engine/builtins/path-builtins.d.ts +20 -0
- package/dist/commands/query-engine/builtins/sql-builtins.d.ts +16 -0
- package/dist/commands/query-engine/builtins/string-builtins.d.ts +15 -0
- package/dist/commands/query-engine/builtins/type-builtins.d.ts +11 -0
- package/dist/commands/query-engine/evaluator.d.ts +62 -0
- package/dist/commands/query-engine/index.d.ts +8 -0
- package/dist/commands/query-engine/json-output.d.ts +11 -0
- package/dist/commands/query-engine/parser-types.d.ts +171 -0
- package/dist/commands/query-engine/parser.d.ts +14 -0
- package/dist/commands/query-engine/path-operations.d.ts +15 -0
- package/dist/commands/query-engine/safe-object.d.ts +84 -0
- package/dist/commands/query-engine/value-operations.d.ts +44 -0
- package/dist/commands/readlink/readlink.d.ts +4 -0
- package/dist/commands/registry.d.ts +56 -0
- package/dist/commands/rev/rev.d.ts +13 -0
- package/dist/commands/rg/file-types.d.ts +49 -0
- package/dist/commands/rg/gitignore.d.ts +98 -0
- package/dist/commands/rg/rg-options.d.ts +61 -0
- package/dist/commands/rg/rg-parser.d.ts +20 -0
- package/dist/commands/rg/rg-search.d.ts +15 -0
- package/dist/commands/rg/rg.d.ts +14 -0
- package/dist/commands/rm/rm.d.ts +4 -0
- package/dist/commands/rmdir/rmdir.d.ts +4 -0
- package/dist/commands/search-engine/index.d.ts +10 -0
- package/dist/commands/search-engine/matcher.d.ts +72 -0
- package/dist/commands/search-engine/regex.d.ts +46 -0
- package/dist/commands/sed/executor.d.ts +7 -0
- package/dist/commands/sed/lexer.d.ts +88 -0
- package/dist/commands/sed/parser.d.ts +21 -0
- package/dist/commands/sed/sed-regex.d.ts +23 -0
- package/dist/commands/sed/sed.d.ts +4 -0
- package/dist/commands/sed/types.d.ts +216 -0
- package/dist/commands/seq/seq.d.ts +16 -0
- package/dist/commands/sleep/sleep.d.ts +4 -0
- package/dist/commands/sort/comparator.d.ts +9 -0
- package/dist/commands/sort/parser.d.ts +11 -0
- package/dist/commands/sort/sort.d.ts +4 -0
- package/dist/commands/sort/types.d.ts +30 -0
- package/dist/commands/split/split.d.ts +12 -0
- package/dist/commands/sqlite3/formatters.d.ts +17 -0
- package/dist/commands/sqlite3/sqlite3.d.ts +24 -0
- package/dist/commands/sqlite3/worker.d.ts +50 -0
- package/dist/commands/sqlite3/worker.js +1928 -0
- package/dist/commands/stat/stat.d.ts +4 -0
- package/dist/commands/strings/strings.d.ts +12 -0
- package/dist/commands/tac/tac.d.ts +11 -0
- package/dist/commands/tail/tail.d.ts +4 -0
- package/dist/commands/tar/archive.d.ts +150 -0
- package/dist/commands/tar/bzip2-compress.d.ts +18 -0
- package/dist/commands/tar/tar-options.d.ts +37 -0
- package/dist/commands/tar/tar.d.ts +10 -0
- package/dist/commands/tee/tee.d.ts +4 -0
- package/dist/commands/time/time.d.ts +27 -0
- package/dist/commands/timeout/timeout.d.ts +4 -0
- package/dist/commands/touch/touch.d.ts +4 -0
- package/dist/commands/tr/tr.d.ts +4 -0
- package/dist/commands/tree/tree.d.ts +4 -0
- package/dist/commands/true/true.d.ts +6 -0
- package/dist/commands/uniq/uniq.d.ts +4 -0
- package/dist/commands/wc/wc.d.ts +4 -0
- package/dist/commands/which/which.d.ts +4 -0
- package/dist/commands/whoami/whoami.d.ts +11 -0
- package/dist/commands/worker-bridge/bridge-handler.d.ts +73 -0
- package/dist/commands/worker-bridge/protocol.d.ts +141 -0
- package/dist/commands/worker-bridge/sync-backend.d.ts +86 -0
- package/dist/commands/worker-request-controller.d.ts +36 -0
- package/dist/commands/xan/aggregation.d.ts +30 -0
- package/dist/commands/xan/bounded-output.d.ts +4 -0
- package/dist/commands/xan/column-selection.d.ts +20 -0
- package/dist/commands/xan/csv.d.ts +62 -0
- package/dist/commands/xan/moonblade-parser.d.ts +89 -0
- package/dist/commands/xan/moonblade-to-jq.d.ts +12 -0
- package/dist/commands/xan/moonblade-tokenizer.d.ts +32 -0
- package/dist/commands/xan/subcommands.d.ts +15 -0
- package/dist/commands/xan/xan-agg.d.ts +8 -0
- package/dist/commands/xan/xan-columns.d.ts +8 -0
- package/dist/commands/xan/xan-core.d.ts +10 -0
- package/dist/commands/xan/xan-data.d.ts +52 -0
- package/dist/commands/xan/xan-filter.d.ts +8 -0
- package/dist/commands/xan/xan-map.d.ts +11 -0
- package/dist/commands/xan/xan-reshape.d.ts +40 -0
- package/dist/commands/xan/xan-simple.d.ts +40 -0
- package/dist/commands/xan/xan-view.d.ts +12 -0
- package/dist/commands/xan/xan.d.ts +10 -0
- package/dist/commands/xargs/xargs.d.ts +4 -0
- package/dist/commands/yq/formats.d.ts +65 -0
- package/dist/commands/yq/yq.d.ts +13 -0
- package/dist/custom-commands.d.ts +65 -0
- package/dist/encoding.d.ts +131 -0
- package/dist/execution-output.d.ts +28 -0
- package/dist/execution-scope.d.ts +110 -0
- package/dist/fatal-execution-error.d.ts +27 -0
- package/dist/fs/encoding.d.ts +17 -0
- package/dist/fs/identity.d.ts +9 -0
- package/dist/fs/in-memory-fs/in-memory-fs.d.ts +98 -0
- package/dist/fs/in-memory-fs/index.d.ts +1 -0
- package/dist/fs/init.d.ts +22 -0
- package/dist/fs/interface.d.ts +255 -0
- package/dist/fs/mountable-fs/index.d.ts +1 -0
- package/dist/fs/mountable-fs/mountable-fs.d.ts +118 -0
- package/dist/fs/overlay-fs/apply.d.ts +22 -0
- package/dist/fs/overlay-fs/index.d.ts +1 -0
- package/dist/fs/overlay-fs/overlay-fs.d.ts +360 -0
- package/dist/fs/overlay-fs/overlay-tree.d.ts +188 -0
- package/dist/fs/path-utils.d.ts +48 -0
- package/dist/fs/read-write-fs/index.d.ts +1 -0
- package/dist/fs/read-write-fs/read-write-fs.d.ts +150 -0
- package/dist/fs/real-fs-utils.d.ts +90 -0
- package/dist/fs/sanitize-error.d.ts +19 -0
- package/dist/fs/traversal.d.ts +98 -0
- package/dist/index.d.cts +30 -0
- package/dist/index.d.ts +30 -0
- package/dist/interpreter/alias-expansion.d.ts +27 -0
- package/dist/interpreter/arithmetic.d.ts +24 -0
- package/dist/interpreter/assignment-expansion.d.ts +24 -0
- package/dist/interpreter/builtin-dispatch.d.ts +46 -0
- package/dist/interpreter/builtins/break.d.ts +6 -0
- package/dist/interpreter/builtins/cd.d.ts +6 -0
- package/dist/interpreter/builtins/compgen.d.ts +26 -0
- package/dist/interpreter/builtins/complete.d.ts +17 -0
- package/dist/interpreter/builtins/compopt.d.ts +28 -0
- package/dist/interpreter/builtins/continue.d.ts +6 -0
- package/dist/interpreter/builtins/declare-array-parsing.d.ts +18 -0
- package/dist/interpreter/builtins/declare-print.d.ts +39 -0
- package/dist/interpreter/builtins/declare.d.ts +35 -0
- package/dist/interpreter/builtins/dirs.d.ts +29 -0
- package/dist/interpreter/builtins/eval.d.ts +15 -0
- package/dist/interpreter/builtins/exit.d.ts +5 -0
- package/dist/interpreter/builtins/export.d.ts +14 -0
- package/dist/interpreter/builtins/getopts.d.ts +18 -0
- package/dist/interpreter/builtins/hash.d.ts +19 -0
- package/dist/interpreter/builtins/help.d.ts +12 -0
- package/dist/interpreter/builtins/index.d.ts +44 -0
- package/dist/interpreter/builtins/let.d.ts +18 -0
- package/dist/interpreter/builtins/local.d.ts +6 -0
- package/dist/interpreter/builtins/mapfile.d.ts +17 -0
- package/dist/interpreter/builtins/read.d.ts +6 -0
- package/dist/interpreter/builtins/return.d.ts +6 -0
- package/dist/interpreter/builtins/set.d.ts +9 -0
- package/dist/interpreter/builtins/shift.d.ts +15 -0
- package/dist/interpreter/builtins/shopt.d.ts +7 -0
- package/dist/interpreter/builtins/source.d.ts +6 -0
- package/dist/interpreter/builtins/unset.d.ts +16 -0
- package/dist/interpreter/builtins/variable-assignment.d.ts +69 -0
- package/dist/interpreter/command-analysis.d.ts +30 -0
- package/dist/interpreter/command-resolution.d.ts +43 -0
- package/dist/interpreter/conditionals.d.ts +17 -0
- package/dist/interpreter/control-flow.d.ts +21 -0
- package/dist/interpreter/defense-aware-command-context.d.ts +6 -0
- package/dist/interpreter/errors.d.ts +161 -0
- package/dist/interpreter/expansion/analysis.d.ts +37 -0
- package/dist/interpreter/expansion/arith-text-expansion.d.ts +20 -0
- package/dist/interpreter/expansion/array-pattern-ops.d.ts +21 -0
- package/dist/interpreter/expansion/array-prefix-suffix.d.ts +46 -0
- package/dist/interpreter/expansion/array-slice-transform.d.ts +36 -0
- package/dist/interpreter/expansion/array-word-expansion.d.ts +39 -0
- package/dist/interpreter/expansion/brace-range.d.ts +24 -0
- package/dist/interpreter/expansion/command-substitution.d.ts +23 -0
- package/dist/interpreter/expansion/glob-escape.d.ts +32 -0
- package/dist/interpreter/expansion/indirect-expansion.d.ts +42 -0
- package/dist/interpreter/expansion/parameter-ops.d.ts +113 -0
- package/dist/interpreter/expansion/pattern-expansion.d.ts +23 -0
- package/dist/interpreter/expansion/pattern-removal.d.ts +17 -0
- package/dist/interpreter/expansion/pattern-replacement.d.ts +4 -0
- package/dist/interpreter/expansion/pattern.d.ts +23 -0
- package/dist/interpreter/expansion/positional-params.d.ts +59 -0
- package/dist/interpreter/expansion/prompt.d.ts +39 -0
- package/dist/interpreter/expansion/quoting.d.ts +13 -0
- package/dist/interpreter/expansion/tilde.d.ts +14 -0
- package/dist/interpreter/expansion/unquoted-expansion.d.ts +76 -0
- package/dist/interpreter/expansion/variable-attrs.d.ts +19 -0
- package/dist/interpreter/expansion/variable.d.ts +36 -0
- package/dist/interpreter/expansion/word-glob-expansion.d.ts +33 -0
- package/dist/interpreter/expansion/word-split.d.ts +29 -0
- package/dist/interpreter/expansion.d.ts +53 -0
- package/dist/interpreter/fd-table.d.ts +130 -0
- package/dist/interpreter/functions.d.ts +14 -0
- package/dist/interpreter/helpers/array.d.ts +56 -0
- package/dist/interpreter/helpers/bounded-array.d.ts +2 -0
- package/dist/interpreter/helpers/condition.d.ts +19 -0
- package/dist/interpreter/helpers/errors.d.ts +8 -0
- package/dist/interpreter/helpers/file-tests.d.ts +33 -0
- package/dist/interpreter/helpers/ifs.d.ts +104 -0
- package/dist/interpreter/helpers/loop.d.ts +24 -0
- package/dist/interpreter/helpers/nameref.d.ts +65 -0
- package/dist/interpreter/helpers/numeric-compare.d.ts +13 -0
- package/dist/interpreter/helpers/quoting.d.ts +26 -0
- package/dist/interpreter/helpers/readonly.d.ts +45 -0
- package/dist/interpreter/helpers/regex.d.ts +8 -0
- package/dist/interpreter/helpers/result.d.ts +60 -0
- package/dist/interpreter/helpers/shell-constants.d.ts +41 -0
- package/dist/interpreter/helpers/shellopts.d.ts +28 -0
- package/dist/interpreter/helpers/string-compare.d.ts +24 -0
- package/dist/interpreter/helpers/string-tests.d.ts +13 -0
- package/dist/interpreter/helpers/variable-tests.d.ts +9 -0
- package/dist/interpreter/helpers/word-matching.d.ts +16 -0
- package/dist/interpreter/helpers/word-parts.d.ts +22 -0
- package/dist/interpreter/helpers/xtrace.d.ts +18 -0
- package/dist/interpreter/index.d.ts +3 -0
- package/dist/interpreter/interpreter.d.ts +82 -0
- package/dist/interpreter/numeric-fd-redirects.d.ts +8 -0
- package/dist/interpreter/pipeline-execution.d.ts +16 -0
- package/dist/interpreter/process-substitution.d.ts +62 -0
- package/dist/interpreter/redirections.d.ts +50 -0
- package/dist/interpreter/simple-command-assignments.d.ts +36 -0
- package/dist/interpreter/state-transaction.d.ts +7 -0
- package/dist/interpreter/subshell-group.d.ts +40 -0
- package/dist/interpreter/type-command.d.ts +37 -0
- package/dist/interpreter/types.d.ts +402 -0
- package/dist/limits.d.ts +111 -0
- package/dist/network/allow-list/shared.d.ts +49 -0
- package/dist/network/allow-list.d.ts +59 -0
- package/dist/network/dns-pin.d.ts +42 -0
- package/dist/network/fetch.d.ts +27 -0
- package/dist/network/index.d.ts +7 -0
- package/dist/network/types.d.ts +182 -0
- package/dist/parser/arithmetic-parser.d.ts +23 -0
- package/dist/parser/arithmetic-primaries.d.ts +45 -0
- package/dist/parser/command-parser.d.ts +10 -0
- package/dist/parser/compound-parser.d.ts +28 -0
- package/dist/parser/conditional-parser.d.ts +8 -0
- package/dist/parser/expansion-parser.d.ts +18 -0
- package/dist/parser/lexer.d.ts +195 -0
- package/dist/parser/parser-substitution.d.ts +85 -0
- package/dist/parser/parser.d.ts +152 -0
- package/dist/parser/types.d.ts +40 -0
- package/dist/parser/word-parser.d.ts +35 -0
- package/dist/sandbox/Command.d.ts +35 -0
- package/dist/sandbox/Sandbox.d.ts +121 -0
- package/dist/sandbox/index.d.ts +2 -0
- package/dist/security/blocked-globals.d.ts +60 -0
- package/dist/security/defense-context.d.ts +13 -0
- package/dist/security/defense-in-depth-box.d.ts +354 -0
- package/dist/security/index.d.ts +33 -0
- package/dist/security/safe-timestamp.d.ts +1 -0
- package/dist/security/security-violation-logger.d.ts +99 -0
- package/dist/security/trusted-globals.d.ts +17 -0
- package/dist/security/types.d.ts +151 -0
- package/dist/security/violation-error-message.d.ts +3 -0
- package/dist/security/wasm-callback.d.ts +6 -0
- package/dist/security/worker-defense-in-depth.d.ts +228 -0
- package/dist/shell-metadata.d.ts +25 -0
- package/dist/source-limit.d.ts +2 -0
- package/dist/timers.d.ts +16 -0
- package/dist/transform/pipeline.d.ts +8 -0
- package/dist/transform/plugins/command-collector.d.ts +8 -0
- package/dist/transform/plugins/tee-plugin.d.ts +40 -0
- package/dist/transform/serialize.d.ts +4 -0
- package/dist/transform/types.d.ts +18 -0
- package/dist/types.d.ts +319 -0
- package/dist/utils/args.d.ts +55 -0
- package/dist/utils/constants.d.ts +15 -0
- package/dist/utils/file-reader.d.ts +76 -0
- package/dist/utils/glob.d.ts +25 -0
- package/dist/vitest-setup.d.ts +1 -0
- package/package.json +136 -0
- package/vendor/cpython-emscripten/python.cjs +2 -0
- package/vendor/cpython-emscripten/python.wasm +0 -0
- package/vendor/cpython-emscripten/python313.zip +0 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{a as i,b as l}from"./chunk-QAYAQNCG.js";var p={name:"history",summary:"display command history",usage:"history [n]",options:["-c clear the history list"," --help display this help and exit"]},h="BASH_HISTORY",m={name:"history",async execute(e,s){if(l(e))return i(p);let a=s.env.get(h)||"[]",t;try{t=JSON.parse(a)}catch{t=[]}if(e[0]==="-c")return s.env.set(h,"[]"),{stdout:"",stderr:"",exitCode:0};let n=t.length;e[0]&&/^\d+$/.test(e[0])&&(n=Math.min(parseInt(e[0],10),t.length));let c=t.length-n,r="";for(let o=c;o<t.length;o++){let y=(o+1).toString().padStart(5," ");r+=`${y} ${t[o]}
|
|
3
|
+
`}return{stdout:r,stderr:"",exitCode:0}}},u={name:"history",flags:[{flag:"-c",type:"boolean"}]};export{m as a,u as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{a as r}from"./chunk-73JQKNZT.js";var g=2048,o=new Map;function u(l,c,t){let s=typeof t=="boolean"?{ignoreCase:t}:t??{},e=c;s.stripQuotes&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1));let i=s.ignoreCase?`i:${e}`:e,n=o.get(i);if(!n){if(n=a(e,s.ignoreCase),o.size>=g){let f=o.keys().next().value;f!==void 0&&o.delete(f)}o.set(i,n)}return n.test(l)}function a(l,c){let t="^";for(let s=0;s<l.length;s++){let e=l[s];if(e==="*")t+=".*";else if(e==="?")t+=".";else if(e==="["){let i=s+1;for(;i<l.length&&l[i]!=="]";)i++;t+=l.slice(s,i+1),s=i}else e==="."||e==="+"||e==="^"||e==="$"||e==="{"||e==="}"||e==="("||e===")"||e==="|"||e==="\\"?t+=`\\${e}`:t+=e}return t+="$",r(t,c?"i":"")}export{u as a};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{d as a}from"./chunk-GN6CQ3J4.js";import{a as c}from"./chunk-QIQMJJZ4.js";import{a as u,b as p}from"./chunk-QAYAQNCG.js";import*as g from"diff";var b={name:"diff",summary:"compare files line by line",usage:"diff [OPTION]... FILE1 FILE2",options:["-u, --unified output unified diff format (default)","-q, --brief report only whether files differ","-s, --report-identical-files report when files are the same","-i, --ignore-case ignore case differences"," --help display this help and exit"]},C={unified:{short:"u",long:"unified",type:"boolean"},brief:{short:"q",long:"brief",type:"boolean"},reportSame:{short:"s",long:"report-identical-files",type:"boolean"},ignoreCase:{short:"i",long:"ignore-case",type:"boolean"}},L={name:"diff",async execute(d,e){if(p(d))return u(b);let t=c("diff",d,C);if(!t.ok)return t.error;let m=t.result.flags.brief,h=t.result.flags.reportSame,y=t.result.flags.ignoreCase,l=t.result.positional;if(t.result.flags.unified,l.length<2)return{stdout:"",stderr:`diff: missing operand
|
|
3
|
+
`,exitCode:2};let i,s,[r,o]=l;try{i=r==="-"?a(e.stdin):await e.fs.readFile(e.fs.resolvePath(e.cwd,r))}catch{return{stdout:"",stderr:`diff: ${r}: No such file or directory
|
|
4
|
+
`,exitCode:2}}try{s=o==="-"?a(e.stdin):await e.fs.readFile(e.fs.resolvePath(e.cwd,o))}catch{return{stdout:"",stderr:`diff: ${o}: No such file or directory
|
|
5
|
+
`,exitCode:2}}let f=i,n=s;return y&&(f=f.toLowerCase(),n=n.toLowerCase()),f===n?h?{stdout:`Files ${r} and ${o} are identical
|
|
6
|
+
`,stderr:"",exitCode:0}:{stdout:"",stderr:"",exitCode:0}:m?{stdout:`Files ${r} and ${o} differ
|
|
7
|
+
`,stderr:"",exitCode:1}:{stdout:g.createTwoFilesPatch(r,o,i,s,"","",{context:3}),stderr:"",exitCode:1}}},P={name:"diff",flags:[{flag:"-u",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-i",type:"boolean"}],needsArgs:!0,minArgs:2};export{L as a,P as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{l as u}from"./chunk-TVCZIH6M.js";var m=new Set(["__proto__","constructor","prototype"]),E=new Set([...m,"__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]);function O(e,n){if(Array.isArray(e))throw new TypeError(`${n}: expected object, got array`);if(Object.getPrototypeOf(e)!==null)throw new TypeError(`${n}: expected null-prototype object, got prototypal object`)}function b(e){return!m.has(e)}function A(e,n,p){O(e,"safeSet"),b(n)&&(e[n]=p)}function j(e,n){return O(e,"safeHasOwn"),Object.hasOwn(e,n)}function D(e,n={}){let p=n.maxDepth??2e3,o=n.maxElements??1e6,_=new WeakMap,i=n.elementBudget??{used:0};if(!Number.isSafeInteger(i.used)||i.used<0||i.used>o)throw new u(`query input element limit exceeded (${o})`,"array_elements");let x=()=>{if(++i.used>o)throw new u(`query input element limit exceeded (${o})`,"array_elements")},y=(t,r,c)=>{if(t===null||typeof t!="object"||t instanceof Date)return t;let l=_.get(t);if(l!==void 0)return l;if(r>p)throw new u(`query depth limit exceeded (${p})`,"recursion");let a=Array.isArray(t)?[]:Object.create(null);return _.set(t,a),c.push({source:t,target:a,depth:r}),a},f=[],h=y(e,0,f);for(;f.length>0;){let t=f.pop();if(!t)break;let{source:r,target:c,depth:l}=t;if(Array.isArray(r)&&Array.isArray(c)){if(r.length>o-i.used)throw new u(`query input element limit exceeded (${o})`,"array_elements");c.length=r.length;for(let s=r.length-1;s>=0;s--)x(),c[s]=y(r[s],l+1,f);continue}let a=r,w=c,d=Object.keys(a);if(d.length>o-i.used)throw new u(`query input element limit exceeded (${o})`,"array_elements");for(let s=0;s<d.length;s++){x();let g=d[s];w[g]=y(a[g],l+1,f)}}return h}function k(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function P(e){return Object.assign(Object.create(null),e)}function $(e){return Object.assign(Object.create(null),e)}function G(...e){return Object.assign(Object.create(null),...e)}export{b as a,A as b,j as c,D as d,k as e,P as f,$ as g,G as h};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{a as _}from"./chunk-WZQNMEQW.js";import{a as $e}from"./chunk-TDD4NFYE.js";import{a as D}from"./chunk-73JQKNZT.js";import{b as le}from"./chunk-ZBUZKIPX.js";import{a as q}from"./chunk-GN6CQ3J4.js";import{a as Se,b as Be,c as fe}from"./chunk-QAYAQNCG.js";var nt="file",it="link",st="symlink",Le="directory",at={file:"0",link:"1",symlink:"2","character-device":"3","block-device":"4",directory:"5",fifo:"6","pax-header":"x","pax-global-header":"g","gnu-long-name":"L","gnu-long-link-name":"K"},ot={0:nt,1:it,2:st,3:"character-device",4:"block-device",5:Le,6:"fifo",x:"pax-header",g:"pax-global-header",L:"gnu-long-name",K:"gnu-long-link-name"},ct=new Uint8Array(512),V=new Uint8Array(0),I=new TextEncoder,Q=new TextDecoder;function P(e,t,r,n){n&&I.encodeInto(n,e.subarray(t,t+r))}function j(e,t,r,n){if(n===void 0)return;let i=n.toString(8).padStart(r-1,"0");I.encodeInto(i,e.subarray(t,t+r-1))}function F(e,t,r){let n=e.indexOf(0,t),i=n===-1||n>t+r?t+r:n;return Q.decode(e.subarray(t,i))}function me(e,t,r){let n=0,i=t+r;for(let s=t;s<i;s++){let a=e[s];if(a===0)break;a!==32&&(n=n*8+(a-48))}return n}function Y(e,t,r){if(e[t]&128){let n=0;n=e[t]&127;for(let i=1;i<r;i++)n=n*256+e[t+i];if(!Number.isSafeInteger(n))throw new Error("TAR number too large");return n}return me(e,t,r)}var M=e=>e.type==="directory"||e.type==="symlink"||e.type==="link"||e.type==="character-device"||e.type==="block-device"||e.type==="fifo";async function Ne(e){if(e==null)return V;if(e instanceof Uint8Array)return e;if(typeof e=="string")return I.encode(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(e instanceof Blob)return new Uint8Array(await e.arrayBuffer());throw new TypeError("Unsupported content type for entry body.")}var Te=(e,t)=>{let r=e.split("/").filter(Boolean);return t>=r.length?"":r.slice(t).join("/")};function he(e,t){let{strip:r,filter:n,map:i}=t;if(!r&&!n&&!i)return e;let s={...e};if(r&&r>0){let o=Te(s.name,r);if(!o)return null;if(s.name=s.type==="directory"&&!o.endsWith("/")?`${o}/`:o,s.linkname){let c=s.linkname.startsWith("/");if(c||s.type==="link"){let l=Te(s.linkname,r);s.linkname=c?`/${l}`||"/":l}}}if(n?.(s)===!1)return null;let a=i?i(s):s;return a&&(!a.name||!a.name.trim()||a.name==="."||a.name==="/")?null:a}var K=256;function lt(){let e=new Array(K),t=e.length-1,r=0,n=0,i=0,s=o=>{let c=e[r];o===c.length?(e[r]=V,r=r+1&t):e[r]=c.subarray(o),i-=o,i===0&&e.length>K&&(e=new Array(K),t=K-1,r=0,n=0)};function a(o,c){if(c){let y=0,d=Math.min(o,i);for(;d>0;){let m=e[r],p=Math.min(d,m.length),b=p===m.length?m:m.subarray(0,p);if(s(p),d-=p,y+=p,!c(b))break}return y}if(i<o)return null;if(o===0)return V;let l=e[r];if(l.length>=o){let y=l.length===o?l:l.subarray(0,o);return s(o),y}let f=new Uint8Array(o),u=0,h=o;for(;h>0;){let y=e[r],d=Math.min(h,y.length);f.set(d===y.length?y:y.subarray(0,d),u),u+=d,h-=d,s(d)}return f}return{push:o=>{if(o.length===0)return;let c=n+1&t;if(c===r){let l=e.length,f=l*2,u=new Array(f),h=n-r+l&l-1;if(r<n)for(let y=0;y<h;y++)u[y]=e[r+y];else if(h>0){let y=l-r;for(let d=0;d<y;d++)u[d]=e[r+d];for(let d=0;d<n;d++)u[y+d]=e[d]}e=u,t=f-1,r=0,n=h,c=n+1&t}e[n]=o,n=c,i+=o.length},available:()=>i,peek:o=>{if(i<o)return null;if(o===0)return V;let c=e[r];if(c.length>=o)return c.length===o?c:c.subarray(0,o);let l=new Uint8Array(o),f=0,u=r;for(;f<o;){let h=e[u],y=Math.min(o-f,h.length);y===h.length?l.set(h,f):l.set(h.subarray(0,y),f),f+=y,u=u+1&t}return l},discard:o=>{if(o>i)throw new Error("Too many bytes consumed");if(o===0)return;let c=o;for(;c>0;){let l=e[r],f=Math.min(c,l.length);s(f),c-=f}},pull:a}}var de=32,ft=48;function ut(e){let t=me(e,148,8),r=0;for(let n=0;n<e.length;n++)n>=148&&n<156?r+=de:r+=e[n];return t===r}function dt(e){e.fill(de,148,156);let t=0;for(let r of e)t+=r;for(let r=153;r>=148;r--)e[r]=(t&7)+ft,t>>=3;e[154]=0,e[155]=de}var mt=256;function ht(e){let t={};I.encode(e.name).length>100&&Ue(e.name)===null&&(t.path=e.name),e.linkname&&I.encode(e.linkname).length>100&&(t.linkpath=e.linkname),e.uname&&I.encode(e.uname).length>32&&(t.uname=e.uname),e.gname&&I.encode(e.gname).length>32&&(t.gname=e.gname),e.uid!=null&&e.uid>2097151&&(t.uid=String(e.uid)),e.gid!=null&&e.gid>2097151&&(t.gid=String(e.gid)),e.size!=null&&e.size>8589934591&&(t.size=String(e.size)),e.pax&&Object.assign(t,e.pax);let r=Object.entries(t);if(r.length===0)return null;let n=I.encode(r.map(([i,s])=>{let a=`${i}=${s}
|
|
3
|
+
`,o=I.encode(a).length+1,c=o+String(o).length;return c=o+String(c).length,`${c} ${a}`}).join(""));return{paxHeader:Pe({name:Q.decode(I.encode(`PaxHeader/${e.name}`).slice(0,100)),size:n.length,type:"pax-header",mode:420,mtime:e.mtime,uname:e.uname,gname:e.gname,uid:e.uid,gid:e.gid}),paxBody:n}}function Ue(e){let t=I.encode(e).length;if(t<=100||t>mt)return null;for(let r=e.length-1;r>0;r--){if(e[r]!=="/")continue;let n=e.slice(0,r),i=e.slice(r+1);if(I.encode(n).length<=155&&I.encode(i).length<=100)return{prefix:n,name:i}}return null}function Pe(e){let t=new Uint8Array(512),r=M(e)?0:e.size??0,n=e.name,i="";if(!e.pax?.path){let s=Ue(n);s&&(n=s.name,i=s.prefix)}return P(t,0,100,n),j(t,100,8,e.mode??(e.type==="directory"?493:420)),j(t,108,8,e.uid??0),j(t,116,8,e.gid??0),j(t,124,12,r),j(t,136,12,Math.floor((e.mtime?.getTime()??Date.now())/1e3)),P(t,156,1,at[e.type??"file"]),P(t,157,100,e.linkname),P(t,257,6,"ustar\0"),P(t,263,2,"00"),P(t,265,32,e.uname),P(t,297,32,e.gname),P(t,345,155,i),dt(t),t}function pt(e,t){if(t&&!ut(e))throw new Error("Invalid tar header checksum.");let r=F(e,156,1),n={name:F(e,0,100),mode:me(e,100,8),uid:Y(e,108,8),gid:Y(e,116,8),size:Y(e,124,12),mtime:new Date(Y(e,136,12)*1e3),type:ot[r]||"file",linkname:F(e,157,100)},i=F(e,257,6);return i.trim()==="ustar"&&(n.uname=F(e,265,32),n.gname=F(e,297,32)),i==="ustar"&&(n.prefix=F(e,345,155)),n}var Ie={path:["name",e=>e],linkpath:["linkname",e=>e],size:["size",e=>/^\d+$/.test(e)&&Number.isSafeInteger(+e)?+e:NaN],mtime:["mtime",parseFloat],uid:["uid",e=>parseInt(e,10)],gid:["gid",e=>parseInt(e,10)],uname:["uname",e=>e],gname:["gname",e=>e]};function gt(e){let t=Object.create(null),r=Object.create(null),n=!1,i=0;for(;i<e.length;){let s=e.indexOf(32,i);if(s===-1)break;let a=parseInt(Q.decode(e.subarray(i,s)),10);if(!(a>0))break;let o=i+a,c=Q.decode(e.subarray(s+1,o-1)),l=c.indexOf("=");if(l>0){let f=c.slice(0,l),u=c.slice(l+1);if(r[f]=u,n=!0,Object.hasOwn(Ie,f)){let[h,y]=Ie[f],d=y(u);(typeof d=="string"||!Number.isNaN(d))&&(t[h]=d)}}i=o}return n&&(t.pax=r),t}function Oe(e,t){t.name!==void 0&&(e.name=t.name),t.linkname!==void 0&&(e.linkname=t.linkname),t.size!==void 0&&(e.size=t.size),t.mtime!==void 0&&(e.mtime=new Date(t.mtime*1e3)),t.uid!==void 0&&(e.uid=t.uid),t.gid!==void 0&&(e.gid=t.gid),t.uname!==void 0&&(e.uname=t.uname),t.gname!==void 0&&(e.gname=t.gname),t.pax&&(e.pax=Object.assign({},e.pax??{},t.pax))}function yt(e){switch(e){case"pax-global-header":case"pax-header":return gt;case"gnu-long-name":return t=>({name:F(t,0,t.length)});case"gnu-long-link-name":return t=>({linkname:F(t,0,t.length)});default:return}}function wt(e){let t=Pe(e),r=ht(e);if(!r)return[t];let n=-r.paxBody.length&511,i=n>0?[ct.subarray(0,n)]:[];return[r.paxHeader,r.paxBody,...i,t]}var ue=0,H=1,xt=8*1024*1024,J=new Error("Tar archive is truncated.");function pe(e={}){let t=e.strict??!1,{available:r,peek:n,push:i,discard:s,pull:a}=lt(),o=ue,c=!1,l=!1,f=!1,u=null,h={},y={},d={isEntryActive:()=>o===H,isBodyComplete:()=>!u||u.remaining===0,canFinish:()=>!u||r()>=u.remaining+u.padding,bodyBytes:()=>u&&u.remaining>0?Math.min(u.remaining,r()):0,write(m){if(c)throw new Error("Archive already ended.");i(m)},end(){c=!0},readHeader(){if(o!==ue)throw new Error("Cannot read header while an entry is active");if(!l)for(;!l;){if(r()<512){if(c){if(r()>0&&t)throw J;l=!0;return}return null}let m=n(512);if(Fe(m)){if(r()<512*2){if(c){if(t)throw J;l=!0;return}return null}if(Fe(n(512*2).subarray(512))){s(512*2),l=!0,f=!0;return}if(t)throw new Error("Invalid tar header.");s(512);continue}let p;try{p=pt(m,t)}catch(z){if(t)throw z;s(512);continue}let b=yt(p.type);if(b){if(p.size>xt)throw new Error("Tar metadata entry exceeds maximum size.");let z=p.size+(-p.size&511);if(r()<512+z){if(c&&t)throw J;return null}s(512);let C=b(a(z).subarray(0,p.size));y.pax&&(y={});let A=p.type==="pax-global-header"?h:y;for(let W in C)A[W]=C[W];continue}s(512);let w=p;p.prefix&&(w.name=`${p.prefix}/${w.name}`),Oe(w,h),Oe(w,y);let S=w.size;return M(w)?(S=0,w.size=0):w.name.endsWith("/")&&w.type==="file"&&(w.type=Le,w.size=0),y={},u={header:w,remaining:S,padding:-S&511},o=H,w}},streamBody(m){if(o!==H||!u||u.remaining===0)return 0;let p=Math.min(u.remaining,r());if(p===0)return 0;let b=a(p,m);return u.remaining-=b,b},skipPadding(){if(o!==H||!u)return!0;if(u.remaining>0)throw new Error("Body not fully consumed");return r()<u.padding?!1:(s(u.padding),u=null,o=ue,!0)},skipEntry(){if(o!==H||!u)return!0;let m=Math.min(u.remaining,r());return m>0&&(s(m),u.remaining-=m),u.remaining>0?!1:d.skipPadding()},validateEOF(){if(t){if(!f)throw J;if(r()>0&&a(r()).some(m=>m!==0))throw new Error("Invalid EOF.")}}};return d}function Fe(e){if(e.byteOffset%8===0){let t=new BigUint64Array(e.buffer,e.byteOffset,e.length/8);for(let r=0;r<t.length;r++)if(t[r]!==0n)return!1;return!0}for(let t=0;t<e.length;t++)if(e[t]!==0)return!1;return!0}var bt=new Uint8Array(512*2);function Re(e,t,r){let n=null,i=0,s=!1,a=o=>{let c=new Error(o);throw t(c),c};return{add(o){s&&a("No new tar entries after finalize."),n!==null&&a("Previous entry must be completed before adding a new one");let c=M(o)?0:o.size;(!Number.isSafeInteger(c)||c<0)&&a("Invalid tar entry size.");try{let l=wt({...o,size:c});for(let f of l)e(f);n={...o,size:c},i=0}catch(l){t(l)}},write(o){n||a("No active tar entry."),s&&a("Cannot write data after finalize.");let c=i+o.length;c>n.size&&a(`"${n.name}" exceeds given size of ${n.size} bytes.`);try{i=c,e(o)}catch(l){t(l)}},endEntry(){n||a("No active entry to end."),s&&a("Cannot end entry after finalize.");try{i!==n.size&&a(`Size mismatch for "${n.name}".`);let o=-n.size&511;o>0&&e(new Uint8Array(o)),n=null,i=0}catch(o){throw t(o),o}},finalize(){s&&a("Archive has already been finalized"),n!==null&&a("Cannot finalize while an entry is still active");try{e(bt),s=!0,r&&r()}catch(o){t(o)}}}}function De(){return new CompressionStream("gzip")}function We(){return new DecompressionStream("gzip")}function zt(){let e,t;return{readable:new ReadableStream({start(r){e=r,t=Re(r.enqueue.bind(r),r.error.bind(r),r.close.bind(r))}}),controller:{add(r){let n=M(r);return t.add(r),n&&t.endEntry(),new WritableStream({write(i){t.write(i)},close(){n||t.endEntry()},abort(i){e.error(i)}})},finalize(){t.finalize()},error(r){e.error(r)}}}}async function _e(e){let t=[],r=e.getReader(),n=0;try{for(;;){let{done:a,value:o}=await r.read();if(a)break;t.push(o),n+=o.length}let i=new Uint8Array(n),s=0;for(let a of t)i.set(a,s),s+=a.length;return i}finally{r.releaseLock()}}var Me=e=>e.pipeTo(new WritableStream);function vt(e={}){let t=pe(e),r=e.strict??!1,n=null,i=null,s=!1,a=!1,o=!1,c=!1,l=()=>{try{i?.close()}catch{}i=null},f=d=>{if(!c){c=!0;try{i?.error(d)}catch{}i=null;try{n.error(d)}catch{}n=null}},u=()=>{if(!c){c=!0,l();try{n.close()}catch{}n=null}},h=()=>{if(r)throw new Error("Tar archive is truncated.");u()},y=()=>{if(!(s||c||!n)){s=!0;try{for(;;){if(a){o&&(t.validateEOF(),u());break}if(t.isEntryActive()){if(o&&!t.canFinish()){h();break}if(i){if((i.desiredSize??1)<=0)break;if(t.streamBody(d=>(i.enqueue(d),(i.desiredSize??1)>0))===0&&!t.isBodyComplete()){o&&h();break}}else if(!t.skipEntry()){o&&h();break}if(t.isBodyComplete()&&(l(),!t.skipPadding())){o&&h();break}}else{if((n.desiredSize??0)<0)break;let d=t.readHeader();if(d===null){o&&u();break}if(d===void 0){if(o){t.validateEOF(),u();break}a=!0;break}n.enqueue({header:d,body:new ReadableStream({start(m){d.size===0?m.close():i=m},pull:y,cancel(){i=null,y()}})})}}}catch(d){throw f(d),d}finally{s=!1}}};return{readable:new ReadableStream({start(d){n=d},pull:y,cancel(d){d!==void 0?f(d):u()}},{highWaterMark:2}),writable:new WritableStream({write(d){try{if(a&&r&&d.some(m=>m!==0))throw new Error("Invalid EOF.");t.write(d),y()}catch(m){throw f(m),m}},close(){try{o=!0,t.end(),y()}catch(d){throw f(d),d}},abort(d){f(d)}})}}async function je(e){let{readable:t,controller:r}=zt();return await(async()=>{for(let n of e){let i=r.add(n.header),s="body"in n?n.body:n.data;if(!s){await i.close();continue}if(s instanceof ReadableStream)await s.pipeTo(i);else if(s instanceof Blob)await s.stream().pipeTo(i);else try{let a=await Ne(s);if(a.length>0){let o=i.getWriter();await o.write(a),await o.close()}else await i.close()}catch{throw new TypeError(`Unsupported content type for entry "${n.header.name}".`)}}})().then(()=>r.finalize()).catch(n=>r.error(n)),_e(t)}async function He(e,t={}){if(!(e instanceof ReadableStream))return kt(e instanceof Uint8Array?e:new Uint8Array(e),t);let r=[],n=e.pipeThrough(vt(t));for await(let i of n){let s;try{s=he(i.header,t)}catch(a){throw await i.body.cancel(),a}if(s===null){await Me(i.body);continue}M(s)?(await Me(i.body),r.push({header:s})):r.push({header:s,data:await _e(i.body)})}return r}function kt(e,t){let r=pe(t),n=t.strict??!1,i=[];for(r.write(e),r.end();;){let s=r.readHeader();if(s===void 0)break;if(s===null){if(n)throw new Error("Tar archive is truncated.");break}let a=he(s,t);if(a===null){let h=r.skipEntry();if(!h&&n)throw new Error("Tar archive is truncated.");if(!h)break;continue}if(M(a)){let h=r.skipEntry();if(!h&&n)throw new Error("Tar archive is truncated.");if(i.push({header:a}),!h)break;continue}let o=s.size;if(o<0||!r.canFinish()){if(n)throw new Error("Tar archive is truncated.");o=r.bodyBytes()}let c=new Uint8Array(o),l=0;r.streamBody(h=>(c.set(h,l),l+=h.length,!0));let f=r.isBodyComplete(),u=!0;if(f&&(u=r.skipPadding(),!u&&n))throw new Error("Tar archive is truncated.");if(i.push({header:a,data:c}),!f||!u)break}return r.validateEOF(),i}import Lt from"seek-bzip";var Ct=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t++){let r=t<<24;for(let n=0;n<8;n++)r=r&2147483648?r<<1^79764919:r<<1;e[t]=r>>>0}return e})();function At(e,t){return(e<<8^Ct[(e>>>24^t)&255])>>>0}var ge=class{maxOutputBytes;buffer=[];current=0;bitCount=0;constructor(t=Number.MAX_SAFE_INTEGER){if(this.maxOutputBytes=t,!Number.isSafeInteger(t)||t<0)throw new Error("Invalid bzip2 output limit")}pushByte(t){if(this.buffer.length>=this.maxOutputBytes)throw new Error(`bzip2 output exceeds limit (${this.maxOutputBytes} bytes)`);this.buffer.push(t)}writeBits(t,r){for(let n=t-1;n>=0;n--)this.current=this.current<<1|r>>>n&1,this.bitCount++,this.bitCount===8&&(this.pushByte(this.current),this.current=0,this.bitCount=0)}writeBit(t){this.current=this.current<<1|t&1,this.bitCount++,this.bitCount===8&&(this.pushByte(this.current),this.current=0,this.bitCount=0)}finish(){return this.bitCount>0&&this.pushByte(this.current<<8-this.bitCount),new Uint8Array(this.buffer)}};function Et(e){let t=[],r=0;for(;r<e.length;){let n=e[r],i=1;for(;r+i<e.length&&e[r+i]===n&&i<255;)i++;i>=4?(t.push(n,n,n,n),t.push(i-4),r+=i):(t.push(n),r++)}return new Uint8Array(t)}function St(e){let t=e.length;if(t===0)return{transformed:new Uint8Array(0),pointer:0};let r=Bt(e),n=new Uint8Array(t),i=0;for(let s=0;s<t;s++)r[s]===0?(i=s,n[s]=e[t-1]):n[s]=e[r[s]-1];return{transformed:n,pointer:i}}function Bt(e){let t=e.length,r=new Int32Array(t),n=new Int32Array(t);for(let i=0;i<t;i++)r[i]=i,n[i]=e[i];for(let i=1;i<t;i*=2){let s=n.slice();r.sort((a,o)=>s[a]!==s[o]?s[a]-s[o]:s[(a+i)%t]-s[(o+i)%t]),n[r[0]]=0;for(let a=1;a<t;a++)s[r[a]]===s[r[a-1]]&&s[(r[a]+i)%t]===s[(r[a-1]+i)%t]?n[r[a]]=n[r[a-1]]:n[r[a]]=n[r[a-1]]+1;if(n[r[t-1]]===t-1)break}return r}function $t(e,t){let r=[];for(let a=0;a<256;a++)t[a]&&r.push(a);let n=new Array(256).fill(-1);for(let a=0;a<r.length;a++)n[r[a]]=a;let i=new Uint16Array(e.length),s=r.slice();for(let a=0;a<e.length;a++){let o=e[a],c=0;for(;s[c]!==o;)c++;if(i[a]=c,c>0){let l=s[c];for(let f=c;f>0;f--)s[f]=s[f-1];s[0]=l}}return{encoded:i,length:e.length}}function Tt(e,t,r){let s=r+1,a=[],o=0;for(;o<t;)if(e[o]===0){let l=0;for(;o<t&&e[o]===0;)l++,o++;let f=l;for(;f>0;)f--,f&1?a.push(1):a.push(0),f>>>=1}else a.push(e[o]+1),o++;a.push(s);let c=new Uint16Array(a.length);for(let l=0;l<a.length;l++)c[l]=a[l];return{symbols:c,length:a.length,eob:s}}function Xe(e,t,r){if(t<=1){let l=new Array(e.length).fill(0);for(let f=0;f<e.length;f++)e[f]>0&&(l[f]=1);return{codeLengths:l,maxLen:1,minLen:1}}let n=[];for(let l=0;l<e.length;l++)e[l]>0&&n.push({freq:e[l],symbol:l,left:null,right:null});if(n.length===0)return{codeLengths:new Array(e.length).fill(0),maxLen:0,minLen:0};if(n.length===1){let l=new Array(e.length).fill(0);return l[n[0].symbol]=1,{codeLengths:l,maxLen:1,minLen:1}}for(;n.length>1;){n.sort((u,h)=>u.freq-h.freq);let l=n.shift(),f=n.shift();n.push({freq:l.freq+f.freq,symbol:-1,left:l,right:f})}let i=new Array(e.length).fill(0);function s(l,f){if(!l.left&&!l.right){i[l.symbol]=f;return}l.left&&s(l.left,f+1),l.right&&s(l.right,f+1)}s(n[0],0);let a=!0;for(;a;){a=!1;for(let l=0;l<i.length;l++)i[l]>r&&(i[l]=r,a=!0);if(a){let l=0;for(let f=0;f<i.length;f++)i[f]>0&&(l+=1/(1<<i[f]));if(l>1)for(let f=1;f<r&&l>1;f++)for(let u=0;u<i.length&&l>1;u++)i[u]===f&&(i[u]++,l-=1/(1<<f)-1/(1<<f+1));a=!1;for(let f=0;f<i.length;f++)if(i[f]>r){a=!0;break}}}let o=r,c=0;for(let l=0;l<i.length;l++)i[l]>0&&(i[l]<o&&(o=i[l]),i[l]>c&&(c=i[l]));return{codeLengths:i,maxLen:c,minLen:o}}function It(e,t){let r=new Array(t).fill(0),n=e.slice(0,t),i=Math.max(...n,0),s=new Array(i+1).fill(0);for(let c=0;c<t;c++)n[c]>0&&s[n[c]]++;let a=new Array(i+1).fill(0),o=0;for(let c=1;c<=i;c++)o=o+s[c-1]<<1,a[c]=o;for(let c=0;c<t;c++)n[c]>0&&(r[c]=a[n[c]]++);return{codes:r,lengths:n}}function Ot(e,t,r){e.writeBits(24,3227993),e.writeBits(24,2511705),e.writeBits(32,r),e.writeBit(0);let n=Et(t),{transformed:i,pointer:s}=St(n);e.writeBits(24,s);let a=new Array(256).fill(!1);for(let g=0;g<i.length;g++)a[i[g]]=!0;let o=new Array(16).fill(!1);for(let g=0;g<16;g++)for(let x=0;x<16;x++)if(a[g*16+x]){o[g]=!0;break}for(let g=0;g<16;g++)e.writeBit(o[g]?1:0);for(let g=0;g<16;g++)if(o[g])for(let x=0;x<16;x++)e.writeBit(a[g*16+x]?1:0);let c=0;for(let g=0;g<256;g++)a[g]&&c++;let{encoded:l,length:f}=$t(i,a),{symbols:u,length:h}=Tt(l,f,c),y=c+2,d=50,m=Math.ceil(h/d),p;h<200?p=2:h<600?p=3:h<1200?p=4:h<2400?p=5:p=6,p>m&&(p=Math.max(2,m));let b=[];for(let g=0;g<p;g++)b.push(new Array(y).fill(0));let w=new Int32Array(m);for(let g=0;g<m;g++)w[g]=g%p;for(let g=0;g<m;g++){let x=g*d,v=Math.min(x+d,h),T=w[g];for(let E=x;E<v;E++)b[T][u[E]]++}function S(g){for(let x=0;x<y;x++)g[x]<1&&(g[x]=1)}let z=[];for(let g=0;g<p;g++)S(b[g]),z.push(Xe(b[g],y,20));for(let g=0;g<4;g++){for(let x=0;x<p;x++)b[x].fill(0);for(let x=0;x<m;x++){let v=x*d,T=Math.min(v+d,h),E=0,Z=1/0;for(let U=0;U<p;U++){let oe=0;for(let ce=v;ce<T;ce++)oe+=z[U].codeLengths[u[ce]]||20;oe<Z&&(Z=oe,E=U)}w[x]=E;for(let U=v;U<T;U++)b[E][u[U]]++}for(let x=0;x<p;x++)S(b[x]),z[x]=Xe(b[x],y,20)}e.writeBits(3,p),e.writeBits(15,m);let C=[],A=[];for(let g=0;g<p;g++)A.push(g);for(let g=0;g<m;g++){let x=w[g],v=0;for(;A[v]!==x;)v++;if(C.push(v),v>0){let T=A[v];for(let E=v;E>0;E--)A[E]=A[E-1];A[0]=T}}for(let g=0;g<m;g++){for(let x=0;x<C[g];x++)e.writeBit(1);e.writeBit(0)}for(let g=0;g<p;g++){let x=z[g].codeLengths,v=x[0];e.writeBits(5,v);for(let T=0;T<y;T++){let E=x[T];for(;v<E;)e.writeBit(1),e.writeBit(0),v++;for(;v>E;)e.writeBit(1),e.writeBit(1),v--;e.writeBit(0)}}for(let g=0;g<p;g++){let{codes:x,lengths:v}=It(z[g].codeLengths,y);z[g]=Object.assign(z[g],{_codes:x,_lengths:v})}let W=0,G=0;for(let g=0;g<h;g++){(G===0||G>=d)&&(g>0&&W++,G=0);let x=w[W],v=z[x],T=u[g],E=v._lengths[T],Z=v._codes[T];E>0&&e.writeBits(E,Z),G++}}var Ft=10*1024*1024;function Ge(e,t=9,r=Ft,n=Number.MAX_SAFE_INTEGER){if(t<1||t>9)throw new Error("Block size level must be 1-9");if(e.length>r)throw new Error(`Input too large for bzip2 compression (${e.length} bytes, max ${r})`);let i=t*1e5,s=new ge(n);s.writeBits(8,66),s.writeBits(8,90),s.writeBits(8,104),s.writeBits(8,48+t);let a=0,o=0;for(;o<e.length;){let c=Math.min(o+i,e.length),l=e.subarray(o,c),f=4294967295;for(let u=0;u<l.length;u++)f=At(f,l[u]);f=~f>>>0,a=(a<<1|a>>>31)>>>0,a=(a^f)>>>0,Ot(s,l,f),o=c}return s.writeBits(24,1536581),s.writeBits(24,3690640),s.writeBits(32,a),s.finish()}var ee=null,te=null;async function Ze(){if(ee)return ee;if(te)throw te;try{return ee=await le.runTrustedAsync(()=>import("node-liblzma")),ee}catch{throw te=new Error("xz compression requires node-liblzma which failed to load. Install liblzma-dev (apt) or xz (brew) and reinstall dependencies."),te}}var re=null,ne=null;async function qe(){if(re)return re;if(ne)throw ne;try{return re=await le.runTrustedAsync(()=>import("@mongodb-js/zstd")),re}catch{throw ne=new Error("zstd compression requires @mongodb-js/zstd which is not installed. Install it with: npm install @mongodb-js/zstd"),ne}}var ye=1024*1024*1024,$=512,Nt=1e6;function X(e,t){let r=e??t;if(!Number.isSafeInteger(r)||r<=0)throw new Error("Archive limits must be positive safe integers");return r}function O(e){return{maxArchiveSize:X(e?.maxArchiveSize,ye),maxEntries:X(e?.maxEntries,Nt),maxEntrySize:X(e?.maxEntrySize,ye),maxCompressedSize:X(e?.maxCompressedSize,e?.maxArchiveSize??ye),maxExpansionRatio:X(e?.maxExpansionRatio,1e4),signal:e?.signal,executionScope:e?.executionScope,allowTrustedWholeBufferCodecs:e?.allowTrustedWholeBufferCodecs??!0}}function Ut(e,t){if(e.length>t.maxEntries)throw new Error(`Too many archive entries (max ${t.maxEntries})`);let r=i=>{if(!Number.isSafeInteger(i)||i<0||i>t.maxArchiveSize-n)throw new Error(`Archive too large (max ${t.maxArchiveSize} bytes)`);n+=i},n=$*2;for(let i of e){t.signal?.throwIfAborted();let s=i.isDirectory||i.isSymlink?0:typeof i.content=="string"?q(i.content):i.content?.length??0;if(s>t.maxEntrySize)throw new Error(`Archive entry too large (max ${t.maxEntrySize} bytes)`);let a=i.isDirectory&&!i.name.endsWith("/")?`${i.name}/`:i.name,o=q(a),c=q(i.linkTarget??"");if(o>t.maxArchiveSize||c>t.maxArchiveSize)throw new Error(`Archive too large (max ${t.maxArchiveSize} bytes)`);let l=0;if(o>100&&(l+=o+64),c>100&&(l+=c+64),!Number.isSafeInteger(l))throw new Error(`Archive too large (max ${t.maxArchiveSize} bytes)`);let f=Math.ceil(s/$)*$;if(r($+f),l>0){let u=Math.ceil(l/$)*$;r($+u)}}return n}function ie(e,t,r){return e.executionScope?.reserveBytes(t,r,`tar: ${t}`)}function Pt(e){let t=e.subarray(124,136);if((t[0]&128)!==0){let i=t[0]&127;for(let s=1;s<t.length;s++)if(i=i*256+t[s],!Number.isSafeInteger(i))return;return i}let r=new TextDecoder("ascii").decode(t).replace(/\0.*$/,"").trim();if(r==="")return 0;if(!/^[0-7]+$/.test(r))return;let n=Number.parseInt(r,8);return Number.isSafeInteger(n)?n:void 0}function Rt(e,t){let r=0,n=0;for(;r+$<=e.length;){t.signal?.throwIfAborted();let i=e.subarray(r,r+$);if(i.every(o=>o===0))return;if(n++,n>t.maxEntries)return`Too many entries (max ${t.maxEntries})`;let s=Pt(i);if(s===void 0)return"Invalid tar archive format";if(s>t.maxEntrySize)return`Archive entry too large (max ${t.maxEntrySize} bytes)`;let a=Math.ceil(s/$)*$;if(!Number.isSafeInteger(a)||(r+=$+a,r>e.length))return"Invalid tar archive format"}return r===e.length?void 0:"Invalid tar archive format"}function Mt(e){let t="file";e.isDirectory?t="directory":e.isSymlink&&(t="symlink");let r=e.name;e.isDirectory&&!r.endsWith("/")&&(r+="/");let n;e.content!==void 0&&(typeof e.content=="string"?n=new TextEncoder().encode(e.content):n=e.content);let i=e.isDirectory||e.isSymlink?0:n?.length??0;return{header:{name:r,mode:e.mode??(e.isDirectory?493:420),uid:e.uid??0,gid:e.gid??0,size:i,mtime:e.mtime??new Date,type:t,linkname:e.linkTarget??"",uname:"user",gname:"user"},body:n}}async function R(e,t){let r=O(t),n=Ut(e,r),i=ie(r,"archive construction",n);try{let s=e.map(Mt),a=await je(s);if(r.signal?.throwIfAborted(),a.length>r.maxArchiveSize)throw new Error(`Archive too large (max ${r.maxArchiveSize} bytes)`);return a}finally{i?.release()}}async function Ye(e,t){let r=O(t),n=await R(e,r),i=ie(r,"gzip input",n.byteLength),s=new _({maxInputBytes:r.maxArchiveSize,maxOutputBytes:r.maxCompressedSize,signal:r.signal,label:"gzip archive"});s.acceptInput(n.length);let c=new ReadableStream({start(h){h.enqueue(n),h.close()}}).pipeThrough(De()).getReader(),l=[],f=[],u=0;try{for(;;){let{done:y,value:d}=await c.read();if(y)break;try{s.acceptOutput(d.length);let m=ie(r,"gzip chunks",d.byteLength);m&&f.push(m)}catch(m){throw await c.cancel(),m}u+=d.length,l.push(d)}let h=ie(r,"gzip result",u);try{let y=new Uint8Array(u),d=0;for(let m of l)y.set(m,d),d+=m.length;return y}finally{h?.release()}}finally{for(let h of f)h.release();i?.release()}}async function L(e,t){let r=O(t);if(e.length>r.maxArchiveSize)return{entries:[],error:`Archive too large (max ${r.maxArchiveSize} bytes)`};if(e.length<$||e.length%$!==0)return{entries:[],error:"Invalid tar archive format"};let n=Rt(e,r);if(n)return{entries:[],error:n};try{let i=await He(e),s=[];for(let a of i){if(r.signal?.throwIfAborted(),s.length>=r.maxEntries)return{entries:[],error:`Too many entries (max ${r.maxEntries})`};let o=a.data??new Uint8Array(0);if(a.header.size>r.maxEntrySize||o.length>r.maxEntrySize)return{entries:[],error:`Archive entry too large (max ${r.maxEntrySize} bytes)`};let c="file";switch(a.header.type){case"directory":c="directory";break;case"symlink":c="symlink";break;case"link":c="hardlink";break;case"file":c="file";break;default:c="other"}s.push({name:a.header.name,mode:a.header.mode??420,uid:a.header.uid??0,gid:a.header.gid??0,size:a.header.size,mtime:a.header.mtime??new Date,type:c,linkTarget:a.header.linkname||void 0,content:o})}return{entries:s}}catch(i){let s=i instanceof Error?i.message:"Unknown error";return{entries:[],error:s}}}async function we(e,t){let r=O(t);if(e.length>r.maxCompressedSize)return{entries:[],error:`Archive too large (max ${r.maxCompressedSize} bytes)`};try{let n=new _({maxInputBytes:r.maxCompressedSize,maxOutputBytes:r.maxArchiveSize,maxExpansionRatio:r.maxExpansionRatio,signal:r.signal,label:"gzip archive"});n.acceptInput(e.length);let a=new ReadableStream({start(u){u.enqueue(e),u.close()}}).pipeThrough(We()).getReader(),o=[],c=0;for(;;){let{done:u,value:h}=await a.read();if(u)break;try{n.acceptOutput(h.length)}catch(y){throw await a.cancel(),y}c+=h.length,o.push(h)}let l=new Uint8Array(c),f=0;for(let u of o)l.set(u,f),f+=u.length;return L(l,r)}catch(n){let i=n instanceof Error?n.message:"Unknown error";return{entries:[],error:`Decompression failed: ${i}`}}}function xe(e){return e.length>=2&&e[0]===31&&e[1]===139}function be(e){return e.length>=3&&e[0]===66&&e[1]===90&&e[2]===104}function ze(e){return e.length>=6&&e[0]===253&&e[1]===55&&e[2]===122&&e[3]===88&&e[4]===90&&e[5]===0}async function Dt(e,t){let r=new _({maxInputBytes:t.maxCompressedSize,maxOutputBytes:t.maxArchiveSize,maxExpansionRatio:t.maxExpansionRatio,signal:t.signal,label:"bzip2 archive"});r.acceptInput(e.length);let n=Math.min(64*1024,t.maxArchiveSize),i=[],s=Buffer.allocUnsafe(n),a=0,o=0,c={writeByte(l){r.acceptOutput(1),a===s.length&&(i.push(s),s=Buffer.allocUnsafe(n),a=0),s[a++]=l,o++}};return Lt.decode(Buffer.from(e),c),a>0&&i.push(s.subarray(0,a)),new Uint8Array(Buffer.concat(i,o))}async function Wt(e,t){let r=new _({maxInputBytes:t.maxArchiveSize,maxOutputBytes:t.maxCompressedSize,signal:t.signal,label:"bzip2 archive"});r.acceptInput(e.length);let n=await Ge(e,9,t.maxArchiveSize,t.maxCompressedSize);return r.acceptOutput(n.length),n}async function _t(e){let r=(await Ze()).unxzSync(Buffer.from(e));return new Uint8Array(r)}async function jt(e){let r=(await Ze()).xzSync(Buffer.from(e));return new Uint8Array(r)}async function Ke(e,t){let r=O(t),n=await R(e,r);return Wt(n,r)}async function Je(e,t){let r=O(t);if(t?.allowNativeCodecs===!1||!r.allowTrustedWholeBufferCodecs)throw new Error("xz compression is disabled by configuration. Enable native and trusted whole-buffer codecs to use it.");let n=await R(e,r),i=await jt(n);if(r.signal?.throwIfAborted(),i.length>r.maxCompressedSize)throw new Error(`xz archive: output exceeds limit (${r.maxCompressedSize} bytes)`);return i}async function ve(e,t){let r=O({...t,maxArchiveSize:t?.maxDecompressedSize??t?.maxArchiveSize});if(e.length>r.maxCompressedSize)return{entries:[],error:`Archive too large (max ${r.maxCompressedSize} bytes)`};try{let n=await Dt(e,r);return L(n,r)}catch(n){let i=n instanceof Error?n.message:"Unknown error";return i===`bzip2 archive: output exceeds limit (${r.maxArchiveSize} bytes)`?{entries:[],error:`Decompressed archive too large (max ${r.maxArchiveSize} bytes)`}:{entries:[],error:i}}}async function ke(e,t){let r=O(t);if(t?.allowNativeCodecs===!1||!r.allowTrustedWholeBufferCodecs)return{entries:[],error:"xz decompression is disabled by configuration. Enable native and trusted whole-buffer codecs, or decompress the archive externally before extraction."};if(e.length>r.maxCompressedSize)return{entries:[],error:`Archive too large (max ${r.maxCompressedSize} bytes)`};try{let n=await _t(e);return r.signal?.throwIfAborted(),n.length>r.maxArchiveSize?{entries:[],error:`Trusted xz codec produced data over limit (${r.maxArchiveSize} bytes)`}:L(n,r)}catch(n){let i=n instanceof Error?n.message:"Unknown error";return{entries:[],error:i}}}function Ce(e){return e.length>=4&&e[0]===40&&e[1]===181&&e[2]===47&&e[3]===253}async function Ht(e){let r=await(await qe()).compress(Buffer.from(e),3);return new Uint8Array(r)}async function Xt(e){let r=await(await qe()).decompress(Buffer.from(e));return new Uint8Array(r)}async function Ve(e,t){let r=O(t);if(t?.allowNativeCodecs===!1||!r.allowTrustedWholeBufferCodecs)throw new Error("zstd compression is disabled by configuration. Enable native and trusted whole-buffer codecs to use it.");let n=await R(e,r),i=await Ht(n);if(r.signal?.throwIfAborted(),i.length>r.maxCompressedSize)throw new Error(`zstd archive: output exceeds limit (${r.maxCompressedSize} bytes)`);return i}async function Ae(e,t){let r=O(t);if(t?.allowNativeCodecs===!1||!r.allowTrustedWholeBufferCodecs)return{entries:[],error:"zstd decompression is disabled by configuration. Enable native and trusted whole-buffer codecs, or decompress the archive externally before extraction."};if(e.length>r.maxCompressedSize)return{entries:[],error:`Archive too large (max ${r.maxCompressedSize} bytes)`};try{let n=await Xt(e);return r.signal?.throwIfAborted(),n.length>r.maxArchiveSize?{entries:[],error:`Trusted zstd codec produced data over limit (${r.maxArchiveSize} bytes)`}:L(n,r)}catch(n){let i=n instanceof Error?n.message:"Unknown error";return{entries:[],error:i}}}function Qe(e){let t=e.length>0&&e[0]!==""&&!e[0].startsWith("-")?Gt(e):e,r={create:!1,append:!1,update:!1,extract:!1,list:!1,file:"",autoCompress:!1,gzip:!1,bzip2:!1,xz:!1,zstd:!1,verbose:!1,toStdout:!1,keepOldFiles:!1,touch:!1,directory:"",preserve:!1,absoluteNames:!1,strip:0,exclude:[],filesFrom:"",excludeFrom:"",wildcards:!1},n=[],i=0;for(;i<t.length;){let s=t[i];if(s.startsWith("-")&&!s.startsWith("--")&&s.length>2){if(/^-\d+$/.test(s)){n.push(s),i++;continue}for(let a=1;a<s.length;a++){let o=s[a];switch(o){case"c":r.create=!0;break;case"r":r.append=!0;break;case"u":r.update=!0;break;case"x":r.extract=!0;break;case"t":r.list=!0;break;case"a":r.autoCompress=!0;break;case"z":r.gzip=!0;break;case"j":r.bzip2=!0;break;case"J":r.xz=!0;break;case"v":r.verbose=!0;break;case"O":r.toStdout=!0;break;case"k":r.keepOldFiles=!0;break;case"m":r.touch=!0;break;case"p":r.preserve=!0;break;case"P":r.absoluteNames=!0;break;case"f":if(a<s.length-1)r.file=s.substring(a+1),a=s.length;else{if(i++,i>=t.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'f'
|
|
4
|
+
`,exitCode:2}};r.file=t[i]}break;case"C":if(a<s.length-1)r.directory=s.substring(a+1),a=s.length;else{if(i++,i>=t.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'C'
|
|
5
|
+
`,exitCode:2}};r.directory=t[i]}break;case"T":if(a<s.length-1)r.filesFrom=s.substring(a+1),a=s.length;else{if(i++,i>=t.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'T'
|
|
6
|
+
`,exitCode:2}};r.filesFrom=t[i]}break;case"X":if(a<s.length-1)r.excludeFrom=s.substring(a+1),a=s.length;else{if(i++,i>=t.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'X'
|
|
7
|
+
`,exitCode:2}};r.excludeFrom=t[i]}break;default:return{ok:!1,error:fe("tar",`-${o}`)}}}i++;continue}if(s==="-c"||s==="--create")r.create=!0;else if(s==="-r"||s==="--append")r.append=!0;else if(s==="-u"||s==="--update")r.update=!0;else if(s==="-x"||s==="--extract"||s==="--get")r.extract=!0;else if(s==="-t"||s==="--list")r.list=!0;else if(s==="-a"||s==="--auto-compress")r.autoCompress=!0;else if(s==="-z"||s==="--gzip"||s==="--gunzip")r.gzip=!0;else if(s==="-j"||s==="--bzip2")r.bzip2=!0;else if(s==="-J"||s==="--xz")r.xz=!0;else if(s==="--zstd")r.zstd=!0;else if(s==="-v"||s==="--verbose")r.verbose=!0;else if(s==="-O"||s==="--to-stdout")r.toStdout=!0;else if(s==="-k"||s==="--keep-old-files")r.keepOldFiles=!0;else if(s==="-m"||s==="--touch")r.touch=!0;else if(s==="--wildcards")r.wildcards=!0;else if(s==="-p"||s==="--preserve"||s==="--preserve-permissions")r.preserve=!0;else if(s==="-P"||s==="--absolute-names")r.absoluteNames=!0;else if(s==="-f"||s==="--file"){if(i++,i>=t.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'f'
|
|
8
|
+
`,exitCode:2}};r.file=t[i]}else if(s.startsWith("--file="))r.file=s.substring(7);else if(s==="-C"||s==="--directory"){if(i++,i>=t.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'C'
|
|
9
|
+
`,exitCode:2}};r.directory=t[i]}else if(s.startsWith("--directory="))r.directory=s.substring(12);else if(s.startsWith("--strip-components=")||s.startsWith("--strip=")){let a=s.includes("--strip-components=")?s.substring(19):s.substring(8),o=parseInt(a,10);if(Number.isNaN(o)||o<0)return{ok:!1,error:{stdout:"",stderr:`tar: invalid number for --strip: '${a}'
|
|
10
|
+
`,exitCode:2}};r.strip=o}else if(s.startsWith("--exclude="))r.exclude.push(s.substring(10));else if(s==="--exclude"){if(i++,i>=t.length)return{ok:!1,error:{stdout:"",stderr:`tar: option '--exclude' requires an argument
|
|
11
|
+
`,exitCode:2}};r.exclude.push(t[i])}else if(s==="-T"||s==="--files-from"){if(i++,i>=t.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'T'
|
|
12
|
+
`,exitCode:2}};r.filesFrom=t[i]}else if(s.startsWith("--files-from="))r.filesFrom=s.substring(13);else if(s==="-X"||s==="--exclude-from"){if(i++,i>=t.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'X'
|
|
13
|
+
`,exitCode:2}};r.excludeFrom=t[i]}else if(s.startsWith("--exclude-from="))r.excludeFrom=s.substring(15);else if(s==="--"){n.push(...t.slice(i+1));break}else{if(s.startsWith("-"))return{ok:!1,error:fe("tar",s)};n.push(s)}i++}return{ok:!0,options:r,files:n}}function Gt(e){let t=e[0],r=[],n=1;for(let i of t)r.push(`-${i}`),"fCTX".includes(i)&&n<e.length&&(r.push(e[n]),n++);return r.push(...e.slice(n)),r}var et=100;function k(e){return{maxArchiveSize:e.limits.maxArchiveBytes,maxCompressedSize:e.limits.maxArchiveCompressedBytes,maxEntrySize:e.limits.maxArchiveEntryBytes,maxEntries:e.limits.maxArchiveEntries,signal:e.signal,executionScope:e.executionScope}}function B(e){return e.signal?.aborted===!0}function N(){return{stdout:"",stderr:`tar: operation aborted
|
|
14
|
+
`,exitCode:126}}var Zt={name:"tar",summary:"manipulate tape archives",usage:"tar [options] [file...]",description:["Create, extract, or list contents of tar archives.","","One of -c, -r, -u, -x, or -t is required to specify the operation."],options:["-c, --create create a new archive","-r, --append append files to the end of an archive","-u, --update only append files newer than copy in archive","-x, --extract extract files from an archive","-t, --list list contents of an archive","-f, --file=ARCHIVE use archive file ARCHIVE","-a, --auto-compress use archive suffix to determine compression","-z, --gzip filter archive through gzip","-j, --bzip2 filter archive through bzip2","-J, --xz filter archive through xz","--zstd filter archive through zstd","-v, --verbose verbosely list files processed","-O, --to-stdout extract files to standard output","-k, --keep-old-files don't replace existing files when extracting","-m, --touch don't extract file modified time","-C, --directory=DIR change to directory DIR before performing operations","-p, --preserve preserve permissions","-P, --absolute-names do not strip leading '/' or block '..' paths","-T, --files-from=FILE read files to extract/create from FILE","-X, --exclude-from=FILE read exclude patterns from FILE","--strip=N strip N leading path components on extraction","--exclude=PATTERN exclude files matching PATTERN","--wildcards use wildcards for pattern matching"," --help display this help and exit"],examples:["tar -cvf archive.tar file1 file2 Create archive from files","tar -czvf archive.tar.gz dir/ Create gzip-compressed archive","tar -cjvf archive.tar.bz2 dir/ Create bzip2-compressed archive","tar -rf archive.tar newfile.txt Append file to archive","tar -uf archive.tar dir/ Update archive with newer files","tar -xvf archive.tar Extract archive","tar -xvf archive.tar -C /tmp Extract to /tmp","tar -tvf archive.tar List archive contents","tar -xzf archive.tar.gz Extract gzip archive","tar -xf archive.tar file1.txt Extract specific file","tar -xOf archive.tar file.txt Extract file to stdout","tar -xf archive.tar --wildcards '*.txt' Extract matching files"]};function Ee(e,t){let r=e.includes("/")?e.substring(e.lastIndexOf("/")+1):e;for(let n of t){let i=n.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"<<<GLOBSTAR>>>").replace(/\*/g,"[^/]*").replace(/<<<GLOBSTAR>>>/g,".*").replace(/\?/g,".");if(D(`^${i}$`).test(e)||D(`^${i}/`).test(e)||!n.includes("/")&&D(`^${i}$`).test(r))return!0}return!1}function se(e,t){let r=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"<<<GLOBSTAR>>>").replace(/\*/g,"[^/]*").replace(/<<<GLOBSTAR>>>/g,".*").replace(/\?/g,"."),n=e.includes("/")?e.substring(e.lastIndexOf("/")+1):e;return D(`^${r}$`).test(e)||D(`^${r}$`).test(n)}function tt(e,t){if(t<=0)return e;let r=e.split("/").filter(n=>n!=="");return r.length<=t?"":r.slice(t).join("/")}function rt(e){return e.split("/").some(t=>t==="..")}function qt(e,t){if(t)return{safePath:e};let r=e.replace(/^\/+/,"");return r.length===0?{safePath:""}:rt(r)?{error:"Path contains '..'"}:{safePath:r}}function Yt(e){let r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],n=e.getDate().toString().padStart(2," "),i=e.getHours().toString().padStart(2,"0"),s=e.getMinutes().toString().padStart(2,"0");return`${r} ${n} ${i}:${s}`}async function ae(e,t,r,n){let i=[],s=[],a=e.fs.resolvePath(t,r);if(B(e))return{entries:i,errors:["tar: operation aborted"]};try{let o=await e.fs.stat(a);if(B(e))return{entries:i,errors:["tar: operation aborted"]};if(Ee(r,n))return{entries:i,errors:s};if(o.isDirectory){i.push({name:r,isDirectory:!0,mode:o.mode,mtime:o.mtime});let c=await e.fs.readdir(a);if(B(e))return{entries:i,errors:["tar: operation aborted"]};for(let l=0;l<c.length;l+=et){if(B(e))return{entries:i,errors:["tar: operation aborted"]};let f=c.slice(l,l+et),u=await Promise.all(f.map(h=>ae(e,t,r?`${r}/${h}`:h,n)));for(let h of u)i.push(...h.entries),s.push(...h.errors)}}else if(o.isFile){let c=await e.fs.readFileBuffer(a);if(B(e))return{entries:i,errors:["tar: operation aborted"]};i.push({name:r,content:c,mode:o.mode,mtime:o.mtime})}else if(o.isSymbolicLink){let c=await e.fs.readlink(a);if(B(e))return{entries:i,errors:["tar: operation aborted"]};i.push({name:r,isSymlink:!0,linkTarget:c,mode:o.mode,mtime:o.mtime})}}catch(o){let c=o instanceof Error?o.message:"unknown error";s.push(`tar: ${r}: ${c}`)}return{entries:i,errors:s}}async function Kt(e,t,r){if(r.length===0)return{stdout:"",stderr:`tar: Cowardly refusing to create an empty archive
|
|
15
|
+
`,exitCode:2};let n=t.directory?e.fs.resolvePath(e.cwd,t.directory):e.cwd,i=[],s=[],a="";for(let f of r){if(B(e))return N();let{entries:u,errors:h}=await ae(e,n,f,t.exclude);if(i.push(...u),s.push(...h),t.verbose)for(let y of u)a+=`${y.name}${y.isDirectory?"/":""}
|
|
16
|
+
`}if(i.length===0&&s.length>0)return{stdout:"",stderr:`${s.join(`
|
|
17
|
+
`)}
|
|
18
|
+
`,exitCode:2};let o;try{t.gzip?o=await Ye(i,k(e)):t.bzip2?o=await Ke(i,k(e)):t.xz?o=await Je(i,k(e)):t.zstd?o=await Ve(i,k(e)):o=await R(i,k(e))}catch(f){return{stdout:"",stderr:`tar: error creating archive: ${f instanceof Error?f.message:"unknown error"}
|
|
19
|
+
`,exitCode:2}}let c="";if(t.file&&t.file!=="-"){let f=e.fs.resolvePath(e.cwd,t.file);try{await e.fs.writeFile(f,o)}catch(u){let h=u instanceof Error?u.message:"unknown error";return{stdout:"",stderr:`tar: ${t.file}: ${h}
|
|
20
|
+
`,exitCode:2}}}else c=Buffer.from(o).toString("latin1");let l=a;return s.length>0&&(l+=`${s.join(`
|
|
21
|
+
`)}
|
|
22
|
+
`),{stdout:c,stderr:l,exitCode:s.length>0?2:0,stdoutKind:c.length>0?"bytes":"text"}}async function Jt(e,t,r){if(!t.file||t.file==="-")return{stdout:"",stderr:`tar: Cannot append to stdin/stdout
|
|
23
|
+
`,exitCode:2};if(r.length===0)return{stdout:"",stderr:`tar: Cowardly refusing to append nothing to archive
|
|
24
|
+
`,exitCode:2};let n=e.fs.resolvePath(e.cwd,t.file),i;try{i=await e.fs.readFileBuffer(n)}catch{return{stdout:"",stderr:`tar: ${t.file}: Cannot open: No such file or directory
|
|
25
|
+
`,exitCode:2}}let s=await L(i,k(e));if(s.error)return{stdout:"",stderr:`tar: ${s.error}
|
|
26
|
+
`,exitCode:2};let a=s.entries.map(d=>({name:d.name,content:d.content,mode:d.mode,mtime:d.mtime,isDirectory:d.type==="directory",isSymlink:d.type==="symlink",linkTarget:d.linkTarget,uid:d.uid,gid:d.gid})),o=t.directory?e.fs.resolvePath(e.cwd,t.directory):e.cwd,c=[],l=[],f="";for(let d of r){let{entries:m,errors:p}=await ae(e,o,d,t.exclude);if(c.push(...m),l.push(...p),t.verbose)for(let b of m)f+=`${b.name}${b.isDirectory?"/":""}
|
|
27
|
+
`}let u=[...a,...c],h;try{h=await R(u,k(e))}catch(d){return{stdout:"",stderr:`tar: error creating archive: ${d instanceof Error?d.message:"unknown error"}
|
|
28
|
+
`,exitCode:2}}try{await e.fs.writeFile(n,h)}catch(d){let m=d instanceof Error?d.message:"unknown error";return{stdout:"",stderr:`tar: ${t.file}: ${m}
|
|
29
|
+
`,exitCode:2}}let y=f;return l.length>0&&(y+=`${l.join(`
|
|
30
|
+
`)}
|
|
31
|
+
`),{stdout:"",stderr:y,exitCode:l.length>0?2:0}}async function Vt(e,t,r){if(!t.file||t.file==="-")return{stdout:"",stderr:`tar: Cannot update stdin/stdout
|
|
32
|
+
`,exitCode:2};if(r.length===0)return{stdout:"",stderr:`tar: Cowardly refusing to update with nothing
|
|
33
|
+
`,exitCode:2};let n=e.fs.resolvePath(e.cwd,t.file),i;try{i=await e.fs.readFileBuffer(n)}catch{return{stdout:"",stderr:`tar: ${t.file}: Cannot open: No such file or directory
|
|
34
|
+
`,exitCode:2}}let s=await L(i,k(e));if(s.error)return{stdout:"",stderr:`tar: ${s.error}
|
|
35
|
+
`,exitCode:2};let a=new Map;for(let p of s.entries)a.set(p.name,p.mtime);let o=t.directory?e.fs.resolvePath(e.cwd,t.directory):e.cwd,c=[],l=[],f="";for(let p of r){let{entries:b,errors:w}=await ae(e,o,p,t.exclude);l.push(...w);for(let S of b){let z=a.get(S.name);(!z||S.mtime&&S.mtime.getTime()>z.getTime())&&(c.push(S),t.verbose&&(f+=`${S.name}${S.isDirectory?"/":""}
|
|
36
|
+
`))}}if(c.length===0){let p="";return l.length>0&&(p=`${l.join(`
|
|
37
|
+
`)}
|
|
38
|
+
`),{stdout:"",stderr:p,exitCode:l.length>0?2:0}}let u=new Set(c.map(p=>p.name)),y=[...s.entries.filter(p=>!u.has(p.name)).map(p=>({name:p.name,content:p.content,mode:p.mode,mtime:p.mtime,isDirectory:p.type==="directory",isSymlink:p.type==="symlink",linkTarget:p.linkTarget,uid:p.uid,gid:p.gid})),...c],d;try{d=await R(y,k(e))}catch(p){return{stdout:"",stderr:`tar: error creating archive: ${p instanceof Error?p.message:"unknown error"}
|
|
39
|
+
`,exitCode:2}}try{await e.fs.writeFile(n,d)}catch(p){let b=p instanceof Error?p.message:"unknown error";return{stdout:"",stderr:`tar: ${t.file}: ${b}
|
|
40
|
+
`,exitCode:2}}let m=f;return l.length>0&&(m+=`${l.join(`
|
|
41
|
+
`)}
|
|
42
|
+
`),{stdout:"",stderr:m,exitCode:l.length>0?2:0}}async function Qt(e,t,r){let n;if(t.file&&t.file!=="-"){let m=e.fs.resolvePath(e.cwd,t.file);try{n=await e.fs.readFileBuffer(m)}catch{return{stdout:"",stderr:`tar: ${t.file}: Cannot open: No such file or directory
|
|
43
|
+
`,exitCode:2}}}else n=Uint8Array.from(e.stdin,m=>m.charCodeAt(0));let i,s=t.gzip||xe(n),a=t.bzip2||be(n),o=t.xz||ze(n),c=t.zstd||Ce(n);if(s?i=await we(n,k(e)):a?i=await ve(n,k(e)):o?i=await ke(n,k(e)):c?i=await Ae(n,k(e)):i=await L(n,k(e)),i.error)return{stdout:"",stderr:`tar: ${i.error}
|
|
44
|
+
`,exitCode:2};let l=t.directory?e.fs.resolvePath(e.cwd,t.directory):e.cwd,f=t.absoluteNames?r:r.map(m=>m.replace(/^\/+/,"")).filter(m=>m.length>0),u="",h="",y=[];if(t.directory&&!t.toStdout){if(B(e))return N();try{await e.fs.mkdir(l,{recursive:!0})}catch{}}for(let m of i.entries){if(B(e))return N();let p=tt(m.name,t.strip);if(!p)continue;let b=qt(p,t.absoluteNames);if(b.error){y.push(`tar: ${p}: ${b.error}`);continue}let w=b.safePath??"";if(!w)continue;let S=w.endsWith("/")?w.slice(0,-1):w;if(f.length>0){let C;if(t.wildcards?C=f.some(A=>se(w,A)||se(S,A)||w.startsWith(`${A}/`)):C=f.some(A=>w===A||w.startsWith(`${A}/`)||S===A),!C)continue}if(Ee(w,t.exclude))continue;let z=e.fs.resolvePath(l,w);try{if(m.type==="directory"){if(t.toStdout)continue;if(B(e))return N();await e.fs.mkdir(z,{recursive:!0}),t.verbose&&(u+=`${w}
|
|
45
|
+
`)}else if(m.type==="file"){if(t.toStdout){h+=new TextDecoder().decode(m.content),t.verbose&&(u+=`${w}
|
|
46
|
+
`);continue}if(t.keepOldFiles)try{await e.fs.stat(z),t.verbose&&(u+=`${w}: not overwritten, file exists
|
|
47
|
+
`);continue}catch{}let C=z.substring(0,z.lastIndexOf("/"));if(C)try{await e.fs.mkdir(C,{recursive:!0})}catch{}if(B(e))return N();if(await e.fs.writeFile(z,m.content),t.preserve&&m.mode)try{await e.fs.chmod(z,m.mode)}catch{}t.verbose&&(u+=`${w}
|
|
48
|
+
`)}else if(m.type==="symlink"&&m.linkTarget){if(t.toStdout)continue;if(!t.absoluteNames&&(m.linkTarget.startsWith("/")||rt(m.linkTarget))){y.push(`tar: ${w}: unsafe symlink target`);continue}if(t.keepOldFiles)try{await e.fs.stat(z),t.verbose&&(u+=`${w}: not overwritten, file exists
|
|
49
|
+
`);continue}catch{}let C=z.substring(0,z.lastIndexOf("/"));if(C)try{await e.fs.mkdir(C,{recursive:!0})}catch{}try{if(B(e))return N();await e.fs.symlink(m.linkTarget,z)}catch{}t.verbose&&(u+=`${w}
|
|
50
|
+
`)}}catch(C){if(B(e))return N();let A=C instanceof Error?C.message:"unknown error";y.push(`tar: ${w}: ${A}`)}}let d=u;return y.length>0&&(d+=`${y.join(`
|
|
51
|
+
`)}
|
|
52
|
+
`),{stdout:h,stderr:d,exitCode:y.length>0?2:0}}async function er(e,t,r){let n;if(t.file&&t.file!=="-"){let f=e.fs.resolvePath(e.cwd,t.file);try{n=await e.fs.readFileBuffer(f)}catch{return{stdout:"",stderr:`tar: ${t.file}: Cannot open: No such file or directory
|
|
53
|
+
`,exitCode:2}}}else n=Uint8Array.from(e.stdin,f=>f.charCodeAt(0));let i,s=t.gzip||xe(n),a=t.bzip2||be(n),o=t.xz||ze(n),c=t.zstd||Ce(n);if(s?i=await we(n,k(e)):a?i=await ve(n,k(e)):o?i=await ke(n,k(e)):c?i=await Ae(n,k(e)):i=await L(n,k(e)),i.error)return{stdout:"",stderr:`tar: ${i.error}
|
|
54
|
+
`,exitCode:2};let l="";for(let f of i.entries){if(B(e))return N();let u=tt(f.name,t.strip);if(!u)continue;let h=u.endsWith("/")?u.slice(0,-1):u;if(r.length>0){let y;if(t.wildcards?y=r.some(d=>se(u,d)||se(h,d)||u.startsWith(`${d}/`)):y=r.some(d=>u===d||u.startsWith(`${d}/`)||h===d),!y)continue}if(!Ee(u,t.exclude))if(t.verbose){let y=f.type==="directory",d=$e(f.mode,y),m=`${f.uid}/${f.gid}`,p=f.size.toString().padStart(8," "),b=Yt(f.mtime),w=`${d} ${m.padEnd(10)} ${p} ${b} ${u}`;f.type==="symlink"&&f.linkTarget&&(w+=` -> ${f.linkTarget}`),l+=`${w}
|
|
55
|
+
`}else l+=`${u}
|
|
56
|
+
`}return{stdout:l,stderr:"",exitCode:0}}var zr={name:"tar",async execute(e,t){if(B(t))return N();if(Be(e))return Se(Zt);let r=Qe(e);if(!r.ok)return r.error;let{options:n,files:i}=r,s=[n.create,n.append,n.update,n.extract,n.list].filter(Boolean).length;if(s===0)return{stdout:"",stderr:`tar: You must specify one of -c, -r, -u, -x, or -t
|
|
57
|
+
`,exitCode:2};if(s>1)return{stdout:"",stderr:`tar: You may not specify more than one of -c, -r, -u, -x, or -t
|
|
58
|
+
`,exitCode:2};if(n.autoCompress&&n.file&&n.create){let c=n.file.toLowerCase();c.endsWith(".tar.gz")||c.endsWith(".tgz")?n.gzip=!0:c.endsWith(".tar.bz2")||c.endsWith(".tbz2")?n.bzip2=!0:c.endsWith(".tar.xz")||c.endsWith(".txz")?n.xz=!0:(c.endsWith(".tar.zst")||c.endsWith(".tzst"))&&(n.zstd=!0)}let a=[n.gzip,n.bzip2,n.xz,n.zstd].filter(Boolean).length;if(a>1)return{stdout:"",stderr:`tar: You may not specify more than one compression option
|
|
59
|
+
`,exitCode:2};if((n.append||n.update)&&a>0)return{stdout:"",stderr:`tar: Cannot append/update compressed archives - decompress first
|
|
60
|
+
`,exitCode:2};let o=i;if(n.filesFrom){let c=t.fs.resolvePath(t.cwd,n.filesFrom);try{let f=(await t.fs.readFile(c)).split(`
|
|
61
|
+
`).map(u=>u.trim()).filter(u=>u.length>0&&!u.startsWith("#"));o=[...i,...f]}catch{return{stdout:"",stderr:`tar: ${n.filesFrom}: Cannot open: No such file or directory
|
|
62
|
+
`,exitCode:2}}}if(n.excludeFrom){let c=t.fs.resolvePath(t.cwd,n.excludeFrom);try{let f=(await t.fs.readFile(c)).split(`
|
|
63
|
+
`).map(u=>u.trim()).filter(u=>u.length>0&&!u.startsWith("#"));n.exclude.push(...f)}catch{return{stdout:"",stderr:`tar: ${n.excludeFrom}: Cannot open: No such file or directory
|
|
64
|
+
`,exitCode:2}}}return n.create?Kt(t,n,o):n.append?Jt(t,n,o):n.update?Vt(t,n,o):n.extract?Qt(t,n,o):er(t,n,o)}},vr={name:"tar",flags:[{flag:"-c",type:"boolean"},{flag:"-x",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-f",type:"value",valueHint:"path"},{flag:"-z",type:"boolean"},{flag:"-j",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-C",type:"value",valueHint:"path"},{flag:"--strip-components",type:"value",valueHint:"number"},{flag:"--exclude",type:"value",valueHint:"pattern"}],needsArgs:!0};export{zr as a,vr as b};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{a as h}from"./chunk-FOCWZZDE.js";import{a as m,b as g,c as p}from"./chunk-QAYAQNCG.js";var y={name:"ln",summary:"make links between files",usage:"ln [OPTIONS] TARGET LINK_NAME",options:["-s create a symbolic link instead of a hard link","-f remove existing destination files","-n treat LINK_NAME as a normal file if it is a symbolic link to a directory","-v print name of each linked file"," --help display this help and exit"]},v={name:"ln",async execute(n,s){if(g(n))return m(y);let i=!1,f=!1,d=!1,t=0;for(;t<n.length&&n[t].startsWith("-");){let e=n[t];if(e==="-s"||e==="--symbolic")i=!0,t++;else if(e==="-f"||e==="--force")f=!0,t++;else if(e==="-v"||e==="--verbose")d=!0,t++;else if(e==="-n"||e==="--no-dereference")t++;else if(/^-[sfvn]+$/.test(e))e.includes("s")&&(i=!0),e.includes("f")&&(f=!0),e.includes("v")&&(d=!0),t++;else if(e==="--"){t++;break}else return p("ln",e)}let r=n.slice(t);if(r.length<2)return{stdout:"",stderr:`ln: missing file operand
|
|
3
|
+
`,exitCode:1};if(r.length>2)return{stdout:"",stderr:`ln: extra operand '${r[2]}'
|
|
4
|
+
`,exitCode:1};let l=r[0],o=r[1],a=s.fs.resolvePath(s.cwd,o);if(await s.fs.exists(a))if(f)try{await s.fs.rm(a,{force:!0})}catch{return{stdout:"",stderr:`ln: cannot remove '${o}': Permission denied
|
|
5
|
+
`,exitCode:1}}else return{stdout:"",stderr:`ln: failed to create ${i?"symbolic ":""}link '${o}': File exists
|
|
6
|
+
`,exitCode:1};try{if(i)await s.fs.symlink(l,a);else{let e=s.fs.resolvePath(s.cwd,l);if(!await s.fs.exists(e))return{stdout:"",stderr:`ln: failed to access '${l}': No such file or directory
|
|
7
|
+
`,exitCode:1};await s.fs.link(e,a)}}catch(e){let u=e;return u.message.includes("EPERM")?{stdout:"",stderr:i?`ln: failed to create symbolic link '${o}': Operation not permitted
|
|
8
|
+
`:`ln: '${l}': hard link not allowed for directory
|
|
9
|
+
`,exitCode:1}:{stdout:"",stderr:`ln: ${h(u.message)}
|
|
10
|
+
`,exitCode:1}}let c="";return d&&(c=`'${o}' -> '${l}'
|
|
11
|
+
`),{stdout:c,stderr:"",exitCode:0}}},$={name:"ln",flags:[{flag:"-s",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2};export{v as a,$ as b};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{b as P,c as F,d as O,e as T}from"./chunk-7IJWBG4I.js";import{b as S}from"./chunk-YUSFCOM7.js";import{l as v,m as w}from"./chunk-TVCZIH6M.js";import{a as E}from"./chunk-QIQMJJZ4.js";import{a as D}from"./chunk-W5DWRFSU.js";import{a as $,b as C}from"./chunk-QAYAQNCG.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
|
|
3
|
+
`,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
|
|
4
|
+
`,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}'
|
|
5
|
+
`,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}'
|
|
6
|
+
`,i=1;continue}if(c==="unknown"){n+=`cp: cannot safely determine whether '${r}' is inside '${t}'
|
|
7
|
+
`,i=1;continue}}if(k)try{await e.fs.stat(r);continue}catch{}let b=await P(e.fs,o,r);if(b==="same"){n+=`cp: '${t}' and '${r}' are the same file
|
|
8
|
+
`,i=1;continue}if(b==="unknown"){n+=`cp: cannot safely determine whether '${t}' and '${r}' are the same file
|
|
9
|
+
`,i=1;continue}a.isDirectory&&await T({fs:e.fs,root:o,limits:e.limits,signal:e.signal,executionScope:e.executionScope,site:"cp",symlinks:"never",budget:h},()=>{}),await e.fs.cp(o,r,{recursive:d}),N&&(y+=`'${t}' -> '${r}'
|
|
10
|
+
`)}catch(o){if(o instanceof v||o instanceof w)throw o;let a=D(o);a.includes("ENOENT")||a.includes("no such file")?n+=`cp: cannot stat '${t}': No such file or directory
|
|
11
|
+
`:n+=`cp: cannot copy '${t}': ${a}
|
|
12
|
+
`,i=1}return{stdout:y,stderr:n,exitCode:i}}},q={name:"cp",flags:[{flag:"-r",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-p",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2};export{j as a,q as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
var u=new TextEncoder,a=new TextDecoder;function o(r,i){if(r instanceof Uint8Array)return r;if(i==="base64")return Uint8Array.from(atob(r),t=>t.charCodeAt(0));if(i==="hex"){let t=new Uint8Array(r.length/2);for(let n=0;n<r.length;n+=2)t[n/2]=parseInt(r.slice(n,n+2),16);return t}if(i==="binary"||i==="latin1"){if(r.length<=65536)return Uint8Array.from(r,e=>e.charCodeAt(0));let n=new Uint8Array(r.length);for(let e=0;e<r.length;e++)n[e]=r.charCodeAt(e);return n}return u.encode(r)}function h(r,i){if(i==="base64"){if(typeof Buffer<"u")return Buffer.from(r).toString("base64");let t=65536,n="";for(let e=0;e<r.length;e+=t){let f=r.subarray(e,e+t);n+=String.fromCharCode(...f)}return btoa(n)}if(i==="hex")return Array.from(r).map(t=>t.toString(16).padStart(2,"0")).join("");if(i==="binary"||i==="latin1"){if(typeof Buffer<"u")return Buffer.from(r).toString(i);let t=65536;if(r.length<=t)return String.fromCharCode(...r);let n="";for(let e=0;e<r.length;e+=t){let f=r.subarray(e,e+t);n+=String.fromCharCode(...f)}return n}return a.decode(r)}function l(r){if(r!=null)return typeof r=="string"?r:r.encoding??void 0}export{o as a,h as b,l as c};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{b as a}from"./chunk-ZBUZKIPX.js";var s=globalThis.setTimeout.bind(globalThis),l=globalThis.clearTimeout.bind(globalThis),T=globalThis.setInterval.bind(globalThis),f=globalThis.clearInterval.bind(globalThis);function u(e){return typeof e!="function"?e:a.bindCurrentContext(e)}var b=((e,n,...i)=>s(u(e),n,...i)),d=l,c=2147483647;function I(e,n){if(n===Number.POSITIVE_INFINITY)return;let i=u(e),t={cleared:!1,remainingMs:Math.max(0,n),timer:void 0},r=()=>{if(t.cleared)return;let o=Math.min(t.remainingMs,c);t.timer=s(()=>{t.cleared||(t.remainingMs-=o,t.remainingMs>0?r():i())},o)};return r(),t}function _(e){e&&(e.cleared=!0,e.timer!==void 0&&l(e.timer))}export{b as a,d as b,I as c,_ as d};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
var o=class{options;inputBytes=0;outputBytes=0;workBytes=0;label;constructor(t){this.options=t,this.label=t.label??"codec";for(let[i,e]of[["maxInputBytes",t.maxInputBytes],["maxOutputBytes",t.maxOutputBytes],["maxExpansionRatio",t.maxExpansionRatio],["ratioGraceBytes",t.ratioGraceBytes],["maxWorkBytes",t.maxWorkBytes]])if(e!==void 0&&(!Number.isSafeInteger(e)||e<0))throw new Error(`${this.label}: invalid ${i}`)}checkpoint(){if(this.options.signal?.aborted)throw new Error(`${this.label}: operation aborted`)}acceptInput(t){this.checkpoint(),this.inputBytes=this.addWithinLimit(this.inputBytes,t,this.options.maxInputBytes,"input"),this.chargeWork(t)}acceptOutput(t){this.checkpoint();let i=this.addWithinLimit(this.outputBytes,t,this.options.maxOutputBytes,"output"),e=this.options.ratioGraceBytes??1024*1024,s=this.options.maxExpansionRatio;if(s!==void 0&&i>e&&(this.inputBytes===0||i>this.inputBytes*s))throw new Error(`${this.label}: expansion ratio exceeds limit (${s}:1)`);this.outputBytes=i,this.chargeWork(t)}get inputLength(){return this.inputBytes}get outputLength(){return this.outputBytes}chargeWork(t){let i=this.options.maxWorkBytes??this.options.maxInputBytes+this.options.maxOutputBytes;this.workBytes=this.addWithinLimit(this.workBytes,t,i,"work")}addWithinLimit(t,i,e,s){if(!Number.isSafeInteger(i)||i<0||i>e-t)throw new Error(`${this.label}: ${s} exceeds limit (${e} bytes)`);return t+i}};export{o as a};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{a as w}from"./chunk-SX2HC7SO.js";import{a as b}from"./chunk-BRJERIF4.js";import{a as h,b as A}from"./chunk-WXPNKIIH.js";import{a as y}from"./chunk-L2UW7DWF.js";import{a as v,b as O,c as d}from"./chunk-QAYAQNCG.js";var x={name:"timeout",summary:"run a command with a time limit",usage:"timeout [OPTION] DURATION COMMAND [ARG]...",description:`Start COMMAND, and kill it if still running after DURATION.
|
|
3
|
+
|
|
4
|
+
DURATION is a number with optional suffix:
|
|
5
|
+
s - seconds (default)
|
|
6
|
+
m - minutes
|
|
7
|
+
h - hours
|
|
8
|
+
d - days`,options:["-k, --kill-after=DURATION send KILL signal after DURATION if still running","-s, --signal=SIGNAL specify signal to send (default: TERM)"," --preserve-status exit with same status as COMMAND, even on timeout"," --foreground run command in foreground"," --help display this help and exit"]},R={name:"timeout",async execute(n,s){if(O(n))return v(x);let i=0;for(let e=0;e<n.length;e++){let t=n[e];if(t==="--preserve-status")i=e+1;else if(t==="--foreground")i=e+1;else if(t==="-k"||t==="--kill-after")e++,i=e+1;else if(t.startsWith("--kill-after="))i=e+1;else if(t==="-s"||t==="--signal")e++,i=e+1;else if(t.startsWith("--signal="))i=e+1;else{if(t.startsWith("--")&&t!=="--")return d("timeout",t);if(t.startsWith("-")&&t.length>1&&t!=="--")if(t.startsWith("-k"))i=e+1;else if(t.startsWith("-s"))i=e+1;else return d("timeout",t);else{i=e;break}}}let a=n.slice(i);if(a.length===0)return{stdout:"",stderr:`timeout: missing operand
|
|
9
|
+
`,exitCode:1};let f=a[0],g=w(f);if(g===null)return{stdout:"",stderr:`timeout: invalid time interval '${f}'
|
|
10
|
+
`,exitCode:1};let l=a.slice(1);if(l.length===0)return{stdout:"",stderr:`timeout: missing operand
|
|
11
|
+
`,exitCode:1};if(!s.exec)return{stdout:"",stderr:`timeout: exec not available
|
|
12
|
+
`,exitCode:1};let c=new AbortController,r=b(s.signal,c.signal),u,o;try{let e=new Promise(m=>{o=()=>m({timedOut:!0}),r.signal?.addEventListener("abort",o,{once:!0}),u=h(()=>{c.abort()},g)}),t=s.exec(y([l[0]]),{cwd:s.cwd,signal:r.signal,stdin:s.stdin,stdinKind:"bytes",args:l.slice(1)}).then(m=>({timedOut:!1,result:m})),p=await Promise.race([e,t]);return p.timedOut?(await t.catch(()=>{}),{stdout:"",stderr:"",exitCode:124}):p.result}finally{u!==void 0&&A(u),o&&r.signal?.removeEventListener("abort",o),r.cleanup()}}},L={name:"timeout",flags:[{flag:"-k",type:"value",valueHint:"string"},{flag:"-s",type:"value",valueHint:"string"},{flag:"--preserve-status",type:"boolean"},{flag:"--foreground",type:"boolean"}],needsArgs:!0,minArgs:2};export{R as a,L as b};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{d as k}from"./chunk-7IJWBG4I.js";import{l as u,m}from"./chunk-TVCZIH6M.js";import{a as h,b as p,c as g}from"./chunk-QAYAQNCG.js";var w={name:"readlink",summary:"print resolved symbolic links or canonical file names",usage:"readlink [OPTIONS] FILE...",options:["-f canonicalize by following every symlink in every component of the given name recursively"," --help display this help and exit"]},x={name:"readlink",async execute(r,n){if(p(r))return h(w);let l=!1,t=0;for(;t<r.length&&r[t].startsWith("-");){let i=r[t];if(i==="-f"||i==="--canonicalize")l=!0,t++;else if(i==="--"){t++;break}else return g("readlink",i)}let c=r.slice(t);if(c.length===0)return{stdout:"",stderr:`readlink: missing operand
|
|
3
|
+
`,exitCode:1};let a="",d=!1,y=new k({limits:n.limits,signal:n.signal,executionScope:n.executionScope,site:"readlink",label:"symlink traversal"});for(let i of c){let s=n.fs.resolvePath(n.cwd,i);try{if(l){let e=s,o=new Set;for(;y.visit(o.size),!o.has(e);){o.add(e);try{let f=await n.fs.readlink(e);if(f.startsWith("/"))e=f;else{let b=e.substring(0,e.lastIndexOf("/"))||"/";e=n.fs.resolvePath(b,f)}}catch{break}}a+=`${e}
|
|
4
|
+
`}else{let e=await n.fs.readlink(s);a+=`${e}
|
|
5
|
+
`}}catch(e){if(e instanceof u||e instanceof m)throw e;l?a+=`${s}
|
|
6
|
+
`:d=!0}}return{stdout:a,stderr:"",exitCode:d?1:0}}},F={name:"readlink",flags:[{flag:"-f",type:"boolean"},{flag:"-e",type:"boolean"}],needsArgs:!0};export{x as a,F as b};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{b as x}from"./chunk-AYSZ5MAE.js";import{d as g}from"./chunk-FTET43KM.js";import{l as S}from"./chunk-TVCZIH6M.js";import{g as y}from"./chunk-GN6CQ3J4.js";async function F(a,n){let s="octal",o=[],p=[];for(let t=0;t<a.length;t++){let e=a[t];if(e==="-c")o.push("char");else if(e==="-An"||e==="-A"&&a[t+1]==="n")s="none",e==="-A"&&t++;else if(e==="-t"&&a[t+1]){let r=a[++t];r==="x1"?o.push("hex"):r==="c"?o.push("char"):r.startsWith("o")&&o.push("octal")}else(!e.startsWith("-")||e==="-")&&p.push(e)}o.length===0&&o.push("octal");let m=new g(n.limits.maxInputBytes,"od input"),A=p.length===0?["-"]:p;for(let t of A){if(t==="-"){m.append(n.stdin);continue}let e=t.startsWith("/")?t:`${n.cwd}/${t}`;try{let r=await y(n.fs,e);n.executionScope?.consumeInput(r.length,"od"),m.append(r)}catch(r){return x(r),{stdout:"",stderr:`od: ${t}: No such file or directory
|
|
3
|
+
`,exitCode:1}}}let C=o.includes("char");function $(t){return t===0?" \\0":t===7?" \\a":t===8?" \\b":t===9?" \\t":t===10?" \\n":t===11?" \\v":t===12?" \\f":t===13?" \\r":t>=32&&t<127?` ${String.fromCharCode(t)}`:` ${t.toString(8).padStart(3,"0")}`}function B(t){return C?` ${t.toString(16).padStart(2,"0")}`:` ${t.toString(16).padStart(2,"0")}`}function w(t){return` ${t.toString(8).padStart(3,"0")}`}let i=m.build(),u=16,d=new g(Math.min(n.limits.maxOutputSize,n.limits.maxStringLength),"od"),h=o.length;if(h>0&&i.length>Math.floor(n.limits.maxLoopIterations/h))throw new S(`od: format work limit exceeded (${n.limits.maxLoopIterations})`,"iterations");n.executionScope?.consumeWork(i.length*h,"od formatting");for(let t=0;t<i.length;t+=u)for(let e=0;e<o.length;e++){let r=o[e],l;r==="char"?l=Array.from(i.slice(t,t+u),f=>$(f.charCodeAt(0))):r==="hex"?l=Array.from(i.slice(t,t+u),f=>B(f.charCodeAt(0))):l=Array.from(i.slice(t,t+u),f=>w(f.charCodeAt(0)));let c="";e===0&&s!=="none"?c=`${t.toString(8).padStart(7,"0")} `:(e>0||s==="none")&&(c=s==="none"?"":" "),d.append(c+l.join("")).append(`
|
|
4
|
+
`)}return s!=="none"&&i.length>0&&d.append(i.length.toString(8).padStart(7,"0")).append(`
|
|
5
|
+
`),{stdout:d.build(),stderr:"",exitCode:0}}var H={name:"od",execute:F},W={name:"od",flags:[{flag:"-c",type:"boolean"},{flag:"-A",type:"value",valueHint:"string"},{flag:"-t",type:"value",valueHint:"string"},{flag:"-N",type:"value",valueHint:"number"}],stdinType:"text",needsFiles:!0};export{H as a,W as b};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{a as c,d as p}from"./chunk-GN6CQ3J4.js";import{a as h,b,c as w}from"./chunk-QAYAQNCG.js";var g={name:"fold",summary:"wrap each input line to fit in specified width",usage:"fold [OPTION]... [FILE]...",description:"Wrap input lines in each FILE, writing to standard output. If no FILE is specified, standard input is read.",options:["-w WIDTH Use WIDTH columns instead of 80","-s Break at spaces","-b Count bytes rather than columns"],examples:["fold -w 40 file.txt # Wrap at 40 columns","fold -sw 40 file.txt # Word wrap at 40 columns","echo 'long line' | fold -w 5 # Force wrap at 5"]};function y(s,r,n){return n?c(s):s===" "?8-r%8:s==="\b"?-1:1}function N(s,r){if(s.length===0)return s;let{width:n,breakAtSpaces:u,countBytes:i}=r,l=[],e="",t=0,o=-1,f=0;for(let a of s){let d=y(a,t,i);t+d>n&&e.length>0?u&&o>=0?(l.push(e.slice(0,o+1)),e=e.slice(o+1)+a,t=t-f-1+d,o=-1,f=0):(l.push(e),e=a,t=d,o=-1,f=0):(e+=a,t+=d,(a===" "||a===" ")&&(o=e.length-1,f=t-d))}return e.length>0&&l.push(e),l.join(`
|
|
3
|
+
`)}function m(s,r){if(s==="")return"";let n=s.split(`
|
|
4
|
+
`),u=s.endsWith(`
|
|
5
|
+
`)&&n[n.length-1]==="";return u&&n.pop(),n.map(l=>N(l,r)).join(`
|
|
6
|
+
`)+(u?`
|
|
7
|
+
`:"")}var x={name:"fold",execute:async(s,r)=>{if(b(s))return h(g);let n={width:80,breakAtSpaces:!1,countBytes:!1},u=[],i=0;for(;i<s.length;){let e=s[i];if(e==="-w"&&i+1<s.length){let t=parseInt(s[i+1],10);if(Number.isNaN(t)||t<1)return{exitCode:1,stdout:"",stderr:`fold: invalid number of columns: '${s[i+1]}'
|
|
8
|
+
`};n.width=t,i+=2}else if(e.startsWith("-w")&&e.length>2){let t=parseInt(e.slice(2),10);if(Number.isNaN(t)||t<1)return{exitCode:1,stdout:"",stderr:`fold: invalid number of columns: '${e.slice(2)}'
|
|
9
|
+
`};n.width=t,i++}else if(e==="-s")n.breakAtSpaces=!0,i++;else if(e==="-b")n.countBytes=!0,i++;else if(e==="-bs"||e==="-sb")n.breakAtSpaces=!0,n.countBytes=!0,i++;else if(e.match(/^-[sb]+w\d+$/)){e.includes("s")&&(n.breakAtSpaces=!0),e.includes("b")&&(n.countBytes=!0);let t=e.replace(/^-[sb]+w/,""),o=parseInt(t,10);if(Number.isNaN(o)||o<1)return{exitCode:1,stdout:"",stderr:`fold: invalid number of columns: '${t}'
|
|
10
|
+
`};n.width=o,i++}else if(e.match(/^-[sb]+w$/)&&i+1<s.length){e.includes("s")&&(n.breakAtSpaces=!0),e.includes("b")&&(n.countBytes=!0);let t=parseInt(s[i+1],10);if(Number.isNaN(t)||t<1)return{exitCode:1,stdout:"",stderr:`fold: invalid number of columns: '${s[i+1]}'
|
|
11
|
+
`};n.width=t,i+=2}else if(e==="--"){u.push(...s.slice(i+1));break}else if(e.startsWith("-")&&e!=="-"){let t=e.slice(1),o=!1;for(let f of t)if(f==="s")n.breakAtSpaces=!0;else if(f==="b")n.countBytes=!0;else{o=!0;break}if(o)return w("fold",e);i++}else u.push(e),i++}let l="";if(u.length===0){let e=p(r.stdin)??"";l=m(e,n)}else for(let e of u){let t=r.fs.resolvePath(r.cwd,e),o=await r.fs.readFile(t);if(o===null)return{exitCode:1,stdout:l,stderr:`fold: ${e}: No such file or directory
|
|
12
|
+
`};l+=m(o,n)}return{exitCode:0,stdout:l,stderr:""}}},C={name:"fold",flags:[{flag:"-w",type:"value",valueHint:"number"},{flag:"-s",type:"boolean"},{flag:"-b",type:"boolean"}],stdinType:"text",needsFiles:!0};export{x as a,C as b};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{l as p}from"./chunk-TVCZIH6M.js";import{f as m,g as d}from"./chunk-GN6CQ3J4.js";function B(e,t,n){if(!Number.isSafeInteger(t)||t<0||t>e.limits.maxInputBytes)throw new p(`${n}: input size limit exceeded (${e.limits.maxInputBytes} bytes)`,"string_length");e.executionScope?.consumeInput(t,n)}async function y(e,t,n){let{cmdName:o,allowStdinMarker:u=!0,stopOnError:s=!1,batchSize:f=100}=n;if(t.length===0)return{files:[{filename:"",content:e.stdin}],stderr:"",exitCode:0};let a=[],c="",l=0;for(let i=0;i<t.length;i+=f){let h=t.slice(i,i+f),E=await Promise.all(h.map(async r=>{if(u&&r==="-")return{filename:"-",content:e.stdin,error:null};try{let w=e.fs.resolvePath(e.cwd,r),x=await d(e.fs,w);return{filename:r,content:x,error:null}}catch{return{filename:r,content:m,error:`${o}: ${r}: No such file or directory
|
|
3
|
+
`}}}));for(let r of E)if(r.error){if(c+=r.error,l=1,s)return{files:a,stderr:c,exitCode:l}}else a.push({filename:r.filename,content:r.content})}return{files:a,stderr:c,exitCode:l}}async function F(e,t,n){let o=await y(e,t,{...n,stopOnError:!0});return o.exitCode!==0?{ok:!1,error:{stdout:"",stderr:o.stderr,exitCode:o.exitCode}}:{ok:!0,content:o.files.map(s=>s.content).join("")}}export{B as a,y as b,F as c};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{b as D}from"./chunk-WNH3HOQA.js";import{a as A,b as h}from"./chunk-KIGPB52X.js";import{c as F,d as g}from"./chunk-WXPNKIIH.js";import{a as O}from"./chunk-L2UW7DWF.js";import{b as T}from"./chunk-ZBUZKIPX.js";import{a as m,b as w}from"./chunk-FOCWZZDE.js";var n={NOOP:0,READ_FILE:1,WRITE_FILE:2,STAT:3,READDIR:4,MKDIR:5,RM:6,EXISTS:7,APPEND_FILE:8,SYMLINK:9,READLINK:10,LSTAT:11,CHMOD:12,REALPATH:13,RENAME:14,COPY_FILE:15,WRITE_STDOUT:100,WRITE_STDERR:101,EXIT:102,HTTP_REQUEST:200,EXEC_COMMAND:300,INVOKE_TOOL:400},r={PENDING:0,READY:1,SUCCESS:2,ERROR:3},l={NONE:0,NOT_FOUND:1,IS_DIRECTORY:2,NOT_DIRECTORY:3,EXISTS:4,PERMISSION_DENIED:5,INVALID_PATH:6,IO_ERROR:7,TIMEOUT:8,NETWORK_ERROR:9,NETWORK_NOT_CONFIGURED:10},o={OP_CODE:0,STATUS:4,PATH_LENGTH:8,DATA_LENGTH:12,RESULT_LENGTH:16,ERROR_CODE:20,FLAGS:24,MODE:28,PATH_BUFFER:32,DATA_BUFFER:4128},p={CONTROL_REGION:32,PATH_BUFFER:4096,DATA_BUFFER:8388608,TOTAL:8392736},S={NONE:0,RECURSIVE:1,FORCE:2,MKDIR_RECURSIVE:1},u={IS_FILE:0,IS_DIRECTORY:1,IS_SYMLINK:2,MODE:4,SIZE:8,MTIME:16,TOTAL:24};function x(){return new A(p.TOTAL)}var R=class{int32View;uint8View;dataView;constructor(t){this.int32View=new Int32Array(t),this.uint8View=new Uint8Array(t),this.dataView=new DataView(t)}getOpCode(){return h.load(this.int32View,o.OP_CODE/4)}setOpCode(t){h.store(this.int32View,o.OP_CODE/4,t)}getStatus(){return h.load(this.int32View,o.STATUS/4)}setStatus(t){h.store(this.int32View,o.STATUS/4,t)}getPathLength(){return h.load(this.int32View,o.PATH_LENGTH/4)}setPathLength(t){h.store(this.int32View,o.PATH_LENGTH/4,t)}getDataLength(){return h.load(this.int32View,o.DATA_LENGTH/4)}setDataLength(t){h.store(this.int32View,o.DATA_LENGTH/4,t)}getResultLength(){return h.load(this.int32View,o.RESULT_LENGTH/4)}setResultLength(t){h.store(this.int32View,o.RESULT_LENGTH/4,t)}getErrorCode(){return h.load(this.int32View,o.ERROR_CODE/4)}setErrorCode(t){h.store(this.int32View,o.ERROR_CODE/4,t)}getFlags(){return h.load(this.int32View,o.FLAGS/4)}setFlags(t){h.store(this.int32View,o.FLAGS/4,t)}getMode(){return h.load(this.int32View,o.MODE/4)}setMode(t){h.store(this.int32View,o.MODE/4,t)}getPath(){let t=this.getPathLength(),e=this.uint8View.slice(o.PATH_BUFFER,o.PATH_BUFFER+t);return new TextDecoder().decode(e)}setPath(t){let e=new TextEncoder().encode(t);if(e.length>p.PATH_BUFFER)throw new Error(`Path too long: ${e.length} > ${p.PATH_BUFFER}`);this.uint8View.set(e,o.PATH_BUFFER),this.setPathLength(e.length)}getData(){let t=this.getDataLength();return this.uint8View.slice(o.DATA_BUFFER,o.DATA_BUFFER+t)}setData(t){if(t.length>p.DATA_BUFFER)throw new Error(`Data too large: ${t.length} > ${p.DATA_BUFFER}`);this.uint8View.set(t,o.DATA_BUFFER),this.setDataLength(t.length)}getDataAsString(){let t=this.getData();return new TextDecoder().decode(t)}setDataFromString(t){let e=new TextEncoder().encode(t);this.setData(e)}getResult(){let t=this.getResultLength();return this.uint8View.slice(o.DATA_BUFFER,o.DATA_BUFFER+t)}setResult(t){if(t.length>p.DATA_BUFFER)throw new Error(`Result too large: ${t.length} > ${p.DATA_BUFFER}`);this.uint8View.set(t,o.DATA_BUFFER),this.setResultLength(t.length)}getResultAsString(){let t=this.getResult();return new TextDecoder().decode(t)}setResultFromString(t){let e=new TextEncoder().encode(t);this.setResult(e)}encodeStat(t){this.uint8View[o.DATA_BUFFER+u.IS_FILE]=t.isFile?1:0,this.uint8View[o.DATA_BUFFER+u.IS_DIRECTORY]=t.isDirectory?1:0,this.uint8View[o.DATA_BUFFER+u.IS_SYMLINK]=t.isSymbolicLink?1:0,this.dataView.setInt32(o.DATA_BUFFER+u.MODE,t.mode,!0);let e=Math.min(t.size,Number.MAX_SAFE_INTEGER);this.dataView.setFloat64(o.DATA_BUFFER+u.SIZE,e,!0),this.dataView.setFloat64(o.DATA_BUFFER+u.MTIME,t.mtime.getTime(),!0),this.setResultLength(u.TOTAL)}decodeStat(){return{isFile:this.uint8View[o.DATA_BUFFER+u.IS_FILE]===1,isDirectory:this.uint8View[o.DATA_BUFFER+u.IS_DIRECTORY]===1,isSymbolicLink:this.uint8View[o.DATA_BUFFER+u.IS_SYMLINK]===1,mode:this.dataView.getInt32(o.DATA_BUFFER+u.MODE,!0),size:this.dataView.getFloat64(o.DATA_BUFFER+u.SIZE,!0),mtime:new Date(this.dataView.getFloat64(o.DATA_BUFFER+u.MTIME,!0))}}waitForReady(t){return h.wait(this.int32View,o.STATUS/4,r.PENDING,t)}waitForReadyAsync(t){return h.waitAsync(this.int32View,o.STATUS/4,r.PENDING,t)}async waitUntilReady(t){let e=Date.now();for(;;){let a=this.getStatus();if(a===r.READY)return!0;let s=Date.now()-e;if(s>=t)return!1;let i=t-s,c=h.waitAsync(this.int32View,o.STATUS/4,a,i);if(c.async&&await c.value==="timed-out")return!1}}waitForResult(t){return h.wait(this.int32View,o.STATUS/4,r.READY,t)}notify(){return h.notify(this.int32View,o.STATUS/4)}reset(){this.setOpCode(n.NOOP),this.setStatus(r.PENDING),this.setPathLength(0),this.setDataLength(0),this.setResultLength(0),this.setErrorCode(l.NONE),this.setFlags(S.NONE),this.setMode(0)}};var C=class{fs;cwd;commandName;secureFetch;maxOutputSize;exec;invokeTool;protocol;running=!1;output={stdout:"",stderr:"",exitCode:0};outputLimitExceeded=!1;startTime=0;timeoutMs=0;constructor(t,e,a,s,i=void 0,c=0,d=void 0,E=void 0){this.fs=e,this.cwd=a,this.commandName=s,this.secureFetch=i,this.maxOutputSize=c,this.exec=d,this.invokeTool=E,this.protocol=new R(t)}remainingMs(){return Math.max(0,this.timeoutMs-(Date.now()-this.startTime))}raceDeadline(t){let e=this.remainingMs();if(e<=0)return this.running=!1,this.output.exitCode=124,this.output.stderr+=`
|
|
3
|
+
${this.commandName}: execution timeout exceeded
|
|
4
|
+
`,Promise.reject(new Error("Operation timed out"));let a=t();return e===Number.POSITIVE_INFINITY?a:new Promise((s,i)=>{let c=F(()=>{this.running=!1,this.output.exitCode=124,this.output.stderr+=`
|
|
5
|
+
${this.commandName}: execution timeout exceeded
|
|
6
|
+
`,i(new Error("Operation timed out"))},e);a.then(d=>{g(c),s(d)},d=>{g(c),i(d)})})}async run(t){for(this.running=!0,this.startTime=Date.now(),this.timeoutMs=t;this.running;){if(Date.now()-this.startTime>=t){this.output.stderr+=`
|
|
7
|
+
${this.commandName}: execution timeout exceeded
|
|
8
|
+
`,this.output.exitCode=124;break}let a=this.remainingMs();if(!await this.protocol.waitUntilReady(a)){this.output.stderr+=`
|
|
9
|
+
${this.commandName}: execution timeout exceeded
|
|
10
|
+
`,this.output.exitCode=124;break}if(!this.running)break;let i=this.protocol.getOpCode();await this.handleOperation(i),this.protocol.notify()}return this.output}stop(){this.running=!1,this.protocol.setStatus(r.READY),this.protocol.notify()}async handleOperation(t){try{switch(t){case n.READ_FILE:await this.handleReadFile();break;case n.WRITE_FILE:await this.handleWriteFile();break;case n.STAT:await this.handleStat();break;case n.LSTAT:await this.handleLstat();break;case n.READDIR:await this.handleReaddir();break;case n.MKDIR:await this.handleMkdir();break;case n.RM:await this.handleRm();break;case n.EXISTS:await this.handleExists();break;case n.APPEND_FILE:await this.handleAppendFile();break;case n.SYMLINK:await this.handleSymlink();break;case n.READLINK:await this.handleReadlink();break;case n.CHMOD:await this.handleChmod();break;case n.REALPATH:await this.handleRealpath();break;case n.RENAME:await this.handleRename();break;case n.COPY_FILE:await this.handleCopyFile();break;case n.WRITE_STDOUT:this.handleWriteStdout();break;case n.WRITE_STDERR:this.handleWriteStderr();break;case n.EXIT:this.handleExit();break;case n.HTTP_REQUEST:await this.handleHttpRequest();break;case n.EXEC_COMMAND:await this.handleExecCommand();break;case n.INVOKE_TOOL:await this.handleInvokeTool();break;default:this.protocol.setErrorCode(l.IO_ERROR),this.protocol.setStatus(r.ERROR)}}catch(e){this.setErrorFromException(e)}}resolvePath(t){return this.fs.resolvePath(this.cwd,t)}async handleReadFile(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readFileBuffer(t);this.protocol.setResult(e),this.protocol.setStatus(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleWriteFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.writeFile(t,e),this.protocol.setStatus(r.SUCCESS)}catch(a){this.setErrorFromException(a)}}async handleStat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.stat(t);this.protocol.encodeStat(e),this.protocol.setStatus(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleLstat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.lstat(t);this.protocol.encodeStat(e),this.protocol.setStatus(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleReaddir(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readdir(t);this.protocol.setResultFromString(JSON.stringify(e)),this.protocol.setStatus(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleMkdir(){let t=this.resolvePath(this.protocol.getPath()),a=(this.protocol.getFlags()&S.MKDIR_RECURSIVE)!==0;try{await this.fs.mkdir(t,{recursive:a}),this.protocol.setStatus(r.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleRm(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getFlags(),a=(e&S.RECURSIVE)!==0,s=(e&S.FORCE)!==0;try{await this.fs.rm(t,{recursive:a,force:s}),this.protocol.setStatus(r.SUCCESS)}catch(i){this.setErrorFromException(i)}}async handleExists(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.exists(t);this.protocol.setResult(new Uint8Array([e?1:0])),this.protocol.setStatus(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleAppendFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.appendFile(t,e),this.protocol.setStatus(r.SUCCESS)}catch(a){this.setErrorFromException(a)}}async handleSymlink(){let t=this.protocol.getPath(),e=this.protocol.getDataAsString(),a=this.resolvePath(t);try{await this.fs.symlink(e,a),this.protocol.setStatus(r.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleReadlink(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readlink(t);this.protocol.setResultFromString(e),this.protocol.setStatus(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleChmod(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getMode();try{await this.fs.chmod(t,e),this.protocol.setStatus(r.SUCCESS)}catch(a){this.setErrorFromException(a)}}async handleRealpath(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.realpath(t);this.protocol.setResultFromString(e),this.protocol.setStatus(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleRename(){let t=this.resolvePath(this.protocol.getPath()),e=this.resolvePath(this.protocol.getDataAsString());try{await this.fs.mv(t,e),this.protocol.setStatus(r.SUCCESS)}catch(a){this.setErrorFromException(a)}}async handleCopyFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.resolvePath(this.protocol.getDataAsString());try{await this.fs.cp(t,e),this.protocol.setStatus(r.SUCCESS)}catch(a){this.setErrorFromException(a)}}handleWriteStdout(){let t=this.protocol.getDataAsString();if(!this.tryAppendOutput("stdout",t)){this.outputLimitExceeded=!0,this.output.exitCode=1,this.appendOutputLimitError(),this.protocol.setErrorCode(l.IO_ERROR),this.protocol.setResultFromString("Output size limit exceeded"),this.protocol.setStatus(r.ERROR);return}this.protocol.setStatus(r.SUCCESS)}handleWriteStderr(){let t=this.protocol.getDataAsString();if(!this.tryAppendOutput("stderr",t)){this.outputLimitExceeded=!0,this.output.exitCode=1,this.appendOutputLimitError(),this.protocol.setErrorCode(l.IO_ERROR),this.protocol.setResultFromString("Output size limit exceeded"),this.protocol.setStatus(r.ERROR);return}this.protocol.setStatus(r.SUCCESS)}handleExit(){let t=this.protocol.getFlags();this.outputLimitExceeded?this.output.exitCode===0&&(this.output.exitCode=1):this.output.exitCode=t,this.protocol.setStatus(r.SUCCESS),this.running=!1}tryAppendOutput(t,e){return this.outputLimitExceeded?!1:this.maxOutputSize<=0?(t==="stdout"?this.output.stdout+=e:this.output.stderr+=e,!0):this.output.stdout.length+this.output.stderr.length+e.length>this.maxOutputSize?!1:(t==="stdout"?this.output.stdout+=e:this.output.stderr+=e,!0)}appendOutputLimitError(){if(this.maxOutputSize<=0)return;let t=`${this.commandName}: total output size exceeded (>${this.maxOutputSize} bytes), increase executionLimits.maxOutputSize
|
|
11
|
+
`,e=t.length>this.maxOutputSize?t.slice(0,this.maxOutputSize):t;if(this.output.stderr.includes("total output size exceeded"))return;let s=this.output.stdout.length+this.output.stderr.length+e.length-this.maxOutputSize;if(s>0)if(this.output.stdout.length>=s)this.output.stdout=this.output.stdout.slice(0,this.output.stdout.length-s);else{let i=s-this.output.stdout.length;this.output.stdout="",i>=this.output.stderr.length?this.output.stderr="":this.output.stderr=this.output.stderr.slice(0,this.output.stderr.length-i)}this.output.stderr+=e}async handleHttpRequest(){let t=this.secureFetch;if(!t){this.protocol.setErrorCode(l.NETWORK_NOT_CONFIGURED),this.protocol.setResultFromString("Network access not configured. Enable network in Bash options."),this.protocol.setStatus(r.ERROR);return}let e=this.protocol.getPath(),a=this.protocol.getDataAsString();try{let s=a?JSON.parse(a):{},i=this.remainingMs(),c=await this.raceDeadline(()=>t(e,{method:s.method,headers:s.headers,body:s.body,timeoutMs:i})),d=JSON.stringify({status:c.status,statusText:c.statusText,headers:c.headers,bodyBase64:D(c.body,"base64"),url:c.url});this.protocol.setResultFromString(d),this.protocol.setStatus(r.SUCCESS)}catch(s){let i=m(s instanceof Error?s.message:String(s));this.protocol.setErrorCode(l.NETWORK_ERROR),this.protocol.setResultFromString(i),this.protocol.setStatus(r.ERROR)}}async handleExecCommand(){let t=this.exec;if(!t){this.protocol.setErrorCode(l.IO_ERROR),this.protocol.setResultFromString("Command execution not available in this context."),this.protocol.setStatus(r.ERROR);return}let e=this.protocol.getPath(),a=this.protocol.getDataAsString(),s=new AbortController;try{let i={cwd:this.cwd,signal:s.signal};if(a){let E=JSON.parse(a);E.stdin&&(i.stdin=E.stdin),E.args&&Array.isArray(E.args)&&(i.args=E.args.map(f=>String(f)),e=O([e]))}let c=await this.raceDeadline(()=>t(e,i)),d=JSON.stringify({stdout:c.stdout,stderr:c.stderr,exitCode:c.exitCode});this.protocol.setResultFromString(d),this.protocol.setStatus(r.SUCCESS)}catch(i){s.abort();let c=i instanceof Error?i.message:String(i);this.protocol.setErrorCode(l.IO_ERROR),this.protocol.setResultFromString(c),this.protocol.setStatus(r.ERROR)}}async handleInvokeTool(){let t=this.invokeTool;if(!t){this.protocol.setErrorCode(l.IO_ERROR),this.protocol.setResultFromString("Tool invocation not available in this context."),this.protocol.setStatus(r.ERROR);return}let e=this.protocol.getPath(),a=this.protocol.getDataAsString();try{let s=await this.raceDeadline(()=>T.runTrustedAsync(()=>t(e,a)));this.protocol.setResultFromString(s),this.protocol.setStatus(r.SUCCESS)}catch(s){let i=w(s instanceof Error?s.message:String(s));this.protocol.setErrorCode(l.IO_ERROR),this.protocol.setResultFromString(i),this.protocol.setStatus(r.ERROR)}}setErrorFromException(t){let e=t instanceof Error?t.message:String(t),a=m(e),s=l.IO_ERROR,i=e.toLowerCase();i.includes("no such file")||i.includes("not found")||i.includes("enoent")?s=l.NOT_FOUND:i.includes("is a directory")||i.includes("eisdir")?s=l.IS_DIRECTORY:i.includes("not a directory")||i.includes("enotdir")?s=l.NOT_DIRECTORY:i.includes("already exists")||i.includes("eexist")?s=l.EXISTS:(i.includes("permission")||i.includes("eperm")||i.includes("eacces"))&&(s=l.PERMISSION_DENIED),this.protocol.setErrorCode(s),this.protocol.setResultFromString(a),this.protocol.setStatus(r.ERROR)}};export{x as a,C as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
function o(n){if(!n||n==="/")return"/";let t=n.endsWith("/")&&n!=="/"?n.slice(0,-1):n;t.startsWith("/")||(t=`/${t}`);let r=t.split("/").filter(i=>i&&i!=="."),e=[];for(let i of r)i===".."?e.pop():e.push(i);return`/${e.join("/")}`||"/"}function l(n,t){let r=o(n),e=o(t);return e===r||r==="/"||e.startsWith(`${r}/`)}function u(n,t){if(n.includes("\0"))throw new Error(`ENOENT: path contains null byte, ${t} '${n}'`)}function s(n){let t=o(n);if(t==="/")return"/";let r=t.lastIndexOf("/");return r===0?"/":t.slice(0,r)}function f(n,t){if(t.startsWith("/"))return o(t);let r=n==="/"?`/${t}`:`${n}/${t}`;return o(r)}function c(n,t){return n==="/"?`/${t}`:`${n}/${t}`}function a(n,t){if(t.startsWith("/"))return o(t);let r=s(n);return o(c(r,t))}export{o as a,l as b,u as c,s as d,f as e,c as f,a as g};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import*as M from"node:async_hooks";import*as $ from"node:module";var v;function T(){return v||w(),v}function w(){let a=[{prop:"Function",target:globalThis,violationType:"function_constructor",strategy:"throw",reason:"Function constructor allows arbitrary code execution"},{prop:"eval",target:globalThis,violationType:"eval",strategy:"throw",reason:"eval() allows arbitrary code execution"},{prop:"setTimeout",target:globalThis,violationType:"setTimeout",strategy:"throw",reason:"setTimeout with string argument allows code execution"},{prop:"setInterval",target:globalThis,violationType:"setInterval",strategy:"throw",reason:"setInterval with string argument allows code execution"},{prop:"setImmediate",target:globalThis,violationType:"setImmediate",strategy:"throw",reason:"setImmediate could be used to escape sandbox context"},{prop:"env",target:process,violationType:"process_env",strategy:"throw",reason:"process.env could leak sensitive environment variables",allowedKeys:new Set(["NODE_V8_COVERAGE","NODE_DEBUG","NODE_DEBUG_NATIVE","NODE_COMPILE_CACHE","NODE_ENV","WATCH_REPORT_DEPENDENCIES","FORCE_COLOR","DEBUG","UNDICI_NO_FG","JEST_WORKER_ID","__MINIMATCH_TESTING_PLATFORM__","LOG_TOKENS","LOG_STREAM"])},{prop:"binding",target:process,violationType:"process_binding",strategy:"throw",reason:"process.binding provides access to native Node.js modules"},{prop:"_linkedBinding",target:process,violationType:"process_binding",strategy:"throw",reason:"process._linkedBinding provides access to native Node.js modules"},{prop:"dlopen",target:process,violationType:"process_dlopen",strategy:"throw",reason:"process.dlopen allows loading native addons"},{prop:"getBuiltinModule",target:process,violationType:"process_get_builtin_module",strategy:"throw",reason:"process.getBuiltinModule allows loading native Node.js modules (fs, child_process, vm)"},{prop:"exit",target:process,violationType:"process_exit",strategy:"throw",reason:"process.exit could terminate the interpreter"},{prop:"abort",target:process,violationType:"process_exit",strategy:"throw",reason:"process.abort could crash the interpreter"},{prop:"kill",target:process,violationType:"process_kill",strategy:"throw",reason:"process.kill could signal other processes"},{prop:"setuid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setuid could escalate privileges"},{prop:"setgid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setgid could escalate privileges"},{prop:"seteuid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.seteuid could escalate effective user privileges"},{prop:"setegid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setegid could escalate effective group privileges"},{prop:"initgroups",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.initgroups could modify supplementary group IDs"},{prop:"setgroups",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setgroups could modify supplementary group IDs"},{prop:"umask",target:process,violationType:"process_umask",strategy:"throw",reason:"process.umask could modify file creation permissions"},{prop:"argv",target:process,violationType:"process_argv",strategy:"throw",reason:"process.argv may contain secrets in CLI arguments"},{prop:"cwd",target:process,violationType:"process_chdir",strategy:"throw",reason:"process.cwd could disclose real host working directory path"},{prop:"chdir",target:process,violationType:"process_chdir",strategy:"throw",reason:"process.chdir could confuse the interpreter's CWD tracking"},{prop:"report",target:process,violationType:"process_report",strategy:"throw",reason:"process.report could disclose full environment, host paths, and system info"},{prop:"loadEnvFile",target:process,violationType:"process_env",strategy:"throw",reason:"process.loadEnvFile could load env files bypassing env proxy"},{prop:"setUncaughtExceptionCaptureCallback",target:process,violationType:"process_exception_handler",strategy:"throw",reason:"setUncaughtExceptionCaptureCallback could intercept security errors"},...["on","once","addListener","prependListener","prependOnceListener"].map(t=>({prop:t,target:process,violationType:"process_exception_handler",strategy:"throw",reason:"process-global listeners can outlive the sandbox and lose its security context"})),{prop:"send",target:process,violationType:"process_send",strategy:"throw",reason:"process.send could communicate with parent process in IPC contexts"},{prop:"channel",target:process,violationType:"process_channel",strategy:"throw",reason:"process.channel could access IPC channel to parent process"},{prop:"cpuUsage",target:process,violationType:"process_timing",strategy:"throw",reason:"process.cpuUsage could enable timing side-channel attacks"},{prop:"memoryUsage",target:process,violationType:"process_timing",strategy:"throw",reason:"process.memoryUsage could enable timing side-channel attacks"},{prop:"hrtime",target:process,violationType:"process_timing",strategy:"throw",reason:"process.hrtime could enable timing side-channel attacks"},{prop:"WeakRef",target:globalThis,violationType:"weak_ref",strategy:"throw",reason:"WeakRef could be used to leak references outside sandbox"},{prop:"FinalizationRegistry",target:globalThis,violationType:"finalization_registry",strategy:"throw",reason:"FinalizationRegistry could be used to leak references outside sandbox"},{prop:"Reflect",target:globalThis,violationType:"reflect",strategy:"freeze",reason:"Reflect provides introspection capabilities"},{prop:"Proxy",target:globalThis,violationType:"proxy",strategy:"throw",reason:"Proxy allows intercepting and modifying object behavior"},{prop:"WebAssembly",target:globalThis,violationType:"webassembly",strategy:"throw",reason:"WebAssembly allows executing arbitrary compiled code"},{prop:"SharedArrayBuffer",target:globalThis,violationType:"shared_array_buffer",strategy:"throw",reason:"SharedArrayBuffer could enable side-channel communication or timing attacks"},{prop:"Atomics",target:globalThis,violationType:"atomics",strategy:"throw",reason:"Atomics could enable side-channel communication or timing attacks"},{prop:"performance",target:globalThis,violationType:"performance_timing",strategy:"throw",reason:"performance.now() provides sub-millisecond timing for side-channel attacks"},{prop:"stdout",target:process,violationType:"process_stdout",strategy:"throw",reason:"process.stdout could bypass interpreter output to write to host stdout"},{prop:"stderr",target:process,violationType:"process_stderr",strategy:"throw",reason:"process.stderr could bypass interpreter output to write to host stderr"},{prop:"__defineGetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__defineGetter__ allows prototype pollution via getter injection"},{prop:"__defineSetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__defineSetter__ allows prototype pollution via setter injection"},{prop:"__lookupGetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__lookupGetter__ enables introspection for prototype pollution attacks"},{prop:"__lookupSetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__lookupSetter__ enables introspection for prototype pollution attacks"},{prop:"JSON",target:globalThis,violationType:"json_mutation",strategy:"freeze",reason:"Freeze JSON to prevent mutation of parsing/serialization"},{prop:"Math",target:globalThis,violationType:"math_mutation",strategy:"freeze",reason:"Freeze Math to prevent mutation of math utilities"}];try{let t=Object.getPrototypeOf(async()=>{}).constructor;t&&t!==Function&&a.push({prop:"constructor",target:Object.getPrototypeOf(async()=>{}),violationType:"async_function_constructor",strategy:"throw",reason:"AsyncFunction constructor allows arbitrary async code execution"})}catch{}try{let t=Object.getPrototypeOf(function*(){}).constructor;t&&t!==Function&&a.push({prop:"constructor",target:Object.getPrototypeOf(function*(){}),violationType:"generator_function_constructor",strategy:"throw",reason:"GeneratorFunction constructor allows arbitrary generator code execution"})}catch{}try{let t=Object.getPrototypeOf(async function*(){}).constructor;t&&t!==Function&&t!==Object.getPrototypeOf(async()=>{}).constructor&&a.push({prop:"constructor",target:Object.getPrototypeOf(async function*(){}),violationType:"async_generator_function_constructor",strategy:"throw",reason:"AsyncGeneratorFunction constructor allows arbitrary async generator code execution"})}catch{}let e=a.filter(t=>{try{return t.target[t.prop]!==void 0}catch{return!1}});return v??=new Set(e.map(({violationType:t})=>t)),e}var j=performance.timeOrigin,V=performance.now.bind(performance);function k(){return Math.floor(j+V())}var E=new Set(["function_constructor","async_function_constructor","generator_function_constructor","async_generator_function_constructor"]);function D(a){let e=a?.find(t=>E.has(t));if(e)throw new RangeError(`defenseInDepth.excludeViolationTypes cannot disable the non-excludable "${e}" protection`)}var R=`
|
|
3
|
+
|
|
4
|
+
This is a defense-in-depth measure and indicates a bug in just-bash. Please report this at security@vercel.com`;function O(a,e,t){let i=t&&!E.has(e)?`
|
|
5
|
+
|
|
6
|
+
If this access is required by trusted host-runtime code, add "${e}" to defenseInDepth.excludeViolationTypes.`:"";return a+R+i}var f=typeof __BROWSER__<"u"&&__BROWSER__;function S(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{let e=Math.random()*16|0;return(a==="x"?e:e&3|8).toString(16)})}var P=null,m=null,A=null;if(!f)try{P=M.AsyncLocalStorage,m=$,A=m.Module??m.default??null}catch{}var d=class extends Error{violation;constructor(e,t){super(O(e,t.type,t.type==="error_prepare_stack_trace"||T().has(t.type))),this.violation=t,this.name="SecurityViolationError"}},p=!f&&P?new P:null,L=1e3;function G(a,e,...t){return p.run(a,()=>e(...t))}var N={enabled:!0,auditMode:!1,processLifetimeIntrinsicHardening:!1};function I(){return!f&&typeof m?.registerHooks=="function"}function C(a){let e=typeof a=="boolean"?{enabled:a}:a??{};if(D(e.excludeViolationTypes),e.enabled!==void 0&&e.enabled!==!0&&e.enabled!==!1&&e.enabled!=="auto")throw new RangeError('defenseInDepth.enabled must be true, false, or "auto"');let t={...N,...e},i=t.enabled==="auto"?"auto":t.enabled?"enabled":"disabled",r={...t,enabled:i!=="disabled",requested:i};return r.excludeViolationTypes&&(r.excludeViolationTypes=[...new Set(r.excludeViolationTypes)].sort()),r}function H(a,e){if(a.enabled!==e.enabled||a.auditMode!==e.auditMode||a.processLifetimeIntrinsicHardening!==e.processLifetimeIntrinsicHardening||a.onViolation!==e.onViolation)return!1;let t=a.excludeViolationTypes??[],i=e.excludeViolationTypes??[];return t.length===i.length&&t.every((r,o)=>r===i[o])}var B=class a{static instance=null;static importHooksRegistered=!1;static trustedExecutionDepth=new Map;config;refCount=0;patchFailures=[];activeExecutionIds=new Set;contextCache=new Map;originalDescriptors=[];temporaryIntrinsicDescriptors=[];violations=[];activationTime=0;totalActiveTimeMs=0;constructor(e){this.config=e}static getInstance(e){let t=C(e);if(!a.instance)a.instance=new a(t);else{let i=a.instance.config;if(!H(t,i))throw new Error("DefenseInDepthBox config conflict: all resolved defense options, including exclusions and the violation callback, must match across Bash instances. Call DefenseInDepthBox.resetInstance() between incompatible configurations.")}return a.instance}static resetInstance(){a.instance&&(a.instance.forceDeactivate(),a.instance=null),a.trustedExecutionDepth.clear()}static isInSandboxedContext(){return p?p?.getStore()?.sandboxActive===!0:!1}static getCurrentExecutionId(){if(p)return p?.getStore()?.executionId}static enterTrustedScope(e){let t=a.trustedExecutionDepth.get(e)??0;a.trustedExecutionDepth.set(e,t+1)}static leaveTrustedScope(e){let t=a.trustedExecutionDepth.get(e);if(t){if(t===1){a.trustedExecutionDepth.delete(e);return}a.trustedExecutionDepth.set(e,t-1)}}static isTrustedScopeActive(e){return e?(a.trustedExecutionDepth.get(e)??0)>0:!1}static isTrustedContext(e){return!e||e.forceUntrusted?!1:e.trusted===!0||a.isTrustedScopeActive(e.executionId)}isExecutionIdActive(e){return this.activeExecutionIds.has(e)}getCachedContext(e){let t=this.contextCache.get(e);return t||(t={sandboxActive:!0,executionId:e},this.contextCache.set(e,t)),t}static bindCurrentContext(e){if(!p)return e;let t=p.getStore(),i=t?.sandboxActive===!0?t.executionId:void 0;if(!i)return e;let o=a.instance?.getCachedContext(i)??{sandboxActive:!0,executionId:i},n=t?.forceUntrusted?{...o,forceUntrusted:!0}:o;return((...s)=>{let c=a.instance;if(!(c&&!c.isExecutionIdActive(i)&&(c.recordViolation("bound_callback_after_deactivate","bound callback","Bound callback blocked after originating execution was deactivated"),!c.config.auditMode)))return G(n,e,...s)})}isEnabled(){return this.getStatus().state==="enabled"}getStatus(){let e=I();return this.config.requested==="disabled"?{requested:"disabled",state:"disabled",level:"none",contextualDynamicImportProtection:e,processLifetimeIntrinsicHardening:this.config.processLifetimeIntrinsicHardening===!0,intrinsicProtection:this.config.processLifetimeIntrinsicHardening?"process-lifetime":"scoped-best-effort"}:!p||f?{requested:this.config.requested,state:"unsupported",level:"none",contextualDynamicImportProtection:!1,processLifetimeIntrinsicHardening:this.config.processLifetimeIntrinsicHardening===!0,intrinsicProtection:this.config.processLifetimeIntrinsicHardening?"process-lifetime":"scoped-best-effort",reason:"context-aware ESM loader hooks (node:module.registerHooks) are unavailable"}:{requested:this.config.requested,state:"enabled",level:this.config.auditMode?"none":e?"full":"best-effort",contextualDynamicImportProtection:e,processLifetimeIntrinsicHardening:this.config.processLifetimeIntrinsicHardening===!0,intrinsicProtection:this.config.processLifetimeIntrinsicHardening?"process-lifetime":"scoped-best-effort",reason:this.config.auditMode?"audit mode records violations but does not block them":e?void 0:"best-effort protection; context-aware ESM loader hooks are unavailable"}}updateConfig(e){if(this.refCount>0)throw new Error("DefenseInDepthBox configuration cannot change while protection is active");this.config=C({...this.config,...e})}activate(){if(!f&&this.config.enabled&&!p)throw new Error("DefenseInDepthBox: enabled protection requires node:async_hooks and node:module");if(f||!this.config.enabled){let i=S(),r=!1;return{run:o=>r?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):o(),deactivate:()=>{r=!0},executionId:i}}if(this.refCount++,this.refCount===1){try{this.applyPatches()}catch(i){throw this.restorePatches(),this.activeExecutionIds.clear(),this.contextCache.clear(),this.refCount=0,i}this.activationTime=Date.now()}let e=S(),t=!1;return{run:i=>t?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):(this.activeExecutionIds.add(e),p.run({sandboxActive:!0,executionId:e},i)),deactivate:()=>{t||(t=!0,this.activeExecutionIds.delete(e),this.contextCache.delete(e),this.refCount--,this.refCount===0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.refCount<0&&(this.refCount=0))},executionId:e}}forceDeactivate(){this.refCount>0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.activeExecutionIds.clear(),this.contextCache.clear(),this.refCount=0}isActive(){return this.refCount>0}getStats(){return{violationsBlocked:this.violations.length,violations:[...this.violations],activeTimeMs:this.totalActiveTimeMs+(this.refCount>0?Date.now()-this.activationTime:0),refCount:this.refCount}}getPatchFailures(){return[...this.patchFailures]}clearViolations(){this.violations=[]}getPathForTarget(e,t){return e===globalThis?`globalThis.${t}`:e===process?`process.${t}`:e===Error?`Error.${t}`:e===Function.prototype?`Function.prototype.${t}`:e===Object.prototype?`Object.prototype.${t}`:`<object>.${t}`}static runTrusted(e){if(!p)return e();let t=p.getStore();if(!t)return e();let{executionId:i}=t;return p.run({...t,trusted:!0,forceUntrusted:!1},()=>{a.enterTrustedScope(i);try{let r=e();return typeof r=="object"&&r!==null&&"finally"in r&&typeof r.finally=="function"?r.finally(()=>{a.leaveTrustedScope(i)}):(a.leaveTrustedScope(i),r)}catch(r){throw a.leaveTrustedScope(i),r}})}static async runTrustedAsync(e){if(!p)return e();let t=p.getStore();if(!t)return e();let{executionId:i}=t;return p.run({...t,trusted:!0,forceUntrusted:!1},async()=>{a.enterTrustedScope(i);try{return await e()}finally{a.leaveTrustedScope(i)}})}static async runUntrustedAsync(e){if(!p)return e();let t=p.getStore();return t?p.run({...t,trusted:!1,forceUntrusted:!0},e):e()}shouldBlock(){if(f||this.config.auditMode||!p)return!1;let e=p?.getStore();return!(e?.sandboxActive!==!0||a.isTrustedContext(e))}shouldAudit(){if(!this.config.auditMode||!p)return!1;let e=p.getStore();return e?.sandboxActive===!0&&!a.isTrustedContext(e)}recordViolation(e,t,i){let r={timestamp:k(),type:e,message:i,path:t,stack:new Error().stack,executionId:p?.getStore()?.executionId};if(this.violations.length<L&&this.violations.push(r),this.config.onViolation)try{this.config.onViolation(r)}catch(o){console.debug("[DefenseInDepthBox] onViolation callback threw:",o instanceof Error?o.message:o)}return r}createBlockingProxy(e,t,i){let r=this;return new Proxy(e,{apply(o,n,s){if(r.shouldBlock()){let c=`${t} is blocked during script execution`,l=r.recordViolation(i,t,c);throw new d(c,l)}return r.shouldAudit()&&r.recordViolation(i,t,`${t} called (audit mode)`),Reflect.apply(o,n,s)},construct(o,n,s){if(r.shouldBlock()){let c=`${t} constructor is blocked during script execution`,l=r.recordViolation(i,t,c);throw new d(c,l)}return r.shouldAudit()&&r.recordViolation(i,t,`${t} constructor called (audit mode)`),Reflect.construct(o,n,s)}})}createBlockingObjectProxy(e,t,i,r){let o=this;return new Proxy(e,{get(n,s,c){if(o.shouldBlock()){if(r&&typeof s=="string"&&r.has(s))return Reflect.get(n,s,c);let l=`${t}.${String(s)}`,u=`${l} is blocked during script execution`,h=o.recordViolation(i,l,u);throw new d(u,h)}if(o.shouldAudit()){let l=`${t}.${String(s)}`;o.recordViolation(i,l,`${l} accessed (audit mode)`)}return Reflect.get(n,s,c)},set(n,s,c,l){if(o.shouldBlock()){let u=`${t}.${String(s)}`,h=`${u} modification is blocked during script execution`,y=o.recordViolation(i,u,h);throw new d(h,y)}return t==="process.env"&&s==="DEBUG"?Reflect.set(n,s,c):Reflect.set(n,s,c,l)},ownKeys(n){if(o.shouldBlock()){let s=`${t} enumeration is blocked during script execution`,c=o.recordViolation(i,t,s);throw new d(s,c)}return Reflect.ownKeys(n)},getOwnPropertyDescriptor(n,s){if(o.shouldBlock()){let c=`${t}.${String(s)}`,l=`${c} descriptor access is blocked during script execution`,u=o.recordViolation(i,c,l);throw new d(l,u)}return Reflect.getOwnPropertyDescriptor(n,s)},has(n,s){if(o.shouldBlock()){let c=`${t}.${String(s)}`,l=`${c} existence check is blocked during script execution`,u=o.recordViolation(i,c,l);throw new d(l,u)}return Reflect.has(n,s)},deleteProperty(n,s){if(o.shouldBlock()){let c=`${t}.${String(s)}`,l=`${c} deletion is blocked during script execution`,u=o.recordViolation(i,c,l);throw new d(l,u)}return Reflect.deleteProperty(n,s)},setPrototypeOf(n,s){if(o.shouldBlock()){let c=`${t} setPrototypeOf is blocked during script execution`,l=o.recordViolation(i,t,c);throw new d(c,l)}return Reflect.setPrototypeOf(n,s)},defineProperty(n,s,c){if(o.shouldBlock()){let l=`${t}.${String(s)}`,u=`${l} defineProperty is blocked during script execution`,h=o.recordViolation(i,l,u);throw new d(u,h)}return Reflect.defineProperty(n,s,c)}})}createReadonlyObjectProxy(e,t,i){let r=this,o=n=>{let s=`${t} ${n} is blocked during script execution`,c=r.recordViolation(i,t,s);throw new d(s,c)};return new Proxy(e,{set(n,s,c,l){return r.shouldBlock()&&o("modification"),Reflect.set(n,s,c,l)},defineProperty(n,s,c){return r.shouldBlock()&&o("defineProperty"),Reflect.defineProperty(n,s,c)},deleteProperty(n,s){return r.shouldBlock()&&o("deletion"),Reflect.deleteProperty(n,s)},setPrototypeOf(n,s){return r.shouldBlock()&&o("setPrototypeOf"),Reflect.setPrototypeOf(n,s)},preventExtensions(n){return r.shouldBlock()&&o("preventExtensions"),Reflect.preventExtensions(n)}})}applyPatches(){this.patchFailures=[];let e=w(),t=new Set(this.config.excludeViolationTypes??[]),i=new Set(["process_send","process_channel","process_stdout","process_stderr"]),r=[];for(let s of e)if(!t.has(s.violationType)&&!i.has(s.violationType)){if(s.strategy==="freeze"){r.push(s);continue}this.applyPatch(s)}this.protectConstructorChain(),t.has("error_prepare_stack_trace")||this.protectErrorPrepareStackTrace(),this.protectPromiseThen(),I()&&this.protectDynamicImport(),this.protectModuleLoad(),this.protectModuleResolveFilename(),this.protectProcessMainModule(),this.protectProcessExecPath(),this.protectProxyRevocable();let o=["Function.prototype.constructor","Module._load","Module._resolveFilename"],n=this.patchFailures.filter(s=>o.includes(s));if(n.length>0)throw this.restorePatches(),new Error(`DefenseInDepthBox: critical patches failed: ${n.join(", ")}`);this.config.processLifetimeIntrinsicHardening||this.protectReversibleIntrinsics(r);for(let s of r)this.applyPatch(s,this.config.processLifetimeIntrinsicHardening===!0);this.config.processLifetimeIntrinsicHardening&&this.lockWellKnownSymbols()}protectReversibleIntrinsics(e){let t=new Set,i=(n,s)=>{let c=Object.getOwnPropertyDescriptor(n,s);!c||!("value"in c)||c.writable!==!0||c.configurable!==!0||(this.temporaryIntrinsicDescriptors.push({target:n,prop:s,descriptor:c}),Object.defineProperty(n,s,{...c,writable:!1}))};for(let{target:n,prop:s}of e){let c=n[s];if(!(typeof c!="object"||c===null)){t.add(c);for(let l of Reflect.ownKeys(c))i(c,l)}}let r=[];for(let n of[Array,Map,Set,RegExp,Promise])r.push([n,Symbol.species]);for(let n of[Array.prototype,String.prototype,Map.prototype,Set.prototype])r.push([n,Symbol.iterator]);r.push([Symbol.prototype,Symbol.toPrimitive],[Date.prototype,Symbol.toPrimitive],[Function.prototype,Symbol.hasInstance],[Array.prototype,Symbol.unscopables]);for(let n of[Symbol.match,Symbol.matchAll,Symbol.replace,Symbol.search,Symbol.split])r.push([RegExp.prototype,n]);for(let n of[Map.prototype,Set.prototype,Promise.prototype,ArrayBuffer.prototype])r.push([n,Symbol.toStringTag]);for(let[n,s]of r)t.add(n),i(n,s);let o=(n,s,c)=>{let l=Object.getOwnPropertyDescriptor(n,s);if(!l||!("value"in l)||typeof l.value!="function"||l.configurable!==!0)return;let u=l.value,h=this,y=function(...b){let g=b[0];if(h.shouldBlock()&&typeof g=="object"&&g!==null&&t.has(g)){let x=`${c}.${s}`,_=`${x} is blocked for protected intrinsics during script execution`,F=h.recordViolation("prototype_mutation",x,_);throw new d(_,F)}return Reflect.apply(u,this,b)};this.temporaryIntrinsicDescriptors.push({target:n,prop:s,descriptor:l}),Object.defineProperty(n,s,{...l,value:y,writable:!1})};for(let n of["assign","defineProperties","defineProperty","freeze","preventExtensions","seal","setPrototypeOf"])o(Object,n,"Object");for(let n of["defineProperty","deleteProperty","preventExtensions","set","setPrototypeOf"])o(Reflect,n,"Reflect")}protectConstructorChain(){this.patchPrototypeConstructor(Function.prototype,"Function.prototype.constructor","function_constructor");try{let e=Object.getPrototypeOf(async()=>{}).constructor;e&&e!==Function&&this.patchPrototypeConstructor(e.prototype,"AsyncFunction.prototype.constructor","async_function_constructor")}catch(e){this.patchFailures.push("AsyncFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncFunction.prototype.constructor:",e instanceof Error?e.message:e)}try{let e=Object.getPrototypeOf(function*(){}).constructor;e&&e!==Function&&this.patchPrototypeConstructor(e.prototype,"GeneratorFunction.prototype.constructor","generator_function_constructor")}catch(e){this.patchFailures.push("GeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch GeneratorFunction.prototype.constructor:",e instanceof Error?e.message:e)}try{let e=Object.getPrototypeOf(async function*(){}).constructor,t=Object.getPrototypeOf(async()=>{}).constructor;e&&e!==Function&&e!==t&&this.patchPrototypeConstructor(e.prototype,"AsyncGeneratorFunction.prototype.constructor","async_generator_function_constructor")}catch(e){this.patchFailures.push("AsyncGeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncGeneratorFunction.prototype.constructor:",e instanceof Error?e.message:e)}}protectErrorPrepareStackTrace(){let e=this;try{let t=Object.getOwnPropertyDescriptor(Error,"prepareStackTrace");this.originalDescriptors.push({target:Error,prop:"prepareStackTrace",descriptor:t});let i=t?.value;Object.defineProperty(Error,"prepareStackTrace",{get(){return i},set(r){if(e.shouldBlock()){let o="Error.prepareStackTrace modification is blocked during script execution",n=e.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace",o);throw new d(o,n)}e.shouldAudit()&&e.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace","Error.prepareStackTrace set (audit mode)"),i=r},configurable:!0})}catch(t){this.patchFailures.push("Error.prepareStackTrace"),console.debug("[DefenseInDepthBox] Could not protect Error.prepareStackTrace:",t instanceof Error?t.message:t)}}protectPromiseThen(){let e=this;try{let o=function(...n){return p.run(this.captured,()=>{if(!this.box.isExecutionIdActive(this.executionId)){if(this.box.recordViolation("promise_then_after_deactivate","Promise.then","Promise.then callback is blocked after defense deactivation"),this.box.config.auditMode)return Reflect.apply(this.cb,void 0,n);if(this.kind==="fulfilled")return n[0];throw n[0]}return Reflect.apply(this.cb,void 0,n)})};var t=o;let i=Object.getOwnPropertyDescriptor(Promise.prototype,"then");this.originalDescriptors.push({target:Promise.prototype,prop:"then",descriptor:i});let r=i?.value;if(typeof r!="function")return;Object.defineProperty(Promise.prototype,"then",{value:function(s,c){if(!p)return Reflect.apply(r,this,[s,c]);let l=p.getStore(),u=l?.sandboxActive===!0&&l.trusted!==!0?l.executionId:void 0;if(!u)return Reflect.apply(r,this,[s,c]);let h=e.getCachedContext(u),y=l?.forceUntrusted?{...h,forceUntrusted:!0}:h,b=(g,x)=>typeof g!="function"?g:o.bind({box:e,executionId:u,captured:y,cb:g,kind:x});return Reflect.apply(r,this,[b(s,"fulfilled"),b(c,"rejected")])},writable:!0,configurable:!0})}catch(i){this.patchFailures.push("Promise.prototype.then"),console.debug("[DefenseInDepthBox] Could not protect Promise.prototype.then:",i instanceof Error?i.message:i)}}patchPrototypeConstructor(e,t,i){let r=this;try{let o=Object.getOwnPropertyDescriptor(e,"constructor");this.originalDescriptors.push({target:e,prop:"constructor",descriptor:o});let n=o?.value;Object.defineProperty(e,"constructor",{get(){if(r.shouldBlock()){let s=`${t} access is blocked during script execution`,c=r.recordViolation(i,t,s);throw new d(s,c)}return r.shouldAudit()&&r.recordViolation(i,t,`${t} accessed (audit mode)`),n},set(s){if(r.shouldBlock()){let c=`${t} modification is blocked during script execution`,l=r.recordViolation(i,t,c);throw new d(c,l)}Object.defineProperty(this,"constructor",{value:s,writable:!0,configurable:!0})},configurable:!0})}catch(o){this.patchFailures.push(t),console.debug(`[DefenseInDepthBox] Could not patch ${t}:`,o instanceof Error?o.message:o)}}protectProcessMainModule(){if(typeof process>"u")return;let e=this;try{let t=Object.getOwnPropertyDescriptor(process,"mainModule");this.originalDescriptors.push({target:process,prop:"mainModule",descriptor:t});let i=t?.value;i!==void 0&&Object.defineProperty(process,"mainModule",{get(){if(e.shouldBlock()){let r="process.mainModule access is blocked during script execution",o=e.recordViolation("process_main_module","process.mainModule",r);throw new d(r,o)}return e.shouldAudit()&&e.recordViolation("process_main_module","process.mainModule","process.mainModule accessed (audit mode)"),i},set(r){if(e.shouldBlock()){let o="process.mainModule modification is blocked during script execution",n=e.recordViolation("process_main_module","process.mainModule",o);throw new d(o,n)}Object.defineProperty(process,"mainModule",{value:r,writable:!0,configurable:!0})},configurable:!0})}catch(t){this.patchFailures.push("process.mainModule"),console.debug("[DefenseInDepthBox] Could not protect process.mainModule:",t instanceof Error?t.message:t)}}protectProcessExecPath(){if(typeof process>"u")return;let e=this;try{let t=Object.getOwnPropertyDescriptor(process,"execPath");this.originalDescriptors.push({target:process,prop:"execPath",descriptor:t});let i=t?.value??process.execPath;Object.defineProperty(process,"execPath",{get(){if(e.shouldBlock()){let r="process.execPath access is blocked during script execution",o=e.recordViolation("process_exec_path","process.execPath",r);throw new d(r,o)}return e.shouldAudit()&&e.recordViolation("process_exec_path","process.execPath","process.execPath accessed (audit mode)"),i},set(r){if(e.shouldBlock()){let o="process.execPath modification is blocked during script execution",n=e.recordViolation("process_exec_path","process.execPath",o);throw new d(o,n)}Object.defineProperty(process,"execPath",{value:r,writable:!0,configurable:!0})},configurable:!0})}catch(t){this.patchFailures.push("process.execPath"),console.debug("[DefenseInDepthBox] Could not protect process.execPath:",t instanceof Error?t.message:t)}}lockWellKnownSymbols(){let e=(t,i)=>{try{let r=Object.getOwnPropertyDescriptor(t,i);if(r?.configurable){if("value"in r){Object.defineProperty(t,i,{...r,configurable:!1,writable:!1});return}Object.defineProperty(t,i,{...r,configurable:!1})}}catch{}};for(let t of[Array,Map,Set,RegExp,Promise])e(t,Symbol.species);for(let t of[Array.prototype,String.prototype,Map.prototype,Set.prototype])e(t,Symbol.iterator);e(Symbol.prototype,Symbol.toPrimitive),e(Date.prototype,Symbol.toPrimitive);for(let t of[Symbol.match,Symbol.matchAll,Symbol.replace,Symbol.search,Symbol.split])e(RegExp.prototype,t);e(Function.prototype,Symbol.hasInstance),e(Array.prototype,Symbol.unscopables);for(let t of[Map.prototype,Set.prototype,Promise.prototype,ArrayBuffer.prototype])e(t,Symbol.toStringTag)}protectProxyRevocable(){let e=this;try{let t=Proxy.revocable;if(typeof t!="function")return;let i=Object.getOwnPropertyDescriptor(Proxy,"revocable");this.originalDescriptors.push({target:Proxy,prop:"revocable",descriptor:i}),Object.defineProperty(Proxy,"revocable",{value:function(o,n){if(e.shouldBlock()){let s="Proxy.revocable is blocked during script execution",c=e.recordViolation("proxy","Proxy.revocable",s);throw new d(s,c)}return e.shouldAudit()&&e.recordViolation("proxy","Proxy.revocable","Proxy.revocable called (audit mode)"),t(o,n)},writable:!1,configurable:!0})}catch(t){this.patchFailures.push("Proxy.revocable"),console.debug("[DefenseInDepthBox] Could not protect Proxy.revocable:",t instanceof Error?t.message:t)}}protectDynamicImport(){if(!(f||a.importHooksRegistered))try{let e=m;if(!e)throw new Error("node:module is unavailable");let t=new Set;for(let o of e.builtinModules??[]){let n=o.startsWith("node:")?o.slice(5):o;t.add(n);let s=n.indexOf("/");s>0&&t.add(n.slice(0,s))}let i=o=>{if(o.startsWith("./")||o.startsWith("../")||o.startsWith("/")||o.startsWith("file:")||o.startsWith("data:")||o.startsWith("blob:")||o.startsWith("http:")||o.startsWith("https:"))return!1;let n=o.startsWith("node:")?o.slice(5):o;if(!n)return!1;if(typeof e.isBuiltin=="function"&&e.isBuiltin(n)||t.has(n))return!0;let s=n.indexOf("/");return s>0&&t.has(n.slice(0,s))},r=o=>{let n=p?.getStore();return o.config.auditMode===!0&&n?.sandboxActive===!0&&!a.isTrustedContext(n)};if(typeof e.registerHooks=="function"){e.registerHooks({resolve(o,n,s){let c=a.instance;if(!c)return s(o,n);if((o.startsWith("data:")||o.startsWith("blob:"))&&c.shouldBlock()){let l=`import(${o.startsWith("data:")?"data:":"blob:"})`,u=`dynamic import of ${o.startsWith("data:")?"data:":"blob:"} URLs is blocked by defense-in-depth`,h=c.recordViolation("dynamic_import_builtin",l,u);throw new d(u,h)}if(i(o)){let l=`import(${o})`,u=`dynamic import of Node.js builtin '${o}' is blocked during script execution`;if(c.shouldBlock()){let h=c.recordViolation("dynamic_import_builtin",l,u);throw new d(u,h)}r(c)&&c.recordViolation("dynamic_import_builtin",l,`dynamic import of Node.js builtin '${o}' called (audit mode)`)}return s(o,n)}}),a.importHooksRegistered=!0;return}throw new Error("context-aware ESM loader hooks (node:module.registerHooks) are unavailable")}catch(e){throw new Error(`DefenseInDepthBox: could not register dynamic-import hooks: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}protectModuleLoad(){this.protectModuleMethod("_load","module_load")}protectModuleResolveFilename(){this.protectModuleMethod("_resolveFilename","module_resolve_filename")}protectModuleMethod(e,t){if(f)return;let i=`Module.${e}`;try{let r=A,o=r?.[e];if(!r||typeof o!="function")throw new Error("node:module Module class or method is unavailable");let n=Object.getOwnPropertyDescriptor(r,e);if(!n)throw new Error("method has no own property descriptor");if(n.configurable===!1&&n.writable===!1)throw new Error("method is non-configurable and non-writable");let s=this.createBlockingProxy(o,i,t);this.originalDescriptors.push({target:r,prop:e,descriptor:n}),Object.defineProperty(r,e,{...n,value:s});let c=Object.getOwnPropertyDescriptor(r,e);if(r[e]!==s||c?.value!==s)throw new Error("installed patch failed verification")}catch{this.patchFailures.push(i)}}applyPatch(e,t=!1){let{target:i,prop:r,violationType:o,strategy:n}=e;try{let s=i[r];if(s===void 0)return;let c=Object.getOwnPropertyDescriptor(i,r);if(this.originalDescriptors.push({target:i,prop:r,descriptor:c}),n==="freeze"){if(typeof s=="object"&&s!==null){t&&Object.freeze(s);let l=this.getPathForTarget(i,r),u=this.createReadonlyObjectProxy(s,l,o);Object.defineProperty(i,r,{...c,value:u})}}else{let l=this.getPathForTarget(i,r),u=typeof s=="function"?this.createBlockingProxy(s,l,o):this.createBlockingObjectProxy(s,l,o,e.allowedKeys);Object.defineProperty(i,r,{value:u,writable:!0,configurable:!0})}}catch(s){let c=this.getPathForTarget(i,r);this.patchFailures.push(c),console.debug(`[DefenseInDepthBox] Could not patch ${c}:`,s instanceof Error?s.message:s)}}restorePatches(){for(let e=this.temporaryIntrinsicDescriptors.length-1;e>=0;e--){let{target:t,prop:i,descriptor:r}=this.temporaryIntrinsicDescriptors[e];try{Object.defineProperty(t,i,r)}catch(o){console.debug(`[DefenseInDepthBox] Could not restore temporary intrinsic ${String(i)}:`,o instanceof Error?o.message:o)}}this.temporaryIntrinsicDescriptors=[];for(let e=this.originalDescriptors.length-1;e>=0;e--){let{target:t,prop:i,descriptor:r}=this.originalDescriptors[e];try{r?Object.defineProperty(t,i,r):delete t[i]}catch(o){let n=this.getPathForTarget(t,i);console.debug(`[DefenseInDepthBox] Could not restore ${n}:`,o instanceof Error?o.message:o)}}this.originalDescriptors=[]}};export{d as a,B as b};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{a as r,b as m}from"./chunk-QAYAQNCG.js";var p={name:"basename",summary:"strip directory and suffix from filenames",usage:`basename NAME [SUFFIX]
|
|
3
|
+
basename OPTION... NAME...`,options:["-a, --multiple support multiple arguments","-s, --suffix=SUFFIX remove a trailing SUFFIX"," --help display this help and exit"]},c={name:"basename",async execute(n,u){if(m(n))return r(p);let l=!1,s="",a=[];for(let t=0;t<n.length;t++){let e=n[t];e==="-a"||e==="--multiple"?l=!0:e==="-s"&&t+1<n.length?(s=n[++t],l=!0):e.startsWith("--suffix=")?(s=e.slice(9),l=!0):e.startsWith("-")||a.push(e)}if(a.length===0)return{stdout:"",stderr:`basename: missing operand
|
|
4
|
+
`,exitCode:1};!l&&a.length>=2&&(s=a.pop()??"");let o=[];for(let t of a){let e=t.replace(/\/+$/,""),i=e.split("/").pop()||e;s&&i.endsWith(s)&&(i=i.slice(0,-s.length)),o.push(i)}return{stdout:`${o.join(`
|
|
5
|
+
`)}
|
|
6
|
+
`,stderr:"",exitCode:0}}},h={name:"basename",flags:[{flag:"-a",type:"boolean"},{flag:"-s",type:"value",valueHint:"string"}],needsArgs:!0};export{c as a,h as b};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{c as O}from"./chunk-YEYSCLSJ.js";import{d as F}from"./chunk-GN6CQ3J4.js";import{a as N,b as w,c as k}from"./chunk-QAYAQNCG.js";var P=new Map([["",1],["k",1024],["m",1048576],["g",1073741824],["t",1099511627776],["p",0x4000000000000],["e",1152921504606847e3]]),D=new Map([["jan",1],["feb",2],["mar",3],["apr",4],["may",5],["jun",6],["jul",7],["aug",8],["sep",9],["oct",10],["nov",11],["dec",12]]);function x(u){let r=u.trim(),e=r.match(/^([+-]?\d*\.?\d+)\s*([kmgtpeKMGTPE])?[iI]?[bB]?$/);if(!e){let n=parseFloat(r);return Number.isNaN(n)?0:n}let l=parseFloat(e[1]),s=(e[2]||"").toLowerCase(),i=P.get(s)??1;return l*i}function M(u){let r=u.trim().toLowerCase().slice(0,3);return D.get(r)??0}function q(u,r){let e=u.split(/(\d+)/),l=r.split(/(\d+)/),s=Math.max(e.length,l.length);for(let i=0;i<s;i++){let n=e[i]||"",d=l[i]||"",o=/^\d+$/.test(n)?parseInt(n,10):null,c=/^\d+$/.test(d)?parseInt(d,10):null;if(o!==null&&c!==null){if(o!==c)return o-c}else if(n!==d)return n.localeCompare(d)}return 0}function L(u){return u.replace(/[^a-zA-Z0-9\s]/g,"")}function v(u,r,e){let l=e!==null?e:/\s+/,s=u.split(l),i=r.startField-1;if(i>=s.length)return"";if(r.endField===void 0){let o=s[i]||"";return r.startChar!==void 0&&(o=o.slice(r.startChar-1)),r.ignoreLeading&&(o=o.trimStart()),o}let n=Math.min(r.endField-1,s.length-1),d="";for(let o=i;o<=n&&o<s.length;o++){let c=s[o]||"";if(o===i&&r.startChar!==void 0&&(c=c.slice(r.startChar-1)),o===n&&r.endChar!==void 0){let t=o===i&&r.startChar!==void 0?r.endChar-r.startChar+1:r.endChar;c=c.slice(0,t)}o>i&&(d+=e||" "),d+=c}return r.ignoreLeading&&(d=d.trimStart()),d}function I(u,r,e){let l=u,s=r;if(e.dictionaryOrder&&(l=L(l),s=L(s)),e.ignoreCase&&(l=l.toLowerCase(),s=s.toLowerCase()),e.monthSort){let i=M(l),n=M(s);return i-n}if(e.humanNumeric){let i=x(l),n=x(s);return i-n}if(e.versionSort)return q(l,s);if(e.numeric){let i=parseFloat(l)||0,n=parseFloat(s)||0;return i-n}return l.localeCompare(s)}function B(u){let{keys:r,fieldDelimiter:e,numeric:l,ignoreCase:s,reverse:i,humanNumeric:n,versionSort:d,dictionaryOrder:o,monthSort:c,ignoreLeadingBlanks:t,stable:a}=u;return(f,C)=>{let g=f,b=C;if(t&&(g=g.trimStart(),b=b.trimStart()),r.length===0){let h=I(g,b,{numeric:l,ignoreCase:s,humanNumeric:n,versionSort:d,dictionaryOrder:o,monthSort:c});if(h!==0)return i?-h:h;if(!a){let p=f.localeCompare(C);return i?-p:p}return 0}for(let m of r){let h=v(g,m,e),p=v(b,m,e);m.ignoreLeading&&(h=h.trimStart(),p=p.trimStart());let V={numeric:m.numeric??l,ignoreCase:m.ignoreCase??s,humanNumeric:m.humanNumeric??n,versionSort:m.versionSort??d,dictionaryOrder:m.dictionaryOrder??o,monthSort:m.monthSort??c},A=m.reverse??i,S=I(h,p,V);if(S!==0)return A?-S:S}if(!a){let m=f.localeCompare(C);return i?-m:m}return 0}}function E(u,r){if(r.keys.length===0){if(r.ignoreCase){let s=new Set;return u.filter(i=>{let n=i.toLowerCase();return s.has(n)?!1:(s.add(n),!0)})}return[...new Set(u)]}let e=r.keys[0],l=new Set;return u.filter(s=>{let i=v(s,e,r.fieldDelimiter);return(e.ignoreCase??r.ignoreCase)&&(i=i.toLowerCase()),l.has(i)?!1:(l.add(i),!0)})}function y(u){let r={startField:1},e="",l=u,s=l.match(/([bdfhMnrV]+)$/);s&&(e=s[1],l=l.slice(0,-e.length)),e.includes("n")&&(r.numeric=!0),e.includes("r")&&(r.reverse=!0),e.includes("f")&&(r.ignoreCase=!0),e.includes("b")&&(r.ignoreLeading=!0),e.includes("h")&&(r.humanNumeric=!0),e.includes("V")&&(r.versionSort=!0),e.includes("d")&&(r.dictionaryOrder=!0),e.includes("M")&&(r.monthSort=!0);let i=l.split(",");if(i.length===0||i[0]==="")return null;let n=i[0].split("."),d=parseInt(n[0],10);if(Number.isNaN(d)||d<1)return null;if(r.startField=d,n.length>1&&n[1]){let o=parseInt(n[1],10);!Number.isNaN(o)&&o>=1&&(r.startChar=o)}if(i.length>1&&i[1]){let o=i[1],c=o.match(/([bdfhMnrV]+)$/);if(c){let a=c[1];a.includes("n")&&(r.numeric=!0),a.includes("r")&&(r.reverse=!0),a.includes("f")&&(r.ignoreCase=!0),a.includes("b")&&(r.ignoreLeading=!0),a.includes("h")&&(r.humanNumeric=!0),a.includes("V")&&(r.versionSort=!0),a.includes("d")&&(r.dictionaryOrder=!0),a.includes("M")&&(r.monthSort=!0),o=o.slice(0,-a.length)}let t=o.split(".");if(t[0]){let a=parseInt(t[0],10);if(!Number.isNaN(a)&&a>=1&&(r.endField=a),t.length>1&&t[1]){let f=parseInt(t[1],10);!Number.isNaN(f)&&f>=1&&(r.endChar=f)}}}return r}var H={name:"sort",summary:"sort lines of text files",usage:"sort [OPTION]... [FILE]...",options:["-b, --ignore-leading-blanks ignore leading blanks","-d, --dictionary-order consider only blanks and alphanumeric characters","-f, --ignore-case fold lower case to upper case characters","-h, --human-numeric-sort compare human readable numbers (e.g., 2K 1G)","-M, --month-sort compare (unknown) < 'JAN' < ... < 'DEC'","-n, --numeric-sort compare according to string numerical value","-r, --reverse reverse the result of comparisons","-V, --version-sort natural sort of (version) numbers within text","-c, --check check for sorted input; do not sort","-o, --output=FILE write result to FILE instead of stdout","-s, --stable stabilize sort by disabling last-resort comparison","-u, --unique output only unique lines","-k, --key=KEYDEF sort via a key; KEYDEF gives location and type","-t, --field-separator=SEP use SEP as field separator"," --help display this help and exit"],description:`KEYDEF is F[.C][OPTS][,F[.C][OPTS]]
|
|
3
|
+
F is a field number (1-indexed)
|
|
4
|
+
C is a character position within the field (1-indexed)
|
|
5
|
+
OPTS can be: b d f h M n r V (per-key modifiers)
|
|
6
|
+
|
|
7
|
+
Examples:
|
|
8
|
+
-k1 sort by first field
|
|
9
|
+
-k2,2 sort by second field only
|
|
10
|
+
-k1.3 sort by first field starting at 3rd character
|
|
11
|
+
-k1,2n sort by fields 1-2 numerically
|
|
12
|
+
-k2 -k1 sort by field 2, then by field 1`},R={name:"sort",async execute(u,r){if(w(u))return N(H);let e={reverse:!1,numeric:!1,unique:!1,ignoreCase:!1,humanNumeric:!1,versionSort:!1,dictionaryOrder:!1,monthSort:!1,ignoreLeadingBlanks:!1,stable:!1,checkOnly:!1,outputFile:null,keys:[],fieldDelimiter:null},l=[];for(let c=0;c<u.length;c++){let t=u[c];if(t==="-r"||t==="--reverse")e.reverse=!0;else if(t==="-n"||t==="--numeric-sort")e.numeric=!0;else if(t==="-u"||t==="--unique")e.unique=!0;else if(t==="-f"||t==="--ignore-case")e.ignoreCase=!0;else if(t==="-h"||t==="--human-numeric-sort")e.humanNumeric=!0;else if(t==="-V"||t==="--version-sort")e.versionSort=!0;else if(t==="-d"||t==="--dictionary-order")e.dictionaryOrder=!0;else if(t==="-M"||t==="--month-sort")e.monthSort=!0;else if(t==="-b"||t==="--ignore-leading-blanks")e.ignoreLeadingBlanks=!0;else if(t==="-s"||t==="--stable")e.stable=!0;else if(t==="-c"||t==="--check")e.checkOnly=!0;else if(t==="-o"||t==="--output")e.outputFile=u[++c]||null;else if(t.startsWith("-o"))e.outputFile=t.slice(2)||null;else if(t.startsWith("--output="))e.outputFile=t.slice(9)||null;else if(t==="-t"||t==="--field-separator")e.fieldDelimiter=u[++c]||null;else if(t.startsWith("-t"))e.fieldDelimiter=t.slice(2)||null;else if(t.startsWith("--field-separator="))e.fieldDelimiter=t.slice(18)||null;else if(t==="-k"||t==="--key"){let a=u[++c];if(a){let f=y(a);f&&e.keys.push(f)}}else if(t.startsWith("-k")){let a=y(t.slice(2));a&&e.keys.push(a)}else if(t.startsWith("--key=")){let a=y(t.slice(6));a&&e.keys.push(a)}else{if(t.startsWith("--"))return k("sort",t);if(t.startsWith("-")&&!t.startsWith("--")){let a=!1;for(let f of t.slice(1))if(f==="r")e.reverse=!0;else if(f==="n")e.numeric=!0;else if(f==="u")e.unique=!0;else if(f==="f")e.ignoreCase=!0;else if(f==="h")e.humanNumeric=!0;else if(f==="V")e.versionSort=!0;else if(f==="d")e.dictionaryOrder=!0;else if(f==="M")e.monthSort=!0;else if(f==="b")e.ignoreLeadingBlanks=!0;else if(f==="s")e.stable=!0;else if(f==="c")e.checkOnly=!0;else{a=!0;break}if(a)return k("sort",t)}else l.push(t)}}let s=await O(r,l,{cmdName:"sort"});if(!s.ok)return s.error;let n=F(s.content).split(`
|
|
13
|
+
`);n.length>0&&n[n.length-1]===""&&n.pop();let d=B(e);if(e.checkOnly){let c=l.length>0?l[0]:"-";for(let t=1;t<n.length;t++)if(d(n[t-1],n[t])>0)return{stdout:"",stderr:`sort: ${c}:${t+1}: disorder: ${n[t]}
|
|
14
|
+
`,exitCode:1};return{stdout:"",stderr:"",exitCode:0}}n.sort(d),e.unique&&(n=E(n,e));let o=n.length>0?`${n.join(`
|
|
15
|
+
`)}
|
|
16
|
+
`:"";if(e.outputFile){let c=r.fs.resolvePath(r.cwd,e.outputFile);return await r.fs.writeFile(c,o),{stdout:"",stderr:"",exitCode:0}}return{stdout:o,stderr:"",exitCode:0}}},Y={name:"sort",flags:[{flag:"-r",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-u",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-h",type:"boolean"},{flag:"-V",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-M",type:"boolean"},{flag:"-b",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-k",type:"value",valueHint:"string"},{flag:"-t",type:"value",valueHint:"delimiter"},{flag:"-o",type:"value",valueHint:"path"}],stdinType:"text",needsFiles:!0};export{R as a,Y as b};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{e as F}from"./chunk-7IJWBG4I.js";import{l as d,m as h}from"./chunk-TVCZIH6M.js";import{a as x}from"./chunk-QIQMJJZ4.js";import{a as g,b as z}from"./chunk-QAYAQNCG.js";var $={name:"du",summary:"estimate file space usage",usage:"du [OPTION]... [FILE]...",options:["-a write counts for all files, not just directories","-h print sizes in human readable format","-s display only a total for each argument","-c produce a grand total","--max-depth=N print total for directory only if N or fewer levels deep"," --help display this help and exit"]},b={allFiles:{short:"a",type:"boolean"},humanReadable:{short:"h",type:"boolean"},summarize:{short:"s",type:"boolean"},grandTotal:{short:"c",type:"boolean"},maxDepth:{long:"max-depth",type:"number"}},R={name:"du",async execute(t,s){if(z(t))return g($);let a=x("du",t,b);if(!a.ok)return a.error;let l={allFiles:a.result.flags.allFiles,humanReadable:a.result.flags.humanReadable,summarize:a.result.flags.summarize,grandTotal:a.result.flags.grandTotal,maxDepth:a.result.flags.maxDepth??null},i=a.result.positional;i.length===0&&i.push(".");let n="",o="",e=0;for(let u of i){let f=s.fs.resolvePath(s.cwd,u);try{await s.fs.stat(f);let r=await w(s,f,u,l,0);n+=r.output,e+=r.totalSize,o+=r.stderr}catch(r){if(r instanceof d||r instanceof h)throw r;o+=`du: cannot access '${u}': No such file or directory
|
|
3
|
+
`}}return l.grandTotal&&i.length>0&&(n+=`${p(e,l.humanReadable)} total
|
|
4
|
+
`),{stdout:n,stderr:o,exitCode:o?1:0}}};async function w(t,s,a,l,i){let n={output:"",totalSize:0,stderr:""},o=new Map;return await F({fs:t.fs,root:s,limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"du",symlinks:"never",includeLeave:!0},e=>{let u=e.path.slice(s.length).replace(/^\//,""),f=u?a==="."?u:`${a}/${u}`:a,r=e.path==="/"?"/":e.path.slice(0,e.path.lastIndexOf("/"))||"/";if(e.phase==="enter"){if(e.stat.isDirectory){o.set(e.path,0);return}o.set(r,(o.get(r)??0)+e.stat.size),(l.allFiles||e.depth===i)&&!l.summarize&&(n.output+=`${p(e.stat.size,l.humanReadable)} ${f}
|
|
5
|
+
`),e.depth===i&&(n.totalSize=e.stat.size);return}let m=o.get(e.path)??0;e.depth>i?o.set(r,(o.get(r)??0)+m):n.totalSize=m;let c=e.depth-i;(l.summarize&&c===0||!l.summarize&&(l.maxDepth===null||c<=l.maxDepth))&&(n.output+=`${p(m,l.humanReadable)} ${f}
|
|
6
|
+
`)}),n}function p(t,s){return s?t<1024?`${t}`:t<1024*1024?`${(t/1024).toFixed(1)}K`:t<1024*1024*1024?`${(t/(1024*1024)).toFixed(1)}M`:`${(t/(1024*1024*1024)).toFixed(1)}G`:String(Math.ceil(t/1024)||1)}var E={name:"du",flags:[{flag:"-a",type:"boolean"},{flag:"-h",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"--max-depth",type:"value",valueHint:"number"}],needsFiles:!0};export{R as a,E as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{a,b}from"./chunk-EZNS4GF7.js";import"./chunk-FTET43KM.js";import"./chunk-TVCZIH6M.js";import"./chunk-GN6CQ3J4.js";import"./chunk-QIQMJJZ4.js";import"./chunk-QAYAQNCG.js";import"./chunk-NCUTH6QL.js";export{a as column,b as flagsForFuzzing};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{a,b}from"./chunk-WN54B5NQ.js";import"./chunk-7IJWBG4I.js";import"./chunk-YUSFCOM7.js";import"./chunk-TVCZIH6M.js";import"./chunk-GN6CQ3J4.js";import"./chunk-FOCWZZDE.js";import"./chunk-QIQMJJZ4.js";import"./chunk-W5DWRFSU.js";import"./chunk-QAYAQNCG.js";import"./chunk-NCUTH6QL.js";export{a as cpCommand,b as flagsForFuzzing};
|