@poe-platform/safe-bash 0.1.630 → 0.1.632
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 -0
- 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-KQ6J7JHQ.js → chunk-3LD67SER.js} +12 -10
- package/dist/safe-bash/chunks/{chunk-KQ6J7JHQ.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-6YSBXTTJ.js → chunk-EI4X5ETX.js} +12 -10
- package/dist/safe-bash/chunks/{chunk-6YSBXTTJ.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-K7W6Q6FN.js → chunk-V73A742N.js} +58 -16
- 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-3BZ5NQ73.js → chunk-WECHUK3Y.js} +369 -36
- 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/index.browser.js +8 -6
- 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/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 +5502 -2210
- package/dist/safe-bash/core.browser.js.map +4 -4
- package/dist/safe-bash/core.d.ts +1 -0
- package/dist/safe-bash/core.d.ts.map +1 -1
- package/dist/safe-bash/core.js +1 -0
- package/dist/safe-bash/core.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 +92 -4
- package/dist/safe-bash/chunks/chunk-3BZ5NQ73.js.map +0 -7
- 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-K7W6Q6FN.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
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
export const integerMaximum = 9223372036854775807n;
|
|
2
|
+
export class UsageError extends Error {
|
|
3
|
+
}
|
|
4
|
+
const escapes = new Map([[7, "a"], [8, "b"], [9, "t"], [10, "n"], [11, "v"], [12, "f"], [13, "r"]]);
|
|
5
|
+
export function quote(value) {
|
|
6
|
+
let result = "'";
|
|
7
|
+
for (const byte of new TextEncoder().encode(value)) {
|
|
8
|
+
const escape = escapes.get(byte);
|
|
9
|
+
result += escape ? `\\${escape}` : byte < 32 || byte >= 127 ? `\\${byte.toString(8).padStart(3, "0")}`
|
|
10
|
+
: byte === 39 || byte === 92 ? `\\${String.fromCharCode(byte)}` : String.fromCharCode(byte);
|
|
11
|
+
}
|
|
12
|
+
return `${result}'`;
|
|
13
|
+
}
|
|
14
|
+
export function pathQuote(value) {
|
|
15
|
+
if (value && !value.startsWith("~") && !value.startsWith("#") && value !== "{" && value !== "}"
|
|
16
|
+
&& Array.from(value).every(character => "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_./-+,:@%]~#{}".includes(character)))
|
|
17
|
+
return value;
|
|
18
|
+
const bytes = new TextEncoder().encode(value);
|
|
19
|
+
if (bytes.every(byte => byte >= 32 && byte < 127)) {
|
|
20
|
+
if (!value.includes("'"))
|
|
21
|
+
return `'${value}'`;
|
|
22
|
+
if (!["$", "`", "\\", '"'].some(character => value.includes(character)))
|
|
23
|
+
return `"${value}"`;
|
|
24
|
+
return `'${value.replaceAll("'", "'\\''")}'`;
|
|
25
|
+
}
|
|
26
|
+
let result = "'", escaped = false;
|
|
27
|
+
for (const byte of bytes) {
|
|
28
|
+
const special = byte < 32 || byte >= 127;
|
|
29
|
+
if (special !== escaped) {
|
|
30
|
+
result += special ? "'$'" : "''";
|
|
31
|
+
escaped = special;
|
|
32
|
+
}
|
|
33
|
+
result += special ? `\\${escapes.get(byte) ?? byte.toString(8).padStart(3, "0")}`
|
|
34
|
+
: byte === 39 ? "'\\''" : String.fromCharCode(byte);
|
|
35
|
+
}
|
|
36
|
+
return `${result}'`;
|
|
37
|
+
}
|
|
38
|
+
function countValue(text, kind) {
|
|
39
|
+
const invalid = () => { throw new UsageError(`invalid --${kind} value ${quote(text)}`); };
|
|
40
|
+
let position = 0;
|
|
41
|
+
while (position < text.length && " \t\n\r\v\f".includes(text[position]))
|
|
42
|
+
position++;
|
|
43
|
+
let negative = false;
|
|
44
|
+
if (text[position] === "+" || text[position] === "-")
|
|
45
|
+
negative = text[position++] === "-";
|
|
46
|
+
let base = 10;
|
|
47
|
+
if (text[position] === "0") {
|
|
48
|
+
base = 8;
|
|
49
|
+
if (text[position + 1]?.toLowerCase() === "x") {
|
|
50
|
+
base = 16;
|
|
51
|
+
position += 2;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const start = position;
|
|
55
|
+
let value = 0n;
|
|
56
|
+
while (position < text.length) {
|
|
57
|
+
const digit = "0123456789abcdef".indexOf(text[position].toLowerCase());
|
|
58
|
+
if (digit < 0 || digit >= base)
|
|
59
|
+
break;
|
|
60
|
+
value = value * BigInt(base) + BigInt(digit);
|
|
61
|
+
if (value > integerMaximum)
|
|
62
|
+
value = integerMaximum + 1n;
|
|
63
|
+
position++;
|
|
64
|
+
}
|
|
65
|
+
const suffix = text.slice(position);
|
|
66
|
+
const power = suffix ? "KMGTPEZY".indexOf(suffix[0] === "k" ? "K" : suffix[0]) + 1 : 0;
|
|
67
|
+
if (position === start && (!power || base !== 10 || negative || start !== 0))
|
|
68
|
+
invalid();
|
|
69
|
+
if (position === start)
|
|
70
|
+
value = 1n;
|
|
71
|
+
if (suffix) {
|
|
72
|
+
if (!power || !["", "B", "D", "iB"].includes(suffix.slice(1)))
|
|
73
|
+
invalid();
|
|
74
|
+
value *= (suffix.endsWith("B") && !suffix.endsWith("iB") || suffix.endsWith("D") ? 1000n : 1024n) ** BigInt(power);
|
|
75
|
+
}
|
|
76
|
+
if (negative && value !== 0n)
|
|
77
|
+
invalid();
|
|
78
|
+
return value > integerMaximum ? integerMaximum + 1n : value;
|
|
79
|
+
}
|
|
80
|
+
const longOptions = [
|
|
81
|
+
["print-bytes", "b"], ["print-chars", "c"], ["ignore-initial", "i"], ["verbose", "l"],
|
|
82
|
+
["bytes", "n"], ["silent", "s"], ["quiet", "s"], ["version", "v"], ["help", "help"],
|
|
83
|
+
];
|
|
84
|
+
export function parseArguments(args, posix) {
|
|
85
|
+
const operands = [];
|
|
86
|
+
const skips = [0n, 0n];
|
|
87
|
+
let count = integerMaximum, mode = "first", printBytes = false, stopped = false;
|
|
88
|
+
const skip = (index, text) => {
|
|
89
|
+
const parsed = countValue(text, "ignore-initial");
|
|
90
|
+
if (skips[index] < integerMaximum && parsed > skips[index])
|
|
91
|
+
skips[index] = parsed;
|
|
92
|
+
};
|
|
93
|
+
const apply = (flag, value) => {
|
|
94
|
+
if (flag === "b" || flag === "c")
|
|
95
|
+
printBytes = true;
|
|
96
|
+
if (flag === "l" || flag === "s") {
|
|
97
|
+
const selected = flag === "l" ? "all" : "silent";
|
|
98
|
+
if (mode !== "first" && mode !== selected)
|
|
99
|
+
throw new UsageError("options -l and -s are incompatible");
|
|
100
|
+
mode = selected;
|
|
101
|
+
}
|
|
102
|
+
if (flag === "n") {
|
|
103
|
+
const parsed = countValue(value, "bytes");
|
|
104
|
+
if (parsed < count)
|
|
105
|
+
count = parsed;
|
|
106
|
+
}
|
|
107
|
+
if (flag === "i") {
|
|
108
|
+
const delimiter = value.indexOf(":");
|
|
109
|
+
if (delimiter < 0) {
|
|
110
|
+
skip(0, value);
|
|
111
|
+
if (skips[0] > skips[1])
|
|
112
|
+
skips[1] = skips[0];
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
try {
|
|
116
|
+
skip(0, value.slice(0, delimiter));
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
throw new UsageError(`invalid --ignore-initial value ${quote(value)}`);
|
|
120
|
+
}
|
|
121
|
+
skip(1, value.slice(delimiter + 1));
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
for (let index = 0; index < args.length; index++) {
|
|
126
|
+
const argument = args[index];
|
|
127
|
+
if (stopped || argument === "-" || !argument.startsWith("-")) {
|
|
128
|
+
operands.push(argument);
|
|
129
|
+
if (posix)
|
|
130
|
+
stopped = true;
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
if (argument === "--") {
|
|
134
|
+
stopped = true;
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if (argument.startsWith("--")) {
|
|
138
|
+
const separator = argument.indexOf("=");
|
|
139
|
+
const name = argument.slice(2, separator < 0 ? undefined : separator);
|
|
140
|
+
const exact = longOptions.find(([option]) => option === name);
|
|
141
|
+
const matches = exact ? [exact] : longOptions.filter(([option]) => option.startsWith(name));
|
|
142
|
+
if (!matches.length)
|
|
143
|
+
throw new UsageError(`unrecognized option '${argument}'`);
|
|
144
|
+
if (matches.length > 1)
|
|
145
|
+
throw new UsageError(`option '${argument}' is ambiguous; possibilities:${matches.map(([option]) => ` '--${option}'`).join("")}`);
|
|
146
|
+
const flag = matches[0][1];
|
|
147
|
+
let value = separator < 0 ? undefined : argument.slice(separator + 1);
|
|
148
|
+
if (flag === "i" || flag === "n") {
|
|
149
|
+
if (value === undefined)
|
|
150
|
+
value = args[++index];
|
|
151
|
+
if (value === undefined)
|
|
152
|
+
throw new UsageError(`option '${argument}' requires an argument`);
|
|
153
|
+
}
|
|
154
|
+
else if (value !== undefined)
|
|
155
|
+
throw new UsageError(`option '--${matches[0][0]}' doesn't allow an argument`);
|
|
156
|
+
if (flag === "help" || flag === "v")
|
|
157
|
+
return { files: ["-", "-"], skips, count, mode, printBytes, information: flag === "v" ? "version" : "help" };
|
|
158
|
+
apply(flag, value);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
for (let offset = 1; offset < argument.length; offset++) {
|
|
162
|
+
const flag = argument[offset];
|
|
163
|
+
if (!"bci:ln:sv".includes(flag) || flag === ":")
|
|
164
|
+
throw new UsageError(`invalid option -- '${flag}'`);
|
|
165
|
+
if (flag === "v")
|
|
166
|
+
return { files: ["-", "-"], skips, count, mode, printBytes, information: "version" };
|
|
167
|
+
let value;
|
|
168
|
+
if (flag === "i" || flag === "n") {
|
|
169
|
+
value = argument.slice(offset + 1) || args[++index];
|
|
170
|
+
if (value === undefined)
|
|
171
|
+
throw new UsageError(`option requires an argument -- '${flag}'`);
|
|
172
|
+
offset = argument.length;
|
|
173
|
+
}
|
|
174
|
+
apply(flag, value);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (!operands.length)
|
|
179
|
+
throw new UsageError(`missing operand after ${quote(args.at(-1) ?? "cmp")}`);
|
|
180
|
+
if (operands[2] !== undefined)
|
|
181
|
+
skip(0, operands[2]);
|
|
182
|
+
if (operands[3] !== undefined)
|
|
183
|
+
skip(1, operands[3]);
|
|
184
|
+
if (operands[4] !== undefined)
|
|
185
|
+
throw new UsageError(`extra operand ${quote(operands[4])}`);
|
|
186
|
+
return { files: [operands[0], operands[1] ?? "-"], skips, count, mode, printBytes };
|
|
187
|
+
}
|
|
188
|
+
export function limitsFor(options) {
|
|
189
|
+
const limits = { maxChunkBytes: 1024 * 1024, maxFallbackBytes: 8 * 1024 * 1024, ...options.limits };
|
|
190
|
+
for (const [name, value] of Object.entries(limits)) {
|
|
191
|
+
if (!Number.isSafeInteger(value) || value < 1)
|
|
192
|
+
throw new RangeError(`cmp ${name} must be a positive safe integer`);
|
|
193
|
+
}
|
|
194
|
+
return Object.freeze(limits);
|
|
195
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
const encodings = {
|
|
2
|
+
ascii: "000102039c09867f978d8e0b0c0d0e0f101112139d8508871819928f1c1d1e1f" +
|
|
3
|
+
"80818283840a171b88898a8b8c050607909116939495960498999a9b14159e1a" +
|
|
4
|
+
"20a0a1a2a3a4a5a6a7a8d52e3c282b7c26a9aaabacadaeafb0b121242a293b7e" +
|
|
5
|
+
"2d2fb2b3b4b5b6b7b8b9cb2c255f3e3fbabbbcbdbebfc0c1c2603a2340273d22" +
|
|
6
|
+
"c3616263646566676869c4c5c6c7c8c9ca6a6b6c6d6e6f7071725ecccdcecfd0" +
|
|
7
|
+
"d1e5737475767778797ad2d3d45bd6d7d8d9dadbdcdddedfe0e1e2e3e45de6e7" +
|
|
8
|
+
"7b414243444546474849e8e9eaebeced7d4a4b4c4d4e4f505152eeeff0f1f2f3" +
|
|
9
|
+
"5c9f535455565758595af4f5f6f7f8f930313233343536373839fafbfcfdfeff",
|
|
10
|
+
ebcdic: "00010203372d2e2f1605250b0c0d0e0f101112133c3d322618193f271c1d1e1f" +
|
|
11
|
+
"405a7f7b5b6c507d4d5d5c4e6b604b61f0f1f2f3f4f5f6f7f8f97a5e4c7e6e6f" +
|
|
12
|
+
"7cc1c2c3c4c5c6c7c8c9d1d2d3d4d5d6d7d8d9e2e3e4e5e6e7e8e9ade0bd9a6d" +
|
|
13
|
+
"79818283848586878889919293949596979899a2a3a4a5a6a7a8a9c04fd05f07" +
|
|
14
|
+
"202122232415061728292a2b2c090a1b30311a333435360838393a3b04143ee1" +
|
|
15
|
+
"4142434445464748495152535455565758596263646566676869707172737475" +
|
|
16
|
+
"767778808a8b8c8d8e8f906a9b9c9d9e9fa0aaabac4aaeafb0b1b2b3b4b5b6b7" +
|
|
17
|
+
"b8b9babbbca1bebfcacbcccdcecfdadbdcdddedfeaebecedeeeffafbfcfdfeff",
|
|
18
|
+
ibm: "00010203372d2e2f1605250b0c0d0e0f101112133c3d322618193f271c1d1e1f" +
|
|
19
|
+
"405a7f7b5b6c507d4d5d5c4e6b604b61f0f1f2f3f4f5f6f7f8f97a5e4c7e6e6f" +
|
|
20
|
+
"7cc1c2c3c4c5c6c7c8c9d1d2d3d4d5d6d7d8d9e2e3e4e5e6e7e8e9ade0bd5f6d" +
|
|
21
|
+
"79818283848586878889919293949596979899a2a3a4a5a6a7a8a9c04fd0a107" +
|
|
22
|
+
"202122232415061728292a2b2c090a1b30311a333435360838393a3b04143ee1" +
|
|
23
|
+
"4142434445464748495152535455565758596263646566676869707172737475" +
|
|
24
|
+
"767778808a8b8c8d8e8f909a9b9c9d9e9fa0aaabacadaeafb0b1b2b3b4b5b6b7" +
|
|
25
|
+
"b8b9babbbcbdbebfcacbcccdcecfdadbdcdddedfeaebecedeeeffafbfcfdfeff",
|
|
26
|
+
};
|
|
27
|
+
export class DdConverter {
|
|
28
|
+
plan;
|
|
29
|
+
stats;
|
|
30
|
+
emit;
|
|
31
|
+
table = Uint8Array.from({ length: 256 }, (_, index) => index);
|
|
32
|
+
newline;
|
|
33
|
+
space;
|
|
34
|
+
saved;
|
|
35
|
+
column = 0;
|
|
36
|
+
spaces = 0;
|
|
37
|
+
buffer;
|
|
38
|
+
used = 0;
|
|
39
|
+
constructor(plan, stats, emit, chunkSize) {
|
|
40
|
+
this.plan = plan;
|
|
41
|
+
this.stats = stats;
|
|
42
|
+
this.emit = emit;
|
|
43
|
+
const translate = (name, byte) => Number.parseInt(encodings[name].slice(byte * 2, byte * 2 + 2), 16);
|
|
44
|
+
for (let index = 0; index < 256; index++) {
|
|
45
|
+
let value = plan.convert.has("ascii") ? translate("ascii", index) : index;
|
|
46
|
+
if (plan.convert.has("lcase") && value >= 65 && value <= 90)
|
|
47
|
+
value += 32;
|
|
48
|
+
if (plan.convert.has("ucase") && value >= 97 && value <= 122)
|
|
49
|
+
value -= 32;
|
|
50
|
+
if (plan.convert.has("ebcdic"))
|
|
51
|
+
value = translate("ebcdic", value);
|
|
52
|
+
if (plan.convert.has("ibm"))
|
|
53
|
+
value = translate("ibm", value);
|
|
54
|
+
this.table[index] = value;
|
|
55
|
+
}
|
|
56
|
+
this.newline = plan.convert.has("ebcdic") || plan.convert.has("ibm") ? 37 : 10;
|
|
57
|
+
this.space = plan.convert.has("ebcdic") || plan.convert.has("ibm") ? 64 : 32;
|
|
58
|
+
this.buffer = new Uint8Array(chunkSize);
|
|
59
|
+
}
|
|
60
|
+
async output(byte) {
|
|
61
|
+
this.buffer[this.used++] = byte;
|
|
62
|
+
if (this.used === this.buffer.length) {
|
|
63
|
+
await this.emit(this.buffer);
|
|
64
|
+
this.used = 0;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
async record(byte) {
|
|
68
|
+
const width = Number(this.plan.cbs);
|
|
69
|
+
if (this.plan.convert.has("block")) {
|
|
70
|
+
if (byte === this.newline) {
|
|
71
|
+
while (this.column < width) {
|
|
72
|
+
await this.output(this.space);
|
|
73
|
+
this.column++;
|
|
74
|
+
}
|
|
75
|
+
this.column = 0;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
if (this.column < width)
|
|
79
|
+
await this.output(byte);
|
|
80
|
+
else if (this.column === width)
|
|
81
|
+
this.stats.truncated++;
|
|
82
|
+
this.column = Math.min(width + 1, this.column + 1);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else if (this.plan.convert.has("unblock")) {
|
|
86
|
+
if (this.column === width) {
|
|
87
|
+
await this.output(this.newline);
|
|
88
|
+
this.column = 0;
|
|
89
|
+
this.spaces = 0;
|
|
90
|
+
}
|
|
91
|
+
this.column++;
|
|
92
|
+
if (byte === this.space)
|
|
93
|
+
this.spaces++;
|
|
94
|
+
else {
|
|
95
|
+
while (this.spaces > 0) {
|
|
96
|
+
await this.output(this.space);
|
|
97
|
+
this.spaces--;
|
|
98
|
+
}
|
|
99
|
+
await this.output(byte);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
else
|
|
103
|
+
await this.output(byte);
|
|
104
|
+
}
|
|
105
|
+
async push(input) {
|
|
106
|
+
if (!["swab", "block", "unblock"].some(conversion => this.plan.convert.has(conversion))) {
|
|
107
|
+
for (let offset = 0; offset < input.length; offset += this.buffer.length) {
|
|
108
|
+
const count = Math.min(this.buffer.length, input.length - offset);
|
|
109
|
+
for (let index = 0; index < count; index++)
|
|
110
|
+
this.buffer[index] = this.table[input[offset + index]];
|
|
111
|
+
await this.emit(this.buffer.subarray(0, count));
|
|
112
|
+
}
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
for (const byte of input) {
|
|
116
|
+
const value = this.table[byte];
|
|
117
|
+
if (this.plan.convert.has("swab")) {
|
|
118
|
+
if (this.saved === undefined)
|
|
119
|
+
this.saved = value;
|
|
120
|
+
else {
|
|
121
|
+
await this.record(value);
|
|
122
|
+
await this.record(this.saved);
|
|
123
|
+
this.saved = undefined;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
else
|
|
127
|
+
await this.record(value);
|
|
128
|
+
}
|
|
129
|
+
if (this.used) {
|
|
130
|
+
await this.emit(this.buffer.subarray(0, this.used));
|
|
131
|
+
this.used = 0;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
async finish() {
|
|
135
|
+
if (this.saved !== undefined) {
|
|
136
|
+
await this.record(this.saved);
|
|
137
|
+
this.saved = undefined;
|
|
138
|
+
}
|
|
139
|
+
if (this.plan.convert.has("block") && this.column > 0) {
|
|
140
|
+
while (this.column < Number(this.plan.cbs)) {
|
|
141
|
+
await this.output(this.space);
|
|
142
|
+
this.column++;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (this.plan.convert.has("unblock") && this.column)
|
|
146
|
+
await this.output(this.newline);
|
|
147
|
+
if (this.used) {
|
|
148
|
+
await this.emit(this.buffer.subarray(0, this.used));
|
|
149
|
+
this.used = 0;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CommandDefinition } from "@poe-platform/safe-bash/contracts/command";
|
|
2
|
+
import type { VirtualShellPlugin } from "@poe-platform/safe-bash/contracts/plugin";
|
|
3
|
+
import { type DdFileOpener } from "./io.js";
|
|
4
|
+
export { openDdFile } from "./io.js";
|
|
5
|
+
export type { DdFileHandle, DdFileOpener, DdFileRequest } from "./io.js";
|
|
6
|
+
export interface DdCommandsOptions {
|
|
7
|
+
readonly replace?: boolean | undefined;
|
|
8
|
+
readonly maxBlockBytes?: number | undefined;
|
|
9
|
+
readonly maxBufferBytes?: number | undefined;
|
|
10
|
+
readonly maxTransferBytes?: number | undefined;
|
|
11
|
+
readonly maxReadOperations?: number | undefined;
|
|
12
|
+
readonly maxArgumentBytes?: number | undefined;
|
|
13
|
+
readonly now?: (() => number) | undefined;
|
|
14
|
+
readonly openFile?: DdFileOpener | undefined;
|
|
15
|
+
}
|
|
16
|
+
export declare function createDdCommand(options?: DdCommandsOptions): CommandDefinition;
|
|
17
|
+
export declare function createDdCommands(options?: DdCommandsOptions): readonly CommandDefinition[];
|
|
18
|
+
export declare function ddCommands(options?: DdCommandsOptions): VirtualShellPlugin;
|