boltdocs 3.3.5 → 3.3.6

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 (79) hide show
  1. package/dist/{build-BVoMHMhw.mjs → build-BJnL-FHG.mjs} +1 -1
  2. package/dist/{build-B672n0hL.cjs → build-CxT38vPv.cjs} +1 -1
  3. package/dist/client/index.cjs +29 -12
  4. package/dist/client/index.d.cts +1 -1
  5. package/dist/client/index.d.ts +1 -1
  6. package/dist/client/index.js +27 -11
  7. package/dist/client/mdx.cjs +1 -1
  8. package/dist/client/mdx.js +1 -1
  9. package/dist/client/primitives.cjs +4 -4
  10. package/dist/client/primitives.d.cts +40 -9
  11. package/dist/client/primitives.d.ts +40 -9
  12. package/dist/client/primitives.js +4 -4
  13. package/dist/config-B3_iVsbi.mjs +7 -0
  14. package/dist/{config-PLvresCv.cjs → config-BC_qhXws.cjs} +1 -1
  15. package/dist/config-BJp3lGzE.cjs +7 -0
  16. package/dist/{dev-DbuhNcF5.cjs → dev-46NiL0MC.cjs} +1 -1
  17. package/dist/{dev-B49V6O6p.mjs → dev-C4kjO5xs.mjs} +1 -1
  18. package/dist/{docs-layout-CbZ7LDRe.js → docs-layout-D3Fmb0Wd.js} +16 -117
  19. package/dist/{docs-layout-vzfXed1Q.cjs → docs-layout-SgphExoE.cjs} +16 -123
  20. package/dist/{doctor-DMECtdK6.cjs → doctor-BqxOFRt3.cjs} +1 -1
  21. package/dist/{doctor-i8Qmd8DJ.mjs → doctor-Cv5lXnay.mjs} +1 -1
  22. package/dist/{doctor-FuFY1jBz.cjs → doctor-TS3JGNEU.cjs} +1 -1
  23. package/dist/{image-B-NDSDuY.js → image-BAiDReNd.js} +1 -1
  24. package/dist/{image-Hnaa2bJd.cjs → image-Bkx85rsq.cjs} +1 -1
  25. package/dist/{index-B3o307nd.d.ts → index-B1Mx0dHl.d.ts} +24 -4
  26. package/dist/{index-Bg-JtZeK.d.cts → index-DLaHgD-i.d.cts} +24 -4
  27. package/dist/{link-vZjmD-es.cjs → link-hLWOsx0x.cjs} +59 -28
  28. package/dist/{link-CgdI6O2o.js → link-q1qHNGK_.js} +54 -29
  29. package/dist/{mdx-BRT71V5Q.js → mdx-CJGWzBGy.js} +2 -2
  30. package/dist/{mdx-D0Absdq5.cjs → mdx-Qi0DmaY8.cjs} +2 -2
  31. package/dist/node/cli-entry.cjs +1 -1
  32. package/dist/node/cli-entry.mjs +1 -1
  33. package/dist/node/highlight.d.cts +2 -2
  34. package/dist/node/highlight.d.mts +2 -2
  35. package/dist/node/index.cjs +1 -1
  36. package/dist/node/index.d.cts +7 -4
  37. package/dist/node/index.d.mts +7 -4
  38. package/dist/node/index.mjs +1 -1
  39. package/dist/node/mdx/shiki-adapter.cjs +1 -1
  40. package/dist/node/mdx/shiki-adapter.d.cts +7 -2
  41. package/dist/node/mdx/shiki-adapter.d.mts +7 -2
  42. package/dist/node/mdx/shiki-adapter.mjs +1 -1
  43. package/dist/node-7Cfw6nMr.cjs +23 -0
  44. package/dist/node-CT2E84nY.mjs +23 -0
  45. package/dist/{package-CNqjEYE1.cjs → package-Bah2tHjK.cjs} +1 -1
  46. package/dist/{package-sdcKhDhe.mjs → package-D6bf68FR.mjs} +1 -1
  47. package/dist/plugin-AgNI3ktz.cjs +69 -0
  48. package/dist/plugin-BAv_pYLt.mjs +69 -0
  49. package/dist/{plugin-context-CscLcXjH.cjs → plugin-context-BZs5lvDu.cjs} +2 -2
  50. package/dist/{plugin-context-DuSg-Hax.mjs → plugin-context-b5qVVQSU.mjs} +1 -1
  51. package/dist/{plugin-lifecycle-BywrEoWK.cjs → plugin-lifecycle-s89gzTlh.cjs} +1 -1
  52. package/dist/{registry-sJqDv0kE.d.mts → registry-B8pt41zj.d.cts} +1 -1
  53. package/dist/{registry-BbB6NqSv.d.cts → registry-BrrH2X9c.d.mts} +1 -1
  54. package/dist/routes-CzhKOw67.cjs +6 -0
  55. package/dist/{routes-C3_w9fLX.cjs → routes-Dq_2EUIB.cjs} +1 -1
  56. package/dist/routes-Dw6g0bfF.mjs +6 -0
  57. package/dist/search-dialog-BYZS9aeO.cjs +747 -0
  58. package/dist/{search-dialog-x_qHU8ty.cjs → search-dialog-CguKVtUu.cjs} +145 -5
  59. package/dist/{search-dialog-B9mdxsUC.js → search-dialog-DQwod5Xc.js} +1 -1
  60. package/dist/search-dialog-DzObE-Ar.js +717 -0
  61. package/dist/{search-dialog-DCtm2dyR.cjs → search-dialog-QgKRRbsI.cjs} +1 -1
  62. package/dist/{search-dialog-BqkzDTq2.js → search-dialog-mYnqU4v7.js} +134 -6
  63. package/dist/{types-Db6zToZH.d.mts → types-74i_xUe2.d.mts} +1 -1
  64. package/dist/{types-o7iZ2BAR.d.cts → types-X_Pwk8Cg.d.cts} +1 -1
  65. package/dist/virtual-modules-C3S3Nz8r.cjs +40 -0
  66. package/dist/virtual-modules-CaxqrFd6.mjs +40 -0
  67. package/package.json +6 -5
  68. package/dist/config-CrsQJHQz.cjs +0 -7
  69. package/dist/config-DC0nMMk7.mjs +0 -7
  70. package/dist/node-BljvHMpS.cjs +0 -23
  71. package/dist/node-CWxGw4H4.mjs +0 -23
  72. package/dist/plugin-BPcm1cU0.mjs +0 -69
  73. package/dist/plugin-WUhxnpko.cjs +0 -69
  74. package/dist/routes-C0kb4ue6.cjs +0 -6
  75. package/dist/routes-C4wrLWwu.mjs +0 -6
  76. package/dist/search-dialog-Bp_ouN1c.cjs +0 -550
  77. package/dist/search-dialog-an2BNMj6.js +0 -526
  78. package/dist/virtual-modules-B2X4Ht2r.mjs +0 -39
  79. package/dist/virtual-modules-DPsdHKcu.cjs +0 -39
