@djangocfg/nextjs 2.1.36 → 2.1.38
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 +146 -1
- package/dist/config/index.d.mts +7 -428
- package/dist/config/index.mjs +80 -396
- package/dist/config/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +80 -396
- package/dist/index.mjs.map +1 -1
- package/dist/plugin-DuRJ_Jq6.d.mts +100 -0
- package/dist/pwa/cli.d.mts +1 -0
- package/dist/pwa/cli.mjs +140 -0
- package/dist/pwa/cli.mjs.map +1 -0
- package/dist/pwa/index.d.mts +274 -0
- package/dist/pwa/index.mjs +327 -0
- package/dist/pwa/index.mjs.map +1 -0
- package/dist/pwa/server/index.d.mts +86 -0
- package/dist/pwa/server/index.mjs +175 -0
- package/dist/pwa/server/index.mjs.map +1 -0
- package/dist/pwa/server/routes.d.mts +2 -0
- package/dist/pwa/server/routes.mjs +149 -0
- package/dist/pwa/server/routes.mjs.map +1 -0
- package/dist/pwa/worker/index.d.mts +56 -0
- package/dist/pwa/worker/index.mjs +97 -0
- package/dist/pwa/worker/index.mjs.map +1 -0
- package/dist/routes-DXA29sS_.d.mts +68 -0
- package/package.json +39 -8
- package/src/config/createNextConfig.ts +9 -13
- package/src/config/index.ts +2 -20
- package/src/config/plugins/devStartup.ts +35 -36
- package/src/config/plugins/index.ts +1 -1
- package/src/config/utils/index.ts +0 -1
- package/src/index.ts +4 -0
- package/src/pwa/cli.ts +171 -0
- package/src/pwa/index.ts +9 -0
- package/src/pwa/manifest.ts +355 -0
- package/src/pwa/notifications.ts +192 -0
- package/src/pwa/plugin.ts +194 -0
- package/src/pwa/server/index.ts +23 -0
- package/src/pwa/server/push.ts +166 -0
- package/src/pwa/server/routes.ts +137 -0
- package/src/pwa/worker/index.ts +174 -0
- package/src/pwa/worker/package.json +3 -0
- package/src/config/plugins/pwa.ts +0 -616
- package/src/config/utils/manifest.ts +0 -214
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.38",
|
|
18
18
|
description: "Next.js server utilities: sitemap, health, OG images, contact forms, navigation, config",
|
|
19
19
|
keywords: [
|
|
20
20
|
"nextjs",
|
|
@@ -92,6 +92,31 @@ var require_package = __commonJS({
|
|
|
92
92
|
types: "./dist/scripts/index.d.mts",
|
|
93
93
|
import: "./dist/scripts/index.mjs",
|
|
94
94
|
default: "./dist/scripts/index.mjs"
|
|
95
|
+
},
|
|
96
|
+
"./pwa": {
|
|
97
|
+
types: "./dist/pwa/index.d.mts",
|
|
98
|
+
import: "./dist/pwa/index.mjs",
|
|
99
|
+
default: "./dist/pwa/index.mjs"
|
|
100
|
+
},
|
|
101
|
+
"./pwa/worker": {
|
|
102
|
+
types: "./dist/pwa/worker/index.d.mts",
|
|
103
|
+
import: "./dist/pwa/worker/index.mjs",
|
|
104
|
+
default: "./dist/pwa/worker/index.mjs"
|
|
105
|
+
},
|
|
106
|
+
"./worker": {
|
|
107
|
+
types: "./dist/pwa/worker/index.d.mts",
|
|
108
|
+
import: "./dist/pwa/worker/index.mjs",
|
|
109
|
+
default: "./dist/pwa/worker/index.mjs"
|
|
110
|
+
},
|
|
111
|
+
"./pwa/server": {
|
|
112
|
+
types: "./dist/pwa/server/index.d.mts",
|
|
113
|
+
import: "./dist/pwa/server/index.mjs",
|
|
114
|
+
default: "./dist/pwa/server/index.mjs"
|
|
115
|
+
},
|
|
116
|
+
"./pwa/server/routes": {
|
|
117
|
+
types: "./dist/pwa/server/routes.d.mts",
|
|
118
|
+
import: "./dist/pwa/server/routes.mjs",
|
|
119
|
+
default: "./dist/pwa/server/routes.mjs"
|
|
95
120
|
}
|
|
96
121
|
},
|
|
97
122
|
files: [
|
|
@@ -101,7 +126,8 @@ var require_package = __commonJS({
|
|
|
101
126
|
"LICENSE"
|
|
102
127
|
],
|
|
103
128
|
bin: {
|
|
104
|
-
"djangocfg-docs": "./dist/ai/cli.mjs"
|
|
129
|
+
"djangocfg-docs": "./dist/ai/cli.mjs",
|
|
130
|
+
"djangocfg-pwa": "./dist/pwa/cli.mjs"
|
|
105
131
|
},
|
|
106
132
|
scripts: {
|
|
107
133
|
build: "tsup",
|
|
@@ -110,17 +136,21 @@ var require_package = __commonJS({
|
|
|
110
136
|
lint: "eslint .",
|
|
111
137
|
check: "tsc --noEmit",
|
|
112
138
|
"check-links": "tsx src/scripts/check-links.ts",
|
|
113
|
-
"ai-docs": "tsx src/ai/cli.ts"
|
|
139
|
+
"ai-docs": "tsx src/ai/cli.ts",
|
|
140
|
+
pwa: "tsx src/pwa/cli.ts"
|
|
114
141
|
},
|
|
115
142
|
peerDependencies: {
|
|
116
143
|
next: "^16.0.10"
|
|
117
144
|
},
|
|
118
145
|
dependencies: {
|
|
119
|
-
"@
|
|
146
|
+
"@serwist/next": "^9.2.3",
|
|
147
|
+
"@serwist/sw": "^9.2.3",
|
|
120
148
|
chalk: "^5.3.0",
|
|
121
149
|
conf: "^15.0.2",
|
|
122
150
|
consola: "^3.4.2",
|
|
123
|
-
semver: "^7.7.3"
|
|
151
|
+
semver: "^7.7.3",
|
|
152
|
+
serwist: "^9.2.3",
|
|
153
|
+
"web-push": "^3.6.7"
|
|
124
154
|
},
|
|
125
155
|
devDependencies: {
|
|
126
156
|
"@djangocfg/imgai": "workspace:*",
|
|
@@ -130,6 +160,7 @@ var require_package = __commonJS({
|
|
|
130
160
|
"@types/react": "19.2.2",
|
|
131
161
|
"@types/react-dom": "19.2.1",
|
|
132
162
|
"@types/semver": "^7.7.1",
|
|
163
|
+
"@types/web-push": "^3.6.4",
|
|
133
164
|
"@types/webpack": "^5.28.5",
|
|
134
165
|
"@vercel/og": "^0.8.5",
|
|
135
166
|
eslint: "^9.37.0",
|
|
@@ -1054,7 +1085,6 @@ function resetUpdaterPreferences() {
|
|
|
1054
1085
|
|
|
1055
1086
|
// src/config/plugins/devStartup.ts
|
|
1056
1087
|
var startupDone = false;
|
|
1057
|
-
var browserOpened = false;
|
|
1058
1088
|
var DevStartupPlugin = class {
|
|
1059
1089
|
constructor(options = {}) {
|
|
1060
1090
|
this.options = options;
|
|
@@ -1065,10 +1095,6 @@ var DevStartupPlugin = class {
|
|
|
1065
1095
|
startupDone = true;
|
|
1066
1096
|
await this.runStartupTasks();
|
|
1067
1097
|
}
|
|
1068
|
-
if (this.options.openBrowser && !browserOpened) {
|
|
1069
|
-
browserOpened = true;
|
|
1070
|
-
this.openBrowser();
|
|
1071
|
-
}
|
|
1072
1098
|
});
|
|
1073
1099
|
}
|
|
1074
1100
|
async runStartupTasks() {
|
|
@@ -1077,6 +1103,7 @@ var DevStartupPlugin = class {
|
|
|
1077
1103
|
if (version) {
|
|
1078
1104
|
console.log(chalk4.dim(` \u{1F4E6} @djangocfg/nextjs v${version}`));
|
|
1079
1105
|
}
|
|
1106
|
+
this.checkPWASetup();
|
|
1080
1107
|
console.log(chalk4.magenta(` ${AI_DOCS_HINT}
|
|
1081
1108
|
`));
|
|
1082
1109
|
if (this.options.checkUpdates !== false) {
|
|
@@ -1097,27 +1124,33 @@ var DevStartupPlugin = class {
|
|
|
1097
1124
|
});
|
|
1098
1125
|
}
|
|
1099
1126
|
}
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
}
|
|
1113
|
-
console.
|
|
1127
|
+
checkPWASetup() {
|
|
1128
|
+
const fs = __require("fs");
|
|
1129
|
+
const path = __require("path");
|
|
1130
|
+
const cwd = process.cwd();
|
|
1131
|
+
const swPath = path.join(cwd, "app", "sw.ts");
|
|
1132
|
+
const manifestPath = path.join(cwd, "app", "manifest.ts");
|
|
1133
|
+
const hasSW = fs.existsSync(swPath);
|
|
1134
|
+
const hasManifest = fs.existsSync(manifestPath);
|
|
1135
|
+
if (hasSW || hasManifest) {
|
|
1136
|
+
console.log(chalk4.cyan(" \u{1F4F1} PWA Configuration:"));
|
|
1137
|
+
if (hasSW) {
|
|
1138
|
+
console.log(chalk4.green(" \u2713 Service Worker: app/sw.ts"));
|
|
1139
|
+
} else {
|
|
1140
|
+
console.log(chalk4.yellow(" \u26A0 Service Worker: not found"));
|
|
1114
1141
|
}
|
|
1115
|
-
|
|
1142
|
+
if (hasManifest) {
|
|
1143
|
+
console.log(chalk4.green(" \u2713 Manifest: app/manifest.ts"));
|
|
1144
|
+
} else {
|
|
1145
|
+
console.log(chalk4.yellow(" \u26A0 Manifest: not found"));
|
|
1146
|
+
}
|
|
1147
|
+
console.log(chalk4.dim(" \u2192 Check: DevTools \u2192 Application \u2192 Service Workers"));
|
|
1148
|
+
console.log(chalk4.dim(" \u2192 Test push: import from @djangocfg/nextjs/pwa"));
|
|
1149
|
+
}
|
|
1116
1150
|
}
|
|
1117
1151
|
};
|
|
1118
1152
|
function resetDevStartupState() {
|
|
1119
1153
|
startupDone = false;
|
|
1120
|
-
browserOpened = false;
|
|
1121
1154
|
}
|
|
1122
1155
|
|
|
1123
1156
|
// src/config/plugins/compression.ts
|
|
@@ -1172,276 +1205,33 @@ function isCompressionAvailable() {
|
|
|
1172
1205
|
return isPackageInstalled("compression-webpack-plugin");
|
|
1173
1206
|
}
|
|
1174
1207
|
|
|
1175
|
-
// src/
|
|
1208
|
+
// src/pwa/plugin.ts
|
|
1176
1209
|
import { consola as consola4 } from "consola";
|
|
1177
|
-
function isPWAAvailable() {
|
|
1178
|
-
try {
|
|
1179
|
-
__require.resolve("@ducanh2912/next-pwa");
|
|
1180
|
-
return true;
|
|
1181
|
-
} catch {
|
|
1182
|
-
try {
|
|
1183
|
-
__require.resolve("next-pwa");
|
|
1184
|
-
consola4.warn(
|
|
1185
|
-
"Found legacy next-pwa. Please use @ducanh2912/next-pwa for Next.js 13+ support.\nRun: pnpm remove next-pwa && pnpm add @ducanh2912/next-pwa"
|
|
1186
|
-
);
|
|
1187
|
-
return true;
|
|
1188
|
-
} catch {
|
|
1189
|
-
return false;
|
|
1190
|
-
}
|
|
1191
|
-
}
|
|
1192
|
-
}
|
|
1193
1210
|
function withPWA(nextConfig, options = {}) {
|
|
1194
|
-
if (!isPWAAvailable()) {
|
|
1195
|
-
consola4.error(
|
|
1196
|
-
"@ducanh2912/next-pwa is missing!\nThis is unexpected as it should be installed automatically.\nTry: pnpm install --force\nPWA features will be disabled."
|
|
1197
|
-
);
|
|
1198
|
-
return nextConfig;
|
|
1199
|
-
}
|
|
1200
1211
|
const isDev2 = process.env.NODE_ENV === "development";
|
|
1201
1212
|
const defaultOptions = {
|
|
1202
|
-
|
|
1213
|
+
swSrc: "app/sw.ts",
|
|
1214
|
+
swDest: "public/sw.js",
|
|
1203
1215
|
disable: options.disable !== void 0 ? options.disable : isDev2,
|
|
1204
|
-
|
|
1205
|
-
skipWaiting: true,
|
|
1206
|
-
clientsClaim: true,
|
|
1207
|
-
cleanupOutdatedCaches: true,
|
|
1208
|
-
publicExcludes: ["!noprecache/**/*"],
|
|
1209
|
-
buildExcludes: [/middleware-manifest\.json$/, /build-manifest\.json$/],
|
|
1210
|
-
cacheStartUrl: true,
|
|
1211
|
-
dynamicStartUrl: true,
|
|
1216
|
+
cacheOnNavigation: true,
|
|
1212
1217
|
reloadOnOnline: true,
|
|
1213
1218
|
...options
|
|
1214
1219
|
};
|
|
1215
1220
|
try {
|
|
1216
|
-
const
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
var defaultRuntimeCaching = [
|
|
1230
|
-
{
|
|
1231
|
-
urlPattern: /^https:\/\/fonts\.(?:gstatic)\.com\/.*/i,
|
|
1232
|
-
handler: "CacheFirst",
|
|
1233
|
-
options: {
|
|
1234
|
-
cacheName: "google-fonts-webfonts",
|
|
1235
|
-
expiration: {
|
|
1236
|
-
maxEntries: 4,
|
|
1237
|
-
maxAgeSeconds: 365 * 24 * 60 * 60
|
|
1238
|
-
// 1 year
|
|
1239
|
-
}
|
|
1240
|
-
}
|
|
1241
|
-
},
|
|
1242
|
-
{
|
|
1243
|
-
urlPattern: /^https:\/\/fonts\.(?:googleapis)\.com\/.*/i,
|
|
1244
|
-
handler: "StaleWhileRevalidate",
|
|
1245
|
-
options: {
|
|
1246
|
-
cacheName: "google-fonts-stylesheets",
|
|
1247
|
-
expiration: {
|
|
1248
|
-
maxEntries: 4,
|
|
1249
|
-
maxAgeSeconds: 7 * 24 * 60 * 60
|
|
1250
|
-
// 1 week
|
|
1251
|
-
}
|
|
1252
|
-
}
|
|
1253
|
-
},
|
|
1254
|
-
{
|
|
1255
|
-
urlPattern: /\.(?:eot|otf|ttc|ttf|woff|woff2|font.css)$/i,
|
|
1256
|
-
handler: "StaleWhileRevalidate",
|
|
1257
|
-
options: {
|
|
1258
|
-
cacheName: "static-font-assets",
|
|
1259
|
-
expiration: {
|
|
1260
|
-
maxEntries: 4,
|
|
1261
|
-
maxAgeSeconds: 7 * 24 * 60 * 60
|
|
1262
|
-
// 1 week
|
|
1263
|
-
}
|
|
1264
|
-
}
|
|
1265
|
-
},
|
|
1266
|
-
{
|
|
1267
|
-
urlPattern: /\.(?:jpg|jpeg|gif|png|svg|ico|webp)$/i,
|
|
1268
|
-
handler: "StaleWhileRevalidate",
|
|
1269
|
-
options: {
|
|
1270
|
-
cacheName: "static-image-assets",
|
|
1271
|
-
expiration: {
|
|
1272
|
-
maxEntries: 64,
|
|
1273
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
1274
|
-
// 24 hours
|
|
1275
|
-
}
|
|
1276
|
-
}
|
|
1277
|
-
},
|
|
1278
|
-
{
|
|
1279
|
-
urlPattern: /\/_next\/image\?url=.+$/i,
|
|
1280
|
-
handler: "StaleWhileRevalidate",
|
|
1281
|
-
options: {
|
|
1282
|
-
cacheName: "next-image",
|
|
1283
|
-
expiration: {
|
|
1284
|
-
maxEntries: 64,
|
|
1285
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
1286
|
-
// 24 hours
|
|
1287
|
-
}
|
|
1288
|
-
}
|
|
1289
|
-
},
|
|
1290
|
-
{
|
|
1291
|
-
urlPattern: /\.(?:mp3|wav|ogg)$/i,
|
|
1292
|
-
handler: "CacheFirst",
|
|
1293
|
-
options: {
|
|
1294
|
-
rangeRequests: true,
|
|
1295
|
-
cacheName: "static-audio-assets",
|
|
1296
|
-
expiration: {
|
|
1297
|
-
maxEntries: 32,
|
|
1298
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
1299
|
-
// 24 hours
|
|
1300
|
-
}
|
|
1301
|
-
}
|
|
1302
|
-
},
|
|
1303
|
-
{
|
|
1304
|
-
urlPattern: /\.(?:mp4)$/i,
|
|
1305
|
-
handler: "CacheFirst",
|
|
1306
|
-
options: {
|
|
1307
|
-
rangeRequests: true,
|
|
1308
|
-
cacheName: "static-video-assets",
|
|
1309
|
-
expiration: {
|
|
1310
|
-
maxEntries: 32,
|
|
1311
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
1312
|
-
// 24 hours
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
|
-
},
|
|
1316
|
-
{
|
|
1317
|
-
urlPattern: /\.(?:js)$/i,
|
|
1318
|
-
handler: "StaleWhileRevalidate",
|
|
1319
|
-
options: {
|
|
1320
|
-
cacheName: "static-js-assets",
|
|
1321
|
-
expiration: {
|
|
1322
|
-
maxEntries: 32,
|
|
1323
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
1324
|
-
// 24 hours
|
|
1325
|
-
}
|
|
1326
|
-
}
|
|
1327
|
-
},
|
|
1328
|
-
{
|
|
1329
|
-
urlPattern: /\.(?:css|less)$/i,
|
|
1330
|
-
handler: "StaleWhileRevalidate",
|
|
1331
|
-
options: {
|
|
1332
|
-
cacheName: "static-style-assets",
|
|
1333
|
-
expiration: {
|
|
1334
|
-
maxEntries: 32,
|
|
1335
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
1336
|
-
// 24 hours
|
|
1337
|
-
}
|
|
1338
|
-
}
|
|
1339
|
-
},
|
|
1340
|
-
{
|
|
1341
|
-
urlPattern: /\/_next\/data\/.+\/.+\.json$/i,
|
|
1342
|
-
handler: "StaleWhileRevalidate",
|
|
1343
|
-
options: {
|
|
1344
|
-
cacheName: "next-data",
|
|
1345
|
-
expiration: {
|
|
1346
|
-
maxEntries: 32,
|
|
1347
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
1348
|
-
// 24 hours
|
|
1349
|
-
}
|
|
1350
|
-
}
|
|
1351
|
-
},
|
|
1352
|
-
{
|
|
1353
|
-
urlPattern: /\.(?:json|xml|csv)$/i,
|
|
1354
|
-
handler: "NetworkFirst",
|
|
1355
|
-
options: {
|
|
1356
|
-
cacheName: "static-data-assets",
|
|
1357
|
-
expiration: {
|
|
1358
|
-
maxEntries: 32,
|
|
1359
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
1360
|
-
// 24 hours
|
|
1361
|
-
}
|
|
1362
|
-
}
|
|
1363
|
-
},
|
|
1364
|
-
{
|
|
1365
|
-
urlPattern: ({ url }) => {
|
|
1366
|
-
const isSameOrigin = self.origin === url.origin;
|
|
1367
|
-
if (!isSameOrigin) return false;
|
|
1368
|
-
const pathname = url.pathname;
|
|
1369
|
-
if (pathname.startsWith("/api/")) return false;
|
|
1370
|
-
return true;
|
|
1371
|
-
},
|
|
1372
|
-
handler: "NetworkFirst",
|
|
1373
|
-
options: {
|
|
1374
|
-
cacheName: "pages",
|
|
1375
|
-
expiration: {
|
|
1376
|
-
maxEntries: 32,
|
|
1377
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
1378
|
-
// 24 hours
|
|
1379
|
-
}
|
|
1380
|
-
}
|
|
1221
|
+
const withSerwistInit = __require("@serwist/next").default;
|
|
1222
|
+
const withSerwist = withSerwistInit({
|
|
1223
|
+
swSrc: defaultOptions.swSrc,
|
|
1224
|
+
swDest: defaultOptions.swDest,
|
|
1225
|
+
disable: defaultOptions.disable,
|
|
1226
|
+
cacheOnNavigation: defaultOptions.cacheOnNavigation,
|
|
1227
|
+
reloadOnOnline: defaultOptions.reloadOnOnline,
|
|
1228
|
+
...defaultOptions.serwistOptions
|
|
1229
|
+
});
|
|
1230
|
+
return withSerwist(nextConfig);
|
|
1231
|
+
} catch (error) {
|
|
1232
|
+
consola4.error("Failed to configure Serwist:", error);
|
|
1233
|
+
return nextConfig;
|
|
1381
1234
|
}
|
|
1382
|
-
];
|
|
1383
|
-
function createApiCacheRule(apiUrl, options = {}) {
|
|
1384
|
-
const {
|
|
1385
|
-
strategy = "NetworkFirst",
|
|
1386
|
-
maxAge = 300,
|
|
1387
|
-
maxEntries = 50,
|
|
1388
|
-
cacheName = "api-cache"
|
|
1389
|
-
} = options;
|
|
1390
|
-
return {
|
|
1391
|
-
urlPattern: new RegExp(`^${apiUrl.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}/.*`, "i"),
|
|
1392
|
-
handler: strategy,
|
|
1393
|
-
options: {
|
|
1394
|
-
cacheName,
|
|
1395
|
-
expiration: {
|
|
1396
|
-
maxEntries,
|
|
1397
|
-
maxAgeSeconds: maxAge
|
|
1398
|
-
},
|
|
1399
|
-
networkTimeoutSeconds: 10
|
|
1400
|
-
}
|
|
1401
|
-
};
|
|
1402
|
-
}
|
|
1403
|
-
function createStaticAssetRule(extensions, options = {}) {
|
|
1404
|
-
const {
|
|
1405
|
-
strategy = "CacheFirst",
|
|
1406
|
-
maxAge = 86400,
|
|
1407
|
-
maxEntries = 64,
|
|
1408
|
-
cacheName = "static-assets"
|
|
1409
|
-
} = options;
|
|
1410
|
-
const pattern = extensions.map((ext) => ext.replace(".", "")).join("|");
|
|
1411
|
-
return {
|
|
1412
|
-
urlPattern: new RegExp(`\\.(?:${pattern})$`, "i"),
|
|
1413
|
-
handler: strategy,
|
|
1414
|
-
options: {
|
|
1415
|
-
cacheName,
|
|
1416
|
-
expiration: {
|
|
1417
|
-
maxEntries,
|
|
1418
|
-
maxAgeSeconds: maxAge
|
|
1419
|
-
}
|
|
1420
|
-
}
|
|
1421
|
-
};
|
|
1422
|
-
}
|
|
1423
|
-
function createCdnCacheRule(cdnUrl, options = {}) {
|
|
1424
|
-
const {
|
|
1425
|
-
strategy = "CacheFirst",
|
|
1426
|
-
maxAge = 2592e3,
|
|
1427
|
-
// 30 days
|
|
1428
|
-
maxEntries = 100,
|
|
1429
|
-
cacheName = "cdn-cache"
|
|
1430
|
-
} = options;
|
|
1431
|
-
return {
|
|
1432
|
-
urlPattern: new RegExp(`^${cdnUrl.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}/.*`, "i"),
|
|
1433
|
-
handler: strategy,
|
|
1434
|
-
options: {
|
|
1435
|
-
cacheName,
|
|
1436
|
-
expiration: {
|
|
1437
|
-
maxEntries,
|
|
1438
|
-
maxAgeSeconds: maxAge
|
|
1439
|
-
},
|
|
1440
|
-
cacheableResponse: {
|
|
1441
|
-
statuses: [0, 200]
|
|
1442
|
-
}
|
|
1443
|
-
}
|
|
1444
|
-
};
|
|
1445
1235
|
}
|
|
1446
1236
|
|
|
1447
1237
|
// src/config/createNextConfig.ts
|
|
@@ -1511,6 +1301,9 @@ function createBaseNextConfig(options = {}) {
|
|
|
1511
1301
|
...DEFAULT_TRANSPILE_PACKAGES,
|
|
1512
1302
|
...options.transpilePackages || []
|
|
1513
1303
|
],
|
|
1304
|
+
// Turbopack configuration (Next.js 16+ default bundler)
|
|
1305
|
+
// Always set turbopack config to silence Next.js 16 warning about webpack config
|
|
1306
|
+
turbopack: options.turbopack || {},
|
|
1514
1307
|
// Experimental features
|
|
1515
1308
|
experimental: {
|
|
1516
1309
|
// Optimize package imports (only in production)
|
|
@@ -1528,9 +1321,6 @@ function createBaseNextConfig(options = {}) {
|
|
|
1528
1321
|
...options.experimental
|
|
1529
1322
|
},
|
|
1530
1323
|
// Webpack configuration
|
|
1531
|
-
// NOTE: Next.js 16 uses Turbopack by default in dev mode, which doesn't support webpack plugins.
|
|
1532
|
-
// DevStartupPlugin only runs in webpack mode (next dev --webpack).
|
|
1533
|
-
// For Turbopack compatibility, consider using a custom dev script for browser auto-open.
|
|
1534
1324
|
webpack: (config, webpackOptions) => {
|
|
1535
1325
|
const { isServer, dev } = webpackOptions;
|
|
1536
1326
|
if (dev && !isServer) {
|
|
@@ -1539,7 +1329,6 @@ function createBaseNextConfig(options = {}) {
|
|
|
1539
1329
|
}
|
|
1540
1330
|
config.plugins.push(
|
|
1541
1331
|
new DevStartupPlugin({
|
|
1542
|
-
openBrowser: options.openBrowser,
|
|
1543
1332
|
checkUpdates: options.checkUpdates,
|
|
1544
1333
|
autoUpdate: options.autoUpdate,
|
|
1545
1334
|
forceCheckWorkspace: options.forceCheckWorkspace,
|
|
@@ -1573,7 +1362,6 @@ function createBaseNextConfig(options = {}) {
|
|
|
1573
1362
|
let finalConfig = deepMerge(baseConfig, options);
|
|
1574
1363
|
delete finalConfig.optimizePackageImports;
|
|
1575
1364
|
delete finalConfig.isDefaultCfgAdmin;
|
|
1576
|
-
delete finalConfig.openBrowser;
|
|
1577
1365
|
delete finalConfig.checkUpdates;
|
|
1578
1366
|
delete finalConfig.autoUpdate;
|
|
1579
1367
|
delete finalConfig.forceCheckWorkspace;
|
|
@@ -1587,100 +1375,6 @@ function createBaseNextConfig(options = {}) {
|
|
|
1587
1375
|
delete finalConfig.pwa;
|
|
1588
1376
|
return finalConfig;
|
|
1589
1377
|
}
|
|
1590
|
-
|
|
1591
|
-
// src/config/utils/manifest.ts
|
|
1592
|
-
function createViewport(config) {
|
|
1593
|
-
return {
|
|
1594
|
-
width: "device-width",
|
|
1595
|
-
initialScale: 1,
|
|
1596
|
-
maximumScale: 1,
|
|
1597
|
-
themeColor: config.themeColor || "#000000"
|
|
1598
|
-
};
|
|
1599
|
-
}
|
|
1600
|
-
function createManifestMetadata(config) {
|
|
1601
|
-
return {
|
|
1602
|
-
manifest: "/manifest.json",
|
|
1603
|
-
appleWebApp: {
|
|
1604
|
-
capable: true,
|
|
1605
|
-
statusBarStyle: "default",
|
|
1606
|
-
title: config.shortName || config.name
|
|
1607
|
-
},
|
|
1608
|
-
applicationName: config.name,
|
|
1609
|
-
formatDetection: {
|
|
1610
|
-
telephone: false
|
|
1611
|
-
}
|
|
1612
|
-
};
|
|
1613
|
-
}
|
|
1614
|
-
function createManifest(config) {
|
|
1615
|
-
return () => {
|
|
1616
|
-
let manifestIcons;
|
|
1617
|
-
if (Array.isArray(config.icons)) {
|
|
1618
|
-
manifestIcons = config.icons;
|
|
1619
|
-
} else if (config.icons) {
|
|
1620
|
-
const { logo192, logo384, logo512 } = config.icons;
|
|
1621
|
-
manifestIcons = [
|
|
1622
|
-
...logo192 ? [
|
|
1623
|
-
{
|
|
1624
|
-
src: logo192,
|
|
1625
|
-
sizes: "192x192",
|
|
1626
|
-
type: "image/png",
|
|
1627
|
-
purpose: "maskable"
|
|
1628
|
-
}
|
|
1629
|
-
] : [],
|
|
1630
|
-
...logo384 ? [
|
|
1631
|
-
{
|
|
1632
|
-
src: logo384,
|
|
1633
|
-
sizes: "384x384",
|
|
1634
|
-
type: "image/png"
|
|
1635
|
-
}
|
|
1636
|
-
] : [],
|
|
1637
|
-
...logo512 ? [
|
|
1638
|
-
{
|
|
1639
|
-
src: logo512,
|
|
1640
|
-
sizes: "512x512",
|
|
1641
|
-
type: "image/png"
|
|
1642
|
-
}
|
|
1643
|
-
] : []
|
|
1644
|
-
];
|
|
1645
|
-
} else {
|
|
1646
|
-
manifestIcons = [
|
|
1647
|
-
{
|
|
1648
|
-
src: "/static/logos/192x192.png",
|
|
1649
|
-
sizes: "192x192",
|
|
1650
|
-
type: "image/png",
|
|
1651
|
-
purpose: "maskable"
|
|
1652
|
-
},
|
|
1653
|
-
{
|
|
1654
|
-
src: "/static/logos/384x384.png",
|
|
1655
|
-
sizes: "384x384",
|
|
1656
|
-
type: "image/png"
|
|
1657
|
-
},
|
|
1658
|
-
{
|
|
1659
|
-
src: "/static/logos/512x512.png",
|
|
1660
|
-
sizes: "512x512",
|
|
1661
|
-
type: "image/png"
|
|
1662
|
-
}
|
|
1663
|
-
];
|
|
1664
|
-
}
|
|
1665
|
-
return {
|
|
1666
|
-
name: config.name,
|
|
1667
|
-
short_name: config.shortName || config.name,
|
|
1668
|
-
description: config.description || config.name,
|
|
1669
|
-
start_url: config.startUrl || "/",
|
|
1670
|
-
scope: config.scope || "/",
|
|
1671
|
-
display: config.display || "standalone",
|
|
1672
|
-
orientation: config.orientation || "portrait",
|
|
1673
|
-
background_color: config.backgroundColor || "#000000",
|
|
1674
|
-
theme_color: config.themeColor || "#ffffff",
|
|
1675
|
-
lang: config.lang || "en",
|
|
1676
|
-
dir: config.dir || "ltr",
|
|
1677
|
-
icons: manifestIcons
|
|
1678
|
-
};
|
|
1679
|
-
};
|
|
1680
|
-
}
|
|
1681
|
-
function generateManifest(config) {
|
|
1682
|
-
return createManifest(config)();
|
|
1683
|
-
}
|
|
1684
1378
|
export {
|
|
1685
1379
|
AI_DOCS_HINT,
|
|
1686
1380
|
DEFAULT_OPTIMIZE_PACKAGES,
|
|
@@ -1702,18 +1396,10 @@ export {
|
|
|
1702
1396
|
checkForUpdate,
|
|
1703
1397
|
checkForUpdates,
|
|
1704
1398
|
checkPackages,
|
|
1705
|
-
createApiCacheRule,
|
|
1706
1399
|
createBaseNextConfig,
|
|
1707
|
-
createCdnCacheRule,
|
|
1708
|
-
createManifest,
|
|
1709
|
-
createManifestMetadata,
|
|
1710
|
-
createStaticAssetRule,
|
|
1711
|
-
createViewport,
|
|
1712
1400
|
deepMerge,
|
|
1713
|
-
defaultRuntimeCaching,
|
|
1714
1401
|
detectPackageManager,
|
|
1715
1402
|
fetchLatestVersion,
|
|
1716
|
-
generateManifest,
|
|
1717
1403
|
getApiUrl,
|
|
1718
1404
|
getBasePath,
|
|
1719
1405
|
getCurrentVersion,
|
|
@@ -1728,7 +1414,6 @@ export {
|
|
|
1728
1414
|
isCI,
|
|
1729
1415
|
isCompressionAvailable,
|
|
1730
1416
|
isDev,
|
|
1731
|
-
isPWAAvailable,
|
|
1732
1417
|
isPackageInstalled,
|
|
1733
1418
|
isProduction,
|
|
1734
1419
|
isStaticBuild,
|
|
@@ -1736,7 +1421,6 @@ export {
|
|
|
1736
1421
|
resetDevStartupState,
|
|
1737
1422
|
resetInstallerPreferences,
|
|
1738
1423
|
resetUpdaterPreferences,
|
|
1739
|
-
updatePackagesWithProgress
|
|
1740
|
-
withPWA
|
|
1424
|
+
updatePackagesWithProgress
|
|
1741
1425
|
};
|
|
1742
1426
|
//# sourceMappingURL=index.mjs.map
|