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.js CHANGED
@@ -118,12 +118,14 @@ const loadUtils = () => loadDep("@clean-jsdoc-theme/utils", [
118
118
  "DiagnosticBag",
119
119
  "formatBuildReport",
120
120
  "formatRenderError",
121
+ "renderFailureMessage",
121
122
  "normalizeBasePath",
122
123
  "withBase",
123
124
  "toExtractManifest",
124
125
  "normalizeCollapsibleSidebarSections",
125
126
  "unmatchedCollapsibleSections",
126
127
  "topLevelSectionLabels",
128
+ "unknownSectionOrderLabels",
127
129
  "normalizeScrollbar"
128
130
  ]);
129
131
  /**
@@ -1520,7 +1522,7 @@ async function runPublish(data, opts, tutorials, report) {
1520
1522
  const sourcesPromise = outputSourceFilesEnabled(opts) ? collectSourceFiles(data) : Promise.resolve([]);
1521
1523
  const docsPromise = docsDir ? collectDocs(docsDir) : Promise.resolve([]);
1522
1524
  const progress = createBuildProgress(opts.progress === false ? null : await loadOra());
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 }) => {
1525
+ 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 }) => {
1524
1526
  setText("Loading renderer (setu)");
1525
1527
  const setu = await loadSetu();
1526
1528
  setText("Loading renderer (dwar)");
@@ -1534,7 +1536,7 @@ async function runPublish(data, opts, tutorials, report) {
1534
1536
  });
1535
1537
  const basePath = normalizeBasePath(buildSpec?.basePath ?? opts.basePath);
1536
1538
  const hrefForServed = (servedPath) => withBase(basePath, "/" + servedPath);
1537
- const strict = opts.strict === true || opts.templates?.default?.strict === true;
1539
+ const strict = opts.strict === true;
1538
1540
  const strictOptionErrors = [];
1539
1541
  const warnOption = (message) => {
1540
1542
  if (!strict) return console.warn(message);
@@ -1642,6 +1644,15 @@ async function runPublish(data, opts, tutorials, report) {
1642
1644
  const unmatched = unmatchedCollapsibleSections(collapsibleSidebarSections, present);
1643
1645
  if (unmatched.length > 0) warnOption(`clean-jsdoc-theme: collapsibleSidebarSections — no sidebar section matches ${unmatched.map((l) => `'${l}'`).join(", ")}. Available sections: ${present.join(", ")}.`);
1644
1646
  }
1647
+ if (sectionOrder) {
1648
+ const known = [.../* @__PURE__ */ new Set([
1649
+ ...topLevelSectionLabels(manifest.nav),
1650
+ ...DEFAULT_SECTION_ORDER,
1651
+ DOCS_SECTION
1652
+ ])];
1653
+ const unknown = unknownSectionOrderLabels(sectionOrder, known, ["Global"]);
1654
+ 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(", ")}.`);
1655
+ }
1645
1656
  failOnStrictOptionErrors();
1646
1657
  const extractPath = process.env.CLEAN_JSDOC_THEME_EXTRACT?.trim();
1647
1658
  if (extractPath) {
@@ -1701,6 +1712,8 @@ async function runPublish(data, opts, tutorials, report) {
1701
1712
  }))
1702
1713
  } } : {}
1703
1714
  }));
1715
+ const renderFailure = renderFailureMessage(result);
1716
+ if (renderFailure) throw new Error(`clean-jsdoc-theme: ${renderFailure}`);
1704
1717
  const generatedFiles = [
1705
1718
  ...result.files,
1706
1719
  ...logoFiles,