@djangocfg/nextjs 2.1.36 → 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 -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/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,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",
|
|
@@ -2035,7 +2066,6 @@ function resetUpdaterPreferences() {
|
|
|
2035
2066
|
|
|
2036
2067
|
// src/config/plugins/devStartup.ts
|
|
2037
2068
|
var startupDone = false;
|
|
2038
|
-
var browserOpened = false;
|
|
2039
2069
|
var DevStartupPlugin = class {
|
|
2040
2070
|
constructor(options = {}) {
|
|
2041
2071
|
this.options = options;
|
|
@@ -2046,10 +2076,6 @@ var DevStartupPlugin = class {
|
|
|
2046
2076
|
startupDone = true;
|
|
2047
2077
|
await this.runStartupTasks();
|
|
2048
2078
|
}
|
|
2049
|
-
if (this.options.openBrowser && !browserOpened) {
|
|
2050
|
-
browserOpened = true;
|
|
2051
|
-
this.openBrowser();
|
|
2052
|
-
}
|
|
2053
2079
|
});
|
|
2054
2080
|
}
|
|
2055
2081
|
async runStartupTasks() {
|
|
@@ -2058,6 +2084,7 @@ var DevStartupPlugin = class {
|
|
|
2058
2084
|
if (version) {
|
|
2059
2085
|
console.log(chalk4.dim(` \u{1F4E6} @djangocfg/nextjs v${version}`));
|
|
2060
2086
|
}
|
|
2087
|
+
this.checkPWASetup();
|
|
2061
2088
|
console.log(chalk4.magenta(` ${AI_DOCS_HINT}
|
|
2062
2089
|
`));
|
|
2063
2090
|
if (this.options.checkUpdates !== false) {
|
|
@@ -2078,27 +2105,33 @@ var DevStartupPlugin = class {
|
|
|
2078
2105
|
});
|
|
2079
2106
|
}
|
|
2080
2107
|
}
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
}
|
|
2094
|
-
console.
|
|
2108
|
+
checkPWASetup() {
|
|
2109
|
+
const fs = __require("fs");
|
|
2110
|
+
const path = __require("path");
|
|
2111
|
+
const cwd = process.cwd();
|
|
2112
|
+
const swPath = path.join(cwd, "app", "sw.ts");
|
|
2113
|
+
const manifestPath = path.join(cwd, "app", "manifest.ts");
|
|
2114
|
+
const hasSW = fs.existsSync(swPath);
|
|
2115
|
+
const hasManifest = fs.existsSync(manifestPath);
|
|
2116
|
+
if (hasSW || hasManifest) {
|
|
2117
|
+
console.log(chalk4.cyan(" \u{1F4F1} PWA Configuration:"));
|
|
2118
|
+
if (hasSW) {
|
|
2119
|
+
console.log(chalk4.green(" \u2713 Service Worker: app/sw.ts"));
|
|
2120
|
+
} else {
|
|
2121
|
+
console.log(chalk4.yellow(" \u26A0 Service Worker: not found"));
|
|
2095
2122
|
}
|
|
2096
|
-
|
|
2123
|
+
if (hasManifest) {
|
|
2124
|
+
console.log(chalk4.green(" \u2713 Manifest: app/manifest.ts"));
|
|
2125
|
+
} else {
|
|
2126
|
+
console.log(chalk4.yellow(" \u26A0 Manifest: not found"));
|
|
2127
|
+
}
|
|
2128
|
+
console.log(chalk4.dim(" \u2192 Check: DevTools \u2192 Application \u2192 Service Workers"));
|
|
2129
|
+
console.log(chalk4.dim(" \u2192 Test push: import from @djangocfg/nextjs/pwa"));
|
|
2130
|
+
}
|
|
2097
2131
|
}
|
|
2098
2132
|
};
|
|
2099
2133
|
function resetDevStartupState() {
|
|
2100
2134
|
startupDone = false;
|
|
2101
|
-
browserOpened = false;
|
|
2102
2135
|
}
|
|
2103
2136
|
|
|
2104
2137
|
// src/config/plugins/compression.ts
|
|
@@ -2153,276 +2186,33 @@ function isCompressionAvailable() {
|
|
|
2153
2186
|
return isPackageInstalled("compression-webpack-plugin");
|
|
2154
2187
|
}
|
|
2155
2188
|
|
|
2156
|
-
// src/
|
|
2189
|
+
// src/pwa/plugin.ts
|
|
2157
2190
|
import { consola as consola4 } from "consola";
|
|
2158
|
-
function isPWAAvailable() {
|
|
2159
|
-
try {
|
|
2160
|
-
__require.resolve("@ducanh2912/next-pwa");
|
|
2161
|
-
return true;
|
|
2162
|
-
} catch {
|
|
2163
|
-
try {
|
|
2164
|
-
__require.resolve("next-pwa");
|
|
2165
|
-
consola4.warn(
|
|
2166
|
-
"Found legacy next-pwa. Please use @ducanh2912/next-pwa for Next.js 13+ support.\nRun: pnpm remove next-pwa && pnpm add @ducanh2912/next-pwa"
|
|
2167
|
-
);
|
|
2168
|
-
return true;
|
|
2169
|
-
} catch {
|
|
2170
|
-
return false;
|
|
2171
|
-
}
|
|
2172
|
-
}
|
|
2173
|
-
}
|
|
2174
2191
|
function withPWA(nextConfig, options = {}) {
|
|
2175
|
-
if (!isPWAAvailable()) {
|
|
2176
|
-
consola4.error(
|
|
2177
|
-
"@ducanh2912/next-pwa is missing!\nThis is unexpected as it should be installed automatically.\nTry: pnpm install --force\nPWA features will be disabled."
|
|
2178
|
-
);
|
|
2179
|
-
return nextConfig;
|
|
2180
|
-
}
|
|
2181
2192
|
const isDev2 = process.env.NODE_ENV === "development";
|
|
2182
2193
|
const defaultOptions = {
|
|
2183
|
-
|
|
2194
|
+
swSrc: "app/sw.ts",
|
|
2195
|
+
swDest: "public/sw.js",
|
|
2184
2196
|
disable: options.disable !== void 0 ? options.disable : isDev2,
|
|
2185
|
-
|
|
2186
|
-
skipWaiting: true,
|
|
2187
|
-
clientsClaim: true,
|
|
2188
|
-
cleanupOutdatedCaches: true,
|
|
2189
|
-
publicExcludes: ["!noprecache/**/*"],
|
|
2190
|
-
buildExcludes: [/middleware-manifest\.json$/, /build-manifest\.json$/],
|
|
2191
|
-
cacheStartUrl: true,
|
|
2192
|
-
dynamicStartUrl: true,
|
|
2197
|
+
cacheOnNavigation: true,
|
|
2193
2198
|
reloadOnOnline: true,
|
|
2194
2199
|
...options
|
|
2195
2200
|
};
|
|
2196
2201
|
try {
|
|
2197
|
-
const
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
var defaultRuntimeCaching = [
|
|
2211
|
-
{
|
|
2212
|
-
urlPattern: /^https:\/\/fonts\.(?:gstatic)\.com\/.*/i,
|
|
2213
|
-
handler: "CacheFirst",
|
|
2214
|
-
options: {
|
|
2215
|
-
cacheName: "google-fonts-webfonts",
|
|
2216
|
-
expiration: {
|
|
2217
|
-
maxEntries: 4,
|
|
2218
|
-
maxAgeSeconds: 365 * 24 * 60 * 60
|
|
2219
|
-
// 1 year
|
|
2220
|
-
}
|
|
2221
|
-
}
|
|
2222
|
-
},
|
|
2223
|
-
{
|
|
2224
|
-
urlPattern: /^https:\/\/fonts\.(?:googleapis)\.com\/.*/i,
|
|
2225
|
-
handler: "StaleWhileRevalidate",
|
|
2226
|
-
options: {
|
|
2227
|
-
cacheName: "google-fonts-stylesheets",
|
|
2228
|
-
expiration: {
|
|
2229
|
-
maxEntries: 4,
|
|
2230
|
-
maxAgeSeconds: 7 * 24 * 60 * 60
|
|
2231
|
-
// 1 week
|
|
2232
|
-
}
|
|
2233
|
-
}
|
|
2234
|
-
},
|
|
2235
|
-
{
|
|
2236
|
-
urlPattern: /\.(?:eot|otf|ttc|ttf|woff|woff2|font.css)$/i,
|
|
2237
|
-
handler: "StaleWhileRevalidate",
|
|
2238
|
-
options: {
|
|
2239
|
-
cacheName: "static-font-assets",
|
|
2240
|
-
expiration: {
|
|
2241
|
-
maxEntries: 4,
|
|
2242
|
-
maxAgeSeconds: 7 * 24 * 60 * 60
|
|
2243
|
-
// 1 week
|
|
2244
|
-
}
|
|
2245
|
-
}
|
|
2246
|
-
},
|
|
2247
|
-
{
|
|
2248
|
-
urlPattern: /\.(?:jpg|jpeg|gif|png|svg|ico|webp)$/i,
|
|
2249
|
-
handler: "StaleWhileRevalidate",
|
|
2250
|
-
options: {
|
|
2251
|
-
cacheName: "static-image-assets",
|
|
2252
|
-
expiration: {
|
|
2253
|
-
maxEntries: 64,
|
|
2254
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
2255
|
-
// 24 hours
|
|
2256
|
-
}
|
|
2257
|
-
}
|
|
2258
|
-
},
|
|
2259
|
-
{
|
|
2260
|
-
urlPattern: /\/_next\/image\?url=.+$/i,
|
|
2261
|
-
handler: "StaleWhileRevalidate",
|
|
2262
|
-
options: {
|
|
2263
|
-
cacheName: "next-image",
|
|
2264
|
-
expiration: {
|
|
2265
|
-
maxEntries: 64,
|
|
2266
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
2267
|
-
// 24 hours
|
|
2268
|
-
}
|
|
2269
|
-
}
|
|
2270
|
-
},
|
|
2271
|
-
{
|
|
2272
|
-
urlPattern: /\.(?:mp3|wav|ogg)$/i,
|
|
2273
|
-
handler: "CacheFirst",
|
|
2274
|
-
options: {
|
|
2275
|
-
rangeRequests: true,
|
|
2276
|
-
cacheName: "static-audio-assets",
|
|
2277
|
-
expiration: {
|
|
2278
|
-
maxEntries: 32,
|
|
2279
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
2280
|
-
// 24 hours
|
|
2281
|
-
}
|
|
2282
|
-
}
|
|
2283
|
-
},
|
|
2284
|
-
{
|
|
2285
|
-
urlPattern: /\.(?:mp4)$/i,
|
|
2286
|
-
handler: "CacheFirst",
|
|
2287
|
-
options: {
|
|
2288
|
-
rangeRequests: true,
|
|
2289
|
-
cacheName: "static-video-assets",
|
|
2290
|
-
expiration: {
|
|
2291
|
-
maxEntries: 32,
|
|
2292
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
2293
|
-
// 24 hours
|
|
2294
|
-
}
|
|
2295
|
-
}
|
|
2296
|
-
},
|
|
2297
|
-
{
|
|
2298
|
-
urlPattern: /\.(?:js)$/i,
|
|
2299
|
-
handler: "StaleWhileRevalidate",
|
|
2300
|
-
options: {
|
|
2301
|
-
cacheName: "static-js-assets",
|
|
2302
|
-
expiration: {
|
|
2303
|
-
maxEntries: 32,
|
|
2304
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
2305
|
-
// 24 hours
|
|
2306
|
-
}
|
|
2307
|
-
}
|
|
2308
|
-
},
|
|
2309
|
-
{
|
|
2310
|
-
urlPattern: /\.(?:css|less)$/i,
|
|
2311
|
-
handler: "StaleWhileRevalidate",
|
|
2312
|
-
options: {
|
|
2313
|
-
cacheName: "static-style-assets",
|
|
2314
|
-
expiration: {
|
|
2315
|
-
maxEntries: 32,
|
|
2316
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
2317
|
-
// 24 hours
|
|
2318
|
-
}
|
|
2319
|
-
}
|
|
2320
|
-
},
|
|
2321
|
-
{
|
|
2322
|
-
urlPattern: /\/_next\/data\/.+\/.+\.json$/i,
|
|
2323
|
-
handler: "StaleWhileRevalidate",
|
|
2324
|
-
options: {
|
|
2325
|
-
cacheName: "next-data",
|
|
2326
|
-
expiration: {
|
|
2327
|
-
maxEntries: 32,
|
|
2328
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
2329
|
-
// 24 hours
|
|
2330
|
-
}
|
|
2331
|
-
}
|
|
2332
|
-
},
|
|
2333
|
-
{
|
|
2334
|
-
urlPattern: /\.(?:json|xml|csv)$/i,
|
|
2335
|
-
handler: "NetworkFirst",
|
|
2336
|
-
options: {
|
|
2337
|
-
cacheName: "static-data-assets",
|
|
2338
|
-
expiration: {
|
|
2339
|
-
maxEntries: 32,
|
|
2340
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
2341
|
-
// 24 hours
|
|
2342
|
-
}
|
|
2343
|
-
}
|
|
2344
|
-
},
|
|
2345
|
-
{
|
|
2346
|
-
urlPattern: ({ url }) => {
|
|
2347
|
-
const isSameOrigin = self.origin === url.origin;
|
|
2348
|
-
if (!isSameOrigin) return false;
|
|
2349
|
-
const pathname = url.pathname;
|
|
2350
|
-
if (pathname.startsWith("/api/")) return false;
|
|
2351
|
-
return true;
|
|
2352
|
-
},
|
|
2353
|
-
handler: "NetworkFirst",
|
|
2354
|
-
options: {
|
|
2355
|
-
cacheName: "pages",
|
|
2356
|
-
expiration: {
|
|
2357
|
-
maxEntries: 32,
|
|
2358
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
2359
|
-
// 24 hours
|
|
2360
|
-
}
|
|
2361
|
-
}
|
|
2202
|
+
const withSerwistInit = __require("@serwist/next").default;
|
|
2203
|
+
const withSerwist = withSerwistInit({
|
|
2204
|
+
swSrc: defaultOptions.swSrc,
|
|
2205
|
+
swDest: defaultOptions.swDest,
|
|
2206
|
+
disable: defaultOptions.disable,
|
|
2207
|
+
cacheOnNavigation: defaultOptions.cacheOnNavigation,
|
|
2208
|
+
reloadOnOnline: defaultOptions.reloadOnOnline,
|
|
2209
|
+
...defaultOptions.serwistOptions
|
|
2210
|
+
});
|
|
2211
|
+
return withSerwist(nextConfig);
|
|
2212
|
+
} catch (error) {
|
|
2213
|
+
consola4.error("Failed to configure Serwist:", error);
|
|
2214
|
+
return nextConfig;
|
|
2362
2215
|
}
|
|
2363
|
-
];
|
|
2364
|
-
function createApiCacheRule(apiUrl, options = {}) {
|
|
2365
|
-
const {
|
|
2366
|
-
strategy = "NetworkFirst",
|
|
2367
|
-
maxAge = 300,
|
|
2368
|
-
maxEntries = 50,
|
|
2369
|
-
cacheName = "api-cache"
|
|
2370
|
-
} = options;
|
|
2371
|
-
return {
|
|
2372
|
-
urlPattern: new RegExp(`^${apiUrl.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}/.*`, "i"),
|
|
2373
|
-
handler: strategy,
|
|
2374
|
-
options: {
|
|
2375
|
-
cacheName,
|
|
2376
|
-
expiration: {
|
|
2377
|
-
maxEntries,
|
|
2378
|
-
maxAgeSeconds: maxAge
|
|
2379
|
-
},
|
|
2380
|
-
networkTimeoutSeconds: 10
|
|
2381
|
-
}
|
|
2382
|
-
};
|
|
2383
|
-
}
|
|
2384
|
-
function createStaticAssetRule(extensions, options = {}) {
|
|
2385
|
-
const {
|
|
2386
|
-
strategy = "CacheFirst",
|
|
2387
|
-
maxAge = 86400,
|
|
2388
|
-
maxEntries = 64,
|
|
2389
|
-
cacheName = "static-assets"
|
|
2390
|
-
} = options;
|
|
2391
|
-
const pattern = extensions.map((ext) => ext.replace(".", "")).join("|");
|
|
2392
|
-
return {
|
|
2393
|
-
urlPattern: new RegExp(`\\.(?:${pattern})$`, "i"),
|
|
2394
|
-
handler: strategy,
|
|
2395
|
-
options: {
|
|
2396
|
-
cacheName,
|
|
2397
|
-
expiration: {
|
|
2398
|
-
maxEntries,
|
|
2399
|
-
maxAgeSeconds: maxAge
|
|
2400
|
-
}
|
|
2401
|
-
}
|
|
2402
|
-
};
|
|
2403
|
-
}
|
|
2404
|
-
function createCdnCacheRule(cdnUrl, options = {}) {
|
|
2405
|
-
const {
|
|
2406
|
-
strategy = "CacheFirst",
|
|
2407
|
-
maxAge = 2592e3,
|
|
2408
|
-
// 30 days
|
|
2409
|
-
maxEntries = 100,
|
|
2410
|
-
cacheName = "cdn-cache"
|
|
2411
|
-
} = options;
|
|
2412
|
-
return {
|
|
2413
|
-
urlPattern: new RegExp(`^${cdnUrl.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}/.*`, "i"),
|
|
2414
|
-
handler: strategy,
|
|
2415
|
-
options: {
|
|
2416
|
-
cacheName,
|
|
2417
|
-
expiration: {
|
|
2418
|
-
maxEntries,
|
|
2419
|
-
maxAgeSeconds: maxAge
|
|
2420
|
-
},
|
|
2421
|
-
cacheableResponse: {
|
|
2422
|
-
statuses: [0, 200]
|
|
2423
|
-
}
|
|
2424
|
-
}
|
|
2425
|
-
};
|
|
2426
2216
|
}
|
|
2427
2217
|
|
|
2428
2218
|
// src/config/createNextConfig.ts
|
|
@@ -2492,6 +2282,9 @@ function createBaseNextConfig(options = {}) {
|
|
|
2492
2282
|
...DEFAULT_TRANSPILE_PACKAGES,
|
|
2493
2283
|
...options.transpilePackages || []
|
|
2494
2284
|
],
|
|
2285
|
+
// Turbopack configuration (Next.js 16+ default bundler)
|
|
2286
|
+
// Always set turbopack config to silence Next.js 16 warning about webpack config
|
|
2287
|
+
turbopack: options.turbopack || {},
|
|
2495
2288
|
// Experimental features
|
|
2496
2289
|
experimental: {
|
|
2497
2290
|
// Optimize package imports (only in production)
|
|
@@ -2509,9 +2302,6 @@ function createBaseNextConfig(options = {}) {
|
|
|
2509
2302
|
...options.experimental
|
|
2510
2303
|
},
|
|
2511
2304
|
// Webpack configuration
|
|
2512
|
-
// NOTE: Next.js 16 uses Turbopack by default in dev mode, which doesn't support webpack plugins.
|
|
2513
|
-
// DevStartupPlugin only runs in webpack mode (next dev --webpack).
|
|
2514
|
-
// For Turbopack compatibility, consider using a custom dev script for browser auto-open.
|
|
2515
2305
|
webpack: (config, webpackOptions) => {
|
|
2516
2306
|
const { isServer, dev } = webpackOptions;
|
|
2517
2307
|
if (dev && !isServer) {
|
|
@@ -2520,7 +2310,6 @@ function createBaseNextConfig(options = {}) {
|
|
|
2520
2310
|
}
|
|
2521
2311
|
config.plugins.push(
|
|
2522
2312
|
new DevStartupPlugin({
|
|
2523
|
-
openBrowser: options.openBrowser,
|
|
2524
2313
|
checkUpdates: options.checkUpdates,
|
|
2525
2314
|
autoUpdate: options.autoUpdate,
|
|
2526
2315
|
forceCheckWorkspace: options.forceCheckWorkspace,
|
|
@@ -2554,7 +2343,6 @@ function createBaseNextConfig(options = {}) {
|
|
|
2554
2343
|
let finalConfig = deepMerge(baseConfig, options);
|
|
2555
2344
|
delete finalConfig.optimizePackageImports;
|
|
2556
2345
|
delete finalConfig.isDefaultCfgAdmin;
|
|
2557
|
-
delete finalConfig.openBrowser;
|
|
2558
2346
|
delete finalConfig.checkUpdates;
|
|
2559
2347
|
delete finalConfig.autoUpdate;
|
|
2560
2348
|
delete finalConfig.forceCheckWorkspace;
|
|
@@ -2569,100 +2357,6 @@ function createBaseNextConfig(options = {}) {
|
|
|
2569
2357
|
return finalConfig;
|
|
2570
2358
|
}
|
|
2571
2359
|
|
|
2572
|
-
// src/config/utils/manifest.ts
|
|
2573
|
-
function createViewport(config) {
|
|
2574
|
-
return {
|
|
2575
|
-
width: "device-width",
|
|
2576
|
-
initialScale: 1,
|
|
2577
|
-
maximumScale: 1,
|
|
2578
|
-
themeColor: config.themeColor || "#000000"
|
|
2579
|
-
};
|
|
2580
|
-
}
|
|
2581
|
-
function createManifestMetadata(config) {
|
|
2582
|
-
return {
|
|
2583
|
-
manifest: "/manifest.json",
|
|
2584
|
-
appleWebApp: {
|
|
2585
|
-
capable: true,
|
|
2586
|
-
statusBarStyle: "default",
|
|
2587
|
-
title: config.shortName || config.name
|
|
2588
|
-
},
|
|
2589
|
-
applicationName: config.name,
|
|
2590
|
-
formatDetection: {
|
|
2591
|
-
telephone: false
|
|
2592
|
-
}
|
|
2593
|
-
};
|
|
2594
|
-
}
|
|
2595
|
-
function createManifest(config) {
|
|
2596
|
-
return () => {
|
|
2597
|
-
let manifestIcons;
|
|
2598
|
-
if (Array.isArray(config.icons)) {
|
|
2599
|
-
manifestIcons = config.icons;
|
|
2600
|
-
} else if (config.icons) {
|
|
2601
|
-
const { logo192, logo384, logo512 } = config.icons;
|
|
2602
|
-
manifestIcons = [
|
|
2603
|
-
...logo192 ? [
|
|
2604
|
-
{
|
|
2605
|
-
src: logo192,
|
|
2606
|
-
sizes: "192x192",
|
|
2607
|
-
type: "image/png",
|
|
2608
|
-
purpose: "maskable"
|
|
2609
|
-
}
|
|
2610
|
-
] : [],
|
|
2611
|
-
...logo384 ? [
|
|
2612
|
-
{
|
|
2613
|
-
src: logo384,
|
|
2614
|
-
sizes: "384x384",
|
|
2615
|
-
type: "image/png"
|
|
2616
|
-
}
|
|
2617
|
-
] : [],
|
|
2618
|
-
...logo512 ? [
|
|
2619
|
-
{
|
|
2620
|
-
src: logo512,
|
|
2621
|
-
sizes: "512x512",
|
|
2622
|
-
type: "image/png"
|
|
2623
|
-
}
|
|
2624
|
-
] : []
|
|
2625
|
-
];
|
|
2626
|
-
} else {
|
|
2627
|
-
manifestIcons = [
|
|
2628
|
-
{
|
|
2629
|
-
src: "/static/logos/192x192.png",
|
|
2630
|
-
sizes: "192x192",
|
|
2631
|
-
type: "image/png",
|
|
2632
|
-
purpose: "maskable"
|
|
2633
|
-
},
|
|
2634
|
-
{
|
|
2635
|
-
src: "/static/logos/384x384.png",
|
|
2636
|
-
sizes: "384x384",
|
|
2637
|
-
type: "image/png"
|
|
2638
|
-
},
|
|
2639
|
-
{
|
|
2640
|
-
src: "/static/logos/512x512.png",
|
|
2641
|
-
sizes: "512x512",
|
|
2642
|
-
type: "image/png"
|
|
2643
|
-
}
|
|
2644
|
-
];
|
|
2645
|
-
}
|
|
2646
|
-
return {
|
|
2647
|
-
name: config.name,
|
|
2648
|
-
short_name: config.shortName || config.name,
|
|
2649
|
-
description: config.description || config.name,
|
|
2650
|
-
start_url: config.startUrl || "/",
|
|
2651
|
-
scope: config.scope || "/",
|
|
2652
|
-
display: config.display || "standalone",
|
|
2653
|
-
orientation: config.orientation || "portrait",
|
|
2654
|
-
background_color: config.backgroundColor || "#000000",
|
|
2655
|
-
theme_color: config.themeColor || "#ffffff",
|
|
2656
|
-
lang: config.lang || "en",
|
|
2657
|
-
dir: config.dir || "ltr",
|
|
2658
|
-
icons: manifestIcons
|
|
2659
|
-
};
|
|
2660
|
-
};
|
|
2661
|
-
}
|
|
2662
|
-
function generateManifest(config) {
|
|
2663
|
-
return createManifest(config)();
|
|
2664
|
-
}
|
|
2665
|
-
|
|
2666
2360
|
// src/ai/client.ts
|
|
2667
2361
|
var DjangoCfgDocsClient = class {
|
|
2668
2362
|
constructor(baseUrl = MCP_BASE_URL, timeout = DEFAULT_TIMEOUT) {
|
|
@@ -2792,30 +2486,22 @@ export {
|
|
|
2792
2486
|
checkForUpdate,
|
|
2793
2487
|
checkForUpdates,
|
|
2794
2488
|
checkPackages,
|
|
2795
|
-
createApiCacheRule,
|
|
2796
2489
|
createBaseNextConfig,
|
|
2797
|
-
createCdnCacheRule,
|
|
2798
2490
|
createFontLoader,
|
|
2799
2491
|
createHealthHandler,
|
|
2800
|
-
createManifest,
|
|
2801
|
-
createManifestMetadata,
|
|
2802
2492
|
createOgImageDynamicRoute,
|
|
2803
2493
|
createOgImageHandler,
|
|
2804
2494
|
createOgImageMetadataGenerator,
|
|
2805
2495
|
createOgImageUrlBuilder,
|
|
2806
2496
|
createSitemapHandler,
|
|
2807
|
-
createStaticAssetRule,
|
|
2808
|
-
createViewport,
|
|
2809
2497
|
decodeBase64,
|
|
2810
2498
|
deepMerge,
|
|
2811
|
-
defaultRuntimeCaching,
|
|
2812
2499
|
defineRoute,
|
|
2813
2500
|
detectPackageManager,
|
|
2814
2501
|
encodeBase64,
|
|
2815
2502
|
fetchLatestVersion,
|
|
2816
2503
|
findRoute,
|
|
2817
2504
|
findRouteByPattern,
|
|
2818
|
-
generateManifest,
|
|
2819
2505
|
generateOgImageMetadata,
|
|
2820
2506
|
generateOgImageUrl,
|
|
2821
2507
|
generateSitemapXml,
|
|
@@ -2840,7 +2526,6 @@ export {
|
|
|
2840
2526
|
isCI,
|
|
2841
2527
|
isCompressionAvailable,
|
|
2842
2528
|
isDev,
|
|
2843
|
-
isPWAAvailable,
|
|
2844
2529
|
isPackageInstalled,
|
|
2845
2530
|
isProduction,
|
|
2846
2531
|
isStaticBuild,
|
|
@@ -2856,7 +2541,6 @@ export {
|
|
|
2856
2541
|
resetUpdaterPreferences,
|
|
2857
2542
|
routesToMenuItems,
|
|
2858
2543
|
search,
|
|
2859
|
-
updatePackagesWithProgress
|
|
2860
|
-
withPWA
|
|
2544
|
+
updatePackagesWithProgress
|
|
2861
2545
|
};
|
|
2862
2546
|
//# sourceMappingURL=index.mjs.map
|