boltdocs 2.7.10 → 2.8.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/README.md +2 -2
- package/dist/banner-3N4Jd_L9.d.ts +100 -0
- package/dist/banner-MynZD_Ox.d.cts +100 -0
- package/dist/cache-BMUyNiiA.mjs +6 -0
- package/dist/cache-CKm45d2w.cjs +6 -0
- package/dist/client/index.cjs +2268 -1
- package/dist/client/index.d.cts +86 -110
- package/dist/client/index.d.ts +87 -111
- package/dist/client/index.js +2214 -1
- package/dist/client/mdx.cjs +12 -1
- package/dist/client/mdx.d.cts +39 -93
- package/dist/client/mdx.d.ts +38 -93
- package/dist/client/mdx.js +7 -1
- package/dist/client/primitives.cjs +60 -1
- package/dist/client/primitives.d.cts +411 -347
- package/dist/client/primitives.d.ts +411 -347
- package/dist/client/primitives.js +20 -1
- package/dist/docs-layout-CwCq42Zt.cjs +1348 -0
- package/dist/docs-layout-Dn6S5g59.js +1167 -0
- package/dist/doctor-BArviV8X.cjs +28 -0
- package/dist/doctor-CgLA7_Uv.mjs +28 -0
- package/dist/{doctor-CrytFkqW.cjs → doctor-DyNUVe96.cjs} +1 -1
- package/dist/{routes-DP1vmWRj.cjs → doctor-aN_leTbh.mjs} +1 -1
- package/dist/{generator-ClVanhvi.mjs → generator-BHCrLU6h.mjs} +2 -2
- package/dist/{generator-CHqxiQhF.cjs → generator-CC2yHzhZ.cjs} +2 -2
- package/dist/icons-dev-DvJ-hh9x.cjs +1209 -0
- package/dist/icons-dev-Oju24Wjp.js +845 -0
- package/dist/image-Ch4-GxdO.cjs +268 -0
- package/dist/image-Do8V9PCW.js +214 -0
- package/dist/mdx-D3A2_l7P.js +520 -0
- package/dist/mdx-PLhhPJRS.cjs +531 -0
- package/dist/node/cli-entry.cjs +3 -1
- package/dist/node/cli-entry.mjs +3 -1
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.d.cts +258 -152
- package/dist/node/index.d.mts +258 -150
- package/dist/node/index.mjs +1 -1
- package/dist/node/routes/worker.cjs +1 -1
- package/dist/node/routes/worker.mjs +1 -1
- package/dist/node-BmlP0eBP.cjs +159 -0
- package/dist/node-Y8_4ayje.mjs +159 -0
- package/dist/package-2nFy_NsW.cjs +6 -0
- package/dist/{package--0Yf0t1N.mjs → package-DAbtltXX.mjs} +1 -1
- package/dist/parser-B7-6PyQz.cjs +6 -0
- package/dist/{parser-Aq8LoH-0.cjs → parser-BzB-zCkF.cjs} +1 -1
- package/dist/parser-WGZdWs0X.mjs +6 -0
- package/dist/routes-BDDSxAl0.mjs +6 -0
- package/dist/routes-DJNJ-rTt.cjs +6 -0
- package/dist/routes-DiYC4nD2.cjs +6 -0
- package/dist/routes-_Bb2f4eI.mjs +6 -0
- package/dist/search-dialog-BXVoecTx.cjs +483 -0
- package/dist/search-dialog-BYhOov4S.cjs +331 -0
- package/dist/search-dialog-C09riYmx.js +313 -0
- package/dist/search-dialog-CUeAfy-8.cjs +8 -0
- package/dist/search-dialog-D8gLkhUV.js +453 -0
- package/dist/search-dialog-DHc_8FFX.js +8 -0
- package/dist/{sidebar-CcBkrm06.d.cts → sidebar-DNq4_ZAa.d.ts} +118 -52
- package/dist/{sidebar-CyZS9YOm.d.ts → sidebar-Dlkgbxs6.d.cts} +118 -52
- package/dist/utils-BYITg7T5.mjs +7 -0
- package/dist/utils-Cjmx1hhk.cjs +7 -0
- package/dist/worker-pool-CtqklOXq.cjs +6 -0
- package/dist/worker-pool-k0DY6k8T.mjs +6 -0
- package/package.json +5 -6
- package/src/shared/config-utils.ts +4 -0
- package/src/shared/types.ts +52 -6
- package/dist/cache-Ba-DZQNH.cjs +0 -6
- package/dist/cache-BuMZ58L5.mjs +0 -6
- package/dist/cards-BakZPTz9.d.ts +0 -30
- package/dist/cards-CQn9mXZS.d.cts +0 -30
- package/dist/docs-layout-KoWNZc8_.js +0 -6
- package/dist/docs-layout-x2yKt2cL.cjs +0 -6
- package/dist/doctor-Be7Ly1oM.mjs +0 -21
- package/dist/doctor-jMxWZyLJ.cjs +0 -21
- 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/node-DtEDyN1u.cjs +0 -111
- package/dist/node-_1jhMGYx.mjs +0 -111
- package/dist/package-DrwtlXfk.cjs +0 -6
- package/dist/parser-CdNbqN5y.cjs +0 -6
- package/dist/parser-nE792MLO.mjs +0 -6
- package/dist/rolldown-runtime-fkIsjY3S.mjs +0 -6
- package/dist/routes-2k3tbUmC.cjs +0 -6
- package/dist/routes-CpxZIsMM.mjs +0 -6
- package/dist/search-dialog-B584t9ZF.js +0 -6
- package/dist/search-dialog-BvBopRsZ.cjs +0 -6
- package/dist/search-dialog-ByvGScjt.js +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/dist/utils-CG65J0Sc.mjs +0 -7
- package/dist/utils-CKunkU96.cjs +0 -7
- package/dist/worker-pool-CGn7DrLb.mjs +0 -6
- package/dist/worker-pool-Crbqgw5R.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
- /package/dist/{meta-loader-CWg2gnbY.mjs → meta-loader-DzwDFtdT.mjs} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
import * as React$2 from "react";
|
|
3
3
|
import { ComponentType, ReactNode } from "react";
|
|
4
|
-
import { Plugin } from "vite";
|
|
5
4
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
+
import { Plugin } from "vite";
|
|
6
6
|
|
|
7
7
|
//#region src/shared/types.d.ts
|
|
8
8
|
/**
|
|
@@ -33,15 +33,15 @@ interface BoltdocsThemeConfig {
|
|
|
33
33
|
};
|
|
34
34
|
navbar?: Array<{
|
|
35
35
|
label: string | Record<string, string>;
|
|
36
|
-
href:
|
|
36
|
+
href: BoltdocsRoutePathWithFallback$1;
|
|
37
37
|
items?: Array<{
|
|
38
38
|
label: string | Record<string, string>;
|
|
39
|
-
href:
|
|
39
|
+
href: BoltdocsRoutePathWithFallback$1;
|
|
40
40
|
}>;
|
|
41
41
|
}>;
|
|
42
42
|
sidebar?: Record<string, Array<{
|
|
43
43
|
text: string;
|
|
44
|
-
link:
|
|
44
|
+
link: BoltdocsRoutePathWithFallback$1;
|
|
45
45
|
}>>;
|
|
46
46
|
sidebarGroups?: Record<string, {
|
|
47
47
|
title?: string | Record<string, string>;
|
|
@@ -111,24 +111,44 @@ interface BoltdocsVersionsConfig {
|
|
|
111
111
|
prefix?: string;
|
|
112
112
|
versions: BoltdocsVersionConfig[];
|
|
113
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Shared badge value type used in frontmatter, RouteMeta, and ComponentRoute.
|
|
116
|
+
*/
|
|
117
|
+
type BadgeValue = string | {
|
|
118
|
+
text: string;
|
|
119
|
+
expires?: string;
|
|
120
|
+
};
|
|
114
121
|
/**
|
|
115
122
|
* Defines a Boltdocs plugin.
|
|
123
|
+
*
|
|
124
|
+
* Use the `createPlugin()` helper from the node API for full type safety and
|
|
125
|
+
* access to lifecycle hooks.
|
|
116
126
|
*/
|
|
117
127
|
interface BoltdocsPlugin {
|
|
118
128
|
name: string;
|
|
119
129
|
enforce?: 'pre' | 'post';
|
|
120
130
|
version?: string;
|
|
121
131
|
boltdocsVersion?: string;
|
|
122
|
-
permissions?: string[];
|
|
123
132
|
remarkPlugins?: unknown[];
|
|
124
133
|
rehypePlugins?: unknown[];
|
|
125
134
|
vitePlugins?: Plugin[];
|
|
126
135
|
components?: Record<string, string>;
|
|
127
|
-
hooks
|
|
136
|
+
/** Lifecycle hooks — use the `PluginLifecycleHooks` type from the node API. */
|
|
137
|
+
hooks?: Record<string, (ctx: unknown) => Promise<void> | void>;
|
|
128
138
|
}
|
|
129
139
|
/**
|
|
130
|
-
* Configuration for
|
|
131
|
-
*/
|
|
140
|
+
* Configuration for the collections (blog) feature.
|
|
141
|
+
*/
|
|
142
|
+
interface BoltdocsCollectionsConfig {
|
|
143
|
+
/** Number of posts per page in collection listing pages. Defaults to 10. */
|
|
144
|
+
postsPerPage?: number;
|
|
145
|
+
/** The name of the default collection used by BlogList when none is specified. */
|
|
146
|
+
defaultCollection?: string;
|
|
147
|
+
/** Date format string for rendering post dates (e.g., 'MMMM dd, yyyy'). */
|
|
148
|
+
dateFormat?: string;
|
|
149
|
+
/** Field to sort posts by. Defaults to 'date'. */
|
|
150
|
+
sortBy?: 'date' | 'title' | 'sidebarPosition';
|
|
151
|
+
}
|
|
132
152
|
interface BoltdocsSecurityConfig {
|
|
133
153
|
headers?: Record<string, string>;
|
|
134
154
|
enableCSP?: boolean;
|
|
@@ -168,9 +188,18 @@ interface BoltdocsGTMConfig {
|
|
|
168
188
|
dataLayerName?: string;
|
|
169
189
|
preview?: string;
|
|
170
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* Configuration for Algolia DocSearch.
|
|
193
|
+
*/
|
|
194
|
+
interface BoltdocsAlgoliaConfig {
|
|
195
|
+
appId: string;
|
|
196
|
+
apiKey: string;
|
|
197
|
+
indexName: string;
|
|
198
|
+
}
|
|
171
199
|
interface BoltdocsIntegrationsConfig {
|
|
172
200
|
ga4?: BoltdocsGA4Config;
|
|
173
201
|
gtm?: BoltdocsGTMConfig;
|
|
202
|
+
algolia?: BoltdocsAlgoliaConfig;
|
|
174
203
|
}
|
|
175
204
|
/**
|
|
176
205
|
* The root configuration object for Boltdocs.
|
|
@@ -183,6 +212,7 @@ interface BoltdocsConfig$1 {
|
|
|
183
212
|
i18n?: BoltdocsI18nConfig;
|
|
184
213
|
versions?: BoltdocsVersionsConfig;
|
|
185
214
|
plugins?: BoltdocsPlugin[];
|
|
215
|
+
collections?: BoltdocsCollectionsConfig;
|
|
186
216
|
robots?: BoltdocsRobotsConfig;
|
|
187
217
|
security?: BoltdocsSecurityConfig;
|
|
188
218
|
seo?: BoltdocsSeoConfig;
|
|
@@ -198,9 +228,17 @@ interface BoltdocsConfig$1 {
|
|
|
198
228
|
declare global {
|
|
199
229
|
namespace Boltdocs {
|
|
200
230
|
interface Types {}
|
|
231
|
+
/**
|
|
232
|
+
* Marker interface augmented by generated code to provide strict route path typing.
|
|
233
|
+
* When no types have been generated (e.g., before first dev server start),
|
|
234
|
+
* keyof is never, and BoltdocsRoutePath falls back to string.
|
|
235
|
+
*/
|
|
236
|
+
interface RoutePaths {}
|
|
201
237
|
}
|
|
202
238
|
}
|
|
203
239
|
type BoltdocsTypes = Boltdocs.Types;
|
|
240
|
+
type BoltdocsRoutePath = keyof Boltdocs.RoutePaths;
|
|
241
|
+
type BoltdocsRoutePathWithFallback$1 = BoltdocsRoutePath extends never ? string : BoltdocsRoutePath;
|
|
204
242
|
type BoltdocsLocale = Boltdocs.Types extends {
|
|
205
243
|
Locale: infer L;
|
|
206
244
|
} ? L : string;
|
|
@@ -259,16 +297,15 @@ interface ComponentRoute {
|
|
|
259
297
|
/** The tab this route belongs to, if tabs are configured */
|
|
260
298
|
tab?: string;
|
|
261
299
|
/** Optional badge to display next to the sidebar item */
|
|
262
|
-
badge?:
|
|
263
|
-
text: 'updated' | 'new' | 'deprecated';
|
|
264
|
-
expires?: string;
|
|
265
|
-
};
|
|
300
|
+
badge?: BadgeValue;
|
|
266
301
|
/** Optional icon for the route's group */
|
|
267
302
|
groupIcon?: string;
|
|
268
303
|
/** The sub-route group this route belongs to (from folders starting with _) */
|
|
269
304
|
subRouteGroup?: string;
|
|
270
305
|
/** The nested sub-routes if this route acts as the parent of a subRouteGroup */
|
|
271
306
|
subRoutes?: ComponentRoute[];
|
|
307
|
+
/** Internal helper map for nesting routes during sidebar construction */
|
|
308
|
+
_subMap?: Map<string, ComponentRoute>;
|
|
272
309
|
/** The extracted plain-text content of the page for search indexing */
|
|
273
310
|
_content?: string;
|
|
274
311
|
/** The raw markdown content of the page */
|
|
@@ -277,10 +314,29 @@ interface ComponentRoute {
|
|
|
277
314
|
date?: string | Date;
|
|
278
315
|
/** The last updated timestamp or date */
|
|
279
316
|
lastUpdated?: string | number | Date;
|
|
317
|
+
/** The collection this route belongs to (from [name] directories) */
|
|
318
|
+
collection?: string;
|
|
319
|
+
/** Tags for blog posts */
|
|
320
|
+
tags?: string[];
|
|
321
|
+
/** Author identifier for blog posts */
|
|
322
|
+
author?: string | {
|
|
323
|
+
name: string;
|
|
324
|
+
avatar?: string;
|
|
325
|
+
url?: string;
|
|
326
|
+
image?: string;
|
|
327
|
+
};
|
|
328
|
+
/** Draft flag */
|
|
329
|
+
draft?: boolean;
|
|
330
|
+
/** Short excerpt for list displays */
|
|
331
|
+
excerpt?: string;
|
|
332
|
+
/** Cover image for blog posts */
|
|
333
|
+
coverImage?: string;
|
|
280
334
|
/** Raw extensible frontmatter data for custom components and formatters */
|
|
281
335
|
frontmatter?: Record<string, any>;
|
|
282
336
|
/** Clean URL segments stripped of locale/version prefixes */
|
|
283
337
|
slugParts?: string[];
|
|
338
|
+
/** SEO metadata for page headers */
|
|
339
|
+
seo?: Record<string, any>;
|
|
284
340
|
}
|
|
285
341
|
/**
|
|
286
342
|
* Site configuration provided by the server.
|
|
@@ -333,11 +389,50 @@ interface LayoutProps {
|
|
|
333
389
|
*/
|
|
334
390
|
interface NavbarLink {
|
|
335
391
|
label: string | Record<string, string>;
|
|
336
|
-
href:
|
|
392
|
+
href: BoltdocsRoutePathWithFallback;
|
|
337
393
|
active: boolean;
|
|
338
394
|
to?: string;
|
|
339
395
|
items?: NavbarLink[];
|
|
340
396
|
}
|
|
397
|
+
/**
|
|
398
|
+
* Shape of the data returned by a collection post route loader.
|
|
399
|
+
* Consumed by `BlogPost` via `useLoaderData<CollectionPostLoaderData>()`.
|
|
400
|
+
*/
|
|
401
|
+
interface CollectionPostLoaderData {
|
|
402
|
+
/** Full route metadata for this post (title, date, author, tags, etc.) */
|
|
403
|
+
route: ComponentRoute;
|
|
404
|
+
/** The name of the collection this post belongs to (e.g. 'blog') */
|
|
405
|
+
collection: string;
|
|
406
|
+
/** Extracted page headings for the Table of Contents */
|
|
407
|
+
headings: {
|
|
408
|
+
level: number;
|
|
409
|
+
text: string;
|
|
410
|
+
id: string;
|
|
411
|
+
}[];
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Shape of the data returned by a collection listing route loader.
|
|
415
|
+
* Consumed by `BlogList` via `useLoaderData<CollectionListLoaderData>()`.
|
|
416
|
+
*/
|
|
417
|
+
interface CollectionListLoaderData {
|
|
418
|
+
/** Paginated subset of posts to display on this page */
|
|
419
|
+
posts: Array<{
|
|
420
|
+
path: string;
|
|
421
|
+
title: string;
|
|
422
|
+
date?: string | Date;
|
|
423
|
+
excerpt?: string;
|
|
424
|
+
tags?: string[];
|
|
425
|
+
author?: string;
|
|
426
|
+
coverImage?: string;
|
|
427
|
+
filePath: string;
|
|
428
|
+
}>;
|
|
429
|
+
/** Total number of pages available */
|
|
430
|
+
totalPages: number;
|
|
431
|
+
/** Current page index (1-based) */
|
|
432
|
+
currentPage: number;
|
|
433
|
+
/** Collection name used to build pagination URLs (e.g. 'blog' → '/blog/page/2') */
|
|
434
|
+
collection: string;
|
|
435
|
+
}
|
|
341
436
|
//#endregion
|
|
342
437
|
//#region src/client/components/primitives/types.d.ts
|
|
343
438
|
type ComponentBase = {
|
|
@@ -377,7 +472,7 @@ declare function SidebarContent({
|
|
|
377
472
|
/**
|
|
378
473
|
* Navigation Group
|
|
379
474
|
*/
|
|
380
|
-
declare
|
|
475
|
+
declare function SidebarGroup({
|
|
381
476
|
title,
|
|
382
477
|
icon: Icon,
|
|
383
478
|
children,
|
|
@@ -385,7 +480,7 @@ declare const SidebarGroup: ({
|
|
|
385
480
|
}: {
|
|
386
481
|
title?: string;
|
|
387
482
|
icon?: React.ElementType;
|
|
388
|
-
} & ComponentBase)
|
|
483
|
+
} & ComponentBase): _$react_jsx_runtime0.JSX.Element;
|
|
389
484
|
/**
|
|
390
485
|
* Sidebar Link
|
|
391
486
|
*/
|
|
@@ -396,18 +491,18 @@ interface SidebarLinkProps extends ComponentBase {
|
|
|
396
491
|
icon?: React.ElementType;
|
|
397
492
|
badge?: ComponentRoute['badge'];
|
|
398
493
|
}
|
|
399
|
-
declare
|
|
494
|
+
declare function SidebarLink({
|
|
400
495
|
label,
|
|
401
496
|
href,
|
|
402
497
|
active,
|
|
403
498
|
icon: Icon,
|
|
404
499
|
badge,
|
|
405
500
|
className
|
|
406
|
-
}: SidebarLinkProps)
|
|
501
|
+
}: SidebarLinkProps): _$react_jsx_runtime0.JSX.Element;
|
|
407
502
|
/**
|
|
408
503
|
* Nested SubGroup
|
|
409
504
|
*/
|
|
410
|
-
declare
|
|
505
|
+
declare function SidebarSubGroup({
|
|
411
506
|
label,
|
|
412
507
|
href,
|
|
413
508
|
active,
|
|
@@ -421,7 +516,7 @@ declare const SidebarSubGroup: ({
|
|
|
421
516
|
isOpen: boolean;
|
|
422
517
|
onToggle: () => void;
|
|
423
518
|
children: ReactNode;
|
|
424
|
-
})
|
|
519
|
+
}): _$react_jsx_runtime0.JSX.Element;
|
|
425
520
|
/**
|
|
426
521
|
* Automated single-route rendering primitive
|
|
427
522
|
*/
|
|
@@ -454,40 +549,11 @@ declare const Sidebar: typeof SidebarRoot & {
|
|
|
454
549
|
Mobile: typeof SidebarMobile;
|
|
455
550
|
Header: typeof SidebarHeader;
|
|
456
551
|
Content: typeof SidebarContent;
|
|
457
|
-
Group:
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
children,
|
|
461
|
-
className
|
|
462
|
-
}: {
|
|
463
|
-
title?: string;
|
|
464
|
-
icon?: React.ElementType;
|
|
465
|
-
} & ComponentBase) => _$react_jsx_runtime0.JSX.Element;
|
|
466
|
-
Link: ({
|
|
467
|
-
label,
|
|
468
|
-
href,
|
|
469
|
-
active,
|
|
470
|
-
icon: Icon,
|
|
471
|
-
badge,
|
|
472
|
-
className
|
|
473
|
-
}: SidebarLinkProps) => _$react_jsx_runtime0.JSX.Element;
|
|
474
|
-
SubGroup: ({
|
|
475
|
-
label,
|
|
476
|
-
href,
|
|
477
|
-
active,
|
|
478
|
-
icon: Icon,
|
|
479
|
-
badge,
|
|
480
|
-
isOpen,
|
|
481
|
-
onToggle,
|
|
482
|
-
children,
|
|
483
|
-
className
|
|
484
|
-
}: SidebarLinkProps & {
|
|
485
|
-
isOpen: boolean;
|
|
486
|
-
onToggle: () => void;
|
|
487
|
-
children: ReactNode;
|
|
488
|
-
}) => _$react_jsx_runtime0.JSX.Element;
|
|
552
|
+
Group: typeof SidebarGroup;
|
|
553
|
+
Link: typeof SidebarLink;
|
|
554
|
+
SubGroup: typeof SidebarSubGroup;
|
|
489
555
|
Item: typeof SidebarItem;
|
|
490
556
|
Items: typeof SidebarItems;
|
|
491
557
|
};
|
|
492
558
|
//#endregion
|
|
493
|
-
export {
|
|
559
|
+
export { BoltdocsRoutePathWithFallback$1 as A, SiteConfig as C, BoltdocsLocale as D, BoltdocsIntegrationsConfig as E, BoltdocsTypes as M, BoltdocsVersion as N, BoltdocsMdxComponents as O, SidebarProps as S, BoltdocsConfig$1 as T, CollectionPostLoaderData as _, SidebarItem as a, NavbarLink as b, SidebarItemsProps as c, SidebarMobile as d, SidebarRoot as f, CollectionListLoaderData as g, BoltdocsTab as h, SidebarHeader as i, BoltdocsSocialLink as j, BoltdocsRoutePath as k, SidebarLink as l, ComponentBase as m, SidebarContent as n, SidebarItemProps as o, SidebarSubGroup as p, SidebarGroup as r, SidebarItems as s, Sidebar as t, SidebarLinkProps as u, ComponentRoute as v, TabsProps as w, OnThisPageProps as x, LayoutProps as y };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
import * as React$2 from "react";
|
|
3
3
|
import { ComponentType, ReactNode } from "react";
|
|
4
|
-
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
4
|
import { Plugin } from "vite";
|
|
5
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
6
|
|
|
7
7
|
//#region src/shared/types.d.ts
|
|
8
8
|
/**
|
|
@@ -33,15 +33,15 @@ interface BoltdocsThemeConfig {
|
|
|
33
33
|
};
|
|
34
34
|
navbar?: Array<{
|
|
35
35
|
label: string | Record<string, string>;
|
|
36
|
-
href:
|
|
36
|
+
href: BoltdocsRoutePathWithFallback$1;
|
|
37
37
|
items?: Array<{
|
|
38
38
|
label: string | Record<string, string>;
|
|
39
|
-
href:
|
|
39
|
+
href: BoltdocsRoutePathWithFallback$1;
|
|
40
40
|
}>;
|
|
41
41
|
}>;
|
|
42
42
|
sidebar?: Record<string, Array<{
|
|
43
43
|
text: string;
|
|
44
|
-
link:
|
|
44
|
+
link: BoltdocsRoutePathWithFallback$1;
|
|
45
45
|
}>>;
|
|
46
46
|
sidebarGroups?: Record<string, {
|
|
47
47
|
title?: string | Record<string, string>;
|
|
@@ -111,24 +111,44 @@ interface BoltdocsVersionsConfig {
|
|
|
111
111
|
prefix?: string;
|
|
112
112
|
versions: BoltdocsVersionConfig[];
|
|
113
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Shared badge value type used in frontmatter, RouteMeta, and ComponentRoute.
|
|
116
|
+
*/
|
|
117
|
+
type BadgeValue = string | {
|
|
118
|
+
text: string;
|
|
119
|
+
expires?: string;
|
|
120
|
+
};
|
|
114
121
|
/**
|
|
115
122
|
* Defines a Boltdocs plugin.
|
|
123
|
+
*
|
|
124
|
+
* Use the `createPlugin()` helper from the node API for full type safety and
|
|
125
|
+
* access to lifecycle hooks.
|
|
116
126
|
*/
|
|
117
127
|
interface BoltdocsPlugin {
|
|
118
128
|
name: string;
|
|
119
129
|
enforce?: 'pre' | 'post';
|
|
120
130
|
version?: string;
|
|
121
131
|
boltdocsVersion?: string;
|
|
122
|
-
permissions?: string[];
|
|
123
132
|
remarkPlugins?: unknown[];
|
|
124
133
|
rehypePlugins?: unknown[];
|
|
125
134
|
vitePlugins?: Plugin[];
|
|
126
135
|
components?: Record<string, string>;
|
|
127
|
-
hooks
|
|
136
|
+
/** Lifecycle hooks — use the `PluginLifecycleHooks` type from the node API. */
|
|
137
|
+
hooks?: Record<string, (ctx: unknown) => Promise<void> | void>;
|
|
128
138
|
}
|
|
129
139
|
/**
|
|
130
|
-
* Configuration for
|
|
131
|
-
*/
|
|
140
|
+
* Configuration for the collections (blog) feature.
|
|
141
|
+
*/
|
|
142
|
+
interface BoltdocsCollectionsConfig {
|
|
143
|
+
/** Number of posts per page in collection listing pages. Defaults to 10. */
|
|
144
|
+
postsPerPage?: number;
|
|
145
|
+
/** The name of the default collection used by BlogList when none is specified. */
|
|
146
|
+
defaultCollection?: string;
|
|
147
|
+
/** Date format string for rendering post dates (e.g., 'MMMM dd, yyyy'). */
|
|
148
|
+
dateFormat?: string;
|
|
149
|
+
/** Field to sort posts by. Defaults to 'date'. */
|
|
150
|
+
sortBy?: 'date' | 'title' | 'sidebarPosition';
|
|
151
|
+
}
|
|
132
152
|
interface BoltdocsSecurityConfig {
|
|
133
153
|
headers?: Record<string, string>;
|
|
134
154
|
enableCSP?: boolean;
|
|
@@ -168,9 +188,18 @@ interface BoltdocsGTMConfig {
|
|
|
168
188
|
dataLayerName?: string;
|
|
169
189
|
preview?: string;
|
|
170
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* Configuration for Algolia DocSearch.
|
|
193
|
+
*/
|
|
194
|
+
interface BoltdocsAlgoliaConfig {
|
|
195
|
+
appId: string;
|
|
196
|
+
apiKey: string;
|
|
197
|
+
indexName: string;
|
|
198
|
+
}
|
|
171
199
|
interface BoltdocsIntegrationsConfig {
|
|
172
200
|
ga4?: BoltdocsGA4Config;
|
|
173
201
|
gtm?: BoltdocsGTMConfig;
|
|
202
|
+
algolia?: BoltdocsAlgoliaConfig;
|
|
174
203
|
}
|
|
175
204
|
/**
|
|
176
205
|
* The root configuration object for Boltdocs.
|
|
@@ -183,6 +212,7 @@ interface BoltdocsConfig$1 {
|
|
|
183
212
|
i18n?: BoltdocsI18nConfig;
|
|
184
213
|
versions?: BoltdocsVersionsConfig;
|
|
185
214
|
plugins?: BoltdocsPlugin[];
|
|
215
|
+
collections?: BoltdocsCollectionsConfig;
|
|
186
216
|
robots?: BoltdocsRobotsConfig;
|
|
187
217
|
security?: BoltdocsSecurityConfig;
|
|
188
218
|
seo?: BoltdocsSeoConfig;
|
|
@@ -198,9 +228,17 @@ interface BoltdocsConfig$1 {
|
|
|
198
228
|
declare global {
|
|
199
229
|
namespace Boltdocs {
|
|
200
230
|
interface Types {}
|
|
231
|
+
/**
|
|
232
|
+
* Marker interface augmented by generated code to provide strict route path typing.
|
|
233
|
+
* When no types have been generated (e.g., before first dev server start),
|
|
234
|
+
* keyof is never, and BoltdocsRoutePath falls back to string.
|
|
235
|
+
*/
|
|
236
|
+
interface RoutePaths {}
|
|
201
237
|
}
|
|
202
238
|
}
|
|
203
239
|
type BoltdocsTypes = Boltdocs.Types;
|
|
240
|
+
type BoltdocsRoutePath = keyof Boltdocs.RoutePaths;
|
|
241
|
+
type BoltdocsRoutePathWithFallback$1 = BoltdocsRoutePath extends never ? string : BoltdocsRoutePath;
|
|
204
242
|
type BoltdocsLocale = Boltdocs.Types extends {
|
|
205
243
|
Locale: infer L;
|
|
206
244
|
} ? L : string;
|
|
@@ -259,16 +297,15 @@ interface ComponentRoute {
|
|
|
259
297
|
/** The tab this route belongs to, if tabs are configured */
|
|
260
298
|
tab?: string;
|
|
261
299
|
/** Optional badge to display next to the sidebar item */
|
|
262
|
-
badge?:
|
|
263
|
-
text: 'updated' | 'new' | 'deprecated';
|
|
264
|
-
expires?: string;
|
|
265
|
-
};
|
|
300
|
+
badge?: BadgeValue;
|
|
266
301
|
/** Optional icon for the route's group */
|
|
267
302
|
groupIcon?: string;
|
|
268
303
|
/** The sub-route group this route belongs to (from folders starting with _) */
|
|
269
304
|
subRouteGroup?: string;
|
|
270
305
|
/** The nested sub-routes if this route acts as the parent of a subRouteGroup */
|
|
271
306
|
subRoutes?: ComponentRoute[];
|
|
307
|
+
/** Internal helper map for nesting routes during sidebar construction */
|
|
308
|
+
_subMap?: Map<string, ComponentRoute>;
|
|
272
309
|
/** The extracted plain-text content of the page for search indexing */
|
|
273
310
|
_content?: string;
|
|
274
311
|
/** The raw markdown content of the page */
|
|
@@ -277,10 +314,29 @@ interface ComponentRoute {
|
|
|
277
314
|
date?: string | Date;
|
|
278
315
|
/** The last updated timestamp or date */
|
|
279
316
|
lastUpdated?: string | number | Date;
|
|
317
|
+
/** The collection this route belongs to (from [name] directories) */
|
|
318
|
+
collection?: string;
|
|
319
|
+
/** Tags for blog posts */
|
|
320
|
+
tags?: string[];
|
|
321
|
+
/** Author identifier for blog posts */
|
|
322
|
+
author?: string | {
|
|
323
|
+
name: string;
|
|
324
|
+
avatar?: string;
|
|
325
|
+
url?: string;
|
|
326
|
+
image?: string;
|
|
327
|
+
};
|
|
328
|
+
/** Draft flag */
|
|
329
|
+
draft?: boolean;
|
|
330
|
+
/** Short excerpt for list displays */
|
|
331
|
+
excerpt?: string;
|
|
332
|
+
/** Cover image for blog posts */
|
|
333
|
+
coverImage?: string;
|
|
280
334
|
/** Raw extensible frontmatter data for custom components and formatters */
|
|
281
335
|
frontmatter?: Record<string, any>;
|
|
282
336
|
/** Clean URL segments stripped of locale/version prefixes */
|
|
283
337
|
slugParts?: string[];
|
|
338
|
+
/** SEO metadata for page headers */
|
|
339
|
+
seo?: Record<string, any>;
|
|
284
340
|
}
|
|
285
341
|
/**
|
|
286
342
|
* Site configuration provided by the server.
|
|
@@ -333,11 +389,50 @@ interface LayoutProps {
|
|
|
333
389
|
*/
|
|
334
390
|
interface NavbarLink {
|
|
335
391
|
label: string | Record<string, string>;
|
|
336
|
-
href:
|
|
392
|
+
href: BoltdocsRoutePathWithFallback;
|
|
337
393
|
active: boolean;
|
|
338
394
|
to?: string;
|
|
339
395
|
items?: NavbarLink[];
|
|
340
396
|
}
|
|
397
|
+
/**
|
|
398
|
+
* Shape of the data returned by a collection post route loader.
|
|
399
|
+
* Consumed by `BlogPost` via `useLoaderData<CollectionPostLoaderData>()`.
|
|
400
|
+
*/
|
|
401
|
+
interface CollectionPostLoaderData {
|
|
402
|
+
/** Full route metadata for this post (title, date, author, tags, etc.) */
|
|
403
|
+
route: ComponentRoute;
|
|
404
|
+
/** The name of the collection this post belongs to (e.g. 'blog') */
|
|
405
|
+
collection: string;
|
|
406
|
+
/** Extracted page headings for the Table of Contents */
|
|
407
|
+
headings: {
|
|
408
|
+
level: number;
|
|
409
|
+
text: string;
|
|
410
|
+
id: string;
|
|
411
|
+
}[];
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Shape of the data returned by a collection listing route loader.
|
|
415
|
+
* Consumed by `BlogList` via `useLoaderData<CollectionListLoaderData>()`.
|
|
416
|
+
*/
|
|
417
|
+
interface CollectionListLoaderData {
|
|
418
|
+
/** Paginated subset of posts to display on this page */
|
|
419
|
+
posts: Array<{
|
|
420
|
+
path: string;
|
|
421
|
+
title: string;
|
|
422
|
+
date?: string | Date;
|
|
423
|
+
excerpt?: string;
|
|
424
|
+
tags?: string[];
|
|
425
|
+
author?: string;
|
|
426
|
+
coverImage?: string;
|
|
427
|
+
filePath: string;
|
|
428
|
+
}>;
|
|
429
|
+
/** Total number of pages available */
|
|
430
|
+
totalPages: number;
|
|
431
|
+
/** Current page index (1-based) */
|
|
432
|
+
currentPage: number;
|
|
433
|
+
/** Collection name used to build pagination URLs (e.g. 'blog' → '/blog/page/2') */
|
|
434
|
+
collection: string;
|
|
435
|
+
}
|
|
341
436
|
//#endregion
|
|
342
437
|
//#region src/client/components/primitives/types.d.ts
|
|
343
438
|
type ComponentBase = {
|
|
@@ -377,7 +472,7 @@ declare function SidebarContent({
|
|
|
377
472
|
/**
|
|
378
473
|
* Navigation Group
|
|
379
474
|
*/
|
|
380
|
-
declare
|
|
475
|
+
declare function SidebarGroup({
|
|
381
476
|
title,
|
|
382
477
|
icon: Icon,
|
|
383
478
|
children,
|
|
@@ -385,7 +480,7 @@ declare const SidebarGroup: ({
|
|
|
385
480
|
}: {
|
|
386
481
|
title?: string;
|
|
387
482
|
icon?: React.ElementType;
|
|
388
|
-
} & ComponentBase)
|
|
483
|
+
} & ComponentBase): _$react_jsx_runtime0.JSX.Element;
|
|
389
484
|
/**
|
|
390
485
|
* Sidebar Link
|
|
391
486
|
*/
|
|
@@ -396,18 +491,18 @@ interface SidebarLinkProps extends ComponentBase {
|
|
|
396
491
|
icon?: React.ElementType;
|
|
397
492
|
badge?: ComponentRoute['badge'];
|
|
398
493
|
}
|
|
399
|
-
declare
|
|
494
|
+
declare function SidebarLink({
|
|
400
495
|
label,
|
|
401
496
|
href,
|
|
402
497
|
active,
|
|
403
498
|
icon: Icon,
|
|
404
499
|
badge,
|
|
405
500
|
className
|
|
406
|
-
}: SidebarLinkProps)
|
|
501
|
+
}: SidebarLinkProps): _$react_jsx_runtime0.JSX.Element;
|
|
407
502
|
/**
|
|
408
503
|
* Nested SubGroup
|
|
409
504
|
*/
|
|
410
|
-
declare
|
|
505
|
+
declare function SidebarSubGroup({
|
|
411
506
|
label,
|
|
412
507
|
href,
|
|
413
508
|
active,
|
|
@@ -421,7 +516,7 @@ declare const SidebarSubGroup: ({
|
|
|
421
516
|
isOpen: boolean;
|
|
422
517
|
onToggle: () => void;
|
|
423
518
|
children: ReactNode;
|
|
424
|
-
})
|
|
519
|
+
}): _$react_jsx_runtime0.JSX.Element;
|
|
425
520
|
/**
|
|
426
521
|
* Automated single-route rendering primitive
|
|
427
522
|
*/
|
|
@@ -454,40 +549,11 @@ declare const Sidebar: typeof SidebarRoot & {
|
|
|
454
549
|
Mobile: typeof SidebarMobile;
|
|
455
550
|
Header: typeof SidebarHeader;
|
|
456
551
|
Content: typeof SidebarContent;
|
|
457
|
-
Group:
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
children,
|
|
461
|
-
className
|
|
462
|
-
}: {
|
|
463
|
-
title?: string;
|
|
464
|
-
icon?: React.ElementType;
|
|
465
|
-
} & ComponentBase) => _$react_jsx_runtime0.JSX.Element;
|
|
466
|
-
Link: ({
|
|
467
|
-
label,
|
|
468
|
-
href,
|
|
469
|
-
active,
|
|
470
|
-
icon: Icon,
|
|
471
|
-
badge,
|
|
472
|
-
className
|
|
473
|
-
}: SidebarLinkProps) => _$react_jsx_runtime0.JSX.Element;
|
|
474
|
-
SubGroup: ({
|
|
475
|
-
label,
|
|
476
|
-
href,
|
|
477
|
-
active,
|
|
478
|
-
icon: Icon,
|
|
479
|
-
badge,
|
|
480
|
-
isOpen,
|
|
481
|
-
onToggle,
|
|
482
|
-
children,
|
|
483
|
-
className
|
|
484
|
-
}: SidebarLinkProps & {
|
|
485
|
-
isOpen: boolean;
|
|
486
|
-
onToggle: () => void;
|
|
487
|
-
children: ReactNode;
|
|
488
|
-
}) => _$react_jsx_runtime0.JSX.Element;
|
|
552
|
+
Group: typeof SidebarGroup;
|
|
553
|
+
Link: typeof SidebarLink;
|
|
554
|
+
SubGroup: typeof SidebarSubGroup;
|
|
489
555
|
Item: typeof SidebarItem;
|
|
490
556
|
Items: typeof SidebarItems;
|
|
491
557
|
};
|
|
492
558
|
//#endregion
|
|
493
|
-
export {
|
|
559
|
+
export { BoltdocsRoutePathWithFallback$1 as A, SiteConfig as C, BoltdocsLocale as D, BoltdocsIntegrationsConfig as E, BoltdocsTypes as M, BoltdocsVersion as N, BoltdocsMdxComponents as O, SidebarProps as S, BoltdocsConfig$1 as T, CollectionPostLoaderData as _, SidebarItem as a, NavbarLink as b, SidebarItemsProps as c, SidebarMobile as d, SidebarRoot as f, CollectionListLoaderData as g, BoltdocsTab as h, SidebarHeader as i, BoltdocsSocialLink as j, BoltdocsRoutePath as k, SidebarLink as l, ComponentBase as m, SidebarContent as n, SidebarItemProps as o, SidebarSubGroup as p, SidebarGroup as r, SidebarItems as s, Sidebar as t, SidebarLinkProps as u, ComponentRoute as v, TabsProps as w, OnThisPageProps as x, LayoutProps as y };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boltdocs - https://boltdocs.vercel.app
|
|
3
|
+
* Copyright (c) 2026 Jesus Alcala
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import e from"node:fs";import t from"isomorphic-dompurify";import{z as n}from"zod";import{error as r}from"@bdocs/dui";const i=/^[a-zA-Z0-9\-_/.()\[\]]+$/,a=n.looseObject({title:n.string().max(200).optional(),description:n.string().max(500).optional(),permalink:n.string().optional(),sidebarPosition:n.number().optional(),sidebarLabel:n.string().max(100).optional(),sidebarHidden:n.boolean().optional(),hidden:n.boolean().optional(),category:n.string().max(50).optional(),order:n.number().optional(),badge:n.union([n.string().max(50),n.object({text:n.string().max(50),expires:n.string().optional()})]).optional(),icon:n.string().max(50).optional(),date:n.union([n.string(),n.date()]).optional(),lastUpdated:n.union([n.string(),n.date()]).optional(),groupTitle:n.string().max(100).optional(),groupPosition:n.number().optional(),seo:n.record(n.string(),n.any()).optional(),tags:n.array(n.string().max(50)).optional(),author:n.union([n.string().max(100),n.object({name:n.string().max(100),avatar:n.string().optional(),url:n.string().optional(),image:n.string().optional()})]).optional(),draft:n.boolean().optional(),excerpt:n.string().max(500).optional(),coverImage:n.string().nullable().optional()});function o(e){let t=e.trim();if(!t.startsWith(`---`))return{data:{},content:e,rawMatter:``};let n=t.indexOf(`---`,3);if(n===-1||n===3)return{data:{},content:e,rawMatter:``};let r=t.slice(3,n).trim(),i=t.slice(n+3).trim();return s(r)?{data:{},content:i,rawMatter:r}:{data:c(r),content:i,rawMatter:r}}function s(e){let t=!1,n=!1;for(let r=0;r<e.length;r++){let i=e[r],a=r>0?e[r-1]:``;i===`'`&&!n&&a!==`\\`?t=!t:i===`"`&&!t&&a!==`\\`&&(n=!n)}return t||n}function c(e){let t=e.split(`
|
|
7
|
+
`),n={},r=0;for(;r<t.length;){let e=t[r],i=e.trim();if(!i||i.startsWith(`#`)){r++;continue}let a=i.indexOf(`:`);if(a!==-1){let o=i.slice(0,a).trim(),s=i.slice(a+1).trim();if(s===``){let i=l(t.slice(r+1),e.search(/\S|$/));i.value===void 0?r++:(n[o]=i.value,r+=i.linesConsumed+1)}else n[o]=u(s),r++}else r++}return n}function l(e,t){if(e.length===0)return{value:void 0,linesConsumed:0};if(e[0].trim().startsWith(`-`)){let n=[],r=0;for(;r<e.length;){let i=e[r],a=i.search(/\S|$/),o=i.trim();if(!o||o.startsWith(`#`)){r++;continue}if(o.startsWith(`-`)){let e=o.slice(1).trim();if(e.includes(`:`)){let t={},r=e.split(/,\s*/);for(let e of r){let n=e.indexOf(`:`);if(n!==-1){let r=e.slice(0,n).trim();t[r]=u(e.slice(n+1).trim())}}n.push(t)}else n.push(e)}else if(a>t&&n.length>0){let e=n[n.length-1];if(typeof e==`object`&&e){let t=e,n=o.indexOf(`:`);if(n!==-1){let e=o.slice(0,n).trim();t[e]=u(o.slice(n+1).trim())}}}else break;r++}return{value:n.length>0?n:void 0,linesConsumed:r}}let n={},r=0;for(;r<e.length;){let i=e[r],a=i.search(/\S|$/),o=i.trim();if(!o||o.startsWith(`#`)){r++;continue}if(a<=t)break;let s=o.indexOf(`:`);if(s!==-1){let e=o.slice(0,s).trim();n[e]=u(o.slice(s+1).trim())}r++}return{value:Object.keys(n).length>0?n:void 0,linesConsumed:r}}function u(e){let t=e.trim();if(t===`true`)return!0;if(t===`false`)return!1;if(t===`null`||t===`~`)return null;if(/^-?\d+(\.\d+)?$/.test(t))return Number(t);if(t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`))return t.slice(1,-1);if(t.startsWith(`[`)&&t.endsWith(`]`)){let e=t.slice(1,-1).trim();return e?e.split(/,\s*/).map(e=>u(e.trim())):[]}if(t.startsWith(`{`)&&t.endsWith(`}`)){let e=t.slice(1,-1).trim(),n={},r=e.split(/,\s*/);for(let e of r){let t=e.indexOf(`:`);if(t!==-1){let r=e.slice(0,t).trim();n[r]=u(e.slice(t+1).trim())}}return n}return t}var d=class e extends Error{constructor(t){super(t),this.name=`SecurityViolationError`,Object.setPrototypeOf(this,e.prototype)}},f=class e extends d{constructor(t){super(t),this.name=`PathTraversalError`,Object.setPrototypeOf(this,e.prototype)}},p=class e extends d{constructor(t){super(t),this.name=`EncodingSecurityError`,Object.setPrototypeOf(this,e.prototype)}},m=class e extends d{constructor(t){super(t),this.name=`ValidationError`,Object.setPrototypeOf(this,e.prototype)}};function h(e){return e.replace(/\\/g,`/`)}function g(e){return e.replace(/^\d+\./,``)}function _(e){let t=e.match(/^(\d+)\./);return t?parseInt(t[1],10):void 0}function v(e){return/\.mdx?$/.test(e)}function y(t){try{return e.statSync(t).mtimeMs}catch{return 0}}function b(e,t,n){let{data:r,content:i,rawMatter:s}=o(t);if(s&&s.length>10240)throw k(`FRONTMATTER_TOO_LARGE`,`Frontmatter block exceeds size limit`,{size:s.length,file:e}),new m(`Security breach: Frontmatter size exceeds limit of 10240 bytes`);if(!n)return{data:r,content:i};let c=a.safeParse(r),l={...c.success?c.data:{}};return l.title&&=E(l.title).trim(),l.description&&=E(l.description).trim(),{data:l,content:i}}async function x(t,n=!0){let r=``;try{r=await e.promises.readFile(t,`utf-8`);let{data:i,content:a}=b(t,r,n);if(n&&!i.lastUpdated)try{i.lastUpdated=(await e.promises.stat(t)).mtimeMs}catch{i.lastUpdated=0}return{data:i,content:a,raw:r}}catch(e){if(e instanceof m)throw e;return{data:{},content:r,raw:r}}}function S(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/'/g,`'`).replace(/</g,`<`).replace(/>/g,`>`)}function C(e){return S(e)}function w(e){let t=h(e).split(`/`).map(e=>O(g(e))).join(`/`).replace(/\/$/,``);return t=t.replace(/\.mdx?$/,``),(t===`index`||t.endsWith(`/index`))&&(t=t.replace(/index$/,``)),t.startsWith(`/`)||(t=`/`+t),t.length>1&&t.endsWith(`/`)&&(t=t.slice(0,-1)),t}function T(e){return t.sanitize(e,{ALLOWED_TAGS:`b.i.em.strong.a.p.br.code.pre.span.div.h1.h2.h3.h4.h5.h6.ul.ol.li.table.thead.tbody.tr.th.td.blockquote.hr`.split(`.`),ALLOWED_ATTR:[`href`,`title`,`target`,`class`,`id`,`src`,`alt`,`width`,`height`],FORCE_BODY:!0})}t.addHook(`afterSanitizeAttributes`,e=>{if(e.hasAttribute(`href`)){let t=e.getAttribute(`href`)?.toLowerCase()||``;(t.startsWith(`javascript:`)||t.startsWith(`data:`)||t.startsWith(`vbscript:`))&&e.removeAttribute(`href`)}if(e.hasAttribute(`src`)){let t=e.getAttribute(`src`)?.toLowerCase()||``;(t.startsWith(`javascript:`)||t.startsWith(`data:`)||t.startsWith(`vbscript:`))&&e.removeAttribute(`src`)}});function E(e){return e?e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,``).replace(/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi,``).replace(/<!--[\s\S]*?-->/g,``).replace(/<[^>]+>/g,` `).replace(/\s+/g,` `).trim():``}function D(e){return e.charAt(0).toUpperCase()+e.slice(1)}function O(e){return e.replace(/[^a-zA-Z0-9\-_/.]/g,``).split(`/`).filter(e=>e!==`..`&&e!==`.`).map(e=>e.replace(/\.\.+/g,`.`)).join(`/`)}function k(e,t,n={}){let i=new Date().toISOString(),a={...n};for(let e in a)typeof a[e]==`string`&&a[e].includes(`:`)&&(a[e]=a[e].split(/[\\/]/).pop()||a[e]);r(`[SECURITY][${i}] TYPE: ${e} | MESSAGE: ${t} | DETAILS: ${JSON.stringify(a)}`)}function A(){return{dir:process.env.BOLTDOCS_CACHE_DIR||`.boltdocs/cache`,noCache:process.env.BOLTDOCS_NO_CACHE===`1`,lruLimit:parseInt(process.env.BOLTDOCS_CACHE_LRU_LIMIT||`2000`,10),lruTTL:parseInt(process.env.BOLTDOCS_CACHE_LRU_TTL||`14400000`,10),compress:process.env.BOLTDOCS_CACHE_COMPRESS!==`0`}}export{f as _,w as a,i as b,v as c,x as d,O as f,p as g,g as h,_ as i,k as l,E as m,S as n,A as o,T as p,C as r,y as s,D as t,h as u,m as v,a as y};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boltdocs - https://boltdocs.vercel.app
|
|
3
|
+
* Copyright (c) 2026 Jesus Alcala
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
const e=require(`./chunk-CU-zTemE.cjs`);let t=require(`node:fs`);t=e.t(t);let n=require(`isomorphic-dompurify`);n=e.t(n);let r=require(`zod`),i=require(`@bdocs/dui`);const a=/^[a-zA-Z0-9\-_/.()\[\]]+$/,o=r.z.looseObject({title:r.z.string().max(200).optional(),description:r.z.string().max(500).optional(),permalink:r.z.string().optional(),sidebarPosition:r.z.number().optional(),sidebarLabel:r.z.string().max(100).optional(),sidebarHidden:r.z.boolean().optional(),hidden:r.z.boolean().optional(),category:r.z.string().max(50).optional(),order:r.z.number().optional(),badge:r.z.union([r.z.string().max(50),r.z.object({text:r.z.string().max(50),expires:r.z.string().optional()})]).optional(),icon:r.z.string().max(50).optional(),date:r.z.union([r.z.string(),r.z.date()]).optional(),lastUpdated:r.z.union([r.z.string(),r.z.date()]).optional(),groupTitle:r.z.string().max(100).optional(),groupPosition:r.z.number().optional(),seo:r.z.record(r.z.string(),r.z.any()).optional(),tags:r.z.array(r.z.string().max(50)).optional(),author:r.z.union([r.z.string().max(100),r.z.object({name:r.z.string().max(100),avatar:r.z.string().optional(),url:r.z.string().optional(),image:r.z.string().optional()})]).optional(),draft:r.z.boolean().optional(),excerpt:r.z.string().max(500).optional(),coverImage:r.z.string().nullable().optional()});function s(e){let t=e.trim();if(!t.startsWith(`---`))return{data:{},content:e,rawMatter:``};let n=t.indexOf(`---`,3);if(n===-1||n===3)return{data:{},content:e,rawMatter:``};let r=t.slice(3,n).trim(),i=t.slice(n+3).trim();return c(r)?{data:{},content:i,rawMatter:r}:{data:l(r),content:i,rawMatter:r}}function c(e){let t=!1,n=!1;for(let r=0;r<e.length;r++){let i=e[r],a=r>0?e[r-1]:``;i===`'`&&!n&&a!==`\\`?t=!t:i===`"`&&!t&&a!==`\\`&&(n=!n)}return t||n}function l(e){let t=e.split(`
|
|
7
|
+
`),n={},r=0;for(;r<t.length;){let e=t[r],i=e.trim();if(!i||i.startsWith(`#`)){r++;continue}let a=i.indexOf(`:`);if(a!==-1){let o=i.slice(0,a).trim(),s=i.slice(a+1).trim();if(s===``){let i=u(t.slice(r+1),e.search(/\S|$/));i.value===void 0?r++:(n[o]=i.value,r+=i.linesConsumed+1)}else n[o]=d(s),r++}else r++}return n}function u(e,t){if(e.length===0)return{value:void 0,linesConsumed:0};if(e[0].trim().startsWith(`-`)){let n=[],r=0;for(;r<e.length;){let i=e[r],a=i.search(/\S|$/),o=i.trim();if(!o||o.startsWith(`#`)){r++;continue}if(o.startsWith(`-`)){let e=o.slice(1).trim();if(e.includes(`:`)){let t={},r=e.split(/,\s*/);for(let e of r){let n=e.indexOf(`:`);if(n!==-1){let r=e.slice(0,n).trim();t[r]=d(e.slice(n+1).trim())}}n.push(t)}else n.push(e)}else if(a>t&&n.length>0){let e=n[n.length-1];if(typeof e==`object`&&e){let t=e,n=o.indexOf(`:`);if(n!==-1){let e=o.slice(0,n).trim();t[e]=d(o.slice(n+1).trim())}}}else break;r++}return{value:n.length>0?n:void 0,linesConsumed:r}}let n={},r=0;for(;r<e.length;){let i=e[r],a=i.search(/\S|$/),o=i.trim();if(!o||o.startsWith(`#`)){r++;continue}if(a<=t)break;let s=o.indexOf(`:`);if(s!==-1){let e=o.slice(0,s).trim();n[e]=d(o.slice(s+1).trim())}r++}return{value:Object.keys(n).length>0?n:void 0,linesConsumed:r}}function d(e){let t=e.trim();if(t===`true`)return!0;if(t===`false`)return!1;if(t===`null`||t===`~`)return null;if(/^-?\d+(\.\d+)?$/.test(t))return Number(t);if(t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`))return t.slice(1,-1);if(t.startsWith(`[`)&&t.endsWith(`]`)){let e=t.slice(1,-1).trim();return e?e.split(/,\s*/).map(e=>d(e.trim())):[]}if(t.startsWith(`{`)&&t.endsWith(`}`)){let e=t.slice(1,-1).trim(),n={},r=e.split(/,\s*/);for(let e of r){let t=e.indexOf(`:`);if(t!==-1){let r=e.slice(0,t).trim();n[r]=d(e.slice(t+1).trim())}}return n}return t}var f=class e extends Error{constructor(t){super(t),this.name=`SecurityViolationError`,Object.setPrototypeOf(this,e.prototype)}},p=class e extends f{constructor(t){super(t),this.name=`PathTraversalError`,Object.setPrototypeOf(this,e.prototype)}},m=class e extends f{constructor(t){super(t),this.name=`EncodingSecurityError`,Object.setPrototypeOf(this,e.prototype)}},h=class e extends f{constructor(t){super(t),this.name=`ValidationError`,Object.setPrototypeOf(this,e.prototype)}};function g(e){return e.replace(/\\/g,`/`)}function _(e){return e.replace(/^\d+\./,``)}function v(e){let t=e.match(/^(\d+)\./);return t?parseInt(t[1],10):void 0}function y(e){return/\.mdx?$/.test(e)}function b(e){try{return t.default.statSync(e).mtimeMs}catch{return 0}}function x(e,t,n){let{data:r,content:i,rawMatter:a}=s(t);if(a&&a.length>10240)throw A(`FRONTMATTER_TOO_LARGE`,`Frontmatter block exceeds size limit`,{size:a.length,file:e}),new h(`Security breach: Frontmatter size exceeds limit of 10240 bytes`);if(!n)return{data:r,content:i};let c=o.safeParse(r),l={...c.success?c.data:{}};return l.title&&=D(l.title).trim(),l.description&&=D(l.description).trim(),{data:l,content:i}}async function S(e,n=!0){let r=``;try{r=await t.default.promises.readFile(e,`utf-8`);let{data:i,content:a}=x(e,r,n);if(n&&!i.lastUpdated)try{i.lastUpdated=(await t.default.promises.stat(e)).mtimeMs}catch{i.lastUpdated=0}return{data:i,content:a,raw:r}}catch(e){if(e instanceof h)throw e;return{data:{},content:r,raw:r}}}function C(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/'/g,`'`).replace(/</g,`<`).replace(/>/g,`>`)}function w(e){return C(e)}function T(e){let t=g(e).split(`/`).map(e=>k(_(e))).join(`/`).replace(/\/$/,``);return t=t.replace(/\.mdx?$/,``),(t===`index`||t.endsWith(`/index`))&&(t=t.replace(/index$/,``)),t.startsWith(`/`)||(t=`/`+t),t.length>1&&t.endsWith(`/`)&&(t=t.slice(0,-1)),t}function E(e){return n.default.sanitize(e,{ALLOWED_TAGS:`b.i.em.strong.a.p.br.code.pre.span.div.h1.h2.h3.h4.h5.h6.ul.ol.li.table.thead.tbody.tr.th.td.blockquote.hr`.split(`.`),ALLOWED_ATTR:[`href`,`title`,`target`,`class`,`id`,`src`,`alt`,`width`,`height`],FORCE_BODY:!0})}n.default.addHook(`afterSanitizeAttributes`,e=>{if(e.hasAttribute(`href`)){let t=e.getAttribute(`href`)?.toLowerCase()||``;(t.startsWith(`javascript:`)||t.startsWith(`data:`)||t.startsWith(`vbscript:`))&&e.removeAttribute(`href`)}if(e.hasAttribute(`src`)){let t=e.getAttribute(`src`)?.toLowerCase()||``;(t.startsWith(`javascript:`)||t.startsWith(`data:`)||t.startsWith(`vbscript:`))&&e.removeAttribute(`src`)}});function D(e){return e?e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,``).replace(/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi,``).replace(/<!--[\s\S]*?-->/g,``).replace(/<[^>]+>/g,` `).replace(/\s+/g,` `).trim():``}function O(e){return e.charAt(0).toUpperCase()+e.slice(1)}function k(e){return e.replace(/[^a-zA-Z0-9\-_/.]/g,``).split(`/`).filter(e=>e!==`..`&&e!==`.`).map(e=>e.replace(/\.\.+/g,`.`)).join(`/`)}function A(e,t,n={}){let r=new Date().toISOString(),a={...n};for(let e in a)typeof a[e]==`string`&&a[e].includes(`:`)&&(a[e]=a[e].split(/[\\/]/).pop()||a[e]);(0,i.error)(`[SECURITY][${r}] TYPE: ${e} | MESSAGE: ${t} | DETAILS: ${JSON.stringify(a)}`)}function j(){return{dir:process.env.BOLTDOCS_CACHE_DIR||`.boltdocs/cache`,noCache:process.env.BOLTDOCS_NO_CACHE===`1`,lruLimit:parseInt(process.env.BOLTDOCS_CACHE_LRU_LIMIT||`2000`,10),lruTTL:parseInt(process.env.BOLTDOCS_CACHE_LRU_TTL||`14400000`,10),compress:process.env.BOLTDOCS_CACHE_COMPRESS!==`0`}}Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,`b`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`v`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`y`,{enumerable:!0,get:function(){return o}});
|