@dogsbay/ssg-cli 0.2.0-beta.183 → 0.2.0-beta.188

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 (29) hide show
  1. package/AGENTS.md +168 -0
  2. package/README.md +3 -1
  3. package/THIRD-PARTY-NOTICES.txt +23 -17
  4. package/chunks/{build-command-QLNZ5BNK.mjs → build-command-NJATVOUY.mjs} +37 -26
  5. package/chunks/check-command-FL5O3AXB.mjs +577 -0
  6. package/chunks/chunk-2EM7IEQT.mjs +95 -0
  7. package/chunks/{chunk-JABACD5T.mjs → chunk-5A2QPRCV.mjs} +1 -30
  8. package/chunks/chunk-5NQOUB5I.mjs +4534 -0
  9. package/chunks/chunk-CYJ6GFVM.mjs +77 -0
  10. package/chunks/{chunk-KE6N5RFA.mjs → chunk-FFIXBXHD.mjs} +63 -234
  11. package/chunks/chunk-GFG5I7WI.mjs +807 -0
  12. package/chunks/chunk-GZ3E45TE.mjs +2290 -0
  13. package/chunks/chunk-IAAKV7V2.mjs +37 -0
  14. package/chunks/{chunk-IERF2DNL.mjs → chunk-VJ6AESSJ.mjs} +8072 -8555
  15. package/chunks/chunk-X3UPCLX5.mjs +503 -0
  16. package/chunks/{chunk-QDXUP47M.mjs → chunk-ZDH4JRVX.mjs} +1203 -4035
  17. package/chunks/{chunk-LNWQN7K7.mjs → chunk-ZRGJHNES.mjs} +7 -1
  18. package/chunks/compare-W4DJYVHT.mjs +239 -0
  19. package/chunks/compare-command-U36H55IE.mjs +144 -0
  20. package/chunks/{css-build-VKKTSP6P.mjs → css-build-MKIHYHCX.mjs} +2 -1
  21. package/chunks/{dev-HXLVZ7MF.mjs → dev-X3PKN4G3.mjs} +77 -25
  22. package/chunks/{menu-N2AZSZKS.mjs → menu-J3CLVADF.mjs} +9 -5
  23. package/chunks/{publish-command-UFHG6PJN.mjs → publish-command-SAPICGGM.mjs} +15 -7
  24. package/chunks/{release-diff-LFDQIFEF.mjs → release-diff-Y7X63MT3.mjs} +13 -6
  25. package/chunks/{serve-WGWRM7JQ.mjs → serve-7DR4WSYA.mjs} +3 -1
  26. package/cli.mjs +17 -10
  27. package/package.json +4 -3
  28. package/chunks/check-command-5U7VSMDO.mjs +0 -218
  29. package/chunks/chunk-KFYMG4VB.mjs +0 -45
