@djangocfg/nextjs 2.1.6 → 2.1.7

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.
Files changed (39) hide show
  1. package/dist/ai/cli.d.mts +1 -0
  2. package/dist/ai/cli.mjs +171 -0
  3. package/dist/ai/cli.mjs.map +1 -0
  4. package/dist/ai/index.d.mts +81 -0
  5. package/dist/ai/index.mjs +139 -0
  6. package/dist/ai/index.mjs.map +1 -0
  7. package/dist/config/index.d.mts +360 -0
  8. package/dist/config/index.mjs +1363 -0
  9. package/dist/config/index.mjs.map +1 -0
  10. package/dist/constants-HezbftFb.d.mts +10 -0
  11. package/dist/contact/index.d.mts +47 -0
  12. package/dist/contact/index.mjs +98 -0
  13. package/dist/contact/index.mjs.map +1 -0
  14. package/dist/contact/route.d.mts +35 -0
  15. package/dist/contact/route.mjs +99 -0
  16. package/dist/contact/route.mjs.map +1 -0
  17. package/dist/health/index.d.mts +43 -0
  18. package/dist/health/index.mjs +38 -0
  19. package/dist/health/index.mjs.map +1 -0
  20. package/dist/index.d.mts +19 -0
  21. package/dist/index.mjs +2565 -0
  22. package/dist/index.mjs.map +1 -0
  23. package/dist/navigation/index.d.mts +89 -0
  24. package/dist/navigation/index.mjs +63 -0
  25. package/dist/navigation/index.mjs.map +1 -0
  26. package/dist/og-image/components/index.d.mts +59 -0
  27. package/dist/og-image/components/index.mjs +325 -0
  28. package/dist/og-image/components/index.mjs.map +1 -0
  29. package/dist/og-image/index.d.mts +112 -0
  30. package/dist/og-image/index.mjs +823 -0
  31. package/dist/og-image/index.mjs.map +1 -0
  32. package/dist/og-image/utils/index.d.mts +302 -0
  33. package/dist/og-image/utils/index.mjs +317 -0
  34. package/dist/og-image/utils/index.mjs.map +1 -0
  35. package/dist/sitemap/index.d.mts +66 -0
  36. package/dist/sitemap/index.mjs +76 -0
  37. package/dist/sitemap/index.mjs.map +1 -0
  38. package/dist/types-CwhXnEbK.d.mts +30 -0
  39. package/package.json +7 -6
