fumadocs-core 15.2.11 → 15.2.13
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/server.d.ts
CHANGED
|
@@ -43,10 +43,15 @@ type WithLocale<T> = T & {
|
|
|
43
43
|
};
|
|
44
44
|
declare function createI18nSearchAPI<T extends 'simple' | 'advanced'>(type: T, options: T extends 'simple' ? I18nSimpleOptions : I18nAdvancedOptions): SearchAPI;
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
interface Options<Page = unknown> extends Omit<AdvancedOptions, 'indexes'> {
|
|
47
47
|
localeMap?: LocaleMap<Partial<AdvancedOptions>>;
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
buildIndex?: (page: Page) => AdvancedIndex;
|
|
49
|
+
}
|
|
50
|
+
declare function createFromSource<S extends LoaderOutput<LoaderConfig>>(source: S, options?: Options<InferPageType<S>>): SearchAPI;
|
|
51
|
+
/**
|
|
52
|
+
* @deprecated Use `createFromSource(source, options)` instead.
|
|
53
|
+
*/
|
|
54
|
+
declare function createFromSource<S extends LoaderOutput<LoaderConfig>>(source: S, pageToIndexFn?: (page: InferPageType<S>) => AdvancedIndex, options?: Omit<Options, 'buildIndex'>): SearchAPI;
|
|
50
55
|
|
|
51
56
|
type SearchType = 'simple' | 'advanced';
|
|
52
57
|
type ExportedData = (RawData & {
|
package/dist/search/server.js
CHANGED
|
@@ -157,7 +157,13 @@ function pageToIndex(page) {
|
|
|
157
157
|
structuredData
|
|
158
158
|
};
|
|
159
159
|
}
|
|
160
|
-
function createFromSource(source,
|
|
160
|
+
function createFromSource(source, _buildIndexOrOptions = pageToIndex, _options) {
|
|
161
|
+
const options = {
|
|
162
|
+
...typeof _buildIndexOrOptions === "function" ? {
|
|
163
|
+
buildIndex: _buildIndexOrOptions
|
|
164
|
+
} : _buildIndexOrOptions,
|
|
165
|
+
..._options
|
|
166
|
+
};
|
|
161
167
|
if (source._i18n) {
|
|
162
168
|
return createI18nSearchAPI("advanced", {
|
|
163
169
|
...options,
|
|
@@ -165,7 +171,7 @@ function createFromSource(source, pageToIndexFn = pageToIndex, options = {}) {
|
|
|
165
171
|
indexes: source.getLanguages().flatMap((entry) => {
|
|
166
172
|
return entry.pages.map((page) => {
|
|
167
173
|
return {
|
|
168
|
-
...
|
|
174
|
+
...(options.buildIndex ?? pageToIndex)(page),
|
|
169
175
|
locale: entry.language
|
|
170
176
|
};
|
|
171
177
|
});
|
|
@@ -175,7 +181,7 @@ function createFromSource(source, pageToIndexFn = pageToIndex, options = {}) {
|
|
|
175
181
|
return createSearchAPI("advanced", {
|
|
176
182
|
...options,
|
|
177
183
|
indexes: source.getPages().map((page) => {
|
|
178
|
-
return
|
|
184
|
+
return (options.buildIndex ?? pageToIndex)(page);
|
|
179
185
|
})
|
|
180
186
|
});
|
|
181
187
|
}
|
package/dist/source/index.d.ts
CHANGED
|
@@ -10,11 +10,11 @@ interface FileInfo {
|
|
|
10
10
|
*/
|
|
11
11
|
flattenedPath: string;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* path of file (unparsed)
|
|
14
14
|
*/
|
|
15
15
|
path: string;
|
|
16
16
|
/**
|
|
17
|
-
* File name without
|
|
17
|
+
* File name without extension
|
|
18
18
|
*/
|
|
19
19
|
name: string;
|
|
20
20
|
/**
|
|
@@ -104,6 +104,9 @@ interface Source<Config extends SourceConfig> {
|
|
|
104
104
|
files: VirtualFile[] | (() => VirtualFile[]);
|
|
105
105
|
}
|
|
106
106
|
interface Page<Data = PageData> {
|
|
107
|
+
/**
|
|
108
|
+
* Virtualized file path
|
|
109
|
+
*/
|
|
107
110
|
file: FileInfo;
|
|
108
111
|
slugs: string[];
|
|
109
112
|
url: string;
|
|
@@ -111,6 +114,9 @@ interface Page<Data = PageData> {
|
|
|
111
114
|
locale?: string | undefined;
|
|
112
115
|
}
|
|
113
116
|
interface Meta<Data = MetaData> {
|
|
117
|
+
/**
|
|
118
|
+
* Virtualized file path
|
|
119
|
+
*/
|
|
114
120
|
file: FileInfo;
|
|
115
121
|
data: Data;
|
|
116
122
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-core",
|
|
3
|
-
"version": "15.2.
|
|
3
|
+
"version": "15.2.13",
|
|
4
4
|
"description": "The library for building a documentation website in Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -97,26 +97,26 @@
|
|
|
97
97
|
"@algolia/client-search": "4.24.0",
|
|
98
98
|
"@mdx-js/mdx": "^3.1.0",
|
|
99
99
|
"@oramacloud/client": "^2.1.4",
|
|
100
|
-
"@tanstack/react-router": "^1.
|
|
100
|
+
"@tanstack/react-router": "^1.119.0",
|
|
101
101
|
"@types/estree-jsx": "^1.0.5",
|
|
102
102
|
"@types/hast": "^3.0.4",
|
|
103
103
|
"@types/mdast": "^4.0.3",
|
|
104
104
|
"@types/negotiator": "^0.6.3",
|
|
105
|
-
"@types/node": "22.15.
|
|
105
|
+
"@types/node": "22.15.3",
|
|
106
106
|
"@types/react": "^19.1.2",
|
|
107
|
-
"@types/react-dom": "^19.1.
|
|
107
|
+
"@types/react-dom": "^19.1.3",
|
|
108
108
|
"algoliasearch": "4.24.0",
|
|
109
109
|
"mdast-util-mdx-jsx": "^3.2.0",
|
|
110
110
|
"mdast-util-mdxjs-esm": "^2.0.1",
|
|
111
111
|
"next": "^15.3.1",
|
|
112
|
-
"react-router": "^7.5.
|
|
112
|
+
"react-router": "^7.5.3",
|
|
113
113
|
"remark-mdx": "^3.1.0",
|
|
114
114
|
"remark-rehype": "^11.1.2",
|
|
115
115
|
"typescript": "^5.8.3",
|
|
116
116
|
"unified": "^11.0.5",
|
|
117
117
|
"vfile": "^6.0.3",
|
|
118
|
-
"
|
|
119
|
-
"
|
|
118
|
+
"eslint-config-custom": "0.0.0",
|
|
119
|
+
"tsconfig": "0.0.0"
|
|
120
120
|
},
|
|
121
121
|
"peerDependencies": {
|
|
122
122
|
"@oramacloud/client": "1.x.x || 2.x.x",
|