@djangocfg/nextjs 2.1.109 → 2.1.111
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/README.md +176 -7
- package/dist/config/index.d.mts +16 -1
- package/dist/config/index.mjs +83 -14
- package/dist/config/index.mjs.map +1 -1
- package/dist/i18n/client.d.mts +123 -0
- package/dist/i18n/client.mjs +104 -0
- package/dist/i18n/client.mjs.map +1 -0
- package/dist/i18n/components.d.mts +22 -0
- package/dist/i18n/components.mjs +133 -0
- package/dist/i18n/components.mjs.map +1 -0
- package/dist/i18n/index.d.mts +17 -0
- package/dist/i18n/index.mjs +269 -0
- package/dist/i18n/index.mjs.map +1 -0
- package/dist/i18n/navigation.d.mts +1095 -0
- package/dist/i18n/navigation.mjs +45 -0
- package/dist/i18n/navigation.mjs.map +1 -0
- package/dist/i18n/plugin.d.mts +41 -0
- package/dist/i18n/plugin.mjs +17 -0
- package/dist/i18n/plugin.mjs.map +1 -0
- package/dist/i18n/provider.d.mts +18 -0
- package/dist/i18n/provider.mjs +54 -0
- package/dist/i18n/provider.mjs.map +1 -0
- package/dist/i18n/proxy.d.mts +40 -0
- package/dist/i18n/proxy.mjs +42 -0
- package/dist/i18n/proxy.mjs.map +1 -0
- package/dist/i18n/request.d.mts +42 -0
- package/dist/i18n/request.mjs +63 -0
- package/dist/i18n/request.mjs.map +1 -0
- package/dist/i18n/routing.d.mts +79 -0
- package/dist/i18n/routing.mjs +33 -0
- package/dist/i18n/routing.mjs.map +1 -0
- package/dist/i18n/server.d.mts +90 -0
- package/dist/i18n/server.mjs +79 -0
- package/dist/i18n/server.mjs.map +1 -0
- package/dist/index.d.mts +3 -1
- package/dist/index.mjs +176 -30
- package/dist/index.mjs.map +1 -1
- package/dist/sitemap/index.d.mts +22 -3
- package/dist/sitemap/index.mjs +92 -15
- package/dist/sitemap/index.mjs.map +1 -1
- package/dist/types-Cy349X20.d.mts +60 -0
- package/package.json +54 -4
- package/src/config/constants.ts +1 -0
- package/src/config/createNextConfig.ts +39 -17
- package/src/i18n/client.ts +221 -0
- package/src/i18n/components/LocaleSwitcher.tsx +124 -0
- package/src/i18n/components/index.ts +7 -0
- package/src/i18n/index.ts +149 -0
- package/src/i18n/navigation.ts +90 -0
- package/src/i18n/plugin.ts +66 -0
- package/src/i18n/provider.tsx +91 -0
- package/src/i18n/proxy.ts +81 -0
- package/src/i18n/request.ts +141 -0
- package/src/i18n/routing.ts +84 -0
- package/src/i18n/server.ts +175 -0
- package/src/i18n/types.ts +88 -0
- package/src/sitemap/generator.ts +84 -9
- package/src/sitemap/index.ts +1 -1
- package/src/sitemap/route.ts +71 -8
- package/src/sitemap/types.ts +9 -0
package/README.md
CHANGED
|
@@ -17,16 +17,16 @@
|
|
|
17
17
|
|
|
18
18
|
## Features
|
|
19
19
|
|
|
20
|
+
- **i18n (Internationalization)** - Full next-intl integration with routing, middleware, and components
|
|
20
21
|
- **Dev Server with Browser Auto-Open** - Cross-platform CLI that works with Turbopack and webpack
|
|
21
22
|
- **Zero-Config PWA** - Progressive Web App out of the box (service worker, offline support, manifest)
|
|
22
23
|
- **Base Next.js Config** - Universal, reusable Next.js configuration factory for monorepos
|
|
23
24
|
- **AI Documentation** - Search DjangoCFG docs via MCP server and CLI
|
|
24
|
-
- **Sitemap Generation** - Dynamic XML sitemap
|
|
25
|
+
- **Sitemap Generation** - Dynamic XML sitemap with i18n hreflang support
|
|
25
26
|
- **Health Checks** - Production-ready health monitoring endpoints
|
|
26
27
|
- **OG Images** - Dynamic Open Graph image generation with templates
|
|
27
28
|
- **Navigation Utilities** - Route definitions, menu generation, and navigation helpers
|
|
28
29
|
- **TypeScript** - Full type safety throughout
|
|
29
|
-
- **Server-Only** - No client-side code, pure server utilities
|
|
30
30
|
|
|
31
31
|
## Installation
|
|
32
32
|
|
|
@@ -314,16 +314,104 @@ curl -X POST http://localhost:3000/api/push/send \
|
|
|
314
314
|
- Ready-to-use route handlers
|
|
315
315
|
- Built-in subscription management
|
|
316
316
|
|
|
317
|
+
### i18n (Internationalization)
|
|
318
|
+
|
|
319
|
+
Full next-intl integration for multilingual Next.js apps.
|
|
320
|
+
|
|
321
|
+
#### 1. Create middleware (proxy.ts)
|
|
322
|
+
|
|
323
|
+
```tsx
|
|
324
|
+
// proxy.ts (or middleware.ts)
|
|
325
|
+
import createMiddleware from 'next-intl/middleware';
|
|
326
|
+
import { routing } from '@djangocfg/nextjs/i18n';
|
|
327
|
+
|
|
328
|
+
export default createMiddleware(routing);
|
|
329
|
+
|
|
330
|
+
export const config = {
|
|
331
|
+
matcher: ['/((?!api|_next|_vercel|.*\\..*).*)',],
|
|
332
|
+
};
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
#### 2. Create i18n request config
|
|
336
|
+
|
|
337
|
+
```tsx
|
|
338
|
+
// i18n/request.ts
|
|
339
|
+
import { getRequestConfig } from 'next-intl/server';
|
|
340
|
+
import { en, ru, ko, mergeTranslations } from '@djangocfg/i18n';
|
|
341
|
+
|
|
342
|
+
const locales = {
|
|
343
|
+
en: mergeTranslations(en, { app: appEn }),
|
|
344
|
+
ru: mergeTranslations(ru, { app: appRu }),
|
|
345
|
+
ko: mergeTranslations(ko, { app: appKo }),
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
export default getRequestConfig(async ({ requestLocale }) => {
|
|
349
|
+
let locale = await requestLocale;
|
|
350
|
+
if (!locale || !(locale in locales)) locale = 'en';
|
|
351
|
+
|
|
352
|
+
return {
|
|
353
|
+
locale,
|
|
354
|
+
messages: locales[locale],
|
|
355
|
+
timeZone: 'UTC',
|
|
356
|
+
};
|
|
357
|
+
});
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
#### 3. Use in layout
|
|
361
|
+
|
|
362
|
+
```tsx
|
|
363
|
+
// app/[locale]/layout.tsx
|
|
364
|
+
import { I18nProvider, routing } from '@djangocfg/nextjs/i18n';
|
|
365
|
+
import { getMessages } from 'next-intl/server';
|
|
366
|
+
|
|
367
|
+
export default async function LocaleLayout({ children, params }) {
|
|
368
|
+
const { locale } = await params;
|
|
369
|
+
const messages = await getMessages();
|
|
370
|
+
|
|
371
|
+
return (
|
|
372
|
+
<I18nProvider locale={locale} messages={messages}>
|
|
373
|
+
{children}
|
|
374
|
+
</I18nProvider>
|
|
375
|
+
);
|
|
376
|
+
}
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
#### 4. Use translations in components
|
|
380
|
+
|
|
381
|
+
```tsx
|
|
382
|
+
'use client';
|
|
383
|
+
import { useTranslations } from 'next-intl';
|
|
384
|
+
|
|
385
|
+
function MyComponent() {
|
|
386
|
+
const t = useTranslations('app');
|
|
387
|
+
return <h1>{t('title')}</h1>;
|
|
388
|
+
}
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
#### Locale Switcher
|
|
392
|
+
|
|
393
|
+
```tsx
|
|
394
|
+
import { LocaleSwitcher } from '@djangocfg/nextjs/i18n/components';
|
|
395
|
+
|
|
396
|
+
<LocaleSwitcher variant="outline" size="sm" />
|
|
397
|
+
```
|
|
398
|
+
|
|
317
399
|
### Sitemap Generation
|
|
318
400
|
|
|
319
|
-
Generate dynamic XML sitemaps
|
|
401
|
+
Generate dynamic XML sitemaps with i18n hreflang support:
|
|
320
402
|
|
|
321
403
|
```tsx
|
|
322
|
-
// app/sitemap.ts
|
|
404
|
+
// app/sitemap.xml/route.ts
|
|
323
405
|
import { createSitemapHandler } from '@djangocfg/nextjs/sitemap';
|
|
406
|
+
import { routing } from '@djangocfg/nextjs/i18n';
|
|
324
407
|
|
|
325
|
-
export
|
|
408
|
+
export const GET = createSitemapHandler({
|
|
326
409
|
siteUrl: 'https://example.com',
|
|
410
|
+
// i18n support with hreflang tags
|
|
411
|
+
i18n: {
|
|
412
|
+
locales: routing.locales,
|
|
413
|
+
defaultLocale: routing.defaultLocale,
|
|
414
|
+
},
|
|
327
415
|
staticPages: [
|
|
328
416
|
{ loc: '/', changefreq: 'daily', priority: 1.0 },
|
|
329
417
|
{ loc: '/about', changefreq: 'monthly', priority: 0.8 },
|
|
@@ -340,6 +428,20 @@ export default createSitemapHandler({
|
|
|
340
428
|
});
|
|
341
429
|
```
|
|
342
430
|
|
|
431
|
+
**Generated XML with hreflang:**
|
|
432
|
+
|
|
433
|
+
```xml
|
|
434
|
+
<url>
|
|
435
|
+
<loc>https://example.com/en/about</loc>
|
|
436
|
+
<xhtml:link rel="alternate" hreflang="en" href="https://example.com/en/about"/>
|
|
437
|
+
<xhtml:link rel="alternate" hreflang="ru" href="https://example.com/ru/about"/>
|
|
438
|
+
<xhtml:link rel="alternate" hreflang="ko" href="https://example.com/ko/about"/>
|
|
439
|
+
<xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/en/about"/>
|
|
440
|
+
<changefreq>monthly</changefreq>
|
|
441
|
+
<priority>0.8</priority>
|
|
442
|
+
</url>
|
|
443
|
+
```
|
|
444
|
+
|
|
343
445
|
### Health Check Endpoint
|
|
344
446
|
|
|
345
447
|
Create a health monitoring endpoint:
|
|
@@ -438,13 +540,17 @@ import { RedirectPage } from '@djangocfg/layouts/components/RedirectPage';
|
|
|
438
540
|
| Path | Description |
|
|
439
541
|
|------|-------------|
|
|
440
542
|
| `@djangocfg/nextjs` | Main exports (all modules) |
|
|
543
|
+
| `@djangocfg/nextjs/i18n` | i18n routing, provider, utilities |
|
|
544
|
+
| `@djangocfg/nextjs/i18n/server` | Server-side i18n utilities |
|
|
545
|
+
| `@djangocfg/nextjs/i18n/client` | Client-side i18n hooks |
|
|
546
|
+
| `@djangocfg/nextjs/i18n/components` | LocaleSwitcher and i18n components |
|
|
441
547
|
| `@djangocfg/nextjs/ai` | AI documentation search and MCP config |
|
|
442
548
|
| `@djangocfg/nextjs/config` | Base Next.js configuration factory |
|
|
443
549
|
| `@djangocfg/nextjs/pwa` | PWA client utilities (service worker registration, push subscriptions) |
|
|
444
550
|
| `@djangocfg/nextjs/pwa/worker` | Service worker creation helpers |
|
|
445
551
|
| `@djangocfg/nextjs/pwa/server` | Server-side push notification utilities |
|
|
446
552
|
| `@djangocfg/nextjs/pwa/server/routes` | Ready-to-use API route handlers for push |
|
|
447
|
-
| `@djangocfg/nextjs/sitemap` | Sitemap generation
|
|
553
|
+
| `@djangocfg/nextjs/sitemap` | Sitemap generation with i18n hreflang support |
|
|
448
554
|
| `@djangocfg/nextjs/health` | Health check handlers |
|
|
449
555
|
| `@djangocfg/nextjs/og-image` | OG image generation |
|
|
450
556
|
| `@djangocfg/nextjs/og-image/utils` | OG image URL and metadata utilities |
|
|
@@ -478,11 +584,64 @@ createBaseNextConfig({
|
|
|
478
584
|
- Standard transpile packages for monorepo
|
|
479
585
|
- Type-safe configuration merging
|
|
480
586
|
|
|
587
|
+
### i18n
|
|
588
|
+
|
|
589
|
+
#### `routing`
|
|
590
|
+
|
|
591
|
+
Default routing configuration with locales `['en', 'ru', 'ko']` and default locale `'en'`.
|
|
592
|
+
|
|
593
|
+
```tsx
|
|
594
|
+
import { routing } from '@djangocfg/nextjs/i18n';
|
|
595
|
+
|
|
596
|
+
routing.locales // ['en', 'ru', 'ko']
|
|
597
|
+
routing.defaultLocale // 'en'
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
#### `createRouting(config?)`
|
|
601
|
+
|
|
602
|
+
Create custom routing configuration.
|
|
603
|
+
|
|
604
|
+
```tsx
|
|
605
|
+
import { createRouting } from '@djangocfg/nextjs/i18n';
|
|
606
|
+
|
|
607
|
+
const routing = createRouting({
|
|
608
|
+
locales: ['en', 'de', 'fr'],
|
|
609
|
+
defaultLocale: 'en',
|
|
610
|
+
localePrefix: 'always', // 'always' | 'as-needed' | 'never'
|
|
611
|
+
});
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
#### `I18nProvider`
|
|
615
|
+
|
|
616
|
+
Provider component for next-intl integration.
|
|
617
|
+
|
|
618
|
+
```tsx
|
|
619
|
+
import { I18nProvider } from '@djangocfg/nextjs/i18n';
|
|
620
|
+
|
|
621
|
+
<I18nProvider locale="en" messages={messages}>
|
|
622
|
+
{children}
|
|
623
|
+
</I18nProvider>
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
#### `LocaleSwitcher`
|
|
627
|
+
|
|
628
|
+
Ready-to-use locale switcher component.
|
|
629
|
+
|
|
630
|
+
```tsx
|
|
631
|
+
import { LocaleSwitcher } from '@djangocfg/nextjs/i18n/components';
|
|
632
|
+
|
|
633
|
+
<LocaleSwitcher
|
|
634
|
+
variant="outline"
|
|
635
|
+
size="sm"
|
|
636
|
+
className="w-full"
|
|
637
|
+
/>
|
|
638
|
+
```
|
|
639
|
+
|
|
481
640
|
### Sitemap
|
|
482
641
|
|
|
483
642
|
#### `createSitemapHandler(options)`
|
|
484
643
|
|
|
485
|
-
Creates a Next.js route handler for sitemap generation.
|
|
644
|
+
Creates a Next.js route handler for sitemap generation with optional i18n support.
|
|
486
645
|
|
|
487
646
|
```tsx
|
|
488
647
|
createSitemapHandler({
|
|
@@ -490,9 +649,19 @@ createSitemapHandler({
|
|
|
490
649
|
staticPages?: SitemapUrl[];
|
|
491
650
|
dynamicPages?: SitemapUrl[] | (() => Promise<SitemapUrl[]>);
|
|
492
651
|
cacheControl?: string;
|
|
652
|
+
// i18n support
|
|
653
|
+
i18n?: {
|
|
654
|
+
locales: string[]; // e.g., ['en', 'ru', 'ko']
|
|
655
|
+
defaultLocale: string; // e.g., 'en'
|
|
656
|
+
};
|
|
493
657
|
})
|
|
494
658
|
```
|
|
495
659
|
|
|
660
|
+
When `i18n` is provided:
|
|
661
|
+
- URLs are expanded for each locale (e.g., `/about` → `/en/about`, `/ru/about`, `/ko/about`)
|
|
662
|
+
- `xhtml:link` elements with `hreflang` are added for SEO
|
|
663
|
+
- `x-default` points to the default locale
|
|
664
|
+
|
|
496
665
|
### Health
|
|
497
666
|
|
|
498
667
|
#### `createHealthHandler(config)`
|
package/dist/config/index.d.mts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { NextConfig } from 'next';
|
|
2
2
|
import { Configuration, Compiler } from 'webpack';
|
|
3
|
+
import { a as I18nPluginOptions } from '../types-Cy349X20.mjs';
|
|
3
4
|
import { P as PWAPluginOptions } from '../plugin-DuRJ_Jq6.mjs';
|
|
4
5
|
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';
|
|
6
|
+
import '@djangocfg/i18n';
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* Base Next.js Configuration Factory
|
|
@@ -54,6 +56,19 @@ interface BaseNextConfigOptions {
|
|
|
54
56
|
* @default { enabled: true (in production), disable: true (in development) }
|
|
55
57
|
*/
|
|
56
58
|
pwa?: PWAPluginOptions | false;
|
|
59
|
+
/**
|
|
60
|
+
* i18n configuration options for internationalization
|
|
61
|
+
* Enables URL-based locale routing (e.g., /en/about, /ru/about)
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* i18n: {
|
|
66
|
+
* locales: ['en', 'ru', 'ko'],
|
|
67
|
+
* defaultLocale: 'en',
|
|
68
|
+
* }
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
i18n?: I18nPluginOptions;
|
|
57
72
|
/** Turbopack configuration (Next.js 16+ default bundler) */
|
|
58
73
|
turbopack?: NextConfig['turbopack'];
|
|
59
74
|
/** Custom webpack configuration function (called after base webpack logic) */
|
|
@@ -89,7 +104,7 @@ declare function createBaseNextConfig(options?: BaseNextConfigOptions): NextConf
|
|
|
89
104
|
declare const PACKAGE_NAME = "@djangocfg/nextjs";
|
|
90
105
|
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";
|
|
91
106
|
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"];
|
|
92
|
-
declare const DEFAULT_TRANSPILE_PACKAGES: readonly ["@djangocfg/ui-core", "@djangocfg/ui-nextjs", "@djangocfg/layouts", "@djangocfg/ui-tools", "@djangocfg/api", "@djangocfg/centrifugo"];
|
|
107
|
+
declare const DEFAULT_TRANSPILE_PACKAGES: readonly ["@djangocfg/i18n", "@djangocfg/ui-core", "@djangocfg/ui-nextjs", "@djangocfg/layouts", "@djangocfg/ui-tools", "@djangocfg/api", "@djangocfg/centrifugo"];
|
|
93
108
|
declare const DEFAULT_OPTIMIZE_PACKAGES: readonly ["@djangocfg/ui-core", "@djangocfg/ui-nextjs", "@djangocfg/layouts", "lucide-react", "recharts"];
|
|
94
109
|
|
|
95
110
|
/**
|
package/dist/config/index.mjs
CHANGED
|
@@ -14,7 +14,7 @@ var require_package = __commonJS({
|
|
|
14
14
|
"package.json"(exports, module) {
|
|
15
15
|
module.exports = {
|
|
16
16
|
name: "@djangocfg/nextjs",
|
|
17
|
-
version: "2.1.
|
|
17
|
+
version: "2.1.111",
|
|
18
18
|
description: "Next.js server utilities: sitemap, health, OG images, contact forms, navigation, config",
|
|
19
19
|
keywords: [
|
|
20
20
|
"nextjs",
|
|
@@ -112,6 +112,46 @@ var require_package = __commonJS({
|
|
|
112
112
|
types: "./dist/pwa/server/routes.d.mts",
|
|
113
113
|
import: "./dist/pwa/server/routes.mjs",
|
|
114
114
|
default: "./dist/pwa/server/routes.mjs"
|
|
115
|
+
},
|
|
116
|
+
"./i18n": {
|
|
117
|
+
types: "./dist/i18n/index.d.mts",
|
|
118
|
+
import: "./dist/i18n/index.mjs",
|
|
119
|
+
default: "./dist/i18n/index.mjs"
|
|
120
|
+
},
|
|
121
|
+
"./i18n/server": {
|
|
122
|
+
types: "./dist/i18n/server.d.mts",
|
|
123
|
+
import: "./dist/i18n/server.mjs",
|
|
124
|
+
default: "./dist/i18n/server.mjs"
|
|
125
|
+
},
|
|
126
|
+
"./i18n/client": {
|
|
127
|
+
types: "./dist/i18n/client.d.mts",
|
|
128
|
+
import: "./dist/i18n/client.mjs",
|
|
129
|
+
default: "./dist/i18n/client.mjs"
|
|
130
|
+
},
|
|
131
|
+
"./i18n/proxy": {
|
|
132
|
+
types: "./dist/i18n/proxy.d.mts",
|
|
133
|
+
import: "./dist/i18n/proxy.mjs",
|
|
134
|
+
default: "./dist/i18n/proxy.mjs"
|
|
135
|
+
},
|
|
136
|
+
"./i18n/navigation": {
|
|
137
|
+
types: "./dist/i18n/navigation.d.mts",
|
|
138
|
+
import: "./dist/i18n/navigation.mjs",
|
|
139
|
+
default: "./dist/i18n/navigation.mjs"
|
|
140
|
+
},
|
|
141
|
+
"./i18n/routing": {
|
|
142
|
+
types: "./dist/i18n/routing.d.mts",
|
|
143
|
+
import: "./dist/i18n/routing.mjs",
|
|
144
|
+
default: "./dist/i18n/routing.mjs"
|
|
145
|
+
},
|
|
146
|
+
"./i18n/request": {
|
|
147
|
+
types: "./dist/i18n/request.d.mts",
|
|
148
|
+
import: "./dist/i18n/request.mjs",
|
|
149
|
+
default: "./dist/i18n/request.mjs"
|
|
150
|
+
},
|
|
151
|
+
"./i18n/components": {
|
|
152
|
+
types: "./dist/i18n/components.d.mts",
|
|
153
|
+
import: "./dist/i18n/components.mjs",
|
|
154
|
+
default: "./dist/i18n/components.mjs"
|
|
115
155
|
}
|
|
116
156
|
},
|
|
117
157
|
files: [
|
|
@@ -134,19 +174,29 @@ var require_package = __commonJS({
|
|
|
134
174
|
pwa: "tsx src/pwa/cli.ts"
|
|
135
175
|
},
|
|
136
176
|
peerDependencies: {
|
|
177
|
+
"@djangocfg/i18n": "workspace:*",
|
|
178
|
+
"@djangocfg/ui-core": "workspace:*",
|
|
137
179
|
next: "^16.0.10"
|
|
138
180
|
},
|
|
181
|
+
peerDependenciesMeta: {
|
|
182
|
+
"@djangocfg/ui-core": {
|
|
183
|
+
optional: true
|
|
184
|
+
}
|
|
185
|
+
},
|
|
139
186
|
dependencies: {
|
|
140
187
|
"@serwist/next": "^9.2.3",
|
|
141
188
|
"@serwist/sw": "^9.2.3",
|
|
142
189
|
chalk: "^5.3.0",
|
|
143
190
|
conf: "^15.0.2",
|
|
144
191
|
consola: "^3.4.2",
|
|
192
|
+
"next-intl": "^4.1.0",
|
|
145
193
|
semver: "^7.7.3",
|
|
146
194
|
serwist: "^9.2.3",
|
|
147
195
|
"web-push": "^3.6.7"
|
|
148
196
|
},
|
|
149
197
|
devDependencies: {
|
|
198
|
+
"@djangocfg/i18n": "workspace:*",
|
|
199
|
+
"@djangocfg/ui-core": "workspace:*",
|
|
150
200
|
"@djangocfg/imgai": "workspace:*",
|
|
151
201
|
"@djangocfg/layouts": "workspace:*",
|
|
152
202
|
"@djangocfg/typescript-config": "workspace:*",
|
|
@@ -170,6 +220,18 @@ var require_package = __commonJS({
|
|
|
170
220
|
}
|
|
171
221
|
});
|
|
172
222
|
|
|
223
|
+
// src/i18n/plugin.ts
|
|
224
|
+
import createNextIntlPlugin from "next-intl/plugin";
|
|
225
|
+
function createI18nPlugin(options) {
|
|
226
|
+
const requestConfigPath = options?.requestConfig ?? "./i18n/request.ts";
|
|
227
|
+
const withNextIntl = createNextIntlPlugin(requestConfigPath);
|
|
228
|
+
return withNextIntl;
|
|
229
|
+
}
|
|
230
|
+
function withI18n(config, options) {
|
|
231
|
+
const plugin = createI18nPlugin(options);
|
|
232
|
+
return plugin(config);
|
|
233
|
+
}
|
|
234
|
+
|
|
173
235
|
// src/pwa/plugin.ts
|
|
174
236
|
import { consola } from "consola";
|
|
175
237
|
function withPWA(nextConfig, options = {}) {
|
|
@@ -226,6 +288,7 @@ var DJANGOCFG_PACKAGES = [
|
|
|
226
288
|
"@djangocfg/typescript-config"
|
|
227
289
|
];
|
|
228
290
|
var DEFAULT_TRANSPILE_PACKAGES = [
|
|
291
|
+
"@djangocfg/i18n",
|
|
229
292
|
"@djangocfg/ui-core",
|
|
230
293
|
"@djangocfg/ui-nextjs",
|
|
231
294
|
"@djangocfg/layouts",
|
|
@@ -1379,20 +1442,26 @@ function createBaseNextConfig(options = {}) {
|
|
|
1379
1442
|
return config;
|
|
1380
1443
|
}
|
|
1381
1444
|
};
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1445
|
+
const {
|
|
1446
|
+
i18n: i18nOptions,
|
|
1447
|
+
pwa: pwaOptions,
|
|
1448
|
+
optimizePackageImports,
|
|
1449
|
+
isDefaultCfgAdmin,
|
|
1450
|
+
checkUpdates,
|
|
1451
|
+
autoUpdate,
|
|
1452
|
+
forceCheckWorkspace,
|
|
1453
|
+
checkPackages: checkPackages2,
|
|
1454
|
+
autoInstall,
|
|
1455
|
+
allowIframeFrom,
|
|
1456
|
+
...nextConfigOptions
|
|
1457
|
+
} = options;
|
|
1458
|
+
let finalConfig = deepMerge(baseConfig, nextConfigOptions);
|
|
1459
|
+
if (pwaOptions) {
|
|
1460
|
+
finalConfig = withPWA(finalConfig, pwaOptions);
|
|
1461
|
+
}
|
|
1462
|
+
if (i18nOptions) {
|
|
1463
|
+
finalConfig = withI18n(finalConfig, i18nOptions);
|
|
1394
1464
|
}
|
|
1395
|
-
delete finalConfig.pwa;
|
|
1396
1465
|
return finalConfig;
|
|
1397
1466
|
}
|
|
1398
1467
|
export {
|