package/AGENTS.md ADDED
@@ -0,0 +1,168 @@
1
+ # dogsbay-ssg for AI assistants
2
+
3
+ How to write, check and build a Dogsbay documentation site with `dogsbay-ssg`. This file ships in the
4
+ `@dogsbay/ssg-cli` npm package and matches its version: `dogsbay-ssg --version` prints it. The
5
+ `dogsbay` package's AGENTS.md says the same for the Dogsbay CLI and its Astro build; the project
6
+ files are the same for both.
7
+
8
+ ## Run the right command
9
+
10
+ | Task | Command |
11
+ |---|---|
12
+ | Build a project into a static site | `npx @dogsbay/ssg-cli@beta build <project> -o <out>` |
13
+ | Check the project and the built pages | `npx @dogsbay/ssg-cli@beta check <project>` |
14
+ | Preview a built site | `npx @dogsbay/ssg-cli@beta serve <out>` |
15
+ | Preview while editing (live reload) | `npx @dogsbay/ssg-cli@beta dev <project>` |
16
+ | Print the generator's version | `npx @dogsbay/ssg-cli@beta --version` |
17
+
18
+ - The command is named `dogsbay-ssg`, but the package is **`@dogsbay/ssg-cli`**. `npx dogsbay-ssg`
19
+ works only where that package is installed (`npm install --save-dev @dogsbay/ssg-cli@beta`).
20
+ `@dogsbay/ssg` is a library for browsers, not the command.
21
+ - Use `@beta` or an exact version (`@dogsbay/ssg-cli@0.2.0-beta.N`). If a build misreads a project,
22
+ check the version first: suspect an old generator before changing the project.
23
+ - `<command> --help` lists a command's options.
24
+ - The output works from a web server and from disk (`file://`). It needs no CDN. (With
25
+ `ssg.search: pagefind`, search works only from a web server.)
26
+
27
+ ## Project layout
28
+
29
+ ```text
30
+ my-docs/
31
+ dogsbay.config.yml site settings (optional, but it is where the site's name goes)
32
+ content/
33
+ nav.yml the menu (sidebar); optional: without it the folders give the menu
34
+ index.md the home page
35
+ guides/
36
+ install.md
37
+ data/ optional: YAML, JSON or CSV that pages show with ::data-table
38
+ ```
39
+
40
+ Without `dogsbay.config.yml`, `content/` is the content folder if there is one, otherwise the project
41
+ folder is.
42
+
43
+ ## dogsbay.config.yml
44
+
45
+ ```yaml
46
+ schemaVersion: 1
47
+ site:
48
+ name: Acme Docs # the site's name: site.name, never title:
49
+ description: Install and run Acme.
50
+ url: https://docs.acme.com # optional: canonical links, sitemap
51
+ content:
52
+ sources:
53
+ - path: ./content
54
+ redirects: # top level, not under site:
55
+ /old-page/: /guides/install/
56
+ ```
57
+
58
+ - The site's name is `site.name`. `site.title`, a top-level `title:` and `site.redirects` are not
59
+ read; the build warns about them. The Dogsbay CLI refuses a config without `site.name`, so always set it.
60
+ - `site.url` is a full `https://` address. Without it the build makes no sitemap or canonical links,
61
+ and `check` fails with `seo/sitemap-present`. Set `site.url` if the site has an address; if it has
62
+ none (a local or artifact build), run `check <project> --skip seo/sitemap-present`.
63
+ - `basePath` (under `site:`) defaults to `""`, served from the root. Set it only when asked.
64
+ - Write `true` and `false`, not `yes` and `no`.
65
+ - Unknown keys are ignored. If a setting seems to do nothing, check its spelling and its section.
66
+
67
+ ## content/nav.yml
68
+
69
+ ```yaml
70
+ - label: Overview
71
+ file: index.md
72
+ - label: Guides
73
+ children:
74
+ - label: Install
75
+ file: guides/install.md
76
+ - file: guides/configure.md # no label: the page's title
77
+ - label: GitHub
78
+ href: https://github.com/acme/acme
79
+ ```
80
+
81
+ - Fields: `label`, `file` (a path from this menu file's folder, with `.md`), `href` (a URL or a
82
+ site path), `children`, `include` (another menu file), `toc: false` (built, not in the menu),
83
+ `unlisted: true` (built, listed nowhere).
84
+ - The short form `- Install: guides/install.md` is read too, and the two forms mix.
85
+ - **Keep the menu file the project has.** Never convert `nav.yml` to `nav.json`, or one form into
86
+ the other, to make a build accept it. Both are read; with both present, `nav.yml` wins.
87
+ - A problem in the menu fails the build and names the file and line. Fix that entry; do not rewrite
88
+ the file.
89
+
90
+ ## Pages
91
+
92
+ ```markdown
93
+ ---
94
+ title: Install Acme
95
+ description: Install Acme on Linux, macOS or Windows.
96
+ ---
97
+
98
+ Start the body here. The title is the page's heading, so the body starts at `##`.
99
+
100
+ ## Requirements
101
+
102
+ - Linux, macOS or Windows.
103
+ - See [Configure](configure.md) next.
104
+ ```
105
+
106
+ - `title` and `description` in front matter. `status: draft` keeps a page out of `build`; `dev`
107
+ still shows it.
108
+ - Link to other pages by their file: `[Configure](configure.md)` from the same folder, or
109
+ `[Configure](/guides/configure.md)` from the content folder's root. The build writes the site
110
+ address. Do not hand-write `/docs/guides/configure/`.
111
+ - Images go beside the page or in a folder under the content folder: `![Alt text](images/x.png)`.
112
+ - Files and folders whose names start with `_` are not pages: use them for includes.
113
+
114
+ ## Markdown syntax
115
+
116
+ CommonMark and GitHub Flavored Markdown, plus `:::` directives:
117
+
118
+ ````markdown
119
+ > [!WARNING]
120
+ > Back up first.
121
+
122
+ :::steps
123
+ 1. **Download**
124
+
125
+ Get the archive.
126
+
127
+ 2. **Install**
128
+
129
+ Run `./install.sh`.
130
+ :::
131
+
132
+ :::tabs
133
+ Linux
134
+ : ```bash
135
+ curl -fsSL https://get.acme.dev | sh
136
+ ```
137
+
138
+ macOS
139
+ : ```bash
140
+ brew install acme
141
+ ```
142
+ :::
143
+
144
+ Press :kbd[Ctrl+C] to stop.
145
+ ````
146
+
147
+ - Callouts: `> [!NOTE]`, `> [!TIP]`, `> [!IMPORTANT]`, `> [!WARNING]`, `> [!CAUTION]`.
148
+ - Tabs are a definition list inside `:::tabs`: the tab's label on its own line, then `:` and the
149
+ content indented four spaces.
150
+ - Each `:::` block closes with its own `:::`. Inline directives take one colon (`:kbd[...]`).
151
+ - Give every code block its language.
152
+ - `dogsbay-ssg check <project>` reports Markdown it cannot read (`markdown/syntax`), with the file
153
+ and line.
154
+
155
+ ## Publishing elsewhere
156
+
157
+ To publish the site as a claude.ai artifact, run `npx @dogsbay/ssg-cli@beta check <project> --artifact`
158
+ first: each message says what to change. Two of its errors are expected: `_headers` and `_redirects`
159
+ are files for Cloudflare and Netlify, so leave them out of the upload. Fix `_dogsbay/` with
160
+ `ssg.assetsFolder` and build again, not by renaming it in the output.
161
+
162
+ ## Mistakes to avoid
163
+
164
+ - `title:` for the site's name (it is `site.name`), or `redirects` under `site:`.
165
+ - `npx dogsbay-ssg` without installing `@dogsbay/ssg-cli`.
166
+ - Rewriting a menu file, or changing its format, instead of fixing the entry the build names.
167
+ - Absolute `/docs/...` links to the site's own pages (link the `.md` file).
168
+ - Raw HTML for layout: use the directives.
package/README.md CHANGED
@@ -15,7 +15,9 @@ npm install --save-dev @dogsbay/ssg-cli@beta
15
15
  npx dogsbay-ssg dev # live reload while you edit
16
16
  ```
