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

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 (86) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +82 -625
  3. package/dist/publish.d.mts +287 -0
  4. package/dist/publish.d.ts +287 -0
  5. package/dist/publish.js +819 -0
  6. package/dist/publish.js.map +1 -0
  7. package/dist/publish.mjs +779 -0
  8. package/dist/publish.mjs.map +1 -0
  9. package/package.json +66 -55
  10. package/.eslintignore +0 -5
  11. package/.eslintrc.js +0 -3
  12. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -43
  13. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -27
  14. package/.github/dependabot.yml +0 -9
  15. package/.github/pull_request_template.md +0 -16
  16. package/.github/workflows/codeql.yml +0 -72
  17. package/.github/workflows/greetings.yml +0 -16
  18. package/.prettierignore +0 -2
  19. package/.prettierrc +0 -5
  20. package/.stylelintignore +0 -4
  21. package/.stylelintrc +0 -18
  22. package/.travis.yml +0 -30
  23. package/CHANGELOG.md +0 -260
  24. package/CODE_OF_CONDUCT.md +0 -76
  25. package/CODE_OF_CONDUCT_HINDI.md +0 -61
  26. package/CONTRIBUTING.md +0 -36
  27. package/SECURITY.md +0 -21
  28. package/clean-jsdoc-theme-defaults.js +0 -37
  29. package/clean-jsdoc-theme-helper.js +0 -186
  30. package/css-property-order-fix.js +0 -56
  31. package/helpers/Environment.html +0 -3
  32. package/helpers/down-arrow.js +0 -9
  33. package/jsdoc-config.json +0 -102
  34. package/minify.js +0 -72
  35. package/publish.js +0 -1110
  36. package/static/fonts/Inconsolata-Regular.ttf +0 -0
  37. package/static/fonts/OpenSans-Regular.ttf +0 -0
  38. package/static/fonts/WorkSans-Bold.ttf +0 -0
  39. package/static/scripts/core.js +0 -726
  40. package/static/scripts/core.min.js +0 -23
  41. package/static/scripts/resize.js +0 -90
  42. package/static/scripts/search.js +0 -265
  43. package/static/scripts/search.min.js +0 -6
  44. package/static/scripts/third-party/Apache-License-2.0.txt +0 -202
  45. package/static/scripts/third-party/fuse.js +0 -9
  46. package/static/scripts/third-party/hljs-line-num-original.js +0 -369
  47. package/static/scripts/third-party/hljs-line-num.js +0 -1
  48. package/static/scripts/third-party/hljs-original.js +0 -5171
  49. package/static/scripts/third-party/hljs.js +0 -1
  50. package/static/scripts/third-party/popper.js +0 -5
  51. package/static/scripts/third-party/tippy.js +0 -1
  52. package/static/scripts/third-party/tocbot.js +0 -672
  53. package/static/scripts/third-party/tocbot.min.js +0 -1
  54. package/static/styles/clean-jsdoc-theme-base.css +0 -1159
  55. package/static/styles/clean-jsdoc-theme-dark.css +0 -412
  56. package/static/styles/clean-jsdoc-theme-light.css +0 -482
  57. package/static/styles/clean-jsdoc-theme-scrollbar.css +0 -30
  58. package/static/styles/clean-jsdoc-theme-without-scrollbar.min.css +0 -1
  59. package/static/styles/clean-jsdoc-theme.min.css +0 -1
  60. package/tmpl/augments.tmpl +0 -10
  61. package/tmpl/container.tmpl +0 -208
  62. package/tmpl/details.tmpl +0 -207
  63. package/tmpl/example.tmpl +0 -3
  64. package/tmpl/examples.tmpl +0 -48
  65. package/tmpl/exceptions.tmpl +0 -32
  66. package/tmpl/icons.tmpl +0 -73
  67. package/tmpl/include-target-script-and-styles.tmpl +0 -43
  68. package/tmpl/layout.tmpl +0 -167
  69. package/tmpl/mainpage.tmpl +0 -10
  70. package/tmpl/members.tmpl +0 -42
  71. package/tmpl/method.tmpl +0 -175
  72. package/tmpl/mobile-sidebar.tmpl +0 -21
  73. package/tmpl/navbar-actions.tmpl +0 -19
  74. package/tmpl/navbar-menu.tmpl +0 -25
  75. package/tmpl/navbar.tmpl +0 -14
  76. package/tmpl/params.tmpl +0 -131
  77. package/tmpl/properties.tmpl +0 -109
  78. package/tmpl/returns.tmpl +0 -19
  79. package/tmpl/search.tmpl +0 -17
  80. package/tmpl/sidebar-items.tmpl +0 -24
  81. package/tmpl/sidebar-title.tmpl +0 -8
  82. package/tmpl/sidebar.tmpl +0 -9
  83. package/tmpl/source.tmpl +0 -13
  84. package/tmpl/toc.tmpl +0 -4
  85. package/tmpl/tutorial.tmpl +0 -32
  86. package/tmpl/type.tmpl +0 -13
