gutterpress 0.11.18-alpha.9 → 0.11.19-alpha.1
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 +1 -1
- package/dist/api/index.js +4 -2
- package/dist/{build-t1wxx70d.js → build-vgz3pr8y.js} +6 -6
- package/dist/{cdp-smdx6mr3.js → cdp-1hn3xsk2.js} +2 -2
- package/dist/{cdp-jg95s674.js → cdp-h0wa42cz.js} +1 -1
- package/dist/{cli-t1m7mpdz.js → cli-5j0a5hmc.js} +74 -5
- package/dist/{cli-7fkhgtfn.js → cli-asap4t1z.js} +4 -3
- package/dist/{cli-kkzka31p.js → cli-eyyggect.js} +1 -1
- package/dist/{cli-7t8r97zk.js → cli-mkn97gxp.js} +197 -181
- package/dist/{cli-5xt70xgy.js → cli-n3nd3sav.js} +1 -1
- package/dist/{cli-ptez7zcc.js → cli-xx94a1k6.js} +1 -1
- package/dist/cli.js +12 -12
- package/dist/{doctor-hsyr28at.js → doctor-gxf8ty3n.js} +3 -3
- package/dist/{engine-wtnakejg.js → engine-fe0n7v9p.js} +3 -3
- package/dist/{engine-zy6fzs5a.js → engine-zehw6tkv.js} +2 -2
- package/dist/{ext-4m3fx6ts.js → ext-7j388f5z.js} +6 -6
- package/dist/{index-n8vs6pss.js → index-b866g2ph.js} +1 -1
- package/dist/{index-rzm1phg0.js → index-bt0qws5c.js} +4 -3
- package/dist/{index-qm9mw408.js → index-n4ek1358.js} +130 -6
- package/dist/index.js +5 -3
- package/dist/lib/exec.d.ts +2 -1
- package/dist/lib/ghostscript.d.ts +20 -0
- package/dist/lib/remote-auth/sync.d.ts +21 -0
- package/dist/{new-6a3vr08x.js → new-0wyn55dn.js} +6 -6
- package/dist/{preflight-qcxb1bq7.js → preflight-re9v4skc.js} +6 -6
- package/dist/{preview-yaxfszs5.js → preview-2x113vyc.js} +6 -8
- package/dist/{publish-nzvdfe9y.js → publish-r379k1hr.js} +6 -6
- package/dist/{validate-5ybtaw18.js → validate-fje7ca9g.js} +6 -6
- package/package.json +1 -1
package/dist/api/index.d.ts
CHANGED
|
@@ -77,7 +77,7 @@ export { connectGenericHost, knownForgeTokenUrl, } from "../lib/remote-auth/gene
|
|
|
77
77
|
export type { GenericTokenConnectInput, GenericAuthOptions, } from "../lib/remote-auth/generic-auth.ts";
|
|
78
78
|
export { diagnoseProjectRemote, parseRemoteOrigin, forgeKindForHost, } from "../lib/remote-auth/diagnose.ts";
|
|
79
79
|
export type { ProjectRemoteDiagnosis, DiagnoseProjectRemoteOptions, RemoteProtocol, RemoteGuidanceId, ForgeKind, } from "../lib/remote-auth/diagnose.ts";
|
|
80
|
-
export { syncProject, refreshRemoteCopies, SYNC_SNAPSHOT_MESSAGE, } from "../lib/remote-auth/sync.ts";
|
|
80
|
+
export { syncProject, refreshRemoteCopies, checkRemoteUpdates, SYNC_SNAPSHOT_MESSAGE, } from "../lib/remote-auth/sync.ts";
|
|
81
81
|
export { repairOnlineBackup, REPAIR_SNAPSHOT_MESSAGE, type RepairOnlineBackupOptions, type RepairOnlineBackupResult, } from "../lib/remote-auth/repair.ts";
|
|
82
82
|
export { scorchedEarth, type ScorchedEarthOptions, type ScorchedEarthResult, } from "../lib/remote-auth/scorched-earth.ts";
|
|
83
83
|
export type { SyncOutcome, SyncProjectOptions, KeptBothFile, } from "../lib/remote-auth/sync.ts";
|
package/dist/api/index.js
CHANGED
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
autoSnapshotDelayMs,
|
|
38
38
|
autoSyncDelayMs,
|
|
39
39
|
checkExtensionUpdates,
|
|
40
|
+
checkRemoteUpdates,
|
|
40
41
|
cloneRepository,
|
|
41
42
|
connectGenericHost,
|
|
42
43
|
connectGoogleDrive,
|
|
@@ -136,7 +137,7 @@ import {
|
|
|
136
137
|
testRemoteAccess,
|
|
137
138
|
updateExtensions,
|
|
138
139
|
validateProjectExtensions
|
|
139
|
-
} from "../index-
|
|
140
|
+
} from "../index-n4ek1358.js";
|
|
140
141
|
import"../index-ht1bcqdd.js";
|
|
141
142
|
import {
|
|
142
143
|
BuildError
|
|
@@ -145,7 +146,7 @@ import {
|
|
|
145
146
|
DEFAULT_PRINT_OPTS,
|
|
146
147
|
assertMilestone,
|
|
147
148
|
readyProbeExpr
|
|
148
|
-
} from "../index-
|
|
149
|
+
} from "../index-bt0qws5c.js";
|
|
149
150
|
import {
|
|
150
151
|
AUTO_SNAPSHOT_MESSAGE,
|
|
151
152
|
HISTORY_PAGE_LIMIT,
|
|
@@ -282,6 +283,7 @@ export {
|
|
|
282
283
|
connectGoogleDrive,
|
|
283
284
|
connectGenericHost,
|
|
284
285
|
cloneRepository,
|
|
286
|
+
checkRemoteUpdates,
|
|
285
287
|
checkExtensionUpdates,
|
|
286
288
|
capabilitiesFor,
|
|
287
289
|
autoSyncDelayMs,
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runBuild,
|
|
3
3
|
splitOutPath
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-mkn97gxp.js";
|
|
5
5
|
import {
|
|
6
6
|
log
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-5j0a5hmc.js";
|
|
8
8
|
import {
|
|
9
9
|
UsageError,
|
|
10
10
|
parseFormat,
|
|
11
11
|
parsePdfxFlavor,
|
|
12
12
|
rejectExtraPositionals,
|
|
13
13
|
rejectUnknownFlags
|
|
14
|
-
} from "./cli-
|
|
14
|
+
} from "./cli-n3nd3sav.js";
|
|
15
15
|
import"./cli-ht1bcqdd.js";
|
|
16
|
-
import"./cli-
|
|
16
|
+
import"./cli-xx94a1k6.js";
|
|
17
17
|
import {
|
|
18
18
|
BuildError
|
|
19
19
|
} from "./cli-46ycxe6r.js";
|
|
20
|
-
import"./cli-
|
|
21
|
-
import"./cli-
|
|
20
|
+
import"./cli-eyyggect.js";
|
|
21
|
+
import"./cli-asap4t1z.js";
|
|
22
22
|
import"./cli-5qr3z0qa.js";
|
|
23
23
|
import"./cli-v5mp7a6q.js";
|
|
24
24
|
import"./cli-37x76zdn.js";
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
package_default
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-n3nd3sav.js";
|
|
4
4
|
import {
|
|
5
|
+
enhancedPath,
|
|
5
6
|
execCapture,
|
|
6
7
|
findTool,
|
|
7
8
|
fullInstallHint,
|
|
8
9
|
isToolAvailable,
|
|
9
10
|
resolveChromiumExecutable,
|
|
10
|
-
run
|
|
11
|
-
|
|
11
|
+
run,
|
|
12
|
+
spawnCapture
|
|
13
|
+
} from "./cli-asap4t1z.js";
|
|
12
14
|
import {
|
|
13
15
|
__require
|
|
14
16
|
} from "./cli-37x76zdn.js";
|
|
@@ -170,6 +172,58 @@ async function hasLiveTransparency(pdfBytes) {
|
|
|
170
172
|
}
|
|
171
173
|
return false;
|
|
172
174
|
}
|
|
175
|
+
async function findPostScriptShadingPages(pdfBytes) {
|
|
176
|
+
const { PDFDocument, PDFDict, PDFName, PDFNumber, PDFRawStream, PDFRef } = await import("pdf-lib");
|
|
177
|
+
let doc;
|
|
178
|
+
try {
|
|
179
|
+
doc = await PDFDocument.load(pdfBytes, {
|
|
180
|
+
updateMetadata: false,
|
|
181
|
+
throwOnInvalidObject: false
|
|
182
|
+
});
|
|
183
|
+
} catch {
|
|
184
|
+
return [];
|
|
185
|
+
}
|
|
186
|
+
const ctx = doc.context;
|
|
187
|
+
const asDict = (obj) => {
|
|
188
|
+
const o = obj instanceof PDFRef ? ctx.lookup(obj) : obj;
|
|
189
|
+
return o instanceof PDFRawStream ? o.dict : o instanceof PDFDict ? o : undefined;
|
|
190
|
+
};
|
|
191
|
+
const num = (obj) => {
|
|
192
|
+
const o = obj instanceof PDFRef ? ctx.lookup(obj) : obj;
|
|
193
|
+
return o instanceof PDFNumber ? o.asNumber() : undefined;
|
|
194
|
+
};
|
|
195
|
+
const isPostScriptShading = (shading) => {
|
|
196
|
+
const dict = asDict(shading);
|
|
197
|
+
if (!dict || num(dict.get(PDFName.of("ShadingType"))) !== 1)
|
|
198
|
+
return false;
|
|
199
|
+
return num(asDict(dict.get(PDFName.of("Function")))?.get(PDFName.of("FunctionType"))) === 4;
|
|
200
|
+
};
|
|
201
|
+
const subDicts = (resources, key) => {
|
|
202
|
+
const group = asDict(resources.get(PDFName.of(key)));
|
|
203
|
+
return group ? group.entries().map(([, v]) => v) : [];
|
|
204
|
+
};
|
|
205
|
+
const seen = new Set;
|
|
206
|
+
const usesPostScriptShading = (resources) => {
|
|
207
|
+
if (!resources || seen.has(resources))
|
|
208
|
+
return false;
|
|
209
|
+
seen.add(resources);
|
|
210
|
+
if (subDicts(resources, "Shading").some(isPostScriptShading))
|
|
211
|
+
return true;
|
|
212
|
+
for (const pattern of subDicts(resources, "Pattern")) {
|
|
213
|
+
const dict = asDict(pattern);
|
|
214
|
+
if (dict && isPostScriptShading(dict.get(PDFName.of("Shading"))))
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
return subDicts(resources, "XObject").some((x) => usesPostScriptShading(asDict(asDict(x)?.get(PDFName.of("Resources")))));
|
|
218
|
+
};
|
|
219
|
+
const pages = [];
|
|
220
|
+
doc.getPages().forEach((page, i) => {
|
|
221
|
+
seen.clear();
|
|
222
|
+
if (usesPostScriptShading(asDict(page.node.Resources())))
|
|
223
|
+
pages.push(i + 1);
|
|
224
|
+
});
|
|
225
|
+
return pages;
|
|
226
|
+
}
|
|
173
227
|
async function stripAnnotations(pdfPath, stagingDir) {
|
|
174
228
|
const tmp = join(stagingDir, "annotations-stripped.pdf");
|
|
175
229
|
try {
|
|
@@ -297,7 +351,22 @@ async function convertToPdfxCmyk(inputPdf, outPdf, config) {
|
|
|
297
351
|
if (!ghostscript) {
|
|
298
352
|
throw new Error("Ghostscript executable not found. Install Ghostscript or set GHOSTSCRIPT_PATH to its command-line executable.");
|
|
299
353
|
}
|
|
300
|
-
await
|
|
354
|
+
const { code, signal, stdout, stderr } = await spawnCapture(ghostscript, args, {
|
|
355
|
+
env: { ...process.env, PATH: enhancedPath }
|
|
356
|
+
});
|
|
357
|
+
if (signal) {
|
|
358
|
+
const version = await execCapture(ghostscript, ["--version"]).then((r) => r.stdout.trim()).catch(() => "unknown version");
|
|
359
|
+
throw new Error(`Ghostscript ${version} crashed (${signal}) while converting to PDF/X. This is a Ghostscript bug, not a problem with the PDF. Ghostscript 10.02.1 has been seen to crash in the PDF 1.3 transparency flattening PDF/X requires, on a page with an alpha-channel image. Flattening that image against its background avoided it there; a newer Ghostscript may too. A plain PDF (--format pdf) does not run this step.`);
|
|
360
|
+
}
|
|
361
|
+
if (code !== 0) {
|
|
362
|
+
throw new Error(`${ghostscript} ${args.join(" ")} exited ${code}
|
|
363
|
+
${stdout}${stderr}`);
|
|
364
|
+
}
|
|
365
|
+
const at = stderr.indexOf("The following warnings");
|
|
366
|
+
if (at >= 0) {
|
|
367
|
+
log.warn(`Ghostscript reported problems converting to PDF/X:
|
|
368
|
+
${stderr.slice(at).trim()}`);
|
|
369
|
+
}
|
|
301
370
|
} finally {
|
|
302
371
|
await unlink(tmpDef).catch(() => {});
|
|
303
372
|
}
|
|
@@ -514,4 +583,4 @@ async function getSystemDiagnostics() {
|
|
|
514
583
|
};
|
|
515
584
|
}
|
|
516
585
|
|
|
517
|
-
export { setLogLevel, debug, info, warn, error, log, resolveGhostscript, hasLiveTransparency, stripAnnotations, stampCreator, convertToPdfxCmyk, PACKAGE_META, PACKAGE_VERSION, defaultConfigDir, FileTokenStore, getSystemDiagnostics };
|
|
586
|
+
export { setLogLevel, debug, info, warn, error, log, resolveGhostscript, hasLiveTransparency, findPostScriptShadingPages, stripAnnotations, stampCreator, convertToPdfxCmyk, PACKAGE_META, PACKAGE_VERSION, defaultConfigDir, FileTokenStore, getSystemDiagnostics };
|
|
@@ -16,11 +16,12 @@ function run(cmd, args, opts = {}) {
|
|
|
16
16
|
return new Promise((resolve, reject) => {
|
|
17
17
|
const p = spawn(cmd, args, { stdio: "inherit", cwd: opts.cwd, env: enhancedEnv() });
|
|
18
18
|
p.on("error", reject);
|
|
19
|
-
p.on("exit", (code) => {
|
|
19
|
+
p.on("exit", (code, signal) => {
|
|
20
20
|
if (code === 0)
|
|
21
21
|
return resolve();
|
|
22
22
|
const cwd = opts.cwd ?? process.cwd();
|
|
23
|
-
|
|
23
|
+
const what = signal ? `was killed by signal ${signal}` : `exited ${code}`;
|
|
24
|
+
reject(Object.assign(new Error(`${cmd} ${args.join(" ")} (cwd=${cwd}) ${what}`), { signal }));
|
|
24
25
|
});
|
|
25
26
|
});
|
|
26
27
|
}
|
|
@@ -240,4 +241,4 @@ async function requireChromiumExecutable() {
|
|
|
240
241
|
`));
|
|
241
242
|
}
|
|
242
243
|
|
|
243
|
-
export { run, spawnCapture, execCapture, isToolAvailable, findTool, INSTALL_HINTS, fullInstallHint, resolveChromiumExecutable, requireChromiumExecutable };
|
|
244
|
+
export { enhancedPath, run, spawnCapture, execCapture, isToolAvailable, findTool, INSTALL_HINTS, fullInstallHint, resolveChromiumExecutable, requireChromiumExecutable };
|