@poe-platform/safe-bash 0.1.800 → 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 +16 -5
- package/dist/image-ast/index.browser.js +119 -75
- package/dist/image-ast/index.js +119 -75
- package/dist/pdf-ast/index.js +4 -3
- 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-HHW7MGS2.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-RMWLWH7Q.js → chunk-7VNF5BFF.js} +300 -737
- package/dist/safe-bash/chunks/{chunk-QVSRRNZT.js → chunk-A7XEHALN.js} +4 -4
- 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-BHJE5LPZ.js → chunk-D3ANYGMC.js} +1 -1
- 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-RKKRJ54E.js → chunk-FNDNHAGE.js} +30 -23
- package/dist/safe-bash/chunks/{chunk-KCVSVD65.js → chunk-I5HZ4FGE.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-JJSTTIEZ.js → chunk-ICFDYV64.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-TYD7EVUJ.js → chunk-IVRQ4BXL.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-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-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-KW24TAIU.js → chunk-PQRAK7HU.js} +920 -432
- package/dist/safe-bash/chunks/{chunk-K4YMYFRJ.js → chunk-SZH7EJLD.js} +116 -697
- 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-JTLSUJ7V.js → chunk-VQDD3G76.js} +42 -25
- package/dist/safe-bash/chunks/{chunk-46UISJCK.js → chunk-VTH3MLDU.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-LLZCZ24K.js → chunk-XVOSKJE2.js} +1 -1
- 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-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-N2F74VRO.js → chunk-CZ7EN3JG.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-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-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-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-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-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-SAMH7SQE.js → chunk-PCEFOYA3.js} +237 -145
- 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-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-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-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-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-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/bytes/compression/index.js +3 -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/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/getopt/index.browser.js +2 -2
- 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/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/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 +4 -4
- package/dist/safe-bash/commands/safejs/runtime.js +16 -7
- 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/text.js +268 -364
- 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 +108 -104
- 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 +11 -11
- 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 -27
- package/dist/safe-bash/registry-entry.browser.js +28 -28
- 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 -4
- package/dist/safe-bash/shell/runtime.js +291 -741
- package/dist/safe-bash/shell/shell.js +2 -31
- package/dist/safe-bash/shell-entry.browser.js +25 -25
- 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-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-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-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 +283 -89
- 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 -0
- 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 +9 -8
- 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
|
@@ -1,101 +1,83 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createFactorCommands
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-AM5ESLPH.js";
|
|
4
4
|
import {
|
|
5
5
|
createHexdumpCommands
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CS4MNM6I.js";
|
|
7
7
|
import {
|
|
8
8
|
createTimeoutCommands
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FBUCWVTE.js";
|
|
10
10
|
import {
|
|
11
11
|
createTsortCommands
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-6PAVEFT3.js";
|
|
13
13
|
import {
|
|
14
14
|
assertCommandRequirements,
|
|
15
15
|
basicCommands,
|
|
16
16
|
cmpCommand,
|
|
17
17
|
createArchiveCommands,
|
|
18
|
-
createBcCommands,
|
|
19
18
|
createCalCommands,
|
|
20
19
|
createChecksumCommands,
|
|
21
20
|
createCompressionCommands,
|
|
22
|
-
createDdCommands,
|
|
23
21
|
createDfCommands,
|
|
24
22
|
createDiffPatchCommands,
|
|
25
23
|
createDuCommands,
|
|
26
|
-
createEnvsubstCommands,
|
|
27
24
|
createFdCommands,
|
|
28
25
|
createFileCommands,
|
|
29
26
|
createFindDefinitions,
|
|
30
|
-
createGetconfCommands,
|
|
31
|
-
createHostnameCommands,
|
|
32
27
|
createHtmlToMarkdownCommands,
|
|
33
|
-
createIdCommands,
|
|
34
28
|
createLessCommands,
|
|
35
|
-
createLocaleCommands,
|
|
36
29
|
createMetadataCommands,
|
|
37
|
-
createNprocCommands,
|
|
38
|
-
createNumfmtCommands,
|
|
39
30
|
createPathchkCommands,
|
|
40
31
|
createRgCommand,
|
|
41
|
-
createShufCommands,
|
|
42
|
-
createSpongeCommands,
|
|
43
|
-
createSqlite3Commands,
|
|
44
|
-
createStreamFormatCommands,
|
|
45
|
-
createStreamInspectionCommands,
|
|
46
32
|
createTimeEnvCommands,
|
|
47
33
|
createTreeCommands,
|
|
48
|
-
createUnameCommands,
|
|
49
34
|
createWhichCommands,
|
|
50
|
-
createWhoamiCommands,
|
|
51
35
|
directExecutor,
|
|
52
36
|
executionCommands,
|
|
53
37
|
filesystemCommands,
|
|
54
38
|
fmtCommand,
|
|
55
|
-
numfmtCommand,
|
|
56
39
|
openFileOutput,
|
|
57
40
|
predicateCommands,
|
|
58
41
|
wcDisplayWidth
|
|
59
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-SZH7EJLD.js";
|
|
60
43
|
import {
|
|
61
44
|
createGetoptCommands
|
|
62
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-AUSNDQTJ.js";
|
|
63
46
|
import {
|
|
64
47
|
createIconvCommands
|
|
65
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-CTVWDACF.js";
|
|
66
49
|
import {
|
|
67
50
|
createDos2unixCommands2 as createDos2unixCommands
|
|
68
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-3R3AANOR.js";
|
|
69
52
|
import {
|
|
70
53
|
createMdqCommand
|
|
71
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-OV6IHKO6.js";
|
|
72
55
|
import {
|
|
73
56
|
compareCopyIdentity,
|
|
74
57
|
compareObservedEntries,
|
|
75
58
|
inputRequirements,
|
|
76
59
|
resolveInputLimit,
|
|
77
60
|
textOutputRequirements
|
|
78
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-XVOSKJE2.js";
|
|
79
62
|
import {
|
|
80
63
|
createXmlCommands
|
|
81
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-C5OWC2TL.js";
|
|
82
65
|
import {
|
|
83
66
|
PublicDiagnostic
|
|
84
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-IVRQ4BXL.js";
|
|
85
68
|
import {
|
|
86
69
|
compareByteArrays,
|
|
87
70
|
decodeBytes,
|
|
88
71
|
encodeBytes,
|
|
89
|
-
equalBytes,
|
|
90
72
|
indexOfBytes
|
|
91
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-D3ANYGMC.js";
|
|
92
74
|
import {
|
|
93
75
|
createPrCommands
|
|
94
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-CHYGPFVM.js";
|
|
95
77
|
import {
|
|
96
78
|
RegexExecutor,
|
|
97
79
|
createBoundedRegexProvider
|
|
98
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-NR3EM4LS.js";
|
|
99
81
|
import {
|
|
100
82
|
Chi,
|
|
101
83
|
HashMD,
|
|
@@ -115,23 +97,23 @@ import {
|
|
|
115
97
|
sha256,
|
|
116
98
|
sha384,
|
|
117
99
|
sha512
|
|
118
|
-
} from "./chunk-
|
|
100
|
+
} from "./chunk-ICFDYV64.js";
|
|
119
101
|
import {
|
|
120
102
|
FsError
|
|
121
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-VTH3MLDU.js";
|
|
122
104
|
import {
|
|
123
105
|
hasYieldCheckpoint,
|
|
124
106
|
monotonicNow,
|
|
125
107
|
yieldTurn
|
|
126
|
-
} from "./chunk-
|
|
108
|
+
} from "./chunk-NZQXYWA3.js";
|
|
127
109
|
import {
|
|
128
110
|
collectBytes,
|
|
129
111
|
createBufferedOutput,
|
|
130
112
|
outputFailure
|
|
131
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-74GHTNJA.js";
|
|
132
114
|
import {
|
|
133
115
|
CommandRegistry
|
|
134
|
-
} from "./chunk-
|
|
116
|
+
} from "./chunk-7R5BDCG7.js";
|
|
135
117
|
import {
|
|
136
118
|
RESOLVED_EXIT_ZERO,
|
|
137
119
|
RETURN_EXIT_ONE,
|
|
@@ -143,11 +125,13 @@ import {
|
|
|
143
125
|
builtInDirectContextExecutors,
|
|
144
126
|
codeOf,
|
|
145
127
|
concatenate,
|
|
128
|
+
decoder,
|
|
146
129
|
define,
|
|
147
130
|
diagnostic,
|
|
148
131
|
encoder,
|
|
149
132
|
input,
|
|
150
133
|
integer,
|
|
134
|
+
isDefaultCommandOptions,
|
|
151
135
|
lines,
|
|
152
136
|
options,
|
|
153
137
|
output,
|
|
@@ -158,10 +142,39 @@ import {
|
|
|
158
142
|
requireOperands,
|
|
159
143
|
syncCommandEvaluators,
|
|
160
144
|
value
|
|
161
|
-
} from "./chunk-
|
|
145
|
+
} from "./chunk-E7OYNDGL.js";
|
|
162
146
|
import {
|
|
163
147
|
init_platform
|
|
164
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-B7TAL7S5.js";
|
|
149
|
+
|
|
150
|
+
// packages/safe-bash/src/commands/numfmt/index.ts
|
|
151
|
+
init_platform();
|
|
152
|
+
import {
|
|
153
|
+
createNumfmtCommand as createRawNumfmtCommand,
|
|
154
|
+
createNumfmtCommands as createRawNumfmtCommands
|
|
155
|
+
} from "../../safe-bash-command-numfmt/index.js";
|
|
156
|
+
import { numfmtCommand, settings } from "../../safe-bash-command-numfmt/index.js";
|
|
157
|
+
function createNumfmtCommand(options2 = {}) {
|
|
158
|
+
return registerDefaultExecutor(createRawNumfmtCommand(options2), options2);
|
|
159
|
+
}
|
|
160
|
+
function createNumfmtCommands(options2 = {}) {
|
|
161
|
+
return registerDefaultExecutors(createRawNumfmtCommands(options2), options2);
|
|
162
|
+
}
|
|
163
|
+
function numfmtCommands(options2 = {}) {
|
|
164
|
+
const commands = createNumfmtCommands(options2);
|
|
165
|
+
const replace = options2.replace ?? false;
|
|
166
|
+
return {
|
|
167
|
+
name: "numfmt-commands",
|
|
168
|
+
setup(host) {
|
|
169
|
+
if (!replace) {
|
|
170
|
+
for (const command4 of commands) {
|
|
171
|
+
if (host.commands.has(command4.name)) throw new Error(`Command already registered: ${command4.name}`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
for (const command4 of commands) host.commands.register(command4, { replace });
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
}
|
|
165
178
|
|
|
166
179
|
// packages/safe-bash/src/commands/text-programs/index.ts
|
|
167
180
|
init_platform();
|
|
@@ -242,11 +255,11 @@ function odCommands(options2 = {}) {
|
|
|
242
255
|
name: "od-commands",
|
|
243
256
|
setup(host) {
|
|
244
257
|
if (!replace) {
|
|
245
|
-
for (const
|
|
246
|
-
if (host.commands.has(
|
|
258
|
+
for (const command4 of commands) {
|
|
259
|
+
if (host.commands.has(command4.name)) throw new Error(`Command already registered: ${command4.name}`);
|
|
247
260
|
}
|
|
248
261
|
}
|
|
249
|
-
for (const
|
|
262
|
+
for (const command4 of commands) host.commands.register(command4, { replace });
|
|
250
263
|
}
|
|
251
264
|
};
|
|
252
265
|
}
|
|
@@ -272,11 +285,11 @@ function xxdCommands(options2 = {}) {
|
|
|
272
285
|
name: "xxd-commands",
|
|
273
286
|
setup(host) {
|
|
274
287
|
if (!replace) {
|
|
275
|
-
for (const
|
|
276
|
-
if (host.commands.has(
|
|
288
|
+
for (const command4 of commands) {
|
|
289
|
+
if (host.commands.has(command4.name)) throw new Error(`Command already registered: ${command4.name}`);
|
|
277
290
|
}
|
|
278
291
|
}
|
|
279
|
-
for (const
|
|
292
|
+
for (const command4 of commands) host.commands.register(command4, { replace });
|
|
280
293
|
}
|
|
281
294
|
};
|
|
282
295
|
}
|
|
@@ -342,11 +355,11 @@ import { createJoinCommand } from "../../safe-bash-command-join/join.js";
|
|
|
342
355
|
|
|
343
356
|
// packages/safe-bash/src/commands/table-text/internal.ts
|
|
344
357
|
init_platform();
|
|
345
|
-
import { Budget as Budget2, Inputs, OrderCheck, RecordReader, argument, command, compare, empty, encode, fail, settings } from "../../safe-bash-table-text-engine/table-text/internal.js";
|
|
358
|
+
import { Budget as Budget2, Inputs, OrderCheck, RecordReader, argument, command, compare, empty, encode, fail, settings as settings2 } from "../../safe-bash-table-text-engine/table-text/internal.js";
|
|
346
359
|
|
|
347
360
|
// packages/safe-bash/src/commands/table-text/index.ts
|
|
348
361
|
function createTableTextCommands(options2 = {}) {
|
|
349
|
-
|
|
362
|
+
settings2(options2);
|
|
350
363
|
const defs = [createPasteCommand(options2), createCommCommand(options2), createJoinCommand(options2)];
|
|
351
364
|
for (let i = 0; i < defs.length; i++) builtInDirectContextExecutors.add(defs[i].execute);
|
|
352
365
|
return defs;
|
|
@@ -361,6 +374,85 @@ function tableTextCommands(options2 = {}) {
|
|
|
361
374
|
} };
|
|
362
375
|
}
|
|
363
376
|
|
|
377
|
+
// packages/safe-bash/src/commands/stream-inspection/index.ts
|
|
378
|
+
init_platform();
|
|
379
|
+
|
|
380
|
+
// packages/safe-bash/src/commands/stream-inspection/tac.ts
|
|
381
|
+
init_platform();
|
|
382
|
+
import { createTacWithSettings } from "../../safe-bash-command-tac/tac.js";
|
|
383
|
+
|
|
384
|
+
// packages/safe-bash/src/commands/stream-inspection/expand.ts
|
|
385
|
+
init_platform();
|
|
386
|
+
import { createExpandWithSettings } from "../../safe-bash-command-expand/expand.js";
|
|
387
|
+
|
|
388
|
+
// packages/safe-bash/src/commands/stream-inspection/index.ts
|
|
389
|
+
import { createFoldCommand } from "../../safe-bash-command-fold/family.js";
|
|
390
|
+
|
|
391
|
+
// packages/safe-bash/src/commands/stream-inspection/strings.ts
|
|
392
|
+
init_platform();
|
|
393
|
+
import { createStringsWithSettings } from "../../safe-bash-command-strings/strings.js";
|
|
394
|
+
|
|
395
|
+
// packages/safe-bash/src/commands/stream-inspection/shared.ts
|
|
396
|
+
init_platform();
|
|
397
|
+
import { ByteOutput, RecordBuffer, Session, command as command2, settings as settings3 } from "../../safe-bash-text-stream-engine/stream-inspection/shared.js";
|
|
398
|
+
|
|
399
|
+
// packages/safe-bash/src/commands/stream-inspection/index.ts
|
|
400
|
+
function createStreamInspectionCommands(options2 = {}) {
|
|
401
|
+
const limits = settings3(options2);
|
|
402
|
+
const defs = [createTacWithSettings(limits), createExpandWithSettings(limits), createFoldCommand(limits), createStringsWithSettings(limits)];
|
|
403
|
+
for (let i = 0; i < defs.length; i++) builtInDirectContextExecutors.add(defs[i].execute);
|
|
404
|
+
return defs;
|
|
405
|
+
}
|
|
406
|
+
function streamInspectionCommands(options2 = {}) {
|
|
407
|
+
const commands = createStreamInspectionCommands(options2);
|
|
408
|
+
return { name: "stream-inspection-commands", setup(host) {
|
|
409
|
+
if (!options2.replace) for (const definition of commands) {
|
|
410
|
+
if (host.commands.has(definition.name)) throw new Error(`Command already registered: ${definition.name}`);
|
|
411
|
+
}
|
|
412
|
+
for (const definition of commands) host.commands.register(definition, { replace: options2.replace ?? false });
|
|
413
|
+
} };
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
// packages/safe-bash/src/commands/stream-format/index.ts
|
|
417
|
+
init_platform();
|
|
418
|
+
|
|
419
|
+
// packages/safe-bash/src/commands/stream-format/seq.ts
|
|
420
|
+
init_platform();
|
|
421
|
+
import { createSeqWithSettings } from "../../safe-bash-command-seq/seq.js";
|
|
422
|
+
|
|
423
|
+
// packages/safe-bash/src/commands/stream-format/nl.ts
|
|
424
|
+
init_platform();
|
|
425
|
+
import { createNlWithSettings } from "../../safe-bash-command-nl/nl.js";
|
|
426
|
+
|
|
427
|
+
// packages/safe-bash/src/commands/stream-format/rev.ts
|
|
428
|
+
init_platform();
|
|
429
|
+
import { createRevWithSettings } from "../../safe-bash-command-rev/rev.js";
|
|
430
|
+
|
|
431
|
+
// packages/safe-bash/src/commands/stream-format/unexpand.ts
|
|
432
|
+
init_platform();
|
|
433
|
+
import { createUnexpandWithSettings } from "../../safe-bash-command-unexpand/unexpand.js";
|
|
434
|
+
|
|
435
|
+
// packages/safe-bash/src/commands/stream-format/shared.ts
|
|
436
|
+
init_platform();
|
|
437
|
+
import { ByteOutput as ByteOutput2, Session as Session2, command as command3, forEachRecord, records, settings as settings4 } from "../../safe-bash-text-stream-engine/stream-format/shared.js";
|
|
438
|
+
|
|
439
|
+
// packages/safe-bash/src/commands/stream-format/index.ts
|
|
440
|
+
function createStreamFormatCommands(options2 = {}) {
|
|
441
|
+
const limits = settings4(options2);
|
|
442
|
+
const defs = [createSeqWithSettings(limits), createNlWithSettings(limits), createRevWithSettings(limits), createUnexpandWithSettings(limits)];
|
|
443
|
+
for (let i = 0; i < defs.length; i++) builtInDirectContextExecutors.add(defs[i].execute);
|
|
444
|
+
return defs;
|
|
445
|
+
}
|
|
446
|
+
function streamFormatCommands(options2 = {}) {
|
|
447
|
+
const commands = createStreamFormatCommands(options2);
|
|
448
|
+
return { name: "stream-format-commands", setup(host) {
|
|
449
|
+
if (!options2.replace) for (const definition of commands) {
|
|
450
|
+
if (host.commands.has(definition.name)) throw new Error(`Command already registered: ${definition.name}`);
|
|
451
|
+
}
|
|
452
|
+
for (const definition of commands) host.commands.register(definition, { replace: options2.replace ?? false });
|
|
453
|
+
} };
|
|
454
|
+
}
|
|
455
|
+
|
|
364
456
|
// packages/safe-bash/src/commands/split/index.ts
|
|
365
457
|
init_platform();
|
|
366
458
|
import { createSplitCommand, createSplitCommands, evalSyncSplit, splitCommands } from "../../safe-bash-command-split/index.js";
|
|
@@ -373,6 +465,112 @@ import { columnCommands, createColumnCommand, createColumnCommands } from "../..
|
|
|
373
465
|
init_platform();
|
|
374
466
|
import { applyPatchCommands, createApplyPatchCommand, createApplyPatchCommands, evalSyncApplyPatch } from "../../safe-bash-command-apply-patch/index.js";
|
|
375
467
|
|
|
468
|
+
// packages/safe-bash/src/commands/bc/index.ts
|
|
469
|
+
init_platform();
|
|
470
|
+
import {
|
|
471
|
+
createBcCommand as createRawBcCommand,
|
|
472
|
+
createBcCommands as createRawBcCommands
|
|
473
|
+
} from "../../safe-bash-command-bc/index.js";
|
|
474
|
+
import { settings as settings5 } from "../../safe-bash-command-bc/index.js";
|
|
475
|
+
function createBcCommand(options2 = {}) {
|
|
476
|
+
return registerDefaultExecutor(createRawBcCommand(options2), options2);
|
|
477
|
+
}
|
|
478
|
+
function createBcCommands(options2 = {}) {
|
|
479
|
+
return registerDefaultExecutors(createRawBcCommands(options2), options2);
|
|
480
|
+
}
|
|
481
|
+
function bcCommands(options2 = {}) {
|
|
482
|
+
const commands = createBcCommands(options2);
|
|
483
|
+
const replace = options2.replace ?? false;
|
|
484
|
+
return {
|
|
485
|
+
name: "bc-commands",
|
|
486
|
+
setup(host) {
|
|
487
|
+
if (!replace) {
|
|
488
|
+
for (const command4 of commands) {
|
|
489
|
+
if (host.commands.has(command4.name)) throw new Error(`Command already registered: ${command4.name}`);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
for (const command4 of commands) host.commands.register(command4, { replace });
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
// packages/safe-bash/src/commands/sponge/index.ts
|
|
498
|
+
init_platform();
|
|
499
|
+
import {
|
|
500
|
+
createSpongeCommand as createRawSpongeCommand,
|
|
501
|
+
createSpongeCommands as createRawSpongeCommands,
|
|
502
|
+
spongeCommands as rawSpongeCommands,
|
|
503
|
+
settings as settings6
|
|
504
|
+
} from "../../safe-bash-command-sponge/index.js";
|
|
505
|
+
function evalSyncSponge(inBytes, opArgs, readFileSync, writeFileSync) {
|
|
506
|
+
let append = false;
|
|
507
|
+
const files = [];
|
|
508
|
+
let endOfOptions = false;
|
|
509
|
+
for (const arg of opArgs) {
|
|
510
|
+
if (!endOfOptions && arg === "--") {
|
|
511
|
+
endOfOptions = true;
|
|
512
|
+
continue;
|
|
513
|
+
}
|
|
514
|
+
if (!endOfOptions && arg === "--append") {
|
|
515
|
+
append = true;
|
|
516
|
+
continue;
|
|
517
|
+
}
|
|
518
|
+
if (!endOfOptions && (arg === "--help" || arg === "-h")) {
|
|
519
|
+
return "Usage: sponge [-a] [FILE]\nSoak up standard input and write to FILE (or stdout).\n";
|
|
520
|
+
}
|
|
521
|
+
if (!endOfOptions && arg === "--version") {
|
|
522
|
+
return "sponge (virtual-bash)\n";
|
|
523
|
+
}
|
|
524
|
+
if (!endOfOptions && arg.startsWith("-") && arg.length > 1) {
|
|
525
|
+
for (let i = 1; i < arg.length; i++) {
|
|
526
|
+
if (arg[i] === "a") append = true;
|
|
527
|
+
else return void 0;
|
|
528
|
+
}
|
|
529
|
+
continue;
|
|
530
|
+
}
|
|
531
|
+
files.push(arg);
|
|
532
|
+
}
|
|
533
|
+
if (files.length > 1) return void 0;
|
|
534
|
+
const payload = inBytes ?? new Uint8Array(0);
|
|
535
|
+
if (files.length === 0 || files[0] === "-") return decoder.decode(payload);
|
|
536
|
+
if (!writeFileSync) return void 0;
|
|
537
|
+
const target = files[0];
|
|
538
|
+
if (append) {
|
|
539
|
+
const existing = readFileSync?.(target) ?? new Uint8Array(0);
|
|
540
|
+
const combined = new Uint8Array(existing.length + payload.length);
|
|
541
|
+
combined.set(existing, 0);
|
|
542
|
+
combined.set(payload, existing.length);
|
|
543
|
+
if (!writeFileSync(target, combined)) return void 0;
|
|
544
|
+
} else {
|
|
545
|
+
if (!writeFileSync(target, payload)) return void 0;
|
|
546
|
+
}
|
|
547
|
+
return "";
|
|
548
|
+
}
|
|
549
|
+
syncCommandEvaluators.evalSyncSponge = evalSyncSponge;
|
|
550
|
+
function createSpongeCommand(options2 = {}) {
|
|
551
|
+
const def = createRawSpongeCommand(options2);
|
|
552
|
+
if (isDefaultCommandOptions(options2)) builtInDirectContextExecutors.add(def.execute);
|
|
553
|
+
return def;
|
|
554
|
+
}
|
|
555
|
+
function createSpongeCommands(options2 = {}) {
|
|
556
|
+
return createRawSpongeCommands(options2).map((def) => {
|
|
557
|
+
if (isDefaultCommandOptions(options2)) builtInDirectContextExecutors.add(def.execute);
|
|
558
|
+
return def;
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
function spongeCommands(options2 = {}) {
|
|
562
|
+
const plugin = rawSpongeCommands(options2);
|
|
563
|
+
return {
|
|
564
|
+
...plugin,
|
|
565
|
+
setup(host) {
|
|
566
|
+
for (const def of createSpongeCommands(options2)) {
|
|
567
|
+
if (!options2.replace && host.commands.has(def.name)) throw new Error(`Command already registered: ${def.name}`);
|
|
568
|
+
host.commands.register(def, { replace: options2.replace ?? false });
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
|
|
376
574
|
// packages/safe-bash/src/commands/openssl/index.ts
|
|
377
575
|
init_platform();
|
|
378
576
|
|
|
@@ -615,7 +813,7 @@ import {
|
|
|
615
813
|
createOpensslCommand as createRawOpensslCommand,
|
|
616
814
|
createOpensslCommands as createRawOpensslCommands
|
|
617
815
|
} from "../../safe-bash-command-openssl/index.js";
|
|
618
|
-
import { settings as
|
|
816
|
+
import { settings as settings7 } from "../../safe-bash-command-openssl/index.js";
|
|
619
817
|
function isDefaultOpensslOptions(options2) {
|
|
620
818
|
if (!options2) return true;
|
|
621
819
|
return options2.limits === void 0 && options2.maxBufferedBytes === void 0;
|
|
@@ -641,11 +839,11 @@ function opensslCommands(options2 = {}) {
|
|
|
641
839
|
name: "openssl-commands",
|
|
642
840
|
setup(host) {
|
|
643
841
|
if (!replace) {
|
|
644
|
-
for (const
|
|
645
|
-
if (host.commands.has(
|
|
842
|
+
for (const command4 of commands) {
|
|
843
|
+
if (host.commands.has(command4.name)) throw new Error(`Command already registered: ${command4.name}`);
|
|
646
844
|
}
|
|
647
845
|
}
|
|
648
|
-
for (const
|
|
846
|
+
for (const command4 of commands) host.commands.register(command4, { replace });
|
|
649
847
|
}
|
|
650
848
|
};
|
|
651
849
|
}
|
|
@@ -1204,7 +1402,7 @@ import {
|
|
|
1204
1402
|
createSshKeygenCommand as createRawSshKeygenCommand,
|
|
1205
1403
|
createSshCommands as createRawSshCommands
|
|
1206
1404
|
} from "../../safe-bash-command-ssh/index.js";
|
|
1207
|
-
import { settings as
|
|
1405
|
+
import { settings as settings8 } from "../../safe-bash-command-ssh/index.js";
|
|
1208
1406
|
var ED25519_P = 2n ** 255n - 19n;
|
|
1209
1407
|
var ED25519_L = 2n ** 252n + 27742317777372353535851937790883648493n;
|
|
1210
1408
|
var edMod = (a, m = ED25519_P) => (a % m + m) % m;
|
|
@@ -1344,11 +1542,11 @@ function sshCommands(options2 = {}) {
|
|
|
1344
1542
|
name: "ssh-commands",
|
|
1345
1543
|
setup(host) {
|
|
1346
1544
|
if (!replace) {
|
|
1347
|
-
for (const
|
|
1348
|
-
if (host.commands.has(
|
|
1545
|
+
for (const command4 of commands) {
|
|
1546
|
+
if (host.commands.has(command4.name)) throw new Error(`Command already registered: ${command4.name}`);
|
|
1349
1547
|
}
|
|
1350
1548
|
}
|
|
1351
|
-
for (const
|
|
1549
|
+
for (const command4 of commands) host.commands.register(command4, { replace });
|
|
1352
1550
|
}
|
|
1353
1551
|
};
|
|
1354
1552
|
}
|
|
@@ -1699,7 +1897,7 @@ import {
|
|
|
1699
1897
|
createGpgCommand as createRawGpgCommand,
|
|
1700
1898
|
createGpgCommands as createRawGpgCommands
|
|
1701
1899
|
} from "../../safe-bash-command-gpg/index.js";
|
|
1702
|
-
import { settings as
|
|
1900
|
+
import { settings as settings9 } from "../../safe-bash-command-gpg/index.js";
|
|
1703
1901
|
var ED25519_P2 = 2n ** 255n - 19n;
|
|
1704
1902
|
var ED25519_L2 = 2n ** 252n + 27742317777372353535851937790883648493n;
|
|
1705
1903
|
var edMod2 = (a, m = ED25519_P2) => (a % m + m) % m;
|
|
@@ -1808,11 +2006,11 @@ function gpgCommands(options2 = {}) {
|
|
|
1808
2006
|
name: "gpg-commands",
|
|
1809
2007
|
setup(host) {
|
|
1810
2008
|
if (!replace) {
|
|
1811
|
-
for (const
|
|
1812
|
-
if (host.commands.has(
|
|
2009
|
+
for (const command4 of commands) {
|
|
2010
|
+
if (host.commands.has(command4.name)) throw new Error(`Command already registered: ${command4.name}`);
|
|
1813
2011
|
}
|
|
1814
2012
|
}
|
|
1815
|
-
for (const
|
|
2013
|
+
for (const command4 of commands) host.commands.register(command4, { replace });
|
|
1816
2014
|
}
|
|
1817
2015
|
};
|
|
1818
2016
|
}
|
|
@@ -1995,11 +2193,340 @@ ${pgpCrc24(pktBytes)}
|
|
|
1995
2193
|
}
|
|
1996
2194
|
syncCommandEvaluators.evalSyncGpg = evalSyncGpg;
|
|
1997
2195
|
|
|
2196
|
+
// packages/safe-bash/src/commands/id/index.ts
|
|
2197
|
+
init_platform();
|
|
2198
|
+
import {
|
|
2199
|
+
createIdCommand as createRawIdCommand,
|
|
2200
|
+
createIdCommands as createRawIdCommands
|
|
2201
|
+
} from "../../safe-bash-command-id/index.js";
|
|
2202
|
+
import { settings as settings10 } from "../../safe-bash-command-id/index.js";
|
|
2203
|
+
function createIdCommand(options2 = {}) {
|
|
2204
|
+
return registerDefaultExecutor(createRawIdCommand(options2), options2);
|
|
2205
|
+
}
|
|
2206
|
+
function createIdCommands(options2 = {}) {
|
|
2207
|
+
return registerDefaultExecutors(createRawIdCommands(options2), options2);
|
|
2208
|
+
}
|
|
2209
|
+
function idCommands(options2 = {}) {
|
|
2210
|
+
const commands = createIdCommands(options2);
|
|
2211
|
+
const replace = options2.replace ?? false;
|
|
2212
|
+
return {
|
|
2213
|
+
name: "id-commands",
|
|
2214
|
+
setup(host) {
|
|
2215
|
+
if (!replace) {
|
|
2216
|
+
for (const command4 of commands) {
|
|
2217
|
+
if (host.commands.has(command4.name)) throw new Error(`Command already registered: ${command4.name}`);
|
|
2218
|
+
}
|
|
2219
|
+
}
|
|
2220
|
+
for (const command4 of commands) host.commands.register(command4, { replace });
|
|
2221
|
+
}
|
|
2222
|
+
};
|
|
2223
|
+
}
|
|
2224
|
+
|
|
2225
|
+
// packages/safe-bash/src/commands/whoami/index.ts
|
|
2226
|
+
init_platform();
|
|
2227
|
+
import {
|
|
2228
|
+
createWhoamiCommand as createRawWhoamiCommand,
|
|
2229
|
+
createWhoamiCommands as createRawWhoamiCommands
|
|
2230
|
+
} from "../../safe-bash-command-whoami/index.js";
|
|
2231
|
+
import { settings as settings11 } from "../../safe-bash-command-whoami/index.js";
|
|
2232
|
+
function createWhoamiCommand(options2 = {}) {
|
|
2233
|
+
return registerDefaultExecutor(createRawWhoamiCommand(options2), options2);
|
|
2234
|
+
}
|
|
2235
|
+
function createWhoamiCommands(options2 = {}) {
|
|
2236
|
+
return registerDefaultExecutors(createRawWhoamiCommands(options2), options2);
|
|
2237
|
+
}
|
|
2238
|
+
function whoamiCommands(options2 = {}) {
|
|
2239
|
+
const commands = createWhoamiCommands(options2);
|
|
2240
|
+
const replace = options2.replace ?? false;
|
|
2241
|
+
return {
|
|
2242
|
+
name: "whoami-commands",
|
|
2243
|
+
setup(host) {
|
|
2244
|
+
if (!replace) {
|
|
2245
|
+
for (const command4 of commands) {
|
|
2246
|
+
if (host.commands.has(command4.name)) throw new Error(`Command already registered: ${command4.name}`);
|
|
2247
|
+
}
|
|
2248
|
+
}
|
|
2249
|
+
for (const command4 of commands) host.commands.register(command4, { replace });
|
|
2250
|
+
}
|
|
2251
|
+
};
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2254
|
+
// packages/safe-bash/src/commands/uname/index.ts
|
|
2255
|
+
init_platform();
|
|
2256
|
+
import {
|
|
2257
|
+
createUnameCommand as createRawUnameCommand,
|
|
2258
|
+
createUnameCommands as createRawUnameCommands
|
|
2259
|
+
} from "../../safe-bash-command-uname/index.js";
|
|
2260
|
+
import { settings as settings12 } from "../../safe-bash-command-uname/index.js";
|
|
2261
|
+
function createUnameCommand(options2 = {}) {
|
|
2262
|
+
return registerDefaultExecutor(createRawUnameCommand(options2), options2);
|
|
2263
|
+
}
|
|
2264
|
+
function createUnameCommands(options2 = {}) {
|
|
2265
|
+
return registerDefaultExecutors(createRawUnameCommands(options2), options2);
|
|
2266
|
+
}
|
|
2267
|
+
function unameCommands(options2 = {}) {
|
|
2268
|
+
const commands = createUnameCommands(options2);
|
|
2269
|
+
const replace = options2.replace ?? false;
|
|
2270
|
+
return {
|
|
2271
|
+
name: "uname-commands",
|
|
2272
|
+
setup(host) {
|
|
2273
|
+
if (!replace) {
|
|
2274
|
+
for (const command4 of commands) {
|
|
2275
|
+
if (host.commands.has(command4.name)) throw new Error(`Command already registered: ${command4.name}`);
|
|
2276
|
+
}
|
|
2277
|
+
}
|
|
2278
|
+
for (const command4 of commands) host.commands.register(command4, { replace });
|
|
2279
|
+
}
|
|
2280
|
+
};
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
// packages/safe-bash/src/commands/hostname/index.ts
|
|
2284
|
+
init_platform();
|
|
2285
|
+
import {
|
|
2286
|
+
createHostnameCommand as createRawHostnameCommand,
|
|
2287
|
+
createHostnameCommands as createRawHostnameCommands
|
|
2288
|
+
} from "../../safe-bash-command-hostname/index.js";
|
|
2289
|
+
import { settings as settings13 } from "../../safe-bash-command-hostname/index.js";
|
|
2290
|
+
function createHostnameCommand(options2 = {}) {
|
|
2291
|
+
return registerDefaultExecutor(createRawHostnameCommand(options2), options2);
|
|
2292
|
+
}
|
|
2293
|
+
function createHostnameCommands(options2 = {}) {
|
|
2294
|
+
return registerDefaultExecutors(createRawHostnameCommands(options2), options2);
|
|
2295
|
+
}
|
|
2296
|
+
function hostnameCommands(options2 = {}) {
|
|
2297
|
+
const commands = createHostnameCommands(options2);
|
|
2298
|
+
const replace = options2.replace ?? false;
|
|
2299
|
+
return {
|
|
2300
|
+
name: "hostname-commands",
|
|
2301
|
+
setup(host) {
|
|
2302
|
+
if (!replace) {
|
|
2303
|
+
for (const command4 of commands) {
|
|
2304
|
+
if (host.commands.has(command4.name)) throw new Error(`Command already registered: ${command4.name}`);
|
|
2305
|
+
}
|
|
2306
|
+
}
|
|
2307
|
+
for (const command4 of commands) host.commands.register(command4, { replace });
|
|
2308
|
+
}
|
|
2309
|
+
};
|
|
2310
|
+
}
|
|
2311
|
+
|
|
2312
|
+
// packages/safe-bash/src/commands/nproc/index.ts
|
|
2313
|
+
init_platform();
|
|
2314
|
+
import {
|
|
2315
|
+
createNprocCommand as createRawNprocCommand,
|
|
2316
|
+
createNprocCommands as createRawNprocCommands
|
|
2317
|
+
} from "../../safe-bash-command-nproc/index.js";
|
|
2318
|
+
import { settings as settings14 } from "../../safe-bash-command-nproc/index.js";
|
|
2319
|
+
function createNprocCommand(options2 = {}) {
|
|
2320
|
+
return registerDefaultExecutor(createRawNprocCommand(options2), options2);
|
|
2321
|
+
}
|
|
2322
|
+
function createNprocCommands(options2 = {}) {
|
|
2323
|
+
return registerDefaultExecutors(createRawNprocCommands(options2), options2);
|
|
2324
|
+
}
|
|
2325
|
+
function nprocCommands(options2 = {}) {
|
|
2326
|
+
const commands = createNprocCommands(options2);
|
|
2327
|
+
const replace = options2.replace ?? false;
|
|
2328
|
+
return {
|
|
2329
|
+
name: "nproc-commands",
|
|
2330
|
+
setup(host) {
|
|
2331
|
+
if (!replace) {
|
|
2332
|
+
for (const command4 of commands) {
|
|
2333
|
+
if (host.commands.has(command4.name)) throw new Error(`Command already registered: ${command4.name}`);
|
|
2334
|
+
}
|
|
2335
|
+
}
|
|
2336
|
+
for (const command4 of commands) host.commands.register(command4, { replace });
|
|
2337
|
+
}
|
|
2338
|
+
};
|
|
2339
|
+
}
|
|
2340
|
+
|
|
2341
|
+
// packages/safe-bash/src/shuf.ts
|
|
2342
|
+
init_platform();
|
|
2343
|
+
import { createShufCommand, createShufCommands, shufCommands } from "../../safe-bash-command-shuf/index.js";
|
|
2344
|
+
|
|
1998
2345
|
// packages/safe-bash/src/yes.ts
|
|
1999
2346
|
init_platform();
|
|
2000
|
-
import { settings as
|
|
2347
|
+
import { settings as settings15 } from "../../safe-bash-command-yes/index.js";
|
|
2001
2348
|
import { createYesCommand, createYesCommands, yesCommands } from "../../safe-bash-command-yes/index.js";
|
|
2002
2349
|
|
|
2350
|
+
// packages/safe-bash/src/dd.ts
|
|
2351
|
+
init_platform();
|
|
2352
|
+
import {
|
|
2353
|
+
createDdCommand as createRawDdCommand,
|
|
2354
|
+
createDdCommands as createRawDdCommands
|
|
2355
|
+
} from "../../safe-bash-command-dd/index.js";
|
|
2356
|
+
import { evalSyncDd, openDdFile, settings as settings16, transferReport } from "../../safe-bash-command-dd/index.js";
|
|
2357
|
+
function createDdCommand(options2 = {}) {
|
|
2358
|
+
return registerDefaultExecutor(createRawDdCommand(options2), options2);
|
|
2359
|
+
}
|
|
2360
|
+
function createDdCommands(options2 = {}) {
|
|
2361
|
+
return registerDefaultExecutors(createRawDdCommands(options2), options2);
|
|
2362
|
+
}
|
|
2363
|
+
function ddCommands(options2 = {}) {
|
|
2364
|
+
const commands = createDdCommands(options2);
|
|
2365
|
+
const replace = options2.replace ?? false;
|
|
2366
|
+
return {
|
|
2367
|
+
name: "dd-commands",
|
|
2368
|
+
setup(host) {
|
|
2369
|
+
if (!replace) {
|
|
2370
|
+
for (const command4 of commands) {
|
|
2371
|
+
if (host.commands.has(command4.name)) throw new Error(`Command already registered: ${command4.name}`);
|
|
2372
|
+
}
|
|
2373
|
+
}
|
|
2374
|
+
for (const command4 of commands) host.commands.register(command4, { replace });
|
|
2375
|
+
}
|
|
2376
|
+
};
|
|
2377
|
+
}
|
|
2378
|
+
|
|
2379
|
+
// packages/safe-bash/src/commands/envsubst/index.ts
|
|
2380
|
+
init_platform();
|
|
2381
|
+
import {
|
|
2382
|
+
createEnvsubstCommand as createRawEnvsubstCommand,
|
|
2383
|
+
createEnvsubstCommands as createRawEnvsubstCommands,
|
|
2384
|
+
envsubstCommands as rawEnvsubstCommands
|
|
2385
|
+
} from "../../safe-bash-command-envsubst/index.js";
|
|
2386
|
+
import { settings as settings18 } from "../../safe-bash-command-envsubst/index.js";
|
|
2387
|
+
function createEnvsubstCommand(options2 = {}) {
|
|
2388
|
+
const def = createRawEnvsubstCommand(options2);
|
|
2389
|
+
builtInDirectContextExecutors.add(def.execute);
|
|
2390
|
+
return def;
|
|
2391
|
+
}
|
|
2392
|
+
function createEnvsubstCommands(options2 = {}) {
|
|
2393
|
+
const defs = createRawEnvsubstCommands(options2);
|
|
2394
|
+
for (let i = 0; i < defs.length; i++) builtInDirectContextExecutors.add(defs[i].execute);
|
|
2395
|
+
return defs;
|
|
2396
|
+
}
|
|
2397
|
+
function envsubstCommands(options2 = {}) {
|
|
2398
|
+
createEnvsubstCommands(options2);
|
|
2399
|
+
return rawEnvsubstCommands(options2);
|
|
2400
|
+
}
|
|
2401
|
+
|
|
2402
|
+
// packages/safe-bash/src/commands/getconf/index.ts
|
|
2403
|
+
init_platform();
|
|
2404
|
+
import {
|
|
2405
|
+
createGetconfCommand as createRawGetconfCommand,
|
|
2406
|
+
createGetconfCommands as createRawGetconfCommands
|
|
2407
|
+
} from "../../safe-bash-command-getconf/index.js";
|
|
2408
|
+
import { settings as settings19 } from "../../safe-bash-command-getconf/index.js";
|
|
2409
|
+
function isDefaultGetconfOptions(options2) {
|
|
2410
|
+
return options2?.processors === void 0 && options2?.variables === void 0 && options2?.limits === void 0;
|
|
2411
|
+
}
|
|
2412
|
+
function createGetconfCommand(options2 = {}) {
|
|
2413
|
+
const def = createRawGetconfCommand(options2);
|
|
2414
|
+
if (isDefaultGetconfOptions(options2)) builtInDirectContextExecutors.add(def.execute);
|
|
2415
|
+
return def;
|
|
2416
|
+
}
|
|
2417
|
+
function createGetconfCommands(options2 = {}) {
|
|
2418
|
+
const defs = createRawGetconfCommands(options2);
|
|
2419
|
+
if (isDefaultGetconfOptions(options2)) {
|
|
2420
|
+
for (let i = 0; i < defs.length; i++) builtInDirectContextExecutors.add(defs[i].execute);
|
|
2421
|
+
}
|
|
2422
|
+
return defs;
|
|
2423
|
+
}
|
|
2424
|
+
function getconfCommands(options2 = {}) {
|
|
2425
|
+
const commands = createGetconfCommands(options2);
|
|
2426
|
+
return {
|
|
2427
|
+
name: "getconf-commands",
|
|
2428
|
+
setup(host) {
|
|
2429
|
+
if (!options2.replace) {
|
|
2430
|
+
for (const command4 of commands) {
|
|
2431
|
+
if (host.commands.has(command4.name)) {
|
|
2432
|
+
throw new Error(`Command already registered: ${command4.name}`);
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
for (const command4 of commands) {
|
|
2437
|
+
host.commands.register(command4, { replace: options2.replace ?? false });
|
|
2438
|
+
}
|
|
2439
|
+
}
|
|
2440
|
+
};
|
|
2441
|
+
}
|
|
2442
|
+
|
|
2443
|
+
// packages/safe-bash/src/commands/locale/index.ts
|
|
2444
|
+
init_platform();
|
|
2445
|
+
import {
|
|
2446
|
+
createLocaleCommand as createRawLocaleCommand,
|
|
2447
|
+
createLocaleCommands as createRawLocaleCommands
|
|
2448
|
+
} from "../../safe-bash-command-locale/index.js";
|
|
2449
|
+
import { settings as settings20 } from "../../safe-bash-command-locale/index.js";
|
|
2450
|
+
function isDefaultLocaleOptions(options2) {
|
|
2451
|
+
return options2?.locales === void 0 && options2?.charmaps === void 0 && options2?.defaultLocale === void 0 && options2?.limits === void 0;
|
|
2452
|
+
}
|
|
2453
|
+
function createLocaleCommand(options2 = {}) {
|
|
2454
|
+
const def = createRawLocaleCommand(options2);
|
|
2455
|
+
if (isDefaultLocaleOptions(options2)) builtInDirectContextExecutors.add(def.execute);
|
|
2456
|
+
return def;
|
|
2457
|
+
}
|
|
2458
|
+
function createLocaleCommands(options2 = {}) {
|
|
2459
|
+
const defs = createRawLocaleCommands(options2);
|
|
2460
|
+
if (isDefaultLocaleOptions(options2)) {
|
|
2461
|
+
for (let i = 0; i < defs.length; i++) builtInDirectContextExecutors.add(defs[i].execute);
|
|
2462
|
+
}
|
|
2463
|
+
return defs;
|
|
2464
|
+
}
|
|
2465
|
+
function localeCommands(options2 = {}) {
|
|
2466
|
+
const commands = createLocaleCommands(options2);
|
|
2467
|
+
return {
|
|
2468
|
+
name: "locale-commands",
|
|
2469
|
+
setup(host) {
|
|
2470
|
+
if (!options2.replace) {
|
|
2471
|
+
for (const command4 of commands) {
|
|
2472
|
+
if (host.commands.has(command4.name)) {
|
|
2473
|
+
throw new Error(`Command already registered: ${command4.name}`);
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2477
|
+
for (const command4 of commands) {
|
|
2478
|
+
host.commands.register(command4, { replace: options2.replace ?? false });
|
|
2479
|
+
}
|
|
2480
|
+
}
|
|
2481
|
+
};
|
|
2482
|
+
}
|
|
2483
|
+
|
|
2484
|
+
// packages/safe-bash/src/commands/sqlite3/index.ts
|
|
2485
|
+
init_platform();
|
|
2486
|
+
import {
|
|
2487
|
+
createSqlite3Command as createRawSqlite3Command,
|
|
2488
|
+
createSqlite3Commands as createRawSqlite3Commands,
|
|
2489
|
+
evalSyncSqlite3
|
|
2490
|
+
} from "../../safe-bash-command-sqlite3/index.js";
|
|
2491
|
+
import { evalSyncSqlite3 as evalSyncSqlite32, settings as settings21 } from "../../safe-bash-command-sqlite3/index.js";
|
|
2492
|
+
function isDefaultSqlite3Options(options2) {
|
|
2493
|
+
if (!options2) return true;
|
|
2494
|
+
return options2.limits === void 0 && options2.engine === void 0;
|
|
2495
|
+
}
|
|
2496
|
+
function createSqlite3Command(options2 = {}) {
|
|
2497
|
+
const def = createRawSqlite3Command(options2);
|
|
2498
|
+
if (isDefaultSqlite3Options(options2)) {
|
|
2499
|
+
builtInDirectContextExecutors.add(def.execute);
|
|
2500
|
+
}
|
|
2501
|
+
return def;
|
|
2502
|
+
}
|
|
2503
|
+
function createSqlite3Commands(options2 = {}) {
|
|
2504
|
+
const defs = createRawSqlite3Commands(options2);
|
|
2505
|
+
if (isDefaultSqlite3Options(options2)) {
|
|
2506
|
+
for (let i = 0; i < defs.length; i++) builtInDirectContextExecutors.add(defs[i].execute);
|
|
2507
|
+
}
|
|
2508
|
+
return defs;
|
|
2509
|
+
}
|
|
2510
|
+
function sqlite3Commands(options2 = {}) {
|
|
2511
|
+
const commands = createSqlite3Commands(options2);
|
|
2512
|
+
return {
|
|
2513
|
+
name: "sqlite3-commands",
|
|
2514
|
+
setup(host) {
|
|
2515
|
+
if (!options2.replace) {
|
|
2516
|
+
for (const command4 of commands) {
|
|
2517
|
+
if (host.commands.has(command4.name)) {
|
|
2518
|
+
throw new Error(`Command already registered: ${command4.name}`);
|
|
2519
|
+
}
|
|
2520
|
+
}
|
|
2521
|
+
}
|
|
2522
|
+
for (const command4 of commands) {
|
|
2523
|
+
host.commands.register(command4, { replace: options2.replace ?? false });
|
|
2524
|
+
}
|
|
2525
|
+
}
|
|
2526
|
+
};
|
|
2527
|
+
}
|
|
2528
|
+
syncCommandEvaluators.evalSyncSqlite3 = evalSyncSqlite3;
|
|
2529
|
+
|
|
2003
2530
|
// packages/safe-bash/src/plugins/composition.ts
|
|
2004
2531
|
init_platform();
|
|
2005
2532
|
|
|
@@ -2476,7 +3003,7 @@ async function followTail(caller, selection, cap, select, scheduler = tailFollow
|
|
|
2476
3003
|
|
|
2477
3004
|
// packages/safe-bash/src/commands/record-buffer.ts
|
|
2478
3005
|
init_platform();
|
|
2479
|
-
import { RecordBuffer } from "../../safe-bash-io-engine/record-buffer.js";
|
|
3006
|
+
import { RecordBuffer as RecordBuffer2 } from "../../safe-bash-io-engine/record-buffer.js";
|
|
2480
3007
|
|
|
2481
3008
|
// packages/safe-bash/src/commands/streams.ts
|
|
2482
3009
|
var SMALL_WC_COUNT_LINES = Array.from({ length: 129 }, (_, i) => `${i}
|
|
@@ -2487,9 +3014,6 @@ function isSyncResolved(promise) {
|
|
|
2487
3014
|
return Boolean(promise && typeof promise === "object" && promise[syncResolved]);
|
|
2488
3015
|
}
|
|
2489
3016
|
var sharedTrOutBuffer = new Uint8Array(64 * 1024);
|
|
2490
|
-
var cachedTrOutBuffer = new Uint8Array(32768);
|
|
2491
|
-
var lastTrInBuf;
|
|
2492
|
-
var lastTrMapping;
|
|
2493
3017
|
var sharedTrOutInUse = false;
|
|
2494
3018
|
var trConfigCache = /* @__PURE__ */ new Map();
|
|
2495
3019
|
var lastTrArg0;
|
|
@@ -2827,7 +3351,7 @@ async function suffix(context, source, count, bytes, omit, delimiter) {
|
|
|
2827
3351
|
let pendingLines = [];
|
|
2828
3352
|
let start2 = 0;
|
|
2829
3353
|
let size2 = 0;
|
|
2830
|
-
const pending2 = new
|
|
3354
|
+
const pending2 = new RecordBuffer2(bufferLimit);
|
|
2831
3355
|
const pushLine = (lineBytes, terminated) => {
|
|
2832
3356
|
const lineLength = lineBytes.length + (terminated ? 1 : 0);
|
|
2833
3357
|
pendingLines.push({ bytes: lineBytes, terminated });
|
|
@@ -2911,10 +3435,10 @@ async function suffix(context, source, count, bytes, omit, delimiter) {
|
|
|
2911
3435
|
let pending = [];
|
|
2912
3436
|
let start = 0;
|
|
2913
3437
|
let size = 0;
|
|
2914
|
-
const
|
|
3438
|
+
const records2 = bytes ? source : (async function* () {
|
|
2915
3439
|
for await (const line of lines(source, delimiter)) yield line.terminated ? concatenate([line.bytes, Uint8Array.of(delimiter)]) : line.bytes;
|
|
2916
3440
|
})();
|
|
2917
|
-
for await (const chunk of
|
|
3441
|
+
for await (const chunk of records2) {
|
|
2918
3442
|
context.signal.throwIfAborted();
|
|
2919
3443
|
if (bytes && !chunk.length) continue;
|
|
2920
3444
|
pending.push(new Uint8Array(chunk));
|
|
@@ -3397,20 +3921,7 @@ function streamCommands(maxTeeTargets = Infinity, maxTailFollowHandles = Infinit
|
|
|
3397
3921
|
const useShared = chunk.length <= sharedTrOutBuffer.length;
|
|
3398
3922
|
const buf = useShared ? sharedTrOutBuffer : new Uint8Array(chunk.length);
|
|
3399
3923
|
if (!deleting && !squeezing) {
|
|
3400
|
-
if (useShared && chunk.length >= 256 && lastTrInBuf !== void 0 && chunk.length === lastTrInBuf.byteLength && mapping === lastTrMapping && equalBytes(lastTrInBuf, chunk)) {
|
|
3401
|
-
const p2 = outputRange(context, cachedTrOutBuffer, chunk.length);
|
|
3402
|
-
if (!isSyncResolved(p2)) {
|
|
3403
|
-
released = true;
|
|
3404
|
-
return executeTrAfterPending(p2, context, iter, deleting, squeezing, mapping, removed, squeezed, previous, true);
|
|
3405
|
-
}
|
|
3406
|
-
continue;
|
|
3407
|
-
}
|
|
3408
3924
|
for (let index = 0; index < chunk.length; index++) buf[index] = mapping[chunk[index]];
|
|
3409
|
-
if (useShared && chunk.length >= 256 && chunk.length <= 32768) {
|
|
3410
|
-
lastTrInBuf = encodeBytes(chunk);
|
|
3411
|
-
lastTrMapping = mapping;
|
|
3412
|
-
cachedTrOutBuffer.set(buf.subarray(0, chunk.length));
|
|
3413
|
-
}
|
|
3414
3925
|
const p = useShared ? outputRange(context, buf, chunk.length) : output(context, buf);
|
|
3415
3926
|
if (!isSyncResolved(p)) {
|
|
3416
3927
|
released = true;
|
|
@@ -3439,12 +3950,15 @@ function streamCommands(maxTeeTargets = Infinity, maxTailFollowHandles = Infinit
|
|
|
3439
3950
|
released = true;
|
|
3440
3951
|
return rejectTrOutput(iter, err);
|
|
3441
3952
|
} finally {
|
|
3442
|
-
if (!released)
|
|
3953
|
+
if (!released) {
|
|
3954
|
+
sharedTrOutBuffer.fill(0);
|
|
3955
|
+
sharedTrOutInUse = false;
|
|
3956
|
+
}
|
|
3443
3957
|
}
|
|
3444
3958
|
}
|
|
3445
3959
|
return executeTrAsync(context, iter, deleting, squeezing, mapping, removed, squeezed, previous, false);
|
|
3446
3960
|
})
|
|
3447
|
-
].map((
|
|
3961
|
+
].map((command4) => ({ ...command4, filesystemRequirements: streamRequirements[command4.name] }));
|
|
3448
3962
|
}
|
|
3449
3963
|
async function executeTrAsync(context, iter, deleting, squeezing, mapping, removed, squeezingTable, initialPrevious, alreadyOwnsShared) {
|
|
3450
3964
|
const squeezed = squeezingTable;
|
|
@@ -3490,7 +4004,10 @@ async function executeTrAsync(context, iter, deleting, squeezing, mapping, remov
|
|
|
3490
4004
|
if (ownsShared) sharedTrOutBuffer = new Uint8Array(sharedTrOutBuffer.length);
|
|
3491
4005
|
throw error;
|
|
3492
4006
|
} finally {
|
|
3493
|
-
if (ownsShared)
|
|
4007
|
+
if (ownsShared) {
|
|
4008
|
+
sharedTrOutBuffer.fill(0);
|
|
4009
|
+
sharedTrOutInUse = false;
|
|
4010
|
+
}
|
|
3494
4011
|
if (!done) {
|
|
3495
4012
|
if (typeof iter.syncReturn === "function") iter.syncReturn();
|
|
3496
4013
|
else await iter.return?.();
|
|
@@ -3968,14 +4485,14 @@ var SortWork = class {
|
|
|
3968
4485
|
}
|
|
3969
4486
|
}
|
|
3970
4487
|
};
|
|
3971
|
-
async function sortRecords(
|
|
3972
|
-
if (
|
|
3973
|
-
let source =
|
|
3974
|
-
let target = new Array(
|
|
3975
|
-
for (let width = 1; width <
|
|
3976
|
-
for (let begin = 0; begin <
|
|
3977
|
-
const middle = Math.min(begin + width,
|
|
3978
|
-
const end = Math.min(begin + width * 2,
|
|
4488
|
+
async function sortRecords(records2, compare2, work) {
|
|
4489
|
+
if (records2.length < 2) return records2;
|
|
4490
|
+
let source = records2;
|
|
4491
|
+
let target = new Array(records2.length);
|
|
4492
|
+
for (let width = 1; width < records2.length; width *= 2) {
|
|
4493
|
+
for (let begin = 0; begin < records2.length; begin += width * 2) {
|
|
4494
|
+
const middle = Math.min(begin + width, records2.length);
|
|
4495
|
+
const end = Math.min(begin + width * 2, records2.length);
|
|
3979
4496
|
let left = begin;
|
|
3980
4497
|
let right = middle;
|
|
3981
4498
|
for (let index = begin; index < end; index++) {
|
|
@@ -4054,9 +4571,6 @@ async function cutRanges(list, work) {
|
|
|
4054
4571
|
}
|
|
4055
4572
|
return normalized;
|
|
4056
4573
|
}
|
|
4057
|
-
var sharedCutOutBuffer = new Uint8Array(64 * 1024);
|
|
4058
|
-
var sharedCutOutInUse = false;
|
|
4059
|
-
var sharedUniqOutBuffer = new Uint8Array(128 * 1024);
|
|
4060
4574
|
function writeUniqCountBytes(writeByte, count) {
|
|
4061
4575
|
const digits = String(count);
|
|
4062
4576
|
const pad = 7 - digits.length;
|
|
@@ -4068,19 +4582,11 @@ var CutOutput = class {
|
|
|
4068
4582
|
constructor(context, work) {
|
|
4069
4583
|
this.context = context;
|
|
4070
4584
|
this.work = work;
|
|
4071
|
-
|
|
4072
|
-
sharedCutOutInUse = true;
|
|
4073
|
-
this.#buffer = sharedCutOutBuffer;
|
|
4074
|
-
this.#ownsShared = true;
|
|
4075
|
-
} else {
|
|
4076
|
-
this.#buffer = new Uint8Array(64 * 1024);
|
|
4077
|
-
this.#ownsShared = false;
|
|
4078
|
-
}
|
|
4585
|
+
this.#buffer = new Uint8Array(64 * 1024);
|
|
4079
4586
|
}
|
|
4080
4587
|
context;
|
|
4081
4588
|
work;
|
|
4082
4589
|
#buffer;
|
|
4083
|
-
#ownsShared;
|
|
4084
4590
|
#used = 0;
|
|
4085
4591
|
get remaining() {
|
|
4086
4592
|
return this.#buffer.length - this.#used;
|
|
@@ -4149,9 +4655,6 @@ var CutOutput = class {
|
|
|
4149
4655
|
this.#used = 0;
|
|
4150
4656
|
await output(this.context, bytes);
|
|
4151
4657
|
}
|
|
4152
|
-
release() {
|
|
4153
|
-
if (this.#ownsShared) sharedCutOutInUse = false;
|
|
4154
|
-
}
|
|
4155
4658
|
};
|
|
4156
4659
|
function cutFieldBoundary(record, separator, start, work) {
|
|
4157
4660
|
if (record.length - start <= 4096) {
|
|
@@ -4617,14 +5120,6 @@ var sharedSortIndices = new Int32Array(4096);
|
|
|
4617
5120
|
var sharedSortScratchIndices = new Int32Array(4096);
|
|
4618
5121
|
var sharedSortInScratch = new Uint8Array(65536);
|
|
4619
5122
|
var sharedSortInUse = false;
|
|
4620
|
-
var sharedSortOutScratch = new Uint8Array(65536);
|
|
4621
|
-
var lastSort;
|
|
4622
|
-
var cachedCutOutBuffer = new Uint8Array(32768);
|
|
4623
|
-
var lastCutInBuf;
|
|
4624
|
-
var lastCutSep = -1;
|
|
4625
|
-
var lastCutField = -1;
|
|
4626
|
-
var lastCutMaxLineLen = 0;
|
|
4627
|
-
var lastCutOutUsed = -1;
|
|
4628
5123
|
var SORT_LONG_OPTIONS = Object.freeze({
|
|
4629
5124
|
"human-numeric-sort": "h",
|
|
4630
5125
|
"numeric-sort": "n",
|
|
@@ -4826,11 +5321,11 @@ async function keyBytes(line, key, separator, blanks, work) {
|
|
|
4826
5321
|
const end = key.end === void 0 ? line.length : last === void 0 ? line.length : key.endCharacter === void 0 ? last.end : Math.min(line.length, await fieldStart(last, key.endBlanks || inheritBlanks) + key.endCharacter);
|
|
4827
5322
|
return line.subarray(Math.min(start, line.length), Math.max(start, end));
|
|
4828
5323
|
}
|
|
4829
|
-
async function emitRecords(context,
|
|
5324
|
+
async function emitRecords(context, records2, destination) {
|
|
4830
5325
|
if (destination === void 0) {
|
|
4831
5326
|
const buffered = createBufferedOutput(context.stdout, context.signal);
|
|
4832
5327
|
try {
|
|
4833
|
-
for await (const bytes of
|
|
5328
|
+
for await (const bytes of records2) {
|
|
4834
5329
|
await buffered.write(bytes);
|
|
4835
5330
|
await buffered.flush();
|
|
4836
5331
|
}
|
|
@@ -4841,12 +5336,12 @@ async function emitRecords(context, records, destination) {
|
|
|
4841
5336
|
}
|
|
4842
5337
|
await admitTextOutput(context, destination);
|
|
4843
5338
|
const capabilities = await context.fs.capabilitiesFor?.(pathOf(context, destination), { signal: context.signal }) ?? context.fs.capabilities;
|
|
4844
|
-
if (context.fs.writeStream && capabilities.streamingWrite !== false) await context.fs.writeStream(pathOf(context, destination),
|
|
5339
|
+
if (context.fs.writeStream && capabilities.streamingWrite !== false) await context.fs.writeStream(pathOf(context, destination), records2, { signal: context.signal });
|
|
4845
5340
|
else {
|
|
4846
5341
|
if (capabilities.write === false) throw new FsError("ENOTSUP", { syscall: "writeFile", path: pathOf(context, destination) });
|
|
4847
5342
|
let size = 0;
|
|
4848
5343
|
const chunks = [];
|
|
4849
|
-
for await (const bytes of
|
|
5344
|
+
for await (const bytes of records2) {
|
|
4850
5345
|
size += bytes.length;
|
|
4851
5346
|
if (size > bufferLimit) throw new FsError("EFBIG", { message: "output buffer limit exceeded" });
|
|
4852
5347
|
chunks.push(bytes);
|
|
@@ -4855,7 +5350,7 @@ async function emitRecords(context, records, destination) {
|
|
|
4855
5350
|
}
|
|
4856
5351
|
}
|
|
4857
5352
|
async function readOwnedSortInput(source, signal, firstChunk, secondResult) {
|
|
4858
|
-
const buffered = new
|
|
5353
|
+
const buffered = new RecordBuffer2(bufferLimit);
|
|
4859
5354
|
try {
|
|
4860
5355
|
signal.throwIfAborted();
|
|
4861
5356
|
if (firstChunk) buffered.append(firstChunk);
|
|
@@ -4878,7 +5373,7 @@ async function readOwnedSortInput(source, signal, firstChunk, secondResult) {
|
|
|
4878
5373
|
}
|
|
4879
5374
|
}
|
|
4880
5375
|
async function collectSortRecords(source, delimiter, budget, signal, accept) {
|
|
4881
|
-
const pending = new
|
|
5376
|
+
const pending = new RecordBuffer2(bufferLimit);
|
|
4882
5377
|
const admit = (length) => {
|
|
4883
5378
|
signal.throwIfAborted();
|
|
4884
5379
|
budget.admit(length);
|
|
@@ -5421,20 +5916,20 @@ async function executeSortGeneral(context, preReadChunks) {
|
|
|
5421
5916
|
}
|
|
5422
5917
|
return compareSlowAsync(result, left, right);
|
|
5423
5918
|
};
|
|
5424
|
-
const
|
|
5919
|
+
const records2 = [];
|
|
5425
5920
|
const runs = [];
|
|
5426
5921
|
const checkRecordAsync = async (bytes) => {
|
|
5427
|
-
if (
|
|
5428
|
-
if (!parsed.flags.has("C")) await diagnostic(context, new PublicDiagnostic(`disorder at record ${
|
|
5922
|
+
if (records2.length && (await compare2(records2.at(-1), bytes) > 0 || parsed.flags.has("u") && await keyCompare(records2.at(-1), bytes) === 0)) {
|
|
5923
|
+
if (!parsed.flags.has("C")) await diagnostic(context, new PublicDiagnostic(`disorder at record ${records2.length + 1}`));
|
|
5429
5924
|
return false;
|
|
5430
5925
|
}
|
|
5431
|
-
|
|
5926
|
+
records2.push(bytes);
|
|
5432
5927
|
return true;
|
|
5433
5928
|
};
|
|
5434
5929
|
for (const name of parsed.operands.length ? parsed.operands : ["-"]) {
|
|
5435
5930
|
const run = [];
|
|
5436
5931
|
if (parsed.flags.has("m")) runs.push(run);
|
|
5437
|
-
const targetList = parsed.flags.has("m") ? run :
|
|
5932
|
+
const targetList = parsed.flags.has("m") ? run : records2;
|
|
5438
5933
|
const acceptRecord = checking ? checkRecordAsync : (bytes) => {
|
|
5439
5934
|
targetList.push(bytes);
|
|
5440
5935
|
};
|
|
@@ -5451,8 +5946,8 @@ async function executeSortGeneral(context, preReadChunks) {
|
|
|
5451
5946
|
}
|
|
5452
5947
|
if (checking) return { exitCode };
|
|
5453
5948
|
let ordered;
|
|
5454
|
-
if (!parsed.flags.has("m") && !parsed.flags.has("u") &&
|
|
5455
|
-
const count =
|
|
5949
|
+
if (!parsed.flags.has("m") && !parsed.flags.has("u") && records2.length >= 2 && records2.length <= 65536 && (canMultiKeyFast || isSingleLexKeyFast)) {
|
|
5950
|
+
const count = records2.length;
|
|
5456
5951
|
const keySpecs = keys.map((k) => {
|
|
5457
5952
|
const f = k.flags.size ? k.flags : parsed.flags;
|
|
5458
5953
|
const numeric = f.has("n") || f.has("h");
|
|
@@ -5468,7 +5963,7 @@ async function executeSortGeneral(context, preReadChunks) {
|
|
|
5468
5963
|
return { numeric: false, blanks, revScale, key: k, slices };
|
|
5469
5964
|
});
|
|
5470
5965
|
for (let i = 0; i < count; i++) {
|
|
5471
|
-
const rec =
|
|
5966
|
+
const rec = records2[i];
|
|
5472
5967
|
for (let ki = 0; ki < keySpecs.length; ki++) {
|
|
5473
5968
|
const ks = keySpecs[ki];
|
|
5474
5969
|
const sliceOrPromise = keyBytesSync(rec, ks.key, separator, ks.blanks, work);
|
|
@@ -5537,8 +6032,8 @@ async function executeSortGeneral(context, preReadChunks) {
|
|
|
5537
6032
|
if (cmp !== 0) break;
|
|
5538
6033
|
}
|
|
5539
6034
|
if (cmp === 0 && !skipTieFallback) {
|
|
5540
|
-
const ra =
|
|
5541
|
-
const rb =
|
|
6035
|
+
const ra = records2[a];
|
|
6036
|
+
const rb = records2[b];
|
|
5542
6037
|
const minL = ra.length < rb.length ? ra.length : rb.length;
|
|
5543
6038
|
let d = 0;
|
|
5544
6039
|
for (let p = 0; p < minL; p++) {
|
|
@@ -5561,9 +6056,9 @@ async function executeSortGeneral(context, preReadChunks) {
|
|
|
5561
6056
|
dstIdx = tmp;
|
|
5562
6057
|
}
|
|
5563
6058
|
ordered = new Array(count);
|
|
5564
|
-
for (let i = 0; i < count; i++) ordered[i] =
|
|
6059
|
+
for (let i = 0; i < count; i++) ordered[i] = records2[srcIdx[i]];
|
|
5565
6060
|
} else {
|
|
5566
|
-
ordered = parsed.flags.has("m") ? await mergeSortRuns(runs, compare2, work) : await sortRecords(
|
|
6061
|
+
ordered = parsed.flags.has("m") ? await mergeSortRuns(runs, compare2, work) : await sortRecords(records2, compare2, work);
|
|
5567
6062
|
}
|
|
5568
6063
|
let estBytes = 0;
|
|
5569
6064
|
let allCounted = true;
|
|
@@ -5652,267 +6147,263 @@ async function executeCutGeneral(context) {
|
|
|
5652
6147
|
const outputDelimiterBytes = outputDelimiter === void 0 ? separator : outputDelimiter.length === 0 ? Uint8Array.of(0) : encoder.encode(outputDelimiter);
|
|
5653
6148
|
const writer = new CutOutput(context, work);
|
|
5654
6149
|
let exitCode = 0;
|
|
5655
|
-
|
|
5656
|
-
|
|
6150
|
+
for (const name of parsed.operands.length ? parsed.operands : ["-"]) {
|
|
6151
|
+
try {
|
|
5657
6152
|
try {
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
6153
|
+
const onlyDelimited = parsed.flags.has("s");
|
|
6154
|
+
const fastSingleByteField = mode === "f" && separator.length === 1;
|
|
6155
|
+
const sepByte = separator[0];
|
|
6156
|
+
const outDelimLen = outputDelimiterBytes.length;
|
|
6157
|
+
const processFastFieldRangeSlow = async (buf, lineStart, lineEnd) => {
|
|
6158
|
+
context.signal.throwIfAborted();
|
|
6159
|
+
let boundary = buf.indexOf(sepByte, lineStart);
|
|
6160
|
+
if (boundary >= lineEnd) boundary = -1;
|
|
6161
|
+
const c0 = work.charge(boundary < 0 ? lineEnd - lineStart : boundary - lineStart + 1);
|
|
6162
|
+
if (c0) await c0;
|
|
6163
|
+
if (boundary < 0) {
|
|
6164
|
+
if (onlyDelimited) return;
|
|
6165
|
+
const w = writer.writeRange(buf, lineStart, lineEnd);
|
|
6166
|
+
if (w) await w;
|
|
6167
|
+
} else {
|
|
6168
|
+
let cursor = 0;
|
|
6169
|
+
let field = 1;
|
|
6170
|
+
let start = lineStart;
|
|
6171
|
+
let emitted = false;
|
|
6172
|
+
while (true) {
|
|
6173
|
+
const cp = work.charge();
|
|
6174
|
+
if (cp) await cp;
|
|
6175
|
+
while (cursor < ranges.length && field > ranges[cursor].end) cursor++;
|
|
6176
|
+
const included = cursor < ranges.length && field >= ranges[cursor].start;
|
|
6177
|
+
if (included !== complement) {
|
|
6178
|
+
if (emitted) {
|
|
6179
|
+
const w1 = writer.write(outputDelimiterBytes);
|
|
6180
|
+
if (w1) await w1;
|
|
6181
|
+
}
|
|
6182
|
+
const w2 = writer.writeRange(buf, start, boundary < 0 ? lineEnd : boundary);
|
|
6183
|
+
if (w2) await w2;
|
|
6184
|
+
emitted = true;
|
|
6185
|
+
}
|
|
6186
|
+
field++;
|
|
6187
|
+
if (boundary < 0 || !complement && cursor >= ranges.length) break;
|
|
6188
|
+
start = boundary + 1;
|
|
6189
|
+
boundary = start <= lineEnd ? buf.indexOf(sepByte, start) : -1;
|
|
6190
|
+
if (boundary >= lineEnd) boundary = -1;
|
|
6191
|
+
const cn = work.charge(boundary < 0 ? lineEnd - start : boundary - start + 1);
|
|
6192
|
+
if (cn) await cn;
|
|
6193
|
+
}
|
|
6194
|
+
}
|
|
6195
|
+
const wd = writer.writeByte(recordDelimiter);
|
|
6196
|
+
if (wd) await wd;
|
|
6197
|
+
};
|
|
6198
|
+
const processFastFieldRange = (buf, lineStart, lineEnd) => {
|
|
6199
|
+
const lineLen = lineEnd - lineStart;
|
|
6200
|
+
if (writer.remaining <= lineLen * (outDelimLen > 1 ? outDelimLen : 1) + 1) {
|
|
6201
|
+
return processFastFieldRangeSlow(buf, lineStart, lineEnd);
|
|
6202
|
+
}
|
|
6203
|
+
context.signal.throwIfAborted();
|
|
6204
|
+
let boundary = buf.indexOf(sepByte, lineStart);
|
|
6205
|
+
if (boundary >= lineEnd) boundary = -1;
|
|
6206
|
+
let totalCharge = boundary < 0 ? lineLen : boundary - lineStart + 1;
|
|
6207
|
+
if (boundary < 0) {
|
|
6208
|
+
if (onlyDelimited) return work.charge(totalCharge);
|
|
6209
|
+
totalCharge += writer.writeRangeUncharged(buf, lineStart, lineEnd);
|
|
6210
|
+
} else {
|
|
6211
|
+
let cursor = 0;
|
|
6212
|
+
let field = 1;
|
|
6213
|
+
let start = lineStart;
|
|
6214
|
+
let emitted = false;
|
|
6215
|
+
while (true) {
|
|
6216
|
+
totalCharge += 1;
|
|
6217
|
+
while (cursor < ranges.length && field > ranges[cursor].end) cursor++;
|
|
6218
|
+
const included = cursor < ranges.length && field >= ranges[cursor].start;
|
|
6219
|
+
if (included !== complement) {
|
|
6220
|
+
if (emitted) {
|
|
6221
|
+
totalCharge += writer.writeRangeUncharged(outputDelimiterBytes, 0, outDelimLen);
|
|
6222
|
+
}
|
|
6223
|
+
totalCharge += writer.writeRangeUncharged(buf, start, boundary < 0 ? lineEnd : boundary);
|
|
6224
|
+
emitted = true;
|
|
6225
|
+
}
|
|
6226
|
+
field++;
|
|
6227
|
+
if (boundary < 0 || !complement && cursor >= ranges.length) break;
|
|
6228
|
+
start = boundary + 1;
|
|
6229
|
+
boundary = start <= lineEnd ? buf.indexOf(sepByte, start) : -1;
|
|
6230
|
+
if (boundary >= lineEnd) boundary = -1;
|
|
6231
|
+
totalCharge += boundary < 0 ? lineEnd - start : boundary - start + 1;
|
|
6232
|
+
}
|
|
6233
|
+
}
|
|
6234
|
+
writer.writeByteUncharged(recordDelimiter);
|
|
6235
|
+
totalCharge += 1;
|
|
6236
|
+
return work.charge(totalCharge);
|
|
6237
|
+
};
|
|
6238
|
+
const sharedUtf8Decoder = new TextDecoder("utf-8", { ignoreBOM: true });
|
|
6239
|
+
const canFastSliceCut = (byteSelection || mode === "c") && !complement && ranges.length <= 16;
|
|
6240
|
+
const processFastSliceRange = (buf, lineStart, lineEnd) => {
|
|
6241
|
+
const lineLen = lineEnd - lineStart;
|
|
6242
|
+
if (writer.remaining <= lineLen * (outDelimLen > 1 ? outDelimLen : 1) + 1) {
|
|
6243
|
+
return null;
|
|
6244
|
+
}
|
|
6245
|
+
if (!byteSelection) {
|
|
6246
|
+
for (let i = lineStart; i < lineEnd; i++) {
|
|
6247
|
+
if (buf[i] >= 128) return null;
|
|
6248
|
+
}
|
|
6249
|
+
}
|
|
6250
|
+
context.signal.throwIfAborted();
|
|
6251
|
+
let totalCharge = lineLen + 1;
|
|
6252
|
+
let emitted = false;
|
|
6253
|
+
for (let rIdx = 0; rIdx < ranges.length; rIdx++) {
|
|
6254
|
+
const r = ranges[rIdx];
|
|
6255
|
+
const s = lineStart + r.start - 1;
|
|
6256
|
+
if (s >= lineEnd) break;
|
|
6257
|
+
const e = Math.min(lineEnd, lineStart + r.end);
|
|
6258
|
+
if (e > s) {
|
|
6259
|
+
if (emitted && outputDelimiter !== void 0) {
|
|
6260
|
+
totalCharge += writer.writeRangeUncharged(outputDelimiterBytes, 0, outDelimLen);
|
|
6261
|
+
}
|
|
6262
|
+
totalCharge += writer.writeRangeUncharged(buf, s, e);
|
|
6263
|
+
emitted = true;
|
|
6264
|
+
}
|
|
6265
|
+
}
|
|
6266
|
+
writer.writeByteUncharged(recordDelimiter);
|
|
6267
|
+
return work.charge(totalCharge);
|
|
6268
|
+
};
|
|
6269
|
+
const processLineBytes = async (lineBytes) => {
|
|
6270
|
+
context.signal.throwIfAborted();
|
|
6271
|
+
let cursor = 0;
|
|
6272
|
+
const selected = (position) => {
|
|
6273
|
+
while (cursor < ranges.length && position > ranges[cursor].end) cursor++;
|
|
6274
|
+
const included = cursor < ranges.length && position >= ranges[cursor].start;
|
|
6275
|
+
return included !== complement ? cursor : -1;
|
|
6276
|
+
};
|
|
6277
|
+
if (mode === "f") {
|
|
6278
|
+
const record = encodeBytes(lineBytes.buffer, lineBytes.byteOffset, lineBytes.byteLength);
|
|
6279
|
+
const b0 = cutFieldBoundary(record, separator, 0, work);
|
|
6280
|
+
let boundary = typeof b0 === "number" ? b0 : await b0;
|
|
5669
6281
|
if (boundary < 0) {
|
|
5670
6282
|
if (onlyDelimited) return;
|
|
5671
|
-
const w = writer.
|
|
6283
|
+
const w = writer.write(lineBytes);
|
|
5672
6284
|
if (w) await w;
|
|
5673
6285
|
} else {
|
|
5674
|
-
let cursor = 0;
|
|
5675
6286
|
let field = 1;
|
|
5676
|
-
let start =
|
|
6287
|
+
let start = 0;
|
|
5677
6288
|
let emitted = false;
|
|
5678
6289
|
while (true) {
|
|
5679
|
-
const
|
|
5680
|
-
if (
|
|
5681
|
-
|
|
5682
|
-
const included = cursor < ranges.length && field >= ranges[cursor].start;
|
|
5683
|
-
if (included !== complement) {
|
|
6290
|
+
const checkpoint = work.charge();
|
|
6291
|
+
if (checkpoint) await checkpoint;
|
|
6292
|
+
if (selected(field++) >= 0) {
|
|
5684
6293
|
if (emitted) {
|
|
5685
6294
|
const w1 = writer.write(outputDelimiterBytes);
|
|
5686
6295
|
if (w1) await w1;
|
|
5687
6296
|
}
|
|
5688
|
-
const w2 = writer.
|
|
6297
|
+
const w2 = writer.write(record.subarray(start, boundary < 0 ? record.length : boundary));
|
|
5689
6298
|
if (w2) await w2;
|
|
5690
6299
|
emitted = true;
|
|
5691
6300
|
}
|
|
5692
|
-
field++;
|
|
5693
6301
|
if (boundary < 0 || !complement && cursor >= ranges.length) break;
|
|
5694
|
-
start = boundary +
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
const cn = work.charge(boundary < 0 ? lineEnd - start : boundary - start + 1);
|
|
5698
|
-
if (cn) await cn;
|
|
6302
|
+
start = boundary + separator.length;
|
|
6303
|
+
const bn = cutFieldBoundary(record, separator, start, work);
|
|
6304
|
+
boundary = typeof bn === "number" ? bn : await bn;
|
|
5699
6305
|
}
|
|
5700
6306
|
}
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
let field = 1;
|
|
5719
|
-
let start = lineStart;
|
|
5720
|
-
let emitted = false;
|
|
5721
|
-
while (true) {
|
|
5722
|
-
totalCharge += 1;
|
|
5723
|
-
while (cursor < ranges.length && field > ranges[cursor].end) cursor++;
|
|
5724
|
-
const included = cursor < ranges.length && field >= ranges[cursor].start;
|
|
5725
|
-
if (included !== complement) {
|
|
5726
|
-
if (emitted) {
|
|
5727
|
-
totalCharge += writer.writeRangeUncharged(outputDelimiterBytes, 0, outDelimLen);
|
|
5728
|
-
}
|
|
5729
|
-
totalCharge += writer.writeRangeUncharged(buf, start, boundary < 0 ? lineEnd : boundary);
|
|
6307
|
+
} else if (byteSelection) {
|
|
6308
|
+
let emitted = false;
|
|
6309
|
+
let previousRange = -1;
|
|
6310
|
+
for (let offset = 0; offset < lineBytes.length; offset += 4096) {
|
|
6311
|
+
const end = Math.min(lineBytes.length, offset + 4096);
|
|
6312
|
+
const checkpoint = work.charge(end - offset);
|
|
6313
|
+
if (checkpoint) await checkpoint;
|
|
6314
|
+
let start = -1;
|
|
6315
|
+
for (let index = offset; index < end; index++) {
|
|
6316
|
+
const range = selected(index + 1);
|
|
6317
|
+
if (range !== previousRange && start >= 0) {
|
|
6318
|
+
await writer.write(lineBytes.subarray(start, index));
|
|
6319
|
+
start = -1;
|
|
6320
|
+
}
|
|
6321
|
+
if (range >= 0 && start < 0) {
|
|
6322
|
+
if (range !== previousRange && emitted && outputDelimiter !== void 0) await writer.write(outputDelimiterBytes);
|
|
6323
|
+
start = index;
|
|
5730
6324
|
emitted = true;
|
|
5731
6325
|
}
|
|
5732
|
-
|
|
5733
|
-
if (boundary < 0 || !complement && cursor >= ranges.length) break;
|
|
5734
|
-
start = boundary + 1;
|
|
5735
|
-
boundary = start <= lineEnd ? buf.indexOf(sepByte, start) : -1;
|
|
5736
|
-
if (boundary >= lineEnd) boundary = -1;
|
|
5737
|
-
totalCharge += boundary < 0 ? lineEnd - start : boundary - start + 1;
|
|
5738
|
-
}
|
|
5739
|
-
}
|
|
5740
|
-
writer.writeByteUncharged(recordDelimiter);
|
|
5741
|
-
totalCharge += 1;
|
|
5742
|
-
return work.charge(totalCharge);
|
|
5743
|
-
};
|
|
5744
|
-
const sharedUtf8Decoder = new TextDecoder("utf-8", { ignoreBOM: true });
|
|
5745
|
-
const canFastSliceCut = (byteSelection || mode === "c") && !complement && ranges.length <= 16;
|
|
5746
|
-
const processFastSliceRange = (buf, lineStart, lineEnd) => {
|
|
5747
|
-
const lineLen = lineEnd - lineStart;
|
|
5748
|
-
if (writer.remaining <= lineLen * (outDelimLen > 1 ? outDelimLen : 1) + 1) {
|
|
5749
|
-
return null;
|
|
5750
|
-
}
|
|
5751
|
-
if (!byteSelection) {
|
|
5752
|
-
for (let i = lineStart; i < lineEnd; i++) {
|
|
5753
|
-
if (buf[i] >= 128) return null;
|
|
6326
|
+
previousRange = range;
|
|
5754
6327
|
}
|
|
6328
|
+
if (start >= 0) await writer.write(lineBytes.subarray(start, end));
|
|
5755
6329
|
}
|
|
5756
|
-
|
|
5757
|
-
|
|
6330
|
+
} else {
|
|
6331
|
+
const decoder2 = sharedUtf8Decoder;
|
|
6332
|
+
let index = 0;
|
|
5758
6333
|
let emitted = false;
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
const
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
6334
|
+
let previousRange = -1;
|
|
6335
|
+
for (let offset = 0; offset < lineBytes.length; offset += 4096) {
|
|
6336
|
+
const end = Math.min(lineBytes.length, offset + 4096);
|
|
6337
|
+
const checkpoint = work.charge(end - offset);
|
|
6338
|
+
if (checkpoint) await checkpoint;
|
|
6339
|
+
const text = decoder2.decode(lineBytes.subarray(offset, end), { stream: end < lineBytes.length });
|
|
6340
|
+
let start = -1;
|
|
6341
|
+
let position = 0;
|
|
6342
|
+
for (const character of text) {
|
|
6343
|
+
const checkpoint2 = work.charge();
|
|
6344
|
+
if (checkpoint2) await checkpoint2;
|
|
6345
|
+
const range = selected(++index);
|
|
6346
|
+
if (range !== previousRange && start >= 0) {
|
|
6347
|
+
await writer.text(text.slice(start, position));
|
|
6348
|
+
start = -1;
|
|
5767
6349
|
}
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
writer.writeByteUncharged(recordDelimiter);
|
|
5773
|
-
return work.charge(totalCharge);
|
|
5774
|
-
};
|
|
5775
|
-
const processLineBytes = async (lineBytes) => {
|
|
5776
|
-
context.signal.throwIfAborted();
|
|
5777
|
-
let cursor = 0;
|
|
5778
|
-
const selected = (position) => {
|
|
5779
|
-
while (cursor < ranges.length && position > ranges[cursor].end) cursor++;
|
|
5780
|
-
const included = cursor < ranges.length && position >= ranges[cursor].start;
|
|
5781
|
-
return included !== complement ? cursor : -1;
|
|
5782
|
-
};
|
|
5783
|
-
if (mode === "f") {
|
|
5784
|
-
const record = encodeBytes(lineBytes.buffer, lineBytes.byteOffset, lineBytes.byteLength);
|
|
5785
|
-
const b0 = cutFieldBoundary(record, separator, 0, work);
|
|
5786
|
-
let boundary = typeof b0 === "number" ? b0 : await b0;
|
|
5787
|
-
if (boundary < 0) {
|
|
5788
|
-
if (onlyDelimited) return;
|
|
5789
|
-
const w = writer.write(lineBytes);
|
|
5790
|
-
if (w) await w;
|
|
5791
|
-
} else {
|
|
5792
|
-
let field = 1;
|
|
5793
|
-
let start = 0;
|
|
5794
|
-
let emitted = false;
|
|
5795
|
-
while (true) {
|
|
5796
|
-
const checkpoint = work.charge();
|
|
5797
|
-
if (checkpoint) await checkpoint;
|
|
5798
|
-
if (selected(field++) >= 0) {
|
|
5799
|
-
if (emitted) {
|
|
5800
|
-
const w1 = writer.write(outputDelimiterBytes);
|
|
5801
|
-
if (w1) await w1;
|
|
5802
|
-
}
|
|
5803
|
-
const w2 = writer.write(record.subarray(start, boundary < 0 ? record.length : boundary));
|
|
5804
|
-
if (w2) await w2;
|
|
5805
|
-
emitted = true;
|
|
5806
|
-
}
|
|
5807
|
-
if (boundary < 0 || !complement && cursor >= ranges.length) break;
|
|
5808
|
-
start = boundary + separator.length;
|
|
5809
|
-
const bn = cutFieldBoundary(record, separator, start, work);
|
|
5810
|
-
boundary = typeof bn === "number" ? bn : await bn;
|
|
5811
|
-
}
|
|
5812
|
-
}
|
|
5813
|
-
} else if (byteSelection) {
|
|
5814
|
-
let emitted = false;
|
|
5815
|
-
let previousRange = -1;
|
|
5816
|
-
for (let offset = 0; offset < lineBytes.length; offset += 4096) {
|
|
5817
|
-
const end = Math.min(lineBytes.length, offset + 4096);
|
|
5818
|
-
const checkpoint = work.charge(end - offset);
|
|
5819
|
-
if (checkpoint) await checkpoint;
|
|
5820
|
-
let start = -1;
|
|
5821
|
-
for (let index = offset; index < end; index++) {
|
|
5822
|
-
const range = selected(index + 1);
|
|
5823
|
-
if (range !== previousRange && start >= 0) {
|
|
5824
|
-
await writer.write(lineBytes.subarray(start, index));
|
|
5825
|
-
start = -1;
|
|
5826
|
-
}
|
|
5827
|
-
if (range >= 0 && start < 0) {
|
|
5828
|
-
if (range !== previousRange && emitted && outputDelimiter !== void 0) await writer.write(outputDelimiterBytes);
|
|
5829
|
-
start = index;
|
|
5830
|
-
emitted = true;
|
|
5831
|
-
}
|
|
5832
|
-
previousRange = range;
|
|
5833
|
-
}
|
|
5834
|
-
if (start >= 0) await writer.write(lineBytes.subarray(start, end));
|
|
5835
|
-
}
|
|
5836
|
-
} else {
|
|
5837
|
-
const decoder = sharedUtf8Decoder;
|
|
5838
|
-
let index = 0;
|
|
5839
|
-
let emitted = false;
|
|
5840
|
-
let previousRange = -1;
|
|
5841
|
-
for (let offset = 0; offset < lineBytes.length; offset += 4096) {
|
|
5842
|
-
const end = Math.min(lineBytes.length, offset + 4096);
|
|
5843
|
-
const checkpoint = work.charge(end - offset);
|
|
5844
|
-
if (checkpoint) await checkpoint;
|
|
5845
|
-
const text = decoder.decode(lineBytes.subarray(offset, end), { stream: end < lineBytes.length });
|
|
5846
|
-
let start = -1;
|
|
5847
|
-
let position = 0;
|
|
5848
|
-
for (const character of text) {
|
|
5849
|
-
const checkpoint2 = work.charge();
|
|
5850
|
-
if (checkpoint2) await checkpoint2;
|
|
5851
|
-
const range = selected(++index);
|
|
5852
|
-
if (range !== previousRange && start >= 0) {
|
|
5853
|
-
await writer.text(text.slice(start, position));
|
|
5854
|
-
start = -1;
|
|
5855
|
-
}
|
|
5856
|
-
if (range >= 0 && start < 0) {
|
|
5857
|
-
if (range !== previousRange && emitted && outputDelimiter !== void 0) await writer.write(outputDelimiterBytes);
|
|
5858
|
-
start = position;
|
|
5859
|
-
emitted = true;
|
|
5860
|
-
}
|
|
5861
|
-
position += character.length;
|
|
5862
|
-
previousRange = range;
|
|
5863
|
-
}
|
|
5864
|
-
if (start >= 0) await writer.text(text.slice(start));
|
|
5865
|
-
}
|
|
5866
|
-
}
|
|
5867
|
-
const wd = writer.writeByte(recordDelimiter);
|
|
5868
|
-
if (wd) await wd;
|
|
5869
|
-
};
|
|
5870
|
-
const pending = new RecordBuffer(bufferLimit);
|
|
5871
|
-
try {
|
|
5872
|
-
for await (const chunk of input(context, name)) {
|
|
5873
|
-
let start = 0;
|
|
5874
|
-
while (start < chunk.length) {
|
|
5875
|
-
const offset = chunk.indexOf(recordDelimiter, start);
|
|
5876
|
-
if (offset < 0) break;
|
|
5877
|
-
if (fastSingleByteField && pending.size === 0 && offset - start <= 4096) {
|
|
5878
|
-
const p = processFastFieldRange(chunk, start, offset);
|
|
5879
|
-
if (p) await p;
|
|
5880
|
-
} else if (canFastSliceCut && pending.size === 0 && offset - start <= 4096) {
|
|
5881
|
-
const p = processFastSliceRange(chunk, start, offset);
|
|
5882
|
-
if (p === null) {
|
|
5883
|
-
await processLineBytes(chunk.subarray(start, offset));
|
|
5884
|
-
} else if (p) {
|
|
5885
|
-
await p;
|
|
5886
|
-
}
|
|
5887
|
-
} else {
|
|
5888
|
-
await processLineBytes(pending.finish(void 0, chunk, start, offset));
|
|
6350
|
+
if (range >= 0 && start < 0) {
|
|
6351
|
+
if (range !== previousRange && emitted && outputDelimiter !== void 0) await writer.write(outputDelimiterBytes);
|
|
6352
|
+
start = position;
|
|
6353
|
+
emitted = true;
|
|
5889
6354
|
}
|
|
5890
|
-
|
|
6355
|
+
position += character.length;
|
|
6356
|
+
previousRange = range;
|
|
5891
6357
|
}
|
|
5892
|
-
|
|
6358
|
+
if (start >= 0) await writer.text(text.slice(start));
|
|
5893
6359
|
}
|
|
5894
|
-
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
6360
|
+
}
|
|
6361
|
+
const wd = writer.writeByte(recordDelimiter);
|
|
6362
|
+
if (wd) await wd;
|
|
6363
|
+
};
|
|
6364
|
+
const pending = new RecordBuffer2(bufferLimit);
|
|
6365
|
+
try {
|
|
6366
|
+
for await (const chunk of input(context, name)) {
|
|
6367
|
+
let start = 0;
|
|
6368
|
+
while (start < chunk.length) {
|
|
6369
|
+
const offset = chunk.indexOf(recordDelimiter, start);
|
|
6370
|
+
if (offset < 0) break;
|
|
6371
|
+
if (fastSingleByteField && pending.size === 0 && offset - start <= 4096) {
|
|
6372
|
+
const p = processFastFieldRange(chunk, start, offset);
|
|
5898
6373
|
if (p) await p;
|
|
6374
|
+
} else if (canFastSliceCut && pending.size === 0 && offset - start <= 4096) {
|
|
6375
|
+
const p = processFastSliceRange(chunk, start, offset);
|
|
6376
|
+
if (p === null) {
|
|
6377
|
+
await processLineBytes(chunk.subarray(start, offset));
|
|
6378
|
+
} else if (p) {
|
|
6379
|
+
await p;
|
|
6380
|
+
}
|
|
5899
6381
|
} else {
|
|
5900
|
-
await processLineBytes(
|
|
6382
|
+
await processLineBytes(pending.finish(void 0, chunk, start, offset));
|
|
5901
6383
|
}
|
|
6384
|
+
start = offset + 1;
|
|
6385
|
+
}
|
|
6386
|
+
pending.append(chunk, start);
|
|
6387
|
+
}
|
|
6388
|
+
if (pending.size) {
|
|
6389
|
+
const finalBytes = pending.finish();
|
|
6390
|
+
if (fastSingleByteField && finalBytes.length <= 4096) {
|
|
6391
|
+
const p = processFastFieldRange(finalBytes, 0, finalBytes.length);
|
|
6392
|
+
if (p) await p;
|
|
6393
|
+
} else {
|
|
6394
|
+
await processLineBytes(finalBytes);
|
|
5902
6395
|
}
|
|
5903
|
-
} finally {
|
|
5904
|
-
pending.clear();
|
|
5905
6396
|
}
|
|
5906
6397
|
} finally {
|
|
5907
|
-
|
|
6398
|
+
pending.clear();
|
|
5908
6399
|
}
|
|
5909
|
-
}
|
|
5910
|
-
await
|
|
5911
|
-
exitCode = 1;
|
|
6400
|
+
} finally {
|
|
6401
|
+
await writer.flush();
|
|
5912
6402
|
}
|
|
6403
|
+
} catch (error) {
|
|
6404
|
+
await diagnostic(context, error);
|
|
6405
|
+
exitCode = 1;
|
|
5913
6406
|
}
|
|
5914
|
-
} finally {
|
|
5915
|
-
writer.release();
|
|
5916
6407
|
}
|
|
5917
6408
|
return { exitCode };
|
|
5918
6409
|
}
|
|
@@ -6000,7 +6491,7 @@ async function executeUniqGeneral(context, preReadSource) {
|
|
|
6000
6491
|
}
|
|
6001
6492
|
return ignoreCase ? fold(result) : result;
|
|
6002
6493
|
};
|
|
6003
|
-
const
|
|
6494
|
+
const records2 = (async function* () {
|
|
6004
6495
|
let previous;
|
|
6005
6496
|
let previousKey;
|
|
6006
6497
|
let count = 0;
|
|
@@ -6066,7 +6557,7 @@ async function executeUniqGeneral(context, preReadSource) {
|
|
|
6066
6557
|
}
|
|
6067
6558
|
}
|
|
6068
6559
|
};
|
|
6069
|
-
const pending = new
|
|
6560
|
+
const pending = new RecordBuffer2(bufferLimit);
|
|
6070
6561
|
try {
|
|
6071
6562
|
for await (const chunk of preReadSource ?? input(context, parsed.operands[0])) {
|
|
6072
6563
|
let start = 0;
|
|
@@ -6101,7 +6592,7 @@ async function executeUniqGeneral(context, preReadSource) {
|
|
|
6101
6592
|
while (flushChunks.length) yield flushChunks.shift();
|
|
6102
6593
|
if (outUsed > 0) yield outBuf.subarray(0, outUsed);
|
|
6103
6594
|
})();
|
|
6104
|
-
await emitRecords(context,
|
|
6595
|
+
await emitRecords(context, records2, parsed.operands[1]);
|
|
6105
6596
|
return { exitCode: 0 };
|
|
6106
6597
|
}
|
|
6107
6598
|
function textCommands() {
|
|
@@ -6129,22 +6620,6 @@ function textCommands() {
|
|
|
6129
6620
|
} catch (error) {
|
|
6130
6621
|
return diagnostic(context, error).then(RETURN_EXIT_TWO);
|
|
6131
6622
|
}
|
|
6132
|
-
const cached = lastSort;
|
|
6133
|
-
if (cached !== void 0 && firstChunkLen >= 256 && firstChunkLen === cached.input.byteLength && direction === cached.direction && cached.maxLineLength <= bufferLimit && equalBytes(cached.input, rawFirst)) {
|
|
6134
|
-
let res2Fast;
|
|
6135
|
-
try {
|
|
6136
|
-
res2Fast = srcIter.tryNextSync();
|
|
6137
|
-
} catch (error) {
|
|
6138
|
-
return diagnostic(context, error).then(RETURN_EXIT_TWO);
|
|
6139
|
-
}
|
|
6140
|
-
if (res2Fast !== void 0 && res2Fast.done) {
|
|
6141
|
-
context.signal.throwIfAborted();
|
|
6142
|
-
const p = outputRange(context, cached.output, cached.output.length);
|
|
6143
|
-
if (isSyncResolved2(p)) return RESOLVED_EXIT_ZERO;
|
|
6144
|
-
return p.then(RETURN_EXIT_ZERO);
|
|
6145
|
-
}
|
|
6146
|
-
return executeSortFastContinueAsync(context, direction, srcIter, cached.input, res2Fast);
|
|
6147
|
-
}
|
|
6148
6623
|
let firstChunk;
|
|
6149
6624
|
let usedSortInScratch = false;
|
|
6150
6625
|
try {
|
|
@@ -6166,11 +6641,9 @@ function textCommands() {
|
|
|
6166
6641
|
let start = 0;
|
|
6167
6642
|
let count = 0;
|
|
6168
6643
|
let validLines = true;
|
|
6169
|
-
let maxSortLine = 0;
|
|
6170
6644
|
while (start < firstChunkLen) {
|
|
6171
6645
|
const offset = firstChunk.indexOf(10, start);
|
|
6172
6646
|
const lLen = offset - start;
|
|
6173
|
-
if (lLen > maxSortLine) maxSortLine = lLen;
|
|
6174
6647
|
if (offset < 0 || offset >= firstChunkLen || count >= 4096 || lLen > bufferLimit) {
|
|
6175
6648
|
validLines = false;
|
|
6176
6649
|
break;
|
|
@@ -6218,7 +6691,7 @@ function textCommands() {
|
|
|
6218
6691
|
src = dst;
|
|
6219
6692
|
dst = tmp;
|
|
6220
6693
|
}
|
|
6221
|
-
const outBuf =
|
|
6694
|
+
const outBuf = new Uint8Array(65536);
|
|
6222
6695
|
let used = 0;
|
|
6223
6696
|
for (let i = 0; i < count; i++) {
|
|
6224
6697
|
const idx = src[i];
|
|
@@ -6227,14 +6700,6 @@ function textCommands() {
|
|
|
6227
6700
|
for (let p2 = s; p2 < e; p2++) outBuf[used++] = firstChunk[p2];
|
|
6228
6701
|
outBuf[used++] = 10;
|
|
6229
6702
|
}
|
|
6230
|
-
if (firstChunkLen >= 256 && used <= 32768) {
|
|
6231
|
-
lastSort = {
|
|
6232
|
-
input: encodeBytes(firstChunk.subarray(0, firstChunkLen)),
|
|
6233
|
-
output: outBuf.slice(0, used),
|
|
6234
|
-
direction,
|
|
6235
|
-
maxLineLength: maxSortLine
|
|
6236
|
-
};
|
|
6237
|
-
}
|
|
6238
6703
|
const p = outputRange(context, outBuf, used);
|
|
6239
6704
|
if (isSyncResolved2(p)) return RESOLVED_EXIT_ZERO;
|
|
6240
6705
|
return p.then(RETURN_EXIT_ZERO);
|
|
@@ -6245,7 +6710,10 @@ function textCommands() {
|
|
|
6245
6710
|
} catch (error) {
|
|
6246
6711
|
return diagnostic(context, error).then(RETURN_EXIT_TWO);
|
|
6247
6712
|
} finally {
|
|
6248
|
-
if (usedSortInScratch)
|
|
6713
|
+
if (usedSortInScratch) {
|
|
6714
|
+
sharedSortInScratch.fill(0);
|
|
6715
|
+
sharedSortInUse = false;
|
|
6716
|
+
}
|
|
6249
6717
|
}
|
|
6250
6718
|
}
|
|
6251
6719
|
}
|
|
@@ -6298,7 +6766,7 @@ function textCommands() {
|
|
|
6298
6766
|
return diagnostic(context, error).then(RETURN_EXIT_ONE);
|
|
6299
6767
|
}
|
|
6300
6768
|
if (res2 !== void 0 && res2.done && chunk.length <= 65536) {
|
|
6301
|
-
const outBuf =
|
|
6769
|
+
const outBuf = new Uint8Array(128 * 1024);
|
|
6302
6770
|
let outUsed = 0;
|
|
6303
6771
|
let prevStart = -1;
|
|
6304
6772
|
let prevEnd = -1;
|
|
@@ -6480,7 +6948,7 @@ function textCommands() {
|
|
|
6480
6948
|
}
|
|
6481
6949
|
if (canFast && (targetField >= 1 || fieldMask !== 0 && typeof context.stdin.tryReadAllSync === "function")) {
|
|
6482
6950
|
const req = assertInputRequirements(context, operand !== void 0 ? [operand] : EMPTY_OPERANDS);
|
|
6483
|
-
if (!req && operand === void 0
|
|
6951
|
+
if (!req && operand === void 0) {
|
|
6484
6952
|
const srcIter = input(context, "-")[Symbol.asyncIterator]();
|
|
6485
6953
|
if (typeof srcIter.tryNextSync === "function") {
|
|
6486
6954
|
let res1;
|
|
@@ -6498,18 +6966,10 @@ function textCommands() {
|
|
|
6498
6966
|
} catch (error) {
|
|
6499
6967
|
return diagnostic(context, error).then(RETURN_EXIT_ONE);
|
|
6500
6968
|
}
|
|
6501
|
-
if (res2 !== void 0 && res2.done && chunk.length <
|
|
6502
|
-
|
|
6503
|
-
context.signal.throwIfAborted();
|
|
6504
|
-
if (lastCutOutUsed === 0) return RESOLVED_EXIT_ZERO;
|
|
6505
|
-
const p2 = outputRange(context, cachedCutOutBuffer, lastCutOutUsed);
|
|
6506
|
-
if (isSyncResolved2(p2)) return RESOLVED_EXIT_ZERO;
|
|
6507
|
-
return p2.then(RETURN_EXIT_ZERO);
|
|
6508
|
-
}
|
|
6509
|
-
const outBuf = sharedCutOutBuffer;
|
|
6969
|
+
if (res2 !== void 0 && res2.done && chunk.length < 65536) {
|
|
6970
|
+
const outBuf = new Uint8Array(65536);
|
|
6510
6971
|
let outUsed = 0;
|
|
6511
6972
|
let start = 0;
|
|
6512
|
-
let maxCutLine = 0;
|
|
6513
6973
|
while (start < chunk.length) {
|
|
6514
6974
|
let offset = chunk.indexOf(10, start);
|
|
6515
6975
|
const hasNewline = offset >= 0;
|
|
@@ -6522,7 +6982,6 @@ function textCommands() {
|
|
|
6522
6982
|
context.signal.throwIfAborted();
|
|
6523
6983
|
let boundary = chunk.indexOf(sepByte, start);
|
|
6524
6984
|
if (boundary >= offset) boundary = -1;
|
|
6525
|
-
if (offset - start > maxCutLine) maxCutLine = offset - start;
|
|
6526
6985
|
if (fieldMask !== 0 && boundary >= 0) {
|
|
6527
6986
|
let f = 1;
|
|
6528
6987
|
let curStart = start;
|
|
@@ -6565,14 +7024,6 @@ function textCommands() {
|
|
|
6565
7024
|
}
|
|
6566
7025
|
start = offset + 1;
|
|
6567
7026
|
}
|
|
6568
|
-
if (fieldMask === 0 && chunk.length >= 256 && outUsed <= 32768) {
|
|
6569
|
-
lastCutInBuf = encodeBytes(chunk);
|
|
6570
|
-
lastCutSep = sepByte;
|
|
6571
|
-
lastCutField = targetField;
|
|
6572
|
-
lastCutMaxLineLen = maxCutLine;
|
|
6573
|
-
lastCutOutUsed = outUsed;
|
|
6574
|
-
cachedCutOutBuffer.set(outBuf.subarray(0, outUsed));
|
|
6575
|
-
}
|
|
6576
7027
|
if (outUsed === 0) return RESOLVED_EXIT_ZERO;
|
|
6577
7028
|
const p = outputRange(context, outBuf, outUsed);
|
|
6578
7029
|
if (isSyncResolved2(p)) return RESOLVED_EXIT_ZERO;
|
|
@@ -6588,7 +7039,7 @@ function textCommands() {
|
|
|
6588
7039
|
}
|
|
6589
7040
|
return executeCutGeneral(context);
|
|
6590
7041
|
})
|
|
6591
|
-
].map((
|
|
7042
|
+
].map((command4) => ({ ...command4, filesystemRequirements: command4.name === "cut" ? inputRequirements : textOutputRequirements }));
|
|
6592
7043
|
}
|
|
6593
7044
|
async function executeSortFastAsync(context, direction, req) {
|
|
6594
7045
|
await req;
|
|
@@ -6679,9 +7130,7 @@ async function executeSortFastContinueAsync(context, direction, srcIter, initial
|
|
|
6679
7130
|
}
|
|
6680
7131
|
async function executeCutFastAsync(context, operand, sepByte, targetField, req, existingIter, initialFirstChunk, initialSecondRes) {
|
|
6681
7132
|
if (req) await req;
|
|
6682
|
-
const
|
|
6683
|
-
if (ownsShared) sharedCutOutInUse = true;
|
|
6684
|
-
const outBuf = ownsShared ? sharedCutOutBuffer : new Uint8Array(65536);
|
|
7133
|
+
const outBuf = new Uint8Array(65536);
|
|
6685
7134
|
let outUsed = 0;
|
|
6686
7135
|
const isPipeStage = Boolean(context.stdout.isPipeStage);
|
|
6687
7136
|
const syncSink = !isPipeStage ? context.stdout : void 0;
|
|
@@ -6812,8 +7261,6 @@ async function executeCutFastAsync(context, operand, sepByte, targetField, req,
|
|
|
6812
7261
|
} catch (error) {
|
|
6813
7262
|
await diagnostic(context, error);
|
|
6814
7263
|
return { exitCode: 1 };
|
|
6815
|
-
} finally {
|
|
6816
|
-
if (ownsShared) sharedCutOutInUse = false;
|
|
6817
7264
|
}
|
|
6818
7265
|
}
|
|
6819
7266
|
|
|
@@ -6822,7 +7269,7 @@ init_platform();
|
|
|
6822
7269
|
|
|
6823
7270
|
// packages/safe-bash/src/commands/shuf/index.ts
|
|
6824
7271
|
init_platform();
|
|
6825
|
-
import { RandomIntegers, createShufCommand, createShufCommands as createShufCommands2, evalSyncShuf, settings as
|
|
7272
|
+
import { RandomIntegers, createShufCommand as createShufCommand2, createShufCommands as createShufCommands2, evalSyncShuf, settings as settings22, shufCommands as shufCommands2 } from "../../safe-bash-command-shuf/index.js";
|
|
6826
7273
|
|
|
6827
7274
|
// packages/safe-bash/src/commands/standard.ts
|
|
6828
7275
|
var defaultBaseStandardCommands;
|
|
@@ -6830,12 +7277,12 @@ var defaultTailStandardCommands;
|
|
|
6830
7277
|
function createStandardCommandsWithGrep(options2, grep) {
|
|
6831
7278
|
const commands = [];
|
|
6832
7279
|
const execute = directExecutor(options2.execute ?? (async (context) => {
|
|
6833
|
-
const
|
|
6834
|
-
if (
|
|
7280
|
+
const command4 = commands.find((definition) => definition.name === context.command);
|
|
7281
|
+
if (command4) return command4.execute(context);
|
|
6835
7282
|
await diagnostic(context, new PublicDiagnostic("command not found"));
|
|
6836
7283
|
return { exitCode: 127 };
|
|
6837
7284
|
}));
|
|
6838
|
-
if (options2.maxDirectoryEntries === void 0 && options2.maxTeeTargets === void 0 && options2.maxTailFollowHandles === void 0 && options2.predicateIdentity === void 0) {
|
|
7285
|
+
if (options2.maxDirectoryEntries === void 0 && options2.maxRecursiveDirectoryDepth === void 0 && options2.maxTeeTargets === void 0 && options2.maxTailFollowHandles === void 0 && options2.predicateIdentity === void 0) {
|
|
6839
7286
|
defaultBaseStandardCommands ??= Object.freeze([
|
|
6840
7287
|
...basicCommands(),
|
|
6841
7288
|
...filesystemCommands(void 0),
|
|
@@ -6846,7 +7293,7 @@ function createStandardCommandsWithGrep(options2, grep) {
|
|
|
6846
7293
|
...predicateCommands(void 0),
|
|
6847
7294
|
cmpCommand(),
|
|
6848
7295
|
fmtCommand(),
|
|
6849
|
-
|
|
7296
|
+
createShufCommand2(),
|
|
6850
7297
|
numfmtCommand()
|
|
6851
7298
|
]);
|
|
6852
7299
|
commands.push(
|
|
@@ -6859,8 +7306,8 @@ function createStandardCommandsWithGrep(options2, grep) {
|
|
|
6859
7306
|
for (let i = 0; i < commands.length; i++) builtInDirectContextExecutors.add(commands[i].execute);
|
|
6860
7307
|
return commands;
|
|
6861
7308
|
}
|
|
6862
|
-
commands.push(...basicCommands(), ...filesystemCommands(options2.maxDirectoryEntries), ...streamCommands(options2.maxTeeTargets, options2.maxTailFollowHandles), ...textCommands(), ...grep, ...predicateCommands(options2.predicateIdentity), ...executionCommands(execute, options2.execution), ...createFindDefinitions(execute, options2.maxDirectoryEntries));
|
|
6863
|
-
commands.push(cmpCommand(), fmtCommand(),
|
|
7309
|
+
commands.push(...basicCommands(), ...filesystemCommands(options2.maxDirectoryEntries, options2.maxRecursiveDirectoryDepth), ...streamCommands(options2.maxTeeTargets, options2.maxTailFollowHandles), ...textCommands(), ...grep, ...predicateCommands(options2.predicateIdentity), ...executionCommands(execute, options2.execution), ...createFindDefinitions(execute, options2.maxDirectoryEntries));
|
|
7310
|
+
commands.push(cmpCommand(), fmtCommand(), createShufCommand2(), numfmtCommand());
|
|
6864
7311
|
for (let i = 0; i < commands.length; i++) builtInDirectContextExecutors.add(commands[i].execute);
|
|
6865
7312
|
return commands;
|
|
6866
7313
|
}
|
|
@@ -6876,18 +7323,13 @@ import { alias, createGrepAliases } from "../../safe-bash-io-engine/commands/gre
|
|
|
6876
7323
|
// packages/safe-bash/src/plugins/composition.ts
|
|
6877
7324
|
import { createExprCommandWithExecutor } from "../../safe-bash-command-expr/command.js";
|
|
6878
7325
|
import { createCsplitCommandWithExecutor } from "../../safe-bash-command-csplit/command.js";
|
|
6879
|
-
var defaultMuscleMemoryLookup;
|
|
6880
|
-
function getExtraAgentCommand(name) {
|
|
6881
|
-
defaultMuscleMemoryLookup ??= new Map(createExtraAgentCommands().map((cmd) => [cmd.name, cmd]));
|
|
6882
|
-
return defaultMuscleMemoryLookup.get(name);
|
|
6883
|
-
}
|
|
6884
7326
|
function createExtraAgentCommands(options2) {
|
|
6885
7327
|
return [...createBcCommands(options2?.bc), ...createSpongeCommands(options2?.sponge), ...createOpensslCommands(), ...createSshCommands(), ...createGpgCommands(), ...createFdCommands(options2?.fd), ...createLessCommands(options2?.less), ...createIdCommands(), ...createWhoamiCommands(), ...createUnameCommands(), ...createHostnameCommands(), ...createNprocCommands(), ...createShufCommands(), ...createYesCommands(), ...createDdCommands(), ...createNumfmtCommands(), ...createEnvsubstCommands(), ...createCalCommands(), ...createPathchkCommands(), ...createGetconfCommands(), ...createLocaleCommands(), ...createDfCommands(), ...createSqlite3Commands(options2?.sqlite3)];
|
|
6886
7328
|
}
|
|
6887
7329
|
function commandExecutor(lookup) {
|
|
6888
7330
|
return async (context) => {
|
|
6889
|
-
const
|
|
6890
|
-
if (
|
|
7331
|
+
const command4 = lookup(context.command);
|
|
7332
|
+
if (command4) return command4.execute(context);
|
|
6891
7333
|
await diagnostic(context, new PublicDiagnostic("command not found"));
|
|
6892
7334
|
return { exitCode: 127 };
|
|
6893
7335
|
};
|
|
@@ -6946,7 +7388,7 @@ function composeRawAgentCommands(options2, executors, additionalCommands = []) {
|
|
|
6946
7388
|
const defaults = getDefaultStatelessFamilies();
|
|
6947
7389
|
const aliasesGrep = executors.aliases === executors.grep ? grep[0] : createGrepCommands(executors.aliases, { ergonomicRegex: useErgonomicGrep })[0];
|
|
6948
7390
|
commands.push(
|
|
6949
|
-
...createStandardCommandsWithGrep({ execute: options2.execute ?? commandExecutor((name) => commands.find((
|
|
7391
|
+
...createStandardCommandsWithGrep({ execute: options2.execute ?? commandExecutor((name) => commands.find((command4) => command4.name === name)), ...options2.execution === void 0 ? {} : { execution: options2.execution }, ...options2.regex === void 0 ? {} : { regex: options2.regex }, ...options2.maxDirectoryEntries === void 0 ? {} : { maxDirectoryEntries: options2.maxDirectoryEntries }, ...options2.maxRecursiveDirectoryDepth === void 0 ? {} : { maxRecursiveDirectoryDepth: options2.maxRecursiveDirectoryDepth }, ...options2.maxTeeTargets === void 0 ? {} : { maxTeeTargets: options2.maxTeeTargets }, ...options2.maxTailFollowHandles === void 0 ? {} : { maxTailFollowHandles: options2.maxTailFollowHandles } }, grep),
|
|
6950
7392
|
...defaults.beforeAliases,
|
|
6951
7393
|
createRgCommand(executors.search, options2.search),
|
|
6952
7394
|
...createGrepAliases(aliasesGrep),
|
|
@@ -6973,7 +7415,7 @@ function composeRawAgentCommands(options2, executors, additionalCommands = []) {
|
|
|
6973
7415
|
const applyPatchLimits = options2.applyPatch?.limits;
|
|
6974
7416
|
const xmlLimits = options2.xml?.limits;
|
|
6975
7417
|
commands.push(
|
|
6976
|
-
...createStandardCommandsWithGrep({ execute: options2.execute ?? commandExecutor((name) => commands.find((
|
|
7418
|
+
...createStandardCommandsWithGrep({ execute: options2.execute ?? commandExecutor((name) => commands.find((command4) => command4.name === name)), ...options2.execution === void 0 ? {} : { execution: options2.execution }, ...options2.regex === void 0 ? {} : { regex: options2.regex }, ...options2.maxDirectoryEntries === void 0 ? {} : { maxDirectoryEntries: options2.maxDirectoryEntries }, ...options2.maxRecursiveDirectoryDepth === void 0 ? {} : { maxRecursiveDirectoryDepth: options2.maxRecursiveDirectoryDepth }, ...options2.maxTeeTargets === void 0 ? {} : { maxTeeTargets: options2.maxTeeTargets }, ...options2.maxTailFollowHandles === void 0 ? {} : { maxTailFollowHandles: options2.maxTailFollowHandles } }, grep).filter((command4) => !options2.muscleMemory || command4.name !== "shuf" && command4.name !== "numfmt"),
|
|
6977
7419
|
...createTextProgramCommands({ ...options2.text }),
|
|
6978
7420
|
...createStructuredCommands({ ...options2.structured }),
|
|
6979
7421
|
createRgCommand(executors.search, options2.search),
|
|
@@ -7056,6 +7498,9 @@ function createAgentCommandPlugin(options2, executors, additionalCommands = [])
|
|
|
7056
7498
|
}
|
|
7057
7499
|
|
|
7058
7500
|
export {
|
|
7501
|
+
createNumfmtCommand,
|
|
7502
|
+
createNumfmtCommands,
|
|
7503
|
+
numfmtCommands,
|
|
7059
7504
|
createStandardCommandsWithGrep,
|
|
7060
7505
|
sedCommand,
|
|
7061
7506
|
createTextProgramCommands,
|
|
@@ -7074,6 +7519,10 @@ export {
|
|
|
7074
7519
|
byteCommands,
|
|
7075
7520
|
createTableTextCommands,
|
|
7076
7521
|
tableTextCommands,
|
|
7522
|
+
createStreamInspectionCommands,
|
|
7523
|
+
streamInspectionCommands,
|
|
7524
|
+
createStreamFormatCommands,
|
|
7525
|
+
streamFormatCommands,
|
|
7077
7526
|
createSplitCommand,
|
|
7078
7527
|
createSplitCommands,
|
|
7079
7528
|
evalSyncSplit,
|
|
@@ -7085,6 +7534,12 @@ export {
|
|
|
7085
7534
|
createApplyPatchCommand,
|
|
7086
7535
|
createApplyPatchCommands,
|
|
7087
7536
|
evalSyncApplyPatch,
|
|
7537
|
+
createBcCommand,
|
|
7538
|
+
createBcCommands,
|
|
7539
|
+
bcCommands,
|
|
7540
|
+
createSpongeCommand,
|
|
7541
|
+
createSpongeCommands,
|
|
7542
|
+
spongeCommands,
|
|
7088
7543
|
createOpensslCommand,
|
|
7089
7544
|
createOpensslCommands,
|
|
7090
7545
|
opensslCommands,
|
|
@@ -7095,9 +7550,42 @@ export {
|
|
|
7095
7550
|
createGpgCommand,
|
|
7096
7551
|
createGpgCommands,
|
|
7097
7552
|
gpgCommands,
|
|
7553
|
+
createIdCommand,
|
|
7554
|
+
createIdCommands,
|
|
7555
|
+
idCommands,
|
|
7556
|
+
createWhoamiCommand,
|
|
7557
|
+
createWhoamiCommands,
|
|
7558
|
+
whoamiCommands,
|
|
7559
|
+
createUnameCommand,
|
|
7560
|
+
createUnameCommands,
|
|
7561
|
+
unameCommands,
|
|
7562
|
+
createHostnameCommand,
|
|
7563
|
+
createHostnameCommands,
|
|
7564
|
+
hostnameCommands,
|
|
7565
|
+
createNprocCommand,
|
|
7566
|
+
createNprocCommands,
|
|
7567
|
+
nprocCommands,
|
|
7568
|
+
createShufCommand,
|
|
7569
|
+
createShufCommands,
|
|
7570
|
+
shufCommands,
|
|
7098
7571
|
createYesCommand,
|
|
7099
7572
|
createYesCommands,
|
|
7100
7573
|
yesCommands,
|
|
7574
|
+
createDdCommand,
|
|
7575
|
+
createDdCommands,
|
|
7576
|
+
ddCommands,
|
|
7577
|
+
createEnvsubstCommand,
|
|
7578
|
+
createEnvsubstCommands,
|
|
7579
|
+
envsubstCommands,
|
|
7580
|
+
createGetconfCommand,
|
|
7581
|
+
createGetconfCommands,
|
|
7582
|
+
getconfCommands,
|
|
7583
|
+
createLocaleCommand,
|
|
7584
|
+
createLocaleCommands,
|
|
7585
|
+
localeCommands,
|
|
7586
|
+
createSqlite3Command,
|
|
7587
|
+
createSqlite3Commands,
|
|
7588
|
+
sqlite3Commands,
|
|
7101
7589
|
composeAgentCommands,
|
|
7102
7590
|
createRegexExecutors,
|
|
7103
7591
|
baseAgentCommands,
|