boltdocs 3.0.2 → 3.2.1

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 (123) hide show
  1. package/README.md +2 -18
  2. package/dist/{adapters-DEXNIv3x.mjs → adapters-ByYY44Zy.mjs} +1 -1
  3. package/dist/{adapters-C5AWWGfb.cjs → adapters-DvmtpdSF.cjs} +1 -1
  4. package/dist/{banner-CfdalYLL.d.ts → banner-BMop1KLF.d.ts} +2 -2
  5. package/dist/{banner-DNSkgUsO.d.cts → banner-CVD0GugR.d.cts} +2 -2
  6. package/dist/cache-CO4Dy2uQ.cjs +6 -0
  7. package/dist/cache-Dk53iOo6.mjs +6 -0
  8. package/dist/chunk-BFSpntXv.mjs +6 -0
  9. package/dist/{chunk-Ds5LZdWN.cjs → chunk-D1Md3oWO.cjs} +1 -1
  10. package/dist/client/index.cjs +433 -272
  11. package/dist/client/index.d.cts +129 -18
  12. package/dist/client/index.d.ts +129 -18
  13. package/dist/client/index.js +337 -178
  14. package/dist/client/mdx.cjs +1 -1
  15. package/dist/client/mdx.d.cts +1 -1
  16. package/dist/client/mdx.d.ts +1 -1
  17. package/dist/client/mdx.js +1 -1
  18. package/dist/client/primitives.cjs +7 -7
  19. package/dist/client/primitives.d.cts +5 -22
  20. package/dist/client/primitives.d.ts +5 -22
  21. package/dist/client/primitives.js +4 -4
  22. package/dist/client/theme/neutral.css +1 -3
  23. package/dist/client/theme/reset.css +31 -4
  24. package/dist/config-BpzaPsJj.d.cts +781 -0
  25. package/dist/config-CCXp3aXO.mjs +7 -0
  26. package/dist/{config-JGkMJoJQ.cjs → config-CMd4XoFq.cjs} +1 -1
  27. package/dist/config-DlGoEM9D.cjs +7 -0
  28. package/dist/config-xtS0ZkMm.d.mts +781 -0
  29. package/dist/{csp-CBysWlAf.cjs → csp-CRp_3U7a.cjs} +1 -1
  30. package/dist/csp-oTC2ygvF.mjs +6 -0
  31. package/dist/{docs-layout-6FQ8__ok.js → docs-layout-BdtZ9z6s.js} +9 -28
  32. package/dist/{docs-layout-3TpAt6MB.cjs → docs-layout-CFWI15Id.cjs} +69 -88
  33. package/dist/{doctor-BR1B2Mkz.cjs → doctor-BBtmNJE0.cjs} +1 -1
  34. package/dist/doctor-Bv16QSrI.cjs +7 -0
  35. package/dist/doctor-DOAbSaiL.mjs +7 -0
  36. package/dist/{generator-DtUU3Cfk.cjs → generator-COepVWGi.cjs} +1 -1
  37. package/dist/{handler-Btd4t_67.mjs → handler-DzQae4eA.mjs} +1 -1
  38. package/dist/{handler-Dzf4dSnV.cjs → handler-XX7cLTqe.cjs} +1 -1
  39. package/dist/headers-Ddwek8K7.mjs +6 -0
  40. package/dist/{headers-BXKxiPUv.cjs → headers-dg4SDrjY.cjs} +1 -1
  41. package/dist/{image-C9md50h2.js → image-Bz87fCla.js} +2 -2
  42. package/dist/{image-CR6UlaI5.cjs → image-C4TlpMHn.cjs} +18 -18
  43. package/dist/link-2PzgTnaP.js +673 -0
  44. package/dist/{icons-dev-BryEFkJu.cjs → link-D1Gjkb-2.cjs} +8 -353
  45. package/dist/{mdx-DhyMkc35.js → mdx-BuO6a1f7.js} +199 -40
  46. package/dist/{mdx-DJBg5DuL.cjs → mdx-CD-tSjRG.cjs} +237 -72
  47. package/dist/{meta-loader-C9MKjAs0.cjs → meta-loader-Dq1zcFnh.cjs} +1 -1
  48. package/dist/node/cache.cjs +6 -0
  49. package/dist/node/cache.d.cts +84 -0
  50. package/dist/node/cache.d.mts +84 -0
  51. package/dist/node/cache.mjs +6 -0
  52. package/dist/node/cli-entry.cjs +6 -6
  53. package/dist/node/cli-entry.mjs +9 -9
  54. package/dist/node/index.cjs +1 -1
  55. package/dist/node/index.d.cts +27 -638
  56. package/dist/node/index.d.mts +27 -640
  57. package/dist/node/index.mjs +1 -1
  58. package/dist/node/mdx/shiki-adapter.cjs +6 -0
  59. package/dist/node/mdx/shiki-adapter.d.cts +51 -0
  60. package/dist/node/mdx/shiki-adapter.d.mts +51 -0
  61. package/dist/node/mdx/shiki-adapter.mjs +6 -0
  62. package/dist/node-BXtqM1uH.mjs +6 -0
  63. package/dist/node-BlVk4EVg.cjs +104 -0
  64. package/dist/node-DOf4zhWc.mjs +104 -0
  65. package/dist/node-aD1eisrR.cjs +6 -0
  66. package/dist/{package-CEDhVAfO.cjs → package-BcISI5-P.cjs} +1 -1
  67. package/dist/{package-_dCCKVvG.mjs → package-CCYEAYeA.mjs} +1 -1
  68. package/dist/{pages-external-CX2uyW95.cjs → pages-external-XkYIs-d5.cjs} +1 -1
  69. package/dist/parser-DCiEWkSk.cjs +8 -0
  70. package/dist/parser-qk9FIHJ7.mjs +8 -0
  71. package/dist/plugin-C95kvu6h.mjs +73 -0
  72. package/dist/plugin-DM3u2bVj.cjs +73 -0
  73. package/dist/routes-BW6zsk7Z.mjs +6 -0
  74. package/dist/routes-BgoIB5wb.cjs +6 -0
  75. package/dist/{routes-BajCwrvX.cjs → routes-CORVxc02.cjs} +1 -1
  76. package/dist/{search-dialog-D4rplZMv.cjs → search-dialog-B1NERUNx.cjs} +101 -55
  77. package/dist/{search-dialog-Cx7aGW3U.cjs → search-dialog-BRFno7HD.cjs} +8 -8
  78. package/dist/{search-dialog-DDopgbKM.js → search-dialog-BmxHiKwt.js} +2 -2
  79. package/dist/{search-dialog-BNdRV60O.js → search-dialog-D6TvjcuV.js} +1 -1
  80. package/dist/{search-dialog-DaeSPvEo.js → search-dialog-DFnlx8LO.js} +44 -4
  81. package/dist/{search-dialog-CW1f6dn6.cjs → search-dialog-DHqwjJuG.cjs} +1 -1
  82. package/dist/server/index.cjs +1 -1
  83. package/dist/server/index.d.mts +1 -1
  84. package/dist/server/index.mjs +1 -1
  85. package/dist/shiki-adapter-CoQ6jyJ4.cjs +6 -0
  86. package/dist/shiki-adapter-D-aKw7PP.mjs +6 -0
  87. package/dist/sidebar-COTaMHR-.d.ts +1100 -0
  88. package/dist/sidebar-CrEdJuHX.d.cts +1100 -0
  89. package/dist/{types-generator-CYcHkDzZ.cjs → types-generator-BXhv7Ill.cjs} +1 -1
  90. package/dist/types-generator-bDPvUztF.mjs +26 -0
  91. package/dist/utils-Crm9oPcV.mjs +7 -0
  92. package/dist/utils-D6Xtj0FZ.cjs +7 -0
  93. package/package.json +26 -12
  94. package/src/shared/types.ts +532 -23
  95. package/dist/cache-DETwlACe.cjs +0 -6
  96. package/dist/cache-SF59enb3.mjs +0 -6
  97. package/dist/config-B5uVv5q4.cjs +0 -7
  98. package/dist/config-D3_zDkHh.mjs +0 -7
  99. package/dist/csp-gaZ51xzq.mjs +0 -6
  100. package/dist/doctor-3MheVMwd.mjs +0 -7
  101. package/dist/doctor-DQxLM202.cjs +0 -7
  102. package/dist/headers-CXyf0auY.mjs +0 -6
  103. package/dist/icons-dev-kJyGWNeg.js +0 -916
  104. package/dist/node-B9JSyEIU.mjs +0 -105
  105. package/dist/node-Cedquois.cjs +0 -105
  106. package/dist/parser-CNIPHx4s.cjs +0 -8
  107. package/dist/parser-D0QHIQsi.mjs +0 -8
  108. package/dist/plugin-WYNORxp1.cjs +0 -68
  109. package/dist/plugin-YWNVRpws.mjs +0 -68
  110. package/dist/rolldown-runtime-fkIsjY3S.mjs +0 -6
  111. package/dist/routes-CyrnmVuG.mjs +0 -6
  112. package/dist/routes-D6Tuu7Fs.cjs +0 -6
  113. package/dist/shiki-adapter-CGTmrR6S.cjs +0 -6
  114. package/dist/shiki-adapter-CXEGRnjr.mjs +0 -6
  115. package/dist/shiki-adapter-Mr8_oT_9.cjs +0 -6
  116. package/dist/sidebar-7gIifpBX.d.cts +0 -615
  117. package/dist/sidebar-BAKgJ-Er.d.ts +0 -615
  118. package/dist/types-generator-DVOnRVKU.mjs +0 -26
  119. package/dist/utils-B3xYMrpK.mjs +0 -7
  120. package/dist/utils-Bz1tG9Dg.cjs +0 -7
  121. /package/dist/{errors-C0Hx15Ag.mjs → errors-0zGHRLue.mjs} +0 -0
  122. /package/dist/{errors-Dx6JHoKE.cjs → errors-vKw8CkiX.cjs} +0 -0
  123. /package/dist/{index-CdJv4ocW.d.mts → index-1KsTDq4o.d.mts} +0 -0
