boltdocs 2.7.11 → 2.8.0

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