@hanzo/docs-core 16.2.5 → 16.4.2

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 (279) hide show
  1. package/dist/advanced-CEwMef7q.js +80 -0
  2. package/dist/advanced-CEwMef7q.js.map +1 -0
  3. package/dist/algolia-BrWPzYE_.js +49 -0
  4. package/dist/algolia-BrWPzYE_.js.map +1 -0
  5. package/dist/algolia-CBBN8R6-.d.ts +68 -0
  6. package/dist/algolia-CBBN8R6-.d.ts.map +1 -0
  7. package/dist/breadcrumb.d.ts +29 -27
  8. package/dist/breadcrumb.d.ts.map +1 -0
  9. package/dist/breadcrumb.js +55 -72
  10. package/dist/breadcrumb.js.map +1 -0
  11. package/dist/chunk-B-ezknvj.js +42 -0
  12. package/dist/codeblock-utils-lld8UiQo.d.ts +37 -0
  13. package/dist/codeblock-utils-lld8UiQo.d.ts.map +1 -0
  14. package/dist/content/github.d.ts +43 -32
  15. package/dist/content/github.d.ts.map +1 -0
  16. package/dist/content/github.js +29 -43
  17. package/dist/content/github.js.map +1 -0
  18. package/dist/content/index.d.ts +20 -13
  19. package/dist/content/index.d.ts.map +1 -0
  20. package/dist/content/index.js +17 -23
  21. package/dist/content/index.js.map +1 -0
  22. package/dist/content/mdx/preset-bundler.d.ts +22 -24
  23. package/dist/content/mdx/preset-bundler.d.ts.map +1 -0
  24. package/dist/content/mdx/preset-bundler.js +38 -69
  25. package/dist/content/mdx/preset-bundler.js.map +1 -0
  26. package/dist/content/mdx/preset-runtime.d.ts +22 -24
  27. package/dist/content/mdx/preset-runtime.d.ts.map +1 -0
  28. package/dist/content/mdx/preset-runtime.js +36 -68
  29. package/dist/content/mdx/preset-runtime.js.map +1 -0
  30. package/dist/content/toc.d.ts +7 -6
  31. package/dist/content/toc.d.ts.map +1 -0
  32. package/dist/content/toc.js +15 -19
  33. package/dist/content/toc.js.map +1 -0
  34. package/dist/definitions-DuxDer_c.d.ts +62 -0
  35. package/dist/definitions-DuxDer_c.d.ts.map +1 -0
  36. package/dist/dynamic-link.d.ts +7 -5
  37. package/dist/dynamic-link.d.ts.map +1 -0
  38. package/dist/dynamic-link.js +29 -27
  39. package/dist/dynamic-link.js.map +1 -0
  40. package/dist/fetch-B5e9CFfN.js +20 -0
  41. package/dist/fetch-B5e9CFfN.js.map +1 -0
  42. package/dist/framework/index.d.ts +38 -29
  43. package/dist/framework/index.d.ts.map +1 -0
  44. package/dist/framework/index.js +68 -17
  45. package/dist/framework/index.js.map +1 -0
  46. package/dist/framework/next.d.ts +15 -10
  47. package/dist/framework/next.d.ts.map +1 -0
  48. package/dist/framework/next.js +18 -26
  49. package/dist/framework/next.js.map +1 -0
  50. package/dist/framework/react-router.d.ts +15 -10
  51. package/dist/framework/react-router.d.ts.map +1 -0
  52. package/dist/framework/react-router.js +42 -55
  53. package/dist/framework/react-router.js.map +1 -0
  54. package/dist/framework/tanstack.d.ts +15 -10
  55. package/dist/framework/tanstack.d.ts.map +1 -0
  56. package/dist/framework/tanstack.js +54 -69
  57. package/dist/framework/tanstack.js.map +1 -0
  58. package/dist/framework/waku.d.ts +15 -10
  59. package/dist/framework/waku.d.ts.map +1 -0
  60. package/dist/framework/waku.js +47 -58
  61. package/dist/framework/waku.js.map +1 -0
  62. package/dist/highlight/client.d.ts +6 -7
  63. package/dist/highlight/client.d.ts.map +1 -0
  64. package/dist/highlight/client.js +22 -14
  65. package/dist/highlight/client.js.map +1 -0
  66. package/dist/highlight/index.d.ts +2 -30
  67. package/dist/highlight/index.js +3 -13
  68. package/dist/i18n/index.d.ts +2 -39
  69. package/dist/i18n/index.js +6 -7
  70. package/dist/i18n/index.js.map +1 -0
  71. package/dist/i18n/middleware.d.ts +36 -28
  72. package/dist/i18n/middleware.d.ts.map +1 -0
  73. package/dist/i18n/middleware.js +55 -73
  74. package/dist/i18n/middleware.js.map +1 -0
  75. package/dist/icon-Ds1OCIhh.js +19 -0
  76. package/dist/icon-Ds1OCIhh.js.map +1 -0
  77. package/dist/index-2U6Tl4--.d.ts +379 -0
  78. package/dist/index-2U6Tl4--.d.ts.map +1 -0
  79. package/dist/index-Bw-DCOra.d.ts +41 -0
  80. package/dist/index-Bw-DCOra.d.ts.map +1 -0
  81. package/dist/link.d.ts +17 -15
  82. package/dist/link.d.ts.map +1 -0
  83. package/dist/link.js +29 -9
  84. package/dist/link.js.map +1 -0
  85. package/dist/mdast-utils-mc9-X-PK.js +40 -0
  86. package/dist/mdast-utils-mc9-X-PK.js.map +1 -0
  87. package/dist/mdx-plugins/codeblock-utils.d.ts +2 -29
  88. package/dist/mdx-plugins/codeblock-utils.js +71 -9
  89. package/dist/mdx-plugins/codeblock-utils.js.map +1 -0
  90. package/dist/mdx-plugins/index.d.ts +15 -20
  91. package/dist/mdx-plugins/index.js +18 -73
  92. package/dist/mdx-plugins/rehype-code.d.ts +2 -55
  93. package/dist/mdx-plugins/rehype-code.js +5 -15
  94. package/dist/mdx-plugins/rehype-toc.d.ts +2 -14
  95. package/dist/mdx-plugins/rehype-toc.js +3 -7
  96. package/dist/mdx-plugins/remark-admonition.d.ts +2 -20
  97. package/dist/mdx-plugins/remark-admonition.js +74 -8
  98. package/dist/mdx-plugins/remark-admonition.js.map +1 -0
  99. package/dist/mdx-plugins/remark-code-tab.d.ts +2 -30
  100. package/dist/mdx-plugins/remark-code-tab.js +183 -7
  101. package/dist/mdx-plugins/remark-code-tab.js.map +1 -0
  102. package/dist/mdx-plugins/remark-directive-admonition.d.ts +2 -27
  103. package/dist/mdx-plugins/remark-directive-admonition.js +60 -7
  104. package/dist/mdx-plugins/remark-directive-admonition.js.map +1 -0
  105. package/dist/mdx-plugins/remark-gfm.d.ts +2 -1
  106. package/dist/mdx-plugins/remark-gfm.js +3 -7
  107. package/dist/mdx-plugins/remark-heading.d.ts +2 -31
  108. package/dist/mdx-plugins/remark-heading.js +45 -8
  109. package/dist/mdx-plugins/remark-heading.js.map +1 -0
  110. package/dist/mdx-plugins/remark-image.d.ts +2 -57
  111. package/dist/mdx-plugins/remark-image.js +192 -7
  112. package/dist/mdx-plugins/remark-image.js.map +1 -0
  113. package/dist/mdx-plugins/remark-mdx-files.d.ts +2 -40
  114. package/dist/mdx-plugins/remark-mdx-files.js +96 -7
  115. package/dist/mdx-plugins/remark-mdx-files.js.map +1 -0
  116. package/dist/mdx-plugins/remark-mdx-mermaid.d.ts +2 -15
  117. package/dist/mdx-plugins/remark-mdx-mermaid.js +31 -7
  118. package/dist/mdx-plugins/remark-mdx-mermaid.js.map +1 -0
  119. package/dist/mdx-plugins/remark-npm.d.ts +2 -31
  120. package/dist/mdx-plugins/remark-npm.js +68 -8
  121. package/dist/mdx-plugins/remark-npm.js.map +1 -0
  122. package/dist/mdx-plugins/remark-steps.d.ts +2 -23
  123. package/dist/mdx-plugins/remark-steps.js +77 -7
  124. package/dist/mdx-plugins/remark-steps.js.map +1 -0
  125. package/dist/mdx-plugins/remark-structure.d.ts +2 -71
  126. package/dist/mdx-plugins/remark-structure.js +105 -11
  127. package/dist/mdx-plugins/remark-structure.js.map +1 -0
  128. package/dist/mixedbread-DlByNYSd.js +88 -0
  129. package/dist/mixedbread-DlByNYSd.js.map +1 -0
  130. package/dist/negotiation/index.d.ts +6 -4
  131. package/dist/negotiation/index.d.ts.map +1 -0
  132. package/dist/negotiation/index.js +41 -11
  133. package/dist/negotiation/index.js.map +1 -0
  134. package/dist/normalize-url-DP9-1I-S.js +16 -0
  135. package/dist/normalize-url-DP9-1I-S.js.map +1 -0
  136. package/dist/orama-cloud-MyA-JBt1.js +84 -0
  137. package/dist/orama-cloud-MyA-JBt1.js.map +1 -0
  138. package/dist/page-tree/index.d.ts +23 -11
  139. package/dist/page-tree/index.d.ts.map +1 -0
  140. package/dist/page-tree/index.js +3 -17
  141. package/dist/path-DPJpqaLb.js +60 -0
  142. package/dist/path-DPJpqaLb.js.map +1 -0
  143. package/dist/rehype-code-CQDbiG8_.js +241 -0
  144. package/dist/rehype-code-CQDbiG8_.js.map +1 -0
  145. package/dist/rehype-code-vVWG4-ej.d.ts +58 -0
  146. package/dist/rehype-code-vVWG4-ej.d.ts.map +1 -0
  147. package/dist/rehype-toc-D-eLj90w.js +143 -0
  148. package/dist/rehype-toc-D-eLj90w.js.map +1 -0
  149. package/dist/rehype-toc-DJvSyE0o.d.ts +18 -0
  150. package/dist/rehype-toc-DJvSyE0o.d.ts.map +1 -0
  151. package/dist/remark-admonition-DOwBWzsH.d.ts +22 -0
  152. package/dist/remark-admonition-DOwBWzsH.d.ts.map +1 -0
  153. package/dist/remark-code-tab-CXsYlims.d.ts +32 -0
  154. package/dist/remark-code-tab-CXsYlims.d.ts.map +1 -0
  155. package/dist/remark-directive-admonition-BCm_yiU9.d.ts +36 -0
  156. package/dist/remark-directive-admonition-BCm_yiU9.d.ts.map +1 -0
  157. package/dist/remark-gfm-CeWpMwyk.d.ts +2 -0
  158. package/dist/remark-heading-CXvCY0go.d.ts +37 -0
  159. package/dist/remark-heading-CXvCY0go.d.ts.map +1 -0
  160. package/dist/remark-image-CvUis4R1.d.ts +65 -0
  161. package/dist/remark-image-CvUis4R1.d.ts.map +1 -0
  162. package/dist/remark-mdx-files-DOYafA4x.d.ts +42 -0
  163. package/dist/remark-mdx-files-DOYafA4x.d.ts.map +1 -0
  164. package/dist/remark-mdx-mermaid-BdSUUiCG.d.ts +17 -0
  165. package/dist/remark-mdx-mermaid-BdSUUiCG.d.ts.map +1 -0
  166. package/dist/remark-npm-BIvIEKT2.d.ts +36 -0
  167. package/dist/remark-npm-BIvIEKT2.d.ts.map +1 -0
  168. package/dist/remark-steps-CHJN-rtm.d.ts +28 -0
  169. package/dist/remark-steps-CHJN-rtm.d.ts.map +1 -0
  170. package/dist/remark-structure-RZD2gGKp.d.ts +77 -0
  171. package/dist/remark-structure-RZD2gGKp.d.ts.map +1 -0
  172. package/dist/remove-undefined-DgDIJk1A.js +19 -0
  173. package/dist/remove-undefined-DgDIJk1A.js.map +1 -0
  174. package/dist/search/algolia.d.ts +3 -69
  175. package/dist/search/algolia.js +69 -63
  176. package/dist/search/algolia.js.map +1 -0
  177. package/dist/search/client.d.ts +120 -114
  178. package/dist/search/client.d.ts.map +1 -0
  179. package/dist/search/client.js +92 -91
  180. package/dist/search/client.js.map +1 -0
  181. package/dist/search/index.d.ts +20 -18
  182. package/dist/search/index.d.ts.map +1 -0
  183. package/dist/search/index.js +3 -7
  184. package/dist/search/orama-cloud.d.ts +70 -68
  185. package/dist/search/orama-cloud.d.ts.map +1 -0
  186. package/dist/search/orama-cloud.js +46 -54
  187. package/dist/search/orama-cloud.js.map +1 -0
  188. package/dist/search/server.d.ts +6 -136
  189. package/dist/search/server.js +292 -369
  190. package/dist/search/server.js.map +1 -0
  191. package/dist/search-GCBSTRxD.js +44 -0
  192. package/dist/search-GCBSTRxD.js.map +1 -0
  193. package/dist/server-CPR_fgkH.d.ts +133 -0
  194. package/dist/server-CPR_fgkH.d.ts.map +1 -0
  195. package/dist/shiki-4oMYwHED.js +80 -0
  196. package/dist/shiki-4oMYwHED.js.map +1 -0
  197. package/dist/shiki-CIBQys54.d.ts +33 -0
  198. package/dist/shiki-CIBQys54.d.ts.map +1 -0
  199. package/dist/source/client/index.d.ts +7 -5
  200. package/dist/source/client/index.d.ts.map +1 -0
  201. package/dist/source/client/index.js +24 -35
  202. package/dist/source/client/index.js.map +1 -0
  203. package/dist/source/index.d.ts +3 -42
  204. package/dist/source/index.js +599 -739
  205. package/dist/source/index.js.map +1 -0
  206. package/dist/source/plugins/lucide-icons.d.ts +7 -7
  207. package/dist/source/plugins/lucide-icons.d.ts.map +1 -0
  208. package/dist/source/plugins/lucide-icons.js +21 -20
  209. package/dist/source/plugins/lucide-icons.js.map +1 -0
  210. package/dist/source/plugins/slugs.d.ts +3 -0
  211. package/dist/source/plugins/slugs.js +65 -0
  212. package/dist/source/plugins/slugs.js.map +1 -0
  213. package/dist/source/schema.d.ts +17 -14
  214. package/dist/source/schema.d.ts.map +1 -0
  215. package/dist/source/schema.js +26 -22
  216. package/dist/source/schema.js.map +1 -0
  217. package/dist/static-vTmR4-T2.js +51 -0
  218. package/dist/static-vTmR4-T2.js.map +1 -0
  219. package/dist/toc.d.ts +38 -25
  220. package/dist/toc.d.ts.map +1 -0
  221. package/dist/toc.js +123 -136
  222. package/dist/toc.js.map +1 -0
  223. package/dist/util-CK2ykiif.d.ts +8 -0
  224. package/dist/util-CK2ykiif.d.ts.map +1 -0
  225. package/dist/util-s9piKHsk.js +10 -0
  226. package/dist/util-s9piKHsk.js.map +1 -0
  227. package/dist/utils/use-effect-event.d.ts +3 -1
  228. package/dist/utils/use-effect-event.d.ts.map +1 -0
  229. package/dist/utils/use-effect-event.js +16 -13
  230. package/dist/utils/use-effect-event.js.map +1 -0
  231. package/dist/utils/use-media-query.d.ts +3 -1
  232. package/dist/utils/use-media-query.d.ts.map +1 -0
  233. package/dist/utils/use-media-query.js +20 -20
  234. package/dist/utils/use-media-query.js.map +1 -0
  235. package/dist/utils/use-on-change.d.ts +3 -1
  236. package/dist/utils/use-on-change.d.ts.map +1 -0
  237. package/dist/utils/use-on-change.js +23 -7
  238. package/dist/utils/use-on-change.js.map +1 -0
  239. package/dist/utils-DUvi2WkD.js +134 -0
  240. package/dist/utils-DUvi2WkD.js.map +1 -0
  241. package/package.json +72 -71
  242. package/dist/algolia-IZEDLPHE.js +0 -58
  243. package/dist/chunk-5PMI7QDD.js +0 -220
  244. package/dist/chunk-ADBHPKXG.js +0 -78
  245. package/dist/chunk-APKPSBSB.js +0 -74
  246. package/dist/chunk-CH7YHH7V.js +0 -222
  247. package/dist/chunk-EFVXL2PP.js +0 -144
  248. package/dist/chunk-EMWGTXSW.js +0 -19
  249. package/dist/chunk-FAEPKD7U.js +0 -20
  250. package/dist/chunk-FUUVPEA5.js +0 -29
  251. package/dist/chunk-GINBKBVQ.js +0 -12
  252. package/dist/chunk-GLRQBLGN.js +0 -59
  253. package/dist/chunk-JUF4WZ6G.js +0 -117
  254. package/dist/chunk-K4WNLOVQ.js +0 -75
  255. package/dist/chunk-L4JKQWCM.js +0 -131
  256. package/dist/chunk-MA6O2UUE.js +0 -50
  257. package/dist/chunk-ONG4RVCR.js +0 -8
  258. package/dist/chunk-OTD7MV33.js +0 -53
  259. package/dist/chunk-PFNP6PEB.js +0 -11
  260. package/dist/chunk-QJRXMG4S.js +0 -275
  261. package/dist/chunk-SH7BNTG7.js +0 -38
  262. package/dist/chunk-TWIDBWFG.js +0 -84
  263. package/dist/chunk-U67V476Y.js +0 -35
  264. package/dist/chunk-VLSDGCJE.js +0 -47
  265. package/dist/chunk-W6WTLKRA.js +0 -73
  266. package/dist/chunk-X2HFD5QJ.js +0 -275
  267. package/dist/chunk-XJ6ZQNEX.js +0 -91
  268. package/dist/chunk-XN2LKXFZ.js +0 -101
  269. package/dist/chunk-XOFXGHS4.js +0 -93
  270. package/dist/chunk-XZSI7AHE.js +0 -67
  271. package/dist/chunk-YVVDKJ2H.js +0 -34
  272. package/dist/chunk-ZMWYLUDP.js +0 -21
  273. package/dist/definitions-pJ7PybYY.d.ts +0 -60
  274. package/dist/fetch-IBTWQCJR.js +0 -22
  275. package/dist/loader-BvlPPJX0.d.ts +0 -321
  276. package/dist/mixedbread-RAHDVXGJ.js +0 -118
  277. package/dist/orama-cloud-UZAPMPFV.js +0 -93
  278. package/dist/static-A2YJ5TXV.js +0 -62
  279. package/dist/util-bZU2QeJ2.d.ts +0 -6
