gutterpress 0.11.17-alpha.2 → 0.11.17-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.
- package/dist/api/index.d.ts +4 -0
- package/dist/api/index.js +10 -2
- package/dist/{build-1p999cmg.js → build-394c1ee1.js} +4 -4
- package/dist/checks/pdf/index.d.ts +1 -0
- package/dist/checks/pdf/signature.d.ts +3 -0
- package/dist/{cli-70xgehq2.js → cli-3p1e95zc.js} +1 -1
- package/dist/{cli-6z5zthzt.js → cli-9nba5ve6.js} +562 -211
- package/dist/{cli-ppc0vz4b.js → cli-d57bsfpb.js} +1 -1
- package/dist/{cli-gymfg04q.js → cli-jyy9pqf3.js} +15 -10
- package/dist/cli.js +12 -12
- package/dist/{doctor-reqpnn3h.js → doctor-c459qv5j.js} +2 -2
- package/dist/engine/compiler/build.d.ts +3 -2
- package/dist/engine/compiler/postprocess.d.ts +6 -4
- package/dist/engine/shared/synthesis.d.ts +29 -5
- package/dist/{engine-5jzhjjvv.js → engine-3xqgm82d.js} +2 -2
- package/dist/{engine-078ggczp.js → engine-zdb41ay1.js} +1 -1
- package/dist/{ext-dsbfejt3.js → ext-ha7gg8h9.js} +4 -4
- package/dist/{gutterpress-viewer-zkv2stfy.js → gutterpress-viewer-1n793gwd.js} +5 -3
- package/dist/{index-c275p061.js → index-bscfmg5r.js} +1714 -1054
- package/dist/{index-5dcj1vts.js → index-hrx0gfkj.js} +23 -684
- package/dist/index-q1xqxrh9.js +949 -0
- package/dist/index.js +11 -3
- package/dist/lib/black-text-gray.d.ts +38 -8
- package/dist/lib/build-fingerprint.d.ts +2 -0
- package/dist/lib/engine.d.ts +2 -1
- package/dist/lib/lint-rules.d.ts +9 -0
- package/dist/lib/markdown/assemble.d.ts +3 -5
- package/dist/lib/markdown/index.d.ts +3 -8
- package/dist/lib/markdown/renderer.d.ts +9 -1
- package/dist/lib/page-size.d.ts +66 -0
- package/dist/lib/pdf-inspect.d.ts +6 -0
- package/dist/lib/printsafe.d.ts +8 -1
- package/dist/lib/project-scaffold.d.ts +3 -9
- package/dist/lib/remote-auth/github-repos.d.ts +7 -0
- package/dist/lib/remote-auth/online-backup.d.ts +51 -0
- package/dist/lib/snippets.d.ts +3 -0
- package/dist/{manifest.schema-40sfq49z.json → manifest.schema-gh0jjve9.json} +14 -2
- package/dist/{new-m5y2wepr.js → new-kky3z7kv.js} +4 -4
- package/dist/{plugin.js-m4a7m3t4.tpl → plugin.js-cswq7wvd.tpl} +4 -1
- package/dist/{plugin.test.js-6n8ct5e3.tpl → plugin.test.js-xgxrd8hf.tpl} +4 -1
- package/dist/{preflight-bwpqwwny.js → preflight-t8v6szq6.js} +4 -4
- package/dist/preview/file-watcher.d.ts +2 -4
- package/dist/{preview-62y7qhkp.js → preview-cxab4y5x.js} +4 -4
- package/dist/{publish-k2zyt3x6.js → publish-s2mtenb5.js} +4 -4
- package/dist/render.js +30 -5
- package/dist/schema/manifest.types.d.ts +17 -0
- package/dist/{validate-fgwwxtbn.js → validate-xaajdw4x.js} +4 -4
- package/package.json +1 -1
- package/dist/index-eyaj6nkc.js +0 -267
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
// package.json
|
|
5
5
|
var package_default = {
|
|
6
6
|
name: "gutterpress",
|
|
7
|
-
version: "0.11.17-alpha.
|
|
7
|
+
version: "0.11.17-alpha.3",
|
|
8
8
|
description: "Markdown-to-PDF converter for professional print layout using a native Chromium print engine and Ghostscript.",
|
|
9
9
|
author: "itlackey",
|
|
10
10
|
license: "MPL-2.0",
|
|
@@ -681,10 +681,15 @@ function planRectoBlanks(sites) {
|
|
|
681
681
|
return wrong;
|
|
682
682
|
});
|
|
683
683
|
}
|
|
684
|
-
function
|
|
684
|
+
function lastPageMode(print) {
|
|
685
|
+
return print.lastPage ?? (print.reserveLastPage ? "blank" : undefined);
|
|
686
|
+
}
|
|
687
|
+
function signaturePadding(pageCount, signature = 1, lastPage) {
|
|
685
688
|
const size = signature > 1 ? signature : 1;
|
|
689
|
+
if (lastPage === "short-by-one")
|
|
690
|
+
return (size - (pageCount + 1) % size) % size;
|
|
686
691
|
const padded = (size - pageCount % size) % size;
|
|
687
|
-
return padded === 0 &&
|
|
692
|
+
return padded === 0 && lastPage === "blank" ? size : padded;
|
|
688
693
|
}
|
|
689
694
|
var WHICH_VALUES = new Set(["first", "start", "last", "first-except"]);
|
|
690
695
|
function parseWhich(raw) {
|
|
@@ -1111,7 +1116,7 @@ import { fileURLToPath } from "node:url";
|
|
|
1111
1116
|
var favicon_default = "./favicon-wkbm9cjn.ico";
|
|
1112
1117
|
|
|
1113
1118
|
// src/assets/manifest.schema.json
|
|
1114
|
-
var manifest_schema_default = "./manifest.schema-
|
|
1119
|
+
var manifest_schema_default = "./manifest.schema-gh0jjve9.json";
|
|
1115
1120
|
|
|
1116
1121
|
// src/assets/preview/scripts/preview-interface.js
|
|
1117
1122
|
var preview_interface_default = "./preview-interface-c44qk17f.js";
|
|
@@ -1126,7 +1131,7 @@ var preview_shell_default = "./preview-shell-xwn84kqr.js";
|
|
|
1126
1131
|
var CGATS21_CRPC1_default = "./CGATS21_CRPC1-g0e3k7kr.icc";
|
|
1127
1132
|
|
|
1128
1133
|
// src/assets/engine/gutterpress-viewer.js
|
|
1129
|
-
var gutterpress_viewer_default = "./gutterpress-viewer-
|
|
1134
|
+
var gutterpress_viewer_default = "./gutterpress-viewer-1n793gwd.js";
|
|
1130
1135
|
|
|
1131
1136
|
// src/assets/engine/gutterpress-agent.js
|
|
1132
1137
|
var gutterpress_agent_default = "./gutterpress-agent-cazqstr1.js";
|
|
@@ -1156,7 +1161,7 @@ var package_default = "./package-9rv69pxm.json";
|
|
|
1156
1161
|
var README_default = "./README-vsnsc1b3.md";
|
|
1157
1162
|
|
|
1158
1163
|
// src/assets/extension-templates/plugin/plugin.js.tpl
|
|
1159
|
-
var plugin_js_default = "./plugin.js-
|
|
1164
|
+
var plugin_js_default = "./plugin.js-cswq7wvd.tpl";
|
|
1160
1165
|
|
|
1161
1166
|
// src/assets/extension-templates/plugin/styles/plugin.css
|
|
1162
1167
|
var plugin_default = "./plugin-spbcem4j.css";
|
|
@@ -1171,7 +1176,7 @@ var fixture_default = "./fixture-2qnyqgb5.md";
|
|
|
1171
1176
|
var expected_default = "./expected-ycmacem8.html";
|
|
1172
1177
|
|
|
1173
1178
|
// src/assets/extension-templates/plugin/test/plugin.test.js.tpl
|
|
1174
|
-
var plugin_test_js_default = "./plugin.test.js-
|
|
1179
|
+
var plugin_test_js_default = "./plugin.test.js-xgxrd8hf.tpl";
|
|
1175
1180
|
|
|
1176
1181
|
// src/assets/extension-templates/theme/package.json
|
|
1177
1182
|
var package_default2 = "./package-aenwjew3.json";
|
|
@@ -1455,7 +1460,7 @@ async function postprocess(input, opts) {
|
|
|
1455
1460
|
g.media.width - inset,
|
|
1456
1461
|
g.media.height - inset
|
|
1457
1462
|
];
|
|
1458
|
-
const padded = signaturePadding(doc.getPageCount(), opts.signature, opts.
|
|
1463
|
+
const padded = signaturePadding(doc.getPageCount(), opts.signature, opts.lastPage);
|
|
1459
1464
|
for (let i = 0;i < padded; i++)
|
|
1460
1465
|
doc.addPage([g.media.width, g.media.height]);
|
|
1461
1466
|
const wantMarks = opts.marks || g.marks.includes("crop") || g.marks.includes("cross");
|
|
@@ -2232,12 +2237,12 @@ ${mapCss}`;
|
|
|
2232
2237
|
const post = await postprocess(bytes, {
|
|
2233
2238
|
geometry: tier2.geometry,
|
|
2234
2239
|
signature: opts.signature,
|
|
2235
|
-
|
|
2240
|
+
lastPage: opts.lastPage,
|
|
2236
2241
|
marks: opts.marks,
|
|
2237
2242
|
title: opts.title,
|
|
2238
2243
|
author: opts.author
|
|
2239
2244
|
});
|
|
2240
|
-
log(`postprocess: ${post.pageCount} pages` + (post.padded ? ` (+${post.padded} blank${opts.
|
|
2245
|
+
log(`postprocess: ${post.pageCount} pages` + (post.padded ? ` (+${post.padded} blank${opts.lastPage ? `; last page: ${opts.lastPage}` : ""})` : ""));
|
|
2241
2246
|
return {
|
|
2242
2247
|
bytes: post.bytes,
|
|
2243
2248
|
tier,
|
|
@@ -2597,4 +2602,4 @@ ${lines.length ? lines.join(`
|
|
|
2597
2602
|
`);
|
|
2598
2603
|
}
|
|
2599
2604
|
|
|
2600
|
-
export { getAssetsDir, getAssetPath, MARGIN_BOX_IGNORED_PROPERTIES, build };
|
|
2605
|
+
export { lastPageMode, getAssetsDir, getAssetPath, MARGIN_BOX_IGNORED_PROPERTIES, build };
|
package/dist/cli.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
UsageError,
|
|
7
7
|
package_default,
|
|
8
8
|
rejectUnknownFlags
|
|
9
|
-
} from "./cli-
|
|
9
|
+
} from "./cli-d57bsfpb.js";
|
|
10
10
|
import {
|
|
11
11
|
EXIT_CODES
|
|
12
12
|
} from "./cli-46ycxe6r.js";
|
|
@@ -18,14 +18,14 @@ import {
|
|
|
18
18
|
import { defineCommand, parseArgs, runMain } from "citty";
|
|
19
19
|
import { statSync } from "node:fs";
|
|
20
20
|
var SUBCOMMANDS = {
|
|
21
|
-
new: () => import("./new-
|
|
22
|
-
preview: () => import("./preview-
|
|
23
|
-
build: () => import("./build-
|
|
24
|
-
publish: () => import("./publish-
|
|
25
|
-
validate: () => import("./validate-
|
|
26
|
-
preflight: () => import("./preflight-
|
|
27
|
-
doctor: () => import("./doctor-
|
|
28
|
-
ext: () => import("./ext-
|
|
21
|
+
new: () => import("./new-kky3z7kv.js").then((m) => m.default),
|
|
22
|
+
preview: () => import("./preview-cxab4y5x.js").then((m) => m.default),
|
|
23
|
+
build: () => import("./build-394c1ee1.js").then((m) => m.default),
|
|
24
|
+
publish: () => import("./publish-s2mtenb5.js").then((m) => m.default),
|
|
25
|
+
validate: () => import("./validate-xaajdw4x.js").then((m) => m.default),
|
|
26
|
+
preflight: () => import("./preflight-t8v6szq6.js").then((m) => m.default),
|
|
27
|
+
doctor: () => import("./doctor-c459qv5j.js").then((m) => m.default),
|
|
28
|
+
ext: () => import("./ext-ha7gg8h9.js").then((m) => m.default)
|
|
29
29
|
};
|
|
30
30
|
var VERSION = package_default.version;
|
|
31
31
|
var main = defineCommand({
|
|
@@ -50,7 +50,7 @@ async function preflightRequiredInvocations(rawArgs) {
|
|
|
50
50
|
const [command, ...commandArgs] = rawArgs;
|
|
51
51
|
try {
|
|
52
52
|
if (command === "new") {
|
|
53
|
-
const { newArgs } = await import("./new-
|
|
53
|
+
const { newArgs } = await import("./new-kky3z7kv.js");
|
|
54
54
|
rejectUnknownFlags(commandArgs, newArgs, "new");
|
|
55
55
|
const parsed = parseArgs(commandArgs, {
|
|
56
56
|
...newArgs,
|
|
@@ -62,7 +62,7 @@ async function preflightRequiredInvocations(rawArgs) {
|
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
64
|
if (command === "preflight") {
|
|
65
|
-
const { preflightArgs } = await import("./preflight-
|
|
65
|
+
const { preflightArgs } = await import("./preflight-t8v6szq6.js");
|
|
66
66
|
rejectUnknownFlags(commandArgs, preflightArgs, "preflight");
|
|
67
67
|
const parsed = parseArgs(commandArgs, {
|
|
68
68
|
...preflightArgs,
|
|
@@ -82,7 +82,7 @@ async function preflightRequiredInvocations(rawArgs) {
|
|
|
82
82
|
}
|
|
83
83
|
if (subcommand.startsWith("-"))
|
|
84
84
|
return;
|
|
85
|
-
const { EXT_SUBCOMMANDS, extAddArgs, extRemoveArgs, extEnableArgs, extDisableArgs } = await import("./ext-
|
|
85
|
+
const { EXT_SUBCOMMANDS, extAddArgs, extRemoveArgs, extEnableArgs, extDisableArgs } = await import("./ext-ha7gg8h9.js");
|
|
86
86
|
if (!EXT_SUBCOMMANDS.includes(subcommand)) {
|
|
87
87
|
throw new UsageError(`gutterpress ext: unknown command "${subcommand}"`);
|
|
88
88
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getSystemDiagnostics,
|
|
3
3
|
log
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-3p1e95zc.js";
|
|
5
5
|
import {
|
|
6
6
|
UsageError,
|
|
7
7
|
rejectExtraPositionals,
|
|
8
8
|
rejectUnknownFlags
|
|
9
|
-
} from "./cli-
|
|
9
|
+
} from "./cli-d57bsfpb.js";
|
|
10
10
|
import"./cli-46ycxe6r.js";
|
|
11
11
|
import"./cli-7fkhgtfn.js";
|
|
12
12
|
import"./cli-37x76zdn.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Browser } from "../shared/cdp.ts";
|
|
2
2
|
import { type GcpmModel } from "../shared/gcpm-extract.ts";
|
|
3
|
+
import { type LastPageMode } from "../shared/synthesis.ts";
|
|
3
4
|
import { type Tier2Output } from "./tier2.ts";
|
|
4
5
|
import { type PostprocessResult } from "./postprocess.ts";
|
|
5
6
|
/**
|
|
@@ -19,8 +20,8 @@ export interface BuildOptions {
|
|
|
19
20
|
input: string;
|
|
20
21
|
output?: string;
|
|
21
22
|
signature?: number;
|
|
22
|
-
/**
|
|
23
|
-
|
|
23
|
+
/** the printer-reserved last page: see `LastPageMode` in shared/synthesis.ts */
|
|
24
|
+
lastPage?: LastPageMode;
|
|
24
25
|
marks?: boolean;
|
|
25
26
|
slugPt?: number;
|
|
26
27
|
bleedPt?: number;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
import { type LastPageMode } from "../shared/synthesis.ts";
|
|
1
2
|
import type { PageTrim } from "./tier2.ts";
|
|
2
3
|
export interface PostprocessOptions {
|
|
3
4
|
geometry: PageTrim;
|
|
4
5
|
/** append blank pages until pageCount % signature === 0 */
|
|
5
6
|
signature?: number;
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
-
* would add nothing, append one full signature of blank pages
|
|
9
|
-
* signature <= 1).
|
|
8
|
+
* `blank`: guarantee the last page is a blank page added here (if signature
|
|
9
|
+
* padding would add nothing, append one full signature of blank pages — one
|
|
10
|
+
* page when signature <= 1). `short-by-one`: stop one page short of a
|
|
11
|
+
* multiple of the signature, for the printer to add the last page.
|
|
10
12
|
*/
|
|
11
|
-
|
|
13
|
+
lastPage?: LastPageMode;
|
|
12
14
|
title?: string;
|
|
13
15
|
author?: string;
|
|
14
16
|
subject?: string;
|
|
@@ -34,14 +34,38 @@ export interface RectoSite {
|
|
|
34
34
|
* Page 1 is a recto; recto pages are odd.
|
|
35
35
|
*/
|
|
36
36
|
export declare function planRectoBlanks(sites: RectoSite[]): boolean[];
|
|
37
|
+
/**
|
|
38
|
+
* How the interior treats its last page for a printer that reserves it
|
|
39
|
+
* (DriveThruRPG puts its own information there):
|
|
40
|
+
* - `blank` — the build's last page is an empty one it added (padded to a
|
|
41
|
+
* multiple of the signature, plus a whole signature if that added nothing);
|
|
42
|
+
* - `short-by-one` — the interior is one page short of a multiple of the
|
|
43
|
+
* signature (`k × signature − 1`) and the printer supplies the last page.
|
|
44
|
+
*/
|
|
45
|
+
export type LastPageMode = "blank" | "short-by-one";
|
|
46
|
+
/** The `print` settings that decide how many blank pages the interior gets. */
|
|
47
|
+
export interface PrintPadding {
|
|
48
|
+
signature?: number;
|
|
49
|
+
/** older spelling of `lastPage: "blank"` */
|
|
50
|
+
reserveLastPage?: boolean;
|
|
51
|
+
lastPage?: LastPageMode;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The effective last-page mode of a resolved `print` block: `lastPage` when
|
|
55
|
+
* set, else the older `reserveLastPage: true` (which means `blank`). One
|
|
56
|
+
* place, so the manifest, the viewer's data attribute and the preflight
|
|
57
|
+
* check cannot disagree about what an existing manifest asks for.
|
|
58
|
+
*/
|
|
59
|
+
export declare function lastPageMode(print: PrintPadding): LastPageMode | undefined;
|
|
37
60
|
/**
|
|
38
61
|
* How many blank pages the build appends after `pageCount` content pages:
|
|
39
|
-
* enough to reach a multiple of `signature
|
|
40
|
-
*
|
|
41
|
-
* blank one (one page when `signature` <= 1)
|
|
42
|
-
*
|
|
62
|
+
* enough to reach a multiple of `signature` — with `lastPage: "blank"`, a full
|
|
63
|
+
* extra signature when that would add none, so the last page is always a
|
|
64
|
+
* blank one (one page when `signature` <= 1); with `"short-by-one"`, enough to
|
|
65
|
+
* reach one page short of a multiple. `postprocess.ts` pads the PDF by this
|
|
66
|
+
* and the viewer shows the same sheets, so their page counts agree.
|
|
43
67
|
*/
|
|
44
|
-
export declare function signaturePadding(pageCount: number, signature?: number,
|
|
68
|
+
export declare function signaturePadding(pageCount: number, signature?: number, lastPage?: LastPageMode): number;
|
|
45
69
|
export type StringWhich = "first" | "start" | "last" | "first-except";
|
|
46
70
|
export interface StringEntry {
|
|
47
71
|
/** 1-based page the assignment lands on */
|
|
@@ -12,16 +12,16 @@ import {
|
|
|
12
12
|
searchNpmExtensions,
|
|
13
13
|
setExtensionEnabled,
|
|
14
14
|
updateExtensions
|
|
15
|
-
} from "./cli-
|
|
16
|
-
import"./cli-
|
|
15
|
+
} from "./cli-9nba5ve6.js";
|
|
16
|
+
import"./cli-3p1e95zc.js";
|
|
17
17
|
import {
|
|
18
18
|
UsageError,
|
|
19
19
|
exitForUsage,
|
|
20
20
|
rejectExtraPositionals,
|
|
21
21
|
rejectUnknownFlags,
|
|
22
22
|
resolveProjectDir
|
|
23
|
-
} from "./cli-
|
|
24
|
-
import"./cli-
|
|
23
|
+
} from "./cli-d57bsfpb.js";
|
|
24
|
+
import"./cli-jyy9pqf3.js";
|
|
25
25
|
import {
|
|
26
26
|
EXIT_CODES
|
|
27
27
|
} from "./cli-46ycxe6r.js";
|
|
@@ -947,10 +947,12 @@
|
|
|
947
947
|
return wrong;
|
|
948
948
|
});
|
|
949
949
|
}
|
|
950
|
-
function signaturePadding(pageCount, signature = 1,
|
|
950
|
+
function signaturePadding(pageCount, signature = 1, lastPage) {
|
|
951
951
|
const size = signature > 1 ? signature : 1;
|
|
952
|
+
if (lastPage === "short-by-one")
|
|
953
|
+
return (size - (pageCount + 1) % size) % size;
|
|
952
954
|
const padded = (size - pageCount % size) % size;
|
|
953
|
-
return padded === 0 &&
|
|
955
|
+
return padded === 0 && lastPage === "blank" ? size : padded;
|
|
954
956
|
}
|
|
955
957
|
var WHICH_VALUES = new Set(["first", "start", "last", "first-except"]);
|
|
956
958
|
function parseWhich(raw) {
|
|
@@ -1678,7 +1680,7 @@
|
|
|
1678
1680
|
for (const spacer of Array.from(document.querySelectorAll(".gp-pad-spacer")))
|
|
1679
1681
|
spacer.remove();
|
|
1680
1682
|
const data = document.documentElement.dataset;
|
|
1681
|
-
const count = signaturePadding(contentPages, Number(data.gpSignature) || 1, data.
|
|
1683
|
+
const count = signaturePadding(contentPages, Number(data.gpSignature) || 1, data.gpLastPage);
|
|
1682
1684
|
const last = strips[strips.length - 1];
|
|
1683
1685
|
if (!last || count === 0)
|
|
1684
1686
|
return contentPages;
|