clean-jsdoc-theme 5.3.0 → 5.4.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.mjs CHANGED
@@ -124,12 +124,14 @@ const loadUtils = () => loadDep("@clean-jsdoc-theme/utils", [
124
124
  "DiagnosticBag",
125
125
  "formatBuildReport",
126
126
  "formatRenderError",
127
+ "renderFailureMessage",
127
128
  "normalizeBasePath",
128
129
  "withBase",
129
130
  "toExtractManifest",
130
131
  "normalizeCollapsibleSidebarSections",
131
132
  "unmatchedCollapsibleSections",
132
133
  "topLevelSectionLabels",
134
+ "unknownSectionOrderLabels",
133
135
  "normalizeScrollbar"
134
136
  ]);
135
137
  /**
@@ -1526,7 +1528,7 @@ async function runPublish(data, opts, tutorials, report) {
1526
1528
  const sourcesPromise = outputSourceFilesEnabled(opts) ? collectSourceFiles(data) : Promise.resolve([]);
1527
1529
  const docsPromise = docsDir ? collectDocs(docsDir) : Promise.resolve([]);
1528
1530
  const progress = createBuildProgress(opts.progress === false ? null : await loadOra());
1529
- const [{ generateSite, stampSite }, { render }, { validateThemeOpts, createGoogleFontResolver, formatDiagnostics, DiagnosticBag, formatBuildReport, formatRenderError, normalizeBasePath, withBase, toExtractManifest, normalizeCollapsibleSidebarSections, unmatchedCollapsibleSections, topLevelSectionLabels, normalizeScrollbar }] = await progress.stage("Loading renderer", async ({ setText }) => {
1531
+ const [{ generateSite, stampSite, DEFAULT_SECTION_ORDER, DOCS_SECTION }, { render }, { validateThemeOpts, createGoogleFontResolver, formatDiagnostics, DiagnosticBag, formatBuildReport, formatRenderError, renderFailureMessage, normalizeBasePath, withBase, toExtractManifest, normalizeCollapsibleSidebarSections, unmatchedCollapsibleSections, topLevelSectionLabels, unknownSectionOrderLabels, normalizeScrollbar }] = await progress.stage("Loading renderer", async ({ setText }) => {
1530
1532
  setText("Loading renderer (setu)");
1531
1533
  const setu = await loadSetu();
1532
1534
  setText("Loading renderer (dwar)");
@@ -1540,7 +1542,7 @@ async function runPublish(data, opts, tutorials, report) {
1540
1542
  });
1541
1543
  const basePath = normalizeBasePath(buildSpec?.basePath ?? opts.basePath);
1542
1544
  const hrefForServed = (servedPath) => withBase(basePath, "/" + servedPath);
1543
- const strict = opts.strict === true || opts.templates?.default?.strict === true;
1545
+ const strict = opts.strict === true;
1544
1546
  const strictOptionErrors = [];
1545
1547
  const warnOption = (message) => {
1546
1548
  if (!strict) return console.warn(message);
@@ -1648,6 +1650,15 @@ async function runPublish(data, opts, tutorials, report) {
1648
1650
  const unmatched = unmatchedCollapsibleSections(collapsibleSidebarSections, present);
1649
1651
  if (unmatched.length > 0) warnOption(`clean-jsdoc-theme: collapsibleSidebarSections — no sidebar section matches ${unmatched.map((l) => `'${l}'`).join(", ")}. Available sections: ${present.join(", ")}.`);
1650
1652
  }
1653
+ if (sectionOrder) {
1654
+ const known = [.../* @__PURE__ */ new Set([
1655
+ ...topLevelSectionLabels(manifest.nav),
1656
+ ...DEFAULT_SECTION_ORDER,
1657
+ DOCS_SECTION
1658
+ ])];
1659
+ const unknown = unknownSectionOrderLabels(sectionOrder, known, ["Global"]);
1660
+ if (unknown.length > 0) warnOption(`clean-jsdoc-theme: sectionOrder — no sidebar section matches ` + unknown.map((u) => `'${u.label}'` + (u.hint ? ` (${u.hint})` : u.suggestion ? ` (did you mean '${u.suggestion}'?)` : "")).join(", ") + `. Known sections: ${known.join(", ")}.`);
1661
+ }
1651
1662
  failOnStrictOptionErrors();
1652
1663
  const extractPath = process.env.CLEAN_JSDOC_THEME_EXTRACT?.trim();
1653
1664
  if (extractPath) {
@@ -1707,6 +1718,8 @@ async function runPublish(data, opts, tutorials, report) {
1707
1718
  }))
1708
1719
  } } : {}
1709
1720
  }));
1721
+ const renderFailure = renderFailureMessage(result);
1722
+ if (renderFailure) throw new Error(`clean-jsdoc-theme: ${renderFailure}`);
1710
1723
  const generatedFiles = [
1711
1724
  ...result.files,
1712
1725
  ...logoFiles,