boltdocs 2.0.0 → 2.1.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 (67) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/bin/boltdocs.js +12 -0
  3. package/dist/cache-Q4T6VAUL.mjs +1 -0
  4. package/dist/chunk-52MVMZWS.mjs +1 -0
  5. package/dist/chunk-BVWWKXJH.mjs +1 -0
  6. package/dist/chunk-DVY3RDXD.mjs +1 -0
  7. package/dist/chunk-FUVYCYWC.mjs +1 -0
  8. package/dist/{chunk-BA5NH5HU.mjs → chunk-GBLMDJ2B.mjs} +1 -1
  9. package/dist/{chunk-H63UMKYF.mjs → chunk-ISPX45DF.mjs} +1 -1
  10. package/dist/chunk-PNXZMUCO.mjs +1 -0
  11. package/dist/chunk-V2ZHKQSP.mjs +74 -0
  12. package/dist/client/components/mdx/index.d.mts +2 -3
  13. package/dist/client/components/mdx/index.d.ts +2 -3
  14. package/dist/client/components/mdx/index.js +1 -1
  15. package/dist/client/components/mdx/index.mjs +1 -1
  16. package/dist/client/hooks/index.d.mts +2 -3
  17. package/dist/client/hooks/index.d.ts +2 -3
  18. package/dist/client/hooks/index.js +1 -1
  19. package/dist/client/hooks/index.mjs +1 -1
  20. package/dist/client/index.d.mts +3 -5
  21. package/dist/client/index.d.ts +3 -5
  22. package/dist/client/index.js +1 -1
  23. package/dist/client/index.mjs +1 -1
  24. package/dist/client/ssr.d.mts +53 -6
  25. package/dist/client/ssr.d.ts +53 -6
  26. package/dist/client/ssr.mjs +1 -1
  27. package/dist/node/cli-entry.d.mts +1 -0
  28. package/dist/node/cli-entry.d.ts +1 -0
  29. package/dist/node/cli-entry.js +75 -0
  30. package/dist/node/cli-entry.mjs +2 -0
  31. package/dist/node/index.d.mts +213 -4
  32. package/dist/node/index.d.ts +213 -4
  33. package/dist/node/index.js +40 -23
  34. package/dist/node/index.mjs +1 -57
  35. package/dist/search-dialog-TWGYKF2D.mjs +1 -0
  36. package/dist/types-Cp21DHI6.d.mts +355 -0
  37. package/dist/types-Cp21DHI6.d.ts +355 -0
  38. package/dist/{use-routes-BefRXY3v.d.ts → use-routes-8Iei6jTp.d.mts} +1 -2
  39. package/dist/{use-routes-5bAtAAYX.d.mts → use-routes-xLhumjbV.d.ts} +1 -2
  40. package/package.json +7 -1
  41. package/src/client/components/ui-base/breadcrumbs.tsx +2 -1
  42. package/src/client/components/ui-base/navbar.tsx +3 -3
  43. package/src/client/components/ui-base/sidebar.tsx +2 -1
  44. package/src/client/hooks/use-navbar.ts +1 -1
  45. package/src/node/cli-entry.ts +24 -0
  46. package/src/node/cli.ts +59 -0
  47. package/src/node/config.ts +63 -11
  48. package/src/node/index.ts +39 -3
  49. package/src/node/plugin/entry.ts +7 -0
  50. package/src/node/plugin/html.ts +49 -9
  51. package/src/node/plugin/index.ts +42 -3
  52. package/src/node/ssg/index.ts +6 -1
  53. package/src/node/ssg/robots.ts +50 -0
  54. package/tsup.config.ts +36 -10
  55. package/dist/cache-7G6D532T.mjs +0 -1
  56. package/dist/chunk-A4HQPEPU.mjs +0 -1
  57. package/dist/chunk-BQCD3DWG.mjs +0 -1
  58. package/dist/chunk-IWHRQHS7.mjs +0 -1
  59. package/dist/chunk-JZXLCA2E.mjs +0 -1
  60. package/dist/chunk-MFU7Q6WF.mjs +0 -1
  61. package/dist/chunk-QYPNX5UN.mjs +0 -1
  62. package/dist/chunk-XEAPSFMB.mjs +0 -1
  63. package/dist/config-CX4l-ZNp.d.mts +0 -166
  64. package/dist/config-CX4l-ZNp.d.ts +0 -166
  65. package/dist/search-dialog-EB3N4TYM.mjs +0 -1
  66. package/dist/types-BuZWFT7r.d.ts +0 -159
  67. package/dist/types-CvT-SGbK.d.mts +0 -159