@@ -0,0 +1,287 @@
1
+ import { ThemeColors, CopyPageConfig, PageNavConfig, SiteLogo, OutputFile } from '@clean-jsdoc-theme/dwar';
2
+ import { DocInput, MenuItem } from '@clean-jsdoc-theme/setu';
3
+
4
+ interface JSDocOpts {
5
+ destination?: string;
6
+ package?: string;
7
+ /**
8
+ * Site identity from `jsdoc.json` (`"opts": { "siteName": ... }`). Either a
9
+ * string (shown in the header/footer and appended to each page's `<title>`),
10
+ * or a logo image set `{ default, dark, light, alt }`. Local image paths are
11
+ * copied into the output; `http(s)://` and `data:` values pass through. The
12
+ * `alt` text (or `pkg.name`) is used for the `<title>` suffix and image alt.
13
+ */
14
+ siteName?: string | SiteLogo;
15
+ /**
16
+ * Font overrides from `jsdoc.json` (`"opts": { "fonts": { ... } }`). Values
17
+ * are Google Fonts family names for `heading`/`body`; `mono` is a CSS stack.
18
+ */
19
+ fonts?: {
20
+ heading?: string;
21
+ body?: string;
22
+ mono?: string;
23
+ };
24
+ /**
25
+ * Light-mode color overrides from `jsdoc.json` (`"opts": { "colors": { ... } }`).
26
+ * Any subset of `bg`, `bgMuted`, `fg`, `fgMuted`, `accent`, `accentFg`, `border`;
27
+ * each value is any CSS color string (the theme ships oklch). Omitted keys keep
28
+ * the default palette.
29
+ */
30
+ colors?: unknown;
31
+ /**
32
+ * Dark-mode color overrides (`"opts": { "darkColors": { ... } }`). Same keys as
33
+ * {@link JSDocOpts.colors}; emitted under `[data-theme="dark"]`. Omitted keys
34
+ * keep the default dark palette.
35
+ */
36
+ darkColors?: unknown;
37
+ /**
38
+ * Project README as HTML. JSDoc renders the Markdown README (`-R`/`opts.readme`
39
+ * or one found in the source paths) and replaces this with the resulting HTML
40
+ * before calling `publish`. Rendered as the site home page.
41
+ */
42
+ readme?: string;
43
+ /** Path to the tutorials directory (`-u`/`opts.tutorials`); resolved tree arrives as the 3rd `publish` arg. */
44
+ tutorials?: string;
45
+ /**
46
+ * Path to a docs content directory (`jsdoc.json` `"opts": { "docs": "docs/" }`),
47
+ * resolved relative to the cwd. The bridge walks it recursively; each
48
+ * `*.md`/`*.markdown` (and `*.html`) file becomes a prose page at its clean,
49
+ * unprefixed slug (the relative path), grouped by frontmatter/directory. A root
50
+ * `index.md` becomes the home page. Unset → no docs site (today's behavior).
51
+ */
52
+ docs?: unknown;
53
+ /**
54
+ * Top-level doc-group display order (`jsdoc.json` `"opts": { "docGroups": [...] }`).
55
+ * An ordered list of doc-group labels controlling how the doc-group sidebar
56
+ * sections render (after the API sections). Omit for the default order.
57
+ */
58
+ docGroups?: unknown;
59
+ /**
60
+ * Group label assigned to a doc page that carries no frontmatter/directory
61
+ * group (`jsdoc.json` `"opts": { "defaultDocGroup": "Docs" }`). Omit to leave
62
+ * such pages ungrouped.
63
+ */
64
+ defaultDocGroup?: unknown;
65
+ /**
66
+ * Sidebar section order from `jsdoc.json` (`"opts": { "sectionOrder": [...] }`).
67
+ * An ordered list of section labels (e.g. `["Classes", "Tutorials"]`) that both
68
+ * filters and orders the sidebar sections; "Home" and "Source Files" are always
69
+ * shown regardless. Omit (or leave empty) for the default order.
70
+ */
71
+ sectionOrder?: unknown;
72
+ /**
73
+ * Full sidebar menu from `jsdoc.json` (`"opts": { "menu": [...] }`). An ordered
74
+ * list of `{ id, title, href, icon }` entries. When present it takes precedence
75
+ * over `sectionOrder` and controls the entire sidebar (built-ins, sections, and
76
+ * external links). See setu's {@link MenuItem}.
77
+ */
78
+ menu?: unknown;
79
+ /**
80
+ * Club related sidebar entries into prefix-grouped subtrees (`jsdoc.json`
81
+ * `"opts": { "clubSidebarItems": true }`). Groups entries within each section
82
+ * by the path segment before the first `/` (e.g. `queue/*` under a `queue`
83
+ * parent); a prefix with a single entry is left flat. Off by default.
84
+ */
85
+ clubSidebarItems?: unknown;
86
+ /**
87
+ * Custom prompt for the copy-page button's "Open in ChatGPT/Claude/Perplexity"
88
+ * actions (`jsdoc.json` `"opts": { "aiPrompt": "…" }`). `{siteName}`, `{url}`,
89
+ * and `{mdUrl}` (the page's raw Markdown link) placeholders are substituted at
90
+ * click time. Only the prompt + links are sent (the AI fetches `{mdUrl}`), so
91
+ * the query stays short for long docs. Omit for a sensible default.
92
+ */
93
+ aiPrompt?: unknown;
94
+ /**
95
+ * Copy-page button config (`jsdoc.json` `"opts": { "copyPage": … }`). Either a
96
+ * boolean (`false` hides the button) or an object `{ enabled?, actions? }`,
97
+ * where `actions` is an ordered subset of
98
+ * `["copy","view","claude","chatgpt","perplexity"]` (`[]` shows just the
99
+ * primary copy button). Defaults to enabled with all actions.
100
+ */
101
+ copyPage?: unknown;
102
+ /**
103
+ * Previous/next page pager config (`jsdoc.json` `"opts": { "pageNav": … }`).
104
+ * Either a boolean (`false` hides the pager) or an object `{ enabled? }`. The
105
+ * pager links each content page to its neighbors in sidebar reading order.
106
+ * Defaults to enabled.
107
+ */
108
+ pageNav?: unknown;
109
+ /**
110
+ * Inline custom CSS (`jsdoc.json` `"opts": { "customCss": "…" }`), injected as
111
+ * a `<style>` after the theme stylesheet so it can override.
112
+ */
113
+ customCss?: unknown;
114
+ /**
115
+ * Path(s) to custom CSS file(s) (`"opts": { "customCssFile": "a.css" }` or an
116
+ * array). Each file is copied AS-IS (its own bytes) to
117
+ * `_assets/<name>.<hash>.css` and linked after the theme stylesheet. The
118
+ * `<hash>` is a content hash (see `hashCustomAssets`), so an unchanged file
119
+ * keeps a stable, cacheable URL.
120
+ */
121
+ customCssFile?: unknown;
122
+ /**
123
+ * Inline custom JS (`"opts": { "customJs": "…" }`), injected as a classic
124
+ * `<script>` before `</body>`, after the theme's own scripts.
125
+ */
126
+ customJs?: unknown;
127
+ /**
128
+ * Path(s) to custom JS file(s) (`"opts": { "customJsFile": "a.js" }` or an
129
+ * array). Each file is copied AS-IS to `_assets/<name>.<hash>.js` and
130
+ * referenced before `</body>`. See `hashCustomAssets`.
131
+ */
132
+ customJsFile?: unknown;
133
+ /**
134
+ * Whether to append a content hash to copied `customCssFile`/`customJsFile`
135
+ * asset names (`_assets/<name>.<hash>.css`). Defaults to `true` — the hash is
136
+ * derived from the file's content (NOT random), so an unchanged file yields
137
+ * the same URL across builds (cache-friendly) and a changed file cache-busts.
138
+ * Set `false` to copy with the original `<name>.css`/`.js` (no hash).
139
+ */
140
+ hashCustomAssets?: unknown;
141
+ /**
142
+ * Build-stage progress output (`jsdoc.json` `"opts": { "progress": false }`).
143
+ * The setu→dwar pipeline does noticeably more than a bare jsdoc run (per-page
144
+ * MDX compile, per-island esbuild bundling, the Pagefind index), so by default
145
+ * the bridge narrates each stage with its elapsed time. Set `false` to silence
146
+ * the stage lines (the build report still prints).
147
+ */
148
+ progress?: unknown;
149
+ /**
150
+ * JSDoc's default-template source options, read from `conf.templates.default`
151
+ * (or, as a fallback, nested under `opts.templates`):
152
+ * - `outputSourceFiles` — defaults to `true`; set `false` to suppress the
153
+ * per-file source viewer pages and the `Source: file:line` member links.
154
+ * - `sourceLinkToComment` — defaults to `false`. By default a `Source:`
155
+ * link lands on the first line of the declaration; set `true` to point it
156
+ * at the doclet's doc-comment line instead (the pre-v5 behavior).
157
+ */
158
+ templates?: {
159
+ default?: {
160
+ outputSourceFiles?: unknown;
161
+ sourceLinkToComment?: unknown;
162
+ };
163
+ };
164
+ [key: string]: unknown;
165
+ }
166
+ /**
167
+ * Resolve JSDoc's `templates.default.outputSourceFiles` flag. The `opts` arg
168
+ * `publish` receives is `env.opts` — the `opts` block — which does NOT carry the
169
+ * root-level `templates` block, so we probe in priority order and default ON:
170
+ * 1. `require('jsdoc/env').conf.templates.default.outputSourceFiles` (the
171
+ * canonical location at runtime; wrapped in try/catch so a missing
172
+ * `jsdoc/env` — e.g. in unit tests — never throws the build).
173
+ * 2. `opts.templates.default.outputSourceFiles` (in case a user nests it
174
+ * under `opts`).
175
+ * Resolves to `false` ONLY when one of those is exactly `=== false`; otherwise
176
+ * `true` (matching JSDoc's default-template default).
177
+ */
178
+ declare function outputSourceFilesEnabled(opts: JSDocOpts): boolean;
179
+ /**
180
+ * Resolve `templates.default.sourceLinkToComment`. Probed in the same priority
181
+ * order as {@link outputSourceFilesEnabled} (canonical `jsdoc/env` conf, then a
182
+ * nested `opts.templates` fallback). Resolves to `true` ONLY when one of those
183
+ * is exactly `=== true`; otherwise `false` (the default: links jump to code).
184
+ */
185
+ declare function sourceLinkToCommentEnabled(opts: JSDocOpts): boolean;
186
+ /**
187
+ * Whether a JSDoc `conf.plugins` list enables the bundled `plugins/markdown`
188
+ * plugin. The theme relies on it: JSDoc runs `plugins/markdown` to convert the
189
+ * Markdown in doclet descriptions/tags to HTML *before* `publish` ever sees the
190
+ * doclets, so without it descriptions arrive as raw Markdown and render wrong.
191
+ * Pure + exported for testing — accepts the `plugins` array (module specifiers,
192
+ * e.g. `"plugins/markdown"`; tolerant of a `.js` suffix or path separators).
193
+ */
194
+ declare function hasMarkdownPlugin(plugins: unknown): boolean;
195
+ /**
196
+ * Validate `opts.sectionOrder` into a clean `string[]`, or `undefined` to fall
197
+ * back to setu's default order. Accepts only an array; trims string entries and
198
+ * drops non-strings/empties. An array that yields no usable labels → `undefined`.
199
+ */
200
+ declare function normalizeSectionOrder(raw: unknown): string[] | undefined;
201
+ /**
202
+ * Validate `opts.menu` into a clean `MenuItem[]`, or `undefined` when there's no
203
+ * usable menu. Accepts only an array of objects; trims string fields. The link
204
+ * URL is read from `link` (preferred) or `href`. Keeps only actionable entries —
205
+ * a built-in (`id`) or an external link (`link`/`href`).
206
+ */
207
+ declare function normalizeMenu(raw: unknown): MenuItem[] | undefined;
208
+ /**
209
+ * Validate `opts.copyPage` into a {@link CopyPageConfig}, or `undefined` to use
210
+ * the defaults (enabled, all actions). Accepts a boolean shorthand (`false`
211
+ * hides the button) or an object: `enabled` is read if boolean; `actions`, if an
212
+ * array, is filtered to the known action ids (preserving order, dropping
213
+ * unknowns/dupes) — an empty/all-invalid array still yields `[]` (primary button
214
+ * only), which is meaningful and kept.
215
+ */
216
+ declare function normalizeCopyPage(raw: unknown): CopyPageConfig | undefined;
217
+ /**
218
+ * Validate `opts.pageNav` into a {@link PageNavConfig}, or `undefined` to use the
219
+ * default (enabled). Accepts a boolean shorthand (`false` hides the pager) or an
220
+ * object whose `enabled` is read when boolean.
221
+ */
222
+ declare function normalizePageNav(raw: unknown): PageNavConfig | undefined;
223
+ /**
224
+ * Validate a user `colors`/`darkColors` object from `jsdoc.json` into a clean
225
+ * `Partial<ThemeColors>`: keeps only the known palette keys whose value is a
226
+ * non-empty string, dropping everything else. Returns `undefined` when the input
227
+ * is not an object or yields no usable keys, so callers can fall back cleanly.
228
+ * Values are passed through verbatim (any CSS color is valid).
229
+ */
230
+ declare function normalizeColors(raw: unknown): Partial<ThemeColors> | undefined;
231
+ /**
232
+ * Compute project-relative paths for a set of absolute source paths by stripping
233
+ * their longest common directory prefix. Returns a `Map<absPath, relPath>` with
234
+ * `relPath` normalized to forward slashes. Pure + exported for testing.
235
+ *
236
+ * Windows-aware: paths are split on both `/` and `\\`, and segment comparison is
237
+ * case-insensitive (NTFS is case-insensitive, and JSDoc's `meta.path` casing can
238
+ * differ from disk). The single-file case yields just its basename. If the paths
239
+ * share no common leading segment (e.g. different drives / UNC vs. drive), each
240
+ * file falls back to its basename so the index stays sane.
241
+ */
242
+ declare function computeRelPaths(absPaths: readonly string[]): Map<string, string>;
243
+ /**
244
+ * Recursively walk a docs directory and read each Markdown/HTML file into a
245
+ * {@link DocInput} for setu's docs front-end. Mirrors {@link collectSourceFiles}'s
246
+ * safe-probe style:
247
+ *
248
+ * - `path` is the file path relative to `dir`, POSIX-normalized (forward slashes)
249
+ * with the extension stripped (`<dir>/guides/advanced.md` → `'guides/advanced'`,
250
+ * `<dir>/index.md` → `'index'`).
251
+ * - `content` is the raw UTF-8 text (frontmatter stays embedded — setu parses it).
252
+ * - `type` is `'markdown'` for `.md`/`.markdown`, `'html'` for `.html`/`.htm`.
253
+ *
254
+ * Resilient by design: a missing/unreadable directory yields `[]` (never throws);
255
+ * dotfiles/dot-dirs and `node_modules`-like noise are skipped; a single
256
+ * unreadable file is warned about and skipped. Results are sorted by `path` so
257
+ * the output is stable build-to-build. Setu does no I/O — this is the only place
258
+ * the docs tree is read.
259
+ */
260
+ declare function collectDocs(dir: string): Promise<DocInput[]>;
261
+ /**
262
+ * Resolve the local images a doc references and route them through the same
263
+ * content-hashed `_assets/` pipeline the logo and custom files use. For each
264
+ * `![alt](src)` whose `src` points to a file on disk, the file is copied to
265
+ * `_assets/<base>.<hash><ext>` (cache-busted, deduped across docs) and the `src`
266
+ * is rewritten to the root-relative `/_assets/<base>.<hash><ext>` (rang's
267
+ * `MdxImg` adds the base path, like it does for links). A `src` is resolved
268
+ * relative to the project root when it starts with `/`, else relative to the
269
+ * doc's own directory; absolute (`http(s):`, `data:`), `#`-anchor, and
270
+ * unreadable srcs are left untouched (the last with a warning). Returns the docs
271
+ * with rewritten content plus the asset files to write. The bridge is the I/O
272
+ * layer here, so setu/dwar only ever see the final `_assets/` paths.
273
+ */
274
+ declare function resolveDocImages(docs: DocInput[], docsDir: string): Promise<{
275
+ docs: DocInput[];
276
+ files: OutputFile[];
277
+ inlineSvgs: Record<string, string>;
278
+ }>;
279
+ /**
280
+ * Validate `opts.docGroups` into a clean `string[]`, or `undefined` to fall back
281
+ * to setu's default doc-group order. Mirrors {@link normalizeSectionOrder}:
282
+ * accepts only an array; trims string entries and drops non-strings/empties.
283
+ */
284
+ declare function normalizeDocGroups(raw: unknown): string[] | undefined;
285
+ declare function publish(data: unknown, opts: JSDocOpts, tutorials?: unknown): Promise<void>;
286
+
287
+ export { collectDocs, computeRelPaths, hasMarkdownPlugin, normalizeColors, normalizeCopyPage, normalizeDocGroups, normalizeMenu, normalizePageNav, normalizeSectionOrder, outputSourceFilesEnabled, publish, resolveDocImages, sourceLinkToCommentEnabled };
@@ -0,0 +1,287 @@
1
+ import { ThemeColors, CopyPageConfig, PageNavConfig, SiteLogo, OutputFile } from '@clean-jsdoc-theme/dwar';
2
+ import { DocInput, MenuItem } from '@clean-jsdoc-theme/setu';
3
+
4
+ interface JSDocOpts {
5
+ destination?: string;
6
+ package?: string;
7
+ /**
8
+ * Site identity from `jsdoc.json` (`"opts": { "siteName": ... }`). Either a
9
+ * string (shown in the header/footer and appended to each page's `<title>`),
10
+ * or a logo image set `{ default, dark, light, alt }`. Local image paths are
11
+ * copied into the output; `http(s)://` and `data:` values pass through. The
12
+ * `alt` text (or `pkg.name`) is used for the `<title>` suffix and image alt.
13
+ */
14
+ siteName?: string | SiteLogo;
15
+ /**
16
+ * Font overrides from `jsdoc.json` (`"opts": { "fonts": { ... } }`). Values
17
+ * are Google Fonts family names for `heading`/`body`; `mono` is a CSS stack.
18
+ */
19
+ fonts?: {
20
+ heading?: string;
21
+ body?: string;
22
+ mono?: string;
23
+ };
24
+ /**
25
+ * Light-mode color overrides from `jsdoc.json` (`"opts": { "colors": { ... } }`).
26
+ * Any subset of `bg`, `bgMuted`, `fg`, `fgMuted`, `accent`, `accentFg`, `border`;
27
+ * each value is any CSS color string (the theme ships oklch). Omitted keys keep
28
+ * the default palette.
29
+ */
30
+ colors?: unknown;
31
+ /**
32
+ * Dark-mode color overrides (`"opts": { "darkColors": { ... } }`). Same keys as
33
+ * {@link JSDocOpts.colors}; emitted under `[data-theme="dark"]`. Omitted keys
34
+ * keep the default dark palette.
35
+ */
36
+ darkColors?: unknown;
37
+ /**
38
+ * Project README as HTML. JSDoc renders the Markdown README (`-R`/`opts.readme`
39
+ * or one found in the source paths) and replaces this with the resulting HTML
40
+ * before calling `publish`. Rendered as the site home page.
41
+ */
42
+ readme?: string;
43
+ /** Path to the tutorials directory (`-u`/`opts.tutorials`); resolved tree arrives as the 3rd `publish` arg. */
44
+ tutorials?: string;
45
+ /**
46
+ * Path to a docs content directory (`jsdoc.json` `"opts": { "docs": "docs/" }`),
47
+ * resolved relative to the cwd. The bridge walks it recursively; each
48
+ * `*.md`/`*.markdown` (and `*.html`) file becomes a prose page at its clean,
49
+ * unprefixed slug (the relative path), grouped by frontmatter/directory. A root
50
+ * `index.md` becomes the home page. Unset → no docs site (today's behavior).
51
+ */
52
+ docs?: unknown;
53
+ /**
54
+ * Top-level doc-group display order (`jsdoc.json` `"opts": { "docGroups": [...] }`).
55
+ * An ordered list of doc-group labels controlling how the doc-group sidebar
56
+ * sections render (after the API sections). Omit for the default order.
57
+ */
58
+ docGroups?: unknown;
59
+ /**
60
+ * Group label assigned to a doc page that carries no frontmatter/directory
61
+ * group (`jsdoc.json` `"opts": { "defaultDocGroup": "Docs" }`). Omit to leave
62
+ * such pages ungrouped.
63
+ */
64
+ defaultDocGroup?: unknown;
65
+ /**
66
+ * Sidebar section order from `jsdoc.json` (`"opts": { "sectionOrder": [...] }`).
67
+ * An ordered list of section labels (e.g. `["Classes", "Tutorials"]`) that both
68
+ * filters and orders the sidebar sections; "Home" and "Source Files" are always
69
+ * shown regardless. Omit (or leave empty) for the default order.
70
+ */
71
+ sectionOrder?: unknown;
72
+ /**
73
+ * Full sidebar menu from `jsdoc.json` (`"opts": { "menu": [...] }`). An ordered
74
+ * list of `{ id, title, href, icon }` entries. When present it takes precedence
75
+ * over `sectionOrder` and controls the entire sidebar (built-ins, sections, and
76
+ * external links). See setu's {@link MenuItem}.
77
+ */
78
+ menu?: unknown;
79
+ /**
80
+ * Club related sidebar entries into prefix-grouped subtrees (`jsdoc.json`
81
+ * `"opts": { "clubSidebarItems": true }`). Groups entries within each section
82
+ * by the path segment before the first `/` (e.g. `queue/*` under a `queue`
83
+ * parent); a prefix with a single entry is left flat. Off by default.
84
+ */
85
+ clubSidebarItems?: unknown;
86
+ /**
87
+ * Custom prompt for the copy-page button's "Open in ChatGPT/Claude/Perplexity"
88
+ * actions (`jsdoc.json` `"opts": { "aiPrompt": "…" }`). `{siteName}`, `{url}`,
89
+ * and `{mdUrl}` (the page's raw Markdown link) placeholders are substituted at
90
+ * click time. Only the prompt + links are sent (the AI fetches `{mdUrl}`), so
91
+ * the query stays short for long docs. Omit for a sensible default.
92
+ */
93
+ aiPrompt?: unknown;
94
+ /**
95
+ * Copy-page button config (`jsdoc.json` `"opts": { "copyPage": … }`). Either a
96
+ * boolean (`false` hides the button) or an object `{ enabled?, actions? }`,
97
+ * where `actions` is an ordered subset of
98
+ * `["copy","view","claude","chatgpt","perplexity"]` (`[]` shows just the
99
+ * primary copy button). Defaults to enabled with all actions.
100
+ */
101
+ copyPage?: unknown;
102
+ /**
103
+ * Previous/next page pager config (`jsdoc.json` `"opts": { "pageNav": … }`).
104
+ * Either a boolean (`false` hides the pager) or an object `{ enabled? }`. The
105
+ * pager links each content page to its neighbors in sidebar reading order.
106
+ * Defaults to enabled.
107
+ */
108
+ pageNav?: unknown;
109
+ /**
110
+ * Inline custom CSS (`jsdoc.json` `"opts": { "customCss": "…" }`), injected as
111
+ * a `<style>` after the theme stylesheet so it can override.
112
+ */
113
+ customCss?: unknown;
114
+ /**
115
+ * Path(s) to custom CSS file(s) (`"opts": { "customCssFile": "a.css" }` or an
116
+ * array). Each file is copied AS-IS (its own bytes) to
117
+ * `_assets/<name>.<hash>.css` and linked after the theme stylesheet. The
118
+ * `<hash>` is a content hash (see `hashCustomAssets`), so an unchanged file
119
+ * keeps a stable, cacheable URL.
120
+ */
121
+ customCssFile?: unknown;
122
+ /**
123
+ * Inline custom JS (`"opts": { "customJs": "…" }`), injected as a classic
124
+ * `<script>` before `</body>`, after the theme's own scripts.
125
+ */
126
+ customJs?: unknown;
127
+ /**
128
+ * Path(s) to custom JS file(s) (`"opts": { "customJsFile": "a.js" }` or an
129
+ * array). Each file is copied AS-IS to `_assets/<name>.<hash>.js` and
130
+ * referenced before `</body>`. See `hashCustomAssets`.
131
+ */
132
+ customJsFile?: unknown;
133
+ /**
134
+ * Whether to append a content hash to copied `customCssFile`/`customJsFile`
135
+ * asset names (`_assets/<name>.<hash>.css`). Defaults to `true` — the hash is
136
+ * derived from the file's content (NOT random), so an unchanged file yields
137
+ * the same URL across builds (cache-friendly) and a changed file cache-busts.
138
+ * Set `false` to copy with the original `<name>.css`/`.js` (no hash).
139
+ */
140
+ hashCustomAssets?: unknown;
141
+ /**
142
+ * Build-stage progress output (`jsdoc.json` `"opts": { "progress": false }`).
143
+ * The setu→dwar pipeline does noticeably more than a bare jsdoc run (per-page
144
+ * MDX compile, per-island esbuild bundling, the Pagefind index), so by default
145
+ * the bridge narrates each stage with its elapsed time. Set `false` to silence
146
+ * the stage lines (the build report still prints).
147
+ */
148
+ progress?: unknown;
149
+ /**
150
+ * JSDoc's default-template source options, read from `conf.templates.default`
151
+ * (or, as a fallback, nested under `opts.templates`):
152
+ * - `outputSourceFiles` — defaults to `true`; set `false` to suppress the
153
+ * per-file source viewer pages and the `Source: file:line` member links.
154
+ * - `sourceLinkToComment` — defaults to `false`. By default a `Source:`
155
+ * link lands on the first line of the declaration; set `true` to point it
156
+ * at the doclet's doc-comment line instead (the pre-v5 behavior).
157
+ */
158
+ templates?: {
159
+ default?: {
160
+ outputSourceFiles?: unknown;
161
+ sourceLinkToComment?: unknown;
162
+ };
163
+ };
164
+ [key: string]: unknown;
165
+ }
166
+ /**
167
+ * Resolve JSDoc's `templates.default.outputSourceFiles` flag. The `opts` arg
168
+ * `publish` receives is `env.opts` — the `opts` block — which does NOT carry the
169
+ * root-level `templates` block, so we probe in priority order and default ON:
170
+ * 1. `require('jsdoc/env').conf.templates.default.outputSourceFiles` (the
171
+ * canonical location at runtime; wrapped in try/catch so a missing
172
+ * `jsdoc/env` — e.g. in unit tests — never throws the build).
173
+ * 2. `opts.templates.default.outputSourceFiles` (in case a user nests it
174
+ * under `opts`).
175
+ * Resolves to `false` ONLY when one of those is exactly `=== false`; otherwise
176
+ * `true` (matching JSDoc's default-template default).
177
+ */
178
+ declare function outputSourceFilesEnabled(opts: JSDocOpts): boolean;
179
+ /**
180
+ * Resolve `templates.default.sourceLinkToComment`. Probed in the same priority
181
+ * order as {@link outputSourceFilesEnabled} (canonical `jsdoc/env` conf, then a
182
+ * nested `opts.templates` fallback). Resolves to `true` ONLY when one of those
183
+ * is exactly `=== true`; otherwise `false` (the default: links jump to code).
184
+ */
185
+ declare function sourceLinkToCommentEnabled(opts: JSDocOpts): boolean;
186
+ /**
187
+ * Whether a JSDoc `conf.plugins` list enables the bundled `plugins/markdown`
188
+ * plugin. The theme relies on it: JSDoc runs `plugins/markdown` to convert the
189
+ * Markdown in doclet descriptions/tags to HTML *before* `publish` ever sees the
190
+ * doclets, so without it descriptions arrive as raw Markdown and render wrong.
191
+ * Pure + exported for testing — accepts the `plugins` array (module specifiers,
192
+ * e.g. `"plugins/markdown"`; tolerant of a `.js` suffix or path separators).
193
+ */
194
+ declare function hasMarkdownPlugin(plugins: unknown): boolean;
195
+ /**
196
+ * Validate `opts.sectionOrder` into a clean `string[]`, or `undefined` to fall
197
+ * back to setu's default order. Accepts only an array; trims string entries and
198
+ * drops non-strings/empties. An array that yields no usable labels → `undefined`.
199
+ */
200
+ declare function normalizeSectionOrder(raw: unknown): string[] | undefined;
201
+ /**
202
+ * Validate `opts.menu` into a clean `MenuItem[]`, or `undefined` when there's no
203
+ * usable menu. Accepts only an array of objects; trims string fields. The link
204
+ * URL is read from `link` (preferred) or `href`. Keeps only actionable entries —
205
+ * a built-in (`id`) or an external link (`link`/`href`).
206
+ */
207
+ declare function normalizeMenu(raw: unknown): MenuItem[] | undefined;
208
+ /**
209
+ * Validate `opts.copyPage` into a {@link CopyPageConfig}, or `undefined` to use
210
+ * the defaults (enabled, all actions). Accepts a boolean shorthand (`false`
211
+ * hides the button) or an object: `enabled` is read if boolean; `actions`, if an
212
+ * array, is filtered to the known action ids (preserving order, dropping
213
+ * unknowns/dupes) — an empty/all-invalid array still yields `[]` (primary button
214
+ * only), which is meaningful and kept.
215
+ */
216
+ declare function normalizeCopyPage(raw: unknown): CopyPageConfig | undefined;
217
+ /**
218
+ * Validate `opts.pageNav` into a {@link PageNavConfig}, or `undefined` to use the
219
+ * default (enabled). Accepts a boolean shorthand (`false` hides the pager) or an
220
+ * object whose `enabled` is read when boolean.
221
+ */
222
+ declare function normalizePageNav(raw: unknown): PageNavConfig | undefined;
223
+ /**
224
+ * Validate a user `colors`/`darkColors` object from `jsdoc.json` into a clean
225
+ * `Partial<ThemeColors>`: keeps only the known palette keys whose value is a
226
+ * non-empty string, dropping everything else. Returns `undefined` when the input
227
+ * is not an object or yields no usable keys, so callers can fall back cleanly.
228
+ * Values are passed through verbatim (any CSS color is valid).
229
+ */
230
+ declare function normalizeColors(raw: unknown): Partial<ThemeColors> | undefined;
231
+ /**
232
+ * Compute project-relative paths for a set of absolute source paths by stripping
233
+ * their longest common directory prefix. Returns a `Map<absPath, relPath>` with
234
+ * `relPath` normalized to forward slashes. Pure + exported for testing.
235
+ *
236
+ * Windows-aware: paths are split on both `/` and `\\`, and segment comparison is
237
+ * case-insensitive (NTFS is case-insensitive, and JSDoc's `meta.path` casing can
238
+ * differ from disk). The single-file case yields just its basename. If the paths
239
+ * share no common leading segment (e.g. different drives / UNC vs. drive), each
240
+ * file falls back to its basename so the index stays sane.
241
+ */
242
+ declare function computeRelPaths(absPaths: readonly string[]): Map<string, string>;
243
+ /**
244
+ * Recursively walk a docs directory and read each Markdown/HTML file into a
245
+ * {@link DocInput} for setu's docs front-end. Mirrors {@link collectSourceFiles}'s
246
+ * safe-probe style:
247
+ *
248
+ * - `path` is the file path relative to `dir`, POSIX-normalized (forward slashes)
249
+ * with the extension stripped (`<dir>/guides/advanced.md` → `'guides/advanced'`,
250
+ * `<dir>/index.md` → `'index'`).
251
+ * - `content` is the raw UTF-8 text (frontmatter stays embedded — setu parses it).
252
+ * - `type` is `'markdown'` for `.md`/`.markdown`, `'html'` for `.html`/`.htm`.
253
+ *
254
+ * Resilient by design: a missing/unreadable directory yields `[]` (never throws);
255
+ * dotfiles/dot-dirs and `node_modules`-like noise are skipped; a single
256
+ * unreadable file is warned about and skipped. Results are sorted by `path` so
257
+ * the output is stable build-to-build. Setu does no I/O — this is the only place
258
+ * the docs tree is read.
259
+ */
260
+ declare function collectDocs(dir: string): Promise<DocInput[]>;
261
+ /**
262
+ * Resolve the local images a doc references and route them through the same
263
+ * content-hashed `_assets/` pipeline the logo and custom files use. For each
264
+ * `![alt](src)` whose `src` points to a file on disk, the file is copied to
265
+ * `_assets/<base>.<hash><ext>` (cache-busted, deduped across docs) and the `src`
266
+ * is rewritten to the root-relative `/_assets/<base>.<hash><ext>` (rang's
267
+ * `MdxImg` adds the base path, like it does for links). A `src` is resolved
268
+ * relative to the project root when it starts with `/`, else relative to the
269
+ * doc's own directory; absolute (`http(s):`, `data:`), `#`-anchor, and
270
+ * unreadable srcs are left untouched (the last with a warning). Returns the docs
271
+ * with rewritten content plus the asset files to write. The bridge is the I/O
272
+ * layer here, so setu/dwar only ever see the final `_assets/` paths.
273
+ */
274
+ declare function resolveDocImages(docs: DocInput[], docsDir: string): Promise<{
275
+ docs: DocInput[];
276
+ files: OutputFile[];
277
+ inlineSvgs: Record<string, string>;
278
+ }>;
279
+ /**
280
+ * Validate `opts.docGroups` into a clean `string[]`, or `undefined` to fall back
281
+ * to setu's default doc-group order. Mirrors {@link normalizeSectionOrder}:
282
+ * accepts only an array; trims string entries and drops non-strings/empties.
283
+ */
284
+ declare function normalizeDocGroups(raw: unknown): string[] | undefined;
285
+ declare function publish(data: unknown, opts: JSDocOpts, tutorials?: unknown): Promise<void>;
286
+
287
+ export { collectDocs, computeRelPaths, hasMarkdownPlugin, normalizeColors, normalizeCopyPage, normalizeDocGroups, normalizeMenu, normalizePageNav, normalizeSectionOrder, outputSourceFilesEnabled, publish, resolveDocImages, sourceLinkToCommentEnabled };