17
17
 
18
- Node 20 or later.
18
+ Node 20 or later. `dogsbay-ssg --version` prints the version.
19
+
20
+ AI assistants: read `AGENTS.md` in this package before writing or building a project. It matches this version.
19
21
 
20
22
  ## Commands
21
23
 
@@ -1,55 +1,55 @@
1
1
  Third-party software in dist/cli.mjs and its chunks
2
2
 
3
3
  ========================================================================
4
- @dogsbay/corpus@0.2.0-beta.183 (MIT)
4
+ @dogsbay/corpus@0.2.0-beta.188 (MIT)
5
5
  https://github.com/dogsbay/dogsbay.git
6
6
 
7
7
  Licensed under MIT; the package ships no licence file.
8
8
 
9
9
  ========================================================================
10
- @dogsbay/detect@0.2.0-beta.183 (MIT)
10
+ @dogsbay/detect@0.2.0-beta.188 (MIT)
11
11
  https://github.com/dogsbay/dogsbay.git
12
12
 
13
13
  Licensed under MIT; the package ships no licence file.
14
14
 
15
15
  ========================================================================
16
- @dogsbay/elements@0.2.0-beta.183 (MIT)
16
+ @dogsbay/elements@0.2.0-beta.188 (MIT)
17
17
  https://github.com/dogsbay/dogsbay.git
18
18
 
19
19
  Licensed under MIT; the package ships no licence file.
20
20
 
21
21
  ========================================================================
22
- @dogsbay/format-dogsbay-md@0.2.0-beta.183 (MIT)
22
+ @dogsbay/format-dogsbay-md@0.2.0-beta.188 (MIT)
23
23
  https://github.com/dogsbay/dogsbay.git
24
24
 
25
25
  Licensed under MIT; the package ships no licence file.
26
26
 
27
27
  ========================================================================
28
- @dogsbay/format-openapi@0.2.0-beta.183 (MIT)
28
+ @dogsbay/format-openapi@0.2.0-beta.188 (MIT)
29
29
  https://github.com/dogsbay/dogsbay.git
30
30
 
31
31
  Licensed under MIT; the package ships no licence file.
32
32
 
33
33
  ========================================================================
34
- @dogsbay/format-topicmap@0.2.0-beta.183 (MIT)
34
+ @dogsbay/format-topicmap@0.2.0-beta.188 (MIT)
35
35
  https://github.com/dogsbay/dogsbay.git
36
36
 
