boltdocs 2.5.6 → 2.6.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 (112) hide show
  1. package/bin/boltdocs.js +2 -2
  2. package/dist/client/index.cjs +6 -0
  3. package/dist/client/{index.d.mts → index.d.cts} +134 -252
  4. package/dist/client/index.d.ts +135 -253
  5. package/dist/client/index.js +1 -1
  6. package/dist/client/theme/neutral.css +90 -50
  7. package/dist/node/cli-entry.cjs +2 -2
  8. package/dist/node/cli-entry.mjs +2 -2
  9. package/dist/node/index.cjs +1 -1
  10. package/dist/node/index.d.cts +150 -205
  11. package/dist/node/index.d.mts +150 -205
  12. package/dist/node/index.mjs +1 -1
  13. package/dist/node-BgvNl2Ay.mjs +89 -0
  14. package/dist/node-vkbb0MK7.cjs +89 -0
  15. package/dist/{package-OFZf0s2j.mjs → package-CR0HF9x3.mjs} +1 -1
  16. package/dist/{package-BY8Jd2j4.cjs → package-Dgmsc_l5.cjs} +1 -1
  17. package/dist/search-dialog-3lvKsbVG.js +6 -0
  18. package/dist/search-dialog-DMK5OpgH.cjs +6 -0
  19. package/dist/use-search-C9bxCqfF.js +6 -0
  20. package/dist/use-search-DcfZSunO.cjs +6 -0
  21. package/package.json +19 -22
  22. package/src/client/app/config-context.tsx +38 -5
  23. package/src/client/app/doc-page.tsx +34 -0
  24. package/src/client/app/mdx-component.tsx +2 -3
  25. package/src/client/app/mdx-components-context.tsx +27 -2
  26. package/src/client/app/routes-context.tsx +34 -0
  27. package/src/client/app/scroll-handler.tsx +7 -4
  28. package/src/client/app/theme-context.tsx +71 -67
  29. package/src/client/components/default-layout.tsx +13 -14
  30. package/src/client/components/docs-layout.tsx +1 -2
  31. package/src/client/components/icons-dev.tsx +36 -5
  32. package/src/client/components/mdx/admonition.tsx +11 -27
  33. package/src/client/components/mdx/badge.tsx +1 -1
  34. package/src/client/components/mdx/button.tsx +3 -3
  35. package/src/client/components/mdx/card.tsx +1 -1
  36. package/src/client/components/mdx/code-block.tsx +90 -80
  37. package/src/client/components/mdx/component-preview.tsx +1 -5
  38. package/src/client/components/mdx/component-props.tsx +1 -1
  39. package/src/client/components/mdx/field.tsx +4 -5
  40. package/src/client/components/mdx/file-tree.tsx +6 -3
  41. package/src/client/components/mdx/hooks/use-code-block.ts +2 -2
  42. package/src/client/components/mdx/image.tsx +1 -1
  43. package/src/client/components/mdx/link.tsx +2 -2
  44. package/src/client/components/mdx/list.tsx +1 -1
  45. package/src/client/components/mdx/table.tsx +1 -1
  46. package/src/client/components/mdx/tabs.tsx +1 -1
  47. package/src/client/components/primitives/breadcrumbs.tsx +1 -7
  48. package/src/client/components/primitives/button-group.tsx +1 -1
  49. package/src/client/components/primitives/button.tsx +1 -1
  50. package/src/client/components/primitives/code-block.tsx +113 -0
  51. package/src/client/components/primitives/link.tsx +23 -41
  52. package/src/client/components/primitives/menu.tsx +5 -6
  53. package/src/client/components/primitives/navbar.tsx +6 -18
  54. package/src/client/components/primitives/navigation-menu.tsx +4 -4
  55. package/src/client/components/primitives/on-this-page.tsx +6 -10
  56. package/src/client/components/primitives/page-nav.tsx +4 -9
  57. package/src/client/components/primitives/popover.tsx +1 -1
  58. package/src/client/components/primitives/search-dialog.tsx +3 -6
  59. package/src/client/components/primitives/sidebar.tsx +80 -22
  60. package/src/client/components/primitives/skeleton.tsx +1 -1
  61. package/src/client/components/primitives/tabs.tsx +4 -11
  62. package/src/client/components/primitives/tooltip.tsx +3 -3
  63. package/src/client/components/ui-base/breadcrumbs.tsx +4 -6
  64. package/src/client/components/ui-base/copy-markdown.tsx +2 -7
  65. package/src/client/components/ui-base/github-stars.tsx +2 -2
  66. package/src/client/components/ui-base/head.tsx +58 -51
  67. package/src/client/components/ui-base/loading.tsx +2 -2
  68. package/src/client/components/ui-base/navbar.tsx +12 -14
  69. package/src/client/components/ui-base/not-found.tsx +1 -1
  70. package/src/client/components/ui-base/on-this-page.tsx +6 -6
  71. package/src/client/components/ui-base/page-nav.tsx +4 -8
  72. package/src/client/components/ui-base/search-dialog.tsx +10 -8
  73. package/src/client/components/ui-base/sidebar.tsx +76 -23
  74. package/src/client/components/ui-base/tabs.tsx +9 -8
  75. package/src/client/components/ui-base/theme-toggle.tsx +2 -2
  76. package/src/client/hooks/use-i18n.ts +3 -3
  77. package/src/client/hooks/use-localized-to.ts +1 -1
  78. package/src/client/hooks/use-navbar.ts +8 -6
  79. package/src/client/hooks/use-routes.ts +19 -11
  80. package/src/client/hooks/use-search.ts +1 -1
  81. package/src/client/hooks/use-sidebar.ts +48 -2
  82. package/src/client/hooks/use-tabs.ts +6 -2
  83. package/src/client/hooks/use-version.ts +3 -3
  84. package/src/client/index.ts +22 -22
  85. package/src/client/ssg/boltdocs-shell.tsx +127 -0
  86. package/src/client/ssg/create-routes.tsx +179 -0
  87. package/src/client/ssg/index.ts +3 -0
  88. package/src/client/ssg/mdx-page.tsx +37 -0
  89. package/src/client/store/boltdocs-context.tsx +46 -99
  90. package/src/client/theme/neutral.css +90 -50
  91. package/src/client/types.ts +5 -33
  92. package/src/client/utils/react-to-text.ts +34 -0
  93. package/dist/cache-Cr8W2zgZ.cjs +0 -6
  94. package/dist/cache-DFdakSmR.mjs +0 -6
  95. package/dist/client/index.mjs +0 -6
  96. package/dist/client/ssr.cjs +0 -6
  97. package/dist/client/ssr.d.cts +0 -80
  98. package/dist/client/ssr.d.mts +0 -80
  99. package/dist/client/ssr.mjs +0 -6
  100. package/dist/node-CWXme96p.mjs +0 -73
  101. package/dist/node-VYfhzGrh.cjs +0 -73
  102. package/dist/search-dialog-BeNyI_KQ.mjs +0 -6
  103. package/dist/search-dialog-dYsCAk5S.js +0 -6
  104. package/dist/use-search-D25n0PrV.mjs +0 -6
  105. package/dist/use-search-WuzdH1cJ.js +0 -6
  106. package/src/client/app/index.tsx +0 -348
  107. package/src/client/app/mdx-page.tsx +0 -15
  108. package/src/client/app/preload.tsx +0 -66
  109. package/src/client/app/router.tsx +0 -30
  110. package/src/client/integrations/codesandbox.ts +0 -179
  111. package/src/client/integrations/index.ts +0 -1
  112. package/src/client/ssr.tsx +0 -65
