@djangocfg/nextjs 2.1.42 → 2.1.43

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 +1 @@
1
- {"version":3,"sources":["../../src/sitemap/route.ts","../../src/sitemap/generator.ts"],"sourcesContent":["/**\n * Sitemap Route Handler for Next.js App Router\n *\n * Usage:\n * ```tsx\n * // app/sitemap.ts\n * import { createSitemapHandler } from '@djangocfg/nextjs/sitemap';\n *\n * export default createSitemapHandler({\n * siteUrl: 'https://example.com',\n * staticPages: [\n * { loc: '/', changefreq: 'daily', priority: 1.0 },\n * { loc: '/about', changefreq: 'monthly', priority: 0.8 },\n * ],\n * dynamicPages: async () => {\n * // Fetch dynamic pages from API\n * const posts = await fetchPosts();\n * return posts.map(post => ({\n * loc: `/posts/${post.slug}`,\n * lastmod: post.updatedAt,\n * changefreq: 'weekly',\n * priority: 0.7,\n * }));\n * },\n * });\n * ```\n */\n\nimport { NextResponse } from 'next/server';\nimport type { SitemapGeneratorOptions } from './types';\nimport { generateSitemapXml, normalizeUrl } from './generator';\nimport type { SitemapUrl } from '../types';\n\nexport function createSitemapHandler(options: SitemapGeneratorOptions) {\n const {\n siteUrl,\n staticPages = [],\n dynamicPages = [],\n cacheControl = 'public, s-maxage=86400, stale-while-revalidate',\n } = options;\n\n return async function GET() {\n const urls: SitemapUrl[] = [...staticPages];\n\n // Add dynamic pages\n if (dynamicPages) {\n if (typeof dynamicPages === 'function') {\n const dynamicUrls = await dynamicPages();\n urls.push(...dynamicUrls);\n } else {\n urls.push(...dynamicPages);\n }\n }\n\n // Normalize all URLs\n const normalizedUrls = urls.map((url) => ({\n ...url,\n loc: normalizeUrl(url.loc, siteUrl),\n }));\n\n // Generate XML\n const sitemap = generateSitemapXml(normalizedUrls);\n\n // Return response\n return new NextResponse(sitemap, {\n status: 200,\n headers: {\n 'Content-Type': 'application/xml',\n 'Cache-Control': cacheControl,\n },\n });\n };\n}\n\n","/**\n * Sitemap Generator\n *\n * Generates XML sitemap from configuration\n */\n\nimport type { SitemapUrl } from '../types';\n\n/**\n * Generate XML sitemap string from URLs\n */\nexport function generateSitemapXml(urls: SitemapUrl[]): string {\n return `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n xsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9\n http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\">\n${urls\n .map(\n ({ loc, lastmod, changefreq, priority }) => ` <url>\n <loc>${escapeXml(loc)}</loc>\n ${lastmod ? `<lastmod>${formatDate(lastmod)}</lastmod>` : ''}\n ${changefreq ? `<changefreq>${changefreq}</changefreq>` : ''}\n ${priority !== undefined ? `<priority>${priority.toFixed(1)}</priority>` : ''}\n </url>`\n )\n .join('\\n')}\n</urlset>`;\n}\n\n/**\n * Format date for sitemap (ISO 8601)\n */\nfunction formatDate(date: string | Date): string {\n if (typeof date === 'string') {\n return date;\n }\n return date.toISOString().split('T')[0];\n}\n\n/**\n * Escape XML special characters\n */\nfunction escapeXml(unsafe: string): string {\n return unsafe\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&apos;');\n}\n\n/**\n * Normalize URL (ensure absolute)\n */\nexport function normalizeUrl(url: string, siteUrl: string): string {\n if (url.startsWith('http://') || url.startsWith('https://')) {\n return url;\n }\n const baseUrl = siteUrl.endsWith('/') ? siteUrl.slice(0, -1) : siteUrl;\n const path = url.startsWith('/') ? url : `/${url}`;\n return `${baseUrl}${path}`;\n}\n\n"],"mappings":";AA4BA,SAAS,oBAAoB;;;ACjBtB,SAAS,mBAAmB,MAA4B;AAC7D,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKP,KACC;AAAA,IACC,CAAC,EAAE,KAAK,SAAS,YAAY,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Y;AAAA,MAC3B;AAAA,IACF;AAGA,UAAM,iBAAiB,KAAK,IAAI,CAAC,SAAS;AAAA,MACxC,GAAG;AAAA,MACH,KAAK,aAAa,IAAI,KAAK,OAAO;AAAA,IACpC,EAAE;AAGF,UAAM,UAAU,mBAAmB,cAAc;AAGjD,WAAO,IAAI,aAAa,SAAS;AAAA,MAC/B,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,gBAAgB;AAAA,QAChB,iBAAiB;AAAA,MACnB;AAAA,IACF,CAAC;AAAA,EACH;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/sitemap/route.ts","../../src/sitemap/generator.ts"],"sourcesContent":["/**\n * Sitemap Route Handler for Next.js App Router\n *\n * Usage:\n * ```tsx\n * // app/sitemap.ts\n * import { createSitemapHandler } from '@djangocfg/nextjs/sitemap';\n *\n * export default createSitemapHandler({\n * siteUrl: 'https://example.com',\n * staticPages: [\n * { loc: '/', changefreq: 'daily', priority: 1.0 },\n * { loc: '/about', changefreq: 'monthly', priority: 0.8 },\n * ],\n * dynamicPages: async () => {\n * // Fetch dynamic pages from API\n * const posts = await fetchPosts();\n * return posts.map(post => ({\n * loc: `/posts/${post.slug}`,\n * lastmod: post.updatedAt,\n * changefreq: 'weekly',\n * priority: 0.7,\n * }));\n * },\n * });\n * ```\n */\n\nimport { NextResponse } from 'next/server';\n\nimport { generateSitemapXml, normalizeUrl } from './generator';\n\nimport type { SitemapGeneratorOptions } from './types';\nimport type { SitemapUrl } from '../types';\n\nexport function createSitemapHandler(options: SitemapGeneratorOptions) {\n const {\n siteUrl,\n staticPages = [],\n dynamicPages = [],\n cacheControl = 'public, s-maxage=86400, stale-while-revalidate',\n } = options;\n\n return async function GET() {\n const urls: SitemapUrl[] = [...staticPages];\n\n // Add dynamic pages\n if (dynamicPages) {\n if (typeof dynamicPages === 'function') {\n const dynamicUrls = await dynamicPages();\n urls.push(...dynamicUrls);\n } else {\n urls.push(...dynamicPages);\n }\n }\n\n // Normalize all URLs\n const normalizedUrls = urls.map((url) => ({\n ...url,\n loc: normalizeUrl(url.loc, siteUrl),\n }));\n\n // Generate XML\n const sitemap = generateSitemapXml(normalizedUrls);\n\n // Return response\n return new NextResponse(sitemap, {\n status: 200,\n headers: {\n 'Content-Type': 'application/xml',\n 'Cache-Control': cacheControl,\n },\n });\n };\n}\n\n","/**\n * Sitemap Generator\n *\n * Generates XML sitemap from configuration\n */\n\nimport type { SitemapUrl } from '../types';\n\n/**\n * Generate XML sitemap string from URLs\n */\nexport function generateSitemapXml(urls: SitemapUrl[]): string {\n return `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n xsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9\n http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\">\n${urls\n .map(\n ({ loc, lastmod, changefreq, priority }) => ` <url>\n <loc>${escapeXml(loc)}</loc>\n ${lastmod ? `<lastmod>${formatDate(lastmod)}</lastmod>` : ''}\n ${changefreq ? `<changefreq>${changefreq}</changefreq>` : ''}\n ${priority !== undefined ? `<priority>${priority.toFixed(1)}</priority>` : ''}\n </url>`\n )\n .join('\\n')}\n</urlset>`;\n}\n\n/**\n * Format date for sitemap (ISO 8601)\n */\nfunction formatDate(date: string | Date): string {\n if (typeof date === 'string') {\n return date;\n }\n return date.toISOString().split('T')[0];\n}\n\n/**\n * Escape XML special characters\n */\nfunction escapeXml(unsafe: string): string {\n return unsafe\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&apos;');\n}\n\n/**\n * Normalize URL (ensure absolute)\n */\nexport function normalizeUrl(url: string, siteUrl: string): string {\n if (url.startsWith('http://') || url.startsWith('https://')) {\n return url;\n }\n const baseUrl = siteUrl.endsWith('/') ? siteUrl.slice(0, -1) : siteUr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EJ,SAAO,eAAe,MAAM;AAC1B,UAAM,OAAqB,CAAC,GAAG,WAAW;AAG1C,QAAI,cAAc;AAChB,UAAI,OAAO,iBAAiB,YAAY;AACtC,cAAM,cAAc,MAAM,aAAa;AACvC,aAAK,KAAK,GAAG,WAAW;AAAA,MAC1B,OAAO;AACL,aAAK,KAAK,GAAG,YAAY;AAAA,MAC3B;AAAA,IACF;AAGA,UAAM,iBAAiB,KAAK,IAAI,CAAC,SAAS;AAAA,MACxC,GAAG;AAAA,MACH,KAAK,aAAa,IAAI,KAAK,OAAO;AAAA,IACpC,EAAE;AAGF,UAAM,UAAU,mBAAmB,cAAc;AAGjD,WAAO,IAAI,aAAa,SAAS;AAAA,MAC/B,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,gBAAgB;AAAA,QAChB,iBAAiB;AAAA,MACnB;AAAA,IACF,CAAC;AAAA,EACH;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djangocfg/nextjs",
3
- "version": "2.1.42",
3
+ "version": "2.1.43",
4
4
  "description": "Next.js server utilities: sitemap, health, OG images, contact forms, navigation, config",
5
5
  "keywords": [
6
6
  "nextjs",
@@ -139,9 +139,9 @@
139
139
  "web-push": "^3.6.7"
140
140
  },
141
141
  "devDependencies": {
142
- "@djangocfg/imgai": "^2.1.42",
143
- "@djangocfg/layouts": "^2.1.42",
144
- "@djangocfg/typescript-config": "^2.1.42",
142
+ "@djangocfg/imgai": "^2.1.43",
143
+ "@djangocfg/layouts": "^2.1.43",
144
+ "@djangocfg/typescript-config": "^2.1.43",
145
145
  "@types/node": "^24.7.2",
146
146
  "@types/react": "19.2.2",
147
147
  "@types/react-dom": "19.2.1",
package/src/ai/cli.ts CHANGED
@@ -8,7 +8,8 @@
8
8
  */
9
9
 
10
10
  import { consola } from 'consola';
11
- import { search, getMcpConfig, MCP_SERVER_URL, MCP_API_URL } from './index';
11
+
12
+ import { getMcpConfig, MCP_API_URL, MCP_SERVER_URL, search } from './index';
12
13
 
13
14
  const args = process.argv.slice(2);
14
15
  const command = args[0];
package/src/ai/client.ts CHANGED
@@ -4,12 +4,8 @@
4
4
  * HTTP client for accessing DjangoCFG documentation via MCP server API.
5
5
  */
6
6
 
7
- import {
8
- MCP_BASE_URL,
9
- API_SEARCH_ENDPOINT,
10
- API_INFO_ENDPOINT,
11
- DEFAULT_TIMEOUT,
12
- } from './constants';
7
+ import { API_INFO_ENDPOINT, API_SEARCH_ENDPOINT, DEFAULT_TIMEOUT, MCP_BASE_URL } from './constants';
8
+
13
9
  import type { SearchResult, SearchOptions, McpConfig, ApiSearchResponse } from './types';
14
10
 
15
11
  /**
@@ -24,12 +24,12 @@
24
24
  import type { NextConfig } from 'next';
25
25
  import type { Configuration as WebpackConfig } from 'webpack';
26
26
 
27
- import { DEFAULT_TRANSPILE_PACKAGES, DEFAULT_OPTIMIZE_PACKAGES } from './constants';
28
- import { deepMerge } from './utils/deepMerge';
29
- import { isStaticBuild, isDev, getBasePath, getApiUrl, getSiteUrl } from './utils/env';
30
- import { DevStartupPlugin } from './plugins/devStartup';
27
+ import { type PWAPluginOptions, withPWA } from '../pwa/plugin';
28
+ import { DEFAULT_OPTIMIZE_PACKAGES, DEFAULT_TRANSPILE_PACKAGES } from './constants';
31
29
  import { addCompressionPlugins } from './plugins/compression';
32
- import { withPWA, type PWAPluginOptions } from '../pwa/plugin';
30
+ import { DevStartupPlugin } from './plugins/devStartup';
31
+ import { deepMerge } from './utils/deepMerge';
32
+ import { getApiUrl, getBasePath, getSiteUrl, isDev, isStaticBuild } from './utils/env';
33
33
 
34
34
  // ─────────────────────────────────────────────────────────────────────────
35
35
  // Configuration Options
@@ -6,10 +6,11 @@
6
6
 
7
7
  import { createRequire } from 'module';
8
8
  import { join } from 'path';
9
- import type { PackageDefinition } from './definitions';
9
+
10
+ import { isDev, isStaticBuild } from '../utils/env';
10
11
  import { getPackagesForContext, OPTIONAL_PACKAGES } from './definitions';
11
- import { isStaticBuild, isDev } from '../utils/env';
12
12
 
13
+ import type { PackageDefinition } from './definitions';
13
14
  export interface MissingPackage extends PackageDefinition {
14
15
  /** Why is this package needed? */
15
16
  reason: string;
@@ -4,15 +4,16 @@
4
4
  * Provides auto-installation functionality with user confirmation and progress indication.
5
5
  */
6
6
 
7
- import { execSync, spawn } from 'child_process';
8
- import { createInterface } from 'readline';
9
7
  import chalk from 'chalk';
10
- import consola from 'consola';
8
+ import { execSync, spawn } from 'child_process';
11
9
  import Conf from 'conf';
12
- import type { MissingPackage } from './checker';
13
- import { getMissingPackages } from './checker';
10
+ import consola from 'consola';
11
+ import { createInterface } from 'readline';
12
+
14
13
  import { isCI } from '../utils/env';
14
+ import { getMissingPackages } from './checker';
15
15
 
16
+ import type { MissingPackage } from './checker';
16
17
  // Installer preferences cache
17
18
  const installerCache = new Conf<{
18
19
  autoInstall?: boolean;
@@ -4,14 +4,15 @@
4
4
  * Checks for outdated @djangocfg/* packages and offers to update them.
5
5
  */
6
6
 
7
+ import chalk from 'chalk';
7
8
  import { spawn } from 'child_process';
8
- import { createInterface } from 'readline';
9
+ import Conf from 'conf';
10
+ import consola from 'consola';
9
11
  import { createRequire } from 'module';
10
12
  import { join } from 'path';
11
- import chalk from 'chalk';
12
- import consola from 'consola';
13
- import Conf from 'conf';
13
+ import { createInterface } from 'readline';
14
14
  import semver from 'semver';
15
+
15
16
  import { DJANGOCFG_PACKAGES, PACKAGE_NAME } from '../constants';
16
17
  import { isCI } from '../utils/env';
17
18
  import { detectPackageManager } from './installer';
@@ -6,11 +6,12 @@
6
6
 
7
7
  import type { Compiler } from 'webpack';
8
8
  import chalk from 'chalk';
9
- import { DJANGO_CFG_BANNER } from '../constants';
9
+
10
10
  import { AI_DOCS_HINT } from '../../ai/constants';
11
- import { getCurrentVersion } from '../utils/version';
11
+ import { DJANGO_CFG_BANNER } from '../constants';
12
12
  import { checkAndInstallPackages } from '../packages/installer';
13
13
  import { checkAndUpdatePackages } from '../packages/updater';
14
+ import { getCurrentVersion } from '../utils/version';
14
15
 
15
16
  // Track if startup tasks were already run (persists across HMR)
16
17
  let startupDone = false;
@@ -3,10 +3,11 @@
3
3
  */
4
4
 
5
5
  import chalk from 'chalk';
6
- import semver from 'semver';
7
- import consola from 'consola';
8
6
  import Conf from 'conf';
9
- import { PACKAGE_NAME, VERSION_CACHE_TTL_MS, DJANGOCFG_PACKAGES } from '../constants';
7
+ import consola from 'consola';
8
+ import semver from 'semver';
9
+
10
+ import { DJANGOCFG_PACKAGES, PACKAGE_NAME, VERSION_CACHE_TTL_MS } from '../constants';
10
11
 
11
12
  // Version cache using conf (stores in ~/.config/djangocfg-nextjs/)
12
13
  const versionCache = new Conf<{
@@ -22,6 +22,7 @@
22
22
  */
23
23
 
24
24
  import { NextResponse } from 'next/server';
25
+
25
26
  import type { HealthConfig, HealthResponse } from './types';
26
27
 
27
28
  export function createHealthHandler(config: HealthConfig = {}) {
@@ -21,10 +21,12 @@
21
21
 
22
22
  import { ImageResponse } from 'next/og';
23
23
  import { NextRequest } from 'next/server';
24
- import type { ReactElement } from 'react';
24
+
25
+ import { DefaultTemplate } from './components/DefaultTemplate';
25
26
  import { loadGoogleFonts } from './utils';
26
27
  import { parseOgImageData } from './utils/url';
27
- import { DefaultTemplate } from './components/DefaultTemplate';
28
+
29
+ import type { ReactElement } from 'react';
28
30
  import type { OgImageTemplateProps } from './types';
29
31
 
30
32
  export interface OgImageHandlerConfig {
@@ -5,7 +5,7 @@
5
5
  */
6
6
 
7
7
  import type { Metadata } from 'next';
8
- import { generateOgImageUrl, getAbsoluteOgImageUrl, type OgImageUrlParams } from './url';
8
+ import { generateOgImageUrl, getAbsoluteOgImageUrl, OgImageUrlParams} from './url';
9
9
 
10
10
  /**
11
11
  * Options for generating OG image metadata
@@ -4,8 +4,8 @@
4
4
  * VAPID-based Web Push notifications using web-push library
5
5
  */
6
6
 
7
- import webpush, { PushSubscription } from 'web-push';
8
7
  import { consola } from 'consola';
8
+ import webpush, { PushSubscription } from 'web-push';
9
9
 
10
10
  let vapidConfigured = false;
11
11
 
@@ -5,6 +5,7 @@
5
5
  */
6
6
 
7
7
  import { NextRequest, NextResponse } from 'next/server';
8
+
8
9
  import { configureVapid, sendPushNotification, validateSubscription } from './push';
9
10
 
10
11
  // In-memory storage для demo (в production используй БД)
@@ -6,9 +6,10 @@
6
6
 
7
7
  /// <reference lib="webworker" />
8
8
 
9
- import { defaultCache } from '@serwist/next/worker';
10
9
  import { Serwist } from 'serwist';
11
10
 
11
+ import { defaultCache } from '@serwist/next/worker';
12
+
12
13
  export interface ServiceWorkerOptions {
13
14
  /**
14
15
  * Offline fallback URL
@@ -12,13 +12,13 @@
12
12
  * ```
13
13
  */
14
14
 
15
+ import { mkdir, writeFile } from 'fs/promises';
15
16
  import * as linkinator from 'linkinator';
16
- import type { CheckOptions } from 'linkinator';
17
- import prompts from 'prompts';
18
- import pc from 'picocolors';
19
- import { writeFile, mkdir } from 'fs/promises';
20
17
  import { dirname } from 'path';
18
+ import pc from 'picocolors';
19
+ import prompts from 'prompts';
21
20
 
21
+ import type { CheckOptions } from 'linkinator';
22
22
  export interface CheckLinksOptions {
23
23
  /** Base URL to check */
24
24
  url: string;
@@ -27,8 +27,10 @@
27
27
  */
28
28
 
29
29
  import { NextResponse } from 'next/server';
30
- import type { SitemapGeneratorOptions } from './types';
30
+
31
31
  import { generateSitemapXml, normalizeUrl } from './generator';
32
+
33
+ import type { SitemapGeneratorOptions } from './types';
32
34
  import type { SitemapUrl } from '../types';
33
35
 
34
36
  export function createSitemapHandler(options: SitemapGeneratorOptions) {