fumadocs-core 16.2.2 → 16.2.3
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/{definitions-DbCug1P3.d.ts → definitions-pJ7PybYY.d.ts} +6 -5
- package/dist/{loader-Dz9yZIJQ.d.ts → loader-qkSHi822.d.ts} +2 -1
- package/dist/mdx-plugins/index.js +1 -1
- package/dist/mdx-plugins/remark-image.js +1 -1
- package/dist/page-tree/index.d.ts +2 -2
- 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 +18 -9
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,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,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,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/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.3",
|
|
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,7 +125,7 @@
|
|
|
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": {
|
|
@@ -140,8 +144,8 @@
|
|
|
140
144
|
"lucide-react": "^0.555.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.7",
|
|
148
|
+
"react-router": "^7.10.0",
|
|
145
149
|
"remark-directive": "^4.0.0",
|
|
146
150
|
"remark-mdx": "^3.1.1",
|
|
147
151
|
"remove-markdown": "^0.6.2",
|
|
@@ -149,8 +153,9 @@
|
|
|
149
153
|
"unified": "^11.0.5",
|
|
150
154
|
"vfile": "^6.0.3",
|
|
151
155
|
"waku": "^0.27.2",
|
|
152
|
-
"
|
|
153
|
-
"eslint-config-custom": "0.0.0"
|
|
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": {
|