boltdocs 3.1.0 → 3.2.2

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 (138) hide show
  1. package/dist/{adapters-DEXNIv3x.mjs → adapters-ByYY44Zy.mjs} +1 -1
  2. package/dist/{adapters-uGz-UKQa.cjs → adapters-DvmtpdSF.cjs} +1 -1
  3. package/dist/{banner-DjujkctF.d.ts → banner-BMop1KLF.d.ts} +2 -2
  4. package/dist/{banner-DdSgCs4G.d.cts → banner-CVD0GugR.d.cts} +2 -2
  5. package/dist/{cache-CfRTUzWC.cjs → cache-CO4Dy2uQ.cjs} +1 -1
  6. package/dist/{cache-B0C2i0yP.mjs → cache-Dk53iOo6.mjs} +1 -1
  7. package/dist/chunk-BFSpntXv.mjs +6 -0
  8. package/dist/{chunk-Ds5LZdWN.cjs → chunk-D1Md3oWO.cjs} +1 -1
  9. package/dist/client/index.cjs +219 -172
  10. package/dist/client/index.d.cts +75 -9
  11. package/dist/client/index.d.ts +75 -9
  12. package/dist/client/index.js +119 -73
  13. package/dist/client/mdx.cjs +1 -1
  14. package/dist/client/mdx.d.cts +1 -1
  15. package/dist/client/mdx.d.ts +1 -1
  16. package/dist/client/mdx.js +1 -1
  17. package/dist/client/primitives.cjs +7 -7
  18. package/dist/client/primitives.d.cts +5 -22
  19. package/dist/client/primitives.d.ts +5 -22
  20. package/dist/client/primitives.js +4 -4
  21. package/dist/client/theme/reset.css +31 -4
  22. package/dist/{shiki-adapter-fS94vy-z.d.mts → config-BpzaPsJj.d.cts} +325 -78
  23. package/dist/config-CCXp3aXO.mjs +7 -0
  24. package/dist/{config-BxsogK5A.cjs → config-CMd4XoFq.cjs} +1 -1
  25. package/dist/config-DlGoEM9D.cjs +7 -0
  26. package/dist/{shiki-adapter-l2kEP5rn.d.cts → config-xtS0ZkMm.d.mts} +325 -78
  27. package/dist/{csp-BX06rvdg.cjs → csp-CRp_3U7a.cjs} +1 -1
  28. package/dist/csp-oTC2ygvF.mjs +6 -0
  29. package/dist/{docs-layout-DyLDBwS6.js → docs-layout-BdtZ9z6s.js} +9 -28
  30. package/dist/{docs-layout-D1buSdua.cjs → docs-layout-CFWI15Id.cjs} +69 -88
  31. package/dist/{doctor-DPDcRKM1.cjs → doctor-BBtmNJE0.cjs} +1 -1
  32. package/dist/doctor-Bv16QSrI.cjs +7 -0
  33. package/dist/doctor-DOAbSaiL.mjs +7 -0
  34. package/dist/{generator-BN75lJOv.cjs → generator-COepVWGi.cjs} +1 -1
  35. package/dist/{handler-Btd4t_67.mjs → handler-DzQae4eA.mjs} +1 -1
  36. package/dist/{handler-1LRMYeI4.cjs → handler-XX7cLTqe.cjs} +1 -1
  37. package/dist/headers-Ddwek8K7.mjs +6 -0
  38. package/dist/{headers-YpD10rDb.cjs → headers-dg4SDrjY.cjs} +1 -1
  39. package/dist/{image-5WsgWYTh.js → image-Bz87fCla.js} +1 -1
  40. package/dist/{image-Hb105Gu6.cjs → image-C4TlpMHn.cjs} +18 -18
  41. package/dist/link-2PzgTnaP.js +673 -0
  42. package/dist/{icons-dev-YtDoLUsb.cjs → link-D1Gjkb-2.cjs} +0 -350
  43. package/dist/{mdx-Bv-pS6-O.js → mdx-BuO6a1f7.js} +195 -40
  44. package/dist/{mdx-CDUcJmye.cjs → mdx-CD-tSjRG.cjs} +234 -73
  45. package/dist/{meta-loader-CTB62-Mo.cjs → meta-loader-Dq1zcFnh.cjs} +1 -1
  46. package/dist/node/cache.cjs +1 -1
  47. package/dist/node/cache.d.cts +2 -1
  48. package/dist/node/cache.d.mts +2 -1
  49. package/dist/node/cache.mjs +1 -1
  50. package/dist/node/cli-entry.cjs +6 -6
  51. package/dist/node/cli-entry.mjs +9 -9
  52. package/dist/node/index.cjs +1 -1
  53. package/dist/node/index.d.cts +20 -174
  54. package/dist/node/index.d.mts +18 -175
  55. package/dist/node/index.mjs +1 -1
  56. package/dist/node/mdx/shiki-adapter.cjs +1 -1
  57. package/dist/node/mdx/shiki-adapter.d.cts +49 -1
  58. package/dist/node/mdx/shiki-adapter.d.mts +49 -1
  59. package/dist/node/mdx/shiki-adapter.mjs +1 -1
  60. package/dist/node-B5hu_6qj.cjs +104 -0
  61. package/dist/node-BXtqM1uH.mjs +6 -0
  62. package/dist/node-C8725aw7.mjs +104 -0
  63. package/dist/node-aD1eisrR.cjs +6 -0
  64. package/dist/{package-_-Oa8-qN.cjs → package-CH2ChQqw.cjs} +1 -1
  65. package/dist/{package-CoHWTf0N.mjs → package-DSSB8B5L.mjs} +1 -1
  66. package/dist/{pages-external-CX2uyW95.cjs → pages-external-XkYIs-d5.cjs} +1 -1
  67. package/dist/parser-DCiEWkSk.cjs +8 -0
  68. package/dist/parser-qk9FIHJ7.mjs +8 -0
  69. package/dist/plugin-CX1OZ6jB.cjs +73 -0
  70. package/dist/plugin-CgfiWaFZ.mjs +73 -0
  71. package/dist/routes-BW6zsk7Z.mjs +6 -0
  72. package/dist/routes-BgoIB5wb.cjs +6 -0
  73. package/dist/{routes-D_S9kjkS.cjs → routes-CORVxc02.cjs} +1 -1
  74. package/dist/{search-dialog-BpNULmrl.cjs → search-dialog-B1NERUNx.cjs} +101 -55
  75. package/dist/{search-dialog-BbtxA1uT.cjs → search-dialog-BRFno7HD.cjs} +8 -8
  76. package/dist/{search-dialog-DC7oXU-5.js → search-dialog-BmxHiKwt.js} +2 -2
  77. package/dist/{search-dialog-gp9lrJXm.js → search-dialog-D6TvjcuV.js} +1 -1
  78. package/dist/{search-dialog-PJrFRU5G.js → search-dialog-DFnlx8LO.js} +44 -4
  79. package/dist/{search-dialog-BIuxGQsg.cjs → search-dialog-DHqwjJuG.cjs} +1 -1
  80. package/dist/server/index.cjs +1 -1
  81. package/dist/server/index.d.mts +1 -1
  82. package/dist/server/index.mjs +1 -1
  83. package/dist/shiki-adapter-CoQ6jyJ4.cjs +6 -0
  84. package/dist/shiki-adapter-D-aKw7PP.mjs +6 -0
  85. package/dist/{sidebar-DknLUI1R.d.ts → sidebar-COTaMHR-.d.ts} +349 -41
  86. package/dist/{sidebar-DH2iPKXM.d.cts → sidebar-CrEdJuHX.d.cts} +349 -41
  87. package/dist/{types-generator-CYcHkDzZ.cjs → types-generator-BXhv7Ill.cjs} +1 -1
  88. package/dist/types-generator-bDPvUztF.mjs +26 -0
  89. package/dist/utils-Crm9oPcV.mjs +7 -0
  90. package/dist/utils-D6Xtj0FZ.cjs +7 -0
  91. package/package.json +13 -10
  92. package/src/shared/types.ts +361 -19
  93. package/dist/chunk-hT5z_Zn9-DsJawvsz.mjs +0 -6
  94. package/dist/chunk-hT5z_Zn9-SKz6VFXu.cjs +0 -6
  95. package/dist/config-DAgpZyh6.mjs +0 -7
  96. package/dist/config-DrRQYDCI.cjs +0 -7
  97. package/dist/csp-z2D0FuRW.mjs +0 -6
  98. package/dist/doctor-BadGEhXv.cjs +0 -7
  99. package/dist/doctor-vDsUDgqp.mjs +0 -7
  100. package/dist/escape-string-regexp-AG8q1e25-9Un9V90q.mjs +0 -6
  101. package/dist/escape-string-regexp-AG8q1e25-bJ9Ixe7c.cjs +0 -6
  102. package/dist/esm-shims-DSep1HcR.mjs +0 -6
  103. package/dist/headers-CL0pMcwm.mjs +0 -6
  104. package/dist/icons-dev-CHZOwhQA.js +0 -921
  105. package/dist/lib-BR0SoanK-CLswltLI.cjs +0 -6
  106. package/dist/lib-BR0SoanK-DcYeDrE6.mjs +0 -6
  107. package/dist/lib-DPoCz1YB-CLYXwKST.cjs +0 -6
  108. package/dist/lib-DPoCz1YB-CyGOqgSO.mjs +0 -6
  109. package/dist/micromark-util-character-5KqJafVT-C6gnc770.cjs +0 -6
  110. package/dist/micromark-util-character-5KqJafVT-DkPKsbgn.mjs +0 -6
  111. package/dist/node-BDBv8CT6.mjs +0 -104
  112. package/dist/node-DFV_FV0y.mjs +0 -6
  113. package/dist/node-DqsP7kXz.cjs +0 -6
  114. package/dist/node-yFmAavND.cjs +0 -104
  115. package/dist/parser-BZJgAa9E.mjs +0 -8
  116. package/dist/parser-DlanzESE.cjs +0 -8
  117. package/dist/plugin-BVuwx5D9.cjs +0 -73
  118. package/dist/plugin-BoxD91Yh.mjs +0 -73
  119. package/dist/rehype-slug--ZOxZ-_K-BNeYC4aT.cjs +0 -6
  120. package/dist/rehype-slug--ZOxZ-_K-CjIQEJCs.mjs +0 -6
  121. package/dist/remark-frontmatter-wFYRLcCt-CutW0gA3.mjs +0 -8
  122. package/dist/remark-frontmatter-wFYRLcCt-ENB5qG3y.cjs +0 -8
  123. package/dist/remark-gfm-B8TMkQbX-CjUJo8Rd.cjs +0 -21
  124. package/dist/remark-gfm-B8TMkQbX-Ctu0VV1_.mjs +0 -21
  125. package/dist/rolldown-runtime-fkIsjY3S.mjs +0 -6
  126. package/dist/rollup-DMqoG11U-CKcJ37u_.mjs +0 -59
  127. package/dist/rollup-DMqoG11U-DKdxvZIj.cjs +0 -59
  128. package/dist/routes-BN2XbGcT.mjs +0 -6
  129. package/dist/routes-Cnq8xTCv.cjs +0 -6
  130. package/dist/shiki-adapter-CGTmrR6S.cjs +0 -6
  131. package/dist/shiki-adapter-CK3llqw2.mjs +0 -6
  132. package/dist/types-generator-DVOnRVKU.mjs +0 -26
  133. package/dist/utils-B3xYMrpK.mjs +0 -7
  134. package/dist/utils-Bz1tG9Dg.cjs +0 -7
  135. /package/dist/{errors-C0Hx15Ag.mjs → errors-0zGHRLue.mjs} +0 -0
  136. /package/dist/{errors-Dx6JHoKE.cjs → errors-vKw8CkiX.cjs} +0 -0
  137. /package/dist/{index-DJYJzs-Z.d.mts → index-1KsTDq4o.d.mts} +0 -0
  138. /package/dist/{meta-loader-Bq-MjTXB.mjs → meta-loader-C4Hu9RN9.mjs} +0 -0