@@ -3,124 +3,26 @@ import * as _$vite from "vite";
3
3
  import { InlineConfig, Plugin } from "vite";
4
4
  import { z } from "zod";
5
5
 
6
- //#region src/node/plugins/plugin-types.d.ts
7
- /**
8
- * Permissions that a plugin can request to access specific Boltdocs capabilities.
9
- */
10
- type PluginPermission = 'fs:read' | 'fs:write' | 'vite:config' | 'mdx:remark' | 'mdx:rehype' | 'components' | 'hooks:build' | 'hooks:dev';
11
- /**
12
- * Shared context injected into every plugin lifecycle hook.
13
- */
14
- interface PluginContext {
15
- /** The full, resolved Boltdocs configuration (Readonly) */
16
- readonly config: BoltdocsConfig;
17
- /** A plugin-specific logger */
18
- readonly logger: PluginLogger;
19
- /** A shared store for dependency injection and state sharing between plugins */
20
- readonly store: PluginStore;
21
- /** Metadata about the current plugin */
22
- readonly meta: PluginMeta;
23
- }
24
- /**
25
- * Simple logger interface for plugins.
26
- */
27
- interface PluginLogger {
28
- info(message: string): void;
29
- warn(message: string): void;
30
- error(message: string | Error): void;
31
- debug(message: string): void;
32
- }
33
- /**
34
- * A shared key-value store that allows plugins to share state and configuration.
35
- */
36
- interface PluginStore {
37
- /** Get a value from the store. Keys are namespaced by plugin internally. */
38
- get<T = unknown>(pluginName: string, key: string): T | undefined;
39
- /** Set a value in the store. */
40
- set(pluginName: string, key: string, value: unknown): void;
41
- /** Check if a key exists in the store. */
42
- has(pluginName: string, key: string): boolean;
43
- }
44
- /**
45
- * Metadata for a plugin, used for identification and compatibility checks.
46
- */
47
- interface PluginMeta {
48
- /** Unique identifier for the plugin */
49
- name: string;
50
- /** Version of the plugin itself (semver) */
51
- version?: string;
52
- /** Minimum required version of Boltdocs (semver range) */
53
- boltdocsVersion?: string;
54
- }
55
- /**
56
- * Lifecycle hooks that a plugin can implement to hook into the build and dev processes.
57
- */
58
- interface PluginLifecycleHooks {
59
- /** Called before the build process starts */
60
- beforeBuild?: (ctx: PluginContext) => Promise<void> | void;
61
- /** Called after the build process finishes successfully */
62
- afterBuild?: (ctx: PluginContext) => Promise<void> | void;
63
- /** Called before the dev server starts */
64
- beforeDev?: (ctx: PluginContext) => Promise<void> | void;
65
- /** Called after the dev server is ready (configureServer) */
66
- afterDev?: (ctx: PluginContext) => Promise<void> | void;
67
- /** Called when the final Boltdocs config is resolved */
68
- configResolved?: (ctx: PluginContext, config: BoltdocsConfig) => void;
69
- /** Called when the build is closing */
70
- buildEnd?: (ctx: PluginContext) => Promise<void> | void;
71
- }
72
- /**
73
- * The extended, secure Boltdocs plugin interface.
74
- */
75
- interface SecureBoltdocsPlugin {
76
- /** A unique name for the plugin (e.g., 'boltdocs-plugin-mermaid') */
77
- name: string;
78
- /** Whether to run this plugin before or after default ones */
79
- enforce?: 'pre' | 'post';
80
- /** Version of the plugin (optional, but recommended for security) */
81
- version?: string;
82
- /** Minimum compatible Boltdocs version (optional, semver range) */
83
- boltdocsVersion?: string;
84
- /** List of permissions this plugin requires to operate */
85
- permissions?: PluginPermission[];
86
- /** Optional remark plugins to add to the MDX pipeline (requires 'mdx:remark' permission) */
87
- remarkPlugins?: unknown[];
88
- /** Optional rehype plugins to add to the MDX pipeline (requires 'mdx:rehype' permission) */
89
- rehypePlugins?: unknown[];
90
- /** Optional Vite plugins to inject into the build process (requires 'vite:config' permission) */
91
- vitePlugins?: Plugin[];
92
- /** Optional custom React components to register in MDX. Map of Name -> Module Path. (requires 'components' permission) */
93
- components?: Record<string, string>;
94
- /** Implementation of lifecycle hooks (requires 'hooks:build' or 'hooks:dev' permissions) */
95
- hooks?: PluginLifecycleHooks;
96
- }
97
- //#endregion
98
- //#region src/node/config.d.ts
6
+ //#region src/shared/types.d.ts
99
7
  /**
100
8
  * Represents a single social link in the configuration.
101
9
  */
