gutterpress 0.9.0-alpha.2 → 0.10.0-alpha.3

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.
Files changed (138) hide show
  1. package/README.md +18 -4
  2. package/dist/api/index.d.ts +11 -5
  3. package/dist/api/index.js +20 -15
  4. package/dist/assets/preview/scripts/preview-bridge.d.ts +1 -0
  5. package/dist/assets/preview/scripts/preview-interface.d.ts +1 -0
  6. package/dist/{audit-nhn2pjz3.js → audit-xxegv0t0.js} +10 -7
  7. package/dist/{build-san7fv2z.js → build-w0vb6mgq.js} +14 -8
  8. package/dist/checks/source/index.d.ts +1 -0
  9. package/dist/checks/source/layout-markers.d.ts +3 -0
  10. package/dist/checks/source/local-ref-parser.d.ts +28 -0
  11. package/dist/cli-46ycxe6r.js +18 -0
  12. package/dist/{cli-k4bd06sd.js → cli-5czby0dd.js} +4986 -5889
  13. package/dist/cli-c41yr7he.js +241 -0
  14. package/dist/{cli-e5zhb0xs.js → cli-f4rcbt2t.js} +17 -24
  15. package/dist/{cli-najycadg.js → cli-gk3wsdpb.js} +69 -253
  16. package/dist/{index-yzrh708h.js → cli-k1065rkg.js} +2 -5
  17. package/dist/{cli-506tg37g.js → cli-revgt4pr.js} +2 -1
  18. package/dist/{cli-wchtvxvw.js → cli-v5mp7a6q.js} +14 -1
  19. package/dist/cli-yp3p0sf2.js +2343 -0
  20. package/dist/cli.js +20 -18
  21. package/dist/{doctor-hrk0kxxz.js → doctor-ctgn1dnt.js} +4 -2
  22. package/dist/engine/compiler/build.d.ts +139 -0
  23. package/dist/engine/compiler/postprocess.d.ts +23 -0
  24. package/dist/engine/compiler/tier2.d.ts +78 -0
  25. package/dist/engine/shared/cdp.d.ts +104 -0
  26. package/dist/engine/shared/content-value.d.ts +64 -0
  27. package/dist/engine/shared/gcpm-extract.d.ts +119 -0
  28. package/dist/engine/shared/margin-box-support.d.ts +12 -0
  29. package/dist/engine/shared/pdf-inspect.d.ts +24 -0
  30. package/dist/engine/shared/synthesis.d.ts +155 -0
  31. package/dist/engine-eng4xh2q.js +41 -0
  32. package/dist/engine-q5skhgms.js +40 -0
  33. package/dist/gutterpress-agent-1ctgfz92.js +576 -0
  34. package/dist/gutterpress-viewer-cem7dmr5.js +2349 -0
  35. package/dist/index-a4kr77td.js +1907 -0
  36. package/dist/{cli-yzrh708h.js → index-mdefp0y5.js} +1 -1
  37. package/dist/index-mvehxh0e.js +708 -0
  38. package/dist/{index-bynn850m.js → index-s416qpdv.js} +3049 -4015
  39. package/dist/{index-wchtvxvw.js → index-v5mp7a6q.js} +14 -1
  40. package/dist/index.d.ts +3 -1
  41. package/dist/index.js +24 -17
  42. package/dist/lib/asset-inline.d.ts +36 -0
  43. package/dist/lib/browser-pool.d.ts +18 -0
  44. package/dist/lib/build-error.d.ts +1 -1
  45. package/dist/lib/build-preflight.d.ts +35 -2
  46. package/dist/lib/build-runner.d.ts +45 -17
  47. package/dist/lib/build-staging.d.ts +9 -55
  48. package/dist/lib/cli-args.d.ts +8 -0
  49. package/dist/lib/desktop.d.ts +2 -2
  50. package/dist/lib/embedded-assets.d.ts +1 -1
  51. package/dist/lib/engine.d.ts +33 -0
  52. package/dist/lib/ghostscript.d.ts +46 -1
  53. package/dist/lib/markdown/assemble.d.ts +18 -10
  54. package/dist/lib/markdown/gp-pin-scope.d.ts +1 -0
  55. package/dist/lib/markdown/gutterpress-css.d.ts +125 -0
  56. package/dist/lib/markdown/images.d.ts +26 -0
  57. package/dist/lib/markdown/index.d.ts +4 -2
  58. package/dist/lib/markdown/inline-source.d.ts +10 -0
  59. package/dist/lib/markdown/markers.d.ts +32 -0
  60. package/dist/lib/markdown/renderer.d.ts +8 -3
  61. package/dist/lib/markdown/source-range.d.ts +61 -0
  62. package/dist/lib/missing-asset-placeholder.d.ts +52 -0
  63. package/dist/lib/presets.d.ts +1 -1
  64. package/dist/lib/printsafe.d.ts +2 -3
  65. package/dist/lib/remote-auth/converge-merge.d.ts +48 -0
  66. package/dist/lib/remote-auth/image-clash.d.ts +17 -0
  67. package/dist/lib/remote-auth/recovery/classify.d.ts +55 -67
  68. package/dist/lib/remote-auth/recovery/inspect.d.ts +14 -13
  69. package/dist/lib/remote-auth/recovery/locks.d.ts +20 -0
  70. package/dist/lib/remote-auth/recovery/repair.d.ts +29 -0
  71. package/dist/lib/remote-auth/recovery/types.d.ts +8 -204
  72. package/dist/lib/remote-auth/sync-messages.d.ts +2 -3
  73. package/dist/lib/remote-auth/sync-types.d.ts +35 -63
  74. package/dist/lib/remote-auth/sync.d.ts +11 -18
  75. package/dist/lib/remote-auth/transport.d.ts +14 -7
  76. package/dist/lib/theme-import.d.ts +4 -5
  77. package/dist/{lint-96j9hrj4.js → lint-gsh6qwrq.js} +10 -7
  78. package/dist/{manifest.schema-z61rzw44.json → manifest.schema-zxgxnbg7.json} +21 -0
  79. package/dist/{new-8p38wavc.js → new-nkhycqy4.js} +12 -8
  80. package/dist/{plugin-ees6nhkc.js → plugin-129wcs93.js} +10 -7
  81. package/dist/{preflight-1q6c2edh.js → preflight-41hcejg9.js} +10 -7
  82. package/dist/preview/file-watcher.d.ts +13 -17
  83. package/dist/preview/lifecycle.d.ts +1 -1
  84. package/dist/{pagedjs-bridge-vn4hk9fx.js → preview-bridge-fz7vpk8m.js} +8 -0
  85. package/dist/preview-interface-fnqb2y4v.js +1015 -0
  86. package/dist/{preview-y5a2zen1.js → preview-pftsvr9z.js} +16 -9
  87. package/dist/preview-shell-c5mfa3q0.js +346 -0
  88. package/dist/{project-source-p0gn1wd5.js → project-source-ekcyp63q.js} +1 -1
  89. package/dist/{publish-rm9yb3wh.js → publish-dnjvb4jg.js} +10 -7
  90. package/dist/render.d.ts +3 -4
  91. package/dist/render.js +728 -64
  92. package/dist/{repair-zgq7q2g6.js → repair-a3enjttn.js} +45 -79
  93. package/dist/schema/manifest.types.d.ts +38 -0
  94. package/dist/{source-provider-c1rjm2c0.js → source-provider-3tcj6qg2.js} +2 -2
  95. package/dist/source-provider-vanafrt9.js +40 -0
  96. package/dist/{theme-zz2ktzqs.css → theme-h5recz6c.css} +8 -7
  97. package/dist/{theme-570zmh2t.css → theme-j2bagrfx.css} +8 -7
  98. package/dist/{theme-nya4nqh6.css → theme-nn6d53zy.css} +8 -7
  99. package/dist/types.d.ts +7 -0
  100. package/dist/{validate-nr0xa6sa.js → validate-ph1xffqy.js} +10 -7
  101. package/package.json +6 -6
  102. package/dist/cli-yja077f6.js +0 -92
  103. package/dist/git-http-yrb4ag6z.js +0 -17
  104. package/dist/index-yja077f6.js +0 -92
  105. package/dist/lib/markdown/markdown-it-paged.d.ts +0 -30
  106. package/dist/lib/pagedjs-marker.d.ts +0 -42
  107. package/dist/lib/pagedjs.d.ts +0 -26
  108. package/dist/lib/pagination.d.ts +0 -149
  109. package/dist/lib/remote-auth/conflict-resolution.d.ts +0 -29
  110. package/dist/lib/remote-auth/recovery/abort-interrupted-operation.d.ts +0 -103
  111. package/dist/lib/remote-auth/recovery/backup.d.ts +0 -113
  112. package/dist/lib/remote-auth/recovery/context.d.ts +0 -47
  113. package/dist/lib/remote-auth/recovery/dispatch.d.ts +0 -28
  114. package/dist/lib/remote-auth/recovery/failsafe.d.ts +0 -33
  115. package/dist/lib/remote-auth/recovery/manual-guidance.d.ts +0 -28
  116. package/dist/lib/remote-auth/recovery/outcome-mapping.d.ts +0 -59
  117. package/dist/lib/remote-auth/recovery/policy.d.ts +0 -47
  118. package/dist/lib/remote-auth/recovery/recover-auth.d.ts +0 -42
  119. package/dist/lib/remote-auth/recovery/recover-binary-conflict.d.ts +0 -37
  120. package/dist/lib/remote-auth/recovery/recover-corrupt-index.d.ts +0 -40
  121. package/dist/lib/remote-auth/recovery/recover-detached-head.d.ts +0 -70
  122. package/dist/lib/remote-auth/recovery/recover-interrupted-cherry-pick.d.ts +0 -23
  123. package/dist/lib/remote-auth/recovery/recover-interrupted-merge.d.ts +0 -28
  124. package/dist/lib/remote-auth/recovery/recover-interrupted-rebase.d.ts +0 -39
  125. package/dist/lib/remote-auth/recovery/recover-merge-conflict.d.ts +0 -34
  126. package/dist/lib/remote-auth/recovery/recover-missing-git-dir.d.ts +0 -37
  127. package/dist/lib/remote-auth/recovery/recover-missing-objects.d.ts +0 -56
  128. package/dist/lib/remote-auth/recovery/recover-network.d.ts +0 -34
  129. package/dist/lib/remote-auth/recovery/recover-non-fast-forward.d.ts +0 -27
  130. package/dist/lib/remote-auth/recovery/recover-stale-lock.d.ts +0 -68
  131. package/dist/lib/remote-auth/recovery/recover-unrelated-histories.d.ts +0 -44
  132. package/dist/lib/remote-auth/recovery/recover-wrong-remote.d.ts +0 -35
  133. package/dist/lib/remote-auth/resolution-plan.d.ts +0 -64
  134. package/dist/paged.polyfill-n95pbxfn.js +0 -33288
  135. package/dist/pagedjs-interface-qxvzgwd7.js +0 -557
  136. package/dist/preview-shell-6dqexx1m.js +0 -581
  137. /package/dist/assets/{preview/scripts/pagedjs-bridge.d.ts → engine/gutterpress-agent.d.ts} +0 -0
  138. /package/dist/assets/{preview/scripts/pagedjs-interface.d.ts → engine/gutterpress-viewer.d.ts} +0 -0