@@ -1,321 +0,0 @@
1
- import { R as Root, I as Item, F as Folder, S as Separator } from './definitions-pJ7PybYY.js';
2
- import { I18nConfig } from './i18n/index.js';
3
- import { ReactNode } from 'react';
4
-
5
- interface Source<Config extends SourceConfig = SourceConfig> {
6
- files: VirtualFile<Config>[];
7
- }
8
- interface SourceConfig {
9
- pageData: PageData;
10
- metaData: MetaData;
11
- }
12
- interface MetaData {
13
- icon?: string | undefined;
14
- title?: string | undefined;
15
- root?: boolean | undefined;
16
- pages?: string[] | undefined;
17
- defaultOpen?: boolean | undefined;
18
- collapsible?: boolean | undefined;
19
- description?: string | undefined;
20
- }
21
- interface PageData {
22
- icon?: string | undefined;
23
- title?: string;
24
- description?: string | undefined;
25
- }
26
- type VirtualFile<Config extends SourceConfig = SourceConfig> = VirtualPage<Config['pageData']> | VirtualMeta<Config['metaData']>;
27
- interface BaseVirtualFile {
28
- /**
29
- * Virtualized path (relative to content directory)
30
- *
31
- * @example `docs/page.mdx`
32
- */
33
- path: string;
34
- /**
35
- * Absolute path of the file
36
- */
37
- absolutePath?: string;
38
- }
39
- interface VirtualPage<Data extends PageData> extends BaseVirtualFile {
40
- type: 'page';
41
- /**
42
- * Specified Slugs for page
43
- */
44
- slugs?: string[];
45
- data: Data;
46
- }
47
- interface VirtualMeta<Data extends MetaData> extends BaseVirtualFile {
48
- type: 'meta';
49
- data: Data;
50
- }
51
- type _ConfigUnion_<T extends Record<string, Source>> = {
52
- [K in keyof T]: T[K] extends Source<infer Config> ? {
53
- pageData: Config['pageData'] & {
54
- type: K;
55
- };
56
- metaData: Config['metaData'] & {
57
- type: K;
58
- };
59
- } : never;
60
- }[keyof T];
61
- declare function multiple<T extends Record<string, Source>>(sources: T): Source<_ConfigUnion_<T>>;
62
- declare function source<Page extends PageData, Meta extends MetaData>(config: {
63
- pages: VirtualPage<Page>[];
64
- metas: VirtualMeta<Meta>[];
65
- }): Source<{
66
- pageData: Page;
67
- metaData: Meta;
68
- }>;
69
- /**
70
- * update a source object in-place.
71
- */
72
- declare function update<Config extends SourceConfig>(source: Source<Config>): {
73
- files<Page extends PageData, Meta extends MetaData>(fn: (files: VirtualFile<Config>[]) => (VirtualPage<Page> | VirtualMeta<Meta>)[]): typeof update<{
74
- pageData: Page;
75
- metaData: Meta;
76
- }>;
77
- page<V extends PageData>(fn: (page: VirtualPage<Config["pageData"]>) => VirtualPage<V>): typeof update<{
78
- pageData: V;
79
- metaData: Config["metaData"];
80
- }>;
81
- meta<V extends MetaData>(fn: (meta: VirtualMeta<Config["metaData"]>) => VirtualMeta<V>): typeof update<{
82
- pageData: Config["pageData"];
83
- metaData: V;
84
- }>;
85
- build(): Source<Config>;
86
- };
87
-
88
- /**
89
- * In memory file system.
90
- */
91
- declare class FileSystem<File> {
92
- files: Map<string, File>;
93
- folders: Map<string, string[]>;
94
- constructor(inherit?: FileSystem<File>);
95
- read(path: string): File | undefined;
96
- /**
97
- * get the direct children of folder (in virtual file path)
98
- */
99
- readDir(path: string): string[] | undefined;
100
- write(path: string, file: File): void;
101
- /**
102
- * Delete files at specified path.
103
- *
104
- * @param path - the target path.
105
- * @param [recursive=false] - if set to `true`, it will also delete directories.
106
- */
107
- delete(path: string, recursive?: boolean): boolean;
108
- getFiles(): string[];
109
- makeDir(path: string): void;
110
- }
111
-
112
- type ContentStorage<Config extends SourceConfig = SourceConfig> = FileSystem<ContentStorageFile<Config>>;
113
- type ContentStorageFile<Config extends SourceConfig = SourceConfig> = {
114
- path: string;
115
- absolutePath?: string;
116
- format: 'meta';
117
- data: Config['metaData'];
118
- } | {
119
- path: string;
120
- absolutePath?: string;
121
- format: 'page';
122
- slugs: string[];
123
- data: Config['pageData'];
124
- };
125
- /**
126
- * @param defaultLanguage - language to use when i18n is not configured.
127
- * @returns a map of locale and its content storage.
128
- *
129
- * in the storage, locale codes are removed from file paths, hence the same file will have same file paths in every storage.
130
- */
131
- declare function buildContentStorage(loaderConfig: ResolvedLoaderConfig, defaultLanguage: string): Record<string, ContentStorage>;
132
-
133
- interface PageTreeBuilderContext<Config extends SourceConfig = SourceConfig> {
134
- rootId: string;
135
- generateNodeId: () => string;
136
- options: PageTreeOptions;
137
- transformers: PageTreeTransformer<Config>[];
138
- builder: PageTreeBuilder;
139
- storage: ContentStorage<Config>;
140
- getUrl: ResolvedLoaderConfig['url'];
141
- storages?: Record<string, ContentStorage<Config>>;
142
- locale?: string;
143
- }
144
- interface PageTreeTransformer<Config extends SourceConfig = SourceConfig> {
145
- file?: (this: PageTreeBuilderContext<Config>, node: Item, filePath?: string) => Item;
146
- folder?: (this: PageTreeBuilderContext<Config>, node: Folder, folderPath: string, metaPath?: string) => Folder;
147
- separator?: (this: PageTreeBuilderContext<Config>, node: Separator) => Separator;
148
- root?: (this: PageTreeBuilderContext<Config>, node: Root) => Root;
149
- }
150
- interface PageTreeOptions<Config extends LoaderConfig = LoaderConfig> {
151
- id?: string;
152
- /**
153
- * Remove references to the file path of original nodes (`$ref`)
154
- *
155
- * @defaultValue false
156
- */
157
- noRef?: boolean;
158
- /**
159
- * generate fallback page tree
160
- *
161
- * @defaultValue true
162
- */
163
- generateFallback?: boolean;
164
- /**
165
- * Additional page tree transformers to apply
166
- */
167
- transformers?: PageTreeTransformer<Config['source']>[];
168
- }
169
- interface PageTreeBuilder {
170
- build: (storage: ContentStorage, options?: PageTreeOptions) => Root;
171
- buildI18n: (storages: Record<string, ContentStorage>, options?: PageTreeOptions) => Record<string, Root>;
172
- }
173
- declare function createPageTreeBuilder(loaderConfig: ResolvedLoaderConfig): PageTreeBuilder;
174
-
175
- interface LoaderPlugin<Config extends LoaderConfig = LoaderConfig> {
176
- name?: string;
177
- /**
178
- * Change the order of plugin:
179
- * - `pre`: before normal plugins
180
- * - `post`: after normal plugins
181
- */
182
- enforce?: 'pre' | 'post';
183
- /**
184
- * receive & replace loader options
185
- */
186
- config?: (config: ResolvedLoaderConfig) => ResolvedLoaderConfig | void | undefined;
187
- /**
188
- * transform the storage after loading
189
- */
190
- transformStorage?: (context: {
191
- storage: ContentStorage<Config['source']>;
192
- }) => void;
193
- /**
194
- * transform the generated page tree
195
- */
196
- transformPageTree?: PageTreeTransformer<Config['source']>;
197
- }
198
- type LoaderPluginOption<Config extends LoaderConfig = LoaderConfig> = LoaderPlugin<Config> | LoaderPluginOption<Config>[] | undefined;
199
- declare function buildPlugins(plugins: LoaderPluginOption[], sort?: boolean): LoaderPlugin[];
200
-
201
- type IconResolver = (icon: string | undefined) => ReactNode;
202
-
203
- interface LoaderConfig {
204
- source: SourceConfig;
205
- i18n: I18nConfig | undefined;
206
- }
207
- interface LoaderOptions<C extends LoaderConfig = LoaderConfig> {
208
- baseUrl: string;
209
- i18n?: C['i18n'];
210
- url?: (slugs: string[], locale?: string) => string;
211
- /**
212
- * Additional options for page tree builder
213
- */
214
- pageTree?: PageTreeOptions<C>;
215
- plugins?: LoaderPluginOption[] | ((context: {
216
- typedPlugin: (plugin: LoaderPlugin<C>) => LoaderPlugin;
217
- }) => LoaderPluginOption[]);
218
- icon?: IconResolver;
219
- slugs?: (info: {
220
- path: string;
221
- }) => string[];
222
- }
223
- interface ResolvedLoaderConfig {
224
- source: Source;
225
- url: (slugs: string[], locale?: string) => string;
226
- plugins?: LoaderPlugin[];
227
- pageTree?: PageTreeOptions;
228
- i18n?: I18nConfig | undefined;
229
- }
230
- interface SharedFileInfo {
231
- /**
232
- * Virtualized file path (relative to content directory)
233
- *
234
- * @example `docs/page.mdx`
235
- */
236
- path: string;
237
- /**
238
- * Absolute path of the file
239
- */
240
- absolutePath?: string;
241
- }
242
- interface Page<Data = PageData> extends SharedFileInfo {
243
- slugs: string[];
244
- url: string;
245
- data: Data;
246
- locale?: string | undefined;
247
- }
248
- interface Meta<Data = MetaData> extends SharedFileInfo {
249
- data: Data;
250
- }
251
- interface LoaderOutput<Config extends LoaderConfig> {
252
- pageTree: Config['i18n'] extends I18nConfig ? Record<string, Root> : Root;
253
- getPageTree: (locale?: string) => Root;
254
- getPageByHref: (href: string, options?: {
255
- language?: string;
256
- /**
257
- * resolve relative file paths in `href` from specified dirname, must be a virtual path.
258
- */
259
- dir?: string;
260
- }) => {
261
- page: Page<Config['source']['pageData']>;
262
- hash?: string;
263
- } | undefined;
264
- /**
265
- * @internal
266
- */
267
- _i18n?: I18nConfig;
268
- /**
269
- * Get a list of pages from specified language
270
- *
271
- * @param language - If empty, list pages from all languages.
272
- */
273
- getPages: (language?: string) => Page<Config['source']['pageData']>[];
274
- /**
275
- * get each language and its pages, empty if i18n is not enabled.
276
- */
277
- getLanguages: () => {
278
- language: string;
279
- pages: Page<Config['source']['pageData']>[];
280
- }[];
281
- /**
282
- * Get page with slugs, the slugs can also be URI encoded.
283
- *
284
- * @param language - If empty, the default language will be used
285
- */
286
- getPage: (slugs: string[] | undefined, language?: string) => Page<Config['source']['pageData']> | undefined;
287
- getNodePage: (node: Item, language?: string) => Page<Config['source']['pageData']> | undefined;
288
- getNodeMeta: (node: Folder, language?: string) => Meta<Config['source']['metaData']> | undefined;
289
- /**
290
- * generate static params for Next.js SSG
291
- *
292
- * @param slug - customise parameter name for slugs
293
- * @param lang - customise parameter name for lang
294
- */
295
- generateParams: <TSlug extends string = 'slug', TLang extends string = 'lang'>(slug?: TSlug, lang?: TLang) => (Record<TSlug, string[]> & Record<TLang, string>)[];
296
- /**
297
- * serialize page tree for non-RSC environments
298
- */
299
- serializePageTree: (tree: Root) => Promise<object>;
300
- }
301
- declare function createGetUrl(baseUrl: string, i18n?: I18nConfig): ResolvedLoaderConfig['url'];
302
- declare function loader<Config extends SourceConfig, I18n extends I18nConfig | undefined = undefined>(source: Source<Config>, options: LoaderOptions<{
303
- source: NoInfer<Config>;
304
- i18n: I18n;
305
- }>): LoaderOutput<{
306
- source: Config;
307
- i18n: I18n;
308
- }>;
309
- declare function loader<Config extends SourceConfig, I18n extends I18nConfig | undefined = undefined>(options: LoaderOptions<{
310
- source: NoInfer<Config>;
311
- i18n: I18n;
312
- }> & {
313
- source: Source<Config>;
314
- }): LoaderOutput<{
315
- source: Config;
316
- i18n: I18n;
317
- }>;
318
- type InferPageType<Utils extends LoaderOutput<any>> = Utils extends LoaderOutput<infer Config> ? Page<Config['source']['pageData']> : never;
319
- type InferMetaType<Utils extends LoaderOutput<any>> = Utils extends LoaderOutput<infer Config> ? Meta<Config['source']['metaData']> : never;
320
-
321
- export { type ContentStorage as C, FileSystem as F, type InferPageType as I, type LoaderPlugin as L, type MetaData as M, type PageData as P, type ResolvedLoaderConfig as R, type Source as S, type VirtualFile as V, type _ConfigUnion_ as _, type SourceConfig as a, type LoaderConfig as b, type LoaderOptions as c, type Page as d, type Meta as e, type LoaderOutput as f, createGetUrl as g, type InferMetaType as h, type PageTreeBuilderContext as i, type PageTreeTransformer as j, type PageTreeOptions as k, loader as l, multiple as m, type PageTreeBuilder as n, createPageTreeBuilder as o, type ContentStorageFile as p, buildContentStorage as q, type LoaderPluginOption as r, source as s, buildPlugins as t, update as u };
@@ -1,118 +0,0 @@
1
- import {
2
- __commonJS,
3
- __toESM
4
- } from "./chunk-U67V476Y.js";
5
-
6
- // ../../node_modules/.pnpm/remove-markdown@0.6.2/node_modules/remove-markdown/index.js
7
- var require_remove_markdown = __commonJS({
8
- "../../node_modules/.pnpm/remove-markdown@0.6.2/node_modules/remove-markdown/index.js"(exports, module) {
9
- "use strict";
10
- module.exports = function(md, options) {
11
- options = options || {};
12
- options.listUnicodeChar = options.hasOwnProperty("listUnicodeChar") ? options.listUnicodeChar : false;
13
- options.stripListLeaders = options.hasOwnProperty("stripListLeaders") ? options.stripListLeaders : true;
14
- options.gfm = options.hasOwnProperty("gfm") ? options.gfm : true;
15
- options.useImgAltText = options.hasOwnProperty("useImgAltText") ? options.useImgAltText : true;
16
- options.abbr = options.hasOwnProperty("abbr") ? options.abbr : false;
17
- options.replaceLinksWithURL = options.hasOwnProperty("replaceLinksWithURL") ? options.replaceLinksWithURL : false;
18
- options.htmlTagsToSkip = options.hasOwnProperty("htmlTagsToSkip") ? options.htmlTagsToSkip : [];
19
- options.throwError = options.hasOwnProperty("throwError") ? options.throwError : false;
20
- var output = md || "";
21
- output = output.replace(/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/gm, "");
22
- try {
23
- if (options.stripListLeaders) {
24
- if (options.listUnicodeChar)
25
- output = output.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm, options.listUnicodeChar + " $1");
26
- else
27
- output = output.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm, "$1");
28
- }
29
- if (options.gfm) {
30
- output = output.replace(/\n={2,}/g, "\n").replace(/~{3}.*\n/g, "").replace(/~~/g, "").replace(/```(?:.*)\n([\s\S]*?)```/g, (_, code) => code.trim());
31
- }
32
- if (options.abbr) {
33
- output = output.replace(/\*\[.*\]:.*\n/, "");
34
- }
35
- let htmlReplaceRegex = /<[^>]*>/g;
36
- if (options.htmlTagsToSkip && options.htmlTagsToSkip.length > 0) {
37
- const joinedHtmlTagsToSkip = options.htmlTagsToSkip.join("|");
38
- htmlReplaceRegex = new RegExp(
39
- `<(?!/?(${joinedHtmlTagsToSkip})(?=>|s[^>]*>))[^>]*>`,
40
- "g"
41
- );
42
- }
43
- output = output.replace(htmlReplaceRegex, "").replace(/^[=\-]{2,}\s*$/g, "").replace(/\[\^.+?\](\: .*?$)?/g, "").replace(/\s{0,2}\[.*?\]: .*?$/g, "").replace(/\!\[(.*?)\][\[\(].*?[\]\)]/g, options.useImgAltText ? "$1" : "").replace(/\[([\s\S]*?)\]\s*[\(\[].*?[\)\]]/g, options.replaceLinksWithURL ? "$2" : "$1").replace(/^(\n)?\s{0,3}>\s?/gm, "$1").replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g, "").replace(/^(\n)?\s{0,}#{1,6}\s*( (.+))? +#+$|^(\n)?\s{0,}#{1,6}\s*( (.+))?$/gm, "$1$3$4$6").replace(/([\*]+)(\S)(.*?\S)??\1/g, "$2$3").replace(/(^|\W)([_]+)(\S)(.*?\S)??\2($|\W)/g, "$1$3$4$5").replace(/(`{3,})(.*?)\1/gm, "$2").replace(/`(.+?)`/g, "$1").replace(/~(.*?)~/g, "$1");
44
- } catch (e) {
45
- if (options.throwError) throw e;
46
- console.error("remove-markdown encountered error: %s", e);
47
- return md;
48
- }
49
- return output;
50
- };
51
- }
52
- });
53
-
54
- // src/search/client/mixedbread.ts
55
- var import_remove_markdown = __toESM(require_remove_markdown(), 1);
56
- import Slugger from "github-slugger";
57
- var slugger = new Slugger();
58
- function extractHeadingTitle(text) {
59
- const trimmedText = text.trim();
60
- if (!trimmedText.startsWith("#")) {
61
- return "";
62
- }
63
- const lines = trimmedText.split("\n");
64
- const firstLine = lines[0]?.trim();
65
- if (firstLine) {
66
- const plainText = (0, import_remove_markdown.default)(firstLine, {
67
- useImgAltText: false
68
- });
69
- return plainText;
70
- }
71
- return "";
72
- }
73
- async function search(query, options) {
74
- const { client, vectorStoreId, tag } = options;
75
- if (!query.trim()) {
76
- return [];
77
- }
78
- const res = await client.vectorStores.search({
79
- query,
80
- vector_store_identifiers: [vectorStoreId],
81
- top_k: 10,
82
- filters: {
83
- key: "generated_metadata.tag",
84
- operator: "eq",
85
- value: tag
86
- },
87
- search_options: {
88
- return_metadata: true
89
- }
90
- });
91
- return res.data.flatMap((item) => {
92
- const metadata = item.generated_metadata;
93
- const url = metadata.url || "#";
94
- const title = metadata.title || "Untitled";
95
- const chunkResults = [
96
- {
97
- id: `${item.file_id}-${item.chunk_index}-page`,
98
- type: "page",
99
- content: title,
100
- url
101
- }
102
- ];
103
- const headingTitle = item.type === "text" ? extractHeadingTitle(item.text) : "";
104
- if (headingTitle) {
105
- slugger.reset();
106
- chunkResults.push({
107
- id: `${item.file_id}-${item.chunk_index}-heading`,
108
- type: "heading",
109
- content: headingTitle,
110
- url: `${url}#${slugger.slug(headingTitle)}`
111
- });
112
- }
113
- return chunkResults;
114
- });
115
- }
116
- export {
117
- search
118
- };
@@ -1,93 +0,0 @@
1
- import {
2
- removeUndefined
3
- } from "./chunk-ZMWYLUDP.js";
4
- import {
5
- createContentHighlighter
6
- } from "./chunk-OTD7MV33.js";
7
- import "./chunk-U67V476Y.js";
8
-
9
- // src/search/client/orama-cloud.ts
10
- async function searchDocs(query, options) {
11
- const highlighter = createContentHighlighter(query);
12
- const list = [];
13
- const { index = "default", client, params: extraParams, tag } = options;
14
- if (index === "crawler") {
15
- const result2 = await client.search({
16
- datasources: [],
17
- ...extraParams,
18
- term: query,
19
- where: {
20
- category: tag ? {
21
- eq: tag.slice(0, 1).toUpperCase() + tag.slice(1)
22
- } : void 0,
23
- ...extraParams?.where
24
- },
25
- limit: 10
26
- });
27
- if (!result2) return list;
28
- for (const hit of result2.hits) {
29
- const doc = hit.document;
30
- list.push(
31
- {
32
- id: hit.id,
33
- type: "page",
34
- content: doc.title,
35
- contentWithHighlights: highlighter.highlight(doc.title),
36
- url: doc.path
37
- },
38
- {
39
- id: "page" + hit.id,
40
- type: "text",
41
- content: doc.content,
42
- contentWithHighlights: highlighter.highlight(doc.content),
43
- url: doc.path
44
- }
45
- );
46
- }
47
- return list;
48
- }
49
- const params = {
50
- datasources: [],
51
- ...extraParams,
52
- term: query,
53
- where: removeUndefined({
54
- tag,
55
- ...extraParams?.where
56
- }),
57
- groupBy: {
58
- properties: ["page_id"],
59
- max_results: 7,
60
- ...extraParams?.groupBy
61
- }
62
- };
63
- const result = await client.search(params);
64
- if (!result || !result.groups) return list;
65
- for (const item of result.groups) {
66
- let addedHead = false;
67
- for (const hit of item.result) {
68
- const doc = hit.document;
69
- if (!addedHead) {
70
- list.push({
71
- id: doc.page_id,
72
- type: "page",
73
- content: doc.title,
74
- breadcrumbs: doc.breadcrumbs,
75
- contentWithHighlights: highlighter.highlight(doc.title),
76
- url: doc.url
77
- });
78
- addedHead = true;
79
- }
80
- list.push({
81
- id: doc.id,
82
- content: doc.content,
83
- contentWithHighlights: highlighter.highlight(doc.content),
84
- type: doc.content === doc.section ? "heading" : "text",
85
- url: doc.section_id ? `${doc.url}#${doc.section_id}` : doc.url
86
- });
87
- }
88
- }
89
- return list;
90
- }
91
- export {
92
- searchDocs
93
- };
@@ -1,62 +0,0 @@
1
- import {
2
- searchAdvanced,
3
- searchSimple
4
- } from "./chunk-XOFXGHS4.js";
5
- import "./chunk-ZMWYLUDP.js";
6
- import "./chunk-OTD7MV33.js";
7
- import "./chunk-U67V476Y.js";
8
-
9
- // src/search/client/static.ts
10
- import { create, load } from "@orama/orama";
11
- var cache = /* @__PURE__ */ new Map();
12
- async function loadDB({
13
- from = "/api/search",
14
- initOrama = (locale) => create({ schema: { _: "string" }, language: locale })
15
- }) {
16
- const cacheKey = from;
17
- const cached = cache.get(cacheKey);
18
- if (cached) return cached;
19
- async function init() {
20
- const res = await fetch(from);
21
- if (!res.ok)
22
- throw new Error(
23
- `failed to fetch exported search indexes from ${from}, make sure the search database is exported and available for client.`
24
- );
25
- const data = await res.json();
26
- const dbs = /* @__PURE__ */ new Map();
27
- if (data.type === "i18n") {
28
- await Promise.all(
29
- Object.entries(data.data).map(async ([k, v]) => {
30
- const db2 = await initOrama(k);
31
- load(db2, v);
32
- dbs.set(k, {
33
- type: v.type,
34
- db: db2
35
- });
36
- })
37
- );
38
- return dbs;
39
- }
40
- const db = await initOrama();
41
- load(db, data);
42
- dbs.set("", {
43
- type: data.type,
44
- db
45
- });
46
- return dbs;
47
- }
48
- const result = init();
49
- cache.set(cacheKey, result);
50
- return result;
51
- }
52
- async function search(query, options) {
53
- const { tag, locale } = options;
54
- const db = (await loadDB(options)).get(locale ?? "");
55
- if (!db) return [];
56
- if (db.type === "simple")
57
- return searchSimple(db, query);
58
- return searchAdvanced(db.db, query, tag);
59
- }
60
- export {
61
- search
62
- };
@@ -1,6 +0,0 @@
1
- import { Pluggable } from 'unified';
2
-
3
- type Thenable<T> = T | PromiseLike<T>;
4
- type ResolvePlugins = Thenable<Pluggable>[] | ((v: Pluggable[]) => Thenable<Pluggable>[]);
5
-
6
- export type { ResolvePlugins as R };