gutterpress 0.10.1 → 0.10.2-alpha.2

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 (44) hide show
  1. package/dist/api/index.js +2 -2
  2. package/dist/{audit-p4e7v2m7.js → audit-qz3np6k3.js} +4 -4
  3. package/dist/{build-h0x2w036.js → build-41eds5kk.js} +5 -5
  4. package/dist/{cli-eewynen9.js → cli-c2yvktan.js} +88 -7
  5. package/dist/{cli-4n1p25df.js → cli-daahjr6z.js} +1 -1
  6. package/dist/{cli-yzf38679.js → cli-pfpb1t3h.js} +1 -1
  7. package/dist/{cli-bq7vkea9.js → cli-w3spkryk.js} +36 -19
  8. package/dist/{cli-n79ghfhs.js → cli-wef7qh62.js} +1 -1
  9. package/dist/cli.js +15 -15
  10. package/dist/{doctor-y2w1kcqf.js → doctor-dqmz9wr7.js} +2 -2
  11. package/dist/engine/compiler/build.d.ts +1 -1
  12. package/dist/engine/shared/margin-box-support.d.ts +18 -1
  13. package/dist/{engine-57vw8zpd.js → engine-36jts441.js} +1 -1
  14. package/dist/{engine-8kdwy0jz.js → engine-qg5tdaqv.js} +2 -2
  15. package/dist/{gutterpress-viewer-tma1qwz2.js → gutterpress-viewer-mfeccbys.js} +12 -1
  16. package/dist/{index-j6b6cees.js → index-5vfsbjwz.js} +35 -18
  17. package/dist/{index-p0ebr7dh.js → index-my3v298z.js} +75 -4
  18. package/dist/{index-7hrvksrb.js → index-wbm6p5j3.js} +16 -5
  19. package/dist/index.js +3 -3
  20. package/dist/lib/asset-inline.d.ts +9 -7
  21. package/dist/lib/build-runner.d.ts +6 -7
  22. package/dist/lib/cli-args.d.ts +4 -5
  23. package/dist/lib/engine.d.ts +3 -3
  24. package/dist/lib/markdown/assemble.d.ts +37 -0
  25. package/dist/lib/markdown/gutterpress-css.d.ts +5 -10
  26. package/dist/lib/markdown/markers.d.ts +4 -6
  27. package/dist/lib/markdown/source-range.d.ts +1 -1
  28. package/dist/lib/static-serve.d.ts +1 -2
  29. package/dist/{lint-7wss5p35.js → lint-67xx8zms.js} +4 -4
  30. package/dist/{manifest.schema-zxgxnbg7.json → manifest.schema-084rxtwp.json} +3 -3
  31. package/dist/{new-6gz60bbx.js → new-a4052xsg.js} +4 -4
  32. package/dist/{plugin-7awkmgq0.js → plugin-n4b7b0nx.js} +4 -4
  33. package/dist/{preflight-3tb7stqb.js → preflight-7201sv7c.js} +4 -4
  34. package/dist/preview/server-context.d.ts +6 -6
  35. package/dist/{preview-7a35z1v1.js → preview-ez7yfe8p.js} +5 -5
  36. package/dist/{preview-interface-2f5v96hd.js → preview-interface-9rwz21yw.js} +2 -2
  37. package/dist/{preview-shell-kyjq59d9.js → preview-shell-gqnc5xxe.js} +3 -5
  38. package/dist/{publish-dpx2cebg.js → publish-thxa0cz7.js} +4 -4
  39. package/dist/render.js +3 -1
  40. package/dist/schema/manifest.types.d.ts +4 -5
  41. package/dist/test-helpers/testkit.d.ts +31 -0
  42. package/dist/types.d.ts +2 -2
  43. package/dist/{validate-hbe05b26.js → validate-0tbsdxz2.js} +4 -4
  44. package/package.json +1 -1
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  addNpmPlugin,
3
3
  parseNpmPluginSpec