102
10
  interface BoltdocsSocialLink {
103
- /** Identifier for the icon (e.g., 'github') */
104
11
  icon: 'discord' | 'x' | 'github' | 'bluesky' | string;
105
- /** The URL the social link points to */
106
12
  link: string;
107
13
  }
108
14
  /**
109
15
  * Configuration for the site footer.
110
16
  */
111
17
  interface BoltdocsFooterConfig {
112
- /** Text to display in the footer (HTML is supported) */
113
18
  text?: string;
114
19
  }
115
20
  /**
116
- * Theme-specific configuration options governing the appearance and navigation of the site.
21
+ * Theme-specific configuration options.
117
22
  */
118
23
  interface BoltdocsThemeConfig {
119
- /** The global title of the documentation site (can be translated) */
120
24
  title?: string | Record<string, string>;
121
- /** The global description of the site (can be translated) */
122
25
  description?: string | Record<string, string>;
123
- /** URL path to the site logo or an object for light/dark versions */
124
26
  logo?: string | {
125
27
  dark: string;
126
28
  light: string;
@@ -128,190 +30,150 @@ interface BoltdocsThemeConfig {
128
30
  width?: number;
129
31
  height?: number;
130
32
  };
131
- /** Items to display in the top navigation bar */
132
33
  navbar?: Array<{
133
- /** Text to display (can be a string or a map of translations) */label: string | Record<string, string>; /** URL path or external link */
34
+ label: string | Record<string, string>;
134
35
  href: string;
135
36
  }>;
136
- /** Items to display in the sidebar, organized optionally by group URLs */
137
37
  sidebar?: Record<string, Array<{
138
38
  text: string;
139
39
  link: string;
140
40
  }>>;
141
- /** Social links to display in the navigation bar */
41
+ sidebarGroups?: Record<string, {
42
+ title?: string;
43
+ icon?: string;
44
+ }>;
142
45
  socialLinks?: BoltdocsSocialLink[];
143
- /** Site footer configuration */
144
46
  footer?: BoltdocsFooterConfig;
145
- /** Whether to show breadcrumbs navigation (default: true) */
146
47
  breadcrumbs?: boolean;
147
- /** URL template for 'Edit this page'. Use :path as a placeholder. */
148
48
  editLink?: string;
149
- /** URL for the 'Community help' link. */
150
49
  communityHelp?: string;
151
- /** The current version of the project (e.g., 'v2.8.9'). Displayed in the Navbar. */
152
50
  version?: string;
153
- /** The GitHub repository in the format 'owner/repo' to fetch and display star count. */
154
51
  githubRepo?: string;
155
- /**
156
- * URL path to the site favicon.
157
- * If not specified, the logo will be used if available.
158
- */
159
52
  favicon?: string;
160
- /**
161
- * The Open Graph image URL to display when the site is shared on social media.
162
- */
163
- ogImage?: string;
164
- /** Whether to show the 'Powered by LiteDocs' badge in the sidebar (default: true) */
165
53
  poweredBy?: boolean;
166
- /**
167
- * Top-level tabs for organizing documentation groups.
168
- * Tab discovery uses the (tab-id) directory syntax.
169
- */
170
54
  tabs?: Array<{
171
- id: string; /** Text to display (can be a string or a map of translations) */
55
+ id: string;
172
56
  text: string | Record<string, string>;
173
57
  icon?: string;
174
58
  }>;
175
- /**
176
- * The syntax highlighting theme for code blocks.
177
- * Supports any Shiki theme name (e.g., 'github-dark', 'one-dark-pro', 'aurora-x').
178
- * Can also be an object for multiple themes (e.g., { light: 'github-light', dark: 'github-dark' }).
179
- * Default: { light: 'github-light', dark: 'one-dark-pro' }
180
- */
181
- codeTheme?: string | {
182
- light: string;
183
- dark: string;
59
+ codeTheme?: ShikiTheme | {
60
+ light: ShikiTheme;
61
+ dark: ShikiTheme;
184
62
  };
185
- /**
186
- * Configuration for the 'Copy Markdown' button.
187
- * Can be a boolean or an object with text and icon.
188
- * Default: true
189
- */
190
63
  copyMarkdown?: boolean | {
191
64
  text?: string;
192
65
  icon?: string;
193
66
  };
194
67
  }
68
+ /**
69
+ * List of supported syntax highlighting themes.
70
+ */
71
+ type ShikiTheme = 'github-dark' | 'github-light' | 'tokyo-night' | 'dracula' | 'nord' | 'one-dark-pro' | 'one-light';
195
72
  /**
196
73
  * Configuration for the robots.txt file.
197
74
  */
198
75
  type BoltdocsRobotsConfig = string | {
199
- /** User-agent rules */rules?: Array<{
200
- userAgent: string; /** Paths allowed to be crawled */
201
- allow?: string | string[]; /** Paths disallowed to be crawled */
76
+ rules?: Array<{
77
+ userAgent: string;
78
+ allow?: string | string[];
202
79
  disallow?: string | string[];
203
- }>; /** Sitemaps to include in the robots.txt */
80
+ }>;
204
81
  sitemaps?: string[];
205
82
  };
206
83
  /**
207
84
  * Configuration for a specific locale.
208
85
  */
209
86
  interface BoltdocsLocaleConfig {
210
- /** The display name of the locale */
211
87
  label?: string;
212
- /** The text direction (ltr or rtl) */
213
88
  direction?: 'ltr' | 'rtl';
214
- /** The HTML lang attribute value (e.g., 'en-US') */
215
89
  htmlLang?: string;
216
- /** The calendar system to use (e.g., 'gregory') */
217
90
  calendar?: string;
218
91
  }
219
92
  /**
220
93
  * Configuration for internationalization (i18n).
221
94
  */
222
95
  interface BoltdocsI18nConfig {
223
- /** The default locale (e.g., 'en') */
224
96
  defaultLocale: string;
225
- /** Available locales and their basic display names (e.g., { en: 'English', es: 'Español' }) */
226
97
  locales: Record<string, string>;
227
- /** Detailed configuration for each locale */
228
98
  localeConfigs?: Record<string, BoltdocsLocaleConfig>;
229
99
  }
230
100
  /**
231
101
  * Configuration for a specific documentation version.
232
102
  */
233
103
  interface BoltdocsVersionConfig {
234
- /** The display name of the version (e.g., 'v2.0') */
235
104
  label: string;
236
- /** The URL path prefix for the version (e.g., '2.0') */
237
105
  path: string;
238
106
  }
239
107
  /**
240
108
  * Configuration for documentation versioning.
241
109
  */
242
110
  interface BoltdocsVersionsConfig {
243
- /** The default version path (e.g., 'v2') */
244
111
  defaultVersion: string;
245
- /**
246
- * Optional prefix for all version paths (e.g., 'v').
247
- * If set to 'v', version '1.1' will be available at '/docs/v1.1'.
248
- */
249
112
  prefix?: string;
250
- /** Available versions configurations */
251
113
  versions: BoltdocsVersionConfig[];
252
114
  }
253
115
  /**
254
- * Defines a Boltdocs plugin that can extend the build process and client-side functionality.
116
+ * Defines a Boltdocs plugin.
255
117
  */
256
118
  interface BoltdocsPlugin {
257
- /** A unique name for the plugin */
258
119
  name: string;
259
- /** Whether to run this plugin before or after default ones (optional) */
260
120
  enforce?: 'pre' | 'post';
261
- /** Version of the plugin (optional) */
262
121
  version?: string;
263
- /** Minimum compatible Boltdocs version (optional, semver range) */
264
122
  boltdocsVersion?: string;
265
- /** List of permissions this plugin requires to operate */
266
- permissions?: PluginPermission[];
267
- /** Optional remark plugins to add to the MDX pipeline */
123
+ permissions?: string[];
268
124
  remarkPlugins?: unknown[];
269
- /** Optional rehype plugins to add to the MDX pipeline */
270
125
  rehypePlugins?: unknown[];
271
- /** Optional Vite plugins to inject into the build process */
272
126
  vitePlugins?: Plugin[];
273
- /** Optional custom React components to register in MDX. Map of Name -> Module Path. */
274
127
  components?: Record<string, string>;
275
- /** Implementation of lifecycle hooks */
276
- hooks?: PluginLifecycleHooks;
128
+ hooks?: Record<string, any>;
277
129
  }
278
130
  /**
279
131
  * Configuration for security-related settings.
280
132
  */
281
133
  interface BoltdocsSecurityConfig {
282
- /** Map of standard security headers to override or supplement defaults */
283
134
  headers?: Record<string, string>;
284
- /** Whether to enable Content Security Policy (CSP) generation (default: false) */
285
135
  enableCSP?: boolean;
286
- /** Additional custom headers to inject into responses */
287
136
  customHeaders?: Record<string, string>;
288
137
  }
138
+ /**
139
+ * Configuration for SEO.
140
+ */
141
+ interface BoltdocsSeoConfig {
142
+ metatags?: Record<string, string>;
143
+ indexing?: 'all' | 'public';
144
+ thumbnails?: {
145
+ background?: string;
146
+ };
147
+ }
289
148
  /**
290
149
  * The root configuration object for Boltdocs.
291
150
  */
292
151
  interface BoltdocsConfig {
293
- /** The base URL of the site, used for generating the sitemap */
294
152
  siteUrl?: string;
295
- /** The root directory containing markdown documentation files (default: 'docs') */
296
153
  docsDir?: string;
297
- /** Path to a custom HomePage component */
154
+ base?: string;
298
155
  homePage?: string;
299
- /** Configuration pertaining to the UI and appearance */
300
156
  theme?: BoltdocsThemeConfig;
301
- /** Configuration for internationalization */
302
157
  i18n?: BoltdocsI18nConfig;
303
- /** Configuration for documentation versioning */
304
158
  versions?: BoltdocsVersionsConfig;
305
- /** Custom plugins for extending functionality */
306
159
  plugins?: BoltdocsPlugin[];
307
- /** Configuration for the robots.txt file */
308
160
  robots?: BoltdocsRobotsConfig;
309
- /** Security-related settings and headers */
310
161
  security?: BoltdocsSecurityConfig;
311
- /** Low-level Vite configuration overrides */
312
- vite?: _$vite.InlineConfig;
162
+ seo?: BoltdocsSeoConfig;
163
+ vite?: any;
313
164
  }
165
+ //#endregion
166
+ //#region src/shared/config-utils.d.ts
167
+ /**
168
+ * Type-safe helper for defining Boltdocs configuration.
169
+ * This is an identity function that provides IntelliSense in both
170
+ * Node.js (config files) and client-side code (MDX examples).
171
+ *
172
+ * @param config - The Boltdocs configuration object
173
+ */
314
174
  declare function defineConfig(config: BoltdocsConfig): BoltdocsConfig;
175
+ //#endregion
176
+ //#region src/node/config.d.ts
315
177
  /**
316
178
  * Loads user's configuration file (e.g., `boltdocs.config.js` or `boltdocs.config.ts`) if it exists,
317
179
  * merges it with the default configuration, and returns the final `BoltdocsConfig`.
@@ -333,29 +195,16 @@ interface BoltdocsPluginOptions {
333
195
  homePage?: string;
334
196
  }
335
197
  //#endregion
336
- //#region src/node/ssg/options.d.ts
337
- /**
338
- * Options for the Static Site Generation process.
339
- */
340
- interface SSGOptions {
341
- /** The root directory containing markdown documentation files */
342
- docsDir: string;
343
- /** The name of the documentation directory (e.g. 'docs') */
344
- docsDirName: string;
345
- /** The output directory where Vite placed the compiled `index.html` and assets */
346
- outDir: string;
347
- /** Pre-resolved config (avoids re-resolving during the SSG phase) */
348
- config?: BoltdocsConfig;
349
- }
350
- //#endregion
351
- //#region src/node/ssg/index.d.ts
198
+ //#region src/node/plugin/entry.d.ts
352
199
  /**
353
- * Generates static HTML files and a \`sitemap.xml\` for all documentation routes.
354
- * Called automatically in the \`closeBundle\` hook of the Vite plugin during a production build.
200
+ * Generates the raw source code for the virtual entry file (`\0virtual:boltdocs-entry`).
201
+ * This code initializes the client-side React application.
355
202
  *
356
- * @param options - Configuration for paths and site metadata
203
+ * @param options - Plugin options containing potential custom overrides (like `homePage` or `customCss`)
204
+ * @param config - The resolved Boltdocs configuration containing custom plugins and components
205
+ * @returns A string of JavaScript code to be evaluated by the browser
357
206
  */
358
- declare function generateStaticPages(options: SSGOptions): Promise<void>;
207
+ declare function generateEntryCode(options: BoltdocsPluginOptions, config?: BoltdocsConfig): string;
359
208
  //#endregion
360
209
  //#region src/node/routes/types.d.ts
361
210
  /**
@@ -383,6 +232,8 @@ interface RouteMeta {
383
232
  groupPosition?: number;
384
233
  /** Optional icon for the route's group */
385
234
  groupIcon?: string;
235
+ /** The sub-route group this route belongs to (from folders starting with _) */
236
+ subRouteGroup?: string;
386
237
  /** Extracted markdown headings for search indexing */
387
238
  headings?: {
388
239
  level: number;
@@ -406,6 +257,100 @@ interface RouteMeta {
406
257
  _content?: string;
407
258
  /** The raw markdown content of the page */
408
259
  _rawContent?: string;
260
+ /** Extracted SEO and Open Graph metadata from frontmatter */
261
+ seo?: Record<string, any>;
262
+ }
263
+ //#endregion
264
+ //#region src/node/plugins/plugin-types.d.ts
265
+ /**
266
+ * Permissions that a plugin can request to access specific Boltdocs capabilities.
267
+ */
268
+ type PluginPermission = 'fs:read' | 'fs:write' | 'vite:config' | 'mdx:remark' | 'mdx:rehype' | 'components' | 'hooks:build' | 'hooks:dev';
269
+ /**
270
+ * Shared context injected into every plugin lifecycle hook.
271
+ */
272
+ interface PluginContext {
273
+ /** The full, resolved Boltdocs configuration (Readonly) */
274
+ readonly config: BoltdocsConfig;
275
+ /** A plugin-specific logger */
276
+ readonly logger: PluginLogger;
277
+ /** A shared store for dependency injection and state sharing between plugins */
278
+ readonly store: PluginStore;
279
+ /** Metadata about the current plugin */
280
+ readonly meta: PluginMeta;
281
+ }
282
+ /**
283
+ * Simple logger interface for plugins.
284
+ */
285
+ interface PluginLogger {
286
+ info(message: string): void;
287
+ warn(message: string): void;
288
+ error(message: string | Error): void;
289
+ debug(message: string): void;
290
+ }
291
+ /**
292
+ * A shared key-value store that allows plugins to share state and configuration.
293
+ */
294
+ interface PluginStore {
295
+ /** Get a value from the store. Keys are namespaced by plugin internally. */
296
+ get<T = unknown>(pluginName: string, key: string): T | undefined;
297
+ /** Set a value in the store. */
298
+ set(pluginName: string, key: string, value: unknown): void;
299
+ /** Check if a key exists in the store. */
300
+ has(pluginName: string, key: string): boolean;
301
+ }
302
+ /**
303
+ * Metadata for a plugin, used for identification and compatibility checks.
304
+ */
305
+ interface PluginMeta {
306
+ /** Unique identifier for the plugin */
307
+ name: string;
308
+ /** Version of the plugin itself (semver) */
309
+ version?: string;
310
+ /** Minimum required version of Boltdocs (semver range) */
311
+ boltdocsVersion?: string;
312
+ }
313
+ /**
314
+ * Lifecycle hooks that a plugin can implement to hook into the build and dev processes.
315
+ */
316
+ interface PluginLifecycleHooks {
317
+ /** Called before the build process starts */
318
+ beforeBuild?: (ctx: PluginContext) => Promise<void> | void;
319
+ /** Called after the build process finishes successfully */
320
+ afterBuild?: (ctx: PluginContext) => Promise<void> | void;
321
+ /** Called before the dev server starts */
322
+ beforeDev?: (ctx: PluginContext) => Promise<void> | void;
323
+ /** Called after the dev server is ready (configureServer) */
324
+ afterDev?: (ctx: PluginContext) => Promise<void> | void;
325
+ /** Called when the final Boltdocs config is resolved */
326
+ configResolved?: (ctx: PluginContext, config: BoltdocsConfig) => void;
327
+ /** Called when the build is closing */
328
+ buildEnd?: (ctx: PluginContext) => Promise<void> | void;
329
+ }
330
+ /**
331
+ * The extended, secure Boltdocs plugin interface.
332
+ */
333
+ interface SecureBoltdocsPlugin {
334
+ /** A unique name for the plugin (e.g., 'boltdocs-plugin-mermaid') */
335
+ name: string;
336
+ /** Whether to run this plugin before or after default ones */
337
+ enforce?: 'pre' | 'post';
338
+ /** Version of the plugin (optional, but recommended for security) */
339
+ version?: string;
340
+ /** Minimum compatible Boltdocs version (optional, semver range) */
341
+ boltdocsVersion?: string;
342
+ /** List of permissions this plugin requires to operate */
343
+ permissions?: PluginPermission[];
344
+ /** Optional remark plugins to add to the MDX pipeline (requires 'mdx:remark' permission) */
345
+ remarkPlugins?: unknown[];
346
+ /** Optional rehype plugins to add to the MDX pipeline (requires 'mdx:rehype' permission) */
347
+ rehypePlugins?: unknown[];
348
+ /** Optional Vite plugins to inject into the build process (requires 'vite:config' permission) */
349
+ vitePlugins?: Plugin[];
350
+ /** Optional custom React components to register in MDX. Map of Name -> Module Path. (requires 'components' permission) */
351
+ components?: Record<string, string>;
352
+ /** Implementation of lifecycle hooks (requires 'hooks:build' or 'hooks:dev' permissions) */
353
+ hooks?: PluginLifecycleHooks;
409
354
  }
410
355
  //#endregion
411
356
  //#region src/node/plugins/plugin-errors.d.ts
@@ -571,4 +516,4 @@ declare function boltdocs(options?: BoltdocsPluginOptions): Promise<Plugin[]>;
571
516
  */
572
517
  declare function createViteConfig(root: string, mode?: 'development' | 'production'): Promise<InlineConfig>;
573
518
  //#endregion
574
- 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, type SSGOptions, SecureBoltdocsPlugin, SecurePluginSchema, createPlugin, createViteConfig, boltdocs as default, defineConfig, generateStaticPages, hasPermission, resolveConfig, validatePlugins };
519
+ 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, resolveConfig, validatePlugins };
@@ -3,4 +3,4 @@
3
3
  * Copyright (c) 2026 Jesus Alcala
4
4
  * Licensed under the MIT License.
5
5
  */
6
- import{a as e,c as t,d as n,f as r,h as i,i as a,l as o,m as s,n as c,o as l,p as u,r as d,s as f,t as p,u as m,v as h,x as g,y as _}from"../node-CWXme96p.mjs";d();export{m as BoltdocsPluginStore,n as PluginCompatibilityError,r as PluginError,u as PluginHookError,e as PluginLifecycleManager,s as PluginPermissionError,l as PluginSandbox,i as PluginValidationError,f as SecurePluginSchema,a as createPlugin,c as createViteConfig,p as default,_ as defineConfig,h as generateStaticPages,t as hasPermission,g as resolveConfig,o as validatePlugins};
6
+ import{_ as e,a as t,c as n,d as r,f as i,g 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-BgvNl2Ay.mjs";export{c as BoltdocsPluginStore,g as PluginCompatibilityError,r as PluginError,i as PluginHookError,s as PluginLifecycleManager,f as PluginPermissionError,t as PluginSandbox,l as PluginValidationError,d as SecurePluginSchema,p as createPlugin,u as createViteConfig,h as default,e as defineConfig,o as generateEntryCode,m as hasPermission,a as resolveConfig,n as validatePlugins};