@hanzo/docs-core 16.5.0 → 16.5.3

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 (262) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -3
  3. package/dist/{advanced-BRT5Ij43.js → advanced-BH0syJ-M.js} +3 -4
  4. package/dist/{algolia-CQPXCnjV.js → algolia-C7Crg8-5.js} +2 -3
  5. package/dist/breadcrumb.d.ts +2 -3
  6. package/dist/breadcrumb.js +3 -4
  7. package/dist/{chunk-B-ezknvj.js → chunk-CaR5F9JI.js} +3 -3
  8. package/dist/content/github.d.ts +1 -2
  9. package/dist/content/github.js +1 -2
  10. package/dist/content/index.d.ts +3 -4
  11. package/dist/content/index.js +1 -2
  12. package/dist/content/mdx/preset-bundler.d.ts +9 -10
  13. package/dist/content/mdx/preset-bundler.js +2 -3
  14. package/dist/content/mdx/preset-runtime.d.ts +9 -10
  15. package/dist/content/mdx/preset-runtime.js +2 -3
  16. package/dist/content/toc.d.ts +1 -3
  17. package/dist/content/toc.js +4 -5
  18. package/dist/create-i18n-Cv3Cocbs.d.ts +51 -0
  19. package/dist/{definitions-DuxDer_c.d.ts → definitions-DSNTbAwC.d.ts} +1 -2
  20. package/dist/dynamic-link.d.ts +3 -4
  21. package/dist/dynamic-link.js +1 -3
  22. package/dist/{fetch-B5e9CFfN.js → fetch-HotVeLLF.js} +1 -2
  23. package/dist/framework/index.d.ts +5 -6
  24. package/dist/framework/index.js +18 -19
  25. package/dist/framework/next.d.ts +3 -4
  26. package/dist/framework/next.js +1 -2
  27. package/dist/framework/react-router.d.ts +3 -4
  28. package/dist/framework/react-router.js +1 -2
  29. package/dist/framework/tanstack.d.ts +3 -4
  30. package/dist/framework/tanstack.js +1 -2
  31. package/dist/framework/waku.d.ts +3 -4
  32. package/dist/framework/waku.js +1 -2
  33. package/dist/hast-utils-BmGqqmvo.js +15 -0
  34. package/dist/highlight/client.d.ts +2 -4
  35. package/dist/highlight/client.js +7 -13
  36. package/dist/highlight/config.d.ts +15 -0
  37. package/dist/highlight/config.js +18 -0
  38. package/dist/highlight/core/client.d.ts +31 -0
  39. package/dist/highlight/core/client.js +68 -0
  40. package/dist/highlight/core/index.d.ts +27 -0
  41. package/dist/highlight/core/index.js +69 -0
  42. package/dist/highlight/index.d.ts +34 -2
  43. package/dist/highlight/index.js +57 -2
  44. package/dist/i18n/index.d.ts +39 -1
  45. package/dist/i18n/index.js +1 -2
  46. package/dist/i18n/middleware.d.ts +2 -3
  47. package/dist/i18n/middleware.js +1 -2
  48. package/dist/{icon-BWwSDabM.js → icon-OtPFhyk1.js} +1 -2
  49. package/dist/link.d.ts +3 -4
  50. package/dist/link.js +1 -2
  51. package/dist/{mdast-utils-mc9-X-PK.js → mdast-utils-gJMY143g.js} +1 -2
  52. package/dist/mdx-plugins/codeblock-utils.d.ts +35 -1
  53. package/dist/mdx-plugins/codeblock-utils.js +1 -2
  54. package/dist/mdx-plugins/index.d.ts +18 -15
  55. package/dist/mdx-plugins/index.js +7 -5
  56. package/dist/mdx-plugins/rehype-code.core.d.ts +38 -0
  57. package/dist/mdx-plugins/rehype-code.core.js +104 -0
  58. package/dist/mdx-plugins/rehype-code.d.ts +18 -2
  59. package/dist/mdx-plugins/rehype-code.js +24 -3
  60. package/dist/mdx-plugins/rehype-toc.d.ts +16 -1
  61. package/dist/mdx-plugins/rehype-toc.js +127 -1
  62. package/dist/mdx-plugins/remark-admonition.d.ts +20 -1
  63. package/dist/mdx-plugins/remark-admonition.js +2 -3
  64. package/dist/mdx-plugins/remark-code-tab.d.ts +30 -1
  65. package/dist/mdx-plugins/remark-code-tab.js +4 -5
  66. package/dist/mdx-plugins/remark-directive-admonition.d.ts +34 -1
  67. package/dist/mdx-plugins/remark-directive-admonition.js +1 -2
  68. package/dist/mdx-plugins/remark-feedback-block.d.ts +51 -0
  69. package/dist/mdx-plugins/remark-feedback-block.js +47 -0
  70. package/dist/mdx-plugins/remark-gfm.d.ts +2 -2
  71. package/dist/mdx-plugins/remark-heading.d.ts +35 -1
  72. package/dist/mdx-plugins/remark-heading.js +2 -3
  73. package/dist/mdx-plugins/remark-image.d.ts +63 -1
  74. package/dist/mdx-plugins/remark-image.js +1 -2
  75. package/dist/mdx-plugins/remark-mdx-files.d.ts +55 -2
  76. package/dist/mdx-plugins/remark-mdx-files.js +103 -13
  77. package/dist/mdx-plugins/remark-mdx-mermaid.d.ts +15 -1
  78. package/dist/mdx-plugins/remark-mdx-mermaid.js +1 -2
  79. package/dist/mdx-plugins/remark-npm.d.ts +34 -1
  80. package/dist/mdx-plugins/remark-npm.js +1 -2
  81. package/dist/mdx-plugins/remark-steps.d.ts +26 -1
  82. package/dist/mdx-plugins/remark-steps.js +1 -2
  83. package/dist/mdx-plugins/remark-structure.d.ts +75 -1
  84. package/dist/mdx-plugins/remark-structure.js +7 -8
  85. package/dist/{mixedbread-DlByNYSd.js → mixedbread-Bx9drx9S.js} +6 -5
  86. package/dist/negotiation/index.d.ts +1 -2
  87. package/dist/negotiation/index.js +1 -2
  88. package/dist/{normalize-url-ChLsV26G.js → normalize-url-DUHbcuVM.js} +1 -2
  89. package/dist/{orama-cloud-DH3g37zc.js → orama-cloud-ByznDyOk.js} +6 -7
  90. package/dist/orama-cloud-legacy-BbgJnf5f.js +81 -0
  91. package/dist/page-tree/index.d.ts +3 -45
  92. package/dist/page-tree/index.js +1 -1
  93. package/dist/{index-2U6Tl4--.d.ts → path-B77y3W0_.d.ts} +111 -98
  94. package/dist/{path-DHIjrDBP.js → path-D0Bwm6Fs.js} +2 -3
  95. package/dist/{remove-undefined-Cfs4o_mM.js → remove-undefined-CJm9cyrC.js} +1 -2
  96. package/dist/search/algolia.d.ts +66 -2
  97. package/dist/search/algolia.js +1 -2
  98. package/dist/search/client.d.ts +30 -7
  99. package/dist/search/client.js +27 -22
  100. package/dist/search/index.d.ts +1 -2
  101. package/dist/search/index.js +41 -1
  102. package/dist/search/orama-cloud-legacy.d.ts +77 -0
  103. package/dist/search/orama-cloud-legacy.js +49 -0
  104. package/dist/search/orama-cloud.d.ts +5 -9
  105. package/dist/search/orama-cloud.js +1 -2
  106. package/dist/search/server.d.ts +87 -4
  107. package/dist/search/server.js +7 -8
  108. package/dist/source/client/index.d.ts +13 -11
  109. package/dist/source/client/index.js +22 -13
  110. package/dist/source/index.d.ts +5 -3
  111. package/dist/source/index.js +428 -333
  112. package/dist/source/plugins/lucide-icons.d.ts +5 -4
  113. package/dist/source/plugins/lucide-icons.js +2 -3
  114. package/dist/source/plugins/slugs.d.ts +24 -2
  115. package/dist/source/plugins/slugs.js +2 -3
  116. package/dist/source/plugins/status-badges.d.ts +52 -0
  117. package/dist/source/plugins/status-badges.js +54 -0
  118. package/dist/source/schema.d.ts +1 -3
  119. package/dist/source/schema.js +1 -2
  120. package/dist/{static-Dq8pA8Ay.js → static-DTxK4eHk.js} +5 -6
  121. package/dist/toc.d.ts +1 -2
  122. package/dist/toc.js +1 -2
  123. package/dist/{rehype-code-sM9Tq-r7.js → transformer-icon-BYedaeE8.js} +1 -96
  124. package/dist/transformer-icon-D7-6aFzt.d.ts +18 -0
  125. package/dist/types-BSnJn7kF.d.ts +6 -0
  126. package/dist/{util-CK2ykiif.d.ts → util-C60LmklF.d.ts} +1 -2
  127. package/dist/{util-s9piKHsk.js → util-De0ALHOx.js} +1 -2
  128. package/dist/utils/use-media-query.d.ts +1 -2
  129. package/dist/utils/use-media-query.js +1 -2
  130. package/dist/utils/use-on-change.d.ts +1 -2
  131. package/dist/utils/use-on-change.js +1 -2
  132. package/dist/{utils-DUvi2WkD.js → utils-Bc53B3CJ.js} +8 -7
  133. package/dist/utils-IgHyYnrz.d.ts +45 -0
  134. package/package.json +68 -38
  135. package/dist/advanced-BRT5Ij43.js.map +0 -1
  136. package/dist/algolia-CQPXCnjV.js.map +0 -1
  137. package/dist/algolia-Cc1y6qWl.d.ts +0 -68
  138. package/dist/algolia-Cc1y6qWl.d.ts.map +0 -1
  139. package/dist/breadcrumb.d.ts.map +0 -1
  140. package/dist/breadcrumb.js.map +0 -1
  141. package/dist/codeblock-utils-DDnYb8gi.d.ts +0 -37
  142. package/dist/codeblock-utils-DDnYb8gi.d.ts.map +0 -1
  143. package/dist/content/github.d.ts.map +0 -1
  144. package/dist/content/github.js.map +0 -1
  145. package/dist/content/index.d.ts.map +0 -1
  146. package/dist/content/index.js.map +0 -1
  147. package/dist/content/mdx/preset-bundler.d.ts.map +0 -1
  148. package/dist/content/mdx/preset-bundler.js.map +0 -1
  149. package/dist/content/mdx/preset-runtime.d.ts.map +0 -1
  150. package/dist/content/mdx/preset-runtime.js.map +0 -1
  151. package/dist/content/toc.d.ts.map +0 -1
  152. package/dist/content/toc.js.map +0 -1
  153. package/dist/definitions-DuxDer_c.d.ts.map +0 -1
  154. package/dist/dynamic-link.d.ts.map +0 -1
  155. package/dist/dynamic-link.js.map +0 -1
  156. package/dist/fetch-B5e9CFfN.js.map +0 -1
  157. package/dist/framework/index.d.ts.map +0 -1
  158. package/dist/framework/index.js.map +0 -1
  159. package/dist/framework/next.d.ts.map +0 -1
  160. package/dist/framework/next.js.map +0 -1
  161. package/dist/framework/react-router.d.ts.map +0 -1
  162. package/dist/framework/react-router.js.map +0 -1
  163. package/dist/framework/tanstack.d.ts.map +0 -1
  164. package/dist/framework/tanstack.js.map +0 -1
  165. package/dist/framework/waku.d.ts.map +0 -1
  166. package/dist/framework/waku.js.map +0 -1
  167. package/dist/highlight/client.d.ts.map +0 -1
  168. package/dist/highlight/client.js.map +0 -1
  169. package/dist/i18n/index.js.map +0 -1
  170. package/dist/i18n/middleware.d.ts.map +0 -1
  171. package/dist/i18n/middleware.js.map +0 -1
  172. package/dist/icon-BWwSDabM.js.map +0 -1
  173. package/dist/index-2U6Tl4--.d.ts.map +0 -1
  174. package/dist/index-Bw-DCOra.d.ts +0 -41
  175. package/dist/index-Bw-DCOra.d.ts.map +0 -1
  176. package/dist/link.d.ts.map +0 -1
  177. package/dist/link.js.map +0 -1
  178. package/dist/mdast-utils-mc9-X-PK.js.map +0 -1
  179. package/dist/mdx-plugins/codeblock-utils.js.map +0 -1
  180. package/dist/mdx-plugins/remark-admonition.js.map +0 -1
  181. package/dist/mdx-plugins/remark-code-tab.js.map +0 -1
  182. package/dist/mdx-plugins/remark-directive-admonition.js.map +0 -1
  183. package/dist/mdx-plugins/remark-heading.js.map +0 -1
  184. package/dist/mdx-plugins/remark-image.js.map +0 -1
  185. package/dist/mdx-plugins/remark-mdx-files.js.map +0 -1
  186. package/dist/mdx-plugins/remark-mdx-mermaid.js.map +0 -1
  187. package/dist/mdx-plugins/remark-npm.js.map +0 -1
  188. package/dist/mdx-plugins/remark-steps.js.map +0 -1
  189. package/dist/mdx-plugins/remark-structure.js.map +0 -1
  190. package/dist/mixedbread-DlByNYSd.js.map +0 -1
  191. package/dist/negotiation/index.d.ts.map +0 -1
  192. package/dist/negotiation/index.js.map +0 -1
  193. package/dist/normalize-url-ChLsV26G.js.map +0 -1
  194. package/dist/orama-cloud-DH3g37zc.js.map +0 -1
  195. package/dist/page-tree/index.d.ts.map +0 -1
  196. package/dist/path-DHIjrDBP.js.map +0 -1
  197. package/dist/rehype-code-sM9Tq-r7.js.map +0 -1
  198. package/dist/rehype-code-vVWG4-ej.d.ts +0 -58
  199. package/dist/rehype-code-vVWG4-ej.d.ts.map +0 -1
  200. package/dist/rehype-toc-DJvSyE0o.d.ts +0 -18
  201. package/dist/rehype-toc-DJvSyE0o.d.ts.map +0 -1
  202. package/dist/rehype-toc-DVwJcwvA.js +0 -143
  203. package/dist/rehype-toc-DVwJcwvA.js.map +0 -1
  204. package/dist/remark-admonition-DOwBWzsH.d.ts +0 -22
  205. package/dist/remark-admonition-DOwBWzsH.d.ts.map +0 -1
  206. package/dist/remark-code-tab-CXsYlims.d.ts +0 -32
  207. package/dist/remark-code-tab-CXsYlims.d.ts.map +0 -1
  208. package/dist/remark-directive-admonition-BCm_yiU9.d.ts +0 -36
  209. package/dist/remark-directive-admonition-BCm_yiU9.d.ts.map +0 -1
  210. package/dist/remark-gfm-CeWpMwyk.d.ts +0 -2
  211. package/dist/remark-heading-CXvCY0go.d.ts +0 -37
  212. package/dist/remark-heading-CXvCY0go.d.ts.map +0 -1
  213. package/dist/remark-image-CvUis4R1.d.ts +0 -65
  214. package/dist/remark-image-CvUis4R1.d.ts.map +0 -1
  215. package/dist/remark-mdx-files-DOYafA4x.d.ts +0 -42
  216. package/dist/remark-mdx-files-DOYafA4x.d.ts.map +0 -1
  217. package/dist/remark-mdx-mermaid-BdSUUiCG.d.ts +0 -17
  218. package/dist/remark-mdx-mermaid-BdSUUiCG.d.ts.map +0 -1
  219. package/dist/remark-npm-Bo08HqcQ.d.ts +0 -36
  220. package/dist/remark-npm-Bo08HqcQ.d.ts.map +0 -1
  221. package/dist/remark-steps-CHJN-rtm.d.ts +0 -28
  222. package/dist/remark-steps-CHJN-rtm.d.ts.map +0 -1
  223. package/dist/remark-structure-DGuWR82i.d.ts +0 -77
  224. package/dist/remark-structure-DGuWR82i.d.ts.map +0 -1
  225. package/dist/remove-undefined-Cfs4o_mM.js.map +0 -1
  226. package/dist/search/algolia.js.map +0 -1
  227. package/dist/search/client.d.ts.map +0 -1
  228. package/dist/search/client.js.map +0 -1
  229. package/dist/search/index.d.ts.map +0 -1
  230. package/dist/search/orama-cloud.d.ts.map +0 -1
  231. package/dist/search/orama-cloud.js.map +0 -1
  232. package/dist/search/server.js.map +0 -1
  233. package/dist/search-D6ChCLhY.js +0 -44
  234. package/dist/search-D6ChCLhY.js.map +0 -1
  235. package/dist/server-DmY4lGBs.d.ts +0 -133
  236. package/dist/server-DmY4lGBs.d.ts.map +0 -1
  237. package/dist/shiki-B5wNmyIZ.js +0 -80
  238. package/dist/shiki-B5wNmyIZ.js.map +0 -1
  239. package/dist/shiki-Dq3XIYAT.d.ts +0 -33
  240. package/dist/shiki-Dq3XIYAT.d.ts.map +0 -1
  241. package/dist/source/client/index.d.ts.map +0 -1
  242. package/dist/source/client/index.js.map +0 -1
  243. package/dist/source/index.js.map +0 -1
  244. package/dist/source/plugins/lucide-icons.d.ts.map +0 -1
  245. package/dist/source/plugins/lucide-icons.js.map +0 -1
  246. package/dist/source/plugins/slugs.js.map +0 -1
  247. package/dist/source/schema.d.ts.map +0 -1
  248. package/dist/source/schema.js.map +0 -1
  249. package/dist/static-Dq8pA8Ay.js.map +0 -1
  250. package/dist/toc.d.ts.map +0 -1
  251. package/dist/toc.js.map +0 -1
  252. package/dist/util-CK2ykiif.d.ts.map +0 -1
  253. package/dist/util-s9piKHsk.js.map +0 -1
  254. package/dist/utils/use-effect-event.d.ts +0 -11
  255. package/dist/utils/use-effect-event.d.ts.map +0 -1
  256. package/dist/utils/use-effect-event.js +0 -19
  257. package/dist/utils/use-effect-event.js.map +0 -1
  258. package/dist/utils/use-media-query.d.ts.map +0 -1
  259. package/dist/utils/use-media-query.js.map +0 -1
  260. package/dist/utils/use-on-change.d.ts.map +0 -1
  261. package/dist/utils/use-on-change.js.map +0 -1
  262. package/dist/utils-DUvi2WkD.js.map +0 -1
