fumadocs-core 16.6.8 → 16.6.10

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 (61) hide show
  1. package/dist/{advanced-ZOIuXvBJ.js → advanced-D8-Cn2tE.js} +1 -1
  2. package/dist/breadcrumb.d.ts +1 -1
  3. package/dist/content/mdx/preset-bundler.d.ts +1 -3
  4. package/dist/content/mdx/preset-bundler.js +1 -1
  5. package/dist/content/mdx/preset-runtime.d.ts +1 -3
  6. package/dist/content/mdx/preset-runtime.js +1 -1
  7. package/dist/content/toc.js +1 -1
  8. package/dist/{create-i18n-DxSvCSv-.d.ts → create-i18n-BakPYec9.d.ts} +2 -2
  9. package/dist/highlight/config.d.ts +1 -1
  10. package/dist/highlight/core/client.d.ts +1 -1
  11. package/dist/highlight/core/index.d.ts +1 -1
  12. package/dist/highlight/index.d.ts +1 -1
  13. package/dist/{mdast-utils-gJMY143g.js → mdast-utils-hhRcKfZf.js} +5 -3
  14. package/dist/mdx-plugins/index.d.ts +3 -3
  15. package/dist/mdx-plugins/index.js +1 -1
  16. package/dist/mdx-plugins/rehype-code.core.d.ts +2 -2
  17. package/dist/mdx-plugins/rehype-code.d.ts +1 -1
  18. package/dist/mdx-plugins/rehype-toc.d.ts +33 -5
  19. package/dist/mdx-plugins/rehype-toc.js +99 -108
  20. package/dist/mdx-plugins/remark-admonition.js +1 -1
  21. package/dist/mdx-plugins/remark-feedback-block.js +1 -1
  22. package/dist/mdx-plugins/remark-heading.d.ts +10 -1
  23. package/dist/mdx-plugins/remark-heading.js +9 -5
  24. package/dist/mdx-plugins/remark-structure.js +1 -1
  25. package/dist/{mixedbread-TBJmV3co.js → mixedbread-BewwCSYr.js} +1 -1
  26. package/dist/{orama-cloud-cgTJNLo0.js → orama-cloud-EXSXD2UK.js} +1 -1
  27. package/dist/{orama-cloud-legacy-Caf8mcU9.js → orama-cloud-legacy-BD43H--x.js} +1 -1
  28. package/dist/page-tree/index.d.ts +2 -2
  29. package/dist/{path-CDjb5iUO.d.ts → path-oEC3g6wP.d.ts} +19 -12
  30. package/dist/search/client.d.ts +0 -5
  31. package/dist/search/client.js +6 -6
  32. package/dist/search/mixedbread.d.ts +0 -4
  33. package/dist/search/mixedbread.js +2 -2
  34. package/dist/search/orama-cloud-legacy.d.ts +0 -2
  35. package/dist/search/orama-cloud.d.ts +0 -2
  36. package/dist/search/server.d.ts +1 -4
  37. package/dist/search/server.js +47 -40
  38. package/dist/source/client/index.d.ts +1 -4
  39. package/dist/source/index.d.ts +2 -4
  40. package/dist/source/index.js +77 -14
  41. package/dist/source/plugins/lucide-icons.d.ts +1 -4
  42. package/dist/source/plugins/lucide-icons.js +1 -1
  43. package/dist/source/plugins/slugs.d.ts +1 -3
  44. package/dist/source/plugins/slugs.js +1 -1
  45. package/dist/source/plugins/status-badges.d.ts +2 -3
  46. package/dist/{static-BUXJwBmr.js → static-dXiDJ_Bs.js} +1 -1
  47. package/dist/{utils-5HX-8dF3.d.ts → utils-DWLhAKwM.d.ts} +1 -1
  48. package/package.json +6 -6
  49. package/dist/hast-utils-BmGqqmvo.js +0 -15
  50. /package/dist/{algolia-CfKKhsrI.js → algolia-y2iOKbWu.js} +0 -0
  51. /package/dist/{create-endpoint-9PZc4Cmz.js → create-endpoint-ErPy6bli.js} +0 -0
  52. /package/dist/{definitions-Cw2aM1Af.d.ts → definitions-VpSOvVeD.d.ts} +0 -0
  53. /package/dist/{fetch-D_OY-eAB.js → fetch-CqH9lOHV.js} +0 -0
  54. /package/dist/{icon-CGDZIqYj.js → icon-DzOeXioY.js} +0 -0
  55. /package/dist/{path-CfJghBXy.js → path-CX1URXrl.js} +0 -0
  56. /package/dist/{remove-markdown-CnXcUR-e.js → remove-markdown-CpjkP9z4.js} +0 -0
  57. /package/dist/{remove-undefined-B_oBVupY.js → remove-undefined-CM-o9RdZ.js} +0 -0
  58. /package/dist/{transformer-icon-C8MUuI2T.d.ts → transformer-icon-BtBormWx.d.ts} +0 -0
  59. /package/dist/{types-Bt4vrwsT.d.ts → types-BKxquRYN.d.ts} +0 -0
  60. /package/dist/{util-C7X6g0ql.d.ts → util-DJ5AvEKK.d.ts} +0 -0
  61. /package/dist/{util-bgCahl6-.js → util-DLLyljU4.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { createContentHighlighter } from "./search/index.js";
2
- import { t as removeUndefined } from "./remove-undefined-B_oBVupY.js";
2
+ import { t as removeUndefined } from "./remove-undefined-CM-o9RdZ.js";
3
3
  import { getByID, search } from "@orama/orama";
4
4
 
5
5
  //#region src/search/orama/search/simple.ts
@@ -1,4 +1,4 @@
1
- import { i as Root, r as Node } from "./definitions-Cw2aM1Af.js";
1
+ import { i as Root, r as Node } from "./definitions-VpSOvVeD.js";
2
2
  import { ReactNode } from "react";
3
3
 
4
4
  //#region src/breadcrumb.d.ts
@@ -1,12 +1,10 @@
1
- import "../../transformer-icon-C8MUuI2T.js";
2
1
  import { RehypeCodeOptions } from "../../mdx-plugins/rehype-code.js";
3
2
  import { RemarkImageOptions } from "../../mdx-plugins/remark-image.js";
4
3
  import { StructureOptions } from "../../mdx-plugins/remark-structure.js";
5
4
  import { RemarkHeadingOptions } from "../../mdx-plugins/remark-heading.js";
6
5
  import { RemarkCodeTabOptions } from "../../mdx-plugins/remark-code-tab.js";
7
6
  import { RemarkNpmOptions } from "../../mdx-plugins/remark-npm.js";
8
- import "../../mdx-plugins/index.js";
9
- import { t as ResolvePlugins } from "../../util-C7X6g0ql.js";
7
+ import { t as ResolvePlugins } from "../../util-DJ5AvEKK.js";
10
8
  import { ProcessorOptions } from "@mdx-js/mdx";
11
9
 
12
10
  //#region src/content/mdx/preset-bundler.d.ts
@@ -1,4 +1,4 @@
1
- import { t as resolvePlugins } from "../../util-bgCahl6-.js";
1
+ import { t as resolvePlugins } from "../../util-DLLyljU4.js";
2
2
 
3
3
  //#region src/content/mdx/preset-bundler.ts
4
4
  /**
@@ -1,12 +1,10 @@
1
- import "../../transformer-icon-C8MUuI2T.js";
2
1
  import { RehypeCodeOptions } from "../../mdx-plugins/rehype-code.js";
3
2
  import { RemarkImageOptions } from "../../mdx-plugins/remark-image.js";
4
3
  import { StructureOptions } from "../../mdx-plugins/remark-structure.js";
5
4
  import { RemarkHeadingOptions } from "../../mdx-plugins/remark-heading.js";
6
5
  import { RemarkCodeTabOptions } from "../../mdx-plugins/remark-code-tab.js";
7
6
  import { RemarkNpmOptions } from "../../mdx-plugins/remark-npm.js";
8
- import "../../mdx-plugins/index.js";
9
- import { t as ResolvePlugins } from "../../util-C7X6g0ql.js";
7
+ import { t as ResolvePlugins } from "../../util-DJ5AvEKK.js";
10
8
  import { ProcessorOptions } from "@mdx-js/mdx";
11
9
 
12
10
  //#region src/content/mdx/preset-runtime.d.ts
@@ -1,4 +1,4 @@
1
- import { t as resolvePlugins } from "../../util-bgCahl6-.js";
1
+ import { t as resolvePlugins } from "../../util-DLLyljU4.js";
2
2
 
3
3
  //#region src/content/mdx/preset-runtime.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import "../mdast-utils-gJMY143g.js";
1
+ import "../mdast-utils-hhRcKfZf.js";
2
2
  import { remarkHeading } from "../mdx-plugins/remark-heading.js";
3
3
  import { remark } from "remark";
4
4
 
@@ -1,6 +1,6 @@
1
- import { t as Awaitable } from "./types-Bt4vrwsT.js";
1
+ import { t as Awaitable } from "./types-BKxquRYN.js";
2
2
  import { I18nConfig } from "./i18n/index.js";
3
- import { i as LoaderConfig, o as LoaderOutput, u as Page } from "./path-CDjb5iUO.js";
3
+ import { i as LoaderConfig, o as LoaderOutput, u as Page } from "./path-oEC3g6wP.js";
4
4
  import { AdvancedIndex, AdvancedOptions, Dynamic, Index, SearchAPI, SimpleOptions } from "./search/server.js";
5
5
  import { Language, Orama, TypedDocument } from "@orama/orama";
6
6
 
@@ -1,4 +1,4 @@
1
- import { t as Awaitable } from "../types-Bt4vrwsT.js";
1
+ import { t as Awaitable } from "../types-BKxquRYN.js";
2
2
  import { BundledTheme, CodeOptionsThemes, HighlighterCore } from "shiki";
3
3
 
4
4
  //#region src/highlight/config.d.ts
@@ -1,4 +1,4 @@
1
- import { r as MakeOptional } from "../../types-Bt4vrwsT.js";
1
+ import { r as MakeOptional } from "../../types-BKxquRYN.js";
2
2
  import { ResolvedShikiConfig } from "../config.js";
3
3
  import { CoreHighlightOptions } from "./index.js";
4
4
  import { DependencyList, ReactNode } from "react";
@@ -1,4 +1,4 @@
1
- import { n as DistributiveOmit } from "../../types-Bt4vrwsT.js";
1
+ import { n as DistributiveOmit } from "../../types-BKxquRYN.js";
2
2
  import { ResolvedShikiConfig } from "../config.js";
3
3
  import { ReactNode } from "react";
4
4
  import { Components } from "hast-util-to-jsx-runtime";
@@ -1,4 +1,4 @@
1
- import { n as DistributiveOmit } from "../types-Bt4vrwsT.js";
1
+ import { n as DistributiveOmit } from "../types-BKxquRYN.js";
2
2
  import { ResolvedShikiConfig } from "./config.js";
3
3
  import { CoreHighlightOptions } from "./core/index.js";
4
4
  import { ReactNode } from "react";
@@ -7,6 +7,9 @@ function flattenNode(node) {
7
7
  return "";
8
8
  }
9
9
  function toMdxExport(name, value) {
10
+ return toMdxExportRaw(name, valueToEstree(value));
11
+ }
12
+ function toMdxExportRaw(name, expression) {
10
13
  return {
11
14
  type: "mdxjsEsm",
12
15
  value: "",
@@ -17,7 +20,6 @@ function toMdxExport(name, value) {
17
20
  type: "ExportNamedDeclaration",
18
21
  attributes: [],
19
22
  specifiers: [],
20
- source: null,
21
23
  declaration: {
22
24
  type: "VariableDeclaration",
23
25
  kind: "let",
@@ -27,7 +29,7 @@ function toMdxExport(name, value) {
27
29
  type: "Identifier",
28
30
  name
29
31
  },
30
- init: valueToEstree(value)
32
+ init: expression
31
33
  }]
32
34
  }
33
35
  }]
@@ -36,4 +38,4 @@ function toMdxExport(name, value) {
36
38
  }
37
39
 
38
40
  //#endregion
39
- export { toMdxExport as n, flattenNode as t };
41
+ export { toMdxExport as n, toMdxExportRaw as r, flattenNode as t };
@@ -1,5 +1,5 @@
1
1
  import { RemarkGfmOptions, remarkGfm } from "./remark-gfm.js";
2
- import { r as transformerIcon, t as CodeBlockIcon } from "../transformer-icon-C8MUuI2T.js";
2
+ import { r as transformerIcon, t as CodeBlockIcon } from "../transformer-icon-BtBormWx.js";
3
3
  import { transformerTab } from "./rehype-code.core.js";
4
4
  import { RehypeCodeOptions, rehypeCode, rehypeCodeDefaultOptions } from "./rehype-code.js";
5
5
  import { RemarkImageOptions, remarkImage } from "./remark-image.js";
@@ -7,7 +7,7 @@ import { StringifyOptions, StructureOptions, StructuredData, defaultStringifier,
7
7
  import { RemarkHeadingOptions, remarkHeading } from "./remark-heading.js";
8
8
  import { RemarkAdmonitionOptions, remarkAdmonition } from "./remark-admonition.js";
9
9
  import { RemarkDirectiveAdmonitionOptions, remarkDirectiveAdmonition } from "./remark-directive-admonition.js";
10
- import { RehypeTocOptions, rehypeToc } from "./rehype-toc.js";
10
+ import { RehypeTOCItemType, RehypeTocOptions, rehypeToc } from "./rehype-toc.js";
11
11
  import { RemarkCodeTabOptions, remarkCodeTab } from "./remark-code-tab.js";
12
12
  import { RemarkStepsOptions, remarkSteps } from "./remark-steps.js";
13
13
  import { RemarkNpmOptions, remarkNpm } from "./remark-npm.js";
@@ -15,4 +15,4 @@ import { CodeBlockAttributes, CodeBlockTabsOptions, generateCodeBlockTabs, parse
15
15
  import { RemarkMdxFilesOptions, remarkMdxFiles } from "./remark-mdx-files.js";
16
16
  import { RemarkMdxMermaidOptions, remarkMdxMermaid } from "./remark-mdx-mermaid.js";
17
17
  import { FeedbackBlockProps, RemarkFeedbackBlockOptions, remarkFeedbackBlock } from "./remark-feedback-block.js";
18
- export { CodeBlockAttributes, CodeBlockIcon, CodeBlockTabsOptions, FeedbackBlockProps, RehypeCodeOptions, RehypeTocOptions, RemarkAdmonitionOptions, RemarkCodeTabOptions, RemarkDirectiveAdmonitionOptions, RemarkFeedbackBlockOptions, RemarkGfmOptions, RemarkHeadingOptions, RemarkImageOptions, type RemarkMdxFilesOptions, RemarkMdxMermaidOptions, RemarkNpmOptions, RemarkStepsOptions, StringifyOptions, StructureOptions, StructuredData, defaultStringifier, generateCodeBlockTabs, parseCodeBlockAttributes, rehypeCode, rehypeCodeDefaultOptions, rehypeToc, remarkAdmonition, remarkCodeTab, remarkDirectiveAdmonition, remarkFeedbackBlock, remarkGfm, remarkHeading, remarkImage, remarkMdxFiles, remarkMdxMermaid, remarkNpm, remarkSteps, remarkStructure, remarkStructureDefaultOptions, structure, transformerIcon, transformerTab };
18
+ export { CodeBlockAttributes, CodeBlockIcon, CodeBlockTabsOptions, FeedbackBlockProps, RehypeCodeOptions, RehypeTOCItemType, RehypeTocOptions, RemarkAdmonitionOptions, RemarkCodeTabOptions, RemarkDirectiveAdmonitionOptions, RemarkFeedbackBlockOptions, RemarkGfmOptions, RemarkHeadingOptions, RemarkImageOptions, type RemarkMdxFilesOptions, RemarkMdxMermaidOptions, RemarkNpmOptions, RemarkStepsOptions, StringifyOptions, StructureOptions, StructuredData, defaultStringifier, generateCodeBlockTabs, parseCodeBlockAttributes, rehypeCode, rehypeCodeDefaultOptions, rehypeToc, remarkAdmonition, remarkCodeTab, remarkDirectiveAdmonition, remarkFeedbackBlock, remarkGfm, remarkHeading, remarkImage, remarkMdxFiles, remarkMdxMermaid, remarkNpm, remarkSteps, remarkStructure, remarkStructureDefaultOptions, structure, transformerIcon, transformerTab };
@@ -1,4 +1,4 @@
1
- import "../mdast-utils-gJMY143g.js";
1
+ import "../mdast-utils-hhRcKfZf.js";
2
2
  import { remarkHeading } from "./remark-heading.js";
3
3
  import { generateCodeBlockTabs, parseCodeBlockAttributes } from "./codeblock-utils.js";
4
4
  import { remarkGfm } from "./remark-gfm.js";
@@ -1,5 +1,5 @@
1
- import { n as IconOptions, r as transformerIcon, t as CodeBlockIcon } from "../transformer-icon-C8MUuI2T.js";
2
- import { n as DistributiveOmit } from "../types-Bt4vrwsT.js";
1
+ import { n as IconOptions, r as transformerIcon, t as CodeBlockIcon } from "../transformer-icon-BtBormWx.js";
2
+ import { n as DistributiveOmit } from "../types-BKxquRYN.js";
3
3
  import { ResolvedShikiConfig } from "../highlight/config.js";
4
4
  import { ShikiTransformer } from "shiki";
5
5
  import { Processor, Transformer } from "unified";
@@ -1,4 +1,4 @@
1
- import { r as transformerIcon, t as CodeBlockIcon } from "../transformer-icon-C8MUuI2T.js";
1
+ import { r as transformerIcon, t as CodeBlockIcon } from "../transformer-icon-BtBormWx.js";
2
2
  import { RehypeCodeOptionsCommon, transformerTab } from "./rehype-code.core.js";
3
3
  import * as unified from "unified";
4
4
  import * as hast from "hast";
@@ -1,17 +1,45 @@
1
1
  import { Processor, Transformer } from "unified";
2
- import { Root } from "hast";
2
+ import { Element, Root } from "hast";
3
3
 
4
4
  //#region src/mdx-plugins/rehype-toc.d.ts
5
5
  interface RehypeTocOptions {
6
6
  /**
7
- * Export generated toc as a variable
7
+ * Export the generated toc.
8
8
  *
9
- * @defaultValue true
9
+ * - `true` (default): as an ESM export named `toc`.
10
+ * - `false`: disable the plugin.
10
11
  */
11
- exportToc?: boolean;
12
+ exportToc?: boolean | {
13
+ /**
14
+ * generate to `file.data.rehypeToc`.
15
+ */
16
+ as: 'data';
17
+ } | {
18
+ /**
19
+ * generate as an ESM export.
20
+ */
21
+ as: 'esm';
22
+ name: string;
23
+ };
24
+ }
25
+ declare module 'vfile' {
26
+ interface DataMap {
27
+ /**
28
+ * [Fumadocs: rehype-toc] output data.
29
+ */
30
+ rehypeToc?: RehypeTOCItemType[];
31
+ }
32
+ }
33
+ interface RehypeTOCItemType {
34
+ /**
35
+ * the original heading tag
36
+ */
37
+ title: Element;
38
+ url: string;
39
+ depth: number;
12
40
  }
