@djangocfg/nextjs 2.1.542 → 2.1.544
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.d.mts +22 -9
- package/dist/config/index.mjs +40 -40
- package/dist/config/index.mjs.map +1 -1
- package/dist/health/index.d.mts +1 -1
- package/dist/health/index.mjs +5 -2
- package/dist/health/index.mjs.map +1 -1
- package/dist/i18n/routing.d.mts +20 -20
- package/dist/i18n/server.d.mts +2 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +45 -42
- package/dist/index.mjs.map +1 -1
- package/dist/pwa/index.mjs +6 -5
- package/dist/pwa/index.mjs.map +1 -1
- package/dist/pwa/manifest.d.mts +1 -1
- package/dist/pwa/manifest.mjs +6 -5
- package/dist/pwa/manifest.mjs.map +1 -1
- package/dist/pwa/worker/index.mjs.map +1 -1
- package/dist/sitemap/index.d.mts +1 -1
- package/dist/{types-l9x1Rkmf.d.mts → types-CMxSgWnS.d.mts} +2 -0
- package/package.json +9 -9
- package/src/config/createNextConfig.ts +49 -26
- package/src/config/packages/installer.ts +11 -7
- package/src/config/packages/updater.ts +6 -6
- package/src/config/plugins/compression.ts +1 -1
- package/src/config/utils/deepMerge.ts +25 -21
- package/src/config/utils/version.ts +3 -3
- package/src/health/route.ts +5 -2
- package/src/pwa/manifest.ts +11 -8
- package/src/pwa/worker/index.ts +9 -7
- package/src/types.ts +2 -0
package/src/pwa/manifest.ts
CHANGED
|
@@ -174,7 +174,8 @@ export interface SmartScreenshotInput {
|
|
|
174
174
|
export function createScreenshot(input: SmartScreenshotInput | string): ScreenshotConfig {
|
|
175
175
|
// Allow string shorthand
|
|
176
176
|
const config = typeof input === 'string' ? { src: input } : input;
|
|
177
|
-
|
|
177
|
+
const { src, label, form_factor } = config;
|
|
178
|
+
let { width, height } = config;
|
|
178
179
|
|
|
179
180
|
// Auto-detect image type from extension
|
|
180
181
|
const ext = src.split('.').pop()?.toLowerCase();
|
|
@@ -189,10 +190,12 @@ export function createScreenshot(input: SmartScreenshotInput | string): Screensh
|
|
|
189
190
|
|
|
190
191
|
// Try to parse dimensions from filename (e.g., "1920x1080.png" or "screenshot-390x844.png")
|
|
191
192
|
const filename = src.toLowerCase();
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
193
|
+
// Destructured: `\d{3,4}` cannot match empty, so both groups exist whenever
|
|
194
|
+
// the match does — but only binding them says so without an assertion.
|
|
195
|
+
const [, matchedWidth, matchedHeight] = filename.match(/(\d{3,4})x(\d{3,4})/) ?? [];
|
|
196
|
+
if (matchedWidth && matchedHeight && !width && !height) {
|
|
197
|
+
width = parseInt(matchedWidth, 10);
|
|
198
|
+
height = parseInt(matchedHeight, 10);
|
|
196
199
|
}
|
|
197
200
|
|
|
198
201
|
// Auto-detect form_factor from filename if not provided
|
|
@@ -333,12 +336,12 @@ export function createManifest(config: {
|
|
|
333
336
|
|
|
334
337
|
// Add screenshots if provided (for Richer PWA Install UI)
|
|
335
338
|
if (config.screenshots && config.screenshots.length > 0) {
|
|
336
|
-
|
|
339
|
+
manifest.screenshots = config.screenshots;
|
|
337
340
|
}
|
|
338
341
|
|
|
339
342
|
// Add protocol handlers if provided
|
|
340
343
|
if (config.protocol_handlers && config.protocol_handlers.length > 0) {
|
|
341
|
-
|
|
344
|
+
manifest.protocol_handlers = config.protocol_handlers;
|
|
342
345
|
}
|
|
343
346
|
|
|
344
347
|
return manifest;
|
|
@@ -350,6 +353,6 @@ export function createManifest(config: {
|
|
|
350
353
|
*
|
|
351
354
|
* @deprecated Use createManifest() instead
|
|
352
355
|
*/
|
|
353
|
-
export function generateManifest(config: ManifestConfig):
|
|
356
|
+
export function generateManifest(config: ManifestConfig): MetadataRoute.Manifest {
|
|
354
357
|
return createManifest(config)();
|
|
355
358
|
}
|
package/src/pwa/worker/index.ts
CHANGED
|
@@ -43,21 +43,23 @@ export function createServiceWorker(options: ServiceWorkerOptions = {}): void {
|
|
|
43
43
|
cacheName = 'app-cache-v1',
|
|
44
44
|
} = options;
|
|
45
45
|
|
|
46
|
-
//
|
|
47
|
-
|
|
46
|
+
// `self` resolves to the DOM lib's `Window` when this file is compiled as part
|
|
47
|
+
// of an app; inside a service worker it is really a ServiceWorkerGlobalScope.
|
|
48
|
+
// Casting once here types every event handler below via the standard overloads.
|
|
49
|
+
const sw = self as unknown as ServiceWorkerGlobalScope;
|
|
48
50
|
|
|
49
|
-
sw.addEventListener('install', (event
|
|
51
|
+
sw.addEventListener('install', (event) => {
|
|
50
52
|
event.waitUntil(
|
|
51
|
-
caches.open(cacheName).then((cache
|
|
53
|
+
caches.open(cacheName).then((cache) => cache.addAll([offlineFallback]))
|
|
52
54
|
);
|
|
53
55
|
if (skipWaiting) sw.skipWaiting();
|
|
54
56
|
});
|
|
55
57
|
|
|
56
|
-
sw.addEventListener('activate', (event
|
|
58
|
+
sw.addEventListener('activate', (event) => {
|
|
57
59
|
event.waitUntil(
|
|
58
60
|
caches
|
|
59
61
|
.keys()
|
|
60
|
-
.then((keys
|
|
62
|
+
.then((keys) =>
|
|
61
63
|
Promise.all(keys.filter((k) => k !== cacheName).map((k) => caches.delete(k)))
|
|
62
64
|
)
|
|
63
65
|
.then(() => {
|
|
@@ -66,7 +68,7 @@ export function createServiceWorker(options: ServiceWorkerOptions = {}): void {
|
|
|
66
68
|
);
|
|
67
69
|
});
|
|
68
70
|
|
|
69
|
-
sw.addEventListener('fetch', (event
|
|
71
|
+
sw.addEventListener('fetch', (event) => {
|
|
70
72
|
const { request } = event;
|
|
71
73
|
if (request.mode !== 'navigate') return;
|
|
72
74
|
event.respondWith(
|