@@ -1,316 +1,11 @@
1
1
 
2
- import { i as handleVercelFeedback, n as handleWebFeedback, r as handleNetlifyFeedback, t as handleAwsFeedback } from "../index-CdJv4ocW.mjs";
2
+ import { flushCache } from "./cache.mjs";
3
+ import { i as handleVercelFeedback, n as handleWebFeedback, r as handleNetlifyFeedback, t as handleAwsFeedback } from "../index-1KsTDq4o.mjs";
4
+ import { a as BoltdocsThemeConfig, c as PluginLogger, d as PluginTransformMiddleware, f as RouteMeta, i as BoltdocsPlugin, l as PluginMeta, n as defineConfig, o as PluginContext, r as BoltdocsConfig, s as PluginLifecycleHooks, t as resolveConfig, u as PluginStore } from "../config-xtS0ZkMm.mjs";
3
5
  import { z } from "zod";
4
- import { EXIT, SKIP } from "unist-util-visit";
5
6
  import { InlineConfig, Plugin } from "vite";
6
- //#region src/shared/types.d.ts
7
- /**
8
- * Represents a single social link in the configuration.
9
- */
10
- interface BoltdocsSocialLink {
11
- icon: 'discord' | 'x' | 'github' | 'bluesky' | string;
12
- link: string;
13
- }
14
- /**
15
- * Configuration for the site footer.
16
- */
17
- interface BoltdocsFooterConfig {
18
- text?: string;
19
- }
20
- /**
21
- * Theme-specific configuration options.
22
- */
23
- interface BoltdocsThemeConfig {
24
- title?: string | Record<string, string>;
25
- description?: string | Record<string, string>;
26
- logo?: string | {
27
- dark: string;
28
- light: string;
29
- alt?: string;
30
- width?: number;
31
- height?: number;
32
- };
33
- navbar?: Array<{
34
- label: string | Record<string, string>;
35
- href: BoltdocsRoutePathWithFallback;
36
- items?: Array<{
37
- label: string | Record<string, string>;
38
- href: BoltdocsRoutePathWithFallback;
39
- }>;
40
- }>;
41
- sidebar?: Record<string, Array<{
42
- text: string;
43
- link: BoltdocsRoutePathWithFallback;
44
- }>>;
45
- sidebarGroups?: Record<string, {
46
- title?: string | Record<string, string>;
47
- icon?: string;
48
- }>;
49
- socialLinks?: BoltdocsSocialLink[];
50
- footer?: BoltdocsFooterConfig;
51
- editLink?: string;
52
- communityHelp?: string;
53
- version?: string;
54
- githubRepo?: string;
55
- favicon?: string;
56
- tabs?: Array<{
57
- id: string;
58
- text: string | Record<string, string>;
59
- icon?: string;
60
- }>;
61
- codeTheme?: ShikiTheme | {
62
- light: ShikiTheme;
63
- dark: ShikiTheme;
64
- };
65
- }
66
- /**
67
- * List of supported syntax highlighting themes.
68
- */
69
- type ShikiTheme = 'github-dark' | 'github-light' | 'tokyo-night' | 'dracula' | 'nord' | 'one-dark-pro' | 'one-light';
70
- /**
71
- * Configuration for the robots.txt file.
72
- */
73
- type BoltdocsRobotsConfig = string | {
74
- rules?: Array<{
75
- userAgent: string;
76
- allow?: string | string[];
77
- disallow?: string | string[];
78
- }>;
79
- sitemaps?: string[];
80
- };
81
- /**
82
- * Configuration for a specific locale.
83
- */
84
- interface BoltdocsLocaleConfig {
85
- label?: string;
86
- direction?: 'ltr' | 'rtl';
87
- htmlLang?: string;
88
- calendar?: string;
89
- }
90
- /**
91
- * Configuration for internationalization (i18n).
92
- */
93
- interface BoltdocsI18nConfig {
94
- defaultLocale: string;
95
- locales: string[] | Record<string, string>;
96
- localeConfigs?: Record<string, BoltdocsLocaleConfig>;
97
- }
98
- /**
99
- * Configuration for a specific documentation version.
100
- */
101
- interface BoltdocsVersionConfig {
102
- label: string;
103
- path: string;
104
- }
105
- /**
106
- * Configuration for documentation versioning.
107
- */
108
- interface BoltdocsVersionsConfig {
109
- defaultVersion: string;
110
- prefix?: string;
111
- versions: BoltdocsVersionConfig[];
112
- }
113
- /**
114
- * Shared badge value type used in frontmatter, RouteMeta, and ComponentRoute.
115
- */
116
- type BadgeValue = string | {
117
- text: string;
118
- expires?: string;
119
- };
120
- /**
121
- * Defines a Boltdocs plugin.
122
- *
123
- * Use the `createPlugin()` helper from the node API for full type safety and
124
- * access to lifecycle hooks.
125
- */
126
- interface BoltdocsPlugin {
127
- name: string;
128
- enforce?: 'pre' | 'post';
129
- version?: string;
130
- boltdocsVersion?: string;
131
- remarkPlugins?: unknown[];
132
- rehypePlugins?: unknown[];
133
- vitePlugins?: Plugin[];
134
- components?: Record<string, string>;
135
- /** Lifecycle hooks — use the `PluginLifecycleHooks` type from the node API. */
136
- hooks?: Record<string, (ctx: unknown) => Promise<void> | void>;
137
- }
138
- /**
139
- * Configuration for the collections (blog) feature.
140
- */
141
- interface BoltdocsCollectionsConfig {
142
- /** Number of posts per page in collection listing pages. Defaults to 10. */
143
- postsPerPage?: number;
144
- /** The name of the default collection used by BlogList when none is specified. */
145
- defaultCollection?: string;
146
- /** Date format string for rendering post dates (e.g., 'MMMM dd, yyyy'). */
147
- dateFormat?: string;
148
- /** Field to sort posts by. Defaults to 'date'. */
149
- sortBy?: 'date' | 'title' | 'sidebarPosition';
150
- }
151
- interface BoltdocsSecurityConfig {
152
- headers?: Record<string, string>;
153
- enableCSP?: boolean;
154
- customHeaders?: Record<string, string>;
155
- }
156
- interface BoltdocsVerificationConfig {
157
- google?: string;
158
- bing?: string;
159
- yandex?: string;
160
- pinterest?: string;
161
- facebook?: string;
162
- }
163
- /**
164
- * Configuration for SEO.
165
- */
166
- interface BoltdocsSeoConfig {
167
- metatags?: Record<string, string>;
168
- indexing?: 'all' | 'public';
169
- thumbnails?: {
170
- background?: string;
171
- };
172
- verification?: BoltdocsVerificationConfig;
173
- }
174
- /**
175
- * Configuration for Google Analytics 4 (GA4).
176
- */
177
- interface BoltdocsGA4Config {
178
- measurementId: string;
179
- debug?: boolean;
180
- anonymizeIp?: boolean;
181
- sendPageView?: boolean;
182
- cookieFlags?: string;
183
- autoTrack?: {
184
- pageViews?: boolean;
185
- downloads?: boolean;
186
- externalLinks?: boolean;
187
- search?: boolean;
188
- };
189
- }
190
- /**
191
- * Configuration for Google Tag Manager (GTM).
192
- */
193
- interface BoltdocsGTMConfig {
194
- tagId: string;
195
- dataLayerName?: string;
196
- preview?: string;
197
- }
198
- /**
199
- * Configuration for Algolia DocSearch.
200
- */
201
- interface BoltdocsAlgoliaConfig {
202
- appId: string;
203
- apiKey: string;
204
- indexName: string;
205
- }
206
- /**
207
- * Configuration for Giscus comments.
208
- */
209
- interface BoltdocsGiscusConfig {
210
- repo: string;
211
- repoId: string;
212
- category?: string;
213
- categoryId?: string;
214
- mapping?: 'pathname' | 'url' | 'title' | 'og:title' | 'specific' | 'number';
215
- strict?: '0' | '1' | boolean;
216
- reactionsEnabled?: '0' | '1' | boolean;
217
- emitMetadata?: '0' | '1' | boolean;
218
- inputPosition?: 'top' | 'bottom';
219
- theme?: string;
220
- darkTheme?: string;
221
- lang?: string;
222
- loading?: 'lazy' | 'eager';
223
- }
224
- /**
225
- * Configuration for custom feedback system using GitHub Discussions API.
226
- */
227
- interface BoltdocsCustomFeedbackConfig {
228
- enabled: boolean;
229
- owner: string;
230
- repo: string;
231
- categorySlug?: string;
232
- endpoint?: string;
233
- }
234
- interface BoltdocsVercelConfig {
235
- analytics?: boolean;
236
- speedInsights?: boolean;
237
- }
238
- interface BoltdocsIntegrationsConfig {
239
- analytics?: {
240
- ga4?: BoltdocsGA4Config;
241
- vercel?: BoltdocsVercelConfig;
242
- gtm?: BoltdocsGTMConfig;
243
- };
244
- search?: {
245
- algolia?: BoltdocsAlgoliaConfig;
246
- };
247
- feedback?: {
248
- giscus?: BoltdocsGiscusConfig;
249
- custom?: BoltdocsCustomFeedbackConfig;
250
- };
251
- }
252
- /**
253
- * The root configuration object for Boltdocs.
254
- */
255
- interface BoltdocsConfig {
256
- siteUrl?: string;
257
- docsDir?: string;
258
- base?: string;
259
- theme?: BoltdocsThemeConfig;
260
- i18n?: BoltdocsI18nConfig;
261
- versions?: BoltdocsVersionsConfig;
262
- plugins?: BoltdocsPlugin[];
263
- collections?: BoltdocsCollectionsConfig;
264
- robots?: BoltdocsRobotsConfig;
265
- security?: BoltdocsSecurityConfig;
266
- seo?: BoltdocsSeoConfig;
267
- integrations?: BoltdocsIntegrationsConfig;
268
- directoryMeta?: Record<string, unknown>;
269
- vite?: unknown;
270
- }
271
- /**
272
- * Global namespace for Boltdocs types that can be augmented by generated code.
273
- * This allows for strictly typed locales and versions based on the project configuration.
274
- */
275
- declare global {
276
- namespace Boltdocs {
277
- interface Types {}
278
- /**
279
- * Marker interface augmented by generated code to provide strict route path typing.
280
- * When no types have been generated (e.g., before first dev server start),
281
- * keyof is never, and BoltdocsRoutePath falls back to string.
282
- */
283
- interface RoutePaths {}
284
- }
285
- }
286
- type BoltdocsRoutePath = keyof Boltdocs.RoutePaths;
287
- type BoltdocsRoutePathWithFallback = BoltdocsRoutePath extends never ? string : BoltdocsRoutePath;
288
- //#endregion
289
- //#region src/shared/config-utils.d.ts
290
- /**
291
- * Type-safe helper for defining Boltdocs configuration.
292
- * This is an identity function that provides IntelliSense in both
293
- * Node.js (config files) and client-side code (MDX examples).
294
- *
295
- * @remarks
296
- * Intended for use in `boltdocs.config.ts` (Node.js context). This function
297
- * is **not** available as a client-side import from `boltdocs/client`.
298
- *
299
- * @param config - The Boltdocs configuration object
300
- */
301
- declare function defineConfig(config: BoltdocsConfig): BoltdocsConfig;
302
- //#endregion
303
- //#region src/node/config.d.ts
304
- /**
305
- * Loads user's configuration file (e.g., `boltdocs.config.js` or `boltdocs.config.ts`) if it exists,
306
- * merges it with the default configuration, and returns the final `BoltdocsConfig`.
307
- *
308
- * @param docsDir - The directory containing the documentation files
309
- * @param root - The project root directory (defaults to process.cwd())
310
- * @returns The merged configuration object
311
- */
312
- declare function resolveConfig(docsDir: string, root?: string): Promise<BoltdocsConfig>;
313
- //#endregion
7
+ export * from "@bdocs/unist-utils";
8
+
314
9
  //#region src/node/plugin/types.d.ts
