boltdocs 3.3.6 → 3.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.
Files changed (116) hide show
  1. package/dist/{adapters-BKzKe2mO.mjs → adapters-BXiBWAKs.mjs} +1 -1
  2. package/dist/{adapters-DwDTQoCG.cjs → adapters-Czl3WtQt.cjs} +1 -1
  3. package/dist/{build-CxT38vPv.cjs → build-CNkXRdk8.cjs} +1 -1
  4. package/dist/{build-BJnL-FHG.mjs → build-CqUBsXVC.mjs} +1 -1
  5. package/dist/client/index.cjs +223 -51
  6. package/dist/client/index.d.cts +3 -3
  7. package/dist/client/index.d.ts +3 -3
  8. package/dist/client/index.js +226 -56
  9. package/dist/client/mdx.cjs +1 -1
  10. package/dist/client/mdx.js +1 -1
  11. package/dist/client/primitives.cjs +5 -5
  12. package/dist/client/primitives.d.cts +53 -34
  13. package/dist/client/primitives.d.ts +62 -43
  14. package/dist/client/primitives.js +4 -4
  15. package/dist/client/router.cjs +1 -1
  16. package/dist/client/router.d.cts +1 -1
  17. package/dist/client/router.d.ts +1 -1
  18. package/dist/client/router.js +1 -1
  19. package/dist/client/theme/reset.css +41 -0
  20. package/dist/{config-BJp3lGzE.cjs → config-B3SEoVjG.cjs} +2 -2
  21. package/dist/{config-BC_qhXws.cjs → config-Bfakeadu.cjs} +1 -1
  22. package/dist/{config-B3_iVsbi.mjs → config-CTcfF-0c.mjs} +2 -2
  23. package/dist/dev-D1DmOSjn.mjs +6 -0
  24. package/dist/dev-DH6cSge8.cjs +6 -0
  25. package/dist/{docs-layout-D3Fmb0Wd.js → docs-layout-CmntYM6p.js} +33 -33
  26. package/dist/{docs-layout-SgphExoE.cjs → docs-layout-DIgxJ5c7.cjs} +9 -9
  27. package/dist/{doctor-BqxOFRt3.cjs → doctor-BLxm2alc.cjs} +1 -1
  28. package/dist/{doctor-TS3JGNEU.cjs → doctor-Dd-JMTRo.cjs} +1 -1
  29. package/dist/{doctor-Cv5lXnay.mjs → doctor-DogHujrP.mjs} +1 -1
  30. package/dist/{image-Bkx85rsq.cjs → image-Bke2ojW1.cjs} +3 -3
  31. package/dist/{image-BAiDReNd.js → image-CaY2w0ua.js} +2 -1
  32. package/dist/index--xbYbT8N.d.ts +343 -0
  33. package/dist/{index-B1Mx0dHl.d.ts → index-B_o5y34l.d.cts} +89 -10
  34. package/dist/{index-DLaHgD-i.d.cts → index-Bx0CUd7Q.d.ts} +89 -10
  35. package/dist/index-RK7W_Fxy.d.cts +343 -0
  36. package/dist/{link-q1qHNGK_.js → link-CSe_oD8Y.js} +86 -113
  37. package/dist/{link-hLWOsx0x.cjs → link-Xb69Oy2F.cjs} +87 -143
  38. package/dist/{mdx-Qi0DmaY8.cjs → mdx-BCOrMd-P.cjs} +68 -16
  39. package/dist/{mdx-CJGWzBGy.js → mdx-BijiEbkp.js} +62 -15
  40. package/dist/{native-nLA4Jr0T.cjs → native-BbtRkce5.cjs} +1 -1
  41. package/dist/node/cli-entry.cjs +1 -1
  42. package/dist/node/cli-entry.mjs +1 -1
  43. package/dist/node/highlight.d.cts +2 -2
  44. package/dist/node/highlight.d.mts +2 -2
  45. package/dist/node/index.cjs +1 -1
  46. package/dist/node/index.d.cts +18 -39
  47. package/dist/node/index.d.mts +19 -40
  48. package/dist/node/index.mjs +1 -1
  49. package/dist/node/mdx/shiki-adapter.d.cts +1 -1
  50. package/dist/node/mdx/shiki-adapter.d.mts +1 -1
  51. package/dist/node-BgiLCa0I.cjs +39 -0
  52. package/dist/node-Da3tYBHo.mjs +39 -0
  53. package/dist/{package-Bah2tHjK.cjs → package-D1gVs5gQ.cjs} +1 -1
  54. package/dist/{package-D6bf68FR.mjs → package-YgQJn3Yh.mjs} +1 -1
  55. package/dist/pages-external-B_r6gvqP.cjs +6 -0
  56. package/dist/pages-external-jmK7AHaO.mjs +6 -0
  57. package/dist/{parser-CD8Oo8qh.mjs → parser-CvNZc5s3.mjs} +1 -1
  58. package/dist/{parser-vPaKvzLp.cjs → parser-DJLWTiO-.cjs} +1 -1
  59. package/dist/plugin-DW9K2fW5.mjs +69 -0
  60. package/dist/plugin-NwGKyTJX.cjs +69 -0
  61. package/dist/{plugin-context-b5qVVQSU.mjs → plugin-context-COh-cbsW.mjs} +1 -1
  62. package/dist/{plugin-context-BZs5lvDu.cjs → plugin-context-FIHaWn6r.cjs} +1 -1
  63. package/dist/{plugin-lifecycle-s89gzTlh.cjs → plugin-lifecycle-D9fTRaWY.cjs} +1 -1
  64. package/dist/{registry-B8pt41zj.d.cts → registry-BFmzj1yg.d.mts} +1 -1
  65. package/dist/{registry-BrrH2X9c.d.mts → registry-BoswPzYV.d.cts} +1 -1
  66. package/dist/{resolve-C5rT6B21.mjs → resolve-5puUe7eS.mjs} +1 -1
  67. package/dist/{resolve-BelytNYR.cjs → resolve-CF4ZLfqx.cjs} +1 -1
  68. package/dist/route-paths-B6ocUfNY.cjs +6 -0
  69. package/dist/route-paths-DyDji4bX.mjs +6 -0
  70. package/dist/{router-CZBxMRAH.js → router-B5e8k4qK.js} +175 -10
  71. package/dist/{router-C3kygdRK.cjs → router-DKC0Lu0n.cjs} +204 -9
  72. package/dist/{routes-Dq_2EUIB.cjs → routes-D55M8UrH.cjs} +1 -1
  73. package/dist/{routes-CzhKOw67.cjs → routes-DdE6Lfcl.cjs} +1 -1
  74. package/dist/{routes-Dw6g0bfF.mjs → routes-_I_8PQYF.mjs} +1 -1
  75. package/dist/{search-dialog-CguKVtUu.cjs → search-dialog-BOQRHKTb.cjs} +53 -20
  76. package/dist/{search-dialog-mYnqU4v7.js → search-dialog-BXil4_7P.js} +57 -24
  77. package/dist/{search-dialog-BYZS9aeO.cjs → search-dialog-CwlBd-Mu.cjs} +5 -5
  78. package/dist/{search-dialog-DQwod5Xc.js → search-dialog-D3Obh3eA.js} +1 -1
  79. package/dist/{search-dialog-DzObE-Ar.js → search-dialog-DeplpVEB.js} +3 -3
  80. package/dist/{search-dialog-QgKRRbsI.cjs → search-dialog-cHXR5zhL.cjs} +1 -1
  81. package/dist/server/index.cjs +1 -1
  82. package/dist/server/index.d.mts +1 -1
  83. package/dist/server/index.mjs +1 -1
  84. package/dist/ssg-static-options-Br1_u9qp.mjs +6 -0
  85. package/dist/ssg-static-options-CVvGKM8i.cjs +6 -0
  86. package/dist/types-58Ac3UGI.d.cts +114 -0
  87. package/dist/types-BwnGf-1E.d.mts +114 -0
  88. package/dist/{virtual-modules-C3S3Nz8r.cjs → virtual-modules-C4-qxFlL.cjs} +1 -1
  89. package/dist/{virtual-modules-CaxqrFd6.mjs → virtual-modules-DiWUKJGP.mjs} +1 -1
  90. package/package.json +5 -3
  91. package/src/shared/types.ts +133 -987
  92. package/dist/dev-46NiL0MC.cjs +0 -6
  93. package/dist/dev-C4kjO5xs.mjs +0 -6
  94. package/dist/index-CgWkOCCn.d.cts +0 -1193
  95. package/dist/index-CuNSD3E2.d.ts +0 -1193
  96. package/dist/node-7Cfw6nMr.cjs +0 -23
  97. package/dist/node-CT2E84nY.mjs +0 -23
  98. package/dist/pages-external-BBw8ObVK.mjs +0 -6
  99. package/dist/pages-external-DPiPFxxP.cjs +0 -6
  100. package/dist/plugin-AgNI3ktz.cjs +0 -69
  101. package/dist/plugin-BAv_pYLt.mjs +0 -69
  102. package/dist/types-74i_xUe2.d.mts +0 -975
  103. package/dist/types-X_Pwk8Cg.d.cts +0 -975
  104. /package/dist/{audit-CMc_ydRr.mjs → audit-CYAkXXvP.mjs} +0 -0
  105. /package/dist/{audit-CHkGiV3c.cjs → audit-DxCZZTuX.cjs} +0 -0
  106. /package/dist/{csp-BiGAG8aF.cjs → csp-B-gc2Iha.cjs} +0 -0
  107. /package/dist/{csp-D0BOH8ae.mjs → csp-f8DOcI_7.mjs} +0 -0
  108. /package/dist/{generator-BCrZL53x.cjs → generator-CBAPKY6r.cjs} +0 -0
  109. /package/dist/{generator-CFukoGa0.mjs → generator-MRpn-yp6.mjs} +0 -0
  110. /package/dist/{handler-Lex5DbvG.mjs → handler-DBZqoWt2.mjs} +0 -0
  111. /package/dist/{handler-Ch-Q9NAB.cjs → handler-ryZR9Q41.cjs} +0 -0
  112. /package/dist/{index-HAwIo4nZ.d.mts → index-CPr34I2C.d.mts} +0 -0
  113. /package/dist/{native-BYKMke79.mjs → native-DZ6WMwjG.mjs} +0 -0
  114. /package/dist/{native-BOet8hpE.cjs → native-DeKxny_T.cjs} +0 -0
  115. /package/dist/{update-check-BXD1atVv.mjs → update-check-BXx8te9F.mjs} +0 -0
  116. /package/dist/{update-check-DFQZyoSU.cjs → update-check-CiIeC7CX.cjs} +0 -0