37
37
  Licensed under MIT; the package ships no licence file.
38
38
 
39
39
  ========================================================================
40
- @dogsbay/highlight@0.2.0-beta.183 (MIT)
40
+ @dogsbay/highlight@0.2.0-beta.188 (MIT)
41
41
  https://github.com/dogsbay/dogsbay.git
42
42
 
43
43
  Licensed under MIT; the package ships no licence file.
44
44
 
45
45
  ========================================================================
46
- @dogsbay/icons@0.2.0-beta.183 (MIT)
46
+ @dogsbay/icons@0.2.0-beta.188 (MIT)
47
47
  https://github.com/dogsbay/dogsbay.git
48
48
 
49
49
  Licensed under MIT; the package ships no licence file.
50
50
 
51
51
  ========================================================================
52
- @dogsbay/minja@0.2.0-beta.183 (MIT)
52
+ @dogsbay/minja@0.2.0-beta.188 (MIT)
53
53
 
54
54
  MIT License
55
55
 
@@ -74,49 +74,55 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
74
74
  SOFTWARE.
75
75
 
76
76
  ========================================================================
77
- @dogsbay/primitives@0.2.0-beta.183 (MIT)
77
+ @dogsbay/primitives@0.2.0-beta.188 (MIT)
78
78
  https://github.com/dogsbay/dogsbay.git
79
79
 
80
80
  Licensed under MIT; the package ships no licence file.
81
81
 
82
82
  ========================================================================
83
- @dogsbay/render-html@0.2.0-beta.183 (MIT)
83
+ @dogsbay/render-html@0.2.0-beta.188 (MIT)
84
84
  https://github.com/dogsbay/dogsbay.git
85
85
 
86
86
  Licensed under MIT; the package ships no licence file.
87
87
 
88
88
  ========================================================================
89
- @dogsbay/search@0.2.0-beta.183 (MIT)
89
+ @dogsbay/search@0.2.0-beta.188 (MIT)
90
90
  https://github.com/dogsbay/dogsbay.git
91
91
 
92
92
  Licensed under MIT; the package ships no licence file.
93
93
 
94
94
  ========================================================================
95
- @dogsbay/serialize-core@0.2.0-beta.183 (MIT)
95
+ @dogsbay/serialize-core@0.2.0-beta.188 (MIT)
96
96
  https://github.com/dogsbay/dogsbay.git
97
97
 
98
98
  Licensed under MIT; the package ships no licence file.
99
99
 
100
100
  ========================================================================
101
- @dogsbay/site-check@0.2.0-beta.183 (MIT)
101
+ @dogsbay/site-check@0.2.0-beta.188 (MIT)
102
102
  https://github.com/dogsbay/dogsbay.git
103
103
 
104
104
  Licensed under MIT; the package ships no licence file.
105
105
 
106
106
  ========================================================================
107
- @dogsbay/site-files@0.2.0-beta.183 (MIT)
107
+ @dogsbay/site-files@0.2.0-beta.188 (MIT)
108
108
  https://github.com/dogsbay/dogsbay.git
109
109
 
110
110
  Licensed under MIT; the package ships no licence file.
111
111
 
112
112
  ========================================================================
113
- @dogsbay/types@0.2.0-beta.183 (MIT)
113
+ @dogsbay/tree-diff@0.2.0-beta.188 (MIT)
114
114
  https://github.com/dogsbay/dogsbay.git
115
115
 
116
116
  Licensed under MIT; the package ships no licence file.
117
117
 
118
118
  ========================================================================
119
- @dogsbay/ui@0.2.0-beta.183 (MIT)
119
+ @dogsbay/types@0.2.0-beta.188 (MIT)
120
+ https://github.com/dogsbay/dogsbay.git
121
+
122
+ Licensed under MIT; the package ships no licence file.
123
+
124
+ ========================================================================
125
+ @dogsbay/ui@0.2.0-beta.188 (MIT)
120
126
  https://github.com/dogsbay/dogsbay.git
121
127
 
122
128
  Licensed under MIT; the package ships no licence file.
@@ -7,39 +7,47 @@ import {
7
7
  } from "./chunk-OBUK53NJ.mjs";