@@ -0,0 +1,241 @@
1
+ // src/lib/tool-probe.ts
2
+ import { platform } from "node:os";
3
+
4
+ // src/lib/exec.ts
5
+ import { spawn } from "node:child_process";
6
+ import { join, resolve as resolvePath, delimiter } from "node:path";
7
+ function buildEnhancedPath(dir, existingPath, sep = delimiter) {
8
+ return `${dir}${sep}${existingPath}`;
9
+ }
10
+ var localBin = resolvePath(join(import.meta.dirname, "..", "..", "node_modules", ".bin"));
11
+ var enhancedPath = buildEnhancedPath(localBin, process.env.PATH ?? "");
12
+ function enhancedEnv() {
13
+ return { ...process.env, PATH: enhancedPath };
14
+ }
15
+ function run(cmd, args, opts = {}) {
16
+ return new Promise((resolve, reject) => {
17
+ const p = spawn(cmd, args, { stdio: "inherit", cwd: opts.cwd, env: enhancedEnv() });
18
+ p.on("error", reject);
19
+ p.on("exit", (code) => {
20
+ if (code === 0)
21
+ return resolve();
22
+ const cwd = opts.cwd ?? process.cwd();
23
+ reject(new Error(`${cmd} ${args.join(" ")} (cwd=${cwd}) exited ${code}`));
24
+ });
25
+ });
26
+ }
27
+ var EXIT_FLUSH_GRACE_MS = 2000;
28
+ function keepTail(buffer, chunk, limit) {
29
+ const joined = buffer + chunk;
30
+ return limit !== undefined && joined.length > limit ? joined.slice(-limit) : joined;
31
+ }
32
+ function spawnCapture(cmd, args, opts = {}) {
33
+ return new Promise((resolve, reject) => {
34
+ const p = spawn(cmd, args, {
35
+ stdio: ["ignore", "pipe", "pipe"],
36
+ cwd: opts.cwd,
37
+ env: opts.env
38
+ });
39
+ let stdout = "";
40
+ let stderr = "";
41
+ let settled = false;
42
+ let exited = false;
43
+ let exitCode = null;
44
+ let exitSignal = null;
45
+ let killTimer;
46
+ let graceTimer;
47
+ const settle = (fn) => {
48
+ if (settled)
49
+ return;
50
+ settled = true;
51
+ if (killTimer)
52
+ clearTimeout(killTimer);
53
+ if (graceTimer)
54
+ clearTimeout(graceTimer);
55
+ fn();
56
+ };
57
+ const armKill = () => {
58
+ if (!opts.timeoutMs)
59
+ return;
60
+ if (killTimer)
61
+ clearTimeout(killTimer);
62
+ killTimer = setTimeout(() => {
63
+ settle(() => {
64
+ p.kill("SIGKILL");
65
+ reject(new Error(opts.timeoutMode === "idle" ? `${cmd} produced no output for ${opts.timeoutMs}ms and was stopped` : `${cmd} ${args.join(" ")} timed out after ${opts.timeoutMs}ms`));
66
+ });
67
+ }, opts.timeoutMs);
68
+ killTimer.unref();
69
+ };
70
+ armKill();
71
+ const finish = () => settle(() => resolve({ code: exitCode, signal: exitSignal, stdout, stderr }));
72
+ const armGrace = () => {
73
+ if (graceTimer)
74
+ clearTimeout(graceTimer);
75
+ graceTimer = setTimeout(finish, opts.exitGraceMs ?? EXIT_FLUSH_GRACE_MS);
76
+ graceTimer.unref();
77
+ };
78
+ const onData = (stream) => (d) => {
79
+ const text = d.toString();
80
+ if (stream === "stdout")
81
+ stdout = keepTail(stdout, text, opts.captureLimit);
82
+ else
83
+ stderr = keepTail(stderr, text, opts.captureLimit);
84
+ opts.onChunk?.(stream, text);
85
+ if (exited)
86
+ armGrace();
87
+ else if (opts.timeoutMode === "idle")
88
+ armKill();
89
+ };
90
+ p.stdout.on("data", onData("stdout"));
91
+ p.stderr.on("data", onData("stderr"));
92
+ p.on("error", (err) => settle(() => reject(err)));
93
+ p.on("exit", (code, signal) => {
94
+ exited = true;
95
+ exitCode = code;
96
+ exitSignal = signal;
97
+ if (killTimer) {
98
+ clearTimeout(killTimer);
99
+ killTimer = undefined;
100
+ }
101
+ armGrace();
102
+ });
103
+ p.on("close", finish);
104
+ });
105
+ }
106
+ async function execCapture(cmd, args, opts = {}) {
107
+ const { code, signal, stdout, stderr } = await spawnCapture(cmd, args, {
108
+ cwd: opts.cwd,
109
+ env: enhancedEnv(),
110
+ timeoutMs: opts.timeoutMs
111
+ });
112
+ if (code === 0)
113
+ return { stdout, stderr };
114
+ throw new Error(code === null ? `${cmd} was killed by signal ${signal}
115
+ ${stderr}` : `${cmd} exited ${code}
116
+ ${stderr}`);
117
+ }
118
+
119
+ // src/lib/tool-probe.ts
120
+ var IS_WINDOWS = platform() === "win32";
121
+ var PROBE_CMD = IS_WINDOWS ? "where.exe" : "which";
122
+ async function isToolAvailable(tool) {
123
+ try {
124
+ await execCapture(PROBE_CMD, [tool]);
125
+ return true;
126
+ } catch {
127
+ return false;
128
+ }
129
+ }
130
+ async function findTool(tool) {
131
+ try {
132
+ const { stdout } = await execCapture(PROBE_CMD, [tool]);
133
+ const firstLine = stdout.split(/\r?\n/).find((line) => line.trim().length > 0);
134
+ return firstLine?.trim() || undefined;
135
+ } catch {
136
+ return;
137
+ }
138
+ }
139
+
140
+ // src/lib/install-hints.ts
141
+ var INSTALL_HINTS = {
142
+ chromium: {
143
+ label: "Google Chrome, Chromium, or Microsoft Edge",
144
+ body: ` macOS: brew install --cask google-chrome
145
+ ` + ` Ubuntu: sudo apt install -y chromium-browser
146
+ ` + " Windows: https://www.google.com/chrome/ (Edge is auto-detected if pre-installed)"
147
+ },
148
+ gs: {
149
+ label: "Ghostscript",
150
+ body: ` macOS: brew install ghostscript
151
+ ` + ` Ubuntu: sudo apt install -y ghostscript
152
+ ` + " Windows: https://www.ghostscript.com/releases/gsdnld.html (standard installs are auto-detected; or: choco install ghostscript)"
153
+ },
154
+ qpdf: {
155
+ label: "qpdf",
156
+ body: ` macOS: brew install qpdf
157
+ ` + ` Ubuntu: sudo apt install -y qpdf
158
+ ` + " Windows: choco install qpdf (or: https://github.com/qpdf/qpdf/releases)"
159
+ }
160
+ };
161
+ function fullInstallHint(tool) {
162
+ const hint = INSTALL_HINTS[tool];
163
+ return `Install ${hint.label}:
164
+ ${hint.body}`;
165
+ }
166
+
167
+ // src/lib/chromium.ts
168
+ import { existsSync } from "node:fs";
169
+ var SYSTEM_PATHS = [
170
+ process.env.CHROMIUM_PATH,
171
+ process.env.PUPPETEER_EXECUTABLE_PATH,
172
+ "/usr/bin/google-chrome",
173
+ "/usr/bin/google-chrome-stable",
174
+ "/usr/bin/chromium",
175
+ "/usr/bin/chromium-browser",
176
+ "/snap/bin/chromium",
177
+ "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
178
+ "/Applications/Chromium.app/Contents/MacOS/Chromium",
179
+ "/opt/homebrew/bin/chromium",
180
+ "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge",
181
+ "/Applications/Brave Browser.app/Contents/MacOS/Brave Browser",
182
+ "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe",
183
+ "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",
184
+ process.env.LOCALAPPDATA ? `${process.env.LOCALAPPDATA}\\Google\\Chrome\\Application\\chrome.exe` : undefined,
185
+ "C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe",
186
+ "C:\\Program Files\\Microsoft\\Edge\\Application\\msedge.exe",
187
+ process.env.LOCALAPPDATA ? `${process.env.LOCALAPPDATA}\\Microsoft\\Edge\\Application\\msedge.exe` : undefined,
188
+ process.env.LOCALAPPDATA ? `${process.env.LOCALAPPDATA}\\BraveSoftware\\Brave-Browser\\Application\\brave.exe` : undefined
189
+ ].filter(Boolean);
190
+ var PATH_CANDIDATES = [
191
+ "google-chrome",
192
+ "google-chrome-stable",
193
+ "chromium",
194
+ "chromium-browser",
195
+ "chrome",
196
+ "chrome.exe",
197
+ "msedge",
198
+ "msedge.exe",
199
+ "brave",
200
+ "brave-browser",
201
+ "brave.exe",
202
+ "vivaldi",
203
+ "vivaldi-stable",
204
+ "vivaldi.exe",
205
+ "opera",
206
+ "opera-stable",
207
+ "opera.exe"
208
+ ];
209
+ async function resolveChromiumExecutable() {
210
+ for (const candidate of SYSTEM_PATHS) {
211
+ if (existsSync(candidate))
212
+ return candidate;
213
+ }
214
+ for (const candidate of PATH_CANDIDATES) {
215
+ const found = await findTool(candidate);
216
+ if (found)
217
+ return found;
218
+ }
219
+ return;
220
+ }
221
+ async function requireChromiumExecutable() {
222
+ const found = await resolveChromiumExecutable();
223
+ if (found)
224
+ return found;
225
+ throw new Error([
226
+ "No Chrome / Chromium / Edge binary found. Gutterpress needs a Chromium-based browser to render PDFs.",
227
+ "",
228
+ "Install one of:",
229
+ INSTALL_HINTS.chromium.body,
230
+ "",
231
+ "Or point to an existing install:",
232
+ " CHROMIUM_PATH=/path/to/chrome gutterpress build ...",
233
+ "",
234
+ "The Gutterpress desktop app uses its own bundled browser for BOTH",
235
+ "PDF export and needs no separate install.",
236
+ "This message is about the CLI, which does need one."
237
+ ].join(`
238
+ `));
239
+ }
240
+
241
+ export { run, spawnCapture, execCapture, isToolAvailable, findTool, INSTALL_HINTS, fullInstallHint, resolveChromiumExecutable, requireChromiumExecutable };
@@ -1,15 +1,17 @@
1
+ import {
2
+ EXIT_CODES
3
+ } from "./cli-46ycxe6r.js";
1
4
  // package.json
