fumadocs-core 15.6.5 → 15.6.6

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.
@@ -1,3 +1,5 @@
1
+ import "./chunk-JSBRDJBE.js";
2
+
1
3
  // src/search/client/algolia.ts
2
4
  function groupResults(hits) {
3
5
  const grouped = [];
@@ -1,3 +1,5 @@
1
+ import "./chunk-JSBRDJBE.js";
2
+
1
3
  // src/breadcrumb.tsx
2
4
  import { useMemo } from "react";
3
5
  function useBreadcrumb(url, tree, options) {
@@ -0,0 +1,30 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ // If the importer is in node compatibility mode or this is not an ESM
20
+ // file that has been converted to a CommonJS file using a Babel-
21
+ // compatible transform (i.e. "__esModule" has not been set), then set
22
+ // "default" to the CommonJS "module.exports" for node compatibility.
23
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
+ mod
25
+ ));
26
+
27
+ export {
28
+ __commonJS,
29
+ __toESM
30
+ };
@@ -1,3 +1,5 @@
1
+ import "../chunk-JSBRDJBE.js";
2
+
1
3
  // src/content/index.ts
2
4
  import { remark } from "remark";
3
5
  import remarkGfm from "remark-gfm";
@@ -5,6 +5,7 @@ import {
5
5
  import {
6
6
  useParams
7
7
  } from "./chunk-BBP7MIO4.js";
8
+ import "./chunk-JSBRDJBE.js";
8
9
 
9
10
  // src/dynamic-link.tsx
10
11
  import { forwardRef, useMemo } from "react";
@@ -1,3 +1,5 @@
1
+ import "./chunk-JSBRDJBE.js";
2
+
1
3
  // src/search/client/fetch.ts
2
4
  var cache = /* @__PURE__ */ new Map();
3
5
  async function fetchDocs(query, { api = "/api/search", locale, tag }) {
@@ -8,6 +8,7 @@ import {
8
8
  usePathname,
9
9
  useRouter
10
10
  } from "../chunk-BBP7MIO4.js";
11
+ import "../chunk-JSBRDJBE.js";
11
12
  export {
12
13
  FrameworkProvider,
13
14
  Image,
@@ -2,6 +2,7 @@
2
2
  import {
3
3
  FrameworkProvider
4
4
  } from "../chunk-BBP7MIO4.js";
5
+ import "../chunk-JSBRDJBE.js";
5
6
 
6
7
  // src/framework/next.tsx
7
8
  import { useParams, usePathname, useRouter } from "next/navigation";
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  FrameworkProvider
3
3
  } from "../chunk-BBP7MIO4.js";
4
+ import "../chunk-JSBRDJBE.js";
4
5
 
5
6
  // src/framework/react-router.tsx
6
7
  import { useMemo } from "react";
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  FrameworkProvider
3
3
  } from "../chunk-BBP7MIO4.js";
4
+ import "../chunk-JSBRDJBE.js";
4
5
 
5
6
  // src/framework/tanstack.tsx
6
7
  import { useMemo } from "react";
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ import "./chunk-JSBRDJBE.js";
2
3
 
3
4
  // src/hide-if-empty.tsx
4
5
  import React from "react";
@@ -4,6 +4,7 @@ import {
4
4
  _renderHighlight,
5
5
  highlight
6
6
  } from "../chunk-3NX26V7I.js";
7
+ import "../chunk-JSBRDJBE.js";
7
8
 
8
9
  // src/highlight/client.tsx
9
10
  import {
@@ -2,6 +2,7 @@ import {
2
2
  getHighlighter,
3
3
  highlight
4
4
  } from "../chunk-3NX26V7I.js";
5
+ import "../chunk-JSBRDJBE.js";
5
6
  export {
6
7
  getHighlighter,
7
8
  highlight
@@ -1,3 +1,5 @@
1
+ import "../chunk-JSBRDJBE.js";
2
+
1
3
  // src/i18n/middleware.ts
2
4
  import { match as matchLocale } from "@formatjs/intl-localematcher";
3
5
  import Negotiator from "negotiator";
package/dist/link.js CHANGED
@@ -3,6 +3,7 @@ import {
3
3
  Link
4
4
  } from "./chunk-5SU2O5AS.js";
5
5
  import "./chunk-BBP7MIO4.js";
6
+ import "./chunk-JSBRDJBE.js";
6
7
  export {
7
8
  Link as default
8
9
  };
@@ -10,6 +10,7 @@ import {
10
10
  defaultThemes,
11
11
  getHighlighter
12
12
  } from "../chunk-3NX26V7I.js";
13
+ import "../chunk-JSBRDJBE.js";
13
14
 
14
15
  // src/mdx-plugins/index.ts
15
16
  import {
@@ -0,0 +1,119 @@
1
+ import {
2
+ __commonJS,
3
+ __toESM
4
+ } from "./chunk-JSBRDJBE.js";
5
+
6
+ // ../../node_modules/.pnpm/remove-markdown@0.6.2/node_modules/remove-markdown/index.js
7
+ var require_remove_markdown = __commonJS({
8
+ "../../node_modules/.pnpm/remove-markdown@0.6.2/node_modules/remove-markdown/index.js"(exports, module) {
9
+ "use strict";
10
+ module.exports = function(md, options) {
11
+ options = options || {};
12
+ options.listUnicodeChar = options.hasOwnProperty("listUnicodeChar") ? options.listUnicodeChar : false;
13
+ options.stripListLeaders = options.hasOwnProperty("stripListLeaders") ? options.stripListLeaders : true;
14
+ options.gfm = options.hasOwnProperty("gfm") ? options.gfm : true;
15
+ options.useImgAltText = options.hasOwnProperty("useImgAltText") ? options.useImgAltText : true;
16
+ options.abbr = options.hasOwnProperty("abbr") ? options.abbr : false;
17
+ options.replaceLinksWithURL = options.hasOwnProperty("replaceLinksWithURL") ? options.replaceLinksWithURL : false;
18
+ options.htmlTagsToSkip = options.hasOwnProperty("htmlTagsToSkip") ? options.htmlTagsToSkip : [];
19
+ options.throwError = options.hasOwnProperty("throwError") ? options.throwError : false;
20
+ var output = md || "";
21
+ output = output.replace(/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/gm, "");
22
+ try {
23
+ if (options.stripListLeaders) {
24
+ if (options.listUnicodeChar)
25
+ output = output.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm, options.listUnicodeChar + " $1");
26
+ else
27
+ output = output.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm, "$1");
28
+ }
29
+ if (options.gfm) {
30
+ output = output.replace(/\n={2,}/g, "\n").replace(/~{3}.*\n/g, "").replace(/~~/g, "").replace(/```(?:.*)\n([\s\S]*?)```/g, (_, code) => code.trim());
31
+ }
32
+ if (options.abbr) {
33
+ output = output.replace(/\*\[.*\]:.*\n/, "");
34
+ }
35
+ let htmlReplaceRegex = /<[^>]*>/g;
36
+ if (options.htmlTagsToSkip && options.htmlTagsToSkip.length > 0) {
37
+ const joinedHtmlTagsToSkip = options.htmlTagsToSkip.join("|");
38
+ htmlReplaceRegex = new RegExp(
39
+ `<(?!/?(${joinedHtmlTagsToSkip})(?=>|s[^>]*>))[^>]*>`,
40
+ "g"
41
+ );
42
+ }
43
+ output = output.replace(htmlReplaceRegex, "").replace(/^[=\-]{2,}\s*$/g, "").replace(/\[\^.+?\](\: .*?$)?/g, "").replace(/\s{0,2}\[.*?\]: .*?$/g, "").replace(/\!\[(.*?)\][\[\(].*?[\]\)]/g, options.useImgAltText ? "$1" : "").replace(/\[([\s\S]*?)\]\s*[\(\[].*?[\)\]]/g, options.replaceLinksWithURL ? "$2" : "$1").replace(/^(\n)?\s{0,3}>\s?/gm, "$1").replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g, "").replace(/^(\n)?\s{0,}#{1,6}\s*( (.+))? +#+$|^(\n)?\s{0,}#{1,6}\s*( (.+))?$/gm, "$1$3$4$6").replace(/([\*]+)(\S)(.*?\S)??\1/g, "$2$3").replace(/(^|\W)([_]+)(\S)(.*?\S)??\2($|\W)/g, "$1$3$4$5").replace(/(`{3,})(.*?)\1/gm, "$2").replace(/`(.+?)`/g, "$1").replace(/~(.*?)~/g, "$1");
44
+ } catch (e) {
45
+ if (options.throwError) throw e;
46
+ console.error("remove-markdown encountered error: %s", e);
47
+ return md;
48
+ }
49
+ return output;
50
+ };
51
+ }
52
+ });
53
+
54
+ // src/search/client/mixedbread.ts
55
+ var import_remove_markdown = __toESM(require_remove_markdown(), 1);
56
+ import Slugger from "github-slugger";
57
+ var slugger = new Slugger();
58
+ function extractHeadingTitle(text) {
59
+ const trimmedText = text.trim();
60
+ if (!trimmedText.startsWith("#")) {
61
+ return "";
62
+ }
63
+ const lines = trimmedText.split("\n");
64
+ const firstLine = lines[0]?.trim();
65
+ if (firstLine) {
66
+ const plainText = (0, import_remove_markdown.default)(firstLine, {
67
+ useImgAltText: false
68
+ });
69
+ return plainText;
70
+ }
71
+ return "";
72
+ }
73
+ async function search(query, options) {
74
+ const { client, vectorStoreId, tag } = options;
75
+ if (!query.trim()) {
76
+ return [];
77
+ }
78
+ const res = await client.vectorStores.search({
79
+ query,
80
+ vector_store_identifiers: [vectorStoreId],
81
+ top_k: 10,
82
+ filters: {
83
+ key: "generated_metadata.tag",
84
+ operator: "eq",
85
+ value: tag
86
+ },
87
+ search_options: {
88
+ return_metadata: true
89
+ }
90
+ });
91
+ const results = res.data.flatMap((item) => {
92
+ const metadata = item.generated_metadata;
93
+ const url = metadata.url || "#";
94
+ const title = metadata.title || "Untitled";
95
+ const chunkResults = [
96
+ {
97
+ id: `${item.file_id}-${item.chunk_index}-page`,
98
+ type: "page",
99
+ content: title,
100
+ url
101
+ }
102
+ ];
103
+ const headingTitle = item.type === "text" ? extractHeadingTitle(item.text) : "";
104
+ if (headingTitle) {
105
+ slugger.reset();
106
+ chunkResults.push({
107
+ id: `${item.file_id}-${item.chunk_index}-heading`,
108
+ type: "heading",
109
+ content: headingTitle,
110
+ url: `${url}#${slugger.slug(headingTitle)}`
111
+ });
112
+ }
113
+ return chunkResults;
114
+ });
115
+ return results;
116
+ }
117
+ export {
118
+ search
119
+ };
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  removeUndefined
3
3
  } from "./chunk-KAOEMCTI.js";
4
+ import "./chunk-JSBRDJBE.js";
4
5
 
5
6
  // src/search/client/orama-cloud.ts
6
7
  async function searchDocs(query, options) {
@@ -1,3 +1,5 @@
1
+ import "../chunk-JSBRDJBE.js";
2
+
1
3
  // src/search/algolia.ts
2
4
  async function sync(client, options) {
3
5
  const { document = "document", indexName = document, documents } = options;
@@ -3,6 +3,7 @@ import { AnyOrama } from '@orama/orama';
3
3
  import { BaseIndex } from './algolia.js';
4
4
  import { LiteClient, SearchResponse } from 'algoliasearch/lite';
5
5
  import { OramaClient, ClientSearchParams } from '@oramacloud/client';
6
+ import Mixedbread from '@mixedbread/sdk';
6
7
  import 'algoliasearch';
7
8
  import '../remark-structure-DVje0Sib.js';
8
9
  import 'mdast';
@@ -76,6 +77,25 @@ interface OramaCloudOptions {
76
77
  locale?: string;
77
78
  }
78
79
 
80
+ interface MixedbreadOptions {
81
+ /**
82
+ * The ID of the vector store to search in
83
+ */
84
+ vectorStoreId: string;
85
+ /**
86
+ * The Mixedbread SDK client instance
87
+ */
88
+ client: Mixedbread;
89
+ /**
90
+ * Filter results with specific tag.
91
+ */
92
+ tag?: string;
93
+ /**
94
+ * Filter by locale (unsupported at the moment)
95
+ */
96
+ locale?: string;
97
+ }
98
+
79
99
  interface UseDocsSearch {
80
100
  search: string;
81
101
  setSearch: (v: string) => void;
@@ -93,7 +113,9 @@ type Client = ({
93
113
  type: 'algolia';
94
114
  } & AlgoliaOptions) | ({
95
115
  type: 'orama-cloud';
96
- } & OramaCloudOptions);
116
+ } & OramaCloudOptions) | ({
117
+ type: 'mixedbread';
118
+ } & MixedbreadOptions);
97
119
  /**
98
120
  * Provide a hook to query different official search clients.
99
121
  *
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  useOnChange
3
3
  } from "../chunk-EMWGTXSW.js";
4
+ import "../chunk-JSBRDJBE.js";
4
5
 
5
6
  // src/search/client.ts
6
7
  import { useRef as useRef2, useState as useState2 } from "react";
@@ -64,19 +65,23 @@ function useDocsSearch(clientOptions, _locale, _tag, _delayMs = 100, _allowEmpty
64
65
  async function run() {
65
66
  if (debouncedValue.length === 0 && !allowEmpty) return "empty";
66
67
  if (client.type === "fetch") {
67
- const { fetchDocs } = await import("../fetch-YKY7NMVE.js");
68
+ const { fetchDocs } = await import("../fetch-ITPHBPBE.js");
68
69
  return fetchDocs(debouncedValue, client);
69
70
  }
70
71
  if (client.type === "algolia") {
71
- const { searchDocs } = await import("../algolia-NXNLN7TR.js");
72
+ const { searchDocs } = await import("../algolia-UCGCELZZ.js");
72
73
  return searchDocs(debouncedValue, client);
73
74
  }
74
75
  if (client.type === "orama-cloud") {
75
- const { searchDocs } = await import("../orama-cloud-I4WBDIAI.js");
76
+ const { searchDocs } = await import("../orama-cloud-6T5Z4MZY.js");
76
77
  return searchDocs(debouncedValue, client);
77
78
  }
78
79
  if (client.type === "static") {
79
- const { search: search2 } = await import("../static-5YPNWD5F.js");
80
+ const { search: search2 } = await import("../static-7YX4RCT6.js");
81
+ return search2(debouncedValue, client);
82
+ }
83
+ if (client.type === "mixedbread") {
84
+ const { search: search2 } = await import("../mixedbread-2MQ3PSN7.js");
80
85
  return search2(debouncedValue, client);
81
86
  }
82
87
  throw new Error("unknown search client");
@@ -1,3 +1,5 @@
1
+ import "../chunk-JSBRDJBE.js";
2
+
1
3
  // src/search/orama-cloud.ts
2
4
  async function sync(cloudManager, options) {
3
5
  const { autoDeploy = true } = options;
@@ -7,6 +7,7 @@ import {
7
7
  basename,
8
8
  extname
9
9
  } from "../chunk-7GNSIKII.js";
10
+ import "../chunk-JSBRDJBE.js";
10
11
 
11
12
  // src/search/server.ts
12
13
  import {
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  remarkHeading
3
3
  } from "../chunk-Y2774T3B.js";
4
+ import "../chunk-JSBRDJBE.js";
4
5
 
5
6
  // src/server/get-toc.ts
6
7
  import { remark } from "remark";
package/dist/sidebar.js CHANGED
@@ -2,6 +2,7 @@
2
2
  import {
3
3
  useMediaQuery
4
4
  } from "./chunk-EP5LHGDZ.js";
5
+ import "./chunk-JSBRDJBE.js";
5
6
 
6
7
  // src/sidebar.tsx
7
8
  import {
@@ -10,6 +10,7 @@ import {
10
10
  slash,
11
11
  splitPath
12
12
  } from "../chunk-3JSIVMCJ.js";
13
+ import "../chunk-JSBRDJBE.js";
13
14
 
14
15
  // src/source/page-tree-builder.ts
15
16
  var group = /^\((?<name>.+)\)$/;
@@ -3,6 +3,7 @@ import {
3
3
  searchSimple
4
4
  } from "./chunk-62HKBTBF.js";
5
5
  import "./chunk-KAOEMCTI.js";
6
+ import "./chunk-JSBRDJBE.js";
6
7
 
7
8
  // src/search/client/static.ts
8
9
  import { create, load } from "@orama/orama";
package/dist/toc.js CHANGED
@@ -2,6 +2,7 @@
2
2
  import {
3
3
  useOnChange
4
4
  } from "./chunk-EMWGTXSW.js";
5
+ import "./chunk-JSBRDJBE.js";
5
6
 
6
7
  // src/toc.tsx
7
8
  import { createContext, forwardRef, useContext, useMemo, useRef } from "react";
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ import "../chunk-JSBRDJBE.js";
2
3
 
3
4
  // src/utils/use-effect-event.ts
4
5
  import { useCallback, useRef } from "react";
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  useMediaQuery
3
3
  } from "../chunk-EP5LHGDZ.js";
4
+ import "../chunk-JSBRDJBE.js";
4
5
  export {
5
6
  useMediaQuery
6
7
  };
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  useOnChange
3
3
  } from "../chunk-EMWGTXSW.js";
4
+ import "../chunk-JSBRDJBE.js";
4
5
  export {
5
6
  useOnChange
6
7
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-core",
3
- "version": "15.6.5",
3
+ "version": "15.6.6",
4
4
  "description": "The library for building a documentation website in Next.js",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -105,21 +105,23 @@
105
105
  },
106
106
  "devDependencies": {
107
107
  "@mdx-js/mdx": "^3.1.0",
108
+ "@mixedbread/sdk": "^0.19.0",
108
109
  "@oramacloud/client": "^2.1.4",
109
- "@tanstack/react-router": "^1.128.8",
110
+ "@tanstack/react-router": "^1.129.0",
110
111
  "@types/estree-jsx": "^1.0.5",
111
112
  "@types/hast": "^3.0.4",
112
113
  "@types/mdast": "^4.0.3",
113
114
  "@types/negotiator": "^0.6.4",
114
- "@types/node": "24.0.15",
115
+ "@types/node": "24.1.0",
115
116
  "@types/react": "^19.1.8",
116
117
  "@types/react-dom": "^19.1.6",
117
- "algoliasearch": "5.34.0",
118
+ "algoliasearch": "5.34.1",
118
119
  "mdast-util-mdx-jsx": "^3.2.0",
119
120
  "mdast-util-mdxjs-esm": "^2.0.1",
120
- "next": "^15.4.2",
121
- "react-router": "^7.7.0",
121
+ "next": "^15.4.4",
122
+ "react-router": "^7.7.1",
122
123
  "remark-mdx": "^3.1.0",
124
+ "remove-markdown": "^0.6.2",
123
125
  "typescript": "^5.8.3",
124
126
  "unified": "^11.0.5",
125
127
  "vfile": "^6.0.3",
@@ -127,6 +129,7 @@
127
129
  "tsconfig": "0.0.0"
128
130
  },
129
131
  "peerDependencies": {
132
+ "@mixedbread/sdk": "^0.19.0",
130
133
  "@oramacloud/client": "1.x.x || 2.x.x",
131
134
  "@types/react": "*",
132
135
  "algoliasearch": "5.x.x",
@@ -135,6 +138,9 @@
135
138
  "react-dom": "18.x.x || 19.x.x"
136
139
  },
137
140
  "peerDependenciesMeta": {
141
+ "@mixedbread/sdk": {
142
+ "optional": true
143
+ },
138
144
  "@types/react": {
139
145
  "optional": true
140
146
  },