@poe-platform/safe-bash 0.1.798 → 0.1.800
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/README.md +34 -18
- package/dist/image-ast/index.browser.js +1384 -23
- package/dist/image-ast/index.js +1384 -23
- package/dist/mp4-ast/types.d.ts +1 -0
- package/dist/office-package/zip.d.ts +2 -0
- package/dist/office-package/zip.js +1 -1
- package/dist/pdf-ast/index.js +1 -1
- package/dist/safe-bash/chunks/{chunk-IUTD5FH5.js → chunk-46UISJCK.js} +1 -6
- package/dist/safe-bash/chunks/chunk-4SEW2Q6H.js +26 -0
- package/dist/safe-bash/chunks/{chunk-AKC46AF6.js → chunk-7YSRXFEG.js} +7 -40
- package/dist/safe-bash/chunks/{chunk-KTGR4U57.js → chunk-BHJE5LPZ.js} +1 -2
- package/dist/safe-bash/chunks/{chunk-AMTCC256.js → chunk-HHW7MGS2.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-ZNAFMYIA.js → chunk-I7L3G3NX.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-KMH2DF3I.js → chunk-JJSTTIEZ.js} +6 -1
- package/dist/safe-bash/chunks/{chunk-6IBTC4YL.js → chunk-JTLSUJ7V.js} +57 -20
- package/dist/safe-bash/chunks/chunk-K2VCOJ2B.js +111 -0
- package/dist/safe-bash/chunks/chunk-K4YMYFRJ.js +9802 -0
- package/dist/safe-bash/chunks/{chunk-CSNXID73.js → chunk-KW24TAIU.js} +446 -5543
- package/dist/safe-bash/chunks/{chunk-ENR3HB2B.js → chunk-NLAW7KDI.js} +0 -1
- package/dist/safe-bash/chunks/{chunk-B3DDEDH2.js → chunk-PPYM75Z3.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-NX2SQVON.js → chunk-RKKRJ54E.js} +19 -7
- package/dist/safe-bash/chunks/{chunk-V3VEATEA.js → chunk-RMWLWH7Q.js} +870 -953
- package/dist/safe-bash/chunks/{chunk-JSVX4VIA.js → chunk-TFGRKY43.js} +2 -1
- package/dist/safe-bash/chunks/{chunk-T5KKDMYB.js → chunk-TYD7EVUJ.js} +6 -0
- package/dist/safe-bash/chunks/{csvkit-W2UEKH6P.js → csvkit-QGP3GAOB.js} +1 -1
- package/dist/safe-bash/chunks/{ffmpeg-42CGASMV.js → ffmpeg-JTVH26MK.js} +1 -1
- package/dist/safe-bash/chunks/{gh-26GYLH6D.js → gh-I7QX7N5C.js} +1 -1
- package/dist/safe-bash/chunks/{git-YREKMUVD.js → git-MA7NKYVP.js} +1 -1
- package/dist/safe-bash/chunks/{imagemagick-3YIX4XO2.js → imagemagick-Y4NPWX2Q.js} +1 -1
- package/dist/safe-bash/chunks/{implementation-E3YMKU3Z.js → implementation-BWDKOVQJ.js} +1 -1
- package/dist/safe-bash/chunks/mmdc-44PELHDG.js +118 -0
- package/dist/safe-bash/chunks/{pdfimages-UE2UISP2.js → pdfimages-635TRW4Q.js} +1 -1
- package/dist/safe-bash/chunks/{pdfinfo-RGARKLI5.js → pdfinfo-FSDAA2KY.js} +3 -11
- package/dist/safe-bash/chunks/{pdftk-JY3WVCCC.js → pdftk-GQ5UH3VG.js} +1 -1
- package/dist/safe-bash/chunks/{pdftoppm-GPD3BMPY.js → pdftoppm-YTXQCAYT.js} +1 -1
- package/dist/safe-bash/chunks/{pdftotext-K7GQ2QJZ.js → pdftotext-CVA2G7FY.js} +1 -1
- package/dist/safe-bash/chunks/{qpdf-F4U7WUSU.js → qpdf-HZMIFG4A.js} +1 -1
- package/dist/safe-bash/chunks/{sips-RWENS7X5.js → sips-E7UBDP33.js} +1 -1
- package/dist/safe-bash/chunks/{soffice-IT6W2C5F.js → soffice-ELASUWUK.js} +1 -1
- package/dist/safe-bash/chunks/{wkhtmltopdf-JYNDAHIZ.js → wkhtmltopdf-EPO6YCMG.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-2FGJYFWZ.js +44 -0
- package/dist/safe-bash/command-chunks/chunk-2H4JTFIL.js +53 -0
- package/dist/safe-bash/command-chunks/{chunk-THS4YAKG.js → chunk-2QHG43WJ.js} +2 -2
- package/dist/safe-bash/command-chunks/chunk-364TMWBT.js +946 -0
- package/dist/safe-bash/command-chunks/{chunk-JEPY4UY4.js → chunk-3DT2YOGW.js} +11 -6
- package/dist/safe-bash/command-chunks/chunk-3E2OIS2J.js +7037 -0
- package/dist/safe-bash/command-chunks/{chunk-AIRGA2SU.js → chunk-3HXDA5PT.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-3LSOYLNV.js +1091 -0
- package/dist/safe-bash/command-chunks/{chunk-OAJUAAWH.js → chunk-464RVBGB.js} +3 -3
- package/dist/safe-bash/command-chunks/chunk-4B7Y7S6E.js +61 -0
- package/dist/safe-bash/command-chunks/{chunk-HRLIAMXC.js → chunk-4C6QI5BQ.js} +3 -2
- package/dist/safe-bash/command-chunks/{chunk-25BLI6S6.js → chunk-4Y3WVMK4.js} +1 -14
- package/dist/safe-bash/command-chunks/chunk-4ZHMW6F5.js +104 -0
- package/dist/safe-bash/command-chunks/{chunk-YMQKVEIF.js → chunk-52PCQXD2.js} +2 -13
- package/dist/safe-bash/command-chunks/{chunk-SSBFTMVI.js → chunk-53P53XFM.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-ZCKDQGKY.js → chunk-5HDSFHGW.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-5LSGEIZY.js +379 -0
- package/dist/safe-bash/command-chunks/{chunk-MKQVQMXO.js → chunk-5LU4UCBR.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-5T7CRJHW.js +560 -0
- package/dist/safe-bash/command-chunks/chunk-5TBUOBDE.js +346 -0
- package/dist/safe-bash/command-chunks/{chunk-AUAF5YBT.js → chunk-5WPI42ZW.js} +0 -7
- package/dist/safe-bash/command-chunks/chunk-5XY4DTNG.js +34 -0
- package/dist/safe-bash/command-chunks/chunk-5ZMZ573Q.js +140 -0
- package/dist/safe-bash/command-chunks/{chunk-2Q7UQ7R4.js → chunk-67IQF5GC.js} +200 -66
- package/dist/safe-bash/command-chunks/chunk-67QKREJK.js +347 -0
- package/dist/safe-bash/command-chunks/chunk-6EPHJGGF.js +23 -0
- package/dist/safe-bash/command-chunks/chunk-6F4XCVON.js +266 -0
- package/dist/safe-bash/command-chunks/{chunk-ESMCX3YV.js → chunk-6HMX4CQS.js} +669 -130
- package/dist/safe-bash/command-chunks/{chunk-RECJB2BO.js → chunk-7BS66BXN.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-GRWOVSFK.js → chunk-7D7JRRML.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-7K6JYKPJ.js +422 -0
- package/dist/safe-bash/command-chunks/{chunk-E6IYUYVA.js → chunk-7L24L4UO.js} +2 -2
- package/dist/safe-bash/command-chunks/chunk-7N2LI2KO.js +206 -0
- package/dist/safe-bash/command-chunks/chunk-7RGB363W.js +362 -0
- package/dist/safe-bash/command-chunks/{chunk-HBXQWTJR.js → chunk-A5ZAV6DO.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-LW34AKDM.js → chunk-AB4MXHVS.js} +4 -14
- package/dist/safe-bash/command-chunks/{pptx-GBPNWNEP-7EQEVXV5.js → chunk-AI5JAXQF.js} +34820 -18029
- package/dist/safe-bash/command-chunks/chunk-AMO3THU4.js +105 -0
- package/dist/safe-bash/command-chunks/{chunk-EELNLEEP.js → chunk-AXK3H4PX.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-Y55OCH37.js → chunk-AYUTO323.js} +3 -10
- package/dist/safe-bash/command-chunks/{chunk-DY36FDDC.js → chunk-B5TAOCKD.js} +6 -6
- package/dist/safe-bash/command-chunks/chunk-BAGCY35S.js +231 -0
- package/dist/safe-bash/command-chunks/chunk-BAXU7B5Z.js +101 -0
- package/dist/safe-bash/command-chunks/{chunk-YB6KVU6H.js → chunk-BDBVVZY6.js} +4 -14
- package/dist/safe-bash/command-chunks/{chunk-2HOESGFJ.js → chunk-BKCNF5U3.js} +68 -7
- package/dist/safe-bash/command-chunks/chunk-BNOU5YQS.js +182 -0
- package/dist/safe-bash/command-chunks/{chunk-QAN7KKDZ.js → chunk-BZDDAPSV.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-HZCPWYWA.js → chunk-BZPAWTUL.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-C7I25AAL.js +25 -0
- package/dist/safe-bash/command-chunks/chunk-CKXV2CLD.js +65 -0
- package/dist/safe-bash/command-chunks/{chunk-RT2J5ATD.js → chunk-CPPGTBZF.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-CQ5YGOGB.js +150 -0
- package/dist/safe-bash/command-chunks/{chunk-5UA3BEGA.js → chunk-D4OP2BR3.js} +72 -24
- package/dist/safe-bash/command-chunks/chunk-DB453IE6.js +122 -0
- package/dist/safe-bash/command-chunks/chunk-DOKKNRRM.js +87 -0
- package/dist/safe-bash/command-chunks/{chunk-2PX5B7T5.js → chunk-DQAVUDDX.js} +2 -2
- package/dist/safe-bash/command-chunks/chunk-DT7BCTWY.js +249 -0
- package/dist/safe-bash/command-chunks/chunk-E2LB7FRT.js +42 -0
- package/dist/safe-bash/command-chunks/chunk-EK6YNAXT.js +343 -0
- package/dist/safe-bash/command-chunks/chunk-EQ4HV54N.js +22 -0
- package/dist/safe-bash/command-chunks/chunk-ERYJLO6G.js +293 -0
- package/dist/safe-bash/command-chunks/{chunk-4ONEXMD3.js → chunk-EUSPTFAX.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-FKKB5X5V.js +97 -0
- package/dist/safe-bash/command-chunks/chunk-FXELCPFX.js +195 -0
- package/dist/safe-bash/command-chunks/{chunk-HLMUPSM6.js → chunk-GI4CJED2.js} +3 -2
- package/dist/safe-bash/command-chunks/{chunk-CU5RLO62.js → chunk-GLOZX57Y.js} +92 -18
- package/dist/safe-bash/command-chunks/chunk-GMIHJYDG.js +331 -0
- package/dist/safe-bash/command-chunks/chunk-H622NS6Z.js +11 -0
- package/dist/safe-bash/command-chunks/{chunk-QGVOS3EY.js → chunk-HFII3QYO.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-5EWTQJSC.js → chunk-HHP343KT.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-WBJKOTSP.js → chunk-HMOZ6XVJ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-AVSPNLWV.js → chunk-I237SNW5.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-4MS5WZJC.js → chunk-IKS2YXZQ.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-CZVBYCB5.js → chunk-IL53SJL4.js} +2 -12
- package/dist/safe-bash/command-chunks/{chunk-VZ64JXHC.js → chunk-IR2BY7EL.js} +21 -6
- package/dist/safe-bash/command-chunks/chunk-IYPAQ7PH.js +42 -0
- package/dist/safe-bash/command-chunks/chunk-JN7WIP6S.js +94 -0
- package/dist/safe-bash/command-chunks/chunk-JNZ3CVAE.js +147 -0
- package/dist/safe-bash/command-chunks/{chunk-HLBX5IRS.js → chunk-JQ74HC37.js} +24 -32
- package/dist/safe-bash/command-chunks/{chunk-2LLZBNLL.js → chunk-JWE54GHQ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-QLDIP3OP.js → chunk-JZSNU2MY.js} +2 -2
- package/dist/safe-bash/command-chunks/chunk-KFVV7ZJO.js +216 -0
- package/dist/safe-bash/command-chunks/{chunk-G4PNVO6Z.js → chunk-KP7AO66M.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-KWESKQHR.js +25 -0
- package/dist/safe-bash/command-chunks/chunk-KYSPGS33.js +41 -0
- package/dist/safe-bash/command-chunks/{chunk-C7IHMJEW.js → chunk-KZC5UWFF.js} +2 -2
- package/dist/safe-bash/command-chunks/chunk-L6DVEBW3.js +553 -0
- package/dist/safe-bash/command-chunks/chunk-LC2MFKT4.js +2489 -0
- package/dist/safe-bash/command-chunks/chunk-LE5LZNHE.js +204 -0
- package/dist/safe-bash/command-chunks/chunk-MDH5T4OS.js +41 -0
- package/dist/safe-bash/command-chunks/chunk-MM6HU6CX.js +20 -0
- package/dist/safe-bash/command-chunks/{chunk-MYJAZ3U2.js → chunk-MPL2466A.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-3TANKHBX.js → chunk-MRW5HD2D.js} +1 -6
- package/dist/safe-bash/command-chunks/{chunk-3WKA57FA.js → chunk-N5FGCXQJ.js} +1 -9
- package/dist/safe-bash/command-chunks/{chunk-VZHRZMS7.js → chunk-NAY27PXB.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-NCD7PEWH.js +298 -0
- package/dist/safe-bash/command-chunks/chunk-NFGI5IGF.js +266 -0
- package/dist/safe-bash/command-chunks/{chunk-U3ONEICA.js → chunk-NXEQ3ESQ.js} +7 -11
- package/dist/safe-bash/command-chunks/{chunk-3VGGYEDH.js → chunk-ORYGZYKW.js} +4 -3
- package/dist/safe-bash/command-chunks/{chunk-OLQG7ZCN.js → chunk-PEF7K3UQ.js} +136 -75
- package/dist/safe-bash/command-chunks/{chunk-HVI6ALJF.js → chunk-PFAADCB5.js} +2 -4
- package/dist/safe-bash/command-chunks/chunk-PII4YEZW.js +123 -0
- package/dist/safe-bash/command-chunks/{chunk-JG5W2ENK.js → chunk-PJJUYO3R.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-VKQCNX32.js → chunk-PTT3I223.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-Q3DII3Q7.js +174 -0
- package/dist/safe-bash/command-chunks/chunk-Q3EWDEUQ.js +185 -0
- package/dist/safe-bash/command-chunks/{chunk-JXU2N6GN.js → chunk-Q7Q5GM5S.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-Z5TFSVNU.js → chunk-QAKKSRNV.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-2FUAW6GO.js → chunk-QI7LGHJJ.js} +58 -9
- package/dist/safe-bash/command-chunks/{chunk-6BETHLXZ.js → chunk-QJAFJP2G.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-QNIMV57G.js +63 -0
- package/dist/safe-bash/command-chunks/{chunk-KAHH4XOU.js → chunk-QNXI2UP6.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-AC6X7Q4I.js → chunk-QP4R6GLA.js} +6 -9
- package/dist/safe-bash/command-chunks/{chunk-LPORMIZS.js → chunk-QWIDNAAK.js} +8 -8
- package/dist/safe-bash/command-chunks/chunk-RVLO4DYT.js +35 -0
- package/dist/safe-bash/command-chunks/{chunk-X2YQLGKS.js → chunk-SAMH7SQE.js} +4 -4
- package/dist/safe-bash/command-chunks/chunk-SEM36PG5.js +11 -0
- package/dist/safe-bash/command-chunks/chunk-STC3LEWJ.js +634 -0
- package/dist/safe-bash/command-chunks/chunk-SVULUDOP.js +331 -0
- package/dist/safe-bash/command-chunks/{chunk-WYOL5JNT.js → chunk-SX2X3IH4.js} +4 -4
- package/dist/safe-bash/command-chunks/chunk-TEVJJPTC.js +1392 -0
- package/dist/safe-bash/command-chunks/{chunk-6N5V4VBN.js → chunk-TYCGMRLM.js} +2 -2
- package/dist/safe-bash/command-chunks/chunk-UG7SMZFF.js +178 -0
- package/dist/safe-bash/command-chunks/{chunk-PRCT7FKJ.js → chunk-UMDIOL3O.js} +3 -3
- package/dist/safe-bash/command-chunks/chunk-UXSR5BZH.js +136 -0
- package/dist/safe-bash/command-chunks/chunk-V6BEDRMQ.js +112 -0
- package/dist/safe-bash/command-chunks/chunk-V6MSPQLA.js +362 -0
- package/dist/safe-bash/command-chunks/{chunk-J4PEQWSF.js → chunk-VGG2DL5Q.js} +0 -1
- package/dist/safe-bash/command-chunks/{chunk-SG424QWS.js → chunk-VL67NWNS.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-WB5SVIG7.js +1034 -0
- package/dist/safe-bash/command-chunks/{src-UJOWAS2S.js → chunk-WD3ERGRY.js} +77 -277
- package/dist/safe-bash/command-chunks/{chunk-YFSDDFGV.js → chunk-WH627NJL.js} +446 -53
- package/dist/safe-bash/command-chunks/chunk-WNE7FPVR.js +236 -0
- package/dist/safe-bash/command-chunks/{chunk-UKS2XJZI.js → chunk-WPYIOKE3.js} +4 -4
- package/dist/safe-bash/command-chunks/chunk-XETLEHZP.js +1227 -0
- package/dist/safe-bash/command-chunks/chunk-XIIBTGC5.js +580 -0
- package/dist/safe-bash/command-chunks/chunk-XJXU3VVH.js +737 -0
- package/dist/safe-bash/command-chunks/{chunk-JCVXAX2G.js → chunk-XWZBMJ5B.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-Y5INTD6S.js +220 -0
- package/dist/safe-bash/command-chunks/{chunk-23XLM73P.js → chunk-YEOPI5SK.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-PPOIPMY4.js → chunk-YGC6OS5O.js} +3 -56
- package/dist/safe-bash/command-chunks/chunk-YJDV76GL.js +262 -0
- package/dist/safe-bash/command-chunks/chunk-YOF7R4OY.js +80 -0
- package/dist/safe-bash/command-chunks/chunk-Z7RVSD5K.js +594 -0
- package/dist/safe-bash/command-chunks/chunk-ZHUWOUWB.js +618 -0
- package/dist/safe-bash/command-chunks/{chunk-OGUMMTTD.js → chunk-ZJBR5Q5I.js} +4 -4
- package/dist/safe-bash/command-chunks/{model-store-L35QTZMJ.js → model-store-WPKMRPV4.js} +2 -2
- package/dist/safe-bash/command-chunks/pptx-7G52EJ6L-4JACH5FB.js +625 -0
- package/dist/safe-bash/command-chunks/python-worker-source-TYOFJMCW.js +4 -0
- package/dist/safe-bash/command-chunks/src-ICMQISAA.js +501 -0
- package/dist/safe-bash/commands/archive/create.d.ts +1 -17
- package/dist/safe-bash/commands/archive/create.js +1 -252
- package/dist/safe-bash/commands/archive/extract.d.ts +1 -11
- package/dist/safe-bash/commands/archive/extract.js +1 -640
- package/dist/safe-bash/commands/archive/format.d.ts +1 -32
- package/dist/safe-bash/commands/archive/format.js +1 -225
- package/dist/safe-bash/commands/archive/index.d.ts +5 -10
- package/dist/safe-bash/commands/archive/index.js +6 -931
- package/dist/safe-bash/commands/archive/listing.d.ts +1 -2
- package/dist/safe-bash/commands/archive/listing.js +1 -21
- package/dist/safe-bash/commands/archive/modes.d.ts +1 -5
- package/dist/safe-bash/commands/archive/modes.js +1 -182
- package/dist/safe-bash/commands/archive/options.d.ts +1 -53
- package/dist/safe-bash/commands/archive/options.js +1 -462
- package/dist/safe-bash/commands/archive/stream.d.ts +1 -22
- package/dist/safe-bash/commands/archive/stream.js +1 -188
- package/dist/safe-bash/commands/archive/transform.d.ts +1 -16
- package/dist/safe-bash/commands/archive/transform.js +1 -85
- package/dist/safe-bash/commands/archive/unzip/arguments.d.ts +1 -53
- package/dist/safe-bash/commands/archive/unzip/arguments.js +1 -322
- package/dist/safe-bash/commands/archive/unzip/safety.d.ts +1 -32
- package/dist/safe-bash/commands/archive/unzip/safety.js +1 -295
- package/dist/safe-bash/commands/archive/unzip.d.ts +1 -3
- package/dist/safe-bash/commands/archive/unzip.js +1 -398
- package/dist/safe-bash/commands/archive/zip/aes.d.ts +1 -17
- package/dist/safe-bash/commands/archive/zip/aes.js +1 -156
- package/dist/safe-bash/commands/archive/zip/comments.d.ts +1 -17
- package/dist/safe-bash/commands/archive/zip/comments.js +1 -83
- package/dist/safe-bash/commands/archive/zip/crc.d.ts +1 -1
- package/dist/safe-bash/commands/archive/zip/crc.js +1 -1
- package/dist/safe-bash/commands/archive/zip/crypto.d.ts +1 -19
- package/dist/safe-bash/commands/archive/zip/crypto.js +1 -118
- package/dist/safe-bash/commands/archive/zip/dates.d.ts +1 -4
- package/dist/safe-bash/commands/archive/zip/dates.js +1 -66
- package/dist/safe-bash/commands/archive/zip/environment.d.ts +1 -2
- package/dist/safe-bash/commands/archive/zip/environment.js +1 -62
- package/dist/safe-bash/commands/archive/zip/grow.d.ts +1 -3
- package/dist/safe-bash/commands/archive/zip/grow.js +1 -2
- package/dist/safe-bash/commands/archive/zip/help.d.ts +1 -4
- package/dist/safe-bash/commands/archive/zip/help.js +1 -182
- package/dist/safe-bash/commands/archive/zip/line-endings.d.ts +1 -2
- package/dist/safe-bash/commands/archive/zip/line-endings.js +1 -194
- package/dist/safe-bash/commands/archive/zip/log.d.ts +1 -22
- package/dist/safe-bash/commands/archive/zip/log.js +1 -159
- package/dist/safe-bash/commands/archive/zip/lzma.d.ts +1 -9
- package/dist/safe-bash/commands/archive/zip/lzma.js +1 -40
- package/dist/safe-bash/commands/archive/zip/move.d.ts +1 -11
- package/dist/safe-bash/commands/archive/zip/move.js +1 -59
- package/dist/safe-bash/commands/archive/zip/names.d.ts +1 -2
- package/dist/safe-bash/commands/archive/zip/names.js +1 -33
- package/dist/safe-bash/commands/archive/zip/options.d.ts +1 -13
- package/dist/safe-bash/commands/archive/zip/options.js +1 -124
- package/dist/safe-bash/commands/archive/zip/repair.d.ts +1 -10
- package/dist/safe-bash/commands/archive/zip/repair.js +1 -392
- package/dist/safe-bash/commands/archive/zip/safety.d.ts +1 -54
- package/dist/safe-bash/commands/archive/zip/safety.js +1 -360
- package/dist/safe-bash/commands/archive/zip/sfx.d.ts +1 -4
- package/dist/safe-bash/commands/archive/zip/sfx.js +1 -52
- package/dist/safe-bash/commands/archive/zip/test-command.d.ts +1 -5
- package/dist/safe-bash/commands/archive/zip/test-command.js +1 -101
- package/dist/safe-bash/commands/archive/zip/volumes.d.ts +1 -21
- package/dist/safe-bash/commands/archive/zip/volumes.js +1 -281
- package/dist/safe-bash/commands/archive/zip/zip64.d.ts +1 -30
- package/dist/safe-bash/commands/archive/zip/zip64.js +1 -227
- package/dist/safe-bash/commands/archive/zip-format.d.ts +1 -68
- package/dist/safe-bash/commands/archive/zip-format.js +1 -1075
- package/dist/safe-bash/commands/archive/zip.d.ts +1 -3
- package/dist/safe-bash/commands/archive/zip.js +1 -1523
- package/dist/safe-bash/commands/awk/index.d.ts +2 -0
- package/dist/safe-bash/commands/awk/index.js +2 -0
- package/dist/safe-bash/commands/bytes/compression/index.js +2 -1
- package/dist/safe-bash/commands/curl/index.d.ts +2 -0
- package/dist/safe-bash/commands/curl/index.js +2 -0
- package/dist/safe-bash/commands/diff/index.d.ts +2 -0
- package/dist/safe-bash/commands/diff/index.js +2 -0
- package/dist/safe-bash/commands/diff-patch/diff-format.d.ts +1 -10
- package/dist/safe-bash/commands/diff-patch/diff-format.js +1 -237
- package/dist/safe-bash/commands/diff-patch/diff-options.d.ts +1 -38
- package/dist/safe-bash/commands/diff-patch/diff-options.js +1 -261
- package/dist/safe-bash/commands/diff-patch/diff-output.d.ts +1 -20
- package/dist/safe-bash/commands/diff-patch/diff-output.js +1 -290
- package/dist/safe-bash/commands/diff-patch/diff.d.ts +1 -2
- package/dist/safe-bash/commands/diff-patch/diff.js +1 -656
- package/dist/safe-bash/commands/diff-patch/index.d.ts +4 -5
- package/dist/safe-bash/commands/diff-patch/index.js +8 -333
- package/dist/safe-bash/commands/diff-patch/patch-envelope.d.ts +1 -2
- package/dist/safe-bash/commands/diff-patch/patch-envelope.js +1 -63
- package/dist/safe-bash/commands/diff-patch/patch-formats.d.ts +1 -7
- package/dist/safe-bash/commands/diff-patch/patch-formats.js +1 -264
- package/dist/safe-bash/commands/diff-patch/patch-gnu-paths.d.ts +1 -41
- package/dist/safe-bash/commands/diff-patch/patch-gnu-paths.js +1 -263
- package/dist/safe-bash/commands/diff-patch/patch-gnu-reject.d.ts +1 -3
- package/dist/safe-bash/commands/diff-patch/patch-gnu-reject.js +1 -100
- package/dist/safe-bash/commands/diff-patch/patch-path.d.ts +1 -3
- package/dist/safe-bash/commands/diff-patch/patch-path.js +1 -91
- package/dist/safe-bash/commands/diff-patch/patch-publication.d.ts +1 -13
- package/dist/safe-bash/commands/diff-patch/patch-publication.js +1 -107
- package/dist/safe-bash/commands/diff-patch/patch.d.ts +1 -2
- package/dist/safe-bash/commands/diff-patch/patch.js +1 -653
- package/dist/safe-bash/commands/diff-patch/shared.d.ts +1 -55
- package/dist/safe-bash/commands/diff-patch/shared.js +1 -276
- package/dist/safe-bash/commands/diff-patch/unified.d.ts +1 -52
- package/dist/safe-bash/commands/diff-patch/unified.js +1 -385
- package/dist/safe-bash/commands/directory-admission.d.ts +1 -3
- package/dist/safe-bash/commands/directory-admission.js +1 -26
- package/dist/safe-bash/commands/find/index.d.ts +2 -0
- package/dist/safe-bash/commands/find/index.js +2 -0
- package/dist/safe-bash/commands/find-format.d.ts +1 -20
- package/dist/safe-bash/commands/find-format.js +1 -161
- package/dist/safe-bash/commands/find.d.ts +2 -18
- package/dist/safe-bash/commands/find.js +2 -1236
- package/dist/safe-bash/commands/gzip/index.d.ts +2 -0
- package/dist/safe-bash/commands/gzip/index.js +2 -0
- package/dist/safe-bash/commands/line-endings/index.browser.js +1 -1
- package/dist/safe-bash/commands/line-endings/index.d.ts +1 -1
- package/dist/safe-bash/commands/line-endings/index.js +1 -262
- package/dist/safe-bash/commands/llm/index.browser.js +3 -1
- package/dist/safe-bash/commands/mdq/index.browser.js +2 -2
- package/dist/safe-bash/commands/metadata/chmod.d.ts +1 -4
- package/dist/safe-bash/commands/metadata/chmod.js +2 -63
- package/dist/safe-bash/commands/network/aggregate.d.ts +1 -4
- package/dist/safe-bash/commands/network/aggregate.js +1 -23
- package/dist/safe-bash/commands/network/args.d.ts +1 -68
- package/dist/safe-bash/commands/network/args.js +1 -321
- package/dist/safe-bash/commands/network/authorizer.d.ts +1 -6
- package/dist/safe-bash/commands/network/authorizer.js +1 -33
- package/dist/safe-bash/commands/network/body.d.ts +1 -9
- package/dist/safe-bash/commands/network/body.js +1 -393
- package/dist/safe-bash/commands/network/curl.d.ts +3 -13
- package/dist/safe-bash/commands/network/curl.js +6 -693
- package/dist/safe-bash/commands/network/deadline.d.ts +1 -2
- package/dist/safe-bash/commands/network/deadline.js +1 -14
- package/dist/safe-bash/commands/network/decode.d.ts +1 -2
- package/dist/safe-bash/commands/network/decode.js +1 -79
- package/dist/safe-bash/commands/network/fetch-transport.d.ts +1 -7
- package/dist/safe-bash/commands/network/fetch-transport.js +1 -94
- package/dist/safe-bash/commands/network/form-content-type.d.ts +1 -5
- package/dist/safe-bash/commands/network/form-content-type.js +1 -63
- package/dist/safe-bash/commands/network/form-headers.d.ts +1 -2
- package/dist/safe-bash/commands/network/form-headers.js +1 -35
- package/dist/safe-bash/commands/network/glob.d.ts +1 -7
- package/dist/safe-bash/commands/network/glob.js +1 -134
- package/dist/safe-bash/commands/network/index.browser.js +2 -10
- package/dist/safe-bash/commands/network/input.d.ts +1 -5
- package/dist/safe-bash/commands/network/input.js +1 -276
- package/dist/safe-bash/commands/network/output.d.ts +1 -6
- package/dist/safe-bash/commands/network/output.js +1 -131
- package/dist/safe-bash/commands/network/private-address.d.ts +1 -1
- package/dist/safe-bash/commands/network/private-address.js +1 -44
- package/dist/safe-bash/commands/network/shared.d.ts +1 -14
- package/dist/safe-bash/commands/network/shared.js +1 -71
- package/dist/safe-bash/commands/network/types.d.ts +1 -37
- package/dist/safe-bash/commands/network/types.js +1 -31
- package/dist/safe-bash/commands/network/url.d.ts +1 -2
- package/dist/safe-bash/commands/network/url.js +1 -30
- package/dist/safe-bash/commands/network/wget.d.ts +3 -3
- package/dist/safe-bash/commands/network/wget.js +10 -331
- package/dist/safe-bash/commands/node/index.browser.js +4 -5
- package/dist/safe-bash/commands/node/index.d.ts +3 -3
- package/dist/safe-bash/commands/node/index.js +5 -0
- package/dist/safe-bash/commands/node/safejs.d.ts +3 -3
- package/dist/safe-bash/commands/node/safejs.js +6 -1
- package/dist/safe-bash/commands/node/types.d.ts +1 -1
- package/dist/safe-bash/commands/node/unconfigured.d.ts +3 -0
- package/dist/safe-bash/commands/node/unconfigured.js +10 -0
- package/dist/safe-bash/commands/op/index.browser.js +2 -2
- package/dist/safe-bash/commands/patch/index.d.ts +2 -0
- package/dist/safe-bash/commands/patch/index.js +2 -0
- package/dist/safe-bash/commands/pdfinfo/index.js +2 -1
- package/dist/safe-bash/commands/predicates.js +3 -4
- package/dist/safe-bash/commands/python/index.browser.js +5 -5
- package/dist/safe-bash/commands/python/llm-capability.d.ts +1 -0
- package/dist/safe-bash/commands/python/llm-capability.js +27 -7
- package/dist/safe-bash/commands/python/llm-module.js +11 -0
- package/dist/safe-bash/commands/python/manifest.d.ts +1 -0
- package/dist/safe-bash/commands/python/manifest.js +9 -5
- package/dist/safe-bash/commands/python/provisioning.js +1 -1
- package/dist/safe-bash/commands/regex-execution/matching.js +1 -2
- package/dist/safe-bash/commands/regex-execution/public.browser.js +5 -5
- package/dist/safe-bash/commands/search/index.d.ts +1 -1
- package/dist/safe-bash/commands/search/index.js +1 -347
- package/dist/safe-bash/commands/search/portable.d.ts +2 -2
- package/dist/safe-bash/commands/search/portable.js +3 -2
- package/dist/safe-bash/commands/sed/index.d.ts +2 -0
- package/dist/safe-bash/commands/sed/index.js +2 -0
- package/dist/safe-bash/commands/tar/index.d.ts +2 -0
- package/dist/safe-bash/commands/tar/index.js +2 -0
- package/dist/safe-bash/commands/text-programs/awk-inspection.d.ts +1 -19
- package/dist/safe-bash/commands/text-programs/awk-inspection.js +1 -50
- package/dist/safe-bash/commands/text-programs/awk-pipes.d.ts +2 -0
- package/dist/safe-bash/commands/text-programs/awk-pipes.js +2 -0
- package/dist/safe-bash/commands/text-programs/awk-pretty.d.ts +1 -3
- package/dist/safe-bash/commands/text-programs/awk-pretty.js +1 -197
- package/dist/safe-bash/commands/text-programs/awk-quote.d.ts +1 -2
- package/dist/safe-bash/commands/text-programs/awk-quote.js +1 -15
- package/dist/safe-bash/commands/text-programs/awk-reader.d.ts +1 -42
- package/dist/safe-bash/commands/text-programs/awk-reader.js +1 -449
- package/dist/safe-bash/commands/text-programs/awk-retention.d.ts +1 -13
- package/dist/safe-bash/commands/text-programs/awk-retention.js +1 -51
- package/dist/safe-bash/commands/text-programs/awk-runtime.d.ts +1 -150
- package/dist/safe-bash/commands/text-programs/awk-runtime.js +1 -2627
- package/dist/safe-bash/commands/text-programs/awk-syntax.d.ts +1 -142
- package/dist/safe-bash/commands/text-programs/awk-syntax.js +1 -509
- package/dist/safe-bash/commands/text-programs/awk-values.d.ts +1 -32
- package/dist/safe-bash/commands/text-programs/awk-values.js +1 -386
- package/dist/safe-bash/commands/text-programs/awk.d.ts +1 -3
- package/dist/safe-bash/commands/text-programs/awk.js +1 -361
- package/dist/safe-bash/commands/text-programs/inplace.d.ts +1 -16
- package/dist/safe-bash/commands/text-programs/inplace.js +1 -155
- package/dist/safe-bash/commands/text-programs/sed.d.ts +1 -3
- package/dist/safe-bash/commands/text-programs/sed.js +1 -1647
- package/dist/safe-bash/commands/text.js +1 -25
- package/dist/safe-bash/commands/unzip/index.d.ts +2 -0
- package/dist/safe-bash/commands/unzip/index.js +2 -0
- package/dist/safe-bash/commands/wget/index.d.ts +2 -0
- package/dist/safe-bash/commands/wget/index.js +2 -0
- package/dist/safe-bash/commands/yq/index.browser.js +7 -2
- package/dist/safe-bash/commands/yq/index.d.ts +1 -6
- package/dist/safe-bash/commands/yq/index.js +1 -36
- package/dist/safe-bash/commands/zip/index.d.ts +2 -0
- package/dist/safe-bash/commands/zip/index.js +2 -0
- package/dist/safe-bash/core.browser.js +1 -1
- package/dist/safe-bash/core.d.ts +8 -1
- package/dist/safe-bash/core.js +7 -1
- package/dist/safe-bash/fs/s3/index.d.ts +2 -2
- package/dist/safe-bash/fs/s3/index.js +1 -1
- package/dist/safe-bash/full-core.browser.js +254 -223
- package/dist/safe-bash/jobs.browser.js +2 -2
- package/dist/safe-bash/lazy-mmdc.d.ts +6 -0
- package/dist/safe-bash/lazy-mmdc.js +23 -0
- package/dist/safe-bash/opt-in/commands/dd/index.js +4 -13
- package/dist/safe-bash/opt-in/commands/yq/mike.js +6 -13
- package/dist/safe-bash/opt-in/commands/yq/native-work.d.ts +1 -0
- package/dist/safe-bash/opt-in/commands/yq/native-work.js +19 -1
- package/dist/safe-bash/opt-in/optional/commands/shuf/input.js +3 -21
- package/dist/safe-bash/opt-in/optional/commands/shuf/shuf.js +4 -27
- package/dist/safe-bash/optional-host.browser.js +8 -4
- package/dist/safe-bash/optional-host.d.ts +1 -1
- package/dist/safe-bash/optional-host.js +1 -1
- package/dist/safe-bash/playwright/ability-execution.js +3 -2
- package/dist/safe-bash/playwright/adapter.js +1 -1
- package/dist/safe-bash/playwright/controller.js +9 -8
- package/dist/safe-bash/playwright/modal-capabilities.js +2 -1
- package/dist/safe-bash/playwright/native-json-snapshot.js +4 -3
- package/dist/safe-bash/playwright/native-snapshot.js +5 -4
- package/dist/safe-bash/playwright/open-options.js +3 -3
- package/dist/safe-bash/playwright/resource-limit.d.ts +2 -0
- package/dist/safe-bash/playwright/resource-limit.js +4 -0
- package/dist/safe-bash/playwright/session-configuration.js +8 -3
- package/dist/safe-bash/playwright/snapshot.js +8 -7
- package/dist/safe-bash/playwright/standard-capabilities.js +5 -4
- package/dist/safe-bash/plugins/index.browser.js +14 -16
- package/dist/safe-bash/registry-entry.browser.js +14 -16
- package/dist/safe-bash/shell/arrays/bindings.d.ts +3 -5
- package/dist/safe-bash/shell/arrays/bindings.js +6 -2
- package/dist/safe-bash/shell/input.js +16 -14
- package/dist/safe-bash/shell/runtime.d.ts +3 -0
- package/dist/safe-bash/shell/runtime.js +316 -64
- package/dist/safe-bash/shell/types.d.ts +2 -0
- package/dist/safe-bash/shell/value-state.js +17 -2
- package/dist/safe-bash/shell/worker-limits.js +1 -0
- package/dist/safe-bash/shell-entry.browser.js +13 -15
- package/dist/safe-bash/trap.browser.d.ts +3 -0
- package/dist/safe-bash/trap.browser.js +14 -0
- package/dist/safe-bash/worker/host.js +1 -1
- package/dist/safe-bash-command-apply-patch/apply.js +2 -2
- package/dist/safe-bash-command-apply-patch/index.js +3 -3
- package/dist/safe-bash-command-awk/LICENSE +21 -0
- package/dist/safe-bash-command-awk/awk-inspection.d.ts +19 -0
- package/dist/safe-bash-command-awk/awk-inspection.js +9 -0
- package/dist/safe-bash-command-awk/awk-pipes.d.ts +19 -0
- package/dist/safe-bash-command-awk/awk-pipes.js +8 -0
- package/dist/safe-bash-command-awk/awk-pretty.d.ts +3 -0
- package/dist/safe-bash-command-awk/awk-pretty.js +8 -0
- package/dist/safe-bash-command-awk/awk-quote.d.ts +2 -0
- package/dist/safe-bash-command-awk/awk-quote.js +7 -0
- package/dist/safe-bash-command-awk/awk-reader.d.ts +42 -0
- package/dist/safe-bash-command-awk/awk-reader.js +9 -0
- package/dist/safe-bash-command-awk/awk-retention.d.ts +13 -0
- package/dist/safe-bash-command-awk/awk-retention.js +7 -0
- package/dist/safe-bash-command-awk/awk-runtime.d.ts +151 -0
- package/dist/safe-bash-command-awk/awk-runtime.js +11 -0
- package/dist/safe-bash-command-awk/awk-syntax.d.ts +144 -0
- package/dist/safe-bash-command-awk/awk-syntax.js +14 -0
- package/dist/safe-bash-command-awk/awk-values.d.ts +32 -0
- package/dist/safe-bash-command-awk/awk-values.js +35 -0
- package/dist/safe-bash-command-awk/awk.d.ts +3 -0
- package/dist/safe-bash-command-awk/awk.js +16 -0
- package/dist/safe-bash-command-awk/index.d.ts +7 -0
- package/dist/safe-bash-command-awk/index.js +36 -0
- package/dist/safe-bash-command-bc/index.d.ts +4 -0
- package/dist/safe-bash-command-bc/index.js +15 -176
- package/dist/safe-bash-command-column/column.js +3 -3
- package/dist/safe-bash-command-column/index.js +3 -3
- package/dist/safe-bash-command-column/layout.js +2 -2
- package/dist/safe-bash-command-csplit/command.js +2 -2
- package/dist/safe-bash-command-csplit/index.js +2 -2
- package/dist/safe-bash-command-csvkit/contracts.d.ts +1 -0
- package/dist/safe-bash-command-csvkit/csvpy-interpreter.d.ts +2 -1
- package/dist/safe-bash-command-csvkit/default-csvpy.d.ts +11 -0
- package/dist/safe-bash-command-csvkit/errors.js +22 -0
- package/dist/safe-bash-command-csvkit/index.d.ts +1 -0
- package/dist/safe-bash-command-csvkit/index.js +172 -4
- package/dist/safe-bash-command-csvkit/python-worker-browser.d.ts +3 -0
- package/dist/safe-bash-command-csvkit/python-worker-browser.js +16 -0
- package/dist/safe-bash-command-csvkit/python-worker-contract.d.ts +20 -0
- package/dist/safe-bash-command-csvkit/python-worker-node.d.ts +3 -0
- package/dist/safe-bash-command-csvkit/python-worker-node.js +9 -0
- package/dist/safe-bash-command-csvkit/runtime.d.ts +1 -0
- package/dist/safe-bash-command-curl/LICENSE +21 -0
- package/dist/safe-bash-command-curl/curl.d.ts +13 -0
- package/dist/safe-bash-command-curl/curl.js +9 -0
- package/dist/safe-bash-command-curl/index.d.ts +6 -0
- package/dist/safe-bash-command-curl/index.js +26 -0
- package/dist/safe-bash-command-dd/index.js +4 -13
- package/dist/safe-bash-command-diff/LICENSE +21 -0
- package/dist/safe-bash-command-diff/diff-format.d.ts +10 -0
- package/dist/safe-bash-command-diff/diff-format.js +10 -0
- package/dist/safe-bash-command-diff/diff-options.d.ts +38 -0
- package/dist/safe-bash-command-diff/diff-options.js +7 -0
- package/dist/safe-bash-command-diff/diff-output.d.ts +20 -0
- package/dist/safe-bash-command-diff/diff-output.js +19 -0
- package/dist/safe-bash-command-diff/diff.d.ts +2 -0
- package/dist/safe-bash-command-diff/diff.js +10 -0
- package/dist/safe-bash-command-diff/index.d.ts +8 -0
- package/dist/safe-bash-command-diff/index.js +34 -0
- package/dist/safe-bash-command-diff/sync.d.ts +2 -0
- package/dist/safe-bash-command-diff/sync.js +9 -0
- package/dist/safe-bash-command-diff3/index.js +5 -5
- package/dist/safe-bash-command-docx/index.d.ts +4 -4
- package/dist/safe-bash-command-docx/index.js +12 -5
- package/dist/safe-bash-command-dos2unix/index.d.ts +1 -0
- package/dist/safe-bash-command-dos2unix/index.js +225 -1
- package/dist/safe-bash-command-dos2unix/sync.d.ts +1 -0
- package/dist/safe-bash-command-du/budget.d.ts +0 -2
- package/dist/safe-bash-command-du/budget.js +1 -1
- package/dist/safe-bash-command-du/du.js +2 -2
- package/dist/safe-bash-command-du/index.js +2 -2
- package/dist/safe-bash-command-exiftool/index.js +2 -2
- package/dist/safe-bash-command-factor/command.js +2 -2
- package/dist/safe-bash-command-factor/index.js +2 -2
- package/dist/safe-bash-command-ffmpeg/index.js +86 -94
- package/dist/safe-bash-command-file/index.js +4 -4
- package/dist/safe-bash-command-file/shared.d.ts +0 -2
- package/dist/safe-bash-command-file/shared.js +1 -1
- package/dist/safe-bash-command-find/LICENSE +21 -0
- package/dist/safe-bash-command-find/find-format.d.ts +20 -0
- package/dist/safe-bash-command-find/find-format.js +9 -0
- package/dist/safe-bash-command-find/find.d.ts +18 -0
- package/dist/safe-bash-command-find/find.js +10 -0
- package/dist/safe-bash-command-find/index.d.ts +13 -0
- package/dist/safe-bash-command-find/index.js +45 -0
- package/dist/safe-bash-command-fmt/index.js +10 -19
- package/dist/safe-bash-command-git/git_rust.wasm +0 -0
- package/dist/safe-bash-command-git/index.js +5 -7
- package/dist/safe-bash-command-git/wasm.generated.js +1 -1
- package/dist/safe-bash-command-gzip/LICENSE +21 -0
- package/dist/safe-bash-command-gzip/index.d.ts +11 -0
- package/dist/safe-bash-command-gzip/index.js +94 -0
- package/dist/safe-bash-command-html-to-markdown/budget.d.ts +0 -3
- package/dist/safe-bash-command-html-to-markdown/budget.js +1 -1
- package/dist/safe-bash-command-html-to-markdown/entities.js +3 -3
- package/dist/safe-bash-command-html-to-markdown/index.js +11 -11
- package/dist/safe-bash-command-html-to-markdown/input.js +5 -5
- package/dist/safe-bash-command-html-to-markdown/parser.js +4 -4
- package/dist/safe-bash-command-html-to-markdown/render.js +5 -5
- package/dist/safe-bash-command-html-to-markdown/text.js +2 -2
- package/dist/safe-bash-command-htmlq/index.js +12 -8
- package/dist/safe-bash-command-iconv/command.js +5 -5
- package/dist/safe-bash-command-iconv/index.js +5 -5
- package/dist/safe-bash-command-iconv/internal.d.ts +0 -2
- package/dist/safe-bash-command-iconv/internal.js +1 -1
- package/dist/safe-bash-command-iconv/lifecycle.js +2 -2
- package/dist/safe-bash-command-iconv/options.js +2 -2
- package/dist/safe-bash-command-iconv/reader.js +2 -2
- package/dist/safe-bash-command-imagemagick/index.js +22 -30
- package/dist/safe-bash-command-jq/index.js +1 -1
- package/dist/safe-bash-command-jq/jq.js +1 -1
- package/dist/safe-bash-command-llm/command.js +1 -1
- package/dist/safe-bash-command-llm/index.d.ts +1 -0
- package/dist/safe-bash-command-llm/index.js +16 -14
- package/dist/safe-bash-command-llm/openai.js +3 -3
- package/dist/safe-bash-command-llm/providers/index.js +3 -3
- package/dist/safe-bash-command-llm/providers/openai.js +3 -3
- package/dist/safe-bash-command-llm/stored-schema.d.ts +10 -0
- package/dist/safe-bash-command-mmdc/index.js +13 -604
- package/dist/safe-bash-command-mmdc/settings.d.ts +2 -0
- package/dist/safe-bash-command-mmdc/settings.js +7 -0
- package/dist/safe-bash-command-numfmt/index.js +4 -18
- package/dist/safe-bash-command-pandoc/command.js +4 -3
- package/dist/safe-bash-command-pandoc/defaults.d.ts +1 -0
- package/dist/safe-bash-command-pandoc/index.js +4 -3
- package/dist/safe-bash-command-pandoc/lua-filters.js +1 -1
- package/dist/safe-bash-command-pandoc/types.d.ts +3 -1
- package/dist/safe-bash-command-patch/LICENSE +21 -0
- package/dist/safe-bash-command-patch/index.d.ts +8 -0
- package/dist/safe-bash-command-patch/index.js +38 -0
- package/dist/safe-bash-command-patch/patch-envelope.d.ts +2 -0
- package/dist/safe-bash-command-patch/patch-envelope.js +7 -0
- package/dist/safe-bash-command-patch/patch-formats.d.ts +7 -0
- package/dist/safe-bash-command-patch/patch-formats.js +9 -0
- package/dist/safe-bash-command-patch/patch-gnu-paths.d.ts +41 -0
- package/dist/safe-bash-command-patch/patch-gnu-paths.js +26 -0
- package/dist/safe-bash-command-patch/patch-gnu-reject.d.ts +3 -0
- package/dist/safe-bash-command-patch/patch-gnu-reject.js +7 -0
- package/dist/safe-bash-command-patch/patch-path.d.ts +3 -0
- package/dist/safe-bash-command-patch/patch-path.js +11 -0
- package/dist/safe-bash-command-patch/patch-publication.d.ts +13 -0
- package/dist/safe-bash-command-patch/patch-publication.js +7 -0
- package/dist/safe-bash-command-patch/patch.d.ts +2 -0
- package/dist/safe-bash-command-patch/patch.js +14 -0
- package/dist/safe-bash-command-patch/sync.d.ts +2 -0
- package/dist/safe-bash-command-patch/sync.js +7 -0
- package/dist/safe-bash-command-patch/unified.d.ts +52 -0
- package/dist/safe-bash-command-patch/unified.js +16 -0
- package/dist/safe-bash-command-pdfimages/index.js +37 -16
- package/dist/safe-bash-command-pdfinfo/index.d.ts +0 -23
- package/dist/safe-bash-command-pdfinfo/index.js +20 -772
- package/dist/safe-bash-command-pdftk/index.js +37 -9
- package/dist/safe-bash-command-pdftoppm/index.js +50 -20
- package/dist/safe-bash-command-pdftotext/index.js +10 -2
- package/dist/safe-bash-command-pptx/index.d.ts +4 -4
- package/dist/safe-bash-command-pptx/index.js +11 -5
- package/dist/safe-bash-command-pr/command.js +5 -5
- package/dist/safe-bash-command-pr/format.js +2 -2
- package/dist/safe-bash-command-pr/index.js +7 -7
- package/dist/safe-bash-command-pr/internal.d.ts +0 -2
- package/dist/safe-bash-command-pr/internal.js +1 -1
- package/dist/safe-bash-command-pr/io.js +2 -2
- package/dist/safe-bash-command-pr/options.js +2 -2
- package/dist/safe-bash-command-qpdf/index.js +26 -13
- package/dist/safe-bash-command-rg/index.d.ts +1 -0
- package/dist/safe-bash-command-rg/index.js +222 -1
- package/dist/safe-bash-command-rg/rg-command.js +1 -1
- package/dist/safe-bash-command-rg/sync.d.ts +1 -0
- package/dist/safe-bash-command-sed/LICENSE +21 -0
- package/dist/safe-bash-command-sed/index.d.ts +7 -0
- package/dist/safe-bash-command-sed/index.js +28 -0
- package/dist/safe-bash-command-sed/inplace.d.ts +16 -0
- package/dist/safe-bash-command-sed/inplace.js +9 -0
- package/dist/safe-bash-command-sed/sed.d.ts +3 -0
- package/dist/safe-bash-command-sed/sed.js +8 -0
- package/dist/safe-bash-command-shuf/input.js +3 -21
- package/dist/safe-bash-command-shuf/shuf.js +4 -27
- package/dist/safe-bash-command-sips/index.js +111 -35
- package/dist/safe-bash-command-soffice/index.js +4 -4
- package/dist/safe-bash-command-split/index.js +3 -3
- package/dist/safe-bash-command-split/io.d.ts +0 -2
- package/dist/safe-bash-command-split/io.js +1 -1
- package/dist/safe-bash-command-split/outputs.js +2 -2
- package/dist/safe-bash-command-split/split.js +3 -3
- package/dist/safe-bash-command-sqlite3/engine.d.ts +1 -2
- package/dist/safe-bash-command-sqlite3/index.js +152 -452
- package/dist/safe-bash-command-ssconvert/commands.js +1 -1
- package/dist/safe-bash-command-ssconvert/formats/ods.js +2 -2
- package/dist/safe-bash-command-ssconvert/formats/xlsx.js +3 -3
- package/dist/safe-bash-command-ssconvert/index.js +5 -5
- package/dist/safe-bash-command-tar/LICENSE +21 -0
- package/dist/safe-bash-command-tar/create.d.ts +17 -0
- package/dist/safe-bash-command-tar/create.js +14 -0
- package/dist/safe-bash-command-tar/extract.d.ts +11 -0
- package/dist/safe-bash-command-tar/extract.js +14 -0
- package/dist/safe-bash-command-tar/format.d.ts +32 -0
- package/dist/safe-bash-command-tar/format.js +19 -0
- package/dist/safe-bash-command-tar/index.d.ts +8 -0
- package/dist/safe-bash-command-tar/index.js +550 -0
- package/dist/safe-bash-command-tar/listing.d.ts +2 -0
- package/dist/safe-bash-command-tar/listing.js +7 -0
- package/dist/safe-bash-command-tar/modes.d.ts +5 -0
- package/dist/safe-bash-command-tar/modes.js +16 -0
- package/dist/safe-bash-command-tar/options.d.ts +53 -0
- package/dist/safe-bash-command-tar/options.js +10 -0
- package/dist/safe-bash-command-tar/stream.d.ts +22 -0
- package/dist/safe-bash-command-tar/stream.js +15 -0
- package/dist/safe-bash-command-tar/transform.d.ts +16 -0
- package/dist/safe-bash-command-tar/transform.js +9 -0
- package/dist/safe-bash-command-tree/arguments.js +3 -3
- package/dist/safe-bash-command-tree/charset.js +1 -1
- package/dist/safe-bash-command-tree/index.js +4 -4
- package/dist/safe-bash-command-tree/io.d.ts +0 -1
- package/dist/safe-bash-command-tree/io.js +1 -1
- package/dist/safe-bash-command-tree/pattern.js +2 -2
- package/dist/safe-bash-command-tree/tree.js +4 -4
- package/dist/safe-bash-command-tsort/command.js +4 -4
- package/dist/safe-bash-command-tsort/graph.js +2 -2
- package/dist/safe-bash-command-tsort/index.js +4 -4
- package/dist/safe-bash-command-tsort/internal.d.ts +0 -2
- package/dist/safe-bash-command-tsort/internal.js +1 -1
- package/dist/safe-bash-command-tsort/io.js +2 -2
- package/dist/safe-bash-command-unzip/LICENSE +21 -0
- package/dist/safe-bash-command-unzip/index.d.ts +7 -0
- package/dist/safe-bash-command-unzip/index.js +39 -0
- package/dist/safe-bash-command-unzip/sync.d.ts +3 -0
- package/dist/safe-bash-command-unzip/sync.js +9 -0
- package/dist/safe-bash-command-unzip/unzip/safety.d.ts +32 -0
- package/dist/safe-bash-command-unzip/unzip/safety.js +7 -0
- package/dist/safe-bash-command-unzip/unzip.d.ts +3 -0
- package/dist/safe-bash-command-unzip/unzip.js +8 -0
- package/dist/safe-bash-command-wget/LICENSE +21 -0
- package/dist/safe-bash-command-wget/index.d.ts +6 -0
- package/dist/safe-bash-command-wget/index.js +26 -0
- package/dist/safe-bash-command-wget/wget.d.ts +3 -0
- package/dist/safe-bash-command-wget/wget.js +7 -0
- package/dist/safe-bash-command-xan/argv.d.ts +4 -1
- package/dist/safe-bash-command-xan/argv.js +1 -1
- package/dist/safe-bash-command-xan/commands.js +4 -3
- package/dist/safe-bash-command-xan/index.js +15 -14
- package/dist/safe-bash-command-xan/io.js +2 -2
- package/dist/safe-bash-command-xmllint/index.js +189 -49
- package/dist/safe-bash-command-xz/index.js +3 -2
- package/dist/safe-bash-command-xz/options.d.ts +9 -1
- package/dist/safe-bash-command-xz/options.js +3 -1
- package/dist/safe-bash-command-yq/index.d.ts +4 -11
- package/dist/safe-bash-command-yq/index.js +3367 -670
- package/dist/safe-bash-command-yq/mike.js +6 -13
- package/dist/safe-bash-command-yq/native-work.d.ts +1 -0
- package/dist/safe-bash-command-yq/native-work.js +19 -1
- package/dist/safe-bash-command-yq/query.d.ts +11 -0
- package/dist/safe-bash-command-yq/query.js +735 -0
- package/dist/safe-bash-command-zip/LICENSE +21 -0
- package/dist/safe-bash-command-zip/index.d.ts +7 -0
- package/dist/safe-bash-command-zip/index.js +38 -0
- package/dist/safe-bash-command-zip/sync.d.ts +3 -0
- package/dist/safe-bash-command-zip/sync.js +9 -0
- package/dist/safe-bash-command-zip/zip.d.ts +3 -0
- package/dist/safe-bash-command-zip/zip.js +7 -0
- package/dist/safe-bash-compression-engine/files.js +4 -4
- package/dist/safe-bash-compression-engine/index.js +2 -2
- package/dist/safe-bash-compression-engine/operand.js +6 -6
- package/dist/safe-bash-compression-engine/stream.js +2 -2
- package/dist/safe-bash-compression-engine/zstd-decode.js +1 -1
- package/dist/safe-bash-contracts/command.js +1 -1
- package/dist/safe-bash-contracts/diagnostics.js +4 -4
- package/dist/safe-bash-contracts/escaping.js +11 -11
- package/dist/safe-bash-contracts/filesystem-descriptor.js +1 -1
- package/dist/safe-bash-contracts/filesystem-output.js +8 -8
- package/dist/safe-bash-contracts/index.js +34 -34
- package/dist/safe-bash-contracts/io.js +2 -2
- package/dist/safe-bash-contracts/output.js +3 -3
- package/dist/safe-bash-diff-engine/LICENSE +21 -0
- package/dist/safe-bash-diff-engine/index.d.ts +1 -0
- package/dist/safe-bash-diff-engine/index.js +24 -0
- package/dist/safe-bash-diff-engine/shared.d.ts +53 -0
- package/dist/safe-bash-diff-engine/shared.js +19 -0
- package/dist/safe-bash-io-engine/commands/archive/internal.d.ts +0 -1
- package/dist/safe-bash-io-engine/commands/archive/internal.js +3 -7
- package/dist/safe-bash-io-engine/commands/directory-admission.d.ts +3 -0
- package/dist/safe-bash-io-engine/commands/directory-admission.js +34 -0
- package/dist/safe-bash-io-engine/commands/mode-change.d.ts +4 -0
- package/dist/safe-bash-io-engine/commands/mode-change.js +60 -0
- package/dist/safe-bash-io-engine/commands/text-programs/shared.js +20 -31
- package/dist/safe-bash-io-engine/shell/pattern.js +8 -13
- package/dist/safe-bash-io-engine/shell/string-operations.d.ts +0 -2
- package/dist/safe-bash-io-engine/shell/string-operations.js +1 -1
- package/dist/safe-bash-line-ending-engine/internal.d.ts +0 -2
- package/dist/safe-bash-line-ending-engine/internal.js +1 -9
- package/dist/safe-bash-markdown-engine/commonmark-blocks.js +4 -4
- package/dist/safe-bash-markdown-engine/commonmark-inlines.js +4 -4
- package/dist/safe-bash-markdown-engine/commonmark-syntax.js +2 -2
- package/dist/safe-bash-markdown-engine/gfm-syntax.js +3 -3
- package/dist/safe-bash-markdown-engine/index.js +7 -7
- package/dist/safe-bash-mcp/index.browser.d.ts +6 -0
- package/dist/safe-bash-mcp/index.browser.js +1 -0
- package/dist/safe-bash-mcp/index.d.ts +12 -0
- package/dist/safe-bash-mcp/index.js +1558 -36
- package/dist/safe-bash-network-engine/LICENSE +21 -0
- package/dist/safe-bash-network-engine/aggregate.d.ts +4 -0
- package/dist/safe-bash-network-engine/aggregate.js +37 -0
- package/dist/safe-bash-network-engine/args.d.ts +68 -0
- package/dist/safe-bash-network-engine/args.js +19 -0
- package/dist/safe-bash-network-engine/authorizer.d.ts +6 -0
- package/dist/safe-bash-network-engine/authorizer.js +8 -0
- package/dist/safe-bash-network-engine/body.d.ts +9 -0
- package/dist/safe-bash-network-engine/body.js +374 -0
- package/dist/safe-bash-network-engine/deadline.d.ts +2 -0
- package/dist/safe-bash-network-engine/deadline.js +7 -0
- package/dist/safe-bash-network-engine/decode.d.ts +2 -0
- package/dist/safe-bash-network-engine/decode.js +81 -0
- package/dist/safe-bash-network-engine/fetch-transport.d.ts +7 -0
- package/dist/safe-bash-network-engine/fetch-transport.js +9 -0
- package/dist/safe-bash-network-engine/form-content-type.d.ts +5 -0
- package/dist/safe-bash-network-engine/form-content-type.js +8 -0
- package/dist/safe-bash-network-engine/form-headers.d.ts +2 -0
- package/dist/safe-bash-network-engine/form-headers.js +10 -0
- package/dist/safe-bash-network-engine/glob.d.ts +7 -0
- package/dist/safe-bash-network-engine/glob.js +124 -0
- package/dist/safe-bash-network-engine/index.d.ts +3 -0
- package/dist/safe-bash-network-engine/index.js +26 -0
- package/dist/safe-bash-network-engine/input.d.ts +5 -0
- package/dist/safe-bash-network-engine/input.js +255 -0
- package/dist/safe-bash-network-engine/output.d.ts +6 -0
- package/dist/safe-bash-network-engine/output.js +132 -0
- package/dist/safe-bash-network-engine/platform-portable.d.ts +5 -0
- package/dist/safe-bash-network-engine/platform-portable.js +19 -0
- package/dist/safe-bash-network-engine/private-address.d.ts +1 -0
- package/dist/safe-bash-network-engine/private-address.js +7 -0
- package/dist/safe-bash-network-engine/shared.d.ts +14 -0
- package/dist/safe-bash-network-engine/shared.js +23 -0
- package/dist/safe-bash-network-engine/types.d.ts +37 -0
- package/dist/safe-bash-network-engine/types.js +11 -0
- package/dist/safe-bash-network-engine/url.d.ts +2 -0
- package/dist/safe-bash-network-engine/url.js +8 -0
- package/dist/safe-bash-query-engine/capture.d.ts +1 -0
- package/dist/safe-bash-query-engine/capture.js +9 -7
- package/dist/safe-bash-query-engine/dates.d.ts +5 -1
- package/dist/safe-bash-query-engine/dates.js +10 -2
- package/dist/safe-bash-query-engine/delpaths.js +5 -5
- package/dist/safe-bash-query-engine/formats.js +3 -3
- package/dist/safe-bash-query-engine/index.js +15 -15
- package/dist/safe-bash-query-engine/indices.js +5 -5
- package/dist/safe-bash-query-engine/input.d.ts +1 -2
- package/dist/safe-bash-query-engine/input.js +2 -4
- package/dist/safe-bash-query-engine/interpreter.d.ts +5 -0
- package/dist/safe-bash-query-engine/interpreter.js +13 -13
- package/dist/safe-bash-query-engine/limits.js +1 -1
- package/dist/safe-bash-query-engine/parser.d.ts +8 -1
- package/dist/safe-bash-query-engine/parser.js +2 -2
- package/dist/safe-bash-query-engine/query-core.js +15 -15
- package/dist/safe-bash-query-engine/recurse.js +2 -2
- package/dist/safe-bash-query-engine/regex.d.ts +4 -2
- package/dist/safe-bash-query-engine/regex.js +10 -5
- package/dist/safe-bash-query-engine/split.js +2 -2
- package/dist/safe-bash-query-engine/splits.d.ts +1 -1
- package/dist/safe-bash-query-engine/splits.js +7 -6
- package/dist/safe-bash-query-engine/values.js +4 -4
- package/dist/safe-bash-regex-engine/ere/limits.d.ts +0 -1
- package/dist/safe-bash-regex-engine/ere/limits.js +1 -1
- package/dist/safe-bash-regex-engine/ere/matcher.js +9 -9
- package/dist/safe-bash-regex-engine/ere/syntax.js +2 -2
- package/dist/safe-bash-regex-engine/execution/bounded-provider.js +2 -4
- package/dist/safe-bash-regex-engine/index.js +2 -2
- package/dist/safe-bash-regex-engine/text/regex.d.ts +1 -0
- package/dist/safe-bash-regex-engine/text/regex.js +2 -2
- package/dist/safe-bash-search-engine/ergonomic-regex.d.ts +12 -2
- package/dist/safe-bash-search-engine/ergonomic-regex.js +2 -2
- package/dist/safe-bash-search-engine/glob.js +2 -2
- package/dist/safe-bash-search-engine/grep.js +2 -2
- package/dist/safe-bash-search-engine/matcher.d.ts +6 -2
- package/dist/safe-bash-search-engine/matcher.js +30 -8
- package/dist/safe-bash-search-engine/options.js +1 -1
- package/dist/safe-bash-search-engine/output.d.ts +3 -2
- package/dist/safe-bash-search-engine/output.js +111 -30
- package/dist/safe-bash-search-engine/shared.d.ts +2 -0
- package/dist/safe-bash-search-engine/shared.js +2 -2
- package/dist/safe-bash-search-engine/walk.js +11 -10
- package/dist/safe-bash-text-stream-engine/stream-format/shared.d.ts +0 -2
- package/dist/safe-bash-text-stream-engine/stream-format/shared.js +1 -9
- package/dist/safe-bash-xml-engine/document.d.ts +1 -1
- package/dist/safe-bash-xml-engine/document.js +3 -3
- package/dist/safe-bash-xml-engine/evaluate.d.ts +1 -0
- package/dist/safe-bash-xml-engine/evaluate.js +4 -1
- package/dist/safe-bash-xml-engine/index.js +8 -6
- package/dist/safe-bash-xml-engine/io.js +1 -1
- package/dist/safe-bash-xml-engine/limits.d.ts +2 -2
- package/dist/safe-bash-xml-engine/limits.js +1 -1
- package/dist/safe-bash-xml-engine/predicate.d.ts +57 -0
- package/dist/safe-bash-xml-engine/query.d.ts +3 -15
- package/dist/safe-bash-xml-engine/query.js +3 -2
- package/dist/safe-bash-zip-engine/LICENSE +21 -0
- package/dist/safe-bash-zip-engine/index.d.ts +1 -0
- package/dist/safe-bash-zip-engine/index.js +32 -0
- package/dist/safe-bash-zip-engine/unzip/arguments.d.ts +53 -0
- package/dist/safe-bash-zip-engine/unzip/arguments.js +270 -0
- package/dist/safe-bash-zip-engine/zip/aes.d.ts +17 -0
- package/dist/safe-bash-zip-engine/zip/aes.js +15 -0
- package/dist/safe-bash-zip-engine/zip/comments.d.ts +17 -0
- package/dist/safe-bash-zip-engine/zip/comments.js +77 -0
- package/dist/safe-bash-zip-engine/zip/crc.d.ts +1 -0
- package/dist/safe-bash-zip-engine/zip/crc.js +7 -0
- package/dist/safe-bash-zip-engine/zip/crypto.d.ts +19 -0
- package/dist/safe-bash-zip-engine/zip/crypto.js +16 -0
- package/dist/safe-bash-zip-engine/zip/dates.d.ts +4 -0
- package/dist/safe-bash-zip-engine/zip/dates.js +68 -0
- package/dist/safe-bash-zip-engine/zip/environment.d.ts +2 -0
- package/dist/safe-bash-zip-engine/zip/environment.js +60 -0
- package/dist/safe-bash-zip-engine/zip/grow.d.ts +3 -0
- package/dist/safe-bash-zip-engine/zip/grow.js +7 -0
- package/dist/safe-bash-zip-engine/zip/help.d.ts +4 -0
- package/dist/safe-bash-zip-engine/zip/help.js +194 -0
- package/dist/safe-bash-zip-engine/zip/line-endings.d.ts +2 -0
- package/dist/safe-bash-zip-engine/zip/line-endings.js +165 -0
- package/dist/safe-bash-zip-engine/zip/log.d.ts +22 -0
- package/dist/safe-bash-zip-engine/zip/log.js +153 -0
- package/dist/safe-bash-zip-engine/zip/lzma.d.ts +9 -0
- package/dist/safe-bash-zip-engine/zip/lzma.js +7 -0
- package/dist/safe-bash-zip-engine/zip/move.d.ts +11 -0
- package/dist/safe-bash-zip-engine/zip/move.js +57 -0
- package/dist/safe-bash-zip-engine/zip/names.d.ts +2 -0
- package/dist/safe-bash-zip-engine/zip/names.js +37 -0
- package/dist/safe-bash-zip-engine/zip/options.d.ts +13 -0
- package/dist/safe-bash-zip-engine/zip/options.js +23 -0
- package/dist/safe-bash-zip-engine/zip/repair.d.ts +10 -0
- package/dist/safe-bash-zip-engine/zip/repair.js +348 -0
- package/dist/safe-bash-zip-engine/zip/safety.d.ts +54 -0
- package/dist/safe-bash-zip-engine/zip/safety.js +19 -0
- package/dist/safe-bash-zip-engine/zip/sfx.d.ts +4 -0
- package/dist/safe-bash-zip-engine/zip/sfx.js +58 -0
- package/dist/safe-bash-zip-engine/zip/test-command.d.ts +5 -0
- package/dist/safe-bash-zip-engine/zip/test-command.js +98 -0
- package/dist/safe-bash-zip-engine/zip/volumes.d.ts +21 -0
- package/dist/safe-bash-zip-engine/zip/volumes.js +255 -0
- package/dist/safe-bash-zip-engine/zip/zip64.d.ts +30 -0
- package/dist/safe-bash-zip-engine/zip/zip64.js +25 -0
- package/dist/safe-bash-zip-engine/zip-format.d.ts +68 -0
- package/dist/safe-bash-zip-engine/zip-format.js +27 -0
- package/dist/safe-playwright-cloudflare/browser-codegen.generated.d.ts +7 -7
- package/dist/safe-playwright-cloudflare/browser-codegen.generated.js +866 -8069
- package/dist/safe-playwright-cloudflare/browser-run-code-budget.d.ts +0 -1
- package/dist/safe-playwright-cloudflare/browser-run-code-budget.js +0 -2
- package/dist/safe-playwright-cloudflare/browser-trace-archive.d.ts +5 -1
- package/dist/safe-playwright-cloudflare/browser-trace-archive.js +2 -1
- package/dist/safe-playwright-cloudflare/browser-trace-budget.js +2 -2
- package/dist/safe-playwright-cloudflare/shell-browser-resource.d.ts +2 -0
- package/dist/safe-playwright-cloudflare/shell-browser-resource.js +3 -11
- package/dist/safe-playwright-cloudflare/shell-playwright.d.ts +2 -0
- package/dist/safe-playwright-cloudflare/shell-playwright.js +1 -1
- package/dist/spreadsheet-engine/io/publication.d.ts +1 -0
- package/package.json +163 -14
- package/dist/safe-bash/chunks/chunk-O4ZUCRGN.js +0 -13
- package/dist/safe-bash/chunks/chunk-S264DZO2.js +0 -243
- package/dist/safe-bash/chunks/chunk-WVG5SHHQ.js +0 -12
- package/dist/safe-bash/chunks/chunk-XH26YVGW.js +0 -23027
- package/dist/safe-bash/chunks/chunk-ZW6K2J7P.js +0 -2652
- package/dist/safe-bash/command-chunks/chunk-BIXLZ3OG.js +0 -14342
- package/dist/safe-bash/command-chunks/chunk-DUYJE2HY.js +0 -14
- package/dist/safe-bash/command-chunks/chunk-JHVZYB4R.js +0 -181
- package/dist/safe-bash/command-chunks/chunk-ULZ7HIZP.js +0 -40
- package/dist/safe-bash/command-chunks/chunk-XS3PGJU2.js +0 -343
- package/dist/safe-bash/command-chunks/chunk-XTZALMLR.js +0 -488
- package/dist/safe-bash/commands/archive/zip/aes-primitives-unavailable.d.ts +0 -2
- package/dist/safe-bash/commands/archive/zip/aes-primitives-unavailable.js +0 -3
- package/dist/safe-bash/commands/archive/zip/aes-primitives.d.ts +0 -2
- package/dist/safe-bash/commands/archive/zip/aes-primitives.js +0 -3
- package/dist/safe-bash/commands/xml/document.d.ts +0 -2
- package/dist/safe-bash/commands/xml/document.js +0 -2
- package/dist/safe-bash/commands/xml/evaluate.d.ts +0 -2
- package/dist/safe-bash/commands/xml/evaluate.js +0 -2
- package/dist/safe-bash/commands/xml/json.d.ts +0 -2
- package/dist/safe-bash/commands/xml/json.js +0 -2
- package/dist/safe-bash/commands/xml/limits.d.ts +0 -2
- package/dist/safe-bash/commands/xml/limits.js +0 -2
- package/dist/safe-bash/commands/xml/query.d.ts +0 -2
- package/dist/safe-bash/commands/xml/query.js +0 -2
- package/dist/safe-bash/chunks/{chunk-NHOXKQNE.js → chunk-QVSRRNZT.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-FIUFIDAO.js → chunk-2JRBIDAD.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-TYVCKQDH.js → chunk-J5SN3PZ3.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-2ENZ6JGA.js → chunk-KEV7C3KH.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-S62HELHU.js → chunk-PL6O4K6W.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-2WRTLCGK.js → chunk-QZF3SINC.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-X7TM3AKW.js → chunk-U6G67N23.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-DDLQ5YDB.js → chunk-YHFXOX6U.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-DQMOM72Z.js → chunk-ZRRBXU3M.js} +4 -4
|
@@ -1,1524 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { zipDosName } from "./zip/names.js";
|
|
3
|
-
import { readZipSfx } from "./zip/sfx.js";
|
|
4
|
-
import { adjustZipSfx, repairZip } from "./zip/repair.js";
|
|
5
|
-
import { zipGrowRecords } from "./zip/grow.js";
|
|
6
|
-
import { ZipLog } from "./zip/log.js";
|
|
7
|
-
import { parseZipTestCommand, testZipCommand } from "./zip/test-command.js";
|
|
8
|
-
import { inspectZipMoveSource, removeZipSources } from "./zip/move.js";
|
|
9
|
-
import { readZipPassword, ZipHostFailure } from "./zip/crypto.js";
|
|
10
|
-
import { zipEncryptionProfile } from "./zip/aes.js";
|
|
11
|
-
import { zipToCrlf, zipFromCrlf } from "./zip/line-endings.js";
|
|
12
|
-
import { parseZipDate, zipDateMatches, zipLatestTime } from "./zip/dates.js";
|
|
13
|
-
import { zipEnvironmentArguments } from "./zip/environment.js";
|
|
14
|
-
import { readZipComment, ZipCommentInput } from "./zip/comments.js";
|
|
15
|
-
import { collectBytes, dirname, getCommandArguments, writeBytes } from "../../contracts/index.js";
|
|
16
|
-
import { shellValueByteLength, shellValueBytes } from "../../contracts/value.js";
|
|
17
|
-
import { writeFileOutput } from "../../contracts/filesystem-output.js";
|
|
18
|
-
import { createOutputOperation } from "../../contracts/output.js";
|
|
19
|
-
import { yieldTurn } from "../../contracts/yield.js";
|
|
20
|
-
import { publicDiagnosticMessage } from "../../diagnostics.js";
|
|
21
|
-
import { escapeText } from "../../escaping.js";
|
|
22
|
-
import { Budget, checkPath, display, fail, invocationLimits, settings, text, vfsPath } from "./internal.js";
|
|
23
|
-
import { decodeZipEntry, makeZipEntry, readZipArchive, writeZipArchive, streamZipArchive, updateZipExtras, setZipEntryComment } from "./zip-format.js";
|
|
24
|
-
import { zipHelp, zipExtendedHelp, zipVersion, zipLicense } from "./zip/help.js";
|
|
25
|
-
import { publishZip, stageZip, ZipScope, hasZipIdentity as hasIdentity, sameZipIdentity as sameIdentity, unchangedZipSource as unchanged, safeZipFile } from "./zip/safety.js";
|
|
26
|
-
import { splitSize, splitZipVolumes, resolveZipVolumes, publishZipVolumes, volumeName } from "./zip/volumes.js";
|
|
27
|
-
import { Selection } from "./unzip/arguments.js";
|
|
28
|
-
import { normalizeZipOption, reservedZipShortOptions, ZipFailure, parseZipDotSize, zipLongOptions, zipNegatableOptions, zipDisplaySize, zipPublicText, zipPasswordArgument } from "./zip/options.js";
|
|
29
|
-
const defaultStoreSuffixes = [".Z", ".zip", ".zoo", ".arc", ".lzh", ".arj"];
|
|
30
|
-
async function parse(scope, limits, defaults) {
|
|
31
|
-
const context = scope.context;
|
|
32
|
-
const args = zipEnvironmentArguments(context.env, context.args, limits);
|
|
33
|
-
const rawArguments = context.argumentValues ? getCommandArguments(context) : undefined;
|
|
34
|
-
const passwordArguments = new Set();
|
|
35
|
-
const defaultsCount = args.length - context.args.length;
|
|
36
|
-
const validateArgumentText = () => {
|
|
37
|
-
if (rawArguments)
|
|
38
|
-
for (const [index, value] of rawArguments.values.entries()) {
|
|
39
|
-
if (!passwordArguments.has(index))
|
|
40
|
-
text(shellValueBytes(value));
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
if (args.length > limits.maxArgumentBytes)
|
|
44
|
-
fail("argument count limit exceeded");
|
|
45
|
-
let bytes = 0;
|
|
46
|
-
for (const argument of args) {
|
|
47
|
-
const size = byteLength(argument);
|
|
48
|
-
if (size > limits.maxArgumentBytes - bytes)
|
|
49
|
-
fail("argument byte limit exceeded");
|
|
50
|
-
bytes += size;
|
|
51
|
-
}
|
|
52
|
-
if (context.argumentValues) {
|
|
53
|
-
const argumentsValue = getCommandArguments(context);
|
|
54
|
-
let rawBytes = 0;
|
|
55
|
-
for (const value of argumentsValue.values) {
|
|
56
|
-
const size = shellValueByteLength(value);
|
|
57
|
-
if (size > limits.maxArgumentBytes - rawBytes)
|
|
58
|
-
fail("argument byte limit exceeded");
|
|
59
|
-
rawBytes += size;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
let archive;
|
|
63
|
-
let password;
|
|
64
|
-
let encrypt = defaults?.encryption !== undefined;
|
|
65
|
-
let aes = zipEncryptionProfile(defaults?.encryption ?? "zipcrypto");
|
|
66
|
-
let output;
|
|
67
|
-
let action = "add";
|
|
68
|
-
let recursive = false;
|
|
69
|
-
let recursivePatterns = false;
|
|
70
|
-
let noWild = false;
|
|
71
|
-
let stopAtDirectories = false;
|
|
72
|
-
let quiet = false;
|
|
73
|
-
let verbose = false;
|
|
74
|
-
let showFiles;
|
|
75
|
-
let showCommand = false;
|
|
76
|
-
let showOptions = false;
|
|
77
|
-
let debug = false;
|
|
78
|
-
let displayBytes = false;
|
|
79
|
-
let displayCounts = false;
|
|
80
|
-
let displayUsize = false;
|
|
81
|
-
let displayVolume = false;
|
|
82
|
-
let dotSize = 0;
|
|
83
|
-
let dotsSet = false;
|
|
84
|
-
let globalDots = false;
|
|
85
|
-
const commandOptions = [];
|
|
86
|
-
const commandPaths = [];
|
|
87
|
-
let junkPaths = false;
|
|
88
|
-
let dosNames = false;
|
|
89
|
-
let fifo = false;
|
|
90
|
-
let omitDirectories = false;
|
|
91
|
-
let storeLinks = false;
|
|
92
|
-
let test = false;
|
|
93
|
-
let testCommand;
|
|
94
|
-
let difference = false;
|
|
95
|
-
let grow = false;
|
|
96
|
-
let tempPath;
|
|
97
|
-
let junkSfx = false;
|
|
98
|
-
let repair;
|
|
99
|
-
let adjust = false;
|
|
100
|
-
let logPath;
|
|
101
|
-
let logAppend = false;
|
|
102
|
-
let logInfo = false;
|
|
103
|
-
let mustMatch = false;
|
|
104
|
-
let filesync = false;
|
|
105
|
-
let archiveComment = false;
|
|
106
|
-
let entryComments = false;
|
|
107
|
-
let latestTime = false;
|
|
108
|
-
let toCrlf = false;
|
|
109
|
-
let fromCrlf = false;
|
|
110
|
-
let move = false;
|
|
111
|
-
let fromDate;
|
|
112
|
-
let beforeDate;
|
|
113
|
-
let descriptors = false;
|
|
114
|
-
let split;
|
|
115
|
-
let splitPause = false, splitVerbose = false, splitBell = false;
|
|
116
|
-
let zip64;
|
|
117
|
-
let metadata = "default";
|
|
118
|
-
let level = 6;
|
|
119
|
-
let method = defaults?.compression ?? "deflate";
|
|
120
|
-
if (method !== "store" && method !== "deflate" && method !== "bzip2" && method !== "lzma")
|
|
121
|
-
fail("ZIP unsupported compression method");
|
|
122
|
-
let suffixes = defaultStoreSuffixes;
|
|
123
|
-
let stdinNames = false;
|
|
124
|
-
let literal = false;
|
|
125
|
-
let firstOperand = -1;
|
|
126
|
-
const operands = [];
|
|
127
|
-
const includes = [];
|
|
128
|
-
const excludes = [];
|
|
129
|
-
for (let index = 0; index < args.length; index++) {
|
|
130
|
-
const startIndex = index;
|
|
131
|
-
let listOption = false;
|
|
132
|
-
const original = args[index];
|
|
133
|
-
checkPath(original, limits);
|
|
134
|
-
if (!literal && (original === "--encryption" || original.startsWith("--encryption="))) {
|
|
135
|
-
const value = original === "--encryption" ? args[++index] : original.slice(13);
|
|
136
|
-
if (value === undefined)
|
|
137
|
-
fail("ZIP encryption option requires a profile");
|
|
138
|
-
aes = zipEncryptionProfile(value);
|
|
139
|
-
encrypt = true;
|
|
140
|
-
commandOptions.push(...args.slice(startIndex, index + 1));
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
const argument = literal ? original : normalizeZipOption(original);
|
|
144
|
-
if (!literal && argument === "--") {
|
|
145
|
-
if (archive === undefined)
|
|
146
|
-
throw new ZipFailure(16, "Invalid command arguments", "can't use -- before archive name");
|
|
147
|
-
literal = true;
|
|
148
|
-
commandPaths.push(original);
|
|
149
|
-
}
|
|
150
|
-
else if (!literal && argument.startsWith("-") && argument !== "-") {
|
|
151
|
-
commandOptions.push(original);
|
|
152
|
-
if (argument === "--version") {
|
|
153
|
-
validateArgumentText();
|
|
154
|
-
return { information: "version" };
|
|
155
|
-
}
|
|
156
|
-
for (let offset = 1; offset < argument.length; offset++) {
|
|
157
|
-
if (reservedZipShortOptions.has(argument.slice(offset, offset + 2))) {
|
|
158
|
-
throw new ZipFailure(16, "Invalid command arguments", `unsupported option: -${argument.slice(offset, offset + 2)}`);
|
|
159
|
-
}
|
|
160
|
-
const flag = argument[offset];
|
|
161
|
-
const pair = argument.slice(offset, offset + 2);
|
|
162
|
-
if (pair === "sp" || pair === "sv" || pair === "sb") {
|
|
163
|
-
if (pair === "sp") {
|
|
164
|
-
splitPause = true;
|
|
165
|
-
descriptors = true;
|
|
166
|
-
}
|
|
167
|
-
if (pair === "sv")
|
|
168
|
-
splitVerbose = true;
|
|
169
|
-
if (pair === "sb")
|
|
170
|
-
splitBell = true;
|
|
171
|
-
offset++;
|
|
172
|
-
}
|
|
173
|
-
else if (flag === "s" && !["sc", "sd", "sf", "so"].includes(pair)) {
|
|
174
|
-
let value = argument.slice(offset + 1) || args[++index];
|
|
175
|
-
if (value?.startsWith("="))
|
|
176
|
-
value = value.slice(1);
|
|
177
|
-
if (!value)
|
|
178
|
-
throw new ZipFailure(16, "Invalid command arguments", "split size requires a value");
|
|
179
|
-
split = splitSize(value);
|
|
180
|
-
break;
|
|
181
|
-
}
|
|
182
|
-
else if (pair === "FI") {
|
|
183
|
-
fifo = argument[offset + 2] !== "-";
|
|
184
|
-
offset += fifo ? 1 : 2;
|
|
185
|
-
}
|
|
186
|
-
else if (pair === "RE") {
|
|
187
|
-
// Unix bracket lists are already enabled in the bounded glob matcher.
|
|
188
|
-
if (argument[offset + 2] === "-")
|
|
189
|
-
throw new ZipFailure(16, "Invalid command arguments", "option RE is not negatable");
|
|
190
|
-
offset++;
|
|
191
|
-
}
|
|
192
|
-
else if (flag === "k") {
|
|
193
|
-
if (argument[offset + 1] === "-")
|
|
194
|
-
throw new ZipFailure(16, "Invalid command arguments", "option k is not negatable");
|
|
195
|
-
dosNames = true;
|
|
196
|
-
}
|
|
197
|
-
else if (pair === "DF") {
|
|
198
|
-
difference = true;
|
|
199
|
-
offset++;
|
|
200
|
-
}
|
|
201
|
-
else if (pair === "la" || pair === "li") {
|
|
202
|
-
if (pair === "la")
|
|
203
|
-
logAppend = true;
|
|
204
|
-
else
|
|
205
|
-
logInfo = true;
|
|
206
|
-
offset++;
|
|
207
|
-
}
|
|
208
|
-
else if (pair === "TT" || pair === "lf" || flag === "b") {
|
|
209
|
-
const option = flag === "b" ? "b" : pair;
|
|
210
|
-
if (option !== "b")
|
|
211
|
-
offset++;
|
|
212
|
-
let value = argument.slice(offset + 1) || args[++index];
|
|
213
|
-
if (value?.startsWith("="))
|
|
214
|
-
value = value.slice(1);
|
|
215
|
-
if (!value)
|
|
216
|
-
throw new ZipFailure(16, "Invalid command arguments", `option ${option} requires a value`);
|
|
217
|
-
if (option === "b")
|
|
218
|
-
tempPath = value;
|
|
219
|
-
else if (option === "lf")
|
|
220
|
-
logPath = value;
|
|
221
|
-
else
|
|
222
|
-
testCommand = parseZipTestCommand(value);
|
|
223
|
-
break;
|
|
224
|
-
}
|
|
225
|
-
else if (flag === "g")
|
|
226
|
-
grow = true;
|
|
227
|
-
else if (flag === "J")
|
|
228
|
-
junkSfx = true;
|
|
229
|
-
else if (flag === "A")
|
|
230
|
-
adjust = true;
|
|
231
|
-
else if (flag === "F" && pair !== "FS" && pair !== "FI") {
|
|
232
|
-
repair = pair === "FF" ? "FF" : "F";
|
|
233
|
-
if (pair === "FF")
|
|
234
|
-
offset++;
|
|
235
|
-
}
|
|
236
|
-
else if (flag === "P") {
|
|
237
|
-
let value = argument.slice(offset + 1);
|
|
238
|
-
const attached = value.length > 0;
|
|
239
|
-
if (!value) {
|
|
240
|
-
value = args[++index];
|
|
241
|
-
if (value === undefined)
|
|
242
|
-
throw new ZipFailure(16, "Invalid command arguments", "password option requires a value");
|
|
243
|
-
}
|
|
244
|
-
else if (value.startsWith("="))
|
|
245
|
-
value = value.slice(1);
|
|
246
|
-
const rawIndex = index - defaultsCount;
|
|
247
|
-
passwordArguments.add(rawIndex);
|
|
248
|
-
const raw = rawArguments?.bytes(rawIndex);
|
|
249
|
-
const prefix = attached ? original.startsWith("--") ? original.indexOf("=") + 1 : offset + 1 + (original[offset + 1] === "=" ? 1 : 0) : 0;
|
|
250
|
-
password = raw ? new Uint8Array(raw.subarray(prefix)) : encodeBytes(value);
|
|
251
|
-
if (password.includes(0))
|
|
252
|
-
fail("ZIP invalid password bytes");
|
|
253
|
-
if (!password.length)
|
|
254
|
-
throw new ZipFailure(16, "Invalid command arguments", "zero length password not allowed");
|
|
255
|
-
encrypt = true;
|
|
256
|
-
break;
|
|
257
|
-
}
|
|
258
|
-
else if (flag === "e")
|
|
259
|
-
encrypt = true;
|
|
260
|
-
else if (["db", "dc", "dd", "dg", "du", "dv", "ds", "sc", "sd", "sf", "so"].includes(pair)) {
|
|
261
|
-
offset++;
|
|
262
|
-
const negated = argument[offset + 1] === "-";
|
|
263
|
-
if (negated && !zipNegatableOptions.has(pair))
|
|
264
|
-
throw new ZipFailure(16, "Invalid command arguments", `option ${pair} is not negatable`);
|
|
265
|
-
if (negated)
|
|
266
|
-
offset++;
|
|
267
|
-
if (pair === "ds") {
|
|
268
|
-
let value = argument.slice(offset + 1) || args[++index];
|
|
269
|
-
if (value === undefined)
|
|
270
|
-
throw new ZipFailure(16, "Invalid command arguments", "option ds requires a value");
|
|
271
|
-
if (value.startsWith("="))
|
|
272
|
-
value = value.slice(1);
|
|
273
|
-
dotSize = parseZipDotSize(value);
|
|
274
|
-
dotsSet = true;
|
|
275
|
-
break;
|
|
276
|
-
}
|
|
277
|
-
if (pair === "db")
|
|
278
|
-
displayBytes = !negated;
|
|
279
|
-
else if (pair === "dc")
|
|
280
|
-
displayCounts = !negated;
|
|
281
|
-
else if (pair === "du")
|
|
282
|
-
displayUsize = !negated;
|
|
283
|
-
else if (pair === "dv")
|
|
284
|
-
displayVolume = !negated;
|
|
285
|
-
else if (pair === "sf")
|
|
286
|
-
showFiles = !negated;
|
|
287
|
-
else if (pair === "sc")
|
|
288
|
-
showCommand = true;
|
|
289
|
-
else if (pair === "sd")
|
|
290
|
-
debug = true;
|
|
291
|
-
else if (pair === "so")
|
|
292
|
-
showOptions = true;
|
|
293
|
-
else if (pair === "dd") {
|
|
294
|
-
globalDots = false;
|
|
295
|
-
if (negated)
|
|
296
|
-
dotsSet = false;
|
|
297
|
-
else {
|
|
298
|
-
if (!dotsSet)
|
|
299
|
-
dotSize = 10 * 1024 ** 2;
|
|
300
|
-
dotsSet = true;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
else if (pair === "dg") {
|
|
304
|
-
globalDots = !negated;
|
|
305
|
-
if (!negated) {
|
|
306
|
-
if (!dotsSet)
|
|
307
|
-
dotSize = 10 * 1024 ** 2;
|
|
308
|
-
dotsSet = true;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
else if (flag === "L" || flag === "v") {
|
|
313
|
-
if (argument[offset + 1] === "-")
|
|
314
|
-
throw new ZipFailure(16, "Invalid command arguments", `option ${flag} is not negatable`);
|
|
315
|
-
if (flag === "L") {
|
|
316
|
-
validateArgumentText();
|
|
317
|
-
return { information: "license" };
|
|
318
|
-
}
|
|
319
|
-
if (args.length === 1 && original === "-v") {
|
|
320
|
-
validateArgumentText();
|
|
321
|
-
return { information: "version" };
|
|
322
|
-
}
|
|
323
|
-
verbose = true;
|
|
324
|
-
quiet = false;
|
|
325
|
-
}
|
|
326
|
-
else if (flag === "h") {
|
|
327
|
-
if (argument[offset + 1] === "-")
|
|
328
|
-
throw new ZipFailure(16, "Invalid command arguments", "option h is not negatable");
|
|
329
|
-
if (argument[offset + 1] === "2") {
|
|
330
|
-
if (argument[offset + 2] === "-")
|
|
331
|
-
throw new ZipFailure(16, "Invalid command arguments", "option h2 is not negatable");
|
|
332
|
-
validateArgumentText();
|
|
333
|
-
return { information: "more-help" };
|
|
334
|
-
}
|
|
335
|
-
validateArgumentText();
|
|
336
|
-
return { information: "help" };
|
|
337
|
-
}
|
|
338
|
-
else if (flag === "r" || flag === "R") {
|
|
339
|
-
if (flag === "r")
|
|
340
|
-
recursive = true;
|
|
341
|
-
else
|
|
342
|
-
recursivePatterns = true;
|
|
343
|
-
if (recursive && recursivePatterns)
|
|
344
|
-
throw new ZipFailure(16, "Invalid command arguments", "do not specify both -r and -R");
|
|
345
|
-
}
|
|
346
|
-
else if (flag === "f" && argument[offset + 1] === "d") {
|
|
347
|
-
if (argument[offset + 2] === "-")
|
|
348
|
-
throw new ZipFailure(16, "Invalid command arguments", "option fd is not negatable");
|
|
349
|
-
descriptors = true;
|
|
350
|
-
offset++;
|
|
351
|
-
}
|
|
352
|
-
else if (flag === "f" && argument[offset + 1] === "z") {
|
|
353
|
-
zip64 = argument[offset + 2] !== "-";
|
|
354
|
-
offset += zip64 ? 1 : 2;
|
|
355
|
-
}
|
|
356
|
-
else if (flag === "d" || flag === "u" || flag === "f" || flag === "U") {
|
|
357
|
-
const next = flag === "d" ? "delete" : flag === "u" ? "update" : flag === "U" ? "copy" : "freshen";
|
|
358
|
-
if (action !== "add" && action !== next)
|
|
359
|
-
throw new ZipFailure(16, "Invalid command arguments", "specify just one action");
|
|
360
|
-
action = next;
|
|
361
|
-
}
|
|
362
|
-
else if (flag === "n" && argument[offset + 1] === "w" || flag === "w" && argument[offset + 1] === "s") {
|
|
363
|
-
if (argument[offset + 2] === "-")
|
|
364
|
-
throw new ZipFailure(16, "Invalid command arguments", "wildcard control is not negatable");
|
|
365
|
-
if (flag === "n")
|
|
366
|
-
noWild = true;
|
|
367
|
-
else
|
|
368
|
-
stopAtDirectories = true;
|
|
369
|
-
offset++;
|
|
370
|
-
}
|
|
371
|
-
else if (flag === "M" && argument[offset + 1] === "M") {
|
|
372
|
-
if (argument[offset + 2] === "-")
|
|
373
|
-
throw new ZipFailure(16, "Invalid command arguments", "option MM is not negatable");
|
|
374
|
-
mustMatch = true;
|
|
375
|
-
offset++;
|
|
376
|
-
}
|
|
377
|
-
else if (flag === "F" && argument[offset + 1] === "S") {
|
|
378
|
-
if (argument[offset + 2] === "-")
|
|
379
|
-
throw new ZipFailure(16, "Invalid command arguments", "option FS is not negatable");
|
|
380
|
-
filesync = true;
|
|
381
|
-
offset++;
|
|
382
|
-
}
|
|
383
|
-
else if (flag === "q")
|
|
384
|
-
quiet = true;
|
|
385
|
-
else if (flag === "z")
|
|
386
|
-
archiveComment = true;
|
|
387
|
-
else if (flag === "c")
|
|
388
|
-
entryComments = true;
|
|
389
|
-
else if (flag === "o")
|
|
390
|
-
latestTime = true;
|
|
391
|
-
else if (flag === "l") {
|
|
392
|
-
fromCrlf = argument[offset + 1] === "l";
|
|
393
|
-
toCrlf = !fromCrlf;
|
|
394
|
-
if (fromCrlf)
|
|
395
|
-
offset++;
|
|
396
|
-
}
|
|
397
|
-
else if (flag === "m")
|
|
398
|
-
move = true;
|
|
399
|
-
else if (flag === "p") {
|
|
400
|
-
if (argument[offset + 1] === "-")
|
|
401
|
-
throw new ZipFailure(16, "Invalid command arguments", "option p is not negatable");
|
|
402
|
-
// Native Unix procname accepts -p for compatibility without undoing -j.
|
|
403
|
-
}
|
|
404
|
-
else if (flag === "j")
|
|
405
|
-
junkPaths = true;
|
|
406
|
-
else if (flag === "X") {
|
|
407
|
-
metadata = argument[offset + 1] === "-" ? "all" : "strip";
|
|
408
|
-
if (metadata === "all")
|
|
409
|
-
offset++;
|
|
410
|
-
}
|
|
411
|
-
else if (flag === "D")
|
|
412
|
-
omitDirectories = true;
|
|
413
|
-
else if (flag === "y")
|
|
414
|
-
storeLinks = true;
|
|
415
|
-
else if (flag === "T")
|
|
416
|
-
test = true;
|
|
417
|
-
else if (flag === "@")
|
|
418
|
-
stdinNames = true;
|
|
419
|
-
else if (flag !== undefined && flag >= "0" && flag <= "9") {
|
|
420
|
-
level = Number(flag);
|
|
421
|
-
if (level === 0)
|
|
422
|
-
method = "store";
|
|
423
|
-
}
|
|
424
|
-
else if (flag === "O") {
|
|
425
|
-
let value = argument.slice(offset + 1) || args[++index];
|
|
426
|
-
if (value?.startsWith("="))
|
|
427
|
-
value = value.slice(1);
|
|
428
|
-
if (value === undefined)
|
|
429
|
-
throw new ZipFailure(16, "Invalid command arguments", "option O requires a value");
|
|
430
|
-
output = value;
|
|
431
|
-
break;
|
|
432
|
-
}
|
|
433
|
-
else if (flag === "t") {
|
|
434
|
-
const option = argument[offset + 1] === "t" ? "tt" : "t";
|
|
435
|
-
if (option === "tt")
|
|
436
|
-
offset++;
|
|
437
|
-
let value = argument.slice(offset + 1);
|
|
438
|
-
if (!value)
|
|
439
|
-
value = args[++index] ?? "";
|
|
440
|
-
if (value.startsWith("="))
|
|
441
|
-
value = value.slice(1);
|
|
442
|
-
const date = parseZipDate(value, option);
|
|
443
|
-
if (option === "t")
|
|
444
|
-
fromDate = date;
|
|
445
|
-
else
|
|
446
|
-
beforeDate = date;
|
|
447
|
-
break;
|
|
448
|
-
}
|
|
449
|
-
else if (flag === "n" || flag === "Z") {
|
|
450
|
-
let value = argument.slice(offset + 1);
|
|
451
|
-
if (!value) {
|
|
452
|
-
const next = args[index + 1];
|
|
453
|
-
if (next === undefined || next.startsWith("-") && next !== "-")
|
|
454
|
-
throw new ZipFailure(16, "Invalid command arguments", `option '${flag}' requires a value`);
|
|
455
|
-
value = next;
|
|
456
|
-
index++;
|
|
457
|
-
}
|
|
458
|
-
if (value.startsWith("="))
|
|
459
|
-
value = value.slice(1);
|
|
460
|
-
if (flag === "n") {
|
|
461
|
-
suffixes = value ? value.split(":").filter(suffix => suffix.length > 0) : defaultStoreSuffixes;
|
|
462
|
-
if (value && suffixes.length > limits.maxMembers)
|
|
463
|
-
fail("suffix count limit exceeded");
|
|
464
|
-
}
|
|
465
|
-
else {
|
|
466
|
-
const matches = ["store", "deflate", "bzip2", "lzma"].filter(name => name.startsWith(value.toLowerCase()));
|
|
467
|
-
const selected = matches.length === 1 ? matches[0] : undefined;
|
|
468
|
-
if (!selected)
|
|
469
|
-
throw new ZipFailure(16, "Invalid command arguments", "Option -Z (--compression-method): unknown method");
|
|
470
|
-
method = selected;
|
|
471
|
-
}
|
|
472
|
-
break;
|
|
473
|
-
}
|
|
474
|
-
else if (flag === "i" || flag === "x") {
|
|
475
|
-
listOption = offset + 1 === argument.length;
|
|
476
|
-
const patterns = flag === "i" ? includes : excludes;
|
|
477
|
-
const before = patterns.length;
|
|
478
|
-
const append = (pattern) => {
|
|
479
|
-
if (pattern)
|
|
480
|
-
checkPath(pattern, limits);
|
|
481
|
-
if (includes.length + excludes.length >= limits.maxMembers)
|
|
482
|
-
fail("pattern count limit exceeded");
|
|
483
|
-
patterns.push(dosNames ? zipDosName(pattern) : pattern);
|
|
484
|
-
};
|
|
485
|
-
const attached = offset + 1 < argument.length;
|
|
486
|
-
if (attached) {
|
|
487
|
-
const value = argument.slice(offset + 1);
|
|
488
|
-
append(value.startsWith("=") ? value.slice(1) : value);
|
|
489
|
-
}
|
|
490
|
-
while (!attached && index + 1 < args.length) {
|
|
491
|
-
const next = args[index + 1];
|
|
492
|
-
if (next === "@") {
|
|
493
|
-
index++;
|
|
494
|
-
break;
|
|
495
|
-
}
|
|
496
|
-
if (next.startsWith("-") && next !== "-")
|
|
497
|
-
break;
|
|
498
|
-
append(next);
|
|
499
|
-
index++;
|
|
500
|
-
}
|
|
501
|
-
if (patterns.length === before)
|
|
502
|
-
throw new ZipFailure(16, "Invalid command arguments", `option '${flag}' requires a value`);
|
|
503
|
-
break;
|
|
504
|
-
}
|
|
505
|
-
else
|
|
506
|
-
throw new ZipFailure(16, "Invalid command arguments", `unsupported option: -${flag}`);
|
|
507
|
-
}
|
|
508
|
-
commandOptions.push(...args.slice(startIndex + 1, index + 1));
|
|
509
|
-
if (listOption && args[index] !== "@")
|
|
510
|
-
commandOptions.push("@");
|
|
511
|
-
}
|
|
512
|
-
else if (archive === undefined) {
|
|
513
|
-
archive = argument;
|
|
514
|
-
commandPaths.push(original);
|
|
515
|
-
}
|
|
516
|
-
else {
|
|
517
|
-
if (operands.length >= limits.maxMembers)
|
|
518
|
-
fail("operand limit exceeded");
|
|
519
|
-
if (firstOperand < 0)
|
|
520
|
-
firstOperand = index;
|
|
521
|
-
operands.push(argument);
|
|
522
|
-
commandPaths.push(original);
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
validateArgumentText();
|
|
526
|
-
if (repair || adjust) {
|
|
527
|
-
if (repair && adjust || junkSfx || grow || move || split !== undefined || operands.length || stdinNames || includes.length || excludes.length || action !== "add" || archiveComment || entryComments || latestTime || filesync || encrypt || showFiles !== undefined || difference || toCrlf || fromCrlf || recursive || recursivePatterns)
|
|
528
|
-
throw new ZipFailure(16, "Invalid command arguments", "repair/adjust cannot be combined with archive modification or selection");
|
|
529
|
-
if (!archive || archive === "-" || repair && (!output || output === "-"))
|
|
530
|
-
throw new ZipFailure(16, "Invalid command arguments", "recovery requires a named source and a separate --out file");
|
|
531
|
-
}
|
|
532
|
-
if (showCommand)
|
|
533
|
-
return { information: "command", command: [context.command, ...commandOptions, ...commandPaths], debug };
|
|
534
|
-
if (showOptions)
|
|
535
|
-
return { information: "options", debug };
|
|
536
|
-
if (verbose && !dotsSet && !dotSize)
|
|
537
|
-
dotSize = 10 * 1024 ** 2;
|
|
538
|
-
if (archive === undefined) {
|
|
539
|
-
if (includes.length || excludes.length)
|
|
540
|
-
throw new ZipFailure(16, "Invalid command arguments", "nothing to select from");
|
|
541
|
-
if (action !== "add")
|
|
542
|
-
throw new ZipFailure(16, "Invalid command arguments", "expected archive name");
|
|
543
|
-
archive = "-";
|
|
544
|
-
if (!stdinNames)
|
|
545
|
-
operands.push("-");
|
|
546
|
-
}
|
|
547
|
-
if (archive !== "-" && !archive.slice(archive.lastIndexOf("/") + 1).includes("."))
|
|
548
|
-
archive += ".zip";
|
|
549
|
-
checkPath(archive, limits);
|
|
550
|
-
if (output !== undefined) {
|
|
551
|
-
if (!output.slice(output.lastIndexOf("/") + 1).includes("."))
|
|
552
|
-
output += ".zip";
|
|
553
|
-
checkPath(output, limits);
|
|
554
|
-
if (action === "add" && archive !== "-" && !operands.length && !stdinNames)
|
|
555
|
-
action = "copy";
|
|
556
|
-
}
|
|
557
|
-
if (showFiles !== undefined && !operands.length && !stdinNames && (includes.length || excludes.length))
|
|
558
|
-
throw new ZipFailure(16, "Invalid command arguments", "nothing to select from");
|
|
559
|
-
if (action === "copy" && output === undefined && showFiles === undefined)
|
|
560
|
-
throw new ZipFailure(16, "Invalid command arguments", "-U (--copy) requires -O (--out)");
|
|
561
|
-
const names = [];
|
|
562
|
-
if (stdinNames) {
|
|
563
|
-
const input = await collectBytes(scope.stdin, { ...(Number.isFinite(limits.maxFilesFromBytes) ? { maxBytes: limits.maxFilesFromBytes } : {}), signal: context.signal });
|
|
564
|
-
let start = 0;
|
|
565
|
-
let lines = 0;
|
|
566
|
-
for (let end = 0; end <= input.length; end++) {
|
|
567
|
-
if (end !== input.length && input[end] !== 10)
|
|
568
|
-
continue;
|
|
569
|
-
if (++lines > limits.maxPatternSteps)
|
|
570
|
-
fail("stdin filename work limit exceeded");
|
|
571
|
-
if (lines % 128 === 0)
|
|
572
|
-
await yieldTurn(context.signal);
|
|
573
|
-
let last = end;
|
|
574
|
-
while (last > start && input[last - 1] === 13)
|
|
575
|
-
last--;
|
|
576
|
-
if (last > start) {
|
|
577
|
-
if (names.length + operands.length >= limits.maxMembers)
|
|
578
|
-
fail("operand limit exceeded");
|
|
579
|
-
if (last - start > limits.maxPathBytes)
|
|
580
|
-
fail("path byte limit exceeded");
|
|
581
|
-
const name = text(input.subarray(start, last));
|
|
582
|
-
checkPath(name, limits);
|
|
583
|
-
names.push(name);
|
|
584
|
-
}
|
|
585
|
-
start = end + 1;
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
if (recursivePatterns && !names.length && !operands.length)
|
|
589
|
-
throw new ZipFailure(16, "Invalid command arguments", "nothing to select from");
|
|
590
|
-
if (difference && (archive === "-" || output === undefined || action === "copy" || action === "delete"))
|
|
591
|
-
throw new ZipFailure(16, "Invalid command arguments", "difference archive requires separate output and cannot use delete or copy");
|
|
592
|
-
if (logPath !== undefined && !logPath.slice(logPath.lastIndexOf("/") + 1).includes("."))
|
|
593
|
-
logPath += ".log";
|
|
594
|
-
if (filesync && (action !== "add" || grow))
|
|
595
|
-
throw new ZipFailure(16, "Invalid command arguments", "can't use -d, -f, -u, -U, or -g with filesync -FS\n");
|
|
596
|
-
const diagnosticArgs = args.map((value, index) => passwordArguments.has(index - defaultsCount) ? "[redacted]" : zipPublicText(value));
|
|
597
|
-
if (split && (archive === "-" || grow))
|
|
598
|
-
throw new ZipFailure(16, "Invalid command arguments", "split output requires a file and cannot grow");
|
|
599
|
-
return { repair, adjust, split, splitPause, splitVerbose, splitBell, password, encrypt, ...(aes ? { aes } : {}), args: diagnosticArgs, action, archive, output, recursive, recursivePatterns, noWild, stopAtDirectories, quiet, verbose, showFiles, debug, displayBytes, displayCounts, displayUsize, displayVolume, dotSize, globalDots, junkPaths, dosNames, fifo, omitDirectories, storeLinks: storeLinks && !dosNames, test, testCommand, difference, grow, tempPath, junkSfx, logPath, logAppend, logInfo, mustMatch, filesync, archiveComment, entryComments, latestTime, toCrlf, fromCrlf, move, fromDate, beforeDate, descriptors, zip64, metadata, includes, excludes, level, method, suffixes, operands: [...names, ...operands], firstOperand };
|
|
600
|
-
}
|
|
601
|
-
function memberName(path, limits) {
|
|
602
|
-
if (path.startsWith("//") && !path.startsWith("///"))
|
|
603
|
-
fail("UNC source paths are unsupported");
|
|
604
|
-
let start = 0;
|
|
605
|
-
while (path[start] === "/")
|
|
606
|
-
start++;
|
|
607
|
-
while (path.slice(start, start + 2) === "./")
|
|
608
|
-
start += 2;
|
|
609
|
-
const name = path.slice(start);
|
|
610
|
-
if (name.split("/").includes(".."))
|
|
611
|
-
fail("parent-component archive names are unsupported");
|
|
612
|
-
if (name && name !== ".")
|
|
613
|
-
checkPath(name, limits);
|
|
614
|
-
return name === "." ? "" : name;
|
|
615
|
-
}
|
|
616
|
-
async function inspectSource(scope, path, storeLinks) {
|
|
617
|
-
const { fs, signal } = scope.context;
|
|
618
|
-
if (storeLinks) {
|
|
619
|
-
const stat = await scope.operation(() => fs.lstat(path, { signal }));
|
|
620
|
-
if (stat.type === "symlink") {
|
|
621
|
-
const parent = await scope.operation(() => fs.realpath(dirname(path), { signal }));
|
|
622
|
-
const canonical = `${parent === "/" ? "" : parent}/${path.slice(path.lastIndexOf("/") + 1)}`;
|
|
623
|
-
return { canonical, stat };
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
const canonical = await scope.operation(() => fs.realpath(path, { signal }));
|
|
627
|
-
const stat = await scope.operation(() => fs.stat(path, { signal }));
|
|
628
|
-
return { canonical, stat };
|
|
629
|
-
}
|
|
630
|
-
async function filterName(name, selection, includeCount) {
|
|
631
|
-
selection.matched.clear();
|
|
632
|
-
await selection.matches(name);
|
|
633
|
-
let included = includeCount === 0;
|
|
634
|
-
for (const pattern of selection.matched) {
|
|
635
|
-
if (pattern >= includeCount)
|
|
636
|
-
return false;
|
|
637
|
-
included = true;
|
|
638
|
-
}
|
|
639
|
-
return included;
|
|
640
|
-
}
|
|
641
|
-
async function prepare(scope, parsed, budget, log, host) {
|
|
642
|
-
const context = scope.context;
|
|
643
|
-
const limits = budget.limits;
|
|
644
|
-
if (parsed.archive === "-" && parsed.action !== "add")
|
|
645
|
-
throw new ZipFailure(16, "Invalid command arguments", "can't use -d, -f, -u, -U, or -g on stdout\n");
|
|
646
|
-
let temporary;
|
|
647
|
-
if (parsed.tempPath !== undefined && parsed.showFiles === undefined) {
|
|
648
|
-
const name = vfsPath(context.cwd, parsed.tempPath);
|
|
649
|
-
checkPath(name, limits);
|
|
650
|
-
const parent = await scope.operation(() => context.fs.realpath(name, { signal: context.signal }));
|
|
651
|
-
const parentStat = await scope.operation(() => context.fs.lstat(parent, { signal: context.signal }));
|
|
652
|
-
if (parentStat.type !== "directory" || !hasIdentity(parentStat))
|
|
653
|
-
fail("ZIP temporary path requires a directory with known backing identity");
|
|
654
|
-
temporary = { name, parent, parentStat };
|
|
655
|
-
}
|
|
656
|
-
let publication;
|
|
657
|
-
if (parsed.archive !== "-" && parsed.showFiles === undefined) {
|
|
658
|
-
const outputName = vfsPath(context.cwd, parsed.output ?? parsed.archive);
|
|
659
|
-
const parentName = dirname(outputName);
|
|
660
|
-
const parent = await scope.operation(() => context.fs.realpath(parentName, { signal: context.signal }));
|
|
661
|
-
const parentStat = await scope.operation(() => context.fs.lstat(parent, { signal: context.signal }));
|
|
662
|
-
const output = `${parent === "/" ? "" : parent}/${outputName.slice(outputName.lastIndexOf("/") + 1)}`;
|
|
663
|
-
checkPath(output, limits);
|
|
664
|
-
const existing = await scope.stat(output);
|
|
665
|
-
publication = { output, parentName, parent, parentStat, existing };
|
|
666
|
-
if (temporary)
|
|
667
|
-
publication = { ...publication, stagingName: temporary.name, stagingParent: temporary.parent, stagingParentStat: temporary.parentStat };
|
|
668
|
-
}
|
|
669
|
-
const output = publication?.output ?? (parsed.output === undefined ? undefined : vfsPath(context.cwd, parsed.output));
|
|
670
|
-
let input = publication?.output;
|
|
671
|
-
let existing = publication?.existing;
|
|
672
|
-
if (parsed.showFiles !== undefined && parsed.archive !== "-") {
|
|
673
|
-
input = vfsPath(context.cwd, parsed.archive);
|
|
674
|
-
existing = await scope.stat(input);
|
|
675
|
-
}
|
|
676
|
-
if (parsed.output !== undefined && parsed.showFiles === undefined) {
|
|
677
|
-
if (parsed.archive === "-") {
|
|
678
|
-
input = undefined;
|
|
679
|
-
existing = undefined;
|
|
680
|
-
}
|
|
681
|
-
else {
|
|
682
|
-
const name = vfsPath(context.cwd, parsed.archive);
|
|
683
|
-
try {
|
|
684
|
-
const parent = await scope.operation(() => context.fs.realpath(dirname(name), { signal: context.signal }));
|
|
685
|
-
input = `${parent === "/" ? "" : parent}/${name.slice(name.lastIndexOf("/") + 1)}`;
|
|
686
|
-
existing = await scope.stat(input);
|
|
687
|
-
}
|
|
688
|
-
catch (error) {
|
|
689
|
-
context.signal.throwIfAborted();
|
|
690
|
-
if (typeof error === "object" && error !== null && "code" in error && (error.code === "ENOENT" || error.code === "EACCES"))
|
|
691
|
-
throw new ZipFailure(18, "File not found or no read permission", parsed.archive);
|
|
692
|
-
throw error;
|
|
693
|
-
}
|
|
694
|
-
if (input === output || existing && publication?.existing && sameIdentity(existing, publication.existing))
|
|
695
|
-
throw new ZipFailure(16, "Invalid command arguments", `--out path must be different than in path: ${parsed.archive}`);
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
if ((parsed.action === "copy" || parsed.showFiles !== undefined && !parsed.operands.length || parsed.output !== undefined && parsed.archive !== "-") && !existing)
|
|
699
|
-
throw new ZipFailure(18, "File not found or no read permission", parsed.archive);
|
|
700
|
-
const allowHardlinkedUpdate = !parsed.split && parsed.output === undefined;
|
|
701
|
-
if (publication?.existing && !await safeZipFile(scope, publication.output, publication.existing, allowHardlinkedUpdate))
|
|
702
|
-
fail("output archive requires a regular, single-link file with known backing identity");
|
|
703
|
-
if (parsed.archive === "-" && parsed.test && !parsed.quiet)
|
|
704
|
-
await budget.output("\tzip warning: can't use -T on stdout, -T ignored\n");
|
|
705
|
-
if (existing && !await safeZipFile(scope, input, existing, allowHardlinkedUpdate))
|
|
706
|
-
fail("updating archive requires a regular, single-link file with known backing identity; archive aliases are unsupported");
|
|
707
|
-
let archive = { entries: [], comment: new Uint8Array() };
|
|
708
|
-
let originalBytes;
|
|
709
|
-
let inputPaths = [];
|
|
710
|
-
let inputSplit;
|
|
711
|
-
if (existing && input) {
|
|
712
|
-
if (!Number.isSafeInteger(existing.size) || existing.size < 0 || existing.size > limits.maxArchiveBytes)
|
|
713
|
-
fail("archive byte limit exceeded");
|
|
714
|
-
const bytes = await collectBytes(scope.input(input), { ...(Number.isFinite(limits.maxArchiveBytes) ? { maxBytes: limits.maxArchiveBytes } : {}), ...(Number.isFinite(limits.maxInputMemoryBytes) ? { maxMemoryBytes: limits.maxInputMemoryBytes } : {}), signal: context.signal });
|
|
715
|
-
if (bytes.length !== existing.size)
|
|
716
|
-
fail("archive changed while reading");
|
|
717
|
-
const resolved = parsed.repair || parsed.adjust ? { bytes, paths: [input] } : await resolveZipVolumes(scope, input, bytes, host);
|
|
718
|
-
inputPaths = resolved.paths;
|
|
719
|
-
await log?.protect(inputPaths);
|
|
720
|
-
if (resolved.disks && resolved.disks.starts.length > 1)
|
|
721
|
-
inputSplit = Math.max(65536, ...resolved.disks.lengths.slice(0, -1));
|
|
722
|
-
if (publication && parsed.output !== undefined)
|
|
723
|
-
for (const path of inputPaths) {
|
|
724
|
-
const stat = await scope.stat(path);
|
|
725
|
-
if (publication.output === path || stat && publication.existing && sameIdentity(stat, publication.existing))
|
|
726
|
-
fail("ZIP output aliases an input volume");
|
|
727
|
-
}
|
|
728
|
-
if ((parsed.split || resolved.disks) && parsed.output === undefined && parsed.showFiles === undefined)
|
|
729
|
-
throw new ZipFailure(16, "Invalid command arguments", "split archives require a separate --out destination");
|
|
730
|
-
if (parsed.repair || parsed.adjust) {
|
|
731
|
-
if (!publication)
|
|
732
|
-
fail("ZIP repair requires a file destination");
|
|
733
|
-
let outputBytes, partial = false;
|
|
734
|
-
if (parsed.repair) {
|
|
735
|
-
const recovered = await repairZip(bytes, parsed.repair, limits, context.signal, parsed.password);
|
|
736
|
-
partial = recovered.partial;
|
|
737
|
-
outputBytes = await writeZipArchive(recovered.archive, limits, context.signal);
|
|
738
|
-
const verified = await readZipArchive(outputBytes, limits, context.signal);
|
|
739
|
-
for (const entry of verified.entries)
|
|
740
|
-
for await (const chunk of decodeZipEntry(entry, limits, context.signal, parsed.password)) {
|
|
741
|
-
void chunk;
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
else {
|
|
745
|
-
archive = await readZipArchive(bytes, limits, context.signal, { prefix: true });
|
|
746
|
-
outputBytes = await adjustZipSfx(bytes, archive, limits, context.signal, parsed.password);
|
|
747
|
-
}
|
|
748
|
-
const current = await scope.stat(input);
|
|
749
|
-
if (!current || !unchanged(existing, current))
|
|
750
|
-
fail("archive changed while reading");
|
|
751
|
-
const progress = [];
|
|
752
|
-
if (!parsed.quiet)
|
|
753
|
-
progress.push(parsed.repair ? `Fix archive (-${parsed.repair}) - verified recovered members\n` : "Zip entry offsets adjusted\n");
|
|
754
|
-
if (partial)
|
|
755
|
-
progress.push("\tzip warning: partial recovery; some entries were not recovered\n");
|
|
756
|
-
return { kind: "file", inputSplit, inputPaths, testRequired: parsed.test, publication, bytes: outputBytes, progress, exitCode: 0, moves: [] };
|
|
757
|
-
}
|
|
758
|
-
archive = parsed.junkSfx ? await readZipSfx(bytes, limits, context.signal, parsed.password) : await readZipArchive(resolved.bytes, limits, context.signal, { grow: parsed.grow, ...(resolved.disks ? { disks: resolved.disks } : {}) });
|
|
759
|
-
if (!resolved.disks && (parsed.latestTime || parsed.test))
|
|
760
|
-
originalBytes = bytes;
|
|
761
|
-
const current = await scope.stat(input);
|
|
762
|
-
if (!current || !unchanged(existing, current))
|
|
763
|
-
fail("archive changed while reading");
|
|
764
|
-
}
|
|
765
|
-
const logStat = parsed.logPath === undefined ? undefined : await scope.stat(vfsPath(context.cwd, parsed.logPath));
|
|
766
|
-
const old = new Map(archive.entries.map(entry => [entry.name, entry]));
|
|
767
|
-
const liveProfile = !parsed.split && !existing && !parsed.toCrlf && !parsed.fromCrlf && !parsed.archiveComment && !parsed.entryComments
|
|
768
|
-
&& !parsed.test && !parsed.latestTime && parsed.tempPath === undefined;
|
|
769
|
-
if (!archive.entries.length && !parsed.quiet && (parsed.action === "update" || parsed.action === "freshen"))
|
|
770
|
-
await budget.output(`\tzip warning: ${zipPublicText(parsed.archive)} not found or empty\n`);
|
|
771
|
-
const dosConvertedNames = new Set();
|
|
772
|
-
const selected = new Map();
|
|
773
|
-
const conversionWarnings = new Map();
|
|
774
|
-
const listed = new Map();
|
|
775
|
-
const moves = new Map();
|
|
776
|
-
const deleted = new Set();
|
|
777
|
-
const synchronized = new Map();
|
|
778
|
-
const commentNames = new Set();
|
|
779
|
-
const selection = new Selection([...parsed.includes, ...parsed.excludes], limits, context.signal, { noWild: parsed.noWild, stopAtDirectories: parsed.stopAtDirectories });
|
|
780
|
-
const recursiveSelection = parsed.recursivePatterns ? new Selection(parsed.dosNames ? parsed.operands.map(zipDosName) : parsed.operands, limits, context.signal, { noWild: parsed.noWild, stopAtDirectories: parsed.stopAtDirectories, trailingComponents: true }) : undefined;
|
|
781
|
-
const ancestors = [];
|
|
782
|
-
let visits = 0;
|
|
783
|
-
let work = 0;
|
|
784
|
-
let compressedBytes = 0;
|
|
785
|
-
const encodeSelected = async (source, name, input, attributes, expectedSize) => {
|
|
786
|
-
const live = !(input instanceof Uint8Array);
|
|
787
|
-
let bytes = live ? new Uint8Array() : input;
|
|
788
|
-
const sourceSize = live ? expectedSize ?? 0 : bytes.length;
|
|
789
|
-
const originalBytes = bytes;
|
|
790
|
-
const store = parsed.method === "store" || parsed.level !== 9 && parsed.suffixes.some(suffix => name.endsWith(suffix));
|
|
791
|
-
if (!store && parsed.level === 0 && bytes.length && !attributes.directory && !attributes.symlink)
|
|
792
|
-
throw new ZipFailure(5, "Internal logic error", "bad pack level");
|
|
793
|
-
if ((parsed.toCrlf || parsed.fromCrlf) && !attributes.directory && !attributes.symlink) {
|
|
794
|
-
if (parsed.fromCrlf && parsed.method === "bzip2" && !store)
|
|
795
|
-
fail("from-crlf BZIP2 native read profile unsupported");
|
|
796
|
-
const originalSize = bytes.length;
|
|
797
|
-
bytes = parsed.fromCrlf ? await zipFromCrlf(bytes, store, context.signal, parsed.level) : await zipToCrlf(bytes, store, Math.min(limits.maxEntryBytes, limits.maxTotalBytes - budget.totalBytes + originalSize), context.signal);
|
|
798
|
-
budget.totalBytes += bytes.length - originalSize;
|
|
799
|
-
}
|
|
800
|
-
const level = store ? 0 : parsed.level;
|
|
801
|
-
let entry = await makeZipEntry(name, bytes, attributes, limits, context.signal, level, !store && (parsed.archive === "-" && parsed.tempPath === undefined || parsed.descriptors && bytes.length > 0), parsed.method === "store" ? "deflate" : parsed.method);
|
|
802
|
-
if (live) {
|
|
803
|
-
entry = { ...entry, data: new Uint8Array(), size: expectedSize ?? 0, source: input, level,
|
|
804
|
-
method: store || expectedSize === 0 && parsed.archive !== "-" ? 0 : parsed.method === "lzma" ? 14 : parsed.method === "bzip2" ? 12 : 8, ...(parsed.method === "lzma" && !store && !(expectedSize === 0 && parsed.archive !== "-") ? { flags: 0x802 } : {}), ...(expectedSize === undefined ? {} : { expectedSize }) };
|
|
805
|
-
}
|
|
806
|
-
if (parsed.fromCrlf && sourceSize > 0 && !store && entry.internalAttributes === 0 && !attributes.directory && !attributes.symlink && !parsed.quiet) {
|
|
807
|
-
conversionWarnings.set(name, `\tzip warning: ${bytes === originalBytes ? "has binary so -ll ignored" : "-ll used on binary file - corrupted?"}\n`);
|
|
808
|
-
}
|
|
809
|
-
if (parsed.descriptors)
|
|
810
|
-
entry.descriptors = true;
|
|
811
|
-
if (parsed.zip64 === false)
|
|
812
|
-
entry.zip64 = false;
|
|
813
|
-
if (parsed.zip64 === true || parsed.zip64 === undefined && source === "-")
|
|
814
|
-
entry.zip64 = true;
|
|
815
|
-
const prior = old.get(name);
|
|
816
|
-
if (prior?.comment)
|
|
817
|
-
entry = { ...entry, comment: prior.comment };
|
|
818
|
-
if (parsed.metadata !== "default")
|
|
819
|
-
entry = updateZipExtras(entry, prior, parsed.metadata, limits);
|
|
820
|
-
if (entry.data.length > limits.maxArchiveBytes - compressedBytes)
|
|
821
|
-
fail("archive byte limit exceeded");
|
|
822
|
-
compressedBytes += entry.data.length;
|
|
823
|
-
if (dosConvertedNames.has(name)) {
|
|
824
|
-
entry = { ...entry, mode: attributes.directory ? 0o040755 : 0o100644, versionMadeBy: 30, externalAttributes: attributes.directory ? 16 : 0, flags: (entry.flags ?? 0) & ~0x800 | (prior?.comment?.some(byte => byte >= 128) ? (prior.flags ?? 0) & 0x800 : 0) };
|
|
825
|
-
}
|
|
826
|
-
if (parsed.encryption && !entry.directory)
|
|
827
|
-
entry.encryption = parsed.encryption;
|
|
828
|
-
selected.set(name, { entry, source, sourceSize });
|
|
829
|
-
if (parsed.entryComments)
|
|
830
|
-
commentNames.add(name);
|
|
831
|
-
};
|
|
832
|
-
const visit = async (source, name, depth, storedName = false) => {
|
|
833
|
-
context.signal.throwIfAborted();
|
|
834
|
-
if (++visits > limits.maxMembers)
|
|
835
|
-
fail("traversal member limit exceeded");
|
|
836
|
-
if (++work > limits.maxPatternSteps)
|
|
837
|
-
fail("archive work limit exceeded");
|
|
838
|
-
if (visits % 128 === 0)
|
|
839
|
-
await yieldTurn(context.signal);
|
|
840
|
-
if (depth > limits.maxDepth)
|
|
841
|
-
fail("archive recursion depth limit exceeded");
|
|
842
|
-
if (source === "-") {
|
|
843
|
-
const previous = selected.get(name) ?? listed.get(name);
|
|
844
|
-
if (previous && previous.source !== source)
|
|
845
|
-
throw new ZipFailure(16, "Invalid command arguments", "cannot repeat names in zip file");
|
|
846
|
-
if (previous || !await filterName(name, selection, parsed.includes.length))
|
|
847
|
-
return;
|
|
848
|
-
const prior = old.get(name);
|
|
849
|
-
const modified = new Date();
|
|
850
|
-
if (parsed.entryComments && prior)
|
|
851
|
-
commentNames.add(name);
|
|
852
|
-
if (!zipDateMatches(modified, parsed.fromDate, parsed.beforeDate))
|
|
853
|
-
return;
|
|
854
|
-
if (parsed.filesync) {
|
|
855
|
-
if (synchronized.has(name) && synchronized.get(name) !== source)
|
|
856
|
-
throw new ZipFailure(16, "Invalid command arguments", "cannot repeat names in zip file");
|
|
857
|
-
synchronized.set(name, source);
|
|
858
|
-
}
|
|
859
|
-
if (parsed.action === "freshen" && !prior || prior && (parsed.action === "update" || parsed.action === "freshen") && Math.floor(modified.getTime() / 1000) <= Math.floor(prior.modified.getTime() / 1000))
|
|
860
|
-
return;
|
|
861
|
-
if (parsed.showFiles !== undefined) {
|
|
862
|
-
await budget.member(0);
|
|
863
|
-
listed.set(name, { name, size: 0, source });
|
|
864
|
-
return;
|
|
865
|
-
}
|
|
866
|
-
const live = liveProfile;
|
|
867
|
-
const bytes = live ? scope.stdin : await collectBytes(scope.stdin, { ...(Number.isFinite(Math.min(limits.maxEntryBytes, limits.maxTotalBytes - budget.totalBytes)) ? { maxBytes: Math.min(limits.maxEntryBytes, limits.maxTotalBytes - budget.totalBytes) } : {}), signal: context.signal });
|
|
868
|
-
await budget.member(bytes instanceof Uint8Array ? bytes.length : 0);
|
|
869
|
-
await encodeSelected(source, name, bytes, { modified, mode: 0o010660, directory: false, symlink: false });
|
|
870
|
-
return;
|
|
871
|
-
}
|
|
872
|
-
const path = vfsPath(context.cwd, source);
|
|
873
|
-
checkPath(path, limits);
|
|
874
|
-
let canonical;
|
|
875
|
-
let stat;
|
|
876
|
-
try {
|
|
877
|
-
({ canonical, stat } = await inspectSource(scope, path, parsed.storeLinks));
|
|
878
|
-
}
|
|
879
|
-
catch (error) {
|
|
880
|
-
context.signal.throwIfAborted();
|
|
881
|
-
if (typeof error !== "object" || error === null || !("code" in error))
|
|
882
|
-
throw error;
|
|
883
|
-
if (parsed.mustMatch && error.code === "EACCES")
|
|
884
|
-
throw new ZipFailure(18, "File not found or no read permission", source);
|
|
885
|
-
if (error.code !== "ENOENT")
|
|
886
|
-
throw error;
|
|
887
|
-
if (!storedName) {
|
|
888
|
-
const operandName = memberName(source, limits);
|
|
889
|
-
const pattern = new Selection([parsed.junkPaths ? operandName.slice(operandName.lastIndexOf("/") + 1) : operandName], limits, context.signal, { noWild: parsed.noWild, stopAtDirectories: parsed.stopAtDirectories });
|
|
890
|
-
let matched = false;
|
|
891
|
-
for (const entry of archive.entries) {
|
|
892
|
-
if (await pattern.matches(entry.name, true)) {
|
|
893
|
-
matched = true;
|
|
894
|
-
await visit(entry.name, entry.name, depth, true);
|
|
895
|
-
}
|
|
896
|
-
}
|
|
897
|
-
if (matched)
|
|
898
|
-
return;
|
|
899
|
-
}
|
|
900
|
-
if (parsed.entryComments && old.has(name) && await filterName(name, selection, parsed.includes.length))
|
|
901
|
-
commentNames.add(name);
|
|
902
|
-
if (parsed.mustMatch && !storedName) {
|
|
903
|
-
if (!parsed.quiet)
|
|
904
|
-
await budget.output(`\tzip warning: name not matched: ${zipPublicText(source)}\n`);
|
|
905
|
-
throw new ZipFailure(18, "File not found or no read permission", source);
|
|
906
|
-
}
|
|
907
|
-
if (!parsed.quiet && !storedName)
|
|
908
|
-
await budget.output(`\tzip warning: name not matched: ${zipPublicText(source)}\n`);
|
|
909
|
-
return;
|
|
910
|
-
}
|
|
911
|
-
checkPath(canonical, limits);
|
|
912
|
-
if (canonical === output || canonical === input || (existing && sameIdentity(existing, stat)) || (publication?.existing && sameIdentity(publication.existing, stat)))
|
|
913
|
-
return;
|
|
914
|
-
const symlink = parsed.storeLinks && stat.type === "symlink";
|
|
915
|
-
const fifoSource = (stat.mode & 0o170000) === 0o010000;
|
|
916
|
-
if (fifoSource && !parsed.fifo || stat.type !== "file" && stat.type !== "directory" && !symlink && !fifoSource) {
|
|
917
|
-
if (!parsed.quiet)
|
|
918
|
-
await budget.output(`\tzip warning: ignoring special file: ${zipPublicText(source)}\n`);
|
|
919
|
-
return;
|
|
920
|
-
}
|
|
921
|
-
const directory = stat.type === "directory";
|
|
922
|
-
if ((existing || publication?.existing) && !directory && !hasIdentity(stat))
|
|
923
|
-
fail("cannot exclude archive aliases when source backing identity is unknown");
|
|
924
|
-
if (directory && name && !name.endsWith("/"))
|
|
925
|
-
name += "/";
|
|
926
|
-
const dateIncluded = zipDateMatches(new Date(stat.mtimeMs), parsed.fromDate, parsed.beforeDate);
|
|
927
|
-
const nameIncluded = (dateIncluded || parsed.entryComments) && await filterName(name, selection, parsed.includes.length) && (!recursiveSelection || await recursiveSelection.matches(name, true));
|
|
928
|
-
const included = dateIncluded && nameIncluded;
|
|
929
|
-
if (logStat && included && (!hasIdentity(stat) || sameIdentity(logStat, stat))) {
|
|
930
|
-
if (log)
|
|
931
|
-
log.failed = true;
|
|
932
|
-
throw new ZipFailure(16, "Invalid command arguments", "ZIP log may not alias a selected source");
|
|
933
|
-
}
|
|
934
|
-
const sourceName = name;
|
|
935
|
-
if (parsed.junkPaths && !storedName)
|
|
936
|
-
name = directory ? "" : name.slice(name.lastIndexOf("/") + 1);
|
|
937
|
-
if (parsed.dosNames && !storedName && name && included) {
|
|
938
|
-
name = zipDosName(name);
|
|
939
|
-
if (!name || (directory ? name.slice(0, -1) : name).split("/").some(component => !component))
|
|
940
|
-
throw new ZipFailure(16, "Invalid command arguments", "DOS conversion produces an empty component");
|
|
941
|
-
dosConvertedNames.add(name);
|
|
942
|
-
}
|
|
943
|
-
const prior = old.get(name);
|
|
944
|
-
if (parsed.entryComments && prior && nameIncluded)
|
|
945
|
-
commentNames.add(name);
|
|
946
|
-
if ((parsed.filesync || parsed.difference) && name && included && !(directory && parsed.omitDirectories)) {
|
|
947
|
-
if (synchronized.has(name) && synchronized.get(name) !== source)
|
|
948
|
-
throw new ZipFailure(16, "Invalid command arguments", "cannot repeat names in zip file");
|
|
949
|
-
synchronized.set(name, source);
|
|
950
|
-
}
|
|
951
|
-
const current = !fifoSource && (parsed.filesync || parsed.difference) && prior && prior.size === (directory ? 0 : stat.size)
|
|
952
|
-
&& Math.ceil(Math.floor(stat.mtimeMs / 1000) / 2) === Math.ceil(Math.floor(prior.modified.getTime() / 1000) / 2);
|
|
953
|
-
const eligible = parsed.action !== "update" && parsed.action !== "freshen"
|
|
954
|
-
|| (prior ? Math.floor(stat.mtimeMs / 1000) > Math.floor(prior.modified.getTime() / 1000) : parsed.action === "update");
|
|
955
|
-
if (parsed.showFiles === undefined && parsed.move && (!parsed.difference || !current && eligible) && name && included && !(directory && parsed.omitDirectories) && (prior || parsed.action !== "freshen")) {
|
|
956
|
-
if (!moves.has(path))
|
|
957
|
-
moves.set(path, await inspectZipMoveSource(scope, path, source));
|
|
958
|
-
}
|
|
959
|
-
if (name && included && eligible && (!current || parsed.showFiles !== undefined) && !(directory && parsed.omitDirectories)) {
|
|
960
|
-
checkPath(name, limits);
|
|
961
|
-
const previous = selected.get(name) ?? listed.get(name);
|
|
962
|
-
if (previous && previous.source !== source) {
|
|
963
|
-
if (!parsed.quiet)
|
|
964
|
-
await budget.output(`\tzip warning: first full name: ${zipPublicText(previous.source)}\n second full name: ${zipPublicText(source)}\n name in zip file repeated: ${zipPublicText(name)}\n`);
|
|
965
|
-
throw new ZipFailure(16, "Invalid command arguments", "cannot repeat names in zip file");
|
|
966
|
-
}
|
|
967
|
-
if (!previous) {
|
|
968
|
-
if (fifoSource && parsed.move)
|
|
969
|
-
fail("FIFO move is unsupported: producer streams have no removable file snapshot");
|
|
970
|
-
await budget.member(directory || fifoSource ? 0 : stat.size);
|
|
971
|
-
if (parsed.showFiles !== undefined) {
|
|
972
|
-
listed.set(name, { name, size: directory ? 0 : stat.size, source });
|
|
973
|
-
}
|
|
974
|
-
else {
|
|
975
|
-
const store = parsed.method === "store" || parsed.level !== 9 && parsed.suffixes.some(suffix => name.endsWith(suffix));
|
|
976
|
-
if (fifoSource) {
|
|
977
|
-
const bytes = await collectBytes(scope.input(path, true), { ...(Number.isFinite(Math.min(limits.maxEntryBytes, limits.maxTotalBytes - budget.totalBytes)) ? { maxBytes: Math.min(limits.maxEntryBytes, limits.maxTotalBytes - budget.totalBytes) } : {}), signal: context.signal });
|
|
978
|
-
const current = await inspectSource(scope, path, parsed.storeLinks);
|
|
979
|
-
if (current.canonical !== canonical || !unchanged(stat, current.stat))
|
|
980
|
-
fail(`source changed while reading: ${source}`);
|
|
981
|
-
budget.totalBytes += bytes.length;
|
|
982
|
-
await encodeSelected(source, name, bytes, { modified: new Date(stat.mtimeMs), mode: 0o100644, directory: false, symlink: false });
|
|
983
|
-
return;
|
|
984
|
-
}
|
|
985
|
-
if (liveProfile && !directory && !symlink && (parsed.archive === "-" || store || parsed.descriptors)) {
|
|
986
|
-
const input = (async function* () {
|
|
987
|
-
yield* scope.input(path, false, stat);
|
|
988
|
-
const current = await inspectSource(scope, path, parsed.storeLinks);
|
|
989
|
-
if (current.canonical !== canonical || !unchanged(stat, current.stat))
|
|
990
|
-
fail(`source changed while reading: ${source}`);
|
|
991
|
-
})();
|
|
992
|
-
await encodeSelected(source, name, input, { modified: new Date(stat.mtimeMs), mode: stat.mode, directory, symlink }, stat.size);
|
|
993
|
-
return;
|
|
994
|
-
}
|
|
995
|
-
let bytes;
|
|
996
|
-
if (directory)
|
|
997
|
-
bytes = new Uint8Array();
|
|
998
|
-
else if (symlink) {
|
|
999
|
-
if (!context.fs.readlink)
|
|
1000
|
-
fail("filesystem does not support reading symbolic links");
|
|
1001
|
-
const target = await scope.operation(() => context.fs.readlink(path, { signal: context.signal }));
|
|
1002
|
-
if (byteLength(target) > stat.size)
|
|
1003
|
-
fail(`source changed while reading: ${source}`);
|
|
1004
|
-
bytes = encodeBytes(target);
|
|
1005
|
-
}
|
|
1006
|
-
else {
|
|
1007
|
-
try {
|
|
1008
|
-
bytes = await collectBytes(scope.input(path, false, stat), { maxBytes: stat.size, signal: context.signal });
|
|
1009
|
-
}
|
|
1010
|
-
catch (error) {
|
|
1011
|
-
context.signal.throwIfAborted();
|
|
1012
|
-
if (parsed.mustMatch && typeof error === "object" && error !== null && "code" in error && (error.code === "ENOENT" || error.code === "EACCES"))
|
|
1013
|
-
throw new ZipFailure(18, "File not found or no read permission", `was zipping ${source}`);
|
|
1014
|
-
throw error;
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
if (!directory && bytes.length !== stat.size)
|
|
1018
|
-
fail(`source changed while reading: ${source}`);
|
|
1019
|
-
const current = await inspectSource(scope, path, parsed.storeLinks);
|
|
1020
|
-
if (current.canonical !== canonical || !unchanged(stat, current.stat))
|
|
1021
|
-
fail(`source changed while reading: ${source}`);
|
|
1022
|
-
await encodeSelected(source, name, bytes, { modified: new Date(stat.mtimeMs), mode: stat.mode, directory, symlink });
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
}
|
|
1026
|
-
if (directory && !storedName && (parsed.recursive || parsed.recursivePatterns)) {
|
|
1027
|
-
if (ancestors.some(ancestor => ancestor.path === canonical || sameIdentity(ancestor.stat, stat)))
|
|
1028
|
-
fail(`directory cycle while archiving: ${source}`);
|
|
1029
|
-
ancestors.push({ path: canonical, stat });
|
|
1030
|
-
try {
|
|
1031
|
-
const children = await scope.operation(() => context.fs.readdir(path, { signal: context.signal, ...(Number.isFinite(limits.maxMembers) ? { maxEntries: limits.maxMembers - visits } : {}) }));
|
|
1032
|
-
if (children.length > limits.maxMembers - visits)
|
|
1033
|
-
fail("traversal member limit exceeded");
|
|
1034
|
-
for (const child of children) {
|
|
1035
|
-
if (!child.name || child.name === "." || child.name === ".." || child.name.includes("/") || child.name.includes("\0"))
|
|
1036
|
-
fail("invalid filesystem directory entry");
|
|
1037
|
-
const prefix = source === "." ? "" : source.endsWith("/") ? source : `${source}/`;
|
|
1038
|
-
await visit(`${prefix}${child.name}`, `${sourceName}${child.name}`, depth + 1);
|
|
1039
|
-
}
|
|
1040
|
-
}
|
|
1041
|
-
finally {
|
|
1042
|
-
ancestors.pop();
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
};
|
|
1046
|
-
const editComment = parsed.archiveComment && parsed.action !== "delete" && parsed.action !== "copy";
|
|
1047
|
-
const editEntries = parsed.entryComments && parsed.action !== "delete" && parsed.action !== "copy";
|
|
1048
|
-
if ((parsed.archiveComment || parsed.entryComments || parsed.move) && parsed.action === "copy" && !parsed.quiet)
|
|
1049
|
-
await budget.output("\tzip warning: can't set method, move, recurse, or comments with copy mode.\n");
|
|
1050
|
-
if (parsed.action === "copy") {
|
|
1051
|
-
const operands = new Selection(parsed.operands, limits, context.signal, { noWild: parsed.noWild, stopAtDirectories: parsed.stopAtDirectories });
|
|
1052
|
-
for (const entry of archive.entries) {
|
|
1053
|
-
if (await operands.matches(entry.name) && await filterName(entry.name, selection, parsed.includes.length) && zipDateMatches(entry.modified, parsed.fromDate, parsed.beforeDate)) {
|
|
1054
|
-
await budget.member(entry.size);
|
|
1055
|
-
selected.set(entry.name, { entry, source: entry.name, sourceSize: entry.size });
|
|
1056
|
-
}
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
else if (parsed.action === "delete") {
|
|
1060
|
-
if (!parsed.quiet && (parsed.recursive || parsed.archiveComment || parsed.entryComments || parsed.move))
|
|
1061
|
-
await budget.output("\tzip warning: invalid option(s) used with -d; ignored.\n");
|
|
1062
|
-
if (!parsed.quiet && !archive.entries.length)
|
|
1063
|
-
await budget.output(`\tzip warning: ${zipPublicText(parsed.archive)} not found or empty\n`);
|
|
1064
|
-
const operands = new Selection(parsed.recursivePatterns ? [] : parsed.operands, limits, context.signal, { noWild: parsed.noWild, stopAtDirectories: parsed.stopAtDirectories });
|
|
1065
|
-
if (parsed.operands.length && !parsed.recursivePatterns) {
|
|
1066
|
-
for (const entry of archive.entries) {
|
|
1067
|
-
if (await operands.matches(entry.name) && await filterName(entry.name, selection, parsed.includes.length) && zipDateMatches(entry.modified, parsed.fromDate, parsed.beforeDate))
|
|
1068
|
-
deleted.add(entry.name);
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
if (parsed.mustMatch && !parsed.recursivePatterns) {
|
|
1072
|
-
for (const [index, operand] of parsed.operands.entries()) {
|
|
1073
|
-
if (!operands.matched.has(index))
|
|
1074
|
-
throw new ZipFailure(18, "File not found or no read permission", operand);
|
|
1075
|
-
}
|
|
1076
|
-
}
|
|
1077
|
-
if (!parsed.quiet) {
|
|
1078
|
-
for (const [index, operand] of parsed.operands.entries()) {
|
|
1079
|
-
if (!operands.matched.has(index))
|
|
1080
|
-
await budget.output(`\tzip warning: name not matched: ${zipPublicText(operand)}\n`);
|
|
1081
|
-
}
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
else {
|
|
1085
|
-
const operands = parsed.showFiles !== undefined && !parsed.operands.length ? [] : parsed.operands.length || parsed.action === "add" ? parsed.operands : archive.entries.map(entry => entry.name);
|
|
1086
|
-
if (parsed.recursivePatterns)
|
|
1087
|
-
await visit(".", "", 0);
|
|
1088
|
-
else
|
|
1089
|
-
for (const operand of operands)
|
|
1090
|
-
await visit(operand, memberName(operand, limits), 0);
|
|
1091
|
-
}
|
|
1092
|
-
if (!publication || !(parsed.split ?? inputSplit))
|
|
1093
|
-
await log?.start();
|
|
1094
|
-
if (parsed.showFiles !== undefined) {
|
|
1095
|
-
const contains = !parsed.operands.length && !parsed.includes.length && !parsed.excludes.length;
|
|
1096
|
-
const listing = contains ? archive.entries : parsed.action === "delete" ? archive.entries.filter(entry => deleted.has(entry.name)) : parsed.action === "copy" ? [...selected.values()].map(item => item.entry) : [...listed.values()];
|
|
1097
|
-
const title = contains ? "Archive contains" : parsed.action === "delete" ? "Would Delete" : parsed.action === "freshen" ? "Would Freshen" : parsed.action === "copy" ? "Would Copy" : "Would Add/Update";
|
|
1098
|
-
if (!parsed.quiet && parsed.showFiles) {
|
|
1099
|
-
await budget.output(`${title}:\n`);
|
|
1100
|
-
for (const entry of listing)
|
|
1101
|
-
await budget.output(` ${escapeText(zipPublicText(entry.name), "display")}\n`);
|
|
1102
|
-
}
|
|
1103
|
-
await budget.output(`Total ${listing.length} entries (${listing.reduce((total, entry) => total + entry.size, 0)} bytes)\n`);
|
|
1104
|
-
return { kind: "current", exitCode: 0, moves: [] };
|
|
1105
|
-
}
|
|
1106
|
-
if (parsed.filesync) {
|
|
1107
|
-
if (!synchronized.size)
|
|
1108
|
-
throw new ZipFailure(12, "Nothing to do!", parsed.archive);
|
|
1109
|
-
for (const entry of archive.entries)
|
|
1110
|
-
if (!synchronized.has(entry.name))
|
|
1111
|
-
deleted.add(entry.name);
|
|
1112
|
-
if (!selected.size && !deleted.size) {
|
|
1113
|
-
if (!parsed.quiet)
|
|
1114
|
-
await budget.output("Archive is current\n");
|
|
1115
|
-
if (!parsed.latestTime)
|
|
1116
|
-
return { kind: "current", exitCode: 0, moves: [...moves.values()] };
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
const changed = selected.size > 0 || deleted.size > 0;
|
|
1120
|
-
const testRequired = parsed.test && !(parsed.filesync && !changed);
|
|
1121
|
-
let exitCode = 0;
|
|
1122
|
-
if (!parsed.difference && !selected.size && !((editComment || editEntries || parsed.junkSfx || parsed.test) && archive.entries.length) && (parsed.action === "freshen" || parsed.action === "update" && (existing || !parsed.includes.length))) {
|
|
1123
|
-
if (!parsed.latestTime || !archive.entries.length)
|
|
1124
|
-
return moves.size ? { kind: "current", exitCode: 12, moves: [...moves.values()] } : undefined;
|
|
1125
|
-
exitCode = 12;
|
|
1126
|
-
}
|
|
1127
|
-
if (parsed.latestTime && !changed && !archive.entries.length && parsed.archive !== "-")
|
|
1128
|
-
throw new ZipFailure(13, "Missing or empty zip file", parsed.archive);
|
|
1129
|
-
if (!parsed.difference && !selected.size && !deleted.size && !((editComment || editEntries || parsed.junkSfx || parsed.latestTime || parsed.test) && archive.entries.length) && (parsed.action === "delete" || parsed.action === "copy" || parsed.recursivePatterns || parsed.fromDate !== undefined || parsed.beforeDate !== undefined || !parsed.includes.length)) {
|
|
1130
|
-
const detail = parsed.action !== "delete" && parsed.recursive && parsed.firstOperand >= 0
|
|
1131
|
-
? `try: zip ${parsed.args.slice(0, parsed.firstOperand).join(" ")} . -i ${parsed.args.slice(parsed.firstOperand).join(" ")}`
|
|
1132
|
-
: parsed.archive;
|
|
1133
|
-
throw new ZipFailure(12, "Nothing to do!", detail);
|
|
1134
|
-
}
|
|
1135
|
-
const entries = [];
|
|
1136
|
-
const progress = [];
|
|
1137
|
-
let progressBytes = 0;
|
|
1138
|
-
const queue = (message) => {
|
|
1139
|
-
if (parsed.quiet)
|
|
1140
|
-
return;
|
|
1141
|
-
const size = byteLength(message);
|
|
1142
|
-
if (size > limits.maxTextBytes - budget.textBytes - progressBytes)
|
|
1143
|
-
fail("text output limit exceeded");
|
|
1144
|
-
progressBytes += size;
|
|
1145
|
-
progress.push(message);
|
|
1146
|
-
};
|
|
1147
|
-
const counted = parsed.action === "delete" ? archive.entries.filter(entry => deleted.has(entry.name)) : [...selected.values()].map(item => item.entry);
|
|
1148
|
-
let remainingBytes = counted.reduce((total, entry) => total + (parsed.action === "delete" || parsed.action === "copy" ? entry.data.length : selected.get(entry.name)?.sourceSize ?? entry.size), 0);
|
|
1149
|
-
let doneBytes = 0;
|
|
1150
|
-
let done = 0;
|
|
1151
|
-
const stats = (entry) => {
|
|
1152
|
-
let prefix = parsed.displayVolume ? "1>1: " : "";
|
|
1153
|
-
if (parsed.displayCounts)
|
|
1154
|
-
prefix += `${String(done).padStart(3)}/${String(counted.length - done).padStart(3)} `;
|
|
1155
|
-
if (parsed.displayBytes)
|
|
1156
|
-
prefix += `[${zipDisplaySize(doneBytes).padStart(4)}/${zipDisplaySize(remainingBytes).padStart(4)}] `;
|
|
1157
|
-
const size = parsed.action === "delete" || parsed.action === "copy" ? entry.data.length : selected.get(entry.name)?.sourceSize ?? entry.size;
|
|
1158
|
-
done++;
|
|
1159
|
-
doneBytes += size;
|
|
1160
|
-
remainingBytes -= size;
|
|
1161
|
-
return prefix;
|
|
1162
|
-
};
|
|
1163
|
-
const append = (entry, update) => {
|
|
1164
|
-
if (parsed.quiet)
|
|
1165
|
-
return;
|
|
1166
|
-
const compressedSize = entry.compressedSize ?? entry.data.length;
|
|
1167
|
-
const percentage = entry.size ? Math.trunc((Math.trunc(200 * (entry.size - compressedSize) / entry.size) + 1) / 2) : 0;
|
|
1168
|
-
const prefix = stats(entry);
|
|
1169
|
-
const usize = parsed.displayUsize ? ` (${zipDisplaySize(selected.get(entry.name)?.sourceSize ?? entry.size)})` : "";
|
|
1170
|
-
const verbose = parsed.verbose ? `${entry.method === 0 ? "" : " "}\t(in=${entry.size}) (out=${compressedSize})` : "";
|
|
1171
|
-
const dotCount = !parsed.globalDots && parsed.dotSize ? Math.floor(entry.size / parsed.dotSize) : 0;
|
|
1172
|
-
if (dotCount > limits.maxTextBytes - budget.textBytes - progressBytes)
|
|
1173
|
-
fail("text output limit exceeded");
|
|
1174
|
-
const dots = ".".repeat(dotCount);
|
|
1175
|
-
const warning = conversionWarnings.get(entry.name);
|
|
1176
|
-
queue(`${prefix}${update ? parsed.action === "freshen" ? "freshening:" : "updating:" : " adding:"} ${escapeText(zipPublicText(entry.name), "display")}${usize}${verbose}${warning ? `\n${warning}` : ""} ${dots ? `${dots} ` : ""}(${entry.method === 14 ? `lzma ${percentage}%` : entry.method === 12 ? `bzipped ${percentage}%` : entry.method === 8 ? `deflated ${percentage}%` : "stored 0%"})\n`);
|
|
1177
|
-
};
|
|
1178
|
-
for (const entry of archive.entries) {
|
|
1179
|
-
if (++work > limits.maxPatternSteps)
|
|
1180
|
-
fail("archive work limit exceeded");
|
|
1181
|
-
if (deleted.has(entry.name)) {
|
|
1182
|
-
queue(`${stats(entry)}deleting: ${escapeText(zipPublicText(entry.name), "display")}\n`);
|
|
1183
|
-
continue;
|
|
1184
|
-
}
|
|
1185
|
-
const replacement = selected.get(entry.name);
|
|
1186
|
-
if (parsed.action === "copy") {
|
|
1187
|
-
if (replacement) {
|
|
1188
|
-
entries.push(replacement.entry);
|
|
1189
|
-
queue(`${stats(entry)} copying: ${escapeText(zipPublicText(entry.name), "display")}\n`);
|
|
1190
|
-
selected.delete(entry.name);
|
|
1191
|
-
}
|
|
1192
|
-
continue;
|
|
1193
|
-
}
|
|
1194
|
-
if (replacement) {
|
|
1195
|
-
entries.push(replacement.entry);
|
|
1196
|
-
append(replacement.entry, true);
|
|
1197
|
-
selected.delete(entry.name);
|
|
1198
|
-
}
|
|
1199
|
-
else if (!parsed.difference) {
|
|
1200
|
-
await budget.member(entry.size);
|
|
1201
|
-
entries.push(entry);
|
|
1202
|
-
}
|
|
1203
|
-
}
|
|
1204
|
-
if (parsed.grow && (parsed.zip64 !== undefined || deleted.size || archive.entries.some(entry => !entries.includes(entry)))) {
|
|
1205
|
-
for (const entry of archive.entries) {
|
|
1206
|
-
zipGrowRecords.delete(entry);
|
|
1207
|
-
if (parsed.zip64 === false)
|
|
1208
|
-
entry.zip64 = false;
|
|
1209
|
-
}
|
|
1210
|
-
}
|
|
1211
|
-
const pendingProgress = [];
|
|
1212
|
-
for (const { entry } of selected.values()) {
|
|
1213
|
-
entries.push(entry);
|
|
1214
|
-
if (entry.source)
|
|
1215
|
-
pendingProgress.push(entry);
|
|
1216
|
-
else
|
|
1217
|
-
append(entry, false);
|
|
1218
|
-
}
|
|
1219
|
-
const summary = () => {
|
|
1220
|
-
if (!parsed.verbose || parsed.quiet)
|
|
1221
|
-
return;
|
|
1222
|
-
const size = entries.reduce((total, entry) => total + entry.size, 0);
|
|
1223
|
-
const compressed = entries.reduce((total, entry) => total + (entry.compressedSize ?? entry.data.length), 0);
|
|
1224
|
-
queue(`total bytes=${size}, compressed=${compressed} -> ${size ? Math.round(100 * (size - compressed) / size) : 0}% savings\n`);
|
|
1225
|
-
};
|
|
1226
|
-
const finishProgress = () => {
|
|
1227
|
-
if (!pendingProgress.length)
|
|
1228
|
-
return;
|
|
1229
|
-
for (const entry of pendingProgress.splice(0))
|
|
1230
|
-
append(entry, false);
|
|
1231
|
-
summary();
|
|
1232
|
-
};
|
|
1233
|
-
if (!pendingProgress.length)
|
|
1234
|
-
summary();
|
|
1235
|
-
if (!entries.length)
|
|
1236
|
-
queue("\tzip warning: zip file empty\n");
|
|
1237
|
-
let comment = archive.comment;
|
|
1238
|
-
if (editComment || editEntries && commentNames.size) {
|
|
1239
|
-
for (const message of progress)
|
|
1240
|
-
await budget.output(message);
|
|
1241
|
-
progress.length = 0;
|
|
1242
|
-
progressBytes = 0;
|
|
1243
|
-
const commentInput = new ZipCommentInput(scope.stdin, limits, context.signal);
|
|
1244
|
-
if (editEntries) {
|
|
1245
|
-
for (let index = 0; index < entries.length; index++) {
|
|
1246
|
-
const entry = entries[index];
|
|
1247
|
-
if (!commentNames.has(entry.name))
|
|
1248
|
-
continue;
|
|
1249
|
-
if (!parsed.quiet)
|
|
1250
|
-
await budget.output(`Enter comment for ${zipPublicText(entry.name)}:\n`);
|
|
1251
|
-
const line = await commentInput.readLine();
|
|
1252
|
-
if (line !== undefined)
|
|
1253
|
-
entries[index] = setZipEntryComment(entry, line.at(-1) === 10 ? line.subarray(0, -1) : line, limits);
|
|
1254
|
-
}
|
|
1255
|
-
}
|
|
1256
|
-
if (editComment && !parsed.quiet) {
|
|
1257
|
-
if (comment.length) {
|
|
1258
|
-
await budget.output("current zip file comment is:\n");
|
|
1259
|
-
await budget.output(comment);
|
|
1260
|
-
if (comment.at(-1) !== 10)
|
|
1261
|
-
await budget.output("\n");
|
|
1262
|
-
}
|
|
1263
|
-
await budget.output("enter new zip file comment (end with .):\n");
|
|
1264
|
-
}
|
|
1265
|
-
if (editComment)
|
|
1266
|
-
comment = await readZipComment(commentInput, limits, context.signal);
|
|
1267
|
-
}
|
|
1268
|
-
if (!publication)
|
|
1269
|
-
return { kind: "stream", temporary, archive: { entries, comment }, progress, finishProgress, moves: [...moves.values()] };
|
|
1270
|
-
if (entries.some(entry => entry.source))
|
|
1271
|
-
return { kind: "staged-stream", publication, archive: { entries, comment }, progress, finishProgress, exitCode, moves: [...moves.values()] };
|
|
1272
|
-
let latestWarning;
|
|
1273
|
-
if (parsed.latestTime) {
|
|
1274
|
-
const mtimeMs = await zipLatestTime(entries, context.signal);
|
|
1275
|
-
if (mtimeMs === undefined)
|
|
1276
|
-
latestWarning = entries.length
|
|
1277
|
-
? "\tzip warning: zip file has only directories, can't make it as old as latest entry\n"
|
|
1278
|
-
: "\tzip warning: zip file is empty, can't make it as old as latest entry\n";
|
|
1279
|
-
else
|
|
1280
|
-
publication = { ...publication, mtimeMs };
|
|
1281
|
-
}
|
|
1282
|
-
const bytes = originalBytes && !changed && !editComment && !editEntries && !parsed.junkSfx && !parsed.difference ? originalBytes
|
|
1283
|
-
: await writeZipArchive({ entries, comment }, limits, context.signal, false, parsed.zip64 === true, parsed.zip64 !== false);
|
|
1284
|
-
if (testRequired && parsed.archive !== "-") {
|
|
1285
|
-
for (const message of progress)
|
|
1286
|
-
await budget.output(message);
|
|
1287
|
-
progress.length = 0;
|
|
1288
|
-
progressBytes = 0;
|
|
1289
|
-
}
|
|
1290
|
-
if (latestWarning !== undefined)
|
|
1291
|
-
queue(latestWarning);
|
|
1292
|
-
if (!changed && originalBytes && !editComment && !editEntries && !parsed.junkSfx && !parsed.difference && (parsed.output === undefined || parsed.action === "copy" && parsed.test) && (latestWarning !== undefined || parsed.test && !parsed.latestTime)) {
|
|
1293
|
-
if (testRequired && input)
|
|
1294
|
-
await testZipCommand(scope, parsed.testCommand, input, budget, parsed.archive, parsed.quiet, parsed.password);
|
|
1295
|
-
for (const message of progress)
|
|
1296
|
-
await budget.output(message);
|
|
1297
|
-
return { kind: "current", exitCode, moves: [...moves.values()] };
|
|
1298
|
-
}
|
|
1299
|
-
const sourcePaths = [];
|
|
1300
|
-
if ((parsed.split ?? inputSplit) && parsed.action !== "copy" && parsed.action !== "delete")
|
|
1301
|
-
for (const value of selected.values()) {
|
|
1302
|
-
if (value.source === "-")
|
|
1303
|
-
continue;
|
|
1304
|
-
const path = vfsPath(context.cwd, value.source);
|
|
1305
|
-
if (value.entry.symlink) {
|
|
1306
|
-
const parent = await scope.operation(() => context.fs.realpath(dirname(path), { signal: context.signal }));
|
|
1307
|
-
sourcePaths.push(`${parent === "/" ? "" : parent}/${path.slice(path.lastIndexOf("/") + 1)}`);
|
|
1308
|
-
}
|
|
1309
|
-
else
|
|
1310
|
-
sourcePaths.push(await scope.operation(() => context.fs.realpath(path, { signal: context.signal })));
|
|
1311
|
-
}
|
|
1312
|
-
return { kind: "file", inputSplit, inputPaths: [...inputPaths, ...sourcePaths], testRequired, publication, bytes, progress, exitCode, moves: [...moves.values()] };
|
|
1313
|
-
}
|
|
1314
|
-
export function createZipCommand(options = {}) {
|
|
1315
|
-
const configured = settings(options);
|
|
1316
|
-
return { name: "zip", description: "Create or update bounded ZIP archives in the virtual filesystem", async execute(original) {
|
|
1317
|
-
const limits = invocationLimits(configured, original);
|
|
1318
|
-
original.signal.throwIfAborted();
|
|
1319
|
-
const scope = new ZipScope(original, limits);
|
|
1320
|
-
const context = scope.context;
|
|
1321
|
-
let budget = new Budget(context, limits);
|
|
1322
|
-
let log;
|
|
1323
|
-
try {
|
|
1324
|
-
let parsed = await parse(scope, limits, options.zip);
|
|
1325
|
-
if ("information" in parsed) {
|
|
1326
|
-
if (parsed.debug)
|
|
1327
|
-
await budget.output("sd: Command line read\n");
|
|
1328
|
-
if (parsed.information === "command") {
|
|
1329
|
-
await budget.output("command line:\n");
|
|
1330
|
-
let redactNext = false;
|
|
1331
|
-
for (const argument of parsed.command ?? []) {
|
|
1332
|
-
const value = zipPublicText(redactNext ? "[redacted]" : argument);
|
|
1333
|
-
redactNext = zipPasswordArgument(argument) === "separate";
|
|
1334
|
-
const escaped = escapeText(value, "display", size => { if (size > limits.maxTextBytes - budget.textBytes)
|
|
1335
|
-
fail("text output limit exceeded"); }).split("'").join("'\\''");
|
|
1336
|
-
await budget.output(`'${escaped}' `);
|
|
1337
|
-
}
|
|
1338
|
-
await budget.output("\n\nzip error: Interrupted (show command line)\n");
|
|
1339
|
-
return { exitCode: 9 };
|
|
1340
|
-
}
|
|
1341
|
-
if (parsed.information === "options") {
|
|
1342
|
-
await budget.output("available options:\nVirtual implementation; unsupported native options are omitted.\n sh long val neg\n");
|
|
1343
|
-
for (const [name, short] of Object.entries(zipLongOptions)) {
|
|
1344
|
-
const value = ["i", "x"].includes(short) ? "list" : ["s", "P", "n", "Z", "t", "tt", "O", "ds", "b", "lf", "TT"].includes(short) ? "req" : "";
|
|
1345
|
-
await budget.output(` ${(short === "version" ? "" : short).padEnd(3)} ${name.padEnd(20)} ${value.padEnd(4)} ${zipNegatableOptions.has(short) ? "neg" : ""}\n`);
|
|
1346
|
-
}
|
|
1347
|
-
}
|
|
1348
|
-
else
|
|
1349
|
-
await budget.output(parsed.information === "more-help" ? zipExtendedHelp : parsed.information === "version" ? zipVersion : parsed.information === "license" ? zipLicense : zipHelp);
|
|
1350
|
-
return { exitCode: 0 };
|
|
1351
|
-
}
|
|
1352
|
-
if (parsed.logPath !== undefined) {
|
|
1353
|
-
log = new ZipLog(scope, parsed.logInfo);
|
|
1354
|
-
await log.open(parsed.logPath, parsed.logAppend, [parsed.archive, parsed.output, ...(parsed.action === "copy" || parsed.action === "delete" ? [] : parsed.operands)].filter((path) => path !== undefined));
|
|
1355
|
-
}
|
|
1356
|
-
const quietDisplay = parsed.quiet;
|
|
1357
|
-
if (log && quietDisplay)
|
|
1358
|
-
parsed = { ...parsed, quiet: false };
|
|
1359
|
-
const progressContext = log ? { ...context, stdout: log.sink(context.stdout, quietDisplay), stderr: log.sink(context.stderr, quietDisplay) } : context;
|
|
1360
|
-
budget = new Budget(parsed.archive === "-" ? { ...progressContext, stdout: log ? log.sink(context.stderr, quietDisplay) : context.stderr } : progressContext, limits);
|
|
1361
|
-
if (parsed.encrypt) {
|
|
1362
|
-
if (parsed.password === undefined)
|
|
1363
|
-
parsed.password = await scope.operation(() => readZipPassword(options.zipHost, limits.maxArgumentBytes, context.signal, true));
|
|
1364
|
-
if (log)
|
|
1365
|
-
log.password = parsed.password;
|
|
1366
|
-
parsed.encryption = { ...(parsed.aes ? { aes: parsed.aes } : {}), password: parsed.password, entropy: (length, signal) => scope.operation(() => {
|
|
1367
|
-
if (!options.zipHost?.entropy)
|
|
1368
|
-
throw new ZipHostFailure("entropy");
|
|
1369
|
-
return options.zipHost.entropy(length, signal);
|
|
1370
|
-
}) };
|
|
1371
|
-
}
|
|
1372
|
-
if (parsed.debug)
|
|
1373
|
-
await budget.output("sd: Command line read\nsd: Reading virtual archive and selecting files\n");
|
|
1374
|
-
if (parsed.split && parsed.splitPause && !options.zipHost?.volumePrompt)
|
|
1375
|
-
throw new ZipFailure(16, "Invalid command arguments", "split pause requires an explicit volume prompt capability");
|
|
1376
|
-
const prepared = await prepare(scope, parsed, budget, log, options.zipHost);
|
|
1377
|
-
if (!prepared)
|
|
1378
|
-
return { exitCode: 12 };
|
|
1379
|
-
if (prepared.kind === "current") {
|
|
1380
|
-
await removeZipSources(scope, prepared.moves, budget, parsed.quiet);
|
|
1381
|
-
return { exitCode: prepared.exitCode };
|
|
1382
|
-
}
|
|
1383
|
-
if (parsed.debug)
|
|
1384
|
-
await budget.output("sd: Writing virtual archive\n");
|
|
1385
|
-
let globalBytes = 0;
|
|
1386
|
-
const dots = async (size) => {
|
|
1387
|
-
if (!parsed.globalDots || !parsed.dotSize)
|
|
1388
|
-
return;
|
|
1389
|
-
if (!globalBytes)
|
|
1390
|
-
await budget.output(" ");
|
|
1391
|
-
const count = Math.floor((globalBytes + size) / parsed.dotSize) - Math.floor(globalBytes / parsed.dotSize);
|
|
1392
|
-
globalBytes += size;
|
|
1393
|
-
for (let index = 0; index < count; index++)
|
|
1394
|
-
await budget.output(".");
|
|
1395
|
-
};
|
|
1396
|
-
if (prepared.kind === "file") {
|
|
1397
|
-
const publication = prepared.publication;
|
|
1398
|
-
if (!publication)
|
|
1399
|
-
fail("ZIP missing file publication");
|
|
1400
|
-
await dots(prepared.bytes.length);
|
|
1401
|
-
const split = parsed.split ?? prepared.inputSplit;
|
|
1402
|
-
if (split) {
|
|
1403
|
-
if (parsed.splitPause && !options.zipHost?.volumePrompt)
|
|
1404
|
-
throw new ZipFailure(16, "Invalid command arguments", "split pause requires an explicit volume prompt capability");
|
|
1405
|
-
const parts = await splitZipVolumes(prepared.bytes, split, limits, context.signal);
|
|
1406
|
-
await log?.protect(parts.map((_, disk) => volumeName(publication.output, disk, parts.length)));
|
|
1407
|
-
await log?.start();
|
|
1408
|
-
if (prepared.testRequired) {
|
|
1409
|
-
await scope.operation(() => stageZip(scope, { ...publication, bytes: prepared.bytes, reservedPath: publication.output }, staging => testZipCommand(scope, parsed.testCommand, staging.file.path, budget, parsed.archive, parsed.quiet, parsed.password)));
|
|
1410
|
-
}
|
|
1411
|
-
await scope.operation(() => publishZipVolumes(scope, publication, parts, prepared.inputPaths, async (path, disk) => {
|
|
1412
|
-
if (parsed.splitVerbose)
|
|
1413
|
-
await budget.output(`split ${disk + 1}/${parts.length}: ${zipPublicText(path)} (${parts[disk].length} bytes)\n`);
|
|
1414
|
-
if (disk && parsed.splitPause) {
|
|
1415
|
-
if (parsed.splitBell)
|
|
1416
|
-
await budget.output("\u0007");
|
|
1417
|
-
if (!await scope.operation(() => options.zipHost.volumePrompt({ path, disk, disks: parts.length, signal: context.signal })))
|
|
1418
|
-
fail("ZIP split volume prompt cancelled");
|
|
1419
|
-
}
|
|
1420
|
-
}));
|
|
1421
|
-
}
|
|
1422
|
-
else
|
|
1423
|
-
await writeFileOutput(context, prepared.bytes, () => scope.operation(() => publishZip(scope, { ...publication, bytes: prepared.bytes, ...(prepared.testRequired ? { validate: (path) => testZipCommand(scope, parsed.testCommand, path, budget, parsed.archive, parsed.quiet, parsed.password) } : {}) })));
|
|
1424
|
-
for (const message of prepared.progress)
|
|
1425
|
-
await budget.output(message);
|
|
1426
|
-
}
|
|
1427
|
-
else if (prepared.kind === "staged-stream") {
|
|
1428
|
-
const source = (async function* () {
|
|
1429
|
-
for await (const chunk of streamZipArchive(prepared.archive, limits, context.signal, true, parsed.zip64 === true, parsed.zip64 !== false)) {
|
|
1430
|
-
yield chunk;
|
|
1431
|
-
try {
|
|
1432
|
-
await dots(chunk.length);
|
|
1433
|
-
}
|
|
1434
|
-
catch (error) {
|
|
1435
|
-
void scope.closeInputs().catch(() => { });
|
|
1436
|
-
throw error;
|
|
1437
|
-
}
|
|
1438
|
-
}
|
|
1439
|
-
prepared.finishProgress();
|
|
1440
|
-
})();
|
|
1441
|
-
await scope.operation(() => publishZip(scope, { ...prepared.publication, source }));
|
|
1442
|
-
prepared.finishProgress();
|
|
1443
|
-
for (const message of prepared.progress)
|
|
1444
|
-
await budget.output(message);
|
|
1445
|
-
}
|
|
1446
|
-
else {
|
|
1447
|
-
const output = createOutputOperation(context, context.stdout);
|
|
1448
|
-
try {
|
|
1449
|
-
const source = streamZipArchive(prepared.archive, limits, output.signal, !prepared.temporary || parsed.descriptors, parsed.zip64 === true, parsed.zip64 !== false);
|
|
1450
|
-
const emit = async (input) => {
|
|
1451
|
-
for await (const chunk of input) {
|
|
1452
|
-
try {
|
|
1453
|
-
await writeBytes(output.output, chunk, output.signal);
|
|
1454
|
-
await dots(chunk.length);
|
|
1455
|
-
}
|
|
1456
|
-
catch (error) {
|
|
1457
|
-
void scope.closeInputs().catch(() => { });
|
|
1458
|
-
throw error;
|
|
1459
|
-
}
|
|
1460
|
-
}
|
|
1461
|
-
};
|
|
1462
|
-
if (prepared.temporary) {
|
|
1463
|
-
const temporary = prepared.temporary;
|
|
1464
|
-
await scope.operation(() => stageZip(scope, { ...temporary, source }, async (staging) => {
|
|
1465
|
-
const current = await scope.operation(() => context.fs.realpath(temporary.name, { signal: context.signal }));
|
|
1466
|
-
if (current !== temporary.parent)
|
|
1467
|
-
fail("ZIP temporary path changed before output");
|
|
1468
|
-
await emit(scope.input(staging.file.path));
|
|
1469
|
-
}));
|
|
1470
|
-
}
|
|
1471
|
-
else
|
|
1472
|
-
await emit(source);
|
|
1473
|
-
}
|
|
1474
|
-
finally {
|
|
1475
|
-
await output.close();
|
|
1476
|
-
}
|
|
1477
|
-
prepared.finishProgress();
|
|
1478
|
-
for (const message of prepared.progress)
|
|
1479
|
-
await budget.output(message);
|
|
1480
|
-
}
|
|
1481
|
-
if (parsed.globalDots)
|
|
1482
|
-
await budget.output("\n");
|
|
1483
|
-
if (parsed.debug)
|
|
1484
|
-
await budget.output("sd: Virtual archive complete\n");
|
|
1485
|
-
await removeZipSources(scope, prepared.moves, budget, parsed.quiet);
|
|
1486
|
-
return { exitCode: prepared.kind === "file" || prepared.kind === "staged-stream" ? prepared.exitCode : 0 };
|
|
1487
|
-
}
|
|
1488
|
-
catch (error) {
|
|
1489
|
-
original.signal.throwIfAborted();
|
|
1490
|
-
context.signal.throwIfAborted();
|
|
1491
|
-
// Incomplete selection has not proved the log is disjoint from sources.
|
|
1492
|
-
// Report to the screen rather than mutating an unvisited source file.
|
|
1493
|
-
if (log && !log.started)
|
|
1494
|
-
log.failed = true;
|
|
1495
|
-
if (error instanceof ZipHostFailure && (error.code === "password-empty" || error.code === "password-confirm")) {
|
|
1496
|
-
await budget.output(`\nzip error: Invalid command arguments (${error.message})\n`);
|
|
1497
|
-
return { exitCode: 16 };
|
|
1498
|
-
}
|
|
1499
|
-
if (error instanceof ZipFailure) {
|
|
1500
|
-
const diagnostic = `\nzip error: ${error.label} (${zipPublicText(error.message)})\n`;
|
|
1501
|
-
if (log?.failed)
|
|
1502
|
-
await writeBytes(context.stderr, encodeBytes(diagnostic).subarray(0, limits.maxDiagnosticBytes), context.signal);
|
|
1503
|
-
else
|
|
1504
|
-
await budget.output(diagnostic);
|
|
1505
|
-
return { exitCode: error.status };
|
|
1506
|
-
}
|
|
1507
|
-
if (log?.failed)
|
|
1508
|
-
budget = new Budget(context, limits);
|
|
1509
|
-
const detail = display(publicDiagnosticMessage(error, context.onInternalError).slice(0, 1024));
|
|
1510
|
-
const message = escapeText(error instanceof ZipHostFailure ? detail : zipPublicText(detail), "diagnostic");
|
|
1511
|
-
await writeBytes(log && !log.failed ? log.sink(context.stderr) : context.stderr, encodeBytes(`zip: ${message}\n`).subarray(0, limits.maxDiagnosticBytes), context.signal);
|
|
1512
|
-
return { exitCode: 2 };
|
|
1513
|
-
}
|
|
1514
|
-
finally {
|
|
1515
|
-
try {
|
|
1516
|
-
await scope.close();
|
|
1517
|
-
}
|
|
1518
|
-
finally {
|
|
1519
|
-
original.signal.throwIfAborted();
|
|
1520
|
-
}
|
|
1521
|
-
}
|
|
1522
|
-
} };
|
|
1523
|
-
}
|
|
1
|
+
export * from "../../../safe-bash-command-zip/zip.js";
|
|
1524
2
|
//# sourceMappingURL=zip.js.map
|