boltdocs 2.5.5 → 2.5.6

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 (96) hide show
  1. package/bin/boltdocs.js +1 -1
  2. package/dist/cache-Cr8W2zgZ.cjs +6 -0
  3. package/dist/cache-DFdakSmR.mjs +6 -0
  4. package/dist/client/index.d.mts +1276 -861
  5. package/dist/client/index.d.ts +1276 -861
  6. package/dist/client/index.js +6 -1
  7. package/dist/client/index.mjs +6 -1
  8. package/dist/client/ssr.cjs +6 -0
  9. package/dist/client/ssr.d.cts +80 -0
  10. package/dist/client/ssr.d.mts +63 -61
  11. package/dist/client/ssr.mjs +6 -1
  12. package/dist/client/theme/neutral.css +388 -0
  13. package/dist/node/cli-entry.cjs +8 -0
  14. package/dist/node/cli-entry.d.cts +2 -0
  15. package/dist/node/cli-entry.d.mts +2 -1
  16. package/dist/node/cli-entry.mjs +7 -5
  17. package/dist/node/index.cjs +6 -0
  18. package/dist/node/index.d.cts +574 -0
  19. package/dist/node/index.d.mts +385 -378
  20. package/dist/node/index.mjs +6 -1
  21. package/dist/node-CWXme96p.mjs +73 -0
  22. package/dist/node-VYfhzGrh.cjs +73 -0
  23. package/dist/package-BY8Jd2j4.cjs +6 -0
  24. package/dist/package-OFZf0s2j.mjs +6 -0
  25. package/dist/search-dialog-BeNyI_KQ.mjs +6 -0
  26. package/dist/search-dialog-dYsCAk5S.js +6 -0
  27. package/dist/use-search-D25n0PrV.mjs +6 -0
  28. package/dist/use-search-WuzdH1cJ.js +6 -0
  29. package/package.json +16 -12
  30. package/src/client/app/index.tsx +15 -12
  31. package/src/client/components/default-layout.tsx +21 -19
  32. package/src/client/hooks/use-i18n.ts +1 -1
  33. package/src/client/hooks/use-routes.ts +1 -1
  34. package/src/client/hooks/use-version.ts +1 -1
  35. package/src/client/store/boltdocs-context.tsx +119 -0
  36. package/CHANGELOG.md +0 -98
  37. package/dist/cache-3FOEPC2P.mjs +0 -1
  38. package/dist/chunk-5B5NKOW6.mjs +0 -77
  39. package/dist/chunk-J2PTDWZM.mjs +0 -1
  40. package/dist/chunk-TP5KMRD3.mjs +0 -1
  41. package/dist/chunk-Y4RE5KI7.mjs +0 -1
  42. package/dist/client/ssr.d.ts +0 -78
  43. package/dist/client/ssr.js +0 -1
  44. package/dist/node/cli-entry.d.ts +0 -1
  45. package/dist/node/cli-entry.js +0 -82
  46. package/dist/node/index.d.ts +0 -567
  47. package/dist/node/index.js +0 -77
  48. package/dist/package-QFIAETHR.mjs +0 -1
  49. package/dist/search-dialog-O6VLVSOA.mjs +0 -1
  50. package/src/client/store/use-boltdocs-store.ts +0 -44
  51. package/src/node/cache.ts +0 -408
  52. package/src/node/cli/build.ts +0 -53
  53. package/src/node/cli/dev.ts +0 -22
  54. package/src/node/cli/doctor.ts +0 -243
  55. package/src/node/cli/index.ts +0 -9
  56. package/src/node/cli/ui.ts +0 -54
  57. package/src/node/cli-entry.ts +0 -24
  58. package/src/node/config.ts +0 -382
  59. package/src/node/errors.ts +0 -44
  60. package/src/node/index.ts +0 -84
  61. package/src/node/mdx/cache.ts +0 -12
  62. package/src/node/mdx/highlighter.ts +0 -47
  63. package/src/node/mdx/index.ts +0 -122
  64. package/src/node/mdx/rehype-shiki.ts +0 -62
  65. package/src/node/mdx/remark-code-meta.ts +0 -35
  66. package/src/node/mdx/remark-shiki.ts +0 -61
  67. package/src/node/plugin/entry.ts +0 -87
  68. package/src/node/plugin/html.ts +0 -99
  69. package/src/node/plugin/index.ts +0 -478
  70. package/src/node/plugin/types.ts +0 -9
  71. package/src/node/plugins/index.ts +0 -17
  72. package/src/node/plugins/plugin-errors.ts +0 -62
  73. package/src/node/plugins/plugin-lifecycle.ts +0 -117
  74. package/src/node/plugins/plugin-sandbox.ts +0 -59
  75. package/src/node/plugins/plugin-store.ts +0 -54
  76. package/src/node/plugins/plugin-types.ts +0 -107
  77. package/src/node/plugins/plugin-validator.ts +0 -105
  78. package/src/node/routes/cache.ts +0 -28
  79. package/src/node/routes/index.ts +0 -293
  80. package/src/node/routes/parser.ts +0 -262
  81. package/src/node/routes/sorter.ts +0 -42
  82. package/src/node/routes/types.ts +0 -61
  83. package/src/node/schema/config.ts +0 -195
  84. package/src/node/schema/frontmatter.ts +0 -17
  85. package/src/node/search/index.ts +0 -55
  86. package/src/node/security/constants/index.ts +0 -10
  87. package/src/node/security/csp.ts +0 -31
  88. package/src/node/security/headers.ts +0 -27
  89. package/src/node/ssg/index.ts +0 -205
  90. package/src/node/ssg/meta.ts +0 -33
  91. package/src/node/ssg/options.ts +0 -15
  92. package/src/node/ssg/robots.ts +0 -53
  93. package/src/node/ssg/sitemap.ts +0 -55
  94. package/src/node/utils.ts +0 -349
  95. package/tsconfig.json +0 -26
  96. package/tsup.config.ts +0 -56