4
- } from "./cli-bq7vkea9.js";
5
- import"./cli-n79ghfhs.js";
4
+ } from "./cli-w3spkryk.js";
5
+ import"./cli-wef7qh62.js";
6
6
  import {
7
7
  UsageError,
8
8
  rejectExtraPositionals,
9
9
  rejectUnknownFlags
10
- } from "./cli-4n1p25df.js";
11
- import"./cli-eewynen9.js";
10
+ } from "./cli-daahjr6z.js";
11
+ import"./cli-c2yvktan.js";
12
12
  import"./cli-c41yr7he.js";
13
13
  import {
14
14
  EXIT_CODES
@@ -2,16 +2,16 @@ import {
2
2
  executeValidation,
3
3
  publishTargetFor,
4
4
  reportMissingTools
5
- } from "./cli-bq7vkea9.js";
5
+ } from "./cli-w3spkryk.js";
6
6
  import {
7
7
  log
8
- } from "./cli-n79ghfhs.js";
8
+ } from "./cli-wef7qh62.js";
9
9
  import {
10
10
  UsageError,
11
11
  rejectExtraPositionals,
12
12
  rejectUnknownFlags
13
- } from "./cli-4n1p25df.js";
14
- import"./cli-eewynen9.js";
13
+ } from "./cli-daahjr6z.js";
14
+ import"./cli-c2yvktan.js";
15
15
  import"./cli-c41yr7he.js";
16
16
  import {
17
17
  EXIT_CODES
@@ -35,12 +35,12 @@ export interface ServerState {
35
35
  * Files the inlined CSS references but could not embed, as
36
36
  * `book.html`-relative URL path → absolute source path.
37
37
  *
38
- * `asset-inline.ts` embeds fonts and images up to
39
- * `IMAGE_INLINE_MAX_BYTES`; anything larger keeps its project-relative path
40
- * (if it lives in the book) or becomes `assets/<contentHash><ext>` (if it
41
- * does not e.g. art referenced from a repo-root shared stylesheet, the
42
- * normative multi-book layout). Either way the inliner returns a COPY PLAN,
43
- * which the build executes into its output dir.
38
+ * `asset-inline.ts` embeds fonts; every image becomes
39
+ * `assets/<contentHash><ext>`, wherever it lives in the book, or in a
40
+ * repo-root shared stylesheet's art folder (the normative multi-book
41
+ * layout). The inliner returns a COPY PLAN, which the build executes into
42
+ * its output dir. Content-addressing is what keeps a CSS image's URL
43
+ * distinct from a prose image's; see `inlineOne`.
44
44
  *
45
45
  * The preview serves the project in place and has no output dir, so a
46
46
  * rewritten `assets/<hash>` URL had nothing behind it and shared art
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  previewArgs
3
- } from "./cli-yzf38679.js";
3
+ } from "./cli-pfpb1t3h.js";
4
4
  import {
5
5
  openPath,
6
6
  runBuild,
7
7
  splitOutPath,
8
8
  startPreviewServer
9
- } from "./cli-bq7vkea9.js";
9
+ } from "./cli-w3spkryk.js";
10
10
  import {
11
11
  log
12
- } from "./cli-n79ghfhs.js";
12
+ } from "./cli-wef7qh62.js";
13
13
  import {
14
14
  UsageError,
15
15
  parseEngine,
@@ -18,8 +18,8 @@ import {
18
18
  rejectExtraPositionals,
19
19
  rejectUnknownFlags,
20
20
  resolvePort
21
- } from "./cli-4n1p25df.js";
22
- import"./cli-eewynen9.js";
21
+ } from "./cli-daahjr6z.js";
22
+ import"./cli-c2yvktan.js";
23
23
  import"./cli-c41yr7he.js";
24
24
  import {
25
25
  BuildError
@@ -637,8 +637,8 @@
637
637
  // ONLY to serve that panel and went with it (protocol v8).
638
638
  //
639
639
  // Three properties of the native viewer are what make this work, each
640
- // spike-verified rather than assumed (plan §2) — under Paged.js none of them
641
- // held, which is why the panel existed:
640
+ // spike-verified rather than assumed (plan §2) — the floating panel existed
641
+ // because none of them can be assumed of a paginator that pre-cuts the DOM:
642
642
  // 1. A block spanning a page break is ONE element with several client
643
643
  // rects, so it takes ONE contenteditable and the caret crosses the
644
644
  // break natively (ArrowDown walks into the next page).
@@ -288,11 +288,9 @@
288
288
  armPendingSwap();
289
289
  }
