@djangocfg/nextjs 2.1.516 → 2.1.518
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/index.d.mts +1 -1
- package/dist/config/index.mjs +37 -68
- package/dist/config/index.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +37 -68
- package/dist/index.mjs.map +1 -1
- package/dist/plugin-yhoLWYh6.d.mts +79 -0
- package/dist/pwa/index.d.mts +1 -1
- package/dist/pwa/index.mjs +31 -82
- package/dist/pwa/index.mjs.map +1 -1
- package/dist/pwa/worker/index.d.mts +17 -24
- package/dist/pwa/worker/index.mjs +25 -28
- package/dist/pwa/worker/index.mjs.map +1 -1
- package/package.json +10 -13
- package/src/config/plugins/index.ts +1 -1
- package/src/pwa/plugin.ts +69 -155
- package/src/pwa/worker/index.ts +48 -62
- package/dist/plugin-DdmK3zAE.d.mts +0 -100
package/dist/index.d.mts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -289,39 +289,8 @@ function withI18n(config, options) {
|
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
// src/pwa/plugin.ts
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
var requirePeer = createRequire(import.meta.url);
|
|
295
|
-
function withPWA(nextConfig, options = {}) {
|
|
296
|
-
const isDev2 = process.env.NODE_ENV === "development";
|
|
297
|
-
const isStaticBuild2 = process.env.NEXT_PUBLIC_STATIC_BUILD === "true";
|
|
298
|
-
const shouldDisable = options.disable !== void 0 ? options.disable : isDev2 || isStaticBuild2;
|
|
299
|
-
const defaultOptions = {
|
|
300
|
-
swSrc: "app/sw.ts",
|
|
301
|
-
swDest: "public/sw.js",
|
|
302
|
-
disable: shouldDisable,
|
|
303
|
-
cacheOnNavigation: true,
|
|
304
|
-
reloadOnOnline: true,
|
|
305
|
-
...options
|
|
306
|
-
};
|
|
307
|
-
try {
|
|
308
|
-
if (!process.env.SERWIST_SUPPRESS_TURBOPACK_WARNING) {
|
|
309
|
-
process.env.SERWIST_SUPPRESS_TURBOPACK_WARNING = "1";
|
|
310
|
-
}
|
|
311
|
-
const withSerwistInit = requirePeer("@serwist/next").default;
|
|
312
|
-
const withSerwist = withSerwistInit({
|
|
313
|
-
swSrc: defaultOptions.swSrc,
|
|
314
|
-
swDest: defaultOptions.swDest,
|
|
315
|
-
disable: defaultOptions.disable,
|
|
316
|
-
cacheOnNavigation: defaultOptions.cacheOnNavigation,
|
|
317
|
-
reloadOnOnline: defaultOptions.reloadOnOnline,
|
|
318
|
-
...defaultOptions.serwistOptions
|
|
319
|
-
});
|
|
320
|
-
return withSerwist(nextConfig);
|
|
321
|
-
} catch (error) {
|
|
322
|
-
consola.error("Failed to configure Serwist:", error);
|
|
323
|
-
return nextConfig;
|
|
324
|
-
}
|
|
292
|
+
function withPWA(nextConfig, _options = {}) {
|
|
293
|
+
return nextConfig;
|
|
325
294
|
}
|
|
326
295
|
|
|
327
296
|
// src/config/constants.ts
|
|
@@ -468,14 +437,14 @@ function resolveCspVendors(vendors, warnUnknown = true) {
|
|
|
468
437
|
}
|
|
469
438
|
|
|
470
439
|
// src/config/plugins/compression.ts
|
|
471
|
-
import { createRequire as
|
|
440
|
+
import { createRequire as createRequire2 } from "module";
|
|
472
441
|
|
|
473
442
|
// src/config/packages/checker.ts
|
|
474
|
-
import { createRequire
|
|
443
|
+
import { createRequire } from "module";
|
|
475
444
|
import { join } from "path";
|
|
476
445
|
|
|
477
446
|
// src/config/utils/env.ts
|
|
478
|
-
import
|
|
447
|
+
import consola from "consola";
|
|
479
448
|
var isStaticBuild = process.env.NEXT_PUBLIC_STATIC_BUILD === "true";
|
|
480
449
|
var isDev = process.env.NODE_ENV === "development";
|
|
481
450
|
var isProduction = !isDev;
|
|
@@ -492,7 +461,7 @@ function hasApiUrl() {
|
|
|
492
461
|
}
|
|
493
462
|
function warnIfApiUrlMissing() {
|
|
494
463
|
if (hasApiUrl() || isDev) return;
|
|
495
|
-
|
|
464
|
+
consola.warn(
|
|
496
465
|
"NEXT_PUBLIC_API_URL is not set \u2014 API-backed features are disabled in this build.\nRequests that need it are skipped rather than sent to a relative path.\nIf this app DOES have a backend, the value must be present at BUILD time:\n \u2022 commit it to the app's `.env.production`, and check no `.dockerignore`\n rule (e.g. `**/.env*`) strips that file from the build context;\n \u2022 or pass it as a Dockerfile ARG/ENV before the build step.\nA compose `environment:` entry is too late \u2014 it only exists at runtime."
|
|
497
466
|
);
|
|
498
467
|
}
|
|
@@ -539,7 +508,7 @@ function getPackagesForContext(options) {
|
|
|
539
508
|
// src/config/packages/checker.ts
|
|
540
509
|
function isPackageInstalled(packageName) {
|
|
541
510
|
try {
|
|
542
|
-
const consumerRequire =
|
|
511
|
+
const consumerRequire = createRequire(join(process.cwd(), "package.json"));
|
|
543
512
|
consumerRequire.resolve(packageName);
|
|
544
513
|
return true;
|
|
545
514
|
} catch {
|
|
@@ -594,7 +563,7 @@ function getReasonText(pkg) {
|
|
|
594
563
|
}
|
|
595
564
|
|
|
596
565
|
// src/config/plugins/compression.ts
|
|
597
|
-
var
|
|
566
|
+
var requirePeer = createRequire2(import.meta.url);
|
|
598
567
|
var DEFAULT_OPTIONS = {
|
|
599
568
|
gzip: true,
|
|
600
569
|
brotli: true,
|
|
@@ -608,7 +577,7 @@ function addCompressionPlugins(config, options = {}) {
|
|
|
608
577
|
}
|
|
609
578
|
const opts = { ...DEFAULT_OPTIONS, ...options };
|
|
610
579
|
try {
|
|
611
|
-
const CompressionPlugin =
|
|
580
|
+
const CompressionPlugin = requirePeer("compression-webpack-plugin");
|
|
612
581
|
if (!config.plugins) {
|
|
613
582
|
config.plugins = [];
|
|
614
583
|
}
|
|
@@ -677,7 +646,7 @@ Example queries:
|
|
|
677
646
|
import chalk from "chalk";
|
|
678
647
|
import { execSync, spawn } from "child_process";
|
|
679
648
|
import Conf from "conf";
|
|
680
|
-
import
|
|
649
|
+
import consola2 from "consola";
|
|
681
650
|
import { existsSync } from "fs";
|
|
682
651
|
import { join as join2 } from "path";
|
|
683
652
|
import { createInterface } from "readline";
|
|
@@ -896,13 +865,13 @@ async function installPackagesWithProgress(packages) {
|
|
|
896
865
|
}
|
|
897
866
|
console.log("");
|
|
898
867
|
if (failedPackages.length === 0) {
|
|
899
|
-
|
|
868
|
+
consola2.success(`All ${total} packages installed successfully!`);
|
|
900
869
|
return true;
|
|
901
870
|
} else if (successCount > 0) {
|
|
902
|
-
|
|
871
|
+
consola2.warn(`${successCount}/${total} packages installed. Failed: ${failedPackages.join(", ")}`);
|
|
903
872
|
return false;
|
|
904
873
|
} else {
|
|
905
|
-
|
|
874
|
+
consola2.error(`Failed to install packages: ${failedPackages.join(", ")}`);
|
|
906
875
|
return false;
|
|
907
876
|
}
|
|
908
877
|
}
|
|
@@ -913,7 +882,7 @@ async function installPackages(packages) {
|
|
|
913
882
|
if (packages.length === 0) return true;
|
|
914
883
|
const pm = detectPackageManager();
|
|
915
884
|
const command = buildInstallCommand(packages, pm);
|
|
916
|
-
|
|
885
|
+
consola2.info(`Installing: ${chalk.cyan(packages.map((p) => p.name).join(", "))}`);
|
|
917
886
|
const spinner = createSpinner("Installing packages...");
|
|
918
887
|
spinner.start();
|
|
919
888
|
return new Promise((resolve) => {
|
|
@@ -953,7 +922,7 @@ async function checkAndInstallPackages(options = {}) {
|
|
|
953
922
|
return installPackages(toInstall);
|
|
954
923
|
}
|
|
955
924
|
console.log("");
|
|
956
|
-
|
|
925
|
+
consola2.box("\u{1F4E6} Missing Optional Packages");
|
|
957
926
|
console.log("");
|
|
958
927
|
for (const pkg of toInstall) {
|
|
959
928
|
console.log(` ${chalk.yellow("\u2022")} ${chalk.bold(pkg.name)}`);
|
|
@@ -977,7 +946,7 @@ async function checkAndInstallPackages(options = {}) {
|
|
|
977
946
|
);
|
|
978
947
|
if (enableAuto) {
|
|
979
948
|
installerCache.set("autoInstall", true);
|
|
980
|
-
|
|
949
|
+
consola2.info("Auto-install enabled. Run with --no-auto-install to disable.");
|
|
981
950
|
}
|
|
982
951
|
}
|
|
983
952
|
return success;
|
|
@@ -988,7 +957,7 @@ async function checkAndInstallPackages(options = {}) {
|
|
|
988
957
|
if (skipPermanently) {
|
|
989
958
|
const currentSkip = installerCache.get("skipPackages") || [];
|
|
990
959
|
installerCache.set("skipPackages", [...currentSkip, ...toInstall.map((p) => p.name)]);
|
|
991
|
-
|
|
960
|
+
consola2.info("Packages added to skip list.");
|
|
992
961
|
}
|
|
993
962
|
return false;
|
|
994
963
|
}
|
|
@@ -996,21 +965,21 @@ function printMissingPackagesInfo(packages) {
|
|
|
996
965
|
if (packages.length === 0) return;
|
|
997
966
|
const pm = detectPackageManager();
|
|
998
967
|
const command = buildInstallCommand(packages, pm);
|
|
999
|
-
|
|
1000
|
-
|
|
968
|
+
consola2.warn(`Missing optional packages: ${packages.map((p) => p.name).join(", ")}`);
|
|
969
|
+
consola2.info(`Install with: ${chalk.cyan(command)}`);
|
|
1001
970
|
}
|
|
1002
971
|
function resetInstallerPreferences() {
|
|
1003
972
|
installerCache.clear();
|
|
1004
|
-
|
|
973
|
+
consola2.success("Installer preferences reset");
|
|
1005
974
|
}
|
|
1006
975
|
|
|
1007
976
|
// src/config/packages/updater.ts
|
|
1008
977
|
import chalk2 from "chalk";
|
|
1009
978
|
import { spawn as spawn2 } from "child_process";
|
|
1010
979
|
import Conf2 from "conf";
|
|
1011
|
-
import
|
|
980
|
+
import consola3 from "consola";
|
|
1012
981
|
import { existsSync as existsSync2, readFileSync } from "fs";
|
|
1013
|
-
import { createRequire as
|
|
982
|
+
import { createRequire as createRequire3 } from "module";
|
|
1014
983
|
import { join as join3 } from "path";
|
|
1015
984
|
import { createInterface as createInterface2 } from "readline";
|
|
1016
985
|
import semver from "semver";
|
|
@@ -1063,13 +1032,13 @@ function getInstalledVersion(packageName) {
|
|
|
1063
1032
|
} catch {
|
|
1064
1033
|
}
|
|
1065
1034
|
try {
|
|
1066
|
-
const consumerRequire =
|
|
1035
|
+
const consumerRequire = createRequire3(join3(cwd, "package.json"));
|
|
1067
1036
|
const pkgPath = consumerRequire.resolve(`${packageName}/package.json`);
|
|
1068
1037
|
return JSON.parse(readFileSync(pkgPath, "utf-8")).version || null;
|
|
1069
1038
|
} catch {
|
|
1070
1039
|
}
|
|
1071
1040
|
try {
|
|
1072
|
-
const localRequire =
|
|
1041
|
+
const localRequire = createRequire3(import.meta.url);
|
|
1073
1042
|
const pkgPath = localRequire.resolve(`${packageName}/package.json`);
|
|
1074
1043
|
return JSON.parse(readFileSync(pkgPath, "utf-8")).version || null;
|
|
1075
1044
|
} catch {
|
|
@@ -1266,13 +1235,13 @@ async function updatePackagesWithProgress(packages) {
|
|
|
1266
1235
|
}
|
|
1267
1236
|
console.log("");
|
|
1268
1237
|
if (failedPackages.length === 0) {
|
|
1269
|
-
|
|
1238
|
+
consola3.success(`All ${total} packages updated successfully!`);
|
|
1270
1239
|
return true;
|
|
1271
1240
|
} else if (successCount > 0) {
|
|
1272
|
-
|
|
1241
|
+
consola3.warn(`${successCount}/${total} packages updated. Failed: ${failedPackages.join(", ")}`);
|
|
1273
1242
|
return false;
|
|
1274
1243
|
} else {
|
|
1275
|
-
|
|
1244
|
+
consola3.error(`Failed to update packages: ${failedPackages.join(", ")}`);
|
|
1276
1245
|
return false;
|
|
1277
1246
|
}
|
|
1278
1247
|
}
|
|
@@ -1297,7 +1266,7 @@ async function checkAndUpdatePackages(options = {}) {
|
|
|
1297
1266
|
return updatePackagesWithProgress(outdated);
|
|
1298
1267
|
}
|
|
1299
1268
|
console.log("");
|
|
1300
|
-
|
|
1269
|
+
consola3.box("\u{1F4E6} Updates Available");
|
|
1301
1270
|
console.log("");
|
|
1302
1271
|
for (const pkg of outdated) {
|
|
1303
1272
|
console.log(
|
|
@@ -1316,7 +1285,7 @@ async function checkAndUpdatePackages(options = {}) {
|
|
|
1316
1285
|
);
|
|
1317
1286
|
if (enableAuto) {
|
|
1318
1287
|
updaterCache.set("autoUpdate", true);
|
|
1319
|
-
|
|
1288
|
+
consola3.info("Auto-update enabled.");
|
|
1320
1289
|
}
|
|
1321
1290
|
}
|
|
1322
1291
|
return success;
|
|
@@ -1332,21 +1301,21 @@ async function checkAndUpdatePackages(options = {}) {
|
|
|
1332
1301
|
}
|
|
1333
1302
|
}
|
|
1334
1303
|
updaterCache.set("skippedVersions", skipped);
|
|
1335
|
-
|
|
1304
|
+
consola3.info("Versions skipped. Will prompt again for newer versions.");
|
|
1336
1305
|
}
|
|
1337
1306
|
return false;
|
|
1338
1307
|
}
|
|
1339
1308
|
function resetUpdaterPreferences() {
|
|
1340
1309
|
updaterCache.clear();
|
|
1341
|
-
|
|
1310
|
+
consola3.success("Updater preferences reset");
|
|
1342
1311
|
}
|
|
1343
1312
|
|
|
1344
1313
|
// src/config/utils/version.ts
|
|
1345
1314
|
import chalk3 from "chalk";
|
|
1346
1315
|
import Conf3 from "conf";
|
|
1347
|
-
import
|
|
1316
|
+
import consola4 from "consola";
|
|
1348
1317
|
import { readFileSync as readFileSync2 } from "fs";
|
|
1349
|
-
import { createRequire as
|
|
1318
|
+
import { createRequire as createRequire4 } from "module";
|
|
1350
1319
|
import semver2 from "semver";
|
|
1351
1320
|
function createMemoryCache3() {
|
|
1352
1321
|
const store = /* @__PURE__ */ new Map();
|
|
@@ -1375,7 +1344,7 @@ function createVersionCache() {
|
|
|
1375
1344
|
var versionCache = createVersionCache();
|
|
1376
1345
|
function getCurrentVersion() {
|
|
1377
1346
|
try {
|
|
1378
|
-
const localRequire =
|
|
1347
|
+
const localRequire = createRequire4(import.meta.url);
|
|
1379
1348
|
const pkgPath = localRequire.resolve("../../../package.json");
|
|
1380
1349
|
return JSON.parse(readFileSync2(pkgPath, "utf-8")).version || null;
|
|
1381
1350
|
} catch {
|
|
@@ -1439,10 +1408,10 @@ function getUpdateCommand() {
|
|
|
1439
1408
|
async function printVersionInfo() {
|
|
1440
1409
|
const { hasUpdate, currentVersion, latestVersion } = await checkForUpdate();
|
|
1441
1410
|
if (!currentVersion) return;
|
|
1442
|
-
|
|
1411
|
+
consola4.box(`\u{1F4E6} @djangocfg/nextjs v${currentVersion}`);
|
|
1443
1412
|
if (hasUpdate && latestVersion) {
|
|
1444
|
-
|
|
1445
|
-
|
|
1413
|
+
consola4.warn(`Update Available! ${chalk3.red(currentVersion)} \u2192 ${chalk3.green(latestVersion)}`);
|
|
1414
|
+
consola4.info(`Run: ${chalk3.cyan(getUpdateCommand())}`);
|
|
1446
1415
|
console.log("");
|
|
1447
1416
|
}
|
|
1448
1417
|
}
|