boltdocs 2.7.10 → 2.7.11
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/client/index.cjs +1929 -1
- package/dist/client/index.js +1880 -1
- package/dist/client/mdx.cjs +7 -1
- package/dist/client/mdx.js +7 -1
- package/dist/client/primitives.cjs +60 -1
- package/dist/client/primitives.js +20 -1
- package/dist/docs-layout-BXHV0xw_.cjs +1431 -0
- package/dist/docs-layout-DwFndmj5.js +1231 -0
- package/dist/icons-dev-3cZMyt8r.cjs +1204 -0
- package/dist/icons-dev-Df8OQ481.js +839 -0
- package/dist/image-DtrI2cw3.cjs +268 -0
- package/dist/image-jxPb-2iV.js +214 -0
- package/dist/mdx-BdWkJTeB.cjs +523 -0
- package/dist/mdx-UTTLFWJq.js +494 -0
- package/dist/node/cli-entry.cjs +1 -1
- package/dist/node/cli-entry.mjs +1 -1
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.mjs +1 -1
- package/dist/{node-DtEDyN1u.cjs → node-BSM4qcDK.cjs} +1 -1
- package/dist/{node-_1jhMGYx.mjs → node-BspZN3R2.mjs} +1 -1
- package/dist/{package-DrwtlXfk.cjs → package-DIIrjuWI.cjs} +1 -1
- package/dist/{package--0Yf0t1N.mjs → package-K0zsjGIz.mjs} +1 -1
- package/dist/{search-dialog-ByvGScjt.js → search-dialog-BHuIiUC6.js} +3 -1
- package/dist/search-dialog-BNF10tDl.js +375 -0
- package/dist/search-dialog-BwkDuI9R.cjs +220 -0
- package/dist/search-dialog-C7xuvyNk.cjs +386 -0
- package/dist/search-dialog-CIQg6k8c.cjs +8 -0
- package/dist/search-dialog-D-DDN7zJ.js +208 -0
- package/package.json +3 -4
- package/dist/docs-layout-KoWNZc8_.js +0 -6
- package/dist/docs-layout-x2yKt2cL.cjs +0 -6
- package/dist/icons-dev-B_RZIyxu.js +0 -6
- package/dist/icons-dev-BlV3wWFT.cjs +0 -6
- package/dist/image-BHhTvQzr.cjs +0 -6
- package/dist/image-CqKzYD8f.js +0 -6
- package/dist/mdx-DudBEac0.js +0 -7
- package/dist/mdx-r4cDQxWu.cjs +0 -7
- package/dist/search-dialog-B584t9ZF.js +0 -6
- package/dist/search-dialog-BvBopRsZ.cjs +0 -6
- package/dist/search-dialog-Cyko6TJm.cjs +0 -6
- package/dist/search-dialog-D6BNohIJ.js +0 -6
- package/dist/search-dialog-DuYTIefy.cjs +0 -6
- package/src/client/app/config-context.tsx +0 -51
- package/src/client/app/doc-page.tsx +0 -38
- package/src/client/app/docs-layout.tsx +0 -28
- package/src/client/app/head.tsx +0 -122
- package/src/client/app/helmet-compat.tsx +0 -36
- package/src/client/app/mdx-component.tsx +0 -8
- package/src/client/app/mdx-components-context.tsx +0 -72
- package/src/client/app/routes-context.tsx +0 -34
- package/src/client/app/scroll-handler.tsx +0 -74
- package/src/client/app/theme-context.tsx +0 -103
- package/src/client/app/ui-context.tsx +0 -42
- package/src/client/components/docs-layout-default.tsx +0 -85
- package/src/client/components/icons-dev.tsx +0 -282
- package/src/client/components/mdx/callout.tsx +0 -97
- package/src/client/components/mdx/card.tsx +0 -99
- package/src/client/components/mdx/cards.tsx +0 -27
- package/src/client/components/mdx/code-block.tsx +0 -184
- package/src/client/components/mdx/field.tsx +0 -33
- package/src/client/components/mdx/image.tsx +0 -44
- package/src/client/components/mdx/index.ts +0 -19
- package/src/client/components/mdx/table.tsx +0 -54
- package/src/client/components/mdx/typographics.tsx +0 -120
- package/src/client/components/mdx/use-code-block.ts +0 -34
- package/src/client/components/primitives/breadcrumbs.tsx +0 -54
- package/src/client/components/primitives/button-group.tsx +0 -54
- package/src/client/components/primitives/button.tsx +0 -6
- package/src/client/components/primitives/code-block.tsx +0 -120
- package/src/client/components/primitives/docs-layout.tsx +0 -125
- package/src/client/components/primitives/error-boundary.tsx +0 -107
- package/src/client/components/primitives/heading.tsx +0 -128
- package/src/client/components/primitives/helpers/observer.ts +0 -141
- package/src/client/components/primitives/image.tsx +0 -26
- package/src/client/components/primitives/link.tsx +0 -102
- package/src/client/components/primitives/menu.tsx +0 -137
- package/src/client/components/primitives/navbar.tsx +0 -466
- package/src/client/components/primitives/on-this-page.tsx +0 -430
- package/src/client/components/primitives/page-nav.tsx +0 -51
- package/src/client/components/primitives/popover.tsx +0 -28
- package/src/client/components/primitives/search-dialog.tsx +0 -193
- package/src/client/components/primitives/sidebar.tsx +0 -423
- package/src/client/components/primitives/skeleton.tsx +0 -26
- package/src/client/components/primitives/tabs.tsx +0 -70
- package/src/client/components/primitives/tooltip.tsx +0 -81
- package/src/client/components/primitives/types.ts +0 -11
- package/src/client/components/ui-base/banner.tsx +0 -66
- package/src/client/components/ui-base/breadcrumbs.tsx +0 -44
- package/src/client/components/ui-base/copy-markdown.tsx +0 -107
- package/src/client/components/ui-base/error-boundary.tsx +0 -15
- package/src/client/components/ui-base/github-stars.tsx +0 -29
- package/src/client/components/ui-base/icons.tsx +0 -240
- package/src/client/components/ui-base/index.ts +0 -16
- package/src/client/components/ui-base/last-updated.tsx +0 -27
- package/src/client/components/ui-base/navbar.tsx +0 -266
- package/src/client/components/ui-base/not-found.tsx +0 -26
- package/src/client/components/ui-base/on-this-page.tsx +0 -57
- package/src/client/components/ui-base/page-nav.tsx +0 -50
- package/src/client/components/ui-base/search-dialog.tsx +0 -163
- package/src/client/components/ui-base/search-highlight.tsx +0 -10
- package/src/client/components/ui-base/sidebar.tsx +0 -92
- package/src/client/components/ui-base/tabs.tsx +0 -83
- package/src/client/components/ui-base/theme-toggle.tsx +0 -130
- package/src/client/components/ui-base/version-i18n.tsx +0 -80
- package/src/client/hooks/index.ts +0 -13
- package/src/client/hooks/use-analytics.ts +0 -272
- package/src/client/hooks/use-breadcrumbs.ts +0 -22
- package/src/client/hooks/use-i18n.ts +0 -182
- package/src/client/hooks/use-localized-to.ts +0 -113
- package/src/client/hooks/use-location.ts +0 -5
- package/src/client/hooks/use-navbar.ts +0 -130
- package/src/client/hooks/use-page-nav.ts +0 -46
- package/src/client/hooks/use-routes.ts +0 -108
- package/src/client/hooks/use-search-highlight.ts +0 -185
- package/src/client/hooks/use-search.ts +0 -118
- package/src/client/hooks/use-sidebar.ts +0 -205
- package/src/client/hooks/use-tabs.ts +0 -46
- package/src/client/hooks/use-version.ts +0 -111
- package/src/client/index.ts +0 -31
- package/src/client/mdx.ts +0 -2
- package/src/client/primitives.ts +0 -19
- package/src/client/ssg/boltdocs-shell.tsx +0 -148
- package/src/client/ssg/create-routes.tsx +0 -473
- package/src/client/ssg/index.ts +0 -4
- package/src/client/ssg/mdx-page.tsx +0 -38
- package/src/client/store/boltdocs-context.tsx +0 -137
- package/src/client/theme/neutral.css +0 -141
- package/src/client/theme/reset.css +0 -189
- package/src/client/types.ts +0 -116
- package/src/client/utils/cn.ts +0 -6
- package/src/client/utils/copy-clipboard.ts +0 -22
- package/src/client/utils/get-base-file-path.ts +0 -21
- package/src/client/utils/github.ts +0 -121
- package/src/client/utils/i18n.ts +0 -23
- package/src/client/utils/path.ts +0 -9
- package/src/client/utils/react-to-text.ts +0 -34
- package/src/client/virtual.d.ts +0 -24
|
@@ -0,0 +1,494 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boltdocs - https://boltdocs.vercel.app
|
|
3
|
+
* Copyright (c) 2026 Jesus Alcala
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import { I as Info, M as File, R as Lightbulb, S as AlertTriangle, _ as Link, a as Csv, c as JavaScript, d as React$1, f as Rust, g as Yaml, i as Css, k as Copy, l as Json, m as TypeScript, n as BracketsOrange, p as Shell, r as BracketsRed, u as Markdown, w as Check, x as AlertCircle, y as cn } from "./icons-dev-Df8OQ481.js";
|
|
7
|
+
import { a as CodeBlockGroup, i as CodeBlockContent, l as useTheme, n as Tooltip, o as CodeBlockHeader, r as CodeBlock$1, s as Heading$1, t as Image$1 } from "./image-jxPb-2iV.js";
|
|
8
|
+
import { isValidElement, useCallback, useEffect, useRef, useState } from "react";
|
|
9
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { Button } from "react-aria-components";
|
|
11
|
+
|
|
12
|
+
//#region src/client/components/mdx/callout.tsx
|
|
13
|
+
const variantStyles = {
|
|
14
|
+
note: {
|
|
15
|
+
container: "bg-slate-500/5 dark:bg-slate-500/10 border-slate-500/40 text-slate-800 dark:text-slate-200",
|
|
16
|
+
titleText: "text-slate-900 dark:text-slate-100",
|
|
17
|
+
iconColor: "text-slate-500",
|
|
18
|
+
icon: Info,
|
|
19
|
+
defaultTitle: "Note"
|
|
20
|
+
},
|
|
21
|
+
info: {
|
|
22
|
+
container: "bg-indigo-500/5 dark:bg-indigo-500/10 border-indigo-500/40 text-indigo-800 dark:text-indigo-200",
|
|
23
|
+
titleText: "text-indigo-900 dark:text-indigo-100",
|
|
24
|
+
iconColor: "text-indigo-500",
|
|
25
|
+
icon: Info,
|
|
26
|
+
defaultTitle: "Info"
|
|
27
|
+
},
|
|
28
|
+
tip: {
|
|
29
|
+
container: "bg-green-500/5 dark:bg-green-500/10 border-green-500/40 text-green-800 dark:text-green-200",
|
|
30
|
+
titleText: "text-green-900 dark:text-green-100",
|
|
31
|
+
iconColor: "text-green-500",
|
|
32
|
+
icon: Lightbulb,
|
|
33
|
+
defaultTitle: "Tip"
|
|
34
|
+
},
|
|
35
|
+
warning: {
|
|
36
|
+
container: "bg-amber-500/5 dark:bg-amber-500/10 border-amber-500/40 text-amber-800 dark:text-amber-200",
|
|
37
|
+
titleText: "text-amber-900 dark:text-amber-100",
|
|
38
|
+
iconColor: "text-amber-500",
|
|
39
|
+
icon: AlertTriangle,
|
|
40
|
+
defaultTitle: "Warning"
|
|
41
|
+
},
|
|
42
|
+
danger: {
|
|
43
|
+
container: "bg-rose-500/5 dark:bg-rose-500/10 border-rose-500/40 text-rose-800 dark:text-rose-200",
|
|
44
|
+
titleText: "text-rose-900 dark:text-rose-100",
|
|
45
|
+
iconColor: "text-rose-500",
|
|
46
|
+
icon: AlertCircle,
|
|
47
|
+
defaultTitle: "Danger"
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
function Callout({ children, className = "", variant = "note", title, ...props }) {
|
|
51
|
+
const styles = variantStyles[variant] || variantStyles.note;
|
|
52
|
+
const Icon = styles.icon;
|
|
53
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
54
|
+
className: cn("my-6 flex gap-4 p-4 rounded-xl border-2", styles.container, className),
|
|
55
|
+
...props,
|
|
56
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
57
|
+
className: cn("shrink-0 pt-0.5", styles.iconColor),
|
|
58
|
+
children: /* @__PURE__ */ jsx(Icon, { className: "w-5 h-5 stroke-[2]" })
|
|
59
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
60
|
+
className: "flex-1 text-[0.875rem] leading-[1.6]",
|
|
61
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
62
|
+
className: cn("font-bold text-sm mb-1", styles.titleText),
|
|
63
|
+
children: title || styles.defaultTitle
|
|
64
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
65
|
+
className: "prose prose-neutral dark:prose-invert max-w-none [&>p]:m-0 [&>p+p]:mt-2",
|
|
66
|
+
children
|
|
67
|
+
})]
|
|
68
|
+
})]
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/client/components/mdx/field.tsx
|
|
74
|
+
const Field = ({ children, name, type, description, required }) => /* @__PURE__ */ jsxs("div", {
|
|
75
|
+
className: "my-4 border border-subtle bg-surface/50 p-4 rounded-xl flex flex-col gap-1 text-sm select-none",
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ jsxs("div", {
|
|
78
|
+
className: "flex items-center gap-2",
|
|
79
|
+
children: [
|
|
80
|
+
/* @__PURE__ */ jsx("span", {
|
|
81
|
+
className: "font-mono font-bold text-primary-500",
|
|
82
|
+
children: name
|
|
83
|
+
}),
|
|
84
|
+
type && /* @__PURE__ */ jsx("span", {
|
|
85
|
+
className: "text-xs text-muted font-mono bg-soft px-1.5 py-0.5 rounded-md",
|
|
86
|
+
children: type
|
|
87
|
+
}),
|
|
88
|
+
required && /* @__PURE__ */ jsx("span", {
|
|
89
|
+
className: "text-xs text-rose-500 font-semibold",
|
|
90
|
+
children: "required"
|
|
91
|
+
})
|
|
92
|
+
]
|
|
93
|
+
}),
|
|
94
|
+
description && /* @__PURE__ */ jsx("div", {
|
|
95
|
+
className: "text-muted text-xs mt-1",
|
|
96
|
+
children: description
|
|
97
|
+
}),
|
|
98
|
+
children && /* @__PURE__ */ jsx("div", {
|
|
99
|
+
className: "mt-2",
|
|
100
|
+
children
|
|
101
|
+
})
|
|
102
|
+
]
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region src/client/components/mdx/typographics.tsx
|
|
107
|
+
const Anchor = ({ href, children, className, ...props }) => {
|
|
108
|
+
return /* @__PURE__ */ jsx(Link, {
|
|
109
|
+
href: href || "",
|
|
110
|
+
className: cn("text-primary-500 hover:text-primary-400 dark:text-primary-500 hover:underline font-medium transition-colors duration-200", className),
|
|
111
|
+
...props,
|
|
112
|
+
children
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
const HEADING_CLASSES = {
|
|
116
|
+
1: "text-3xl sm:text-[2.5rem] font-extrabold tracking-tight text-body mb-4 leading-tight",
|
|
117
|
+
2: "text-2xl sm:text-[1.75rem] font-bold tracking-tight text-body mt-14 mb-5 pb-2 border-b border-subtle scroll-mt-24",
|
|
118
|
+
3: "text-lg sm:text-[1.4rem] font-semibold tracking-tight text-body mt-10 mb-4 scroll-mt-24",
|
|
119
|
+
4: "text-base sm:text-[1.1rem] font-semibold tracking-tight text-body mt-8 mb-3 scroll-mt-24",
|
|
120
|
+
5: "text-sm sm:text-[0.9rem] font-semibold tracking-tight text-body mt-6 mb-2 scroll-mt-24",
|
|
121
|
+
6: "text-xs sm:text-[0.75rem] font-semibold tracking-tight text-body mt-6 mb-2 scroll-mt-24"
|
|
122
|
+
};
|
|
123
|
+
const Heading = ({ level, className, ...props }) => {
|
|
124
|
+
return /* @__PURE__ */ jsx(Heading$1, {
|
|
125
|
+
level,
|
|
126
|
+
className: cn(HEADING_CLASSES[level] || "", className),
|
|
127
|
+
...props
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
const Typographics = {
|
|
131
|
+
a: Anchor,
|
|
132
|
+
h1: (props) => /* @__PURE__ */ jsx(Heading, {
|
|
133
|
+
level: 1,
|
|
134
|
+
...props
|
|
135
|
+
}),
|
|
136
|
+
h2: (props) => /* @__PURE__ */ jsx(Heading, {
|
|
137
|
+
level: 2,
|
|
138
|
+
...props
|
|
139
|
+
}),
|
|
140
|
+
h3: (props) => /* @__PURE__ */ jsx(Heading, {
|
|
141
|
+
level: 3,
|
|
142
|
+
...props
|
|
143
|
+
}),
|
|
144
|
+
h4: (props) => /* @__PURE__ */ jsx(Heading, {
|
|
145
|
+
level: 4,
|
|
146
|
+
...props
|
|
147
|
+
}),
|
|
148
|
+
h5: (props) => /* @__PURE__ */ jsx(Heading, {
|
|
149
|
+
level: 5,
|
|
150
|
+
...props
|
|
151
|
+
}),
|
|
152
|
+
h6: (props) => /* @__PURE__ */ jsx(Heading, {
|
|
153
|
+
level: 6,
|
|
154
|
+
...props
|
|
155
|
+
}),
|
|
156
|
+
p: ({ className, ...props }) => /* @__PURE__ */ jsx("p", {
|
|
157
|
+
className: cn("text-paragraph leading-relaxed my-5", className),
|
|
158
|
+
...props
|
|
159
|
+
}),
|
|
160
|
+
strong: ({ className, ...props }) => /* @__PURE__ */ jsx("strong", {
|
|
161
|
+
className: cn("font-semibold text-body", className),
|
|
162
|
+
...props
|
|
163
|
+
}),
|
|
164
|
+
mark: ({ className, ...props }) => /* @__PURE__ */ jsx("mark", {
|
|
165
|
+
className: cn("bg-primary-500/10 text-primary-500 font-semibold px-1.5 py-0.5 rounded-md", className),
|
|
166
|
+
...props
|
|
167
|
+
}),
|
|
168
|
+
blockquote: ({ className, ...props }) => /* @__PURE__ */ jsx("blockquote", {
|
|
169
|
+
className: cn("border-l-4 border-primary-500 bg-soft/30 pl-4 py-2 my-6 italic text-muted rounded-r-lg", className),
|
|
170
|
+
...props
|
|
171
|
+
}),
|
|
172
|
+
hr: ({ className, ...props }) => /* @__PURE__ */ jsx("hr", {
|
|
173
|
+
className: cn("my-8 border-t border-subtle", className),
|
|
174
|
+
...props
|
|
175
|
+
}),
|
|
176
|
+
ul: ({ className, ...props }) => /* @__PURE__ */ jsx("ul", {
|
|
177
|
+
className: cn("list-disc pl-6 my-5 space-y-2 text-paragraph", className),
|
|
178
|
+
...props
|
|
179
|
+
}),
|
|
180
|
+
ol: ({ className, ...props }) => /* @__PURE__ */ jsx("ol", {
|
|
181
|
+
className: cn("list-decimal pl-6 my-5 space-y-2 text-paragraph", className),
|
|
182
|
+
...props
|
|
183
|
+
}),
|
|
184
|
+
li: ({ className, ...props }) => /* @__PURE__ */ jsx("li", {
|
|
185
|
+
className: cn("pl-1", className),
|
|
186
|
+
...props
|
|
187
|
+
})
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region src/client/components/mdx/table.tsx
|
|
192
|
+
const Table = (props) => /* @__PURE__ */ jsx("div", {
|
|
193
|
+
className: "my-6 w-full overflow-x-auto rounded-xl border border-subtle bg-surface/30",
|
|
194
|
+
children: /* @__PURE__ */ jsx("table", {
|
|
195
|
+
className: "w-full border-collapse text-left text-sm",
|
|
196
|
+
...props
|
|
197
|
+
})
|
|
198
|
+
});
|
|
199
|
+
const TableHead = (props) => /* @__PURE__ */ jsx("thead", {
|
|
200
|
+
className: cn("border-b border-subtle bg-soft/50", props.className),
|
|
201
|
+
...props
|
|
202
|
+
});
|
|
203
|
+
const TableBody = (props) => /* @__PURE__ */ jsx("tbody", { ...props });
|
|
204
|
+
const TableRow = (props) => /* @__PURE__ */ jsx("tr", {
|
|
205
|
+
className: cn("border-b border-subtle last:border-0 even:bg-soft/10 hover:bg-soft/20 transition-colors", props.className),
|
|
206
|
+
...props
|
|
207
|
+
});
|
|
208
|
+
const TableHeader = (props) => /* @__PURE__ */ jsx("th", {
|
|
209
|
+
className: cn("px-4 py-3 font-semibold text-body text-xs font-mono", props.className),
|
|
210
|
+
...props
|
|
211
|
+
});
|
|
212
|
+
const TableCell = (props) => /* @__PURE__ */ jsx("td", {
|
|
213
|
+
className: cn("px-4 py-3 text-paragraph leading-relaxed", props.className),
|
|
214
|
+
...props
|
|
215
|
+
});
|
|
216
|
+
const TableComponents = {
|
|
217
|
+
table: Table,
|
|
218
|
+
thead: TableHead,
|
|
219
|
+
tbody: TableBody,
|
|
220
|
+
tr: TableRow,
|
|
221
|
+
th: TableHeader,
|
|
222
|
+
td: TableCell
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region src/client/utils/react-to-text.ts
|
|
227
|
+
const reactToText = (node, resolvers) => {
|
|
228
|
+
if (node == null || typeof node === "boolean") return "";
|
|
229
|
+
if (typeof node === "string" || typeof node === "number") return String(node);
|
|
230
|
+
if (Array.isArray(node)) return node.map((n) => reactToText(n, resolvers)).join("");
|
|
231
|
+
if (isValidElement(node)) {
|
|
232
|
+
const resolver = resolvers?.get(node.type);
|
|
233
|
+
if (resolver) return resolver(node.props);
|
|
234
|
+
return reactToText(node.props.children, resolvers);
|
|
235
|
+
}
|
|
236
|
+
return "";
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
//#endregion
|
|
240
|
+
//#region src/client/utils/copy-clipboard.ts
|
|
241
|
+
/**
|
|
242
|
+
* Copy text to clipboard.
|
|
243
|
+
* @param text - The text to copy.
|
|
244
|
+
* @returns True if the text was copied successfully.
|
|
245
|
+
*/
|
|
246
|
+
const copyToClipboard = async (text) => {
|
|
247
|
+
try {
|
|
248
|
+
await navigator.clipboard.writeText(text);
|
|
249
|
+
return true;
|
|
250
|
+
} catch {
|
|
251
|
+
const textarea = document.createElement("textarea");
|
|
252
|
+
textarea.value = text;
|
|
253
|
+
textarea.style.position = "fixed";
|
|
254
|
+
textarea.style.opacity = "0";
|
|
255
|
+
document.body.appendChild(textarea);
|
|
256
|
+
textarea.select();
|
|
257
|
+
document.execCommand("copy");
|
|
258
|
+
document.body.removeChild(textarea);
|
|
259
|
+
return true;
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
//#endregion
|
|
264
|
+
//#region src/client/components/mdx/use-code-block.ts
|
|
265
|
+
function useCodeBlock(props) {
|
|
266
|
+
const [copied, setCopied] = useState(false);
|
|
267
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
268
|
+
const [isExpandable, setIsExpandable] = useState(false);
|
|
269
|
+
const preRef = useRef(null);
|
|
270
|
+
const handleCopy = useCallback(async () => {
|
|
271
|
+
copyToClipboard(preRef.current?.textContent ?? "");
|
|
272
|
+
setCopied(true);
|
|
273
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
274
|
+
}, []);
|
|
275
|
+
useEffect(() => {
|
|
276
|
+
const lines = (preRef.current?.textContent ?? "").trim().split("\n").length;
|
|
277
|
+
setIsExpandable(lines > 6);
|
|
278
|
+
}, [props.children, props.highlightedHtml]);
|
|
279
|
+
return {
|
|
280
|
+
copied,
|
|
281
|
+
isExpanded,
|
|
282
|
+
setIsExpanded,
|
|
283
|
+
isExpandable,
|
|
284
|
+
preRef,
|
|
285
|
+
handleCopy,
|
|
286
|
+
shouldTruncate: isExpandable && !isExpanded
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
//#endregion
|
|
291
|
+
//#region src/client/components/mdx/code-block.tsx
|
|
292
|
+
const langIconMap = {
|
|
293
|
+
ts: TypeScript,
|
|
294
|
+
tsx: React$1,
|
|
295
|
+
js: JavaScript,
|
|
296
|
+
jsx: React$1,
|
|
297
|
+
json: Json,
|
|
298
|
+
css: Css,
|
|
299
|
+
html: BracketsOrange,
|
|
300
|
+
md: Markdown,
|
|
301
|
+
mdx: Markdown,
|
|
302
|
+
bash: Shell,
|
|
303
|
+
sh: Shell,
|
|
304
|
+
yaml: Yaml,
|
|
305
|
+
yml: Yaml,
|
|
306
|
+
rs: Rust,
|
|
307
|
+
rust: Rust,
|
|
308
|
+
toml: BracketsRed,
|
|
309
|
+
csv: Csv
|
|
310
|
+
};
|
|
311
|
+
const CopyButton = ({ copied, handleCopy }) => {
|
|
312
|
+
return /* @__PURE__ */ jsx(Tooltip, {
|
|
313
|
+
content: copied ? "Copied!" : "Copy code",
|
|
314
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
315
|
+
onPress: handleCopy,
|
|
316
|
+
className: cn("grid place-items-center size-8 bg-transparent outline-none cursor-pointer transition-all duration-200 hover:scale-110 active:scale-95 [&>svg]:size-4 [&>svg]:stroke-2 z-10", copied ? "text-emerald-400" : "text-muted hover:text-body"),
|
|
317
|
+
"aria-label": "Copy code",
|
|
318
|
+
children: copied ? /* @__PURE__ */ jsx(Check, { size: 20 }) : /* @__PURE__ */ jsx(Copy, { size: 20 })
|
|
319
|
+
})
|
|
320
|
+
});
|
|
321
|
+
};
|
|
322
|
+
function CodeBlock(props) {
|
|
323
|
+
const { children, hideCopy = false, highlightedHtml, "data-highlighted-html": dataHighlightedHtml, title, "data-title": dataTitle, "data-lang": dataLang, plain = false, ...rest } = props;
|
|
324
|
+
const rawHighlightedHtml = highlightedHtml || dataHighlightedHtml;
|
|
325
|
+
const effectiveHighlightedHtml = typeof rawHighlightedHtml === "string" ? rawHighlightedHtml.replace(/<span class="line">\s*(?:<span[^>]*>\s*<\/span>)?\s*<\/span>\s*(<\/code>\s*<\/pre>)/g, "$1") : rawHighlightedHtml;
|
|
326
|
+
const effectiveTitle = title || dataTitle;
|
|
327
|
+
const lang = props.lang || dataLang || "";
|
|
328
|
+
const { copied, isExpanded, setIsExpanded, isExpandable, preRef, handleCopy, shouldTruncate } = useCodeBlock(props);
|
|
329
|
+
const LangIcon = langIconMap[lang];
|
|
330
|
+
return /* @__PURE__ */ jsxs(CodeBlock$1, {
|
|
331
|
+
plain,
|
|
332
|
+
className: props.className,
|
|
333
|
+
children: [(effectiveTitle || !hideCopy) && /* @__PURE__ */ jsxs(CodeBlockHeader, {
|
|
334
|
+
className: cn({ "absolute top-2 left-0 w-full": !effectiveTitle }),
|
|
335
|
+
children: [/* @__PURE__ */ jsx(CodeBlockGroup, { children: effectiveTitle && /* @__PURE__ */ jsxs(Fragment, { children: [LangIcon ? /* @__PURE__ */ jsx(LangIcon, { size: 14 }) : /* @__PURE__ */ jsx(File, {
|
|
336
|
+
size: 14,
|
|
337
|
+
className: "opacity-60"
|
|
338
|
+
}), /* @__PURE__ */ jsx("span", { children: effectiveTitle })] }) }), /* @__PURE__ */ jsx("div", {
|
|
339
|
+
className: "flex items-center gap-1",
|
|
340
|
+
children: !hideCopy && /* @__PURE__ */ jsx(CopyButton, {
|
|
341
|
+
copied,
|
|
342
|
+
handleCopy
|
|
343
|
+
})
|
|
344
|
+
})]
|
|
345
|
+
}), /* @__PURE__ */ jsxs(CodeBlockContent, {
|
|
346
|
+
shouldTruncate,
|
|
347
|
+
children: [effectiveHighlightedHtml ? /* @__PURE__ */ jsx("div", {
|
|
348
|
+
ref: preRef,
|
|
349
|
+
className: "shiki-wrapper overflow-x-auto [&>pre]:m-0! [&>pre]:rounded-none! [&>pre]:border-none! [&>pre]:bg-inherit! [&>pre>code]:grid! [&>pre>code]:p-5! [&>pre>code]:text-[0.875rem]! [&>pre>code]:leading-[1.6]! [&>.shiki.shiki-themes]:bg-transparent!",
|
|
350
|
+
dangerouslySetInnerHTML: { __html: effectiveHighlightedHtml }
|
|
351
|
+
}) : /* @__PURE__ */ jsx("pre", {
|
|
352
|
+
ref: preRef,
|
|
353
|
+
className: "m-0! p-5! rounded-none! border-none! bg-inherit! font-mono text-[0.875rem] leading-[1.6] overflow-x-auto",
|
|
354
|
+
...rest,
|
|
355
|
+
children: reactToText(children).trimEnd()
|
|
356
|
+
}), isExpandable && /* @__PURE__ */ jsx("div", {
|
|
357
|
+
className: cn(shouldTruncate ? "absolute bottom-0 inset-x-0 h-24 bg-linear-to-t from-(--color-code-bg) to-transparent flex items-end justify-center pb-4 z-10" : "relative flex justify-center pb-4 pt-1 -mt-4"),
|
|
358
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
359
|
+
onPress: () => setIsExpanded(!isExpanded),
|
|
360
|
+
className: "rounded-full bg-surface border border-subtle px-5 py-2 text-[0.8125rem] font-medium text-body outline-none cursor-pointer transition-all hover:bg-soft hover:-translate-y-px backdrop-blur-md",
|
|
361
|
+
children: isExpanded ? "Show less" : "Expand code"
|
|
362
|
+
})
|
|
363
|
+
})]
|
|
364
|
+
})]
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
//#endregion
|
|
369
|
+
//#region src/client/components/mdx/image.tsx
|
|
370
|
+
const Image = ({ src, alt, title, theme, className, ...props }) => {
|
|
371
|
+
const { theme: themeContext } = useTheme();
|
|
372
|
+
if (!src) return null;
|
|
373
|
+
if (theme !== themeContext) return null;
|
|
374
|
+
const caption = title || alt;
|
|
375
|
+
return /* @__PURE__ */ jsxs("figure", {
|
|
376
|
+
className: "my-6 sm:my-8 flex flex-col items-center justify-center group not-prose",
|
|
377
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
378
|
+
className: "relative w-full overflow-hidden rounded-lg sm:rounded-2xl border border-subtle bg-soft/30 transition-all duration-300 sm:max-w-[85%] lg:max-w-full",
|
|
379
|
+
children: /* @__PURE__ */ jsx(Image$1, {
|
|
380
|
+
src,
|
|
381
|
+
alt: alt || "",
|
|
382
|
+
theme,
|
|
383
|
+
loading: "lazy",
|
|
384
|
+
decoding: "async",
|
|
385
|
+
className: cn("w-full h-auto object-contain transition-transform duration-500 group-hover:scale-[1.01] my-0 rounded-md sm:rounded-xl block", className),
|
|
386
|
+
...props
|
|
387
|
+
})
|
|
388
|
+
}), caption && /* @__PURE__ */ jsx("figcaption", {
|
|
389
|
+
className: "mt-2 sm:mt-3 text-center text-xs sm:text-sm text-muted font-medium select-none tracking-wide opacity-90 sm:opacity-80 group-hover:opacity-100 transition-opacity duration-300 px-2",
|
|
390
|
+
children: caption
|
|
391
|
+
})]
|
|
392
|
+
});
|
|
393
|
+
};
|
|
394
|
+
const ImageComponents = {
|
|
395
|
+
img: Image,
|
|
396
|
+
Image
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
//#endregion
|
|
400
|
+
//#region src/client/components/mdx/card.tsx
|
|
401
|
+
function Card({ className, title, icon, href, children, ...props }) {
|
|
402
|
+
const [position, setPosition] = useState({
|
|
403
|
+
x: 0,
|
|
404
|
+
y: 0
|
|
405
|
+
});
|
|
406
|
+
const [opacity, setOpacity] = useState(0);
|
|
407
|
+
const cardRef = useRef(null);
|
|
408
|
+
const handleMouseMove = (e) => {
|
|
409
|
+
if (!cardRef.current) return;
|
|
410
|
+
const rect = cardRef.current.getBoundingClientRect();
|
|
411
|
+
setPosition({
|
|
412
|
+
x: e.clientX - rect.left,
|
|
413
|
+
y: e.clientY - rect.top
|
|
414
|
+
});
|
|
415
|
+
};
|
|
416
|
+
const handleMouseEnter = () => setOpacity(1);
|
|
417
|
+
const handleMouseLeave = () => setOpacity(0);
|
|
418
|
+
const Wrapper = href ? "a" : "div";
|
|
419
|
+
const spotlightColor = "var(--color-primary-500, #eb5828)";
|
|
420
|
+
return /* @__PURE__ */ jsxs(Wrapper, {
|
|
421
|
+
ref: cardRef,
|
|
422
|
+
href,
|
|
423
|
+
onMouseMove: handleMouseMove,
|
|
424
|
+
onMouseEnter: handleMouseEnter,
|
|
425
|
+
onMouseLeave: handleMouseLeave,
|
|
426
|
+
className: cn("group relative flex flex-col gap-3 rounded-2xl border p-6 overflow-hidden transition-all duration-300", "hover:shadow-lg dark:hover:shadow-none hover:-translate-y-0.5", "bg-surface border-subtle text-paragraph", href && "cursor-pointer", className),
|
|
427
|
+
...props,
|
|
428
|
+
children: [
|
|
429
|
+
/* @__PURE__ */ jsx("div", {
|
|
430
|
+
className: "pointer-events-none absolute inset-0 transition-opacity duration-300",
|
|
431
|
+
style: {
|
|
432
|
+
opacity,
|
|
433
|
+
background: `radial-gradient(600px circle at ${position.x}px ${position.y}px, color-mix(in srgb, ${spotlightColor} 8%, transparent), transparent 40%)`
|
|
434
|
+
}
|
|
435
|
+
}),
|
|
436
|
+
/* @__PURE__ */ jsx("div", {
|
|
437
|
+
className: "pointer-events-none absolute inset-0 rounded-2xl transition-opacity duration-300",
|
|
438
|
+
style: {
|
|
439
|
+
opacity,
|
|
440
|
+
padding: "1px",
|
|
441
|
+
background: `radial-gradient(400px circle at ${position.x}px ${position.y}px, color-mix(in srgb, ${spotlightColor} 50%, transparent), transparent 40%)`,
|
|
442
|
+
WebkitMask: "linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)",
|
|
443
|
+
WebkitMaskComposite: "xor",
|
|
444
|
+
maskComposite: "exclude"
|
|
445
|
+
}
|
|
446
|
+
}),
|
|
447
|
+
/* @__PURE__ */ jsxs("div", {
|
|
448
|
+
className: "relative z-10 flex items-center gap-3",
|
|
449
|
+
children: [icon && /* @__PURE__ */ jsx("div", {
|
|
450
|
+
className: cn("shrink-0 transition-transform duration-500 group-hover:rotate-[15deg] group-hover:scale-110 flex items-center justify-center text-muted group-hover:text-primary-500", "[&>svg]:w-6 [&>svg]:h-6 [&>svg]:stroke-[1.5]"),
|
|
451
|
+
children: icon
|
|
452
|
+
}), title && /* @__PURE__ */ jsx("h3", {
|
|
453
|
+
className: "font-semibold text-base m-0 leading-none text-body",
|
|
454
|
+
children: title
|
|
455
|
+
})]
|
|
456
|
+
}),
|
|
457
|
+
/* @__PURE__ */ jsx("div", {
|
|
458
|
+
className: "relative z-10 text-[0.875rem] leading-[1.6] opacity-90 prose prose-neutral dark:prose-invert max-w-none [&>p]:m-0 [&>p+p]:mt-2",
|
|
459
|
+
children
|
|
460
|
+
})
|
|
461
|
+
]
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
//#endregion
|
|
466
|
+
//#region src/client/components/mdx/cards.tsx
|
|
467
|
+
function Cards({ children, className, cols = 2, ...props }) {
|
|
468
|
+
return /* @__PURE__ */ jsx("div", {
|
|
469
|
+
className: cn("grid gap-4 my-6", {
|
|
470
|
+
"grid-cols-1": cols === 1,
|
|
471
|
+
"grid-cols-1 sm:grid-cols-2": cols === 2,
|
|
472
|
+
"grid-cols-1 sm:grid-cols-2 md:grid-cols-3": cols === 3,
|
|
473
|
+
"grid-cols-1 sm:grid-cols-2 lg:grid-cols-4": cols === 4
|
|
474
|
+
}, className),
|
|
475
|
+
...props,
|
|
476
|
+
children
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
//#endregion
|
|
481
|
+
//#region src/client/components/mdx/index.ts
|
|
482
|
+
const mdx_components_default = {
|
|
483
|
+
...Typographics,
|
|
484
|
+
...TableComponents,
|
|
485
|
+
...ImageComponents,
|
|
486
|
+
pre: CodeBlock,
|
|
487
|
+
Field,
|
|
488
|
+
Callout,
|
|
489
|
+
Card,
|
|
490
|
+
Cards
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
//#endregion
|
|
494
|
+
export { reactToText as a, copyToClipboard as i, Cards as n, Card as r, mdx_components_default as t };
|
package/dist/node/cli-entry.cjs
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* Copyright (c) 2026 Jesus Alcala
|
|
5
5
|
* Licensed under the MIT License.
|
|
6
6
|
*/
|
|
7
|
-
const e=require(`../chunk-CU-zTemE.cjs`),t=require(`../routes-2k3tbUmC.cjs`),n=require(`../node-
|
|
7
|
+
const e=require(`../chunk-CU-zTemE.cjs`),t=require(`../routes-2k3tbUmC.cjs`),n=require(`../node-BSM4qcDK.cjs`),r=require(`../doctor-jMxWZyLJ.cjs`);let i=require(`vite`),a=require(`node:path`);a=e.t(a);let o=require(`@bdocs/dui`),s=require(`cac`);s=e.t(s);let c=require(`@bdocs/ssg/node`);async function l(e=process.cwd()){r.u();try{let t=await n.n(e,`development`);t.logLevel=`warn`,t.clearScreen=!1;let r=await(0,c.createServer)(t);await r.listen();let i=r.resolvedUrls;console.log((0,o.devServer)(i?.local?.[0]??`http://localhost:5173`,i?.network?.[0]??null)),r.bindCLIShortcuts({print:!1})}catch(e){(0,o.error)(`Failed to start dev server:`,e),process.exit(1)}}async function u(e=process.cwd()){r.u();try{let i=await n.n(e,`production`),s=await r.f(`docs`,e),l=await t.t(a.default.resolve(e,`docs`),s,i.base),u={};for(let e of l)if(e.path&&e.componentPath){u[e.path]=e.componentPath;let t=e.path.replace(/\/$/,``);u[t]=e.componentPath}await(0,c.build)({entry:`boltdocs/entry`,routeToSourceFileMap:u,cacheDir:a.default.resolve(e,`.boltdocs`)},i),(0,o.success)(`SSG build completed successfully!`),process.exit(0)}catch(e){(0,o.error)(`Build failed:`,e),process.exit(1)}}async function d(e=process.cwd()){try{let t=await n.n(e,`production`);t.logLevel=`warn`,t.clearScreen=!1;let r=await(0,i.preview)(t),a=r.resolvedUrls;console.log(r(a?.local?.[0]??`http://localhost:4173`,a?.network?.[0]??null))}catch(e){(0,o.error)(`Failed to start preview server:`,e),process.exit(1)}}(0,o.configure)({prefix:`boltdocs`,devServerTitle:`boltdocs dev server`,previewServerTitle:`boltdocs preview server`,updateCommand:`pnpm add boltdocs@latest`});const f=(0,s.default)(`boltdocs`);f.command(`[root]`,`Start development server`).alias(`dev`).action(l),f.command(`build [root]`,`Build for production`).action(u),f.command(`preview [root]`,`Preview production build`).action(d),f.command(`doctor [root]`,`Check the health of your documentation`).option(`--fix`,`Automatically fix broken internal links and sync translations`).option(`--check-external`,`Verify external links (slower)`).option(`--init`,`Initialize doctor.json with default configuration`).action(async(e,t)=>{let{doctorAction:n}=await Promise.resolve().then(()=>require(`../doctor-CrytFkqW.cjs`));await n(e,t)}),f.command(`generate-changelog <file>`,`Generate changelog documentation from CHANGELOG.md`).option(`-o, --output <path>`,`Output folder (default: docs/changelog)`,{default:`docs/changelog`}).option(`-t, --title <text>`,`Title for changelog pages`,{default:`Changelog`}).option(`--infer-tab`,`Infer tab from folder name (default: true)`,{default:!0}).option(`-l, --limit <number>`,`Limit number of versions to generate`).action(async(e,t)=>{let{generateChangelog:n}=await Promise.resolve().then(()=>require(`../generator-CHqxiQhF.cjs`));await n(e,{output:t.output,title:t.title,inferTab:t.inferTab,limit:t.limit?parseInt(String(t.limit),10):void 0})}),f.help(),f.version(`2.0.0`),f.parse();
|
package/dist/node/cli-entry.mjs
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* Copyright (c) 2026 Jesus Alcala
|
|
5
5
|
* Licensed under the MIT License.
|
|
6
6
|
*/
|
|
7
|
-
import{t as e}from"../routes-CpxZIsMM.mjs";import{n as t}from"../node-
|
|
7
|
+
import{t as e}from"../routes-CpxZIsMM.mjs";import{n as t}from"../node-BspZN3R2.mjs";import{a as n,r}from"../doctor-Be7Ly1oM.mjs";import{preview as i}from"vite";import a from"node:path";import{configure as o,devServer as s,error as c,success as l}from"@bdocs/dui";import u from"cac";import{build as d,createServer as f}from"@bdocs/ssg/node";async function p(e=process.cwd()){r();try{let n=await t(e,`development`);n.logLevel=`warn`,n.clearScreen=!1;let r=await f(n);await r.listen();let i=r.resolvedUrls;console.log(s(i?.local?.[0]??`http://localhost:5173`,i?.network?.[0]??null)),r.bindCLIShortcuts({print:!1})}catch(e){c(`Failed to start dev server:`,e),process.exit(1)}}async function m(i=process.cwd()){r();try{let r=await t(i,`production`),o=await n(`docs`,i),s=await e(a.resolve(i,`docs`),o,r.base),c={};for(let e of s)if(e.path&&e.componentPath){c[e.path]=e.componentPath;let t=e.path.replace(/\/$/,``);c[t]=e.componentPath}await d({entry:`boltdocs/entry`,routeToSourceFileMap:c,cacheDir:a.resolve(i,`.boltdocs`)},r),l(`SSG build completed successfully!`),process.exit(0)}catch(e){c(`Build failed:`,e),process.exit(1)}}async function h(e=process.cwd()){try{let n=await t(e,`production`);n.logLevel=`warn`,n.clearScreen=!1;let r=await i(n),a=r.resolvedUrls;console.log(r(a?.local?.[0]??`http://localhost:4173`,a?.network?.[0]??null))}catch(e){c(`Failed to start preview server:`,e),process.exit(1)}}o({prefix:`boltdocs`,devServerTitle:`boltdocs dev server`,previewServerTitle:`boltdocs preview server`,updateCommand:`pnpm add boltdocs@latest`});const g=u(`boltdocs`);g.command(`[root]`,`Start development server`).alias(`dev`).action(p),g.command(`build [root]`,`Build for production`).action(m),g.command(`preview [root]`,`Preview production build`).action(h),g.command(`doctor [root]`,`Check the health of your documentation`).option(`--fix`,`Automatically fix broken internal links and sync translations`).option(`--check-external`,`Verify external links (slower)`).option(`--init`,`Initialize doctor.json with default configuration`).action(async(e,t)=>{let{doctorAction:n}=await import(`../doctor-Be7Ly1oM.mjs`).then(e=>e.t);await n(e,t)}),g.command(`generate-changelog <file>`,`Generate changelog documentation from CHANGELOG.md`).option(`-o, --output <path>`,`Output folder (default: docs/changelog)`,{default:`docs/changelog`}).option(`-t, --title <text>`,`Title for changelog pages`,{default:`Changelog`}).option(`--infer-tab`,`Infer tab from folder name (default: true)`,{default:!0}).option(`-l, --limit <number>`,`Limit number of versions to generate`).action(async(e,t)=>{let{generateChangelog:n}=await import(`../generator-ClVanhvi.mjs`);await n(e,{output:t.output,title:t.title,inferTab:t.inferTab,limit:t.limit?parseInt(String(t.limit),10):void 0})}),g.help(),g.version(`2.0.0`),g.parse();export{};
|
package/dist/node/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.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`../utils-CKunkU96.cjs`),t=require(`../node-
|
|
6
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`../utils-CKunkU96.cjs`),t=require(`../node-BSM4qcDK.cjs`),n=require(`../doctor-jMxWZyLJ.cjs`);exports.BoltdocsPluginStore=t.u,exports.PluginCompatibilityError=t.d,exports.PluginError=t.f,exports.PluginHookError=t.p,exports.PluginLifecycleManager=t.a,exports.PluginPermissionError=t.m,exports.PluginSandbox=t.o,exports.PluginValidationError=t.h,exports.SecurePluginSchema=t.s,exports.createPlugin=t.i,exports.createViteConfig=t.n,exports.default=t.t,exports.defineConfig=n.m,exports.generateEntryCode=t.r,exports.hasPermission=t.c,exports.normalizePath=e.l,exports.resolveConfig=n.f,exports.sanitizeFilename=e.d,exports.validatePlugins=t.l;
|
package/dist/node/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{d as e,l as t}from"../utils-CG65J0Sc.mjs";import{a as n,c as r,d as i,f as a,h as o,i as s,l as c,m as l,n as u,o as d,p as f,r as p,s as m,t as h,u as g}from"../node-
|
|
6
|
+
import{d as e,l as t}from"../utils-CG65J0Sc.mjs";import{a as n,c as r,d as i,f as a,h as o,i as s,l as c,m as l,n as u,o as d,p as f,r as p,s as m,t as h,u as g}from"../node-BspZN3R2.mjs";import{a as _,s as v}from"../doctor-Be7Ly1oM.mjs";export{g as BoltdocsPluginStore,i as PluginCompatibilityError,a as PluginError,f as PluginHookError,n as PluginLifecycleManager,l as PluginPermissionError,d as PluginSandbox,o as PluginValidationError,m as SecurePluginSchema,s as createPlugin,u as createViteConfig,h as default,v as defineConfig,p as generateEntryCode,r as hasPermission,t as normalizePath,_ as resolveConfig,e as sanitizeFilename,c as validatePlugins};
|
|
@@ -104,7 +104,7 @@ export const createRoot = ViteReactSSG(
|
|
|
104
104
|
const mdxComponents = components.default || components;
|
|
105
105
|
export default mdxComponents;
|
|
106
106
|
export * from '${e}';`}return`export default {};`}if(u===`layout`){let e=[`tsx`,`jsx`],n=null;for(let t of e){let e=c.default.resolve(a,`layout.${t}`);if(f.default.existsSync(e)){n=e;break}}if(n)return`import UserLayout from '${t.l(n)}';
|
|
107
|
-
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(u===`icons`){let e=[`tsx`,`jsx`,`ts`,`js`],n=null;for(let t of e){let e=c.default.resolve(a,`icons.${t}`);if(f.default.existsSync(e)){n=e;break}}return n?`import * as icons from '${t.l(n)}';\nexport default icons;`:`export default {};`}if(u===`search`){if(!K){let e=be(await r.t(a,l));K=`export default ${JSON.stringify(e,null,2)};`}return K}if(u===`client`){let e=__dirname,n=``;for(;e&&e!==c.default.parse(e).root;){let r=c.default.join(e,`src/client/index.ts`),i=c.default.join(e,`dist/client/index.mjs`),a=c.default.join(e,`client/index.ts`);if(f.default.existsSync(r)){n=t.l(r);break}if(f.default.existsSync(i)){n=t.l(i);break}if(f.default.existsSync(a)){n=t.l(a);break}e=c.default.dirname(e)}if(!n)throw Error(`[boltdocs] Could not resolve boltdocs/client entry point starting from ${__dirname}`);return`export * from '${n}';`}}}}const Ce={"X-Content-Type-Options":`nosniff`,"X-Frame-Options":`DENY`,"X-XSS-Protection":`1; mode=block`,"Referrer-Policy":`strict-origin-when-cross-origin`,"Permissions-Policy":`camera=(), microphone=(), geolocation=()`,"Strict-Transport-Security":`max-age=31536000; includeSubDomains`};function we(e){let t=process.env.NODE_ENV===`development`,n={"default-src":[`'self'`],"script-src":[`'self'`,`'unsafe-inline'`],"style-src":[`'self'`,`'unsafe-inline'`],"img-src":[`'self'`,`data:`,`https:`],"font-src":[`'self'`],"connect-src":[`'self'`]};return t&&(n[`script-src`]=[`'self'`,`'unsafe-eval'`,`'unsafe-inline'`],n[`style-src`]=[`'self'`,`'unsafe-inline'`]),Object.entries(n).map(([e,t])=>`${e} ${t.join(` `)}`).join(`; `)}const q=new Map;async function Te(e){try{let{data:n}=await t.u(e),r=JSON.stringify(n);return p.default.createHash(`md5`).update(r).digest(`hex`)}catch{return``}}function Ee(e){return q.get(e)}function De(e,t){q.set(e,t)}function Oe(e){q.delete(e)}function J(e,t){let n=e.moduleGraph.getModuleById(`\0virtual:boltdocs-${t}.ts`);n&&e.moduleGraph.invalidateModule(n)}function ke(e,n,a,o,s){let l=new Map;return{name:`vite-plugin-boltdocs-dev-server`,apply:`serve`,async configureServer(o){let u=s();await u?.runHook(`beforeDev`),i.s(e,process.cwd(),a()).catch(e=>{(0,d.error)(`Failed to generate initial link tree:`,e)}),setTimeout(async()=>{try{let{generateRoutes:t}=await Promise.resolve().then(()=>require(`./routes-DP1vmWRj.cjs`)),n=await t(e,a());for(let e of n)if(e.filePath){let t=c.default.relative(process.cwd(),e.filePath).replace(/\\/g,`/`),n=t.startsWith(`/`)?t:`/${t}`;await o.transformRequest(n).catch(()=>{}),await new Promise(e=>setTimeout(e,50))}}catch{}},1e3),o.middlewares.use((e,t,n)=>{process.env.NODE_ENV===`production`&&Object.entries(Ce).forEach(([e,n])=>{t.setHeader(e,n)});let r=a();r.security?.enableCSP&&t.setHeader(`Content-Security-Policy`,we(r)),n()}),o.middlewares.use((e,t,n)=>{if(e.url===`/robots.txt`){n();return}n()}),o.middlewares.use(async(e,t,n)=>{let r=e.url?.split(`?`)[0]||`/`,i=e.headers.accept||``,s=a(),c=/\.(js|css|png|jpe?g|gif|svg|ico|webp|woff2?|ttf|otf|mp4|webm|ogg|mp3|wav|flac|aac|pdf|zip|gz|map|json)$/i.test(r);if(i.includes(`text/html`)&&!c){let n=ue(s);n=de(n,s),n=await o.transformIndexHtml(e.url||`/`,n),t.statusCode=200,t.setHeader(`Content-Type`,`text/html`),t.end(n);return}n()});let f=i.d.map(e=>c.default.resolve(process.cwd(),e)),p=[`tsx`,`jsx`].map(t=>c.default.resolve(e,`layout.${t}`)),m=[`tsx`,`ts`,`jsx`,`js`],h=m.map(t=>c.default.resolve(e,`mdx-components.${t}`)),g=m.map(t=>c.default.resolve(e,`pages-external/index.${t}`)),_=m.map(t=>c.default.resolve(e,`icons.${t}`));o.watcher.add([...f,...h,...p,...g,..._]);let v=async(s,u)=>{try{let f=t.l(s);if(i.d.some(e=>f.endsWith(e))){o.restart();return}if(m.some(e=>f.endsWith(`mdx-components.${e}`))){i.h(a(),e),J(o,`mdx-components.tsx`),o.ws.send({type:`full-reload`});return}if(m.some(e=>f.endsWith(`icons.${e}`))){J(o,`icons.tsx`),o.ws.send({type:`full-reload`});return}if(f.endsWith(`layout.tsx`)||f.endsWith(`layout.jsx`)){J(o,`layout.tsx`),o.ws.send({type:`full-reload`});return}if(f.includes(`/pages-external/`)||f.includes(`\\pages-external\\`)){J(o,`entry`),o.ws.send({type:`full-reload`});return}if(!f.toLowerCase().startsWith(n.toLowerCase())||!t.s(f))return;if(u===`add`||u===`unlink`){u===`unlink`&&Oe(s),r.n(),xe();let t=a();i.h(t,e),J(o,`config`),J(o,`routes`),J(o,`search`),i.s(e,process.cwd(),t).catch(e=>{(0,d.error)(`Failed to update link tree:`,e)}),o.ws.send({type:`custom`,event:`boltdocs:config-update`,data:{theme:t?.theme,i18n:t?.i18n,versions:t?.versions,siteUrl:t?.siteUrl}}),o.ws.send({type:`full-reload`});return}l.has(f)&&clearTimeout(l.get(f)),l.set(f,setTimeout(async()=>{l.delete(f);try{let n=Ee(s),i=await Te(s);De(s,i),r.r(s),n!==void 0&&n!==i&&(J(o,`routes`),J(o,`search`));let a=t.l(c.default.relative(e,s)),l=o.moduleGraph.getModulesByFile(f);if(l)for(let e of l)o.moduleGraph.invalidateModule(e);o.ws.send({type:`custom`,event:`boltdocs:mdx-update`,data:{file:f,relPath:a}})}catch(e){(0,d.error)(`HMR error processing content change:`,e)}},150))}catch(e){(0,d.error)(`HMR error during ${u} event:`,e)}};o.watcher.on(`add`,e=>v(e,`add`)),o.watcher.on(`unlink`,e=>v(e,`unlink`)),o.watcher.on(`change`,e=>v(e,`change`)),await u?.runHook(`afterDev`)},handleHotUpdate({file:e,server:r}){let i=t.l(e);if(i.toLowerCase().startsWith(n.toLowerCase())&&t.s(i))return[]}}}const Y=_.createRequire(require(`url`).pathToFileURL(__filename).href);function Ae(e){let t=c.default.dirname(e);for(;t&&t!==c.default.dirname(t);){let e=c.default.join(t,`package.json`);if(f.default.existsSync(e))return e;t=c.default.dirname(t)}return null}function je(e){let t=e.split(`/`);return e.startsWith(`@`)?{packageName:t.slice(0,2).join(`/`),subpath:t.slice(2).join(`/`)}:{packageName:t[0],subpath:t.slice(1).join(`/`)}}function X(e,t=Y){try{let{packageName:n,subpath:r}=je(e),i;try{i=t.resolve(n+`/package.json`)}catch{i=Ae(t.resolve(n))||``}if(!i)throw Error(`Could not find package.json for ${n}`);let a=c.default.dirname(i),o=JSON.parse(f.default.readFileSync(i,`utf-8`)),s=``,l=r?`./`+r:`.`;if(o.exports){let e=o.exports[l]||o.exports[r];e&&(s=typeof e==`string`?e:e.import||e.default||e.require||e)}if(!s&&!r&&(s=o.module||o.main||`index.js`),typeof s==`object`&&(s=s.import||s.default||s.require||``),s){let e=c.default.resolve(a,s);if(f.default.existsSync(e))return e}}catch{}return t.resolve(e)}function Me(){let e=[`react`,`react-dom`,`react-router-dom`,`react-helmet-async`,`@bdocs/ssg`,`react-fast-compare`,`invariant`],n=[],r=Y;try{let e=c.default.join(process.cwd(),`node_modules/boltdocs/package.json`);if(f.default.existsSync(e)){let t=f.default.realpathSync(e);r=_.createRequire(t)}else r=_.createRequire(c.default.join(process.cwd(),`package.json`))}catch{}for(let t of e)try{let e=``;e=t===`@bdocs/ssg`||t===`react-router-dom`||t===`react-helmet-async`?X(t,r):r.resolve(t),e&&n.push(f.default.realpathSync(e))}catch{}if(r!==Y)for(let t of e)try{let e=``;e=t===`@bdocs/ssg`||t===`react-router-dom`||t===`react-helmet-async`?X(t,Y):Y.resolve(t),e&&n.push(f.default.realpathSync(e))}catch{}for(let e of[`react/jsx-runtime`,`react/jsx-dev-runtime`,`react-dom/client`]){try{n.push(f.default.realpathSync(r.resolve(e)))}catch{}if(r!==Y)try{n.push(f.default.realpathSync(Y.resolve(e)))}catch{}}return Array.from(new Set(n)).map(e=>t.l(e))}function Ne(e={},n){let a=c.default.resolve(process.cwd(),e.docsDir||`docs`),o=t.l(a),l=n,u,d=!1,p,h=[],g=()=>l;return[{name:`vite-plugin-boltdocs`,enforce:`pre`,async config(e,t){d=t.command===`build`;let n=!!(t.ssrBuild||t.ssr||e.build?.ssr),o=e.envDir||process.cwd(),u=(0,s.loadEnv)(t.mode,o,``);Object.assign(process.env,u),l||=await i.p(a);let m=(await Promise.resolve().then(()=>require(`./package-DrwtlXfk.cjs`))).version,g=ge(l.plugins||[],m);return l.plugins=g,p=new _e(g,l),h=g.flatMap(e=>H.getSanitizedCapabilities(e).vitePlugins||[]),d&&await p.runHook(`beforeBuild`),{ssgOptions:{entry:`boltdocs/entry`,htmlEntry:`index.html`,dirStyle:`flat`,includeAllRoutes:!0,mock:!0,script:`async`,beastiesOptions:{preload:`media`},onFinished:async e=>{let t=ce(se(await r.t(a,l)),l);t&&f.default.writeFileSync(c.default.join(e,`sitemap.xml`),t);let n=le(l);f.default.writeFileSync(c.default.join(e,`robots.txt`),n)}},build:{ssrManifest:d},optimizeDeps:{include:[`react`,`react-dom`,`react-dom/client`,`react-router-dom`,`react-helmet-async`,`react-fast-compare`,`invariant`],exclude:[`boltdocs`,`boltdocs/client`]},resolve:{alias:[{find:`react-router-dom`,replacement:X(`react-router-dom`)},{find:`react-helmet-async`,replacement:X(`react-helmet-async`)},{find:`@bdocs/ssg`,replacement:X(`@bdocs/ssg`)}],dedupe:[`react`,`react-dom`,...n?[]:[`react-router-dom`,`react-helmet-async`,`@bdocs/ssg`]]},ssr:{external:[`react`,`react-dom`,`react-router-dom`,`react-helmet-async`,`@bdocs/ssg`,`react-fast-compare`,`invariant`,...Me()],optimizeDeps:{include:[`react-fast-compare`,`invariant`]},noExternal:[]}}},configResolved(e){u=e,p?.runHook(`configResolved`,l)},resolveId(e,t,n){let r=[`react`,`react-dom`,`react-router-dom`,`react-helmet-async`,`@bdocs/ssg`].find(t=>e===t||e.startsWith(t+`/`)||e.includes(`/node_modules/${t}/`)||t.startsWith(`@`)&&e.includes(`/node_modules/${t.replace(`/`,c.default.sep)}/`));if(r&&n?.ssr){let t=e;if(!c.default.isAbsolute(e)){let n=Y;try{let e=c.default.join(process.cwd(),`node_modules/boltdocs/package.json`);if(f.default.existsSync(e)){let t=f.default.realpathSync(e);n=_.createRequire(t)}else n=_.createRequire(c.default.join(process.cwd(),`package.json`))}catch{}try{t=r===`@bdocs/ssg`||r===`react-router-dom`||r===`react-helmet-async`?X(e,n):n.resolve(e)}catch{try{t=r===`@bdocs/ssg`||r===`react-router-dom`||r===`react-helmet-async`?X(e,Y):Y.resolve(e)}catch{}}}try{t=f.default.realpathSync(t)}catch{}return{id:t,external:!0}}return null},transformIndexHtml:{order:`pre`,handler(e){return de(e,l)}},async buildEnd(){let{pool:e}=await Promise.resolve().then(()=>require(`./worker-pool-Crbqgw5R.cjs`));await e.terminate()},async closeBundle(){!d||u?.build?.ssr||(await p?.runHook(`afterBuild`),await p?.runHook(`buildEnd`))},configurePreviewServer(e){let t=u?.build?.outDir?c.default.resolve(u.root||process.cwd(),u.build.outDir):c.default.resolve(process.cwd(),`dist`);e.middlewares.use((e,n,r)=>{let i=e.url||`/`,a=i.split(`?`)[0].split(`#`)[0];if(c.default.extname(a))return r();let o=a.replace(/\/$/,``)||`/`,s=c.default.join(t,o,`index.html`);o!==`/`&&f.default.existsSync(s)&&(e.url=`${o}/index.html${i.includes(`?`)?`?${i.split(`?`)[1]}`:``}`),r()})}},Se(e,g,()=>u,a),ke(a,o,g,e=>{l=e},()=>p),{...(0,m.ViteImageOptimizer)({includePublic:!0,png:{quality:80},jpeg:{quality:80},jpg:{quality:80},webp:{quality:80},avif:{quality:80},svg:{multipass:!0,plugins:[{name:`preset-default`}]}}),apply:`build`},...h]}const Z=new n.r(`mdx`),Pe=[S.default.default||S.default,C.default.default||C.default,w.default.default||w.default,T.default.default||T.default,E.default.default||E.default,D.default.default||D.default,O.default.default||O.default],Fe=[k.default,A.default,j.default,M.default,N.default,P.default,F.default,I.default,re.default,ie.default,ae.default,oe.default,L.default];let Ie=null,Le=null;const Re=()=>(Ie??=(0,te.createJavaScriptRegexEngine)(),Ie),ze=async e=>Le||(Le=(0,ne.createHighlighterCore)({themes:Pe,langs:Fe,engine:Re()}),Le),Be={JSX_FLOW_ELEMENT:`mdxJsxFlowElement`,JSX_TEXT_ELEMENT:`mdxJsxTextElement`,JSX_ATTRIBUTE:`mdxJsxAttribute`,ELEMENT:`element`,TEXT:`text`,CODE:`code`},Ve={PRE:`pre`,CODE:`code`},Q={TITLE:`data-title`,LANG:`data-lang`,HIGHLIGHTED:`data-highlighted`,HIGHLIGHTED_HTML:`data-highlighted-html`},$={LINE_NUMBERS:`shiki-line-numbers`,WORD_WRAP:`shiki-word-wrap`,FALLBACK:`shiki-fallback`},He={LIGHT:`github-light`,DARK:`github-dark`},Ue={LANG:`plaintext`,MDX_DEFAULT_LANG:`text`},We=(e={})=>{let{activateByDefault:t=!1}=e;return{name:`boltdocs:line-numbers`,pre(e){let n=this.options.meta?.lineNumbers===!0;(t||n)&&this.addClassToHast(e,$.LINE_NUMBERS)}}},Ge=(e={})=>{let{activateByDefault:t=!1}=e;return{name:`boltdocs:word-wrap`,pre(e){let n=this.options.meta?.wordWrap===!0;(t||n)&&this.addClassToHast(e,$.WORD_WRAP)}}},Ke=()=>({name:`AddTitleProperty`,pre(e){let t=this.options.meta?.title;t&&(e.properties[Q.TITLE]=t)}}),qe=()=>({name:`AddLanguageProperty`,pre(e){e.properties[Q.LANG]=this.options.lang||Ue.LANG}});function Je(e){let t={};if(!e)return t;/lineNumbers|showLineNumbers/.test(e)&&(t.lineNumbers=!0),/wordWrap|word-wrap/.test(e)&&(t.wordWrap=!0);let n=e.match(/title=(["'])(.*?)\1/);return n&&(t.title=n[2]),t}var Ye=class{config;constructor(e){this.config=e}getTheme(){return this.config?.theme?.codeTheme||{light:He.LIGHT,dark:He.DARK}}async getHighlighter(){return await ze(this.getTheme())}getOptions(e,t){let n=this.getTheme(),r={},i=``;typeof t==`string`?(i=t,r=Je(t)):t&&(r=t,i=t.__raw||``);let a={lang:e||Ue.LANG,meta:{__raw:i,...r},transformers:[We(),Ge(),Ke(),qe()]};return typeof n==`object`?a.themes={light:n.light,dark:n.dark}:a.theme=n,a}async render(e,t,n){try{let r=await this.getHighlighter(),i=this.getOptions(t,n);return r.codeToHtml(e,i)}catch(t){return console.error(`[ShikiAdapter] Failed to render code:`,t),`<pre class="${$.FALLBACK}"><code>${Xe(e)}</code></pre>`}}};function Xe(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}let Ze=null,Qe;function $e(e){let t=JSON.stringify(e?.theme?.codeTheme||null);return(Ze===null||Qe!==t)&&(Ze=new Ye(e),Qe=t),Ze}function et(e){let t=$e(e);return async e=>{let n=await t.getHighlighter();(0,ee.visit)(e,Be.ELEMENT,e=>{if(e.tagName===Ve.PRE&&e.children?.[0]?.type===Be.ELEMENT&&e.children[0].tagName===Ve.CODE){let r=e.children[0],i=(r.properties?.className||[]).find(e=>e.startsWith(`language-`)),a=i?i.slice(9):Ue.MDX_DEFAULT_LANG;if(a===`mermaid`)return;let o=r.children?.[0]?.value||``,s=Je(r.properties?.metastring||r.data?.meta||``),c=t.getOptions(a,s),l=``;try{l=n.codeToHtml(o,c)}catch(e){console.error(`[rehypeShiki] Failed to highlight code block:`,e),l=`<pre class="${$.FALLBACK}"><code>${Xe(o)}</code></pre>`}e.properties=e.properties||{},s.title&&(e.properties[Q.TITLE]=s.title),e.properties[Q.HIGHLIGHTED]=`true`,e.properties[Q.HIGHLIGHTED_HTML]=l,e.properties[Q.LANG]=a,e.children=[]}})}}function tt(){return e=>{(0,ee.visit)(e,Be.CODE,e=>{e.meta&&(e.data=e.data||{},e.data.hProperties=e.data.hProperties||{},e.data.hProperties.metastring=e.meta)})}}let nt=!1;function rt(e,t=v.default){let n=e?.plugins?.flatMap(e=>H.getSanitizedCapabilities(e).remarkPlugins||[])||[],r=e?.plugins?.flatMap(e=>H.getSanitizedCapabilities(e).rehypePlugins||[])||[],i=t({remarkPlugins:[y.default,b.default,tt,...n],rehypePlugins:[x.default,[et,e],...r],jsxRuntime:`automatic`});return{...i,name:`vite-plugin-boltdocs-mdx`,async buildStart(){nt||=(await Z.load(),!0),i.buildStart&&await i.buildStart.call(this)},async transform(e,t,n){let[r]=t.split(`?`);if(!r.endsWith(`.md`)&&!r.endsWith(`.mdx`))return i.transform?.call(this,e,t,n);let a=`${r}:${p.default.createHash(`md5`).update(e).digest(`hex`)}:${process.env.NODE_ENV===`production`?`prod`:`dev`}:v3`,o=await Z.getAsync(a);if(o)return{code:o,map:null};let s=await i.transform.call(this,e,r,n);return s&&typeof s==`object`&&s.code&&(process.env.NODE_ENV!==`production`&&(s.code+=`
|
|
107
|
+
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(u===`icons`){let e=[`tsx`,`jsx`,`ts`,`js`],n=null;for(let t of e){let e=c.default.resolve(a,`icons.${t}`);if(f.default.existsSync(e)){n=e;break}}return n?`import * as icons from '${t.l(n)}';\nexport default icons;`:`export default {};`}if(u===`search`){if(!K){let e=be(await r.t(a,l));K=`export default ${JSON.stringify(e,null,2)};`}return K}if(u===`client`){let e=__dirname,n=``;for(;e&&e!==c.default.parse(e).root;){let r=c.default.join(e,`src/client/index.ts`),i=c.default.join(e,`dist/client/index.mjs`),a=c.default.join(e,`client/index.ts`);if(f.default.existsSync(r)){n=t.l(r);break}if(f.default.existsSync(i)){n=t.l(i);break}if(f.default.existsSync(a)){n=t.l(a);break}e=c.default.dirname(e)}if(!n)throw Error(`[boltdocs] Could not resolve boltdocs/client entry point starting from ${__dirname}`);return`export * from '${n}';`}}}}const Ce={"X-Content-Type-Options":`nosniff`,"X-Frame-Options":`DENY`,"X-XSS-Protection":`1; mode=block`,"Referrer-Policy":`strict-origin-when-cross-origin`,"Permissions-Policy":`camera=(), microphone=(), geolocation=()`,"Strict-Transport-Security":`max-age=31536000; includeSubDomains`};function we(e){let t=process.env.NODE_ENV===`development`,n={"default-src":[`'self'`],"script-src":[`'self'`,`'unsafe-inline'`],"style-src":[`'self'`,`'unsafe-inline'`],"img-src":[`'self'`,`data:`,`https:`],"font-src":[`'self'`],"connect-src":[`'self'`]};return t&&(n[`script-src`]=[`'self'`,`'unsafe-eval'`,`'unsafe-inline'`],n[`style-src`]=[`'self'`,`'unsafe-inline'`]),Object.entries(n).map(([e,t])=>`${e} ${t.join(` `)}`).join(`; `)}const q=new Map;async function Te(e){try{let{data:n}=await t.u(e),r=JSON.stringify(n);return p.default.createHash(`md5`).update(r).digest(`hex`)}catch{return``}}function Ee(e){return q.get(e)}function De(e,t){q.set(e,t)}function Oe(e){q.delete(e)}function J(e,t){let n=e.moduleGraph.getModuleById(`\0virtual:boltdocs-${t}.ts`);n&&e.moduleGraph.invalidateModule(n)}function ke(e,n,a,o,s){let l=new Map;return{name:`vite-plugin-boltdocs-dev-server`,apply:`serve`,async configureServer(o){let u=s();await u?.runHook(`beforeDev`),i.s(e,process.cwd(),a()).catch(e=>{(0,d.error)(`Failed to generate initial link tree:`,e)}),setTimeout(async()=>{try{let{generateRoutes:t}=await Promise.resolve().then(()=>require(`./routes-DP1vmWRj.cjs`)),n=await t(e,a());for(let e of n)if(e.filePath){let t=c.default.relative(process.cwd(),e.filePath).replace(/\\/g,`/`),n=t.startsWith(`/`)?t:`/${t}`;await o.transformRequest(n).catch(()=>{}),await new Promise(e=>setTimeout(e,50))}}catch{}},1e3),o.middlewares.use((e,t,n)=>{process.env.NODE_ENV===`production`&&Object.entries(Ce).forEach(([e,n])=>{t.setHeader(e,n)});let r=a();r.security?.enableCSP&&t.setHeader(`Content-Security-Policy`,we(r)),n()}),o.middlewares.use((e,t,n)=>{if(e.url===`/robots.txt`){n();return}n()}),o.middlewares.use(async(e,t,n)=>{let r=e.url?.split(`?`)[0]||`/`,i=e.headers.accept||``,s=a(),c=/\.(js|css|png|jpe?g|gif|svg|ico|webp|woff2?|ttf|otf|mp4|webm|ogg|mp3|wav|flac|aac|pdf|zip|gz|map|json)$/i.test(r);if(i.includes(`text/html`)&&!c){let n=ue(s);n=de(n,s),n=await o.transformIndexHtml(e.url||`/`,n),t.statusCode=200,t.setHeader(`Content-Type`,`text/html`),t.end(n);return}n()});let f=i.d.map(e=>c.default.resolve(process.cwd(),e)),p=[`tsx`,`jsx`].map(t=>c.default.resolve(e,`layout.${t}`)),m=[`tsx`,`ts`,`jsx`,`js`],h=m.map(t=>c.default.resolve(e,`mdx-components.${t}`)),g=m.map(t=>c.default.resolve(e,`pages-external/index.${t}`)),_=m.map(t=>c.default.resolve(e,`icons.${t}`));o.watcher.add([...f,...h,...p,...g,..._]);let v=async(s,u)=>{try{let f=t.l(s);if(i.d.some(e=>f.endsWith(e))){o.restart();return}if(m.some(e=>f.endsWith(`mdx-components.${e}`))){i.h(a(),e),J(o,`mdx-components.tsx`),o.ws.send({type:`full-reload`});return}if(m.some(e=>f.endsWith(`icons.${e}`))){J(o,`icons.tsx`),o.ws.send({type:`full-reload`});return}if(f.endsWith(`layout.tsx`)||f.endsWith(`layout.jsx`)){J(o,`layout.tsx`),o.ws.send({type:`full-reload`});return}if(f.includes(`/pages-external/`)||f.includes(`\\pages-external\\`)){J(o,`entry`),o.ws.send({type:`full-reload`});return}if(!f.toLowerCase().startsWith(n.toLowerCase())||!t.s(f))return;if(u===`add`||u===`unlink`){u===`unlink`&&Oe(s),r.n(),xe();let t=a();i.h(t,e),J(o,`config`),J(o,`routes`),J(o,`search`),i.s(e,process.cwd(),t).catch(e=>{(0,d.error)(`Failed to update link tree:`,e)}),o.ws.send({type:`custom`,event:`boltdocs:config-update`,data:{theme:t?.theme,i18n:t?.i18n,versions:t?.versions,siteUrl:t?.siteUrl}}),o.ws.send({type:`full-reload`});return}l.has(f)&&clearTimeout(l.get(f)),l.set(f,setTimeout(async()=>{l.delete(f);try{let n=Ee(s),i=await Te(s);De(s,i),r.r(s),n!==void 0&&n!==i&&(J(o,`routes`),J(o,`search`));let a=t.l(c.default.relative(e,s)),l=o.moduleGraph.getModulesByFile(f);if(l)for(let e of l)o.moduleGraph.invalidateModule(e);o.ws.send({type:`custom`,event:`boltdocs:mdx-update`,data:{file:f,relPath:a}})}catch(e){(0,d.error)(`HMR error processing content change:`,e)}},150))}catch(e){(0,d.error)(`HMR error during ${u} event:`,e)}};o.watcher.on(`add`,e=>v(e,`add`)),o.watcher.on(`unlink`,e=>v(e,`unlink`)),o.watcher.on(`change`,e=>v(e,`change`)),await u?.runHook(`afterDev`)},handleHotUpdate({file:e,server:r}){let i=t.l(e);if(i.toLowerCase().startsWith(n.toLowerCase())&&t.s(i))return[]}}}const Y=_.createRequire(require(`url`).pathToFileURL(__filename).href);function Ae(e){let t=c.default.dirname(e);for(;t&&t!==c.default.dirname(t);){let e=c.default.join(t,`package.json`);if(f.default.existsSync(e))return e;t=c.default.dirname(t)}return null}function je(e){let t=e.split(`/`);return e.startsWith(`@`)?{packageName:t.slice(0,2).join(`/`),subpath:t.slice(2).join(`/`)}:{packageName:t[0],subpath:t.slice(1).join(`/`)}}function X(e,t=Y){try{let{packageName:n,subpath:r}=je(e),i;try{i=t.resolve(n+`/package.json`)}catch{i=Ae(t.resolve(n))||``}if(!i)throw Error(`Could not find package.json for ${n}`);let a=c.default.dirname(i),o=JSON.parse(f.default.readFileSync(i,`utf-8`)),s=``,l=r?`./`+r:`.`;if(o.exports){let e=o.exports[l]||o.exports[r];e&&(s=typeof e==`string`?e:e.import||e.default||e.require||e)}if(!s&&!r&&(s=o.module||o.main||`index.js`),typeof s==`object`&&(s=s.import||s.default||s.require||``),s){let e=c.default.resolve(a,s);if(f.default.existsSync(e))return e}}catch{}return t.resolve(e)}function Me(){let e=[`react`,`react-dom`,`react-router-dom`,`react-helmet-async`,`@bdocs/ssg`,`react-fast-compare`,`invariant`],n=[],r=Y;try{let e=c.default.join(process.cwd(),`node_modules/boltdocs/package.json`);if(f.default.existsSync(e)){let t=f.default.realpathSync(e);r=_.createRequire(t)}else r=_.createRequire(c.default.join(process.cwd(),`package.json`))}catch{}for(let t of e)try{let e=``;e=t===`@bdocs/ssg`||t===`react-router-dom`||t===`react-helmet-async`?X(t,r):r.resolve(t),e&&n.push(f.default.realpathSync(e))}catch{}if(r!==Y)for(let t of e)try{let e=``;e=t===`@bdocs/ssg`||t===`react-router-dom`||t===`react-helmet-async`?X(t,Y):Y.resolve(t),e&&n.push(f.default.realpathSync(e))}catch{}for(let e of[`react/jsx-runtime`,`react/jsx-dev-runtime`,`react-dom/client`]){try{n.push(f.default.realpathSync(r.resolve(e)))}catch{}if(r!==Y)try{n.push(f.default.realpathSync(Y.resolve(e)))}catch{}}return Array.from(new Set(n)).map(e=>t.l(e))}function Ne(e={},n){let a=c.default.resolve(process.cwd(),e.docsDir||`docs`),o=t.l(a),l=n,u,d=!1,p,h=[],g=()=>l;return[{name:`vite-plugin-boltdocs`,enforce:`pre`,async config(e,t){d=t.command===`build`;let n=!!(t.ssrBuild||t.ssr||e.build?.ssr),o=e.envDir||process.cwd(),u=(0,s.loadEnv)(t.mode,o,``);Object.assign(process.env,u),l||=await i.p(a);let m=(await Promise.resolve().then(()=>require(`./package-DIIrjuWI.cjs`))).version,g=ge(l.plugins||[],m);return l.plugins=g,p=new _e(g,l),h=g.flatMap(e=>H.getSanitizedCapabilities(e).vitePlugins||[]),d&&await p.runHook(`beforeBuild`),{ssgOptions:{entry:`boltdocs/entry`,htmlEntry:`index.html`,dirStyle:`flat`,includeAllRoutes:!0,mock:!0,script:`async`,beastiesOptions:{preload:`media`},onFinished:async e=>{let t=ce(se(await r.t(a,l)),l);t&&f.default.writeFileSync(c.default.join(e,`sitemap.xml`),t);let n=le(l);f.default.writeFileSync(c.default.join(e,`robots.txt`),n)}},build:{ssrManifest:d},optimizeDeps:{include:[`react`,`react-dom`,`react-dom/client`,`react-router-dom`,`react-helmet-async`,`react-fast-compare`,`invariant`],exclude:[`boltdocs`,`boltdocs/client`]},resolve:{alias:[{find:`react-router-dom`,replacement:X(`react-router-dom`)},{find:`react-helmet-async`,replacement:X(`react-helmet-async`)},{find:`@bdocs/ssg`,replacement:X(`@bdocs/ssg`)}],dedupe:[`react`,`react-dom`,...n?[]:[`react-router-dom`,`react-helmet-async`,`@bdocs/ssg`]]},ssr:{external:[`react`,`react-dom`,`react-router-dom`,`react-helmet-async`,`@bdocs/ssg`,`react-fast-compare`,`invariant`,...Me()],optimizeDeps:{include:[`react-fast-compare`,`invariant`]},noExternal:[]}}},configResolved(e){u=e,p?.runHook(`configResolved`,l)},resolveId(e,t,n){let r=[`react`,`react-dom`,`react-router-dom`,`react-helmet-async`,`@bdocs/ssg`].find(t=>e===t||e.startsWith(t+`/`)||e.includes(`/node_modules/${t}/`)||t.startsWith(`@`)&&e.includes(`/node_modules/${t.replace(`/`,c.default.sep)}/`));if(r&&n?.ssr){let t=e;if(!c.default.isAbsolute(e)){let n=Y;try{let e=c.default.join(process.cwd(),`node_modules/boltdocs/package.json`);if(f.default.existsSync(e)){let t=f.default.realpathSync(e);n=_.createRequire(t)}else n=_.createRequire(c.default.join(process.cwd(),`package.json`))}catch{}try{t=r===`@bdocs/ssg`||r===`react-router-dom`||r===`react-helmet-async`?X(e,n):n.resolve(e)}catch{try{t=r===`@bdocs/ssg`||r===`react-router-dom`||r===`react-helmet-async`?X(e,Y):Y.resolve(e)}catch{}}}try{t=f.default.realpathSync(t)}catch{}return{id:t,external:!0}}return null},transformIndexHtml:{order:`pre`,handler(e){return de(e,l)}},async buildEnd(){let{pool:e}=await Promise.resolve().then(()=>require(`./worker-pool-Crbqgw5R.cjs`));await e.terminate()},async closeBundle(){!d||u?.build?.ssr||(await p?.runHook(`afterBuild`),await p?.runHook(`buildEnd`))},configurePreviewServer(e){let t=u?.build?.outDir?c.default.resolve(u.root||process.cwd(),u.build.outDir):c.default.resolve(process.cwd(),`dist`);e.middlewares.use((e,n,r)=>{let i=e.url||`/`,a=i.split(`?`)[0].split(`#`)[0];if(c.default.extname(a))return r();let o=a.replace(/\/$/,``)||`/`,s=c.default.join(t,o,`index.html`);o!==`/`&&f.default.existsSync(s)&&(e.url=`${o}/index.html${i.includes(`?`)?`?${i.split(`?`)[1]}`:``}`),r()})}},Se(e,g,()=>u,a),ke(a,o,g,e=>{l=e},()=>p),{...(0,m.ViteImageOptimizer)({includePublic:!0,png:{quality:80},jpeg:{quality:80},jpg:{quality:80},webp:{quality:80},avif:{quality:80},svg:{multipass:!0,plugins:[{name:`preset-default`}]}}),apply:`build`},...h]}const Z=new n.r(`mdx`),Pe=[S.default.default||S.default,C.default.default||C.default,w.default.default||w.default,T.default.default||T.default,E.default.default||E.default,D.default.default||D.default,O.default.default||O.default],Fe=[k.default,A.default,j.default,M.default,N.default,P.default,F.default,I.default,re.default,ie.default,ae.default,oe.default,L.default];let Ie=null,Le=null;const Re=()=>(Ie??=(0,te.createJavaScriptRegexEngine)(),Ie),ze=async e=>Le||(Le=(0,ne.createHighlighterCore)({themes:Pe,langs:Fe,engine:Re()}),Le),Be={JSX_FLOW_ELEMENT:`mdxJsxFlowElement`,JSX_TEXT_ELEMENT:`mdxJsxTextElement`,JSX_ATTRIBUTE:`mdxJsxAttribute`,ELEMENT:`element`,TEXT:`text`,CODE:`code`},Ve={PRE:`pre`,CODE:`code`},Q={TITLE:`data-title`,LANG:`data-lang`,HIGHLIGHTED:`data-highlighted`,HIGHLIGHTED_HTML:`data-highlighted-html`},$={LINE_NUMBERS:`shiki-line-numbers`,WORD_WRAP:`shiki-word-wrap`,FALLBACK:`shiki-fallback`},He={LIGHT:`github-light`,DARK:`github-dark`},Ue={LANG:`plaintext`,MDX_DEFAULT_LANG:`text`},We=(e={})=>{let{activateByDefault:t=!1}=e;return{name:`boltdocs:line-numbers`,pre(e){let n=this.options.meta?.lineNumbers===!0;(t||n)&&this.addClassToHast(e,$.LINE_NUMBERS)}}},Ge=(e={})=>{let{activateByDefault:t=!1}=e;return{name:`boltdocs:word-wrap`,pre(e){let n=this.options.meta?.wordWrap===!0;(t||n)&&this.addClassToHast(e,$.WORD_WRAP)}}},Ke=()=>({name:`AddTitleProperty`,pre(e){let t=this.options.meta?.title;t&&(e.properties[Q.TITLE]=t)}}),qe=()=>({name:`AddLanguageProperty`,pre(e){e.properties[Q.LANG]=this.options.lang||Ue.LANG}});function Je(e){let t={};if(!e)return t;/lineNumbers|showLineNumbers/.test(e)&&(t.lineNumbers=!0),/wordWrap|word-wrap/.test(e)&&(t.wordWrap=!0);let n=e.match(/title=(["'])(.*?)\1/);return n&&(t.title=n[2]),t}var Ye=class{config;constructor(e){this.config=e}getTheme(){return this.config?.theme?.codeTheme||{light:He.LIGHT,dark:He.DARK}}async getHighlighter(){return await ze(this.getTheme())}getOptions(e,t){let n=this.getTheme(),r={},i=``;typeof t==`string`?(i=t,r=Je(t)):t&&(r=t,i=t.__raw||``);let a={lang:e||Ue.LANG,meta:{__raw:i,...r},transformers:[We(),Ge(),Ke(),qe()]};return typeof n==`object`?a.themes={light:n.light,dark:n.dark}:a.theme=n,a}async render(e,t,n){try{let r=await this.getHighlighter(),i=this.getOptions(t,n);return r.codeToHtml(e,i)}catch(t){return console.error(`[ShikiAdapter] Failed to render code:`,t),`<pre class="${$.FALLBACK}"><code>${Xe(e)}</code></pre>`}}};function Xe(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}let Ze=null,Qe;function $e(e){let t=JSON.stringify(e?.theme?.codeTheme||null);return(Ze===null||Qe!==t)&&(Ze=new Ye(e),Qe=t),Ze}function et(e){let t=$e(e);return async e=>{let n=await t.getHighlighter();(0,ee.visit)(e,Be.ELEMENT,e=>{if(e.tagName===Ve.PRE&&e.children?.[0]?.type===Be.ELEMENT&&e.children[0].tagName===Ve.CODE){let r=e.children[0],i=(r.properties?.className||[]).find(e=>e.startsWith(`language-`)),a=i?i.slice(9):Ue.MDX_DEFAULT_LANG;if(a===`mermaid`)return;let o=r.children?.[0]?.value||``,s=Je(r.properties?.metastring||r.data?.meta||``),c=t.getOptions(a,s),l=``;try{l=n.codeToHtml(o,c)}catch(e){console.error(`[rehypeShiki] Failed to highlight code block:`,e),l=`<pre class="${$.FALLBACK}"><code>${Xe(o)}</code></pre>`}e.properties=e.properties||{},s.title&&(e.properties[Q.TITLE]=s.title),e.properties[Q.HIGHLIGHTED]=`true`,e.properties[Q.HIGHLIGHTED_HTML]=l,e.properties[Q.LANG]=a,e.children=[]}})}}function tt(){return e=>{(0,ee.visit)(e,Be.CODE,e=>{e.meta&&(e.data=e.data||{},e.data.hProperties=e.data.hProperties||{},e.data.hProperties.metastring=e.meta)})}}let nt=!1;function rt(e,t=v.default){let n=e?.plugins?.flatMap(e=>H.getSanitizedCapabilities(e).remarkPlugins||[])||[],r=e?.plugins?.flatMap(e=>H.getSanitizedCapabilities(e).rehypePlugins||[])||[],i=t({remarkPlugins:[y.default,b.default,tt,...n],rehypePlugins:[x.default,[et,e],...r],jsxRuntime:`automatic`});return{...i,name:`vite-plugin-boltdocs-mdx`,async buildStart(){nt||=(await Z.load(),!0),i.buildStart&&await i.buildStart.call(this)},async transform(e,t,n){let[r]=t.split(`?`);if(!r.endsWith(`.md`)&&!r.endsWith(`.mdx`))return i.transform?.call(this,e,t,n);let a=`${r}:${p.default.createHash(`md5`).update(e).digest(`hex`)}:${process.env.NODE_ENV===`production`?`prod`:`dev`}:v3`,o=await Z.getAsync(a);if(o)return{code:o,map:null};let s=await i.transform.call(this,e,r,n);return s&&typeof s==`object`&&s.code&&(process.env.NODE_ENV!==`production`&&(s.code+=`
|
|
108
108
|
if (import.meta.hot) {
|
|
109
109
|
import.meta.hot.accept();
|
|
110
110
|
}
|