fumapress 0.2.5 → 0.3.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/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 +25 -5
- package/dist/adapters/openapi.d.ts +15 -0
- package/dist/adapters/openapi.js +22 -0
- package/dist/components/blog-panel.js +56 -0
- package/dist/components/blog.js +60 -0
- package/dist/config.d.ts +23 -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 +82 -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 -51
- package/dist/layouts/home.d.ts +18 -6
- package/dist/layouts/home.js +37 -21
- package/dist/layouts/notebook.d.ts +3 -3
- package/dist/layouts/notebook.js +24 -51
- package/dist/layouts/root.js +5 -6
- package/dist/layouts/switch.d.ts +11 -0
- package/dist/layouts/switch.js +21 -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 +20 -6
- package/dist/node_modules/.pnpm/@fastify_deepmerge@3.2.1/node_modules/@fastify/deepmerge/index.js +108 -0
- package/dist/plugins/blog.d.ts +72 -0
- package/dist/plugins/blog.js +175 -0
- package/dist/plugins/llms.txt.d.ts +1 -1
- package/dist/plugins/llms.txt.js +5 -5
- package/dist/plugins/openapi.d.ts +13 -0
- package/dist/plugins/openapi.js +21 -0
- package/dist/router.d.ts +7 -6
- package/dist/router.js +49 -40
- package/dist/vite.d.ts +11 -3
- package/dist/vite.js +3 -4
- package/package.json +32 -11
package/dist/router.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AppContext } from "./lib/shared.js";
|
|
2
|
+
import { Config, ConfigContext } from "./config.js";
|
|
3
|
+
import { Awaitable, RouteFns } from "./lib/types.js";
|
|
2
4
|
import * as waku from "waku";
|
|
3
5
|
|
|
4
6
|
//#region src/router.d.ts
|
|
5
|
-
type
|
|
6
|
-
declare function createRouter<C extends ConfigContext>(userConfig: Config<C
|
|
7
|
-
|
|
8
|
-
createPages: () => ReturnType<typeof waku.createPages>;
|
|
7
|
+
type Options = Parameters<typeof waku.createPages>[1];
|
|
8
|
+
declare function createRouter<C extends ConfigContext>(userConfig: Config<C>): {
|
|
9
|
+
createPages: (fn?: (this: AppContext<C>, fns: RouteFns) => Awaitable<void>, options?: Options) => ReturnType<typeof waku.createPages>;
|
|
9
10
|
};
|
|
10
11
|
//#endregion
|
|
11
|
-
export {
|
|
12
|
+
export { createRouter };
|
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 {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { Fragment } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { unstable_notFound, unstable_redirect } from "waku/router/server";
|
|
6
|
+
//#region src/router.tsx
|
|
7
|
+
function createRouter(userConfig) {
|
|
7
8
|
async function init() {
|
|
8
9
|
const context = parseConfig(userConfig);
|
|
9
|
-
for (const plugin of context.plugins) plugin.init?.call(context);
|
|
10
|
-
const layouts = {
|
|
11
|
-
...userConfig.layouts,
|
|
12
|
-
...routerOptions
|
|
13
|
-
};
|
|
10
|
+
for (const plugin of context.plugins) await plugin.init?.call(context);
|
|
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) => {
|
|
@@ -38,36 +35,50 @@ function createRouter(userConfig, routerOptions) {
|
|
|
38
35
|
});
|
|
39
36
|
}
|
|
40
37
|
};
|
|
41
|
-
await base(fns);
|
|
42
|
-
|
|
38
|
+
await base?.call(context, fns);
|
|
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 source = await context.getLoader();
|
|
48
|
+
const staticPaths = [];
|
|
49
|
+
for (const page of source.getPages()) {
|
|
50
|
+
if (resolved.has(page)) continue;
|
|
51
|
+
staticPaths.push(page.locale ? [page.locale, ...page.slugs] : page.slugs);
|
|
52
|
+
}
|
|
43
53
|
const defaultRenderMode = context.mode === "dynamic" ? "dynamic" : "static";
|
|
44
54
|
if (context.i18nConfig) {
|
|
45
55
|
fns.createRoot({
|
|
46
56
|
render: defaultRenderMode,
|
|
47
|
-
component
|
|
48
|
-
return children;
|
|
49
|
-
}
|
|
57
|
+
component: Fragment
|
|
50
58
|
});
|
|
51
59
|
fns.createLayout({
|
|
52
60
|
render: defaultRenderMode,
|
|
53
61
|
path: "/[lang]",
|
|
54
62
|
component({ children, lang }) {
|
|
55
|
-
return
|
|
63
|
+
return /* @__PURE__ */ jsx(layouts.root, {
|
|
56
64
|
lang,
|
|
57
|
-
|
|
58
|
-
|
|
65
|
+
ctx: context,
|
|
66
|
+
children
|
|
59
67
|
});
|
|
60
68
|
}
|
|
61
69
|
});
|
|
62
70
|
fns.createPage({
|
|
63
71
|
render: defaultRenderMode,
|
|
64
72
|
path: "/[lang]/[...slugs]",
|
|
65
|
-
staticPaths
|
|
66
|
-
component({ slugs, lang }) {
|
|
67
|
-
|
|
73
|
+
staticPaths,
|
|
74
|
+
async component({ slugs, lang }) {
|
|
75
|
+
const page = (await context.getLoader()).getPage(slugs, lang);
|
|
76
|
+
if (!page || resolved.has(page)) unstable_notFound();
|
|
77
|
+
return /* @__PURE__ */ jsx(layouts.page, {
|
|
68
78
|
lang,
|
|
69
79
|
slugs,
|
|
70
|
-
|
|
80
|
+
page,
|
|
81
|
+
ctx: context
|
|
71
82
|
});
|
|
72
83
|
}
|
|
73
84
|
});
|
|
@@ -76,9 +87,9 @@ function createRouter(userConfig, routerOptions) {
|
|
|
76
87
|
path: "/[lang]/404",
|
|
77
88
|
staticPaths: Object.keys(context.i18nConfig.languages),
|
|
78
89
|
component({ lang }) {
|
|
79
|
-
return
|
|
90
|
+
return /* @__PURE__ */ jsx(layouts.notFound, {
|
|
80
91
|
lang,
|
|
81
|
-
|
|
92
|
+
ctx: context
|
|
82
93
|
});
|
|
83
94
|
}
|
|
84
95
|
});
|
|
@@ -93,20 +104,23 @@ function createRouter(userConfig, routerOptions) {
|
|
|
93
104
|
fns.createRoot({
|
|
94
105
|
render: defaultRenderMode,
|
|
95
106
|
component({ children }) {
|
|
96
|
-
return
|
|
97
|
-
|
|
98
|
-
|
|
107
|
+
return /* @__PURE__ */ jsx(layouts.root, {
|
|
108
|
+
ctx: context,
|
|
109
|
+
children
|
|
99
110
|
});
|
|
100
111
|
}
|
|
101
112
|
});
|
|
102
113
|
fns.createPage({
|
|
103
114
|
render: defaultRenderMode,
|
|
104
115
|
path: "/[...slugs]",
|
|
105
|
-
staticPaths
|
|
106
|
-
component({ slugs }) {
|
|
107
|
-
|
|
116
|
+
staticPaths,
|
|
117
|
+
async component({ slugs }) {
|
|
118
|
+
const page = (await context.getLoader()).getPage(slugs);
|
|
119
|
+
if (!page || resolved.has(page)) unstable_notFound();
|
|
120
|
+
return /* @__PURE__ */ jsx(layouts.page, {
|
|
108
121
|
slugs,
|
|
109
|
-
|
|
122
|
+
page,
|
|
123
|
+
ctx: context
|
|
110
124
|
});
|
|
111
125
|
}
|
|
112
126
|
});
|
|
@@ -115,19 +129,14 @@ function createRouter(userConfig, routerOptions) {
|
|
|
115
129
|
staticPaths: [],
|
|
116
130
|
path: "/404",
|
|
117
131
|
component() {
|
|
118
|
-
return
|
|
132
|
+
return /* @__PURE__ */ jsx(layouts.notFound, { ctx: context });
|
|
119
133
|
}
|
|
120
134
|
});
|
|
121
135
|
}
|
|
122
136
|
return null;
|
|
123
137
|
}, createPagesOptions);
|
|
124
138
|
};
|
|
125
|
-
return {
|
|
126
|
-
extend: createPages,
|
|
127
|
-
createPages() {
|
|
128
|
-
return createPages(() => null);
|
|
129
|
-
}
|
|
130
|
-
};
|
|
139
|
+
return { createPages };
|
|
131
140
|
}
|
|
132
141
|
//#endregion
|
|
133
142
|
export { createRouter };
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Plugin } from "vite";
|
|
2
2
|
|
|
3
3
|
//#region src/vite.d.ts
|
|
4
|
-
|
|
4
|
+
interface PluginOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Auto-generate Vite config to handle CJS bundling.
|
|
7
|
+
*
|
|
8
|
+
* @default true
|
|
9
|
+
*/
|
|
10
|
+
generateViteConfig?: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare function press(options?: PluginOptions): Plugin;
|
|
5
13
|
//#endregion
|
|
6
|
-
export { press as default };
|
|
14
|
+
export { PluginOptions, press as default };
|
package/dist/vite.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { crawlFrameworkPkgs } from "./lib/vitefu.js";
|
|
2
2
|
//#region src/vite.ts
|
|
3
|
-
function press() {
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
function pressCore() {
|
|
3
|
+
function press(options = {}) {
|
|
4
|
+
const { generateViteConfig = true } = options;
|
|
7
5
|
return {
|
|
8
6
|
name: "fumapress:core",
|
|
9
7
|
async config(_, { command }) {
|
|
8
|
+
if (!generateViteConfig) return;
|
|
10
9
|
const out = await crawlFrameworkPkgs({
|
|
11
10
|
root: process.cwd(),
|
|
12
11
|
isBuild: command === "build",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumapress",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "An opinionated docs framework powered by Fumadocs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Docs",
|
|
@@ -20,12 +20,20 @@
|
|
|
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
|
+
"./adapters/openapi": "./dist/adapters/openapi.js",
|
|
25
|
+
"./layouts/blog": "./dist/layouts/blog.js",
|
|
26
|
+
"./layouts/blog.index": "./dist/layouts/blog.index.js",
|
|
27
|
+
"./layouts/blog.tags": "./dist/layouts/blog.tags.js",
|
|
23
28
|
"./layouts/docs": "./dist/layouts/docs.js",
|
|
24
29
|
"./layouts/home": "./dist/layouts/home.js",
|
|
25
30
|
"./layouts/notebook": "./dist/layouts/notebook.js",
|
|
26
31
|
"./layouts/root": "./dist/layouts/root.js",
|
|
32
|
+
"./layouts/switch": "./dist/layouts/switch.js",
|
|
33
|
+
"./plugins/blog": "./dist/plugins/blog.js",
|
|
27
34
|
"./plugins/flexsearch": "./dist/plugins/flexsearch.js",
|
|
28
35
|
"./plugins/llms.txt": "./dist/plugins/llms.txt.js",
|
|
36
|
+
"./plugins/openapi": "./dist/plugins/openapi.js",
|
|
29
37
|
"./plugins/orama-search": "./dist/plugins/orama-search.js",
|
|
30
38
|
"./plugins/takumi": "./dist/plugins/takumi.js",
|
|
31
39
|
"./router": "./dist/router.js",
|
|
@@ -40,32 +48,42 @@
|
|
|
40
48
|
"dependencies": {
|
|
41
49
|
"@orama/orama": "^3.1.18",
|
|
42
50
|
"@takumi-rs/image-response": "^1.1.2",
|
|
51
|
+
"class-variance-authority": "^0.7.1",
|
|
43
52
|
"flexsearch": "^0.8.212",
|
|
44
|
-
"fumadocs-core": "^16.8.
|
|
45
|
-
"fumadocs-ui": "^16.8.
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
53
|
+
"fumadocs-core": "^16.8.11",
|
|
54
|
+
"fumadocs-ui": "^16.8.11",
|
|
55
|
+
"lucide-react": "^1.16.0",
|
|
56
|
+
"tailwind-merge": "^3.6.0",
|
|
57
|
+
"vite": "^8.0.13",
|
|
58
|
+
"zod": "^4.4.3"
|
|
49
59
|
},
|
|
50
60
|
"devDependencies": {
|
|
61
|
+
"@fastify/deepmerge": "^3.2.1",
|
|
51
62
|
"@tailwindcss/oxide": "^4.3.0",
|
|
52
63
|
"@types/mdx": "^2.0.13",
|
|
53
|
-
"@types/node": "^25.
|
|
64
|
+
"@types/node": "^25.8.0",
|
|
54
65
|
"@types/react": "^19.2.14",
|
|
55
|
-
"fumadocs-mdx": "^15.0.
|
|
66
|
+
"fumadocs-mdx": "^15.0.6",
|
|
67
|
+
"fumadocs-openapi": "^10.8.5",
|
|
56
68
|
"react": "^19.2.6",
|
|
57
69
|
"react-dom": "^19.2.6",
|
|
58
70
|
"tsdown": "0.22.0",
|
|
59
|
-
"typescript": "^6.0.3"
|
|
71
|
+
"typescript": "^6.0.3",
|
|
72
|
+
"waku": "1.0.0-beta.0"
|
|
60
73
|
},
|
|
61
74
|
"peerDependencies": {
|
|
62
75
|
"@types/mdx": "*",
|
|
63
76
|
"@types/react": "*",
|
|
64
77
|
"fumadocs-mdx": "^15.0.0",
|
|
78
|
+
"fumadocs-openapi": "^10.8.0",
|
|
65
79
|
"react": "^19.2.0",
|
|
66
|
-
"react-dom": "^19.2.0"
|
|
80
|
+
"react-dom": "^19.2.0",
|
|
81
|
+
"waku": "1.0.0-beta.0"
|
|
67
82
|
},
|
|
68
83
|
"peerDependenciesMeta": {
|
|
84
|
+
"fumadocs-openapi": {
|
|
85
|
+
"optional": true
|
|
86
|
+
},
|
|
69
87
|
"@types/mdx": {
|
|
70
88
|
"optional": true
|
|
71
89
|
},
|
|
@@ -76,8 +94,11 @@
|
|
|
76
94
|
"optional": true
|
|
77
95
|
}
|
|
78
96
|
},
|
|
97
|
+
"inlinedDependencies": {
|
|
98
|
+
"@fastify/deepmerge": "3.2.1"
|
|
99
|
+
},
|
|
79
100
|
"scripts": {
|
|
80
|
-
"dev": "tsdown --watch",
|
|
101
|
+
"dev": "tsdown --watch --clean false",
|
|
81
102
|
"build": "tsdown",
|
|
82
103
|
"types:check": "tsc --noEmit"
|
|
83
104
|
}
|