@@ -1,567 +0,0 @@
1
- import * as vite from 'vite';
2
- import { Plugin, InlineConfig } from 'vite';
3
- import { z } from 'zod';
4
-
5
- /**
6
- * Permissions that a plugin can request to access specific Boltdocs capabilities.
7
- */
8
- type PluginPermission = 'fs:read' | 'fs:write' | 'vite:config' | 'mdx:remark' | 'mdx:rehype' | 'components' | 'hooks:build' | 'hooks:dev';
9
- /**
10
- * Shared context injected into every plugin lifecycle hook.
11
- */
12
- interface PluginContext {
13
- /** The full, resolved Boltdocs configuration (Readonly) */
14
- readonly config: BoltdocsConfig;
15
- /** A plugin-specific logger */
16
- readonly logger: PluginLogger;
17
- /** A shared store for dependency injection and state sharing between plugins */
18
- readonly store: PluginStore;
19
- /** Metadata about the current plugin */
20
- readonly meta: PluginMeta;
21
- }
22
- /**
23
- * Simple logger interface for plugins.
24
- */
25
- interface PluginLogger {
26
- info(message: string): void;
27
- warn(message: string): void;
28
- error(message: string | Error): void;
29
- debug(message: string): void;
30
- }
31
- /**
32
- * A shared key-value store that allows plugins to share state and configuration.
33
- */
34
- interface PluginStore {
35
- /** Get a value from the store. Keys are namespaced by plugin internally. */
36
- get<T = unknown>(pluginName: string, key: string): T | undefined;
37
- /** Set a value in the store. */
38
- set(pluginName: string, key: string, value: unknown): void;
39
- /** Check if a key exists in the store. */
40
- has(pluginName: string, key: string): boolean;
41
- }
42
- /**
43
- * Metadata for a plugin, used for identification and compatibility checks.
44
- */
45
- interface PluginMeta {
46
- /** Unique identifier for the plugin */
47
- name: string;
48
- /** Version of the plugin itself (semver) */
49
- version?: string;
50
- /** Minimum required version of Boltdocs (semver range) */
51
- boltdocsVersion?: string;
52
- }
53
- /**
54
- * Lifecycle hooks that a plugin can implement to hook into the build and dev processes.
55
- */
56
- interface PluginLifecycleHooks {
57
- /** Called before the build process starts */
58
- beforeBuild?: (ctx: PluginContext) => Promise<void> | void;
59
- /** Called after the build process finishes successfully */
60
- afterBuild?: (ctx: PluginContext) => Promise<void> | void;
61
- /** Called before the dev server starts */
62
- beforeDev?: (ctx: PluginContext) => Promise<void> | void;
63
- /** Called after the dev server is ready (configureServer) */
64
- afterDev?: (ctx: PluginContext) => Promise<void> | void;
65
- /** Called when the final Boltdocs config is resolved */
66
- configResolved?: (ctx: PluginContext, config: BoltdocsConfig) => void;
67
- /** Called when the build is closing */
68
- buildEnd?: (ctx: PluginContext) => Promise<void> | void;
69
- }
70
- /**
71
- * The extended, secure Boltdocs plugin interface.
72
- */
73
- interface SecureBoltdocsPlugin {
74
- /** A unique name for the plugin (e.g., 'boltdocs-plugin-mermaid') */
75
- name: string;
76
- /** Whether to run this plugin before or after default ones */
77
- enforce?: 'pre' | 'post';
78
- /** Version of the plugin (optional, but recommended for security) */
79
- version?: string;
80
- /** Minimum compatible Boltdocs version (optional, semver range) */
81
- boltdocsVersion?: string;
82
- /** List of permissions this plugin requires to operate */
83
- permissions?: PluginPermission[];
84
- /** Optional remark plugins to add to the MDX pipeline (requires 'mdx:remark' permission) */
85
- remarkPlugins?: unknown[];
86
- /** Optional rehype plugins to add to the MDX pipeline (requires 'mdx:rehype' permission) */
87
- rehypePlugins?: unknown[];
88
- /** Optional Vite plugins to inject into the build process (requires 'vite:config' permission) */
89
- vitePlugins?: Plugin[];
90
- /** Optional custom React components to register in MDX. Map of Name -> Module Path. (requires 'components' permission) */
91
- components?: Record<string, string>;
92
- /** Implementation of lifecycle hooks (requires 'hooks:build' or 'hooks:dev' permissions) */
93
- hooks?: PluginLifecycleHooks;
94
- }
95
-
96
- /**
97
- * Represents a single social link in the configuration.
98
- */
99
- interface BoltdocsSocialLink {
100
- /** Identifier for the icon (e.g., 'github') */
101
- icon: 'discord' | 'x' | 'github' | 'bluesky' | string;
102
- /** The URL the social link points to */
103
- link: string;
104
- }
105
- /**
106
- * Configuration for the site footer.
107
- */
108
- interface BoltdocsFooterConfig {
109
- /** Text to display in the footer (HTML is supported) */
110
- text?: string;
111
- }
112
- /**
113
- * Theme-specific configuration options governing the appearance and navigation of the site.
114
- */
115
- interface BoltdocsThemeConfig {
116
- /** The global title of the documentation site (can be translated) */
117
- title?: string | Record<string, string>;
118
- /** The global description of the site (can be translated) */
119
- description?: string | Record<string, string>;
120
- /** URL path to the site logo or an object for light/dark versions */
121
- logo?: string | {
122
- dark: string;
123
- light: string;
124
- alt?: string;
125
- width?: number;
126
- height?: number;
127
- };
128
- /** Items to display in the top navigation bar */
129
- navbar?: Array<{
130
- /** Text to display (can be a string or a map of translations) */
131
- label: string | Record<string, string>;
132
- /** URL path or external link */
133
- href: string;
134
- }>;
135
- /** Items to display in the sidebar, organized optionally by group URLs */
136
- sidebar?: Record<string, Array<{
137
- text: string;
138
- link: string;
139
- }>>;
140
- /** Social links to display in the navigation bar */
141
- socialLinks?: BoltdocsSocialLink[];
142
- /** Site footer configuration */
143
- footer?: BoltdocsFooterConfig;
144
- /** Whether to show breadcrumbs navigation (default: true) */
145
- breadcrumbs?: boolean;
146
- /** URL template for 'Edit this page'. Use :path as a placeholder. */
147
- editLink?: string;
148
- /** URL for the 'Community help' link. */
149
- communityHelp?: string;
150
- /** The current version of the project (e.g., 'v2.8.9'). Displayed in the Navbar. */
151
- version?: string;
152
- /** The GitHub repository in the format 'owner/repo' to fetch and display star count. */
153
- githubRepo?: string;
154
- /**
155
- * URL path to the site favicon.
156
- * If not specified, the logo will be used if available.
157
- */
158
- favicon?: string;
159
- /**
160
- * The Open Graph image URL to display when the site is shared on social media.
161
- */
162
- ogImage?: string;
163
- /** Whether to show the 'Powered by LiteDocs' badge in the sidebar (default: true) */
164
- poweredBy?: boolean;
165
- /**
166
- * Top-level tabs for organizing documentation groups.
167
- * Tab discovery uses the (tab-id) directory syntax.
168
- */
169
- tabs?: Array<{
170
- id: string;
171
- /** Text to display (can be a string or a map of translations) */
172
- text: string | Record<string, string>;
173
- icon?: string;
174
- }>;
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;
184
- };
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
- copyMarkdown?: boolean | {
191
- text?: string;
192
- icon?: string;
193
- };
194
- }
195
- /**
196
- * Configuration for the robots.txt file.
197
- */
198
- type BoltdocsRobotsConfig = string | {
199
- /** User-agent rules */
200
- rules?: Array<{
201
- userAgent: string;
202
- /** Paths allowed to be crawled */
203
- allow?: string | string[];
204
- /** Paths disallowed to be crawled */
205
- disallow?: string | string[];
206
- }>;
207
- /** Sitemaps to include in the robots.txt */
208
- sitemaps?: string[];
209
- };
210
- /**
211
- * Configuration for a specific locale.
212
- */
213
- interface BoltdocsLocaleConfig {
214
- /** The display name of the locale */
215
- label?: string;
216
- /** The text direction (ltr or rtl) */
217
- direction?: 'ltr' | 'rtl';
218
- /** The HTML lang attribute value (e.g., 'en-US') */
219
- htmlLang?: string;
220
- /** The calendar system to use (e.g., 'gregory') */
221
- calendar?: string;
222
- }
223
- /**
224
- * Configuration for internationalization (i18n).
225
- */
226
- interface BoltdocsI18nConfig {
227
- /** The default locale (e.g., 'en') */
228
- defaultLocale: string;
229
- /** Available locales and their basic display names (e.g., { en: 'English', es: 'Español' }) */
230
- locales: Record<string, string>;
231
- /** Detailed configuration for each locale */
232
- localeConfigs?: Record<string, BoltdocsLocaleConfig>;
233
- }
234
- /**
235
- * Configuration for a specific documentation version.
236
- */
237
- interface BoltdocsVersionConfig {
238
- /** The display name of the version (e.g., 'v2.0') */
239
- label: string;
240
- /** The URL path prefix for the version (e.g., '2.0') */
241
- path: string;
242
- }
243
- /**
244
- * Configuration for documentation versioning.
245
- */
246
- interface BoltdocsVersionsConfig {
247
- /** The default version path (e.g., 'v2') */
248
- defaultVersion: string;
249
- /**
250
- * Optional prefix for all version paths (e.g., 'v').
251
- * If set to 'v', version '1.1' will be available at '/docs/v1.1'.
252
- */
253
- prefix?: string;
254
- /** Available versions configurations */
255
- versions: BoltdocsVersionConfig[];
256
- }
257
- /**
258
- * Defines a Boltdocs plugin that can extend the build process and client-side functionality.
259
- */
260
- interface BoltdocsPlugin {
261
- /** A unique name for the plugin */
262
- name: string;
263
- /** Whether to run this plugin before or after default ones (optional) */
264
- enforce?: 'pre' | 'post';
265
- /** Version of the plugin (optional) */
266
- version?: string;
267
- /** Minimum compatible Boltdocs version (optional, semver range) */
268
- boltdocsVersion?: string;
269
- /** List of permissions this plugin requires to operate */
270
- permissions?: PluginPermission[];
271
- /** Optional remark plugins to add to the MDX pipeline */
272
- remarkPlugins?: unknown[];
273
- /** Optional rehype plugins to add to the MDX pipeline */
274
- rehypePlugins?: unknown[];
275
- /** Optional Vite plugins to inject into the build process */
276
- vitePlugins?: Plugin[];
277
- /** Optional custom React components to register in MDX. Map of Name -> Module Path. */
278
- components?: Record<string, string>;
279
- /** Implementation of lifecycle hooks */
280
- hooks?: PluginLifecycleHooks;
281
- }
282
- /**
283
- * Configuration for security-related settings.
284
- */
285
- interface BoltdocsSecurityConfig {
286
- /** Map of standard security headers to override or supplement defaults */
287
- headers?: Record<string, string>;
288
- /** Whether to enable Content Security Policy (CSP) generation (default: false) */
289
- enableCSP?: boolean;
290
- /** Additional custom headers to inject into responses */
291
- customHeaders?: Record<string, string>;
292
- }
293
- /**
294
- * The root configuration object for Boltdocs.
295
- */
296
- interface BoltdocsConfig {
297
- /** The base URL of the site, used for generating the sitemap */
298
- siteUrl?: string;
299
- /** The root directory containing markdown documentation files (default: 'docs') */
300
- docsDir?: string;
301
- /** Path to a custom HomePage component */
302
- homePage?: string;
303
- /** Configuration pertaining to the UI and appearance */
304
- theme?: BoltdocsThemeConfig;
305
- /** Configuration for internationalization */
306
- i18n?: BoltdocsI18nConfig;
307
- /** Configuration for documentation versioning */
308
- versions?: BoltdocsVersionsConfig;
309
- /** Custom plugins for extending functionality */
310
- plugins?: BoltdocsPlugin[];
311
- /** Configuration for the robots.txt file */
312
- robots?: BoltdocsRobotsConfig;
313
- /** Security-related settings and headers */
314
- security?: BoltdocsSecurityConfig;
315
- /** Low-level Vite configuration overrides */
316
- vite?: vite.InlineConfig;
317
- }
318
- declare function defineConfig(config: BoltdocsConfig): BoltdocsConfig;
319
- /**
320
- * Loads user's configuration file (e.g., `boltdocs.config.js` or `boltdocs.config.ts`) if it exists,
321
- * merges it with the default configuration, and returns the final `BoltdocsConfig`.
322
- *
323
- * @param docsDir - The directory containing the documentation files
324
- * @param root - The project root directory (defaults to process.cwd())
325
- * @returns The merged configuration object
326
- */
327
- declare function resolveConfig(docsDir: string, root?: string): Promise<BoltdocsConfig>;
328
-
329
- /**
330
- * Configuration options specifically for the Boltdocs Vite plugin.
331
- */
332
- interface BoltdocsPluginOptions {
333
- /** The root directory containing markdown files (default: 'docs') */
334
- docsDir?: string;
335
- /** Path to a custom home page component (relative to project root) to render at '/' */
336
- homePage?: string;
337
- }
338
-
339
- /**
340
- * Options for the Static Site Generation process.
341
- */
342
- interface SSGOptions {
343
- /** The root directory containing markdown documentation files */
344
- docsDir: string;
345
- /** The name of the documentation directory (e.g. 'docs') */
346
- docsDirName: string;
347
- /** The output directory where Vite placed the compiled `index.html` and assets */
348
- outDir: string;
349
- /** Pre-resolved config (avoids re-resolving during the SSG phase) */
350
- config?: BoltdocsConfig;
351
- }
352
-
353
- /**
354
- * Generates static HTML files and a \`sitemap.xml\` for all documentation routes.
355
- * Called automatically in the \`closeBundle\` hook of the Vite plugin during a production build.
356
- *
357
- * @param options - Configuration for paths and site metadata
358
- */
359
- declare function generateStaticPages(options: SSGOptions): Promise<void>;
360
-
361
- /**
362
- * Metadata representing a single documentation route.
363
- * This information is used to build the client-side router and the sidebar navigation.
364
- */
365
- interface RouteMeta {
366
- /** The final URL path for the route (e.g., '/docs/guide/start') */
367
- path: string;
368
- /** The absolute filesystem path to the source markdown/mdx file */
369
- componentPath: string;
370
- /** The title of the page, usually extracted from frontmatter or the filename */
371
- title: string;
372
- /** The relative path from the docs directory, used for edit links */
373
- filePath: string;
374
- /** Optional description of the page (for SEO/meta tags) */
375
- description?: string;
376
- /** Optional explicit position for ordering in the sidebar */
377
- sidebarPosition?: number;
378
- /** The group (directory) this route belongs to */
379
- group?: string;
380
- /** The display title for the route's group */
381
- groupTitle?: string;
382
- /** Optional explicit position for ordering the group itself */
383
- groupPosition?: number;
384
- /** Optional icon for the route's group */
385
- groupIcon?: string;
386
- /** Extracted markdown headings for search indexing */
387
- headings?: {
388
- level: number;
389
- text: string;
390
- id: string;
391
- }[];
392
- /** The locale this route belongs to, if i18n is configured */
393
- locale?: string;
394
- /** The version this route belongs to, if versioning is configured */
395
- version?: string;
396
- /** Optional badge to display next to the sidebar item (e.g., 'New', 'Experimental') */
397
- badge?: string | {
398
- text: string;
399
- expires?: string;
400
- };
401
- /** Optional icon to display (Lucide icon name or raw SVG) */
402
- icon?: string;
403
- /** The tab this route belongs to, if tabs are configured */
404
- tab?: string;
405
- /** The extracted plain-text content of the page for search indexing */
406
- _content?: string;
407
- /** The raw markdown content of the page */
408
- _rawContent?: string;
409
- }
410
-
411
- /**
412
- * Base class for all plugin-related errors in Boltdocs.
413
- */
414
- declare class PluginError extends Error {
415
- readonly pluginName: string;
416
- constructor(pluginName: string, message: string);
417
- }
418
- /**
419
- * Specifically for schema or structure validation failures.
420
- */
421
- declare class PluginValidationError extends PluginError {
422
- constructor(pluginName: string, message: string);
423
- }
424
- /**
425
- * Specifically for version mismatch or compatibility issues.
426
- */
427
- declare class PluginCompatibilityError extends PluginError {
428
- constructor(pluginName: string, message: string);
429
- }
430
- /**
431
- * Specifically for attempts to use capabilities without proper permissions.
432
- */
433
- declare class PluginPermissionError extends PluginError {
434
- constructor(pluginName: string, permission: string);
435
- }
436
- /**
437
- * Specifically for errors that occur during the execution of a lifecycle hook.
438
- */
439
- declare class PluginHookError extends PluginError {
440
- readonly hookName: string;
441
- constructor(pluginName: string, hookName: string, originalError: Error);
442
- }
443
-
444
- /**
445
- * Implementation of the shared plugin store.
446
- * Uses a namespaced approach to prevent key collisions between plugins.
447
- */
448
- declare class BoltdocsPluginStore implements PluginStore {
449
- private data;
450
- /**
451
- * Internal helper to create a namespaced key.
452
- */
453
- private getNamespaceKey;
454
- /**
455
- * Retrieves a value from the store. Returns a deep clone to prevent mutations (side-effects).
456
- */
457
- get<T = unknown>(pluginName: string, key: string): T | undefined;
458
- /**
459
- * Stores a value in the store. Key is automatically namespaced.
460
- */
461
- set(pluginName: string, key: string, value: unknown): void;
462
- /**
463
- * Checks for the existence of a key in the store.
464
- */
465
- has(pluginName: string, key: string): boolean;
466
- }
467
-
468
- /**
469
- * Enhanced Zod schema for secure plugins.
470
- */
471
- declare const SecurePluginSchema: z.ZodObject<{
472
- name: z.ZodString;
473
- enforce: z.ZodOptional<z.ZodEnum<{
474
- pre: "pre";
475
- post: "post";
476
- }>>;
477
- remarkPlugins: z.ZodOptional<z.ZodArray<z.ZodAny>>;
478
- rehypePlugins: z.ZodOptional<z.ZodArray<z.ZodAny>>;
479
- vitePlugins: z.ZodOptional<z.ZodArray<z.ZodAny>>;
480
- components: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
481
- version: z.ZodOptional<z.ZodString>;
482
- boltdocsVersion: z.ZodOptional<z.ZodString>;
483
- permissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
484
- hooks: z.ZodOptional<z.ZodObject<{
485
- beforeBuild: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
486
- afterBuild: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
487
- beforeDev: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
488
- afterDev: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
489
- configResolved: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
490
- buildEnd: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
491
- }, z.core.$strip>>;
492
- }, z.core.$strip>;
493
- /**
494
- * Validates a list of plugins for correctness, security, and compatibility.
495
- */
496
- declare function validatePlugins(plugins: any[], boltdocsVersion: string): SecureBoltdocsPlugin[];
497
- /**
498
- * Helper to check if a specific permission is granted to a plugin.
499
- */
500
- declare function hasPermission(plugin: SecureBoltdocsPlugin, permission: PluginPermission): boolean;
501
-
502
- /**
503
- * The Sandbox provides a protective layer that ensures plugins only use
504
- * the capabilities they have explicitly requested permissions for.
505
- */
506
- declare class PluginSandbox {
507
- /**
508
- * Validates if a plugin has the required permission for a capability.
509
- * Throws a PluginPermissionError if not granted.
510
- */
511
- static checkPermission(plugin: SecureBoltdocsPlugin, permission: PluginPermission): void;
512
- /**
513
- * Filters a plugin's capabilities based on its declared permissions.
514
- * This is used when aggregating plugins (remark, rehype, vite, components).
515
- */
516
- static getSanitizedCapabilities(plugin: SecureBoltdocsPlugin): {
517
- remarkPlugins: unknown[] | undefined;
518
- rehypePlugins: unknown[] | undefined;
519
- vitePlugins: vite.Plugin<any>[] | undefined;
520
- components: Record<string, string> | undefined;
521
- };
522
- /**
523
- * Wraps a hook execution with permission checks and error isolation.
524
- */
525
- static executeWithIsolation<T>(plugin: SecureBoltdocsPlugin, requiredPermission: PluginPermission, hookName: string, action: () => Promise<T> | T): Promise<T | undefined>;
526
- }
527
-
528
- /**
529
- * Manages the lifecycle of all loaded plugins, ensuring hooks are executed
530
- * in the correct order with proper error isolation and context.
531
- */
532
- declare class PluginLifecycleManager {
533
- private plugins;
534
- private config;
535
- private store;
536
- constructor(plugins: SecureBoltdocsPlugin[], config: BoltdocsConfig);
537
- /**
538
- * Runs a specific hook for all plugins that implement it.
539
- */
540
- runHook(hookName: keyof PluginLifecycleHooks, ...args: any[]): Promise<void>;
541
- /**
542
- * Sorts plugins based on their 'enforce' property (pre -> normal -> post).
543
- */
544
- private getSortedPlugins;
545
- /**
546
- * Creates a specialized context for a plugin.
547
- */
548
- private createContext;
549
- /**
550
- * Creates a namespaced logger for a plugin.
551
- */
552
- private createLogger;
553
- }
554
-
555
- /**
556
- * Utility to create a Boltdocs plugin with full type safety.
557
- */
558
- declare function createPlugin(plugin: SecureBoltdocsPlugin): SecureBoltdocsPlugin;
559
-
560
- declare function boltdocs(options?: BoltdocsPluginOptions): Promise<Plugin[]>;
561
- /**
562
- * Generates the complete Vite configuration for a Boltdocs project.
563
- * This is used by the Boltdocs CLI to run Vite without a user-defined vite.config.ts.
564
- */
565
- declare function createViteConfig(root: string, mode?: 'development' | 'production'): Promise<InlineConfig>;
566
-
567
- export { type BoltdocsConfig, type BoltdocsPlugin, type BoltdocsPluginOptions, BoltdocsPluginStore, type BoltdocsThemeConfig, PluginCompatibilityError, type PluginContext, PluginError, PluginHookError, type PluginLifecycleHooks, PluginLifecycleManager, type PluginLogger, type PluginMeta, type PluginPermission, PluginPermissionError, PluginSandbox, type PluginStore, PluginValidationError, type RouteMeta, type SSGOptions, type SecureBoltdocsPlugin, SecurePluginSchema, createPlugin, createViteConfig, boltdocs as default, defineConfig, generateStaticPages, hasPermission, resolveConfig, validatePlugins };