boltdocs 3.2.1 → 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.
- package/bin/boltdocs.js +20 -1
- package/bin/preloader.mjs +28 -0
- package/dist/{adapters-ByYY44Zy.mjs → adapters-BmB4TKCc.mjs} +1 -1
- package/dist/{adapters-DvmtpdSF.cjs → adapters-Cp1Maurn.cjs} +1 -1
- package/dist/audit-CLXjMzwQ.mjs +11 -0
- package/dist/audit-COgjnQ5n.cjs +11 -0
- package/dist/build-BS2hefiL.cjs +6 -0
- package/dist/build-C5mNh9D-.mjs +6 -0
- package/dist/cache-CJE9nWLE.cjs +6 -0
- package/dist/cache-OY4HzIXl.mjs +6 -0
- package/dist/callout-oI_LCbxS.d.ts +71 -0
- package/dist/callout-plqx9Dw-.d.cts +71 -0
- package/dist/client/index.cjs +1265 -569
- package/dist/client/index.d.cts +3 -542
- package/dist/client/index.d.ts +3 -542
- package/dist/client/index.js +1167 -521
- package/dist/client/mdx.cjs +1 -1
- package/dist/client/mdx.d.cts +24 -2
- package/dist/client/mdx.d.ts +24 -2
- package/dist/client/mdx.js +1 -1
- package/dist/client/primitives.cjs +14 -4
- package/dist/client/primitives.d.cts +281 -38
- package/dist/client/primitives.d.ts +281 -38
- package/dist/client/primitives.js +5 -5
- package/dist/client/router.cjs +49 -0
- package/dist/client/router.d.cts +3 -0
- package/dist/client/router.d.ts +3 -0
- package/dist/client/router.js +8 -0
- package/dist/client/theme/reset.css +40 -4
- package/dist/{config-BpzaPsJj.d.cts → config-BoRlz0Ca.d.mts} +157 -14
- package/dist/{config-xtS0ZkMm.d.mts → config-CTsX_tGM.d.cts} +157 -14
- package/dist/config-Ceib-AOH.cjs +7 -0
- package/dist/config-DGLQsy7y.mjs +7 -0
- package/dist/{package-BcISI5-P.cjs → config-files-BYHDOrKn.mjs} +1 -1
- package/dist/config-files-D9cdBMl2.cjs +6 -0
- package/dist/config-jJh8WYJI.cjs +6 -0
- package/dist/csp-C4LmN1ko.cjs +6 -0
- package/dist/csp-D6JEOqKh.mjs +6 -0
- package/dist/dev-Ch3hEe5Y.cjs +6 -0
- package/dist/dev-QPNxysrd.mjs +6 -0
- package/dist/{docs-layout-BdtZ9z6s.js → docs-layout-CbZ7LDRe.js} +504 -249
- package/dist/{docs-layout-CFWI15Id.cjs → docs-layout-vzfXed1Q.cjs} +516 -254
- package/dist/{doctor-BBtmNJE0.cjs → doctor-B1_YL0Wt.cjs} +1 -1
- package/dist/doctor-C7whl4ED.cjs +6 -0
- package/dist/doctor-DmQnml2k.mjs +6 -0
- package/dist/{generator-COepVWGi.cjs → generator-BlW45ST7.cjs} +5 -3
- package/dist/{generator-CcOBN5vI.mjs → generator-BwknNejd.mjs} +5 -3
- package/dist/{handler-XX7cLTqe.cjs → handler-CDEoKARD.cjs} +2 -2
- package/dist/{handler-DzQae4eA.mjs → handler-D7UyZlPm.mjs} +2 -2
- package/dist/{image-Bz87fCla.js → image-B-NDSDuY.js} +129 -11
- package/dist/{image-C4TlpMHn.cjs → image-Hnaa2bJd.cjs} +175 -9
- package/dist/index-C56bL-A-.d.cts +1344 -0
- package/dist/{sidebar-COTaMHR-.d.ts → index-CPUUKzxD.d.cts} +344 -327
- package/dist/{sidebar-CrEdJuHX.d.cts → index-Ci4kfOHF.d.ts} +344 -327
- package/dist/index-Cu9H6CRa.d.ts +1344 -0
- package/dist/link-CgdI6O2o.js +872 -0
- package/dist/{link-D1Gjkb-2.cjs → link-vZjmD-es.cjs} +406 -223
- package/dist/{mdx-BuO6a1f7.js → mdx-BRT71V5Q.js} +211 -168
- package/dist/{mdx-CD-tSjRG.cjs → mdx-D0Absdq5.cjs} +225 -169
- package/dist/native-BNCY7PRF.cjs +6 -0
- package/dist/native-Di9Fnfrv.mjs +6 -0
- package/dist/native-Kre2T5eS.cjs +6 -0
- package/dist/node/cache.cjs +1 -1
- package/dist/node/cache.d.cts +19 -3
- package/dist/node/cache.d.mts +19 -3
- package/dist/node/cache.mjs +1 -1
- package/dist/node/cli-entry.cjs +1 -9
- package/dist/node/cli-entry.mjs +1 -9
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.d.cts +245 -17
- package/dist/node/index.d.mts +246 -18
- package/dist/node/index.mjs +1 -1
- package/dist/node/mdx/shiki-adapter.cjs +1 -1
- package/dist/node/mdx/shiki-adapter.d.cts +24 -3
- package/dist/node/mdx/shiki-adapter.d.mts +24 -2
- package/dist/node/mdx/shiki-adapter.mjs +1 -1
- package/dist/node-Du5UL5wo.mjs +23 -0
- package/dist/node-DunuGqyp.cjs +23 -0
- package/dist/{package-CCYEAYeA.mjs → package-DA848keM.mjs} +1 -1
- package/dist/package-wplzySjz.cjs +6 -0
- package/dist/pages-external-BBw8ObVK.mjs +6 -0
- package/dist/pages-external-DPiPFxxP.cjs +6 -0
- package/dist/parser-BqTOsEUa.cjs +6 -0
- package/dist/parser-CGMY2lJ7.mjs +6 -0
- package/dist/plugin-BcTzvHAJ.mjs +69 -0
- package/dist/plugin-TulVMt1z.cjs +69 -0
- package/dist/plugin-context-C-l90hFt.cjs +15 -0
- package/dist/plugin-context-wqHNSZum.mjs +15 -0
- package/dist/plugin-lifecycle-B1BzSHdn.cjs +6 -0
- package/dist/resolve-B7vWOd8R.cjs +6 -0
- package/dist/resolve-C2kKnk_5.mjs +6 -0
- package/dist/resolve-It1Iug83.cjs +6 -0
- package/dist/resolve-YdTrt_FG.mjs +6 -0
- package/dist/router-C3kygdRK.cjs +1285 -0
- package/dist/router-CZBxMRAH.js +987 -0
- package/dist/routes-BL4y79tb.mjs +6 -0
- package/dist/routes-C2nPecwu.cjs +6 -0
- package/dist/routes-U9L8psZ9.cjs +6 -0
- package/dist/{search-dialog-DHqwjJuG.cjs → search-dialog-BCOHQGSt.cjs} +1 -1
- package/dist/search-dialog-Bp_P1MPP.js +481 -0
- package/dist/{search-dialog-DFnlx8LO.js → search-dialog-BqkzDTq2.js} +107 -57
- package/dist/{search-dialog-BRFno7HD.cjs → search-dialog-CIeIUhAn.cjs} +218 -43
- package/dist/{search-dialog-D6TvjcuV.js → search-dialog-DtmxmfEu.js} +1 -1
- package/dist/{search-dialog-B1NERUNx.cjs → search-dialog-x_qHU8ty.cjs} +107 -58
- package/dist/server/index.cjs +1 -1
- package/dist/server/index.d.mts +1 -1
- package/dist/server/index.mjs +1 -1
- package/dist/update-check-BKqmYfwT.cjs +11 -0
- package/dist/update-check-QnrVR3q1.mjs +11 -0
- package/dist/utils-8lzafE49.mjs +7 -0
- package/dist/utils-ej6_SjIZ.cjs +7 -0
- package/dist/virtual-modules-Ca5tHk1X.cjs +30 -0
- package/dist/virtual-modules-Dlgt1fP0.mjs +30 -0
- package/package.json +18 -16
- package/src/shared/mdx-path.ts +12 -0
- package/src/shared/structured-data.ts +145 -0
- package/src/shared/types.ts +220 -16
- package/dist/banner-BMop1KLF.d.ts +0 -100
- package/dist/banner-CVD0GugR.d.cts +0 -100
- package/dist/cache-CO4Dy2uQ.cjs +0 -6
- package/dist/cache-Dk53iOo6.mjs +0 -6
- package/dist/config-CCXp3aXO.mjs +0 -7
- package/dist/config-CMd4XoFq.cjs +0 -6
- package/dist/config-DlGoEM9D.cjs +0 -7
- package/dist/csp-CRp_3U7a.cjs +0 -6
- package/dist/csp-oTC2ygvF.mjs +0 -6
- package/dist/doctor-Bv16QSrI.cjs +0 -7
- package/dist/doctor-DOAbSaiL.mjs +0 -7
- package/dist/headers-Ddwek8K7.mjs +0 -6
- package/dist/headers-dg4SDrjY.cjs +0 -6
- package/dist/link-2PzgTnaP.js +0 -673
- package/dist/meta-loader-C4Hu9RN9.mjs +0 -6
- package/dist/meta-loader-Dq1zcFnh.cjs +0 -6
- package/dist/node-BXtqM1uH.mjs +0 -6
- package/dist/node-BlVk4EVg.cjs +0 -104
- package/dist/node-DOf4zhWc.mjs +0 -104
- package/dist/node-aD1eisrR.cjs +0 -6
- package/dist/pages-external-BYa4JSda.mjs +0 -6
- package/dist/pages-external-XkYIs-d5.cjs +0 -6
- package/dist/parser-DCiEWkSk.cjs +0 -8
- package/dist/parser-qk9FIHJ7.mjs +0 -8
- package/dist/plugin-C95kvu6h.mjs +0 -73
- package/dist/plugin-DM3u2bVj.cjs +0 -73
- package/dist/routes-BW6zsk7Z.mjs +0 -6
- package/dist/routes-BgoIB5wb.cjs +0 -6
- package/dist/routes-CORVxc02.cjs +0 -6
- package/dist/search-dialog-BmxHiKwt.js +0 -312
- package/dist/shiki-adapter-CoQ6jyJ4.cjs +0 -6
- package/dist/shiki-adapter-D-aKw7PP.mjs +0 -6
- package/dist/utils-Crm9oPcV.mjs +0 -7
- package/dist/utils-D6Xtj0FZ.cjs +0 -7
- /package/dist/{errors-0zGHRLue.mjs → errors-N-b6Sn2G.mjs} +0 -0
- /package/dist/{index-1KsTDq4o.d.mts → index-lFoyzCXy.d.mts} +0 -0
- /package/dist/{types-generator-BXhv7Ill.cjs → types-generator-DDSA93P3.cjs} +0 -0
- /package/dist/{types-generator-bDPvUztF.mjs → types-generator-DG1GX1EZ.mjs} +0 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
|
|
2
|
+
import { $ as LazyRouteResult, A as matchRouteBranch, B as useRouteData, C as stripSiteProtocol, D as normalizeBasename, E as hasBasename, F as useLoaderData, G as MatchesContext, H as LocationProvider, I as useLocation, J as PrefetchContext, K as NavigateContext, L as useMatches, M as resolveRouteBranch, N as Outlet, O as stripBasename, P as OutletContext, Q as CreateRoutesResult, R as useNavigate, S as splitUrlReference, T as addBasename, U as LocationProviderProps, V as LocationContext, W as LocationState, X as RouteDataContext, Y as PrefetchFunction, Z as defaultNavigate, _ as isConfiguredVersion, a as UrlRouteHint, at as RouterOptions, b as parseUrlReference, c as buildUrl, d as getConfiguredVersions, et as LoaderFunction, f as getVersionPrefixSegments, g as isConfiguredLocale, h as hasUrlBase, i as UrlContractConfig, it as RouteRendererProps, j as matchRouteBranchWithParams, k as RouteRenderer, l as classifyUrlPath, m as hasUriScheme, n as ParsedUrl, nt as RouteMatch, o as UrlRouteKind, p as getVersionSegments, q as NavigateFunction, r as ResolveUrlOptions, rt as RouteRecord, s as addUrlBase, t as BuildUrlOptions, tt as LoaderFunctionArgs, u as getConfiguredLocales, v as normalizeUrlBase, w as stripUrlBase, x as resolveUrlReference, y as normalizeUrlPath, z as usePrefetch } from "../index-CPUUKzxD.cjs";
|
|
3
|
+
export { BuildUrlOptions, CreateRoutesResult, LazyRouteResult, LoaderFunction, LoaderFunctionArgs, LocationContext, LocationProvider, LocationProviderProps, LocationState, MatchesContext, NavigateContext, NavigateFunction, Outlet, OutletContext, ParsedUrl, PrefetchContext, PrefetchFunction, ResolveUrlOptions, RouteDataContext, RouteMatch, RouteRecord, RouteRenderer, RouteRendererProps, RouterOptions, UrlContractConfig, UrlRouteHint, UrlRouteKind, addBasename, addUrlBase, buildUrl, classifyUrlPath, defaultNavigate, getConfiguredLocales, getConfiguredVersions, getVersionPrefixSegments, getVersionSegments, hasBasename, hasUriScheme, hasUrlBase, isConfiguredLocale, isConfiguredVersion, matchRouteBranch, matchRouteBranchWithParams, normalizeBasename, normalizeUrlBase, normalizeUrlPath, parseUrlReference, resolveRouteBranch, resolveUrlReference, splitUrlReference, stripBasename, stripSiteProtocol, stripUrlBase, useLoaderData, useLocation, useMatches, useNavigate, usePrefetch, useRouteData };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
|
|
2
|
+
import { $ as LazyRouteResult, A as matchRouteBranch, B as useRouteData, C as stripSiteProtocol, D as normalizeBasename, E as hasBasename, F as useLoaderData, G as MatchesContext, H as LocationProvider, I as useLocation, J as PrefetchContext, K as NavigateContext, L as useMatches, M as resolveRouteBranch, N as Outlet, O as stripBasename, P as OutletContext, Q as CreateRoutesResult, R as useNavigate, S as splitUrlReference, T as addBasename, U as LocationProviderProps, V as LocationContext, W as LocationState, X as RouteDataContext, Y as PrefetchFunction, Z as defaultNavigate, _ as isConfiguredVersion, a as UrlRouteHint, at as RouterOptions, b as parseUrlReference, c as buildUrl, d as getConfiguredVersions, et as LoaderFunction, f as getVersionPrefixSegments, g as isConfiguredLocale, h as hasUrlBase, i as UrlContractConfig, it as RouteRendererProps, j as matchRouteBranchWithParams, k as RouteRenderer, l as classifyUrlPath, m as hasUriScheme, n as ParsedUrl, nt as RouteMatch, o as UrlRouteKind, p as getVersionSegments, q as NavigateFunction, r as ResolveUrlOptions, rt as RouteRecord, s as addUrlBase, t as BuildUrlOptions, tt as LoaderFunctionArgs, u as getConfiguredLocales, v as normalizeUrlBase, w as stripUrlBase, x as resolveUrlReference, y as normalizeUrlPath, z as usePrefetch } from "../index-Ci4kfOHF.js";
|
|
3
|
+
export { BuildUrlOptions, CreateRoutesResult, LazyRouteResult, LoaderFunction, LoaderFunctionArgs, LocationContext, LocationProvider, LocationProviderProps, LocationState, MatchesContext, NavigateContext, NavigateFunction, Outlet, OutletContext, ParsedUrl, PrefetchContext, PrefetchFunction, ResolveUrlOptions, RouteDataContext, RouteMatch, RouteRecord, RouteRenderer, RouteRendererProps, RouterOptions, UrlContractConfig, UrlRouteHint, UrlRouteKind, addBasename, addUrlBase, buildUrl, classifyUrlPath, defaultNavigate, getConfiguredLocales, getConfiguredVersions, getVersionPrefixSegments, getVersionSegments, hasBasename, hasUriScheme, hasUrlBase, isConfiguredLocale, isConfiguredVersion, matchRouteBranch, matchRouteBranchWithParams, normalizeBasename, normalizeUrlBase, normalizeUrlPath, parseUrlReference, resolveRouteBranch, resolveUrlReference, splitUrlReference, stripBasename, stripSiteProtocol, stripUrlBase, useLoaderData, useLocation, useMatches, useNavigate, usePrefetch, useRouteData };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boltdocs - https://boltdocs.vercel.app
|
|
3
|
+
* Copyright (c) 2026 Jesus Alcala
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import { A as useRouteData, B as normalizeBasename, C as Outlet, D as useMatches, E as useLocation, F as PrefetchContext, I as RouteDataContext, L as defaultNavigate, M as LocationProvider, N as MatchesContext, O as useNavigate, P as NavigateContext, R as addBasename, S as resolveRouteBranch, T as useLoaderData, V as stripBasename, _ as stripSiteProtocol, a as getConfiguredVersions, b as matchRouteBranch, c as hasUriScheme, d as isConfiguredVersion, f as normalizeUrlBase, g as splitUrlReference, h as resolveUrlReference, i as getConfiguredLocales, j as LocationContext, k as usePrefetch, l as hasUrlBase, m as parseUrlReference, n as buildUrl, o as getVersionPrefixSegments, p as normalizeUrlPath, r as classifyUrlPath, s as getVersionSegments, t as addUrlBase, u as isConfiguredLocale, v as stripUrlBase, w as OutletContext, x as matchRouteBranchWithParams, y as RouteRenderer, z as hasBasename } from "../router-CZBxMRAH.js";
|
|
7
|
+
|
|
8
|
+
export { LocationContext, LocationProvider, MatchesContext, NavigateContext, Outlet, OutletContext, PrefetchContext, RouteDataContext, RouteRenderer, addBasename, addUrlBase, buildUrl, classifyUrlPath, defaultNavigate, getConfiguredLocales, getConfiguredVersions, getVersionPrefixSegments, getVersionSegments, hasBasename, hasUriScheme, hasUrlBase, isConfiguredLocale, isConfiguredVersion, matchRouteBranch, matchRouteBranchWithParams, normalizeBasename, normalizeUrlBase, normalizeUrlPath, parseUrlReference, resolveRouteBranch, resolveUrlReference, splitUrlReference, stripBasename, stripSiteProtocol, stripUrlBase, useLoaderData, useLocation, useMatches, useNavigate, usePrefetch, useRouteData };
|
|
@@ -139,7 +139,32 @@
|
|
|
139
139
|
|
|
140
140
|
/* ═══ Shiki Styles ═══ */
|
|
141
141
|
|
|
142
|
-
/* Shiki
|
|
142
|
+
/* Boltdocs Code Block — Shiki/plain pre normalization.
|
|
143
|
+
Previously `!important` utilities baked into the code-block primitive;
|
|
144
|
+
kept here so the primitive stays style-neutral and themes can override
|
|
145
|
+
via `--code-pad` or stronger selectors. */
|
|
146
|
+
.boltdocs-code-block .shiki-wrapper > pre {
|
|
147
|
+
margin: 0 !important;
|
|
148
|
+
border-radius: 0 !important;
|
|
149
|
+
border: none !important;
|
|
150
|
+
background: inherit !important;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.boltdocs-code-block .shiki-wrapper > pre > code {
|
|
154
|
+
display: grid !important;
|
|
155
|
+
padding: var(--code-pad, 1.25rem) !important;
|
|
156
|
+
font-size: 0.875rem !important;
|
|
157
|
+
line-height: 1.6 !important;
|
|
158
|
+
white-space: pre !important;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.boltdocs-code-block .shiki-wrapper > .shiki.shiki-themes {
|
|
162
|
+
background-color: transparent !important;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/* Shiki base: font + transparent token backgrounds. Deliberately does NOT
|
|
166
|
+
override `color`, so single-theme output (inline token colors, e.g.
|
|
167
|
+
`codeTheme: 'github-dark'`) keeps its highlighting in every mode. */
|
|
143
168
|
:root .shiki,
|
|
144
169
|
:root .shiki span {
|
|
145
170
|
font-family: var(--font-mono);
|
|
@@ -147,9 +172,19 @@
|
|
|
147
172
|
background-color: transparent !important;
|
|
148
173
|
}
|
|
149
174
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
175
|
+
/* Shiki dual-theme (light/dark pair) output carries `shiki-themes` plus
|
|
176
|
+
inline `--shiki-light`/`--shiki-dark` variables. Only those blocks are
|
|
177
|
+
color-driven by this rule — single-theme output is left untouched. */
|
|
178
|
+
:root .shiki.shiki-themes,
|
|
179
|
+
:root .shiki.shiki-themes span {
|
|
180
|
+
color: var(--shiki-light, inherit);
|
|
181
|
+
background-color: var(--shiki-light, transparent);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
:root.dark .shiki.shiki-themes,
|
|
185
|
+
:root.dark .shiki.shiki-themes span {
|
|
186
|
+
color: var(--shiki-dark, inherit);
|
|
187
|
+
background-color: var(--shiki-dark, transparent);
|
|
153
188
|
}
|
|
154
189
|
|
|
155
190
|
/* Base Shiki Pre & Span Styles */
|
|
@@ -161,6 +196,7 @@
|
|
|
161
196
|
|
|
162
197
|
pre.shiki span.line {
|
|
163
198
|
@apply relative block px-4 py-0;
|
|
199
|
+
white-space: pre;
|
|
164
200
|
min-height: 1.6em;
|
|
165
201
|
}
|
|
166
202
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { Plugin } from "vite";
|
|
2
|
+
import { AliasOptions, Plugin, UserConfig } from "vite";
|
|
3
3
|
import * as _$http from "http";
|
|
4
4
|
//#region src/shared/types.d.ts
|
|
5
5
|
/**
|
|
@@ -64,7 +64,7 @@ interface RouteMeta {
|
|
|
64
64
|
/** The raw markdown content of the page */
|
|
65
65
|
_rawContent?: string;
|
|
66
66
|
/** Extracted SEO and Open Graph metadata from frontmatter */
|
|
67
|
-
seo?: Record<string,
|
|
67
|
+
seo?: Record<string, unknown>;
|
|
68
68
|
/** The publication date */
|
|
69
69
|
date?: string | Date;
|
|
70
70
|
/** The last updated timestamp or date */
|
|
@@ -78,7 +78,7 @@ interface RouteMeta {
|
|
|
78
78
|
/** Whether the page is hidden from the sidebar */
|
|
79
79
|
sidebarHidden?: boolean;
|
|
80
80
|
/** Raw extensible frontmatter data for custom components and formatters */
|
|
81
|
-
frontmatter?: Record<string,
|
|
81
|
+
frontmatter?: Record<string, unknown>;
|
|
82
82
|
/** Optional recursive child routes for deep sidebar hierarchies */
|
|
83
83
|
subRoutes?: RouteMeta[];
|
|
84
84
|
/** Clean URL segments stripped of locale/version prefixes */
|
|
@@ -534,15 +534,112 @@ interface PluginServerAPI {
|
|
|
534
534
|
* Connect-style middleware signature.
|
|
535
535
|
*/
|
|
536
536
|
type PluginServerMiddleware = (req: _$http.IncomingMessage, res: _$http.ServerResponse, next: (err?: unknown) => void) => void | Promise<void>;
|
|
537
|
+
/**
|
|
538
|
+
* Public API surface of the core plugin lifecycle manager.
|
|
539
|
+
*
|
|
540
|
+
* This is exposed as an interface so that plugin authors and internal
|
|
541
|
+
* subsystems can receive a reference to the lifecycle manager without
|
|
542
|
+
* pulling in the concrete class (which has private members and is not
|
|
543
|
+
* stable across source/dist boundaries during development).
|
|
544
|
+
*/
|
|
545
|
+
interface IPluginLifecycleManager {
|
|
546
|
+
runHook(hookName: keyof PluginLifecycleHooks, ...args: unknown[]): Promise<void>;
|
|
547
|
+
runChain<TParams extends Record<string, unknown>>(hookName: keyof PluginLifecycleHooks, initialParams: TParams): Promise<TParams>;
|
|
548
|
+
runMiddlewareChain<TParams extends Record<string, unknown>>(hookName: 'transformSource' | 'transformMdx' | 'transformHtml', initialParams: TParams): Promise<TParams>;
|
|
549
|
+
hasHook(hookName: keyof PluginLifecycleHooks | 'transformSource' | 'transformMdx' | 'transformHtml'): boolean;
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* Standardized Search Document contract passed to search plugins.
|
|
553
|
+
*/
|
|
554
|
+
interface SearchDocument {
|
|
555
|
+
id: string;
|
|
556
|
+
path: string;
|
|
557
|
+
title: string;
|
|
558
|
+
content: string;
|
|
559
|
+
headings: Array<{
|
|
560
|
+
level: number;
|
|
561
|
+
text: string;
|
|
562
|
+
id: string;
|
|
563
|
+
}>;
|
|
564
|
+
frontmatter: Record<string, unknown>;
|
|
565
|
+
locale?: string;
|
|
566
|
+
version?: string;
|
|
567
|
+
}
|
|
568
|
+
interface PluginHeadEntry {
|
|
569
|
+
tag: 'script' | 'link' | 'meta' | 'style';
|
|
570
|
+
attrs?: Record<string, string | boolean>;
|
|
571
|
+
content?: string;
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Client-side configuration and UI slot injections for plugins.
|
|
575
|
+
*/
|
|
576
|
+
interface PluginClientConfig {
|
|
577
|
+
/** Dynamic UI slot registrations (mapped to component file paths) */
|
|
578
|
+
slots?: Record<string, string>;
|
|
579
|
+
/** Top-level React provider component file paths */
|
|
580
|
+
providers?: string[];
|
|
581
|
+
/** MDX component overrides & additions */
|
|
582
|
+
mdxComponents?: Record<string, string>;
|
|
583
|
+
/** Head elements to inject into rendered HTML */
|
|
584
|
+
head?: PluginHeadEntry[];
|
|
585
|
+
}
|
|
537
586
|
/**
|
|
538
587
|
* Plugin lifecycle hooks with full type safety.
|
|
539
588
|
*/
|
|
540
589
|
interface PluginLifecycleHooks {
|
|
590
|
+
/** Build hooks (Astro-style) */
|
|
591
|
+
'build:before'?: (ctx: PluginContext) => Promise<void> | void;
|
|
592
|
+
'build:after'?: (ctx: PluginContext) => Promise<void> | void;
|
|
593
|
+
'build:end'?: (ctx: PluginContext) => Promise<void> | void;
|
|
594
|
+
'build:generate'?: (ctx: PluginContext, params: {
|
|
595
|
+
routes: RouteMeta[];
|
|
596
|
+
outDir: string;
|
|
597
|
+
siteUrl?: string;
|
|
598
|
+
}) => void | Promise<void>;
|
|
599
|
+
/** Dev hooks (Astro-style) */
|
|
600
|
+
'dev:before'?: (ctx: PluginContext) => Promise<void> | void;
|
|
601
|
+
'dev:after'?: (ctx: PluginContext) => Promise<void> | void;
|
|
602
|
+
/** Transform hooks (Astro-style) */
|
|
603
|
+
'transform:source'?: (ctx: PluginContext, params: TransformSourceParams) => TransformResult<{
|
|
604
|
+
code: string;
|
|
605
|
+
}> | Promise<TransformResult<{
|
|
606
|
+
code: string;
|
|
607
|
+
}>>;
|
|
608
|
+
'transform:mdx'?: (ctx: PluginContext, params: TransformSourceParams) => TransformResult<{
|
|
609
|
+
code: string;
|
|
610
|
+
}> | Promise<TransformResult<{
|
|
611
|
+
code: string;
|
|
612
|
+
}>>;
|
|
613
|
+
'transform:html'?: (ctx: PluginContext, params: TransformHtmlParams) => TransformResult<{
|
|
614
|
+
html: string;
|
|
615
|
+
}> | Promise<TransformResult<{
|
|
616
|
+
html: string;
|
|
617
|
+
}>>;
|
|
618
|
+
/** Dynamic frontmatter transformation hook */
|
|
619
|
+
'frontmatter:transform'?: (ctx: PluginContext, params: {
|
|
620
|
+
frontmatter: Record<string, unknown>;
|
|
621
|
+
filePath: string;
|
|
622
|
+
rawContent: string;
|
|
623
|
+
}) => Record<string, unknown> | Promise<Record<string, unknown>> | undefined;
|
|
624
|
+
/** Fired after routes are crawled, normalized, and resolved */
|
|
625
|
+
'routes:resolved'?: (ctx: PluginContext, params: {
|
|
626
|
+
routes: RouteMeta[];
|
|
627
|
+
}) => RouteMeta[] | Promise<RouteMeta[]> | undefined;
|
|
628
|
+
/** Agnostic search index hook: core passes SearchDocument[], plugin returns index payload */
|
|
629
|
+
'search:index'?: (ctx: PluginContext, params: {
|
|
630
|
+
documents: SearchDocument[];
|
|
631
|
+
routes: RouteMeta[];
|
|
632
|
+
}) => unknown | Promise<unknown>;
|
|
633
|
+
'server:configure'?: (ctx: PluginContext, params: {
|
|
634
|
+
server: unknown;
|
|
635
|
+
middleware: PluginServerAPI;
|
|
636
|
+
}) => void | Promise<void>;
|
|
637
|
+
/** Legacy alias hooks for backwards compatibility */
|
|
541
638
|
beforeBuild?: (ctx: PluginContext) => Promise<void> | void;
|
|
542
639
|
afterBuild?: (ctx: PluginContext) => Promise<void> | void;
|
|
640
|
+
buildEnd?: (ctx: PluginContext) => Promise<void> | void;
|
|
543
641
|
beforeDev?: (ctx: PluginContext) => Promise<void> | void;
|
|
544
642
|
afterDev?: (ctx: PluginContext) => Promise<void> | void;
|
|
545
|
-
buildEnd?: (ctx: PluginContext) => Promise<void> | void;
|
|
546
643
|
transformSource?: (ctx: PluginContext, params: TransformSourceParams) => TransformResult<{
|
|
547
644
|
code: string;
|
|
548
645
|
}> | Promise<TransformResult<{
|
|
@@ -564,14 +661,20 @@ interface PluginLifecycleHooks {
|
|
|
564
661
|
* When `processor` is set to 'satteri', the Sätteri Rust-based compiler is used.
|
|
565
662
|
*/
|
|
566
663
|
interface BoltdocsMdxConfig {
|
|
567
|
-
processor?: '
|
|
664
|
+
processor?: 'satteri';
|
|
568
665
|
}
|
|
569
666
|
/**
|
|
570
667
|
* Defines a Boltdocs plugin.
|
|
571
668
|
*
|
|
572
|
-
* Use the `createPlugin()` helper from the node API for full
|
|
573
|
-
* access to lifecycle hooks.
|
|
669
|
+
* Use the `definePlugin()` or `createPlugin()` helper from the node API for full
|
|
670
|
+
* type safety and access to lifecycle hooks.
|
|
574
671
|
*/
|
|
672
|
+
interface PluginCssConfig {
|
|
673
|
+
cssFiles?: string[];
|
|
674
|
+
headStyles?: string[];
|
|
675
|
+
postcssPlugins?: unknown[];
|
|
676
|
+
preprocessorOptions?: Record<string, unknown>;
|
|
677
|
+
}
|
|
575
678
|
interface BoltdocsPlugin {
|
|
576
679
|
name: string;
|
|
577
680
|
enforce?: 'pre' | 'post';
|
|
@@ -581,11 +684,10 @@ interface BoltdocsPlugin {
|
|
|
581
684
|
rehypePlugins?: unknown[];
|
|
582
685
|
vitePlugins?: Plugin[];
|
|
583
686
|
components?: Record<string, string>;
|
|
584
|
-
|
|
687
|
+
client?: PluginClientConfig;
|
|
585
688
|
metadata?: Record<string, unknown>;
|
|
586
|
-
|
|
689
|
+
css?: PluginCssConfig;
|
|
587
690
|
middleware?: PluginTransformMiddleware[];
|
|
588
|
-
/** Lifecycle hooks with full type safety */
|
|
589
691
|
hooks?: PluginLifecycleHooks;
|
|
590
692
|
}
|
|
591
693
|
/**
|
|
@@ -609,6 +711,12 @@ interface BoltdocsVerificationConfig {
|
|
|
609
711
|
/**
|
|
610
712
|
* Configuration for SEO.
|
|
611
713
|
*/
|
|
714
|
+
type JsonLdPrimitive = string | number | boolean | null;
|
|
715
|
+
type JsonLdValue = JsonLdPrimitive | JsonLdObject | JsonLdValue[];
|
|
716
|
+
interface JsonLdObject {
|
|
717
|
+
[key: string]: JsonLdValue | undefined;
|
|
718
|
+
}
|
|
719
|
+
type StructuredData = JsonLdObject | JsonLdObject[];
|
|
612
720
|
interface BoltdocsSeoConfig {
|
|
613
721
|
metatags?: Record<string, string>;
|
|
614
722
|
indexing?: 'all' | 'public';
|
|
@@ -616,6 +724,30 @@ interface BoltdocsSeoConfig {
|
|
|
616
724
|
background?: string;
|
|
617
725
|
};
|
|
618
726
|
verification?: BoltdocsVerificationConfig;
|
|
727
|
+
/** Global JSON-LD graph emitted in every page head. */
|
|
728
|
+
structuredData?: StructuredData;
|
|
729
|
+
}
|
|
730
|
+
interface BoltdocsViewTransitionsConfig {
|
|
731
|
+
/** Native document transitions are enabled when true. */
|
|
732
|
+
enabled?: boolean;
|
|
733
|
+
/** Optional transition types passed to `document.startViewTransition`. */
|
|
734
|
+
types?: string[];
|
|
735
|
+
}
|
|
736
|
+
interface BoltdocsExperimentalConfig {
|
|
737
|
+
/** Enables the native View Transition API integration. */
|
|
738
|
+
viewTransitions?: boolean | BoltdocsViewTransitionsConfig;
|
|
739
|
+
/** Enables static file-routing under `docs/pages-external/`. */
|
|
740
|
+
fileRouting?: boolean;
|
|
741
|
+
}
|
|
742
|
+
interface ExternalFileRoute {
|
|
743
|
+
path: string;
|
|
744
|
+
filePath: string;
|
|
745
|
+
kind: 'component' | 'mdx';
|
|
746
|
+
/**
|
|
747
|
+
* Locale the file provides, derived from a `pages-external/{locale}/`
|
|
748
|
+
* directory. Absent for default-locale files.
|
|
749
|
+
*/
|
|
750
|
+
locale?: string;
|
|
619
751
|
}
|
|
620
752
|
/**
|
|
621
753
|
* Configuration for Google Analytics 4 (GA4).
|
|
@@ -704,6 +836,13 @@ interface BoltdocsIntegrationsConfig {
|
|
|
704
836
|
custom?: BoltdocsCustomFeedbackConfig;
|
|
705
837
|
};
|
|
706
838
|
}
|
|
839
|
+
/**
|
|
840
|
+
* Configuration for static site generation.
|
|
841
|
+
*/
|
|
842
|
+
interface BoltdocsSsgConfig {
|
|
843
|
+
/** Critical CSS strategy; `none` disables critical CSS processing. */
|
|
844
|
+
criticalCss?: 'zig-critters' | 'beasties' | 'none';
|
|
845
|
+
}
|
|
707
846
|
/**
|
|
708
847
|
* Configuration for drafts visibility control.
|
|
709
848
|
*/
|
|
@@ -724,6 +863,7 @@ interface BoltdocsConfig {
|
|
|
724
863
|
i18n?: BoltdocsI18nConfig;
|
|
725
864
|
versions?: BoltdocsVersionsConfig;
|
|
726
865
|
mdx?: BoltdocsMdxConfig;
|
|
866
|
+
ssg?: BoltdocsSsgConfig;
|
|
727
867
|
plugins?: BoltdocsPlugin[];
|
|
728
868
|
collections?: BoltdocsCollectionsConfig;
|
|
729
869
|
robots?: BoltdocsRobotsConfig;
|
|
@@ -732,8 +872,10 @@ interface BoltdocsConfig {
|
|
|
732
872
|
integrations?: BoltdocsIntegrationsConfig;
|
|
733
873
|
drafts?: BoltdocsDraftsConfig;
|
|
734
874
|
featureFlags?: Record<string, boolean | string>;
|
|
875
|
+
experimental?: BoltdocsExperimentalConfig;
|
|
735
876
|
directoryMeta?: Record<string, unknown>;
|
|
736
|
-
|
|
877
|
+
aliases?: AliasOptions;
|
|
878
|
+
vite?: UserConfig;
|
|
737
879
|
}
|
|
738
880
|
/**
|
|
739
881
|
* Global namespace for Boltdocs types that can be augmented by generated code.
|
|
@@ -751,7 +893,8 @@ declare global {
|
|
|
751
893
|
}
|
|
752
894
|
}
|
|
753
895
|
type BoltdocsRoutePath = keyof Boltdocs.RoutePaths;
|
|
754
|
-
type
|
|
896
|
+
type ExternalRouteReference = `/${string}` | `#${string}` | `?${string}` | `site:/${string}` | `site:${string}` | `http://${string}` | `https://${string}` | `//${string}`;
|
|
897
|
+
type BoltdocsRoutePathWithFallback = BoltdocsRoutePath | ExternalRouteReference | string;
|
|
755
898
|
//#endregion
|
|
756
899
|
//#region src/shared/config-utils.d.ts
|
|
757
900
|
/**
|
|
@@ -776,6 +919,6 @@ declare function defineConfig(config: BoltdocsConfig): BoltdocsConfig;
|
|
|
776
919
|
* @param root - The project root directory (defaults to process.cwd())
|
|
777
920
|
* @returns The merged configuration object
|
|
778
921
|
*/
|
|
779
|
-
declare function resolveConfig(docsDir: string, root?: string): Promise<BoltdocsConfig>;
|
|
922
|
+
declare function resolveConfig(docsDir: string, root?: string, command?: string, mode?: string): Promise<BoltdocsConfig>;
|
|
780
923
|
//#endregion
|
|
781
|
-
export { BoltdocsThemeConfig as a,
|
|
924
|
+
export { StructuredData as C, ShikiTheme as S, PluginServerMiddleware as _, BoltdocsThemeConfig as a, RegisteredVirtualModule as b, ExternalFileRoute as c, JsonLdValue as d, PluginContext as f, PluginMeta as g, PluginLogger as h, BoltdocsExperimentalConfig as i, IPluginLifecycleManager as l, PluginLifecycleHooks as m, defineConfig as n, BoltdocsViewTransitionsConfig as o, PluginHmrEvent as p, BoltdocsConfig as r, DiagnosticRecord as s, resolveConfig as t, JsonLdObject as u, PluginStore as v, RouteMeta as x, PluginTransformMiddleware as y };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { Plugin } from "vite";
|
|
2
|
+
import { AliasOptions, Plugin, UserConfig } from "vite";
|
|
3
3
|
import * as _$http from "http";
|
|
4
4
|
//#region src/shared/types.d.ts
|
|
5
5
|
/**
|
|
@@ -64,7 +64,7 @@ interface RouteMeta {
|
|
|
64
64
|
/** The raw markdown content of the page */
|
|
65
65
|
_rawContent?: string;
|
|
66
66
|
/** Extracted SEO and Open Graph metadata from frontmatter */
|
|
67
|
-
seo?: Record<string,
|
|
67
|
+
seo?: Record<string, unknown>;
|
|
68
68
|
/** The publication date */
|
|
69
69
|
date?: string | Date;
|
|
70
70
|
/** The last updated timestamp or date */
|
|
@@ -78,7 +78,7 @@ interface RouteMeta {
|
|
|
78
78
|
/** Whether the page is hidden from the sidebar */
|
|
79
79
|
sidebarHidden?: boolean;
|
|
80
80
|
/** Raw extensible frontmatter data for custom components and formatters */
|
|
81
|
-
frontmatter?: Record<string,
|
|
81
|
+
frontmatter?: Record<string, unknown>;
|
|
82
82
|
/** Optional recursive child routes for deep sidebar hierarchies */
|
|
83
83
|
subRoutes?: RouteMeta[];
|
|
84
84
|
/** Clean URL segments stripped of locale/version prefixes */
|
|
@@ -534,15 +534,112 @@ interface PluginServerAPI {
|
|
|
534
534
|
* Connect-style middleware signature.
|
|
535
535
|
*/
|
|
536
536
|
type PluginServerMiddleware = (req: _$http.IncomingMessage, res: _$http.ServerResponse, next: (err?: unknown) => void) => void | Promise<void>;
|
|
537
|
+
/**
|
|
538
|
+
* Public API surface of the core plugin lifecycle manager.
|
|
539
|
+
*
|
|
540
|
+
* This is exposed as an interface so that plugin authors and internal
|
|
541
|
+
* subsystems can receive a reference to the lifecycle manager without
|
|
542
|
+
* pulling in the concrete class (which has private members and is not
|
|
543
|
+
* stable across source/dist boundaries during development).
|
|
544
|
+
*/
|
|
545
|
+
interface IPluginLifecycleManager {
|
|
546
|
+
runHook(hookName: keyof PluginLifecycleHooks, ...args: unknown[]): Promise<void>;
|
|
547
|
+
runChain<TParams extends Record<string, unknown>>(hookName: keyof PluginLifecycleHooks, initialParams: TParams): Promise<TParams>;
|
|
548
|
+
runMiddlewareChain<TParams extends Record<string, unknown>>(hookName: 'transformSource' | 'transformMdx' | 'transformHtml', initialParams: TParams): Promise<TParams>;
|
|
549
|
+
hasHook(hookName: keyof PluginLifecycleHooks | 'transformSource' | 'transformMdx' | 'transformHtml'): boolean;
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* Standardized Search Document contract passed to search plugins.
|
|
553
|
+
*/
|
|
554
|
+
interface SearchDocument {
|
|
555
|
+
id: string;
|
|
556
|
+
path: string;
|
|
557
|
+
title: string;
|
|
558
|
+
content: string;
|
|
559
|
+
headings: Array<{
|
|
560
|
+
level: number;
|
|
561
|
+
text: string;
|
|
562
|
+
id: string;
|
|
563
|
+
}>;
|
|
564
|
+
frontmatter: Record<string, unknown>;
|
|
565
|
+
locale?: string;
|
|
566
|
+
version?: string;
|
|
567
|
+
}
|
|
568
|
+
interface PluginHeadEntry {
|
|
569
|
+
tag: 'script' | 'link' | 'meta' | 'style';
|
|
570
|
+
attrs?: Record<string, string | boolean>;
|
|
571
|
+
content?: string;
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Client-side configuration and UI slot injections for plugins.
|
|
575
|
+
*/
|
|
576
|
+
interface PluginClientConfig {
|
|
577
|
+
/** Dynamic UI slot registrations (mapped to component file paths) */
|
|
578
|
+
slots?: Record<string, string>;
|
|
579
|
+
/** Top-level React provider component file paths */
|
|
580
|
+
providers?: string[];
|
|
581
|
+
/** MDX component overrides & additions */
|
|
582
|
+
mdxComponents?: Record<string, string>;
|
|
583
|
+
/** Head elements to inject into rendered HTML */
|
|
584
|
+
head?: PluginHeadEntry[];
|
|
585
|
+
}
|
|
537
586
|
/**
|
|
538
587
|
* Plugin lifecycle hooks with full type safety.
|
|
539
588
|
*/
|
|
540
589
|
interface PluginLifecycleHooks {
|
|
590
|
+
/** Build hooks (Astro-style) */
|
|
591
|
+
'build:before'?: (ctx: PluginContext) => Promise<void> | void;
|
|
592
|
+
'build:after'?: (ctx: PluginContext) => Promise<void> | void;
|
|
593
|
+
'build:end'?: (ctx: PluginContext) => Promise<void> | void;
|
|
594
|
+
'build:generate'?: (ctx: PluginContext, params: {
|
|
595
|
+
routes: RouteMeta[];
|
|
596
|
+
outDir: string;
|
|
597
|
+
siteUrl?: string;
|
|
598
|
+
}) => void | Promise<void>;
|
|
599
|
+
/** Dev hooks (Astro-style) */
|
|
600
|
+
'dev:before'?: (ctx: PluginContext) => Promise<void> | void;
|
|
601
|
+
'dev:after'?: (ctx: PluginContext) => Promise<void> | void;
|
|
602
|
+
/** Transform hooks (Astro-style) */
|
|
603
|
+
'transform:source'?: (ctx: PluginContext, params: TransformSourceParams) => TransformResult<{
|
|
604
|
+
code: string;
|
|
605
|
+
}> | Promise<TransformResult<{
|
|
606
|
+
code: string;
|
|
607
|
+
}>>;
|
|
608
|
+
'transform:mdx'?: (ctx: PluginContext, params: TransformSourceParams) => TransformResult<{
|
|
609
|
+
code: string;
|
|
610
|
+
}> | Promise<TransformResult<{
|
|
611
|
+
code: string;
|
|
612
|
+
}>>;
|
|
613
|
+
'transform:html'?: (ctx: PluginContext, params: TransformHtmlParams) => TransformResult<{
|
|
614
|
+
html: string;
|
|
615
|
+
}> | Promise<TransformResult<{
|
|
616
|
+
html: string;
|
|
617
|
+
}>>;
|
|
618
|
+
/** Dynamic frontmatter transformation hook */
|
|
619
|
+
'frontmatter:transform'?: (ctx: PluginContext, params: {
|
|
620
|
+
frontmatter: Record<string, unknown>;
|
|
621
|
+
filePath: string;
|
|
622
|
+
rawContent: string;
|
|
623
|
+
}) => Record<string, unknown> | Promise<Record<string, unknown>> | undefined;
|
|
624
|
+
/** Fired after routes are crawled, normalized, and resolved */
|
|
625
|
+
'routes:resolved'?: (ctx: PluginContext, params: {
|
|
626
|
+
routes: RouteMeta[];
|
|
627
|
+
}) => RouteMeta[] | Promise<RouteMeta[]> | undefined;
|
|
628
|
+
/** Agnostic search index hook: core passes SearchDocument[], plugin returns index payload */
|
|
629
|
+
'search:index'?: (ctx: PluginContext, params: {
|
|
630
|
+
documents: SearchDocument[];
|
|
631
|
+
routes: RouteMeta[];
|
|
632
|
+
}) => unknown | Promise<unknown>;
|
|
633
|
+
'server:configure'?: (ctx: PluginContext, params: {
|
|
634
|
+
server: unknown;
|
|
635
|
+
middleware: PluginServerAPI;
|
|
636
|
+
}) => void | Promise<void>;
|
|
637
|
+
/** Legacy alias hooks for backwards compatibility */
|
|
541
638
|
beforeBuild?: (ctx: PluginContext) => Promise<void> | void;
|
|
542
639
|
afterBuild?: (ctx: PluginContext) => Promise<void> | void;
|
|
640
|
+
buildEnd?: (ctx: PluginContext) => Promise<void> | void;
|
|
543
641
|
beforeDev?: (ctx: PluginContext) => Promise<void> | void;
|
|
544
642
|
afterDev?: (ctx: PluginContext) => Promise<void> | void;
|
|
545
|
-
buildEnd?: (ctx: PluginContext) => Promise<void> | void;
|
|
546
643
|
transformSource?: (ctx: PluginContext, params: TransformSourceParams) => TransformResult<{
|
|
547
644
|
code: string;
|
|
548
645
|
}> | Promise<TransformResult<{
|
|
@@ -564,14 +661,20 @@ interface PluginLifecycleHooks {
|
|
|
564
661
|
* When `processor` is set to 'satteri', the Sätteri Rust-based compiler is used.
|
|
565
662
|
*/
|
|
566
663
|
interface BoltdocsMdxConfig {
|
|
567
|
-
processor?: '
|
|
664
|
+
processor?: 'satteri';
|
|
568
665
|
}
|
|
569
666
|
/**
|
|
570
667
|
* Defines a Boltdocs plugin.
|
|
571
668
|
*
|
|
572
|
-
* Use the `createPlugin()` helper from the node API for full
|
|
573
|
-
* access to lifecycle hooks.
|
|
669
|
+
* Use the `definePlugin()` or `createPlugin()` helper from the node API for full
|
|
670
|
+
* type safety and access to lifecycle hooks.
|
|
574
671
|
*/
|
|
672
|
+
interface PluginCssConfig {
|
|
673
|
+
cssFiles?: string[];
|
|
674
|
+
headStyles?: string[];
|
|
675
|
+
postcssPlugins?: unknown[];
|
|
676
|
+
preprocessorOptions?: Record<string, unknown>;
|
|
677
|
+
}
|
|
575
678
|
interface BoltdocsPlugin {
|
|
576
679
|
name: string;
|
|
577
680
|
enforce?: 'pre' | 'post';
|
|
@@ -581,11 +684,10 @@ interface BoltdocsPlugin {
|
|
|
581
684
|
rehypePlugins?: unknown[];
|
|
582
685
|
vitePlugins?: Plugin[];
|
|
583
686
|
components?: Record<string, string>;
|
|
584
|
-
|
|
687
|
+
client?: PluginClientConfig;
|
|
585
688
|
metadata?: Record<string, unknown>;
|
|
586
|
-
|
|
689
|
+
css?: PluginCssConfig;
|
|
587
690
|
middleware?: PluginTransformMiddleware[];
|
|
588
|
-
/** Lifecycle hooks with full type safety */
|
|
589
691
|
hooks?: PluginLifecycleHooks;
|
|
590
692
|
}
|
|
591
693
|
/**
|
|
@@ -609,6 +711,12 @@ interface BoltdocsVerificationConfig {
|
|
|
609
711
|
/**
|
|
610
712
|
* Configuration for SEO.
|
|
611
713
|
*/
|
|
714
|
+
type JsonLdPrimitive = string | number | boolean | null;
|
|
715
|
+
type JsonLdValue = JsonLdPrimitive | JsonLdObject | JsonLdValue[];
|
|
716
|
+
interface JsonLdObject {
|
|
717
|
+
[key: string]: JsonLdValue | undefined;
|
|
718
|
+
}
|
|
719
|
+
type StructuredData = JsonLdObject | JsonLdObject[];
|
|
612
720
|
interface BoltdocsSeoConfig {
|
|
613
721
|
metatags?: Record<string, string>;
|
|
614
722
|
indexing?: 'all' | 'public';
|
|
@@ -616,6 +724,30 @@ interface BoltdocsSeoConfig {
|
|
|
616
724
|
background?: string;
|
|
617
725
|
};
|
|
618
726
|
verification?: BoltdocsVerificationConfig;
|
|
727
|
+
/** Global JSON-LD graph emitted in every page head. */
|
|
728
|
+
structuredData?: StructuredData;
|
|
729
|
+
}
|
|
730
|
+
interface BoltdocsViewTransitionsConfig {
|
|
731
|
+
/** Native document transitions are enabled when true. */
|
|
732
|
+
enabled?: boolean;
|
|
733
|
+
/** Optional transition types passed to `document.startViewTransition`. */
|
|
734
|
+
types?: string[];
|
|
735
|
+
}
|
|
736
|
+
interface BoltdocsExperimentalConfig {
|
|
737
|
+
/** Enables the native View Transition API integration. */
|
|
738
|
+
viewTransitions?: boolean | BoltdocsViewTransitionsConfig;
|
|
739
|
+
/** Enables static file-routing under `docs/pages-external/`. */
|
|
740
|
+
fileRouting?: boolean;
|
|
741
|
+
}
|
|
742
|
+
interface ExternalFileRoute {
|
|
743
|
+
path: string;
|
|
744
|
+
filePath: string;
|
|
745
|
+
kind: 'component' | 'mdx';
|
|
746
|
+
/**
|
|
747
|
+
* Locale the file provides, derived from a `pages-external/{locale}/`
|
|
748
|
+
* directory. Absent for default-locale files.
|
|
749
|
+
*/
|
|
750
|
+
locale?: string;
|
|
619
751
|
}
|
|
620
752
|
/**
|
|
621
753
|
* Configuration for Google Analytics 4 (GA4).
|
|
@@ -704,6 +836,13 @@ interface BoltdocsIntegrationsConfig {
|
|
|
704
836
|
custom?: BoltdocsCustomFeedbackConfig;
|
|
705
837
|
};
|
|
706
838
|
}
|
|
839
|
+
/**
|
|
840
|
+
* Configuration for static site generation.
|
|
841
|
+
*/
|
|
842
|
+
interface BoltdocsSsgConfig {
|
|
843
|
+
/** Critical CSS strategy; `none` disables critical CSS processing. */
|
|
844
|
+
criticalCss?: 'zig-critters' | 'beasties' | 'none';
|
|
845
|
+
}
|
|
707
846
|
/**
|
|
708
847
|
* Configuration for drafts visibility control.
|
|
709
848
|
*/
|
|
@@ -724,6 +863,7 @@ interface BoltdocsConfig {
|
|
|
724
863
|
i18n?: BoltdocsI18nConfig;
|
|
725
864
|
versions?: BoltdocsVersionsConfig;
|
|
726
865
|
mdx?: BoltdocsMdxConfig;
|
|
866
|
+
ssg?: BoltdocsSsgConfig;
|
|
727
867
|
plugins?: BoltdocsPlugin[];
|
|
728
868
|
collections?: BoltdocsCollectionsConfig;
|
|
729
869
|
robots?: BoltdocsRobotsConfig;
|
|
@@ -732,8 +872,10 @@ interface BoltdocsConfig {
|
|
|
732
872
|
integrations?: BoltdocsIntegrationsConfig;
|
|
733
873
|
drafts?: BoltdocsDraftsConfig;
|
|
734
874
|
featureFlags?: Record<string, boolean | string>;
|
|
875
|
+
experimental?: BoltdocsExperimentalConfig;
|
|
735
876
|
directoryMeta?: Record<string, unknown>;
|
|
736
|
-
|
|
877
|
+
aliases?: AliasOptions;
|
|
878
|
+
vite?: UserConfig;
|
|
737
879
|
}
|
|
738
880
|
/**
|
|
739
881
|
* Global namespace for Boltdocs types that can be augmented by generated code.
|
|
@@ -751,7 +893,8 @@ declare global {
|
|
|
751
893
|
}
|
|
752
894
|
}
|
|
753
895
|
type BoltdocsRoutePath = keyof Boltdocs.RoutePaths;
|
|
754
|
-
type
|
|
896
|
+
type ExternalRouteReference = `/${string}` | `#${string}` | `?${string}` | `site:/${string}` | `site:${string}` | `http://${string}` | `https://${string}` | `//${string}`;
|
|
897
|
+
type BoltdocsRoutePathWithFallback = BoltdocsRoutePath | ExternalRouteReference | string;
|
|
755
898
|
//#endregion
|
|
756
899
|
//#region src/shared/config-utils.d.ts
|
|
757
900
|
/**
|
|
@@ -776,6 +919,6 @@ declare function defineConfig(config: BoltdocsConfig): BoltdocsConfig;
|
|
|
776
919
|
* @param root - The project root directory (defaults to process.cwd())
|
|
777
920
|
* @returns The merged configuration object
|
|
778
921
|
*/
|
|
779
|
-
declare function resolveConfig(docsDir: string, root?: string): Promise<BoltdocsConfig>;
|
|
922
|
+
declare function resolveConfig(docsDir: string, root?: string, command?: string, mode?: string): Promise<BoltdocsConfig>;
|
|
780
923
|
//#endregion
|
|
781
|
-
export { BoltdocsThemeConfig as a,
|
|
924
|
+
export { StructuredData as C, ShikiTheme as S, PluginServerMiddleware as _, BoltdocsThemeConfig as a, RegisteredVirtualModule as b, ExternalFileRoute as c, JsonLdValue as d, PluginContext as f, PluginMeta as g, PluginLogger as h, BoltdocsExperimentalConfig as i, IPluginLifecycleManager as l, PluginLifecycleHooks as m, defineConfig as n, BoltdocsViewTransitionsConfig as o, PluginHmrEvent as p, BoltdocsConfig as r, DiagnosticRecord as s, resolveConfig as t, JsonLdObject as u, PluginStore as v, RouteMeta as x, PluginTransformMiddleware as y };
|
|
@@ -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(`./config-files-D9cdBMl2.cjs`);let r=require(`node:path`);r=e.r(r);let i=require(`node:fs`);i=e.r(i);let a=require(`node:crypto`);a=e.r(a);let o=require(`zod`),s=require(`@bdocs/dui`);function c(e){return e}const l=o.z.object({icon:o.z.string().max(50),link:o.z.string().url()}),u=o.z.object({processor:o.z.enum([`satteri`]).default(`satteri`)}),d=o.z.object({name:o.z.string(),enforce:o.z.enum([`pre`,`post`]).optional(),version:o.z.string().optional(),boltdocsVersion:o.z.string().optional(),clientEntry:o.z.string().optional(),remarkPlugins:o.z.array(o.z.unknown()).optional(),rehypePlugins:o.z.array(o.z.unknown()).optional(),vitePlugins:o.z.array(o.z.unknown()).optional(),components:o.z.record(o.z.string(),o.z.string()).optional(),metadata:o.z.record(o.z.string(),o.z.unknown()).optional(),css:o.z.object({cssFiles:o.z.array(o.z.string()).optional(),headStyles:o.z.array(o.z.string()).optional(),postcssPlugins:o.z.array(o.z.unknown()).optional(),preprocessorOptions:o.z.record(o.z.string(),o.z.unknown()).optional()}).optional(),middleware:o.z.array(o.z.object({name:o.z.string().optional(),enforce:o.z.enum([`pre`,`post`]).optional()}).passthrough()).optional(),hooks:o.z.record(o.z.string(),o.z.unknown()).optional()}),f=o.z.object({title:o.z.union([o.z.string(),o.z.record(o.z.string(),o.z.string())]).optional(),description:o.z.union([o.z.string(),o.z.record(o.z.string(),o.z.string())]).optional(),logo:o.z.union([o.z.string(),o.z.object({dark:o.z.string(),light:o.z.string(),alt:o.z.string().optional(),width:o.z.number().optional(),height:o.z.number().optional()})]).optional(),navbar:o.z.array(o.z.object({label:o.z.union([o.z.string(),o.z.record(o.z.string(),o.z.string())]),href:o.z.string(),items:o.z.array(o.z.object({label:o.z.union([o.z.string(),o.z.record(o.z.string(),o.z.string())]),href:o.z.string()})).optional()})).optional(),sidebar:o.z.record(o.z.string(),o.z.array(o.z.object({text:o.z.string(),link:o.z.string()}))).optional(),sidebarGroups:o.z.record(o.z.string(),o.z.object({title:o.z.union([o.z.string(),o.z.record(o.z.string(),o.z.string())]).optional(),icon:o.z.string().optional()})).optional(),socialLinks:o.z.array(l).optional(),editLink:o.z.string().refine(e=>!e||e.includes(`:path`),{message:`editLink must contain ':path' placeholder if specified`}).optional(),communityHelp:o.z.string().url().optional(),version:o.z.string().max(50).optional(),githubRepo:o.z.string().max(100).optional(),favicon:o.z.string().optional(),tabs:o.z.array(o.z.object({id:o.z.string(),text:o.z.union([o.z.string(),o.z.record(o.z.string(),o.z.string())]),icon:o.z.string().optional()})).optional(),codeTheme:o.z.union([o.z.string(),o.z.object({light:o.z.string(),dark:o.z.string()})]).optional()}),p=o.z.union([o.z.string(),o.z.object({rules:o.z.array(o.z.object({userAgent:o.z.string(),allow:o.z.union([o.z.string(),o.z.array(o.z.string())]).optional(),disallow:o.z.union([o.z.string(),o.z.array(o.z.string())]).optional()})).optional(),sitemaps:o.z.array(o.z.string().url()).optional()})]),m=o.z.object({defaultLocale:o.z.string(),locales:o.z.union([o.z.record(o.z.string(),o.z.string()),o.z.array(o.z.string())]).transform(e=>Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e),localeConfigs:o.z.record(o.z.string(),o.z.object({label:o.z.string().optional(),direction:o.z.enum([`ltr`,`rtl`]).optional(),htmlLang:o.z.string().optional(),calendar:o.z.string().optional()})).optional()}),h=o.z.object({defaultVersion:o.z.string(),prefix:o.z.string().optional(),versions:o.z.array(o.z.object({label:o.z.string(),path:o.z.string()}))}),g=o.z.object({headers:o.z.record(o.z.string(),o.z.string()).optional(),enableCSP:o.z.boolean().optional(),customHeaders:o.z.record(o.z.string(),o.z.string()).optional()}),_=o.z.object({google:o.z.string().optional(),bing:o.z.string().optional(),yandex:o.z.string().optional(),pinterest:o.z.string().optional(),facebook:o.z.string().optional()}),v=o.z.lazy(()=>o.z.union([o.z.string(),o.z.number(),o.z.boolean(),o.z.null(),o.z.array(v),o.z.record(o.z.string(),v)])),y=o.z.union([o.z.record(o.z.string(),v),o.z.array(o.z.record(o.z.string(),v))]),b=o.z.object({metatags:o.z.record(o.z.string(),o.z.string()).optional(),indexing:o.z.enum([`all`,`public`]).optional(),thumbnails:o.z.object({background:o.z.string().optional()}).optional(),verification:_.optional(),structuredData:y.optional()}),x=o.z.object({viewTransitions:o.z.union([o.z.boolean(),o.z.object({enabled:o.z.boolean().optional(),types:o.z.array(o.z.string()).optional()})]).optional(),fileRouting:o.z.boolean().optional()}),S=o.z.object({measurementId:o.z.string().min(1,`Measurement ID is required for GA4`),debug:o.z.boolean().optional(),anonymizeIp:o.z.boolean().optional(),sendPageView:o.z.boolean().optional(),cookieFlags:o.z.string().optional(),autoTrack:o.z.object({pageViews:o.z.boolean().optional(),downloads:o.z.boolean().optional(),externalLinks:o.z.boolean().optional(),search:o.z.boolean().optional()}).optional()}),C=o.z.object({tagId:o.z.string().min(1,`Tag ID is required for GTM`),dataLayerName:o.z.string().optional(),preview:o.z.string().optional()}),w=o.z.object({appId:o.z.string().min(1,`Algolia App ID is required`),apiKey:o.z.string().min(1,`Algolia API Key is required`),indexName:o.z.string().min(1,`Algolia Index Name is required`)}),T=o.z.object({repo:o.z.string().min(1,`Giscus repository is required`),repoId:o.z.string().min(1,`Giscus repository ID is required`),category:o.z.string().optional(),categoryId:o.z.string().optional(),mapping:o.z.enum([`pathname`,`url`,`title`,`og:title`,`specific`,`number`]).optional(),strict:o.z.union([o.z.enum([`0`,`1`]),o.z.boolean()]).optional(),reactionsEnabled:o.z.union([o.z.enum([`0`,`1`]),o.z.boolean()]).optional(),emitMetadata:o.z.union([o.z.enum([`0`,`1`]),o.z.boolean()]).optional(),inputPosition:o.z.enum([`top`,`bottom`]).optional(),theme:o.z.string().optional(),darkTheme:o.z.string().optional(),lang:o.z.string().optional(),loading:o.z.enum([`lazy`,`eager`]).optional()}),E=o.z.object({enabled:o.z.boolean(),owner:o.z.string().min(1,`GitHub owner is required`),repo:o.z.string().min(1,`GitHub repository name is required`),categorySlug:o.z.string().optional(),endpoint:o.z.string().optional()}),D=o.z.object({analytics:o.z.boolean().optional(),speedInsights:o.z.boolean().optional()}),O=o.z.object({apiKey:o.z.string().min(1,`API key is required for PostHog`),host:o.z.string().url().optional(),capturePageview:o.z.boolean().optional(),capturePageleave:o.z.boolean().optional(),sessionRecording:o.z.boolean().optional(),autocapture:o.z.boolean().optional()}),k=o.z.object({ga4:S.optional(),gtm:C.optional(),vercel:D.optional(),posthog:O.optional()}),A=o.z.object({algolia:w.optional()}),j=o.z.object({giscus:T.optional(),custom:E.optional()}),M=o.z.object({analytics:k.optional(),search:A.optional(),feedback:j.optional()}),N=o.z.object({criticalCss:o.z.enum([`zig-critters`,`beasties`,`none`]).optional()}),P=o.z.object({labels:o.z.record(o.z.string(),o.z.union([o.z.string(),o.z.record(o.z.string(),o.z.string())])).optional(),positions:o.z.record(o.z.string(),o.z.number()).optional(),postsPerPage:o.z.number().int().positive().optional(),defaultCollection:o.z.string().optional(),dateFormat:o.z.string().optional(),sortBy:o.z.enum([`date`,`title`,`sidebarPosition`]).optional()}),F=o.z.object({visible:o.z.boolean().optional(),environments:o.z.array(o.z.string()).optional()}),I=o.z.object({turbo:o.z.boolean().optional(),siteUrl:o.z.string().url().optional(),docsDir:o.z.string().optional(),base:o.z.string().optional(),theme:f.optional(),i18n:m.optional(),versions:h.optional(),mdx:u.optional(),ssg:N.optional(),plugins:o.z.array(d).optional(),collections:P.optional(),robots:p.optional(),security:g.optional(),seo:b.optional(),integrations:M.optional(),drafts:F.optional(),experimental:x.optional(),aliases:o.z.custom().optional(),featureFlags:o.z.record(o.z.string(),o.z.union([o.z.boolean(),o.z.string()])).optional(),vite:o.z.custom().optional()}),L=new Map;function R(e,t,n,r){return`${e}::${t}::${n}::${r}`}function z(e){return r.default.join(e,`.boltdocs`,`cache`,`config.json`)}function B(e,t,n,r,i){return a.default.createHash(`sha256`).update(`${e}:${t}:${n}:${r}:${i}`).digest(`hex`)}function V(e,t,n){let a=z(e);if(!i.default.existsSync(a))return null;try{let o=i.default.readFileSync(a,`utf-8`),s=JSON.parse(o),c=r.default.resolve(e,s.filename);if(!i.default.existsSync(c))return null;let l=i.default.statSync(c);if(B(s.filename,l.mtimeMs,l.size,t,n)!==B(s.filename,s.mtimeMs,s.size,s.command,s.mode))return null;let u=I.safeParse(s.config);return u.success?{config:u.data,configFile:c}:null}catch{return null}}function H(e,t,n,a,o,s,c){try{let l=z(e);i.default.mkdirSync(r.default.dirname(l),{recursive:!0});let u={filename:t,mtimeMs:n,size:a,command:o,mode:s,config:{...c,plugins:[]}};i.default.writeFileSync(l,JSON.stringify(u),`utf-8`)}catch(e){process.env.BOLTDOCS_DEBUG===`true`&&console.warn(`[boltdocs] Failed to write config cache:`,e)}}async function U(e,t){let{createJiti:n}=await import(`jiti`),r=await n(t,{interopDefault:!0}).import(e);return r.default??r.config??r}async function W(e,a=process.cwd(),o=`serve`,c=`development`){let l=a,u=R(e,l,o,c);{let e=L.get(u);if(e)return e}let d=V(l,o,c);if(d){try{let e=await U(d.configFile,l);e?.plugins&&(d.config.plugins=e.plugins)}catch{}return L.set(u,d.config),d.config}let f={docsDir:r.default.resolve(l,e),theme:{title:`Boltdocs`,description:`A Vite documentation framework`,navbar:[{label:`Home`,href:`/`},{label:`Documentation`,href:`/docs`}],codeTheme:{light:`github-light`,dark:`github-dark`}}},p={},m=null;for(let e of n.t){let t=r.default.resolve(l,e);if(i.default.existsSync(t))try{let n;try{n=await U(t,l)}catch(r){process.env.BOLTDOCS_DEBUG===`true`&&console.warn(`[boltdocs] jiti config load failed for ${e}, falling back to Vite: ${r instanceof Error?r.message:String(r)}`);let{loadConfigFromFile:i}=await import(`vite`);n=(await i({command:o,mode:c},t,l))?.config}if(n){p=n;let r=i.default.statSync(t);m={filename:e,mtimeMs:r.mtimeMs,size:r.size};break}}catch(t){t instanceof Error&&(console.error(`\x1b[31m[boltdocs] ✖ Failed to load config from ${e}: ${t.message}\x1b[0m`),(0,s.warn)(`Failed to load config from ${e}: ${t.message}`))}}let h={title:p.title,description:p.description,logo:p.logo,favicon:p.favicon,navbar:p.navbar,sidebar:p.sidebar,sidebarGroups:p.theme?.sidebarGroups,socialLinks:p.socialLinks,githubRepo:p.githubRepo,tabs:p.tabs,codeTheme:p.codeTheme,communityHelp:p.communityHelp,version:p.version,editLink:p.editLink,...p.theme||{}},g=Object.fromEntries(Object.entries(h).filter(([e,t])=>t!==void 0));g.navbar&&=g.navbar.map(e=>({label:e.label||``,href:e.href||``,items:e.items}));let _={docsDir:r.default.resolve(l,p.docsDir||e),theme:{...f.theme,...g},i18n:p.i18n?{...p.i18n,locales:Array.isArray(p.i18n.locales)?Object.fromEntries(p.i18n.locales.map(e=>[e,e])):p.i18n.locales}:void 0,versions:p.versions,siteUrl:p.siteUrl,base:p.base,ssg:p.ssg,seo:p.seo,plugins:p.plugins||[],robots:p.robots,security:p.security,integrations:p.integrations,experimental:p.experimental,featureFlags:p.featureFlags,aliases:p.aliases,drafts:p.drafts,collections:p.collections,vite:p.vite},v=I.safeParse(_);if(!v.success)throw new t.r(`Invalid Boltdocs configuration:\n${v.error.issues.map(e=>` - ${e.path.join(`.`)}: ${e.message}`).join(`
|
|
7
|
+
`)}`);let y=v.data;return m&&H(l,m.filename,m.mtimeMs,m.size,o,c,y),L.set(u,y),y}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return W}});
|