@@ -1,8 +1,6 @@
1
1
 
2
2
  import { Plugin } from "vite";
3
- import * as _$shiki from "shiki";
4
- import { CodeToHastOptions } from "shiki";
5
-
3
+ import * as _$http from "http";
6
4
  //#region src/shared/types.d.ts
7
5
  /**
8
6
  * Metadata representing a single documentation route.
@@ -177,6 +175,43 @@ interface BoltdocsVersionConfig {
177
175
  label: string;
178
176
  path: string;
179
177
  }
178
+ /**
179
+ * Configuration for content collections (e.g. blog posts, changelog)
180
+ * declared in `boltdocs.config.ts`. Each entry maps a directory name
181
+ * (e.g. `[blog]`) to its display + ordering settings.
182
+ */
183
+ interface BoltdocsCollectionsConfig {
184
+ /**
185
+ * Map of collection id (matches the bracketed directory name) to
186
+ * its display label. Falls back to the id when a label is missing.
187
+ */
188
+ labels?: Record<string, string | Record<string, string>>;
189
+ /**
190
+ * Map of collection id to a numeric position used for sidebar ordering.
191
+ * Collections with no explicit position are sorted last.
192
+ */
193
+ positions?: Record<string, number>;
194
+ /**
195
+ * Items-per-page for paginated collection routes (e.g. blog indexes).
196
+ * Falls back to the framework default (10) when omitted.
197
+ */
198
+ postsPerPage?: number;
199
+ /**
200
+ * Default collection ID used by collection routing when no collection
201
+ * is explicitly referenced. Defaults to `'blog'`.
202
+ */
203
+ defaultCollection?: string;
204
+ /**
205
+ * Date format string for rendering post dates in listing pages.
206
+ * Defaults to `'MMMM dd, yyyy'`.
207
+ */
208
+ dateFormat?: string;
209
+ /**
210
+ * Field used to sort posts within a collection.
211
+ * Defaults to `'date'`.
212
+ */
213
+ sortBy?: 'date' | 'title' | 'sidebarPosition';
214
+ }
180
215
  /**
181
216
  * Configuration for documentation versioning.
182
217
  */