@@ -1,84 +1,130 @@
1
+ import type { IncomingMessage, ServerResponse } from 'node:http'
1
2
  import type { AliasOptions, Plugin as VitePlugin, UserConfig } from 'vite'
2
3
  import type { ComponentType } from 'react'
3
-
4
- /**
5
- * Metadata representing a single documentation route.
6
- * This information is used to build the client-side router and the sidebar navigation.
7
- */
8
- export interface RouteMeta {
9
- /** The final URL path for the route (e.g., '/docs/guide/start') */
10
- path: string
11
- /** The absolute filesystem path to the source markdown/mdx file */
12
- componentPath: string
13
- /** The title of the page, usually extracted from frontmatter or the filename */
14
- title: string
15
- /** The relative path from the docs directory, used for edit links */
16
- filePath: string
17
- /** Optional description of the page (for SEO/meta tags) */
18
- description?: string
19
- /** Optional explicit position for ordering in the sidebar */
20
- sidebarPosition?: number
21
- /** The group (directory) this route belongs to */
22
- group?: string
23
- /** The display title for the route's group */
24
- groupTitle?: string
25
- /** Optional explicit position for ordering the group itself */
26
- groupPosition?: number
27
- /** Optional icon for the route's group */
28
- groupIcon?: string
29
- /** The sub-route group this route belongs to (from folders starting with _) */
30
- subRouteGroup?: string
31
- /** Extracted markdown headings for search indexing */
32
- headings?: { level: number; text: string; id: string }[]
33
- /** The locale this route belongs to, if i18n is configured */
34
- locale?: string
35
- /** The version this route belongs to, if versioning is configured */
36
- version?: string
37
- /** Optional badge to display next to the sidebar item (e.g., 'New', 'Experimental') */
38
- badge?: BadgeValue
39
- /** Optional icon to display (Lucide icon name or raw SVG) */
40
- icon?: string
41
- /** The tab this route belongs to, if tabs are configured */
42
- tab?: string
43
- /** The collection this route belongs to (from [name] directories like [blog]) */
44
- collection?: string
45
- /** Tags for blog posts or other taxonomy */
46
- tags?: string[]
47
- /** Author identifier for blog posts */
48
- author?: string
49
- /** Draft flag — excluded from production builds */
50
- draft?: boolean
51
- /** Feature flags required for this page to be visible */
52
- featureFlags?: string[]
53
- /** Short excerpt/summary for list displays */
54
- excerpt?: string
55
- /** Cover image for blog posts */
56
- coverImage?: string
57
- /** The extracted plain-text content of the page for search indexing */
58
- _content?: string
59
- /** The raw markdown content of the page */
60
- _rawContent?: string
61
- /** Extracted SEO and Open Graph metadata from frontmatter */
62
- seo?: Record<string, unknown>
63
- /** The publication date */
64
- date?: string | Date
65
- /** The last updated timestamp or date */
66
- lastUpdated?: string | number | Date
67
- /** Optional category for the page */
68
- category?: string
69
- /** Optional explicit order (alternative to sidebarPosition) */
70
- order?: number
71
- /** Optional explicit label for the sidebar */
72
- sidebarLabel?: string
73
- /** Whether the page is hidden from the sidebar */
74
- sidebarHidden?: boolean
75
- /** Raw extensible frontmatter data for custom components and formatters */
76
- frontmatter?: Record<string, unknown>
77
- /** Optional recursive child routes for deep sidebar hierarchies */
78
- subRoutes?: RouteMeta[]
79
- /** Clean URL segments stripped of locale/version prefixes */
80
- slugParts?: string[]
81
- }
4
+ import type {
5
+ BoltdocsConfigContract,
6
+ CodeHighlightConfig,
7
+ CodeTheme,
8
+ IPluginLifecycleManager as ContractIPluginLifecycleManager,
9
+ PluginContext as ContractPluginContext,
10
+ PluginCssDefinition as ContractPluginCssDefinition,
11
+ PluginDefinition as ContractPluginDefinition,
12
+ PluginLifecycleHooks as ContractPluginLifecycleHooks,
13
+ PluginMiddlewareAPI as ContractPluginMiddlewareAPI,
14
+ PluginServerAPI as ContractPluginServerAPI,
15
+ PluginServerMiddleware as ContractPluginServerMiddleware,
16
+ PluginTransformMiddleware as ContractPluginTransformMiddleware,
17
+ } from '@bdocs/contracts'
18
+
19
+ export type {
20
+ BadgeValue,
21
+ BoltdocsAlgoliaConfig,
22
+ BoltdocsCollectionsConfig,
23
+ BoltdocsConfigContract,
24
+ BoltdocsCustomFeedbackConfig,
25
+ BoltdocsDraftsConfig,
26
+ BoltdocsExperimentalConfig,
27
+ BoltdocsGA4Config,
28
+ BoltdocsGTMConfig,
29
+ BoltdocsGiscusConfig,
30
+ BoltdocsI18nConfig,
31
+ BoltdocsIntegrationsConfig,
32
+ BoltdocsLocaleConfig,
33
+ BoltdocsMdxConfig,
34
+ BoltdocsPostHogConfig,
35
+ BoltdocsRobotsConfig,
36
+ BoltdocsSecurityConfig,
37
+ BoltdocsSeoConfig,
38
+ BoltdocsSsgConfig,
39
+ BoltdocsUiSlot,
40
+ BoltdocsVercelConfig,
41
+ BoltdocsVerificationConfig,
42
+ BoltdocsVersionConfig,
43
+ BoltdocsVersionsConfig,
44
+ BoltdocsViewTransitionsConfig,
45
+ ChainSignal,
46
+ CodeHighlightConfig,
47
+ CodeHighlighterAdapter,
48
+ CodeHighlighterEngine,
49
+ CodeHighlighterRuntime,
50
+ CodeTheme,
51
+ DiagnosticRecord,
52
+ ExperimentalViewTransitions,
53
+ ExternalFileRoute,
54
+ JsonLdObject,
55
+ JsonLdPrimitive,
56
+ JsonLdValue,
57
+ ParsedMetaLike,
58
+ PluginCachesAPI,
59
+ PluginClientConfig,
60
+ PluginCssDefinition,
61
+ PluginDefinition,
62
+ PluginDiagnosticsAPI,
63
+ PluginHmrAPI,
64
+ PluginHmrEvent,
65
+ PluginHeadEntry,
66
+ PluginLogger,
67
+ PluginMemoryCacheAPI,
68
+ PluginMeta,
69
+ PluginPathsAPI,
70
+ PluginRoutesCacheAPI,
71
+ PluginStore,
72
+ PluginTransformCacheAPI,
73
+ PluginVirtualModulesAPI,
74
+ RedirectConfig,
75
+ RedirectStatus,
76
+ RegisteredVirtualModule,
77
+ RouteHeading,
78
+ RouteMeta,
79
+ SearchDocument,
80
+ StructuredData,
81
+ TransformHtmlParams,
82
+ TransformResult,
83
+ TransformSourceParams,
84
+ } from '@bdocs/contracts'
85
+
86
+ export type PluginServerMiddleware = ContractPluginServerMiddleware<
87
+ IncomingMessage,
88
+ ServerResponse
89
+ >
90
+
91
+ export interface PluginServerAPI
92
+ extends ContractPluginServerAPI<IncomingMessage, ServerResponse> {}
93
+
94
+ export interface PluginMiddlewareAPI
95
+ extends ContractPluginMiddlewareAPI<
96
+ BoltdocsConfig,
97
+ IncomingMessage,
98
+ ServerResponse
99
+ > {}
100
+
101
+ export interface PluginContext
102
+ extends ContractPluginContext<
103
+ BoltdocsConfig,
104
+ IncomingMessage,
105
+ ServerResponse
106
+ > {}
107
+
108
+ export interface PluginLifecycleHooks
109
+ extends ContractPluginLifecycleHooks<
110
+ BoltdocsConfig,
111
+ IncomingMessage,
112
+ ServerResponse
113
+ > {}
114
+
115
+ export interface PluginTransformMiddleware
116
+ extends ContractPluginTransformMiddleware<
117
+ BoltdocsConfig,
118
+ IncomingMessage,
119
+ ServerResponse
120
+ > {}
121
+
122
+ export interface IPluginLifecycleManager
123
+ extends ContractIPluginLifecycleManager<
124
+ BoltdocsConfig,
125
+ IncomingMessage,
126
+ ServerResponse
127
+ > {}
82
128
 
