boltdocs 3.2.2 → 3.3.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 (155) hide show
  1. package/bin/boltdocs.js +20 -1
  2. package/bin/preloader.mjs +28 -0
  3. package/dist/{adapters-ByYY44Zy.mjs → adapters-BmB4TKCc.mjs} +1 -1
  4. package/dist/{adapters-DvmtpdSF.cjs → adapters-Cp1Maurn.cjs} +1 -1
  5. package/dist/audit-CLXjMzwQ.mjs +11 -0
  6. package/dist/audit-COgjnQ5n.cjs +11 -0
  7. package/dist/build-BS2hefiL.cjs +6 -0
  8. package/dist/build-C5mNh9D-.mjs +6 -0
  9. package/dist/cache-CJE9nWLE.cjs +6 -0
  10. package/dist/cache-OY4HzIXl.mjs +6 -0
  11. package/dist/callout-oI_LCbxS.d.ts +71 -0
  12. package/dist/callout-plqx9Dw-.d.cts +71 -0
  13. package/dist/client/index.cjs +1265 -569
  14. package/dist/client/index.d.cts +3 -542
  15. package/dist/client/index.d.ts +3 -542
  16. package/dist/client/index.js +1167 -521
  17. package/dist/client/mdx.cjs +1 -1
  18. package/dist/client/mdx.d.cts +24 -2
  19. package/dist/client/mdx.d.ts +24 -2
  20. package/dist/client/mdx.js +1 -1
  21. package/dist/client/primitives.cjs +14 -4
  22. package/dist/client/primitives.d.cts +281 -38
  23. package/dist/client/primitives.d.ts +281 -38
  24. package/dist/client/primitives.js +5 -5
  25. package/dist/client/router.cjs +49 -0
  26. package/dist/client/router.d.cts +3 -0
  27. package/dist/client/router.d.ts +3 -0
  28. package/dist/client/router.js +8 -0
  29. package/dist/client/theme/reset.css +40 -4
  30. package/dist/{config-BpzaPsJj.d.cts → config-BoRlz0Ca.d.mts} +157 -14
  31. package/dist/{config-xtS0ZkMm.d.mts → config-CTsX_tGM.d.cts} +157 -14
  32. package/dist/config-Ceib-AOH.cjs +7 -0
  33. package/dist/config-DGLQsy7y.mjs +7 -0
  34. package/dist/{package-CH2ChQqw.cjs → config-files-BYHDOrKn.mjs} +1 -1
  35. package/dist/config-files-D9cdBMl2.cjs +6 -0
  36. package/dist/config-jJh8WYJI.cjs +6 -0
  37. package/dist/csp-C4LmN1ko.cjs +6 -0
  38. package/dist/csp-D6JEOqKh.mjs +6 -0
  39. package/dist/dev-Ch3hEe5Y.cjs +6 -0
  40. package/dist/dev-QPNxysrd.mjs +6 -0
  41. package/dist/{docs-layout-BdtZ9z6s.js → docs-layout-CbZ7LDRe.js} +504 -249
  42. package/dist/{docs-layout-CFWI15Id.cjs → docs-layout-vzfXed1Q.cjs} +516 -254
  43. package/dist/{doctor-BBtmNJE0.cjs → doctor-B1_YL0Wt.cjs} +1 -1
  44. package/dist/doctor-C7whl4ED.cjs +6 -0
  45. package/dist/doctor-DmQnml2k.mjs +6 -0
  46. package/dist/{generator-COepVWGi.cjs → generator-BlW45ST7.cjs} +5 -3
  47. package/dist/{generator-CcOBN5vI.mjs → generator-BwknNejd.mjs} +5 -3
  48. package/dist/{handler-XX7cLTqe.cjs → handler-CDEoKARD.cjs} +2 -2
  49. package/dist/{handler-DzQae4eA.mjs → handler-D7UyZlPm.mjs} +2 -2
  50. package/dist/{image-Bz87fCla.js → image-B-NDSDuY.js} +129 -11
  51. package/dist/{image-C4TlpMHn.cjs → image-Hnaa2bJd.cjs} +175 -9
  52. package/dist/index-C56bL-A-.d.cts +1344 -0
  53. package/dist/{sidebar-COTaMHR-.d.ts → index-CPUUKzxD.d.cts} +344 -327
  54. package/dist/{sidebar-CrEdJuHX.d.cts → index-Ci4kfOHF.d.ts} +344 -327
  55. package/dist/index-Cu9H6CRa.d.ts +1344 -0
  56. package/dist/link-CgdI6O2o.js +872 -0
  57. package/dist/{link-D1Gjkb-2.cjs → link-vZjmD-es.cjs} +406 -223
  58. package/dist/{mdx-BuO6a1f7.js → mdx-BRT71V5Q.js} +211 -168
  59. package/dist/{mdx-CD-tSjRG.cjs → mdx-D0Absdq5.cjs} +225 -169
  60. package/dist/native-BNCY7PRF.cjs +6 -0
  61. package/dist/native-Di9Fnfrv.mjs +6 -0
  62. package/dist/native-Kre2T5eS.cjs +6 -0
  63. package/dist/node/cache.cjs +1 -1
  64. package/dist/node/cache.d.cts +19 -3
  65. package/dist/node/cache.d.mts +19 -3
  66. package/dist/node/cache.mjs +1 -1
  67. package/dist/node/cli-entry.cjs +1 -9
  68. package/dist/node/cli-entry.mjs +1 -9
  69. package/dist/node/index.cjs +1 -1
  70. package/dist/node/index.d.cts +245 -17
  71. package/dist/node/index.d.mts +246 -18
  72. package/dist/node/index.mjs +1 -1
  73. package/dist/node/mdx/shiki-adapter.cjs +1 -1
  74. package/dist/node/mdx/shiki-adapter.d.cts +24 -3
  75. package/dist/node/mdx/shiki-adapter.d.mts +24 -2
  76. package/dist/node/mdx/shiki-adapter.mjs +1 -1
  77. package/dist/node-Du5UL5wo.mjs +23 -0
  78. package/dist/node-DunuGqyp.cjs +23 -0
  79. package/dist/{package-DSSB8B5L.mjs → package-DA848keM.mjs} +1 -1
  80. package/dist/package-wplzySjz.cjs +6 -0
  81. package/dist/pages-external-BBw8ObVK.mjs +6 -0
  82. package/dist/pages-external-DPiPFxxP.cjs +6 -0
  83. package/dist/parser-BqTOsEUa.cjs +6 -0
  84. package/dist/parser-CGMY2lJ7.mjs +6 -0
  85. package/dist/plugin-BcTzvHAJ.mjs +69 -0
  86. package/dist/plugin-TulVMt1z.cjs +69 -0
  87. package/dist/plugin-context-C-l90hFt.cjs +15 -0
  88. package/dist/plugin-context-wqHNSZum.mjs +15 -0
  89. package/dist/plugin-lifecycle-B1BzSHdn.cjs +6 -0
  90. package/dist/resolve-B7vWOd8R.cjs +6 -0
  91. package/dist/resolve-C2kKnk_5.mjs +6 -0
  92. package/dist/resolve-It1Iug83.cjs +6 -0
  93. package/dist/resolve-YdTrt_FG.mjs +6 -0
  94. package/dist/router-C3kygdRK.cjs +1285 -0
  95. package/dist/router-CZBxMRAH.js +987 -0
  96. package/dist/routes-BL4y79tb.mjs +6 -0
  97. package/dist/routes-C2nPecwu.cjs +6 -0
  98. package/dist/routes-U9L8psZ9.cjs +6 -0
  99. package/dist/{search-dialog-DHqwjJuG.cjs → search-dialog-BCOHQGSt.cjs} +1 -1
  100. package/dist/search-dialog-Bp_P1MPP.js +481 -0
  101. package/dist/{search-dialog-DFnlx8LO.js → search-dialog-BqkzDTq2.js} +107 -57
  102. package/dist/{search-dialog-BRFno7HD.cjs → search-dialog-CIeIUhAn.cjs} +218 -43
  103. package/dist/{search-dialog-D6TvjcuV.js → search-dialog-DtmxmfEu.js} +1 -1
  104. package/dist/{search-dialog-B1NERUNx.cjs → search-dialog-x_qHU8ty.cjs} +107 -58
  105. package/dist/server/index.cjs +1 -1
  106. package/dist/server/index.d.mts +1 -1
  107. package/dist/server/index.mjs +1 -1
  108. package/dist/update-check-BKqmYfwT.cjs +11 -0
  109. package/dist/update-check-QnrVR3q1.mjs +11 -0
  110. package/dist/utils-8lzafE49.mjs +7 -0
  111. package/dist/utils-ej6_SjIZ.cjs +7 -0
  112. package/dist/virtual-modules-Ca5tHk1X.cjs +30 -0
  113. package/dist/virtual-modules-Dlgt1fP0.mjs +30 -0
  114. package/package.json +18 -16
  115. package/src/shared/mdx-path.ts +12 -0
  116. package/src/shared/structured-data.ts +145 -0
  117. package/src/shared/types.ts +220 -16
  118. package/dist/banner-BMop1KLF.d.ts +0 -100
  119. package/dist/banner-CVD0GugR.d.cts +0 -100
  120. package/dist/cache-CO4Dy2uQ.cjs +0 -6
  121. package/dist/cache-Dk53iOo6.mjs +0 -6
  122. package/dist/config-CCXp3aXO.mjs +0 -7
  123. package/dist/config-CMd4XoFq.cjs +0 -6
  124. package/dist/config-DlGoEM9D.cjs +0 -7
  125. package/dist/csp-CRp_3U7a.cjs +0 -6
  126. package/dist/csp-oTC2ygvF.mjs +0 -6
  127. package/dist/doctor-Bv16QSrI.cjs +0 -7
  128. package/dist/doctor-DOAbSaiL.mjs +0 -7
  129. package/dist/headers-Ddwek8K7.mjs +0 -6
  130. package/dist/headers-dg4SDrjY.cjs +0 -6
  131. package/dist/link-2PzgTnaP.js +0 -673
  132. package/dist/meta-loader-C4Hu9RN9.mjs +0 -6
  133. package/dist/meta-loader-Dq1zcFnh.cjs +0 -6
  134. package/dist/node-B5hu_6qj.cjs +0 -104
  135. package/dist/node-BXtqM1uH.mjs +0 -6
  136. package/dist/node-C8725aw7.mjs +0 -104
  137. package/dist/node-aD1eisrR.cjs +0 -6
  138. package/dist/pages-external-BYa4JSda.mjs +0 -6
  139. package/dist/pages-external-XkYIs-d5.cjs +0 -6
  140. package/dist/parser-DCiEWkSk.cjs +0 -8
  141. package/dist/parser-qk9FIHJ7.mjs +0 -8
  142. package/dist/plugin-CX1OZ6jB.cjs +0 -73
  143. package/dist/plugin-CgfiWaFZ.mjs +0 -73
  144. package/dist/routes-BW6zsk7Z.mjs +0 -6
  145. package/dist/routes-BgoIB5wb.cjs +0 -6
  146. package/dist/routes-CORVxc02.cjs +0 -6
  147. package/dist/search-dialog-BmxHiKwt.js +0 -312
  148. package/dist/shiki-adapter-CoQ6jyJ4.cjs +0 -6
  149. package/dist/shiki-adapter-D-aKw7PP.mjs +0 -6
  150. package/dist/utils-Crm9oPcV.mjs +0 -7
  151. package/dist/utils-D6Xtj0FZ.cjs +0 -7
  152. /package/dist/{errors-0zGHRLue.mjs → errors-N-b6Sn2G.mjs} +0 -0
  153. /package/dist/{index-1KsTDq4o.d.mts → index-lFoyzCXy.d.mts} +0 -0
  154. /package/dist/{types-generator-BXhv7Ill.cjs → types-generator-DDSA93P3.cjs} +0 -0
  155. /package/dist/{types-generator-bDPvUztF.mjs → types-generator-DG1GX1EZ.mjs} +0 -0
