clean-jsdoc-theme 5.0.0-alpha.2 → 5.0.0-alpha.4

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
@@ -1,6 +1,11 @@
1
1
  <div align="center">
2
2
 
3
- <a href="https://ankdev.me/clean-jsdoc-theme"><img src="https://raw.githubusercontent.com/ankitskvmdam/clean-jsdoc-theme/master/packages/clean-jsdoc-theme/media/clean-jsdoc-theme.svg" alt="clean-jsdoc-theme" width="340" /></a>
3
+ <a href="https://ankdev.me/clean-jsdoc-theme">
4
+ <picture>
5
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ankitskvmdam/clean-jsdoc-theme/master/packages/clean-jsdoc-theme/media/clean-jsdoc-theme-dark.svg" />
6
+ <img src="https://raw.githubusercontent.com/ankitskvmdam/clean-jsdoc-theme/master/packages/clean-jsdoc-theme/media/clean-jsdoc-theme-light.svg" alt="clean-jsdoc-theme" width="340" />
7
+ </picture>
8
+ </a>
4
9
 
5
10
  A fast, modern, LLM-friendly documentation theme for **JSDoc** and **TypeDoc**.
6
11
 
@@ -13,6 +18,7 @@ A fast, modern, LLM-friendly documentation theme for **JSDoc** and **TypeDoc**.
13
18
  [![forks](https://img.shields.io/github/forks/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme/fork)
14
19
  [![issues](https://img.shields.io/github/issues/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme/issues)
15
20
  [![contributors](https://img.shields.io/github/contributors/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme/graphs/contributors)
21
+ [![sponsor](https://img.shields.io/badge/sponsor-%E2%9D%A4-db61a2?logo=githubsponsors&logoColor=white)](https://github.com/sponsors/ankitskvmdam)
16
22
 
17
23
  </div>
18
24
 
@@ -36,8 +42,13 @@ of every page for LLMs. No CSS or build config required to get started.
36
42
  [Pagefind](https://pagefind.app/) full-text index.
37
43
  - **Guides + API in one site** — hand-written Markdown guides and the
38
44
  auto-generated reference share one sidebar and one search.
45
+ - **Localization built in** — declare your locales and the `clean-jsdoc` CLI
46
+ builds one static site per language (translated UI, API descriptions, and
47
+ prose) with a header language switcher, per-language fonts, and `hreflang`.
39
48
  - **LLM-friendly** — every page ships a clean companion `.md`, plus a
40
- copy-page button to hand any page to Claude / ChatGPT / Perplexity.
49
+ copy-page button to hand any page to Claude / ChatGPT / Perplexity. A
50
+ downloadable [skill](https://ankdev.me/clean-jsdoc-theme/theme/llm-skill) turns
51
+ any coding assistant into a setup expert.
41
52
  - **Polished by default** — light/dark OKLCH themes, Google Fonts, shiki syntax
42
53
  highlighting, a Monaco source viewer, and `Source: file:line` links.
43
54
 
@@ -71,6 +82,7 @@ npx serve dist
71
82
  ## Documentation
72
83
 
73
84
  - **Guides & full reference** — [**ankdev.me/clean-jsdoc-theme**](https://ankdev.me/clean-jsdoc-theme): installation, TypeDoc usage, configuration, and theming.
85
+ - **FAQ & recipes** — [**ankdev.me/clean-jsdoc-theme/guides/faq**](https://ankdev.me/clean-jsdoc-theme/guides/faq): how to embed CodePen / YouTube / sites, write rich doc comments (callouts, steps), and common config tweaks.
74
86
  - **Live demo** — [**ankdev.me/clean-jsdoc-theme/api-docs**](https://ankdev.me/clean-jsdoc-theme/api-docs): a real generated API reference, so you can see the output before installing.
75
87
 
76
88
  > **v5 is in alpha.** To stay on v4, pin `"clean-jsdoc-theme": "^4"` in your
@@ -1,4 +1,4 @@
1
- import { ThemeColors, CopyPageConfig, PageNavConfig, SiteLogo, OutputFile } from '@clean-jsdoc-theme/dwar';
1
+ import { OutputFile, ThemeColors, CopyPageConfig, PageNavConfig, SiteLogo } from '@clean-jsdoc-theme/dwar';
2
2
  import { DocInput, MenuItem } from '@clean-jsdoc-theme/setu';
3
3
 
4
4
  interface JSDocOpts {
@@ -276,6 +276,22 @@ declare function resolveDocImages(docs: DocInput[], docsDir: string): Promise<{
276
276
  files: OutputFile[];
277
277
  inlineSvgs: Record<string, string>;
278
278
  }>;
279
+ /** The output of {@link resolveDocImages}: resolved docs + their image assets. */
280
+ interface ResolvedDocs {
281
+ docs: DocInput[];
282
+ files: OutputFile[];
283
+ inlineSvgs: Record<string, string>;
284
+ }
285
+ /**
286
+ * Overlay a locale's resolved docs over the default set (the per-locale docs
287
+ * track). A locale page WINS over the default page with the same `path`; a
288
+ * default page absent from the locale falls back (stays). Image asset files are
289
+ * deduped by served path (same content-hashed name → one copy), and inline SVGs
290
+ * merge locale-over-default. Output docs are re-sorted by `path` so the manifest
291
+ * stays stable regardless of merge order. Pure — the I/O already happened in the
292
+ * two {@link resolveDocImages} calls that produced `base`/`locale`.
293
+ */
294
+ declare function overlayDocs(base: ResolvedDocs, locale: ResolvedDocs): ResolvedDocs;
279
295
  /**
280
296
  * Validate `opts.docGroups` into a clean `string[]`, or `undefined` to fall back
281
297
  * to setu's default doc-group order. Mirrors {@link normalizeSectionOrder}:
@@ -284,4 +300,4 @@ declare function resolveDocImages(docs: DocInput[], docsDir: string): Promise<{
284
300
  declare function normalizeDocGroups(raw: unknown): string[] | undefined;
285
301
  declare function publish(data: unknown, opts: JSDocOpts, tutorials?: unknown): Promise<void>;
286
302
 
287
- export { collectDocs, computeRelPaths, hasMarkdownPlugin, normalizeColors, normalizeCopyPage, normalizeDocGroups, normalizeMenu, normalizePageNav, normalizeSectionOrder, outputSourceFilesEnabled, publish, resolveDocImages, sourceLinkToCommentEnabled };
303
+ export { type ResolvedDocs, collectDocs, computeRelPaths, hasMarkdownPlugin, normalizeColors, normalizeCopyPage, normalizeDocGroups, normalizeMenu, normalizePageNav, normalizeSectionOrder, outputSourceFilesEnabled, overlayDocs, publish, resolveDocImages, sourceLinkToCommentEnabled };
package/dist/publish.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ThemeColors, CopyPageConfig, PageNavConfig, SiteLogo, OutputFile } from '@clean-jsdoc-theme/dwar';
1
+ import { OutputFile, ThemeColors, CopyPageConfig, PageNavConfig, SiteLogo } from '@clean-jsdoc-theme/dwar';
2
2
  import { DocInput, MenuItem } from '@clean-jsdoc-theme/setu';
3
3
 
4
4
  interface JSDocOpts {
@@ -276,6 +276,22 @@ declare function resolveDocImages(docs: DocInput[], docsDir: string): Promise<{
276
276
  files: OutputFile[];
277
277
  inlineSvgs: Record<string, string>;
278
278
  }>;
279
+ /** The output of {@link resolveDocImages}: resolved docs + their image assets. */
280
+ interface ResolvedDocs {
281
+ docs: DocInput[];
282
+ files: OutputFile[];
283
+ inlineSvgs: Record<string, string>;
284
+ }
285
+ /**
286
+ * Overlay a locale's resolved docs over the default set (the per-locale docs
287
+ * track). A locale page WINS over the default page with the same `path`; a
288
+ * default page absent from the locale falls back (stays). Image asset files are
289
+ * deduped by served path (same content-hashed name → one copy), and inline SVGs
290
+ * merge locale-over-default. Output docs are re-sorted by `path` so the manifest
291
+ * stays stable regardless of merge order. Pure — the I/O already happened in the
292
+ * two {@link resolveDocImages} calls that produced `base`/`locale`.
293
+ */
294
+ declare function overlayDocs(base: ResolvedDocs, locale: ResolvedDocs): ResolvedDocs;
279
295
  /**
280
296
  * Validate `opts.docGroups` into a clean `string[]`, or `undefined` to fall back
281
297
  * to setu's default doc-group order. Mirrors {@link normalizeSectionOrder}:
@@ -284,4 +300,4 @@ declare function resolveDocImages(docs: DocInput[], docsDir: string): Promise<{
284
300
  declare function normalizeDocGroups(raw: unknown): string[] | undefined;
285
301
  declare function publish(data: unknown, opts: JSDocOpts, tutorials?: unknown): Promise<void>;
286
302
 
287
- export { collectDocs, computeRelPaths, hasMarkdownPlugin, normalizeColors, normalizeCopyPage, normalizeDocGroups, normalizeMenu, normalizePageNav, normalizeSectionOrder, outputSourceFilesEnabled, publish, resolveDocImages, sourceLinkToCommentEnabled };
303
+ export { type ResolvedDocs, collectDocs, computeRelPaths, hasMarkdownPlugin, normalizeColors, normalizeCopyPage, normalizeDocGroups, normalizeMenu, normalizePageNav, normalizeSectionOrder, outputSourceFilesEnabled, overlayDocs, publish, resolveDocImages, sourceLinkToCommentEnabled };
package/dist/publish.js CHANGED
@@ -40,6 +40,7 @@ __export(publish_exports, {
40
40
  normalizePageNav: () => normalizePageNav,
41
41
  normalizeSectionOrder: () => normalizeSectionOrder,
42
42
  outputSourceFilesEnabled: () => outputSourceFilesEnabled,
43
+ overlayDocs: () => overlayDocs,
43
44
  publish: () => publish,
44
45
  resolveDocImages: () => resolveDocImages,
45
46
  sourceLinkToCommentEnabled: () => sourceLinkToCommentEnabled
@@ -137,7 +138,7 @@ async function loadDep(name, requiredExports) {
137
138
  }
138
139
  return mod;
139
140
  }
140
- var loadSetu = () => loadDep("@clean-jsdoc-theme/setu", ["generateSite"]);
141
+ var loadSetu = () => loadDep("@clean-jsdoc-theme/setu", ["generateSite", "stampSite"]);
141
142
  var loadDwar = () => loadDep("@clean-jsdoc-theme/dwar", ["render", "runPagefindAgainstDir"]);
142
143
  var loadUtils = () => loadDep("@clean-jsdoc-theme/utils", [
143
144
  "validateThemeOpts",
@@ -145,7 +146,8 @@ var loadUtils = () => loadDep("@clean-jsdoc-theme/utils", [
145
146
  "formatDiagnostics",
146
147
  "formatBuildReport",
147
148
  "normalizeBasePath",
148
- "withBase"
149
+ "withBase",
150
+ "toExtractManifest"
149
151
  ]);
150
152
  var loadOra = async () => {
151
153
  try {
@@ -207,7 +209,16 @@ var defaultTheme = {
207
209
  },
208
210
  basePath: "/"
209
211
  };
210
- function resolveTheme(opts, siteName, fonts, basePath) {
212
+ function resolveFontSet(fonts, locale) {
213
+ const base = defaultTheme.tokens.fonts;
214
+ const override = locale && fonts.locales?.[locale] || {};
215
+ return {
216
+ heading: override.heading ?? fonts.heading ?? base.heading,
217
+ body: override.body ?? fonts.body ?? base.body,
218
+ mono: override.mono ?? fonts.mono ?? base.mono
219
+ };
220
+ }
221
+ function resolveTheme(opts, siteName, fonts, basePath, locale) {
211
222
  const aiPrompt = typeof opts.aiPrompt === "string" && opts.aiPrompt.trim() ? opts.aiPrompt.trim() : void 0;
212
223
  const copyPage = normalizeCopyPage(opts.copyPage);
213
224
  const pageNav = normalizePageNav(opts.pageNav);
@@ -223,11 +234,7 @@ function resolveTheme(opts, siteName, fonts, basePath) {
223
234
  ...defaultTheme.tokens,
224
235
  colors: { ...defaultTheme.tokens.colors, ...colors ?? {} },
225
236
  darkColors: { ...defaultTheme.tokens.darkColors, ...darkColors ?? {} },
226
- fonts: {
227
- heading: fonts.heading ?? defaultTheme.tokens.fonts.heading,
228
- body: fonts.body ?? defaultTheme.tokens.fonts.body,
229
- mono: fonts.mono ?? defaultTheme.tokens.fonts.mono
230
- },
237
+ fonts: resolveFontSet(fonts, locale),
231
238
  ...siteName ? { siteName } : {}
232
239
  }
233
240
  };
@@ -385,9 +392,7 @@ function sourceLinkToCommentEnabled(opts) {
385
392
  }
386
393
  function hasMarkdownPlugin(plugins) {
387
394
  if (!Array.isArray(plugins)) return false;
388
- return plugins.some(
389
- (p) => typeof p === "string" && /(^|[\\/])markdown(\.js)?$/i.test(p.trim())
390
- );
395
+ return plugins.some((p) => typeof p === "string" && /(^|[\\/])markdown(\.js)?$/i.test(p.trim()));
391
396
  }
392
397
  function assertMarkdownPlugin() {
393
398
  let conf;
@@ -636,6 +641,17 @@ async function resolveDocImages(docs, docsDir) {
636
641
  }
637
642
  return { docs: out, files, inlineSvgs };
638
643
  }
644
+ function overlayDocs(base, locale) {
645
+ const byPath = new Map(base.docs.map((d) => [d.path, d]));
646
+ for (const d of locale.docs) byPath.set(d.path, d);
647
+ const filesByPath = /* @__PURE__ */ new Map();
648
+ for (const f of [...base.files, ...locale.files]) filesByPath.set(f.path, f);
649
+ return {
650
+ docs: [...byPath.values()].sort((a, b) => a.path.localeCompare(b.path)),
651
+ files: [...filesByPath.values()],
652
+ inlineSvgs: { ...base.inlineSvgs, ...locale.inlineSvgs }
653
+ };
654
+ }
639
655
  function normalizeDocGroups(raw) {
640
656
  return normalizeSectionOrder(raw);
641
657
  }
@@ -644,22 +660,64 @@ function formatElapsed(ms) {
644
660
  }
645
661
  function createBuildProgress(ora) {
646
662
  async function stage(label, fn) {
647
- if (!ora) return await fn();
663
+ const noop = { setText: () => {
664
+ } };
665
+ if (!ora) return await fn(noop);
648
666
  const spinner = ora(label).start();
649
667
  const begin = Date.now();
668
+ let current = label;
669
+ const refresh = () => {
670
+ const secs = Math.floor((Date.now() - begin) / 1e3);
671
+ spinner.text = secs > 0 ? `${current} (${secs}s)` : current;
672
+ };
673
+ const heartbeat = setInterval(refresh, 1e3);
674
+ if (typeof heartbeat.unref === "function") heartbeat.unref();
675
+ const handle = {
676
+ setText(text) {
677
+ current = text;
678
+ refresh();
679
+ }
680
+ };
650
681
  try {
651
- const result = await fn();
682
+ const result = await fn(handle);
683
+ clearInterval(heartbeat);
652
684
  spinner.succeed(`${label} (${formatElapsed(Date.now() - begin)})`);
653
685
  return result;
654
686
  } catch (err) {
687
+ clearInterval(heartbeat);
655
688
  spinner.fail(label);
656
689
  throw err;
657
690
  }
658
691
  }
659
692
  return { stage };
660
693
  }
694
+ function readBuildSpec() {
695
+ const path = process.env.CLEAN_JSDOC_THEME_BUILD?.trim();
696
+ if (!path) return null;
697
+ const spec = JSON.parse((0, import_node_fs.readFileSync)(path, "utf8"));
698
+ if (typeof spec.version === "number" && spec.version !== 1) {
699
+ throw new Error(
700
+ `clean-jsdoc-theme: build spec version ${spec.version} unsupported (expected 1) \u2014 update clean-jsdoc-theme and aadesh together.`
701
+ );
702
+ }
703
+ if (typeof spec.destination !== "string" || typeof spec.basePath !== "string") {
704
+ throw new Error(`clean-jsdoc-theme: malformed build spec at "${path}".`);
705
+ }
706
+ return {
707
+ locale: typeof spec.locale === "string" ? spec.locale : "",
708
+ defaultLocale: typeof spec.defaultLocale === "string" ? spec.defaultLocale : "en",
709
+ apiMessages: spec.apiMessages ?? {},
710
+ chromeMessages: spec.chromeMessages ?? {},
711
+ destination: spec.destination,
712
+ basePath: spec.basePath,
713
+ siteBasePath: typeof spec.siteBasePath === "string" ? spec.siteBasePath : "/",
714
+ locales: Array.isArray(spec.locales) ? spec.locales : [],
715
+ ...typeof spec.docsDir === "string" && spec.docsDir ? { docsDir: spec.docsDir } : {}
716
+ };
717
+ }
661
718
  async function publish(data, opts, tutorials) {
662
- const destination = opts.destination;
719
+ const buildSpec = readBuildSpec();
720
+ const destination = buildSpec?.destination ?? opts.destination;
663
721
  if (!destination || typeof destination !== "string") {
664
722
  throw new Error(
665
723
  'clean-jsdoc-theme publish: opts.destination is required (set "opts.destination" in your jsdoc.json).'
@@ -674,7 +732,7 @@ async function publish(data, opts, tutorials) {
674
732
  const ora = opts.progress === false ? null : await loadOra();
675
733
  const progress = createBuildProgress(ora);
676
734
  const [
677
- { generateSite },
735
+ { generateSite, stampSite },
678
736
  { render, runPagefindAgainstDir },
679
737
  {
680
738
  validateThemeOpts,
@@ -682,13 +740,23 @@ async function publish(data, opts, tutorials) {
682
740
  formatDiagnostics,
683
741
  formatBuildReport,
684
742
  normalizeBasePath,
685
- withBase
743
+ withBase,
744
+ toExtractManifest
686
745
  }
687
- ] = await progress.stage(
688
- "Loading renderer",
689
- () => Promise.all([loadSetu(), loadDwar(), loadUtils()])
690
- );
691
- const basePath = normalizeBasePath(opts.basePath);
746
+ // Loaded sequentially (not Promise.all) so the spinner can step its label
747
+ // through each module — the evaluation of these large ESM bundles is the
748
+ // single longest, most event-loop-blocking stage, so visibly naming the
749
+ // module in flight is what stops it from reading as a hang.
750
+ ] = await progress.stage("Loading renderer", async ({ setText }) => {
751
+ setText("Loading renderer (setu)");
752
+ const setu = await loadSetu();
753
+ setText("Loading renderer (dwar)");
754
+ const dwar = await loadDwar();
755
+ setText("Loading renderer (utils)");
756
+ const utils = await loadUtils();
757
+ return [setu, dwar, utils];
758
+ });
759
+ const basePath = normalizeBasePath(buildSpec?.basePath ?? opts.basePath);
692
760
  const hrefForServed = (servedPath) => withBase(basePath, "/" + servedPath);
693
761
  const fontResolver = createGoogleFontResolver();
694
762
  const { value, diagnostics } = await progress.stage(
@@ -719,12 +787,23 @@ async function publish(data, opts, tutorials) {
719
787
  "Reading sources & docs",
720
788
  async () => {
721
789
  const [srcs, rawDocs] = await Promise.all([sourcesPromise, docsPromise]);
722
- const resolved = docsDir ? await resolveDocImages(rawDocs, docsDir) : { docs: rawDocs, files: [], inlineSvgs: {} };
790
+ const base = docsDir ? await resolveDocImages(rawDocs, docsDir) : { docs: rawDocs, files: [], inlineSvgs: {} };
791
+ if (!buildSpec?.docsDir) {
792
+ return {
793
+ sources: srcs,
794
+ docs: base.docs,
795
+ docImageFiles: base.files,
796
+ inlineSvgs: base.inlineSvgs
797
+ };
798
+ }
799
+ const localeRaw = await collectDocs(buildSpec.docsDir);
800
+ const locale = await resolveDocImages(localeRaw, buildSpec.docsDir);
801
+ const merged = overlayDocs(base, locale);
723
802
  return {
724
803
  sources: srcs,
725
- docs: resolved.docs,
726
- docImageFiles: resolved.files,
727
- inlineSvgs: resolved.inlineSvgs
804
+ docs: merged.docs,
805
+ docImageFiles: merged.files,
806
+ inlineSvgs: merged.inlineSvgs
728
807
  };
729
808
  }
730
809
  );
@@ -733,7 +812,7 @@ async function publish(data, opts, tutorials) {
733
812
  const sectionOrder = normalizeSectionOrder(opts.sectionOrder);
734
813
  const menu = normalizeMenu(opts.menu);
735
814
  const clubSidebarItems = opts.clubSidebarItems === true;
736
- const manifest = await progress.stage("Generating pages", () => generateSite(data, {
815
+ const siteOptions = {
737
816
  ...pkg ? { pkg } : {},
738
817
  ...readme ? { readme } : {},
739
818
  ...tutorialTree.length > 0 ? { tutorials: tutorialTree } : {},
@@ -745,7 +824,23 @@ async function publish(data, opts, tutorials) {
745
824
  ...sectionOrder ? { sectionOrder } : {},
746
825
  ...menu ? { menu } : {},
747
826
  ...clubSidebarItems ? { clubSidebarItems } : {}
748
- }));
827
+ };
828
+ const manifest = await progress.stage(
829
+ "Generating pages",
830
+ () => buildSpec ? stampSite(data, buildSpec.apiMessages, siteOptions) : generateSite(data, siteOptions)
831
+ );
832
+ const extractPath = process.env.CLEAN_JSDOC_THEME_EXTRACT?.trim();
833
+ if (extractPath) {
834
+ const target = (0, import_node_path2.resolve)(extractPath);
835
+ await progress.stage("Writing extract manifest", async () => {
836
+ await (0, import_promises2.mkdir)((0, import_node_path2.dirname)(target), { recursive: true });
837
+ await (0, import_promises2.writeFile)(target, JSON.stringify(toExtractManifest(manifest), null, 2) + "\n", "utf8");
838
+ });
839
+ console.log(
840
+ `clean-jsdoc-theme: extract mode \u2014 wrote ${manifest.slots?.length ?? 0} slot(s) to ${target}`
841
+ );
842
+ return;
843
+ }
749
844
  const { siteName, files: logoFiles } = await prepareSiteName(value.siteName, hrefForServed);
750
845
  const notGoogle = new Set(
751
846
  diagnostics.list.filter((d) => d.code === "fonts/not-google" && d.path).map((d) => d.path)
@@ -753,23 +848,44 @@ async function publish(data, opts, tutorials) {
753
848
  const fonts = { ...value.fonts };
754
849
  if (notGoogle.has("fonts.heading")) delete fonts.heading;
755
850
  if (notGoogle.has("fonts.body")) delete fonts.body;
851
+ if (fonts.locales) {
852
+ const cleaned = {};
853
+ for (const [loc, set] of Object.entries(fonts.locales)) {
854
+ const s = { ...set };
855
+ if (notGoogle.has(`fonts.${loc}:heading`)) delete s.heading;
856
+ if (notGoogle.has(`fonts.${loc}:body`)) delete s.body;
857
+ cleaned[loc] = s;
858
+ }
859
+ fonts.locales = cleaned;
860
+ }
756
861
  const customAssets = await resolveCustomAssets(opts, hrefForServed);
757
862
  const absoluteDestination = (0, import_node_path2.resolve)(destination);
758
863
  const islandCacheDir = (0, import_node_path2.resolve)(process.cwd(), "node_modules", ".cache", "clean-jsdoc-theme");
759
864
  const result = await progress.stage(
760
865
  "Rendering site",
761
866
  () => render(manifest, {
762
- theme: { ...resolveTheme(opts, siteName, fonts, basePath), ...customAssets.theme },
867
+ theme: {
868
+ ...resolveTheme(opts, siteName, fonts, basePath, buildSpec?.locale),
869
+ ...customAssets.theme
870
+ },
763
871
  destination: absoluteDestination,
764
872
  islandCacheDir,
765
- inlineSvgs
873
+ inlineSvgs,
874
+ // Build mode: render chrome in the locale (SSR provider + island seeding)
875
+ // and, with >1 locale, mount the language switcher.
876
+ ...buildSpec ? {
877
+ locale: {
878
+ code: buildSpec.locale,
879
+ defaultLocale: buildSpec.defaultLocale,
880
+ messages: buildSpec.chromeMessages,
881
+ siteBasePath: buildSpec.siteBasePath,
882
+ locales: buildSpec.locales.map((l) => ({ code: l.code, label: l.name ?? l.code }))
883
+ }
884
+ } : {}
766
885
  })
767
886
  );
768
887
  const outputFiles = [...result.files, ...logoFiles, ...customAssets.files, ...docImageFiles];
769
- await progress.stage(
770
- "Writing files",
771
- () => writeOutputFiles(absoluteDestination, outputFiles)
772
- );
888
+ await progress.stage("Writing files", () => writeOutputFiles(absoluteDestination, outputFiles));
773
889
  const zlib = await import("zlib");
774
890
  const gzipSizer = (b) => zlib.gzipSync(b).length;
775
891
  console.log(
@@ -795,9 +911,7 @@ async function publish(data, opts, tutorials) {
795
911
  () => runPagefindAgainstDir(absoluteDestination)
796
912
  );
797
913
  } catch (err) {
798
- console.warn(
799
- `clean-jsdoc-theme: pagefind step skipped (optional) \u2014 ${err.message}`
800
- );
914
+ console.warn(`clean-jsdoc-theme: pagefind step skipped (optional) \u2014 ${err.message}`);
801
915
  }
802
916
  }
803
917
  // Annotate the CommonJS export names for ESM import in node:
@@ -812,6 +926,7 @@ async function publish(data, opts, tutorials) {
812
926
  normalizePageNav,
813
927
  normalizeSectionOrder,
814
928
  outputSourceFilesEnabled,
929
+ overlayDocs,
815
930
  publish,
816
931
  resolveDocImages,
817
932
  sourceLinkToCommentEnabled