boltdocs 2.9.3 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/boltdocs.js +2 -1
- package/dist/{adapters-uGz-UKQa.cjs → adapters-C5AWWGfb.cjs} +1 -1
- package/dist/{adapters-HVuXENAe.mjs → adapters-DEXNIv3x.mjs} +1 -1
- package/dist/{banner-D2NddBfF.d.ts → banner-CfdalYLL.d.ts} +1 -1
- package/dist/{banner-C_xkGxzI.d.cts → banner-DNSkgUsO.d.cts} +1 -1
- package/dist/{cache-B19MLTpN.cjs → cache-DETwlACe.cjs} +1 -1
- package/dist/{cache-CfhOTR3Q.mjs → cache-SF59enb3.mjs} +1 -1
- package/dist/client/index.cjs +126 -24
- package/dist/client/index.d.cts +4 -3
- package/dist/client/index.d.ts +4 -3
- package/dist/client/index.js +125 -24
- package/dist/client/mdx.cjs +1 -1
- package/dist/client/mdx.js +1 -1
- package/dist/client/primitives.cjs +2 -2
- package/dist/client/primitives.d.cts +10 -8
- package/dist/client/primitives.d.ts +10 -8
- package/dist/client/primitives.js +2 -2
- package/dist/config-B5uVv5q4.cjs +7 -0
- package/dist/config-D3_zDkHh.mjs +7 -0
- package/dist/{config-CnmfjOE4.cjs → config-JGkMJoJQ.cjs} +1 -1
- package/dist/csp-gaZ51xzq.mjs +6 -0
- package/dist/doctor-3MheVMwd.mjs +7 -0
- package/dist/{parser-CHsNUEhU.cjs → doctor-BR1B2Mkz.cjs} +1 -1
- package/dist/doctor-DQxLM202.cjs +7 -0
- package/dist/handler-Btd4t_67.mjs +28 -0
- package/dist/{headers-DuCAOgYX.cjs → headers-BXKxiPUv.cjs} +1 -1
- package/dist/headers-CXyf0auY.mjs +6 -0
- package/dist/{image-BCDyLHyD.js → image-C9md50h2.js} +14 -6
- package/dist/{image-DWdmichO.cjs → image-CR6UlaI5.cjs} +14 -6
- package/dist/{mdx-9QJoSITt.cjs → mdx-DJBg5DuL.cjs} +10 -23
- package/dist/{mdx-DFbspTP9.js → mdx-DhyMkc35.js} +10 -23
- package/dist/node/cli-entry.cjs +3 -3
- package/dist/node/cli-entry.mjs +3 -3
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.d.cts +40 -19
- package/dist/node/index.d.mts +41 -20
- package/dist/node/index.mjs +1 -1
- package/dist/node-BUAMwxuS.cjs +105 -0
- package/dist/node-Clh72alT.mjs +105 -0
- package/dist/{package-Di7alQGe.mjs → package-1GvyLw7z.mjs} +1 -1
- package/dist/{package-BlYktJR3.cjs → package-3jQEMIvy.cjs} +1 -1
- package/dist/pages-external-BYa4JSda.mjs +6 -0
- package/dist/pages-external-CX2uyW95.cjs +6 -0
- package/dist/parser-CNIPHx4s.cjs +8 -0
- package/dist/parser-D0QHIQsi.mjs +8 -0
- package/dist/plugin-D9gURy-9.mjs +68 -0
- package/dist/plugin-N3zGyZXw.cjs +68 -0
- package/dist/rolldown-runtime-fkIsjY3S.mjs +6 -0
- package/dist/routes-BajCwrvX.cjs +6 -0
- package/dist/routes-CyrnmVuG.mjs +6 -0
- package/dist/routes-D6Tuu7Fs.cjs +6 -0
- package/dist/{search-dialog-DRNJsxOv.js → search-dialog-CQneRo8T.js} +1 -1
- package/dist/{search-dialog-BsAiQgnx.cjs → search-dialog-CwNh8lIN.cjs} +27 -30
- package/dist/{search-dialog-BhXg05Ri.cjs → search-dialog-D4rplZMv.cjs} +1 -0
- package/dist/{search-dialog-DaR66wl0.js → search-dialog-DaeSPvEo.js} +1 -0
- package/dist/{search-dialog-CaOO1Q4i.js → search-dialog-DoGobmuG.js} +28 -31
- package/dist/{search-dialog-CzwvKoLW.cjs → search-dialog-cHJoKjts.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/{shiki-adapter-BB71nVsG.cjs → shiki-adapter-CGTmrR6S.cjs} +1 -1
- package/dist/shiki-adapter-CXEGRnjr.mjs +6 -0
- package/dist/{doctor-BL6c8x2Q.cjs → shiki-adapter-Mr8_oT_9.cjs} +1 -1
- package/dist/{sidebar-BtJyWHy4.d.cts → sidebar-7gIifpBX.d.cts} +21 -4
- package/dist/{sidebar-C4fuRYYS.d.ts → sidebar-BAKgJ-Er.d.ts} +21 -4
- package/dist/types-generator-DVOnRVKU.mjs +26 -0
- package/dist/{utils-DexBrwiP.mjs → utils-B3xYMrpK.mjs} +1 -1
- package/dist/{utils-BWy_8ASj.cjs → utils-Bz1tG9Dg.cjs} +1 -1
- package/package.json +2 -1
- package/src/shared/types.ts +22 -3
- package/dist/config-BCqkPkjC.mjs +0 -7
- package/dist/config-BPWGa2W3.mjs +0 -6
- package/dist/config-D7ERJhqe.cjs +0 -7
- package/dist/csp-DtM6q2gZ.mjs +0 -6
- package/dist/doctor-A17UhTRn.cjs +0 -7
- package/dist/doctor-Bc-Tx_md.mjs +0 -7
- package/dist/handler-CyIBbZdb.mjs +0 -28
- package/dist/handler-eNNcucnf.mjs +0 -6
- package/dist/headers-DK0Hw7iB.mjs +0 -6
- package/dist/node/routes/worker.cjs +0 -6
- package/dist/node/routes/worker.d.cts +0 -2
- package/dist/node/routes/worker.d.mts +0 -2
- package/dist/node/routes/worker.mjs +0 -6
- package/dist/node-JQ6C-CBi.mjs +0 -105
- package/dist/node-cZgna618.cjs +0 -105
- package/dist/parser-CLtGv_XH.cjs +0 -6
- package/dist/parser-Ww0eOqs7.mjs +0 -6
- package/dist/plugin-BCCYSeId.cjs +0 -61
- package/dist/plugin-Bu75gPjx.mjs +0 -61
- package/dist/routes-B2joDAlC.cjs +0 -6
- package/dist/routes-CyKj3dzf.cjs +0 -6
- package/dist/routes-DMBny9t9.mjs +0 -6
- package/dist/routes-DZjS8QSV.mjs +0 -6
- package/dist/shiki-adapter-CL-IQwKI.cjs +0 -6
- package/dist/shiki-adapter-CxTLkjew.mjs +0 -6
- package/dist/shiki-adapter-rQ087Lx3.mjs +0 -6
- package/dist/types-generator-BRyf4o9F.mjs +0 -26
- package/dist/types-generator-Cu2jQP-V.mjs +0 -6
- package/dist/worker-pool-CgOMozUz.cjs +0 -6
- package/dist/worker-pool-v6tW2MDQ.mjs +0 -6
- /package/dist/{csp-DbbF3R9Q.cjs → csp-CBysWlAf.cjs} +0 -0
- /package/dist/{generator-BaSvGlxR.mjs → generator-CcOBN5vI.mjs} +0 -0
- /package/dist/{generator-DsajVrDx.cjs → generator-DtUU3Cfk.cjs} +0 -0
- /package/dist/{handler-1LRMYeI4.cjs → handler-Dzf4dSnV.cjs} +0 -0
- /package/dist/{index-ZqgZUvwp.d.mts → index-CdJv4ocW.d.mts} +0 -0
- /package/dist/{meta-loader-CD3Yptr5.mjs → meta-loader-C4Hu9RN9.mjs} +0 -0
- /package/dist/{meta-loader-CjphwtS7.cjs → meta-loader-C9MKjAs0.cjs} +0 -0
- /package/dist/{types-generator-BqNKCbrx.cjs → types-generator-CYcHkDzZ.cjs} +0 -0
package/dist/client/index.js
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
import { $ as TextAlignStart, C as RoutesProvider, D as Check, E as ArrowLeft, F as FaceBad, I as FaceGood, J as Moon, K as Menu, L as FaceRegular, M as Copy, O as ChevronDown, P as ExternalLink, Q as Sun, S as normalizePath, U as Languages, V as Home, X as Pencil, _ as Link$1, at as useBoltdocsContext, b as useLocalizedTo, et as X, it as BoltdocsProvider, j as CircleHelp, nt as ConfigContext, q as Monitor, rt as useConfig, s as Github, tt as icons_exports, x as useRoutes, y as cn } from "../icons-dev-kJyGWNeg.js";
|
|
7
|
-
import { c as ThemeProvider, l as useTheme } from "../image-
|
|
8
|
-
import { n as useCodeBlock, r as copyToClipboard, t as mdx_components_default } from "../mdx-
|
|
7
|
+
import { c as ThemeProvider, l as useTheme } from "../image-C9md50h2.js";
|
|
8
|
+
import { n as useCodeBlock, r as copyToClipboard, t as mdx_components_default } from "../mdx-DhyMkc35.js";
|
|
9
9
|
import { A as useUI, C as useSidebar, D as ButtonGroup, O as Breadcrumbs$2, S as useLocation, T as Menu$1, f as PageNav$1, k as UIProvider, m as OnThisPage$1, n as Sidebar$1, t as DocsLayout$1, w as Tabs$1, x as useSearchHighlight } from "../docs-layout-6FQ8__ok.js";
|
|
10
|
-
import { a as Button$1, n as Navbar$1, r as ErrorBoundary$1 } from "../search-dialog-
|
|
11
|
-
import { n as useSearch, r as InternalErrorBoundary, t as SearchDialog } from "../search-dialog-
|
|
10
|
+
import { a as Button$1, n as Navbar$1, r as ErrorBoundary$1 } from "../search-dialog-DaeSPvEo.js";
|
|
11
|
+
import { n as useSearch, r as InternalErrorBoundary, t as SearchDialog } from "../search-dialog-DoGobmuG.js";
|
|
12
12
|
import { ViteReactSSG } from "@bdocs/ssg";
|
|
13
13
|
import { Suspense, createContext, isValidElement, lazy, use, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
14
14
|
import { Link, Outlet, useLoaderData, useLocation as useLocation$1, useMatches, useNavigate } from "react-router-dom";
|
|
@@ -17,6 +17,7 @@ import * as ReactHelmetAsync from "react-helmet-async";
|
|
|
17
17
|
import { Button } from "react-aria-components";
|
|
18
18
|
import virtualCustomComponents from "virtual:boltdocs-mdx-components";
|
|
19
19
|
import virtualIcons from "virtual:boltdocs-icons";
|
|
20
|
+
import DOMPurify from "isomorphic-dompurify";
|
|
20
21
|
import UserLayout from "virtual:boltdocs-layout";
|
|
21
22
|
|
|
22
23
|
//#region src/client/app/mdx-components-context.tsx
|
|
@@ -250,6 +251,26 @@ function Head({ siteTitle, siteDescription, routes }) {
|
|
|
250
251
|
name: "generator",
|
|
251
252
|
content: "Boltdocs"
|
|
252
253
|
}),
|
|
254
|
+
config?.seo?.verification?.google && /* @__PURE__ */ jsx("meta", {
|
|
255
|
+
name: "google-site-verification",
|
|
256
|
+
content: config.seo.verification.google
|
|
257
|
+
}),
|
|
258
|
+
config?.seo?.verification?.bing && /* @__PURE__ */ jsx("meta", {
|
|
259
|
+
name: "msvalidate.01",
|
|
260
|
+
content: config.seo.verification.bing
|
|
261
|
+
}),
|
|
262
|
+
config?.seo?.verification?.yandex && /* @__PURE__ */ jsx("meta", {
|
|
263
|
+
name: "yandex-verification",
|
|
264
|
+
content: config.seo.verification.yandex
|
|
265
|
+
}),
|
|
266
|
+
config?.seo?.verification?.pinterest && /* @__PURE__ */ jsx("meta", {
|
|
267
|
+
name: "p:domain_verify",
|
|
268
|
+
content: config.seo.verification.pinterest
|
|
269
|
+
}),
|
|
270
|
+
config?.seo?.verification?.facebook && /* @__PURE__ */ jsx("meta", {
|
|
271
|
+
name: "facebook-domain-verification",
|
|
272
|
+
content: config.seo.verification.facebook
|
|
273
|
+
}),
|
|
253
274
|
Object.entries(globalMetatags).map(([key, value]) => {
|
|
254
275
|
return key.startsWith("og:") || key.startsWith("music:") || key.startsWith("video:") || key.startsWith("article:") || key.startsWith("book:") || key.startsWith("profile:") ? /* @__PURE__ */ jsx("meta", {
|
|
255
276
|
property: key,
|
|
@@ -872,7 +893,7 @@ function Tabs({ tabs, routes }) {
|
|
|
872
893
|
if (!iconName) return null;
|
|
873
894
|
if (iconName.trim().startsWith("<svg")) return /* @__PURE__ */ jsx("span", {
|
|
874
895
|
className: "h-4 w-4",
|
|
875
|
-
dangerouslySetInnerHTML: { __html: iconName }
|
|
896
|
+
dangerouslySetInnerHTML: { __html: DOMPurify.sanitize(iconName, { USE_PROFILES: { svg: true } }) }
|
|
876
897
|
});
|
|
877
898
|
const icons = {
|
|
878
899
|
...icons_exports,
|
|
@@ -1135,7 +1156,7 @@ function createGtagAnalytics(config) {
|
|
|
1135
1156
|
window.gtag?.("event", "page_view", {
|
|
1136
1157
|
page_path: path,
|
|
1137
1158
|
page_title: title || document.title,
|
|
1138
|
-
send_to: config?.ga4?.measurementId
|
|
1159
|
+
send_to: config?.analytics?.ga4?.measurementId
|
|
1139
1160
|
});
|
|
1140
1161
|
},
|
|
1141
1162
|
trackEvent: ({ action, category, label, value, params }) => {
|
|
@@ -1143,7 +1164,7 @@ function createGtagAnalytics(config) {
|
|
|
1143
1164
|
event_category: category,
|
|
1144
1165
|
event_label: label,
|
|
1145
1166
|
value,
|
|
1146
|
-
send_to: config?.ga4?.measurementId,
|
|
1167
|
+
send_to: config?.analytics?.ga4?.measurementId,
|
|
1147
1168
|
...params
|
|
1148
1169
|
});
|
|
1149
1170
|
},
|
|
@@ -1151,20 +1172,20 @@ function createGtagAnalytics(config) {
|
|
|
1151
1172
|
window.gtag?.("event", "search", {
|
|
1152
1173
|
search_term: query,
|
|
1153
1174
|
results_count: resultsCount,
|
|
1154
|
-
send_to: config?.ga4?.measurementId
|
|
1175
|
+
send_to: config?.analytics?.ga4?.measurementId
|
|
1155
1176
|
});
|
|
1156
1177
|
},
|
|
1157
1178
|
trackDownload: (file, type) => {
|
|
1158
1179
|
window.gtag?.("event", "file_download", {
|
|
1159
1180
|
file_name: file,
|
|
1160
1181
|
file_type: type || file.split(".").pop(),
|
|
1161
|
-
send_to: config?.ga4?.measurementId
|
|
1182
|
+
send_to: config?.analytics?.ga4?.measurementId
|
|
1162
1183
|
});
|
|
1163
1184
|
},
|
|
1164
1185
|
trackExternalLink: (url) => {
|
|
1165
1186
|
window.gtag?.("event", "external_link", {
|
|
1166
1187
|
link_url: url,
|
|
1167
|
-
send_to: config?.ga4?.measurementId
|
|
1188
|
+
send_to: config?.analytics?.ga4?.measurementId
|
|
1168
1189
|
});
|
|
1169
1190
|
},
|
|
1170
1191
|
isEnabled: true
|
|
@@ -1177,7 +1198,7 @@ function createDataLayerAnalytics(config) {
|
|
|
1177
1198
|
event: "page_view",
|
|
1178
1199
|
page_path: path,
|
|
1179
1200
|
page_title: title || document.title,
|
|
1180
|
-
send_to: config?.gtm?.tagId
|
|
1201
|
+
send_to: config?.analytics?.gtm?.tagId
|
|
1181
1202
|
});
|
|
1182
1203
|
},
|
|
1183
1204
|
trackEvent: ({ action, category, label, value, params }) => {
|
|
@@ -1186,7 +1207,7 @@ function createDataLayerAnalytics(config) {
|
|
|
1186
1207
|
event_category: category,
|
|
1187
1208
|
event_label: label,
|
|
1188
1209
|
value,
|
|
1189
|
-
send_to: config?.gtm?.tagId,
|
|
1210
|
+
send_to: config?.analytics?.gtm?.tagId,
|
|
1190
1211
|
...params
|
|
1191
1212
|
});
|
|
1192
1213
|
},
|
|
@@ -1195,7 +1216,7 @@ function createDataLayerAnalytics(config) {
|
|
|
1195
1216
|
event: "search",
|
|
1196
1217
|
search_term: query,
|
|
1197
1218
|
results_count: resultsCount,
|
|
1198
|
-
send_to: config?.gtm?.tagId
|
|
1219
|
+
send_to: config?.analytics?.gtm?.tagId
|
|
1199
1220
|
});
|
|
1200
1221
|
},
|
|
1201
1222
|
trackDownload: (file, type) => {
|
|
@@ -1203,14 +1224,14 @@ function createDataLayerAnalytics(config) {
|
|
|
1203
1224
|
event: "file_download",
|
|
1204
1225
|
file_name: file,
|
|
1205
1226
|
file_type: type || file.split(".").pop(),
|
|
1206
|
-
send_to: config?.gtm?.tagId
|
|
1227
|
+
send_to: config?.analytics?.gtm?.tagId
|
|
1207
1228
|
});
|
|
1208
1229
|
},
|
|
1209
1230
|
trackExternalLink: (url) => {
|
|
1210
1231
|
window.dataLayer?.push({
|
|
1211
1232
|
event: "external_link",
|
|
1212
1233
|
link_url: url,
|
|
1213
|
-
send_to: config?.gtm?.tagId
|
|
1234
|
+
send_to: config?.analytics?.gtm?.tagId
|
|
1214
1235
|
});
|
|
1215
1236
|
},
|
|
1216
1237
|
isEnabled: true
|
|
@@ -1412,13 +1433,13 @@ function I18nSelector({ className }) {
|
|
|
1412
1433
|
|
|
1413
1434
|
//#endregion
|
|
1414
1435
|
//#region src/client/components/ui-base/navbar.tsx
|
|
1415
|
-
const SearchDialog$1 = lazy(() => import("../search-dialog-
|
|
1436
|
+
const SearchDialog$1 = lazy(() => import("../search-dialog-CQneRo8T.js").then((m) => ({ default: m.SearchDialog })));
|
|
1416
1437
|
function Navbar() {
|
|
1417
1438
|
const { links, title, logo, logoProps, github, social, config } = useNavbar();
|
|
1418
1439
|
const { routes, currentRoute, isCollectionPage, currentVersion, currentLocale } = useRoutes();
|
|
1419
1440
|
const { isSidebarOpen, toggleSidebar } = useUI();
|
|
1420
1441
|
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
|
|
1421
|
-
const themeConfig = config.theme
|
|
1442
|
+
const themeConfig = config.theme;
|
|
1422
1443
|
const isDocs = !!currentRoute?.filePath && !isCollectionPage;
|
|
1423
1444
|
const hasTabs = themeConfig?.tabs && themeConfig.tabs.length > 0;
|
|
1424
1445
|
return /* @__PURE__ */ jsxs(Navbar$1.Root, {
|
|
@@ -1448,15 +1469,18 @@ function Navbar() {
|
|
|
1448
1469
|
children: config.versions && currentVersion && /* @__PURE__ */ jsx(VersionSelector, {})
|
|
1449
1470
|
})
|
|
1450
1471
|
] }),
|
|
1451
|
-
/* @__PURE__ */ jsx(Navbar$1.Center, { children: /* @__PURE__ */ jsx(
|
|
1452
|
-
|
|
1453
|
-
children: /* @__PURE__ */ jsx(
|
|
1472
|
+
/* @__PURE__ */ jsx(Navbar$1.Center, { children: /* @__PURE__ */ jsx("div", {
|
|
1473
|
+
className: "flex items-center gap-2",
|
|
1474
|
+
children: /* @__PURE__ */ jsx(Suspense, {
|
|
1475
|
+
fallback: /* @__PURE__ */ jsx("div", { className: "h-9 w-32 animate-pulse rounded-md bg-surface" }),
|
|
1476
|
+
children: /* @__PURE__ */ jsx(SearchDialog$1, { routes: routes || [] })
|
|
1477
|
+
})
|
|
1454
1478
|
}) }),
|
|
1455
1479
|
/* @__PURE__ */ jsxs(Navbar$1.Right, { children: [
|
|
1456
1480
|
/* @__PURE__ */ jsx(Suspense, {
|
|
1457
1481
|
fallback: null,
|
|
1458
1482
|
children: /* @__PURE__ */ jsx("div", {
|
|
1459
|
-
className: "lg:hidden",
|
|
1483
|
+
className: "lg:hidden flex items-center gap-1",
|
|
1460
1484
|
children: /* @__PURE__ */ jsx(SearchDialog$1, { routes: routes || [] })
|
|
1461
1485
|
})
|
|
1462
1486
|
}),
|
|
@@ -1807,6 +1831,69 @@ function Feedback({ className }) {
|
|
|
1807
1831
|
});
|
|
1808
1832
|
}
|
|
1809
1833
|
|
|
1834
|
+
//#endregion
|
|
1835
|
+
//#region src/client/components/ui-base/giscus.tsx
|
|
1836
|
+
function Giscus({ className }) {
|
|
1837
|
+
const config = useConfig();
|
|
1838
|
+
const { resolvedTheme } = useTheme();
|
|
1839
|
+
const ref = useRef(null);
|
|
1840
|
+
const initializedRef = useRef(false);
|
|
1841
|
+
const giscusConfig = config.integrations?.feedback?.giscus;
|
|
1842
|
+
useEffect(() => {
|
|
1843
|
+
if (!giscusConfig) return;
|
|
1844
|
+
const theme = giscusConfig.theme || (resolvedTheme === "dark" ? "dark" : "light");
|
|
1845
|
+
const session = {
|
|
1846
|
+
repo: giscusConfig.repo,
|
|
1847
|
+
"repo-id": giscusConfig.repoId,
|
|
1848
|
+
category: giscusConfig.category,
|
|
1849
|
+
"category-id": giscusConfig.categoryId,
|
|
1850
|
+
mapping: giscusConfig.mapping || "pathname",
|
|
1851
|
+
strict: String(giscusConfig.strict ?? "0"),
|
|
1852
|
+
"reactions-enabled": String(giscusConfig.reactionsEnabled ?? "1"),
|
|
1853
|
+
"emit-metadata": String(giscusConfig.emitMetadata ?? "0"),
|
|
1854
|
+
"input-position": giscusConfig.inputPosition || "bottom",
|
|
1855
|
+
lang: giscusConfig.lang || "en",
|
|
1856
|
+
loading: giscusConfig.loading || "lazy"
|
|
1857
|
+
};
|
|
1858
|
+
if (!initializedRef.current) {
|
|
1859
|
+
initializedRef.current = true;
|
|
1860
|
+
const script = document.createElement("script");
|
|
1861
|
+
script.src = "https://giscus.app/client.js";
|
|
1862
|
+
script.setAttribute("data-repo", session.repo);
|
|
1863
|
+
script.setAttribute("data-repo-id", session["repo-id"]);
|
|
1864
|
+
if (session.category) script.setAttribute("data-category", session.category);
|
|
1865
|
+
if (session["category-id"]) script.setAttribute("data-category-id", session["category-id"]);
|
|
1866
|
+
script.setAttribute("data-mapping", session.mapping);
|
|
1867
|
+
script.setAttribute("data-strict", session.strict);
|
|
1868
|
+
script.setAttribute("data-reactions-enabled", session["reactions-enabled"]);
|
|
1869
|
+
script.setAttribute("data-emit-metadata", session["emit-metadata"]);
|
|
1870
|
+
script.setAttribute("data-input-position", session["input-position"]);
|
|
1871
|
+
script.setAttribute("data-lang", session.lang);
|
|
1872
|
+
script.setAttribute("data-loading", session.loading);
|
|
1873
|
+
script.setAttribute("data-theme", theme);
|
|
1874
|
+
script.setAttribute("crossorigin", "anonymous");
|
|
1875
|
+
script.async = true;
|
|
1876
|
+
if (ref.current) ref.current.appendChild(script);
|
|
1877
|
+
return () => {
|
|
1878
|
+
initializedRef.current = false;
|
|
1879
|
+
if (script.parentNode) script.parentNode.removeChild(script);
|
|
1880
|
+
(ref.current?.querySelectorAll("iframe"))?.forEach((iframe) => iframe.remove());
|
|
1881
|
+
};
|
|
1882
|
+
}
|
|
1883
|
+
}, [giscusConfig]);
|
|
1884
|
+
useEffect(() => {
|
|
1885
|
+
if (!giscusConfig || !initializedRef.current) return;
|
|
1886
|
+
const theme = giscusConfig.theme || (resolvedTheme === "dark" ? "dark" : "light");
|
|
1887
|
+
const iframe = ref.current?.querySelector("iframe.giscus-frame");
|
|
1888
|
+
if (iframe) iframe.contentWindow?.postMessage({ giscus: { setConfig: { theme } } }, "https://giscus.app");
|
|
1889
|
+
}, [resolvedTheme, giscusConfig]);
|
|
1890
|
+
if (!giscusConfig) return null;
|
|
1891
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1892
|
+
ref,
|
|
1893
|
+
className: cn("w-full max-w-2xl mt-12 mb-6", className)
|
|
1894
|
+
});
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1810
1897
|
//#endregion
|
|
1811
1898
|
//#region src/client/ssg/mdx-elements.tsx
|
|
1812
1899
|
const Loading = () => /* @__PURE__ */ jsx("div", {
|
|
@@ -2329,6 +2416,18 @@ function createRoutes(options) {
|
|
|
2329
2416
|
function DocsLayoutComponent({ children }) {
|
|
2330
2417
|
const { routes: filteredRoutes, currentRoute, isCollectionPage } = useRoutes();
|
|
2331
2418
|
const config = useConfig();
|
|
2419
|
+
const AskAiDialog = useMergedComponents().AskAiDialog;
|
|
2420
|
+
const [isAskAiOpen, setIsAskAiOpen] = useState(false);
|
|
2421
|
+
useEffect(() => {
|
|
2422
|
+
const handleOpen = () => setIsAskAiOpen(true);
|
|
2423
|
+
const handleClose = () => setIsAskAiOpen(false);
|
|
2424
|
+
window.addEventListener("boltdocs:ask-ai:open", handleOpen);
|
|
2425
|
+
window.addEventListener("boltdocs:ask-ai:close", handleClose);
|
|
2426
|
+
return () => {
|
|
2427
|
+
window.removeEventListener("boltdocs:ask-ai:open", handleOpen);
|
|
2428
|
+
window.removeEventListener("boltdocs:ask-ai:close", handleClose);
|
|
2429
|
+
};
|
|
2430
|
+
}, []);
|
|
2332
2431
|
return /* @__PURE__ */ jsxs(DocsLayout$1, {
|
|
2333
2432
|
className: "selection:bg-primary-500/10 selection:text-primary-500",
|
|
2334
2433
|
children: [/* @__PURE__ */ jsx(Navbar, {}), /* @__PURE__ */ jsxs(DocsLayout$1.Body, {
|
|
@@ -2365,15 +2464,17 @@ function DocsLayoutComponent({ children }) {
|
|
|
2365
2464
|
children
|
|
2366
2465
|
}) }),
|
|
2367
2466
|
!isCollectionPage && /* @__PURE__ */ jsx(Feedback, {}),
|
|
2467
|
+
!isCollectionPage && /* @__PURE__ */ jsx(Giscus, {}),
|
|
2368
2468
|
/* @__PURE__ */ jsx(DocsLayout$1.Footer, { children: !isCollectionPage && /* @__PURE__ */ jsx(PageNav, {}) })
|
|
2369
2469
|
]
|
|
2370
2470
|
})
|
|
2371
2471
|
}),
|
|
2372
|
-
/* @__PURE__ */ jsx(
|
|
2472
|
+
AskAiDialog && /* @__PURE__ */ jsx(AskAiDialog, {}),
|
|
2473
|
+
!isCollectionPage && !isAskAiOpen && /* @__PURE__ */ jsx(OnThisPage, {
|
|
2373
2474
|
headings: currentRoute?.headings,
|
|
2374
|
-
|
|
2475
|
+
filePath: currentRoute?.filePath,
|
|
2375
2476
|
communityHelp: config.theme?.communityHelp,
|
|
2376
|
-
|
|
2477
|
+
editLink: config.theme?.editLink
|
|
2377
2478
|
})
|
|
2378
2479
|
]
|
|
2379
2480
|
})]
|
package/dist/client/mdx.cjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
7
|
-
const require_mdx = require('../mdx-
|
|
7
|
+
const require_mdx = require('../mdx-DJBg5DuL.cjs');
|
|
8
8
|
|
|
9
9
|
//#region src/client/mdx.ts
|
|
10
10
|
const { Card, Cards, Callout, Field, Image } = require_mdx.mdx_components_default;
|
package/dist/client/mdx.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2026 Jesus Alcala
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import { t as mdx_components_default } from "../mdx-
|
|
6
|
+
import { t as mdx_components_default } from "../mdx-DhyMkc35.js";
|
|
7
7
|
|
|
8
8
|
//#region src/client/mdx.ts
|
|
9
9
|
const { Card, Cards, Callout, Field, Image } = mdx_components_default;
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
7
7
|
const require_icons_dev = require('../icons-dev-BryEFkJu.cjs');
|
|
8
|
-
const require_image = require('../image-
|
|
8
|
+
const require_image = require('../image-CR6UlaI5.cjs');
|
|
9
9
|
const require_docs_layout = require('../docs-layout-3TpAt6MB.cjs');
|
|
10
|
-
const require_search_dialog = require('../search-dialog-
|
|
10
|
+
const require_search_dialog = require('../search-dialog-D4rplZMv.cjs');
|
|
11
11
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
12
12
|
|
|
13
13
|
//#region src/client/components/primitives/skeleton.tsx
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
|
-
import { A as BoltdocsRoutePathWithFallback, a as SidebarItem, c as SidebarItemsProps, d as SidebarMobile, f as SidebarRoot, i as SidebarHeader, l as SidebarLink, m as ComponentBase, n as SidebarContent, o as SidebarItemProps, p as SidebarSubGroup, r as SidebarGroup, s as SidebarItems, t as Sidebar, u as SidebarLinkProps } from "../sidebar-
|
|
2
|
+
import { A as BoltdocsRoutePathWithFallback, a as SidebarItem, c as SidebarItemsProps, d as SidebarMobile, f as SidebarRoot, i as SidebarHeader, l as SidebarLink, m as ComponentBase, n as SidebarContent, o as SidebarItemProps, p as SidebarSubGroup, r as SidebarGroup, s as SidebarItems, t as Sidebar, u as SidebarLinkProps } from "../sidebar-7gIifpBX.cjs";
|
|
3
3
|
import * as React$2 from "react";
|
|
4
4
|
import { Component, ComponentProps, ComponentType, ErrorInfo, ImgHTMLAttributes, ReactNode, RefObject } from "react";
|
|
5
5
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
6
|
import * as RAC from "react-aria-components";
|
|
7
|
-
import {
|
|
7
|
+
import { PopoverProps as PopoverProps$1 } from "react-aria-components";
|
|
8
8
|
|
|
9
9
|
//#region src/client/components/primitives/docs-layout.d.ts
|
|
10
10
|
/**
|
|
@@ -527,7 +527,7 @@ declare function MenuSeparator(props: RAC.SeparatorProps): _$react_jsx_runtime0.
|
|
|
527
527
|
//#endregion
|
|
528
528
|
//#region src/client/components/primitives/page-nav.d.ts
|
|
529
529
|
interface PageNavProps extends ComponentBase {
|
|
530
|
-
to:
|
|
530
|
+
to: BoltdocsRoutePathWithFallback;
|
|
531
531
|
direction: 'prev' | 'next';
|
|
532
532
|
}
|
|
533
533
|
declare function PageNav({
|
|
@@ -706,8 +706,10 @@ declare function BreadcrumbsLink({
|
|
|
706
706
|
href,
|
|
707
707
|
className,
|
|
708
708
|
...props
|
|
709
|
-
}:
|
|
709
|
+
}: {
|
|
710
|
+
href: BoltdocsRoutePathWithFallback;
|
|
710
711
|
className?: string;
|
|
712
|
+
children?: React.ReactNode;
|
|
711
713
|
}): _$react_jsx_runtime0.JSX.Element;
|
|
712
714
|
declare function BreadcrumbsSeparator({
|
|
713
715
|
className
|
|
@@ -716,7 +718,7 @@ declare function BreadcrumbsSeparator({
|
|
|
716
718
|
//#region src/client/components/primitives/navbar.d.ts
|
|
717
719
|
interface NavbarLinkProps extends Omit<ComponentBase, 'children'> {
|
|
718
720
|
label: ReactNode;
|
|
719
|
-
href:
|
|
721
|
+
href: BoltdocsRoutePathWithFallback;
|
|
720
722
|
to?: 'internal' | 'external';
|
|
721
723
|
}
|
|
722
724
|
interface NavbarLogoProps extends Omit<ComponentBase, 'children'> {
|
|
@@ -724,7 +726,7 @@ interface NavbarLogoProps extends Omit<ComponentBase, 'children'> {
|
|
|
724
726
|
alt: string;
|
|
725
727
|
width?: number;
|
|
726
728
|
height?: number;
|
|
727
|
-
href?:
|
|
729
|
+
href?: BoltdocsRoutePathWithFallback;
|
|
728
730
|
}
|
|
729
731
|
interface NavbarSearchTriggerProps extends ComponentBase {
|
|
730
732
|
onPress: () => void;
|
|
@@ -796,7 +798,7 @@ declare function NavbarTitle({
|
|
|
796
798
|
className,
|
|
797
799
|
href
|
|
798
800
|
}: {
|
|
799
|
-
href?:
|
|
801
|
+
href?: BoltdocsRoutePathWithFallback;
|
|
800
802
|
} & ComponentBase): _$react_jsx_runtime0.JSX.Element;
|
|
801
803
|
declare function NavbarLinks({
|
|
802
804
|
children,
|
|
@@ -822,7 +824,7 @@ declare function NavbarDropdownItem({
|
|
|
822
824
|
label,
|
|
823
825
|
className
|
|
824
826
|
}: {
|
|
825
|
-
href:
|
|
827
|
+
href: BoltdocsRoutePathWithFallback;
|
|
826
828
|
label: string;
|
|
827
829
|
className?: string;
|
|
828
830
|
}): _$react_jsx_runtime0.JSX.Element;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
|
-
import { A as BoltdocsRoutePathWithFallback, a as SidebarItem, c as SidebarItemsProps, d as SidebarMobile, f as SidebarRoot, i as SidebarHeader, l as SidebarLink, m as ComponentBase, n as SidebarContent, o as SidebarItemProps, p as SidebarSubGroup, r as SidebarGroup, s as SidebarItems, t as Sidebar, u as SidebarLinkProps } from "../sidebar-
|
|
2
|
+
import { A as BoltdocsRoutePathWithFallback, a as SidebarItem, c as SidebarItemsProps, d as SidebarMobile, f as SidebarRoot, i as SidebarHeader, l as SidebarLink, m as ComponentBase, n as SidebarContent, o as SidebarItemProps, p as SidebarSubGroup, r as SidebarGroup, s as SidebarItems, t as Sidebar, u as SidebarLinkProps } from "../sidebar-BAKgJ-Er.js";
|
|
3
3
|
import * as React$2 from "react";
|
|
4
4
|
import { Component, ComponentProps, ComponentType, ErrorInfo, ImgHTMLAttributes, ReactNode, RefObject } from "react";
|
|
5
5
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
6
|
import * as RAC from "react-aria-components";
|
|
7
|
-
import {
|
|
7
|
+
import { PopoverProps as PopoverProps$1 } from "react-aria-components";
|
|
8
8
|
|
|
9
9
|
//#region src/client/components/primitives/docs-layout.d.ts
|
|
10
10
|
/**
|
|
@@ -527,7 +527,7 @@ declare function MenuSeparator(props: RAC.SeparatorProps): _$react_jsx_runtime0.
|
|
|
527
527
|
//#endregion
|
|
528
528
|
//#region src/client/components/primitives/page-nav.d.ts
|
|
529
529
|
interface PageNavProps extends ComponentBase {
|
|
530
|
-
to:
|
|
530
|
+
to: BoltdocsRoutePathWithFallback;
|
|
531
531
|
direction: 'prev' | 'next';
|
|
532
532
|
}
|
|
533
533
|
declare function PageNav({
|
|
@@ -706,8 +706,10 @@ declare function BreadcrumbsLink({
|
|
|
706
706
|
href,
|
|
707
707
|
className,
|
|
708
708
|
...props
|
|
709
|
-
}:
|
|
709
|
+
}: {
|
|
710
|
+
href: BoltdocsRoutePathWithFallback;
|
|
710
711
|
className?: string;
|
|
712
|
+
children?: React.ReactNode;
|
|
711
713
|
}): _$react_jsx_runtime0.JSX.Element;
|
|
712
714
|
declare function BreadcrumbsSeparator({
|
|
713
715
|
className
|
|
@@ -716,7 +718,7 @@ declare function BreadcrumbsSeparator({
|
|
|
716
718
|
//#region src/client/components/primitives/navbar.d.ts
|
|
717
719
|
interface NavbarLinkProps extends Omit<ComponentBase, 'children'> {
|
|
718
720
|
label: ReactNode;
|
|
719
|
-
href:
|
|
721
|
+
href: BoltdocsRoutePathWithFallback;
|
|
720
722
|
to?: 'internal' | 'external';
|
|
721
723
|
}
|
|
722
724
|
interface NavbarLogoProps extends Omit<ComponentBase, 'children'> {
|
|
@@ -724,7 +726,7 @@ interface NavbarLogoProps extends Omit<ComponentBase, 'children'> {
|
|
|
724
726
|
alt: string;
|
|
725
727
|
width?: number;
|
|
726
728
|
height?: number;
|
|
727
|
-
href?:
|
|
729
|
+
href?: BoltdocsRoutePathWithFallback;
|
|
728
730
|
}
|
|
729
731
|
interface NavbarSearchTriggerProps extends ComponentBase {
|
|
730
732
|
onPress: () => void;
|
|
@@ -796,7 +798,7 @@ declare function NavbarTitle({
|
|
|
796
798
|
className,
|
|
797
799
|
href
|
|
798
800
|
}: {
|
|
799
|
-
href?:
|
|
801
|
+
href?: BoltdocsRoutePathWithFallback;
|
|
800
802
|
} & ComponentBase): _$react_jsx_runtime0.JSX.Element;
|
|
801
803
|
declare function NavbarLinks({
|
|
802
804
|
children,
|
|
@@ -822,7 +824,7 @@ declare function NavbarDropdownItem({
|
|
|
822
824
|
label,
|
|
823
825
|
className
|
|
824
826
|
}: {
|
|
825
|
-
href:
|
|
827
|
+
href: BoltdocsRoutePathWithFallback;
|
|
826
828
|
label: string;
|
|
827
829
|
className?: string;
|
|
828
830
|
}): _$react_jsx_runtime0.JSX.Element;
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
import { _ as Link, v as NavLink, y as cn } from "../icons-dev-kJyGWNeg.js";
|
|
7
|
-
import { a as CodeBlockGroup, i as CodeBlockContent, n as Tooltip, o as CodeBlockHeader, r as CodeBlock, s as Heading, t as Image } from "../image-
|
|
7
|
+
import { a as CodeBlockGroup, i as CodeBlockContent, n as Tooltip, o as CodeBlockHeader, r as CodeBlock, s as Heading, t as Image } from "../image-C9md50h2.js";
|
|
8
8
|
import { D as ButtonGroup, E as Popover, O as Breadcrumbs, T as Menu, _ as ScrollProvider, a as SidebarHeader, b as useItems, c as SidebarLink, d as SidebarSubGroup, f as PageNav, g as OnThisPageTree, h as OnThisPageItems, i as SidebarGroup, l as SidebarMobile, m as OnThisPage, n as Sidebar, o as SidebarItem, p as AnchorProvider, r as SidebarContent, s as SidebarItems, t as DocsLayout, u as SidebarRoot, v as useActiveAnchor, w as Tabs, y as useActiveAnchors } from "../docs-layout-6FQ8__ok.js";
|
|
9
|
-
import { a as Button, i as ErrorBoundaryFallback, n as Navbar, r as ErrorBoundary, t as SearchDialog } from "../search-dialog-
|
|
9
|
+
import { a as Button, i as ErrorBoundaryFallback, n as Navbar, r as ErrorBoundary, t as SearchDialog } from "../search-dialog-DaeSPvEo.js";
|
|
10
10
|
import { jsx } from "react/jsx-runtime";
|
|
11
11
|
|
|
12
12
|
//#region src/client/components/primitives/skeleton.tsx
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boltdocs - https://boltdocs.vercel.app
|
|
3
|
+
* Copyright (c) 2026 Jesus Alcala
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
const e=require(`./chunk-Ds5LZdWN.cjs`),t=require(`./errors-Dx6JHoKE.cjs`),n=require(`./types-generator-CYcHkDzZ.cjs`);let r=require(`node:path`);r=e.n(r);let i=require(`node:fs`);i=e.n(i);let a=require(`zod`),o=require(`@bdocs/dui`);function s(e){return e}const c=a.z.object({icon:a.z.string().max(50),link:a.z.string().url()});a.z.object({text:a.z.string().max(2e3).optional()});const l=a.z.object({name:a.z.string(),enforce:a.z.enum([`pre`,`post`]).optional(),version:a.z.string().optional(),boltdocsVersion:a.z.string().optional(),remarkPlugins:a.z.array(a.z.unknown()).optional(),rehypePlugins:a.z.array(a.z.unknown()).optional(),vitePlugins:a.z.array(a.z.unknown()).optional(),components:a.z.record(a.z.string(),a.z.string()).optional(),hooks:a.z.record(a.z.string(),a.z.unknown()).optional()}),u=a.z.object({title:a.z.union([a.z.string(),a.z.record(a.z.string(),a.z.string())]).optional(),description:a.z.union([a.z.string(),a.z.record(a.z.string(),a.z.string())]).optional(),logo:a.z.union([a.z.string(),a.z.object({dark:a.z.string(),light:a.z.string(),alt:a.z.string().optional(),width:a.z.number().optional(),height:a.z.number().optional()})]).optional(),navbar:a.z.array(a.z.object({label:a.z.union([a.z.string(),a.z.record(a.z.string(),a.z.string())]),href:a.z.string(),items:a.z.array(a.z.object({label:a.z.union([a.z.string(),a.z.record(a.z.string(),a.z.string())]),href:a.z.string()})).optional()})).optional(),sidebar:a.z.record(a.z.string(),a.z.array(a.z.object({text:a.z.string(),link:a.z.string()}))).optional(),sidebarGroups:a.z.record(a.z.string(),a.z.object({title:a.z.union([a.z.string(),a.z.record(a.z.string(),a.z.string())]).optional(),icon:a.z.string().optional()})).optional(),socialLinks:a.z.array(c).optional(),editLink:a.z.string().refine(e=>!e||e.includes(`:path`),{message:`editLink must contain ':path' placeholder if specified`}).optional(),communityHelp:a.z.string().url().optional(),version:a.z.string().max(50).optional(),githubRepo:a.z.string().max(100).optional(),favicon:a.z.string().optional(),tabs:a.z.array(a.z.object({id:a.z.string(),text:a.z.union([a.z.string(),a.z.record(a.z.string(),a.z.string())]),icon:a.z.string().optional()})).optional(),codeTheme:a.z.union([a.z.string(),a.z.object({light:a.z.string(),dark:a.z.string()})]).optional()}),d=a.z.union([a.z.string(),a.z.object({rules:a.z.array(a.z.object({userAgent:a.z.string(),allow:a.z.union([a.z.string(),a.z.array(a.z.string())]).optional(),disallow:a.z.union([a.z.string(),a.z.array(a.z.string())]).optional()})).optional(),sitemaps:a.z.array(a.z.string().url()).optional()})]),f=a.z.object({defaultLocale:a.z.string(),locales:a.z.union([a.z.record(a.z.string(),a.z.string()),a.z.array(a.z.string())]).transform(e=>Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e),localeConfigs:a.z.record(a.z.string(),a.z.object({label:a.z.string().optional(),direction:a.z.enum([`ltr`,`rtl`]).optional(),htmlLang:a.z.string().optional(),calendar:a.z.string().optional()})).optional()}),p=a.z.object({defaultVersion:a.z.string(),prefix:a.z.string().optional(),versions:a.z.array(a.z.object({label:a.z.string(),path:a.z.string()}))}),m=a.z.object({headers:a.z.record(a.z.string(),a.z.string()).optional(),enableCSP:a.z.boolean().optional(),customHeaders:a.z.record(a.z.string(),a.z.string()).optional()}),h=a.z.object({google:a.z.string().optional(),bing:a.z.string().optional(),yandex:a.z.string().optional(),pinterest:a.z.string().optional(),facebook:a.z.string().optional()}),g=a.z.object({metatags:a.z.record(a.z.string(),a.z.string()).optional(),indexing:a.z.enum([`all`,`public`]).optional(),thumbnails:a.z.object({background:a.z.string().optional()}).optional(),verification:h.optional()}),_=a.z.object({measurementId:a.z.string().min(1,`Measurement ID is required for GA4`),debug:a.z.boolean().optional(),anonymizeIp:a.z.boolean().optional(),sendPageView:a.z.boolean().optional(),cookieFlags:a.z.string().optional(),autoTrack:a.z.object({pageViews:a.z.boolean().optional(),downloads:a.z.boolean().optional(),externalLinks:a.z.boolean().optional(),search:a.z.boolean().optional()}).optional()}),v=a.z.object({tagId:a.z.string().min(1,`Tag ID is required for GTM`),dataLayerName:a.z.string().optional(),preview:a.z.string().optional()}),y=a.z.object({appId:a.z.string().min(1,`Algolia App ID is required`),apiKey:a.z.string().min(1,`Algolia API Key is required`),indexName:a.z.string().min(1,`Algolia Index Name is required`)}),b=a.z.object({repo:a.z.string().min(1,`Giscus repository is required`),repoId:a.z.string().min(1,`Giscus repository ID is required`),category:a.z.string().optional(),categoryId:a.z.string().optional(),mapping:a.z.enum([`pathname`,`url`,`title`,`og:title`,`specific`,`number`]).optional(),strict:a.z.union([a.z.enum([`0`,`1`]),a.z.boolean()]).optional(),reactionsEnabled:a.z.union([a.z.enum([`0`,`1`]),a.z.boolean()]).optional(),emitMetadata:a.z.union([a.z.enum([`0`,`1`]),a.z.boolean()]).optional(),inputPosition:a.z.enum([`top`,`bottom`]).optional(),theme:a.z.string().optional(),darkTheme:a.z.string().optional(),lang:a.z.string().optional(),loading:a.z.enum([`lazy`,`eager`]).optional()}),x=a.z.object({enabled:a.z.boolean(),owner:a.z.string().min(1,`GitHub owner is required`),repo:a.z.string().min(1,`GitHub repository name is required`),categorySlug:a.z.string().optional(),endpoint:a.z.string().optional()}),S=a.z.object({analytics:a.z.boolean().optional(),speedInsights:a.z.boolean().optional()}),C=a.z.object({ga4:_.optional(),gtm:v.optional(),vercel:S.optional()}),w=a.z.object({algolia:y.optional()}),T=a.z.object({giscus:b.optional(),custom:x.optional()}),E=a.z.object({analytics:C.optional(),search:w.optional(),feedback:T.optional()}),D=a.z.object({siteUrl:a.z.string().url().optional(),docsDir:a.z.string().optional(),base:a.z.string().optional(),theme:u.optional(),i18n:f.optional(),versions:p.optional(),plugins:a.z.array(l).optional(),robots:d.optional(),security:m.optional(),seo:g.optional(),integrations:E.optional(),vite:a.z.record(a.z.string(),a.z.unknown()).optional()}),O=[`boltdocs.config.js`,`boltdocs.config.mjs`,`boltdocs.config.ts`];async function k(e,n=process.cwd()){let a=n,s={docsDir:r.default.resolve(e),theme:{title:`Boltdocs`,description:`A Vite documentation framework`,navbar:[{label:`Home`,href:`/`},{label:`Documentation`,href:`/docs`}],codeTheme:{light:`github-light`,dark:`github-dark`}}},c={};for(let e of O){let t=r.default.resolve(a,e);if(i.default.existsSync(t))try{let{loadConfigFromFile:e}=await import(`vite`),n=await e({command:`serve`,mode:`development`},t,a);if(n){c=n.config;break}}catch(t){(0,o.warn)(`Failed to load config from ${e}:`,t)}}let l={title:c.title,description:c.description,logo:c.logo,favicon:c.favicon,navbar:c.navbar,sidebar:c.sidebar,sidebarGroups:c.theme?.sidebarGroups,socialLinks:c.socialLinks,githubRepo:c.githubRepo,tabs:c.tabs,codeTheme:c.codeTheme,communityHelp:c.communityHelp,version:c.version,editLink:c.editLink,...c.theme||{}},u=Object.fromEntries(Object.entries(l).filter(([e,t])=>t!==void 0));u.navbar&&=u.navbar.map(e=>({label:e.label||e.text||``,href:e.href||e.link||e.to||``,items:e.items}));let d={docsDir:r.default.resolve(e),theme:{...s.theme,...u},i18n:c.i18n?{...c.i18n,locales:Array.isArray(c.i18n.locales)?Object.fromEntries(c.i18n.locales.map(e=>[e,e])):c.i18n.locales}:void 0,versions:c.versions,siteUrl:c.siteUrl,base:c.base,seo:c.seo,plugins:c.plugins||[],robots:c.robots,security:c.security,integrations:c.integrations,vite:c.vite},f=D.safeParse(d);if(!f.success)throw new t.r(`Invalid Boltdocs configuration:\n${f.error.issues.map(e=>` - ${e.path.join(`.`)}: ${e.message}`).join(`
|
|
7
|
+
`)}`);return f.data}async function A(e,t=process.cwd()){let r=await k(e,t);return n.t(r,e,t),r}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return O}});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boltdocs - https://boltdocs.vercel.app
|
|
3
|
+
* Copyright (c) 2026 Jesus Alcala
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import{t as e}from"./rolldown-runtime-fkIsjY3S.mjs";import{r as t}from"./errors-C0Hx15Ag.mjs";import{t as n}from"./types-generator-DVOnRVKU.mjs";import r from"node:path";import i from"node:fs";import{z as a}from"zod";import{warn as o}from"@bdocs/dui";function s(e){return e}const c=a.object({icon:a.string().max(50),link:a.string().url()});a.object({text:a.string().max(2e3).optional()});const l=a.object({name:a.string(),enforce:a.enum([`pre`,`post`]).optional(),version:a.string().optional(),boltdocsVersion:a.string().optional(),remarkPlugins:a.array(a.unknown()).optional(),rehypePlugins:a.array(a.unknown()).optional(),vitePlugins:a.array(a.unknown()).optional(),components:a.record(a.string(),a.string()).optional(),hooks:a.record(a.string(),a.unknown()).optional()}),u=a.object({title:a.union([a.string(),a.record(a.string(),a.string())]).optional(),description:a.union([a.string(),a.record(a.string(),a.string())]).optional(),logo:a.union([a.string(),a.object({dark:a.string(),light:a.string(),alt:a.string().optional(),width:a.number().optional(),height:a.number().optional()})]).optional(),navbar:a.array(a.object({label:a.union([a.string(),a.record(a.string(),a.string())]),href:a.string(),items:a.array(a.object({label:a.union([a.string(),a.record(a.string(),a.string())]),href:a.string()})).optional()})).optional(),sidebar:a.record(a.string(),a.array(a.object({text:a.string(),link:a.string()}))).optional(),sidebarGroups:a.record(a.string(),a.object({title:a.union([a.string(),a.record(a.string(),a.string())]).optional(),icon:a.string().optional()})).optional(),socialLinks:a.array(c).optional(),editLink:a.string().refine(e=>!e||e.includes(`:path`),{message:`editLink must contain ':path' placeholder if specified`}).optional(),communityHelp:a.string().url().optional(),version:a.string().max(50).optional(),githubRepo:a.string().max(100).optional(),favicon:a.string().optional(),tabs:a.array(a.object({id:a.string(),text:a.union([a.string(),a.record(a.string(),a.string())]),icon:a.string().optional()})).optional(),codeTheme:a.union([a.string(),a.object({light:a.string(),dark:a.string()})]).optional()}),d=a.union([a.string(),a.object({rules:a.array(a.object({userAgent:a.string(),allow:a.union([a.string(),a.array(a.string())]).optional(),disallow:a.union([a.string(),a.array(a.string())]).optional()})).optional(),sitemaps:a.array(a.string().url()).optional()})]),f=a.object({defaultLocale:a.string(),locales:a.union([a.record(a.string(),a.string()),a.array(a.string())]).transform(e=>Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e),localeConfigs:a.record(a.string(),a.object({label:a.string().optional(),direction:a.enum([`ltr`,`rtl`]).optional(),htmlLang:a.string().optional(),calendar:a.string().optional()})).optional()}),p=a.object({defaultVersion:a.string(),prefix:a.string().optional(),versions:a.array(a.object({label:a.string(),path:a.string()}))}),m=a.object({headers:a.record(a.string(),a.string()).optional(),enableCSP:a.boolean().optional(),customHeaders:a.record(a.string(),a.string()).optional()}),h=a.object({google:a.string().optional(),bing:a.string().optional(),yandex:a.string().optional(),pinterest:a.string().optional(),facebook:a.string().optional()}),g=a.object({metatags:a.record(a.string(),a.string()).optional(),indexing:a.enum([`all`,`public`]).optional(),thumbnails:a.object({background:a.string().optional()}).optional(),verification:h.optional()}),_=a.object({measurementId:a.string().min(1,`Measurement ID is required for GA4`),debug:a.boolean().optional(),anonymizeIp:a.boolean().optional(),sendPageView:a.boolean().optional(),cookieFlags:a.string().optional(),autoTrack:a.object({pageViews:a.boolean().optional(),downloads:a.boolean().optional(),externalLinks:a.boolean().optional(),search:a.boolean().optional()}).optional()}),v=a.object({tagId:a.string().min(1,`Tag ID is required for GTM`),dataLayerName:a.string().optional(),preview:a.string().optional()}),y=a.object({appId:a.string().min(1,`Algolia App ID is required`),apiKey:a.string().min(1,`Algolia API Key is required`),indexName:a.string().min(1,`Algolia Index Name is required`)}),b=a.object({repo:a.string().min(1,`Giscus repository is required`),repoId:a.string().min(1,`Giscus repository ID is required`),category:a.string().optional(),categoryId:a.string().optional(),mapping:a.enum([`pathname`,`url`,`title`,`og:title`,`specific`,`number`]).optional(),strict:a.union([a.enum([`0`,`1`]),a.boolean()]).optional(),reactionsEnabled:a.union([a.enum([`0`,`1`]),a.boolean()]).optional(),emitMetadata:a.union([a.enum([`0`,`1`]),a.boolean()]).optional(),inputPosition:a.enum([`top`,`bottom`]).optional(),theme:a.string().optional(),darkTheme:a.string().optional(),lang:a.string().optional(),loading:a.enum([`lazy`,`eager`]).optional()}),x=a.object({enabled:a.boolean(),owner:a.string().min(1,`GitHub owner is required`),repo:a.string().min(1,`GitHub repository name is required`),categorySlug:a.string().optional(),endpoint:a.string().optional()}),S=a.object({analytics:a.boolean().optional(),speedInsights:a.boolean().optional()}),C=a.object({ga4:_.optional(),gtm:v.optional(),vercel:S.optional()}),w=a.object({algolia:y.optional()}),T=a.object({giscus:b.optional(),custom:x.optional()}),E=a.object({analytics:C.optional(),search:w.optional(),feedback:T.optional()}),D=a.object({siteUrl:a.string().url().optional(),docsDir:a.string().optional(),base:a.string().optional(),theme:u.optional(),i18n:f.optional(),versions:p.optional(),plugins:a.array(l).optional(),robots:d.optional(),security:m.optional(),seo:g.optional(),integrations:E.optional(),vite:a.record(a.string(),a.unknown()).optional()});var O=e({CONFIG_FILES:()=>k,defineConfig:()=>s,resolveConfig:()=>A,resolveConfigAndGenerateTypes:()=>j});const k=[`boltdocs.config.js`,`boltdocs.config.mjs`,`boltdocs.config.ts`];async function A(e,n=process.cwd()){let a=n,s={docsDir:r.resolve(e),theme:{title:`Boltdocs`,description:`A Vite documentation framework`,navbar:[{label:`Home`,href:`/`},{label:`Documentation`,href:`/docs`}],codeTheme:{light:`github-light`,dark:`github-dark`}}},c={};for(let e of k){let t=r.resolve(a,e);if(i.existsSync(t))try{let{loadConfigFromFile:e}=await import(`vite`),n=await e({command:`serve`,mode:`development`},t,a);if(n){c=n.config;break}}catch(t){o(`Failed to load config from ${e}:`,t)}}let l={title:c.title,description:c.description,logo:c.logo,favicon:c.favicon,navbar:c.navbar,sidebar:c.sidebar,sidebarGroups:c.theme?.sidebarGroups,socialLinks:c.socialLinks,githubRepo:c.githubRepo,tabs:c.tabs,codeTheme:c.codeTheme,communityHelp:c.communityHelp,version:c.version,editLink:c.editLink,...c.theme||{}},u=Object.fromEntries(Object.entries(l).filter(([e,t])=>t!==void 0));u.navbar&&=u.navbar.map(e=>({label:e.label||e.text||``,href:e.href||e.link||e.to||``,items:e.items}));let d={docsDir:r.resolve(e),theme:{...s.theme,...u},i18n:c.i18n?{...c.i18n,locales:Array.isArray(c.i18n.locales)?Object.fromEntries(c.i18n.locales.map(e=>[e,e])):c.i18n.locales}:void 0,versions:c.versions,siteUrl:c.siteUrl,base:c.base,seo:c.seo,plugins:c.plugins||[],robots:c.robots,security:c.security,integrations:c.integrations,vite:c.vite},f=D.safeParse(d);if(!f.success)throw new t(`Invalid Boltdocs configuration:\n${f.error.issues.map(e=>` - ${e.path.join(`.`)}: ${e.message}`).join(`
|
|
7
|
+
`)}`);return f.data}async function j(e,t=process.cwd()){let r=await A(e,t);return n(r,e,t),r}export{s as a,l as i,O as n,A as r,k as t};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Copyright (c) 2026 Jesus Alcala
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
const e=require(`./config-
|
|
6
|
+
const e=require(`./config-B5uVv5q4.cjs`);exports.CONFIG_FILES=e.t,exports.defineConfig=e.a,exports.resolveConfig=e.n,exports.resolveConfigAndGenerateTypes=e.r;
|
|
@@ -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
|
+
import{t as e}from"./rolldown-runtime-fkIsjY3S.mjs";var t=e({getCSPHeader:()=>n});function n(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(`; `)}export{n,t};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boltdocs - https://boltdocs.vercel.app
|
|
3
|
+
* Copyright (c) 2026 Jesus Alcala
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import{t as e}from"./rolldown-runtime-fkIsjY3S.mjs";import{_ as t,a as n,d as r,u as i}from"./utils-B3xYMrpK.mjs";import{t as a}from"./pages-external-BYa4JSda.mjs";import{r as o}from"./config-D3_zDkHh.mjs";import{t as s}from"./node/cli-entry.mjs";import c from"node:path";import l from"node:fs";import{bullet as u,colors as d,confirm as f,dividerLog as p,double as m,error as h,info as g,round as _,single as v,success as y,tasks as b,warn as x}from"@bdocs/dui";import{fdir as S}from"fdir";import C from"picomatch";import{distance as w}from"fastest-levenshtein";const T={$schema:`https://boltdocs.vercel.app/schemas/doctor-config.schema.json`,checks:{metadata:{enabled:!0,titleMin:10,titleMax:60,descriptionMin:50,required:[`title`,`description`],optional:[],validateDates:!1},links:{internal:!0,external:!1,timeout:1e4,concurrency:10,ignore:[]},i18n:{enabled:!0},performance:{enabled:!0,budgets:{maxJSBundleSize:`200kb`,maxCSSBundleSize:`30kb`,maxPageHTMLSize:`80kb`,maxImagesKB:500,maxBuildTime:3e4,maxFontCount:3}}},fix:{confirmChanges:!1,backupFiles:!1,backupPath:`.boltdocs/backups`},reporting:{format:`pretty`,outputFile:`.boltdocs/reports/doctor.json`,failOnError:!1,maxWarnings:-1},severity:{missingTranslation:`warning`,brokenLink:`high`,brokenAnchor:`warning`,largeFile:`warning`,orphanedPage:`low`,duplicateTitle:`low`,shortMetadata:`low`,missingMetadata:`warning`,malformedFrontmatter:`high`,invalidFrontmatter:`high`,budgetExceeded:`warning`},exclude:[]};function E(e,t){if(e==null)return t;if(typeof e==`number`)return e;let n=e.toLowerCase().match(/^(\d+(?:\.\d+)?)\s*(b|kb|mb|gb)?$/);if(!n)return t;let r=Number.parseFloat(n[1]),i=n[2]||`b`;return Math.round(r*({b:1,kb:1024,mb:1024*1024,gb:1024*1024*1024}[i]||1))}function D(e,t,n){return e.doctorConfig.severity[t]||n}async function O(e,t){l.existsSync(t)||l.mkdirSync(t,{recursive:!0});let n=c.basename(e),r=new Date().toISOString().replace(/[:.]/g,`-`),i=c.join(t,`${n}.${r}.bak`);l.copyFileSync(e,i)}const k=new Map;function A(e){let t=k.get(e);if(t)return t;let n=(async()=>{let t=await r(e,!1);return{raw:t.raw,data:t.data,content:t.content}})();return k.set(e,n),n}const j=new Map;function M(e){if(j.has(e))return j.get(e);let t=!1;try{t=l.existsSync(e)&&l.statSync(e).isFile()}catch{t=!1}return j.set(e,t),t}async function N(e){let t=c.resolve(e,`doctor.json`);if(l.existsSync(t))try{let e=JSON.parse(l.readFileSync(t,`utf-8`));return{...T,...e,checks:{...T.checks,...e.checks,metadata:{...T.checks.metadata,...e.checks?.metadata},links:{...T.checks.links,...e.checks?.links},i18n:{...T.checks.i18n,...e.checks?.i18n},performance:{...T.checks.performance,...e.checks?.performance,budgets:{...T.checks.performance?.budgets,...e.checks?.performance?.budgets}}},fix:{...T.fix,...e.fix},reporting:{...T.reporting,...e.reporting},severity:{...T.severity,...e.severity},exclude:[...T.exclude,...e.exclude||[]]}}catch(e){x(`Failed to parse doctor.json: ${e}`)}return T}async function P(e,t=process.cwd(),r,i){let o=c.resolve(t,`.boltdocs`,`generated`);l.existsSync(o)||l.mkdirSync(o,{recursive:!0});let s=i;s||=await new S().withFullPaths().filter(e=>e.endsWith(`.md`)||e.endsWith(`.mdx`)).crawl(e).withPromise();let u=r?.base||`/docs`,d=[];for(let t=0;t<s.length;t+=100){let r=s.slice(t,t+100),i=await Promise.all(r.map(async t=>{let r=c.isAbsolute(t)?t:c.resolve(e,t),i=c.relative(e,r),{data:a}=await A(r),o;return o=a.permalink?a.permalink.startsWith(`/`)?a.permalink:`/${a.permalink}`:n(i),u===`/`?o:(u.endsWith(`/`)?u:u+`/`)+(o.startsWith(`/`)?o.substring(1):o)}));d.push(...i)}d.includes(u)||d.push(u);let f=a(e,r);for(let e of f)d.includes(e)||d.push(e);let p={routes:Array.from(new Set(d)).sort(),timestamp:Date.now()};return l.writeFileSync(c.resolve(o,`link-tree.json`),JSON.stringify(p,null,2)),p}function F(e,t){if(e===t)return 1;if(!e||!t)return 0;let n=e.split(`/`).filter(Boolean),r=t.split(`/`).filter(Boolean),i=n[n.length-1]||``,a=r[r.length-1]||``;if(i===a){let e=0;for(let t of n)r.includes(t)&&e++;return e>=2?.99:.9}if(i.length>3&&a.length>3&&(a.startsWith(i)||i.startsWith(a))&&Math.min(i.length,a.length)/Math.max(i.length,a.length)>.5)return .88;let o=1-w(i,a)/Math.max(i.length,a.length);return o>.8?o*.95:1-w(e,t)/Math.max(e.length,t.length)}const I=new Map;function L(e,t){if(I.has(e))return I.get(e);let n=e.length,r=``,i=0;for(let a of t){if(a===e)continue;let t=a.length,o=Math.max(n,t);if(o===0)continue;let s=1-Math.abs(n-t)/o;if(s<=.8&&s<=i)continue;let c=F(e,a);c>i&&(i=c,r=a)}let a={bestMatch:r,similarity:i};return I.set(e,a),a}async function R(e){let n=[];if(!e.doctorConfig.checks.metadata.enabled)return n;let{titleMin:r,titleMax:a,descriptionMin:o}=e.doctorConfig.checks.metadata,s=new Map;for(let l of e.files){let u=i(c.relative(e.docsDir,l));try{let{raw:i,data:c}=await A(l);if(i.trim().startsWith(`---`)&&i.split(`---`).length>=3&&Object.keys(c).length===0){let t=D(e,`malformedFrontmatter`,`high`);t!==`off`&&n.push({file:u,level:t,message:`Malformed frontmatter (YAML parsing failed).`,suggestion:`Check your YAML syntax for indentation or unquoted special characters.`})}let d=t.safeParse(c);if(!d.success){let t=D(e,`invalidFrontmatter`,`high`);if(t!==`off`)for(let e of d.error.issues)n.push({file:u,level:t,message:`Invalid frontmatter field "${e.path.join(`.`)}": ${e.message}`,suggestion:`Ensure the field follows the correct type.`})}let f=Array.from(new Set([`title`,...e.doctorConfig.checks.metadata.required]));for(let t of f)if(c[t]===void 0){let r=D(e,`missingMetadata`,`warning`);r!==`off`&&n.push({file:u,level:r,message:`Missing required frontmatter field: "${t}".`,suggestion:`Add the "${t}" field to your frontmatter.`})}if(e.doctorConfig.checks.metadata.validateDates){let t=[`date`,`lastUpdated`,...e.doctorConfig.checks.metadata.optional.filter(e=>e.toLowerCase().includes(`date`))];for(let r of t)if(c[r]&&Number.isNaN(Date.parse(String(c[r])))){let t=D(e,`invalidFrontmatter`,`high`);t!==`off`&&n.push({file:u,level:t,message:`Invalid date format in field "${r}": "${c[r]}".`,suggestion:`Use a valid ISO date format (e.g., YYYY-MM-DD).`})}}if(c.title){let t=String(c.title);if(t.length<r){let i=D(e,`shortMetadata`,`low`);i!==`off`&&n.push({file:u,level:i,message:`Title is too short (${t.length} chars).`,suggestion:`Titles should be at least ${r} characters for better SEO.`})}else if(t.length>a){let r=D(e,`shortMetadata`,`low`);r!==`off`&&n.push({file:u,level:r,message:`Title is too long (${t.length} chars).`,suggestion:`Titles should be under ${a} characters.`})}let i=s.get(t)||[];i.push(u),s.set(t,i)}if(c.description&&String(c.description).length<o){let t=D(e,`shortMetadata`,`low`);t!==`off`&&n.push({file:u,level:t,message:`Description is very short.`,suggestion:`Descriptions should ideally be at least ${o} characters.`})}}catch(t){if(t instanceof Error){let r=D(e,`malformedFrontmatter`,`high`);r!==`off`&&n.push({file:u,level:r,message:`Malformed frontmatter (YAML error): ${t.message}`,suggestion:`Check your YAML syntax for indentation or unquoted special characters.`})}}}for(let[t,r]of s.entries())if(r.length>1){let i=D(e,`duplicateTitle`,`low`);if(i!==`off`)for(let e of r)n.push({file:e,level:i,message:`Duplicate title found: "${t}"`,suggestion:`Ensure each page has a unique title. Also used in: ${r.filter(t=>t!==e).join(`, `)}`})}return n}async function z(e){let t=[],{internal:n,external:r,ignore:a,timeout:o,concurrency:s}=e.doctorConfig.checks.links;if(!n&&!r&&!e.options.checkExternal)return t;let u=/(?:\[.*?\]\((.*?)\))|(?:href=["']([^"']+)["'])/g,f=new Set,p=5e5;for(let o of e.files){let s=i(c.relative(e.docsDir,o)),{content:d}=await A(o),m=[...(d.length>p?d.slice(0,p):d).replace(/```[\s\S]*?```/g,``).replace(/`[^`\n]*`/g,``).matchAll(u)];for(let i of m){let u=i[1]||i[2],d=!!i[1];if(!u||a.some(e=>u.includes(e)))continue;if(/^https?:\/\//i.test(u)){(r||e.options.checkExternal)&&f.add({url:u,file:o});continue}if(!n||/^(mailto|tel|#)/i.test(u))continue;let p;try{p=decodeURIComponent(u.split(`#`)[0].split(`?`)[0])}catch{p=u.split(`#`)[0].split(`?`)[0]}if(!p)continue;let m=!1,h=``;if(p.startsWith(`/`))if(e.routeIndex.has(p)||e.routeIndexWithSlash.has(p)||e.routeIndexWithoutSlash.has(p))m=!0;else{let t=e.basePrefix+(p.startsWith(`/`)?p:`/`+p);if(e.routeIndex.has(t)||e.routeIndexWithSlash.has(t))m=!1,h=t;else{let t=e.config.base!==`/`&&p.startsWith(e.config.base||`/`)?p.substring((e.config.base||`/`).length):p,n=t.startsWith(`/`)?t.substring(1):t;h=c.join(e.docsDir,n),m=[``,`.md`,`.mdx`,`/index.md`,`/index.mdx`].some(e=>M(h+e))}}else h=c.resolve(c.dirname(o),p),m=[``,`.md`,`.mdx`,`/index.md`,`/index.mdx`].some(e=>M(h+e));if(!m){let{bestMatch:n,similarity:r}=L(p,e.linkTree.routes),i=!1,a=e.basePrefix+(p.startsWith(`/`)?p:`/`+p);(e.routeIndex.has(a)||e.routeIndexWithSlash.has(a))&&(n=a,r=1,i=!0);let c=r>.6||i,f=r>.75&&n!==p||i,m=D(e,`brokenLink`,`high`);m!==`off`&&t.push({file:s,level:m,message:`Broken internal link: "${u}"`,suggestion:c?`Did you mean "${n}"?`:`Ensure the target exists or check for typos.`,fix:f?async()=>{let e=u.includes(`#`)?`#`+u.split(`#`)[1]:``,t=d?`(${u})`:`href="${u}"`,r=d?`(${n}${e})`:`href="${n}${e}"`,i=l.readFileSync(o,`utf-8`).replace(t,r);l.writeFileSync(o,i),k.delete(o)}:void 0})}}}if(f.size>0){g(d.gray(`Verifying ${f.size} external links...`));let n=new Map;for(let e of f)n.has(e.url)||n.set(e.url,[]),n.get(e.url).push(e.file);let r=async e=>{try{let t=new AbortController,n=setTimeout(()=>t.abort(),o),r=await fetch(e,{method:`HEAD`,signal:t.signal,headers:{"User-Agent":`boltdocs-doctor/1.0`}});return clearTimeout(n),!r.ok&&r.status!==404?{url:e,ok:(await fetch(e,{method:`GET`,signal:t.signal,headers:{"User-Agent":`boltdocs-doctor/1.0`}})).ok}:{url:e,ok:r.ok}}catch(t){return{url:e,ok:!1,error:t.message}}},a=Array.from(n.keys()),l=[];for(let e=0;e<a.length;e+=s){let t=a.slice(e,e+s),n=await Promise.allSettled(t.map(r));l.push(...n.map(e=>e.status===`fulfilled`?e.value:{url:`unknown`,ok:!1,error:e.reason}))}for(let r of l)if(!r.ok){let a=D(e,`brokenLink`,`warning`);if(a!==`off`){let o=n.get(r.url)||[];for(let n of o)t.push({file:i(c.relative(e.docsDir,n)),level:a,message:`Broken external link: "${r.url}"`,suggestion:`Verify the URL or update it if it's permanently down. Error: ${r.error||`Status >= 400`}`})}}}return t}async function B(e){let t=[];if(!e.doctorConfig.checks.i18n.enabled||!e.config.i18n)return t;let{defaultLocale:n,locales:r}=e.config.i18n,a=Object.keys(r),o=a.filter(e=>e!==n);for(let r of e.files){let s=i(c.relative(e.docsDir,r)),u=s.split(`/`),d=u[0];if(d===n){let n=u.slice(1).join(`/`);for(let i of o){let a=c.join(e.docsDir,i,n);if(!M(a)){let o=D(e,`missingTranslation`,`warning`);o!==`off`&&t.push({file:s,level:o,message:`Missing translation for locale "${i}"`,suggestion:`Create a version at "${i}/${n}".`,fix:async()=>{let e=c.dirname(a);l.existsSync(e)||l.mkdirSync(e,{recursive:!0}),l.copyFileSync(r,a)}})}}}else if(a.includes(d)){let i=u.slice(1).join(`/`);if(!M(c.join(e.docsDir,n,i))){let a=D(e,`missingTranslation`,`low`);a!==`off`&&t.push({file:s,level:a,message:`Orphaned translation (source missing in "${n}")`,suggestion:`Remove this file or create the source at "${n}/${i}".`,fix:async()=>{l.unlinkSync(r)}})}}}return t}async function V(e){let t=[];if(!e.config.theme.sidebar)return t;let n=new Set,r=e.config.theme.sidebar;for(let[i,a]of Object.entries(r))for(let r of a){if(!r.text){let n=D(e,`invalidFrontmatter`,`warning`);n!==`off`&&t.push({file:`boltdocs.config.ts`,level:n,message:`Sidebar item in group "${i}" is missing a label.`,suggestion:`Add a "text" property to the sidebar item.`})}if(r.link&&(n.add(r.link),!e.routeIndex.has(r.link))){let{bestMatch:n,similarity:i}=L(r.link,e.linkTree.routes),a=i>.6,o=D(e,`brokenLink`,`high`);o!==`off`&&t.push({file:`boltdocs.config.ts`,level:o,message:`Broken sidebar link: "${r.link}"`,suggestion:a?`Did you mean "${n}"?`:`Ensure the route exists and is correctly formatted.`})}}for(let r of e.linkTree.routes)if(!(r===`/`||r===``)&&!n.has(r)){let n=D(e,`orphanedPage`,`low`);n!==`off`&&t.push({file:`Sidebar`,level:n,message:`Orphaned page found: "${r}" is not linked in the sidebar.`,suggestion:`Consider adding it to the sidebar for better discoverability.`})}return t}async function H(e){let t=[],n=e.doctorConfig.checks.performance;if(!n?.enabled)return t;let r=c.resolve(e.root,`.boltdocs`,`reports`,`performance.json`);if(!l.existsSync(r))return t.push({file:`(build)`,level:D(e,`budgetExceeded`,`warning`),message:"Performance metrics not found. Run `boltdocs build` first."}),t;let i;try{i=JSON.parse(l.readFileSync(r,`utf-8`))}catch{return t.push({file:`(build)`,level:D(e,`budgetExceeded`,`warning`),message:`Failed to parse performance metrics file.`}),t}let a=n.budgets,o=D(e,`budgetExceeded`,`warning`),s=E(a?.maxJSBundleSize,1/0),u=E(a?.maxCSSBundleSize,1/0),d=E(a?.maxPageHTMLSize,1/0),f=a?.maxImagesKB??1/0,p=a?.maxBuildTime??1/0,m=a?.maxFontCount??1/0;if(s!==1/0&&i.totalJSBundleSize>s){let e=(i.totalJSBundleSize/1024).toFixed(0),n=(s/1024).toFixed(0);t.push({file:`(build)`,level:o,message:`JS bundle size exceeds budget: ${e}kb > ${n}kb`,suggestion:`Code-split large dependencies or lazy-load route components.`})}if(u!==1/0&&i.totalCSSBundleSize>u){let e=(i.totalCSSBundleSize/1024).toFixed(0),n=(u/1024).toFixed(0);t.push({file:`(build)`,level:o,message:`CSS bundle size exceeds budget: ${e}kb > ${n}kb`,suggestion:`Remove unused styles or split CSS by route.`})}if(d!==1/0){for(let e of i.pages)if(e.htmlSize>d){let n=(e.htmlSize/1024).toFixed(0),r=(d/1024).toFixed(0);t.push({file:e.route,level:o,message:`Page HTML size exceeds budget: ${n}kb > ${r}kb`,suggestion:`Reduce the amount of inline content or split into sub-pages.`})}}let h=f*1024;if(f!==1/0&&i.totalImagesSize>h){let e=(i.totalImagesSize/1024).toFixed(0);t.push({file:`(build)`,level:o,message:`Image assets exceed budget: ${e}kb > ${f}kb`,suggestion:`Optimize images with lossy compression or use next-gen formats (webp/avif).`})}if(p!==1/0&&i.buildTime>p){let e=(i.buildTime/1e3).toFixed(1),n=(p/1e3).toFixed(1);t.push({file:`(build)`,level:o,message:`Build time exceeds budget: ${e}s > ${n}s`,suggestion:"Check for large unoptimized assets or increase `concurrency` in SSG options."})}return m!==1/0&&i.fontCount>m&&t.push({file:`(build)`,level:o,message:`Font files exceed budget: ${i.fontCount} > ${m}`,suggestion:`Reduce the number of font families or use variable fonts.`}),t}var U=e({DEFAULT_DOCTOR_CONFIG:()=>T,checkI18n:()=>B,checkLinks:()=>z,checkMetadata:()=>R,checkPerformance:()=>H,checkSidebar:()=>V,doctorAction:()=>G,doctorInit:()=>W,generateLinkTree:()=>P,loadDoctorConfig:()=>N});async function W(e){let t=c.resolve(e,`doctor.json`);if(l.existsSync(t)){x(`"doctor.json" already exists at ${e}.`);return}try{l.writeFileSync(t,JSON.stringify(T,null,2)),y(`Created "doctor.json" with default configuration.`)}catch(e){h(`Failed to create "doctor.json": ${e}`)}}async function G(e=process.cwd(),t={}){if(t.init){await W(e);return}s();try{let n=await N(e),{format:r}=n.reporting,i=performance.now(),a=await o(`docs`,e),s=c.resolve(e,`docs`);l.existsSync(s)||(r===`pretty`&&h(`Docs dir not found at ${s}`),process.exit(1)),r===`pretty`&&console.log(m([` ${d.dim(`Docs dir:`)} ${s}`,` ${d.dim(`Reports:`)} ${e}/.boltdocs/reports/`],{title:`✦ DOCTOR — Documentation Health Check`})),r===`pretty`&&g(d.dim(`🔍 Discovering files and routes...`));let x=C(n.exclude||[]),w=await new S().withFullPaths().filter(e=>{if(!(e.endsWith(`.md`)||e.endsWith(`.mdx`)))return!1;let t=c.relative(s,e).replace(/\\/g,`/`),n=t.split(`/`).some(e=>e.startsWith(`_`)&&e!==`_index.md`&&e!==`_index.mdx`);return!x(t)&&!n}).crawl(s).withPromise();for(let e of w)j.set(e,!0);let T=await P(s,e,a,w),E=a.base||`/`,D=E===`/`?``:E.endsWith(`/`)?E.slice(0,-1):E,k={root:e,docsDir:s,config:a,doctorConfig:n,linkTree:T,files:w,options:t,routeIndex:new Set(T.routes),routeIndexWithSlash:new Set(T.routes.map(e=>e.endsWith(`/`)?e:e+`/`)),routeIndexWithoutSlash:new Set(T.routes.map(e=>e.endsWith(`/`)?e.slice(0,-1):e)),basePrefix:D};r===`pretty`&&g(d.dim(`🧪 Running diagnostic checks in parallel...`));let A=[R(k),z(k),B(k),V(k)];t.budget&&A.push(H(k));let[M,F,I,L,...U]=await Promise.all(A),W=t.budget?U[0]:[],G=[...M,...F,...I,...L,...W];if(r===`pretty`){let e=[{label:`Metadata checks ${M.length>0?`— ${M.length} issue${M.length===1?``:`s`}`:`— OK`}`,done:M.length===0},{label:`Link checks ${F.length>0?`— ${F.length} issue${F.length===1?``:`s`}`:`— OK`}`,done:F.length===0},{label:`i18n checks ${I.length>0?`— ${I.length} issue${I.length===1?``:`s`}`:`— OK`}`,done:I.length===0},{label:`Sidebar checks ${L.length>0?`— ${L.length} issue${L.length===1?``:`s`}`:`— OK`}`,done:L.length===0}];t.budget&&e.push({label:`Performance budget ${W.length>0?`— ${W.length} issue${W.length===1?``:`s`}`:`— OK`}`,done:W.length===0}),console.log(`\n${b(e)}`)}let K=0;if(t.fix){for(let e of G)if(e.fix){if(k.doctorConfig.fix.confirmChanges&&!await f(`Fix issue in "${e.file}": ${e.message}?`))continue;if(k.doctorConfig.fix.backupFiles){let t=c.resolve(k.docsDir,e.file);l.existsSync(t)&&await O(t,c.resolve(k.root,k.doctorConfig.fix.backupPath))}await e.fix(),K++}}let q=((performance.now()-i)/1e3).toFixed(2),J=G.filter(e=>e.level===`high`).length,Y=G.filter(e=>e.level===`warning`).length,X=G.filter(e=>e.level===`low`).length,Z={summary:{total:G.length,high:J,warning:Y,low:X,fixed:K,duration:q},issues:G.map(e=>({...e,fix:void 0}))};if(n.reporting.outputFile){let t=c.resolve(e,n.reporting.outputFile);l.existsSync(c.dirname(t))||l.mkdirSync(c.dirname(t),{recursive:!0}),l.writeFileSync(t,JSON.stringify(Z,null,2))}if(r===`json`)console.log(JSON.stringify(Z,null,2));else if(r===`pretty`){let e=G.reduce((e,t)=>(e[t.file]||(e[t.file]=[]),e[t.file].push(t),e),{});if(G.length>0){p();for(let[n,r]of Object.entries(e)){let e=[];for(let n of r){let r=n.level===`high`?`❌`:n.level===`warning`?`⚠️`:`ℹ️`,i=n.level===`high`?d.red:n.level===`warning`?d.yellow:d.blue;e.push(`${r} ${i(n.level.toUpperCase())}: ${n.message}`),n.suggestion&&e.push(` ${d.dim(`💡 ${n.suggestion}`)}`),t.fix&&n.fix&&e.push(` ${d.green(`✅ Fixed automatically`)}`)}console.log(`\n${v(e,{title:`📄 ${n}`})}`)}p()}if(G.length===0)console.log(_([` Everything looks perfect!`,` Your documentation is in great shape.`,``,` ${d.dim(`Scanned ${w.length} file${w.length===1?``:`s`} in ${q}s`)}`],{title:`✨ Documentation Health Check`}));else{let e=[];J>0&&e.push(d.red(`${J} Critical Error${J===1?``:`s`}`)),Y>0&&e.push(d.yellow(`${Y} Warning${Y===1?``:`s`}`)),X>0&&e.push(d.blue(`${X} Improvement${X===1?``:`s`}`));let t=[...u(e).split(`
|
|
7
|
+
`).map(e=>e.trimStart()),``,d.dim(`Scanned ${w.length} file${w.length===1?``:`s`} in ${q}s`)];console.log(`\n${m(t,{title:`Diagnosis Results`})}\n`),K>0&&y(`Successfully fixed ${K} issues automatically!`),J>0?h(`Please fix the critical errors before building for production.`):y(`No critical issues found. You are ready to go!`)}}n.reporting.failOnError&&J>0&&process.exit(1),n.reporting.maxWarnings!==-1&&Y>n.reporting.maxWarnings&&(r===`pretty`&&h(`Failed: Too many warnings (${Y} > ${n.reporting.maxWarnings})`),process.exit(1))}catch(e){h(`Doctor failed: ${e}`),process.exit(1)}}export{P as n,U as t};
|