boltdocs 2.5.5 → 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.
- package/bin/boltdocs.js +2 -2
- package/dist/client/index.cjs +6 -0
- package/dist/client/index.d.cts +1560 -0
- package/dist/client/index.d.ts +1219 -922
- package/dist/client/index.js +6 -1
- package/dist/client/theme/neutral.css +428 -0
- package/dist/node/cli-entry.cjs +8 -0
- package/dist/node/cli-entry.d.cts +2 -0
- package/dist/node/cli-entry.d.mts +2 -1
- package/dist/node/cli-entry.mjs +7 -5
- package/dist/node/index.cjs +6 -0
- package/dist/node/index.d.cts +519 -0
- package/dist/node/index.d.mts +374 -422
- package/dist/node/index.mjs +6 -1
- package/dist/node-BgvNl2Ay.mjs +89 -0
- package/dist/node-vkbb0MK7.cjs +89 -0
- package/dist/package-CR0HF9x3.mjs +6 -0
- package/dist/package-Dgmsc_l5.cjs +6 -0
- package/dist/search-dialog-3lvKsbVG.js +6 -0
- package/dist/search-dialog-DMK5OpgH.cjs +6 -0
- package/dist/use-search-C9bxCqfF.js +6 -0
- package/dist/use-search-DcfZSunO.cjs +6 -0
- package/package.json +26 -25
- package/src/client/app/config-context.tsx +38 -5
- package/src/client/app/doc-page.tsx +34 -0
- package/src/client/app/mdx-component.tsx +2 -3
- package/src/client/app/mdx-components-context.tsx +27 -2
- package/src/client/app/routes-context.tsx +34 -0
- package/src/client/app/scroll-handler.tsx +7 -4
- package/src/client/app/theme-context.tsx +71 -67
- package/src/client/components/default-layout.tsx +34 -33
- package/src/client/components/docs-layout.tsx +1 -2
- package/src/client/components/icons-dev.tsx +36 -5
- package/src/client/components/mdx/admonition.tsx +11 -27
- package/src/client/components/mdx/badge.tsx +1 -1
- package/src/client/components/mdx/button.tsx +3 -3
- package/src/client/components/mdx/card.tsx +1 -1
- package/src/client/components/mdx/code-block.tsx +90 -80
- package/src/client/components/mdx/component-preview.tsx +1 -5
- package/src/client/components/mdx/component-props.tsx +1 -1
- package/src/client/components/mdx/field.tsx +4 -5
- package/src/client/components/mdx/file-tree.tsx +6 -3
- package/src/client/components/mdx/hooks/use-code-block.ts +2 -2
- package/src/client/components/mdx/image.tsx +1 -1
- package/src/client/components/mdx/link.tsx +2 -2
- package/src/client/components/mdx/list.tsx +1 -1
- package/src/client/components/mdx/table.tsx +1 -1
- package/src/client/components/mdx/tabs.tsx +1 -1
- package/src/client/components/primitives/breadcrumbs.tsx +1 -7
- package/src/client/components/primitives/button-group.tsx +1 -1
- package/src/client/components/primitives/button.tsx +1 -1
- package/src/client/components/primitives/code-block.tsx +113 -0
- package/src/client/components/primitives/link.tsx +23 -41
- package/src/client/components/primitives/menu.tsx +5 -6
- package/src/client/components/primitives/navbar.tsx +6 -18
- package/src/client/components/primitives/navigation-menu.tsx +4 -4
- package/src/client/components/primitives/on-this-page.tsx +6 -10
- package/src/client/components/primitives/page-nav.tsx +4 -9
- package/src/client/components/primitives/popover.tsx +1 -1
- package/src/client/components/primitives/search-dialog.tsx +3 -6
- package/src/client/components/primitives/sidebar.tsx +80 -22
- package/src/client/components/primitives/skeleton.tsx +1 -1
- package/src/client/components/primitives/tabs.tsx +4 -11
- package/src/client/components/primitives/tooltip.tsx +3 -3
- package/src/client/components/ui-base/breadcrumbs.tsx +4 -6
- package/src/client/components/ui-base/copy-markdown.tsx +2 -7
- package/src/client/components/ui-base/github-stars.tsx +2 -2
- package/src/client/components/ui-base/head.tsx +58 -51
- package/src/client/components/ui-base/loading.tsx +2 -2
- package/src/client/components/ui-base/navbar.tsx +12 -14
- package/src/client/components/ui-base/not-found.tsx +1 -1
- package/src/client/components/ui-base/on-this-page.tsx +6 -6
- package/src/client/components/ui-base/page-nav.tsx +4 -8
- package/src/client/components/ui-base/search-dialog.tsx +10 -8
- package/src/client/components/ui-base/sidebar.tsx +76 -23
- package/src/client/components/ui-base/tabs.tsx +9 -8
- package/src/client/components/ui-base/theme-toggle.tsx +2 -2
- package/src/client/hooks/use-i18n.ts +3 -3
- package/src/client/hooks/use-localized-to.ts +1 -1
- package/src/client/hooks/use-navbar.ts +8 -6
- package/src/client/hooks/use-routes.ts +19 -11
- package/src/client/hooks/use-search.ts +1 -1
- package/src/client/hooks/use-sidebar.ts +48 -2
- package/src/client/hooks/use-tabs.ts +6 -2
- package/src/client/hooks/use-version.ts +3 -3
- package/src/client/index.ts +22 -22
- package/src/client/ssg/boltdocs-shell.tsx +127 -0
- package/src/client/ssg/create-routes.tsx +179 -0
- package/src/client/ssg/index.ts +3 -0
- package/src/client/ssg/mdx-page.tsx +37 -0
- package/src/client/store/boltdocs-context.tsx +66 -0
- package/src/client/theme/neutral.css +90 -50
- package/src/client/types.ts +5 -33
- package/src/client/utils/react-to-text.ts +34 -0
- package/CHANGELOG.md +0 -98
- package/dist/cache-3FOEPC2P.mjs +0 -1
- package/dist/chunk-5B5NKOW6.mjs +0 -77
- package/dist/chunk-J2PTDWZM.mjs +0 -1
- package/dist/chunk-TP5KMRD3.mjs +0 -1
- package/dist/chunk-Y4RE5KI7.mjs +0 -1
- package/dist/client/index.d.mts +0 -1263
- package/dist/client/index.mjs +0 -1
- package/dist/client/ssr.d.mts +0 -78
- package/dist/client/ssr.d.ts +0 -78
- package/dist/client/ssr.js +0 -1
- package/dist/client/ssr.mjs +0 -1
- package/dist/node/cli-entry.d.ts +0 -1
- package/dist/node/cli-entry.js +0 -82
- package/dist/node/index.d.ts +0 -567
- package/dist/node/index.js +0 -77
- package/dist/package-QFIAETHR.mjs +0 -1
- package/dist/search-dialog-O6VLVSOA.mjs +0 -1
- package/src/client/app/index.tsx +0 -345
- package/src/client/app/mdx-page.tsx +0 -15
- package/src/client/app/preload.tsx +0 -66
- package/src/client/app/router.tsx +0 -30
- package/src/client/integrations/codesandbox.ts +0 -179
- package/src/client/integrations/index.ts +0 -1
- package/src/client/ssr.tsx +0 -65
- package/src/client/store/use-boltdocs-store.ts +0 -44
- package/src/node/cache.ts +0 -408
- package/src/node/cli/build.ts +0 -53
- package/src/node/cli/dev.ts +0 -22
- package/src/node/cli/doctor.ts +0 -243
- package/src/node/cli/index.ts +0 -9
- package/src/node/cli/ui.ts +0 -54
- package/src/node/cli-entry.ts +0 -24
- package/src/node/config.ts +0 -382
- package/src/node/errors.ts +0 -44
- package/src/node/index.ts +0 -84
- package/src/node/mdx/cache.ts +0 -12
- package/src/node/mdx/highlighter.ts +0 -47
- package/src/node/mdx/index.ts +0 -122
- package/src/node/mdx/rehype-shiki.ts +0 -62
- package/src/node/mdx/remark-code-meta.ts +0 -35
- package/src/node/mdx/remark-shiki.ts +0 -61
- package/src/node/plugin/entry.ts +0 -87
- package/src/node/plugin/html.ts +0 -99
- package/src/node/plugin/index.ts +0 -478
- package/src/node/plugin/types.ts +0 -9
- package/src/node/plugins/index.ts +0 -17
- package/src/node/plugins/plugin-errors.ts +0 -62
- package/src/node/plugins/plugin-lifecycle.ts +0 -117
- package/src/node/plugins/plugin-sandbox.ts +0 -59
- package/src/node/plugins/plugin-store.ts +0 -54
- package/src/node/plugins/plugin-types.ts +0 -107
- package/src/node/plugins/plugin-validator.ts +0 -105
- package/src/node/routes/cache.ts +0 -28
- package/src/node/routes/index.ts +0 -293
- package/src/node/routes/parser.ts +0 -262
- package/src/node/routes/sorter.ts +0 -42
- package/src/node/routes/types.ts +0 -61
- package/src/node/schema/config.ts +0 -195
- package/src/node/schema/frontmatter.ts +0 -17
- package/src/node/search/index.ts +0 -55
- package/src/node/security/constants/index.ts +0 -10
- package/src/node/security/csp.ts +0 -31
- package/src/node/security/headers.ts +0 -27
- package/src/node/ssg/index.ts +0 -205
- package/src/node/ssg/meta.ts +0 -33
- package/src/node/ssg/options.ts +0 -15
- package/src/node/ssg/robots.ts +0 -53
- package/src/node/ssg/sitemap.ts +0 -55
- package/src/node/utils.ts +0 -349
- package/tsconfig.json +0 -26
- package/tsup.config.ts +0 -56
package/dist/node/index.d.mts
CHANGED
|
@@ -1,321 +1,179 @@
|
|
|
1
|
-
import * as vite from 'vite';
|
|
2
|
-
import { Plugin, InlineConfig } from 'vite';
|
|
3
|
-
import { z } from 'zod';
|
|
4
1
|
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
}
|
|
2
|
+
import * as _$vite from "vite";
|
|
3
|
+
import { InlineConfig, Plugin } from "vite";
|
|
4
|
+
import { z } from "zod";
|
|
95
5
|
|
|
6
|
+
//#region src/shared/types.d.ts
|
|
96
7
|
/**
|
|
97
8
|
* Represents a single social link in the configuration.
|
|
98
9
|
*/
|
|
99
10
|
interface BoltdocsSocialLink {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
/** The URL the social link points to */
|
|
103
|
-
link: string;
|
|
11
|
+
icon: 'discord' | 'x' | 'github' | 'bluesky' | string;
|
|
12
|
+
link: string;
|
|
104
13
|
}
|
|
105
14
|
/**
|
|
106
15
|
* Configuration for the site footer.
|
|
107
16
|
*/
|
|
108
17
|
interface BoltdocsFooterConfig {
|
|
109
|
-
|
|
110
|
-
text?: string;
|
|
18
|
+
text?: string;
|
|
111
19
|
}
|
|
112
20
|
/**
|
|
113
|
-
* Theme-specific configuration options
|
|
21
|
+
* Theme-specific configuration options.
|
|
114
22
|
*/
|
|
115
23
|
interface BoltdocsThemeConfig {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
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
|
-
};
|
|
24
|
+
title?: string | Record<string, string>;
|
|
25
|
+
description?: string | Record<string, string>;
|
|
26
|
+
logo?: string | {
|
|
27
|
+
dark: string;
|
|
28
|
+
light: string;
|
|
29
|
+
alt?: string;
|
|
30
|
+
width?: number;
|
|
31
|
+
height?: number;
|
|
32
|
+
};
|
|
33
|
+
navbar?: Array<{
|
|
34
|
+
label: string | Record<string, string>;
|
|
35
|
+
href: string;
|
|
36
|
+
}>;
|
|
37
|
+
sidebar?: Record<string, Array<{
|
|
38
|
+
text: string;
|
|
39
|
+
link: string;
|
|
40
|
+
}>>;
|
|
41
|
+
sidebarGroups?: Record<string, {
|
|
42
|
+
title?: string;
|
|
43
|
+
icon?: string;
|
|
44
|
+
}>;
|
|
45
|
+
socialLinks?: BoltdocsSocialLink[];
|
|
46
|
+
footer?: BoltdocsFooterConfig;
|
|
47
|
+
breadcrumbs?: boolean;
|
|
48
|
+
editLink?: string;
|
|
49
|
+
communityHelp?: string;
|
|
50
|
+
version?: string;
|
|
51
|
+
githubRepo?: string;
|
|
52
|
+
favicon?: string;
|
|
53
|
+
poweredBy?: boolean;
|
|
54
|
+
tabs?: Array<{
|
|
55
|
+
id: string;
|
|
56
|
+
text: string | Record<string, string>;
|
|
57
|
+
icon?: string;
|
|
58
|
+
}>;
|
|
59
|
+
codeTheme?: ShikiTheme | {
|
|
60
|
+
light: ShikiTheme;
|
|
61
|
+
dark: ShikiTheme;
|
|
62
|
+
};
|
|
63
|
+
copyMarkdown?: boolean | {
|
|
64
|
+
text?: string;
|
|
65
|
+
icon?: string;
|
|
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
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
disallow?: string | string[];
|
|
206
|
-
}>;
|
|
207
|
-
/** Sitemaps to include in the robots.txt */
|
|
208
|
-
sitemaps?: string[];
|
|
76
|
+
rules?: Array<{
|
|
77
|
+
userAgent: string;
|
|
78
|
+
allow?: string | string[];
|
|
79
|
+
disallow?: string | string[];
|
|
80
|
+
}>;
|
|
81
|
+
sitemaps?: string[];
|
|
209
82
|
};
|
|
210
83
|
/**
|
|
211
84
|
* Configuration for a specific locale.
|
|
212
85
|
*/
|
|
213
86
|
interface BoltdocsLocaleConfig {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
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;
|
|
87
|
+
label?: string;
|
|
88
|
+
direction?: 'ltr' | 'rtl';
|
|
89
|
+
htmlLang?: string;
|
|
90
|
+
calendar?: string;
|
|
222
91
|
}
|
|
223
92
|
/**
|
|
224
93
|
* Configuration for internationalization (i18n).
|
|
225
94
|
*/
|
|
226
95
|
interface BoltdocsI18nConfig {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
locales: Record<string, string>;
|
|
231
|
-
/** Detailed configuration for each locale */
|
|
232
|
-
localeConfigs?: Record<string, BoltdocsLocaleConfig>;
|
|
96
|
+
defaultLocale: string;
|
|
97
|
+
locales: Record<string, string>;
|
|
98
|
+
localeConfigs?: Record<string, BoltdocsLocaleConfig>;
|
|
233
99
|
}
|
|
234
100
|
/**
|
|
235
101
|
* Configuration for a specific documentation version.
|
|
236
102
|
*/
|
|
237
103
|
interface BoltdocsVersionConfig {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
/** The URL path prefix for the version (e.g., '2.0') */
|
|
241
|
-
path: string;
|
|
104
|
+
label: string;
|
|
105
|
+
path: string;
|
|
242
106
|
}
|
|
243
107
|
/**
|
|
244
108
|
* Configuration for documentation versioning.
|
|
245
109
|
*/
|
|
246
110
|
interface BoltdocsVersionsConfig {
|
|
247
|
-
|
|
248
|
-
|
|
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[];
|
|
111
|
+
defaultVersion: string;
|
|
112
|
+
prefix?: string;
|
|
113
|
+
versions: BoltdocsVersionConfig[];
|
|
256
114
|
}
|
|
257
115
|
/**
|
|
258
|
-
* Defines a Boltdocs plugin
|
|
116
|
+
* Defines a Boltdocs plugin.
|
|
259
117
|
*/
|
|
260
118
|
interface BoltdocsPlugin {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
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;
|
|
119
|
+
name: string;
|
|
120
|
+
enforce?: 'pre' | 'post';
|
|
121
|
+
version?: string;
|
|
122
|
+
boltdocsVersion?: string;
|
|
123
|
+
permissions?: string[];
|
|
124
|
+
remarkPlugins?: unknown[];
|
|
125
|
+
rehypePlugins?: unknown[];
|
|
126
|
+
vitePlugins?: Plugin[];
|
|
127
|
+
components?: Record<string, string>;
|
|
128
|
+
hooks?: Record<string, any>;
|
|
281
129
|
}
|
|
282
130
|
/**
|
|
283
131
|
* Configuration for security-related settings.
|
|
284
132
|
*/
|
|
285
133
|
interface BoltdocsSecurityConfig {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
134
|
+
headers?: Record<string, string>;
|
|
135
|
+
enableCSP?: boolean;
|
|
136
|
+
customHeaders?: Record<string, string>;
|
|
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
|
+
};
|
|
292
147
|
}
|
|
293
148
|
/**
|
|
294
149
|
* The root configuration object for Boltdocs.
|
|
295
150
|
*/
|
|
296
151
|
interface BoltdocsConfig {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
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;
|
|
152
|
+
siteUrl?: string;
|
|
153
|
+
docsDir?: string;
|
|
154
|
+
base?: string;
|
|
155
|
+
homePage?: string;
|
|
156
|
+
theme?: BoltdocsThemeConfig;
|
|
157
|
+
i18n?: BoltdocsI18nConfig;
|
|
158
|
+
versions?: BoltdocsVersionsConfig;
|
|
159
|
+
plugins?: BoltdocsPlugin[];
|
|
160
|
+
robots?: BoltdocsRobotsConfig;
|
|
161
|
+
security?: BoltdocsSecurityConfig;
|
|
162
|
+
seo?: BoltdocsSeoConfig;
|
|
163
|
+
vite?: any;
|
|
317
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
|
+
*/
|
|
318
174
|
declare function defineConfig(config: BoltdocsConfig): BoltdocsConfig;
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region src/node/config.d.ts
|
|
319
177
|
/**
|
|
320
178
|
* Loads user's configuration file (e.g., `boltdocs.config.js` or `boltdocs.config.ts`) if it exists,
|
|
321
179
|
* merges it with the default configuration, and returns the final `BoltdocsConfig`.
|
|
@@ -325,170 +183,260 @@ declare function defineConfig(config: BoltdocsConfig): BoltdocsConfig;
|
|
|
325
183
|
* @returns The merged configuration object
|
|
326
184
|
*/
|
|
327
185
|
declare function resolveConfig(docsDir: string, root?: string): Promise<BoltdocsConfig>;
|
|
328
|
-
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region src/node/plugin/types.d.ts
|
|
329
188
|
/**
|
|
330
189
|
* Configuration options specifically for the Boltdocs Vite plugin.
|
|
331
190
|
*/
|
|
332
191
|
interface BoltdocsPluginOptions {
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
192
|
+
/** The root directory containing markdown files (default: 'docs') */
|
|
193
|
+
docsDir?: string;
|
|
194
|
+
/** Path to a custom home page component (relative to project root) to render at '/' */
|
|
195
|
+
homePage?: string;
|
|
337
196
|
}
|
|
338
|
-
|
|
197
|
+
//#endregion
|
|
198
|
+
//#region src/node/plugin/entry.d.ts
|
|
339
199
|
/**
|
|
340
|
-
*
|
|
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.
|
|
200
|
+
* Generates the raw source code for the virtual entry file (`\0virtual:boltdocs-entry`).
|
|
201
|
+
* This code initializes the client-side React application.
|
|
356
202
|
*
|
|
357
|
-
* @param options -
|
|
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
|
|
358
206
|
*/
|
|
359
|
-
declare function
|
|
360
|
-
|
|
207
|
+
declare function generateEntryCode(options: BoltdocsPluginOptions, config?: BoltdocsConfig): string;
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/node/routes/types.d.ts
|
|
361
210
|
/**
|
|
362
211
|
* Metadata representing a single documentation route.
|
|
363
212
|
* This information is used to build the client-side router and the sidebar navigation.
|
|
364
213
|
*/
|
|
365
214
|
interface RouteMeta {
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
215
|
+
/** The final URL path for the route (e.g., '/docs/guide/start') */
|
|
216
|
+
path: string;
|
|
217
|
+
/** The absolute filesystem path to the source markdown/mdx file */
|
|
218
|
+
componentPath: string;
|
|
219
|
+
/** The title of the page, usually extracted from frontmatter or the filename */
|
|
220
|
+
title: string;
|
|
221
|
+
/** The relative path from the docs directory, used for edit links */
|
|
222
|
+
filePath: string;
|
|
223
|
+
/** Optional description of the page (for SEO/meta tags) */
|
|
224
|
+
description?: string;
|
|
225
|
+
/** Optional explicit position for ordering in the sidebar */
|
|
226
|
+
sidebarPosition?: number;
|
|
227
|
+
/** The group (directory) this route belongs to */
|
|
228
|
+
group?: string;
|
|
229
|
+
/** The display title for the route's group */
|
|
230
|
+
groupTitle?: string;
|
|
231
|
+
/** Optional explicit position for ordering the group itself */
|
|
232
|
+
groupPosition?: number;
|
|
233
|
+
/** Optional icon for the route's group */
|
|
234
|
+
groupIcon?: string;
|
|
235
|
+
/** The sub-route group this route belongs to (from folders starting with _) */
|
|
236
|
+
subRouteGroup?: string;
|
|
237
|
+
/** Extracted markdown headings for search indexing */
|
|
238
|
+
headings?: {
|
|
239
|
+
level: number;
|
|
240
|
+
text: string;
|
|
241
|
+
id: string;
|
|
242
|
+
}[];
|
|
243
|
+
/** The locale this route belongs to, if i18n is configured */
|
|
244
|
+
locale?: string;
|
|
245
|
+
/** The version this route belongs to, if versioning is configured */
|
|
246
|
+
version?: string;
|
|
247
|
+
/** Optional badge to display next to the sidebar item (e.g., 'New', 'Experimental') */
|
|
248
|
+
badge?: string | {
|
|
249
|
+
text: string;
|
|
250
|
+
expires?: string;
|
|
251
|
+
};
|
|
252
|
+
/** Optional icon to display (Lucide icon name or raw SVG) */
|
|
253
|
+
icon?: string;
|
|
254
|
+
/** The tab this route belongs to, if tabs are configured */
|
|
255
|
+
tab?: string;
|
|
256
|
+
/** The extracted plain-text content of the page for search indexing */
|
|
257
|
+
_content?: string;
|
|
258
|
+
/** The raw markdown content of the page */
|
|
259
|
+
_rawContent?: string;
|
|
260
|
+
/** Extracted SEO and Open Graph metadata from frontmatter */
|
|
261
|
+
seo?: Record<string, any>;
|
|
409
262
|
}
|
|
410
|
-
|
|
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;
|
|
354
|
+
}
|
|
355
|
+
//#endregion
|
|
356
|
+
//#region src/node/plugins/plugin-errors.d.ts
|
|
411
357
|
/**
|
|
412
358
|
* Base class for all plugin-related errors in Boltdocs.
|
|
413
359
|
*/
|
|
414
360
|
declare class PluginError extends Error {
|
|
415
|
-
|
|
416
|
-
|
|
361
|
+
readonly pluginName: string;
|
|
362
|
+
constructor(pluginName: string, message: string);
|
|
417
363
|
}
|
|
418
364
|
/**
|
|
419
365
|
* Specifically for schema or structure validation failures.
|
|
420
366
|
*/
|
|
421
367
|
declare class PluginValidationError extends PluginError {
|
|
422
|
-
|
|
368
|
+
constructor(pluginName: string, message: string);
|
|
423
369
|
}
|
|
424
370
|
/**
|
|
425
371
|
* Specifically for version mismatch or compatibility issues.
|
|
426
372
|
*/
|
|
427
373
|
declare class PluginCompatibilityError extends PluginError {
|
|
428
|
-
|
|
374
|
+
constructor(pluginName: string, message: string);
|
|
429
375
|
}
|
|
430
376
|
/**
|
|
431
377
|
* Specifically for attempts to use capabilities without proper permissions.
|
|
432
378
|
*/
|
|
433
379
|
declare class PluginPermissionError extends PluginError {
|
|
434
|
-
|
|
380
|
+
constructor(pluginName: string, permission: string);
|
|
435
381
|
}
|
|
436
382
|
/**
|
|
437
383
|
* Specifically for errors that occur during the execution of a lifecycle hook.
|
|
438
384
|
*/
|
|
439
385
|
declare class PluginHookError extends PluginError {
|
|
440
|
-
|
|
441
|
-
|
|
386
|
+
readonly hookName: string;
|
|
387
|
+
constructor(pluginName: string, hookName: string, originalError: Error);
|
|
442
388
|
}
|
|
443
|
-
|
|
389
|
+
//#endregion
|
|
390
|
+
//#region src/node/plugins/plugin-store.d.ts
|
|
444
391
|
/**
|
|
445
392
|
* Implementation of the shared plugin store.
|
|
446
393
|
* Uses a namespaced approach to prevent key collisions between plugins.
|
|
447
394
|
*/
|
|
448
395
|
declare class BoltdocsPluginStore implements PluginStore {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
396
|
+
private data;
|
|
397
|
+
/**
|
|
398
|
+
* Internal helper to create a namespaced key.
|
|
399
|
+
*/
|
|
400
|
+
private getNamespaceKey;
|
|
401
|
+
/**
|
|
402
|
+
* Retrieves a value from the store. Returns a deep clone to prevent mutations (side-effects).
|
|
403
|
+
*/
|
|
404
|
+
get<T = unknown>(pluginName: string, key: string): T | undefined;
|
|
405
|
+
/**
|
|
406
|
+
* Stores a value in the store. Key is automatically namespaced.
|
|
407
|
+
*/
|
|
408
|
+
set(pluginName: string, key: string, value: unknown): void;
|
|
409
|
+
/**
|
|
410
|
+
* Checks for the existence of a key in the store.
|
|
411
|
+
*/
|
|
412
|
+
has(pluginName: string, key: string): boolean;
|
|
466
413
|
}
|
|
467
|
-
|
|
414
|
+
//#endregion
|
|
415
|
+
//#region src/node/plugins/plugin-validator.d.ts
|
|
468
416
|
/**
|
|
469
417
|
* Enhanced Zod schema for secure plugins.
|
|
470
418
|
*/
|
|
471
419
|
declare const SecurePluginSchema: z.ZodObject<{
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
420
|
+
name: z.ZodString;
|
|
421
|
+
enforce: z.ZodOptional<z.ZodEnum<{
|
|
422
|
+
pre: "pre";
|
|
423
|
+
post: "post";
|
|
424
|
+
}>>;
|
|
425
|
+
remarkPlugins: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
426
|
+
rehypePlugins: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
427
|
+
vitePlugins: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
428
|
+
components: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
429
|
+
version: z.ZodOptional<z.ZodString>;
|
|
430
|
+
boltdocsVersion: z.ZodOptional<z.ZodString>;
|
|
431
|
+
permissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
432
|
+
hooks: z.ZodOptional<z.ZodObject<{
|
|
433
|
+
beforeBuild: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
434
|
+
afterBuild: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
435
|
+
beforeDev: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
436
|
+
afterDev: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
437
|
+
configResolved: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
438
|
+
buildEnd: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
439
|
+
}, z.core.$strip>>;
|
|
492
440
|
}, z.core.$strip>;
|
|
493
441
|
/**
|
|
494
442
|
* Validates a list of plugins for correctness, security, and compatibility.
|
|
@@ -498,70 +446,74 @@ declare function validatePlugins(plugins: any[], boltdocsVersion: string): Secur
|
|
|
498
446
|
* Helper to check if a specific permission is granted to a plugin.
|
|
499
447
|
*/
|
|
500
448
|
declare function hasPermission(plugin: SecureBoltdocsPlugin, permission: PluginPermission): boolean;
|
|
501
|
-
|
|
449
|
+
//#endregion
|
|
450
|
+
//#region src/node/plugins/plugin-sandbox.d.ts
|
|
502
451
|
/**
|
|
503
452
|
* The Sandbox provides a protective layer that ensures plugins only use
|
|
504
453
|
* the capabilities they have explicitly requested permissions for.
|
|
505
454
|
*/
|
|
506
455
|
declare class PluginSandbox {
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
456
|
+
/**
|
|
457
|
+
* Validates if a plugin has the required permission for a capability.
|
|
458
|
+
* Throws a PluginPermissionError if not granted.
|
|
459
|
+
*/
|
|
460
|
+
static checkPermission(plugin: SecureBoltdocsPlugin, permission: PluginPermission): void;
|
|
461
|
+
/**
|
|
462
|
+
* Filters a plugin's capabilities based on its declared permissions.
|
|
463
|
+
* This is used when aggregating plugins (remark, rehype, vite, components).
|
|
464
|
+
*/
|
|
465
|
+
static getSanitizedCapabilities(plugin: SecureBoltdocsPlugin): {
|
|
466
|
+
remarkPlugins: unknown[] | undefined;
|
|
467
|
+
rehypePlugins: unknown[] | undefined;
|
|
468
|
+
vitePlugins: _$vite.Plugin<any>[] | undefined;
|
|
469
|
+
components: Record<string, string> | undefined;
|
|
470
|
+
};
|
|
471
|
+
/**
|
|
472
|
+
* Wraps a hook execution with permission checks and error isolation.
|
|
473
|
+
*/
|
|
474
|
+
static executeWithIsolation<T>(plugin: SecureBoltdocsPlugin, requiredPermission: PluginPermission, hookName: string, action: () => Promise<T> | T): Promise<T | undefined>;
|
|
526
475
|
}
|
|
527
|
-
|
|
476
|
+
//#endregion
|
|
477
|
+
//#region src/node/plugins/plugin-lifecycle.d.ts
|
|
528
478
|
/**
|
|
529
479
|
* Manages the lifecycle of all loaded plugins, ensuring hooks are executed
|
|
530
480
|
* in the correct order with proper error isolation and context.
|
|
531
481
|
*/
|
|
532
482
|
declare class PluginLifecycleManager {
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
483
|
+
private plugins;
|
|
484
|
+
private config;
|
|
485
|
+
private store;
|
|
486
|
+
constructor(plugins: SecureBoltdocsPlugin[], config: BoltdocsConfig);
|
|
487
|
+
/**
|
|
488
|
+
* Runs a specific hook for all plugins that implement it.
|
|
489
|
+
*/
|
|
490
|
+
runHook(hookName: keyof PluginLifecycleHooks, ...args: any[]): Promise<void>;
|
|
491
|
+
/**
|
|
492
|
+
* Sorts plugins based on their 'enforce' property (pre -> normal -> post).
|
|
493
|
+
*/
|
|
494
|
+
private getSortedPlugins;
|
|
495
|
+
/**
|
|
496
|
+
* Creates a specialized context for a plugin.
|
|
497
|
+
*/
|
|
498
|
+
private createContext;
|
|
499
|
+
/**
|
|
500
|
+
* Creates a namespaced logger for a plugin.
|
|
501
|
+
*/
|
|
502
|
+
private createLogger;
|
|
553
503
|
}
|
|
554
|
-
|
|
504
|
+
//#endregion
|
|
505
|
+
//#region src/node/plugins/index.d.ts
|
|
555
506
|
/**
|
|
556
507
|
* Utility to create a Boltdocs plugin with full type safety.
|
|
557
508
|
*/
|
|
558
509
|
declare function createPlugin(plugin: SecureBoltdocsPlugin): SecureBoltdocsPlugin;
|
|
559
|
-
|
|
510
|
+
//#endregion
|
|
511
|
+
//#region src/node/index.d.ts
|
|
560
512
|
declare function boltdocs(options?: BoltdocsPluginOptions): Promise<Plugin[]>;
|
|
561
513
|
/**
|
|
562
514
|
* Generates the complete Vite configuration for a Boltdocs project.
|
|
563
515
|
* This is used by the Boltdocs CLI to run Vite without a user-defined vite.config.ts.
|
|
564
516
|
*/
|
|
565
517
|
declare function createViteConfig(root: string, mode?: 'development' | 'production'): Promise<InlineConfig>;
|
|
566
|
-
|
|
567
|
-
export { type BoltdocsConfig, type BoltdocsPlugin, type BoltdocsPluginOptions, BoltdocsPluginStore, type BoltdocsThemeConfig, PluginCompatibilityError,
|
|
518
|
+
//#endregion
|
|
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 };
|