fumadocs-core 13.4.10 → 14.0.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-algolia/client.js → algolia-NTWLS6J3.js} +10 -27
- package/dist/breadcrumb.d.ts +15 -7
- package/dist/breadcrumb.js +47 -25
- package/dist/chunk-2V6SCS43.js +12 -0
- package/dist/chunk-2ZSMGYVH.js +78 -0
- package/dist/{chunk-UQV4A7HQ.js → chunk-4MNUWZIW.js} +9 -7
- package/dist/{chunk-KGMG4N3Y.js → chunk-I5BWASD6.js} +2 -2
- package/dist/dynamic-link.js +2 -1
- package/dist/fetch-4K7QOPFM.js +17 -0
- package/dist/i18n/index.js +64 -3
- package/dist/mdx-plugins/index.d.ts +20 -5
- package/dist/mdx-plugins/index.js +143 -17
- package/dist/{page-tree-BTCDMLTU.d.ts → page-tree-r8qjoUla.d.ts} +7 -4
- package/dist/{search-algolia/server.d.ts → search/algolia.d.ts} +1 -1
- package/dist/{search-algolia/server.js → search/algolia.js} +1 -1
- package/dist/search/client.d.ts +37 -7
- package/dist/search/client.js +74 -22
- package/dist/search/server.d.ts +65 -32
- package/dist/search/server.js +272 -234
- package/dist/server/index.d.ts +56 -4
- package/dist/server/index.js +59 -1
- package/dist/sidebar.js +7 -5
- package/dist/source/index.d.ts +14 -23
- package/dist/source/index.js +89 -81
- package/dist/static-5GPJ7RUY.js +60 -0
- package/dist/toc.js +1 -1
- package/dist/{search/shared.d.ts → types-Ch8gnVgO.d.ts} +1 -1
- package/dist/utils/use-on-change.d.ts +6 -1
- package/dist/utils/use-on-change.js +1 -1
- package/package.json +27 -86
- package/dist/chunk-MXOJWF66.js +0 -67
- package/dist/chunk-NREWOIVI.js +0 -19
- package/dist/middleware.d.ts +0 -3
- package/dist/middleware.js +0 -7
- package/dist/search/shared.js +0 -0
- package/dist/search-algolia/client.d.ts +0 -37
package/dist/chunk-MXOJWF66.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
// src/i18n/middleware.ts
|
|
2
|
-
import { match as matchLocale } from "@formatjs/intl-localematcher";
|
|
3
|
-
import Negotiator from "negotiator";
|
|
4
|
-
import { NextResponse } from "next/server";
|
|
5
|
-
var COOKIE = "FD_LOCALE";
|
|
6
|
-
function getLocale(request, locales, defaultLanguage) {
|
|
7
|
-
const negotiatorHeaders = {};
|
|
8
|
-
request.headers.forEach((value, key) => negotiatorHeaders[key] = value);
|
|
9
|
-
const languages = new Negotiator({ headers: negotiatorHeaders }).languages(
|
|
10
|
-
locales
|
|
11
|
-
);
|
|
12
|
-
return matchLocale(languages, locales, defaultLanguage);
|
|
13
|
-
}
|
|
14
|
-
var defaultFormat = (locale, path) => {
|
|
15
|
-
return `/${locale}/${path}`;
|
|
16
|
-
};
|
|
17
|
-
function createI18nMiddleware({
|
|
18
|
-
languages,
|
|
19
|
-
defaultLanguage,
|
|
20
|
-
format = defaultFormat,
|
|
21
|
-
hideLocale = "never"
|
|
22
|
-
}) {
|
|
23
|
-
function getUrl(request, pathname, locale) {
|
|
24
|
-
if (!locale) {
|
|
25
|
-
return new URL(
|
|
26
|
-
pathname.startsWith("/") ? pathname : `/${pathname}`,
|
|
27
|
-
request.url
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
return new URL(
|
|
31
|
-
format(locale, pathname.startsWith("/") ? pathname.slice(1) : pathname),
|
|
32
|
-
request.url
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
return (request) => {
|
|
36
|
-
const { pathname } = request.nextUrl;
|
|
37
|
-
const pathLocale = languages.find(
|
|
38
|
-
(locale) => pathname.startsWith(`/${locale}/`) || pathname === `/${locale}`
|
|
39
|
-
);
|
|
40
|
-
if (!pathLocale) {
|
|
41
|
-
if (hideLocale === "default-locale") {
|
|
42
|
-
return NextResponse.rewrite(getUrl(request, pathname, defaultLanguage));
|
|
43
|
-
}
|
|
44
|
-
const preferred = getLocale(request, languages, defaultLanguage);
|
|
45
|
-
if (hideLocale === "always") {
|
|
46
|
-
const locale = request.cookies.get(COOKIE)?.value ?? preferred;
|
|
47
|
-
return NextResponse.rewrite(getUrl(request, pathname, locale));
|
|
48
|
-
}
|
|
49
|
-
return NextResponse.redirect(getUrl(request, pathname, preferred));
|
|
50
|
-
}
|
|
51
|
-
if (hideLocale === "always") {
|
|
52
|
-
const path = pathname.slice(`/${pathLocale}`.length);
|
|
53
|
-
const res = NextResponse.redirect(getUrl(request, path));
|
|
54
|
-
res.cookies.set(COOKIE, pathLocale);
|
|
55
|
-
return res;
|
|
56
|
-
}
|
|
57
|
-
if (hideLocale === "default-locale" && pathLocale === defaultLanguage) {
|
|
58
|
-
const path = pathname.slice(`/${pathLocale}`.length);
|
|
59
|
-
return NextResponse.redirect(getUrl(request, path));
|
|
60
|
-
}
|
|
61
|
-
return NextResponse.next();
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export {
|
|
66
|
-
createI18nMiddleware
|
|
67
|
-
};
|
package/dist/chunk-NREWOIVI.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// src/utils/use-debounce.ts
|
|
2
|
-
import { useRef, useState } from "react";
|
|
3
|
-
function useDebounce(value, delayMs = 1e3) {
|
|
4
|
-
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
5
|
-
const timer = useRef();
|
|
6
|
-
if (delayMs === 0) return value;
|
|
7
|
-
if (value !== debouncedValue && timer.current?.value !== value) {
|
|
8
|
-
if (timer.current) clearTimeout(timer.current.handler);
|
|
9
|
-
const handler = window.setTimeout(() => {
|
|
10
|
-
setDebouncedValue(value);
|
|
11
|
-
}, delayMs);
|
|
12
|
-
timer.current = { value, handler };
|
|
13
|
-
}
|
|
14
|
-
return debouncedValue;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export {
|
|
18
|
-
useDebounce
|
|
19
|
-
};
|
package/dist/middleware.d.ts
DELETED
package/dist/middleware.js
DELETED
package/dist/search/shared.js
DELETED
|
File without changes
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { SearchOptions, Hit } from '@algolia/client-search';
|
|
2
|
-
import { SearchIndex } from 'algoliasearch/lite';
|
|
3
|
-
import { SWRResponse } from 'swr';
|
|
4
|
-
import { SortedResult } from '../search/shared.js';
|
|
5
|
-
import { BaseIndex } from './server.js';
|
|
6
|
-
import 'algoliasearch';
|
|
7
|
-
import '../remark-structure-mP51W1AN.js';
|
|
8
|
-
import 'mdast';
|
|
9
|
-
import 'unified';
|
|
10
|
-
import 'unist-util-visit';
|
|
11
|
-
|
|
12
|
-
interface Options extends SearchOptions {
|
|
13
|
-
/**
|
|
14
|
-
* Use `empty` as result if query is empty
|
|
15
|
-
*
|
|
16
|
-
* @defaultValue true
|
|
17
|
-
*/
|
|
18
|
-
allowEmpty?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Delay to debounce (in ms)
|
|
21
|
-
*
|
|
22
|
-
* @defaultValue 300
|
|
23
|
-
*/
|
|
24
|
-
delay?: number;
|
|
25
|
-
}
|
|
26
|
-
declare function groupResults(hits: Hit<BaseIndex>[]): SortedResult[];
|
|
27
|
-
declare function searchDocs(index: SearchIndex, query: string, options?: SearchOptions): Promise<SortedResult[]>;
|
|
28
|
-
interface UseAlgoliaSearch {
|
|
29
|
-
search: string;
|
|
30
|
-
setSearch: (v: string) => void;
|
|
31
|
-
query: SWRResponse<SortedResult[] | 'empty', Error, {
|
|
32
|
-
keepPreviousData: true;
|
|
33
|
-
}>;
|
|
34
|
-
}
|
|
35
|
-
declare function useAlgoliaSearch(index: SearchIndex, { allowEmpty, delay, ...options }?: Options): UseAlgoliaSearch;
|
|
36
|
-
|
|
37
|
-
export { type Options, groupResults, searchDocs, useAlgoliaSearch };
|