fimo 2.4.0-staging.3 → 2.4.0-staging.5

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.
@@ -9,8 +9,8 @@ export const astroServerContentRuntime = {
9
9
  headers(extra) {
10
10
  const headers = { ...extra };
11
11
  // `FIMO_ENV` is the variable name a customer's deployed build reads and
12
- // keeps its spelling; only the header this build emits is canonical
13
- // (branch-cutover ledger, F5). Builds already in production keep sending
12
+ // keeps its spelling; only the header this build emits is canonical.
13
+ // Builds already in production keep sending
14
14
  // `X-Fimo-Env`, which the API still accepts.
15
15
  const branch = import.meta.env.FIMO_ENV?.trim();
16
16
  if (branch) {
@@ -47,7 +47,7 @@ async function fetchEntries(baseUrl, schema, rootDir, locale) {
47
47
  }
48
48
  const headers = {};
49
49
  // `FIMO_ENV` is a customer-facing variable name and keeps its spelling; the
50
- // header this build emits is canonical (branch-cutover ledger, F5). A
50
+ // header this build emits is canonical. A
51
51
  // deployed site always talks to the current API, and builds produced by an
52
52
  // older `fimo` keep sending `X-Fimo-Env`, which the API still accepts.
53
53
  const branch = readEnvValue(rootDir, 'FIMO_ENV') ?? resolveLocalRuntimeEnv({ cwd: rootDir })?.env;
@@ -19,8 +19,7 @@ export declare const PROD_BRANCH_PREFIX = "release/";
19
19
  export declare function isValidBranch(branch: string): boolean;
20
20
  /**
21
21
  * Mirror of `envResourceKey` in `@fimo/api-contracts`. Keeps that name on both
22
- * sides: its OUTPUT is a live tenant hostname and R2 prefix, and the symbol
23
- * rename is a later slice (branch-cutover ledger, F10).
22
+ * sides: its OUTPUT is a live tenant hostname and R2 prefix.
24
23
  */
25
24
  export declare function envResourceKey(branch: string): string;
26
25
  /** Mirror of `buildTenantApiUrl` in `@fimo/api-contracts`. */
@@ -32,15 +31,14 @@ export declare function buildTenantApiUrl(projectId: string, branch: string, ten
32
31
  * reads is one more line to reason about when a site talks to the wrong Branch.
33
32
  *
34
33
  * These are process-env variable names in a CUSTOMER's app; they keep their
35
- * `ENV` spelling (branch-cutover ledger, F3 "Preserve").
34
+ * `ENV` spelling.
36
35
  */
37
36
  export declare const LOCAL_CONTENT_API_ENV_KEYS: readonly ['FIMO_CONTENT_API_URL', 'VITE_API_URL', 'NEXT_PUBLIC_FIMO_API_URL', 'PUBLIC_FIMO_API_URL'];
38
37
  /**
39
38
  * Branch selectors a runtime turns into the Branch request header.
40
39
  *
41
40
  * `FIMO_ENV` / `NEXT_PUBLIC_FIMO_ENV` are the variable names a customer's
42
- * deployed build reads; renaming either breaks it (branch-cutover ledger,
43
- * "Names that must not be mechanically renamed").
41
+ * deployed build reads; renaming either breaks it.
44
42
  */
45
43
  export declare const LOCAL_ENV_SELECTOR_KEYS: readonly ['FIMO_ENV', 'NEXT_PUBLIC_FIMO_ENV'];
46
44
  /**
@@ -46,8 +46,7 @@ function fnv1a8(s) {
46
46
  }
47
47
  /**
48
48
  * Mirror of `envResourceKey` in `@fimo/api-contracts`. Keeps that name on both
49
- * sides: its OUTPUT is a live tenant hostname and R2 prefix, and the symbol
50
- * rename is a later slice (branch-cutover ledger, F10).
49
+ * sides: its OUTPUT is a live tenant hostname and R2 prefix.
51
50
  */
52
51
  export function envResourceKey(branch) {
53
52
  const base = branch
@@ -71,7 +70,7 @@ export function buildTenantApiUrl(projectId, branch, tenantApiBaseUrl) {
71
70
  * reads is one more line to reason about when a site talks to the wrong Branch.
72
71
  *
73
72
  * These are process-env variable names in a CUSTOMER's app; they keep their
74
- * `ENV` spelling (branch-cutover ledger, F3 "Preserve").
73
+ * `ENV` spelling.
75
74
  */
76
75
  export const LOCAL_CONTENT_API_ENV_KEYS = [
77
76
  'FIMO_CONTENT_API_URL',
@@ -83,8 +82,7 @@ export const LOCAL_CONTENT_API_ENV_KEYS = [
83
82
  * Branch selectors a runtime turns into the Branch request header.
84
83
  *
85
84
  * `FIMO_ENV` / `NEXT_PUBLIC_FIMO_ENV` are the variable names a customer's
86
- * deployed build reads; renaming either breaks it (branch-cutover ledger,
87
- * "Names that must not be mechanically renamed").
85
+ * deployed build reads; renaming either breaks it.
88
86
  */
89
87
  export const LOCAL_ENV_SELECTOR_KEYS = ['FIMO_ENV', 'NEXT_PUBLIC_FIMO_ENV'];
90
88
  /**
@@ -2,10 +2,9 @@ export interface ExportStaticOptions {
2
2
  cwd?: string;
3
3
  }
4
4
  /**
5
- * Post-build cleanup for `react-router build` output:
6
- * - Removes `dist/server/` (we ship a fully prerendered SPA, no SSR runtime needed)
7
- * - Removes `*.data` files (data is embedded in the prerendered HTML and
8
- * never fetched because navigation uses full-page <a> loads)
5
+ * Removes `dist/server/` after a static React Router build. Requires
6
+ * `dist/client/` to exist and preserves its contents, including `*.data`
7
+ * files used by React Router client navigation or authored as static assets.
9
8
  *
10
9
  * Run from `react-router build && fimo export-static`.
11
10
  */
@@ -9,23 +9,10 @@ async function pathExists(targetPath) {
9
9
  return false;
10
10
  }
11
11
  }
12
- async function removeDataFiles(dir) {
13
- const entries = await fs.readdir(dir, { withFileTypes: true });
14
- for (const entry of entries) {
15
- const fullPath = path.join(dir, entry.name);
16
- if (entry.isDirectory()) {
17
- await removeDataFiles(fullPath);
18
- }
19
- else if (entry.name.endsWith('.data')) {
20
- await fs.rm(fullPath);
21
- }
22
- }
23
- }
24
12
  /**
25
- * Post-build cleanup for `react-router build` output:
26
- * - Removes `dist/server/` (we ship a fully prerendered SPA, no SSR runtime needed)
27
- * - Removes `*.data` files (data is embedded in the prerendered HTML and
28
- * never fetched because navigation uses full-page <a> loads)
13
+ * Removes `dist/server/` after a static React Router build. Requires
14
+ * `dist/client/` to exist and preserves its contents, including `*.data`
15
+ * files used by React Router client navigation or authored as static assets.
29
16
  *
30
17
  * Run from `react-router build && fimo export-static`.
31
18
  */
@@ -36,12 +23,8 @@ export async function exportStatic(options = {}) {
36
23
  if (!(await pathExists(clientDir))) {
37
24
  throw new Error('Missing dist/client output. Run `react-router build` first.');
38
25
  }
39
- // In framework mode with buildDirectory=dist, the static output already lives in dist/client.
40
26
  if (await pathExists(serverDir)) {
41
27
  await fs.rm(serverDir, { recursive: true, force: true });
42
28
  }
43
- // Remove .data files — all data is embedded in prerendered HTML.
44
- // Navigation uses <a> tags (full page loads), so .data files are never fetched.
45
- await removeDataFiles(clientDir);
46
29
  console.log('Static export complete.');
47
30
  }
@@ -144,6 +144,7 @@ function resolveProjectRuntime(cwd) {
144
144
  version,
145
145
  providesLegacyReactRuntime: packageExportsSubpath(packageJson, './ui'),
146
146
  providesReactRuntime: packageExportsSubpath(readProjectPackage(cwd, 'fimo-react'), '.'),
147
+ providesLegacyNextRuntime: packageExportsSubpath(packageJson, './next') && packageExportsSubpath(packageJson, './next/client'),
147
148
  providesNextRuntime: packageExportsSubpath(readProjectPackage(cwd, 'fimo-next'), '.') &&
148
149
  packageExportsSubpath(readProjectPackage(cwd, 'fimo-next'), './client'),
149
150
  providesAstroRuntime: packageExportsSubpath(packageJson, './astro'),
@@ -154,7 +155,7 @@ function resolveProjectRuntime(cwd) {
154
155
  }
155
156
  function contentRuntimeImportFor(framework, runtime) {
156
157
  if (framework === 'nextjs') {
157
- return 'fimo-next';
158
+ return isVersionAtLeast(runtime.version, MINIMUM_FRAMEWORK_COMPANION_RUNTIME_VERSION) ? 'fimo-next' : 'fimo/next';
158
159
  }
159
160
  if (framework === 'astro') {
160
161
  return 'fimo/astro';
@@ -196,6 +197,12 @@ function resolveSchemaGenerationTarget(runtimeImport, runtime) {
196
197
  if (runtimeImport === 'fimo-react') {
197
198
  return 'react';
198
199
  }
200
+ if (runtimeImport === 'fimo/next' && !runtime.providesLegacyNextRuntime) {
201
+ throw new Error(`Cannot generate schema clients because project-local fimo@${runtime.version} does not provide the ` +
202
+ 'legacy fimo/next and fimo/next/client exports required by this Next.js project. ' +
203
+ `Run \`${CONTENT_CLIENT_RUNTIME_UPGRADE_COMMAND}\` in the project, then run \`npx fimo@latest validate\` again. ` +
204
+ 'No generated files were changed.');
205
+ }
199
206
  if (runtimeImport === 'fimo-next' && !runtime.providesNextRuntime) {
200
207
  throw new Error(`Cannot generate schema clients because the project does not provide the ` +
201
208
  'fimo-next and fimo-next/client exports required by this Next.js project. ' +
@@ -213,7 +220,7 @@ function resolveSchemaGenerationTarget(runtimeImport, runtime) {
213
220
  `Run \`npm install fimo-sveltekit@${runtime.version}\` in the project, then run \`npx fimo@latest validate\` again. ` +
214
221
  'No generated files were changed.');
215
222
  }
216
- if (runtimeImport === 'fimo-next') {
223
+ if (runtimeImport === 'fimo/next' || runtimeImport === 'fimo-next') {
217
224
  return 'next';
218
225
  }
219
226
  return runtimeImport === 'fimo/astro' ? 'astro' : 'sveltekit';
@@ -224,17 +231,17 @@ function templatesForTarget(target, runtime, runtimeImport) {
224
231
  {
225
232
  suffix: '.types.ts',
226
233
  path: templatePath(runtime, 'types'),
227
- runtimeImport: 'fimo-next',
234
+ runtimeImport,
228
235
  },
229
236
  {
230
237
  suffix: '.ts',
231
238
  path: templatePath(runtime, 'nextServer'),
232
- runtimeImport: 'fimo-next',
239
+ runtimeImport,
233
240
  },
234
241
  {
235
242
  suffix: '.client.ts',
236
243
  path: templatePath(runtime, 'nextClient'),
237
- runtimeImport: 'fimo-next/client',
244
+ runtimeImport: `${runtimeImport}/client`,
238
245
  },
239
246
  ];
240
247
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fimo",
3
- "version": "2.4.0-staging.3",
3
+ "version": "2.4.0-staging.5",
4
4
  "description": "Fimo CLI - create, deploy, and manage Fimo projects",
5
5
  "keywords": [
6
6
  "astro-component"
@@ -193,13 +193,13 @@
193
193
  "devDependencies": {
194
194
  "@clack/core": "^1.2.0",
195
195
  "@clack/prompts": "^1.2.0",
196
- "@fimo/agents-bundle": "2.4.0-staging.3",
197
- "@fimo/api-contracts": "2.4.0-staging.3",
198
- "@fimo/cli-kit": "2.4.0-staging.3",
199
- "@fimo/framework-detect": "2.4.0-staging.3",
200
- "@fimo/routes": "2.4.0-staging.3",
201
- "@fimo/sdk": "2.4.0-staging.3",
202
- "@fimo/tsconfig": "2.4.0-staging.3",
196
+ "@fimo/agents-bundle": "2.4.0-staging.5",
197
+ "@fimo/api-contracts": "2.4.0-staging.5",
198
+ "@fimo/cli-kit": "2.4.0-staging.5",
199
+ "@fimo/framework-detect": "2.4.0-staging.5",
200
+ "@fimo/routes": "2.4.0-staging.5",
201
+ "@fimo/sdk": "2.4.0-staging.5",
202
+ "@fimo/tsconfig": "2.4.0-staging.5",
203
203
  "@types/node": "22.18.6",
204
204
  "agent-install": "^0.0.5",
205
205
  "astro": "^7.1.6",
@@ -9,8 +9,8 @@
9
9
  "check": "astro sync && astro check"
10
10
  },
11
11
  "dependencies": {
12
- "fimo": "2.4.0-staging.3",
13
- "fimo-astro": "2.4.0-staging.3"
12
+ "fimo": "2.4.0-staging.5",
13
+ "fimo-astro": "2.4.0-staging.5"
14
14
  },
15
15
  "devDependencies": {
16
16
  "@astrojs/check": "^0.9.10",
@@ -12,9 +12,9 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "@tanstack/react-query": "^5.80.6",
15
- "fimo": "2.4.0-staging.3",
16
- "fimo-next": "2.4.0-staging.3",
17
- "fimo-react": "2.4.0-staging.3",
15
+ "fimo": "2.4.0-staging.5",
16
+ "fimo-next": "2.4.0-staging.5",
17
+ "fimo-react": "2.4.0-staging.5",
18
18
  "next": "^16.3.3",
19
19
  "react": "^19.2.7",
20
20
  "react-dom": "^19.2.7"
@@ -21,10 +21,10 @@
21
21
  "cn": "0.2.4",
22
22
  "date-fns": "^4.1.0",
23
23
  "embla-carousel-react": "^8.6.0",
24
- "fimo": "2.4.0-staging.3",
25
- "fimo-react": "2.4.0-staging.3",
26
- "fimo-react-router": "2.4.0-staging.3",
27
- "fimo-vite": "2.4.0-staging.3",
24
+ "fimo": "2.4.0-staging.5",
25
+ "fimo-react": "2.4.0-staging.5",
26
+ "fimo-react-router": "2.4.0-staging.5",
27
+ "fimo-vite": "2.4.0-staging.5",
28
28
  "input-otp": "^1.4.2",
29
29
  "isbot": "^5",
30
30
  "lucide-react": "^0.577.0",
@@ -11,8 +11,8 @@
11
11
  "prepare": "svelte-kit sync"
12
12
  },
13
13
  "dependencies": {
14
- "fimo": "2.4.0-staging.3",
15
- "fimo-sveltekit": "2.4.0-staging.3"
14
+ "fimo": "2.4.0-staging.5",
15
+ "fimo-sveltekit": "2.4.0-staging.5"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@sveltejs/kit": "^2.70.2",
@@ -11,10 +11,10 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@tanstack/react-query": "^5.80.6",
14
- "fimo": "2.4.0-staging.3",
15
- "fimo-react": "2.4.0-staging.3",
16
- "fimo-react-router": "2.4.0-staging.3",
17
- "fimo-vite": "2.4.0-staging.3",
14
+ "fimo": "2.4.0-staging.5",
15
+ "fimo-react": "2.4.0-staging.5",
16
+ "fimo-react-router": "2.4.0-staging.5",
17
+ "fimo-vite": "2.4.0-staging.5",
18
18
  "react": "^19.2.7",
19
19
  "react-dom": "^19.2.7",
20
20
  "react-router": "^8.3.0"