boltdocs 2.7.10 → 2.8.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 (193) hide show
  1. package/README.md +2 -2
  2. package/dist/banner-3N4Jd_L9.d.ts +100 -0
  3. package/dist/banner-MynZD_Ox.d.cts +100 -0
  4. package/dist/cache-BMUyNiiA.mjs +6 -0
  5. package/dist/cache-CKm45d2w.cjs +6 -0
  6. package/dist/client/index.cjs +2268 -1
  7. package/dist/client/index.d.cts +86 -110
  8. package/dist/client/index.d.ts +87 -111
  9. package/dist/client/index.js +2214 -1
  10. package/dist/client/mdx.cjs +12 -1
  11. package/dist/client/mdx.d.cts +39 -93
  12. package/dist/client/mdx.d.ts +38 -93
  13. package/dist/client/mdx.js +7 -1
  14. package/dist/client/primitives.cjs +60 -1
  15. package/dist/client/primitives.d.cts +411 -347
  16. package/dist/client/primitives.d.ts +411 -347
  17. package/dist/client/primitives.js +20 -1
  18. package/dist/docs-layout-CwCq42Zt.cjs +1348 -0
  19. package/dist/docs-layout-Dn6S5g59.js +1167 -0
  20. package/dist/doctor-BArviV8X.cjs +28 -0
  21. package/dist/doctor-CgLA7_Uv.mjs +28 -0
  22. package/dist/{doctor-CrytFkqW.cjs → doctor-DyNUVe96.cjs} +1 -1
  23. package/dist/{routes-DP1vmWRj.cjs → doctor-aN_leTbh.mjs} +1 -1
  24. package/dist/{generator-ClVanhvi.mjs → generator-BHCrLU6h.mjs} +2 -2
  25. package/dist/{generator-CHqxiQhF.cjs → generator-CC2yHzhZ.cjs} +2 -2
  26. package/dist/icons-dev-DvJ-hh9x.cjs +1209 -0
  27. package/dist/icons-dev-Oju24Wjp.js +845 -0
  28. package/dist/image-Ch4-GxdO.cjs +268 -0
  29. package/dist/image-Do8V9PCW.js +214 -0
  30. package/dist/mdx-D3A2_l7P.js +520 -0
  31. package/dist/mdx-PLhhPJRS.cjs +531 -0
  32. package/dist/node/cli-entry.cjs +3 -1
  33. package/dist/node/cli-entry.mjs +3 -1
  34. package/dist/node/index.cjs +1 -1
  35. package/dist/node/index.d.cts +258 -152
  36. package/dist/node/index.d.mts +258 -150
  37. package/dist/node/index.mjs +1 -1
  38. package/dist/node/routes/worker.cjs +1 -1
  39. package/dist/node/routes/worker.mjs +1 -1
  40. package/dist/node-BmlP0eBP.cjs +159 -0
  41. package/dist/node-Y8_4ayje.mjs +159 -0
  42. package/dist/package-2nFy_NsW.cjs +6 -0
  43. package/dist/{package--0Yf0t1N.mjs → package-DAbtltXX.mjs} +1 -1
  44. package/dist/parser-B7-6PyQz.cjs +6 -0
  45. package/dist/{parser-Aq8LoH-0.cjs → parser-BzB-zCkF.cjs} +1 -1
  46. package/dist/parser-WGZdWs0X.mjs +6 -0
  47. package/dist/routes-BDDSxAl0.mjs +6 -0
  48. package/dist/routes-DJNJ-rTt.cjs +6 -0
  49. package/dist/routes-DiYC4nD2.cjs +6 -0
  50. package/dist/routes-_Bb2f4eI.mjs +6 -0
  51. package/dist/search-dialog-BXVoecTx.cjs +483 -0
  52. package/dist/search-dialog-BYhOov4S.cjs +331 -0
  53. package/dist/search-dialog-C09riYmx.js +313 -0
  54. package/dist/search-dialog-CUeAfy-8.cjs +8 -0
  55. package/dist/search-dialog-D8gLkhUV.js +453 -0
  56. package/dist/search-dialog-DHc_8FFX.js +8 -0
  57. package/dist/{sidebar-CcBkrm06.d.cts → sidebar-DNq4_ZAa.d.ts} +118 -52
  58. package/dist/{sidebar-CyZS9YOm.d.ts → sidebar-Dlkgbxs6.d.cts} +118 -52
  59. package/dist/utils-BYITg7T5.mjs +7 -0
  60. package/dist/utils-Cjmx1hhk.cjs +7 -0
  61. package/dist/worker-pool-CtqklOXq.cjs +6 -0
  62. package/dist/worker-pool-k0DY6k8T.mjs +6 -0
  63. package/package.json +5 -6
  64. package/src/shared/config-utils.ts +4 -0
  65. package/src/shared/types.ts +52 -6
  66. package/dist/cache-Ba-DZQNH.cjs +0 -6
  67. package/dist/cache-BuMZ58L5.mjs +0 -6
  68. package/dist/cards-BakZPTz9.d.ts +0 -30
  69. package/dist/cards-CQn9mXZS.d.cts +0 -30
  70. package/dist/docs-layout-KoWNZc8_.js +0 -6
  71. package/dist/docs-layout-x2yKt2cL.cjs +0 -6
  72. package/dist/doctor-Be7Ly1oM.mjs +0 -21
  73. package/dist/doctor-jMxWZyLJ.cjs +0 -21
  74. package/dist/icons-dev-B_RZIyxu.js +0 -6
  75. package/dist/icons-dev-BlV3wWFT.cjs +0 -6
  76. package/dist/image-BHhTvQzr.cjs +0 -6
  77. package/dist/image-CqKzYD8f.js +0 -6
  78. package/dist/mdx-DudBEac0.js +0 -7
  79. package/dist/mdx-r4cDQxWu.cjs +0 -7
  80. package/dist/node-DtEDyN1u.cjs +0 -111
  81. package/dist/node-_1jhMGYx.mjs +0 -111
  82. package/dist/package-DrwtlXfk.cjs +0 -6
  83. package/dist/parser-CdNbqN5y.cjs +0 -6
  84. package/dist/parser-nE792MLO.mjs +0 -6
  85. package/dist/rolldown-runtime-fkIsjY3S.mjs +0 -6
  86. package/dist/routes-2k3tbUmC.cjs +0 -6
  87. package/dist/routes-CpxZIsMM.mjs +0 -6
  88. package/dist/search-dialog-B584t9ZF.js +0 -6
  89. package/dist/search-dialog-BvBopRsZ.cjs +0 -6
  90. package/dist/search-dialog-ByvGScjt.js +0 -6
  91. package/dist/search-dialog-Cyko6TJm.cjs +0 -6
  92. package/dist/search-dialog-D6BNohIJ.js +0 -6
  93. package/dist/search-dialog-DuYTIefy.cjs +0 -6
  94. package/dist/utils-CG65J0Sc.mjs +0 -7
  95. package/dist/utils-CKunkU96.cjs +0 -7
  96. package/dist/worker-pool-CGn7DrLb.mjs +0 -6
  97. package/dist/worker-pool-Crbqgw5R.cjs +0 -6
  98. package/src/client/app/config-context.tsx +0 -51
  99. package/src/client/app/doc-page.tsx +0 -38
  100. package/src/client/app/docs-layout.tsx +0 -28
  101. package/src/client/app/head.tsx +0 -122
  102. package/src/client/app/helmet-compat.tsx +0 -36
  103. package/src/client/app/mdx-component.tsx +0 -8
  104. package/src/client/app/mdx-components-context.tsx +0 -72
  105. package/src/client/app/routes-context.tsx +0 -34
  106. package/src/client/app/scroll-handler.tsx +0 -74
  107. package/src/client/app/theme-context.tsx +0 -103
  108. package/src/client/app/ui-context.tsx +0 -42
  109. package/src/client/components/docs-layout-default.tsx +0 -85
  110. package/src/client/components/icons-dev.tsx +0 -282
  111. package/src/client/components/mdx/callout.tsx +0 -97
  112. package/src/client/components/mdx/card.tsx +0 -99
  113. package/src/client/components/mdx/cards.tsx +0 -27
  114. package/src/client/components/mdx/code-block.tsx +0 -184
  115. package/src/client/components/mdx/field.tsx +0 -33
  116. package/src/client/components/mdx/image.tsx +0 -44
  117. package/src/client/components/mdx/index.ts +0 -19
  118. package/src/client/components/mdx/table.tsx +0 -54
  119. package/src/client/components/mdx/typographics.tsx +0 -120
  120. package/src/client/components/mdx/use-code-block.ts +0 -34
  121. package/src/client/components/primitives/breadcrumbs.tsx +0 -54
  122. package/src/client/components/primitives/button-group.tsx +0 -54
  123. package/src/client/components/primitives/button.tsx +0 -6
  124. package/src/client/components/primitives/code-block.tsx +0 -120
  125. package/src/client/components/primitives/docs-layout.tsx +0 -125
  126. package/src/client/components/primitives/error-boundary.tsx +0 -107
  127. package/src/client/components/primitives/heading.tsx +0 -128
  128. package/src/client/components/primitives/helpers/observer.ts +0 -141
  129. package/src/client/components/primitives/image.tsx +0 -26
  130. package/src/client/components/primitives/link.tsx +0 -102
  131. package/src/client/components/primitives/menu.tsx +0 -137
  132. package/src/client/components/primitives/navbar.tsx +0 -466
  133. package/src/client/components/primitives/on-this-page.tsx +0 -430
  134. package/src/client/components/primitives/page-nav.tsx +0 -51
  135. package/src/client/components/primitives/popover.tsx +0 -28
  136. package/src/client/components/primitives/search-dialog.tsx +0 -193
  137. package/src/client/components/primitives/sidebar.tsx +0 -423
  138. package/src/client/components/primitives/skeleton.tsx +0 -26
  139. package/src/client/components/primitives/tabs.tsx +0 -70
  140. package/src/client/components/primitives/tooltip.tsx +0 -81
  141. package/src/client/components/primitives/types.ts +0 -11
  142. package/src/client/components/ui-base/banner.tsx +0 -66
  143. package/src/client/components/ui-base/breadcrumbs.tsx +0 -44
  144. package/src/client/components/ui-base/copy-markdown.tsx +0 -107
  145. package/src/client/components/ui-base/error-boundary.tsx +0 -15
  146. package/src/client/components/ui-base/github-stars.tsx +0 -29
  147. package/src/client/components/ui-base/icons.tsx +0 -240
  148. package/src/client/components/ui-base/index.ts +0 -16
  149. package/src/client/components/ui-base/last-updated.tsx +0 -27
  150. package/src/client/components/ui-base/navbar.tsx +0 -266
  151. package/src/client/components/ui-base/not-found.tsx +0 -26
  152. package/src/client/components/ui-base/on-this-page.tsx +0 -57
  153. package/src/client/components/ui-base/page-nav.tsx +0 -50
  154. package/src/client/components/ui-base/search-dialog.tsx +0 -163
  155. package/src/client/components/ui-base/search-highlight.tsx +0 -10
  156. package/src/client/components/ui-base/sidebar.tsx +0 -92
  157. package/src/client/components/ui-base/tabs.tsx +0 -83
  158. package/src/client/components/ui-base/theme-toggle.tsx +0 -130
  159. package/src/client/components/ui-base/version-i18n.tsx +0 -80
  160. package/src/client/hooks/index.ts +0 -13
  161. package/src/client/hooks/use-analytics.ts +0 -272
  162. package/src/client/hooks/use-breadcrumbs.ts +0 -22
  163. package/src/client/hooks/use-i18n.ts +0 -182
  164. package/src/client/hooks/use-localized-to.ts +0 -113
  165. package/src/client/hooks/use-location.ts +0 -5
  166. package/src/client/hooks/use-navbar.ts +0 -130
  167. package/src/client/hooks/use-page-nav.ts +0 -46
  168. package/src/client/hooks/use-routes.ts +0 -108
  169. package/src/client/hooks/use-search-highlight.ts +0 -185
  170. package/src/client/hooks/use-search.ts +0 -118
  171. package/src/client/hooks/use-sidebar.ts +0 -205
  172. package/src/client/hooks/use-tabs.ts +0 -46
  173. package/src/client/hooks/use-version.ts +0 -111
  174. package/src/client/index.ts +0 -31
  175. package/src/client/mdx.ts +0 -2
  176. package/src/client/primitives.ts +0 -19
  177. package/src/client/ssg/boltdocs-shell.tsx +0 -148
  178. package/src/client/ssg/create-routes.tsx +0 -473
  179. package/src/client/ssg/index.ts +0 -4
  180. package/src/client/ssg/mdx-page.tsx +0 -38
  181. package/src/client/store/boltdocs-context.tsx +0 -137
  182. package/src/client/theme/neutral.css +0 -141
  183. package/src/client/theme/reset.css +0 -189
  184. package/src/client/types.ts +0 -116
  185. package/src/client/utils/cn.ts +0 -6
  186. package/src/client/utils/copy-clipboard.ts +0 -22
  187. package/src/client/utils/get-base-file-path.ts +0 -21
  188. package/src/client/utils/github.ts +0 -121
  189. package/src/client/utils/i18n.ts +0 -23
  190. package/src/client/utils/path.ts +0 -9
  191. package/src/client/utils/react-to-text.ts +0 -34
  192. package/src/client/virtual.d.ts +0 -24
  193. /package/dist/{meta-loader-CWg2gnbY.mjs → meta-loader-DzwDFtdT.mjs} +0 -0