315
10
  /**
316
11
  * Configuration options specifically for the Boltdocs Vite plugin.
@@ -318,6 +13,8 @@ declare function resolveConfig(docsDir: string, root?: string): Promise<Boltdocs
318
13
  interface BoltdocsPluginOptions {
319
14
  /** The root directory containing markdown files (default: 'docs') */
320
15
  docsDir?: string;
16
+ /** Enable turbo mode (Sätteri MDX compiler) */
17
+ turbo?: boolean;
321
18
  }
322
19
  //#endregion
323
20
  //#region src/node/plugin/entry.d.ts
@@ -331,88 +28,6 @@ interface BoltdocsPluginOptions {
331
28
  */
332
29
  declare function generateEntryCode(options: BoltdocsPluginOptions, config?: BoltdocsConfig): string;
333
30
  //#endregion
334
- //#region src/node/routes/types.d.ts
335
- /**
336
- * Metadata representing a single documentation route.
337
- * This information is used to build the client-side router and the sidebar navigation.
338
- */
339
- interface RouteMeta {
340
- /** The final URL path for the route (e.g., '/docs/guide/start') */
341
- path: string;
342
- /** The absolute filesystem path to the source markdown/mdx file */
343
- componentPath: string;
344
- /** The title of the page, usually extracted from frontmatter or the filename */
345
- title: string;
346
- /** The relative path from the docs directory, used for edit links */
347
- filePath: string;
348
- /** Optional description of the page (for SEO/meta tags) */
349
- description?: string;
350
- /** Optional explicit position for ordering in the sidebar */
351
- sidebarPosition?: number;
352
- /** The group (directory) this route belongs to */
353
- group?: string;
354
- /** The display title for the route's group */
355
- groupTitle?: string;
356
- /** Optional explicit position for ordering the group itself */
357
- groupPosition?: number;
358
- /** Optional icon for the route's group */
359
- groupIcon?: string;
360
- /** The sub-route group this route belongs to (from folders starting with _) */
361
- subRouteGroup?: string;
362
- /** Extracted markdown headings for search indexing */
363
- headings?: {
364
- level: number;
365
- text: string;
366
- id: string;
367
- }[];
368
- /** The locale this route belongs to, if i18n is configured */
369
- locale?: string;
370
- /** The version this route belongs to, if versioning is configured */
371
- version?: string;
372
- /** Optional badge to display next to the sidebar item (e.g., 'New', 'Experimental') */
373
- badge?: BadgeValue;
374
- /** Optional icon to display (Lucide icon name or raw SVG) */
375
- icon?: string;
376
- /** The tab this route belongs to, if tabs are configured */
377
- tab?: string;
378
- /** The collection this route belongs to (from [name] directories like [blog]) */
379
- collection?: string;
380
- /** Tags for blog posts or other taxonomy */
381
- tags?: string[];
382
- /** Author identifier for blog posts */
383
- author?: string;
384
- /** Draft flag — excluded from production builds */
385
- draft?: boolean;
386
- /** Short excerpt/summary for list displays */
387
- excerpt?: string;
388
- /** Cover image for blog posts */
389
- coverImage?: string;
390
- /** The extracted plain-text content of the page for search indexing */
391
- _content?: string;
392
- /** The raw markdown content of the page */
393
- _rawContent?: string;
394
- /** Extracted SEO and Open Graph metadata from frontmatter */
395
- seo?: Record<string, any>;
396
- /** The publication date */
397
- date?: string | Date;
398
- /** The last updated timestamp or date */
399
- lastUpdated?: string | number | Date;
400
- /** Optional category for the page */
401
- category?: string;
402
- /** Optional explicit order (alternative to sidebarPosition) */
403
- order?: number;
404
- /** Optional explicit label for the sidebar */
405
- sidebarLabel?: string;
406
- /** Whether the page is hidden from the sidebar */
407
- sidebarHidden?: boolean;
408
- /** Raw extensible frontmatter data for custom components and formatters */
409
- frontmatter?: Record<string, any>;
410
- /** Optional recursive child routes for deep sidebar hierarchies */
411
- subRoutes?: RouteMeta[];
412
- /** Clean URL segments stripped of locale/version prefixes */
413
- slugParts?: string[];
414
- }
415
- //#endregion
416
31
  //#region src/node/routes/index.d.ts
417
32
  /**
418
33
  * Invalidates the global route metadata and clears local state.
@@ -429,64 +44,9 @@ declare function invalidateRouteCache(): void;
429
44
  * @param basePath - The base URL path for the routes (default: '/docs')
430
45
  * @returns A promise resolving to an array of RouteMeta objects
431
46
  */
432
- declare function generateRoutes(docsDir: string, config?: BoltdocsConfig, basePath?: string, forceScan?: boolean): Promise<RouteMeta[]>;
47
+ declare function generateRoutes(docsDir: string, config?: BoltdocsConfig, basePath?: string, forceScan?: boolean, turbo?: boolean): Promise<RouteMeta[]>;
433
48
  //#endregion
434
49
  //#region src/node/plugins/plugin-types.d.ts
435
- interface PluginContext {
436
- readonly config: BoltdocsConfig;
437
- readonly logger: PluginLogger;
438
- readonly store: PluginStore;
439
- readonly meta: PluginMeta;
440
- readonly docsDir: string;
441
- readonly rootDir: string;
442
- }
443
- interface PluginLogger {
444
- info(message: string): void;
445
- warn(message: string): void;
446
- error(message: string | Error): void;
447
- debug(message: string): void;
448
- }
449
- interface PluginStore {
450
- get<T = unknown>(pluginName: string, key: string): T | undefined;
451
- set(pluginName: string, key: string, value: unknown): void;
452
- has(pluginName: string, key: string): boolean;
453
- }
454
- interface PluginMeta {
455
- name: string;
456
- version?: string;
457
- boltdocsVersion?: string;
458
- }
459
- interface PluginLifecycleHooks {
460
- beforeBuild?: (ctx: PluginContext) => Promise<void> | void;
461
- afterBuild?: (ctx: PluginContext) => Promise<void> | void;
462
- beforeDev?: (ctx: PluginContext) => Promise<void> | void;
463
- afterDev?: (ctx: PluginContext) => Promise<void> | void;
464
- buildEnd?: (ctx: PluginContext) => Promise<void> | void;
465
- transformSource?: (ctx: PluginContext, params: {
466
- code: string;
467
- filePath: string;
468
- }) => Promise<{
469
- code: string;
470
- }> | {
471
- code: string;
472
- };
473
- transformMdx?: (ctx: PluginContext, params: {
474
- code: string;
475
- filePath: string;
476
- }) => Promise<{
477
- code: string;
478
- }> | {
479
- code: string;
480
- };
481
- transformHtml?: (ctx: PluginContext, params: {
482
- html: string;
483
- path: string;
484
- }) => Promise<{
485
- html: string;
486
- }> | {
487
- html: string;
488
- };
489
- }
490
50
  interface SecureBoltdocsPlugin {
491
51
  name: string;
492
52
  enforce?: 'pre' | 'post';
@@ -496,6 +56,8 @@ interface SecureBoltdocsPlugin {
496
56
  rehypePlugins?: unknown[];
497
57
  vitePlugins?: Plugin[];
498
58
  components?: Record<string, string>;
59
+ metadata?: Record<string, unknown>;
60
+ middleware?: PluginTransformMiddleware[];
499
61
  hooks?: PluginLifecycleHooks;
500
62
  }
501
63
  //#endregion
@@ -551,195 +113,25 @@ declare class PluginLifecycleManager {
551
113
  private store;
552
114
  private docsDir;
553
115
  private rootDir;
554
- constructor(plugins: SecureBoltdocsPlugin[], config: BoltdocsConfig, docsDir?: string, rootDir?: string);
116
+ private routes;
117
+ private outDir;
118
+ constructor(plugins: SecureBoltdocsPlugin[], config: BoltdocsConfig, docsDir?: string, rootDir?: string, routes?: RouteMeta[], outDir?: string);
555
119
  runHook(hookName: keyof PluginLifecycleHooks, ...args: unknown[]): Promise<void>;
556
- runChain<TParams>(hookName: keyof PluginLifecycleHooks, initialParams: TParams): Promise<TParams>;
120
+ runChain<TParams extends Record<string, unknown>>(hookName: keyof PluginLifecycleHooks, initialParams: TParams): Promise<TParams>;
121
+ /**
122
+ * Run registered transform middleware in `enforce` order over a chain of
123
+ * params. Middleware registered via `ctx.middleware.add()` from lifecycle
124
+ * hooks or declared statically via `BoltdocsPlugin.middleware` are all
125
+ * collected. Execution respects `__signal: 'skip'` and `__signal: 'break'`.
126
+ */
127
+ runMiddlewareChain<TParams extends Record<string, unknown>>(hookName: 'transformSource' | 'transformMdx' | 'transformHtml', initialParams: TParams): Promise<TParams>;
557
128
  private getSortedPlugins;
558
129
  private createStep;
559
130
  private createContext;
131
+ private createGenericContext;
560
132
  private createLogger;
561
133
  }
562
134
  //#endregion
563
- //#region ../../node_modules/.pnpm/@types+unist@3.0.3/node_modules/@types/unist/index.d.ts
564
- // ## Interfaces
565
- /**
566
- * Info associated with nodes by the ecosystem.
567
- *
568
- * This space is guaranteed to never be specified by unist or specifications
569
- * implementing unist.
570
- * But you can use it in utilities and plugins to store data.
571
- *
572
- * This type can be augmented to register custom data.
573
- * For example:
574
- *
575
- * ```ts
576
- * declare module 'unist' {
577
- * interface Data {
578
- * // `someNode.data.myId` is typed as `number | undefined`
579
- * myId?: number | undefined
580
- * }
581
- * }
582
- * ```
583
- */
584
- interface Data {}
585
- /**
586
- * One place in a source file.
587
- */
588
- interface Point {
589
- /**
590
- * Line in a source file (1-indexed integer).
591
- */
592
- line: number;
593
- /**
594
- * Column in a source file (1-indexed integer).
595
- */
596
- column: number;
597
- /**
598
- * Character in a source file (0-indexed integer).
599
- */
600
- offset?: number | undefined;
601
- }
602
- /**
603
- * Position of a node in a source document.
604
- *
605
- * A position is a range between two points.
606
- */
607
- interface Position {
608
- /**
609
- * Place of the first character of the parsed source region.
610
- */
611
- start: Point;
612
- /**
613
- * Place of the first character after the parsed source region.
614
- */
615
- end: Point;
616
- }
617
- /**
618
- * Abstract unist node.
619
- *
620
- * The syntactic unit in unist syntax trees are called nodes.
621
- *
622
- * This interface is supposed to be extended.
623
- * If you can use {@link Literal} or {@link Parent}, you should.
624
- * But for example in markdown, a `thematicBreak` (`***`), is neither literal
625
- * nor parent, but still a node.
626
- */
627
- interface Node {
628
- /**
629
- * Node type.
630
- */
631
- type: string;
632
- /**
633
- * Info from the ecosystem.
634
- */
635
- data?: Data | undefined;
636
- /**
637
- * Position of a node in a source document.
638
- *
639
- * Nodes that are generated (not in the original source document) must not
640
- * have a position.
641
- */
642
- position?: Position | undefined;
643
- }
644
- /**
645
- * Abstract unist node that contains other nodes (*children*).
646
- *
647
- * This interface is supposed to be extended.
648
- *
649
- * For example, in XML, an element is a parent of different things, such as
650
- * comments, text, and further elements.
651
- */
652
- interface Parent extends Node {
653
- /**
654
- * List of children.
655
- */
656
- children: Node[];
657
- }
658
- //#endregion
659
- //#region src/node/mdx/types.d.ts
660
- interface MdxJsxAttributeValueExpression {
661
- type: 'mdxJsxAttributeValueExpression';
662
- value: string;
663
- data?: {
664
- estree?: any;
665
- };
666
- }
667
- interface MdxJsxAttribute {
668
- type: 'mdxJsxAttribute';
669
- name: string;
670
- value?: string | MdxJsxAttributeValueExpression;
671
- }
672
- interface MdxJsxElement {
673
- type: 'mdxJsxFlowElement' | 'mdxJsxTextElement';
674
- name: string | null;
675
- attributes?: MdxJsxAttribute[];
676
- children?: any[];
677
- }
678
- interface ElementNode {
679
- type: 'element';
680
- tagName: string;
681
- properties?: Record<string, any>;
682
- children?: any[];
683
- }
684
- //#endregion
685
- //#region src/node/mdx/shiki-adapter.d.ts
686
- interface ParsedMeta {
687
- title?: string;
688
- lineNumbers?: boolean;
689
- wordWrap?: boolean;
690
- [key: string]: any;
691
- }
692
- /**
693
- * Parses a meta string into a structured ParsedMeta object.
694
- */
695
- declare function parseMetaString(metaStr: string): ParsedMeta;
696
- //#endregion
697
- //#region src/node/plugins/plugin-utils.d.ts
698
- interface NodeWithHProperties extends Node {
699
- data?: {
700
- hProperties?: Record<string, unknown>;
701
- [key: string]: unknown;
702
- };
703
- }
704
- /**
705
- * General, type-safe utility to visit nodes in the AST (MDAST/HAST/MDX).
706
- */
707
- declare function visitNodes<T extends Node>(tree: Node, test: string | string[] | ((node: Node) => boolean), callback: (node: T, index: number, parent: Parent) => void | number | boolean | symbol): void;
708
- declare function visitRehypeElements(tree: Node, tagName: string, callback: (node: ElementNode, index: number, parent: Parent) => void | number | boolean | symbol): void;
709
- declare function visitMdxElements(tree: Node, name: string | string[], callback: (node: MdxJsxElement, index: number, parent: Parent) => void | number | boolean | symbol): void;
710
- declare function setNodeProperty(node: NodeWithHProperties, key: string, value: unknown): void;
711
- declare function getNodeProperty(node: NodeWithHProperties, key: string): unknown;
712
- declare function createMdxAttribute(name: string, value: unknown): MdxJsxAttribute;
713
- declare function createRehypeElement(tagName: string, properties?: Record<string, unknown>, children?: Node[]): ElementNode;
714
- declare function createMdxElement(name: string, attributes?: Record<string, unknown>, children?: Node[], isFlow?: boolean): MdxJsxElement;
715
- declare function visitRemarkHeadings(tree: Node, callback: (node: any, index: number, parent: Parent) => void | number | boolean | symbol): void;
716
- declare function visitRemarkLinks(tree: Node, callback: (node: any, index: number, parent: Parent) => void | number | boolean | symbol): void;
717
- declare function addNodeClass(node: ElementNode, className: string): void;
718
- declare function removeNodeClass(node: ElementNode, className: string): void;
719
- declare function hasNodeClass(node: ElementNode, className: string): boolean;
720
- //#endregion
721
- //#region src/node/mdx/constants.d.ts
722
- declare const MDX_NODES: {
723
- readonly ROOT: "root";
724
- readonly ELEMENT: "element";
725
- readonly TEXT: "text";
726
- readonly COMMENT: "comment";
727
- readonly CODE: "code";
728
- readonly INLINE_CODE: "inlineCode";
729
- readonly HEADING: "heading";
730
- readonly PARAGRAPH: "paragraph";
731
- readonly LINK: "link";
732
- readonly IMAGE: "image";
733
- readonly LIST: "list";
734
- readonly LIST_ITEM: "listItem";
735
- readonly JSX_FLOW_ELEMENT: "mdxJsxFlowElement";
736
- readonly JSX_TEXT_ELEMENT: "mdxJsxTextElement";
737
- readonly JSX_ATTRIBUTE: "mdxJsxAttribute";
738
- readonly FLOW_EXPRESSION: "mdxFlowExpression";
739
- readonly TEXT_EXPRESSION: "mdxTextExpression";
740
- readonly ESM: "mdxjsEsm";
741
- };
742
- //#endregion
743
135
  //#region src/node/plugins/index.d.ts
744
136
  declare function createPlugin(plugin: SecureBoltdocsPlugin): SecureBoltdocsPlugin;
745
137
  //#endregion
@@ -774,19 +166,14 @@ declare function normalizePath(p: string): string;
774
166
  * @returns The sanitized name
775
167
  */
776
168
  declare function sanitizeFilename(name: string): string;
777
- //#endregion
778
- //#region src/node/cache.d.ts
779
- /**
780
- * Flushes all pending background cache operations.
781
- */
782
- declare function flushCache(): Promise<void>;
783
- //#endregion
784
- //#region src/node/index.d.ts
169
+ declare namespace index_d_exports {
170
+ export { BoltdocsConfig, BoltdocsPlugin, BoltdocsPluginOptions, BoltdocsPluginStore, BoltdocsThemeConfig, PluginCompatibilityError, PluginContext, PluginError, PluginHookError, PluginLifecycleHooks, PluginLifecycleManager, PluginLogger, PluginMeta, PluginStore, PluginValidationError, RouteMeta, SecureBoltdocsPlugin, createPlugin, createViteConfig, boltdocs as default, defineConfig, flushCache, generateEntryCode, generateRoutes, handleAwsFeedback, handleFeedback, handleNetlifyFeedback, handleVercelFeedback, handleWebFeedback, invalidateRouteCache, normalizePath, resolveConfig, sanitizeFilename, validatePlugins };
171
+ }
785
172
  declare function boltdocs(options?: BoltdocsPluginOptions): Promise<Plugin[]>;
786
173
  /**
787
174
  * Generates the complete Vite configuration for a Boltdocs project.
788
175
  * This is used by the Boltdocs CLI to run Vite without a user-defined vite.config.ts.
789
176
  */
790
- declare function createViteConfig(root: string, mode?: 'development' | 'production', preResolvedConfig?: BoltdocsConfig): Promise<InlineConfig>;
177
+ declare function createViteConfig(root: string, mode?: 'development' | 'production', preResolvedConfig?: BoltdocsConfig, turbo?: boolean): Promise<InlineConfig>;
791
178
  //#endregion
792
- export { type BoltdocsConfig, type BoltdocsPlugin, type BoltdocsPluginOptions, BoltdocsPluginStore, type BoltdocsThemeConfig, EXIT, MDX_NODES, NodeWithHProperties, PluginCompatibilityError, PluginContext, PluginError, PluginHookError, PluginLifecycleHooks, PluginLifecycleManager, PluginLogger, PluginMeta, PluginStore, PluginValidationError, type RouteMeta, SKIP, SecureBoltdocsPlugin, addNodeClass, createMdxAttribute, createMdxElement, createPlugin, createRehypeElement, createViteConfig, boltdocs as default, defineConfig, flushCache, generateEntryCode, generateRoutes, getNodeProperty, handleAwsFeedback, handleFeedback, handleNetlifyFeedback, handleVercelFeedback, handleWebFeedback, hasNodeClass, invalidateRouteCache, normalizePath, parseMetaString, removeNodeClass, resolveConfig, sanitizeFilename, setNodeProperty, validatePlugins, visitMdxElements, visitNodes, visitRehypeElements, visitRemarkHeadings, visitRemarkLinks };
179
+ export { type BoltdocsConfig, type BoltdocsPlugin, type BoltdocsPluginOptions, BoltdocsPluginStore, type BoltdocsThemeConfig, PluginCompatibilityError, type PluginContext, PluginError, PluginHookError, type PluginLifecycleHooks, PluginLifecycleManager, type PluginLogger, type PluginMeta, type PluginStore, PluginValidationError, type RouteMeta, SecureBoltdocsPlugin, createPlugin, createViteConfig, boltdocs as default, defineConfig, flushCache, generateEntryCode, generateRoutes, handleAwsFeedback, handleFeedback, handleNetlifyFeedback, handleVercelFeedback, handleWebFeedback, invalidateRouteCache, normalizePath, resolveConfig, sanitizeFilename, validatePlugins };