boltdocs 3.2.2 → 3.3.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 (155) hide show
  1. package/bin/boltdocs.js +20 -1
  2. package/bin/preloader.mjs +28 -0
  3. package/dist/{adapters-ByYY44Zy.mjs → adapters-BmB4TKCc.mjs} +1 -1
  4. package/dist/{adapters-DvmtpdSF.cjs → adapters-Cp1Maurn.cjs} +1 -1
  5. package/dist/audit-CLXjMzwQ.mjs +11 -0
  6. package/dist/audit-COgjnQ5n.cjs +11 -0
  7. package/dist/build-BS2hefiL.cjs +6 -0
  8. package/dist/build-C5mNh9D-.mjs +6 -0
  9. package/dist/cache-CJE9nWLE.cjs +6 -0
  10. package/dist/cache-OY4HzIXl.mjs +6 -0
  11. package/dist/callout-oI_LCbxS.d.ts +71 -0
  12. package/dist/callout-plqx9Dw-.d.cts +71 -0
  13. package/dist/client/index.cjs +1265 -569
  14. package/dist/client/index.d.cts +3 -542
  15. package/dist/client/index.d.ts +3 -542
  16. package/dist/client/index.js +1167 -521
  17. package/dist/client/mdx.cjs +1 -1
  18. package/dist/client/mdx.d.cts +24 -2
  19. package/dist/client/mdx.d.ts +24 -2
  20. package/dist/client/mdx.js +1 -1
  21. package/dist/client/primitives.cjs +14 -4
  22. package/dist/client/primitives.d.cts +281 -38
  23. package/dist/client/primitives.d.ts +281 -38
  24. package/dist/client/primitives.js +5 -5
  25. package/dist/client/router.cjs +49 -0
  26. package/dist/client/router.d.cts +3 -0
  27. package/dist/client/router.d.ts +3 -0
  28. package/dist/client/router.js +8 -0
  29. package/dist/client/theme/reset.css +40 -4
  30. package/dist/{config-BpzaPsJj.d.cts → config-BoRlz0Ca.d.mts} +157 -14
  31. package/dist/{config-xtS0ZkMm.d.mts → config-CTsX_tGM.d.cts} +157 -14
  32. package/dist/config-Ceib-AOH.cjs +7 -0
  33. package/dist/config-DGLQsy7y.mjs +7 -0
  34. package/dist/{package-CH2ChQqw.cjs → config-files-BYHDOrKn.mjs} +1 -1
  35. package/dist/config-files-D9cdBMl2.cjs +6 -0
  36. package/dist/config-jJh8WYJI.cjs +6 -0
  37. package/dist/csp-C4LmN1ko.cjs +6 -0
  38. package/dist/csp-D6JEOqKh.mjs +6 -0
  39. package/dist/dev-Ch3hEe5Y.cjs +6 -0
  40. package/dist/dev-QPNxysrd.mjs +6 -0
  41. package/dist/{docs-layout-BdtZ9z6s.js → docs-layout-CbZ7LDRe.js} +504 -249
  42. package/dist/{docs-layout-CFWI15Id.cjs → docs-layout-vzfXed1Q.cjs} +516 -254
  43. package/dist/{doctor-BBtmNJE0.cjs → doctor-B1_YL0Wt.cjs} +1 -1
  44. package/dist/doctor-C7whl4ED.cjs +6 -0
  45. package/dist/doctor-DmQnml2k.mjs +6 -0
  46. package/dist/{generator-COepVWGi.cjs → generator-BlW45ST7.cjs} +5 -3
  47. package/dist/{generator-CcOBN5vI.mjs → generator-BwknNejd.mjs} +5 -3
  48. package/dist/{handler-XX7cLTqe.cjs → handler-CDEoKARD.cjs} +2 -2
  49. package/dist/{handler-DzQae4eA.mjs → handler-D7UyZlPm.mjs} +2 -2
  50. package/dist/{image-Bz87fCla.js → image-B-NDSDuY.js} +129 -11
  51. package/dist/{image-C4TlpMHn.cjs → image-Hnaa2bJd.cjs} +175 -9
  52. package/dist/index-C56bL-A-.d.cts +1344 -0
  53. package/dist/{sidebar-COTaMHR-.d.ts → index-CPUUKzxD.d.cts} +344 -327
  54. package/dist/{sidebar-CrEdJuHX.d.cts → index-Ci4kfOHF.d.ts} +344 -327
  55. package/dist/index-Cu9H6CRa.d.ts +1344 -0
  56. package/dist/link-CgdI6O2o.js +872 -0
  57. package/dist/{link-D1Gjkb-2.cjs → link-vZjmD-es.cjs} +406 -223
  58. package/dist/{mdx-BuO6a1f7.js → mdx-BRT71V5Q.js} +211 -168
  59. package/dist/{mdx-CD-tSjRG.cjs → mdx-D0Absdq5.cjs} +225 -169
  60. package/dist/native-BNCY7PRF.cjs +6 -0
  61. package/dist/native-Di9Fnfrv.mjs +6 -0
  62. package/dist/native-Kre2T5eS.cjs +6 -0
  63. package/dist/node/cache.cjs +1 -1
  64. package/dist/node/cache.d.cts +19 -3
  65. package/dist/node/cache.d.mts +19 -3
  66. package/dist/node/cache.mjs +1 -1
  67. package/dist/node/cli-entry.cjs +1 -9
  68. package/dist/node/cli-entry.mjs +1 -9
  69. package/dist/node/index.cjs +1 -1
  70. package/dist/node/index.d.cts +245 -17
  71. package/dist/node/index.d.mts +246 -18
  72. package/dist/node/index.mjs +1 -1
  73. package/dist/node/mdx/shiki-adapter.cjs +1 -1
  74. package/dist/node/mdx/shiki-adapter.d.cts +24 -3
  75. package/dist/node/mdx/shiki-adapter.d.mts +24 -2
  76. package/dist/node/mdx/shiki-adapter.mjs +1 -1
  77. package/dist/node-Du5UL5wo.mjs +23 -0
  78. package/dist/node-DunuGqyp.cjs +23 -0
  79. package/dist/{package-DSSB8B5L.mjs → package-DA848keM.mjs} +1 -1
  80. package/dist/package-wplzySjz.cjs +6 -0
  81. package/dist/pages-external-BBw8ObVK.mjs +6 -0
  82. package/dist/pages-external-DPiPFxxP.cjs +6 -0
  83. package/dist/parser-BqTOsEUa.cjs +6 -0
  84. package/dist/parser-CGMY2lJ7.mjs +6 -0
  85. package/dist/plugin-BcTzvHAJ.mjs +69 -0
  86. package/dist/plugin-TulVMt1z.cjs +69 -0
  87. package/dist/plugin-context-C-l90hFt.cjs +15 -0
  88. package/dist/plugin-context-wqHNSZum.mjs +15 -0
  89. package/dist/plugin-lifecycle-B1BzSHdn.cjs +6 -0
  90. package/dist/resolve-B7vWOd8R.cjs +6 -0
  91. package/dist/resolve-C2kKnk_5.mjs +6 -0
  92. package/dist/resolve-It1Iug83.cjs +6 -0
  93. package/dist/resolve-YdTrt_FG.mjs +6 -0
  94. package/dist/router-C3kygdRK.cjs +1285 -0
  95. package/dist/router-CZBxMRAH.js +987 -0
  96. package/dist/routes-BL4y79tb.mjs +6 -0
  97. package/dist/routes-C2nPecwu.cjs +6 -0
  98. package/dist/routes-U9L8psZ9.cjs +6 -0
  99. package/dist/{search-dialog-DHqwjJuG.cjs → search-dialog-BCOHQGSt.cjs} +1 -1
  100. package/dist/search-dialog-Bp_P1MPP.js +481 -0
  101. package/dist/{search-dialog-DFnlx8LO.js → search-dialog-BqkzDTq2.js} +107 -57
  102. package/dist/{search-dialog-BRFno7HD.cjs → search-dialog-CIeIUhAn.cjs} +218 -43
  103. package/dist/{search-dialog-D6TvjcuV.js → search-dialog-DtmxmfEu.js} +1 -1
  104. package/dist/{search-dialog-B1NERUNx.cjs → search-dialog-x_qHU8ty.cjs} +107 -58
  105. package/dist/server/index.cjs +1 -1
  106. package/dist/server/index.d.mts +1 -1
  107. package/dist/server/index.mjs +1 -1
  108. package/dist/update-check-BKqmYfwT.cjs +11 -0
  109. package/dist/update-check-QnrVR3q1.mjs +11 -0
  110. package/dist/utils-8lzafE49.mjs +7 -0
  111. package/dist/utils-ej6_SjIZ.cjs +7 -0
  112. package/dist/virtual-modules-Ca5tHk1X.cjs +30 -0
  113. package/dist/virtual-modules-Dlgt1fP0.mjs +30 -0
  114. package/package.json +18 -16
  115. package/src/shared/mdx-path.ts +12 -0
  116. package/src/shared/structured-data.ts +145 -0
  117. package/src/shared/types.ts +220 -16
  118. package/dist/banner-BMop1KLF.d.ts +0 -100
  119. package/dist/banner-CVD0GugR.d.cts +0 -100
  120. package/dist/cache-CO4Dy2uQ.cjs +0 -6
  121. package/dist/cache-Dk53iOo6.mjs +0 -6
  122. package/dist/config-CCXp3aXO.mjs +0 -7
  123. package/dist/config-CMd4XoFq.cjs +0 -6
  124. package/dist/config-DlGoEM9D.cjs +0 -7
  125. package/dist/csp-CRp_3U7a.cjs +0 -6
  126. package/dist/csp-oTC2ygvF.mjs +0 -6
  127. package/dist/doctor-Bv16QSrI.cjs +0 -7
  128. package/dist/doctor-DOAbSaiL.mjs +0 -7
  129. package/dist/headers-Ddwek8K7.mjs +0 -6
  130. package/dist/headers-dg4SDrjY.cjs +0 -6
  131. package/dist/link-2PzgTnaP.js +0 -673
  132. package/dist/meta-loader-C4Hu9RN9.mjs +0 -6
  133. package/dist/meta-loader-Dq1zcFnh.cjs +0 -6
  134. package/dist/node-B5hu_6qj.cjs +0 -104
  135. package/dist/node-BXtqM1uH.mjs +0 -6
  136. package/dist/node-C8725aw7.mjs +0 -104
  137. package/dist/node-aD1eisrR.cjs +0 -6
  138. package/dist/pages-external-BYa4JSda.mjs +0 -6
  139. package/dist/pages-external-XkYIs-d5.cjs +0 -6
  140. package/dist/parser-DCiEWkSk.cjs +0 -8
  141. package/dist/parser-qk9FIHJ7.mjs +0 -8
  142. package/dist/plugin-CX1OZ6jB.cjs +0 -73
  143. package/dist/plugin-CgfiWaFZ.mjs +0 -73
  144. package/dist/routes-BW6zsk7Z.mjs +0 -6
  145. package/dist/routes-BgoIB5wb.cjs +0 -6
  146. package/dist/routes-CORVxc02.cjs +0 -6
  147. package/dist/search-dialog-BmxHiKwt.js +0 -312
  148. package/dist/shiki-adapter-CoQ6jyJ4.cjs +0 -6
  149. package/dist/shiki-adapter-D-aKw7PP.mjs +0 -6
  150. package/dist/utils-Crm9oPcV.mjs +0 -7
  151. package/dist/utils-D6Xtj0FZ.cjs +0 -7
  152. /package/dist/{errors-0zGHRLue.mjs → errors-N-b6Sn2G.mjs} +0 -0
  153. /package/dist/{index-1KsTDq4o.d.mts → index-lFoyzCXy.d.mts} +0 -0
  154. /package/dist/{types-generator-BXhv7Ill.cjs → types-generator-DDSA93P3.cjs} +0 -0
  155. /package/dist/{types-generator-bDPvUztF.mjs → types-generator-DG1GX1EZ.mjs} +0 -0