@@ -1,7 +1,7 @@
1
1
 
2
- import * as _$vite from "vite";
3
2
  import { InlineConfig, Plugin } from "vite";
4
3
  import { z } from "zod";
4
+ import { EXIT, SKIP } from "unist-util-visit";
5
5
  //#region src/shared/types.d.ts
6
6
  /**
7
7
  * Represents a single social link in the configuration.
@@ -31,15 +31,15 @@ interface BoltdocsThemeConfig {
31
31
  };
32
32
  navbar?: Array<{
33
33
  label: string | Record<string, string>;
34
- href: string;
34
+ href: BoltdocsRoutePathWithFallback;
35
35
  items?: Array<{
36
36
  label: string | Record<string, string>;
37
- href: string;
37
+ href: BoltdocsRoutePathWithFallback;
38
38
  }>;
39
39
  }>;
40
40
  sidebar?: Record<string, Array<{
41
41
  text: string;
42
- link: string;
42
+ link: BoltdocsRoutePathWithFallback;
43
43
  }>>;
44
44
  sidebarGroups?: Record<string, {
45
45
  title?: string | Record<string, string>;
@@ -109,24 +109,44 @@ interface BoltdocsVersionsConfig {
109
109
  prefix?: string;
110
110
  versions: BoltdocsVersionConfig[];
111
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
+ };
112
119
  /**
113
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.
114
124
  */