@@ -1,12 +1,46 @@
1
1
 
2
- import { flushCache } from "./cache.cjs";
2
+ import { FileCache, flushCache } from "./cache.cjs";
3
3
  import { i as handleVercelFeedback, n as handleWebFeedback, r as handleNetlifyFeedback, t as handleAwsFeedback } from "../index-aWC0KjDF.cjs";
4
- import { a as BoltdocsThemeConfig, c as PluginLogger, d as PluginTransformMiddleware, f as RouteMeta, i as BoltdocsPlugin, l as PluginMeta, n as defineConfig, o as PluginContext, r as BoltdocsConfig, s as PluginLifecycleHooks, t as resolveConfig, u as PluginStore } from "../config-BpzaPsJj.cjs";
4
+ import { C as StructuredData, _ as PluginServerMiddleware, a as BoltdocsThemeConfig, b as RegisteredVirtualModule, c as ExternalFileRoute, d as JsonLdValue, f as PluginContext, g as PluginMeta, h as PluginLogger, i as BoltdocsExperimentalConfig, l as IPluginLifecycleManager, m as PluginLifecycleHooks, n as defineConfig, o as BoltdocsViewTransitionsConfig, p as PluginHmrEvent, r as BoltdocsConfig, s as DiagnosticRecord, t as resolveConfig, u as JsonLdObject, v as PluginStore, x as RouteMeta, y as PluginTransformMiddleware } from "../config-CTsX_tGM.cjs";
5
5
  import { InlineConfig, Plugin } from "vite";
