boltdocs 1.0.0 → 1.0.4

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 (47) hide show
  1. package/dist/{CodeBlock-37XMKCYY.mjs → CodeBlock-V3Z5EKGR.mjs} +0 -1
  2. package/dist/{PackageManagerTabs-4NWXLXQO.mjs → PackageManagerTabs-XEKI3L7P.mjs} +0 -2
  3. package/dist/Playground-B2FA34BC.mjs +6 -0
  4. package/dist/{SearchDialog-ZAZXYIFX.css → SearchDialog-PYF3QMYG.css} +3 -3
  5. package/dist/{SearchDialog-FTOQZ763.mjs → SearchDialog-R36WKAQ7.mjs} +1 -2
  6. package/dist/{Video-I6QY4X7J.mjs → Video-KNTY5BNO.mjs} +0 -1
  7. package/dist/{chunk-ZFCOLEXN.mjs → chunk-TWSRXUFF.mjs} +7 -10
  8. package/dist/{chunk-PN4GCTYG.mjs → chunk-WPT4MWTQ.mjs} +25 -3
  9. package/dist/client/index.css +3 -3
  10. package/dist/client/index.d.mts +34 -4
  11. package/dist/client/index.d.ts +34 -4
  12. package/dist/client/index.js +28 -10
  13. package/dist/client/index.mjs +4 -5
  14. package/dist/client/ssr.css +3 -3
  15. package/dist/client/ssr.d.mts +1 -1
  16. package/dist/client/ssr.d.ts +1 -1
  17. package/dist/client/ssr.js +25 -3
  18. package/dist/client/ssr.mjs +1 -2
  19. package/dist/node/index.mjs +68 -28
  20. package/dist/{index-CRQKWAeo.d.mts → types-CvrzTbEX.d.mts} +1 -28
  21. package/dist/{index-CRQKWAeo.d.ts → types-CvrzTbEX.d.ts} +1 -28
  22. package/package.json +1 -5
  23. package/src/client/app/index.tsx +7 -56
  24. package/src/client/app/preload.tsx +1 -1
  25. package/src/client/index.ts +1 -1
  26. package/src/client/ssr.tsx +2 -1
  27. package/src/client/theme/components/Playground/Playground.tsx +40 -2
  28. package/src/client/theme/styles/markdown.css +3 -3
  29. package/src/client/theme/ui/Breadcrumbs/Breadcrumbs.tsx +1 -1
  30. package/src/client/theme/ui/LanguageSwitcher/LanguageSwitcher.tsx +1 -1
  31. package/src/client/theme/ui/Layout/Layout.tsx +1 -1
  32. package/src/client/theme/ui/Navbar/Navbar.tsx +1 -1
  33. package/src/client/theme/ui/SearchDialog/SearchDialog.tsx +1 -1
  34. package/src/client/theme/ui/VersionSwitcher/VersionSwitcher.tsx +1 -1
  35. package/src/client/types.ts +50 -0
  36. package/tsconfig.json +1 -0
  37. package/dist/Playground-OE2OE6B6.mjs +0 -7
  38. package/dist/chunk-X2TDGMTR.mjs +0 -64
  39. package/dist/chunk-X6BYQHVC.mjs +0 -12
  40. package/dist/node/cli/index.d.mts +0 -1
  41. package/dist/node/cli/index.d.ts +0 -1
  42. package/dist/node/cli/index.js +0 -199
  43. package/dist/node/cli/index.mjs +0 -154
  44. package/src/node/cli/commands/config.ts +0 -15
  45. package/src/node/cli/commands/generate-css.ts +0 -24
  46. package/src/node/cli/constants.ts +0 -70
  47. package/src/node/cli/index.ts +0 -22
@@ -1,10 +1,3 @@
1
- import {
2
- CONFIG_FILES,
3
- init_config,
4
- resolveConfig
5
- } from "../chunk-X2TDGMTR.mjs";
6
- import "../chunk-X6BYQHVC.mjs";
7
-
8
1
  // src/node/plugin/index.ts
9
2
  import { loadEnv } from "vite";
10
3
 
@@ -338,12 +331,60 @@ async function generateRoutes(docsDir, config, basePath = "/docs") {
338
331
  }
