@djangocfg/nextjs 2.1.514 → 2.1.515

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.
@@ -1,209 +1,9 @@
1
- var __getOwnPropNames = Object.getOwnPropertyNames;
2
1
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
3
2
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
4
3
  }) : x)(function(x) {
5
4
  if (typeof require !== "undefined") return require.apply(this, arguments);
6
5
  throw Error('Dynamic require of "' + x + '" is not supported');
7
6
  });
8
- var __commonJS = (cb, mod) => function __require2() {
9
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
- };
11
-
12
- // package.json
13
- var require_package = __commonJS({
14
- "package.json"(exports, module) {
15
- module.exports = {
16
- name: "@djangocfg/nextjs",
17
- version: "2.1.514",
18
- description: "Next.js server utilities: sitemap, health, OG images, contact forms, navigation, config",
19
- keywords: [
20
- "nextjs",
21
- "sitemap",
22
- "health",
23
- "og-image",
24
- "navigation",
25
- "config",
26
- "react",
27
- "typescript"
28
- ],
29
- author: {
30
- name: "DjangoCFG",
31
- url: "https://djangocfg.com"
32
- },
33
- homepage: "https://djangocfg.com",
34
- repository: {
35
- type: "git",
36
- url: "https://github.com/markolofsen/django-cfg.git",
37
- directory: "packages/nextjs"
38
- },
39
- bugs: {
40
- url: "https://github.com/markolofsen/django-cfg/issues"
41
- },
42
- license: "MIT",
43
- main: "./dist/index.mjs",
44
- types: "./dist/index.d.mts",
45
- exports: {
46
- ".": {
47
- types: "./dist/index.d.mts",
48
- import: "./dist/index.mjs",
49
- default: "./dist/index.mjs"
50
- },
51
- "./sitemap": {
52
- types: "./dist/sitemap/index.d.mts",
53
- import: "./dist/sitemap/index.mjs",
54
- default: "./dist/sitemap/index.mjs"
55
- },
56
- "./health": {
57
- types: "./dist/health/index.d.mts",
58
- import: "./dist/health/index.mjs",
59
- default: "./dist/health/index.mjs"
60
- },
61
- "./navigation": {
62
- types: "./dist/navigation/index.d.mts",
63
- import: "./dist/navigation/index.mjs",
64
- default: "./dist/navigation/index.mjs"
65
- },
66
- "./config": {
67
- types: "./dist/config/index.d.mts",
68
- import: "./dist/config/index.mjs",
69
- default: "./dist/config/index.mjs"
70
- },
71
- "./ai": {
72
- types: "./dist/ai/index.d.mts",
73
- import: "./dist/ai/index.mjs",
74
- default: "./dist/ai/index.mjs"
75
- },
76
- "./pwa": {
77
- types: "./dist/pwa/index.d.mts",
78
- import: "./dist/pwa/index.mjs",
79
- default: "./dist/pwa/index.mjs"
80
- },
81
- "./pwa/worker": {
82
- types: "./dist/pwa/worker/index.d.mts",
83
- import: "./dist/pwa/worker/index.mjs",
84
- default: "./dist/pwa/worker/index.mjs"
85
- },
86
- "./worker": {
87
- types: "./dist/pwa/worker/index.d.mts",
88
- import: "./dist/pwa/worker/index.mjs",
89
- default: "./dist/pwa/worker/index.mjs"
90
- },
91
- "./og-image": {
92
- types: "./dist/og-image/index.d.mts",
93
- import: "./dist/og-image/index.mjs",
94
- default: "./dist/og-image/index.mjs"
95
- },
96
- "./monitor": {
97
- types: "./dist/monitor/index.d.mts",
98
- import: "./dist/monitor/index.mjs",
99
- default: "./dist/monitor/index.mjs"
100
- },
101
- "./i18n": {
102
- types: "./dist/i18n/index.d.mts",
103
- import: "./dist/i18n/index.mjs",
104
- default: "./dist/i18n/index.mjs"
105
- },
106
- "./i18n/server": {
107
- types: "./dist/i18n/server.d.mts",
108
- import: "./dist/i18n/server.mjs",
109
- default: "./dist/i18n/server.mjs"
110
- },
111
- "./i18n/client": {
112
- types: "./dist/i18n/client.d.mts",
113
- import: "./dist/i18n/client.mjs",
114
- default: "./dist/i18n/client.mjs"
115
- },
116
- "./i18n/proxy": {
117
- types: "./dist/i18n/proxy.d.mts",
118
- import: "./dist/i18n/proxy.mjs",
119
- default: "./dist/i18n/proxy.mjs"
120
- },
121
- "./i18n/navigation": {
122
- types: "./dist/i18n/navigation.d.mts",
123
- import: "./dist/i18n/navigation.mjs",
124
- default: "./dist/i18n/navigation.mjs"
125
- },
126
- "./i18n/routing": {
127
- types: "./dist/i18n/routing.d.mts",
128
- import: "./dist/i18n/routing.mjs",
129
- default: "./dist/i18n/routing.mjs"
130
- },
131
- "./i18n/request": {
132
- types: "./dist/i18n/request.d.mts",
133
- import: "./dist/i18n/request.mjs",
134
- default: "./dist/i18n/request.mjs"
135
- },
136
- "./i18n/components": {
137
- types: "./dist/i18n/components.d.mts",
138
- import: "./dist/i18n/components.mjs",
139
- default: "./dist/i18n/components.mjs"
140
- }
141
- },
142
- files: [
143
- "dist",
144
- "src",
145
- "README.md",
146
- "LICENSE"
147
- ],
148
- bin: {
149
- "djangocfg-docs": "./dist/ai/cli.mjs"
150
- },
151
- scripts: {
152
- build: "tsup",
153
- dev: "tsup --watch",
154
- clean: "rm -rf dist",
155
- lint: "eslint .",
156
- check: "tsc --noEmit",
157
- test: "tsx --test src/**/*.test.ts",
158
- "ai-docs": "tsx src/ai/cli.ts"
159
- },
160
- peerDependencies: {
161
- "@djangocfg/devtools": "workspace:*",
162
- "@djangocfg/i18n": "workspace:*",
163
- "@djangocfg/ui-core": "workspace:*",
164
- next: "^16.2.2"
165
- },
166
- peerDependenciesMeta: {
167
- "@djangocfg/ui-core": {
168
- optional: true
169
- },
170
- "@djangocfg/devtools": {
171
- optional: true
172
- }
173
- },
174
- dependencies: {
175
- "@serwist/next": "^9.5.11",
176
- "@serwist/sw": "^9.5.11",
177
- chalk: "^5.6.2",
178
- conf: "^15.1.0",
179
- consola: "^3.4.2",
180
- "next-intl": "^4.13.2",
181
- semver: "^7.8.5",
182
- serwist: "^9.5.11"
183
- },
184
- devDependencies: {
185
- "@djangocfg/devtools": "workspace:*",
186
- "@djangocfg/i18n": "workspace:*",
187
- "@djangocfg/layouts": "workspace:*",
188
- "@djangocfg/typescript-config": "workspace:*",
189
- "@djangocfg/ui-core": "workspace:*",
190
- "@types/node": "^25.9.5",
191
- "@types/react": "19.2.15",
192
- "@types/react-dom": "19.2.3",
193
- "@types/semver": "^7.7.1",
194
- "@types/webpack": "^5.28.5",
195
- eslint: "^9.39.5",
196
- "lucide-react": "^0.545.0",
197
- tsup: "^8.5.1",
198
- tsx: "^4.23.0",
199
- typescript: "^5.9.3"
200
- },
201
- publishConfig: {
202
- access: "public"
203
- }
204
- };
205
- }
206
- });
207
7
 
