fumapress 0.2.5 → 0.3.0
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/css/generated.css +155 -8
- package/dist/_virtual/_rolldown/runtime.js +24 -0
- package/dist/adapters/mdx/schema.d.ts +39 -0
- package/dist/adapters/mdx/schema.js +9 -0
- package/dist/adapters/mdx.js +18 -0
- package/dist/components/blog-panel.js +56 -0
- package/dist/components/blog.js +60 -0
- package/dist/config.d.ts +22 -10
- package/dist/index.d.ts +2 -2
- package/dist/layouts/blog.d.ts +21 -0
- package/dist/layouts/blog.index.d.ts +15 -0
- package/dist/layouts/blog.index.js +36 -0
- package/dist/layouts/blog.js +85 -0
- package/dist/layouts/blog.tags.d.ts +19 -0
- package/dist/layouts/blog.tags.js +113 -0
- package/dist/layouts/docs.d.ts +3 -3
- package/dist/layouts/docs.js +24 -48
- package/dist/layouts/home.d.ts +18 -6
- package/dist/layouts/home.js +38 -19
- package/dist/layouts/notebook.d.ts +3 -3
- package/dist/layouts/notebook.js +24 -48
- package/dist/layouts/root.js +5 -6
- package/dist/layouts/switch.d.ts +11 -0
- package/dist/layouts/switch.js +25 -0
- package/dist/lib/cn.js +2 -0
- package/dist/lib/join-pathname.js +9 -0
- package/dist/lib/shared/blog.js +39 -0
- package/dist/lib/shared.d.ts +3 -2
- package/dist/lib/shared.js +50 -11
- package/dist/lib/types.d.ts +17 -5
- package/dist/node_modules/.pnpm/@fastify_deepmerge@3.2.1/node_modules/@fastify/deepmerge/index.js +108 -0
- package/dist/plugins/blog.d.ts +71 -0
- package/dist/plugins/blog.js +168 -0
- package/dist/router.d.ts +3 -4
- package/dist/router.js +32 -29
- package/package.json +25 -11
package/dist/router.js
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import { parseConfig } from "./lib/shared.js";
|
|
2
2
|
import * as waku from "waku";
|
|
3
|
-
import {
|
|
3
|
+
import { Fragment } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
5
|
import { unstable_redirect } from "waku/router/server";
|
|
5
|
-
//#region src/router.
|
|
6
|
-
function createRouter(userConfig
|
|
6
|
+
//#region src/router.tsx
|
|
7
|
+
function createRouter(userConfig) {
|
|
7
8
|
async function init() {
|
|
8
9
|
const context = parseConfig(userConfig);
|
|
9
10
|
for (const plugin of context.plugins) plugin.init?.call(context);
|
|
10
|
-
const layouts = {
|
|
11
|
-
...userConfig.layouts,
|
|
12
|
-
...routerOptions
|
|
13
|
-
};
|
|
14
11
|
return {
|
|
15
12
|
context,
|
|
16
|
-
root: layouts
|
|
17
|
-
page: layouts.page ?? (await import("./layouts/docs.js")).
|
|
18
|
-
notFound: layouts.notFound ?? (await import("fumadocs-ui/layouts/home/not-found")).DefaultNotFound
|
|
13
|
+
root: context.layouts.root ?? (await import("./layouts/root.js")).createRootLayout(),
|
|
14
|
+
page: context.layouts.page ?? (await import("./layouts/docs.js")).createDocsLayoutPage(),
|
|
15
|
+
notFound: context.layouts.notFound ?? (await import("fumadocs-ui/layouts/home/not-found")).DefaultNotFound
|
|
19
16
|
};
|
|
20
17
|
}
|
|
21
18
|
const createPages = (base, createPagesOptions) => {
|
|
@@ -39,35 +36,41 @@ function createRouter(userConfig, routerOptions) {
|
|
|
39
36
|
}
|
|
40
37
|
};
|
|
41
38
|
await base(fns);
|
|
42
|
-
|
|
39
|
+
const resolved = /* @__PURE__ */ new Set();
|
|
40
|
+
const createPagesCtx = {
|
|
41
|
+
...context,
|
|
42
|
+
markResolved(page) {
|
|
43
|
+
resolved.add(page);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
for (const plugin of context.plugins) await plugin.createPages?.call(createPagesCtx, fns);
|
|
47
|
+
const pendingPages = (await context.getLoader()).getPages().filter((page) => !resolved.has(page));
|
|
43
48
|
const defaultRenderMode = context.mode === "dynamic" ? "dynamic" : "static";
|
|
44
49
|
if (context.i18nConfig) {
|
|
45
50
|
fns.createRoot({
|
|
46
51
|
render: defaultRenderMode,
|
|
47
|
-
component
|
|
48
|
-
return children;
|
|
49
|
-
}
|
|
52
|
+
component: Fragment
|
|
50
53
|
});
|
|
51
54
|
fns.createLayout({
|
|
52
55
|
render: defaultRenderMode,
|
|
53
56
|
path: "/[lang]",
|
|
54
57
|
component({ children, lang }) {
|
|
55
|
-
return
|
|
58
|
+
return /* @__PURE__ */ jsx(layouts.root, {
|
|
56
59
|
lang,
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
ctx: context,
|
|
61
|
+
children
|
|
59
62
|
});
|
|
60
63
|
}
|
|
61
64
|
});
|
|
62
65
|
fns.createPage({
|
|
63
66
|
render: defaultRenderMode,
|
|
64
67
|
path: "/[lang]/[...slugs]",
|
|
65
|
-
staticPaths:
|
|
68
|
+
staticPaths: pendingPages.map((page) => [page.locale, ...page.slugs]),
|
|
66
69
|
component({ slugs, lang }) {
|
|
67
|
-
return
|
|
70
|
+
return /* @__PURE__ */ jsx(layouts.page, {
|
|
68
71
|
lang,
|
|
69
72
|
slugs,
|
|
70
|
-
|
|
73
|
+
ctx: context
|
|
71
74
|
});
|
|
72
75
|
}
|
|
73
76
|
});
|
|
@@ -76,9 +79,9 @@ function createRouter(userConfig, routerOptions) {
|
|
|
76
79
|
path: "/[lang]/404",
|
|
77
80
|
staticPaths: Object.keys(context.i18nConfig.languages),
|
|
78
81
|
component({ lang }) {
|
|
79
|
-
return
|
|
82
|
+
return /* @__PURE__ */ jsx(layouts.notFound, {
|
|
80
83
|
lang,
|
|
81
|
-
|
|
84
|
+
ctx: context
|
|
82
85
|
});
|
|
83
86
|
}
|
|
84
87
|
});
|
|
@@ -93,20 +96,20 @@ function createRouter(userConfig, routerOptions) {
|
|
|
93
96
|
fns.createRoot({
|
|
94
97
|
render: defaultRenderMode,
|
|
95
98
|
component({ children }) {
|
|
96
|
-
return
|
|
97
|
-
|
|
98
|
-
|
|
99
|
+
return /* @__PURE__ */ jsx(layouts.root, {
|
|
100
|
+
ctx: context,
|
|
101
|
+
children
|
|
99
102
|
});
|
|
100
103
|
}
|
|
101
104
|
});
|
|
102
105
|
fns.createPage({
|
|
103
106
|
render: defaultRenderMode,
|
|
104
107
|
path: "/[...slugs]",
|
|
105
|
-
staticPaths:
|
|
108
|
+
staticPaths: pendingPages.map((page) => page.slugs),
|
|
106
109
|
component({ slugs }) {
|
|
107
|
-
return
|
|
110
|
+
return /* @__PURE__ */ jsx(layouts.page, {
|
|
108
111
|
slugs,
|
|
109
|
-
|
|
112
|
+
ctx: context
|
|
110
113
|
});
|
|
111
114
|
}
|
|
112
115
|
});
|
|
@@ -115,7 +118,7 @@ function createRouter(userConfig, routerOptions) {
|
|
|
115
118
|
staticPaths: [],
|
|
116
119
|
path: "/404",
|
|
117
120
|
component() {
|
|
118
|
-
return
|
|
121
|
+
return /* @__PURE__ */ jsx(layouts.notFound, { ctx: context });
|
|
119
122
|
}
|
|
120
123
|
});
|
|
121
124
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumapress",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "An opinionated docs framework powered by Fumadocs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Docs",
|
|
@@ -20,10 +20,16 @@
|
|
|
20
20
|
"exports": {
|
|
21
21
|
".": "./dist/index.js",
|
|
22
22
|
"./adapters/mdx": "./dist/adapters/mdx.js",
|
|
23
|
+
"./adapters/mdx/schema": "./dist/adapters/mdx/schema.js",
|
|
24
|
+
"./layouts/blog": "./dist/layouts/blog.js",
|
|
25
|
+
"./layouts/blog.index": "./dist/layouts/blog.index.js",
|
|
26
|
+
"./layouts/blog.tags": "./dist/layouts/blog.tags.js",
|
|
23
27
|
"./layouts/docs": "./dist/layouts/docs.js",
|
|
24
28
|
"./layouts/home": "./dist/layouts/home.js",
|
|
25
29
|
"./layouts/notebook": "./dist/layouts/notebook.js",
|
|
26
30
|
"./layouts/root": "./dist/layouts/root.js",
|
|
31
|
+
"./layouts/switch": "./dist/layouts/switch.js",
|
|
32
|
+
"./plugins/blog": "./dist/plugins/blog.js",
|
|
27
33
|
"./plugins/flexsearch": "./dist/plugins/flexsearch.js",
|
|
28
34
|
"./plugins/llms.txt": "./dist/plugins/llms.txt.js",
|
|
29
35
|
"./plugins/orama-search": "./dist/plugins/orama-search.js",
|
|
@@ -40,30 +46,35 @@
|
|
|
40
46
|
"dependencies": {
|
|
41
47
|
"@orama/orama": "^3.1.18",
|
|
42
48
|
"@takumi-rs/image-response": "^1.1.2",
|
|
49
|
+
"class-variance-authority": "^0.7.1",
|
|
43
50
|
"flexsearch": "^0.8.212",
|
|
44
|
-
"fumadocs-core": "^16.8.
|
|
45
|
-
"fumadocs-ui": "^16.8.
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
51
|
+
"fumadocs-core": "^16.8.11",
|
|
52
|
+
"fumadocs-ui": "^16.8.11",
|
|
53
|
+
"lucide-react": "^1.16.0",
|
|
54
|
+
"tailwind-merge": "^3.6.0",
|
|
55
|
+
"vite": "^8.0.13",
|
|
56
|
+
"zod": "^4.4.3"
|
|
49
57
|
},
|
|
50
58
|
"devDependencies": {
|
|
59
|
+
"@fastify/deepmerge": "^3.2.1",
|
|
51
60
|
"@tailwindcss/oxide": "^4.3.0",
|
|
52
61
|
"@types/mdx": "^2.0.13",
|
|
53
|
-
"@types/node": "^25.
|
|
62
|
+
"@types/node": "^25.8.0",
|
|
54
63
|
"@types/react": "^19.2.14",
|
|
55
|
-
"fumadocs-mdx": "^15.0.
|
|
64
|
+
"fumadocs-mdx": "^15.0.5",
|
|
56
65
|
"react": "^19.2.6",
|
|
57
66
|
"react-dom": "^19.2.6",
|
|
58
67
|
"tsdown": "0.22.0",
|
|
59
|
-
"typescript": "^6.0.3"
|
|
68
|
+
"typescript": "^6.0.3",
|
|
69
|
+
"waku": "1.0.0-beta.0"
|
|
60
70
|
},
|
|
61
71
|
"peerDependencies": {
|
|
62
72
|
"@types/mdx": "*",
|
|
63
73
|
"@types/react": "*",
|
|
64
74
|
"fumadocs-mdx": "^15.0.0",
|
|
65
75
|
"react": "^19.2.0",
|
|
66
|
-
"react-dom": "^19.2.0"
|
|
76
|
+
"react-dom": "^19.2.0",
|
|
77
|
+
"waku": "1.0.0-beta.0"
|
|
67
78
|
},
|
|
68
79
|
"peerDependenciesMeta": {
|
|
69
80
|
"@types/mdx": {
|
|
@@ -76,8 +87,11 @@
|
|
|
76
87
|
"optional": true
|
|
77
88
|
}
|
|
78
89
|
},
|
|
90
|
+
"inlinedDependencies": {
|
|
91
|
+
"@fastify/deepmerge": "3.2.1"
|
|
92
|
+
},
|
|
79
93
|
"scripts": {
|
|
80
|
-
"dev": "tsdown --watch",
|
|
94
|
+
"dev": "tsdown --watch --clean false",
|
|
81
95
|
"build": "tsdown",
|
|
82
96
|
"types:check": "tsc --noEmit"
|
|
83
97
|
}
|