fumapress 0.2.0 → 0.2.2

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/LICENSE +1 -1
  2. package/css/default.css +4 -4
  3. package/css/preset.css +1 -1
  4. package/package.json +14 -13
  5. package/css/generated.css +0 -98
  6. package/dist/_virtual/_rolldown/runtime.js +0 -4
  7. package/dist/adapters/mdx.d.ts +0 -6
  8. package/dist/adapters/mdx.js +0 -39
  9. package/dist/components/flexsearch-static.js +0 -24
  10. package/dist/components/orama-search-static.js +0 -34
  11. package/dist/config.d.ts +0 -52
  12. package/dist/config.js +0 -13
  13. package/dist/index.d.ts +0 -4
  14. package/dist/index.js +0 -2
  15. package/dist/layouts/docs.d.ts +0 -29
  16. package/dist/layouts/docs.js +0 -67
  17. package/dist/layouts/home.d.ts +0 -26
  18. package/dist/layouts/home.js +0 -34
  19. package/dist/layouts/root.d.ts +0 -7
  20. package/dist/layouts/root.js +0 -33
  21. package/dist/lib/fs.js +0 -18
  22. package/dist/lib/shared.d.ts +0 -38
  23. package/dist/lib/shared.js +0 -49
  24. package/dist/lib/types.d.ts +0 -33
  25. package/dist/node_modules/.pnpm/vitefu@1.1.3_vite@8.0.11_@types_node@25.6.2_esbuild@0.28.0_jiti@2.7.0_terser@5.47.1_tsx@4.21.0_yaml@2.8.4_/node_modules/vitefu/src/index.js +0 -199
  26. package/dist/node_modules/.pnpm/vitefu@1.1.3_vite@8.0.11_@types_node@25.6.2_esbuild@0.28.0_jiti@2.7.0_terser@5.47.1_tsx@4.21.0_yaml@2.8.4_/node_modules/vitefu/src/sync.js +0 -48
  27. package/dist/plugins/flexsearch.d.ts +0 -14
  28. package/dist/plugins/flexsearch.js +0 -36
  29. package/dist/plugins/llms.txt.d.ts +0 -11
  30. package/dist/plugins/llms.txt.js +0 -71
  31. package/dist/plugins/orama-search.d.ts +0 -14
  32. package/dist/plugins/orama-search.js +0 -35
  33. package/dist/plugins/takumi.d.ts +0 -16
  34. package/dist/plugins/takumi.js +0 -62
  35. package/dist/router.d.ts +0 -26
  36. package/dist/router.js +0 -129
  37. package/dist/vite.d.ts +0 -6
  38. package/dist/vite.js +0 -45
