@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/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",
|
|
@@ -2037,7 +2066,6 @@ function resetUpdaterPreferences() {
|
|
|
2037
2066
|
|
|
2038
2067
|
// src/config/plugins/devStartup.ts
|
|
2039
2068
|
var startupDone = false;
|
|
2040
|
-
var browserOpened = false;
|
|
2041
2069
|
var DevStartupPlugin = class {
|
|
2042
2070
|
constructor(options = {}) {
|
|
2043
2071
|
this.options = options;
|
|
@@ -2048,10 +2076,6 @@ var DevStartupPlugin = class {
|
|
|
2048
2076
|
startupDone = true;
|
|
2049
2077
|
await this.runStartupTasks();
|
|
2050
2078
|
}
|
|
2051
|
-
if (this.options.openBrowser && !browserOpened) {
|
|
2052
|
-
browserOpened = true;
|
|
2053
|
-
this.openBrowser();
|
|
2054
|
-
}
|
|
2055
2079
|
});
|
|
2056
2080
|
}
|
|
2057
2081
|
async runStartupTasks() {
|
|
@@ -2060,6 +2084,7 @@ var DevStartupPlugin = class {
|
|
|
2060
2084
|
if (version) {
|
|
2061
2085
|
console.log(chalk4.dim(` \u{1F4E6} @djangocfg/nextjs v${version}`));
|
|
2062
2086
|
}
|
|
2087
|
+
this.checkPWASetup();
|
|
2063
2088
|
console.log(chalk4.magenta(` ${AI_DOCS_HINT}
|
|
2064
2089
|
`));
|
|
2065
2090
|
if (this.options.checkUpdates !== false) {
|
|
@@ -2080,27 +2105,33 @@ var DevStartupPlugin = class {
|
|
|
2080
2105
|
});
|
|
2081
2106
|
}
|
|
2082
2107
|
}
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
}
|
|
2096
|
-
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"));
|
|
2097
2122
|
}
|
|
2098
|
-
|
|
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
|
+
}
|
|
2099
2131
|
}
|
|
2100
2132
|
};
|
|
2101
2133
|
function resetDevStartupState() {
|
|
2102
2134
|
startupDone = false;
|
|
2103
|
-
browserOpened = false;
|
|
2104
2135
|
}
|
|
2105
2136
|
|
|
2106
2137
|
// src/config/plugins/compression.ts
|
|
@@ -2155,276 +2186,33 @@ function isCompressionAvailable() {
|
|
|
2155
2186
|
return isPackageInstalled("compression-webpack-plugin");
|
|
2156
2187
|
}
|
|
2157
2188
|
|
|
2158
|
-
// src/
|
|
2189
|
+
// src/pwa/plugin.ts
|
|
2159
2190
|
import { consola as consola4 } from "consola";
|
|
2160
|
-
function isPWAAvailable() {
|
|
2161
|
-
try {
|
|
2162
|
-
__require.resolve("@ducanh2912/next-pwa");
|
|
2163
|
-
return true;
|
|
2164
|
-
} catch {
|
|
2165
|
-
try {
|
|
2166
|
-
__require.resolve("next-pwa");
|
|
2167
|
-
consola4.warn(
|
|
2168
|
-
"Found legacy next-pwa. Please use @ducanh2912/next-pwa for Next.js 13+ support.\nRun: pnpm remove next-pwa && pnpm add @ducanh2912/next-pwa"
|
|
2169
|
-
);
|
|
2170
|
-
return true;
|
|
2171
|
-
} catch {
|
|
2172
|
-
return false;
|
|
2173
|
-
}
|
|
2174
|
-
}
|
|
2175
|
-
}
|
|
2176
2191
|
function withPWA(nextConfig, options = {}) {
|
|
2177
|
-
if (!isPWAAvailable()) {
|
|
2178
|
-
consola4.error(
|
|
2179
|
-
"@ducanh2912/next-pwa is missing!\nThis is unexpected as it should be installed automatically.\nTry: pnpm install --force\nPWA features will be disabled."
|
|
2180
|
-
);
|
|
2181
|
-
return nextConfig;
|
|
2182
|
-
}
|
|
2183
2192
|
const isDev2 = process.env.NODE_ENV === "development";
|
|
2184
2193
|
const defaultOptions = {
|
|
2185
|
-
|
|
2194
|
+
swSrc: "app/sw.ts",
|
|
2195
|
+
swDest: "public/sw.js",
|
|
2186
2196
|
disable: options.disable !== void 0 ? options.disable : isDev2,
|
|
2187
|
-
|
|
2188
|
-
skipWaiting: true,
|
|
2189
|
-
clientsClaim: true,
|
|
2190
|
-
cleanupOutdatedCaches: true,
|
|
2191
|
-
publicExcludes: ["!noprecache/**/*"],
|
|
2192
|
-
buildExcludes: [/middleware-manifest\.json$/, /build-manifest\.json$/],
|
|
2193
|
-
cacheStartUrl: true,
|
|
2194
|
-
dynamicStartUrl: true,
|
|
2197
|
+
cacheOnNavigation: true,
|
|
2195
2198
|
reloadOnOnline: true,
|
|
2196
2199
|
...options
|
|
2197
2200
|
};
|
|
2198
2201
|
try {
|
|
2199
|
-
const
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
var defaultRuntimeCaching = [
|
|
2213
|
-
{
|
|
2214
|
-
urlPattern: /^https:\/\/fonts\.(?:gstatic)\.com\/.*/i,
|
|
2215
|
-
handler: "CacheFirst",
|
|
2216
|
-
options: {
|
|
2217
|
-
cacheName: "google-fonts-webfonts",
|
|
2218
|
-
expiration: {
|
|
2219
|
-
maxEntries: 4,
|
|
2220
|
-
maxAgeSeconds: 365 * 24 * 60 * 60
|
|
2221
|
-
// 1 year
|
|
2222
|
-
}
|
|
2223
|
-
}
|
|
2224
|
-
},
|
|
2225
|
-
{
|
|
2226
|
-
urlPattern: /^https:\/\/fonts\.(?:googleapis)\.com\/.*/i,
|
|
2227
|
-
handler: "StaleWhileRevalidate",
|
|
2228
|
-
options: {
|
|
2229
|
-
cacheName: "google-fonts-stylesheets",
|
|
2230
|
-
expiration: {
|
|
2231
|
-
maxEntries: 4,
|
|
2232
|
-
maxAgeSeconds: 7 * 24 * 60 * 60
|
|
2233
|
-
// 1 week
|
|
2234
|
-
}
|
|
2235
|
-
}
|
|
2236
|
-
},
|
|
2237
|
-
{
|
|
2238
|
-
urlPattern: /\.(?:eot|otf|ttc|ttf|woff|woff2|font.css)$/i,
|
|
2239
|
-
handler: "StaleWhileRevalidate",
|
|
2240
|
-
options: {
|
|
2241
|
-
cacheName: "static-font-assets",
|
|
2242
|
-
expiration: {
|
|
2243
|
-
maxEntries: 4,
|
|
2244
|
-
maxAgeSeconds: 7 * 24 * 60 * 60
|
|
2245
|
-
// 1 week
|
|
2246
|
-
}
|
|
2247
|
-
}
|
|
2248
|
-
},
|
|
2249
|
-
{
|
|
2250
|
-
urlPattern: /\.(?:jpg|jpeg|gif|png|svg|ico|webp)$/i,
|
|
2251
|
-
handler: "StaleWhileRevalidate",
|
|
2252
|
-
options: {
|
|
2253
|
-
cacheName: "static-image-assets",
|
|
2254
|
-
expiration: {
|
|
2255
|
-
maxEntries: 64,
|
|
2256
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
2257
|
-
// 24 hours
|
|
2258
|
-
}
|
|
2259
|
-
}
|
|
2260
|
-
},
|
|
2261
|
-
{
|
|
2262
|
-
urlPattern: /\/_next\/image\?url=.+$/i,
|
|
2263
|
-
handler: "StaleWhileRevalidate",
|
|
2264
|
-
options: {
|
|
2265
|
-
cacheName: "next-image",
|
|
2266
|
-
expiration: {
|
|
2267
|
-
maxEntries: 64,
|
|
2268
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
2269
|
-
// 24 hours
|
|
2270
|
-
}
|
|
2271
|
-
}
|
|
2272
|
-
},
|
|
2273
|
-
{
|
|
2274
|
-
urlPattern: /\.(?:mp3|wav|ogg)$/i,
|
|
2275
|
-
handler: "CacheFirst",
|
|
2276
|
-
options: {
|
|
2277
|
-
rangeRequests: true,
|
|
2278
|
-
cacheName: "static-audio-assets",
|
|
2279
|
-
expiration: {
|
|
2280
|
-
maxEntries: 32,
|
|
2281
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
2282
|
-
// 24 hours
|
|
2283
|
-
}
|
|
2284
|
-
}
|
|
2285
|
-
},
|
|
2286
|
-
{
|
|
2287
|
-
urlPattern: /\.(?:mp4)$/i,
|
|
2288
|
-
handler: "CacheFirst",
|
|
2289
|
-
options: {
|
|
2290
|
-
rangeRequests: true,
|
|
2291
|
-
cacheName: "static-video-assets",
|
|
2292
|
-
expiration: {
|
|
2293
|
-
maxEntries: 32,
|
|
2294
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
2295
|
-
// 24 hours
|
|
2296
|
-
}
|
|
2297
|
-
}
|
|
2298
|
-
},
|
|
2299
|
-
{
|
|
2300
|
-
urlPattern: /\.(?:js)$/i,
|
|
2301
|
-
handler: "StaleWhileRevalidate",
|
|
2302
|
-
options: {
|
|
2303
|
-
cacheName: "static-js-assets",
|
|
2304
|
-
expiration: {
|
|
2305
|
-
maxEntries: 32,
|
|
2306
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
2307
|
-
// 24 hours
|
|
2308
|
-
}
|
|
2309
|
-
}
|
|
2310
|
-
},
|
|
2311
|
-
{
|
|
2312
|
-
urlPattern: /\.(?:css|less)$/i,
|
|
2313
|
-
handler: "StaleWhileRevalidate",
|
|
2314
|
-
options: {
|
|
2315
|
-
cacheName: "static-style-assets",
|
|
2316
|
-
expiration: {
|
|
2317
|
-
maxEntries: 32,
|
|
2318
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
2319
|
-
// 24 hours
|
|
2320
|
-
}
|
|
2321
|
-
}
|
|
2322
|
-
},
|
|
2323
|
-
{
|
|
2324
|
-
urlPattern: /\/_next\/data\/.+\/.+\.json$/i,
|
|
2325
|
-
handler: "StaleWhileRevalidate",
|
|
2326
|
-
options: {
|
|
2327
|
-
cacheName: "next-data",
|
|
2328
|
-
expiration: {
|
|
2329
|
-
maxEntries: 32,
|
|
2330
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
2331
|
-
// 24 hours
|
|
2332
|
-
}
|
|
2333
|
-
}
|
|
2334
|
-
},
|
|
2335
|
-
{
|
|
2336
|
-
urlPattern: /\.(?:json|xml|csv)$/i,
|
|
2337
|
-
handler: "NetworkFirst",
|
|
2338
|
-
options: {
|
|
2339
|
-
cacheName: "static-data-assets",
|
|
2340
|
-
expiration: {
|
|
2341
|
-
maxEntries: 32,
|
|
2342
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
2343
|
-
// 24 hours
|
|
2344
|
-
}
|
|
2345
|
-
}
|
|
2346
|
-
},
|
|
2347
|
-
{
|
|
2348
|
-
urlPattern: ({ url }) => {
|
|
2349
|
-
const isSameOrigin = self.origin === url.origin;
|
|
2350
|
-
if (!isSameOrigin) return false;
|
|
2351
|
-
const pathname = url.pathname;
|
|
2352
|
-
if (pathname.startsWith("/api/")) return false;
|
|
2353
|
-
return true;
|
|
2354
|
-
},
|
|
2355
|
-
handler: "NetworkFirst",
|
|
2356
|
-
options: {
|
|
2357
|
-
cacheName: "pages",
|
|
2358
|
-
expiration: {
|
|
2359
|
-
maxEntries: 32,
|
|
2360
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
2361
|
-
// 24 hours
|
|
2362
|
-
}
|
|
2363
|
-
}
|
|
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;
|
|
2364
2215
|
}
|
|
2365
|
-
];
|
|
2366
|
-
function createApiCacheRule(apiUrl, options = {}) {
|
|
2367
|
-
const {
|
|
2368
|
-
strategy = "NetworkFirst",
|
|
2369
|
-
maxAge = 300,
|
|
2370
|
-
maxEntries = 50,
|
|
2371
|
-
cacheName = "api-cache"
|
|
2372
|
-
} = options;
|
|
2373
|
-
return {
|
|
2374
|
-
urlPattern: new RegExp(`^${apiUrl.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}/.*`, "i"),
|
|
2375
|
-
handler: strategy,
|
|
2376
|
-
options: {
|
|
2377
|
-
cacheName,
|
|
2378
|
-
expiration: {
|
|
2379
|
-
maxEntries,
|
|
2380
|
-
maxAgeSeconds: maxAge
|
|
2381
|
-
},
|
|
2382
|
-
networkTimeoutSeconds: 10
|
|
2383
|
-
}
|
|
2384
|
-
};
|
|
2385
|
-
}
|
|
2386
|
-
function createStaticAssetRule(extensions, options = {}) {
|
|
2387
|
-
const {
|
|
2388
|
-
strategy = "CacheFirst",
|
|
2389
|
-
maxAge = 86400,
|
|
2390
|
-
maxEntries = 64,
|
|
2391
|
-
cacheName = "static-assets"
|
|
2392
|
-
} = options;
|
|
2393
|
-
const pattern = extensions.map((ext) => ext.replace(".", "")).join("|");
|
|
2394
|
-
return {
|
|
2395
|
-
urlPattern: new RegExp(`\\.(?:${pattern})$`, "i"),
|
|
2396
|
-
handler: strategy,
|
|
2397
|
-
options: {
|
|
2398
|
-
cacheName,
|
|
2399
|
-
expiration: {
|
|
2400
|
-
maxEntries,
|
|
2401
|
-
maxAgeSeconds: maxAge
|
|
2402
|
-
}
|
|
2403
|
-
}
|
|
2404
|
-
};
|
|
2405
|
-
}
|
|
2406
|
-
function createCdnCacheRule(cdnUrl, options = {}) {
|
|
2407
|
-
const {
|
|
2408
|
-
strategy = "CacheFirst",
|
|
2409
|
-
maxAge = 2592e3,
|
|
2410
|
-
// 30 days
|
|
2411
|
-
maxEntries = 100,
|
|
2412
|
-
cacheName = "cdn-cache"
|
|
2413
|
-
} = options;
|
|
2414
|
-
return {
|
|
2415
|
-
urlPattern: new RegExp(`^${cdnUrl.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}/.*`, "i"),
|
|
2416
|
-
handler: strategy,
|
|
2417
|
-
options: {
|
|
2418
|
-
cacheName,
|
|
2419
|
-
expiration: {
|
|
2420
|
-
maxEntries,
|
|
2421
|
-
maxAgeSeconds: maxAge
|
|
2422
|
-
},
|
|
2423
|
-
cacheableResponse: {
|
|
2424
|
-
statuses: [0, 200]
|
|
2425
|
-
}
|
|
2426
|
-
}
|
|
2427
|
-
};
|
|
2428
2216
|
}
|
|
2429
2217
|
|
|
2430
2218
|
// src/config/createNextConfig.ts
|
|
@@ -2494,6 +2282,9 @@ function createBaseNextConfig(options = {}) {
|
|
|
2494
2282
|
...DEFAULT_TRANSPILE_PACKAGES,
|
|
2495
2283
|
...options.transpilePackages || []
|
|
2496
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 || {},
|
|
2497
2288
|
// Experimental features
|
|
2498
2289
|
experimental: {
|
|
2499
2290
|
// Optimize package imports (only in production)
|
|
@@ -2511,9 +2302,6 @@ function createBaseNextConfig(options = {}) {
|
|
|
2511
2302
|
...options.experimental
|
|
2512
2303
|
},
|
|
2513
2304
|
// Webpack configuration
|
|
2514
|
-
// NOTE: Next.js 16 uses Turbopack by default in dev mode, which doesn't support webpack plugins.
|
|
2515
|
-
// DevStartupPlugin only runs in webpack mode (next dev --webpack).
|
|
2516
|
-
// For Turbopack compatibility, consider using a custom dev script for browser auto-open.
|
|
2517
2305
|
webpack: (config, webpackOptions) => {
|
|
2518
2306
|
const { isServer, dev } = webpackOptions;
|
|
2519
2307
|
if (dev && !isServer) {
|
|
@@ -2522,7 +2310,6 @@ function createBaseNextConfig(options = {}) {
|
|
|
2522
2310
|
}
|
|
2523
2311
|
config.plugins.push(
|
|
2524
2312
|
new DevStartupPlugin({
|
|
2525
|
-
openBrowser: options.openBrowser,
|
|
2526
2313
|
checkUpdates: options.checkUpdates,
|
|
2527
2314
|
autoUpdate: options.autoUpdate,
|
|
2528
2315
|
forceCheckWorkspace: options.forceCheckWorkspace,
|
|
@@ -2556,7 +2343,6 @@ function createBaseNextConfig(options = {}) {
|
|
|
2556
2343
|
let finalConfig = deepMerge(baseConfig, options);
|
|
2557
2344
|
delete finalConfig.optimizePackageImports;
|
|
2558
2345
|
delete finalConfig.isDefaultCfgAdmin;
|
|
2559
|
-
delete finalConfig.openBrowser;
|
|
2560
2346
|
delete finalConfig.checkUpdates;
|
|
2561
2347
|
delete finalConfig.autoUpdate;
|
|
2562
2348
|
delete finalConfig.forceCheckWorkspace;
|
|
@@ -2571,98 +2357,6 @@ function createBaseNextConfig(options = {}) {
|
|
|
2571
2357
|
return finalConfig;
|
|
2572
2358
|
}
|
|
2573
2359
|
|
|
2574
|
-
// src/config/utils/manifest.ts
|
|
2575
|
-
function createManifestMetadata(config) {
|
|
2576
|
-
return {
|
|
2577
|
-
manifest: "/manifest.json",
|
|
2578
|
-
themeColor: config.themeColor || "#000000",
|
|
2579
|
-
appleWebApp: {
|
|
2580
|
-
capable: true,
|
|
2581
|
-
statusBarStyle: "default",
|
|
2582
|
-
title: config.shortName || config.name
|
|
2583
|
-
},
|
|
2584
|
-
applicationName: config.name,
|
|
2585
|
-
formatDetection: {
|
|
2586
|
-
telephone: false
|
|
2587
|
-
},
|
|
2588
|
-
viewport: {
|
|
2589
|
-
width: "device-width",
|
|
2590
|
-
initialScale: 1,
|
|
2591
|
-
maximumScale: 1
|
|
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,29 +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
2497
|
decodeBase64,
|
|
2809
2498
|
deepMerge,
|
|
2810
|
-
defaultRuntimeCaching,
|
|
2811
2499
|
defineRoute,
|
|
2812
2500
|
detectPackageManager,
|
|
2813
2501
|
encodeBase64,
|
|
2814
2502
|
fetchLatestVersion,
|
|
2815
2503
|
findRoute,
|
|
2816
2504
|
findRouteByPattern,
|
|
2817
|
-
generateManifest,
|
|
2818
2505
|
generateOgImageMetadata,
|
|
2819
2506
|
generateOgImageUrl,
|
|
2820
2507
|
generateSitemapXml,
|
|
@@ -2839,7 +2526,6 @@ export {
|
|
|
2839
2526
|
isCI,
|
|
2840
2527
|
isCompressionAvailable,
|
|
2841
2528
|
isDev,
|
|
2842
|
-
isPWAAvailable,
|
|
2843
2529
|
isPackageInstalled,
|
|
2844
2530
|
isProduction,
|
|
2845
2531
|
isStaticBuild,
|
|
@@ -2855,7 +2541,6 @@ export {
|
|
|
2855
2541
|
resetUpdaterPreferences,
|
|
2856
2542
|
routesToMenuItems,
|
|
2857
2543
|
search,
|
|
2858
|
-
updatePackagesWithProgress
|
|
2859
|
-
withPWA
|
|
2544
|
+
updatePackagesWithProgress
|
|
2860
2545
|
};
|
|
2861
2546
|
//# sourceMappingURL=index.mjs.map
|