@@ -1,2 +1,55 @@
1
- import { n as remarkMdxFiles, t as RemarkMdxFilesOptions } from "../remark-mdx-files-DOYafA4x.js";
2
- export { RemarkMdxFilesOptions, remarkMdxFiles };
1
+ import { Transformer } from "unified";
2
+ import { Root } from "mdast";
3
+ import { MdxJsxFlowElement } from "mdast-util-mdx-jsx";
4
+
5
+ //#region src/mdx-plugins/remark-mdx-files.d.ts
6
+ interface FileNode {
7
+ depth: number;
8
+ type: 'file';
9
+ name: string;
10
+ }
11
+ interface FolderNode {
12
+ depth: number;
13
+ type: 'folder';
14
+ name: string;
15
+ children: Node[];
16
+ }
17
+ interface ToMdxOptions {
18
+ defaultOpenAll: boolean;
19
+ }
20
+ type Node = FileNode | FolderNode;
21
+ interface RemarkMdxFilesOptions {
22
+ /**
23
+ * @defaultValue files
24
+ */
25
+ lang?: string;
26
+ toMdx?: (node: Node, options: ToMdxOptions) => MdxJsxFlowElement;
27
+ }
28
+ /**
29
+ *
30
+ * **Files CodeBlock:**
31
+ *
32
+ * Convert codeblocks with `files` as lang, like:
33
+ *
34
+ * ```files
35
+ * project
36
+ * ├── src
37
+ * │ ├── index.js
38
+ * │ └── utils
39
+ * │ └── helper.js
40
+ * ├── package.json
41
+ * ```
42
+ *
43
+ * into MDX `<Files />` component.
44
+ *
45
+ * **Auto Files:**
46
+ *
47
+ * Generates MDX `<Files />` component from file system.
48
+ *
49
+ * ```mdx
50
+ * <auto-files dir="scripts" pattern="my-dir/*" defaultOpenAll />
51
+ * ```
52
+ */
53
+ declare function remarkMdxFiles(options?: RemarkMdxFilesOptions): Transformer<Root, Root>;
54
+ //#endregion
55
+ export { FileNode, FolderNode, RemarkMdxFilesOptions, ToMdxOptions, remarkMdxFiles };
@@ -1,4 +1,5 @@
1
1
  import { visit } from "unist-util-visit";
