@poe-platform/safe-bash 0.1.629 → 0.1.631
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 +2 -2
- package/dist/office-package/compression.d.ts +19 -0
- package/dist/office-package/compression.js +186 -0
- package/dist/office-package/runtime.d.ts +11 -0
- package/dist/office-package/runtime.js +28 -0
- package/dist/safe-bash/chunks/{bz2-B2RXT4EX.js → bz2-ACU4EOVE.js} +2 -2
- package/dist/safe-bash/chunks/chunk-2E4KBFO6.js +239 -0
- package/dist/safe-bash/chunks/chunk-2E4KBFO6.js.map +7 -0
- package/dist/safe-bash/chunks/chunk-3E5M2WEL.js +33 -0
- package/dist/safe-bash/chunks/chunk-3E5M2WEL.js.map +7 -0
- package/dist/safe-bash/chunks/{chunk-WPEMUXV4.js → chunk-3LD67SER.js} +12 -10
- package/dist/safe-bash/chunks/{chunk-WPEMUXV4.js.map → chunk-3LD67SER.js.map} +1 -1
- package/dist/safe-bash/chunks/{chunk-6LSSEOG7.js → chunk-6HNK7Q66.js} +11 -7
- package/dist/safe-bash/chunks/{chunk-6LSSEOG7.js.map → chunk-6HNK7Q66.js.map} +1 -1
- package/dist/safe-bash/chunks/{chunk-AD7UAP5B.js → chunk-7EEWZY5S.js} +10 -8
- package/dist/safe-bash/chunks/{chunk-AD7UAP5B.js.map → chunk-7EEWZY5S.js.map} +1 -1
- package/dist/safe-bash/chunks/{chunk-RNKTWFEM.js → chunk-CDBQXRWL.js} +3 -3
- package/dist/safe-bash/chunks/{chunk-UYX72YHY.js → chunk-CHHAB5SS.js} +10 -74
- package/dist/safe-bash/chunks/{chunk-UYX72YHY.js.map → chunk-CHHAB5SS.js.map} +3 -3
- package/dist/safe-bash/chunks/{chunk-KYNRHYHP.js → chunk-EI4X5ETX.js} +15 -13
- package/dist/safe-bash/chunks/{chunk-KYNRHYHP.js.map → chunk-EI4X5ETX.js.map} +1 -1
- package/dist/safe-bash/chunks/{chunk-KZ7QCYNT.js → chunk-GIBLUW2U.js} +13 -9
- package/dist/safe-bash/chunks/{chunk-KZ7QCYNT.js.map → chunk-GIBLUW2U.js.map} +1 -1
- package/dist/safe-bash/chunks/chunk-GPV7ZFYS.js +1528 -0
- package/dist/safe-bash/chunks/chunk-GPV7ZFYS.js.map +7 -0
- package/dist/safe-bash/chunks/{chunk-N5CYTGBN.js → chunk-H3E67KTZ.js} +13 -9
- package/dist/safe-bash/chunks/{chunk-N5CYTGBN.js.map → chunk-H3E67KTZ.js.map} +1 -1
- package/dist/safe-bash/chunks/{chunk-AFH57PPL.js → chunk-IEKESMO4.js} +3 -3
- package/dist/safe-bash/chunks/{chunk-DPJWEGIX.js → chunk-JLBIUYT3.js} +2 -2
- package/dist/safe-bash/chunks/chunk-JZDO5MC3.js +77 -0
- package/dist/safe-bash/chunks/chunk-JZDO5MC3.js.map +7 -0
- package/dist/safe-bash/chunks/{chunk-GFZKQIPL.js → chunk-LA6BX562.js} +8 -6
- package/dist/safe-bash/chunks/{chunk-GFZKQIPL.js.map → chunk-LA6BX562.js.map} +1 -1
- package/dist/safe-bash/chunks/{chunk-PVJJFCGA.js → chunk-M3GPCYSP.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-FWDMJTQO.js → chunk-NDCZ3UBP.js} +13 -9
- package/dist/safe-bash/chunks/{chunk-FWDMJTQO.js.map → chunk-NDCZ3UBP.js.map} +1 -1
- package/dist/safe-bash/chunks/{chunk-2KL6W6NB.js → chunk-O2EVBRKF.js} +1 -2
- package/dist/safe-bash/chunks/chunk-OFT77XIB.js +389 -0
- package/dist/safe-bash/chunks/chunk-OFT77XIB.js.map +7 -0
- package/dist/safe-bash/chunks/{chunk-PCLOK32J.js → chunk-PC6BEIAF.js} +13 -9
- package/dist/safe-bash/chunks/{chunk-PCLOK32J.js.map → chunk-PC6BEIAF.js.map} +1 -1
- package/dist/safe-bash/chunks/{chunk-3M5F7LD5.js → chunk-QWKP7ZU7.js} +13 -9
- package/dist/safe-bash/chunks/{chunk-3M5F7LD5.js.map → chunk-QWKP7ZU7.js.map} +1 -1
- package/dist/safe-bash/chunks/chunk-THXJ6CLF.js +53 -0
- package/dist/safe-bash/chunks/chunk-THXJ6CLF.js.map +7 -0
- package/dist/safe-bash/chunks/{chunk-HHJSJWUD.js → chunk-V73A742N.js} +57 -15
- package/dist/safe-bash/chunks/chunk-V73A742N.js.map +7 -0
- package/dist/safe-bash/chunks/{chunk-4BYUV5PA.js → chunk-VN3ZGME3.js} +12 -8
- package/dist/safe-bash/chunks/{chunk-4BYUV5PA.js.map → chunk-VN3ZGME3.js.map} +1 -1
- package/dist/safe-bash/chunks/chunk-WECHUK3Y.js +4285 -0
- package/dist/safe-bash/chunks/chunk-WECHUK3Y.js.map +7 -0
- package/dist/safe-bash/chunks/{chunk-X55AMTNM.js → chunk-WIOEUR7D.js} +14 -10
- package/dist/safe-bash/chunks/{chunk-X55AMTNM.js.map → chunk-WIOEUR7D.js.map} +1 -1
- package/dist/safe-bash/chunks/chunk-WPIOO4NX.js +443 -0
- package/dist/safe-bash/chunks/chunk-WPIOO4NX.js.map +7 -0
- package/dist/safe-bash/chunks/{chunk-C7QNJ3D4.js → chunk-WYTI64IU.js} +2 -2
- package/dist/safe-bash/chunks/{xz-AVXFDXW4.js → xz-U4QDTPZL.js} +2 -2
- package/dist/safe-bash/chunks/{zstd-R6RPHJYO.js → zstd-OG5RPYXO.js} +2 -2
- package/dist/safe-bash/commands/archive/zip/crc.d.ts +2 -0
- package/dist/safe-bash/commands/archive/zip/crc.d.ts.map +1 -0
- package/dist/safe-bash/commands/archive/zip/crc.js +7 -0
- package/dist/safe-bash/commands/archive/zip/crc.js.map +1 -0
- package/dist/safe-bash/commands/archive/zip/crypto.d.ts +4 -0
- package/dist/safe-bash/commands/archive/zip/crypto.d.ts.map +1 -0
- package/dist/safe-bash/commands/archive/zip/crypto.js +34 -0
- package/dist/safe-bash/commands/archive/zip/crypto.js.map +1 -0
- package/dist/safe-bash/commands/archive/zip/help.d.ts +3 -0
- package/dist/safe-bash/commands/archive/zip/help.d.ts.map +1 -0
- package/dist/safe-bash/commands/archive/zip/help.js +87 -0
- package/dist/safe-bash/commands/archive/zip/help.js.map +1 -0
- package/dist/safe-bash/commands/archive/zip/move.d.ts +12 -0
- package/dist/safe-bash/commands/archive/zip/move.d.ts.map +1 -0
- package/dist/safe-bash/commands/archive/zip/move.js +60 -0
- package/dist/safe-bash/commands/archive/zip/move.js.map +1 -0
- package/dist/safe-bash/commands/archive/zip/options.js +5 -5
- package/dist/safe-bash/commands/archive/zip/options.js.map +1 -1
- package/dist/safe-bash/commands/archive/zip-format.d.ts +1 -1
- package/dist/safe-bash/commands/archive/zip-format.d.ts.map +1 -1
- package/dist/safe-bash/commands/archive/zip-format.js +14 -17
- package/dist/safe-bash/commands/archive/zip-format.js.map +1 -1
- package/dist/safe-bash/commands/archive/zip.d.ts.map +1 -1
- package/dist/safe-bash/commands/archive/zip.js +45 -15
- package/dist/safe-bash/commands/archive/zip.js.map +1 -1
- package/dist/safe-bash/commands/bytes/compression/bounded-codec.d.ts +2 -0
- package/dist/safe-bash/commands/bytes/compression/bounded-codec.d.ts.map +1 -1
- package/dist/safe-bash/commands/bytes/compression/bounded-codec.js +4 -0
- package/dist/safe-bash/commands/bytes/compression/bounded-codec.js.map +1 -1
- package/dist/safe-bash/commands/bytes/compression/codec.d.ts +4 -24
- package/dist/safe-bash/commands/bytes/compression/codec.d.ts.map +1 -1
- package/dist/safe-bash/commands/bytes/compression/codec.js +12 -168
- package/dist/safe-bash/commands/bytes/compression/codec.js.map +1 -1
- package/dist/safe-bash/commands/cmp.js +1 -1
- package/dist/safe-bash/commands/cmp.js.map +1 -1
- package/dist/safe-bash/commands/csplit/index.browser.js +10 -7
- package/dist/safe-bash/commands/docx/index.browser.js +54 -0
- package/dist/safe-bash/commands/docx/index.browser.js.map +7 -0
- package/dist/safe-bash/commands/docx/index.d.ts +25 -0
- package/dist/safe-bash/commands/docx/index.d.ts.map +1 -0
- package/dist/safe-bash/commands/docx/index.js +42 -0
- package/dist/safe-bash/commands/docx/index.js.map +1 -0
- package/dist/safe-bash/commands/docx/io.d.ts +15 -0
- package/dist/safe-bash/commands/docx/io.d.ts.map +1 -0
- package/dist/safe-bash/commands/docx/io.js +16 -0
- package/dist/safe-bash/commands/docx/io.js.map +1 -0
- package/dist/safe-bash/commands/factor/index.browser.js +7 -5
- package/dist/safe-bash/commands/filesystem.d.ts.map +1 -1
- package/dist/safe-bash/commands/filesystem.js +9 -1
- package/dist/safe-bash/commands/filesystem.js.map +1 -1
- package/dist/safe-bash/commands/getopt/index.browser.js +7 -5
- package/dist/safe-bash/commands/hexdump/index.browser.js +8 -6
- package/dist/safe-bash/commands/iconv/index.browser.js +8 -6
- package/dist/safe-bash/commands/line-endings/index.browser.js +10 -7
- package/dist/safe-bash/commands/llm/index.browser.js +10 -8
- package/dist/safe-bash/commands/llm/providers/index.browser.js +3 -3
- package/dist/safe-bash/commands/network/index.browser.js +11 -8
- package/dist/safe-bash/commands/node/browser.d.ts +2 -0
- package/dist/safe-bash/commands/node/browser.d.ts.map +1 -0
- package/dist/safe-bash/commands/node/browser.js +2 -0
- package/dist/safe-bash/commands/node/browser.js.map +1 -0
- package/dist/safe-bash/commands/node/index.browser.js +18 -0
- package/dist/safe-bash/commands/node/index.browser.js.map +7 -0
- package/dist/safe-bash/commands/node/safejs.d.ts +6 -0
- package/dist/safe-bash/commands/node/safejs.d.ts.map +1 -1
- package/dist/safe-bash/commands/node/safejs.js +25 -1
- package/dist/safe-bash/commands/node/safejs.js.map +1 -1
- package/dist/safe-bash/commands/op/index.browser.js +3 -3
- package/dist/safe-bash/commands/op/index.js +0 -1
- package/dist/safe-bash/commands/op/index.js.map +2 -2
- package/dist/safe-bash/commands/pptx/index.d.ts +29 -0
- package/dist/safe-bash/commands/pptx/index.d.ts.map +1 -0
- package/dist/safe-bash/commands/pptx/index.js +153 -0
- package/dist/safe-bash/commands/pptx/index.js.map +1 -0
- package/dist/safe-bash/commands/pr/index.browser.js +8 -6
- package/dist/safe-bash/commands/predicates.js +1 -1
- package/dist/safe-bash/commands/python/execution.d.ts +3 -0
- package/dist/safe-bash/commands/python/execution.d.ts.map +1 -0
- package/dist/safe-bash/commands/python/execution.js +193 -0
- package/dist/safe-bash/commands/python/execution.js.map +1 -0
- package/dist/safe-bash/commands/python/index.browser.js +21 -0
- package/dist/safe-bash/commands/python/index.browser.js.map +7 -0
- package/dist/safe-bash/commands/python/index.d.ts +49 -0
- package/dist/safe-bash/commands/python/index.d.ts.map +1 -0
- package/dist/safe-bash/commands/python/index.js +317 -0
- package/dist/safe-bash/commands/python/index.js.map +1 -0
- package/dist/safe-bash/commands/python/installation.d.ts +9 -0
- package/dist/safe-bash/commands/python/installation.d.ts.map +1 -0
- package/dist/safe-bash/commands/python/installation.js +80 -0
- package/dist/safe-bash/commands/python/installation.js.map +1 -0
- package/dist/safe-bash/commands/python/invocation.d.ts +10 -0
- package/dist/safe-bash/commands/python/invocation.d.ts.map +1 -0
- package/dist/safe-bash/commands/python/invocation.js +81 -0
- package/dist/safe-bash/commands/python/invocation.js.map +1 -0
- package/dist/safe-bash/commands/python/node.d.ts +12 -0
- package/dist/safe-bash/commands/python/node.d.ts.map +1 -0
- package/dist/safe-bash/commands/python/node.js +33 -0
- package/dist/safe-bash/commands/python/node.js.map +1 -0
- package/dist/safe-bash/commands/python/provisioning-runtime.d.ts +5 -0
- package/dist/safe-bash/commands/python/provisioning-runtime.d.ts.map +1 -0
- package/dist/safe-bash/commands/python/provisioning-runtime.js +179 -0
- package/dist/safe-bash/commands/python/provisioning-runtime.js.map +1 -0
- package/dist/safe-bash/commands/python/provisioning.d.ts +49 -0
- package/dist/safe-bash/commands/python/provisioning.d.ts.map +1 -0
- package/dist/safe-bash/commands/python/provisioning.js +320 -0
- package/dist/safe-bash/commands/python/provisioning.js.map +1 -0
- package/dist/safe-bash/commands/python/reply.d.ts +3 -0
- package/dist/safe-bash/commands/python/reply.d.ts.map +1 -0
- package/dist/safe-bash/commands/python/reply.js +103 -0
- package/dist/safe-bash/commands/python/reply.js.map +1 -0
- package/dist/safe-bash/commands/python/worker.browser.js +736 -0
- package/dist/safe-bash/commands/python/worker.browser.js.map +7 -0
- package/dist/safe-bash/commands/python/worker.d.ts +47 -0
- package/dist/safe-bash/commands/python/worker.d.ts.map +1 -0
- package/dist/safe-bash/commands/python/worker.js +373 -0
- package/dist/safe-bash/commands/python/worker.js.map +1 -0
- package/dist/safe-bash/commands/safejs/index.d.ts +5 -17
- package/dist/safe-bash/commands/safejs/index.d.ts.map +1 -1
- package/dist/safe-bash/commands/safejs/index.js +3 -202
- package/dist/safe-bash/commands/safejs/index.js.map +1 -1
- package/dist/safe-bash/commands/safejs/runtime.d.ts +15 -0
- package/dist/safe-bash/commands/safejs/runtime.d.ts.map +1 -0
- package/dist/safe-bash/commands/safejs/runtime.js +190 -0
- package/dist/safe-bash/commands/safejs/runtime.js.map +1 -0
- package/dist/safe-bash/commands/tsort/index.browser.js +8 -6
- package/dist/safe-bash/commands/xml/index.browser.js +9 -7
- package/dist/safe-bash/commands/yq/index.browser.js +10 -8
- package/dist/safe-bash/commands/yq/index.d.ts.map +1 -1
- package/dist/safe-bash/commands/yq/index.js +32 -4
- package/dist/safe-bash/commands/yq/index.js.map +1 -1
- package/dist/safe-bash/commands/yq/parser.d.ts.map +1 -1
- package/dist/safe-bash/commands/yq/parser.js +21 -5
- package/dist/safe-bash/commands/yq/parser.js.map +1 -1
- package/dist/safe-bash/contracts/command.d.ts +2 -0
- package/dist/safe-bash/contracts/command.d.ts.map +1 -1
- package/dist/safe-bash/contracts/command.js +6 -2
- package/dist/safe-bash/contracts/command.js.map +1 -1
- package/dist/safe-bash/contracts/filesystem-descriptor.d.ts +13 -0
- package/dist/safe-bash/contracts/filesystem-descriptor.d.ts.map +1 -0
- package/dist/safe-bash/contracts/filesystem-descriptor.js +189 -0
- package/dist/safe-bash/contracts/filesystem-descriptor.js.map +1 -0
- package/dist/safe-bash/contracts/filesystem-output-budget.d.ts +15 -0
- package/dist/safe-bash/contracts/filesystem-output-budget.d.ts.map +1 -0
- package/dist/safe-bash/contracts/filesystem-output-budget.js +69 -0
- package/dist/safe-bash/contracts/filesystem-output-budget.js.map +1 -0
- package/dist/safe-bash/contracts/filesystem-output.d.ts +11 -5
- package/dist/safe-bash/contracts/filesystem-output.d.ts.map +1 -1
- package/dist/safe-bash/contracts/filesystem-output.js +229 -20
- package/dist/safe-bash/contracts/filesystem-output.js.map +1 -1
- package/dist/safe-bash/contracts/io.d.ts +29 -0
- package/dist/safe-bash/contracts/io.d.ts.map +1 -1
- package/dist/safe-bash/contracts/io.js +317 -37
- package/dist/safe-bash/contracts/io.js.map +1 -1
- package/dist/safe-bash/core.browser.js +5963 -6522
- package/dist/safe-bash/core.browser.js.map +4 -4
- package/dist/safe-bash/core.d.ts +2 -0
- package/dist/safe-bash/core.d.ts.map +1 -1
- package/dist/safe-bash/core.js +2 -0
- package/dist/safe-bash/core.js.map +1 -1
- package/dist/safe-bash/index.d.ts +1 -0
- package/dist/safe-bash/index.d.ts.map +1 -1
- package/dist/safe-bash/index.js +1 -0
- package/dist/safe-bash/index.js.map +1 -1
- package/dist/safe-bash/opt-in/commands/cmp/compare.js +95 -0
- package/dist/safe-bash/opt-in/commands/cmp/index.d.ts +6 -0
- package/dist/safe-bash/opt-in/commands/cmp/index.js +99 -0
- package/dist/safe-bash/opt-in/commands/cmp/io.js +218 -0
- package/dist/safe-bash/opt-in/commands/cmp/options.d.ts +24 -0
- package/dist/safe-bash/opt-in/commands/cmp/options.js +195 -0
- package/dist/safe-bash/opt-in/commands/dd/conversions.js +152 -0
- package/dist/safe-bash/opt-in/commands/dd/index.d.ts +18 -0
- package/dist/safe-bash/opt-in/commands/dd/index.js +561 -0
- package/dist/safe-bash/opt-in/commands/dd/io.d.ts +31 -0
- package/dist/safe-bash/opt-in/commands/dd/io.js +244 -0
- package/dist/safe-bash/opt-in/commands/dd/options.js +184 -0
- package/dist/safe-bash/opt-in/commands/dd/report.js +69 -0
- package/dist/safe-bash/opt-in/commands/install/arguments.js +224 -0
- package/dist/safe-bash/opt-in/commands/install/index.d.ts +6 -0
- package/dist/safe-bash/opt-in/commands/install/index.js +678 -0
- package/dist/safe-bash/opt-in/commands/install/mode.js +71 -0
- package/dist/safe-bash/opt-in/commands/install/options.d.ts +36 -0
- package/dist/safe-bash/opt-in/commands/install/options.js +27 -0
- package/dist/safe-bash/opt-in/commands/shuf/args.js +179 -0
- package/dist/safe-bash/opt-in/commands/shuf/index.d.ts +6 -0
- package/dist/safe-bash/opt-in/commands/shuf/index.js +20 -0
- package/dist/safe-bash/opt-in/commands/shuf/input.js +93 -0
- package/dist/safe-bash/opt-in/commands/shuf/options.d.ts +9 -0
- package/dist/safe-bash/opt-in/commands/shuf/options.js +8 -0
- package/dist/safe-bash/opt-in/commands/shuf/random.js +114 -0
- package/dist/safe-bash/opt-in/commands/shuf/shuf.d.ts +3 -0
- package/dist/safe-bash/opt-in/commands/shuf/shuf.js +230 -0
- package/dist/safe-bash/opt-in/commands/shuf/usage.js +24 -0
- package/dist/safe-bash/opt-in/commands/truncate/arguments.js +186 -0
- package/dist/safe-bash/opt-in/commands/truncate/index.d.ts +9 -0
- package/dist/safe-bash/opt-in/commands/truncate/index.js +244 -0
- package/dist/safe-bash/opt-in/commands/yes/index.d.ts +11 -0
- package/dist/safe-bash/opt-in/commands/yes/index.js +167 -0
- package/dist/safe-bash/opt-in/commands/yq/arguments.js +177 -0
- package/dist/safe-bash/opt-in/commands/yq/evaluate.js +564 -0
- package/dist/safe-bash/opt-in/commands/yq/expression.js +183 -0
- package/dist/safe-bash/opt-in/commands/yq/inplace.js +65 -0
- package/dist/safe-bash/opt-in/commands/yq/mike.d.ts +9 -0
- package/dist/safe-bash/opt-in/commands/yq/mike.js +192 -0
- package/dist/safe-bash/opt-in/commands/yq/native-encoder.js +165 -0
- package/dist/safe-bash/opt-in/commands/yq/native-work.d.ts +44 -0
- package/dist/safe-bash/opt-in/commands/yq/native-work.js +188 -0
- package/dist/safe-bash/opt-in/commands/yq/nodes.js +621 -0
- package/dist/safe-bash/opt-in/entrypoints/arrays.d.ts +1 -0
- package/dist/safe-bash/opt-in/entrypoints/arrays.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/cmp.d.ts +2 -0
- package/dist/safe-bash/opt-in/entrypoints/cmp.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/dd.d.ts +2 -0
- package/dist/safe-bash/opt-in/entrypoints/dd.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/devices.d.ts +2 -0
- package/dist/safe-bash/opt-in/entrypoints/devices.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/install.d.ts +2 -0
- package/dist/safe-bash/opt-in/entrypoints/install.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/jobs.d.ts +1 -0
- package/dist/safe-bash/opt-in/entrypoints/jobs.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/mapfile.d.ts +1 -0
- package/dist/safe-bash/opt-in/entrypoints/mapfile.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/read.d.ts +2 -0
- package/dist/safe-bash/opt-in/entrypoints/read.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/shuf.d.ts +2 -0
- package/dist/safe-bash/opt-in/entrypoints/shuf.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/trap.d.ts +2 -0
- package/dist/safe-bash/opt-in/entrypoints/trap.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/truncate.d.ts +2 -0
- package/dist/safe-bash/opt-in/entrypoints/truncate.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/yes.d.ts +2 -0
- package/dist/safe-bash/opt-in/entrypoints/yes.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/yq.d.ts +3 -0
- package/dist/safe-bash/opt-in/entrypoints/yq.js +1 -0
- package/dist/safe-bash/opt-in/fs/devices/index.d.ts +8 -0
- package/dist/safe-bash/opt-in/fs/devices/index.js +292 -0
- package/dist/safe-bash/opt-in/optional.d.ts +28 -0
- package/dist/safe-bash/opt-in/optional.js +14 -0
- package/dist/safe-bash/opt-in/shell/extensions/arrays/index.d.ts +2 -0
- package/dist/safe-bash/opt-in/shell/extensions/arrays/index.js +4 -0
- package/dist/safe-bash/opt-in/shell/extensions/jobs/index.d.ts +2 -0
- package/dist/safe-bash/opt-in/shell/extensions/jobs/index.js +291 -0
- package/dist/safe-bash/opt-in/shell/extensions/jobs/state.js +374 -0
- package/dist/safe-bash/opt-in/shell/extensions/mapfile/index.d.ts +24 -0
- package/dist/safe-bash/opt-in/shell/extensions/mapfile/index.js +338 -0
- package/dist/safe-bash/opt-in/shell/extensions/read/index.d.ts +5 -0
- package/dist/safe-bash/opt-in/shell/extensions/read/index.js +351 -0
- package/dist/safe-bash/opt-in/shell/extensions/trap/index.d.ts +9 -0
- package/dist/safe-bash/opt-in/shell/extensions/trap/index.js +210 -0
- package/dist/safe-bash/optional-host.d.ts +5 -0
- package/dist/safe-bash/optional-host.d.ts.map +1 -0
- package/dist/safe-bash/optional-host.js +3 -0
- package/dist/safe-bash/optional-host.js.map +1 -0
- package/dist/safe-bash/shell/arrays/bindings.d.ts +15 -5
- package/dist/safe-bash/shell/arrays/bindings.d.ts.map +1 -1
- package/dist/safe-bash/shell/arrays/bindings.js +131 -23
- package/dist/safe-bash/shell/arrays/bindings.js.map +1 -1
- package/dist/safe-bash/shell/arrays/ledger.d.ts +1 -0
- package/dist/safe-bash/shell/arrays/ledger.d.ts.map +1 -1
- package/dist/safe-bash/shell/arrays/ledger.js +19 -0
- package/dist/safe-bash/shell/arrays/ledger.js.map +1 -1
- package/dist/safe-bash/shell/arrays/state.d.ts.map +1 -1
- package/dist/safe-bash/shell/arrays/state.js +3 -1
- package/dist/safe-bash/shell/arrays/state.js.map +1 -1
- package/dist/safe-bash/shell/arrays/syntax.d.ts +4 -1
- package/dist/safe-bash/shell/arrays/syntax.d.ts.map +1 -1
- package/dist/safe-bash/shell/arrays/syntax.js +3 -3
- package/dist/safe-bash/shell/arrays/syntax.js.map +1 -1
- package/dist/safe-bash/shell/conditional.js +1 -1
- package/dist/safe-bash/shell/descriptors.d.ts +31 -0
- package/dist/safe-bash/shell/descriptors.d.ts.map +1 -0
- package/dist/safe-bash/shell/descriptors.js +234 -0
- package/dist/safe-bash/shell/descriptors.js.map +1 -0
- package/dist/safe-bash/shell/diagnostic-name-ranges.d.ts +2 -0
- package/dist/safe-bash/shell/diagnostic-name-ranges.d.ts.map +1 -0
- package/dist/safe-bash/shell/diagnostic-name-ranges.js +717 -0
- package/dist/safe-bash/shell/diagnostic-name-ranges.js.map +1 -0
- package/dist/safe-bash/shell/diagnostic-name.d.ts +3 -0
- package/dist/safe-bash/shell/diagnostic-name.d.ts.map +1 -0
- package/dist/safe-bash/shell/diagnostic-name.js +89 -0
- package/dist/safe-bash/shell/diagnostic-name.js.map +1 -0
- package/dist/safe-bash/shell/display.js +1 -1
- package/dist/safe-bash/shell/display.js.map +1 -1
- package/dist/safe-bash/shell/extensions.d.ts +188 -0
- package/dist/safe-bash/shell/extensions.d.ts.map +1 -0
- package/dist/safe-bash/shell/extensions.js +141 -0
- package/dist/safe-bash/shell/extensions.js.map +1 -0
- package/dist/safe-bash/shell/input.d.ts +66 -14
- package/dist/safe-bash/shell/input.d.ts.map +1 -1
- package/dist/safe-bash/shell/input.js +947 -173
- package/dist/safe-bash/shell/input.js.map +1 -1
- package/dist/safe-bash/shell/parser.d.ts +38 -6
- package/dist/safe-bash/shell/parser.d.ts.map +1 -1
- package/dist/safe-bash/shell/parser.js +339 -52
- package/dist/safe-bash/shell/parser.js.map +1 -1
- package/dist/safe-bash/shell/runtime.d.ts +92 -20
- package/dist/safe-bash/shell/runtime.d.ts.map +1 -1
- package/dist/safe-bash/shell/runtime.js +2547 -689
- package/dist/safe-bash/shell/runtime.js.map +1 -1
- package/dist/safe-bash/shell/shell.d.ts.map +1 -1
- package/dist/safe-bash/shell/shell.js +52 -21
- package/dist/safe-bash/shell/shell.js.map +1 -1
- package/dist/safe-bash/shell/types.d.ts +4 -0
- package/dist/safe-bash/shell/types.d.ts.map +1 -1
- package/dist/safe-bash/shell/types.js.map +1 -1
- package/package.json +99 -5
- package/dist/safe-bash/chunks/chunk-4DBWBEU7.js +0 -194
- package/dist/safe-bash/chunks/chunk-4DBWBEU7.js.map +0 -7
- package/dist/safe-bash/chunks/chunk-CXMIIXJA.js +0 -178
- package/dist/safe-bash/chunks/chunk-CXMIIXJA.js.map +0 -7
- package/dist/safe-bash/chunks/chunk-HHJSJWUD.js.map +0 -7
- /package/dist/safe-bash/chunks/{bz2-B2RXT4EX.js.map → bz2-ACU4EOVE.js.map} +0 -0
- /package/dist/safe-bash/chunks/{chunk-RNKTWFEM.js.map → chunk-CDBQXRWL.js.map} +0 -0
- /package/dist/safe-bash/chunks/{chunk-AFH57PPL.js.map → chunk-IEKESMO4.js.map} +0 -0
- /package/dist/safe-bash/chunks/{chunk-DPJWEGIX.js.map → chunk-JLBIUYT3.js.map} +0 -0
- /package/dist/safe-bash/chunks/{chunk-PVJJFCGA.js.map → chunk-M3GPCYSP.js.map} +0 -0
- /package/dist/safe-bash/chunks/{chunk-2KL6W6NB.js.map → chunk-O2EVBRKF.js.map} +0 -0
- /package/dist/safe-bash/chunks/{chunk-C7QNJ3D4.js.map → chunk-WYTI64IU.js.map} +0 -0
- /package/dist/safe-bash/chunks/{xz-AVXFDXW4.js.map → xz-U4QDTPZL.js.map} +0 -0
- /package/dist/safe-bash/chunks/{zstd-R6RPHJYO.js.map → zstd-OG5RPYXO.js.map} +0 -0
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/contracts/filesystem-output.ts"],
|
|
4
|
-
"sourcesContent": ["import type { CommandContext } from \"./command.js\";\nimport { FsError } from \"./errors.js\";\nimport { createBytePipe, outputFailure, type BytePipe, type ByteSink, type ByteSource } from \"./io.js\";\nimport { createOutputOperation } from \"./output.js\";\n\nconst filesystemOutputBudgets = new WeakMap<NonNullable<CommandContext[\"registerCleanup\"]>, (sink: ByteSink) => ByteSink>();\n\nexport type FileOutputContext = Pick<CommandContext, \"fs\" | \"signal\" | \"registerCleanup\"> & {\n readonly outputBudget?: \"shell\" | \"independent\";\n};\n\nexport function bindFileOutputBudget(context: Pick<CommandContext, \"registerCleanup\">, budget: (sink: ByteSink) => ByteSink): void {\n if (!context.registerCleanup) throw new TypeError(\"Shell output budgets require invocation cleanup ownership\");\n filesystemOutputBudgets.set(context.registerCleanup, budget);\n}\n\nexport async function writeFileOutput(context: Pick<CommandContext, \"signal\" | \"registerCleanup\">, bytes: Uint8Array, write: (bytes: Uint8Array) => Promise<void>): Promise<void> {\n context.signal.throwIfAborted();\n const budget = context.registerCleanup && filesystemOutputBudgets.get(context.registerCleanup);\n let pending: Promise<void> | undefined;\n const destination: ByteSink = { write(chunk) {\n context.signal.throwIfAborted();\n return pending = (async () => { await write(chunk); })();\n } };\n try { await (budget?.(destination) ?? destination).write(bytes); }\n catch (error) {\n // Shell sink cancellation may win its race before the direct host call.\n // Keep the original awaited-write lifetime without a retained cleanup hook.\n await pending?.catch(() => {});\n context.signal.throwIfAborted();\n throw error;\n }\n context.signal.throwIfAborted();\n}\n\nexport interface FileOutput {\n readonly sink: ByteSink;\n readonly signal: AbortSignal;\n finish(): Promise<void>;\n abort(reason: unknown): Promise<void>;\n}\n\nexport async function openFileOutput(context: FileOutputContext, path: string, flag: \"w\" | \"a\", incremental?: () => Promise<ByteSink>): Promise<FileOutput> {\n let pipe: BytePipe | undefined;\n let task: Promise<void> | undefined;\n let completed = false;\n let ended = false;\n let closing = false;\n let failure: { reason: unknown } | undefined;\n const consumer = new AbortController();\n let writes = Promise.resolve();\n let acknowledge: (() => void) | undefined;\n const acknowledgeWrite = (): void => {\n const accepted = acknowledge;\n acknowledge = undefined;\n accepted?.();\n };\n let ready!: () => void;\n const opened = new Promise<void>(resolve => { ready = resolve; });\n const destination: ByteSink = {\n [outputFailure]: reason => operation.abort(reason),\n async write(chunk) {\n if (closing) throw new FsError(\"EBADF\", { path, syscall: \"write\" });\n const writing = writes.then(async () => {\n for (let offset = 0; offset < chunk.byteLength; offset += 64 * 1024) {\n const accepted = new Promise<void>(resolve => { acknowledge = resolve; });\n await pipe!.writable.write(chunk.subarray(offset, offset + 64 * 1024));\n await accepted;\n if (failure) throw failure.reason;\n operation.signal.throwIfAborted();\n }\n });\n writes = writing.catch(() => {});\n await writing;\n },\n };\n const budget = context.outputBudget !== \"independent\" && context.registerCleanup\n ? filesystemOutputBudgets.get(context.registerCleanup) : undefined;\n const operation = createOutputOperation(context, budget?.(destination) ?? destination);\n operation.registerCleanup(async () => {\n closing = true;\n if (!completed) {\n void operation.abort(operation.signal.aborted ? operation.signal.reason : new FsError(\"ECANCELED\", { path, syscall: \"write\" }));\n await pipe?.abort(operation.signal.reason);\n }\n await task?.catch(() => {});\n await writes;\n });\n try {\n pipe = createBytePipe({ highWaterMark: 1, signal: operation.signal });\n let reading = false;\n const source: ByteSource = {\n [Symbol.asyncIterator]() {\n return (async function* () {\n reading = true;\n ready();\n for await (const chunk of pipe!.readable) {\n yield chunk;\n acknowledgeWrite();\n }\n operation.signal.throwIfAborted();\n ended = true;\n })();\n },\n };\n task = (async () => {\n const { fs } = context;\n const signal = operation.signal;\n signal.throwIfAborted();\n const capabilities = await fs.capabilitiesFor?.(path, { signal }) ?? fs.capabilities;\n if (capabilities.readOnly === true) throw new FsError(\"EROFS\", { path, syscall: \"write\" });\n try { await fs.access(path, 2, { signal }); }\n catch (error) {\n signal.throwIfAborted();\n if (!(error instanceof FsError) || error.code !== \"ENOENT\" && error.code !== \"ENOTSUP\") throw error;\n }\n signal.throwIfAborted();\n const streaming = flag === \"a\" ? capabilities.streamingAppend ?? capabilities.streamingWrite : capabilities.streamingWrite;\n if ((!incremental || capabilities.descriptorWriteStream === true) && streaming !== false && fs.writeStream) {\n try {\n await fs.writeStream(path, source, { flag, signal });\n if (!ended) throw new FsError(\"EIO\", { path, message: \"Streaming writer returned before consuming output\" });\n return;\n } catch (error) {\n signal.throwIfAborted();\n if (reading || !(error instanceof FsError) || error.code !== \"ENOTSUP\") throw error;\n }\n }\n if (flag === \"w\" && capabilities.write === false) throw new FsError(\"ENOTSUP\", { path, syscall: \"writeFile\" });\n if ((!incremental || flag === \"a\") && capabilities.append === false) throw new FsError(\"ENOTSUP\", { path, syscall: \"appendFile\" });\n const sink = incremental ? await incremental() : await (async (): Promise<ByteSink> => {\n if (flag === \"a\") await fs.appendFile(path, new Uint8Array(), { signal });\n else await fs.writeFile(path, new Uint8Array(), { flag, signal });\n return { write: chunk => fs.appendFile(path, chunk, { signal }) };\n })();\n for await (const chunk of source) {\n signal.throwIfAborted();\n await sink.write(chunk);\n }\n })();\n void task.then(acknowledgeWrite, error => {\n failure = { reason: error };\n acknowledgeWrite();\n if (!operation.signal.aborted) consumer.abort(error);\n void operation.abort(error).catch(() => {});\n });\n await Promise.race([opened, task]);\n operation.signal.throwIfAborted();\n const write = async (chunk: Uint8Array): Promise<void> => {\n try { await operation.output.write(chunk); }\n catch (error) { throw failure ? failure.reason : error; }\n };\n return {\n signal: operation.signal,\n sink: {\n [outputFailure]: destination[outputFailure]!,\n ownedOutput: { consumerClosed: consumer.signal, write },\n write,\n },\n async finish() {\n closing = true;\n try {\n await writes;\n await pipe!.close();\n await task;\n operation.signal.throwIfAborted();\n completed = true;\n } catch (error) { throw failure ? failure.reason : error; }\n finally { await operation.close(); }\n },\n abort: reason => operation.abort(reason),\n };\n } catch (error) {\n await operation.abort(error);\n throw error;\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;AAAA;AAKA,IAAM,0BAA0B,oBAAI,QAAsF;AAMnH,SAAS,qBAAqB,SAAkD,QAA4C;AACjI,MAAI,CAAC,QAAQ,gBAAiB,OAAM,IAAI,UAAU,2DAA2D;AAC7G,0BAAwB,IAAI,QAAQ,iBAAiB,MAAM;AAC7D;AAEA,eAAsB,gBAAgB,SAA6D,OAAmB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|
|
5
|
-
|
|
6
|
-
// packages/safe-bash/src/contracts/errors.ts
|
|
7
|
-
init_platform();
|
|
8
|
-
import { isErrnoCode, isFsError, toFsError, FsError } from "@poe-platform/safe-fs/core";
|
|
9
|
-
|
|
10
|
-
// packages/safe-bash/src/contracts/io.ts
|
|
11
|
-
init_platform();
|
|
12
|
-
init_platform();
|
|
13
|
-
import { collectBytes, readBytes } from "@poe-platform/safe-fs/core";
|
|
14
|
-
import { collectBytes as collectBytes2, readBytes as readBytes2, toByteSource } from "@poe-platform/safe-fs/core";
|
|
15
|
-
var outputFailure = /* @__PURE__ */ Symbol("output failure");
|
|
16
|
-
function createBytePipe(options = {}) {
|
|
17
|
-
const highWaterMark = options.highWaterMark ?? 64 * 1024;
|
|
18
|
-
const signal = options.signal;
|
|
19
|
-
if (!Number.isSafeInteger(highWaterMark) || highWaterMark < 1) {
|
|
20
|
-
throw new RangeError("highWaterMark must be a positive safe integer");
|
|
21
|
-
}
|
|
22
|
-
const stream = new TransformStream(
|
|
23
|
-
void 0,
|
|
24
|
-
{ highWaterMark: 1 },
|
|
25
|
-
{ highWaterMark, size: (chunk) => chunk.byteLength }
|
|
26
|
-
);
|
|
27
|
-
const reader = stream.readable.getReader();
|
|
28
|
-
const writer = stream.writable.getWriter();
|
|
29
|
-
let ended = false;
|
|
30
|
-
let failed = false;
|
|
31
|
-
let failure;
|
|
32
|
-
let closePromise;
|
|
33
|
-
let abortPromise;
|
|
34
|
-
let finished = false;
|
|
35
|
-
const consumer = new AbortController();
|
|
36
|
-
const abort = (reason = new FsError("EPIPE", { syscall: "pipe" })) => {
|
|
37
|
-
if (abortPromise) return abortPromise;
|
|
38
|
-
if (finished) return Promise.resolve();
|
|
39
|
-
failed = true;
|
|
40
|
-
failure = reason;
|
|
41
|
-
ended = true;
|
|
42
|
-
consumer.abort(reason);
|
|
43
|
-
abortPromise = Promise.allSettled([reader.cancel(reason), writer.abort(reason)]).then(() => {
|
|
44
|
-
});
|
|
45
|
-
return abortPromise;
|
|
46
|
-
};
|
|
47
|
-
const onAbort = () => {
|
|
48
|
-
void abort(signal?.reason);
|
|
49
|
-
};
|
|
50
|
-
const cleanup = () => signal?.removeEventListener("abort", onAbort);
|
|
51
|
-
void writer.closed.catch(() => {
|
|
52
|
-
});
|
|
53
|
-
void reader.closed.then(cleanup, cleanup);
|
|
54
|
-
if (signal?.aborted) onAbort();
|
|
55
|
-
else signal?.addEventListener("abort", onAbort, { once: true });
|
|
56
|
-
const iterator = (async function* () {
|
|
57
|
-
try {
|
|
58
|
-
while (true) {
|
|
59
|
-
if (failed) throw failure;
|
|
60
|
-
const result = await reader.read();
|
|
61
|
-
if (failed) throw failure;
|
|
62
|
-
if (result.done) {
|
|
63
|
-
finished = true;
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
yield result.value;
|
|
67
|
-
}
|
|
68
|
-
} finally {
|
|
69
|
-
if (!finished) await abort();
|
|
70
|
-
reader.releaseLock();
|
|
71
|
-
}
|
|
72
|
-
})();
|
|
73
|
-
const readable = {
|
|
74
|
-
[Symbol.asyncIterator]() {
|
|
75
|
-
return this;
|
|
76
|
-
},
|
|
77
|
-
next() {
|
|
78
|
-
return iterator.next();
|
|
79
|
-
},
|
|
80
|
-
async return() {
|
|
81
|
-
if (!finished) await abort();
|
|
82
|
-
try {
|
|
83
|
-
return await iterator.return(void 0);
|
|
84
|
-
} finally {
|
|
85
|
-
reader.releaseLock();
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
async throw(reason) {
|
|
89
|
-
await abort(reason);
|
|
90
|
-
try {
|
|
91
|
-
return await iterator.throw(reason);
|
|
92
|
-
} finally {
|
|
93
|
-
reader.releaseLock();
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
const write = async (chunk) => {
|
|
98
|
-
if (failed) throw failure;
|
|
99
|
-
if (ended) throw new FsError("EPIPE", { syscall: "write" });
|
|
100
|
-
if (!(chunk instanceof Uint8Array)) throw new TypeError("Byte sinks require Uint8Array chunks");
|
|
101
|
-
if (chunk.byteLength > 0) await writer.write(new Uint8Array(chunk));
|
|
102
|
-
};
|
|
103
|
-
return {
|
|
104
|
-
readable,
|
|
105
|
-
writable: {
|
|
106
|
-
write,
|
|
107
|
-
[outputFailure]: abort,
|
|
108
|
-
ownedOutput: { consumerClosed: consumer.signal, write }
|
|
109
|
-
},
|
|
110
|
-
close() {
|
|
111
|
-
if (failed) return Promise.reject(failure);
|
|
112
|
-
ended = true;
|
|
113
|
-
closePromise ??= writer.close();
|
|
114
|
-
return closePromise;
|
|
115
|
-
},
|
|
116
|
-
abort
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
async function writeText(sink, text) {
|
|
120
|
-
await sink.write(new TextEncoder().encode(text));
|
|
121
|
-
}
|
|
122
|
-
async function writeBytes(sink, chunk, signal) {
|
|
123
|
-
if (!(chunk instanceof Uint8Array)) throw new TypeError("Byte sinks require Uint8Array chunks");
|
|
124
|
-
await abortable(() => sink.write(chunk), signal);
|
|
125
|
-
}
|
|
126
|
-
async function pipeBytes(source, sink, signal) {
|
|
127
|
-
signal?.throwIfAborted();
|
|
128
|
-
for await (const chunk of readBytes(source, signal)) {
|
|
129
|
-
await writeBytes(sink, chunk, signal);
|
|
130
|
-
}
|
|
131
|
-
signal?.throwIfAborted();
|
|
132
|
-
}
|
|
133
|
-
async function collectText(source, options) {
|
|
134
|
-
return new TextDecoder().decode(await collectBytes(source, options));
|
|
135
|
-
}
|
|
136
|
-
async function abortable(operation, signal) {
|
|
137
|
-
signal?.throwIfAborted();
|
|
138
|
-
if (!signal) return operation();
|
|
139
|
-
return new Promise((resolve, reject) => {
|
|
140
|
-
const onAbort = () => {
|
|
141
|
-
signal.removeEventListener("abort", onAbort);
|
|
142
|
-
reject(signal.reason);
|
|
143
|
-
};
|
|
144
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
145
|
-
try {
|
|
146
|
-
Promise.resolve(operation()).then(
|
|
147
|
-
(result) => {
|
|
148
|
-
signal.removeEventListener("abort", onAbort);
|
|
149
|
-
resolve(result);
|
|
150
|
-
},
|
|
151
|
-
(error) => {
|
|
152
|
-
signal.removeEventListener("abort", onAbort);
|
|
153
|
-
reject(error);
|
|
154
|
-
}
|
|
155
|
-
);
|
|
156
|
-
} catch (error) {
|
|
157
|
-
signal.removeEventListener("abort", onAbort);
|
|
158
|
-
reject(error);
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
export {
|
|
164
|
-
isErrnoCode,
|
|
165
|
-
isFsError,
|
|
166
|
-
toFsError,
|
|
167
|
-
FsError,
|
|
168
|
-
outputFailure,
|
|
169
|
-
createBytePipe,
|
|
170
|
-
writeText,
|
|
171
|
-
writeBytes,
|
|
172
|
-
pipeBytes,
|
|
173
|
-
collectText,
|
|
174
|
-
collectBytes2 as collectBytes,
|
|
175
|
-
readBytes2 as readBytes,
|
|
176
|
-
toByteSource
|
|
177
|
-
};
|
|
178
|
-
//# sourceMappingURL=chunk-CXMIIXJA.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/contracts/errors.ts", "../../src/contracts/io.ts"],
|
|
4
|
-
"sourcesContent": ["export { isErrnoCode, isFsError, toFsError, FsError } from \"poe-code/safe-fs/core\";\nexport type { ErrnoCode, FsErrorOptions } from \"poe-code/safe-fs/core\";\n", "import { collectBytes, readBytes } from \"poe-code/safe-fs/core\";\nimport type { ByteSource, CollectOptions } from \"poe-code/safe-fs/core\";\nexport { collectBytes, readBytes, toByteSource } from \"poe-code/safe-fs/core\";\nexport type { ByteSource, CollectOptions } from \"poe-code/safe-fs/core\";\nimport { TransformStream } from \"node:stream/web\";\nimport { FsError } from \"./errors.js\";\n\nexport const outputFailure = Symbol(\"output failure\");\n\nexport interface ByteSink {\n write(chunk: Uint8Array): Promise<void>;\n readonly [outputFailure]?: (reason: unknown) => Promise<void>;\n readonly ownedOutput?: {\n readonly consumerClosed: AbortSignal;\n write(chunk: Uint8Array): Promise<void>;\n };\n}\n\nexport interface BytePipe {\n readonly readable: ByteSource;\n readonly writable: ByteSink;\n close(): Promise<void>;\n abort(reason?: unknown): Promise<void>;\n}\n\nexport interface BytePipeOptions {\n readonly highWaterMark?: number;\n readonly signal?: AbortSignal;\n}\n\nexport function createBytePipe(options: BytePipeOptions = {}): BytePipe {\n const highWaterMark = options.highWaterMark ?? 64 * 1024;\n const signal = options.signal;\n if (!Number.isSafeInteger(highWaterMark) || highWaterMark < 1) {\n throw new RangeError(\"highWaterMark must be a positive safe integer\");\n }\n const stream = new TransformStream<Uint8Array, Uint8Array>(\n undefined,\n { highWaterMark: 1 },\n { highWaterMark, size: (chunk) => chunk.byteLength },\n );\n const reader = stream.readable.getReader();\n const writer = stream.writable.getWriter();\n let ended = false;\n let failed = false;\n let failure: unknown;\n let closePromise: Promise<void> | undefined;\n let abortPromise: Promise<void> | undefined;\n let finished = false;\n const consumer = new AbortController();\n const abort = (reason: unknown = new FsError(\"EPIPE\", { syscall: \"pipe\" })): Promise<void> => {\n if (abortPromise) return abortPromise;\n if (finished) return Promise.resolve();\n failed = true;\n failure = reason;\n ended = true;\n consumer.abort(reason);\n abortPromise = Promise.allSettled([reader.cancel(reason), writer.abort(reason)]).then(() => {});\n return abortPromise;\n };\n const onAbort = (): void => { void abort(signal?.reason); };\n const cleanup = (): void => signal?.removeEventListener(\"abort\", onAbort);\n void writer.closed.catch(() => {});\n void reader.closed.then(cleanup, cleanup);\n if (signal?.aborted) onAbort();\n else signal?.addEventListener(\"abort\", onAbort, { once: true });\n const iterator = (async function* (): AsyncGenerator<Uint8Array> {\n try {\n while (true) {\n if (failed) throw failure;\n const result = await reader.read();\n if (failed) throw failure;\n if (result.done) {\n finished = true;\n return;\n }\n yield result.value;\n }\n } finally {\n if (!finished) await abort();\n reader.releaseLock();\n }\n })();\n const readable: AsyncIterableIterator<Uint8Array> = {\n [Symbol.asyncIterator]() { return this; },\n next() { return iterator.next(); },\n async return() {\n if (!finished) await abort();\n try {\n return await iterator.return(undefined);\n } finally {\n reader.releaseLock();\n }\n },\n async throw(reason) {\n await abort(reason);\n try {\n return await iterator.throw(reason);\n } finally {\n reader.releaseLock();\n }\n },\n };\n const write = async (chunk: Uint8Array): Promise<void> => {\n if (failed) throw failure;\n if (ended) throw new FsError(\"EPIPE\", { syscall: \"write\" });\n if (!(chunk instanceof Uint8Array)) throw new TypeError(\"Byte sinks require Uint8Array chunks\");\n if (chunk.byteLength > 0) await writer.write(new Uint8Array(chunk));\n };\n return {\n readable,\n writable: {\n write,\n [outputFailure]: abort,\n ownedOutput: { consumerClosed: consumer.signal, write },\n },\n close() {\n if (failed) return Promise.reject(failure);\n ended = true;\n closePromise ??= writer.close();\n return closePromise;\n },\n abort,\n };\n}\n\nexport async function writeText(sink: ByteSink, text: string): Promise<void> {\n await sink.write(new TextEncoder().encode(text));\n}\n\nexport async function writeBytes(sink: ByteSink, chunk: Uint8Array, signal?: AbortSignal): Promise<void> {\n if (!(chunk instanceof Uint8Array)) throw new TypeError(\"Byte sinks require Uint8Array chunks\");\n await abortable(() => sink.write(chunk), signal);\n}\n\nexport async function pipeBytes(source: ByteSource, sink: ByteSink, signal?: AbortSignal): Promise<void> {\n signal?.throwIfAborted();\n for await (const chunk of readBytes(source, signal)) {\n await writeBytes(sink, chunk, signal);\n }\n signal?.throwIfAborted();\n}\n\nexport async function collectText(source: ByteSource, options: CollectOptions): Promise<string> {\n return new TextDecoder().decode(await collectBytes(source, options));\n}\n\nasync function abortable<Result>(operation: () => PromiseLike<Result>, signal?: AbortSignal): Promise<Result> {\n signal?.throwIfAborted();\n if (!signal) return operation();\n return new Promise<Result>((resolve, reject) => {\n const onAbort = (): void => {\n signal.removeEventListener(\"abort\", onAbort);\n reject(signal.reason);\n };\n signal.addEventListener(\"abort\", onAbort, { once: true });\n try {\n Promise.resolve(operation()).then(\n (result) => {\n signal.removeEventListener(\"abort\", onAbort);\n resolve(result);\n },\n (error: unknown) => {\n signal.removeEventListener(\"abort\", onAbort);\n reject(error);\n },\n );\n } catch (error) {\n signal.removeEventListener(\"abort\", onAbort);\n reject(error);\n }\n });\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;AAAA;AAAA,SAAS,aAAa,WAAW,WAAW,eAAe;;;ACA3D;AAIA;AAJA,SAAS,cAAc,iBAAiB;AAExC,SAAS,gBAAAA,eAAc,aAAAC,YAAW,oBAAoB;AAK/C,IAAM,gBAAgB,uBAAO,gBAAgB;AAuB7C,SAAS,eAAe,UAA2B,CAAC,GAAa;AACtE,QAAM,gBAAgB,QAAQ,iBAAiB,KAAK;AACpD,QAAM,SAAS,QAAQ;AACvB,MAAI,CAAC,OAAO,cAAc,aAAa,KAAK,gBAAgB,GAAG;AAC7D,UAAM,IAAI,WAAW,+CAA+C;AAAA,EACtE;AACA,QAAM,SAAS,IAAI;AAAA,IACjB;AAAA,IACA,EAAE,eAAe,EAAE;AAAA,IACnB,EAAE,eAAe,MAAM,CAAC,UAAU,MAAM,WAAW;AAAA,EACrD;AACA,QAAM,SAAS,OAAO,SAAS,UAAU;AACzC,QAAM,SAAS,OAAO,SAAS,UAAU;AACzC,MAAI,QAAQ;AACZ,MAAI,SAAS;AACb,MAAI;AACJ,MAAI;AACJ,MAAI;AACJ,MAAI,WAAW;AACf,QAAM,WAAW,IAAI,gBAAgB;AACrC,QAAM,QAAQ,CAAC,SAAkB,IAAI,QAAQ,SAAS,EAAE,SAAS,OAAO,CAAC,MAAqB;AAC5F,QAAI,aAAc,QAAO;AACzB,QAAI,SAAU,QAAO,QAAQ,QAAQ;AACrC,aAAS;AACT,cAAU;AACV,YAAQ;AACR,aAAS,MAAM,MAAM;AACrB,mBAAe,QAAQ,WAAW,CAAC,OAAO,OAAO,MAAM,GAAG,OAAO,MAAM,MAAM,CAAC,CAAC,EAAE,KAAK,MAAM;AAAA,IAAC,CAAC;AAC9F,WAAO;AAAA,EACT;AACA,QAAM,UAAU,MAAY;AAA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