339
332
 
340
333
  // src/node/plugin/index.ts
341
- init_config();
342
334
  import { ViteImageOptimizer } from "vite-plugin-image-optimizer";
343
335
 
344
- // src/node/ssg/index.ts
345
- import fs2 from "fs";
336
+ // src/node/config.ts
346
337
  import path2 from "path";
338
+ import { pathToFileURL } from "url";
339
+ import fs2 from "fs";
340
+ var CONFIG_FILES = [
341
+ "boltdocs.config.js",
342
+ "boltdocs.config.mjs",
343
+ "boltdocs.config.ts"
344
+ ];
345
+ async function resolveConfig(docsDir) {
346
+ const projectRoot = process.cwd();
347
+ const defaults = {
348
+ docsDir: path2.resolve(docsDir),
349
+ themeConfig: {
350
+ title: "Boltdocs",
351
+ description: "A Vite documentation framework",
352
+ navbar: [
353
+ { text: "Home", link: "/" },
354
+ { text: "Documentation", link: "/docs" }
355
+ ]
356
+ }
357
+ };
358
+ for (const filename of CONFIG_FILES) {
359
+ const configPath = path2.resolve(projectRoot, filename);
360
+ if (fs2.existsSync(configPath)) {
361
+ try {
362
+ const fileUrl = pathToFileURL(configPath).href + "?t=" + Date.now();
363
+ const mod = await import(fileUrl);
364
+ const userConfig = mod.default || mod;
365
+ const userThemeConfig = userConfig.themeConfig || userConfig;
366
+ return {
367
+ docsDir: path2.resolve(docsDir),
368
+ themeConfig: {
369
+ ...defaults.themeConfig,
370
+ ...userThemeConfig
371
+ },
372
+ i18n: userConfig.i18n,
373
+ versions: userConfig.versions,
374
+ siteUrl: userConfig.siteUrl,
375
+ plugins: userConfig.plugins || []
376
+ };
377
+ } catch (e) {
378
+ console.warn(`[boltdocs] Failed to load config from ${filename}:`, e);
379
+ }
380
+ }
381
+ }
382
+ return defaults;
383
+ }
384
+
385
+ // src/node/ssg/index.ts
386
+ import fs3 from "fs";
387
+ import path3 from "path";
347
388
  import { fileURLToPath } from "url";
348
389
  import { createRequire } from "module";
349
390
 
