boltdocs 1.11.0 → 2.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +21 -0
  3. package/dist/cache-7G6D532T.mjs +1 -0
  4. package/dist/chunk-A4HQPEPU.mjs +1 -0
  5. package/dist/chunk-BA5NH5HU.mjs +1 -0
  6. package/dist/chunk-BQCD3DWG.mjs +1 -0
  7. package/dist/chunk-H63UMKYF.mjs +1 -0
  8. package/dist/chunk-IWHRQHS7.mjs +1 -0
  9. package/dist/chunk-JZXLCA2E.mjs +1 -0
  10. package/dist/chunk-MFU7Q6WF.mjs +1 -0
  11. package/dist/chunk-QYPNX5UN.mjs +1 -0
  12. package/dist/chunk-XEAPSFMB.mjs +1 -0
  13. package/dist/client/components/mdx/index.d.mts +209 -0
  14. package/dist/client/components/mdx/index.d.ts +209 -0
  15. package/dist/client/components/mdx/index.js +1 -0
  16. package/dist/client/components/mdx/index.mjs +1 -0
  17. package/dist/client/hooks/index.d.mts +133 -0
  18. package/dist/client/hooks/index.d.ts +133 -0
  19. package/dist/client/hooks/index.js +1 -0
  20. package/dist/client/hooks/index.mjs +1 -0
  21. package/dist/client/index.d.mts +212 -0
  22. package/dist/client/index.d.ts +212 -0
  23. package/dist/client/index.js +1 -0
  24. package/dist/client/index.mjs +1 -0
  25. package/dist/client/ssr.d.mts +31 -0
  26. package/dist/client/ssr.d.ts +31 -0
  27. package/dist/client/ssr.js +1 -0
  28. package/dist/client/ssr.mjs +1 -0
  29. package/dist/config-CX4l-ZNp.d.mts +166 -0
  30. package/dist/config-CX4l-ZNp.d.ts +166 -0
  31. package/dist/node/index.d.mts +89 -0
  32. package/dist/node/index.d.ts +89 -0
  33. package/dist/node/index.js +57 -0
  34. package/dist/node/index.mjs +57 -0
  35. package/dist/search-dialog-EB3N4TYM.mjs +1 -0
  36. package/dist/types-BuZWFT7r.d.ts +159 -0
  37. package/dist/types-CvT-SGbK.d.mts +159 -0
  38. package/dist/use-routes-5bAtAAYX.d.mts +30 -0
  39. package/dist/use-routes-BefRXY3v.d.ts +30 -0
  40. package/package.json +10 -10
  41. package/src/client/app/index.tsx +9 -6
  42. package/src/client/types.ts +1 -1
  43. package/src/node/plugin/index.ts +0 -1
  44. package/src/node/routes/parser.ts +27 -32
  45. package/src/node/ssg/index.ts +29 -3
  46. package/src/node/utils.ts +23 -0
