fumadocs-core 15.0.9 → 15.0.10
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/search/client.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { S as SortedResult } from '../types-Ch8gnVgO.js';
|
|
2
|
+
import { Orama } from '@orama/orama';
|
|
2
3
|
import { SearchOptions } from '@algolia/client-search';
|
|
3
4
|
import { SearchIndex } from 'algoliasearch/lite';
|
|
4
5
|
import { OramaClient, ClientSearchParams } from '@oramacloud/client';
|
|
@@ -15,6 +16,7 @@ interface StaticOptions {
|
|
|
15
16
|
* Where to download exported search indexes (URL)
|
|
16
17
|
*/
|
|
17
18
|
from?: string;
|
|
19
|
+
initOrama?: (locale?: string) => Promise<Orama<unknown, never, never, never>>;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
interface AlgoliaOptions extends SearchOptions {
|
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-HAZVD2ZO.js");
|
|
68
68
|
return searchDocs(debouncedValue, tag, client);
|
|
69
69
|
}
|
|
70
|
-
const { createStaticClient } = await import("../static-
|
|
70
|
+
const { createStaticClient } = await import("../static-R3CYGT5R.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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TypedDocument, Orama, Language, create, SearchParams } from '@orama/orama';
|
|
1
|
+
import { TypedDocument, Orama, Language, RawData, create, SearchParams } from '@orama/orama';
|
|
2
2
|
import { NextRequest } from 'next/server';
|
|
3
3
|
import { S as StructuredData } from '../remark-structure-mP51W1AN.js';
|
|
4
4
|
import { S as SortedResult } from '../types-Ch8gnVgO.js';
|
|
@@ -49,6 +49,15 @@ type Options = Omit<AdvancedOptions, 'language' | 'indexes'> & {
|
|
|
49
49
|
};
|
|
50
50
|
declare function createFromSource<S extends LoaderOutput<LoaderConfig>>(source: S, pageToIndexFn?: (page: InferPageType<S>) => AdvancedIndex, options?: Options): SearchAPI;
|
|
51
51
|
|
|
52
|
+
type SearchType = 'simple' | 'advanced';
|
|
53
|
+
type ExportedData = (RawData & {
|
|
54
|
+
type: SearchType;
|
|
55
|
+
}) | {
|
|
56
|
+
type: 'i18n';
|
|
57
|
+
data: Record<string, RawData & {
|
|
58
|
+
type: SearchType;
|
|
59
|
+
}>;
|
|
60
|
+
};
|
|
52
61
|
interface SearchServer {
|
|
53
62
|
search: (query: string, options?: {
|
|
54
63
|
locale?: string;
|
|
@@ -59,7 +68,7 @@ interface SearchServer {
|
|
|
59
68
|
*
|
|
60
69
|
* You can reference the exported database to implement client-side search
|
|
61
70
|
*/
|
|
62
|
-
export: () => Promise<
|
|
71
|
+
export: () => Promise<ExportedData>;
|
|
63
72
|
}
|
|
64
73
|
interface SearchAPI extends SearchServer {
|
|
65
74
|
GET: (request: NextRequest) => Promise<Response>;
|
|
@@ -91,7 +100,7 @@ interface AdvancedOptions extends SharedOptions {
|
|
|
91
100
|
*/
|
|
92
101
|
search?: Partial<SearchParams<Orama<typeof advancedSchema>, AdvancedDocument>>;
|
|
93
102
|
}
|
|
94
|
-
declare function createSearchAPI<T extends
|
|
103
|
+
declare function createSearchAPI<T extends SearchType>(type: T, options: T extends 'simple' ? SimpleOptions : AdvancedOptions): SearchAPI;
|
|
95
104
|
interface Index {
|
|
96
105
|
title: string;
|
|
97
106
|
description?: string;
|
|
@@ -117,4 +126,4 @@ interface AdvancedIndex {
|
|
|
117
126
|
}
|
|
118
127
|
declare function initAdvancedSearch(options: AdvancedOptions): SearchServer;
|
|
119
128
|
|
|
120
|
-
export { type AdvancedIndex, type AdvancedOptions, type Dynamic, type Index, type SearchAPI, type SearchServer, type SimpleOptions, createFromSource, createI18nSearchAPI, createSearchAPI, initAdvancedSearch, initSimpleSearch };
|
|
129
|
+
export { type AdvancedIndex, type AdvancedOptions, type Dynamic, type ExportedData, type Index, type SearchAPI, type SearchServer, type SimpleOptions, createFromSource, createI18nSearchAPI, createSearchAPI, initAdvancedSearch, initSimpleSearch };
|
package/dist/search/server.js
CHANGED
|
@@ -6,7 +6,9 @@ import "../chunk-DELA6Z2I.js";
|
|
|
6
6
|
import "../chunk-MLKGABMK.js";
|
|
7
7
|
|
|
8
8
|
// src/search/server.ts
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
save
|
|
11
|
+
} from "@orama/orama";
|
|
10
12
|
|
|
11
13
|
// src/search/orama/create-endpoint.ts
|
|
12
14
|
function createEndpoint(server) {
|
|
@@ -299,7 +301,7 @@ function initSimpleSearch(options) {
|
|
|
299
301
|
async export() {
|
|
300
302
|
return {
|
|
301
303
|
type: "simple",
|
|
302
|
-
...save(await doc)
|
|
304
|
+
...await save(await doc)
|
|
303
305
|
};
|
|
304
306
|
},
|
|
305
307
|
async search(query) {
|
|
@@ -6,12 +6,10 @@ import "./chunk-DELA6Z2I.js";
|
|
|
6
6
|
import "./chunk-MLKGABMK.js";
|
|
7
7
|
|
|
8
8
|
// src/search/client/static.ts
|
|
9
|
-
import {
|
|
10
|
-
create,
|
|
11
|
-
load
|
|
12
|
-
} from "@orama/orama";
|
|
9
|
+
import { create, load } from "@orama/orama";
|
|
13
10
|
function createStaticClient({
|
|
14
|
-
from = "/api/search"
|
|
11
|
+
from = "/api/search",
|
|
12
|
+
initOrama = (locale) => create({ schema: { _: "string" }, language: locale })
|
|
15
13
|
}) {
|
|
16
14
|
const dbs = /* @__PURE__ */ new Map();
|
|
17
15
|
async function init() {
|
|
@@ -23,7 +21,7 @@ function createStaticClient({
|
|
|
23
21
|
const data = await res.json();
|
|
24
22
|
if (data.type === "i18n") {
|
|
25
23
|
for (const [k, v] of Object.entries(data.data)) {
|
|
26
|
-
const db = await
|
|
24
|
+
const db = await initOrama(k);
|
|
27
25
|
await load(db, v);
|
|
28
26
|
dbs.set(k, {
|
|
29
27
|
type: v.type,
|
|
@@ -31,7 +29,7 @@ function createStaticClient({
|
|
|
31
29
|
});
|
|
32
30
|
}
|
|
33
31
|
} else {
|
|
34
|
-
const db = await
|
|
32
|
+
const db = await initOrama();
|
|
35
33
|
await load(db, data);
|
|
36
34
|
dbs.set("", {
|
|
37
35
|
type: data.type,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-core",
|
|
3
|
-
"version": "15.0.
|
|
3
|
+
"version": "15.0.10",
|
|
4
4
|
"description": "The library for building a documentation website in Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
"dependencies": {
|
|
84
84
|
"@formatjs/intl-localematcher": "^0.6.0",
|
|
85
85
|
"@orama/orama": "^2.1.1",
|
|
86
|
-
"@shikijs/rehype": "^
|
|
87
|
-
"@shikijs/transformers": "^
|
|
86
|
+
"@shikijs/rehype": "^3.0.0",
|
|
87
|
+
"@shikijs/transformers": "^3.0.0",
|
|
88
88
|
"github-slugger": "^2.0.0",
|
|
89
89
|
"hast-util-to-estree": "^3.1.1",
|
|
90
90
|
"hast-util-to-jsx-runtime": "^2.3.2",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"remark": "^15.0.0",
|
|
95
95
|
"remark-gfm": "^4.0.1",
|
|
96
96
|
"scroll-into-view-if-needed": "^3.1.0",
|
|
97
|
-
"shiki": "^
|
|
97
|
+
"shiki": "^3.0.0",
|
|
98
98
|
"unist-util-visit": "^5.0.0"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
@@ -107,8 +107,8 @@
|
|
|
107
107
|
"@types/mdast": "^4.0.3",
|
|
108
108
|
"@types/negotiator": "^0.6.3",
|
|
109
109
|
"@types/node": "22.13.4",
|
|
110
|
-
"@types/react": "^19.0.
|
|
111
|
-
"@types/react-dom": "^19.0.
|
|
110
|
+
"@types/react": "^19.0.10",
|
|
111
|
+
"@types/react-dom": "^19.0.4",
|
|
112
112
|
"algoliasearch": "4.24.0",
|
|
113
113
|
"mdast-util-mdx-jsx": "^3.2.0",
|
|
114
114
|
"mdast-util-mdxjs-esm": "^2.0.1",
|
|
@@ -118,8 +118,8 @@
|
|
|
118
118
|
"typescript": "^5.7.3",
|
|
119
119
|
"unified": "^11.0.5",
|
|
120
120
|
"vfile": "^6.0.3",
|
|
121
|
-
"
|
|
122
|
-
"
|
|
121
|
+
"tsconfig": "0.0.0",
|
|
122
|
+
"eslint-config-custom": "0.0.0"
|
|
123
123
|
},
|
|
124
124
|
"peerDependencies": {
|
|
125
125
|
"@orama/tokenizers": "2.x.x",
|