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