fumapress 0.5.3 → 0.5.4

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 CHANGED
@@ -202,7 +202,6 @@
202
202
  @source inline("human");
203
203
  @source inline("i");
204
204
  @source inline("i18n");
205
- @source inline("i18nProvider");
206
205
  @source inline("if");
207
206
  @source inline("image");
208
207
  @source inline("imageSizes");
@@ -475,6 +474,7 @@
475
474
  @source inline("truncate");
476
475
  @source inline("type");
477
476
  @source inline("typeof");
477
+ @source inline("uiTranslations");
478
478
  @source inline("undefined");
479
479
  @source inline("unnecessary");
480
480
  @source inline("unoptimized");
package/dist/config.d.ts CHANGED
@@ -3,7 +3,6 @@ import { Adapter, Awaitable, PressLoaderOptions, ServerPluginOption } from "./li
3
3
  import { FC, ReactNode } from "react";
4
4
  import { LoaderConfig, LoaderOutput, Meta, Page, SourceUnion, _Internal } from "fumadocs-core/source";
5
5
  import { I18nConfig, SingularTranslationsAPI, TranslationsAPI } from "fumadocs-core/i18n";
6
- import { Translations } from "fumadocs-ui/i18n";
7
6
  import { BaseLayoutProps } from "fumadocs-ui/layouts/shared";
8
7
 
9
8
  //#region src/config.d.ts