@@ -1,9 +1,8 @@
1
1
 
2
- import * as React$2 from "react";
3
- import { ComponentType, ReactNode } from "react";
2
+ import * as _$react from "react";
3
+ import React$1, { ComponentType, ReactNode } from "react";
4
4
  import * as _$http from "http";
5
- import { Plugin } from "vite";
6
- import * as _$react_jsx_runtime0 from "react/jsx-runtime";
5
+ import { AliasOptions, Plugin, UserConfig } from "vite";
7
6
 
8
7
  //#region src/shared/types.d.ts
9
8
  /**
@@ -68,7 +67,7 @@ interface RouteMeta {
68
67
  /** The raw markdown content of the page */
69
68
  _rawContent?: string;
70
69
  /** Extracted SEO and Open Graph metadata from frontmatter */
71
- seo?: Record<string, any>;
70
+ seo?: Record<string, unknown>;
72
71
  /** The publication date */
73
72
  date?: string | Date;
74
73
  /** The last updated timestamp or date */
@@ -82,7 +81,7 @@ interface RouteMeta {
82
81
  /** Whether the page is hidden from the sidebar */
83
82
  sidebarHidden?: boolean;
84
83
  /** Raw extensible frontmatter data for custom components and formatters */
85
- frontmatter?: Record<string, any>;
84
+ frontmatter?: Record<string, unknown>;
86
85
  /** Optional recursive child routes for deep sidebar hierarchies */
87
86
  subRoutes?: RouteMeta[];
88
87
  /** Clean URL segments stripped of locale/version prefixes */
@@ -538,15 +537,98 @@ interface PluginServerAPI {
538
537
  * Connect-style middleware signature.
539
538
  */
540
539
  type PluginServerMiddleware = (req: _$http.IncomingMessage, res: _$http.ServerResponse, next: (err?: unknown) => void) => void | Promise<void>;
540
+ /**
541
+ * Standardized Search Document contract passed to search plugins.
542
+ */
543
+ interface SearchDocument {
544
+ id: string;
545
+ path: string;
546
+ title: string;
547
+ content: string;
548
+ headings: Array<{
549
+ level: number;
550
+ text: string;
551
+ id: string;
552
+ }>;
553
+ frontmatter: Record<string, unknown>;
554
+ locale?: string;
555
+ version?: string;
556
+ }
557
+ interface PluginHeadEntry {
558
+ tag: 'script' | 'link' | 'meta' | 'style';
559
+ attrs?: Record<string, string | boolean>;
560
+ content?: string;
561
+ }
562
+ /**
563
+ * Client-side configuration and UI slot injections for plugins.
564
+ */
565
+ interface PluginClientConfig {
566
+ /** Dynamic UI slot registrations (mapped to component file paths) */
567
+ slots?: Record<string, string>;
568
+ /** Top-level React provider component file paths */
569
+ providers?: string[];
570
+ /** MDX component overrides & additions */
571
+ mdxComponents?: Record<string, string>;
572
+ /** Head elements to inject into rendered HTML */
573
+ head?: PluginHeadEntry[];
574
+ }
541
575
  /**
542
576
  * Plugin lifecycle hooks with full type safety.
543
577
  */
544
578
  interface PluginLifecycleHooks {
579
+ /** Build hooks (Astro-style) */
580
+ 'build:before'?: (ctx: PluginContext) => Promise<void> | void;
581
+ 'build:after'?: (ctx: PluginContext) => Promise<void> | void;
582
+ 'build:end'?: (ctx: PluginContext) => Promise<void> | void;
583
+ 'build:generate'?: (ctx: PluginContext, params: {
584
+ routes: RouteMeta[];
585
+ outDir: string;
586
+ siteUrl?: string;
587
+ }) => void | Promise<void>;
588
+ /** Dev hooks (Astro-style) */
589
+ 'dev:before'?: (ctx: PluginContext) => Promise<void> | void;
590
+ 'dev:after'?: (ctx: PluginContext) => Promise<void> | void;
591
+ /** Transform hooks (Astro-style) */
592
+ 'transform:source'?: (ctx: PluginContext, params: TransformSourceParams) => TransformResult<{
593
+ code: string;
594
+ }> | Promise<TransformResult<{
595
+ code: string;
596
+ }>>;
597
+ 'transform:mdx'?: (ctx: PluginContext, params: TransformSourceParams) => TransformResult<{
598
+ code: string;
599
+ }> | Promise<TransformResult<{
600
+ code: string;
601
+ }>>;
602
+ 'transform:html'?: (ctx: PluginContext, params: TransformHtmlParams) => TransformResult<{
603
+ html: string;
604
+ }> | Promise<TransformResult<{
605
+ html: string;
606
+ }>>;
607
+ /** Dynamic frontmatter transformation hook */
608
+ 'frontmatter:transform'?: (ctx: PluginContext, params: {
609
+ frontmatter: Record<string, unknown>;
610
+ filePath: string;
611
+ rawContent: string;
612
+ }) => Record<string, unknown> | Promise<Record<string, unknown>> | undefined;
613
+ /** Fired after routes are crawled, normalized, and resolved */
614
+ 'routes:resolved'?: (ctx: PluginContext, params: {
615
+ routes: RouteMeta[];
616
+ }) => RouteMeta[] | Promise<RouteMeta[]> | undefined;
617
+ /** Agnostic search index hook: core passes SearchDocument[], plugin returns index payload */
618
+ 'search:index'?: (ctx: PluginContext, params: {
619
+ documents: SearchDocument[];
620
+ routes: RouteMeta[];
621
+ }) => unknown | Promise<unknown>;
622
+ 'server:configure'?: (ctx: PluginContext, params: {
623
+ server: unknown;
624
+ middleware: PluginServerAPI;
625
+ }) => void | Promise<void>;
626
+ /** Legacy alias hooks for backwards compatibility */
545
627
  beforeBuild?: (ctx: PluginContext) => Promise<void> | void;
546
628
  afterBuild?: (ctx: PluginContext) => Promise<void> | void;
629
+ buildEnd?: (ctx: PluginContext) => Promise<void> | void;
547
630
  beforeDev?: (ctx: PluginContext) => Promise<void> | void;
548
631
  afterDev?: (ctx: PluginContext) => Promise<void> | void;
549
- buildEnd?: (ctx: PluginContext) => Promise<void> | void;
550
632
  transformSource?: (ctx: PluginContext, params: TransformSourceParams) => TransformResult<{
551
633
  code: string;
552
634
  }> | Promise<TransformResult<{
@@ -568,14 +650,20 @@ interface PluginLifecycleHooks {
568
650
  * When `processor` is set to 'satteri', the Sätteri Rust-based compiler is used.
569
651
  */
570
652
  interface BoltdocsMdxConfig {
571
- processor?: 'unified' | 'satteri';
653
+ processor?: 'satteri';
572
654
  }
573
655
  /**
574
656
  * Defines a Boltdocs plugin.
575
657
  *
576
- * Use the `createPlugin()` helper from the node API for full type safety and
577
- * access to lifecycle hooks.
578
- */
658
+ * Use the `definePlugin()` or `createPlugin()` helper from the node API for full
659
+ * type safety and access to lifecycle hooks.
660
+ */
661
+ interface PluginCssConfig {
662
+ cssFiles?: string[];
663
+ headStyles?: string[];
664
+ postcssPlugins?: unknown[];
665
+ preprocessorOptions?: Record<string, unknown>;
666
+ }
579
667
  interface BoltdocsPlugin {
580
668
  name: string;
581
669
  enforce?: 'pre' | 'post';
@@ -585,11 +673,10 @@ interface BoltdocsPlugin {
585
673
  rehypePlugins?: unknown[];
586
674
  vitePlugins?: Plugin[];
587
675
  components?: Record<string, string>;
588
- /** Optional runtime metadata exposed to client via useConfig().plugins[].metadata */
676
+ client?: PluginClientConfig;
589
677
  metadata?: Record<string, unknown>;
590
- /** Declarative transform middleware entries. */
678
+ css?: PluginCssConfig;
591
679
  middleware?: PluginTransformMiddleware[];
592
- /** Lifecycle hooks with full type safety */
593
680
  hooks?: PluginLifecycleHooks;
594
681
  }
595
682
  /**
@@ -613,6 +700,12 @@ interface BoltdocsVerificationConfig {
613
700
  /**
614
701
  * Configuration for SEO.
615
702
  */
703
+ type JsonLdPrimitive = string | number | boolean | null;
704
+ type JsonLdValue = JsonLdPrimitive | JsonLdObject | JsonLdValue[];
705
+ interface JsonLdObject {
706
+ [key: string]: JsonLdValue | undefined;
707
+ }
708
+ type StructuredData = JsonLdObject | JsonLdObject[];
616
709
  interface BoltdocsSeoConfig {
617
710
  metatags?: Record<string, string>;
618
711
  indexing?: 'all' | 'public';
@@ -620,6 +713,20 @@ interface BoltdocsSeoConfig {
620
713
  background?: string;
621
714
  };
622
715
  verification?: BoltdocsVerificationConfig;
716
+ /** Global JSON-LD graph emitted in every page head. */
717
+ structuredData?: StructuredData;
718
+ }
719
+ interface BoltdocsViewTransitionsConfig {
720
+ /** Native document transitions are enabled when true. */
721
+ enabled?: boolean;
722
+ /** Optional transition types passed to `document.startViewTransition`. */
723
+ types?: string[];
724
+ }
725
+ interface BoltdocsExperimentalConfig {
726
+ /** Enables the native View Transition API integration. */
727
+ viewTransitions?: boolean | BoltdocsViewTransitionsConfig;
728
+ /** Enables static file-routing under `docs/pages-external/`. */
729
+ fileRouting?: boolean;
623
730
  }
624
731
  /**
625
732
  * Configuration for Google Analytics 4 (GA4).
@@ -708,6 +815,13 @@ interface BoltdocsIntegrationsConfig {
708
815
  custom?: BoltdocsCustomFeedbackConfig;
709
816
  };
710
817
  }
818
+ /**
819
+ * Configuration for static site generation.
820
+ */
821
+ interface BoltdocsSsgConfig {
822
+ /** Critical CSS strategy; `none` disables critical CSS processing. */
823
+ criticalCss?: 'zig-critters' | 'beasties' | 'none';
824
+ }
711
825
  /**
712
826
  * Configuration for drafts visibility control.
713
827
  */
@@ -728,6 +842,7 @@ interface BoltdocsConfig {
728
842
  i18n?: BoltdocsI18nConfig;
729
843
  versions?: BoltdocsVersionsConfig;
730
844
  mdx?: BoltdocsMdxConfig;
845
+ ssg?: BoltdocsSsgConfig;
731
846
  plugins?: BoltdocsPlugin[];
732
847
  collections?: BoltdocsCollectionsConfig;
733
848
  robots?: BoltdocsRobotsConfig;
@@ -736,8 +851,10 @@ interface BoltdocsConfig {
736
851
  integrations?: BoltdocsIntegrationsConfig;
737
852
  drafts?: BoltdocsDraftsConfig;
738
853
  featureFlags?: Record<string, boolean | string>;
854
+ experimental?: BoltdocsExperimentalConfig;
739
855
  directoryMeta?: Record<string, unknown>;
740
- vite?: unknown;
856
+ aliases?: AliasOptions;
857
+ vite?: UserConfig;
741
858
  }
742
859
  /**
743
860
  * Global namespace for Boltdocs types that can be augmented by generated code.
@@ -756,7 +873,8 @@ declare global {
756
873
  }
757
874
  type BoltdocsTypes = Boltdocs.Types;
758
875
  type BoltdocsRoutePath = keyof Boltdocs.RoutePaths;
759
- type BoltdocsRoutePathWithFallback = BoltdocsRoutePath extends never ? string : BoltdocsRoutePath;
876
+ type ExternalRouteReference = `/${string}` | `#${string}` | `?${string}` | `site:/${string}` | `site:${string}` | `http://${string}` | `https://${string}` | `//${string}`;
877
+ type BoltdocsRoutePathWithFallback = BoltdocsRoutePath | ExternalRouteReference | string;
760
878
  type BoltdocsLocale = Boltdocs.Types extends {
761
879
  Locale: infer L;
762
880
  } ? L : string;
@@ -771,330 +889,229 @@ type TransformMdxComponents<T> = { [K in keyof T as K extends `Frontmatter_${str
771
889
  };
772
890
  type BoltdocsMdxComponents = Boltdocs.Types extends {
773
891
  MdxComponents: infer M;
774
- } ? TransformMdxComponents<UnpackMdxComponents<M>> : Omit<Record<string, ComponentType<any>>, 'Frontmatter'> & {
775
- Frontmatter: Record<string, ComponentType<any>>;
892
+ } ? TransformMdxComponents<UnpackMdxComponents<M>> : Omit<Record<string, ComponentType<unknown>>, 'Frontmatter'> & {
893
+ Frontmatter: Record<string, ComponentType<unknown>>;
776
894
  };
777
895
  //#endregion
778
- //#region src/client/types.d.ts
779
- /**
780
- * Metadata provided by the server for a specific route.
781
- * Maps closely to the `RouteMeta` type in the Node environment.
782
- */
783
- interface ComponentRoute {
784
- /** The final URL path */
785
- path: string;
786
- /** The absolute filesystem path of the source file */
787
- componentPath: string;
788
- /** The page title */
789
- title: string;
790
- /** Explicit order in the sidebar */
791
- sidebarPosition?: number;
792
- /** The relative path from the docs directory */
793
- filePath: string;
794
- /** The group directory name */
795
- group?: string;
796
- /** The display title of the group */
797
- groupTitle?: string;
798
- /** Explicit order of the group in the sidebar */
799
- groupPosition?: number;
800
- /** Extracted markdown headings for search indexing */
801
- headings?: {
802
- level: number;
803
- text: string;
804
- id: string;
805
- }[];
806
- /** The page summary or description */
807
- description?: string;
808
- /** The locale this route belongs to, if i18n is configured */
809
- locale?: string;
810
- /** The version this route belongs to, if versioning is configured */
811
- version?: string;
812
- /** Optional icon to display (Lucide icon name or raw SVG) */
813
- icon?: string;
814
- /** The tab this route belongs to, if tabs are configured */
815
- tab?: string;
816
- /** Optional badge to display next to the sidebar item */
817
- badge?: BadgeValue;
818
- /** Optional icon for the route's group */
819
- groupIcon?: string;
820
- /** The sub-route group this route belongs to (from folders starting with _) */
821
- subRouteGroup?: string;
822
- /** The nested sub-routes if this route acts as the parent of a subRouteGroup */
823
- subRoutes?: ComponentRoute[];
824
- /** Internal helper map for nesting routes during sidebar construction */
825
- _subMap?: Map<string, ComponentRoute>;
826
- /** The extracted plain-text content of the page for search indexing */
827
- _content?: string;
828
- /** The raw markdown content of the page */
829
- _rawContent?: string;
830
- /** The publication date */
831
- date?: string | Date;
832
- /** The last updated timestamp or date */
833
- lastUpdated?: string | number | Date;
834
- /** The collection this route belongs to (from [name] directories) */
835
- collection?: string;
836
- /** Tags for blog posts */
837
- tags?: string[];
838
- /** Author identifier for blog posts */
839
- author?: string | {
840
- name: string;
841
- avatar?: string;
842
- url?: string;
843
- image?: string;
844
- };
845
- /** Draft flag */
846
- draft?: boolean;
847
- /** Feature flags required for this page to be visible */
848
- featureFlags?: string[];
849
- /** Short excerpt for list displays */
850
- excerpt?: string;
851
- /** Cover image for blog posts */
852
- coverImage?: string;
853
- /** Optional explicit order (alternative to sidebarPosition) */
854
- order?: number;
855
- /** Optional explicit label for the sidebar */
856
- sidebarLabel?: string;
857
- /** Optional category for the page */
858
- category?: string;
859
- /** Whether the page is hidden from the sidebar */
860
- sidebarHidden?: boolean;
861
- /**
862
- * Optional nested child routes for sidebar hierarchies that mirror the
863
- * server-side `RouteMeta.subRoutes` shape. `sidebar.tsx` walks this
864
- * field to render the group → subRoutes → items tree.
865
- */
866
- routes?: ComponentRoute[];
867
- /** Raw extensible frontmatter data for custom components and formatters */
868
- frontmatter?: Record<string, unknown>;
869
- /** Clean URL segments stripped of locale/version prefixes */
870
- slugParts?: string[];
871
- /** SEO metadata for page headers */
872
- seo?: Record<string, unknown>;
873
- /** Flag to indicate if this is a fallback redirect route */
874
- fallback?: boolean;
896
+ //#region src/client/router/types.d.ts
897
+ interface LoaderFunctionArgs {
898
+ request: Request;
899
+ params: Record<string, string>;
875
900
  }
876
- /**
877
- * Site configuration provided by the server.
878
- */
879
- type SiteConfig = BoltdocsConfig;
880
- /**
881
- * Tab configuration for the documentation site.
882
- */
883
- interface BoltdocsTab {
884
- id: string;
885
- /** Text to display (can be a string or a map of translations) */
886
- text: string | Record<string, string>;
887
- icon?: string;
901
+ type LoaderFunction<T = unknown> = (args: LoaderFunctionArgs) => Promise<T> | T;
902
+ type PrefetchFunction$1 = (to: string) => Promise<void>;
903
+ interface RouteMatch {
904
+ route: RouteRecord;
905
+ params: Record<string, string>;
906
+ pathname: string;
907
+ pathnameBase: string;
908
+ data?: Record<string, unknown>;
888
909
  }
889
- /**
890
- * Props for the Sidebar component.
891
- */
892
- interface SidebarProps {
893
- routes: ComponentRoute[];
894
- config: BoltdocsConfig;
910
+ interface LazyRouteResult {
911
+ Component?: ComponentType<any>;
912
+ element?: ReactNode;
913
+ loader?: LoaderFunction;
914
+ ErrorBoundary?: ComponentType<any>;
895
915
  }
896
- /**
897
- * Props for the OnThisPage (TOC) component.
898
- */
899
- interface OnThisPageProps {
900
- headings?: {
901
- level: number;
902
- text: string;
903
- id: string;
904
- }[];
905
- editLink?: string;
906
- communityHelp?: string;
907
- filePath?: string;
916
+ /** Structurally compatible with react-router-dom's route objects */
917
+ interface RouteRecord {
918
+ path?: string;
919
+ index?: boolean;
920
+ id?: string;
921
+ element?: ReactNode;
922
+ Component?: ComponentType<any>;
923
+ loader?: LoaderFunction;
924
+ action?: (...args: any[]) => any;
925
+ ErrorBoundary?: ComponentType<any>;
926
+ hasErrorBoundary?: boolean;
927
+ HydrateFallback?: ComponentType<any>;
928
+ children?: RouteRecord[];
929
+ lazy?: () => Promise<LazyRouteResult>;
930
+ caseSensitive?: boolean;
931
+ shouldRevalidate?: (...args: any[]) => boolean;
932
+ getStaticPaths?: () => string[] | Promise<string[]>;
933
+ entry?: string;
934
+ /** Locale this route belongs to (used by i18n fallbacks) */
935
+ locale?: string;
908
936
  }
909
- /**
910
- * Props for the Tabs component.
911
- */
912
- interface TabsProps {
913
- tabs: BoltdocsTab[];
914
- routes: ComponentRoute[];
937
+ interface RouterOptions {
938
+ routes: RouteRecord[];
939
+ basename?: string;
940
+ future?: Record<string, boolean>;
915
941
  }
916
- /**
917
- * Props for user-defined layout components (layout.tsx).
918
- */
919
- interface LayoutProps {
920
- children: React$2.ReactNode;
942
+ interface RouteRendererProps {
943
+ routes: RouteRecord[];
944
+ pathname?: string;
945
+ loaderData?: Record<string, unknown> | null;
946
+ /** Whether loaderData was explicitly produced for the initial SSR route. */
947
+ hasLoaderData?: boolean;
948
+ /** Resolved branch supplied by SSR so lazy MDX routes render without effects. */
949
+ resolvedBranch?: RouteRecord[];
950
+ basename?: string;
951
+ /** Default locale is omitted from external URLs. */
952
+ defaultLocale?: string;
953
+ /** Optional route prefetcher used by Link hover/focus interactions. */
954
+ prefetch?: PrefetchFunction$1;
955
+ /** Enables native View Transitions for route updates. */
956
+ viewTransitions?: boolean | {
957
+ enabled?: boolean;
958
+ types?: string[];
959
+ };
921
960
  }
922
- /**
923
- * Unified type for navbar links.
924
- */
925
- interface NavbarLink {
926
- label: string | Record<string, string>;
927
- href: BoltdocsRoutePathWithFallback;
928
- active: boolean;
929
- to?: string;
930
- items?: NavbarLink[];
961
+ interface CreateRoutesResult {
962
+ routes: RouteRecord[];
963
+ RouteRenderer: ComponentType<RouteRendererProps>;
964
+ matchRouteBranch: (routes: RouteRecord[], pathname: string) => RouteRecord[];
965
+ matchRouteBranchWithParams: (routes: RouteRecord[], pathname: string, basename?: string) => Array<{
966
+ route: RouteRecord;
967
+ params: Record<string, string>;
968
+ }>;
969
+ resolveRouteBranch: (branch: RouteRecord[]) => Promise<RouteRecord[]>;
931
970
  }
932
- /**
933
- * Shape of the data returned by a collection post route loader.
934
- * Consumed by `BlogPost` via `useLoaderData<CollectionPostLoaderData>()`.
935
- */
936
- interface CollectionPostLoaderData {
937
- /** Full route metadata for this post (title, date, author, tags, etc.) */
938
- route: ComponentRoute;
939
- /** The name of the collection this post belongs to (e.g. 'blog') */
940
- collection: string;
941
- /** Extracted page headings for the Table of Contents */
942
- headings: {
943
- level: number;
944
- text: string;
945
- id: string;
946
- }[];
971
+ //#endregion
972
+ //#region src/client/router/context.d.ts
973
+ interface LocationState {
974
+ pathname: string;
975
+ search: string;
976
+ hash: string;
947
977
  }
948
- /**
949
- * Shape of the data returned by a collection listing route loader.
950
- * Consumed by `BlogList` via `useLoaderData<CollectionListLoaderData>()`.
951
- */
952
- interface CollectionListLoaderData {
953
- /** Paginated subset of posts to display on this page */
954
- posts: Array<{
955
- path: string;
956
- title: string;
957
- date?: string | Date;
958
- excerpt?: string;
959
- tags?: string[];
960
- author?: string;
961
- coverImage?: string;
962
- filePath: string;
963
- }>;
964
- /** Total number of pages available */
965
- totalPages: number;
966
- /** Current page index (1-based) */
967
- currentPage: number;
968
- /** Collection name used to build pagination URLs (e.g. 'blog' → '/blog/page/2') */
969
- collection: string;
978
+ type PrefetchFunction = (to: string) => Promise<void>;
979
+ type NavigateFunction = (to: string, options?: {
980
+ replace?: boolean;
981
+ state?: unknown; /** Disable the router transition when an outer transition owns the update. */
982
+ viewTransition?: boolean;
983
+ }) => void;
984
+ declare const defaultNavigate: NavigateFunction;
985
+ declare const LocationContext: _$react.Context<LocationState>;
986
+ declare const NavigateContext: _$react.Context<NavigateFunction>;
987
+ declare const PrefetchContext: _$react.Context<PrefetchFunction>;
988
+ declare const RouteDataContext: _$react.Context<Record<string, unknown> | null>;
989
+ declare const MatchesContext: _$react.Context<RouteMatch[]>;
990
+ interface LocationProviderProps {
991
+ pathname?: string;
992
+ children: React.ReactNode;
993
+ loaderData?: Record<string, unknown> | null;
994
+ matches?: RouteMatch[];
995
+ /** Base path of the application. Only links under this path are handled as SPA navigation. */
996
+ basename?: string;
997
+ /** Default locale is omitted from external URLs. */
998
+ defaultLocale?: string;
999
+ /** Optional route prefetcher used by Link hover/focus interactions. */
1000
+ prefetch?: PrefetchFunction;
1001
+ /** Enables the native View Transition API for route updates. */
1002
+ viewTransitions?: boolean | {
1003
+ enabled?: boolean;
1004
+ types?: string[];
1005
+ };
970
1006
  }
1007
+ declare const LocationProvider: React.FC<LocationProviderProps>;
971
1008
  //#endregion
972
- //#region src/client/components/primitives/types.d.ts
973
- type ComponentBase = {
974
- className?: string;
975
- children?: ReactNode;
976
- };
1009
+ //#region src/client/router/hooks.d.ts
1010
+ declare function useLocation(): LocationState;
1011
+ declare function useNavigate(): NavigateFunction;
1012
+ declare function usePrefetch(): (to: string) => Promise<void>;
1013
+ declare function useRouteData<T = Record<string, unknown>>(): T;
1014
+ /** Alias for useRouteData — parity with react-router-dom's useLoaderData */
1015
+ declare function useLoaderData<T = Record<string, unknown>>(): T;
1016
+ declare function useMatches(): RouteMatch[];
977
1017
  //#endregion
978
- //#region src/client/components/primitives/sidebar.d.ts
979
- /**
980
- * Desktop Sidebar Container
981
- */
982
- declare function SidebarRoot({
983
- children,
984
- className
985
- }: ComponentBase): _$react_jsx_runtime0.JSX.Element;
986
- /**
987
- * Mobile Sidebar Modal
988
- */
989
- declare function SidebarMobile({
990
- children,
991
- className
992
- }: ComponentBase): _$react_jsx_runtime0.JSX.Element;
993
- /**
994
- * Shared Header for Sidebar
995
- */
996
- declare function SidebarHeader({
997
- children,
998
- className
999
- }: ComponentBase): _$react_jsx_runtime0.JSX.Element;
1000
- /**
1001
- * Scrollable Content Wrapper
1002
- */
1003
- declare function SidebarContent({
1004
- children,
1005
- className
1006
- }: ComponentBase): _$react_jsx_runtime0.JSX.Element;
1007
- /**
1008
- * Navigation Group
1009
- */
1010
- declare function SidebarGroup({
1011
- title,
1012
- icon: Icon,
1013
- children,
1014
- className,
1015
- collapsible,
1016
- collapsed,
1017
- active
1018
- }: {
1019
- title?: string;
1020
- icon?: React.ElementType;
1021
- collapsible?: boolean;
1022
- collapsed?: boolean;
1023
- active?: boolean;
1024
- } & ComponentBase): _$react_jsx_runtime0.JSX.Element;
1025
- /**
1026
- * Sidebar Link
1027
- */
1028
- interface SidebarLinkProps extends ComponentBase {
1029
- label: string;
1030
- href: BoltdocsRoutePathWithFallback;
1031
- active?: boolean;
1032
- icon?: React.ElementType;
1033
- badge?: ComponentRoute['badge'];
1034
- }
1035
- declare function SidebarLink({
1036
- label,
1037
- href,
1038
- active,
1039
- icon: Icon,
1040
- badge,
1041
- className
1042
- }: SidebarLinkProps): _$react_jsx_runtime0.JSX.Element;
1043
- /**
1044
- * Nested SubGroup
1045
- */
1046
- declare function SidebarSubGroup({
1047
- label,
1048
- href,
1049
- active,
1050
- icon: Icon,
1051
- badge,
1052
- isOpen,
1053
- onToggle,
1054
- children,
1055
- className
1056
- }: SidebarLinkProps & {
1057
- isOpen: boolean;
1058
- onToggle: () => void;
1059
- children: ReactNode;
1060
- }): _$react_jsx_runtime0.JSX.Element;
1061
- /**
1062
- * Automated single-route rendering primitive
1063
- */
1064
- interface SidebarItemProps extends ComponentBase {
1065
- route: ComponentRoute;
1066
- activePath: string;
1067
- activeRoute?: ComponentRoute;
1068
- }
1069
- declare function SidebarItem({
1070
- route,
1071
- activePath,
1072
- activeRoute,
1073
- className
1074
- }: SidebarItemProps): _$react_jsx_runtime0.JSX.Element;
1075
- /**
1076
- * High-level automated routes data rendering primitive
1077
- */
1078
- interface SidebarItemsProps extends ComponentBase {
1079
- routes: ComponentRoute[];
1018
+ //#region src/client/router/outlet.d.ts
1019
+ declare const OutletContext: _$react.Context<_$react.ReactNode>;
1020
+ declare const Outlet: React.FC;
1021
+ //#endregion
1022
+ //#region src/client/router/renderer.d.ts
1023
+ interface RouteBranchMatch {
1024
+ route: RouteRecord;
1025
+ params: Record<string, string>;
1080
1026
  }
1081
- declare function SidebarItems({
1082
- routes,
1083
- className
1084
- }: SidebarItemsProps): _$react_jsx_runtime0.JSX.Element;
1085
- /**
1086
- * Main Sidebar Export
1087
- */
1088
- declare const Sidebar: typeof SidebarRoot & {
1089
- Root: typeof SidebarRoot;
1090
- Mobile: typeof SidebarMobile;
1091
- Header: typeof SidebarHeader;
1092
- Content: typeof SidebarContent;
1093
- Group: typeof SidebarGroup;
1094
- Link: typeof SidebarLink;
1095
- SubGroup: typeof SidebarSubGroup;
1096
- Item: typeof SidebarItem;
1097
- Items: typeof SidebarItems;
1027
+ declare function matchRouteBranchWithParams(routes: RouteRecord[], pathname: string, basename?: string): RouteBranchMatch[];
1028
+ declare function matchRouteBranch(routes: RouteRecord[], pathname: string, basename?: string): RouteRecord[];
1029
+ declare function resolveRouteBranch(branch: RouteRecord[]): Promise<RouteRecord[]>;
1030
+ declare const RouteRenderer: React$1.FC<RouteRendererProps>;
1031
+ //#endregion
1032
+ //#region src/client/router/utils.d.ts
1033
+ declare function normalizeBasename(basename?: string): string;
1034
+ declare function hasBasename(path: string, basename: string): boolean;
1035
+ declare function stripBasename(path: string, basename: string): string;
1036
+ declare function addBasename(path: string, basename: string): string;
1037
+ //#endregion
1038
+ //#region src/client/router/url-contract.d.ts
1039
+ type UrlRouteKind = 'doc' | 'external' | 'collection';
1040
+ interface UrlContractConfig {
1041
+ base?: string;
1042
+ i18n?: Pick<BoltdocsI18nConfig, 'defaultLocale' | 'locales'>;
1043
+ versions?: Pick<BoltdocsVersionsConfig, 'defaultVersion' | 'prefix' | 'versions'>;
1044
+ collections?: readonly string[] | BoltdocsCollectionsConfig;
1045
+ }
1046
+ interface UrlRouteHint {
1047
+ path: string;
1048
+ kind?: UrlRouteKind;
1049
+ collection?: string;
1050
+ }
1051
+ interface ParsedUrl {
1052
+ /** The normalized pathname, without query string or hash. */
1053
+ pathname: string;
1054
+ /** The normalized route content after removing structural prefixes. */
1055
+ routePath: string;
1056
+ /** Query string including `?`, when present. */
1057
+ search: string;
1058
+ /** Hash including `#`, when present. */
1059
+ hash: string;
1060
+ kind: UrlRouteKind;
1061
+ locale?: string;
1062
+ version?: string;
1063
+ collection?: string;
1064
+ /** Whether the input used the explicit `site:` protocol. */
1065
+ siteProtocol: boolean;
1066
+ /** Whether the input pathname contained the configured documentation base. */
1067
+ hadBase: boolean;
1068
+ }
1069
+ interface BuildUrlOptions {
1070
+ kind: UrlRouteKind;
1071
+ /** Route content, e.g. `/guides/start`, `/about`, or `/my-post`. */
1072
+ path?: string;
1073
+ locale?: string;
1074
+ version?: string;
1075
+ collection?: string;
1076
+ search?: string;
1077
+ hash?: string;
1078
+ /** The input pathname already contained the configured base. */
1079
+ hadBase?: boolean;
1080
+ }
1081
+ interface ResolveUrlOptions {
1082
+ /** Explicitly choose the route family when the path is ambiguous. */
1083
+ kind?: UrlRouteKind;
1084
+ /** Known route metadata used to classify paths outside `base`. */
1085
+ routes?: readonly UrlRouteHint[];
1086
+ /** Locale/version to apply when building a canonical target. */
1087
+ locale?: string;
1088
+ version?: string;
1089
+ }
1090
+ declare function normalizeUrlBase(base?: string): string;
1091
+ declare function normalizeUrlPath(path: string): string;
1092
+ declare function hasUrlBase(pathname: string, base?: string): boolean;
1093
+ declare function stripUrlBase(pathname: string, base?: string): string;
1094
+ declare function addUrlBase(pathname: string, base?: string): string;
1095
+ declare function getConfiguredLocales(config: UrlContractConfig): string[];
1096
+ declare function getConfiguredVersions(config: UrlContractConfig): string[];
1097
+ declare function getVersionPrefixSegments(config: UrlContractConfig): string[];
1098
+ declare function getVersionSegments(version: string | undefined, config: UrlContractConfig): string[];
1099
+ declare function isConfiguredLocale(value: string | undefined, config: UrlContractConfig): value is string;
1100
+ declare function isConfiguredVersion(value: string | undefined, config: UrlContractConfig): value is string;
1101
+ declare function splitUrlReference(to: string): {
1102
+ pathname: string;
1103
+ search: string;
1104
+ hash: string;
1105
+ };
1106
+ declare function stripSiteProtocol(to: string): {
1107
+ value: string;
1108
+ siteProtocol: boolean;
1098
1109
  };
1110
+ /** Returns true for URI schemes such as `mailto:`, `tel:`, or `data:`. */
1111
+ declare function hasUriScheme(value: string): boolean;
1112
+ declare function classifyUrlPath(pathname: string, config: UrlContractConfig, options?: Pick<ResolveUrlOptions, 'kind' | 'routes'>): UrlRouteKind;
1113
+ declare function parseUrlReference(to: string, config: UrlContractConfig, options?: Pick<ResolveUrlOptions, 'kind' | 'routes'>): ParsedUrl;
1114
+ declare function buildUrl(options: BuildUrlOptions, config: UrlContractConfig): string;
1115
+ declare function resolveUrlReference(to: string, config: UrlContractConfig, options?: ResolveUrlOptions): string;
1099
1116
  //#endregion
1100
- export { BoltdocsRoutePathWithFallback as A, SiteConfig as C, BoltdocsLocale as D, BoltdocsIntegrationsConfig as E, BoltdocsTypes as M, BoltdocsVersion as N, BoltdocsMdxComponents as O, SidebarProps as S, BoltdocsConfig as T, CollectionPostLoaderData as _, SidebarItem as a, NavbarLink as b, SidebarItemsProps as c, SidebarMobile as d, SidebarRoot as f, CollectionListLoaderData as g, BoltdocsTab as h, SidebarHeader as i, BoltdocsSocialLink as j, BoltdocsRoutePath as k, SidebarLink as l, ComponentBase as m, SidebarContent as n, SidebarItemProps as o, SidebarSubGroup as p, SidebarGroup as r, SidebarItems as s, Sidebar as t, SidebarLinkProps as u, ComponentRoute as v, TabsProps as w, OnThisPageProps as x, LayoutProps as y };
1117
+ export { LazyRouteResult as $, matchRouteBranch as A, useRouteData as B, stripSiteProtocol as C, normalizeBasename as D, hasBasename as E, useLoaderData as F, MatchesContext as G, LocationProvider as H, useLocation as I, PrefetchContext as J, NavigateContext as K, useMatches as L, resolveRouteBranch as M, Outlet as N, stripBasename as O, OutletContext as P, CreateRoutesResult as Q, useNavigate as R, splitUrlReference as S, addBasename as T, LocationProviderProps as U, LocationContext as V, LocationState as W, RouteDataContext as X, PrefetchFunction as Y, defaultNavigate as Z, isConfiguredVersion as _, StructuredData as _t, UrlRouteHint as a, RouterOptions as at, parseUrlReference as b, buildUrl as c, BoltdocsIntegrationsConfig as ct, getConfiguredVersions as d, BoltdocsRoutePath as dt, LoaderFunction as et, getVersionPrefixSegments as f, BoltdocsRoutePathWithFallback as ft, isConfiguredLocale as g, JsonLdObject as gt, hasUrlBase as h, BoltdocsVersion as ht, UrlContractConfig as i, RouteRendererProps as it, matchRouteBranchWithParams as j, RouteRenderer as k, classifyUrlPath as l, BoltdocsLocale as lt, hasUriScheme as m, BoltdocsTypes as mt, ParsedUrl as n, RouteMatch as nt, UrlRouteKind as o, BadgeValue as ot, getVersionSegments as p, BoltdocsSocialLink as pt, NavigateFunction as q, ResolveUrlOptions as r, RouteRecord as rt, addUrlBase as s, BoltdocsConfig as st, BuildUrlOptions as t, LoaderFunctionArgs as tt, getConfiguredLocales as u, BoltdocsMdxComponents as ut, normalizeUrlBase as v, stripUrlBase as w, resolveUrlReference as x, normalizeUrlPath as y, usePrefetch as z };