290
290
 
291
- // Incremental chapter splice used to live here (spliceChapter): it needed
292
- // Paged.js's `.pagedjs_page` DOM to find a chapter's live page range and
293
- // graft a freshly-paginated replacement into it. Paged.js has been removed
294
- // (native-only-migration-plan.md Phase 6). A native in-place splice was
295
- // also tried and removed (2026-08-08 review), and the standing reason is
291
+ // Incremental chapter splice used to live here (spliceChapter): it grafted
292
+ // a freshly-paginated replacement into a chapter's live page range. It was
293
+ // tried and removed (2026-08-08 review), and the standing reason is
296
294
  // PERFORMANCE, not soundness: measured end-to-end (file write -> change
297
295
  // visible, 5 samples, 34pp field guide) the plain full reload (`swap`,
298
296
  // below) is 509ms avg vs the incremental splice's 998ms avg. Every
@@ -7,17 +7,17 @@ import {
7
7
  publishCredentialKey,
8
8
  publishProviderFor,
9
9
  runPublish
10
- } from "./cli-bq7vkea9.js";
10
+ } from "./cli-w3spkryk.js";
11
11
  import {
12
12
  FileTokenStore,
13
13
  log
14
- } from "./cli-n79ghfhs.js";
14
+ } from "./cli-wef7qh62.js";
15
15
  import {
16
16
  UsageError,
17
17
  rejectExtraPositionals,
18
18
  rejectUnknownFlags
19
- } from "./cli-4n1p25df.js";
20
- import"./cli-eewynen9.js";
19
+ } from "./cli-daahjr6z.js";
20
+ import"./cli-c2yvktan.js";
21
21
  import"./cli-c41yr7he.js";