115
125
  interface BoltdocsPlugin {
116
126
  name: string;
117
127
  enforce?: 'pre' | 'post';
118
128
  version?: string;
119
129
  boltdocsVersion?: string;
120
- permissions?: string[];
121
130
  remarkPlugins?: unknown[];
122
131
  rehypePlugins?: unknown[];
123
132
  vitePlugins?: Plugin[];
124
133
  components?: Record<string, string>;
125
- hooks?: Record<string, any>;
134
+ /** Lifecycle hooks use the `PluginLifecycleHooks` type from the node API. */
135
+ hooks?: Record<string, (ctx: unknown) => Promise<void> | void>;
126
136
  }
127
137
  /**
128
- * Configuration for security-related settings.
129
- */
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
+ }
130
150
  interface BoltdocsSecurityConfig {
131
151
  headers?: Record<string, string>;
132
152
  enableCSP?: boolean;
@@ -166,9 +186,18 @@ interface BoltdocsGTMConfig {
166
186
  dataLayerName?: string;
167
187
  preview?: string;
168
188
  }
189
+ /**
190
+ * Configuration for Algolia DocSearch.
191
+ */
192
+ interface BoltdocsAlgoliaConfig {
193
+ appId: string;
194
+ apiKey: string;
195
+ indexName: string;
196
+ }
169
197
  interface BoltdocsIntegrationsConfig {
170
198
  ga4?: BoltdocsGA4Config;
171
199
  gtm?: BoltdocsGTMConfig;
200
+ algolia?: BoltdocsAlgoliaConfig;
172
201
  }
173
202
  /**
174
203
  * The root configuration object for Boltdocs.
@@ -181,6 +210,7 @@ interface BoltdocsConfig {
181
210
  i18n?: BoltdocsI18nConfig;
182
211
  versions?: BoltdocsVersionsConfig;
183
212
  plugins?: BoltdocsPlugin[];
213
+ collections?: BoltdocsCollectionsConfig;
184
214
  robots?: BoltdocsRobotsConfig;
185
215
  security?: BoltdocsSecurityConfig;
186
216
  seo?: BoltdocsSeoConfig;
@@ -196,8 +226,16 @@ interface BoltdocsConfig {
196
226
  declare global {
197
227
  namespace Boltdocs {
198
228
  interface Types {}
229
+ /**
230
+ * Marker interface augmented by generated code to provide strict route path typing.
231
+ * When no types have been generated (e.g., before first dev server start),
232
+ * keyof is never, and BoltdocsRoutePath falls back to string.
233
+ */
234
+ interface RoutePaths {}
199
235
  }
