@djangocfg/nextjs 2.1.249 → 2.1.251

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djangocfg/nextjs",
3
- "version": "2.1.249",
3
+ "version": "2.1.251",
4
4
  "description": "Next.js server utilities: sitemap, health, OG images, contact forms, navigation, config",
5
5
  "keywords": [
6
6
  "nextjs",
@@ -143,9 +143,9 @@
143
143
  "ai-docs": "tsx src/ai/cli.ts"
144
144
  },
145
145
  "peerDependencies": {
146
- "@djangocfg/i18n": "^2.1.249",
147
- "@djangocfg/monitor": "^2.1.249",
148
- "@djangocfg/ui-core": "^2.1.249",
146
+ "@djangocfg/i18n": "^2.1.251",
147
+ "@djangocfg/monitor": "^2.1.251",
148
+ "@djangocfg/ui-core": "^2.1.251",
149
149
  "next": "^16.0.10"
150
150
  },
151
151
  "peerDependenciesMeta": {
@@ -167,11 +167,11 @@
167
167
  "serwist": "^9.2.3"
168
168
  },
169
169
  "devDependencies": {
170
- "@djangocfg/i18n": "^2.1.249",
171
- "@djangocfg/monitor": "^2.1.249",
172
- "@djangocfg/ui-core": "^2.1.249",
173
- "@djangocfg/layouts": "^2.1.249",
174
- "@djangocfg/typescript-config": "^2.1.249",
170
+ "@djangocfg/i18n": "^2.1.251",
171
+ "@djangocfg/monitor": "^2.1.251",
172
+ "@djangocfg/ui-core": "^2.1.251",
173
+ "@djangocfg/layouts": "^2.1.251",
174
+ "@djangocfg/typescript-config": "^2.1.251",
175
175
  "@types/node": "^24.7.2",
176
176
  "@types/react": "^19.1.0",
177
177
  "@types/react-dom": "^19.1.0",
@@ -14,15 +14,47 @@ import { isCI } from '../utils/env';
14
14
  import { getMissingPackages } from './checker';
15
15
 
16
16
  import type { MissingPackage } from './checker';
17
- // Installer preferences cache
18
- const installerCache = new Conf<{
17
+ type InstallerCacheShape = {
19
18
  autoInstall?: boolean;
20
19
  skipPackages?: string[];
21
20
  lastPrompt?: number;
22
- }>({
23
- projectName: 'djangocfg-nextjs-installer',
24
- projectVersion: '1.0.0',
25
- });
21
+ };
22
+
23
+ interface CacheLike<T extends Record<string, any>> {
24
+ get<K extends keyof T>(key: K): T[K] | undefined;
25
+ set<K extends keyof T>(key: K, value: T[K]): void;
26
+ clear(): void;
27
+ }
28
+
29
+ function createMemoryCache<T extends Record<string, any>>(): CacheLike<T> {
30
+ const store = new Map<string, unknown>();
31
+ return {
32
+ get<K extends keyof T>(key: K): T[K] | undefined {
33
+ return store.get(String(key)) as T[K] | undefined;
34
+ },
35
+ set<K extends keyof T>(key: K, value: T[K]): void {
36
+ store.set(String(key), value);
37
+ },
38
+ clear(): void {
39
+ store.clear();
40
+ },
41
+ };
42
+ }
43
+
44
+ function createInstallerCache(): CacheLike<InstallerCacheShape> {
45
+ try {
46
+ return new Conf<InstallerCacheShape>({
47
+ projectName: 'djangocfg-nextjs-installer',
48
+ projectVersion: '1.0.0',
49
+ });
50
+ } catch {
51
+ // Fallback for corrupted conf file or invalid JSON in cache storage.
52
+ return createMemoryCache<InstallerCacheShape>();
53
+ }
54
+ }
55
+
56
+ // Installer preferences cache
57
+ const installerCache = createInstallerCache();
26
58
 
27
59
  // Don't prompt more than once per hour
28
60
  const PROMPT_COOLDOWN_MS = 60 * 60 * 1000;
@@ -17,15 +17,47 @@ import { DJANGOCFG_PACKAGES, PACKAGE_NAME } from '../constants';
17
17
  import { isCI } from '../utils/env';
18
18
  import { detectPackageManager } from './installer';
19
19
 
20
- // Updater preferences cache
21
- const updaterCache = new Conf<{
20
+ type UpdaterCacheShape = {
22
21
  autoUpdate?: boolean;
23
22
  lastCheck?: number;
24
23
  skippedVersions?: Record<string, string>;
25
- }>({
26
- projectName: 'djangocfg-nextjs-updater',
27
- projectVersion: '1.0.0',
28
- });
24
+ };
25
+
26
+ interface CacheLike<T extends Record<string, any>> {
27
+ get<K extends keyof T>(key: K): T[K] | undefined;
28
+ set<K extends keyof T>(key: K, value: T[K]): void;
29
+ clear(): void;
30
+ }
31
+
32
+ function createMemoryCache<T extends Record<string, any>>(): CacheLike<T> {
33
+ const store = new Map<string, unknown>();
34
+ return {
35
+ get<K extends keyof T>(key: K): T[K] | undefined {
36
+ return store.get(String(key)) as T[K] | undefined;
37
+ },
38
+ set<K extends keyof T>(key: K, value: T[K]): void {
39
+ store.set(String(key), value);
40
+ },
41
+ clear(): void {
42
+ store.clear();
43
+ },
44
+ };
45
+ }
46
+
47
+ function createUpdaterCache(): CacheLike<UpdaterCacheShape> {
48
+ try {
49
+ return new Conf<UpdaterCacheShape>({
50
+ projectName: 'djangocfg-nextjs-updater',
51
+ projectVersion: '1.0.0',
52
+ });
53
+ } catch {
54
+ // Fallback for corrupted conf file or invalid JSON in cache storage.
55
+ return createMemoryCache<UpdaterCacheShape>();
56
+ }
57
+ }
58
+
59
+ // Updater preferences cache
60
+ const updaterCache = createUpdaterCache();
29
61
 
30
62
  // Check for updates once per hour
31
63
  const UPDATE_CHECK_COOLDOWN_MS = 60 * 60 * 1000;
@@ -9,14 +9,46 @@ import semver from 'semver';
9
9
 
10
10
  import { DJANGOCFG_PACKAGES, PACKAGE_NAME, VERSION_CACHE_TTL_MS } from '../constants';
11
11
 
12
- // Version cache using conf (stores in ~/.config/djangocfg-nextjs/)
13
- const versionCache = new Conf<{
12
+ type VersionCacheShape = {
14
13
  latestVersion?: string;
15
14
  lastCheck?: number;
16
- }>({
17
- projectName: 'djangocfg-nextjs',
18
- projectVersion: '1.0.0',
19
- });
15
+ };
16
+
17
+ interface CacheLike<T extends Record<string, any>> {
18
+ get<K extends keyof T>(key: K): T[K] | undefined;
19
+ set<K extends keyof T>(key: K, value: T[K]): void;
20
+ clear(): void;
21
+ }
22
+
23
+ function createMemoryCache<T extends Record<string, any>>(): CacheLike<T> {
24
+ const store = new Map<string, unknown>();
25
+ return {
26
+ get<K extends keyof T>(key: K): T[K] | undefined {
27
+ return store.get(String(key)) as T[K] | undefined;
28
+ },
29
+ set<K extends keyof T>(key: K, value: T[K]): void {
30
+ store.set(String(key), value);
31
+ },
32
+ clear(): void {
33
+ store.clear();
34
+ },
35
+ };
36
+ }
37
+
38
+ function createVersionCache(): CacheLike<VersionCacheShape> {
39
+ try {
40
+ return new Conf<VersionCacheShape>({
41
+ projectName: 'djangocfg-nextjs',
42
+ projectVersion: '1.0.0',
43
+ });
44
+ } catch {
45
+ // Fallback for corrupted conf file or invalid JSON in cache storage.
46
+ return createMemoryCache<VersionCacheShape>();
47
+ }
48
+ }
49
+
50
+ // Version cache using conf (stores in ~/.config/djangocfg-nextjs/)
51
+ const versionCache = createVersionCache();
20
52
 
21
53
  /**
22
54
  * Get current package version from package.json