22
22
  import {
23
23
  EXIT_CODES
package/dist/render.js CHANGED
@@ -1389,12 +1389,14 @@ ${projectCss.trim()}` : null
1389
1389
  ].filter(Boolean).join(`
1390
1390
 
1391
1391
  `);
1392
+ const preloadTags = (opts.preloadImages ?? []).map((href) => `
1393
+ <link rel="preload" as="image" href="${href}">`).join("");
1392
1394
  return `<!DOCTYPE html>
1393
1395
  <html lang="en">
1394
1396
  <head>
1395
1397
  <meta charset="UTF-8">
1396
1398
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
1397
- <title>${title}</title>
1399
+ <title>${title}</title>${preloadTags}
1398
1400
  <style data-project-css>
1399
1401
  ${inlineCss}
1400
1402
  </style>
@@ -67,8 +67,7 @@ export interface GutterpressManifest {
67
67
  /** How the book is designed (ADR 0008). The registry in lib/presets.ts is authoritative. */
68
68
  preset?: "dtrpg" | "book" | "custom";
69
69
  /**
70
- * Pagination engine. Paged.js has been removed (native-only-migration-
71
- * plan.md Phase 6) — the Gutterpress engine (`src/engine/`, native Chromium
70
+ * Pagination engine. The Gutterpress engine (`src/engine/`, native Chromium
72
71
  * pagination) is the only engine. This field and `--engine` on the CLI are
73
72
  * accepted-but-ignored for backward compatibility: an explicit "paged"
74
73
  * produces a one-line warning and the build proceeds natively regardless.
@@ -77,12 +76,12 @@ export interface GutterpressManifest {
77
76
  /**
78
77
  * Engine-conditional stylesheets, appended AFTER `styles`. `.native` is the
79
78
  * only list that still applies; `.paged` is accepted-but-ignored (a warning
80
- * fires if it has entries) now that Paged.js has been removed.
79
+ * fires if it has entries).
81
80
  */
82
81
  engineStyles?: {
83
82
  /**
84
- * REMOVED Paged.js has been deleted. Accepted for backward-compatible
85
- * manifest parsing only; entries here are ignored with a warning.
83
+ * Accepted for backward-compatible manifest parsing only; entries here are
84
+ * ignored with a warning.
86
85
  */
87
86
  paged?: string[];
88
87
  native?: string[];
@@ -89,3 +89,34 @@ export declare class ProcessExitSignal extends Error {
89
89
  * `build-runner.browser-lifecycle.test.ts`.
90
90
  */
91
91
  export declare function stubProcessExit(): ReturnType<typeof spyOn<typeof process, "exit">>;
92
+ /**
93
+ * "Did this declaration paint anything?" is not answerable from a PDF's
94
+ * structure — Chromium fetches an unreferenced `@page` background image and
95
+ * then paints nothing, with no error and no missing object
96
+ * (docs/known-limitations.md §3, #152). The only honest answer is pixels, so
97
+ * these helpers rasterize page 1 and diff it against a control.
98
+ *
99
+ * Ghostscript rather than poppler's `pdftoppm`: `gs` is what CI installs, and
100
+ * one rasterizer keeps the two page-background suites measuring the same way.
101
+ */
102
+ export interface GrayRaster {
103
+ width: number;
104
+ height: number;
105
+ data: Uint8Array;
106
+ }
107
+ /** Ghostscript's path, or `null`. Callers self-skip, as the PDF/X suites do. */
108
+ export declare function resolveRasterizer(): Promise<string | null>;
109
+ /** Page 1 of `pdfPath` as an 8-bit grayscale raster at 100 dpi. */
110
+ export declare function rasterizePdfPage(gsBin: string, pdfPath: string, outDir: string, tag: string): GrayRaster;
111
+ /**
112
+ * Mean absolute per-pixel difference. `0` means the two prints are identical —
113
+ * i.e. the declaration under test changed nothing at all.
114
+ */
115
+ export declare function meanAbsDiff(a: GrayRaster, b: GrayRaster): number;
116
+ /**
117
+ * A minimal RGB PNG encoder, so page-background fixtures can generate the
118
+ * exact image they need — a solid tile that is unmistakable when it paints, or
119
+ * an incompressible one that is genuinely large — instead of carrying opaque
120
+ * base64 blobs whose size and contrast nobody can check by reading them.
121
+ */
122
+ export declare function pngRgb(width: number, height: number, pixel: (x: number, y: number) => [number, number, number]): Buffer;
package/dist/types.d.ts CHANGED
@@ -29,8 +29,8 @@ export interface PreviewServerOptions {
29
29
  openBrowser: boolean;
30
30
  /**
31
31
  * CLI `--engine` override, fed into {@link resolveConfig} the same way
32
- * `build`'s does (MIGRATION.md Decision #5 — preview and PDF switch
33
- * together, per project, behind one flag). `undefined` defers to the
32
+ * `build`'s does — preview and PDF switch together, per project, behind
33
+ * one flag. `undefined` defers to the
34
34
  * manifest's `engine:` field (or the "native" default).
35
35
  */
36
36
  engine?: "paged" | "native";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  executeAndReport
3
- } from "./cli-bq7vkea9.js";
3
+ } from "./cli-w3spkryk.js";
4
4
  import {
5
5
  log
6
- } from "./cli-n79ghfhs.js";
6
+ } from "./cli-wef7qh62.js";
7
7
  import {
8
8
  UsageError,
9
9
  rejectExtraPositionals,
10
10
  rejectUnknownFlags
11
- } from "./cli-4n1p25df.js";
12
- import"./cli-eewynen9.js";
11
+ } from "./cli-daahjr6z.js";
12
+ import"./cli-c2yvktan.js";
13
13
  import"./cli-c41yr7he.js";
14
14
  import {
15
15
  EXIT_CODES
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gutterpress",
3
- "version": "0.10.1",
3
+ "version": "0.10.2-alpha.2",
4
4
  "description": "Markdown-to-PDF converter for professional print layout using a native Chromium print engine and Ghostscript.",
5
5
  "author": "itlackey",
6
6
  "license": "MPL-2.0",