package/dist/router.js DELETED
@@ -1,129 +0,0 @@
1
- import { parseConfig } from "./lib/shared.js";
2
- import * as waku from "waku";
3
- import { createElement } from "react";
4
- import { unstable_redirect } from "waku/router/server";
5
- //#region src/router.ts
6
- function createRouter(rawConfig, options = {}) {
7
- async function init() {
8
- const context = parseConfig(rawConfig);
9
- for (const plugin of context.plugins) plugin.init?.call(context);
10
- return {
11
- context,
12
- root: options.root ?? (await import("./layouts/root.js")).createRootLayout(),
13
- page: options.page ?? (await import("./layouts/docs.js")).createDocsLayout(),
14
- notFound: options.notFound ?? (await import("fumadocs-ui/layouts/home/not-found")).DefaultNotFound
15
- };
16
- }
17
- const createPages = (base, createPagesOptions) => {
18
- return waku.createPages(async (_fns) => {
19
- const { context, ...layouts } = await init();
20
- const fns = {
21
- ..._fns,
22
- createApiIsomorphic(config) {
23
- if (config.render === "static") _fns.createApi({
24
- render: "static",
25
- method: "GET",
26
- staticPaths: config.staticPaths,
27
- path: config.path,
28
- handler: config.handler
29
- });
30
- else _fns.createApi({
31
- render: "dynamic",
32
- path: config.path,
33
- handlers: { GET: config.handler }
34
- });
35
- }
36
- };
37
- await base(fns);
38
- for (const plugin of context.plugins) await plugin.createPages?.call(context, fns);
39
- const defaultRenderMode = context.mode === "dynamic" ? "dynamic" : "static";
40
- if (context.i18nConfig) {
41
- fns.createRoot({
42
- render: defaultRenderMode,
43
- component({ children }) {
44
- return children;
45
- }
46
- });
47
- fns.createLayout({
48
- render: defaultRenderMode,
49
- path: "/[lang]",
50
- component({ children, lang }) {
51
- return createElement(layouts.root, {
52
- lang,
53
- children,
54
- ...context
55
- });
56
- }
57
- });
58
- fns.createPage({
59
- render: defaultRenderMode,
60
- path: "/[lang]/[...slugs]",
61
- staticPaths: (await context.getLoader()).getPages().map((page) => [page.locale, ...page.slugs]),
62
- component({ slugs, lang }) {
63
- return createElement(layouts.page, {
64
- lang,
65
- slugs,
66
- ...context
67
- });
68
- }
69
- });
70
- fns.createPage({
71
- render: defaultRenderMode,
72
- path: "/[lang]/404",
73
- staticPaths: Object.keys(context.i18nConfig.languages),
74
- component({ lang }) {
75
- return createElement(layouts.notFound, {
76
- lang,
77
- ...context
78
- });
79
- }
80
- });
81
- if (context.mode !== "static") fns.createPage({
82
- render: "dynamic",
83
- path: "/404",
84
- component() {
85
- unstable_redirect(`/${context.i18nConfig.defaultLanguage}`);
86
- }
87
- });
88
- } else {
89
- fns.createRoot({
90
- render: defaultRenderMode,
91
- component({ children }) {
92
- return createElement(layouts.root, {
93
- children,
94
- ...context
95
- });
96
- }
97
- });
98
- fns.createPage({
99
- render: defaultRenderMode,
100
- path: "/[...slugs]",
101
- staticPaths: (await context.getLoader()).getPages().map((page) => page.slugs),
102
- component({ slugs }) {
103
- return createElement(layouts.page, {
104
- slugs,
105
- ...context
106
- });
107
- }
108
- });
109
- fns.createPage({
110
- render: defaultRenderMode,
111
- staticPaths: [],
112
- path: "/404",
113
- component() {
114
- return createElement(layouts.notFound, context);
115
- }
116
- });
117
- }
118
- return null;
119
- }, createPagesOptions);
120
- };
121
- return {
122
- extend: createPages,
123
- createPages() {
124
- return createPages(() => null);
125
- }
126
- };
127
- }
128
- //#endregion
129
- export { createRouter };
package/dist/vite.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { PluginOption } from "vite";
2
-
3
- //#region src/vite.d.ts
4
- declare function press(): PluginOption;
5
- //#endregion
6
- export { press as default };
package/dist/vite.js DELETED
@@ -1,45 +0,0 @@
1
- import { crawlFrameworkPkgs } from "./node_modules/.pnpm/vitefu@1.1.3_vite@8.0.11_@types_node@25.6.2_esbuild@0.28.0_jiti@2.7.0_terser@5.47.1_tsx@4.21.0_yaml@2.8.4_/node_modules/vitefu/src/index.js";
2
- //#region src/vite.ts
3
- function press() {
4
- return pressCore();
5
- }
6
- function pressCore() {
7
- return {
8
- name: "fumapress:core",
9
- async config(_, { command }) {
10
- const out = await crawlFrameworkPkgs({
11
- root: process.cwd(),
12
- isBuild: command === "build",
13
- isFrameworkPkgByName(pkgName) {
14
- if (pkgName.startsWith("@fumapress/") || pkgName.startsWith("@fumadocs/") || pkgName.startsWith("fumadocs-") || pkgName === "fumapress") return true;
15
- }
16
- });
17
- return {
18
- ssr: {
19
- noExternal: out.ssr.noExternal,
20
- external: ["@takumi-rs/image-response"]
21
- },
22
- optimizeDeps: out.optimizeDeps
23
- };
24
- },
25
- async resolveId(source, _importer, options) {
26
- if (source === "virtual:fumapress-core/config") return this.resolve("/press.config", void 0, options);
27
- if (source === "virtual:root.css?inline") return await this.resolve(`/src/app.css?inline`) ?? await this.resolve(`fumapress/css/default.css?inline`);
28
- },
29
- async load(id) {
30
- if (id === "\0virtual:vite-rsc-waku/server-entry-inner") return getManagedServerEntry();
31
- }
32
- };
33
- }
34
- function getManagedServerEntry() {
35
- return `import adapter from 'waku/adapters/default';
36
- import pressConfig from 'virtual:fumapress-core/config';
37
- import { createRouter } from 'fumapress/router';
38
-
39
- const router = createRouter(pressConfig);
40
-
41
- export default adapter(router.createPages());
42
- `;
43
- }
44
- //#endregion
45
- export { press as default };