gutterpress 0.11.16-alpha.5 → 0.11.16-alpha.6

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/README.md CHANGED
@@ -178,6 +178,10 @@ build-and-open instead. `--manifest` applies only to those one-shot PDF/PDF-X
178
178
  modes; live HTML preview discovers the project manifest from its input
179
179
  directory.
180
180
 
181
+ Before it loads plugins, `preview` downloads any pinned npm extension whose
182
+ copy is missing (see [Restoring pinned extensions](#restoring-pinned-extensions)).
183
+ If that fails it warns and previews anyway; the one-shot PDF modes fail fast.
184
+
181
185
  ```sh
182
186
  gutterpress preview [input-dir] [options]
183
187
 
@@ -204,6 +208,8 @@ gutterpress preview [input-dir] [options]
204
208
 
205
209
  Build a PDF (default) or HTML output. Pipeline: `validate:pre → convert → assets → build → validate:post`. The CSS print-safety check (remote urls, risky print effects, page-containment) runs once, inside `validate:pre`, as the `source.stylelint` check — there is no separate lint phase.
206
210
 
211
+ Before it loads plugins, `build` downloads any pinned npm extension whose copy is missing — a fresh clone has the pins but not the files — and prints one `Downloaded name@version (pinned in manifest.yaml)` line per package. If a download fails, the build stops and names the extension, why, and how to retry. See [Restoring pinned extensions](#restoring-pinned-extensions).
212
+
207
213
  ```sh
208
214
  gutterpress build [input-dir] [options]
209
215
 
@@ -272,7 +278,7 @@ gutterpress publish --provider gdrive ./my-book
272
278
 
273
279
  Run the validation pipeline (pre-build source checks and/or post-build PDF checks). Tools that aren't installed are skipped with a warning — they don't fail the run. See [User Guide: Chapter 6 — Validation](https://github.com/dimm-city/gutterpress/blob/main/examples/gutterpress-user-guide/06-validation.md) for the full check list and [User Guide: Chapter 7 — System Setup](https://github.com/dimm-city/gutterpress/blob/main/examples/gutterpress-user-guide/07-system-setup.md) for which external tools each check needs.
274
280
 
275
- The positional directory and `--pdf`/`--input` are independent: the positional (or `--input`) sets the pre-build source directory, `--pdf` separately points at a built PDF for post-build checks. `--input` overrides the positional if both are given.
281
+ The positional directory and `--pdf`/`--input` are independent: the positional (or `--input`) sets the pre-build source directory, `--pdf` separately points at a built PDF for post-build checks. `--input` overrides the positional if both are given. When a source directory is given, missing pinned npm extensions are downloaded first, as for `build` (a failed download exits 3 with the reason). This holds for `preflight` too. The `Downloaded …` lines go to stderr, so `--format json` output stays parseable.
276
282
 
277
283
  ```sh
278
284
  gutterpress validate [dir] [options]
@@ -392,6 +398,31 @@ Add an extension. What `SOURCE` is decides what happens:
392
398
  Adding something already listed re-pins or updates that entry instead of
393
399
  adding a second one.
394
400
 
401
+ An npm install also makes sure the book's `.gitignore` ignores `plugins/npm/`
402
+ (append-only; an author's own `!plugins/npm/` re-include is respected and the
403
+ install warns that downloaded extensions shouldn't be committed). The manifest
404
+ pin is what travels with the book; the downloaded copy does not.
405
+
406
+ ##### Restoring pinned extensions
407
+
408
+ A fresh clone has `manifest.yaml`'s `name@version` pins but not the downloaded
409
+ copies under `plugins/npm/`. `build`, `validate`, `preflight` and `preview`
410
+ download any missing (or incomplete) pinned version before they load plugins —
411
+ exactly the pinned version, through the same registry-resolved, hash-verified,
412
+ load-tested install as `ext add`, without touching the manifest. Builds and
413
+ checks do it inside the shared plugin-loading step, so every build and export
414
+ (including the desktop's) and every check run does it, and fails with the
415
+ extension, the reason and how to retry when it cannot. Nothing is downloaded,
416
+ and the network is not used, when every copy is present; unpinned names, local
417
+ paths and bundled features are never touched. The plugin loader itself stays
418
+ offline. The desktop app does the same when it opens a book.
419
+
420
+ Once a package's pinned version is installed (by `ext add` or a restore), its
421
+ other downloaded versions under `plugins/npm/<name>/` are deleted — a cache
422
+ that a pulled pin or branch switch would otherwise leave to pile up — except a
423
+ version another enabled manifest entry still pins. A failed install removes the
424
+ folders it created and nothing else.
425
+
395
426
  ```sh
396
427
  gutterpress ext add <source> [dir] [options]
397
428
 
@@ -518,9 +549,10 @@ Order is load order: a later entry's markdown runs after earlier entries' (and s
518
549
 
519
550
  Pinned npm packages and their runtime dependencies live under `plugins/npm/`
520
551
  as a plain nested `node_modules` tree, which Node's own module resolution loads.
521
- They travel with the project and builds never fetch from the registry; each
522
- tarball's integrity is checked against the registry's hash when it is
523
- installed. Install/build scripts, native addon compilation, bundled
552
+ The pin travels with the project; the downloaded copy is gitignored, and
553
+ `build`, `validate`, `preflight` and `preview` download a missing pinned version first
554
+ (nothing is fetched when every copy is present). Each tarball's integrity is
555
+ checked against the registry's hash when it is installed. Install/build scripts, native addon compilation, bundled
524
556
  `node_modules`, and non-registry dependency selectors are intentionally
525
557
  unsupported. Only install packages you trust: extensions run unsandboxed with
526
558
  the process's full filesystem and network privileges.
@@ -21,7 +21,8 @@ export { getSystemDiagnostics, } from "../lib/diagnostics";
21
21
  export type { ToolStatus, SystemDiagnostics, } from "../lib/diagnostics";
22
22
  export { detectProjectSource, capabilitiesFor, findEnclosingRepoDir, repoSubPath, repoRootForSource, } from "../lib/project-source";
23
23
  export type { ProjectSource, ProjectCapabilities, } from "../lib/project-source";
24
- export { scaffoldProject, adoptFolder, ensureGitignoreHasDist, slugifyProjectName, escapeYamlScalar, } from "../lib/project-scaffold.ts";
24
+ export { scaffoldProject, adoptFolder, slugifyProjectName, escapeYamlScalar, } from "../lib/project-scaffold.ts";
25
+ export { ensureProjectGitignore } from "../lib/project-gitignore.ts";
25
26
  export type { ProjectTemplateId, ProjectVersionHistoryMode, CreateProjectOptions, CustomPageOptions, AdoptFolderOptions, CreateProjectResult, CreateProjectErrorCode, CreateProjectError, } from "../lib/project-scaffold.ts";
26
27
  export { scaffoldExtension, resolveExtensionPrefix, EXTENSION_KINDS, RESERVED_PREFIX, } from "../lib/extension-scaffold.ts";
27
28
  export type { ExtensionKind, ScaffoldExtensionOptions, ScaffoldExtensionResult, } from "../lib/extension-scaffold.ts";
@@ -37,6 +38,8 @@ export { listProjectExtensions, describeExtension, addExtension, checkExtensionU
37
38
  export type { ProjectExtensionEntry, ExtensionValidationResult, RecommendedExtension, ExtensionSourceKind, BuiltInStyleSet, BuiltInStyleSetId, AddExtensionOptions, ExtensionUpdateCheck, ExtensionUpdateResult, CheckExtensionUpdatesOptions, UpdateExtensionsOptions, } from "../lib/extension-manager.ts";
38
39
  export { BUNDLED_EXTENSIONS, isBundledExtension, isPathSpecifier, parseExtensionSpecifier, } from "../lib/extension-specifier.ts";
39
40
  export type { ParsedExtensionSpecifier } from "../lib/extension-specifier.ts";
41
+ export { restorePinnedExtensions, restoreFailureMessage } from "../lib/extension-restore.ts";
42
+ export type { RestorePinnedOptions, RestoreResult, RestoreFailure, RestoreProgress } from "../lib/extension-restore.ts";
40
43
  export { importExtensionFromFile, importExtensionFromUrl } from "../lib/extension-import.ts";
41
44
  export type { ExtensionImportResult, ExtensionImportWarning } from "../lib/extension-import.ts";
42
45
  export { MAX_SEARCH_BYTES, SEARCH_KEYWORDS, searchNpmExtensions, } from "../lib/extension-search.ts";
package/dist/api/index.js CHANGED
@@ -46,7 +46,7 @@ import {
46
46
  describeExtension,
47
47
  diagnoseProjectRemote,
48
48
  disconnectPublishCredential,
49
- ensureGitignoreHasDist,
49
+ ensureProjectGitignore,
50
50
  escapeYamlScalar,
51
51
  extensionCarries,
52
52
  extensionEntry,
@@ -106,6 +106,8 @@ import {
106
106
  resolveGoogleClientSecret,
107
107
  resolvePublishFormat,
108
108
  resolvePublishRequest,
109
+ restoreFailureMessage,
110
+ restorePinnedExtensions,
109
111
  revokeGoogleCredential,
110
112
  runBuild,
111
113
  runPublish,
@@ -129,7 +131,7 @@ import {
129
131
  testRemoteAccess,
130
132
  updateExtensions,
131
133
  validateProjectExtensions
132
- } from "../index-nk2mt7gp.js";
134
+ } from "../index-ss8dv3zf.js";
133
135
  import {
134
136
  BuildError
135
137
  } from "../index-ee7wp8q3.js";
@@ -188,6 +190,8 @@ export {
188
190
  runBuild,
189
191
  revokeGoogleCredential,
190
192
  restoreVersionWithBackup,
193
+ restorePinnedExtensions,
194
+ restoreFailureMessage,
191
195
  resolvePublishRequest,
192
196
  resolvePublishFormat,
193
197
  resolveLogger,
@@ -255,7 +259,7 @@ export {
255
259
  extensionEntry,
256
260
  extensionCarries,
257
261
  escapeYamlScalar,
258
- ensureGitignoreHasDist,
262
+ ensureProjectGitignore,
259
263
  disconnectPublishCredential,
260
264
  diagnoseProjectRemote,
261
265
  detectProjectSource,
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  runBuild,
3
3
  splitOutPath
4
- } from "./cli-4d4xegsw.js";
4
+ } from "./cli-ac7zs8sp.js";
5
5
  import {
6
6
  log
7
- } from "./cli-6s4pkvbx.js";
7
+ } from "./cli-n9e1mzb7.js";
8
8
  import {
9
9
  UsageError,
10
10
  parseFormat,
11
11
  parsePdfxFlavor,
12
12
  rejectExtraPositionals,
13
13
  rejectUnknownFlags
14
- } from "./cli-cg03zvez.js";
14
+ } from "./cli-nzzsyw1e.js";
15
15
  import"./cli-wqy8hnnh.js";
16
16
  import {
17
17
  BuildError
@@ -53,15 +53,17 @@ var build_default = defineCommand({
53
53
  log.info(`Format: ${format}`);
54
54
  const pdfxFlavor = parsePdfxFlavor(args["pdfx-flavor"], format);
55
55
  const { outDir, pdfFileOverride } = splitOutPath(typeof args.out === "string" ? args.out : undefined, format);
56
+ const inputDir = path.resolve(args.input ?? ".");
57
+ const manifestPath = typeof args.manifest === "string" ? args.manifest : undefined;
56
58
  await runBuild({
57
- inputDir: path.resolve(args.input ?? "."),
59
+ inputDir,
58
60
  format,
59
61
  outDir,
60
62
  pdfFileOverride,
61
63
  title: typeof args.title === "string" ? args.title : undefined,
62
64
  pdfxFlavor,
63
65
  iccPath: typeof args.icc === "string" ? args.icc : undefined,
64
- manifestPath: typeof args.manifest === "string" ? args.manifest : undefined,
66
+ manifestPath,
65
67
  stripAnnotations: typeof args["strip-annotations"] === "boolean" ? args["strip-annotations"] : undefined,
66
68
  skipLint: !!args["skip-lint"],
67
69
  skipPreValidate: !!args["skip-pre-validate"],