fumadocs-core 16.2.2 → 16.2.4
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/breadcrumb.d.ts +1 -1
- package/dist/{chunk-YDNO7UZ6.js → chunk-5PMI7QDD.js} +54 -50
- package/dist/{chunk-SLIKY7GW.js → chunk-JUF4WZ6G.js} +11 -5
- package/dist/{chunk-HNZEUF6C.js → chunk-MA6O2UUE.js} +1 -1
- package/dist/{chunk-A4G5V4FQ.js → chunk-VLSDGCJE.js} +1 -1
- package/dist/{chunk-JOXPHQ2R.js → chunk-W6WTLKRA.js} +1 -1
- package/dist/content/toc.js +2 -2
- package/dist/{definitions-DbCug1P3.d.ts → definitions-pJ7PybYY.d.ts} +6 -5
- package/dist/i18n/middleware.d.ts +27 -5
- package/dist/i18n/middleware.js +44 -31
- package/dist/{loader-Dz9yZIJQ.d.ts → loader-qkSHi822.d.ts} +2 -1
- package/dist/mdx-plugins/index.d.ts +1 -1
- package/dist/mdx-plugins/index.js +7 -5
- package/dist/mdx-plugins/remark-admonition.js +2 -2
- package/dist/mdx-plugins/remark-heading.js +2 -2
- package/dist/mdx-plugins/remark-image.js +1 -1
- package/dist/mdx-plugins/remark-structure.d.ts +9 -2
- package/dist/mdx-plugins/remark-structure.js +4 -2
- package/dist/page-tree/index.d.ts +2 -2
- package/dist/search/client.d.ts +3 -3
- package/dist/search/client.js +9 -8
- package/dist/search/server.d.ts +2 -2
- package/dist/source/client/index.d.ts +1 -1
- package/dist/source/index.d.ts +2 -2
- package/dist/source/index.js +16 -18
- package/dist/source/plugins/lucide-icons.d.ts +2 -2
- package/dist/source/schema.d.ts +26 -0
- package/dist/source/schema.js +25 -0
- package/package.json +24 -15
package/dist/breadcrumb.d.ts
CHANGED
|
@@ -15,6 +15,20 @@ function remarkImage({
|
|
|
15
15
|
const importsToInject = [];
|
|
16
16
|
const promises = [];
|
|
17
17
|
async function onImage(src, node) {
|
|
18
|
+
const attributes = [
|
|
19
|
+
{
|
|
20
|
+
type: "mdxJsxAttribute",
|
|
21
|
+
name: "alt",
|
|
22
|
+
value: node.alt ?? "image"
|
|
23
|
+
}
|
|
24
|
+
];
|
|
25
|
+
if (node.title) {
|
|
26
|
+
attributes.push({
|
|
27
|
+
type: "mdxJsxAttribute",
|
|
28
|
+
name: "title",
|
|
29
|
+
value: node.title
|
|
30
|
+
});
|
|
31
|
+
}
|
|
18
32
|
if (src.type === "file" && useImport) {
|
|
19
33
|
const variableName = `__img${importsToInject.length}`;
|
|
20
34
|
const hasBlur = placeholder === "blur" && VALID_BLUR_EXT.some((ext) => src.file.endsWith(ext));
|
|
@@ -27,37 +41,31 @@ function remarkImage({
|
|
|
27
41
|
variableName,
|
|
28
42
|
importPath: getImportPath(src.file, file.dirname)
|
|
29
43
|
});
|
|
44
|
+
attributes.push({
|
|
45
|
+
type: "mdxJsxAttribute",
|
|
46
|
+
name: "src",
|
|
47
|
+
value: {
|
|
48
|
+
type: "mdxJsxAttributeValueExpression",
|
|
49
|
+
value: variableName,
|
|
50
|
+
data: {
|
|
51
|
+
estree: {
|
|
52
|
+
body: [
|
|
53
|
+
{
|
|
54
|
+
type: "ExpressionStatement",
|
|
55
|
+
expression: { type: "Identifier", name: variableName }
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
type: "Program",
|
|
59
|
+
sourceType: "script"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
});
|
|
30
64
|
const out = {
|
|
31
65
|
children: [],
|
|
32
66
|
type: "mdxJsxFlowElement",
|
|
33
67
|
name: "img",
|
|
34
|
-
attributes
|
|
35
|
-
{
|
|
36
|
-
type: "mdxJsxAttribute",
|
|
37
|
-
name: "alt",
|
|
38
|
-
value: node.alt ?? "image"
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
type: "mdxJsxAttribute",
|
|
42
|
-
name: "src",
|
|
43
|
-
value: {
|
|
44
|
-
type: "mdxJsxAttributeValueExpression",
|
|
45
|
-
value: variableName,
|
|
46
|
-
data: {
|
|
47
|
-
estree: {
|
|
48
|
-
body: [
|
|
49
|
-
{
|
|
50
|
-
type: "ExpressionStatement",
|
|
51
|
-
expression: { type: "Identifier", name: variableName }
|
|
52
|
-
}
|
|
53
|
-
],
|
|
54
|
-
type: "Program",
|
|
55
|
-
sourceType: "script"
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
]
|
|
68
|
+
attributes
|
|
61
69
|
};
|
|
62
70
|
if (hasBlur) {
|
|
63
71
|
out.attributes.push({
|
|
@@ -77,32 +85,28 @@ function remarkImage({
|
|
|
77
85
|
);
|
|
78
86
|
});
|
|
79
87
|
if (!size) return;
|
|
88
|
+
attributes.push(
|
|
89
|
+
{
|
|
90
|
+
type: "mdxJsxAttribute",
|
|
91
|
+
name: "src",
|
|
92
|
+
// `src` doesn't support file paths, we can use `node.url` for files and let the underlying framework handle it
|
|
93
|
+
value: src.type === "url" ? src.url.toString() : node.url
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
type: "mdxJsxAttribute",
|
|
97
|
+
name: "width",
|
|
98
|
+
value: size.width.toString()
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
type: "mdxJsxAttribute",
|
|
102
|
+
name: "height",
|
|
103
|
+
value: size.height.toString()
|
|
104
|
+
}
|
|
105
|
+
);
|
|
80
106
|
return {
|
|
81
107
|
type: "mdxJsxFlowElement",
|
|
82
108
|
name: "img",
|
|
83
|
-
attributes
|
|
84
|
-
{
|
|
85
|
-
type: "mdxJsxAttribute",
|
|
86
|
-
name: "alt",
|
|
87
|
-
value: node.alt ?? "image"
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
type: "mdxJsxAttribute",
|
|
91
|
-
name: "src",
|
|
92
|
-
// `src` doesn't support file paths, we can use `node.url` for files and let the underlying framework handle it
|
|
93
|
-
value: src.type === "url" ? src.url.toString() : node.url
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
type: "mdxJsxAttribute",
|
|
97
|
-
name: "width",
|
|
98
|
-
value: size.width.toString()
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
type: "mdxJsxAttribute",
|
|
102
|
-
name: "height",
|
|
103
|
-
value: size.height.toString()
|
|
104
|
-
}
|
|
105
|
-
],
|
|
109
|
+
attributes,
|
|
106
110
|
children: []
|
|
107
111
|
};
|
|
108
112
|
}
|
|
@@ -1,26 +1,31 @@
|
|
|
1
1
|
import {
|
|
2
2
|
flattenNode,
|
|
3
3
|
toMdxExport
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-VLSDGCJE.js";
|
|
5
5
|
|
|
6
6
|
// src/mdx-plugins/remark-structure.ts
|
|
7
7
|
import Slugger from "github-slugger";
|
|
8
8
|
import { remark } from "remark";
|
|
9
9
|
import remarkGfm from "remark-gfm";
|
|
10
10
|
import { visit } from "unist-util-visit";
|
|
11
|
-
|
|
12
|
-
types
|
|
11
|
+
var remarkStructureDefaultOptions = {
|
|
12
|
+
types: [
|
|
13
13
|
"heading",
|
|
14
14
|
"paragraph",
|
|
15
15
|
"blockquote",
|
|
16
16
|
"tableCell",
|
|
17
17
|
"mdxJsxFlowElement"
|
|
18
18
|
],
|
|
19
|
-
allowedMdxAttributes
|
|
19
|
+
allowedMdxAttributes: (node) => {
|
|
20
20
|
if (!node.name) return false;
|
|
21
21
|
return ["TypeTable", "Callout"].includes(node.name);
|
|
22
22
|
},
|
|
23
|
-
exportAs
|
|
23
|
+
exportAs: false
|
|
24
|
+
};
|
|
25
|
+
function remarkStructure({
|
|
26
|
+
types = remarkStructureDefaultOptions.types,
|
|
27
|
+
allowedMdxAttributes = remarkStructureDefaultOptions.allowedMdxAttributes,
|
|
28
|
+
exportAs = remarkStructureDefaultOptions.exportAs
|
|
24
29
|
} = {}) {
|
|
25
30
|
const slugger = new Slugger();
|
|
26
31
|
if (Array.isArray(allowedMdxAttributes)) {
|
|
@@ -106,6 +111,7 @@ function structure(content, remarkPlugins = [], options = {}) {
|
|
|
106
111
|
}
|
|
107
112
|
|
|
108
113
|
export {
|
|
114
|
+
remarkStructureDefaultOptions,
|
|
109
115
|
remarkStructure,
|
|
110
116
|
structure
|
|
111
117
|
};
|
|
@@ -3,7 +3,7 @@ import { valueToEstree } from "estree-util-value-to-estree";
|
|
|
3
3
|
function flattenNode(node) {
|
|
4
4
|
if ("children" in node)
|
|
5
5
|
return node.children.map((child) => flattenNode(child)).join("");
|
|
6
|
-
if ("value" in node) return node.value;
|
|
6
|
+
if ("value" in node && typeof node.value === "string") return node.value;
|
|
7
7
|
return "";
|
|
8
8
|
}
|
|
9
9
|
function toMdxExport(name, value) {
|
package/dist/content/toc.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
|
|
3
|
-
interface
|
|
3
|
+
interface ID {
|
|
4
4
|
/**
|
|
5
5
|
* ID for the node, unique in all page trees (even across different locales)
|
|
6
6
|
*/
|
|
7
7
|
$id?: string;
|
|
8
8
|
}
|
|
9
|
-
interface Root extends
|
|
9
|
+
interface Root extends ID {
|
|
10
10
|
name: ReactNode;
|
|
11
11
|
children: Node[];
|
|
12
12
|
/**
|
|
@@ -15,7 +15,7 @@ interface Root extends INode {
|
|
|
15
15
|
fallback?: Root;
|
|
16
16
|
}
|
|
17
17
|
type Node = Item | Separator | Folder;
|
|
18
|
-
interface Item extends
|
|
18
|
+
interface Item extends ID {
|
|
19
19
|
/**
|
|
20
20
|
* @internal
|
|
21
21
|
*/
|
|
@@ -34,12 +34,12 @@ interface Item extends INode {
|
|
|
34
34
|
description?: ReactNode;
|
|
35
35
|
icon?: ReactNode;
|
|
36
36
|
}
|
|
37
|
-
interface Separator extends
|
|
37
|
+
interface Separator extends ID {
|
|
38
38
|
type: 'separator';
|
|
39
39
|
name?: ReactNode;
|
|
40
40
|
icon?: ReactNode;
|
|
41
41
|
}
|
|
42
|
-
interface Folder extends
|
|
42
|
+
interface Folder extends ID {
|
|
43
43
|
/**
|
|
44
44
|
* @internal
|
|
45
45
|
*/
|
|
@@ -51,6 +51,7 @@ interface Folder extends INode {
|
|
|
51
51
|
description?: ReactNode;
|
|
52
52
|
root?: boolean;
|
|
53
53
|
defaultOpen?: boolean;
|
|
54
|
+
collapsible?: boolean;
|
|
54
55
|
index?: Item;
|
|
55
56
|
icon?: ReactNode;
|
|
56
57
|
children: Node[];
|
|
@@ -1,12 +1,34 @@
|
|
|
1
|
-
import { NextProxy } from 'next/
|
|
1
|
+
import { NextProxy } from 'next/server';
|
|
2
2
|
import { I18nConfig } from './index.js';
|
|
3
|
+
import { NextURL } from 'next/dist/server/web/next-url';
|
|
3
4
|
|
|
4
5
|
interface MiddlewareOptions extends I18nConfig {
|
|
5
6
|
/**
|
|
6
|
-
*
|
|
7
|
+
* Either:
|
|
8
|
+
* - A formatter object
|
|
9
|
+
* - A function that adds the locale prefix to pathname
|
|
7
10
|
*/
|
|
8
|
-
format?: (locale: string,
|
|
11
|
+
format?: URLFormatter | ((locale: string, pathname: string) => string);
|
|
12
|
+
/**
|
|
13
|
+
* the cookie to store locale code when `hideLocale` is set to `always`.
|
|
14
|
+
*/
|
|
15
|
+
cookieName?: string;
|
|
16
|
+
}
|
|
17
|
+
interface URLFormatter {
|
|
18
|
+
/**
|
|
19
|
+
* get locale code from request URL
|
|
20
|
+
*/
|
|
21
|
+
get: (url: NextURL) => string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* add locale code to request URL (which is missing the locale).
|
|
24
|
+
*/
|
|
25
|
+
add: (url: NextURL, locale: string) => URL;
|
|
26
|
+
/**
|
|
27
|
+
* remove locale code from request URL
|
|
28
|
+
*/
|
|
29
|
+
remove: (url: NextURL) => URL;
|
|
9
30
|
}
|
|
10
|
-
declare
|
|
31
|
+
declare const DefaultFormatter: URLFormatter;
|
|
32
|
+
declare function createI18nMiddleware({ languages, defaultLanguage, format, cookieName, hideLocale, }: MiddlewareOptions): NextProxy;
|
|
11
33
|
|
|
12
|
-
export { createI18nMiddleware };
|
|
34
|
+
export { DefaultFormatter, type URLFormatter, createI18nMiddleware };
|
package/dist/i18n/middleware.js
CHANGED
|
@@ -6,58 +6,71 @@ import "../chunk-U67V476Y.js";
|
|
|
6
6
|
// src/i18n/middleware.ts
|
|
7
7
|
import { match as matchLocale } from "@formatjs/intl-localematcher";
|
|
8
8
|
import { NextResponse } from "next/server";
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
var DefaultFormatter = {
|
|
10
|
+
get(url) {
|
|
11
|
+
const segs = url.pathname.split("/");
|
|
12
|
+
if (segs.length > 1 && segs[1]) return segs[1];
|
|
13
|
+
},
|
|
14
|
+
add(url, locale) {
|
|
15
|
+
const next = new URL(url);
|
|
16
|
+
next.pathname = `${url.basePath}/${locale}/${url.pathname}`.replaceAll(
|
|
17
|
+
/\/+/g,
|
|
18
|
+
"/"
|
|
19
|
+
);
|
|
20
|
+
return next;
|
|
21
|
+
},
|
|
22
|
+
remove(url) {
|
|
23
|
+
const next = new URL(url);
|
|
24
|
+
const pathname = url.pathname.split("/").slice(2).join("/");
|
|
25
|
+
next.pathname = `${url.basePath}/${pathname}`.replaceAll(/\/+/g, "/");
|
|
26
|
+
return next;
|
|
27
|
+
}
|
|
16
28
|
};
|
|
17
29
|
function createI18nMiddleware({
|
|
18
30
|
languages,
|
|
19
31
|
defaultLanguage,
|
|
20
|
-
format =
|
|
32
|
+
format = DefaultFormatter,
|
|
33
|
+
cookieName = "FD_LOCALE",
|
|
21
34
|
hideLocale = "never"
|
|
22
35
|
}) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
36
|
+
let formatter;
|
|
37
|
+
if (typeof format === "function") {
|
|
38
|
+
formatter = {
|
|
39
|
+
...DefaultFormatter,
|
|
40
|
+
add(url, locale) {
|
|
41
|
+
const next = new URL(url);
|
|
42
|
+
next.pathname = format(locale, url.pathname);
|
|
43
|
+
return next;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
} else {
|
|
47
|
+
formatter = format;
|
|
27
48
|
}
|
|
28
49
|
return (request) => {
|
|
29
50
|
const url = request.nextUrl;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
);
|
|
51
|
+
let pathLocale = formatter.get(url);
|
|
52
|
+
if (pathLocale && !languages.includes(pathLocale)) pathLocale = void 0;
|
|
33
53
|
if (!pathLocale) {
|
|
34
54
|
if (hideLocale === "default-locale") {
|
|
35
|
-
return NextResponse.rewrite(
|
|
55
|
+
return NextResponse.rewrite(formatter.add(url, defaultLanguage));
|
|
36
56
|
}
|
|
37
|
-
const
|
|
57
|
+
const finalLanguages = getNegotiator(request).languages(languages);
|
|
58
|
+
const preferred = matchLocale(finalLanguages, languages, defaultLanguage);
|
|
38
59
|
if (hideLocale === "always") {
|
|
39
|
-
const locale = request.cookies.get(
|
|
40
|
-
return NextResponse.rewrite(
|
|
60
|
+
const locale = request.cookies.get(cookieName)?.value ?? preferred;
|
|
61
|
+
return NextResponse.rewrite(formatter.add(url, locale));
|
|
41
62
|
}
|
|
42
|
-
return NextResponse.redirect(
|
|
63
|
+
return NextResponse.redirect(formatter.add(url, preferred));
|
|
43
64
|
}
|
|
44
65
|
if (hideLocale === "always" || hideLocale === "default-locale" && pathLocale === defaultLanguage) {
|
|
45
|
-
const res = NextResponse.redirect(
|
|
46
|
-
|
|
47
|
-
forceSlashPrefix(url.pathname.slice(`/${pathLocale}`.length)),
|
|
48
|
-
request.url
|
|
49
|
-
)
|
|
50
|
-
);
|
|
51
|
-
res.cookies.set(COOKIE, pathLocale);
|
|
66
|
+
const res = NextResponse.redirect(formatter.remove(url));
|
|
67
|
+
res.cookies.set(cookieName, pathLocale);
|
|
52
68
|
return res;
|
|
53
69
|
}
|
|
54
70
|
return NextResponse.next();
|
|
55
71
|
};
|
|
56
72
|
}
|
|
57
|
-
function forceSlashPrefix(v) {
|
|
58
|
-
if (v.startsWith("/")) return v;
|
|
59
|
-
return "/" + v;
|
|
60
|
-
}
|
|
61
73
|
export {
|
|
74
|
+
DefaultFormatter,
|
|
62
75
|
createI18nMiddleware
|
|
63
76
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as Root, I as Item, F as Folder, S as Separator } from './definitions-
|
|
1
|
+
import { R as Root, I as Item, F as Folder, S as Separator } from './definitions-pJ7PybYY.js';
|
|
2
2
|
import { I18nConfig } from './i18n/index.js';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
4
|
|
|
@@ -15,6 +15,7 @@ interface MetaData {
|
|
|
15
15
|
root?: boolean | undefined;
|
|
16
16
|
pages?: string[] | undefined;
|
|
17
17
|
defaultOpen?: boolean | undefined;
|
|
18
|
+
collapsible?: boolean | undefined;
|
|
18
19
|
description?: string | undefined;
|
|
19
20
|
}
|
|
20
21
|
interface PageData {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { Options as RemarkGfmOptions, default as remarkGfm } from 'remark-gfm';
|
|
2
2
|
export { CodeBlockIcon, RehypeCodeOptions, rehypeCode, rehypeCodeDefaultOptions, transformerIcon, transformerTab } from './rehype-code.js';
|
|
3
3
|
export { RemarkImageOptions, remarkImage } from './remark-image.js';
|
|
4
|
-
export { StructureOptions, StructuredData, remarkStructure, structure } from './remark-structure.js';
|
|
4
|
+
export { StructureOptions, StructuredData, remarkStructure, remarkStructureDefaultOptions, structure } from './remark-structure.js';
|
|
5
5
|
export { RemarkHeadingOptions, remarkHeading } from './remark-heading.js';
|
|
6
6
|
export { RemarkAdmonitionOptions, remarkAdmonition } from './remark-admonition.js';
|
|
7
7
|
export { RemarkDirectiveAdmonitionOptions, remarkDirectiveAdmonition } from './remark-directive-admonition.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
remarkImage
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-5PMI7QDD.js";
|
|
4
4
|
import {
|
|
5
5
|
remarkMdxFiles
|
|
6
6
|
} from "../chunk-ADBHPKXG.js";
|
|
@@ -15,8 +15,9 @@ import {
|
|
|
15
15
|
} from "../chunk-XJ6ZQNEX.js";
|
|
16
16
|
import {
|
|
17
17
|
remarkStructure,
|
|
18
|
+
remarkStructureDefaultOptions,
|
|
18
19
|
structure
|
|
19
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-JUF4WZ6G.js";
|
|
20
21
|
import {
|
|
21
22
|
rehypeCode,
|
|
22
23
|
rehypeCodeDefaultOptions,
|
|
@@ -28,7 +29,7 @@ import {
|
|
|
28
29
|
} from "../chunk-EFVXL2PP.js";
|
|
29
30
|
import {
|
|
30
31
|
remarkAdmonition
|
|
31
|
-
} from "../chunk-
|
|
32
|
+
} from "../chunk-W6WTLKRA.js";
|
|
32
33
|
import {
|
|
33
34
|
remarkCodeTab
|
|
34
35
|
} from "../chunk-CH7YHH7V.js";
|
|
@@ -45,8 +46,8 @@ import {
|
|
|
45
46
|
import "../chunk-XN2LKXFZ.js";
|
|
46
47
|
import {
|
|
47
48
|
remarkHeading
|
|
48
|
-
} from "../chunk-
|
|
49
|
-
import "../chunk-
|
|
49
|
+
} from "../chunk-MA6O2UUE.js";
|
|
50
|
+
import "../chunk-VLSDGCJE.js";
|
|
50
51
|
import "../chunk-U67V476Y.js";
|
|
51
52
|
export {
|
|
52
53
|
generateCodeBlockTabs,
|
|
@@ -65,6 +66,7 @@ export {
|
|
|
65
66
|
remarkNpm,
|
|
66
67
|
remarkSteps,
|
|
67
68
|
remarkStructure,
|
|
69
|
+
remarkStructureDefaultOptions,
|
|
68
70
|
structure,
|
|
69
71
|
transformerIcon,
|
|
70
72
|
transformerTab
|
|
@@ -52,8 +52,15 @@ declare module 'vfile' {
|
|
|
52
52
|
structuredData: StructuredData;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
+
declare const remarkStructureDefaultOptions: {
|
|
56
|
+
types: string[];
|
|
57
|
+
allowedMdxAttributes: (node: MdxJsxFlowElement) => boolean;
|
|
58
|
+
exportAs: false;
|
|
59
|
+
};
|
|
55
60
|
/**
|
|
56
|
-
*
|
|
61
|
+
* Extract content into structured data.
|
|
62
|
+
*
|
|
63
|
+
* By default, the output is stored into VFile (`vfile.data.structuredData`), you can specify `exportAs` to export it.
|
|
57
64
|
*/
|
|
58
65
|
declare function remarkStructure({ types, allowedMdxAttributes, exportAs, }?: StructureOptions): Transformer<Root, Root>;
|
|
59
66
|
/**
|
|
@@ -61,4 +68,4 @@ declare function remarkStructure({ types, allowedMdxAttributes, exportAs, }?: St
|
|
|
61
68
|
*/
|
|
62
69
|
declare function structure(content: string, remarkPlugins?: PluggableList, options?: StructureOptions): StructuredData;
|
|
63
70
|
|
|
64
|
-
export { type StructureOptions, type StructuredData, remarkStructure, structure };
|
|
71
|
+
export { type StructureOptions, type StructuredData, remarkStructure, remarkStructureDefaultOptions, structure };
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
remarkStructure,
|
|
3
|
+
remarkStructureDefaultOptions,
|
|
3
4
|
structure
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-JUF4WZ6G.js";
|
|
6
|
+
import "../chunk-VLSDGCJE.js";
|
|
6
7
|
import "../chunk-U67V476Y.js";
|
|
7
8
|
export {
|
|
8
9
|
remarkStructure,
|
|
10
|
+
remarkStructureDefaultOptions,
|
|
9
11
|
structure
|
|
10
12
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as Node, I as Item, R as Root, F as Folder } from '../definitions-
|
|
2
|
-
export { S as Separator } from '../definitions-
|
|
1
|
+
import { N as Node, I as Item, R as Root, F as Folder } from '../definitions-pJ7PybYY.js';
|
|
2
|
+
export { S as Separator } from '../definitions-pJ7PybYY.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/search/client.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DependencyList } from 'react';
|
|
1
2
|
import { AnyOrama } from '@orama/orama';
|
|
2
3
|
import '../mdx-plugins/remark-structure.js';
|
|
3
4
|
import { BaseIndex } from './algolia.js';
|
|
@@ -9,7 +10,6 @@ import 'mdast';
|
|
|
9
10
|
import 'unified';
|
|
10
11
|
import 'mdast-util-mdx-jsx';
|
|
11
12
|
import 'algoliasearch';
|
|
12
|
-
import 'react';
|
|
13
13
|
|
|
14
14
|
interface FetchOptions {
|
|
15
15
|
/**
|
|
@@ -120,7 +120,7 @@ type Client = ({
|
|
|
120
120
|
/**
|
|
121
121
|
* Provide a hook to query different official search clients.
|
|
122
122
|
*
|
|
123
|
-
* Note: it will re-query when its parameters changed, make sure to use `
|
|
123
|
+
* Note: it will re-query when its parameters changed, make sure to use `useMemo()` on `clientOptions` or define `deps` array.
|
|
124
124
|
*/
|
|
125
125
|
declare function useDocsSearch(clientOptions: Client & {
|
|
126
126
|
/**
|
|
@@ -135,6 +135,6 @@ declare function useDocsSearch(clientOptions: Client & {
|
|
|
135
135
|
* @defaultValue false
|
|
136
136
|
*/
|
|
137
137
|
allowEmpty?: boolean;
|
|
138
|
-
}): UseDocsSearch;
|
|
138
|
+
}, deps?: DependencyList): UseDocsSearch;
|
|
139
139
|
|
|
140
140
|
export { type AlgoliaOptions, type Client, type FetchOptions, type OramaCloudOptions, type StaticOptions, useDocsSearch };
|
package/dist/search/client.js
CHANGED
|
@@ -22,20 +22,21 @@ function useDebounce(value, delayMs = 1e3) {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
// src/search/client.ts
|
|
25
|
-
function
|
|
25
|
+
function isDeepEqual(a, b) {
|
|
26
|
+
if (a === b) return true;
|
|
26
27
|
if (Array.isArray(a) && Array.isArray(b)) {
|
|
27
|
-
return b.length
|
|
28
|
+
return b.length === a.length && a.every((v, i) => isDeepEqual(v, b[i]));
|
|
28
29
|
}
|
|
29
30
|
if (typeof a === "object" && a && typeof b === "object" && b) {
|
|
30
31
|
const aKeys = Object.keys(a);
|
|
31
32
|
const bKeys = Object.keys(b);
|
|
32
|
-
return aKeys.length
|
|
33
|
-
(key) =>
|
|
33
|
+
return aKeys.length === bKeys.length && aKeys.every(
|
|
34
|
+
(key) => Object.hasOwn(b, key) && isDeepEqual(a[key], b[key])
|
|
34
35
|
);
|
|
35
36
|
}
|
|
36
|
-
return
|
|
37
|
+
return false;
|
|
37
38
|
}
|
|
38
|
-
function useDocsSearch(clientOptions) {
|
|
39
|
+
function useDocsSearch(clientOptions, deps) {
|
|
39
40
|
const { delayMs = 100, allowEmpty = false, ...client } = clientOptions;
|
|
40
41
|
const [search, setSearch] = useState2("");
|
|
41
42
|
const [results, setResults] = useState2("empty");
|
|
@@ -44,7 +45,7 @@ function useDocsSearch(clientOptions) {
|
|
|
44
45
|
const debouncedValue = useDebounce(search, delayMs);
|
|
45
46
|
const onStart = useRef(void 0);
|
|
46
47
|
useOnChange(
|
|
47
|
-
[
|
|
48
|
+
[deps ?? clientOptions, debouncedValue],
|
|
48
49
|
() => {
|
|
49
50
|
if (onStart.current) {
|
|
50
51
|
onStart.current();
|
|
@@ -89,7 +90,7 @@ function useDocsSearch(clientOptions) {
|
|
|
89
90
|
setIsLoading(false);
|
|
90
91
|
});
|
|
91
92
|
},
|
|
92
|
-
|
|
93
|
+
deps ? void 0 : (a, b) => !isDeepEqual(a, b)
|
|
93
94
|
);
|
|
94
95
|
return { search, setSearch, query: { isLoading, data: results, error } };
|
|
95
96
|
}
|
package/dist/search/server.d.ts
CHANGED
|
@@ -3,12 +3,12 @@ import { StructuredData } from '../mdx-plugins/remark-structure.js';
|
|
|
3
3
|
import { SortedResult } from './index.js';
|
|
4
4
|
export { HighlightedText, ReactSortedResult, createContentHighlighter } from './index.js';
|
|
5
5
|
import { I18nConfig } from '../i18n/index.js';
|
|
6
|
-
import { g as LoaderOutput, c as LoaderConfig, I as InferPageType } from '../loader-
|
|
6
|
+
import { g as LoaderOutput, c as LoaderConfig, I as InferPageType } from '../loader-qkSHi822.js';
|
|
7
7
|
import 'mdast';
|
|
8
8
|
import 'unified';
|
|
9
9
|
import 'mdast-util-mdx-jsx';
|
|
10
10
|
import 'react';
|
|
11
|
-
import '../definitions-
|
|
11
|
+
import '../definitions-pJ7PybYY.js';
|
|
12
12
|
|
|
13
13
|
type SimpleDocument = TypedDocument<Orama<typeof simpleSchema>>;
|
|
14
14
|
declare const simpleSchema: {
|
package/dist/source/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { C as ContentStorage, q as ContentStorageFile, F as FileSystem, i as InferMetaType, I as InferPageType, c as LoaderConfig, d as LoaderOptions, g as LoaderOutput, L as LoaderPlugin, s as LoaderPluginOption, f as Meta, M as MetaData, e as Page, P as PageData, o as PageTreeBuilder, j as PageTreeBuilderContext, n as PageTreeOptions, k as PageTreeTransformer, R as ResolvedLoaderConfig, S as Source, a as SourceConfig, V as VirtualFile, _ as _ConfigUnion_, r as buildContentStorage, t as buildPlugins, h as createGetUrl, p as createPageTreeBuilder, l as loader, b as map, m as multiple } from '../loader-
|
|
2
|
-
import '../definitions-
|
|
1
|
+
export { C as ContentStorage, q as ContentStorageFile, F as FileSystem, i as InferMetaType, I as InferPageType, c as LoaderConfig, d as LoaderOptions, g as LoaderOutput, L as LoaderPlugin, s as LoaderPluginOption, f as Meta, M as MetaData, e as Page, P as PageData, o as PageTreeBuilder, j as PageTreeBuilderContext, n as PageTreeOptions, k as PageTreeTransformer, R as ResolvedLoaderConfig, S as Source, a as SourceConfig, V as VirtualFile, _ as _ConfigUnion_, r as buildContentStorage, t as buildPlugins, h as createGetUrl, p as createPageTreeBuilder, l as loader, b as map, m as multiple } from '../loader-qkSHi822.js';
|
|
2
|
+
import '../definitions-pJ7PybYY.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import '../i18n/index.js';
|
|
5
5
|
|
package/dist/source/index.js
CHANGED
|
@@ -399,15 +399,14 @@ function createPageTreeBuilderUtils(ctx) {
|
|
|
399
399
|
"page"
|
|
400
400
|
);
|
|
401
401
|
let meta = storage.read(metaPath);
|
|
402
|
-
if (meta
|
|
403
|
-
|
|
404
|
-
}
|
|
405
|
-
const isRoot = meta?.data.root ?? isGlobalRoot;
|
|
402
|
+
if (meta && meta.format !== "meta") meta = void 0;
|
|
403
|
+
const metadata = meta?.data ?? {};
|
|
404
|
+
const { root = isGlobalRoot, pages } = metadata;
|
|
406
405
|
let index;
|
|
407
406
|
let children;
|
|
408
|
-
if (
|
|
409
|
-
const resolved =
|
|
410
|
-
if (!
|
|
407
|
+
if (pages) {
|
|
408
|
+
const resolved = pages.flatMap((item) => this.resolveFolderItem(folderPath, item));
|
|
409
|
+
if (!root && !visitedPaths.has(indexPath)) {
|
|
411
410
|
index = this.file(indexPath);
|
|
412
411
|
}
|
|
413
412
|
for (let i = 0; i < resolved.length; i++) {
|
|
@@ -422,25 +421,24 @@ function createPageTreeBuilderUtils(ctx) {
|
|
|
422
421
|
}
|
|
423
422
|
children = resolved;
|
|
424
423
|
} else {
|
|
425
|
-
if (!
|
|
424
|
+
if (!root && !visitedPaths.has(indexPath)) {
|
|
426
425
|
index = this.file(indexPath);
|
|
427
426
|
}
|
|
428
427
|
children = this.buildPaths(
|
|
429
428
|
files.filter((file) => !visitedPaths.has(file))
|
|
430
429
|
);
|
|
431
430
|
}
|
|
432
|
-
let name = meta?.data.title ?? index?.name;
|
|
433
|
-
if (!name) {
|
|
434
|
-
const folderName = basename(folderPath);
|
|
435
|
-
name = pathToName(group.exec(folderName)?.[1] ?? folderName);
|
|
436
|
-
}
|
|
437
431
|
let node = {
|
|
438
432
|
type: "folder",
|
|
439
|
-
name
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
433
|
+
name: metadata.title ?? index?.name ?? (() => {
|
|
434
|
+
const folderName = basename(folderPath);
|
|
435
|
+
return pathToName(group.exec(folderName)?.[1] ?? folderName);
|
|
436
|
+
})(),
|
|
437
|
+
icon: metadata.icon,
|
|
438
|
+
root: metadata.root,
|
|
439
|
+
defaultOpen: metadata.defaultOpen,
|
|
440
|
+
description: metadata.description,
|
|
441
|
+
collapsible: metadata.collapsible,
|
|
444
442
|
index,
|
|
445
443
|
children,
|
|
446
444
|
$id: nextNodeId(folderPath),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { L as LoaderPlugin } from '../../loader-
|
|
1
|
+
import { L as LoaderPlugin } from '../../loader-qkSHi822.js';
|
|
2
2
|
import { icons } from 'lucide-react';
|
|
3
|
-
import '../../definitions-
|
|
3
|
+
import '../../definitions-pJ7PybYY.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
import '../../i18n/index.js';
|
|
6
6
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Zod 4 schema
|
|
5
|
+
*/
|
|
6
|
+
declare const metaSchema: z.ZodObject<{
|
|
7
|
+
title: z.ZodOptional<z.ZodString>;
|
|
8
|
+
pages: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
9
|
+
description: z.ZodOptional<z.ZodString>;
|
|
10
|
+
root: z.ZodOptional<z.ZodBoolean>;
|
|
11
|
+
defaultOpen: z.ZodOptional<z.ZodBoolean>;
|
|
12
|
+
collapsible: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
/**
|
|
16
|
+
* Zod 4 schema
|
|
17
|
+
*/
|
|
18
|
+
declare const pageSchema: z.ZodObject<{
|
|
19
|
+
title: z.ZodString;
|
|
20
|
+
description: z.ZodOptional<z.ZodString>;
|
|
21
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
22
|
+
full: z.ZodOptional<z.ZodBoolean>;
|
|
23
|
+
_openapi: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
|
|
26
|
+
export { metaSchema, pageSchema };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import "../chunk-U67V476Y.js";
|
|
2
|
+
|
|
3
|
+
// src/source/schema.ts
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
var metaSchema = z.object({
|
|
6
|
+
title: z.string().optional(),
|
|
7
|
+
pages: z.array(z.string()).optional(),
|
|
8
|
+
description: z.string().optional(),
|
|
9
|
+
root: z.boolean().optional(),
|
|
10
|
+
defaultOpen: z.boolean().optional(),
|
|
11
|
+
collapsible: z.boolean().optional(),
|
|
12
|
+
icon: z.string().optional()
|
|
13
|
+
});
|
|
14
|
+
var pageSchema = z.object({
|
|
15
|
+
title: z.string(),
|
|
16
|
+
description: z.string().optional(),
|
|
17
|
+
icon: z.string().optional(),
|
|
18
|
+
full: z.boolean().optional(),
|
|
19
|
+
// Fumadocs OpenAPI generated
|
|
20
|
+
_openapi: z.looseObject({}).optional()
|
|
21
|
+
});
|
|
22
|
+
export {
|
|
23
|
+
metaSchema,
|
|
24
|
+
pageSchema
|
|
25
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-core",
|
|
3
|
-
"version": "16.2.
|
|
3
|
+
"version": "16.2.4",
|
|
4
4
|
"description": "The React.js library for building a documentation website",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Fumadocs",
|
|
@@ -52,6 +52,10 @@
|
|
|
52
52
|
"import": "./dist/source/client/index.js",
|
|
53
53
|
"types": "./dist/source/client/index.d.ts"
|
|
54
54
|
},
|
|
55
|
+
"./source/schema": {
|
|
56
|
+
"import": "./dist/source/schema.js",
|
|
57
|
+
"types": "./dist/source/schema.d.ts"
|
|
58
|
+
},
|
|
55
59
|
"./source/*": {
|
|
56
60
|
"import": "./dist/source/plugins/*.js",
|
|
57
61
|
"types": "./dist/source/plugins/*.d.ts"
|
|
@@ -107,8 +111,8 @@
|
|
|
107
111
|
"dependencies": {
|
|
108
112
|
"@formatjs/intl-localematcher": "^0.6.2",
|
|
109
113
|
"@orama/orama": "^3.1.16",
|
|
110
|
-
"@shikijs/rehype": "^3.
|
|
111
|
-
"@shikijs/transformers": "^3.
|
|
114
|
+
"@shikijs/rehype": "^3.19.0",
|
|
115
|
+
"@shikijs/transformers": "^3.19.0",
|
|
112
116
|
"estree-util-value-to-estree": "^3.5.0",
|
|
113
117
|
"github-slugger": "^2.0.0",
|
|
114
118
|
"hast-util-to-estree": "^3.1.3",
|
|
@@ -121,36 +125,37 @@
|
|
|
121
125
|
"remark-gfm": "^4.0.1",
|
|
122
126
|
"remark-rehype": "^11.1.2",
|
|
123
127
|
"scroll-into-view-if-needed": "^3.1.0",
|
|
124
|
-
"shiki": "^3.
|
|
128
|
+
"shiki": "^3.19.0",
|
|
125
129
|
"unist-util-visit": "^5.0.0"
|
|
126
130
|
},
|
|
127
131
|
"devDependencies": {
|
|
128
132
|
"@mdx-js/mdx": "^3.1.1",
|
|
129
|
-
"@mixedbread/sdk": "^0.
|
|
133
|
+
"@mixedbread/sdk": "^0.46.0",
|
|
130
134
|
"@orama/core": "^1.2.13",
|
|
131
|
-
"@tanstack/react-router": "1.
|
|
135
|
+
"@tanstack/react-router": "1.140.0",
|
|
132
136
|
"@types/estree-jsx": "^1.0.5",
|
|
133
137
|
"@types/hast": "^3.0.4",
|
|
134
138
|
"@types/mdast": "^4.0.4",
|
|
135
139
|
"@types/negotiator": "^0.6.4",
|
|
136
|
-
"@types/node": "24.10.
|
|
140
|
+
"@types/node": "24.10.2",
|
|
137
141
|
"@types/react": "^19.2.7",
|
|
138
142
|
"@types/react-dom": "^19.2.3",
|
|
139
|
-
"algoliasearch": "5.
|
|
140
|
-
"lucide-react": "^0.
|
|
143
|
+
"algoliasearch": "5.46.0",
|
|
144
|
+
"lucide-react": "^0.556.0",
|
|
141
145
|
"mdast-util-mdx-jsx": "^3.2.0",
|
|
142
146
|
"mdast-util-mdxjs-esm": "^2.0.1",
|
|
143
|
-
"next": "16.0.
|
|
144
|
-
"react-router": "^7.
|
|
147
|
+
"next": "16.0.8",
|
|
148
|
+
"react-router": "^7.10.1",
|
|
145
149
|
"remark-directive": "^4.0.0",
|
|
146
150
|
"remark-mdx": "^3.1.1",
|
|
147
151
|
"remove-markdown": "^0.6.2",
|
|
148
152
|
"typescript": "^5.9.3",
|
|
149
153
|
"unified": "^11.0.5",
|
|
150
154
|
"vfile": "^6.0.3",
|
|
151
|
-
"waku": "^0.27.
|
|
152
|
-
"
|
|
153
|
-
"eslint-config-custom": "0.0.0"
|
|
155
|
+
"waku": "^0.27.3",
|
|
156
|
+
"zod": "^4.1.13",
|
|
157
|
+
"eslint-config-custom": "0.0.0",
|
|
158
|
+
"tsconfig": "0.0.0"
|
|
154
159
|
},
|
|
155
160
|
"peerDependencies": {
|
|
156
161
|
"@mixedbread/sdk": "^0.19.0",
|
|
@@ -163,7 +168,8 @@
|
|
|
163
168
|
"react": "^19.2.0",
|
|
164
169
|
"react-dom": "^19.2.0",
|
|
165
170
|
"react-router": "7.x.x",
|
|
166
|
-
"waku": "^0.26.0 || ^0.27.0"
|
|
171
|
+
"waku": "^0.26.0 || ^0.27.0",
|
|
172
|
+
"zod": "*"
|
|
167
173
|
},
|
|
168
174
|
"peerDependenciesMeta": {
|
|
169
175
|
"@mixedbread/sdk": {
|
|
@@ -198,6 +204,9 @@
|
|
|
198
204
|
},
|
|
199
205
|
"lucide-react": {
|
|
200
206
|
"optional": true
|
|
207
|
+
},
|
|
208
|
+
"zod": {
|
|
209
|
+
"optional": true
|
|
201
210
|
}
|
|
202
211
|
},
|
|
203
212
|
"publishConfig": {
|