@poe-platform/safe-bash 0.1.797 → 0.1.799
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 -1
- package/dist/pdf/index.d.ts +1 -1
- package/dist/pdf/model.d.ts +7 -2
- package/dist/safe-bash/chunks/{chunk-D2XB7XIC.js → chunk-AZAJJVFX.js} +7 -11
- package/dist/safe-bash/chunks/{chunk-C2NYCU7O.js → chunk-JSVX4VIA.js} +5 -1
- package/dist/safe-bash/chunks/{chunk-TCWZNUVP.js → chunk-SPYL72GN.js} +1 -25
- package/dist/safe-bash/chunks/{chunk-TGOF7VO5.js → chunk-TRVGCN3U.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-ZXKVOJNL.js → chunk-WUNK5NXJ.js} +6 -5
- package/dist/safe-bash/command-chunks/{chunk-JG5W2ENK.js → chunk-43GSSUAY.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-OAJUAAWH.js → chunk-464RVBGB.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-25BLI6S6.js → chunk-4Y3WVMK4.js} +1 -14
- package/dist/safe-bash/command-chunks/{chunk-SSBFTMVI.js → chunk-4ZALPDBV.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-YMQKVEIF.js → chunk-52PCQXD2.js} +2 -13
- package/dist/safe-bash/command-chunks/{chunk-ZCKDQGKY.js → chunk-5HDSFHGW.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-JHVZYB4R.js → chunk-5MPOQ6V3.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-AUAF5YBT.js → chunk-5WPI42ZW.js} +0 -7
- package/dist/safe-bash/command-chunks/{chunk-PPOIPMY4.js → chunk-5ZSM4UFN.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-RECJB2BO.js → chunk-7BS66BXN.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-GRWOVSFK.js → chunk-7D7JRRML.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-E6IYUYVA.js → chunk-7L24L4UO.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-HBXQWTJR.js → chunk-A5ZAV6DO.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-LW34AKDM.js → chunk-AB4MXHVS.js} +4 -14
- package/dist/safe-bash/command-chunks/{chunk-EELNLEEP.js → chunk-AXK3H4PX.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-Y55OCH37.js → chunk-AYUTO323.js} +3 -10
- package/dist/safe-bash/command-chunks/{chunk-DY36FDDC.js → chunk-B5BKA5WH.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-YB6KVU6H.js → chunk-BDBVVZY6.js} +4 -14
- package/dist/safe-bash/command-chunks/{chunk-QAN7KKDZ.js → chunk-BZDDAPSV.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-HZCPWYWA.js → chunk-BZPAWTUL.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-RT2J5ATD.js → chunk-CPPGTBZF.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-A7RIYQIF.js → chunk-DDLQ5YDB.js} +172 -167
- package/dist/safe-bash/command-chunks/{chunk-JEPY4UY4.js → chunk-EIVW3X3N.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-C2DUYVYZ.js → chunk-ESMCX3YV.js} +138 -36
- package/dist/safe-bash/command-chunks/chunk-EZ7D6DXC.js +6 -0
- package/dist/safe-bash/command-chunks/{chunk-QGVOS3EY.js → chunk-HFII3QYO.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-5EWTQJSC.js → chunk-HHP343KT.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-5UA3BEGA.js → chunk-I3K5RYU4.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-4MS5WZJC.js → chunk-IKS2YXZQ.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-CZVBYCB5.js → chunk-IL53SJL4.js} +2 -12
- package/dist/safe-bash/command-chunks/{chunk-HLMUPSM6.js → chunk-JCNNOMBV.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-2LLZBNLL.js → chunk-JWE54GHQ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-QLDIP3OP.js → chunk-JZSNU2MY.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-2HOESGFJ.js → chunk-KMCZ6P4O.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-U3ONEICA.js → chunk-KVFCSLKK.js} +1 -11
- package/dist/safe-bash/command-chunks/{chunk-THS4YAKG.js → chunk-LLCXZKZ6.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-3TANKHBX.js → chunk-MRW5HD2D.js} +1 -6
- package/dist/safe-bash/command-chunks/{chunk-3WKA57FA.js → chunk-N5FGCXQJ.js} +1 -9
- package/dist/safe-bash/command-chunks/{chunk-ULZ7HIZP.js → chunk-NETECMOF.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-2Q7UQ7R4.js → chunk-OPUJSTHS.js} +12 -12
- package/dist/safe-bash/command-chunks/{chunk-HVI6ALJF.js → chunk-PFAADCB5.js} +2 -4
- package/dist/safe-bash/command-chunks/{chunk-JXU2N6GN.js → chunk-Q7Q5GM5S.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-Z5TFSVNU.js → chunk-QAKKSRNV.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-KAHH4XOU.js → chunk-QNXI2UP6.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-ECAK3JHR.js → chunk-QRRYN2KO.js} +21 -12
- package/dist/safe-bash/command-chunks/{chunk-WYOL5JNT.js → chunk-SX2X3IH4.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-WBJKOTSP.js → chunk-UI32HWGS.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-AC6X7Q4I.js → chunk-VVI4Z73I.js} +1 -8
- package/dist/safe-bash/command-chunks/{chunk-JCVXAX2G.js → chunk-XWZBMJ5B.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-UUR2S7AD.js → chunk-Y6TUZWPS.js} +28 -1
- package/dist/safe-bash/command-chunks/{chunk-23XLM73P.js → chunk-YEOPI5SK.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-PRCT7FKJ.js → chunk-YZ5SVZFD.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-OGUMMTTD.js → chunk-ZJBR5Q5I.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-VZ64JXHC.js → chunk-ZS3QPNUL.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-VKQCNX32.js → chunk-ZT4KSS2V.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-6N5V4VBN.js → chunk-ZXKW7SJ2.js} +2 -2
- package/dist/safe-bash/command-chunks/{pptx-KY2OJWZW-76LBHCHD.js → pptx-GBPNWNEP-7EQEVXV5.js} +8 -2
- package/dist/safe-bash/commands/diff-patch/shared.d.ts +0 -2
- package/dist/safe-bash/commands/diff-patch/shared.js +2 -11
- package/dist/safe-bash/commands/llm/index.browser.js +9 -1
- package/dist/safe-bash/commands/llm/providers/index.browser.js +6 -2
- package/dist/safe-bash/commands/text.js +1 -25
- package/dist/safe-bash/core.browser.js +1 -1
- package/dist/safe-bash/core.d.ts +5 -1
- package/dist/safe-bash/core.js +5 -1
- package/dist/safe-bash/full-core.browser.js +134 -5
- package/dist/safe-bash/lazy-optional.d.ts +13 -0
- package/dist/safe-bash/lazy-optional.js +118 -0
- package/dist/safe-bash/opt-in/commands/dd/index.js +4 -13
- package/dist/safe-bash/opt-in/commands/yq/native-work.js +2 -1
- package/dist/safe-bash/opt-in/optional/commands/shuf/input.js +3 -21
- package/dist/safe-bash/opt-in/optional/commands/shuf/shuf.js +4 -27
- package/dist/safe-bash/plugins/index.browser.js +3 -3
- package/dist/safe-bash/registry-entry.browser.js +2 -2
- package/dist/safe-bash/shell/env-warning.js +3 -2
- package/dist/safe-bash/shell/runtime.js +2 -2
- package/dist/safe-bash/shell-entry.browser.js +2 -2
- package/dist/safe-bash-command-csvkit/index.js +528 -498
- package/dist/safe-bash-command-dd/index.js +4 -13
- package/dist/safe-bash-command-du/budget.d.ts +0 -2
- package/dist/safe-bash-command-du/budget.js +1 -1
- package/dist/safe-bash-command-du/du.js +2 -2
- package/dist/safe-bash-command-du/index.js +2 -2
- package/dist/safe-bash-command-file/index.js +1 -1
- package/dist/safe-bash-command-file/shared.d.ts +0 -2
- package/dist/safe-bash-command-file/shared.js +1 -1
- package/dist/safe-bash-command-fmt/index.js +3 -15
- package/dist/safe-bash-command-git/git_rust.wasm +0 -0
- package/dist/safe-bash-command-git/wasm.generated.js +1 -1
- package/dist/safe-bash-command-html-to-markdown/budget.d.ts +0 -3
- package/dist/safe-bash-command-html-to-markdown/budget.js +1 -1
- package/dist/safe-bash-command-html-to-markdown/entities.js +3 -3
- package/dist/safe-bash-command-html-to-markdown/index.js +6 -6
- package/dist/safe-bash-command-html-to-markdown/input.js +5 -5
- package/dist/safe-bash-command-html-to-markdown/parser.js +4 -4
- package/dist/safe-bash-command-html-to-markdown/render.js +5 -5
- package/dist/safe-bash-command-html-to-markdown/text.js +2 -2
- package/dist/safe-bash-command-iconv/command.js +5 -5
- package/dist/safe-bash-command-iconv/index.js +5 -5
- package/dist/safe-bash-command-iconv/internal.d.ts +0 -2
- package/dist/safe-bash-command-iconv/internal.js +1 -1
- package/dist/safe-bash-command-iconv/lifecycle.js +2 -2
- package/dist/safe-bash-command-iconv/options.js +2 -2
- package/dist/safe-bash-command-iconv/reader.js +2 -2
- package/dist/safe-bash-command-llm/base64-stream.d.ts +2 -0
- package/dist/safe-bash-command-llm/chat-json.d.ts +10 -0
- package/dist/safe-bash-command-llm/index.d.ts +2 -1
- package/dist/safe-bash-command-llm/index.js +11 -2
- package/dist/safe-bash-command-llm/json-string.d.ts +2 -0
- package/dist/safe-bash-command-llm/json-value.d.ts +2 -0
- package/dist/safe-bash-command-llm/openai.d.ts +1 -0
- package/dist/safe-bash-command-llm/openai.js +4 -2
- package/dist/safe-bash-command-llm/provider-serialization.d.ts +6 -0
- package/dist/safe-bash-command-llm/providers/index.d.ts +2 -1
- package/dist/safe-bash-command-llm/providers/index.js +12 -3
- package/dist/safe-bash-command-llm/providers/openai.d.ts +1 -1
- package/dist/safe-bash-command-llm/providers/openai.js +4 -2
- package/dist/safe-bash-command-numfmt/index.js +4 -18
- package/dist/safe-bash-command-pandoc/citeproc-filters.js +1 -1
- package/dist/safe-bash-command-pandoc/command.js +3 -3
- package/dist/safe-bash-command-pandoc/index.js +3 -3
- package/dist/safe-bash-command-pr/command.js +5 -5
- package/dist/safe-bash-command-pr/format.js +2 -2
- package/dist/safe-bash-command-pr/index.js +5 -5
- package/dist/safe-bash-command-pr/internal.d.ts +0 -2
- package/dist/safe-bash-command-pr/internal.js +1 -1
- package/dist/safe-bash-command-pr/io.js +2 -2
- package/dist/safe-bash-command-pr/options.js +2 -2
- package/dist/safe-bash-command-shuf/input.js +3 -21
- package/dist/safe-bash-command-shuf/shuf.js +4 -27
- package/dist/safe-bash-command-split/index.js +3 -3
- package/dist/safe-bash-command-split/io.d.ts +0 -2
- package/dist/safe-bash-command-split/io.js +1 -1
- package/dist/safe-bash-command-split/outputs.js +2 -2
- package/dist/safe-bash-command-split/split.js +3 -3
- package/dist/safe-bash-command-ssconvert/index.js +1 -1
- package/dist/safe-bash-command-tree/arguments.js +3 -3
- package/dist/safe-bash-command-tree/charset.js +1 -1
- package/dist/safe-bash-command-tree/index.js +4 -4
- package/dist/safe-bash-command-tree/io.d.ts +0 -1
- package/dist/safe-bash-command-tree/io.js +1 -1
- package/dist/safe-bash-command-tree/pattern.js +2 -2
- package/dist/safe-bash-command-tree/tree.js +4 -4
- package/dist/safe-bash-command-tsort/command.js +4 -4
- package/dist/safe-bash-command-tsort/graph.js +2 -2
- package/dist/safe-bash-command-tsort/index.js +4 -4
- package/dist/safe-bash-command-tsort/internal.d.ts +0 -2
- package/dist/safe-bash-command-tsort/internal.js +1 -1
- package/dist/safe-bash-command-tsort/io.js +2 -2
- package/dist/safe-bash-command-yq/native-work.js +2 -1
- package/dist/safe-bash-io-engine/commands/archive/internal.d.ts +0 -1
- package/dist/safe-bash-io-engine/commands/archive/internal.js +3 -7
- package/dist/safe-bash-io-engine/shell/pattern.js +1 -1
- package/dist/safe-bash-io-engine/shell/string-operations.d.ts +0 -2
- package/dist/safe-bash-io-engine/shell/string-operations.js +1 -1
- package/dist/safe-bash-line-ending-engine/internal.d.ts +0 -2
- package/dist/safe-bash-line-ending-engine/internal.js +1 -9
- package/dist/safe-bash-query-engine/capture.js +5 -5
- package/dist/safe-bash-query-engine/dates.js +2 -2
- package/dist/safe-bash-query-engine/delpaths.js +5 -5
- package/dist/safe-bash-query-engine/formats.js +3 -3
- package/dist/safe-bash-query-engine/index.js +15 -15
- package/dist/safe-bash-query-engine/indices.js +5 -5
- package/dist/safe-bash-query-engine/input.js +2 -2
- package/dist/safe-bash-query-engine/interpreter.js +13 -13
- package/dist/safe-bash-query-engine/limits.js +1 -1
- package/dist/safe-bash-query-engine/parser.js +2 -2
- package/dist/safe-bash-query-engine/query-core.js +15 -15
- package/dist/safe-bash-query-engine/recurse.js +2 -2
- package/dist/safe-bash-query-engine/regex.js +5 -5
- package/dist/safe-bash-query-engine/split.js +2 -2
- package/dist/safe-bash-query-engine/splits.js +6 -6
- package/dist/safe-bash-query-engine/values.js +4 -4
- package/dist/safe-bash-regex-engine/ere/limits.d.ts +0 -1
- package/dist/safe-bash-regex-engine/ere/limits.js +1 -1
- package/dist/safe-bash-regex-engine/ere/matcher.js +5 -5
- package/dist/safe-bash-regex-engine/ere/syntax.js +2 -2
- package/dist/safe-bash-regex-engine/execution/bounded-provider.js +2 -4
- package/dist/safe-bash-text-stream-engine/stream-format/shared.d.ts +0 -2
- package/dist/safe-bash-text-stream-engine/stream-format/shared.js +1 -9
- package/dist/safe-bash-xml-engine/document.js +2 -2
- package/dist/safe-bash-xml-engine/index.js +3 -3
- package/dist/safe-bash-xml-engine/io.js +1 -1
- package/dist/safe-bash-xml-engine/limits.d.ts +0 -2
- package/dist/safe-bash-xml-engine/limits.js +1 -1
- package/dist/safe-bash-xml-engine/query.js +2 -2
- package/package.json +5 -4
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
defaultPdfLimits,
|
|
4
4
|
renderPdf,
|
|
5
5
|
suppliedDefaultFont
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QRRYN2KO.js";
|
|
7
7
|
import {
|
|
8
8
|
createZipCodec
|
|
9
9
|
} from "./chunk-MKQVQMXO.js";
|
|
@@ -19,11 +19,12 @@ import {
|
|
|
19
19
|
import {
|
|
20
20
|
createCiteprocFilterCapability,
|
|
21
21
|
defaultTreeAdapter,
|
|
22
|
+
encodeXML,
|
|
22
23
|
htmlReader,
|
|
23
24
|
htmlTreeDocument,
|
|
24
25
|
html_exports,
|
|
25
26
|
parseFragment
|
|
26
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-Y6TUZWPS.js";
|
|
27
28
|
import {
|
|
28
29
|
AstError,
|
|
29
30
|
PandocError
|
|
@@ -40,7 +41,7 @@ import {
|
|
|
40
41
|
init_buffer
|
|
41
42
|
} from "./chunk-HX3SHTCE.js";
|
|
42
43
|
|
|
43
|
-
// packages/safe-bash-command-pandoc/dist/chunks/chunk-
|
|
44
|
+
// packages/safe-bash-command-pandoc/dist/chunks/chunk-BVLWOSZS.js
|
|
44
45
|
init_buffer();
|
|
45
46
|
import * as gfm_syntax_star from "../../safe-bash-markdown-engine/gfm-syntax.js";
|
|
46
47
|
import * as commonmark_blocks_star from "../../safe-bash-markdown-engine/commonmark-blocks.js";
|
|
@@ -3791,7 +3792,7 @@ async function parseStrictJson(text, context, error, number = () => {
|
|
|
3791
3792
|
continue;
|
|
3792
3793
|
}
|
|
3793
3794
|
if (cursor === text.length) error(cursor, "Incomplete JSON escape");
|
|
3794
|
-
const
|
|
3795
|
+
const escape2 = await step();
|
|
3795
3796
|
const escapes = {
|
|
3796
3797
|
'"': '"',
|
|
3797
3798
|
"\\": "\\",
|
|
@@ -3802,11 +3803,11 @@ async function parseStrictJson(text, context, error, number = () => {
|
|
|
3802
3803
|
r: "\r",
|
|
3803
3804
|
t: " "
|
|
3804
3805
|
};
|
|
3805
|
-
if (Object.hasOwn(escapes,
|
|
3806
|
-
append2(escapes[
|
|
3806
|
+
if (Object.hasOwn(escapes, escape2)) {
|
|
3807
|
+
append2(escapes[escape2]);
|
|
3807
3808
|
continue;
|
|
3808
3809
|
}
|
|
3809
|
-
if (
|
|
3810
|
+
if (escape2 !== "u") error(cursor - 1, "Invalid JSON escape");
|
|
3810
3811
|
let code = 0;
|
|
3811
3812
|
for (let i = 0; i < 4; i++) {
|
|
3812
3813
|
if (cursor === text.length) error(cursor, "Incomplete JSON Unicode escape");
|
|
@@ -9776,7 +9777,7 @@ var epubWriter = {
|
|
|
9776
9777
|
const fail3 = (message, code = "E_CAPABILITY") => {
|
|
9777
9778
|
throw new PandocError(code, ctx.operation ?? "write", message, "epub");
|
|
9778
9779
|
};
|
|
9779
|
-
const
|
|
9780
|
+
const escape2 = (value) => {
|
|
9780
9781
|
ctx.checkpoint(value.length);
|
|
9781
9782
|
let result = "";
|
|
9782
9783
|
for (const ch of value) {
|
|
@@ -9825,7 +9826,7 @@ var epubWriter = {
|
|
|
9825
9826
|
await ctx.cooperate();
|
|
9826
9827
|
const name = resource.id;
|
|
9827
9828
|
if (!name || name.startsWith("/") || name.includes(":") || name.includes("\\") || name.split("/").some((p) => !p || p === "." || p === "..")) fail3("Unsafe declared resource key", "E_RESOURCE");
|
|
9828
|
-
|
|
9829
|
+
escape2(name);
|
|
9829
9830
|
if (media.has(name)) fail3("Duplicate declared resource key", "E_RESOURCE");
|
|
9830
9831
|
const ext = name.slice(name.lastIndexOf(".") + 1).toLowerCase();
|
|
9831
9832
|
const b = resource.bytes;
|
|
@@ -9930,13 +9931,13 @@ var epubWriter = {
|
|
|
9930
9931
|
for (const resource of media.values()) if (!resource.used) fail3("Orphan declared resource", "E_RESOURCE");
|
|
9931
9932
|
const serialize = (node) => {
|
|
9932
9933
|
ctx.checkpoint();
|
|
9933
|
-
if (defaultTreeAdapter.isTextNode(node)) return
|
|
9934
|
+
if (defaultTreeAdapter.isTextNode(node)) return escape2(node.value);
|
|
9934
9935
|
if (!defaultTreeAdapter.isElementNode(node)) return "";
|
|
9935
|
-
const attrs = node.attrs.map((a) => ` ${a.name}="${
|
|
9936
|
+
const attrs = node.attrs.map((a) => ` ${a.name}="${escape2(a.value)}"`).join("");
|
|
9936
9937
|
if (["br", "hr", "img", "col"].includes(node.tagName)) return `<${node.tagName}${attrs}/>`;
|
|
9937
9938
|
return `<${node.tagName}${attrs}>${node.childNodes.map(serialize).join("")}</${node.tagName}>`;
|
|
9938
9939
|
};
|
|
9939
|
-
const xhtml = (body, name) => `<?xml version="1.0" encoding="UTF-8"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" lang="${
|
|
9940
|
+
const xhtml = (body, name) => `<?xml version="1.0" encoding="UTF-8"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" lang="${escape2(lang)}" xml:lang="${escape2(lang)}"><head><title>${escape2(name)}</title><link rel="stylesheet" type="text/css" href="style.css"/></head><body>${body}</body></html>`;
|
|
9940
9941
|
const parts = /* @__PURE__ */ new Map();
|
|
9941
9942
|
let total = 0;
|
|
9942
9943
|
const add = (name, value) => {
|
|
@@ -9954,8 +9955,8 @@ var epubWriter = {
|
|
|
9954
9955
|
add("EPUB/style.css", css);
|
|
9955
9956
|
for (const chapter of chapters) add(`EPUB/${chapter.name}`, xhtml(chapter.nodes.map(serialize).join(""), title));
|
|
9956
9957
|
for (const resource of media.values()) add(`EPUB/${resource.path}`, resource.bytes);
|
|
9957
|
-
if (cover !== void 0) add("EPUB/cover.xhtml", xhtml(`<section class="cover" epub:type="cover"><h1>${
|
|
9958
|
-
add("EPUB/nav.xhtml", xhtml(`<nav epub:type="toc" id="toc"><h1>Contents</h1><ol>${toc.map((t) => `<li class="level-${t.level}"><a href="${
|
|
9958
|
+
if (cover !== void 0) add("EPUB/cover.xhtml", xhtml(`<section class="cover" epub:type="cover"><h1>${escape2(title)}</h1><img src="${uri(media.get(cover).path)}" alt="${escape2(title)}"/></section>`, title));
|
|
9959
|
+
add("EPUB/nav.xhtml", xhtml(`<nav epub:type="toc" id="toc"><h1>Contents</h1><ol>${toc.map((t) => `<li class="level-${t.level}"><a href="${escape2(t.href)}">${escape2(t.label)}</a></li>`).join("")}</ol></nav>${cover === void 0 ? "" : '<nav epub:type="landmarks"><h2>Landmarks</h2><ol><li><a epub:type="cover" href="cover.xhtml">Cover</a></li></ol></nav>'}`, "Contents"));
|
|
9959
9960
|
const digestInput = [];
|
|
9960
9961
|
let digestSize = 0;
|
|
9961
9962
|
for (const [name, bytes] of parts) {
|
|
@@ -9977,8 +9978,8 @@ var epubWriter = {
|
|
|
9977
9978
|
const digest = new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256", input));
|
|
9978
9979
|
ctx.checkpoint();
|
|
9979
9980
|
const identifier2 = explicitIdentifier ?? `urn:sha256:${[...digest].map((n) => n.toString(16).padStart(2, "0")).join("")}`;
|
|
9980
|
-
const items = [`<item id="nav" href="nav.xhtml" media-type="application/xhtml+xml" properties="nav"/>`, '<item id="css" href="style.css" media-type="text/css"/>', ...chapters.map((c, i) => `<item id="chapter-${i + 1}" href="${c.name}" media-type="application/xhtml+xml"/>`), ...[...media.entries()].map(([key, r], i) => `<item id="resource-${i + 1}" href="${
|
|
9981
|
-
add("EPUB/package.opf", `<?xml version="1.0" encoding="UTF-8"?><package xmlns="http://www.idpf.org/2007/opf" version="3.0" unique-identifier="publication-id"><metadata xmlns:dc="http://purl.org/dc/elements/1.1/"><dc:identifier id="publication-id">${
|
|
9981
|
+
const items = [`<item id="nav" href="nav.xhtml" media-type="application/xhtml+xml" properties="nav"/>`, '<item id="css" href="style.css" media-type="text/css"/>', ...chapters.map((c, i) => `<item id="chapter-${i + 1}" href="${c.name}" media-type="application/xhtml+xml"/>`), ...[...media.entries()].map(([key, r], i) => `<item id="resource-${i + 1}" href="${escape2(uri(r.path))}" media-type="${r.type}"${key === cover ? ' properties="cover-image"' : ""}/>`), ...cover === void 0 ? [] : ['<item id="cover" href="cover.xhtml" media-type="application/xhtml+xml"/>']];
|
|
9982
|
+
add("EPUB/package.opf", `<?xml version="1.0" encoding="UTF-8"?><package xmlns="http://www.idpf.org/2007/opf" version="3.0" unique-identifier="publication-id"><metadata xmlns:dc="http://purl.org/dc/elements/1.1/"><dc:identifier id="publication-id">${escape2(identifier2)}</dc:identifier><dc:title>${escape2(title)}</dc:title><dc:language>${escape2(lang)}</dc:language><meta property="dcterms:modified">${modified}</meta></metadata><manifest>${items.join("")}</manifest><spine>${cover === void 0 ? "" : '<itemref idref="cover"/>'}${chapters.map((_, i) => `<itemref idref="chapter-${i + 1}"/>`).join("")}</spine></package>`);
|
|
9982
9983
|
const signal = ctx.signal ?? new AbortController().signal;
|
|
9983
9984
|
const limits = { maxArchiveBytes: ctx.limits.outputBytes, maxEntryBytes: ctx.limits.expandedBytes, maxTotalBytes: ctx.limits.expandedBytes, maxMembers: ctx.limits.parts, maxPathBytes: ctx.limits.text, maxDepth: ctx.limits.depth, maxPaxBytes: ctx.limits.binaryBytes, maxTextBytes: ctx.limits.text, chunkSize: 4096 };
|
|
9984
9985
|
const zip = createZipCodec({ compression: createCompressionCodec(), yieldTurn: async () => ctx.cooperate(), fail: (message) => fail3(message, message.includes("limit") ? "E_LIMIT" : "E_CAPABILITY") }, { rejectDuplicateNames: true, validatePayloads: true });
|
|
@@ -10019,6 +10020,7 @@ var pdfWriter = {
|
|
|
10019
10020
|
throw new PandocError("E_CAPABILITY", ctx.operation ?? "write", message, "pdf");
|
|
10020
10021
|
};
|
|
10021
10022
|
if (document.direction === "rtl" || document.direction === "auto") fail3("PDF profile requires explicit LTR text");
|
|
10023
|
+
const styledFonts = /* @__PURE__ */ new Map();
|
|
10022
10024
|
const notes = [];
|
|
10023
10025
|
const runs = async (nodes, size = ctx.pdf?.fontSize ?? 12, link, style = {}) => {
|
|
10024
10026
|
const result = [];
|
|
@@ -10027,8 +10029,15 @@ var pdfWriter = {
|
|
|
10027
10029
|
ctx.charge("references", 1);
|
|
10028
10030
|
if (node.t === "Str" || node.t === "Space" || node.t === "SoftBreak" || node.t === "LineBreak" || node.t === "Code") {
|
|
10029
10031
|
const text = node.t === "Str" ? node.c : node.t === "Code" ? node.c[1] : node.t === "LineBreak" ? "\n" : " ";
|
|
10032
|
+
let font;
|
|
10033
|
+
if (!ctx.pdfFonts && (style.bold || style.italic || node.t === "Code")) {
|
|
10034
|
+
const family = node.t === "Code" ? "Courier" : "Helvetica";
|
|
10035
|
+
const name = family + (style.bold && style.italic ? "-BoldOblique" : style.bold ? "-Bold" : style.italic ? "-Oblique" : "");
|
|
10036
|
+
font = `standard:${name}`;
|
|
10037
|
+
styledFonts.set(name, { id: font, standard: name });
|
|
10038
|
+
}
|
|
10030
10039
|
ctx.charge("retainedBytes", text.length * 2 + 64);
|
|
10031
|
-
result.push({ text, size, ...style, ...link === void 0 ? {} : { link } });
|
|
10040
|
+
result.push({ text, size, ...style, ...font === void 0 ? {} : { font }, ...link === void 0 ? {} : { link } });
|
|
10032
10041
|
} else if (node.t === "Link") result.push(...await runs(node.c[1], size, node.c[2][0], style));
|
|
10033
10042
|
else if (node.t === "Span") result.push(...await runs(node.c[1], size, link, style));
|
|
10034
10043
|
else if (node.t === "Math") {
|
|
@@ -10158,11 +10167,11 @@ var pdfWriter = {
|
|
|
10158
10167
|
}
|
|
10159
10168
|
}
|
|
10160
10169
|
const budgetMap = { fontBytes: "binaryBytes", fonts: "fonts", glyphs: "glyphs", pages: "pages", objects: "objects", images: "images", imageBytes: "binaryBytes", decodedImageBytes: "retainedBytes", layoutWork: "layoutWork" };
|
|
10161
|
-
ctx.bound("fonts", ctx.pdfFonts?.length ?? 1);
|
|
10162
|
-
const fonts = ctx.pdfFonts ?? [suppliedDefaultFont((size) => {
|
|
10170
|
+
ctx.bound("fonts", (ctx.pdfFonts?.length ?? 1) + styledFonts.size);
|
|
10171
|
+
const fonts = [...ctx.pdfFonts ?? [suppliedDefaultFont((size) => {
|
|
10163
10172
|
ctx.bound("binaryBytes", size);
|
|
10164
10173
|
ctx.charge("retainedBytes", size * 2);
|
|
10165
|
-
})];
|
|
10174
|
+
})], ...styledFonts.values()];
|
|
10166
10175
|
try {
|
|
10167
10176
|
const bytes = await renderPdf({ blocks: blocks3, fonts, metadata: metadata2, ...ctx.pdf?.lineHeight === void 0 ? {} : { lineHeight: ctx.pdf.lineHeight }, ...ctx.pdfPage === void 0 ? {} : { page: ctx.pdfPage } }, { signal: ctx.signal, yield: () => ctx.cooperate(256), limits: { outputBytes: ctx.limits.outputBytes }, charge: (key, amount) => {
|
|
10168
10177
|
const mapped = budgetMap[key];
|
|
@@ -10407,6 +10416,19 @@ var pdf_default = {
|
|
|
10407
10416
|
write: ["standalone", "pdfPage", "pdfFonts", "pdf"]
|
|
10408
10417
|
}
|
|
10409
10418
|
};
|
|
10419
|
+
var EntityLevel;
|
|
10420
|
+
(function(EntityLevel2) {
|
|
10421
|
+
EntityLevel2[EntityLevel2["XML"] = 0] = "XML";
|
|
10422
|
+
EntityLevel2[EntityLevel2["HTML"] = 1] = "HTML";
|
|
10423
|
+
})(EntityLevel || (EntityLevel = {}));
|
|
10424
|
+
var EncodingMode;
|
|
10425
|
+
(function(EncodingMode2) {
|
|
10426
|
+
EncodingMode2[EncodingMode2["UTF8"] = 0] = "UTF8";
|
|
10427
|
+
EncodingMode2[EncodingMode2["ASCII"] = 1] = "ASCII";
|
|
10428
|
+
EncodingMode2[EncodingMode2["Extensive"] = 2] = "Extensive";
|
|
10429
|
+
EncodingMode2[EncodingMode2["Attribute"] = 3] = "Attribute";
|
|
10430
|
+
EncodingMode2[EncodingMode2["Text"] = 4] = "Text";
|
|
10431
|
+
})(EncodingMode || (EncodingMode = {}));
|
|
10410
10432
|
var attr2 = ["", [], []];
|
|
10411
10433
|
async function modelContext(ctx) {
|
|
10412
10434
|
const { DocumentBudget } = await import("./src-UJOWAS2S.js");
|
|
@@ -10479,13 +10501,18 @@ var docxReader = { format: "docx", async read(input, ctx) {
|
|
|
10479
10501
|
var docxWriter = { format: "docx", async write(document, ctx) {
|
|
10480
10502
|
return guarded(ctx, async () => {
|
|
10481
10503
|
const blocks3 = [];
|
|
10482
|
-
const
|
|
10504
|
+
const paragraphs = [];
|
|
10505
|
+
const numbering2 = [];
|
|
10506
|
+
const w = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
10507
|
+
const r = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
10508
|
+
const runs = (nodes, bold = false, italic = false, link) => {
|
|
10483
10509
|
const result = [];
|
|
10484
10510
|
for (const node of nodes) {
|
|
10485
10511
|
ctx.checkpoint();
|
|
10486
|
-
if (node.t === "Strong") result.push(...runs(node.c, true, italic));
|
|
10487
|
-
else if (node.t === "Emph") result.push(...runs(node.c, bold, true));
|
|
10488
|
-
else if (node.t === "Span") result.push(...runs(node.c[1], bold, italic));
|
|
10512
|
+
if (node.t === "Strong") result.push(...runs(node.c, true, italic, link));
|
|
10513
|
+
else if (node.t === "Emph") result.push(...runs(node.c, bold, true, link));
|
|
10514
|
+
else if (node.t === "Span") result.push(...runs(node.c[1], bold, italic, link));
|
|
10515
|
+
else if (node.t === "Link") result.push(...runs(node.c[1], bold, italic, node.c[2][0]));
|
|
10489
10516
|
else {
|
|
10490
10517
|
let text;
|
|
10491
10518
|
if (node.t === "Str") text = node.c;
|
|
@@ -10493,25 +10520,100 @@ var docxWriter = { format: "docx", async write(document, ctx) {
|
|
|
10493
10520
|
else if (node.t === "LineBreak") text = "\n";
|
|
10494
10521
|
else if (node.t === "Code") text = node.c[1];
|
|
10495
10522
|
else throw new PandocError("E_UNSUPPORTED_FEATURE", "write", `Unsupported DOCX inline: ${node.t}`, "docx");
|
|
10496
|
-
result.push({ text, bold, italic });
|
|
10523
|
+
result.push({ text, bold, italic, ...link === void 0 ? {} : { link } });
|
|
10497
10524
|
}
|
|
10498
10525
|
}
|
|
10499
10526
|
return result;
|
|
10500
10527
|
};
|
|
10501
|
-
|
|
10502
|
-
|
|
10503
|
-
|
|
10504
|
-
|
|
10505
|
-
|
|
10506
|
-
|
|
10507
|
-
|
|
10508
|
-
|
|
10528
|
+
const paragraph = (target, content, properties, level) => {
|
|
10529
|
+
paragraphs.push({ runs: content, properties });
|
|
10530
|
+
target.push({ kind: "paragraph", ...level === void 0 ? {} : { level }, runs: content.map(({ link: _link, ...run }) => run) });
|
|
10531
|
+
};
|
|
10532
|
+
const visit5 = async (nodes, target, indent3 = 0, list2) => {
|
|
10533
|
+
for (const block2 of nodes) {
|
|
10534
|
+
await ctx.cooperate();
|
|
10535
|
+
const properties = (list2?.pending ? `<w:numPr><w:ilvl w:val="${list2.level}"/><w:numId w:val="${list2.id}"/></w:numPr>` : "") + (indent3 ? `<w:ind w:left="${indent3}"/>` : "");
|
|
10536
|
+
if (block2.t === "Header") {
|
|
10537
|
+
paragraph(target, runs(block2.c[2]), properties, block2.c[0]);
|
|
10538
|
+
if (list2) list2.pending = false;
|
|
10539
|
+
} else if (block2.t === "Para" || block2.t === "Plain") {
|
|
10540
|
+
paragraph(target, runs(block2.c), properties);
|
|
10541
|
+
if (list2) list2.pending = false;
|
|
10542
|
+
} else if (block2.t === "CodeBlock") {
|
|
10543
|
+
paragraph(target, [{ text: block2.c[1] }], properties);
|
|
10544
|
+
if (list2) list2.pending = false;
|
|
10545
|
+
} else if (block2.t === "Div") await visit5(block2.c[1], target, indent3, list2);
|
|
10546
|
+
else if (block2.t === "BlockQuote") await visit5(block2.c, target, indent3 + 720, list2);
|
|
10547
|
+
else if (block2.t === "HorizontalRule") paragraph(target, [], `<w:pBdr><w:bottom w:val="single" w:sz="6" w:space="1" w:color="auto"/></w:pBdr>`);
|
|
10548
|
+
else if (block2.t === "BulletList" || block2.t === "OrderedList") {
|
|
10549
|
+
const level = list2 ? list2.level + 1 : 0;
|
|
10550
|
+
if (level > 8) throw new PandocError("E_UNSUPPORTED_FEATURE", "write", "DOCX lists support at most nine levels", "docx");
|
|
10551
|
+
const id = numbering2.length + 1;
|
|
10552
|
+
const styles = { DefaultStyle: "decimal", Decimal: "decimal", LowerAlpha: "lowerLetter", UpperAlpha: "upperLetter", LowerRoman: "lowerRoman", UpperRoman: "upperRoman" };
|
|
10553
|
+
const format2 = block2.t === "BulletList" ? "bullet" : styles[block2.c[0][1]];
|
|
10554
|
+
if (!format2) throw new PandocError("E_UNSUPPORTED_FEATURE", "write", "Unsupported DOCX list style", "docx");
|
|
10555
|
+
const marker = block2.t === "BulletList" ? "\u2022" : block2.c[0][2] === "TwoParens" ? `(%${level + 1})` : block2.c[0][2] === "OneParen" ? `%${level + 1})` : `%${level + 1}.`;
|
|
10556
|
+
numbering2.push(`<w:abstractNum w:abstractNumId="${id}"><w:multiLevelType w:val="multilevel"/><w:lvl w:ilvl="${level}"><w:start w:val="${block2.t === "BulletList" ? 1 : block2.c[0][0]}"/><w:numFmt w:val="${format2}"/><w:lvlText w:val="${marker}"/><w:pPr><w:ind w:left="${720 * (level + 1)}" w:hanging="360"/></w:pPr></w:lvl></w:abstractNum>`);
|
|
10557
|
+
for (const item of block2.t === "BulletList" ? block2.c : block2.c[1]) await visit5(item, target, indent3, { id, level, pending: true });
|
|
10558
|
+
} else if (block2.t === "Table") {
|
|
10559
|
+
if (block2.c[1][1].length) await visit5(block2.c[1][1], target, indent3);
|
|
10560
|
+
else if (block2.c[1][0]?.length) paragraph(target, runs(block2.c[1][0]), "");
|
|
10561
|
+
const rows = [];
|
|
10562
|
+
for (const row2 of [...block2.c[3][1], ...block2.c[4].flatMap((body) => [...body[2], ...body[3]]), ...block2.c[5][1]]) {
|
|
10563
|
+
const cells = [];
|
|
10564
|
+
for (const cell2 of row2[1]) {
|
|
10565
|
+
if (cell2[2] !== 1 || cell2[3] !== 1) throw new PandocError("E_UNSUPPORTED_FEATURE", "write", "DOCX table spans are unsupported", "docx");
|
|
10566
|
+
const children2 = [];
|
|
10567
|
+
await visit5(cell2[4], children2);
|
|
10568
|
+
if (!children2.length || children2.at(-1)?.kind !== "paragraph") paragraph(children2, [], "");
|
|
10569
|
+
cells.push({ blocks: children2 });
|
|
10570
|
+
}
|
|
10571
|
+
rows.push(cells);
|
|
10572
|
+
}
|
|
10573
|
+
target.push({ kind: "table", rows, headerRows: block2.c[3][1].length });
|
|
10574
|
+
} else throw new PandocError("E_UNSUPPORTED_FEATURE", "write", `Unsupported DOCX block: ${block2.t}`, "docx");
|
|
10575
|
+
}
|
|
10576
|
+
};
|
|
10577
|
+
await visit5(document.blocks, blocks3);
|
|
10578
|
+
const { createDocumentArchive, writeDocumentArchive, DocumentXmlEditor } = await import("./src-UJOWAS2S.js");
|
|
10509
10579
|
const mc = await modelContext(ctx);
|
|
10510
10580
|
const archiveContext = { signal: mc.signal, budget: mc.budget };
|
|
10511
10581
|
const archive = await createDocumentArchive({ content: { version: 1, blocks: blocks3 } }, archiveContext);
|
|
10582
|
+
const main = new DocumentXmlEditor(archive.members.find((member) => member.name === "word/document.xml").bytes, {}, void 0, mc.budget);
|
|
10583
|
+
const relationships = new DocumentXmlEditor(archive.members.find((member) => member.name === "word/_rels/document.xml.rels").bytes, {}, void 0, mc.budget);
|
|
10584
|
+
let paragraphIndex = 0, relationshipId = 2;
|
|
10585
|
+
const linkRelationships = [];
|
|
10586
|
+
const edit = async (node) => {
|
|
10587
|
+
await ctx.cooperate();
|
|
10588
|
+
if (node.namespace === w && node.localName === "p") {
|
|
10589
|
+
const extra = paragraphs[paragraphIndex++];
|
|
10590
|
+
if (!extra) return;
|
|
10591
|
+
const replacements = /* @__PURE__ */ new Map();
|
|
10592
|
+
const properties = node.children.find((child) => child.localName === "pPr");
|
|
10593
|
+
if (properties && extra.properties) replacements.set(properties, `<w:pPr>${main.sourceXml(properties, /* @__PURE__ */ new Map(), true)}${extra.properties}</w:pPr>`);
|
|
10594
|
+
const nativeRuns = node.children.filter((child) => child.localName === "r");
|
|
10595
|
+
for (const [index, run] of extra.runs.entries()) if (run.link !== void 0) {
|
|
10596
|
+
ctx.checkpoint();
|
|
10597
|
+
const native = nativeRuns[index];
|
|
10598
|
+
const anchor = run.link.startsWith("#");
|
|
10599
|
+
const id = `rId${relationshipId++}`;
|
|
10600
|
+
if (!anchor) linkRelationships.push(`<Relationship Id="${id}" Type="${r}/hyperlink" Target="${encodeXML(run.link)}" TargetMode="External"/>`);
|
|
10601
|
+
replacements.set(native, `<w:hyperlink ${anchor ? `w:anchor="${encodeXML(run.link.slice(1))}"` : `xmlns:r="${r}" r:id="${id}"`}>${main.sourceXml(native)}</w:hyperlink>`);
|
|
10602
|
+
}
|
|
10603
|
+
if (extra.properties || replacements.size) main.replaceElement(node, `<w:p xmlns:w="${w}">${!properties && extra.properties ? `<w:pPr>${extra.properties}</w:pPr>` : ""}${main.sourceXml(node, replacements, true)}</w:p>`);
|
|
10604
|
+
} else for (const child of node.children) await edit(child);
|
|
10605
|
+
};
|
|
10606
|
+
await edit(main.root);
|
|
10607
|
+
if (numbering2.length) linkRelationships.push(`<Relationship Id="rId${relationshipId++}" Type="${r}/numbering" Target="numbering.xml"/>`);
|
|
10608
|
+
if (linkRelationships.length) relationships.insertChildren(relationships.root, linkRelationships.map((xml) => xml.replace("<Relationship ", '<Relationship xmlns="http://schemas.openxmlformats.org/package/2006/relationships" ')).join(""));
|
|
10609
|
+
const types = new DocumentXmlEditor(archive.members.find((member) => member.name === "[Content_Types].xml").bytes, {}, void 0, mc.budget);
|
|
10610
|
+
if (numbering2.length) types.insertChildren(types.root, '<Override xmlns="http://schemas.openxmlformats.org/package/2006/content-types" PartName="/word/numbering.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"/>');
|
|
10611
|
+
const parts = /* @__PURE__ */ new Map([["word/document.xml", main.serialize()], ["word/_rels/document.xml.rels", relationships.serialize()], ["[Content_Types].xml", types.serialize()]]);
|
|
10612
|
+
const members = archive.members.map((member) => ({ ...member, bytes: parts.get(member.name) ?? member.bytes }));
|
|
10613
|
+
if (numbering2.length) members.push({ name: "word/numbering.xml", bytes: new TextEncoder().encode(`<w:numbering xmlns:w="${w}">${numbering2.join("")}${numbering2.map((_, i) => `<w:num w:numId="${i + 1}"><w:abstractNumId w:val="${i + 1}"/></w:num>`).join("")}</w:numbering>`), directory: false, modified: /* @__PURE__ */ new Date(0) });
|
|
10512
10614
|
const chunks = [];
|
|
10513
10615
|
let size = 0;
|
|
10514
|
-
await writeDocumentArchive(archive, { async write(bytes2) {
|
|
10616
|
+
await writeDocumentArchive({ members, comment: archive.comment }, { async write(bytes2) {
|
|
10515
10617
|
size += bytes2.length;
|
|
10516
10618
|
ctx.bound("outputBytes", size);
|
|
10517
10619
|
ctx.charge("retainedBytes", bytes2.length);
|
|
@@ -10551,7 +10653,7 @@ var pptx_default = {
|
|
|
10551
10653
|
format: "pptx",
|
|
10552
10654
|
async read(input, context, selection) {
|
|
10553
10655
|
context.signal?.throwIfAborted();
|
|
10554
|
-
const { pptxReader } = await import("./pptx-
|
|
10656
|
+
const { pptxReader } = await import("./pptx-GBPNWNEP-7EQEVXV5.js");
|
|
10555
10657
|
context.signal?.throwIfAborted();
|
|
10556
10658
|
return pptxReader.read(input, context, selection);
|
|
10557
10659
|
}
|
|
@@ -10560,7 +10662,7 @@ var pptx_default = {
|
|
|
10560
10662
|
format: "pptx",
|
|
10561
10663
|
async write(document, context, selection) {
|
|
10562
10664
|
context.signal?.throwIfAborted();
|
|
10563
|
-
const { pptxWriter } = await import("./pptx-
|
|
10665
|
+
const { pptxWriter } = await import("./pptx-GBPNWNEP-7EQEVXV5.js");
|
|
10564
10666
|
context.signal?.throwIfAborted();
|
|
10565
10667
|
return pptxWriter.write(document, context, selection);
|
|
10566
10668
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
help,
|
|
3
3
|
parse
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-Q7Q5GM5S.js";
|
|
5
5
|
import {
|
|
6
6
|
settings
|
|
7
7
|
} from "./chunk-EHVMZ2NP.js";
|
|
8
8
|
import {
|
|
9
9
|
matches
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-BZPAWTUL.js";
|
|
11
11
|
import {
|
|
12
12
|
TreeLimitError,
|
|
13
13
|
UsageError,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
escaped,
|
|
16
16
|
escapedName,
|
|
17
17
|
message
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-PFAADCB5.js";
|
|
19
19
|
import {
|
|
20
20
|
compareVersions
|
|
21
21
|
} from "./chunk-N6TXEPXL.js";
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
init_buffer();
|
|
7
7
|
import { getCommandArguments } from "../../safe-bash-contracts/index.js";
|
|
8
8
|
import { shellValueByteLength, shellValueBytes } from "../../safe-bash-contracts/value.js";
|
|
9
|
-
import {
|
|
9
|
+
import { yieldTurn } from "../../safe-bash-contracts/yield.js";
|
|
10
10
|
import { PublicDiagnostic } from "../../safe-bash-contracts/diagnostics.js";
|
|
11
11
|
function settings(options) {
|
|
12
12
|
const limits = {
|
|
@@ -114,8 +114,6 @@ var Budget = class {
|
|
|
114
114
|
signal;
|
|
115
115
|
work = 0;
|
|
116
116
|
checkpoint = 0;
|
|
117
|
-
checkpointCount = 0;
|
|
118
|
-
lastYield = monotonicNow();
|
|
119
117
|
retained = 0;
|
|
120
118
|
input = 0;
|
|
121
119
|
output = 0;
|
|
@@ -137,15 +135,7 @@ var Budget = class {
|
|
|
137
135
|
this.assertSignalOpen();
|
|
138
136
|
if (this.work - this.checkpoint < 4096) return;
|
|
139
137
|
this.checkpoint = this.work;
|
|
140
|
-
|
|
141
|
-
const now = monotonicNow();
|
|
142
|
-
if (count === 1 || count % 16 === 0 || now - this.lastYield >= 16 || hasYieldCheckpoint(this.signal)) {
|
|
143
|
-
this.lastYield = now;
|
|
144
|
-
return yieldTurn(this.signal).then(() => {
|
|
145
|
-
this.lastYield = monotonicNow();
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
return runYieldCheckpoint(this.signal);
|
|
138
|
+
return yieldTurn(this.signal);
|
|
149
139
|
}
|
|
150
140
|
retain(amount) {
|
|
151
141
|
this.check(this.retained + amount, this.limits.maxBufferedBytes, "buffered bytes");
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
describe
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YZ5SVZFD.js";
|
|
4
4
|
import {
|
|
5
5
|
JqError,
|
|
6
6
|
JqLimitError,
|
|
7
7
|
object,
|
|
8
8
|
put
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-VVI4Z73I.js";
|
|
10
10
|
import {
|
|
11
11
|
init_buffer
|
|
12
12
|
} from "./chunk-HX3SHTCE.js";
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
} from "./chunk-K6WIMONJ.js";
|
|
8
8
|
import {
|
|
9
9
|
Outputs
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-AXK3H4PX.js";
|
|
11
11
|
import {
|
|
12
12
|
Budget,
|
|
13
13
|
Cursor,
|
|
14
14
|
interruptible
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-MRW5HD2D.js";
|
|
16
16
|
import {
|
|
17
17
|
init_buffer
|
|
18
18
|
} from "./chunk-HX3SHTCE.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
describe
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YZ5SVZFD.js";
|
|
4
4
|
import {
|
|
5
5
|
JqError,
|
|
6
6
|
JqLimitError,
|
|
7
7
|
object,
|
|
8
8
|
put
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-VVI4Z73I.js";
|
|
10
10
|
import {
|
|
11
11
|
utf8ByteLength
|
|
12
12
|
} from "./chunk-PDKXAR4Y.js";
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
|
|
5
5
|
// packages/safe-bash-xml-engine/src/limits.ts
|
|
6
6
|
init_buffer();
|
|
7
|
-
import { hasYieldCheckpoint, monotonicNow, runYieldCheckpoint, yieldTurn } from "../../safe-bash-contracts/yield.js";
|
|
8
7
|
var defaultXmlQueryLimits = Object.freeze({
|
|
9
8
|
maxInputBytes: Infinity,
|
|
10
9
|
maxOutputBytes: Infinity,
|
|
@@ -56,8 +55,6 @@ var XmlBudget = class {
|
|
|
56
55
|
checkpointTurn;
|
|
57
56
|
steps = 0;
|
|
58
57
|
checkpoint = 0;
|
|
59
|
-
checkpointCount = 0;
|
|
60
|
-
lastYield = monotonicNow();
|
|
61
58
|
aborted = false;
|
|
62
59
|
pollSignal;
|
|
63
60
|
outputBytes = 0;
|
|
@@ -69,14 +66,7 @@ var XmlBudget = class {
|
|
|
69
66
|
this.checkpoint += work;
|
|
70
67
|
if (this.checkpoint >= 16384) {
|
|
71
68
|
this.checkpoint = 0;
|
|
72
|
-
|
|
73
|
-
if ((++this.checkpointCount & 15) === 0 || this.checkpointTurn !== yieldTurn || hasYieldCheckpoint(this.signal) || now - this.lastYield >= 16) {
|
|
74
|
-
this.lastYield = now;
|
|
75
|
-
return this.checkpointTurn(this.signal).then(() => {
|
|
76
|
-
this.lastYield = monotonicNow();
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
runYieldCheckpoint(this.signal);
|
|
69
|
+
return this.checkpointTurn(this.signal);
|
|
80
70
|
}
|
|
81
71
|
}
|
|
82
72
|
results(size) {
|
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
equal,
|
|
3
3
|
indexValue,
|
|
4
4
|
sliceValue
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-YZ5SVZFD.js";
|
|
6
6
|
import {
|
|
7
7
|
JqError,
|
|
8
8
|
JqLimitError,
|
|
9
9
|
isObject
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-VVI4Z73I.js";
|
|
11
11
|
import {
|
|
12
12
|
encoder
|
|
13
13
|
} from "./chunk-PDKXAR4Y.js";
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
|
|
5
5
|
// packages/safe-bash-command-split/src/io.ts
|
|
6
6
|
init_buffer();
|
|
7
|
-
import {
|
|
7
|
+
import { yieldTurn } from "../../safe-bash-contracts/yield.js";
|
|
8
8
|
import { FsError, readBytes } from "../../safe-bash-contracts/index.js";
|
|
9
9
|
import { pathOf } from "../../safe-bash-io-engine/internal.js";
|
|
10
10
|
var splitSignalWaiters = /* @__PURE__ */ new WeakMap();
|
|
@@ -56,8 +56,6 @@ var Budget = class {
|
|
|
56
56
|
outputBytes = 0;
|
|
57
57
|
steps = 0;
|
|
58
58
|
untilYield = 65536;
|
|
59
|
-
yieldChecks = 0;
|
|
60
|
-
lastYield = monotonicNow();
|
|
61
59
|
check(value, maximum, label) {
|
|
62
60
|
if (value > maximum) throw new FsError("EFBIG", { message: `split ${label} limit exceeded` });
|
|
63
61
|
}
|
|
@@ -77,13 +75,10 @@ var Budget = class {
|
|
|
77
75
|
this.untilYield -= count;
|
|
78
76
|
if (this.untilYield > 0) return;
|
|
79
77
|
this.untilYield = 65536;
|
|
80
|
-
if (++this.yieldChecks % 16 !== 0 && !hasYieldCheckpoint(this.signal) && monotonicNow() - this.lastYield < 16) return;
|
|
81
|
-
this.lastYield = monotonicNow();
|
|
82
78
|
return yieldTurn(this.signal).catch((error) => {
|
|
83
79
|
this.signal.throwIfAborted();
|
|
84
80
|
throw error;
|
|
85
81
|
}).then(() => {
|
|
86
|
-
this.lastYield = monotonicNow();
|
|
87
82
|
this.signal.throwIfAborted();
|
|
88
83
|
});
|
|
89
84
|
}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
init_buffer();
|
|
7
7
|
import { getCommandArguments } from "../../safe-bash-contracts/index.js";
|
|
8
8
|
import { shellValueByteLength, shellValueBytes } from "../../safe-bash-contracts/value.js";
|
|
9
|
-
import {
|
|
9
|
+
import { inheritYieldCheckpoint, yieldTurn } from "../../safe-bash-contracts/yield.js";
|
|
10
10
|
import { PublicDiagnostic } from "../../safe-bash-contracts/diagnostics.js";
|
|
11
11
|
function settings(options) {
|
|
12
12
|
const limits = {
|
|
@@ -119,8 +119,6 @@ var Budget = class {
|
|
|
119
119
|
signal;
|
|
120
120
|
work = 0;
|
|
121
121
|
checkpoint = 0;
|
|
122
|
-
yieldChecks = 0;
|
|
123
|
-
lastYield = monotonicNow();
|
|
124
122
|
retained = 0;
|
|
125
123
|
input = 0;
|
|
126
124
|
lines = 0;
|
|
@@ -144,13 +142,7 @@ var Budget = class {
|
|
|
144
142
|
this.assertSignalOpen();
|
|
145
143
|
if (this.work - this.checkpoint < 4096) return;
|
|
146
144
|
this.checkpoint = this.work;
|
|
147
|
-
if (++this.yieldChecks % 16 !== 0 && !hasYieldCheckpoint(this.signal) && monotonicNow() - this.lastYield < 25) {
|
|
148
|
-
runYieldCheckpoint(this.signal);
|
|
149
|
-
this.assertSignalOpen();
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
145
|
return yieldTurn(this.signal).then(() => {
|
|
153
|
-
this.lastYield = monotonicNow();
|
|
154
146
|
this.assertSignalOpen();
|
|
155
147
|
});
|
|
156
148
|
}
|