@@ -1,526 +0,0 @@
1
- /**
2
- * Boltdocs - https://boltdocs.vercel.app
3
- * Copyright (c) 2026 Jesus Alcala
4
- * Licensed under the MIT License.
5
- */
6
- import { R as Search, V as X, W as useConfig, l as useRoutesContext, o as cn, q as useBoltdocsContext, u as normalizePath } from "./link-CgdI6O2o.js";
7
- import { E as useLocation, O as useNavigate } from "./router-CZBxMRAH.js";
8
- import { i as ErrorBoundary, n as Navbar, t as SearchDialog$1 } from "./search-dialog-BqkzDTq2.js";
9
- import { useCallback, useEffect, useMemo, useRef, useState } from "react";
10
- import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
11
- import fetchSearchData from "virtual:boltdocs-search";
12
-
13
- //#region src/client/hooks/use-routes.ts
14
- /**
15
- * Hook to access the framework's routing state.
16
- * Returns both the complete set of routes and a filtered list based on the current
17
- * version and locale.
18
- */
19
- function useRoutes() {
20
- const routeContext = useRoutesContext();
21
- const allRoutes = routeContext.routes;
22
- const routeIndex = routeContext.index || {
23
- byPath: new Map(allRoutes.map((route) => [normalizePath(route.path), route])),
24
- hintsByPath: /* @__PURE__ */ new Map(),
25
- collectionNames: []
26
- };
27
- const config = useConfig();
28
- const location = useLocation();
29
- const { pathname } = location;
30
- const { currentLocale: currentLocaleStore, currentVersion: currentVersionStore } = useBoltdocsContext();
31
- const currentPath = normalizePath(pathname);
32
- const currentRoute = useMemo(() => {
33
- const direct = routeIndex.byPath.get(currentPath);
34
- if (direct) return direct;
35
- const target = currentPath.split("/").filter(Boolean);
36
- if (target.length === 0) return void 0;
37
- let best;
38
- for (const [key, route] of routeIndex.byPath) {
39
- if (!route.collection) continue;
40
- const segments = key.split("/").filter(Boolean);
41
- if (segments.length === 0 || segments.length > target.length) continue;
42
- const offset = target.length - segments.length;
43
- if (segments.every((segment, i) => segment === target[offset + i]) && (!best || segments.length > best.depth)) best = {
44
- route,
45
- depth: segments.length
46
- };
47
- }
48
- return best?.route;
49
- }, [routeIndex, currentPath]);
50
- const pathParts = pathname.split("/").filter(Boolean);
51
- const urlLocale = config.i18n ? pathParts.find((part) => Array.isArray(config.i18n?.locales) ? config.i18n?.locales.includes(part) : part in (config.i18n?.locales || {})) : void 0;
52
- const currentLocale = config.i18n ? urlLocale || currentLocaleStore || config.i18n.defaultLocale : void 0;
53
- const configuredVersions = config.versions?.versions || [];
54
- const currentVersion = config.versions ? configuredVersions.some((version) => version.path === currentVersionStore) ? currentVersionStore : config.versions.defaultVersion : void 0;
55
- const routes = useMemo(() => {
56
- if (!allRoutes) return [];
57
- const alternateCounts = /* @__PURE__ */ new Map();
58
- const defaultLocale = config.i18n?.defaultLocale || "";
59
- const defaultVersion = config.versions?.defaultVersion || "";
60
- for (const r of allRoutes) {
61
- const locale = r.locale || defaultLocale;
62
- const version = r.version || defaultVersion;
63
- const key = `${r.filePath}::${locale}::${version}`;
64
- alternateCounts.set(key, (alternateCounts.get(key) || 0) + 1);
65
- }
66
- return allRoutes.filter((r) => {
67
- const localeMatch = config.i18n ? (r.locale || config.i18n.defaultLocale) === currentLocale : true;
68
- const versionMatch = config.versions ? (r.version || config.versions.defaultVersion) === currentVersion : true;
69
- if (!(localeMatch && versionMatch)) return false;
70
- const pathParts = pathname.split("/").filter(Boolean);
71
- const isCurrentLocalePrefixed = !!(config.i18n && pathParts.includes(currentLocaleStore || config.i18n.defaultLocale));
72
- const isCurrentVersionPrefixed = !!(config.versions && !!currentVersion && pathParts.includes(currentVersion));
73
- const isRouteLocalePrefixed = !!r.locale;
74
- const isRouteVersionPrefixed = !!r.version;
75
- const locale = r.locale || defaultLocale;
76
- const version = r.version || defaultVersion;
77
- const key = `${r.filePath}::${locale}::${version}`;
78
- if ((alternateCounts.get(key) || 0) > 1) {
79
- const localeMismatch = config.i18n && isCurrentLocalePrefixed !== isRouteLocalePrefixed;
80
- const versionMismatch = config.versions && isCurrentVersionPrefixed !== isRouteVersionPrefixed;
81
- if (localeMismatch || versionMismatch) return false;
82
- }
83
- return true;
84
- });
85
- }, [
86
- allRoutes,
87
- config,
88
- pathname,
89
- currentLocale,
90
- currentVersion,
91
- currentLocaleStore
92
- ]);
93
- const collections = useMemo(() => new Set(routeIndex.collectionNames), [routeIndex.collectionNames]);
94
- return {
95
- routes,
96
- allRoutes,
97
- currentRoute,
98
- isCollectionPage: !!currentRoute?.collection || location.pathname.split("/").filter(Boolean).some((segment) => collections.has(segment.toLowerCase())),
99
- currentLocale,
100
- currentVersion
101
- };
102
- }
103
-
104
- //#endregion
105
- //#region src/client/components/internal/error-boundary.tsx
106
- function InternalFallback({ error, resetErrorBoundary, className }) {
107
- return /* @__PURE__ */ jsxs("div", {
108
- role: "alert",
109
- className: cn("p-2 font-mono flex flex-col items-center justify-between min-h-[30vh]", className),
110
- children: [
111
- /* @__PURE__ */ jsx("p", {
112
- className: "text-lg font-semibold text-danger-500",
113
- children: "Something went wrong"
114
- }),
115
- error?.message && /* @__PURE__ */ jsx("pre", {
116
- className: "text-sm mt-2 max-w-md overflow-auto whitespace-pre-wrap break-word",
117
- children: error.message
118
- }),
119
- error?.stack && /* @__PURE__ */ jsxs("details", {
120
- className: "mt-2 max-w-md text-left text-xs",
121
- children: [/* @__PURE__ */ jsx("summary", {
122
- className: "cursor-pointer text-muted select-none outline-none",
123
- children: "Error details"
124
- }), /* @__PURE__ */ jsx("pre", {
125
- className: "mt-2 p-2 bg-soft rounded border-subtle border overflow-auto max-h-48 whitespace-pre-wrap break-words",
126
- children: error.stack
127
- })]
128
- }),
129
- /* @__PURE__ */ jsxs("div", {
130
- className: "flex items-center gap-2 mt-2",
131
- children: [/* @__PURE__ */ jsx("button", {
132
- type: "button",
133
- onClick: resetErrorBoundary,
134
- className: "px-2 py-3 bg-soft rounded border-subtle border font-mono font-semibold text-body hover:scale-105 transition-transform active:scale-95 cursor-pointer",
135
- children: "Try again"
136
- }), typeof window !== "undefined" && /* @__PURE__ */ jsx("button", {
137
- type: "button",
138
- onClick: () => window.location.reload(),
139
- className: "px-2 py-3 rounded font-mono font-semibold text-muted hover:text-body transition-colors cursor-pointer",
140
- children: "Reload page"
141
- })]
142
- })
143
- ]
144
- });
145
- }
146
- function InternalErrorBoundary({ children, fallback, resetKeys }) {
147
- return /* @__PURE__ */ jsx(ErrorBoundary, {
148
- fallback,
149
- resetKeys,
150
- FallbackComponent: !fallback ? InternalFallback : void 0,
151
- children
152
- });
153
- }
154
-
155
- //#endregion
156
- //#region src/client/hooks/use-search.ts
157
- function useSearch(routes) {
158
- const { currentLocale, currentVersion } = useRoutes();
159
- const config = useConfig();
160
- const algoliaConfig = config.integrations?.search?.algolia;
161
- const [isOpen, setIsOpen] = useState(false);
162
- const [query, setQuery] = useState("");
163
- const [index, setIndex] = useState(null);
164
- const [algoliaResults, setAlgoliaResults] = useState([]);
165
- const [searchData, setSearchData] = useState([]);
166
- const [searchDataLoading, setSearchDataLoading] = useState(false);
167
- const [searchDataError, setSearchDataError] = useState(null);
168
- const searchGeneration = useRef(0);
169
- const loadingGeneration = useRef(null);
170
- const navigate = useNavigate();
171
- useEffect(() => {
172
- if (algoliaConfig || !isOpen) return;
173
- if (searchData.length > 0) return;
174
- setSearchDataLoading(true);
175
- setSearchDataError(null);
176
- let active = true;
177
- const generation = ++searchGeneration.current;
178
- loadingGeneration.current = generation;
179
- fetchSearchData().then((data) => {
180
- if (!active || generation !== searchGeneration.current) return;
181
- setSearchData(data || []);
182
- if (loadingGeneration.current === generation) {
183
- loadingGeneration.current = null;
184
- setSearchDataLoading(false);
185
- }
186
- }).catch((err) => {
187
- if (!active || generation !== searchGeneration.current) return;
188
- console.error("[boltdocs] Failed to load search index:", err);
189
- setSearchDataError(err);
190
- if (loadingGeneration.current === generation) {
191
- loadingGeneration.current = null;
192
- setSearchDataLoading(false);
193
- }
194
- });
195
- return () => {
196
- active = false;
197
- };
198
- }, [
199
- isOpen,
200
- algoliaConfig,
201
- searchData.length
202
- ]);
203
- useEffect(() => {
204
- if (!import.meta.hot) return;
205
- const applyFrontmatterDelta = (payload) => {
206
- const updated = payload.search?.updated ?? [];
207
- const deleted = new Set(payload.search?.deleted ?? []);
208
- searchGeneration.current += 1;
209
- if (loadingGeneration.current !== null) {
210
- loadingGeneration.current = null;
211
- setSearchDataLoading(false);
212
- }
213
- setSearchData((prev) => {
214
- const map = new Map(prev.map((d) => [d.id, d]));
215
- for (const doc of updated) map.set(doc.id, doc);
216
- for (const id of deleted) map.delete(id);
217
- return Array.from(map.values());
218
- });
219
- setIndex(null);
220
- };
221
- const refreshFromAsset = async () => {
222
- const generation = ++searchGeneration.current;
223
- loadingGeneration.current = generation;
224
- setSearchDataLoading(true);
225
- try {
226
- const data = await fetchSearchData({ bustCache: true });
227
- if (generation !== searchGeneration.current) return;
228
- setSearchData(data || []);
229
- setSearchDataError(null);
230
- setIndex(null);
231
- } catch (error) {
232
- if (generation !== searchGeneration.current) return;
233
- console.error("[boltdocs] Failed to refresh search index:", error);
234
- setSearchDataError(error instanceof Error ? error : new Error(String(error)));
235
- } finally {
236
- if (generation === searchGeneration.current) {
237
- loadingGeneration.current = null;
238
- setSearchDataLoading(false);
239
- }
240
- }
241
- };
242
- const hot = import.meta.hot;
243
- hot.on("boltdocs:frontmatter-update", applyFrontmatterDelta);
244
- hot.on("boltdocs:mdx-update", refreshFromAsset);
245
- return () => {
246
- hot.off?.("boltdocs:frontmatter-update", applyFrontmatterDelta);
247
- hot.off?.("boltdocs:mdx-update", refreshFromAsset);
248
- };
249
- }, []);
250
- useEffect(() => {
251
- const handleKeyDown = (e) => {
252
- if ((/Mac/.test(navigator.userAgent) ? e.metaKey : e.ctrlKey) && (e.key === "k" || e.key === "j")) {
253
- e.preventDefault();
254
- setIsOpen((prev) => !prev);
255
- }
256
- };
257
- window.addEventListener("keydown", handleKeyDown);
258
- return () => window.removeEventListener("keydown", handleKeyDown);
259
- }, []);
260
- const handleSelect = useCallback((key) => {
261
- const path = String(key);
262
- if (!path) return;
263
- setIsOpen(false);
264
- const url = new URL(path, window.location.origin);
265
- if (query) url.searchParams.set("hl", query);
266
- navigate(`${url.pathname}${url.search}${url.hash}`);
267
- }, [navigate, query]);
268
- useEffect(() => {
269
- if (algoliaConfig) return;
270
- if (!isOpen || searchData.length === 0 || index) return;
271
- let cancelled = false;
272
- import("flexsearch").then(({ Index: FlexIndex }) => {
273
- if (cancelled) return;
274
- const newIndex = new FlexIndex({
275
- tokenize: "forward",
276
- cache: true
277
- });
278
- for (let i = 0; i < searchData.length; i++) {
279
- const doc = searchData[i];
280
- if (!doc) continue;
281
- newIndex.add(i, `${doc.title} ${doc.content}`);
282
- }
283
- setIndex(newIndex);
284
- }).catch((err) => {
285
- console.error("[boltdocs] Failed to load search engine:", err);
286
- });
287
- return () => {
288
- cancelled = true;
289
- };
290
- }, [
291
- isOpen,
292
- index,
293
- algoliaConfig,
294
- searchData
295
- ]);
296
- useEffect(() => {
297
- if (!algoliaConfig) return;
298
- if (!query) {
299
- setAlgoliaResults([]);
300
- return;
301
- }
302
- const delayDebounceFn = setTimeout(async () => {
303
- try {
304
- const url = `https://${algoliaConfig.appId}-dsn.algolia.net/1/indexes/${algoliaConfig.indexName}/query`;
305
- const facetFilters = [];
306
- if (currentLocale) facetFilters.push(`lang:${currentLocale}`);
307
- if (currentVersion) facetFilters.push(`version:${currentVersion}`);
308
- let params = `query=${encodeURIComponent(query)}&hitsPerPage=20`;
309
- if (facetFilters.length > 0) params += `&facetFilters=${encodeURIComponent(JSON.stringify(facetFilters))}`;
310
- const response = await fetch(url, {
311
- method: "POST",
312
- headers: {
313
- "Content-Type": "application/json",
314
- "X-Algolia-API-Key": algoliaConfig.apiKey,
315
- "X-Algolia-Application-Id": algoliaConfig.appId
316
- },
317
- body: JSON.stringify({ params })
318
- });
319
- if (!response.ok) throw new Error(`Algolia search request failed: ${response.statusText}`);
320
- setAlgoliaResults(((await response.json()).hits || []).map((hit) => {
321
- let path = hit.url || "";
322
- try {
323
- if (path.startsWith("http://") || path.startsWith("https://")) {
324
- const urlObj = new URL(path);
325
- path = urlObj.pathname + urlObj.search + urlObj.hash;
326
- }
327
- } catch {}
328
- const hierarchy = hit.hierarchy || {};
329
- const levels = [
330
- hierarchy.lvl0,
331
- hierarchy.lvl1,
332
- hierarchy.lvl2,
333
- hierarchy.lvl3,
334
- hierarchy.lvl4,
335
- hierarchy.lvl5,
336
- hierarchy.lvl6
337
- ].filter(Boolean);
338
- const title = levels[levels.length - 1] || "Documentation";
339
- const bio = levels.join(" > ");
340
- return {
341
- id: hit.objectID || path,
342
- title,
343
- path,
344
- bio,
345
- groupTitle: hierarchy.lvl0 || "Docs",
346
- isHeading: !!hit.anchor || path.includes("#")
347
- };
348
- }));
349
- } catch (err) {
350
- console.error("Error fetching search results from Algolia:", err);
351
- }
352
- }, 250);
353
- return () => clearTimeout(delayDebounceFn);
354
- }, [
355
- query,
356
- algoliaConfig,
357
- currentLocale,
358
- currentVersion
359
- ]);
360
- return {
361
- isOpen,
362
- setIsOpen,
363
- query,
364
- setQuery,
365
- list: useMemo(() => {
366
- if (!query) return routes.filter((r) => {
367
- const routeLocale = r.locale || config.i18n?.defaultLocale;
368
- const routeVersion = r.version || config.versions?.defaultVersion;
369
- return (!currentLocale || routeLocale === currentLocale) && (!currentVersion || routeVersion === currentVersion);
370
- }).slice(0, 10).map((r) => ({
371
- id: r.path,
372
- title: r.title,
373
- path: r.path,
374
- bio: r.description || "",
375
- groupTitle: r.groupTitle
376
- }));
377
- if (algoliaConfig) return algoliaResults;
378
- if (!index) return [];
379
- const searchResults = index.search(query, {
380
- limit: 20,
381
- suggest: true
382
- });
383
- const results = [];
384
- const seen = /* @__PURE__ */ new Set();
385
- for (const id of searchResults) {
386
- const doc = searchData[typeof id === "number" ? id : Number(id)];
387
- if (!doc) continue;
388
- const docLocale = doc.locale || config.i18n?.defaultLocale;
389
- const docVersion = doc.version || config.versions?.defaultVersion;
390
- const localeMatch = !currentLocale || docLocale === currentLocale || !doc.locale && currentLocale === config.i18n?.defaultLocale;
391
- if (!(!currentVersion || docVersion === currentVersion)) continue;
392
- if (seen.has(doc.url)) continue;
393
- seen.add(doc.url);
394
- results.push({
395
- id: doc.url,
396
- title: doc.title,
397
- path: doc.url,
398
- bio: doc.display,
399
- groupTitle: doc.display.split(" > ")[0],
400
- isHeading: doc.url.includes("#"),
401
- localeMatch
402
- });
403
- }
404
- return results.filter((result) => result.localeMatch).slice(0, 10);
405
- }, [
406
- query,
407
- index,
408
- currentLocale,
409
- currentVersion,
410
- routes,
411
- searchData,
412
- algoliaConfig,
413
- algoliaResults,
414
- config
415
- ]),
416
- searchDataLoading,
417
- searchDataError,
418
- handleSelect,
419
- input: {
420
- value: query,
421
- onChange: (e) => setQuery(e.target.value)
422
- }
423
- };
424
- }
425
-
426
- //#endregion
427
- //#region src/client/components/ui-base/search-dialog.tsx
428
- function Highlight({ text, query, markClassName }) {
429
- if (!query || !text) return /* @__PURE__ */ jsx(Fragment$1, { children: text });
430
- const escapedQuery = query.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
431
- const regex = new RegExp(`(${escapedQuery})`, "gi");
432
- return /* @__PURE__ */ jsx(Fragment$1, { children: text.split(regex).map((part, i) => regex.test(part) ? /* @__PURE__ */ jsx("mark", {
433
- className: cn("bg-primary-500/20 text-primary-600 dark:text-primary-400 font-bold px-0.5 rounded-sm", markClassName),
434
- children: part
435
- }, i) : part) });
436
- }
437
- function SearchDialog({ routes, className, markClassName }) {
438
- const { isOpen, setIsOpen, query, setQuery, list, searchDataLoading, searchDataError, handleSelect } = useSearch(routes);
439
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [
440
- /* @__PURE__ */ jsxs(Navbar.SearchTrigger.Desktop, {
441
- onPress: () => setIsOpen(true),
442
- className: "rounded-xl border border-subtle bg-surface text-muted transition-all duration-200 hover:border-primary-500/50 hover:text-body hover:bg-soft/50 hover:shadow-sm active:scale-[0.98] focus-visible:ring-2 focus-visible:ring-primary-500/30",
443
- children: [/* @__PURE__ */ jsxs("div", {
444
- className: "flex items-center gap-2",
445
- children: [/* @__PURE__ */ jsx(Search, { size: 16 }), /* @__PURE__ */ jsx("span", {
446
- className: "hidden sm:inline-block",
447
- children: "Search docs..."
448
- })]
449
- }), /* @__PURE__ */ jsx(Navbar.SearchTrigger.Kbd, { className: "[&_kbd]:bg-main [&_kbd]:border [&_kbd]:border-subtle [&_kbd]:rounded [&_kbd]:px-1.5 [&_kbd]:h-5 [&_kbd]:w-5" })]
450
- }),
451
- /* @__PURE__ */ jsx(Navbar.SearchTrigger.Mobile, {
452
- onPress: () => setIsOpen(true),
453
- className: "rounded-xl text-muted transition-all duration-200 hover:text-body active:scale-95 focus-visible:ring-2 focus-visible:ring-primary-500/30",
454
- children: /* @__PURE__ */ jsx(Search, { size: 20 })
455
- }),
456
- /* @__PURE__ */ jsx(InternalErrorBoundary, { children: /* @__PURE__ */ jsx(SearchDialog$1.Overlay, {
457
- isOpen,
458
- isDismissable: true,
459
- onOpenChange: () => setIsOpen(false),
460
- className: cn("fixed inset-0 z-100 flex items-center justify-center p-4 bg-black/40 backdrop-blur-xs animate-fade-in", className),
461
- children: /* @__PURE__ */ jsx(SearchDialog$1.Content, {
462
- className: "w-full max-w-lg bg-main border border-subtle shadow-md rounded-2xl overflow-hidden p-6",
463
- children: /* @__PURE__ */ jsx(SearchDialog$1.Dialog, {
464
- "aria-label": "Search documentation",
465
- className: "flex flex-col min-h-0 h-[450px]",
466
- children: /* @__PURE__ */ jsxs(SearchDialog$1.Autocomplete, {
467
- className: "flex flex-col min-h-0",
468
- children: [/* @__PURE__ */ jsxs(SearchDialog$1.Input, {
469
- value: query,
470
- onChange: setQuery,
471
- className: "flex items-center gap-2 border border-subtle bg-surface px-4 py-2.5 rounded-xl focus-within:border-primary-500 mb-4",
472
- children: [/* @__PURE__ */ jsx(SearchDialog$1.Input.SearchInput, {
473
- placeholder: "Search documentation...",
474
- className: "w-full bg-transparent outline-none text-body text-sm"
475
- }), query && /* @__PURE__ */ jsx(SearchDialog$1.Input.Button, {
476
- onPress: () => setQuery(""),
477
- className: "text-muted hover:text-body hover:bg-surface rounded-md p-1 cursor-pointer select-none transition-colors",
478
- children: /* @__PURE__ */ jsx(X, { size: 16 })
479
- })]
480
- }), searchDataLoading ? /* @__PURE__ */ jsx("div", {
481
- className: "flex flex-1 items-center justify-center px-4 py-8 text-sm text-muted",
482
- children: "Loading search index…"
483
- }) : searchDataError ? /* @__PURE__ */ jsx("div", {
484
- className: "flex flex-1 items-center justify-center px-4 py-8 text-center text-sm text-muted",
485
- children: "Search is temporarily unavailable."
486
- }) : query && list.length === 0 ? /* @__PURE__ */ jsx("div", {
487
- className: "flex flex-1 items-center justify-center px-4 py-8 text-sm text-muted",
488
- children: "No results found."
489
- }) : /* @__PURE__ */ jsx(SearchDialog$1.List, {
490
- items: list,
491
- onAction: handleSelect,
492
- children: (item) => /* @__PURE__ */ jsxs(SearchDialog$1.Item, {
493
- textValue: item.title,
494
- className: "flex items-center gap-3 px-4 py-2 rounded-xl group dark:hover:bg-primary-300/40 hover:bg-primary-200/50 transition-colors duration-100",
495
- children: [/* @__PURE__ */ jsx(SearchDialog$1.Item.Icon, {
496
- isHeading: item.isHeading,
497
- className: "text-muted group-hover:text-primary-500 group-focus:text-primary-500"
498
- }), /* @__PURE__ */ jsxs("div", {
499
- className: "flex flex-col justify-center min-w-0",
500
- children: [/* @__PURE__ */ jsx(SearchDialog$1.Item.Title, {
501
- className: "text-sm font-medium text-body truncate dark:group-hover:text-primary-100",
502
- children: /* @__PURE__ */ jsx(Highlight, {
503
- text: item.title,
504
- query,
505
- markClassName
506
- })
507
- }), /* @__PURE__ */ jsx(SearchDialog$1.Item.Bio, {
508
- className: "text-xs text-muted truncate",
509
- children: /* @__PURE__ */ jsx(Highlight, {
510
- text: item.bio,
511
- query,
512
- markClassName
513
- })
514
- })]
515
- })]
516
- }, item.id)
517
- })]
518
- })
519
- })
520
- })
521
- }) })
522
- ] });
523
- }
524
-
525
- //#endregion
526
- export { useRoutes as i, useSearch as n, InternalErrorBoundary as r, SearchDialog as t };
@@ -1,39 +0,0 @@
1
- /**
2
- * Boltdocs - https://boltdocs.vercel.app
3
- * Copyright (c) 2026 Jesus Alcala
4
- * Licensed under the MIT License.
5
- */
6
- import{_ as e,g as t,h as n}from"./plugin-context-DuSg-Hax.mjs";import{u as r}from"./utils-8lzafE49.mjs";import{c as i,l as a,s as o,t as s}from"./routes-C4wrLWwu.mjs";import c from"node:path";import l from"node:fs";function u(e){return typeof e==`string`?[e]:Array.isArray(e)?e.flatMap(u):e&&typeof e==`object`?Object.values(e).flatMap(u):[]}const d=new Set([`title`,`description`,`permalink`,`sidebarPosition`,`sidebarLabel`,`sidebarHidden`,`hidden`,`category`,`order`,`badge`,`icon`,`date`,`lastUpdated`,`groupTitle`,`groupPosition`,`seo`]);function f(e){let t=[];for(let n of e){let e=``;n.frontmatter&&(e=u(Object.entries(n.frontmatter).filter(([e])=>!d.has(e)).map(([e,t])=>t)).join(` `));let r=(e?`${n._content||``} ${e}`:n._content||``).slice(0,500);if(t.push({id:n.path,title:n.title,content:r,url:n.path,display:n.groupTitle?`${n.groupTitle} > ${n.title}`:n.title,locale:n.locale,version:n.version}),n.headings)for(let e of n.headings)t.push({id:`${n.path}#${e.id}`,title:e.text,content:`${e.text} in ${n.title}`,url:`${n.path}#${e.id}`,display:`${n.title} > ${e.text}`,locale:n.locale,version:n.version})}return t}function p(e){return{path:e.path,filePath:e.filePath,title:e.title,description:e.description||``,sidebarPosition:e.sidebarPosition,badge:e.badge,icon:e.icon,headings:e.headings||[],frontmatter:e.frontmatter,locale:e.locale,version:e.version,tab:e.tab,collection:e.collection,tags:e.tags,author:e.author,draft:e.draft,excerpt:e.excerpt,coverImage:e.coverImage,group:e.group,groupTitle:e.groupTitle,groupPosition:e.groupPosition,groupIcon:e.groupIcon,subRouteGroup:e.subRouteGroup,seo:e.seo,date:e.date,lastUpdated:e.lastUpdated,category:e.category,order:e.order,sidebarLabel:e.sidebarLabel,sidebarHidden:e.sidebarHidden,slugParts:e.slugParts}}function m(e){return{routeCacheContext:e,routeGenerationFingerprint:void 0,directoryMetaCache:null,routesDataMap:new Map,collectionsDataMap:new Map,searchDataMap:new Map}}const h=m();function g(e){return e??h}function _(e){let t=g(e);t.directoryMetaCache=null,t.routeGenerationFingerprint=void 0,t.routeCacheVariant=void 0,t.routesDataMap.clear(),t.collectionsDataMap.clear(),t.searchDataMap.clear()}function v(e,t){return(!t.routeCacheContext||t.routeCacheContext.disposed)&&(t.routeCacheContext=o(e),t.routeCacheVariant=void 0,t.routeGenerationFingerprint=void 0,t.routesDataMap.clear(),t.collectionsDataMap.clear(),t.searchDataMap.clear()),t.routeCacheContext}async function y(e,t,n,r){let o=g(n),c=v(e,o),l=a(t),u=(r?.fingerprint===l&&c.variants.get(l)===r?r:void 0)??i(c,l);o.routeCacheVariant=u,o.routeGenerationFingerprint=l;let d=await s(e,t,void 0,!1,c,u);o.routesDataMap.clear();for(let e of d)o.routesDataMap.set(e.path,e);b(o)}function b(e){let t=g(e),n=Array.from(t.routesDataMap.values()),r=f(n);t.searchDataMap.clear();for(let e of r)t.searchDataMap.set(e.id,e);t.collectionsDataMap.clear();for(let e of n)if(e.collection){let n={path:e.path,title:e.title,date:e.date,excerpt:e.excerpt,tags:e.tags,author:e.author,coverImage:e.coverImage,filePath:e.filePath,locale:e.locale,version:e.version,frontmatter:e.frontmatter,draft:e.frontmatter?.draft,collection:e.collection};t.collectionsDataMap.set(e.filePath,n)}}async function x(e,t,n){let r=g(n);v(e,r);let i=a(t);(r.routesDataMap.size===0||r.routeGenerationFingerprint!==i)&&(r.routesDataMap.clear(),r.collectionsDataMap.clear(),r.searchDataMap.clear(),await y(e,t,r))}function S(e){let t=g(e),n={},r=Array.from(t.collectionsDataMap.values()).sort((e,t)=>{let n=e=>{if(!e)return-1/0;let t=new Date(e).getTime();return Number.isFinite(t)?t:-1/0},r=n(e.date),i=n(t.date)-r;return i===0?e.path.localeCompare(t.path):i});for(let e of r){let t=e.collection;t&&(n[t]||(n[t]=[]),n[t].push(e))}return n}function C(e,t=e=>e){let n=Array.from(e.values(),t).sort((e,t)=>{let n=e=>{if(typeof e!=`object`||!e)return String(e);let t=e;return`${String(t.path||``)}\u0000${String(t.id||``)}\u0000${String(t.filePath||``)}`};return n(e).localeCompare(n(t))});return`export default ${JSON.stringify(n)};`}function w(e){return Array.from(g(e).searchDataMap.values()).sort((e,t)=>e.id.localeCompare(t.id))}function T(e){return`export default ${JSON.stringify(e)};`}async function E(e,t,n,r,i){let o=g(n);r&&(o.routeCacheContext=r),i&&(o.routeCacheVariant=i);let s=a(t);o.routeGenerationFingerprint!==s&&(o.routesDataMap.clear(),o.collectionsDataMap.clear(),o.searchDataMap.clear());let c=new Map(o.routesDataMap),l=new Map(o.collectionsDataMap),u=new Map(o.searchDataMap);await y(e,t,o);let d={routes:{updated:[],deleted:[]},collections:{updated:[],deleted:[]},search:{updated:[],deleted:[]}};for(let[e,t]of o.routesDataMap){let n=c.get(e);(!n||JSON.stringify(n)!==JSON.stringify(t))&&d.routes.updated.push(p(t))}for(let e of c.keys())o.routesDataMap.has(e)||d.routes.deleted.push(e);for(let[e,t]of o.collectionsDataMap){let n=l.get(e);(!n||JSON.stringify(n)!==JSON.stringify(t))&&d.collections.updated.push(t)}for(let e of l.keys())o.collectionsDataMap.has(e)||d.collections.deleted.push(e);for(let[e,t]of o.searchDataMap){let n=u.get(e);(!n||JSON.stringify(n)!==JSON.stringify(t))&&d.search.updated.push(t)}for(let e of u.keys())o.searchDataMap.has(e)||d.search.deleted.push(e);return d}function D(i,a,o,s,u,d){let f=u?.virtualModuleRegistry??n,m=g(d);return{name:`vite-plugin-boltdocs-virtual-modules`,resolveId(e){if(o()?.root||process.cwd(),e.includes(`boltdocs-entry`)||e===`virtual:boltdocs-entry`||e===`boltdocs/entry`||e===`boltdocs-entry`||e===`\0virtual:boltdocs-entry`||e===`\0virtual:boltdocs-entry.tsx`)return`\0virtual:boltdocs-entry.tsx`;if(e.includes(`boltdocs-client`)||e===`virtual:boltdocs-client`||e===`boltdocs/client`||e===`boltdocs-client`||e===`\0virtual:boltdocs-client.mjs`)return`\0virtual:boltdocs-client.mjs`;if(e.startsWith(`\0`)){let t=e.slice(1);if(!t.startsWith(`virtual:boltdocs-`)&&f?.has(t))return e}else if(!e.startsWith(`virtual:boltdocs-`)&&f?.has(e))return`\0`+e;return e.startsWith(`virtual:boltdocs-`)?`\0`+e:e.startsWith(`\0virtual:boltdocs-`)?e:null},async load(n,u){let d=a(),h=n.startsWith(`\0`)?n.slice(1):n;if(!h.includes(`boltdocs-entry.tsx`)&&!h.includes(`boltdocs-client.mjs`)&&!h.startsWith(`virtual:boltdocs-`)&&f?.has(h)){let e=f?.get(h);if(!e)return null;try{let t=await e.loader();if(typeof t!=`string`)throw Error(`[boltdocs] Plugin virtual module '${h}' loader must return a string source code, got ${typeof t}.`);return t}catch(e){throw Error(`[boltdocs] Plugin virtual module '${h}' failed to load: ${e instanceof Error?e.message:String(e)}`)}}if(n.includes(`boltdocs-entry.tsx`)||n===`\0virtual:boltdocs-entry`){let e=this.environment?.config?.consumer,n=o(),r=e===void 0?!!n?.build?.ssr:e!==`client`;return t({...i,ssr:r,useCompiledPages:n?.command===`build`},d)}if(n.includes(`boltdocs-client.mjs`)||n===`\0virtual:boltdocs-client.ts`||n===`virtual:boltdocs-client`){let t=e,n=t;for(;t!==c.parse(t).root;){if(l.existsSync(c.join(t,`package.json`))&&JSON.parse(l.readFileSync(c.join(t,`package.json`),`utf-8`)).name===`boltdocs`){n=t;break}t=c.dirname(t)}let i=c.join(n,`src/client/index.ts`),a=c.join(n,`dist/client/index.js`);return`export * from '${r(l.existsSync(i)?i:a)}';`}if(!n.startsWith(`\0virtual:boltdocs-`))return;let g=n.replace(`\0virtual:boltdocs-`,``).replace(/\.tsx?$/,``);if(g===`routes`)return await x(s,d,m),C(m.routesDataMap,p);if(g===`collections`)return await x(s,d,m),T(S(m));if(g===`config`){await x(s,d,m);let e=m.routeCacheVariant?.directoryMeta||{};m.directoryMetaCache=e;let t=[...new Set(Array.from(m.routesDataMap.values()).map(e=>e.collection).filter(e=>!!e))].sort((e,t)=>e.localeCompare(t)),n=d?.collections,r=n?{...n,labels:{...n.labels||{},...Object.fromEntries(t.map(e=>[e,n.labels?.[e]??e]))}}:t.length>0?t:void 0,i={base:d?.base,theme:d?.theme,i18n:d?.i18n,versions:d?.versions,siteUrl:d?.siteUrl,integrations:d?.integrations,collections:r,seo:d?.seo,experimental:d?.experimental,plugins:d?.plugins?.map(e=>({name:e.name})),directoryMeta:e};return`export default ${JSON.stringify(i,null,2)};`}if(g===`entry`){let e=this,n=o(),r=e.environment?.config?.consumer,a=r===void 0?!!(u?.ssr??n?.build?.ssr):r!==`client`;return t({...i,ssr:a,useCompiledPages:n?.command===`build`},d)}if(g===`mdx-components`){let e=[`tsx`,`ts`,`jsx`,`js`],t=null;for(let n of e){let e=c.resolve(s,`mdx-components.${n}`);if(l.existsSync(e)){t=e;break}}let n={};if(d?.plugins)for(let e of d.plugins)e.components&&Object.assign(n,e.components);let i=Object.entries(n),a=i.map(([e,t],n)=>`import * as _pluginCompMod_${n} from '${t}';`).join(`
7
- `),o=i.map(([e],t)=>`${JSON.stringify(e)}: _pluginCompMod_${t}[${JSON.stringify(e)}] || _pluginCompMod_${t}["default"] || _pluginCompMod_${t}`).join(`,
8
- `);if(t){let e=r(t);return`${a}
9
- import * as components from '${e}';
10
- const userMdxComponents = components.default || components;
11
- const mdxComponents = {
12
- ${o}${o?`,`:``}
13
- ...userMdxComponents,
14
- };
15
- export default mdxComponents;
16
- export * from '${e}';`}return`${a}
17
- const mdxComponents = {
18
- ${o}
19
- };
20
- export default mdxComponents;`}if(g===`layout`){let e=[`tsx`,`jsx`],t=null;for(let n of e){let e=c.resolve(s,`layout.${n}`);if(l.existsSync(e)){t=e;break}}if(t)return`import UserLayout from '${r(t)}';
21
- export default UserLayout;`;throw Error(`[Boltdocs] Layout file not found. A 'layout.tsx' or 'layout.jsx' file is mandatory in your docs directory. Please create one to define your site structure.`)}if(g===`icons`){let e=[`tsx`,`jsx`,`ts`,`js`],t=null;for(let n of e){let e=c.resolve(s,`icons.${n}`);if(l.existsSync(e)){t=e;break}}return t?`import * as icons from '${r(t)}';\nexport default icons;`:`export default {};`}if(g===`search`)return await x(s,d,m),`export default async function fetchSearchData(options = {}) {
22
- const base = import.meta.env.BASE_URL || '/';
23
- const origin = typeof window !== 'undefined' ? window.location.origin : 'http://localhost';
24
- const basePath = base.endsWith('/') ? base : base + '/';
25
- const url = new URL('search.json', new URL(basePath, origin));
26
- if (options.bustCache) url.searchParams.set('t', String(Date.now()));
27
- const res = await fetch(url, { cache: options.bustCache ? 'no-store' : 'default' });
28
- if (!res.ok) throw new Error('Failed to fetch search index');
29
- return res.json();
30
- }`;if(g===`page-source`){await x(s,d,m);let e={};for(let t of m.routesDataMap.values())t.path&&t._rawContent&&(e[t.path]=t._rawContent);return`export default async function fetchPageSource(options = {}) {
31
- const base = import.meta.env.BASE_URL || '/';
32
- const origin = typeof window !== 'undefined' ? window.location.origin : 'http://localhost';
33
- const basePath = base.endsWith('/') ? base : base + '/';
34
- const url = new URL('page-source.json', new URL(basePath, origin));
35
- if (options.bustCache) url.searchParams.set('t', String(Date.now()));
36
- const res = await fetch(url, { cache: options.bustCache ? 'no-store' : 'default' });
37
- if (!res.ok) throw new Error('Failed to fetch page source');
38
- return res.json();
39
- }`}if(g===`client`){let t=e,n=``;for(;t&&t!==c.parse(t).root;){let e=c.join(t,`src/client/index.ts`),i=c.join(t,`dist/client/index.mjs`),a=c.join(t,`client/index.ts`);if(l.existsSync(e)){n=r(e);break}if(l.existsSync(i)){n=r(i);break}if(l.existsSync(a)){n=r(a);break}t=c.dirname(t)}if(!n)throw Error(`[boltdocs] Could not resolve boltdocs/client entry point starting from ${e}`);return`export * from '${n}';`}}}}export{E as computeFrontmatterDelta,m as createVirtualModuleState,D as createVirtualModulesPlugin,w as getSearchDataExport,_ as invalidateDirectoryMetaCache};
@@ -1,39 +0,0 @@
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(`./utils-ej6_SjIZ.cjs`),n=require(`./plugin-context-CscLcXjH.cjs`),r=require(`./routes-C0kb4ue6.cjs`);let i=require(`node:path`);i=e.r(i);let a=require(`node:fs`);a=e.r(a);function o(e){return typeof e==`string`?[e]:Array.isArray(e)?e.flatMap(o):e&&typeof e==`object`?Object.values(e).flatMap(o):[]}const s=new Set([`title`,`description`,`permalink`,`sidebarPosition`,`sidebarLabel`,`sidebarHidden`,`hidden`,`category`,`order`,`badge`,`icon`,`date`,`lastUpdated`,`groupTitle`,`groupPosition`,`seo`]);function c(e){let t=[];for(let n of e){let e=``;n.frontmatter&&(e=o(Object.entries(n.frontmatter).filter(([e])=>!s.has(e)).map(([e,t])=>t)).join(` `));let r=(e?`${n._content||``} ${e}`:n._content||``).slice(0,500);if(t.push({id:n.path,title:n.title,content:r,url:n.path,display:n.groupTitle?`${n.groupTitle} > ${n.title}`:n.title,locale:n.locale,version:n.version}),n.headings)for(let e of n.headings)t.push({id:`${n.path}#${e.id}`,title:e.text,content:`${e.text} in ${n.title}`,url:`${n.path}#${e.id}`,display:`${n.title} > ${e.text}`,locale:n.locale,version:n.version})}return t}function l(e){return{path:e.path,filePath:e.filePath,title:e.title,description:e.description||``,sidebarPosition:e.sidebarPosition,badge:e.badge,icon:e.icon,headings:e.headings||[],frontmatter:e.frontmatter,locale:e.locale,version:e.version,tab:e.tab,collection:e.collection,tags:e.tags,author:e.author,draft:e.draft,excerpt:e.excerpt,coverImage:e.coverImage,group:e.group,groupTitle:e.groupTitle,groupPosition:e.groupPosition,groupIcon:e.groupIcon,subRouteGroup:e.subRouteGroup,seo:e.seo,date:e.date,lastUpdated:e.lastUpdated,category:e.category,order:e.order,sidebarLabel:e.sidebarLabel,sidebarHidden:e.sidebarHidden,slugParts:e.slugParts}}function u(e){return{routeCacheContext:e,routeGenerationFingerprint:void 0,directoryMetaCache:null,routesDataMap:new Map,collectionsDataMap:new Map,searchDataMap:new Map}}const d=u();function f(e){return e??d}function p(e){let t=f(e);t.directoryMetaCache=null,t.routeGenerationFingerprint=void 0,t.routeCacheVariant=void 0,t.routesDataMap.clear(),t.collectionsDataMap.clear(),t.searchDataMap.clear()}function m(e,t){return(!t.routeCacheContext||t.routeCacheContext.disposed)&&(t.routeCacheContext=r.s(e),t.routeCacheVariant=void 0,t.routeGenerationFingerprint=void 0,t.routesDataMap.clear(),t.collectionsDataMap.clear(),t.searchDataMap.clear()),t.routeCacheContext}async function h(e,t,n,i){let a=f(n),o=m(e,a),s=r.l(t),c=(i?.fingerprint===s&&o.variants.get(s)===i?i:void 0)??r.c(o,s);a.routeCacheVariant=c,a.routeGenerationFingerprint=s;let l=await r.t(e,t,void 0,!1,o,c);a.routesDataMap.clear();for(let e of l)a.routesDataMap.set(e.path,e);g(a)}function g(e){let t=f(e),n=Array.from(t.routesDataMap.values()),r=c(n);t.searchDataMap.clear();for(let e of r)t.searchDataMap.set(e.id,e);t.collectionsDataMap.clear();for(let e of n)if(e.collection){let n={path:e.path,title:e.title,date:e.date,excerpt:e.excerpt,tags:e.tags,author:e.author,coverImage:e.coverImage,filePath:e.filePath,locale:e.locale,version:e.version,frontmatter:e.frontmatter,draft:e.frontmatter?.draft,collection:e.collection};t.collectionsDataMap.set(e.filePath,n)}}async function _(e,t,n){let i=f(n);m(e,i);let a=r.l(t);(i.routesDataMap.size===0||i.routeGenerationFingerprint!==a)&&(i.routesDataMap.clear(),i.collectionsDataMap.clear(),i.searchDataMap.clear(),await h(e,t,i))}function v(e){let t=f(e),n={},r=Array.from(t.collectionsDataMap.values()).sort((e,t)=>{let n=e=>{if(!e)return-1/0;let t=new Date(e).getTime();return Number.isFinite(t)?t:-1/0},r=n(e.date),i=n(t.date)-r;return i===0?e.path.localeCompare(t.path):i});for(let e of r){let t=e.collection;t&&(n[t]||(n[t]=[]),n[t].push(e))}return n}function y(e,t=e=>e){let n=Array.from(e.values(),t).sort((e,t)=>{let n=e=>{if(typeof e!=`object`||!e)return String(e);let t=e;return`${String(t.path||``)}\u0000${String(t.id||``)}\u0000${String(t.filePath||``)}`};return n(e).localeCompare(n(t))});return`export default ${JSON.stringify(n)};`}function b(e){return Array.from(f(e).searchDataMap.values()).sort((e,t)=>e.id.localeCompare(t.id))}function x(e){return`export default ${JSON.stringify(e)};`}async function S(e,t,n,i,a){let o=f(n);i&&(o.routeCacheContext=i),a&&(o.routeCacheVariant=a);let s=r.l(t);o.routeGenerationFingerprint!==s&&(o.routesDataMap.clear(),o.collectionsDataMap.clear(),o.searchDataMap.clear());let c=new Map(o.routesDataMap),u=new Map(o.collectionsDataMap),d=new Map(o.searchDataMap);await h(e,t,o);let p={routes:{updated:[],deleted:[]},collections:{updated:[],deleted:[]},search:{updated:[],deleted:[]}};for(let[e,t]of o.routesDataMap){let n=c.get(e);(!n||JSON.stringify(n)!==JSON.stringify(t))&&p.routes.updated.push(l(t))}for(let e of c.keys())o.routesDataMap.has(e)||p.routes.deleted.push(e);for(let[e,t]of o.collectionsDataMap){let n=u.get(e);(!n||JSON.stringify(n)!==JSON.stringify(t))&&p.collections.updated.push(t)}for(let e of u.keys())o.collectionsDataMap.has(e)||p.collections.deleted.push(e);for(let[e,t]of o.searchDataMap){let n=d.get(e);(!n||JSON.stringify(n)!==JSON.stringify(t))&&p.search.updated.push(t)}for(let e of d.keys())o.searchDataMap.has(e)||p.search.deleted.push(e);return p}function C(e,r,o,s,c,u){let d=c?.virtualModuleRegistry??n.h,p=f(u);return{name:`vite-plugin-boltdocs-virtual-modules`,resolveId(e){if(o()?.root||process.cwd(),e.includes(`boltdocs-entry`)||e===`virtual:boltdocs-entry`||e===`boltdocs/entry`||e===`boltdocs-entry`||e===`\0virtual:boltdocs-entry`||e===`\0virtual:boltdocs-entry.tsx`)return`\0virtual:boltdocs-entry.tsx`;if(e.includes(`boltdocs-client`)||e===`virtual:boltdocs-client`||e===`boltdocs/client`||e===`boltdocs-client`||e===`\0virtual:boltdocs-client.mjs`)return`\0virtual:boltdocs-client.mjs`;if(e.startsWith(`\0`)){let t=e.slice(1);if(!t.startsWith(`virtual:boltdocs-`)&&d?.has(t))return e}else if(!e.startsWith(`virtual:boltdocs-`)&&d?.has(e))return`\0`+e;return e.startsWith(`virtual:boltdocs-`)?`\0`+e:e.startsWith(`\0virtual:boltdocs-`)?e:null},async load(c,u){let f=r(),m=c.startsWith(`\0`)?c.slice(1):c;if(!m.includes(`boltdocs-entry.tsx`)&&!m.includes(`boltdocs-client.mjs`)&&!m.startsWith(`virtual:boltdocs-`)&&d?.has(m)){let e=d?.get(m);if(!e)return null;try{let t=await e.loader();if(typeof t!=`string`)throw Error(`[boltdocs] Plugin virtual module '${m}' loader must return a string source code, got ${typeof t}.`);return t}catch(e){throw Error(`[boltdocs] Plugin virtual module '${m}' failed to load: ${e instanceof Error?e.message:String(e)}`)}}if(c.includes(`boltdocs-entry.tsx`)||c===`\0virtual:boltdocs-entry`){let t=this.environment?.config?.consumer,r=o(),i=t===void 0?!!r?.build?.ssr:t!==`client`;return n.g({...e,ssr:i,useCompiledPages:r?.command===`build`},f)}if(c.includes(`boltdocs-client.mjs`)||c===`\0virtual:boltdocs-client.ts`||c===`virtual:boltdocs-client`){let e=__dirname,n=e;for(;e!==i.default.parse(e).root;){if(a.default.existsSync(i.default.join(e,`package.json`))&&JSON.parse(a.default.readFileSync(i.default.join(e,`package.json`),`utf-8`)).name===`boltdocs`){n=e;break}e=i.default.dirname(e)}let r=i.default.join(n,`src/client/index.ts`),o=i.default.join(n,`dist/client/index.js`);return`export * from '${t.u(a.default.existsSync(r)?r:o)}';`}if(!c.startsWith(`\0virtual:boltdocs-`))return;let h=c.replace(`\0virtual:boltdocs-`,``).replace(/\.tsx?$/,``);if(h===`routes`)return await _(s,f,p),y(p.routesDataMap,l);if(h===`collections`)return await _(s,f,p),x(v(p));if(h===`config`){await _(s,f,p);let e=p.routeCacheVariant?.directoryMeta||{};p.directoryMetaCache=e;let t=[...new Set(Array.from(p.routesDataMap.values()).map(e=>e.collection).filter(e=>!!e))].sort((e,t)=>e.localeCompare(t)),n=f?.collections,r=n?{...n,labels:{...n.labels||{},...Object.fromEntries(t.map(e=>[e,n.labels?.[e]??e]))}}:t.length>0?t:void 0,i={base:f?.base,theme:f?.theme,i18n:f?.i18n,versions:f?.versions,siteUrl:f?.siteUrl,integrations:f?.integrations,collections:r,seo:f?.seo,experimental:f?.experimental,plugins:f?.plugins?.map(e=>({name:e.name})),directoryMeta:e};return`export default ${JSON.stringify(i,null,2)};`}if(h===`entry`){let t=this,r=o(),i=t.environment?.config?.consumer,a=i===void 0?!!(u?.ssr??r?.build?.ssr):i!==`client`;return n.g({...e,ssr:a,useCompiledPages:r?.command===`build`},f)}if(h===`mdx-components`){let e=[`tsx`,`ts`,`jsx`,`js`],n=null;for(let t of e){let e=i.default.resolve(s,`mdx-components.${t}`);if(a.default.existsSync(e)){n=e;break}}let r={};if(f?.plugins)for(let e of f.plugins)e.components&&Object.assign(r,e.components);let o=Object.entries(r),c=o.map(([e,t],n)=>`import * as _pluginCompMod_${n} from '${t}';`).join(`
7
- `),l=o.map(([e],t)=>`${JSON.stringify(e)}: _pluginCompMod_${t}[${JSON.stringify(e)}] || _pluginCompMod_${t}["default"] || _pluginCompMod_${t}`).join(`,
8
- `);if(n){let e=t.u(n);return`${c}
9
- import * as components from '${e}';
10
- const userMdxComponents = components.default || components;
11
- const mdxComponents = {
12
- ${l}${l?`,`:``}
13
- ...userMdxComponents,
14
- };
15
- export default mdxComponents;
16
- export * from '${e}';`}return`${c}
17
- const mdxComponents = {
18
- ${l}
19
- };
20
- export default mdxComponents;`}if(h===`layout`){let e=[`tsx`,`jsx`],n=null;for(let t of e){let e=i.default.resolve(s,`layout.${t}`);if(a.default.existsSync(e)){n=e;break}}if(n)return`import UserLayout from '${t.u(n)}';
21
- export default UserLayout;`;throw Error(`[Boltdocs] Layout file not found. A 'layout.tsx' or 'layout.jsx' file is mandatory in your docs directory. Please create one to define your site structure.`)}if(h===`icons`){let e=[`tsx`,`jsx`,`ts`,`js`],n=null;for(let t of e){let e=i.default.resolve(s,`icons.${t}`);if(a.default.existsSync(e)){n=e;break}}return n?`import * as icons from '${t.u(n)}';\nexport default icons;`:`export default {};`}if(h===`search`)return await _(s,f,p),`export default async function fetchSearchData(options = {}) {
22
- const base = import.meta.env.BASE_URL || '/';
23
- const origin = typeof window !== 'undefined' ? window.location.origin : 'http://localhost';
24
- const basePath = base.endsWith('/') ? base : base + '/';
25
- const url = new URL('search.json', new URL(basePath, origin));
26
- if (options.bustCache) url.searchParams.set('t', String(Date.now()));
27
- const res = await fetch(url, { cache: options.bustCache ? 'no-store' : 'default' });
28
- if (!res.ok) throw new Error('Failed to fetch search index');
29
- return res.json();
30
- }`;if(h===`page-source`){await _(s,f,p);let e={};for(let t of p.routesDataMap.values())t.path&&t._rawContent&&(e[t.path]=t._rawContent);return`export default async function fetchPageSource(options = {}) {
31
- const base = import.meta.env.BASE_URL || '/';
32
- const origin = typeof window !== 'undefined' ? window.location.origin : 'http://localhost';
33
- const basePath = base.endsWith('/') ? base : base + '/';
34
- const url = new URL('page-source.json', new URL(basePath, origin));
35
- if (options.bustCache) url.searchParams.set('t', String(Date.now()));
36
- const res = await fetch(url, { cache: options.bustCache ? 'no-store' : 'default' });
37
- if (!res.ok) throw new Error('Failed to fetch page source');
38
- return res.json();
39
- }`}if(h===`client`){let e=__dirname,n=``;for(;e&&e!==i.default.parse(e).root;){let r=i.default.join(e,`src/client/index.ts`),o=i.default.join(e,`dist/client/index.mjs`),s=i.default.join(e,`client/index.ts`);if(a.default.existsSync(r)){n=t.u(r);break}if(a.default.existsSync(o)){n=t.u(o);break}if(a.default.existsSync(s)){n=t.u(s);break}e=i.default.dirname(e)}if(!n)throw Error(`[boltdocs] Could not resolve boltdocs/client entry point starting from ${__dirname}`);return`export * from '${n}';`}}}}exports.computeFrontmatterDelta=S,exports.createVirtualModuleState=u,exports.createVirtualModulesPlugin=C,exports.getSearchDataExport=b,exports.invalidateDirectoryMetaCache=p;