clean-jsdoc-theme 5.0.3 → 5.0.5

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.
@@ -1,5 +1,5 @@
1
- import { OutputFile, ThemeColors, CopyPageConfig, MetaTag, PageNavConfig, ThemeConfig, SiteLogo } from '@clean-jsdoc-theme/dwar';
2
- import { DocInput, MenuItem, PlaygroundSiteConfig } from '@clean-jsdoc-theme/setu';
1
+ import { OutputFile, SiteLogo, ThemeColors, CopyPageConfig, MetaTag, PageNavConfig, ThemeConfig } from '@clean-jsdoc-theme/dwar';
2
+ import { DocInput, MenuItem, PlaygroundSiteConfig, TutorialInput } from '@clean-jsdoc-theme/setu';
3
3
 
4
4
  interface JSDocOpts {
5
5
  destination?: string;
@@ -124,6 +124,14 @@ interface JSDocOpts {
124
124
  * Omit for the default footer.
125
125
  */
126
126
  footer?: unknown;
127
+ /**
128
+ * Site public base URL (`jsdoc.json` `"opts": { "siteUrl": "https://example.com" }`).
129
+ * When set, the build emits a `sitemap.xml` at the output root listing every
130
+ * non-hidden page's canonical URL. Only the URL's origin is used — the deploy
131
+ * sub-path comes from `basePath` — so a bare origin or a full URL whose path
132
+ * equals `basePath` both work. Omit it for no sitemap.
133
+ */
134
+ siteUrl?: unknown;
127
135
  /**
128
136
  * Favicon (`jsdoc.json` `"opts": { "favicon": "./icon.svg" }`). A path to an
129
137
  * image file (`.svg`/`.png`/`.ico`/…), relative to the working dir. The bridge
@@ -188,11 +196,23 @@ interface JSDocOpts {
188
196
  * - `sourceLinkToComment` — defaults to `false`. By default a `Source:`
189
197
  * link lands on the first line of the declaration; set `true` to point it
190
198
  * at the doclet's doc-comment line instead (the pre-v5 behavior).
199
+ * - `cleanOutputDir` — defaults to `true`; set `false` to keep existing files
200
+ * in the destination instead of emptying it before each build.
191
201
  */
192
202
  templates?: {
193
203
  default?: {
194
204
  outputSourceFiles?: unknown;
195
205
  sourceLinkToComment?: unknown;
206
+ cleanOutputDir?: unknown;
207
+ /**
208
+ * JSDoc's standard static-file passthrough
209
+ * (`templates.default.staticFiles`): `{ include, exclude, includePattern,
210
+ * excludePattern }`. Files matched by `include` are copied verbatim into
211
+ * the output (an include dir's contents land at the output root, JSDoc's
212
+ * mapping) AND their dirs become fallback search roots for image
213
+ * resolution, so a bare/relative reference to a static image resolves.
214
+ */
215
+ staticFiles?: unknown;
196
216
  };
197
217
  };
198
218
  [key: string]: unknown;
@@ -247,6 +267,15 @@ declare function outputSourceFilesEnabled(opts: JSDocOpts): boolean;
247
267
  * is exactly `=== true`; otherwise `false` (the default: links jump to code).
248
268
  */
249
269
  declare function sourceLinkToCommentEnabled(opts: JSDocOpts): boolean;
270
+ /**
271
+ * Resolve `templates.default.cleanOutputDir`. Probed in the same priority order
272
+ * as {@link outputSourceFilesEnabled} (canonical `jsdoc/env` conf, then a nested
273
+ * `opts.templates` fallback). Defaults to `true` — the build empties its
274
+ * destination first so a page removed or renamed between runs (e.g. a deleted
275
+ * class, or a stale content-hashed `styles.<hash>.css`) doesn't linger in the
276
+ * served site. Resolves to `false` ONLY when one is exactly `=== false`.
277
+ */
278
+ declare function cleanOutputDirEnabled(opts: JSDocOpts): boolean;
250
279
  /**
251
280
  * Whether a JSDoc `conf.plugins` list enables the bundled `plugins/markdown`
252
281
  * plugin. The theme relies on it: JSDoc runs `plugins/markdown` to convert the
@@ -338,23 +367,134 @@ declare function computeRelPaths(absPaths: readonly string[]): Map<string, strin
338
367
  */
339
368
  declare function collectDocs(dir: string): Promise<DocInput[]>;
340
369
  /**
341
- * Resolve the local images a doc references and route them through the same
342
- * content-hashed `_assets/` pipeline the logo and custom files use. For each
343
- * `![alt](src)` whose `src` points to a file on disk, the file is copied to
344
- * `_assets/<base>.<hash><ext>` (cache-busted, deduped across docs) and the `src`
345
- * is rewritten to the root-relative `/_assets/<base>.<hash><ext>` (rang's
346
- * `MdxImg` adds the base path, like it does for links). A `src` is resolved
347
- * relative to the project root when it starts with `/`, else relative to the
348
- * doc's own directory; absolute (`http(s):`, `data:`), `#`-anchor, and
349
- * unreadable srcs are left untouched (the last with a warning). Returns the docs
350
- * with rewritten content plus the asset files to write. The bridge is the I/O
351
- * layer here, so setu/dwar only ever see the final `_assets/` paths.
370
+ * A reusable local-image asset pipeline shared by every prose source (docs,
371
+ * tutorials, README, doclet comments). `resolve(src, baseDir)` copies a local
372
+ * image to `_assets/<base>.<hash><ext>` (content-hashed → cache-busted, deduped
373
+ * across all sources via the shared caches) and returns the root-relative
374
+ * `/_assets/…` href. It accumulates each copied file on `files`, each SVG's
375
+ * markup on `inlineSvgs` (keyed by the rewritten href, so the renderer can inline
376
+ * it — its `[data-theme]` styles then track the toggle), and the absolute source
377
+ * path of every copied image on `consumed` (so the static-file passthrough can
378
+ * skip re-copying an image it already served from `_assets/`).
379
+ *
380
+ * Resolution tries, in order: the doc-relative path (or project root for a
381
+ * `/`-rooted src), then — for the JSDoc `staticFiles` convention — each
382
+ * `staticDirs` root joined with the reference's output-relative name. So a bare
383
+ * `![x](classes-io.png)` whose file lives in a declared `staticFiles` dir still
384
+ * resolves and is hashed. External (`http(s):`, `data:`), `#`-anchor, and
385
+ * fully-unresolvable srcs yield `null` (the last warned once) so callers leave
386
+ * them untouched.
352
387
  */
353
- declare function resolveDocImages(docs: DocInput[], docsDir: string): Promise<{
388
+ interface ImageCollector {
389
+ resolve(rawSrc: string, baseDir: string): Promise<string | null>;
390
+ readonly files: OutputFile[];
391
+ readonly inlineSvgs: Record<string, string>;
392
+ readonly consumed: Set<string>;
393
+ }
394
+ declare function createImageCollector(staticDirs?: readonly string[]): ImageCollector;
395
+ /**
396
+ * Resolve the local images a doc references and route them through the shared
397
+ * content-hashed `_assets/` pipeline (see {@link createImageCollector}). Each
398
+ * `![alt](src)` / `<img src>` whose `src` points to a file on disk is copied and
399
+ * its `src` rewritten to the root-relative `/_assets/<base>.<hash><ext>` (rang's
400
+ * `MdxImg` adds the base path, like it does for links), resolved relative to the
401
+ * project root when it starts with `/`, else relative to the doc's own directory.
402
+ * Returns the docs with rewritten content plus the asset files to write. The
403
+ * bridge is the I/O layer here, so setu/dwar only ever see the final `_assets/`
404
+ * paths.
405
+ */
406
+ declare function resolveDocImages(docs: DocInput[], docsDir: string, collector?: ImageCollector): Promise<{
354
407
  docs: DocInput[];
355
408
  files: OutputFile[];
356
409
  inlineSvgs: Record<string, string>;
357
410
  }>;
411
+ /**
412
+ * Resolve the local images referenced by tutorial content, routing them through
413
+ * the shared `collector` (the same content-hashed `_assets/` pipeline as docs).
414
+ * JSDoc reads every tutorial from a single directory, so each tutorial's relative
415
+ * srcs (`![x](../img/x.png)`, `<img src>`) resolve against `tutorialsDir`. Walks
416
+ * the resolved tree (sub-tutorials included), rewriting each node's content —
417
+ * Markdown or HTML; the tree shape is preserved. Returns a new tree (the input is
418
+ * left untouched). Exported for testing.
419
+ */
420
+ declare function resolveTutorialImages(tree: TutorialInput[], tutorialsDir: string, collector: ImageCollector): Promise<TutorialInput[]>;
421
+ /**
422
+ * Resolve the local images referenced inside JSDoc-comment prose (doclet
423
+ * descriptions, `@classdesc`, nested `@param`/`@property`/`@returns`
424
+ * descriptions, …) and route them through the shared `collector`. JSDoc's
425
+ * `plugins/markdown` has already turned a comment's `![alt](../img/x.png)` into
426
+ * an HTML `<img src="../img/x.png">` by the time `publish` runs, so each src is
427
+ * resolved **relative to that doclet's own source file** (`meta.path` — the
428
+ * directory of the file the comment lives in). Doclets are mutated IN PLACE:
429
+ * salty's `get()` hands out live object references, so the rewrite is visible
430
+ * when setu later reads the same collection. Resilient — a non-collection `data`
431
+ * or unreadable image is skipped (the latter warned), never fatal.
432
+ */
433
+ declare function resolveDocletImages(data: unknown, collector: ImageCollector): Promise<void>;
434
+ /** Normalized `templates.default.staticFiles` config. */
435
+ interface StaticFilesConfig {
436
+ /** Resolved-as-given include paths (dirs or files), trimmed, non-empty. */
437
+ include: string[];
438
+ /** Paths to exclude (a file equal to, or under, an excluded dir is dropped). */
439
+ exclude: string[];
440
+ /** Regex (source string) a file's POSIX abs path must match to be included. */
441
+ includePattern?: string;
442
+ /** Regex (source string) that drops a file when its POSIX abs path matches. */
443
+ excludePattern?: string;
444
+ }
445
+ /**
446
+ * Normalize a raw `staticFiles` block into a {@link StaticFilesConfig}, or
447
+ * `undefined` when there's nothing to include. `include`/`exclude` accept a
448
+ * string or string[]; patterns are kept as source strings (compiled later, so a
449
+ * bad pattern fails open rather than throwing). Pure + exported for testing.
450
+ */
451
+ declare function normalizeStaticFilesConfig(raw: unknown): StaticFilesConfig | undefined;
452
+ /**
453
+ * Read `templates.default.staticFiles` from JSDoc's canonical `jsdoc/env` conf
454
+ * (the only place the root-level `templates` block lives at runtime), falling
455
+ * back to a nested `opts.templates.default.staticFiles`. Mirrors the probe order
456
+ * of {@link outputSourceFilesEnabled}. Returns `undefined` when unset/unusable.
457
+ */
458
+ declare function readStaticFilesConfig(opts: JSDocOpts): StaticFilesConfig | undefined;
459
+ /**
460
+ * Output-relative path (POSIX) for a static file under an include root: strip the
461
+ * resolved-root prefix so `<root>/img/sub/x.png` under root `<root>/img` →
462
+ * `sub/x.png` (JSDoc maps an include dir's contents to the output ROOT). When the
463
+ * include was a single FILE (`absFile === includeRootAbs`), the output name is its
464
+ * basename. Windows-aware: separators are normalized and the prefix match is
465
+ * case-insensitive (NTFS). Pure + exported for testing.
466
+ */
467
+ declare function staticFileOutputName(absFile: string, includeRootAbs: string): string;
468
+ /**
469
+ * Whether a static file passes a config's filter — `includePattern` (must match),
470
+ * `excludePattern` (must not match), and `exclude` (file equal to, or nested
471
+ * under, an excluded path is dropped). Patterns are tested against the file's
472
+ * POSIX-normalized absolute path; a malformed pattern fails open (ignored). Pure
473
+ * + exported for testing.
474
+ */
475
+ declare function staticFileIncluded(absFile: string, config: StaticFilesConfig): boolean;
476
+ /** One verbatim static-file copy entry. */
477
+ interface StaticFileEntry {
478
+ /** Output-relative POSIX path (where it lands under the destination). */
479
+ outputPath: string;
480
+ /** Absolute source path (matched against the image collector's `consumed`). */
481
+ absSource: string;
482
+ contents: Buffer;
483
+ }
484
+ /**
485
+ * Collect the files matched by a {@link StaticFilesConfig}: walk each include
486
+ * path (a directory recursively, or a single file), apply
487
+ * {@link staticFileIncluded}, and read each match. Returns the verbatim copy
488
+ * entries (output path = include-root-stripped, JSDoc's "contents → output root"
489
+ * mapping) plus the resolved `searchDirs` the image resolver uses as fallback
490
+ * roots (an include dir as-is; a file include's parent dir). Resilient: a missing
491
+ * include path / unreadable file is warned + skipped, never fatal. Exported for
492
+ * testing.
493
+ */
494
+ declare function collectStaticFiles(config: StaticFilesConfig, warn?: (message: string) => void): Promise<{
495
+ files: StaticFileEntry[];
496
+ searchDirs: string[];
497
+ }>;
358
498
  /** The output of {@link resolveDocImages}: resolved docs + their image assets. */
359
499
  interface ResolvedDocs {
360
500
  docs: DocInput[];
@@ -379,4 +519,4 @@ declare function overlayDocs(base: ResolvedDocs, locale: ResolvedDocs): Resolved
379
519
  declare function normalizeDocGroups(raw: unknown): string[] | undefined;
380
520
  declare function publish(data: unknown, opts: JSDocOpts, tutorials?: unknown): Promise<void>;
381
521
 
382
- export { type ResolvedDocs, collectDocs, computeRelPaths, hasMarkdownPlugin, normalizeColors, normalizeCopyPage, normalizeDocGroups, normalizeMenu, normalizeMeta, normalizePageNav, normalizePlayground, normalizeSectionOrder, outputSourceFilesEnabled, overlayDocs, publish, resolveDocImages, resolveFavicon, resolveFooter, sourceLinkToCommentEnabled };
522
+ export { type ImageCollector, type ResolvedDocs, type StaticFileEntry, type StaticFilesConfig, cleanOutputDirEnabled, collectDocs, collectStaticFiles, computeRelPaths, createImageCollector, hasMarkdownPlugin, normalizeColors, normalizeCopyPage, normalizeDocGroups, normalizeMenu, normalizeMeta, normalizePageNav, normalizePlayground, normalizeSectionOrder, normalizeStaticFilesConfig, outputSourceFilesEnabled, overlayDocs, publish, readStaticFilesConfig, resolveDocImages, resolveDocletImages, resolveFavicon, resolveFooter, resolveTutorialImages, sourceLinkToCommentEnabled, staticFileIncluded, staticFileOutputName };
package/dist/publish.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { OutputFile, ThemeColors, CopyPageConfig, MetaTag, PageNavConfig, ThemeConfig, SiteLogo } from '@clean-jsdoc-theme/dwar';
2
- import { DocInput, MenuItem, PlaygroundSiteConfig } from '@clean-jsdoc-theme/setu';
1
+ import { OutputFile, SiteLogo, ThemeColors, CopyPageConfig, MetaTag, PageNavConfig, ThemeConfig } from '@clean-jsdoc-theme/dwar';
2
+ import { DocInput, MenuItem, PlaygroundSiteConfig, TutorialInput } from '@clean-jsdoc-theme/setu';
3
3
 
4
4
  interface JSDocOpts {
5
5
  destination?: string;
@@ -124,6 +124,14 @@ interface JSDocOpts {
124
124
  * Omit for the default footer.
125
125
  */
126
126
  footer?: unknown;
127
+ /**
128
+ * Site public base URL (`jsdoc.json` `"opts": { "siteUrl": "https://example.com" }`).
129
+ * When set, the build emits a `sitemap.xml` at the output root listing every
130
+ * non-hidden page's canonical URL. Only the URL's origin is used — the deploy
131
+ * sub-path comes from `basePath` — so a bare origin or a full URL whose path
132
+ * equals `basePath` both work. Omit it for no sitemap.
133
+ */
134
+ siteUrl?: unknown;
127
135
  /**
128
136
  * Favicon (`jsdoc.json` `"opts": { "favicon": "./icon.svg" }`). A path to an
129
137
  * image file (`.svg`/`.png`/`.ico`/…), relative to the working dir. The bridge
@@ -188,11 +196,23 @@ interface JSDocOpts {
188
196
  * - `sourceLinkToComment` — defaults to `false`. By default a `Source:`
189
197
  * link lands on the first line of the declaration; set `true` to point it
190
198
  * at the doclet's doc-comment line instead (the pre-v5 behavior).
199
+ * - `cleanOutputDir` — defaults to `true`; set `false` to keep existing files
200
+ * in the destination instead of emptying it before each build.
191
201
  */
192
202
  templates?: {
193
203
  default?: {
194
204
  outputSourceFiles?: unknown;
195
205
  sourceLinkToComment?: unknown;
206
+ cleanOutputDir?: unknown;
207
+ /**
208
+ * JSDoc's standard static-file passthrough
209
+ * (`templates.default.staticFiles`): `{ include, exclude, includePattern,
210
+ * excludePattern }`. Files matched by `include` are copied verbatim into
211
+ * the output (an include dir's contents land at the output root, JSDoc's
212
+ * mapping) AND their dirs become fallback search roots for image
213
+ * resolution, so a bare/relative reference to a static image resolves.
214
+ */
215
+ staticFiles?: unknown;
196
216
  };
197
217
  };
198
218
  [key: string]: unknown;
@@ -247,6 +267,15 @@ declare function outputSourceFilesEnabled(opts: JSDocOpts): boolean;
247
267
  * is exactly `=== true`; otherwise `false` (the default: links jump to code).
248
268
  */
249
269
  declare function sourceLinkToCommentEnabled(opts: JSDocOpts): boolean;
270
+ /**
271
+ * Resolve `templates.default.cleanOutputDir`. Probed in the same priority order
272
+ * as {@link outputSourceFilesEnabled} (canonical `jsdoc/env` conf, then a nested
273
+ * `opts.templates` fallback). Defaults to `true` — the build empties its
274
+ * destination first so a page removed or renamed between runs (e.g. a deleted
275
+ * class, or a stale content-hashed `styles.<hash>.css`) doesn't linger in the
276
+ * served site. Resolves to `false` ONLY when one is exactly `=== false`.
277
+ */
278
+ declare function cleanOutputDirEnabled(opts: JSDocOpts): boolean;
250
279
  /**
251
280
  * Whether a JSDoc `conf.plugins` list enables the bundled `plugins/markdown`
252
281
  * plugin. The theme relies on it: JSDoc runs `plugins/markdown` to convert the
@@ -338,23 +367,134 @@ declare function computeRelPaths(absPaths: readonly string[]): Map<string, strin
338
367
  */
339
368
  declare function collectDocs(dir: string): Promise<DocInput[]>;
340
369
  /**
341
- * Resolve the local images a doc references and route them through the same
342
- * content-hashed `_assets/` pipeline the logo and custom files use. For each
343
- * `![alt](src)` whose `src` points to a file on disk, the file is copied to
344
- * `_assets/<base>.<hash><ext>` (cache-busted, deduped across docs) and the `src`
345
- * is rewritten to the root-relative `/_assets/<base>.<hash><ext>` (rang's
346
- * `MdxImg` adds the base path, like it does for links). A `src` is resolved
347
- * relative to the project root when it starts with `/`, else relative to the
348
- * doc's own directory; absolute (`http(s):`, `data:`), `#`-anchor, and
349
- * unreadable srcs are left untouched (the last with a warning). Returns the docs
350
- * with rewritten content plus the asset files to write. The bridge is the I/O
351
- * layer here, so setu/dwar only ever see the final `_assets/` paths.
370
+ * A reusable local-image asset pipeline shared by every prose source (docs,
371
+ * tutorials, README, doclet comments). `resolve(src, baseDir)` copies a local
372
+ * image to `_assets/<base>.<hash><ext>` (content-hashed → cache-busted, deduped
373
+ * across all sources via the shared caches) and returns the root-relative
374
+ * `/_assets/…` href. It accumulates each copied file on `files`, each SVG's
375
+ * markup on `inlineSvgs` (keyed by the rewritten href, so the renderer can inline
376
+ * it — its `[data-theme]` styles then track the toggle), and the absolute source
377
+ * path of every copied image on `consumed` (so the static-file passthrough can
378
+ * skip re-copying an image it already served from `_assets/`).
379
+ *
380
+ * Resolution tries, in order: the doc-relative path (or project root for a
381
+ * `/`-rooted src), then — for the JSDoc `staticFiles` convention — each
382
+ * `staticDirs` root joined with the reference's output-relative name. So a bare
383
+ * `![x](classes-io.png)` whose file lives in a declared `staticFiles` dir still
384
+ * resolves and is hashed. External (`http(s):`, `data:`), `#`-anchor, and
385
+ * fully-unresolvable srcs yield `null` (the last warned once) so callers leave
386
+ * them untouched.
352
387
  */
353
- declare function resolveDocImages(docs: DocInput[], docsDir: string): Promise<{
388
+ interface ImageCollector {
389
+ resolve(rawSrc: string, baseDir: string): Promise<string | null>;
390
+ readonly files: OutputFile[];
391
+ readonly inlineSvgs: Record<string, string>;
392
+ readonly consumed: Set<string>;
393
+ }
394
+ declare function createImageCollector(staticDirs?: readonly string[]): ImageCollector;
395
+ /**
396
+ * Resolve the local images a doc references and route them through the shared
397
+ * content-hashed `_assets/` pipeline (see {@link createImageCollector}). Each
398
+ * `![alt](src)` / `<img src>` whose `src` points to a file on disk is copied and
399
+ * its `src` rewritten to the root-relative `/_assets/<base>.<hash><ext>` (rang's
400
+ * `MdxImg` adds the base path, like it does for links), resolved relative to the
401
+ * project root when it starts with `/`, else relative to the doc's own directory.
402
+ * Returns the docs with rewritten content plus the asset files to write. The
403
+ * bridge is the I/O layer here, so setu/dwar only ever see the final `_assets/`
404
+ * paths.
405
+ */
406
+ declare function resolveDocImages(docs: DocInput[], docsDir: string, collector?: ImageCollector): Promise<{
354
407
  docs: DocInput[];
355
408
  files: OutputFile[];
356
409
  inlineSvgs: Record<string, string>;
357
410
  }>;
411
+ /**
412
+ * Resolve the local images referenced by tutorial content, routing them through
413
+ * the shared `collector` (the same content-hashed `_assets/` pipeline as docs).
414
+ * JSDoc reads every tutorial from a single directory, so each tutorial's relative
415
+ * srcs (`![x](../img/x.png)`, `<img src>`) resolve against `tutorialsDir`. Walks
416
+ * the resolved tree (sub-tutorials included), rewriting each node's content —
417
+ * Markdown or HTML; the tree shape is preserved. Returns a new tree (the input is
418
+ * left untouched). Exported for testing.
419
+ */
420
+ declare function resolveTutorialImages(tree: TutorialInput[], tutorialsDir: string, collector: ImageCollector): Promise<TutorialInput[]>;
421
+ /**
422
+ * Resolve the local images referenced inside JSDoc-comment prose (doclet
423
+ * descriptions, `@classdesc`, nested `@param`/`@property`/`@returns`
424
+ * descriptions, …) and route them through the shared `collector`. JSDoc's
425
+ * `plugins/markdown` has already turned a comment's `![alt](../img/x.png)` into
426
+ * an HTML `<img src="../img/x.png">` by the time `publish` runs, so each src is
427
+ * resolved **relative to that doclet's own source file** (`meta.path` — the
428
+ * directory of the file the comment lives in). Doclets are mutated IN PLACE:
429
+ * salty's `get()` hands out live object references, so the rewrite is visible
430
+ * when setu later reads the same collection. Resilient — a non-collection `data`
431
+ * or unreadable image is skipped (the latter warned), never fatal.
432
+ */
433
+ declare function resolveDocletImages(data: unknown, collector: ImageCollector): Promise<void>;
434
+ /** Normalized `templates.default.staticFiles` config. */
435
+ interface StaticFilesConfig {
436
+ /** Resolved-as-given include paths (dirs or files), trimmed, non-empty. */
437
+ include: string[];
438
+ /** Paths to exclude (a file equal to, or under, an excluded dir is dropped). */
439
+ exclude: string[];
440
+ /** Regex (source string) a file's POSIX abs path must match to be included. */
441
+ includePattern?: string;
442
+ /** Regex (source string) that drops a file when its POSIX abs path matches. */
443
+ excludePattern?: string;
444
+ }
445
+ /**
446
+ * Normalize a raw `staticFiles` block into a {@link StaticFilesConfig}, or
447
+ * `undefined` when there's nothing to include. `include`/`exclude` accept a
448
+ * string or string[]; patterns are kept as source strings (compiled later, so a
449
+ * bad pattern fails open rather than throwing). Pure + exported for testing.
450
+ */
451
+ declare function normalizeStaticFilesConfig(raw: unknown): StaticFilesConfig | undefined;
452
+ /**
453
+ * Read `templates.default.staticFiles` from JSDoc's canonical `jsdoc/env` conf
454
+ * (the only place the root-level `templates` block lives at runtime), falling
455
+ * back to a nested `opts.templates.default.staticFiles`. Mirrors the probe order
456
+ * of {@link outputSourceFilesEnabled}. Returns `undefined` when unset/unusable.
457
+ */
458
+ declare function readStaticFilesConfig(opts: JSDocOpts): StaticFilesConfig | undefined;
459
+ /**
460
+ * Output-relative path (POSIX) for a static file under an include root: strip the
461
+ * resolved-root prefix so `<root>/img/sub/x.png` under root `<root>/img` →
462
+ * `sub/x.png` (JSDoc maps an include dir's contents to the output ROOT). When the
463
+ * include was a single FILE (`absFile === includeRootAbs`), the output name is its
464
+ * basename. Windows-aware: separators are normalized and the prefix match is
465
+ * case-insensitive (NTFS). Pure + exported for testing.
466
+ */
467
+ declare function staticFileOutputName(absFile: string, includeRootAbs: string): string;
468
+ /**
469
+ * Whether a static file passes a config's filter — `includePattern` (must match),
470
+ * `excludePattern` (must not match), and `exclude` (file equal to, or nested
471
+ * under, an excluded path is dropped). Patterns are tested against the file's
472
+ * POSIX-normalized absolute path; a malformed pattern fails open (ignored). Pure
473
+ * + exported for testing.
474
+ */
475
+ declare function staticFileIncluded(absFile: string, config: StaticFilesConfig): boolean;
476
+ /** One verbatim static-file copy entry. */
477
+ interface StaticFileEntry {
478
+ /** Output-relative POSIX path (where it lands under the destination). */
479
+ outputPath: string;
480
+ /** Absolute source path (matched against the image collector's `consumed`). */
481
+ absSource: string;
482
+ contents: Buffer;
483
+ }
484
+ /**
485
+ * Collect the files matched by a {@link StaticFilesConfig}: walk each include
486
+ * path (a directory recursively, or a single file), apply
487
+ * {@link staticFileIncluded}, and read each match. Returns the verbatim copy
488
+ * entries (output path = include-root-stripped, JSDoc's "contents → output root"
489
+ * mapping) plus the resolved `searchDirs` the image resolver uses as fallback
490
+ * roots (an include dir as-is; a file include's parent dir). Resilient: a missing
491
+ * include path / unreadable file is warned + skipped, never fatal. Exported for
492
+ * testing.
493
+ */
494
+ declare function collectStaticFiles(config: StaticFilesConfig, warn?: (message: string) => void): Promise<{
495
+ files: StaticFileEntry[];
496
+ searchDirs: string[];
497
+ }>;
358
498
  /** The output of {@link resolveDocImages}: resolved docs + their image assets. */
359
499
  interface ResolvedDocs {
360
500
  docs: DocInput[];
@@ -379,4 +519,4 @@ declare function overlayDocs(base: ResolvedDocs, locale: ResolvedDocs): Resolved
379
519
  declare function normalizeDocGroups(raw: unknown): string[] | undefined;
380
520
  declare function publish(data: unknown, opts: JSDocOpts, tutorials?: unknown): Promise<void>;
381
521
 
382
- export { type ResolvedDocs, collectDocs, computeRelPaths, hasMarkdownPlugin, normalizeColors, normalizeCopyPage, normalizeDocGroups, normalizeMenu, normalizeMeta, normalizePageNav, normalizePlayground, normalizeSectionOrder, outputSourceFilesEnabled, overlayDocs, publish, resolveDocImages, resolveFavicon, resolveFooter, sourceLinkToCommentEnabled };
522
+ export { type ImageCollector, type ResolvedDocs, type StaticFileEntry, type StaticFilesConfig, cleanOutputDirEnabled, collectDocs, collectStaticFiles, computeRelPaths, createImageCollector, hasMarkdownPlugin, normalizeColors, normalizeCopyPage, normalizeDocGroups, normalizeMenu, normalizeMeta, normalizePageNav, normalizePlayground, normalizeSectionOrder, normalizeStaticFilesConfig, outputSourceFilesEnabled, overlayDocs, publish, readStaticFilesConfig, resolveDocImages, resolveDocletImages, resolveFavicon, resolveFooter, resolveTutorialImages, sourceLinkToCommentEnabled, staticFileIncluded, staticFileOutputName };