83
129
  /**
84
130
  * Represents a single social link in the configuration.
@@ -149,76 +195,6 @@ export interface BoltdocsThemeConfig {
149
195
  codeHighlighting?: CodeHighlightConfig | string
150
196
  }
151
197
 
152
- /**
153
- * An engine-agnostic theme: either a single theme name or a light/dark pair.
154
- */
155
- export type CodeTheme = string | { light: string; dark: string }
156
-
157
- /**
158
- * Runtime produced by a {@link CodeHighlighterAdapter} after initialization.
159
- */
160
- export interface CodeHighlighterRuntime {
161
- codeToHast(code: string, options: Record<string, unknown>): unknown
162
- codeToHtml(code: string, options: Record<string, unknown>): Promise<string>
163
- }
164
-
165
- /**
166
- * The SPI every highlighting engine must implement. Build the highlighter
167
- * lazily via {@link CodeHighlighterAdapter.initialize} (never on module load)
168
- * so unused engines cost nothing and the core stays engine-agnostic.
169
- */
170
- export interface CodeHighlighterAdapter {
171
- /** Registry id, emitted as `data-code-engine` on rendered `<pre>` blocks. */
172
- name: string
173
- version?: string
174
- /** Assemble engine options for a code block (theme, transformers, meta...). */
175
- getOptions(lang: string, meta: ParsedMetaLike): Record<string, unknown>
176
- /** Create (or reuse) the highlighter runtime for this adapter. */
177
- initialize(): Promise<CodeHighlighterRuntime>
178
- /** Ensure a language grammar/capability is loaded before rendering. */
179
- ensureLanguage?(lang: string): Promise<boolean>
180
- /** Warm the highlighter off the critical path (background, never awaited). */
181
- prewarm?(options?: Record<string, unknown>): void | Promise<void>
182
- }
183
-
184
- /**
185
- * Minimal structural view of `ParsedMeta` so `shared/types.ts` (bundled to
186
- * the client) does not depend on `@bdocs/unist-utils`. The framework's
187
- * canonical implementation lives in `@bdocs/unist-utils`.
188
- */
189
- export interface ParsedMetaLike {
190
- title?: string
191
- lineNumbers?: boolean
192
- wordWrap?: boolean
193
- __raw?: string
194
- [key: string]: unknown
195
- }
196
-
197
- /**
198
- * How to select a highlighting engine:
199
- * - `string` → registry id (e.g. `'shiki'`, or a plugin-provided engine name)
200
- * - `CodeHighlighterAdapter` → used directly
201
- * - `() => CodeHighlighterAdapter | Promise<...>` → factory resolved on demand
202
- */
203
- export type CodeHighlighterEngine =
204
- | string
205
- | CodeHighlighterAdapter
206
- | ((
207
- api: CodeHighlightConfig,
208
- ) => CodeHighlighterAdapter | Promise<CodeHighlighterAdapter>)
209
-
210
- /**
211
- * Engine-agnostic configuration for markdown code highlighting.
212
- */
213
- export interface CodeHighlightConfig {
214
- /** Engine selector. Defaults to the built-in `'shiki'` engine. */
215
- engine?: CodeHighlighterEngine
216
- /** Single theme name or a light/dark pair. */
217
- theme?: CodeTheme
218
- /** Engine-specific options (e.g. `{ regexEngine: 'oniguruma' | 'javascript' }` for Shiki). */
219
- options?: Record<string, unknown>
220
- }
221
-
222
198
  /**
223
199
  * List of supported syntax highlighting themes.
224
200
  */
