@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
|
@@ -0,0 +1,621 @@
|
|
|
1
|
+
import { MikeError } from "./native-work.js";
|
|
2
|
+
export async function loadYaml() {
|
|
3
|
+
try {
|
|
4
|
+
return await import("yaml");
|
|
5
|
+
}
|
|
6
|
+
catch {
|
|
7
|
+
throw new MikeError("the optional yaml@2.9.0 peer is required for this yq profile");
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export function scalar(yaml, work, value) {
|
|
11
|
+
work.node();
|
|
12
|
+
if (typeof value === "string" && Buffer.byteLength(value) > work.limits.maxScalarBytes)
|
|
13
|
+
throw new MikeError("yq limit exceeded: maxScalarBytes");
|
|
14
|
+
return new yaml.Scalar(value);
|
|
15
|
+
}
|
|
16
|
+
export function root(document) { return { node: document.doc.contents, document, isDocumentRoot: true }; }
|
|
17
|
+
export function nodeTag(node, yaml) {
|
|
18
|
+
if (node.tag)
|
|
19
|
+
return node.tag.replace("tag:yaml.org,2002:", "!!");
|
|
20
|
+
if (yaml.isMap(node))
|
|
21
|
+
return "!!map";
|
|
22
|
+
if (yaml.isSeq(node))
|
|
23
|
+
return "!!seq";
|
|
24
|
+
if (yaml.isAlias(node))
|
|
25
|
+
return "";
|
|
26
|
+
const value = node.value;
|
|
27
|
+
if (value === null || value === undefined)
|
|
28
|
+
return "!!null";
|
|
29
|
+
if (typeof value === "boolean")
|
|
30
|
+
return "!!bool";
|
|
31
|
+
if (typeof value === "bigint" || typeof value === "number" && Number.isInteger(value))
|
|
32
|
+
return "!!int";
|
|
33
|
+
if (typeof value === "number")
|
|
34
|
+
return "!!float";
|
|
35
|
+
return "!!str";
|
|
36
|
+
}
|
|
37
|
+
export function truth(node, yaml) {
|
|
38
|
+
return !yaml.isScalar(node) || node.value !== null && node.value !== undefined && node.value !== false;
|
|
39
|
+
}
|
|
40
|
+
export function dereference(candidate, yaml, work) {
|
|
41
|
+
let node = candidate.node;
|
|
42
|
+
const seen = new Set();
|
|
43
|
+
while (yaml.isAlias(node)) {
|
|
44
|
+
work.alias();
|
|
45
|
+
if (seen.has(node))
|
|
46
|
+
throw new MikeError("cyclic YAML alias");
|
|
47
|
+
seen.add(node);
|
|
48
|
+
const resolved = node.resolve(candidate.document.doc);
|
|
49
|
+
if (!resolved)
|
|
50
|
+
throw new MikeError(`unknown anchor '${node.source}' referenced`);
|
|
51
|
+
node = resolved;
|
|
52
|
+
}
|
|
53
|
+
return node === candidate.node ? candidate : { node, document: candidate.document };
|
|
54
|
+
}
|
|
55
|
+
export async function inspectNode(node, yaml, work, allocate = false) {
|
|
56
|
+
const pending = [{ node, depth: 0 }];
|
|
57
|
+
let count = 0;
|
|
58
|
+
while (pending.length) {
|
|
59
|
+
const current = pending.pop();
|
|
60
|
+
work.depth(current.depth);
|
|
61
|
+
if (++count > work.limits.maxParserNodes)
|
|
62
|
+
throw new MikeError("yq limit exceeded: maxParserNodes");
|
|
63
|
+
await work.tick();
|
|
64
|
+
if (allocate)
|
|
65
|
+
work.node();
|
|
66
|
+
if (yaml.isScalar(current.node)) {
|
|
67
|
+
if (typeof current.node.value === "string" && Buffer.byteLength(current.node.value) > work.limits.maxScalarBytes)
|
|
68
|
+
throw new MikeError("yq limit exceeded: maxScalarBytes");
|
|
69
|
+
}
|
|
70
|
+
else if (yaml.isMap(current.node)) {
|
|
71
|
+
for (const pair of current.node.items) {
|
|
72
|
+
if (yaml.isNode(pair.key))
|
|
73
|
+
pending.push({ node: pair.key, depth: current.depth + 1 });
|
|
74
|
+
if (yaml.isNode(pair.value))
|
|
75
|
+
pending.push({ node: pair.value, depth: current.depth + 1 });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else if (yaml.isSeq(current.node)) {
|
|
79
|
+
for (const child of current.node.items)
|
|
80
|
+
if (yaml.isNode(child))
|
|
81
|
+
pending.push({ node: child, depth: current.depth + 1 });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
export async function cloneNode(node, yaml, work) {
|
|
86
|
+
await inspectNode(node, yaml, work, true);
|
|
87
|
+
work.assertOpen();
|
|
88
|
+
const cloned = node.clone();
|
|
89
|
+
const pending = [{ original: node, cloned }];
|
|
90
|
+
while (pending.length) {
|
|
91
|
+
const current = pending.pop();
|
|
92
|
+
await work.tick();
|
|
93
|
+
if (work.implicitTags.has(current.original))
|
|
94
|
+
work.implicitTags.add(current.cloned);
|
|
95
|
+
if (yaml.isMap(current.original) && yaml.isMap(current.cloned))
|
|
96
|
+
for (let index = 0; index < current.original.items.length; index++) {
|
|
97
|
+
const original = current.original.items[index];
|
|
98
|
+
const copy = current.cloned.items[index];
|
|
99
|
+
if (yaml.isNode(original.key) && yaml.isNode(copy.key))
|
|
100
|
+
pending.push({ original: original.key, cloned: copy.key });
|
|
101
|
+
if (yaml.isNode(original.value) && yaml.isNode(copy.value))
|
|
102
|
+
pending.push({ original: original.value, cloned: copy.value });
|
|
103
|
+
}
|
|
104
|
+
else if (yaml.isSeq(current.original) && yaml.isSeq(current.cloned))
|
|
105
|
+
for (let index = 0; index < current.original.items.length; index++) {
|
|
106
|
+
const original = current.original.items[index];
|
|
107
|
+
const copy = current.cloned.items[index];
|
|
108
|
+
if (yaml.isNode(original) && yaml.isNode(copy))
|
|
109
|
+
pending.push({ original, cloned: copy });
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return cloned;
|
|
113
|
+
}
|
|
114
|
+
export async function replace(candidate, incoming, yaml, work, clobber = false) {
|
|
115
|
+
const node = await cloneNode(incoming, yaml, work);
|
|
116
|
+
const previous = candidate.node;
|
|
117
|
+
if (previous.comment !== undefined)
|
|
118
|
+
node.comment = previous.comment;
|
|
119
|
+
if (previous.commentBefore !== undefined)
|
|
120
|
+
node.commentBefore = previous.commentBefore;
|
|
121
|
+
if (previous.spaceBefore !== undefined)
|
|
122
|
+
node.spaceBefore = previous.spaceBefore;
|
|
123
|
+
if ("anchor" in previous && "anchor" in node)
|
|
124
|
+
node.anchor = previous.anchor;
|
|
125
|
+
if (!clobber && previous.tag && (!previous.tag.startsWith("tag:yaml.org,2002:") || nodeTag(node, yaml) === nodeTag(previous, yaml))) {
|
|
126
|
+
node.tag = previous.tag;
|
|
127
|
+
if (work.implicitTags.has(previous))
|
|
128
|
+
work.implicitTags.add(node);
|
|
129
|
+
}
|
|
130
|
+
if (yaml.isScalar(node) && yaml.isScalar(previous) && previous.type !== undefined)
|
|
131
|
+
node.type = previous.type;
|
|
132
|
+
if (candidate.parent) {
|
|
133
|
+
if (yaml.isMap(candidate.parent))
|
|
134
|
+
candidate.parent.items[candidate.slot].value = node;
|
|
135
|
+
else
|
|
136
|
+
candidate.parent.items[candidate.slot] = node;
|
|
137
|
+
}
|
|
138
|
+
else if (candidate.isDocumentRoot)
|
|
139
|
+
candidate.document.doc.contents = node;
|
|
140
|
+
candidate.node = node;
|
|
141
|
+
}
|
|
142
|
+
async function admitCst(token, work) {
|
|
143
|
+
const pending = [{ value: token, depth: 0 }];
|
|
144
|
+
let nodes = 0;
|
|
145
|
+
let composed = 0;
|
|
146
|
+
let bytes = 0;
|
|
147
|
+
while (pending.length) {
|
|
148
|
+
const { value, depth } = pending.pop();
|
|
149
|
+
if (!value || typeof value !== "object")
|
|
150
|
+
continue;
|
|
151
|
+
await work.tick();
|
|
152
|
+
if (Array.isArray(value)) {
|
|
153
|
+
for (const child of value)
|
|
154
|
+
pending.push({ value: child, depth });
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
const item = value;
|
|
158
|
+
const collection = item.type === "block-map" || item.type === "block-seq" || item.type === "flow-collection";
|
|
159
|
+
if (collection || ["alias", "scalar", "single-quoted-scalar", "double-quoted-scalar", "block-scalar"].includes(String(item.type))) {
|
|
160
|
+
if (++composed > work.limits.maxParserNodes)
|
|
161
|
+
throw new MikeError("yq limit exceeded: maxParserNodes");
|
|
162
|
+
work.node();
|
|
163
|
+
}
|
|
164
|
+
work.depth(depth);
|
|
165
|
+
if (item.type && ++nodes > work.limits.maxParserNodes * 8)
|
|
166
|
+
throw new MikeError("yq limit exceeded: maxParserNodes");
|
|
167
|
+
if (typeof item.source === "string") {
|
|
168
|
+
bytes += Buffer.byteLength(item.source);
|
|
169
|
+
if (bytes > work.limits.maxDocumentBytes)
|
|
170
|
+
throw new MikeError("yq limit exceeded: maxDocumentBytes");
|
|
171
|
+
if (item.source.length > work.limits.maxScalarBytes)
|
|
172
|
+
throw new MikeError("yq limit exceeded: maxScalarBytes");
|
|
173
|
+
}
|
|
174
|
+
for (const child of Object.values(item))
|
|
175
|
+
if (child && typeof child === "object")
|
|
176
|
+
pending.push({ value: child, depth: depth + (collection ? 1 : 0) });
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
async function decodeJsonDocument(source, filename, yaml, work) {
|
|
180
|
+
let offset = 0;
|
|
181
|
+
let nodes = 0;
|
|
182
|
+
const admit = () => {
|
|
183
|
+
if (++nodes > work.limits.maxParserNodes)
|
|
184
|
+
throw new MikeError("yq limit exceeded: maxParserNodes");
|
|
185
|
+
work.node();
|
|
186
|
+
};
|
|
187
|
+
const fail = (context) => { throw new MikeError(`bad file '${filename}': ${context ? `json: ${context} unexpected end of JSON input` : "invalid JSON input"}`); };
|
|
188
|
+
const skip = async () => { while (offset < source.length && " \t\r\n".includes(source[offset])) {
|
|
189
|
+
offset++;
|
|
190
|
+
await work.tick();
|
|
191
|
+
} };
|
|
192
|
+
const string = async () => {
|
|
193
|
+
const start = offset++;
|
|
194
|
+
let escaped = false;
|
|
195
|
+
while (offset < source.length) {
|
|
196
|
+
await work.tick();
|
|
197
|
+
const character = source[offset++];
|
|
198
|
+
if (!escaped && character === '"') {
|
|
199
|
+
let value;
|
|
200
|
+
try {
|
|
201
|
+
value = JSON.parse(source.slice(start, offset));
|
|
202
|
+
}
|
|
203
|
+
catch {
|
|
204
|
+
return fail();
|
|
205
|
+
}
|
|
206
|
+
if (Buffer.byteLength(value) > work.limits.maxScalarBytes)
|
|
207
|
+
throw new MikeError("yq limit exceeded: maxScalarBytes");
|
|
208
|
+
return Buffer.from(value).toString("utf8");
|
|
209
|
+
}
|
|
210
|
+
if (!escaped && character === "\\")
|
|
211
|
+
escaped = true;
|
|
212
|
+
else
|
|
213
|
+
escaped = false;
|
|
214
|
+
}
|
|
215
|
+
return fail();
|
|
216
|
+
};
|
|
217
|
+
const parse = async (depth, context = "null") => {
|
|
218
|
+
await skip();
|
|
219
|
+
await work.tick();
|
|
220
|
+
work.depth(depth);
|
|
221
|
+
const character = source[offset];
|
|
222
|
+
if (character === undefined)
|
|
223
|
+
return fail(context === "value of object" ? "object of object" : context);
|
|
224
|
+
admit();
|
|
225
|
+
if (character === "{") {
|
|
226
|
+
offset++;
|
|
227
|
+
const node = new yaml.YAMLMap();
|
|
228
|
+
await skip();
|
|
229
|
+
if (source[offset] === "}") {
|
|
230
|
+
offset++;
|
|
231
|
+
return node;
|
|
232
|
+
}
|
|
233
|
+
for (;;) {
|
|
234
|
+
if (source[offset] !== '"')
|
|
235
|
+
return fail();
|
|
236
|
+
admit();
|
|
237
|
+
const key = new yaml.Scalar(await string());
|
|
238
|
+
await skip();
|
|
239
|
+
if (source[offset++] !== ":")
|
|
240
|
+
return fail();
|
|
241
|
+
const value = await parse(depth + 1, "value of object");
|
|
242
|
+
node.items.push(new yaml.Pair(key, value));
|
|
243
|
+
await skip();
|
|
244
|
+
if (source[offset] === "}") {
|
|
245
|
+
offset++;
|
|
246
|
+
return node;
|
|
247
|
+
}
|
|
248
|
+
if (source[offset] === '"')
|
|
249
|
+
continue;
|
|
250
|
+
if (source[offset++] !== ",")
|
|
251
|
+
return fail("object of object");
|
|
252
|
+
await skip();
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
if (character === "[") {
|
|
256
|
+
offset++;
|
|
257
|
+
const node = new yaml.YAMLSeq();
|
|
258
|
+
await skip();
|
|
259
|
+
if (source[offset] === "]") {
|
|
260
|
+
offset++;
|
|
261
|
+
return node;
|
|
262
|
+
}
|
|
263
|
+
for (;;) {
|
|
264
|
+
node.items.push(await parse(depth + 1));
|
|
265
|
+
await skip();
|
|
266
|
+
if (source[offset] === "]") {
|
|
267
|
+
offset++;
|
|
268
|
+
return node;
|
|
269
|
+
}
|
|
270
|
+
if (source[offset++] !== ",")
|
|
271
|
+
return fail();
|
|
272
|
+
await skip();
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
if (character === '"')
|
|
276
|
+
return new yaml.Scalar(await string());
|
|
277
|
+
if (character === "}" || character === "]" || character === ",")
|
|
278
|
+
return fail(context);
|
|
279
|
+
const start = offset;
|
|
280
|
+
while (offset < source.length && !' \t\r\n,]}"'.includes(source[offset])) {
|
|
281
|
+
offset++;
|
|
282
|
+
await work.tick();
|
|
283
|
+
}
|
|
284
|
+
let value;
|
|
285
|
+
try {
|
|
286
|
+
value = JSON.parse(source.slice(start, offset));
|
|
287
|
+
}
|
|
288
|
+
catch {
|
|
289
|
+
return fail();
|
|
290
|
+
}
|
|
291
|
+
if (value !== null && typeof value !== "number" && typeof value !== "boolean")
|
|
292
|
+
return fail();
|
|
293
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
294
|
+
if (Number.isInteger(value)) {
|
|
295
|
+
const integer = BigInt(value);
|
|
296
|
+
const clamped = integer < -(1n << 63n) ? -(1n << 63n) : integer >= 1n << 63n ? (1n << 63n) - 1n : integer;
|
|
297
|
+
if (Number(clamped) === value)
|
|
298
|
+
return new yaml.Scalar(clamped);
|
|
299
|
+
}
|
|
300
|
+
const node = new yaml.Scalar(value);
|
|
301
|
+
const magnitude = Math.abs(value);
|
|
302
|
+
node.source = (magnitude < 0.0001 || magnitude >= 1_000_000 ? value.toExponential() : String(value)).replace(/e([+-])([0-9])$/u, "e$10$2");
|
|
303
|
+
node.tag = "tag:yaml.org,2002:float";
|
|
304
|
+
work.implicitTags.add(node);
|
|
305
|
+
return node;
|
|
306
|
+
}
|
|
307
|
+
return new yaml.Scalar(value);
|
|
308
|
+
};
|
|
309
|
+
const contents = await parse(0);
|
|
310
|
+
await skip();
|
|
311
|
+
if (offset !== source.length)
|
|
312
|
+
fail();
|
|
313
|
+
const doc = new yaml.Document();
|
|
314
|
+
doc.contents = contents;
|
|
315
|
+
return doc;
|
|
316
|
+
}
|
|
317
|
+
async function adaptQuotedIndent(text, filename, yaml, work) {
|
|
318
|
+
const additions = [];
|
|
319
|
+
const failures = new Map();
|
|
320
|
+
let size = Buffer.byteLength(text);
|
|
321
|
+
let sourceOffset = 0;
|
|
322
|
+
let quotedUntil = 0;
|
|
323
|
+
const lexer = new yaml.Lexer();
|
|
324
|
+
const closeQuote = async (start, limit) => {
|
|
325
|
+
const quote = text[start];
|
|
326
|
+
let escaped = false;
|
|
327
|
+
for (let index = start + 1; index < limit; index++) {
|
|
328
|
+
await work.tick();
|
|
329
|
+
if (index - start > work.limits.maxScalarBytes)
|
|
330
|
+
throw new MikeError("yq limit exceeded: maxScalarBytes");
|
|
331
|
+
const character = text[index];
|
|
332
|
+
if (character === "\n") {
|
|
333
|
+
const marker = text.slice(index + 1, index + 4);
|
|
334
|
+
const after = text[index + 4];
|
|
335
|
+
if ((marker === "---" || marker === "...") && (after === undefined || " \t\r\n".includes(after))) {
|
|
336
|
+
const line = text.slice(0, start).split("\n").length;
|
|
337
|
+
const column = start - text.lastIndexOf("\n", start);
|
|
338
|
+
const markerLine = text.slice(0, index + 1).split("\n").length;
|
|
339
|
+
if (!failures.has(start))
|
|
340
|
+
work.node();
|
|
341
|
+
failures.set(start, `bad file '${filename}': yaml: while scanning a quoted scalar at line ${line}, column ${column}: line ${markerLine}: found unexpected document indicator`);
|
|
342
|
+
return -1;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
if (quote === '"') {
|
|
346
|
+
if (!escaped && character === '"')
|
|
347
|
+
return index + 1;
|
|
348
|
+
if (!escaped && character === "\\")
|
|
349
|
+
escaped = true;
|
|
350
|
+
else
|
|
351
|
+
escaped = false;
|
|
352
|
+
}
|
|
353
|
+
else if (character === "'") {
|
|
354
|
+
if (text[index + 1] === "'")
|
|
355
|
+
index++;
|
|
356
|
+
else
|
|
357
|
+
return index + 1;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
return -1;
|
|
361
|
+
};
|
|
362
|
+
scan: for (let offset = 0; offset <= text.length; offset += 4096) {
|
|
363
|
+
const incomplete = offset + 4096 < text.length;
|
|
364
|
+
await work.tick(Math.min(4096, text.length - offset) + 1);
|
|
365
|
+
for (const lexeme of lexer.lex(text.slice(offset, offset + 4096), incomplete)) {
|
|
366
|
+
await work.tick();
|
|
367
|
+
if (lexeme === yaml.CST.DOCUMENT || lexeme === yaml.CST.FLOW_END || lexeme === yaml.CST.SCALAR)
|
|
368
|
+
continue;
|
|
369
|
+
const start = sourceOffset;
|
|
370
|
+
sourceOffset += lexeme.length;
|
|
371
|
+
if (start < quotedUntil || lexeme[0] !== '"' && lexeme[0] !== "'")
|
|
372
|
+
continue;
|
|
373
|
+
const closed = await closeQuote(start, sourceOffset);
|
|
374
|
+
if (failures.size)
|
|
375
|
+
break scan;
|
|
376
|
+
if (closed >= 0)
|
|
377
|
+
continue;
|
|
378
|
+
const end = await closeQuote(start, text.length);
|
|
379
|
+
if (failures.size)
|
|
380
|
+
break scan;
|
|
381
|
+
if (end < 0)
|
|
382
|
+
continue;
|
|
383
|
+
quotedUntil = end;
|
|
384
|
+
const lineStart = text.lastIndexOf("\n", start) + 1;
|
|
385
|
+
let indentation = 0;
|
|
386
|
+
while (text[lineStart + indentation] === " ") {
|
|
387
|
+
indentation++;
|
|
388
|
+
await work.tick();
|
|
389
|
+
}
|
|
390
|
+
for (let index = start; index < end; index++) {
|
|
391
|
+
await work.tick();
|
|
392
|
+
if (text[index] !== "\n")
|
|
393
|
+
continue;
|
|
394
|
+
let spaces = 0;
|
|
395
|
+
while (text[index + 1 + spaces] === " ") {
|
|
396
|
+
spaces++;
|
|
397
|
+
await work.tick();
|
|
398
|
+
}
|
|
399
|
+
if (spaces > indentation)
|
|
400
|
+
continue;
|
|
401
|
+
const length = indentation + 1 - spaces;
|
|
402
|
+
if (length > work.limits.maxInputBytes - size)
|
|
403
|
+
throw new MikeError("yq limit exceeded: maxInputBytes");
|
|
404
|
+
work.node(3);
|
|
405
|
+
additions.push({ offset: index + 1, length });
|
|
406
|
+
size += length;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
if (!incomplete)
|
|
410
|
+
break;
|
|
411
|
+
}
|
|
412
|
+
if (!additions.length)
|
|
413
|
+
return { text, insertions: [], failures };
|
|
414
|
+
const chunks = [];
|
|
415
|
+
const insertions = [];
|
|
416
|
+
let copied = 0;
|
|
417
|
+
let inserted = 0;
|
|
418
|
+
for (const addition of additions) {
|
|
419
|
+
await work.tick(addition.length + 1);
|
|
420
|
+
chunks.push(text.slice(copied, addition.offset), " ".repeat(addition.length));
|
|
421
|
+
insertions.push({ offset: addition.offset + inserted, length: addition.length });
|
|
422
|
+
copied = addition.offset;
|
|
423
|
+
inserted += addition.length;
|
|
424
|
+
}
|
|
425
|
+
chunks.push(text.slice(copied));
|
|
426
|
+
return { text: chunks.join(""), insertions, failures };
|
|
427
|
+
}
|
|
428
|
+
export async function decodeDocuments(text, filename, fileIndex, format, yaml, work, onDocument) {
|
|
429
|
+
const documents = [];
|
|
430
|
+
const originalText = text;
|
|
431
|
+
let insertions = [];
|
|
432
|
+
let quotedFailures = new Map();
|
|
433
|
+
const originalOffset = (offset) => {
|
|
434
|
+
let added = 0;
|
|
435
|
+
for (const insertion of insertions) {
|
|
436
|
+
if (insertion.offset >= offset)
|
|
437
|
+
break;
|
|
438
|
+
added += Math.min(insertion.length, offset - insertion.offset);
|
|
439
|
+
}
|
|
440
|
+
return offset - added;
|
|
441
|
+
};
|
|
442
|
+
const position = (offset) => {
|
|
443
|
+
const index = originalOffset(offset);
|
|
444
|
+
const prefix = originalText.slice(0, index);
|
|
445
|
+
return { line: prefix.split("\n").length, column: index - prefix.lastIndexOf("\n") };
|
|
446
|
+
};
|
|
447
|
+
const accept = async (doc) => {
|
|
448
|
+
work.assertOpen();
|
|
449
|
+
const startOffset = originalOffset(doc.range?.[0] ?? 0);
|
|
450
|
+
const endOffset = originalOffset(doc.range?.[2] ?? text.length);
|
|
451
|
+
for (const [offset, failure] of quotedFailures)
|
|
452
|
+
if (offset >= startOffset && offset < endOffset)
|
|
453
|
+
throw new MikeError(failure);
|
|
454
|
+
const error = doc.errors.find(error => !(error.code === "MISSING_CHAR" && error.message === "Comments must be separated from other tokens by white space characters"));
|
|
455
|
+
if (error) {
|
|
456
|
+
let message = error.message;
|
|
457
|
+
const start = position(doc.contents?.range?.[0] ?? doc.range?.[0] ?? 0);
|
|
458
|
+
if (message.startsWith("Flow sequence") && message.includes("end with a ]"))
|
|
459
|
+
message = `while parsing a flow node at line ${start.line}: did not find expected node content`;
|
|
460
|
+
else if (message.startsWith("Missing closing") && message.includes("quote")) {
|
|
461
|
+
const end = position(error.pos[0]);
|
|
462
|
+
message = `while scanning a quoted scalar at line ${start.line}: line ${end.line}, column ${end.column}: found unexpected end of stream`;
|
|
463
|
+
}
|
|
464
|
+
else if (message === "Missing , or : between flow sequence items")
|
|
465
|
+
message = `while parsing a flow sequence at <unknown position>: line ${start.line}: did not find expected ',' or ']'`;
|
|
466
|
+
else if (error.code === "MULTILINE_IMPLICIT_KEY") {
|
|
467
|
+
let colon = error.pos[1];
|
|
468
|
+
while (text[colon] === " " || text[colon] === "\t") {
|
|
469
|
+
colon++;
|
|
470
|
+
await work.tick();
|
|
471
|
+
}
|
|
472
|
+
const location = position(colon);
|
|
473
|
+
message = `line ${location.line}, column ${location.column}: mapping values are not allowed in this context`;
|
|
474
|
+
}
|
|
475
|
+
throw new MikeError(`bad file '${filename}': yaml: ${message}`);
|
|
476
|
+
}
|
|
477
|
+
work.document();
|
|
478
|
+
if (!doc.contents) {
|
|
479
|
+
const empty = new yaml.Scalar(null);
|
|
480
|
+
empty.source = "";
|
|
481
|
+
work.node();
|
|
482
|
+
doc.contents = empty;
|
|
483
|
+
}
|
|
484
|
+
await inspectNode(doc.contents, yaml, work, true);
|
|
485
|
+
const anchors = new Set();
|
|
486
|
+
const pending = [doc.contents];
|
|
487
|
+
while (pending.length) {
|
|
488
|
+
await work.tick();
|
|
489
|
+
const node = pending.pop();
|
|
490
|
+
if ("anchor" in node && node.anchor)
|
|
491
|
+
anchors.add(node.anchor);
|
|
492
|
+
if (yaml.isAlias(node)) {
|
|
493
|
+
work.alias();
|
|
494
|
+
if (!anchors.has(node.source)) {
|
|
495
|
+
const location = position((node.range?.[0] ?? 0) + 1);
|
|
496
|
+
throw new MikeError(`bad file '${filename}': yaml: line ${location.line}, column ${location.column}: unknown anchor '${node.source}' referenced`);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
else if (yaml.isMap(node)) {
|
|
500
|
+
for (let index = node.items.length - 1; index >= 0; index--) {
|
|
501
|
+
const pair = node.items[index];
|
|
502
|
+
if (yaml.isNode(pair.value))
|
|
503
|
+
pending.push(pair.value);
|
|
504
|
+
if (yaml.isNode(pair.key))
|
|
505
|
+
pending.push(pair.key);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
else if (yaml.isSeq(node))
|
|
509
|
+
for (let index = node.items.length - 1; index >= 0; index--)
|
|
510
|
+
if (yaml.isNode(node.items[index]))
|
|
511
|
+
pending.push(node.items[index]);
|
|
512
|
+
}
|
|
513
|
+
const document = { doc, filename, fileIndex, documentIndex: documents.length, format };
|
|
514
|
+
documents.push(document);
|
|
515
|
+
await onDocument?.(document);
|
|
516
|
+
};
|
|
517
|
+
if (format === "json") {
|
|
518
|
+
let start = 0;
|
|
519
|
+
let depth = 0;
|
|
520
|
+
let quoted = false;
|
|
521
|
+
let escaped = false;
|
|
522
|
+
let tokens = 0;
|
|
523
|
+
const acceptJson = async (end) => {
|
|
524
|
+
const source = text.slice(start, end).trim();
|
|
525
|
+
start = end;
|
|
526
|
+
if (!source)
|
|
527
|
+
return;
|
|
528
|
+
if (Buffer.byteLength(source) > work.limits.maxDocumentBytes)
|
|
529
|
+
throw new MikeError("yq limit exceeded: maxDocumentBytes");
|
|
530
|
+
const doc = await decodeJsonDocument(source, filename, yaml, work);
|
|
531
|
+
await accept(doc);
|
|
532
|
+
};
|
|
533
|
+
for (let index = 0; index < text.length; index++) {
|
|
534
|
+
if ((index & 255) === 0)
|
|
535
|
+
await work.tick(256);
|
|
536
|
+
const character = text[index];
|
|
537
|
+
if (quoted) {
|
|
538
|
+
if (escaped)
|
|
539
|
+
escaped = false;
|
|
540
|
+
else if (character === "\\")
|
|
541
|
+
escaped = true;
|
|
542
|
+
else if (character === '"') {
|
|
543
|
+
quoted = false;
|
|
544
|
+
if (depth === 0)
|
|
545
|
+
await acceptJson(index + 1);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
else if (character === '"')
|
|
549
|
+
quoted = true;
|
|
550
|
+
else if (character === "{" || character === "[") {
|
|
551
|
+
depth++;
|
|
552
|
+
work.depth(depth);
|
|
553
|
+
}
|
|
554
|
+
else if (character === "}" || character === "]") {
|
|
555
|
+
depth--;
|
|
556
|
+
if (depth === 0) {
|
|
557
|
+
await acceptJson(index + 1);
|
|
558
|
+
tokens = 0;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
else if (/\s/u.test(character) && depth === 0)
|
|
562
|
+
await acceptJson(index + 1);
|
|
563
|
+
if (!quoted && ",:{}[]".includes(character) && ++tokens > work.limits.maxParserNodes)
|
|
564
|
+
throw new MikeError("yq limit exceeded: maxParserNodes");
|
|
565
|
+
}
|
|
566
|
+
await acceptJson(text.length);
|
|
567
|
+
return documents;
|
|
568
|
+
}
|
|
569
|
+
const admitText = async (input) => {
|
|
570
|
+
let documentBytes = 0;
|
|
571
|
+
for (let offset = 0; offset < input.length;) {
|
|
572
|
+
const newline = input.indexOf("\n", offset);
|
|
573
|
+
const end = newline < 0 ? input.length : newline + 1;
|
|
574
|
+
if (end - offset > work.limits.maxScalarBytes)
|
|
575
|
+
throw new MikeError("yq limit exceeded: maxScalarBytes");
|
|
576
|
+
const line = input.slice(offset, end);
|
|
577
|
+
if (/^(?:---|\.\.\.)(?:[ \t\r\n]|$)/u.test(line))
|
|
578
|
+
documentBytes = 0;
|
|
579
|
+
documentBytes += Buffer.byteLength(line);
|
|
580
|
+
if (documentBytes > work.limits.maxDocumentBytes)
|
|
581
|
+
throw new MikeError("yq limit exceeded: maxDocumentBytes");
|
|
582
|
+
await work.tick(line.length + 1);
|
|
583
|
+
offset = end;
|
|
584
|
+
}
|
|
585
|
+
};
|
|
586
|
+
await admitText(text);
|
|
587
|
+
const adapted = await adaptQuotedIndent(text, filename, yaml, work);
|
|
588
|
+
quotedFailures = adapted.failures;
|
|
589
|
+
if (adapted.text !== text) {
|
|
590
|
+
await admitText(adapted.text);
|
|
591
|
+
text = adapted.text;
|
|
592
|
+
insertions = adapted.insertions;
|
|
593
|
+
}
|
|
594
|
+
const lexer = new yaml.Lexer();
|
|
595
|
+
const parser = new yaml.Parser();
|
|
596
|
+
const composer = new yaml.Composer({ keepSourceTokens: true, intAsBigInt: true, uniqueKeys: false, merge: false, prettyErrors: false, logLevel: "silent" });
|
|
597
|
+
const token = async (item) => {
|
|
598
|
+
await admitCst(item, work);
|
|
599
|
+
for (const doc of composer.next(item))
|
|
600
|
+
await accept(doc);
|
|
601
|
+
};
|
|
602
|
+
for (let offset = 0; offset <= text.length; offset += 4096) {
|
|
603
|
+
await work.tick(Math.min(4096, text.length - offset) + 1);
|
|
604
|
+
const incomplete = offset + 4096 < text.length;
|
|
605
|
+
for (const lexeme of lexer.lex(text.slice(offset, offset + 4096), incomplete)) {
|
|
606
|
+
if (Buffer.byteLength(lexeme) > work.limits.maxScalarBytes)
|
|
607
|
+
throw new MikeError("yq limit exceeded: maxScalarBytes");
|
|
608
|
+
await work.tick();
|
|
609
|
+
work.depth(parser.stack.length);
|
|
610
|
+
for (const item of parser.next(lexeme))
|
|
611
|
+
await token(item);
|
|
612
|
+
}
|
|
613
|
+
if (!incomplete)
|
|
614
|
+
break;
|
|
615
|
+
}
|
|
616
|
+
for (const item of parser.end())
|
|
617
|
+
await token(item);
|
|
618
|
+
for (const doc of composer.end(documents.length === 0, text.length))
|
|
619
|
+
await accept(doc);
|
|
620
|
+
return documents;
|
|
621
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { arraysExtension } from "../shell/extensions/arrays/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { arraysExtension } from "../shell/extensions/arrays/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createCmpCommand, createCmpCommands, cmpCommands } from "../commands/cmp/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createDdCommand, createDdCommands, ddCommands } from "../commands/dd/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createDeviceFileSystem } from "../fs/devices/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createInstallCommand, createInstallCommands, installCommands } from "../commands/install/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { jobsExtension } from "../shell/extensions/jobs/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { jobsExtension } from "../shell/extensions/jobs/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { mapfileExtension } from "../shell/extensions/mapfile/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { mapfileExtension } from "../shell/extensions/mapfile/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { readExtension } from "../shell/extensions/read/index.js";
|