2
+ import path from "node:path";
2
3
 
3
4
  //#region src/mdx-plugins/remark-mdx-files.ts
4
5
  function parseFileTree(code) {
@@ -35,12 +36,12 @@ function parseFileTree(code) {
35
36
  }
36
37
  return stack.get(0);
37
38
  }
38
- function defaultToMDX(node, depth = 0) {
39
+ function defaultToMDX(node, options, depth = 0) {
39
40
  if (depth === 0) return {
40
41
  type: "mdxJsxFlowElement",
41
42
  name: "Files",
42
43
  attributes: [],
43
- children: [defaultToMDX(node, depth + 1)]
44
+ children: [defaultToMDX(node, options, depth + 1)]
44
45
  };
45
46
  const attributes = [{
46
47
  type: "mdxJsxAttribute",
@@ -53,7 +54,7 @@ function defaultToMDX(node, depth = 0) {
53
54
  children: [],
54
55
  name: "File"
55
56
  };
56
- attributes.push({
57
+ if (options.defaultOpenAll) attributes.push({
57
58
  type: "mdxJsxAttribute",
58
59
  name: "defaultOpen",
59
60
  value: null
@@ -62,10 +63,13 @@ function defaultToMDX(node, depth = 0) {
62
63
  type: "mdxJsxFlowElement",
63
64
  attributes,
64
65
  name: "Folder",
65
- children: node.children.map((item) => defaultToMDX(item, depth + 1))
66
+ children: node.children.map((item) => defaultToMDX(item, options, depth + 1))
66
67
  };
67
68
  }
68
69
  /**
70
+ *
71
+ * **Files CodeBlock:**
72
+ *
69
73
  * Convert codeblocks with `files` as lang, like:
70
74
  *
71
75
  * ```files
@@ -77,20 +81,106 @@ function defaultToMDX(node, depth = 0) {
77
81
  * ├── package.json
78
82
  * ```
79
83
  *
80
- * into MDX `<Files />` component
84
+ * into MDX `<Files />` component.
85
+ *
86
+ * **Auto Files:**
87
+ *
88
+ * Generates MDX `<Files />` component from file system.
89
+ *
90
+ * ```mdx
91
+ * <auto-files dir="scripts" pattern="my-dir/*" defaultOpenAll />
92
+ * ```
81
93
  */
82
94
  function remarkMdxFiles(options = {}) {
83
95
  const { lang = "files", toMdx = defaultToMDX } = options;
84
- return (tree) => {
85
- visit(tree, "code", (node) => {
86
- if (node.lang !== lang || !node.value) return;
87
- const fileTree = parseFileTree(node.value);
88
- if (!fileTree) return;
89
- Object.assign(node, toMdx(fileTree));
96
+ async function autoFiles(file, node, { patterns, dir, defaultOpenAll = false }) {
97
+ const { glob } = await import("tinyglobby");
98
+ if (!patterns) file.fail("Missing `pattern` prop in <auto-files>", { place: node.position });
99
+ const baseDir = file.dirname ?? file.cwd;
100
+ const cwd = dir ? path.join(baseDir, dir) : baseDir;
101
+ const files = await glob(patterns, { cwd });
102
+ Object.assign(node, toMdx(buildFileTreeFromGlob(cwd, files), { defaultOpenAll }));
103
+ }
104
+ return async (tree, file) => {
105
+ const queue = [];
106
+ visit(tree, ["code", "mdxJsxFlowElement"], (node) => {
107
+ if (node.type === "code") {
108
+ if (node.lang !== lang || !node.value) return;
109
+ const fileTree = parseFileTree(node.value);
110
+ if (!fileTree) return;
111
+ Object.assign(node, toMdx(fileTree, { defaultOpenAll: true }));
112
+ return "skip";
113
+ }
114
+ if (node.type === "mdxJsxFlowElement") {
115
+ if (node.name !== "auto-files") return;
116
+ const parsed = {};
117
+ for (const attr of node.attributes) {
118
+ if (attr.type !== "mdxJsxAttribute") continue;
119
+ const { name, value } = attr;
120
+ switch (name) {
121
+ case "dir":
122
+ if (typeof value === "string") parsed.dir = value;
123
+ break;
124
+ case "pattern":
125
+ if (typeof value === "string") {
126
+ parsed.patterns ??= [];
127
+ parsed.patterns.push(value);
128
+ }
129
+ break;
130
+ case "defaultOpenAll":
131
+ parsed.defaultOpenAll = true;
132
+ break;
133
+ }
134
+ }
135
+ queue.push(autoFiles(file, node, parsed));
136
+ return "skip";
137
+ }
90
138
  });
139
+ await Promise.all(queue);
140
+ };
141
+ }
142
+ function buildFileTreeFromGlob(dir, files) {
143
+ const nodeMap = /* @__PURE__ */ new Map();
144
+ const root = {
145
+ depth: 0,
146
+ type: "folder",
147
+ name: path.basename(dir),
148
+ children: []
91
149
  };
150
+ nodeMap.set("", root);
151
+ for (const file of files) {
152
+ const parts = path.normalize(file).split(path.sep).filter((part) => part.length > 0);
153
+ let currentPath = "";
154
+ let current = root;
155
+ for (let i = 0; i < parts.length; i++) {
156
+ const name = parts[i];
157
+ const nextPath = path.join(currentPath, name);
158
+ if (i === parts.length - 1) {
159
+ const fileNode = {
160
+ depth: i + 1,
161
+ type: "file",
162
+ name
163
+ };
164
+ current.children.push(fileNode);
165
+ } else {
166
+ let folder = nodeMap.get(nextPath);
167
+ if (!folder) {
168
+ folder = {
169
+ depth: i + 1,
170
+ type: "folder",
171
+ name,
172
+ children: []
173
+ };
174
+ nodeMap.set(nextPath, folder);
175
+ current.children.push(folder);
176
+ }
177
+ current = folder;
178
+ currentPath = nextPath;
179
+ }
180
+ }
181
+ }
182
+ return root;
92
183
  }
93
184
 
94
185
  //#endregion
95
- export { remarkMdxFiles };
96
- //# sourceMappingURL=remark-mdx-files.js.map
186
+ export { remarkMdxFiles };
@@ -1,2 +1,16 @@
1
- import { n as remarkMdxMermaid, t as RemarkMdxMermaidOptions } from "../remark-mdx-mermaid-BdSUUiCG.js";
1
+ import { Transformer } from "unified";
2
+ import { Root } from "mdast";
3
+
4
+ //#region src/mdx-plugins/remark-mdx-mermaid.d.ts
5
+ interface RemarkMdxMermaidOptions {
6
+ /**
7
+ * @defaultValue mermaid
8
+ */
9
+ lang?: string;
10
+ }
11
+ /**
12
+ * Convert `mermaid` codeblocks into `<Mermaid />` MDX component
13
+ */
14
+ declare function remarkMdxMermaid(options?: RemarkMdxMermaidOptions): Transformer<Root, Root>;
15
+ //#endregion
2
16
  export { RemarkMdxMermaidOptions, remarkMdxMermaid };
@@ -27,5 +27,4 @@ function remarkMdxMermaid(options = {}) {
27
27
  }
28
28
 
29
29
  //#endregion
30
- export { remarkMdxMermaid };
31
- //# sourceMappingURL=remark-mdx-mermaid.js.map
30
+ export { remarkMdxMermaid };
@@ -1,2 +1,35 @@
1
- import { n as remarkNpm, t as RemarkNpmOptions } from "../remark-npm-Bo08HqcQ.js";
1
+ import { Transformer } from "unified";
2
+ import { Root } from "mdast";
3
+
4
+ //#region src/mdx-plugins/remark-npm.d.ts
5
+ interface PackageManager {
6
+ name: string;
7
+ /**
8
+ * Default to `name`
9
+ */
10
+ value?: string;
11
+ /**
12
+ * Convert from npm to another package manager
13
+ */
14
+ command: (command: string) => string | undefined;
15
+ }
16
+ interface RemarkNpmOptions {
17
+ /**
18
+ * Persist Tab value (Hanzo Docs UI only)
19
+ *
20
+ * @defaultValue false
21
+ */
22
+ persist?: {
23
+ id: string;
24
+ } | false;
25
+ packageManagers?: PackageManager[];
26
+ }
27
+ /**
28
+ * It generates multiple tabs of codeblocks for different package managers from a npm command codeblock.
29
+ */
30
+ declare function remarkNpm({
31
+ persist,
32
+ packageManagers
33
+ }?: RemarkNpmOptions): Transformer<Root, Root>;
34
+ //#endregion
2
35
  export { RemarkNpmOptions, remarkNpm };
@@ -64,5 +64,4 @@ function remarkNpm({ persist = false, packageManagers = [
64
64
  }
65
65
 
66
66
  //#endregion
67
- export { remarkNpm };
68
- //# sourceMappingURL=remark-npm.js.map
67
+ export { remarkNpm };
@@ -1,2 +1,27 @@
1
- import { n as remarkSteps, t as RemarkStepsOptions } from "../remark-steps-CHJN-rtm.js";
1
+ import { Transformer } from "unified";
2
+ import { Root } from "mdast";
3
+
4
+ //#region src/mdx-plugins/remark-steps.d.ts
5
+ interface RemarkStepsOptions {
6
+ /**
7
+ * Class name for steps container
8
+ *
9
+ * @defaultValue fd-steps
10
+ */
11
+ steps?: string;
12
+ /**
13
+ * Class name for step container
14
+ *
15
+ * @defaultValue fd-step
16
+ */
17
+ step?: string;
18
+ }
19
+ /**
20
+ * Convert headings in the format of `1. Hello World` into steps.
21
+ */
22
+ declare function remarkSteps({
23
+ steps,
24
+ step
25
+ }?: RemarkStepsOptions): Transformer<Root, Root>;
26
+ //#endregion
2
27
  export { RemarkStepsOptions, remarkSteps };
@@ -73,5 +73,4 @@ function remarkSteps({ steps = "fd-steps", step = "fd-step" } = {}) {
73
73
  }
74
74
 
75
75
  //#endregion
76
- export { remarkSteps };
77
- //# sourceMappingURL=remark-steps.js.map
76
+ export { remarkSteps };
@@ -1,2 +1,76 @@
1
- import { a as structure, i as remarkStructureDefaultOptions, n as StructuredData, r as remarkStructure, t as StructureOptions } from "../remark-structure-DGuWR82i.js";
1
+ import { PluggableList, Transformer } from "unified";
2
+ import { Nodes, Root } from "mdast";
3
+ import { MdxJsxAttribute, MdxJsxExpressionAttribute, MdxJsxFlowElement } from "mdast-util-mdx-jsx";
4
+
5
+ //#region src/mdx-plugins/remark-structure.d.ts
6
+ interface Heading$1 {
7
+ id: string;
8
+ content: string;
9
+ }
10
+ interface Content {
11
+ heading: string | undefined;
12
+ content: string;
13
+ }
14
+ interface StructuredData {
15
+ headings: Heading$1[];
16
+ /**
17
+ * Refer to paragraphs, a heading may contain multiple contents as well
18
+ */
19
+ contents: Content[];
20
+ }
21
+ interface StructureOptions {
22
+ /**
23
+ * Types to be scanned as content.
24
+ *
25
+ * @defaultValue ['heading', 'paragraph', 'blockquote', 'tableCell', 'mdxJsxFlowElement']
26
+ */
27
+ types?: string[] | ((node: Nodes) => boolean);
28
+ /**
29
+ * A list of indexable MDX attributes, either:
30
+ *
31
+ * - an array of attribute names.
32
+ * - a function that determines if attribute should be indexed.
33
+ */
34
+ allowedMdxAttributes?: string[] | ((node: MdxJsxFlowElement, attribute: MdxJsxAttribute | MdxJsxExpressionAttribute) => boolean);
35
+ /**
36
+ * export as `structuredData` or specified variable name.
37
+ */
38
+ exportAs?: string | boolean;
39
+ }
40
+ declare module 'mdast' {
41
+ interface Data {
42
+ /**
43
+ * [Hanzo Docs] Get content of unserializable element, `remarkStructure` uses it to generate search index.
44
+ */
45
+ _string?: string[];
46
+ }
47
+ }
48
+ declare module 'vfile' {
49
+ interface DataMap {
50
+ /**
51
+ * [Hanzo Docs] injected by `remarkStructure`
52
+ */
53
+ structuredData: StructuredData;
54
+ }
55
+ }
56
+ declare const remarkStructureDefaultOptions: {
57
+ types: string[];
58
+ allowedMdxAttributes: (node: MdxJsxFlowElement) => boolean;
59
+ exportAs: false;
60
+ };
61
+ /**
62
+ * Extract content into structured data.
63
+ *
64
+ * By default, the output is stored into VFile (`vfile.data.structuredData`), you can specify `exportAs` to export it.
65
+ */
66
+ declare function remarkStructure({
67
+ types,
68
+ allowedMdxAttributes,
69
+ exportAs
70
+ }?: StructureOptions): Transformer<Root, Root>;
71
+ /**
72
+ * Extract data from markdown/mdx content
73
+ */
74
+ declare function structure(content: string, remarkPlugins?: PluggableList, options?: StructureOptions): StructuredData;
75
+ //#endregion
2
76
  export { StructureOptions, StructuredData, remarkStructure, remarkStructureDefaultOptions, structure };
@@ -1,4 +1,4 @@
1
- import { n as toMdxExport, t as flattenNode } from "../mdast-utils-mc9-X-PK.js";
1
+ import { n as toMdxExport, t as flattenNode } from "../mdast-utils-gJMY143g.js";
2
2
  import { remark } from "remark";
3
3
  import remarkGfm from "remark-gfm";
4
4
  import Slugger from "github-slugger";
@@ -54,19 +54,19 @@ function remarkStructure({ types = remarkStructureDefaultOptions.types, allowedM
54
54
  element.data ||= {};
55
55
  element.data.hProperties ||= {};
56
56
  const properties = element.data.hProperties;
57
- const content$1 = flattenNode(element).trim();
58
- const id = properties.id ?? slugger.slug(content$1);
57
+ const content = flattenNode(element).trim();
58
+ const id = properties.id ?? slugger.slug(content);
59
59
  data.headings.push({
60
60
  id,
61
- content: content$1
61
+ content
62
62
  });
63
63
  lastHeading = id;
64
64
  return "skip";
65
65
  }
66
66
  if (element.data?._string) {
67
- for (const content$1 of element.data._string) data.contents.push({
67
+ for (const content of element.data._string) data.contents.push({
68
68
  heading: lastHeading,
69
- content: content$1
69
+ content
70
70
  });
71
71
  return "skip";
72
72
  }
@@ -102,5 +102,4 @@ function structure(content, remarkPlugins = [], options = {}) {
102
102
  }
103
103
 
104
104
  //#endregion
105
- export { remarkStructure, remarkStructureDefaultOptions, structure };
106
- //# sourceMappingURL=remark-structure.js.map
105
+ export { remarkStructure, remarkStructureDefaultOptions, structure };
@@ -1,7 +1,7 @@
1
- import { r as __toESM, t as __commonJSMin } from "./chunk-B-ezknvj.js";
1
+ import { r as __toESM, t as __commonJSMin } from "./chunk-CaR5F9JI.js";
2
2
  import Slugger from "github-slugger";
3
3
 
4
- //#region ../../node_modules/.pnpm/remove-markdown@0.6.2/node_modules/remove-markdown/index.js
4
+ //#region ../../node_modules/.pnpm/remove-markdown@0.6.3/node_modules/remove-markdown/index.js
5
5
  var require_remove_markdown = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6
6
  module.exports = function(md, options) {
7
7
  options = options || {};
@@ -11,6 +11,7 @@ var require_remove_markdown = /* @__PURE__ */ __commonJSMin(((exports, module) =
11
11
  options.useImgAltText = options.hasOwnProperty("useImgAltText") ? options.useImgAltText : true;
12
12
  options.abbr = options.hasOwnProperty("abbr") ? options.abbr : false;
13
13
  options.replaceLinksWithURL = options.hasOwnProperty("replaceLinksWithURL") ? options.replaceLinksWithURL : false;
14
+ options.separateLinksAndTexts = options.hasOwnProperty("separateLinksAndTexts") ? options.separateLinksAndTexts : null;
14
15
  options.htmlTagsToSkip = options.hasOwnProperty("htmlTagsToSkip") ? options.htmlTagsToSkip : [];
15
16
  options.throwError = options.hasOwnProperty("throwError") ? options.throwError : false;
16
17
  var output = md || "";
@@ -25,6 +26,7 @@ var require_remove_markdown = /* @__PURE__ */ __commonJSMin(((exports, module) =
25
26
  const joinedHtmlTagsToSkip = options.htmlTagsToSkip.join("|");
26
27
  htmlReplaceRegex = new RegExp(`<(?!\/?(${joinedHtmlTagsToSkip})(?=>|\s[^>]*>))[^>]*>`, "g");
27
28
  }
29
+ if (options.separateLinksAndTexts) output = output.replace(/\[([^\]]+)\]\(([^)]+)\)/g, "$1" + options.separateLinksAndTexts + "$2");
28
30
  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");
29
31
  } catch (e) {
30
32
  if (options.throwError) throw e;
@@ -37,7 +39,7 @@ var require_remove_markdown = /* @__PURE__ */ __commonJSMin(((exports, module) =
37
39
 
38
40
  //#endregion
39
41
  //#region src/search/client/mixedbread.ts
40
- var import_remove_markdown = /* @__PURE__ */ __toESM(require_remove_markdown());
42
+ var import_remove_markdown = /* @__PURE__ */ __toESM(require_remove_markdown(), 1);
41
43
  const slugger = new Slugger();
42
44
  function extractHeadingTitle(text) {
43
45
  const trimmedText = text.trim();
@@ -84,5 +86,4 @@ async function search(query, options) {
84
86
  }
85
87
 
86
88
  //#endregion
87
- export { search };
88
- //# sourceMappingURL=mixedbread-DlByNYSd.js.map
89
+ export { search };
@@ -17,5 +17,4 @@ declare function isMarkdownPreferred(request: Request, options?: {
17
17
  markdownMediaTypes?: string[];
18
18
  }): boolean;
19
19
  //#endregion
20
- export { getNegotiator, isMarkdownPreferred, rewritePath };
21
- //# sourceMappingURL=index.d.ts.map
20
+ export { getNegotiator, isMarkdownPreferred, rewritePath };
@@ -37,5 +37,4 @@ function isMarkdownPreferred(request, options) {
37
37
  }
38
38
 
39
39
  //#endregion
40
- export { getNegotiator, isMarkdownPreferred, rewritePath };
41
- //# sourceMappingURL=index.js.map
40
+ export { getNegotiator, isMarkdownPreferred, rewritePath };
@@ -12,5 +12,4 @@ function normalizeUrl(url) {
12
12
  }
13
13
 
14
14
  //#endregion
15
- export { normalizeUrl as t };
16
- //# sourceMappingURL=normalize-url-ChLsV26G.js.map
15
+ export { normalizeUrl as t };
@@ -1,5 +1,5 @@
1
- import { t as createContentHighlighter } from "./search-D6ChCLhY.js";
2
- import { t as removeUndefined } from "./remove-undefined-Cfs4o_mM.js";
1
+ import { createContentHighlighter } from "./search/index.js";
2
+ import { t as removeUndefined } from "./remove-undefined-CJm9cyrC.js";
3
3
 
4
4
  //#region src/search/client/orama-cloud.ts
5
5
  async function searchDocs(query, options) {
@@ -7,7 +7,7 @@ async function searchDocs(query, options) {
7
7
  const list = [];
8
8
  const { index = "default", client, params: extraParams, tag } = options;
9
9
  if (index === "crawler") {
10
- const result$1 = await client.search({
10
+ const result = await client.search({
11
11
  datasources: [],
12
12
  ...extraParams,
13
13
  term: query,
@@ -17,8 +17,8 @@ async function searchDocs(query, options) {
17
17
  },
18
18
  limit: 10
19
19
  });
20
- if (!result$1) return list;
21
- for (const hit of result$1.hits) {
20
+ if (!result) return list;
21
+ for (const hit of result.hits) {
22
22
  const doc = hit.document;
23
23
  list.push({
24
24
  id: hit.id,
@@ -80,5 +80,4 @@ async function searchDocs(query, options) {
80
80
  }
81
81
 
82
82
  //#endregion
83
- export { searchDocs };
84
- //# sourceMappingURL=orama-cloud-DH3g37zc.js.map
83
+ export { searchDocs };
@@ -0,0 +1,81 @@
1
+ import { createContentHighlighter } from "./search/index.js";
2
+ import { t as removeUndefined } from "./remove-undefined-CJm9cyrC.js";
3
+
4
+ //#region src/search/client/orama-cloud-legacy.ts
5
+ async function searchDocs(query, options) {
6
+ const highlighter = createContentHighlighter(query);
7
+ const list = [];
8
+ const { index = "default", client, params: extraParams = {}, tag } = options;
9
+ if (index === "crawler") {
10
+ const result = await client.search({
11
+ ...extraParams,
12
+ term: query,
13
+ where: {
14
+ category: tag ? { eq: tag.slice(0, 1).toUpperCase() + tag.slice(1) } : void 0,
15
+ ...extraParams.where
16
+ },
17
+ limit: 10
18
+ });
19
+ if (!result) return list;
20
+ for (const hit of result.hits) {
21
+ const doc = hit.document;
22
+ list.push({
23
+ id: hit.id,
24
+ type: "page",
25
+ content: doc.title,
26
+ contentWithHighlights: highlighter.highlight(doc.title),
27
+ url: doc.path
28
+ }, {
29
+ id: "page" + hit.id,
30
+ type: "text",
31
+ content: doc.content,
32
+ contentWithHighlights: highlighter.highlight(doc.content),
33
+ url: doc.path
34
+ });
35
+ }
36
+ return list;
37
+ }
38
+ const params = {
39
+ ...extraParams,
40
+ term: query,
41
+ where: removeUndefined({
42
+ tag,
43
+ ...extraParams.where
44
+ }),
45
+ groupBy: {
46
+ properties: ["page_id"],
47
+ maxResult: 7,
48
+ ...extraParams.groupBy
49
+ }
50
+ };
51
+ const result = await client.search(params);
52
+ if (!result || !result.groups) return list;
53
+ for (const item of result.groups) {
54
+ let addedHead = false;
55
+ for (const hit of item.result) {
56
+ const doc = hit.document;
57
+ if (!addedHead) {
58
+ list.push({
59
+ id: doc.page_id,
60
+ type: "page",
61
+ content: doc.title,
62
+ breadcrumbs: doc.breadcrumbs,
63
+ contentWithHighlights: highlighter.highlight(doc.title),
64
+ url: doc.url
65
+ });
66
+ addedHead = true;
67
+ }
68
+ list.push({
69
+ id: doc.id,
70
+ content: doc.content,
71
+ contentWithHighlights: highlighter.highlight(doc.content),
72
+ type: doc.content === doc.section ? "heading" : "text",
73
+ url: doc.section_id ? `${doc.url}#${doc.section_id}` : doc.url
74
+ });
75
+ }
76
+ }
77
+ return list;
78
+ }
79
+
80
+ //#endregion
81
+ export { searchDocs };
@@ -1,45 +1,3 @@
1
- import { a as Separator, i as Root, n as Item, r as Node, t as Folder } from "../definitions-DuxDer_c.js";
2
-
3
- //#region src/page-tree/utils.d.ts
4
-
5
- /**
6
- * Flatten tree to an array of page nodes
7
- */
8
- declare function flattenTree(nodes: Node[]): Item[];
9
- /**
10
- * Get neighbours of a page, useful for implementing "previous & next" buttons
11
- */
12
- declare function findNeighbour(tree: Root, url: string, options?: {
13
- separateRoot?: boolean;
14
- }): {
15
- previous?: Item;
16
- next?: Item;
17
- };
18
- declare function getPageTreeRoots(pageTree: Root | Folder): (Root | Folder)[];
19
- /**
20
- * Get other item nodes that lives under the same parent.
21
- */
22
- declare function getPageTreePeers(treeOrTrees: Root | Record<string, Root>, url: string): Item[];
23
- /**
24
- * Get other tree nodes that lives under the same parent.
25
- */
26
- declare function findSiblings(treeOrTrees: Root | Record<string, Root>, url: string): Node[];
27
- declare function findParent(from: Root | Folder, url: string): Root | Folder | undefined;
28
- /**
29
- * Search the path of a node in the tree matched by the matcher.
30
- *
31
- * @returns The path to the target node (from starting root), or null if the page doesn't exist
32
- */
33
- declare function findPath(nodes: Node[], matcher: (node: Node) => boolean, options?: {
34
- includeSeparator?: boolean;
35
- }): Node[] | null;
36
- /**
37
- * Perform a depth-first search on page tree visiting every node.
38
- *
39
- * @param root - the root of page tree to visit.
40
- * @param visitor - function to receive nodes, return `skip` to skip the children of current node, `break` to stop the search entirely.
41
- */
42
- declare function visit<Root$1 extends Node | Root>(root: Root$1, visitor: <T extends Node | Root>(node: T, parent?: Root | Folder) => 'skip' | 'break' | T | void): Root$1;
43
- //#endregion
44
- export { Folder, Item, Node, Root, Separator, findNeighbour, findParent, findPath, findSiblings, flattenTree, getPageTreePeers, getPageTreeRoots, visit };
45
- //# sourceMappingURL=index.d.ts.map
1
+ import { a as Separator, i as Root, n as Item, r as Node, t as Folder } from "../definitions-DSNTbAwC.js";
2
+ import { a as flattenTree, c as visit, i as findSiblings, n as findParent, o as getPageTreePeers, r as findPath, s as getPageTreeRoots, t as findNeighbour } from "../utils-IgHyYnrz.js";
3
+ export { Folder, Item, Node, Root, Separator, findNeighbour, findParent, findPath, findSiblings, flattenTree, getPageTreePeers, getPageTreeRoots, visit };
@@ -1,3 +1,3 @@
1
- import { a as flattenTree, c as visit, i as findSiblings, n as findParent, o as getPageTreePeers, r as findPath, s as getPageTreeRoots, t as findNeighbour } from "../utils-DUvi2WkD.js";
1
+ import { a as flattenTree, c as visit, i as findSiblings, n as findParent, o as getPageTreePeers, r as findPath, s as getPageTreeRoots, t as findNeighbour } from "../utils-Bc53B3CJ.js";
2
2
 
3
3
  export { findNeighbour, findParent, findPath, findSiblings, flattenTree, getPageTreePeers, getPageTreeRoots, visit };