@@ -204,6 +239,129 @@ interface PluginContext {
204
239
  readonly rootDir: string;
205
240
  readonly outDir: string;
206
241
  readonly routes: RouteMeta[];
242
+ /** Namespaced cache helpers bound to the core's cache machinery. */
243
+ readonly caches: PluginCachesAPI;
244
+ /** Structured diagnostics channel; reports can be drained via `list()`. */
245
+ readonly diagnostics: PluginDiagnosticsAPI;
246
+ /** Helpers for resolving paths inside the workspace safely. */
247
+ readonly paths: PluginPathsAPI;
248
+ /** Declare virtual modules the core should expose to Vite. */
249
+ readonly virtualModules: PluginVirtualModulesAPI;
250
+ /** Register and query transform middleware at runtime. */
251
+ readonly middleware: PluginMiddlewareAPI;
252
+ /**
253
+ * Hook into dev-server file watching and send custom HMR events
254
+ * to connected clients.
255
+ */
256
+ readonly hmr: PluginHmrAPI;
257
+ /**
258
+ * Register HTTP middleware and server lifecycle hooks without
259
+ * writing a Vite plugin.
260
+ */
261
+ readonly server: PluginServerAPI;
262
+ }
263
+ /**
264
+ * Functional cache helpers exposed through `PluginContext.caches`.
265
+ *
266
+ * Plugin authors do not get a reference to the raw `TransformCache` /
267
+ * `FileCache` instances — those stay encapsulated in core. The methods
268
+ * returned here are bound to namespaced keys so two plugins cannot
269
+ * collide.
270
+ */
271
+ interface PluginCachesAPI {
272
+ /** Sharded, hash-keyed cache. One namespace per plugin recommended. */
273
+ transform(namespace: string): PluginTransformCacheAPI;
274
+ /** Routes cache wrapper around the parsed-doc cache. */
275
+ routes: PluginRoutesCacheAPI;
276
+ /** In-memory LRU cache keyed by namespace + plugin-supplied key. */
277
+ memory<V = unknown>(namespace: string, opts?: {
278
+ max?: number;
279
+ ttl?: number;
280
+ }): PluginMemoryCacheAPI<V>;
281
+ }
282
+ interface PluginTransformCacheAPI {
283
+ /** Async read — first call may warm from disk if the entry was evicted. */
284
+ get(key: string): Promise<string | null>;
285
+ /** Synchronous write that batches a background disk flush. */
286
+ set(key: string, value: string): void;
287
+ /** Force-flush background writes. Call before measuring disk state. */
288
+ flush(): Promise<void>;
289
+ }
290
+ interface PluginRoutesCacheAPI {
291
+ /** Read a parsed `RouteMeta` (and its private `_content` blob) by abs file path. */
292
+ get(filePath: string): RouteMeta | null;
293
+ /** Write a parsed route entry. Caller assumptions match `docCache.set`. */
294
+ set(filePath: string, route: RouteMeta): void;
295
+ /** Invalidate one route. Use when content changes. */
296
+ invalidate(filePath: string): void;
297
+ /** Clear every cached route. Use when the directory layout changes. */
298
+ invalidateAll(): void;
299
+ }
300
+ interface PluginMemoryCacheAPI<V> {
301
+ get(key: string): V | undefined;
302
+ set(key: string, value: V): void;
303
+ has(key: string): boolean;
304
+ }
305
+ /**
306
+ * Plugin diagnostics API.
307
+ *
308
+ * Plugins push structured records instead of spamming the logger; downstream
309
+ * tools (dev-server overlay, CI reporters, IDE plugins) drain the queue via
310
+ * `list()`.
311
+ */
312
+ interface DiagnosticRecord {
313
+ readonly id: number;
314
+ readonly severity: 'info' | 'warn' | 'error';
315
+ readonly code: string;
316
+ readonly message: string;
317
+ readonly pluginName: string;
318
+ readonly filePath?: string;
319
+ readonly routePath?: string;
320
+ readonly time: Date;
321
+ }
322
+ interface PluginDiagnosticsAPI {
323
+ report(severity: DiagnosticRecord['severity'], code: string, message: string, where?: {
324
+ filePath?: string;
325
+ routePath?: string;
326
+ }): void;
327
+ list(): readonly DiagnosticRecord[];
328
+ clear(): void;
329
+ }
330
+ /**
331
+ * Path-resolution helpers exposed through `PluginContext.paths`.
332
+ *
333
+ * Both `resolveDocs` and `resolveAsset` validate the resulting path against
334
+ * the workspace boundary and reject any segment that resolves outside the
335
+ * docs / project root directories.
336
+ */
337
+ interface PluginPathsAPI {
338
+ resolveDocs(...parts: string[]): string;
339
+ resolveAsset(...parts: string[]): string;
340
+ /**
341
+ * Build a `file://` URL for an absolute path inside the workspace.
342
+ * Useful for `new URL(import.meta.url)` replacements and image srcsets.
343
+ */
344
+ safeFileURL(absFilePath: string): string;
345
+ }
346
+ /**
347
+ * Plugin virtual-modules registration.
348
+ *
349
+ * Plugins call `add(id, loader)` to expose a `virtual:<plugin>/<id>` module
350
+ * to Vite without having to author a full Vite plugin. The loader returns
351
+ * the module source code as a string; the core wraps it in the right
352
+ * `resolveId`/`load` plumbing at Vite build time.
353
+ */
354
+ interface RegisteredVirtualModule {
355
+ readonly id: string;
356
+ readonly eager: boolean;
357
+ readonly loader: () => string | Promise<string>;
358
+ }
359
+ interface PluginVirtualModulesAPI {
360
+ add(id: string, loader: () => string | Promise<string>, opts?: {
361
+ eager?: boolean;
362
+ }): void;
363
+ has(id: string): boolean;
364
+ list(): readonly RegisteredVirtualModule[];
207
365
  }
