@poe-platform/safe-bash 0.1.788 → 0.1.790
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 +1 -1
- package/dist/image-ast/index.browser.js +147 -80
- package/dist/image-ast/index.js +147 -80
- package/dist/mp4-ast/mp4.d.ts +2 -0
- package/dist/pdf-ast/cos/parser.d.ts +1 -0
- package/dist/pdf-ast/cos/security.d.ts +2 -0
- package/dist/pdf-ast/cos/writer.d.ts +1 -0
- package/dist/pdf-ast/document.d.ts +3 -0
- package/dist/pdf-ast/edit/forms.d.ts +1 -0
- package/dist/pdf-ast/index.js +171 -82
- package/dist/safe-bash/chunks/{chunk-L5QQLNTO.js → chunk-22PI65AH.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-Q3E6C3DX.js → chunk-2TAGYMPK.js} +49 -34
- package/dist/safe-bash/chunks/{chunk-Z3HX3ZBA.js → chunk-2W4HTMEK.js} +52 -48
- package/dist/safe-bash/chunks/{chunk-FFZXP6ZC.js → chunk-3M7L7XU2.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-XNODZRVD.js → chunk-3QAO6UYS.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-YPETOVQU.js → chunk-3VKFK3NF.js} +2 -2
- package/dist/safe-bash/chunks/chunk-5OST7NOX.js +42 -0
- package/dist/safe-bash/chunks/{chunk-KEBSX2AX.js → chunk-6HLURHVU.js} +2 -2
- package/dist/safe-bash/chunks/chunk-DYEUZE6Z.js +19 -0
- package/dist/safe-bash/chunks/{chunk-T2TGCHKE.js → chunk-FM3WBSZT.js} +2 -2
- package/dist/safe-bash/chunks/chunk-GAYRKQM6.js +22 -0
- package/dist/safe-bash/chunks/{chunk-Q45QCA4J.js → chunk-I3KSESCR.js} +0 -7
- package/dist/safe-bash/chunks/{chunk-OSKDIBQS.js → chunk-JLIMK5TD.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-2AYZCT5X.js → chunk-JQ2FAJJT.js} +27 -23
- package/dist/safe-bash/chunks/{chunk-QA3NVP43.js → chunk-JRE6Z3T7.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-DC5EHLKS.js → chunk-NDIL6T7Y.js} +5 -5
- package/dist/safe-bash/chunks/{chunk-747G42FY.js → chunk-OPR4UAIT.js} +2 -2
- package/dist/safe-bash/chunks/chunk-OSMQCYSP.js +19 -0
- package/dist/safe-bash/chunks/chunk-OYB332PQ.js +17 -0
- package/dist/safe-bash/chunks/{chunk-ZMYVCRAF.js → chunk-QTIH2AFE.js} +77 -69
- package/dist/safe-bash/chunks/{chunk-PYTLIUST.js → chunk-SBESXWT2.js} +43 -44
- package/dist/safe-bash/chunks/{chunk-4FDQJUFW.js → chunk-SDEPGTOF.js} +1 -1
- package/dist/safe-bash/chunks/chunk-UZU5BIJI.js +32 -0
- package/dist/safe-bash/chunks/{chunk-BI6JV62X.js → chunk-VCCMROTL.js} +7 -10
- package/dist/safe-bash/chunks/chunk-W47GHRRF.js +13 -0
- package/dist/safe-bash/chunks/{chunk-NPMQWZUZ.js → chunk-WS7KZIUM.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-3PZYHMGM.js → chunk-YYAERCWS.js} +7 -7
- package/dist/safe-bash/chunks/{chunk-5U7JECDB.js → chunk-ZPGVEUKF.js} +8 -7
- package/dist/safe-bash/chunks/{csvkit-K55OYAQC.js → csvkit-USUJG62I.js} +65 -11
- package/dist/safe-bash/chunks/{ffmpeg-BEFTQ6DZ.js → ffmpeg-KRGG5DLH.js} +21 -10
- package/dist/safe-bash/chunks/{gh-HQWOWLWE.js → gh-UCFDUZCX.js} +16 -8
- package/dist/safe-bash/chunks/{git-UFNPAOYZ.js → git-LPAF6KDG.js} +7 -9
- package/dist/safe-bash/chunks/{imagemagick-53BMHH6D.js → imagemagick-KGREKK4G.js} +38 -7
- package/dist/safe-bash/chunks/{implementation-QUTAAYMT.js → implementation-FXDRYS5A.js} +34 -8
- package/dist/safe-bash/chunks/{pdfimages-4OYI6FLG.js → pdfimages-UADCF4G4.js} +12 -8
- package/dist/safe-bash/chunks/{pdfinfo-I7U6TQPP.js → pdfinfo-O7UWPF4W.js} +38 -13
- package/dist/safe-bash/chunks/{pdftk-SUA6FMHI.js → pdftk-AERXIJTN.js} +13 -8
- package/dist/safe-bash/chunks/{pdftoppm-4C5DGEWX.js → pdftoppm-L466JQKI.js} +17 -10
- package/dist/safe-bash/chunks/{pdftotext-Y4WI225Y.js → pdftotext-SUSI4WXS.js} +19 -9
- package/dist/safe-bash/chunks/{qpdf-IORB4RV5.js → qpdf-YL24KVRH.js} +14 -8
- package/dist/safe-bash/chunks/{sips-WHAMJFEU.js → sips-QXEQZERX.js} +14 -7
- package/dist/safe-bash/chunks/{soffice-SYEK6WJS.js → soffice-TBITRML3.js} +16 -8
- package/dist/safe-bash/chunks/{wkhtmltopdf-ZIICWJLF.js → wkhtmltopdf-NJA2THRC.js} +27 -7
- package/dist/safe-bash/command-chunks/chunk-2C5BEBPY.js +1388 -0
- package/dist/safe-bash/command-chunks/{chunk-FXYWQ6S4.js → chunk-2EXV2ZLV.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-PFBJR2PY.js → chunk-2KRKKW5S.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-4DSJDVBM.js → chunk-32F3RBUW.js} +10 -749
- package/dist/safe-bash/command-chunks/{chunk-L3MLMXL4.js → chunk-3ZK5F23O.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-4QX6XCDD.js → chunk-4RNIZ3RT.js} +79 -0
- package/dist/safe-bash/command-chunks/{chunk-D7TADAYG.js → chunk-64LG3EVJ.js} +17 -0
- package/dist/safe-bash/command-chunks/{chunk-TOSM3T3A.js → chunk-6EASC5EC.js} +20 -9
- package/dist/safe-bash/command-chunks/{chunk-ZF3ZVGQC.js → chunk-7JRITHKW.js} +150 -80
- package/dist/safe-bash/command-chunks/{chunk-IJ3FXP4Q.js → chunk-A3ZX6SCY.js} +1 -1
- package/dist/safe-bash/{chunks/chunk-LD76P7AG.js → command-chunks/chunk-AKDMCNX4.js} +74 -39
- package/dist/safe-bash/command-chunks/{chunk-KSIGF4AG.js → chunk-BK4CMEE6.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-JUDOV5MJ.js → chunk-CBDVLMJB.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-XGMWWUHV.js → chunk-CZ5DAK4K.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-Z57TV6TC.js → chunk-EZ2DTOLI.js} +4 -2
- package/dist/safe-bash/command-chunks/{chunk-ADCGH6A7.js → chunk-FH3D75FC.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-WYJTWJZ5.js → chunk-G3G6W5ZE.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-3HDIDEUJ.js → chunk-GF54KE2M.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-H4LWTITX.js +169 -0
- package/dist/safe-bash/command-chunks/chunk-I2MQNBGR.js +145 -0
- package/dist/safe-bash/command-chunks/{chunk-Z7TYZG3A.js → chunk-IHHTTQX6.js} +5 -3
- package/dist/safe-bash/command-chunks/{chunk-5GRLAARV.js → chunk-IOXI5ZAJ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-INDIFLBW.js → chunk-JTAGNROA.js} +4 -0
- package/dist/safe-bash/command-chunks/{chunk-Y5IHIAY3.js → chunk-MDPIOQUD.js} +12 -8
- package/dist/safe-bash/command-chunks/chunk-PGEYORBZ.js +25 -0
- package/dist/safe-bash/command-chunks/chunk-QI4MGIN6.js +6 -0
- package/dist/safe-bash/command-chunks/chunk-QM4UZF3C.js +753 -0
- package/dist/safe-bash/command-chunks/chunk-QTYZAWSB.js +91 -0
- package/dist/safe-bash/command-chunks/chunk-SNK7K3XW.js +90 -0
- package/dist/safe-bash/command-chunks/chunk-T5OLGM43.js +314 -0
- package/dist/safe-bash/command-chunks/chunk-TB7IFMUZ.js +802 -0
- package/dist/safe-bash/command-chunks/{chunk-YNT4ZJHW.js → chunk-TPPBPIWL.js} +3 -3
- package/dist/safe-bash/command-chunks/chunk-VMK4XVKO.js +82 -0
- package/dist/safe-bash/command-chunks/chunk-VNSJKXDU.js +130 -0
- package/dist/safe-bash/command-chunks/{chunk-2LP3VMPA.js → chunk-WFDW4XXD.js} +1 -17
- package/dist/safe-bash/command-chunks/chunk-WR37IS4O.js +318 -0
- package/dist/safe-bash/command-chunks/chunk-YFNTMH6Z.js +6 -0
- package/dist/safe-bash/commands/basic.js +148 -48
- package/dist/safe-bash/commands/bytes/compression/index.js +5 -6
- package/dist/safe-bash/commands/cmp.d.ts +2 -3
- package/dist/safe-bash/commands/cmp.js +2 -689
- package/dist/safe-bash/commands/csplit/index.browser.js +2 -2
- package/dist/safe-bash/commands/docx/index.browser.js +4 -47
- package/dist/safe-bash/commands/docx/index.d.ts +2 -24
- package/dist/safe-bash/commands/docx/index.js +2 -41
- package/dist/safe-bash/commands/docx/io.d.ts +1 -14
- package/dist/safe-bash/commands/docx/io.js +1 -15
- package/dist/safe-bash/commands/factor/index.browser.js +2 -2
- 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/iconv/index.browser.js +2 -2
- package/dist/safe-bash/commands/line-endings/index.browser.js +2 -2
- package/dist/safe-bash/commands/llm/command.d.ts +1 -4
- package/dist/safe-bash/commands/llm/command.js +1 -248
- package/dist/safe-bash/commands/llm/elevenlabs-stream.d.ts +1 -2
- package/dist/safe-bash/commands/llm/elevenlabs-stream.js +1 -117
- package/dist/safe-bash/commands/llm/elevenlabs.d.ts +1 -15
- package/dist/safe-bash/commands/llm/elevenlabs.js +1 -123
- package/dist/safe-bash/commands/llm/index.browser.js +20 -15
- package/dist/safe-bash/commands/llm/index.d.ts +1 -6
- package/dist/safe-bash/commands/llm/index.js +1 -4
- package/dist/safe-bash/commands/llm/mime.d.ts +1 -2
- package/dist/safe-bash/commands/llm/mime.js +1 -136
- package/dist/safe-bash/commands/llm/openai-http.d.ts +1 -8
- package/dist/safe-bash/commands/llm/openai-http.js +1 -143
- package/dist/safe-bash/commands/llm/openai-sse.d.ts +1 -3
- package/dist/safe-bash/commands/llm/openai-sse.js +1 -78
- package/dist/safe-bash/commands/llm/openai.d.ts +1 -14
- package/dist/safe-bash/commands/llm/openai.js +1 -288
- package/dist/safe-bash/commands/llm/providers/elevenlabs.d.ts +1 -1
- package/dist/safe-bash/commands/llm/providers/elevenlabs.js +1 -1
- package/dist/safe-bash/commands/llm/providers/index.browser.js +6 -6
- package/dist/safe-bash/commands/llm/providers/index.d.ts +1 -3
- package/dist/safe-bash/commands/llm/providers/index.js +1 -2
- package/dist/safe-bash/commands/llm/providers/openai.d.ts +1 -1
- package/dist/safe-bash/commands/llm/providers/openai.js +1 -1
- package/dist/safe-bash/commands/llm/providers/shared.d.ts +1 -23
- package/dist/safe-bash/commands/llm/providers/shared.js +1 -65
- package/dist/safe-bash/commands/llm/service.d.ts +1 -37
- package/dist/safe-bash/commands/llm/service.js +1 -151
- package/dist/safe-bash/commands/llm/types.d.ts +1 -52
- package/dist/safe-bash/commands/llm/types.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/index.browser.js +9 -9
- package/dist/safe-bash/commands/network/types.d.ts +2 -40
- package/dist/safe-bash/commands/node/index.browser.js +6 -8
- package/dist/safe-bash/commands/op/index.browser.js +3 -3
- package/dist/safe-bash/commands/op/index.js +12 -28
- package/dist/safe-bash/commands/pptx/index.d.ts +2 -28
- package/dist/safe-bash/commands/pptx/index.js +2 -152
- package/dist/safe-bash/commands/pr/index.browser.js +2 -2
- package/dist/safe-bash/commands/printf-float.d.ts +1 -0
- package/dist/safe-bash/commands/printf-float.js +48 -38
- package/dist/safe-bash/commands/printf-format.js +9 -6
- package/dist/safe-bash/commands/printf-quote.d.ts +3 -0
- package/dist/safe-bash/commands/printf-quote.js +62 -0
- package/dist/safe-bash/commands/printf-wide.d.ts +5 -0
- package/dist/safe-bash/commands/printf-wide.js +41 -0
- package/dist/safe-bash/commands/python/index.browser.js +8 -8
- package/dist/safe-bash/commands/python/worker.browser.js +2 -2
- package/dist/safe-bash/commands/truncate.d.ts +2 -3
- package/dist/safe-bash/commands/truncate.js +2 -686
- 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 +3 -3
- package/dist/safe-bash/contracts/diagnostics.d.ts +2 -0
- package/dist/safe-bash/contracts/diagnostics.js +2 -0
- package/dist/safe-bash/contracts/runtime-control.d.ts +2 -0
- package/dist/safe-bash/contracts/runtime-control.js +2 -0
- package/dist/safe-bash/core.browser.d.ts +1 -1
- package/dist/safe-bash/core.browser.js +10645 -14065
- package/dist/safe-bash/core.d.ts +10 -1
- package/dist/safe-bash/core.js +0 -1
- package/dist/safe-bash/jobs.browser.js +5 -4
- package/dist/safe-bash/opt-in/commands/cmp/index.d.ts +6 -2
- package/dist/safe-bash/opt-in/commands/cmp/index.js +776 -79
- package/dist/safe-bash/opt-in/commands/cmp/options.d.ts +0 -12
- package/dist/safe-bash/opt-in/commands/cmp/options.js +0 -153
- package/dist/safe-bash/opt-in/commands/truncate/index.d.ts +8 -3
- package/dist/safe-bash/opt-in/commands/truncate/index.js +790 -272
- package/dist/safe-bash/opt-in/commands/truncate/sync.d.ts +1 -0
- package/dist/safe-bash/opt-in/commands/truncate/sync.js +60 -0
- package/dist/safe-bash/optional-host.browser.js +61 -80
- package/dist/safe-bash/optional-host.d.ts +3 -1
- package/dist/safe-bash/optional-host.js +3 -1
- package/dist/safe-bash/shell/runtime.js +44 -18
- package/dist/safe-bash/yq-browser/index.js +1 -1
- package/dist/safe-bash-checksum-engine/index.d.ts +1 -1
- package/dist/safe-bash-checksum-engine/index.js +14 -2
- package/dist/safe-bash-command-bzip2/index.js +2 -1
- package/dist/safe-bash-command-cmp/index.d.ts +10 -0
- package/dist/safe-bash-command-cmp/index.js +796 -0
- package/dist/safe-bash-command-cmp/options.d.ts +12 -0
- package/dist/safe-bash-command-cmp/options.js +42 -0
- package/dist/safe-bash-command-csvcut/index.js +11 -8
- package/dist/safe-bash-command-csvgrep/index.js +35 -7
- package/dist/safe-bash-command-csvkit/codecs/python.js +4 -3
- package/dist/safe-bash-command-csvkit/codecs/utf8.js +3 -2
- package/dist/safe-bash-command-csvkit/index.js +80 -324
- package/dist/safe-bash-command-csvkit/python-regex.d.ts +5 -0
- package/dist/safe-bash-command-csvkit/python-regex.js +14 -0
- package/dist/safe-bash-command-csvkit/runtime.d.ts +1 -0
- package/dist/safe-bash-command-csvkit/sync-support.js +4 -2
- package/dist/safe-bash-command-diff3/index.js +3 -0
- package/dist/safe-bash-command-docx/LICENSE +21 -0
- package/dist/safe-bash-command-docx/index.d.ts +30 -0
- package/dist/safe-bash-command-docx/index.js +67 -0
- package/dist/safe-bash-command-docx/io.d.ts +14 -0
- package/dist/safe-bash-command-docx/io.js +26 -0
- package/dist/safe-bash-command-envsubst/index.js +34 -3
- package/dist/safe-bash-command-exiftool/index.js +3 -0
- package/dist/safe-bash-command-ffmpeg/index.js +8073 -7940
- package/dist/safe-bash-command-fold/family.js +1 -1
- package/dist/safe-bash-command-fold/index.js +1 -1
- package/dist/safe-bash-command-git/git_rust.wasm +0 -0
- package/dist/safe-bash-command-git/wasm.generated.js +1 -1
- package/dist/safe-bash-command-htmlq/index.js +5 -0
- package/dist/safe-bash-command-imagemagick/index.d.ts +25 -21
- package/dist/safe-bash-command-imagemagick/index.js +671 -273
- package/dist/safe-bash-command-llm/LICENSE +21 -0
- package/dist/safe-bash-command-llm/command.d.ts +5 -0
- package/dist/safe-bash-command-llm/command.js +14 -0
- package/dist/safe-bash-command-llm/configuration.d.ts +18 -0
- package/dist/safe-bash-command-llm/elevenlabs-stream.d.ts +2 -0
- package/dist/safe-bash-command-llm/elevenlabs-stream.js +7 -0
- package/dist/safe-bash-command-llm/elevenlabs.d.ts +15 -0
- package/dist/safe-bash-command-llm/elevenlabs.js +10 -0
- package/dist/safe-bash-command-llm/index.d.ts +10 -0
- package/dist/safe-bash-command-llm/index.js +46 -0
- package/dist/safe-bash-command-llm/mime.d.ts +2 -0
- package/dist/safe-bash-command-llm/mime.js +9 -0
- package/dist/safe-bash-command-llm/model-options.d.ts +3 -0
- package/dist/safe-bash-command-llm/openai-http.d.ts +8 -0
- package/dist/safe-bash-command-llm/openai-http.js +17 -0
- package/dist/safe-bash-command-llm/openai-sse.d.ts +3 -0
- package/dist/safe-bash-command-llm/openai-sse.js +8 -0
- package/dist/safe-bash-command-llm/openai.d.ts +14 -0
- package/dist/safe-bash-command-llm/openai.js +12 -0
- package/dist/safe-bash-command-llm/providers/elevenlabs.d.ts +1 -0
- package/dist/safe-bash-command-llm/providers/elevenlabs.js +11 -0
- package/dist/safe-bash-command-llm/providers/index.d.ts +3 -0
- package/dist/safe-bash-command-llm/providers/index.js +24 -0
- package/dist/safe-bash-command-llm/providers/openai.d.ts +1 -0
- package/dist/safe-bash-command-llm/providers/openai.js +13 -0
- package/dist/safe-bash-command-llm/providers/shared.d.ts +23 -0
- package/dist/safe-bash-command-llm/providers/shared.js +13 -0
- package/dist/safe-bash-command-llm/schemas.d.ts +2 -0
- package/dist/safe-bash-command-llm/service.d.ts +42 -0
- package/dist/safe-bash-command-llm/service.js +9 -0
- package/dist/safe-bash-command-llm/templates.d.ts +27 -0
- package/dist/safe-bash-command-llm/types.d.ts +87 -0
- package/dist/safe-bash-command-llm/types.js +6 -0
- package/dist/safe-bash-command-mmdc/command.d.ts +4 -0
- package/dist/safe-bash-command-mmdc/index.d.ts +1 -1
- package/dist/safe-bash-command-mmdc/index.js +7134 -6699
- package/dist/safe-bash-command-mmdc/layout.d.ts +1 -0
- package/dist/safe-bash-command-mmdc/parser.d.ts +1 -0
- package/dist/safe-bash-command-mmdc/png.d.ts +3 -0
- package/dist/safe-bash-command-mmdc/raster.d.ts +1 -0
- package/dist/safe-bash-command-mmdc/svg.d.ts +1 -0
- package/dist/safe-bash-command-op/index.js +19 -14
- package/dist/safe-bash-command-pandoc/command.js +3 -3
- package/dist/safe-bash-command-pandoc/index.js +3 -3
- package/dist/safe-bash-command-pdfimages/index.d.ts +7 -1
- package/dist/safe-bash-command-pdfimages/index.js +210 -113
- package/dist/safe-bash-command-pdfinfo/index.d.ts +24 -20
- package/dist/safe-bash-command-pdfinfo/index.js +517 -241
- package/dist/safe-bash-command-pdftk/index.d.ts +7 -3
- package/dist/safe-bash-command-pdftk/index.js +261 -125
- package/dist/safe-bash-command-pdftoppm/index.d.ts +15 -7
- package/dist/safe-bash-command-pdftoppm/index.js +326 -189
- package/dist/safe-bash-command-pdftotext/index.d.ts +9 -5
- package/dist/safe-bash-command-pdftotext/index.js +237 -107
- package/dist/safe-bash-command-pptx/LICENSE +21 -0
- package/dist/safe-bash-command-pptx/index.d.ts +33 -0
- package/dist/safe-bash-command-pptx/index.js +168 -0
- package/dist/safe-bash-command-qpdf/index.d.ts +9 -3
- package/dist/safe-bash-command-qpdf/index.js +254 -130
- package/dist/safe-bash-command-sha512sum/index.js +12 -475
- package/dist/safe-bash-command-sips/index.d.ts +9 -5
- package/dist/safe-bash-command-sips/index.js +65 -46
- package/dist/safe-bash-command-soffice/index.d.ts +9 -3
- package/dist/safe-bash-command-soffice/index.js +66 -25
- package/dist/safe-bash-command-sqlite3/engine.d.ts +9 -0
- package/dist/safe-bash-command-sqlite3/index.d.ts +1 -0
- package/dist/safe-bash-command-sqlite3/index.js +851 -352
- package/dist/safe-bash-command-ssconvert/formats/xls.js +3 -3
- package/dist/safe-bash-command-ssconvert/index.js +147 -80
- package/dist/safe-bash-command-timeout/index.js +3 -3
- package/dist/safe-bash-command-truncate/index.d.ts +8 -3
- package/dist/safe-bash-command-truncate/index.js +790 -272
- package/dist/safe-bash-command-truncate/sync.d.ts +1 -0
- package/dist/safe-bash-command-truncate/sync.js +60 -0
- package/dist/safe-bash-command-wkhtmltopdf/index.js +239 -118
- package/dist/safe-bash-command-wkhtmltopdf/pdf-renderer.d.ts +1 -1
- package/dist/safe-bash-command-xxd/index.js +78 -20
- package/dist/safe-bash-command-xz/command.d.ts +4 -0
- package/dist/safe-bash-command-xz/index.d.ts +1 -1
- package/dist/safe-bash-command-xz/index.js +1 -1
- package/dist/safe-bash-compression-engine/bounded-codec.js +3 -3
- package/dist/safe-bash-compression-engine/codec-loader.js +2 -2
- package/dist/safe-bash-compression-engine/files.js +6 -6
- package/dist/safe-bash-compression-engine/index.js +5 -5
- package/dist/safe-bash-compression-engine/operand.js +6 -6
- package/dist/safe-bash-compression-engine/stream.js +5 -5
- package/dist/safe-bash-compression-engine/zstd-decode.js +4 -4
- package/dist/safe-bash-contracts/command.js +3 -3
- package/dist/safe-bash-contracts/default-executor.d.ts +5 -0
- package/dist/safe-bash-contracts/default-executor.js +37 -0
- package/dist/safe-bash-contracts/diagnostics.js +3 -3
- package/dist/safe-bash-contracts/escaping.js +9 -9
- package/dist/safe-bash-contracts/filesystem-descriptor.js +3 -3
- package/dist/safe-bash-contracts/filesystem-output.js +8 -8
- package/dist/safe-bash-contracts/http.d.ts +41 -0
- package/dist/safe-bash-contracts/http.js +6 -0
- package/dist/safe-bash-contracts/index.js +21 -19
- package/dist/safe-bash-contracts/io.d.ts +12 -0
- package/dist/safe-bash-contracts/io.js +4 -1
- package/dist/safe-bash-contracts/output.js +3 -2
- package/dist/safe-bash-contracts/runtime-control.js +2 -2
- package/dist/safe-bash-contracts/signals.js +1 -1
- package/dist/safe-bash-contracts/yield.d.ts +1 -0
- package/dist/safe-bash-contracts/yield.js +3 -1
- package/dist/safe-bash-csv-engine/index.d.ts +10 -1
- package/dist/safe-bash-csv-engine/index.js +78 -6
- package/dist/safe-bash-io-engine/commands/search/requirements.js +3 -3
- package/dist/safe-bash-io-engine/commands/text-programs/shared.js +3 -3
- package/dist/safe-bash-io-engine/gnu-information.d.ts +1 -1
- package/dist/safe-bash-io-engine/gnu-information.js +1 -1
- package/dist/safe-bash-io-engine/internal.d.ts +1 -1
- package/dist/safe-bash-io-engine/internal.js +2 -2
- package/dist/safe-bash-query-engine/index.js +5 -5
- package/dist/safe-bash-query-engine/interpreter.js +3 -3
- package/dist/safe-bash-query-engine/query-core.js +5 -5
- package/package.json +2 -2
- package/dist/safe-bash/chunks/chunk-2G2T5MEM.js +0 -14
- package/dist/safe-bash/chunks/chunk-FJZNUUOQ.js +0 -81
- package/dist/safe-bash/chunks/chunk-GJWUEOT6.js +0 -14
- package/dist/safe-bash/chunks/chunk-LAPF2XE6.js +0 -14
- package/dist/safe-bash/chunks/chunk-O6356Z27.js +0 -37
- package/dist/safe-bash/chunks/chunk-S2LSZFZ6.js +0 -758
- package/dist/safe-bash/chunks/chunk-T3VDYWKZ.js +0 -21
- package/dist/safe-bash/chunks/chunk-VYW4Q6KF.js +0 -12
- package/dist/safe-bash/chunks/chunk-WHURJBET.js +0 -409
- package/dist/safe-bash/opt-in/commands/cmp/compare.js +0 -95
- package/dist/safe-bash/opt-in/commands/cmp/io.js +0 -218
- package/dist/safe-bash/command-chunks/{chunk-RTOJNFFL.js → chunk-KNI4GRXF.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-DEH3CMGL.js → chunk-QJ3ONEBI.js} +3 -3
|
@@ -1,32 +1,40 @@
|
|
|
1
1
|
import {
|
|
2
2
|
shellValueByteLength,
|
|
3
|
-
|
|
4
|
-
} from "./chunk-
|
|
3
|
+
shellValueBytes
|
|
4
|
+
} from "./chunk-VCCMROTL.js";
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
} from "./chunk-
|
|
6
|
+
writeDiagnostic
|
|
7
|
+
} from "./chunk-W47GHRRF.js";
|
|
8
8
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
FsError,
|
|
10
|
+
createOutputOperation
|
|
11
|
+
} from "./chunk-OYB332PQ.js";
|
|
11
12
|
import {
|
|
12
|
-
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
getCommandArguments
|
|
14
|
+
} from "./chunk-DYEUZE6Z.js";
|
|
14
15
|
import {
|
|
16
|
+
inheritYieldCheckpoint,
|
|
15
17
|
normalizePath,
|
|
16
|
-
posixPath
|
|
17
|
-
|
|
18
|
+
posixPath,
|
|
19
|
+
yieldTurn
|
|
20
|
+
} from "./chunk-UZU5BIJI.js";
|
|
18
21
|
import {
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
collectBytes,
|
|
23
|
+
outputFailure,
|
|
24
|
+
readBytes,
|
|
25
|
+
toByteSource,
|
|
26
|
+
writeBytes
|
|
27
|
+
} from "./chunk-OSMQCYSP.js";
|
|
21
28
|
import {
|
|
22
|
-
|
|
23
|
-
|
|
29
|
+
builtInDirectContextExecutors,
|
|
30
|
+
pathOf,
|
|
31
|
+
syncCommandEvaluators
|
|
32
|
+
} from "./chunk-5OST7NOX.js";
|
|
24
33
|
import {
|
|
25
34
|
TransformStream,
|
|
26
|
-
__reExport,
|
|
27
35
|
import_buffer,
|
|
28
36
|
init_platform
|
|
29
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-I3KSESCR.js";
|
|
30
38
|
|
|
31
39
|
// packages/safe-bash/src/commands/network/public.ts
|
|
32
40
|
init_platform();
|
|
@@ -141,14 +149,14 @@ function networkError(error) {
|
|
|
141
149
|
return new CurlError(56, "Network transfer failed");
|
|
142
150
|
}
|
|
143
151
|
async function diagnostic(context, error) {
|
|
144
|
-
await
|
|
152
|
+
await writeDiagnostic(context.stderr, `${context.command}: (${error.exitCode}) ${error.message}
|
|
145
153
|
`, context.signal);
|
|
146
154
|
}
|
|
147
155
|
async function collectNetworkBytes(source, options) {
|
|
148
|
-
if (Number.isFinite(options.maxBytes)) return
|
|
156
|
+
if (Number.isFinite(options.maxBytes)) return collectBytes(source, options);
|
|
149
157
|
const chunks = [];
|
|
150
158
|
let size = 0;
|
|
151
|
-
for await (const chunk of
|
|
159
|
+
for await (const chunk of readBytes(source, options.signal)) {
|
|
152
160
|
chunks.push(new Uint8Array(chunk));
|
|
153
161
|
size += chunk.length;
|
|
154
162
|
}
|
|
@@ -559,7 +567,7 @@ init_platform();
|
|
|
559
567
|
function createDeadlineOutput(context, destination, remaining) {
|
|
560
568
|
const lifetime = new AbortController();
|
|
561
569
|
const signal = AbortSignal.any([context.signal, lifetime.signal]);
|
|
562
|
-
const operation =
|
|
570
|
+
const operation = createOutputOperation({ ...context, signal }, destination);
|
|
563
571
|
if (operation.signal.aborted) return operation;
|
|
564
572
|
const cancel = scheduleNetworkDeadline(remaining, () => lifetime.abort(new CurlError(28, "Operation timed out")));
|
|
565
573
|
operation.registerCleanup(cancel);
|
|
@@ -777,7 +785,7 @@ async function parseCurlInput(context, limits) {
|
|
|
777
785
|
const read = async (file) => {
|
|
778
786
|
try {
|
|
779
787
|
const maxBytes = limits.maxBufferBytes - inputBytes;
|
|
780
|
-
const bytes = file === "-" ? await collectNetworkBytes(context.stdin, { signal: context.signal, maxBytes }) : await withSignal(() => context.fs.readFile(
|
|
788
|
+
const bytes = file === "-" ? await collectNetworkBytes(context.stdin, { signal: context.signal, maxBytes }) : await withSignal(() => context.fs.readFile(pathOf(context, file), { signal: context.signal, ...Number.isFinite(maxBytes) ? { maxBytes } : {} }), context.signal);
|
|
781
789
|
context.signal.throwIfAborted();
|
|
782
790
|
inputBytes += bytes.length;
|
|
783
791
|
if (inputBytes > limits.maxBufferBytes) throw new CurlError(2, "Curl input exceeds host buffer limit");
|
|
@@ -1222,7 +1230,7 @@ async function* transfer(source, encoder, signal) {
|
|
|
1222
1230
|
yield encode(output);
|
|
1223
1231
|
output = "";
|
|
1224
1232
|
}
|
|
1225
|
-
await
|
|
1233
|
+
await yieldTurn(signal);
|
|
1226
1234
|
}
|
|
1227
1235
|
}
|
|
1228
1236
|
signal.throwIfAborted();
|
|
@@ -1295,15 +1303,15 @@ function createBody(context, args, limits) {
|
|
|
1295
1303
|
if (part.file === "-") {
|
|
1296
1304
|
if (!stdinUsed) {
|
|
1297
1305
|
stdinUsed = true;
|
|
1298
|
-
yield*
|
|
1306
|
+
yield* readBytes(context.stdin, signal);
|
|
1299
1307
|
}
|
|
1300
1308
|
return;
|
|
1301
1309
|
}
|
|
1302
1310
|
try {
|
|
1303
|
-
const path =
|
|
1311
|
+
const path = pathOf(context, part.file);
|
|
1304
1312
|
const capabilities = await context.fs.capabilitiesFor?.(path, { signal }) ?? context.fs.capabilities;
|
|
1305
1313
|
signal.throwIfAborted();
|
|
1306
|
-
if (context.fs.readStream && capabilities.streamingRead !== false) yield*
|
|
1314
|
+
if (context.fs.readStream && capabilities.streamingRead !== false) yield* readBytes(context.fs.readStream(path, { signal }), signal);
|
|
1307
1315
|
else yield await context.fs.readFile(path, { signal, ...Number.isFinite(Math.min(limits.maxBufferBytes, limits.maxUploadBytes)) ? { maxBytes: Math.min(limits.maxBufferBytes, limits.maxUploadBytes) } : {} });
|
|
1308
1316
|
} catch (error) {
|
|
1309
1317
|
signal.throwIfAborted();
|
|
@@ -1330,7 +1338,7 @@ function createBody(context, args, limits) {
|
|
|
1330
1338
|
if (part.separator && count === 0) continue;
|
|
1331
1339
|
let prefix = part.prefix;
|
|
1332
1340
|
for await (const raw of transfer(source(part, signal), part.encoder, signal)) {
|
|
1333
|
-
if (++chunks % 256 === 0) await
|
|
1341
|
+
if (++chunks % 256 === 0) await yieldTurn(signal);
|
|
1334
1342
|
for (let offset = 0; offset < raw.length; offset += 16 * 1024) {
|
|
1335
1343
|
signal.throwIfAborted();
|
|
1336
1344
|
let chunk = raw.subarray(offset, offset + 16 * 1024);
|
|
@@ -1385,7 +1393,7 @@ async function* decodeContent(source, encoding, signal, maxBytes) {
|
|
|
1385
1393
|
yield* source;
|
|
1386
1394
|
return;
|
|
1387
1395
|
}
|
|
1388
|
-
const iterator =
|
|
1396
|
+
const iterator = readBytes(source, signal)[Symbol.asyncIterator]();
|
|
1389
1397
|
let inputError;
|
|
1390
1398
|
let inputFailed = false;
|
|
1391
1399
|
let stream = new ReadableStream({
|
|
@@ -1442,10 +1450,8 @@ async function* decodeContent(source, encoding, signal, maxBytes) {
|
|
|
1442
1450
|
init_platform();
|
|
1443
1451
|
|
|
1444
1452
|
// packages/safe-bash/src/contracts/filesystem-output.ts
|
|
1445
|
-
var filesystem_output_exports = {};
|
|
1446
1453
|
init_platform();
|
|
1447
|
-
|
|
1448
|
-
import * as filesystem_output_star from "../../safe-bash-contracts/filesystem-output.js";
|
|
1454
|
+
import { assertCountedFileOutput, bindFileOutputBudget, openFileOutput, writeFileOutput, writeFileOutputCounted } from "../../safe-bash-contracts/filesystem-output.js";
|
|
1449
1455
|
|
|
1450
1456
|
// packages/safe-bash/src/commands/network/output.ts
|
|
1451
1457
|
function responseHeaders(response, maxBytes) {
|
|
@@ -1468,26 +1474,26 @@ function responseHeaders(response, maxBytes) {
|
|
|
1468
1474
|
async function writeOutput(context, path, source, signal, append = false, preserveEmpty = false) {
|
|
1469
1475
|
if (path === void 0 || path === "-") {
|
|
1470
1476
|
try {
|
|
1471
|
-
for await (const chunk of
|
|
1477
|
+
for await (const chunk of readBytes(source, signal)) {
|
|
1472
1478
|
try {
|
|
1473
|
-
await
|
|
1479
|
+
await writeBytes(context.stdout, chunk, signal);
|
|
1474
1480
|
} catch {
|
|
1475
1481
|
signal.throwIfAborted();
|
|
1476
1482
|
throw new CurlError(23, "Failed writing output");
|
|
1477
1483
|
}
|
|
1478
1484
|
}
|
|
1479
1485
|
} catch (error) {
|
|
1480
|
-
await context.stdout[
|
|
1486
|
+
await context.stdout[outputFailure]?.(error);
|
|
1481
1487
|
throw error;
|
|
1482
1488
|
}
|
|
1483
1489
|
return;
|
|
1484
1490
|
}
|
|
1485
1491
|
try {
|
|
1486
|
-
let target = preserveEmpty ? void 0 : await
|
|
1492
|
+
let target = preserveEmpty ? void 0 : await openFileOutput({ ...context, signal, outputBudget: "independent" }, pathOf(context, path), append ? "a" : "w");
|
|
1487
1493
|
try {
|
|
1488
|
-
for await (const chunk of
|
|
1494
|
+
for await (const chunk of readBytes(source, target?.signal ?? signal)) {
|
|
1489
1495
|
if (preserveEmpty && chunk.length === 0) continue;
|
|
1490
|
-
target ??= await
|
|
1496
|
+
target ??= await openFileOutput({ ...context, signal, outputBudget: "independent" }, pathOf(context, path), append ? "a" : "w");
|
|
1491
1497
|
await target.sink.write(chunk);
|
|
1492
1498
|
}
|
|
1493
1499
|
await target?.finish();
|
|
@@ -1498,14 +1504,14 @@ async function writeOutput(context, path, source, signal, append = false, preser
|
|
|
1498
1504
|
} catch (error) {
|
|
1499
1505
|
signal.throwIfAborted();
|
|
1500
1506
|
if (error instanceof CurlError) throw error;
|
|
1501
|
-
throw new CurlError(23, error instanceof
|
|
1507
|
+
throw new CurlError(23, error instanceof FsError ? `Failed writing virtual output file: ${error.message}` : "Failed writing virtual output file");
|
|
1502
1508
|
}
|
|
1503
1509
|
}
|
|
1504
1510
|
async function dumpHeaders(context, path, bytes, append, signal) {
|
|
1505
1511
|
try {
|
|
1506
|
-
if (path === "-") await
|
|
1512
|
+
if (path === "-") await writeBytes(context.stdout, bytes, signal);
|
|
1507
1513
|
else {
|
|
1508
|
-
const target = await
|
|
1514
|
+
const target = await openFileOutput({ ...context, signal, outputBudget: "independent" }, pathOf(context, path), append ? "a" : "w");
|
|
1509
1515
|
try {
|
|
1510
1516
|
await target.sink.write(bytes);
|
|
1511
1517
|
await target.finish();
|
|
@@ -1649,10 +1655,10 @@ function remoteFilename(url) {
|
|
|
1649
1655
|
}
|
|
1650
1656
|
async function existingSize(context, output, signal) {
|
|
1651
1657
|
try {
|
|
1652
|
-
return (await context.fs.stat(
|
|
1658
|
+
return (await context.fs.stat(pathOf(context, output), { signal })).size;
|
|
1653
1659
|
} catch (error) {
|
|
1654
1660
|
signal.throwIfAborted();
|
|
1655
|
-
if (error instanceof
|
|
1661
|
+
if (error instanceof FsError && error.code === "ENOENT") return void 0;
|
|
1656
1662
|
throw new CurlError(23, "Failed inspecting virtual output file");
|
|
1657
1663
|
}
|
|
1658
1664
|
}
|
|
@@ -1683,7 +1689,7 @@ function createTransferCommand(options, profile) {
|
|
|
1683
1689
|
let started = executions.get(scope) ?? performance.now();
|
|
1684
1690
|
const parsing = new AbortController();
|
|
1685
1691
|
const parsingSignal = AbortSignal.any([context.signal, parsing.signal]);
|
|
1686
|
-
|
|
1692
|
+
inheritYieldCheckpoint(context.signal, parsingSignal);
|
|
1687
1693
|
const cancelParsingDeadline = scheduleNetworkDeadline(
|
|
1688
1694
|
limits.maxTotalTimeMs - (performance.now() - started),
|
|
1689
1695
|
() => parsing.abort(new CurlError(28, "Operation timed out"))
|
|
@@ -1696,7 +1702,7 @@ function createTransferCommand(options, profile) {
|
|
|
1696
1702
|
parsingSignal.throwIfAborted();
|
|
1697
1703
|
if (performance.now() - started >= limits.maxTotalTimeMs) throw new CurlError(28, "Operation timed out");
|
|
1698
1704
|
if (args.help || args.version) {
|
|
1699
|
-
await
|
|
1705
|
+
await writeBytes(context.stdout, encode(args.version ? profile.version : profile.help), context.signal);
|
|
1700
1706
|
return { exitCode: 0 };
|
|
1701
1707
|
}
|
|
1702
1708
|
if (args.connectTimeoutMs !== void 0 && transport.supportsConnectTimeout !== true) {
|
|
@@ -1763,7 +1769,7 @@ function createTransferCommand(options, profile) {
|
|
|
1763
1769
|
return { exitCode };
|
|
1764
1770
|
}
|
|
1765
1771
|
};
|
|
1766
|
-
|
|
1772
|
+
builtInDirectContextExecutors.add(def.execute);
|
|
1767
1773
|
return def;
|
|
1768
1774
|
}
|
|
1769
1775
|
async function transfer2(context, args, input, limits, transport, authorize, started, status, headerState) {
|
|
@@ -1789,7 +1795,7 @@ async function transfer2(context, args, input, limits, transport, authorize, sta
|
|
|
1789
1795
|
const publish = async (bytes) => {
|
|
1790
1796
|
const writing = createDeadlineOutput(context, context.stdout, remaining());
|
|
1791
1797
|
try {
|
|
1792
|
-
await
|
|
1798
|
+
await writeBytes(writing.output, bytes, writing.signal);
|
|
1793
1799
|
} catch (error) {
|
|
1794
1800
|
context.signal.throwIfAborted();
|
|
1795
1801
|
if (!pipeClosed(error)) throw error;
|
|
@@ -1802,10 +1808,10 @@ async function transfer2(context, args, input, limits, transport, authorize, sta
|
|
|
1802
1808
|
if (args.etagCompare !== void 0) {
|
|
1803
1809
|
let bytes;
|
|
1804
1810
|
try {
|
|
1805
|
-
bytes = await withSignal(() => context.fs.readFile(
|
|
1811
|
+
bytes = await withSignal(() => context.fs.readFile(pathOf(context, args.etagCompare), { signal, ...Number.isFinite(limits.maxBufferBytes) ? { maxBytes: limits.maxBufferBytes } : {} }), signal);
|
|
1806
1812
|
} catch (error) {
|
|
1807
1813
|
signal.throwIfAborted();
|
|
1808
|
-
if (!(error instanceof
|
|
1814
|
+
if (!(error instanceof FsError && error.code === "ENOENT")) throw new CurlError(26, "Failed reading virtual ETag file");
|
|
1809
1815
|
bytes = new Uint8Array();
|
|
1810
1816
|
}
|
|
1811
1817
|
if (bytes.length > limits.maxBufferBytes) throw new CurlError(63, "ETag file exceeds host buffer limit");
|
|
@@ -1816,7 +1822,7 @@ async function transfer2(context, args, input, limits, transport, authorize, sta
|
|
|
1816
1822
|
let ca;
|
|
1817
1823
|
if (args.caFile !== void 0) {
|
|
1818
1824
|
try {
|
|
1819
|
-
const bytes = await withSignal(() => context.fs.readFile(
|
|
1825
|
+
const bytes = await withSignal(() => context.fs.readFile(pathOf(context, args.caFile), { signal, ...Number.isFinite(limits.maxBufferBytes) ? { maxBytes: limits.maxBufferBytes } : {} }), signal);
|
|
1820
1826
|
signal.throwIfAborted();
|
|
1821
1827
|
if (bytes.length > limits.maxBufferBytes) throw new CurlError(77, "CA certificate exceeds host buffer limit");
|
|
1822
1828
|
ca = new Uint8Array(bytes);
|
|
@@ -1827,7 +1833,7 @@ async function transfer2(context, args, input, limits, transport, authorize, sta
|
|
|
1827
1833
|
}
|
|
1828
1834
|
if (format?.startsWith("@")) {
|
|
1829
1835
|
try {
|
|
1830
|
-
const bytes = format === "@-" ? await collectNetworkBytes(borrowed, { signal, maxBytes: limits.maxBufferBytes }) : await withSignal(() => context.fs.readFile(
|
|
1836
|
+
const bytes = format === "@-" ? await collectNetworkBytes(borrowed, { signal, maxBytes: limits.maxBufferBytes }) : await withSignal(() => context.fs.readFile(pathOf(context, format.slice(1)), { signal, ...Number.isFinite(limits.maxBufferBytes) ? { maxBytes: limits.maxBufferBytes } : {} }), signal);
|
|
1831
1837
|
format = import_buffer.Buffer.from(bytes).toString("utf8");
|
|
1832
1838
|
} catch {
|
|
1833
1839
|
signal.throwIfAborted();
|
|
@@ -1880,7 +1886,7 @@ async function transfer2(context, args, input, limits, transport, authorize, sta
|
|
|
1880
1886
|
if (args.download.noClobber && !args.download.contentDisposition && await existingSize(context, output, signal) !== void 0) return 0;
|
|
1881
1887
|
if (args.download.resume) resumeOffset = await existingSize(context, output, signal) ?? 0;
|
|
1882
1888
|
}
|
|
1883
|
-
if (output && output !== "-" && args.dumpHeader && args.dumpHeader !== "-" && normalizePath(
|
|
1889
|
+
if (output && output !== "-" && args.dumpHeader && args.dumpHeader !== "-" && normalizePath(pathOf(context, output)) === normalizePath(pathOf(context, args.dumpHeader))) {
|
|
1884
1890
|
throw new CurlError(23, "Body and header output files must differ");
|
|
1885
1891
|
}
|
|
1886
1892
|
const initialRequestMethod = args.head || args.download?.spider ? "HEAD" : args.get ? "GET" : args.upload !== void 0 ? "PUT" : body ? "POST" : "GET";
|
|
@@ -1931,7 +1937,7 @@ async function transfer2(context, args, input, limits, transport, authorize, sta
|
|
|
1931
1937
|
throw new CurlError(7, "Transport cannot enforce private network policy");
|
|
1932
1938
|
}
|
|
1933
1939
|
const headers = requestHeaders(resumeOffset ? { ...args, range: `${resumeOffset}-` } : args, currentBody?.contentType, args.user ?? parsed.user, credentialsInScope, limits.maxHeaderBytes, previous);
|
|
1934
|
-
if (args.verbose) await
|
|
1940
|
+
if (args.verbose) await writeBytes(context.stderr, encode(`> ${method} ${current.origin}
|
|
1935
1941
|
${headers.map(([name]) => `> ${name}: [redacted]
|
|
1936
1942
|
`).join("")}`), signal);
|
|
1937
1943
|
const upload = currentBody && (async function* () {
|
|
@@ -1977,7 +1983,7 @@ ${headers.map(([name]) => `> ${name}: [redacted]
|
|
|
1977
1983
|
values2.http_code = values2.response_code = String(response.status).padStart(3, "0");
|
|
1978
1984
|
values2.content_type = header(response.headers, "content-type") ?? "";
|
|
1979
1985
|
values2.http_version = response.httpVersion ?? "1.1";
|
|
1980
|
-
if (args.verbose) await
|
|
1986
|
+
if (args.verbose) await writeBytes(context.stderr, encode(`< HTTP ${response.status}
|
|
1981
1987
|
`), signal);
|
|
1982
1988
|
if (args.dumpHeader !== void 0) {
|
|
1983
1989
|
if (args.dumpHeader === "-") await publish(block);
|
|
@@ -1992,7 +1998,7 @@ ${headers.map(([name]) => `> ${name}: [redacted]
|
|
|
1992
1998
|
const bytes = tag === void 0 ? new Uint8Array() : new Uint8Array(import_buffer.Buffer.from(`${tag}
|
|
1993
1999
|
`, "latin1"));
|
|
1994
2000
|
if (args.etagSave === "-") await publish(bytes);
|
|
1995
|
-
else await writeOutput(context, args.etagSave,
|
|
2001
|
+
else await writeOutput(context, args.etagSave, toByteSource(bytes), signal);
|
|
1996
2002
|
}
|
|
1997
2003
|
if (args.head || args.include) included.push(block);
|
|
1998
2004
|
const location = header(response.headers, "location");
|
|
@@ -2058,12 +2064,12 @@ ${headers.map(([name]) => `> ${name}: [redacted]
|
|
|
2058
2064
|
const readBody = !(args.download && method === "HEAD") && !args.head && !suppressBody;
|
|
2059
2065
|
let published = 0;
|
|
2060
2066
|
if (!args.download?.spider && (!suppressBody || included.length)) {
|
|
2061
|
-
if (args.download && output && output !== "-") await context.fs.mkdir(posixPath.dirname(
|
|
2067
|
+
if (args.download && output && output !== "-") await context.fs.mkdir(posixPath.dirname(pathOf(context, output)), { recursive: true, signal });
|
|
2062
2068
|
const length = args.ignoreContentLength ? void 0 : header(response.headers, "content-length");
|
|
2063
2069
|
if (readBody && length && /^\d+$/.test(length) && Number(length) > args.maxFileSize) throw new CurlError(63, "Response exceeds download byte limit");
|
|
2064
2070
|
const final = response;
|
|
2065
2071
|
const encoding = header(final.headers, "content-encoding");
|
|
2066
|
-
const writing = output === void 0 || output === "-" ?
|
|
2072
|
+
const writing = output === void 0 || output === "-" ? createOutputOperation({ ...context, signal }, context.stdout) : void 0;
|
|
2067
2073
|
const bodySignal = writing?.signal ?? signal;
|
|
2068
2074
|
const source = (async function* () {
|
|
2069
2075
|
for (const bytes of included) {
|
|
@@ -2075,7 +2081,7 @@ ${headers.map(([name]) => `> ${name}: [redacted]
|
|
|
2075
2081
|
if (args.raw && header(final.headers, "transfer-encoding")) throw new CurlError(61, "Raw transfer encoding is unsupported by this transport");
|
|
2076
2082
|
let chunks = 0;
|
|
2077
2083
|
const encoded = (async function* () {
|
|
2078
|
-
for await (const chunk of
|
|
2084
|
+
for await (const chunk of readBytes(final.body, bodySignal)) {
|
|
2079
2085
|
downloaded += chunk.length;
|
|
2080
2086
|
if (downloaded > args.maxFileSize) throw new CurlError(63, "Response exceeds download byte limit");
|
|
2081
2087
|
yield chunk;
|
|
@@ -2087,7 +2093,7 @@ ${headers.map(([name]) => `> ${name}: [redacted]
|
|
|
2087
2093
|
try {
|
|
2088
2094
|
for await (const chunk of decoded) {
|
|
2089
2095
|
if (++chunks % 256 === 0) {
|
|
2090
|
-
await
|
|
2096
|
+
await yieldTurn(context.signal);
|
|
2091
2097
|
bodySignal.throwIfAborted();
|
|
2092
2098
|
}
|
|
2093
2099
|
outputBytes += chunk.length;
|
|
@@ -2122,7 +2128,7 @@ ${headers.map(([name]) => `> ${name}: [redacted]
|
|
|
2122
2128
|
}
|
|
2123
2129
|
await stop(response, signal);
|
|
2124
2130
|
response = void 0;
|
|
2125
|
-
if (published && output !== void 0 && output !== "-" && !args.download?.resume) await writeOutput(context, output,
|
|
2131
|
+
if (published && output !== void 0 && output !== "-" && !args.download?.resume) await writeOutput(context, output, toByteSource(""), signal);
|
|
2126
2132
|
await delay(Math.min(wait, limits.maxTimeMs), signal);
|
|
2127
2133
|
continue;
|
|
2128
2134
|
}
|
|
@@ -2167,7 +2173,7 @@ ${headers.map(([name]) => `> ${name}: [redacted]
|
|
|
2167
2173
|
|
|
2168
2174
|
// packages/safe-bash/src/commands/network/wget.ts
|
|
2169
2175
|
async function parseWget(context, limits) {
|
|
2170
|
-
const carrier =
|
|
2176
|
+
const carrier = getCommandArguments(context);
|
|
2171
2177
|
let argumentBytes = 0;
|
|
2172
2178
|
for (const value of carrier.values) {
|
|
2173
2179
|
if (typeof value === "string" && value.length > limits.maxBufferBytes) throw new CurlError(2, "Arguments exceed host buffer limit");
|
|
@@ -2175,7 +2181,7 @@ async function parseWget(context, limits) {
|
|
|
2175
2181
|
if (argumentBytes > limits.maxBufferBytes) throw new CurlError(2, "Arguments exceed host buffer limit");
|
|
2176
2182
|
if (typeof value === "string") {
|
|
2177
2183
|
for (let index = 0; index < value.length; index++) {
|
|
2178
|
-
if (index % 1024 === 0) await
|
|
2184
|
+
if (index % 1024 === 0) await yieldTurn(context.signal);
|
|
2179
2185
|
const code = value.charCodeAt(index);
|
|
2180
2186
|
if (code >= 55296 && code <= 56319) {
|
|
2181
2187
|
const next = value.charCodeAt(++index);
|
|
@@ -2184,10 +2190,10 @@ async function parseWget(context, limits) {
|
|
|
2184
2190
|
}
|
|
2185
2191
|
continue;
|
|
2186
2192
|
}
|
|
2187
|
-
const bytes =
|
|
2193
|
+
const bytes = shellValueBytes(value);
|
|
2188
2194
|
const decoder = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
|
|
2189
2195
|
for (let offset = 0; offset < bytes.length; offset += 1024) {
|
|
2190
|
-
await
|
|
2196
|
+
await yieldTurn(context.signal);
|
|
2191
2197
|
try {
|
|
2192
2198
|
decoder.decode(bytes.subarray(offset, offset + 1024), { stream: offset + 1024 < bytes.length });
|
|
2193
2199
|
} catch (error) {
|
|
@@ -2262,7 +2268,7 @@ async function parseWget(context, limits) {
|
|
|
2262
2268
|
let ended = false;
|
|
2263
2269
|
let inputFile;
|
|
2264
2270
|
for (let index = 0; index < context.args.length; index++) {
|
|
2265
|
-
if (index % 128 === 0) await
|
|
2271
|
+
if (index % 128 === 0) await yieldTurn(context.signal);
|
|
2266
2272
|
const argument = context.args[index];
|
|
2267
2273
|
if (ended || !argument.startsWith("-") || argument === "-") {
|
|
2268
2274
|
result.urls.push(argument);
|
|
@@ -2274,7 +2280,7 @@ async function parseWget(context, limits) {
|
|
|
2274
2280
|
}
|
|
2275
2281
|
if (!argument.startsWith("--")) {
|
|
2276
2282
|
for (let position = 1; position < argument.length; position++) {
|
|
2277
|
-
if (position % 1024 === 0) await
|
|
2283
|
+
if (position % 1024 === 0) await yieldTurn(context.signal);
|
|
2278
2284
|
const flag2 = argument[position];
|
|
2279
2285
|
if (flag2 === "q") result.silent = true;
|
|
2280
2286
|
else if (flag2 === "c") result.download.resume = true;
|
|
@@ -2400,7 +2406,7 @@ async function parseWget(context, limits) {
|
|
|
2400
2406
|
if (inputFile !== void 0) {
|
|
2401
2407
|
let bytes;
|
|
2402
2408
|
try {
|
|
2403
|
-
bytes = inputFile === "-" ? await collectNetworkBytes(context.stdin, { signal: context.signal, maxBytes: limits.maxBufferBytes }) : await context.fs.readFile(
|
|
2409
|
+
bytes = inputFile === "-" ? await collectNetworkBytes(context.stdin, { signal: context.signal, maxBytes: limits.maxBufferBytes }) : await context.fs.readFile(pathOf(context, inputFile), { signal: context.signal, ...Number.isFinite(limits.maxBufferBytes) ? { maxBytes: limits.maxBufferBytes } : {} });
|
|
2404
2410
|
} catch {
|
|
2405
2411
|
context.signal.throwIfAborted();
|
|
2406
2412
|
throw new CurlError(26, "Failed reading virtual URL input file");
|
|
@@ -2414,7 +2420,7 @@ async function parseWget(context, limits) {
|
|
|
2414
2420
|
let start = 0;
|
|
2415
2421
|
let lines = 0;
|
|
2416
2422
|
for (let index = 0; index <= text.length; index++) {
|
|
2417
|
-
if (index % 1024 === 0) await
|
|
2423
|
+
if (index % 1024 === 0) await yieldTurn(context.signal);
|
|
2418
2424
|
if (index !== text.length && text[index] !== "\n") continue;
|
|
2419
2425
|
if (index === text.length && start === index) break;
|
|
2420
2426
|
if (++lines > 4096) throw new CurlError(2, "URL input exceeds 4096-line limit");
|
|
@@ -2625,11 +2631,13 @@ function evalSyncWget(opArgs) {
|
|
|
2625
2631
|
}
|
|
2626
2632
|
return void 0;
|
|
2627
2633
|
}
|
|
2628
|
-
|
|
2629
|
-
|
|
2634
|
+
syncCommandEvaluators.evalSyncCurl = evalSyncCurl;
|
|
2635
|
+
syncCommandEvaluators.evalSyncWget = evalSyncWget;
|
|
2630
2636
|
|
|
2631
2637
|
export {
|
|
2632
|
-
|
|
2638
|
+
bindFileOutputBudget,
|
|
2639
|
+
openFileOutput,
|
|
2640
|
+
writeFileOutput,
|
|
2633
2641
|
defaultNetworkLimits,
|
|
2634
2642
|
cloudflareWorkerNetworkLimits,
|
|
2635
2643
|
CurlError,
|