@djangocfg/nextjs 2.1.472 → 2.1.474
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/index.mjs +23 -5
- package/dist/config/index.mjs.map +1 -1
- package/dist/i18n/routing.d.mts +2 -2
- package/dist/index.mjs +23 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
- package/src/config/createNextConfig.ts +28 -4
package/dist/i18n/routing.d.mts
CHANGED
|
@@ -24,7 +24,6 @@ declare function createRouting(config?: Partial<I18nConfig>): {
|
|
|
24
24
|
localePrefix?: next_intl_routing.LocalePrefix<string[], "always" | "as-needed" | "never">;
|
|
25
25
|
domains?: never;
|
|
26
26
|
localeCookie?: boolean | {
|
|
27
|
-
name?: string;
|
|
28
27
|
maxAge?: number | undefined;
|
|
29
28
|
priority?: "low" | "medium" | "high" | undefined;
|
|
30
29
|
domain?: string | undefined;
|
|
@@ -32,6 +31,7 @@ declare function createRouting(config?: Partial<I18nConfig>): {
|
|
|
32
31
|
secure?: boolean | undefined;
|
|
33
32
|
sameSite?: true | false | "lax" | "strict" | "none" | undefined;
|
|
34
33
|
partitioned?: boolean | undefined;
|
|
34
|
+
name?: string;
|
|
35
35
|
};
|
|
36
36
|
alternateLinks?: boolean;
|
|
37
37
|
localeDetection?: boolean;
|
|
@@ -46,7 +46,6 @@ declare const routing: {
|
|
|
46
46
|
localePrefix?: next_intl_routing.LocalePrefix<string[], "always" | "as-needed" | "never">;
|
|
47
47
|
domains?: never;
|
|
48
48
|
localeCookie?: boolean | {
|
|
49
|
-
name?: string;
|
|
50
49
|
maxAge?: number | undefined;
|
|
51
50
|
priority?: "low" | "medium" | "high" | undefined;
|
|
52
51
|
domain?: string | undefined;
|
|
@@ -54,6 +53,7 @@ declare const routing: {
|
|
|
54
53
|
secure?: boolean | undefined;
|
|
55
54
|
sameSite?: true | false | "lax" | "strict" | "none" | undefined;
|
|
56
55
|
partitioned?: boolean | undefined;
|
|
56
|
+
name?: string;
|
|
57
57
|
};
|
|
58
58
|
alternateLinks?: boolean;
|
|
59
59
|
localeDetection?: boolean;
|
package/dist/index.mjs
CHANGED
|
@@ -14,7 +14,7 @@ var require_package = __commonJS({
|
|
|
14
14
|
"package.json"(exports, module) {
|
|
15
15
|
module.exports = {
|
|
16
16
|
name: "@djangocfg/nextjs",
|
|
17
|
-
version: "2.1.
|
|
17
|
+
version: "2.1.474",
|
|
18
18
|
description: "Next.js server utilities: sitemap, health, OG images, contact forms, navigation, config",
|
|
19
19
|
keywords: [
|
|
20
20
|
"nextjs",
|
|
@@ -1724,10 +1724,27 @@ function createBaseNextConfig(options = {}) {
|
|
|
1724
1724
|
const userHeaders = options.headers ? await options.headers() : [];
|
|
1725
1725
|
return [...headers, ...userHeaders];
|
|
1726
1726
|
},
|
|
1727
|
-
// Rewrites
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1727
|
+
// Rewrites — first-party analytics ingest proxy, then user rewrites.
|
|
1728
|
+
//
|
|
1729
|
+
// @djangocfg/analytics POSTs to a RELATIVE /cfg/analytics/collect/ so the beacon
|
|
1730
|
+
// stays same-origin (sendBeacon is unreliable cross-origin). On a split-domain
|
|
1731
|
+
// deploy (Next on one host, Django on `apiUrl`) that same-origin path has no
|
|
1732
|
+
// route here, so every beacon 404s and nothing is ingested — unless we proxy it.
|
|
1733
|
+
// Same-domain and static builds keep apiUrl empty and need no proxy.
|
|
1734
|
+
...apiUrl && !isStaticBuild || options.rewrites ? {
|
|
1735
|
+
async rewrites() {
|
|
1736
|
+
const analyticsProxy = apiUrl && !isStaticBuild ? [{ source: "/cfg/analytics/:path*", destination: `${apiUrl}/cfg/analytics/:path*` }] : [];
|
|
1737
|
+
const user = options.rewrites ? await options.rewrites() : [];
|
|
1738
|
+
if (Array.isArray(user)) {
|
|
1739
|
+
return { beforeFiles: analyticsProxy, afterFiles: user, fallback: [] };
|
|
1740
|
+
}
|
|
1741
|
+
return {
|
|
1742
|
+
beforeFiles: [...analyticsProxy, ...user?.beforeFiles ?? []],
|
|
1743
|
+
afterFiles: user?.afterFiles ?? [],
|
|
1744
|
+
fallback: user?.fallback ?? []
|
|
1745
|
+
};
|
|
1746
|
+
}
|
|
1747
|
+
} : {},
|
|
1731
1748
|
// Redirects for URL normalization
|
|
1732
1749
|
// Fixes "Failed to construct 'URL': Invalid URL" error with double slashes
|
|
1733
1750
|
async redirects() {
|
|
@@ -1825,6 +1842,7 @@ function createBaseNextConfig(options = {}) {
|
|
|
1825
1842
|
allowIframeFrom,
|
|
1826
1843
|
dpop,
|
|
1827
1844
|
stripe,
|
|
1845
|
+
csp,
|
|
1828
1846
|
...nextConfigOptions
|
|
1829
1847
|
} = options;
|
|
1830
1848
|
let finalConfig = deepMerge(baseConfig, nextConfigOptions);
|