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