@poe-platform/safe-bash 0.1.799 → 0.1.801
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 +48 -22
- package/dist/image-ast/index.browser.js +1503 -98
- package/dist/image-ast/index.js +1503 -98
- 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 +5 -4
- package/dist/safe-bash/chunks/{chunk-LUOFIVNI.js → chunk-3NDIFSNM.js} +3 -3
- package/dist/safe-bash/chunks/chunk-3R3AANOR.js +26 -0
- package/dist/safe-bash/chunks/{chunk-TRVGCN3U.js → chunk-45PK3NWI.js} +4 -4
- package/dist/safe-bash/chunks/{chunk-KHMGTPD6.js → chunk-46Z5E5EV.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-XB3B7KMM.js → chunk-6O77NL2S.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-T3JTVIEP.js → chunk-6PAVEFT3.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-PYVEAFJM.js → chunk-74GHTNJA.js} +3 -2
- package/dist/safe-bash/chunks/{chunk-LQHGH25W.js → chunk-7R5BDCG7.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-WUNK5NXJ.js → chunk-7VNF5BFF.js} +1140 -1660
- package/dist/safe-bash/chunks/{chunk-NHOXKQNE.js → chunk-A7XEHALN.js} +6 -6
- package/dist/safe-bash/chunks/{chunk-MHZ24KEI.js → chunk-AM5ESLPH.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-3L3T6LYV.js → chunk-AUSNDQTJ.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-YG5WAHK7.js → chunk-B7TAL7S5.js} +1 -3
- package/dist/safe-bash/chunks/{chunk-K7IQZE7D.js → chunk-C5OWC2TL.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-F3RV2F72.js → chunk-CHYGPFVM.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-M4CFCXHN.js → chunk-CS4MNM6I.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-H6JW3E4F.js → chunk-CTVWDACF.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-KTGR4U57.js → chunk-D3ANYGMC.js} +2 -3
- package/dist/safe-bash/chunks/{chunk-ENR3HB2B.js → chunk-E7OYNDGL.js} +1 -2
- package/dist/safe-bash/chunks/{chunk-SOZK5JVX.js → chunk-FBUCWVTE.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-NX2SQVON.js → chunk-FNDNHAGE.js} +46 -27
- package/dist/safe-bash/chunks/{chunk-KCVSVD65.js → chunk-I5HZ4FGE.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-KMH2DF3I.js → chunk-ICFDYV64.js} +7 -2
- package/dist/safe-bash/chunks/{chunk-T5KKDMYB.js → chunk-IVRQ4BXL.js} +7 -1
- package/dist/safe-bash/chunks/{chunk-KV7PKOHV.js → chunk-IWDICZVK.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-I4OAEOP6.js → chunk-J42RIHHJ.js} +1 -1
- package/dist/safe-bash/chunks/chunk-K6VCD7IY.js +106 -0
- package/dist/safe-bash/chunks/{chunk-63FXVDGF.js → chunk-LVOBFF4D.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-U5NUZPCC.js → chunk-MHMMRCYC.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-6HZYFL3H.js → chunk-NR3EM4LS.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-VYZTG3GV.js → chunk-NZQXYWA3.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-JSVX4VIA.js → chunk-OQRVVGR6.js} +3 -2
- package/dist/safe-bash/chunks/{chunk-B3DDEDH2.js → chunk-OV6IHKO6.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-SPYL72GN.js → chunk-PQRAK7HU.js} +1196 -5781
- package/dist/safe-bash/chunks/chunk-SZH7EJLD.js +9221 -0
- package/dist/safe-bash/chunks/{chunk-AKC46AF6.js → chunk-TFIBK2GI.js} +8 -41
- package/dist/safe-bash/chunks/{chunk-ZNAFMYIA.js → chunk-UE5KZDEK.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-QU3BVQ53.js → chunk-UTBUUFDM.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-6IBTC4YL.js → chunk-VQDD3G76.js} +93 -39
- package/dist/safe-bash/chunks/{chunk-IUTD5FH5.js → chunk-VTH3MLDU.js} +2 -7
- package/dist/safe-bash/chunks/{chunk-LLZCZ24K.js → chunk-XVOSKJE2.js} +1 -1
- package/dist/safe-bash/chunks/{csvkit-W2UEKH6P.js → csvkit-TACDU7FC.js} +3 -3
- package/dist/safe-bash/chunks/{ffmpeg-42CGASMV.js → ffmpeg-WTC3TEFI.js} +2 -2
- package/dist/safe-bash/chunks/{gh-26GYLH6D.js → gh-6WU6PXL4.js} +2 -2
- package/dist/safe-bash/chunks/{git-YREKMUVD.js → git-EFZIGJW4.js} +2 -2
- package/dist/safe-bash/chunks/{imagemagick-3YIX4XO2.js → imagemagick-EIEYGWPF.js} +2 -2
- package/dist/safe-bash/chunks/{implementation-E3YMKU3Z.js → implementation-MLFHUQ5M.js} +2 -2
- package/dist/safe-bash/chunks/mmdc-ROQJT5HQ.js +118 -0
- package/dist/safe-bash/chunks/{pdfimages-UE2UISP2.js → pdfimages-DW7LWXFI.js} +2 -2
- package/dist/safe-bash/chunks/{pdfinfo-RGARKLI5.js → pdfinfo-TIP6XLUQ.js} +4 -12
- package/dist/safe-bash/chunks/{pdftk-JY3WVCCC.js → pdftk-DMG22ITZ.js} +2 -2
- package/dist/safe-bash/chunks/{pdftoppm-GPD3BMPY.js → pdftoppm-WNDYR72T.js} +2 -2
- package/dist/safe-bash/chunks/{pdftotext-K7GQ2QJZ.js → pdftotext-5IPZ4NI7.js} +2 -2
- package/dist/safe-bash/chunks/{qpdf-F4U7WUSU.js → qpdf-TTX2DIUA.js} +2 -2
- package/dist/safe-bash/chunks/{sips-RWENS7X5.js → sips-XYS46JPJ.js} +2 -2
- package/dist/safe-bash/chunks/{soffice-IT6W2C5F.js → soffice-TU73E5KL.js} +2 -2
- package/dist/safe-bash/chunks/{wkhtmltopdf-JYNDAHIZ.js → wkhtmltopdf-FSZ2CHGE.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-QBGA56UH.js → chunk-2ELYGJDD.js} +7 -7
- 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-52PCQXD2.js → chunk-2NHI5F5S.js} +2 -1
- package/dist/safe-bash/command-chunks/{chunk-HDKVO47G.js → chunk-2SQEIUGJ.js} +3 -3
- package/dist/safe-bash/command-chunks/chunk-364TMWBT.js +946 -0
- package/dist/safe-bash/command-chunks/chunk-3E2OIS2J.js +7037 -0
- package/dist/safe-bash/command-chunks/chunk-3HHCU5YU.js +380 -0
- package/dist/safe-bash/command-chunks/{chunk-TF6OA2GK.js → chunk-3NV3HYT2.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-4B7Y7S6E.js +61 -0
- package/dist/safe-bash/command-chunks/{chunk-LLCXZKZ6.js → chunk-4BB2SWJ5.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-IEXHHNOF.js → chunk-4J5CZ2DP.js} +2 -7
- package/dist/safe-bash/command-chunks/{chunk-WDHI3S6Y.js → chunk-4OOUQTQO.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-4ZHMW6F5.js +104 -0
- package/dist/safe-bash/command-chunks/{chunk-YMONDXET.js → chunk-4ZQWGOZB.js} +2 -2
- package/dist/safe-bash/command-chunks/chunk-5BSTFCXG.js +553 -0
- package/dist/safe-bash/command-chunks/{chunk-MKQVQMXO.js → chunk-5LU4UCBR.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-5PWJG2UK.js +174 -0
- package/dist/safe-bash/command-chunks/chunk-5TBUOBDE.js +346 -0
- package/dist/safe-bash/command-chunks/{chunk-JMPP4TCW.js → chunk-5UBXNSFZ.js} +3 -2
- 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-3NG75MOB.js → chunk-67GQA75T.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-67QKREJK.js +347 -0
- package/dist/safe-bash/command-chunks/{chunk-L6SU4S26.js → chunk-6B7WQIKB.js} +0 -7
- package/dist/safe-bash/command-chunks/chunk-6BNTBWIK.js +327 -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-6KJ3LPI2.js +94 -0
- package/dist/safe-bash/command-chunks/{chunk-HLDTOR7M.js → chunk-6ZVI7LUY.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-X6NJC3IC.js → chunk-75OFBY5R.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-7K6JYKPJ.js +422 -0
- package/dist/safe-bash/command-chunks/chunk-7N2LI2KO.js +206 -0
- package/dist/safe-bash/command-chunks/{chunk-MRW5HD2D.js → chunk-7O3E4LPT.js} +4 -22
- package/dist/safe-bash/command-chunks/chunk-7U7EXOXX.js +1392 -0
- package/dist/safe-bash/command-chunks/{chunk-6CYTRQ24.js → chunk-7VTKQUA5.js} +20 -17
- package/dist/safe-bash/command-chunks/{chunk-BZPAWTUL.js → chunk-AEF5BA3D.js} +1 -1
- package/dist/safe-bash/command-chunks/{pptx-GBPNWNEP-7EQEVXV5.js → chunk-AI5JAXQF.js} +34820 -18029
- package/dist/safe-bash/command-chunks/{chunk-63R3FEZJ.js → chunk-AIV5BF5W.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-AYUTO323.js → chunk-AKJG2XD3.js} +2 -18
- package/dist/safe-bash/command-chunks/{chunk-J34TZVMW.js → chunk-ALDC4XP4.js} +0 -5
- package/dist/safe-bash/command-chunks/chunk-AMO3THU4.js +105 -0
- package/dist/safe-bash/command-chunks/chunk-ARBYOQUZ.js +65 -0
- 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-44AHAB5O.js → chunk-BDSMROQZ.js} +1 -4
- package/dist/safe-bash/command-chunks/chunk-BNOU5YQS.js +182 -0
- package/dist/safe-bash/command-chunks/{chunk-4ZALPDBV.js → chunk-BPE5INLI.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-OT4LZMLB.js → chunk-BR73BIOW.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-C5YYCQHW.js +1444 -0
- package/dist/safe-bash/command-chunks/chunk-C7I25AAL.js +25 -0
- package/dist/safe-bash/command-chunks/{chunk-4ONEXMD3.js → chunk-CAP7ZJSY.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-DWFLVJC6.js → chunk-CCRHMAU5.js} +2 -1
- package/dist/safe-bash/command-chunks/chunk-CQ5YGOGB.js +150 -0
- package/dist/safe-bash/command-chunks/{chunk-JCNNOMBV.js → chunk-CQTRW45K.js} +3 -2
- package/dist/safe-bash/command-chunks/{chunk-N2F74VRO.js → chunk-CZ7EN3JG.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-DB453IE6.js +122 -0
- package/dist/safe-bash/command-chunks/{chunk-KKG4BAFZ.js → chunk-DIEPXUM4.js} +6 -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-6BETHLXZ.js → chunk-DZCY63VJ.js} +13 -11
- package/dist/safe-bash/command-chunks/{chunk-QUENU6GM.js → chunk-E55UKBIE.js} +3 -3
- 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-HLGKIZ25.js → chunk-F6OYH562.js} +2 -0
- package/dist/safe-bash/command-chunks/{chunk-MC3VWLIZ.js → chunk-FDBUV4HJ.js} +28 -19
- package/dist/safe-bash/command-chunks/{chunk-7FKUC34S.js → chunk-FPVUD6TH.js} +6 -3
- package/dist/safe-bash/command-chunks/chunk-FXELCPFX.js +195 -0
- package/dist/safe-bash/command-chunks/chunk-FXOA7RBK.js +42 -0
- package/dist/safe-bash/command-chunks/{chunk-LPORMIZS.js → chunk-FZTK4MFI.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-K543PB3I.js → chunk-G66QUHIZ.js} +6 -35
- package/dist/safe-bash/command-chunks/chunk-GFQZCKO6.js +272 -0
- 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-GOB777HR.js +97 -0
- package/dist/safe-bash/command-chunks/chunk-GRBWW4SG.js +48 -0
- package/dist/safe-bash/command-chunks/{chunk-PPNBNFAU.js → chunk-GYQ2HAKQ.js} +8 -8
- package/dist/safe-bash/command-chunks/chunk-H622NS6Z.js +11 -0
- package/dist/safe-bash/command-chunks/{chunk-UI32HWGS.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-43GSSUAY.js → chunk-II77KPZN.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-ZS3QPNUL.js → chunk-IR2BY7EL.js} +21 -6
- package/dist/safe-bash/command-chunks/{chunk-SG424QWS.js → chunk-JDYXY44P.js} +2 -2
- package/dist/safe-bash/command-chunks/chunk-JNZ3CVAE.js +147 -0
- package/dist/safe-bash/command-chunks/{chunk-4QJOYXVB.js → chunk-JV7LBUTP.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-IKS2YXZQ.js → chunk-K67MWWWH.js} +3 -3
- 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-KMCZ6P4O.js → chunk-KQLD3AED.js} +68 -7
- package/dist/safe-bash/command-chunks/chunk-KWESKQHR.js +25 -0
- package/dist/safe-bash/command-chunks/{chunk-YZ5SVZFD.js → chunk-KXU3IRUO.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-C7IHMJEW.js → chunk-KZC5UWFF.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-2WRTLCGK.js → chunk-LAOM65EE.js} +5 -5
- package/dist/safe-bash/command-chunks/chunk-LE5LZNHE.js +204 -0
- package/dist/safe-bash/command-chunks/{chunk-HFII3QYO.js → chunk-LWS62ISU.js} +46 -32
- package/dist/safe-bash/command-chunks/{chunk-BZDDAPSV.js → chunk-LWSBAWLT.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-MDH5T4OS.js +41 -0
- package/dist/safe-bash/command-chunks/{chunk-X7TM3AKW.js → chunk-MIXBO6U7.js} +20 -7
- 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-HLBX5IRS.js → chunk-MQFIPHIQ.js} +46 -81
- package/dist/safe-bash/command-chunks/{chunk-ZJBR5Q5I.js → chunk-MSFXC3OC.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-NI7MKJPN.js → chunk-MTQH74CF.js} +3 -55
- package/dist/safe-bash/command-chunks/chunk-MWUZZWXK.js +354 -0
- package/dist/safe-bash/command-chunks/chunk-N4PFUSRM.js +35 -0
- 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-I3K5RYU4.js → chunk-NKFYQSES.js} +73 -26
- package/dist/safe-bash/command-chunks/{chunk-KVFCSLKK.js → chunk-NXEQ3ESQ.js} +6 -0
- package/dist/safe-bash/command-chunks/{chunk-NGWB2YBL.js → chunk-O4JQSB7O.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-7L24L4UO.js → chunk-OQU6UT6X.js} +2 -20
- package/dist/safe-bash/command-chunks/{chunk-3VGGYEDH.js → chunk-ORYGZYKW.js} +4 -3
- package/dist/safe-bash/command-chunks/{chunk-ZXKW7SJ2.js → chunk-OYYV7ZAF.js} +2 -2
- package/dist/safe-bash/command-chunks/chunk-P2N33UMN.js +270 -0
- package/dist/safe-bash/command-chunks/{chunk-Q7Q5GM5S.js → chunk-P5APDEFB.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-X2YQLGKS.js → chunk-PCEFOYA3.js} +240 -148
- package/dist/safe-bash/command-chunks/{chunk-OLQG7ZCN.js → chunk-PEF7K3UQ.js} +136 -75
- package/dist/safe-bash/command-chunks/chunk-PII4YEZW.js +123 -0
- package/dist/safe-bash/command-chunks/{chunk-AIRGA2SU.js → chunk-PMBFZXTK.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-ZT4KSS2V.js → chunk-PTT3I223.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-4Y3WVMK4.js → chunk-PV66YWHB.js} +1 -0
- package/dist/safe-bash/command-chunks/chunk-Q3EWDEUQ.js +185 -0
- package/dist/safe-bash/command-chunks/{chunk-AXK3H4PX.js → chunk-QJ33BHI4.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-QKFSRZGQ.js +1091 -0
- package/dist/safe-bash/command-chunks/{chunk-JZSNU2MY.js → chunk-QKJLP53H.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-VVI4Z73I.js → chunk-QP4R6GLA.js} +5 -1
- package/dist/safe-bash/command-chunks/chunk-RMWQAAO5.js +2488 -0
- package/dist/safe-bash/command-chunks/{chunk-QDTBMSBE.js → chunk-RO62EWX6.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-HRLIAMXC.js → chunk-RZZI24ZE.js} +7 -6
- package/dist/safe-bash/command-chunks/{chunk-PFAADCB5.js → chunk-SDNBCQ3X.js} +10 -24
- package/dist/safe-bash/command-chunks/chunk-SEM36PG5.js +11 -0
- package/dist/safe-bash/command-chunks/{chunk-36O5OT7E.js → chunk-T35Y7YQD.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-ESMCX3YV.js → chunk-TGSNCQSR.js} +710 -143
- package/dist/safe-bash/command-chunks/chunk-TIOCQVUQ.js +557 -0
- package/dist/safe-bash/command-chunks/{chunk-T5H5UJQ3.js → chunk-TNOA7FCQ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-GN2TKLE7.js → chunk-TS65BJHG.js} +5 -5
- package/dist/safe-bash/command-chunks/chunk-TSCGT46G.js +363 -0
- package/dist/safe-bash/command-chunks/chunk-UG7SMZFF.js +178 -0
- package/dist/safe-bash/command-chunks/{chunk-KBEURXFF.js → chunk-UN6WS55J.js} +3 -3
- package/dist/safe-bash/command-chunks/chunk-UXSR5BZH.js +136 -0
- package/dist/safe-bash/command-chunks/{chunk-SX2X3IH4.js → chunk-V2V5OCL3.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-V6BEDRMQ.js +112 -0
- package/dist/safe-bash/command-chunks/chunk-V7A7DRTU.js +293 -0
- package/dist/safe-bash/command-chunks/{chunk-5SHGJ7NO.js → chunk-VA5ZHYYA.js} +73 -33
- package/dist/safe-bash/command-chunks/{chunk-J4PEQWSF.js → chunk-VGG2DL5Q.js} +0 -1
- package/dist/safe-bash/command-chunks/chunk-VPR5LQYX.js +1228 -0
- package/dist/safe-bash/command-chunks/{chunk-EIVW3X3N.js → chunk-VSRGNQCP.js} +11 -6
- package/dist/safe-bash/command-chunks/{chunk-TYVCKQDH.js → chunk-VXSLJH7G.js} +56 -6
- package/dist/safe-bash/command-chunks/{chunk-PXYOWWMV.js → chunk-W7RAD4EW.js} +4 -3
- package/dist/safe-bash/command-chunks/{src-UJOWAS2S.js → chunk-WD3ERGRY.js} +77 -277
- package/dist/safe-bash/command-chunks/{chunk-5ZSM4UFN.js → chunk-WECIOOQB.js} +8 -64
- 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-HHP343KT.js → chunk-WTECBRU4.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-AO6Z5EQ7.js → chunk-WVE64WM2.js} +6 -5
- package/dist/safe-bash/command-chunks/chunk-WVHONVZ4.js +594 -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-XNLFHHOC.js +63 -0
- package/dist/safe-bash/command-chunks/{chunk-XAFSZDY2.js → chunk-XS72HTMA.js} +11 -0
- package/dist/safe-bash/command-chunks/chunk-Y5INTD6S.js +220 -0
- package/dist/safe-bash/command-chunks/chunk-YIQACGEW.js +43 -0
- package/dist/safe-bash/command-chunks/chunk-YOF7R4OY.js +80 -0
- package/dist/safe-bash/command-chunks/{chunk-VZHRZMS7.js → chunk-YOFC45RK.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-2FUAW6GO.js → chunk-Z45N42QC.js} +75 -11
- package/dist/safe-bash/command-chunks/chunk-ZHUWOUWB.js +618 -0
- package/dist/safe-bash/command-chunks/{chunk-OPUJSTHS.js → chunk-ZYHTWNAE.js} +215 -67
- package/dist/safe-bash/command-chunks/chunk-ZYXH3B66.js +636 -0
- 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 +4 -2
- package/dist/safe-bash/commands/copy-preserve.d.ts +1 -0
- package/dist/safe-bash/commands/csplit/index.browser.js +2 -2
- 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 -53
- package/dist/safe-bash/commands/diff-patch/shared.js +1 -267
- 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/docx/index.browser.js +1 -1
- package/dist/safe-bash/commands/execution.js +19 -13
- package/dist/safe-bash/commands/factor/index.browser.js +2 -2
- package/dist/safe-bash/commands/filesystem.d.ts +1 -1
- package/dist/safe-bash/commands/filesystem.js +17 -13
- 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/getopt/index.browser.js +2 -2
- 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/hexdump/index.browser.js +2 -2
- package/dist/safe-bash/commands/htmlq/index.d.ts +1 -1
- package/dist/safe-bash/commands/iconv/index.browser.js +2 -2
- package/dist/safe-bash/commands/line-endings/index.browser.js +2 -2
- 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 +4 -2
- package/dist/safe-bash/commands/llm/providers/index.browser.js +1 -1
- package/dist/safe-bash/commands/mdq/index.browser.js +3 -3
- package/dist/safe-bash/commands/media/index.browser.js +1 -1
- 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 -695
- 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 +4 -12
- 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/platform-portable.d.ts +1 -5
- package/dist/safe-bash/commands/network/platform-portable.js +1 -26
- 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/public.d.ts +2 -2
- package/dist/safe-bash/commands/network/public.js +2 -2
- 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/transport.js +2 -2
- 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 +9 -332
- package/dist/safe-bash/commands/node/filesystem.js +3 -2
- package/dist/safe-bash/commands/node/index.browser.js +8 -9
- 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/types.js +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 +3 -3
- 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/pr/index.browser.js +2 -2
- package/dist/safe-bash/commands/predicates.js +3 -4
- package/dist/safe-bash/commands/python/host-capabilities.js +31 -14
- package/dist/safe-bash/commands/python/index.browser.js +11 -11
- 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 +2 -0
- package/dist/safe-bash/commands/python/manifest.js +13 -6
- package/dist/safe-bash/commands/python/provisioning.js +1 -1
- package/dist/safe-bash/commands/python/shell-capability.d.ts +1 -0
- package/dist/safe-bash/commands/python/shell-capability.js +3 -2
- package/dist/safe-bash/commands/python/worker.browser.js +3 -3
- package/dist/safe-bash/commands/regex-execution/matching.js +1 -2
- package/dist/safe-bash/commands/regex-execution/public.browser.js +8 -8
- package/dist/safe-bash/commands/safejs/runtime.js +16 -7
- 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/standard.d.ts +1 -0
- package/dist/safe-bash/commands/standard.js +2 -1
- package/dist/safe-bash/commands/streams.js +6 -24
- 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 +268 -364
- package/dist/safe-bash/commands/tsort/index.browser.js +2 -2
- 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/xml/index.browser.js +2 -2
- package/dist/safe-bash/commands/yq/index.browser.js +8 -3
- 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 +2 -2
- package/dist/safe-bash/core.d.ts +14 -2
- package/dist/safe-bash/core.js +8 -2
- 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 +321 -286
- package/dist/safe-bash/jobs.browser.js +5 -5
- 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 +2 -0
- 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 +17 -0
- package/dist/safe-bash/opt-in/optional/commands/shuf/options.d.ts +1 -0
- package/dist/safe-bash/opt-in/optional/commands/shuf/options.js +2 -4
- package/dist/safe-bash/opt-in/optional/commands/shuf/shuf.js +2 -1
- package/dist/safe-bash/optional-host.browser.js +15 -11
- 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/composition.d.ts +1 -0
- package/dist/safe-bash/plugins/composition.js +3 -8
- package/dist/safe-bash/plugins/index.browser.js +27 -29
- package/dist/safe-bash/registry-entry.browser.js +28 -30
- package/dist/safe-bash/shell/arrays/bindings.d.ts +3 -5
- package/dist/safe-bash/shell/arrays/bindings.js +7 -3
- package/dist/safe-bash/shell/arrays/state.js +4 -0
- package/dist/safe-bash/shell/brace-expansion.js +1 -1
- package/dist/safe-bash/shell/dynamic-variables.d.ts +10 -0
- package/dist/safe-bash/shell/dynamic-variables.js +25 -0
- package/dist/safe-bash/shell/input.js +16 -14
- package/dist/safe-bash/shell/parser.js +8 -1
- package/dist/safe-bash/shell/runtime.d.ts +7 -4
- package/dist/safe-bash/shell/runtime.js +604 -802
- package/dist/safe-bash/shell/shell.js +2 -31
- 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 +25 -27
- 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/yq-browser/index.js +1 -1
- package/dist/safe-bash-base-encoding-engine/base.js +2 -2
- package/dist/safe-bash-base-encoding-engine/shared.js +1 -1
- package/dist/safe-bash-byte-input-engine/index.d.ts +3 -2
- package/dist/safe-bash-byte-input-engine/index.js +4 -1
- package/dist/safe-bash-checksum-engine/index.js +13 -6
- package/dist/safe-bash-command-apply-patch/apply.d.ts +1 -1
- package/dist/safe-bash-command-apply-patch/apply.js +4 -3
- package/dist/safe-bash-command-apply-patch/index.js +4 -4
- package/dist/safe-bash-command-apply-patch/matcher.js +1 -1
- package/dist/safe-bash-command-apply-patch/parser.js +1 -1
- 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 +6 -0
- package/dist/safe-bash-command-bc/index.js +136 -266
- package/dist/safe-bash-command-column/column.js +5 -5
- package/dist/safe-bash-command-column/display.d.ts +1 -1
- package/dist/safe-bash-command-column/display.js +1 -1
- package/dist/safe-bash-command-column/index.js +5 -5
- package/dist/safe-bash-command-column/internal.d.ts +0 -2
- package/dist/safe-bash-command-column/internal.js +1 -1
- package/dist/safe-bash-command-column/layout.js +4 -4
- package/dist/safe-bash-command-column/table.js +2 -2
- package/dist/safe-bash-command-comm/comm.js +1 -1
- package/dist/safe-bash-command-comm/index.js +1 -1
- 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-csvcut/index.d.ts +1 -0
- package/dist/safe-bash-command-csvcut/index.js +1 -0
- package/dist/safe-bash-command-csvgrep/index.d.ts +1 -0
- package/dist/safe-bash-command-csvgrep/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 +180 -12
- 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-csvkit/sync-support.js +1 -1
- 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 +2 -0
- 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-exiftool/index.d.ts +1 -0
- 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-fd/index.js +9 -9
- package/dist/safe-bash-command-ffmpeg/index.js +117 -102
- package/dist/safe-bash-command-file/index.js +4 -4
- 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 +7 -4
- 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 +95 -0
- package/dist/safe-bash-command-hexdump/command.js +4 -4
- package/dist/safe-bash-command-hexdump/custom.d.ts +24 -0
- package/dist/safe-bash-command-hexdump/index.js +4 -4
- package/dist/safe-bash-command-hexdump/internal.d.ts +2 -0
- package/dist/safe-bash-command-hexdump/internal.js +1 -1
- package/dist/safe-bash-command-hexdump/io.js +2 -2
- package/dist/safe-bash-command-hexdump/options.d.ts +3 -0
- package/dist/safe-bash-command-hexdump/options.js +2 -2
- package/dist/safe-bash-command-hostname/index.js +1 -1
- 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.d.ts +1 -0
- 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.d.ts +1 -0
- package/dist/safe-bash-command-htmlq/index.js +39 -17
- package/dist/safe-bash-command-iconv/codec.js +1 -1
- package/dist/safe-bash-command-iconv/command.js +2 -2
- package/dist/safe-bash-command-iconv/index.js +2 -2
- package/dist/safe-bash-command-imagemagick/index.js +45 -35
- package/dist/safe-bash-command-join/index.js +1 -1
- package/dist/safe-bash-command-join/join.js +1 -1
- 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-less/index.js +43 -28
- 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.d.ts +1 -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 +0 -11
- package/dist/safe-bash-command-od/index.js +101 -68
- 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-paste/index.js +1 -1
- package/dist/safe-bash-command-paste/paste.js +1 -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-pathchk/index.js +3 -13
- package/dist/safe-bash-command-pdfimages/index.js +62 -25
- package/dist/safe-bash-command-pdfinfo/index.d.ts +0 -23
- package/dist/safe-bash-command-pdfinfo/index.js +39 -782
- package/dist/safe-bash-command-pdftk/index.js +40 -12
- package/dist/safe-bash-command-pdftoppm/index.js +76 -30
- package/dist/safe-bash-command-pdftotext/index.js +37 -15
- 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 +2 -2
- package/dist/safe-bash-command-pr/index.js +4 -4
- package/dist/safe-bash-command-qpdf/index.js +31 -18
- 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/options.d.ts +1 -0
- package/dist/safe-bash-command-shuf/options.js +2 -4
- package/dist/safe-bash-command-shuf/shuf.js +2 -1
- package/dist/safe-bash-command-sips/index.js +111 -35
- package/dist/safe-bash-command-soffice/index.js +21 -17
- package/dist/safe-bash-command-split/index.js +3 -3
- 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/btree.d.ts +1 -0
- package/dist/safe-bash-command-sqlite3/engine.d.ts +7 -2
- package/dist/safe-bash-command-sqlite3/index.js +436 -537
- package/dist/safe-bash-command-ssconvert/commands.js +9 -9
- package/dist/safe-bash-command-ssconvert/core.js +8 -8
- package/dist/safe-bash-command-ssconvert/formats/csv.js +9 -9
- package/dist/safe-bash-command-ssconvert/formats/ods.js +9 -9
- package/dist/safe-bash-command-ssconvert/formats/spreadsheetml.js +2 -2
- package/dist/safe-bash-command-ssconvert/formats/xls.js +9 -9
- package/dist/safe-bash-command-ssconvert/formats/xlsx.js +9 -9
- package/dist/safe-bash-command-ssconvert/index.js +21 -21
- 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 +551 -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.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-unrtf/index.js +14 -7
- 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 +6 -3
- package/dist/safe-bash-command-xan/csv.d.ts +1 -1
- package/dist/safe-bash-command-xan/csv.js +1 -1
- package/dist/safe-bash-command-xan/index.js +18 -17
- package/dist/safe-bash-command-xan/io.js +3 -3
- package/dist/safe-bash-command-xmllint/index.js +190 -50
- package/dist/safe-bash-command-xxd/index.js +105 -91
- package/dist/safe-bash-command-xz/command.d.ts +2 -0
- package/dist/safe-bash-command-xz/index.d.ts +1 -1
- package/dist/safe-bash-command-xz/index.js +11 -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 +17 -0
- 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 +12 -12
- 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.d.ts +1 -0
- package/dist/safe-bash-contracts/index.js +39 -35
- package/dist/safe-bash-contracts/io.d.ts +4 -1
- package/dist/safe-bash-contracts/io.js +4 -2
- package/dist/safe-bash-contracts/managed-abort.d.ts +10 -0
- 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 +54 -0
- package/dist/safe-bash-diff-engine/shared.js +19 -0
- package/dist/safe-bash-io-engine/commands/archive/internal.js +5 -23
- 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/search/requirements.js +2 -2
- package/dist/safe-bash-io-engine/commands/text-programs/shared.js +44 -66
- package/dist/safe-bash-io-engine/internal.js +1 -1
- package/dist/safe-bash-io-engine/shell/pattern.js +8 -13
- package/dist/safe-bash-io-engine/shell/string-operations.js +1 -1
- 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 +161 -35
- package/dist/safe-bash-mcp/index.browser.js +417 -0
- package/dist/safe-bash-mcp/index.d.ts +66 -2
- package/dist/safe-bash-mcp/index.js +1838 -122
- 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 +80 -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 +42 -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/matcher.js +106 -34
- package/dist/safe-bash-regex-engine/execution/bounded-provider.js +55 -67
- package/dist/safe-bash-regex-engine/execution/portable.d.ts +0 -1
- package/dist/safe-bash-regex-engine/execution/portable.js +6 -10
- package/dist/safe-bash-regex-engine/execution/protocol.d.ts +0 -5
- package/dist/safe-bash-regex-engine/execution/protocol.js +1 -3
- package/dist/safe-bash-regex-engine/index.js +6 -4
- package/dist/safe-bash-regex-engine/text/budget.d.ts +1 -0
- package/dist/safe-bash-regex-engine/text/budget.js +1 -1
- package/dist/safe-bash-regex-engine/text/regex.d.ts +15 -0
- package/dist/safe-bash-regex-engine/text/regex.js +6 -4
- package/dist/safe-bash-regex-engine/text/replacement-buffer.js +2 -2
- package/dist/safe-bash-regex-engine/text/rust-syntax.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 +191 -229
- 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-table-text-engine/table-text/internal.d.ts +7 -5
- package/dist/safe-bash-table-text-engine/table-text/internal.js +39 -21
- 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 -0
- 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 +8 -4
- 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/codecs/odf-hyperlinks.js +8 -2
- package/dist/spreadsheet-engine/formulas/functions/captured-bessel-phase.js +2 -2
- package/dist/spreadsheet-engine/formulas/label-references.js +54 -33
- package/dist/spreadsheet-engine/formulas/parser.js +3 -1
- package/dist/spreadsheet-engine/formulas/rewriting.js +13 -3
- package/dist/spreadsheet-engine/io/publication.d.ts +1 -0
- package/dist/spreadsheet-format-xls/biff-data-tables.js +4 -6
- package/dist/spreadsheet-format-xls/biff-formulas.js +3 -0
- package/dist/spreadsheet-format-xls/biff-label-ranges.js +9 -6
- package/dist/spreadsheet-format-xls/biff.js +1 -1
- package/dist/xlsx-ast/xlsx.js +8 -5
- package/package.json +165 -15
- package/dist/safe-bash/chunks/chunk-AZAJJVFX.js +0 -23017
- 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-ZW6K2J7P.js +0 -2652
- package/dist/safe-bash/command-chunks/chunk-5MPOQ6V3.js +0 -181
- 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-KAGBORIC.js +0 -88
- package/dist/safe-bash/command-chunks/chunk-NETECMOF.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/command-chunks/{chunk-FIUFIDAO.js → chunk-2JRBIDAD.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-BWNXWI33.js → chunk-2LMZVE3I.js} +0 -0
- package/dist/safe-bash/command-chunks/{chunk-B5BKA5WH.js → chunk-B5TAOCKD.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-DDLQ5YDB.js → chunk-YHFXOX6U.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-DQMOM72Z.js → chunk-ZRRBXU3M.js} +4 -4
|
@@ -0,0 +1,1444 @@
|
|
|
1
|
+
import {
|
|
2
|
+
parseSelection,
|
|
3
|
+
resolveSelection
|
|
4
|
+
} from "./chunk-LCF3OB7P.js";
|
|
5
|
+
import {
|
|
6
|
+
Writer
|
|
7
|
+
} from "./chunk-VM2ZMWHQ.js";
|
|
8
|
+
import {
|
|
9
|
+
observe,
|
|
10
|
+
outputOperation,
|
|
11
|
+
preflight,
|
|
12
|
+
publish
|
|
13
|
+
} from "./chunk-JDYXY44P.js";
|
|
14
|
+
import {
|
|
15
|
+
checkedAdd,
|
|
16
|
+
inferDelimiter,
|
|
17
|
+
unsigned
|
|
18
|
+
} from "./chunk-Z45N42QC.js";
|
|
19
|
+
import {
|
|
20
|
+
boundedSort
|
|
21
|
+
} from "./chunk-HEYKESED.js";
|
|
22
|
+
import {
|
|
23
|
+
Scanner
|
|
24
|
+
} from "./chunk-E55UKBIE.js";
|
|
25
|
+
import {
|
|
26
|
+
XanError
|
|
27
|
+
} from "./chunk-QOKBZFFD.js";
|
|
28
|
+
import {
|
|
29
|
+
init_buffer
|
|
30
|
+
} from "./chunk-HX3SHTCE.js";
|
|
31
|
+
|
|
32
|
+
// packages/safe-bash-command-xan/src/commands.ts
|
|
33
|
+
init_buffer();
|
|
34
|
+
|
|
35
|
+
// packages/safe-bash-command-xan/src/extended.ts
|
|
36
|
+
init_buffer();
|
|
37
|
+
import { resolvePath } from "../../safe-bash-contracts/path.js";
|
|
38
|
+
|
|
39
|
+
// packages/safe-bash-command-xan/src/cells.ts
|
|
40
|
+
init_buffer();
|
|
41
|
+
async function* emitted(bytes, budget) {
|
|
42
|
+
try {
|
|
43
|
+
yield bytes;
|
|
44
|
+
} finally {
|
|
45
|
+
budget.release(bytes.length);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async function* textRow(values, writer, budget) {
|
|
49
|
+
const owned = [];
|
|
50
|
+
budget.hold(values.length * 32);
|
|
51
|
+
try {
|
|
52
|
+
const cells = [];
|
|
53
|
+
for (const value of values) {
|
|
54
|
+
if (typeof value === "string") {
|
|
55
|
+
const bytes = await budget.encode(value);
|
|
56
|
+
owned.push(bytes);
|
|
57
|
+
cells.push(bytes);
|
|
58
|
+
} else cells.push(value);
|
|
59
|
+
}
|
|
60
|
+
yield* emitted(await writer.values(cells), budget);
|
|
61
|
+
} finally {
|
|
62
|
+
for (const bytes of owned) budget.release(bytes.length);
|
|
63
|
+
budget.release(values.length * 32);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async function compareBytes(left, right, budget) {
|
|
67
|
+
for (let i = 0; i < Math.min(left.length, right.length); i++) {
|
|
68
|
+
budget.work();
|
|
69
|
+
if (left[i] !== right[i]) return left[i] < right[i] ? -1 : 1;
|
|
70
|
+
if ((i & 1023) === 0) {
|
|
71
|
+
const c = budget.checkpoint();
|
|
72
|
+
if (c) await c;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return Math.sign(left.length - right.length);
|
|
76
|
+
}
|
|
77
|
+
function cellText(bytes, budget) {
|
|
78
|
+
budget.work(bytes.length);
|
|
79
|
+
try {
|
|
80
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
81
|
+
} catch {
|
|
82
|
+
throw new XanError("cell is not valid UTF-8");
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function decimalNumber(text, budget) {
|
|
86
|
+
let offset = text[0] === "+" || text[0] === "-" ? 1 : 0;
|
|
87
|
+
let digits = 0;
|
|
88
|
+
while (offset < text.length && text[offset] >= "0" && text[offset] <= "9") {
|
|
89
|
+
offset++;
|
|
90
|
+
digits++;
|
|
91
|
+
budget.work();
|
|
92
|
+
}
|
|
93
|
+
if (text[offset] === ".") {
|
|
94
|
+
offset++;
|
|
95
|
+
while (offset < text.length && text[offset] >= "0" && text[offset] <= "9") {
|
|
96
|
+
offset++;
|
|
97
|
+
digits++;
|
|
98
|
+
budget.work();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (!digits) return void 0;
|
|
102
|
+
if (text[offset] === "e" || text[offset] === "E") {
|
|
103
|
+
offset++;
|
|
104
|
+
if (text[offset] === "+" || text[offset] === "-") offset++;
|
|
105
|
+
const start = offset;
|
|
106
|
+
while (offset < text.length && text[offset] >= "0" && text[offset] <= "9") {
|
|
107
|
+
offset++;
|
|
108
|
+
budget.work();
|
|
109
|
+
}
|
|
110
|
+
if (offset === start) return void 0;
|
|
111
|
+
}
|
|
112
|
+
if (offset !== text.length) return void 0;
|
|
113
|
+
const value = Number(text);
|
|
114
|
+
return Number.isFinite(value) ? value : void 0;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// packages/safe-bash-command-xan/src/extended.ts
|
|
118
|
+
async function select(text, header, args, budget) {
|
|
119
|
+
budget.hold((header?.width ?? 0) * 32);
|
|
120
|
+
try {
|
|
121
|
+
return await resolveSelection(await parseSelection(text, budget), header?.cells.map((cell) => cell.decoded.view()) ?? [], args.noHeaders, budget);
|
|
122
|
+
} finally {
|
|
123
|
+
budget.release((header?.width ?? 0) * 32);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
async function key(row, selected, budget) {
|
|
127
|
+
const size = selected.reduce((n, i) => n + row.cells[i].decoded.length * 2 + 32, 0);
|
|
128
|
+
budget.hold(size);
|
|
129
|
+
let result = "";
|
|
130
|
+
for (const index of selected) {
|
|
131
|
+
const bytes = row.cells[index].decoded.view();
|
|
132
|
+
result += `${bytes.length}:`;
|
|
133
|
+
for (const byte of bytes) {
|
|
134
|
+
budget.work();
|
|
135
|
+
result += String.fromCharCode(byte);
|
|
136
|
+
const cp = budget.checkpoint();
|
|
137
|
+
if (cp) await cp;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return { identity: result, size };
|
|
141
|
+
}
|
|
142
|
+
async function aggregates(text, header, args, budget) {
|
|
143
|
+
const result = [];
|
|
144
|
+
let at = 0;
|
|
145
|
+
const whitespace2 = () => {
|
|
146
|
+
while (at < text.length && " \n\r ".includes(text[at])) at++;
|
|
147
|
+
};
|
|
148
|
+
while (at < text.length) {
|
|
149
|
+
whitespace2();
|
|
150
|
+
const begin = at;
|
|
151
|
+
while (at < text.length && text[at] !== "(") at++;
|
|
152
|
+
const name = text.slice(begin, at).trim().toLowerCase();
|
|
153
|
+
if (!["count", "sum", "mean", "avg", "min", "max", "first", "last"].includes(name) || at === text.length) throw new XanError("expected an aggregate call");
|
|
154
|
+
const start = ++at;
|
|
155
|
+
let quote = "";
|
|
156
|
+
while (at < text.length) {
|
|
157
|
+
const ch = text[at];
|
|
158
|
+
if (quote) {
|
|
159
|
+
if (ch === quote) quote = "";
|
|
160
|
+
} else if (ch === '"' || ch === "'") quote = ch;
|
|
161
|
+
else if (ch === ")") break;
|
|
162
|
+
at++;
|
|
163
|
+
}
|
|
164
|
+
if (at === text.length) throw new XanError("unterminated aggregate call");
|
|
165
|
+
const column = text.slice(start, at).trim();
|
|
166
|
+
at++;
|
|
167
|
+
let label = text.slice(begin, at).trim();
|
|
168
|
+
whitespace2();
|
|
169
|
+
if (text.slice(at, at + 2).toLowerCase() === "as" && " \n".includes(text[at + 2] ?? "")) {
|
|
170
|
+
at += 2;
|
|
171
|
+
whitespace2();
|
|
172
|
+
const quote2 = text[at] === '"' || text[at] === "'" ? text[at++] : void 0;
|
|
173
|
+
const start2 = at;
|
|
174
|
+
while (at < text.length && (quote2 ? text[at] !== quote2 : text[at] !== ",")) at++;
|
|
175
|
+
label = text.slice(start2, at).trim();
|
|
176
|
+
if (quote2) {
|
|
177
|
+
if (text[at++] !== quote2) throw new XanError("unterminated aggregate alias");
|
|
178
|
+
whitespace2();
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (at < text.length && text[at++] !== ",") throw new XanError("expected comma between aggregate calls");
|
|
182
|
+
let field;
|
|
183
|
+
if (column && column !== "*") {
|
|
184
|
+
const fields = await select(column, header, args, budget);
|
|
185
|
+
try {
|
|
186
|
+
if (fields.length !== 1) throw new XanError("aggregate requires one column");
|
|
187
|
+
field = fields[0];
|
|
188
|
+
} finally {
|
|
189
|
+
budget.release(fields.length * 8);
|
|
190
|
+
}
|
|
191
|
+
} else if (name !== "count") throw new XanError(`${name} requires a column`);
|
|
192
|
+
budget.hold(128 + label.length * 2);
|
|
193
|
+
result.push({ name, label, ...field === void 0 ? {} : { field } });
|
|
194
|
+
}
|
|
195
|
+
if (!result.length) throw new XanError("expected an aggregate call");
|
|
196
|
+
return result;
|
|
197
|
+
}
|
|
198
|
+
async function* extendedRows(args, scope, budget, writer) {
|
|
199
|
+
if (args.command === "from") {
|
|
200
|
+
yield* from(args, scope, budget, writer);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (args.command === "cat") {
|
|
204
|
+
yield* concatenate(args, scope, budget, writer);
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
const scanner = scope.open(args.inputs[0], args);
|
|
208
|
+
const header = await scanner.next();
|
|
209
|
+
if (header) scope.own(header.free);
|
|
210
|
+
const retained = [];
|
|
211
|
+
scope.own(() => {
|
|
212
|
+
for (const row of retained) row.free();
|
|
213
|
+
budget.release(retained.length * 32);
|
|
214
|
+
});
|
|
215
|
+
async function* rows2() {
|
|
216
|
+
let row = args.noHeaders ? header : await scanner.next();
|
|
217
|
+
try {
|
|
218
|
+
while (row) {
|
|
219
|
+
if (row.width !== header?.width) throw new XanError("CSV error: inconsistent field count");
|
|
220
|
+
yield row;
|
|
221
|
+
row = await scanner.next();
|
|
222
|
+
}
|
|
223
|
+
} finally {
|
|
224
|
+
row?.free();
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if (args.command === "enum") {
|
|
228
|
+
if (!args.noHeaders && header) yield* textRow([args.options.get("column-name") ?? "index", ...header.cells.map((cell) => cell.decoded.view())], writer, budget);
|
|
229
|
+
let index = args.start;
|
|
230
|
+
for await (const row of rows2()) {
|
|
231
|
+
try {
|
|
232
|
+
yield* textRow([String(index++), ...row.cells.map((cell) => cell.decoded.view())], writer, budget);
|
|
233
|
+
} finally {
|
|
234
|
+
row.free();
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
if (args.command === "dedup") {
|
|
240
|
+
const selected = await select(args.selection, header, args, budget);
|
|
241
|
+
const seen = /* @__PURE__ */ new Map();
|
|
242
|
+
scope.own(() => {
|
|
243
|
+
for (const entry of seen.values()) entry.row.free();
|
|
244
|
+
});
|
|
245
|
+
if (!args.noHeaders && header) yield* emitted(await writer.row(header.cells), budget);
|
|
246
|
+
for await (const row of rows2()) {
|
|
247
|
+
const { identity, size } = await key(row, selected, budget), existing = seen.get(identity);
|
|
248
|
+
if (existing) {
|
|
249
|
+
budget.release(size);
|
|
250
|
+
existing.count++;
|
|
251
|
+
if (args.options.has("keep-last")) {
|
|
252
|
+
existing.row.free();
|
|
253
|
+
existing.row = row;
|
|
254
|
+
} else row.free();
|
|
255
|
+
} else {
|
|
256
|
+
budget.hold(96);
|
|
257
|
+
seen.set(identity, { row, count: 1 });
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
for (const entry of seen.values()) if (!args.options.has("keep-duplicates") || entry.count > 1) yield* emitted(await writer.row(entry.row.cells), budget);
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
if (args.command === "agg" || args.command === "groupby") {
|
|
264
|
+
const selected = args.command === "groupby" ? await select(args.rightSelection ?? "", header, args, budget) : [];
|
|
265
|
+
const specs = await aggregates(args.operand, header, args, budget);
|
|
266
|
+
const groups = /* @__PURE__ */ new Map();
|
|
267
|
+
const make = (row) => {
|
|
268
|
+
budget.hold(specs.length * 128 + selected.length * 32 + 64);
|
|
269
|
+
return { keys: selected.map((index) => {
|
|
270
|
+
const bytes = row.cells[index].decoded.view();
|
|
271
|
+
budget.hold(bytes.length);
|
|
272
|
+
return bytes.slice();
|
|
273
|
+
}), states: specs.map(() => ({ count: 0, sum: 0, min: Infinity, max: -Infinity })) };
|
|
274
|
+
};
|
|
275
|
+
if (args.command === "agg") groups.set("", make());
|
|
276
|
+
yield* textRow([...selected.map((index) => args.noHeaders ? String(index) : header.cells[index].decoded.view()), ...specs.map((spec) => spec.label)], writer, budget);
|
|
277
|
+
for await (const row of rows2()) {
|
|
278
|
+
try {
|
|
279
|
+
const { identity, size } = selected.length ? await key(row, selected, budget) : { identity: "", size: 0 };
|
|
280
|
+
let group = groups.get(identity);
|
|
281
|
+
if (!group) {
|
|
282
|
+
group = make(row);
|
|
283
|
+
groups.set(identity, group);
|
|
284
|
+
} else budget.release(size);
|
|
285
|
+
for (let i = 0; i < specs.length; i++) {
|
|
286
|
+
budget.work();
|
|
287
|
+
const spec = specs[i], state = group.states[i];
|
|
288
|
+
const bytes = spec.field === void 0 ? void 0 : row.cells[spec.field].decoded.view();
|
|
289
|
+
if (spec.name === "count") {
|
|
290
|
+
if (!bytes || bytes.length) state.count++;
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
if (!bytes?.length) continue;
|
|
294
|
+
state.count++;
|
|
295
|
+
if (spec.name === "first" || spec.name === "last") {
|
|
296
|
+
if (spec.name === "first" && state.first) continue;
|
|
297
|
+
const previous = spec.name === "first" ? state.first : state.last;
|
|
298
|
+
if (previous) budget.release(previous.length);
|
|
299
|
+
budget.hold(bytes.length);
|
|
300
|
+
if (spec.name === "first") state.first = bytes.slice();
|
|
301
|
+
else state.last = bytes.slice();
|
|
302
|
+
} else {
|
|
303
|
+
budget.hold(bytes.length * 4);
|
|
304
|
+
let value;
|
|
305
|
+
try {
|
|
306
|
+
value = decimalNumber(cellText(bytes, budget), budget);
|
|
307
|
+
} finally {
|
|
308
|
+
budget.release(bytes.length * 4);
|
|
309
|
+
}
|
|
310
|
+
if (value === void 0) throw new XanError(`${spec.name} requires numeric values`);
|
|
311
|
+
state.sum += value;
|
|
312
|
+
state.min = Math.min(state.min, value);
|
|
313
|
+
state.max = Math.max(state.max, value);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
} finally {
|
|
317
|
+
row.free();
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
for (const group of groups.values()) yield* textRow([...group.keys, ...specs.map((spec, i) => {
|
|
321
|
+
const state = group.states[i];
|
|
322
|
+
if (spec.name === "first") return state.first ?? "";
|
|
323
|
+
if (spec.name === "last") return state.last ?? "";
|
|
324
|
+
if (spec.name === "count") return String(state.count);
|
|
325
|
+
if (spec.name === "sum") return String(state.sum);
|
|
326
|
+
if (!state.count) return "";
|
|
327
|
+
return String(spec.name === "min" ? state.min : spec.name === "max" ? state.max : state.sum / state.count);
|
|
328
|
+
})], writer, budget);
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
if (args.command === "transpose" && !args.noHeaders && header) {
|
|
332
|
+
budget.hold(32);
|
|
333
|
+
retained.push(header);
|
|
334
|
+
}
|
|
335
|
+
for await (const row of rows2()) {
|
|
336
|
+
budget.hold(32);
|
|
337
|
+
retained.push(row);
|
|
338
|
+
}
|
|
339
|
+
if (args.command === "transpose") {
|
|
340
|
+
for (let i = 0; i < (header?.width ?? 0); i++) yield* textRow(retained.map((row) => row.cells[i].decoded.view()), writer, budget);
|
|
341
|
+
} else if (args.command === "split") {
|
|
342
|
+
const options = args.options;
|
|
343
|
+
let size = Number(await unsigned(options.get("size") ?? "4096", "--size", budget));
|
|
344
|
+
if (options.has("chunks")) {
|
|
345
|
+
const chunks = Number(await unsigned(options.get("chunks"), "--chunks", budget));
|
|
346
|
+
if (!chunks) throw new XanError("chunks must be positive");
|
|
347
|
+
size = Math.max(1, Math.ceil(retained.length / chunks));
|
|
348
|
+
}
|
|
349
|
+
if (!Number.isSafeInteger(size) || size <= 0) throw new XanError("size must be positive");
|
|
350
|
+
const directory = resolvePath(scope.context.cwd, options.get("out-dir") ?? ".");
|
|
351
|
+
const template = options.get("filename") ?? "{}.csv";
|
|
352
|
+
if (template.split("{}").length !== 2 || template.includes("/") || template.includes("\\") || template.includes("\0")) throw new XanError("filename must contain one {} and no path separators");
|
|
353
|
+
await observe(() => scope.context.fs.mkdir(directory, { recursive: true, signal: budget.signal }), budget.signal);
|
|
354
|
+
for (let start = 0; start < Math.max(1, retained.length); start += size) {
|
|
355
|
+
budget.work();
|
|
356
|
+
const output = resolvePath(directory, template.replace("{}", String(options.has("chunks") ? start / size : start)));
|
|
357
|
+
const destination = await preflight(scope.context, { ...args, output }, budget);
|
|
358
|
+
const operation = outputOperation(scope.context, true);
|
|
359
|
+
const chunks = async function* () {
|
|
360
|
+
const chunkWriter = new Writer(writer.delimiter, budget);
|
|
361
|
+
if (!args.noHeaders && header) yield* emitted(await chunkWriter.row(header.cells), budget);
|
|
362
|
+
for (let i = start; i < Math.min(start + size, retained.length); i++) yield* emitted(await chunkWriter.row(retained[i].cells), budget);
|
|
363
|
+
};
|
|
364
|
+
try {
|
|
365
|
+
await publish(scope.context, destination, chunks(), operation, budget);
|
|
366
|
+
} finally {
|
|
367
|
+
await operation.close();
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
} else if (args.command === "to") {
|
|
371
|
+
const format = args.operand;
|
|
372
|
+
if (!["json", "jsonl", "ndjson", "txt"].includes(format)) throw new XanError(`unsupported output format: ${format}`);
|
|
373
|
+
const names = header?.cells.map((cell, index) => args.noHeaders ? String(index) : cellText(cell.decoded.view(), budget)) ?? [];
|
|
374
|
+
const numeric = names.map((_, column) => retained.every((row) => {
|
|
375
|
+
const text = cellText(row.cells[column].decoded.view(), budget);
|
|
376
|
+
return !text || decimalNumber(text, budget) !== void 0;
|
|
377
|
+
}));
|
|
378
|
+
if (format === "json") yield* emitted(await writer.text("["), budget);
|
|
379
|
+
for (let i = 0; i < retained.length; i++) {
|
|
380
|
+
const row = retained[i];
|
|
381
|
+
const temporary = row.cells.reduce((n, cell) => n + cell.decoded.length * 12 + 64, 0);
|
|
382
|
+
budget.hold(temporary);
|
|
383
|
+
try {
|
|
384
|
+
const values = row.cells.map((cell) => cellText(cell.decoded.view(), budget));
|
|
385
|
+
if (format === "txt") {
|
|
386
|
+
yield* emitted(await writer.text(values.join("\n") + "\n"), budget);
|
|
387
|
+
continue;
|
|
388
|
+
}
|
|
389
|
+
const record = Object.fromEntries(values.flatMap((value, column) => !value && args.options.has("omit") ? [] : [[names[column], !value ? args.options.has("nulls") ? null : "" : numeric[column] ? Number(value) : value]]));
|
|
390
|
+
yield* emitted(await writer.text((format === "json" && i ? "," : "") + JSON.stringify(record) + (format === "json" ? "" : "\n")), budget);
|
|
391
|
+
} finally {
|
|
392
|
+
budget.release(temporary);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
if (format === "json") yield* emitted(await writer.text("]\n"), budget);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
async function* from(args, scope, budget, writer) {
|
|
399
|
+
const path = args.inputs[0], format = args.options.get("format") ?? path.slice(path.lastIndexOf(".") + 1);
|
|
400
|
+
if (!["json", "jsonl", "ndjson", "txt", "text", "lines", "raw"].includes(format)) throw new XanError(`unsupported input format: ${format}`);
|
|
401
|
+
const scanner = scope.open(path, args), chunks = [];
|
|
402
|
+
let size = 0;
|
|
403
|
+
for await (const chunk of scanner.raw(false)) {
|
|
404
|
+
budget.hold(chunk.length + 32);
|
|
405
|
+
chunks.push(chunk.slice());
|
|
406
|
+
size += chunk.length;
|
|
407
|
+
}
|
|
408
|
+
budget.hold(size * 64);
|
|
409
|
+
const bytes = new Uint8Array(size);
|
|
410
|
+
let offset = 0;
|
|
411
|
+
for (const chunk of chunks) {
|
|
412
|
+
bytes.set(chunk, offset);
|
|
413
|
+
offset += chunk.length;
|
|
414
|
+
budget.work(chunk.length);
|
|
415
|
+
const cp = budget.checkpoint();
|
|
416
|
+
if (cp) await cp;
|
|
417
|
+
}
|
|
418
|
+
const text = cellText(bytes, budget);
|
|
419
|
+
if (["raw", "txt", "text", "lines"].includes(format)) {
|
|
420
|
+
yield* textRow([args.options.get("column-name") ?? "text"], writer, budget);
|
|
421
|
+
const lines = format === "raw" ? [text] : text.split("\n");
|
|
422
|
+
if (format !== "raw" && lines.at(-1) === "") lines.pop();
|
|
423
|
+
for (const line of lines) {
|
|
424
|
+
budget.add("maxRecords", 1);
|
|
425
|
+
const value = line.endsWith("\r") && format !== "raw" ? line.slice(0, -1) : line;
|
|
426
|
+
const bytes2 = await budget.textSize(value);
|
|
427
|
+
budget.bound("maxCellBytes", bytes2);
|
|
428
|
+
budget.bound("maxRecordBytes", bytes2);
|
|
429
|
+
yield* textRow([value], writer, budget);
|
|
430
|
+
}
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
let data2;
|
|
434
|
+
try {
|
|
435
|
+
data2 = format === "json" ? JSON.parse(text) : text.split("\n").filter((line) => line.trim()).map((line) => JSON.parse(line));
|
|
436
|
+
} catch {
|
|
437
|
+
throw new XanError("invalid JSON input");
|
|
438
|
+
}
|
|
439
|
+
const rows2 = Array.isArray(data2) ? data2 : args.options.has("single-object") ? [data2] : typeof data2 === "object" && data2 !== null ? Object.entries(data2).map(([key2, value]) => ({ key: key2, value })) : [];
|
|
440
|
+
const names = /* @__PURE__ */ new Set();
|
|
441
|
+
for (const row of rows2) {
|
|
442
|
+
budget.add("maxRecords", 1);
|
|
443
|
+
if (!row || typeof row !== "object" || Array.isArray(row)) throw new XanError("JSON records must be objects");
|
|
444
|
+
for (const name of Object.keys(row)) {
|
|
445
|
+
budget.work();
|
|
446
|
+
names.add(name);
|
|
447
|
+
budget.bound("maxColumns", names.size);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
const columns = [...names];
|
|
451
|
+
if (args.options.has("sort-keys")) columns.sort();
|
|
452
|
+
if (columns.length) yield* textRow(columns, writer, budget);
|
|
453
|
+
for (const row of rows2) {
|
|
454
|
+
const values = [];
|
|
455
|
+
let recordBytes = 0;
|
|
456
|
+
for (const name of columns) {
|
|
457
|
+
const value = row[name];
|
|
458
|
+
const text2 = value === null || value === void 0 ? "" : typeof value === "object" ? JSON.stringify(value) : String(value);
|
|
459
|
+
const bytes2 = await budget.textSize(text2);
|
|
460
|
+
budget.bound("maxCellBytes", bytes2);
|
|
461
|
+
recordBytes += bytes2;
|
|
462
|
+
budget.bound("maxRecordBytes", recordBytes);
|
|
463
|
+
values.push(text2);
|
|
464
|
+
}
|
|
465
|
+
yield* textRow(values, writer, budget);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
async function* concatenate(args, scope, budget, writer) {
|
|
469
|
+
if (!["rows", "cols", "columns"].includes(args.operand)) throw new XanError("cat requires rows or columns");
|
|
470
|
+
if (args.operand === "rows") {
|
|
471
|
+
let width2;
|
|
472
|
+
let headerEmitted = false;
|
|
473
|
+
for (let input = 0; input < args.inputs.length; input++) {
|
|
474
|
+
const scanner = scope.open(args.inputs[input], args);
|
|
475
|
+
let first = true;
|
|
476
|
+
for (; ; ) {
|
|
477
|
+
const row = await scanner.next();
|
|
478
|
+
if (!row) break;
|
|
479
|
+
try {
|
|
480
|
+
width2 ??= row.width;
|
|
481
|
+
if (row.width !== width2) throw new XanError("CSV error: inconsistent field count");
|
|
482
|
+
if (!(first && headerEmitted && !args.noHeaders)) yield* emitted(await writer.row(row.cells), budget);
|
|
483
|
+
headerEmitted = true;
|
|
484
|
+
} finally {
|
|
485
|
+
row.free();
|
|
486
|
+
}
|
|
487
|
+
first = false;
|
|
488
|
+
}
|
|
489
|
+
await scanner.close();
|
|
490
|
+
}
|
|
491
|
+
} else {
|
|
492
|
+
const scanners = args.inputs.map((path) => scope.open(path, args)), widths = [];
|
|
493
|
+
for (; ; ) {
|
|
494
|
+
const rows2 = [];
|
|
495
|
+
try {
|
|
496
|
+
for (const scanner of scanners) rows2.push(await scanner.next());
|
|
497
|
+
if (rows2.every((row) => !row) || !args.options.has("pad") && rows2.some((row) => !row)) break;
|
|
498
|
+
const values = [];
|
|
499
|
+
for (let i = 0; i < rows2.length; i++) {
|
|
500
|
+
const row = rows2[i];
|
|
501
|
+
widths[i] ??= row?.width ?? 0;
|
|
502
|
+
if (row && row.width !== widths[i]) throw new XanError("CSV error: inconsistent field count");
|
|
503
|
+
values.push(...row ? row.cells.map((cell) => cell.decoded.view()) : Array(widths[i]).fill(""));
|
|
504
|
+
}
|
|
505
|
+
yield* textRow(values, writer, budget);
|
|
506
|
+
} finally {
|
|
507
|
+
for (const row of rows2) row?.free();
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
// packages/safe-bash-command-xan/src/condition.ts
|
|
514
|
+
init_buffer();
|
|
515
|
+
async function condition(expression, headers, noHeaders, budget, scope) {
|
|
516
|
+
if (expression === void 0) return void 0;
|
|
517
|
+
budget.bound("maxSelectorBytes", await budget.textSize(expression));
|
|
518
|
+
let split = -1;
|
|
519
|
+
let operator = "";
|
|
520
|
+
for (let offset = 0; offset < expression.length; offset++) {
|
|
521
|
+
budget.work();
|
|
522
|
+
if (["=", "!", "<", ">"].includes(expression[offset])) {
|
|
523
|
+
split = offset;
|
|
524
|
+
operator = expression[offset];
|
|
525
|
+
if (expression[offset + 1] === "=") operator += "=";
|
|
526
|
+
break;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
if (split < 0 || !["==", "!=", "<", "<=", ">", ">="].includes(operator)) throw new XanError("unsupported condition: expected COLUMN comparison LITERAL");
|
|
530
|
+
const name = expression.slice(0, split).trim();
|
|
531
|
+
const literal = expression.slice(split + operator.length).trim();
|
|
532
|
+
if (noHeaders) throw new XanError("named conditions require headers");
|
|
533
|
+
const nameBytes = await budget.encode(name);
|
|
534
|
+
let position = -1;
|
|
535
|
+
try {
|
|
536
|
+
for (let index = 0; index < (headers?.cells.length ?? 0); index++) {
|
|
537
|
+
const bytes = headers.cells[index].decoded.view();
|
|
538
|
+
if (bytes.length !== nameBytes.length) continue;
|
|
539
|
+
let same = true;
|
|
540
|
+
for (let offset = 0; offset < bytes.length; offset++) {
|
|
541
|
+
budget.work();
|
|
542
|
+
if (bytes[offset] !== nameBytes[offset]) same = false;
|
|
543
|
+
}
|
|
544
|
+
if (same) {
|
|
545
|
+
position = index;
|
|
546
|
+
break;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
} finally {
|
|
550
|
+
budget.release(nameBytes.length);
|
|
551
|
+
}
|
|
552
|
+
if (position < 0) throw new XanError(`unknown condition column: ${name}`);
|
|
553
|
+
let text;
|
|
554
|
+
let numeric = false;
|
|
555
|
+
if (literal.startsWith('"')) {
|
|
556
|
+
try {
|
|
557
|
+
const value = JSON.parse(literal);
|
|
558
|
+
if (typeof value !== "string") throw new Error();
|
|
559
|
+
text = value;
|
|
560
|
+
} catch {
|
|
561
|
+
throw new XanError("invalid condition string literal");
|
|
562
|
+
}
|
|
563
|
+
} else if (literal.startsWith("'") && literal.endsWith("'") && literal.length >= 2) text = literal.slice(1, -1);
|
|
564
|
+
else {
|
|
565
|
+
if (!literal || !Number.isFinite(Number(literal))) throw new XanError("unsupported condition literal");
|
|
566
|
+
text = literal;
|
|
567
|
+
numeric = true;
|
|
568
|
+
}
|
|
569
|
+
const right = await budget.encode(text);
|
|
570
|
+
scope.own(() => budget.release(right.length));
|
|
571
|
+
return async (row) => {
|
|
572
|
+
const left = row.cells[position].decoded.view();
|
|
573
|
+
let order = 0;
|
|
574
|
+
if (numeric) {
|
|
575
|
+
budget.hold(left.length * 2);
|
|
576
|
+
try {
|
|
577
|
+
let value = "";
|
|
578
|
+
for (let offset = 0; offset < left.length; offset++) {
|
|
579
|
+
budget.work();
|
|
580
|
+
value += String.fromCharCode(left[offset]);
|
|
581
|
+
if ((offset & 1023) === 0) {
|
|
582
|
+
const c = budget.checkpoint();
|
|
583
|
+
if (c) await c;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
const number = Number(value);
|
|
587
|
+
if (!value.trim() || !Number.isFinite(number)) throw new XanError("condition requires a numeric cell");
|
|
588
|
+
order = number < Number(text) ? -1 : number > Number(text) ? 1 : 0;
|
|
589
|
+
} finally {
|
|
590
|
+
budget.release(left.length * 2);
|
|
591
|
+
}
|
|
592
|
+
} else {
|
|
593
|
+
for (let offset = 0; offset < Math.min(left.length, right.length); offset++) {
|
|
594
|
+
budget.work();
|
|
595
|
+
if (left[offset] !== right[offset]) {
|
|
596
|
+
order = left[offset] < right[offset] ? -1 : 1;
|
|
597
|
+
break;
|
|
598
|
+
}
|
|
599
|
+
if ((offset & 1023) === 0) {
|
|
600
|
+
const c = budget.checkpoint();
|
|
601
|
+
if (c) await c;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
if (!order) order = left.length < right.length ? -1 : left.length > right.length ? 1 : 0;
|
|
605
|
+
}
|
|
606
|
+
return operator === "==" ? order === 0 : operator === "!=" ? order !== 0 : operator === "<" ? order < 0 : operator === "<=" ? order <= 0 : operator === ">" ? order > 0 : order >= 0;
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
// packages/safe-bash-command-xan/src/transform.ts
|
|
611
|
+
init_buffer();
|
|
612
|
+
|
|
613
|
+
// packages/safe-bash-command-xan/src/summary.ts
|
|
614
|
+
init_buffer();
|
|
615
|
+
async function* summarize(args, rows2, first, selected, budget, writer) {
|
|
616
|
+
const options = args.options;
|
|
617
|
+
let held = selected.length * 256;
|
|
618
|
+
budget.hold(held);
|
|
619
|
+
const hold = (size) => {
|
|
620
|
+
budget.hold(size);
|
|
621
|
+
held += size;
|
|
622
|
+
};
|
|
623
|
+
const states = selected.map(() => ({
|
|
624
|
+
count: 0,
|
|
625
|
+
empty: 0,
|
|
626
|
+
numeric: 0,
|
|
627
|
+
sum: 0,
|
|
628
|
+
mean: 0,
|
|
629
|
+
m2: 0,
|
|
630
|
+
min: Infinity,
|
|
631
|
+
max: -Infinity,
|
|
632
|
+
minLength: Infinity,
|
|
633
|
+
maxLength: 0,
|
|
634
|
+
first: void 0,
|
|
635
|
+
last: void 0,
|
|
636
|
+
types: /* @__PURE__ */ new Set(),
|
|
637
|
+
frequencies: /* @__PURE__ */ new Map()
|
|
638
|
+
}));
|
|
639
|
+
try {
|
|
640
|
+
for await (const row of rows2) {
|
|
641
|
+
try {
|
|
642
|
+
for (let j = 0; j < selected.length; j++) {
|
|
643
|
+
budget.work();
|
|
644
|
+
const state = states[j], bytes = row.cells[selected[j]].decoded.view();
|
|
645
|
+
state.minLength = Math.min(state.minLength, bytes.length);
|
|
646
|
+
state.maxLength = Math.max(state.maxLength, bytes.length);
|
|
647
|
+
if (args.command === "freq") {
|
|
648
|
+
if (!bytes.length && options.has("no-extra")) continue;
|
|
649
|
+
hold(bytes.length * 4 + 64);
|
|
650
|
+
let key2 = "";
|
|
651
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
652
|
+
budget.work();
|
|
653
|
+
key2 += String.fromCharCode(bytes[i]);
|
|
654
|
+
if ((i & 1023) === 0) {
|
|
655
|
+
const c = budget.checkpoint();
|
|
656
|
+
if (c) await c;
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
const existing = state.frequencies.get(key2);
|
|
660
|
+
if (existing) {
|
|
661
|
+
existing.count++;
|
|
662
|
+
budget.release(bytes.length * 4 + 64);
|
|
663
|
+
held -= bytes.length * 4 + 64;
|
|
664
|
+
} else state.frequencies.set(key2, { bytes: bytes.slice(), count: 1 });
|
|
665
|
+
continue;
|
|
666
|
+
}
|
|
667
|
+
if (!bytes.length) {
|
|
668
|
+
state.empty++;
|
|
669
|
+
state.types.add("empty");
|
|
670
|
+
} else {
|
|
671
|
+
state.count++;
|
|
672
|
+
if (!state.first || await compareBytes(bytes, state.first, budget) < 0) {
|
|
673
|
+
hold(bytes.length);
|
|
674
|
+
if (state.first) {
|
|
675
|
+
held -= state.first.length;
|
|
676
|
+
budget.release(state.first.length);
|
|
677
|
+
}
|
|
678
|
+
state.first = bytes.slice();
|
|
679
|
+
}
|
|
680
|
+
if (!state.last || await compareBytes(bytes, state.last, budget) > 0) {
|
|
681
|
+
hold(bytes.length);
|
|
682
|
+
if (state.last) {
|
|
683
|
+
held -= state.last.length;
|
|
684
|
+
budget.release(state.last.length);
|
|
685
|
+
}
|
|
686
|
+
state.last = bytes.slice();
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
budget.hold(bytes.length * 4);
|
|
690
|
+
try {
|
|
691
|
+
const text = cellText(bytes, budget), parsed = decimalNumber(text, budget);
|
|
692
|
+
const numeric = parsed !== void 0, value = parsed ?? 0;
|
|
693
|
+
if (numeric) {
|
|
694
|
+
state.types.add(Number.isInteger(value) && !text.includes(".") && !text.toLowerCase().includes("e") ? "int" : "float");
|
|
695
|
+
state.sum += value;
|
|
696
|
+
state.min = Math.min(state.min, value);
|
|
697
|
+
state.max = Math.max(state.max, value);
|
|
698
|
+
} else if (text) state.types.add("string");
|
|
699
|
+
if (numeric || !bytes.length && options.has("nulls")) {
|
|
700
|
+
state.numeric++;
|
|
701
|
+
const delta = value - state.mean;
|
|
702
|
+
state.mean += delta / state.numeric;
|
|
703
|
+
state.m2 += delta * (value - state.mean);
|
|
704
|
+
}
|
|
705
|
+
} finally {
|
|
706
|
+
budget.release(bytes.length * 4);
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
} finally {
|
|
710
|
+
row.free();
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
if (args.command === "freq") {
|
|
714
|
+
yield* textRow(["field", "value", "count"], writer, budget);
|
|
715
|
+
const limit = options.has("all") ? 0n : await unsigned(options.get("limit") ?? "10", "--limit", budget);
|
|
716
|
+
for (let j = 0; j < selected.length; j++) {
|
|
717
|
+
const state = states[j];
|
|
718
|
+
budget.hold(state.frequencies.size * 32);
|
|
719
|
+
try {
|
|
720
|
+
const entries = [...state.frequencies.values()];
|
|
721
|
+
await boundedSort(entries, 32, budget, async (a, b) => b.count - a.count || await compareBytes(a.bytes, b.bytes, budget));
|
|
722
|
+
const name = args.noHeaders ? String(selected[j]) : first.cells[selected[j]].decoded.view();
|
|
723
|
+
let remaining = 0;
|
|
724
|
+
for (let i = 0; i < entries.length; i++) {
|
|
725
|
+
budget.work();
|
|
726
|
+
const entry = entries[i];
|
|
727
|
+
if (limit && BigInt(i) >= limit) {
|
|
728
|
+
remaining += entry.count;
|
|
729
|
+
continue;
|
|
730
|
+
}
|
|
731
|
+
yield* textRow([name, entry.bytes.length ? entry.bytes : "<empty>", String(entry.count)], writer, budget);
|
|
732
|
+
}
|
|
733
|
+
if (remaining && !options.has("no-extra")) yield* textRow([name, "<rest>", String(remaining)], writer, budget);
|
|
734
|
+
} finally {
|
|
735
|
+
budget.release(state.frequencies.size * 32);
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
} else {
|
|
739
|
+
yield* textRow(["field", "count", "count_empty", "type", "types", "sum", "mean", "variance", "stddev", "min", "max", "lex_first", "lex_last", "min_length", "max_length"], writer, budget);
|
|
740
|
+
for (let j = 0; j < selected.length; j++) {
|
|
741
|
+
const state = states[j], types = ["string", "float", "int", "empty"].filter((type2) => state.types.has(type2));
|
|
742
|
+
const type = state.types.has("string") ? state.types.has("int") || state.types.has("float") ? "mixed" : "string" : state.types.has("float") ? "float" : state.types.has("int") ? "int" : state.types.has("empty") ? "empty" : "";
|
|
743
|
+
const variance = state.numeric ? Math.max(0, state.m2 / state.numeric) : 0;
|
|
744
|
+
const number = (value) => state.numeric ? String(value) : "";
|
|
745
|
+
yield* textRow([
|
|
746
|
+
args.noHeaders ? String(selected[j]) : first.cells[selected[j]].decoded.view(),
|
|
747
|
+
String(state.count),
|
|
748
|
+
String(state.empty),
|
|
749
|
+
type,
|
|
750
|
+
types.join("|"),
|
|
751
|
+
String(state.sum),
|
|
752
|
+
number(state.mean),
|
|
753
|
+
number(variance),
|
|
754
|
+
number(Math.sqrt(variance)),
|
|
755
|
+
Number.isFinite(state.min) ? String(state.min) : "",
|
|
756
|
+
Number.isFinite(state.max) ? String(state.max) : "",
|
|
757
|
+
state.first ?? "",
|
|
758
|
+
state.last ?? "",
|
|
759
|
+
Number.isFinite(state.minLength) ? String(state.minLength) : "",
|
|
760
|
+
state.count + state.empty ? String(state.maxLength) : ""
|
|
761
|
+
], writer, budget);
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
} finally {
|
|
765
|
+
budget.release(held);
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
// packages/safe-bash-command-xan/src/transform.ts
|
|
770
|
+
function numericCell(bytes, budget) {
|
|
771
|
+
budget.hold(bytes.length * 4);
|
|
772
|
+
try {
|
|
773
|
+
const value = decimalNumber(cellText(bytes, budget), budget);
|
|
774
|
+
if (value === void 0) throw new XanError("could not parse cell as number");
|
|
775
|
+
return value;
|
|
776
|
+
} finally {
|
|
777
|
+
budget.release(bytes.length * 4);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
async function positions(selection, first, args, budget) {
|
|
781
|
+
budget.hold((first?.width ?? 0) * 32);
|
|
782
|
+
try {
|
|
783
|
+
return await resolveSelection(await parseSelection(selection, budget), first?.cells.map((cell) => cell.decoded.view()) ?? [], args.noHeaders, budget);
|
|
784
|
+
} finally {
|
|
785
|
+
budget.release((first?.width ?? 0) * 32);
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
async function* data(scanner, first, noHeaders) {
|
|
789
|
+
let row = noHeaders ? first : await scanner.next();
|
|
790
|
+
try {
|
|
791
|
+
while (row) {
|
|
792
|
+
if (row.width !== first?.width) throw new XanError(`CSV error: record ${row.number}: inconsistent field count`);
|
|
793
|
+
yield row;
|
|
794
|
+
row = await scanner.next();
|
|
795
|
+
}
|
|
796
|
+
} finally {
|
|
797
|
+
row?.free();
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
async function contains(bytes, pattern, exact, budget) {
|
|
801
|
+
if (exact && bytes.length !== pattern.length) return false;
|
|
802
|
+
for (let start = 0; start <= bytes.length - pattern.length; start++) {
|
|
803
|
+
let same = true;
|
|
804
|
+
for (let i = 0; i < pattern.length; i++) {
|
|
805
|
+
budget.work();
|
|
806
|
+
if (bytes[start + i] !== pattern[i]) {
|
|
807
|
+
same = false;
|
|
808
|
+
break;
|
|
809
|
+
}
|
|
810
|
+
if ((i & 1023) === 0) {
|
|
811
|
+
const c2 = budget.checkpoint();
|
|
812
|
+
if (c2) await c2;
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
if (same) return true;
|
|
816
|
+
budget.work();
|
|
817
|
+
const c = budget.checkpoint();
|
|
818
|
+
if (c) await c;
|
|
819
|
+
}
|
|
820
|
+
return false;
|
|
821
|
+
}
|
|
822
|
+
async function* transformRows(args, scope, budget, writer) {
|
|
823
|
+
const options = args.options;
|
|
824
|
+
const scanner = scope.open(args.inputs[0], args);
|
|
825
|
+
const first = await scanner.next();
|
|
826
|
+
if (first) scope.own(first.free);
|
|
827
|
+
const selected = await positions(args.selection, first, args, budget);
|
|
828
|
+
const source = data(scanner, first, args.noHeaders);
|
|
829
|
+
const retained = [];
|
|
830
|
+
const cleanup = () => {
|
|
831
|
+
for (const row of retained) {
|
|
832
|
+
row.free();
|
|
833
|
+
budget.release(32);
|
|
834
|
+
}
|
|
835
|
+
retained.length = 0;
|
|
836
|
+
};
|
|
837
|
+
scope.own(cleanup);
|
|
838
|
+
try {
|
|
839
|
+
if (args.command === "join") {
|
|
840
|
+
yield* join(args, source, first, selected, scope, budget, writer);
|
|
841
|
+
return;
|
|
842
|
+
}
|
|
843
|
+
if (args.command === "freq" || args.command === "stats") {
|
|
844
|
+
yield* summarize(args, source, first, selected, budget, writer);
|
|
845
|
+
return;
|
|
846
|
+
}
|
|
847
|
+
if (args.command === "rename") {
|
|
848
|
+
const bytes = await budget.encode(args.operand);
|
|
849
|
+
const names = new Scanner({ async *[Symbol.asyncIterator]() {
|
|
850
|
+
yield bytes;
|
|
851
|
+
} }, 44, "rename", budget);
|
|
852
|
+
let replacement;
|
|
853
|
+
try {
|
|
854
|
+
replacement = await names.next();
|
|
855
|
+
const extra = await names.next();
|
|
856
|
+
if (extra) extra.free();
|
|
857
|
+
if (replacement?.width !== selected.length || extra) throw new XanError("replacement names must match selected columns");
|
|
858
|
+
budget.hold(selected.length * 32 + (first?.width ?? 0) * 32);
|
|
859
|
+
try {
|
|
860
|
+
const replacements = new Map(selected.map((column, index) => [column, replacement.cells[index].decoded.view()]));
|
|
861
|
+
if (replacements.size !== selected.length) throw new XanError("rename selection contains duplicate columns");
|
|
862
|
+
yield* textRow(first?.cells.map((cell, i) => replacements.get(i) ?? (args.noHeaders ? String(i) : cell.decoded.view())) ?? [], writer, budget);
|
|
863
|
+
} finally {
|
|
864
|
+
budget.release(selected.length * 32 + (first?.width ?? 0) * 32);
|
|
865
|
+
}
|
|
866
|
+
} finally {
|
|
867
|
+
replacement?.free();
|
|
868
|
+
await names.close();
|
|
869
|
+
budget.release(bytes.length);
|
|
870
|
+
}
|
|
871
|
+
} else if (!args.noHeaders && first) yield* emitted(await writer.row(first.cells), budget);
|
|
872
|
+
const predicate = args.command === "filter" ? await condition(args.operand, first, args.noHeaders, budget, scope) : void 0;
|
|
873
|
+
const pattern = args.command === "search" ? await budget.encode(options.has("ignore-case") ? args.operand.toLowerCase() : args.operand) : void 0;
|
|
874
|
+
if (pattern) scope.own(() => budget.release(pattern.length));
|
|
875
|
+
const limit = options.has("limit") ? await unsigned(options.get("limit"), "--limit", budget) : void 0;
|
|
876
|
+
let matches = 0n;
|
|
877
|
+
for await (const row of source) {
|
|
878
|
+
let held = false;
|
|
879
|
+
try {
|
|
880
|
+
if (args.command === "sort" || args.command === "reverse") {
|
|
881
|
+
if (options.has("numeric")) for (const position of selected) numericCell(row.cells[position].decoded.view(), budget);
|
|
882
|
+
budget.hold(32);
|
|
883
|
+
retained.push(row);
|
|
884
|
+
held = true;
|
|
885
|
+
continue;
|
|
886
|
+
}
|
|
887
|
+
let match = predicate ? await predicate(row) : true;
|
|
888
|
+
if (pattern) {
|
|
889
|
+
match = options.has("every-column");
|
|
890
|
+
for (const position of selected) {
|
|
891
|
+
let bytes = row.cells[position].decoded.view();
|
|
892
|
+
let folded;
|
|
893
|
+
try {
|
|
894
|
+
if (options.has("ignore-case")) {
|
|
895
|
+
const size = bytes.length * 8;
|
|
896
|
+
budget.hold(size);
|
|
897
|
+
try {
|
|
898
|
+
folded = await budget.encode(cellText(bytes, budget).toLowerCase());
|
|
899
|
+
} finally {
|
|
900
|
+
budget.release(size);
|
|
901
|
+
}
|
|
902
|
+
bytes = folded;
|
|
903
|
+
}
|
|
904
|
+
const found = await contains(bytes, pattern, options.has("exact"), budget);
|
|
905
|
+
if (options.has("every-column") ? !found : found) {
|
|
906
|
+
match = found;
|
|
907
|
+
break;
|
|
908
|
+
}
|
|
909
|
+
} finally {
|
|
910
|
+
if (folded) budget.release(folded.length);
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
if (options.has("invert-match")) match = !match;
|
|
915
|
+
if (match) {
|
|
916
|
+
if (limit !== void 0 && matches >= limit) break;
|
|
917
|
+
yield* emitted(await writer.row(row.cells), budget);
|
|
918
|
+
matches++;
|
|
919
|
+
if (limit !== void 0 && matches >= limit) break;
|
|
920
|
+
}
|
|
921
|
+
} finally {
|
|
922
|
+
if (!held) row.free();
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
const compare = async (left, right) => {
|
|
926
|
+
for (const position of selected) {
|
|
927
|
+
const a = left.cells[position].decoded.view(), b = right.cells[position].decoded.view();
|
|
928
|
+
let order;
|
|
929
|
+
if (options.has("numeric")) {
|
|
930
|
+
order = Math.sign(numericCell(a, budget) - numericCell(b, budget));
|
|
931
|
+
} else order = await compareBytes(a, b, budget);
|
|
932
|
+
if (order) return options.has("reverse") ? -order : order;
|
|
933
|
+
}
|
|
934
|
+
return 0;
|
|
935
|
+
};
|
|
936
|
+
if (args.command === "sort") await boundedSort(retained, 32, budget, compare);
|
|
937
|
+
for (let i = 0; i < retained.length; i++) {
|
|
938
|
+
budget.work();
|
|
939
|
+
const c = budget.checkpoint();
|
|
940
|
+
if (c) await c;
|
|
941
|
+
const row = retained[args.command === "reverse" ? retained.length - i - 1 : i];
|
|
942
|
+
if (options.has("uniq") && i && await compare(retained[i - 1], row) === 0) continue;
|
|
943
|
+
yield* emitted(await writer.row(row.cells), budget);
|
|
944
|
+
}
|
|
945
|
+
} finally {
|
|
946
|
+
await source.return(void 0);
|
|
947
|
+
cleanup();
|
|
948
|
+
first?.free();
|
|
949
|
+
await scanner.close();
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
async function* join(args, left, first, leftKeys, scope, budget, writer) {
|
|
953
|
+
const options = args.options;
|
|
954
|
+
const scanner = scope.open(args.inputs[1], args);
|
|
955
|
+
const rightFirst = await scanner.next();
|
|
956
|
+
if (rightFirst) scope.own(rightFirst.free);
|
|
957
|
+
const rightKeys = await positions(args.rightSelection ?? "", rightFirst, args, budget);
|
|
958
|
+
if (!options.has("cross") && leftKeys.length !== rightKeys.length) throw new XanError("join key selections have different widths");
|
|
959
|
+
let drop = options.get("drop-key") ?? "none";
|
|
960
|
+
if (!options.has("drop-key") && !args.noHeaders && !options.has("ignore-case") && !options.has("full") && !options.has("cross") && !options.has("semi") && !options.has("anti")) {
|
|
961
|
+
let same = true;
|
|
962
|
+
for (let i = 0; i < leftKeys.length; i++) if (await compareBytes(first.cells[leftKeys[i]].decoded.view(), rightFirst.cells[rightKeys[i]].decoded.view(), budget)) same = false;
|
|
963
|
+
if (same) drop = options.has("right") ? "left" : "right";
|
|
964
|
+
}
|
|
965
|
+
const lcols = await positions("", first, args, budget), rcols = await positions("", rightFirst, args, budget);
|
|
966
|
+
budget.hold((lcols.length + rcols.length + leftKeys.length + rightKeys.length) * 64);
|
|
967
|
+
const leftSet = new Set(leftKeys), rightSet = new Set(rightKeys);
|
|
968
|
+
budget.work(leftKeys.length + rightKeys.length);
|
|
969
|
+
const keepLeft = [], keepRight = [];
|
|
970
|
+
for (const i of lcols) {
|
|
971
|
+
budget.work();
|
|
972
|
+
if (!["left", "both"].includes(drop) || !leftSet.has(i)) keepLeft.push(i);
|
|
973
|
+
const c = budget.checkpoint();
|
|
974
|
+
if (c) await c;
|
|
975
|
+
}
|
|
976
|
+
for (const i of rcols) {
|
|
977
|
+
budget.work();
|
|
978
|
+
if (!["right", "both"].includes(drop) || !rightSet.has(i)) keepRight.push(i);
|
|
979
|
+
const c = budget.checkpoint();
|
|
980
|
+
if (c) await c;
|
|
981
|
+
}
|
|
982
|
+
const semi = options.has("semi") || options.has("anti");
|
|
983
|
+
const index = /* @__PURE__ */ new Map(), rows2 = [], matched = /* @__PURE__ */ new Set();
|
|
984
|
+
let held = 0;
|
|
985
|
+
const hold = (bytes) => {
|
|
986
|
+
budget.hold(bytes);
|
|
987
|
+
held += bytes;
|
|
988
|
+
};
|
|
989
|
+
const key2 = async (row, columns) => {
|
|
990
|
+
let result = "", nonempty = false;
|
|
991
|
+
for (const i of columns) {
|
|
992
|
+
const bytes = row.cells[i].decoded.view();
|
|
993
|
+
nonempty ||= bytes.length > 0;
|
|
994
|
+
let value = "";
|
|
995
|
+
if (options.has("ignore-case")) value = cellText(bytes, budget).toLowerCase();
|
|
996
|
+
else for (let j = 0; j < bytes.length; j++) {
|
|
997
|
+
budget.work();
|
|
998
|
+
value += String.fromCharCode(bytes[j]);
|
|
999
|
+
if ((j & 1023) === 0) {
|
|
1000
|
+
const c = budget.checkpoint();
|
|
1001
|
+
if (c) await c;
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
result += `${value.length}:${value}`;
|
|
1005
|
+
}
|
|
1006
|
+
return nonempty || options.has("nulls") ? result : void 0;
|
|
1007
|
+
};
|
|
1008
|
+
const output = async function* (a, b) {
|
|
1009
|
+
budget.hold((keepLeft.length + keepRight.length) * 32);
|
|
1010
|
+
try {
|
|
1011
|
+
yield* textRow([...keepLeft.map((i) => a?.cells[i]?.decoded.view() ?? ""), ...semi ? [] : keepRight.map((i) => b?.cells[i]?.decoded.view() ?? "")], writer, budget);
|
|
1012
|
+
} finally {
|
|
1013
|
+
budget.release((keepLeft.length + keepRight.length) * 32);
|
|
1014
|
+
}
|
|
1015
|
+
};
|
|
1016
|
+
try {
|
|
1017
|
+
if (!args.noHeaders) yield* output(first, rightFirst);
|
|
1018
|
+
for await (const row of data(scanner, rightFirst, args.noHeaders)) {
|
|
1019
|
+
let retained = false;
|
|
1020
|
+
try {
|
|
1021
|
+
hold(row.cells.reduce((n, cell) => n + cell.decoded.length * 8 + 64, 128));
|
|
1022
|
+
rows2.push(row);
|
|
1023
|
+
retained = true;
|
|
1024
|
+
const value = await key2(row, rightKeys);
|
|
1025
|
+
if (value !== void 0) {
|
|
1026
|
+
const group = index.get(value);
|
|
1027
|
+
if (group) group.push(row);
|
|
1028
|
+
else index.set(value, [row]);
|
|
1029
|
+
}
|
|
1030
|
+
} finally {
|
|
1031
|
+
if (!retained) row.free();
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
for await (const row of left) {
|
|
1035
|
+
try {
|
|
1036
|
+
budget.hold(row.cells.reduce((n, cell) => n + cell.decoded.length * 8 + 64, 0));
|
|
1037
|
+
let value;
|
|
1038
|
+
try {
|
|
1039
|
+
value = await key2(row, leftKeys);
|
|
1040
|
+
const matches = options.has("cross") ? rows2 : value === void 0 ? [] : index.get(value) ?? [];
|
|
1041
|
+
if (semi) {
|
|
1042
|
+
if (options.has("anti") ? !matches.length : matches.length) yield* output(row, void 0);
|
|
1043
|
+
} else if (matches.length) for (const other of matches) {
|
|
1044
|
+
budget.work();
|
|
1045
|
+
matched.add(other);
|
|
1046
|
+
yield* output(row, other);
|
|
1047
|
+
}
|
|
1048
|
+
else if (options.has("left") || options.has("full")) yield* output(row, void 0);
|
|
1049
|
+
} finally {
|
|
1050
|
+
budget.release(row.cells.reduce((n, cell) => n + cell.decoded.length * 8 + 64, 0));
|
|
1051
|
+
}
|
|
1052
|
+
} finally {
|
|
1053
|
+
row.free();
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
if (options.has("right") || options.has("full")) {
|
|
1057
|
+
for (const row of rows2) if (!matched.has(row)) yield* output(void 0, row);
|
|
1058
|
+
}
|
|
1059
|
+
} finally {
|
|
1060
|
+
for (const row of rows2) row.free();
|
|
1061
|
+
rightFirst?.free();
|
|
1062
|
+
budget.release(held);
|
|
1063
|
+
await scanner.close();
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
// packages/safe-bash-command-xan/src/commands.ts
|
|
1068
|
+
async function* emitted2(bytes, budget) {
|
|
1069
|
+
try {
|
|
1070
|
+
if (bytes.length) yield bytes;
|
|
1071
|
+
} finally {
|
|
1072
|
+
budget.release(bytes.length);
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
function width(row, expected) {
|
|
1076
|
+
if (row.width !== expected) throw new XanError(`CSV error: record ${row.number} (byte: ${row.offset}): found record with ${row.width} fields, but the previous record has ${expected} fields`);
|
|
1077
|
+
}
|
|
1078
|
+
async function prepareRows(args, selection, scope, budget, writer) {
|
|
1079
|
+
if (args.help) return emitted2(await writer.text("xan: CSV tools for virtual files and byte streams\nCommands: headers (h), count, select, slice, head, tail, sort, search,\n filter, reverse, rename, drop, stats, freq (frequency), join,\n dedup, enum, transpose, agg, groupby, to, from, cat, split\nCommon: -h --help, -d --delimiter BYTE, -o --output PATH\nheaders: -j --just-names, --csv, -s --start N, --color auto|never\ncount/select/slice: -n --no-headers\ncount: -H/--human-readable, -c/--check-alignment, -a/--approx, -p/--parallel, -t/--threads N\nselect: literal selection or -e/--evaluate COLUMN, -f/--evaluate-file PATH;\nslice: -s/--start, --skip, -e/--end, -l/--len, -i/--index, -I/--indices, -L/--last\nslice bytes: -B/--byte-offset N, --end-byte N, --raw\nslice conditions: -S/--start-condition EXPR, -E/--end-condition EXPR\nConditions: named column comparisons with string/number literals.\nhead/tail: -l/--limit N (default 10)\nsort: -s/--select COLUMNS, -N/--numeric, -R/--reverse, -u/--uniq\nsearch: PATTERN; -s/--select, -e/--exact, -i/--ignore-case, -v/--invert-match\nfilter: COLUMN comparison LITERAL; -v/--invert-match\nrename: NAMES; -s/--select COLUMNS; drop: SELECTION\nstats/freq: -s/--select COLUMNS; freq: -l/--limit N, -A/--all, -N/--no-extra\njoin: COLUMNS LEFT [RIGHT_COLUMNS] RIGHT; --left/--right/--full/--semi/--anti/--cross\n --drop-key none|left|right|both, --nulls, -i/--ignore-case\nSearch uses literal substrings; filter supports the comparisons above.\nagg/groupby: aggregate calls (count, sum, mean, min, max, first, last) with optional AS names.\nto: json, jsonl, ndjson, txt; from: -f json, jsonl, ndjson, txt, raw.\ncat: rows or cols [--pad]; split: -S SIZE, -O DIRECTORY, -f TEMPLATE.\nOther expressions, formats and forced color are unsupported.\nCount execution options use exact sequential counting.\n"), budget);
|
|
1080
|
+
if (["dedup", "enum", "transpose", "agg", "groupby", "to", "from", "cat", "split"].includes(args.command)) return extendedRows(args, scope, budget, writer);
|
|
1081
|
+
if (!["headers", "count", "select", "drop", "slice"].includes(args.command)) return transformRows(args, scope, budget, writer);
|
|
1082
|
+
if (args.command === "headers") return prepareHeaders(args, scope, budget, writer);
|
|
1083
|
+
if (args.command === "slice" && !args.raw && args.noHeaders && args.last === 0) return emitted2(new Uint8Array(0), budget);
|
|
1084
|
+
let scanner = scope.open(args.inputs[0], args);
|
|
1085
|
+
if (args.command === "count") {
|
|
1086
|
+
let count = 0;
|
|
1087
|
+
let expected;
|
|
1088
|
+
while (true) {
|
|
1089
|
+
const row = await scanner.next();
|
|
1090
|
+
if (!row) break;
|
|
1091
|
+
try {
|
|
1092
|
+
expected ??= row.width;
|
|
1093
|
+
if (args.checkAlignment) width(row, expected);
|
|
1094
|
+
count++;
|
|
1095
|
+
} finally {
|
|
1096
|
+
row.free();
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
await scanner.close();
|
|
1100
|
+
count = Math.max(0, count - (args.noHeaders ? 0 : 1));
|
|
1101
|
+
let text = String(count);
|
|
1102
|
+
if (args.humanReadable && !args.parallel) {
|
|
1103
|
+
text = count.toLocaleString("en-US");
|
|
1104
|
+
if (count >= 1e4) {
|
|
1105
|
+
const scale = count >= 1e6 ? 1e6 : 1e3;
|
|
1106
|
+
const rounded = Math.round(count / scale * 10) / 10;
|
|
1107
|
+
text += ` (${rounded}${scale === 1e3 ? "k" : "M"})`;
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
return emitted2(await writer.text(`${text}
|
|
1111
|
+
`), budget);
|
|
1112
|
+
}
|
|
1113
|
+
const first = args.raw && args.noHeaders ? void 0 : await scanner.next();
|
|
1114
|
+
if (first) scope.own(first.free);
|
|
1115
|
+
let positions2;
|
|
1116
|
+
try {
|
|
1117
|
+
if (selection && (first || !args.noHeaders)) {
|
|
1118
|
+
const metadata = (first?.width ?? 0) * 32;
|
|
1119
|
+
budget.hold(metadata);
|
|
1120
|
+
try {
|
|
1121
|
+
positions2 = await resolveSelection(selection, first?.cells.map((cell) => cell.decoded.view()) ?? [], args.noHeaders, budget);
|
|
1122
|
+
} finally {
|
|
1123
|
+
budget.release(metadata);
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
} catch (error) {
|
|
1127
|
+
first?.free();
|
|
1128
|
+
throw error;
|
|
1129
|
+
}
|
|
1130
|
+
const startCondition = args.raw || args.last !== void 0 ? void 0 : await condition(args.startCondition, first, args.noHeaders, budget, scope);
|
|
1131
|
+
const endCondition = args.raw || args.last !== void 0 ? void 0 : await condition(args.endCondition, first, args.noHeaders, budget, scope);
|
|
1132
|
+
if (args.byteOffset !== void 0 && (args.raw || args.last === void 0)) {
|
|
1133
|
+
await scanner.close();
|
|
1134
|
+
scanner = scope.open(args.inputs[0], args);
|
|
1135
|
+
await scanner.position(args.byteOffset, args.endByte);
|
|
1136
|
+
}
|
|
1137
|
+
if (args.raw) return (async function* () {
|
|
1138
|
+
try {
|
|
1139
|
+
if (!args.noHeaders) yield* emitted2(await writer.row(first?.cells ?? []), budget);
|
|
1140
|
+
first?.free();
|
|
1141
|
+
yield* scanner.raw();
|
|
1142
|
+
} finally {
|
|
1143
|
+
first?.free();
|
|
1144
|
+
await scanner.close();
|
|
1145
|
+
}
|
|
1146
|
+
})();
|
|
1147
|
+
return rows(args, scanner, first, positions2, budget, writer, startCondition, endCondition);
|
|
1148
|
+
}
|
|
1149
|
+
async function* rows(args, scanner, first, positions2, budget, writer, startCondition, endCondition) {
|
|
1150
|
+
const expected = first?.width ?? 0;
|
|
1151
|
+
const ring = [];
|
|
1152
|
+
let ringCursor = 0;
|
|
1153
|
+
let current = first;
|
|
1154
|
+
if (args.byteOffset !== void 0 && args.last === void 0) current = void 0;
|
|
1155
|
+
let started = !startCondition;
|
|
1156
|
+
const raw = (args.command === "select" || args.command === "drop") && !args.evaluate && !args.evaluateFile && (args.delimiter ?? inferDelimiter(args.inputs[0])) === 44 && writer.delimiter === 44;
|
|
1157
|
+
try {
|
|
1158
|
+
if (!args.noHeaders) {
|
|
1159
|
+
yield* emitted2(await writer.row(first?.cells ?? [], positions2), budget);
|
|
1160
|
+
first?.free();
|
|
1161
|
+
current = void 0;
|
|
1162
|
+
}
|
|
1163
|
+
if (args.byteOffset !== void 0 && args.noHeaders && args.last === void 0) first?.free();
|
|
1164
|
+
if (args.last === 0) return;
|
|
1165
|
+
if (!first) return;
|
|
1166
|
+
let index = 0n;
|
|
1167
|
+
let wanted = 0;
|
|
1168
|
+
while (true) {
|
|
1169
|
+
current ??= await scanner.next();
|
|
1170
|
+
if (!current) break;
|
|
1171
|
+
width(current, expected);
|
|
1172
|
+
if (!started) {
|
|
1173
|
+
started = await startCondition(current);
|
|
1174
|
+
if (!started) {
|
|
1175
|
+
current.free();
|
|
1176
|
+
current = void 0;
|
|
1177
|
+
continue;
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
if (endCondition && await endCondition(current)) break;
|
|
1181
|
+
if (args.command === "select" || args.command === "drop") yield* emitted2(await writer.row(current.cells, positions2, raw), budget);
|
|
1182
|
+
else if (args.last !== void 0) {
|
|
1183
|
+
if (ring.length < args.last) {
|
|
1184
|
+
budget.hold(32);
|
|
1185
|
+
ring.push(current);
|
|
1186
|
+
} else {
|
|
1187
|
+
ring[ringCursor].free();
|
|
1188
|
+
ring[ringCursor] = current;
|
|
1189
|
+
ringCursor = (ringCursor + 1) % args.last;
|
|
1190
|
+
}
|
|
1191
|
+
current = void 0;
|
|
1192
|
+
} else if (args.indices) {
|
|
1193
|
+
if (args.indices[wanted] === index) {
|
|
1194
|
+
yield* emitted2(await writer.row(current.cells), budget);
|
|
1195
|
+
wanted++;
|
|
1196
|
+
}
|
|
1197
|
+
} else if (index >= args.start) yield* emitted2(await writer.row(current.cells), budget);
|
|
1198
|
+
current?.free();
|
|
1199
|
+
current = void 0;
|
|
1200
|
+
index++;
|
|
1201
|
+
if (args.command === "slice" && args.last === void 0) {
|
|
1202
|
+
if (args.indices && wanted === args.indices.length) break;
|
|
1203
|
+
if (!args.indices && args.end !== void 0 && index === args.end && index > args.start) break;
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
for (let offset = 0; offset < ring.length; offset++) {
|
|
1207
|
+
const row = ring[(ringCursor + offset) % ring.length];
|
|
1208
|
+
yield* emitted2(await writer.row(row.cells), budget);
|
|
1209
|
+
}
|
|
1210
|
+
} finally {
|
|
1211
|
+
current?.free();
|
|
1212
|
+
first?.free();
|
|
1213
|
+
for (const row of ring) {
|
|
1214
|
+
row.free();
|
|
1215
|
+
budget.release(32);
|
|
1216
|
+
}
|
|
1217
|
+
if (positions2) budget.release(positions2.length * 8);
|
|
1218
|
+
await scanner.close();
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
var whitespace = (code) => code >= 9 && code <= 13 || code === 32 || code === 133 || code === 160 || code === 5760 || code >= 8192 && code <= 8202 || code === 8232 || code === 8233 || code === 8239 || code === 8287 || code === 12288;
|
|
1222
|
+
async function sanitize(text, budget) {
|
|
1223
|
+
const parts = [];
|
|
1224
|
+
let normalizedLength = 0;
|
|
1225
|
+
let segment = "";
|
|
1226
|
+
for (let offset = 0; offset < text.length; offset++) {
|
|
1227
|
+
const code = text.charCodeAt(offset);
|
|
1228
|
+
const part = code === 173 || code < 32 && !whitespace(code) ? "" : code === 10 ? "\\n" : code === 13 ? "\\r" : code === 9 ? "\\t" : code === 12 ? "\\f" : text[offset];
|
|
1229
|
+
budget.hold(part.length * 2);
|
|
1230
|
+
budget.work(part.length);
|
|
1231
|
+
segment += part;
|
|
1232
|
+
normalizedLength += part.length;
|
|
1233
|
+
if (segment.length >= 4096) {
|
|
1234
|
+
budget.hold(32);
|
|
1235
|
+
parts.push(segment);
|
|
1236
|
+
segment = "";
|
|
1237
|
+
}
|
|
1238
|
+
if ((offset & 1023) === 0) {
|
|
1239
|
+
const c = budget.checkpoint();
|
|
1240
|
+
if (c) await c;
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
if (segment) {
|
|
1244
|
+
budget.hold(32);
|
|
1245
|
+
parts.push(segment);
|
|
1246
|
+
}
|
|
1247
|
+
budget.hold(normalizedLength * 2);
|
|
1248
|
+
for (let offset = 0; offset < normalizedLength; offset += 4096) {
|
|
1249
|
+
budget.work(Math.min(4096, normalizedLength - offset));
|
|
1250
|
+
{
|
|
1251
|
+
const c = budget.checkpoint();
|
|
1252
|
+
if (c) await c;
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
text = parts.join("");
|
|
1256
|
+
budget.release(normalizedLength * 2 + parts.length * 32);
|
|
1257
|
+
parts.length = 0;
|
|
1258
|
+
let start = 0;
|
|
1259
|
+
let end = text.length;
|
|
1260
|
+
while (start < end && whitespace(text.charCodeAt(start))) {
|
|
1261
|
+
budget.work();
|
|
1262
|
+
start++;
|
|
1263
|
+
}
|
|
1264
|
+
while (end > start && whitespace(text.charCodeAt(end - 1))) {
|
|
1265
|
+
budget.work();
|
|
1266
|
+
end--;
|
|
1267
|
+
}
|
|
1268
|
+
let result = "";
|
|
1269
|
+
for (let offset = 0; offset < text.length; offset++) {
|
|
1270
|
+
const code = text.charCodeAt(offset);
|
|
1271
|
+
let part;
|
|
1272
|
+
if (offset < start || offset >= end) part = "\xB7".repeat(code < 128 ? 1 : code < 2048 ? 2 : 3);
|
|
1273
|
+
else part = text[offset];
|
|
1274
|
+
budget.hold(part.length * 2);
|
|
1275
|
+
budget.work(part.length);
|
|
1276
|
+
result += part;
|
|
1277
|
+
if ((offset & 1023) === 0) {
|
|
1278
|
+
const c = budget.checkpoint();
|
|
1279
|
+
if (c) await c;
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
budget.release(normalizedLength * 2);
|
|
1283
|
+
return result;
|
|
1284
|
+
}
|
|
1285
|
+
async function decodeHeader(bytes, field, budget) {
|
|
1286
|
+
for (let offset = 0; offset < bytes.length; ) {
|
|
1287
|
+
const first = bytes[offset];
|
|
1288
|
+
budget.work();
|
|
1289
|
+
let width2 = first < 128 ? 1 : first >= 194 && first <= 223 ? 2 : first >= 224 && first <= 239 ? 3 : first >= 240 && first <= 244 ? 4 : 0;
|
|
1290
|
+
if (offset + width2 > bytes.length) width2 = 0;
|
|
1291
|
+
for (let index = 1; index < width2; index++) {
|
|
1292
|
+
budget.work();
|
|
1293
|
+
const byte = bytes[offset + index];
|
|
1294
|
+
if (byte < 128 || byte > 191 || index === 1 && (first === 224 && byte < 160 || first === 237 && byte > 159 || first === 240 && byte < 144 || first === 244 && byte > 143)) {
|
|
1295
|
+
width2 = 0;
|
|
1296
|
+
break;
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
if (!width2) throw new XanError(`CSV parse error: record 0 (line 1, field: ${field}, byte: 0): invalid utf-8: invalid UTF-8 in field ${field} near byte index ${offset}`);
|
|
1300
|
+
offset += width2;
|
|
1301
|
+
{
|
|
1302
|
+
const c = budget.checkpoint();
|
|
1303
|
+
if (c) await c;
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
const decoder = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
|
|
1307
|
+
const metadata = Math.ceil(bytes.length / 4096) * 32;
|
|
1308
|
+
budget.hold(bytes.length * 2 + metadata);
|
|
1309
|
+
const parts = [];
|
|
1310
|
+
let length = 0;
|
|
1311
|
+
try {
|
|
1312
|
+
for (let offset = 0; offset < bytes.length; offset += 4096) {
|
|
1313
|
+
const fragment = bytes.subarray(offset, offset + 4096);
|
|
1314
|
+
budget.work(fragment.length);
|
|
1315
|
+
const part = decoder.decode(fragment, { stream: offset + 4096 < bytes.length });
|
|
1316
|
+
parts.push(part);
|
|
1317
|
+
length += part.length;
|
|
1318
|
+
{
|
|
1319
|
+
const c = budget.checkpoint();
|
|
1320
|
+
if (c) await c;
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
budget.hold(length * 2);
|
|
1324
|
+
for (let offset = 0; offset < length; offset += 2048) {
|
|
1325
|
+
budget.work(Math.min(2048, length - offset) * 2);
|
|
1326
|
+
{
|
|
1327
|
+
const c = budget.checkpoint();
|
|
1328
|
+
if (c) await c;
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
return parts.join("");
|
|
1332
|
+
} finally {
|
|
1333
|
+
budget.release(bytes.length * 2 + metadata);
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
async function prepareHeaders(args, scope, budget, writer) {
|
|
1337
|
+
const headers = [];
|
|
1338
|
+
try {
|
|
1339
|
+
for (const path of args.inputs) {
|
|
1340
|
+
const scanner = scope.open(path, args);
|
|
1341
|
+
const row = await scanner.next();
|
|
1342
|
+
if (row) scope.own(row.free);
|
|
1343
|
+
const header = { ...row ? { row } : {}, names: [], display: [] };
|
|
1344
|
+
budget.hold(32);
|
|
1345
|
+
headers.push(header);
|
|
1346
|
+
for (let index = 0; index < (row?.cells.length ?? 0); index++) {
|
|
1347
|
+
const bytes = row.cells[index].decoded.view();
|
|
1348
|
+
budget.hold(32);
|
|
1349
|
+
const name = await decodeHeader(bytes, index, budget);
|
|
1350
|
+
header.names.push(name);
|
|
1351
|
+
header.display.push(args.csv ? "" : await sanitize(name, budget));
|
|
1352
|
+
}
|
|
1353
|
+
if (!args.csv && header.names.length) checkedAdd(args.start, BigInt(header.names.length - 1));
|
|
1354
|
+
await scanner.close();
|
|
1355
|
+
}
|
|
1356
|
+
return headerOutput(args, headers, budget, writer);
|
|
1357
|
+
} catch (error) {
|
|
1358
|
+
for (const header of headers) header.row?.free();
|
|
1359
|
+
throw error;
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
async function* headerOutput(args, headers, budget, writer) {
|
|
1363
|
+
try {
|
|
1364
|
+
const maximum = Math.max(0, ...headers.map((header) => header.names.length));
|
|
1365
|
+
if (args.csv) {
|
|
1366
|
+
const paths = [];
|
|
1367
|
+
try {
|
|
1368
|
+
for (const path of args.inputs) paths.push(await budget.encode(path === "-" ? "<stdin>" : path));
|
|
1369
|
+
yield* emitted2(await writer.values(paths), budget);
|
|
1370
|
+
} finally {
|
|
1371
|
+
for (const path of paths) budget.release(path.length);
|
|
1372
|
+
}
|
|
1373
|
+
for (let index = 0; index < maximum; index++) {
|
|
1374
|
+
budget.hold(headers.length * 32);
|
|
1375
|
+
try {
|
|
1376
|
+
yield* emitted2(await writer.values(headers.map((header) => header.row?.cells[index]?.decoded.view() ?? new Uint8Array(0))), budget);
|
|
1377
|
+
} finally {
|
|
1378
|
+
budget.release(headers.length * 32);
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
return;
|
|
1382
|
+
}
|
|
1383
|
+
const counts = /* @__PURE__ */ new Map();
|
|
1384
|
+
for (let file = 0; file < headers.length; file++) {
|
|
1385
|
+
const header = headers[file];
|
|
1386
|
+
if (headers.length > 1) yield* emitted2(await writer.text(`${file ? "\n" : ""}${args.inputs[file] === "-" ? "<stdin>" : args.inputs[file]}
|
|
1387
|
+
`), budget);
|
|
1388
|
+
for (let index = 0; index < header.names.length; index++) {
|
|
1389
|
+
const name = header.names[index];
|
|
1390
|
+
if (headers.length > 1) {
|
|
1391
|
+
const previous = counts.get(name);
|
|
1392
|
+
if (previous) {
|
|
1393
|
+
if (previous.lastFile !== file) {
|
|
1394
|
+
previous.count++;
|
|
1395
|
+
previous.lastFile = file;
|
|
1396
|
+
}
|
|
1397
|
+
} else {
|
|
1398
|
+
budget.hold(32);
|
|
1399
|
+
counts.set(name, { count: 1, lastFile: file, bytes: header.row.cells[index].decoded.view(), display: header.display[index] });
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
const prefix = args.justNames ? "" : `${checkedAdd(args.start, BigInt(index))} `;
|
|
1403
|
+
yield* emitted2(await writer.text(`${prefix}${header.display[index]}
|
|
1404
|
+
`), budget);
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
if (headers.length > 1) {
|
|
1408
|
+
const same = [...counts.values()].every((value) => value.count === headers.length);
|
|
1409
|
+
if (same) yield* emitted2(await writer.text("\nAll files have the same headers!\n"), budget);
|
|
1410
|
+
else {
|
|
1411
|
+
budget.hold(counts.size * 32);
|
|
1412
|
+
const divergent = [...counts.values()].filter((value) => value.count < headers.length);
|
|
1413
|
+
await boundedSort(divergent, 32, budget, async (left, right) => {
|
|
1414
|
+
for (let offset = 0; offset < Math.min(left.bytes.length, right.bytes.length); offset++) {
|
|
1415
|
+
budget.work();
|
|
1416
|
+
const difference = left.bytes[offset] - right.bytes[offset];
|
|
1417
|
+
if (difference) return difference;
|
|
1418
|
+
if ((offset & 1023) === 0) {
|
|
1419
|
+
const c = budget.checkpoint();
|
|
1420
|
+
if (c) await c;
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
return left.bytes.length - right.bytes.length;
|
|
1424
|
+
});
|
|
1425
|
+
yield* emitted2(await writer.text("\nAll files don't have the same headers!\nDiverging headers: "), budget);
|
|
1426
|
+
for (let index = 0; index < divergent.length; index++) yield* emitted2(await writer.text(`${index ? ", " : ""}${divergent[index].display}`), budget);
|
|
1427
|
+
yield* emitted2(await writer.text("\n"), budget);
|
|
1428
|
+
budget.release(counts.size * 32);
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
budget.release(counts.size * 32);
|
|
1432
|
+
} finally {
|
|
1433
|
+
for (const header of headers) {
|
|
1434
|
+
header.row?.free();
|
|
1435
|
+
budget.release(32);
|
|
1436
|
+
for (const name of header.names) budget.release(name.length * 2 + 32);
|
|
1437
|
+
for (const display of header.display) budget.release(display.length * 2);
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
export {
|
|
1443
|
+
prepareRows
|
|
1444
|
+
};
|