just-bash 3.0.1 → 3.0.3
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 +123 -0
- package/README.md +11 -0
- package/dist/AGENTS.md +2 -0
- package/dist/bin/chunks/{awk2-RLMNTGI7.js → awk2-UFCNQFCV.js} +1 -1
- package/dist/bin/{shell/chunks/base64-RZRLGMB3.js → chunks/base64-EGKVQIBC.js} +1 -1
- package/dist/bin/{shell/chunks/bash-CLP24TE2.js → chunks/bash-BEG4JB7K.js} +1 -1
- package/dist/bin/{shell/chunks/cat-LQH5FSAR.js → chunks/cat-NBL6MU5H.js} +1 -1
- package/dist/bin/chunks/{chunk-KFMPGSUT.js → chunk-2ZAK22BG.js} +1 -1
- package/dist/bin/chunks/chunk-4BNS566Q.js +4 -0
- package/dist/bin/chunks/chunk-4J4UC7OD.js +17 -0
- package/dist/bin/{shell/chunks/chunk-IEXQTXU5.js → chunks/chunk-52FZYTIX.js} +4 -4
- package/dist/bin/{shell/chunks/chunk-EDTBGO7F.js → chunks/chunk-5KX5YUWT.js} +1 -1
- package/dist/bin/chunks/{chunk-XFFUAO3F.js → chunk-6FYCU7QB.js} +1 -1
- package/dist/bin/chunks/{chunk-PAYQNSZN.js → chunk-6JKLDBRW.js} +1 -1
- package/dist/bin/chunks/{chunk-22HCD466.js → chunk-7HK63L6Y.js} +1 -1
- package/dist/bin/chunks/chunk-7NDRU2ZN.js +5 -0
- package/dist/bin/{shell/chunks/chunk-IZGLHVBB.js → chunks/chunk-AFAD5U2A.js} +1 -1
- package/dist/bin/chunks/{chunk-LNNWMRCB.js → chunk-AZH64XMJ.js} +1 -1
- package/dist/bin/chunks/{chunk-6FSBHK6H.js → chunk-C6JOQKE2.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-77MLOOQS.js → chunks/chunk-CX5CEEGI.js} +1 -1
- package/dist/bin/chunks/{chunk-NXVG64T3.js → chunk-D7YFPDMV.js} +1 -1
- package/dist/bin/chunks/chunk-DHIKZU63.js +3 -0
- package/dist/bin/chunks/{chunk-UR4CEP4Y.js → chunk-DWECIBLJ.js} +1 -1
- package/dist/bin/chunks/{chunk-C7ISPH7Y.js → chunk-FEENTUVZ.js} +1 -1
- package/dist/bin/chunks/{chunk-FVRXEJYQ.js → chunk-FJABJBIW.js} +2 -2
- package/dist/bin/chunks/{chunk-YOKQNNQO.js → chunk-FYCT4DWY.js} +1 -1
- package/dist/bin/chunks/{chunk-J7TUF2VI.js → chunk-G7ZWT7BT.js} +1 -1
- package/dist/bin/chunks/{chunk-XJ37N3S5.js → chunk-GTO74SFS.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-L24QXM5S.js → chunks/chunk-GXX3QUMM.js} +1 -1
- package/dist/bin/chunks/chunk-HMCRB24D.js +15 -0
- package/dist/bin/chunks/{chunk-FKVQZWJQ.js → chunk-HWNCK5BB.js} +1 -1
- package/dist/bin/chunks/{chunk-V2RP73X4.js → chunk-IX7LKVVH.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-JZW7NFK2.js → chunks/chunk-J7XTZ47D.js} +1 -1
- package/dist/bin/chunks/{chunk-3BYTCO2H.js → chunk-JDFKEXLG.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-HN2DCT7T.js → chunks/chunk-JJC4ENJL.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-F3WNDKOC.js → chunks/chunk-JSZBZ2XU.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-UO5LOD7U.js → chunks/chunk-KMZUSEWI.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-OPMLWMNH.js → chunks/chunk-KWCO3YXP.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-LSQTB2QK.js → chunks/chunk-LMA4D2KK.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-HL4ZS7TX.js → chunks/chunk-LX2H4DPL.js} +3 -3
- package/dist/bin/chunks/{chunk-X4MX6EHF.js → chunk-MP77TJMM.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-F3GKANW3.js → chunks/chunk-MTK7VLZG.js} +1 -1
- package/dist/bin/chunks/chunk-N3FQJLPZ.js +17 -0
- package/dist/bin/{shell/chunks/chunk-2SVX7I5P.js → chunks/chunk-NMMVECGD.js} +1 -1
- package/dist/bin/chunks/{chunk-LAHBP3FW.js → chunk-NXYVRP6D.js} +1 -1
- package/dist/bin/chunks/{chunk-7UU7KPEM.js → chunk-OVVMB2JI.js} +1 -1
- package/dist/bin/chunks/{chunk-YY5PJR7O.js → chunk-OXZSG3ZZ.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-CAZ75E7E.js → chunks/chunk-PKE7GKU5.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-7AYT3UKI.js → chunks/chunk-PSJORJRS.js} +1 -1
- package/dist/bin/chunks/{chunk-7NC4CPHS.js → chunk-R36DS2UF.js} +1 -1
- package/dist/bin/chunks/{chunk-2NRAWO6E.js → chunk-RKBWTGBZ.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-LC6D27QJ.js → chunks/chunk-RVGYO2OU.js} +1 -1
- package/dist/bin/chunks/{chunk-SMSELHIY.js → chunk-SF2OLINE.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-M65CQLJE.js → chunks/chunk-TIRU5FOD.js} +1 -1
- package/dist/bin/chunks/{chunk-BE4PARL3.js → chunk-TKYWUEON.js} +1 -1
- package/dist/bin/chunks/chunk-TYBXHT6W.js +10 -0
- package/dist/bin/chunks/chunk-UI7CV277.js +20 -0
- package/dist/bin/chunks/{chunk-KRRM5UCC.js → chunk-UNWZQG7U.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-4KSZJAQK.js → chunks/chunk-W5OBQVJ2.js} +1 -1
- package/dist/bin/chunks/{chunk-JNUX75OX.js → chunk-WHUKZ3K3.js} +1 -1
- package/dist/bin/chunks/chunk-Y2IUEWQD.js +11 -0
- package/dist/bin/chunks/chunk-Y5OWCEDV.js +64 -0
- package/dist/bin/chunks/{chunk-H7JTIXAO.js → chunk-ZZP3RSWL.js} +1 -1
- package/dist/bin/chunks/{column-AQB3A3PJ.js → column-QLGOK3XM.js} +1 -1
- package/dist/bin/{shell/chunks/comm-Q4VDF6ZO.js → chunks/comm-PLYUTVP3.js} +1 -1
- package/dist/bin/chunks/curl-DCSPNPEW.js +27 -0
- package/dist/bin/chunks/{cut-ZI2HIAW7.js → cut-JNQTCQY7.js} +1 -1
- package/dist/bin/chunks/date-OFYBOAUE.js +3 -0
- package/dist/bin/{shell/chunks/diff-YDJ42RKS.js → chunks/diff-LZ4WRLIF.js} +1 -1
- package/dist/bin/chunks/{env-NY32PQJM.js → env-FNVYNLGB.js} +1 -1
- package/dist/bin/{shell/chunks/expand-YYSO35NS.js → chunks/expand-CB7FG7LQ.js} +1 -1
- package/dist/bin/{shell/chunks/expr-7PLWSWZI.js → chunks/expr-6A2XZORA.js} +1 -1
- package/dist/bin/chunks/{find-P4DOE7CE.js → find-5OZWMYCV.js} +1 -1
- package/dist/bin/chunks/flag-coverage-H6NG6ZQL.js +3 -0
- package/dist/bin/{shell/chunks/fold-5MF7QZWQ.js → chunks/fold-7YEITA5L.js} +1 -1
- package/dist/bin/chunks/{grep-VAYCFO4O.js → grep-KKBXRB73.js} +1 -1
- package/dist/bin/chunks/{gzip-UGBQQKIH.js → gzip-ZJP5VIAQ.js} +1 -1
- package/dist/bin/chunks/{head-QNC2ZYDO.js → head-B6GFQHKF.js} +1 -1
- package/dist/bin/{shell/chunks/html-to-markdown-QEFY7XQR.js → chunks/html-to-markdown-3HJ7L7NL.js} +1 -1
- package/dist/bin/chunks/{join-EJ73DYTK.js → join-WRM6S6CO.js} +1 -1
- package/dist/bin/chunks/{jq-GGTKKMEN.js → jq-33GJJXTL.js} +1 -1
- package/dist/bin/chunks/{js-exec-BC6NI55L.js → js-exec-F7JAZ4ZQ.js} +1 -1
- package/dist/bin/chunks/js-exec-worker.js +214 -17
- package/dist/bin/chunks/{md5sum-MCVDIB35.js → md5sum-ZNYCDRQL.js} +1 -1
- package/dist/bin/{shell/chunks/nl-KUPLVCTS.js → chunks/nl-6TVYE4ZB.js} +1 -1
- package/dist/bin/{shell/chunks/od-YQ5ZUI2H.js → chunks/od-Y3E3QXOL.js} +1 -1
- package/dist/bin/{shell/chunks/paste-A5KKPWXX.js → chunks/paste-LYNFXXCM.js} +1 -1
- package/dist/bin/chunks/printf-MR3FXCDE.js +3 -0
- package/dist/bin/{shell/chunks/python3-BQWDPUBM.js → chunks/python3-R5OFWJIH.js} +1 -1
- package/dist/bin/{shell/chunks/rev-PYHOZ4D4.js → chunks/rev-AJECDD4L.js} +1 -1
- package/dist/bin/chunks/{rg-BGFMSIVK.js → rg-2YWJS6TE.js} +1 -1
- package/dist/bin/chunks/{sed-FWA634SN.js → sed-IGRH7EGG.js} +1 -1
- package/dist/bin/chunks/{sha1sum-4KF52U3Y.js → sha1sum-5QZSNFY3.js} +1 -1
- package/dist/bin/chunks/{sha256sum-6YEPULPX.js → sha256sum-DI7JAVAU.js} +1 -1
- package/dist/bin/{shell/chunks/sleep-QHAPNY3Q.js → chunks/sleep-RPGCUUGX.js} +1 -1
- package/dist/bin/{shell/chunks/sort-4C6WOKNK.js → chunks/sort-HQPAFL76.js} +1 -1
- package/dist/bin/chunks/{split-TV7NL7LA.js → split-F6FSB5KI.js} +1 -1
- package/dist/bin/chunks/{sqlite3-W777NCI4.js → sqlite3-7TRACAE7.js} +1 -1
- package/dist/bin/chunks/sqlite3-worker.js +3 -2
- package/dist/bin/chunks/{strings-MDD72LR6.js → strings-6PE3YMPO.js} +1 -1
- package/dist/bin/chunks/{tac-C2N4NQ6S.js → tac-NERJXVOM.js} +1 -1
- package/dist/bin/chunks/{tail-BCB5W6JC.js → tail-24F643A4.js} +1 -1
- package/dist/bin/chunks/tar-5HK3VMV2.js +3 -0
- package/dist/bin/chunks/{tee-UQHPO4OW.js → tee-5B7P2QRJ.js} +1 -1
- package/dist/bin/chunks/{time-ZPY52VT2.js → time-FN6VJGRS.js} +1 -1
- package/dist/bin/chunks/{timeout-5AX3ZS3X.js → timeout-ZARIAF3K.js} +1 -1
- package/dist/bin/{shell/chunks/tr-G7K6M6HP.js → chunks/tr-QQZYZ3CH.js} +1 -1
- package/dist/bin/chunks/{unexpand-QIR4EDPG.js → unexpand-3JWOSSBQ.js} +1 -1
- package/dist/bin/chunks/{uniq-I7PVFJR4.js → uniq-Q5UH5NL3.js} +1 -1
- package/dist/bin/{shell/chunks/wc-6NGWULAP.js → chunks/wc-4HXNTHY3.js} +1 -1
- package/dist/bin/chunks/worker.js +3 -2
- package/dist/bin/chunks/{xan-KX4VPXUN.js → xan-TSDTZVY3.js} +1 -1
- package/dist/bin/chunks/{xan-view-JXOZLJ7S.js → xan-view-XBMA362V.js} +1 -1
- package/dist/bin/chunks/{xargs-UWHPYLY7.js → xargs-VTFN762K.js} +1 -1
- package/dist/bin/chunks/{yq-GCDCJBKB.js → yq-KU5YTNAK.js} +1 -1
- package/dist/bin/just-bash.js +378 -303
- package/dist/bin/shell/chunks/{awk2-RLMNTGI7.js → awk2-UFCNQFCV.js} +1 -1
- package/dist/bin/{chunks/base64-RZRLGMB3.js → shell/chunks/base64-EGKVQIBC.js} +1 -1
- package/dist/bin/{chunks/bash-CLP24TE2.js → shell/chunks/bash-BEG4JB7K.js} +1 -1
- package/dist/bin/{chunks/cat-LQH5FSAR.js → shell/chunks/cat-NBL6MU5H.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-KFMPGSUT.js → chunk-2ZAK22BG.js} +1 -1
- package/dist/bin/shell/chunks/chunk-4BNS566Q.js +4 -0
- package/dist/bin/shell/chunks/chunk-4J4UC7OD.js +17 -0
- package/dist/bin/{chunks/chunk-IEXQTXU5.js → shell/chunks/chunk-52FZYTIX.js} +4 -4
- package/dist/bin/{chunks/chunk-EDTBGO7F.js → shell/chunks/chunk-5KX5YUWT.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-XFFUAO3F.js → chunk-6FYCU7QB.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-PAYQNSZN.js → chunk-6JKLDBRW.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-22HCD466.js → chunk-7HK63L6Y.js} +1 -1
- package/dist/bin/shell/chunks/chunk-7NDRU2ZN.js +5 -0
- package/dist/bin/{chunks/chunk-IZGLHVBB.js → shell/chunks/chunk-AFAD5U2A.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-LNNWMRCB.js → chunk-AZH64XMJ.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-6FSBHK6H.js → chunk-C6JOQKE2.js} +1 -1
- package/dist/bin/{chunks/chunk-77MLOOQS.js → shell/chunks/chunk-CX5CEEGI.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-NXVG64T3.js → chunk-D7YFPDMV.js} +1 -1
- package/dist/bin/shell/chunks/chunk-DHIKZU63.js +3 -0
- package/dist/bin/shell/chunks/{chunk-UR4CEP4Y.js → chunk-DWECIBLJ.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-C7ISPH7Y.js → chunk-FEENTUVZ.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-FVRXEJYQ.js → chunk-FJABJBIW.js} +2 -2
- package/dist/bin/shell/chunks/{chunk-YOKQNNQO.js → chunk-FYCT4DWY.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-J7TUF2VI.js → chunk-G7ZWT7BT.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-XJ37N3S5.js → chunk-GTO74SFS.js} +1 -1
- package/dist/bin/{chunks/chunk-L24QXM5S.js → shell/chunks/chunk-GXX3QUMM.js} +1 -1
- package/dist/bin/shell/chunks/chunk-HMCRB24D.js +15 -0
- package/dist/bin/shell/chunks/{chunk-FKVQZWJQ.js → chunk-HWNCK5BB.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-V2RP73X4.js → chunk-IX7LKVVH.js} +1 -1
- package/dist/bin/{chunks/chunk-JZW7NFK2.js → shell/chunks/chunk-J7XTZ47D.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-3BYTCO2H.js → chunk-JDFKEXLG.js} +1 -1
- package/dist/bin/{chunks/chunk-HN2DCT7T.js → shell/chunks/chunk-JJC4ENJL.js} +1 -1
- package/dist/bin/{chunks/chunk-F3WNDKOC.js → shell/chunks/chunk-JSZBZ2XU.js} +1 -1
- package/dist/bin/{chunks/chunk-UO5LOD7U.js → shell/chunks/chunk-KMZUSEWI.js} +1 -1
- package/dist/bin/{chunks/chunk-OPMLWMNH.js → shell/chunks/chunk-KWCO3YXP.js} +1 -1
- package/dist/bin/{chunks/chunk-LSQTB2QK.js → shell/chunks/chunk-LMA4D2KK.js} +1 -1
- package/dist/bin/{chunks/chunk-HL4ZS7TX.js → shell/chunks/chunk-LX2H4DPL.js} +3 -3
- package/dist/bin/shell/chunks/{chunk-X4MX6EHF.js → chunk-MP77TJMM.js} +1 -1
- package/dist/bin/{chunks/chunk-F3GKANW3.js → shell/chunks/chunk-MTK7VLZG.js} +1 -1
- package/dist/bin/shell/chunks/chunk-N3FQJLPZ.js +17 -0
- package/dist/bin/{chunks/chunk-2SVX7I5P.js → shell/chunks/chunk-NMMVECGD.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-LAHBP3FW.js → chunk-NXYVRP6D.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-7UU7KPEM.js → chunk-OVVMB2JI.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-YY5PJR7O.js → chunk-OXZSG3ZZ.js} +1 -1
- package/dist/bin/{chunks/chunk-CAZ75E7E.js → shell/chunks/chunk-PKE7GKU5.js} +1 -1
- package/dist/bin/{chunks/chunk-7AYT3UKI.js → shell/chunks/chunk-PSJORJRS.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-7NC4CPHS.js → chunk-R36DS2UF.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-2NRAWO6E.js → chunk-RKBWTGBZ.js} +1 -1
- package/dist/bin/{chunks/chunk-LC6D27QJ.js → shell/chunks/chunk-RVGYO2OU.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-SMSELHIY.js → chunk-SF2OLINE.js} +1 -1
- package/dist/bin/{chunks/chunk-M65CQLJE.js → shell/chunks/chunk-TIRU5FOD.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-BE4PARL3.js → chunk-TKYWUEON.js} +1 -1
- package/dist/bin/shell/chunks/chunk-TYBXHT6W.js +10 -0
- package/dist/bin/shell/chunks/chunk-UI7CV277.js +20 -0
- package/dist/bin/shell/chunks/{chunk-KRRM5UCC.js → chunk-UNWZQG7U.js} +1 -1
- package/dist/bin/{chunks/chunk-4KSZJAQK.js → shell/chunks/chunk-W5OBQVJ2.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-JNUX75OX.js → chunk-WHUKZ3K3.js} +1 -1
- package/dist/bin/shell/chunks/chunk-Y2IUEWQD.js +11 -0
- package/dist/bin/shell/chunks/chunk-Y5OWCEDV.js +64 -0
- package/dist/bin/shell/chunks/{chunk-H7JTIXAO.js → chunk-ZZP3RSWL.js} +1 -1
- package/dist/bin/shell/chunks/{column-AQB3A3PJ.js → column-QLGOK3XM.js} +1 -1
- package/dist/bin/{chunks/comm-Q4VDF6ZO.js → shell/chunks/comm-PLYUTVP3.js} +1 -1
- package/dist/bin/shell/chunks/curl-DCSPNPEW.js +27 -0
- package/dist/bin/shell/chunks/{cut-ZI2HIAW7.js → cut-JNQTCQY7.js} +1 -1
- package/dist/bin/shell/chunks/date-OFYBOAUE.js +3 -0
- package/dist/bin/{chunks/diff-YDJ42RKS.js → shell/chunks/diff-LZ4WRLIF.js} +1 -1
- package/dist/bin/shell/chunks/{env-NY32PQJM.js → env-FNVYNLGB.js} +1 -1
- package/dist/bin/{chunks/expand-YYSO35NS.js → shell/chunks/expand-CB7FG7LQ.js} +1 -1
- package/dist/bin/{chunks/expr-7PLWSWZI.js → shell/chunks/expr-6A2XZORA.js} +1 -1
- package/dist/bin/shell/chunks/{find-P4DOE7CE.js → find-5OZWMYCV.js} +1 -1
- package/dist/bin/shell/chunks/flag-coverage-H6NG6ZQL.js +3 -0
- package/dist/bin/{chunks/fold-5MF7QZWQ.js → shell/chunks/fold-7YEITA5L.js} +1 -1
- package/dist/bin/shell/chunks/{grep-VAYCFO4O.js → grep-KKBXRB73.js} +1 -1
- package/dist/bin/shell/chunks/{gzip-UGBQQKIH.js → gzip-ZJP5VIAQ.js} +1 -1
- package/dist/bin/shell/chunks/{head-QNC2ZYDO.js → head-B6GFQHKF.js} +1 -1
- package/dist/bin/{chunks/html-to-markdown-QEFY7XQR.js → shell/chunks/html-to-markdown-3HJ7L7NL.js} +1 -1
- package/dist/bin/shell/chunks/{join-EJ73DYTK.js → join-WRM6S6CO.js} +1 -1
- package/dist/bin/shell/chunks/{jq-GGTKKMEN.js → jq-33GJJXTL.js} +1 -1
- package/dist/bin/shell/chunks/{js-exec-BC6NI55L.js → js-exec-F7JAZ4ZQ.js} +1 -1
- package/dist/bin/shell/chunks/{md5sum-MCVDIB35.js → md5sum-ZNYCDRQL.js} +1 -1
- package/dist/bin/{chunks/nl-KUPLVCTS.js → shell/chunks/nl-6TVYE4ZB.js} +1 -1
- package/dist/bin/{chunks/od-YQ5ZUI2H.js → shell/chunks/od-Y3E3QXOL.js} +1 -1
- package/dist/bin/{chunks/paste-A5KKPWXX.js → shell/chunks/paste-LYNFXXCM.js} +1 -1
- package/dist/bin/shell/chunks/printf-MR3FXCDE.js +3 -0
- package/dist/bin/{chunks/python3-BQWDPUBM.js → shell/chunks/python3-R5OFWJIH.js} +1 -1
- package/dist/bin/{chunks/rev-PYHOZ4D4.js → shell/chunks/rev-AJECDD4L.js} +1 -1
- package/dist/bin/shell/chunks/{rg-BGFMSIVK.js → rg-2YWJS6TE.js} +1 -1
- package/dist/bin/shell/chunks/{sed-FWA634SN.js → sed-IGRH7EGG.js} +1 -1
- package/dist/bin/shell/chunks/{sha1sum-4KF52U3Y.js → sha1sum-5QZSNFY3.js} +1 -1
- package/dist/bin/shell/chunks/{sha256sum-6YEPULPX.js → sha256sum-DI7JAVAU.js} +1 -1
- package/dist/bin/{chunks/sleep-QHAPNY3Q.js → shell/chunks/sleep-RPGCUUGX.js} +1 -1
- package/dist/bin/{chunks/sort-4C6WOKNK.js → shell/chunks/sort-HQPAFL76.js} +1 -1
- package/dist/bin/shell/chunks/{split-TV7NL7LA.js → split-F6FSB5KI.js} +1 -1
- package/dist/bin/shell/chunks/{sqlite3-W777NCI4.js → sqlite3-7TRACAE7.js} +1 -1
- package/dist/bin/shell/chunks/{strings-MDD72LR6.js → strings-6PE3YMPO.js} +1 -1
- package/dist/bin/shell/chunks/{tac-C2N4NQ6S.js → tac-NERJXVOM.js} +1 -1
- package/dist/bin/shell/chunks/{tail-BCB5W6JC.js → tail-24F643A4.js} +1 -1
- package/dist/bin/shell/chunks/tar-5HK3VMV2.js +3 -0
- package/dist/bin/shell/chunks/{tee-UQHPO4OW.js → tee-5B7P2QRJ.js} +1 -1
- package/dist/bin/shell/chunks/{time-ZPY52VT2.js → time-FN6VJGRS.js} +1 -1
- package/dist/bin/shell/chunks/{timeout-5AX3ZS3X.js → timeout-ZARIAF3K.js} +1 -1
- package/dist/bin/{chunks/tr-G7K6M6HP.js → shell/chunks/tr-QQZYZ3CH.js} +1 -1
- package/dist/bin/shell/chunks/{unexpand-QIR4EDPG.js → unexpand-3JWOSSBQ.js} +1 -1
- package/dist/bin/shell/chunks/{uniq-I7PVFJR4.js → uniq-Q5UH5NL3.js} +1 -1
- package/dist/bin/{chunks/wc-6NGWULAP.js → shell/chunks/wc-4HXNTHY3.js} +1 -1
- package/dist/bin/shell/chunks/{xan-KX4VPXUN.js → xan-TSDTZVY3.js} +1 -1
- package/dist/bin/shell/chunks/{xan-view-JXOZLJ7S.js → xan-view-XBMA362V.js} +1 -1
- package/dist/bin/shell/chunks/{xargs-UWHPYLY7.js → xargs-VTFN762K.js} +1 -1
- package/dist/bin/shell/chunks/{yq-GCDCJBKB.js → yq-KU5YTNAK.js} +1 -1
- package/dist/bin/shell/shell.js +383 -308
- package/dist/bundle/browser.js +665 -659
- package/dist/bundle/chunks/{awk2-LA3USKJP.js → awk2-SREAOJRG.js} +1 -1
- package/dist/bundle/chunks/{base64-C2AIWVNC.js → base64-WIGL46P3.js} +1 -1
- package/dist/bundle/chunks/{bash-YZ33HQZQ.js → bash-F4KHPMTX.js} +1 -1
- package/dist/bundle/chunks/{cat-TSFMZVYS.js → cat-LPZ6XNHG.js} +1 -1
- package/dist/bundle/chunks/{chunk-ICIEVHY5.js → chunk-55LZFN6S.js} +1 -1
- package/dist/bundle/chunks/{chunk-6VAT5Z2D.js → chunk-5MV7Q5QB.js} +1 -1
- package/dist/bundle/chunks/{chunk-UP6MSJGD.js → chunk-6L65G6A7.js} +1 -1
- package/dist/bundle/chunks/{chunk-GGC5NEPZ.js → chunk-6NYPZ4NX.js} +1 -1
- package/dist/bundle/chunks/{chunk-4RUAZWKT.js → chunk-7CSMHFIJ.js} +4 -4
- package/dist/bundle/chunks/{chunk-ACSZB4FE.js → chunk-AAGO7IQ5.js} +1 -1
- package/dist/bundle/chunks/chunk-AFQAPVZ3.js +16 -0
- package/dist/bundle/chunks/{chunk-5H5SCKJM.js → chunk-AX2X3SZS.js} +1 -1
- package/dist/bundle/chunks/{chunk-EBAPSGAO.js → chunk-AXMYAPFA.js} +1 -1
- package/dist/bundle/chunks/chunk-BU36VZYL.js +4 -0
- package/dist/bundle/chunks/{chunk-CBJVD2XA.js → chunk-CJFAMHFC.js} +1 -1
- package/dist/bundle/chunks/{chunk-GJC3WVOW.js → chunk-CQV3EITV.js} +1 -1
- package/dist/bundle/chunks/{chunk-Q7H5W7YE.js → chunk-DJ7QC6LC.js} +2 -2
- package/dist/bundle/chunks/{chunk-S3LEJEPP.js → chunk-DVJY2RAX.js} +1 -1
- package/dist/bundle/chunks/{chunk-N6DXJ2JN.js → chunk-EUCNMMRD.js} +1 -1
- package/dist/bundle/chunks/{chunk-GTQIUQM6.js → chunk-FLMHFDSN.js} +1 -1
- package/dist/bundle/chunks/chunk-GE6OQDB2.js +10 -0
- package/dist/bundle/chunks/{chunk-FW54FHZR.js → chunk-GHB6M7KA.js} +1 -1
- package/dist/bundle/chunks/{chunk-LNBPBRV4.js → chunk-GRQJA2J7.js} +1 -1
- package/dist/bundle/chunks/{chunk-R74UQCKX.js → chunk-H2TS57O5.js} +1 -1
- package/dist/bundle/chunks/{chunk-7JHM3L42.js → chunk-H7WISVP3.js} +1 -1
- package/dist/bundle/chunks/chunk-HAIOEUEV.js +63 -0
- package/dist/bundle/chunks/{chunk-46RN27KI.js → chunk-IZ6KBTV7.js} +1 -1
- package/dist/bundle/chunks/{chunk-T4TFLF3R.js → chunk-JTMQLUCH.js} +1 -1
- package/dist/bundle/chunks/{chunk-2JIPICV3.js → chunk-K5JMLDHX.js} +1 -1
- package/dist/bundle/chunks/{chunk-L64BMZUV.js → chunk-KAPG5ONA.js} +1 -1
- package/dist/bundle/chunks/chunk-KSBHIW2H.js +19 -0
- package/dist/bundle/chunks/{chunk-XHLMAZX2.js → chunk-KTL5PAHY.js} +1 -1
- package/dist/bundle/chunks/{chunk-YCLFEX4T.js → chunk-KTPCYKBB.js} +1 -1
- package/dist/bundle/chunks/chunk-LI6PTSPD.js +9 -0
- package/dist/bundle/chunks/{chunk-LEKBROJD.js → chunk-LZUPLYFM.js} +1 -1
- package/dist/bundle/chunks/{chunk-4N6J7B5P.js → chunk-MFRETFZB.js} +1 -1
- package/dist/bundle/chunks/{chunk-OVGANXCG.js → chunk-MIZIUC5M.js} +1 -1
- package/dist/bundle/chunks/chunk-MJLETYZI.js +14 -0
- package/dist/bundle/chunks/{chunk-VLCHOJWK.js → chunk-MTHXXA6H.js} +1 -1
- package/dist/bundle/chunks/{chunk-6LASZU3O.js → chunk-NGPDJCUE.js} +1 -1
- package/dist/bundle/chunks/{chunk-ZZKH2ELC.js → chunk-OVH44QKR.js} +1 -1
- package/dist/bundle/chunks/chunk-PDUL32DM.js +16 -0
- package/dist/bundle/chunks/{chunk-KD3KENL6.js → chunk-PYDWFCTN.js} +1 -1
- package/dist/bundle/chunks/{chunk-AQ6FYS2X.js → chunk-QAJKDPNS.js} +1 -1
- package/dist/bundle/chunks/{chunk-XCQWV4AU.js → chunk-R4QNMLOB.js} +1 -1
- package/dist/bundle/chunks/chunk-RBQG6ZUG.js +3 -0
- package/dist/bundle/chunks/{chunk-U73A73IE.js → chunk-RCXNPPJY.js} +1 -1
- package/dist/bundle/chunks/{chunk-S443BAN4.js → chunk-S2BIZAWY.js} +1 -1
- package/dist/bundle/chunks/{chunk-XRFHFXFP.js → chunk-SY4HAUHP.js} +1 -1
- package/dist/bundle/chunks/{chunk-FJK43EBQ.js → chunk-TA74ENH7.js} +1 -1
- package/dist/bundle/chunks/{chunk-OC35HPHG.js → chunk-TC2WHAIS.js} +1 -1
- package/dist/bundle/chunks/{chunk-TN7HHBQW.js → chunk-VACKIICN.js} +3 -3
- package/dist/bundle/chunks/{chunk-GSPYNYZA.js → chunk-VBLMIJON.js} +1 -1
- package/dist/bundle/chunks/{chunk-VPADYNBD.js → chunk-WKPK7M56.js} +1 -1
- package/dist/bundle/chunks/chunk-XEKXHOPO.js +2 -0
- package/dist/bundle/chunks/{chunk-BVKWRAS6.js → chunk-XPK7ZFVA.js} +1 -1
- package/dist/bundle/chunks/{chunk-FAXLQUCQ.js → chunk-XZUZRAAC.js} +1 -1
- package/dist/bundle/chunks/{chunk-HJBTD7PY.js → chunk-YRNR2VHY.js} +1 -1
- package/dist/bundle/chunks/{chunk-KATRCGLX.js → chunk-YWOZZRSK.js} +1 -1
- package/dist/bundle/chunks/{chunk-FX7KQCEA.js → chunk-Z3KJQD7F.js} +1 -1
- package/dist/bundle/chunks/{column-XT6UFXNQ.js → column-PVOEF65J.js} +1 -1
- package/dist/bundle/chunks/{comm-VV2LDX2J.js → comm-5QMYEAJL.js} +1 -1
- package/dist/bundle/chunks/curl-PAWGO3EH.js +26 -0
- package/dist/bundle/chunks/{cut-OKARJCCV.js → cut-NDMV7SPO.js} +1 -1
- package/dist/bundle/chunks/date-XKUEQ4WF.js +2 -0
- package/dist/bundle/chunks/{diff-MWJFIG7X.js → diff-TT4M7WM3.js} +1 -1
- package/dist/bundle/chunks/{env-36M5BO7M.js → env-DLFRY633.js} +1 -1
- package/dist/bundle/chunks/{expand-JSPG6VOP.js → expand-T2TH4TBQ.js} +1 -1
- package/dist/bundle/chunks/{expr-5JAACS4X.js → expr-YLACLCSM.js} +1 -1
- package/dist/bundle/chunks/find-T5TGGXUU.js +2 -0
- package/dist/bundle/chunks/flag-coverage-TRYUZMPS.js +2 -0
- package/dist/bundle/chunks/{fold-4TQNYMSW.js → fold-XR2JMFCW.js} +1 -1
- package/dist/bundle/chunks/{grep-V3LQVMRQ.js → grep-VUESTEZ7.js} +1 -1
- package/dist/bundle/chunks/{gzip-O5ASJAFY.js → gzip-HF3D26QX.js} +1 -1
- package/dist/bundle/chunks/{head-442HYESI.js → head-AEMOMQSZ.js} +1 -1
- package/dist/bundle/chunks/{html-to-markdown-JW4MSQZO.js → html-to-markdown-LXXMVQ3V.js} +1 -1
- package/dist/bundle/chunks/{join-TBRGI3LQ.js → join-YIABB6WR.js} +1 -1
- package/dist/bundle/chunks/{jq-4XLYLOS5.js → jq-3FAAQVR6.js} +1 -1
- package/dist/bundle/chunks/{js-exec-N5KEZBH7.js → js-exec-SR6IMNWM.js} +1 -1
- package/dist/bundle/chunks/js-exec-worker.js +214 -17
- package/dist/bundle/chunks/{md5sum-SPU24VSG.js → md5sum-LU7RVIB7.js} +1 -1
- package/dist/bundle/chunks/{nl-WSDW7I4O.js → nl-Q2L5XQWZ.js} +1 -1
- package/dist/bundle/chunks/{od-WOKFDJTP.js → od-RDSM4TQJ.js} +1 -1
- package/dist/bundle/chunks/{paste-7JC6S4DX.js → paste-ABCY7E6C.js} +1 -1
- package/dist/bundle/chunks/printf-JPOOWRJC.js +2 -0
- package/dist/bundle/chunks/{python3-POMOR4OA.js → python3-JPCH6LLN.js} +1 -1
- package/dist/bundle/chunks/{rev-5EHFX4EJ.js → rev-GCV6X22K.js} +1 -1
- package/dist/bundle/chunks/rg-N5WLPMSA.js +2 -0
- package/dist/bundle/chunks/{sed-S5UIK574.js → sed-DX2SGXMF.js} +1 -1
- package/dist/bundle/chunks/{sha1sum-2PTOAFR6.js → sha1sum-O6DM3TPQ.js} +1 -1
- package/dist/bundle/chunks/{sha256sum-NS7D3IXX.js → sha256sum-WPVZLZPS.js} +1 -1
- package/dist/bundle/chunks/{sleep-X22JJINO.js → sleep-HZ4QEFOK.js} +1 -1
- package/dist/bundle/chunks/{sort-SW2YEO5B.js → sort-VW2NIZHW.js} +1 -1
- package/dist/bundle/chunks/{split-4KKZZXXE.js → split-NBMH43M2.js} +1 -1
- package/dist/bundle/chunks/{sqlite3-CGOEFJAO.js → sqlite3-UE3PJTDQ.js} +1 -1
- package/dist/bundle/chunks/sqlite3-worker.js +3 -2
- package/dist/bundle/chunks/{strings-6WDHLGMX.js → strings-MCXFXPDL.js} +1 -1
- package/dist/bundle/chunks/{tac-2STMMJYW.js → tac-BQ7EDZW2.js} +1 -1
- package/dist/bundle/chunks/{tail-R4PCA2C4.js → tail-GJMTLMNE.js} +1 -1
- package/dist/bundle/chunks/tar-WIZ3PDF4.js +2 -0
- package/dist/bundle/chunks/{tee-YUZ2FKCJ.js → tee-SGANDVNY.js} +1 -1
- package/dist/bundle/chunks/{time-D4LNBSWX.js → time-FCZCDIAM.js} +1 -1
- package/dist/bundle/chunks/timeout-VDIEAB4R.js +2 -0
- package/dist/bundle/chunks/{tr-36LHWFRQ.js → tr-JNNR5JMS.js} +1 -1
- package/dist/bundle/chunks/{unexpand-CADSA4VO.js → unexpand-2TKXAENW.js} +1 -1
- package/dist/bundle/chunks/{uniq-XSIZR6PB.js → uniq-DMFKT3AB.js} +1 -1
- package/dist/bundle/chunks/{wc-LF7NU4LA.js → wc-TZFYWFLA.js} +1 -1
- package/dist/bundle/chunks/worker.js +3 -2
- package/dist/bundle/chunks/{xan-Y6WF3IRG.js → xan-U6654PZR.js} +1 -1
- package/dist/bundle/chunks/xan-view-YATJ4KAA.js +2 -0
- package/dist/bundle/chunks/{xargs-MGZPH7AX.js → xargs-VDP7DLOU.js} +1 -1
- package/dist/bundle/chunks/yq-ZBXLBSXV.js +2 -0
- package/dist/bundle/index.cjs +934 -928
- package/dist/bundle/index.js +385 -310
- package/dist/commands/curl/types.d.ts +29 -0
- package/dist/commands/js-exec/module-shims.d.ts +1 -1
- package/dist/commands/sqlite3/worker.js +3 -2
- package/dist/commands/tar/tar-options.d.ts +1 -1
- package/dist/encoding.d.ts +14 -0
- package/dist/parser/parser-substitution.d.ts +14 -0
- package/package.json +1 -1
- package/dist/bin/chunks/chunk-3UKQXBQ3.js +0 -6
- package/dist/bin/chunks/chunk-ALVEEXFD.js +0 -19
- package/dist/bin/chunks/chunk-BGX3RW7H.js +0 -10
- package/dist/bin/chunks/chunk-D6CPXGKK.js +0 -75
- package/dist/bin/chunks/chunk-FOUVACI7.js +0 -16
- package/dist/bin/chunks/chunk-Q4UMTSRO.js +0 -15
- package/dist/bin/chunks/chunk-UGJM7CKP.js +0 -17
- package/dist/bin/chunks/chunk-VBDLSL7Y.js +0 -10
- package/dist/bin/chunks/chunk-VZK4FHWJ.js +0 -3
- package/dist/bin/chunks/chunk-Y4FPH5DQ.js +0 -64
- package/dist/bin/chunks/curl-AXXGQRR2.js +0 -27
- package/dist/bin/chunks/date-JEZYSA4F.js +0 -3
- package/dist/bin/chunks/expansion-PPP6PD75.js +0 -3
- package/dist/bin/chunks/flag-coverage-RFKIBJ6L.js +0 -3
- package/dist/bin/chunks/printf-Z5C2UOI5.js +0 -3
- package/dist/bin/chunks/tar-DOO744MK.js +0 -3
- package/dist/bin/shell/chunks/chunk-3UKQXBQ3.js +0 -6
- package/dist/bin/shell/chunks/chunk-ALVEEXFD.js +0 -19
- package/dist/bin/shell/chunks/chunk-BGX3RW7H.js +0 -10
- package/dist/bin/shell/chunks/chunk-D6CPXGKK.js +0 -75
- package/dist/bin/shell/chunks/chunk-FOUVACI7.js +0 -16
- package/dist/bin/shell/chunks/chunk-Q4UMTSRO.js +0 -15
- package/dist/bin/shell/chunks/chunk-UGJM7CKP.js +0 -17
- package/dist/bin/shell/chunks/chunk-VBDLSL7Y.js +0 -10
- package/dist/bin/shell/chunks/chunk-VZK4FHWJ.js +0 -3
- package/dist/bin/shell/chunks/chunk-Y4FPH5DQ.js +0 -64
- package/dist/bin/shell/chunks/curl-AXXGQRR2.js +0 -27
- package/dist/bin/shell/chunks/date-JEZYSA4F.js +0 -3
- package/dist/bin/shell/chunks/expansion-PPP6PD75.js +0 -3
- package/dist/bin/shell/chunks/flag-coverage-RFKIBJ6L.js +0 -3
- package/dist/bin/shell/chunks/printf-Z5C2UOI5.js +0 -3
- package/dist/bin/shell/chunks/tar-DOO744MK.js +0 -3
- package/dist/bundle/chunks/chunk-CHFEPBH4.js +0 -18
- package/dist/bundle/chunks/chunk-G5EVRAOO.js +0 -74
- package/dist/bundle/chunks/chunk-GIUR5SNU.js +0 -15
- package/dist/bundle/chunks/chunk-MZFCCXPZ.js +0 -63
- package/dist/bundle/chunks/chunk-NRSASXYY.js +0 -2
- package/dist/bundle/chunks/chunk-OGJ5CFPR.js +0 -9
- package/dist/bundle/chunks/chunk-SO6R3ZKN.js +0 -16
- package/dist/bundle/chunks/chunk-XDGLKIHR.js +0 -9
- package/dist/bundle/chunks/chunk-XUIHBHL5.js +0 -5
- package/dist/bundle/chunks/chunk-XYXUMFSU.js +0 -14
- package/dist/bundle/chunks/curl-LV5Y3AMS.js +0 -26
- package/dist/bundle/chunks/date-UUUPW43J.js +0 -2
- package/dist/bundle/chunks/expansion-R25BK4W3.js +0 -2
- package/dist/bundle/chunks/find-INTH3OLC.js +0 -2
- package/dist/bundle/chunks/flag-coverage-XWSYNE72.js +0 -2
- package/dist/bundle/chunks/printf-TWGXF445.js +0 -2
- package/dist/bundle/chunks/rg-S4FXYXWB.js +0 -2
- package/dist/bundle/chunks/tar-STHHZTZ6.js +0 -2
- package/dist/bundle/chunks/timeout-YDCRSLPQ.js +0 -2
- package/dist/bundle/chunks/xan-view-HDVKHFC2.js +0 -2
- package/dist/bundle/chunks/yq-4QJW3EQG.js +0 -2
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{a as Z}from"./chunk-RBQG6ZUG.js";import{a as _,c as N}from"./chunk-27JIFWUR.js";import{k as A}from"./chunk-SAI2SPQQ.js";import{a as z}from"./chunk-W5DWRFSU.js";import{a as F,b as W}from"./chunk-QAYAQNCG.js";import{sprintf as g}from"sprintf-js";function q(e){let s="",t=0;for(;t<e.length;){let r=e[t];if(r<128){s+=String.fromCharCode(r),t++;continue}if((r&224)===192){if(t+1<e.length&&(e[t+1]&192)===128&&r>=194){let i=(r&31)<<6|e[t+1]&63;s+=String.fromCharCode(i),t+=2;continue}s+=String.fromCharCode(r),t++;continue}if((r&240)===224){if(t+2<e.length&&(e[t+1]&192)===128&&(e[t+2]&192)===128){if(r===224&&e[t+1]<160){s+=String.fromCharCode(r),t++;continue}let i=(r&15)<<12|(e[t+1]&63)<<6|e[t+2]&63;if(i>=55296&&i<=57343){s+=String.fromCharCode(r),t++;continue}s+=String.fromCharCode(i),t+=3;continue}s+=String.fromCharCode(r),t++;continue}if((r&248)===240&&r<=244){if(t+3<e.length&&(e[t+1]&192)===128&&(e[t+2]&192)===128&&(e[t+3]&192)===128){if(r===240&&e[t+1]<144){s+=String.fromCharCode(r),t++;continue}let i=(r&7)<<18|(e[t+1]&63)<<12|(e[t+2]&63)<<6|e[t+3]&63;if(i>1114111){s+=String.fromCharCode(r),t++;continue}s+=String.fromCodePoint(i),t+=4;continue}s+=String.fromCharCode(r),t++;continue}s+=String.fromCharCode(r),t++}return s}var H={name:"printf",summary:"format and print data",usage:"printf [-v var] FORMAT [ARGUMENT...]",options:[" -v var assign the output to shell variable VAR rather than display it"," --help display this help and exit"],notes:["FORMAT controls the output like in C printf.","Escape sequences: \\n (newline), \\t (tab), \\\\ (backslash)","Format specifiers: %s (string), %d (integer), %f (float), %x (hex), %o (octal), %% (literal %)","Width and precision: %10s (width 10), %.2f (2 decimal places), %010d (zero-padded)","Flags: %- (left-justify), %+ (show sign), %0 (zero-pad)"]},re={name:"printf",async execute(e,s){if(W(e))return F(H);if(e.length===0)return{stdout:"",stderr:`printf: usage: printf format [arguments]
|
|
3
|
+
`,exitCode:2};let t=null,r=0;for(;r<e.length;){let l=e[r];if(l==="--"){r++;break}if(l==="-v"){if(r+1>=e.length)return{stdout:"",stderr:`printf: -v: option requires an argument
|
|
4
|
+
`,exitCode:1};if(t=e[r+1],!/^[a-zA-Z_][a-zA-Z0-9_]*(\[[a-zA-Z0-9_@*"'$]+\])?$/.test(t))return{stdout:"",stderr:`printf: \`${t}': not a valid identifier
|
|
5
|
+
`,exitCode:2};r+=2}else{if(l.startsWith("-")&&l!=="-")break;break}}if(r>=e.length)return{stdout:"",stderr:`printf: usage: printf format [arguments]
|
|
6
|
+
`,exitCode:1};let i=e[r],n=e.slice(r+1);try{let l=N(i),a="",f=0,o=!1,c="",E=s.env.get("TZ"),h=s.limits?.maxStringLength;do{let{result:m,argsConsumed:v,error:u,errMsg:C,stopped:S}=L(l,n,f,E);if(a+=m,h!==void 0&&h>0&&a.length>h)throw new A(`printf: output size limit exceeded (${h} bytes)`,"string_length");if(f+=v,u&&(o=!0,C&&(c=C)),S)break}while(f<n.length&&f>0);if(f===0&&n.length>0,t){let m=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(['"]?)(.+?)\2\]$/);if(m){let v=m[1],u=m[3];u=u.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(C,S)=>s.env.get(S)??""),s.env.set(`${v}_${u}`,a)}else s.env.set(t,a);return{stdout:"",stderr:c,exitCode:o?1:0}}return{stdout:a,stderr:c,exitCode:o?1:0}}catch(l){if(l instanceof A)throw l;return{stdout:"",stderr:`printf: ${z(l)}
|
|
7
|
+
`,exitCode:1}}}};function L(e,s,t,r){let i="",n=0,l=0,a=!1,f="";for(;n<e.length;)if(e[n]==="%"&&n+1<e.length){let o=n;if(n++,e[n]==="%"){i+="%",n++;continue}let c=e.slice(o).match(/^%(-?\d*)(?:\.(\d+))?\(([^)]*)\)T/);if(c){let x=c[1]?parseInt(c[1],10):0,b=c[2]?parseInt(c[2],10):-1,R=c[3],U=c[0],w=s[t+l]||"";l++;let $;w===""||w==="-1"||w==="-2"?$=Math.floor(Date.now()/1e3):$=parseInt(w,10)||0;let p=Z(R,$,r);if(b>=0&&p.length>b&&(p=p.slice(0,b)),x!==0){let M=Math.abs(x);p.length<M&&(x<0?p=p.padEnd(M," "):p=p.padStart(M," "))}i+=p,n=o+U.length;continue}for(;n<e.length&&"+-0 #'".includes(e[n]);)n++;let E=!1;if(e[n]==="*")E=!0,n++;else for(;n<e.length&&/\d/.test(e[n]);)n++;let h=!1;if(e[n]===".")if(n++,e[n]==="*")h=!0,n++;else for(;n<e.length&&/\d/.test(e[n]);)n++;n<e.length&&"hlL".includes(e[n])&&n++;let m=e[n]||"";n++;let u=e.slice(o,n);if(E){let x=parseInt(s[t+l]||"0",10);l++,u=u.replace("*",String(x))}if(h){let x=parseInt(s[t+l]||"0",10);l++,u=u.replace(".*",`.${x}`)}let C=s[t+l]||"";l++;let{value:S,parseError:P,parseErrMsg:k,stopped:j}=X(u,m,C);if(i+=S,P&&(a=!0,k&&(f=k)),j)return{result:i,argsConsumed:l,error:a,errMsg:f,stopped:!0}}else i+=e[n],n++;return{result:i,argsConsumed:l,error:a,errMsg:f,stopped:!1}}function X(e,s,t){let r=!1,i="";switch(s){case"d":case"i":{let n=I(t);return r=d,r&&(i=`printf: ${t}: invalid number
|
|
8
|
+
`),{value:T(e,n),parseError:r,parseErrMsg:i}}case"o":{let n=I(t);return r=d,r&&(i=`printf: ${t}: invalid number
|
|
9
|
+
`),{value:D(e,n),parseError:r,parseErrMsg:i}}case"u":{let n=I(t);r=d,r&&(i=`printf: ${t}: invalid number
|
|
10
|
+
`);let l=n<0?n>>>0:n;return{value:T(e.replace("u","d"),l),parseError:r,parseErrMsg:i}}case"x":case"X":{let n=I(t);return r=d,r&&(i=`printf: ${t}: invalid number
|
|
11
|
+
`),{value:G(e,n),parseError:r,parseErrMsg:i}}case"e":case"E":case"f":case"F":case"g":case"G":{let n=parseFloat(t)||0;return{value:y(e,s,n),parseError:!1,parseErrMsg:""}}case"c":{if(t==="")return{value:"",parseError:!1,parseErrMsg:""};let a=new TextEncoder().encode(t)[0];return{value:String.fromCharCode(a),parseError:!1,parseErrMsg:""}}case"s":return{value:Q(e,t),parseError:!1,parseErrMsg:""};case"q":return{value:V(e,t),parseError:!1,parseErrMsg:""};case"b":{let n=B(t);return{value:n.value,parseError:!1,parseErrMsg:"",stopped:n.stopped}}default:try{return{value:g(e,t),parseError:!1,parseErrMsg:""}}catch{return{value:"",parseError:!0,parseErrMsg:`printf: [sprintf] unexpected placeholder
|
|
12
|
+
`}}}}var d=!1;function I(e){d=!1;let s=e.trimStart(),t=s!==s.trimEnd();if(e=s.trimEnd(),e.startsWith("'")&&e.length>=2||e.startsWith('"')&&e.length>=2)return e.charCodeAt(1);if(e.startsWith("\\'")&&e.length>=3||e.startsWith('\\"')&&e.length>=3)return e.charCodeAt(2);if(e.startsWith("+")&&(e=e.slice(1)),e.startsWith("0x")||e.startsWith("0X")){let r=parseInt(e,16);return Number.isNaN(r)?(d=!0,0):(t&&(d=!0),r)}if(e.startsWith("0")&&e.length>1&&/^-?0[0-7]+$/.test(e))return t&&(d=!0),parseInt(e,8)||0;if(/^\d+#/.test(e)){d=!0;let r=e.match(/^(\d+)#/);return r?parseInt(r[1],10):0}if(e!==""&&!/^-?\d+$/.test(e)){d=!0;let r=parseInt(e,10);return Number.isNaN(r)?0:r}return t&&(d=!0),parseInt(e,10)||0}function T(e,s){let t=e.match(/^%([- +#0']*)(\d*)(\.(\d*))?[diu]$/);if(!t)return g(e.replace(/\.\d*/,""),s);let r=t[1]||"",i=t[2]?parseInt(t[2],10):0,n=t[3]!==void 0?t[4]?parseInt(t[4],10):0:-1,l=s<0,a=Math.abs(s),f=String(a);n>=0&&(f=f.padStart(n,"0"));let o="";l?o="-":r.includes("+")?o="+":r.includes(" ")&&(o=" ");let c=o+f;return i>c.length&&(r.includes("-")?c=c.padEnd(i," "):r.includes("0")&&n<0?c=o+f.padStart(i-o.length,"0"):c=c.padStart(i," ")),c}function D(e,s){let t=e.match(/^%([- +#0']*)(\d*)(\.(\d*))?o$/);if(!t)return g(e,s);let r=t[1]||"",i=t[2]?parseInt(t[2],10):0,n=t[3]!==void 0?t[4]?parseInt(t[4],10):0:-1,l=Math.abs(s).toString(8);n>=0&&(l=l.padStart(n,"0")),r.includes("#")&&!l.startsWith("0")&&(l=`0${l}`);let a=l;return i>a.length&&(r.includes("-")?a=a.padEnd(i," "):r.includes("0")&&n<0?a=a.padStart(i,"0"):a=a.padStart(i," ")),a}function G(e,s){let t=e.includes("X"),r=e.match(/^%([- +#0']*)(\d*)(\.(\d*))?[xX]$/);if(!r)return g(e,s);let i=r[1]||"",n=r[2]?parseInt(r[2],10):0,l=r[3]!==void 0?r[4]?parseInt(r[4],10):0:-1,a=Math.abs(s).toString(16);t&&(a=a.toUpperCase()),l>=0&&(a=a.padStart(l,"0"));let f="";i.includes("#")&&s!==0&&(f=t?"0X":"0x");let o=f+a;return n>o.length&&(i.includes("-")?o=o.padEnd(n," "):i.includes("0")&&l<0?o=f+a.padStart(n-f.length,"0"):o=o.padStart(n," ")),o}function O(e){if(e==="")return"''";if(/^[a-zA-Z0-9_./-]+$/.test(e))return e;if(/[\x00-\x1f\x7f-\xff]/.test(e)){let r="$'";for(let i of e){let n=i.charCodeAt(0);i==="'"?r+="\\'":i==="\\"?r+="\\\\":i===`
|
|
13
|
+
`?r+="\\n":i===" "?r+="\\t":i==="\r"?r+="\\r":i==="\x07"?r+="\\a":i==="\b"?r+="\\b":i==="\f"?r+="\\f":i==="\v"?r+="\\v":i==="\x1B"?r+="\\E":n<32||n>=127&&n<=255?r+=`\\${n.toString(8).padStart(3,"0")}`:i==='"'?r+='\\"':r+=i}return r+="'",r}let t="";for(let r of e)" |&;<>()$`\\\"'*?[#~=%!{}".includes(r)?t+=`\\${r}`:t+=r;return t}function Q(e,s){let t=e.match(/^%(-?)(\d*)(\.(\d*))?s$/);if(!t)return g(e.replace(/0+(?=\d)/,""),s);let r=t[1]==="-",i=t[2]?parseInt(t[2],10):0,n=t[3]!==void 0?t[4]?parseInt(t[4],10):0:-1,l=r?-i:i;return _(s,l,n)}function V(e,s){let t=O(s),r=e.match(/^%(-?)(\d*)q$/);if(!r)return t;let i=r[1]==="-",n=r[2]?parseInt(r[2],10):0,l=t;return n>l.length&&(i?l=l.padEnd(n," "):l=l.padStart(n," ")),l}function y(e,s,t){let r=e.match(/^%([- +#0']*)(\d*)(\.(\d*))?[eEfFgG]$/);if(!r)return g(e,t);let i=r[1]||"",n=r[2]?parseInt(r[2],10):0,l=r[3]!==void 0?r[4]?parseInt(r[4],10):0:6,a,f=s.toLowerCase();if(f==="e"?(a=t.toExponential(l),a=a.replace(/e([+-])(\d)$/,"e$10$2"),s==="E"&&(a=a.toUpperCase())):f==="f"?(a=t.toFixed(l),i.includes("#")&&l===0&&!a.includes(".")&&(a+=".")):f==="g"?(a=t.toPrecision(l||1),i.includes("#")||(a=a.replace(/\.?0+$/,""),a=a.replace(/\.?0+e/,"e")),a=a.replace(/e([+-])(\d)$/,"e$10$2"),s==="G"&&(a=a.toUpperCase())):a=t.toString(),t>=0&&(i.includes("+")?a=`+${a}`:i.includes(" ")&&(a=` ${a}`)),n>a.length)if(i.includes("-"))a=a.padEnd(n," ");else if(i.includes("0")){let o=a.match(/^[+ -]/)?.[0]||"",c=o?a.slice(1):a;a=o+c.padStart(n-o.length,"0")}else a=a.padStart(n," ");return a}function B(e){let s="",t=0;for(;t<e.length;)if(e[t]==="\\"&&t+1<e.length)switch(e[t+1]){case"n":s+=`
|
|
14
|
+
`,t+=2;break;case"t":s+=" ",t+=2;break;case"r":s+="\r",t+=2;break;case"\\":s+="\\",t+=2;break;case"a":s+="\x07",t+=2;break;case"b":s+="\b",t+=2;break;case"f":s+="\f",t+=2;break;case"v":s+="\v",t+=2;break;case"c":return{value:s,stopped:!0};case"x":{let i=[],n=t;for(;n+1<e.length&&e[n]==="\\"&&e[n+1]==="x";){let l="",a=n+2;for(;a<e.length&&a<n+4&&/[0-9a-fA-F]/.test(e[a]);)l+=e[a],a++;if(l)i.push(parseInt(l,16)),n=a;else break}i.length>0?(s+=q(i),t=n):(s+="\\x",t+=2);break}case"u":{let i="",n=t+2;for(;n<e.length&&n<t+6&&/[0-9a-fA-F]/.test(e[n]);)i+=e[n],n++;i?(s+=String.fromCodePoint(parseInt(i,16)),t=n):(s+="\\u",t+=2);break}case"0":{let i="",n=t+2;for(;n<e.length&&n<t+5&&/[0-7]/.test(e[n]);)i+=e[n],n++;i?s+=String.fromCharCode(parseInt(i,8)):s+="\0",t=n;break}case"1":case"2":case"3":case"4":case"5":case"6":case"7":{let i="",n=t+1;for(;n<e.length&&n<t+4&&/[0-7]/.test(e[n]);)i+=e[n],n++;s+=String.fromCharCode(parseInt(i,8)),t=n;break}default:s+=e[t],t++}else s+=e[t],t++;return{value:s,stopped:!1}}var ie={name:"printf",flags:[{flag:"-v",type:"value",valueHint:"string"}],stdinType:"none",needsArgs:!0};export{re as a,ie as b};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{a as T}from"./chunk-
|
|
2
|
+
import{a as T}from"./chunk-KTPCYKBB.js";import{c as b}from"./chunk-XEKXHOPO.js";import{a as M}from"./chunk-QIQMJJZ4.js";import{a as S,b as F}from"./chunk-QAYAQNCG.js";var H={name:"wc",summary:"print newline, word, and byte counts for each file",usage:"wc [OPTION]... [FILE]...",options:["-c, --bytes print the byte counts","-m, --chars print the character counts","-l, --lines print the newline counts","-w, --words print the word counts"," --help display this help and exit"]},O={lines:{short:"l",long:"lines",type:"boolean"},words:{short:"w",long:"words",type:"boolean"},bytes:{short:"c",long:"bytes",type:"boolean"},chars:{short:"m",long:"chars",type:"boolean"}},N={name:"wc",async execute(a,f){if(F(a))return S(H);let s=M("wc",a,O);if(!s.ok)return s.error;let{lines:o,words:n}=s.result.flags,l=s.result.flags.bytes,e=s.result.flags.chars,t=s.result.positional;!o&&!n&&!l&&!e&&(o=n=l=!0);let c=l||e,i=await T(f,t,{cmdName:"wc",stopOnError:!1});if(t.length===0){let r=C(i.files[0].content,e);return{stdout:`${x(r,o,n,c,"",0)}
|
|
3
3
|
`,stderr:"",exitCode:0}}let d=[],m=0,g=0,u=0;for(let{filename:r,content:y}of i.files){let p=C(y,e);m+=p.lines,g+=p.words,u+=p.third,d.push({filename:r,stats:p})}let L=t.length>1?m:Math.max(...d.map(r=>r.stats.lines)),$=t.length>1?g:Math.max(...d.map(r=>r.stats.words)),B=t.length>1?u:Math.max(...d.map(r=>r.stats.third)),h=t.length>1?3:0;o&&(h=Math.max(h,String(L).length)),n&&(h=Math.max(h,String($).length)),c&&(h=Math.max(h,String(B).length));let w="";for(let{filename:r,stats:y}of d)w+=`${x(y,o,n,c,r,h)}
|
|
4
4
|
`;return t.length>1&&(w+=`${x({lines:m,words:g,third:u},o,n,c,"total",h)}
|
|
5
5
|
`),{stdout:w,stderr:i.stderr,exitCode:i.exitCode}}};function C(a,f){let s=a,o=s.length,n=f?Array.from(b(a)).length:o,l=0,e=0,t=!1;for(let c=0;c<o;c++){let i=s[c];i===`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{a as $}from"./chunk-L2UW7DWF.js";import{c as v}from"./chunk-
|
|
2
|
+
import{a as $}from"./chunk-L2UW7DWF.js";import{c as v}from"./chunk-XEKXHOPO.js";import{a as L,b as M,c as w}from"./chunk-QAYAQNCG.js";var N={name:"xargs",summary:"build and execute command lines from standard input",usage:"xargs [OPTION]... [COMMAND [INITIAL-ARGS]]",options:["-I REPLACE replace occurrences of REPLACE with input","-d DELIM use DELIM as input delimiter (e.g., -d '\\n' for newline)","-n NUM use at most NUM arguments per command line","-P NUM run at most NUM processes at a time","-0, --null items are separated by null, not whitespace","-t, --verbose print commands before executing","-r, --no-run-if-empty do not run command if input is empty"," --help display this help and exit"]},U={name:"xargs",async execute(l,i){if(M(l))return L(N);let m=null,g=null,c=null,o=null,h=!1,x=!1,y=!1,s=0;for(let e=0;e<l.length;e++){let t=l[e];if(t==="-I"&&e+1<l.length)m=l[++e],s=e+1;else if(t==="-d"&&e+1<l.length)g=l[++e].replace(/\\n/g,`
|
|
3
3
|
`).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\0/g,"\0").replace(/\\\\/g,"\\"),s=e+1;else if(t==="-n"&&e+1<l.length)c=parseInt(l[++e],10),s=e+1;else if(t==="-P"&&e+1<l.length)o=parseInt(l[++e],10),s=e+1;else if(t==="-0"||t==="--null")h=!0,s=e+1;else if(t==="-t"||t==="--verbose")x=!0,s=e+1;else if(t==="-r"||t==="--no-run-if-empty")y=!0,s=e+1;else{if(t.startsWith("--"))return w("xargs",t);if(t.startsWith("-")&&t.length>1){for(let n of t.slice(1))if(!"0tr".includes(n))return w("xargs",`-${n}`);t.includes("0")&&(h=!0),t.includes("t")&&(x=!0),t.includes("r")&&(y=!0),s=e+1}else if(!t.startsWith("-")){s=e;break}}}let a=l.slice(s);a.length===0&&a.push("echo");let C=v(i.stdin),r;if(h?r=C.split("\0").filter(e=>e.length>0):g!==null?r=C.replace(/\n$/,"").split(g).filter(t=>t.length>0):r=C.split(/\s+/).map(e=>e.trim()).filter(e=>e.length>0),r.length===0)return y?{stdout:"",stderr:"",exitCode:0}:{stdout:"",stderr:"",exitCode:0};let f="",u="",d=0,I=e=>/[\s"'\\$`!*?[\]{}();&|<>#]/.test(e)?`"${e.replace(/([\\"`$])/g,"\\$1")}"`:e,b=async e=>{if(x){let n=e.map(I).join(" ");u+=`${n}
|
|
4
4
|
`}return i.exec?i.exec($([e[0]]),{cwd:i.cwd,signal:i.signal,args:e.slice(1)}):{stdout:`${e.map(I).join(" ")}
|
|
5
5
|
`,stderr:"",exitCode:0}},A=async e=>{if(o!==null&&o>1)for(let t=0;t<e.length;t+=o){let n=e.slice(t,t+o),E=await Promise.all(n.map(b));for(let p of E)f+=p.stdout,u+=p.stderr,p.exitCode!==0&&(d=p.exitCode)}else for(let t of e){let n=await b(t);f+=n.stdout,u+=n.stderr,n.exitCode!==0&&(d=n.exitCode)}};if(m!==null){let e=r.map(t=>a.map(n=>n.replaceAll(m,t)));await A(e)}else if(c!==null){let e=[];for(let t=0;t<r.length;t+=c){let n=r.slice(t,t+c);e.push([...a,...n])}await A(e)}else{let e=[...a,...r],t=await b(e);f+=t.stdout,u+=t.stderr,d=t.exitCode}return{stdout:f,stderr:u,exitCode:d}}},O={name:"xargs",flags:[{flag:"-I",type:"value",valueHint:"string"},{flag:"-d",type:"value",valueHint:"delimiter"},{flag:"-n",type:"value",valueHint:"number"},{flag:"-0",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-r",type:"boolean"}],stdinType:"text"};export{U as a,O as b};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{a as fe}from"./chunk-TDD4NFYE.js";import{a as Y}from"./chunk-
|
|
2
|
+
import{a as fe}from"./chunk-TDD4NFYE.js";import{a as Y}from"./chunk-QAJKDPNS.js";import{a as ne}from"./chunk-L2UW7DWF.js";import{a as te}from"./chunk-7CSMHFIJ.js";import{a as oe,b as pe,c as ce}from"./chunk-27JIFWUR.js";import{a as ie,b as le}from"./chunk-QAYAQNCG.js";function k(e,t){switch(e.type){case"name":{let n=e.pattern,a=n.match(/^\*(\.[a-zA-Z0-9]+)$/);if(a){let s=a[1],o=t.name;if(e.ignoreCase){if(!o.toLowerCase().endsWith(s.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!o.endsWith(s))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Y(t.name,n,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let n=e.pattern,a=t.relativePath,s=n.split("/");for(let i=0;i<s.length-1;i++){let r=s[i];if(r&&r!=="."&&r!==".."&&!r.includes("*")&&!r.includes("?")&&!r.includes("[")){let p=`/${r}/`;if(e.ignoreCase){if(!a.toLowerCase().includes(p.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!a.includes(p))return{matches:!1,pruned:!1,printed:!1}}}let o=n.match(/\*(\.[a-zA-Z0-9]+)$/);if(o){let i=o[1];if(e.ignoreCase){if(!a.toLowerCase().endsWith(i.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!a.endsWith(i))return{matches:!1,pruned:!1,printed:!1}}return{matches:Y(a,n,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let n=e.ignoreCase?"i":"";return{matches:te(e.pattern,n).test(t.relativePath),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case"type":return e.fileType==="f"?{matches:t.isFile,pruned:!1,printed:!1}:e.fileType==="d"?{matches:t.isDirectory,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case"empty":return{matches:t.isEmpty,pruned:!1,printed:!1};case"mtime":{let a=(Date.now()-t.mtime)/(1e3*60*60*24),s;return e.comparison==="more"?s=a>e.days:e.comparison==="less"?s=a<e.days:s=Math.floor(a)===e.days,{matches:s,pruned:!1,printed:!1}}case"newer":{let n=t.newerRefTimes.get(e.refPath);return n===void 0?{matches:!1,pruned:!1,printed:!1}:{matches:t.mtime>n,pruned:!1,printed:!1}}case"size":{let n=e.value;switch(e.unit){case"c":n=e.value;break;case"k":n=e.value*1024;break;case"M":n=e.value*1024*1024;break;case"G":n=e.value*1024*1024*1024;break;case"b":n=e.value*512;break}let a;return e.comparison==="more"?a=t.size>n:e.comparison==="less"?a=t.size<n:e.unit==="b"?a=Math.ceil(t.size/512)===e.value:a=t.size===n,{matches:a,pruned:!1,printed:!1}}case"perm":{let n=t.mode&511,a=e.mode&511,s;return e.matchType==="exact"?s=n===a:e.matchType==="all"?s=(n&a)===a:s=(n&a)!==0,{matches:s,pruned:!1,printed:!1}}case"prune":return{matches:!0,pruned:!0,printed:!1};case"print":return{matches:!0,pruned:!1,printed:!0};case"not":{let n=k(e.expr,t);return{matches:!n.matches,pruned:n.pruned,printed:!1}}case"and":{let n=k(e.left,t);if(!n.matches)return{matches:!1,pruned:n.pruned,printed:!1};let a=k(e.right,t);return{matches:a.matches,pruned:n.pruned||a.pruned,printed:n.printed||a.printed}}case"or":{let n=k(e.left,t);if(n.matches)return n;let a=k(e.right,t);return{matches:a.matches,pruned:n.pruned||a.pruned,printed:a.printed}}}}function _(e){if(!e)return!1;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!1;case"empty":case"mtime":case"newer":case"size":case"perm":return!0;case"not":return _(e.expr);case"and":case"or":return _(e.left)||_(e.right)}}function j(e){if(!e)return!1;switch(e.type){case"empty":return!0;case"not":return j(e.expr);case"and":case"or":return j(e.left)||j(e.right);default:return!1}}function ue(e){let t={terminalDirName:null,requiredExtension:null};if(!e)return t;let n=Ee(e);if(Me(e)&&n.length===1){let o=n[0].split("/").filter(i=>i.length>0);if(o.length>=2)for(let i=o.length-2;i>=0;i--){let r=o[i];if(!r.includes("*")&&!r.includes("?")&&!r.includes("[")&&r!=="."&&r!==".."){let p=o[i+1];if(p&&(p.includes("*")||p.includes("?"))){t.terminalDirName=r;let l=p.match(/^\*(\.[a-zA-Z0-9]+)$/);l&&(t.requiredExtension=l[1])}break}}}return t}function Ee(e){let t=[],n=a=>{a.type==="path"?t.push(a.pattern):a.type==="not"?n(a.expr):(a.type==="and"||a.type==="or")&&(n(a.left),n(a.right))};return n(e),t}function Me(e){let t=n=>n.type==="type"&&n.fileType==="f"?!0:n.type==="not"?t(n.expr):n.type==="and"||n.type==="or"?t(n.left)||t(n.right):!1;return t(e)}function he(e){let t=[],n=a=>{a&&(a.type==="newer"?t.push(a.refPath):a.type==="not"?n(a.expr):(a.type==="and"||a.type==="or")&&(n(a.left),n(a.right)))};return n(e),t}function J(e){if(!e)return!0;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!0;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return J(e.expr);case"and":case"or":return J(e.left)&&J(e.right)}}function L(e,t,n,a,s){switch(e.type){case"name":{let o=e.pattern,i=o.match(/^\*(\.[a-zA-Z0-9]+)$/);if(i){let r=i[1];if(e.ignoreCase){if(!t.toLowerCase().endsWith(r.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!t.endsWith(r))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Y(t,o,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let o=e.pattern,i=o.split("/");for(let p=0;p<i.length-1;p++){let l=i[p];if(l&&l!=="."&&l!==".."&&!l.includes("*")&&!l.includes("?")&&!l.includes("[")){let d=`/${l}/`;if(e.ignoreCase){if(!n.toLowerCase().includes(d.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.includes(d))return{matches:!1,pruned:!1,printed:!1}}}let r=o.match(/\*(\.[a-zA-Z0-9]+)$/);if(r){let p=r[1];if(e.ignoreCase){if(!n.toLowerCase().endsWith(p.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.endsWith(p))return{matches:!1,pruned:!1,printed:!1}}return{matches:Y(n,o,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let o=e.ignoreCase?"i":"";return{matches:te(e.pattern,o).test(n),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case"type":return e.fileType==="f"?{matches:a,pruned:!1,printed:!1}:e.fileType==="d"?{matches:s,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case"prune":return{matches:!0,pruned:!0,printed:!1};case"print":return{matches:!0,pruned:!1,printed:!0};case"not":{let o=L(e.expr,t,n,a,s);return{matches:!o.matches,pruned:o.pruned,printed:!1}}case"and":{let o=L(e.left,t,n,a,s);if(!o.matches)return{matches:!1,pruned:o.pruned,printed:!1};let i=L(e.right,t,n,a,s);return{matches:i.matches,pruned:o.pruned||i.pruned,printed:o.printed||i.printed}}case"or":{let o=L(e.left,t,n,a,s);if(o.matches)return o;let i=L(e.right,t,n,a,s);return{matches:i.matches,pruned:o.pruned||i.pruned,printed:i.printed}}default:return{matches:!1,pruned:!1,printed:!1}}}function V(e){if(!e)return!1;switch(e.type){case"prune":return!0;case"not":return V(e.expr);case"and":case"or":return V(e.left)||V(e.right);default:return!1}}function z(e){switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!0;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return z(e.expr);case"and":case"or":return z(e.left)&&z(e.right)}}function de(e,t){if(!e||!t.isDirectory)return{shouldPrune:!1};if(!z(e))return se(e,t);let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return{shouldPrune:k(e,n).pruned}}function se(e,t){switch(e.type){case"or":{if(z(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};if(k(e.left,n).pruned)return{shouldPrune:!0}}return se(e.right,t)}case"and":{if(z(e.left)&&z(e.right)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return{shouldPrune:k(e,n).pruned}}if(z(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return k(e.left,n).matches?se(e.right,t):{shouldPrune:!1}}return{shouldPrune:!1}}case"not":return{shouldPrune:!1};default:return{shouldPrune:!1}}}function me(e,t){let n=[],a=[],s=t;for(;s<e.length;){let i=e[s];if(i==="("||i==="\\("){n.push({type:"lparen"}),s++;continue}if(i===")"||i==="\\)"){n.push({type:"rparen"}),s++;continue}if(i==="-name"&&s+1<e.length)n.push({type:"expr",expr:{type:"name",pattern:e[++s]}});else if(i==="-iname"&&s+1<e.length)n.push({type:"expr",expr:{type:"name",pattern:e[++s],ignoreCase:!0}});else if(i==="-path"&&s+1<e.length)n.push({type:"expr",expr:{type:"path",pattern:e[++s]}});else if(i==="-ipath"&&s+1<e.length)n.push({type:"expr",expr:{type:"path",pattern:e[++s],ignoreCase:!0}});else if(i==="-regex"&&s+1<e.length)n.push({type:"expr",expr:{type:"regex",pattern:e[++s]}});else if(i==="-iregex"&&s+1<e.length)n.push({type:"expr",expr:{type:"regex",pattern:e[++s],ignoreCase:!0}});else if(i==="-type"&&s+1<e.length){let r=e[++s];if(r==="f"||r==="d")n.push({type:"expr",expr:{type:"type",fileType:r}});else return{expr:null,pathIndex:s,error:`find: Unknown argument to -type: ${r}
|
|
3
3
|
`,actions:[]}}else if(i==="-empty")n.push({type:"expr",expr:{type:"empty"}});else if(i==="-mtime"&&s+1<e.length){let r=e[++s],p="exact",l=r;r.startsWith("+")?(p="more",l=r.slice(1)):r.startsWith("-")&&(p="less",l=r.slice(1));let d=parseInt(l,10);Number.isNaN(d)||n.push({type:"expr",expr:{type:"mtime",days:d,comparison:p}})}else if(i==="-newer"&&s+1<e.length){let r=e[++s];n.push({type:"expr",expr:{type:"newer",refPath:r}})}else if(i==="-size"&&s+1<e.length){let r=e[++s],p="exact",l=r;r.startsWith("+")?(p="more",l=r.slice(1)):r.startsWith("-")&&(p="less",l=r.slice(1));let d=l.match(/^(\d+)([ckMGb])?$/);if(d){let O=parseInt(d[1],10),x=d[2]||"b";n.push({type:"expr",expr:{type:"size",value:O,unit:x,comparison:p}})}}else if(i==="-perm"&&s+1<e.length){let r=e[++s],p="exact",l=r;r.startsWith("-")?(p="all",l=r.slice(1)):r.startsWith("/")&&(p="any",l=r.slice(1));let d=parseInt(l,8);Number.isNaN(d)||n.push({type:"expr",expr:{type:"perm",mode:d,matchType:p}})}else if(i==="-prune")n.push({type:"expr",expr:{type:"prune"}});else if(i==="-not"||i==="!")n.push({type:"not"});else if(i==="-o"||i==="-or")n.push({type:"op",op:"or"});else if(i==="-a"||i==="-and")n.push({type:"op",op:"and"});else if(i==="-maxdepth"||i==="-mindepth")s++;else if(i!=="-depth")if(i==="-exec"){let r=[];for(s++;s<e.length&&e[s]!==";"&&e[s]!=="+";)r.push(e[s]),s++;if(s>=e.length)return{expr:null,pathIndex:s,error:"find: missing argument to `-exec'\n",actions:[]};let p=e[s]==="+";a.push({type:"exec",command:r,batchMode:p})}else if(i==="-print")n.push({type:"expr",expr:{type:"print"}}),a.push({type:"print"});else if(i==="-print0")a.push({type:"print0"});else if(i==="-printf"&&s+1<e.length){let r=e[++s];a.push({type:"printf",format:r})}else if(i==="-delete")a.push({type:"delete"});else{if(i.startsWith("-"))return{expr:null,pathIndex:s,error:`find: unknown predicate '${i}'
|
|
4
4
|
`,actions:[]};if(n.length===0){s++;continue}break}s++}if(n.length===0)return{expr:null,pathIndex:s,actions:a};let o=Fe(n);return o.error?{expr:null,pathIndex:s,error:o.error,actions:a}:{expr:o.expr,pathIndex:s,actions:a}}function Fe(e){let t=0;function n(){let r=a();if(!r)return null;for(;t<e.length;){let p=e[t];if(p.type==="op"&&p.op==="or"){t++;let l=a();if(!l)return r;r={type:"or",left:r,right:l}}else break}return r}function a(){let r=s();if(!r)return null;for(;t<e.length;){let p=e[t];if(p.type==="op"&&p.op==="and"){t++;let l=s();if(!l)return r;r={type:"and",left:r,right:l}}else if(p.type==="expr"||p.type==="not"||p.type==="lparen"){let l=s();if(!l)return r;r={type:"and",left:r,right:l}}else break}return r}function s(){if(t<e.length&&e[t].type==="not"){t++;let r=s();return r?{type:"not",expr:r}:null}return o()}function o(){if(t>=e.length)return null;let r=e[t];if(r.type==="lparen"){t++;let p=n();return t<e.length&&e[t].type==="rparen"&&t++,p}return r.type==="expr"?(t++,r.expr):(r.type==="rparen",null)}return{expr:n()}}var ye=500;function Ie(){return{readdirCalls:0,readdirTime:0,statCalls:0,statTime:0,evalCalls:0,evalTime:0,nodeCount:0,batchCount:0,batchTime:0,earlyPrunes:0}}function xe(e,t,n){e({category:"find",name:"summary",durationMs:n,details:{readdirCalls:t.readdirCalls,readdirTimeMs:t.readdirTime,statCalls:t.statCalls,statTimeMs:t.statTime,evalCalls:t.evalCalls,evalTimeMs:t.evalTime,nodeCount:t.nodeCount,batchCount:t.batchCount,batchTimeMs:t.batchTime,earlyPrunes:t.earlyPrunes,otherTimeMs:n-t.readdirTime-t.statTime-t.evalTime-t.batchTime}})}var $e={name:"find",summary:"search for files in a directory hierarchy",usage:"find [path...] [expression]",options:["-name PATTERN file name matches shell pattern PATTERN","-iname PATTERN like -name but case insensitive","-path PATTERN file path matches shell pattern PATTERN","-ipath PATTERN like -path but case insensitive","-regex PATTERN file path matches regular expression PATTERN","-iregex PATTERN like -regex but case insensitive","-type TYPE file is of type: f (regular file), d (directory)","-empty file is empty or directory is empty","-mtime N file's data was modified N*24 hours ago","-newer FILE file was modified more recently than FILE","-size N[ckMGb] file uses N units of space (c=bytes, k=KB, M=MB, G=GB, b=512B blocks)","-perm MODE file's permission bits are exactly MODE (octal)","-perm -MODE all permission bits MODE are set","-perm /MODE any permission bits MODE are set","-maxdepth LEVELS descend at most LEVELS directories","-mindepth LEVELS do not apply tests at levels less than LEVELS","-depth process directory contents before directory itself","-prune do not descend into this directory","-not, ! negate the following expression","-a, -and logical AND (default)","-o, -or logical OR","-exec CMD {} ; execute CMD on each file ({} is replaced by filename)","-exec CMD {} + execute CMD with multiple files at once","-print print the full file name (default action)","-print0 print the full file name followed by a null character","-printf FORMAT print FORMAT with directives: %f %h %p %P %s %d %m %M %t","-delete delete found files/directories"," --help display this help and exit"]},Re=new Set(["-name","-iname","-path","-ipath","-regex","-iregex","-type","-maxdepth","-mindepth","-mtime","-newer","-size","-perm"]),je={name:"find",async execute(e,t){if(le(e))return ie($e);let n=[],a=null,s=null,o=!1,i=!1;for(let c=0;c<e.length;c++){let f=e[c];if(f==="-maxdepth"&&c+1<e.length)i=!0,a=parseInt(e[++c],10);else if(f==="-mindepth"&&c+1<e.length)i=!0,s=parseInt(e[++c],10);else if(f==="-depth")i=!0,o=!0;else if(f==="-exec")for(i=!0,c++;c<e.length&&e[c]!==";"&&e[c]!=="+";)c++;else!f.startsWith("-")&&f!==";"&&f!=="+"&&f!=="("&&f!==")"&&f!=="\\("&&f!=="\\)"&&f!=="!"?i||n.push(f):Re.has(f)?(i=!0,c++):(f.startsWith("-")||f==="("||f==="\\("||f==="!")&&(i=!0)}n.length===0&&n.push(".");let{expr:r,error:p,actions:l}=me(e,0);if(p)return{stdout:"",stderr:p,exitCode:1};let d=l.some(c=>c.type==="print"),O=l.length===0,x=[],ge=l.some(c=>c.type==="printf"),re=[],B="",q=0,we=he(r),U=new Map;for(let c of we){let f=t.fs.resolvePath(t.cwd,c);try{let u=await t.fs.stat(f);U.set(c,u.mtime?.getTime()??Date.now())}catch{}}let De=l.some(c=>{if(c.type!=="printf")return!1;let f=c.format.replace(/%%/g,"");return/%[-+]?[0-9]*\.?[0-9]*(s|m|M|t|T)/.test(f)}),Te=_(r)||De,Ce=j(r),K=ue(r),ae=V(r),Pe=J(r),Se=typeof t.fs.readdirWithFileTypes=="function";for(let c of n){let G=function(h){let $=s===null||h.depth>=s,P=!1;if($&&r!==null){let S=Date.now(),y;if(Pe)y=L(r,h.name,h.relativePath,h.isFile,h.isDirectory);else{let m={name:h.name,relativePath:h.relativePath,isFile:h.isFile,isDirectory:h.isDirectory,isEmpty:h.isEmpty,mtime:h.stat?.mtime?.getTime()??Date.now(),size:h.stat?.size??0,mode:h.stat?.mode??420,newerRefTimes:U};y=k(r,m)}$=y.matches,P=d?y.printed:$,u.evalCalls++,u.evalTime+=Date.now()-S}else $&&(P=!0);return P?{print:!0,printfData:ge?{path:h.relativePath,name:h.name,size:h.stat?.size??0,mtime:h.stat?.mtime?.getTime()??Date.now(),mode:h.stat?.mode??420,isDirectory:h.isDirectory,depth:h.depth,startingPoint:c}:null}:{print:!1,printfData:null}};var We=G;c.length>1&&c.endsWith("/")&&(c=c.slice(0,-1));let f=t.fs.resolvePath(t.cwd,c);try{await t.fs.stat(f)}catch{B+=`find: ${c}: No such file or directory
|
|
5
5
|
`,q=1;continue}let u=Ie(),M=Date.now();async function N(h){let{path:b,depth:$,typeInfo:P}=h;if(u.nodeCount++,$>(a??256))return null;let v,S,y;if(P&&!Te)v=P.isFile,S=P.isDirectory;else{try{let A=Date.now();y=await t.fs.stat(b),u.statCalls++,u.statTime+=Date.now()-A}catch{return null}if(!y)return null;v=y.isFile,S=y.isDirectory}let m;b===f?m=c.split("/").pop()||c:m=b.split("/").pop()||"";let g=b===f?c:c==="."?`./${b.slice(f==="/"?f.length:f.length+1)}`:c+b.slice(f.length),T=[],C=null,w=null,D=!1;S&&ae&&!o&&(D=de(r,{name:m,relativePath:g,isFile:v,isDirectory:S}).shouldPrune,D&&u.earlyPrunes++);let F=$>=(a??256),I=K.terminalDirName!==null&&m===K.terminalDirName,Z=!F&&!I&&!D;if(S&&((Z||Ce||I)&&!D)){let A=Date.now();if(Se&&t.fs.readdirWithFileTypes){if(C=await t.fs.readdirWithFileTypes(b),w=C.map(E=>E.name),u.readdirCalls++,u.readdirTime+=Date.now()-A,Z)T=C.map((E,R)=>({path:b==="/"?`/${E.name}`:`${b}/${E.name}`,depth:$+1,typeInfo:{isFile:E.isFile,isDirectory:E.isDirectory},resultIndex:R}));else if(I){let E=K.requiredExtension;T=C.filter(R=>R.isFile&&(!E||R.name.endsWith(E))).map((R,ve)=>({path:b==="/"?`/${R.name}`:`${b}/${R.name}`,depth:$+1,typeInfo:{isFile:R.isFile,isDirectory:R.isDirectory},resultIndex:ve}))}}else w=await t.fs.readdir(b),u.readdirCalls++,u.readdirTime+=Date.now()-A,Z&&(T=w.map((E,R)=>({path:b==="/"?`/${E}`:`${b}/${E}`,depth:$+1,resultIndex:R})))}let Q=v?(y?.size??0)===0:w!==null&&w.length===0,H=D;if(!o&&r!==null&&!D&&ae){let A=Date.now(),E={name:m,relativePath:g,isFile:v,isDirectory:S,isEmpty:Q,mtime:y?.mtime?.getTime()??Date.now(),size:y?.size??0,mode:y?.mode??420,newerRefTimes:U};H=k(r,E).pruned,u.evalCalls++,u.evalTime+=Date.now()-A}return{relativePath:g,name:m,isFile:v,isDirectory:S,isEmpty:Q,stat:y,depth:$,children:H?[]:T,pruned:H}}async function be(){let h={paths:[],printfData:[]};if(o){let y=function(m){let g={paths:[],printfData:[]},T=P[m];if(!T)return g;for(let D of T.childIndices){let F=y(D);g.paths.push(...F.paths),g.printfData.push(...F.printfData)}let{print:C,printfData:w}=G(T.node);return C&&(g.paths.push(T.node.relativePath),w&&g.printfData.push(w)),g};var b=y;let P=[],v=[{item:{path:f,depth:0,resultIndex:0},parentIndex:-1,childOrderInParent:0}],S=new Map;for(;v.length>0;){let m=Date.now(),g=v.splice(0,ye),T=await Promise.all(g.map(C=>N(C.item)));u.batchCount++,u.batchTime+=Date.now()-m;for(let C=0;C<g.length;C++){let w=T[C],D=g[C];if(!w)continue;let F=P.length;if(D.parentIndex>=0){let I=S.get(D.parentIndex)||[];I.push(F),S.set(D.parentIndex,I)}P.push({node:w,parentIndex:D.parentIndex,childIndices:[]});for(let I=0;I<w.children.length;I++)v.push({item:w.children[I],parentIndex:F,childOrderInParent:I})}}for(let[m,g]of S)m>=0&&m<P.length&&(P[m].childIndices=g);if(P.length>0){let m=y(0);h.paths.push(...m.paths),h.printfData.push(...m.printfData)}}else{let m=function(g){let T=P.get(g);T&&(h.paths.push(T.path),T.printfData&&h.printfData.push(T.printfData));let C=y.get(g);if(C)for(let w of C)m(w)};var $=m;let P=new Map,v=0,S=[{item:{path:f,depth:0,resultIndex:0},orderIndex:v++}],y=new Map;for(;S.length>0;){let g=Date.now(),T=S.splice(0,ye),C=await Promise.all(T.map(async({item:w,orderIndex:D})=>{let F=await N(w);return F?{node:F,orderIndex:D}:null}));u.batchCount++,u.batchTime+=Date.now()-g;for(let w of C){if(!w)continue;let{node:D,orderIndex:F}=w,{print:I,printfData:Z}=G(D);if(I&&P.set(F,{path:D.relativePath,printfData:Z}),D.children.length>0){let ee=[];for(let Q of D.children){let H=v++;ee.push(H),S.push({item:Q,orderIndex:H})}y.set(F,ee)}}}m(0)}return h}let X=await be();if(x.push(...X.paths),re.push(...X.printfData),t.trace){let h=Date.now()-M;xe(t.trace,u,h),t.trace({category:"find",name:"searchPath",durationMs:h,details:{path:c,resultsFound:X.paths.length}})}}let W="";if(l.length>0)for(let c of l)switch(c.type){case"print":W+=x.length>0?`${x.join(`
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{d as b,f as g}from"./chunk-XEKXHOPO.js";import{c as p}from"./chunk-QAYAQNCG.js";function $(t,i){let r=10,s=null,f=!1,l=!1,n=!1,u=[];for(let o=0;o<t.length;o++){let e=t[o];if(e==="-n"&&o+1<t.length){let a=t[++o];i==="tail"&&a.startsWith("+")?(n=!0,r=parseInt(a.slice(1),10)):r=parseInt(a,10)}else if(i==="tail"&&e.startsWith("-n+"))n=!0,r=parseInt(e.slice(3),10);else if(e.startsWith("-n"))r=parseInt(e.slice(2),10);else if(e==="-c"&&o+1<t.length)s=parseInt(t[++o],10);else if(e.startsWith("-c"))s=parseInt(e.slice(2),10);else if(e.startsWith("--bytes="))s=parseInt(e.slice(8),10);else if(e.startsWith("--lines="))r=parseInt(e.slice(8),10);else if(e==="-q"||e==="--quiet"||e==="--silent")f=!0;else if(e==="-v"||e==="--verbose")l=!0;else if(e.match(/^-\d+$/))r=parseInt(e.slice(1),10);else{if(e.startsWith("--"))return{ok:!1,error:p(i,e)};if(e.startsWith("-")&&e!=="-")return{ok:!1,error:p(i,e)};u.push(e)}}return s!==null&&(Number.isNaN(s)||s<0)?{ok:!1,error:{stdout:"",stderr:`${i}: invalid number of bytes
|
|
3
|
+
`,exitCode:1}}:Number.isNaN(r)||r<0?{ok:!1,error:{stdout:"",stderr:`${i}: invalid number of lines
|
|
4
|
+
`,exitCode:1}}:{ok:!0,options:{lines:r,bytes:s,quiet:f,verbose:l,files:u,fromLine:n}}}async function k(t,i,r,s){let{quiet:f,verbose:l,files:n}=i;if(n.length===0)return{stdout:s(t.stdin),stderr:"",exitCode:0,stdoutEncoding:"binary"};let u="",o="",e=0,a=l||!f&&n.length>1,d=0;for(let h=0;h<n.length;h++){let c=n[h];try{let x=t.fs.resolvePath(t.cwd,c),w=await g(t.fs,x);a&&(d>0&&(u+=`
|
|
5
|
+
`),u+=b(`==> ${c} <==
|
|
6
|
+
`)),u+=s(w),d++}catch{o+=`${r}: ${c}: No such file or directory
|
|
7
|
+
`,e=1}}return{stdout:u,stderr:o,exitCode:e,stdoutEncoding:"binary"}}function v(t,i,r){if(r!==null)return t.slice(0,r);if(i===0)return"";let s=0,f=0,l=t.length;for(;s<l&&f<i;){let n=t.indexOf(`
|
|
8
|
+
`,s);if(n===-1)return`${t}
|
|
9
|
+
`;f++,s=n+1}return s>0?t.slice(0,s):""}function C(t,i,r,s){if(r!==null)return t.slice(-r);let f=t.length;if(f===0)return"";if(s){let o=0,e=1;for(;o<f&&e<i;){let d=t.indexOf(`
|
|
10
|
+
`,o);if(d===-1)break;e++,o=d+1}let a=t.slice(o);return a.endsWith(`
|
|
11
|
+
`)?a:`${a}
|
|
12
|
+
`}if(i===0)return"";let l=f-1;t[l]===`
|
|
13
|
+
`&&l--;let n=0;for(;l>=0&&n<i;){if(t[l]===`
|
|
14
|
+
`&&(n++,n===i)){l++;break}l--}l<0&&(l=0);let u=t.slice(l);return t[f-1]===`
|
|
15
|
+
`?u:`${u}
|
|
16
|
+
`}export{$ as a,k as b,v as c,C as d};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{c as d}from"./chunk-
|
|
2
|
+
import{c as d}from"./chunk-XEKXHOPO.js";import{a as f,b as c,c as u}from"./chunk-QAYAQNCG.js";var x={name:"expand",summary:"convert tabs to spaces",usage:"expand [OPTION]... [FILE]...",description:"Convert TABs in each FILE to spaces, writing to standard output. If no FILE is specified, standard input is read.",options:["-t N Use N spaces per tab (default: 8)","-t LIST Use comma-separated list of tab stops","-i Only convert leading tabs on each line"],examples:["expand file.txt # Convert all tabs to 8 spaces","expand -t 4 file.txt # Use 4-space tabs","expand -t 4,8,12 file.txt # Custom tab stops"]};function p(n){let i=n.split(",").map(o=>o.trim()),t=[];for(let o of i){let e=parseInt(o,10);if(Number.isNaN(e)||e<1)return null;t.push(e)}for(let o=1;o<t.length;o++)if(t[o]<=t[o-1])return null;return t}function g(n,i){if(i.length===1){let t=i[0];return t-n%t}for(let t of i)if(t>n)return t-n;if(i.length>=2){let t=i[i.length-1]-i[i.length-2],o=i[i.length-1],e=Math.floor((n-o)/t)+1;return o+e*t-n}return 1}function b(n,i){let{tabStops:t,leadingOnly:o}=i,e="",r=0,s=!0;for(let a of n)if(a===" ")if(o&&!s)e+=a,r++;else{let l=g(r,t);e+=" ".repeat(l),r+=l}else a!==" "&&a!==" "&&(s=!1),e+=a,r++;return e}function h(n,i){if(n==="")return"";let t=n.split(`
|
|
3
3
|
`),o=n.endsWith(`
|
|
4
4
|
`)&&t[t.length-1]==="";return o&&t.pop(),t.map(r=>b(r,i)).join(`
|
|
5
5
|
`)+(o?`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{a as r}from"./chunk-
|
|
2
|
+
import{a as r}from"./chunk-7CSMHFIJ.js";var g=2048,o=new Map;function u(l,c,t){let s=typeof t=="boolean"?{ignoreCase:t}:t??{},e=c;s.stripQuotes&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1));let i=s.ignoreCase?`i:${e}`:e,n=o.get(i);if(!n){if(n=a(e,s.ignoreCase),o.size>=g){let f=o.keys().next().value;f!==void 0&&o.delete(f)}o.set(i,n)}return n.test(l)}function a(l,c){let t="^";for(let s=0;s<l.length;s++){let e=l[s];if(e==="*")t+=".*";else if(e==="?")t+=".";else if(e==="["){let i=s+1;for(;i<l.length&&l[i]!=="]";)i++;t+=l.slice(s,i+1),s=i}else e==="."||e==="+"||e==="^"||e==="$"||e==="{"||e==="}"||e==="("||e===")"||e==="|"||e==="\\"?t+=`\\${e}`:t+=e}return t+="$",r(t,c?"i":"")}export{u as a};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{c as p}from"./chunk-
|
|
2
|
+
import{c as p}from"./chunk-XEKXHOPO.js";import{a as h,b as w,c as b}from"./chunk-QAYAQNCG.js";var g={name:"fold",summary:"wrap each input line to fit in specified width",usage:"fold [OPTION]... [FILE]...",description:"Wrap input lines in each FILE, writing to standard output. If no FILE is specified, standard input is read.",options:["-w WIDTH Use WIDTH columns instead of 80","-s Break at spaces","-b Count bytes rather than columns"],examples:["fold -w 40 file.txt # Wrap at 40 columns","fold -sw 40 file.txt # Word wrap at 40 columns","echo 'long line' | fold -w 5 # Force wrap at 5"]};function y(s,r,n){return n?new TextEncoder().encode(s).length:s===" "?8-r%8:s==="\b"?-1:1}function N(s,r){if(s.length===0)return s;let{width:n,breakAtSpaces:u,countBytes:i}=r,l=[],e="",t=0,o=-1,f=0;for(let c=0;c<s.length;c++){let a=s[c],d=y(a,t,i);t+d>n&&e.length>0?u&&o>=0?(l.push(e.slice(0,o+1)),e=e.slice(o+1)+a,t=t-f-1+d,o=-1,f=0):(l.push(e),e=a,t=d,o=-1,f=0):(e+=a,t+=d,(a===" "||a===" ")&&(o=e.length-1,f=t-d))}return e.length>0&&l.push(e),l.join(`
|
|
3
3
|
`)}function m(s,r){if(s==="")return"";let n=s.split(`
|
|
4
4
|
`),u=s.endsWith(`
|
|
5
5
|
`)&&n[n.length-1]==="";return u&&n.pop(),n.map(l=>N(l,r)).join(`
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
function M(r,o,a){let e=new Date(o*1e3),t="",n=0;for(;n<r.length;)if(r[n]==="%"&&n+1<r.length){let u=r[n+1],i=S(e,u,a);i!==null?(t+=i,n+=2):(t+=r[n],n++)}else t+=r[n],n++;return t}function f(r,o){let a={year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",weekday:"short",hour12:!1,timeZone:o};try{let t=new Intl.DateTimeFormat("en-US",a).formatToParts(r),n=c=>t.find(m=>m.type===c)?.value??"",u=new Map([["Sun",0],["Mon",1],["Tue",2],["Wed",3],["Thu",4],["Fri",5],["Sat",6]]),i=n("weekday"),s=(c,m)=>{let y=Number.parseInt(c,10);return Number.isNaN(y)?m:y};return{year:s(n("year"),r.getFullYear()),month:s(n("month"),r.getMonth()+1),day:s(n("day"),r.getDate()),hour:s(n("hour"),r.getHours())%24,minute:s(n("minute"),r.getMinutes()),second:s(n("second"),r.getSeconds()),weekday:u.get(i)??r.getDay()}}catch{return{year:r.getFullYear(),month:r.getMonth()+1,day:r.getDate(),hour:r.getHours(),minute:r.getMinutes(),second:r.getSeconds(),weekday:r.getDay()}}}function S(r,o,a){let e=f(r,a),t=(s,c=2)=>String(s).padStart(c,"0"),n=g(e.year,e.month,e.day),u=d(e.year,e.month,e.day,e.weekday,0),i=d(e.year,e.month,e.day,e.weekday,1);switch(o){case"a":return["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][e.weekday];case"A":return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][e.weekday];case"b":case"h":return["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.month-1];case"B":return["January","February","March","April","May","June","July","August","September","October","November","December"][e.month-1];case"c":return`${["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][e.weekday]} ${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.month-1]} ${String(e.day).padStart(2," ")} ${t(e.hour)}:${t(e.minute)}:${t(e.second)} ${e.year}`;case"C":return t(Math.floor(e.year/100));case"d":return t(e.day);case"D":return`${t(e.month)}/${t(e.day)}/${t(e.year%100)}`;case"e":return String(e.day).padStart(2," ");case"F":return`${e.year}-${t(e.month)}-${t(e.day)}`;case"g":return t(h(e.year,e.month,e.day)%100);case"G":return String(h(e.year,e.month,e.day));case"H":return t(e.hour);case"I":return t(e.hour%12||12);case"j":return String(n).padStart(3,"0");case"k":return String(e.hour).padStart(2," ");case"l":return String(e.hour%12||12).padStart(2," ");case"m":return t(e.month);case"M":return t(e.minute);case"n":return`
|
|
3
|
+
`;case"N":return"000000000";case"p":return e.hour<12?"AM":"PM";case"P":return e.hour<12?"am":"pm";case"r":return`${t(e.hour%12||12)}:${t(e.minute)}:${t(e.second)} ${e.hour<12?"AM":"PM"}`;case"R":return`${t(e.hour)}:${t(e.minute)}`;case"s":return String(Math.floor(r.getTime()/1e3));case"S":return t(e.second);case"t":return" ";case"T":return`${t(e.hour)}:${t(e.minute)}:${t(e.second)}`;case"u":return String(e.weekday===0?7:e.weekday);case"U":return t(u);case"V":return t($(e.year,e.month,e.day));case"w":return String(e.weekday);case"W":return t(i);case"x":return`${t(e.month)}/${t(e.day)}/${t(e.year%100)}`;case"X":return`${t(e.hour)}:${t(e.minute)}:${t(e.second)}`;case"y":return t(e.year%100);case"Y":return String(e.year);case"z":return l(r,a);case"Z":return p(r,a);case"%":return"%";default:return null}}function l(r,o){if(!o){let u=-r.getTimezoneOffset(),i=u>=0?"+":"-",s=Math.floor(Math.abs(u)/60),c=Math.abs(u)%60;return`${i}${String(s).padStart(2,"0")}${String(c).padStart(2,"0")}`}try{let s=new Intl.DateTimeFormat("en-US",{timeZone:o,timeZoneName:"longOffset"}).formatToParts(r).find(c=>c.type==="timeZoneName");if(s){let c=s.value.match(/GMT([+-])(\d{2}):(\d{2})/);if(c)return`${c[1]}${c[2]}${c[3]}`;if(s.value==="GMT"||s.value==="UTC")return"+0000"}}catch{}let a=-r.getTimezoneOffset(),e=a>=0?"+":"-",t=Math.floor(Math.abs(a)/60),n=Math.abs(a)%60;return`${e}${String(t).padStart(2,"0")}${String(n).padStart(2,"0")}`}function p(r,o){try{return new Intl.DateTimeFormat("en-US",{timeZone:o,timeZoneName:"short"}).formatToParts(r).find(n=>n.type==="timeZoneName")?.value??"UTC"}catch{return"UTC"}}function g(r,o,a){let e=[31,28,31,30,31,30,31,31,30,31,30,31];(r%4===0&&r%100!==0||r%400===0)&&(e[1]=29);let n=a;for(let u=0;u<o-1;u++)n+=e[u];return n}function d(r,o,a,e,t){let n=g(r,o,a),u=new Date(r,0,1).getDay(),i=1+(7+t-u)%7,s=n-i;return s<0?0:Math.floor(s/7)+1}function $(r,o,a){let e=new Date(r,o-1,a,12,0,0);e.setDate(e.getDate()+3-(e.getDay()+6)%7);let t=new Date(e.getFullYear(),0,4);t.setDate(t.getDate()+3-(t.getDay()+6)%7);let n=e.getTime()-t.getTime();return 1+Math.round(n/(10080*60*1e3))}function h(r,o,a){let e=new Date(r,o-1,a,12,0,0);return e.setDate(e.getDate()+3-(e.getDay()+6)%7),e.getFullYear()}export{M as a};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{c as f}from"./chunk-
|
|
2
|
+
import{c as f}from"./chunk-XEKXHOPO.js";import{a as m,b as c,c as b}from"./chunk-QAYAQNCG.js";var p={name:"nl",summary:"number lines of files",usage:"nl [OPTION]... [FILE]...",description:"Write each FILE to standard output, with line numbers added. If no FILE is specified, standard input is read.",options:["-b STYLE Body numbering style: a (all), t (non-empty), n (none)","-n FORMAT Number format: ln (left), rn (right), rz (right zeros)","-w WIDTH Number width (default: 6)","-s SEP Separator after number (default: TAB)","-v START Starting line number (default: 1)","-i INCR Line number increment (default: 1)"],examples:["nl file.txt # Number non-empty lines","nl -ba file.txt # Number all lines","nl -n rz -w 3 file.txt # Right-justified with zeros","nl -s ': ' file.txt # Use ': ' as separator"]};function N(r,s,i){let l=String(r);switch(s){case"ln":return l.padEnd(i);case"rn":return l.padStart(i);case"rz":return l.padStart(i,"0");default:return s}}function v(r,s){switch(s){case"a":return!0;case"t":return r.trim().length>0;case"n":return!1;default:return s}}function h(r,s,i){if(r==="")return{output:"",nextNumber:i};let l=r.split(`
|
|
3
3
|
`),t=[],u=i,a=r.endsWith(`
|
|
4
4
|
`)&&l[l.length-1]==="";a&&l.pop();for(let n of l)if(v(n,s.bodyStyle)){let e=N(u,s.numberFormat,s.width);t.push(`${e}${s.separator}${n}`),u+=s.increment}else{let e=" ".repeat(s.width);t.push(`${e}${s.separator}${n}`)}return{output:t.join(`
|
|
5
5
|
`)+(a?`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{c as f}from"./chunk-
|
|
2
|
+
import{c as f}from"./chunk-XEKXHOPO.js";import{a,b as c,c as d}from"./chunk-QAYAQNCG.js";var u={name:"rev",summary:"reverse lines characterwise",usage:"rev [file ...]",description:"Copies the specified files to standard output, reversing the order of characters in every line. If no files are specified, standard input is read.",examples:["echo 'hello' | rev # Output: olleh","rev file.txt # Reverse each line in file"]};function p(r){return Array.from(r).reverse().join("")}var g={name:"rev",execute:async(r,s)=>{if(c(r))return a(u);let o=[];for(let e of r)if(e==="--"){let t=r.indexOf(e);o.push(...r.slice(t+1));break}else{if(e.startsWith("-")&&e!=="-")return d("rev",e);o.push(e)}let n="",l=e=>{let t=e.split(`
|
|
3
3
|
`),i=e.endsWith(`
|
|
4
4
|
`)&&t[t.length-1]==="";return i&&t.pop(),t.map(p).join(`
|
|
5
5
|
`)+(i?`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{b as e}from"./chunk-
|
|
2
|
+
import{b as e}from"./chunk-VACKIICN.js";var i=globalThis.setTimeout.bind(globalThis),r=globalThis.clearTimeout.bind(globalThis),s=globalThis.setInterval.bind(globalThis),T=globalThis.clearInterval.bind(globalThis);function l(t){return typeof t!="function"?t:e.bindCurrentContext(t)}var b=((t,n,...o)=>i(l(t),n,...o)),u=r;export{b as a,u as b};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{c as j,d as y}from"./chunk-
|
|
2
|
+
import{c as j,d as y}from"./chunk-XEKXHOPO.js";import{a as g,b as v,c as F}from"./chunk-QAYAQNCG.js";var N={name:"join",summary:"join lines of two files on a common field",usage:"join [OPTION]... FILE1 FILE2",description:"For each pair of input lines with identical join fields, write a line to standard output. The default join field is the first, delimited by blanks.",options:["-1 FIELD Join on this FIELD of file 1 (default: 1)","-2 FIELD Join on this FIELD of file 2 (default: 1)","-t CHAR Use CHAR as input and output field separator","-a FILENUM Also print unpairable lines from file FILENUM (1 or 2)","-v FILENUM Like -a but only output unpairable lines","-e STRING Replace missing fields with STRING","-o FORMAT Output format (comma-separated list of FILENUM.FIELD)","-i Ignore case when comparing fields"],examples:["join file1 file2 # Join on first field","join -1 2 -2 1 file1 file2 # Join file1 col 2 with file2 col 1","join -t ',' file1.csv file2.csv # Join CSV files","join -a 1 file1 file2 # Left outer join"]};function I(i,s){return s?i.split(s):i.split(/[ \t]+/).filter(n=>n.length>0)}function L(i,s,n,f){let e=I(i,s),r=e[n-1]??"";return f&&(r=r.toLowerCase()),{fields:e,joinKey:r,original:i}}function m(i,s,n){let f=n.separator??" ";if(n.outputFormat){let l=[];for(let{file:c,field:p}of n.outputFormat){let a=c===1?i:s;a&&p===0?l.push(a.joinKey):a&&a.fields[p-1]!==void 0?l.push(a.fields[p-1]):l.push(n.emptyString)}return l.join(f)}let e=[],r=i?.joinKey??s?.joinKey??"";if(e.push(r),i)for(let l=0;l<i.fields.length;l++)l!==n.field1-1&&e.push(i.fields[l]);if(s)for(let l=0;l<s.fields.length;l++)l!==n.field2-1&&e.push(s.fields[l]);return e.join(f)}function U(i){let s=i.split(","),n=[];for(let f of s){let e=f.trim().match(/^(\d+)\.(\d+)$/);if(!e)return null;let r=Number.parseInt(e[1],10),l=Number.parseInt(e[2],10);if(r!==1&&r!==2)return null;n.push({file:r,field:l})}return n}var E={name:"join",execute:async(i,s)=>{if(v(i))return g(N);let n={field1:1,field2:1,separator:null,printUnpairable:new Set,onlyUnpairable:new Set,emptyString:"",outputFormat:null,ignoreCase:!1},f=[],e=0;for(;e<i.length;){let t=i[e];if(t==="-1"&&e+1<i.length){let o=Number.parseInt(i[e+1],10);if(Number.isNaN(o)||o<1)return{exitCode:1,stdout:"",stderr:`join: invalid field number: '${i[e+1]}'
|
|
3
3
|
`};n.field1=o,e+=2}else if(t==="-2"&&e+1<i.length){let o=Number.parseInt(i[e+1],10);if(Number.isNaN(o)||o<1)return{exitCode:1,stdout:"",stderr:`join: invalid field number: '${i[e+1]}'
|
|
4
4
|
`};n.field2=o,e+=2}else if((t==="-t"||t==="--field-separator")&&e+1<i.length)n.separator=i[e+1],e+=2;else if(t.startsWith("-t")&&t.length>2)n.separator=t.slice(2),e++;else if(t==="-a"&&e+1<i.length){let o=Number.parseInt(i[e+1],10);if(o!==1&&o!==2)return{exitCode:1,stdout:"",stderr:`join: invalid file number: '${i[e+1]}'
|
|
5
5
|
`};n.printUnpairable.add(o),e+=2}else if(t.match(/^-a[12]$/))n.printUnpairable.add(Number.parseInt(t[2],10)),e++;else if(t==="-v"&&e+1<i.length){let o=Number.parseInt(i[e+1],10);if(o!==1&&o!==2)return{exitCode:1,stdout:"",stderr:`join: invalid file number: '${i[e+1]}'
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{a as n,b as i,c as r}from"./chunk-
|
|
2
|
+
import{a as n,b as i,c as r}from"./chunk-PDUL32DM.js";import{a,b as s}from"./chunk-QAYAQNCG.js";var f={name:"head",summary:"output the first part of files",usage:"head [OPTION]... [FILE]...",options:["-c, --bytes=NUM print the first NUM bytes","-n, --lines=NUM print the first NUM lines (default 10)","-q, --quiet never print headers giving file names","-v, --verbose always print headers giving file names"," --help display this help and exit"]},m={name:"head",async execute(t,l){if(s(t))return a(f);let e=n(t,"head");if(!e.ok)return e.error;let{lines:o,bytes:p}=e.options;return i(l,e.options,"head",d=>r(d,o,p))}},g={name:"head",flags:[{flag:"-n",type:"value",valueHint:"number"},{flag:"-c",type:"value",valueHint:"number"},{flag:"-q",type:"boolean"},{flag:"-v",type:"boolean"}],stdinType:"text",needsFiles:!0};export{m as a,g as b};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{a as
|
|
2
|
+
import{a as f}from"./chunk-BZUGFHVS.js";function v(){let a=[{prop:"Function",target:globalThis,violationType:"function_constructor",strategy:"throw",reason:"Function constructor allows arbitrary code execution"},{prop:"eval",target:globalThis,violationType:"eval",strategy:"throw",reason:"eval() allows arbitrary code execution"},{prop:"setTimeout",target:globalThis,violationType:"setTimeout",strategy:"throw",reason:"setTimeout with string argument allows code execution"},{prop:"setInterval",target:globalThis,violationType:"setInterval",strategy:"throw",reason:"setInterval with string argument allows code execution"},{prop:"setImmediate",target:globalThis,violationType:"setImmediate",strategy:"throw",reason:"setImmediate could be used to escape sandbox context"},{prop:"env",target:process,violationType:"process_env",strategy:"throw",reason:"process.env could leak sensitive environment variables",allowedKeys:new Set(["NODE_V8_COVERAGE","NODE_DEBUG","NODE_DEBUG_NATIVE","NODE_COMPILE_CACHE","WATCH_REPORT_DEPENDENCIES","FORCE_COLOR","DEBUG","UNDICI_NO_FG","JEST_WORKER_ID","__MINIMATCH_TESTING_PLATFORM__","LOG_TOKENS","LOG_STREAM"])},{prop:"binding",target:process,violationType:"process_binding",strategy:"throw",reason:"process.binding provides access to native Node.js modules"},{prop:"_linkedBinding",target:process,violationType:"process_binding",strategy:"throw",reason:"process._linkedBinding provides access to native Node.js modules"},{prop:"dlopen",target:process,violationType:"process_dlopen",strategy:"throw",reason:"process.dlopen allows loading native addons"},{prop:"getBuiltinModule",target:process,violationType:"process_get_builtin_module",strategy:"throw",reason:"process.getBuiltinModule allows loading native Node.js modules (fs, child_process, vm)"},{prop:"exit",target:process,violationType:"process_exit",strategy:"throw",reason:"process.exit could terminate the interpreter"},{prop:"abort",target:process,violationType:"process_exit",strategy:"throw",reason:"process.abort could crash the interpreter"},{prop:"kill",target:process,violationType:"process_kill",strategy:"throw",reason:"process.kill could signal other processes"},{prop:"setuid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setuid could escalate privileges"},{prop:"setgid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setgid could escalate privileges"},{prop:"seteuid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.seteuid could escalate effective user privileges"},{prop:"setegid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setegid could escalate effective group privileges"},{prop:"initgroups",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.initgroups could modify supplementary group IDs"},{prop:"setgroups",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setgroups could modify supplementary group IDs"},{prop:"umask",target:process,violationType:"process_umask",strategy:"throw",reason:"process.umask could modify file creation permissions"},{prop:"argv",target:process,violationType:"process_argv",strategy:"throw",reason:"process.argv may contain secrets in CLI arguments"},{prop:"cwd",target:process,violationType:"process_chdir",strategy:"throw",reason:"process.cwd could disclose real host working directory path"},{prop:"chdir",target:process,violationType:"process_chdir",strategy:"throw",reason:"process.chdir could confuse the interpreter's CWD tracking"},{prop:"report",target:process,violationType:"process_report",strategy:"throw",reason:"process.report could disclose full environment, host paths, and system info"},{prop:"loadEnvFile",target:process,violationType:"process_env",strategy:"throw",reason:"process.loadEnvFile could load env files bypassing env proxy"},{prop:"setUncaughtExceptionCaptureCallback",target:process,violationType:"process_exception_handler",strategy:"throw",reason:"setUncaughtExceptionCaptureCallback could intercept security errors"},{prop:"send",target:process,violationType:"process_send",strategy:"throw",reason:"process.send could communicate with parent process in IPC contexts"},{prop:"channel",target:process,violationType:"process_channel",strategy:"throw",reason:"process.channel could access IPC channel to parent process"},{prop:"cpuUsage",target:process,violationType:"process_timing",strategy:"throw",reason:"process.cpuUsage could enable timing side-channel attacks"},{prop:"memoryUsage",target:process,violationType:"process_timing",strategy:"throw",reason:"process.memoryUsage could enable timing side-channel attacks"},{prop:"hrtime",target:process,violationType:"process_timing",strategy:"throw",reason:"process.hrtime could enable timing side-channel attacks"},{prop:"WeakRef",target:globalThis,violationType:"weak_ref",strategy:"throw",reason:"WeakRef could be used to leak references outside sandbox"},{prop:"FinalizationRegistry",target:globalThis,violationType:"finalization_registry",strategy:"throw",reason:"FinalizationRegistry could be used to leak references outside sandbox"},{prop:"Reflect",target:globalThis,violationType:"reflect",strategy:"freeze",reason:"Reflect provides introspection capabilities"},{prop:"Proxy",target:globalThis,violationType:"proxy",strategy:"throw",reason:"Proxy allows intercepting and modifying object behavior"},{prop:"WebAssembly",target:globalThis,violationType:"webassembly",strategy:"throw",reason:"WebAssembly allows executing arbitrary compiled code"},{prop:"SharedArrayBuffer",target:globalThis,violationType:"shared_array_buffer",strategy:"throw",reason:"SharedArrayBuffer could enable side-channel communication or timing attacks"},{prop:"Atomics",target:globalThis,violationType:"atomics",strategy:"throw",reason:"Atomics could enable side-channel communication or timing attacks"},{prop:"performance",target:globalThis,violationType:"performance_timing",strategy:"throw",reason:"performance.now() provides sub-millisecond timing for side-channel attacks"},{prop:"stdout",target:process,violationType:"process_stdout",strategy:"throw",reason:"process.stdout could bypass interpreter output to write to host stdout"},{prop:"stderr",target:process,violationType:"process_stderr",strategy:"throw",reason:"process.stderr could bypass interpreter output to write to host stderr"},{prop:"__defineGetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__defineGetter__ allows prototype pollution via getter injection"},{prop:"__defineSetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__defineSetter__ allows prototype pollution via setter injection"},{prop:"__lookupGetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__lookupGetter__ enables introspection for prototype pollution attacks"},{prop:"__lookupSetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__lookupSetter__ enables introspection for prototype pollution attacks"},{prop:"JSON",target:globalThis,violationType:"json_mutation",strategy:"freeze",reason:"Freeze JSON to prevent mutation of parsing/serialization"},{prop:"Math",target:globalThis,violationType:"math_mutation",strategy:"freeze",reason:"Freeze Math to prevent mutation of math utilities"}];try{let e=Object.getPrototypeOf(async()=>{}).constructor;e&&e!==Function&&a.push({prop:"constructor",target:Object.getPrototypeOf(async()=>{}),violationType:"async_function_constructor",strategy:"throw",reason:"AsyncFunction constructor allows arbitrary async code execution"})}catch{}try{let e=Object.getPrototypeOf(function*(){}).constructor;e&&e!==Function&&a.push({prop:"constructor",target:Object.getPrototypeOf(function*(){}),violationType:"generator_function_constructor",strategy:"throw",reason:"GeneratorFunction constructor allows arbitrary generator code execution"})}catch{}try{let e=Object.getPrototypeOf(async function*(){}).constructor;e&&e!==Function&&e!==Object.getPrototypeOf(async()=>{}).constructor&&a.push({prop:"constructor",target:Object.getPrototypeOf(async function*(){}),violationType:"async_generator_function_constructor",strategy:"throw",reason:"AsyncGeneratorFunction constructor allows arbitrary async generator code execution"})}catch{}return a.filter(e=>{try{return e.target[e.prop]!==void 0}catch{return!1}})}var g=typeof __BROWSER__<"u"&&__BROWSER__;function w(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{let e=Math.random()*16|0;return(a==="x"?e:e&3|8).toString(16)})}var x=null;if(!g)try{let{AsyncLocalStorage:a}=f("node:async_hooks");x=a}catch{}var k=`
|
|
3
3
|
|
|
4
|
-
This is a defense-in-depth measure and indicates a bug in just-bash. Please report this at security@vercel.com`,d=class extends Error{violation;constructor(e,t){super(e+k),this.violation=t,this.name="SecurityViolationError"}},u=!f&&x?new x:null,T=1e3;function D(a,e,...t){return u.run(a,()=>e(...t))}var m={enabled:!0,auditMode:!1};function E(a){return a===void 0?{...m,enabled:!1}:typeof a=="boolean"?{...m,enabled:a}:{...m,...a}}var _=class a{static instance=null;static importHooksRegistered=!1;static trustedExecutionDepth=new Map;config;refCount=0;patchFailures=[];activeExecutionIds=new Set;contextCache=new Map;originalDescriptors=[];violations=[];activationTime=0;totalActiveTimeMs=0;constructor(e){this.config=e}static getInstance(e){let t=E(e);if(!a.instance)a.instance=new a(t);else{let r=a.instance.config;if(t.enabled!==r.enabled||t.auditMode!==r.auditMode)throw new Error(`DefenseInDepthBox config conflict: requested {enabled: ${t.enabled}, auditMode: ${t.auditMode}} but singleton already has {enabled: ${r.enabled}, auditMode: ${r.auditMode}}. All Bash instances must use the same defense-in-depth security settings, or call DefenseInDepthBox.resetInstance() between incompatible configurations.`)}return a.instance}static resetInstance(){a.instance&&(a.instance.forceDeactivate(),a.instance=null),a.trustedExecutionDepth.clear()}static isInSandboxedContext(){return u?u?.getStore()?.sandboxActive===!0:!1}static getCurrentExecutionId(){if(u)return u?.getStore()?.executionId}static enterTrustedScope(e){let t=a.trustedExecutionDepth.get(e)??0;a.trustedExecutionDepth.set(e,t+1)}static leaveTrustedScope(e){let t=a.trustedExecutionDepth.get(e);if(t){if(t===1){a.trustedExecutionDepth.delete(e);return}a.trustedExecutionDepth.set(e,t-1)}}static isTrustedScopeActive(e){return e?(a.trustedExecutionDepth.get(e)??0)>0:!1}isExecutionIdActive(e){return this.activeExecutionIds.has(e)}getCachedContext(e){let t=this.contextCache.get(e);return t||(t={sandboxActive:!0,executionId:e},this.contextCache.set(e,t)),t}getPreferredActiveExecutionId(){if(this.activeExecutionIds.size!==0)for(let e of this.activeExecutionIds)return e}static bindCurrentContext(e){if(!u)return e;let t=a.instance,r=u.getStore(),s=r?.sandboxActive===!0?r.executionId:t?.getPreferredActiveExecutionId();if(!s)return e;let n=t?.getCachedContext(s)??{sandboxActive:!0,executionId:s};return((...o)=>{let i=a.instance;if(!(i&&!i.isExecutionIdActive(s)&&(i.recordViolation("bound_callback_after_deactivate","bound callback","Bound callback blocked after originating execution was deactivated"),!i.config.auditMode)))return D(n,e,...o)})}isEnabled(){return this.config.enabled===!0&&u!==null&&!f}updateConfig(e){this.config={...this.config,...e}}activate(){if(f||!this.config.enabled||!u){let r=w(),s=!1;return{run:n=>s?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):n(),deactivate:()=>{s=!0},executionId:r}}this.refCount++,this.refCount===1&&(this.applyPatches(),this.activationTime=Date.now());let e=w(),t=!1;return{run:r=>t?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):(this.activeExecutionIds.add(e),u.run({sandboxActive:!0,executionId:e},r)),deactivate:()=>{t||(t=!0,this.activeExecutionIds.delete(e),this.contextCache.delete(e),this.refCount--,this.refCount===0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.refCount<0&&(this.refCount=0))},executionId:e}}forceDeactivate(){this.refCount>0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.activeExecutionIds.clear(),this.contextCache.clear(),this.refCount=0}isActive(){return this.refCount>0}getStats(){return{violationsBlocked:this.violations.length,violations:[...this.violations],activeTimeMs:this.totalActiveTimeMs+(this.refCount>0?Date.now()-this.activationTime:0),refCount:this.refCount}}getPatchFailures(){return[...this.patchFailures]}clearViolations(){this.violations=[]}getPathForTarget(e,t){return e===globalThis?`globalThis.${t}`:e===process?`process.${t}`:e===Error?`Error.${t}`:e===Function.prototype?`Function.prototype.${t}`:e===Object.prototype?`Object.prototype.${t}`:`<object>.${t}`}static runTrusted(e){if(!u)return e();let t=u.getStore();if(!t)return e();let{executionId:r}=t;return u.run({...t,trusted:!0},()=>{a.enterTrustedScope(r);try{let s=e();return typeof s=="object"&&s!==null&&"finally"in s&&typeof s.finally=="function"?s.finally(()=>{a.leaveTrustedScope(r)}):(a.leaveTrustedScope(r),s)}catch(s){throw a.leaveTrustedScope(r),s}})}static async runTrustedAsync(e){if(!u)return e();let t=u.getStore();if(!t)return e();let{executionId:r}=t;return u.run({...t,trusted:!0},async()=>{a.enterTrustedScope(r);try{return await e()}finally{a.leaveTrustedScope(r)}})}shouldBlock(){if(f||this.config.auditMode||!u)return!1;let e=u?.getStore();return!(e?.sandboxActive!==!0||e.trusted||a.isTrustedScopeActive(e.executionId))}recordViolation(e,t,r){let s={timestamp:Date.now(),type:e,message:r,path:t,stack:new Error().stack,executionId:u?.getStore()?.executionId};if(this.violations.length<T&&this.violations.push(s),this.config.onViolation)try{this.config.onViolation(s)}catch(n){console.debug("[DefenseInDepthBox] onViolation callback threw:",n instanceof Error?n.message:n)}return s}createBlockingProxy(e,t,r){let s=this;return new Proxy(e,{apply(n,o,i){if(s.shouldBlock()){let c=`${t} is blocked during script execution`,l=s.recordViolation(r,t,c);throw new d(c,l)}return s.config.auditMode&&u?.getStore()?.sandboxActive===!0&&s.recordViolation(r,t,`${t} called (audit mode)`),Reflect.apply(n,o,i)},construct(n,o,i){if(s.shouldBlock()){let c=`${t} constructor is blocked during script execution`,l=s.recordViolation(r,t,c);throw new d(c,l)}return s.config.auditMode&&u?.getStore()?.sandboxActive===!0&&s.recordViolation(r,t,`${t} constructor called (audit mode)`),Reflect.construct(n,o,i)}})}createBlockingObjectProxy(e,t,r,s){let n=this;return new Proxy(e,{get(o,i,c){if(n.shouldBlock()){if(s&&typeof i=="string"&&s.has(i))return Reflect.get(o,i,c);let l=`${t}.${String(i)}`,p=`${l} is blocked during script execution`,h=n.recordViolation(r,l,p);throw new d(p,h)}if(n.config.auditMode&&u?.getStore()?.sandboxActive===!0){let l=`${t}.${String(i)}`;n.recordViolation(r,l,`${l} accessed (audit mode)`)}return Reflect.get(o,i,c)},set(o,i,c,l){if(n.shouldBlock()){let p=`${t}.${String(i)}`,h=`${p} modification is blocked during script execution`,y=n.recordViolation(r,p,h);throw new d(h,y)}return Reflect.set(o,i,c,l)},ownKeys(o){if(n.shouldBlock()){let i=`${t} enumeration is blocked during script execution`,c=n.recordViolation(r,t,i);throw new d(i,c)}return Reflect.ownKeys(o)},getOwnPropertyDescriptor(o,i){if(n.shouldBlock()){let c=`${t}.${String(i)}`,l=`${c} descriptor access is blocked during script execution`,p=n.recordViolation(r,c,l);throw new d(l,p)}return Reflect.getOwnPropertyDescriptor(o,i)},has(o,i){if(n.shouldBlock()){let c=`${t}.${String(i)}`,l=`${c} existence check is blocked during script execution`,p=n.recordViolation(r,c,l);throw new d(l,p)}return Reflect.has(o,i)},deleteProperty(o,i){if(n.shouldBlock()){let c=`${t}.${String(i)}`,l=`${c} deletion is blocked during script execution`,p=n.recordViolation(r,c,l);throw new d(l,p)}return Reflect.deleteProperty(o,i)},setPrototypeOf(o,i){if(n.shouldBlock()){let c=`${t} setPrototypeOf is blocked during script execution`,l=n.recordViolation(r,t,c);throw new d(c,l)}return Reflect.setPrototypeOf(o,i)},defineProperty(o,i,c){if(n.shouldBlock()){let l=`${t}.${String(i)}`,p=`${l} defineProperty is blocked during script execution`,h=n.recordViolation(r,l,p);throw new d(p,h)}return Reflect.defineProperty(o,i,c)}})}applyPatches(){this.patchFailures=[];let e=v(),t=new Set(["process_send","process_channel","process_stdout","process_stderr"]);for(let n of e)t.has(n.violationType)||this.applyPatch(n);this.protectConstructorChain(),this.protectErrorPrepareStackTrace(),this.protectPromiseThen(),this.protectDynamicImport(),this.protectModuleLoad(),this.protectModuleResolveFilename(),this.protectProcessMainModule(),this.protectProcessExecPath(),this.lockWellKnownSymbols(),this.protectProxyRevocable();let r=["Function.prototype.constructor","Module._load"],s=this.patchFailures.filter(n=>r.includes(n));if(s.length>0)throw this.restorePatches(),new Error(`DefenseInDepthBox: critical patches failed: ${s.join(", ")}`)}protectConstructorChain(){this.patchPrototypeConstructor(Function.prototype,"Function.prototype.constructor","function_constructor");try{let e=Object.getPrototypeOf(async()=>{}).constructor;e&&e!==Function&&this.patchPrototypeConstructor(e.prototype,"AsyncFunction.prototype.constructor","async_function_constructor")}catch(e){this.patchFailures.push("AsyncFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncFunction.prototype.constructor:",e instanceof Error?e.message:e)}try{let e=Object.getPrototypeOf(function*(){}).constructor;e&&e!==Function&&this.patchPrototypeConstructor(e.prototype,"GeneratorFunction.prototype.constructor","generator_function_constructor")}catch(e){this.patchFailures.push("GeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch GeneratorFunction.prototype.constructor:",e instanceof Error?e.message:e)}try{let e=Object.getPrototypeOf(async function*(){}).constructor,t=Object.getPrototypeOf(async()=>{}).constructor;e&&e!==Function&&e!==t&&this.patchPrototypeConstructor(e.prototype,"AsyncGeneratorFunction.prototype.constructor","async_generator_function_constructor")}catch(e){this.patchFailures.push("AsyncGeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncGeneratorFunction.prototype.constructor:",e instanceof Error?e.message:e)}}protectErrorPrepareStackTrace(){let e=this;try{let t=Object.getOwnPropertyDescriptor(Error,"prepareStackTrace");this.originalDescriptors.push({target:Error,prop:"prepareStackTrace",descriptor:t});let r=t?.value;Object.defineProperty(Error,"prepareStackTrace",{get(){return r},set(s){if(e.shouldBlock()){let n="Error.prepareStackTrace modification is blocked during script execution",o=e.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace",n);throw new d(n,o)}e.config.auditMode&&u?.getStore()?.sandboxActive===!0&&e.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace","Error.prepareStackTrace set (audit mode)"),r=s},configurable:!0})}catch(t){this.patchFailures.push("Error.prepareStackTrace"),console.debug("[DefenseInDepthBox] Could not protect Error.prepareStackTrace:",t instanceof Error?t.message:t)}}protectPromiseThen(){let e=this;try{let n=function(...o){return u.run(this.captured,()=>{if(!this.box.isExecutionIdActive(this.executionId)){if(this.box.recordViolation("promise_then_after_deactivate","Promise.then","Promise.then callback is blocked after defense deactivation"),this.box.config.auditMode)return Reflect.apply(this.cb,void 0,o);if(this.kind==="fulfilled")return o[0];throw o[0]}return Reflect.apply(this.cb,void 0,o)})};var t=n;let r=Object.getOwnPropertyDescriptor(Promise.prototype,"then");this.originalDescriptors.push({target:Promise.prototype,prop:"then",descriptor:r});let s=r?.value;if(typeof s!="function")return;Object.defineProperty(Promise.prototype,"then",{value:function(i,c){if(!u)return Reflect.apply(s,this,[i,c]);let l=u.getStore(),p=l?.sandboxActive===!0&&l.trusted!==!0?l.executionId:void 0;if(!p)return Reflect.apply(s,this,[i,c]);let h=e.getCachedContext(p),y=(b,P)=>typeof b!="function"?b:n.bind({box:e,executionId:p,captured:h,cb:b,kind:P});return Reflect.apply(s,this,[y(i,"fulfilled"),y(c,"rejected")])},writable:!0,configurable:!0})}catch(r){this.patchFailures.push("Promise.prototype.then"),console.debug("[DefenseInDepthBox] Could not protect Promise.prototype.then:",r instanceof Error?r.message:r)}}patchPrototypeConstructor(e,t,r){let s=this;try{let n=Object.getOwnPropertyDescriptor(e,"constructor");this.originalDescriptors.push({target:e,prop:"constructor",descriptor:n});let o=n?.value;Object.defineProperty(e,"constructor",{get(){if(s.shouldBlock()){let i=`${t} access is blocked during script execution`,c=s.recordViolation(r,t,i);throw new d(i,c)}return s.config.auditMode&&u?.getStore()?.sandboxActive===!0&&s.recordViolation(r,t,`${t} accessed (audit mode)`),o},set(i){if(s.shouldBlock()){let c=`${t} modification is blocked during script execution`,l=s.recordViolation(r,t,c);throw new d(c,l)}Object.defineProperty(this,"constructor",{value:i,writable:!0,configurable:!0})},configurable:!0})}catch(n){this.patchFailures.push(t),console.debug(`[DefenseInDepthBox] Could not patch ${t}:`,n instanceof Error?n.message:n)}}protectProcessMainModule(){if(typeof process>"u")return;let e=this;try{let t=Object.getOwnPropertyDescriptor(process,"mainModule");this.originalDescriptors.push({target:process,prop:"mainModule",descriptor:t});let r=t?.value;r!==void 0&&Object.defineProperty(process,"mainModule",{get(){if(e.shouldBlock()){let s="process.mainModule access is blocked during script execution",n=e.recordViolation("process_main_module","process.mainModule",s);throw new d(s,n)}return e.config.auditMode&&u?.getStore()?.sandboxActive===!0&&e.recordViolation("process_main_module","process.mainModule","process.mainModule accessed (audit mode)"),r},set(s){if(e.shouldBlock()){let n="process.mainModule modification is blocked during script execution",o=e.recordViolation("process_main_module","process.mainModule",n);throw new d(n,o)}Object.defineProperty(process,"mainModule",{value:s,writable:!0,configurable:!0})},configurable:!0})}catch(t){this.patchFailures.push("process.mainModule"),console.debug("[DefenseInDepthBox] Could not protect process.mainModule:",t instanceof Error?t.message:t)}}protectProcessExecPath(){if(typeof process>"u")return;let e=this;try{let t=Object.getOwnPropertyDescriptor(process,"execPath");this.originalDescriptors.push({target:process,prop:"execPath",descriptor:t});let r=t?.value??process.execPath;Object.defineProperty(process,"execPath",{get(){if(e.shouldBlock()){let s="process.execPath access is blocked during script execution",n=e.recordViolation("process_exec_path","process.execPath",s);throw new d(s,n)}return e.config.auditMode&&u?.getStore()?.sandboxActive===!0&&e.recordViolation("process_exec_path","process.execPath","process.execPath accessed (audit mode)"),r},set(s){if(e.shouldBlock()){let n="process.execPath modification is blocked during script execution",o=e.recordViolation("process_exec_path","process.execPath",n);throw new d(n,o)}Object.defineProperty(process,"execPath",{value:s,writable:!0,configurable:!0})},configurable:!0})}catch(t){this.patchFailures.push("process.execPath"),console.debug("[DefenseInDepthBox] Could not protect process.execPath:",t instanceof Error?t.message:t)}}lockWellKnownSymbols(){let e=(t,r)=>{try{let s=Object.getOwnPropertyDescriptor(t,r);if(s?.configurable){if("value"in s){Object.defineProperty(t,r,{...s,configurable:!1,writable:!1});return}Object.defineProperty(t,r,{...s,configurable:!1})}}catch{}};for(let t of[Array,Map,Set,RegExp,Promise])e(t,Symbol.species);for(let t of[Array.prototype,String.prototype,Map.prototype,Set.prototype])e(t,Symbol.iterator);e(Symbol.prototype,Symbol.toPrimitive),e(Date.prototype,Symbol.toPrimitive);for(let t of[Symbol.match,Symbol.matchAll,Symbol.replace,Symbol.search,Symbol.split])e(RegExp.prototype,t);e(Function.prototype,Symbol.hasInstance),e(Array.prototype,Symbol.unscopables);for(let t of[Map.prototype,Set.prototype,Promise.prototype,ArrayBuffer.prototype])e(t,Symbol.toStringTag);try{let t=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");this.originalDescriptors.push({target:Error,prop:"stackTraceLimit",descriptor:t}),Object.defineProperty(Error,"stackTraceLimit",{value:Error.stackTraceLimit,writable:!1,configurable:!0})}catch{}}protectProxyRevocable(){let e=this;try{let t=Proxy.revocable;if(typeof t!="function")return;let r=Object.getOwnPropertyDescriptor(Proxy,"revocable");this.originalDescriptors.push({target:Proxy,prop:"revocable",descriptor:r}),Object.defineProperty(Proxy,"revocable",{value:function(n,o){if(e.shouldBlock()){let i="Proxy.revocable is blocked during script execution",c=e.recordViolation("proxy","Proxy.revocable",i);throw new d(i,c)}return e.config.auditMode&&u?.getStore()?.sandboxActive===!0&&e.recordViolation("proxy","Proxy.revocable","Proxy.revocable called (audit mode)"),t(n,o)},writable:!1,configurable:!0})}catch(t){this.patchFailures.push("Proxy.revocable"),console.debug("[DefenseInDepthBox] Could not protect Proxy.revocable:",t instanceof Error?t.message:t)}}protectDynamicImport(){if(!(f||a.importHooksRegistered))try{let e=this,t=g("node:module"),r=new Set;for(let o of t.builtinModules??[]){let i=o.startsWith("node:")?o.slice(5):o;r.add(i);let c=i.indexOf("/");c>0&&r.add(i.slice(0,c))}let s=o=>{if(o.startsWith("./")||o.startsWith("../")||o.startsWith("/")||o.startsWith("file:")||o.startsWith("data:")||o.startsWith("blob:")||o.startsWith("http:")||o.startsWith("https:"))return!1;let i=o.startsWith("node:")?o.slice(5):o;if(!i)return!1;if(typeof t.isBuiltin=="function"&&t.isBuiltin(i)||r.has(i))return!0;let c=i.indexOf("/");return c>0&&r.has(i.slice(0,c))},n=()=>{let o=u?.getStore();return e.config.auditMode===!0&&o?.sandboxActive===!0&&o.trusted!==!0&&!a.isTrustedScopeActive(o.executionId)};if(typeof t.registerHooks=="function"){t.registerHooks({resolve(o,i,c){if(o.startsWith("data:")||o.startsWith("blob:"))throw new Error(`dynamic import of ${o.startsWith("data:")?"data:":"blob:"} URLs is blocked by defense-in-depth`);if(s(o)){let l=`import(${o})`,p=`dynamic import of Node.js builtin '${o}' is blocked during script execution`;if(e.shouldBlock()){let h=e.recordViolation("dynamic_import_builtin",l,p);throw new d(p,h)}n()&&e.recordViolation("dynamic_import_builtin",l,`dynamic import of Node.js builtin '${o}' called (audit mode)`)}return c(o,i)}}),a.importHooksRegistered=!0;return}if(typeof t.register=="function"){let o=["export async function resolve(specifier, context, nextResolve) {",' if (specifier.startsWith("data:") || specifier.startsWith("blob:")) {',' throw new Error("dynamic import of " + (specifier.startsWith("data:") ? "data:" : "blob:") + " URLs is blocked by defense-in-depth");'," }"," return nextResolve(specifier, context);","}"].join(`
|
|
5
|
-
`);t.register(`data:text/javascript,${encodeURIComponent(o)}`),a.importHooksRegistered=!0}}catch(e){console.debug("[DefenseInDepthBox] Could not register import() hooks:",e instanceof Error?e.message:e)}}protectModuleLoad(){if(!
|
|
4
|
+
This is a defense-in-depth measure and indicates a bug in just-bash. Please report this at security@vercel.com`,d=class extends Error{violation;constructor(e,t){super(e+k),this.violation=t,this.name="SecurityViolationError"}},u=!g&&x?new x:null,T=1e3;function D(a,e,...t){return u.run(a,()=>e(...t))}var m={enabled:!0,auditMode:!1};function E(a){return a===void 0?{...m,enabled:!1}:typeof a=="boolean"?{...m,enabled:a}:{...m,...a}}var _=class a{static instance=null;static importHooksRegistered=!1;static trustedExecutionDepth=new Map;config;refCount=0;patchFailures=[];activeExecutionIds=new Set;contextCache=new Map;originalDescriptors=[];violations=[];activationTime=0;totalActiveTimeMs=0;constructor(e){this.config=e}static getInstance(e){let t=E(e);if(!a.instance)a.instance=new a(t);else{let r=a.instance.config;if(t.enabled!==r.enabled||t.auditMode!==r.auditMode)throw new Error(`DefenseInDepthBox config conflict: requested {enabled: ${t.enabled}, auditMode: ${t.auditMode}} but singleton already has {enabled: ${r.enabled}, auditMode: ${r.auditMode}}. All Bash instances must use the same defense-in-depth security settings, or call DefenseInDepthBox.resetInstance() between incompatible configurations.`)}return a.instance}static resetInstance(){a.instance&&(a.instance.forceDeactivate(),a.instance=null),a.trustedExecutionDepth.clear()}static isInSandboxedContext(){return u?u?.getStore()?.sandboxActive===!0:!1}static getCurrentExecutionId(){if(u)return u?.getStore()?.executionId}static enterTrustedScope(e){let t=a.trustedExecutionDepth.get(e)??0;a.trustedExecutionDepth.set(e,t+1)}static leaveTrustedScope(e){let t=a.trustedExecutionDepth.get(e);if(t){if(t===1){a.trustedExecutionDepth.delete(e);return}a.trustedExecutionDepth.set(e,t-1)}}static isTrustedScopeActive(e){return e?(a.trustedExecutionDepth.get(e)??0)>0:!1}isExecutionIdActive(e){return this.activeExecutionIds.has(e)}getCachedContext(e){let t=this.contextCache.get(e);return t||(t={sandboxActive:!0,executionId:e},this.contextCache.set(e,t)),t}getPreferredActiveExecutionId(){if(this.activeExecutionIds.size!==0)for(let e of this.activeExecutionIds)return e}static bindCurrentContext(e){if(!u)return e;let t=a.instance,r=u.getStore(),s=r?.sandboxActive===!0?r.executionId:t?.getPreferredActiveExecutionId();if(!s)return e;let n=t?.getCachedContext(s)??{sandboxActive:!0,executionId:s};return((...o)=>{let i=a.instance;if(!(i&&!i.isExecutionIdActive(s)&&(i.recordViolation("bound_callback_after_deactivate","bound callback","Bound callback blocked after originating execution was deactivated"),!i.config.auditMode)))return D(n,e,...o)})}isEnabled(){return this.config.enabled===!0&&u!==null&&!g}updateConfig(e){this.config={...this.config,...e}}activate(){if(g||!this.config.enabled||!u){let r=w(),s=!1;return{run:n=>s?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):n(),deactivate:()=>{s=!0},executionId:r}}this.refCount++,this.refCount===1&&(this.applyPatches(),this.activationTime=Date.now());let e=w(),t=!1;return{run:r=>t?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):(this.activeExecutionIds.add(e),u.run({sandboxActive:!0,executionId:e},r)),deactivate:()=>{t||(t=!0,this.activeExecutionIds.delete(e),this.contextCache.delete(e),this.refCount--,this.refCount===0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.refCount<0&&(this.refCount=0))},executionId:e}}forceDeactivate(){this.refCount>0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.activeExecutionIds.clear(),this.contextCache.clear(),this.refCount=0}isActive(){return this.refCount>0}getStats(){return{violationsBlocked:this.violations.length,violations:[...this.violations],activeTimeMs:this.totalActiveTimeMs+(this.refCount>0?Date.now()-this.activationTime:0),refCount:this.refCount}}getPatchFailures(){return[...this.patchFailures]}clearViolations(){this.violations=[]}getPathForTarget(e,t){return e===globalThis?`globalThis.${t}`:e===process?`process.${t}`:e===Error?`Error.${t}`:e===Function.prototype?`Function.prototype.${t}`:e===Object.prototype?`Object.prototype.${t}`:`<object>.${t}`}static runTrusted(e){if(!u)return e();let t=u.getStore();if(!t)return e();let{executionId:r}=t;return u.run({...t,trusted:!0},()=>{a.enterTrustedScope(r);try{let s=e();return typeof s=="object"&&s!==null&&"finally"in s&&typeof s.finally=="function"?s.finally(()=>{a.leaveTrustedScope(r)}):(a.leaveTrustedScope(r),s)}catch(s){throw a.leaveTrustedScope(r),s}})}static async runTrustedAsync(e){if(!u)return e();let t=u.getStore();if(!t)return e();let{executionId:r}=t;return u.run({...t,trusted:!0},async()=>{a.enterTrustedScope(r);try{return await e()}finally{a.leaveTrustedScope(r)}})}shouldBlock(){if(g||this.config.auditMode||!u)return!1;let e=u?.getStore();return!(e?.sandboxActive!==!0||e.trusted||a.isTrustedScopeActive(e.executionId))}recordViolation(e,t,r){let s={timestamp:Date.now(),type:e,message:r,path:t,stack:new Error().stack,executionId:u?.getStore()?.executionId};if(this.violations.length<T&&this.violations.push(s),this.config.onViolation)try{this.config.onViolation(s)}catch(n){console.debug("[DefenseInDepthBox] onViolation callback threw:",n instanceof Error?n.message:n)}return s}createBlockingProxy(e,t,r){let s=this;return new Proxy(e,{apply(n,o,i){if(s.shouldBlock()){let c=`${t} is blocked during script execution`,l=s.recordViolation(r,t,c);throw new d(c,l)}return s.config.auditMode&&u?.getStore()?.sandboxActive===!0&&s.recordViolation(r,t,`${t} called (audit mode)`),Reflect.apply(n,o,i)},construct(n,o,i){if(s.shouldBlock()){let c=`${t} constructor is blocked during script execution`,l=s.recordViolation(r,t,c);throw new d(c,l)}return s.config.auditMode&&u?.getStore()?.sandboxActive===!0&&s.recordViolation(r,t,`${t} constructor called (audit mode)`),Reflect.construct(n,o,i)}})}createBlockingObjectProxy(e,t,r,s){let n=this;return new Proxy(e,{get(o,i,c){if(n.shouldBlock()){if(s&&typeof i=="string"&&s.has(i))return Reflect.get(o,i,c);let l=`${t}.${String(i)}`,p=`${l} is blocked during script execution`,h=n.recordViolation(r,l,p);throw new d(p,h)}if(n.config.auditMode&&u?.getStore()?.sandboxActive===!0){let l=`${t}.${String(i)}`;n.recordViolation(r,l,`${l} accessed (audit mode)`)}return Reflect.get(o,i,c)},set(o,i,c,l){if(n.shouldBlock()){let p=`${t}.${String(i)}`,h=`${p} modification is blocked during script execution`,y=n.recordViolation(r,p,h);throw new d(h,y)}return t==="process.env"&&i==="DEBUG"?Reflect.set(o,i,c):Reflect.set(o,i,c,l)},ownKeys(o){if(n.shouldBlock()){let i=`${t} enumeration is blocked during script execution`,c=n.recordViolation(r,t,i);throw new d(i,c)}return Reflect.ownKeys(o)},getOwnPropertyDescriptor(o,i){if(n.shouldBlock()){let c=`${t}.${String(i)}`,l=`${c} descriptor access is blocked during script execution`,p=n.recordViolation(r,c,l);throw new d(l,p)}return Reflect.getOwnPropertyDescriptor(o,i)},has(o,i){if(n.shouldBlock()){let c=`${t}.${String(i)}`,l=`${c} existence check is blocked during script execution`,p=n.recordViolation(r,c,l);throw new d(l,p)}return Reflect.has(o,i)},deleteProperty(o,i){if(n.shouldBlock()){let c=`${t}.${String(i)}`,l=`${c} deletion is blocked during script execution`,p=n.recordViolation(r,c,l);throw new d(l,p)}return Reflect.deleteProperty(o,i)},setPrototypeOf(o,i){if(n.shouldBlock()){let c=`${t} setPrototypeOf is blocked during script execution`,l=n.recordViolation(r,t,c);throw new d(c,l)}return Reflect.setPrototypeOf(o,i)},defineProperty(o,i,c){if(n.shouldBlock()){let l=`${t}.${String(i)}`,p=`${l} defineProperty is blocked during script execution`,h=n.recordViolation(r,l,p);throw new d(p,h)}return Reflect.defineProperty(o,i,c)}})}applyPatches(){this.patchFailures=[];let e=v(),t=new Set(["process_send","process_channel","process_stdout","process_stderr"]);for(let n of e)t.has(n.violationType)||this.applyPatch(n);this.protectConstructorChain(),this.protectErrorPrepareStackTrace(),this.protectPromiseThen(),this.protectDynamicImport(),this.protectModuleLoad(),this.protectModuleResolveFilename(),this.protectProcessMainModule(),this.protectProcessExecPath(),this.lockWellKnownSymbols(),this.protectProxyRevocable();let r=["Function.prototype.constructor","Module._load"],s=this.patchFailures.filter(n=>r.includes(n));if(s.length>0)throw this.restorePatches(),new Error(`DefenseInDepthBox: critical patches failed: ${s.join(", ")}`)}protectConstructorChain(){this.patchPrototypeConstructor(Function.prototype,"Function.prototype.constructor","function_constructor");try{let e=Object.getPrototypeOf(async()=>{}).constructor;e&&e!==Function&&this.patchPrototypeConstructor(e.prototype,"AsyncFunction.prototype.constructor","async_function_constructor")}catch(e){this.patchFailures.push("AsyncFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncFunction.prototype.constructor:",e instanceof Error?e.message:e)}try{let e=Object.getPrototypeOf(function*(){}).constructor;e&&e!==Function&&this.patchPrototypeConstructor(e.prototype,"GeneratorFunction.prototype.constructor","generator_function_constructor")}catch(e){this.patchFailures.push("GeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch GeneratorFunction.prototype.constructor:",e instanceof Error?e.message:e)}try{let e=Object.getPrototypeOf(async function*(){}).constructor,t=Object.getPrototypeOf(async()=>{}).constructor;e&&e!==Function&&e!==t&&this.patchPrototypeConstructor(e.prototype,"AsyncGeneratorFunction.prototype.constructor","async_generator_function_constructor")}catch(e){this.patchFailures.push("AsyncGeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncGeneratorFunction.prototype.constructor:",e instanceof Error?e.message:e)}}protectErrorPrepareStackTrace(){let e=this;try{let t=Object.getOwnPropertyDescriptor(Error,"prepareStackTrace");this.originalDescriptors.push({target:Error,prop:"prepareStackTrace",descriptor:t});let r=t?.value;Object.defineProperty(Error,"prepareStackTrace",{get(){return r},set(s){if(e.shouldBlock()){let n="Error.prepareStackTrace modification is blocked during script execution",o=e.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace",n);throw new d(n,o)}e.config.auditMode&&u?.getStore()?.sandboxActive===!0&&e.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace","Error.prepareStackTrace set (audit mode)"),r=s},configurable:!0})}catch(t){this.patchFailures.push("Error.prepareStackTrace"),console.debug("[DefenseInDepthBox] Could not protect Error.prepareStackTrace:",t instanceof Error?t.message:t)}}protectPromiseThen(){let e=this;try{let n=function(...o){return u.run(this.captured,()=>{if(!this.box.isExecutionIdActive(this.executionId)){if(this.box.recordViolation("promise_then_after_deactivate","Promise.then","Promise.then callback is blocked after defense deactivation"),this.box.config.auditMode)return Reflect.apply(this.cb,void 0,o);if(this.kind==="fulfilled")return o[0];throw o[0]}return Reflect.apply(this.cb,void 0,o)})};var t=n;let r=Object.getOwnPropertyDescriptor(Promise.prototype,"then");this.originalDescriptors.push({target:Promise.prototype,prop:"then",descriptor:r});let s=r?.value;if(typeof s!="function")return;Object.defineProperty(Promise.prototype,"then",{value:function(i,c){if(!u)return Reflect.apply(s,this,[i,c]);let l=u.getStore(),p=l?.sandboxActive===!0&&l.trusted!==!0?l.executionId:void 0;if(!p)return Reflect.apply(s,this,[i,c]);let h=e.getCachedContext(p),y=(b,P)=>typeof b!="function"?b:n.bind({box:e,executionId:p,captured:h,cb:b,kind:P});return Reflect.apply(s,this,[y(i,"fulfilled"),y(c,"rejected")])},writable:!0,configurable:!0})}catch(r){this.patchFailures.push("Promise.prototype.then"),console.debug("[DefenseInDepthBox] Could not protect Promise.prototype.then:",r instanceof Error?r.message:r)}}patchPrototypeConstructor(e,t,r){let s=this;try{let n=Object.getOwnPropertyDescriptor(e,"constructor");this.originalDescriptors.push({target:e,prop:"constructor",descriptor:n});let o=n?.value;Object.defineProperty(e,"constructor",{get(){if(s.shouldBlock()){let i=`${t} access is blocked during script execution`,c=s.recordViolation(r,t,i);throw new d(i,c)}return s.config.auditMode&&u?.getStore()?.sandboxActive===!0&&s.recordViolation(r,t,`${t} accessed (audit mode)`),o},set(i){if(s.shouldBlock()){let c=`${t} modification is blocked during script execution`,l=s.recordViolation(r,t,c);throw new d(c,l)}Object.defineProperty(this,"constructor",{value:i,writable:!0,configurable:!0})},configurable:!0})}catch(n){this.patchFailures.push(t),console.debug(`[DefenseInDepthBox] Could not patch ${t}:`,n instanceof Error?n.message:n)}}protectProcessMainModule(){if(typeof process>"u")return;let e=this;try{let t=Object.getOwnPropertyDescriptor(process,"mainModule");this.originalDescriptors.push({target:process,prop:"mainModule",descriptor:t});let r=t?.value;r!==void 0&&Object.defineProperty(process,"mainModule",{get(){if(e.shouldBlock()){let s="process.mainModule access is blocked during script execution",n=e.recordViolation("process_main_module","process.mainModule",s);throw new d(s,n)}return e.config.auditMode&&u?.getStore()?.sandboxActive===!0&&e.recordViolation("process_main_module","process.mainModule","process.mainModule accessed (audit mode)"),r},set(s){if(e.shouldBlock()){let n="process.mainModule modification is blocked during script execution",o=e.recordViolation("process_main_module","process.mainModule",n);throw new d(n,o)}Object.defineProperty(process,"mainModule",{value:s,writable:!0,configurable:!0})},configurable:!0})}catch(t){this.patchFailures.push("process.mainModule"),console.debug("[DefenseInDepthBox] Could not protect process.mainModule:",t instanceof Error?t.message:t)}}protectProcessExecPath(){if(typeof process>"u")return;let e=this;try{let t=Object.getOwnPropertyDescriptor(process,"execPath");this.originalDescriptors.push({target:process,prop:"execPath",descriptor:t});let r=t?.value??process.execPath;Object.defineProperty(process,"execPath",{get(){if(e.shouldBlock()){let s="process.execPath access is blocked during script execution",n=e.recordViolation("process_exec_path","process.execPath",s);throw new d(s,n)}return e.config.auditMode&&u?.getStore()?.sandboxActive===!0&&e.recordViolation("process_exec_path","process.execPath","process.execPath accessed (audit mode)"),r},set(s){if(e.shouldBlock()){let n="process.execPath modification is blocked during script execution",o=e.recordViolation("process_exec_path","process.execPath",n);throw new d(n,o)}Object.defineProperty(process,"execPath",{value:s,writable:!0,configurable:!0})},configurable:!0})}catch(t){this.patchFailures.push("process.execPath"),console.debug("[DefenseInDepthBox] Could not protect process.execPath:",t instanceof Error?t.message:t)}}lockWellKnownSymbols(){let e=(t,r)=>{try{let s=Object.getOwnPropertyDescriptor(t,r);if(s?.configurable){if("value"in s){Object.defineProperty(t,r,{...s,configurable:!1,writable:!1});return}Object.defineProperty(t,r,{...s,configurable:!1})}}catch{}};for(let t of[Array,Map,Set,RegExp,Promise])e(t,Symbol.species);for(let t of[Array.prototype,String.prototype,Map.prototype,Set.prototype])e(t,Symbol.iterator);e(Symbol.prototype,Symbol.toPrimitive),e(Date.prototype,Symbol.toPrimitive);for(let t of[Symbol.match,Symbol.matchAll,Symbol.replace,Symbol.search,Symbol.split])e(RegExp.prototype,t);e(Function.prototype,Symbol.hasInstance),e(Array.prototype,Symbol.unscopables);for(let t of[Map.prototype,Set.prototype,Promise.prototype,ArrayBuffer.prototype])e(t,Symbol.toStringTag);try{let t=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");this.originalDescriptors.push({target:Error,prop:"stackTraceLimit",descriptor:t}),Object.defineProperty(Error,"stackTraceLimit",{value:Error.stackTraceLimit,writable:!1,configurable:!0})}catch{}}protectProxyRevocable(){let e=this;try{let t=Proxy.revocable;if(typeof t!="function")return;let r=Object.getOwnPropertyDescriptor(Proxy,"revocable");this.originalDescriptors.push({target:Proxy,prop:"revocable",descriptor:r}),Object.defineProperty(Proxy,"revocable",{value:function(n,o){if(e.shouldBlock()){let i="Proxy.revocable is blocked during script execution",c=e.recordViolation("proxy","Proxy.revocable",i);throw new d(i,c)}return e.config.auditMode&&u?.getStore()?.sandboxActive===!0&&e.recordViolation("proxy","Proxy.revocable","Proxy.revocable called (audit mode)"),t(n,o)},writable:!1,configurable:!0})}catch(t){this.patchFailures.push("Proxy.revocable"),console.debug("[DefenseInDepthBox] Could not protect Proxy.revocable:",t instanceof Error?t.message:t)}}protectDynamicImport(){if(!(g||a.importHooksRegistered))try{let e=this,t=f("node:module"),r=new Set;for(let o of t.builtinModules??[]){let i=o.startsWith("node:")?o.slice(5):o;r.add(i);let c=i.indexOf("/");c>0&&r.add(i.slice(0,c))}let s=o=>{if(o.startsWith("./")||o.startsWith("../")||o.startsWith("/")||o.startsWith("file:")||o.startsWith("data:")||o.startsWith("blob:")||o.startsWith("http:")||o.startsWith("https:"))return!1;let i=o.startsWith("node:")?o.slice(5):o;if(!i)return!1;if(typeof t.isBuiltin=="function"&&t.isBuiltin(i)||r.has(i))return!0;let c=i.indexOf("/");return c>0&&r.has(i.slice(0,c))},n=()=>{let o=u?.getStore();return e.config.auditMode===!0&&o?.sandboxActive===!0&&o.trusted!==!0&&!a.isTrustedScopeActive(o.executionId)};if(typeof t.registerHooks=="function"){t.registerHooks({resolve(o,i,c){if(o.startsWith("data:")||o.startsWith("blob:"))throw new Error(`dynamic import of ${o.startsWith("data:")?"data:":"blob:"} URLs is blocked by defense-in-depth`);if(s(o)){let l=`import(${o})`,p=`dynamic import of Node.js builtin '${o}' is blocked during script execution`;if(e.shouldBlock()){let h=e.recordViolation("dynamic_import_builtin",l,p);throw new d(p,h)}n()&&e.recordViolation("dynamic_import_builtin",l,`dynamic import of Node.js builtin '${o}' called (audit mode)`)}return c(o,i)}}),a.importHooksRegistered=!0;return}if(typeof t.register=="function"){let o=["export async function resolve(specifier, context, nextResolve) {",' if (specifier.startsWith("data:") || specifier.startsWith("blob:")) {',' throw new Error("dynamic import of " + (specifier.startsWith("data:") ? "data:" : "blob:") + " URLs is blocked by defense-in-depth");'," }"," return nextResolve(specifier, context);","}"].join(`
|
|
5
|
+
`);t.register(`data:text/javascript,${encodeURIComponent(o)}`),a.importHooksRegistered=!0}}catch(e){console.debug("[DefenseInDepthBox] Could not register import() hooks:",e instanceof Error?e.message:e)}}protectModuleLoad(){if(!g)try{let e=null;if(typeof process<"u"){let o=process.mainModule;o&&typeof o=="object"&&(e=o.constructor)}if(!e&&typeof f<"u"&&typeof f.main<"u"&&(e=f.main.constructor),!e||typeof e._load!="function")return;let t=e._load,r=Object.getOwnPropertyDescriptor(e,"_load");this.originalDescriptors.push({target:e,prop:"_load",descriptor:r});let n=this.createBlockingProxy(t,"Module._load","module_load");Object.defineProperty(e,"_load",{value:n,writable:!0,configurable:!0})}catch(e){this.patchFailures.push("Module._load"),console.debug("[DefenseInDepthBox] Could not protect Module._load:",e instanceof Error?e.message:e)}}protectModuleResolveFilename(){if(!g)try{let e=null;if(typeof process<"u"){let o=process.mainModule;o&&typeof o=="object"&&(e=o.constructor)}if(!e&&typeof f<"u"&&typeof f.main<"u"&&(e=f.main.constructor),!e||typeof e._resolveFilename!="function")return;let t=e._resolveFilename,r=Object.getOwnPropertyDescriptor(e,"_resolveFilename");this.originalDescriptors.push({target:e,prop:"_resolveFilename",descriptor:r});let n=this.createBlockingProxy(t,"Module._resolveFilename","module_resolve_filename");Object.defineProperty(e,"_resolveFilename",{value:n,writable:!0,configurable:!0})}catch(e){this.patchFailures.push("Module._resolveFilename"),console.debug("[DefenseInDepthBox] Could not protect Module._resolveFilename:",e instanceof Error?e.message:e)}}applyPatch(e){let{target:t,prop:r,violationType:s,strategy:n}=e;try{let o=t[r];if(o===void 0)return;let i=Object.getOwnPropertyDescriptor(t,r);if(this.originalDescriptors.push({target:t,prop:r,descriptor:i}),n==="freeze")typeof o=="object"&&o!==null&&Object.freeze(o);else{let c=this.getPathForTarget(t,r),l=typeof o=="function"?this.createBlockingProxy(o,c,s):this.createBlockingObjectProxy(o,c,s,e.allowedKeys);Object.defineProperty(t,r,{value:l,writable:!0,configurable:!0})}}catch(o){let i=this.getPathForTarget(t,r);this.patchFailures.push(i),console.debug(`[DefenseInDepthBox] Could not patch ${i}:`,o instanceof Error?o.message:o)}}restorePatches(){for(let e=this.originalDescriptors.length-1;e>=0;e--){let{target:t,prop:r,descriptor:s}=this.originalDescriptors[e];try{s?Object.defineProperty(t,r,s):delete t[r]}catch(n){let o=this.getPathForTarget(t,r);console.debug(`[DefenseInDepthBox] Could not restore ${o}:`,n instanceof Error?n.message:n)}}this.originalDescriptors=[]}};export{d as a,_ as b};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{c as u}from"./chunk-DLL7UR66.js";import{c as l}from"./chunk-
|
|
2
|
+
import{c as u}from"./chunk-DLL7UR66.js";import{c as l}from"./chunk-XEKXHOPO.js";import{a as d,b as h}from"./chunk-QAYAQNCG.js";var m={name:"bash",summary:"execute shell commands or scripts",usage:"bash [OPTIONS] [SCRIPT_FILE] [ARGUMENTS...]",options:["-c COMMAND execute COMMAND string"," --help display this help and exit"],notes:["Without -c, reads and executes commands from SCRIPT_FILE.","Arguments are passed as $1, $2, etc. to the script.",'$0 is set to the script name (or "bash" with -c).']},F={name:"bash",async execute(t,e){if(h(t))return d(m);if(t[0]==="-c"&&t.length>=2){let s=t[1],n=t[2]||"bash",c=t.slice(3);return r(s,n,c,e)}if(t.length===0){let s=l(e.stdin);return s.trim()?r(s,"bash",[],e):{stdout:"",stderr:"",exitCode:0}}let o=t[0],i=t.slice(1);try{let s=e.fs.resolvePath(e.cwd,o),n=await e.fs.readFile(s);return r(n,o,i,e)}catch{return{stdout:"",stderr:`bash: ${o}: No such file or directory
|
|
3
3
|
`,exitCode:127}}}},P={name:"sh",async execute(t,e){if(h(t))return d({...m,name:"sh",summary:"execute shell commands or scripts (POSIX shell)"});if(t[0]==="-c"&&t.length>=2){let s=t[1],n=t[2]||"sh",c=t.slice(3);return r(s,n,c,e)}if(t.length===0){let s=l(e.stdin);return s.trim()?r(s,"sh",[],e):{stdout:"",stderr:"",exitCode:0}}let o=t[0],i=t.slice(1);try{let s=e.fs.resolvePath(e.cwd,o),n=await e.fs.readFile(s);return r(n,o,i,e)}catch{return{stdout:"",stderr:`sh: ${o}: No such file or directory
|
|
4
4
|
`,exitCode:127}}}};async function r(t,e,o,i){if(!i.exec)return{stdout:"",stderr:`bash: internal error: exec function not available
|
|
5
5
|
`,exitCode:1};let s=u(i.exportedEnv||{},{0:e,"#":String(o.length),"@":o.join(" "),"*":o.join(" ")});o.forEach((a,p)=>{s[String(p+1)]=a});let n=t;if(n.startsWith("#!")){let a=n.indexOf(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{a as j}from"./chunk-4I3HOE5Z.js";import{c as y}from"./chunk-
|
|
2
|
+
import{a as j}from"./chunk-4I3HOE5Z.js";import{c as y}from"./chunk-XEKXHOPO.js";import{e as v}from"./chunk-BZUGFHVS.js";var w=v(j(),1);function C(){return Object.create(null)}function E(e,r,o){e[r]=o}function b(e){let r=C();for(let o of Object.keys(e)){let s=e[o];(typeof s=="string"||typeof s=="number"||typeof s=="boolean"||s===null)&&(r[o]=s)}return r}function S(e){let r=w.default.parse(e.trim(),{header:!0,dynamicTyping:!0,skipEmptyLines:!0}),o=r.data.map(s=>b(s));return{headers:r.meta.fields||[],data:o}}function I(e,r){return r.length===0?`${e.join(",")}
|
|
3
3
|
`:`${w.default.unparse(r,{columns:e}).replace(/\r\n/g,`
|
|
4
4
|
`)}
|
|
5
5
|
`}async function g(e,r){let o=e.find(p=>!p.startsWith("-")),s;if(!o||o==="-")s=y(r.stdin);else try{let p=r.fs.resolvePath(r.cwd,o);s=await r.fs.readFile(p)}catch{return{headers:[],data:[],error:{stdout:"",stderr:`xan: ${o}: No such file or directory
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
var d=new TextDecoder("utf-8",{fatal:!0}),c=new TextEncoder;function a(t){return t}function x(t){return t}function f(t){let e=t;if(!e)return e;let n=!1;for(let r=0;r<e.length;r++){let u=e.charCodeAt(r);if(u>255)return e;u>127&&(n=!0)}if(!n)return e;let o=new Uint8Array(e.length);for(let r=0;r<e.length;r++)o[r]=e.charCodeAt(r);try{return d.decode(o)}catch{return e}}function s(t){if(!t)return t;let e=c.encode(t),n="";for(let o=0;o<e.length;o++)n+=String.fromCharCode(e[o]);return n}var p="";function y(t){let e="";for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return e}async function l(t,e){return typeof t.readFileBytes=="function"?t.readFileBytes(e):y(await t.readFileBuffer(e))}function i(t){return t.stdoutKind?t.stdoutKind:t.stdoutEncoding==="binary"?"bytes":"text"}function h(t){return i(t)==="bytes"?t.stdout:s(t.stdout)}function B(t){return i(t)==="bytes"?f(t.stdout):t.stdout}function g(t){return{stdout:t,stdoutKind:"text"}}function b(t){return{stdout:t,stdoutKind:"bytes",stdoutEncoding:"binary"}}export{a,x as b,f as c,s as d,p as e,l as f,i as g,h,B as i,g as j,b as k};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{a as y}from"./chunk-SX2HC7SO.js";import{a as c,b as p}from"./chunk-
|
|
2
|
+
import{a as y}from"./chunk-SX2HC7SO.js";import{a as c,b as p}from"./chunk-SY4HAUHP.js";import{a as O}from"./chunk-L2UW7DWF.js";import{a as h,b as A,c as u}from"./chunk-QAYAQNCG.js";var x={name:"timeout",summary:"run a command with a time limit",usage:"timeout [OPTION] DURATION COMMAND [ARG]...",description:`Start COMMAND, and kill it if still running after DURATION.
|
|
3
3
|
|
|
4
4
|
DURATION is a number with optional suffix:
|
|
5
5
|
s - seconds (default)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{a as d}from"./chunk-SX2HC7SO.js";import{a as n,b as i}from"./chunk-
|
|
2
|
+
import{a as d}from"./chunk-SX2HC7SO.js";import{a as n,b as i}from"./chunk-SY4HAUHP.js";import{a,b as l}from"./chunk-QAYAQNCG.js";var u={name:"sleep",summary:"delay for a specified amount of time",usage:"sleep NUMBER[SUFFIX]",description:`Pause for NUMBER seconds. SUFFIX may be:
|
|
3
3
|
s - seconds (default)
|
|
4
4
|
m - minutes
|
|
5
5
|
h - hours
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{c as u}from"./chunk-
|
|
2
|
+
import{c as u}from"./chunk-XEKXHOPO.js";import{a as S}from"./chunk-FOCWZZDE.js";import{a as y}from"./chunk-QIQMJJZ4.js";import{a as m,b as C}from"./chunk-QAYAQNCG.js";var b={name:"tr",summary:"translate or delete characters",usage:"tr [OPTION]... SET1 [SET2]",options:["-c, -C, --complement use the complement of SET1","-d, --delete delete characters in SET1","-s, --squeeze-repeats squeeze repeated characters"," --help display this help and exit"],description:`SET syntax:
|
|
3
3
|
a-z character range
|
|
4
4
|
[:alnum:] all letters and digits
|
|
5
5
|
[:alpha:] all letters
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{a as l,b as n,d as s}from"./chunk-
|
|
2
|
+
import{a as l,b as n,d as s}from"./chunk-PDUL32DM.js";import{a,b as i}from"./chunk-QAYAQNCG.js";var m={name:"tail",summary:"output the last part of files",usage:"tail [OPTION]... [FILE]...",options:["-c, --bytes=NUM print the last NUM bytes","-n, --lines=NUM print the last NUM lines (default 10)","-n +NUM print starting from line NUM","-q, --quiet never print headers giving file names","-v, --verbose always print headers giving file names"," --help display this help and exit"]},d={name:"tail",async execute(t,r){if(i(t))return a(m);let e=l(t,"tail");if(!e.ok)return e.error;let{lines:o,bytes:p,fromLine:f}=e.options;return n(r,e.options,"tail",u=>s(u,o,p,f??!1))}},c={name:"tail",flags:[{flag:"-n",type:"value",valueHint:"number"},{flag:"-c",type:"value",valueHint:"number"},{flag:"-q",type:"boolean"},{flag:"-v",type:"boolean"}],stdinType:"text",needsFiles:!0};export{d as a,c as b};
|