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.
- package/LICENSE +1 -1
- package/css/default.css +4 -4
- package/css/preset.css +1 -1
- package/package.json +14 -13
- package/css/generated.css +0 -98
- package/dist/_virtual/_rolldown/runtime.js +0 -4
- package/dist/adapters/mdx.d.ts +0 -6
- package/dist/adapters/mdx.js +0 -39
- package/dist/components/flexsearch-static.js +0 -24
- package/dist/components/orama-search-static.js +0 -34
- package/dist/config.d.ts +0 -52
- package/dist/config.js +0 -13
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -2
- package/dist/layouts/docs.d.ts +0 -29
- package/dist/layouts/docs.js +0 -67
- package/dist/layouts/home.d.ts +0 -26
- package/dist/layouts/home.js +0 -34
- package/dist/layouts/root.d.ts +0 -7
- package/dist/layouts/root.js +0 -33
- package/dist/lib/fs.js +0 -18
- package/dist/lib/shared.d.ts +0 -38
- package/dist/lib/shared.js +0 -49
- package/dist/lib/types.d.ts +0 -33
- 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
- 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
- package/dist/plugins/flexsearch.d.ts +0 -14
- package/dist/plugins/flexsearch.js +0 -36
- package/dist/plugins/llms.txt.d.ts +0 -11
- package/dist/plugins/llms.txt.js +0 -71
- package/dist/plugins/orama-search.d.ts +0 -14
- package/dist/plugins/orama-search.js +0 -35
- package/dist/plugins/takumi.d.ts +0 -16
- package/dist/plugins/takumi.js +0 -62
- package/dist/router.d.ts +0 -26
- package/dist/router.js +0 -129
- package/dist/vite.d.ts +0 -6
- package/dist/vite.js +0 -45
package/LICENSE
CHANGED
package/css/default.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@import
|
|
2
|
-
@import
|
|
3
|
-
@import
|
|
4
|
-
@import
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
@import "fumadocs-ui/css/neutral.css";
|
|
3
|
+
@import "fumadocs-ui/css/preset.css";
|
|
4
|
+
@import "./preset.css";
|
package/css/preset.css
CHANGED
package/package.json
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumapress",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "An opinionated docs framework powered by Fumadocs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Docs",
|
|
7
7
|
"Fumadocs"
|
|
8
8
|
],
|
|
9
|
-
"homepage": "https://fumadocs.dev",
|
|
9
|
+
"homepage": "https://press.fumadocs.dev",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"author": "Fuma Nama",
|
|
12
|
-
"repository": "github:fuma-nama/
|
|
12
|
+
"repository": "github:fuma-nama/fumapress",
|
|
13
13
|
"files": [
|
|
14
14
|
"dist",
|
|
15
|
-
"css"
|
|
15
|
+
"css",
|
|
16
|
+
"LICENSE.vitefu"
|
|
16
17
|
],
|
|
17
18
|
"type": "module",
|
|
18
19
|
"sideEffects": false,
|
|
@@ -39,26 +40,26 @@
|
|
|
39
40
|
"@orama/orama": "^3.1.18",
|
|
40
41
|
"@takumi-rs/image-response": "^1.1.2",
|
|
41
42
|
"flexsearch": "^0.8.212",
|
|
43
|
+
"fumadocs-core": "^16.8.9",
|
|
44
|
+
"fumadocs-ui": "^16.8.9",
|
|
42
45
|
"lucide-react": "^1.14.0",
|
|
43
|
-
"tailwind-merge": "^3.5.0"
|
|
44
|
-
"fumadocs-core": "16.8.9",
|
|
45
|
-
"fumadocs-ui": "16.8.9"
|
|
46
|
+
"tailwind-merge": "^3.5.0"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
49
|
"@tailwindcss/oxide": "^4.3.0",
|
|
49
50
|
"@types/mdx": "^2.0.13",
|
|
50
51
|
"@types/node": "^25.6.2",
|
|
51
52
|
"@types/react": "^19.2.14",
|
|
53
|
+
"fumadocs-mdx": "^15.0.2",
|
|
52
54
|
"react": "^19.2.6",
|
|
53
55
|
"react-dom": "^19.2.6",
|
|
54
56
|
"tsdown": "0.22.0",
|
|
55
57
|
"typescript": "^6.0.3",
|
|
56
58
|
"vite": "^8.0.11",
|
|
57
|
-
"
|
|
58
|
-
"waku": "1.0.0-alpha.10",
|
|
59
|
-
"fumadocs-mdx": "15.0.1"
|
|
59
|
+
"waku": "1.0.0-alpha.10"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
|
+
"@types/mdx": "*",
|
|
62
63
|
"@types/react": "*",
|
|
63
64
|
"fumadocs-mdx": "^15.0.0",
|
|
64
65
|
"react": "^19.2.0",
|
|
@@ -67,6 +68,9 @@
|
|
|
67
68
|
"waku": "1.0.0-alpha.9"
|
|
68
69
|
},
|
|
69
70
|
"peerDependenciesMeta": {
|
|
71
|
+
"@types/mdx": {
|
|
72
|
+
"optional": true
|
|
73
|
+
},
|
|
70
74
|
"fumadocs-mdx": {
|
|
71
75
|
"optional": true
|
|
72
76
|
},
|
|
@@ -77,9 +81,6 @@
|
|
|
77
81
|
"optional": true
|
|
78
82
|
}
|
|
79
83
|
},
|
|
80
|
-
"inlinedDependencies": {
|
|
81
|
-
"vitefu": "1.1.3"
|
|
82
|
-
},
|
|
83
84
|
"scripts": {
|
|
84
85
|
"dev": "tsdown --watch",
|
|
85
86
|
"build": "tsdown",
|
package/css/generated.css
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
@source inline("@orama/orama");
|
|
2
|
-
@source inline("absolutePath");
|
|
3
|
-
@source inline("adapter");
|
|
4
|
-
@source inline("as");
|
|
5
|
-
@source inline("async");
|
|
6
|
-
@source inline("await");
|
|
7
|
-
@source inline("body");
|
|
8
|
-
@source inline("border-b");
|
|
9
|
-
@source inline("className");
|
|
10
|
-
@source inline("client");
|
|
11
|
-
@source inline("const");
|
|
12
|
-
@source inline("core:docs-layout");
|
|
13
|
-
@source inline("core:home-layout");
|
|
14
|
-
@source inline("core:provider");
|
|
15
|
-
@source inline("core:render-body");
|
|
16
|
-
@source inline("core:render-toc");
|
|
17
|
-
@source inline("create");
|
|
18
|
-
@source inline("createDocsLayout");
|
|
19
|
-
@source inline("createHomeLayout");
|
|
20
|
-
@source inline("createRootLayout");
|
|
21
|
-
@source inline("data");
|
|
22
|
-
@source inline("data-version");
|
|
23
|
-
@source inline("default");
|
|
24
|
-
@source inline("empty");
|
|
25
|
-
@source inline("en");
|
|
26
|
-
@source inline("english");
|
|
27
|
-
@source inline("export");
|
|
28
|
-
@source inline("extends");
|
|
29
|
-
@source inline("flex");
|
|
30
|
-
@source inline("flex-col");
|
|
31
|
-
@source inline("flex-row");
|
|
32
|
-
@source inline("flexsearchStaticClient");
|
|
33
|
-
@source inline("for");
|
|
34
|
-
@source inline("from");
|
|
35
|
-
@source inline("fumadocs-core/source");
|
|
36
|
-
@source inline("fumadocs-core/toc");
|
|
37
|
-
@source inline("function");
|
|
38
|
-
@source inline("gap-2");
|
|
39
|
-
@source inline("githubUrl");
|
|
40
|
-
@source inline("hook");
|
|
41
|
-
@source inline("hooks");
|
|
42
|
-
@source inline("i18n");
|
|
43
|
-
@source inline("if");
|
|
44
|
-
@source inline("import");
|
|
45
|
-
@source inline("in");
|
|
46
|
-
@source inline("interface");
|
|
47
|
-
@source inline("isLoading");
|
|
48
|
-
@source inline("items");
|
|
49
|
-
@source inline("items-center");
|
|
50
|
-
@source inline("lang");
|
|
51
|
-
@source inline("language");
|
|
52
|
-
@source inline("layoutData");
|
|
53
|
-
@source inline("layoutProps");
|
|
54
|
-
@source inline("let");
|
|
55
|
-
@source inline("loaderConfig");
|
|
56
|
-
@source inline("locale");
|
|
57
|
-
@source inline("locales");
|
|
58
|
-
@source inline("markdownUrl");
|
|
59
|
-
@source inline("mb-0");
|
|
60
|
-
@source inline("min-h-screen");
|
|
61
|
-
@source inline("name");
|
|
62
|
-
@source inline("new");
|
|
63
|
-
@source inline("of");
|
|
64
|
-
@source inline("onSearchChange");
|
|
65
|
-
@source inline("option");
|
|
66
|
-
@source inline("page");
|
|
67
|
-
@source inline("pageProps");
|
|
68
|
-
@source inline("pb-6");
|
|
69
|
-
@source inline("providerProps");
|
|
70
|
-
@source inline("pt-2");
|
|
71
|
-
@source inline("query");
|
|
72
|
-
@source inline("r");
|
|
73
|
-
@source inline("react");
|
|
74
|
-
@source inline("render");
|
|
75
|
-
@source inline("renderCtx");
|
|
76
|
-
@source inline("renderPageMeta");
|
|
77
|
-
@source inline("result");
|
|
78
|
-
@source inline("return");
|
|
79
|
-
@source inline("root");
|
|
80
|
-
@source inline("schema");
|
|
81
|
-
@source inline("search");
|
|
82
|
-
@source inline("source");
|
|
83
|
-
@source inline("specify");
|
|
84
|
-
@source inline("static");
|
|
85
|
-
@source inline("string");
|
|
86
|
-
@source inline("styles");
|
|
87
|
-
@source inline("the");
|
|
88
|
-
@source inline("this");
|
|
89
|
-
@source inline("throw");
|
|
90
|
-
@source inline("toc");
|
|
91
|
-
@source inline("translations");
|
|
92
|
-
@source inline("tree");
|
|
93
|
-
@source inline("type");
|
|
94
|
-
@source inline("unknown");
|
|
95
|
-
@source inline("unstable_notFound");
|
|
96
|
-
@source inline("use");
|
|
97
|
-
@source inline("useDocsSearch");
|
|
98
|
-
@source inline("useI18n");
|
package/dist/adapters/mdx.d.ts
DELETED
package/dist/adapters/mdx.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
import defaultMdxComponents, { createRelativeLink } from "fumadocs-ui/mdx";
|
|
3
|
-
//#region src/adapters/mdx.ts
|
|
4
|
-
function fumadocsMdx() {
|
|
5
|
-
return {
|
|
6
|
-
async "core:get-text"(page) {
|
|
7
|
-
if (isAsyncEntry(page.data) || isSyncEntry(page.data)) return page.data.getText("processed");
|
|
8
|
-
},
|
|
9
|
-
async "core:get-structured-data"(page) {
|
|
10
|
-
if (isSyncEntry(page.data)) return page.data.structuredData;
|
|
11
|
-
if (isAsyncEntry(page.data)) return (await page.data.load()).structuredData;
|
|
12
|
-
},
|
|
13
|
-
async "core:render-body"(page) {
|
|
14
|
-
if (isSyncEntry(page.data)) return createElement(page.data.body, { components: {
|
|
15
|
-
...defaultMdxComponents,
|
|
16
|
-
a: createRelativeLink(await this.getLoader(), page)
|
|
17
|
-
} });
|
|
18
|
-
if (isAsyncEntry(page.data)) {
|
|
19
|
-
const { body } = await page.data.load();
|
|
20
|
-
return createElement(body, { components: {
|
|
21
|
-
...defaultMdxComponents,
|
|
22
|
-
a: createRelativeLink(await this.getLoader(), page)
|
|
23
|
-
} });
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
async "core:render-toc"(page) {
|
|
27
|
-
if (isSyncEntry(page.data)) return page.data.toc;
|
|
28
|
-
if (isAsyncEntry(page.data)) return (await page.data.load()).toc;
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
function isSyncEntry(v) {
|
|
33
|
-
return "info" in v && typeof v.info === "object" && "_exports" in v && typeof v._exports === "object";
|
|
34
|
-
}
|
|
35
|
-
function isAsyncEntry(v) {
|
|
36
|
-
return "info" in v && typeof v.info === "object" && "load" in v && typeof v.load === "function";
|
|
37
|
-
}
|
|
38
|
-
//#endregion
|
|
39
|
-
export { fumadocsMdx };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { SearchDialog, SearchDialogClose, SearchDialogContent, SearchDialogHeader, SearchDialogIcon, SearchDialogInput, SearchDialogList, SearchDialogOverlay } from "fumadocs-ui/components/dialog/search";
|
|
4
|
-
import { useDocsSearch } from "fumadocs-core/search/client";
|
|
5
|
-
import { flexsearchStaticClient } from "fumadocs-core/search/client/flexsearch-static";
|
|
6
|
-
import { useI18n } from "fumadocs-ui/contexts/i18n";
|
|
7
|
-
//#region src/components/flexsearch-static.tsx
|
|
8
|
-
function DefaultSearchDialog(props) {
|
|
9
|
-
const { locale } = useI18n();
|
|
10
|
-
const { search, setSearch, query } = useDocsSearch({ client: flexsearchStaticClient({ locale }) });
|
|
11
|
-
return /* @__PURE__ */ jsxs(SearchDialog, {
|
|
12
|
-
search,
|
|
13
|
-
onSearchChange: setSearch,
|
|
14
|
-
isLoading: query.isLoading,
|
|
15
|
-
...props,
|
|
16
|
-
children: [/* @__PURE__ */ jsx(SearchDialogOverlay, {}), /* @__PURE__ */ jsxs(SearchDialogContent, { children: [/* @__PURE__ */ jsxs(SearchDialogHeader, { children: [
|
|
17
|
-
/* @__PURE__ */ jsx(SearchDialogIcon, {}),
|
|
18
|
-
/* @__PURE__ */ jsx(SearchDialogInput, {}),
|
|
19
|
-
/* @__PURE__ */ jsx(SearchDialogClose, {})
|
|
20
|
-
] }), /* @__PURE__ */ jsx(SearchDialogList, { items: query.data !== "empty" ? query.data : null })] })]
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
//#endregion
|
|
24
|
-
export { DefaultSearchDialog as default };
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { SearchDialog, SearchDialogClose, SearchDialogContent, SearchDialogHeader, SearchDialogIcon, SearchDialogInput, SearchDialogList, SearchDialogOverlay } from "fumadocs-ui/components/dialog/search";
|
|
4
|
-
import { useDocsSearch } from "fumadocs-core/search/client";
|
|
5
|
-
import { useI18n } from "fumadocs-ui/contexts/i18n";
|
|
6
|
-
import { create } from "@orama/orama";
|
|
7
|
-
//#region src/components/orama-search-static.tsx
|
|
8
|
-
function initOrama() {
|
|
9
|
-
return create({
|
|
10
|
-
schema: { _: "string" },
|
|
11
|
-
language: "english"
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
function DefaultSearchDialog(props) {
|
|
15
|
-
const { locale } = useI18n();
|
|
16
|
-
const { search, setSearch, query } = useDocsSearch({
|
|
17
|
-
type: "static",
|
|
18
|
-
initOrama,
|
|
19
|
-
locale
|
|
20
|
-
});
|
|
21
|
-
return /* @__PURE__ */ jsxs(SearchDialog, {
|
|
22
|
-
search,
|
|
23
|
-
onSearchChange: setSearch,
|
|
24
|
-
isLoading: query.isLoading,
|
|
25
|
-
...props,
|
|
26
|
-
children: [/* @__PURE__ */ jsx(SearchDialogOverlay, {}), /* @__PURE__ */ jsxs(SearchDialogContent, { children: [/* @__PURE__ */ jsxs(SearchDialogHeader, { children: [
|
|
27
|
-
/* @__PURE__ */ jsx(SearchDialogIcon, {}),
|
|
28
|
-
/* @__PURE__ */ jsx(SearchDialogInput, {}),
|
|
29
|
-
/* @__PURE__ */ jsx(SearchDialogClose, {})
|
|
30
|
-
] }), /* @__PURE__ */ jsx(SearchDialogList, { items: query.data !== "empty" ? query.data : null })] })]
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
//#endregion
|
|
34
|
-
export { DefaultSearchDialog as default };
|
package/dist/config.d.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { AppContext } from "./lib/shared.js";
|
|
2
|
-
import { Adapter, Awaitable, ServerPlugin } from "./lib/types.js";
|
|
3
|
-
import { TranslationsOption } from "fumadocs-ui/contexts/i18n";
|
|
4
|
-
import { LoaderConfig, LoaderOutput } from "fumadocs-core/source";
|
|
5
|
-
import { I18nConfig } from "fumadocs-core/i18n";
|
|
6
|
-
|
|
7
|
-
//#region src/config.d.ts
|
|
8
|
-
interface ConfigContext {
|
|
9
|
-
loaderConfig: LoaderConfig;
|
|
10
|
-
}
|
|
11
|
-
type BuildMode = 'static' | 'dynamic' | 'default';
|
|
12
|
-
interface Config<C extends ConfigContext = ConfigContext> {
|
|
13
|
-
/**
|
|
14
|
-
* - `static`: always prefer static, including search etc.
|
|
15
|
-
* - `dynamic`: always prefer dynamic.
|
|
16
|
-
* - `default`: only certain parts like search routes are dynamic.
|
|
17
|
-
*/
|
|
18
|
-
mode?: BuildMode;
|
|
19
|
-
/** the default content loader */
|
|
20
|
-
loader: LoaderOutput<C['loaderConfig']> | (() => Awaitable<LoaderOutput<C['loaderConfig']>>);
|
|
21
|
-
site?: SiteConfig;
|
|
22
|
-
plugins?: ServerPlugin[] | ((ctx: AppContext<C>) => ServerPlugin[]);
|
|
23
|
-
/** adapter for content sources, use `fumadocs-mdx` if not specified */
|
|
24
|
-
adapters?: Adapter[];
|
|
25
|
-
i18n?: I18nConfig$1;
|
|
26
|
-
}
|
|
27
|
-
interface I18nConfig$1 {
|
|
28
|
-
/** locale code -> language info */
|
|
29
|
-
languages: Record<string, {
|
|
30
|
-
displayName: string;
|
|
31
|
-
translations?: TranslationsOption;
|
|
32
|
-
}>;
|
|
33
|
-
defaultLanguage: string;
|
|
34
|
-
}
|
|
35
|
-
/** convert Fumapress i18n config to core i18n config */
|
|
36
|
-
declare function coreI18n(i18n: I18nConfig$1): I18nConfig;
|
|
37
|
-
interface SiteConfig {
|
|
38
|
-
name?: string;
|
|
39
|
-
git?: {
|
|
40
|
-
user: string;
|
|
41
|
-
repo: string;
|
|
42
|
-
branch: string; /** the root directory of git repo */
|
|
43
|
-
rootDir?: string;
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
declare function defineConfig<C extends LoaderConfig>(config: Config<{
|
|
47
|
-
loaderConfig: C;
|
|
48
|
-
}>): Config<{
|
|
49
|
-
loaderConfig: C;
|
|
50
|
-
}>;
|
|
51
|
-
//#endregion
|
|
52
|
-
export { BuildMode, Config, ConfigContext, I18nConfig$1 as I18nConfig, SiteConfig, coreI18n, defineConfig };
|
package/dist/config.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
//#region src/config.ts
|
|
2
|
-
/** convert Fumapress i18n config to core i18n config */
|
|
3
|
-
function coreI18n(i18n) {
|
|
4
|
-
return {
|
|
5
|
-
defaultLanguage: i18n.defaultLanguage,
|
|
6
|
-
languages: Object.keys(i18n.languages)
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
function defineConfig(config) {
|
|
10
|
-
return config;
|
|
11
|
-
}
|
|
12
|
-
//#endregion
|
|
13
|
-
export { coreI18n, defineConfig };
|
package/dist/index.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { BuildMode, Config, ConfigContext, I18nConfig, SiteConfig, coreI18n, defineConfig } from "./config.js";
|
|
2
|
-
import { AppContext, AppContextData } from "./lib/shared.js";
|
|
3
|
-
import { Adapter, ServerPlugin } from "./lib/types.js";
|
|
4
|
-
export { type Adapter, type AppContext, type AppContextData, BuildMode, Config, ConfigContext, I18nConfig, type ServerPlugin, SiteConfig, coreI18n, defineConfig };
|
package/dist/index.js
DELETED
package/dist/layouts/docs.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { ConfigContext } from "../config.js";
|
|
2
|
-
import { Layouts } from "../router.js";
|
|
3
|
-
import { AppContext } from "../lib/shared.js";
|
|
4
|
-
import { Awaitable } from "../lib/types.js";
|
|
5
|
-
import { ReactNode } from "react";
|
|
6
|
-
import { DocsLayoutProps } from "fumadocs-ui/layouts/docs";
|
|
7
|
-
import { DocsPageProps } from "fumadocs-ui/layouts/docs/page";
|
|
8
|
-
import { Page } from "fumadocs-core/source";
|
|
9
|
-
|
|
10
|
-
//#region src/layouts/docs.d.ts
|
|
11
|
-
interface DocsLayoutOptions<C extends ConfigContext = ConfigContext> {
|
|
12
|
-
render?: (this: AppContext<C>, page: C['loaderConfig']['page']) => Awaitable<Partial<DocsLayoutRenderData>>;
|
|
13
|
-
}
|
|
14
|
-
interface DocsLayoutRenderData {
|
|
15
|
-
markdownUrl?: string;
|
|
16
|
-
body: ReactNode;
|
|
17
|
-
layoutProps: DocsLayoutProps;
|
|
18
|
-
pageProps?: DocsPageProps;
|
|
19
|
-
}
|
|
20
|
-
interface DocsLayoutContextData {
|
|
21
|
-
renderers?: ((this: {
|
|
22
|
-
page: Page;
|
|
23
|
-
}, data: DocsLayoutRenderData) => Awaitable<DocsLayoutRenderData>)[];
|
|
24
|
-
}
|
|
25
|
-
declare function createDocsLayout<C extends ConfigContext = ConfigContext>({
|
|
26
|
-
render
|
|
27
|
-
}?: DocsLayoutOptions<C>): Layouts<C>['page'];
|
|
28
|
-
//#endregion
|
|
29
|
-
export { DocsLayoutContextData, DocsLayoutOptions, DocsLayoutRenderData, createDocsLayout };
|
package/dist/layouts/docs.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { baseOptions, getGitHubFileUrl, renderPageMeta } from "../lib/shared.js";
|
|
2
|
-
import { unstable_notFound } from "waku/router/server";
|
|
3
|
-
import { DocsLayout } from "fumadocs-ui/layouts/docs";
|
|
4
|
-
import { DocsBody, DocsDescription, DocsPage, DocsTitle, MarkdownCopyButton, ViewOptionsPopover } from "fumadocs-ui/layouts/docs/page";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
//#region src/layouts/docs.tsx
|
|
7
|
-
function createDocsLayout({ render = async function defaultRender(page) {
|
|
8
|
-
let body;
|
|
9
|
-
let toc;
|
|
10
|
-
for (const adapter of this.adapters) {
|
|
11
|
-
body = await adapter["core:render-body"]?.call(this, page);
|
|
12
|
-
if (body !== void 0) break;
|
|
13
|
-
}
|
|
14
|
-
for (const adapter of this.adapters) {
|
|
15
|
-
toc = await adapter["core:render-toc"]?.call(this, page);
|
|
16
|
-
if (toc !== void 0) break;
|
|
17
|
-
}
|
|
18
|
-
if (body === void 0) throw new Error("[Fumapress] Please specify the `render` option in createDocsLayout()");
|
|
19
|
-
return {
|
|
20
|
-
body,
|
|
21
|
-
pageProps: { toc }
|
|
22
|
-
};
|
|
23
|
-
} } = {}) {
|
|
24
|
-
return async function Layout(props) {
|
|
25
|
-
const { slugs, lang, getLoader, data: { "core:docs-layout": layoutData } } = props;
|
|
26
|
-
const source = await getLoader();
|
|
27
|
-
const page = source.getPage(slugs, lang);
|
|
28
|
-
if (!page) unstable_notFound();
|
|
29
|
-
let result = await render.call(props, page);
|
|
30
|
-
result.layoutProps ??= {
|
|
31
|
-
tree: source.getPageTree(lang),
|
|
32
|
-
...baseOptions(props)
|
|
33
|
-
};
|
|
34
|
-
if (layoutData?.renderers) {
|
|
35
|
-
const renderCtx = { page };
|
|
36
|
-
for (const r of layoutData.renderers) result = await r.call(renderCtx, result);
|
|
37
|
-
}
|
|
38
|
-
return /* @__PURE__ */ jsxs(DocsLayout, {
|
|
39
|
-
...result.layoutProps,
|
|
40
|
-
children: [
|
|
41
|
-
renderPageMeta(page, props),
|
|
42
|
-
result.layoutProps.children,
|
|
43
|
-
/* @__PURE__ */ jsxs(DocsPage, {
|
|
44
|
-
...result.pageProps,
|
|
45
|
-
children: [
|
|
46
|
-
result.pageProps?.children,
|
|
47
|
-
/* @__PURE__ */ jsx(DocsTitle, { children: page.data.title }),
|
|
48
|
-
/* @__PURE__ */ jsx(DocsDescription, {
|
|
49
|
-
className: "mb-0",
|
|
50
|
-
children: page.data.description
|
|
51
|
-
}),
|
|
52
|
-
/* @__PURE__ */ jsxs("div", {
|
|
53
|
-
className: "flex flex-row gap-2 items-center border-b pt-2 pb-6",
|
|
54
|
-
children: [result.markdownUrl && /* @__PURE__ */ jsx(MarkdownCopyButton, { markdownUrl: result.markdownUrl }), /* @__PURE__ */ jsx(ViewOptionsPopover, {
|
|
55
|
-
markdownUrl: result.markdownUrl,
|
|
56
|
-
githubUrl: page.absolutePath ? getGitHubFileUrl(props, page.absolutePath) : void 0
|
|
57
|
-
})]
|
|
58
|
-
}),
|
|
59
|
-
/* @__PURE__ */ jsx(DocsBody, { children: result.body })
|
|
60
|
-
]
|
|
61
|
-
})
|
|
62
|
-
]
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
//#endregion
|
|
67
|
-
export { createDocsLayout };
|
package/dist/layouts/home.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ConfigContext } from "../config.js";
|
|
2
|
-
import { Layouts } from "../router.js";
|
|
3
|
-
import { AppContext } from "../lib/shared.js";
|
|
4
|
-
import { Awaitable } from "../lib/types.js";
|
|
5
|
-
import { ReactNode } from "react";
|
|
6
|
-
import { HomeLayoutProps } from "fumadocs-ui/layouts/home";
|
|
7
|
-
import { Page } from "fumadocs-core/source";
|
|
8
|
-
|
|
9
|
-
//#region src/layouts/home.d.ts
|
|
10
|
-
interface HomeLayoutOptions<C extends ConfigContext = ConfigContext> {
|
|
11
|
-
render?: (this: AppContext<C>, page: C['loaderConfig']['page']) => Awaitable<Partial<HomeLayoutRenderData>>;
|
|
12
|
-
}
|
|
13
|
-
interface HomeLayoutRenderData {
|
|
14
|
-
body: ReactNode;
|
|
15
|
-
layoutProps: HomeLayoutProps;
|
|
16
|
-
}
|
|
17
|
-
interface HomeLayoutContextData {
|
|
18
|
-
renderers?: ((this: {
|
|
19
|
-
page: Page;
|
|
20
|
-
}, data: HomeLayoutRenderData) => Awaitable<HomeLayoutRenderData>)[];
|
|
21
|
-
}
|
|
22
|
-
declare function createHomeLayout<C extends ConfigContext = ConfigContext>({
|
|
23
|
-
render
|
|
24
|
-
}: HomeLayoutOptions<C>): Layouts<C>['page'];
|
|
25
|
-
//#endregion
|
|
26
|
-
export { HomeLayoutContextData, HomeLayoutOptions, HomeLayoutRenderData, createHomeLayout };
|
package/dist/layouts/home.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { baseOptions, renderPageMeta } from "../lib/shared.js";
|
|
2
|
-
import { unstable_notFound } from "waku/router/server";
|
|
3
|
-
import { jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { HomeLayout } from "fumadocs-ui/layouts/home";
|
|
5
|
-
//#region src/layouts/home.tsx
|
|
6
|
-
function createHomeLayout({ render = async function renderDefault(page) {
|
|
7
|
-
for (const adapter of this.adapters) {
|
|
8
|
-
const body = await adapter["core:render-body"]?.call(this, page);
|
|
9
|
-
if (body !== void 0) return { body };
|
|
10
|
-
}
|
|
11
|
-
throw new Error("[Fumapress] Please specify the `render` option in createHomeLayout()");
|
|
12
|
-
} }) {
|
|
13
|
-
return async function Layout(props) {
|
|
14
|
-
const { slugs, lang, getLoader, data: { "core:home-layout": layoutData } } = props;
|
|
15
|
-
const page = (await getLoader()).getPage(slugs, lang);
|
|
16
|
-
if (!page) unstable_notFound();
|
|
17
|
-
let result = await render.call(props, page);
|
|
18
|
-
result.layoutProps ??= baseOptions(props);
|
|
19
|
-
if (layoutData?.renderers) {
|
|
20
|
-
const renderCtx = { page };
|
|
21
|
-
for (const r of layoutData.renderers) result = await r.call(renderCtx, result);
|
|
22
|
-
}
|
|
23
|
-
return /* @__PURE__ */ jsxs(HomeLayout, {
|
|
24
|
-
...result.layoutProps,
|
|
25
|
-
children: [
|
|
26
|
-
result.layoutProps.children,
|
|
27
|
-
renderPageMeta(page, props),
|
|
28
|
-
result.body
|
|
29
|
-
]
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
//#endregion
|
|
34
|
-
export { createHomeLayout };
|
package/dist/layouts/root.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ConfigContext } from "../config.js";
|
|
2
|
-
import { Layouts } from "../router.js";
|
|
3
|
-
|
|
4
|
-
//#region src/layouts/root.d.ts
|
|
5
|
-
declare function createRootLayout<C extends ConfigContext = ConfigContext>(): Layouts<C>['root'];
|
|
6
|
-
//#endregion
|
|
7
|
-
export { createRootLayout };
|
package/dist/layouts/root.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import styles from "virtual:root.css?inline";
|
|
3
|
-
import { RootProvider } from "fumadocs-ui/provider/waku";
|
|
4
|
-
//#region src/layouts/root.tsx
|
|
5
|
-
function createRootLayout() {
|
|
6
|
-
return async function({ children, lang, i18nConfig, data }) {
|
|
7
|
-
const hooks = data["core:provider"];
|
|
8
|
-
let providerProps = {};
|
|
9
|
-
if (i18nConfig) providerProps.i18n = {
|
|
10
|
-
locale: lang,
|
|
11
|
-
locales: Object.entries(i18nConfig.languages).map(([k, v]) => ({
|
|
12
|
-
name: v.displayName,
|
|
13
|
-
locale: k
|
|
14
|
-
})),
|
|
15
|
-
translations: lang ? i18nConfig.languages[lang]?.translations : void 0
|
|
16
|
-
};
|
|
17
|
-
if (hooks) for (const hook of hooks) providerProps = await hook(providerProps);
|
|
18
|
-
return /* @__PURE__ */ jsxs("html", {
|
|
19
|
-
lang: lang ?? "en",
|
|
20
|
-
suppressHydrationWarning: true,
|
|
21
|
-
children: [/* @__PURE__ */ jsx("head", { children: /* @__PURE__ */ jsx("style", { children: styles }) }), /* @__PURE__ */ jsx("body", {
|
|
22
|
-
"data-version": "1.0",
|
|
23
|
-
className: "flex flex-col min-h-screen",
|
|
24
|
-
children: /* @__PURE__ */ jsx(RootProvider, {
|
|
25
|
-
...providerProps,
|
|
26
|
-
children
|
|
27
|
-
})
|
|
28
|
-
})]
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
//#endregion
|
|
33
|
-
export { createRootLayout };
|
package/dist/lib/fs.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
|
-
import { dirname, join } from "node:path";
|
|
3
|
-
//#region src/lib/fs.ts
|
|
4
|
-
/**
|
|
5
|
-
* Returns the absolute path to the root directory of the current git repository.
|
|
6
|
-
*/
|
|
7
|
-
function getGitRootDir(startDir = process.cwd()) {
|
|
8
|
-
let dir = startDir;
|
|
9
|
-
while (true) {
|
|
10
|
-
if (existsSync(join(dir, ".git"))) return dir;
|
|
11
|
-
const parent = dirname(dir);
|
|
12
|
-
if (parent === dir) break;
|
|
13
|
-
dir = parent;
|
|
14
|
-
}
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
//#endregion
|
|
18
|
-
export { getGitRootDir };
|
package/dist/lib/shared.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { BuildMode, ConfigContext, I18nConfig } from "../config.js";
|
|
2
|
-
import { DocsLayoutContextData } from "../layouts/docs.js";
|
|
3
|
-
import { HomeLayoutContextData } from "../layouts/home.js";
|
|
4
|
-
import { Adapter, Awaitable, ServerPlugin } from "./types.js";
|
|
5
|
-
import { ReactNode } from "react";
|
|
6
|
-
import { RootProviderProps } from "fumadocs-ui/provider/waku";
|
|
7
|
-
import { LoaderOutput, Page } from "fumadocs-core/source";
|
|
8
|
-
//#region src/lib/shared.d.ts
|
|
9
|
-
interface AppContext<C extends ConfigContext = ConfigContext> {
|
|
10
|
-
mode: BuildMode;
|
|
11
|
-
getLoader: () => Awaitable<LoaderOutput<C['loaderConfig']>>;
|
|
12
|
-
plugins: ServerPlugin[];
|
|
13
|
-
adapters: Adapter[];
|
|
14
|
-
/** always `undefined`, easier way to infer types */
|
|
15
|
-
$context: C;
|
|
16
|
-
/**
|
|
17
|
-
* custom data in app context, can be referenced from plugins/pages etc
|
|
18
|
-
*/
|
|
19
|
-
data: AppContextData & Record<string, unknown>;
|
|
20
|
-
i18nConfig?: I18nConfig;
|
|
21
|
-
siteConfig: {
|
|
22
|
-
name: string;
|
|
23
|
-
git?: {
|
|
24
|
-
user: string;
|
|
25
|
-
repo: string;
|
|
26
|
-
branch: string;
|
|
27
|
-
rootDir: string;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
interface AppContextData {
|
|
32
|
-
'core:page-meta'?: ((page: Page) => ReactNode)[];
|
|
33
|
-
'core:docs-layout'?: DocsLayoutContextData;
|
|
34
|
-
'core:home-layout'?: HomeLayoutContextData;
|
|
35
|
-
'core:provider'?: ((props: RootProviderProps) => Awaitable<RootProviderProps>)[];
|
|
36
|
-
}
|
|
37
|
-
//#endregion
|
|
38
|
-
export { AppContext, AppContextData };
|