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
@@ -1,6 +1,14 @@
1
1
  import {
2
2
  package_default
3
- } from "./cli-e5zhb0xs.js";
3
+ } from "./cli-f4rcbt2t.js";
4
+ import {
5
+ execCapture,
6
+ findTool,
7
+ fullInstallHint,
8
+ isToolAvailable,
9
+ resolveChromiumExecutable,
10
+ run
11
+ } from "./cli-c41yr7he.js";
4
12
  import {
5
13
  __require
6
14
  } from "./cli-37x76zdn.js";
@@ -67,149 +75,10 @@ var log = {
67
75
  }
68
76
  };
69
77
 
70
- // src/lib/tool-probe.ts
71
- import { platform } from "node:os";
72
-
73
- // src/lib/exec.ts
74
- import { spawn } from "node:child_process";
75
- import { join, resolve as resolvePath, delimiter } from "node:path";
76
- function buildEnhancedPath(dir, existingPath, sep = delimiter) {
77
- return `${dir}${sep}${existingPath}`;
78
- }
79
- var localBin = resolvePath(join(import.meta.dirname, "..", "..", "node_modules", ".bin"));
80
- var enhancedPath = buildEnhancedPath(localBin, process.env.PATH ?? "");
81
- function enhancedEnv() {
82
- return { ...process.env, PATH: enhancedPath };
83
- }
84
- function run(cmd, args, opts = {}) {
85
- return new Promise((resolve, reject) => {
86
- const p = spawn(cmd, args, { stdio: "inherit", cwd: opts.cwd, env: enhancedEnv() });
87
- p.on("error", reject);
88
- p.on("exit", (code) => {
89
- if (code === 0)
90
- return resolve();
91
- const cwd = opts.cwd ?? process.cwd();
92
- reject(new Error(`${cmd} ${args.join(" ")} (cwd=${cwd}) exited ${code}`));
93
- });
94
- });
95
- }
96
- var EXIT_FLUSH_GRACE_MS = 2000;
97
- function keepTail(buffer, chunk, limit) {
98
- const joined = buffer + chunk;
99
- return limit !== undefined && joined.length > limit ? joined.slice(-limit) : joined;
100
- }
101
- function spawnCapture(cmd, args, opts = {}) {
102
- return new Promise((resolve, reject) => {
103
- const p = spawn(cmd, args, {
104
- stdio: ["ignore", "pipe", "pipe"],
105
- cwd: opts.cwd,
106
- env: opts.env
107
- });
108
- let stdout = "";
109
- let stderr = "";
110
- let settled = false;
111
- let exited = false;
112
- let exitCode = null;
113
- let exitSignal = null;
114
- let killTimer;
115
- let graceTimer;
116
- const settle = (fn) => {
117
- if (settled)
118
- return;
119
- settled = true;
120
- if (killTimer)
121
- clearTimeout(killTimer);
122
- if (graceTimer)
123
- clearTimeout(graceTimer);
124
- fn();
125
- };
126
- const armKill = () => {
127
- if (!opts.timeoutMs)
128
- return;
129
- if (killTimer)
130
- clearTimeout(killTimer);
131
- killTimer = setTimeout(() => {
132
- settle(() => {
133
- p.kill("SIGKILL");
134
- 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`));
135
- });
136
- }, opts.timeoutMs);
137
- killTimer.unref();
138
- };
139
- armKill();
140
- const finish = () => settle(() => resolve({ code: exitCode, signal: exitSignal, stdout, stderr }));
141
- const armGrace = () => {
142
- if (graceTimer)
143
- clearTimeout(graceTimer);
144
- graceTimer = setTimeout(finish, opts.exitGraceMs ?? EXIT_FLUSH_GRACE_MS);
145
- graceTimer.unref();
146
- };
147
- const onData = (stream) => (d) => {
148
- const text = d.toString();
149
- if (stream === "stdout")
150
- stdout = keepTail(stdout, text, opts.captureLimit);
151
- else
152
- stderr = keepTail(stderr, text, opts.captureLimit);
153
- opts.onChunk?.(stream, text);
154
- if (exited)
155
- armGrace();
156
- else if (opts.timeoutMode === "idle")
157
- armKill();
158
- };
159
- p.stdout.on("data", onData("stdout"));
160
- p.stderr.on("data", onData("stderr"));
161
- p.on("error", (err) => settle(() => reject(err)));
162
- p.on("exit", (code, signal) => {
163
- exited = true;
164
- exitCode = code;
165
- exitSignal = signal;
166
- if (killTimer) {
167
- clearTimeout(killTimer);
168
- killTimer = undefined;
169
- }
170
- armGrace();
171
- });
172
- p.on("close", finish);
173
- });
174
- }
175
- async function execCapture(cmd, args, opts = {}) {
176
- const { code, signal, stdout, stderr } = await spawnCapture(cmd, args, {
177
- cwd: opts.cwd,
178
- env: enhancedEnv(),
179
- timeoutMs: opts.timeoutMs
180
- });
181
- if (code === 0)
182
- return { stdout, stderr };
183
- throw new Error(code === null ? `${cmd} was killed by signal ${signal}
184
- ${stderr}` : `${cmd} exited ${code}
185
- ${stderr}`);
186
- }
187
-
188
- // src/lib/tool-probe.ts
189
- var IS_WINDOWS = platform() === "win32";
190
- var PROBE_CMD = IS_WINDOWS ? "where.exe" : "which";
191
- async function isToolAvailable(tool) {
192
- try {
193
- await execCapture(PROBE_CMD, [tool]);
194
- return true;
195
- } catch {
196
- return false;
197
- }
198
- }
199
- async function findTool(tool) {
200
- try {
201
- const { stdout } = await execCapture(PROBE_CMD, [tool]);
202
- const firstLine = stdout.split(/\r?\n/).find((line) => line.trim().length > 0);
203
- return firstLine?.trim() || undefined;
204
- } catch {
205
- return;
206
- }
207
- }
208
-
209
78
  // src/lib/ghostscript.ts
210
79
  import { existsSync } from "node:fs";
211
80
  import { readFile, writeFile, unlink, rename, readdir } from "node:fs/promises";
212
- import { join as join2, basename, resolve } from "node:path";
81
+ import { join, basename, resolve } from "node:path";
213
82
  var WINDOWS_GHOSTSCRIPT_NAMES = ["gswin64c", "gswin32c", "gs"];
214
83
  var POSIX_GHOSTSCRIPT_NAMES = ["gs"];
215
84
  function envValue(env, name) {
@@ -232,7 +101,7 @@ async function findWindowsGhostscriptInstall(env) {
232
101
  if (!root || seen.has(root.toLowerCase()))
233
102
  continue;
234
103
  seen.add(root.toLowerCase());
235
- const installRoot = join2(root, "gs");
104
+ const installRoot = join(root, "gs");
236
105
  let versions;
237
106
  try {
238
107
  versions = (await readdir(installRoot, { withFileTypes: true })).filter((entry) => entry.isDirectory() && /^gs\d/i.test(entry.name)).sort((a, b) => b.name.localeCompare(a.name, undefined, { numeric: true }));
@@ -241,7 +110,7 @@ async function findWindowsGhostscriptInstall(env) {
241
110
  }
242
111
  for (const version of versions) {
243
112
  for (const executable of ["gswin64c.exe", "gswin32c.exe"]) {
244
- const candidate = join2(installRoot, version.name, "bin", executable);
113
+ const candidate = join(installRoot, version.name, "bin", executable);
245
114
  if (existsSync(candidate))
246
115
  return candidate;
247
116
  }
@@ -261,14 +130,62 @@ async function resolveGhostscript(targetPlatform = process.platform, env = proce
261
130
  }
262
131
  return targetPlatform === "win32" ? findWindowsGhostscriptInstall(env) : undefined;
263
132
  }
133
+ async function hasLiveTransparency(pdfBytes) {
134
+ const { PDFDocument, PDFDict, PDFName, PDFNumber, PDFRawStream, PDFRef } = await import("pdf-lib");
135
+ let doc;
136
+ try {
137
+ doc = await PDFDocument.load(pdfBytes, {
138
+ updateMetadata: false,
139
+ throwOnInvalidObject: false
140
+ });
141
+ } catch {
142
+ return false;
143
+ }
144
+ const ctx = doc.context;
145
+ const NONE = "/None";
146
+ for (const [, obj] of ctx.enumerateIndirectObjects()) {
147
+ const dict = obj instanceof PDFRawStream ? obj.dict : obj instanceof PDFDict ? obj : undefined;
148
+ if (!dict)
149
+ continue;
150
+ const smask = dict.get(PDFName.of("SMask"));
151
+ const subtype = String(dict.get(PDFName.of("Subtype")) ?? "");
152
+ const type = String(dict.get(PDFName.of("Type")) ?? "");
153
+ if (subtype === "/Image" && smask && String(smask) !== NONE)
154
+ return true;
155
+ if (type === "/ExtGState") {
156
+ if (smask && String(smask) !== NONE)
157
+ return true;
158
+ for (const key of ["ca", "CA"]) {
159
+ const alpha = dict.get(PDFName.of(key));
160
+ if (alpha instanceof PDFNumber && alpha.asNumber() < 1)
161
+ return true;
162
+ }
163
+ }
164
+ const group = dict.get(PDFName.of("Group"));
165
+ if (group) {
166
+ const resolved = group instanceof PDFRef ? ctx.lookup(group) : group;
167
+ if (resolved instanceof PDFDict && String(resolved.get(PDFName.of("S"))) === "/Transparency")
168
+ return true;
169
+ }
170
+ }
171
+ return false;
172
+ }
264
173
  async function stripAnnotations(pdfPath, stagingDir) {
265
- const tmp = join2(stagingDir, "annotations-stripped.pdf");
174
+ const tmp = join(stagingDir, "annotations-stripped.pdf");
266
175
  try {
267
176
  await run("qpdf", [pdfPath, tmp, "--flatten-annotations=all"]);
268
177
  await rename(tmp, pdfPath);
269
178
  } finally {
270
179
  await unlink(tmp).catch(() => {});
271
180
  }
181
+ const { PDFDocument, PDFName } = await import("pdf-lib");
182
+ const bytes = await readFile(pdfPath);
183
+ const doc = await PDFDocument.load(bytes, { updateMetadata: false });
184
+ const annots = PDFName.of("Annots");
185
+ for (const page of doc.getPages())
186
+ page.node.delete(annots);
187
+ const out = await doc.save();
188
+ await writeFile(pdfPath, out);
272
189
  }
273
190
  function makePdfxDefPs(params) {
274
191
  const pdfxVersion = params.pdfx === "x3" ? "PDF/X-3:2002" : "PDF/X-1:2001";
@@ -345,7 +262,7 @@ async function stampCreator(pdfPath) {
345
262
  }
346
263
  async function convertToPdfxCmyk(inputPdf, outPdf, config) {
347
264
  const iccPath = resolve(config.iccPath);
348
- const tmpDef = join2(config.stagingDir, "pdfx-def.ps");
265
+ const tmpDef = join(config.stagingDir, "pdfx-def.ps");
349
266
  const args = [
350
267
  "-dSAFER",
351
268
  `--permit-file-read=${iccPath}`,
@@ -531,108 +448,7 @@ function extractUrlCredential(url) {
531
448
  }
532
449
 
533
450
  // src/lib/diagnostics.ts
534
- import { platform as platform2, arch, release } from "node:os";
535
-
536
- // src/lib/chromium.ts
537
- import { existsSync as existsSync2 } from "node:fs";
538
-
539
- // src/lib/install-hints.ts
540
- var INSTALL_HINTS = {
541
- chromium: {
542
- label: "Google Chrome, Chromium, or Microsoft Edge",
543
- body: ` macOS: brew install --cask google-chrome
544
- ` + ` Ubuntu: sudo apt install -y chromium-browser
545
- ` + " Windows: https://www.google.com/chrome/ (Edge is auto-detected if pre-installed)"
546
- },
547
- gs: {
548
- label: "Ghostscript",
549
- body: ` macOS: brew install ghostscript
550
- ` + ` Ubuntu: sudo apt install -y ghostscript
551
- ` + " Windows: https://www.ghostscript.com/releases/gsdnld.html (standard installs are auto-detected; or: choco install ghostscript)"
552
- },
553
- qpdf: {
554
- label: "qpdf",
555
- body: ` macOS: brew install qpdf
556
- ` + ` Ubuntu: sudo apt install -y qpdf
557
- ` + " Windows: choco install qpdf (or: https://github.com/qpdf/qpdf/releases)"
558
- }
559
- };
560
- function fullInstallHint(tool) {
561
- const hint = INSTALL_HINTS[tool];
562
- return `Install ${hint.label}:
563
- ${hint.body}`;
564
- }
565
-
566
- // src/lib/chromium.ts
567
- var SYSTEM_PATHS = [
568
- process.env.CHROMIUM_PATH,
569
- process.env.PUPPETEER_EXECUTABLE_PATH,
570
- "/usr/bin/google-chrome",
571
- "/usr/bin/google-chrome-stable",
572
- "/usr/bin/chromium",
573
- "/usr/bin/chromium-browser",
574
- "/snap/bin/chromium",
575
- "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
576
- "/Applications/Chromium.app/Contents/MacOS/Chromium",
577
- "/opt/homebrew/bin/chromium",
578
- "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge",
579
- "/Applications/Brave Browser.app/Contents/MacOS/Brave Browser",
580
- "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe",
581
- "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",
582
- process.env.LOCALAPPDATA ? `${process.env.LOCALAPPDATA}\\Google\\Chrome\\Application\\chrome.exe` : undefined,
583
- "C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe",
584
- "C:\\Program Files\\Microsoft\\Edge\\Application\\msedge.exe",
585
- process.env.LOCALAPPDATA ? `${process.env.LOCALAPPDATA}\\Microsoft\\Edge\\Application\\msedge.exe` : undefined,
586
- process.env.LOCALAPPDATA ? `${process.env.LOCALAPPDATA}\\BraveSoftware\\Brave-Browser\\Application\\brave.exe` : undefined
587
- ].filter(Boolean);
588
- var PATH_CANDIDATES = [
589
- "google-chrome",
590
- "google-chrome-stable",
591
- "chromium",
592
- "chromium-browser",
593
- "chrome",
594
- "chrome.exe",
595
- "msedge",
596
- "msedge.exe",
597
- "brave",
598
- "brave-browser",
599
- "brave.exe",
600
- "vivaldi",
601
- "vivaldi-stable",
602
- "vivaldi.exe",
603
- "opera",
604
- "opera-stable",
605
- "opera.exe"
606
- ];
607
- async function resolveChromiumExecutable() {
608
- for (const candidate of SYSTEM_PATHS) {
609
- if (existsSync2(candidate))
610
- return candidate;
611
- }
612
- for (const candidate of PATH_CANDIDATES) {
613
- const found = await findTool(candidate);
614
- if (found)
615
- return found;
616
- }
617
- return;
618
- }
619
- async function requireChromiumExecutable() {
620
- const found = await resolveChromiumExecutable();
621
- if (found)
622
- return found;
623
- throw new Error([
624
- "No Chrome / Chromium / Edge binary found. Gutterpress needs a Chromium-based browser to render PDFs.",
625
- "",
626
- "Install one of:",
627
- INSTALL_HINTS.chromium.body,
628
- "",
629
- "Or point to an existing install:",
630
- " CHROMIUM_PATH=/path/to/chrome gutterpress build ...",
631
- "",
632
- "The Gutterpress desktop app includes its own browser and needs no separate browser installation."
633
- ].join(`
634
- `));
635
- }
451
+ import { platform, arch, release } from "node:os";
636
452
 
637
453
  // src/lib/version.ts
638
454
  var PACKAGE_META = {
@@ -643,7 +459,7 @@ var PACKAGE_META = {
643
459
  var PACKAGE_VERSION = PACKAGE_META.version;
644
460
 
645
461
  // src/lib/diagnostics.ts
646
- var INSTALL_HINTS2 = {
462
+ var INSTALL_HINTS = {
647
463
  chromium: `${fullInstallHint("chromium")}
648
464
  Or set CHROMIUM_PATH=/path/to/chrome`,
649
465
  gs: `${fullInstallHint("gs")}
@@ -696,7 +512,7 @@ async function getSystemDiagnostics() {
696
512
  usedBy: [
697
513
  { feature: "Save PDF (every PDF render)", severity: "required" }
698
514
  ],
699
- installHint: INSTALL_HINTS2.chromium
515
+ installHint: INSTALL_HINTS.chromium
700
516
  };
701
517
  const ghostscriptPath = await resolveGhostscript();
702
518
  const tools = await Promise.all(TOOLS_TO_PROBE.map(async (t) => {
@@ -709,7 +525,7 @@ async function getSystemDiagnostics() {
709
525
  path: ghostscriptPath,
710
526
  version: ghostscriptPath ? await getVersion(ghostscriptPath) : undefined,
711
527
  usedBy: t.usedBy,
712
- installHint: INSTALL_HINTS2[t.hintKey]
528
+ installHint: INSTALL_HINTS[t.hintKey]
713
529
  };
714
530
  }
715
531
  const [path2, available] = await Promise.all([
@@ -726,13 +542,13 @@ async function getSystemDiagnostics() {
726
542
  path: path2,
727
543
  version,
728
544
  usedBy: t.usedBy,
729
- installHint: INSTALL_HINTS2[t.hintKey]
545
+ installHint: INSTALL_HINTS[t.hintKey]
730
546
  };
731
547
  }));
732
548
  return {
733
549
  libVersion,
734
550
  platform: {
735
- os: platform2(),
551
+ os: platform(),
736
552
  arch: arch(),
737
553
  release: release(),
738
554
  node: process.versions.node
@@ -743,4 +559,4 @@ async function getSystemDiagnostics() {
743
559
  };
744
560
  }
745
561
 
746
- export { setLogLevel, debug, info, warn, error, log, spawnCapture, execCapture, isToolAvailable, INSTALL_HINTS, resolveChromiumExecutable, requireChromiumExecutable, resolveGhostscript, stripAnnotations, stampCreator, convertToPdfxCmyk, PACKAGE_META, PACKAGE_VERSION, credentialHostKey, defaultConfigDir, FileTokenStore, extractUrlCredential, getSystemDiagnostics };
562
+ export { setLogLevel, debug, info, warn, error, log, resolveGhostscript, hasLiveTransparency, stripAnnotations, stampCreator, convertToPdfxCmyk, PACKAGE_META, PACKAGE_VERSION, credentialHostKey, defaultConfigDir, FileTokenStore, extractUrlCredential, getSystemDiagnostics };
@@ -2,7 +2,7 @@ import {
2
2
  capabilitiesFor,
3
3
  detectProjectSource,
4
4
  findEnclosingRepoDir
5
- } from "./index-wchtvxvw.js";
5
+ } from "./cli-v5mp7a6q.js";
6
6
 
7
7
  // src/lib/source-provider.ts
8
8
  import * as fs from "node:fs";
@@ -63,9 +63,6 @@ function formatData(data) {
63
63
  }
64
64
  return parts.length > 0 ? " " + parts.join(" ") : "";
65
65
  }
66
- function shortOid(oid) {
67
- return oid.length >= 7 ? oid.slice(0, 7) : oid;
68
- }
69
66
 
70
67
  // src/lib/source-provider.ts
71
68
  var noopLogger = {
@@ -461,4 +458,4 @@ async function restoreVersionWithBackup(options) {
461
458
  });
462
459
  }
463
460
 
464
- export { resolveLogger, shortOid, gitScopeFor, HISTORY_PAGE_LIMIT, withRepoLock, __repoLockQueueSizeForTests, resolveGitAuthor, listWorkdirChanges, stageChanges, hasPendingChanges, hasUncommittedChanges, snapshotWorkingTreeUnlocked, isNoChangesError, providerFor, gitDirFor, snapshotStagingMarkerPath, RESTORE_BACKUP_MESSAGE, AUTO_SNAPSHOT_MESSAGE, restoreVersionWithBackup };
461
+ export { resolveLogger, gitScopeFor, HISTORY_PAGE_LIMIT, withRepoLock, __repoLockQueueSizeForTests, resolveGitAuthor, listWorkdirChanges, stageChanges, hasPendingChanges, hasUncommittedChanges, snapshotWorkingTreeUnlocked, isNoChangesError, providerFor, gitDirFor, snapshotStagingMarkerPath, RESTORE_BACKUP_MESSAGE, AUTO_SNAPSHOT_MESSAGE, restoreVersionWithBackup };
@@ -20,7 +20,8 @@ var previewArgs = {
20
20
  "strip-annotations": { type: "boolean", description: "Strip PDF annotations for PDF/X compliance (pdfx only)" },
21
21
  "skip-lint": { type: "boolean", description: "Skip CSS linting (pdf|pdfx only)" },
22
22
  "skip-pre-validate": { type: "boolean", description: "Skip pre-build validation (pdf|pdfx only)" },
23
- "skip-post-validate": { type: "boolean", description: "Skip post-build PDF/X validation (pdfx only)" }
23
+ "skip-post-validate": { type: "boolean", description: "Skip post-build PDF/X validation (pdfx only)" },
24
+ engine: { type: "string", description: "Pagination engine. Paged.js has been removed; native is the only engine. This flag is accepted but ignored (a warning fires for --engine paged)." }
24
25
  };
25
26
 
26
27
  export { previewArgs };
@@ -29,6 +29,19 @@ async function gitEntryKind(dir) {
29
29
  return "none";
30
30
  }
31
31
  }
32
+ async function looksLikeRepo(dir) {
33
+ const kind = await gitEntryKind(dir);
34
+ if (kind === "none")
35
+ return false;
36
+ if (kind === "file")
37
+ return true;
38
+ try {
39
+ await stat(path.join(dir, ".git", "HEAD"));
40
+ return true;
41
+ } catch {
42
+ return false;
43
+ }
44
+ }
32
45
  async function findEnclosingRepoDir(folderPath) {
33
46
  const home = path.resolve(os.homedir());
34
47
  let dir = path.resolve(folderPath);
@@ -39,7 +52,7 @@ async function findEnclosingRepoDir(folderPath) {
39
52
  dir = parent;
40
53
  if (dir === home)
41
54
  return;
42
- if (await gitEntryKind(dir) !== "none")
55
+ if (await looksLikeRepo(dir))
43
56
  return dir;
44
57
  }
45
58
  return;