@eidos.space/just-bash 3.0.2
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 +53 -0
- package/LICENSE +201 -0
- package/README.md +609 -0
- package/dist/AGENTS.md +325 -0
- package/dist/Bash.d.ts +257 -0
- package/dist/ast/types.d.ts +609 -0
- package/dist/banned-patterns-test.d.ts +1 -0
- package/dist/bin/chunks/alias-YRVAW27Y.js +3 -0
- package/dist/bin/chunks/awk2-RLMNTGI7.js +3 -0
- package/dist/bin/chunks/base64-RZRLGMB3.js +3 -0
- package/dist/bin/chunks/basename-F3AQ4KAQ.js +3 -0
- package/dist/bin/chunks/bash-CLP24TE2.js +3 -0
- package/dist/bin/chunks/cat-LQH5FSAR.js +3 -0
- package/dist/bin/chunks/chmod-S564JCJW.js +3 -0
- package/dist/bin/chunks/chunk-22HCD466.js +3 -0
- package/dist/bin/chunks/chunk-2AIXTPH2.js +9 -0
- package/dist/bin/chunks/chunk-2ETT4ELS.js +4 -0
- package/dist/bin/chunks/chunk-2GG3NVC4.js +10 -0
- package/dist/bin/chunks/chunk-2NRAWO6E.js +7 -0
- package/dist/bin/chunks/chunk-2SVX7I5P.js +14 -0
- package/dist/bin/chunks/chunk-3BYTCO2H.js +12 -0
- package/dist/bin/chunks/chunk-3MRB66F4.js +3 -0
- package/dist/bin/chunks/chunk-3UKQXBQ3.js +6 -0
- package/dist/bin/chunks/chunk-3WIMLJM7.js +8 -0
- package/dist/bin/chunks/chunk-47WZ2U6M.js +9 -0
- package/dist/bin/chunks/chunk-4KSZJAQK.js +6 -0
- package/dist/bin/chunks/chunk-5XSZHUEI.js +15 -0
- package/dist/bin/chunks/chunk-6FSBHK6H.js +22 -0
- package/dist/bin/chunks/chunk-6WJQNLR2.js +7 -0
- package/dist/bin/chunks/chunk-77MLOOQS.js +11 -0
- package/dist/bin/chunks/chunk-7AYT3UKI.js +6 -0
- package/dist/bin/chunks/chunk-7JZKVC3F.js +2 -0
- package/dist/bin/chunks/chunk-7NC4CPHS.js +20 -0
- package/dist/bin/chunks/chunk-7UU7KPEM.js +7 -0
- package/dist/bin/chunks/chunk-7VCQWCSH.js +15 -0
- package/dist/bin/chunks/chunk-AGKL4LDL.js +4 -0
- package/dist/bin/chunks/chunk-AJF3OBTR.js +4 -0
- package/dist/bin/chunks/chunk-ALVEEXFD.js +19 -0
- package/dist/bin/chunks/chunk-B2DRBHGQ.js +3 -0
- package/dist/bin/chunks/chunk-BE4PARL3.js +13 -0
- package/dist/bin/chunks/chunk-BGX3RW7H.js +10 -0
- package/dist/bin/chunks/chunk-BIJXTWZ4.js +3 -0
- package/dist/bin/chunks/chunk-BPZJYOUA.js +33 -0
- package/dist/bin/chunks/chunk-BZP56QBM.js +24 -0
- package/dist/bin/chunks/chunk-C7ISPH7Y.js +18 -0
- package/dist/bin/chunks/chunk-CAZ75E7E.js +3 -0
- package/dist/bin/chunks/chunk-D6CPXGKK.js +75 -0
- package/dist/bin/chunks/chunk-DJAX3ZRG.js +8 -0
- package/dist/bin/chunks/chunk-DYIBFLS3.js +17 -0
- package/dist/bin/chunks/chunk-EDTBGO7F.js +37 -0
- package/dist/bin/chunks/chunk-F3GKANW3.js +12 -0
- package/dist/bin/chunks/chunk-F3WNDKOC.js +3 -0
- package/dist/bin/chunks/chunk-FKVQZWJQ.js +10 -0
- package/dist/bin/chunks/chunk-FOUVACI7.js +16 -0
- package/dist/bin/chunks/chunk-FVRXEJYQ.js +141 -0
- package/dist/bin/chunks/chunk-G4AUMZUY.js +4 -0
- package/dist/bin/chunks/chunk-H7JTIXAO.js +4 -0
- package/dist/bin/chunks/chunk-HL4ZS7TX.js +6 -0
- package/dist/bin/chunks/chunk-HN2DCT7T.js +13 -0
- package/dist/bin/chunks/chunk-I4IRHQDW.js +3 -0
- package/dist/bin/chunks/chunk-IEXQTXU5.js +34 -0
- package/dist/bin/chunks/chunk-IZGLHVBB.js +8 -0
- package/dist/bin/chunks/chunk-J7TUF2VI.js +9 -0
- package/dist/bin/chunks/chunk-JNUX75OX.js +85 -0
- package/dist/bin/chunks/chunk-JXLDT4KX.js +4 -0
- package/dist/bin/chunks/chunk-JZW7NFK2.js +288 -0
- package/dist/bin/chunks/chunk-KFMPGSUT.js +9 -0
- package/dist/bin/chunks/chunk-KI54R2QB.js +3 -0
- package/dist/bin/chunks/chunk-KRRM5UCC.js +3 -0
- package/dist/bin/chunks/chunk-KUMHQGUR.js +3 -0
- package/dist/bin/chunks/chunk-L24QXM5S.js +34 -0
- package/dist/bin/chunks/chunk-LAHBP3FW.js +11 -0
- package/dist/bin/chunks/chunk-LC6D27QJ.js +3 -0
- package/dist/bin/chunks/chunk-LNNWMRCB.js +3 -0
- package/dist/bin/chunks/chunk-LNVSXNT7.js +3 -0
- package/dist/bin/chunks/chunk-LSQTB2QK.js +7 -0
- package/dist/bin/chunks/chunk-M65CQLJE.js +101 -0
- package/dist/bin/chunks/chunk-MLUOPG3W.js +3 -0
- package/dist/bin/chunks/chunk-MNWK4UIM.js +22 -0
- package/dist/bin/chunks/chunk-MROECM42.js +3 -0
- package/dist/bin/chunks/chunk-MUFNRCMY.js +24 -0
- package/dist/bin/chunks/chunk-N6YW4W3Z.js +29 -0
- package/dist/bin/chunks/chunk-NE4R2FVV.js +5 -0
- package/dist/bin/chunks/chunk-NXVG64T3.js +22 -0
- package/dist/bin/chunks/chunk-NYIPFY36.js +3 -0
- package/dist/bin/chunks/chunk-O2BCKSMK.js +3 -0
- package/dist/bin/chunks/chunk-OLEQNRKX.js +8 -0
- package/dist/bin/chunks/chunk-OPMLWMNH.js +17 -0
- package/dist/bin/chunks/chunk-PAYQNSZN.js +18 -0
- package/dist/bin/chunks/chunk-PBOVSFTJ.js +3 -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-Q4UMTSRO.js +15 -0
- package/dist/bin/chunks/chunk-QL33F2W6.js +8 -0
- package/dist/bin/chunks/chunk-RVPTAYDS.js +4 -0
- package/dist/bin/chunks/chunk-SMSELHIY.js +12 -0
- package/dist/bin/chunks/chunk-UGJM7CKP.js +17 -0
- package/dist/bin/chunks/chunk-UO5LOD7U.js +12 -0
- package/dist/bin/chunks/chunk-UOMNSQEZ.js +10 -0
- package/dist/bin/chunks/chunk-UR4CEP4Y.js +3 -0
- package/dist/bin/chunks/chunk-V2RP73X4.js +15 -0
- package/dist/bin/chunks/chunk-VBDLSL7Y.js +10 -0
- package/dist/bin/chunks/chunk-VZK4FHWJ.js +3 -0
- package/dist/bin/chunks/chunk-WDWNEHHE.js +9 -0
- package/dist/bin/chunks/chunk-X4MX6EHF.js +6 -0
- package/dist/bin/chunks/chunk-XBB73LFB.js +5 -0
- package/dist/bin/chunks/chunk-XFFUAO3F.js +3 -0
- package/dist/bin/chunks/chunk-XHCCSVP6.js +9 -0
- package/dist/bin/chunks/chunk-XJ37N3S5.js +7 -0
- package/dist/bin/chunks/chunk-XPTYN6UE.js +8 -0
- package/dist/bin/chunks/chunk-XRUDFQG5.js +7 -0
- package/dist/bin/chunks/chunk-Y4FPH5DQ.js +64 -0
- package/dist/bin/chunks/chunk-YJ5OCPSK.js +7 -0
- package/dist/bin/chunks/chunk-YOIFOOGX.js +9 -0
- package/dist/bin/chunks/chunk-YOKQNNQO.js +6 -0
- package/dist/bin/chunks/chunk-YUZRUF5F.js +10 -0
- package/dist/bin/chunks/chunk-YY5PJR7O.js +7 -0
- package/dist/bin/chunks/chunk-ZFUVUYWG.js +15 -0
- package/dist/bin/chunks/clear-FGNEKYDU.js +3 -0
- package/dist/bin/chunks/column-AQB3A3PJ.js +3 -0
- package/dist/bin/chunks/comm-Q4VDF6ZO.js +3 -0
- package/dist/bin/chunks/cp-HYXTMN3D.js +3 -0
- package/dist/bin/chunks/curl-PLHETP4J.js +27 -0
- package/dist/bin/chunks/cut-ZI2HIAW7.js +3 -0
- package/dist/bin/chunks/date-JEZYSA4F.js +3 -0
- package/dist/bin/chunks/diff-YDJ42RKS.js +3 -0
- package/dist/bin/chunks/dirname-VCINTLPD.js +3 -0
- package/dist/bin/chunks/du-4LRQIGRG.js +3 -0
- package/dist/bin/chunks/echo-KCOHTNDF.js +3 -0
- package/dist/bin/chunks/env-NY32PQJM.js +3 -0
- package/dist/bin/chunks/expand-YYSO35NS.js +3 -0
- package/dist/bin/chunks/expansion-PPP6PD75.js +3 -0
- package/dist/bin/chunks/expr-7PLWSWZI.js +3 -0
- package/dist/bin/chunks/file-GRZLWDVH.js +3 -0
- package/dist/bin/chunks/find-P4DOE7CE.js +3 -0
- package/dist/bin/chunks/flag-coverage-RFKIBJ6L.js +3 -0
- package/dist/bin/chunks/fold-5MF7QZWQ.js +3 -0
- package/dist/bin/chunks/grep-VAYCFO4O.js +3 -0
- package/dist/bin/chunks/gzip-UGBQQKIH.js +3 -0
- package/dist/bin/chunks/head-QNC2ZYDO.js +3 -0
- package/dist/bin/chunks/help-CGUEOGXQ.js +3 -0
- package/dist/bin/chunks/history-AQQWW3QB.js +3 -0
- package/dist/bin/chunks/hostname-USNWOQCK.js +3 -0
- package/dist/bin/chunks/html-to-markdown-QEFY7XQR.js +3 -0
- package/dist/bin/chunks/join-EJ73DYTK.js +3 -0
- package/dist/bin/chunks/jq-GGTKKMEN.js +3 -0
- package/dist/bin/chunks/js-exec-BC6NI55L.js +98 -0
- package/dist/bin/chunks/js-exec-worker.js +4443 -0
- package/dist/bin/chunks/ln-LP4HMCSM.js +3 -0
- package/dist/bin/chunks/ls-KBNHNZWQ.js +3 -0
- package/dist/bin/chunks/md5sum-MCVDIB35.js +3 -0
- package/dist/bin/chunks/mkdir-P4DKRCDX.js +3 -0
- package/dist/bin/chunks/mv-QQK4FQX6.js +3 -0
- package/dist/bin/chunks/nl-KUPLVCTS.js +3 -0
- package/dist/bin/chunks/od-YQ5ZUI2H.js +3 -0
- package/dist/bin/chunks/paste-A5KKPWXX.js +3 -0
- package/dist/bin/chunks/printf-Z5C2UOI5.js +3 -0
- package/dist/bin/chunks/pwd-FCNDA467.js +3 -0
- package/dist/bin/chunks/python3-BQWDPUBM.js +13 -0
- package/dist/bin/chunks/readlink-25V57VOL.js +3 -0
- package/dist/bin/chunks/rev-PYHOZ4D4.js +3 -0
- package/dist/bin/chunks/rg-BGFMSIVK.js +3 -0
- package/dist/bin/chunks/rm-ECNUFR66.js +3 -0
- package/dist/bin/chunks/rmdir-DLOHIA7Q.js +3 -0
- package/dist/bin/chunks/sed-FWA634SN.js +3 -0
- package/dist/bin/chunks/seq-UXDJE6FB.js +3 -0
- package/dist/bin/chunks/sha1sum-4KF52U3Y.js +3 -0
- package/dist/bin/chunks/sha256sum-6YEPULPX.js +3 -0
- package/dist/bin/chunks/sleep-QHAPNY3Q.js +3 -0
- package/dist/bin/chunks/sort-4C6WOKNK.js +3 -0
- package/dist/bin/chunks/split-TV7NL7LA.js +3 -0
- package/dist/bin/chunks/sqlite3-W777NCI4.js +3 -0
- package/dist/bin/chunks/sqlite3-worker.js +1728 -0
- package/dist/bin/chunks/stat-BD6KT3BP.js +3 -0
- package/dist/bin/chunks/strings-MDD72LR6.js +3 -0
- package/dist/bin/chunks/tac-C2N4NQ6S.js +3 -0
- package/dist/bin/chunks/tail-BCB5W6JC.js +3 -0
- package/dist/bin/chunks/tar-DOO744MK.js +3 -0
- package/dist/bin/chunks/tee-UQHPO4OW.js +3 -0
- package/dist/bin/chunks/time-ZPY52VT2.js +3 -0
- package/dist/bin/chunks/timeout-5AX3ZS3X.js +3 -0
- package/dist/bin/chunks/touch-DFGSVIX7.js +3 -0
- package/dist/bin/chunks/tr-G7K6M6HP.js +3 -0
- package/dist/bin/chunks/tree-6D7SMPUR.js +3 -0
- package/dist/bin/chunks/true-SKL4L7JP.js +3 -0
- package/dist/bin/chunks/unexpand-QIR4EDPG.js +3 -0
- package/dist/bin/chunks/uniq-I7PVFJR4.js +3 -0
- package/dist/bin/chunks/wc-6NGWULAP.js +3 -0
- package/dist/bin/chunks/which-LCXKCLFC.js +3 -0
- package/dist/bin/chunks/whoami-TZDZDU7T.js +3 -0
- package/dist/bin/chunks/worker.js +3150 -0
- package/dist/bin/chunks/xan-KX4VPXUN.js +3 -0
- package/dist/bin/chunks/xan-view-JXOZLJ7S.js +3 -0
- package/dist/bin/chunks/xargs-UWHPYLY7.js +3 -0
- package/dist/bin/chunks/yq-GCDCJBKB.js +3 -0
- package/dist/bin/just-bash.js +755 -0
- package/dist/bin/shell/chunks/alias-YRVAW27Y.js +3 -0
- package/dist/bin/shell/chunks/awk2-RLMNTGI7.js +3 -0
- package/dist/bin/shell/chunks/base64-RZRLGMB3.js +3 -0
- package/dist/bin/shell/chunks/basename-F3AQ4KAQ.js +3 -0
- package/dist/bin/shell/chunks/bash-CLP24TE2.js +3 -0
- package/dist/bin/shell/chunks/cat-LQH5FSAR.js +3 -0
- package/dist/bin/shell/chunks/chmod-S564JCJW.js +3 -0
- package/dist/bin/shell/chunks/chunk-22HCD466.js +3 -0
- package/dist/bin/shell/chunks/chunk-2AIXTPH2.js +9 -0
- package/dist/bin/shell/chunks/chunk-2ETT4ELS.js +4 -0
- package/dist/bin/shell/chunks/chunk-2GG3NVC4.js +10 -0
- package/dist/bin/shell/chunks/chunk-2NRAWO6E.js +7 -0
- package/dist/bin/shell/chunks/chunk-2SVX7I5P.js +14 -0
- package/dist/bin/shell/chunks/chunk-3BYTCO2H.js +12 -0
- package/dist/bin/shell/chunks/chunk-3MRB66F4.js +3 -0
- package/dist/bin/shell/chunks/chunk-3UKQXBQ3.js +6 -0
- package/dist/bin/shell/chunks/chunk-3WIMLJM7.js +8 -0
- package/dist/bin/shell/chunks/chunk-47WZ2U6M.js +9 -0
- package/dist/bin/shell/chunks/chunk-4KSZJAQK.js +6 -0
- package/dist/bin/shell/chunks/chunk-5XSZHUEI.js +15 -0
- package/dist/bin/shell/chunks/chunk-6FSBHK6H.js +22 -0
- package/dist/bin/shell/chunks/chunk-6WJQNLR2.js +7 -0
- package/dist/bin/shell/chunks/chunk-77MLOOQS.js +11 -0
- package/dist/bin/shell/chunks/chunk-7AYT3UKI.js +6 -0
- package/dist/bin/shell/chunks/chunk-7JZKVC3F.js +2 -0
- package/dist/bin/shell/chunks/chunk-7NC4CPHS.js +20 -0
- package/dist/bin/shell/chunks/chunk-7UU7KPEM.js +7 -0
- package/dist/bin/shell/chunks/chunk-7VCQWCSH.js +15 -0
- package/dist/bin/shell/chunks/chunk-AGKL4LDL.js +4 -0
- package/dist/bin/shell/chunks/chunk-AJF3OBTR.js +4 -0
- package/dist/bin/shell/chunks/chunk-ALVEEXFD.js +19 -0
- package/dist/bin/shell/chunks/chunk-B2DRBHGQ.js +3 -0
- package/dist/bin/shell/chunks/chunk-BE4PARL3.js +13 -0
- package/dist/bin/shell/chunks/chunk-BGX3RW7H.js +10 -0
- package/dist/bin/shell/chunks/chunk-BIJXTWZ4.js +3 -0
- package/dist/bin/shell/chunks/chunk-BPZJYOUA.js +33 -0
- package/dist/bin/shell/chunks/chunk-BZP56QBM.js +24 -0
- package/dist/bin/shell/chunks/chunk-C7ISPH7Y.js +18 -0
- package/dist/bin/shell/chunks/chunk-CAZ75E7E.js +3 -0
- package/dist/bin/shell/chunks/chunk-D6CPXGKK.js +75 -0
- package/dist/bin/shell/chunks/chunk-DJAX3ZRG.js +8 -0
- package/dist/bin/shell/chunks/chunk-DYIBFLS3.js +17 -0
- package/dist/bin/shell/chunks/chunk-EDTBGO7F.js +37 -0
- package/dist/bin/shell/chunks/chunk-F3GKANW3.js +12 -0
- package/dist/bin/shell/chunks/chunk-F3WNDKOC.js +3 -0
- package/dist/bin/shell/chunks/chunk-FKVQZWJQ.js +10 -0
- package/dist/bin/shell/chunks/chunk-FOUVACI7.js +16 -0
- package/dist/bin/shell/chunks/chunk-FVRXEJYQ.js +141 -0
- package/dist/bin/shell/chunks/chunk-G4AUMZUY.js +4 -0
- package/dist/bin/shell/chunks/chunk-H7JTIXAO.js +4 -0
- package/dist/bin/shell/chunks/chunk-HL4ZS7TX.js +6 -0
- package/dist/bin/shell/chunks/chunk-HN2DCT7T.js +13 -0
- package/dist/bin/shell/chunks/chunk-I4IRHQDW.js +3 -0
- package/dist/bin/shell/chunks/chunk-IEXQTXU5.js +34 -0
- package/dist/bin/shell/chunks/chunk-IZGLHVBB.js +8 -0
- package/dist/bin/shell/chunks/chunk-J7TUF2VI.js +9 -0
- package/dist/bin/shell/chunks/chunk-JNUX75OX.js +85 -0
- package/dist/bin/shell/chunks/chunk-JXLDT4KX.js +4 -0
- package/dist/bin/shell/chunks/chunk-JZW7NFK2.js +288 -0
- package/dist/bin/shell/chunks/chunk-KFMPGSUT.js +9 -0
- package/dist/bin/shell/chunks/chunk-KI54R2QB.js +3 -0
- package/dist/bin/shell/chunks/chunk-KRRM5UCC.js +3 -0
- package/dist/bin/shell/chunks/chunk-KUMHQGUR.js +3 -0
- package/dist/bin/shell/chunks/chunk-L24QXM5S.js +34 -0
- package/dist/bin/shell/chunks/chunk-LAHBP3FW.js +11 -0
- package/dist/bin/shell/chunks/chunk-LC6D27QJ.js +3 -0
- package/dist/bin/shell/chunks/chunk-LNNWMRCB.js +3 -0
- package/dist/bin/shell/chunks/chunk-LNVSXNT7.js +3 -0
- package/dist/bin/shell/chunks/chunk-LSQTB2QK.js +7 -0
- package/dist/bin/shell/chunks/chunk-M65CQLJE.js +101 -0
- package/dist/bin/shell/chunks/chunk-MLUOPG3W.js +3 -0
- package/dist/bin/shell/chunks/chunk-MNWK4UIM.js +22 -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-N6YW4W3Z.js +29 -0
- package/dist/bin/shell/chunks/chunk-NE4R2FVV.js +5 -0
- package/dist/bin/shell/chunks/chunk-NXVG64T3.js +22 -0
- package/dist/bin/shell/chunks/chunk-NYIPFY36.js +3 -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-OPMLWMNH.js +17 -0
- package/dist/bin/shell/chunks/chunk-PAYQNSZN.js +18 -0
- package/dist/bin/shell/chunks/chunk-PBOVSFTJ.js +3 -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-Q4UMTSRO.js +15 -0
- package/dist/bin/shell/chunks/chunk-QL33F2W6.js +8 -0
- package/dist/bin/shell/chunks/chunk-RVPTAYDS.js +4 -0
- package/dist/bin/shell/chunks/chunk-SMSELHIY.js +12 -0
- package/dist/bin/shell/chunks/chunk-UGJM7CKP.js +17 -0
- package/dist/bin/shell/chunks/chunk-UO5LOD7U.js +12 -0
- package/dist/bin/shell/chunks/chunk-UOMNSQEZ.js +10 -0
- package/dist/bin/shell/chunks/chunk-UR4CEP4Y.js +3 -0
- package/dist/bin/shell/chunks/chunk-V2RP73X4.js +15 -0
- package/dist/bin/shell/chunks/chunk-VBDLSL7Y.js +10 -0
- package/dist/bin/shell/chunks/chunk-VZK4FHWJ.js +3 -0
- package/dist/bin/shell/chunks/chunk-WDWNEHHE.js +9 -0
- package/dist/bin/shell/chunks/chunk-X4MX6EHF.js +6 -0
- package/dist/bin/shell/chunks/chunk-XBB73LFB.js +5 -0
- package/dist/bin/shell/chunks/chunk-XFFUAO3F.js +3 -0
- package/dist/bin/shell/chunks/chunk-XHCCSVP6.js +9 -0
- package/dist/bin/shell/chunks/chunk-XJ37N3S5.js +7 -0
- package/dist/bin/shell/chunks/chunk-XPTYN6UE.js +8 -0
- package/dist/bin/shell/chunks/chunk-XRUDFQG5.js +7 -0
- package/dist/bin/shell/chunks/chunk-Y4FPH5DQ.js +64 -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-YOKQNNQO.js +6 -0
- package/dist/bin/shell/chunks/chunk-YUZRUF5F.js +10 -0
- package/dist/bin/shell/chunks/chunk-YY5PJR7O.js +7 -0
- package/dist/bin/shell/chunks/chunk-ZFUVUYWG.js +15 -0
- package/dist/bin/shell/chunks/clear-FGNEKYDU.js +3 -0
- package/dist/bin/shell/chunks/column-AQB3A3PJ.js +3 -0
- package/dist/bin/shell/chunks/comm-Q4VDF6ZO.js +3 -0
- package/dist/bin/shell/chunks/cp-HYXTMN3D.js +3 -0
- package/dist/bin/shell/chunks/curl-PLHETP4J.js +27 -0
- package/dist/bin/shell/chunks/cut-ZI2HIAW7.js +3 -0
- package/dist/bin/shell/chunks/date-JEZYSA4F.js +3 -0
- package/dist/bin/shell/chunks/diff-YDJ42RKS.js +3 -0
- package/dist/bin/shell/chunks/dirname-VCINTLPD.js +3 -0
- package/dist/bin/shell/chunks/du-4LRQIGRG.js +3 -0
- package/dist/bin/shell/chunks/echo-KCOHTNDF.js +3 -0
- package/dist/bin/shell/chunks/env-NY32PQJM.js +3 -0
- package/dist/bin/shell/chunks/expand-YYSO35NS.js +3 -0
- package/dist/bin/shell/chunks/expansion-PPP6PD75.js +3 -0
- package/dist/bin/shell/chunks/expr-7PLWSWZI.js +3 -0
- package/dist/bin/shell/chunks/file-GRZLWDVH.js +3 -0
- package/dist/bin/shell/chunks/find-P4DOE7CE.js +3 -0
- package/dist/bin/shell/chunks/flag-coverage-RFKIBJ6L.js +3 -0
- package/dist/bin/shell/chunks/fold-5MF7QZWQ.js +3 -0
- package/dist/bin/shell/chunks/grep-VAYCFO4O.js +3 -0
- package/dist/bin/shell/chunks/gzip-UGBQQKIH.js +3 -0
- package/dist/bin/shell/chunks/head-QNC2ZYDO.js +3 -0
- package/dist/bin/shell/chunks/help-CGUEOGXQ.js +3 -0
- package/dist/bin/shell/chunks/history-AQQWW3QB.js +3 -0
- package/dist/bin/shell/chunks/hostname-USNWOQCK.js +3 -0
- package/dist/bin/shell/chunks/html-to-markdown-QEFY7XQR.js +3 -0
- package/dist/bin/shell/chunks/join-EJ73DYTK.js +3 -0
- package/dist/bin/shell/chunks/jq-GGTKKMEN.js +3 -0
- package/dist/bin/shell/chunks/js-exec-BC6NI55L.js +98 -0
- package/dist/bin/shell/chunks/ln-LP4HMCSM.js +3 -0
- package/dist/bin/shell/chunks/ls-KBNHNZWQ.js +3 -0
- package/dist/bin/shell/chunks/md5sum-MCVDIB35.js +3 -0
- package/dist/bin/shell/chunks/mkdir-P4DKRCDX.js +3 -0
- package/dist/bin/shell/chunks/mv-QQK4FQX6.js +3 -0
- package/dist/bin/shell/chunks/nl-KUPLVCTS.js +3 -0
- package/dist/bin/shell/chunks/od-YQ5ZUI2H.js +3 -0
- package/dist/bin/shell/chunks/paste-A5KKPWXX.js +3 -0
- package/dist/bin/shell/chunks/printf-Z5C2UOI5.js +3 -0
- package/dist/bin/shell/chunks/pwd-FCNDA467.js +3 -0
- package/dist/bin/shell/chunks/python3-BQWDPUBM.js +13 -0
- package/dist/bin/shell/chunks/readlink-25V57VOL.js +3 -0
- package/dist/bin/shell/chunks/rev-PYHOZ4D4.js +3 -0
- package/dist/bin/shell/chunks/rg-BGFMSIVK.js +3 -0
- package/dist/bin/shell/chunks/rm-ECNUFR66.js +3 -0
- package/dist/bin/shell/chunks/rmdir-DLOHIA7Q.js +3 -0
- package/dist/bin/shell/chunks/sed-FWA634SN.js +3 -0
- package/dist/bin/shell/chunks/seq-UXDJE6FB.js +3 -0
- package/dist/bin/shell/chunks/sha1sum-4KF52U3Y.js +3 -0
- package/dist/bin/shell/chunks/sha256sum-6YEPULPX.js +3 -0
- package/dist/bin/shell/chunks/sleep-QHAPNY3Q.js +3 -0
- package/dist/bin/shell/chunks/sort-4C6WOKNK.js +3 -0
- package/dist/bin/shell/chunks/split-TV7NL7LA.js +3 -0
- package/dist/bin/shell/chunks/sqlite3-W777NCI4.js +3 -0
- package/dist/bin/shell/chunks/stat-BD6KT3BP.js +3 -0
- package/dist/bin/shell/chunks/strings-MDD72LR6.js +3 -0
- package/dist/bin/shell/chunks/tac-C2N4NQ6S.js +3 -0
- package/dist/bin/shell/chunks/tail-BCB5W6JC.js +3 -0
- package/dist/bin/shell/chunks/tar-DOO744MK.js +3 -0
- package/dist/bin/shell/chunks/tee-UQHPO4OW.js +3 -0
- package/dist/bin/shell/chunks/time-ZPY52VT2.js +3 -0
- package/dist/bin/shell/chunks/timeout-5AX3ZS3X.js +3 -0
- package/dist/bin/shell/chunks/touch-DFGSVIX7.js +3 -0
- package/dist/bin/shell/chunks/tr-G7K6M6HP.js +3 -0
- package/dist/bin/shell/chunks/tree-6D7SMPUR.js +3 -0
- package/dist/bin/shell/chunks/true-SKL4L7JP.js +3 -0
- package/dist/bin/shell/chunks/unexpand-QIR4EDPG.js +3 -0
- package/dist/bin/shell/chunks/uniq-I7PVFJR4.js +3 -0
- package/dist/bin/shell/chunks/wc-6NGWULAP.js +3 -0
- package/dist/bin/shell/chunks/which-LCXKCLFC.js +3 -0
- package/dist/bin/shell/chunks/whoami-TZDZDU7T.js +3 -0
- package/dist/bin/shell/chunks/xan-KX4VPXUN.js +3 -0
- package/dist/bin/shell/chunks/xan-view-JXOZLJ7S.js +3 -0
- package/dist/bin/shell/chunks/xargs-UWHPYLY7.js +3 -0
- package/dist/bin/shell/chunks/yq-GCDCJBKB.js +3 -0
- package/dist/bin/shell/shell.js +734 -0
- package/dist/browser.d.ts +23 -0
- package/dist/bundle/browser.js +1515 -0
- package/dist/bundle/chunks/alias-RTYYYW3D.js +2 -0
- package/dist/bundle/chunks/awk2-LA3USKJP.js +2 -0
- package/dist/bundle/chunks/base64-C2AIWVNC.js +2 -0
- package/dist/bundle/chunks/basename-UB3CIYNI.js +2 -0
- package/dist/bundle/chunks/bash-YZ33HQZQ.js +2 -0
- package/dist/bundle/chunks/cat-TSFMZVYS.js +2 -0
- package/dist/bundle/chunks/chmod-TFEPA42X.js +2 -0
- package/dist/bundle/chunks/chunk-27JIFWUR.js +3 -0
- package/dist/bundle/chunks/chunk-2JIPICV3.js +13 -0
- package/dist/bundle/chunks/chunk-2SMD2AUA.js +3 -0
- package/dist/bundle/chunks/chunk-2VDTE5BV.js +14 -0
- package/dist/bundle/chunks/chunk-2VJJEDV2.js +8 -0
- package/dist/bundle/chunks/chunk-46RN27KI.js +100 -0
- package/dist/bundle/chunks/chunk-4I3HOE5Z.js +21 -0
- package/dist/bundle/chunks/chunk-4JLVZKHC.js +8 -0
- package/dist/bundle/chunks/chunk-4MZPEZTU.js +3 -0
- package/dist/bundle/chunks/chunk-4N6J7B5P.js +6 -0
- package/dist/bundle/chunks/chunk-4RUAZWKT.js +33 -0
- package/dist/bundle/chunks/chunk-4WKZNNJK.js +2 -0
- package/dist/bundle/chunks/chunk-5H5SCKJM.js +11 -0
- package/dist/bundle/chunks/chunk-6LASZU3O.js +5 -0
- package/dist/bundle/chunks/chunk-6SHYIICL.js +4 -0
- package/dist/bundle/chunks/chunk-6VAT5Z2D.js +5 -0
- package/dist/bundle/chunks/chunk-7AISL3XV.js +12 -0
- package/dist/bundle/chunks/chunk-7EUWTCWK.js +2 -0
- package/dist/bundle/chunks/chunk-7JHM3L42.js +6 -0
- package/dist/bundle/chunks/chunk-A4R2GWRF.js +9 -0
- package/dist/bundle/chunks/chunk-ACSZB4FE.js +11 -0
- package/dist/bundle/chunks/chunk-AQ6FYS2X.js +2 -0
- package/dist/bundle/chunks/chunk-BVKWRAS6.js +12 -0
- package/dist/bundle/chunks/chunk-BZUGFHVS.js +2 -0
- package/dist/bundle/chunks/chunk-CBJVD2XA.js +7 -0
- package/dist/bundle/chunks/chunk-CHFEPBH4.js +18 -0
- package/dist/bundle/chunks/chunk-CN5XGDNN.js +6 -0
- package/dist/bundle/chunks/chunk-DLL7UR66.js +2 -0
- package/dist/bundle/chunks/chunk-EBAPSGAO.js +9 -0
- package/dist/bundle/chunks/chunk-FAXLQUCQ.js +10 -0
- package/dist/bundle/chunks/chunk-FHC24QSK.js +7 -0
- package/dist/bundle/chunks/chunk-FJK43EBQ.js +14 -0
- package/dist/bundle/chunks/chunk-FOCWZZDE.js +2 -0
- package/dist/bundle/chunks/chunk-FW54FHZR.js +2 -0
- package/dist/bundle/chunks/chunk-FX4RBUYU.js +5 -0
- package/dist/bundle/chunks/chunk-FX7KQCEA.js +33 -0
- package/dist/bundle/chunks/chunk-FZRQOL3C.js +7 -0
- package/dist/bundle/chunks/chunk-G5EVRAOO.js +74 -0
- package/dist/bundle/chunks/chunk-GGC5NEPZ.js +8 -0
- package/dist/bundle/chunks/chunk-GIUR5SNU.js +15 -0
- package/dist/bundle/chunks/chunk-GJC3WVOW.js +2 -0
- package/dist/bundle/chunks/chunk-GSPYNYZA.js +6 -0
- package/dist/bundle/chunks/chunk-GTQIUQM6.js +5 -0
- package/dist/bundle/chunks/chunk-HBVMHTO5.js +2 -0
- package/dist/bundle/chunks/chunk-HDRAUQK2.js +2 -0
- package/dist/bundle/chunks/chunk-HJBTD7PY.js +21 -0
- package/dist/bundle/chunks/chunk-ICIEVHY5.js +36 -0
- package/dist/bundle/chunks/chunk-KATRCGLX.js +2 -0
- package/dist/bundle/chunks/chunk-KD3KENL6.js +11 -0
- package/dist/bundle/chunks/chunk-KWGBQNTV.js +32 -0
- package/dist/bundle/chunks/chunk-L2UW7DWF.js +2 -0
- package/dist/bundle/chunks/chunk-L64BMZUV.js +2 -0
- package/dist/bundle/chunks/chunk-LEKBROJD.js +6 -0
- package/dist/bundle/chunks/chunk-LNBPBRV4.js +21 -0
- package/dist/bundle/chunks/chunk-LPJEKUCB.js +8 -0
- package/dist/bundle/chunks/chunk-LSLPJOYM.js +3 -0
- package/dist/bundle/chunks/chunk-MFDPAVC6.js +14 -0
- package/dist/bundle/chunks/chunk-MLIO3BK2.js +7 -0
- package/dist/bundle/chunks/chunk-MQKGGNPS.js +16 -0
- package/dist/bundle/chunks/chunk-MZFCCXPZ.js +63 -0
- package/dist/bundle/chunks/chunk-N6DXJ2JN.js +287 -0
- package/dist/bundle/chunks/chunk-NRSASXYY.js +2 -0
- package/dist/bundle/chunks/chunk-OC35HPHG.js +2 -0
- package/dist/bundle/chunks/chunk-OGJ5CFPR.js +9 -0
- package/dist/bundle/chunks/chunk-OVGANXCG.js +8 -0
- package/dist/bundle/chunks/chunk-Q7H5W7YE.js +140 -0
- package/dist/bundle/chunks/chunk-QAYAQNCG.js +23 -0
- package/dist/bundle/chunks/chunk-QIQMJJZ4.js +4 -0
- package/dist/bundle/chunks/chunk-R4IFXNY5.js +28 -0
- package/dist/bundle/chunks/chunk-R74UQCKX.js +5 -0
- package/dist/bundle/chunks/chunk-S3LEJEPP.js +2 -0
- package/dist/bundle/chunks/chunk-S443BAN4.js +7 -0
- package/dist/bundle/chunks/chunk-SAI2SPQQ.js +8 -0
- package/dist/bundle/chunks/chunk-SBBYKIYU.js +3 -0
- package/dist/bundle/chunks/chunk-SETW5JBN.js +9 -0
- package/dist/bundle/chunks/chunk-SHKOQWO4.js +3 -0
- package/dist/bundle/chunks/chunk-SJYEXC2Z.js +14 -0
- package/dist/bundle/chunks/chunk-SO6R3ZKN.js +16 -0
- package/dist/bundle/chunks/chunk-STHBFACM.js +1 -0
- package/dist/bundle/chunks/chunk-SX2HC7SO.js +2 -0
- package/dist/bundle/chunks/chunk-T4TFLF3R.js +16 -0
- package/dist/bundle/chunks/chunk-TDD4NFYE.js +2 -0
- package/dist/bundle/chunks/chunk-TN7HHBQW.js +5 -0
- package/dist/bundle/chunks/chunk-U73A73IE.js +17 -0
- package/dist/bundle/chunks/chunk-UIJUTQPH.js +3 -0
- package/dist/bundle/chunks/chunk-UP6MSJGD.js +17 -0
- package/dist/bundle/chunks/chunk-VLCHOJWK.js +6 -0
- package/dist/bundle/chunks/chunk-VPADYNBD.js +10 -0
- package/dist/bundle/chunks/chunk-W5DWRFSU.js +2 -0
- package/dist/bundle/chunks/chunk-WM5IJFMP.js +8 -0
- package/dist/bundle/chunks/chunk-WNH3HOQA.js +2 -0
- package/dist/bundle/chunks/chunk-WPGQVBSY.js +6 -0
- package/dist/bundle/chunks/chunk-WVRWIZF5.js +23 -0
- package/dist/bundle/chunks/chunk-XCQWV4AU.js +12 -0
- package/dist/bundle/chunks/chunk-XDGLKIHR.js +9 -0
- package/dist/bundle/chunks/chunk-XHLMAZX2.js +5 -0
- package/dist/bundle/chunks/chunk-XRFHFXFP.js +2 -0
- package/dist/bundle/chunks/chunk-XUIHBHL5.js +5 -0
- package/dist/bundle/chunks/chunk-XYXUMFSU.js +14 -0
- package/dist/bundle/chunks/chunk-Y4LIDHSD.js +7 -0
- package/dist/bundle/chunks/chunk-YCLFEX4T.js +3 -0
- package/dist/bundle/chunks/chunk-YS4NUBYX.js +9 -0
- package/dist/bundle/chunks/chunk-ZDIT6ST5.js +7 -0
- package/dist/bundle/chunks/chunk-ZDPFA4L3.js +6 -0
- package/dist/bundle/chunks/chunk-ZZKH2ELC.js +11 -0
- package/dist/bundle/chunks/clear-HKGFEOF6.js +2 -0
- package/dist/bundle/chunks/column-XT6UFXNQ.js +2 -0
- package/dist/bundle/chunks/comm-VV2LDX2J.js +2 -0
- package/dist/bundle/chunks/cp-BISAAS7A.js +2 -0
- package/dist/bundle/chunks/curl-GRYA74XW.js +26 -0
- package/dist/bundle/chunks/cut-OKARJCCV.js +2 -0
- package/dist/bundle/chunks/date-UUUPW43J.js +2 -0
- package/dist/bundle/chunks/diff-MWJFIG7X.js +2 -0
- package/dist/bundle/chunks/dirname-MPHRFUTI.js +2 -0
- package/dist/bundle/chunks/du-572XNP42.js +2 -0
- package/dist/bundle/chunks/echo-NDWZZHPO.js +2 -0
- package/dist/bundle/chunks/env-36M5BO7M.js +2 -0
- package/dist/bundle/chunks/expand-JSPG6VOP.js +2 -0
- package/dist/bundle/chunks/expansion-R25BK4W3.js +2 -0
- package/dist/bundle/chunks/expr-5JAACS4X.js +2 -0
- package/dist/bundle/chunks/file-IPZJC3FQ.js +2 -0
- package/dist/bundle/chunks/find-INTH3OLC.js +2 -0
- package/dist/bundle/chunks/flag-coverage-XWSYNE72.js +2 -0
- package/dist/bundle/chunks/fold-4TQNYMSW.js +2 -0
- package/dist/bundle/chunks/grep-V3LQVMRQ.js +2 -0
- package/dist/bundle/chunks/gzip-O5ASJAFY.js +2 -0
- package/dist/bundle/chunks/head-442HYESI.js +2 -0
- package/dist/bundle/chunks/help-HZ6M2CKN.js +2 -0
- package/dist/bundle/chunks/history-WYYKSLSZ.js +2 -0
- package/dist/bundle/chunks/hostname-C4HQXXUP.js +2 -0
- package/dist/bundle/chunks/html-to-markdown-JW4MSQZO.js +2 -0
- package/dist/bundle/chunks/join-TBRGI3LQ.js +2 -0
- package/dist/bundle/chunks/jq-4XLYLOS5.js +2 -0
- package/dist/bundle/chunks/js-exec-N5KEZBH7.js +97 -0
- package/dist/bundle/chunks/js-exec-worker.js +4443 -0
- package/dist/bundle/chunks/ln-4LGSXXGD.js +2 -0
- package/dist/bundle/chunks/ls-ZJGQER7M.js +2 -0
- package/dist/bundle/chunks/md5sum-SPU24VSG.js +2 -0
- package/dist/bundle/chunks/mkdir-MEPGZOB6.js +2 -0
- package/dist/bundle/chunks/mv-W5BIQ646.js +2 -0
- package/dist/bundle/chunks/nl-WSDW7I4O.js +2 -0
- package/dist/bundle/chunks/od-WOKFDJTP.js +2 -0
- package/dist/bundle/chunks/paste-7JC6S4DX.js +2 -0
- package/dist/bundle/chunks/printf-TWGXF445.js +2 -0
- package/dist/bundle/chunks/pwd-WE6EN5AV.js +2 -0
- package/dist/bundle/chunks/python3-POMOR4OA.js +12 -0
- package/dist/bundle/chunks/readlink-OPJF4DL5.js +2 -0
- package/dist/bundle/chunks/rev-5EHFX4EJ.js +2 -0
- package/dist/bundle/chunks/rg-S4FXYXWB.js +2 -0
- package/dist/bundle/chunks/rm-SSGETQVQ.js +2 -0
- package/dist/bundle/chunks/rmdir-OC4ZLPYA.js +2 -0
- package/dist/bundle/chunks/sed-S5UIK574.js +2 -0
- package/dist/bundle/chunks/seq-M5EC7Q57.js +2 -0
- package/dist/bundle/chunks/sha1sum-2PTOAFR6.js +2 -0
- package/dist/bundle/chunks/sha256sum-NS7D3IXX.js +2 -0
- package/dist/bundle/chunks/sleep-X22JJINO.js +2 -0
- package/dist/bundle/chunks/sort-SW2YEO5B.js +2 -0
- package/dist/bundle/chunks/split-4KKZZXXE.js +2 -0
- package/dist/bundle/chunks/sqlite3-CGOEFJAO.js +2 -0
- package/dist/bundle/chunks/sqlite3-worker.js +1728 -0
- package/dist/bundle/chunks/stat-CD34IZ4P.js +2 -0
- package/dist/bundle/chunks/strings-6WDHLGMX.js +2 -0
- package/dist/bundle/chunks/tac-2STMMJYW.js +2 -0
- package/dist/bundle/chunks/tail-R4PCA2C4.js +2 -0
- package/dist/bundle/chunks/tar-STHHZTZ6.js +2 -0
- package/dist/bundle/chunks/tee-YUZ2FKCJ.js +2 -0
- package/dist/bundle/chunks/time-D4LNBSWX.js +2 -0
- package/dist/bundle/chunks/timeout-YDCRSLPQ.js +2 -0
- package/dist/bundle/chunks/touch-UA33VN3N.js +2 -0
- package/dist/bundle/chunks/tr-36LHWFRQ.js +2 -0
- package/dist/bundle/chunks/tree-YLD52CNT.js +2 -0
- package/dist/bundle/chunks/true-FHQXJXBE.js +2 -0
- package/dist/bundle/chunks/unexpand-CADSA4VO.js +2 -0
- package/dist/bundle/chunks/uniq-XSIZR6PB.js +2 -0
- package/dist/bundle/chunks/wc-LF7NU4LA.js +2 -0
- package/dist/bundle/chunks/which-XEM24D5D.js +2 -0
- package/dist/bundle/chunks/whoami-XMTX52VE.js +2 -0
- package/dist/bundle/chunks/worker.js +3150 -0
- package/dist/bundle/chunks/xan-Y6WF3IRG.js +2 -0
- package/dist/bundle/chunks/xan-view-HDVKHFC2.js +2 -0
- package/dist/bundle/chunks/xargs-MGZPH7AX.js +2 -0
- package/dist/bundle/chunks/yq-4QJW3EQG.js +2 -0
- package/dist/bundle/index.cjs +2178 -0
- package/dist/bundle/index.js +710 -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 +75 -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 +100 -0
- package/dist/commands/awk/parser2-print.d.ts +35 -0
- package/dist/commands/awk/parser2.d.ts +81 -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/cp/cp.d.ts +4 -0
- package/dist/commands/curl/curl.d.ts +8 -0
- package/dist/commands/curl/form.d.ts +21 -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 +60 -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 +69 -0
- package/dist/commands/find/parser.d.ts +2 -0
- package/dist/commands/find/types.d.ts +88 -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 +32 -0
- package/dist/commands/js-exec/js-exec.d.ts +11 -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 +25 -0
- package/dist/commands/printf/printf.d.ts +4 -0
- package/dist/commands/printf/strftime.d.ts +9 -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 +28 -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 +40 -0
- package/dist/commands/query-engine/index.d.ts +8 -0
- package/dist/commands/query-engine/parser-types.d.ts +171 -0
- package/dist/commands/query-engine/parser.d.ts +9 -0
- package/dist/commands/query-engine/path-operations.d.ts +15 -0
- package/dist/commands/query-engine/safe-object.d.ts +83 -0
- package/dist/commands/query-engine/value-operations.d.ts +41 -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 +66 -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 +86 -0
- package/dist/commands/sed/parser.d.ts +18 -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 +15 -0
- package/dist/commands/sqlite3/sqlite3.d.ts +23 -0
- package/dist/commands/sqlite3/worker.d.ts +45 -0
- package/dist/commands/sqlite3/worker.js +1728 -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 +135 -0
- package/dist/commands/tar/bzip2-compress.d.ts +17 -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/xan/aggregation.d.ts +20 -0
- package/dist/commands/xan/column-selection.d.ts +19 -0
- package/dist/commands/xan/csv.d.ts +37 -0
- package/dist/commands/xan/moonblade-parser.d.ts +80 -0
- package/dist/commands/xan/moonblade-to-jq.d.ts +12 -0
- package/dist/commands/xan/moonblade-tokenizer.d.ts +25 -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 +64 -0
- package/dist/commands/yq/yq.d.ts +13 -0
- package/dist/custom-commands.d.ts +42 -0
- package/dist/encoding.d.ts +115 -0
- package/dist/fs/encoding.d.ts +17 -0
- package/dist/fs/in-memory-fs/in-memory-fs.d.ts +75 -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 +251 -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/index.d.ts +1 -0
- package/dist/fs/overlay-fs/overlay-fs.d.ts +165 -0
- package/dist/fs/path-utils.d.ts +46 -0
- package/dist/fs/read-write-fs/index.d.ts +1 -0
- package/dist/fs/read-write-fs/read-write-fs.d.ts +98 -0
- package/dist/fs/real-fs-utils.d.ts +90 -0
- package/dist/fs/sanitize-error.d.ts +19 -0
- package/dist/index.d.cts +29 -0
- package/dist/index.d.ts +29 -0
- package/dist/interpreter/alias-expansion.d.ts +23 -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 +39 -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 +14 -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 +9 -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 +45 -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 +66 -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 +158 -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 +20 -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 +18 -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 +12 -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/functions.d.ts +12 -0
- package/dist/interpreter/helpers/array.d.ts +43 -0
- package/dist/interpreter/helpers/condition.d.ts +22 -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 +24 -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 +25 -0
- package/dist/interpreter/helpers/shellopts.d.ts +28 -0
- package/dist/interpreter/helpers/statements.d.ts +20 -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/tilde.d.ts +13 -0
- package/dist/interpreter/helpers/variable-tests.d.ts +9 -0
- package/dist/interpreter/helpers/word-matching.d.ts +26 -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 +79 -0
- package/dist/interpreter/pipeline-execution.d.ts +16 -0
- package/dist/interpreter/redirections.d.ts +51 -0
- package/dist/interpreter/simple-command-assignments.d.ts +29 -0
- package/dist/interpreter/subshell-group.d.ts +32 -0
- package/dist/interpreter/type-command.d.ts +37 -0
- package/dist/interpreter/types.d.ts +349 -0
- package/dist/limits.d.ts +52 -0
- package/dist/network/allow-list/shared.d.ts +57 -0
- package/dist/network/allow-list.d.ts +59 -0
- package/dist/network/dns-pin.d.ts +43 -0
- package/dist/network/fetch.d.ts +25 -0
- package/dist/network/index.d.ts +7 -0
- package/dist/network/types.d.ts +155 -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 +16 -0
- package/dist/parser/lexer.d.ts +197 -0
- package/dist/parser/parser-substitution.d.ts +62 -0
- package/dist/parser/parser.d.ts +135 -0
- package/dist/parser/types.d.ts +25 -0
- package/dist/parser/word-parser.d.ts +33 -0
- package/dist/sandbox/Command.d.ts +35 -0
- package/dist/sandbox/Sandbox.d.ts +90 -0
- package/dist/sandbox/index.d.ts +2 -0
- package/dist/shell-metadata.d.ts +25 -0
- package/dist/timers.d.ts +4 -0
- package/dist/types.d.ts +247 -0
- package/dist/utils/args.d.ts +55 -0
- package/dist/utils/constants.d.ts +15 -0
- package/dist/utils/file-reader.d.ts +74 -0
- package/dist/utils/glob.d.ts +25 -0
- package/dist/vitest-setup.d.ts +1 -0
- package/package.json +127 -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,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
+
import{a as we,c as Oe}from"./chunk-LNVSXNT7.js";var xe=Oe((de,pe)=>{(function(oe,R){typeof define=="function"&&define.amd?define([],R):typeof pe=="object"&&typeof de<"u"?pe.exports=R():oe.Papa=R()})(de,function oe(){"use strict";var R=(function(){return typeof self<"u"?self:typeof window<"u"?window:typeof R<"u"?R:{}})();function _e(){var e=R.URL||R.webkitURL||null,t=oe.toString();return l.BLOB_URL||(l.BLOB_URL=e.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",t,")();"],{type:"text/javascript"})))}var Y=!R.document&&!!R.postMessage,ue=R.IS_PAPA_WORKER||!1,ae={},ge=0,l={};if(l.parse=Ce,l.unparse=Re,l.RECORD_SEP="",l.UNIT_SEP="",l.BYTE_ORDER_MARK="\uFEFF",l.BAD_DELIMITERS=["\r",`
|
|
4
|
+
`,'"',l.BYTE_ORDER_MARK],l.WORKERS_SUPPORTED=!Y&&!!R.Worker,l.NODE_STREAM_INPUT=1,l.LocalChunkSize=1024*1024*10,l.RemoteChunkSize=1024*1024*5,l.DefaultDelimiter=",",l.Parser=fe,l.ParserHandle=ce,l.NetworkStreamer=G,l.FileStreamer=ee,l.StringStreamer=Z,l.ReadableStreamStreamer=te,typeof PAPA_BROWSER_CONTEXT>"u"&&(l.DuplexStreamStreamer=re),R.jQuery){var V=R.jQuery;V.fn.parse=function(e){var t=e.config||{},r=[];return this.each(function(h){var i=V(this).prop("tagName").toUpperCase()==="INPUT"&&V(this).attr("type").toLowerCase()==="file"&&R.FileReader;if(!i||!this.files||this.files.length===0)return!0;for(var y=0;y<this.files.length;y++)r.push({file:this.files[y],inputElem:this,instanceConfig:V.extend({},t)})}),s(),this;function s(){if(r.length===0){g(e.complete)&&e.complete();return}var h=r[0];if(g(e.before)){var i=e.before(h.file,h.inputElem);if(typeof i=="object")if(i.action==="abort"){n("AbortError",h.file,h.inputElem,i.reason);return}else if(i.action==="skip"){p();return}else typeof i.config=="object"&&(h.instanceConfig=V.extend(h.instanceConfig,i.config));else if(i==="skip"){p();return}}var y=h.instanceConfig.complete;h.instanceConfig.complete=function(E){g(y)&&y(E,h.file,h.inputElem),p()},l.parse(h.file,h.instanceConfig)}function n(h,i,y,E){g(e.error)&&e.error({name:h},i,y,E)}function p(){r.splice(0,1),s()}}}ue&&(R.onmessage=Se);function Ce(e,t){t=t||{};var r=t.dynamicTyping||!1;if(g(r)&&(t.dynamicTypingFunction=r,r={}),t.dynamicTyping=r,t.transform=g(t.transform)?t.transform:!1,t.worker&&l.WORKERS_SUPPORTED){var s=Ee();s.userStep=t.step,s.userChunk=t.chunk,s.userComplete=t.complete,s.userError=t.error,t.step=g(t.step),t.chunk=g(t.chunk),t.complete=g(t.complete),t.error=g(t.error),delete t.worker,s.postMessage({input:e,config:t,workerId:s.id});return}var n=null;if(e===l.NODE_STREAM_INPUT&&typeof PAPA_BROWSER_CONTEXT>"u")return n=new re(t),n.getStream();return typeof e=="string"?(e=p(e),t.download?n=new G(t):n=new Z(t)):e.readable===!0&&g(e.read)&&g(e.on)?n=new te(t):(R.File&&e instanceof File||e instanceof Object)&&(n=new ee(t)),n.stream(e);function p(h){return h.charCodeAt(0)===65279?h.slice(1):h}}function Re(e,t){var r=!1,s=!0,n=",",p=`\r
|
|
5
|
+
`,h='"',i=h+h,y=!1,E=null,O=!1;L();var d=new RegExp(se(h),"g");if(typeof e=="string"&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return u(null,e,y);if(typeof e[0]=="object")return u(E||Object.keys(e[0]),e,y)}else if(typeof e=="object")return typeof e.data=="string"&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||E),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:typeof e.data[0]=="object"?Object.keys(e.data[0]):[]),!Array.isArray(e.data[0])&&typeof e.data[0]!="object"&&(e.data=[e.data])),u(e.fields||[],e.data||[],y);throw new Error("Unable to serialize unrecognized input");function L(){if(typeof t=="object"){if(typeof t.delimiter=="string"&&!l.BAD_DELIMITERS.filter(function(v){return t.delimiter.indexOf(v)!==-1}).length&&(n=t.delimiter),(typeof t.quotes=="boolean"||typeof t.quotes=="function"||Array.isArray(t.quotes))&&(r=t.quotes),(typeof t.skipEmptyLines=="boolean"||typeof t.skipEmptyLines=="string")&&(y=t.skipEmptyLines),typeof t.newline=="string"&&(p=t.newline),typeof t.quoteChar=="string"&&(h=t.quoteChar),typeof t.header=="boolean"&&(s=t.header),Array.isArray(t.columns)){if(t.columns.length===0)throw new Error("Option columns is empty");E=t.columns}t.escapeChar!==void 0&&(i=t.escapeChar+h),t.escapeFormulae instanceof RegExp?O=t.escapeFormulae:typeof t.escapeFormulae=="boolean"&&t.escapeFormulae&&(O=/^[=+\-@\t\r].*$/)}}function u(v,k,S){var w="";typeof v=="string"&&(v=JSON.parse(v)),typeof k=="string"&&(k=JSON.parse(k));var M=Array.isArray(v)&&v.length>0,T=!Array.isArray(k[0]);if(M&&s){for(var q=0;q<v.length;q++)q>0&&(w+=n),w+=c(v[q],q);k.length>0&&(w+=p)}for(var _=0;_<k.length;_++){var j=M?v.length:k[_].length,W=!1,o=M?Object.keys(k[_]).length===0:k[_].length===0;if(S&&!M&&(W=S==="greedy"?k[_].join("").trim()==="":k[_].length===1&&k[_][0].length===0),S==="greedy"&&M){for(var f=[],m=0;m<j;m++){var b=T?v[m]:m;f.push(k[_][b])}W=f.join("").trim()===""}if(!W){for(var a=0;a<j;a++){a>0&&!o&&(w+=n);var C=M&&T?v[a]:a;w+=c(k[_][C],a)}_<k.length-1&&(!S||j>0&&!o)&&(w+=p)}}return w}function c(v,k){if(typeof v>"u"||v===null)return"";if(v.constructor===Date)return JSON.stringify(v).slice(1,25);var S=!1;O&&typeof v=="string"&&O.test(v)&&(v="'"+v,S=!0);var w=v.toString().replace(d,i);return S=S||r===!0||typeof r=="function"&&r(v,k)||Array.isArray(r)&&r[k]||Q(w,l.BAD_DELIMITERS)||w.indexOf(n)>-1||w.charAt(0)===" "||w.charAt(w.length-1)===" ",S?h+w+h:w}function Q(v,k){for(var S=0;S<k.length;S++)if(v.indexOf(k[S])>-1)return!0;return!1}}function z(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},t.call(this,e),this.parseChunk=function(r,s){let n=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&n>0){let O=this._config.newline;if(!O){let L=this._config.quoteChar||'"';O=this._handle.guessLineEndings(r,L)}r=[...r.split(O).slice(n)].join(O)}if(this.isFirstChunk&&g(this._config.beforeFirstChunk)){var p=this._config.beforeFirstChunk(r);p!==void 0&&(r=p)}this.isFirstChunk=!1,this._halted=!1;var h=this._partialLine+r;this._partialLine="";var i=this._handle.parse(h,this._baseIndex,!this._finished);if(this._handle.paused()||this._handle.aborted()){this._halted=!0;return}var y=i.meta.cursor;this._finished||(this._partialLine=h.substring(y-this._baseIndex),this._baseIndex=y),i&&i.data&&(this._rowCount+=i.data.length);var E=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(ue)R.postMessage({results:i,workerId:l.WORKER_ID,finished:E});else if(g(this._config.chunk)&&!s){if(this._config.chunk(i,this._handle),this._handle.paused()||this._handle.aborted()){this._halted=!0;return}i=void 0,this._completeResults=void 0}return!this._config.step&&!this._config.chunk&&(this._completeResults.data=this._completeResults.data.concat(i.data),this._completeResults.errors=this._completeResults.errors.concat(i.errors),this._completeResults.meta=i.meta),!this._completed&&E&&g(this._config.complete)&&(!i||!i.meta.aborted)&&(this._config.complete(this._completeResults,this._input),this._completed=!0),!E&&(!i||!i.meta.paused)&&this._nextChunk(),i},this._sendError=function(r){g(this._config.error)?this._config.error(r):ue&&this._config.error&&R.postMessage({workerId:l.WORKER_ID,error:r,finished:!1})};function t(r){var s=he(r);s.chunkSize=parseInt(s.chunkSize),!r.step&&!r.chunk&&(s.chunkSize=null),this._handle=new ce(s),this._handle.streamer=this,this._config=s}}function G(e){e=e||{},e.chunkSize||(e.chunkSize=l.RemoteChunkSize),z.call(this,e);var t;Y?this._nextChunk=function(){this._readChunk(),this._chunkLoaded()}:this._nextChunk=function(){this._readChunk()},this.stream=function(s){this._input=s,this._nextChunk()},this._readChunk=function(){if(this._finished){this._chunkLoaded();return}if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),Y||(t.onload=F(this._chunkLoaded,this),t.onerror=F(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!Y),this._config.downloadRequestHeaders){var s=this._config.downloadRequestHeaders;for(var n in s)t.setRequestHeader(n,s[n])}if(this._config.chunkSize){var p=this._start+this._config.chunkSize-1;t.setRequestHeader("Range","bytes="+this._start+"-"+p)}try{t.send(this._config.downloadRequestBody)}catch(h){this._chunkError(h.message)}Y&&t.status===0&&this._chunkError()},this._chunkLoaded=function(){if(t.readyState===4){if(t.status<200||t.status>=400){this._chunkError();return}this._start+=this._config.chunkSize?this._config.chunkSize:t.responseText.length,this._finished=!this._config.chunkSize||this._start>=r(t),this.parseChunk(t.responseText)}},this._chunkError=function(s){var n=t.statusText||s;this._sendError(new Error(n))};function r(s){var n=s.getResponseHeader("Content-Range");return n===null?-1:parseInt(n.substring(n.lastIndexOf("/")+1))}}G.prototype=Object.create(z.prototype),G.prototype.constructor=G;function ee(e){e=e||{},e.chunkSize||(e.chunkSize=l.LocalChunkSize),z.call(this,e);var t,r,s=typeof FileReader<"u";this.stream=function(n){this._input=n,r=n.slice||n.webkitSlice||n.mozSlice,s?(t=new FileReader,t.onload=F(this._chunkLoaded,this),t.onerror=F(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){!this._finished&&(!this._config.preview||this._rowCount<this._config.preview)&&this._readChunk()},this._readChunk=function(){var n=this._input;if(this._config.chunkSize){var p=Math.min(this._start+this._config.chunkSize,this._input.size);n=r.call(n,this._start,p)}var h=t.readAsText(n,this._config.encoding);s||this._chunkLoaded({target:{result:h}})},this._chunkLoaded=function(n){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(n.target.result)},this._chunkError=function(){this._sendError(t.error)}}ee.prototype=Object.create(z.prototype),ee.prototype.constructor=ee;function Z(e){e=e||{},z.call(this,e);var t;this.stream=function(r){return t=r,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var r=this._config.chunkSize,s;return r?(s=t.substring(0,r),t=t.substring(r)):(s=t,t=""),this._finished=!t,this.parseChunk(s)}}}Z.prototype=Object.create(Z.prototype),Z.prototype.constructor=Z;function te(e){e=e||{},z.call(this,e);var t=[],r=!0,s=!1;this.pause=function(){z.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){z.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(n){this._input=n,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){s&&t.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):r=!0},this._streamData=F(function(n){try{t.push(typeof n=="string"?n:n.toString(this._config.encoding)),r&&(r=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(p){this._streamError(p)}},this),this._streamError=F(function(n){this._streamCleanUp(),this._sendError(n)},this),this._streamEnd=F(function(){this._streamCleanUp(),s=!0,this._streamData("")},this),this._streamCleanUp=F(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}te.prototype=Object.create(z.prototype),te.prototype.constructor=te;function re(e){var t=we("stream").Duplex,r=he(e),s=!0,n=!1,p=[],h=null;this._onCsvData=function(i){var y=i.data;!h.push(y)&&!this._handle.paused()&&this._handle.pause()},this._onCsvComplete=function(){h.push(null)},r.step=F(this._onCsvData,this),r.complete=F(this._onCsvComplete,this),z.call(this,r),this._nextChunk=function(){n&&p.length===1&&(this._finished=!0),p.length?p.shift()():s=!0},this._addToParseQueue=function(i,y){p.push(F(function(){if(this.parseChunk(typeof i=="string"?i:i.toString(r.encoding)),g(y))return y()},this)),s&&(s=!1,this._nextChunk())},this._onRead=function(){this._handle.paused()&&this._handle.resume()},this._onWrite=function(i,y,E){this._addToParseQueue(i,E)},this._onWriteComplete=function(){n=!0,this._addToParseQueue("")},this.getStream=function(){return h},h=new t({readableObjectMode:!0,decodeStrings:!1,read:F(this._onRead,this),write:F(this._onWrite,this)}),h.once("finish",F(this._onWriteComplete,this))}typeof PAPA_BROWSER_CONTEXT>"u"&&(re.prototype=Object.create(z.prototype),re.prototype.constructor=re);function ce(e){var t=Math.pow(2,53),r=-t,s=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,n=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,p=this,h=0,i=0,y,E,O=!1,d=!1,L,u=[],c={data:[],errors:[],meta:{}};if(g(e.step)){var Q=e.step;e.step=function(o){if(c=o,w())S();else{if(S(),c.data.length===0)return;h+=o.data.length,e.preview&&h>e.preview?E.abort():(c.data=c.data[0],Q(c,p))}}}this.parse=function(o,f,m){var b=e.quoteChar||'"';if(e.newline||(e.newline=this.guessLineEndings(o,b)),L=!1,e.delimiter)g(e.delimiter)&&(e.delimiter=e.delimiter(o),c.meta.delimiter=e.delimiter);else{var a=j(o,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess);a.successful?e.delimiter=a.bestDelimiter:(L=!0,e.delimiter=l.DefaultDelimiter),c.meta.delimiter=e.delimiter}var C=he(e);return e.preview&&e.header&&C.preview++,y=o,E=new fe(C),c=E.parse(y,f,m),S(),O?{meta:{paused:!0}}:c||{meta:{paused:!1}}},this.paused=function(){return O},this.pause=function(){O=!0,E.abort(),y=g(e.chunk)?"":y.substring(E.getCharIndex())},this.resume=function(){p.streamer._halted?(O=!1,p.streamer.parseChunk(y,!0)):setTimeout(p.resume,3)},this.aborted=function(){return d},this.abort=function(){d=!0,E.abort(),c.meta.aborted=!0,g(e.complete)&&e.complete(c),y=""},this.guessLineEndings=function(o,f){o=o.substring(0,1024*1024);var m=new RegExp(se(f)+"([^]*?)"+se(f),"gm");o=o.replace(m,"");var b=o.split("\r"),a=o.split(`
|
|
6
|
+
`),C=a.length>1&&a[0].length<b[0].length;if(b.length===1||C)return`
|
|
7
|
+
`;for(var A=0,x=0;x<b.length;x++)b[x][0]===`
|
|
8
|
+
`&&A++;return A>=b.length/2?`\r
|
|
9
|
+
`:"\r"};function v(o){return e.skipEmptyLines==="greedy"?o.join("").trim()==="":o.length===1&&o[0].length===0}function k(o){if(s.test(o)){var f=parseFloat(o);if(f>r&&f<t)return!0}return!1}function S(){return c&&L&&(W("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+l.DefaultDelimiter+"'"),L=!1),e.skipEmptyLines&&(c.data=c.data.filter(function(o){return!v(o)})),w()&&M(),_()}function w(){return e.header&&u.length===0}function M(){if(!c)return;function o(m,b){g(e.transformHeader)&&(m=e.transformHeader(m,b)),u.push(m)}if(Array.isArray(c.data[0])){for(var f=0;w()&&f<c.data.length;f++)c.data[f].forEach(o);c.data.splice(0,1)}else c.data.forEach(o)}function T(o){return e.dynamicTypingFunction&&e.dynamicTyping[o]===void 0&&(e.dynamicTyping[o]=e.dynamicTypingFunction(o)),(e.dynamicTyping[o]||e.dynamicTyping)===!0}function q(o,f){return T(o)?f==="true"||f==="TRUE"?!0:f==="false"||f==="FALSE"?!1:k(f)?parseFloat(f):n.test(f)?new Date(f):f===""?null:f:f}function _(){if(!c||!e.header&&!e.dynamicTyping&&!e.transform)return c;function o(m,b){var a=e.header?{}:[],C;for(C=0;C<m.length;C++){var A=C,x=m[C];e.header&&(A=C>=u.length?"__parsed_extra":u[C]),e.transform&&(x=e.transform(x,A)),x=q(A,x),A==="__parsed_extra"?(a[A]=a[A]||[],a[A].push(x)):a[A]=x}return e.header&&(C>u.length?W("FieldMismatch","TooManyFields","Too many fields: expected "+u.length+" fields but parsed "+C,i+b):C<u.length&&W("FieldMismatch","TooFewFields","Too few fields: expected "+u.length+" fields but parsed "+C,i+b)),a}var f=1;return!c.data.length||Array.isArray(c.data[0])?(c.data=c.data.map(o),f=c.data.length):c.data=o(c.data,0),e.header&&c.meta&&(c.meta.fields=u),i+=f,c}function j(o,f,m,b,a){var C,A,x,J;a=a||[","," ","|",";",l.RECORD_SEP,l.UNIT_SEP];for(var N=0;N<a.length;N++){var ie=a[N],X=0,K=0,I=0;x=void 0;for(var H=new fe({comments:b,delimiter:ie,newline:f,preview:10}).parse(o),D=0;D<H.data.length;D++){if(m&&v(H.data[D])){I++;continue}var P=H.data[D].length;if(K+=P,typeof x>"u"){x=P;continue}else P>0&&(X+=Math.abs(P-x),x=P)}H.data.length>0&&(K/=H.data.length-I),(typeof A>"u"||X<=A)&&(typeof J>"u"||K>J)&&K>1.99&&(A=X,C=ie,J=K)}return e.delimiter=C,{successful:!!C,bestDelimiter:C}}function W(o,f,m,b){var a={type:o,code:f,message:m};b!==void 0&&(a.row=b),c.errors.push(a)}}function se(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function fe(e){e=e||{};var t=e.delimiter,r=e.newline,s=e.comments,n=e.step,p=e.preview,h=e.fastMode,i,y=null,E=!1;e.quoteChar===void 0||e.quoteChar===null?i='"':i=e.quoteChar;var O=i;if(e.escapeChar!==void 0&&(O=e.escapeChar),(typeof t!="string"||l.BAD_DELIMITERS.indexOf(t)>-1)&&(t=","),s===t)throw new Error("Comment character same as delimiter");s===!0?s="#":(typeof s!="string"||l.BAD_DELIMITERS.indexOf(s)>-1)&&(s=!1),r!==`
|
|
10
|
+
`&&r!=="\r"&&r!==`\r
|
|
11
|
+
`&&(r=`
|
|
12
|
+
`);var d=0,L=!1;this.parse=function(u,c,Q){if(typeof u!="string")throw new Error("Input must be a string");var v=u.length,k=t.length,S=r.length,w=s.length,M=g(n);d=0;var T=[],q=[],_=[],j=0;if(!u)return I();if(h||h!==!1&&u.indexOf(i)===-1){for(var W=u.split(r),o=0;o<W.length;o++){if(_=W[o],d+=_.length,o!==W.length-1)d+=r.length;else if(Q)return I();if(!(s&&_.substring(0,w)===s)){if(M){if(T=[],N(_.split(t)),H(),L)return I()}else N(_.split(t));if(p&&o>=p)return T=T.slice(0,p),I(!0)}}return I()}for(var f=u.indexOf(t,d),m=u.indexOf(r,d),b=new RegExp(se(O)+se(i),"g"),a=u.indexOf(i,d);;){if(u[d]===i){for(a=d,d++;;){if(a=u.indexOf(i,a+1),a===-1)return Q||q.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:T.length,index:d}),X();if(a===v-1){var C=u.substring(d,a).replace(b,i);return X(C)}if(i===O&&u[a+1]===O){a++;continue}if(!(i!==O&&a!==0&&u[a-1]===O)){f!==-1&&f<a+1&&(f=u.indexOf(t,a+1)),m!==-1&&m<a+1&&(m=u.indexOf(r,a+1));var A=m===-1?f:Math.min(f,m),x=ie(A);if(u.substr(a+1+x,k)===t){_.push(u.substring(d,a).replace(b,i)),d=a+1+x+k,u[a+1+x+k]!==i&&(a=u.indexOf(i,d)),f=u.indexOf(t,d),m=u.indexOf(r,d);break}var J=ie(m);if(u.substring(a+1+J,a+1+J+S)===r){if(_.push(u.substring(d,a).replace(b,i)),K(a+1+J+S),f=u.indexOf(t,d),a=u.indexOf(i,d),M&&(H(),L))return I();if(p&&T.length>=p)return I(!0);break}q.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:T.length,index:d}),a++}}continue}if(s&&_.length===0&&u.substring(d,d+w)===s){if(m===-1)return I();d=m+S,m=u.indexOf(r,d),f=u.indexOf(t,d);continue}if(f!==-1&&(f<m||m===-1)){_.push(u.substring(d,f)),d=f+k,f=u.indexOf(t,d);continue}if(m!==-1){if(_.push(u.substring(d,m)),K(m+S),M&&(H(),L))return I();if(p&&T.length>=p)return I(!0);continue}break}return X();function N(D){T.push(D),j=d}function ie(D){var P=0;if(D!==-1){var B=u.substring(a+1,D);B&&B.trim()===""&&(P=B.length)}return P}function X(D){return Q||(typeof D>"u"&&(D=u.substring(d)),_.push(D),d=v,N(_),M&&H()),I()}function K(D){d=D,N(_),_=[],m=u.indexOf(r,d)}function I(D){if(e.header&&!c&&T.length&&!E){let P=T[0],B=Object.create(null),le=new Set(P),ve=!1;for(let $=0;$<P.length;$++){let U=P[$];if(g(e.transformHeader)&&(U=e.transformHeader(U,$)),!B[U])B[U]=1,P[$]=U;else{let ne,ke=B[U];do ne=`${U}_${ke}`,ke++;while(le.has(ne));le.add(ne),P[$]=ne,B[U]++,ve=!0,y===null&&(y={}),y[ne]=U}le.add(U)}ve&&console.warn("Duplicate headers found and renamed."),E=!0}return{data:T,errors:q,meta:{delimiter:t,linebreak:r,aborted:L,truncated:!!D,cursor:j+(c||0),renamedHeaders:y}}}function H(){n(I()),T=[],q=[]}},this.abort=function(){L=!0},this.getCharIndex=function(){return d}}function Ee(){if(!l.WORKERS_SUPPORTED)return!1;var e=_e(),t=new R.Worker(e);return t.onmessage=be,t.id=ge++,ae[t.id]=t,t}function be(e){var t=e.data,r=ae[t.workerId],s=!1;if(t.error)r.userError(t.error,t.file);else if(t.results&&t.results.data){var n=function(){s=!0,me(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},p={abort:n,pause:ye,resume:ye};if(g(r.userStep)){for(var h=0;h<t.results.data.length&&(r.userStep({data:t.results.data[h],errors:t.results.errors,meta:t.results.meta},p),!s);h++);delete t.results}else g(r.userChunk)&&(r.userChunk(t.results,p,t.file),delete t.results)}t.finished&&!s&&me(t.workerId,t.results)}function me(e,t){var r=ae[e];g(r.userComplete)&&r.userComplete(t),r.terminate(),delete ae[e]}function ye(){throw new Error("Not implemented.")}function Se(e){var t=e.data;if(typeof l.WORKER_ID>"u"&&t&&(l.WORKER_ID=t.workerId),typeof t.input=="string")R.postMessage({workerId:l.WORKER_ID,results:l.parse(t.input,t.config),finished:!0});else if(R.File&&t.input instanceof File||t.input instanceof Object){var r=l.parse(t.input,t.config);r&&R.postMessage({workerId:l.WORKER_ID,results:r,finished:!0})}}function he(e){if(typeof e!="object"||e===null)return e;var t=Array.isArray(e)?[]:{};for(var r in e)t[r]=he(e[r]);return t}function F(e,t){return function(){e.apply(t,arguments)}}function g(e){return typeof e=="function"}return l})});export{xe as a};
|
|
13
|
+
/*! Bundled license information:
|
|
14
|
+
|
|
15
|
+
papaparse/papaparse.js:
|
|
16
|
+
(* @license
|
|
17
|
+
Papa Parse
|
|
18
|
+
v5.5.3
|
|
19
|
+
https://github.com/mholt/PapaParse
|
|
20
|
+
License: MIT
|
|
21
|
+
*)
|
|
22
|
+
*/
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
+
function r(e){return Object.assign(Object.create(null),Object.fromEntries(e))}function n(e,t){return Object.assign(Object.create(null),Object.fromEntries(e),t)}function c(...e){return Object.assign(Object.create(null),...e)}export{r as a,n as b,c};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
+
function s(t){let e=`${t.name} - ${t.summary}
|
|
4
|
+
|
|
5
|
+
`;if(e+=`Usage: ${t.usage}
|
|
6
|
+
`,t.description){if(e+=`
|
|
7
|
+
Description:
|
|
8
|
+
`,typeof t.description=="string")for(let n of t.description.split(`
|
|
9
|
+
`))e+=n?` ${n}
|
|
10
|
+
`:`
|
|
11
|
+
`;else if(t.description.length>0)for(let n of t.description)e+=n?` ${n}
|
|
12
|
+
`:`
|
|
13
|
+
`}if(t.options&&t.options.length>0){e+=`
|
|
14
|
+
Options:
|
|
15
|
+
`;for(let n of t.options)e+=` ${n}
|
|
16
|
+
`}if(t.examples&&t.examples.length>0){e+=`
|
|
17
|
+
Examples:
|
|
18
|
+
`;for(let n of t.examples)e+=` ${n}
|
|
19
|
+
`}if(t.notes&&t.notes.length>0){e+=`
|
|
20
|
+
Notes:
|
|
21
|
+
`;for(let n of t.notes)e+=` ${n}
|
|
22
|
+
`}return{stdout:e,stderr:"",exitCode:0}}function o(t){return t.includes("--help")}function r(t,e){return{stdout:"",stderr:e.startsWith("--")?`${t}: unrecognized option '${e}'
|
|
23
|
+
`:`${t}: invalid option -- '${e.replace(/^-/,"")}'
|
|
24
|
+
`,exitCode:1}}export{s as a,o as b,r as c};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
+
import{a as I}from"./chunk-NE4R2FVV.js";import{a as K,b as V}from"./chunk-MUFNRCMY.js";var B=(i,t,e)=>{let s=i instanceof RegExp?Y(i,e):i,n=t instanceof RegExp?Y(t,e):t,r=s!==null&&n!=null&&Et(s,n,e);return r&&{start:r[0],end:r[1],pre:e.slice(0,r[0]),body:e.slice(r[0]+s.length,r[1]),post:e.slice(r[1]+n.length)}},Y=(i,t)=>{let e=t.match(i);return e?e[0]:null},Et=(i,t,e)=>{let s,n,r,o,l,h=e.indexOf(i),c=e.indexOf(t,h+1),g=h;if(h>=0&&c>0){if(i===t)return[h,c];for(s=[],r=e.length;g>=0&&!l;){if(g===h)s.push(g),h=e.indexOf(i,g+1);else if(s.length===1){let a=s.pop();a!==void 0&&(l=[a,c])}else n=s.pop(),n!==void 0&&n<r&&(r=n,o=c),c=e.indexOf(t,g+1);g=h<c&&h>=0?h:c}s.length&&o!==void 0&&(l=[r,o])}return l};var Q="\0SLASH"+Math.random()+"\0",tt="\0OPEN"+Math.random()+"\0",q="\0CLOSE"+Math.random()+"\0",et="\0COMMA"+Math.random()+"\0",st="\0PERIOD"+Math.random()+"\0",Mt=new RegExp(Q,"g"),At=new RegExp(tt,"g"),Pt=new RegExp(q,"g"),Tt=new RegExp(et,"g"),Nt=new RegExp(st,"g"),Rt=/\\\\/g,vt=/\\{/g,Ot=/\\}/g,zt=/\\,/g,Ct=/\\\./g,Wt=1e5;function H(i){return isNaN(i)?i.charCodeAt(0):parseInt(i,10)}function Dt(i){return i.replace(Rt,Q).replace(vt,tt).replace(Ot,q).replace(zt,et).replace(Ct,st)}function jt(i){return i.replace(Mt,"\\").replace(At,"{").replace(Pt,"}").replace(Tt,",").replace(Nt,".")}function nt(i){if(!i)return[""];let t=[],e=B("{","}",i);if(!e)return i.split(",");let{pre:s,body:n,post:r}=e,o=s.split(",");o[o.length-1]+="{"+n+"}";let l=nt(r);return r.length&&(o[o.length-1]+=l.shift(),o.push.apply(o,l)),t.push.apply(t,o),t}function it(i,t={}){if(!i)return[];let{max:e=Wt}=t;return i.slice(0,2)==="{}"&&(i="\\{\\}"+i.slice(2)),j(Dt(i),e,!0).map(jt)}function Lt(i){return"{"+i+"}"}function kt(i){return/^-?0\d/.test(i)}function _t(i,t){return i<=t}function Gt(i,t){return i>=t}function j(i,t,e){let s=[],n=B("{","}",i);if(!n)return[i];let r=n.pre,o=n.post.length?j(n.post,t,!1):[""];if(/\$$/.test(n.pre))for(let l=0;l<o.length&&l<t;l++){let h=r+"{"+n.body+"}"+o[l];s.push(h)}else{let l=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body),h=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),c=l||h,g=n.body.indexOf(",")>=0;if(!c&&!g)return n.post.match(/,(?!,).*\}/)?(i=n.pre+"{"+n.body+q+n.post,j(i,t,!0)):[i];let a;if(c)a=n.body.split(/\.\./);else if(a=nt(n.body),a.length===1&&a[0]!==void 0&&(a=j(a[0],t,!1).map(Lt),a.length===1))return o.map(u=>n.pre+a[0]+u);let p;if(c&&a[0]!==void 0&&a[1]!==void 0){let u=H(a[0]),d=H(a[1]),f=Math.max(a[0].length,a[1].length),$=a.length===3&&a[2]!==void 0?Math.max(Math.abs(H(a[2])),1):1,S=_t;d<u&&($*=-1,S=Gt);let b=a.some(kt);p=[];for(let y=u;S(y,d);y+=$){let w;if(h)w=String.fromCharCode(y),w==="\\"&&(w="");else if(w=String(y),b){let E=f-w.length;if(E>0){let x=new Array(E+1).join("0");y<0?w="-"+x+w.slice(1):w=x+w}}p.push(w)}}else{p=[];for(let u=0;u<a.length;u++)p.push.apply(p,j(a[u],t,!1))}for(let u=0;u<p.length;u++)for(let d=0;d<o.length&&s.length<t;d++){let f=r+p[u]+o[d];(!e||c||f)&&s.push(f)}}return s}var L=i=>{if(typeof i!="string")throw new TypeError("invalid pattern");if(i.length>65536)throw new TypeError("pattern is too long")};var Ft={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},k=i=>i.replace(/[[\]\\-]/g,"\\$&"),Bt=i=>i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),rt=i=>i.join(""),ot=(i,t)=>{let e=t;if(i.charAt(e)!=="[")throw new Error("not in a brace expression");let s=[],n=[],r=e+1,o=!1,l=!1,h=!1,c=!1,g=e,a="";t:for(;r<i.length;){let f=i.charAt(r);if((f==="!"||f==="^")&&r===e+1){c=!0,r++;continue}if(f==="]"&&o&&!h){g=r+1;break}if(o=!0,f==="\\"&&!h){h=!0,r++;continue}if(f==="["&&!h){for(let[$,[S,m,b]]of Object.entries(Ft))if(i.startsWith($,r)){if(a)return["$.",!1,i.length-e,!0];r+=$.length,b?n.push(S):s.push(S),l=l||m;continue t}}if(h=!1,a){f>a?s.push(k(a)+"-"+k(f)):f===a&&s.push(k(f)),a="",r++;continue}if(i.startsWith("-]",r+1)){s.push(k(f+"-")),r+=2;continue}if(i.startsWith("-",r+1)){a=f,r+=2;continue}s.push(k(f)),r++}if(g<r)return["",!1,0,!1];if(!s.length&&!n.length)return["$.",!1,i.length-e,!0];if(n.length===0&&s.length===1&&/^\\?.$/.test(s[0])&&!c){let f=s[0].length===2?s[0].slice(-1):s[0];return[Bt(f),!1,g-e,!1]}let p="["+(c?"^":"")+rt(s)+"]",u="["+(c?"":"^")+rt(n)+"]";return[s.length&&n.length?"("+p+"|"+u+")":s.length?p:u,l,g-e,!0]};var v=(i,{windowsPathsNoEscape:t=!1,magicalBraces:e=!0}={})=>e?t?i.replace(/\[([^/\\])\]/g,"$1"):i.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):t?i.replace(/\[([^/\\{}])\]/g,"$1"):i.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1");var T,Ht=new Set(["!","?","+","*","@"]),J=i=>Ht.has(i),at=i=>J(i.type),qt=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),Jt=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),Ut=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),lt=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Zt="(?!(?:^|/)\\.\\.?(?:$|/))",_="(?!\\.)",Xt=new Set(["[","."]),Kt=new Set(["..","."]),Vt=new Set("().*{}+?[]^$\\!"),It=i=>i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),U="[^/]",ct=U+"*?",ht=U+"+?",Yt=0,z=class{type;#s;#n;#i=!1;#t=[];#e;#a;#c;#l=!1;#r;#o;#h=!1;id=++Yt;get depth(){return(this.#e?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#s.id,parent:this.#e?.id,depth:this.depth,partsLength:this.#t.length,parts:this.#t}}constructor(t,e,s={}){this.type=t,t&&(this.#n=!0),this.#e=e,this.#s=this.#e?this.#e.#s:this,this.#r=this.#s===this?s:this.#s.#r,this.#c=this.#s===this?[]:this.#s.#c,t==="!"&&!this.#s.#l&&this.#c.push(this),this.#a=this.#e?this.#e.#t.length:0}get hasMagic(){if(this.#n!==void 0)return this.#n;for(let t of this.#t)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#n=!0;return this.#n}toString(){return this.#o!==void 0?this.#o:this.type?this.#o=this.type+"("+this.#t.map(t=>String(t)).join("|")+")":this.#o=this.#t.map(t=>String(t)).join("")}#y(){if(this!==this.#s)throw new Error("should only call on root");if(this.#l)return this;this.toString(),this.#l=!0;let t;for(;t=this.#c.pop();){if(t.type!=="!")continue;let e=t,s=e.#e;for(;s;){for(let n=e.#a+1;!s.type&&n<s.#t.length;n++)for(let r of t.#t){if(typeof r=="string")throw new Error("string part in extglob AST??");r.copyIn(s.#t[n])}e=s,s=e.#e}}return this}push(...t){for(let e of t)if(e!==""){if(typeof e!="string"&&!(e instanceof T&&e.#e===this))throw new Error("invalid part: "+e);this.#t.push(e)}}toJSON(){let t=this.type===null?this.#t.slice().map(e=>typeof e=="string"?e:e.toJSON()):[this.type,...this.#t.map(e=>e.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#s||this.#s.#l&&this.#e?.type==="!")&&t.push({}),t}isStart(){if(this.#s===this)return!0;if(!this.#e?.isStart())return!1;if(this.#a===0)return!0;let t=this.#e;for(let e=0;e<this.#a;e++){let s=t.#t[e];if(!(s instanceof T&&s.type==="!"))return!1}return!0}isEnd(){if(this.#s===this||this.#e?.type==="!")return!0;if(!this.#e?.isEnd())return!1;if(!this.type)return this.#e?.isEnd();let t=this.#e?this.#e.#t.length:0;return this.#a===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let e=new T(this.type,t);for(let s of this.#t)e.copyIn(s);return e}static#f(t,e,s,n,r){let o=n.maxExtglobRecursion??2,l=!1,h=!1,c=-1,g=!1;if(e.type===null){let f=s,$="";for(;f<t.length;){let S=t.charAt(f++);if(l||S==="\\"){l=!l,$+=S;continue}if(h){f===c+1?(S==="^"||S==="!")&&(g=!0):S==="]"&&!(f===c+2&&g)&&(h=!1),$+=S;continue}else if(S==="["){h=!0,c=f,g=!1,$+=S;continue}if(!n.noext&&J(S)&&t.charAt(f)==="("&&r<=o){e.push($),$="";let b=new T(S,e);f=T.#f(t,b,f,n,r+1),e.push(b);continue}$+=S}return e.push($),f}let a=s+1,p=new T(null,e),u=[],d="";for(;a<t.length;){let f=t.charAt(a++);if(l||f==="\\"){l=!l,d+=f;continue}if(h){a===c+1?(f==="^"||f==="!")&&(g=!0):f==="]"&&!(a===c+2&&g)&&(h=!1),d+=f;continue}else if(f==="["){h=!0,c=a,g=!1,d+=f;continue}if(!n.noext&&J(f)&&t.charAt(a)==="("&&(r<=o||e&&e.#u(f))){let S=e&&e.#u(f)?0:1;p.push(d),d="";let m=new T(f,p);p.push(m),a=T.#f(t,m,a,n,r+S);continue}if(f==="|"){p.push(d),d="",u.push(p),p=new T(null,e);continue}if(f===")")return d===""&&e.#t.length===0&&(e.#h=!0),p.push(d),d="",e.push(...u,p),a;d+=f}return e.type=null,e.#n=void 0,e.#t=[t.substring(s-1)],a}#w(t){return this.#g(t,Jt)}#g(t,e=qt){if(!t||typeof t!="object"||t.type!==null||t.#t.length!==1||this.type===null)return!1;let s=t.#t[0];return!s||typeof s!="object"||s.type===null?!1:this.#u(s.type,e)}#u(t,e=Ut){return!!e.get(this.type)?.includes(t)}#S(t,e){let s=t.#t[0],n=new T(null,s,this.options);n.#t.push(""),s.push(n),this.#d(t,e)}#d(t,e){let s=t.#t[0];this.#t.splice(e,1,...s.#t);for(let n of s.#t)typeof n=="object"&&(n.#e=this);this.#o=void 0}#$(t){return!!lt.get(this.type)?.has(t)}#b(t){if(!t||typeof t!="object"||t.type!==null||t.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let e=t.#t[0];return!e||typeof e!="object"||e.type===null?!1:this.#$(e.type)}#x(t){let e=lt.get(this.type),s=t.#t[0],n=e?.get(s.type);if(!n)return!1;this.#t=s.#t;for(let r of this.#t)typeof r=="object"&&(r.#e=this);this.type=n,this.#o=void 0,this.#h=!1}static fromGlob(t,e={}){let s=new T(null,void 0,e);return T.#f(t,s,0,e,0),s}toMMPattern(){if(this!==this.#s)return this.#s.toMMPattern();let t=this.toString(),[e,s,n,r]=this.toRegExpSource();if(!(n||this.#n||this.#r.nocase&&!this.#r.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return s;let l=(this.#r.nocase?"i":"")+(r?"u":"");return Object.assign(new RegExp(`^${e}$`,l),{_src:e,_glob:t})}get options(){return this.#r}toRegExpSource(t){let e=t??!!this.#r.dot;if(this.#s===this&&(this.#p(),this.#y()),!at(this)){let h=this.isStart()&&this.isEnd()&&!this.#t.some(u=>typeof u!="string"),c=this.#t.map(u=>{let[d,f,$,S]=typeof u=="string"?T.#E(u,this.#n,h):u.toRegExpSource(t);return this.#n=this.#n||$,this.#i=this.#i||S,d}).join(""),g="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&Kt.has(this.#t[0]))){let d=Xt,f=e&&d.has(c.charAt(0))||c.startsWith("\\.")&&d.has(c.charAt(2))||c.startsWith("\\.\\.")&&d.has(c.charAt(4)),$=!e&&!t&&d.has(c.charAt(0));g=f?Zt:$?_:""}let a="";return this.isEnd()&&this.#s.#l&&this.#e?.type==="!"&&(a="(?:$|\\/)"),[g+c+a,v(c),this.#n=!!this.#n,this.#i]}let s=this.type==="*"||this.type==="+",n=this.type==="!"?"(?:(?!(?:":"(?:",r=this.#m(e);if(this.isStart()&&this.isEnd()&&!r&&this.type!=="!"){let h=this.toString(),c=this;return c.#t=[h],c.type=null,c.#n=void 0,[h,v(this.toString()),!1,!1]}let o=!s||t||e||!_?"":this.#m(!0);o===r&&(o=""),o&&(r=`(?:${r})(?:${o})*?`);let l="";if(this.type==="!"&&this.#h)l=(this.isStart()&&!e?_:"")+ht;else{let h=this.type==="!"?"))"+(this.isStart()&&!e&&!t?_:"")+ct+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;l=n+r+h}return[l,v(r),this.#n=!!this.#n,this.#i]}#p(){if(at(this)){let t=0,e=!1;do{e=!0;for(let s=0;s<this.#t.length;s++){let n=this.#t[s];typeof n=="object"&&(n.#p(),this.#g(n)?(e=!1,this.#d(n,s)):this.#w(n)?(e=!1,this.#S(n,s)):this.#b(n)&&(e=!1,this.#x(n)))}}while(!e&&++t<10)}else for(let t of this.#t)typeof t=="object"&&t.#p();this.#o=void 0}#m(t){return this.#t.map(e=>{if(typeof e=="string")throw new Error("string type in extglob ast??");let[s,n,r,o]=e.toRegExpSource(t);return this.#i=this.#i||o,s}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join("|")}static#E(t,e,s=!1){let n=!1,r="",o=!1,l=!1;for(let h=0;h<t.length;h++){let c=t.charAt(h);if(n){n=!1,r+=(Vt.has(c)?"\\":"")+c;continue}if(c==="*"){if(l)continue;l=!0,r+=s&&/^[*]+$/.test(t)?ht:ct,e=!0;continue}else l=!1;if(c==="\\"){h===t.length-1?r+="\\\\":n=!0;continue}if(c==="["){let[g,a,p,u]=ot(t,h);if(p){r+=g,o=o||a,h+=p-1,e=e||u;continue}}if(c==="?"){r+=U,e=!0;continue}r+=It(c)}return[r,v(t),!!e,o]}};T=z;var Z=(i,{windowsPathsNoEscape:t=!1,magicalBraces:e=!1}={})=>e?t?i.replace(/[?*()[\]{}]/g,"[$&]"):i.replace(/[?*()[\]\\{}]/g,"\\$&"):t?i.replace(/[?*()[\]]/g,"[$&]"):i.replace(/[?*()[\]\\]/g,"\\$&");var M=(i,t,e={})=>(L(t),!e.nocomment&&t.charAt(0)==="#"?!1:new D(t,e).match(i)),Qt=/^\*+([^+@!?*[(]*)$/,te=i=>t=>!t.startsWith(".")&&t.endsWith(i),ee=i=>t=>t.endsWith(i),se=i=>(i=i.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(i)),ne=i=>(i=i.toLowerCase(),t=>t.toLowerCase().endsWith(i)),ie=/^\*+\.\*+$/,re=i=>!i.startsWith(".")&&i.includes("."),oe=i=>i!=="."&&i!==".."&&i.includes("."),ae=/^\.\*+$/,le=i=>i!=="."&&i!==".."&&i.startsWith("."),ce=/^\*+$/,he=i=>i.length!==0&&!i.startsWith("."),fe=i=>i.length!==0&&i!=="."&&i!=="..",ue=/^\?+([^+@!?*[(]*)?$/,pe=([i,t=""])=>{let e=pt([i]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},ge=([i,t=""])=>{let e=gt([i]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},de=([i,t=""])=>{let e=gt([i]);return t?s=>e(s)&&s.endsWith(t):e},me=([i,t=""])=>{let e=pt([i]);return t?s=>e(s)&&s.endsWith(t):e},pt=([i])=>{let t=i.length;return e=>e.length===t&&!e.startsWith(".")},gt=([i])=>{let t=i.length;return e=>e.length===t&&e!=="."&&e!==".."},dt=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",ft={win32:{sep:"\\"},posix:{sep:"/"}},ye=dt==="win32"?ft.win32.sep:ft.posix.sep;M.sep=ye;var A=Symbol("globstar **");M.GLOBSTAR=A;var we="[^/]",Se=we+"*?",$e="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",be="(?:(?!(?:\\/|^)\\.).)*?",xe=(i,t={})=>e=>M(e,i,t);M.filter=xe;var N=(i,t={})=>Object.assign({},i,t),Ee=i=>{if(!i||typeof i!="object"||!Object.keys(i).length)return M;let t=M;return Object.assign((s,n,r={})=>t(s,n,N(i,r)),{Minimatch:class extends t.Minimatch{constructor(n,r={}){super(n,N(i,r))}static defaults(n){return t.defaults(N(i,n)).Minimatch}},AST:class extends t.AST{constructor(n,r,o={}){super(n,r,N(i,o))}static fromGlob(n,r={}){return t.AST.fromGlob(n,N(i,r))}},unescape:(s,n={})=>t.unescape(s,N(i,n)),escape:(s,n={})=>t.escape(s,N(i,n)),filter:(s,n={})=>t.filter(s,N(i,n)),defaults:s=>t.defaults(N(i,s)),makeRe:(s,n={})=>t.makeRe(s,N(i,n)),braceExpand:(s,n={})=>t.braceExpand(s,N(i,n)),match:(s,n,r={})=>t.match(s,n,N(i,r)),sep:t.sep,GLOBSTAR:A})};M.defaults=Ee;var mt=(i,t={})=>(L(i),t.nobrace||!/\{(?:(?!\{).)*\}/.test(i)?[i]:it(i,{max:t.braceExpandMax}));M.braceExpand=mt;var Me=(i,t={})=>new D(i,t).makeRe();M.makeRe=Me;var Ae=(i,t,e={})=>{let s=new D(t,e);return i=i.filter(n=>s.match(n)),s.options.nonull&&!i.length&&i.push(t),i};M.match=Ae;var ut=/[?*]|[+@!]\(.*?\)|\[|\]/,Pe=i=>i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),D=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(t,e={}){L(t),e=e||{},this.options=e,this.maxGlobstarRecursion=e.maxGlobstarRecursion??200,this.pattern=t,this.platform=e.platform||dt,this.isWindows=this.platform==="win32";let s="allowWindowsEscape";this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e[s]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!e.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!e.nonegate,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=e.windowsNoMagicRoot!==void 0?e.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let e of t)if(typeof e!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,e=this.options;if(!e.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],e.debug&&(this.debug=(...r)=>console.error(...r)),this.debug(this.pattern,this.globSet);let s=this.globSet.map(r=>this.slashSplit(r));this.globParts=this.preprocess(s),this.debug(this.pattern,this.globParts);let n=this.globParts.map((r,o,l)=>{if(this.isWindows&&this.windowsNoMagicRoot){let h=r[0]===""&&r[1]===""&&(r[2]==="?"||!ut.test(r[2]))&&!ut.test(r[3]),c=/^[a-z]:/i.test(r[0]);if(h)return[...r.slice(0,4),...r.slice(4).map(g=>this.parse(g))];if(c)return[r[0],...r.slice(1).map(g=>this.parse(g))]}return r.map(h=>this.parse(h))});if(this.debug(this.pattern,n),this.set=n.filter(r=>r.indexOf(!1)===-1),this.isWindows)for(let r=0;r<this.set.length;r++){let o=this.set[r];o[0]===""&&o[1]===""&&this.globParts[r][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let s of t)for(let n=0;n<s.length;n++)s[n]==="**"&&(s[n]="*");let{optimizationLevel:e=1}=this.options;return e>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):e>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(e=>{let s=-1;for(;(s=e.indexOf("**",s+1))!==-1;){let n=s;for(;e[n+1]==="**";)n++;n!==s&&e.splice(s,n-s)}return e})}levelOneOptimize(t){return t.map(e=>(e=e.reduce((s,n)=>{let r=s[s.length-1];return n==="**"&&r==="**"?s:n===".."&&r&&r!==".."&&r!=="."&&r!=="**"?(s.pop(),s):(s.push(n),s)},[]),e.length===0?[""]:e))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let e=!1;do{if(e=!1,!this.preserveMultipleSlashes){for(let n=1;n<t.length-1;n++){let r=t[n];n===1&&r===""&&t[0]===""||(r==="."||r==="")&&(e=!0,t.splice(n,1),n--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(e=!0,t.pop())}let s=0;for(;(s=t.indexOf("..",s+1))!==-1;){let n=t[s-1];n&&n!=="."&&n!==".."&&n!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(n))&&(e=!0,t.splice(s-1,2),s-=2)}}while(e);return t.length===0?[""]:t}firstPhasePreProcess(t){let e=!1;do{e=!1;for(let s of t){let n=-1;for(;(n=s.indexOf("**",n+1))!==-1;){let o=n;for(;s[o+1]==="**";)o++;o>n&&s.splice(n+1,o-n);let l=s[n+1],h=s[n+2],c=s[n+3];if(l!==".."||!h||h==="."||h===".."||!c||c==="."||c==="..")continue;e=!0,s.splice(n,1);let g=s.slice(0);g[n]="**",t.push(g),n--}if(!this.preserveMultipleSlashes){for(let o=1;o<s.length-1;o++){let l=s[o];o===1&&l===""&&s[0]===""||(l==="."||l==="")&&(e=!0,s.splice(o,1),o--)}s[0]==="."&&s.length===2&&(s[1]==="."||s[1]==="")&&(e=!0,s.pop())}let r=0;for(;(r=s.indexOf("..",r+1))!==-1;){let o=s[r-1];if(o&&o!=="."&&o!==".."&&o!=="**"){e=!0;let h=r===1&&s[r+1]==="**"?["."]:[];s.splice(r-1,2,...h),s.length===0&&s.push(""),r-=2}}}}while(e);return t}secondPhasePreProcess(t){for(let e=0;e<t.length-1;e++)for(let s=e+1;s<t.length;s++){let n=this.partsMatch(t[e],t[s],!this.preserveMultipleSlashes);if(n){t[e]=[],t[s]=n;break}}return t.filter(e=>e.length)}partsMatch(t,e,s=!1){let n=0,r=0,o=[],l="";for(;n<t.length&&r<e.length;)if(t[n]===e[r])o.push(l==="b"?e[r]:t[n]),n++,r++;else if(s&&t[n]==="**"&&e[r]===t[n+1])o.push(t[n]),n++;else if(s&&e[r]==="**"&&t[n]===e[r+1])o.push(e[r]),r++;else if(t[n]==="*"&&e[r]&&(this.options.dot||!e[r].startsWith("."))&&e[r]!=="**"){if(l==="b")return!1;l="a",o.push(t[n]),n++,r++}else if(e[r]==="*"&&t[n]&&(this.options.dot||!t[n].startsWith("."))&&t[n]!=="**"){if(l==="a")return!1;l="b",o.push(e[r]),n++,r++}else return!1;return t.length===e.length&&o}parseNegate(){if(this.nonegate)return;let t=this.pattern,e=!1,s=0;for(let n=0;n<t.length&&t.charAt(n)==="!";n++)e=!e,s++;s&&(this.pattern=t.slice(s)),this.negate=e}matchOne(t,e,s=!1){let n=0,r=0;if(this.isWindows){let l=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),h=!l&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),c=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),g=!c&&e[0]===""&&e[1]===""&&e[2]==="?"&&typeof e[3]=="string"&&/^[a-z]:$/i.test(e[3]),a=h?3:l?0:void 0,p=g?3:c?0:void 0;if(typeof a=="number"&&typeof p=="number"){let[u,d]=[t[a],e[p]];u.toLowerCase()===d.toLowerCase()&&(e[p]=u,r=p,n=a)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(t=this.levelTwoFileOptimize(t)),e.includes(A)?this.#s(t,e,s,n,r):this.#i(t,e,s,n,r)}#s(t,e,s,n,r){let o=e.indexOf(A,r),l=e.lastIndexOf(A),[h,c,g]=s?[e.slice(r,o),e.slice(o+1),[]]:[e.slice(r,o),e.slice(o+1,l),e.slice(l+1)];if(h.length){let m=t.slice(n,n+h.length);if(!this.#i(m,h,s,0,0))return!1;n+=h.length,r+=h.length}let a=0;if(g.length){if(g.length+n>t.length)return!1;let m=t.length-g.length;if(this.#i(t,g,s,m,0))a=g.length;else{if(t[t.length-1]!==""||n+g.length===t.length||(m--,!this.#i(t,g,s,m,0)))return!1;a=g.length+1}}if(!c.length){let m=!!a;for(let b=n;b<t.length-a;b++){let y=String(t[b]);if(m=!0,y==="."||y===".."||!this.options.dot&&y.startsWith("."))return!1}return s||m}let p=[[[],0]],u=p[0],d=0,f=[0];for(let m of c)m===A?(f.push(d),u=[[],0],p.push(u)):(u[0].push(m),d++);let $=p.length-1,S=t.length-a;for(let m of p)m[1]=S-(f[$--]+m[0].length);return!!this.#n(t,p,n,0,s,0,!!a)}#n(t,e,s,n,r,o,l){let h=e[n];if(!h){for(let a=s;a<t.length;a++){l=!0;let p=t[a];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1}return l}let[c,g]=h;for(;s<=g;){if(this.#i(t.slice(0,s+c.length),c,r,s,0)&&o<this.maxGlobstarRecursion){let u=this.#n(t,e,s+c.length,n+1,r,o+1,l);if(u!==!1)return u}let p=t[s];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1;s++}return r||null}#i(t,e,s,n,r){let o,l,h,c;for(o=n,l=r,c=t.length,h=e.length;o<c&&l<h;o++,l++){this.debug("matchOne loop");let g=e[l],a=t[o];if(this.debug(e,g,a),g===!1||g===A)return!1;let p;if(typeof g=="string"?(p=a===g,this.debug("string match",g,a,p)):(p=g.test(a),this.debug("pattern match",g,a,p)),!p)return!1}if(o===c&&l===h)return!0;if(o===c)return s;if(l===h)return o===c-1&&t[o]==="";throw new Error("wtf?")}braceExpand(){return mt(this.pattern,this.options)}parse(t){L(t);let e=this.options;if(t==="**")return A;if(t==="")return"";let s,n=null;(s=t.match(ce))?n=e.dot?fe:he:(s=t.match(Qt))?n=(e.nocase?e.dot?ne:se:e.dot?ee:te)(s[1]):(s=t.match(ue))?n=(e.nocase?e.dot?ge:pe:e.dot?de:me)(s):(s=t.match(ie))?n=e.dot?oe:re:(s=t.match(ae))&&(n=le);let r=z.fromGlob(t,this.options).toMMPattern();return n&&typeof r=="object"&&Reflect.defineProperty(r,"test",{value:n}),r}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let e=this.options,s=e.noglobstar?Se:e.dot?$e:be,n=new Set(e.nocase?["i"]:[]),r=t.map(h=>{let c=h.map(a=>{if(a instanceof RegExp)for(let p of a.flags.split(""))n.add(p);return typeof a=="string"?Pe(a):a===A?A:a._src});c.forEach((a,p)=>{let u=c[p+1],d=c[p-1];a!==A||d===A||(d===void 0?u!==void 0&&u!==A?c[p+1]="(?:\\/|"+s+"\\/)?"+u:c[p]=s:u===void 0?c[p-1]=d+"(?:\\/|\\/"+s+")?":u!==A&&(c[p-1]=d+"(?:\\/|\\/"+s+"\\/)"+u,c[p+1]=A))});let g=c.filter(a=>a!==A);if(this.partial&&g.length>=1){let a=[];for(let p=1;p<=g.length;p++)a.push(g.slice(0,p).join("/"));return"(?:"+a.join("|")+")"}return g.join("/")}).join("|"),[o,l]=t.length>1?["(?:",")"]:["",""];r="^"+o+r+l+"$",this.partial&&(r="^(?:\\/|"+o+r.slice(1,-1)+l+")$"),this.negate&&(r="^(?!"+r+").+$");try{this.regexp=new RegExp(r,[...n].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,e=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&e)return!0;let s=this.options;this.isWindows&&(t=t.split("\\").join("/"));let n=this.slashSplit(t);this.debug(this.pattern,"split",n);let r=this.set;this.debug(this.pattern,"set",r);let o=n[n.length-1];if(!o)for(let l=n.length-2;!o&&l>=0;l--)o=n[l];for(let l of r){let h=n;if(s.matchBase&&l.length===1&&(h=[o]),this.matchOne(h,l,e))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(t){return M.defaults(t).Minimatch}};M.AST=z;M.Minimatch=D;M.escape=Z;M.unescape=v;function G(i){if(i<1024)return String(i);if(i<1024*1024){let e=i/1024;return e<10?`${e.toFixed(1)}K`:`${Math.round(e)}K`}if(i<1024*1024*1024){let e=i/1048576;return e<10?`${e.toFixed(1)}M`:`${Math.round(e)}M`}let t=i/(1024*1024*1024);return t<10?`${t.toFixed(1)}G`:`${Math.round(t)}G`}function F(i){let e=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][i.getMonth()],s=String(i.getDate()).padStart(2," "),n=new Date,r=new Date(n.getTime()-4320*60*60*1e3);if(i>r){let l=String(i.getHours()).padStart(2,"0"),h=String(i.getMinutes()).padStart(2,"0");return`${e} ${s} ${l}:${h}`}let o=i.getFullYear();return`${e} ${s} ${o}`}function C(i){return i.isDirectory?"/":i.isSymbolicLink?"@":(i.mode&73)!==0?"*":""}var Te={name:"ls",summary:"list directory contents",usage:"ls [OPTION]... [FILE]...",options:["-a, --all do not ignore entries starting with .","-A, --almost-all do not list . and ..","-d, --directory list directories themselves, not their contents","-F, --classify append indicator (one of */=>@) to entries","-h, --human-readable with -l, print sizes like 1K 234M 2G etc.","-l use a long listing format","-r, --reverse reverse order while sorting","-R, --recursive list subdirectories recursively","-S sort by file size, largest first","-t sort by time, newest first","-1 list one file per line"," --help display this help and exit"]},Ne={showAll:{short:"a",long:"all",type:"boolean"},showAlmostAll:{short:"A",long:"almost-all",type:"boolean"},longFormat:{short:"l",type:"boolean"},humanReadable:{short:"h",long:"human-readable",type:"boolean"},recursive:{short:"R",long:"recursive",type:"boolean"},reverse:{short:"r",long:"reverse",type:"boolean"},sortBySize:{short:"S",type:"boolean"},classifyFiles:{short:"F",long:"classify",type:"boolean"},directoryOnly:{short:"d",long:"directory",type:"boolean"},sortByTime:{short:"t",type:"boolean"},onePerLine:{short:"1",type:"boolean"}},es={name:"ls",async execute(i,t){if(V(i))return K(Te);let e=I("ls",i,Ne);if(!e.ok)return e.error;let s=e.result.flags.showAll,n=e.result.flags.showAlmostAll,r=e.result.flags.longFormat,o=e.result.flags.humanReadable,l=e.result.flags.recursive,h=e.result.flags.reverse,c=e.result.flags.sortBySize,g=e.result.flags.classifyFiles,a=e.result.flags.directoryOnly,p=e.result.flags.sortByTime;e.result.flags.onePerLine;let u=e.result.positional;u.length===0&&u.push(".");let d="",f="",$=0;for(let S=0;S<u.length;S++){let m=u[S];if(S>0&&d&&!d.endsWith(`
|
|
4
|
+
|
|
5
|
+
`)&&(d+=`
|
|
6
|
+
`),a){let b=t.fs.resolvePath(t.cwd,m);try{let y=await t.fs.stat(b);if(r){let w=y.isDirectory?"drwxr-xr-x":"-rw-r--r--",E=g?C(await t.fs.lstat(b)):y.isDirectory?"/":"",x=y.size??0,P=o?G(x).padStart(5):String(x).padStart(5),R=y.mtime??new Date(0),W=F(R);d+=`${w} 1 user user ${P} ${W} ${m}${E}
|
|
7
|
+
`}else{let w=g?C(await t.fs.lstat(b)):"";d+=`${m}${w}
|
|
8
|
+
`}}catch{f+=`ls: cannot access '${m}': No such file or directory
|
|
9
|
+
`,$=2}continue}if(m.includes("*")||m.includes("?")||m.includes("[")){let b=await Re(m,t,s,n,r,h,o,c,g);d+=b.stdout,f+=b.stderr,b.exitCode!==0&&($=b.exitCode)}else{let b=await yt(m,t,s,n,r,l,u.length>1,h,o,c,g);d+=b.stdout,f+=b.stderr,b.exitCode!==0&&($=b.exitCode)}}return{stdout:d,stderr:f,exitCode:$}}};async function Re(i,t,e,s,n,r=!1,o=!1,l=!1,h=!1){let c=e||s,g=t.fs.getAllPaths(),a=t.fs.resolvePath(t.cwd,"."),p=[];for(let u of g){let d=u.startsWith(a)&&u.slice(a.length+1)||u;if(M(d,i)||M(u,i)){let f=d.split("/").pop()||d;if(!c&&f.startsWith("."))continue;p.push(d||u)}}if(p.length===0)return{stdout:"",stderr:`ls: ${i}: No such file or directory
|
|
10
|
+
`,exitCode:2};if(l){let u=[];for(let d of p){let f=t.fs.resolvePath(t.cwd,d);try{let $=await t.fs.stat(f);u.push({path:d,size:$.size??0})}catch{u.push({path:d,size:0})}}u.sort((d,f)=>f.size-d.size),p.length=0,p.push(...u.map(d=>d.path))}else p.sort();if(r&&p.reverse(),n){let u=[];for(let d of p){let f=t.fs.resolvePath(t.cwd,d);try{let $=await t.fs.stat(f),S=$.isDirectory?"drwxr-xr-x":"-rw-r--r--",m=h?C(await t.fs.lstat(f)):$.isDirectory?"/":"",b=$.size??0,y=o?G(b).padStart(5):String(b).padStart(5),w=$.mtime??new Date(0),E=F(w);u.push(`${S} 1 user user ${y} ${E} ${d}${m}`)}catch{u.push(`-rw-r--r-- 1 user user 0 Jan 1 00:00 ${d}`)}}return{stdout:`${u.join(`
|
|
11
|
+
`)}
|
|
12
|
+
`,stderr:"",exitCode:0}}if(h){let u=[];for(let d of p){let f=t.fs.resolvePath(t.cwd,d);try{let $=await t.fs.lstat(f);u.push(`${d}${C($)}`)}catch{u.push(d)}}return{stdout:`${u.join(`
|
|
13
|
+
`)}
|
|
14
|
+
`,stderr:"",exitCode:0}}return{stdout:`${p.join(`
|
|
15
|
+
`)}
|
|
16
|
+
`,stderr:"",exitCode:0}}async function yt(i,t,e,s,n,r,o,l=!1,h=!1,c=!1,g=!1,a=!1){let p=e||s,u=t.fs.resolvePath(t.cwd,i);try{let d=await t.fs.stat(u);if(!d.isDirectory){let S=g?C(await t.fs.lstat(u)):"";if(n){let m=d.size??0,b=h?G(m).padStart(5):String(m).padStart(5),y=d.mtime??new Date(0),w=F(y);return{stdout:`-rw-r--r-- 1 user user ${b} ${w} ${i}${S}
|
|
17
|
+
`,stderr:"",exitCode:0}}return{stdout:`${i}${S}
|
|
18
|
+
`,stderr:"",exitCode:0}}let f=await t.fs.readdir(u);if(p||(f=f.filter(S=>!S.startsWith("."))),c){let S=[];for(let m of f){let b=u==="/"?`/${m}`:`${u}/${m}`;try{let y=await t.fs.stat(b);S.push({name:m,size:y.size??0})}catch{S.push({name:m,size:0})}}S.sort((m,b)=>b.size-m.size),f=S.map(m=>m.name)}else f.sort();e&&(f=[".","..",...f]),l&&f.reverse();let $="";if((r||o)&&($+=`${i}:
|
|
19
|
+
`),n){$+=`total ${f.length}
|
|
20
|
+
`;let S=f.filter(w=>w==="."||w===".."),m=f.filter(w=>w!=="."&&w!=="..");for(let w of S)$+=`drwxr-xr-x 1 user user 0 Jan 1 00:00 ${w}
|
|
21
|
+
`;let b=[];for(let w=0;w<m.length;w+=100){let E=m.slice(w,w+100),x=await Promise.all(E.map(async P=>{let R=u==="/"?`/${P}`:`${u}/${P}`;try{let W=await t.fs.stat(R),wt=W.isDirectory?"drwxr-xr-x":"-rw-r--r--",St=g?C(await t.fs.lstat(R)):W.isDirectory?"/":"",X=W.size??0,$t=h?G(X).padStart(5):String(X).padStart(5),bt=W.mtime??new Date(0),xt=F(bt);return{name:P,line:`${wt} 1 user user ${$t} ${xt} ${P}${St}
|
|
22
|
+
`}}catch{return{name:P,line:`-rw-r--r-- 1 user user 0 Jan 1 00:00 ${P}
|
|
23
|
+
`}}}));b.push(...x)}let y=new Map(m.map((w,E)=>[w,E]));b.sort((w,E)=>(y.get(w.name)??0)-(y.get(E.name)??0));for(let{line:w}of b)$+=w}else if(g){let S=[],m=f.filter(y=>y!=="."&&y!==".."),b=f.filter(y=>y==="."||y==="..");for(let y of b)S.push(`${y}/`);for(let y=0;y<m.length;y+=100){let w=m.slice(y,y+100),E=await Promise.all(w.map(async x=>{let P=u==="/"?`/${x}`:`${u}/${x}`;try{let R=await t.fs.lstat(P);return`${x}${C(R)}`}catch{return x}}));S.push(...E)}$+=S.join(`
|
|
24
|
+
`)+(S.length?`
|
|
25
|
+
`:"")}else $+=f.join(`
|
|
26
|
+
`)+(f.length?`
|
|
27
|
+
`:"");if(r){let S=f.filter(y=>y!=="."&&y!==".."),m=[];if(t.fs.readdirWithFileTypes)m=(await t.fs.readdirWithFileTypes(u)).filter(w=>w.isDirectory&&S.includes(w.name)).map(w=>({name:w.name,isDirectory:!0}));else for(let y=0;y<S.length;y+=100){let w=S.slice(y,y+100),E=await Promise.all(w.map(async x=>{let P=u==="/"?`/${x}`:`${u}/${x}`;try{let R=await t.fs.stat(P);return{name:x,isDirectory:R.isDirectory}}catch{return{name:x,isDirectory:!1}}}));m.push(...E.filter(x=>x.isDirectory))}m.sort((y,w)=>y.name.localeCompare(w.name)),l&&m.reverse();let b=[];for(let y=0;y<m.length;y+=100){let w=m.slice(y,y+100),E=await Promise.all(w.map(async x=>{let P=i==="."?`./${x.name}`:`${i}/${x.name}`,R=await yt(P,t,e,s,n,r,!1,l,h,c,g,!0);return{name:x.name,result:R}}));b.push(...E)}b.sort((y,w)=>y.name.localeCompare(w.name)),l&&b.reverse();for(let{result:y}of b)$+=`
|
|
28
|
+
`,$+=y.stdout}return{stdout:$,stderr:"",exitCode:0}}catch{return{stdout:"",stderr:`ls: ${i}: No such file or directory
|
|
29
|
+
`,exitCode:2}}}var ss={name:"ls",flags:[{flag:"-a",type:"boolean"},{flag:"-A",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-h",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-S",type:"boolean"},{flag:"-F",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-1",type:"boolean"}],needsFiles:!0};export{es as a,ss as b};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
+
import{c as p}from"./chunk-MUFNRCMY.js";function x(a,i,d){let g=new Map,h=new Map;for(let[t,e]of Object.entries(d)){let n={name:t,type:e.type};e.short&&g.set(e.short,n),e.long&&h.set(e.long,n)}let s=Object.create(null);for(let[t,e]of Object.entries(d))e.default!==void 0?s[t]=e.default:e.type==="boolean"&&(s[t]=!1);let b=[],k=!1;for(let t=0;t<i.length;t++){let e=i[t];if(k||!e.startsWith("-")||e==="-"){b.push(e);continue}if(e==="--"){k=!0;continue}if(e.startsWith("--")){let n=e.indexOf("="),o,r;n!==-1?(o=e.slice(2,n),r=e.slice(n+1)):o=e.slice(2);let l=h.get(o);if(!l)return{ok:!1,error:p(a,e)};let{name:f,type:u}=l;if(u==="boolean")s[f]=!0;else{if(r===void 0){if(t+1>=i.length)return{ok:!1,error:{stdout:"",stderr:`${a}: option '--${o}' requires an argument
|
|
4
|
+
`,exitCode:1}};r=i[++t]}s[f]=u==="number"?parseInt(r,10):r}}else{let n=e.slice(1);for(let o=0;o<n.length;o++){let r=n[o],l=g.get(r);if(!l)return{ok:!1,error:p(a,`-${r}`)};let{name:f,type:u}=l;if(u==="boolean")s[f]=!0;else{let c;if(o+1<n.length)c=n.slice(o+1);else if(t+1<i.length)c=i[++t];else return{ok:!1,error:{stdout:"",stderr:`${a}: option requires an argument -- '${r}'
|
|
5
|
+
`,exitCode:1}};s[f]=u==="number"?parseInt(c,10):c;break}}}}return{ok:!0,result:{flags:s,positional:b}}}export{x as a};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
+
import{a as Ee}from"./chunk-MROECM42.js";import{a as D,b as _}from"./chunk-LNNWMRCB.js";import{a as x}from"./chunk-HL4ZS7TX.js";import{a as v,b as H}from"./chunk-IEXQTXU5.js";import{a as z}from"./chunk-VZK4FHWJ.js";import{k as P}from"./chunk-47WZ2U6M.js";import{a as fe,b as de,c as ie}from"./chunk-MUFNRCMY.js";var Be=1e4,He=100,$e=new H(/\s+/);function se(e={}){let{fieldSep:t=$e,maxIterations:n=Be,maxRecursionDepth:i=He,maxOutputSize:s=0,fs:a,cwd:o,exec:l,coverage:u,requireDefenseContext:N}=e;return{FS:" ",OFS:" ",ORS:`
|
|
4
|
+
`,OFMT:"%.6g",NR:0,NF:0,FNR:0,FILENAME:"",RSTART:0,RLENGTH:-1,SUBSEP:"",fields:[],line:"",vars:Object.create(null),arrays:Object.create(null),arrayAliases:new Map,ARGC:0,ARGV:Object.create(null),ENVIRON:Object.create(null),functions:new Map,fieldSep:t,maxIterations:n,maxRecursionDepth:i,maxOutputSize:s,currentRecursionDepth:0,exitCode:0,shouldExit:!1,shouldNext:!1,shouldNextFile:!1,loopBreak:!1,loopContinue:!1,hasReturn:!1,inEndBlock:!1,output:"",openedFiles:new Set,fs:a,cwd:o,exec:l,coverage:u,requireDefenseContext:N}}function Ne(e,t,n){switch(n){case"+":return e+t;case"-":return e-t;case"*":return e*t;case"/":return t!==0?e/t:0;case"%":return t!==0?e%t:0;case"^":case"**":return e**t;default:return 0}}function M(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function k(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}async function j(e,t){if(e.type==="regex")return e.pattern;let n=k(await t.evalExpr(e));return n.startsWith("/")&&n.endsWith("/")&&(n=n.slice(1,-1)),n}async function Se(e,t){return e?e.type==="variable"?e.name:e.type==="field"?`$${Math.floor(M(await t.evalExpr(e.index)))}`:"$0":"$0"}function me(e,t){if(e==="$0")return t.line;if(e.startsWith("$")){let n=parseInt(e.slice(1),10)-1;return t.fields[n]||""}return k(t.vars[e]??"")}function we(e,t,n){if(e==="$0")n.line=t,n.fields=n.FS===" "?t.trim().split(/\s+/).filter(Boolean):n.fieldSep.split(t),n.NF=n.fields.length;else if(e.startsWith("$")){let i=parseInt(e.slice(1),10)-1;for(;n.fields.length<=i;)n.fields.push("");n.fields[i]=t,n.NF=n.fields.length,n.line=n.fields.join(n.OFS)}else n.vars[e]=t}async function We(e,t,n){return e.length===0?t.line.length:k(await n.evalExpr(e[0])).length}async function Ve(e,t,n){if(e.length<2)return"";let i=k(await n.evalExpr(e[0])),s=Math.floor(M(await n.evalExpr(e[1])))-1;if(e.length>=3){let a=Math.floor(M(await n.evalExpr(e[2])));return i.substr(Math.max(0,s),a)}return i.substr(Math.max(0,s))}async function Ke(e,t,n){if(e.length<2)return 0;let i=k(await n.evalExpr(e[0])),s=k(await n.evalExpr(e[1])),a=i.indexOf(s);return a===-1?0:a+1}async function Xe(e,t,n){if(e.length<2)return 0;let i=k(await n.evalExpr(e[0])),s=e[1];if(s.type!=="variable")return 0;let a=s.name,o=t.FS;if(e.length>=3){let u=e[2];if(u.type==="regex")o=v(u.pattern);else{let N=k(await n.evalExpr(u));o=N===" "?v("\\s+"):N}}else t.FS===" "&&(o=v("\\s+"));let l=typeof o=="string"?i.split(o):o.split(i);t.arrays[a]=Object.create(null);for(let u=0;u<l.length;u++)t.arrays[a][String(u+1)]=l[u];return l.length}async function qe(e,t,n){if(e.length<2)return 0;let i=await j(e[0],n),s=k(await n.evalExpr(e[1])),a=await Se(e[2],n),o=me(a,t);try{let u=v(i).replace(o,Re(s)),N=u!==o?1:0;return we(a,u,t),N}catch{return 0}}async function ze(e,t,n){if(e.length<2)return 0;let i=await j(e[0],n),s=k(await n.evalExpr(e[1])),a=await Se(e[2],n),o=me(a,t);try{let l=v(i,"g"),u=l.match(o),N=u?u.length:0,A=l.replace(o,Re(s));return we(a,A,t),N}catch{return 0}}function Re(e){return t=>{let n="",i=0;for(;i<e.length;)if(e[i]==="\\"&&i+1<e.length){let s=e[i+1];s==="&"?(n+="&",i+=2):s==="\\"?(n+="\\",i+=2):(n+=e[i+1],i+=2)}else e[i]==="&"?(n+=t,i++):(n+=e[i],i++);return n}}async function je(e,t,n){if(e.length<2)return t.RSTART=0,t.RLENGTH=-1,0;let i=k(await n.evalExpr(e[0])),s=await j(e[1],n);try{let o=v(s).exec(i);if(o)return t.RSTART=o.index+1,t.RLENGTH=o[0].length,t.RSTART}catch{}return t.RSTART=0,t.RLENGTH=-1,0}async function Qe(e,t,n){if(e.length<3)return"";let i=await j(e[0],n),s=k(await n.evalExpr(e[1])),a=k(await n.evalExpr(e[2])),o=e.length>=4?k(await n.evalExpr(e[3])):t.line;try{let l=a.toLowerCase()==="g",u=l?0:parseInt(a,10)||1;if(l)return v(i,"g").replace(o,(A,...C)=>ye(s,A,C.slice(0,-2)));{let N=0;return v(i,"g").replace(o,(C,...O)=>(N++,N===u?ye(s,C,O.slice(0,-2)):C))}}catch{return o}}function ye(e,t,n){let i="",s=0;for(;s<e.length;)if(e[s]==="\\"&&s+1<e.length){let a=e[s+1];if(a==="&")i+="&",s+=2;else if(a==="0")i+=t,s+=2;else if(a>="1"&&a<="9"){let o=parseInt(a,10)-1;i+=n[o]||"",s+=2}else a==="n"?(i+=`
|
|
5
|
+
`,s+=2):a==="t"?(i+=" ",s+=2):(i+=a,s+=2)}else e[s]==="&"?(i+=t,s++):(i+=e[s],s++);return i}async function Je(e,t,n){return e.length===0?"":k(await n.evalExpr(e[0])).toLowerCase()}async function Ze(e,t,n){return e.length===0?"":k(await n.evalExpr(e[0])).toUpperCase()}async function Ye(e,t,n){if(e.length===0)return"";let i=k(await n.evalExpr(e[0])),s=[];for(let a=1;a<e.length;a++)s.push(await n.evalExpr(e[a]));return Q(i,s)}async function et(e,t,n){return e.length===0?0:Math.floor(M(await n.evalExpr(e[0])))}async function tt(e,t,n){return e.length===0?0:Math.sqrt(M(await n.evalExpr(e[0])))}async function nt(e,t,n){return e.length===0?0:Math.sin(M(await n.evalExpr(e[0])))}async function rt(e,t,n){return e.length===0?0:Math.cos(M(await n.evalExpr(e[0])))}async function it(e,t,n){let i=e.length>0?M(await n.evalExpr(e[0])):0,s=e.length>1?M(await n.evalExpr(e[1])):0;return Math.atan2(i,s)}async function st(e,t,n){return e.length===0?0:Math.log(M(await n.evalExpr(e[0])))}async function at(e,t,n){return e.length===0?1:Math.exp(M(await n.evalExpr(e[0])))}function ot(e,t,n){return t.random?t.random():Math.random()}async function lt(e,t,n){let i=e.length>0?M(await n.evalExpr(e[0])):Date.now();return t.vars._srand_seed=i,i}function ut(e,t){return()=>{throw new Error(`${e}() is not supported - ${t}`)}}function ae(e){return()=>{throw new Error(`function '${e}()' is not implemented`)}}var U=1e4;function Q(e,t){let n=0,i="",s=0;for(;s<e.length;)if(e[s]==="%"&&s+1<e.length){let a=s+1,o="",l="",u="",N,A=a;for(;a<e.length&&/\d/.test(e[a]);)a++;a>A&&e[a]==="$"?(N=parseInt(e.substring(A,a),10)-1,a++):a=A;let C=()=>{if(a<e.length){if(a+1<e.length&&(e[a]==="h"&&e[a+1]==="h"||e[a]==="l"&&e[a+1]==="l")){a+=2;return}/[lzjh]/.test(e[a])&&a++}};for(;a<e.length&&/[-+ #0]/.test(e[a]);)o+=e[a++];if(e[a]==="*"){let d=t[n++],R=d!==void 0?Math.floor(Number(d)):0;R<0?(o+="-",l=String(Math.min(-R,U))):l=String(Math.min(R,U)),a++}else for(;a<e.length&&/\d/.test(e[a]);)l+=e[a++];if(l&&parseInt(l,10)>U&&(l=String(U)),e[a]==="."){if(a++,e[a]==="*"){let d=t[n++];u=String(Math.min(d!==void 0?Math.floor(Number(d)):0,U)),a++}else for(;a<e.length&&/\d/.test(e[a]);)u+=e[a++];u&&parseInt(u,10)>U&&(u=String(U))}C();let O=e[a],w=t[N!==void 0?N:n];switch(O){case"s":{let d=w!==void 0?String(w):"";if(u&&(d=d.substring(0,parseInt(u,10))),l){let R=parseInt(l,10);o.includes("-")?d=d.padEnd(R):d=d.padStart(R)}i+=d,N===void 0&&n++;break}case"d":case"i":{let d=w!==void 0?Math.floor(Number(w)):0;Number.isNaN(d)&&(d=0);let R=d<0,h=Math.abs(d).toString();if(u){let F=parseInt(u,10);h=h.padStart(F,"0")}let c="";R?c="-":o.includes("+")?c="+":o.includes(" ")&&(c=" ");let E=c+h;if(l){let F=parseInt(l,10);o.includes("-")?E=E.padEnd(F):o.includes("0")&&!u?E=c+h.padStart(F-c.length,"0"):E=E.padStart(F)}i+=E,N===void 0&&n++;break}case"f":{let d=w!==void 0?Number(w):0;Number.isNaN(d)&&(d=0);let R=u?parseInt(u,10):6,h=d.toFixed(R);if(l){let c=parseInt(l,10);o.includes("-")?h=h.padEnd(c):h=h.padStart(c)}i+=h,N===void 0&&n++;break}case"e":case"E":{let d=w!==void 0?Number(w):0;Number.isNaN(d)&&(d=0);let R=u?parseInt(u,10):6,h=d.toExponential(R);if(O==="E"&&(h=h.toUpperCase()),l){let c=parseInt(l,10);o.includes("-")?h=h.padEnd(c):h=h.padStart(c)}i+=h,N===void 0&&n++;break}case"g":case"G":{let d=w!==void 0?Number(w):0;Number.isNaN(d)&&(d=0);let R=u?parseInt(u,10):6,h=d!==0?Math.floor(Math.log10(Math.abs(d))):0,c;if(d===0?c="0":h<-4||h>=R?(c=d.toExponential(R-1),O==="G"&&(c=c.toUpperCase())):c=d.toPrecision(R),c.includes(".")&&(c=c.replace(/\.?0+$/,"").replace(/\.?0+e/,"e")),c.includes("e")&&(c=c.replace(/\.?0+e/,"e")),l){let E=parseInt(l,10);o.includes("-")?c=c.padEnd(E):c=c.padStart(E)}i+=c,N===void 0&&n++;break}case"x":case"X":{let d=w!==void 0?Math.floor(Number(w)):0;Number.isNaN(d)&&(d=0);let R=Math.abs(d).toString(16);if(O==="X"&&(R=R.toUpperCase()),u){let E=parseInt(u,10);R=R.padStart(E,"0")}let h=d<0?"-":"",c=h+R;if(l){let E=parseInt(l,10);o.includes("-")?c=c.padEnd(E):o.includes("0")&&!u?c=h+R.padStart(E-h.length,"0"):c=c.padStart(E)}i+=c,N===void 0&&n++;break}case"o":{let d=w!==void 0?Math.floor(Number(w)):0;Number.isNaN(d)&&(d=0);let R=Math.abs(d).toString(8);if(u){let E=parseInt(u,10);R=R.padStart(E,"0")}let h=d<0?"-":"",c=h+R;if(l){let E=parseInt(l,10);o.includes("-")?c=c.padEnd(E):o.includes("0")&&!u?c=h+R.padStart(E-h.length,"0"):c=c.padStart(E)}i+=c,N===void 0&&n++;break}case"c":{typeof w=="number"?i+=String.fromCharCode(w):i+=String(w??"").charAt(0)||"",N===void 0&&n++;break}case"%":i+="%";break;default:i+=e.substring(s,a+1)}s=a+1}else if(e[s]==="\\"&&s+1<e.length){let a=e[s+1];switch(a){case"n":i+=`
|
|
6
|
+
`;break;case"t":i+=" ";break;case"r":i+="\r";break;case"\\":i+="\\";break;default:i+=a}s+=2}else i+=e[s++];return i}var ge=new Map([["length",We],["substr",Ve],["index",Ke],["split",Xe],["sub",qe],["gsub",ze],["match",je],["gensub",Qe],["tolower",Je],["toupper",Ze],["sprintf",Ye],["int",et],["sqrt",tt],["sin",nt],["cos",rt],["atan2",it],["log",st],["exp",at],["rand",ot],["srand",lt],["system",ut("system","shell execution not allowed in sandboxed environment")],["close",()=>0],["fflush",()=>0],["systime",ae("systime")],["mktime",ae("mktime")],["strftime",ae("strftime")]]);function b(e){return typeof e=="number"?e!==0:!(e===""||e==="0")}function g(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function m(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}function oe(e){if(typeof e=="number")return!0;let t=String(e).trim();return t===""?!1:!Number.isNaN(Number(t))}function K(e,t){try{return v(e).test(t)}catch{return!1}}function Ae(e,t){return t===""?[]:e.FS===" "?t.trim().split(/\s+/).filter(Boolean):e.fieldSep.split(t)}function J(e,t){return t===0?e.line:t<0||t>e.fields.length?"":e.fields[t-1]??""}function le(e,t,n){if(t===0)e.line=m(n),e.fields=Ae(e,e.line),e.NF=e.fields.length;else if(t>0){for(;e.fields.length<t;)e.fields.push("");e.fields[t-1]=m(n),e.NF=e.fields.length,e.line=e.fields.join(e.OFS)}}function $(e,t){e.line=t,e.fields=Ae(e,t),e.NF=e.fields.length}function ve(e,t){if(e.FS=t,t===" ")e.fieldSep=new H(/\s+/);else try{e.fieldSep=v(t)}catch{e.fieldSep=v(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))}}function Z(e,t){switch(t){case"FS":return e.FS;case"OFS":return e.OFS;case"ORS":return e.ORS;case"OFMT":return e.OFMT;case"NR":return e.NR;case"NF":return e.NF;case"FNR":return e.FNR;case"FILENAME":return e.FILENAME;case"RSTART":return e.RSTART;case"RLENGTH":return e.RLENGTH;case"SUBSEP":return e.SUBSEP;case"ARGC":return e.ARGC}return e.vars[t]??""}function W(e,t,n){switch(t){case"FS":ve(e,m(n));return;case"OFS":e.OFS=m(n);return;case"ORS":e.ORS=m(n);return;case"OFMT":e.OFMT=m(n);return;case"NR":e.NR=Math.floor(g(n));return;case"NF":{let i=Math.floor(g(n));if(i<e.NF)e.fields=e.fields.slice(0,i),e.line=e.fields.join(e.OFS);else if(i>e.NF){for(;e.fields.length<i;)e.fields.push("");e.line=e.fields.join(e.OFS)}e.NF=i;return}case"FNR":e.FNR=Math.floor(g(n));return;case"FILENAME":e.FILENAME=m(n);return;case"RSTART":e.RSTART=Math.floor(g(n));return;case"RLENGTH":e.RLENGTH=Math.floor(g(n));return;case"SUBSEP":e.SUBSEP=m(n);return}e.vars[t]=n}function X(e,t){let n=t,i=new Set,s=e.arrayAliases.get(n);for(;s!==void 0&&!i.has(n);)i.add(n),n=s,s=e.arrayAliases.get(n);return n}function Y(e,t,n){if(t==="ARGV")return e.ARGV[n]??"";if(t==="ENVIRON")return e.ENVIRON[n]??"";let i=X(e,t);return e.arrays[i]?.[n]??""}function ue(e,t,n,i){let s=X(e,t);e.arrays[s]||(e.arrays[s]=Object.create(null)),e.arrays[s][n]=i}function Ie(e,t,n){if(t==="ARGV")return e.ARGV[n]!==void 0;if(t==="ENVIRON")return e.ENVIRON[n]!==void 0;let i=X(e,t);return e.arrays[i]?.[n]!==void 0}function ke(e,t,n){let i=X(e,t);e.arrays[i]&&delete e.arrays[i][n]}function Ce(e,t){let n=X(e,t);delete e.arrays[n]}var be=null;function Oe(e){be=e}function L(e,t){D(e.requireDefenseContext,"awk",t)}function S(e,t,n){return _(e.requireDefenseContext,"awk",t,n)}async function f(e,t){switch(L(e,"expression evaluation"),e.coverage?.hit(`awk:expr:${t.type}`),t.type){case"number":return t.value;case"string":return t.value;case"regex":return K(t.pattern,e.line)?1:0;case"field":return ct(e,t);case"variable":return Z(e,t.name);case"array_access":return ht(e,t);case"binary":return pt(e,t);case"unary":return Et(e,t);case"ternary":return b(await S(e,"ternary condition evaluation",()=>f(e,t.condition)))?await S(e,"ternary consequent evaluation",()=>f(e,t.consequent)):await S(e,"ternary alternate evaluation",()=>f(e,t.alternate));case"call":return Nt(e,t.name,t.args);case"assignment":return St(e,t);case"pre_increment":return mt(e,t.operand);case"pre_decrement":return wt(e,t.operand);case"post_increment":return Rt(e,t.operand);case"post_decrement":return gt(e,t.operand);case"in":return At(e,t.key,t.array);case"getline":return vt(e,t.variable,t.file,t.command);case"tuple":return Ct(e,t.elements);default:return""}}async function ct(e,t){L(e,"field reference evaluation");let n=Math.floor(g(await S(e,"field index evaluation",()=>f(e,t.index))));return J(e,n)}async function ht(e,t){L(e,"array access evaluation");let n=m(await S(e,"array key evaluation",()=>f(e,t.key)));return Y(e,t.array,n)}async function pt(e,t){L(e,"binary expression evaluation");let n=t.operator;if(n==="||")return b(await S(e,"logical-or left evaluation",()=>f(e,t.left)))||b(await S(e,"logical-or right evaluation",()=>f(e,t.right)))?1:0;if(n==="&&")return b(await S(e,"logical-and left evaluation",()=>f(e,t.left)))&&b(await S(e,"logical-and right evaluation",()=>f(e,t.right)))?1:0;if(n==="~"){let l=await S(e,"regex left evaluation",()=>f(e,t.left));t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let u=t.right.type==="regex"?t.right.pattern:m(await S(e,"regex right evaluation",()=>f(e,t.right)));try{return v(u).test(m(l))?1:0}catch{return 0}}if(n==="!~"){let l=await S(e,"negated-regex left evaluation",()=>f(e,t.left));t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let u=t.right.type==="regex"?t.right.pattern:m(await S(e,"negated-regex right evaluation",()=>f(e,t.right)));try{return v(u).test(m(l))?0:1}catch{return 1}}let i=await S(e,"binary left evaluation",()=>f(e,t.left)),s=await S(e,"binary right evaluation",()=>f(e,t.right));if(n===" "){let l=m(i)+m(s);if(e.maxOutputSize>0&&l.length>e.maxOutputSize)throw new P(`awk: string concatenation size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output);return l}if(ft(n))return dt(i,s,n);let a=g(i),o=g(s);return Ne(a,o,n)}function ft(e){return["<","<=",">",">=","==","!="].includes(e)}function dt(e,t,n){let i=oe(e),s=oe(t);if(i&&s){let l=g(e),u=g(t);switch(n){case"<":return l<u?1:0;case"<=":return l<=u?1:0;case">":return l>u?1:0;case">=":return l>=u?1:0;case"==":return l===u?1:0;case"!=":return l!==u?1:0}}let a=m(e),o=m(t);switch(n){case"<":return a<o?1:0;case"<=":return a<=o?1:0;case">":return a>o?1:0;case">=":return a>=o?1:0;case"==":return a===o?1:0;case"!=":return a!==o?1:0}return 0}async function Et(e,t){L(e,"unary expression evaluation");let n=await S(e,"unary operand evaluation",()=>f(e,t.operand));switch(t.operator){case"!":return b(n)?0:1;case"-":return-g(n);case"+":return+g(n);default:return n}}async function Nt(e,t,n){L(e,"function call evaluation");let i=ge.get(t);if(i)return i(n,e,{evalExpr:a=>f(e,a)});let s=e.functions.get(t);return s?yt(e,s,n):""}async function yt(e,t,n){if(L(e,"user function call"),e.currentRecursionDepth++,e.currentRecursionDepth>e.maxRecursionDepth)throw e.currentRecursionDepth--,new P(`awk: recursion depth exceeded maximum (${e.maxRecursionDepth})`,"recursion",e.output);let i=Object.create(null);for(let l of t.params)i[l]=e.vars[l];let s=[];for(let l=0;l<t.params.length;l++){let u=t.params[l];if(l<n.length){let N=n[l];N.type==="variable"&&(e.arrayAliases.set(u,N.name),s.push(u));let A=await S(e,"user function argument evaluation",()=>f(e,N));e.vars[u]=A}else e.vars[u]=""}e.hasReturn=!1,e.returnValue=void 0;let a=be;a&&await S(e,"user function body execution",()=>a(e,t.body.statements));let o=e.returnValue??"";for(let l of t.params)i[l]!==void 0?e.vars[l]=i[l]:delete e.vars[l];for(let l of s)e.arrayAliases.delete(l);return e.hasReturn=!1,e.returnValue=void 0,e.currentRecursionDepth--,o}async function St(e,t){L(e,"assignment evaluation");let n=await S(e,"assignment value evaluation",()=>f(e,t.value)),i=t.target,s=t.operator,a;if(s==="=")a=n;else{let o;if(i.type==="field"){let N=Math.floor(g(await S(e,"assignment field index",()=>f(e,i.index))));o=J(e,N)}else if(i.type==="variable")o=Z(e,i.name);else{let N=m(await S(e,"assignment array key",()=>f(e,i.key)));o=Y(e,i.array,N)}let l=g(o),u=g(n);switch(s){case"+=":a=l+u;break;case"-=":a=l-u;break;case"*=":a=l*u;break;case"/=":a=u!==0?l/u:0;break;case"%=":a=u!==0?l%u:0;break;case"^=":a=l**u;break;default:a=n}}if(i.type==="field"){let o=Math.floor(g(await S(e,"assignment target field index",()=>f(e,i.index))));le(e,o,a)}else if(i.type==="variable")W(e,i.name,a);else{let o=m(await S(e,"assignment target array key",()=>f(e,i.key)));ue(e,i.array,o,a)}return a}async function ee(e,t,n,i){L(e,"inc/dec evaluation");let s;if(t.type==="field"){let a=Math.floor(g(await S(e,"inc/dec field index",()=>f(e,t.index))));s=g(J(e,a)),le(e,a,s+n)}else if(t.type==="variable")s=g(Z(e,t.name)),W(e,t.name,s+n);else{let a=m(await S(e,"inc/dec array key",()=>f(e,t.key)));s=g(Y(e,t.array,a)),ue(e,t.array,a,s+n)}return i?s+n:s}async function mt(e,t){return ee(e,t,1,!0)}async function wt(e,t){return ee(e,t,-1,!0)}async function Rt(e,t){return ee(e,t,1,!1)}async function gt(e,t){return ee(e,t,-1,!1)}async function At(e,t,n){L(e,"in-expression evaluation");let i;if(t.type==="tuple"){e.coverage?.hit("awk:expr:tuple");let s=[];for(let a of t.elements)s.push(m(await S(e,"tuple key element evaluation",()=>f(e,a))));i=s.join(e.SUBSEP)}else i=m(await S(e,"in-expression key evaluation",()=>f(e,t)));return Ie(e,n,i)?1:0}async function vt(e,t,n,i){if(L(e,"getline evaluation"),i)return It(e,t,i);if(n)return kt(e,t,n);if(!e.lines||e.lineIndex===void 0)return-1;let s=e.lineIndex+1;if(s>=e.lines.length)return 0;let a=e.lines[s];return t?W(e,t,a):$(e,a),e.NR++,e.lineIndex=s,1}async function It(e,t,n){let i=e.exec;if(!i)return-1;L(e,"getline command source");let s=m(await S(e,"getline command expression",()=>f(e,n))),a=`__cmd_${s}`,o=`__cmdi_${s}`,l,u;if(e.vars[a]===void 0)try{let C=await S(e,"getline command exec",()=>i(s));l=z(C.stdout).split(`
|
|
7
|
+
`),l.length>0&&l[l.length-1]===""&&l.pop(),e.vars[a]=JSON.stringify(l),e.vars[o]=-1,u=-1}catch(C){if(C instanceof x)throw C;return-1}else l=JSON.parse(e.vars[a]),u=e.vars[o];let N=u+1;if(N>=l.length)return 0;let A=l[N];return e.vars[o]=N,t?W(e,t,A):$(e,A),1}async function kt(e,t,n){let i=e.fs;if(!i||!e.cwd)return-1;L(e,"getline file source");let s=m(await S(e,"getline filename evaluation",()=>f(e,n)));if(s==="/dev/null")return 0;let a=i.resolvePath(e.cwd,s),o=`__fc_${a}`,l=`__fi_${a}`,u,N;if(e.vars[o]===void 0)try{u=(await S(e,"getline file read",()=>i.readFile(a))).split(`
|
|
8
|
+
`),u.length>0&&u[u.length-1]===""&&u.pop(),e.vars[o]=JSON.stringify(u),e.vars[l]=-1,N=-1}catch(O){if(O instanceof x)throw O;return-1}else u=JSON.parse(e.vars[o]),N=e.vars[l];let A=N+1;if(A>=u.length)return 0;let C=u[A];return e.vars[l]=A,t?W(e,t,C):$(e,C),1}async function Ct(e,t){if(L(e,"tuple evaluation"),t.length===0)return"";for(let n=0;n<t.length-1;n++)await S(e,"tuple intermediate element",()=>f(e,t[n]));return S(e,"tuple final element",()=>f(e,t[t.length-1]))}Oe(V);function ce(e){if(e.maxOutputSize>0&&e.output.length>e.maxOutputSize)throw new P(`awk: output size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output)}function T(e,t){D(e.requireDefenseContext,"awk",t)}function y(e,t,n){return _(e.requireDefenseContext,"awk",t,n)}async function V(e,t){T(e,"block execution");for(let n of t)if(await y(e,"statement execution",()=>B(e,n)),bt(e))break}function bt(e){return e.shouldExit||e.shouldNext||e.shouldNextFile||e.loopBreak||e.loopContinue||e.hasReturn}async function B(e,t){switch(T(e,"single statement execution"),e.coverage?.hit(`awk:stmt:${t.type}`),t.type){case"block":await y(e,"nested block statement",()=>V(e,t.statements));break;case"expr_stmt":await y(e,"expression statement",()=>f(e,t.expression));break;case"print":await y(e,"print statement",()=>Ot(e,t.args,t.output));break;case"printf":await y(e,"printf statement",()=>Lt(e,t.format,t.args,t.output));break;case"if":await y(e,"if statement",()=>Mt(e,t));break;case"while":await y(e,"while statement",()=>Pt(e,t));break;case"do_while":await y(e,"do-while statement",()=>Tt(e,t));break;case"for":await y(e,"for statement",()=>Ft(e,t));break;case"for_in":await y(e,"for-in statement",()=>Dt(e,t));break;case"break":e.loopBreak=!0;break;case"continue":e.loopContinue=!0;break;case"next":e.shouldNext=!0;break;case"nextfile":e.shouldNextFile=!0;break;case"exit":e.shouldExit=!0;{let n=t.code;e.exitCode=n?Math.floor(g(await y(e,"exit code expression",()=>f(e,n)))):0}break;case"return":e.hasReturn=!0;{let n=t.value;e.returnValue=n?await y(e,"return expression",()=>f(e,n)):""}break;case"delete":await y(e,"delete statement",()=>_t(e,t.target));break}}async function Ot(e,t,n){T(e,"print execution");let i=[];for(let a of t){let o=await y(e,"print argument evaluation",()=>f(e,a));typeof o=="number"?Number.isInteger(o)&&Math.abs(o)<Number.MAX_SAFE_INTEGER?i.push(String(o)):i.push(Q(e.OFMT,[o])):i.push(m(o))}let s=i.join(e.OFS)+e.ORS;n?await y(e,"print redirection write",()=>Le(e,n.redirect,n.file,s)):(e.output+=s,ce(e))}async function Lt(e,t,n,i){T(e,"printf execution");let s=m(await y(e,"printf format evaluation",()=>f(e,t))),a=[];for(let l of n)a.push(await y(e,"printf argument evaluation",()=>f(e,l)));let o=Q(s,a);i?await y(e,"printf redirection write",()=>Le(e,i.redirect,i.file,o)):(e.output+=o,ce(e))}async function Le(e,t,n,i){T(e,"file write execution");let s=e.fs;if(!s||!e.cwd){e.output+=i,ce(e);return}let a=m(await y(e,"redirection filename evaluation",()=>f(e,n))),o=s.resolvePath(e.cwd,a);t===">"?e.openedFiles.has(o)?await y(e,"redirection append write",()=>s.appendFile(o,i)):(await y(e,"redirection overwrite write",()=>s.writeFile(o,i)),e.openedFiles.add(o)):(e.openedFiles.has(o)||e.openedFiles.add(o),await y(e,"redirection append mode write",()=>s.appendFile(o,i)))}async function Mt(e,t){if(T(e,"if execution"),b(await y(e,"if condition evaluation",()=>f(e,t.condition))))await y(e,"if consequent execution",()=>B(e,t.consequent));else if(t.alternate){let n=t.alternate;await y(e,"if alternate execution",()=>B(e,n))}}async function Pt(e,t){T(e,"while execution");let n=0;for(;b(await y(e,"while condition evaluation",()=>f(e,t.condition)));){if(n++,n>e.maxIterations)throw new P(`awk: while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await y(e,"while body execution",()=>B(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function Tt(e,t){T(e,"do-while execution");let n=0;do{if(n++,n>e.maxIterations)throw new P(`awk: do-while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await y(e,"do-while body execution",()=>B(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}while(b(await y(e,"do-while condition evaluation",()=>f(e,t.condition))))}async function Ft(e,t){T(e,"for execution");let n=t.init,i=t.condition,s=t.update;n&&await y(e,"for init evaluation",()=>f(e,n));let a=0;for(;!i||b(await y(e,"for condition evaluation",()=>f(e,i)));){if(a++,a>e.maxIterations)throw new P(`awk: for loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await y(e,"for body execution",()=>B(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break;s&&await y(e,"for update evaluation",()=>f(e,s))}}async function Dt(e,t){T(e,"for-in execution");let n=e.arrays[t.array];if(n)for(let i of Object.keys(n)){if(e.vars[t.variable]=i,e.loopContinue=!1,await y(e,"for-in body execution",()=>B(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function _t(e,t){if(T(e,"delete execution"),t.type==="array_access"){let n=m(await y(e,"delete key evaluation",()=>f(e,t.key)));ke(e,t.array,n)}else t.type==="variable"&&Ce(e,t.name)}var q=class{ctx;program=null;rangeStates=[];constructor(t){this.ctx=t}assertDefenseContext(t){D(this.ctx.requireDefenseContext,"awk",t)}withDefenseContext(t,n){return _(this.ctx.requireDefenseContext,"awk",t,n)}execute(t){this.assertDefenseContext("program initialization"),this.program=t,this.ctx.output="";for(let n of t.functions)this.ctx.functions.set(n.name,n);this.rangeStates=t.rules.map(()=>!1)}async executeBegin(){if(this.assertDefenseContext("BEGIN execution entry"),!!this.program){for(let t of this.program.rules)if(t.pattern?.type==="begin"&&(await this.withDefenseContext("BEGIN block execution",()=>V(this.ctx,t.action.statements)),this.ctx.shouldExit))break}}async executeLine(t){if(this.assertDefenseContext("line execution entry"),!(!this.program||this.ctx.shouldExit)){$(this.ctx,t),this.ctx.NR++,this.ctx.FNR++,this.ctx.shouldNext=!1;for(let n=0;n<this.program.rules.length&&!(this.ctx.shouldExit||this.ctx.shouldNext||this.ctx.shouldNextFile);n++){let i=this.program.rules[n];i.pattern?.type==="begin"||i.pattern?.type==="end"||await this.withDefenseContext("rule match",()=>this.matchesRule(i,n))&&await this.withDefenseContext("rule block execution",()=>V(this.ctx,i.action.statements))}}}async executeEnd(){if(this.assertDefenseContext("END execution entry"),!!this.program&&!this.ctx.inEndBlock){this.ctx.inEndBlock=!0,this.ctx.shouldExit=!1;for(let t of this.program.rules)if(t.pattern?.type==="end"&&(await this.withDefenseContext("END block execution",()=>V(this.ctx,t.action.statements)),this.ctx.shouldExit))break;this.ctx.inEndBlock=!1}}getOutput(){return this.ctx.output}getExitCode(){return this.ctx.exitCode}getContext(){return this.ctx}async matchesRule(t,n){this.assertDefenseContext("rule matching");let i=t.pattern;if(!i)return!0;switch(i.type){case"begin":case"end":return!1;case"regex_pattern":return K(i.pattern,this.ctx.line);case"expr_pattern":return b(await this.withDefenseContext("expression pattern evaluation",()=>f(this.ctx,i.expression)));case"range":{let s=await this.withDefenseContext("range start pattern",()=>this.matchPattern(i.start)),a=await this.withDefenseContext("range end pattern",()=>this.matchPattern(i.end));return this.rangeStates[n]?(a&&(this.rangeStates[n]=!1),!0):s?(this.rangeStates[n]=!0,a&&(this.rangeStates[n]=!1),!0):!1}default:return!1}}async matchPattern(t){switch(this.assertDefenseContext("pattern matching"),t.type){case"regex_pattern":return K(t.pattern,this.ctx.line);case"expr_pattern":return b(await this.withDefenseContext("nested expression pattern",()=>f(this.ctx,t.expression)));default:return!1}}};var r;(function(e){e.NUMBER="NUMBER",e.STRING="STRING",e.REGEX="REGEX",e.IDENT="IDENT",e.BEGIN="BEGIN",e.END="END",e.IF="IF",e.ELSE="ELSE",e.WHILE="WHILE",e.DO="DO",e.FOR="FOR",e.IN="IN",e.BREAK="BREAK",e.CONTINUE="CONTINUE",e.NEXT="NEXT",e.NEXTFILE="NEXTFILE",e.EXIT="EXIT",e.RETURN="RETURN",e.DELETE="DELETE",e.FUNCTION="FUNCTION",e.PRINT="PRINT",e.PRINTF="PRINTF",e.GETLINE="GETLINE",e.PLUS="PLUS",e.MINUS="MINUS",e.STAR="STAR",e.SLASH="SLASH",e.PERCENT="PERCENT",e.CARET="CARET",e.EQ="EQ",e.NE="NE",e.LT="LT",e.GT="GT",e.LE="LE",e.GE="GE",e.MATCH="MATCH",e.NOT_MATCH="NOT_MATCH",e.AND="AND",e.OR="OR",e.NOT="NOT",e.ASSIGN="ASSIGN",e.PLUS_ASSIGN="PLUS_ASSIGN",e.MINUS_ASSIGN="MINUS_ASSIGN",e.STAR_ASSIGN="STAR_ASSIGN",e.SLASH_ASSIGN="SLASH_ASSIGN",e.PERCENT_ASSIGN="PERCENT_ASSIGN",e.CARET_ASSIGN="CARET_ASSIGN",e.INCREMENT="INCREMENT",e.DECREMENT="DECREMENT",e.QUESTION="QUESTION",e.COLON="COLON",e.COMMA="COMMA",e.SEMICOLON="SEMICOLON",e.NEWLINE="NEWLINE",e.LPAREN="LPAREN",e.RPAREN="RPAREN",e.LBRACE="LBRACE",e.RBRACE="RBRACE",e.LBRACKET="LBRACKET",e.RBRACKET="RBRACKET",e.DOLLAR="DOLLAR",e.APPEND="APPEND",e.PIPE="PIPE",e.EOF="EOF"})(r||(r={}));var Gt=new Map([["BEGIN",r.BEGIN],["END",r.END],["if",r.IF],["else",r.ELSE],["while",r.WHILE],["do",r.DO],["for",r.FOR],["in",r.IN],["break",r.BREAK],["continue",r.CONTINUE],["next",r.NEXT],["nextfile",r.NEXTFILE],["exit",r.EXIT],["return",r.RETURN],["delete",r.DELETE],["function",r.FUNCTION],["print",r.PRINT],["printf",r.PRINTF],["getline",r.GETLINE]]);function xt(e){return e.replace(/\[\[:space:\]\]/g,"[ \\t\\n\\r\\f\\v]").replace(/\[\[:blank:\]\]/g,"[ \\t]").replace(/\[\[:alpha:\]\]/g,"[a-zA-Z]").replace(/\[\[:digit:\]\]/g,"[0-9]").replace(/\[\[:alnum:\]\]/g,"[a-zA-Z0-9]").replace(/\[\[:upper:\]\]/g,"[A-Z]").replace(/\[\[:lower:\]\]/g,"[a-z]").replace(/\[\[:punct:\]\]/g,"[!\"#$%&'()*+,\\-./:;<=>?@\\[\\]\\\\^_`{|}~]").replace(/\[\[:xdigit:\]\]/g,"[0-9A-Fa-f]").replace(/\[\[:graph:\]\]/g,"[!-~]").replace(/\[\[:print:\]\]/g,"[ -~]").replace(/\[\[:cntrl:\]\]/g,"[\\x00-\\x1f\\x7f]")}var Ut=new Set([r.COMMA,r.LBRACE,r.AND,r.OR,r.QUESTION,r.COLON,r.DO,r.ELSE,r.IF,r.WHILE]),te=class{input;pos=0;line=1;column=1;lastTokenType=null;constructor(t){this.input=t}tokenize(){let t=[];for(;this.pos<this.input.length;){let n=this.nextToken();n&&(t.push(n),this.lastTokenType=n.type)}return t.push(this.makeToken(r.EOF,"")),t}makeToken(t,n){return{type:t,value:n,line:this.line,column:this.column}}peek(t=0){return this.input[this.pos+t]||""}advance(){let t=this.input[this.pos++]||"";return t===`
|
|
9
|
+
`?(this.line++,this.column=1):this.column++,t}skipWhitespace(){for(;this.pos<this.input.length;){let t=this.peek();if(t===" "||t===" "||t==="\r")this.advance();else if(t==="\\")if(this.peek(1)===`
|
|
10
|
+
`)this.advance(),this.advance();else break;else if(t==="#")for(;this.pos<this.input.length&&this.peek()!==`
|
|
11
|
+
`;)this.advance();else break}}nextToken(){if(this.skipWhitespace(),this.pos>=this.input.length)return null;let t=this.line,n=this.column,i=this.peek();return i===`
|
|
12
|
+
`?(this.advance(),this.lastTokenType!==null&&Ut.has(this.lastTokenType)?this.nextToken():{type:r.NEWLINE,value:`
|
|
13
|
+
`,line:t,column:n}):i==='"'?this.readString():i==="/"&&this.canBeRegex()?this.readRegex():this.isDigit(i)||i==="."&&this.isDigit(this.peek(1))?this.readNumber():this.isAlpha(i)||i==="_"?this.readIdentifier():this.readOperator()}canBeRegex(){return new Set([null,r.NEWLINE,r.SEMICOLON,r.LBRACE,r.RBRACE,r.LPAREN,r.LBRACKET,r.COMMA,r.ASSIGN,r.PLUS_ASSIGN,r.MINUS_ASSIGN,r.STAR_ASSIGN,r.SLASH_ASSIGN,r.PERCENT_ASSIGN,r.CARET_ASSIGN,r.AND,r.OR,r.NOT,r.MATCH,r.NOT_MATCH,r.QUESTION,r.COLON,r.LT,r.GT,r.LE,r.GE,r.EQ,r.NE,r.PLUS,r.MINUS,r.STAR,r.PERCENT,r.CARET,r.PRINT,r.PRINTF,r.IF,r.WHILE,r.DO,r.FOR,r.RETURN]).has(this.lastTokenType)}readString(){let t=this.line,n=this.column;this.advance();let i="";for(;this.pos<this.input.length&&this.peek()!=='"';)if(this.peek()==="\\"){this.advance();let s=this.advance();switch(s){case"n":i+=`
|
|
14
|
+
`;break;case"t":i+=" ";break;case"r":i+="\r";break;case"f":i+="\f";break;case"b":i+="\b";break;case"v":i+="\v";break;case"a":i+="\x07";break;case"\\":i+="\\";break;case'"':i+='"';break;case"/":i+="/";break;case"x":{let a="";for(;a.length<2&&/[0-9a-fA-F]/.test(this.peek());)a+=this.advance();a.length>0?i+=String.fromCharCode(parseInt(a,16)):i+="x";break}default:if(/[0-7]/.test(s)){let a=s;for(;a.length<3&&/[0-7]/.test(this.peek());)a+=this.advance();i+=String.fromCharCode(parseInt(a,8))}else i+=s}}else i+=this.advance();return this.peek()==='"'&&this.advance(),{type:r.STRING,value:i,line:t,column:n}}readRegex(){let t=this.line,n=this.column;this.advance();let i="";for(;this.pos<this.input.length&&this.peek()!=="/";)if(this.peek()==="\\")i+=this.advance(),this.pos<this.input.length&&(i+=this.advance());else{if(this.peek()===`
|
|
15
|
+
`)break;i+=this.advance()}return this.peek()==="/"&&this.advance(),i=xt(i),{type:r.REGEX,value:i,line:t,column:n}}readNumber(){let t=this.line,n=this.column,i="";for(;this.isDigit(this.peek());)i+=this.advance();if(this.peek()==="."&&this.isDigit(this.peek(1)))for(i+=this.advance();this.isDigit(this.peek());)i+=this.advance();if(this.peek()==="e"||this.peek()==="E")for(i+=this.advance(),(this.peek()==="+"||this.peek()==="-")&&(i+=this.advance());this.isDigit(this.peek());)i+=this.advance();return{type:r.NUMBER,value:parseFloat(i),line:t,column:n}}readIdentifier(){let t=this.line,n=this.column,i="";for(;this.isAlphaNumeric(this.peek())||this.peek()==="_";)i+=this.advance();let s=Gt.get(i);return s!==void 0?{type:s,value:i,line:t,column:n}:{type:r.IDENT,value:i,line:t,column:n}}readOperator(){let t=this.line,n=this.column,i=this.advance(),s=this.peek();switch(i){case"+":return s==="+"?(this.advance(),{type:r.INCREMENT,value:"++",line:t,column:n}):s==="="?(this.advance(),{type:r.PLUS_ASSIGN,value:"+=",line:t,column:n}):{type:r.PLUS,value:"+",line:t,column:n};case"-":return s==="-"?(this.advance(),{type:r.DECREMENT,value:"--",line:t,column:n}):s==="="?(this.advance(),{type:r.MINUS_ASSIGN,value:"-=",line:t,column:n}):{type:r.MINUS,value:"-",line:t,column:n};case"*":return s==="*"?(this.advance(),{type:r.CARET,value:"**",line:t,column:n}):s==="="?(this.advance(),{type:r.STAR_ASSIGN,value:"*=",line:t,column:n}):{type:r.STAR,value:"*",line:t,column:n};case"/":return s==="="?(this.advance(),{type:r.SLASH_ASSIGN,value:"/=",line:t,column:n}):{type:r.SLASH,value:"/",line:t,column:n};case"%":return s==="="?(this.advance(),{type:r.PERCENT_ASSIGN,value:"%=",line:t,column:n}):{type:r.PERCENT,value:"%",line:t,column:n};case"^":return s==="="?(this.advance(),{type:r.CARET_ASSIGN,value:"^=",line:t,column:n}):{type:r.CARET,value:"^",line:t,column:n};case"=":return s==="="?(this.advance(),{type:r.EQ,value:"==",line:t,column:n}):{type:r.ASSIGN,value:"=",line:t,column:n};case"!":return s==="="?(this.advance(),{type:r.NE,value:"!=",line:t,column:n}):s==="~"?(this.advance(),{type:r.NOT_MATCH,value:"!~",line:t,column:n}):{type:r.NOT,value:"!",line:t,column:n};case"<":return s==="="?(this.advance(),{type:r.LE,value:"<=",line:t,column:n}):{type:r.LT,value:"<",line:t,column:n};case">":return s==="="?(this.advance(),{type:r.GE,value:">=",line:t,column:n}):s===">"?(this.advance(),{type:r.APPEND,value:">>",line:t,column:n}):{type:r.GT,value:">",line:t,column:n};case"&":return s==="&"?(this.advance(),{type:r.AND,value:"&&",line:t,column:n}):{type:r.IDENT,value:"&",line:t,column:n};case"|":return s==="|"?(this.advance(),{type:r.OR,value:"||",line:t,column:n}):{type:r.PIPE,value:"|",line:t,column:n};case"~":return{type:r.MATCH,value:"~",line:t,column:n};case"?":return{type:r.QUESTION,value:"?",line:t,column:n};case":":return{type:r.COLON,value:":",line:t,column:n};case",":return{type:r.COMMA,value:",",line:t,column:n};case";":return{type:r.SEMICOLON,value:";",line:t,column:n};case"(":return{type:r.LPAREN,value:"(",line:t,column:n};case")":return{type:r.RPAREN,value:")",line:t,column:n};case"{":return{type:r.LBRACE,value:"{",line:t,column:n};case"}":return{type:r.RBRACE,value:"}",line:t,column:n};case"[":return{type:r.LBRACKET,value:"[",line:t,column:n};case"]":return{type:r.RBRACKET,value:"]",line:t,column:n};case"$":return{type:r.DOLLAR,value:"$",line:t,column:n};default:return{type:r.IDENT,value:i,line:t,column:n}}}isDigit(t){return t>="0"&&t<="9"}isAlpha(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"}isAlphaNumeric(t){return this.isDigit(t)||this.isAlpha(t)}};var p={LPAREN:"LPAREN",RPAREN:"RPAREN",QUESTION:"QUESTION",NEWLINE:"NEWLINE",SEMICOLON:"SEMICOLON",RBRACE:"RBRACE",COMMA:"COMMA",PIPE:"PIPE",GT:"GT",APPEND:"APPEND",AND:"AND",OR:"OR",ASSIGN:"ASSIGN",PLUS_ASSIGN:"PLUS_ASSIGN",MINUS_ASSIGN:"MINUS_ASSIGN",STAR_ASSIGN:"STAR_ASSIGN",SLASH_ASSIGN:"SLASH_ASSIGN",PERCENT_ASSIGN:"PERCENT_ASSIGN",CARET_ASSIGN:"CARET_ASSIGN",RBRACKET:"RBRACKET",COLON:"COLON",IN:"IN",PRINT:"PRINT",PRINTF:"PRINTF",IDENT:"IDENT",LT:"LT",LE:"LE",GE:"GE",EQ:"EQ",NE:"NE",MATCH:"MATCH",NOT_MATCH:"NOT_MATCH",NUMBER:"NUMBER",STRING:"STRING",DOLLAR:"DOLLAR",NOT:"NOT",MINUS:"MINUS",PLUS:"PLUS",INCREMENT:"INCREMENT",DECREMENT:"DECREMENT"};function De(e){e.expect(p.PRINT);let t=[];if(e.check(p.NEWLINE)||e.check(p.SEMICOLON)||e.check(p.RBRACE)||e.check(p.PIPE)||e.check(p.GT)||e.check(p.APPEND))t.push({type:"field",index:{type:"number",value:0}});else for(t.push(ne(e));e.check(p.COMMA);)e.advance(),t.push(ne(e));let n;return e.check(p.GT)?(e.advance(),n={redirect:">",file:e.parsePrimary()}):e.check(p.APPEND)&&(e.advance(),n={redirect:">>",file:e.parsePrimary()}),{type:"print",args:t,output:n}}function ne(e){return Bt(e)?he(e,!0):he(e,!1)}function he(e,t){let n=t?e.parseTernary():Ht(e);if(e.match(p.ASSIGN,p.PLUS_ASSIGN,p.MINUS_ASSIGN,p.STAR_ASSIGN,p.SLASH_ASSIGN,p.PERCENT_ASSIGN,p.CARET_ASSIGN)){let i=e.advance(),s=he(e,t);if(n.type!=="variable"&&n.type!=="field"&&n.type!=="array_access")throw new Error("Invalid assignment target");return{type:"assignment",operator:new Map([["=","="],["+=","+="],["-=","-="],["*=","*="],["/=","/="],["%=","%="],["^=","^="]]).get(i.value)??"=",target:n,value:s}}return n}function Bt(e){let t=0,n=e.pos;for(;n<e.tokens.length;){let i=e.tokens[n];if(i.type===p.LPAREN&&t++,i.type===p.RPAREN&&t--,i.type===p.QUESTION&&t===0)return!0;if(i.type===p.NEWLINE||i.type===p.SEMICOLON||i.type===p.RBRACE||i.type===p.COMMA||i.type===p.PIPE)return!1;n++}return!1}function Ht(e){let t=Me(e);for(;e.check(p.OR);){e.advance();let n=Me(e);t={type:"binary",operator:"||",left:t,right:n}}return t}function Me(e){let t=Pe(e);for(;e.check(p.AND);){e.advance();let n=Pe(e);t={type:"binary",operator:"&&",left:t,right:n}}return t}function Pe(e){let t=$t(e);if(e.check(p.IN)){e.advance();let n=String(e.expect(p.IDENT).value);return{type:"in",key:t,array:n}}return t}function $t(e){let t=Te(e);for(;Wt(e)&&!Vt(e);){let n=Te(e);t={type:"binary",operator:" ",left:t,right:n}}return t}function Te(e){let t=Fe(e);for(;e.match(p.MATCH,p.NOT_MATCH);){let n=e.advance().type===p.MATCH?"~":"!~",i=Fe(e);t={type:"binary",operator:n,left:t,right:i}}return t}function Fe(e){let t=e.parseAddSub();for(;e.match(p.LT,p.LE,p.GE,p.EQ,p.NE);){let n=e.advance(),i=e.parseAddSub();t={type:"binary",operator:new Map([["<","<"],["<=","<="],[">=",">="],["==","=="],["!=","!="]]).get(n.value)??"==",left:t,right:i}}return t}function Wt(e){return e.match(p.NUMBER,p.STRING,p.IDENT,p.DOLLAR,p.LPAREN,p.NOT,p.MINUS,p.PLUS,p.INCREMENT,p.DECREMENT)}function Vt(e){return e.match(p.AND,p.OR,p.QUESTION,p.ASSIGN,p.PLUS_ASSIGN,p.MINUS_ASSIGN,p.STAR_ASSIGN,p.SLASH_ASSIGN,p.PERCENT_ASSIGN,p.CARET_ASSIGN,p.COMMA,p.SEMICOLON,p.NEWLINE,p.RBRACE,p.RPAREN,p.RBRACKET,p.COLON,p.PIPE,p.APPEND,p.GT,p.IN)}function _e(e){e.expect(p.PRINTF);let t=e.check(p.LPAREN);t&&(e.advance(),e.skipNewlines());let n=t?e.parseExpression():ne(e),i=[];for(;e.check(p.COMMA);)e.advance(),t&&e.skipNewlines(),i.push(t?e.parseExpression():ne(e));t&&(e.skipNewlines(),e.expect(p.RPAREN));let s;return e.check(p.GT)?(e.advance(),s={redirect:">",file:e.parsePrimary()}):e.check(p.APPEND)&&(e.advance(),s={redirect:">>",file:e.parsePrimary()}),{type:"printf",format:n,args:i,output:s}}var re=class{tokens=[];pos=0;parse(t){let n=new te(t);return this.tokens=n.tokenize(),this.pos=0,this.parseProgram()}setPos(t){this.pos=t}current(){return this.tokens[this.pos]||{type:r.EOF,value:"",line:0,column:0}}advance(){let t=this.current();return this.pos<this.tokens.length&&this.pos++,t}match(...t){return t.includes(this.current().type)}check(t){return this.current().type===t}expect(t,n){if(!this.check(t)){let i=this.current();throw new Error(n||`Expected ${t}, got ${i.type} at line ${i.line}:${i.column}`)}return this.advance()}skipNewlines(){for(;this.check(r.NEWLINE);)this.advance()}skipTerminators(){for(;this.check(r.NEWLINE)||this.check(r.SEMICOLON);)this.advance()}parseProgram(){let t=[],n=[];for(this.skipNewlines();!this.check(r.EOF)&&(this.skipNewlines(),!this.check(r.EOF));)this.check(r.FUNCTION)?t.push(this.parseFunction()):n.push(this.parseRule()),this.skipTerminators();return{functions:t,rules:n}}parseFunction(){this.expect(r.FUNCTION);let t=this.expect(r.IDENT).value;this.expect(r.LPAREN);let n=[];if(!this.check(r.RPAREN))for(n.push(this.expect(r.IDENT).value);this.check(r.COMMA);)this.advance(),n.push(this.expect(r.IDENT).value);this.expect(r.RPAREN),this.skipNewlines();let i=this.parseBlock();return{name:t,params:n,body:i}}parseRule(){let t;if(this.check(r.BEGIN))this.advance(),t={type:"begin"};else if(this.check(r.END))this.advance(),t={type:"end"};else if(this.check(r.LBRACE))t=void 0;else if(this.check(r.REGEX)){let i=this.advance();if(this.check(r.AND)||this.check(r.OR)){let s={type:"binary",operator:"~",left:{type:"field",index:{type:"number",value:0}},right:{type:"regex",pattern:i.value}};t={type:"expr_pattern",expression:this.parseLogicalOrRest(s)}}else{let s={type:"regex_pattern",pattern:i.value};if(this.check(r.COMMA)){this.advance();let a;this.check(r.REGEX)?a={type:"regex_pattern",pattern:this.advance().value}:a={type:"expr_pattern",expression:this.parseExpression()},t={type:"range",start:s,end:a}}else t=s}}else{let s={type:"expr_pattern",expression:this.parseExpression()};if(this.check(r.COMMA)){this.advance();let a;this.check(r.REGEX)?a={type:"regex_pattern",pattern:this.advance().value}:a={type:"expr_pattern",expression:this.parseExpression()},t={type:"range",start:s,end:a}}else t=s}this.skipNewlines();let n;return this.check(r.LBRACE)?n=this.parseBlock():n={type:"block",statements:[{type:"print",args:[{type:"field",index:{type:"number",value:0}}]}]},{pattern:t,action:n}}parseBlock(){this.expect(r.LBRACE),this.skipNewlines();let t=[];for(;!this.check(r.RBRACE)&&!this.check(r.EOF);)t.push(this.parseStatement()),this.skipTerminators();return this.expect(r.RBRACE),{type:"block",statements:t}}parseStatement(){if(this.check(r.SEMICOLON)||this.check(r.NEWLINE))return this.advance(),{type:"block",statements:[]};if(this.check(r.LBRACE))return this.parseBlock();if(this.check(r.IF))return this.parseIf();if(this.check(r.WHILE))return this.parseWhile();if(this.check(r.DO))return this.parseDoWhile();if(this.check(r.FOR))return this.parseFor();if(this.check(r.BREAK))return this.advance(),{type:"break"};if(this.check(r.CONTINUE))return this.advance(),{type:"continue"};if(this.check(r.NEXT))return this.advance(),{type:"next"};if(this.check(r.NEXTFILE))return this.advance(),{type:"nextfile"};if(this.check(r.EXIT)){this.advance();let n;return!this.check(r.NEWLINE)&&!this.check(r.SEMICOLON)&&!this.check(r.RBRACE)&&!this.check(r.EOF)&&(n=this.parseExpression()),{type:"exit",code:n}}if(this.check(r.RETURN)){this.advance();let n;return!this.check(r.NEWLINE)&&!this.check(r.SEMICOLON)&&!this.check(r.RBRACE)&&!this.check(r.EOF)&&(n=this.parseExpression()),{type:"return",value:n}}if(this.check(r.DELETE)){this.advance();let n=this.parsePrimary();if(n.type!=="array_access"&&n.type!=="variable")throw new Error("delete requires array element or array");return{type:"delete",target:n}}return this.check(r.PRINT)?De(this):this.check(r.PRINTF)?_e(this):{type:"expr_stmt",expression:this.parseExpression()}}parseIf(){this.expect(r.IF),this.expect(r.LPAREN);let t=this.parseExpression();this.expect(r.RPAREN),this.skipNewlines();let n=this.parseStatement();this.skipTerminators();let i;return this.check(r.ELSE)&&(this.advance(),this.skipNewlines(),i=this.parseStatement()),{type:"if",condition:t,consequent:n,alternate:i}}parseWhile(){this.expect(r.WHILE),this.expect(r.LPAREN);let t=this.parseExpression();this.expect(r.RPAREN),this.skipNewlines();let n=this.parseStatement();return{type:"while",condition:t,body:n}}parseDoWhile(){this.expect(r.DO),this.skipNewlines();let t=this.parseStatement();this.skipNewlines(),this.expect(r.WHILE),this.expect(r.LPAREN);let n=this.parseExpression();return this.expect(r.RPAREN),{type:"do_while",body:t,condition:n}}parseFor(){if(this.expect(r.FOR),this.expect(r.LPAREN),this.check(r.IDENT)){let a=this.advance();if(this.check(r.IN)){this.advance();let o=this.expect(r.IDENT).value;this.expect(r.RPAREN),this.skipNewlines();let l=this.parseStatement();return{type:"for_in",variable:a.value,array:o,body:l}}this.pos--}let t;this.check(r.SEMICOLON)||(t=this.parseExpression()),this.expect(r.SEMICOLON);let n;this.check(r.SEMICOLON)||(n=this.parseExpression()),this.expect(r.SEMICOLON);let i;this.check(r.RPAREN)||(i=this.parseExpression()),this.expect(r.RPAREN),this.skipNewlines();let s=this.parseStatement();return{type:"for",init:t,condition:n,update:i,body:s}}parseExpression(){return this.parseAssignment()}parseAssignment(){let t=this.parseTernary();if(this.match(r.ASSIGN,r.PLUS_ASSIGN,r.MINUS_ASSIGN,r.STAR_ASSIGN,r.SLASH_ASSIGN,r.PERCENT_ASSIGN,r.CARET_ASSIGN)){let n=this.advance(),i=this.parseAssignment();if(t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid assignment target");let s=new Set(["=","+=","-=","*=","/=","%=","^="]),a=n.value;if(!s.has(a))throw new Error(`Unknown assignment operator: ${a}`);return{type:"assignment",operator:a,target:t,value:i}}return t}parseTernary(){let t=this.parsePipeGetline();if(this.check(r.QUESTION)){this.advance();let n=this.parseExpression();this.expect(r.COLON);let i=this.parseExpression();t={type:"ternary",condition:t,consequent:n,alternate:i}}return t}parsePipeGetline(){let t=this.parseOr();if(this.check(r.PIPE)){if(this.advance(),!this.check(r.GETLINE))throw new Error("Expected 'getline' after '|' in expression context");this.advance();let n;return this.check(r.IDENT)&&(n=this.advance().value),{type:"getline",command:t,variable:n}}return t}parseOr(){let t=this.parseAnd();for(;this.check(r.OR);){this.advance();let n=this.parseAnd();t={type:"binary",operator:"||",left:t,right:n}}return t}parseLogicalOrRest(t){for(t=this.parseLogicalAndRest(t);this.check(r.OR);){this.advance();let n=this.parseAnd();t={type:"binary",operator:"||",left:t,right:n}}return t}parseLogicalAndRest(t){for(;this.check(r.AND);){this.advance();let n=this.parseIn();t={type:"binary",operator:"&&",left:t,right:n}}return t}parseAnd(){let t=this.parseIn();for(;this.check(r.AND);){this.advance();let n=this.parseIn();t={type:"binary",operator:"&&",left:t,right:n}}return t}parseIn(){let t=this.parseConcatenation();if(this.check(r.IN)){this.advance();let n=this.expect(r.IDENT).value;return{type:"in",key:t,array:n}}return t}parseConcatenation(){let t=this.parseMatch();for(;this.canStartExpression()&&!this.isConcatTerminator();){let n=this.parseMatch();t={type:"binary",operator:" ",left:t,right:n}}return t}parseMatch(){let t=this.parseComparison();for(;this.match(r.MATCH,r.NOT_MATCH);){let n=this.advance().type===r.MATCH?"~":"!~",i=this.parseComparison();t={type:"binary",operator:n,left:t,right:i}}return t}parseComparison(){let t=this.parseAddSub();for(;this.match(r.LT,r.LE,r.GT,r.GE,r.EQ,r.NE);){let n=this.advance(),i=this.parseAddSub();t={type:"binary",operator:new Map([["<","<"],["<=","<="],[">",">"],[">=",">="],["==","=="],["!=","!="]]).get(n.value)??"==",left:t,right:i}}return t}canStartExpression(){return this.match(r.NUMBER,r.STRING,r.IDENT,r.DOLLAR,r.LPAREN,r.NOT,r.MINUS,r.PLUS,r.INCREMENT,r.DECREMENT)}isConcatTerminator(){return this.match(r.AND,r.OR,r.QUESTION,r.ASSIGN,r.PLUS_ASSIGN,r.MINUS_ASSIGN,r.STAR_ASSIGN,r.SLASH_ASSIGN,r.PERCENT_ASSIGN,r.CARET_ASSIGN,r.COMMA,r.SEMICOLON,r.NEWLINE,r.RBRACE,r.RPAREN,r.RBRACKET,r.COLON,r.PIPE,r.APPEND,r.IN)}parseAddSub(){let t=this.parseMulDiv();for(;this.match(r.PLUS,r.MINUS);){let n=this.advance().value,i=this.parseMulDiv();t={type:"binary",operator:n,left:t,right:i}}return t}parseMulDiv(){let t=this.parseUnary();for(;this.match(r.STAR,r.SLASH,r.PERCENT);){let n=this.advance(),i=this.parseUnary();t={type:"binary",operator:new Map([["*","*"],["/","/"],["%","%"]]).get(n.value)??"*",left:t,right:i}}return t}parseUnary(){if(this.check(r.INCREMENT)){this.advance();let t=this.parseUnary();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"+",operand:{type:"unary",operator:"+",operand:t}}:{type:"pre_increment",operand:t}}if(this.check(r.DECREMENT)){this.advance();let t=this.parseUnary();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"-",operand:{type:"unary",operator:"-",operand:t}}:{type:"pre_decrement",operand:t}}if(this.match(r.NOT,r.MINUS,r.PLUS)){let t=this.advance().value,n=this.parseUnary();return{type:"unary",operator:t,operand:n}}return this.parsePower()}parsePower(){let t=this.parsePostfix();if(this.check(r.CARET)){this.advance();let n=this.parsePower();t={type:"binary",operator:"^",left:t,right:n}}return t}parsePostfix(){let t=this.parsePrimary();if(this.check(r.INCREMENT)){if(this.advance(),t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid increment operand");return{type:"post_increment",operand:t}}if(this.check(r.DECREMENT)){if(this.advance(),t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid decrement operand");return{type:"post_decrement",operand:t}}return t}parseFieldIndex(){if(this.check(r.INCREMENT)){this.advance();let t=this.parseFieldIndex();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"+",operand:{type:"unary",operator:"+",operand:t}}:{type:"pre_increment",operand:t}}if(this.check(r.DECREMENT)){this.advance();let t=this.parseFieldIndex();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"-",operand:{type:"unary",operator:"-",operand:t}}:{type:"pre_decrement",operand:t}}if(this.match(r.NOT,r.MINUS,r.PLUS)){let t=this.advance().value,n=this.parseFieldIndex();return{type:"unary",operator:t,operand:n}}return this.parseFieldIndexPower()}parseFieldIndexPower(){let t=this.parseFieldIndexPrimary();if(this.check(r.CARET)){this.advance();let n=this.parseFieldIndexPower();t={type:"binary",operator:"^",left:t,right:n}}return t}parseFieldIndexPrimary(){if(this.check(r.NUMBER))return{type:"number",value:this.advance().value};if(this.check(r.STRING))return{type:"string",value:this.advance().value};if(this.check(r.DOLLAR))return this.advance(),{type:"field",index:this.parseFieldIndex()};if(this.check(r.LPAREN)){this.advance();let t=this.parseExpression();return this.expect(r.RPAREN),t}if(this.check(r.IDENT)){let t=this.advance().value;if(this.check(r.LPAREN)){this.advance();let n=[];if(!this.check(r.RPAREN))for(n.push(this.parseExpression());this.check(r.COMMA);)this.advance(),n.push(this.parseExpression());return this.expect(r.RPAREN),{type:"call",name:t,args:n}}if(this.check(r.LBRACKET)){this.advance();let n=this.parseExpression();if(this.check(r.COMMA)){let i=[n];for(;this.check(r.COMMA);)this.advance(),i.push(this.parseExpression());this.expect(r.RBRACKET);let s=i.reduce((a,o)=>({type:"binary",operator:" ",left:{type:"binary",operator:" ",left:a,right:{type:"variable",name:"SUBSEP"}},right:o}));return{type:"array_access",array:t,key:s}}return this.expect(r.RBRACKET),{type:"array_access",array:t,key:n}}return{type:"variable",name:t}}throw new Error(`Unexpected token in field index: ${this.current().type} at line ${this.current().line}:${this.current().column}`)}parsePrimary(){if(this.check(r.NUMBER))return{type:"number",value:this.advance().value};if(this.check(r.STRING))return{type:"string",value:this.advance().value};if(this.check(r.REGEX))return{type:"regex",pattern:this.advance().value};if(this.check(r.DOLLAR))return this.advance(),{type:"field",index:this.parseFieldIndex()};if(this.check(r.LPAREN)){this.advance();let t=this.parseExpression();if(this.check(r.COMMA)){let n=[t];for(;this.check(r.COMMA);)this.advance(),n.push(this.parseExpression());return this.expect(r.RPAREN),{type:"tuple",elements:n}}return this.expect(r.RPAREN),t}if(this.check(r.GETLINE)){this.advance();let t,n;return this.check(r.IDENT)&&(t=this.advance().value),this.check(r.LT)&&(this.advance(),n=this.parsePrimary()),{type:"getline",variable:t,file:n}}if(this.check(r.IDENT)){let t=this.advance().value;if(this.check(r.LPAREN)){this.advance();let n=[];if(this.skipNewlines(),!this.check(r.RPAREN))for(n.push(this.parseExpression());this.check(r.COMMA);)this.advance(),this.skipNewlines(),n.push(this.parseExpression());return this.skipNewlines(),this.expect(r.RPAREN),{type:"call",name:t,args:n}}if(this.check(r.LBRACKET)){this.advance();let n=[this.parseExpression()];for(;this.check(r.COMMA);)this.advance(),n.push(this.parseExpression());this.expect(r.RBRACKET);let i;if(n.length===1)i=n[0];else{i=n[0];for(let s=1;s<n.length;s++)i={type:"binary",operator:" ",left:{type:"binary",operator:" ",left:i,right:{type:"variable",name:"SUBSEP"}},right:n[s]}}return{type:"array_access",array:t,key:i}}return{type:"variable",name:t}}throw new Error(`Unexpected token: ${this.current().type} at line ${this.current().line}:${this.current().column}`)}};var Kt={name:"awk",summary:"pattern scanning and text processing language",usage:"awk [OPTIONS] 'PROGRAM' [FILE...]",options:["-F FS use FS as field separator","-v VAR=VAL assign VAL to variable VAR"," --help display this help and exit"]},zn={name:"awk",async execute(e,t){D(t.requireDefenseContext,"awk","execution entry");let n=(h,c)=>_(t.requireDefenseContext,"awk",h,c);if(de(e))return fe(Kt);let i=new H(/\s+/),s=" ",a=Object.create(null),o=0;for(let h=0;h<e.length;h++){let c=e[h];if(c==="-F"&&h+1<e.length)s=pe(e[++h]),i=Ge(s),o=h+1;else if(c.startsWith("-F"))s=pe(c.slice(2)),i=Ge(s),o=h+1;else if(c==="-v"&&h+1<e.length){let E=e[++h],F=E.indexOf("=");if(F>0){let G=E.slice(0,F),Ue=pe(E.slice(F+1));a[G]=Ue}o=h+1}else{if(c.startsWith("--"))return ie("awk",c);if(c.startsWith("-")&&c.length>1){let E=c[1];if(E!=="F"&&E!=="v")return ie("awk",`-${E}`);o=h+1}else if(!c.startsWith("-")){o=h;break}}}if(o>=e.length)return{stdout:"",stderr:`awk: missing program
|
|
16
|
+
`,exitCode:1};let l=e[o],u=e.slice(o+1),N=new re,A;try{A=N.parse(l)}catch(h){return{stdout:"",stderr:`awk: ${h instanceof Error?h.message:String(h)}
|
|
17
|
+
`,exitCode:1}}let C={readFile:t.fs.readFile.bind(t.fs),writeFile:t.fs.writeFile.bind(t.fs),appendFile:async(h,c)=>{try{let E=await n("appendFile read",()=>t.fs.readFile(h));await n("appendFile write",()=>t.fs.writeFile(h,E+c))}catch(E){if(E instanceof x)throw E;await n("appendFile create",()=>t.fs.writeFile(h,c))}},resolvePath:t.fs.resolvePath.bind(t.fs)},O=t.exec,I=se({fieldSep:i,maxIterations:t.limits?.maxAwkIterations,maxOutputSize:t.limits?.maxStringLength,fs:C,cwd:t.cwd,exec:O?h=>n("command pipe exec",()=>O(h,{cwd:t.cwd,signal:t.signal})):void 0,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext});I.FS=s,I.vars=Object.assign(Object.create(null),a),I.ARGC=u.length+1,I.ARGV=Object.create(null),I.ARGV[0]="awk";for(let h=0;h<u.length;h++)I.ARGV[String(h+1)]=u[h];I.ENVIRON=Ee(t.env);let w=new q(I);w.execute(A);let d=A.rules.some(h=>h.pattern?.type!=="begin"&&h.pattern?.type!=="end"),R=A.rules.some(h=>h.pattern?.type==="end");try{if(await n("BEGIN execution",()=>w.executeBegin()),I.shouldExit)return await n("END execution after BEGIN exit",()=>w.executeEnd()),{stdout:w.getOutput(),stderr:"",exitCode:w.getExitCode()};if(!d&&!R)return{stdout:w.getOutput(),stderr:"",exitCode:w.getExitCode()};let h=[];if(u.length>0)for(let c of u)try{let E=t.fs.resolvePath(t.cwd,c),G=(await n("input file read",()=>t.fs.readFile(E))).split(`
|
|
18
|
+
`);G.length>0&&G[G.length-1]===""&&G.pop(),h.push({filename:c,lines:G})}catch(E){if(E instanceof x)throw E;return{stdout:"",stderr:`awk: ${c}: No such file or directory
|
|
19
|
+
`,exitCode:1}}else{let c=z(t.stdin).split(`
|
|
20
|
+
`);c.length>0&&c[c.length-1]===""&&c.pop(),h.push({filename:"",lines:c})}for(let c of h){for(I.FILENAME=c.filename,I.FNR=0,I.lines=c.lines,I.lineIndex=-1,I.shouldNextFile=!1;I.lineIndex<c.lines.length-1;){I.lineIndex++;let E=I.lineIndex;if(await n("line execution",()=>w.executeLine(c.lines[E])),I.shouldExit||I.shouldNextFile)break}if(I.shouldExit)break}return await n("END execution",()=>w.executeEnd()),{stdout:w.getOutput(),stderr:"",exitCode:w.getExitCode()}}catch(h){if(h instanceof x)throw h;let c=h instanceof Error?h.message:String(h),E=h instanceof P?P.EXIT_CODE:2;return{stdout:w.getOutput(),stderr:`awk: ${c}
|
|
21
|
+
`,exitCode:E}}}};function pe(e){return e.replace(/\\t/g," ").replace(/\\n/g,`
|
|
22
|
+
`).replace(/\\r/g,"\r").replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\a/g,"\x07").replace(/\\v/g,"\v").replace(/\\\\/g,"\\")}function Ge(e){if(e===" ")return v("\\s+");if(/[[\](){}.*+?^$|\\]/.test(e))try{return v(e)}catch{return v(xe(e))}return v(xe(e))}function xe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var jn={name:"awk",flags:[{flag:"-F",type:"value",valueHint:"delimiter"},{flag:"-v",type:"value",valueHint:"string"}],stdinType:"text",needsArgs:!0};export{zn as a,jn as b};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
+
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,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
+
import{a as f}from"./chunk-PBOVSFTJ.js";import{a as d}from"./chunk-NE4R2FVV.js";import{a as l}from"./chunk-I4IRHQDW.js";var p={recursive:{short:"p",long:"parents",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},b={name:"mkdir",async execute(m,t){let e=d("mkdir",m,p);if(!e.ok)return e.error;let u=e.result.flags.recursive,g=e.result.flags.verbose,n=e.result.positional;if(n.length===0)return{stdout:"",stderr:`mkdir: missing operand
|
|
4
|
+
`,exitCode:1};let a="",o="",c=0;for(let r of n)try{let i=t.fs.resolvePath(t.cwd,r);await t.fs.mkdir(i,{recursive:u}),g&&(a+=`mkdir: created directory '${r}'
|
|
5
|
+
`)}catch(i){let s=l(i);s.includes("ENOENT")||s.includes("no such file")?o+=`mkdir: cannot create directory '${r}': No such file or directory
|
|
6
|
+
`:s.includes("EEXIST")||s.includes("already exists")?o+=`mkdir: cannot create directory '${r}': File exists
|
|
7
|
+
`:o+=`mkdir: cannot create directory '${r}': ${f(s)}
|
|
8
|
+
`,c=1}return{stdout:a,stderr:o,exitCode:c}}},h={name:"mkdir",flags:[{flag:"-p",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0};export{b as a,h as b};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
+
import{b as O}from"./chunk-H7JTIXAO.js";import{a as F}from"./chunk-VZK4FHWJ.js";import{a as N,b as w,c as k}from"./chunk-MUFNRCMY.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]]
|
|
4
|
+
F is a field number (1-indexed)
|
|
5
|
+
C is a character position within the field (1-indexed)
|
|
6
|
+
OPTS can be: b d f h M n r V (per-key modifiers)
|
|
7
|
+
|
|
8
|
+
Examples:
|
|
9
|
+
-k1 sort by first field
|
|
10
|
+
-k2,2 sort by second field only
|
|
11
|
+
-k1.3 sort by first field starting at 3rd character
|
|
12
|
+
-k1,2n sort by fields 1-2 numerically
|
|
13
|
+
-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(`
|
|
14
|
+
`);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]}
|
|
15
|
+
`,exitCode:1};return{stdout:"",stderr:"",exitCode:0}}n.sort(d),e.unique&&(n=E(n,e));let o=n.length>0?`${n.join(`
|
|
16
|
+
`)}
|
|
17
|
+
`:"";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,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
+
import{d as a}from"./chunk-VZK4FHWJ.js";import{a as d,b as h,c as p}from"./chunk-MUFNRCMY.js";var k={name:"split",summary:"split a file into pieces",usage:"split [OPTION]... [FILE [PREFIX]]",description:"Output pieces of FILE to PREFIXaa, PREFIXab, ...; default size is 1000 lines, and default PREFIX is 'x'.",options:["-l N Put N lines per output file","-b SIZE Put SIZE bytes per output file (K, M, G suffixes)","-n CHUNKS Split into CHUNKS equal-sized files","-d Use numeric suffixes (00, 01, ...) instead of alphabetic","-a LENGTH Use suffixes of length LENGTH (default: 2)","--additional-suffix=SUFFIX Append SUFFIX to file names"],examples:["split -l 100 file.txt # Split into 100-line chunks","split -b 1M file.bin # Split into 1MB chunks","split -n 5 file.txt # Split into 5 equal parts","split -d file.txt part_ # part_00, part_01, ...","split -a 3 -d file.txt x # x000, x001, ..."]},m=1e5;function b(s){let l=s.match(/^(\d+)([KMGTPEZY]?)([B]?)$/i);if(!l)return null;let e=Number.parseInt(l[1],10);if(Number.isNaN(e)||e<1)return null;let u=(l[2]||"").toUpperCase(),o=new Map([["",1],["K",1024],["M",1024*1024],["G",1024*1024*1024],["T",1024*1024*1024*1024],["P",1024*1024*1024*1024*1024]]).get(u);return o===void 0?null:e*o}function g(s,l,e){if(l)return s.toString().padStart(e,"0");let u="abcdefghijklmnopqrstuvwxyz",t="",o=s;for(let r=0;r<e;r++)t=u[o%26]+t,o=Math.floor(o/26);return t}function C(s,l){let e=s.split(`
|
|
4
|
+
`),u=s.endsWith(`
|
|
5
|
+
`)&&e[e.length-1]==="";u&&e.pop();let t=[];for(let o=0;o<e.length;o+=l){let r=e.slice(o,o+l),c=o+l>=e.length&&!u?r.join(`
|
|
6
|
+
`):`${r.join(`
|
|
7
|
+
`)}
|
|
8
|
+
`;t.push({content:c,hasContent:!0})}return t}function S(s,l){let u=new TextEncoder().encode(s),t=new TextDecoder,o=[];for(let r=0;r<u.length;r+=l){let f=u.slice(r,r+l);o.push({content:t.decode(f),hasContent:f.length>0})}return o}function v(s,l){let u=new TextEncoder().encode(s),t=new TextDecoder,o=[],r=Math.ceil(u.length/l);for(let f=0;f<l;f++){let c=f*r,i=Math.min(c+r,u.length),n=u.slice(c,i);o.push({content:t.decode(n),hasContent:n.length>0})}return o}var F={name:"split",execute:async(s,l)=>{if(h(s))return d(k);let e={mode:"lines",lines:1e3,bytes:0,chunks:0,useNumericSuffix:!1,suffixLength:2,additionalSuffix:""},u=[],t=0;for(;t<s.length;){let i=s[t];if(i==="-l"&&t+1<s.length){let n=Number.parseInt(s[t+1],10);if(Number.isNaN(n)||n<1)return{exitCode:1,stdout:"",stderr:`split: invalid number of lines: '${s[t+1]}'
|
|
9
|
+
`};e.mode="lines",e.lines=n,t+=2}else if(i.match(/^-l\d+$/)){let n=Number.parseInt(i.slice(2),10);if(Number.isNaN(n)||n<1)return{exitCode:1,stdout:"",stderr:`split: invalid number of lines: '${i.slice(2)}'
|
|
10
|
+
`};e.mode="lines",e.lines=n,t++}else if(i==="-b"&&t+1<s.length){let n=b(s[t+1]);if(n===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of bytes: '${s[t+1]}'
|
|
11
|
+
`};e.mode="bytes",e.bytes=n,t+=2}else if(i.match(/^-b.+$/)){let n=b(i.slice(2));if(n===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of bytes: '${i.slice(2)}'
|
|
12
|
+
`};e.mode="bytes",e.bytes=n,t++}else if(i==="-n"&&t+1<s.length){let n=Number.parseInt(s[t+1],10);if(Number.isNaN(n)||n<1)return{exitCode:1,stdout:"",stderr:`split: invalid number of chunks: '${s[t+1]}'
|
|
13
|
+
`};e.mode="chunks",e.chunks=n,t+=2}else if(i.match(/^-n\d+$/)){let n=Number.parseInt(i.slice(2),10);if(Number.isNaN(n)||n<1)return{exitCode:1,stdout:"",stderr:`split: invalid number of chunks: '${i.slice(2)}'
|
|
14
|
+
`};e.mode="chunks",e.chunks=n,t++}else if(i==="-a"&&t+1<s.length){let n=Number.parseInt(s[t+1],10);if(Number.isNaN(n)||n<1)return{exitCode:1,stdout:"",stderr:`split: invalid suffix length: '${s[t+1]}'
|
|
15
|
+
`};e.suffixLength=n,t+=2}else if(i.match(/^-a\d+$/)){let n=Number.parseInt(i.slice(2),10);if(Number.isNaN(n)||n<1)return{exitCode:1,stdout:"",stderr:`split: invalid suffix length: '${i.slice(2)}'
|
|
16
|
+
`};e.suffixLength=n,t++}else if(i==="-d"||i==="--numeric-suffixes")e.useNumericSuffix=!0,t++;else if(i.startsWith("--additional-suffix="))e.additionalSuffix=i.slice(20),t++;else if(i==="--additional-suffix"&&t+1<s.length)e.additionalSuffix=s[t+1],t+=2;else if(i==="--"){u.push(...s.slice(t+1));break}else{if(i.startsWith("-")&&i!=="-")return p("split",i);u.push(i),t++}}let o="-",r="x";u.length>=1&&(o=u[0]),u.length>=2&&(r=u[1]);let f;if(o==="-")f=l.stdin??"";else{let i=l.fs.resolvePath(l.cwd,o);try{let n=await a(l.fs,i);f=n}catch{return{exitCode:1,stdout:"",stderr:`split: ${o}: No such file or directory
|
|
17
|
+
`}}}if(f==="")return{exitCode:0,stdout:"",stderr:""};let c;switch(e.mode){case"lines":c=C(f,e.lines);break;case"bytes":c=S(f,e.bytes);break;case"chunks":c=v(f,e.chunks);break;default:return e.mode}if(c.length>m)return{exitCode:1,stdout:"",stderr:`split: too many output files (${c.length}), limit is ${m}
|
|
18
|
+
`};for(let i=0;i<c.length;i++){let n=c[i];if(!n.hasContent)continue;let x=g(i,e.useNumericSuffix,e.suffixLength),N=`${r}${x}${e.additionalSuffix}`,y=l.fs.resolvePath(l.cwd,N);await l.fs.writeFile(y,n.content,"binary")}return{exitCode:0,stdout:"",stderr:""}}},E={name:"split",flags:[{flag:"-l",type:"value",valueHint:"number"},{flag:"-b",type:"value",valueHint:"string"},{flag:"-n",type:"value",valueHint:"number"},{flag:"-d",type:"boolean"},{flag:"-a",type:"value",valueHint:"number"}],needsFiles:!0};export{F as a,E as b};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
+
function a(r,s,t){if(!r)return r;let e=r.replace(/\n\s+at\s.*/g,"");return t&&(e=e.replace(/\bfile:\/\/\/?[^\s'",)}\]:]+/g,"<path>")),e=e.replace(s?/(?:\/(?:Users|home|private|var|opt|Library|System|usr|etc|tmp|nix|snap|workspace|root|srv|mnt|app))\b[^\s'",)}\]:]*/g:/(?:\/(?:Users|home|private|var|opt|Library|System|usr|etc|tmp|nix|snap))\b[^\s'",)}\]:]*/g,"<path>"),e=e.replace(/node:internal\/[^\s'",)}\]:]+/g,"<internal>"),e=e.replace(/[A-Z]:\\[^\s'",)}\]:]+/g,"<path>"),t&&(e=e.replace(/\\\\[^\s\\]+\\[^\s'",)}\]:]+/g,"<path>")),e}function n(r){return a(r,!1,!1)}function i(r){return a(r,!0,!0)}export{n as a,i as b};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
+
import{a as g}from"./chunk-NE4R2FVV.js";import{a as D,b as $}from"./chunk-MUFNRCMY.js";var P={name:"tree",summary:"list contents of directories in a tree-like format",usage:"tree [OPTION]... [DIRECTORY]...",options:["-a include hidden files","-d list directories only","-L LEVEL limit depth of directory tree","-f print full path prefix for each file"," --help display this help and exit"]},b={showHidden:{short:"a",type:"boolean"},directoriesOnly:{short:"d",type:"boolean"},fullPath:{short:"f",type:"boolean"},maxDepth:{short:"L",type:"number"}},O={name:"tree",async execute(i,o){if($(i))return D(P);let s=g("tree",i,b);if(!s.ok)return s.error;let f={showHidden:s.result.flags.showHidden,directoriesOnly:s.result.flags.directoriesOnly,maxDepth:s.result.flags.maxDepth??null,fullPath:s.result.flags.fullPath},d=s.result.positional;d.length===0&&d.push(".");let e="",l="",a=0,n=0;for(let t of d){let r=await T(o,t,f,"",0);e+=r.output,l+=r.stderr,a+=r.dirCount,n+=r.fileCount}return e+=`
|
|
4
|
+
${a} director${a===1?"y":"ies"}`,f.directoriesOnly||(e+=`, ${n} file${n===1?"":"s"}`),e+=`
|
|
5
|
+
`,{stdout:e,stderr:l,exitCode:l?1:0}}};async function T(i,o,s,f,d){let e={output:"",stderr:"",dirCount:0,fileCount:0},l=i.fs.resolvePath(i.cwd,o);try{if(!(await i.fs.stat(l)).isDirectory)return e.output=`${o}
|
|
6
|
+
`,e.fileCount=1,e}catch{return e.stderr=`tree: ${o}: No such file or directory
|
|
7
|
+
`,e}if(e.output=`${o}
|
|
8
|
+
`,s.maxDepth!==null&&d>=s.maxDepth)return e;try{let a=[];if(i.fs.readdirWithFileTypes)a=(await i.fs.readdirWithFileTypes(l)).map(r=>({name:r.name,isDirectory:r.isDirectory}));else{let t=await i.fs.readdir(l);for(let r=0;r<t.length;r+=100){let m=t.slice(r,r+100),u=await Promise.all(m.map(async c=>{let y=l==="/"?`/${c}`:`${l}/${c}`;try{let h=await i.fs.stat(y);return{name:c,isDirectory:h.isDirectory}}catch{return null}}));a.push(...u.filter(c=>c!==null))}}let n=a.filter(t=>!(!s.showHidden&&t.name.startsWith(".")||s.directoriesOnly&&!t.isDirectory));n.sort((t,r)=>t.name.localeCompare(r.name));for(let t=0;t<n.length;t++){let r=n[t],m=l==="/"?`/${r.name}`:`${l}/${r.name}`,u=t===n.length-1,c=u?"`-- ":"|-- ",y=f+(u?" ":"| ");if(r.isDirectory){e.dirCount++;let h=s.fullPath?m:r.name;if(e.output+=`${f+c+h}
|
|
9
|
+
`,s.maxDepth===null||d+1<s.maxDepth){let C=await w(i,m,s,y,d+1);e.output+=C.output,e.dirCount+=C.dirCount,e.fileCount+=C.fileCount}}else{e.fileCount++;let h=s.fullPath?m:r.name;e.output+=`${f+c+h}
|
|
10
|
+
`}}}catch{e.stderr=`tree: ${o}: Permission denied
|
|
11
|
+
`}return e}async function w(i,o,s,f,d){let e={output:"",stderr:"",dirCount:0,fileCount:0};if(s.maxDepth!==null&&d>=s.maxDepth)return e;try{let l=[];if(i.fs.readdirWithFileTypes)l=(await i.fs.readdirWithFileTypes(o)).map(t=>({name:t.name,isDirectory:t.isDirectory}));else{let n=await i.fs.readdir(o);for(let t=0;t<n.length;t+=100){let r=n.slice(t,t+100),m=await Promise.all(r.map(async u=>{let c=o==="/"?`/${u}`:`${o}/${u}`;try{let y=await i.fs.stat(c);return{name:u,isDirectory:y.isDirectory}}catch{return null}}));l.push(...m.filter(u=>u!==null))}}let a=l.filter(n=>!(!s.showHidden&&n.name.startsWith(".")||s.directoriesOnly&&!n.isDirectory));a.sort((n,t)=>n.name.localeCompare(t.name));for(let n=0;n<a.length;n++){let t=a[n],r=o==="/"?`/${t.name}`:`${o}/${t.name}`,m=n===a.length-1,u=m?"`-- ":"|-- ",c=f+(m?" ":"| ");if(t.isDirectory){e.dirCount++;let y=s.fullPath?r:t.name;e.output+=`${f+u+y}
|
|
12
|
+
`;let h=await w(i,r,s,c,d+1);e.output+=h.output,e.dirCount+=h.dirCount,e.fileCount+=h.fileCount}else{e.fileCount++;let y=s.fullPath?r:t.name;e.output+=`${f+u+y}
|
|
13
|
+
`}}}catch{}return e}var L={name:"tree",flags:[{flag:"-a",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-L",type:"value",valueHint:"number"}],needsFiles:!0};export{O as a,L as b};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
+
import{a as i,b as l}from"./chunk-MUFNRCMY.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]}
|
|
4
|
+
`}return{stdout:r,stderr:"",exitCode:0}}},u={name:"history",flags:[{flag:"-c",type:"boolean"}]};export{m as a,u as b};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
+
import{a as o,b as i}from"./chunk-MUFNRCMY.js";var m={name:"dirname",summary:"strip last component from file name",usage:"dirname [OPTION] NAME...",options:[" --help display this help and exit"]},p={name:"dirname",async execute(t,l){if(i(t))return o(m);let r=t.filter(n=>!n.startsWith("-"));if(r.length===0)return{stdout:"",stderr:`dirname: missing operand
|
|
4
|
+
`,exitCode:1};let e=[];for(let n of r){let a=n.replace(/\/+$/,""),s=a.lastIndexOf("/");s===-1?e.push("."):s===0?e.push("/"):e.push(a.slice(0,s))}return{stdout:`${e.join(`
|
|
5
|
+
`)}
|
|
6
|
+
`,stderr:"",exitCode:0}}},c={name:"dirname",flags:[],needsArgs:!0};export{p as a,c as b};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
+
import{a as q,b as M}from"./chunk-LSQTB2QK.js";import{d as b}from"./chunk-MLUOPG3W.js";import{a as A,b as L}from"./chunk-LNNWMRCB.js";import{a as k}from"./chunk-HL4ZS7TX.js";import{a as F}from"./chunk-H7JTIXAO.js";import{a as E}from"./chunk-VZK4FHWJ.js";import{k as $}from"./chunk-47WZ2U6M.js";import{a as J}from"./chunk-PBOVSFTJ.js";import{a as D,b as z,c as O}from"./chunk-MUFNRCMY.js";function U(e){switch(e){case"\b":return"\\b";case"\f":return"\\f";case`
|
|
4
|
+
`:return"\\n";case"\r":return"\\r";case" ":return"\\t";default:return`\\u${e.charCodeAt(0).toString(16).padStart(4,"0")}`}}function W(e){let r="",t=!1,o=!1;for(let l=0;l<e.length;l++){let n=e[l];if(o){r+=n,o=!1;continue}if(n==="\\"){r+=n,o=!0;continue}if(n==='"'){r+=n,t=!t;continue}if(t&&n.charCodeAt(0)<=31){r+=U(n);continue}r+=n}return r}function I(e,r,t){return JSON.parse(W(e.slice(r,t)))}function T(e){let r=[],t=0,o=e.length;for(;t<o;){for(;t<o&&/\s/.test(e[t]);)t++;if(t>=o)break;let l=t,n=e[t];if(n==="{"||n==="["){let a=n,f=n==="{"?"}":"]",c=1,p=!1,d=!1;for(t++;t<o&&c>0;){let h=e[t];d?d=!1:h==="\\"?d=!0:h==='"'?p=!p:p||(h===a?c++:h===f&&c--),t++}if(c!==0)throw new Error(`Unexpected end of JSON input at position ${t} (unclosed ${a})`);r.push(b(I(e,l,t)))}else if(n==='"'){let a=!1;for(t++;t<o;){let f=e[t];if(a)a=!1;else if(f==="\\")a=!0;else if(f==='"'){t++;break}t++}r.push(b(I(e,l,t)))}else if(n==="-"||n>="0"&&n<="9"){for(;t<o&&/[\d.eE+-]/.test(e[t]);)t++;r.push(b(I(e,l,t)))}else if(e.slice(t,t+4)==="true")r.push(!0),t+=4;else if(e.slice(t,t+5)==="false")r.push(!1),t+=5;else if(e.slice(t,t+4)==="null")r.push(null),t+=4;else{let a=e.slice(t,t+10);throw new Error(`Invalid JSON at position ${l}: unexpected '${a.split(/\s/)[0]}'`)}}return r}var _={name:"jq",summary:"command-line JSON processor",usage:"jq [OPTIONS] FILTER [FILE]",options:["-r, --raw-output output strings without quotes","-c, --compact compact output (no pretty printing)","-e, --exit-status set exit status based on output","-s, --slurp read entire input into array","-n, --null-input don't read any input","-j, --join-output don't print newlines after each output","-a, --ascii force ASCII output","-S, --sort-keys sort object keys","-C, --color colorize output (ignored)","-M, --monochrome monochrome output (ignored)"," --tab use tabs for indentation"," --help display this help and exit"]};function j(e,r,t,o,l,n=0){if(e===null||e===void 0)return"null";if(typeof e=="boolean")return String(e);if(typeof e=="number")return Number.isFinite(e)?String(e):"null";if(typeof e=="string")return t?e:JSON.stringify(e);let a=l?" ":" ";if(Array.isArray(e))return e.length===0?"[]":r?`[${e.map(c=>j(c,!0,!1,o,l)).join(",")}]`:`[
|
|
5
|
+
${e.map(c=>a.repeat(n+1)+j(c,!1,!1,o,l,n+1)).join(`,
|
|
6
|
+
`)}
|
|
7
|
+
${a.repeat(n)}]`;if(typeof e=="object"){let f=Object.keys(e);return o&&(f=f.sort()),f.length===0?"{}":r?`{${f.map(p=>`${JSON.stringify(p)}:${j(e[p],!0,!1,o,l)}`).join(",")}}`:`{
|
|
8
|
+
${f.map(p=>{let d=j(e[p],!1,!1,o,l,n+1);return`${a.repeat(n+1)}${JSON.stringify(p)}: ${d}`}).join(`,
|
|
9
|
+
`)}
|
|
10
|
+
${a.repeat(n)}}`}return String(e)}var se={name:"jq",async execute(e,r){A(r.requireDefenseContext,"jq","execution entry");let t=(i,s)=>L(r.requireDefenseContext,"jq",i,s);if(z(e))return D(_);let o=!1,l=!1,n=!1,a=!1,f=!1,c=!1,p=!1,d=!1,h=".",N=!1,g=[];for(let i=0;i<e.length;i++){let s=e[i];if(s==="-r"||s==="--raw-output")o=!0;else if(s==="-c"||s==="--compact-output")l=!0;else if(s==="-e"||s==="--exit-status")n=!0;else if(s==="-s"||s==="--slurp")a=!0;else if(s==="-n"||s==="--null-input")f=!0;else if(s==="-j"||s==="--join-output")c=!0;else if(!(s==="-a"||s==="--ascii")){if(s==="-S"||s==="--sort-keys")p=!0;else if(!(s==="-C"||s==="--color")){if(!(s==="-M"||s==="--monochrome"))if(s==="--tab")d=!0;else if(s==="-")g.push("-");else{if(s.startsWith("--"))return O("jq",s);if(s.startsWith("-")){for(let u of s.slice(1))if(u==="r")o=!0;else if(u==="c")l=!0;else if(u==="e")n=!0;else if(u==="s")a=!0;else if(u==="n")f=!0;else if(u==="j")c=!0;else if(u!=="a"){if(u==="S")p=!0;else if(u!=="C"){if(u!=="M")return O("jq",`-${u}`)}}}else N?g.push(s):(h=s,N=!0)}}}}let y=[];if(!f)if(g.length===0||g.length===1&&g[0]==="-")y.push({source:"stdin",content:E(r.stdin)});else{let i=await t("file read",()=>F(r,g,{cmdName:"jq",stopOnError:!0}));if(i.exitCode!==0)return{stdout:"",stderr:i.stderr,exitCode:2};y=i.files.map(s=>({source:s.filename||"stdin",content:E(s.content)}))}try{let i=M(h),s=[],u={limits:r.limits?{maxIterations:r.limits.maxJqIterations}:void 0,env:r.env,coverage:r.coverage,requireDefenseContext:r.requireDefenseContext};if(f)s=q(null,i,u);else if(a){let m=[];for(let{content:C}of y){let w=C.trim();w&&m.push(...T(w))}s=q(m,i,u)}else for(let{content:m}of y){let C=m.trim();if(!C)continue;let w=T(C);for(let P of w)s.push(...q(P,i,u))}let V=s.map(m=>j(m,l,o,p,d)),B=c?"":`
|
|
11
|
+
`,S=V.join(B),x=r.limits?.maxStringLength;if(x!==void 0&&x>0&&S.length>x)throw new $(`jq: output size limit exceeded (${x} bytes)`,"string_length");let H=n&&(s.length===0||s.every(m=>m==null||m===!1))?1:0;return{stdout:S?c?S:`${S}
|
|
12
|
+
`:"",stderr:"",exitCode:H}}catch(i){if(i instanceof k)throw i;if(i instanceof $)return{stdout:"",stderr:`jq: ${J(i.message)}
|
|
13
|
+
`,exitCode:$.EXIT_CODE};let s=J(i.message);return s.includes("Unknown function")?{stdout:"",stderr:`jq: error: ${s}
|
|
14
|
+
`,exitCode:3}:{stdout:"",stderr:`jq: parse error: ${s}
|
|
15
|
+
`,exitCode:5}}}},re={name:"jq",flags:[{flag:"-r",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-e",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-j",type:"boolean"},{flag:"-S",type:"boolean"},{flag:"--tab",type:"boolean"}],stdinType:"json",needsArgs:!0};export{se as a,re as b};
|