@djangocfg/nextjs 2.1.164 → 2.1.166

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.164",
3
+ "version": "2.1.166",
4
4
  "description": "Next.js server utilities: sitemap, health, OG images, contact forms, navigation, config",
5
5
  "keywords": [
6
6
  "nextjs",
@@ -148,8 +148,8 @@
148
148
  "ai-docs": "tsx src/ai/cli.ts"
149
149
  },
150
150
  "peerDependencies": {
151
- "@djangocfg/i18n": "^2.1.164",
152
- "@djangocfg/ui-core": "^2.1.164",
151
+ "@djangocfg/i18n": "^2.1.166",
152
+ "@djangocfg/ui-core": "^2.1.166",
153
153
  "next": "^16.0.10"
154
154
  },
155
155
  "peerDependenciesMeta": {
@@ -168,11 +168,11 @@
168
168
  "serwist": "^9.2.3"
169
169
  },
170
170
  "devDependencies": {
171
- "@djangocfg/i18n": "^2.1.164",
172
- "@djangocfg/ui-core": "^2.1.164",
173
- "@djangocfg/imgai": "^2.1.164",
174
- "@djangocfg/layouts": "^2.1.164",
175
- "@djangocfg/typescript-config": "^2.1.164",
171
+ "@djangocfg/i18n": "^2.1.166",
172
+ "@djangocfg/ui-core": "^2.1.166",
173
+ "@djangocfg/imgai": "^2.1.166",
174
+ "@djangocfg/layouts": "^2.1.166",
175
+ "@djangocfg/typescript-config": "^2.1.166",
176
176
  "@types/node": "^24.7.2",
177
177
  "@types/react": "19.2.2",
178
178
  "@types/react-dom": "19.2.1",
@@ -26,8 +26,12 @@ import {
26
26
  } from 'next-intl';
27
27
 
28
28
  import { usePathname, useRouter } from './navigation';
29
+ import { I18nProvider, NextIntlProvider } from './provider';
29
30
  import { routing } from './routing';
30
31
 
32
+ // Re-export providers
33
+ export { I18nProvider, NextIntlProvider };
34
+
31
35
  import type { LocaleCode } from './types';
32
36
 
33
37
  // ─────────────────────────────────────────────────────────────────────────────
package/src/i18n/index.ts CHANGED
@@ -1,72 +1,34 @@
1
1
  /**
2
2
  * i18n Module for Next.js App Router
3
3
  *
4
- * Complete internationalization solution integrating next-intl with @djangocfg/i18n
5
- *
6
- * @example Setup
7
- * ```ts
8
- * // 1. Create i18n/routing.ts
9
- * import { createRouting } from '@djangocfg/nextjs/i18n';
10
- *
11
- * export const routing = createRouting({
12
- * locales: ['en', 'ru', 'ko'],
13
- * defaultLocale: 'en',
14
- * });
15
- *
16
- * // 2. Create i18n/request.ts
17
- * import { createRequestConfig } from '@djangocfg/nextjs/i18n';
18
- * import { leadsI18n } from '@djangocfg/ext-leads';
19
- *
20
- * export default createRequestConfig({
21
- * extensions: [leadsI18n],
22
- * });
23
- *
24
- * // 3. Create i18n/navigation.ts
25
- * import { createNavigation } from '@djangocfg/nextjs/i18n';
26
- * import { routing } from './routing';
27
- *
28
- * export const { Link, redirect, usePathname, useRouter } = createNavigation(routing);
29
- *
30
- * // 4. Create proxy.ts
31
- * import { createProxy } from '@djangocfg/nextjs/i18n';
32
- * import { routing } from './i18n/routing';
33
- *
34
- * export default createProxy(routing);
35
- * export const config = { matcher: ['/((?!api|_next|.*\\..*).*)'] };
36
- *
37
- * // 5. Update next.config.ts
38
- * import { createBaseNextConfig } from '@djangocfg/nextjs/config';
39
- *
40
- * export default createBaseNextConfig({
41
- * i18n: {
42
- * locales: ['en', 'ru', 'ko'],
43
- * defaultLocale: 'en',
44
- * },
45
- * });
46
- *
47
- * // 6. Create app/[locale]/layout.tsx
48
- * import { I18nProvider } from '@djangocfg/nextjs/i18n';
49
- * import { getMessages, getLocaleFromParams } from '@djangocfg/nextjs/i18n/server';
50
- *
51
- * export default async function LocaleLayout({ children, params }) {
52
- * const locale = await getLocaleFromParams(params);
53
- * const messages = await getMessages();
54
- *
55
- * return (
56
- * <html lang={locale}>
57
- * <body>
58
- * <I18nProvider locale={locale} messages={messages}>
59
- * {children}
60
- * </I18nProvider>
61
- * </body>
62
- * </html>
63
- * );
64
- * }
4
+ * IMPORTANT: This module only exports types and non-React utilities.
5
+ * For React components and hooks, use subpath imports:
6
+ *
7
+ * - `@djangocfg/nextjs/i18n/client` - I18nProvider, hooks (use client)
8
+ * - `@djangocfg/nextjs/i18n/routing` - routing, createRouting, generateLocaleParams
9
+ * - `@djangocfg/nextjs/i18n/server` - getMessages, getLocale
10
+ * - `@djangocfg/nextjs/i18n/navigation` - Link, redirect, usePathname, useRouter
11
+ * - `@djangocfg/nextjs/i18n/proxy` - createProxy
12
+ * - `@djangocfg/nextjs/i18n/request` - createRequestConfig
13
+ * - `@djangocfg/nextjs/i18n/components` - LocaleSwitcher
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * // app/[locale]/layout.tsx
18
+ * import { I18nProvider } from '@djangocfg/nextjs/i18n/client';
19
+ * import { routing, generateLocaleParams } from '@djangocfg/nextjs/i18n/routing';
20
+ * import { getMessages } from 'next-intl/server';
21
+ *
22
+ * // proxy.ts
23
+ * import { routing } from '@djangocfg/nextjs/i18n/routing';
24
+ *
25
+ * // i18n/request.ts
26
+ * import { createRequestConfig } from '@djangocfg/nextjs/i18n/request';
65
27
  * ```
66
28
  */
67
29
 
68
30
  // ─────────────────────────────────────────────────────────────────────────────
69
- // Types
31
+ // Types only - safe to import anywhere
70
32
  // ─────────────────────────────────────────────────────────────────────────────
71
33
 
72
34
  export type {
@@ -83,67 +45,6 @@ export type {
83
45
  I18nTranslations,
84
46
  } from './types';
85
47
 
86
- // ─────────────────────────────────────────────────────────────────────────────
87
- // Routing
88
- // ─────────────────────────────────────────────────────────────────────────────
89
-
90
- export {
91
- createRouting,
92
- routing,
93
- isValidLocale,
94
- getLocaleFromParams,
95
- generateLocaleParams,
96
- } from './routing';
97
-
98
- // ─────────────────────────────────────────────────────────────────────────────
99
- // Navigation
100
- // ─────────────────────────────────────────────────────────────────────────────
101
-
102
- export {
103
- createNavigation,
104
- createNavigationFromConfig,
105
- Link,
106
- redirect,
107
- usePathname,
108
- useRouter,
109
- getPathname,
110
- } from './navigation';
111
-
112
48
  export type { LinkProps } from './navigation';
113
-
114
- // ─────────────────────────────────────────────────────────────────────────────
115
- // Provider
116
- // ─────────────────────────────────────────────────────────────────────────────
117
-
118
- export { I18nProvider, NextIntlProvider } from './provider';
119
-
120
- // ─────────────────────────────────────────────────────────────────────────────
121
- // Request Config (for i18n/request.ts)
122
- // ─────────────────────────────────────────────────────────────────────────────
123
-
124
- export {
125
- createRequestConfig,
126
- type RequestConfigOptions,
127
- } from './request';
128
-
129
- // ─────────────────────────────────────────────────────────────────────────────
130
- // Proxy (Next.js 16+)
131
- // ─────────────────────────────────────────────────────────────────────────────
132
-
133
- export {
134
- createProxy,
135
- createProxyFromConfig,
136
- proxy,
137
- config as proxyConfig,
138
- } from './proxy';
139
-
140
- // ─────────────────────────────────────────────────────────────────────────────
141
- // Plugin (for next.config.ts) - import from '@djangocfg/nextjs/i18n/plugin'
142
- // Not exported here to avoid SWC plugin issues with Turbopack
143
- // ─────────────────────────────────────────────────────────────────────────────
144
-
145
- // ─────────────────────────────────────────────────────────────────────────────
146
- // Components
147
- // ─────────────────────────────────────────────────────────────────────────────
148
-
149
- export { LocaleSwitcher, type LocaleSwitcherProps } from './components';
49
+ export type { RequestConfigOptions } from './request';
50
+ export type { LocaleSwitcherProps } from './components';