@@ -1,6 +1,210 @@
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';
1
+ import * as vite from 'vite';
2
+ import { Plugin, InlineConfig } from 'vite';
3
+
4
+ /**
5
+ * Represents a single social link in the configuration.
6
+ */
7
+ interface BoltdocsSocialLink {
8
+ /** Identifier for the icon (e.g., 'github') */
9
+ icon: 'discord' | 'x' | 'github' | 'bluesky' | string;
10
+ /** The URL the social link points to */
11
+ link: string;
12
+ }
13
+ /**
14
+ * Configuration for the site footer.
15
+ */
16
+ interface BoltdocsFooterConfig {
17
+ /** Text to display in the footer (HTML is supported) */
18
+ text?: string;
19
+ }
20
+ /**
21
+ * Theme-specific configuration options governing the appearance and navigation of the site.
22
+ */
23
+ interface BoltdocsThemeConfig {
24
+ /** The global title of the documentation site */
25
+ title?: string;
26
+ /** The global description of the site (used for SEO) */
27
+ description?: string;
28
+ /** URL path to the site logo or an object for light/dark versions */
29
+ logo?: string | {
30
+ dark: string;
31
+ light: string;
32
+ alt?: string;
33
+ width?: number;
34
+ height?: number;
35
+ };
36
+ /** Items to display in the top navigation bar */
37
+ navbar?: Array<{
38
+ /** Text to display */
39
+ label: string;
40
+ /** URL path or external link */
41
+ href: string;
42
+ /** Nested items for NavigationMenu */
43
+ items?: Array<{
44
+ label: string;
45
+ href: string;
46
+ }>;
47
+ }>;
48
+ /** Items to display in the sidebar, organized optionally by group URLs */
49
+ sidebar?: Record<string, Array<{
50
+ text: string;
51
+ link: string;
52
+ }>>;
53
+ /** Social links to display in the navigation bar */
54
+ socialLinks?: BoltdocsSocialLink[];
55
+ /** Site footer configuration */
56
+ footer?: BoltdocsFooterConfig;
57
+ /** Whether to show breadcrumbs navigation (default: true) */
58
+ breadcrumbs?: boolean;
59
+ /** URL template for 'Edit this page'. Use :path as a placeholder. */
60
+ editLink?: string;
61
+ /** URL for the 'Community help' link. */
62
+ communityHelp?: string;
63
+ /** The current version of the project (e.g., 'v2.8.9'). Displayed in the Navbar. */
64
+ version?: string;
65
+ /** The GitHub repository in the format 'owner/repo' to fetch and display star count. */
66
+ githubRepo?: string;
67
+ /**
68
+ * URL path to the site favicon.
69
+ * If not specified, the logo will be used if available.
70
+ */
71
+ favicon?: string;
72
+ /**
73
+ * The Open Graph image URL to display when the site is shared on social media.
74
+ */
75
+ ogImage?: string;
76
+ /** Whether to show the 'Powered by LiteDocs' badge in the sidebar (default: true) */
77
+ poweredBy?: boolean;
78
+ /**
79
+ * Top-level tabs for organizing documentation groups.
80
+ * Tab discovery uses the (tab-id) directory syntax.
81
+ */
82
+ tabs?: Array<{
83
+ id: string;
84
+ text: string;
85
+ icon?: string;
86
+ }>;
87
+ /**
88
+ * The syntax highlighting theme for code blocks.
89
+ * Supports any Shiki theme name (e.g., 'github-dark', 'one-dark-pro', 'aurora-x').
90
+ * Can also be an object for multiple themes (e.g., { light: 'github-light', dark: 'github-dark' }).
91
+ * Default: { light: 'github-light', dark: 'one-dark-pro' }
92
+ */
93
+ codeTheme?: string | {
94
+ light: string;
95
+ dark: string;
96
+ };
97
+ /**
98
+ * Configuration for the 'Copy Markdown' button.
99
+ * Can be a boolean or an object with text and icon.
100
+ * Default: true
101
+ */
102
+ copyMarkdown?: boolean | {
103
+ text?: string;
104
+ icon?: string;
105
+ };
106
+ }
107
+ /**
108
+ * Configuration for the robots.txt file.
109
+ */
110
+ type BoltdocsRobotsConfig = string | {
111
+ /** User-agent rules */
112
+ rules?: Array<{
113
+ userAgent: string;
114
+ /** Paths allowed to be crawled */
115
+ allow?: string | string[];
116
+ /** Paths disallowed to be crawled */
117
+ disallow?: string | string[];
118
+ }>;
119
+ /** Sitemaps to include in the robots.txt */
120
+ sitemaps?: string[];
121
+ };
122
+ /**
123
+ * Configuration for internationalization (i18n).
124
+ */
125
+ interface BoltdocsI18nConfig {
126
+ /** The default locale (e.g., 'en') */
127
+ defaultLocale: string;
128
+ /** Available locales and their display names (e.g., { en: 'English', es: 'Español' }) */
129
+ locales: Record<string, string>;
130
+ }
131
+ /**
132
+ * Configuration for documentation versioning.
133
+ */
134
+ interface BoltdocsVersionsConfig {
135
+ /** The default version (e.g., 'v2') */
136
+ defaultVersion: string;
137
+ /** Available versions and their display names (e.g., { v1: 'Version 1.x', v2: 'Version 2.x' }) */
138
+ versions: Record<string, string>;
139
+ }
140
+ /**
141
+ * Defines a Boltdocs plugin that can extend the build process and client-side functionality.
142
+ */
143
+ interface BoltdocsPlugin {
144
+ /** A unique name for the plugin */
145
+ name: string;
146
+ /** Whether to run this plugin before or after default ones (optional) */
147
+ enforce?: 'pre' | 'post';
148
+ /** Optional remark plugins to add to the MDX pipeline */
149
+ remarkPlugins?: unknown[];
150
+ /** Optional rehype plugins to add to the MDX pipeline */
151
+ rehypePlugins?: unknown[];
152
+ /** Optional Vite plugins to inject into the build process */
153
+ vitePlugins?: Plugin[];
154
+ /** Optional custom React components to register in MDX. Map of Name -> Module Path. */
155
+ components?: Record<string, string>;
156
+ }
157
+ /**
158
+ * Configuration for external integrations (e.g., CodeSandbox).
159
+ */
160
+ interface BoltdocsIntegrationsConfig {
161
+ /** CodeSandbox integration settings */
162
+ sandbox?: {
163
+ /** Whether to enable the "Open in Sandbox" button in CodeBlocks */
164
+ enable?: boolean;
165
+ /** Default options for the sandbox (files, dependencies, etc.) */
166
+ config?: Record<string, unknown>;
167
+ };
168
+ }
169
+ /**
170
+ * The root configuration object for Boltdocs.
171
+ */
172
+ interface BoltdocsConfig {
173
+ /** The base URL of the site, used for generating the sitemap */
174
+ siteUrl?: string;
175
+ /** The root directory containing markdown documentation files (default: 'docs') */
176
+ docsDir?: string;
177
+ /** Path to a custom HomePage component */
178
+ homePage?: string;
179
+ /** Configuration pertaining to the UI and appearance */
180
+ theme?: BoltdocsThemeConfig;
181
+ /** Configuration for internationalization */
182
+ i18n?: BoltdocsI18nConfig;
183
+ /** Configuration for documentation versioning */
184
+ versions?: BoltdocsVersionsConfig;
185
+ /** Custom plugins for extending functionality */
186
+ plugins?: BoltdocsPlugin[];
187
+ /** Map of custom external route paths to component file paths */
188
+ external?: Record<string, string>;
189
+ /** External integrations configuration */
190
+ integrations?: BoltdocsIntegrationsConfig;
191
+ /** Configuration for the robots.txt file */
192
+ robots?: BoltdocsRobotsConfig;
193
+ /** Low-level Vite configuration overrides */
194
+ vite?: vite.InlineConfig;
195
+ /** @deprecated Use theme instead */
196
+ themeConfig?: BoltdocsThemeConfig;
197
+ }
198
+ declare function defineConfig(config: BoltdocsConfig): BoltdocsConfig;
199
+ /**
200
+ * Loads user's configuration file (e.g., `boltdocs.config.js` or `boltdocs.config.ts`) if it exists,
201
+ * merges it with the default configuration, and returns the final `BoltdocsConfig`.
202
+ *
203
+ * @param docsDir - The directory containing the documentation files
204
+ * @param root - The project root directory (defaults to process.cwd())
205
+ * @returns The merged configuration object
206
+ */
207
+ declare function resolveConfig(docsDir: string, root?: string): Promise<BoltdocsConfig>;
4
208
 
