fimo-next 2.1.0 → 2.2.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/README.md
CHANGED
|
@@ -15,4 +15,12 @@ never manages Fimo runtime variables.
|
|
|
15
15
|
|
|
16
16
|
Server Components, data functions, and route handlers import from `fimo-next`;
|
|
17
17
|
Client Components import from `fimo-next/client`. The Next configuration
|
|
18
|
-
wrapper for hosted preview origins is available from `fimo-next/config`.
|
|
18
|
+
wrapper for hosted preview origins is available from `fimo-next/config`. If the
|
|
19
|
+
application does not set Next.js's `devIndicators`, it hides the development
|
|
20
|
+
indicator in hosted Previews while leaving local `next dev` unchanged. Explicit
|
|
21
|
+
`devIndicators` settings are preserved:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
const nextConfig = { devIndicators: { position: 'bottom-left' } };
|
|
25
|
+
export default withFimo(nextConfig);
|
|
26
|
+
```
|
package/dist/config.d.ts
CHANGED
|
@@ -7,9 +7,12 @@ export type FimoNextConfig<TConfig extends object = object> = TConfig | FimoNext
|
|
|
7
7
|
/**
|
|
8
8
|
* Connect `next dev` to Fimo's hosted preview gateway. The platform supplies
|
|
9
9
|
* the allowed preview origins at runtime, so applications do not need to know
|
|
10
|
-
* which preview provider Fimo currently uses.
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* which preview provider Fimo currently uses. When an application does not
|
|
11
|
+
* configure Next's development indicator, hosted Preview hides it while local
|
|
12
|
+
* development keeps Next's default. Explicit application config is preserved.
|
|
13
|
+
* Every other phase returns the application config unchanged: the Fimo
|
|
14
|
+
* connection is resolved by `FimoProvider` and the server runtime, not by this
|
|
15
|
+
* config wrapper.
|
|
13
16
|
*/
|
|
14
17
|
export declare function withFimo<TConfig extends object>(applicationConfig: FimoNextConfig<TConfig>): FimoNextConfigFactory<TConfig>;
|
|
15
18
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.js
CHANGED
|
@@ -9,9 +9,12 @@ function readPreviewOrigins() {
|
|
|
9
9
|
/**
|
|
10
10
|
* Connect `next dev` to Fimo's hosted preview gateway. The platform supplies
|
|
11
11
|
* the allowed preview origins at runtime, so applications do not need to know
|
|
12
|
-
* which preview provider Fimo currently uses.
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* which preview provider Fimo currently uses. When an application does not
|
|
13
|
+
* configure Next's development indicator, hosted Preview hides it while local
|
|
14
|
+
* development keeps Next's default. Explicit application config is preserved.
|
|
15
|
+
* Every other phase returns the application config unchanged: the Fimo
|
|
16
|
+
* connection is resolved by `FimoProvider` and the server runtime, not by this
|
|
17
|
+
* config wrapper.
|
|
15
18
|
*/
|
|
16
19
|
export function withFimo(applicationConfig) {
|
|
17
20
|
return async (phase, context) => {
|
|
@@ -20,14 +23,18 @@ export function withFimo(applicationConfig) {
|
|
|
20
23
|
return config;
|
|
21
24
|
}
|
|
22
25
|
const previewOrigins = readPreviewOrigins();
|
|
26
|
+
let developmentConfig = config;
|
|
27
|
+
if (previewOrigins.length > 0 && config.devIndicators === undefined) {
|
|
28
|
+
developmentConfig = { ...config, devIndicators: false };
|
|
29
|
+
}
|
|
23
30
|
if (previewOrigins.length === 0) {
|
|
24
|
-
return
|
|
31
|
+
return developmentConfig;
|
|
25
32
|
}
|
|
26
|
-
const configuredOrigins =
|
|
33
|
+
const configuredOrigins = developmentConfig.allowedDevOrigins;
|
|
27
34
|
const allowedDevOrigins = [
|
|
28
35
|
...(Array.isArray(configuredOrigins) ? configuredOrigins : []),
|
|
29
36
|
...previewOrigins,
|
|
30
37
|
].filter((origin, index, origins) => origins.indexOf(origin) === index);
|
|
31
|
-
return { ...
|
|
38
|
+
return { ...developmentConfig, allowedDevOrigins };
|
|
32
39
|
};
|
|
33
40
|
}
|
|
@@ -24,9 +24,9 @@ export const nextClientContentRuntime = {
|
|
|
24
24
|
},
|
|
25
25
|
headers(extra) {
|
|
26
26
|
const headers = { ...extra };
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
29
|
-
headers['X-Fimo-
|
|
27
|
+
const branch = requireConnection().env;
|
|
28
|
+
if (branch) {
|
|
29
|
+
headers['X-Fimo-Branch'] = branch;
|
|
30
30
|
}
|
|
31
31
|
return headers;
|
|
32
32
|
},
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
export interface FimoConnection {
|
|
8
8
|
/** Tenant content API base URL for the active Fimo Branch, no trailing slash. */
|
|
9
9
|
readonly apiUrl: string;
|
|
10
|
-
/** Branch name sent as `X-Fimo-
|
|
10
|
+
/** Branch name sent as `X-Fimo-Branch`; omitted when the URL already pins a Branch. */
|
|
11
11
|
readonly env?: string;
|
|
12
12
|
/** Locale reads fall back to when neither the call nor the provider names one. */
|
|
13
13
|
readonly defaultLocale?: string;
|
|
@@ -11,9 +11,9 @@ export const nextServerContentRuntime = {
|
|
|
11
11
|
},
|
|
12
12
|
headers(extra) {
|
|
13
13
|
const headers = { ...extra };
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
16
|
-
headers['X-Fimo-
|
|
14
|
+
const branch = resolveConnection().env;
|
|
15
|
+
if (branch) {
|
|
16
|
+
headers['X-Fimo-Branch'] = branch;
|
|
17
17
|
}
|
|
18
18
|
return headers;
|
|
19
19
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fimo-next",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0-staging.10",
|
|
4
4
|
"description": "Fimo runtime for Next.js projects.",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/",
|
|
@@ -45,22 +45,22 @@
|
|
|
45
45
|
"test:watch": "vitest"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@fimo/tsconfig": "2.
|
|
48
|
+
"@fimo/tsconfig": "2.2.0-staging.10",
|
|
49
49
|
"@tanstack/react-query": "^5.80.6",
|
|
50
50
|
"@types/node": "22.18.6",
|
|
51
51
|
"@types/react": "19.2.14",
|
|
52
52
|
"@types/react-dom": "19.2.3",
|
|
53
|
-
"fimo": "2.
|
|
54
|
-
"fimo-react": "2.
|
|
55
|
-
"next": "16.3.
|
|
53
|
+
"fimo": "2.2.0-staging.10",
|
|
54
|
+
"fimo-react": "2.2.0-staging.10",
|
|
55
|
+
"next": "16.3.3",
|
|
56
56
|
"react": "19.2.4",
|
|
57
57
|
"react-dom": "19.2.4",
|
|
58
58
|
"typescript": "7.0.2",
|
|
59
|
-
"vitest": "4.1.
|
|
59
|
+
"vitest": "4.1.11"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"@tanstack/react-query": "^5.80.6",
|
|
63
|
-
"fimo": "
|
|
63
|
+
"fimo": "2.2.0-staging.10",
|
|
64
64
|
"fimo-react": ">=2.0.1",
|
|
65
65
|
"next": "^15.0.0 || ^16.0.0",
|
|
66
66
|
"react": "^18.2.0 || ^19.0.0",
|