boltdocs 1.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 (137) hide show
  1. package/dist/CodeBlock-37XMKCYY.mjs +7 -0
  2. package/dist/PackageManagerTabs-4NWXLXQO.mjs +314 -0
  3. package/dist/Playground-OE2OE6B6.mjs +7 -0
  4. package/dist/SearchDialog-FTOQZ763.mjs +187 -0
  5. package/dist/SearchDialog-ZAZXYIFX.css +2147 -0
  6. package/dist/Video-I6QY4X7J.mjs +7 -0
  7. package/dist/chunk-2YRDWM6O.mjs +56 -0
  8. package/dist/chunk-PN4GCTYG.mjs +67 -0
  9. package/dist/chunk-X2TDGMTR.mjs +64 -0
  10. package/dist/chunk-X6BYQHVC.mjs +12 -0
  11. package/dist/chunk-Z7JHYNAS.mjs +57 -0
  12. package/dist/chunk-ZFCOLEXN.mjs +1644 -0
  13. package/dist/client/index.css +2147 -0
  14. package/dist/client/index.d.mts +298 -0
  15. package/dist/client/index.d.ts +298 -0
  16. package/dist/client/index.js +2793 -0
  17. package/dist/client/index.mjs +63 -0
  18. package/dist/client/ssr.css +2147 -0
  19. package/dist/client/ssr.d.mts +25 -0
  20. package/dist/client/ssr.d.ts +25 -0
  21. package/dist/client/ssr.js +2727 -0
  22. package/dist/client/ssr.mjs +32 -0
  23. package/dist/config-D2XmHJYe.d.mts +122 -0
  24. package/dist/config-D2XmHJYe.d.ts +122 -0
  25. package/dist/index-CRQKWAeo.d.mts +82 -0
  26. package/dist/index-CRQKWAeo.d.ts +82 -0
  27. package/dist/node/cli/index.d.mts +1 -0
  28. package/dist/node/cli/index.d.ts +1 -0
  29. package/dist/node/cli/index.js +199 -0
  30. package/dist/node/cli/index.mjs +154 -0
  31. package/dist/node/index.d.mts +79 -0
  32. package/dist/node/index.d.ts +79 -0
  33. package/dist/node/index.js +797 -0
  34. package/dist/node/index.mjs +719 -0
  35. package/package.json +79 -0
  36. package/src/client/app/index.tsx +422 -0
  37. package/src/client/app/preload.tsx +56 -0
  38. package/src/client/index.ts +40 -0
  39. package/src/client/ssr.tsx +50 -0
  40. package/src/client/theme/components/CodeBlock/CodeBlock.tsx +76 -0
  41. package/src/client/theme/components/CodeBlock/index.ts +1 -0
  42. package/src/client/theme/components/PackageManagerTabs/PackageManagerTabs.tsx +154 -0
  43. package/src/client/theme/components/PackageManagerTabs/index.ts +1 -0
  44. package/src/client/theme/components/PackageManagerTabs/pkg-tabs.css +64 -0
  45. package/src/client/theme/components/Playground/Playground.tsx +86 -0
  46. package/src/client/theme/components/Playground/index.ts +1 -0
  47. package/src/client/theme/components/Playground/playground.css +168 -0
  48. package/src/client/theme/components/Video/Video.tsx +84 -0
  49. package/src/client/theme/components/Video/index.ts +1 -0
  50. package/src/client/theme/components/Video/video.css +41 -0
  51. package/src/client/theme/components/mdx/Admonition.tsx +80 -0
  52. package/src/client/theme/components/mdx/Badge.tsx +31 -0
  53. package/src/client/theme/components/mdx/Button.tsx +50 -0
  54. package/src/client/theme/components/mdx/Card.tsx +80 -0
  55. package/src/client/theme/components/mdx/List.tsx +57 -0
  56. package/src/client/theme/components/mdx/Tabs.tsx +94 -0
  57. package/src/client/theme/components/mdx/index.ts +18 -0
  58. package/src/client/theme/components/mdx/mdx-components.css +405 -0
  59. package/src/client/theme/icons/bun.tsx +62 -0
  60. package/src/client/theme/icons/deno.tsx +20 -0
  61. package/src/client/theme/icons/discord.tsx +12 -0
  62. package/src/client/theme/icons/github.tsx +15 -0
  63. package/src/client/theme/icons/npm.tsx +13 -0
  64. package/src/client/theme/icons/pnpm.tsx +72 -0
  65. package/src/client/theme/icons/twitter.tsx +12 -0
  66. package/src/client/theme/styles/home.css +60 -0
  67. package/src/client/theme/styles/markdown.css +343 -0
  68. package/src/client/theme/styles/variables.css +162 -0
  69. package/src/client/theme/styles.css +38 -0
  70. package/src/client/theme/ui/BackgroundGradient/BackgroundGradient.tsx +10 -0
  71. package/src/client/theme/ui/BackgroundGradient/index.ts +1 -0
  72. package/src/client/theme/ui/Breadcrumbs/Breadcrumbs.tsx +68 -0
  73. package/src/client/theme/ui/Breadcrumbs/index.ts +1 -0
  74. package/src/client/theme/ui/Footer/footer.css +32 -0
  75. package/src/client/theme/ui/Head/Head.tsx +69 -0
  76. package/src/client/theme/ui/Head/index.ts +1 -0
  77. package/src/client/theme/ui/LanguageSwitcher/LanguageSwitcher.tsx +125 -0
  78. package/src/client/theme/ui/LanguageSwitcher/index.ts +1 -0
  79. package/src/client/theme/ui/LanguageSwitcher/language-switcher.css +98 -0
  80. package/src/client/theme/ui/Layout/Layout.tsx +213 -0
  81. package/src/client/theme/ui/Layout/base.css +76 -0
  82. package/src/client/theme/ui/Layout/index.ts +2 -0
  83. package/src/client/theme/ui/Layout/pagination.css +72 -0
  84. package/src/client/theme/ui/Layout/responsive.css +40 -0
  85. package/src/client/theme/ui/Link/Link.tsx +202 -0
  86. package/src/client/theme/ui/Link/index.ts +2 -0
  87. package/src/client/theme/ui/Loading/Loading.tsx +10 -0
  88. package/src/client/theme/ui/Loading/index.ts +1 -0
  89. package/src/client/theme/ui/Loading/loading.css +30 -0
  90. package/src/client/theme/ui/Navbar/GithubStars.tsx +27 -0
  91. package/src/client/theme/ui/Navbar/Navbar.tsx +145 -0
  92. package/src/client/theme/ui/Navbar/index.ts +2 -0
  93. package/src/client/theme/ui/Navbar/navbar.css +233 -0
  94. package/src/client/theme/ui/NotFound/NotFound.tsx +20 -0
  95. package/src/client/theme/ui/NotFound/index.ts +1 -0
  96. package/src/client/theme/ui/NotFound/not-found.css +64 -0
  97. package/src/client/theme/ui/OnThisPage/OnThisPage.tsx +192 -0
  98. package/src/client/theme/ui/OnThisPage/index.ts +1 -0
  99. package/src/client/theme/ui/OnThisPage/toc.css +132 -0
  100. package/src/client/theme/ui/PoweredBy/PoweredBy.tsx +18 -0
  101. package/src/client/theme/ui/PoweredBy/index.ts +1 -0
  102. package/src/client/theme/ui/PoweredBy/powered-by.css +76 -0
  103. package/src/client/theme/ui/SearchDialog/SearchDialog.tsx +199 -0
  104. package/src/client/theme/ui/SearchDialog/index.ts +1 -0
  105. package/src/client/theme/ui/SearchDialog/search.css +152 -0
  106. package/src/client/theme/ui/Sidebar/Sidebar.tsx +200 -0
  107. package/src/client/theme/ui/Sidebar/index.ts +1 -0
  108. package/src/client/theme/ui/Sidebar/sidebar.css +269 -0
  109. package/src/client/theme/ui/ThemeToggle/ThemeToggle.tsx +69 -0
  110. package/src/client/theme/ui/ThemeToggle/index.ts +1 -0
  111. package/src/client/theme/ui/VersionSwitcher/VersionSwitcher.tsx +136 -0
  112. package/src/client/theme/ui/VersionSwitcher/index.ts +1 -0
  113. package/src/client/utils.ts +26 -0
  114. package/src/node/cache.ts +94 -0
  115. package/src/node/cli/commands/config.ts +15 -0
  116. package/src/node/cli/commands/generate-css.ts +24 -0
  117. package/src/node/cli/constants.ts +70 -0
  118. package/src/node/cli/index.ts +22 -0
  119. package/src/node/config.ts +185 -0
  120. package/src/node/index.ts +21 -0
  121. package/src/node/mdx.ts +41 -0
  122. package/src/node/plugin/entry.ts +58 -0
  123. package/src/node/plugin/html.ts +55 -0
  124. package/src/node/plugin/index.ts +190 -0
  125. package/src/node/plugin/types.ts +11 -0
  126. package/src/node/routes/cache.ts +24 -0
  127. package/src/node/routes/index.ts +152 -0
  128. package/src/node/routes/parser.ts +127 -0
  129. package/src/node/routes/sorter.ts +42 -0
  130. package/src/node/routes/types.ts +49 -0
  131. package/src/node/ssg/index.ts +110 -0
  132. package/src/node/ssg/meta.ts +34 -0
  133. package/src/node/ssg/options.ts +13 -0
  134. package/src/node/ssg/sitemap.ts +54 -0
  135. package/src/node/utils.ts +134 -0
  136. package/tsconfig.json +20 -0
  137. package/tsup.config.ts +22 -0