5
209
  /**
6
210
  * Configuration options specifically for the Boltdocs Vite plugin.
@@ -85,5 +289,10 @@ interface RouteMeta {
85
289
  }
86
290
 
87
291
  declare function boltdocs(options?: BoltdocsPluginOptions): Promise<Plugin[]>;
292
+ /**
293
+ * Generates the complete Vite configuration for a Boltdocs project.
294
+ * This is used by the Boltdocs CLI to run Vite without a user-defined vite.config.ts.
295
+ */
296
+ declare function createViteConfig(root: string, mode?: 'development' | 'production'): Promise<InlineConfig>;
88
297
 
89
- export { BoltdocsConfig, type BoltdocsPluginOptions, type RouteMeta, type SSGOptions, boltdocs as default, generateStaticPages };
298
+ export { type BoltdocsConfig, type BoltdocsPluginOptions, type BoltdocsThemeConfig, type RouteMeta, type SSGOptions, createViteConfig, boltdocs as default, defineConfig, generateStaticPages, resolveConfig };
@@ -1,6 +1,210 @@
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';
1
+ import * as vite from 'vite';
2
+ import { Plugin, InlineConfig } from 'vite';
3
+
4
+ /**
5
+ * Represents a single social link in the configuration.
6
+ */
7
+ interface BoltdocsSocialLink {
8
+ /** Identifier for the icon (e.g., 'github') */
9
+ icon: 'discord' | 'x' | 'github' | 'bluesky' | string;
10
+ /** The URL the social link points to */
11
+ link: string;
12
+ }
13
+ /**
14
+ * Configuration for the site footer.
15
+ */
16
+ interface BoltdocsFooterConfig {
17
+ /** Text to display in the footer (HTML is supported) */
18
+ text?: string;
19
+ }
20
+ /**
21
+ * Theme-specific configuration options governing the appearance and navigation of the site.
22
+ */
23
+ interface BoltdocsThemeConfig {
24
+ /** The global title of the documentation site */
25
+ title?: string;
26
+ /** The global description of the site (used for SEO) */
27
+ description?: string;
28
+ /** URL path to the site logo or an object for light/dark versions */
29
+ logo?: string | {
30
+ dark: string;
31
+ light: string;
32
+ alt?: string;
33
+ width?: number;
34
+ height?: number;
35
+ };
36
+ /** Items to display in the top navigation bar */
37
+ navbar?: Array<{
38
+ /** Text to display */
39
+ label: string;
40
+ /** URL path or external link */
41
+ href: string;
42
+ /** Nested items for NavigationMenu */
43
+ items?: Array<{
44
+ label: string;
45
+ href: string;
46
+ }>;
47
+ }>;
48
+ /** Items to display in the sidebar, organized optionally by group URLs */
49
+ sidebar?: Record<string, Array<{
50
+ text: string;
51
+ link: string;
52
+ }>>;
53
+ /** Social links to display in the navigation bar */
54
+ socialLinks?: BoltdocsSocialLink[];
55
+ /** Site footer configuration */
56
+ footer?: BoltdocsFooterConfig;
57
+ /** Whether to show breadcrumbs navigation (default: true) */
58
+ breadcrumbs?: boolean;
59
+ /** URL template for 'Edit this page'. Use :path as a placeholder. */
60
+ editLink?: string;
61
+ /** URL for the 'Community help' link. */
62
+ communityHelp?: string;
63
+ /** The current version of the project (e.g., 'v2.8.9'). Displayed in the Navbar. */
64
+ version?: string;
65
+ /** The GitHub repository in the format 'owner/repo' to fetch and display star count. */
66
+ githubRepo?: string;
67
+ /**
68
+ * URL path to the site favicon.
69
+ * If not specified, the logo will be used if available.
70
+ */
71
+ favicon?: string;
72
+ /**
73
+ * The Open Graph image URL to display when the site is shared on social media.
74
+ */
75
+ ogImage?: string;
76
+ /** Whether to show the 'Powered by LiteDocs' badge in the sidebar (default: true) */
77
+ poweredBy?: boolean;
78
+ /**
79
+ * Top-level tabs for organizing documentation groups.
80
+ * Tab discovery uses the (tab-id) directory syntax.
81
+ */
82
+ tabs?: Array<{
83
+ id: string;
84
+ text: string;
85
+ icon?: string;
86
+ }>;
87
+ /**
88
+ * The syntax highlighting theme for code blocks.
89
+ * Supports any Shiki theme name (e.g., 'github-dark', 'one-dark-pro', 'aurora-x').
90
+ * Can also be an object for multiple themes (e.g., { light: 'github-light', dark: 'github-dark' }).
91
+ * Default: { light: 'github-light', dark: 'one-dark-pro' }
92
+ */
93
+ codeTheme?: string | {
94
+ light: string;
95
+ dark: string;
96
+ };
97
+ /**
98
+ * Configuration for the 'Copy Markdown' button.
99
+ * Can be a boolean or an object with text and icon.
100
+ * Default: true
101
+ */
102
+ copyMarkdown?: boolean | {
103
+ text?: string;
104
+ icon?: string;
105
+ };
106
+ }
107
+ /**
108
+ * Configuration for the robots.txt file.
109
+ */
110
+ type BoltdocsRobotsConfig = string | {
111
+ /** User-agent rules */
112
+ rules?: Array<{
113
+ userAgent: string;
114
+ /** Paths allowed to be crawled */
115
+ allow?: string | string[];
116
+ /** Paths disallowed to be crawled */
117
+ disallow?: string | string[];
118
+ }>;
119
+ /** Sitemaps to include in the robots.txt */
120
+ sitemaps?: string[];
121
+ };
122
+ /**
123
+ * Configuration for internationalization (i18n).
124
+ */
125
+ interface BoltdocsI18nConfig {
126
+ /** The default locale (e.g., 'en') */
127
+ defaultLocale: string;
128
+ /** Available locales and their display names (e.g., { en: 'English', es: 'Español' }) */
129
+ locales: Record<string, string>;
130
+ }
131
+ /**
132
+ * Configuration for documentation versioning.
133
+ */
134
+ interface BoltdocsVersionsConfig {
135
+ /** The default version (e.g., 'v2') */
136
+ defaultVersion: string;
137
+ /** Available versions and their display names (e.g., { v1: 'Version 1.x', v2: 'Version 2.x' }) */
138
+ versions: Record<string, string>;
139
+ }
140
+ /**
141
+ * Defines a Boltdocs plugin that can extend the build process and client-side functionality.
142
+ */
143
+ interface BoltdocsPlugin {
144
+ /** A unique name for the plugin */
145
+ name: string;
146
+ /** Whether to run this plugin before or after default ones (optional) */
147
+ enforce?: 'pre' | 'post';
148
+ /** Optional remark plugins to add to the MDX pipeline */
149
+ remarkPlugins?: unknown[];
150
+ /** Optional rehype plugins to add to the MDX pipeline */
151
+ rehypePlugins?: unknown[];
152
+ /** Optional Vite plugins to inject into the build process */
153
+ vitePlugins?: Plugin[];
154
+ /** Optional custom React components to register in MDX. Map of Name -> Module Path. */
155
+ components?: Record<string, string>;
156
+ }
157
+ /**
158
+ * Configuration for external integrations (e.g., CodeSandbox).
159
+ */
160
+ interface BoltdocsIntegrationsConfig {
161
+ /** CodeSandbox integration settings */
162
+ sandbox?: {
163
+ /** Whether to enable the "Open in Sandbox" button in CodeBlocks */
164
+ enable?: boolean;
165
+ /** Default options for the sandbox (files, dependencies, etc.) */
166
+ config?: Record<string, unknown>;
167
+ };
168
+ }
169
+ /**
170
+ * The root configuration object for Boltdocs.
171
+ */
172
+ interface BoltdocsConfig {
173
+ /** The base URL of the site, used for generating the sitemap */
174
+ siteUrl?: string;
175
+ /** The root directory containing markdown documentation files (default: 'docs') */
176
+ docsDir?: string;
177
+ /** Path to a custom HomePage component */
178
+ homePage?: string;
179
+ /** Configuration pertaining to the UI and appearance */
180
+ theme?: BoltdocsThemeConfig;
181
+ /** Configuration for internationalization */
182
+ i18n?: BoltdocsI18nConfig;
183
+ /** Configuration for documentation versioning */
184
+ versions?: BoltdocsVersionsConfig;
185
+ /** Custom plugins for extending functionality */
186
+ plugins?: BoltdocsPlugin[];
187
+ /** Map of custom external route paths to component file paths */
188
+ external?: Record<string, string>;
189
+ /** External integrations configuration */
190
+ integrations?: BoltdocsIntegrationsConfig;
191
+ /** Configuration for the robots.txt file */
192
+ robots?: BoltdocsRobotsConfig;
193
+ /** Low-level Vite configuration overrides */
194
+ vite?: vite.InlineConfig;
195
+ /** @deprecated Use theme instead */
196
+ themeConfig?: BoltdocsThemeConfig;
197
+ }
198
+ declare function defineConfig(config: BoltdocsConfig): BoltdocsConfig;
199
+ /**
200
+ * Loads user's configuration file (e.g., `boltdocs.config.js` or `boltdocs.config.ts`) if it exists,
201
+ * merges it with the default configuration, and returns the final `BoltdocsConfig`.
202
+ *
203
+ * @param docsDir - The directory containing the documentation files
204
+ * @param root - The project root directory (defaults to process.cwd())
205
+ * @returns The merged configuration object
206
+ */
207
+ declare function resolveConfig(docsDir: string, root?: string): Promise<BoltdocsConfig>;
4
208
 
5
209
  /**
6
210
  * Configuration options specifically for the Boltdocs Vite plugin.
@@ -85,5 +289,10 @@ interface RouteMeta {
85
289
  }
86
290
 
87
291
  declare function boltdocs(options?: BoltdocsPluginOptions): Promise<Plugin[]>;
292
+ /**
293
+ * Generates the complete Vite configuration for a Boltdocs project.
294
+ * This is used by the Boltdocs CLI to run Vite without a user-defined vite.config.ts.
295
+ */
296
+ declare function createViteConfig(root: string, mode?: 'development' | 'production'): Promise<InlineConfig>;
88
297
 
89
- export { BoltdocsConfig, type BoltdocsPluginOptions, type RouteMeta, type SSGOptions, boltdocs as default, generateStaticPages };
298
+ export { type BoltdocsConfig, type BoltdocsPluginOptions, type BoltdocsThemeConfig, type RouteMeta, type SSGOptions, createViteConfig, boltdocs as default, defineConfig, generateStaticPages, resolveConfig };