@@ -0,0 +1,360 @@
1
+ import { NextConfig } from 'next';
2
+ import { Configuration, Compiler } from 'webpack';
3
+ export { A as AI_DOCS_HINT, b as MCP_API_URL, M as MCP_BASE_URL, a as MCP_SERVER_URL } from '../constants-HezbftFb.mjs';
4
+
5
+ /**
6
+ * Base Next.js Configuration Factory
7
+ *
8
+ * Universal, reusable Next.js config for all DjangoCFG projects
9
+ * Provides standard settings that can be extended per project
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * // In your project's next.config.ts
14
+ * import { createBaseNextConfig } from '@djangocfg/nextjs/config';
15
+ * import bundleAnalyzer from '@next/bundle-analyzer';
16
+ *
17
+ * const withBundleAnalyzer = bundleAnalyzer({
18
+ * enabled: process.env.ANALYZE === 'true',
19
+ * });
20
+ *
21
+ * export default withBundleAnalyzer(createBaseNextConfig({
22
+ * // Your project-specific overrides
23
+ * transpilePackages: ['my-custom-package'],
24
+ * }));
25
+ * ```
26
+ */
27
+
28
+ interface BaseNextConfigOptions {
29
+ /** Static build path (used when NEXT_PUBLIC_STATIC_BUILD=true) */
30
+ isDefaultCfgAdmin?: boolean;
31
+ /** Additional transpile packages (merged with defaults) */
32
+ transpilePackages?: string[];
33
+ /** Additional optimize package imports (merged with defaults) */
34
+ optimizePackageImports?: string[];
35
+ /** Automatically open browser in dev mode (default: false) */
36
+ openBrowser?: boolean;
37
+ /** Check for @djangocfg/* package updates on startup (default: true) */
38
+ checkUpdates?: boolean;
39
+ /** Auto-update outdated packages without prompting (default: false) */
40
+ autoUpdate?: boolean;
41
+ /** Force check workspace:* packages for updates (for testing in monorepo) */
42
+ forceCheckWorkspace?: boolean;
43
+ /** Check for missing optional packages on startup (default: true) */
44
+ checkPackages?: boolean;
45
+ /** Auto-install missing packages without prompting (default: false) */
46
+ autoInstall?: boolean;
47
+ /**
48
+ * Allow embedding this app in iframe from specified origins
49
+ * Set to ['*'] to allow all origins, or specify domains like ['https://djangocfg.com']
50
+ */
51
+ allowIframeFrom?: string[];
52
+ /** Custom webpack configuration function (called after base webpack logic) */
53
+ webpack?: (config: Configuration, options: {
54
+ isServer: boolean;
55
+ dev: boolean;
56
+ [key: string]: any;
57
+ }) => Configuration | void;
58
+ /** Custom experimental options (merged with defaults) */
59
+ experimental?: NextConfig['experimental'];
60
+ /** Custom env variables (merged with defaults) */
61
+ env?: Record<string, string | undefined>;
62
+ /** Override any Next.js config option */
63
+ [key: string]: any;
64
+ }
65
+ /**
66
+ * Create base Next.js configuration with standard DjangoCFG settings
67
+ *
68
+ * @param options - Custom configuration options to merge with base config
69
+ * @returns Next.js configuration function
70
+ */
71
+ declare function createBaseNextConfig(options?: BaseNextConfigOptions): NextConfig;
72
+
73
+ /**
74
+ * Shared Constants for DjangoCFG Next.js Configuration
75
+ */
76
+ declare const PACKAGE_NAME = "@djangocfg/nextjs";
77
+ declare const DJANGO_CFG_BANNER = "\n\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\n\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557 \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\n\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2588\u2557\n\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551 \u2588\u2588\u2551\n\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u255A\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D \u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\n\u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D\n";
78
+ declare const DJANGOCFG_PACKAGES: readonly ["@djangocfg/ui-core", "@djangocfg/ui-nextjs", "@djangocfg/layouts", "@djangocfg/nextjs", "@djangocfg/api", "@djangocfg/centrifugo", "@djangocfg/eslint-config", "@djangocfg/typescript-config"];
79
+ declare const DEFAULT_TRANSPILE_PACKAGES: readonly ["@djangocfg/ui-core", "@djangocfg/ui-nextjs", "@djangocfg/layouts", "@djangocfg/nextjs", "@djangocfg/api", "@djangocfg/centrifugo"];
80
+ declare const DEFAULT_OPTIMIZE_PACKAGES: readonly ["@djangocfg/ui-core", "@djangocfg/ui-nextjs", "@djangocfg/layouts", "lucide-react", "recharts"];
81
+
82
+ /**
83
+ * Deep Merge Utility
84
+ *
85
+ * Recursively merges objects, replacing arrays instead of merging them.
86
+ */
87
+ declare function deepMerge<T extends Record<string, any>>(target: T, source: Partial<T>): T;
88
+
89
+ /**
90
+ * Environment Variable Utilities
91
+ */
92
+ declare const isStaticBuild: boolean;
93
+ declare const isDev: boolean;
94
+ declare const isProduction: boolean;
95
+ declare const isCI: boolean;
96
+ /**
97
+ * Get base path for static builds
98
+ */
99
+ declare function getBasePath(isDefaultCfgAdmin?: boolean): string;
100
+ /**
101
+ * Get API URL (empty for static builds)
102
+ */
103
+ declare function getApiUrl(): string;
104
+ /**
105
+ * Get Site URL (empty for static builds)
106
+ */
107
+ declare function getSiteUrl(): string;
108
+
109
+ /**
110
+ * Version Checking Utilities
111
+ */
112
+ /**
113
+ * Get current package version from package.json
114
+ */
115
+ declare function getCurrentVersion(): string | null;
116
+ /**
117
+ * Fetch latest version from npm registry (with 1 hour caching via conf)
118
+ */
119
+ declare function fetchLatestVersion(): Promise<string | null>;
120
+ /**
121
+ * Check if update is available
122
+ */
123
+ declare function checkForUpdate(): Promise<{
124
+ hasUpdate: boolean;
125
+ currentVersion: string | null;
126
+ latestVersion: string | null;
127
+ }>;
128
+ /**
129
+ * Get update command for all djangocfg packages
130
+ */
131
+ declare function getUpdateCommand(): string;
132
+ /**
133
+ * Print version info and update notification
134
+ */
135
+ declare function printVersionInfo(): Promise<void>;
136
+
137
+ /**
138
+ * Package Definitions
139
+ *
140
+ * Defines optional packages that can be auto-installed when needed.
141
+ */
142
+ interface PackageDefinition {
143
+ /** npm package name */
144
+ name: string;
145
+ /** Human-readable description */
146
+ description: string;
147
+ /** When is this package needed? */
148
+ condition: 'static-build' | 'dev' | 'always';
149
+ /** Is this a dev dependency? */
150
+ devDependency: boolean;
151
+ /** Feature flag that enables this package */
152
+ featureFlag?: string;
153
+ }
154
+ /**
155
+ * Optional packages that can be auto-installed
156
+ */
157
+ declare const OPTIONAL_PACKAGES: PackageDefinition[];
158
+ /**
159
+ * Required peer dependencies (should already be installed)
160
+ */
161
+ declare const PEER_DEPENDENCIES: readonly ["next", "react", "react-dom"];
162
+ /**
163
+ * Get packages needed for current build context
164
+ */
165
+ declare function getPackagesForContext(options: {
166
+ isStaticBuild: boolean;
167
+ isDev: boolean;
168
+ }): PackageDefinition[];
169
+
170
+ /**
171
+ * Package Checker
172
+ *
173
+ * Checks which optional packages are missing and need to be installed.
174
+ */
175
+
176
+ interface MissingPackage extends PackageDefinition {
177
+ /** Why is this package needed? */
178
+ reason: string;
179
+ }
180
+ /**
181
+ * Check if a package is installed in the consumer's project
182
+ * Uses process.cwd() to check from the consumer's context, not the library's
183
+ */
184
+ declare function isPackageInstalled(packageName: string): boolean;
185
+ /**
186
+ * Get all missing packages for current context
187
+ */
188
+ declare function getMissingPackages(): MissingPackage[];
189
+ /**
190
+ * Check specific packages
191
+ */
192
+ declare function checkPackages(packageNames: string[]): MissingPackage[];
193
+
194
+ /**
195
+ * Package Installer
196
+ *
197
+ * Provides auto-installation functionality with user confirmation and progress indication.
198
+ */
199
+
200
+ interface InstallOptions {
201
+ /** Auto-install without prompting */
202
+ autoInstall?: boolean;
203
+ /** Skip specific packages */
204
+ skipPackages?: string[];
205
+ /** Force prompt even if recently prompted */
206
+ force?: boolean;
207
+ }
208
+ interface InstallProgress {
209
+ current: number;
210
+ total: number;
211
+ package: string;
212
+ status: 'pending' | 'installing' | 'done' | 'error';
213
+ }
214
+ /**
215
+ * Detect package manager
216
+ */
217
+ declare function detectPackageManager(): 'pnpm' | 'yarn' | 'npm';
218
+ /**
219
+ * Build install command for a single package
220
+ */
221
+ declare function buildSingleInstallCommand(packageName: string, isDev: boolean, pm: 'pnpm' | 'yarn' | 'npm'): string;
222
+ /**
223
+ * Build install command for multiple packages (for display)
224
+ */
225
+ declare function buildInstallCommand(packages: MissingPackage[], pm: 'pnpm' | 'yarn' | 'npm'): string;
226
+ /**
227
+ * Install packages with progress indication
228
+ */
229
+ declare function installPackagesWithProgress(packages: MissingPackage[]): Promise<boolean>;
230
+ /**
231
+ * Install packages (simple version without per-package progress)
232
+ */
233
+ declare function installPackages(packages: MissingPackage[]): Promise<boolean>;
234
+ /**
235
+ * Check and prompt for missing packages
236
+ *
237
+ * Returns true if all packages are available (either already installed or just installed)
238
+ */
239
+ declare function checkAndInstallPackages(options?: InstallOptions): Promise<boolean>;
240
+ /**
241
+ * Reset installer preferences
242
+ */
243
+ declare function resetInstallerPreferences(): void;
244
+
245
+ /**
246
+ * Package Updater
247
+ *
248
+ * Checks for outdated @djangocfg/* packages and offers to update them.
249
+ */
250
+ interface PackageVersion {
251
+ name: string;
252
+ current: string | null;
253
+ latest: string | null;
254
+ hasUpdate: boolean;
255
+ }
256
+ interface UpdateOptions {
257
+ /** Auto-update without prompting */
258
+ autoUpdate?: boolean;
259
+ /** Force check even if recently checked (ignores cooldown) */
260
+ force?: boolean;
261
+ /** Force check even for workspace:* packages (for testing) */
262
+ forceCheckWorkspace?: boolean;
263
+ }
264
+ /**
265
+ * Get installed version of a package from consumer's project
266
+ * Uses multiple fallback strategies for monorepo compatibility
267
+ */
268
+ declare function getInstalledVersion(packageName: string): string | null;
269
+ /**
270
+ * Check all @djangocfg packages for updates
271
+ * All packages are aligned to the version of @djangocfg/nextjs (master package)
272
+ * Skips workspace:* packages unless forceCheckWorkspace is true
273
+ */
274
+ declare function checkForUpdates(options?: {
275
+ forceCheckWorkspace?: boolean;
276
+ }): Promise<PackageVersion[]>;
277
+ /**
278
+ * Get packages that need updating
279
+ */
280
+ declare function getOutdatedPackages(options?: {
281
+ forceCheckWorkspace?: boolean;
282
+ }): Promise<PackageVersion[]>;
283
+ /**
284
+ * Update packages with progress
285
+ */
286
+ declare function updatePackagesWithProgress(packages: PackageVersion[]): Promise<boolean>;
287
+ /**
288
+ * Check and prompt for package updates
289
+ */
290
+ declare function checkAndUpdatePackages(options?: UpdateOptions): Promise<boolean>;
291
+ /**
292
+ * Reset updater preferences
293
+ */
294
+ declare function resetUpdaterPreferences(): void;
295
+
296
+ /**
297
+ * Dev Startup Webpack Plugin
298
+ *
299
+ * Handles banner display, version checking, package updates, and browser auto-open.
300
+ */
301
+
302
+ interface DevStartupPluginOptions {
303
+ /** Auto-open browser */
304
+ openBrowser?: boolean;
305
+ /** Check for missing optional packages (default: true) */
306
+ checkPackages?: boolean;
307
+ /** Auto-install missing packages without prompting */
308
+ autoInstall?: boolean;
309
+ /** Check for @djangocfg/* package updates (default: true) */
310
+ checkUpdates?: boolean;
311
+ /** Auto-update packages without prompting */
312
+ autoUpdate?: boolean;
313
+ /** Force check workspace:* packages (for testing in monorepo) */
314
+ forceCheckWorkspace?: boolean;
315
+ }
316
+ /**
317
+ * Webpack plugin for dev startup tasks
318
+ */
319
+ declare class DevStartupPlugin {
320
+ private options;
321
+ constructor(options?: DevStartupPluginOptions);
322
+ apply(compiler: Compiler): void;
323
+ private runStartupTasks;
324
+ private openBrowser;
325
+ }
326
+ /**
327
+ * Reset plugin state (useful for tests)
328
+ */
329
+ declare function resetDevStartupState(): void;
330
+
331
+ /**
332
+ * Compression Plugin Setup
333
+ *
334
+ * Adds Gzip and Brotli compression for static builds.
335
+ */
336
+
337
+ interface CompressionPluginOptions {
338
+ /** Enable gzip compression */
339
+ gzip?: boolean;
340
+ /** Enable brotli compression */
341
+ brotli?: boolean;
342
+ /** Minimum file size to compress (default: 8192) */
343
+ threshold?: number;
344
+ /** Minimum compression ratio (default: 0.8) */
345
+ minRatio?: number;
346
+ /** Brotli compression level (default: 8) */
347
+ brotliLevel?: number;
348
+ }
349
+ /**
350
+ * Add compression plugins to webpack config
351
+ *
352
+ * Returns true if plugins were added, false if compression-webpack-plugin is not installed
353
+ */
354
+ declare function addCompressionPlugins(config: Configuration, options?: CompressionPluginOptions): boolean;
355
+ /**
356
+ * Check if compression is available
357
+ */
358
+ declare function isCompressionAvailable(): boolean;
359
+
360
+ export { type BaseNextConfigOptions, type CompressionPluginOptions, DEFAULT_OPTIMIZE_PACKAGES, DEFAULT_TRANSPILE_PACKAGES, DJANGOCFG_PACKAGES, DJANGO_CFG_BANNER, DevStartupPlugin, type DevStartupPluginOptions, type InstallOptions, type InstallProgress, type MissingPackage, OPTIONAL_PACKAGES, PACKAGE_NAME, PEER_DEPENDENCIES, type PackageDefinition, type PackageVersion, type UpdateOptions, addCompressionPlugins, buildInstallCommand, buildSingleInstallCommand, checkAndInstallPackages, checkAndUpdatePackages, checkForUpdate, checkForUpdates, checkPackages, createBaseNextConfig, deepMerge, detectPackageManager, fetchLatestVersion, getApiUrl, getBasePath, getCurrentVersion, getInstalledVersion, getMissingPackages, getOutdatedPackages, getPackagesForContext, getSiteUrl, getUpdateCommand, installPackages, installPackagesWithProgress, isCI, isCompressionAvailable, isDev, isPackageInstalled, isProduction, isStaticBuild, printVersionInfo, resetDevStartupState, resetInstallerPreferences, resetUpdaterPreferences, updatePackagesWithProgress };