clean-jsdoc-theme 5.2.1 → 5.3.0

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/publish.js CHANGED
@@ -5,6 +5,7 @@ let node_fs = require("node:fs");
5
5
  let node_crypto = require("node:crypto");
6
6
  let node_path = require("node:path");
7
7
  let node_url = require("node:url");
8
+ let node_https = require("node:https");
8
9
  //#region src/write-output-files.ts
9
10
  async function writeOutputFiles(destination, files) {
10
11
  for (const file of files) {
@@ -15,6 +16,43 @@ async function writeOutputFiles(destination, files) {
15
16
  }
16
17
  }
17
18
  //#endregion
19
+ //#region src/https-fetch.ts
20
+ /**
21
+ * A `node:https` implementation of utils' `FetchLike`, injected into
22
+ * `createGoogleFontResolver` instead of the global (undici) `fetch`.
23
+ *
24
+ * Why: on Windows, `process.exit` shortly after an undici `fetch()` aborts Node
25
+ * with a libuv assertion (`!(handle->flags & UV_HANDLE_CLOSING)`, exit 127).
26
+ * A strict build that fails validation right after the Google Fonts check
27
+ * exits exactly then, so the failure surfaced as a native crash instead of
28
+ * exit 1. A plain `node:https` request has no such handle and exits cleanly.
29
+ *
30
+ * Only the status code is read; the response body is discarded and the
31
+ * socket destroyed (`res.destroy()`), so nothing lingers after the check.
32
+ * Abort (the resolver's timeout) and network errors reject, which the
33
+ * resolver maps to `'unknown'` (fail-open, an info note) exactly as before.
34
+ * Redirects are not followed: a 3xx resolves the check to `'unknown'`.
35
+ *
36
+ * The request goes through Node's default agent (`https.globalAgent`), so it
37
+ * honours the env proxy (`NODE_USE_ENV_PROXY=1` / `--use-env-proxy` with
38
+ * `HTTPS_PROXY`/`NO_PROXY`, Node >= 24) just like the global `fetch`. Don't
39
+ * pass `agent: false`: that builds a fresh Agent without the proxy settings.
40
+ *
41
+ * utils stays browser-safe because the `node:` import lives here, in the
42
+ * Node-only bridge. The TypeDoc bridge carries a copy
43
+ * (`packages/typedoc/src/https-fetch.ts`); keep the two in sync.
44
+ */
45
+ const httpsFetch = (url, init) => new Promise((resolve, reject) => {
46
+ (0, node_https.get)(url, {
47
+ ...init?.headers ? { headers: init.headers } : {},
48
+ ...init?.signal ? { signal: init.signal } : {}
49
+ }, (res) => {
50
+ const status = res.statusCode ?? 0;
51
+ res.destroy();
52
+ resolve({ status });
53
+ }).on("error", reject);
54
+ });
55
+ //#endregion
18
56
  //#region src/publish.ts
19
57
  const JSDOC_TUTORIAL_TYPE_MARKDOWN = 2;
20
58
  function anchorPath() {
@@ -77,7 +115,7 @@ const loadUtils = () => loadDep("@clean-jsdoc-theme/utils", [
77
115
  "validateThemeOpts",
78
116
  "createGoogleFontResolver",
79
117
  "formatDiagnostics",
80
- "warningsOnly",
118
+ "DiagnosticBag",
81
119
  "formatBuildReport",
82
120
  "formatRenderError",
83
121
  "normalizeBasePath",
@@ -211,6 +249,7 @@ function resolveTheme(opts, siteName, fonts, basePath, locale) {
211
249
  }
212
250
  };
213
251
  }
252
+ const consoleWarn = (message) => console.warn(message);
214
253
  /** Trim a value to a non-empty string, or `undefined`. */
215
254
  function nonEmptyString(value) {
216
255
  return typeof value === "string" && value.trim().length > 0 ? value : void 0;
@@ -231,19 +270,37 @@ function contentHash(bytes) {
231
270
  * else the bare `<base><ext>`. A file that can't be read is skipped with a
232
271
  * warning (resilient, like `prepareSiteName`); an identical served name is
233
272
  * emitted once.
273
+ *
274
+ * Only local file paths are copied. An entry that isn't a string (v4's
275
+ * `add_style_path`/`add_script_path` took `{ href, integrity, crossorigin }`
276
+ * CDN objects) or is a remote URL is skipped with a warning naming the
277
+ * alternative (`remoteAlternative`), instead of vanishing silently.
234
278
  */
235
- async function copyCustomFiles(raw, ext, hash, label, hrefForServed) {
236
- const paths = (Array.isArray(raw) ? raw : [raw]).filter((p) => typeof p === "string" && p.trim().length > 0);
279
+ async function copyCustomFiles(raw, ext, hash, label, remoteAlternative, hrefForServed, warn = consoleWarn) {
280
+ const entries = raw === void 0 || raw === null ? [] : Array.isArray(raw) ? raw : [raw];
281
+ const paths = [];
282
+ for (const entry of entries) {
283
+ if (typeof entry !== "string") {
284
+ warn(`clean-jsdoc-theme: ${label} takes local file paths; skipping ${JSON.stringify(entry)}. For a remote file, download it or ${remoteAlternative}.`);
285
+ continue;
286
+ }
287
+ const trimmed = entry.trim();
288
+ if (trimmed.length === 0) continue;
289
+ if (/^([a-z][a-z0-9+.-]*:)?\/\//i.test(trimmed)) {
290
+ warn(`clean-jsdoc-theme: ${label} only copies local files; skipping '${trimmed}'. Download it, or ${remoteAlternative}.`);
291
+ continue;
292
+ }
293
+ paths.push(trimmed);
294
+ }
237
295
  const links = [];
238
296
  const files = [];
239
297
  const seen = /* @__PURE__ */ new Set();
240
- for (const p of paths) {
241
- const trimmed = p.trim();
298
+ for (const trimmed of paths) {
242
299
  let bytes;
243
300
  try {
244
301
  bytes = await (0, node_fs_promises.readFile)((0, node_path.resolve)(trimmed));
245
302
  } catch {
246
- console.warn(`clean-jsdoc-theme: could not read ${label} ('${trimmed}'); skipping it.`);
303
+ warn(`clean-jsdoc-theme: could not read ${label} ('${trimmed}'); skipping it.`);
247
304
  continue;
248
305
  }
249
306
  const base = (0, node_path.basename)(trimmed, (0, node_path.extname)(trimmed)) || "custom";
@@ -269,9 +326,9 @@ async function copyCustomFiles(raw, ext, hash, label, hrefForServed) {
269
326
  * `render()` stays pure and just links the resulting hrefs. `hashCustomAssets`
270
327
  * (default `true`) toggles the content-hash suffix.
271
328
  */
272
- async function resolveCustomAssets(opts, hrefForServed) {
329
+ async function resolveCustomAssets(opts, hrefForServed, warn = consoleWarn) {
273
330
  const hash = opts.hashCustomAssets !== false;
274
- const [cssAssets, jsAssets] = await Promise.all([copyCustomFiles(opts.customCssFile, ".css", hash, "customCssFile", hrefForServed), copyCustomFiles(opts.customJsFile, ".js", hash, "customJsFile", hrefForServed)]);
331
+ const [cssAssets, jsAssets] = await Promise.all([copyCustomFiles(opts.customCssFile, ".css", hash, "customCssFile", "`@import url(…)` it from `customCss`", hrefForServed, warn), copyCustomFiles(opts.customJsFile, ".js", hash, "customJsFile", "load it from `customJs` (e.g. append a `<script src>`)", hrefForServed, warn)]);
275
332
  const customCss = nonEmptyString(opts.customCss)?.trim();
276
333
  const customJs = nonEmptyString(opts.customJs)?.trim();
277
334
  return {
@@ -292,7 +349,7 @@ async function resolveCustomAssets(opts, hrefForServed) {
292
349
  * like the logo/custom-asset paths), and an empty value yields `undefined` so
293
350
  * the default footer renders. Exported for testing.
294
351
  */
295
- async function resolveFooter(raw) {
352
+ async function resolveFooter(raw, warn = consoleWarn) {
296
353
  if (typeof raw === "string") {
297
354
  const trimmed = raw.trim();
298
355
  return trimmed.length > 0 ? trimmed : void 0;
@@ -304,7 +361,7 @@ async function resolveFooter(raw) {
304
361
  const html = await (0, node_fs_promises.readFile)((0, node_path.resolve)(file), "utf8");
305
362
  return html.trim().length > 0 ? html : void 0;
306
363
  } catch {
307
- console.warn(`clean-jsdoc-theme: could not read footer file ('${file}'); omitting the custom footer.`);
364
+ warn(`clean-jsdoc-theme: could not read footer file ('${file}'); omitting the custom footer.`);
308
365
  return;
309
366
  }
310
367
  }
@@ -317,14 +374,14 @@ async function resolveFooter(raw) {
317
374
  * `<link>` `type`. A missing/unreadable file is warned about and dropped
318
375
  * (resilient, like the logo/custom-asset paths). Exported for testing.
319
376
  */
320
- async function resolveFavicon(raw, hash, hrefForServed) {
377
+ async function resolveFavicon(raw, hash, hrefForServed, warn = consoleWarn) {
321
378
  if (typeof raw !== "string" || raw.trim().length === 0) return void 0;
322
379
  const trimmed = raw.trim();
323
380
  let bytes;
324
381
  try {
325
382
  bytes = await (0, node_fs_promises.readFile)((0, node_path.resolve)(trimmed));
326
383
  } catch {
327
- console.warn(`clean-jsdoc-theme: could not read favicon ('${trimmed}'); omitting it.`);
384
+ warn(`clean-jsdoc-theme: could not read favicon ('${trimmed}'); omitting it.`);
328
385
  return;
329
386
  }
330
387
  const ext = (0, node_path.extname)(trimmed) || ".ico";
@@ -354,7 +411,7 @@ const META_IDENTITY_ATTRS = [
354
411
  * identifying attribute (`name`/`property`/`http-equiv`/`charset`/`itemprop`) is
355
412
  * dropped with a warning — dwar does the final escaping + key validation.
356
413
  */
357
- function normalizeMeta(raw) {
414
+ function normalizeMeta(raw, warn = consoleWarn) {
358
415
  if (!Array.isArray(raw)) return void 0;
359
416
  const out = [];
360
417
  for (const entry of raw) {
@@ -366,7 +423,7 @@ function normalizeMeta(raw) {
366
423
  if (t.length > 0) tag[k] = t;
367
424
  } else if (typeof v === "number" && Number.isFinite(v)) tag[k] = String(v);
368
425
  if (!META_IDENTITY_ATTRS.some((a) => typeof tag[a] === "string") || Object.keys(tag).length === 0) {
369
- console.warn(`clean-jsdoc-theme: skipping a meta entry with no usable name/property/http-equiv/charset attribute (${JSON.stringify(entry)}).`);
426
+ warn(`clean-jsdoc-theme: skipping a meta entry with no usable name/property/http-equiv/charset attribute (${JSON.stringify(entry)}).`);
370
427
  continue;
371
428
  }
372
429
  out.push(tag);
@@ -386,7 +443,7 @@ function isServableUrl(value) {
386
443
  * through untouched, and the `alt` label is preserved. A path that can't be
387
444
  * read is left verbatim with a warning rather than aborting the build.
388
445
  */
389
- async function prepareSiteName(raw, hrefForServed) {
446
+ async function prepareSiteName(raw, hrefForServed, warn = consoleWarn) {
390
447
  if (typeof raw === "string") {
391
448
  const trimmed = raw.trim();
392
449
  return {
@@ -423,7 +480,7 @@ async function prepareSiteName(raw, hrefForServed) {
423
480
  });
424
481
  out[key] = hrefForServed(served);
425
482
  } catch {
426
- console.warn(`clean-jsdoc-theme: could not read logo image for siteName.${key} ('${v}'); using it verbatim.`);
483
+ warn(`clean-jsdoc-theme: could not read logo image for siteName.${key} ('${v}'); using it verbatim.`);
427
484
  out[key] = v;
428
485
  }
429
486
  }
@@ -508,6 +565,25 @@ function sourceLinkToCommentEnabled(opts) {
508
565
  return false;
509
566
  }
510
567
  /**
568
+ * Whether private doclets should be documented — the private-access slice of
569
+ * JSDoc's `templateHelper.prune`, with its exact tests: `env.opts.private` is
570
+ * truthy (`--private`), or `env.opts.access` `.includes('private')` or
571
+ * `.includes('all')`. Like prune, `includes` runs on whatever `access` is: an
572
+ * array from the CLI (the flag is repeatable) or a string from `jsdoc.json`, so
573
+ * `"private,protected"` and `"all"` count via substring match, exactly as in
574
+ * JSDoc. Default: hidden.
575
+ *
576
+ * Only this slice is implemented. prune's other `--access` levels (`public`,
577
+ * `protected`, `package`, `undefined` — e.g. `--access public` hiding
578
+ * protected symbols) are NOT applied: those symbols stay documented.
579
+ */
580
+ function includePrivateEnabled(opts) {
581
+ if (opts?.private) return true;
582
+ const access = opts?.access;
583
+ if (typeof access !== "string" && !Array.isArray(access)) return false;
584
+ return access.includes("private") || access.includes("all");
585
+ }
586
+ /**
511
587
  * Resolve `templates.default.cleanOutputDir`. Probed in the same priority order
512
588
  * as {@link outputSourceFilesEnabled} (canonical `jsdoc/env` conf, then a nested
513
589
  * `opts.templates` fallback). Defaults to `true` — the build empties its
@@ -850,10 +926,12 @@ async function collectDocs(dir) {
850
926
  const relPath = relPrefix ? `${relPrefix}/${stem}` : stem;
851
927
  try {
852
928
  const content = await (0, node_fs_promises.readFile)(abs, "utf8");
929
+ const source = (0, node_path.relative)(process.cwd(), abs).split(node_path.sep).join("/");
853
930
  docs.push({
854
931
  path: relPath,
855
932
  content,
856
- type
933
+ type,
934
+ source
857
935
  });
858
936
  } catch (err) {
859
937
  console.warn(`clean-jsdoc-theme: could not read doc file '${abs}' — ${err.message}; skipping.`);
@@ -982,11 +1060,11 @@ async function rewriteImageRefs(content, baseDir, collector) {
982
1060
  * content-hashed `_assets/` pipeline (see {@link createImageCollector}). Each
983
1061
  * `![alt](src)` / `<img src>` whose `src` points to a file on disk is copied and
984
1062
  * its `src` rewritten to the root-relative `/_assets/<base>.<hash><ext>` (rang's
985
- * `MdxImg` adds the base path, like it does for links), resolved relative to the
986
- * project root when it starts with `/`, else relative to the doc's own directory.
987
- * Returns the docs with rewritten content plus the asset files to write. The
988
- * bridge is the I/O layer here, so setu/dwar only ever see the final `_assets/`
989
- * paths.
1063
+ * `MdxImg` adds the base path, like it does for links, and dwar adds it to the
1064
+ * `.md`/llms outputs), resolved relative to the project root when it starts with
1065
+ * `/`, else relative to the doc's own directory. Returns the docs with rewritten
1066
+ * content plus the asset files to write. The bridge is the I/O layer here, so
1067
+ * setu/dwar only ever see the final `_assets/` paths.
990
1068
  */
991
1069
  async function resolveDocImages(docs, docsDir, collector = createImageCollector()) {
992
1070
  if (docs.length === 0) return {
@@ -1378,7 +1456,58 @@ function readBuildSpec() {
1378
1456
  ...typeof spec.docsDir === "string" && spec.docsDir ? { docsDir: spec.docsDir } : {}
1379
1457
  };
1380
1458
  }
1459
+ /**
1460
+ * The template entry JSDoc calls. Wraps {@link runPublish} so a failed build
1461
+ * fails the process: JSDoc 4 runs `publish()` inside a promise chain with no
1462
+ * rejection handler, so a thrown error was printed as `Unhandled rejection
1463
+ * <stack>` and JSDoc still exited 0 — invisible to CI, and to aadesh, which
1464
+ * checks each locale build's exit code. Every failure (strict-mode option
1465
+ * errors, a missing `plugins/markdown`, a bad build spec, a render setup
1466
+ * error) goes through {@link reportBuildFailure} instead.
1467
+ */
1381
1468
  async function publish(data, opts, tutorials) {
1469
+ const report = { optionProblems: () => {} };
1470
+ try {
1471
+ await runPublish(data, opts, tutorials, report);
1472
+ } catch (err) {
1473
+ report.optionProblems();
1474
+ reportBuildFailure(err, opts.debug === true || opts.verbose === true);
1475
+ }
1476
+ }
1477
+ /** JSDoc's logger — resolvable only inside a JSDoc process (see `jsdoc/env` above). */
1478
+ function loadJSDocLogger() {
1479
+ return require("jsdoc/util/logger");
1480
+ }
1481
+ /**
1482
+ * Report a failed build once and make the process exit non-zero. Inside JSDoc,
1483
+ * log through JSDoc's own logger: `logger.error` prints the message once and,
1484
+ * through JSDoc's `logger:error` listener, marks the run as failed. Normally
1485
+ * that sets a flag JSDoc turns into exit code 1 once `publish` settles; under
1486
+ * `--pedantic` the listener calls `cli.exit(1)`, which registers a process
1487
+ * `exit` handler that exits with 1 — it doesn't stop the process on the spot,
1488
+ * so the remaining work still finishes. `process.exitCode` is set too, as a
1489
+ * backstop.
1490
+ * Outside a JSDoc process (`jsdoc/util/logger` isn't resolvable — a direct
1491
+ * programmatic call, unit tests) rethrow, so the caller still gets the
1492
+ * rejection, and leave `process.exitCode` alone: the caller decides whether
1493
+ * the failure fails its process. `withStack` (JSDoc's `--debug`/`--verbose`)
1494
+ * adds the stack trace for bug reports. Exported for testing (`loadLogger` is
1495
+ * injectable).
1496
+ */
1497
+ function reportBuildFailure(err, withStack, loadLogger = loadJSDocLogger) {
1498
+ let logger;
1499
+ try {
1500
+ logger = loadLogger();
1501
+ } catch {
1502
+ logger = void 0;
1503
+ }
1504
+ if (!logger || typeof logger.error !== "function") throw err;
1505
+ process.exitCode = 1;
1506
+ const message = err instanceof Error ? err.message : String(err);
1507
+ const stack = withStack && err instanceof Error && err.stack ? `\n${err.stack}` : "";
1508
+ logger.error(`${message}${stack}`);
1509
+ }
1510
+ async function runPublish(data, opts, tutorials, report) {
1382
1511
  const buildSpec = readBuildSpec();
1383
1512
  const destination = buildSpec?.destination ?? opts.destination;
1384
1513
  if (!destination || typeof destination !== "string") throw new Error("clean-jsdoc-theme publish: opts.destination is required (set \"opts.destination\" in your jsdoc.json).");
@@ -1391,7 +1520,7 @@ async function publish(data, opts, tutorials) {
1391
1520
  const sourcesPromise = outputSourceFilesEnabled(opts) ? collectSourceFiles(data) : Promise.resolve([]);
1392
1521
  const docsPromise = docsDir ? collectDocs(docsDir) : Promise.resolve([]);
1393
1522
  const progress = createBuildProgress(opts.progress === false ? null : await loadOra());
1394
- const [{ generateSite, stampSite }, { render }, { validateThemeOpts, createGoogleFontResolver, formatDiagnostics, warningsOnly, formatBuildReport, formatRenderError, normalizeBasePath, withBase, toExtractManifest, normalizeCollapsibleSidebarSections, unmatchedCollapsibleSections, topLevelSectionLabels, normalizeScrollbar }] = await progress.stage("Loading renderer", async ({ setText }) => {
1523
+ const [{ generateSite, stampSite }, { render }, { validateThemeOpts, createGoogleFontResolver, formatDiagnostics, DiagnosticBag, formatBuildReport, formatRenderError, normalizeBasePath, withBase, toExtractManifest, normalizeCollapsibleSidebarSections, unmatchedCollapsibleSections, topLevelSectionLabels, normalizeScrollbar }] = await progress.stage("Loading renderer", async ({ setText }) => {
1395
1524
  setText("Loading renderer (setu)");
1396
1525
  const setu = await loadSetu();
1397
1526
  setText("Loading renderer (dwar)");
@@ -1405,22 +1534,44 @@ async function publish(data, opts, tutorials) {
1405
1534
  });
1406
1535
  const basePath = normalizeBasePath(buildSpec?.basePath ?? opts.basePath);
1407
1536
  const hrefForServed = (servedPath) => withBase(basePath, "/" + servedPath);
1408
- const fontResolver = createGoogleFontResolver();
1537
+ const strict = opts.strict === true || opts.templates?.default?.strict === true;
1538
+ const strictOptionErrors = [];
1539
+ const warnOption = (message) => {
1540
+ if (!strict) return console.warn(message);
1541
+ strictOptionErrors.push(message);
1542
+ console.error(message);
1543
+ };
1544
+ const failOnStrictOptionErrors = () => {
1545
+ if (strictOptionErrors.length === 0) return;
1546
+ throw new Error(`clean-jsdoc-theme: ${strictOptionErrors.length} option problem(s) in strict mode (see above). Fix them or unset \`strict\`.`);
1547
+ };
1548
+ const fontResolver = createGoogleFontResolver({ fetch: httpsFetch });
1409
1549
  const { value, diagnostics } = await progress.stage("Validating options", () => validateThemeOpts({
1410
1550
  opts,
1411
1551
  fontResolver,
1412
1552
  unknownKeyPolicy: "suggest-typos",
1413
- knownNonThemeKeys: JSDOC_OWN_OPTS
1553
+ knownNonThemeKeys: JSDOC_OWN_OPTS,
1554
+ checkV4Options: true,
1555
+ strict
1414
1556
  }));
1415
- const strict = opts.strict === true || opts.templates?.default?.strict === true;
1416
1557
  if (diagnostics.list.length > 0) {
1417
1558
  const formatted = formatDiagnostics(diagnostics, { color });
1418
1559
  if (strict && diagnostics.hasErrors()) {
1419
1560
  console.error(formatted);
1420
1561
  throw new Error("clean-jsdoc-theme: opts validation failed in strict mode (see the diagnostics above). Fix the errors or unset `strict`.");
1421
1562
  }
1422
- console.log(formatted);
1563
+ const notes = new DiagnosticBag();
1564
+ for (const d of diagnostics.list) if (d.level === "info") notes.add(d);
1565
+ if (notes.list.length > 0) console.log(formatDiagnostics(notes, { color }));
1423
1566
  }
1567
+ let reported = false;
1568
+ report.optionProblems = () => {
1569
+ if (reported) return;
1570
+ reported = true;
1571
+ const problems = new DiagnosticBag();
1572
+ for (const d of diagnostics.list) if (d.level !== "info") problems.add(d);
1573
+ if (problems.list.length > 0) console.warn(formatDiagnostics(problems, { color }));
1574
+ };
1424
1575
  const pkg = await pkgPromise;
1425
1576
  const readme = typeof opts.readme === "string" && opts.readme.length > 0 ? opts.readme : void 0;
1426
1577
  const tutorialTree = normalizeTutorials(tutorials);
@@ -1465,9 +1616,9 @@ async function publish(data, opts, tutorials) {
1465
1616
  const menu = normalizeMenu(opts.menu);
1466
1617
  const clubSidebarItems = opts.clubSidebarItems === true;
1467
1618
  const { value: collapsibleSidebarSections, warnings: collapsibleWarnings } = normalizeCollapsibleSidebarSections(opts.collapsibleSidebarSections);
1468
- collapsibleWarnings.forEach((w) => console.warn(`clean-jsdoc-theme: ${w}`));
1619
+ collapsibleWarnings.forEach((w) => warnOption(`clean-jsdoc-theme: ${w}`));
1469
1620
  const { value: scrollbar, warnings: scrollbarWarnings } = normalizeScrollbar(opts.scrollbar);
1470
- scrollbarWarnings.forEach((w) => console.warn(`clean-jsdoc-theme: ${w}`));
1621
+ scrollbarWarnings.forEach((w) => warnOption(`clean-jsdoc-theme: ${w}`));
1471
1622
  const playground = normalizePlayground(opts.playground);
1472
1623
  const siteOptions = {
1473
1624
  ...pkg ? { pkg } : {},
@@ -1482,14 +1633,16 @@ async function publish(data, opts, tutorials) {
1482
1633
  ...menu ? { menu } : {},
1483
1634
  ...clubSidebarItems ? { clubSidebarItems } : {},
1484
1635
  ...collapsibleSidebarSections !== void 0 ? { collapsibleSidebarSections } : {},
1485
- ...playground ? { playground: playground.site } : {}
1636
+ ...playground ? { playground: playground.site } : {},
1637
+ ...includePrivateEnabled(opts) ? { includePrivate: true } : {}
1486
1638
  };
1487
1639
  const manifest = await progress.stage("Generating pages", () => buildSpec ? stampSite(data, buildSpec.apiMessages, siteOptions) : generateSite(data, siteOptions));
1488
1640
  if (Array.isArray(collapsibleSidebarSections)) {
1489
1641
  const present = topLevelSectionLabels(manifest.nav);
1490
1642
  const unmatched = unmatchedCollapsibleSections(collapsibleSidebarSections, present);
1491
- if (unmatched.length > 0) console.warn(`clean-jsdoc-theme: collapsibleSidebarSections — no sidebar section matches ${unmatched.map((l) => `'${l}'`).join(", ")}. Available sections: ${present.join(", ")}.`);
1643
+ if (unmatched.length > 0) warnOption(`clean-jsdoc-theme: collapsibleSidebarSections — no sidebar section matches ${unmatched.map((l) => `'${l}'`).join(", ")}. Available sections: ${present.join(", ")}.`);
1492
1644
  }
1645
+ failOnStrictOptionErrors();
1493
1646
  const extractPath = process.env.CLEAN_JSDOC_THEME_EXTRACT?.trim();
1494
1647
  if (extractPath) {
1495
1648
  const target = (0, node_path.resolve)(extractPath);
@@ -1498,9 +1651,10 @@ async function publish(data, opts, tutorials) {
1498
1651
  await (0, node_fs_promises.writeFile)(target, JSON.stringify(toExtractManifest(manifest), null, 2) + "\n", "utf8");
1499
1652
  });
1500
1653
  console.log(`clean-jsdoc-theme: extract mode — wrote ${manifest.slots?.length ?? 0} slot(s) to ${target}`);
1654
+ report.optionProblems();
1501
1655
  return;
1502
1656
  }
1503
- const { siteName, files: logoFiles } = await prepareSiteName(value.siteName, hrefForServed);
1657
+ const { siteName, files: logoFiles } = await prepareSiteName(value.siteName, hrefForServed, warnOption);
1504
1658
  const notGoogle = new Set(diagnostics.list.filter((d) => d.code === "fonts/not-google" && d.path).map((d) => d.path));
1505
1659
  const fonts = { ...value.fonts };
1506
1660
  if (notGoogle.has("fonts.heading")) delete fonts.heading;
@@ -1515,10 +1669,11 @@ async function publish(data, opts, tutorials) {
1515
1669
  }
1516
1670
  fonts.locales = cleaned;
1517
1671
  }
1518
- const customAssets = await resolveCustomAssets(opts, hrefForServed);
1519
- const footer = await resolveFooter(opts.footer);
1520
- const favicon = await resolveFavicon(opts.favicon, opts.hashCustomAssets !== false, hrefForServed);
1521
- const meta = normalizeMeta(opts.meta);
1672
+ const customAssets = await resolveCustomAssets(opts, hrefForServed, warnOption);
1673
+ const footer = await resolveFooter(opts.footer, warnOption);
1674
+ const favicon = await resolveFavicon(opts.favicon, opts.hashCustomAssets !== false, hrefForServed, warnOption);
1675
+ const meta = normalizeMeta(opts.meta, warnOption);
1676
+ failOnStrictOptionErrors();
1522
1677
  const absoluteDestination = (0, node_path.resolve)(destination);
1523
1678
  const islandCacheDir = (0, node_path.resolve)(process.cwd(), "node_modules", ".cache", "clean-jsdoc-theme");
1524
1679
  const result = await progress.stage("Rendering site", () => render(manifest, {
@@ -1589,8 +1744,7 @@ async function publish(data, opts, tutorials) {
1589
1744
  gzipSizer,
1590
1745
  color
1591
1746
  }));
1592
- const optsWarnings = warningsOnly(diagnostics);
1593
- if (optsWarnings.list.length > 0) console.warn(formatDiagnostics(optsWarnings, { color }));
1747
+ report.optionProblems();
1594
1748
  if (result.errors && result.errors.length > 0) {
1595
1749
  console.warn(`clean-jsdoc-theme: ${result.errors.length} page(s) failed to render and were skipped:`);
1596
1750
  for (const e of result.errors) console.warn(formatRenderError(e));
@@ -1607,6 +1761,7 @@ exports.collectStaticFiles = collectStaticFiles;
1607
1761
  exports.computeRelPaths = computeRelPaths;
1608
1762
  exports.createImageCollector = createImageCollector;
1609
1763
  exports.hasMarkdownPlugin = hasMarkdownPlugin;
1764
+ exports.includePrivateEnabled = includePrivateEnabled;
1610
1765
  exports.normalizeColors = normalizeColors;
1611
1766
  exports.normalizeCopyPage = normalizeCopyPage;
1612
1767
  exports.normalizeDocGroups = normalizeDocGroups;
@@ -1620,6 +1775,8 @@ exports.outputSourceFilesEnabled = outputSourceFilesEnabled;
1620
1775
  exports.overlayDocs = overlayDocs;
1621
1776
  exports.publish = publish;
1622
1777
  exports.readStaticFilesConfig = readStaticFilesConfig;
1778
+ exports.reportBuildFailure = reportBuildFailure;
1779
+ exports.resolveCustomAssets = resolveCustomAssets;
1623
1780
  exports.resolveDocImages = resolveDocImages;
1624
1781
  exports.resolveDocletImages = resolveDocletImages;
1625
1782
  exports.resolveFavicon = resolveFavicon;