fumadocs-core 14.6.4 → 14.6.5
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.
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
removeUndefined
|
|
3
3
|
} from "./chunk-2V6SCS43.js";
|
|
4
4
|
|
|
5
|
-
// src/search/search/simple.ts
|
|
5
|
+
// src/search/orama/search/simple.ts
|
|
6
6
|
import { search } from "@orama/orama";
|
|
7
7
|
async function searchSimple(db, query, params = {}) {
|
|
8
8
|
const result = await search(db, {
|
|
@@ -22,7 +22,7 @@ async function searchSimple(db, query, params = {}) {
|
|
|
22
22
|
}));
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
// src/search/search/advanced.ts
|
|
25
|
+
// src/search/orama/search/advanced.ts
|
|
26
26
|
import { getByID, search as search2 } from "@orama/orama";
|
|
27
27
|
async function searchAdvanced(db, query, tag, extraParams = {}) {
|
|
28
28
|
let params = {
|
package/dist/search/client.js
CHANGED
|
@@ -67,7 +67,7 @@ function useDocsSearch(client, locale, tag, delayMs = 100, allowEmpty = false, k
|
|
|
67
67
|
const { searchDocs } = await import("../orama-cloud-QNHGN6SO.js");
|
|
68
68
|
return searchDocs(debouncedValue, tag, client);
|
|
69
69
|
}
|
|
70
|
-
const { createStaticClient } = await import("../static-
|
|
70
|
+
const { createStaticClient } = await import("../static-7O35FMI3.js");
|
|
71
71
|
if (!staticClient) staticClient = createStaticClient(client);
|
|
72
72
|
return staticClient.search(debouncedValue, locale, tag);
|
|
73
73
|
}
|
package/dist/search/server.d.ts
CHANGED
|
@@ -19,9 +19,8 @@ declare const advancedSchema: {
|
|
|
19
19
|
readonly tag: "string";
|
|
20
20
|
readonly url: "string";
|
|
21
21
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
declare const schema: {
|
|
22
|
+
type SimpleDocument = TypedDocument<Orama<typeof simpleSchema>>;
|
|
23
|
+
declare const simpleSchema: {
|
|
25
24
|
readonly url: "string";
|
|
26
25
|
readonly title: "string";
|
|
27
26
|
readonly description: "string";
|
|
@@ -83,7 +82,7 @@ interface SimpleOptions extends SharedOptions {
|
|
|
83
82
|
/**
|
|
84
83
|
* Customise search options on server
|
|
85
84
|
*/
|
|
86
|
-
search?: Partial<SearchParams<Orama<typeof
|
|
85
|
+
search?: Partial<SearchParams<Orama<typeof simpleSchema>, SimpleDocument>>;
|
|
87
86
|
}
|
|
88
87
|
interface AdvancedOptions extends SharedOptions {
|
|
89
88
|
indexes: AdvancedIndex[] | Dynamic<AdvancedIndex>;
|
package/dist/search/server.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
searchAdvanced,
|
|
3
3
|
searchSimple
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-BO6MEAPT.js";
|
|
5
5
|
import "../chunk-2V6SCS43.js";
|
|
6
6
|
import "../chunk-MLKGABMK.js";
|
|
7
7
|
|
|
8
8
|
// src/search/server.ts
|
|
9
9
|
import { save } from "@orama/orama";
|
|
10
10
|
|
|
11
|
-
// src/search/create-endpoint.ts
|
|
11
|
+
// src/search/orama/create-endpoint.ts
|
|
12
12
|
function createEndpoint(server) {
|
|
13
13
|
const { search } = server;
|
|
14
14
|
return {
|
|
@@ -29,7 +29,7 @@ function createEndpoint(server) {
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
// src/search/create-db.ts
|
|
32
|
+
// src/search/orama/create-db.ts
|
|
33
33
|
import {
|
|
34
34
|
create,
|
|
35
35
|
insertMultiple
|
|
@@ -103,13 +103,7 @@ async function createDB({
|
|
|
103
103
|
await insertMultiple(db, mapTo);
|
|
104
104
|
return db;
|
|
105
105
|
}
|
|
106
|
-
|
|
107
|
-
// src/search/create-db-simple.ts
|
|
108
|
-
import {
|
|
109
|
-
create as create2,
|
|
110
|
-
insertMultiple as insertMultiple2
|
|
111
|
-
} from "@orama/orama";
|
|
112
|
-
var schema = {
|
|
106
|
+
var simpleSchema = {
|
|
113
107
|
url: "string",
|
|
114
108
|
title: "string",
|
|
115
109
|
description: "string",
|
|
@@ -122,14 +116,14 @@ async function createDBSimple({
|
|
|
122
116
|
...rest
|
|
123
117
|
}) {
|
|
124
118
|
const items = typeof indexes === "function" ? await indexes() : indexes;
|
|
125
|
-
const db = await
|
|
126
|
-
schema,
|
|
119
|
+
const db = await create({
|
|
120
|
+
schema: simpleSchema,
|
|
127
121
|
components: {
|
|
128
122
|
tokenizer
|
|
129
123
|
},
|
|
130
124
|
...rest
|
|
131
125
|
});
|
|
132
|
-
await
|
|
126
|
+
await insertMultiple(
|
|
133
127
|
db,
|
|
134
128
|
items.map((page) => ({
|
|
135
129
|
title: page.title,
|
|
@@ -142,7 +136,7 @@ async function createDBSimple({
|
|
|
142
136
|
return db;
|
|
143
137
|
}
|
|
144
138
|
|
|
145
|
-
// src/search/create-from-source.ts
|
|
139
|
+
// src/search/orama/create-from-source.ts
|
|
146
140
|
function pageToIndex(page) {
|
|
147
141
|
if (!("structuredData" in page.data)) {
|
|
148
142
|
throw new Error(
|
|
@@ -180,7 +174,7 @@ function createFromSource(source, pageToIndexFn = pageToIndex, options = {}) {
|
|
|
180
174
|
});
|
|
181
175
|
}
|
|
182
176
|
|
|
183
|
-
// src/search/_stemmers.ts
|
|
177
|
+
// src/search/orama/_stemmers.ts
|
|
184
178
|
var STEMMERS = {
|
|
185
179
|
arabic: "ar",
|
|
186
180
|
armenian: "am",
|
|
@@ -213,7 +207,7 @@ var STEMMERS = {
|
|
|
213
207
|
sanskrit: "sk"
|
|
214
208
|
};
|
|
215
209
|
|
|
216
|
-
// src/search/i18n
|
|
210
|
+
// src/search/orama/create-i18n.ts
|
|
217
211
|
function defaultLocaleMap(locale) {
|
|
218
212
|
const map = STEMMERS;
|
|
219
213
|
return Object.keys(map).find((lang) => map[lang] === locale) ?? locale;
|
|
@@ -318,7 +312,7 @@ function initAdvancedSearch(options) {
|
|
|
318
312
|
async export() {
|
|
319
313
|
return {
|
|
320
314
|
type: "advanced",
|
|
321
|
-
...save(await get)
|
|
315
|
+
...await save(await get)
|
|
322
316
|
};
|
|
323
317
|
},
|
|
324
318
|
async search(query, searchOptions) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
searchAdvanced,
|
|
3
3
|
searchSimple
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-BO6MEAPT.js";
|
|
5
5
|
import "./chunk-2V6SCS43.js";
|
|
6
6
|
import "./chunk-MLKGABMK.js";
|
|
7
7
|
|
|
@@ -46,7 +46,10 @@ function createStaticClient({
|
|
|
46
46
|
const cached = dbs.get(locale ?? "");
|
|
47
47
|
if (!cached) return [];
|
|
48
48
|
if (cached.type === "simple")
|
|
49
|
-
return searchSimple(
|
|
49
|
+
return searchSimple(
|
|
50
|
+
cached,
|
|
51
|
+
query
|
|
52
|
+
);
|
|
50
53
|
return searchAdvanced(
|
|
51
54
|
cached.db,
|
|
52
55
|
query,
|