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.
- package/dist/{algolia-NXNLN7TR.js → algolia-UCGCELZZ.js} +2 -0
- package/dist/breadcrumb.js +2 -0
- package/dist/chunk-JSBRDJBE.js +30 -0
- package/dist/content/index.js +2 -0
- package/dist/dynamic-link.js +1 -0
- package/dist/{fetch-YKY7NMVE.js → fetch-ITPHBPBE.js} +2 -0
- package/dist/framework/index.js +1 -0
- package/dist/framework/next.js +1 -0
- package/dist/framework/react-router.js +1 -0
- package/dist/framework/tanstack.js +1 -0
- package/dist/hide-if-empty.js +1 -0
- package/dist/highlight/client.js +1 -0
- package/dist/highlight/index.js +1 -0
- package/dist/i18n/index.js +2 -0
- package/dist/link.js +1 -0
- package/dist/mdx-plugins/index.js +1 -0
- package/dist/mixedbread-2MQ3PSN7.js +119 -0
- package/dist/{orama-cloud-I4WBDIAI.js → orama-cloud-6T5Z4MZY.js} +1 -0
- package/dist/search/algolia.js +2 -0
- package/dist/search/client.d.ts +23 -1
- package/dist/search/client.js +9 -4
- package/dist/search/orama-cloud.js +2 -0
- package/dist/search/server.js +1 -0
- package/dist/server/index.js +1 -0
- package/dist/sidebar.js +1 -0
- package/dist/source/index.js +1 -0
- package/dist/{static-5YPNWD5F.js → static-7YX4RCT6.js} +1 -0
- package/dist/toc.js +1 -0
- package/dist/utils/use-effect-event.js +1 -0
- package/dist/utils/use-media-query.js +1 -0
- package/dist/utils/use-on-change.js +1 -0
- package/package.json +12 -6
package/dist/breadcrumb.js
CHANGED
|
@@ -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
|
+
};
|
package/dist/content/index.js
CHANGED
package/dist/dynamic-link.js
CHANGED
package/dist/framework/index.js
CHANGED
package/dist/framework/next.js
CHANGED
package/dist/hide-if-empty.js
CHANGED
package/dist/highlight/client.js
CHANGED
package/dist/highlight/index.js
CHANGED
package/dist/i18n/index.js
CHANGED
package/dist/link.js
CHANGED
|
@@ -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
|
+
};
|
package/dist/search/algolia.js
CHANGED
package/dist/search/client.d.ts
CHANGED
|
@@ -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
|
*
|
package/dist/search/client.js
CHANGED
|
@@ -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-
|
|
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-
|
|
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-
|
|
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-
|
|
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");
|
package/dist/search/server.js
CHANGED
package/dist/server/index.js
CHANGED
package/dist/sidebar.js
CHANGED
package/dist/source/index.js
CHANGED
package/dist/toc.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-core",
|
|
3
|
-
"version": "15.6.
|
|
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.
|
|
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
|
|
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.
|
|
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.
|
|
121
|
-
"react-router": "^7.7.
|
|
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
|
},
|