208
366
  /**
209
367
  * Logger interface for plugin logging.
@@ -230,6 +388,152 @@ interface PluginMeta {
230
388
  version?: string;
231
389
  boltdocsVersion?: string;
232
390
  }
391
+ /**
392
+ * Chain control signal returned by transform hooks. Use with `__signal` in
393
+ * the return value to influence the middleware chain:
394
+ *
395
+ * - `'skip'`: stop processing this hook for the current file (remaining
396
+ * plugins in the chain still run).
397
+ * - `'break'`: stop the entire chain immediately — no further plugin's
398
+ * transform hooks run for this file.
399
+ *
400
+ * @example
401
+ * ```ts
402
+ * transformMdx: async (_ctx, { code }) => ({
403
+ * code: code.replace(/foo/g, 'bar'),
404
+ * __signal: 'skip', // skip remaining plugins
405
+ * })
406
+ * ```
407
+ */
408
+ type ChainSignal = 'skip' | 'break';
409
+ /**
410
+ * Returned by a transform hook that wants to signal the chain. The `__signal`
411
+ * field is optional — most hooks will just return `{ code: string }` and the
412
+ * chain continues normally. When `__signal` is present, `runChain` reacts:
413
+ *
414
+ * - `'skip'` continues with the next plugin, but passes the **original params**
415
+ * (the output of this hook is discarded).
416
+ * - `'break'` stops the chain immediately.
417
+ *
418
+ * @template T The params shape (e.g. `{ code: string; filePath: string }`).
419
+ */
420
+ type TransformResult<T> = T & {
421
+ __signal?: ChainSignal;
422
+ };
423
+ /**
424
+ * Enriched params passed to `transformSource` and `transformMdx`. The `code`
425
+ * and `filePath` fields are always present. The optional `frontmatter` and
426
+ * `route` fields are populated when available (they are `undefined` in the
427
+ * early pipeline where frontmatter hasn't been parsed yet).
428
+ */
429
+ interface TransformSourceParams {
430
+ /** The raw or compiled code (source before MDX / JS after MDX). */
431
+ code: string;
432
+ /** Absolute file path of the source document. */
433
+ filePath: string;
434
+ /** Parsed frontmatter, if available. `undefined` in very early pipeline. */
435
+ frontmatter?: Record<string, unknown>;
436
+ }
437
+ /**
438
+ * Enriched params passed to `transformHtml`. The `html` and `path` fields
439
+ * are always present. The optional `route` carries the generated `RouteMeta`
440
+ * for richer context (locale, version, collection, etc.).
441
+ */
442
+ interface TransformHtmlParams {
443
+ /** The rendered HTML string for this page. */
444
+ html: string;
445
+ /** The route path (e.g. `/docs/guides/start`). */
446
+ path: string;
447
+ /** The route metadata for the page, if available. */
448
+ route?: RouteMeta;
449
+ }
450
+ /**
451
+ * Plugin transform middleware. Each middleware runs in the transform
452
+ * pipeline alongside lifecycle hooks. The `name` field is optional —
453
+ * when omitted, the owning plugin's name is used as context.
454
+ * Middleware runs in `enforce` order (pre → normal → post) and supports
455
+ * `__signal: 'skip'` / `__signal: 'break'` for chain control.
456
+ */
457
+ interface PluginTransformMiddleware {
458
+ /** Optional name. Defaults to the owning plugin's name for diagnostics. */
459
+ name?: string;
460
+ enforce?: 'pre' | 'post';
461
+ transformSource?: (ctx: PluginContext, params: TransformSourceParams) => TransformResult<{
462
+ code: string;
463
+ }> | Promise<TransformResult<{
464
+ code: string;
465
+ }>>;
466
+ transformMdx?: (ctx: PluginContext, params: TransformSourceParams) => TransformResult<{
467
+ code: string;
468
+ }> | Promise<TransformResult<{
469
+ code: string;
470
+ }>>;
471
+ transformHtml?: (ctx: PluginContext, params: TransformHtmlParams) => TransformResult<{
472
+ html: string;
473
+ }> | Promise<TransformResult<{
474
+ html: string;
475
+ }>>;
476
+ }
477
+ /**
478
+ * Plugin middleware registry API exposed through `PluginContext.middleware`.
479
+ * Plugins can register named middleware entries from lifecycle hooks.
480
+ */
481
+ interface PluginMiddlewareAPI {
482
+ add(middleware: PluginTransformMiddleware): void;
483
+ remove(name: string): void;
484
+ has(name: string): boolean;
485
+ list(): readonly PluginTransformMiddleware[];
486
+ }
487
+ /**
488
+ * HMR event types plugins can listen to.
489
+ */
490
+ type PluginHmrEvent = 'add' | 'change' | 'unlink';
491
+ /**
492
+ * Plugin HMR API — hook into file-watching events and send custom
493
+ * HMR messages to connected clients.
494
+ */
495
+ interface PluginHmrAPI {
496
+ /**
497
+ * Register a callback for file events scoped to the docs directory.
498
+ * The callback receives the normalized file path and event type.
499
+ */
500
+ onFileEvent(eventType: PluginHmrEvent, handler: (filePath: string) => void | Promise<void>): void;
501
+ /** Shorthand for `onFileEvent('add', handler)`. */
502
+ onFileAdd(handler: (filePath: string) => void | Promise<void>): void;
503
+ /** Shorthand for `onFileEvent('change', handler)`. */
504
+ onFileChange(handler: (filePath: string) => void | Promise<void>): void;
505
+ /** Shorthand for `onFileEvent('unlink', handler)`. */
506
+ onFileUnlink(handler: (filePath: string) => void | Promise<void>): void;
507
+ /**
508
+ * Send a custom HMR event to all connected clients.
509
+ * The client can listen with `import.meta.hot.on('boltdocs:plugin:<name>', ...)`.
510
+ */
511
+ send(event: string, data?: unknown): void;
512
+ }
513
+ /**
514
+ * Plugin Server API — register HTTP middleware and lifecycle hooks
515
+ * for the dev server and preview server, without writing a Vite plugin.
516
+ */
517
+ interface PluginServerAPI {
518
+ /**
519
+ * Register a Connect-style middleware function.
520
+ * Runs on both dev and preview servers.
521
+ */
522
+ use(middleware: PluginServerMiddleware): void;
523
+ /**
524
+ * Register a middleware scoped to a specific path prefix.
525
+ * Only requests starting with `path` trigger the handler.
526
+ */
527
+ useAt(path: string, handler: PluginServerMiddleware): void;
528
+ /** Called when the dev/preview server starts (once per process). */
529
+ onStart(callback: () => void | Promise<void>): void;
530
+ /** Called when the server shuts down (cleanup). */
531
+ onEnd(callback: () => void | Promise<void>): void;
532
+ }
533
+ /**
534
+ * Connect-style middleware signature.
535
+ */
536
+ type PluginServerMiddleware = (req: _$http.IncomingMessage, res: _$http.ServerResponse, next: (err?: unknown) => void) => void | Promise<void>;
233
537
  /**
234
538
  * Plugin lifecycle hooks with full type safety.
235
539
  */