200
236
  }
237
+ type BoltdocsRoutePath = keyof Boltdocs.RoutePaths;
238
+ type BoltdocsRoutePathWithFallback = BoltdocsRoutePath extends never ? string : BoltdocsRoutePath;
201
239
  //#endregion
202
240
  //#region src/shared/config-utils.d.ts
203
241
  /**
@@ -205,6 +243,10 @@ declare global {
205
243
  * This is an identity function that provides IntelliSense in both
206
244
  * Node.js (config files) and client-side code (MDX examples).
207
245
  *
246
+ * @remarks
247
+ * Intended for use in `boltdocs.config.ts` (Node.js context). This function
248
+ * is **not** available as a client-side import from `boltdocs/client`.
249
+ *
208
250
  * @param config - The Boltdocs configuration object
209
251
  */
210
252
  declare function defineConfig(config: BoltdocsConfig): BoltdocsConfig;
@@ -238,7 +280,7 @@ interface BoltdocsPluginOptions {
238
280
  * @param config - The resolved Boltdocs configuration containing custom plugins and components
239
281
  * @returns A string of JavaScript code to be evaluated by the browser
240
282
  */
241
- declare function generateEntryCode(options: BoltdocsPluginOptions, config?: BoltdocsConfig, isBuild?: boolean): string;
283
+ declare function generateEntryCode(options: BoltdocsPluginOptions, config?: BoltdocsConfig): string;
242
284
  //#endregion
243
285
  //#region src/node/routes/types.d.ts
244
286
  /**
@@ -279,14 +321,23 @@ interface RouteMeta {
279
321
  /** The version this route belongs to, if versioning is configured */
280
322
  version?: string;
281
323
  /** Optional badge to display next to the sidebar item (e.g., 'New', 'Experimental') */
282
- badge?: string | {
283
- text: string;
284
- expires?: string;
285
- };
324
+ badge?: BadgeValue;
286
325
  /** Optional icon to display (Lucide icon name or raw SVG) */
287
326
  icon?: string;
288
327
  /** The tab this route belongs to, if tabs are configured */
289
328
  tab?: string;
329
+ /** The collection this route belongs to (from [name] directories like [blog]) */
330
+ collection?: string;
331
+ /** Tags for blog posts or other taxonomy */
332
+ tags?: string[];
333
+ /** Author identifier for blog posts */
334
+ author?: string;
335
+ /** Draft flag — excluded from production builds */
336
+ draft?: boolean;
337
+ /** Short excerpt/summary for list displays */
338
+ excerpt?: string;
339
+ /** Cover image for blog posts */
340
+ coverImage?: string;
290
341
  /** The extracted plain-text content of the page for search indexing */
291
342
  _content?: string;
292
343
  /** The raw markdown content of the page */
@@ -332,126 +383,77 @@ declare function normalizePath(p: string): string;
332
383
  declare function sanitizeFilename(name: string): string;
333
384
  //#endregion
334
385
  //#region src/node/plugins/plugin-types.d.ts
335
- /**
336
- * Permissions that a plugin can request to access specific Boltdocs capabilities.
337
- */
338
- type PluginPermission = 'fs:read' | 'fs:write' | 'vite:config' | 'mdx:remark' | 'mdx:rehype' | 'components' | 'hooks:build' | 'hooks:dev' | 'analytics:track' | 'analytics:config';
339
- /**
340
- * Shared context injected into every plugin lifecycle hook.
341
- */
342
386
  interface PluginContext {
343
- /** The full, resolved Boltdocs configuration (Readonly) */
344
387
  readonly config: BoltdocsConfig;
345
- /** A plugin-specific logger */
346
388
  readonly logger: PluginLogger;
347
- /** A shared store for dependency injection and state sharing between plugins */
348
389
  readonly store: PluginStore;
349
- /** Metadata about the current plugin */
350
390
  readonly meta: PluginMeta;
391
+ readonly docsDir: string;
392
+ readonly rootDir: string;
351
393
  }
352
- /**
353
- * Simple logger interface for plugins.
354
- */
355
394
  interface PluginLogger {
356
395
  info(message: string): void;
357
396
  warn(message: string): void;
358
397
  error(message: string | Error): void;
359
398
  debug(message: string): void;
360
399
  }
361
- /**
362
- * A shared key-value store that allows plugins to share state and configuration.
363
- */
364
400
  interface PluginStore {
365
- /** Get a value from the store. Keys are namespaced by plugin internally. */
366
401
  get<T = unknown>(pluginName: string, key: string): T | undefined;
367
- /** Set a value in the store. */
368
402
  set(pluginName: string, key: string, value: unknown): void;
369
- /** Check if a key exists in the store. */
370
403
  has(pluginName: string, key: string): boolean;
371
404
  }
372
- /**
373
- * Metadata for a plugin, used for identification and compatibility checks.
374
- */
375
405
  interface PluginMeta {
376
- /** Unique identifier for the plugin */
377
406
  name: string;
378
- /** Version of the plugin itself (semver) */
379
407
  version?: string;
380
- /** Minimum required version of Boltdocs (semver range) */
381
408
  boltdocsVersion?: string;
382
409
  }
383
- /**
384
- * Lifecycle hooks that a plugin can implement to hook into the build and dev processes.
385
- */
386
410
  interface PluginLifecycleHooks {
387
- /** Called before the build process starts */
388
411
  beforeBuild?: (ctx: PluginContext) => Promise<void> | void;
389
- /** Called after the build process finishes successfully */
390
412
  afterBuild?: (ctx: PluginContext) => Promise<void> | void;
391
- /** Called before the dev server starts */
392
413
  beforeDev?: (ctx: PluginContext) => Promise<void> | void;
393
- /** Called after the dev server is ready (configureServer) */
394
414
  afterDev?: (ctx: PluginContext) => Promise<void> | void;
395
- /** Called when the final Boltdocs config is resolved */
396
- configResolved?: (ctx: PluginContext, config: BoltdocsConfig) => void;
397
- /** Called when the build is closing */
398
415
  buildEnd?: (ctx: PluginContext) => Promise<void> | void;
416
+ transformMdx?: (ctx: PluginContext, params: {
417
+ code: string;
418
+ filePath: string;
419
+ }) => Promise<{
420
+ code: string;
421
+ }> | {
422
+ code: string;
423
+ };
424
+ transformHtml?: (ctx: PluginContext, params: {
425
+ html: string;
426
+ path: string;
427
+ }) => Promise<{
428
+ html: string;
429
+ }> | {
430
+ html: string;
431
+ };
399
432
  }
400
- /**
401
- * The extended, secure Boltdocs plugin interface.
402
- */
403
433
  interface SecureBoltdocsPlugin {
404
- /** A unique name for the plugin (e.g., 'boltdocs-plugin-mermaid') */
405
434
  name: string;
406
- /** Whether to run this plugin before or after default ones */
407
435
  enforce?: 'pre' | 'post';
408
- /** Version of the plugin (optional, but recommended for security) */
409
436
  version?: string;
410
- /** Minimum compatible Boltdocs version (optional, semver range) */
411
437
  boltdocsVersion?: string;
412
- /** List of permissions this plugin requires to operate */
413
- permissions?: PluginPermission[];
414
- /** Optional remark plugins to add to the MDX pipeline (requires 'mdx:remark' permission) */
415
438
  remarkPlugins?: unknown[];
416
- /** Optional rehype plugins to add to the MDX pipeline (requires 'mdx:rehype' permission) */
417
439
  rehypePlugins?: unknown[];
418
- /** Optional Vite plugins to inject into the build process (requires 'vite:config' permission) */
419
440
  vitePlugins?: Plugin[];
420
- /** Optional custom React components to register in MDX. Map of Name -> Module Path. (requires 'components' permission) */
421
441
  components?: Record<string, string>;
422
- /** Implementation of lifecycle hooks (requires 'hooks:build' or 'hooks:dev' permissions) */
423
442
  hooks?: PluginLifecycleHooks;
424
443
  }
425
444
  //#endregion
426
445
  //#region src/node/plugins/plugin-errors.d.ts
427
- /**
428
- * Base class for all plugin-related errors in Boltdocs.
429
- */
430
446
  declare class PluginError extends Error {
431
447
  readonly pluginName: string;
432
- constructor(pluginName: string, message: string);
448
+ name: string;
449
+ constructor(pluginName: string, message: string, options?: ErrorOptions);
433
450
  }
434
- /**
435
- * Specifically for schema or structure validation failures.
436
- */
437
451
  declare class PluginValidationError extends PluginError {
438
452
  constructor(pluginName: string, message: string);
439
453
  }
440
- /**
441
- * Specifically for version mismatch or compatibility issues.
442
- */
443
454
  declare class PluginCompatibilityError extends PluginError {
444
455
  constructor(pluginName: string, message: string);
445
456
  }
446
- /**
447
- * Specifically for attempts to use capabilities without proper permissions.
448
- */
449
- declare class PluginPermissionError extends PluginError {
450
- constructor(pluginName: string, permission: string);
451
- }
452
- /**
453
- * Specifically for errors that occur during the execution of a lifecycle hook.
454
- */
455
457
  declare class PluginHookError extends PluginError {
456
458
  readonly hookName: string;
457
459
  constructor(pluginName: string, hookName: string, originalError: Error);
@@ -483,99 +485,205 @@ declare class BoltdocsPluginStore implements PluginStore {
483
485
  }
484
486
  //#endregion
485
487
  //#region src/node/plugins/plugin-validator.d.ts
486
- /**
487
- * Enhanced Zod schema for secure plugins.
488
- */
489
- declare const SecurePluginSchema: z.ZodObject<{
490
- name: z.ZodString;
491
- enforce: z.ZodOptional<z.ZodEnum<{
492
- pre: "pre";
493
- post: "post";
494
- }>>;
495
- remarkPlugins: z.ZodOptional<z.ZodArray<z.ZodAny>>;
496
- rehypePlugins: z.ZodOptional<z.ZodArray<z.ZodAny>>;
497
- vitePlugins: z.ZodOptional<z.ZodArray<z.ZodAny>>;
498
- components: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
499
- version: z.ZodOptional<z.ZodString>;
500
- boltdocsVersion: z.ZodOptional<z.ZodString>;
501
- permissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
502
- hooks: z.ZodOptional<z.ZodObject<{
503
- beforeBuild: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
504
- afterBuild: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
505
- beforeDev: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
506
- afterDev: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
507
- configResolved: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
508
- buildEnd: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
509
- }, z.core.$strip>>;
510
- }, z.core.$strip>;
511
- /**
512
- * Validates a list of plugins for correctness, security, and compatibility.
513
- */
514
488
  declare function validatePlugins(plugins: any[], boltdocsVersion: string): SecureBoltdocsPlugin[];
489
+ //#endregion
490
+ //#region src/node/plugins/plugin-lifecycle.d.ts
491
+ declare class PluginLifecycleManager {
492
+ private plugins;
493
+ private config;
494
+ private store;
495
+ private docsDir;
496
+ private rootDir;
497
+ constructor(plugins: SecureBoltdocsPlugin[], config: BoltdocsConfig, docsDir?: string, rootDir?: string);
498
+ runHook(hookName: keyof PluginLifecycleHooks, ...args: unknown[]): Promise<void>;
499
+ runChain<TParams>(hookName: keyof PluginLifecycleHooks, initialParams: TParams): Promise<TParams>;
500
+ private getSortedPlugins;
501
+ private createStep;
502
+ private createContext;
503
+ private createLogger;
504
+ }
505
+ //#endregion
506
+ //#region ../../node_modules/.pnpm/@types+unist@3.0.3/node_modules/@types/unist/index.d.ts
507
+ // ## Interfaces
515
508
  /**
516
- * Helper to check if a specific permission is granted to a plugin.
509
+ * Info associated with nodes by the ecosystem.
510
+ *
511
+ * This space is guaranteed to never be specified by unist or specifications
512
+ * implementing unist.
513
+ * But you can use it in utilities and plugins to store data.
514
+ *
515
+ * This type can be augmented to register custom data.
516
+ * For example:
517
+ *
518
+ * ```ts
519
+ * declare module 'unist' {
520
+ * interface Data {
521
+ * // `someNode.data.myId` is typed as `number | undefined`
522
+ * myId?: number | undefined
523
+ * }
524
+ * }
525
+ * ```
517
526
  */
518
- declare function hasPermission(plugin: SecureBoltdocsPlugin, permission: PluginPermission): boolean;
519
- //#endregion
520
- //#region src/node/plugins/plugin-sandbox.d.ts
527
+ interface Data {}
521
528
  /**
522
- * The Sandbox provides a protective layer that ensures plugins only use
523
- * the capabilities they have explicitly requested permissions for.
529
+ * One place in a source file.
524
530
  */
525
- declare class PluginSandbox {
531
+ interface Point {
526
532
  /**
527
- * Validates if a plugin has the required permission for a capability.
528
- * Throws a PluginPermissionError if not granted.
533
+ * Line in a source file (1-indexed integer).
529
534
  */
530
- static checkPermission(plugin: SecureBoltdocsPlugin, permission: PluginPermission): void;
535
+ line: number;
531
536
  /**
532
- * Filters a plugin's capabilities based on its declared permissions.
533
- * This is used when aggregating plugins (remark, rehype, vite, components).
537
+ * Column in a source file (1-indexed integer).
534
538
  */
535
- static getSanitizedCapabilities(plugin: SecureBoltdocsPlugin): {
536
- remarkPlugins: unknown[] | undefined;
537
- rehypePlugins: unknown[] | undefined;
538
- vitePlugins: _$vite.Plugin<any>[] | undefined;
539
- components: Record<string, string> | undefined;
540
- };
539
+ column: number;
541
540
  /**
542
- * Wraps a hook execution with permission checks and error isolation.
541
+ * Character in a source file (0-indexed integer).
543
542
  */
544
- static executeWithIsolation<T>(plugin: SecureBoltdocsPlugin, requiredPermission: PluginPermission, hookName: string, action: () => Promise<T> | T): Promise<T | undefined>;
543
+ offset?: number | undefined;
545
544
  }
546
- //#endregion
547
- //#region src/node/plugins/plugin-lifecycle.d.ts
548
545
  /**
549
- * Manages the lifecycle of all loaded plugins, ensuring hooks are executed
550
- * in the correct order with proper error isolation and context.
546
+ * Position of a node in a source document.
547
+ *
548
+ * A position is a range between two points.
551
549
  */
552
- declare class PluginLifecycleManager {
553
- private plugins;
554
- private config;
555
- private store;
556
- constructor(plugins: SecureBoltdocsPlugin[], config: BoltdocsConfig);
550
+ interface Position {
557
551
  /**
558
- * Runs a specific hook for all plugins that implement it.
552
+ * Place of the first character of the parsed source region.
559
553
  */
560
- runHook(hookName: keyof PluginLifecycleHooks, ...args: any[]): Promise<void>;
554
+ start: Point;
561
555
  /**
562
- * Sorts plugins based on their 'enforce' property (pre -> normal -> post).
556
+ * Place of the first character after the parsed source region.
563
557
  */
564
- private getSortedPlugins;
558
+ end: Point;
559
+ }
560
+ /**
561
+ * Abstract unist node.
562
+ *
563
+ * The syntactic unit in unist syntax trees are called nodes.
564
+ *
565
+ * This interface is supposed to be extended.
566
+ * If you can use {@link Literal} or {@link Parent}, you should.
567
+ * But for example in markdown, a `thematicBreak` (`***`), is neither literal
568
+ * nor parent, but still a node.
569
+ */
570
+ interface Node {
565
571
  /**
566
- * Creates a specialized context for a plugin.
572
+ * Node type.
567
573
  */
568
- private createContext;
574
+ type: string;
569
575
  /**
570
- * Creates a namespaced logger for a plugin.
576
+ * Info from the ecosystem.
571
577
  */
572
- private createLogger;
578
+ data?: Data | undefined;
579
+ /**
580
+ * Position of a node in a source document.
581
+ *
582
+ * Nodes that are generated (not in the original source document) must not
583
+ * have a position.
584
+ */
585
+ position?: Position | undefined;
586
+ }
587
+ /**
588
+ * Abstract unist node that contains other nodes (*children*).
589
+ *
590
+ * This interface is supposed to be extended.
591
+ *
592
+ * For example, in XML, an element is a parent of different things, such as
593
+ * comments, text, and further elements.
594
+ */
595
+ interface Parent extends Node {
596
+ /**
597
+ * List of children.
598
+ */
599
+ children: Node[];
573
600
  }
574
601
  //#endregion
575
- //#region src/node/plugins/index.d.ts
602
+ //#region src/node/mdx/types.d.ts
603
+ interface MdxJsxAttributeValueExpression {
604
+ type: 'mdxJsxAttributeValueExpression';
605
+ value: string;
606
+ data?: {
607
+ estree?: any;
608
+ };
609
+ }
610
+ interface MdxJsxAttribute {
611
+ type: 'mdxJsxAttribute';
612
+ name: string;
613
+ value?: string | MdxJsxAttributeValueExpression;
614
+ }
615
+ interface MdxJsxElement {
616
+ type: 'mdxJsxFlowElement' | 'mdxJsxTextElement';
617
+ name: string | null;
618
+ attributes?: MdxJsxAttribute[];
619
+ children?: any[];
620
+ }
621
+ interface ElementNode {
622
+ type: 'element';
623
+ tagName: string;
624
+ properties?: Record<string, any>;
625
+ children?: any[];
626
+ }
627
+ //#endregion
628
+ //#region src/node/mdx/shiki-adapter.d.ts
629
+ interface ParsedMeta {
630
+ title?: string;
631
+ lineNumbers?: boolean;
632
+ wordWrap?: boolean;
633
+ [key: string]: any;
634
+ }
576
635
  /**
577
- * Utility to create a Boltdocs plugin with full type safety.
636
+ * Parses a meta string into a structured ParsedMeta object.
578
637
  */
638
+ declare function parseMetaString(metaStr: string): ParsedMeta;
639
+ //#endregion
640
+ //#region src/node/plugins/plugin-utils.d.ts
641
+ interface NodeWithHProperties extends Node {
642
+ data?: {
643
+ hProperties?: Record<string, unknown>;
644
+ [key: string]: unknown;
645
+ };
646
+ }
647
+ /**
648
+ * General, type-safe utility to visit nodes in the AST (MDAST/HAST/MDX).
649
+ */
650
+ 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;
651
+ declare function visitRehypeElements(tree: Node, tagName: string, callback: (node: ElementNode, index: number, parent: Parent) => void | number | boolean | symbol): void;
652
+ declare function visitMdxElements(tree: Node, name: string | string[], callback: (node: MdxJsxElement, index: number, parent: Parent) => void | number | boolean | symbol): void;
653
+ declare function setNodeProperty(node: NodeWithHProperties, key: string, value: unknown): void;
654
+ declare function getNodeProperty(node: NodeWithHProperties, key: string): unknown;
655
+ declare function createMdxAttribute(name: string, value: unknown): MdxJsxAttribute;
656
+ declare function createRehypeElement(tagName: string, properties?: Record<string, unknown>, children?: Node[]): ElementNode;
657
+ declare function createMdxElement(name: string, attributes?: Record<string, unknown>, children?: Node[], isFlow?: boolean): MdxJsxElement;
658
+ declare function visitRemarkHeadings(tree: Node, callback: (node: any, index: number, parent: Parent) => void | number | boolean | symbol): void;
659
+ declare function visitRemarkLinks(tree: Node, callback: (node: any, index: number, parent: Parent) => void | number | boolean | symbol): void;
660
+ declare function addNodeClass(node: ElementNode, className: string): void;
661
+ declare function removeNodeClass(node: ElementNode, className: string): void;
662
+ declare function hasNodeClass(node: ElementNode, className: string): boolean;
663
+ //#endregion
664
+ //#region src/node/mdx/constants.d.ts
665
+ declare const MDX_NODES: {
666
+ readonly ROOT: "root";
667
+ readonly ELEMENT: "element";
668
+ readonly TEXT: "text";
669
+ readonly COMMENT: "comment";
670
+ readonly CODE: "code";
671
+ readonly INLINE_CODE: "inlineCode";
672
+ readonly HEADING: "heading";
673
+ readonly PARAGRAPH: "paragraph";
674
+ readonly LINK: "link";
675
+ readonly IMAGE: "image";
676
+ readonly LIST: "list";
677
+ readonly LIST_ITEM: "listItem";
678
+ readonly JSX_FLOW_ELEMENT: "mdxJsxFlowElement";
679
+ readonly JSX_TEXT_ELEMENT: "mdxJsxTextElement";
680
+ readonly JSX_ATTRIBUTE: "mdxJsxAttribute";
681
+ readonly FLOW_EXPRESSION: "mdxFlowExpression";
682
+ readonly TEXT_EXPRESSION: "mdxTextExpression";
683
+ readonly ESM: "mdxjsEsm";
684
+ };
685
+ //#endregion
686
+ //#region src/node/plugins/index.d.ts
579
687
  declare function createPlugin(plugin: SecureBoltdocsPlugin): SecureBoltdocsPlugin;
580
688
  //#endregion
581
689
  //#region src/node/index.d.ts
@@ -586,4 +694,4 @@ declare function boltdocs(options?: BoltdocsPluginOptions): Promise<Plugin[]>;
586
694
  */
587
695
  declare function createViteConfig(root: string, mode?: 'development' | 'production'): Promise<InlineConfig>;
588
696
  //#endregion
589
- export { type BoltdocsConfig, type BoltdocsPlugin, type BoltdocsPluginOptions, BoltdocsPluginStore, type BoltdocsThemeConfig, PluginCompatibilityError, PluginContext, PluginError, PluginHookError, PluginLifecycleHooks, PluginLifecycleManager, PluginLogger, PluginMeta, PluginPermission, PluginPermissionError, PluginSandbox, PluginStore, PluginValidationError, type RouteMeta, SecureBoltdocsPlugin, SecurePluginSchema, createPlugin, createViteConfig, boltdocs as default, defineConfig, generateEntryCode, hasPermission, normalizePath, resolveConfig, sanitizeFilename, validatePlugins };
697
+ 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, generateEntryCode, getNodeProperty, hasNodeClass, normalizePath, parseMetaString, removeNodeClass, resolveConfig, sanitizeFilename, setNodeProperty, validatePlugins, visitMdxElements, visitNodes, visitRehypeElements, visitRemarkHeadings, visitRemarkLinks };
@@ -3,4 +3,4 @@
3
3
  * Copyright (c) 2026 Jesus Alcala
4
4
  * Licensed under the MIT License.
5
5
  */
6
- import{d as e,l as t}from"../utils-CG65J0Sc.mjs";import{a as n,c as r,d as i,f as a,h as o,i as s,l as c,m as l,n as u,o as d,p as f,r as p,s as m,t as h,u as g}from"../node-_1jhMGYx.mjs";import{a as _,s as v}from"../doctor-Be7Ly1oM.mjs";export{g as BoltdocsPluginStore,i as PluginCompatibilityError,a as PluginError,f as PluginHookError,n as PluginLifecycleManager,l as PluginPermissionError,d as PluginSandbox,o as PluginValidationError,m as SecurePluginSchema,s as createPlugin,u as createViteConfig,h as default,v as defineConfig,p as generateEntryCode,r as hasPermission,t as normalizePath,_ as resolveConfig,e as sanitizeFilename,c as validatePlugins};
6
+ import{A as e,D as t,E as n,O as r,S as i,T as a,_ as o,a as s,b as c,c as l,d as u,f as d,g as f,h as p,i as m,k as h,l as g,m as _,n as v,o as y,p as b,r as x,s as S,t as C,u as w,v as T,x as E,y as D}from"../node-Y8_4ayje.mjs";import{f as O,u as k}from"../utils-BYITg7T5.mjs";import{m as A,p as j}from"../doctor-CgLA7_Uv.mjs";export{n as BoltdocsPluginStore,s as EXIT,E as MDX_NODES,t as PluginCompatibilityError,r as PluginError,h as PluginHookError,i as PluginLifecycleManager,e as PluginValidationError,y as SKIP,S as addNodeClass,l as createMdxAttribute,g as createMdxElement,m as createPlugin,w as createRehypeElement,v as createViteConfig,C as default,A as defineConfig,x as generateEntryCode,u as getNodeProperty,d as hasNodeClass,k as normalizePath,c as parseMetaString,b as removeNodeClass,j as resolveConfig,O as sanitizeFilename,_ as setNodeProperty,a as validatePlugins,p as visitMdxElements,f as visitNodes,o as visitRehypeElements,T as visitRemarkHeadings,D as visitRemarkLinks};
@@ -3,4 +3,4 @@
3
3
  * Copyright (c) 2026 Jesus Alcala
4
4
  * Licensed under the MIT License.
5
5
  */
6
- require(`../../chunk-CU-zTemE.cjs`);const e=require(`../../parser-CdNbqN5y.cjs`);let t=require(`node:worker_threads`);if(!t.parentPort)throw Error(`This file must be run as a worker thread.`);t.parentPort.on(`message`,async n=>{if(n.type===`PARSE_FILE`)try{let r=await e.t(n.file,n.docsDir,n.basePath,n.config);t.parentPort?.postMessage({type:`SUCCESS`,file:n.file,result:r})}catch(e){t.parentPort?.postMessage({type:`ERROR`,file:n.file,error:e.message||`Unknown parsing error`})}});
6
+ require(`../../chunk-CU-zTemE.cjs`);const e=require(`../../parser-B7-6PyQz.cjs`);let t=require(`node:worker_threads`);if(!t.parentPort)throw Error(`This file must be run as a worker thread.`);t.parentPort.on(`message`,async n=>{if(n.type===`PARSE_FILE`)try{let r=await e.t(n.file,n.docsDir,n.basePath,n.config);t.parentPort?.postMessage({type:`SUCCESS`,file:n.file,result:r})}catch(e){t.parentPort?.postMessage({type:`ERROR`,file:n.file,error:e.message||`Unknown parsing error`})}});
@@ -3,4 +3,4 @@
3
3
  * Copyright (c) 2026 Jesus Alcala
4
4
  * Licensed under the MIT License.
5
5
  */
6
- import{n as e}from"../../parser-nE792MLO.mjs";import{parentPort as t}from"node:worker_threads";if(!t)throw Error(`This file must be run as a worker thread.`);t.on(`message`,async n=>{if(n.type===`PARSE_FILE`)try{let r=await e(n.file,n.docsDir,n.basePath,n.config);t?.postMessage({type:`SUCCESS`,file:n.file,result:r})}catch(e){t?.postMessage({type:`ERROR`,file:n.file,error:e.message||`Unknown parsing error`})}});export{};
6
+ import{n as e}from"../../parser-WGZdWs0X.mjs";import{parentPort as t}from"node:worker_threads";if(!t)throw Error(`This file must be run as a worker thread.`);t.on(`message`,async n=>{if(n.type===`PARSE_FILE`)try{let r=await e(n.file,n.docsDir,n.basePath,n.config);t?.postMessage({type:`SUCCESS`,file:n.file,result:r})}catch(e){t?.postMessage({type:`ERROR`,file:n.file,error:e.message||`Unknown parsing error`})}});export{};