@@ -231,858 +207,28 @@ export type ShikiTheme =
231
207
  | 'one-dark-pro'
232
208
  | 'one-light'
233
209
 
234
- /**
235
- * Configuration for the robots.txt file.
236
- */
237
- export type BoltdocsRobotsConfig =
238
- | string
239
- | {
240
- rules?: Array<{
241
- userAgent: string
242
- allow?: string | string[]
243
- disallow?: string | string[]
244
- }>
245
- sitemaps?: string[]
246
- }
247
-
248
- /**
249
- * Configuration for a specific locale.
250
- */
251
- export interface BoltdocsLocaleConfig {
252
- label?: string
253
- direction?: 'ltr' | 'rtl'
254
- htmlLang?: string
255
- calendar?: string
256
- }
257
-
258
- /**
259
- * Configuration for internationalization (i18n).
260
- */
261
- export interface BoltdocsI18nConfig {
262
- defaultLocale: string
263
- locales: string[] | Record<string, string>
264
- localeConfigs?: Record<string, BoltdocsLocaleConfig>
265
- }
266
-
267
- /**
268
- * Configuration for a specific documentation version.
269
- */
270
- export interface BoltdocsVersionConfig {
271
- label: string
272
- path: string
273
- }
274
-
275
- /**
276
- * Configuration for content collections (e.g. blog posts, changelog)
277
- * declared in `boltdocs.config.ts`. Each entry maps a directory name
278
- * (e.g. `[blog]`) to its display + ordering settings.
279
- */
280
- export interface BoltdocsCollectionsConfig {
281
- /**
282
- * Map of collection id (matches the bracketed directory name) to
283
- * its display label. Falls back to the id when a label is missing.
284
- */
285
- labels?: Record<string, string | Record<string, string>>
286
- /**
287
- * Map of collection id to a numeric position used for sidebar ordering.
288
- * Collections with no explicit position are sorted last.
289
- */
290
- positions?: Record<string, number>
291
- /**
292
- * Items-per-page for paginated collection routes (e.g. blog indexes).
293
- * Falls back to the framework default (10) when omitted.
294
- */
295
- postsPerPage?: number
296
- /**
297
- * Default collection ID used by collection routing when no collection
298
- * is explicitly referenced. Defaults to `'blog'`.
299
- */
300
- defaultCollection?: string
301
- /**
302
- * Date format string for rendering post dates in listing pages.
303
- * Defaults to `'MMMM dd, yyyy'`.
304
- */
305
- dateFormat?: string
306
- /**
307
- * Field used to sort posts within a collection.
308
- * Defaults to `'date'`.
309
- */
310
- sortBy?: 'date' | 'title' | 'sidebarPosition'
311
- }
312
-
313
- /**
314
- * Configuration for documentation versioning.
315
- */
316
- export interface BoltdocsVersionsConfig {
317
- defaultVersion: string
318
- prefix?: string
319
- versions: BoltdocsVersionConfig[]
320
- }
321
-
322
- /**
323
- * Shared badge value type used in frontmatter, RouteMeta, and ComponentRoute.
324
- */
325
- export type BadgeValue = string | { text: string; expires?: string }
326
-
327
- /**
328
- * Context provided to plugin lifecycle hooks.
329
- */
330
- export interface PluginContext {
331
- readonly config: BoltdocsConfig
332
- readonly logger: PluginLogger
333
- readonly store: PluginStore
334
- readonly meta: PluginMeta
335
- readonly docsDir: string
336
- readonly rootDir: string
337
- readonly outDir: string
338
- readonly routes: RouteMeta[]
339
- /** Namespaced cache helpers bound to the core's cache machinery. */
340
- readonly caches: PluginCachesAPI
341
- /** Structured diagnostics channel; reports can be drained via `list()`. */
342
- readonly diagnostics: PluginDiagnosticsAPI
343
- /** Helpers for resolving paths inside the workspace safely. */
344
- readonly paths: PluginPathsAPI
345
- /** Declare virtual modules the core should expose to Vite. */
346
- readonly virtualModules: PluginVirtualModulesAPI
347
- /** Register and query transform middleware at runtime. */
348
- readonly middleware: PluginMiddlewareAPI
349
- /**
350
- * Hook into dev-server file watching and send custom HMR events
351
- * to connected clients.
352
- */
353
- readonly hmr: PluginHmrAPI
354
- /**
355
- * Register HTTP middleware and server lifecycle hooks without
356
- * writing a Vite plugin.
357
- */
358
- readonly server: PluginServerAPI
359
- }
360
-
361
- /**
362
- * Functional cache helpers exposed through `PluginContext.caches`.
363
- *
364
- * Plugin authors do not get a reference to the raw `TransformCache` /
365
- * `FileCache` instances — those stay encapsulated in core. The methods
366
- * returned here are bound to namespaced keys so two plugins cannot
367
- * collide.
368
- */
369
- export interface PluginCachesAPI {
370
- /** Sharded, hash-keyed cache. One namespace per plugin recommended. */
371
- transform(namespace: string): PluginTransformCacheAPI
372
- /** Routes cache wrapper around the parsed-doc cache. */
373
- routes: PluginRoutesCacheAPI
374
- /** In-memory LRU cache keyed by namespace + plugin-supplied key. */
375
- memory<V = unknown>(
376
- namespace: string,
377
- opts?: { max?: number; ttl?: number },
378
- ): PluginMemoryCacheAPI<V>
379
- }
380
-
381
- export interface PluginTransformCacheAPI {
382
- /** Async read — first call may warm from disk if the entry was evicted. */
383
- get(key: string): Promise<string | null>
384
- /** Synchronous write that batches a background disk flush. */
385
- set(key: string, value: string): void
386
- /** Force-flush background writes. Call before measuring disk state. */
387
- flush(): Promise<void>
388
- }
389
-
390
- export interface PluginRoutesCacheAPI {
391
- /** Read a parsed `RouteMeta` (and its private `_content` blob) by abs file path. */
392
- get(filePath: string): RouteMeta | null
393
- /** Write a parsed route entry. Caller assumptions match `docCache.set`. */
394
- set(filePath: string, route: RouteMeta): void
395
- /** Invalidate one route. Use when content changes. */
396
- invalidate(filePath: string): void
397
- /** Clear every cached route. Use when the directory layout changes. */
398
- invalidateAll(): void
399
- }
400
-
401
- export interface PluginMemoryCacheAPI<V> {
402
- get(key: string): V | undefined
403
- set(key: string, value: V): void
404
- has(key: string): boolean
405
- }
406
-
407
- /**
408
- * Plugin diagnostics API.
409
- *
410
- * Plugins push structured records instead of spamming the logger; downstream
411
- * tools (dev-server overlay, CI reporters, IDE plugins) drain the queue via
412
- * `list()`.
413
- */
414
- export interface DiagnosticRecord {
415
- readonly id: number
416
- readonly severity: 'info' | 'warn' | 'error'
417
- readonly code: string
418
- readonly message: string
419
- readonly pluginName: string
420
- readonly filePath?: string
421
- readonly routePath?: string
422
- readonly time: Date
423
- }
424
-
425
- export interface PluginDiagnosticsAPI {
426
- report(
427
- severity: DiagnosticRecord['severity'],
428
- code: string,
429
- message: string,
430
- where?: { filePath?: string; routePath?: string },
431
- ): void
432
- list(): readonly DiagnosticRecord[]
433
- clear(): void
434
- }
435
-
436
- /**
437
- * Path-resolution helpers exposed through `PluginContext.paths`.
438
- *
439
- * Both `resolveDocs` and `resolveAsset` validate the resulting path against
440
- * the workspace boundary and reject any segment that resolves outside the
441
- * docs / project root directories.
442
- */
443
- export interface PluginPathsAPI {
444
- resolveDocs(...parts: string[]): string
445
- resolveAsset(...parts: string[]): string
446
- /**
447
- * Build a `file://` URL for an absolute path inside the workspace.
448
- * Useful for `new URL(import.meta.url)` replacements and image srcsets.
449
- */
450
- safeFileURL(absFilePath: string): string
451
- }
452
-
453
- /**
454
- * Plugin virtual-modules registration.
455
- *
456
- * Plugins call `add(id, loader)` to expose a `virtual:<plugin>/<id>` module
457
- * to Vite without having to author a full Vite plugin. The loader returns
458
- * the module source code as a string; the core wraps it in the right
459
- * `resolveId`/`load` plumbing at Vite build time.
460
- */
461
- export interface RegisteredVirtualModule {
462
- readonly id: string
463
- readonly eager: boolean
464
- readonly loader: () => string | Promise<string>
465
- }
466
-
467
- export interface PluginVirtualModulesAPI {
468
- add(
469
- id: string,
470
- loader: () => string | Promise<string>,
471
- opts?: { eager?: boolean },
472
- ): void
473
- has(id: string): boolean
474
- list(): readonly RegisteredVirtualModule[]
475
- }
476
-
477
- /**
478
- * Logger interface for plugin logging.
479
- */
480
- export interface PluginLogger {
481
- info(message: string): void
482
- warn(message: string): void
483
- error(message: string | Error): void
484
- debug(message: string): void
485
- }
486
-
487
- /**
488
- * Key-value store interface for plugins.
489
- */
490
- export interface PluginStore {
491
- get<T = unknown>(pluginName: string, key: string): T | undefined
492
- set(pluginName: string, key: string, value: unknown): void
493
- has(pluginName: string, key: string): boolean
494
- }
495
-
496
- /**
497
- * Plugin metadata provided in the context.
498
- */
499
- export interface PluginMeta {
500
- name: string
501
- version?: string
502
- boltdocsVersion?: string
503
- }
504
-
505
- /**
506
- * Chain control signal returned by transform hooks. Use with `__signal` in
507
- * the return value to influence the middleware chain:
508
- *
509
- * - `'skip'`: stop processing this hook for the current file (remaining
510
- * plugins in the chain still run).
511
- * - `'break'`: stop the entire chain immediately — no further plugin's
512
- * transform hooks run for this file.
513
- *
514
- * @example
515
- * ```ts
516
- * transformMdx: async (_ctx, { code }) => ({
517
- * code: code.replace(/foo/g, 'bar'),
518
- * __signal: 'skip', // skip remaining plugins
519
- * })
520
- * ```
521
- */
522
- export type ChainSignal = 'skip' | 'break'
523
-
524
- /**
525
- * Returned by a transform hook that wants to signal the chain. The `__signal`
526
- * field is optional — most hooks will just return `{ code: string }` and the
527
- * chain continues normally. When `__signal` is present, `runChain` reacts:
528
- *
529
- * - `'skip'` continues with the next plugin, but passes the **original params**
530
- * (the output of this hook is discarded).
531
- * - `'break'` stops the chain immediately.
532
- *
533
- * @template T The params shape (e.g. `{ code: string; filePath: string }`).
534
- */
535
- export type TransformResult<T> = T & { __signal?: ChainSignal }
536
-
537
- /**
538
- * Enriched params passed to `transformSource` and `transformMdx`. The `code`
539
- * and `filePath` fields are always present. The optional `frontmatter` and
540
- * `route` fields are populated when available (they are `undefined` in the
541
- * early pipeline where frontmatter hasn't been parsed yet).
542
- */
543
- export interface TransformSourceParams {
544
- /** The raw or compiled code (source before MDX / JS after MDX). */
545
- code: string
546
- /** Absolute file path of the source document. */
547
- filePath: string
548
- /** Parsed frontmatter, if available. `undefined` in very early pipeline. */
549
- frontmatter?: Record<string, unknown>
550
- }
551
-
552
- /**
553
- * Enriched params passed to `transformHtml`. The `html` and `path` fields
554
- * are always present. The optional `route` carries the generated `RouteMeta`
555
- * for richer context (locale, version, collection, etc.).
556
- */
557
- export interface TransformHtmlParams {
558
- /** The rendered HTML string for this page. */
559
- html: string
560
- /** The route path (e.g. `/docs/guides/start`). */
561
- path: string
562
- /** The route metadata for the page, if available. */
563
- route?: RouteMeta
564
- }
565
-
566
- /**
567
- * Plugin transform middleware. Each middleware runs in the transform
568
- * pipeline alongside lifecycle hooks. The `name` field is optional —
569
- * when omitted, the owning plugin's name is used as context.
570
- * Middleware runs in `enforce` order (pre → normal → post) and supports
571
- * `__signal: 'skip'` / `__signal: 'break'` for chain control.
572
- */
573
- export interface PluginTransformMiddleware {
574
- /** Optional name. Defaults to the owning plugin's name for diagnostics. */
575
- name?: string
576
- enforce?: 'pre' | 'post'
577
- transformSource?: (
578
- ctx: PluginContext,
579
- params: TransformSourceParams,
580
- ) =>
581
- | TransformResult<{ code: string }>
582
- | Promise<TransformResult<{ code: string }>>
583
- transformMdx?: (
584
- ctx: PluginContext,
585
- params: TransformSourceParams,
586
- ) =>
587
- | TransformResult<{ code: string }>
588
- | Promise<TransformResult<{ code: string }>>
589
- transformHtml?: (
590
- ctx: PluginContext,
591
- params: TransformHtmlParams,
592
- ) =>
593
- | TransformResult<{ html: string }>
594
- | Promise<TransformResult<{ html: string }>>
595
- }
596
-
597
- /**
598
- * Plugin middleware registry API exposed through `PluginContext.middleware`.
599
- * Plugins can register named middleware entries from lifecycle hooks.
600
- */
601
- export interface PluginMiddlewareAPI {
602
- add(middleware: PluginTransformMiddleware): void
603
- remove(name: string): void
604
- has(name: string): boolean
605
- list(): readonly PluginTransformMiddleware[]
606
- }
607
-
608
- /**
609
- * HMR event types plugins can listen to.
610
- */
611
- export type PluginHmrEvent = 'add' | 'change' | 'unlink'
612
-
613
- /**
614
- * Plugin HMR API — hook into file-watching events and send custom
615
- * HMR messages to connected clients.
616
- */
617
- export interface PluginHmrAPI {
618
- /**
619
- * Register a callback for file events scoped to the docs directory.
620
- * The callback receives the normalized file path and event type.
621
- */
622
- onFileEvent(
623
- eventType: PluginHmrEvent,
624
- handler: (filePath: string) => void | Promise<void>,
625
- ): void
626
- /** Shorthand for `onFileEvent('add', handler)`. */
627
- onFileAdd(handler: (filePath: string) => void | Promise<void>): void
628
- /** Shorthand for `onFileEvent('change', handler)`. */
629
- onFileChange(handler: (filePath: string) => void | Promise<void>): void
630
- /** Shorthand for `onFileEvent('unlink', handler)`. */
631
- onFileUnlink(handler: (filePath: string) => void | Promise<void>): void
632
- /**
633
- * Send a custom HMR event to all connected clients.
634
- * The client can listen with `import.meta.hot.on('boltdocs:plugin:<name>', ...)`.
635
- */
636
- send(event: string, data?: unknown): void
637
- }
638
-
639
- /**
640
- * Plugin Server API — register HTTP middleware and lifecycle hooks
641
- * for the dev server and preview server, without writing a Vite plugin.
642
- */
643
- export interface PluginServerAPI {
644
- /**
645
- * Register a Connect-style middleware function.
646
- * Runs on both dev and preview servers.
647
- */
648
- use(middleware: PluginServerMiddleware): void
649
- /**
650
- * Register a middleware scoped to a specific path prefix.
651
- * Only requests starting with `path` trigger the handler.
652
- */
653
- useAt(path: string, handler: PluginServerMiddleware): void
654
- /** Called when the dev/preview server starts (once per process). */
655
- onStart(callback: () => void | Promise<void>): void
656
- /** Called when the server shuts down (cleanup). */
657
- onEnd(callback: () => void | Promise<void>): void
658
- }
659
-
660
- /**
661
- * Connect-style middleware signature.
662
- */
663
- export type PluginServerMiddleware = (
664
- req: import('http').IncomingMessage,
665
- res: import('http').ServerResponse,
666
- next: (err?: unknown) => void,
667
- ) => void | Promise<void>
668
-
669
- /**
670
- * Public API surface of the core plugin lifecycle manager.
671
- *
672
- * This is exposed as an interface so that plugin authors and internal
673
- * subsystems can receive a reference to the lifecycle manager without
674
- * pulling in the concrete class (which has private members and is not
675
- * stable across source/dist boundaries during development).
676
- */
677
- export interface IPluginLifecycleManager {
678
- runHook(
679
- hookName: keyof PluginLifecycleHooks,
680
- ...args: unknown[]
681
- ): Promise<void>
682
- runChain<TParams extends Record<string, unknown>>(
683
- hookName: keyof PluginLifecycleHooks,
684
- initialParams: TParams,
685
- ): Promise<TParams>
686
- runMiddlewareChain<TParams extends Record<string, unknown>>(
687
- hookName: 'transformSource' | 'transformMdx' | 'transformHtml',
688
- initialParams: TParams,
689
- ): Promise<TParams>
690
- hasHook(
691
- hookName:
692
- | keyof PluginLifecycleHooks
693
- | 'transformSource'
694
- | 'transformMdx'
695
- | 'transformHtml',
696
- ): boolean
697
- }
698
-
699
- /**
700
- * Standardized Search Document contract passed to search plugins.
701
- */
702
- export interface SearchDocument {
703
- id: string
704
- path: string
705
- title: string
706
- content: string
707
- headings: Array<{ level: number; text: string; id: string }>
708
- frontmatter: Record<string, unknown>
709
- locale?: string
710
- version?: string
711
- }
712
-
713
- /**
714
- * Agnostic UI slots for component injection.
715
- */
716
- export type BoltdocsUiSlot =
717
- | 'search:dialog'
718
- | 'header:left'
719
- | 'header:right'
720
- | 'sidebar:top'
721
- | 'sidebar:bottom'
722
- | 'page:before'
723
- | 'page:after'
724
- | (string & {})
725
-
726
- export interface PluginHeadEntry {
727
- tag: 'script' | 'link' | 'meta' | 'style'
728
- attrs?: Record<string, string | boolean>
729
- content?: string
730
- }
731
-
732
- /**
733
- * Client-side configuration and UI slot injections for plugins.
734
- */
735
- export interface PluginClientConfig {
736
- /** Dynamic UI slot registrations (mapped to component file paths) */
737
- slots?: Record<string, string>
738
- /** Top-level React provider component file paths */
739
- providers?: string[]
740
- /** MDX component overrides & additions */
741
- mdxComponents?: Record<string, string>
742
- /** Head elements to inject into rendered HTML */
743
- head?: PluginHeadEntry[]
744
- }
745
-
746
- /**
747
- * Plugin lifecycle hooks with full type safety.
748
- */
749
- export interface PluginLifecycleHooks {
750
- /** Build hooks (Astro-style) */
751
- 'build:before'?: (ctx: PluginContext) => Promise<void> | void
752
- 'build:after'?: (ctx: PluginContext) => Promise<void> | void
753
- 'build:end'?: (ctx: PluginContext) => Promise<void> | void
754
- 'build:generate'?: (
755
- ctx: PluginContext,
756
- params: { routes: RouteMeta[]; outDir: string; siteUrl?: string },
757
- ) => void | Promise<void>
758
-
759
- /** Dev hooks (Astro-style) */
760
- 'dev:before'?: (ctx: PluginContext) => Promise<void> | void
761
- 'dev:after'?: (ctx: PluginContext) => Promise<void> | void
762
-
763
- /** Transform hooks (Astro-style) */
764
- 'transform:source'?: (
765
- ctx: PluginContext,
766
- params: TransformSourceParams,
767
- ) =>
768
- | TransformResult<{ code: string }>
769
- | Promise<TransformResult<{ code: string }>>
770
- 'transform:mdx'?: (
771
- ctx: PluginContext,
772
- params: TransformSourceParams,
773
- ) =>
774
- | TransformResult<{ code: string }>
775
- | Promise<TransformResult<{ code: string }>>
776
- 'transform:html'?: (
777
- ctx: PluginContext,
778
- params: TransformHtmlParams,
779
- ) =>
780
- | TransformResult<{ html: string }>
781
- | Promise<TransformResult<{ html: string }>>
782
-
783
- /** Dynamic frontmatter transformation hook */
784
- 'frontmatter:transform'?: (
785
- ctx: PluginContext,
786
- params: {
787
- frontmatter: Record<string, unknown>
788
- filePath: string
789
- rawContent: string
790
- },
791
- ) => Record<string, unknown> | Promise<Record<string, unknown>> | undefined
792
-
793
- /** Fired after routes are crawled, normalized, and resolved */
794
- 'routes:resolved'?: (
795
- ctx: PluginContext,
796
- params: { routes: RouteMeta[] },
797
- ) => RouteMeta[] | Promise<RouteMeta[]> | undefined
798
-
799
- /** Agnostic search index hook: core passes SearchDocument[], plugin returns index payload */
800
- 'search:index'?: (
801
- ctx: PluginContext,
802
- params: { documents: SearchDocument[]; routes: RouteMeta[] },
803
- ) => unknown | Promise<unknown>
804
-
805
- 'server:configure'?: (
806
- ctx: PluginContext,
807
- params: { server: unknown; middleware: PluginServerAPI },
808
- ) => void | Promise<void>
809
-
810
- /** Legacy alias hooks for backwards compatibility */
811
- beforeBuild?: (ctx: PluginContext) => Promise<void> | void
812
- afterBuild?: (ctx: PluginContext) => Promise<void> | void
813
- buildEnd?: (ctx: PluginContext) => Promise<void> | void
814
- beforeDev?: (ctx: PluginContext) => Promise<void> | void
815
- afterDev?: (ctx: PluginContext) => Promise<void> | void
816
- transformSource?: (
817
- ctx: PluginContext,
818
- params: TransformSourceParams,
819
- ) =>
820
- | TransformResult<{ code: string }>
821
- | Promise<TransformResult<{ code: string }>>
822
- transformMdx?: (
823
- ctx: PluginContext,
824
- params: TransformSourceParams,
825
- ) =>
826
- | TransformResult<{ code: string }>
827
- | Promise<TransformResult<{ code: string }>>
828
- transformHtml?: (
829
- ctx: PluginContext,
830
- params: TransformHtmlParams,
831
- ) =>
832
- | TransformResult<{ html: string }>
833
- | Promise<TransformResult<{ html: string }>>
834
- }
835
-
836
- /**
837
- * MDX processor configuration.
838
- * When `processor` is set to 'satteri', the Sätteri Rust-based compiler is used.
839
- */
840
- export interface BoltdocsMdxConfig {
841
- processor?: 'satteri'
842
- }
843
-
844
210
  /**
845
211
  * Defines a Boltdocs plugin.
846
212
  *
847
213
  * Use the `definePlugin()` or `createPlugin()` helper from the node API for full
848
214
  * type safety and access to lifecycle hooks.
849
215
  */