@@ -0,0 +1,166 @@
1
+ import { Plugin } from 'vite';
2
+
3
+ /**
4
+ * Represents a single social link in the configuration.
5
+ */
6
+ interface BoltdocsSocialLink {
7
+ /** Identifier for the icon (e.g., 'github') */
8
+ icon: 'discord' | 'x' | 'github' | 'bluesky' | string;
9
+ /** The URL the social link points to */
10
+ link: string;
11
+ }
12
+ /**
13
+ * Configuration for the site footer.
14
+ */
15
+ interface BoltdocsFooterConfig {
16
+ /** Text to display in the footer (HTML is supported) */
17
+ text?: string;
18
+ }
19
+ /**
20
+ * Theme-specific configuration options governing the appearance and navigation of the site.
21
+ */
22
+ interface BoltdocsThemeConfig {
23
+ /** The global title of the documentation site */
24
+ title?: string;
25
+ /** The global description of the site (used for SEO) */
26
+ description?: string;
27
+ /** URL path to the site logo or an object for light/dark versions */
28
+ logo?: string | {
29
+ dark: string;
30
+ light: string;
31
+ alt?: string;
32
+ width?: number;
33
+ height?: number;
34
+ };
35
+ /** Items to display in the top navigation bar */
36
+ navbar?: Array<{
37
+ /** Text to display */
38
+ label: string;
39
+ /** URL path or external link */
40
+ href: string;
41
+ /** Nested items for NavigationMenu */
42
+ items?: Array<{
43
+ label: string;
44
+ href: string;
45
+ }>;
46
+ }>;
47
+ /** Items to display in the sidebar, organized optionally by group URLs */
48
+ sidebar?: Record<string, Array<{
49
+ text: string;
50
+ link: string;
51
+ }>>;
52
+ /** Social links to display in the navigation bar */
53
+ socialLinks?: BoltdocsSocialLink[];
54
+ /** Site footer configuration */
55
+ footer?: BoltdocsFooterConfig;
56
+ /** Whether to show breadcrumbs navigation (default: true) */
57
+ breadcrumbs?: boolean;
58
+ /** URL template for 'Edit this page'. Use :path as a placeholder. */
59
+ editLink?: string;
60
+ /** URL for the 'Community help' link. */
61
+ communityHelp?: string;
62
+ /** The current version of the project (e.g., 'v2.8.9'). Displayed in the Navbar. */
63
+ version?: string;
64
+ /** The GitHub repository in the format 'owner/repo' to fetch and display star count. */
65
+ githubRepo?: string;
66
+ /** Whether to show the 'Powered by LiteDocs' badge in the sidebar (default: true) */
67
+ poweredBy?: boolean;
68
+ /**
69
+ * Top-level tabs for organizing documentation groups.
70
+ * Tab discovery uses the (tab-id) directory syntax.
71
+ */
72
+ tabs?: Array<{
73
+ id: string;
74
+ text: string;
75
+ icon?: string;
76
+ }>;
77
+ /**
78
+ * The syntax highlighting theme for code blocks.
79
+ * Supports any Shiki theme name (e.g., 'github-dark', 'one-dark-pro', 'aurora-x').
80
+ * Can also be an object for multiple themes (e.g., { light: 'github-light', dark: 'github-dark' }).
81
+ * Default: { light: 'github-light', dark: 'one-dark-pro' }
82
+ */
83
+ codeTheme?: string | {
84
+ light: string;
85
+ dark: string;
86
+ };
87
+ /**
88
+ * Configuration for the 'Copy Markdown' button.
89
+ * Can be a boolean or an object with text and icon.
90
+ * Default: true
91
+ */
92
+ copyMarkdown?: boolean | {
93
+ text?: string;
94
+ icon?: string;
95
+ };
96
+ }
97
+ /**
98
+ * Configuration for internationalization (i18n).
99
+ */
100
+ interface BoltdocsI18nConfig {
101
+ /** The default locale (e.g., 'en') */
102
+ defaultLocale: string;
103
+ /** Available locales and their display names (e.g., { en: 'English', es: 'Español' }) */
104
+ locales: Record<string, string>;
105
+ }
106
+ /**
107
+ * Configuration for documentation versioning.
108
+ */
109
+ interface BoltdocsVersionsConfig {
110
+ /** The default version (e.g., 'v2') */
111
+ defaultVersion: string;
112
+ /** Available versions and their display names (e.g., { v1: 'Version 1.x', v2: 'Version 2.x' }) */
113
+ versions: Record<string, string>;
114
+ }
115
+ /**
116
+ * Defines a Boltdocs plugin that can extend the build process and client-side functionality.
117
+ */
118
+ interface BoltdocsPlugin {
119
+ /** A unique name for the plugin */
120
+ name: string;
121
+ /** Whether to run this plugin before or after default ones (optional) */
122
+ enforce?: 'pre' | 'post';
123
+ /** Optional remark plugins to add to the MDX pipeline */
124
+ remarkPlugins?: unknown[];
125
+ /** Optional rehype plugins to add to the MDX pipeline */
126
+ rehypePlugins?: unknown[];
127
+ /** Optional Vite plugins to inject into the build process */
128
+ vitePlugins?: Plugin[];
129
+ /** Optional custom React components to register in MDX. Map of Name -> Module Path. */
130
+ components?: Record<string, string>;
131
+ }
132
+ /**
133
+ * Configuration for external integrations (e.g., CodeSandbox).
134
+ */
135
+ interface BoltdocsIntegrationsConfig {
136
+ /** CodeSandbox integration settings */
137
+ sandbox?: {
138
+ /** Whether to enable the "Open in Sandbox" button in CodeBlocks */
139
+ enable?: boolean;
140
+ /** Default options for the sandbox (files, dependencies, etc.) */
141
+ config?: Record<string, unknown>;
142
+ };
143
+ }
144
+ /**
145
+ * The root configuration object for Boltdocs.
146
+ */
147
+ interface BoltdocsConfig {
148
+ /** The base URL of the site, used for generating the sitemap */
149
+ siteUrl?: string;
150
+ /** Configuration pertaining to the UI and appearance */
151
+ themeConfig?: BoltdocsThemeConfig;
152
+ /** The root directory containing markdown documentation files (default: 'docs') */
153
+ docsDir?: string;
154
+ /** Configuration for internationalization */
155
+ i18n?: BoltdocsI18nConfig;
156
+ /** Configuration for documentation versioning */
157
+ versions?: BoltdocsVersionsConfig;
158
+ /** Custom plugins for extending functionality */
159
+ plugins?: BoltdocsPlugin[];
160
+ /** Map of custom external route paths to component file paths */
161
+ external?: Record<string, string>;
162
+ /** External integrations configuration */
163
+ integrations?: BoltdocsIntegrationsConfig;
164
+ }
165
+
166
+ export type { BoltdocsConfig as B, BoltdocsThemeConfig as a, BoltdocsSocialLink as b };
@@ -0,0 +1,166 @@
1
+ import { Plugin } from 'vite';
2
+
3
+ /**
4
+ * Represents a single social link in the configuration.
5
+ */
6
+ interface BoltdocsSocialLink {
7
+ /** Identifier for the icon (e.g., 'github') */
8
+ icon: 'discord' | 'x' | 'github' | 'bluesky' | string;
9
+ /** The URL the social link points to */
10
+ link: string;
11
+ }
12
+ /**
13
+ * Configuration for the site footer.
14
+ */
15
+ interface BoltdocsFooterConfig {
16
+ /** Text to display in the footer (HTML is supported) */
17
+ text?: string;
18
+ }
19
+ /**
20
+ * Theme-specific configuration options governing the appearance and navigation of the site.
21
+ */
22
+ interface BoltdocsThemeConfig {
23
+ /** The global title of the documentation site */
24
+ title?: string;
25
+ /** The global description of the site (used for SEO) */
26
+ description?: string;
27
+ /** URL path to the site logo or an object for light/dark versions */
28
+ logo?: string | {
29
+ dark: string;
30
+ light: string;
31
+ alt?: string;
32
+ width?: number;
33
+ height?: number;
34
+ };
35
+ /** Items to display in the top navigation bar */
36
+ navbar?: Array<{
37
+ /** Text to display */
38
+ label: string;
39
+ /** URL path or external link */
40
+ href: string;
41
+ /** Nested items for NavigationMenu */
42
+ items?: Array<{
43
+ label: string;
44
+ href: string;
45
+ }>;
46
+ }>;
47
+ /** Items to display in the sidebar, organized optionally by group URLs */
48
+ sidebar?: Record<string, Array<{
49
+ text: string;
50
+ link: string;
51
+ }>>;
52
+ /** Social links to display in the navigation bar */
53
+ socialLinks?: BoltdocsSocialLink[];
54
+ /** Site footer configuration */
55
+ footer?: BoltdocsFooterConfig;
56
+ /** Whether to show breadcrumbs navigation (default: true) */
57
+ breadcrumbs?: boolean;
58
+ /** URL template for 'Edit this page'. Use :path as a placeholder. */
59
+ editLink?: string;
60
+ /** URL for the 'Community help' link. */
61
+ communityHelp?: string;
62
+ /** The current version of the project (e.g., 'v2.8.9'). Displayed in the Navbar. */
63
+ version?: string;
64
+ /** The GitHub repository in the format 'owner/repo' to fetch and display star count. */
65
+ githubRepo?: string;
66
+ /** Whether to show the 'Powered by LiteDocs' badge in the sidebar (default: true) */
67
+ poweredBy?: boolean;
68
+ /**
69
+ * Top-level tabs for organizing documentation groups.
70
+ * Tab discovery uses the (tab-id) directory syntax.
71
+ */
72
+ tabs?: Array<{
73
+ id: string;
74
+ text: string;
75
+ icon?: string;
76
+ }>;
77
+ /**
78
+ * The syntax highlighting theme for code blocks.
79
+ * Supports any Shiki theme name (e.g., 'github-dark', 'one-dark-pro', 'aurora-x').
80
+ * Can also be an object for multiple themes (e.g., { light: 'github-light', dark: 'github-dark' }).
81
+ * Default: { light: 'github-light', dark: 'one-dark-pro' }
82
+ */
83
+ codeTheme?: string | {
84
+ light: string;
85
+ dark: string;
86
+ };
87
+ /**
88
+ * Configuration for the 'Copy Markdown' button.
89
+ * Can be a boolean or an object with text and icon.
90
+ * Default: true
91
+ */
92
+ copyMarkdown?: boolean | {
93
+ text?: string;
94
+ icon?: string;
95
+ };
96
+ }
97
+ /**
98
+ * Configuration for internationalization (i18n).
99
+ */
100
+ interface BoltdocsI18nConfig {
101
+ /** The default locale (e.g., 'en') */
102
+ defaultLocale: string;
103
+ /** Available locales and their display names (e.g., { en: 'English', es: 'Español' }) */
104
+ locales: Record<string, string>;
105
+ }
106
+ /**
107
+ * Configuration for documentation versioning.
108
+ */
109
+ interface BoltdocsVersionsConfig {
110
+ /** The default version (e.g., 'v2') */
111
+ defaultVersion: string;
112
+ /** Available versions and their display names (e.g., { v1: 'Version 1.x', v2: 'Version 2.x' }) */
113
+ versions: Record<string, string>;
114
+ }
115
+ /**
116
+ * Defines a Boltdocs plugin that can extend the build process and client-side functionality.
117
+ */
118
+ interface BoltdocsPlugin {
119
+ /** A unique name for the plugin */
120
+ name: string;
121
+ /** Whether to run this plugin before or after default ones (optional) */
122
+ enforce?: 'pre' | 'post';
123
+ /** Optional remark plugins to add to the MDX pipeline */
124
+ remarkPlugins?: unknown[];
125
+ /** Optional rehype plugins to add to the MDX pipeline */
126
+ rehypePlugins?: unknown[];
127
+ /** Optional Vite plugins to inject into the build process */
128
+ vitePlugins?: Plugin[];
129
+ /** Optional custom React components to register in MDX. Map of Name -> Module Path. */
130
+ components?: Record<string, string>;
131
+ }
132
+ /**
133
+ * Configuration for external integrations (e.g., CodeSandbox).
134
+ */
135
+ interface BoltdocsIntegrationsConfig {
136
+ /** CodeSandbox integration settings */
137
+ sandbox?: {
138
+ /** Whether to enable the "Open in Sandbox" button in CodeBlocks */
139
+ enable?: boolean;
140
+ /** Default options for the sandbox (files, dependencies, etc.) */
141
+ config?: Record<string, unknown>;
142
+ };
143
+ }
144
+ /**
145
+ * The root configuration object for Boltdocs.
146
+ */
147
+ interface BoltdocsConfig {
148
+ /** The base URL of the site, used for generating the sitemap */
149
+ siteUrl?: string;
150
+ /** Configuration pertaining to the UI and appearance */
151
+ themeConfig?: BoltdocsThemeConfig;
152
+ /** The root directory containing markdown documentation files (default: 'docs') */
153
+ docsDir?: string;
154
+ /** Configuration for internationalization */
155
+ i18n?: BoltdocsI18nConfig;
156
+ /** Configuration for documentation versioning */
157
+ versions?: BoltdocsVersionsConfig;
158
+ /** Custom plugins for extending functionality */
159
+ plugins?: BoltdocsPlugin[];
160
+ /** Map of custom external route paths to component file paths */
161
+ external?: Record<string, string>;
162
+ /** External integrations configuration */
163
+ integrations?: BoltdocsIntegrationsConfig;
164
+ }
165
+
166
+ export type { BoltdocsConfig as B, BoltdocsThemeConfig as a, BoltdocsSocialLink as b };
@@ -0,0 +1,89 @@
1
+ import { Plugin } from 'vite';
2
+ import { B as BoltdocsConfig } from '../config-CX4l-ZNp.mjs';
3
+ export { a as BoltdocsThemeConfig } from '../config-CX4l-ZNp.mjs';
4
+
5
+ /**
6
+ * Configuration options specifically for the Boltdocs Vite plugin.
7
+ */
8
+ interface BoltdocsPluginOptions {
9
+ /** The root directory containing markdown files (default: 'docs') */
10
+ docsDir?: string;
11
+ /** Path to a custom home page component (relative to project root) to render at '/' */
12
+ homePage?: string;
13
+ }
14
+
15
+ /**
16
+ * Options for the Static Site Generation process.
17
+ */
18
+ interface SSGOptions {
19
+ /** The root directory containing markdown documentation files */
20
+ docsDir: string;
21
+ /** The name of the documentation directory (e.g. 'docs') */
22
+ docsDirName: string;
23
+ /** The output directory where Vite placed the compiled `index.html` and assets */
24
+ outDir: string;
25
+ /** Pre-resolved config (avoids re-resolving during the SSG phase) */
26
+ config?: BoltdocsConfig;
27
+ }
28
+
29
+ /**
30
+ * Generates static HTML files and a \`sitemap.xml\` for all documentation routes.
31
+ * Called automatically in the \`closeBundle\` hook of the Vite plugin during a production build.
32
+ *
33
+ * @param options - Configuration for paths and site metadata
34
+ */
35
+ declare function generateStaticPages(options: SSGOptions): Promise<void>;
36
+
37
+ /**
38
+ * Metadata representing a single documentation route.
39
+ * This information is used to build the client-side router and the sidebar navigation.
40
+ */
41
+ interface RouteMeta {
42
+ /** The final URL path for the route (e.g., '/docs/guide/start') */
43
+ path: string;
44
+ /** The absolute filesystem path to the source markdown/mdx file */
45
+ componentPath: string;
46
+ /** The title of the page, usually extracted from frontmatter or the filename */
47
+ title: string;
48
+ /** The relative path from the docs directory, used for edit links */
49
+ filePath: string;
50
+ /** Optional description of the page (for SEO/meta tags) */
51
+ description?: string;
52
+ /** Optional explicit position for ordering in the sidebar */
53
+ sidebarPosition?: number;
54
+ /** The group (directory) this route belongs to */
55
+ group?: string;
56
+ /** The display title for the route's group */
57
+ groupTitle?: string;
58
+ /** Optional explicit position for ordering the group itself */
59
+ groupPosition?: number;
60
+ /** Optional icon for the route's group */
61
+ groupIcon?: string;
62
+ /** Extracted markdown headings for search indexing */
63
+ headings?: {
64
+ level: number;
65
+ text: string;
66
+ id: string;
67
+ }[];
68
+ /** The locale this route belongs to, if i18n is configured */
69
+ locale?: string;
70
+ /** The version this route belongs to, if versioning is configured */
71
+ version?: string;
72
+ /** Optional badge to display next to the sidebar item (e.g., 'New', 'Experimental') */
73
+ badge?: string | {
74
+ text: string;
75
+ expires?: string;
76
+ };
77
+ /** Optional icon to display (Lucide icon name or raw SVG) */
78
+ icon?: string;
79
+ /** The tab this route belongs to, if tabs are configured */
80
+ tab?: string;
81
+ /** The extracted plain-text content of the page for search indexing */
82
+ _content?: string;
83
+ /** The raw markdown content of the page */
84
+ _rawContent?: string;
85
+ }
86
+
87
+ declare function boltdocs(options?: BoltdocsPluginOptions): Promise<Plugin[]>;
88
+
89
+ export { BoltdocsConfig, type BoltdocsPluginOptions, type RouteMeta, type SSGOptions, boltdocs as default, generateStaticPages };
@@ -0,0 +1,89 @@
1
+ import { Plugin } from 'vite';
2
+ import { B as BoltdocsConfig } from '../config-CX4l-ZNp.js';
3
+ export { a as BoltdocsThemeConfig } from '../config-CX4l-ZNp.js';
4
+
5
+ /**
6
+ * Configuration options specifically for the Boltdocs Vite plugin.
7
+ */
8
+ interface BoltdocsPluginOptions {
9
+ /** The root directory containing markdown files (default: 'docs') */
10
+ docsDir?: string;
11
+ /** Path to a custom home page component (relative to project root) to render at '/' */
12
+ homePage?: string;
13
+ }
14
+
15
+ /**
16
+ * Options for the Static Site Generation process.
17
+ */
18
+ interface SSGOptions {
19
+ /** The root directory containing markdown documentation files */
20
+ docsDir: string;
21
+ /** The name of the documentation directory (e.g. 'docs') */
22
+ docsDirName: string;
23
+ /** The output directory where Vite placed the compiled `index.html` and assets */
24
+ outDir: string;
25
+ /** Pre-resolved config (avoids re-resolving during the SSG phase) */
26
+ config?: BoltdocsConfig;
27
+ }
28
+
29
+ /**
30
+ * Generates static HTML files and a \`sitemap.xml\` for all documentation routes.
31
+ * Called automatically in the \`closeBundle\` hook of the Vite plugin during a production build.
32
+ *
33
+ * @param options - Configuration for paths and site metadata
34
+ */
35
+ declare function generateStaticPages(options: SSGOptions): Promise<void>;
36
+
37
+ /**
38
+ * Metadata representing a single documentation route.
39
+ * This information is used to build the client-side router and the sidebar navigation.
40
+ */
41
+ interface RouteMeta {
42
+ /** The final URL path for the route (e.g., '/docs/guide/start') */
43
+ path: string;
44
+ /** The absolute filesystem path to the source markdown/mdx file */
45
+ componentPath: string;
46
+ /** The title of the page, usually extracted from frontmatter or the filename */
47
+ title: string;
48
+ /** The relative path from the docs directory, used for edit links */
49
+ filePath: string;
50
+ /** Optional description of the page (for SEO/meta tags) */
51
+ description?: string;
52
+ /** Optional explicit position for ordering in the sidebar */
53
+ sidebarPosition?: number;
54
+ /** The group (directory) this route belongs to */
55
+ group?: string;
56
+ /** The display title for the route's group */
57
+ groupTitle?: string;
58
+ /** Optional explicit position for ordering the group itself */
59
+ groupPosition?: number;
60
+ /** Optional icon for the route's group */
61
+ groupIcon?: string;
62
+ /** Extracted markdown headings for search indexing */
63
+ headings?: {
64
+ level: number;
65
+ text: string;
66
+ id: string;
67
+ }[];
68
+ /** The locale this route belongs to, if i18n is configured */
69
+ locale?: string;
70
+ /** The version this route belongs to, if versioning is configured */
71
+ version?: string;
72
+ /** Optional badge to display next to the sidebar item (e.g., 'New', 'Experimental') */
73
+ badge?: string | {
74
+ text: string;
75
+ expires?: string;
76
+ };
77
+ /** Optional icon to display (Lucide icon name or raw SVG) */
78
+ icon?: string;
79
+ /** The tab this route belongs to, if tabs are configured */
80
+ tab?: string;
81
+ /** The extracted plain-text content of the page for search indexing */
82
+ _content?: string;
83
+ /** The raw markdown content of the page */
84
+ _rawContent?: string;
85
+ }
86
+
87
+ declare function boltdocs(options?: BoltdocsPluginOptions): Promise<Plugin[]>;
88
+
89
+ export { BoltdocsConfig, type BoltdocsPluginOptions, type RouteMeta, type SSGOptions, boltdocs as default, generateStaticPages };
@@ -0,0 +1,57 @@
1
+ "use strict";var ye=Object.create;var Z=Object.defineProperty;var xe=Object.getOwnPropertyDescriptor;var ve=Object.getOwnPropertyNames;var be=Object.getPrototypeOf,Pe=Object.prototype.hasOwnProperty;var ut=(o,t)=>()=>(o&&(t=o(o=0)),t);var Mt=(o,t)=>{for(var e in t)Z(o,e,{get:t[e],enumerable:!0})},kt=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ve(t))!Pe.call(o,n)&&n!==e&&Z(o,n,{get:()=>t[n],enumerable:!(r=xe(t,n))||r.enumerable});return o};var v=(o,t,e)=>(e=o!=null?ye(be(o)):{},kt(t||!o||!o.__esModule?Z(e,"default",{value:o,enumerable:!0}):e,o)),Ce=o=>kt(Z({},"__esModule",{value:!0}),o);var we,b,g=ut(()=>{"use strict";we=()=>typeof document>"u"?new URL(`file:${__filename}`).href:document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"?document.currentScript.src:new URL("main.js",document.baseURI).href,b=we()});function D(o){return o.replace(/\\/g,"/")}function N(o){return o.replace(/^\d+\./,"")}function Q(o){let t=o.match(/^(\d+)\./);return t?parseInt(t[1],10):void 0}function Tt(o){return/\.mdx?$/.test(o)}function Y(o){try{return pt.default.statSync(o).mtimeMs}catch{return 0}}function Ot(o){let t=pt.default.readFileSync(o,"utf-8"),{data:e,content:r}=(0,_t.default)(t);return{data:e,content:r}}function E(o){return o.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function gt(o){return E(o)}function Ft(o){let e=o.split("/").map(N).join("/").replace(/\/$/,"");return e=e.replace(/\.mdx?$/,""),(e==="index"||e.endsWith("/index"))&&(e=e.replace(/index$/,"")),e.startsWith("/")||(e="/"+e),e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1)),e}function A(o){return mt.default.sanitize(o)}function ft(o){return mt.default.sanitize(o,{ALLOWED_TAGS:[],KEEP_CONTENT:!0})}function G(o){return o.charAt(0).toUpperCase()+o.slice(1)}var pt,_t,mt,k=ut(()=>{"use strict";g();pt=v(require("fs")),_t=v(require("gray-matter")),mt=v(require("isomorphic-dompurify"))});var Pt={};Mt(Pt,{AssetCache:()=>xt,FileCache:()=>U,TransformCache:()=>q,flushCache:()=>Me});async function Me(){await T.flush()}var P,C,H,L,I,tt,$e,et,vt,Ue,bt,Se,De,Re,Be,ht,yt,T,U,q,xt,V=ut(()=>{"use strict";g();P=v(require("fs")),C=v(require("path")),H=v(require("crypto")),L=v(require("zlib")),I=require("util");k();tt=(0,I.promisify)(P.default.writeFile),$e=(0,I.promisify)(P.default.readFile),et=(0,I.promisify)(P.default.mkdir),vt=(0,I.promisify)(P.default.rename),Ue=(0,I.promisify)(P.default.unlink),bt=process.env.BOLTDOCS_CACHE_DIR||".boltdocs",Se="assets",De="shards",Re=parseInt(process.env.BOLTDOCS_CACHE_LRU_LIMIT||"2000",10),Be=process.env.BOLTDOCS_CACHE_COMPRESS!=="0",ht=class{constructor(t){this.limit=t}cache=new Map;get(t){let e=this.cache.get(t);return e!==void 0&&(this.cache.delete(t),this.cache.set(t,e)),e}set(t,e){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.limit){let r=this.cache.keys().next().value;r!==void 0&&this.cache.delete(r)}this.cache.set(t,e)}get size(){return this.cache.size}clear(){this.cache.clear()}},yt=class{queue=Promise.resolve();pendingCount=0;add(t){this.pendingCount++,this.queue=this.queue.then(t).finally(()=>{this.pendingCount--})}async flush(){await this.queue}get pending(){return this.pendingCount}},T=new yt,U=class{entries=new Map;cachePath=null;compress;constructor(t={}){if(this.compress=t.compress!==void 0?t.compress:Be,t.name){let e=t.root||process.cwd(),r=this.compress?"json.gz":"json";this.cachePath=C.default.resolve(e,bt,`${t.name}.${r}`)}}load(){if(process.env.BOLTDOCS_NO_CACHE!=="1"&&!(!this.cachePath||!P.default.existsSync(this.cachePath)))try{let t=P.default.readFileSync(this.cachePath);this.cachePath.endsWith(".gz")&&(t=L.default.gunzipSync(t));let e=JSON.parse(t.toString("utf-8"));this.entries=new Map(Object.entries(e))}catch{}}save(){if(process.env.BOLTDOCS_NO_CACHE==="1"||!this.cachePath)return;let t=Object.fromEntries(this.entries),e=JSON.stringify(t),r=this.cachePath,n=this.compress;T.add(async()=>{try{await et(C.default.dirname(r),{recursive:!0});let s=Buffer.from(e);n&&(s=L.default.gzipSync(s));let l=`${r}.${H.default.randomBytes(4).toString("hex")}.tmp`;await tt(l,s),await vt(l,r)}catch{}})}get(t){let e=this.entries.get(t);return!e||Y(t)!==e.mtime?null:e.data}set(t,e){this.entries.set(t,{data:e,mtime:Y(t)})}isValid(t){let e=this.entries.get(t);return e?Y(t)===e.mtime:!1}invalidate(t){this.entries.delete(t)}invalidateAll(){this.entries.clear()}pruneStale(t){for(let e of this.entries.keys())t.has(e)||this.entries.delete(e)}get size(){return this.entries.size}async flush(){await T.flush()}},q=class{index=new Map;memoryCache=new ht(Re);baseDir;shardsDir;indexPath;constructor(t,e=process.cwd()){this.baseDir=C.default.resolve(e,bt,`transform-${t}`),this.shardsDir=C.default.resolve(this.baseDir,De),this.indexPath=C.default.resolve(this.baseDir,"index.json")}load(){if(process.env.BOLTDOCS_NO_CACHE!=="1"&&P.default.existsSync(this.indexPath))try{let t=P.default.readFileSync(this.indexPath,"utf-8");this.index=new Map(Object.entries(JSON.parse(t)))}catch{}}save(){if(process.env.BOLTDOCS_NO_CACHE==="1")return;let t=JSON.stringify(Object.fromEntries(this.index)),e=this.indexPath;T.add(async()=>{await et(C.default.dirname(e),{recursive:!0}),await tt(e,t)})}async getMany(t){let e=new Map,r=[];for(let n of t){let s=this.memoryCache.get(n);s?e.set(n,s):this.index.has(n)&&r.push(n)}if(r.length>0){let n=await Promise.all(r.map(async s=>{let l=this.index.get(s),p=C.default.resolve(this.shardsDir,`${l}.gz`);try{let i=await $e(p),a=L.default.gunzipSync(i).toString("utf-8");return this.memoryCache.set(s,a),{key:s,val:a}}catch{return null}}));for(let s of n)s&&e.set(s.key,s.val)}return e}get(t){let e=this.memoryCache.get(t);if(e)return e;let r=this.index.get(t);if(!r)return null;let n=C.default.resolve(this.shardsDir,`${r}.gz`);if(!P.default.existsSync(n))return null;try{let s=P.default.readFileSync(n),l=L.default.gunzipSync(s).toString("utf-8");return this.memoryCache.set(t,l),l}catch{return null}}set(t,e){let r=H.default.createHash("md5").update(e).digest("hex");this.index.set(t,r),this.memoryCache.set(t,e);let n=C.default.resolve(this.shardsDir,`${r}.gz`);T.add(async()=>{if(P.default.existsSync(n))return;await et(this.shardsDir,{recursive:!0});let s=L.default.gzipSync(Buffer.from(e)),l=`${n}.${H.default.randomBytes(4).toString("hex")}.tmp`;await tt(l,s),await vt(l,n)})}get size(){return this.index.size}async flush(){await T.flush()}},xt=class{assetsDir;constructor(t=process.cwd()){this.assetsDir=C.default.resolve(t,bt,Se)}getFileHash(t){return H.default.createHash("md5").update(P.default.readFileSync(t)).digest("hex")}get(t,e){if(!P.default.existsSync(t))return null;let r=this.getFileHash(t),n=this.getCachedPath(t,`${e}-${r}`);return P.default.existsSync(n)?n:null}set(t,e,r){let n=this.getFileHash(t),s=this.getCachedPath(t,`${e}-${n}`);T.add(async()=>{await et(this.assetsDir,{recursive:!0});let l=`${s}.${H.default.randomBytes(4).toString("hex")}.tmp`;await tt(l,r),await vt(l,s)})}getCachedPath(t,e){let r=C.default.extname(t),n=C.default.basename(t,r),s=e.replace(/[^a-z0-9]/gi,"-").toLowerCase();return C.default.join(this.assetsDir,`${n}.${s}${r}`)}clear(){P.default.existsSync(this.assetsDir)&&P.default.rmSync(this.assetsDir,{recursive:!0,force:!0})}async flush(){await T.flush()}}});var He={};Mt(He,{default:()=>le,generateStaticPages:()=>rt});module.exports=Ce(He);g();g();var Zt=require("vite");g();var It=v(require("fast-glob"));k();g();V();var _=new U({name:"routes"});function Ct(){_.invalidateAll()}function wt(o){_.invalidate(o)}g();var z=v(require("path")),Et=v(require("github-slugger"));k();function jt(o,t,e,r){let n=decodeURIComponent(o),s=z.default.resolve(n),l=z.default.resolve(t),p=D(z.default.relative(l,s));if(p.startsWith("../")||p===".."||s.includes("\0"))throw new Error(`Security breach: File is outside of docs directory or contains null bytes: ${o}`);let{data:i,content:a}=Ot(o),c=p.split("/"),d,h;if(r?.versions&&c.length>0){let S=c[0];r.versions.versions[S]&&(h=S,c=c.slice(1))}if(r?.i18n&&c.length>0){let S=c[0];r.i18n.locales[S]&&(d=S,c=c.slice(1))}let $;if(c.length>0){let S=c[0].match(/^\((.+)\)$/);S&&($=S[1].toLowerCase(),c=c.slice(1))}let u=c.join("/"),m;i.permalink?m=i.permalink.startsWith("/")?i.permalink:`/${i.permalink}`:m=Ft(u||"index.md");let f=e;h&&(f+="/"+h),d&&(f+="/"+d),f+=m==="/"?"":m,(!f||f==="")&&(f="/");let x=c[c.length-1],M=N(x),w=N(z.default.basename(o,z.default.extname(o))),y=i.sidebarPosition??Q(x),R=c.length>=2?c[0]:void 0,F=R?N(R):void 0,X=c.length>=2&&/^index\.mdx?$/.test(M),de=new Et.default,Dt=[],ue=/^(#{2,4})\s+(.+)$/gm,lt;for(;(lt=ue.exec(a))!==null;){let S=lt[1].length,fe=lt[2].replace(/\[([^\]]+)\]\([^\)]+\)/g,"$1").replace(/[_*`]/g,"").trim(),Bt=A(fe).trim(),he=de.slug(Bt);Dt.push({level:S,text:Bt,id:he})}let pe=i.title?A(String(i.title)):w,dt=i.description?A(String(i.description)):"";!dt&&a&&(dt=ft(a.replace(/^#+.*$/gm,"").replace(/\[([^\]]+)\]\([^\)]+\)/g,"$1").replace(/[_*`]/g,"").replace(/\s+/g," ")).trim().slice(0,160));let me=i.badge?A(String(i.badge)):void 0,Rt=i.icon?String(i.icon):void 0,ge=ke(a);return{route:{path:f,componentPath:o,filePath:p,title:pe,description:dt,sidebarPosition:y,headings:Dt,locale:d,version:h,badge:me,icon:Rt,tab:$,_content:ge,_rawContent:a},relativeDir:F,isGroupIndex:X,inferredTab:$,groupMeta:X?{title:i.groupTitle||i.title||(F?G(F):""),position:i.groupPosition??i.sidebarPosition??(R?Q(R):void 0),icon:Rt}:void 0,inferredGroupPosition:R?Q(R):void 0}}function ke(o){let t=o.replace(/^#+.*$/gm,"").replace(/\[([^\]]+)\]\([^\)]+\)/g,"$1").replace(/\{[^\}]+\}/g,"").replace(/[_*`]/g,"").replace(/\s+/g," ");return ft(t).trim()}g();function Ht(o){return o.sort((t,e)=>!t.group&&!e.group?Lt(t,e):t.group?e.group?t.group!==e.group?_e(t,e):Lt(t,e):1:-1)}function Lt(o,t){return o.sidebarPosition!==void 0&&t.sidebarPosition!==void 0?o.sidebarPosition-t.sidebarPosition:o.sidebarPosition!==void 0?-1:t.sidebarPosition!==void 0?1:o.title.localeCompare(t.title)}function _e(o,t){return o.groupPosition!==void 0&&t.groupPosition!==void 0?o.groupPosition-t.groupPosition:o.groupPosition!==void 0?-1:t.groupPosition!==void 0?1:(o.groupTitle||o.group).localeCompare(t.groupTitle||t.group)}var W=new Map;async function K(o,t,e="/docs"){let r=performance.now();_.load(),W.clear(),(process.env.BOLTDOCS_FORCE_REPARSE==="true"||t?.i18n)&&_.invalidateAll();let n=await(0,It.default)(["**/*.md","**/*.mdx"],{cwd:o,absolute:!0,suppressErrors:!0,followSymbolicLinks:!1});_.pruneStale(new Set(n));let s=50,l=[],p=0;for(let u=0;u<n.length;u+=s){let m=n.slice(u,u+s),f=await Promise.all(m.map(async x=>{let M=_.get(x);if(M)return p++,M;let w=jt(x,o,e,t);return _.set(x,w),w}));l.push(...f),u+s<n.length&&await new Promise(x=>setImmediate(x))}_.save();let i=new Map,a=[];for(let u of l)if(u.isGroupIndex&&u.relativeDir&&a.push(u),u.relativeDir){let m=i.get(u.relativeDir);m?(m.position===void 0&&u.inferredGroupPosition!==void 0&&(m.position=u.inferredGroupPosition),!m.icon&&u.route.icon&&(m.icon=u.route.icon)):(m={title:G(u.relativeDir),position:u.inferredGroupPosition,icon:u.route.icon},i.set(u.relativeDir,m))}for(let u of a){let m=i.get(u.relativeDir);u.groupMeta&&(m.title=u.groupMeta.title,u.groupMeta.position!==void 0&&(m.position=u.groupMeta.position),u.groupMeta.icon&&(m.icon=u.groupMeta.icon))}let c=new Array(l.length);for(let u=0;u<l.length;u++){let m=l[u],f=m.relativeDir,x=f?i.get(f):void 0;c[u]={...m.route,group:f,groupTitle:x?.title||(f?G(f):void 0),groupPosition:x?.position,groupIcon:x?.icon}}let d=c;if(t?.i18n){let u=Te(c,t,e);d=[...c,...u]}let h=Ht(d),$=performance.now()-r;return console.log(`[boltdocs] Route generation: ${$.toFixed(2)}ms (${n.length} files, ${p} cache hits)`),h}function Te(o,t,e){let r=t.i18n.defaultLocale,n=Object.keys(t.i18n.locales),s=[],l=new Map,p=[];for(let i of o){let a=i.locale||r;l.has(a)||l.set(a,new Set),l.get(a).add(i.path),a===r&&p.push(i)}for(let i of n){if(i===r)continue;let a=l.get(i)||new Set;for(let c of p){let d=Oe(c.path,r,i,e);a.has(d)||s.push({...c,path:d,locale:i})}}return s}function Oe(o,t,e,r){let n=`${o}:${e}`,s=W.get(n);if(s)return s;let l=r,p=o.match(new RegExp(`^${r}/(v[0-9]+)`));p&&(l+="/"+p[1]);let i=o.substring(l.length),a=`/${t}`;if(i.startsWith(a+"/"))i="/"+e+"/"+i.substring(a.length+1);else if(i===a)i="/"+e;else if(i==="/"||i==="")i="/"+e;else{let d=i.startsWith("/")?"":"/";i="/"+e+d+i}let c=l+i;return W.size>2e3&&W.clear(),W.set(n,c),c}var Qt=require("vite-plugin-image-optimizer");g();var ot=v(require("path")),zt=v(require("fs")),Nt=require("vite"),it=["boltdocs.config.js","boltdocs.config.mjs","boltdocs.config.ts"];async function nt(o,t=process.cwd()){let e=t,r={docsDir:ot.default.resolve(o),themeConfig:{title:"Boltdocs",description:"A Vite documentation framework",navbar:[{label:"Home",href:"/"},{label:"Documentation",href:"/docs"}],codeTheme:{light:"github-light",dark:"github-dark"},poweredBy:!0,breadcrumbs:!0}},n={};for(let i of it){let a=ot.default.resolve(e,i);if(zt.default.existsSync(a))try{let c=await(0,Nt.loadConfigFromFile)({command:"serve",mode:"development"},a,e);if(c){n=c.config;break}}catch(c){console.warn(`[boltdocs] Failed to load config from ${i}:`,c)}}let l={...{title:n.title,description:n.description,logo:n.logo,navbar:n.navbar,sidebar:n.sidebar,socialLinks:n.socialLinks,footer:n.footer,githubRepo:n.githubRepo,tabs:n.tabs},...n.themeConfig||{}},p=Object.fromEntries(Object.entries(l).filter(([i,a])=>a!==void 0));return p.navbar&&(p.navbar=p.navbar.map(i=>({label:i.label||i.text||"",href:i.href||i.link||i.to||"",items:i.items?.map(a=>({label:a.label||a.text||"",href:a.href||a.link||a.to||""}))}))),{docsDir:ot.default.resolve(o),themeConfig:{...r.themeConfig,...p,codeTheme:p.codeTheme||(n.themeConfig||n).codeTheme||r.themeConfig?.codeTheme},i18n:n.i18n,versions:n.versions,siteUrl:n.siteUrl,plugins:n.plugins||[],external:n.external,integrations:n.integrations}}g();var j=v(require("fs")),O=v(require("path"));k();var Vt=require("url"),Wt=require("module");g();k();function At(o,t){let e=E(t.title),r=E(t.description);return o.replace(/<title>.*?<\/title>/,`<title>${e}</title>`).replace(/(<meta name="description" content=")[^"]*(")/,`$1${r}$2`).replace(/(<meta property="og:title" content=")[^"]*(")/,`$1${e}$2`).replace(/(<meta property="og:description" content=")[^"]*(")/,`$1${r}$2`).replace(/(<meta name="twitter:title" content=")[^"]*(")/,`$1${e}$2`).replace(/(<meta name="twitter:description" content=")[^"]*(")/,`$1${r}$2`)}g();k();function Gt(o,t){let e=t?.siteUrl?.replace(/\/$/,"")||"https://example.com",r=new Date().toISOString().split("T")[0],n=[{url:"/",priority:"1.0",changefreq:"daily"}];if(t?.i18n){let l=t.i18n.defaultLocale;for(let p of Object.keys(t.i18n.locales))p!==l&&n.push({url:`/${p}/`,priority:"1.0",changefreq:"daily"})}return`<?xml version="1.0" encoding="UTF-8"?>
2
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
3
+ ${[...n,...o.map(l=>({url:l,priority:"0.8",changefreq:"weekly"}))].map(l=>` <url>
4
+ <loc>${gt(e)}${gt(l.url)}</loc>
5
+ <lastmod>${r}</lastmod>
6
+ <changefreq>${l.changefreq}</changefreq>
7
+ <priority>${l.priority}</priority>
8
+ </url>`).join(`
9
+ `)}
10
+ </urlset>`}var Fe=(0,Vt.fileURLToPath)(b),Ut=O.default.dirname(Fe),qt=(0,Wt.createRequire)(b);async function rt(o){let{docsDir:t,docsDirName:e,outDir:r,config:n}=o,s=await K(t,n),l=n?.themeConfig?.title||"Boltdocs",p=n?.themeConfig?.description||"",i=O.default.resolve(Ut,"../client/ssr.js");if(!j.default.existsSync(i)){console.error("[boltdocs] SSR module not found at",i,"- Did you build the core package?");return}let a=qt("module"),c=a.prototype.require;a.prototype.require=function(f,...x){return f==="virtual:boltdocs-layout"?{__esModule:!0,default:function(w){try{let R=c.apply(this,[O.default.resolve(Ut,"../client/index.js")]).DefaultLayout||(({children:X})=>X);return c.apply(this,["react"]).createElement(R,w)}catch{return w.children}}}:c.apply(this,[f,...x])};let{render:d}=qt(i);a.prototype.require=c;let h=O.default.join(r,"index.html");if(!j.default.existsSync(h)){console.warn("[boltdocs] No index.html found in outDir, skipping SSG.");return}let $=j.default.readFileSync(h,"utf-8");await Promise.all(s.map(async f=>{let x=`${f.title} | ${l}`,M=f.description||p,w={};w[`/${e}/${f.filePath}`]={default:()=>null};try{let y=await d({path:f.path,routes:s,config:n||{},docsDirName:e,modules:w,homePage:void 0}),R=At($,{title:E(x),description:E(M)}).replace("<!--app-html-->",y).replace('<div id="root"></div>',`<div id="root">${y}</div>`),F=O.default.join(r,f.path);await j.default.promises.mkdir(F,{recursive:!0}),await j.default.promises.writeFile(O.default.join(F,"index.html"),R,"utf-8")}catch(y){console.error(`[boltdocs] Error SSR rendering route ${f.path}:`,y&&(y.stack||y))}}));let u=Gt(s.map(f=>f.path),n);j.default.writeFileSync(O.default.join(r,"sitemap.xml"),u,"utf-8"),console.log(`[boltdocs] Generated ${s.length} static pages + sitemap.xml`);let{flushCache:m}=await Promise.resolve().then(()=>(V(),Pt));await m()}k();var B=v(require("path"));g();k();var Kt=v(require("path"));function Jt(o,t){let e=o.homePage?`import HomePage from '${D(o.homePage)}';`:"",r=o.homePage?"homePage: HomePage,":"",n=t?.plugins?.flatMap(d=>Object.entries(d.components||{}))||[],s=n.map(([d,h])=>`import * as _comp_${d} from '${D(h)}';
11
+ const ${d} = _comp_${d}.default || _comp_${d}['${d}'] || _comp_${d};`).join(`
12
+ `),l=n.map(([d])=>d).join(", "),p=Kt.default.basename(o.docsDir||"docs"),i=Object.entries(t?.external||{}),a=i.map(([d,h],$)=>`import _ext_${$} from '${D(h)}';`).join(`
13
+ `),c=i.length>0?`externalPages: { ${i.map(([d],h)=>`"${d}": _ext_${h}`).join(", ")} },`:"";return`
14
+ import { createBoltdocsApp as _createApp } from 'boltdocs/client';
15
+ import _routes from 'virtual:boltdocs-routes';
16
+ import _config from 'virtual:boltdocs-config';
17
+ import _user_mdx_components from 'virtual:boltdocs-mdx-components';
18
+ ${e}
19
+ ${s}
20
+ ${a}
21
+
22
+ _createApp({
23
+ target: '#root',
24
+ routes: _routes,
25
+ docsDirName: '${p}',
26
+ config: _config,
27
+ modules: import.meta.glob('/${p}/**/*.{md,mdx}'),
28
+ hot: import.meta.hot,
29
+ ${r}
30
+ ${c}
31
+ components: { ${l}${l?", ":""} ...(_user_mdx_components || {}) },
32
+ });
33
+ `}g();function Xt(o,t){let e=t.themeConfig?.title||"Boltdocs",r=t.themeConfig?.description||"",n=[`<meta name="description" content="${r}">`,`<meta property="og:title" content="${e}">`,`<meta property="og:description" content="${r}">`,'<meta property="og:type" content="website">','<meta name="twitter:card" content="summary">',`<meta name="twitter:title" content="${e}">`,`<meta name="twitter:description" content="${r}">`,'<meta name="generator" content="Boltdocs">'].join(`
34
+ `),s=`
35
+ <script>
36
+ (function() {
37
+ try {
38
+ var stored = localStorage.getItem("boltdocs-theme");
39
+ var theme = stored || (window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light");
40
+ if (theme === "light") {
41
+ document.documentElement.classList.add("theme-light");
42
+ document.documentElement.dataset.theme = "light";
43
+ } else {
44
+ document.documentElement.classList.remove("theme-light");
45
+ document.documentElement.dataset.theme = "dark";
46
+ }
47
+ } catch (e) {}
48
+ })();
49
+ </script>
50
+ `;return o=o.replace(/<title>.*?<\/title>/,`<title>${e}</title>`),o=o.replace("</head>",` ${n}
51
+ ${s} </head>`),o.includes("src/main")||(o=o.replace("</body>",` <script type="module">import "virtual:boltdocs-entry";</script>
52
+ </body>`)),o}var $t=v(require("fs"));g();function Yt(o={},t){let e=B.default.resolve(process.cwd(),o.docsDir||"docs"),r=D(e),n=t,s,l=!1,p=n?.plugins?.flatMap(i=>i.vitePlugins||[])||[];return[{name:"vite-plugin-boltdocs",enforce:"pre",async config(i,a){l=a.command==="build";let c=i.envDir||process.cwd(),d=(0,Zt.loadEnv)(a.mode,c,"");return Object.assign(process.env,d),n||(n=await nt(e)),{optimizeDeps:{include:["react","react-dom"]}}},configResolved(i){s=i},configureServer(i){let a=it.map(m=>B.default.resolve(process.cwd(),m)),c=["tsx","jsx"],d=c.map(m=>B.default.resolve(e,`layout.${m}`)),h=["tsx","ts","jsx","js"],$=h.map(m=>B.default.resolve(e,`mdx-components.${m}`));i.watcher.add([...a,...$,...d]);let u=async(m,f)=>{let x=D(m);if(it.some(y=>x.endsWith(y))){i.restart();return}if(h.some(y=>x.endsWith(`mdx-components.${y}`))){let y=i.moduleGraph.getModuleById("\0virtual:boltdocs-mdx-components");y&&i.moduleGraph.invalidateModule(y),i.ws.send({type:"full-reload"});return}if(c.some(y=>x.endsWith(`layout.${y}`))){let y=i.moduleGraph.getModuleById("\0virtual:boltdocs-layout");y&&i.moduleGraph.invalidateModule(y),i.ws.send({type:"full-reload"});return}if(!x.startsWith(r)||!Tt(x))return;f==="add"||f==="unlink"?Ct():wt(m);let M=await K(e,n),w=i.moduleGraph.getModuleById("\0virtual:boltdocs-routes");w&&i.moduleGraph.invalidateModule(w),i.ws.send({type:"custom",event:"boltdocs:routes-update",data:M})};i.watcher.on("add",m=>u(m,"add")),i.watcher.on("unlink",m=>u(m,"unlink")),i.watcher.on("change",m=>u(m,"change"))},resolveId(i){if(i==="virtual:boltdocs-routes"||i==="virtual:boltdocs-config"||i==="virtual:boltdocs-entry"||i==="virtual:boltdocs-mdx-components"||i==="virtual:boltdocs-layout")return"\0"+i},async load(i){if(i==="\0virtual:boltdocs-routes"){let a=await K(e,n);return`export default ${JSON.stringify(a,null,2)};`}if(i==="\0virtual:boltdocs-config"){let a={themeConfig:n?.themeConfig,integrations:n?.integrations,i18n:n?.i18n,versions:n?.versions,siteUrl:n?.siteUrl};return`export default ${JSON.stringify(a,null,2)};`}if(i==="\0virtual:boltdocs-entry")return Jt(o,n);if(i==="\0virtual:boltdocs-mdx-components"){let a=["tsx","ts","jsx","js"],c=null;for(let d of a){let h=B.default.resolve(e,`mdx-components.${d}`);if($t.default.existsSync(h)){c=h;break}}if(c){let d=D(c);return`import * as components from '${d}';
53
+ const mdxComponents = components.default || components;
54
+ export default mdxComponents;
55
+ export * from '${d}';`}return"export default {};"}if(i==="\0virtual:boltdocs-layout"){let a=["tsx","jsx"],c=null;for(let d of a){let h=B.default.resolve(e,`layout.${d}`);if($t.default.existsSync(h)){c=h;break}}return c?`import UserLayout from '${D(c)}';
56
+ export default UserLayout;`:`import { DefaultLayout } from 'boltdocs/client';
57
+ export default DefaultLayout;`}},transformIndexHtml:{order:"pre",handler(i){return Xt(i,n)}},async closeBundle(){if(!l)return;let i=s?.build?.outDir?B.default.resolve(s.root,s.build.outDir):B.default.resolve(process.cwd(),"dist"),a=B.default.basename(e||"docs");await rt({docsDir:e,docsDirName:a,outDir:i,config:n});let{flushCache:c}=await Promise.resolve().then(()=>(V(),Pt));await c()}},(0,Qt.ViteImageOptimizer)({includePublic:!0,png:{quality:80},jpeg:{quality:80},jpg:{quality:80},webp:{quality:80},avif:{quality:80},svg:{multipass:!0,plugins:[{name:"preset-default"}]}}),...p.filter(i=>!!i)]}g();var ee=v(require("@mdx-js/rollup")),oe=v(require("remark-gfm")),ie=v(require("remark-frontmatter")),ne=v(require("rehype-slug")),re=v(require("crypto")),St=require("unist-util-visit"),se=require("shiki");V();var st=null;async function ae(o){if(st)return st;let t=typeof o=="object"?[o.light,o.dark]:[o??"github-dark"];return["github-light","github-dark"].forEach(e=>{t.includes(e)||t.push(e)}),st=await(0,se.createHighlighter)({themes:t,langs:["tsx","jsx","ts","js","json","md","mdx","css","html","bash","sh","yaml","yml"]}),st}function Ee(o){return async t=>{let e=o?.themeConfig?.codeTheme??{light:"github-light",dark:"github-dark"},r=await ae(e);(0,St.visit)(t,["mdxJsxFlowElement","mdxJsxTextElement"],n=>{if(n.name!=="ComponentPreview")return;let s=n.attributes?.find(a=>a.name==="code"),l="";if(s){if(typeof s.value=="string")l=s.value;else if(s.value?.type==="mdxJsxAttributeValueExpression"){let a=s.value.value??"";l=a.match(/^[`'"](.+)[`'"]$/)?.[1]??a}}if(!l)return;let p=typeof e=="object"?{themes:{light:e.light,dark:e.dark},lang:"tsx"}:{theme:e,lang:"tsx"},i=r.codeToHtml(l,p);n.attributes=(n.attributes??[]).filter(a=>a.name!=="highlightedHtml"),n.attributes.push({type:"mdxJsxAttribute",name:"highlightedHtml",value:i})})}}function je(o){return async t=>{let e=o?.themeConfig?.codeTheme||{light:"github-light",dark:"github-dark"},r=await ae(e);(0,St.visit)(t,"element",n=>{if(n.tagName==="pre"&&n.children?.[0]?.tagName==="code"){let s=n.children[0],p=(s.properties?.className||[]).find(h=>h.startsWith("language-")),i=p?p.slice(9):"text",a=s.children[0]?.value||"",c={lang:i};typeof e=="object"?c.themes={light:e.light,dark:e.dark}:c.theme=e;let d=r.codeToHtml(a,c);n.properties.dataHighlighted="true",n.properties.highlightedHtml=d,n.children=[]}})}}var Le="v3",J=new q("mdx"),te=!1;function ce(o,t=ee.default){let e=o?.plugins?.flatMap(s=>s.remarkPlugins||[])||[],r=o?.plugins?.flatMap(s=>s.rehypePlugins||[])||[],n=t({remarkPlugins:[oe.default,ie.default,[Ee,o],...e],rehypePlugins:[ne.default,[je,o],...r],jsxRuntime:"automatic",providerImportSource:"@mdx-js/react"});return n.isMock&&console.log("MDX PLUGIN IS MOCKED"),{...n,name:"vite-plugin-boltdocs-mdx",async buildStart(){at=0,ct=0,te||(J.load(),te=!0),n.buildStart&&await n.buildStart.call(this)},async transform(s,l,p){if(!l.endsWith(".md")&&!l.endsWith(".mdx"))return n.transform?.call(this,s,l,p);console.log(`[boltdocs] Transforming MDX: ${l}`),ct++;let i=re.default.createHash("md5").update(s).digest("hex"),a=`${l}:${i}:${Le}`,c=J.get(a);if(c)return at++,{code:c,map:null};let d=await n.transform.call(this,s,l,p);return d&&typeof d=="object"&&d.code&&J.set(a,d.code),d},async buildEnd(){console.log(`[boltdocs] MDX Cache Performance: ${at}/${ct} hits (${Math.round(at/ct*100)||0}%)`),J.save(),await J.flush(),n.buildEnd&&await n.buildEnd.call(this)}}}var at=0,ct=0;async function le(o){let t=o?.docsDir||"docs",e=await nt(t);return[...Yt(o,e),ce(e)]}0&&(module.exports={generateStaticPages});