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