@@ -23,11 +22,7 @@ interface BaseConfig<C extends ConfigContext> {
23
22
  */
24
23
  mode?: BuildMode;
25
24
  site?: SiteConfig;
26
- translations?: (C["i18n"] extends I18nConfig<infer Lang> ? TranslationsAPI<Lang, {
27
- ui: Translations;
28
- }> : never) | SingularTranslationsAPI<{
29
- ui: Translations;
30
- }>;
25
+ translations?: (C["i18n"] extends I18nConfig<infer Lang> ? TranslationsAPI<Lang> : never) | SingularTranslationsAPI;
31
26
  meta?: {
32
27
  /** render meta tags for any pages */root?: (this: AppContext<C>) => ReactNode; /** render meta tags for page */
33
28
  page?: (this: AppContext<C>, page: C["page"]) => ReactNode;
@@ -1,7 +1,7 @@
1
1
  import { getPressContext, renderRootMeta } from "../lib/shared.js";
2
2
  import { PressProvider } from "../components/provider.js";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
- import { i18nProvider } from "fumadocs-ui/i18n";
4
+ import { i18nProvider, uiTranslations } from "fumadocs-ui/i18n";
5
5
  import stylesInline from "virtual:root.css?inline";
6
6
  import stylesHref from "virtual:root.css?url";
7
7
  //#region src/layouts/root.tsx
@@ -19,8 +19,8 @@ function createRootLayout(options) {
19
19
  ...options?.providerProps,
20
20
  children
21
21
  };
22
- if (ctx.translationsConfig && "config" in ctx.translationsConfig) providerProps.i18n ??= i18nProvider(ctx.translationsConfig, lang);
23
- else if (ctx.translationsConfig) providerProps.i18n ??= i18nProvider(ctx.translationsConfig);
22
+ if (ctx.translationsConfig && "config" in ctx.translationsConfig) providerProps.i18n ??= i18nProvider(ctx.translationsConfig.extend(uiTranslations()), lang);
23
+ else if (ctx.translationsConfig) providerProps.i18n ??= i18nProvider(ctx.translationsConfig.extend(uiTranslations()));
24
24
  if (hooks) for (const hook of hooks) providerProps = await hook(providerProps);
25
25
  return /* @__PURE__ */ jsxs("html", {
26
26
  lang: lang ?? "en",
@@ -1,7 +1,7 @@
1
1
  import { __toESM } from "../_virtual/_rolldown/runtime.js";
2
2
  import { getGitRootDir } from "./fs.js";
3
3
  import { require_deepmerge } from "../node_modules/.pnpm/@fastify_deepmerge@3.2.1/node_modules/@fastify/deepmerge/index.js";
4
- import { disableSearchPlugin } from "../plugins/internal/disable-search.js";
4
+ import { applyDefaultsPlugin } from "../plugins/internal/defaults.js";
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  import { Fragment as Fragment$1, isValidElement } from "react";
7
7
  import path from "node:path";
@@ -36,7 +36,7 @@ function resolvePlugins(plugins) {
36
36
  async function initApp(builder) {
37
37
  const config = builder.get();
38
38
  const { translations, site, mode = "default", layouts } = config;
39
- const plugins = resolvePlugins([...config.plugins, disableSearchPlugin()]);
39
+ const plugins = resolvePlugins([...config.plugins, ...applyDefaultsPlugin()]);
40
40
  const ctx = {
41
41
  $context: void 0,
42
42
  getLoader() {
@@ -0,0 +1,21 @@
1
+ import { fumapressTranslations } from "../../i18n.js";
2
+ //#region src/plugins/internal/defaults.ts
3
+ function applyDefaultsPlugin() {
4
+ return [{
5
+ name: "core:i18n",
6
+ init() {
7
+ if (this.translationsConfig) this.translationsConfig.extend(fumapressTranslations());
8
+ }
9
+ }, {
10
+ name: "core:disable-search-if-needed",
11
+ enforce: "post",
12
+ init() {
13
+ (this.data["core:provider"] ??= []).push((data) => {
14
+ data.search ??= { enabled: false };
15
+ return data;
16
+ });
17
+ }
18
+ }];
19
+ }
20
+ //#endregion
21
+ export { applyDefaultsPlugin };
@@ -1,6 +1,7 @@
1
1
  import { isPlainPathname } from "../lib/pathname.js";
2
2
  import { PayloadProvider, WithPayload } from "../components/openapi.payload.js";
3
3
  import { jsx } from "react/jsx-runtime";
4
+ import { openapiTranslations } from "fumadocs-openapi/i18n";
4
5
  //#region src/plugins/openapi.tsx
5
6
  /**
6
7
  * this will register the OpenAPI adapter & required layout configs.
@@ -30,6 +31,7 @@ function openapiPlugin(options) {
30
31
  this.adapters.push(adapter(options));
31
32
  initRenderers(this.data["core:docs-layout"] ??= {});
32
33
  initRenderers(this.data["core:notebook-layout"] ??= {});
34
+ if (this.translationsConfig) this.translationsConfig.extend(openapiTranslations());
33
35
  },
34
36
  renderPage({ page, fallback }) {
35
37
  if (!isOpenAPI(page.data)) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumapress",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "An opinionated docs framework powered by Fumadocs",
5
5
  "keywords": [
6
6
  "Docs",
@@ -56,7 +56,7 @@
56
56
  },
57
57
  "dependencies": {
58
58
  "@orama/orama": "^3.1.18",
59
- "@takumi-rs/image-response": "^1.6.0",
59
+ "@takumi-rs/image-response": "^1.7.0",
60
60
  "class-variance-authority": "^0.7.1",
61
61
  "flexsearch": "^0.8.212",
62
62
  "lucide-react": "^1.17.0",
@@ -74,7 +74,7 @@
74
74
  "@types/react": "^19.2.16",
75
75
  "@types/react-dom": "^19.2.3",
76
76
  "fumadocs-core": "^16.9.3",
77
- "fumadocs-mdx": "^15.0.10",
77
+ "fumadocs-mdx": "^15.0.11",
78
78
  "fumadocs-openapi": "^10.10.3",
79
79
  "fumadocs-ui": "^16.9.3",
80
80
  "hono": "^4.12.23",
@@ -82,7 +82,7 @@
82
82
  "react": "^19.2.7",
83
83
  "react-dom": "^19.2.7",
84
84
  "sharp": "^0.34.5",
85
- "tsdown": "0.22.1",
85
+ "tsdown": "0.22.2",
86
86
  "typescript": "^6.0.3",
87
87
  "waku": "1.0.0-beta.2"
88
88
  },
@@ -97,7 +97,7 @@
97
97
  "react": "^19.2.0",
98
98
  "react-dom": "^19.2.0",
99
99
  "sharp": "^0.34.0",
100
- "waku": "1.0.0-beta.1"
100
+ "waku": "1.0.0-beta.2"
101
101
  },
102
102
  "peerDependenciesMeta": {
103
103
  "sharp": {
@@ -1,15 +0,0 @@
1
- //#region src/plugins/internal/disable-search.ts
2
- function disableSearchPlugin() {
3
- return {
4
- name: "core:disable-search-if-needed",
5
- enforce: "post",
6
- init() {
7
- (this.data["core:provider"] ??= []).push((data) => {
8
- data.search ??= { enabled: false };
9
- return data;
10
- });
11
- }
12
- };
13
- }
14
- //#endregion
15
- export { disableSearchPlugin };