@djangocfg/nextjs 2.1.4 → 2.1.6
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/package.json +5 -5
- package/src/ai/cli.ts +0 -0
- package/src/config/constants.ts +6 -11
- package/src/config/createNextConfig.ts +43 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/nextjs",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.6",
|
|
4
4
|
"description": "Next.js server utilities: sitemap, health, OG images, contact forms, navigation, config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nextjs",
|
|
@@ -104,13 +104,13 @@
|
|
|
104
104
|
"ai-docs": "tsx src/ai/cli.ts"
|
|
105
105
|
},
|
|
106
106
|
"peerDependencies": {
|
|
107
|
-
"@djangocfg/api": "^2.1.
|
|
107
|
+
"@djangocfg/api": "^2.1.6",
|
|
108
108
|
"next": "^15.5.7"
|
|
109
109
|
},
|
|
110
110
|
"devDependencies": {
|
|
111
|
-
"@djangocfg/imgai": "^2.1.
|
|
112
|
-
"@djangocfg/layouts": "^2.1.
|
|
113
|
-
"@djangocfg/typescript-config": "^2.1.
|
|
111
|
+
"@djangocfg/imgai": "^2.1.6",
|
|
112
|
+
"@djangocfg/layouts": "^2.1.6",
|
|
113
|
+
"@djangocfg/typescript-config": "^2.1.6",
|
|
114
114
|
"@types/node": "^24.7.2",
|
|
115
115
|
"@types/react": "19.2.2",
|
|
116
116
|
"@types/react-dom": "19.2.1",
|
package/src/ai/cli.ts
CHANGED
|
File without changes
|
package/src/config/constants.ts
CHANGED
|
@@ -10,17 +10,12 @@ export const VERSION_CACHE_TTL_MS = 60 * 60 * 1000;
|
|
|
10
10
|
|
|
11
11
|
// ASCII Art Banner for Django CFG
|
|
12
12
|
export const DJANGO_CFG_BANNER = `
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
Y88b 888 888 888 888 888 888 Y88b 888 Y88..88P Y88b. 888 Y88b 888
|
|
20
|
-
"Y88888 888 "Y888888 888 888 "Y88888 "Y88P" "Y8888P 888 "Y88888
|
|
21
|
-
888 888 888
|
|
22
|
-
d88P Y8b d88P Y8b d88P
|
|
23
|
-
888P" "Y88P" "Y88P"
|
|
13
|
+
██████╗ ██╗ █████╗ ███╗ ██╗ ██████╗ ██████╗ ██████╗███████╗ ██████╗
|
|
14
|
+
██╔══██╗ ██║██╔══██╗████╗ ██║██╔════╝ ██╔═══██╗ ██╔════╝██╔════╝██╔════╝
|
|
15
|
+
██║ ██║ ██║███████║██╔██╗ ██║██║ ███╗██║ ██║ ██║ █████╗ ██║ ███╗
|
|
16
|
+
██║ ██║██ ██║██╔══██║██║╚██╗██║██║ ██║██║ ██║ ██║ ██╔══╝ ██║ ██║
|
|
17
|
+
██████╔╝╚█████╔╝██║ ██║██║ ╚████║╚██████╔╝╚██████╔╝ ╚██████╗██║ ╚██████╔╝
|
|
18
|
+
╚═════╝ ╚════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚═════╝ ╚═════╝╚═╝ ╚═════╝
|
|
24
19
|
`;
|
|
25
20
|
|
|
26
21
|
// All @djangocfg packages that can be updated together
|
|
@@ -53,6 +53,11 @@ export interface BaseNextConfigOptions {
|
|
|
53
53
|
checkPackages?: boolean;
|
|
54
54
|
/** Auto-install missing packages without prompting (default: false) */
|
|
55
55
|
autoInstall?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Allow embedding this app in iframe from specified origins
|
|
58
|
+
* Set to ['*'] to allow all origins, or specify domains like ['https://djangocfg.com']
|
|
59
|
+
*/
|
|
60
|
+
allowIframeFrom?: string[];
|
|
56
61
|
/** Custom webpack configuration function (called after base webpack logic) */
|
|
57
62
|
webpack?: (
|
|
58
63
|
config: WebpackConfig,
|
|
@@ -118,6 +123,43 @@ export function createBaseNextConfig(
|
|
|
118
123
|
unoptimized: true,
|
|
119
124
|
},
|
|
120
125
|
|
|
126
|
+
// CORS headers for static files and iframe embedding
|
|
127
|
+
async headers() {
|
|
128
|
+
const headers: { source: string; headers: { key: string; value: string }[] }[] = [
|
|
129
|
+
{
|
|
130
|
+
source: '/static/:path*',
|
|
131
|
+
headers: [
|
|
132
|
+
{ key: 'Access-Control-Allow-Origin', value: '*' },
|
|
133
|
+
{ key: 'Access-Control-Allow-Methods', value: 'GET, OPTIONS' },
|
|
134
|
+
{ key: 'Access-Control-Allow-Headers', value: 'Origin, Content-Type, Accept' },
|
|
135
|
+
],
|
|
136
|
+
},
|
|
137
|
+
];
|
|
138
|
+
|
|
139
|
+
// Add iframe embedding headers if allowIframeFrom is specified
|
|
140
|
+
if (options.allowIframeFrom && options.allowIframeFrom.length > 0) {
|
|
141
|
+
const frameAncestors = options.allowIframeFrom.includes('*')
|
|
142
|
+
? '*'
|
|
143
|
+
: `'self' ${options.allowIframeFrom.join(' ')}`;
|
|
144
|
+
|
|
145
|
+
headers.push({
|
|
146
|
+
source: '/:path*',
|
|
147
|
+
headers: [
|
|
148
|
+
// Content-Security-Policy frame-ancestors directive
|
|
149
|
+
{ key: 'Content-Security-Policy', value: `frame-ancestors ${frameAncestors}` },
|
|
150
|
+
// X-Frame-Options for older browsers (ALLOW-FROM is deprecated, use CSP instead)
|
|
151
|
+
// Only set SAMEORIGIN if allowing all, otherwise browsers will use CSP
|
|
152
|
+
...(options.allowIframeFrom.includes('*')
|
|
153
|
+
? []
|
|
154
|
+
: [{ key: 'X-Frame-Options', value: 'SAMEORIGIN' }]
|
|
155
|
+
),
|
|
156
|
+
],
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return headers;
|
|
161
|
+
},
|
|
162
|
+
|
|
121
163
|
// Transpile packages (merge with user-provided)
|
|
122
164
|
transpilePackages: [
|
|
123
165
|
...DEFAULT_TRANSPILE_PACKAGES,
|
|
@@ -204,6 +246,7 @@ export function createBaseNextConfig(
|
|
|
204
246
|
delete (finalConfig as any).forceCheckWorkspace;
|
|
205
247
|
delete (finalConfig as any).checkPackages;
|
|
206
248
|
delete (finalConfig as any).autoInstall;
|
|
249
|
+
delete (finalConfig as any).allowIframeFrom;
|
|
207
250
|
|
|
208
251
|
return finalConfig;
|
|
209
252
|
}
|