850
- export interface PluginCssConfig {
851
- cssFiles?: string[]
852
- headStyles?: string[]
853
- postcssPlugins?: unknown[]
854
- preprocessorOptions?: Record<string, unknown>
855
- }
216
+ export interface PluginCssConfig extends ContractPluginCssDefinition {}
856
217
 
857
- export interface BoltdocsPlugin {
858
- name: string
859
- enforce?: 'pre' | 'post'
860
- version?: string
861
- boltdocsVersion?: string
862
- remarkPlugins?: unknown[]
863
- rehypePlugins?: unknown[]
218
+ export interface BoltdocsPlugin
219
+ extends ContractPluginDefinition<
220
+ BoltdocsConfig,
221
+ IncomingMessage,
222
+ ServerResponse
223
+ > {
864
224
  vitePlugins?: VitePlugin[]
865
- components?: Record<string, string>
866
- client?: PluginClientConfig
867
- metadata?: Record<string, unknown>
868
- css?: PluginCssConfig
869
- middleware?: PluginTransformMiddleware[]
870
- hooks?: PluginLifecycleHooks
871
- }
872
-
873
- /**
874
- */
875
-
876
- /**
877
- */
878
-
879
- /**
880
- */
881
-
882
- export interface BoltdocsSecurityConfig {
883
- headers?: Record<string, string>
884
- enableCSP?: boolean
885
- customHeaders?: Record<string, string>
886
- }
887
-
888
- export interface BoltdocsVerificationConfig {
889
- google?: string
890
- bing?: string
891
- yandex?: string
892
- pinterest?: string
893
- facebook?: string
894
- }
895
-
896
- /**
897
- * Configuration for SEO.
898
- */
899
- export type JsonLdPrimitive = string | number | boolean | null
900
- export type JsonLdValue = JsonLdPrimitive | JsonLdObject | JsonLdValue[]
901
- export interface JsonLdObject {
902
- [key: string]: JsonLdValue | undefined
903
- }
904
- export type StructuredData = JsonLdObject | JsonLdObject[]
905
-
906
- export interface BoltdocsSeoConfig {
907
- metatags?: Record<string, string>
908
- indexing?: 'all' | 'public'
909
- thumbnails?: {
910
- background?: string
911
- }
912
- verification?: BoltdocsVerificationConfig
913
- /** Global JSON-LD graph emitted in every page head. */
914
- structuredData?: StructuredData
915
- }
916
-
917
- export interface BoltdocsViewTransitionsConfig {
918
- /** Native document transitions are enabled when true. */
919
- enabled?: boolean
920
- /** Optional transition types passed to `document.startViewTransition`. */
921
- types?: string[]
922
- }
923
-
924
- export interface BoltdocsExperimentalConfig {
925
- /** Enables the native View Transition API integration. */
926
- viewTransitions?: boolean | BoltdocsViewTransitionsConfig
927
- /** Enables static file-routing under `docs/pages-external/`. */
928
- fileRouting?: boolean
929
- }
930
-
931
- export type ExperimentalViewTransitions =
932
- | boolean
933
- | BoltdocsViewTransitionsConfig
934
-
935
- export interface ExternalFileRoute {
936
- path: string
937
- filePath: string
938
- kind: 'component' | 'mdx'
939
- /**
940
- * Locale the file provides, derived from a `pages-external/{locale}/`
941
- * directory. Absent for default-locale files.
942
- */
943
- locale?: string
944
- }
945
-
946
- /**
947
- * Configuration for Google Analytics 4 (GA4).
948
- */
949
- export interface BoltdocsGA4Config {
950
- measurementId: string
951
- debug?: boolean
952
- anonymizeIp?: boolean
953
- sendPageView?: boolean
954
- cookieFlags?: string
955
- autoTrack?: {
956
- pageViews?: boolean
957
- downloads?: boolean
958
- externalLinks?: boolean
959
- search?: boolean
960
- }
961
- }
962
-
963
- /**
964
- * Configuration for Google Tag Manager (GTM).
965
- */
966
- export interface BoltdocsGTMConfig {
967
- tagId: string
968
- dataLayerName?: string
969
- preview?: string
970
- }
971
-
972
- /**
973
- * Configuration for Algolia DocSearch.
974
- */
975
- export interface BoltdocsAlgoliaConfig {
976
- appId: string
977
- apiKey: string
978
- indexName: string
979
- }
980
-
981
- /**
982
- * Configuration for Giscus comments.
983
- */
984
- export interface BoltdocsGiscusConfig {
985
- repo: string
986
- repoId: string
987
- category?: string
988
- categoryId?: string
989
- mapping?: 'pathname' | 'url' | 'title' | 'og:title' | 'specific' | 'number'
990
- strict?: '0' | '1' | boolean
991
- reactionsEnabled?: '0' | '1' | boolean
992
- emitMetadata?: '0' | '1' | boolean
993
- inputPosition?: 'top' | 'bottom'
994
- theme?: string
995
- darkTheme?: string
996
- lang?: string
997
- loading?: 'lazy' | 'eager'
998
- }
999
-
1000
- /**
1001
- * Configuration for custom feedback system using GitHub Discussions API.
1002
- */
1003
- export interface BoltdocsCustomFeedbackConfig {
1004
- enabled: boolean
1005
- owner: string
1006
- repo: string
1007
- categorySlug?: string
1008
- endpoint?: string
1009
- }
1010
-
1011
- export interface BoltdocsVercelConfig {
1012
- analytics?: boolean
1013
- speedInsights?: boolean
1014
- }
1015
-
1016
- export interface BoltdocsPostHogConfig {
1017
- apiKey: string
1018
- host?: string
1019
- capturePageview?: boolean
1020
- capturePageleave?: boolean
1021
- sessionRecording?: boolean
1022
- autocapture?: boolean
1023
- }
1024
-
1025
- export interface BoltdocsIntegrationsConfig {
1026
- analytics?: {
1027
- ga4?: BoltdocsGA4Config
1028
- vercel?: BoltdocsVercelConfig
1029
- gtm?: BoltdocsGTMConfig
1030
- posthog?: BoltdocsPostHogConfig
1031
- }
1032
- search?: {
1033
- algolia?: BoltdocsAlgoliaConfig
1034
- }
1035
- feedback?: {
1036
- giscus?: BoltdocsGiscusConfig
1037
- custom?: BoltdocsCustomFeedbackConfig
1038
- }
1039
- }
1040
-
1041
- /**
1042
- * Configuration for static site generation.
1043
- */
1044
- export interface BoltdocsSsgConfig {
1045
- /** Critical CSS strategy; `none` disables critical CSS processing. */
1046
- criticalCss?: 'zig-critters' | 'beasties' | 'none'
1047
- /**
1048
- * Per-page budget (bytes) for inlined critical CSS. Pages exceeding it get
1049
- * no inline critical CSS (with a build warning). Default: 24576 (24KB).
1050
- */
1051
- criticalCssMaxSize?: number
1052
- }
1053
-
1054
- /**
1055
- * Configuration for drafts visibility control.
1056
- */
1057
- export interface BoltdocsDraftsConfig {
1058
- /** If true, drafts are visible in all environments. Default: false */
1059
- visible?: boolean
1060
- /** Environments where drafts are visible (e.g. ['development', 'staging']). Default: [] */
1061
- environments?: string[]
1062
225
  }
1063
226
 
1064
227
  /**
1065
228
  * The root configuration object for Boltdocs.
1066
229
  */
1067
- export interface BoltdocsConfig {
1068
- siteUrl?: string
1069
- docsDir?: string
1070
- base?: string
230
+ export interface BoltdocsConfig extends BoltdocsConfigContract<BoltdocsPlugin> {
1071
231
  theme?: BoltdocsThemeConfig
1072
- i18n?: BoltdocsI18nConfig
1073
- versions?: BoltdocsVersionsConfig
1074
- mdx?: BoltdocsMdxConfig
1075
- ssg?: BoltdocsSsgConfig
1076
- plugins?: BoltdocsPlugin[]
1077
- collections?: BoltdocsCollectionsConfig
1078
- robots?: BoltdocsRobotsConfig
1079
- security?: BoltdocsSecurityConfig
1080
- seo?: BoltdocsSeoConfig
1081
- integrations?: BoltdocsIntegrationsConfig
1082
- drafts?: BoltdocsDraftsConfig
1083
- featureFlags?: Record<string, boolean | string>
1084
- experimental?: BoltdocsExperimentalConfig
1085
- directoryMeta?: Record<string, unknown>
1086
232
  aliases?: AliasOptions
1087
233
  vite?: UserConfig
1088
234
  }