@@ -0,0 +1,32 @@
1
+ import {
2
+ AppShell
3
+ } from "../chunk-ZFCOLEXN.mjs";
4
+ import "../chunk-X6BYQHVC.mjs";
5
+
6
+ // src/client/ssr.tsx
7
+ import React from "react";
8
+ import ReactDOMServer from "react-dom/server";
9
+ import { StaticRouter } from "react-router-dom/server";
10
+ import { jsx } from "react/jsx-runtime";
11
+ async function render(options) {
12
+ const { path, routes, config, modules, homePage } = options;
13
+ const resolvedModules = {};
14
+ for (const [key, mod] of Object.entries(modules)) {
15
+ resolvedModules[key] = () => Promise.resolve(mod);
16
+ }
17
+ const html = ReactDOMServer.renderToString(
18
+ /* @__PURE__ */ jsx(React.StrictMode, { children: /* @__PURE__ */ jsx(StaticRouter, { location: path, children: /* @__PURE__ */ jsx(
19
+ AppShell,
20
+ {
21
+ initialRoutes: routes,
22
+ initialConfig: config,
23
+ modules: resolvedModules,
24
+ homePage
25
+ }
26
+ ) }) })
27
+ );
28
+ return html;
29
+ }
30
+ export {
31
+ render
32
+ };
@@ -0,0 +1,122 @@
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', 'twitter') */
8
+ icon: "discord" | "x" | 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 */
28
+ logo?: string;
29
+ /** Items to display in the top navigation bar */
30
+ navbar?: Array<{
31
+ text: string;
32
+ link: string;
33
+ }>;
34
+ /** Items to display in the sidebar, organized optionally by group URLs */
35
+ sidebar?: Record<string, Array<{
36
+ text: string;
37
+ link: string;
38
+ }>>;
39
+ /** Social links to display in the navigation bar */
40
+ socialLinks?: BoltdocsSocialLink[];
41
+ /** Site footer configuration */
42
+ footer?: BoltdocsFooterConfig;
43
+ /** Whether to show breadcrumbs navigation (default: true) */
44
+ breadcrumbs?: boolean;
45
+ /** Path to a custom CSS file that overrides theme variables */
46
+ customCss?: string;
47
+ /** URL template for 'Edit this page'. Use :path as a placeholder. */
48
+ editLink?: string;
49
+ /** URL for the 'Community help' link. */
50
+ communityHelp?: string;
51
+ /** The current version of the project (e.g., 'v2.8.9'). Displayed in the Navbar. */
52
+ version?: string;
53
+ /** The GitHub repository in the format 'owner/repo' to fetch and display star count. */
54
+ githubRepo?: string;
55
+ /** Whether to show the 'Powered by LiteDocs' badge in the sidebar (default: true) */
56
+ poweredBy?: boolean;
57
+ /** Granular layout customization props */
58
+ layoutProps?: {
59
+ navbar?: any;
60
+ sidebar?: any;
61
+ toc?: any;
62
+ background?: any;
63
+ head?: any;
64
+ breadcrumbs?: any;
65
+ className?: string;
66
+ style?: any;
67
+ };
68
+ }
69
+ /**
70
+ * Configuration for internationalization (i18n).
71
+ */
72
+ interface BoltdocsI18nConfig {
73
+ /** The default locale (e.g., 'en') */
74
+ defaultLocale: string;
75
+ /** Available locales and their display names (e.g., { en: 'English', es: 'Español' }) */
76
+ locales: Record<string, string>;
77
+ }
78
+ /**
79
+ * Configuration for documentation versioning.
80
+ */
81
+ interface BoltdocsVersionsConfig {
82
+ /** The default version (e.g., 'v2') */
83
+ defaultVersion: string;
84
+ /** Available versions and their display names (e.g., { v1: 'Version 1.x', v2: 'Version 2.x' }) */
85
+ versions: Record<string, string>;
86
+ }
87
+ /**
88
+ * Defines a Boltdocs plugin that can extend the build process and client-side functionality.
89
+ */
90
+ interface BoltdocsPlugin {
91
+ /** A unique name for the plugin */
92
+ name: string;
93
+ /** Whether to run this plugin before or after default ones (optional) */
94
+ enforce?: "pre" | "post";
95
+ /** Optional remark plugins to add to the MDX pipeline */
96
+ remarkPlugins?: any[];
97
+ /** Optional rehype plugins to add to the MDX pipeline */
98
+ rehypePlugins?: any[];
99
+ /** Optional Vite plugins to inject into the build process */
100
+ vitePlugins?: Plugin[];
101
+ /** Optional custom React components to register in MDX. Map of Name -> Module Path. */
102
+ components?: Record<string, string>;
103
+ }
104
+ /**
105
+ * The root configuration object for Boltdocs.
106
+ */
107
+ interface BoltdocsConfig {
108
+ /** The base URL of the site, used for generating the sitemap */
109
+ siteUrl?: string;
110
+ /** Configuration pertaining to the UI and appearance */
111
+ themeConfig?: BoltdocsThemeConfig;
112
+ /** The root directory containing markdown documentation files (default: 'docs') */
113
+ docsDir?: string;
114
+ /** Configuration for internationalization */
115
+ i18n?: BoltdocsI18nConfig;
116
+ /** Configuration for documentation versioning */
117
+ versions?: BoltdocsVersionsConfig;
118
+ /** Custom plugins for extending functionality */
119
+ plugins?: BoltdocsPlugin[];
120
+ }
121
+
122
+ export type { BoltdocsConfig as B, BoltdocsThemeConfig as a };
@@ -0,0 +1,122 @@
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', 'twitter') */
8
+ icon: "discord" | "x" | 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 */
28
+ logo?: string;
29
+ /** Items to display in the top navigation bar */
30
+ navbar?: Array<{
31
+ text: string;
32
+ link: string;
33
+ }>;
34
+ /** Items to display in the sidebar, organized optionally by group URLs */
35
+ sidebar?: Record<string, Array<{
36
+ text: string;
37
+ link: string;
38
+ }>>;
39
+ /** Social links to display in the navigation bar */
40
+ socialLinks?: BoltdocsSocialLink[];
41
+ /** Site footer configuration */
42
+ footer?: BoltdocsFooterConfig;
43
+ /** Whether to show breadcrumbs navigation (default: true) */
44
+ breadcrumbs?: boolean;
45
+ /** Path to a custom CSS file that overrides theme variables */
46
+ customCss?: string;
47
+ /** URL template for 'Edit this page'. Use :path as a placeholder. */
48
+ editLink?: string;
49
+ /** URL for the 'Community help' link. */
50
+ communityHelp?: string;
51
+ /** The current version of the project (e.g., 'v2.8.9'). Displayed in the Navbar. */
52
+ version?: string;
53
+ /** The GitHub repository in the format 'owner/repo' to fetch and display star count. */
54
+ githubRepo?: string;
55
+ /** Whether to show the 'Powered by LiteDocs' badge in the sidebar (default: true) */
56
+ poweredBy?: boolean;
57
+ /** Granular layout customization props */
58
+ layoutProps?: {
59
+ navbar?: any;
60
+ sidebar?: any;
61
+ toc?: any;
62
+ background?: any;
63
+ head?: any;
64
+ breadcrumbs?: any;
65
+ className?: string;
66
+ style?: any;
67
+ };
68
+ }
69
+ /**
70
+ * Configuration for internationalization (i18n).
71
+ */
72
+ interface BoltdocsI18nConfig {
73
+ /** The default locale (e.g., 'en') */
74
+ defaultLocale: string;
75
+ /** Available locales and their display names (e.g., { en: 'English', es: 'Español' }) */
76
+ locales: Record<string, string>;
77
+ }
78
+ /**
79
+ * Configuration for documentation versioning.
80
+ */
81
+ interface BoltdocsVersionsConfig {
82
+ /** The default version (e.g., 'v2') */
83
+ defaultVersion: string;
84
+ /** Available versions and their display names (e.g., { v1: 'Version 1.x', v2: 'Version 2.x' }) */
85
+ versions: Record<string, string>;
86
+ }
87
+ /**
88
+ * Defines a Boltdocs plugin that can extend the build process and client-side functionality.
89
+ */
90
+ interface BoltdocsPlugin {
91
+ /** A unique name for the plugin */
92
+ name: string;
93
+ /** Whether to run this plugin before or after default ones (optional) */
94
+ enforce?: "pre" | "post";
95
+ /** Optional remark plugins to add to the MDX pipeline */
96
+ remarkPlugins?: any[];
97
+ /** Optional rehype plugins to add to the MDX pipeline */
98
+ rehypePlugins?: any[];
99
+ /** Optional Vite plugins to inject into the build process */
100
+ vitePlugins?: Plugin[];
101
+ /** Optional custom React components to register in MDX. Map of Name -> Module Path. */
102
+ components?: Record<string, string>;
103
+ }
104
+ /**
105
+ * The root configuration object for Boltdocs.
106
+ */
107
+ interface BoltdocsConfig {
108
+ /** The base URL of the site, used for generating the sitemap */
109
+ siteUrl?: string;
110
+ /** Configuration pertaining to the UI and appearance */
111
+ themeConfig?: BoltdocsThemeConfig;
112
+ /** The root directory containing markdown documentation files (default: 'docs') */
113
+ docsDir?: string;
114
+ /** Configuration for internationalization */
115
+ i18n?: BoltdocsI18nConfig;
116
+ /** Configuration for documentation versioning */
117
+ versions?: BoltdocsVersionsConfig;
118
+ /** Custom plugins for extending functionality */
119
+ plugins?: BoltdocsPlugin[];
120
+ }
121
+
122
+ export type { BoltdocsConfig as B, BoltdocsThemeConfig as a };
@@ -0,0 +1,82 @@
1
+ import React from 'react';
2
+
3
+ declare global {
4
+ interface ImportMeta {
5
+ env: Record<string, any>;
6
+ }
7
+ }
8
+ /**
9
+ * Metadata provided by the server for a specific route.
10
+ * Maps closely to the `RouteMeta` type in the Node environment.
11
+ */
12
+ interface ComponentRoute {
13
+ /** The final URL path */
14
+ path: string;
15
+ /** The absolute filesystem path of the source file */
16
+ componentPath: string;
17
+ /** The page title */
18
+ title: string;
19
+ /** Explicit order in the sidebar */
20
+ sidebarPosition?: number;
21
+ /** The relative path from the docs directory */
22
+ filePath: string;
23
+ /** The group directory name */
24
+ group?: string;
25
+ /** The display title of the group */
26
+ groupTitle?: string;
27
+ /** Explicit order of the group in the sidebar */
28
+ groupPosition?: number;
29
+ /** Extracted markdown headings for search indexing */
30
+ headings?: {
31
+ level: number;
32
+ text: string;
33
+ id: string;
34
+ }[];
35
+ /** The locale this route belongs to, if i18n is configured */
36
+ locale?: string;
37
+ /** The version this route belongs to, if versioning is configured */
38
+ version?: string;
39
+ }
40
+ /**
41
+ * Configuration options for initializing the Boltdocs client app.
42
+ */
43
+ interface CreateBoltdocsAppOptions {
44
+ /** CSS selector for the DOM element where the app should mount (e.g. '#root') */
45
+ target: string;
46
+ /** Initial routes generated by the Vite plugin (`virtual:boltdocs-routes`) */
47
+ routes: ComponentRoute[];
48
+ /** Site configuration (`virtual:boltdocs-config`) */
49
+ config: any;
50
+ /** Dynamic import mapping from `import.meta.glob` for the documentation pages */
51
+ modules: Record<string, () => Promise<any>>;
52
+ /** The `import.meta.hot` instance necessary for fast refresh/HMR updates */
53
+ hot?: any;
54
+ /** Optional custom React component to render when visiting the root path ('/') */
55
+ homePage?: React.ComponentType;
56
+ /** Optional custom MDX components provided by plugins */
57
+ components?: Record<string, React.ComponentType<any>>;
58
+ }
59
+ /**
60
+ * Creates and mounts the Boltdocs documentation app.
61
+ *
62
+ * Usage:
63
+ * ```tsx
64
+ * import { createBoltdocsApp } from 'boltdocs/client'
65
+ * import routes from 'virtual:boltdocs-routes'
66
+ * import config from 'virtual:boltdocs-config'
67
+ * import 'boltdocs/style.css'
68
+ * import HomePage from './HomePage'
69
+ *
70
+ * createBoltdocsApp({
71
+ * target: '#root',
72
+ * routes,
73
+ * config,
74
+ * modules: import.meta.glob('/docs/**\/*.{md,mdx}'),
75
+ * hot: import.meta.hot,
76
+ * homePage: HomePage,
77
+ * })
78
+ * ```
79
+ */
80
+ declare function createBoltdocsApp(options: CreateBoltdocsAppOptions): void;
81
+
82
+ export { type ComponentRoute as C, type CreateBoltdocsAppOptions as a, createBoltdocsApp as c };
@@ -0,0 +1,82 @@
1
+ import React from 'react';
2
+
3
+ declare global {
4
+ interface ImportMeta {
5
+ env: Record<string, any>;
6
+ }
7
+ }
8
+ /**
9
+ * Metadata provided by the server for a specific route.
10
+ * Maps closely to the `RouteMeta` type in the Node environment.
11
+ */
12
+ interface ComponentRoute {
13
+ /** The final URL path */
14
+ path: string;
15
+ /** The absolute filesystem path of the source file */
16
+ componentPath: string;
17
+ /** The page title */
18
+ title: string;
19
+ /** Explicit order in the sidebar */
20
+ sidebarPosition?: number;
21
+ /** The relative path from the docs directory */
22
+ filePath: string;
23
+ /** The group directory name */
24
+ group?: string;
25
+ /** The display title of the group */
26
+ groupTitle?: string;
27
+ /** Explicit order of the group in the sidebar */
28
+ groupPosition?: number;
29
+ /** Extracted markdown headings for search indexing */
30
+ headings?: {
31
+ level: number;
32
+ text: string;
33
+ id: string;
34
+ }[];
35
+ /** The locale this route belongs to, if i18n is configured */
36
+ locale?: string;
37
+ /** The version this route belongs to, if versioning is configured */
38
+ version?: string;
39
+ }
40
+ /**
41
+ * Configuration options for initializing the Boltdocs client app.
42
+ */
43
+ interface CreateBoltdocsAppOptions {
44
+ /** CSS selector for the DOM element where the app should mount (e.g. '#root') */
45
+ target: string;
46
+ /** Initial routes generated by the Vite plugin (`virtual:boltdocs-routes`) */
47
+ routes: ComponentRoute[];
48
+ /** Site configuration (`virtual:boltdocs-config`) */
49
+ config: any;
50
+ /** Dynamic import mapping from `import.meta.glob` for the documentation pages */
51
+ modules: Record<string, () => Promise<any>>;
52
+ /** The `import.meta.hot` instance necessary for fast refresh/HMR updates */
53
+ hot?: any;
54
+ /** Optional custom React component to render when visiting the root path ('/') */
55
+ homePage?: React.ComponentType;
56
+ /** Optional custom MDX components provided by plugins */
57
+ components?: Record<string, React.ComponentType<any>>;
58
+ }
59
+ /**
60
+ * Creates and mounts the Boltdocs documentation app.
61
+ *
62
+ * Usage:
63
+ * ```tsx
64
+ * import { createBoltdocsApp } from 'boltdocs/client'
65
+ * import routes from 'virtual:boltdocs-routes'
66
+ * import config from 'virtual:boltdocs-config'
67
+ * import 'boltdocs/style.css'
68
+ * import HomePage from './HomePage'
69
+ *
70
+ * createBoltdocsApp({
71
+ * target: '#root',
72
+ * routes,
73
+ * config,
74
+ * modules: import.meta.glob('/docs/**\/*.{md,mdx}'),
75
+ * hot: import.meta.hot,
76
+ * homePage: HomePage,
77
+ * })
78
+ * ```
79
+ */
80
+ declare function createBoltdocsApp(options: CreateBoltdocsAppOptions): void;
81
+
82
+ export { type ComponentRoute as C, type CreateBoltdocsAppOptions as a, createBoltdocsApp as c };
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
@@ -0,0 +1,199 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
+ // If the importer is in node compatibility mode or this is not an ESM
19
+ // file that has been converted to a CommonJS file using a Babel-
20
+ // compatible transform (i.e. "__esModule" has not been set), then set
21
+ // "default" to the CommonJS "module.exports" for node compatibility.
22
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
+ mod
24
+ ));
25
+
26
+ // src/node/cli/index.ts
27
+ var import_cac = __toESM(require("cac"));
28
+
29
+ // src/node/cli/commands/config.ts
30
+ var import_path2 = __toESM(require("path"));
31
+
32
+ // src/node/config.ts
33
+ var import_path = __toESM(require("path"));
34
+ var import_url = require("url");
35
+ var import_fs = __toESM(require("fs"));
36
+ var CONFIG_FILES = [
37
+ "boltdocs.config.js",
38
+ "boltdocs.config.mjs",
39
+ "boltdocs.config.ts"
40
+ ];
41
+ async function resolveConfig(docsDir) {
42
+ const projectRoot = process.cwd();
43
+ const defaults = {
44
+ docsDir: import_path.default.resolve(docsDir),
45
+ themeConfig: {
46
+ title: "Boltdocs",
47
+ description: "A Vite documentation framework",
48
+ navbar: [
49
+ { text: "Home", link: "/" },
50
+ { text: "Documentation", link: "/docs" }
51
+ ]
52
+ }
53
+ };
54
+ for (const filename of CONFIG_FILES) {
55
+ const configPath = import_path.default.resolve(projectRoot, filename);
56
+ if (import_fs.default.existsSync(configPath)) {
57
+ try {
58
+ const fileUrl = (0, import_url.pathToFileURL)(configPath).href + "?t=" + Date.now();
59
+ const mod = await import(fileUrl);
60
+ const userConfig = mod.default || mod;
61
+ const userThemeConfig = userConfig.themeConfig || userConfig;
62
+ return {
63
+ docsDir: import_path.default.resolve(docsDir),
64
+ themeConfig: {
65
+ ...defaults.themeConfig,
66
+ ...userThemeConfig
67
+ },
68
+ i18n: userConfig.i18n,
69
+ versions: userConfig.versions,
70
+ siteUrl: userConfig.siteUrl,
71
+ plugins: userConfig.plugins || []
72
+ };
73
+ } catch (e) {
74
+ console.warn(`[boltdocs] Failed to load config from ${filename}:`, e);
75
+ }
76
+ }
77
+ }
78
+ return defaults;
79
+ }
80
+
81
+ // src/node/cli/commands/config.ts
82
+ async function configAction(root) {
83
+ const rootDir = root ? import_path2.default.resolve(root) : process.cwd();
84
+ const docsDir = import_path2.default.resolve(rootDir, "docs");
85
+ try {
86
+ const config = await resolveConfig(docsDir);
87
+ process.stdout.write(JSON.stringify(config, null, 2) + "\n");
88
+ } catch (e) {
89
+ process.stderr.write("Failed to resolve configuration: " + e + "\n");
90
+ process.exit(1);
91
+ }
92
+ }
93
+
94
+ // src/node/cli/commands/generate-css.ts
95
+ var import_path3 = __toESM(require("path"));
96
+ var import_node_fs = __toESM(require("fs"));
97
+
98
+ // src/node/cli/constants.ts
99
+ var DEFAULT_CSS_VARIABLES = `:root {
100
+ /* \u2500 Base palette \u2500 */
101
+ --ld-bg-main: #0a0a0f;
102
+ --ld-bg-soft: #0f0f18;
103
+ --ld-bg-mute: #141420;
104
+ --ld-surface: #1a1a2e;
105
+ --ld-border-subtle: rgba(255, 255, 255, 0.06);
106
+ --ld-border-strong: rgba(255, 255, 255, 0.12);
107
+
108
+ /* \u2500 Text \u2500 */
109
+ --ld-text-main: #e4e4ed;
110
+ --ld-text-muted: #9d9db5;
111
+ --ld-text-dim: #6b6b85;
112
+
113
+ /* \u2500 Accent \u2500 */
114
+ --ld-color-primary: #ffff;
115
+ --ld-color-primary-hover: #f8f8f8;
116
+ --ld-color-primary-muted: rgba(255, 255, 255, 0.05);
117
+ --ld-color-primary-glow: rgba(255, 255, 255, 0.15);
118
+ --ld-color-primary-text: #010101;
119
+ --ld-color-accent: #ffff; /* Yellow accent for TOC */
120
+
121
+ /* \u2500 Code \u2500 */
122
+ --ld-code-bg: #0d0d14;
123
+ --ld-code-header: #111119;
124
+ --ld-code-text: #d4d4d4;
125
+
126
+ /* \u2500 Typography \u2500 */
127
+ --ld-font-sans: "Inter", system-ui, -apple-system, sans-serif;
128
+ --ld-font-mono:
129
+ "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
130
+ monospace;
131
+
132
+ /* \u2500 Dimensions \u2500 */
133
+ --ld-navbar-height: 3.5rem;
134
+ --ld-sidebar-width: 14.5rem;
135
+ --ld-toc-width: 13rem;
136
+ --ld-content-max-width: 820px;
137
+ --ld-radius-sm: 4px;
138
+ --ld-radius-md: 8px;
139
+ --ld-radius-lg: 12px;
140
+ --ld-radius-full: 9999px;
141
+ }
142
+
143
+ [data-theme="light"],
144
+ .theme-light {
145
+ --ld-bg-main: #ffffff;
146
+ --ld-bg-soft: #f9fafb;
147
+ --ld-bg-mute: #f3f4f6;
148
+
149
+ --ld-surface: #ffffff;
150
+
151
+ --ld-border-subtle: #e5e7eb;
152
+ --ld-border-strong: #d1d5db;
153
+
154
+ --ld-text-main: #111827;
155
+ --ld-text-muted: #4b5563;
156
+ --ld-text-dim: #6b7280;
157
+
158
+ --ld-color-primary: #010101;
159
+ --ld-color-primary-hover: #010101;
160
+ --ld-color-primary-muted: rgba(127, 19, 236, 0.1);
161
+ --ld-color-primary-glow: rgba(127, 19, 236, 0.25);
162
+ --ld-color-primary-text: #010101;
163
+
164
+ --ld-code-bg: #f3f4f6;
165
+ --ld-code-header: #e5e7eb;
166
+ --ld-code-text: #1f2937;
167
+ }
168
+ `;
169
+
170
+ // src/node/cli/commands/generate-css.ts
171
+ function generateCssAction(outputPath) {
172
+ try {
173
+ const target = process.cwd();
174
+ const filename = outputPath || "custom.css";
175
+ const filepath = import_path3.default.resolve(target, filename);
176
+ if (import_node_fs.default.existsSync(filepath)) {
177
+ process.stderr.write(
178
+ "Error: File " + filename + " already exists in " + target + ".\n"
179
+ );
180
+ process.exit(1);
181
+ }
182
+ import_node_fs.default.writeFileSync(filepath, DEFAULT_CSS_VARIABLES);
183
+ process.stdout.write("Success! Generated " + filename + "\n");
184
+ } catch (e) {
185
+ process.stderr.write("Failed to generate CSS: " + e + "\n");
186
+ process.exit(1);
187
+ }
188
+ }
189
+
190
+ // src/node/cli/index.ts
191
+ var cli = (0, import_cac.default)("boltdocs");
192
+ cli.command("config [root]", "Output the resolved boltdocs configuration").action(configAction);
193
+ cli.command(
194
+ "generate:css [path]",
195
+ "Generate a custom.css file with default Boltdocs CSS variables"
196
+ ).action(generateCssAction);
197
+ cli.help();
198
+ cli.version("1.0.0");
199
+ cli.parse();