@poe-platform/safe-bash 0.1.800 → 0.1.802
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 +16 -5
- package/dist/image-ast/index.browser.js +122 -76
- package/dist/image-ast/index.js +122 -76
- package/dist/pdf-ast/index.js +4 -3
- package/dist/safe-bash/chunks/chunk-3HQU4OJO.js +13 -0
- package/dist/safe-bash/chunks/{chunk-LUOFIVNI.js → chunk-3NDIFSNM.js} +3 -3
- package/dist/safe-bash/chunks/{chunk-4SEW2Q6H.js → chunk-3R3AANOR.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-K4YMYFRJ.js → chunk-44ALJ4QG.js} +5809 -7424
- package/dist/safe-bash/chunks/{chunk-KHMGTPD6.js → chunk-46Z5E5EV.js} +2 -2
- package/dist/safe-bash/chunks/chunk-4BSJLKNM.js +14 -0
- package/dist/safe-bash/chunks/chunk-4D4N7IU2.js +47 -0
- package/dist/safe-bash/chunks/chunk-55YJASTN.js +14 -0
- 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-7ZBU7KYV.js +14 -0
- 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-QVSRRNZT.js → chunk-BJA5XNP6.js} +6 -6
- 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-BHJE5LPZ.js → chunk-D3ANYGMC.js} +1 -1
- package/dist/safe-bash/chunks/chunk-DQP3VHSB.js +15 -0
- package/dist/safe-bash/chunks/{chunk-NLAW7KDI.js → chunk-E7OYNDGL.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-SOZK5JVX.js → chunk-FBUCWVTE.js} +1 -1
- package/dist/safe-bash/chunks/chunk-FZE4HW6G.js +11 -0
- package/dist/safe-bash/chunks/chunk-GEG3BWGE.js +14 -0
- package/dist/safe-bash/chunks/{chunk-HHW7MGS2.js → chunk-GETUOD5D.js} +4 -4
- package/dist/safe-bash/chunks/chunk-HBCN24ZA.js +50 -0
- package/dist/safe-bash/chunks/chunk-HZ7BWKQ3.js +13 -0
- package/dist/safe-bash/chunks/{chunk-JJSTTIEZ.js → chunk-HZAMGT5I.js} +3 -3
- package/dist/safe-bash/chunks/{chunk-KCVSVD65.js → chunk-I5HZ4FGE.js} +1 -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-K2VCOJ2B.js → chunk-K6VCD7IY.js} +7 -12
- package/dist/safe-bash/chunks/chunk-KDNSPLII.js +83 -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-KW24TAIU.js → chunk-NQCM3TYR.js} +922 -658
- package/dist/safe-bash/chunks/{chunk-VYZTG3GV.js → chunk-NZQXYWA3.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-TFGRKY43.js → chunk-OQRVVGR6.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-PPYM75Z3.js → chunk-OV6IHKO6.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-TYD7EVUJ.js → chunk-PH63PLPZ.js} +8 -8
- package/dist/safe-bash/chunks/chunk-QGUV42T5.js +44 -0
- package/dist/safe-bash/chunks/chunk-R3NAKOED.js +51 -0
- package/dist/safe-bash/chunks/chunk-RRR7AQ24.js +38 -0
- package/dist/safe-bash/chunks/{chunk-RKKRJ54E.js → chunk-RSTHLAF3.js} +30 -23
- package/dist/safe-bash/chunks/{chunk-RMWLWH7Q.js → chunk-SHEMU2Z7.js} +378 -1148
- package/dist/safe-bash/chunks/{chunk-7YSRXFEG.js → chunk-TFIBK2GI.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-I7L3G3NX.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-6HZYFL3H.js → chunk-VKNVHEX3.js} +2 -7
- package/dist/safe-bash/chunks/chunk-VSAJ4OTM.js +962 -0
- package/dist/safe-bash/chunks/{chunk-46UISJCK.js → chunk-VTH3MLDU.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-JTLSUJ7V.js → chunk-WDLGKIHD.js} +56 -39
- package/dist/safe-bash/chunks/chunk-XAQMU6OY.js +14 -0
- package/dist/safe-bash/chunks/{chunk-LLZCZ24K.js → chunk-XVOSKJE2.js} +1 -1
- package/dist/safe-bash/chunks/chunk-ZVD5IS4V.js +49 -0
- package/dist/safe-bash/chunks/{csvkit-QGP3GAOB.js → csvkit-TACDU7FC.js} +3 -3
- package/dist/safe-bash/chunks/{ffmpeg-JTVH26MK.js → ffmpeg-WTC3TEFI.js} +2 -2
- package/dist/safe-bash/chunks/{gh-I7QX7N5C.js → gh-6WU6PXL4.js} +2 -2
- package/dist/safe-bash/chunks/{git-MA7NKYVP.js → git-EFZIGJW4.js} +2 -2
- package/dist/safe-bash/chunks/{imagemagick-Y4NPWX2Q.js → imagemagick-EIEYGWPF.js} +2 -2
- package/dist/safe-bash/chunks/{implementation-BWDKOVQJ.js → implementation-MLFHUQ5M.js} +2 -2
- package/dist/safe-bash/chunks/{mmdc-44PELHDG.js → mmdc-ROQJT5HQ.js} +2 -2
- package/dist/safe-bash/chunks/{pdfimages-635TRW4Q.js → pdfimages-DW7LWXFI.js} +2 -2
- package/dist/safe-bash/chunks/{pdfinfo-FSDAA2KY.js → pdfinfo-TIP6XLUQ.js} +2 -2
- package/dist/safe-bash/chunks/{pdftk-GQ5UH3VG.js → pdftk-DMG22ITZ.js} +2 -2
- package/dist/safe-bash/chunks/{pdftoppm-YTXQCAYT.js → pdftoppm-WNDYR72T.js} +2 -2
- package/dist/safe-bash/chunks/{pdftotext-CVA2G7FY.js → pdftotext-5IPZ4NI7.js} +2 -2
- package/dist/safe-bash/chunks/{qpdf-HZMIFG4A.js → qpdf-TTX2DIUA.js} +2 -2
- package/dist/safe-bash/chunks/{sips-E7UBDP33.js → sips-XYS46JPJ.js} +2 -2
- package/dist/safe-bash/chunks/{soffice-ELASUWUK.js → soffice-TU73E5KL.js} +2 -2
- package/dist/safe-bash/chunks/{wkhtmltopdf-EPO6YCMG.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-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-5LSGEIZY.js → chunk-3HHCU5YU.js} +4 -3
- package/dist/safe-bash/command-chunks/{chunk-TF6OA2GK.js → chunk-3NV3HYT2.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-2QHG43WJ.js → chunk-4BB2SWJ5.js} +1 -1
- 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-YMONDXET.js → chunk-4ZQWGOZB.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-L6DVEBW3.js → chunk-5BSTFCXG.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-Q3DII3Q7.js → chunk-5PWJG2UK.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-JMPP4TCW.js → chunk-5UBXNSFZ.js} +3 -2
- package/dist/safe-bash/command-chunks/{chunk-3NG75MOB.js → chunk-67GQA75T.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-L6SU4S26.js → chunk-6B7WQIKB.js} +0 -7
- package/dist/safe-bash/command-chunks/{chunk-V6MSPQLA.js → chunk-6BNTBWIK.js} +4 -39
- package/dist/safe-bash/command-chunks/{chunk-SAMH7SQE.js → chunk-6GWJUQAV.js} +237 -145
- package/dist/safe-bash/command-chunks/{chunk-JN7WIP6S.js → chunk-6KJ3LPI2.js} +2 -2
- 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-MRW5HD2D.js → chunk-7O3E4LPT.js} +4 -22
- package/dist/safe-bash/command-chunks/{chunk-TEVJJPTC.js → chunk-7U7EXOXX.js} +1 -1
- 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/{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-CKXV2CLD.js → chunk-ARBYOQUZ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-44AHAB5O.js → chunk-BDSMROQZ.js} +1 -4
- package/dist/safe-bash/command-chunks/{chunk-53P53XFM.js → chunk-BPE5INLI.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-OT4LZMLB.js → chunk-BR73BIOW.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-WB5SVIG7.js → chunk-C5YYCQHW.js} +498 -88
- package/dist/safe-bash/command-chunks/{chunk-EUSPTFAX.js → chunk-CAP7ZJSY.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-DWFLVJC6.js → chunk-CCRHMAU5.js} +2 -1
- package/dist/safe-bash/command-chunks/{chunk-GI4CJED2.js → chunk-CQTRW45K.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-KKG4BAFZ.js → chunk-DIEPXUM4.js} +6 -0
- package/dist/safe-bash/command-chunks/{chunk-QJAFJP2G.js → chunk-DZCY63VJ.js} +12 -10
- package/dist/safe-bash/command-chunks/{chunk-QUENU6GM.js → chunk-E55UKBIE.js} +3 -3
- 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-E2LB7FRT.js → chunk-FXOA7RBK.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-QWIDNAAK.js → chunk-FZTK4MFI.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-K543PB3I.js → chunk-G66QUHIZ.js} +6 -35
- package/dist/safe-bash/command-chunks/{chunk-YJDV76GL.js → chunk-GFQZCKO6.js} +29 -19
- package/dist/safe-bash/command-chunks/{chunk-FKKB5X5V.js → chunk-GOB777HR.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-IYPAQ7PH.js → chunk-GRBWW4SG.js} +6 -0
- package/dist/safe-bash/command-chunks/{chunk-EFANWIHL.js → chunk-GY3BWK7K.js} +1 -0
- package/dist/safe-bash/command-chunks/{chunk-PPNBNFAU.js → chunk-GYQ2HAKQ.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-PJJUYO3R.js → chunk-II77KPZN.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-VL67NWNS.js → chunk-JDYXY44P.js} +2 -2
- 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-BKCNF5U3.js → chunk-KQLD3AED.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-UMDIOL3O.js → chunk-KXU3IRUO.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-QZF3SINC.js → chunk-LAOM65EE.js} +2 -2
- 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-U6G67N23.js → chunk-MIXBO6U7.js} +18 -5
- package/dist/safe-bash/command-chunks/{chunk-JQ74HC37.js → chunk-MQFIPHIQ.js} +23 -50
- 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-RVLO4DYT.js → chunk-N4PFUSRM.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-WBNZ4PRE.js → chunk-NGG2XL56.js} +7 -4
- package/dist/safe-bash/command-chunks/{chunk-D4OP2BR3.js → chunk-NKFYQSES.js} +1 -2
- package/dist/safe-bash/command-chunks/{chunk-NGWB2YBL.js → chunk-O4JQSB7O.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-GLOZX57Y.js → chunk-OQKC5ZU2.js} +23 -114
- package/dist/safe-bash/command-chunks/{chunk-7L24L4UO.js → chunk-OQU6UT6X.js} +2 -20
- package/dist/safe-bash/command-chunks/{chunk-TYCGMRLM.js → chunk-OYYV7ZAF.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-SVULUDOP.js → chunk-P2N33UMN.js} +20 -81
- package/dist/safe-bash/command-chunks/{chunk-Q7Q5GM5S.js → chunk-P5APDEFB.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-3HXDA5PT.js → chunk-PMBFZXTK.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-4Y3WVMK4.js → chunk-PV66YWHB.js} +1 -0
- package/dist/safe-bash/command-chunks/{chunk-AXK3H4PX.js → chunk-QJ33BHI4.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-3LSOYLNV.js → chunk-QKFSRZGQ.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-JZSNU2MY.js → chunk-QKJLP53H.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-LC2MFKT4.js → chunk-RMWQAAO5.js} +24 -25
- package/dist/safe-bash/command-chunks/{chunk-QDTBMSBE.js → chunk-RO62EWX6.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-4C6QI5BQ.js → chunk-RZZI24ZE.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-PFAADCB5.js → chunk-SDNBCQ3X.js} +10 -24
- package/dist/safe-bash/command-chunks/{chunk-36O5OT7E.js → chunk-T35Y7YQD.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-6HMX4CQS.js → chunk-TGSNCQSR.js} +44 -16
- package/dist/safe-bash/command-chunks/{chunk-5T7CRJHW.js → chunk-TIOCQVUQ.js} +4 -7
- package/dist/safe-bash/command-chunks/{chunk-GN2TKLE7.js → chunk-TS65BJHG.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-7RGB363W.js → chunk-TSCGT46G.js} +3 -2
- package/dist/safe-bash/command-chunks/{chunk-KBEURXFF.js → chunk-UN6WS55J.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-SX2X3IH4.js → chunk-V2V5OCL3.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-ERYJLO6G.js → chunk-V7A7DRTU.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-5SHGJ7NO.js → chunk-VA5ZHYYA.js} +73 -33
- package/dist/safe-bash/command-chunks/{chunk-XETLEHZP.js → chunk-VPR5LQYX.js} +3 -2
- package/dist/safe-bash/command-chunks/{chunk-3DT2YOGW.js → chunk-VSRGNQCP.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-N2F74VRO.js → chunk-VT6MJBEI.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-J5SN3PZ3.js → chunk-VXSLJH7G.js} +53 -3
- package/dist/safe-bash/command-chunks/{chunk-PXYOWWMV.js → chunk-W7RAD4EW.js} +4 -3
- package/dist/safe-bash/command-chunks/{chunk-YGC6OS5O.js → chunk-WECIOOQB.js} +5 -8
- 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-Z7RVSD5K.js → chunk-WVHONVZ4.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-HLGKIZ25.js → chunk-X54L3DBL.js} +6 -9
- package/dist/safe-bash/command-chunks/{chunk-QNIMV57G.js → chunk-XNLFHHOC.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-XAFSZDY2.js → chunk-XS72HTMA.js} +11 -0
- package/dist/safe-bash/command-chunks/{chunk-KYSPGS33.js → chunk-YIQACGEW.js} +2 -0
- package/dist/safe-bash/command-chunks/{chunk-NAY27PXB.js → chunk-YOFC45RK.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-T5H5UJQ3.js → chunk-YVNGTIJO.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-QI7LGHJJ.js → chunk-Z45N42QC.js} +21 -6
- package/dist/safe-bash/command-chunks/{chunk-67IQF5GC.js → chunk-ZYHTWNAE.js} +23 -9
- package/dist/safe-bash/command-chunks/{chunk-STC3LEWJ.js → chunk-ZYXH3B66.js} +5 -3
- package/dist/safe-bash/commands/apply-patch/index.browser.js +14 -0
- package/dist/safe-bash/commands/archive/index.browser.js +36 -0
- package/dist/safe-bash/commands/bytes/compression/index.js +3 -2
- package/dist/safe-bash/commands/column/index.browser.js +12 -0
- 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/docx/index.browser.js +1 -1
- package/dist/safe-bash/commands/du/index.browser.js +14 -0
- package/dist/safe-bash/commands/execution.js +19 -13
- package/dist/safe-bash/commands/expr/index.browser.js +12 -0
- package/dist/safe-bash/commands/factor/index.browser.js +2 -2
- package/dist/safe-bash/commands/file/index.browser.js +14 -0
- package/dist/safe-bash/commands/filesystem.d.ts +1 -1
- package/dist/safe-bash/commands/filesystem.js +26 -15
- package/dist/safe-bash/commands/getopt/index.browser.js +2 -2
- package/dist/safe-bash/commands/grep-aliases/index.browser.js +14 -0
- package/dist/safe-bash/commands/hexdump/index.browser.js +2 -2
- package/dist/safe-bash/commands/html-to-markdown/index.browser.js +16 -0
- 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/llm/index.browser.js +2 -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/index.browser.js +21 -0
- package/dist/safe-bash/commands/network/curl.d.ts +1 -1
- package/dist/safe-bash/commands/network/curl.js +1 -3
- package/dist/safe-bash/commands/network/index.browser.js +4 -4
- 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/public.d.ts +2 -2
- package/dist/safe-bash/commands/network/public.js +2 -2
- package/dist/safe-bash/commands/network/transport.js +2 -2
- package/dist/safe-bash/commands/network/wget.d.ts +1 -1
- package/dist/safe-bash/commands/network/wget.js +1 -3
- package/dist/safe-bash/commands/node/filesystem.js +3 -2
- package/dist/safe-bash/commands/node/index.browser.js +8 -8
- package/dist/safe-bash/commands/node/types.js +1 -1
- package/dist/safe-bash/commands/op/index.browser.js +3 -3
- package/dist/safe-bash/commands/pr/index.browser.js +2 -2
- 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/manifest.d.ts +1 -0
- package/dist/safe-bash/commands/python/manifest.js +6 -3
- 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/public.browser.js +8 -6
- package/dist/safe-bash/commands/safejs/runtime.js +16 -7
- package/dist/safe-bash/commands/split/index.browser.js +14 -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/stream-format/index.browser.js +11 -0
- package/dist/safe-bash/commands/stream-inspection/index.browser.js +11 -0
- package/dist/safe-bash/commands/streams.js +11 -29
- package/dist/safe-bash/commands/table-text/index.browser.js +11 -0
- package/dist/safe-bash/commands/text.js +269 -496
- package/dist/safe-bash/commands/time-env/index.browser.js +15 -0
- package/dist/safe-bash/commands/tree/index.browser.js +14 -0
- package/dist/safe-bash/commands/tsort/index.browser.js +2 -2
- package/dist/safe-bash/commands/xml/index.browser.js +2 -2
- package/dist/safe-bash/commands/yq/index.browser.js +2 -2
- package/dist/safe-bash/core.browser.js +1 -1
- package/dist/safe-bash/core.d.ts +6 -1
- package/dist/safe-bash/core.js +1 -1
- package/dist/safe-bash/full-core.browser.js +308 -295
- package/dist/safe-bash/jobs.browser.js +5 -5
- package/dist/safe-bash/opt-in/commands/dd/index.js +2 -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 -15
- 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 +41 -27
- package/dist/safe-bash/registry-entry.browser.js +42 -28
- package/dist/safe-bash/search.browser.js +48 -0
- package/dist/safe-bash/shell/arrays/bindings.js +1 -1
- 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/parser.js +8 -1
- package/dist/safe-bash/shell/runtime.d.ts +4 -13
- package/dist/safe-bash/shell/runtime.js +334 -1049
- package/dist/safe-bash/shell/shell.js +2 -54
- package/dist/safe-bash/shell-entry.browser.js +35 -26
- package/dist/safe-bash/trap.browser.js +4 -4
- 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 +3 -3
- 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/awk-inspection.js +2 -2
- package/dist/safe-bash-command-awk/awk-runtime.js +3 -3
- package/dist/safe-bash-command-awk/awk-syntax.d.ts +1 -1
- package/dist/safe-bash-command-awk/awk-syntax.js +2 -2
- package/dist/safe-bash-command-awk/awk-values.js +1 -1
- package/dist/safe-bash-command-awk/awk.js +5 -5
- package/dist/safe-bash-command-awk/index.js +5 -5
- package/dist/safe-bash-command-bc/index.d.ts +2 -0
- package/dist/safe-bash-command-bc/index.js +123 -92
- 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-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/index.js +9 -9
- package/dist/safe-bash-command-csvkit/sync-support.js +1 -1
- package/dist/safe-bash-command-curl/curl.js +1 -1
- package/dist/safe-bash-command-curl/index.js +1 -1
- package/dist/safe-bash-command-dd/index.js +2 -0
- package/dist/safe-bash-command-diff/diff.js +1 -1
- package/dist/safe-bash-command-diff/index.js +1 -1
- package/dist/safe-bash-command-exiftool/index.d.ts +1 -0
- package/dist/safe-bash-command-fd/index.js +9 -9
- package/dist/safe-bash-command-ffmpeg/index.js +31 -8
- package/dist/safe-bash-command-file/index.js +1 -1
- package/dist/safe-bash-command-file/shared.js +1 -1
- package/dist/safe-bash-command-find/find.js +1 -1
- package/dist/safe-bash-command-find/index.js +1 -1
- package/dist/safe-bash-command-gzip/index.js +3 -2
- 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 +6 -6
- 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 +27 -9
- 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 +24 -6
- 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-mmdc/index.d.ts +1 -0
- package/dist/safe-bash-command-nl/index.js +1 -1
- package/dist/safe-bash-command-nl/nl.js +1 -1
- 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 +1 -1
- package/dist/safe-bash-command-pandoc/index.js +1 -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-pathchk/index.js +3 -13
- package/dist/safe-bash-command-pdfimages/index.js +27 -11
- package/dist/safe-bash-command-pdfinfo/index.js +19 -10
- package/dist/safe-bash-command-pdftk/index.js +3 -3
- package/dist/safe-bash-command-pdftoppm/index.js +26 -10
- package/dist/safe-bash-command-pdftotext/index.js +27 -13
- package/dist/safe-bash-command-qpdf/index.js +5 -5
- package/dist/safe-bash-command-rg/index.js +1 -1
- package/dist/safe-bash-command-rg/rg-command.d.ts +0 -1
- package/dist/safe-bash-command-rg/rg-command.js +3 -5
- package/dist/safe-bash-command-sed/index.js +1 -1
- package/dist/safe-bash-command-sed/sed.js +1 -1
- 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-soffice/index.js +20 -16
- 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 +6 -0
- package/dist/safe-bash-command-sqlite3/index.js +284 -85
- 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 +8 -8
- 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 +8 -8
- package/dist/safe-bash-command-ssconvert/index.js +20 -20
- package/dist/safe-bash-command-tar/extract.js +1 -1
- package/dist/safe-bash-command-tar/index.js +5 -4
- package/dist/safe-bash-command-tar/modes.js +2 -2
- 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-unexpand/index.js +1 -1
- package/dist/safe-bash-command-unexpand/unexpand.js +1 -1
- package/dist/safe-bash-command-unrtf/index.js +14 -7
- package/dist/safe-bash-command-unzip/index.js +1 -1
- package/dist/safe-bash-command-unzip/unzip.js +1 -1
- package/dist/safe-bash-command-wget/index.js +1 -1
- package/dist/safe-bash-command-wget/wget.js +1 -1
- package/dist/safe-bash-command-xan/argv.d.ts +1 -1
- package/dist/safe-bash-command-xan/argv.js +1 -1
- package/dist/safe-bash-command-xan/commands.js +5 -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 +7 -7
- package/dist/safe-bash-command-xan/io.js +3 -3
- package/dist/safe-bash-command-xmllint/index.js +1 -1
- 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 +8 -0
- package/dist/safe-bash-command-yq/query.js +1 -1
- package/dist/safe-bash-command-zip/index.js +1 -1
- package/dist/safe-bash-command-zip/zip.js +1 -1
- package/dist/safe-bash-contracts/escaping.js +3 -3
- package/dist/safe-bash-contracts/filesystem-output.js +2 -2
- package/dist/safe-bash-contracts/index.d.ts +1 -0
- package/dist/safe-bash-contracts/index.js +7 -3
- package/dist/safe-bash-contracts/io.d.ts +4 -1
- package/dist/safe-bash-contracts/io.js +3 -1
- package/dist/safe-bash-contracts/managed-abort.d.ts +10 -0
- package/dist/safe-bash-contracts/output.js +2 -2
- package/dist/safe-bash-diff-engine/index.js +1 -1
- package/dist/safe-bash-diff-engine/shared.d.ts +3 -2
- package/dist/safe-bash-diff-engine/shared.js +1 -1
- package/dist/safe-bash-io-engine/commands/archive/internal.js +5 -23
- package/dist/safe-bash-io-engine/commands/search/requirements.js +2 -2
- package/dist/safe-bash-io-engine/commands/text-programs/shared.js +33 -44
- package/dist/safe-bash-io-engine/internal.js +1 -1
- package/dist/safe-bash-io-engine/shell/pattern.js +1 -1
- package/dist/safe-bash-io-engine/shell/string-operations.js +1 -1
- package/dist/safe-bash-mcp/index.browser.d.ts +155 -35
- package/dist/safe-bash-mcp/index.browser.js +416 -0
- package/dist/safe-bash-mcp/index.d.ts +54 -2
- package/dist/safe-bash-mcp/index.js +286 -90
- package/dist/safe-bash-network-engine/aggregate.js +2 -2
- package/dist/safe-bash-network-engine/args.js +4 -4
- package/dist/safe-bash-network-engine/authorizer.js +1 -1
- package/dist/safe-bash-network-engine/body.js +6 -6
- package/dist/safe-bash-network-engine/decode.d.ts +1 -1
- package/dist/safe-bash-network-engine/decode.js +3 -4
- package/dist/safe-bash-network-engine/fetch-transport.js +3 -3
- package/dist/safe-bash-network-engine/form-content-type.js +2 -2
- package/dist/safe-bash-network-engine/form-headers.js +2 -2
- package/dist/safe-bash-network-engine/glob.js +1 -1
- package/dist/safe-bash-network-engine/index.js +4 -4
- package/dist/safe-bash-network-engine/input.js +6 -6
- package/dist/safe-bash-network-engine/output.js +2 -2
- package/dist/safe-bash-network-engine/platform-portable.js +3 -3
- package/dist/safe-bash-network-engine/shared.js +2 -2
- package/dist/safe-bash-network-engine/types.d.ts +7 -2
- package/dist/safe-bash-network-engine/types.js +1 -1
- package/dist/safe-bash-network-engine/url.js +2 -2
- package/dist/safe-bash-query-engine/capture.js +3 -3
- package/dist/safe-bash-query-engine/delpaths.js +3 -3
- package/dist/safe-bash-query-engine/formats.js +2 -2
- package/dist/safe-bash-query-engine/index.js +11 -11
- package/dist/safe-bash-query-engine/indices.js +3 -3
- package/dist/safe-bash-query-engine/input.js +1 -1
- package/dist/safe-bash-query-engine/interpreter.js +9 -9
- package/dist/safe-bash-query-engine/parser.js +1 -1
- package/dist/safe-bash-query-engine/query-core.js +11 -11
- package/dist/safe-bash-query-engine/regex.js +4 -4
- package/dist/safe-bash-query-engine/splits.js +5 -5
- package/dist/safe-bash-query-engine/values.js +2 -2
- package/dist/safe-bash-regex-engine/ere/matcher.js +102 -30
- 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 -1
- package/dist/safe-bash-regex-engine/text/budget.js +1 -1
- package/dist/safe-bash-regex-engine/text/regex.d.ts +14 -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/grep.js +189 -227
- 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-playwright-cloudflare/browser-trace-budget.js +6 -2
- 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-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 +68 -12
- package/dist/safe-bash/command-chunks/chunk-KAGBORIC.js +0 -88
- /package/dist/safe-bash/command-chunks/{chunk-BWNXWI33.js → chunk-2LMZVE3I.js} +0 -0
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import {
|
|
2
|
+
HexdumpError,
|
|
3
|
+
raw
|
|
4
|
+
} from "./chunk-DIEPXUM4.js";
|
|
5
|
+
import {
|
|
6
|
+
init_buffer
|
|
7
|
+
} from "./chunk-HX3SHTCE.js";
|
|
8
|
+
|
|
9
|
+
// packages/safe-bash-command-hexdump/src/options.ts
|
|
10
|
+
init_buffer();
|
|
11
|
+
|
|
12
|
+
// packages/safe-bash-command-hexdump/src/custom.ts
|
|
13
|
+
init_buffer();
|
|
14
|
+
|
|
15
|
+
// packages/safe-bash-command-hexdump/src/float.ts
|
|
16
|
+
init_buffer();
|
|
17
|
+
function formatFloat(number2, code, flags, precision, budget) {
|
|
18
|
+
const sign = number2 < 0 || Object.is(number2, -0) ? "-" : flags.includes("+") ? "+" : flags.includes(" ") ? " " : "";
|
|
19
|
+
if (!Number.isFinite(number2)) {
|
|
20
|
+
const special = Number.isNaN(number2) ? "nan" : "inf";
|
|
21
|
+
return sign + (code === code.toUpperCase() ? special.toUpperCase() : special);
|
|
22
|
+
}
|
|
23
|
+
const view = new DataView(new ArrayBuffer(8));
|
|
24
|
+
view.setFloat64(0, Math.abs(number2));
|
|
25
|
+
const bits = view.getBigUint64(0), exponentBits = Number(bits >> 52n & 2047n);
|
|
26
|
+
let coefficient = bits & (1n << 52n) - 1n;
|
|
27
|
+
if (exponentBits) coefficient |= 1n << 52n;
|
|
28
|
+
const binaryExponent = exponentBits ? exponentBits - 1023 - 52 : -1074;
|
|
29
|
+
const scale = binaryExponent < 0 ? -binaryExponent : 0;
|
|
30
|
+
budget.buffered((scale + 64) * 4);
|
|
31
|
+
budget.charge(scale + 64);
|
|
32
|
+
const decimal = (binaryExponent < 0 ? coefficient * 5n ** BigInt(scale) : coefficient << BigInt(binaryExponent)).toString();
|
|
33
|
+
const capacity = (length) => {
|
|
34
|
+
budget.outputCapacity(length + sign.length);
|
|
35
|
+
budget.buffered((length + decimal.length + sign.length) * 6);
|
|
36
|
+
budget.charge(length);
|
|
37
|
+
};
|
|
38
|
+
const round = (keep) => {
|
|
39
|
+
if (keep < 0) return "0";
|
|
40
|
+
if (keep >= decimal.length) {
|
|
41
|
+
capacity(keep);
|
|
42
|
+
return decimal.padEnd(keep, "0");
|
|
43
|
+
}
|
|
44
|
+
const head = decimal.slice(0, keep) || "0";
|
|
45
|
+
const next = decimal[keep];
|
|
46
|
+
let tailNonzero = false;
|
|
47
|
+
for (let index = keep + 1; index < decimal.length; index++) if (decimal[index] !== "0") {
|
|
48
|
+
tailNonzero = true;
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
const up = next > "5" || next === "5" && (tailNonzero || Number(head.at(-1)) % 2 === 1);
|
|
52
|
+
return up ? (BigInt(head) + 1n).toString() : head;
|
|
53
|
+
};
|
|
54
|
+
const digits = precision ?? 6, alternate = flags.includes("#");
|
|
55
|
+
let result;
|
|
56
|
+
if (code === "f") {
|
|
57
|
+
capacity(Math.max(1, decimal.length - scale) + digits + (digits || alternate ? 1 : 0));
|
|
58
|
+
const rounded = round(decimal.length - scale + digits).padStart(digits + 1, "0");
|
|
59
|
+
result = digits ? rounded.slice(0, -digits) + "." + rounded.slice(-digits) : rounded + (alternate ? "." : "");
|
|
60
|
+
} else {
|
|
61
|
+
const general = code === "g" || code === "G";
|
|
62
|
+
const significant = general ? Math.max(1, digits) : digits + 1;
|
|
63
|
+
let exponent = coefficient === 0n ? 0 : decimal.length - scale - 1;
|
|
64
|
+
const keep = general && !alternate ? Math.min(significant, decimal.length) : significant;
|
|
65
|
+
let rounded = coefficient === 0n ? "0" : round(keep);
|
|
66
|
+
if (rounded.length > keep) {
|
|
67
|
+
exponent++;
|
|
68
|
+
rounded = rounded.slice(0, -1);
|
|
69
|
+
}
|
|
70
|
+
if (general && !alternate) {
|
|
71
|
+
while (rounded.length > 1 && rounded.endsWith("0")) rounded = rounded.slice(0, -1);
|
|
72
|
+
} else {
|
|
73
|
+
capacity(significant + 8);
|
|
74
|
+
rounded = rounded.padEnd(significant, "0");
|
|
75
|
+
}
|
|
76
|
+
if (!general || exponent < -4 || exponent >= significant) {
|
|
77
|
+
result = rounded[0] + (rounded.length > 1 || alternate ? "." + rounded.slice(1) : "") + (code === "E" || code === "G" ? "E" : "e") + (exponent < 0 ? "-" : "+") + Math.abs(exponent).toString().padStart(2, "0");
|
|
78
|
+
} else {
|
|
79
|
+
const point = exponent + 1;
|
|
80
|
+
capacity(Math.max(rounded.length, point) + Math.max(0, 1 - point));
|
|
81
|
+
result = point <= 0 ? "0." + "0".repeat(-point) + rounded : point < rounded.length ? rounded.slice(0, point) + "." + rounded.slice(point) : rounded.padEnd(point, "0") + (alternate ? "." : "");
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return sign + result;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// packages/safe-bash-command-hexdump/src/custom.ts
|
|
88
|
+
function parseCustom(text, budget) {
|
|
89
|
+
let at = 0;
|
|
90
|
+
const fail = () => {
|
|
91
|
+
throw new HexdumpError(`bad format: ${text}`);
|
|
92
|
+
};
|
|
93
|
+
const space = () => {
|
|
94
|
+
while (at < text.length && " \n\r".includes(text[at])) at++;
|
|
95
|
+
};
|
|
96
|
+
const integer = () => {
|
|
97
|
+
const start = at;
|
|
98
|
+
while (at < text.length && "0123456789".includes(text[at])) at++;
|
|
99
|
+
if (start === at) return void 0;
|
|
100
|
+
const value = Number(text.slice(start, at));
|
|
101
|
+
if (!Number.isSafeInteger(value)) fail();
|
|
102
|
+
return value;
|
|
103
|
+
};
|
|
104
|
+
const units = [];
|
|
105
|
+
while (at < text.length) {
|
|
106
|
+
space();
|
|
107
|
+
if (at === text.length) break;
|
|
108
|
+
const repeat = integer();
|
|
109
|
+
space();
|
|
110
|
+
let size2;
|
|
111
|
+
if (text[at] === "/") {
|
|
112
|
+
at++;
|
|
113
|
+
space();
|
|
114
|
+
size2 = integer() || void 0;
|
|
115
|
+
space();
|
|
116
|
+
}
|
|
117
|
+
if (text[at++] !== '"') fail();
|
|
118
|
+
const parts = [];
|
|
119
|
+
let literal = "";
|
|
120
|
+
while (at < text.length && text[at] !== '"') {
|
|
121
|
+
budget.charge();
|
|
122
|
+
let ch = text[at++];
|
|
123
|
+
if (ch === "\\") {
|
|
124
|
+
ch = text[at++] ?? fail();
|
|
125
|
+
literal += { a: "\x07", b: "\b", f: "\f", n: "\n", r: "\r", t: " ", v: "\v" }[ch] ?? ch;
|
|
126
|
+
} else if (ch !== "%") literal += ch;
|
|
127
|
+
else if (text[at] === "%") {
|
|
128
|
+
at++;
|
|
129
|
+
literal += "%";
|
|
130
|
+
} else {
|
|
131
|
+
if (literal) {
|
|
132
|
+
parts.push(literal);
|
|
133
|
+
literal = "";
|
|
134
|
+
}
|
|
135
|
+
let flags = "";
|
|
136
|
+
while (at < text.length && "#0- +".includes(text[at])) flags += text[at++];
|
|
137
|
+
const width = integer() ?? 0;
|
|
138
|
+
let precision;
|
|
139
|
+
if (text[at] === ".") {
|
|
140
|
+
at++;
|
|
141
|
+
precision = integer() ?? 0;
|
|
142
|
+
}
|
|
143
|
+
let code = text[at++] ?? fail();
|
|
144
|
+
if (code === "_") {
|
|
145
|
+
code += text[at++] ?? fail();
|
|
146
|
+
if (code === "_a" || code === "_A") code += text[at++] ?? fail();
|
|
147
|
+
}
|
|
148
|
+
if (!["d", "i", "o", "u", "x", "X", "c", "s", "e", "E", "f", "g", "G", "_c", "_p", "_u", "_ad", "_ao", "_ax", "_Ad", "_Ao", "_Ax"].includes(code)) fail();
|
|
149
|
+
const bytes2 = code.startsWith("_a") || code.startsWith("_A") ? 0 : size2 ?? (code === "s" ? precision ?? fail() : ["c", "_c", "_p", "_u"].includes(code) ? 1 : 4);
|
|
150
|
+
if (bytes2 < 0 || code !== "s" && ![0, 1, 2, 4, 8].includes(bytes2)) fail();
|
|
151
|
+
if (["c", "_c", "_p", "_u"].includes(code) && bytes2 !== 1) fail();
|
|
152
|
+
if (["e", "E", "f", "g", "G"].includes(code) && bytes2 !== 4 && bytes2 !== 8) fail();
|
|
153
|
+
budget.check(width, budget.limits.maxBufferedBytes, "format width");
|
|
154
|
+
budget.check(precision ?? 0, budget.limits.maxBufferedBytes, "format precision");
|
|
155
|
+
parts.push({ code, flags, width, ...precision === void 0 ? {} : { precision }, bytes: bytes2 });
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (text[at++] !== '"') fail();
|
|
159
|
+
if (literal) parts.push(literal);
|
|
160
|
+
const conversions = parts.filter((part) => typeof part !== "string" && part.bytes > 0);
|
|
161
|
+
if (size2 !== void 0 && conversions.length > 1) fail();
|
|
162
|
+
const bytes = size2 ?? conversions.reduce((total, part) => total + part.bytes, 0);
|
|
163
|
+
budget.check(bytes * (repeat ?? 1), budget.limits.maxBufferedBytes, "format block");
|
|
164
|
+
units.push({ repeat: repeat ?? 1, explicitRepeat: repeat !== void 0, bytes, parts });
|
|
165
|
+
}
|
|
166
|
+
const size = units.reduce((total, unit) => total + unit.bytes * unit.repeat, 0);
|
|
167
|
+
budget.check(size, budget.limits.maxBufferedBytes, "format block");
|
|
168
|
+
budget.retain(text.length * 2 + units.length * 64);
|
|
169
|
+
const finalUnit = units.findLast((unit) => unit.parts.some((part) => typeof part !== "string" && part.code.startsWith("_A")));
|
|
170
|
+
return { units, size, ...finalUnit ? { finalUnit } : {} };
|
|
171
|
+
}
|
|
172
|
+
var controls = ["nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel", "bs", "ht", "lf", "vt", "ff", "cr", "so", "si", "dle", "dc1", "dc2", "dc3", "dc4", "nak", "syn", "etb", "can", "em", "sub", "esc", "fs", "gs", "rs", "us"];
|
|
173
|
+
function converted(part, block, offset, used, address, budget) {
|
|
174
|
+
const { code, flags, width, precision, bytes } = part;
|
|
175
|
+
budget.buffered(Math.max(width, precision ?? 0) * 6);
|
|
176
|
+
budget.outputCapacity(width);
|
|
177
|
+
budget.charge(width);
|
|
178
|
+
if (bytes && offset >= used) return " ".repeat(width);
|
|
179
|
+
let value = 0n;
|
|
180
|
+
for (let i = code === "s" || ["e", "E", "f", "g", "G"].includes(code) ? -1 : bytes - 1; i >= 0; i--) value = value * 256n + BigInt(offset + i < used ? block[offset + i] : 0);
|
|
181
|
+
let text;
|
|
182
|
+
if (code === "s") {
|
|
183
|
+
let end = Math.min(used, offset + bytes, offset + (precision ?? bytes));
|
|
184
|
+
for (let i = offset; i < end; i++) if (block[i] === 0) {
|
|
185
|
+
end = i;
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
text = raw(block.subarray(offset, end));
|
|
189
|
+
} else if (["c", "_p", "_c", "_u"].includes(code)) {
|
|
190
|
+
const byte = Number(value);
|
|
191
|
+
text = code === "c" ? String.fromCharCode(byte) : code === "_p" ? byte >= 32 && byte <= 126 ? String.fromCharCode(byte) : "." : code === "_u" ? controls[byte] ?? (byte === 127 ? "del" : byte > 127 ? byte.toString(16) : String.fromCharCode(byte)) : { 0: "\\0", 7: "\\a", 8: "\\b", 9: "\\t", 10: "\\n", 11: "\\v", 12: "\\f", 13: "\\r" }[byte] ?? (byte >= 32 && byte <= 126 ? String.fromCharCode(byte) : byte.toString(8).padStart(3, "0"));
|
|
192
|
+
} else if (["e", "E", "f", "g", "G"].includes(code)) {
|
|
193
|
+
const copy = new Uint8Array(bytes);
|
|
194
|
+
copy.set(block.subarray(offset, Math.min(used, offset + bytes)));
|
|
195
|
+
const view = new DataView(copy.buffer), number2 = bytes === 4 ? view.getFloat32(0, true) : view.getFloat64(0, true);
|
|
196
|
+
text = formatFloat(number2, code, flags, precision, budget);
|
|
197
|
+
if (flags.includes("0") && !flags.includes("-") && Number.isFinite(number2)) {
|
|
198
|
+
const signed = text.startsWith("-") || text.startsWith("+") || text.startsWith(" ");
|
|
199
|
+
budget.buffered(Math.max(width, text.length) * 6);
|
|
200
|
+
budget.outputCapacity(Math.max(width, text.length));
|
|
201
|
+
text = signed ? text[0] + text.slice(1).padStart(Math.max(0, width - 1), "0") : text.padStart(width, "0");
|
|
202
|
+
}
|
|
203
|
+
} else {
|
|
204
|
+
const addressCode = code.startsWith("_");
|
|
205
|
+
if (addressCode) value = BigInt(address + offset);
|
|
206
|
+
else if ((code === "d" || code === "i") && value >= 1n << BigInt(bytes * 8 - 1)) value -= 1n << BigInt(bytes * 8);
|
|
207
|
+
const kind = code.at(-1);
|
|
208
|
+
const radix = kind === "x" || kind === "X" ? 16 : kind === "o" ? 8 : 10;
|
|
209
|
+
const sign = value < 0n ? "-" : (code === "d" || code === "i" || code.endsWith("d")) && flags.includes("+") ? "+" : (code === "d" || code === "i" || code.endsWith("d")) && flags.includes(" ") ? " " : "";
|
|
210
|
+
budget.outputCapacity(precision ?? 0);
|
|
211
|
+
budget.charge(precision ?? 0);
|
|
212
|
+
const digits = (value === 0n && precision === 0 ? "" : (value < 0n ? -value : value).toString(radix)).padStart(precision ?? 0, "0");
|
|
213
|
+
const prefix = flags.includes("#") ? radix === 16 && value !== 0n ? "0x" : radix === 8 && !digits.startsWith("0") ? "0" : "" : "";
|
|
214
|
+
text = sign + prefix + digits;
|
|
215
|
+
if (flags.includes("0") && !flags.includes("-") && precision === void 0) text = sign + prefix + digits.padStart(Math.max(0, width - sign.length - prefix.length), "0");
|
|
216
|
+
if (kind === "X") text = text.toUpperCase();
|
|
217
|
+
}
|
|
218
|
+
return flags.includes("-") ? text.padEnd(width, " ") : text.padStart(width, " ");
|
|
219
|
+
}
|
|
220
|
+
async function formatCustom(format, block, used, address, final, budget) {
|
|
221
|
+
let offset = 0, result = "";
|
|
222
|
+
const append = (text) => {
|
|
223
|
+
budget.buffered((result.length + text.length) * 6);
|
|
224
|
+
budget.outputCapacity(result.length + text.length);
|
|
225
|
+
budget.retain(text.length * 2);
|
|
226
|
+
result += text;
|
|
227
|
+
};
|
|
228
|
+
try {
|
|
229
|
+
for (const [index, unit] of format.units.entries()) {
|
|
230
|
+
if (final && unit !== format.finalUnit) continue;
|
|
231
|
+
const isFinal = unit.parts.some((part) => typeof part !== "string" && part.code.startsWith("_A"));
|
|
232
|
+
if (isFinal !== final) {
|
|
233
|
+
if (!final) offset += unit.bytes * unit.repeat;
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
const repeat = !final && index === format.units.length - 1 && !unit.explicitRepeat && unit.bytes && format.size < block.length ? unit.repeat + Math.floor((block.length - format.size) / unit.bytes) : unit.repeat;
|
|
237
|
+
for (let count = 0; count < repeat; count++) {
|
|
238
|
+
budget.charge(unit.bytes + 1);
|
|
239
|
+
const cp = budget.checkpointWork();
|
|
240
|
+
if (cp) await cp;
|
|
241
|
+
let position = offset;
|
|
242
|
+
for (let i = 0; i < unit.parts.length; i++) {
|
|
243
|
+
const part = unit.parts[i];
|
|
244
|
+
if (typeof part === "string") {
|
|
245
|
+
let end = part.length;
|
|
246
|
+
if (count === repeat - 1 && repeat > 1 && i === unit.parts.length - 1) while (end && " ".includes(part[end - 1])) end--;
|
|
247
|
+
append(part.slice(0, end));
|
|
248
|
+
} else {
|
|
249
|
+
append(converted(part, block, position, used, address, budget));
|
|
250
|
+
position += part.bytes;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
offset += unit.bytes;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return result;
|
|
257
|
+
} finally {
|
|
258
|
+
budget.retain(-result.length * 2);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// packages/safe-bash-command-hexdump/src/options.ts
|
|
263
|
+
var usage = "usage: hexdump [-bcCdovx] [-e fmt] [-f fmt_file] [-n length]\n [-s skip] [file ...]\n hd [-bcdovx] [-e fmt] [-f fmt_file] [-n length]\n [-s skip] [file ...]";
|
|
264
|
+
function number(text, skip, dialect) {
|
|
265
|
+
let offset = 0;
|
|
266
|
+
while (offset < text.length && " \n\r\v\f".includes(text[offset])) offset++;
|
|
267
|
+
const negative = text[offset] === "-";
|
|
268
|
+
if (negative || text[offset] === "+") offset++;
|
|
269
|
+
let base = 10;
|
|
270
|
+
if ((skip || dialect === "util-linux") && text[offset] === "0") {
|
|
271
|
+
base = 8;
|
|
272
|
+
if ((text[offset + 1] === "x" || text[offset + 1] === "X") && "0123456789abcdef".includes((text[offset + 2] ?? "!").toLowerCase())) {
|
|
273
|
+
base = 16;
|
|
274
|
+
offset += 2;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
let value = 0;
|
|
278
|
+
const start = offset;
|
|
279
|
+
for (; offset < text.length; offset++) {
|
|
280
|
+
const digit = "0123456789abcdef".indexOf(text[offset].toLowerCase());
|
|
281
|
+
if (digit < 0 || digit >= base) break;
|
|
282
|
+
value = value * base + digit;
|
|
283
|
+
if (!Number.isSafeInteger(value)) throw new HexdumpError(`${text}: numeric value exceeds safe integer range`);
|
|
284
|
+
}
|
|
285
|
+
if (negative && value !== 0) throw new HexdumpError(`${text}: bad ${skip ? "skip" : "length"} value`);
|
|
286
|
+
if (dialect === "util-linux") {
|
|
287
|
+
const suffix = text.slice(offset);
|
|
288
|
+
let multiplier = suffix === "b" ? 512 : 1;
|
|
289
|
+
if (suffix !== "" && suffix !== "b") {
|
|
290
|
+
const power = "KMGTPEZY".indexOf(suffix[0] === "k" ? "K" : suffix[0]) + 1;
|
|
291
|
+
const tail = suffix.slice(1);
|
|
292
|
+
if (!power || tail !== "" && tail !== "B" && tail !== "iB") throw new HexdumpError(`${text}: bad ${skip ? "skip" : "length"} value`);
|
|
293
|
+
multiplier = (tail === "B" ? 1e3 : 1024) ** power;
|
|
294
|
+
}
|
|
295
|
+
if (offset === start || negative) throw new HexdumpError(`${text}: bad ${skip ? "skip" : "length"} value`);
|
|
296
|
+
value *= multiplier;
|
|
297
|
+
} else if (skip) value *= { b: 512, k: 1024, m: 1048576 }[text[offset] ?? ""] ?? 1;
|
|
298
|
+
if (!Number.isSafeInteger(value)) throw new HexdumpError(`${text}: numeric value exceeds safe integer range`);
|
|
299
|
+
return value;
|
|
300
|
+
}
|
|
301
|
+
function parse(budget, name, dialect) {
|
|
302
|
+
const args = budget.arguments();
|
|
303
|
+
const files = [];
|
|
304
|
+
const custom = [];
|
|
305
|
+
const formats = name === "hd" ? ["C"] : [];
|
|
306
|
+
const ordered = [...formats];
|
|
307
|
+
let verbose = false, ended = false, skip = 0, count = Infinity;
|
|
308
|
+
for (let index = 0; index < args.length; index++) {
|
|
309
|
+
const argument = args[index];
|
|
310
|
+
if (!ended && argument === "--") {
|
|
311
|
+
ended = true;
|
|
312
|
+
continue;
|
|
313
|
+
}
|
|
314
|
+
if (ended || argument === "-" || !argument.startsWith("-")) {
|
|
315
|
+
files.push(argument);
|
|
316
|
+
if (budget.context.env.POSIXLY_CORRECT !== void 0) ended = true;
|
|
317
|
+
continue;
|
|
318
|
+
}
|
|
319
|
+
for (let offset = 1; offset < argument.length; offset++) {
|
|
320
|
+
budget.charge();
|
|
321
|
+
const flag = argument[offset];
|
|
322
|
+
if (flag === "v") verbose = true;
|
|
323
|
+
else if (flag === "C" || flag === "b" || flag === "c" || flag === "d" || flag === "o" || flag === "x") {
|
|
324
|
+
if (name === "hd" && flag === "C") throw new HexdumpError(usage, true);
|
|
325
|
+
budget.check(custom.length + formats.length + 1, budget.limits.maxFormats, "format count");
|
|
326
|
+
formats.push(flag);
|
|
327
|
+
ordered.push(flag);
|
|
328
|
+
} else if (flag === "n" || flag === "s") {
|
|
329
|
+
const parameter = argument.slice(offset + 1) || args[++index];
|
|
330
|
+
if (parameter === void 0) throw new HexdumpError(`${name}: option requires an argument -- '${flag}'
|
|
331
|
+
${usage}`, true);
|
|
332
|
+
if (flag === "n") count = number(parameter, false, dialect);
|
|
333
|
+
else skip = number(parameter, true, dialect);
|
|
334
|
+
break;
|
|
335
|
+
} else if (flag === "e") {
|
|
336
|
+
const parameter = argument.slice(offset + 1) || args[++index];
|
|
337
|
+
if (parameter === void 0) throw new HexdumpError("-e requires a format");
|
|
338
|
+
budget.check(custom.length + formats.length + 1, budget.limits.maxFormats, "format count");
|
|
339
|
+
const format = parseCustom(parameter, budget);
|
|
340
|
+
custom.push(format);
|
|
341
|
+
ordered.push(format);
|
|
342
|
+
break;
|
|
343
|
+
} else if (flag === "f") throw new HexdumpError("-f: format files are not supported");
|
|
344
|
+
else throw new HexdumpError(`unsupported option -- '${flag}'`);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
if (ordered.length === 0) ordered.push("default");
|
|
348
|
+
return { ordered, custom, files, formats: formats.length || custom.length ? formats : ["default"], verbose, skip, count, dialect };
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export {
|
|
352
|
+
formatCustom,
|
|
353
|
+
parse
|
|
354
|
+
};
|
|
@@ -68,12 +68,15 @@ function createUnexpandWithSettings(limits) {
|
|
|
68
68
|
const output = new ByteOutput(session);
|
|
69
69
|
let column = 0, initial = true, active = true;
|
|
70
70
|
let pendingStart = 0, pendingCount = 0, pendingTab = false;
|
|
71
|
-
const flushBlanksSlow = async (startPos, convertSingle, firstWait) => {
|
|
71
|
+
const flushBlanksSlow = async (startPos, convertSingle, firstWait, stepCharged = false) => {
|
|
72
72
|
await firstWait;
|
|
73
73
|
let position = startPos;
|
|
74
74
|
while (position < column) {
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
if (!stepCharged) {
|
|
76
|
+
const s = session.step();
|
|
77
|
+
if (s) await s;
|
|
78
|
+
}
|
|
79
|
+
stepCharged = false;
|
|
77
80
|
const stop = nextTab(position);
|
|
78
81
|
if (stop !== void 0 && stop <= column && (stop - position > 1 || convertSingle)) {
|
|
79
82
|
const b = output.byte(9);
|
|
@@ -94,7 +97,7 @@ function createUnexpandWithSettings(limits) {
|
|
|
94
97
|
const convertSingle = initial || pendingCount > 1 || pendingTab;
|
|
95
98
|
while (position < column) {
|
|
96
99
|
const s = session.step();
|
|
97
|
-
if (s) return flushBlanksSlow(position, convertSingle, s);
|
|
100
|
+
if (s) return flushBlanksSlow(position, convertSingle, s, true);
|
|
98
101
|
const stop = nextTab(position);
|
|
99
102
|
if (stop !== void 0 && stop <= column && (stop - position > 1 || convertSingle)) {
|
|
100
103
|
position = stop;
|
|
@@ -115,7 +115,7 @@ var functions = Object.freeze({
|
|
|
115
115
|
limit: [2],
|
|
116
116
|
range: [1, 2, 3],
|
|
117
117
|
join: [1],
|
|
118
|
-
split: [1],
|
|
118
|
+
split: [1, 2],
|
|
119
119
|
splits: [1, 2],
|
|
120
120
|
sub: [2, 3],
|
|
121
121
|
gsub: [2, 3],
|
|
@@ -577,7 +577,6 @@ jq: 1 compile error`, 3);
|
|
|
577
577
|
} while (accept(";"));
|
|
578
578
|
expect(")");
|
|
579
579
|
}
|
|
580
|
-
if (token.text === "split" && args.length === 2) fail("unsupported function split/2");
|
|
581
580
|
const definition2 = definitions.get(`${name}/${args.length}`);
|
|
582
581
|
const parameter = parameters.get(name);
|
|
583
582
|
if (parameter && !args.length) result = parameter;
|
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
// packages/safe-bash-command-rg/src/rg-command.ts
|
|
6
6
|
init_buffer();
|
|
7
7
|
import { utf8ByteLength, bytesFrom } from "../../safe-bash-byte-engine/index.js";
|
|
8
|
-
import {
|
|
8
|
+
import { tryReadMemoryFileViewSync } from "@poe-platform/safe-fs/core";
|
|
9
9
|
import { assertCommandRequirements, collectBytes } from "../../safe-bash-contracts/index.js";
|
|
10
10
|
import { hasYieldCheckpoint } from "../../safe-bash-contracts/yield.js";
|
|
11
11
|
import { chargeRuntimeFileSystemOperation, getRuntimeBackingFileSystem } from "../../safe-bash-contracts/runtime-control.js";
|
|
12
12
|
import { Matcher } from "../../safe-bash-search-engine/matcher.js";
|
|
13
13
|
import { parse, ParsedArguments, SearchError } from "../../safe-bash-search-engine/options.js";
|
|
14
14
|
import { data, elapsed, Printer, stats } from "../../safe-bash-search-engine/output.js";
|
|
15
|
-
import { diagnostic, Limits, lineBatches,
|
|
15
|
+
import { diagnostic, Limits, lineBatches, trySyncLineBatches, OutputClosed, pathFor } from "../../safe-bash-search-engine/shared.js";
|
|
16
16
|
import { Walker } from "../../safe-bash-search-engine/walk.js";
|
|
17
17
|
import { RegexExecutionError, withRegexSession } from "../../safe-bash-regex-engine/execution/portable.js";
|
|
18
18
|
import { inProcessRegexProviders } from "../../safe-bash-regex-engine/execution/protocol.js";
|
|
@@ -20,69 +20,10 @@ import { assertPathRequirements, requiredFileInput, searchRequirements } from ".
|
|
|
20
20
|
import { RESOLVED_EXIT_ONE, RESOLVED_EXIT_ZERO } from "../../safe-bash-io-engine/internal.js";
|
|
21
21
|
var EMPTY_RG_LINES = Object.freeze([]);
|
|
22
22
|
var EMPTY_PATTERNS = Object.freeze([]);
|
|
23
|
-
var EMPTY_SEARCH_OPTIONS = Object.freeze({});
|
|
24
23
|
var DEFAULT_CWD_PATHS = Object.freeze(["."]);
|
|
25
24
|
var DEFAULT_STDIN_PATHS = Object.freeze(["-"]);
|
|
26
25
|
var defaultLimitsTick = Limits.prototype.tick;
|
|
27
26
|
var sharedReadState = { bytesRead: 0, bytesSearched: 0, binaryOffset: null, skipped: false };
|
|
28
|
-
var srcRefSlotMap = /* @__PURE__ */ new WeakMap();
|
|
29
|
-
var srcRefCountMap = /* @__PURE__ */ new WeakMap();
|
|
30
|
-
var srcRefCacheLiteral = new Uint8Array(0);
|
|
31
|
-
var defaultDateNowRg = Date.now;
|
|
32
|
-
var lastRgTreePattern = "";
|
|
33
|
-
var lastRgTreePath = "";
|
|
34
|
-
var lastRgTreeCwd = "";
|
|
35
|
-
var lastRgTreeOutLen = -1;
|
|
36
|
-
var lastRgTreeFound = false;
|
|
37
|
-
var lastRgTreeGen = -1;
|
|
38
|
-
var lastRgTreeDirNames = new Array(8).fill("");
|
|
39
|
-
var lastRgTreeFileNames = new Array(64).fill("");
|
|
40
|
-
function preverifyMemoryRgTree(fastMem) {
|
|
41
|
-
const m = fastMem;
|
|
42
|
-
if (m && m.root?.entries?.size === 1 && m.root.entries._keys?.[0] === "src" && lastRgTreeOutLen >= 0 && lastRgTreePath === "/src") {
|
|
43
|
-
if (tryVerifyAndPopulate64Tree(fastMem, "/src", true)) {
|
|
44
|
-
m._rgTreeVerifiedTick = m.mutationTick ?? 0;
|
|
45
|
-
m._rgTreeVerifiedGen = lastRgTreeGen;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
function tryVerifyAndPopulate64Tree(fastMem, rootPath, verifyOnly) {
|
|
50
|
-
if (verifyOnly && rootPath === "/src" && fastMem._rgTreeVerifiedTick !== void 0 && fastMem._rgTreeVerifiedTick === (fastMem.mutationTick ?? -1) && fastMem._rgTreeVerifiedGen === lastRgTreeGen) {
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
const rootEntries = tryGetMemoryDirectoryEntryNamesSync(fastMem, rootPath);
|
|
54
|
-
if (!rootEntries || rootEntries._next !== 8 || rootEntries.size !== 8) return false;
|
|
55
|
-
const rKeys = rootEntries._keys;
|
|
56
|
-
const rVals = rootEntries._vals;
|
|
57
|
-
for (let d = 0; d < 8; d++) {
|
|
58
|
-
const dName = rKeys[d];
|
|
59
|
-
if (verifyOnly) {
|
|
60
|
-
if (dName !== lastRgTreeDirNames[d]) return false;
|
|
61
|
-
} else {
|
|
62
|
-
lastRgTreeDirNames[d] = dName;
|
|
63
|
-
}
|
|
64
|
-
const dObj = rVals[d];
|
|
65
|
-
if (!dObj || dObj.type !== "directory" || dObj.mode === void 0 || (dObj.mode >> 6 & 4) !== 4) return false;
|
|
66
|
-
const sub = dObj.entries;
|
|
67
|
-
if (!sub || sub._next !== 8 || sub.size !== 8) return false;
|
|
68
|
-
const sKeys = sub._keys;
|
|
69
|
-
const sVals = sub._vals;
|
|
70
|
-
const base = d << 3;
|
|
71
|
-
for (let f = 0; f < 8; f++) {
|
|
72
|
-
const slot = base | f;
|
|
73
|
-
const fName = sKeys[f];
|
|
74
|
-
if (verifyOnly) {
|
|
75
|
-
if (fName !== lastRgTreeFileNames[slot]) return false;
|
|
76
|
-
} else {
|
|
77
|
-
lastRgTreeFileNames[slot] = fName;
|
|
78
|
-
}
|
|
79
|
-
const fObj = sVals[f];
|
|
80
|
-
if (!fObj || fObj.type !== "file" || fObj.mode === void 0 || (fObj.mode >> 6 & 4) !== 4 || fObj.revision !== 0) return false;
|
|
81
|
-
if (fObj.sourceRef === void 0 || srcRefSlotMap.get(fObj.sourceRef) !== slot) return false;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return true;
|
|
85
|
-
}
|
|
86
27
|
var BATCH_SIZE_1 = () => 1;
|
|
87
28
|
var BATCH_SIZE_128 = () => 128;
|
|
88
29
|
var RETURN_TRUE = () => true;
|
|
@@ -114,6 +55,7 @@ function trySearchFileSync(context, args, limits, matcher, printer, target, file
|
|
|
114
55
|
const maxBytes = limits.hasFiniteMaxFileBytes ? limits.maxFileBytes : void 0;
|
|
115
56
|
const view = target.memoryView ?? tryReadMemoryFileViewSync(backing, target.canonicalPath, maxBytes, context.signal);
|
|
116
57
|
if (view === void 0) return void 0;
|
|
58
|
+
context.inputBudget?.check(view.byteLength);
|
|
117
59
|
if (!args.hasInfiniteMaxCount && args.maxCount === 0) {
|
|
118
60
|
totals.searches++;
|
|
119
61
|
return false;
|
|
@@ -122,7 +64,7 @@ function trySearchFileSync(context, args, limits, matcher, printer, target, file
|
|
|
122
64
|
const needAll = args.replacement !== void 0 || args.onlyMatching || args.mode === "matches" || args.stats === true;
|
|
123
65
|
const hasExtYield = hasYieldCheckpoint(context.signal);
|
|
124
66
|
const lit = matcher.literalAsciiBytes;
|
|
125
|
-
if (lit !== void 0 && !args.invert && args.replacement === void 0 && !args.onlyMatching && args.mode !== "matches" && !args.nullData && !args.crlf && binary === "skip" && args.hasInfiniteMaxCount !== false && !hasExtYield && (view.length <= limits.maxLineBytesSmi || view.length <= limits.maxLineBytes) &&
|
|
67
|
+
if (lit !== void 0 && !args.invert && args.replacement === void 0 && !args.onlyMatching && args.mode !== "matches" && !args.nullData && !args.crlf && binary === "skip" && args.hasInfiniteMaxCount !== false && !hasExtYield && (view.length <= limits.maxLineBytesSmi || view.length <= limits.maxLineBytes) && view.indexOf(0) === -1) {
|
|
126
68
|
const firstByte = lit[0];
|
|
127
69
|
const litLen = lit.length;
|
|
128
70
|
let matchedLines2 = 0;
|
|
@@ -130,43 +72,27 @@ function trySearchFileSync(context, args, limits, matcher, printer, target, file
|
|
|
130
72
|
let bytesSearched2 = 0;
|
|
131
73
|
if (!args.stats && !limits.hasExtYield && (args.mode === "count" || args.mode === "with" || args.mode === "without" || args.quiet) && lit.indexOf(10) === -1) {
|
|
132
74
|
bytesSearched2 = view.length;
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
} else {
|
|
144
|
-
const searchEnd = view.length - litLen;
|
|
145
|
-
let pos = 0;
|
|
146
|
-
while (pos <= searchEnd) {
|
|
147
|
-
const index = view.indexOf(firstByte, pos);
|
|
148
|
-
if (index < 0 || index > searchEnd) break;
|
|
149
|
-
let equal = true;
|
|
150
|
-
for (let offset = 1; offset < litLen; offset++) {
|
|
151
|
-
if (view[index + offset] !== lit[offset]) {
|
|
152
|
-
equal = false;
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
if (equal) {
|
|
157
|
-
matchedLines2++;
|
|
158
|
-
matchesCount2++;
|
|
159
|
-
if (args.quiet || args.mode === "with" || args.mode === "without") break;
|
|
160
|
-
const nl = view.indexOf(10, index + litLen);
|
|
161
|
-
if (nl < 0) break;
|
|
162
|
-
pos = nl + 1;
|
|
163
|
-
} else {
|
|
164
|
-
pos = index + 1;
|
|
75
|
+
const searchEnd = view.length - litLen;
|
|
76
|
+
let pos = 0;
|
|
77
|
+
while (pos <= searchEnd) {
|
|
78
|
+
const index = view.indexOf(firstByte, pos);
|
|
79
|
+
if (index < 0 || index > searchEnd) break;
|
|
80
|
+
let equal = true;
|
|
81
|
+
for (let offset = 1; offset < litLen; offset++) {
|
|
82
|
+
if (view[index + offset] !== lit[offset]) {
|
|
83
|
+
equal = false;
|
|
84
|
+
break;
|
|
165
85
|
}
|
|
166
86
|
}
|
|
167
|
-
if (
|
|
168
|
-
|
|
169
|
-
|
|
87
|
+
if (equal) {
|
|
88
|
+
matchedLines2++;
|
|
89
|
+
matchesCount2++;
|
|
90
|
+
if (args.quiet || args.mode === "with" || args.mode === "without") break;
|
|
91
|
+
const nl = view.indexOf(10, index + litLen);
|
|
92
|
+
if (nl < 0) break;
|
|
93
|
+
pos = nl + 1;
|
|
94
|
+
} else {
|
|
95
|
+
pos = index + 1;
|
|
170
96
|
}
|
|
171
97
|
}
|
|
172
98
|
} else {
|
|
@@ -684,14 +610,6 @@ function tryExecuteRgFastSync(context, executor, options) {
|
|
|
684
610
|
const limits = runner.limits;
|
|
685
611
|
limits.resetForRun(context, options);
|
|
686
612
|
limits.speculative = true;
|
|
687
|
-
const cArgs = context.args;
|
|
688
|
-
if (cArgs.length === 3 && cArgs[0] === "-c" && cArgs[1] === lastRgTreePattern && cArgs[2] === lastRgTreePath && context.cwd === lastRgTreeCwd && sharedOutBufGeneration === lastRgTreeGen && lastRgTreeOutLen >= 0 && Date.now === defaultDateNowRg && options.regexExecutor === void 0 && tryVerifyAndPopulate64Tree(fastMem, lastRgTreePath, true)) {
|
|
689
|
-
committing = true;
|
|
690
|
-
if (lastRgTreeOutLen === 0 || limits.flushCachedSharedSync(lastRgTreeOutLen)) {
|
|
691
|
-
return lastRgTreeFound ? RESOLVED_EXIT_ZERO : RESOLVED_EXIT_ONE;
|
|
692
|
-
}
|
|
693
|
-
committing = false;
|
|
694
|
-
}
|
|
695
613
|
const args = parse(context.args, runner.args);
|
|
696
614
|
if (args.help || args.version || args.patternFiles.length !== 0 || args.mode === "json" || !args.quiet && args.mode === "lines" || args.before > 0 || args.after > 0 || args.stats || args.globs.length !== 0 || args.types.length !== 0 || args.ignoreFiles && args.ignorePaths.length !== 0) {
|
|
697
615
|
return void 0;
|
|
@@ -731,14 +649,6 @@ function tryExecuteRgFastSync(context, executor, options) {
|
|
|
731
649
|
}
|
|
732
650
|
return void 0;
|
|
733
651
|
}
|
|
734
|
-
if (cArgs.length === 3 && cArgs[0] === "-c" && totals.searches === 64 && limits.outPos >= 0 && Date.now === defaultDateNowRg && cArgs[2].charCodeAt(0) === 47 && tryVerifyAndPopulate64Tree(fastMem, cArgs[2], false)) {
|
|
735
|
-
lastRgTreePattern = cArgs[1];
|
|
736
|
-
lastRgTreePath = cArgs[2];
|
|
737
|
-
lastRgTreeCwd = context.cwd;
|
|
738
|
-
lastRgTreeOutLen = limits.outPos;
|
|
739
|
-
lastRgTreeFound = runner.found;
|
|
740
|
-
lastRgTreeGen = sharedOutBufGeneration;
|
|
741
|
-
}
|
|
742
652
|
committing = true;
|
|
743
653
|
const flushRes = limits.flushSyncOrAsync();
|
|
744
654
|
if (flushRes === void 0) return runner.found ? RESOLVED_EXIT_ZERO : RESOLVED_EXIT_ONE;
|
|
@@ -1128,7 +1038,6 @@ function createRgCommand(executor, options = {}) {
|
|
|
1128
1038
|
}
|
|
1129
1039
|
|
|
1130
1040
|
export {
|
|
1131
|
-
preverifyMemoryRgTree,
|
|
1132
1041
|
clearRgFastRunnerPool,
|
|
1133
1042
|
createRgCommand
|
|
1134
1043
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
htmlSpace
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WTECBRU4.js";
|
|
4
4
|
import {
|
|
5
5
|
Builder
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-PV66YWHB.js";
|
|
7
7
|
import {
|
|
8
8
|
init_buffer
|
|
9
9
|
} from "./chunk-HX3SHTCE.js";
|
|
@@ -117,24 +117,6 @@ async function escapeText(text, budget, maximum, edges = [false, false], precedi
|
|
|
117
117
|
}
|
|
118
118
|
async function destination(value, image, budget) {
|
|
119
119
|
if (value === void 0) return void 0;
|
|
120
|
-
if (value.length >= 10 && value.length <= 2048 && (value.startsWith("https://") || value.startsWith("http://"))) {
|
|
121
|
-
let cleanUrl = true;
|
|
122
|
-
for (let i = 0; i < value.length; i++) {
|
|
123
|
-
const c = value.charCodeAt(i);
|
|
124
|
-
if (c <= 32 || c >= 127 || c === 37 || c === 38 || c === 92 || c === 40 || c === 41 || c === 60 || c === 62) {
|
|
125
|
-
cleanUrl = false;
|
|
126
|
-
break;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
if (cleanUrl && /^https?:\/\/[A-Za-z0-9]+(?:\.[A-Za-z0-9]+)+(?:\/[A-Za-z0-9._~:@!$'*,;=-]*)?$/u.test(value)) {
|
|
130
|
-
budget.work(value.length * 2);
|
|
131
|
-
{
|
|
132
|
-
const c = budget.checkpoint();
|
|
133
|
-
if (c) await c;
|
|
134
|
-
}
|
|
135
|
-
return value;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
120
|
let first = 0, last = value.length, reference = "none";
|
|
139
121
|
for (let offset = 0; offset < value.length; offset++) {
|
|
140
122
|
budget.work(1);
|