6
6
  export * from "@bdocs/unist-utils";
7
7
 
8
8
  //#region \0rolldown/runtime.js
9
9
  //#endregion
10
+ //#region src/node/routes/types.d.ts
11
+ interface DirectoryMeta {
12
+ title?: string;
13
+ order?: string[] | number;
14
+ icon?: string;
15
+ collapsible?: boolean;
16
+ collapsed?: boolean;
17
+ [key: string]: unknown;
18
+ }
19
+ /**
20
+ * Internal representation of a parsed documentation file before finalizing groups.
21
+ * Stored in the file cache to avoid re-parsing unchanged files.
22
+ */
23
+ interface ParsedDocFile {
24
+ /** The core route metadata without group-level details (inferred later) */
25
+ route: Omit<RouteMeta, 'group' | 'groupTitle' | 'groupPosition'>;
26
+ /** The base directory of the file (used to group files together) */
27
+ relativeDir?: string;
28
+ /** Whether this file is the index file for its directory group */
29
+ isGroupIndex: boolean;
30
+ /** If this is a group index, any specific frontmatter metadata dictating the group's title and position */
31
+ groupMeta?: {
32
+ title: string;
33
+ position?: number;
34
+ icon?: string;
35
+ };
36
+ /** Extracted group position from the directory name if it has a numeric prefix */
37
+ inferredGroupPosition?: number;
38
+ /** Extracted tab name from the directory name if it follows the (tab-name) syntax */
39
+ inferredTab?: string;
40
+ /** Extracted collection name from the [name] directory syntax */
41
+ inferredCollection?: string;
42
+ }
43
+ //#endregion
10
44
  //#region src/node/plugin/types.d.ts
