@djangocfg/nextjs 2.1.514 → 2.1.516

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.
@@ -24,6 +24,7 @@ declare function createRouting(config?: Partial<I18nConfig>): {
24
24
  localePrefix?: next_intl_routing.LocalePrefix<string[], "always" | "as-needed" | "never">;
25
25
  domains?: never;
26
26
  localeCookie?: boolean | {
27
+ name?: string;
27
28
  maxAge?: number | undefined;
28
29
  priority?: "low" | "medium" | "high" | undefined;
29
30
  domain?: string | undefined;
@@ -31,7 +32,6 @@ declare function createRouting(config?: Partial<I18nConfig>): {
31
32
  secure?: boolean | undefined;
32
33
  sameSite?: true | false | "lax" | "strict" | "none" | undefined;
33
34
  partitioned?: boolean | undefined;
34
- name?: string;
35
35
  };
36
36
  alternateLinks?: boolean;
37
37
  localeDetection?: boolean;
@@ -46,6 +46,7 @@ declare const routing: {
46
46
  localePrefix?: next_intl_routing.LocalePrefix<string[], "always" | "as-needed" | "never">;
47
47
  domains?: never;
48
48
  localeCookie?: boolean | {
49
+ name?: string;
49
50
  maxAge?: number | undefined;
50
51
  priority?: "low" | "medium" | "high" | undefined;
51
52
  domain?: string | undefined;
@@ -53,7 +54,6 @@ declare const routing: {
53
54
  secure?: boolean | undefined;
54
55
  sameSite?: true | false | "lax" | "strict" | "none" | undefined;
55
56
  partitioned?: boolean | undefined;
56
- name?: string;
57
57
  };
58
58
  alternateLinks?: boolean;
59
59
  localeDetection?: boolean;
package/dist/index.mjs CHANGED
@@ -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/sitemap/constants.ts
209
9
  var STATIC_ID = "static";
@@ -490,6 +290,8 @@ function withI18n(config, options) {
490
290
 
491
291
  // src/pwa/plugin.ts
492
292
  import { consola } from "consola";
293
+ import { createRequire } from "module";
294
+ var requirePeer = createRequire(import.meta.url);
493
295
  function withPWA(nextConfig, options = {}) {
494
296
  const isDev2 = process.env.NODE_ENV === "development";
495
297
  const isStaticBuild2 = process.env.NEXT_PUBLIC_STATIC_BUILD === "true";
@@ -506,7 +308,7 @@ function withPWA(nextConfig, options = {}) {
506
308
  if (!process.env.SERWIST_SUPPRESS_TURBOPACK_WARNING) {
507
309
  process.env.SERWIST_SUPPRESS_TURBOPACK_WARNING = "1";
508
310
  }
509
- const withSerwistInit = __require("@serwist/next").default;
311
+ const withSerwistInit = requirePeer("@serwist/next").default;
510
312
  const withSerwist = withSerwistInit({
511
313
  swSrc: defaultOptions.swSrc,
512
314
  swDest: defaultOptions.swDest,
@@ -665,8 +467,11 @@ function resolveCspVendors(vendors, warnUnknown = true) {
665
467
  return merged;
666
468
  }
667
469
 
470
+ // src/config/plugins/compression.ts
471
+ import { createRequire as createRequire3 } from "module";
472
+
668
473
  // src/config/packages/checker.ts
669
- import { createRequire } from "module";
474
+ import { createRequire as createRequire2 } from "module";
670
475
  import { join } from "path";
671
476
 
672
477
  // src/config/utils/env.ts
@@ -734,7 +539,7 @@ function getPackagesForContext(options) {
734
539
  // src/config/packages/checker.ts
735
540
  function isPackageInstalled(packageName) {
736
541
  try {
737
- const consumerRequire = createRequire(join(process.cwd(), "package.json"));
542
+ const consumerRequire = createRequire2(join(process.cwd(), "package.json"));
738
543
  consumerRequire.resolve(packageName);
739
544
  return true;
740
545
  } catch {
@@ -789,6 +594,7 @@ function getReasonText(pkg) {
789
594
  }
790
595
 
791
596
  // src/config/plugins/compression.ts
597
+ var requirePeer2 = createRequire3(import.meta.url);
792
598
  var DEFAULT_OPTIONS = {
793
599
  gzip: true,
794
600
  brotli: true,
@@ -802,7 +608,7 @@ function addCompressionPlugins(config, options = {}) {
802
608
  }
803
609
  const opts = { ...DEFAULT_OPTIONS, ...options };
804
610
  try {
805
- const CompressionPlugin = __require("compression-webpack-plugin");
611
+ const CompressionPlugin = requirePeer2("compression-webpack-plugin");
806
612
  if (!config.plugins) {
807
613
  config.plugins = [];
808
614
  }
@@ -842,6 +648,8 @@ function isCompressionAvailable() {
842
648
 
843
649
  // src/config/plugins/devStartup.ts
844
650
  import chalk4 from "chalk";
651
+ import { existsSync as existsSync3 } from "fs";
652
+ import { join as join4 } from "path";
845
653
 
846
654
  // src/ai/constants.ts
847
655
  var MCP_BASE_URL = "https://mcp.djangocfg.com";
@@ -870,6 +678,8 @@ import chalk from "chalk";
870
678
  import { execSync, spawn } from "child_process";
871
679
  import Conf from "conf";
872
680
  import consola3 from "consola";
681
+ import { existsSync } from "fs";
682
+ import { join as join2 } from "path";
873
683
  import { createInterface } from "readline";
874
684
  function createMemoryCache() {
875
685
  const store = /* @__PURE__ */ new Map();
@@ -900,12 +710,10 @@ var PROMPT_COOLDOWN_MS = 60 * 60 * 1e3;
900
710
  var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
901
711
  function detectPackageManager() {
902
712
  try {
903
- const fs = __require("fs");
904
- const path = __require("path");
905
713
  const cwd = process.cwd();
906
- if (fs.existsSync(path.join(cwd, "pnpm-lock.yaml"))) return "pnpm";
907
- if (fs.existsSync(path.join(cwd, "yarn.lock"))) return "yarn";
908
- if (fs.existsSync(path.join(cwd, "package-lock.json"))) return "npm";
714
+ if (existsSync(join2(cwd, "pnpm-lock.yaml"))) return "pnpm";
715
+ if (existsSync(join2(cwd, "yarn.lock"))) return "yarn";
716
+ if (existsSync(join2(cwd, "package-lock.json"))) return "npm";
909
717
  try {
910
718
  execSync("pnpm --version", { stdio: "ignore" });
911
719
  return "pnpm";
@@ -1201,8 +1009,9 @@ import chalk2 from "chalk";
1201
1009
  import { spawn as spawn2 } from "child_process";
1202
1010
  import Conf2 from "conf";
1203
1011
  import consola4 from "consola";
1204
- import { createRequire as createRequire2 } from "module";
1205
- import { join as join2 } from "path";
1012
+ import { existsSync as existsSync2, readFileSync } from "fs";
1013
+ import { createRequire as createRequire4 } from "module";
1014
+ import { join as join3 } from "path";
1206
1015
  import { createInterface as createInterface2 } from "readline";
1207
1016
  import semver from "semver";
1208
1017
  function createMemoryCache2() {
@@ -1234,9 +1043,8 @@ var UPDATE_CHECK_COOLDOWN_MS = 60 * 60 * 1e3;
1234
1043
  var SPINNER_FRAMES2 = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
1235
1044
  function isWorkspacePackage(packageName) {
1236
1045
  try {
1237
- const fs = __require("fs");
1238
- const pkgJsonPath = join2(process.cwd(), "package.json");
1239
- const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
1046
+ const pkgJsonPath = join3(process.cwd(), "package.json");
1047
+ const pkgJson = JSON.parse(readFileSync(pkgJsonPath, "utf-8"));
1240
1048
  const deps = { ...pkgJson.dependencies, ...pkgJson.devDependencies };
1241
1049
  const version = deps[packageName];
1242
1050
  return version?.startsWith("workspace:") || false;
@@ -1245,27 +1053,25 @@ function isWorkspacePackage(packageName) {
1245
1053
  }
1246
1054
  }
1247
1055
  function getInstalledVersion(packageName) {
1248
- const fs = __require("fs");
1249
1056
  const cwd = process.cwd();
1250
1057
  try {
1251
- const directPath = join2(cwd, "node_modules", packageName, "package.json");
1252
- if (fs.existsSync(directPath)) {
1253
- const pkg = JSON.parse(fs.readFileSync(directPath, "utf-8"));
1058
+ const directPath = join3(cwd, "node_modules", packageName, "package.json");
1059
+ if (existsSync2(directPath)) {
1060
+ const pkg = JSON.parse(readFileSync(directPath, "utf-8"));
1254
1061
  return pkg.version || null;
1255
1062
  }
1256
1063
  } catch {
1257
1064
  }
1258
1065
  try {
1259
- const consumerRequire = createRequire2(join2(cwd, "package.json"));
1066
+ const consumerRequire = createRequire4(join3(cwd, "package.json"));
1260
1067
  const pkgPath = consumerRequire.resolve(`${packageName}/package.json`);
1261
- const pkg = __require(pkgPath);
1262
- return pkg.version || null;
1068
+ return JSON.parse(readFileSync(pkgPath, "utf-8")).version || null;
1263
1069
  } catch {
1264
1070
  }
1265
1071
  try {
1266
- const pkgPath = __require.resolve(`${packageName}/package.json`);
1267
- const pkg = __require(pkgPath);
1268
- return pkg.version || null;
1072
+ const localRequire = createRequire4(import.meta.url);
1073
+ const pkgPath = localRequire.resolve(`${packageName}/package.json`);
1074
+ return JSON.parse(readFileSync(pkgPath, "utf-8")).version || null;
1269
1075
  } catch {
1270
1076
  return null;
1271
1077
  }
@@ -1539,6 +1345,8 @@ function resetUpdaterPreferences() {
1539
1345
  import chalk3 from "chalk";
1540
1346
  import Conf3 from "conf";
1541
1347
  import consola5 from "consola";
1348
+ import { readFileSync as readFileSync2 } from "fs";
1349
+ import { createRequire as createRequire5 } from "module";
1542
1350
  import semver2 from "semver";
1543
1351
  function createMemoryCache3() {
1544
1352
  const store = /* @__PURE__ */ new Map();
@@ -1567,8 +1375,9 @@ function createVersionCache() {
1567
1375
  var versionCache = createVersionCache();
1568
1376
  function getCurrentVersion() {
1569
1377
  try {
1570
- const packageJson = require_package();
1571
- return packageJson.version || null;
1378
+ const localRequire = createRequire5(import.meta.url);
1379
+ const pkgPath = localRequire.resolve("../../../package.json");
1380
+ return JSON.parse(readFileSync2(pkgPath, "utf-8")).version || null;
1572
1381
  } catch {
1573
1382
  return null;
1574
1383
  }
@@ -1681,13 +1490,11 @@ var DevStartupPlugin = class {
1681
1490
  }
1682
1491
  }
1683
1492
  checkPWASetup() {
1684
- const fs = __require("fs");
1685
- const path = __require("path");
1686
1493
  const cwd = process.cwd();
1687
- const swPath = path.join(cwd, "app", "sw.ts");
1688
- const manifestPath = path.join(cwd, "app", "manifest.ts");
1689
- const hasSW = fs.existsSync(swPath);
1690
- const hasManifest = fs.existsSync(manifestPath);
1494
+ const swPath = join4(cwd, "app", "sw.ts");
1495
+ const manifestPath = join4(cwd, "app", "manifest.ts");
1496
+ const hasSW = existsSync3(swPath);
1497
+ const hasManifest = existsSync3(manifestPath);
1691
1498
  if (hasSW || hasManifest) {
1692
1499
  console.log(chalk4.cyan(" \u{1F4F1} PWA Configuration:"));
1693
1500
  if (hasSW) {
@@ -1795,15 +1602,15 @@ function createBaseNextConfig(options = {}) {
1795
1602
  ...cspExtra?.vendors ?? []
1796
1603
  ];
1797
1604
  const vendor = resolveCspVendors(vendorNames);
1798
- const join3 = (...groups) => {
1605
+ const join5 = (...groups) => {
1799
1606
  const all = [...new Set(groups.flatMap((g) => g ?? []))];
1800
1607
  return all.length ? " " + all.join(" ") : "";
1801
1608
  };
1802
- const extraScript = join3(vendor.scriptSrc, cspExtra?.scriptSrc);
1803
- const extraConnect = join3(vendor.connectSrc, cspExtra?.connectSrc);
1804
- const extraFrame = join3(vendor.frameSrc, cspExtra?.frameSrc);
1805
- const extraImg = join3(vendor.imgSrc, cspExtra?.imgSrc);
1806
- const extraFont = join3(vendor.fontSrc, cspExtra?.fontSrc);
1609
+ const extraScript = join5(vendor.scriptSrc, cspExtra?.scriptSrc);
1610
+ const extraConnect = join5(vendor.connectSrc, cspExtra?.connectSrc);
1611
+ const extraFrame = join5(vendor.frameSrc, cspExtra?.frameSrc);
1612
+ const extraImg = join5(vendor.imgSrc, cspExtra?.imgSrc);
1613
+ const extraFont = join5(vendor.fontSrc, cspExtra?.fontSrc);
1807
1614
  const connectSrc = isDev ? `connect-src 'self' http: https: ws: wss:${extraConnect}` : `connect-src 'self' https: wss:${extraConnect}`;
1808
1615
  const imgSrc = isDev ? `img-src 'self' data: blob: http: https:${extraImg}` : `img-src 'self' data: blob: https:${extraImg}`;
1809
1616
  if (!cspDisabled) {