8
8
  import {
9
9
  build,
10
- buildUnits,
10
+ selectUnits
11
+ } from "./chunk-ZDH4JRVX.mjs";
12
+ import "./chunk-CYJ6GFVM.mjs";
13
+ import "./chunk-2EM7IEQT.mjs";
14
+ import {
11
15
  fileSink,
12
- parseConfig,
13
16
  prepareOut,
14
- projectRoots,
15
17
  readBuildFiles,
16
18
  readManifests,
17
19
  removeStaleUnitFiles,
18
- selectUnits,
19
20
  unitFilesOf
20
- } from "./chunk-QDXUP47M.mjs";
21
- import "./chunk-KFYMG4VB.mjs";
21
+ } from "./chunk-X3UPCLX5.mjs";
22
+ import "./chunk-GFG5I7WI.mjs";
23
+ import {
24
+ buildUnits,
25
+ parseConfig,
26
+ projectRoots
27
+ } from "./chunk-5NQOUB5I.mjs";
28
+ import "./chunk-GZ3E45TE.mjs";
22
29
  import {
23
30
  UNTRUSTED_DATA_LIMITS
24
- } from "./chunk-IERF2DNL.mjs";
31
+ } from "./chunk-VJ6AESSJ.mjs";
25
32
  import {
26
- FAILING_CODES,
27
33
  UsageError,
28
34
  dataProblemLines,
29
35
  flag,
30
36
  option,
31
- positional
32
- } from "./chunk-LNWQN7K7.mjs";
37
+ positional,
38
+ warningsToShow
39
+ } from "./chunk-ZRGJHNES.mjs";
33
40
  import "./chunk-YVSP26OS.mjs";
34
41
  import "./chunk-O3R3MASP.mjs";
35
- import "./chunk-JABACD5T.mjs";
42
+ import "./chunk-IAAKV7V2.mjs";
43
+ import "./chunk-5A2QPRCV.mjs";
36
44
  import "./chunk-G6OTOD3B.mjs";
37
45
  import {
38
46
  __require
39
47
  } from "./chunk-STRHO6SY.mjs";
40
48
 
41
49
  // src/node/build-command.ts
42
- import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
50
+ import { existsSync as existsSync2, readFileSync as readFileSync2, statSync } from "node:fs";
43
51
  import { join as join3, resolve as resolve2, sep } from "node:path";
44
52
 
45
53
  // src/node/highlight-pool.ts