2
5
  var package_default = {
3
6
  name: "gutterpress",
4
- version: "0.9.0-alpha.2",
5
- description: "Markdown-to-PDF converter for professional print layout using Paged.js and Ghostscript.",
7
+ version: "0.10.0-alpha.3",
8
+ description: "Markdown-to-PDF converter for professional print layout using a native Chromium print engine and Ghostscript.",
6
9
  author: "itlackey",
7
10
  license: "MPL-2.0",
8
11
  keywords: [
9
12
  "markdown",
10
13
  "pdf",
11
14
  "print",
12
- "pagedjs",
13
15
  "ghostscript",
14
16
  "book",
15
17
  "publishing",
@@ -49,11 +51,13 @@ var package_default = {
49
51
  "LICENSE"
50
52
  ],
51
53
  scripts: {
52
- "build:library": "rimraf dist && bun build src/index.ts src/api/index.ts --target=node --packages=external --splitting --outdir=dist && bun build src/render.ts --target=node --packages=external --outdir=dist && node scripts/check-render-pure.mjs && tsc -p tsconfig.build.json",
54
+ "build:library": "bun scripts/build-engine-bundles.mjs && rimraf dist && bun build src/index.ts src/api/index.ts --target=node --packages=external --splitting --outdir=dist && bun build src/render.ts --target=node --packages=external --outdir=dist && node scripts/check-render-pure.mjs && tsc -p tsconfig.build.json",
53
55
  build: "bun run build:library && bun build src/cli.ts --target=node --packages=external --splitting --outdir=dist",
54
56
  prepublishOnly: "bun run build",
55
57
  test: "bun test",
56
- typecheck: "tsc --noEmit"
58
+ typecheck: "tsc --noEmit",
59
+ "typecheck:engine-browser": "tsc --noEmit -p src/engine/browser.tsconfig.json",
60
+ "parity:gate": "bun scripts/native-parity-gate.ts"
57
61
  },
58
62
  engines: {
59
63
  bun: ">=1.0.0",
@@ -95,30 +99,12 @@ var package_default = {
95
99
  "@types/node": "^22.0.0",
96
100
  "@types/semver": "^7.7.1",
97
101
  "@types/ws": "^8.5.13",
98
- pagedjs: "^0.4.3",
99
102
  playwright: "^1.60.0",
100
103
  rimraf: "^6.0.0",
101
104
  typescript: "^5"
102
105
  }
103
106
  };
104
107
 
105
- // src/lib/build-error.ts
106
- var EXIT_CODES = {
107
- OK: 0,
108
- FINDINGS: 1,
109
- USAGE: 2,
110
- PIPELINE: 3
111
- };
112
-
113
- class BuildError extends Error {
114
- exitCode;
115
- constructor(message, exitCode = EXIT_CODES.PIPELINE, options) {
116
- super(message, options);
117
- this.name = "BuildError";
118
- this.exitCode = exitCode;
119
- }
120
- }
121
-
122
108
  // src/constants.ts
123
109
  var NETWORK = {
124
110
  DEFAULT_PORT: 3579
@@ -268,6 +254,13 @@ function parsePdfxFlavor(raw, format) {
268
254
  return raw;
269
255
  throw new UsageError(`Invalid --pdfx-flavor value: "${raw}". Expected "x1a" or "x3".`);
270
256
  }
257
+ function parseEngine(raw) {
258
+ if (raw === undefined)
259
+ return;
260
+ if (raw === "paged" || raw === "native")
261
+ return raw;
262
+ throw new UsageError(`Unknown --engine "${String(raw)}". Expected: paged | native`);
263
+ }
271
264
  function resolvePort(raw) {
272
265
  if (raw === undefined)
273
266
  return NETWORK.DEFAULT_PORT;
@@ -281,4 +274,4 @@ function resolvePort(raw) {
281
274
  return n;
282
275
  }
283
276
 
284
- export { package_default, DEBOUNCE, EXIT_CODES, BuildError, UsageError, rejectUnknownFlags, rejectExtraPositionals, parseFormat, parsePdfxFlavor, resolvePort };
277
+ export { package_default, DEBOUNCE, UsageError, rejectUnknownFlags, rejectExtraPositionals, parseFormat, parsePdfxFlavor, parseEngine, resolvePort };