fumadocs-core 16.5.3 → 16.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/{advanced-BH0syJ-M.js → advanced-3GdE_Q4d.js} +1 -1
  2. package/dist/breadcrumb.d.ts +1 -1
  3. package/dist/content/mdx/preset-bundler.d.ts +2 -2
  4. package/dist/content/mdx/preset-bundler.js +1 -1
  5. package/dist/content/mdx/preset-runtime.d.ts +2 -2
  6. package/dist/content/mdx/preset-runtime.js +1 -1
  7. package/dist/create-endpoint-9PZc4Cmz.js +23 -0
  8. package/dist/{create-i18n-Cv3Cocbs.d.ts → create-i18n-DxSvCSv-.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/mdx-plugins/index.d.ts +1 -1
  14. package/dist/mdx-plugins/rehype-code.core.d.ts +2 -2
  15. package/dist/mdx-plugins/rehype-code.d.ts +1 -1
  16. package/dist/mdx-plugins/remark-structure.d.ts +15 -8
  17. package/dist/mdx-plugins/remark-structure.js +28 -19
  18. package/dist/mixedbread-RiA_24CE.js +58 -0
  19. package/dist/{orama-cloud-ByznDyOk.js → orama-cloud-CmYuZkvC.js} +1 -1
  20. package/dist/{orama-cloud-legacy-BbgJnf5f.js → orama-cloud-legacy-D-cNaYCM.js} +1 -1
  21. package/dist/page-tree/index.d.ts +2 -2
  22. package/dist/{path-B77y3W0_.d.ts → path-CDjb5iUO.d.ts} +1 -1
  23. package/dist/{mixedbread-Bx9drx9S.js → remove-markdown-CnXcUR-e.js} +2 -51
  24. package/dist/search/client.d.ts +9 -4
  25. package/dist/search/client.js +6 -6
  26. package/dist/search/mixedbread.d.ts +56 -0
  27. package/dist/search/mixedbread.js +79 -0
  28. package/dist/search/orama-cloud-legacy.d.ts +1 -1
  29. package/dist/search/orama-cloud.d.ts +1 -1
  30. package/dist/search/server.d.ts +4 -4
  31. package/dist/search/server.js +3 -24
  32. package/dist/source/client/index.d.ts +2 -2
  33. package/dist/source/index.d.ts +3 -3
  34. package/dist/source/index.js +2 -2
  35. package/dist/source/plugins/lucide-icons.d.ts +3 -3
  36. package/dist/source/plugins/lucide-icons.js +1 -1
  37. package/dist/source/plugins/slugs.d.ts +3 -3
  38. package/dist/source/plugins/slugs.js +1 -1
  39. package/dist/source/plugins/status-badges.d.ts +3 -3
  40. package/dist/{static-DTxK4eHk.js → static-BQOJvapl.js} +1 -1
  41. package/dist/{utils-IgHyYnrz.d.ts → utils-5HX-8dF3.d.ts} +1 -1
  42. package/package.json +1 -1
  43. /package/dist/{algolia-C7Crg8-5.js → algolia-Cx9CqUgE.js} +0 -0
  44. /package/dist/{definitions-DSNTbAwC.d.ts → definitions-Cw2aM1Af.d.ts} +0 -0
  45. /package/dist/{fetch-HotVeLLF.js → fetch-D_OY-eAB.js} +0 -0
  46. /package/dist/{icon-BcFuYa-b.js → icon-CGDZIqYj.js} +0 -0
  47. /package/dist/{path-D0Bwm6Fs.js → path-CfJghBXy.js} +0 -0
  48. /package/dist/{remove-undefined-CJm9cyrC.js → remove-undefined-B_oBVupY.js} +0 -0
  49. /package/dist/{transformer-icon-D7-6aFzt.d.ts → transformer-icon-C8MUuI2T.d.ts} +0 -0
  50. /package/dist/{types-BSnJn7kF.d.ts → types-Bt4vrwsT.d.ts} +0 -0
  51. /package/dist/{util-C60LmklF.d.ts → util-C7X6g0ql.d.ts} +0 -0
  52. /package/dist/{util-De0ALHOx.js → util-bgCahl6-.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { createContentHighlighter } from "./search/index.js";
2
- import { t as removeUndefined } from "./remove-undefined-CJm9cyrC.js";
2
+ import { t as removeUndefined } from "./remove-undefined-B_oBVupY.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-DSNTbAwC.js";
1
+ import { i as Root, r as Node } from "./definitions-Cw2aM1Af.js";
2
2
  import { ReactNode } from "react";
3
3
 
4
4
  //#region src/breadcrumb.d.ts
@@ -1,4 +1,4 @@
1
- import "../../transformer-icon-D7-6aFzt.js";
1
+ import "../../transformer-icon-C8MUuI2T.js";
2
2
  import { RehypeCodeOptions } from "../../mdx-plugins/rehype-code.js";
3
3
  import { RemarkImageOptions } from "../../mdx-plugins/remark-image.js";
4
4
  import { StructureOptions } from "../../mdx-plugins/remark-structure.js";
@@ -6,7 +6,7 @@ import { RemarkHeadingOptions } from "../../mdx-plugins/remark-heading.js";
6
6
  import { RemarkCodeTabOptions } from "../../mdx-plugins/remark-code-tab.js";
7
7
  import { RemarkNpmOptions } from "../../mdx-plugins/remark-npm.js";
8
8
  import "../../mdx-plugins/index.js";
9
- import { t as ResolvePlugins } from "../../util-C60LmklF.js";
9
+ import { t as ResolvePlugins } from "../../util-C7X6g0ql.js";
10
10
  import { ProcessorOptions } from "@mdx-js/mdx";
11
11
 
12
12
  //#region src/content/mdx/preset-bundler.d.ts
@@ -1,4 +1,4 @@
1
- import { t as resolvePlugins } from "../../util-De0ALHOx.js";
1
+ import { t as resolvePlugins } from "../../util-bgCahl6-.js";
2
2
 
3
3
  //#region src/content/mdx/preset-bundler.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import "../../transformer-icon-D7-6aFzt.js";
1
+ import "../../transformer-icon-C8MUuI2T.js";
2
2
  import { RehypeCodeOptions } from "../../mdx-plugins/rehype-code.js";
3
3
  import { RemarkImageOptions } from "../../mdx-plugins/remark-image.js";
4
4
  import { StructureOptions } from "../../mdx-plugins/remark-structure.js";
@@ -6,7 +6,7 @@ import { RemarkHeadingOptions } from "../../mdx-plugins/remark-heading.js";
6
6
  import { RemarkCodeTabOptions } from "../../mdx-plugins/remark-code-tab.js";
7
7
  import { RemarkNpmOptions } from "../../mdx-plugins/remark-npm.js";
8
8
  import "../../mdx-plugins/index.js";
9
- import { t as ResolvePlugins } from "../../util-C60LmklF.js";
9
+ import { t as ResolvePlugins } from "../../util-C7X6g0ql.js";
10
10
  import { ProcessorOptions } from "@mdx-js/mdx";
11
11
 
12
12
  //#region src/content/mdx/preset-runtime.d.ts
@@ -1,4 +1,4 @@
1
- import { t as resolvePlugins } from "../../util-De0ALHOx.js";
1
+ import { t as resolvePlugins } from "../../util-bgCahl6-.js";
2
2
 
3
3
  //#region src/content/mdx/preset-runtime.ts
4
4
  /**
@@ -0,0 +1,23 @@
1
+ //#region src/search/orama/create-endpoint.ts
2
+ function createEndpoint(server) {
3
+ const { search } = server;
4
+ return {
5
+ ...server,
6
+ async staticGET() {
7
+ return Response.json(await server.export());
8
+ },
9
+ async GET(request) {
10
+ const url = new URL(request.url);
11
+ const query = url.searchParams.get("query");
12
+ if (!query) return Response.json([]);
13
+ return Response.json(await search(query, {
14
+ tag: url.searchParams.get("tag")?.split(",") ?? void 0,
15
+ locale: url.searchParams.get("locale") ?? void 0,
16
+ mode: url.searchParams.get("mode") === "vector" ? "vector" : "full"
17
+ }));
18
+ }
19
+ };
20
+ }
21
+
22
+ //#endregion
23
+ export { createEndpoint as t };
@@ -1,6 +1,6 @@
1
- import { t as Awaitable } from "./types-BSnJn7kF.js";
1
+ import { t as Awaitable } from "./types-Bt4vrwsT.js";
2
2
  import { I18nConfig } from "./i18n/index.js";
3
- import { i as LoaderConfig, o as LoaderOutput, u as Page } from "./path-B77y3W0_.js";
3
+ import { i as LoaderConfig, o as LoaderOutput, u as Page } from "./path-CDjb5iUO.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-BSnJn7kF.js";
1
+ import { t as Awaitable } from "../types-Bt4vrwsT.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-BSnJn7kF.js";
1
+ import { r as MakeOptional } from "../../types-Bt4vrwsT.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-BSnJn7kF.js";
1
+ import { n as DistributiveOmit } from "../../types-Bt4vrwsT.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-BSnJn7kF.js";
1
+ import { n as DistributiveOmit } from "../types-Bt4vrwsT.js";
2
2
  import { ResolvedShikiConfig } from "./config.js";
3
3
  import { CoreHighlightOptions } from "./core/index.js";
4
4
  import { ReactNode } from "react";
@@ -1,5 +1,5 @@
1
1
  import { RemarkGfmOptions, remarkGfm } from "./remark-gfm.js";
2
- import { r as transformerIcon, t as CodeBlockIcon } from "../transformer-icon-D7-6aFzt.js";
2
+ import { r as transformerIcon, t as CodeBlockIcon } from "../transformer-icon-C8MUuI2T.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";
@@ -1,5 +1,5 @@
1
- import { n as IconOptions, r as transformerIcon, t as CodeBlockIcon } from "../transformer-icon-D7-6aFzt.js";
2
- import { n as DistributiveOmit } from "../types-BSnJn7kF.js";
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";
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-D7-6aFzt.js";
1
+ import { r as transformerIcon, t as CodeBlockIcon } from "../transformer-icon-C8MUuI2T.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";
@@ -19,11 +19,20 @@ interface StructuredData {
19
19
  */
20
20
  contents: Content[];
21
21
  }
22
- interface StructureOptions {
22
+ interface StringifyOptions {
23
23
  /**
24
- * MDAST **block** types to be scanned as content.
24
+ * Determine whether the element itself should be stringified in content block, only stringify its attributes & children if `false`.
25
25
  *
26
- * If a node's type is represented in this array, it will be stringified and its children will not be scanned separatedly.
26
+ * Always return `false` by default.
27
+ */
28
+ filterMdxElements?: (node: MdxJsxFlowElement | MdxJsxTextElement) => boolean;
29
+ filterMdxAttributes?: (node: MdxJsxFlowElement | MdxJsxTextElement, attribute: MdxJsxAttribute | MdxJsxExpressionAttribute) => boolean;
30
+ }
31
+ interface StructureOptions extends Omit<StringifyOptions, 'filterMdxAttributes'> {
32
+ /**
33
+ * MDAST node types to be scanned as a content block.
34
+ *
35
+ * If a node's type represents in this array, it will be converted into a single content block.
27
36
  *
28
37
  * @defaultValue ['heading', 'paragraph', 'blockquote', 'tableCell', 'mdxJsxFlowElement']
29
38
  */
@@ -62,7 +71,6 @@ declare module 'vfile' {
62
71
  }
63
72
  declare const remarkStructureDefaultOptions: {
64
73
  types: string[];
65
- allowedMdxAttributes(node: MdxJsxFlowElement | MdxJsxTextElement): boolean;
66
74
  exportAs: false;
67
75
  };
68
76
  /**
@@ -74,14 +82,13 @@ declare function remarkStructure(this: Processor, {
74
82
  types,
75
83
  stringify,
76
84
  allowedMdxAttributes,
77
- exportAs
85
+ exportAs,
86
+ ...stringifyOptions
78
87
  }?: StructureOptions): Transformer<Root, Root>;
79
88
  /**
80
89
  * Extract data from markdown/mdx content
81
90
  */
82
91
  declare function structure(content: string, remarkPlugins?: PluggableList, options?: StructureOptions): StructuredData;
83
- declare function defaultStringify(config?: Options & {
84
- filterMdxAttributes?: (node: MdxJsxFlowElement | MdxJsxTextElement, attribute: MdxJsxAttribute | MdxJsxExpressionAttribute) => boolean;
85
- }): (this: Processor, node: Nodes) => string;
92
+ declare function defaultStringify(config?: Options & StringifyOptions): (this: Processor, node: Nodes) => string;
86
93
  //#endregion
87
94
  export { StructureOptions, StructuredData, defaultStringify, remarkStructure, remarkStructureDefaultOptions, structure };
@@ -14,13 +14,6 @@ const remarkStructureDefaultOptions = {
14
14
  "tableCell",
15
15
  "mdxJsxFlowElement"
16
16
  ],
17
- allowedMdxAttributes(node) {
18
- switch (node.name) {
19
- case "TypeTable":
20
- case "Callout": return true;
21
- default: return false;
22
- }
23
- },
24
17
  exportAs: false
25
18
  };
26
19
  /**
@@ -28,7 +21,7 @@ const remarkStructureDefaultOptions = {
28
21
  *
29
22
  * By default, the output is stored into VFile (`vfile.data.structuredData`), you can specify `exportAs` to export it.
30
23
  */
31
- function remarkStructure({ types = remarkStructureDefaultOptions.types, stringify, allowedMdxAttributes = remarkStructureDefaultOptions.allowedMdxAttributes, exportAs = remarkStructureDefaultOptions.exportAs } = {}) {
24
+ function remarkStructure({ types = remarkStructureDefaultOptions.types, stringify, allowedMdxAttributes, exportAs = remarkStructureDefaultOptions.exportAs, ...stringifyOptions } = {}) {
32
25
  if (Array.isArray(allowedMdxAttributes)) {
33
26
  const arr = allowedMdxAttributes;
34
27
  allowedMdxAttributes = (_node, attribute) => attribute.type === "mdxJsxAttribute" && arr.includes(attribute.name);
@@ -37,7 +30,10 @@ function remarkStructure({ types = remarkStructureDefaultOptions.types, stringif
37
30
  const arr = types;
38
31
  types = (node) => arr.includes(node.type);
39
32
  }
40
- stringify ??= defaultStringify({ filterMdxAttributes: allowedMdxAttributes });
33
+ stringify ??= defaultStringify({
34
+ filterMdxAttributes: allowedMdxAttributes,
35
+ ...stringifyOptions
36
+ });
41
37
  return (tree, file) => {
42
38
  const data = {
43
39
  contents: [],
@@ -68,13 +64,6 @@ function remarkStructure({ types = remarkStructureDefaultOptions.types, stringif
68
64
  lastHeading = id;
69
65
  return "skip";
70
66
  }
71
- if (element.data?._string) {
72
- for (const content of element.data._string) data.contents.push({
73
- heading: lastHeading,
74
- content
75
- });
76
- return "skip";
77
- }
78
67
  const content = stringify.call(this, element).trim();
79
68
  if (content.length > 0) data.contents.push({
80
69
  heading: lastHeading,
@@ -93,15 +82,35 @@ function structure(content, remarkPlugins = [], options = {}) {
93
82
  return remark().use(remarkGfm).use(remarkPlugins).use(remarkHeading).use(remarkStructure, options).processSync(content).data.structuredData;
94
83
  }
95
84
  function defaultStringify(config = {}) {
96
- const { filterMdxAttributes } = config;
85
+ const { filterMdxAttributes = (node) => {
86
+ switch (node.name) {
87
+ case "TypeTable":
88
+ case "Callout": return true;
89
+ default: return false;
90
+ }
91
+ }, filterMdxElements = () => false } = config;
97
92
  function modHandler(handler) {
98
93
  return function(node, ...rest) {
99
94
  if (node.data?._string) return node.data._string.join("\n");
100
95
  switch (node.type) {
101
96
  case "mdxJsxFlowElement":
102
- case "mdxJsxTextElement": if (filterMdxAttributes) {
97
+ case "mdxJsxTextElement": {
98
+ const filteredAttributes = node.attributes.filter((attr) => filterMdxAttributes(node, attr));
99
+ if (!filterMdxElements(node)) {
100
+ let attrStr = "";
101
+ for (const attr of filteredAttributes) {
102
+ const str = typeof attr.value === "string" ? attr.value : attr.value?.value;
103
+ if (!str) continue;
104
+ attrStr += attr.type === "mdxJsxAttribute" ? `(${attr.name}=${str}) ` : `(${str}) `;
105
+ }
106
+ if (node.children.length === 0) return attrStr.trimEnd();
107
+ return attrStr + rest[1].handle({
108
+ type: "root",
109
+ children: node.children
110
+ }, ...rest);
111
+ }
103
112
  const temp = node.attributes;
104
- node.attributes = node.attributes.filter((attr) => filterMdxAttributes(node, attr));
113
+ node.attributes = filteredAttributes;
105
114
  const s = handler(node, ...rest);
106
115
  node.attributes = temp;
107
116
  return s;
@@ -0,0 +1,58 @@
1
+ import { r as __toESM } from "./chunk-CaR5F9JI.js";
2
+ import { t as require_remove_markdown } from "./remove-markdown-CnXcUR-e.js";
3
+ import Slugger from "github-slugger";
4
+
5
+ //#region src/search/client/mixedbread.ts
6
+ var import_remove_markdown = /* @__PURE__ */ __toESM(require_remove_markdown(), 1);
7
+ const slugger = new Slugger();
8
+ function extractHeadingTitle(text) {
9
+ const trimmedText = text.trim();
10
+ if (!trimmedText.startsWith("#")) return "";
11
+ const firstLine = trimmedText.split("\n")[0]?.trim();
12
+ if (firstLine) return (0, import_remove_markdown.default)(firstLine, { useImgAltText: false });
13
+ return "";
14
+ }
15
+ /**
16
+ * @deprecated Use `createMixedbreadSearchAPI` from `fumadocs-core/search/mixedbread` instead.
17
+ * This client-side approach exposes your API key in the browser.
18
+ * The server-side approach keeps the key secure and uses `type: 'fetch'` on the client.
19
+ */
20
+ async function search(query, options) {
21
+ const { client, storeIdentifier, tag } = options;
22
+ if (!query.trim()) return [];
23
+ return (await client.stores.search({
24
+ query,
25
+ store_identifiers: [storeIdentifier],
26
+ top_k: 10,
27
+ filters: {
28
+ key: "generated_metadata.tag",
29
+ operator: "eq",
30
+ value: tag
31
+ },
32
+ search_options: { return_metadata: true }
33
+ })).data.flatMap((item) => {
34
+ const metadata = item.generated_metadata;
35
+ const url = metadata.url || "#";
36
+ const title = metadata.title || "Untitled";
37
+ const chunkResults = [{
38
+ id: `${item.file_id}-${item.chunk_index}-page`,
39
+ type: "page",
40
+ content: title,
41
+ url
42
+ }];
43
+ const headingTitle = item.type === "text" ? extractHeadingTitle(item.text) : "";
44
+ if (headingTitle) {
45
+ slugger.reset();
46
+ chunkResults.push({
47
+ id: `${item.file_id}-${item.chunk_index}-heading`,
48
+ type: "heading",
49
+ content: headingTitle,
50
+ url: `${url}#${slugger.slug(headingTitle)}`
51
+ });
52
+ }
53
+ return chunkResults;
54
+ });
55
+ }
56
+
57
+ //#endregion
58
+ export { search };
@@ -1,5 +1,5 @@
1
1
  import { createContentHighlighter } from "./search/index.js";
2
- import { t as removeUndefined } from "./remove-undefined-CJm9cyrC.js";
2
+ import { t as removeUndefined } from "./remove-undefined-B_oBVupY.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-CJm9cyrC.js";
2
+ import { t as removeUndefined } from "./remove-undefined-B_oBVupY.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-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";
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";
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-DSNTbAwC.js";
1
+ import { a as Separator, i as Root, n as Item, r as Node, t as Folder } from "./definitions-Cw2aM1Af.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";
@@ -1,5 +1,4 @@
1
- import { r as __toESM, t as __commonJSMin } from "./chunk-CaR5F9JI.js";
2
- import Slugger from "github-slugger";
1
+ import { t as __commonJSMin } from "./chunk-CaR5F9JI.js";
3
2
 
4
3
  //#region ../../node_modules/.pnpm/remove-markdown@0.6.3/node_modules/remove-markdown/index.js
5
4
  var require_remove_markdown = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -38,52 +37,4 @@ var require_remove_markdown = /* @__PURE__ */ __commonJSMin(((exports, module) =
38
37
  }));
39
38
 
40
39
  //#endregion
41
- //#region src/search/client/mixedbread.ts
42
- var import_remove_markdown = /* @__PURE__ */ __toESM(require_remove_markdown(), 1);
43
- const slugger = new Slugger();
44
- function extractHeadingTitle(text) {
45
- const trimmedText = text.trim();
46
- if (!trimmedText.startsWith("#")) return "";
47
- const firstLine = trimmedText.split("\n")[0]?.trim();
48
- if (firstLine) return (0, import_remove_markdown.default)(firstLine, { useImgAltText: false });
49
- return "";
50
- }
51
- async function search(query, options) {
52
- const { client, storeIdentifier, tag } = options;
53
- if (!query.trim()) return [];
54
- return (await client.stores.search({
55
- query,
56
- store_identifiers: [storeIdentifier],
57
- top_k: 10,
58
- filters: {
59
- key: "generated_metadata.tag",
60
- operator: "eq",
61
- value: tag
62
- },
63
- search_options: { return_metadata: true }
64
- })).data.flatMap((item) => {
65
- const metadata = item.generated_metadata;
66
- const url = metadata.url || "#";
67
- const title = metadata.title || "Untitled";
68
- const chunkResults = [{
69
- id: `${item.file_id}-${item.chunk_index}-page`,
70
- type: "page",
71
- content: title,
72
- url
73
- }];
74
- const headingTitle = item.type === "text" ? extractHeadingTitle(item.text) : "";
75
- if (headingTitle) {
76
- slugger.reset();
77
- chunkResults.push({
78
- id: `${item.file_id}-${item.chunk_index}-heading`,
79
- type: "heading",
80
- content: headingTitle,
81
- url: `${url}#${slugger.slug(headingTitle)}`
82
- });
83
- }
84
- return chunkResults;
85
- });
86
- }
87
-
88
- //#endregion
89
- export { search };
40
+ export { require_remove_markdown as t };
@@ -1,9 +1,9 @@
1
- import "../definitions-DSNTbAwC.js";
2
- import "../utils-IgHyYnrz.js";
1
+ import "../definitions-Cw2aM1Af.js";
2
+ import "../utils-5HX-8dF3.js";
3
3
  import { BaseIndex } from "./algolia.js";
4
4
  import { SortedResult } from "./index.js";
5
- import "../create-i18n-Cv3Cocbs.js";
6
- import "../path-B77y3W0_.js";
5
+ import "../create-i18n-DxSvCSv-.js";
6
+ import "../path-CDjb5iUO.js";
7
7
  import "./server.js";
8
8
  import { DependencyList } from "react";
9
9
  import { AnyOrama } from "@orama/orama";
@@ -104,6 +104,11 @@ interface OramaCloudLegacyOptions {
104
104
  }
105
105
  //#endregion
106
106
  //#region src/search/client/mixedbread.d.ts
107
+ /**
108
+ * @deprecated Use `createMixedbreadSearchAPI` from `fumadocs-core/search/mixedbread` instead.
109
+ * This client-side approach exposes your API key in the browser.
110
+ * The server-side approach keeps the key secure and uses `type: 'fetch'` on the client.
111
+ */
107
112
  interface MixedbreadOptions {
108
113
  /**
109
114
  * The identifier of the store to search in
@@ -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-HotVeLLF.js");
57
+ const { fetchDocs } = await import("../fetch-D_OY-eAB.js");
58
58
  return fetchDocs(debouncedValue, client);
59
59
  }
60
60
  case "algolia": {
61
- const { searchDocs } = await import("../algolia-C7Crg8-5.js");
61
+ const { searchDocs } = await import("../algolia-Cx9CqUgE.js");
62
62
  return searchDocs(debouncedValue, client);
63
63
  }
64
64
  case "orama-cloud": {
65
- const { searchDocs } = await import("../orama-cloud-ByznDyOk.js");
65
+ const { searchDocs } = await import("../orama-cloud-CmYuZkvC.js");
66
66
  return searchDocs(debouncedValue, client);
67
67
  }
68
68
  case "orama-cloud-legacy": {
69
- const { searchDocs } = await import("../orama-cloud-legacy-BbgJnf5f.js");
69
+ const { searchDocs } = await import("../orama-cloud-legacy-D-cNaYCM.js");
70
70
  return searchDocs(debouncedValue, client);
71
71
  }
72
72
  case "mixedbread": {
73
- const { search } = await import("../mixedbread-Bx9drx9S.js");
73
+ const { search } = await import("../mixedbread-RiA_24CE.js");
74
74
  return search(debouncedValue, client);
75
75
  }
76
76
  case "static": {
77
- const { search } = await import("../static-DTxK4eHk.js");
77
+ const { search } = await import("../static-BQOJvapl.js");
78
78
  return search(debouncedValue, client);
79
79
  }
80
80
  default: throw new Error("unknown search client");
@@ -0,0 +1,56 @@
1
+ import "../definitions-Cw2aM1Af.js";
2
+ import "../utils-5HX-8dF3.js";
3
+ import { SortedResult } from "./index.js";
4
+ import "../create-i18n-DxSvCSv-.js";
5
+ import "../path-CDjb5iUO.js";
6
+ import { SearchAPI } from "./server.js";
7
+ import Mixedbread from "@mixedbread/sdk";
8
+ import { StoreSearchResponse } from "@mixedbread/sdk/resources/stores";
9
+
10
+ //#region src/search/mixedbread.d.ts
11
+ interface SearchMetadata {
12
+ title?: string;
13
+ description?: string;
14
+ url?: string;
15
+ tag?: string;
16
+ }
17
+ type StoreSearchResult = StoreSearchResponse['data'][number] & {
18
+ generated_metadata: SearchMetadata;
19
+ };
20
+ interface MixedbreadSearchOptions {
21
+ /**
22
+ * The Mixedbread SDK client instance
23
+ */
24
+ client: Mixedbread;
25
+ /**
26
+ * The identifier of the store to search in
27
+ */
28
+ storeIdentifier: string;
29
+ /**
30
+ * Maximum number of results to return
31
+ *
32
+ * @defaultValue 10
33
+ */
34
+ topK?: number;
35
+ /**
36
+ * Re-rank search results for improved relevance
37
+ *
38
+ * @defaultValue true
39
+ */
40
+ rerank?: boolean;
41
+ /**
42
+ * Rewrite the query for better search results
43
+ */
44
+ rewriteQuery?: boolean;
45
+ /**
46
+ * Minimum score threshold for results
47
+ */
48
+ scoreThreshold?: number;
49
+ /**
50
+ * Custom transform function for search results
51
+ */
52
+ transform?: (results: StoreSearchResult[], query: string) => SortedResult[];
53
+ }
54
+ declare function createMixedbreadSearchAPI(options: MixedbreadSearchOptions): SearchAPI;
55
+ //#endregion
56
+ export { MixedbreadSearchOptions, SearchMetadata, createMixedbreadSearchAPI };
@@ -0,0 +1,79 @@
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";
4
+ import Slugger from "github-slugger";
5
+
6
+ //#region src/search/mixedbread.ts
7
+ var import_remove_markdown = /* @__PURE__ */ __toESM(require_remove_markdown(), 1);
8
+ const slugger = new Slugger();
9
+ function extractHeadingTitle(text) {
10
+ const trimmedText = text.trim();
11
+ if (!trimmedText.startsWith("#")) return "";
12
+ const firstLine = trimmedText.split("\n")[0]?.trim();
13
+ if (firstLine) return (0, import_remove_markdown.default)(firstLine, { useImgAltText: false });
14
+ return "";
15
+ }
16
+ function defaultTransform(results) {
17
+ return results.flatMap((item) => {
18
+ const metadata = item.generated_metadata;
19
+ const url = metadata.url || "#";
20
+ const title = metadata.title || "Untitled";
21
+ const chunkResults = [{
22
+ id: `${item.file_id}-${item.chunk_index}-page`,
23
+ type: "page",
24
+ content: title,
25
+ url
26
+ }];
27
+ const headingTitle = item.type === "text" ? extractHeadingTitle(item.text) : "";
28
+ if (headingTitle) {
29
+ slugger.reset();
30
+ chunkResults.push({
31
+ id: `${item.file_id}-${item.chunk_index}-heading`,
32
+ type: "heading",
33
+ content: headingTitle,
34
+ url: `${url}#${slugger.slug(headingTitle)}`
35
+ });
36
+ }
37
+ return chunkResults;
38
+ });
39
+ }
40
+ function createMixedbreadSearchAPI(options) {
41
+ const { client, storeIdentifier, topK = 10, rerank = true, rewriteQuery, scoreThreshold, transform } = options;
42
+ return createEndpoint({
43
+ async search(query, searchOptions) {
44
+ if (!query.trim()) return [];
45
+ const tag = searchOptions?.tag;
46
+ let filters;
47
+ if (Array.isArray(tag) && tag.length > 0) filters = {
48
+ key: "generated_metadata.tag",
49
+ operator: "in",
50
+ value: tag
51
+ };
52
+ else if (typeof tag === "string") filters = {
53
+ key: "generated_metadata.tag",
54
+ operator: "eq",
55
+ value: tag
56
+ };
57
+ const results = (await client.stores.search({
58
+ query,
59
+ store_identifiers: [storeIdentifier],
60
+ top_k: topK,
61
+ filters,
62
+ search_options: {
63
+ return_metadata: true,
64
+ rerank,
65
+ rewrite_query: rewriteQuery,
66
+ score_threshold: scoreThreshold
67
+ }
68
+ })).data;
69
+ if (transform) return transform(results, query);
70
+ return defaultTransform(results);
71
+ },
72
+ async export() {
73
+ throw new Error("Mixedbread search does not support exporting indexes. Use the Mixedbread dashboard to manage your store.");
74
+ }
75
+ });
76
+ }
77
+
78
+ //#endregion
79
+ export { createMixedbreadSearchAPI };
@@ -1,4 +1,4 @@
1
- import "../transformer-icon-D7-6aFzt.js";
1
+ import "../transformer-icon-C8MUuI2T.js";
2
2
  import { StructuredData } from "../mdx-plugins/remark-structure.js";
3
3
  import "../mdx-plugins/index.js";
4
4
  import { CloudManager } from "@oramacloud/client";
@@ -1,4 +1,4 @@
1
- import "../transformer-icon-D7-6aFzt.js";
1
+ import "../transformer-icon-C8MUuI2T.js";
2
2
  import { StructuredData } from "../mdx-plugins/remark-structure.js";
3
3
  import "../mdx-plugins/index.js";
4
4
  import { OramaCloud } from "@orama/core";
@@ -1,9 +1,9 @@
1
- import "../definitions-DSNTbAwC.js";
1
+ import "../definitions-Cw2aM1Af.js";
2
2
  import { StructuredData } from "../mdx-plugins/remark-structure.js";
3
- import "../utils-IgHyYnrz.js";
3
+ import "../utils-5HX-8dF3.js";
4
4
  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-Cv3Cocbs.js";
6
- import "../path-B77y3W0_.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";
7
7
  import { Orama, RawData, SearchParams, create } from "@orama/orama";
8
8
 
9
9
  //#region src/search/server.d.ts
@@ -1,31 +1,10 @@
1
1
  import { r as findPath } from "../utils-Bc53B3CJ.js";
2
2
  import { createContentHighlighter } from "./index.js";
3
- import { n as searchSimple, t as searchAdvanced } from "../advanced-BH0syJ-M.js";
4
- import { r as extname, t as basename } from "../path-D0Bwm6Fs.js";
3
+ import { t as createEndpoint } from "../create-endpoint-9PZc4Cmz.js";
4
+ import { n as searchSimple, t as searchAdvanced } from "../advanced-3GdE_Q4d.js";
5
+ import { r as extname, t as basename } from "../path-CfJghBXy.js";
5
6
  import { create, insertMultiple, save } from "@orama/orama";
6
7
 
7
- //#region src/search/orama/create-endpoint.ts
8
- function createEndpoint(server) {
9
- const { search } = server;
10
- return {
11
- ...server,
12
- async staticGET() {
13
- return Response.json(await server.export());
14
- },
15
- async GET(request) {
16
- const url = new URL(request.url);
17
- const query = url.searchParams.get("query");
18
- if (!query) return Response.json([]);
19
- return Response.json(await search(query, {
20
- tag: url.searchParams.get("tag")?.split(",") ?? void 0,
21
- locale: url.searchParams.get("locale") ?? void 0,
22
- mode: url.searchParams.get("mode") === "vector" ? "vector" : "full"
23
- }));
24
- }
25
- };
26
- }
27
-
28
- //#endregion
29
8
  //#region src/search/orama/create-db.ts
30
9
  const simpleSchema = {
31
10
  url: "string",
@@ -1,5 +1,5 @@
1
- import { i as Root } from "../../definitions-DSNTbAwC.js";
2
- import "../../utils-IgHyYnrz.js";
1
+ import { i as Root } from "../../definitions-Cw2aM1Af.js";
2
+ import "../../utils-5HX-8dF3.js";
3
3
  import "../../page-tree/index.js";
4
4
 
5
5
  //#region src/source/client/index.d.ts
@@ -1,5 +1,5 @@
1
- import "../definitions-DSNTbAwC.js";
2
- import "../utils-IgHyYnrz.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-B77y3W0_.js";
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";
4
4
  import { getSlugs } from "./plugins/slugs.js";
5
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 };
@@ -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-D0Bwm6Fs.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";
4
4
  import { getSlugs, slugsPlugin } from "./plugins/slugs.js";
5
- import { t as iconPlugin } from "../icon-BcFuYa-b.js";
5
+ import { t as iconPlugin } from "../icon-CGDZIqYj.js";
6
6
  import path from "node:path";
7
7
 
8
8
  //#region src/source/source.ts
@@ -1,6 +1,6 @@
1
- import "../../definitions-DSNTbAwC.js";
2
- import "../../utils-IgHyYnrz.js";
3
- import { s as LoaderPlugin } from "../../path-B77y3W0_.js";
1
+ import "../../definitions-Cw2aM1Af.js";
2
+ import "../../utils-5HX-8dF3.js";
3
+ import { s as LoaderPlugin } from "../../path-CDjb5iUO.js";
4
4
  import "../index.js";
5
5
  import { icons } from "lucide-react";
6
6
 
@@ -1,4 +1,4 @@
1
- import { t as iconPlugin } from "../../icon-BcFuYa-b.js";
1
+ import { t as iconPlugin } from "../../icon-CGDZIqYj.js";
2
2
  import { createElement } from "react";
3
3
  import { icons } from "lucide-react";
4
4
 
@@ -1,6 +1,6 @@
1
- import "../../definitions-DSNTbAwC.js";
2
- import "../../utils-IgHyYnrz.js";
3
- import { i as LoaderConfig, s as LoaderPlugin, x as ContentStoragePageFile } from "../../path-B77y3W0_.js";
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";
4
4
 
5
5
  //#region src/source/plugins/slugs.d.ts
6
6
  /**
@@ -1,4 +1,4 @@
1
- import { n as dirname, r as extname, t as basename } from "../../path-D0Bwm6Fs.js";
1
+ import { n as dirname, r as extname, t as basename } from "../../path-CfJghBXy.js";
2
2
 
3
3
  //#region src/source/plugins/slugs.ts
4
4
  /**
@@ -1,6 +1,6 @@
1
- import { a as Separator$1, n as Item$1, t as Folder$1 } from "../../definitions-DSNTbAwC.js";
2
- import "../../utils-IgHyYnrz.js";
3
- import { s as LoaderPlugin } from "../../path-B77y3W0_.js";
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";
4
4
  import { ReactNode } from "react";
5
5
 
6
6
  //#region src/source/plugins/status-badges.d.ts
@@ -1,4 +1,4 @@
1
- import { n as searchSimple, t as searchAdvanced } from "./advanced-BH0syJ-M.js";
1
+ import { n as searchSimple, t as searchAdvanced } from "./advanced-3GdE_Q4d.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-DSNTbAwC.js";
1
+ import { i as Root, n as Item, r as Node, t as Folder } from "./definitions-Cw2aM1Af.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.5.3",
3
+ "version": "16.5.4",
4
4
  "description": "The React.js library for building a documentation website",
5
5
  "keywords": [
6
6
  "Docs",
File without changes
File without changes
File without changes
File without changes
File without changes