@@ -304,21 +312,23 @@ async function runBuild(args, highlightWorker, mode = {}) {
304
312
  if (asWorker && flag(args, "--low-memory")) throw new UsageError("--as-worker uses the Worker's memory settings: drop --low-memory");
305
313
  const untrusted = flag(args, "--untrusted") || asWorker;
306
314
  const memory = asWorker ? { ...WORKER_BUILD_SETTINGS, templateMs: PUBLISHED_TEMPLATE_MS } : cliMemorySettings(flag(args, "--low-memory"));
307
- const project = resolve2(positional(args, "."));
308
- const cfgPath = ["dogsbay.config.yml", "dogsbay.config.yaml"].map((f) => join3(project, f)).find(existsSync2);
309
- const cfgText = cfgPath ? readFileSync2(cfgPath, "utf8") : void 0;
315
+ if (mode.prepared && (units.length || update || cacheOpt.length)) throw new UsageError("--unit, --update and --cache build a project folder");
316
+ const project = mode.prepared ? mode.prepared.root : resolve2(positional(args, "."));
317
+ if (!mode.prepared && !(existsSync2(project) && statSync(project).isDirectory())) throw new UsageError(`${project} is not a folder`);
318
+ const cfgPath = mode.prepared ? void 0 : ["dogsbay.config.yml", "dogsbay.config.yaml"].map((f) => join3(project, f)).find(existsSync2);
319
+ const cfgText = mode.prepared ? mode.prepared.config : cfgPath ? readFileSync2(cfgPath, "utf8") : void 0;
310
320
  const cfg = parseConfig(cfgText, {
311
321
  ...pretty ? { linkStyle: "pretty" } : {},
312
322
  ...noSearch ? { search: false } : {},
313
323
  // --search turns search on with that engine, whatever the config says (--no-search still wins).
314
324
  ...engine && !noSearch ? { search: true, searchEngine: engine } : {}
315
325
  });
316
- if (!cfgPath && !existsSync2(join3(project, "content"))) cfg.sources = [{ path: "." }];
326
+ if (!mode.prepared && !cfgPath && !existsSync2(join3(project, "content"))) cfg.sources = [{ path: "." }];
317
327
  const t0 = performance.now();
318
328
  const out = resolve2(outOpt ?? join3(project, "out"));
319
329
  const cacheDir = cacheOpt[0] ? resolve2(cacheOpt[0]) : void 0;
320
330
  if (cacheDir) checkCacheDir(cacheDir, out, project, cfg, untrusted);
321
- const { files } = await readBuildFiles(project, cfg, cacheDir ? [out, cacheDir] : [out], untrusted);
331
+ const { files } = mode.prepared ? { files: mode.prepared.files } : await readBuildFiles(project, cfg, cacheDir ? [out, cacheDir] : [out], untrusted);
322
332
  const tRead = performance.now() - t0;
323
333
  if (process.env.DOGSBAY_MEM) {
324
334
  globalThis.gc?.();
@@ -330,10 +340,10 @@ async function runBuild(args, highlightWorker, mode = {}) {
330
340
  }
331
341
  let previous;
332
342
  if (update) {
333
- if (!existsSync2(join3(out, "_dogsbay"))) throw new Error(`${out} is not a dogsbay-ssg build to update; build the whole site there first`);
334
- previous = readManifests(out);
335
- if (!previous.length) throw new Error(`${out} has no unit manifests (_dogsbay/units/): a site of two or more units writes them when it is built whole; build it there first (a site of one unit needs no --update)`);
336
- } else prepareOut(out, force);
343
+ if (!existsSync2(join3(out, cfg.assetsFolder))) throw new Error(`${out} is not a dogsbay-ssg build to update; build the whole site there first`);
344
+ previous = readManifests(out, cfg.assetsFolder);
345
+ if (!previous.length) throw new Error(`${out} has no unit manifests (${cfg.assetsFolder}/units/): a site of two or more units writes them when it is built whole; build it there first (a site of one unit needs no --update)`);
346
+ } else prepareOut(out, force, cfg.assetsFolder);
337
347
  const previousFiles = previous && new Map(previous.map((m) => [m.path, unitFilesOf(m.text)]));
338
348
  const written = /* @__PURE__ */ new Set();
339
349
  const sink = fileSink(out);
@@ -375,11 +385,11 @@ async function runBuild(args, highlightWorker, mode = {}) {
375
385
  await pool?.close();
376
386
  if (pool && threadsDead) console.warn(`warn ${threadsDead} of ${pool.threads} highlight threads failed; their blocks were highlighted on the main thread`);
377
387
  const pfStats = await pf?.finish(out);
378
- const removed = previousFiles ? removeStaleUnitFiles(out, previousFiles, written) : 0;
388
+ const removed = previousFiles ? removeStaleUnitFiles(out, previousFiles, written, cfg.assetsFolder) : 0;
379
389
  const treesRemoved = trees && !units.length && !mode.assemble ? trees.removeUnused() : 0;
380
390
  const errors = dataProblemLines(result.problems);
381
- const warnings = result.warnings.filter((_, i) => !FAILING_CODES.has(result.problems[i].code));
382
- const shown = quiet ? 0 : allWarnings ? warnings.length : 50;
391
+ const { warnings, siteWide } = warningsToShow(result.warnings, result.problems.map((p) => p.code));
392
+ const shown = quiet ? 0 : allWarnings ? warnings.length : Math.max(50, siteWide);
383
393
  for (const w of warnings.slice(0, shown)) console.warn(`warn ${w}`);
384
394
  if (warnings.length > shown && !quiet) console.warn(`\u2026 ${warnings.length - shown} more warnings (--all-warnings to list them)`);
385
395
  for (const e of errors) console.error(`error ${e}`);
@@ -401,8 +411,9 @@ async function runBuild(args, highlightWorker, mode = {}) {
401
411
  template parse cache: ${s.parseCache.hits} hits, ${s.parseCache.misses} misses, ${s.parseCache.entries} includes, ${(s.parseCache.bytes / 1e6).toFixed(1)} of ${(s.parseCache.maxBytes / 1e6).toFixed(1)} MB` : "")
402
412
  );
403
413
  if (errors.length) {
404
- const examples = result.problems.filter((p) => p.code === "example").length;
405
- console.error(`build failed: ${[errors.length - examples ? `${errors.length - examples} data problem(s)` : "", examples ? `${examples} example problem(s)` : ""].filter(Boolean).join(", ")}`);
414
+ const count = (code) => result.problems.filter((p) => p.code === code).length;
415
+ const kinds = [["data", count("data")], ["example", count("example")], ["reader-choice", count("choice")]];
416
+ console.error(`build failed: ${kinds.filter(([, n]) => n).map(([k, n]) => `${n} ${k} problem(s)`).join(", ")}`);
406
417
  process.exitCode = 1;
407
418
  }
408
419
  }