@@ -239,30 +543,21 @@ interface PluginLifecycleHooks {
239
543
  beforeDev?: (ctx: PluginContext) => Promise<void> | void;
240
544
  afterDev?: (ctx: PluginContext) => Promise<void> | void;
241
545
  buildEnd?: (ctx: PluginContext) => Promise<void> | void;
242
- transformSource?: (ctx: PluginContext, params: {
243
- code: string;
244
- filePath: string;
245
- }) => Promise<{
246
- code: string;
247
- }> | {
546
+ transformSource?: (ctx: PluginContext, params: TransformSourceParams) => TransformResult<{
248
547
  code: string;
249
- };
250
- transformMdx?: (ctx: PluginContext, params: {
548
+ }> | Promise<TransformResult<{
251
549
  code: string;
252
- filePath: string;
253
- }) => Promise<{
550
+ }>>;
551
+ transformMdx?: (ctx: PluginContext, params: TransformSourceParams) => TransformResult<{
254
552
  code: string;
255
- }> | {
553
+ }> | Promise<TransformResult<{
256
554
  code: string;
257
- };
258
- transformHtml?: (ctx: PluginContext, params: {
259
- html: string;
260
- path: string;
261
- }) => Promise<{
555
+ }>>;
556
+ transformHtml?: (ctx: PluginContext, params: TransformHtmlParams) => TransformResult<{
262
557
  html: string;
263
- }> | {
558
+ }> | Promise<TransformResult<{
264
559
  html: string;
265
- };
560
+ }>>;
266
561
  }
267
562
  /**
268
563
  * MDX processor configuration.
@@ -286,22 +581,19 @@ interface BoltdocsPlugin {
286
581
  rehypePlugins?: unknown[];
287
582
  vitePlugins?: Plugin[];
288
583
  components?: Record<string, string>;
584
+ /** Optional runtime metadata exposed to client via useConfig().plugins[].metadata */
585
+ metadata?: Record<string, unknown>;
586
+ /** Declarative transform middleware entries. */
587
+ middleware?: PluginTransformMiddleware[];
289
588
  /** Lifecycle hooks with full type safety */
290
589
  hooks?: PluginLifecycleHooks;
291
590
  }
292
591
  /**
293
- * Configuration for the collections (blog) feature.
294
592
  */
