@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/config/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",
|
|
@@ -1450,10 +1450,27 @@ function createBaseNextConfig(options = {}) {
|
|
|
1450
1450
|
const userHeaders = options.headers ? await options.headers() : [];
|
|
1451
1451
|
return [...headers, ...userHeaders];
|
|
1452
1452
|
},
|
|
1453
|
-
// Rewrites
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1453
|
+
// Rewrites — first-party analytics ingest proxy, then user rewrites.
|
|
1454
|
+
//
|
|
1455
|
+
// @djangocfg/analytics POSTs to a RELATIVE /cfg/analytics/collect/ so the beacon
|
|
1456
|
+
// stays same-origin (sendBeacon is unreliable cross-origin). On a split-domain
|
|
1457
|
+
// deploy (Next on one host, Django on `apiUrl`) that same-origin path has no
|
|
1458
|
+
// route here, so every beacon 404s and nothing is ingested — unless we proxy it.
|
|
1459
|
+
// Same-domain and static builds keep apiUrl empty and need no proxy.
|
|
1460
|
+
...apiUrl && !isStaticBuild || options.rewrites ? {
|
|
1461
|
+
async rewrites() {
|
|
1462
|
+
const analyticsProxy = apiUrl && !isStaticBuild ? [{ source: "/cfg/analytics/:path*", destination: `${apiUrl}/cfg/analytics/:path*` }] : [];
|
|
1463
|
+
const user = options.rewrites ? await options.rewrites() : [];
|
|
1464
|
+
if (Array.isArray(user)) {
|
|
1465
|
+
return { beforeFiles: analyticsProxy, afterFiles: user, fallback: [] };
|
|
1466
|
+
}
|
|
1467
|
+
return {
|
|
1468
|
+
beforeFiles: [...analyticsProxy, ...user?.beforeFiles ?? []],
|
|
1469
|
+
afterFiles: user?.afterFiles ?? [],
|
|
1470
|
+
fallback: user?.fallback ?? []
|
|
1471
|
+
};
|
|
1472
|
+
}
|
|
1473
|
+
} : {},
|
|
1457
1474
|
// Redirects for URL normalization
|
|
1458
1475
|
// Fixes "Failed to construct 'URL': Invalid URL" error with double slashes
|
|
1459
1476
|
async redirects() {
|
|
@@ -1551,6 +1568,7 @@ function createBaseNextConfig(options = {}) {
|
|
|
1551
1568
|
allowIframeFrom,
|
|
1552
1569
|
dpop,
|
|
1553
1570
|
stripe,
|
|
1571
|
+
csp,
|
|
1554
1572
|
...nextConfigOptions
|
|
1555
1573
|
} = options;
|
|
1556
1574
|
let finalConfig = deepMerge(baseConfig, nextConfigOptions);
|