@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
|
@@ -2,21 +2,23 @@ import {
|
|
|
2
2
|
UsageError,
|
|
3
3
|
pathOf,
|
|
4
4
|
writeDiagnostic
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-LA6BX562.js";
|
|
6
6
|
import {
|
|
7
7
|
PublicDiagnostic,
|
|
8
|
-
publicDiagnosticMessage
|
|
8
|
+
publicDiagnosticMessage
|
|
9
|
+
} from "./chunk-3E5M2WEL.js";
|
|
10
|
+
import {
|
|
9
11
|
yieldTurn
|
|
10
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-THXJ6CLF.js";
|
|
11
13
|
import {
|
|
12
14
|
readBytes,
|
|
13
15
|
toByteSource,
|
|
14
16
|
writeBytes
|
|
15
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-WPIOO4NX.js";
|
|
16
18
|
import {
|
|
17
19
|
import_buffer,
|
|
18
20
|
init_platform
|
|
19
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-O2EVBRKF.js";
|
|
20
22
|
|
|
21
23
|
// packages/safe-bash/src/commands/node/browser.ts
|
|
22
24
|
init_platform();
|
|
@@ -97,7 +99,7 @@ init_platform();
|
|
|
97
99
|
// packages/safe-js/dist/browser/safe-fs.js
|
|
98
100
|
init_platform();
|
|
99
101
|
|
|
100
|
-
// packages/safe-js/dist/browser/chunks/chunk-
|
|
102
|
+
// packages/safe-js/dist/browser/chunks/chunk-RILLSV3Z.js
|
|
101
103
|
init_platform();
|
|
102
104
|
var platform = Object.freeze({
|
|
103
105
|
errno(_code) {
|
|
@@ -162,7 +164,7 @@ var descriptions = {
|
|
|
162
164
|
EPERM: "operation not permitted",
|
|
163
165
|
EPIPE: "broken pipe",
|
|
164
166
|
EROFS: "read-only file system",
|
|
165
|
-
ESPIPE: "
|
|
167
|
+
ESPIPE: "illegal seek",
|
|
166
168
|
ETIMEDOUT: "operation timed out",
|
|
167
169
|
EXDEV: "cross-device link not permitted"
|
|
168
170
|
};
|
|
@@ -254,6 +256,193 @@ async function* readBytes2(source, signal) {
|
|
|
254
256
|
}
|
|
255
257
|
}
|
|
256
258
|
}
|
|
259
|
+
function admitCapabilities(path, options, capabilities) {
|
|
260
|
+
if (![capabilities.positionedRead, capabilities.positionedWrite, capabilities.truncate].every((value) => typeof value === "boolean") || capabilities.position !== void 0 && typeof capabilities.position !== "boolean" || capabilities.readObservation !== void 0 && typeof capabilities.readObservation !== "boolean" || capabilities.openTruncate !== void 0 && typeof capabilities.openTruncate !== "boolean" || capabilities.positionedAppendWrite !== void 0 && typeof capabilities.positionedAppendWrite !== "boolean" || capabilities.delegateZeroLengthWrite !== void 0 && typeof capabilities.delegateZeroLengthWrite !== "boolean" || !["none", "volatile", "storage"].includes(capabilities.synchronization)) throw new FsError("EINVAL", { syscall: "open", path });
|
|
261
|
+
if (options.truncate && !(capabilities.openTruncate ?? capabilities.truncate) || options.synchronization !== void 0 && capabilities.synchronization === "none") {
|
|
262
|
+
throw new FsError("ENOTSUP", { syscall: "open", path });
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
function integer(value, syscall, path) {
|
|
266
|
+
if (!Number.isSafeInteger(value) || value < 0) throw new FsError("EINVAL", { syscall, path });
|
|
267
|
+
}
|
|
268
|
+
var ManagedFileDescriptor = class {
|
|
269
|
+
capabilities;
|
|
270
|
+
#path;
|
|
271
|
+
#access;
|
|
272
|
+
#append;
|
|
273
|
+
#getPosition;
|
|
274
|
+
#probeRead;
|
|
275
|
+
#backend;
|
|
276
|
+
#pending = Promise.resolve();
|
|
277
|
+
#closing;
|
|
278
|
+
constructor(path, options, capabilities, backend) {
|
|
279
|
+
this.#path = path;
|
|
280
|
+
this.#access = options.access;
|
|
281
|
+
this.#append = options.append;
|
|
282
|
+
const getPosition = capabilities.position === true ? backend.getPosition : void 0;
|
|
283
|
+
if (capabilities.position === true && typeof getPosition !== "function") throw new FsError("ENOTSUP", { syscall: "getPosition", path });
|
|
284
|
+
this.#getPosition = getPosition?.bind(backend);
|
|
285
|
+
const probeRead = capabilities.readObservation === true ? backend.probeRead : void 0;
|
|
286
|
+
if (capabilities.readObservation === true && typeof probeRead !== "function") throw new FsError("ENOTSUP", { syscall: "probeRead", path });
|
|
287
|
+
this.#probeRead = probeRead?.bind(backend);
|
|
288
|
+
this.#backend = backend;
|
|
289
|
+
const positionedAppendWrite = capabilities.positionedAppendWrite === true && capabilities.positionedWrite && options.access !== "read";
|
|
290
|
+
this.capabilities = Object.freeze({
|
|
291
|
+
...capabilities.position === void 0 ? {} : { position: capabilities.position },
|
|
292
|
+
...capabilities.readObservation === void 0 ? {} : { readObservation: capabilities.readObservation },
|
|
293
|
+
...capabilities.openTruncate === void 0 ? {} : { openTruncate: capabilities.openTruncate },
|
|
294
|
+
positionedRead: capabilities.positionedRead && options.access !== "write",
|
|
295
|
+
positionedWrite: capabilities.positionedWrite && options.access !== "read" && (!options.append || positionedAppendWrite),
|
|
296
|
+
...capabilities.positionedAppendWrite === void 0 ? {} : { positionedAppendWrite },
|
|
297
|
+
...capabilities.delegateZeroLengthWrite === void 0 ? {} : { delegateZeroLengthWrite: capabilities.delegateZeroLengthWrite && options.access !== "read" },
|
|
298
|
+
truncate: capabilities.truncate && options.access !== "read",
|
|
299
|
+
synchronization: capabilities.synchronization
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
#run(syscall, options, action) {
|
|
303
|
+
const signal = options.signal;
|
|
304
|
+
try {
|
|
305
|
+
signal?.throwIfAborted();
|
|
306
|
+
if (this.#closing || !this.#backend) throw new FsError("EBADF", { syscall, path: this.#path });
|
|
307
|
+
} catch (error) {
|
|
308
|
+
return Promise.reject(error);
|
|
309
|
+
}
|
|
310
|
+
const forwarded = signal === void 0 ? {} : { signal };
|
|
311
|
+
const operation = this.#pending.then(async () => {
|
|
312
|
+
signal?.throwIfAborted();
|
|
313
|
+
try {
|
|
314
|
+
const result = await action(this.#backend, forwarded);
|
|
315
|
+
signal?.throwIfAborted();
|
|
316
|
+
return result;
|
|
317
|
+
} catch (error) {
|
|
318
|
+
signal?.throwIfAborted();
|
|
319
|
+
throw error;
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
this.#pending = operation.then(() => {
|
|
323
|
+
}, () => {
|
|
324
|
+
});
|
|
325
|
+
return operation;
|
|
326
|
+
}
|
|
327
|
+
#position(buffer, position, syscall) {
|
|
328
|
+
if (!(buffer instanceof Uint8Array)) throw new FsError("EINVAL", { syscall, path: this.#path });
|
|
329
|
+
if (position !== null) {
|
|
330
|
+
integer(position, syscall, this.#path);
|
|
331
|
+
if (syscall === "write" && this.#append && this.capabilities.positionedAppendWrite !== true) throw new FsError("EINVAL", { syscall, path: this.#path });
|
|
332
|
+
if (!(syscall === "read" ? this.capabilities.positionedRead : this.capabilities.positionedWrite)) {
|
|
333
|
+
throw new FsError("ESPIPE", { syscall, path: this.#path });
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
stat(options = {}) {
|
|
338
|
+
return this.#run("fstat", options, (backend, forwarded) => backend.stat(backend.resource, forwarded));
|
|
339
|
+
}
|
|
340
|
+
getPosition(options = {}) {
|
|
341
|
+
return this.#run("getPosition", options, async (backend, forwarded) => {
|
|
342
|
+
if (!this.capabilities.position || !this.#getPosition) throw new FsError("ENOTSUP", { syscall: "getPosition", path: this.#path });
|
|
343
|
+
const position = await this.#getPosition(backend.resource, forwarded);
|
|
344
|
+
if (!Number.isSafeInteger(position) || position < 0) throw new FsError("EIO", { syscall: "getPosition", path: this.#path });
|
|
345
|
+
return position;
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
probeRead(options = {}) {
|
|
349
|
+
return this.#run("probeRead", options, async (backend, forwarded) => {
|
|
350
|
+
if (!this.capabilities.readObservation || !this.#probeRead) throw new FsError("ENOTSUP", { syscall: "probeRead", path: this.#path });
|
|
351
|
+
const readiness = await this.#probeRead(backend.resource, forwarded);
|
|
352
|
+
if (readiness !== "ready" && readiness !== "blocked" && readiness !== "unknown") throw new FsError("EIO", { syscall: "probeRead", path: this.#path });
|
|
353
|
+
return readiness;
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
read(buffer, position, options = {}) {
|
|
357
|
+
return this.#run("read", options, async (backend, forwarded) => {
|
|
358
|
+
if (this.#access === "write") throw new FsError("EBADF", { syscall: "read", path: this.#path });
|
|
359
|
+
this.#position(buffer, position, "read");
|
|
360
|
+
if (buffer.byteLength === 0) return 0;
|
|
361
|
+
const count = await backend.read(backend.resource, buffer, position, forwarded);
|
|
362
|
+
if (!Number.isSafeInteger(count) || count < 0 || count > buffer.byteLength) throw new FsError("EIO", { syscall: "read", path: this.#path });
|
|
363
|
+
return count;
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
write(buffer, position, options = {}) {
|
|
367
|
+
return this.#run("write", options, async (backend, forwarded) => {
|
|
368
|
+
if (this.#access === "read") throw new FsError("EBADF", { syscall: "write", path: this.#path });
|
|
369
|
+
this.#position(buffer, position, "write");
|
|
370
|
+
if (buffer.byteLength === 0 && this.capabilities.delegateZeroLengthWrite !== true) return 0;
|
|
371
|
+
const count = await backend.write(backend.resource, buffer, position, forwarded);
|
|
372
|
+
if (!Number.isSafeInteger(count) || count < 0 || count > buffer.byteLength) throw new FsError("EIO", { syscall: "write", path: this.#path });
|
|
373
|
+
return count;
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
truncate(length, options = {}) {
|
|
377
|
+
return this.#run("ftruncate", options, async (backend, forwarded) => {
|
|
378
|
+
if (this.#access === "read") throw new FsError("EBADF", { syscall: "ftruncate", path: this.#path });
|
|
379
|
+
integer(length, "ftruncate", this.#path);
|
|
380
|
+
if (!this.capabilities.truncate) throw new FsError("ENOTSUP", { syscall: "ftruncate", path: this.#path });
|
|
381
|
+
await backend.truncate(backend.resource, length, forwarded);
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
sync(dataOnly, options = {}) {
|
|
385
|
+
return this.#run(dataOnly ? "fdatasync" : "fsync", options, async (backend, forwarded) => {
|
|
386
|
+
if (typeof dataOnly !== "boolean") throw new FsError("EINVAL", { syscall: "fsync", path: this.#path });
|
|
387
|
+
if (this.capabilities.synchronization === "none") throw new FsError("ENOTSUP", { syscall: dataOnly ? "fdatasync" : "fsync", path: this.#path });
|
|
388
|
+
await backend.sync(backend.resource, dataOnly, forwarded);
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
close() {
|
|
392
|
+
this.#closing ??= this.#pending.then(async () => {
|
|
393
|
+
try {
|
|
394
|
+
await this.#backend.close(this.#backend.resource);
|
|
395
|
+
} finally {
|
|
396
|
+
this.#backend = void 0;
|
|
397
|
+
this.#getPosition = void 0;
|
|
398
|
+
this.#probeRead = void 0;
|
|
399
|
+
this.#pending = Promise.resolve();
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
return this.#closing;
|
|
403
|
+
}
|
|
404
|
+
};
|
|
405
|
+
async function openFileDescriptor(path, options, capabilities, acquire) {
|
|
406
|
+
if (!options || typeof options !== "object") throw new FsError("EINVAL", { syscall: "open", path });
|
|
407
|
+
const signal = options.signal;
|
|
408
|
+
signal?.throwIfAborted();
|
|
409
|
+
const keys = ["access", "creation", "truncate", "append", "mode", "synchronization", "signal"];
|
|
410
|
+
const { access, creation = "never", truncate = false, append = false, mode: mode2 = 438, synchronization } = options;
|
|
411
|
+
if (Object.keys(options).some((key) => !keys.includes(key)) || !["read", "write", "readwrite"].includes(access) || !["never", "ifMissing", "exclusive"].includes(creation) || typeof truncate !== "boolean" || typeof append !== "boolean" || access === "read" && (truncate || append) || synchronization !== void 0 && !["data", "all"].includes(synchronization) || !Number.isSafeInteger(mode2) || mode2 < 0 || mode2 > 4095) {
|
|
412
|
+
throw new FsError("EINVAL", { syscall: "open", path });
|
|
413
|
+
}
|
|
414
|
+
const admitted = Object.freeze({
|
|
415
|
+
access,
|
|
416
|
+
creation,
|
|
417
|
+
truncate,
|
|
418
|
+
append,
|
|
419
|
+
mode: mode2,
|
|
420
|
+
...signal === void 0 ? {} : { signal },
|
|
421
|
+
...synchronization === void 0 ? {} : { synchronization }
|
|
422
|
+
});
|
|
423
|
+
const admittedCapabilities = Object.freeze({ ...capabilities });
|
|
424
|
+
admitCapabilities(path, admitted, admittedCapabilities);
|
|
425
|
+
let backend;
|
|
426
|
+
try {
|
|
427
|
+
backend = await acquire(admitted);
|
|
428
|
+
} catch (error) {
|
|
429
|
+
signal?.throwIfAborted();
|
|
430
|
+
throw error;
|
|
431
|
+
}
|
|
432
|
+
try {
|
|
433
|
+
signal?.throwIfAborted();
|
|
434
|
+
const selected = Object.freeze({ ...backend.capabilities ?? admittedCapabilities });
|
|
435
|
+
signal?.throwIfAborted();
|
|
436
|
+
admitCapabilities(path, admitted, selected);
|
|
437
|
+
const descriptor = new ManagedFileDescriptor(path, admitted, selected, backend);
|
|
438
|
+
signal?.throwIfAborted();
|
|
439
|
+
return descriptor;
|
|
440
|
+
} catch (error) {
|
|
441
|
+
await finishCleanup(() => backend.close(backend.resource), true);
|
|
442
|
+
signal?.throwIfAborted();
|
|
443
|
+
throw error;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
257
446
|
function dirname(path) {
|
|
258
447
|
if (typeof path !== "string") throw new TypeError("path must be a string");
|
|
259
448
|
let end = path.length;
|
|
@@ -689,8 +878,14 @@ var defaultMemoryFileSystemLimits = Object.freeze({
|
|
|
689
878
|
});
|
|
690
879
|
function normalizeMemoryFileSystemLimits(options) {
|
|
691
880
|
const keys = ["maxFileBytes", "maxRetainedBytes", "maxMetadataUnits"];
|
|
692
|
-
const record2 = readConfigRecord(options, "memory option", keys);
|
|
881
|
+
const record2 = readConfigRecord(options, "memory option", [...keys, "maxBytes"]);
|
|
693
882
|
const limits = { ...defaultMemoryFileSystemLimits };
|
|
883
|
+
if (Object.hasOwn(record2, "maxBytes") && record2.maxBytes !== void 0) {
|
|
884
|
+
if (typeof record2.maxBytes !== "number" || !Number.isSafeInteger(record2.maxBytes) || record2.maxBytes < 0) {
|
|
885
|
+
throw new RangeError("maxBytes must be a nonnegative safe integer");
|
|
886
|
+
}
|
|
887
|
+
limits.maxBytes = record2.maxBytes;
|
|
888
|
+
}
|
|
694
889
|
for (const key of keys) {
|
|
695
890
|
const value = Object.hasOwn(record2, key) ? record2[key] : limits[key];
|
|
696
891
|
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < (key === "maxMetadataUnits" ? 1 : 0)) {
|
|
@@ -701,6 +896,7 @@ function normalizeMemoryFileSystemLimits(options) {
|
|
|
701
896
|
return Object.freeze(limits);
|
|
702
897
|
}
|
|
703
898
|
var typeModes = { file: 32768, directory: 16384, symlink: 40960 };
|
|
899
|
+
var preferredIoBlockSize = 64 * 1024;
|
|
704
900
|
var ext4HtreeEof64 = (1n << 63n) - 1n;
|
|
705
901
|
var ownedStats = /* @__PURE__ */ new WeakMap();
|
|
706
902
|
var ownedStores = /* @__PURE__ */ new WeakMap();
|
|
@@ -746,6 +942,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
|
|
|
746
942
|
readdir: true,
|
|
747
943
|
realpath: true,
|
|
748
944
|
access: true,
|
|
945
|
+
open: true,
|
|
749
946
|
write: true,
|
|
750
947
|
append: true,
|
|
751
948
|
exclusiveCreate: true,
|
|
@@ -772,6 +969,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
|
|
|
772
969
|
atomicRename: true,
|
|
773
970
|
atomicFileStaging: true,
|
|
774
971
|
atomicFileMutation: true,
|
|
972
|
+
atomicEntryRemoval: true,
|
|
775
973
|
atomicDirectoryMetadata: true,
|
|
776
974
|
streamingRead: true,
|
|
777
975
|
retainedRead: true,
|
|
@@ -788,6 +986,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
|
|
|
788
986
|
nextInode = 1;
|
|
789
987
|
ledger;
|
|
790
988
|
root;
|
|
989
|
+
totalBytes = 0;
|
|
791
990
|
constructor(options = {}) {
|
|
792
991
|
this.ledger = new MemoryLedger(normalizeMemoryFileSystemLimits(options));
|
|
793
992
|
this.ledger.reserve(0, 1, "mkdir", "/");
|
|
@@ -840,7 +1039,9 @@ var MemoryFileSystem = class _MemoryFileSystem {
|
|
|
840
1039
|
this.ledger.reserve(bytes, 2, syscall, path);
|
|
841
1040
|
try {
|
|
842
1041
|
const node = create();
|
|
1042
|
+
if (node.type === "file") this.admitSize(void 0, node.data.byteLength, syscall, path);
|
|
843
1043
|
parent.entries.set(name, node);
|
|
1044
|
+
if (node.type === "file") this.totalBytes += node.data.byteLength;
|
|
844
1045
|
this.changed(parent);
|
|
845
1046
|
return node;
|
|
846
1047
|
} catch (error) {
|
|
@@ -851,7 +1052,10 @@ var MemoryFileSystem = class _MemoryFileSystem {
|
|
|
851
1052
|
releaseNode(node) {
|
|
852
1053
|
if (node.nlink !== 0 || node.references !== 0) return;
|
|
853
1054
|
this.ledger.release(node.type === "symlink" ? node.target.length * 2 : 0, 1);
|
|
854
|
-
if (node.type === "file")
|
|
1055
|
+
if (node.type === "file") {
|
|
1056
|
+
this.totalBytes -= node.data.byteLength;
|
|
1057
|
+
node.allocation.release();
|
|
1058
|
+
}
|
|
855
1059
|
}
|
|
856
1060
|
releaseReference(node, path) {
|
|
857
1061
|
node.references--;
|
|
@@ -860,10 +1064,17 @@ var MemoryFileSystem = class _MemoryFileSystem {
|
|
|
860
1064
|
}
|
|
861
1065
|
replaceData(node, allocation, length = allocation.data.byteLength) {
|
|
862
1066
|
const previous = node.allocation;
|
|
1067
|
+
this.totalBytes += length - node.data.byteLength;
|
|
863
1068
|
node.data = allocation.data.subarray(0, length);
|
|
864
1069
|
node.allocation = allocation;
|
|
865
1070
|
previous.release();
|
|
866
1071
|
}
|
|
1072
|
+
admitSize(node, length, syscall, path) {
|
|
1073
|
+
this.ledger.fileSize(length, syscall, path);
|
|
1074
|
+
if (length - (node?.data.byteLength ?? 0) > (this.ledger.limits.maxBytes ?? Number.MAX_SAFE_INTEGER) - this.totalBytes) {
|
|
1075
|
+
this.fail("ENOSPC", syscall, path);
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
867
1078
|
fail(code, syscall, path, dest) {
|
|
868
1079
|
throw new FsError(code, { syscall, path, ...dest === void 0 ? {} : { dest } });
|
|
869
1080
|
}
|
|
@@ -952,6 +1163,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
|
|
|
952
1163
|
snapshot(node) {
|
|
953
1164
|
return {
|
|
954
1165
|
type: node.type,
|
|
1166
|
+
ioBlockSize: preferredIoBlockSize,
|
|
955
1167
|
...Number.isSafeInteger(node.revision) ? { revision: node.revision } : {},
|
|
956
1168
|
preferredIoBlockSize: 4096,
|
|
957
1169
|
size: node.type === "file" ? node.data.byteLength : node.type === "symlink" ? new TextEncoder().encode(node.target).byteLength : 0,
|
|
@@ -988,6 +1200,71 @@ var MemoryFileSystem = class _MemoryFileSystem {
|
|
|
988
1200
|
throw new FsError("EFBIG", { syscall, path, cause });
|
|
989
1201
|
}
|
|
990
1202
|
}
|
|
1203
|
+
open(path, options) {
|
|
1204
|
+
return openFileDescriptor(path, options, {
|
|
1205
|
+
positionedRead: true,
|
|
1206
|
+
positionedWrite: true,
|
|
1207
|
+
truncate: true,
|
|
1208
|
+
synchronization: "volatile",
|
|
1209
|
+
position: true
|
|
1210
|
+
}, async (admitted) => {
|
|
1211
|
+
const location = this.resolve(path, "open", {
|
|
1212
|
+
followFinal: admitted.creation !== "exclusive",
|
|
1213
|
+
allowMissing: admitted.creation !== "never"
|
|
1214
|
+
});
|
|
1215
|
+
let node = location.node;
|
|
1216
|
+
if (node) {
|
|
1217
|
+
if (admitted.creation === "exclusive") this.fail("EEXIST", "open", path);
|
|
1218
|
+
if (node.type !== "file") this.fail("EISDIR", "open", path);
|
|
1219
|
+
this.permission(node, admitted.access === "read" ? 4 : admitted.access === "write" ? 2 : 6, "open", path);
|
|
1220
|
+
} else {
|
|
1221
|
+
this.permission(location.parent, 3, "open", path);
|
|
1222
|
+
}
|
|
1223
|
+
this.ledger.reserve(path.length * 2, 1, "open", path);
|
|
1224
|
+
try {
|
|
1225
|
+
node ??= this.openWrite(path, {}, "open", { location, mode: admitted.mode, append: false });
|
|
1226
|
+
if (admitted.truncate) this.resizeNode(node, 0, "open", path);
|
|
1227
|
+
} catch (error) {
|
|
1228
|
+
this.ledger.release(path.length * 2, 1);
|
|
1229
|
+
throw error;
|
|
1230
|
+
}
|
|
1231
|
+
node.references++;
|
|
1232
|
+
const resource = { node, position: 0 };
|
|
1233
|
+
return {
|
|
1234
|
+
resource,
|
|
1235
|
+
getPosition: async (retained) => retained.position,
|
|
1236
|
+
stat: async (retained) => this.snapshot(retained.node),
|
|
1237
|
+
read: async (retained, buffer, position) => {
|
|
1238
|
+
const inode = retained.node;
|
|
1239
|
+
const start = position ?? retained.position;
|
|
1240
|
+
const count = Math.min(buffer.byteLength, Math.max(0, inode.data.byteLength - start));
|
|
1241
|
+
buffer.set(inode.data.subarray(start, start + count));
|
|
1242
|
+
if (position === null) retained.position += count;
|
|
1243
|
+
inode.atimeMs = Date.now();
|
|
1244
|
+
return count;
|
|
1245
|
+
},
|
|
1246
|
+
write: async (retained, buffer, position) => {
|
|
1247
|
+
const inode = retained.node;
|
|
1248
|
+
const start = admitted.append ? inode.data.byteLength : position ?? retained.position;
|
|
1249
|
+
const end = start + buffer.byteLength;
|
|
1250
|
+
this.writeAt(inode, buffer, start, "write", path);
|
|
1251
|
+
if (position === null) retained.position = end;
|
|
1252
|
+
return buffer.byteLength;
|
|
1253
|
+
},
|
|
1254
|
+
truncate: async (retained, length) => {
|
|
1255
|
+
const inode = retained.node;
|
|
1256
|
+
this.resizeNode(inode, length, "ftruncate", path);
|
|
1257
|
+
},
|
|
1258
|
+
sync: async () => {
|
|
1259
|
+
},
|
|
1260
|
+
close: async (retained) => {
|
|
1261
|
+
const inode = retained.node;
|
|
1262
|
+
retained.node = void 0;
|
|
1263
|
+
this.releaseReference(inode, path);
|
|
1264
|
+
}
|
|
1265
|
+
};
|
|
1266
|
+
});
|
|
1267
|
+
}
|
|
991
1268
|
prepareWrite(path, options, syscall) {
|
|
992
1269
|
const flag = options.flag ?? "w";
|
|
993
1270
|
if (!["w", "wx", "a", "ax"].includes(flag)) this.fail("EINVAL", syscall, path);
|
|
@@ -1016,7 +1293,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
|
|
|
1016
1293
|
const target = this.prepareWrite(path, options, syscall);
|
|
1017
1294
|
const current = target.location.node;
|
|
1018
1295
|
const length = (target.append ? current?.data.byteLength ?? 0 : 0) + data.byteLength;
|
|
1019
|
-
this.
|
|
1296
|
+
this.admitSize(current, length, syscall, path);
|
|
1020
1297
|
const growth = target.append && length > (current?.allocation.data.byteLength ?? 0) ? length : 0;
|
|
1021
1298
|
this.ledger.check(data.byteLength + growth + (current ? 0 : target.location.name.length * 2), current ? 0 : 2, syscall, path);
|
|
1022
1299
|
const copied = this.bytes(data, syscall, path);
|
|
@@ -1062,6 +1339,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
|
|
|
1062
1339
|
const end = position + data.byteLength;
|
|
1063
1340
|
this.ledger.fileSize(end, syscall, path);
|
|
1064
1341
|
const length = Math.max(node.data.byteLength, end);
|
|
1342
|
+
this.admitSize(node, length, syscall, path);
|
|
1065
1343
|
let allocation = node.allocation;
|
|
1066
1344
|
if (length > allocation.data.byteLength) {
|
|
1067
1345
|
this.ledger.check(length, 0, syscall, path);
|
|
@@ -1082,7 +1360,10 @@ var MemoryFileSystem = class _MemoryFileSystem {
|
|
|
1082
1360
|
throw error;
|
|
1083
1361
|
}
|
|
1084
1362
|
if (allocation !== node.allocation) this.replaceData(node, allocation, length);
|
|
1085
|
-
else
|
|
1363
|
+
else {
|
|
1364
|
+
this.totalBytes += length - node.data.byteLength;
|
|
1365
|
+
node.data = allocation.data.subarray(0, length);
|
|
1366
|
+
}
|
|
1086
1367
|
this.changed(node);
|
|
1087
1368
|
}
|
|
1088
1369
|
async readFile(path, options = {}) {
|
|
@@ -1129,6 +1410,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
|
|
|
1129
1410
|
const mode2 = this.mode(options.mode, content.type === "file" ? 438 : 511, "createStagedFile", directoryPath);
|
|
1130
1411
|
for (const time of [options.atimeMs, options.mtimeMs]) if (time !== void 0 && !Number.isFinite(time)) this.fail("EINVAL", "createStagedFile", directoryPath);
|
|
1131
1412
|
if (content.type === "file" && !(content.data instanceof Uint8Array)) throw new TypeError("Staged files require Uint8Array data");
|
|
1413
|
+
if (content.type === "file") this.admitSize(void 0, content.data.byteLength, "createStagedFile", directoryPath);
|
|
1132
1414
|
if (content.type === "symlink") this.validatePath(content.target, "createStagedFile");
|
|
1133
1415
|
const retained = (location.name.length + name.length) * 2 + (content.type === "symlink" ? content.target.length * 2 : 0);
|
|
1134
1416
|
this.ledger.reserve(retained, 4, "createStagedFile", directoryPath);
|
|
@@ -1143,6 +1425,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
|
|
|
1143
1425
|
if (options.mtimeMs !== void 0) file.mtimeMs = options.mtimeMs;
|
|
1144
1426
|
directory.entries.set(name, file);
|
|
1145
1427
|
location.parent.entries.set(location.name, directory);
|
|
1428
|
+
if (file.type === "file") this.totalBytes += file.data.byteLength;
|
|
1146
1429
|
} catch (error) {
|
|
1147
1430
|
allocation?.release();
|
|
1148
1431
|
this.ledger.release(retained, 4);
|
|
@@ -1217,6 +1500,25 @@ var MemoryFileSystem = class _MemoryFileSystem {
|
|
|
1217
1500
|
this.writeData(path, data, { ...options.mode === void 0 ? {} : { mode: options.mode }, flag: options.append ? "a" : "w" }, "writeFileConditional");
|
|
1218
1501
|
return Object.freeze(this.snapshot(location.parent.entries.get(location.name)));
|
|
1219
1502
|
}
|
|
1503
|
+
async removeEntryConditional(path, options) {
|
|
1504
|
+
options.signal?.throwIfAborted();
|
|
1505
|
+
const location = this.entry(path, "removeEntryConditional", true);
|
|
1506
|
+
this.expectEntry(location.parent, options.parent, path, false);
|
|
1507
|
+
this.expectEntry(location.node, options.expected, path);
|
|
1508
|
+
const node = location.node;
|
|
1509
|
+
if (this.terminalDot(path)) this.fail("EINVAL", "removeEntryConditional", path);
|
|
1510
|
+
if (node === this.root) this.fail("EBUSY", "removeEntryConditional", path);
|
|
1511
|
+
if (node.type !== "file" && node.type !== "symlink" && node.type !== "directory") this.fail("EINVAL", "removeEntryConditional", path);
|
|
1512
|
+
this.permission(location.parent, 3, "removeEntryConditional", path);
|
|
1513
|
+
if (node.type === "directory" && node.entries.size > 0) this.fail("ENOTEMPTY", "removeEntryConditional", path);
|
|
1514
|
+
location.parent.entries.delete(location.name);
|
|
1515
|
+
this.ledger.release(location.name.length * 2, 1);
|
|
1516
|
+
node.nlink--;
|
|
1517
|
+
node.ctimeMs = Date.now();
|
|
1518
|
+
node.revision = Math.min(Number.MAX_SAFE_INTEGER + 1, node.revision + 1);
|
|
1519
|
+
this.releaseNode(node);
|
|
1520
|
+
this.changed(location.parent);
|
|
1521
|
+
}
|
|
1220
1522
|
async removeFileConditional(path, options) {
|
|
1221
1523
|
options.signal?.throwIfAborted();
|
|
1222
1524
|
const location = this.entry(path, "removeFileConditional", true);
|
|
@@ -1327,6 +1629,9 @@ var MemoryFileSystem = class _MemoryFileSystem {
|
|
|
1327
1629
|
}
|
|
1328
1630
|
this.changed(location.parent);
|
|
1329
1631
|
}
|
|
1632
|
+
unlink(path, options = {}) {
|
|
1633
|
+
return this.rm(path, { ...options.signal === void 0 ? {} : { signal: options.signal } });
|
|
1634
|
+
}
|
|
1330
1635
|
async rename(source, destination, options = {}) {
|
|
1331
1636
|
options.signal?.throwIfAborted();
|
|
1332
1637
|
try {
|
|
@@ -1381,7 +1686,6 @@ var MemoryFileSystem = class _MemoryFileSystem {
|
|
|
1381
1686
|
if (target.node === origin) this.fail("EINVAL", "copyFile", source, destination);
|
|
1382
1687
|
const node = this.writeData(destination, origin.data, { mode: origin.mode & 4095, flag: options.exclusive ? "wx" : "w" }, "copyFile");
|
|
1383
1688
|
node.mode = origin.mode;
|
|
1384
|
-
this.changed(node);
|
|
1385
1689
|
origin.atimeMs = Date.now();
|
|
1386
1690
|
} catch (error) {
|
|
1387
1691
|
if (error instanceof FsError) throw new FsError(error.code, { syscall: "copyFile", path: source, dest: destination, cause: error });
|
|
@@ -1459,6 +1763,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
|
|
|
1459
1763
|
this.resizeNode(node, length, "truncate", path);
|
|
1460
1764
|
}
|
|
1461
1765
|
resizeNode(node, length, syscall, path) {
|
|
1766
|
+
this.admitSize(node, length, syscall, path);
|
|
1462
1767
|
const data = this.allocate(length, syscall, path);
|
|
1463
1768
|
try {
|
|
1464
1769
|
data.data.set(node.data.subarray(0, length));
|
|
@@ -1491,7 +1796,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
|
|
|
1491
1796
|
throw error;
|
|
1492
1797
|
}
|
|
1493
1798
|
const snapshot = this.snapshot.bind(this);
|
|
1494
|
-
const
|
|
1799
|
+
const integer3 = this.integer.bind(this);
|
|
1495
1800
|
const resizeNode = this.resizeNode.bind(this);
|
|
1496
1801
|
const releaseReference = this.releaseReference.bind(this);
|
|
1497
1802
|
let closing;
|
|
@@ -1509,7 +1814,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
|
|
|
1509
1814
|
},
|
|
1510
1815
|
async truncate(length, options2 = {}) {
|
|
1511
1816
|
const file = current(options2.signal, "ftruncate");
|
|
1512
|
-
|
|
1817
|
+
integer3(length, "ftruncate", path);
|
|
1513
1818
|
resizeNode(file, length, "ftruncate", path);
|
|
1514
1819
|
},
|
|
1515
1820
|
close() {
|
|
@@ -1566,7 +1871,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
|
|
|
1566
1871
|
this.ledger.reserve(path.length * 2, 1, "openReadFile", path);
|
|
1567
1872
|
node.references++;
|
|
1568
1873
|
const snapshot = this.snapshot.bind(this);
|
|
1569
|
-
const
|
|
1874
|
+
const integer3 = this.integer.bind(this);
|
|
1570
1875
|
const releaseReference = this.releaseReference.bind(this);
|
|
1571
1876
|
let closing;
|
|
1572
1877
|
const current = (signal2, syscall) => {
|
|
@@ -1584,8 +1889,8 @@ var MemoryFileSystem = class _MemoryFileSystem {
|
|
|
1584
1889
|
},
|
|
1585
1890
|
async read(position, maxBytes, options2 = {}) {
|
|
1586
1891
|
const file = current(options2.signal, "read");
|
|
1587
|
-
|
|
1588
|
-
|
|
1892
|
+
integer3(position, "read", path);
|
|
1893
|
+
integer3(maxBytes, "read", path);
|
|
1589
1894
|
if (maxBytes === 0 || maxBytes > Number.MAX_SAFE_INTEGER - position) {
|
|
1590
1895
|
throw new FsError("EINVAL", { syscall: "read", path });
|
|
1591
1896
|
}
|
|
@@ -1607,7 +1912,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
|
|
|
1607
1912
|
async *readStream(path, options = {}) {
|
|
1608
1913
|
options.signal?.throwIfAborted();
|
|
1609
1914
|
const start = options.start ?? 0;
|
|
1610
|
-
const chunkSize2 = options.chunkSize ??
|
|
1915
|
+
const chunkSize2 = options.chunkSize ?? preferredIoBlockSize;
|
|
1611
1916
|
this.integer(start, "readStream", path);
|
|
1612
1917
|
this.integer(chunkSize2, "readStream", path);
|
|
1613
1918
|
if (chunkSize2 === 0) this.fail("EINVAL", "readStream", path);
|
|
@@ -1688,6 +1993,7 @@ function stockDescriptorWrite(filesystem) {
|
|
|
1688
1993
|
"mode",
|
|
1689
1994
|
"bytes",
|
|
1690
1995
|
"allocate",
|
|
1996
|
+
"admitSize",
|
|
1691
1997
|
"changed",
|
|
1692
1998
|
"metadata",
|
|
1693
1999
|
"integer",
|
|
@@ -1723,6 +2029,7 @@ var deviceCapabilities = Object.freeze({
|
|
|
1723
2029
|
retainedRead: true,
|
|
1724
2030
|
streamingWrite: true,
|
|
1725
2031
|
streamingAppend: true,
|
|
2032
|
+
independentWriteStreams: true,
|
|
1726
2033
|
copy: true,
|
|
1727
2034
|
exclusiveCopy: true,
|
|
1728
2035
|
remove: false,
|
|
@@ -1738,7 +2045,9 @@ var deviceCapabilities = Object.freeze({
|
|
|
1738
2045
|
timestamps: false,
|
|
1739
2046
|
truncate: false,
|
|
1740
2047
|
randomAccessWrite: false,
|
|
2048
|
+
open: false,
|
|
1741
2049
|
atomicFileMutation: false,
|
|
2050
|
+
atomicEntryRemoval: false,
|
|
1742
2051
|
atomicFileStaging: false,
|
|
1743
2052
|
atomicDirectoryMetadata: false,
|
|
1744
2053
|
atomicRename: false,
|
|
@@ -1894,7 +2203,7 @@ function* validDeclaration(content, expectedEncoding) {
|
|
|
1894
2203
|
return offset - start;
|
|
1895
2204
|
};
|
|
1896
2205
|
const field = function* (name) {
|
|
1897
|
-
if (content.slice(offset, offset + name.length)
|
|
2206
|
+
if (content.slice(offset, offset + name.length) !== name) return void 0;
|
|
1898
2207
|
offset += name.length;
|
|
1899
2208
|
yield name.length;
|
|
1900
2209
|
yield* whitespace();
|
|
@@ -1913,17 +2222,17 @@ function* validDeclaration(content, expectedEncoding) {
|
|
|
1913
2222
|
};
|
|
1914
2223
|
if (!(yield* whitespace()) || (yield* field("version")) !== "1.0") return false;
|
|
1915
2224
|
let spacing = yield* whitespace();
|
|
1916
|
-
if (content.slice(offset, offset + 8)
|
|
2225
|
+
if (content.slice(offset, offset + 8) === "encoding") {
|
|
1917
2226
|
if (!spacing) return false;
|
|
1918
2227
|
const encoding = yield* field("encoding");
|
|
1919
2228
|
if (encoding === void 0 || encoding.length > 8 || !["utf-8", "utf-16", "utf-16le", "utf-16be"].includes(encoding.toLowerCase())) return false;
|
|
1920
|
-
if (expectedEncoding !== void 0 && encoding.toLowerCase() !== expectedEncoding.toLowerCase()) return false;
|
|
2229
|
+
if (expectedEncoding !== void 0 && encoding.toLowerCase() !== expectedEncoding.toLowerCase() && !(encoding.toLowerCase() === "utf-16" && (expectedEncoding === "UTF-16LE" || expectedEncoding === "UTF-16BE"))) return false;
|
|
1921
2230
|
spacing = yield* whitespace();
|
|
1922
2231
|
}
|
|
1923
|
-
if (content.slice(offset, offset + 10)
|
|
2232
|
+
if (content.slice(offset, offset + 10) === "standalone") {
|
|
1924
2233
|
if (!spacing) return false;
|
|
1925
2234
|
const standalone = yield* field("standalone");
|
|
1926
|
-
if (standalone === void 0 || standalone.length > 3 || !["yes", "no"].includes(standalone
|
|
2235
|
+
if (standalone === void 0 || standalone.length > 3 || !["yes", "no"].includes(standalone)) return false;
|
|
1927
2236
|
yield* whitespace();
|
|
1928
2237
|
}
|
|
1929
2238
|
return offset === content.length;
|
|
@@ -1942,6 +2251,13 @@ function* parseXmlSteps(input, limits = {}) {
|
|
|
1942
2251
|
for (const limit of [maxDepth, maxNodes, maxAttributes, maxContentNodes, maxAttributesPerElement, maxNamespaces]) {
|
|
1943
2252
|
if (!Number.isSafeInteger(limit) || limit < 1) throw new RangeError("XML limits must be positive integers");
|
|
1944
2253
|
}
|
|
2254
|
+
const maxTextLength = limits.maxTextLength ?? Number.MAX_SAFE_INTEGER;
|
|
2255
|
+
if (!Number.isSafeInteger(maxTextLength) || maxTextLength < 1) throw new RangeError("XML limits must be positive integers");
|
|
2256
|
+
let textLength = 0;
|
|
2257
|
+
const admitText = (text) => {
|
|
2258
|
+
if (text.length > maxTextLength - textLength) throw new XmlLimitError("maxTextLength", "XML text limit exceeded");
|
|
2259
|
+
textLength += text.length;
|
|
2260
|
+
};
|
|
1945
2261
|
const chunks = [];
|
|
1946
2262
|
let chunk = "";
|
|
1947
2263
|
for (let index = input.charCodeAt(0) === 65279 ? 1 : 0; index < input.length; index++) {
|
|
@@ -1965,6 +2281,8 @@ function* parseXmlSteps(input, limits = {}) {
|
|
|
1965
2281
|
const source = chunks.join("");
|
|
1966
2282
|
const stack = [];
|
|
1967
2283
|
let root;
|
|
2284
|
+
const prolog = [];
|
|
2285
|
+
const epilog = [];
|
|
1968
2286
|
let declaration;
|
|
1969
2287
|
let offset = 0;
|
|
1970
2288
|
let nodes = 0;
|
|
@@ -1996,6 +2314,7 @@ function* parseXmlSteps(input, limits = {}) {
|
|
|
1996
2314
|
return name;
|
|
1997
2315
|
};
|
|
1998
2316
|
const appendText = function* (text, kind = "text") {
|
|
2317
|
+
admitText(text);
|
|
1999
2318
|
const parent = stack.at(-1);
|
|
2000
2319
|
if (parent) {
|
|
2001
2320
|
parent.element.text += text;
|
|
@@ -2009,6 +2328,10 @@ function* parseXmlSteps(input, limits = {}) {
|
|
|
2009
2328
|
if ((index + 1) % 512 === 0) yield 512;
|
|
2010
2329
|
}
|
|
2011
2330
|
if (text.length % 512) yield text.length % 512;
|
|
2331
|
+
if (retainContent && text.length) {
|
|
2332
|
+
admitContent();
|
|
2333
|
+
(root ? epilog : prolog).push({ kind, text });
|
|
2334
|
+
}
|
|
2012
2335
|
}
|
|
2013
2336
|
};
|
|
2014
2337
|
while (offset < source.length) {
|
|
@@ -2017,7 +2340,7 @@ function* parseXmlSteps(input, limits = {}) {
|
|
|
2017
2340
|
const next = yield* find(source, "<", offset);
|
|
2018
2341
|
const text = source.slice(offset, next < 0 ? source.length : next);
|
|
2019
2342
|
if ((yield* find(text, "]]>", 0)) >= 0) invalid("CDATA terminator in text");
|
|
2020
|
-
yield* appendText(yield* entities(text));
|
|
2343
|
+
yield* appendText(stack.length ? yield* entities(text) : text);
|
|
2021
2344
|
offset += text.length;
|
|
2022
2345
|
} else if (source.startsWith("<!--", offset)) {
|
|
2023
2346
|
const end = yield* find(source, "-->", offset + 4);
|
|
@@ -2025,9 +2348,11 @@ function* parseXmlSteps(input, limits = {}) {
|
|
|
2025
2348
|
invalid("malformed comment");
|
|
2026
2349
|
}
|
|
2027
2350
|
const parent = stack.at(-1);
|
|
2028
|
-
|
|
2351
|
+
const text = source.slice(offset + 4, end);
|
|
2352
|
+
admitText(text);
|
|
2353
|
+
if (retainContent) {
|
|
2029
2354
|
admitContent();
|
|
2030
|
-
parent
|
|
2355
|
+
(parent?.content ?? (root ? epilog : prolog)).push({ kind: "comment", text });
|
|
2031
2356
|
}
|
|
2032
2357
|
offset = end + 3;
|
|
2033
2358
|
} else if (source.startsWith("<![CDATA[", offset)) {
|
|
@@ -2051,15 +2376,17 @@ function* parseXmlSteps(input, limits = {}) {
|
|
|
2051
2376
|
} else if (content && !" \n\r".includes(content[0])) invalid("invalid processing instruction");
|
|
2052
2377
|
if (!(target.length === 3 && target.toLowerCase() === "xml")) {
|
|
2053
2378
|
const parent = stack.at(-1);
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2379
|
+
let start2 = 0;
|
|
2380
|
+
while (start2 < content.length && " \n\r".includes(content[start2])) {
|
|
2381
|
+
start2++;
|
|
2382
|
+
if (start2 % 512 === 0) yield 512;
|
|
2383
|
+
}
|
|
2384
|
+
if (start2 % 512) yield start2 % 512;
|
|
2385
|
+
const text = content.slice(start2);
|
|
2386
|
+
admitText(text);
|
|
2387
|
+
if (retainContent) {
|
|
2061
2388
|
admitContent();
|
|
2062
|
-
parent
|
|
2389
|
+
(parent?.content ?? (root ? epilog : prolog)).push({ kind: "processing-instruction", target, text });
|
|
2063
2390
|
}
|
|
2064
2391
|
}
|
|
2065
2392
|
offset = end + 2;
|
|
@@ -2102,6 +2429,7 @@ function* parseXmlSteps(input, limits = {}) {
|
|
|
2102
2429
|
}
|
|
2103
2430
|
if (raw.length % 512) yield raw.length % 512;
|
|
2104
2431
|
const value = yield* entities(normalized);
|
|
2432
|
+
admitText(value);
|
|
2105
2433
|
attributes.set(attribute, value);
|
|
2106
2434
|
offset = end + 1;
|
|
2107
2435
|
if (attribute === "xmlns" || attribute.startsWith("xmlns:")) {
|
|
@@ -2149,7 +2477,7 @@ function* parseXmlSteps(input, limits = {}) {
|
|
|
2149
2477
|
yield 1;
|
|
2150
2478
|
}
|
|
2151
2479
|
const content = retainContent ? [] : void 0;
|
|
2152
|
-
const element = { kind: "element", name, namespace, localName, children: [], text: "", content: content ?? emptyContent, attributes: retainContent ? retainedAttributes : emptyAttributes, namespaces: retainContent ? namespaces : emptyNamespaces, ...root === void 0 && declaration
|
|
2480
|
+
const element = { kind: "element", name, namespace, localName, children: [], text: "", content: content ?? emptyContent, attributes: retainContent ? retainedAttributes : emptyAttributes, namespaces: retainContent ? namespaces : emptyNamespaces, ...root === void 0 && retainContent ? { prolog, epilog, ...declaration === void 0 ? {} : { declaration } } : {} };
|
|
2153
2481
|
const parent = stack.at(-1);
|
|
2154
2482
|
if (parent) {
|
|
2155
2483
|
parent.element.children.push(element);
|
|
@@ -2335,7 +2663,12 @@ function statusCode(element) {
|
|
|
2335
2663
|
return Number(text.split(" ")[1]);
|
|
2336
2664
|
}
|
|
2337
2665
|
var WebDavFileSystem = class {
|
|
2666
|
+
async open(path, options) {
|
|
2667
|
+
options.signal?.throwIfAborted();
|
|
2668
|
+
throw new FsError("ENOTSUP", { syscall: "open", path });
|
|
2669
|
+
}
|
|
2338
2670
|
capabilities = Object.freeze({
|
|
2671
|
+
open: false,
|
|
2339
2672
|
read: true,
|
|
2340
2673
|
stat: true,
|
|
2341
2674
|
readdir: true,
|
|
@@ -3949,4 +4282,4 @@ export {
|
|
|
3949
4282
|
safeJsNodeCommands,
|
|
3950
4283
|
createSafeJsNodeCommand
|
|
3951
4284
|
};
|
|
3952
|
-
//# sourceMappingURL=chunk-
|
|
4285
|
+
//# sourceMappingURL=chunk-WECHUK3Y.js.map
|