11
45
  /**
12
46
  * Configuration options specifically for the Boltdocs Vite plugin.
@@ -14,8 +48,14 @@ export * from "@bdocs/unist-utils";
14
48
  interface BoltdocsPluginOptions {
15
49
  /** The root directory containing markdown files (default: 'docs') */
16
50
  docsDir?: string;
17
- /** Enable turbo mode (Sätteri MDX compiler) */
18
- turbo?: boolean;
51
+ /** Project root directory (defaults to cwd) */
52
+ root?: string;
53
+ /** Pre-computed routes. When provided, the plugin skips route generation in its config hook. */
54
+ routes?: RouteMeta[];
55
+ /** Internal build target flag used to keep client and SSR entry generation isolated. */
56
+ ssr?: boolean;
57
+ /** Use Sätteri's disk artifacts. Disabled for Vite serve/dev so HMR uses source MDX. */
58
+ useCompiledPages?: boolean;
19
59
  }
20
60
  //#endregion
21
61
  //#region src/node/plugin/entry.d.ts
@@ -29,11 +69,89 @@ interface BoltdocsPluginOptions {
29
69
  */
30
70
  declare function generateEntryCode(options: BoltdocsPluginOptions, config?: BoltdocsConfig): string;
31
71
  //#endregion
32
- //#region src/node/routes/index.d.ts
72
+ //#region src/node/routes/parser/cache.d.ts
33
73
  /**
34
- * Invalidates the global route metadata and clears local state.
74
+ * Parsed-document cache scoped to one Boltdocs project.
75
+ *
76
+ * The old implementation kept one process-wide Map. That was fast, but a
77
+ * second project in the same process could observe the first project's
78
+ * parsed documents. Instances are intentionally cheap and are owned by a
79
+ * RouteCacheContext.
35
80
  */
36
- declare function invalidateRouteCache(): void;
81
+ declare class ParserCache {
82
+ private readonly memoryCache;
83
+ private readonly cacheDir;
84
+ constructor(root?: string, namespace?: string);
85
+ get(file: string): Promise<ParsedDocFile | null>;
86
+ set(file: string, data: ParsedDocFile): Promise<void>;
87
+ invalidate(file: string): void;
88
+ /**
89
+ * Clear only the process-local entries.
90
+ *
91
+ * Disk shards are versioned and validated by `get()` using the source mtime,
92
+ * so deleting the whole directory on every route invalidation only creates
93
+ * unnecessary I/O and forces unchanged files to be parsed again. Stale
94
+ * shards are harmless and are naturally replaced when their files change.
95
+ */
96
+ clear(): void;
97
+ get size(): number;
98
+ }
99
+ declare namespace ParserCache {
100
+ const get: (file: string) => Promise<ParsedDocFile | null>;
101
+ const set: (file: string, data: ParsedDocFile) => Promise<void>;
102
+ const invalidate: (file: string) => void;
103
+ const clear: () => void;
104
+ }
105
+ //#endregion
106
+ //#region src/node/routes/cache.d.ts
107
+ interface DirectoryMetaCacheEntry {
108
+ mtimeMs: number;
109
+ size: number;
110
+ content: DirectoryMeta;
111
+ }
112
+ interface RouteDiscoverySnapshot {
113
+ version: 1;
114
+ files: string[];
115
+ directoryMetaFiles: string[];
116
+ directories: Record<string, number>;
117
+ }
118
+ interface RouteCacheVariant {
119
+ readonly fingerprint: string;
120
+ readonly docCache: FileCache<ParsedDocFile>;
121
+ readonly parserCache: ParserCache;
122
+ cachedFileList: string[] | null;
123
+ localizedPathCache: Map<string, string>;
124
+ cachedNativeDocs: Record<string, any> | null;
125
+ frontmatterHashes: Map<string, string>;
126
+ directoryMeta: Record<string, DirectoryMeta> | null;
127
+ cachedDirectoryMetaFiles: string[] | null;
128
+ directoryMetaEntries: Map<string, DirectoryMetaCacheEntry>;
129
+ discoverySnapshot: RouteDiscoverySnapshot | null;
130
+ discoverySnapshotLoaded: boolean;
131
+ readonly discoverySnapshotPath: string;
132
+ }
133
+ interface RouteCacheContext {
134
+ readonly docsDir: string;
135
+ readonly cacheRoot: string;
136
+ /** Legacy active cache facade used by HMR/plugin consumers. */
137
+ docCache: FileCache<ParsedDocFile>;
138
+ parserCache: ParserCache;
139
+ cachedFileList: string[] | null;
140
+ localizedPathCache: Map<string, string>;
141
+ cachedNativeDocs: Record<string, any> | null;
142
+ frontmatterHashes: Map<string, string>;
143
+ directoryMeta: Record<string, DirectoryMeta> | null;
144
+ cachedDirectoryMetaFiles: string[] | null;
145
+ readonly variants: Map<string, RouteCacheVariant>;
146
+ activeVariant: RouteCacheVariant | null;
147
+ activeGenerations: Map<string, Promise<RouteMeta[]>>;
148
+ generationEpoch: number;
149
+ disposed: boolean;
150
+ }
151
+ //#endregion
152
+ //#region src/node/routes/index.d.ts
153
+ /** Invalidates one project's route metadata and parser state. */
154
+ declare function invalidateRouteCache(contextOrDocsDir?: RouteCacheContext | string): void;
37
155
  /**
38
156
  * Generates the entire route map for the documentation site.
39
157
  *
@@ -45,10 +163,64 @@ declare function invalidateRouteCache(): void;
45
163
  * @param basePath - The base URL path for the routes (default: '/docs')
46
164
  * @returns A promise resolving to an array of RouteMeta objects
47
165
  */
48
- declare function generateRoutes(docsDir: string, config?: BoltdocsConfig, basePath?: string, forceScan?: boolean, turbo?: boolean): Promise<RouteMeta[]>;
166
+ declare function generateRoutes(docsDir: string, config?: BoltdocsConfig, basePath?: string, forceScan?: boolean, cacheContext?: RouteCacheContext, cacheVariant?: RouteCacheVariant): Promise<RouteMeta[]>;
167
+ //#endregion
168
+ //#region src/shared/structured-data.d.ts
169
+ interface WebSiteStructuredDataOptions {
170
+ name: string;
171
+ url: string;
172
+ description?: string;
173
+ searchUrl?: string;
174
+ }
175
+ interface ArticleStructuredDataOptions {
176
+ headline: string;
177
+ url: string;
178
+ description?: string;
179
+ datePublished?: string | Date;
180
+ dateModified?: string | Date;
181
+ image?: string;
182
+ author?: string | {
183
+ name: string;
184
+ url?: string;
185
+ };
186
+ }
187
+ interface BreadcrumbStructuredDataItem {
188
+ name: string;
189
+ url: string;
190
+ }
191
+ interface StructuredDataFactoryOptions {
192
+ /** A WebSite graph for the global site identity. */
193
+ website?: WebSiteStructuredDataOptions;
194
+ /** An Article graph for the current page or release post. */
195
+ article?: ArticleStructuredDataOptions;
196
+ /** A BreadcrumbList graph for the current page hierarchy. */
197
+ breadcrumbs?: BreadcrumbStructuredDataItem[];
198
+ /** Additional graph nodes for schema types not covered by the presets. */
199
+ additional?: JsonLdObject | JsonLdObject[];
200
+ }
201
+ /** Preserve literal JSON-LD types in config files and frontmatter helpers. */
202
+ declare function defineStructuredData<T extends StructuredData>(data: T): T;
203
+ /**
204
+ * Creates one JSON-LD value from the common website/article/breadcrumb presets.
205
+ * Single-node input returns an object; multiple nodes return a graph array.
206
+ */
207
+ declare function createStructuredData(options: StructuredDataFactoryOptions): StructuredData;
208
+ declare function createWebSiteStructuredData(options: WebSiteStructuredDataOptions): JsonLdObject;
209
+ declare function createArticleStructuredData(options: ArticleStructuredDataOptions): JsonLdObject;
210
+ declare function createBreadcrumbStructuredData(items: BreadcrumbStructuredDataItem[]): JsonLdObject;
49
211
  //#endregion
50
212
  //#region src/node/plugins/plugin-types.d.ts
51
- interface SecureBoltdocsPlugin {
213
+ interface PluginCssConfig {
214
+ /** CSS files to inject automatically into entry bundle */
215
+ cssFiles?: string[];
216
+ /** Inline CSS strings to inject into HTML <head> */
217
+ headStyles?: string[];
218
+ /** PostCSS plugins to append to Vite CSS pipeline */
219
+ postcssPlugins?: unknown[];
220
+ /** Vite CSS preprocessor options (e.g. scss, less, stylus) */
221
+ preprocessorOptions?: Record<string, unknown>;
222
+ }
223
+ interface BoltdocsPlugin {
52
224
  name: string;
53
225
  enforce?: 'pre' | 'post';
54
226
  version?: string;
@@ -58,6 +230,7 @@ interface SecureBoltdocsPlugin {
58
230
  vitePlugins?: Plugin[];
59
231
  components?: Record<string, string>;
60
232
  metadata?: Record<string, unknown>;
233
+ css?: PluginCssConfig;
61
234
  middleware?: PluginTransformMiddleware[];
62
235
  hooks?: PluginLifecycleHooks;
63
236
  }
@@ -105,10 +278,24 @@ declare class BoltdocsPluginStore implements PluginStore {
105
278
  }
106
279
  //#endregion
107
280
  //#region src/node/plugins/plugin-validator.d.ts
108
- declare function validatePlugins(plugins: any[], boltdocsVersion: string): SecureBoltdocsPlugin[];
281
+ declare function validatePlugins(plugins: any[], boltdocsVersion: string): BoltdocsPlugin[];
282
+ //#endregion
283
+ //#region src/node/plugins/plugin-context.d.ts
284
+ interface PluginRuntimeState {
285
+ virtualModuleRegistry: Map<string, RegisteredVirtualModule>;
286
+ middlewareRegistry: Map<string, PluginTransformMiddleware>;
287
+ diagnosticRecords: DiagnosticRecord[];
288
+ diagnosticIdCounter: number;
289
+ hmrFileHandlers: Map<PluginHmrEvent, Set<(filePath: string) => void | Promise<void>>>;
290
+ hmrSender: ((event: string, data?: unknown) => void) | null;
291
+ pluginServerMiddleware: PluginServerMiddleware[];
292
+ serverStartCallbacks: Array<() => void | Promise<void>>;
293
+ serverEndCallbacks: Array<() => void | Promise<void>>;
294
+ }
109
295
  //#endregion
110
296
  //#region src/node/plugins/plugin-lifecycle.d.ts
111
- declare class PluginLifecycleManager {
297
+ declare function resolvePluginHook(plugin: BoltdocsPlugin, hookName: keyof PluginLifecycleHooks | string): Function | undefined;
298
+ declare class PluginLifecycleManager implements IPluginLifecycleManager {
112
299
  private plugins;
113
300
  private config;
114
301
  private store;
@@ -116,7 +303,10 @@ declare class PluginLifecycleManager {
116
303
  private rootDir;
117
304
  private routes;
118
305
  private outDir;
119
- constructor(plugins: SecureBoltdocsPlugin[], config: BoltdocsConfig, docsDir?: string, rootDir?: string, routes?: RouteMeta[], outDir?: string);
306
+ private runtime;
307
+ private routeCacheContext;
308
+ private routeCacheVariant;
309
+ constructor(plugins: BoltdocsPlugin[], config: BoltdocsConfig, docsDir?: string, rootDir?: string, routes?: RouteMeta[], outDir?: string, runtime?: PluginRuntimeState, routeCacheContext?: RouteCacheContext, routeCacheVariant?: RouteCacheVariant);
120
310
  runHook(hookName: keyof PluginLifecycleHooks, ...args: unknown[]): Promise<void>;
121
311
  runChain<TParams extends Record<string, unknown>>(hookName: keyof PluginLifecycleHooks, initialParams: TParams): Promise<TParams>;
122
312
  /**
@@ -125,6 +315,7 @@ declare class PluginLifecycleManager {
125
315
  * hooks or declared statically via `BoltdocsPlugin.middleware` are all
126
316
  * collected. Execution respects `__signal: 'skip'` and `__signal: 'break'`.
127
317
  */
318
+ hasHook(hookName: keyof PluginLifecycleHooks | 'transformSource' | 'transformMdx' | 'transformHtml'): boolean;
128
319
  runMiddlewareChain<TParams extends Record<string, unknown>>(hookName: 'transformSource' | 'transformMdx' | 'transformHtml', initialParams: TParams): Promise<TParams>;
129
320
  private getSortedPlugins;
130
321
  private createStep;
@@ -133,8 +324,33 @@ declare class PluginLifecycleManager {
133
324
  private createLogger;
134
325
  }
135
326
  //#endregion
136
- //#region src/node/plugins/index.d.ts
137
- declare function createPlugin(plugin: SecureBoltdocsPlugin): SecureBoltdocsPlugin;
327
+ //#region src/node/plugins/define-plugin.d.ts
328
+ type PluginFactory<TOptions = Record<string, unknown>> = (options?: TOptions) => BoltdocsPlugin;
329
+ /**
330
+ * Creates and defines a Boltdocs plugin with strong TypeScript inference.
331
+ * Supports both a static plugin object or an options-factory function.
332
+ *
333
+ * @example
334
+ * ```ts
335
+ * export default definePlugin<MyOptions>((options) => ({
336
+ * name: 'my-plugin',
337
+ * version: '1.0.0',
338
+ * client: {
339
+ * slots: { 'header:right': './components/HeaderActions.tsx' },
340
+ * },
341
+ * hooks: {
342
+ * 'frontmatter:transform'(ctx, { frontmatter }) {
343
+ * return { ...frontmatter, readingTime: 5 }
344
+ * },
345
+ * },
346
+ * }))
347
+ * ```
348
+ */
349
+ declare function definePlugin<TOptions = Record<string, unknown>>(pluginOrFactory: BoltdocsPlugin | PluginFactory<TOptions>): PluginFactory<TOptions> & ((options?: TOptions) => BoltdocsPlugin);
350
+ /**
351
+ * Alias for `definePlugin` for backwards compatibility.
352
+ */
353
+ declare function createPlugin<TOptions = Record<string, unknown>>(pluginOrFactory: BoltdocsPlugin | PluginFactory<TOptions>): BoltdocsPlugin | (PluginFactory<TOptions> & ((options?: TOptions) => BoltdocsPlugin));
138
354
  //#endregion
139
355
  //#region src/node/feedback/handler.d.ts
140
356
  interface FeedbackHandlerOptions {
@@ -168,13 +384,25 @@ declare function normalizePath(p: string): string;
168
384
  */
169
385
  declare function sanitizeFilename(name: string): string;
170
386
  declare namespace index_d_exports {
171
- export { BoltdocsConfig, BoltdocsPlugin, BoltdocsPluginOptions, BoltdocsPluginStore, BoltdocsThemeConfig, PluginCompatibilityError, PluginContext, PluginError, PluginHookError, PluginLifecycleHooks, PluginLifecycleManager, PluginLogger, PluginMeta, PluginStore, PluginValidationError, RouteMeta, SecureBoltdocsPlugin, createPlugin, createViteConfig, boltdocs as default, defineConfig, flushCache, generateEntryCode, generateRoutes, handleAwsFeedback, handleFeedback, handleNetlifyFeedback, handleVercelFeedback, handleWebFeedback, invalidateRouteCache, normalizePath, resolveConfig, sanitizeFilename, validatePlugins };
387
+ export { ArticleStructuredDataOptions, BoltdocsConfig, BoltdocsExperimentalConfig, BoltdocsPlugin, BoltdocsPluginOptions, BoltdocsPluginStore, BoltdocsThemeConfig, BoltdocsViewTransitionsConfig, BreadcrumbStructuredDataItem, CreateViteConfigOptions, ExternalFileRoute, IPluginLifecycleManager, JsonLdObject, JsonLdValue, PluginCompatibilityError, PluginContext, PluginCssConfig, PluginError, PluginFactory, PluginHookError, PluginLifecycleHooks, PluginLifecycleManager, PluginLogger, PluginMeta, PluginStore, PluginValidationError, RouteMeta, StructuredData, StructuredDataFactoryOptions, WebSiteStructuredDataOptions, createArticleStructuredData, createBreadcrumbStructuredData, createPlugin, createStructuredData, createViteConfig, createWebSiteStructuredData, boltdocs as default, defineConfig, definePlugin, defineStructuredData, flushCache, generateEntryCode, generateRoutes, handleAwsFeedback, handleFeedback, handleNetlifyFeedback, handleVercelFeedback, handleWebFeedback, invalidateRouteCache, normalizePath, resolveConfig, resolvePluginHook, sanitizeFilename, validatePlugins };
388
+ }
389
+ interface CreateViteConfigOptions {
390
+ /** Pre-computed routes. When provided, route generation is skipped. */
391
+ routes?: RouteMeta[];
392
+ /** Skip generating project types (they were already generated elsewhere). */
393
+ skipTypes?: boolean;
394
+ /** Skip writing the link tree (it was already written elsewhere). */
395
+ skipLinkTree?: boolean;
396
+ /** Skip route generation entirely. Routes will be generated lazily by virtual modules. */
397
+ skipRoutes?: boolean;
398
+ /** Static asset directory relative to the project root (default: docs/public). */
399
+ publicDir?: string | false;
172
400
  }
173
401
  declare function boltdocs(options?: BoltdocsPluginOptions): Promise<Plugin[]>;
174
402
  /**
175
403
  * Generates the complete Vite configuration for a Boltdocs project.
176
404
  * This is used by the Boltdocs CLI to run Vite without a user-defined vite.config.ts.
177
405
  */
178
- declare function createViteConfig(root: string, mode?: 'development' | 'production', preResolvedConfig?: BoltdocsConfig, turbo?: boolean): Promise<InlineConfig>;
406
+ declare function createViteConfig(root: string, mode?: 'development' | 'production', preResolvedConfig?: BoltdocsConfig, options?: CreateViteConfigOptions): Promise<InlineConfig>;
179
407
  //#endregion
180
- export { type BoltdocsConfig, type BoltdocsPlugin, type BoltdocsPluginOptions, BoltdocsPluginStore, type BoltdocsThemeConfig, PluginCompatibilityError, type PluginContext, PluginError, PluginHookError, type PluginLifecycleHooks, PluginLifecycleManager, type PluginLogger, type PluginMeta, type PluginStore, PluginValidationError, type RouteMeta, SecureBoltdocsPlugin, createPlugin, createViteConfig, boltdocs as default, defineConfig, flushCache, generateEntryCode, generateRoutes, handleAwsFeedback, handleFeedback, handleNetlifyFeedback, handleVercelFeedback, handleWebFeedback, invalidateRouteCache, normalizePath, resolveConfig, sanitizeFilename, validatePlugins };
408
+ export { type ArticleStructuredDataOptions, type BoltdocsConfig, type BoltdocsExperimentalConfig, BoltdocsPlugin, type BoltdocsPluginOptions, BoltdocsPluginStore, type BoltdocsThemeConfig, type BoltdocsViewTransitionsConfig, type BreadcrumbStructuredDataItem, CreateViteConfigOptions, type ExternalFileRoute, type IPluginLifecycleManager, type JsonLdObject, type JsonLdValue, PluginCompatibilityError, type PluginContext, PluginCssConfig, PluginError, PluginFactory, PluginHookError, type PluginLifecycleHooks, PluginLifecycleManager, type PluginLogger, type PluginMeta, type PluginStore, PluginValidationError, type RouteMeta, type StructuredData, type StructuredDataFactoryOptions, type WebSiteStructuredDataOptions, createArticleStructuredData, createBreadcrumbStructuredData, createPlugin, createStructuredData, createViteConfig, createWebSiteStructuredData, boltdocs as default, defineConfig, definePlugin, defineStructuredData, flushCache, generateEntryCode, generateRoutes, handleAwsFeedback, handleFeedback, handleNetlifyFeedback, handleVercelFeedback, handleWebFeedback, invalidateRouteCache, normalizePath, resolveConfig, resolvePluginHook, sanitizeFilename, validatePlugins };