@djangocfg/nextjs 2.1.35 → 2.1.37
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 -22
- package/dist/config/index.d.mts +7 -409
- package/dist/config/index.mjs +79 -394
- package/dist/config/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +79 -394
- 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 +38 -9
- package/src/config/createNextConfig.ts +9 -13
- package/src/config/index.ts +2 -19
- 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/bin/dev-with-browser.js +0 -114
- package/src/config/plugins/pwa.ts +0 -616
- package/src/config/utils/manifest.ts +0 -195
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.37",
|
|
18
18
|
description: "Next.js server utilities: sitemap, health, OG images, contact forms, navigation, config",
|
|
19
19
|
keywords: [
|
|
20
20
|
"nextjs",
|
|
@@ -92,18 +92,42 @@ 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: [
|
|
98
123
|
"dist",
|
|
99
124
|
"src",
|
|
100
|
-
"bin",
|
|
101
125
|
"README.md",
|
|
102
126
|
"LICENSE"
|
|
103
127
|
],
|
|
104
128
|
bin: {
|
|
105
129
|
"djangocfg-docs": "./dist/ai/cli.mjs",
|
|
106
|
-
"
|
|
130
|
+
"djangocfg-pwa": "./dist/pwa/cli.mjs"
|
|
107
131
|
},
|
|
108
132
|
scripts: {
|
|
109
133
|
build: "tsup",
|
|
@@ -112,17 +136,21 @@ var require_package = __commonJS({
|
|
|
112
136
|
lint: "eslint .",
|
|
113
137
|
check: "tsc --noEmit",
|
|
114
138
|
"check-links": "tsx src/scripts/check-links.ts",
|
|
115
|
-
"ai-docs": "tsx src/ai/cli.ts"
|
|
139
|
+
"ai-docs": "tsx src/ai/cli.ts",
|
|
140
|
+
pwa: "tsx src/pwa/cli.ts"
|
|
116
141
|
},
|
|
117
142
|
peerDependencies: {
|
|
118
143
|
next: "^16.0.10"
|
|
119
144
|
},
|
|
120
145
|
dependencies: {
|
|
121
|
-
"@
|
|
146
|
+
"@serwist/next": "^9.2.3",
|
|
147
|
+
"@serwist/sw": "^9.2.3",
|
|
122
148
|
chalk: "^5.3.0",
|
|
123
149
|
conf: "^15.0.2",
|
|
124
150
|
consola: "^3.4.2",
|
|
125
|
-
semver: "^7.7.3"
|
|
151
|
+
semver: "^7.7.3",
|
|
152
|
+
serwist: "^9.2.3",
|
|
153
|
+
"web-push": "^3.6.7"
|
|
126
154
|
},
|
|
127
155
|
devDependencies: {
|
|
128
156
|
"@djangocfg/imgai": "workspace:*",
|
|
@@ -132,6 +160,7 @@ var require_package = __commonJS({
|
|
|
132
160
|
"@types/react": "19.2.2",
|
|
133
161
|
"@types/react-dom": "19.2.1",
|
|
134
162
|
"@types/semver": "^7.7.1",
|
|
163
|
+
"@types/web-push": "^3.6.4",
|
|
135
164
|
"@types/webpack": "^5.28.5",
|
|
136
165
|
"@vercel/og": "^0.8.5",
|
|
137
166
|
eslint: "^9.37.0",
|
|
@@ -1056,7 +1085,6 @@ function resetUpdaterPreferences() {
|
|
|
1056
1085
|
|
|
1057
1086
|
// src/config/plugins/devStartup.ts
|
|
1058
1087
|
var startupDone = false;
|
|
1059
|
-
var browserOpened = false;
|
|
1060
1088
|
var DevStartupPlugin = class {
|
|
1061
1089
|
constructor(options = {}) {
|
|
1062
1090
|
this.options = options;
|
|
@@ -1067,10 +1095,6 @@ var DevStartupPlugin = class {
|
|
|
1067
1095
|
startupDone = true;
|
|
1068
1096
|
await this.runStartupTasks();
|
|
1069
1097
|
}
|
|
1070
|
-
if (this.options.openBrowser && !browserOpened) {
|
|
1071
|
-
browserOpened = true;
|
|
1072
|
-
this.openBrowser();
|
|
1073
|
-
}
|
|
1074
1098
|
});
|
|
1075
1099
|
}
|
|
1076
1100
|
async runStartupTasks() {
|
|
@@ -1079,6 +1103,7 @@ var DevStartupPlugin = class {
|
|
|
1079
1103
|
if (version) {
|
|
1080
1104
|
console.log(chalk4.dim(` \u{1F4E6} @djangocfg/nextjs v${version}`));
|
|
1081
1105
|
}
|
|
1106
|
+
this.checkPWASetup();
|
|
1082
1107
|
console.log(chalk4.magenta(` ${AI_DOCS_HINT}
|
|
1083
1108
|
`));
|
|
1084
1109
|
if (this.options.checkUpdates !== false) {
|
|
@@ -1099,27 +1124,33 @@ var DevStartupPlugin = class {
|
|
|
1099
1124
|
});
|
|
1100
1125
|
}
|
|
1101
1126
|
}
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
}
|
|
1115
|
-
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"));
|
|
1141
|
+
}
|
|
1142
|
+
if (hasManifest) {
|
|
1143
|
+
console.log(chalk4.green(" \u2713 Manifest: app/manifest.ts"));
|
|
1144
|
+
} else {
|
|
1145
|
+
console.log(chalk4.yellow(" \u26A0 Manifest: not found"));
|
|
1116
1146
|
}
|
|
1117
|
-
|
|
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
|
+
}
|
|
1118
1150
|
}
|
|
1119
1151
|
};
|
|
1120
1152
|
function resetDevStartupState() {
|
|
1121
1153
|
startupDone = false;
|
|
1122
|
-
browserOpened = false;
|
|
1123
1154
|
}
|
|
1124
1155
|
|
|
1125
1156
|
// src/config/plugins/compression.ts
|
|
@@ -1174,276 +1205,33 @@ function isCompressionAvailable() {
|
|
|
1174
1205
|
return isPackageInstalled("compression-webpack-plugin");
|
|
1175
1206
|
}
|
|
1176
1207
|
|
|
1177
|
-
// src/
|
|
1208
|
+
// src/pwa/plugin.ts
|
|
1178
1209
|
import { consola as consola4 } from "consola";
|
|
1179
|
-
function isPWAAvailable() {
|
|
1180
|
-
try {
|
|
1181
|
-
__require.resolve("@ducanh2912/next-pwa");
|
|
1182
|
-
return true;
|
|
1183
|
-
} catch {
|
|
1184
|
-
try {
|
|
1185
|
-
__require.resolve("next-pwa");
|
|
1186
|
-
consola4.warn(
|
|
1187
|
-
"Found legacy next-pwa. Please use @ducanh2912/next-pwa for Next.js 13+ support.\nRun: pnpm remove next-pwa && pnpm add @ducanh2912/next-pwa"
|
|
1188
|
-
);
|
|
1189
|
-
return true;
|
|
1190
|
-
} catch {
|
|
1191
|
-
return false;
|
|
1192
|
-
}
|
|
1193
|
-
}
|
|
1194
|
-
}
|
|
1195
1210
|
function withPWA(nextConfig, options = {}) {
|
|
1196
|
-
if (!isPWAAvailable()) {
|
|
1197
|
-
consola4.error(
|
|
1198
|
-
"@ducanh2912/next-pwa is missing!\nThis is unexpected as it should be installed automatically.\nTry: pnpm install --force\nPWA features will be disabled."
|
|
1199
|
-
);
|
|
1200
|
-
return nextConfig;
|
|
1201
|
-
}
|
|
1202
1211
|
const isDev2 = process.env.NODE_ENV === "development";
|
|
1203
1212
|
const defaultOptions = {
|
|
1204
|
-
|
|
1213
|
+
swSrc: "app/sw.ts",
|
|
1214
|
+
swDest: "public/sw.js",
|
|
1205
1215
|
disable: options.disable !== void 0 ? options.disable : isDev2,
|
|
1206
|
-
|
|
1207
|
-
skipWaiting: true,
|
|
1208
|
-
clientsClaim: true,
|
|
1209
|
-
cleanupOutdatedCaches: true,
|
|
1210
|
-
publicExcludes: ["!noprecache/**/*"],
|
|
1211
|
-
buildExcludes: [/middleware-manifest\.json$/, /build-manifest\.json$/],
|
|
1212
|
-
cacheStartUrl: true,
|
|
1213
|
-
dynamicStartUrl: true,
|
|
1216
|
+
cacheOnNavigation: true,
|
|
1214
1217
|
reloadOnOnline: true,
|
|
1215
1218
|
...options
|
|
1216
1219
|
};
|
|
1217
1220
|
try {
|
|
1218
|
-
const
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
var defaultRuntimeCaching = [
|
|
1232
|
-
{
|
|
1233
|
-
urlPattern: /^https:\/\/fonts\.(?:gstatic)\.com\/.*/i,
|
|
1234
|
-
handler: "CacheFirst",
|
|
1235
|
-
options: {
|
|
1236
|
-
cacheName: "google-fonts-webfonts",
|
|
1237
|
-
expiration: {
|
|
1238
|
-
maxEntries: 4,
|
|
1239
|
-
maxAgeSeconds: 365 * 24 * 60 * 60
|
|
1240
|
-
// 1 year
|
|
1241
|
-
}
|
|
1242
|
-
}
|
|
1243
|
-
},
|
|
1244
|
-
{
|
|
1245
|
-
urlPattern: /^https:\/\/fonts\.(?:googleapis)\.com\/.*/i,
|
|
1246
|
-
handler: "StaleWhileRevalidate",
|
|
1247
|
-
options: {
|
|
1248
|
-
cacheName: "google-fonts-stylesheets",
|
|
1249
|
-
expiration: {
|
|
1250
|
-
maxEntries: 4,
|
|
1251
|
-
maxAgeSeconds: 7 * 24 * 60 * 60
|
|
1252
|
-
// 1 week
|
|
1253
|
-
}
|
|
1254
|
-
}
|
|
1255
|
-
},
|
|
1256
|
-
{
|
|
1257
|
-
urlPattern: /\.(?:eot|otf|ttc|ttf|woff|woff2|font.css)$/i,
|
|
1258
|
-
handler: "StaleWhileRevalidate",
|
|
1259
|
-
options: {
|
|
1260
|
-
cacheName: "static-font-assets",
|
|
1261
|
-
expiration: {
|
|
1262
|
-
maxEntries: 4,
|
|
1263
|
-
maxAgeSeconds: 7 * 24 * 60 * 60
|
|
1264
|
-
// 1 week
|
|
1265
|
-
}
|
|
1266
|
-
}
|
|
1267
|
-
},
|
|
1268
|
-
{
|
|
1269
|
-
urlPattern: /\.(?:jpg|jpeg|gif|png|svg|ico|webp)$/i,
|
|
1270
|
-
handler: "StaleWhileRevalidate",
|
|
1271
|
-
options: {
|
|
1272
|
-
cacheName: "static-image-assets",
|
|
1273
|
-
expiration: {
|
|
1274
|
-
maxEntries: 64,
|
|
1275
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
1276
|
-
// 24 hours
|
|
1277
|
-
}
|
|
1278
|
-
}
|
|
1279
|
-
},
|
|
1280
|
-
{
|
|
1281
|
-
urlPattern: /\/_next\/image\?url=.+$/i,
|
|
1282
|
-
handler: "StaleWhileRevalidate",
|
|
1283
|
-
options: {
|
|
1284
|
-
cacheName: "next-image",
|
|
1285
|
-
expiration: {
|
|
1286
|
-
maxEntries: 64,
|
|
1287
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
1288
|
-
// 24 hours
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
|
-
},
|
|
1292
|
-
{
|
|
1293
|
-
urlPattern: /\.(?:mp3|wav|ogg)$/i,
|
|
1294
|
-
handler: "CacheFirst",
|
|
1295
|
-
options: {
|
|
1296
|
-
rangeRequests: true,
|
|
1297
|
-
cacheName: "static-audio-assets",
|
|
1298
|
-
expiration: {
|
|
1299
|
-
maxEntries: 32,
|
|
1300
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
1301
|
-
// 24 hours
|
|
1302
|
-
}
|
|
1303
|
-
}
|
|
1304
|
-
},
|
|
1305
|
-
{
|
|
1306
|
-
urlPattern: /\.(?:mp4)$/i,
|
|
1307
|
-
handler: "CacheFirst",
|
|
1308
|
-
options: {
|
|
1309
|
-
rangeRequests: true,
|
|
1310
|
-
cacheName: "static-video-assets",
|
|
1311
|
-
expiration: {
|
|
1312
|
-
maxEntries: 32,
|
|
1313
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
1314
|
-
// 24 hours
|
|
1315
|
-
}
|
|
1316
|
-
}
|
|
1317
|
-
},
|
|
1318
|
-
{
|
|
1319
|
-
urlPattern: /\.(?:js)$/i,
|
|
1320
|
-
handler: "StaleWhileRevalidate",
|
|
1321
|
-
options: {
|
|
1322
|
-
cacheName: "static-js-assets",
|
|
1323
|
-
expiration: {
|
|
1324
|
-
maxEntries: 32,
|
|
1325
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
1326
|
-
// 24 hours
|
|
1327
|
-
}
|
|
1328
|
-
}
|
|
1329
|
-
},
|
|
1330
|
-
{
|
|
1331
|
-
urlPattern: /\.(?:css|less)$/i,
|
|
1332
|
-
handler: "StaleWhileRevalidate",
|
|
1333
|
-
options: {
|
|
1334
|
-
cacheName: "static-style-assets",
|
|
1335
|
-
expiration: {
|
|
1336
|
-
maxEntries: 32,
|
|
1337
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
1338
|
-
// 24 hours
|
|
1339
|
-
}
|
|
1340
|
-
}
|
|
1341
|
-
},
|
|
1342
|
-
{
|
|
1343
|
-
urlPattern: /\/_next\/data\/.+\/.+\.json$/i,
|
|
1344
|
-
handler: "StaleWhileRevalidate",
|
|
1345
|
-
options: {
|
|
1346
|
-
cacheName: "next-data",
|
|
1347
|
-
expiration: {
|
|
1348
|
-
maxEntries: 32,
|
|
1349
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
1350
|
-
// 24 hours
|
|
1351
|
-
}
|
|
1352
|
-
}
|
|
1353
|
-
},
|
|
1354
|
-
{
|
|
1355
|
-
urlPattern: /\.(?:json|xml|csv)$/i,
|
|
1356
|
-
handler: "NetworkFirst",
|
|
1357
|
-
options: {
|
|
1358
|
-
cacheName: "static-data-assets",
|
|
1359
|
-
expiration: {
|
|
1360
|
-
maxEntries: 32,
|
|
1361
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
1362
|
-
// 24 hours
|
|
1363
|
-
}
|
|
1364
|
-
}
|
|
1365
|
-
},
|
|
1366
|
-
{
|
|
1367
|
-
urlPattern: ({ url }) => {
|
|
1368
|
-
const isSameOrigin = self.origin === url.origin;
|
|
1369
|
-
if (!isSameOrigin) return false;
|
|
1370
|
-
const pathname = url.pathname;
|
|
1371
|
-
if (pathname.startsWith("/api/")) return false;
|
|
1372
|
-
return true;
|
|
1373
|
-
},
|
|
1374
|
-
handler: "NetworkFirst",
|
|
1375
|
-
options: {
|
|
1376
|
-
cacheName: "pages",
|
|
1377
|
-
expiration: {
|
|
1378
|
-
maxEntries: 32,
|
|
1379
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
1380
|
-
// 24 hours
|
|
1381
|
-
}
|
|
1382
|
-
}
|
|
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;
|
|
1383
1234
|
}
|
|
1384
|
-
];
|
|
1385
|
-
function createApiCacheRule(apiUrl, options = {}) {
|
|
1386
|
-
const {
|
|
1387
|
-
strategy = "NetworkFirst",
|
|
1388
|
-
maxAge = 300,
|
|
1389
|
-
maxEntries = 50,
|
|
1390
|
-
cacheName = "api-cache"
|
|
1391
|
-
} = options;
|
|
1392
|
-
return {
|
|
1393
|
-
urlPattern: new RegExp(`^${apiUrl.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}/.*`, "i"),
|
|
1394
|
-
handler: strategy,
|
|
1395
|
-
options: {
|
|
1396
|
-
cacheName,
|
|
1397
|
-
expiration: {
|
|
1398
|
-
maxEntries,
|
|
1399
|
-
maxAgeSeconds: maxAge
|
|
1400
|
-
},
|
|
1401
|
-
networkTimeoutSeconds: 10
|
|
1402
|
-
}
|
|
1403
|
-
};
|
|
1404
|
-
}
|
|
1405
|
-
function createStaticAssetRule(extensions, options = {}) {
|
|
1406
|
-
const {
|
|
1407
|
-
strategy = "CacheFirst",
|
|
1408
|
-
maxAge = 86400,
|
|
1409
|
-
maxEntries = 64,
|
|
1410
|
-
cacheName = "static-assets"
|
|
1411
|
-
} = options;
|
|
1412
|
-
const pattern = extensions.map((ext) => ext.replace(".", "")).join("|");
|
|
1413
|
-
return {
|
|
1414
|
-
urlPattern: new RegExp(`\\.(?:${pattern})$`, "i"),
|
|
1415
|
-
handler: strategy,
|
|
1416
|
-
options: {
|
|
1417
|
-
cacheName,
|
|
1418
|
-
expiration: {
|
|
1419
|
-
maxEntries,
|
|
1420
|
-
maxAgeSeconds: maxAge
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
};
|
|
1424
|
-
}
|
|
1425
|
-
function createCdnCacheRule(cdnUrl, options = {}) {
|
|
1426
|
-
const {
|
|
1427
|
-
strategy = "CacheFirst",
|
|
1428
|
-
maxAge = 2592e3,
|
|
1429
|
-
// 30 days
|
|
1430
|
-
maxEntries = 100,
|
|
1431
|
-
cacheName = "cdn-cache"
|
|
1432
|
-
} = options;
|
|
1433
|
-
return {
|
|
1434
|
-
urlPattern: new RegExp(`^${cdnUrl.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}/.*`, "i"),
|
|
1435
|
-
handler: strategy,
|
|
1436
|
-
options: {
|
|
1437
|
-
cacheName,
|
|
1438
|
-
expiration: {
|
|
1439
|
-
maxEntries,
|
|
1440
|
-
maxAgeSeconds: maxAge
|
|
1441
|
-
},
|
|
1442
|
-
cacheableResponse: {
|
|
1443
|
-
statuses: [0, 200]
|
|
1444
|
-
}
|
|
1445
|
-
}
|
|
1446
|
-
};
|
|
1447
1235
|
}
|
|
1448
1236
|
|
|
1449
1237
|
// src/config/createNextConfig.ts
|
|
@@ -1513,6 +1301,9 @@ function createBaseNextConfig(options = {}) {
|
|
|
1513
1301
|
...DEFAULT_TRANSPILE_PACKAGES,
|
|
1514
1302
|
...options.transpilePackages || []
|
|
1515
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 || {},
|
|
1516
1307
|
// Experimental features
|
|
1517
1308
|
experimental: {
|
|
1518
1309
|
// Optimize package imports (only in production)
|
|
@@ -1530,9 +1321,6 @@ function createBaseNextConfig(options = {}) {
|
|
|
1530
1321
|
...options.experimental
|
|
1531
1322
|
},
|
|
1532
1323
|
// Webpack configuration
|
|
1533
|
-
// NOTE: Next.js 16 uses Turbopack by default in dev mode, which doesn't support webpack plugins.
|
|
1534
|
-
// DevStartupPlugin only runs in webpack mode (next dev --webpack).
|
|
1535
|
-
// For Turbopack compatibility, consider using a custom dev script for browser auto-open.
|
|
1536
1324
|
webpack: (config, webpackOptions) => {
|
|
1537
1325
|
const { isServer, dev } = webpackOptions;
|
|
1538
1326
|
if (dev && !isServer) {
|
|
@@ -1541,7 +1329,6 @@ function createBaseNextConfig(options = {}) {
|
|
|
1541
1329
|
}
|
|
1542
1330
|
config.plugins.push(
|
|
1543
1331
|
new DevStartupPlugin({
|
|
1544
|
-
openBrowser: options.openBrowser,
|
|
1545
1332
|
checkUpdates: options.checkUpdates,
|
|
1546
1333
|
autoUpdate: options.autoUpdate,
|
|
1547
1334
|
forceCheckWorkspace: options.forceCheckWorkspace,
|
|
@@ -1575,7 +1362,6 @@ function createBaseNextConfig(options = {}) {
|
|
|
1575
1362
|
let finalConfig = deepMerge(baseConfig, options);
|
|
1576
1363
|
delete finalConfig.optimizePackageImports;
|
|
1577
1364
|
delete finalConfig.isDefaultCfgAdmin;
|
|
1578
|
-
delete finalConfig.openBrowser;
|
|
1579
1365
|
delete finalConfig.checkUpdates;
|
|
1580
1366
|
delete finalConfig.autoUpdate;
|
|
1581
1367
|
delete finalConfig.forceCheckWorkspace;
|
|
@@ -1589,98 +1375,6 @@ function createBaseNextConfig(options = {}) {
|
|
|
1589
1375
|
delete finalConfig.pwa;
|
|
1590
1376
|
return finalConfig;
|
|
1591
1377
|
}
|
|
1592
|
-
|
|
1593
|
-
// src/config/utils/manifest.ts
|
|
1594
|
-
function createManifestMetadata(config) {
|
|
1595
|
-
return {
|
|
1596
|
-
manifest: "/manifest.json",
|
|
1597
|
-
themeColor: config.themeColor || "#000000",
|
|
1598
|
-
appleWebApp: {
|
|
1599
|
-
capable: true,
|
|
1600
|
-
statusBarStyle: "default",
|
|
1601
|
-
title: config.shortName || config.name
|
|
1602
|
-
},
|
|
1603
|
-
applicationName: config.name,
|
|
1604
|
-
formatDetection: {
|
|
1605
|
-
telephone: false
|
|
1606
|
-
},
|
|
1607
|
-
viewport: {
|
|
1608
|
-
width: "device-width",
|
|
1609
|
-
initialScale: 1,
|
|
1610
|
-
maximumScale: 1
|
|
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,17 +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
1400
|
deepMerge,
|
|
1712
|
-
defaultRuntimeCaching,
|
|
1713
1401
|
detectPackageManager,
|
|
1714
1402
|
fetchLatestVersion,
|
|
1715
|
-
generateManifest,
|
|
1716
1403
|
getApiUrl,
|
|
1717
1404
|
getBasePath,
|
|
1718
1405
|
getCurrentVersion,
|
|
@@ -1727,7 +1414,6 @@ export {
|
|
|
1727
1414
|
isCI,
|
|
1728
1415
|
isCompressionAvailable,
|
|
1729
1416
|
isDev,
|
|
1730
|
-
isPWAAvailable,
|
|
1731
1417
|
isPackageInstalled,
|
|
1732
1418
|
isProduction,
|
|
1733
1419
|
isStaticBuild,
|
|
@@ -1735,7 +1421,6 @@ export {
|
|
|
1735
1421
|
resetDevStartupState,
|
|
1736
1422
|
resetInstallerPreferences,
|
|
1737
1423
|
resetUpdaterPreferences,
|
|
1738
|
-
updatePackagesWithProgress
|
|
1739
|
-
withPWA
|
|
1424
|
+
updatePackagesWithProgress
|
|
1740
1425
|
};
|
|
1741
1426
|
//# sourceMappingURL=index.mjs.map
|