295
- interface BoltdocsCollectionsConfig {
296
- /** Number of posts per page in collection listing pages. Defaults to 10. */
297
- postsPerPage?: number;
298
- /** The name of the default collection used by BlogList when none is specified. */
299
- defaultCollection?: string;
300
- /** Date format string for rendering post dates (e.g., 'MMMM dd, yyyy'). */
301
- dateFormat?: string;
302
- /** Field to sort posts by. Defaults to 'date'. */
303
- sortBy?: 'date' | 'title' | 'sidebarPosition';
304
- }
593
+ /**
594
+ */
595
+ /**
596
+ */
305
597
  interface BoltdocsSecurityConfig {
306
598
  headers?: Record<string, string>;
307
599
  enableCSP?: boolean;
@@ -486,49 +778,4 @@ declare function defineConfig(config: BoltdocsConfig): BoltdocsConfig;
486
778
  */
487
779
  declare function resolveConfig(docsDir: string, root?: string): Promise<BoltdocsConfig>;
488
780
  //#endregion
489
- //#region src/node/mdx/shiki-adapter.d.ts
490
- interface ParsedMeta {
491
- title?: string;
492
- lineNumbers?: boolean;
493
- wordWrap?: boolean;
494
- [key: string]: any;
495
- }
496
- /**
497
- * Parses a meta string into a structured ParsedMeta object.
498
- */
499
- declare function parseMetaString(metaStr: string): ParsedMeta;
500
- /**
501
- * Unified Shiki Adapter for Boltdocs.
502
- * Centralizes theme resolution, transformer configuration, and rendering logic.
503
- */
504
- declare class ShikiAdapter {
505
- private config;
506
- constructor(config?: BoltdocsConfig);
507
- /**
508
- * Resolves the code theme from Boltdocs configuration.
509
- */
510
- getTheme(): ShikiTheme | {
511
- light: ShikiTheme;
512
- dark: ShikiTheme;
513
- };
514
- /**
515
- * Creates a Shiki highlighter instance with the configured themes.
516
- */
517
- getHighlighter(): Promise<_$shiki.HighlighterCore>;
518
- /**
519
- * Assembles Shiki options including transformers for a specific code block.
520
- */
521
- getOptions(lang: string, meta: string | ParsedMeta): CodeToHastOptions;
522
- /**
523
- * Renders code to HTML using the Boltdocs Shiki pipeline.
524
- * Safely handles highlighter exceptions by falling back to escaped pre.
525
- */
526
- render(code: string, lang: string, meta: string | ParsedMeta): Promise<string>;
527
- }
528
- /**
529
- * Returns a cached ShikiAdapter instance.
530
- * Recreates only if the relevant codeTheme configuration values change deeply.
531
- */
532
- declare function getShikiAdapter(config?: BoltdocsConfig): ShikiAdapter;
533
- //#endregion
534
- export { resolveConfig as a, BoltdocsPlugin as c, PluginLifecycleHooks as d, PluginLogger as f, RouteMeta as h, parseMetaString as i, BoltdocsThemeConfig as l, PluginStore as m, ShikiAdapter as n, defineConfig as o, PluginMeta as p, getShikiAdapter as r, BoltdocsConfig as s, ParsedMeta as t, PluginContext as u };
781
+ export { BoltdocsThemeConfig as a, PluginLogger as c, PluginTransformMiddleware as d, RouteMeta as f, BoltdocsPlugin as i, PluginMeta as l, defineConfig as n, PluginContext as o, ShikiTheme as p, BoltdocsConfig as r, PluginLifecycleHooks as s, resolveConfig as t, PluginStore as u };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Boltdocs - https://boltdocs.vercel.app
3
+ * Copyright (c) 2026 Jesus Alcala
4
+ * Licensed under the MIT License.
5
+ */
6
+ import{t as e}from"./chunk-BFSpntXv.mjs";import{r as t}from"./errors-0zGHRLue.mjs";import{t as n}from"./types-generator-bDPvUztF.mjs";import r from"node:path";import i from"node:fs";import{z as a}from"zod";import{warn as o}from"@bdocs/dui";function s(e){return e}const c=a.object({icon:a.string().max(50),link:a.string().url()});a.object({text:a.string().max(2e3).optional()});const l=a.object({processor:a.enum([`unified`,`satteri`]).optional()}),u=a.object({name:a.string(),enforce:a.enum([`pre`,`post`]).optional(),version:a.string().optional(),boltdocsVersion:a.string().optional(),clientEntry:a.string().optional(),remarkPlugins:a.array(a.unknown()).optional(),rehypePlugins:a.array(a.unknown()).optional(),vitePlugins:a.array(a.unknown()).optional(),components:a.record(a.string(),a.string()).optional(),metadata:a.record(a.string(),a.unknown()).optional(),middleware:a.array(a.object({name:a.string().optional(),enforce:a.enum([`pre`,`post`]).optional()}).passthrough()).optional(),hooks:a.record(a.string(),a.unknown()).optional()}),d=a.object({title:a.union([a.string(),a.record(a.string(),a.string())]).optional(),description:a.union([a.string(),a.record(a.string(),a.string())]).optional(),logo:a.union([a.string(),a.object({dark:a.string(),light:a.string(),alt:a.string().optional(),width:a.number().optional(),height:a.number().optional()})]).optional(),navbar:a.array(a.object({label:a.union([a.string(),a.record(a.string(),a.string())]),href:a.string(),items:a.array(a.object({label:a.union([a.string(),a.record(a.string(),a.string())]),href:a.string()})).optional()})).optional(),sidebar:a.record(a.string(),a.array(a.object({text:a.string(),link:a.string()}))).optional(),sidebarGroups:a.record(a.string(),a.object({title:a.union([a.string(),a.record(a.string(),a.string())]).optional(),icon:a.string().optional()})).optional(),socialLinks:a.array(c).optional(),editLink:a.string().refine(e=>!e||e.includes(`:path`),{message:`editLink must contain ':path' placeholder if specified`}).optional(),communityHelp:a.string().url().optional(),version:a.string().max(50).optional(),githubRepo:a.string().max(100).optional(),favicon:a.string().optional(),tabs:a.array(a.object({id:a.string(),text:a.union([a.string(),a.record(a.string(),a.string())]),icon:a.string().optional()})).optional(),codeTheme:a.union([a.string(),a.object({light:a.string(),dark:a.string()})]).optional()}),f=a.union([a.string(),a.object({rules:a.array(a.object({userAgent:a.string(),allow:a.union([a.string(),a.array(a.string())]).optional(),disallow:a.union([a.string(),a.array(a.string())]).optional()})).optional(),sitemaps:a.array(a.string().url()).optional()})]),p=a.object({defaultLocale:a.string(),locales:a.union([a.record(a.string(),a.string()),a.array(a.string())]).transform(e=>Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e),localeConfigs:a.record(a.string(),a.object({label:a.string().optional(),direction:a.enum([`ltr`,`rtl`]).optional(),htmlLang:a.string().optional(),calendar:a.string().optional()})).optional()}),m=a.object({defaultVersion:a.string(),prefix:a.string().optional(),versions:a.array(a.object({label:a.string(),path:a.string()}))}),h=a.object({headers:a.record(a.string(),a.string()).optional(),enableCSP:a.boolean().optional(),customHeaders:a.record(a.string(),a.string()).optional()}),g=a.object({google:a.string().optional(),bing:a.string().optional(),yandex:a.string().optional(),pinterest:a.string().optional(),facebook:a.string().optional()}),_=a.object({metatags:a.record(a.string(),a.string()).optional(),indexing:a.enum([`all`,`public`]).optional(),thumbnails:a.object({background:a.string().optional()}).optional(),verification:g.optional()}),v=a.object({measurementId:a.string().min(1,`Measurement ID is required for GA4`),debug:a.boolean().optional(),anonymizeIp:a.boolean().optional(),sendPageView:a.boolean().optional(),cookieFlags:a.string().optional(),autoTrack:a.object({pageViews:a.boolean().optional(),downloads:a.boolean().optional(),externalLinks:a.boolean().optional(),search:a.boolean().optional()}).optional()}),y=a.object({tagId:a.string().min(1,`Tag ID is required for GTM`),dataLayerName:a.string().optional(),preview:a.string().optional()}),b=a.object({appId:a.string().min(1,`Algolia App ID is required`),apiKey:a.string().min(1,`Algolia API Key is required`),indexName:a.string().min(1,`Algolia Index Name is required`)}),x=a.object({repo:a.string().min(1,`Giscus repository is required`),repoId:a.string().min(1,`Giscus repository ID is required`),category:a.string().optional(),categoryId:a.string().optional(),mapping:a.enum([`pathname`,`url`,`title`,`og:title`,`specific`,`number`]).optional(),strict:a.union([a.enum([`0`,`1`]),a.boolean()]).optional(),reactionsEnabled:a.union([a.enum([`0`,`1`]),a.boolean()]).optional(),emitMetadata:a.union([a.enum([`0`,`1`]),a.boolean()]).optional(),inputPosition:a.enum([`top`,`bottom`]).optional(),theme:a.string().optional(),darkTheme:a.string().optional(),lang:a.string().optional(),loading:a.enum([`lazy`,`eager`]).optional()}),S=a.object({enabled:a.boolean(),owner:a.string().min(1,`GitHub owner is required`),repo:a.string().min(1,`GitHub repository name is required`),categorySlug:a.string().optional(),endpoint:a.string().optional()}),C=a.object({analytics:a.boolean().optional(),speedInsights:a.boolean().optional()}),w=a.object({apiKey:a.string().min(1,`API key is required for PostHog`),host:a.string().url().optional(),capturePageview:a.boolean().optional(),capturePageleave:a.boolean().optional(),sessionRecording:a.boolean().optional(),autocapture:a.boolean().optional()}),T=a.object({ga4:v.optional(),gtm:y.optional(),vercel:C.optional(),posthog:w.optional()}),E=a.object({algolia:b.optional()}),D=a.object({giscus:x.optional(),custom:S.optional()}),O=a.object({analytics:T.optional(),search:E.optional(),feedback:D.optional()}),k=a.object({visible:a.boolean().optional(),environments:a.array(a.string()).optional()}),A=a.object({siteUrl:a.string().url().optional(),docsDir:a.string().optional(),base:a.string().optional(),theme:d.optional(),i18n:p.optional(),versions:m.optional(),mdx:l.optional(),plugins:a.array(u).optional(),robots:f.optional(),security:h.optional(),seo:_.optional(),integrations:O.optional(),drafts:k.optional(),featureFlags:a.record(a.string(),a.union([a.boolean(),a.string()])).optional(),vite:a.custom().optional()});var j=e({CONFIG_FILES:()=>M,defineConfig:()=>s,resolveConfig:()=>N,resolveConfigAndGenerateTypes:()=>P});const M=[`boltdocs.config.js`,`boltdocs.config.mjs`,`boltdocs.config.ts`];async function N(e,n=process.cwd()){let a=n,s={docsDir:r.resolve(e),theme:{title:`Boltdocs`,description:`A Vite documentation framework`,navbar:[{label:`Home`,href:`/`},{label:`Documentation`,href:`/docs`}],codeTheme:{light:`github-light`,dark:`github-dark`}}},c={};for(let e of M){let t=r.resolve(a,e);if(i.existsSync(t))try{let{loadConfigFromFile:e}=await import(`vite`),n=await e({command:`serve`,mode:`development`},t,a);if(n){c=n.config;break}}catch(t){t instanceof Error&&o(`Failed to load config from ${e}: ${t}`)}}let l={title:c.title,description:c.description,logo:c.logo,favicon:c.favicon,navbar:c.navbar,sidebar:c.sidebar,sidebarGroups:c.theme?.sidebarGroups,socialLinks:c.socialLinks,githubRepo:c.githubRepo,tabs:c.tabs,codeTheme:c.codeTheme,communityHelp:c.communityHelp,version:c.version,editLink:c.editLink,...c.theme||{}},u=Object.fromEntries(Object.entries(l).filter(([e,t])=>t!==void 0));u.navbar&&=u.navbar.map(e=>({label:e.label||``,href:e.href||``,items:e.items}));let d={docsDir:r.resolve(e),theme:{...s.theme,...u},i18n:c.i18n?{...c.i18n,locales:Array.isArray(c.i18n.locales)?Object.fromEntries(c.i18n.locales.map(e=>[e,e])):c.i18n.locales}:void 0,versions:c.versions,siteUrl:c.siteUrl,base:c.base,seo:c.seo,plugins:c.plugins||[],robots:c.robots,security:c.security,integrations:c.integrations,vite:c.vite},f=A.safeParse(d);if(!f.success)throw new t(`Invalid Boltdocs configuration:\n${f.error.issues.map(e=>` - ${e.path.join(`.`)}: ${e.message}`).join(`
7
+ `)}`);return f.data}async function P(e,t=process.cwd()){let r=await N(e,t);return n(r,e,t),r}export{s as a,u as i,j as n,N as r,M as t};
@@ -3,4 +3,4 @@
3
3
  * Copyright (c) 2026 Jesus Alcala
4
4
  * Licensed under the MIT License.
5
5
  */
6
- const e=require(`./config-DrRQYDCI.cjs`);exports.CONFIG_FILES=e.t,exports.defineConfig=e.a,exports.resolveConfig=e.n,exports.resolveConfigAndGenerateTypes=e.r;
6
+ const e=require(`./config-DlGoEM9D.cjs`);exports.CONFIG_FILES=e.t,exports.defineConfig=e.a,exports.resolveConfig=e.n,exports.resolveConfigAndGenerateTypes=e.r;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Boltdocs - https://boltdocs.vercel.app
3
+ * Copyright (c) 2026 Jesus Alcala
4
+ * Licensed under the MIT License.
5
+ */
6
+ const e=require(`./chunk-D1Md3oWO.cjs`),t=require(`./errors-vKw8CkiX.cjs`),n=require(`./types-generator-BXhv7Ill.cjs`);let r=require(`node:path`);r=e.r(r);let i=require(`node:fs`);i=e.r(i);let a=require(`zod`),o=require(`@bdocs/dui`);function s(e){return e}const c=a.z.object({icon:a.z.string().max(50),link:a.z.string().url()});a.z.object({text:a.z.string().max(2e3).optional()});const l=a.z.object({processor:a.z.enum([`unified`,`satteri`]).optional()}),u=a.z.object({name:a.z.string(),enforce:a.z.enum([`pre`,`post`]).optional(),version:a.z.string().optional(),boltdocsVersion:a.z.string().optional(),clientEntry:a.z.string().optional(),remarkPlugins:a.z.array(a.z.unknown()).optional(),rehypePlugins:a.z.array(a.z.unknown()).optional(),vitePlugins:a.z.array(a.z.unknown()).optional(),components:a.z.record(a.z.string(),a.z.string()).optional(),metadata:a.z.record(a.z.string(),a.z.unknown()).optional(),middleware:a.z.array(a.z.object({name:a.z.string().optional(),enforce:a.z.enum([`pre`,`post`]).optional()}).passthrough()).optional(),hooks:a.z.record(a.z.string(),a.z.unknown()).optional()}),d=a.z.object({title:a.z.union([a.z.string(),a.z.record(a.z.string(),a.z.string())]).optional(),description:a.z.union([a.z.string(),a.z.record(a.z.string(),a.z.string())]).optional(),logo:a.z.union([a.z.string(),a.z.object({dark:a.z.string(),light:a.z.string(),alt:a.z.string().optional(),width:a.z.number().optional(),height:a.z.number().optional()})]).optional(),navbar:a.z.array(a.z.object({label:a.z.union([a.z.string(),a.z.record(a.z.string(),a.z.string())]),href:a.z.string(),items:a.z.array(a.z.object({label:a.z.union([a.z.string(),a.z.record(a.z.string(),a.z.string())]),href:a.z.string()})).optional()})).optional(),sidebar:a.z.record(a.z.string(),a.z.array(a.z.object({text:a.z.string(),link:a.z.string()}))).optional(),sidebarGroups:a.z.record(a.z.string(),a.z.object({title:a.z.union([a.z.string(),a.z.record(a.z.string(),a.z.string())]).optional(),icon:a.z.string().optional()})).optional(),socialLinks:a.z.array(c).optional(),editLink:a.z.string().refine(e=>!e||e.includes(`:path`),{message:`editLink must contain ':path' placeholder if specified`}).optional(),communityHelp:a.z.string().url().optional(),version:a.z.string().max(50).optional(),githubRepo:a.z.string().max(100).optional(),favicon:a.z.string().optional(),tabs:a.z.array(a.z.object({id:a.z.string(),text:a.z.union([a.z.string(),a.z.record(a.z.string(),a.z.string())]),icon:a.z.string().optional()})).optional(),codeTheme:a.z.union([a.z.string(),a.z.object({light:a.z.string(),dark:a.z.string()})]).optional()}),f=a.z.union([a.z.string(),a.z.object({rules:a.z.array(a.z.object({userAgent:a.z.string(),allow:a.z.union([a.z.string(),a.z.array(a.z.string())]).optional(),disallow:a.z.union([a.z.string(),a.z.array(a.z.string())]).optional()})).optional(),sitemaps:a.z.array(a.z.string().url()).optional()})]),p=a.z.object({defaultLocale:a.z.string(),locales:a.z.union([a.z.record(a.z.string(),a.z.string()),a.z.array(a.z.string())]).transform(e=>Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e),localeConfigs:a.z.record(a.z.string(),a.z.object({label:a.z.string().optional(),direction:a.z.enum([`ltr`,`rtl`]).optional(),htmlLang:a.z.string().optional(),calendar:a.z.string().optional()})).optional()}),m=a.z.object({defaultVersion:a.z.string(),prefix:a.z.string().optional(),versions:a.z.array(a.z.object({label:a.z.string(),path:a.z.string()}))}),h=a.z.object({headers:a.z.record(a.z.string(),a.z.string()).optional(),enableCSP:a.z.boolean().optional(),customHeaders:a.z.record(a.z.string(),a.z.string()).optional()}),g=a.z.object({google:a.z.string().optional(),bing:a.z.string().optional(),yandex:a.z.string().optional(),pinterest:a.z.string().optional(),facebook:a.z.string().optional()}),_=a.z.object({metatags:a.z.record(a.z.string(),a.z.string()).optional(),indexing:a.z.enum([`all`,`public`]).optional(),thumbnails:a.z.object({background:a.z.string().optional()}).optional(),verification:g.optional()}),v=a.z.object({measurementId:a.z.string().min(1,`Measurement ID is required for GA4`),debug:a.z.boolean().optional(),anonymizeIp:a.z.boolean().optional(),sendPageView:a.z.boolean().optional(),cookieFlags:a.z.string().optional(),autoTrack:a.z.object({pageViews:a.z.boolean().optional(),downloads:a.z.boolean().optional(),externalLinks:a.z.boolean().optional(),search:a.z.boolean().optional()}).optional()}),y=a.z.object({tagId:a.z.string().min(1,`Tag ID is required for GTM`),dataLayerName:a.z.string().optional(),preview:a.z.string().optional()}),b=a.z.object({appId:a.z.string().min(1,`Algolia App ID is required`),apiKey:a.z.string().min(1,`Algolia API Key is required`),indexName:a.z.string().min(1,`Algolia Index Name is required`)}),x=a.z.object({repo:a.z.string().min(1,`Giscus repository is required`),repoId:a.z.string().min(1,`Giscus repository ID is required`),category:a.z.string().optional(),categoryId:a.z.string().optional(),mapping:a.z.enum([`pathname`,`url`,`title`,`og:title`,`specific`,`number`]).optional(),strict:a.z.union([a.z.enum([`0`,`1`]),a.z.boolean()]).optional(),reactionsEnabled:a.z.union([a.z.enum([`0`,`1`]),a.z.boolean()]).optional(),emitMetadata:a.z.union([a.z.enum([`0`,`1`]),a.z.boolean()]).optional(),inputPosition:a.z.enum([`top`,`bottom`]).optional(),theme:a.z.string().optional(),darkTheme:a.z.string().optional(),lang:a.z.string().optional(),loading:a.z.enum([`lazy`,`eager`]).optional()}),S=a.z.object({enabled:a.z.boolean(),owner:a.z.string().min(1,`GitHub owner is required`),repo:a.z.string().min(1,`GitHub repository name is required`),categorySlug:a.z.string().optional(),endpoint:a.z.string().optional()}),C=a.z.object({analytics:a.z.boolean().optional(),speedInsights:a.z.boolean().optional()}),w=a.z.object({apiKey:a.z.string().min(1,`API key is required for PostHog`),host:a.z.string().url().optional(),capturePageview:a.z.boolean().optional(),capturePageleave:a.z.boolean().optional(),sessionRecording:a.z.boolean().optional(),autocapture:a.z.boolean().optional()}),T=a.z.object({ga4:v.optional(),gtm:y.optional(),vercel:C.optional(),posthog:w.optional()}),E=a.z.object({algolia:b.optional()}),D=a.z.object({giscus:x.optional(),custom:S.optional()}),O=a.z.object({analytics:T.optional(),search:E.optional(),feedback:D.optional()}),k=a.z.object({visible:a.z.boolean().optional(),environments:a.z.array(a.z.string()).optional()}),A=a.z.object({siteUrl:a.z.string().url().optional(),docsDir:a.z.string().optional(),base:a.z.string().optional(),theme:d.optional(),i18n:p.optional(),versions:m.optional(),mdx:l.optional(),plugins:a.z.array(u).optional(),robots:f.optional(),security:h.optional(),seo:_.optional(),integrations:O.optional(),drafts:k.optional(),featureFlags:a.z.record(a.z.string(),a.z.union([a.z.boolean(),a.z.string()])).optional(),vite:a.z.custom().optional()}),j=[`boltdocs.config.js`,`boltdocs.config.mjs`,`boltdocs.config.ts`];async function M(e,n=process.cwd()){let a=n,s={docsDir:r.default.resolve(e),theme:{title:`Boltdocs`,description:`A Vite documentation framework`,navbar:[{label:`Home`,href:`/`},{label:`Documentation`,href:`/docs`}],codeTheme:{light:`github-light`,dark:`github-dark`}}},c={};for(let e of j){let t=r.default.resolve(a,e);if(i.default.existsSync(t))try{let{loadConfigFromFile:e}=await import(`vite`),n=await e({command:`serve`,mode:`development`},t,a);if(n){c=n.config;break}}catch(t){t instanceof Error&&(0,o.warn)(`Failed to load config from ${e}: ${t}`)}}let l={title:c.title,description:c.description,logo:c.logo,favicon:c.favicon,navbar:c.navbar,sidebar:c.sidebar,sidebarGroups:c.theme?.sidebarGroups,socialLinks:c.socialLinks,githubRepo:c.githubRepo,tabs:c.tabs,codeTheme:c.codeTheme,communityHelp:c.communityHelp,version:c.version,editLink:c.editLink,...c.theme||{}},u=Object.fromEntries(Object.entries(l).filter(([e,t])=>t!==void 0));u.navbar&&=u.navbar.map(e=>({label:e.label||``,href:e.href||``,items:e.items}));let d={docsDir:r.default.resolve(e),theme:{...s.theme,...u},i18n:c.i18n?{...c.i18n,locales:Array.isArray(c.i18n.locales)?Object.fromEntries(c.i18n.locales.map(e=>[e,e])):c.i18n.locales}:void 0,versions:c.versions,siteUrl:c.siteUrl,base:c.base,seo:c.seo,plugins:c.plugins||[],robots:c.robots,security:c.security,integrations:c.integrations,vite:c.vite},f=A.safeParse(d);if(!f.success)throw new t.r(`Invalid Boltdocs configuration:\n${f.error.issues.map(e=>` - ${e.path.join(`.`)}: ${e.message}`).join(`
7
+ `)}`);return f.data}async function N(e,t=process.cwd()){let r=await M(e,t);return n.t(r,e,t),r}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return j}});