fumapress 0.2.4 → 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.
Files changed (38) hide show
  1. package/css/generated.css +160 -8
  2. package/dist/_virtual/_rolldown/runtime.js +24 -0
  3. package/dist/adapters/mdx/schema.d.ts +39 -0
  4. package/dist/adapters/mdx/schema.js +9 -0
  5. package/dist/adapters/mdx.js +18 -0
  6. package/dist/components/blog-panel.js +56 -0
  7. package/dist/components/blog.js +60 -0
  8. package/dist/config.d.ts +22 -10
  9. package/dist/index.d.ts +3 -3
  10. package/dist/layouts/blog.d.ts +21 -0
  11. package/dist/layouts/blog.index.d.ts +15 -0
  12. package/dist/layouts/blog.index.js +36 -0
  13. package/dist/layouts/blog.js +85 -0
  14. package/dist/layouts/blog.tags.d.ts +19 -0
  15. package/dist/layouts/blog.tags.js +113 -0
  16. package/dist/layouts/docs.d.ts +9 -7
  17. package/dist/layouts/docs.js +43 -69
  18. package/dist/layouts/home.d.ts +20 -8
  19. package/dist/layouts/home.js +39 -19
  20. package/dist/layouts/notebook.d.ts +37 -0
  21. package/dist/layouts/notebook.js +59 -0
  22. package/dist/layouts/root.d.ts +1 -1
  23. package/dist/layouts/root.js +5 -6
  24. package/dist/layouts/switch.d.ts +11 -0
  25. package/dist/layouts/switch.js +25 -0
  26. package/dist/lib/cn.js +2 -0
  27. package/dist/lib/join-pathname.js +9 -0
  28. package/dist/lib/shared/blog.js +39 -0
  29. package/dist/lib/shared.d.ts +10 -4
  30. package/dist/lib/shared.js +51 -5
  31. package/dist/lib/types.d.ts +18 -6
  32. package/dist/node_modules/.pnpm/@fastify_deepmerge@3.2.1/node_modules/@fastify/deepmerge/index.js +108 -0
  33. package/dist/plugins/blog.d.ts +71 -0
  34. package/dist/plugins/blog.js +168 -0
  35. package/dist/router.d.ts +3 -4
  36. package/dist/router.js +32 -29
  37. package/dist/vite.js +5 -0
  38. package/package.json +26 -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 { createElement } from "react";
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.ts
6
- function createRouter(userConfig, routerOptions) {
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?.root ?? (await import("./layouts/root.js")).createRootLayout(),
17
- page: layouts.page ?? (await import("./layouts/docs.js")).createDocsLayout(),
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
- for (const plugin of context.plugins) await plugin.createPages?.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 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({ children }) {
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 createElement(layouts.root, {
58
+ return /* @__PURE__ */ jsx(layouts.root, {
56
59
  lang,
57
- children,
58
- ...context
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: (await context.getLoader()).getPages().map((page) => [page.locale, ...page.slugs]),
68
+ staticPaths: pendingPages.map((page) => [page.locale, ...page.slugs]),
66
69
  component({ slugs, lang }) {
67
- return createElement(layouts.page, {
70
+ return /* @__PURE__ */ jsx(layouts.page, {
68
71
  lang,
69
72
  slugs,
70
- ...context
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 createElement(layouts.notFound, {
82
+ return /* @__PURE__ */ jsx(layouts.notFound, {
80
83
  lang,
81
- ...context
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 createElement(layouts.root, {
97
- children,
98
- ...context
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: (await context.getLoader()).getPages().map((page) => page.slugs),
108
+ staticPaths: pendingPages.map((page) => page.slugs),
106
109
  component({ slugs }) {
107
- return createElement(layouts.page, {
110
+ return /* @__PURE__ */ jsx(layouts.page, {
108
111
  slugs,
109
- ...context
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 createElement(layouts.notFound, context);
121
+ return /* @__PURE__ */ jsx(layouts.notFound, { ctx: context });
119
122
  }
120
123
  });
121
124
  }
package/dist/vite.js CHANGED
@@ -12,6 +12,11 @@ function pressCore() {
12
12
  isBuild: command === "build",
13
13
  isFrameworkPkgByName(pkgName) {
14
14
  if (pkgName.startsWith("@fumapress/") || pkgName.startsWith("@fumadocs/") || pkgName.startsWith("fumadocs-") || pkgName.startsWith("fumapress-") || pkgName === "fumapress") return true;
15
+ switch (pkgName) {
16
+ case "vite":
17
+ case "waku":
18
+ case "shiki": return false;
19
+ }
15
20
  }
16
21
  });
17
22
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumapress",
3
- "version": "0.2.4",
3
+ "version": "0.3.0",
4
4
  "description": "An opinionated docs framework powered by Fumadocs",
5
5
  "keywords": [
6
6
  "Docs",
@@ -20,9 +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",
29
+ "./layouts/notebook": "./dist/layouts/notebook.js",
25
30
  "./layouts/root": "./dist/layouts/root.js",
31
+ "./layouts/switch": "./dist/layouts/switch.js",
32
+ "./plugins/blog": "./dist/plugins/blog.js",
26
33
  "./plugins/flexsearch": "./dist/plugins/flexsearch.js",
27
34
  "./plugins/llms.txt": "./dist/plugins/llms.txt.js",
28
35
  "./plugins/orama-search": "./dist/plugins/orama-search.js",
@@ -39,30 +46,35 @@
39
46
  "dependencies": {
40
47
  "@orama/orama": "^3.1.18",
41
48
  "@takumi-rs/image-response": "^1.1.2",
49
+ "class-variance-authority": "^0.7.1",
42
50
  "flexsearch": "^0.8.212",
43
- "fumadocs-core": "^16.8.10",
44
- "fumadocs-ui": "^16.8.10",
45
- "tailwind-merge": "^3.5.0",
46
- "vite": "^8.0.11",
47
- "waku": "1.0.0-alpha.10"
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"
48
57
  },
49
58
  "devDependencies": {
59
+ "@fastify/deepmerge": "^3.2.1",
50
60
  "@tailwindcss/oxide": "^4.3.0",
51
61
  "@types/mdx": "^2.0.13",
52
- "@types/node": "^25.7.0",
62
+ "@types/node": "^25.8.0",
53
63
  "@types/react": "^19.2.14",
54
- "fumadocs-mdx": "^15.0.4",
64
+ "fumadocs-mdx": "^15.0.5",
55
65
  "react": "^19.2.6",
56
66
  "react-dom": "^19.2.6",
57
67
  "tsdown": "0.22.0",
58
- "typescript": "^6.0.3"
68
+ "typescript": "^6.0.3",
69
+ "waku": "1.0.0-beta.0"
59
70
  },
60
71
  "peerDependencies": {
61
72
  "@types/mdx": "*",
62
73
  "@types/react": "*",
63
74
  "fumadocs-mdx": "^15.0.0",
64
75
  "react": "^19.2.0",
65
- "react-dom": "^19.2.0"
76
+ "react-dom": "^19.2.0",
77
+ "waku": "1.0.0-beta.0"
66
78
  },
67
79
  "peerDependenciesMeta": {
68
80
  "@types/mdx": {
@@ -75,8 +87,11 @@
75
87
  "optional": true
76
88
  }
77
89
  },
90
+ "inlinedDependencies": {
91
+ "@fastify/deepmerge": "3.2.1"
92
+ },
78
93
  "scripts": {
79
- "dev": "tsdown --watch",
94
+ "dev": "tsdown --watch --clean false",
80
95
  "build": "tsdown",
81
96
  "types:check": "tsc --noEmit"
82
97
  }