fumadocs-core 16.6.14 → 16.6.16
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/{advanced-DoRLtKVF.js → advanced-BZKQwtss.js} +5 -6
- package/dist/{endpoint-Bz07NwEH.js → endpoint-8Kwx_qOv.js} +11 -7
- package/dist/search/client/flexsearch-static.js +1 -1
- package/dist/search/client/orama-static.js +1 -1
- package/dist/search/flexsearch.d.ts +1 -1
- package/dist/search/flexsearch.js +3 -3
- package/dist/search/index.js +1 -1
- package/dist/search/mixedbread.d.ts +1 -1
- package/dist/search/mixedbread.js +4 -4
- package/dist/search/server.d.ts +1 -1
- package/dist/search/server.js +14 -9
- package/dist/{server-DR-HoW2v.d.ts → server-C0aEeWdv.d.ts} +1 -0
- package/dist/{utils-CbdTrQE7.js → utils-ktUGajEb.js} +2 -2
- package/package.json +8 -9
|
@@ -36,12 +36,10 @@ async function searchAdvanced(db, query, tag = [], { mode = "fulltext", ...overr
|
|
|
36
36
|
properties: ["page_id"],
|
|
37
37
|
maxResult: 8,
|
|
38
38
|
...override.groupBy
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
if (query.length > 0) Object.assign(params, {
|
|
42
|
-
term: query,
|
|
39
|
+
},
|
|
43
40
|
properties: mode === "fulltext" ? ["content"] : ["content", "embeddings"]
|
|
44
|
-
}
|
|
41
|
+
};
|
|
42
|
+
if (query.length > 0) params.term = query;
|
|
45
43
|
const highlighter = createContentHighlighter(query);
|
|
46
44
|
const result = await search(db, params);
|
|
47
45
|
const list = [];
|
|
@@ -67,7 +65,8 @@ async function searchAdvanced(db, query, tag = [], { mode = "fulltext", ...overr
|
|
|
67
65
|
});
|
|
68
66
|
}
|
|
69
67
|
}
|
|
70
|
-
|
|
68
|
+
if (typeof params.limit === "number" && list.length > params.limit) return list.slice(0, params.limit);
|
|
69
|
+
return list;
|
|
71
70
|
}
|
|
72
71
|
//#endregion
|
|
73
72
|
export { searchSimple as n, searchAdvanced as t };
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
//#region src/search/server/endpoint.ts
|
|
2
2
|
function createEndpoint(server, options = {}) {
|
|
3
3
|
const { search } = server;
|
|
4
|
-
const { readOptions =
|
|
5
|
-
return {
|
|
6
|
-
tag: url.searchParams.get("tag")?.split(","),
|
|
7
|
-
locale: url.searchParams.get("locale")
|
|
8
|
-
};
|
|
9
|
-
} } = options;
|
|
4
|
+
const { readOptions = defaultReadOptions } = options;
|
|
10
5
|
return {
|
|
11
6
|
...server,
|
|
12
7
|
async staticGET() {
|
|
@@ -20,5 +15,14 @@ function createEndpoint(server, options = {}) {
|
|
|
20
15
|
}
|
|
21
16
|
};
|
|
22
17
|
}
|
|
18
|
+
function defaultReadOptions(url) {
|
|
19
|
+
const params = url.searchParams;
|
|
20
|
+
const limit = params.has("limit") ? Number(params.get("limit")) : void 0;
|
|
21
|
+
return {
|
|
22
|
+
tag: params.get("tag")?.split(","),
|
|
23
|
+
locale: params.get("locale"),
|
|
24
|
+
limit: Number.isInteger(limit) ? limit : void 0
|
|
25
|
+
};
|
|
26
|
+
}
|
|
23
27
|
//#endregion
|
|
24
|
-
export { createEndpoint as t };
|
|
28
|
+
export { defaultReadOptions as n, createEndpoint as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as search, t as createDocument } from "../../utils-
|
|
1
|
+
import { n as search, t as createDocument } from "../../utils-ktUGajEb.js";
|
|
2
2
|
//#region src/search/client/flexsearch-static.ts
|
|
3
3
|
function initDocument(data) {
|
|
4
4
|
const document = createDocument();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as searchSimple, t as searchAdvanced } from "../../advanced-
|
|
1
|
+
import { n as searchSimple, t as searchAdvanced } from "../../advanced-BZKQwtss.js";
|
|
2
2
|
import { create, load } from "@orama/orama";
|
|
3
3
|
//#region src/search/client/orama-static.ts
|
|
4
4
|
const cache = /* @__PURE__ */ new Map();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as Awaitable } from "../types-3ccArm6T.js";
|
|
2
2
|
import { t as I18nConfig } from "../index-CNf0Q1pt.js";
|
|
3
|
-
import { m as SharedIndex, n as SearchAPI, t as QueryOptions } from "../server-
|
|
3
|
+
import { m as SharedIndex, n as SearchAPI, t as QueryOptions } from "../server-C0aEeWdv.js";
|
|
4
4
|
import { i as LoaderConfig, o as LoaderOutput, u as Page } from "../index-_S7CzA5M.js";
|
|
5
5
|
import { DocumentData, DocumentOptions } from "flexsearch";
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as createEndpoint } from "../endpoint-
|
|
1
|
+
import { t as createEndpoint } from "../endpoint-8Kwx_qOv.js";
|
|
2
2
|
import { n as buildBreadcrumbs, r as buildIndexDefault, t as buildDocuments } from "../build-doc-BotvE-sS.js";
|
|
3
|
-
import { n as search, t as createDocument } from "../utils-
|
|
3
|
+
import { n as search, t as createDocument } from "../utils-ktUGajEb.js";
|
|
4
4
|
import Search from "flexsearch";
|
|
5
5
|
//#region src/search/flexsearch.ts
|
|
6
6
|
function server(options) {
|
|
@@ -23,7 +23,7 @@ function server(options) {
|
|
|
23
23
|
};
|
|
24
24
|
},
|
|
25
25
|
async search(query, searchOptions) {
|
|
26
|
-
return search(await indexPromise, query, searchOptions?.tag);
|
|
26
|
+
return search(await indexPromise, query, searchOptions?.tag, searchOptions?.limit);
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
}
|
package/dist/search/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as SortedResult } from "../index-CTt-rhJo.js";
|
|
2
|
-
import { n as SearchAPI } from "../server-
|
|
2
|
+
import { n as SearchAPI } from "../server-C0aEeWdv.js";
|
|
3
3
|
import Mixedbread from "@mixedbread/sdk";
|
|
4
4
|
import { StoreSearchResponse } from "@mixedbread/sdk/resources/stores";
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as __toESM } from "../chunk-BoAXSpZd.js";
|
|
2
|
-
import { t as createEndpoint } from "../endpoint-
|
|
2
|
+
import { t as createEndpoint } from "../endpoint-8Kwx_qOv.js";
|
|
3
3
|
import { t as require_remove_markdown } from "../remove-markdown-C5S415Dz.js";
|
|
4
4
|
import Slugger from "github-slugger";
|
|
5
5
|
//#region src/search/mixedbread.ts
|
|
@@ -39,9 +39,9 @@ function defaultTransform(results) {
|
|
|
39
39
|
function createMixedbreadSearchAPI(options) {
|
|
40
40
|
const { client, storeIdentifier, topK = 10, rerank, rewriteQuery, scoreThreshold, transform } = options;
|
|
41
41
|
return createEndpoint({
|
|
42
|
-
async search(query, searchOptions) {
|
|
42
|
+
async search(query, searchOptions = {}) {
|
|
43
43
|
if (!query.trim()) return [];
|
|
44
|
-
const tag = searchOptions
|
|
44
|
+
const { tag, limit } = searchOptions;
|
|
45
45
|
let filters;
|
|
46
46
|
if (Array.isArray(tag) && tag.length > 0) filters = {
|
|
47
47
|
key: "generated_metadata.tag",
|
|
@@ -56,7 +56,7 @@ function createMixedbreadSearchAPI(options) {
|
|
|
56
56
|
const results = (await client.stores.search({
|
|
57
57
|
query,
|
|
58
58
|
store_identifiers: [storeIdentifier],
|
|
59
|
-
top_k: topK,
|
|
59
|
+
top_k: limit ?? topK,
|
|
60
60
|
filters,
|
|
61
61
|
search_options: {
|
|
62
62
|
return_metadata: true,
|
package/dist/search/server.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as AdvancedOptions, c as SimpleOptions, d as createSearchAPI, f as initAdvancedSearch, i as AdvancedIndex, l as createFromSource, n as SearchAPI, o as ExportedData, p as initSimpleSearch, r as SearchServer, s as Index, t as QueryOptions, u as createI18nSearchAPI } from "../server-
|
|
1
|
+
import { a as AdvancedOptions, c as SimpleOptions, d as createSearchAPI, f as initAdvancedSearch, i as AdvancedIndex, l as createFromSource, n as SearchAPI, o as ExportedData, p as initSimpleSearch, r as SearchServer, s as Index, t as QueryOptions, u as createI18nSearchAPI } from "../server-C0aEeWdv.js";
|
|
2
2
|
export { AdvancedIndex, AdvancedOptions, ExportedData, Index, QueryOptions, SearchAPI, SearchServer, SimpleOptions, createFromSource, createI18nSearchAPI, createSearchAPI, initAdvancedSearch, initSimpleSearch };
|
package/dist/search/server.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as createEndpoint } from "../endpoint-
|
|
1
|
+
import { n as defaultReadOptions, t as createEndpoint } from "../endpoint-8Kwx_qOv.js";
|
|
2
2
|
import { n as buildBreadcrumbs, r as buildIndexDefault, t as buildDocuments } from "../build-doc-BotvE-sS.js";
|
|
3
|
-
import { n as searchSimple, t as searchAdvanced } from "../advanced-
|
|
3
|
+
import { n as searchSimple, t as searchAdvanced } from "../advanced-BZKQwtss.js";
|
|
4
4
|
import { create, insertMultiple, save } from "@orama/orama";
|
|
5
5
|
//#region src/search/orama/_stemmers.ts
|
|
6
6
|
const STEMMERS = {
|
|
@@ -99,8 +99,13 @@ function initSimpleSearch(options) {
|
|
|
99
99
|
...save(await doc)
|
|
100
100
|
};
|
|
101
101
|
},
|
|
102
|
-
async search(query) {
|
|
103
|
-
|
|
102
|
+
async search(query, searchOptions = {}) {
|
|
103
|
+
const db = await doc;
|
|
104
|
+
const { limit } = searchOptions;
|
|
105
|
+
return searchSimple(db, query, {
|
|
106
|
+
limit,
|
|
107
|
+
...options.search
|
|
108
|
+
});
|
|
104
109
|
}
|
|
105
110
|
};
|
|
106
111
|
}
|
|
@@ -113,11 +118,12 @@ function initAdvancedSearch(options) {
|
|
|
113
118
|
...save(await get)
|
|
114
119
|
};
|
|
115
120
|
},
|
|
116
|
-
async search(query, searchOptions) {
|
|
121
|
+
async search(query, searchOptions = {}) {
|
|
117
122
|
const db = await get;
|
|
118
|
-
const mode = searchOptions
|
|
119
|
-
return searchAdvanced(db, query,
|
|
123
|
+
const { limit, tag, mode } = searchOptions;
|
|
124
|
+
return searchAdvanced(db, query, tag, {
|
|
120
125
|
...options.search,
|
|
126
|
+
limit,
|
|
121
127
|
mode: mode === "vector" ? "vector" : "fulltext"
|
|
122
128
|
}).catch((err) => {
|
|
123
129
|
if (mode === "vector") throw new Error("failed to search, make sure you have installed `@orama/plugin-embeddings` according to their docs.", { cause: err });
|
|
@@ -217,8 +223,7 @@ function createFromSource(source, options = {}) {
|
|
|
217
223
|
function toAPI(server) {
|
|
218
224
|
return createEndpoint(server, { readOptions(url) {
|
|
219
225
|
return {
|
|
220
|
-
|
|
221
|
-
locale: url.searchParams.get("locale"),
|
|
226
|
+
...defaultReadOptions(url),
|
|
222
227
|
mode: url.searchParams.get("mode") === "vector" ? "vector" : "full"
|
|
223
228
|
};
|
|
224
229
|
} });
|
|
@@ -116,6 +116,7 @@ declare function createFromSource<C extends LoaderConfig>(source: LoaderOutput<C
|
|
|
116
116
|
interface QueryOptions {
|
|
117
117
|
locale?: string | null;
|
|
118
118
|
tag?: string | string[];
|
|
119
|
+
limit?: number;
|
|
119
120
|
}
|
|
120
121
|
interface SearchServer<Q extends QueryOptions = QueryOptions> {
|
|
121
122
|
search: (query: string, options?: Q) => Promise<SortedResult[]>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createContentHighlighter } from "./search/index.js";
|
|
2
2
|
import Search from "flexsearch";
|
|
3
3
|
//#region src/search/flexsearch/utils.ts
|
|
4
|
-
async function search(index, query, tag) {
|
|
4
|
+
async function search(index, query, tag, limit = 60) {
|
|
5
5
|
const arr = await index.searchAsync(query, {
|
|
6
6
|
index: "content",
|
|
7
|
-
limit
|
|
7
|
+
limit,
|
|
8
8
|
tag: tag ? { tags: tag } : void 0
|
|
9
9
|
});
|
|
10
10
|
const out = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-core",
|
|
3
|
-
"version": "16.6.
|
|
3
|
+
"version": "16.6.16",
|
|
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.
|
|
122
|
-
"@shikijs/transformers": "^4.0.
|
|
121
|
+
"@shikijs/rehype": "^4.0.2",
|
|
122
|
+
"@shikijs/transformers": "^4.0.2",
|
|
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.
|
|
137
|
+
"shiki": "^4.0.2",
|
|
138
138
|
"tinyglobby": "^0.2.15",
|
|
139
139
|
"unified": "^11.0.5",
|
|
140
140
|
"unist-util-visit": "^5.1.0",
|
|
@@ -145,16 +145,15 @@
|
|
|
145
145
|
"@mixedbread/sdk": "^0.57.0",
|
|
146
146
|
"@orama/core": "^1.2.19",
|
|
147
147
|
"@oramacloud/client": "^2.1.4",
|
|
148
|
-
"@tanstack/react-router": "1.166.
|
|
148
|
+
"@tanstack/react-router": "1.166.7",
|
|
149
149
|
"@types/estree-jsx": "^1.0.5",
|
|
150
|
-
"@types/flexsearch": "^0.7.42",
|
|
151
150
|
"@types/hast": "^3.0.4",
|
|
152
151
|
"@types/mdast": "^4.0.4",
|
|
153
152
|
"@types/negotiator": "^0.6.4",
|
|
154
|
-
"@types/node": "25.
|
|
153
|
+
"@types/node": "25.4.0",
|
|
155
154
|
"@types/react": "^19.2.14",
|
|
156
155
|
"@types/react-dom": "^19.2.3",
|
|
157
|
-
"algoliasearch": "5.49.
|
|
156
|
+
"algoliasearch": "5.49.2",
|
|
158
157
|
"flexsearch": "^0.8.212",
|
|
159
158
|
"lucide-react": "^0.577.0",
|
|
160
159
|
"next": "16.1.6",
|
|
@@ -162,7 +161,7 @@
|
|
|
162
161
|
"remark-directive": "^4.0.0",
|
|
163
162
|
"remark-mdx": "^3.1.1",
|
|
164
163
|
"remove-markdown": "^0.6.3",
|
|
165
|
-
"tsdown": "0.21.
|
|
164
|
+
"tsdown": "0.21.1",
|
|
166
165
|
"typescript": "^5.9.3",
|
|
167
166
|
"waku": "1.0.0-alpha.5",
|
|
168
167
|
"zod": "^4.3.6",
|