@@ -407,15 +448,15 @@ ${entries.map(
407
448
 
408
449
  // src/node/ssg/index.ts
409
450
  var _filename = fileURLToPath(import.meta.url);
410
- var _dirname = path2.dirname(_filename);
451
+ var _dirname = path3.dirname(_filename);
411
452
  var _require = createRequire(import.meta.url);
412
453
  async function generateStaticPages(options) {
413
454
  const { docsDir, outDir, config } = options;
414
455
  const routes = await generateRoutes(docsDir, config);
415
456
  const siteTitle = config?.themeConfig?.title || "Boltdocs";
416
457
  const siteDescription = config?.themeConfig?.description || "";
417
- const ssrModulePath = path2.resolve(_dirname, "../client/ssr.js");
418
- if (!fs2.existsSync(ssrModulePath)) {
458
+ const ssrModulePath = path3.resolve(_dirname, "../client/ssr.js");
459
+ if (!fs3.existsSync(ssrModulePath)) {
419
460
  console.error(
420
461
  "[boltdocs] SSR module not found at",
421
462
  ssrModulePath,
@@ -424,12 +465,12 @@ async function generateStaticPages(options) {
424
465
  return;
425
466
  }
426
467
  const { render } = _require(ssrModulePath);
427
- const templatePath = path2.join(outDir, "index.html");
428
- if (!fs2.existsSync(templatePath)) {
468
+ const templatePath = path3.join(outDir, "index.html");
469
+ if (!fs3.existsSync(templatePath)) {
429
470
  console.warn("[boltdocs] No index.html found in outDir, skipping SSG.");
430
471
  return;
431
472
  }
432
- const template = fs2.readFileSync(templatePath, "utf-8");
473
+ const template = fs3.readFileSync(templatePath, "utf-8");
433
474
  let homePageComp;
434
475
  if (config?._homePagePath) {
435
476
  try {
@@ -455,10 +496,10 @@ async function generateStaticPages(options) {
455
496
  title: escapeHtml(pageTitle),
456
497
  description: escapeHtml(pageDescription)
457
498
  }).replace("<!--app-html-->", appHtml).replace(`<div id="root"></div>`, `<div id="root">${appHtml}</div>`);
458
- const routeDir = path2.join(outDir, route.path);
459
- await fs2.promises.mkdir(routeDir, { recursive: true });
460
- await fs2.promises.writeFile(
461
- path2.join(routeDir, "index.html"),
499
+ const routeDir = path3.join(outDir, route.path);
500
+ await fs3.promises.mkdir(routeDir, { recursive: true });
501
+ await fs3.promises.writeFile(
502
+ path3.join(routeDir, "index.html"),
462
503
  html,
463
504
  "utf-8"
464
505
  );
@@ -471,14 +512,14 @@ async function generateStaticPages(options) {
471
512
  routes.map((r) => r.path),
472
513
  config
473
514
  );
474
- fs2.writeFileSync(path2.join(outDir, "sitemap.xml"), sitemap, "utf-8");
515
+ fs3.writeFileSync(path3.join(outDir, "sitemap.xml"), sitemap, "utf-8");
475
516
  console.log(
476
517
  `[boltdocs] Generated ${routes.length} static pages + sitemap.xml`
477
518
  );
478
519
  }
479
520
 
480
521
  // src/node/plugin/index.ts
481
- import path3 from "path";
522
+ import path4 from "path";
482
523
 
483
524
  // src/node/plugin/entry.ts
484
525
  function generateEntryCode(options, config) {
@@ -489,8 +530,8 @@ function generateEntryCode(options, config) {
489
530
  const componentImports = pluginComponents.map(
490
531
  ([
491
532
  name,
492
- path4
493
- ]) => `import * as _comp_${name} from '${normalizePath(path4)}';
533
+ path5
534
+ ]) => `import * as _comp_${name} from '${normalizePath(path5)}';
494
535
  const ${name} = _comp_${name}.default || _comp_${name}['${name}'] || _comp_${name};`
495
536
  ).join("\n");
496
537
  const componentMap = pluginComponents.map(([name]) => name).join(", ");
@@ -560,7 +601,7 @@ ${themeScript} </head>`);
560
601
 
561
602
  // src/node/plugin/index.ts
562
603
  function boltdocsPlugin(options = {}, passedConfig) {
563
- const docsDir = path3.resolve(process.cwd(), options.docsDir || "docs");
604
+ const docsDir = path4.resolve(process.cwd(), options.docsDir || "docs");
564
605
  const normalizedDocsDir = normalizePath(docsDir);
565
606
  let config = passedConfig;
566
607
  let viteConfig;
@@ -590,7 +631,7 @@ function boltdocsPlugin(options = {}, passedConfig) {
590
631
  },
591
632
  configureServer(server) {
592
633
  const configPaths = CONFIG_FILES.map(
593
- (c) => path3.resolve(process.cwd(), c)
634
+ (c) => path4.resolve(process.cwd(), c)
594
635
  );
595
636
  server.watcher.add(configPaths);
596
637
  const handleFileEvent = async (file, type) => {
@@ -653,7 +694,7 @@ function boltdocsPlugin(options = {}, passedConfig) {
653
694
  },
654
695
  async closeBundle() {
655
696
  if (!isBuild) return;
656
- const outDir = viteConfig?.build?.outDir ? path3.resolve(viteConfig.root, viteConfig.build.outDir) : path3.resolve(process.cwd(), "dist");
697
+ const outDir = viteConfig?.build?.outDir ? path4.resolve(viteConfig.root, viteConfig.build.outDir) : path4.resolve(process.cwd(), "dist");
657
698
  await generateStaticPages({ docsDir, outDir, config });
658
699
  }
659
700
  },
@@ -707,7 +748,6 @@ function boltdocsMdxPlugin(config) {
707
748
  }
708
749
 
709
750
  // src/node/index.ts
710
- init_config();
711
751
  async function boltdocs(options) {
712
752
  const docsDir = options?.docsDir || "docs";
713
753
  const config = await resolveConfig(docsDir);
@@ -1,10 +1,5 @@
1
1
  import React from 'react';
2
2
 
3
- declare global {
4
- interface ImportMeta {
5
- env: Record<string, any>;
6
- }
7
- }
8
3
  /**
9
4
  * Metadata provided by the server for a specific route.
10
5
  * Maps closely to the `RouteMeta` type in the Node environment.
@@ -56,27 +51,5 @@ interface CreateBoltdocsAppOptions {
56
51
  /** Optional custom MDX components provided by plugins */
57
52
  components?: Record<string, React.ComponentType<any>>;
58
53
  }
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
54
 
82
- export { type ComponentRoute as C, type CreateBoltdocsAppOptions as a, createBoltdocsApp as c };
55
+ export type { CreateBoltdocsAppOptions as C, ComponentRoute as a };
@@ -1,10 +1,5 @@
1
1
  import React from 'react';
2
2
 
3
- declare global {
4
- interface ImportMeta {
5
- env: Record<string, any>;
6
- }
7
- }
8
3
  /**
9
4
  * Metadata provided by the server for a specific route.
10
5
  * Maps closely to the `RouteMeta` type in the Node environment.
@@ -56,27 +51,5 @@ interface CreateBoltdocsAppOptions {
56
51
  /** Optional custom MDX components provided by plugins */
57
52
  components?: Record<string, React.ComponentType<any>>;
58
53
  }
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
54
 
82
- export { type ComponentRoute as C, type CreateBoltdocsAppOptions as a, createBoltdocsApp as c };
55
+ export type { CreateBoltdocsAppOptions as C, ComponentRoute as a };
package/package.json CHANGED
@@ -1,13 +1,10 @@
1
1
  {
2
2
  "name": "boltdocs",
3
- "version": "1.0.0",
3
+ "version": "1.0.4",
4
4
  "description": "A lightweight documentation generator for React projects.",
5
5
  "main": "dist/node/index.js",
6
6
  "module": "dist/node/index.mjs",
7
7
  "types": "dist/node/index.d.ts",
8
- "bin": {
9
- "boltdocs": "./dist/node/cli/index.js"
10
- },
11
8
  "publishConfig": {
12
9
  "access": "public"
13
10
  },
@@ -45,7 +42,6 @@
45
42
  "dependencies": {
46
43
  "@mdx-js/react": "^3.1.1",
47
44
  "@mdx-js/rollup": "^3.1.1",
48
- "cac": "^7.0.0",
49
45
  "fast-glob": "^3.3.3",
50
46
  "github-slugger": "^2.0.0",
51
47
  "gray-matter": "^4.0.3",
@@ -11,6 +11,7 @@ import { ThemeLayout } from "../theme/ui/Layout";
11
11
  import { NotFound } from "../theme/ui/NotFound";
12
12
  import { Loading } from "../theme/ui/Loading";
13
13
  import { MDXProvider } from "@mdx-js/react";
14
+ import { ComponentRoute, CreateBoltdocsAppOptions } from "../types";
14
15
  import {
15
16
  createContext,
16
17
  useContext,
@@ -134,55 +135,6 @@ const mdxComponents = {
134
135
  List,
135
136
  };
136
137
 
137
- /**
138
- * Metadata provided by the server for a specific route.
139
- * Maps closely to the `RouteMeta` type in the Node environment.
140
- */
141
- export interface ComponentRoute {
142
- /** The final URL path */
143
- path: string;
144
- /** The absolute filesystem path of the source file */
145
- componentPath: string;
146
- /** The page title */
147
- title: string;
148
- /** Explicit order in the sidebar */
149
- sidebarPosition?: number;
150
- /** The relative path from the docs directory */
151
- filePath: string;
152
- /** The group directory name */
153
- group?: string;
154
- /** The display title of the group */
155
- groupTitle?: string;
156
- /** Explicit order of the group in the sidebar */
157
- groupPosition?: number;
158
- /** Extracted markdown headings for search indexing */
159
- headings?: { level: number; text: string; id: string }[];
160
- /** The locale this route belongs to, if i18n is configured */
161
- locale?: string;
162
- /** The version this route belongs to, if versioning is configured */
163
- version?: string;
164
- }
165
-
166
- /**
167
- * Configuration options for initializing the Boltdocs client app.
168
- */
169
- export interface CreateBoltdocsAppOptions {
170
- /** CSS selector for the DOM element where the app should mount (e.g. '#root') */
171
- target: string;
172
- /** Initial routes generated by the Vite plugin (`virtual:boltdocs-routes`) */
173
- routes: ComponentRoute[];
174
- /** Site configuration (`virtual:boltdocs-config`) */
175
- config: any;
176
- /** Dynamic import mapping from `import.meta.glob` for the documentation pages */
177
- modules: Record<string, () => Promise<any>>;
178
- /** The `import.meta.hot` instance necessary for fast refresh/HMR updates */
179
- hot?: any;
180
- /** Optional custom React component to render when visiting the root path ('/') */
181
- homePage?: React.ComponentType;
182
- /** Optional custom MDX components provided by plugins */
183
- components?: Record<string, React.ComponentType<any>>;
184
- }
185
-
186
138
  export function AppShell({
187
139
  initialRoutes,
188
140
  initialConfig,
@@ -412,11 +364,10 @@ export function createBoltdocsApp(options: CreateBoltdocsAppOptions) {
412
364
  </React.StrictMode>
413
365
  );
414
366
 
415
- // In production (built app), the HTML is pre-rendered by SSG, so we hydrate.
416
- // In development, the root is empty, so we createRoot.
417
- if (import.meta.env.PROD && container.innerHTML.trim() !== "") {
418
- ReactDOM.hydrateRoot(container as HTMLElement, app);
419
- } else {
420
- ReactDOM.createRoot(container as HTMLElement).render(app);
421
- }
367
+ // SSG pre-renders a shell with mock components for SEO crawlers.
368
+ // We always use createRoot because the SSG output doesn't match the
369
+ // real client-side component tree (components are lazy/dynamic).
370
+ // Clear any SSG placeholder content before mounting.
371
+ container.innerHTML = "";
372
+ ReactDOM.createRoot(container as HTMLElement).render(app);
422
373
  }
@@ -1,5 +1,5 @@
1
1
  import React, { createContext, useContext, useCallback } from "react";
2
- import { ComponentRoute } from "./index";
2
+ import { ComponentRoute } from "../types";
3
3
 
4
4
  interface PreloadContextType {
5
5
  preload: (path: string) => void;
@@ -1,5 +1,5 @@
1
1
  export type { BoltdocsConfig, BoltdocsThemeConfig } from "../node/config";
2
- export type { ComponentRoute, CreateBoltdocsAppOptions } from "./app";
2
+ export type { ComponentRoute, CreateBoltdocsAppOptions } from "./types";
3
3
  export { createBoltdocsApp } from "./app";
4
4
  export { ThemeLayout } from "./theme/ui/Layout";
5
5
  export { Navbar } from "./theme/ui/Navbar";
@@ -1,7 +1,8 @@
1
1
  import React from "react";
2
2
  import ReactDOMServer from "react-dom/server";
3
3
  import { StaticRouter } from "react-router-dom/server";
4
- import { AppShell, ComponentRoute } from "./app";
4
+ import { AppShell } from "./app";
5
+ import { ComponentRoute } from "./types";
5
6
 
6
7
  /**
7
8
  * Options for rendering the Boltdocs application on the server (SSG).
@@ -7,17 +7,52 @@ interface PlaygroundProps {
7
7
  children?: string | React.ReactNode;
8
8
  scope?: Record<string, any>;
9
9
  readonly?: boolean;
10
+ noInline?: boolean;
11
+ }
12
+
13
+ /**
14
+ * Transforms code that uses `export default` into a format compatible
15
+ * with react-live's `noInline` mode by stripping the export and
16
+ * appending a `render(<ComponentName />)` call.
17
+ */
18
+ function prepareCode(raw: string): { code: string; noInline: boolean } {
19
+ const trimmed = raw.trim();
20
+
21
+ // Match: export default function Name(...)
22
+ const fnMatch = trimmed.match(/export\s+default\s+function\s+(\w+)/);
23
+ if (fnMatch) {
24
+ const name = fnMatch[1];
25
+ const code =
26
+ trimmed.replace(/export\s+default\s+/, "") + `\n\nrender(<${name} />);`;
27
+ return { code, noInline: true };
28
+ }
29
+
30
+ // Match: export default ComponentName (at the end)
31
+ const varMatch = trimmed.match(/export\s+default\s+(\w+)\s*;?\s*$/);
32
+ if (varMatch) {
33
+ const name = varMatch[1];
34
+ const code =
35
+ trimmed.replace(/export\s+default\s+\w+\s*;?\s*$/, "") +
36
+ `\nrender(<${name} />);`;
37
+ return { code, noInline: true };
38
+ }
39
+
40
+ // No export default — use inline mode (simple JSX expression)
41
+ return { code: trimmed, noInline: false };
10
42
  }
11
43
 
12
44
  /**
13
45
  * A live React playground component.
14
46
  * Features a split layout with a live editor and a preview section.
47
+ *
48
+ * Supports `export default function App()` style code out of the box.
15
49
  */
16
50
  export function Playground({
17
51
  code,
18
52
  children,
19
53
  scope = {},
20
54
  readonly = false,
55
+ noInline: forceNoInline,
21
56
  }: PlaygroundProps) {
22
57
  // Extract code from either `code` prop or `children`
23
58
  let initialCode = code || "";
@@ -25,8 +60,11 @@ export function Playground({
25
60
  initialCode = children;
26
61
  }
27
62
 
63
+ const prepared = prepareCode(initialCode);
64
+ const useNoInline = forceNoInline ?? prepared.noInline;
65
+
28
66
  const [copied, setCopied] = useState(false);
29
- const [activeCode, setActiveCode] = useState(initialCode.trim());
67
+ const [activeCode, setActiveCode] = useState(prepared.code);
30
68
 
31
69
  const handleCopy = () => {
32
70
  navigator.clipboard.writeText(activeCode);
@@ -43,7 +81,7 @@ export function Playground({
43
81
  code={activeCode}
44
82
  scope={extendedScope}
45
83
  theme={undefined}
46
- noInline={false}
84
+ noInline={useNoInline}
47
85
  >
48
86
  <div className="playground-split-container">
49
87
  {/* Editor Side */}
@@ -265,12 +265,12 @@
265
265
  }
266
266
 
267
267
  .code-block-wrapper pre > code {
268
- padding: 1.25rem !important;
269
- display: block !important;
268
+ display: grid !important;
269
+ padding: 1.25rem 1rem !important;
270
270
  }
271
271
 
272
272
  .code-block-wrapper pre > code .line {
273
- padding: 0;
273
+ padding: 0 1.25rem;
274
274
  }
275
275
 
276
276
  /* Default pre (without wrapper) */
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import { useLocation } from "react-router-dom";
3
3
  import { Link } from "../Link";
4
4
  import { Home, ChevronRight } from "lucide-react";
5
- import { ComponentRoute } from "../../../app";
5
+ import { ComponentRoute } from "../../../types";
6
6
  import { BoltdocsConfig } from "../../../../node/config";
7
7
 
8
8
  export interface BreadcrumbsProps {
@@ -2,7 +2,7 @@ import React, { useState, useRef, useEffect } from "react";
2
2
  import { Globe, ChevronDown } from "lucide-react";
3
3
  import { useNavigate, useLocation } from "react-router-dom";
4
4
  import { BoltdocsI18nConfig } from "../../../../node/config";
5
- import { ComponentRoute } from "../../../app";
5
+ import { ComponentRoute } from "../../../types";
6
6
 
7
7
  function getBaseFilePath(
8
8
  filePath: string,
@@ -4,7 +4,7 @@ import { Link } from "../Link";
4
4
  import { ChevronLeft, ChevronRight, Menu } from "lucide-react";
5
5
  import { usePreload } from "../../../app/preload";
6
6
  import { BoltdocsConfig } from "../../../../node/config";
7
- import { ComponentRoute } from "../../../app";
7
+ import { ComponentRoute } from "../../../types";
8
8
  export { Navbar } from "../Navbar";
9
9
  export { Sidebar } from "../Sidebar";
10
10
  export { OnThisPage } from "../OnThisPage";
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from "react";
2
2
  import { Link } from "../Link";
3
3
  import { Book, ChevronDown } from "lucide-react";
4
4
  import { BoltdocsConfig } from "../../../../node/config";
5
- import { ComponentRoute } from "../../../app";
5
+ import { ComponentRoute } from "../../../types";
6
6
  import { LanguageSwitcher } from "../LanguageSwitcher";
7
7
  import { VersionSwitcher } from "../VersionSwitcher";
8
8
  import { ThemeToggle } from "../ThemeToggle";
@@ -2,7 +2,7 @@ import React, { useState, useEffect, useRef } from "react";
2
2
  import { createPortal } from "react-dom";
3
3
  import { Link } from "../Link";
4
4
  import { Search } from "lucide-react";
5
- import { ComponentRoute } from "../../../app";
5
+ import { ComponentRoute } from "../../../types";
6
6
 
7
7
  interface SearchResult {
8
8
  title: string;
@@ -2,7 +2,7 @@ import { useState, useRef, useEffect } from "react";
2
2
  import { Layers, ChevronDown } from "lucide-react";
3
3
  import { useNavigate, useLocation } from "react-router-dom";
4
4
  import { BoltdocsVersionsConfig } from "../../../../node/config";
5
- import { ComponentRoute } from "../../../app";
5
+ import { ComponentRoute } from "../../../types";
6
6
 
7
7
  function getBaseFilePath(
8
8
  filePath: string,
@@ -0,0 +1,50 @@
1
+ import React from "react";
2
+
3
+ /**
4
+ * Metadata provided by the server for a specific route.
5
+ * Maps closely to the `RouteMeta` type in the Node environment.
6
+ */
7
+ export interface ComponentRoute {
8
+ /** The final URL path */
9
+ path: string;
10
+ /** The absolute filesystem path of the source file */
11
+ componentPath: string;
12
+ /** The page title */
13
+ title: string;
14
+ /** Explicit order in the sidebar */
15
+ sidebarPosition?: number;
16
+ /** The relative path from the docs directory */
17
+ filePath: string;
18
+ /** The group directory name */
19
+ group?: string;
20
+ /** The display title of the group */
21
+ groupTitle?: string;
22
+ /** Explicit order of the group in the sidebar */
23
+ groupPosition?: number;
24
+ /** Extracted markdown headings for search indexing */
25
+ headings?: { level: number; text: string; id: string }[];
26
+ /** The locale this route belongs to, if i18n is configured */
27
+ locale?: string;
28
+ /** The version this route belongs to, if versioning is configured */
29
+ version?: string;
30
+ }
31
+
32
+ /**
33
+ * Configuration options for initializing the Boltdocs client app.
34
+ */
35
+ export interface CreateBoltdocsAppOptions {
36
+ /** CSS selector for the DOM element where the app should mount (e.g. '#root') */
37
+ target: string;
38
+ /** Initial routes generated by the Vite plugin (`virtual:boltdocs-routes`) */
39
+ routes: ComponentRoute[];
40
+ /** Site configuration (`virtual:boltdocs-config`) */
41
+ config: any;
42
+ /** Dynamic import mapping from `import.meta.glob` for the documentation pages */
43
+ modules: Record<string, () => Promise<any>>;
44
+ /** The `import.meta.hot` instance necessary for fast refresh/HMR updates */
45
+ hot?: any;
46
+ /** Optional custom React component to render when visiting the root path ('/') */
47
+ homePage?: React.ComponentType;
48
+ /** Optional custom MDX components provided by plugins */
49
+ components?: Record<string, React.ComponentType<any>>;
50
+ }
package/tsconfig.json CHANGED
@@ -16,5 +16,6 @@
16
16
  "exclude": [
17
17
  "node_modules",
18
18
  "dist",
19
+ "src/node/cli"
19
20
  ]
20
21
  }
@@ -1,7 +0,0 @@
1
- import {
2
- Playground
3
- } from "./chunk-PN4GCTYG.mjs";
4
- import "./chunk-X6BYQHVC.mjs";
5
- export {
6
- Playground
7
- };