boltdocs 3.3.5 → 3.4.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/dist/{adapters-BKzKe2mO.mjs → adapters-BXiBWAKs.mjs} +1 -1
- package/dist/{adapters-DwDTQoCG.cjs → adapters-Czl3WtQt.cjs} +1 -1
- package/dist/{build-B672n0hL.cjs → build-CNkXRdk8.cjs} +1 -1
- package/dist/{build-BVoMHMhw.mjs → build-CqUBsXVC.mjs} +1 -1
- package/dist/client/index.cjs +245 -56
- package/dist/client/index.d.cts +3 -3
- package/dist/client/index.d.ts +3 -3
- package/dist/client/index.js +246 -60
- package/dist/client/mdx.cjs +1 -1
- package/dist/client/mdx.js +1 -1
- package/dist/client/primitives.cjs +5 -5
- package/dist/client/primitives.d.cts +92 -42
- package/dist/client/primitives.d.ts +101 -51
- package/dist/client/primitives.js +4 -4
- package/dist/client/router.cjs +1 -1
- package/dist/client/router.d.cts +1 -1
- package/dist/client/router.d.ts +1 -1
- package/dist/client/router.js +1 -1
- package/dist/client/theme/reset.css +41 -0
- package/dist/config-B3SEoVjG.cjs +7 -0
- package/dist/{config-PLvresCv.cjs → config-Bfakeadu.cjs} +1 -1
- package/dist/config-CTcfF-0c.mjs +7 -0
- package/dist/dev-D1DmOSjn.mjs +6 -0
- package/dist/dev-DH6cSge8.cjs +6 -0
- package/dist/{docs-layout-CbZ7LDRe.js → docs-layout-CmntYM6p.js} +46 -147
- package/dist/{docs-layout-vzfXed1Q.cjs → docs-layout-DIgxJ5c7.cjs} +23 -130
- package/dist/{doctor-DMECtdK6.cjs → doctor-BLxm2alc.cjs} +1 -1
- package/dist/{doctor-FuFY1jBz.cjs → doctor-Dd-JMTRo.cjs} +1 -1
- package/dist/{doctor-i8Qmd8DJ.mjs → doctor-DogHujrP.mjs} +1 -1
- package/dist/{image-Hnaa2bJd.cjs → image-Bke2ojW1.cjs} +3 -3
- package/dist/{image-B-NDSDuY.js → image-CaY2w0ua.js} +2 -1
- package/dist/index--xbYbT8N.d.ts +343 -0
- package/dist/{index-Bg-JtZeK.d.cts → index-B_o5y34l.d.cts} +112 -13
- package/dist/{index-B3o307nd.d.ts → index-Bx0CUd7Q.d.ts} +112 -13
- package/dist/index-RK7W_Fxy.d.cts +343 -0
- package/dist/{link-CgdI6O2o.js → link-CSe_oD8Y.js} +137 -139
- package/dist/{link-vZjmD-es.cjs → link-Xb69Oy2F.cjs} +144 -169
- package/dist/{mdx-D0Absdq5.cjs → mdx-BCOrMd-P.cjs} +68 -16
- package/dist/{mdx-BRT71V5Q.js → mdx-BijiEbkp.js} +62 -15
- package/dist/{native-nLA4Jr0T.cjs → native-BbtRkce5.cjs} +1 -1
- package/dist/node/cli-entry.cjs +1 -1
- package/dist/node/cli-entry.mjs +1 -1
- package/dist/node/highlight.d.cts +2 -2
- package/dist/node/highlight.d.mts +2 -2
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.d.cts +19 -37
- package/dist/node/index.d.mts +20 -38
- package/dist/node/index.mjs +1 -1
- package/dist/node/mdx/shiki-adapter.cjs +1 -1
- package/dist/node/mdx/shiki-adapter.d.cts +7 -2
- package/dist/node/mdx/shiki-adapter.d.mts +7 -2
- package/dist/node/mdx/shiki-adapter.mjs +1 -1
- package/dist/node-BgiLCa0I.cjs +39 -0
- package/dist/node-Da3tYBHo.mjs +39 -0
- package/dist/{package-CNqjEYE1.cjs → package-D1gVs5gQ.cjs} +1 -1
- package/dist/{package-sdcKhDhe.mjs → package-YgQJn3Yh.mjs} +1 -1
- package/dist/pages-external-B_r6gvqP.cjs +6 -0
- package/dist/pages-external-jmK7AHaO.mjs +6 -0
- package/dist/{parser-CD8Oo8qh.mjs → parser-CvNZc5s3.mjs} +1 -1
- package/dist/{parser-vPaKvzLp.cjs → parser-DJLWTiO-.cjs} +1 -1
- package/dist/plugin-DW9K2fW5.mjs +69 -0
- package/dist/plugin-NwGKyTJX.cjs +69 -0
- package/dist/{plugin-context-DuSg-Hax.mjs → plugin-context-COh-cbsW.mjs} +1 -1
- package/dist/{plugin-context-CscLcXjH.cjs → plugin-context-FIHaWn6r.cjs} +2 -2
- package/dist/{plugin-lifecycle-BywrEoWK.cjs → plugin-lifecycle-D9fTRaWY.cjs} +1 -1
- package/dist/{registry-BbB6NqSv.d.cts → registry-BFmzj1yg.d.mts} +1 -1
- package/dist/{registry-sJqDv0kE.d.mts → registry-BoswPzYV.d.cts} +1 -1
- package/dist/{resolve-C5rT6B21.mjs → resolve-5puUe7eS.mjs} +1 -1
- package/dist/{resolve-BelytNYR.cjs → resolve-CF4ZLfqx.cjs} +1 -1
- package/dist/route-paths-B6ocUfNY.cjs +6 -0
- package/dist/route-paths-DyDji4bX.mjs +6 -0
- package/dist/{router-CZBxMRAH.js → router-B5e8k4qK.js} +175 -10
- package/dist/{router-C3kygdRK.cjs → router-DKC0Lu0n.cjs} +204 -9
- package/dist/{routes-C3_w9fLX.cjs → routes-D55M8UrH.cjs} +1 -1
- package/dist/routes-DdE6Lfcl.cjs +6 -0
- package/dist/routes-_I_8PQYF.mjs +6 -0
- package/dist/{search-dialog-x_qHU8ty.cjs → search-dialog-BOQRHKTb.cjs} +197 -24
- package/dist/{search-dialog-BqkzDTq2.js → search-dialog-BXil4_7P.js} +190 -29
- package/dist/search-dialog-CwlBd-Mu.cjs +747 -0
- package/dist/{search-dialog-B9mdxsUC.js → search-dialog-D3Obh3eA.js} +1 -1
- package/dist/search-dialog-DeplpVEB.js +717 -0
- package/dist/{search-dialog-DCtm2dyR.cjs → search-dialog-cHXR5zhL.cjs} +1 -1
- package/dist/server/index.cjs +1 -1
- package/dist/server/index.d.mts +1 -1
- package/dist/server/index.mjs +1 -1
- package/dist/ssg-static-options-Br1_u9qp.mjs +6 -0
- package/dist/ssg-static-options-CVvGKM8i.cjs +6 -0
- package/dist/types-58Ac3UGI.d.cts +114 -0
- package/dist/types-BwnGf-1E.d.mts +114 -0
- package/dist/virtual-modules-C4-qxFlL.cjs +40 -0
- package/dist/virtual-modules-DiWUKJGP.mjs +40 -0
- package/package.json +8 -5
- package/src/shared/types.ts +133 -987
- package/dist/config-CrsQJHQz.cjs +0 -7
- package/dist/config-DC0nMMk7.mjs +0 -7
- package/dist/dev-B49V6O6p.mjs +0 -6
- package/dist/dev-DbuhNcF5.cjs +0 -6
- package/dist/index-CgWkOCCn.d.cts +0 -1193
- package/dist/index-CuNSD3E2.d.ts +0 -1193
- package/dist/node-BljvHMpS.cjs +0 -23
- package/dist/node-CWxGw4H4.mjs +0 -23
- package/dist/pages-external-BBw8ObVK.mjs +0 -6
- package/dist/pages-external-DPiPFxxP.cjs +0 -6
- package/dist/plugin-BPcm1cU0.mjs +0 -69
- package/dist/plugin-WUhxnpko.cjs +0 -69
- package/dist/routes-C0kb4ue6.cjs +0 -6
- package/dist/routes-C4wrLWwu.mjs +0 -6
- package/dist/search-dialog-Bp_ouN1c.cjs +0 -550
- package/dist/search-dialog-an2BNMj6.js +0 -526
- package/dist/types-Db6zToZH.d.mts +0 -975
- package/dist/types-o7iZ2BAR.d.cts +0 -975
- package/dist/virtual-modules-B2X4Ht2r.mjs +0 -39
- package/dist/virtual-modules-DPsdHKcu.cjs +0 -39
- /package/dist/{audit-CMc_ydRr.mjs → audit-CYAkXXvP.mjs} +0 -0
- /package/dist/{audit-CHkGiV3c.cjs → audit-DxCZZTuX.cjs} +0 -0
- /package/dist/{csp-BiGAG8aF.cjs → csp-B-gc2Iha.cjs} +0 -0
- /package/dist/{csp-D0BOH8ae.mjs → csp-f8DOcI_7.mjs} +0 -0
- /package/dist/{generator-BCrZL53x.cjs → generator-CBAPKY6r.cjs} +0 -0
- /package/dist/{generator-CFukoGa0.mjs → generator-MRpn-yp6.mjs} +0 -0
- /package/dist/{handler-Lex5DbvG.mjs → handler-DBZqoWt2.mjs} +0 -0
- /package/dist/{handler-Ch-Q9NAB.cjs → handler-ryZR9Q41.cjs} +0 -0
- /package/dist/{index-HAwIo4nZ.d.mts → index-CPr34I2C.d.mts} +0 -0
- /package/dist/{native-BYKMke79.mjs → native-DZ6WMwjG.mjs} +0 -0
- /package/dist/{native-BOet8hpE.cjs → native-DeKxny_T.cjs} +0 -0
- /package/dist/{update-check-BXD1atVv.mjs → update-check-BXx8te9F.mjs} +0 -0
- /package/dist/{update-check-DFQZyoSU.cjs → update-check-CiIeC7CX.cjs} +0 -0
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
* Copyright (c) 2026 Jesus Alcala
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
const require_search_dialog = require('./search-dialog-
|
|
6
|
+
const require_search_dialog = require('./search-dialog-CwlBd-Mu.cjs');
|
|
7
7
|
|
|
8
8
|
exports.SearchDialog = require_search_dialog.SearchDialog;
|
package/dist/server/index.cjs
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Copyright (c) 2026 Jesus Alcala
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../adapters-
|
|
6
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../adapters-Czl3WtQt.cjs`);exports.handleAwsFeedback=e.t,exports.handleNetlifyFeedback=e.r,exports.handleVercelFeedback=e.i,exports.handleWebFeedback=e.n;
|
package/dist/server/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import { i as handleVercelFeedback, n as handleWebFeedback, r as handleNetlifyFeedback, t as handleAwsFeedback } from "../index-
|
|
2
|
+
import { i as handleVercelFeedback, n as handleWebFeedback, r as handleNetlifyFeedback, t as handleAwsFeedback } from "../index-CPr34I2C.mjs";
|
|
3
3
|
export { handleAwsFeedback, handleNetlifyFeedback, handleVercelFeedback, handleWebFeedback };
|
package/dist/server/index.mjs
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Copyright (c) 2026 Jesus Alcala
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import{i as e,n as t,r as n,t as r}from"../adapters-
|
|
6
|
+
import{i as e,n as t,r as n,t as r}from"../adapters-BXiBWAKs.mjs";export{r as handleAwsFeedback,n as handleNetlifyFeedback,e as handleVercelFeedback,t as handleWebFeedback};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boltdocs - https://boltdocs.vercel.app
|
|
3
|
+
* Copyright (c) 2026 Jesus Alcala
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
function e(e){return e===`none`?!1:e===`beasties`?`beasties`:`zig-critters`}function t(t){return{entry:`boltdocs/entry`,htmlEntry:`index.html`,dirStyle:`flat`,includeAllRoutes:!0,mock:!0,script:`async`,beastiesOptions:!1,criticalCss:e(t?.ssg?.criticalCss),criticalCssMaxSize:t?.ssg?.criticalCssMaxSize}}export{t};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boltdocs - https://boltdocs.vercel.app
|
|
3
|
+
* Copyright (c) 2026 Jesus Alcala
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
function e(e){return e===`none`?!1:e===`beasties`?`beasties`:`zig-critters`}function t(t){return{entry:`boltdocs/entry`,htmlEntry:`index.html`,dirStyle:`flat`,includeAllRoutes:!0,mock:!0,script:`async`,beastiesOptions:!1,criticalCss:e(t?.ssg?.criticalCss),criticalCssMaxSize:t?.ssg?.criticalCssMaxSize}}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return t}});
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
|
|
2
|
+
import { IncomingMessage, ServerResponse } from "node:http";
|
|
3
|
+
import { AliasOptions, Plugin, UserConfig } from "vite";
|
|
4
|
+
import { BoltdocsConfigContract, BoltdocsExperimentalConfig, BoltdocsViewTransitionsConfig, CodeHighlightConfig, CodeHighlightConfig as CodeHighlightConfig$1, CodeHighlighterAdapter, CodeHighlighterEngine, CodeHighlighterRuntime, CodeTheme, CodeTheme as CodeTheme$1, DiagnosticRecord, ExternalFileRoute, IPluginLifecycleManager, JsonLdObject, JsonLdValue, ParsedMetaLike, PluginClientConfig, PluginContext, PluginCssDefinition, PluginDefinition, PluginHmrEvent, PluginLifecycleHooks, PluginLogger, PluginMeta, PluginServerMiddleware, PluginStore, PluginTransformMiddleware, RegisteredVirtualModule, RouteMeta, StructuredData } from "@bdocs/contracts";
|
|
5
|
+
|
|
6
|
+
//#region src/shared/types.d.ts
|
|
7
|
+
type PluginServerMiddleware$1 = PluginServerMiddleware<IncomingMessage, ServerResponse>;
|
|
8
|
+
interface PluginContext$1 extends PluginContext<BoltdocsConfig, IncomingMessage, ServerResponse> {}
|
|
9
|
+
interface PluginLifecycleHooks$1 extends PluginLifecycleHooks<BoltdocsConfig, IncomingMessage, ServerResponse> {}
|
|
10
|
+
interface PluginTransformMiddleware$1 extends PluginTransformMiddleware<BoltdocsConfig, IncomingMessage, ServerResponse> {}
|
|
11
|
+
interface IPluginLifecycleManager$1 extends IPluginLifecycleManager<BoltdocsConfig, IncomingMessage, ServerResponse> {}
|
|
12
|
+
/**
|
|
13
|
+
* Represents a single social link in the configuration.
|
|
14
|
+
*/
|
|
15
|
+
interface BoltdocsSocialLink {
|
|
16
|
+
icon: 'discord' | 'x' | 'github' | 'bluesky' | string;
|
|
17
|
+
link: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Theme-specific configuration options.
|
|
21
|
+
*/
|
|
22
|
+
interface BoltdocsThemeConfig {
|
|
23
|
+
title?: string | Record<string, string>;
|
|
24
|
+
description?: string | Record<string, string>;
|
|
25
|
+
logo?: string | {
|
|
26
|
+
dark: string;
|
|
27
|
+
light: string;
|
|
28
|
+
alt?: string;
|
|
29
|
+
width?: number;
|
|
30
|
+
height?: number;
|
|
31
|
+
};
|
|
32
|
+
navbar?: Array<{
|
|
33
|
+
label: string | Record<string, string>;
|
|
34
|
+
href: BoltdocsRoutePathWithFallback;
|
|
35
|
+
items?: Array<{
|
|
36
|
+
label: string | Record<string, string>;
|
|
37
|
+
href: BoltdocsRoutePathWithFallback;
|
|
38
|
+
}>;
|
|
39
|
+
}>;
|
|
40
|
+
sidebar?: Record<string, Array<{
|
|
41
|
+
text: string;
|
|
42
|
+
link: BoltdocsRoutePathWithFallback;
|
|
43
|
+
}>>;
|
|
44
|
+
sidebarGroups?: Record<string, {
|
|
45
|
+
title?: string | Record<string, string>;
|
|
46
|
+
icon?: string;
|
|
47
|
+
}>;
|
|
48
|
+
socialLinks?: BoltdocsSocialLink[];
|
|
49
|
+
editLink?: string;
|
|
50
|
+
communityHelp?: string;
|
|
51
|
+
version?: string;
|
|
52
|
+
githubRepo?: string;
|
|
53
|
+
favicon?: string;
|
|
54
|
+
tabs?: Array<{
|
|
55
|
+
id: string;
|
|
56
|
+
text: string | Record<string, string>;
|
|
57
|
+
icon?: string;
|
|
58
|
+
}>;
|
|
59
|
+
/**
|
|
60
|
+
* Legacy alias for `codeHighlighting.theme`. Kept for backwards
|
|
61
|
+
* compatibility — prefer `codeHighlighting`.
|
|
62
|
+
* @deprecated Use `codeHighlighting` instead.
|
|
63
|
+
*/
|
|
64
|
+
codeTheme?: CodeTheme;
|
|
65
|
+
/**
|
|
66
|
+
* Configures the markdown code highlighting engine. The engine is
|
|
67
|
+
* engine-agnostic: `engine` accepts a registry id (`'shiki'` by default),
|
|
68
|
+
* an adapter instance, or an adapter factory — so any highlighter can be
|
|
69
|
+
* plugged in without changes to the core.
|
|
70
|
+
*
|
|
71
|
+
* Shorthand: a plain string is a registry id, i.e. `'shiki'` is
|
|
72
|
+
* equivalent to `{ engine: 'shiki' }` (resolved by
|
|
73
|
+
* `normalizeCodeHighlightConfig()` at every read site).
|
|
74
|
+
*/
|
|
75
|
+
codeHighlighting?: CodeHighlightConfig | string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Defines a Boltdocs plugin.
|
|
79
|
+
*
|
|
80
|
+
* Use the `definePlugin()` or `createPlugin()` helper from the node API for full
|
|
81
|
+
* type safety and access to lifecycle hooks.
|
|
82
|
+
*/
|
|
83
|
+
interface PluginCssConfig extends PluginCssDefinition {}
|
|
84
|
+
interface BoltdocsPlugin extends PluginDefinition<BoltdocsConfig, IncomingMessage, ServerResponse> {
|
|
85
|
+
vitePlugins?: Plugin[];
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The root configuration object for Boltdocs.
|
|
89
|
+
*/
|
|
90
|
+
interface BoltdocsConfig extends BoltdocsConfigContract<BoltdocsPlugin> {
|
|
91
|
+
theme?: BoltdocsThemeConfig;
|
|
92
|
+
aliases?: AliasOptions;
|
|
93
|
+
vite?: UserConfig;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Global namespace for Boltdocs types that can be augmented by generated code.
|
|
97
|
+
* This allows for strictly typed locales and versions based on the project configuration.
|
|
98
|
+
*/
|
|
99
|
+
declare global {
|
|
100
|
+
namespace Boltdocs {
|
|
101
|
+
interface Types {}
|
|
102
|
+
/**
|
|
103
|
+
* Marker interface augmented by generated code to provide strict route path typing.
|
|
104
|
+
* When no types have been generated (e.g., before first dev server start),
|
|
105
|
+
* keyof is never, and BoltdocsRoutePath falls back to string.
|
|
106
|
+
*/
|
|
107
|
+
interface RoutePaths {}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
type BoltdocsRoutePath = keyof Boltdocs.RoutePaths;
|
|
111
|
+
type ExternalRouteReference = `/${string}` | `#${string}` | `?${string}` | `site:/${string}` | `site:${string}` | `http://${string}` | `https://${string}` | `//${string}`;
|
|
112
|
+
type BoltdocsRoutePathWithFallback = BoltdocsRoutePath | ExternalRouteReference | string;
|
|
113
|
+
//#endregion
|
|
114
|
+
export { PluginMeta as C, RegisteredVirtualModule as D, PluginTransformMiddleware$1 as E, RouteMeta as O, PluginLogger as S, PluginStore as T, PluginClientConfig as _, BoltdocsViewTransitionsConfig as a, PluginHmrEvent as b, CodeHighlighterEngine as c, DiagnosticRecord as d, ExternalFileRoute as f, ParsedMetaLike as g, JsonLdValue as h, BoltdocsThemeConfig as i, StructuredData as k, CodeHighlighterRuntime as l, JsonLdObject as m, BoltdocsExperimentalConfig as n, CodeHighlightConfig$1 as o, IPluginLifecycleManager$1 as p, BoltdocsPlugin as r, CodeHighlighterAdapter as s, BoltdocsConfig as t, CodeTheme$1 as u, PluginContext$1 as v, PluginServerMiddleware$1 as w, PluginLifecycleHooks$1 as x, PluginCssConfig as y };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
|
|
2
|
+
import { AliasOptions, Plugin, UserConfig } from "vite";
|
|
3
|
+
import { IncomingMessage, ServerResponse } from "node:http";
|
|
4
|
+
import { BoltdocsConfigContract, BoltdocsExperimentalConfig, BoltdocsViewTransitionsConfig, CodeHighlightConfig, CodeHighlightConfig as CodeHighlightConfig$1, CodeHighlighterAdapter, CodeHighlighterEngine, CodeHighlighterRuntime, CodeTheme, CodeTheme as CodeTheme$1, DiagnosticRecord, ExternalFileRoute, IPluginLifecycleManager, JsonLdObject, JsonLdValue, ParsedMetaLike, PluginClientConfig, PluginContext, PluginCssDefinition, PluginDefinition, PluginHmrEvent, PluginLifecycleHooks, PluginLogger, PluginMeta, PluginServerMiddleware, PluginStore, PluginTransformMiddleware, RegisteredVirtualModule, RouteMeta, StructuredData } from "@bdocs/contracts";
|
|
5
|
+
|
|
6
|
+
//#region src/shared/types.d.ts
|
|
7
|
+
type PluginServerMiddleware$1 = PluginServerMiddleware<IncomingMessage, ServerResponse>;
|
|
8
|
+
interface PluginContext$1 extends PluginContext<BoltdocsConfig, IncomingMessage, ServerResponse> {}
|
|
9
|
+
interface PluginLifecycleHooks$1 extends PluginLifecycleHooks<BoltdocsConfig, IncomingMessage, ServerResponse> {}
|
|
10
|
+
interface PluginTransformMiddleware$1 extends PluginTransformMiddleware<BoltdocsConfig, IncomingMessage, ServerResponse> {}
|
|
11
|
+
interface IPluginLifecycleManager$1 extends IPluginLifecycleManager<BoltdocsConfig, IncomingMessage, ServerResponse> {}
|
|
12
|
+
/**
|
|
13
|
+
* Represents a single social link in the configuration.
|
|
14
|
+
*/
|
|
15
|
+
interface BoltdocsSocialLink {
|
|
16
|
+
icon: 'discord' | 'x' | 'github' | 'bluesky' | string;
|
|
17
|
+
link: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Theme-specific configuration options.
|
|
21
|
+
*/
|
|
22
|
+
interface BoltdocsThemeConfig {
|
|
23
|
+
title?: string | Record<string, string>;
|
|
24
|
+
description?: string | Record<string, string>;
|
|
25
|
+
logo?: string | {
|
|
26
|
+
dark: string;
|
|
27
|
+
light: string;
|
|
28
|
+
alt?: string;
|
|
29
|
+
width?: number;
|
|
30
|
+
height?: number;
|
|
31
|
+
};
|
|
32
|
+
navbar?: Array<{
|
|
33
|
+
label: string | Record<string, string>;
|
|
34
|
+
href: BoltdocsRoutePathWithFallback;
|
|
35
|
+
items?: Array<{
|
|
36
|
+
label: string | Record<string, string>;
|
|
37
|
+
href: BoltdocsRoutePathWithFallback;
|
|
38
|
+
}>;
|
|
39
|
+
}>;
|
|
40
|
+
sidebar?: Record<string, Array<{
|
|
41
|
+
text: string;
|
|
42
|
+
link: BoltdocsRoutePathWithFallback;
|
|
43
|
+
}>>;
|
|
44
|
+
sidebarGroups?: Record<string, {
|
|
45
|
+
title?: string | Record<string, string>;
|
|
46
|
+
icon?: string;
|
|
47
|
+
}>;
|
|
48
|
+
socialLinks?: BoltdocsSocialLink[];
|
|
49
|
+
editLink?: string;
|
|
50
|
+
communityHelp?: string;
|
|
51
|
+
version?: string;
|
|
52
|
+
githubRepo?: string;
|
|
53
|
+
favicon?: string;
|
|
54
|
+
tabs?: Array<{
|
|
55
|
+
id: string;
|
|
56
|
+
text: string | Record<string, string>;
|
|
57
|
+
icon?: string;
|
|
58
|
+
}>;
|
|
59
|
+
/**
|
|
60
|
+
* Legacy alias for `codeHighlighting.theme`. Kept for backwards
|
|
61
|
+
* compatibility — prefer `codeHighlighting`.
|
|
62
|
+
* @deprecated Use `codeHighlighting` instead.
|
|
63
|
+
*/
|
|
64
|
+
codeTheme?: CodeTheme;
|
|
65
|
+
/**
|
|
66
|
+
* Configures the markdown code highlighting engine. The engine is
|
|
67
|
+
* engine-agnostic: `engine` accepts a registry id (`'shiki'` by default),
|
|
68
|
+
* an adapter instance, or an adapter factory — so any highlighter can be
|
|
69
|
+
* plugged in without changes to the core.
|
|
70
|
+
*
|
|
71
|
+
* Shorthand: a plain string is a registry id, i.e. `'shiki'` is
|
|
72
|
+
* equivalent to `{ engine: 'shiki' }` (resolved by
|
|
73
|
+
* `normalizeCodeHighlightConfig()` at every read site).
|
|
74
|
+
*/
|
|
75
|
+
codeHighlighting?: CodeHighlightConfig | string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Defines a Boltdocs plugin.
|
|
79
|
+
*
|
|
80
|
+
* Use the `definePlugin()` or `createPlugin()` helper from the node API for full
|
|
81
|
+
* type safety and access to lifecycle hooks.
|
|
82
|
+
*/
|
|
83
|
+
interface PluginCssConfig extends PluginCssDefinition {}
|
|
84
|
+
interface BoltdocsPlugin extends PluginDefinition<BoltdocsConfig, IncomingMessage, ServerResponse> {
|
|
85
|
+
vitePlugins?: Plugin[];
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The root configuration object for Boltdocs.
|
|
89
|
+
*/
|
|
90
|
+
interface BoltdocsConfig extends BoltdocsConfigContract<BoltdocsPlugin> {
|
|
91
|
+
theme?: BoltdocsThemeConfig;
|
|
92
|
+
aliases?: AliasOptions;
|
|
93
|
+
vite?: UserConfig;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Global namespace for Boltdocs types that can be augmented by generated code.
|
|
97
|
+
* This allows for strictly typed locales and versions based on the project configuration.
|
|
98
|
+
*/
|
|
99
|
+
declare global {
|
|
100
|
+
namespace Boltdocs {
|
|
101
|
+
interface Types {}
|
|
102
|
+
/**
|
|
103
|
+
* Marker interface augmented by generated code to provide strict route path typing.
|
|
104
|
+
* When no types have been generated (e.g., before first dev server start),
|
|
105
|
+
* keyof is never, and BoltdocsRoutePath falls back to string.
|
|
106
|
+
*/
|
|
107
|
+
interface RoutePaths {}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
type BoltdocsRoutePath = keyof Boltdocs.RoutePaths;
|
|
111
|
+
type ExternalRouteReference = `/${string}` | `#${string}` | `?${string}` | `site:/${string}` | `site:${string}` | `http://${string}` | `https://${string}` | `//${string}`;
|
|
112
|
+
type BoltdocsRoutePathWithFallback = BoltdocsRoutePath | ExternalRouteReference | string;
|
|
113
|
+
//#endregion
|
|
114
|
+
export { PluginMeta as C, RegisteredVirtualModule as D, PluginTransformMiddleware$1 as E, RouteMeta as O, PluginLogger as S, PluginStore as T, PluginClientConfig as _, BoltdocsViewTransitionsConfig as a, PluginHmrEvent as b, CodeHighlighterEngine as c, DiagnosticRecord as d, ExternalFileRoute as f, ParsedMetaLike as g, JsonLdValue as h, BoltdocsThemeConfig as i, StructuredData as k, CodeHighlighterRuntime as l, JsonLdObject as m, BoltdocsExperimentalConfig as n, CodeHighlightConfig$1 as o, IPluginLifecycleManager$1 as p, BoltdocsPlugin as r, CodeHighlighterAdapter as s, BoltdocsConfig as t, CodeTheme$1 as u, PluginContext$1 as v, PluginServerMiddleware$1 as w, PluginLifecycleHooks$1 as x, PluginCssConfig as y };
|
|
@@ -0,0 +1,40 @@
|
|
|
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-FIHaWn6r.cjs`),r=require(`./routes-DdE6Lfcl.cjs`);let i=require(`node:path`);i=e.r(i);let a=require(`node:fs`);a=e.r(a);const o=1200;function s(e){return typeof e==`string`?[e]:Array.isArray(e)?e.flatMap(s):e&&typeof e==`object`?Object.values(e).flatMap(s):[]}const c=new Set([`title`,`description`,`permalink`,`sidebarPosition`,`sidebarLabel`,`sidebarHidden`,`hidden`,`category`,`order`,`badge`,`icon`,`date`,`lastUpdated`,`groupTitle`,`groupPosition`,`seo`]);function l(e,t){let n=e.replace(/\s+/g,` `).trim();return n.length>t?n.slice(0,t).trim():n}function u(e,t){let n=[],r=e.toLocaleLowerCase(),i=0;for(let e of t.slice(0,100)){let t=e.text.trim();if(!t)continue;let a=r.indexOf(t.toLocaleLowerCase(),i);if(a<0){n.push({heading:e,body:``});continue}let o=a+t.length;n.push({heading:e,start:o,body:``}),i=o}return n.map((t,r)=>{if(t.start===void 0)return t;let i=n[r+1]?.start??e.length;return{heading:t.heading,body:l(e.slice(t.start,i),Math.max(0,o-t.heading.text.length-4))}})}function d(e){let t=[];for(let n of e){let e=``;n.frontmatter&&(e=s(Object.entries(n.frontmatter).filter(([e])=>!c.has(e)).map(([e,t])=>t)).join(` `));let r=n._content||``,i=l(e?`${r} ${e}`:r,2e3),a=n.headings?u(r,n.headings):[];if(t.push({id:n.path,title:n.title,content:i,url:n.path,display:n.groupTitle?`${n.groupTitle} > ${n.title}`:n.title,locale:n.locale,version:n.version}),n.headings){let e=6e3;for(let r of a){let{heading:i}=r,a=`${i.text} in ${n.title}`,s=l(r.body?`${a} ${r.body}`:a,Math.min(o,e));if(s&&(t.push({id:`${n.path}#${i.id}`,title:i.text,content:s,url:`${n.path}#${i.id}`,display:`${n.title} > ${i.text}`,locale:n.locale,version:n.version}),e=Math.max(0,e-s.length)),e===0)break}}}return t}function f(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}}const p=new Set([`apikey`,`authorization`,`credential`,`credentials`,`password`,`privatekey`,`secret`,`secretkey`,`token`]);function m(e){return p.has(e.toLowerCase().replace(/[^a-z0-9]/g,``))}function h(e,t=0){return t>10||typeof e!=`object`||!e?e:Array.isArray(e)?e.map(e=>h(e,t+1)):Object.fromEntries(Object.entries(e).filter(([e])=>!m(e)).map(([e,n])=>[e,h(n,t+1)]))}function g(e){return{name:e.name,...e.metadata?{metadata:h(e.metadata)}:{}}}function _(e){let t=e.lastIndexOf(`#`);return t===-1?{modulePath:e,exportName:`default`}:{modulePath:e.slice(0,t),exportName:e.slice(t+1)||`default`}}function v(e){let t={};for(let n of e)for(let[e,r]of Object.entries(n.client?.slots??{}))t[e]??=[],t[e].push(r);return`const slots = {\n${Object.entries(t).map(([e,t])=>{let n=t.map((t,n)=>{let{modulePath:r,exportName:i}=_(t);return`{ id: ${JSON.stringify(`${e}:${n}`)}, load: () => import(${JSON.stringify(r)}).then(module => ({ default: module[${JSON.stringify(i)}] || module.default })) }`});return` ${JSON.stringify(e)}: [${n.join(`, `)}]`}).join(`,
|
|
7
|
+
`)}\n};\nexport default slots;\n`}function y(e){return{routeCacheContext:e,routeGenerationFingerprint:void 0,directoryMetaCache:null,routesDataMap:new Map,collectionsDataMap:new Map,searchDataMap:new Map,serializedSearchData:null,serializedPageSourceData:null}}const b=y();function x(e){return e??b}function S(e){let t=x(e);t.directoryMetaCache=null,t.routeGenerationFingerprint=void 0,t.routeCacheVariant=void 0,t.routesDataMap.clear(),t.collectionsDataMap.clear(),t.searchDataMap.clear(),t.serializedSearchData=null,t.serializedPageSourceData=null}function C(e,t){return(!t.routeCacheContext||t.routeCacheContext.disposed)&&(t.routeCacheContext=r.d(e),t.routeCacheVariant=void 0,t.routeGenerationFingerprint=void 0,t.routesDataMap.clear(),t.collectionsDataMap.clear(),t.searchDataMap.clear(),t.serializedSearchData=null,t.serializedPageSourceData=null),t.routeCacheContext}async function w(e,t,n,i){let a=x(n),o=C(e,a),s=r.p(t),c=(i?.fingerprint===s&&o.variants.get(s)===i?i:void 0)??r.f(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);T(a)}function T(e){let t=x(e),n=Array.from(t.routesDataMap.values()),r=d(n);t.searchDataMap.clear(),t.serializedSearchData=null,t.serializedPageSourceData=null;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===!0,collection:e.collection};t.collectionsDataMap.set(e.filePath,n)}t.serializedSearchData=JSON.stringify(k(t)),t.serializedPageSourceData=JSON.stringify(A(t))}async function E(e,t,n){let i=x(n);C(e,i);let a=r.p(t);(i.routesDataMap.size===0||i.routeGenerationFingerprint!==a)&&(i.routesDataMap.clear(),i.collectionsDataMap.clear(),i.searchDataMap.clear(),i.serializedSearchData=null,i.serializedPageSourceData=null,await w(e,t,i))}function D(e){let t=x(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 O(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 k(e){return Array.from(x(e).searchDataMap.values()).sort((e,t)=>e.id.localeCompare(t.id))}function A(e){let t=x(e),n={};for(let e of t.routesDataMap.values()){let t=e;t.path&&t._rawContent&&(n[t.path]=t._rawContent)}return Object.fromEntries(Object.entries(n).sort(([e],[t])=>e.localeCompare(t)))}function j(e){let t=x(e);return t.serializedSearchData===null&&(t.serializedSearchData=JSON.stringify(k(t))),t.serializedSearchData}function M(e){let t=x(e);return t.serializedPageSourceData===null&&(t.serializedPageSourceData=JSON.stringify(A(t))),t.serializedPageSourceData}function N(e){return`export default ${JSON.stringify(e)};`}async function P(e,t,n,i,a){let o=x(n);i&&(o.routeCacheContext=i),a&&(o.routeCacheVariant=a);let s=r.p(t);o.routeGenerationFingerprint!==s&&(o.routesDataMap.clear(),o.collectionsDataMap.clear(),o.searchDataMap.clear(),o.serializedSearchData=null,o.serializedPageSourceData=null);let c=new Map(o.routesDataMap),l=new Map(o.collectionsDataMap),u=new Map(o.searchDataMap);await w(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(f(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 F(e,r,o,s,c,l){let u=c?.virtualModuleRegistry??n.h,d=x(l);return{name:`vite-plugin-boltdocs-virtual-modules`,resolveId(e){if(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===`virtual:boltdocs-client-registry`||e===`\0virtual:boltdocs-client-registry`)return`\0virtual:boltdocs-client-registry`;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-`)&&u?.has(t))return e}else if(!e.startsWith(`virtual:boltdocs-`)&&u?.has(e))return`\0${e}`;return e.startsWith(`virtual:boltdocs-`)?`\0${e}`:e.startsWith(`\0virtual:boltdocs-`)?e:null},async load(c,l){let p=r(),m=c.startsWith(`\0`)?c.slice(1):c;if(!m.includes(`boltdocs-entry.tsx`)&&!m.includes(`boltdocs-client.mjs`)&&!m.startsWith(`virtual:boltdocs-`)&&u?.has(m)){let e=u?.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`},p)}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 E(s,p,d),O(d.routesDataMap,f);if(h===`client-registry`)return v(p?.plugins??[]);if(h===`collections`)return await E(s,p,d),N(D(d));if(h===`config`){await E(s,p,d);let e=d.routeCacheVariant?.directoryMeta||{};d.directoryMetaCache=e;let t=[...new Set(Array.from(d.routesDataMap.values()).map(e=>e.collection).filter(e=>!!e))].sort((e,t)=>e.localeCompare(t)),n=p?.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:p?.base,theme:p?.theme,i18n:p?.i18n,versions:p?.versions,siteUrl:p?.siteUrl,integrations:p?.integrations,collections:r,seo:p?.seo,experimental:p?.experimental,plugins:p?.plugins?.map(g),directoryMeta:e};return`export default ${JSON.stringify(i)};`}if(h===`entry`){let t=this,r=o(),i=t.environment?.config?.consumer,a=i===void 0?!!(l?.ssr??r?.build?.ssr):i!==`client`;return n.g({...e,ssr:a,useCompiledPages:r?.command===`build`},p)}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(p?.plugins)for(let e of p.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(`
|
|
8
|
+
`),l=o.map(([e],t)=>`${JSON.stringify(e)}: _pluginCompMod_${t}[${JSON.stringify(e)}] || Reflect.get(_pluginCompMod_${t}, "default") || _pluginCompMod_${t}`).join(`,
|
|
9
|
+
`);if(n){let e=t.u(n);return`${c}
|
|
10
|
+
import * as components from '${e}';
|
|
11
|
+
const userMdxComponents = components.default || components;
|
|
12
|
+
const mdxComponents = {
|
|
13
|
+
${l}${l?`,`:``}
|
|
14
|
+
...userMdxComponents,
|
|
15
|
+
};
|
|
16
|
+
export default mdxComponents;
|
|
17
|
+
export * from '${e}';`}return`${c}
|
|
18
|
+
const mdxComponents = {
|
|
19
|
+
${l}
|
|
20
|
+
};
|
|
21
|
+
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)}';
|
|
22
|
+
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 E(s,p,d),`export default async function fetchSearchData(options = {}) {
|
|
23
|
+
const base = import.meta.env.BASE_URL || '/';
|
|
24
|
+
const origin = typeof window !== 'undefined' ? window.location.origin : 'http://localhost';
|
|
25
|
+
const basePath = base.endsWith('/') ? base : base + '/';
|
|
26
|
+
const url = new URL('search.json', new URL(basePath, origin));
|
|
27
|
+
if (options.bustCache) url.searchParams.set('t', String(Date.now()));
|
|
28
|
+
const res = await fetch(url, { cache: options.bustCache ? 'no-store' : 'default' });
|
|
29
|
+
if (!res.ok) throw new Error('Failed to fetch search index');
|
|
30
|
+
return res.json();
|
|
31
|
+
}`;if(h===`page-source`){await E(s,p,d);let e={};for(let t of d.routesDataMap.values())t.path&&t._rawContent&&(e[t.path]=t._rawContent);return`export default async function fetchPageSource(options = {}) {
|
|
32
|
+
const base = import.meta.env.BASE_URL || '/';
|
|
33
|
+
const origin = typeof window !== 'undefined' ? window.location.origin : 'http://localhost';
|
|
34
|
+
const basePath = base.endsWith('/') ? base : base + '/';
|
|
35
|
+
const url = new URL('page-source.json', new URL(basePath, origin));
|
|
36
|
+
if (options.bustCache) url.searchParams.set('t', String(Date.now()));
|
|
37
|
+
const res = await fetch(url, { cache: options.bustCache ? 'no-store' : 'default' });
|
|
38
|
+
if (!res.ok) throw new Error('Failed to fetch page source');
|
|
39
|
+
return res.json();
|
|
40
|
+
}`}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=P,exports.createVirtualModuleState=y,exports.createVirtualModulesPlugin=F,exports.getPageSourceJsonExport=M,exports.getSearchJsonExport=j,exports.invalidateDirectoryMetaCache=S;
|
|
@@ -0,0 +1,40 @@
|
|
|
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-COh-cbsW.mjs";import{u as r}from"./utils-8lzafE49.mjs";import{d as i,f as a,p as o,t as s}from"./routes-_I_8PQYF.mjs";import c from"node:path";import l from"node:fs";const u=1200;function d(e){return typeof e==`string`?[e]:Array.isArray(e)?e.flatMap(d):e&&typeof e==`object`?Object.values(e).flatMap(d):[]}const f=new Set([`title`,`description`,`permalink`,`sidebarPosition`,`sidebarLabel`,`sidebarHidden`,`hidden`,`category`,`order`,`badge`,`icon`,`date`,`lastUpdated`,`groupTitle`,`groupPosition`,`seo`]);function p(e,t){let n=e.replace(/\s+/g,` `).trim();return n.length>t?n.slice(0,t).trim():n}function m(e,t){let n=[],r=e.toLocaleLowerCase(),i=0;for(let e of t.slice(0,100)){let t=e.text.trim();if(!t)continue;let a=r.indexOf(t.toLocaleLowerCase(),i);if(a<0){n.push({heading:e,body:``});continue}let o=a+t.length;n.push({heading:e,start:o,body:``}),i=o}return n.map((t,r)=>{if(t.start===void 0)return t;let i=n[r+1]?.start??e.length;return{heading:t.heading,body:p(e.slice(t.start,i),Math.max(0,u-t.heading.text.length-4))}})}function h(e){let t=[];for(let n of e){let e=``;n.frontmatter&&(e=d(Object.entries(n.frontmatter).filter(([e])=>!f.has(e)).map(([e,t])=>t)).join(` `));let r=n._content||``,i=p(e?`${r} ${e}`:r,2e3),a=n.headings?m(r,n.headings):[];if(t.push({id:n.path,title:n.title,content:i,url:n.path,display:n.groupTitle?`${n.groupTitle} > ${n.title}`:n.title,locale:n.locale,version:n.version}),n.headings){let e=6e3;for(let r of a){let{heading:i}=r,a=`${i.text} in ${n.title}`,o=p(r.body?`${a} ${r.body}`:a,Math.min(u,e));if(o&&(t.push({id:`${n.path}#${i.id}`,title:i.text,content:o,url:`${n.path}#${i.id}`,display:`${n.title} > ${i.text}`,locale:n.locale,version:n.version}),e=Math.max(0,e-o.length)),e===0)break}}}return t}function g(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}}const _=new Set([`apikey`,`authorization`,`credential`,`credentials`,`password`,`privatekey`,`secret`,`secretkey`,`token`]);function v(e){return _.has(e.toLowerCase().replace(/[^a-z0-9]/g,``))}function y(e,t=0){return t>10||typeof e!=`object`||!e?e:Array.isArray(e)?e.map(e=>y(e,t+1)):Object.fromEntries(Object.entries(e).filter(([e])=>!v(e)).map(([e,n])=>[e,y(n,t+1)]))}function b(e){return{name:e.name,...e.metadata?{metadata:y(e.metadata)}:{}}}function x(e){let t=e.lastIndexOf(`#`);return t===-1?{modulePath:e,exportName:`default`}:{modulePath:e.slice(0,t),exportName:e.slice(t+1)||`default`}}function S(e){let t={};for(let n of e)for(let[e,r]of Object.entries(n.client?.slots??{}))t[e]??=[],t[e].push(r);return`const slots = {\n${Object.entries(t).map(([e,t])=>{let n=t.map((t,n)=>{let{modulePath:r,exportName:i}=x(t);return`{ id: ${JSON.stringify(`${e}:${n}`)}, load: () => import(${JSON.stringify(r)}).then(module => ({ default: module[${JSON.stringify(i)}] || module.default })) }`});return` ${JSON.stringify(e)}: [${n.join(`, `)}]`}).join(`,
|
|
7
|
+
`)}\n};\nexport default slots;\n`}function C(e){return{routeCacheContext:e,routeGenerationFingerprint:void 0,directoryMetaCache:null,routesDataMap:new Map,collectionsDataMap:new Map,searchDataMap:new Map,serializedSearchData:null,serializedPageSourceData:null}}const w=C();function T(e){return e??w}function E(e){let t=T(e);t.directoryMetaCache=null,t.routeGenerationFingerprint=void 0,t.routeCacheVariant=void 0,t.routesDataMap.clear(),t.collectionsDataMap.clear(),t.searchDataMap.clear(),t.serializedSearchData=null,t.serializedPageSourceData=null}function D(e,t){return(!t.routeCacheContext||t.routeCacheContext.disposed)&&(t.routeCacheContext=i(e),t.routeCacheVariant=void 0,t.routeGenerationFingerprint=void 0,t.routesDataMap.clear(),t.collectionsDataMap.clear(),t.searchDataMap.clear(),t.serializedSearchData=null,t.serializedPageSourceData=null),t.routeCacheContext}async function O(e,t,n,r){let i=T(n),c=D(e,i),l=o(t),u=(r?.fingerprint===l&&c.variants.get(l)===r?r:void 0)??a(c,l);i.routeCacheVariant=u,i.routeGenerationFingerprint=l;let d=await s(e,t,void 0,!1,c,u);i.routesDataMap.clear();for(let e of d)i.routesDataMap.set(e.path,e);k(i)}function k(e){let t=T(e),n=Array.from(t.routesDataMap.values()),r=h(n);t.searchDataMap.clear(),t.serializedSearchData=null,t.serializedPageSourceData=null;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===!0,collection:e.collection};t.collectionsDataMap.set(e.filePath,n)}t.serializedSearchData=JSON.stringify(N(t)),t.serializedPageSourceData=JSON.stringify(P(t))}async function A(e,t,n){let r=T(n);D(e,r);let i=o(t);(r.routesDataMap.size===0||r.routeGenerationFingerprint!==i)&&(r.routesDataMap.clear(),r.collectionsDataMap.clear(),r.searchDataMap.clear(),r.serializedSearchData=null,r.serializedPageSourceData=null,await O(e,t,r))}function j(e){let t=T(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 M(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 N(e){return Array.from(T(e).searchDataMap.values()).sort((e,t)=>e.id.localeCompare(t.id))}function P(e){let t=T(e),n={};for(let e of t.routesDataMap.values()){let t=e;t.path&&t._rawContent&&(n[t.path]=t._rawContent)}return Object.fromEntries(Object.entries(n).sort(([e],[t])=>e.localeCompare(t)))}function F(e){let t=T(e);return t.serializedSearchData===null&&(t.serializedSearchData=JSON.stringify(N(t))),t.serializedSearchData}function I(e){let t=T(e);return t.serializedPageSourceData===null&&(t.serializedPageSourceData=JSON.stringify(P(t))),t.serializedPageSourceData}function L(e){return`export default ${JSON.stringify(e)};`}async function R(e,t,n,r,i){let a=T(n);r&&(a.routeCacheContext=r),i&&(a.routeCacheVariant=i);let s=o(t);a.routeGenerationFingerprint!==s&&(a.routesDataMap.clear(),a.collectionsDataMap.clear(),a.searchDataMap.clear(),a.serializedSearchData=null,a.serializedPageSourceData=null);let c=new Map(a.routesDataMap),l=new Map(a.collectionsDataMap),u=new Map(a.searchDataMap);await O(e,t,a);let d={routes:{updated:[],deleted:[]},collections:{updated:[],deleted:[]},search:{updated:[],deleted:[]}};for(let[e,t]of a.routesDataMap){let n=c.get(e);(!n||JSON.stringify(n)!==JSON.stringify(t))&&d.routes.updated.push(g(t))}for(let e of c.keys())a.routesDataMap.has(e)||d.routes.deleted.push(e);for(let[e,t]of a.collectionsDataMap){let n=l.get(e);(!n||JSON.stringify(n)!==JSON.stringify(t))&&d.collections.updated.push(t)}for(let e of l.keys())a.collectionsDataMap.has(e)||d.collections.deleted.push(e);for(let[e,t]of a.searchDataMap){let n=u.get(e);(!n||JSON.stringify(n)!==JSON.stringify(t))&&d.search.updated.push(t)}for(let e of u.keys())a.searchDataMap.has(e)||d.search.deleted.push(e);return d}function z(i,a,o,s,u,d){let f=u?.virtualModuleRegistry??n,p=T(d);return{name:`vite-plugin-boltdocs-virtual-modules`,resolveId(e){if(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===`virtual:boltdocs-client-registry`||e===`\0virtual:boltdocs-client-registry`)return`\0virtual:boltdocs-client-registry`;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(),m=n.startsWith(`\0`)?n.slice(1):n;if(!m.includes(`boltdocs-entry.tsx`)&&!m.includes(`boltdocs-client.mjs`)&&!m.startsWith(`virtual:boltdocs-`)&&f?.has(m)){let e=f?.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(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 h=n.replace(`\0virtual:boltdocs-`,``).replace(/\.tsx?$/,``);if(h===`routes`)return await A(s,d,p),M(p.routesDataMap,g);if(h===`client-registry`)return S(d?.plugins??[]);if(h===`collections`)return await A(s,d,p),L(j(p));if(h===`config`){await A(s,d,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=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(b),directoryMeta:e};return`export default ${JSON.stringify(i)};`}if(h===`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(h===`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(`
|
|
8
|
+
`),o=i.map(([e],t)=>`${JSON.stringify(e)}: _pluginCompMod_${t}[${JSON.stringify(e)}] || Reflect.get(_pluginCompMod_${t}, "default") || _pluginCompMod_${t}`).join(`,
|
|
9
|
+
`);if(t){let e=r(t);return`${a}
|
|
10
|
+
import * as components from '${e}';
|
|
11
|
+
const userMdxComponents = components.default || components;
|
|
12
|
+
const mdxComponents = {
|
|
13
|
+
${o}${o?`,`:``}
|
|
14
|
+
...userMdxComponents,
|
|
15
|
+
};
|
|
16
|
+
export default mdxComponents;
|
|
17
|
+
export * from '${e}';`}return`${a}
|
|
18
|
+
const mdxComponents = {
|
|
19
|
+
${o}
|
|
20
|
+
};
|
|
21
|
+
export default mdxComponents;`}if(h===`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)}';
|
|
22
|
+
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`],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(h===`search`)return await A(s,d,p),`export default async function fetchSearchData(options = {}) {
|
|
23
|
+
const base = import.meta.env.BASE_URL || '/';
|
|
24
|
+
const origin = typeof window !== 'undefined' ? window.location.origin : 'http://localhost';
|
|
25
|
+
const basePath = base.endsWith('/') ? base : base + '/';
|
|
26
|
+
const url = new URL('search.json', new URL(basePath, origin));
|
|
27
|
+
if (options.bustCache) url.searchParams.set('t', String(Date.now()));
|
|
28
|
+
const res = await fetch(url, { cache: options.bustCache ? 'no-store' : 'default' });
|
|
29
|
+
if (!res.ok) throw new Error('Failed to fetch search index');
|
|
30
|
+
return res.json();
|
|
31
|
+
}`;if(h===`page-source`){await A(s,d,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 = {}) {
|
|
32
|
+
const base = import.meta.env.BASE_URL || '/';
|
|
33
|
+
const origin = typeof window !== 'undefined' ? window.location.origin : 'http://localhost';
|
|
34
|
+
const basePath = base.endsWith('/') ? base : base + '/';
|
|
35
|
+
const url = new URL('page-source.json', new URL(basePath, origin));
|
|
36
|
+
if (options.bustCache) url.searchParams.set('t', String(Date.now()));
|
|
37
|
+
const res = await fetch(url, { cache: options.bustCache ? 'no-store' : 'default' });
|
|
38
|
+
if (!res.ok) throw new Error('Failed to fetch page source');
|
|
39
|
+
return res.json();
|
|
40
|
+
}`}if(h===`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{R as computeFrontmatterDelta,C as createVirtualModuleState,z as createVirtualModulesPlugin,I as getPageSourceJsonExport,F as getSearchJsonExport,E as invalidateDirectoryMetaCache};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "boltdocs",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "A lightweight documentation generator for React projects.",
|
|
5
5
|
"main": "dist/node/index.mjs",
|
|
6
6
|
"module": "dist/node/index.mjs",
|
|
@@ -85,6 +85,7 @@
|
|
|
85
85
|
"license": "MIT",
|
|
86
86
|
"dependencies": {
|
|
87
87
|
"@bdocs/dui": "^0.6.0",
|
|
88
|
+
"@shikijs/core": "3.23.0",
|
|
88
89
|
"@shikijs/engine-oniguruma": "3.23.0",
|
|
89
90
|
"@shikijs/langs": "3.23.0",
|
|
90
91
|
"@shikijs/themes": "3.23.0",
|
|
@@ -101,17 +102,19 @@
|
|
|
101
102
|
"lru-cache": "^11.3.6",
|
|
102
103
|
"picomatch": "^4.0.4",
|
|
103
104
|
"react-helmet-async": "^2.0.1",
|
|
105
|
+
"react-refresh": "^0.17.0",
|
|
104
106
|
"scroll-into-view-if-needed": "3.1.0",
|
|
105
107
|
"semver": "^7.7.4",
|
|
106
108
|
"shiki": "3.23.0",
|
|
107
109
|
"tailwind-merge": "3.5.0",
|
|
108
110
|
"vite": "8.1.5",
|
|
109
111
|
"zod": "4.3.6",
|
|
110
|
-
"@bdocs/
|
|
111
|
-
"@bdocs/ssg": "0.4.3",
|
|
112
|
-
"@bdocs/unist-utils": "0.2.1",
|
|
112
|
+
"@bdocs/contracts": "0.1.0",
|
|
113
113
|
"@bdocs/parser": "1.2.0",
|
|
114
|
-
"@bdocs/
|
|
114
|
+
"@bdocs/plugin-image-optimizer": "0.2.2",
|
|
115
|
+
"@bdocs/processor-satteri": "0.4.0",
|
|
116
|
+
"@bdocs/ssg": "0.5.0",
|
|
117
|
+
"@bdocs/unist-utils": "0.2.1"
|
|
115
118
|
},
|
|
116
119
|
"peerDependencies": {
|
|
117
120
|
"react": "19.0.0",
|