fumadocs-core 14.7.0 → 14.7.1
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 +1 -1
- package/dist/search/server.js +14 -5
- package/package.json +6 -1
package/dist/search/client.d.ts
CHANGED
|
@@ -54,4 +54,4 @@ type Client = ({
|
|
|
54
54
|
*/
|
|
55
55
|
declare function useDocsSearch(client: Client, locale?: string, tag?: string, delayMs?: number, allowEmpty?: boolean, key?: string): UseDocsSearch;
|
|
56
56
|
|
|
57
|
-
export { type AlgoliaOptions, type FetchOptions, type OramaCloudOptions, type StaticOptions, useDocsSearch };
|
|
57
|
+
export { type AlgoliaOptions, type Client, type FetchOptions, type OramaCloudOptions, type StaticOptions, useDocsSearch };
|
package/dist/search/server.js
CHANGED
|
@@ -208,9 +208,18 @@ var STEMMERS = {
|
|
|
208
208
|
};
|
|
209
209
|
|
|
210
210
|
// src/search/orama/create-i18n.ts
|
|
211
|
-
function
|
|
212
|
-
const
|
|
213
|
-
|
|
211
|
+
async function getTokenizer(locale) {
|
|
212
|
+
const mandarin = ["cn", "zh"];
|
|
213
|
+
const language = Object.keys(STEMMERS).find((lang) => STEMMERS[lang] === locale) ?? locale;
|
|
214
|
+
if (mandarin.some((code) => locale === code || locale.startsWith(`${code}-`))) {
|
|
215
|
+
const { createTokenizer } = await import("@orama/tokenizers/mandarin");
|
|
216
|
+
return {
|
|
217
|
+
tokenizer: await createTokenizer()
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
return {
|
|
221
|
+
language
|
|
222
|
+
};
|
|
214
223
|
}
|
|
215
224
|
async function initSimple(options) {
|
|
216
225
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -220,7 +229,7 @@ async function initSimple(options) {
|
|
|
220
229
|
const indexes = typeof options.indexes === "function" ? await options.indexes() : options.indexes;
|
|
221
230
|
for (const locale of options.i18n.languages) {
|
|
222
231
|
const localeIndexes = indexes.filter((index) => index.locale === locale);
|
|
223
|
-
const searchLocale = options.localeMap?.[locale] ??
|
|
232
|
+
const searchLocale = options.localeMap?.[locale] ?? await getTokenizer(locale);
|
|
224
233
|
map.set(
|
|
225
234
|
locale,
|
|
226
235
|
typeof searchLocale === "object" ? initSimpleSearch({
|
|
@@ -244,7 +253,7 @@ async function initAdvanced(options) {
|
|
|
244
253
|
const indexes = typeof options.indexes === "function" ? await options.indexes() : options.indexes;
|
|
245
254
|
for (const locale of options.i18n.languages) {
|
|
246
255
|
const localeIndexes = indexes.filter((index) => index.locale === locale);
|
|
247
|
-
const searchLocale = options.localeMap?.[locale] ??
|
|
256
|
+
const searchLocale = options.localeMap?.[locale] ?? await getTokenizer(locale);
|
|
248
257
|
map.set(
|
|
249
258
|
locale,
|
|
250
259
|
typeof searchLocale === "object" ? initAdvancedSearch({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-core",
|
|
3
|
-
"version": "14.7.
|
|
3
|
+
"version": "14.7.1",
|
|
4
4
|
"description": "The library for building a documentation website in Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -95,6 +95,7 @@
|
|
|
95
95
|
"devDependencies": {
|
|
96
96
|
"@algolia/client-search": "4.24.0",
|
|
97
97
|
"@mdx-js/mdx": "^3.1.0",
|
|
98
|
+
"@orama/tokenizers": "^2.1.1",
|
|
98
99
|
"@oramacloud/client": "^2.1.4",
|
|
99
100
|
"@types/estree-jsx": "^1.0.5",
|
|
100
101
|
"@types/hast": "^3.0.4",
|
|
@@ -117,6 +118,7 @@
|
|
|
117
118
|
"tsconfig": "0.0.0"
|
|
118
119
|
},
|
|
119
120
|
"peerDependencies": {
|
|
121
|
+
"@orama/tokenizers": "2.x.x",
|
|
120
122
|
"@oramacloud/client": "1.x.x || 2.x.x",
|
|
121
123
|
"algoliasearch": "4.24.0",
|
|
122
124
|
"next": "14.x.x || 15.x.x",
|
|
@@ -124,6 +126,9 @@
|
|
|
124
126
|
"react-dom": "18.x.x || 19.x.x"
|
|
125
127
|
},
|
|
126
128
|
"peerDependenciesMeta": {
|
|
129
|
+
"@orama/tokenizers": {
|
|
130
|
+
"optional": true
|
|
131
|
+
},
|
|
127
132
|
"@oramacloud/client": {
|
|
128
133
|
"optional": true
|
|
129
134
|
},
|