@djangocfg/nextjs 2.1.30 → 2.1.32
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 +66 -0
- package/dist/config/index.d.mts +405 -2
- package/dist/config/index.mjs +388 -9
- package/dist/config/index.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +388 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -10
- package/src/config/createNextConfig.ts +15 -1
- package/src/config/index.ts +18 -0
- package/src/config/plugins/index.ts +1 -0
- package/src/config/plugins/pwa.ts +616 -0
- package/src/config/utils/index.ts +1 -0
- package/src/config/utils/manifest.ts +195 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/nextjs",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.32",
|
|
4
4
|
"description": "Next.js server utilities: sitemap, health, OG images, contact forms, navigation, config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nextjs",
|
|
@@ -101,10 +101,17 @@
|
|
|
101
101
|
"peerDependencies": {
|
|
102
102
|
"next": "^15.5.9"
|
|
103
103
|
},
|
|
104
|
+
"dependencies": {
|
|
105
|
+
"@ducanh2912/next-pwa": "^10.2.9",
|
|
106
|
+
"chalk": "^5.3.0",
|
|
107
|
+
"conf": "^15.0.2",
|
|
108
|
+
"consola": "^3.4.2",
|
|
109
|
+
"semver": "^7.7.3"
|
|
110
|
+
},
|
|
104
111
|
"devDependencies": {
|
|
105
|
-
"@djangocfg/imgai": "^2.1.
|
|
106
|
-
"@djangocfg/layouts": "^2.1.
|
|
107
|
-
"@djangocfg/typescript-config": "^2.1.
|
|
112
|
+
"@djangocfg/imgai": "^2.1.32",
|
|
113
|
+
"@djangocfg/layouts": "^2.1.32",
|
|
114
|
+
"@djangocfg/typescript-config": "^2.1.32",
|
|
108
115
|
"@types/node": "^24.7.2",
|
|
109
116
|
"@types/react": "19.2.2",
|
|
110
117
|
"@types/react-dom": "19.2.1",
|
|
@@ -122,11 +129,5 @@
|
|
|
122
129
|
},
|
|
123
130
|
"publishConfig": {
|
|
124
131
|
"access": "public"
|
|
125
|
-
},
|
|
126
|
-
"dependencies": {
|
|
127
|
-
"chalk": "^5.3.0",
|
|
128
|
-
"conf": "^15.0.2",
|
|
129
|
-
"consola": "^3.4.2",
|
|
130
|
-
"semver": "^7.7.3"
|
|
131
132
|
}
|
|
132
133
|
}
|
|
@@ -29,6 +29,7 @@ import { deepMerge } from './utils/deepMerge';
|
|
|
29
29
|
import { isStaticBuild, isDev, getBasePath, getApiUrl, getSiteUrl } from './utils/env';
|
|
30
30
|
import { DevStartupPlugin } from './plugins/devStartup';
|
|
31
31
|
import { addCompressionPlugins } from './plugins/compression';
|
|
32
|
+
import { withPWA, type PWAPluginOptions } from './plugins/pwa';
|
|
32
33
|
|
|
33
34
|
// ─────────────────────────────────────────────────────────────────────────
|
|
34
35
|
// Configuration Options
|
|
@@ -58,6 +59,12 @@ export interface BaseNextConfigOptions {
|
|
|
58
59
|
* Set to ['*'] to allow all origins, or specify domains like ['https://djangocfg.com']
|
|
59
60
|
*/
|
|
60
61
|
allowIframeFrom?: string[];
|
|
62
|
+
/**
|
|
63
|
+
* PWA configuration options
|
|
64
|
+
* Set to false to disable PWA, or provide custom options
|
|
65
|
+
* @default { enabled: true (in production), disable: true (in development) }
|
|
66
|
+
*/
|
|
67
|
+
pwa?: PWAPluginOptions | false;
|
|
61
68
|
/** Custom webpack configuration function (called after base webpack logic) */
|
|
62
69
|
webpack?: (
|
|
63
70
|
config: WebpackConfig,
|
|
@@ -237,7 +244,7 @@ export function createBaseNextConfig(
|
|
|
237
244
|
};
|
|
238
245
|
|
|
239
246
|
// Deep merge user options with base config
|
|
240
|
-
|
|
247
|
+
let finalConfig = deepMerge(baseConfig, options);
|
|
241
248
|
|
|
242
249
|
// Cleanup: Remove custom options that are not part of NextConfig
|
|
243
250
|
delete (finalConfig as any).optimizePackageImports;
|
|
@@ -250,5 +257,12 @@ export function createBaseNextConfig(
|
|
|
250
257
|
delete (finalConfig as any).autoInstall;
|
|
251
258
|
delete (finalConfig as any).allowIframeFrom;
|
|
252
259
|
|
|
260
|
+
// Apply PWA wrapper if enabled
|
|
261
|
+
if (options.pwa !== false) {
|
|
262
|
+
const pwaOptions = typeof options.pwa === 'object' ? options.pwa : {};
|
|
263
|
+
finalConfig = withPWA(finalConfig, pwaOptions);
|
|
264
|
+
}
|
|
265
|
+
delete (finalConfig as any).pwa;
|
|
266
|
+
|
|
253
267
|
return finalConfig;
|
|
254
268
|
}
|
package/src/config/index.ts
CHANGED
|
@@ -97,3 +97,21 @@ export {
|
|
|
97
97
|
isCompressionAvailable,
|
|
98
98
|
type CompressionPluginOptions,
|
|
99
99
|
} from './plugins/compression';
|
|
100
|
+
export {
|
|
101
|
+
withPWA,
|
|
102
|
+
isPWAAvailable,
|
|
103
|
+
defaultRuntimeCaching,
|
|
104
|
+
createApiCacheRule,
|
|
105
|
+
createStaticAssetRule,
|
|
106
|
+
createCdnCacheRule,
|
|
107
|
+
type PWAPluginOptions,
|
|
108
|
+
type CacheStrategy,
|
|
109
|
+
type RuntimeCacheEntry,
|
|
110
|
+
} from './plugins/pwa';
|
|
111
|
+
export {
|
|
112
|
+
createManifestMetadata,
|
|
113
|
+
generateManifest,
|
|
114
|
+
createManifest,
|
|
115
|
+
type ManifestConfig,
|
|
116
|
+
type IconPaths,
|
|
117
|
+
} from './utils/manifest';
|
|
@@ -4,3 +4,4 @@
|
|
|
4
4
|
|
|
5
5
|
export { DevStartupPlugin, resetDevStartupState, type DevStartupPluginOptions } from './devStartup';
|
|
6
6
|
export { addCompressionPlugins, isCompressionAvailable, type CompressionPluginOptions } from './compression';
|
|
7
|
+
export { withPWA, isPWAAvailable, defaultRuntimeCaching, type PWAPluginOptions } from './pwa';
|