208
8
  // src/i18n/plugin.ts
209
9
  import createNextIntlPlugin from "next-intl/plugin";
@@ -219,6 +19,8 @@ function withI18n(config, options) {
219
19
 
220
20
  // src/pwa/plugin.ts
221
21
  import { consola } from "consola";
22
+ import { createRequire } from "module";
23
+ var requirePeer = createRequire(import.meta.url);
222
24
  function withPWA(nextConfig, options = {}) {
223
25
  const isDev2 = process.env.NODE_ENV === "development";
224
26
  const isStaticBuild2 = process.env.NEXT_PUBLIC_STATIC_BUILD === "true";
@@ -235,7 +37,7 @@ function withPWA(nextConfig, options = {}) {
235
37
  if (!process.env.SERWIST_SUPPRESS_TURBOPACK_WARNING) {
236
38
  process.env.SERWIST_SUPPRESS_TURBOPACK_WARNING = "1";
237
39
  }
238
- const withSerwistInit = __require("@serwist/next").default;
40
+ const withSerwistInit = requirePeer("@serwist/next").default;
239
41
  const withSerwist = withSerwistInit({
240
42
  swSrc: defaultOptions.swSrc,
241
43
  swDest: defaultOptions.swDest,
@@ -394,8 +196,11 @@ function resolveCspVendors(vendors, warnUnknown = true) {
394
196
  return merged;
395
197
  }
396
198
 
199
+ // src/config/plugins/compression.ts
200
+ import { createRequire as createRequire3 } from "module";
201
+
397
202
  // src/config/packages/checker.ts
398
- import { createRequire } from "module";
203
+ import { createRequire as createRequire2 } from "module";
399
204
  import { join } from "path";
400
205
 
401
206
  // src/config/utils/env.ts
@@ -463,7 +268,7 @@ function getPackagesForContext(options) {
463
268
  // src/config/packages/checker.ts
464
269
  function isPackageInstalled(packageName) {
465
270
  try {
466
- const consumerRequire = createRequire(join(process.cwd(), "package.json"));
271
+ const consumerRequire = createRequire2(join(process.cwd(), "package.json"));
467
272
  consumerRequire.resolve(packageName);
468
273
  return true;
469
274
  } catch {
@@ -518,6 +323,7 @@ function getReasonText(pkg) {
518
323
  }
519
324
 
520
325
  // src/config/plugins/compression.ts
326
+ var requirePeer2 = createRequire3(import.meta.url);
521
327
  var DEFAULT_OPTIONS = {
522
328
  gzip: true,
523
329
  brotli: true,
@@ -531,7 +337,7 @@ function addCompressionPlugins(config, options = {}) {
531
337
  }
532
338
  const opts = { ...DEFAULT_OPTIONS, ...options };
533
339
  try {
534
- const CompressionPlugin = __require("compression-webpack-plugin");
340
+ const CompressionPlugin = requirePeer2("compression-webpack-plugin");
535
341
  if (!config.plugins) {
536
342
  config.plugins = [];
537
343
  }
@@ -571,6 +377,8 @@ function isCompressionAvailable() {
571
377
 
572
378
  // src/config/plugins/devStartup.ts
573
379
  import chalk4 from "chalk";
380
+ import { existsSync as existsSync3 } from "fs";
381
+ import { join as join4 } from "path";
574
382
 
575
383
  // src/ai/constants.ts
576
384
  var MCP_BASE_URL = "https://mcp.djangocfg.com";
@@ -596,6 +404,8 @@ import chalk from "chalk";
596
404
  import { execSync, spawn } from "child_process";
597
405
  import Conf from "conf";
598
406
  import consola3 from "consola";
407
+ import { existsSync } from "fs";
408
+ import { join as join2 } from "path";
599
409
  import { createInterface } from "readline";
600
410
  function createMemoryCache() {
601
411
  const store = /* @__PURE__ */ new Map();
@@ -626,12 +436,10 @@ var PROMPT_COOLDOWN_MS = 60 * 60 * 1e3;
626
436
  var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
627
437
  function detectPackageManager() {
628
438
  try {
629
- const fs = __require("fs");
630
- const path = __require("path");
631
439
  const cwd = process.cwd();
632
- if (fs.existsSync(path.join(cwd, "pnpm-lock.yaml"))) return "pnpm";
633
- if (fs.existsSync(path.join(cwd, "yarn.lock"))) return "yarn";
634
- if (fs.existsSync(path.join(cwd, "package-lock.json"))) return "npm";
440
+ if (existsSync(join2(cwd, "pnpm-lock.yaml"))) return "pnpm";
441
+ if (existsSync(join2(cwd, "yarn.lock"))) return "yarn";
442
+ if (existsSync(join2(cwd, "package-lock.json"))) return "npm";
635
443
  try {
636
444
  execSync("pnpm --version", { stdio: "ignore" });
637
445
  return "pnpm";
@@ -927,8 +735,9 @@ import chalk2 from "chalk";
927
735
  import { spawn as spawn2 } from "child_process";
928
736
  import Conf2 from "conf";
929
737
  import consola4 from "consola";
930
- import { createRequire as createRequire2 } from "module";
931
- import { join as join2 } from "path";
738
+ import { existsSync as existsSync2, readFileSync } from "fs";
739
+ import { createRequire as createRequire4 } from "module";
740
+ import { join as join3 } from "path";
932
741
  import { createInterface as createInterface2 } from "readline";
933
742
  import semver from "semver";
934
743
  function createMemoryCache2() {
@@ -960,9 +769,8 @@ var UPDATE_CHECK_COOLDOWN_MS = 60 * 60 * 1e3;
960
769
  var SPINNER_FRAMES2 = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
961
770
  function isWorkspacePackage(packageName) {
962
771
  try {
963
- const fs = __require("fs");
964
- const pkgJsonPath = join2(process.cwd(), "package.json");
965
- const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
772
+ const pkgJsonPath = join3(process.cwd(), "package.json");
773
+ const pkgJson = JSON.parse(readFileSync(pkgJsonPath, "utf-8"));
966
774
  const deps = { ...pkgJson.dependencies, ...pkgJson.devDependencies };
967
775
  const version = deps[packageName];
968
776
  return version?.startsWith("workspace:") || false;
@@ -971,27 +779,25 @@ function isWorkspacePackage(packageName) {
971
779
  }
972
780
  }
973
781
  function getInstalledVersion(packageName) {
974
- const fs = __require("fs");
975
782
  const cwd = process.cwd();
976
783
  try {
977
- const directPath = join2(cwd, "node_modules", packageName, "package.json");
978
- if (fs.existsSync(directPath)) {
979
- const pkg = JSON.parse(fs.readFileSync(directPath, "utf-8"));
784
+ const directPath = join3(cwd, "node_modules", packageName, "package.json");
785
+ if (existsSync2(directPath)) {
786
+ const pkg = JSON.parse(readFileSync(directPath, "utf-8"));
980
787
  return pkg.version || null;
981
788
  }
982
789
  } catch {
983
790
  }
984
791
  try {
985
- const consumerRequire = createRequire2(join2(cwd, "package.json"));
792
+ const consumerRequire = createRequire4(join3(cwd, "package.json"));
986
793
  const pkgPath = consumerRequire.resolve(`${packageName}/package.json`);
987
- const pkg = __require(pkgPath);
988
- return pkg.version || null;
794
+ return JSON.parse(readFileSync(pkgPath, "utf-8")).version || null;
989
795
  } catch {
990
796
  }
991
797
  try {
992
- const pkgPath = __require.resolve(`${packageName}/package.json`);
993
- const pkg = __require(pkgPath);
994
- return pkg.version || null;
798
+ const localRequire = createRequire4(import.meta.url);
799
+ const pkgPath = localRequire.resolve(`${packageName}/package.json`);
800
+ return JSON.parse(readFileSync(pkgPath, "utf-8")).version || null;
995
801
  } catch {
996
802
  return null;
997
803
  }
@@ -1265,6 +1071,8 @@ function resetUpdaterPreferences() {
1265
1071
  import chalk3 from "chalk";
1266
1072
  import Conf3 from "conf";
1267
1073
  import consola5 from "consola";
1074
+ import { readFileSync as readFileSync2 } from "fs";
1075
+ import { createRequire as createRequire5 } from "module";
1268
1076
  import semver2 from "semver";
1269
1077
  function createMemoryCache3() {
1270
1078
  const store = /* @__PURE__ */ new Map();
@@ -1293,8 +1101,9 @@ function createVersionCache() {
1293
1101
  var versionCache = createVersionCache();
1294
1102
  function getCurrentVersion() {
1295
1103
  try {
1296
- const packageJson = require_package();
1297
- return packageJson.version || null;
1104
+ const localRequire = createRequire5(import.meta.url);
1105
+ const pkgPath = localRequire.resolve("../../../package.json");
1106
+ return JSON.parse(readFileSync2(pkgPath, "utf-8")).version || null;
1298
1107
  } catch {
1299
1108
  return null;
1300
1109
  }
@@ -1407,13 +1216,11 @@ var DevStartupPlugin = class {
1407
1216
  }
1408
1217
  }
1409
1218
  checkPWASetup() {
1410
- const fs = __require("fs");
1411
- const path = __require("path");
1412
1219
  const cwd = process.cwd();
1413
- const swPath = path.join(cwd, "app", "sw.ts");
1414
- const manifestPath = path.join(cwd, "app", "manifest.ts");
1415
- const hasSW = fs.existsSync(swPath);
1416
- const hasManifest = fs.existsSync(manifestPath);
1220
+ const swPath = join4(cwd, "app", "sw.ts");
1221
+ const manifestPath = join4(cwd, "app", "manifest.ts");
1222
+ const hasSW = existsSync3(swPath);
1223
+ const hasManifest = existsSync3(manifestPath);
1417
1224
  if (hasSW || hasManifest) {
1418
1225
  console.log(chalk4.cyan(" \u{1F4F1} PWA Configuration:"));
1419
1226
  if (hasSW) {
@@ -1521,15 +1328,15 @@ function createBaseNextConfig(options = {}) {
1521
1328
  ...cspExtra?.vendors ?? []
1522
1329
  ];
1523
1330
  const vendor = resolveCspVendors(vendorNames);
1524
- const join3 = (...groups) => {
1331
+ const join5 = (...groups) => {
1525
1332
  const all = [...new Set(groups.flatMap((g) => g ?? []))];
1526
1333
  return all.length ? " " + all.join(" ") : "";
1527
1334
  };
1528
- const extraScript = join3(vendor.scriptSrc, cspExtra?.scriptSrc);
1529
- const extraConnect = join3(vendor.connectSrc, cspExtra?.connectSrc);
1530
- const extraFrame = join3(vendor.frameSrc, cspExtra?.frameSrc);
1531
- const extraImg = join3(vendor.imgSrc, cspExtra?.imgSrc);
1532
- const extraFont = join3(vendor.fontSrc, cspExtra?.fontSrc);
1335
+ const extraScript = join5(vendor.scriptSrc, cspExtra?.scriptSrc);
1336
+ const extraConnect = join5(vendor.connectSrc, cspExtra?.connectSrc);
1337
+ const extraFrame = join5(vendor.frameSrc, cspExtra?.frameSrc);
1338
+ const extraImg = join5(vendor.imgSrc, cspExtra?.imgSrc);
1339
+ const extraFont = join5(vendor.fontSrc, cspExtra?.fontSrc);
1533
1340
  const connectSrc = isDev ? `connect-src 'self' http: https: ws: wss:${extraConnect}` : `connect-src 'self' https: wss:${extraConnect}`;
1534
1341
  const imgSrc = isDev ? `img-src 'self' data: blob: http: https:${extraImg}` : `img-src 'self' data: blob: https:${extraImg}`;
1535
1342
  if (!cspDisabled) {