13
41
  declare function rehypeToc(this: Processor, {
14
42
  exportToc
15
43
  }?: RehypeTocOptions): Transformer<Root, Root>;
16
44
  //#endregion
17
- export { RehypeTocOptions, rehypeToc };
45
+ export { RehypeTOCItemType, RehypeTocOptions, rehypeToc };
@@ -1,127 +1,118 @@
1
- import { t as visit } from "../hast-utils-BmGqqmvo.js";
1
+ import { r as toMdxExportRaw } from "../mdast-utils-hhRcKfZf.js";
2
+ import { visit } from "unist-util-visit";
2
3
  import { toEstree } from "hast-util-to-estree";
3
4
 
4
5
  //#region src/mdx-plugins/rehype-toc.ts
5
6
  const TocOnlyTag = "[toc]";
6
7
  const NoTocTag = "[!toc]";
8
+ const HeadingTags = new Set([
9
+ "h1",
10
+ "h2",
11
+ "h3",
12
+ "h4",
13
+ "h5",
14
+ "h6"
15
+ ]);
7
16
  function rehypeToc({ exportToc = true } = {}) {
8
- return (tree) => {
9
- const output = [];
10
- visit(tree, [
11
- "h1",
12
- "h2",
13
- "h3",
14
- "h4",
15
- "h5",
16
- "h6"
17
- ], (element) => {
17
+ if (exportToc === true) exportToc = {
18
+ as: "esm",
19
+ name: "toc"
20
+ };
21
+ if (exportToc === false) return () => void 0;
22
+ return (tree, file) => {
23
+ const items = [];
24
+ visit(tree, "element", (element, idx, parent) => {
25
+ if (!HeadingTags.has(element.tagName) || element.children.length === 0) return;
18
26
  const id = element.properties.id;
19
27
  if (typeof id !== "string") return "skip";
20
28
  let isTocOnly = false;
21
- const last = element.children.at(-1);
22
- if (last?.type === "text" && last.value.endsWith(TocOnlyTag)) {
23
- isTocOnly = true;
24
- last.value = last.value.substring(0, last.value.length - 5).trimEnd();
25
- } else if (last?.type === "text" && last.value.endsWith(NoTocTag)) {
26
- last.value = last.value.substring(0, last.value.length - 6).trimEnd();
27
- return "skip";
29
+ const last = element.children[element.children.length - 1];
30
+ if (last.type === "text") {
31
+ if (last.value.endsWith(NoTocTag)) {
32
+ last.value = last.value.substring(0, last.value.length - 6).trimEnd();
33
+ return "skip";
34
+ }
35
+ if (last.value.endsWith(TocOnlyTag)) {
36
+ isTocOnly = true;
37
+ last.value = last.value.substring(0, last.value.length - 5).trimEnd();
38
+ }
28
39
  }
29
- const estree = toEstree(element, {
30
- elementAttributeNameCase: "react",
31
- stylePropertyNameCase: "dom"
32
- });
33
- if (estree.body[0].type === "ExpressionStatement") output.push({
34
- title: estree.body[0].expression,
35
- depth: Number(element.tagName.slice(1)),
40
+ items.push({
41
+ title: element,
42
+ depth: Number(element.tagName[1]),
36
43
  url: `#${id}`
37
44
  });
38
- if (isTocOnly) Object.assign(element, {
39
- type: "comment",
40
- value: ""
41
- });
45
+ if (isTocOnly && parent && typeof idx === "number") parent.children.splice(idx, 1);
42
46
  return "skip";
43
47
  });
44
- const declaration = {
45
- type: "VariableDeclaration",
46
- kind: "const",
47
- declarations: [{
48
- type: "VariableDeclarator",
49
- id: {
50
- type: "Identifier",
51
- name: "toc"
52
- },
53
- init: {
54
- type: "ArrayExpression",
55
- elements: output.map((item) => ({
56
- type: "ObjectExpression",
57
- properties: [
58
- {
59
- type: "Property",
60
- method: false,
61
- shorthand: false,
62
- computed: false,
63
- key: {
64
- type: "Identifier",
65
- name: "depth"
66
- },
67
- value: {
68
- type: "Literal",
69
- value: item.depth
70
- },
71
- kind: "init"
48
+ if (exportToc.as === "esm") {
49
+ const esmItems = [];
50
+ for (const item of items) {
51
+ const root = toEstree(item.title, {
52
+ elementAttributeNameCase: "react",
53
+ stylePropertyNameCase: "dom"
54
+ }).body[0];
55
+ if (root.type === "ExpressionStatement" && root.expression.type === "JSXElement") esmItems.push({
56
+ ...item,
57
+ title: root.expression
58
+ });
59
+ }
60
+ tree.children.push(toMdxExportRaw(exportToc.name, {
61
+ type: "ArrayExpression",
62
+ elements: esmItems.map((item) => ({
63
+ type: "ObjectExpression",
64
+ properties: [
65
+ {
66
+ type: "Property",
67
+ method: false,
68
+ shorthand: false,
69
+ computed: false,
70
+ key: {
71
+ type: "Identifier",
72
+ name: "depth"
72
73
  },
73
- {
74
- type: "Property",
75
- method: false,
76
- shorthand: false,
77
- computed: false,
78
- key: {
79
- type: "Identifier",
80
- name: "url"
81
- },
82
- value: {
83
- type: "Literal",
84
- value: item.url
85
- },
86
- kind: "init"
74
+ value: {
75
+ type: "Literal",
76
+ value: item.depth
87
77
  },
88
- {
89
- type: "Property",
90
- method: false,
91
- shorthand: false,
92
- computed: false,
93
- key: {
94
- type: "Identifier",
95
- name: "title"
96
- },
97
- value: {
98
- type: "JSXFragment",
99
- openingFragment: { type: "JSXOpeningFragment" },
100
- closingFragment: { type: "JSXClosingFragment" },
101
- children: item.title.children
102
- },
103
- kind: "init"
104
- }
105
- ]
106
- }))
107
- }
108
- }]
109
- };
110
- tree.children.push({
111
- type: "mdxjsEsm",
112
- value: "",
113
- data: { estree: {
114
- type: "Program",
115
- body: [exportToc ? {
116
- type: "ExportNamedDeclaration",
117
- declaration,
118
- attributes: [],
119
- specifiers: []
120
- } : declaration],
121
- sourceType: "module",
122
- comments: []
123
- } }
124
- });
78
+ kind: "init"
79
+ },
80
+ {
81
+ type: "Property",
82
+ method: false,
83
+ shorthand: false,
84
+ computed: false,
85
+ key: {
86
+ type: "Identifier",
87
+ name: "url"
88
+ },
89
+ value: {
90
+ type: "Literal",
91
+ value: item.url
92
+ },
93
+ kind: "init"
94
+ },
95
+ {
96
+ type: "Property",
97
+ method: false,
98
+ shorthand: false,
99
+ computed: false,
100
+ key: {
101
+ type: "Identifier",
102
+ name: "title"
103
+ },
104
+ value: {
105
+ type: "JSXFragment",
106
+ openingFragment: { type: "JSXOpeningFragment" },
107
+ closingFragment: { type: "JSXClosingFragment" },
108
+ children: item.title.children
109
+ },
110
+ kind: "init"
111
+ }
112
+ ]
113
+ }))
114
+ }));
115
+ } else file.data.rehypeToc = items;
125
116
  };
126
117
  }
127
118
 
@@ -1,4 +1,4 @@
1
- import { t as flattenNode } from "../mdast-utils-gJMY143g.js";
1
+ import { t as flattenNode } from "../mdast-utils-hhRcKfZf.js";
2
2
  import { visit } from "unist-util-visit";
3
3
 
4
4
  //#region src/mdx-plugins/remark-admonition.ts
@@ -1,4 +1,4 @@
1
- import { t as flattenNode } from "../mdast-utils-gJMY143g.js";
1
+ import { t as flattenNode } from "../mdast-utils-hhRcKfZf.js";
2
2
  import { visit } from "unist-util-visit";
3
3
  import { createHash } from "node:crypto";
4
4
 
@@ -1,3 +1,4 @@
1
+ import { TOCItemType } from "../toc.js";
1
2
  import { Transformer } from "unified";
2
3
  import { Heading, Root } from "mdast";
3
4
 
@@ -24,11 +25,19 @@ interface RemarkHeadingOptions {
24
25
  */
25
26
  generateToc?: boolean;
26
27
  }
28
+ declare module 'vfile' {
29
+ interface DataMap {
30
+ /**
31
+ * [Fumadocs: remark-heading] output data.
32
+ */
33
+ toc?: TOCItemType[];
34
+ }
35
+ }
27
36
  /**
28
37
  * Add heading ids and extract TOC
29
38
  */
30
39
  declare function remarkHeading({
31
- slug: defaultSlug,
40
+ slug,
32
41
  customId,
33
42
  generateToc
34
43
  }?: RemarkHeadingOptions): Transformer<Root, Root>;
@@ -1,17 +1,21 @@
1
- import { t as flattenNode } from "../mdast-utils-gJMY143g.js";
1
+ import { t as flattenNode } from "../mdast-utils-hhRcKfZf.js";
2
2
  import Slugger from "github-slugger";
3
3
  import { visit } from "unist-util-visit";
4
4
 
5
5
  //#region src/mdx-plugins/remark-heading.ts
6
- const slugger = new Slugger();
7
6
  const regex = /\s*\[#(?<slug>[^]+?)]\s*$/;
8
7
  /**
9
8
  * Add heading ids and extract TOC
10
9
  */
11
- function remarkHeading({ slug: defaultSlug, customId = true, generateToc = true } = {}) {
10
+ function remarkHeading({ slug, customId = true, generateToc = true } = {}) {
11
+ let slugger;
12
+ if (!slug) {
13
+ slugger = new Slugger();
14
+ slug = (_root, _heading, text) => slugger.slug(text);
15
+ }
12
16
  return (root, file) => {
13
17
  const toc = [];
14
- slugger.reset();
18
+ slugger?.reset();
15
19
  visit(root, "heading", (heading) => {
16
20
  heading.data ||= {};
17
21
  heading.data.hProperties ||= {};
@@ -27,7 +31,7 @@ function remarkHeading({ slug: defaultSlug, customId = true, generateToc = true
27
31
  let flattened = null;
28
32
  if (!props.id) {
29
33
  flattened ??= flattenNode(heading);
30
- props.id = defaultSlug ? defaultSlug(root, heading, flattened) : slugger.slug(flattened);
34
+ props.id = slug(root, heading, flattened);
31
35
  }
32
36
  if (generateToc) toc.push({
33
37
  title: flattened ?? flattenNode(heading),
@@ -1,4 +1,4 @@
1
- import { n as toMdxExport } from "../mdast-utils-gJMY143g.js";
1
+ import { n as toMdxExport } from "../mdast-utils-hhRcKfZf.js";
2
2
  import { remarkHeading } from "./remark-heading.js";
3
3
  import { remark } from "remark";
4
4
  import { visit } from "unist-util-visit";
@@ -1,5 +1,5 @@
1
1
  import { r as __toESM } from "./chunk-CaR5F9JI.js";
2
- import { t as require_remove_markdown } from "./remove-markdown-CnXcUR-e.js";
2
+ import { t as require_remove_markdown } from "./remove-markdown-CpjkP9z4.js";
3
3
  import Slugger from "github-slugger";
4
4
 
5
5
  //#region src/search/client/mixedbread.ts
@@ -1,5 +1,5 @@
1
1
  import { createContentHighlighter } from "./search/index.js";
2
- import { t as removeUndefined } from "./remove-undefined-B_oBVupY.js";
2
+ import { t as removeUndefined } from "./remove-undefined-CM-o9RdZ.js";
3
3
 
4
4
  //#region src/search/client/orama-cloud.ts
5
5
  async function searchDocs(query, options) {
@@ -1,5 +1,5 @@
1
1
  import { createContentHighlighter } from "./search/index.js";
2
- import { t as removeUndefined } from "./remove-undefined-B_oBVupY.js";
2
+ import { t as removeUndefined } from "./remove-undefined-CM-o9RdZ.js";
3
3
 
4
4
  //#region src/search/client/orama-cloud-legacy.ts
5
5
  async function searchDocs(query, options) {
@@ -1,3 +1,3 @@
1
- import { a as Separator, i as Root, n as Item, r as Node, t as Folder } from "../definitions-Cw2aM1Af.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-5HX-8dF3.js";
1
+ import { a as Separator, i as Root, n as Item, r as Node, t as Folder } from "../definitions-VpSOvVeD.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-DWLhAKwM.js";
3
3
  export { Folder, Item, Node, Root, Separator, findNeighbour, findParent, findPath, findSiblings, flattenTree, getPageTreePeers, getPageTreeRoots, visit };
@@ -1,4 +1,4 @@
1
- import { a as Separator, i as Root, n as Item, r as Node, t as Folder } from "./definitions-Cw2aM1Af.js";
1
+ import { a as Separator, i as Root, n as Item, r as Node, t as Folder } from "./definitions-VpSOvVeD.js";
2
2
  import { I18nConfig } from "./i18n/index.js";
3
3
  import { SlugFn } from "./source/plugins/slugs.js";
4
4
  import { SerializedPageTree } from "./source/client/index.js";
@@ -128,15 +128,6 @@ interface ContentStoragePageFile<Config extends SourceConfig = SourceConfig> {
128
128
  slugs: string[];
129
129
  data: Config['pageData'];
130
130
  }
131
- /**
132
- * convert input files into virtual file system.
133
- *
134
- * in the storage, locale codes are removed from file paths, hence the same file will have same file paths in every storage.
135
- */
136
- declare function createContentStorageBuilder(loaderConfig: ResolvedLoaderConfig): {
137
- i18n(): Record<string, ContentStorage>;
138
- single(): ContentStorage;
139
- };
140
131
  //#endregion
141
132
  //#region src/source/page-tree/builder.d.ts
142
133
  interface PageTreeBuilderContext<Config extends SourceConfig = SourceConfig> {
@@ -213,6 +204,22 @@ declare class PageTreeBuilder {
213
204
  //#region src/source/plugins/icon.d.ts
214
205
  type IconResolver = (icon: string | undefined) => ReactNode;
215
206
  //#endregion
207
+ //#region src/source/loader/llms.d.ts
208
+ interface Context {
209
+ lang?: string;
210
+ }
211
+ interface LLMsConfig {
212
+ TAB?: string;
213
+ renderName?: (item: Node | Root, ctx: Context) => string;
214
+ renderDescription?: (item: Item | Folder, ctx: Context) => string;
215
+ }
216
+ declare function llms<C extends LoaderConfig>(loader: LoaderOutput<C>, config?: LLMsConfig): {
217
+ /**
218
+ * generate `llms.txt` content in Markdown format.
219
+ */
220
+ index: (lang?: string) => string;
221
+ };
222
+ //#endregion
216
223
  //#region src/source/loader.d.ts
217
224
  interface LoaderConfig {
218
225
  source: SourceConfig;
@@ -235,7 +242,7 @@ interface LoaderOptions<C extends LoaderConfig = LoaderConfig> {
235
242
  interface ResolvedLoaderConfig {
236
243
  source: Source;
237
244
  url: (slugs: string[], locale?: string) => string;
238
- plugins?: LoaderPlugin[];
245
+ plugins: LoaderPlugin[];
239
246
  pageTree?: Partial<PageTreeOptions>;
240
247
  i18n?: I18nConfig | undefined;
241
248
  }
@@ -389,4 +396,4 @@ declare function splitPath(path: string): string[];
389
396
  declare function joinPath(...paths: string[]): string;
390
397
  declare function slash(path: string): string;
391
398
  //#endregion
392
- export { _SourceUpdate_ as A, FileSystem as C, SourceConfig as D, Source as E, source as M, update as N, VirtualFile as O, createContentStorageBuilder as S, PageData as T, PageTreeTransformer as _, LoaderOptions as a, ContentStorageMetaFile as b, LoaderPluginOption as c, ResolvedLoaderConfig as d, createGetUrl as f, PageTreeOptions as g, PageTreeBuilderContext as h, LoaderConfig as i, multiple as j, _ConfigUnion_ as k, Meta as l, PageTreeBuilder as m, InferMetaType as n, LoaderOutput as o, loader as p, InferPageType as r, LoaderPlugin as s, path_d_exports as t, Page as u, ContentStorage as v, MetaData as w, ContentStoragePageFile as x, ContentStorageFile as y };
399
+ export { _ConfigUnion_ as A, ContentStoragePageFile as C, Source as D, PageData as E, multiple as M, source as N, SourceConfig as O, update as P, ContentStorageMetaFile as S, MetaData as T, PageTreeBuilderContext as _, LoaderOptions as a, ContentStorage as b, LoaderPluginOption as c, ResolvedLoaderConfig as d, createGetUrl as f, PageTreeBuilder as g, llms as h, LoaderConfig as i, _SourceUpdate_ as j, VirtualFile as k, Meta as l, LLMsConfig as m, InferMetaType as n, LoaderOutput as o, loader as p, InferPageType as r, LoaderPlugin as s, path_d_exports as t, Page as u, PageTreeOptions as v, FileSystem as w, ContentStorageFile as x, PageTreeTransformer as y };
@@ -1,10 +1,5 @@
1
- import "../definitions-Cw2aM1Af.js";
2
- import "../utils-5HX-8dF3.js";
3
1
  import { BaseIndex } from "./algolia.js";
4
2
  import { SortedResult } from "./index.js";
5
- import "../create-i18n-DxSvCSv-.js";
6
- import "../path-CDjb5iUO.js";
7
- import "./server.js";
8
3
  import { DependencyList } from "react";
9
4
  import { AnyOrama } from "@orama/orama";
10
5
  import { LiteClient, SearchResponse } from "algoliasearch/lite";
@@ -54,27 +54,27 @@ function useDocsSearch(clientOptions, deps) {
54
54
  if (debouncedValue.length === 0 && !allowEmpty) return "empty";
55
55
  switch (client.type) {
56
56
  case "fetch": {
57
- const { fetchDocs } = await import("../fetch-D_OY-eAB.js");
57
+ const { fetchDocs } = await import("../fetch-CqH9lOHV.js");
58
58
  return fetchDocs(debouncedValue, client);
59
59
  }
60
60
  case "algolia": {
61
- const { searchDocs } = await import("../algolia-CfKKhsrI.js");
61
+ const { searchDocs } = await import("../algolia-y2iOKbWu.js");
62
62
  return searchDocs(debouncedValue, client);
63
63
  }
64
64
  case "orama-cloud": {
65
- const { searchDocs } = await import("../orama-cloud-cgTJNLo0.js");
65
+ const { searchDocs } = await import("../orama-cloud-EXSXD2UK.js");
66
66
  return searchDocs(debouncedValue, client);
67
67
  }
68
68
  case "orama-cloud-legacy": {
69
- const { searchDocs } = await import("../orama-cloud-legacy-Caf8mcU9.js");
69
+ const { searchDocs } = await import("../orama-cloud-legacy-BD43H--x.js");
70
70
  return searchDocs(debouncedValue, client);
71
71
  }
72
72
  case "mixedbread": {
73
- const { search } = await import("../mixedbread-TBJmV3co.js");
73
+ const { search } = await import("../mixedbread-BewwCSYr.js");
74
74
  return search(debouncedValue, client);
75
75
  }
76
76
  case "static": {
77
- const { search } = await import("../static-BUXJwBmr.js");
77
+ const { search } = await import("../static-dXiDJ_Bs.js");
78
78
  return search(debouncedValue, client);
79
79
  }
80
80
  default: throw new Error("unknown search client");
@@ -1,8 +1,4 @@
1
- import "../definitions-Cw2aM1Af.js";
2
- import "../utils-5HX-8dF3.js";
3
1
  import { SortedResult } from "./index.js";
4
- import "../create-i18n-DxSvCSv-.js";
5
- import "../path-CDjb5iUO.js";
6
2
  import { SearchAPI } from "./server.js";
7
3
  import Mixedbread from "@mixedbread/sdk";
8
4
  import { StoreSearchResponse } from "@mixedbread/sdk/resources/stores";
@@ -1,6 +1,6 @@
1
1
  import { r as __toESM } from "../chunk-CaR5F9JI.js";
2
- import { t as require_remove_markdown } from "../remove-markdown-CnXcUR-e.js";
3
- import { t as createEndpoint } from "../create-endpoint-9PZc4Cmz.js";
2
+ import { t as require_remove_markdown } from "../remove-markdown-CpjkP9z4.js";
3
+ import { t as createEndpoint } from "../create-endpoint-ErPy6bli.js";
4
4
  import Slugger from "github-slugger";
5
5
 
6
6
  //#region src/search/mixedbread.ts
@@ -1,6 +1,4 @@
1
- import "../transformer-icon-C8MUuI2T.js";
2
1
  import { StructuredData } from "../mdx-plugins/remark-structure.js";
3
- import "../mdx-plugins/index.js";
4
2
  import { CloudManager } from "@oramacloud/client";
5
3
 
6
4
  //#region src/search/orama-cloud-legacy.d.ts
@@ -1,6 +1,4 @@
1
- import "../transformer-icon-C8MUuI2T.js";
2
1
  import { StructuredData } from "../mdx-plugins/remark-structure.js";
3
- import "../mdx-plugins/index.js";
4
2
  import { OramaCloud } from "@orama/core";
5
3
 
6
4
  //#region src/search/orama-cloud.d.ts
@@ -1,9 +1,6 @@
1
- import "../definitions-Cw2aM1Af.js";
2
1
  import { StructuredData } from "../mdx-plugins/remark-structure.js";
3
- import "../utils-5HX-8dF3.js";
4
2
  import { HighlightedText, ReactSortedResult, SortedResult, createContentHighlighter } from "./index.js";
5
- import { a as advancedSchema, i as SimpleDocument, n as createFromSource, o as simpleSchema, r as AdvancedDocument, t as createI18nSearchAPI } from "../create-i18n-DxSvCSv-.js";
6
- import "../path-CDjb5iUO.js";
3
+ import { a as advancedSchema, i as SimpleDocument, n as createFromSource, o as simpleSchema, r as AdvancedDocument, t as createI18nSearchAPI } from "../create-i18n-BakPYec9.js";
7
4
  import { Orama, RawData, SearchParams, create } from "@orama/orama";
8
5
 
9
6
  //#region src/search/server.d.ts
@@ -1,8 +1,8 @@
1
1
  import { r as findPath } from "../utils-Bc53B3CJ.js";
2
2
  import { createContentHighlighter } from "./index.js";
3
- import { t as createEndpoint } from "../create-endpoint-9PZc4Cmz.js";
4
- import { n as searchSimple, t as searchAdvanced } from "../advanced-ZOIuXvBJ.js";
5
- import { r as extname, t as basename } from "../path-CfJghBXy.js";
3
+ import { t as createEndpoint } from "../create-endpoint-ErPy6bli.js";
4
+ import { n as searchSimple, t as searchAdvanced } from "../advanced-D8-Cn2tE.js";
5
+ import { r as extname, t as basename } from "../path-CX1URXrl.js";
6
6
  import { create, insertMultiple, save } from "@orama/orama";
7
7
 
8
8
  //#region src/search/orama/create-db.ts
@@ -100,56 +100,63 @@ async function createDBSimple({ indexes, tokenizer, ...rest }) {
100
100
 
101
101
  //#endregion
102
102
  //#region src/search/orama/create-from-source.ts
103
- function defaultBuildIndex(source) {
104
- function isBreadcrumbItem(item) {
105
- return typeof item === "string" && item.length > 0;
106
- }
107
- return async (page) => {
108
- let breadcrumbs;
109
- let structuredData;
110
- if ("structuredData" in page.data) structuredData = page.data.structuredData;
111
- else if ("load" in page.data && typeof page.data.load === "function") structuredData = (await page.data.load()).structuredData;
112
- if (!structuredData) throw new Error("Cannot find structured data from page, please define the page to index function.");
113
- const pageTree = source.getPageTree(page.locale);
114
- const path = findPath(pageTree.children, (node) => node.type === "page" && node.url === page.url);
115
- if (path) {
116
- breadcrumbs = [];
117
- path.pop();
118
- if (isBreadcrumbItem(pageTree.name)) breadcrumbs.push(pageTree.name);
119
- for (const segment of path) {
120
- if (!isBreadcrumbItem(segment.name)) continue;
121
- breadcrumbs.push(segment.name);
122
- }
123
- }
124
- return {
125
- title: page.data.title ?? basename(page.path, extname(page.path)),
126
- breadcrumbs,
127
- description: page.data.description,
128
- url: page.url,
129
- id: page.url,
130
- structuredData
131
- };
103
+ async function buildIndexDefault(page) {
104
+ let structuredData;
105
+ if ("structuredData" in page.data) structuredData = typeof page.data.structuredData === "function" ? await page.data.structuredData() : page.data.structuredData;
106
+ else if ("load" in page.data && typeof page.data.load === "function") structuredData = (await page.data.load()).structuredData;
107
+ if (!structuredData) throw new Error("Cannot find structured data from page, please define the page to index function.");
108
+ return {
109
+ title: page.data.title ?? basename(page.path, extname(page.path)),
110
+ description: page.data.description,
111
+ url: page.url,
112
+ id: page.url,
113
+ structuredData
132
114
  };
133
115
  }
116
+ function isBreadcrumbItem(item) {
117
+ return typeof item === "string" && item.length > 0;
118
+ }
119
+ function buildBreadcrumbsDefault(source, page) {
120
+ const pageTree = source.getPageTree(page.locale);
121
+ const path = findPath(pageTree.children, (node) => node.type === "page" && node.url === page.url);
122
+ if (path) {
123
+ const breadcrumbs = [];
124
+ path.pop();
125
+ if (isBreadcrumbItem(pageTree.name)) breadcrumbs.push(pageTree.name);
126
+ for (const segment of path) {
127
+ if (!isBreadcrumbItem(segment.name)) continue;
128
+ breadcrumbs.push(segment.name);
129
+ }
130
+ return breadcrumbs;
131
+ }
132
+ }
134
133
  function createFromSource(source, options = {}) {
135
- const { buildIndex = defaultBuildIndex(source) } = options;
134
+ const { buildIndex = buildIndexDefault } = options;
136
135
  if (source._i18n) return createI18nSearchAPI("advanced", {
137
136
  ...options,
138
137
  i18n: source._i18n,
139
- indexes: async () => {
138
+ async indexes() {
140
139
  const indexes = source.getLanguages().flatMap((entry) => {
141
- return entry.pages.map(async (page) => ({
142
- ...await buildIndex(page),
143
- locale: entry.language
144
- }));
140
+ return entry.pages.map(async (page) => {
141
+ const index = await buildIndex(page);
142
+ index.breadcrumbs ??= buildBreadcrumbsDefault(source, page);
143
+ return {
144
+ ...index,
145
+ locale: entry.language
146
+ };
147
+ });
145
148
  });
146
149
  return Promise.all(indexes);
147
150
  }
148
151
  });
149
152
  return createSearchAPI("advanced", {
150
153
  ...options,
151
- indexes: async () => {
152
- const indexes = source.getPages().map((page) => buildIndex(page));
154
+ async indexes() {
155
+ const indexes = source.getPages().map(async (page) => {
156
+ const index = await buildIndex(page);
157
+ index.breadcrumbs ??= buildBreadcrumbsDefault(source, page);
158
+ return index;
159
+ });
153
160
  return Promise.all(indexes);
154
161
  }
155
162
  });
@@ -1,7 +1,4 @@
1
- import { i as Root } from "../../definitions-Cw2aM1Af.js";
2
- import "../../utils-5HX-8dF3.js";
3
- import "../../page-tree/index.js";
4
-
1
+ import { i as Root } from "../../definitions-VpSOvVeD.js";
5
2
  //#region src/source/client/index.d.ts
6
3
  interface SerializedPageTree {
7
4
  $fumadocs_loader: 'page-tree';
@@ -1,5 +1,3 @@
1
- import "../definitions-Cw2aM1Af.js";
2
- import "../utils-5HX-8dF3.js";
3
- import { A as _SourceUpdate_, C as FileSystem, D as SourceConfig, E as Source, M as source, N as update, O as VirtualFile, S as createContentStorageBuilder, T as PageData, _ as PageTreeTransformer, a as LoaderOptions, b as ContentStorageMetaFile, c as LoaderPluginOption, d as ResolvedLoaderConfig, f as createGetUrl, g as PageTreeOptions, h as PageTreeBuilderContext, i as LoaderConfig, j as multiple, k as _ConfigUnion_, l as Meta, m as PageTreeBuilder, n as InferMetaType, o as LoaderOutput, p as loader, r as InferPageType, s as LoaderPlugin, t as path_d_exports, u as Page, v as ContentStorage, w as MetaData, x as ContentStoragePageFile, y as ContentStorageFile } from "../path-CDjb5iUO.js";
1
+ import { A as _ConfigUnion_, C as ContentStoragePageFile, D as Source, E as PageData, M as multiple, N as source, O as SourceConfig, P as update, S as ContentStorageMetaFile, T as MetaData, _ as PageTreeBuilderContext, a as LoaderOptions, b as ContentStorage, c as LoaderPluginOption, d as ResolvedLoaderConfig, f as createGetUrl, g as PageTreeBuilder, h as llms, i as LoaderConfig, j as _SourceUpdate_, k as VirtualFile, l as Meta, m as LLMsConfig, n as InferMetaType, o as LoaderOutput, p as loader, r as InferPageType, s as LoaderPlugin, t as path_d_exports, u as Page, v as PageTreeOptions, w as FileSystem, x as ContentStorageFile, y as PageTreeTransformer } from "../path-oEC3g6wP.js";
4
2
  import { getSlugs } from "./plugins/slugs.js";
5
- export { ContentStorage, ContentStorageFile, ContentStorageMetaFile, ContentStoragePageFile, FileSystem, InferMetaType, InferPageType, LoaderConfig, LoaderOptions, LoaderOutput, LoaderPlugin, LoaderPluginOption, Meta, MetaData, Page, PageData, type PageTreeBuilder, type PageTreeBuilderContext, type PageTreeOptions, type PageTreeTransformer, path_d_exports as PathUtils, ResolvedLoaderConfig, Source, SourceConfig, VirtualFile, _ConfigUnion_, _SourceUpdate_, createContentStorageBuilder, createGetUrl, getSlugs, loader, multiple, source, update };
3
+ export { type ContentStorage, type ContentStorageFile, type ContentStorageMetaFile, type ContentStoragePageFile, FileSystem, InferMetaType, InferPageType, LLMsConfig, LoaderConfig, LoaderOptions, LoaderOutput, LoaderPlugin, LoaderPluginOption, Meta, MetaData, Page, PageData, type PageTreeBuilder, type PageTreeBuilderContext, type PageTreeOptions, type PageTreeTransformer, path_d_exports as PathUtils, ResolvedLoaderConfig, Source, SourceConfig, VirtualFile, _ConfigUnion_, _SourceUpdate_, createGetUrl, getSlugs, llms, loader, multiple, source, update };
@@ -1,8 +1,8 @@
1
1
  import { t as normalizeUrl } from "../normalize-url-DKBxIxO0.js";
2
2
  import { c as visit } from "../utils-Bc53B3CJ.js";
3
- import { a as path_exports, i as joinPath, n as dirname, o as slash, r as extname, s as splitPath, t as basename } from "../path-CfJghBXy.js";
3
+ import { a as path_exports, i as joinPath, n as dirname, o as slash, r as extname, s as splitPath, t as basename } from "../path-CX1URXrl.js";
4
4
  import { getSlugs, slugsPlugin } from "./plugins/slugs.js";
5
- import { t as iconPlugin } from "../icon-CGDZIqYj.js";
5
+ import { t as iconPlugin } from "../icon-DzOeXioY.js";
6
6
  import path from "node:path";
7
7
 
8
8
  //#region src/source/source.ts
@@ -101,12 +101,13 @@ var FileSystem = class {
101
101
  return Array.from(this.files.keys());
102
102
  }
103
103
  makeDir(path) {
104
- const segments = splitPath(path);
105
- for (let i = 0; i < segments.length; i++) {
106
- const segment = segments.slice(0, i + 1).join("/");
107
- if (this.folders.has(segment)) continue;
108
- this.folders.set(segment, []);
109
- this.folders.get(dirname(segment)).push(segment);
104
+ const cur = [];
105
+ for (const seg of splitPath(path)) {
106
+ cur.push(seg);
107
+ const curPath = cur.join("/");
108
+ if (this.folders.has(curPath)) continue;
109
+ this.folders.set(curPath, []);
110
+ this.folders.get(dirname(curPath)).push(curPath);
110
111
  }
111
112
  }
112
113
  };
@@ -141,7 +142,7 @@ const EmptyLang = Symbol();
141
142
  * in the storage, locale codes are removed from file paths, hence the same file will have same file paths in every storage.
142
143
  */
143
144
  function createContentStorageBuilder(loaderConfig) {
144
- const { source, plugins = [], i18n } = loaderConfig;
145
+ const { source, plugins, i18n } = loaderConfig;
145
146
  const parser = i18n ? parsers[i18n.parser ?? "dot"] : parsers.none;
146
147
  const normalized = /* @__PURE__ */ new Map();
147
148
  for (const inputFile of source.files) {
@@ -160,12 +161,15 @@ function createContentStorageBuilder(loaderConfig) {
160
161
  data: inputFile.data
161
162
  };
162
163
  const [pathWithoutLocale, locale = i18n ? i18n.defaultLanguage : EmptyLang] = parser(file.path);
163
- const list = normalized.get(locale) ?? [];
164
+ let list = normalized.get(locale);
165
+ if (!list) {
166
+ list = [];
167
+ normalized.set(locale, list);
168
+ }
164
169
  list.push({
165
170
  pathWithoutLocale,
166
171
  file
167
172
  });
168
- normalized.set(locale, list);
169
173
  }
170
174
  function makeStorage(locale, inherit) {
171
175
  const storage = new FileSystem(inherit);
@@ -523,6 +527,65 @@ function pathToName(name) {
523
527
  return result.join("");
524
528
  }
525
529
 
530
+ //#endregion
531
+ //#region src/source/loader/llms.ts
532
+ function llms(loader, config = {}) {
533
+ const { TAB = " ", renderName = (node, ctx) => {
534
+ if (typeof node.name === "string") return node.name;
535
+ if ("type" in node && node.type === "page") {
536
+ const page = loader.getNodePage(node, ctx.lang);
537
+ if (page) return page.data.title ?? "";
538
+ }
539
+ return String(node.name);
540
+ }, renderDescription = (node, ctx) => {
541
+ if (typeof node.description === "string") return node.description;
542
+ if ("type" in node && node.type === "page") {
543
+ const page = loader.getNodePage(node, ctx.lang);
544
+ if (page) return page.data.description ?? "";
545
+ }
546
+ return String(node.description);
547
+ } } = config;
548
+ function index(lang) {
549
+ if (loader._i18n && lang === void 0) {
550
+ const { languages } = loader._i18n;
551
+ return languages.map(index).join("\n\n");
552
+ }
553
+ const pageTree = loader.getPageTree(lang);
554
+ const out = [];
555
+ const ctx = { lang };
556
+ out.push(`# ${renderName(pageTree, ctx)}`);
557
+ out.push("");
558
+ function item(name, description, indent) {
559
+ const prefix = TAB.repeat(indent);
560
+ description = description.trim();
561
+ if (description.length > 0) return `${prefix}- ${name}: ${description}`;
562
+ return `${prefix}- ${name}`;
563
+ }
564
+ function onNode(node, indent) {
565
+ switch (node.type) {
566
+ case "page":
567
+ out.push(item(formatMarkdownLink(renderName(node, ctx), node.url), renderDescription(node, ctx), indent));
568
+ break;
569
+ case "folder":
570
+ out.push(item(renderName(node, ctx), renderDescription(node, ctx), indent));
571
+ if (node.index) onNode(node.index, indent + 1);
572
+ for (const child of node.children) onNode(child, indent + 1);
573
+ break;
574
+ case "separator":
575
+ if (node.name) out.push(item(`**${renderName(node, ctx)}**`, "", indent));
576
+ out.push("");
577
+ break;
578
+ }
579
+ }
580
+ for (const child of pageTree.children) onNode(child, 0);
581
+ return out.join("\n");
582
+ }
583
+ return { index };
584
+ }
585
+ function formatMarkdownLink(title, url) {
586
+ return `[${title.replace(/([[\]])/g, "\\$1")}](${url.replace(/([()])/g, "\\$1")})`;
587
+ }
588
+
526
589
  //#endregion
527
590
  //#region src/source/loader.ts
528
591
  function createPageIndexer({ url }) {
@@ -596,7 +659,7 @@ function loader(...args) {
596
659
  let pageTrees;
597
660
  function getPageTrees() {
598
661
  if (pageTrees) return pageTrees;
599
- const { plugins = [], url, pageTree: pageTreeConfig } = loaderConfig;
662
+ const { plugins, url, pageTree: pageTreeConfig } = loaderConfig;
600
663
  const transformers = [];
601
664
  if (pageTreeConfig?.transformers) transformers.push(...pageTreeConfig.transformers);
602
665
  for (const plugin of plugins) if (plugin.transformPageTree) transformers.push(plugin.transformPageTree);
@@ -708,7 +771,7 @@ function resolveConfig(source, { slugs, icon, plugins = [], baseUrl, url, ...bas
708
771
  slugsPlugin(slugs)
709
772
  ])
710
773
  };
711
- for (const plugin of config.plugins ?? []) {
774
+ for (const plugin of config.plugins) {
712
775
  const result = plugin.config?.(config);
713
776
  if (result) config = result;
714
777
  }
@@ -728,4 +791,4 @@ function buildPlugins(plugins, sort = true) {
728
791
  }
729
792
 
730
793
  //#endregion
731
- export { FileSystem, path_exports as PathUtils, createGetUrl, getSlugs, loader, multiple, source, update };
794
+ export { FileSystem, path_exports as PathUtils, createGetUrl, getSlugs, llms, loader, multiple, source, update };
@@ -1,7 +1,4 @@
1
- import "../../definitions-Cw2aM1Af.js";
2
- import "../../utils-5HX-8dF3.js";
3
- import { s as LoaderPlugin } from "../../path-CDjb5iUO.js";
4
- import "../index.js";
1
+ import { s as LoaderPlugin } from "../../path-oEC3g6wP.js";
5
2
  import { icons } from "lucide-react";
6
3
 
7
4
  //#region src/source/plugins/lucide-icons.d.ts
@@ -1,4 +1,4 @@
1
- import { t as iconPlugin } from "../../icon-CGDZIqYj.js";
1
+ import { t as iconPlugin } from "../../icon-DzOeXioY.js";
2
2
  import { createElement } from "react";
3
3
  import { icons } from "lucide-react";
4
4
 
@@ -1,6 +1,4 @@
1
- import "../../definitions-Cw2aM1Af.js";
2
- import "../../utils-5HX-8dF3.js";
3
- import { i as LoaderConfig, s as LoaderPlugin, x as ContentStoragePageFile } from "../../path-CDjb5iUO.js";
1
+ import { C as ContentStoragePageFile, i as LoaderConfig, s as LoaderPlugin } from "../../path-oEC3g6wP.js";
4
2
 
5
3
  //#region src/source/plugins/slugs.d.ts
6
4
  /**
@@ -1,4 +1,4 @@
1
- import { n as dirname, r as extname, t as basename } from "../../path-CfJghBXy.js";
1
+ import { n as dirname, r as extname, t as basename } from "../../path-CX1URXrl.js";
2
2
 
3
3
  //#region src/source/plugins/slugs.ts
4
4
  /**
@@ -1,6 +1,5 @@
1
- import { a as Separator$1, n as Item$1, t as Folder$1 } from "../../definitions-Cw2aM1Af.js";
2
- import "../../utils-5HX-8dF3.js";
3
- import { s as LoaderPlugin } from "../../path-CDjb5iUO.js";
1
+ import { a as Separator$1, n as Item$1, t as Folder$1 } from "../../definitions-VpSOvVeD.js";
2
+ import { s as LoaderPlugin } from "../../path-oEC3g6wP.js";
4
3
  import { ReactNode } from "react";
5
4
 
6
5
  //#region src/source/plugins/status-badges.d.ts
@@ -1,4 +1,4 @@
1
- import { n as searchSimple, t as searchAdvanced } from "./advanced-ZOIuXvBJ.js";
1
+ import { n as searchSimple, t as searchAdvanced } from "./advanced-D8-Cn2tE.js";
2
2
  import { create, load } from "@orama/orama";
3
3
 
4
4
  //#region src/search/client/static.ts
@@ -1,4 +1,4 @@
1
- import { i as Root, n as Item, r as Node, t as Folder } from "./definitions-Cw2aM1Af.js";
1
+ import { i as Root, n as Item, r as Node, t as Folder } from "./definitions-VpSOvVeD.js";
2
2
 
3
3
  //#region src/page-tree/utils.d.ts
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-core",
3
- "version": "16.6.8",
3
+ "version": "16.6.10",
4
4
  "description": "The React.js library for building a documentation website",
5
5
  "keywords": [
6
6
  "Docs",
@@ -118,8 +118,8 @@
118
118
  "dependencies": {
119
119
  "@formatjs/intl-localematcher": "^0.8.1",
120
120
  "@orama/orama": "^3.1.18",
121
- "@shikijs/rehype": "^4.0.0",
122
- "@shikijs/transformers": "^4.0.0",
121
+ "@shikijs/rehype": "^4.0.1",
122
+ "@shikijs/transformers": "^4.0.1",
123
123
  "estree-util-value-to-estree": "^3.5.0",
124
124
  "github-slugger": "^2.0.0",
125
125
  "hast-util-to-estree": "^3.1.3",
@@ -134,7 +134,7 @@
134
134
  "remark-gfm": "^4.0.1",
135
135
  "remark-rehype": "^11.1.2",
136
136
  "scroll-into-view-if-needed": "^3.1.0",
137
- "shiki": "^4.0.0",
137
+ "shiki": "^4.0.1",
138
138
  "tinyglobby": "^0.2.15",
139
139
  "unified": "^11.0.5",
140
140
  "unist-util-visit": "^5.1.0",
@@ -145,7 +145,7 @@
145
145
  "@mixedbread/sdk": "^0.56.0",
146
146
  "@orama/core": "^1.2.19",
147
147
  "@oramacloud/client": "^2.1.4",
148
- "@tanstack/react-router": "1.163.3",
148
+ "@tanstack/react-router": "1.166.2",
149
149
  "@types/estree-jsx": "^1.0.5",
150
150
  "@types/hast": "^3.0.4",
151
151
  "@types/mdast": "^4.0.4",
@@ -154,7 +154,7 @@
154
154
  "@types/react": "^19.2.14",
155
155
  "@types/react-dom": "^19.2.3",
156
156
  "algoliasearch": "5.49.1",
157
- "lucide-react": "^0.575.0",
157
+ "lucide-react": "^0.577.0",
158
158
  "next": "16.1.6",
159
159
  "react-router": "^7.13.1",
160
160
  "remark-directive": "^4.0.0",
@@ -1,15 +0,0 @@
1
- //#region src/mdx-plugins/hast-utils.ts
2
- /**
3
- * Visit a node with filtered tag names
4
- */
5
- function visit(node, tagNames, handler) {
6
- if (node.type === "element" && tagNames.includes(node.tagName)) {
7
- if (handler(node) === "skip") return;
8
- }
9
- if ("children" in node) node.children.forEach((n) => {
10
- visit(n, tagNames, handler);
11
- });
12
- }
13
-
14
- //#endregion
15
- export { visit as t };
File without changes
File without changes
File without changes
File without changes
File without changes