fimo-next 2.3.2 → 2.4.0-staging.10

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/dist/config.js CHANGED
@@ -6,10 +6,11 @@ function readPreviewOrigins() {
6
6
  .map((origin) => origin.trim())
7
7
  .filter(Boolean);
8
8
  }
9
- // FIMO-2335: `buildFimoMetadata` reads `.fimo/config.json` at request time in
10
- // deployed SSR, but Next only traces files it can see statically — without
11
- // this include the file is missing from the server bundle.
12
- const FIMO_TRACING_INCLUDES = { '/**': ['.fimo/config.json'] };
9
+ // FIMO-2467: runtime config discovery is dynamic, so Next cannot trace current
10
+ // and legacy SEO config paths from the reader alone.
11
+ const FIMO_TRACING_INCLUDES = {
12
+ '/**': ['.fimo/config.json', 'fimo-config.json', 'fimo.config.json'],
13
+ };
13
14
  function withConfigTracing(config) {
14
15
  const application = config.outputFileTracingIncludes;
15
16
  const outputFileTracingIncludes = { ...FIMO_TRACING_INCLUDES };
@@ -0,0 +1,14 @@
1
+ import type { FimoSEO } from 'fimo/seo';
2
+ import type { Metadata, Viewport } from 'next';
3
+ /**
4
+ * Pure conversion to App Router metadata. Does not load config or merge app
5
+ * metadata. Next supplies social title/description and Twitter images from
6
+ * the final page metadata. Undefined SEO returns an empty object.
7
+ */
8
+ export declare function toNextMetadata(seo?: FimoSEO): Metadata;
9
+ /**
10
+ * Pure conversion of themeColor to App Router viewport settings. Next renders
11
+ * theme-color through viewport exports, not metadata exports.
12
+ */
13
+ export declare function toNextViewport(seo?: FimoSEO): Viewport;
14
+ //# sourceMappingURL=seo-metadata.d.ts.map
@@ -0,0 +1,47 @@
1
+ function toMetadataBase(url) {
2
+ if (!url) {
3
+ return undefined;
4
+ }
5
+ try {
6
+ return new URL(url);
7
+ }
8
+ catch {
9
+ return undefined;
10
+ }
11
+ }
12
+ /**
13
+ * Pure conversion to App Router metadata. Does not load config or merge app
14
+ * metadata. Next supplies social title/description and Twitter images from
15
+ * the final page metadata. Undefined SEO returns an empty object.
16
+ */
17
+ export function toNextMetadata(seo) {
18
+ if (!seo) {
19
+ return {};
20
+ }
21
+ const metadataBase = toMetadataBase(seo.url);
22
+ return {
23
+ ...(seo.title ? { title: seo.title } : {}),
24
+ ...(seo.description ? { description: seo.description } : {}),
25
+ ...(metadataBase ? { metadataBase, alternates: { canonical: './' } } : {}),
26
+ ...(seo.robots ? { robots: seo.robots } : {}),
27
+ ...(seo.favicon ? { icons: { icon: seo.favicon, apple: seo.favicon } } : {}),
28
+ openGraph: {
29
+ type: 'website',
30
+ ...(metadataBase ? { url: './' } : {}),
31
+ ...(seo.siteName ? { siteName: seo.siteName } : {}),
32
+ ...(seo.image ? { images: [seo.image] } : {}),
33
+ ...(seo.locale ? { locale: seo.locale } : {}),
34
+ },
35
+ twitter: {
36
+ card: 'summary_large_image',
37
+ ...(seo.twitterSite ? { site: seo.twitterSite } : {}),
38
+ },
39
+ };
40
+ }
41
+ /**
42
+ * Pure conversion of themeColor to App Router viewport settings. Next renders
43
+ * theme-color through viewport exports, not metadata exports.
44
+ */
45
+ export function toNextViewport(seo) {
46
+ return seo?.themeColor ? { themeColor: seo.themeColor } : {};
47
+ }
@@ -1,17 +1,6 @@
1
1
  import type { Metadata, Viewport } from 'next';
2
- /**
3
- * Site-wide `Metadata` defaults resolved from `.fimo/config.json#seo` — the
4
- * values edited in Studio's Settings → SEO. Wire it as the root layout's
5
- * `generateMetadata`. Resolves the global (`/`) SEO only; page-level
6
- * `metadata`/`generateMetadata` exports merge over these defaults, so
7
- * per-page SEO stays application-owned. Returns `{}` when the project
8
- * declares no SEO config.
9
- */
2
+ /** Global defaults only; the optional argument remains a project directory, not a route. */
10
3
  export declare function buildFimoMetadata(rootDir?: string): Metadata;
11
- /**
12
- * Viewport counterpart of `buildFimoMetadata` — Next renders `theme-color`
13
- * from the viewport export, not `Metadata`. Wire it as the root layout's
14
- * `generateViewport`.
15
- */
4
+ /** Global theme color only. Use an explicit route reader for route-specific colors. */
16
5
  export declare function buildFimoViewport(rootDir?: string): Viewport;
17
6
  //# sourceMappingURL=seo.d.ts.map
@@ -1,59 +1,10 @@
1
1
  import { getConfigServer } from 'fimo/config';
2
- import { resolveSeoForPath } from 'fimo/seo';
3
- function toMetadataBase(url) {
4
- if (!url) {
5
- return undefined;
6
- }
7
- try {
8
- return new URL(url);
9
- }
10
- catch {
11
- return undefined;
12
- }
13
- }
14
- /**
15
- * Site-wide `Metadata` defaults resolved from `.fimo/config.json#seo` — the
16
- * values edited in Studio's Settings → SEO. Wire it as the root layout's
17
- * `generateMetadata`. Resolves the global (`/`) SEO only; page-level
18
- * `metadata`/`generateMetadata` exports merge over these defaults, so
19
- * per-page SEO stays application-owned. Returns `{}` when the project
20
- * declares no SEO config.
21
- */
2
+ import { toNextMetadata, toNextViewport } from './seo-metadata.js';
3
+ /** Global defaults only; the optional argument remains a project directory, not a route. */
22
4
  export function buildFimoMetadata(rootDir = process.cwd()) {
23
- const seo = resolveSeoForPath('/', getConfigServer(rootDir));
24
- if (!seo) {
25
- return {};
26
- }
27
- const metadataBase = toMetadataBase(seo.url);
28
- return {
29
- ...(seo.title ? { title: seo.title } : {}),
30
- ...(seo.description ? { description: seo.description } : {}),
31
- ...(metadataBase ? { metadataBase, alternates: { canonical: './' } } : {}),
32
- ...(seo.robots ? { robots: seo.robots } : {}),
33
- ...(seo.favicon ? { icons: { icon: seo.favicon, apple: seo.favicon } } : {}),
34
- openGraph: {
35
- type: 'website',
36
- ...(seo.siteName ? { siteName: seo.siteName } : {}),
37
- ...(seo.title ? { title: seo.title } : {}),
38
- ...(seo.description ? { description: seo.description } : {}),
39
- ...(seo.image ? { images: [seo.image] } : {}),
40
- ...(seo.locale ? { locale: seo.locale } : {}),
41
- },
42
- twitter: {
43
- card: 'summary_large_image',
44
- ...(seo.twitterSite ? { site: seo.twitterSite } : {}),
45
- ...(seo.title ? { title: seo.title } : {}),
46
- ...(seo.description ? { description: seo.description } : {}),
47
- ...(seo.image ? { images: [seo.image] } : {}),
48
- },
49
- };
5
+ return toNextMetadata(getConfigServer(rootDir).seo);
50
6
  }
51
- /**
52
- * Viewport counterpart of `buildFimoMetadata` — Next renders `theme-color`
53
- * from the viewport export, not `Metadata`. Wire it as the root layout's
54
- * `generateViewport`.
55
- */
7
+ /** Global theme color only. Use an explicit route reader for route-specific colors. */
56
8
  export function buildFimoViewport(rootDir = process.cwd()) {
57
- const seo = resolveSeoForPath('/', getConfigServer(rootDir));
58
- return seo?.themeColor ? { themeColor: seo.themeColor } : {};
9
+ return toNextViewport(getConfigServer(rootDir).seo);
59
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fimo-next",
3
- "version": "2.3.2",
3
+ "version": "2.4.0-staging.10",
4
4
  "description": "Fimo runtime for Next.js projects.",
5
5
  "files": [
6
6
  "dist/",
@@ -28,6 +28,10 @@
28
28
  "types": "./dist/runtime/next/client.d.ts",
29
29
  "import": "./dist/runtime/next/client.js"
30
30
  },
31
+ "./seo": {
32
+ "types": "./dist/runtime/next/seo-metadata.d.ts",
33
+ "import": "./dist/runtime/next/seo-metadata.js"
34
+ },
31
35
  "./config": {
32
36
  "types": "./dist/config.d.ts",
33
37
  "import": "./dist/config.js",
@@ -45,13 +49,13 @@
45
49
  "test:watch": "vitest"
46
50
  },
47
51
  "devDependencies": {
48
- "@fimo/tsconfig": "2.3.2",
52
+ "@fimo/tsconfig": "2.4.0-staging.10",
49
53
  "@tanstack/react-query": "^5.80.6",
50
54
  "@types/node": "22.18.6",
51
55
  "@types/react": "19.2.14",
52
56
  "@types/react-dom": "19.2.3",
53
- "fimo": "2.3.2",
54
- "fimo-react": "2.3.2",
57
+ "fimo": "2.4.0-staging.10",
58
+ "fimo-react": "2.4.0-staging.10",
55
59
  "next": "16.3.3",
56
60
  "react": "19.2.4",
57
61
  "react-dom": "19.2.4",
@@ -60,7 +64,7 @@
60
64
  },
61
65
  "peerDependencies": {
62
66
  "@tanstack/react-query": "^5.80.6",
63
- "fimo": ">=2.0.1",
67
+ "fimo": "2.4.0-staging.10",
64
68
  "fimo-react": ">=2.0.1",
65
69
  "next": "^15.0.0 || ^16.0.0",
66
70
  "react": "^18.2.0 || ^19.0.0",