@intlayer/next-i18next 9.5.1 → 9.5.3
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 +1 -1
- package/dist/cjs/appWithTranslation.cjs +2 -2
- package/dist/cjs/appWithTranslation.cjs.map +1 -1
- package/dist/cjs/warnUnsupported.cjs +28 -0
- package/dist/cjs/warnUnsupported.cjs.map +1 -0
- package/dist/esm/appWithTranslation.mjs +1 -1
- package/dist/esm/appWithTranslation.mjs.map +1 -1
- package/dist/esm/warnUnsupported.mjs +27 -0
- package/dist/esm/warnUnsupported.mjs.map +1 -0
- package/dist/types/warnUnsupported.d.ts +18 -0
- package/dist/types/warnUnsupported.d.ts.map +1 -0
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -328,4 +328,4 @@ Contribute on [GitHub](https://github.com/aymericzip/intlayer), [GitLab](https:/
|
|
|
328
328
|
|
|
329
329
|
If you like Intlayer, give us a ⭐ on GitHub. It helps others discover the project! [See why GitHub Stars matter](https://github.com/aymericzip/intlayer/blob/main/CONTRIBUTING.md#why-github-stars-matter-).
|
|
330
330
|
|
|
331
|
-
[](https://
|
|
331
|
+
[](https://star-history.com/#aymericzip/intlayer&Date)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
let
|
|
2
|
+
let next_intlayer = require("next-intlayer");
|
|
3
3
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
4
|
|
|
5
5
|
//#region src/appWithTranslation.tsx
|
|
@@ -17,7 +17,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
17
17
|
const appWithTranslation = (WrappedApp, _configOverride) => {
|
|
18
18
|
const AppWithTranslation = (props) => {
|
|
19
19
|
const locale = props.pageProps?._nextI18Next?.initialLocale ?? props.router?.locale;
|
|
20
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
20
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(next_intlayer.IntlayerProvider, {
|
|
21
21
|
locale,
|
|
22
22
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WrappedApp, { ...props })
|
|
23
23
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appWithTranslation.cjs","names":["IntlayerProvider"],"sources":["../../src/appWithTranslation.tsx"],"sourcesContent":["import type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport type { appWithTranslation as _appWithTranslation } from 'next-i18next/pages';\nimport
|
|
1
|
+
{"version":3,"file":"appWithTranslation.cjs","names":["IntlayerProvider"],"sources":["../../src/appWithTranslation.tsx"],"sourcesContent":["import type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport type { appWithTranslation as _appWithTranslation } from 'next-i18next/pages';\nimport { IntlayerProvider } from 'next-intlayer';\nimport type * as React from 'react';\n\n/**\n * Drop-in replacement for next-i18next's `appWithTranslation` HOC.\n *\n * Wraps the Next.js `App` component in `IntlayerProvider` and passes the\n * active locale from `_nextI18Next.initialLocale` or the Next.js router.\n *\n * @example\n * ```tsx\n * export default appWithTranslation(MyApp);\n * ```\n */\nexport const appWithTranslation: typeof _appWithTranslation = (\n WrappedApp,\n _configOverride?\n) => {\n const AppWithTranslation = (\n props: React.ComponentProps<typeof WrappedApp> & {\n pageProps: {\n _nextI18Next?: { initialLocale?: string };\n [key: string]: unknown;\n };\n router?: { locale?: string };\n }\n ) => {\n const locale: string | undefined =\n props.pageProps?._nextI18Next?.initialLocale ?? props.router?.locale;\n\n return (\n <IntlayerProvider locale={locale as LocalesValues}>\n <WrappedApp {...props} />\n </IntlayerProvider>\n );\n };\n\n AppWithTranslation.displayName = `appWithTranslation(${\n WrappedApp.displayName ?? WrappedApp.name ?? 'App'\n })`;\n\n return AppWithTranslation as unknown as ReturnType<\n typeof _appWithTranslation\n >;\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,MAAa,sBACX,YACA,oBACG;CACH,MAAM,sBACJ,UAOG;EACH,MAAM,SACJ,MAAM,WAAW,cAAc,iBAAiB,MAAM,QAAQ;EAEhE,OACE,2CAACA,gCAAD;GAA0B;aACxB,2CAAC,YAAD,EAAY,GAAI,MAAQ;EACR;CAEtB;CAEA,mBAAmB,cAAc,sBAC/B,WAAW,eAAe,WAAW,QAAQ,MAC9C;CAED,OAAO;AAGT"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
let _intlayer_config_built = require("@intlayer/config/built");
|
|
3
|
+
let _intlayer_config_colors = require("@intlayer/config/colors");
|
|
4
|
+
let _intlayer_config_logger = require("@intlayer/config/logger");
|
|
5
|
+
|
|
6
|
+
//#region src/warnUnsupported.ts
|
|
7
|
+
/**
|
|
8
|
+
* Warns, in development only, that a `next-i18next` API is a no-op under the
|
|
9
|
+
* intlayer adapter.
|
|
10
|
+
*
|
|
11
|
+
* The `NODE_ENV` check is what keeps `@intlayer/config`'s logger and its ANSI
|
|
12
|
+
* colour table — around 6 KB — out of production bundles: with the branch
|
|
13
|
+
* folded away nothing references the imports any more and they are shaken out.
|
|
14
|
+
* That only works while `process.env.NODE_ENV` survives this package's own
|
|
15
|
+
* build and reaches the consuming app's bundler, which is why `tsdown.config.ts`
|
|
16
|
+
* pins `platform: 'neutral'`.
|
|
17
|
+
*
|
|
18
|
+
* @param api - Name of the shimmed `next-i18next` export, e.g. `serverSideTranslations`.
|
|
19
|
+
* @param reason - What the developer should do instead.
|
|
20
|
+
*/
|
|
21
|
+
const warnUnsupported = (api, reason) => {
|
|
22
|
+
if (process.env.NODE_ENV !== "development") return;
|
|
23
|
+
(0, _intlayer_config_logger.getAppLogger)({ log: _intlayer_config_built.log })(`${(0, _intlayer_config_logger.colorize)(api, _intlayer_config_colors.CYAN)} ${reason}`);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
exports.warnUnsupported = warnUnsupported;
|
|
28
|
+
//# sourceMappingURL=warnUnsupported.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warnUnsupported.cjs","names":["colorize","CYAN"],"sources":["../../src/warnUnsupported.ts"],"sourcesContent":["import { log } from '@intlayer/config/built';\nimport { CYAN } from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\n\n/**\n * Warns, in development only, that a `next-i18next` API is a no-op under the\n * intlayer adapter.\n *\n * The `NODE_ENV` check is what keeps `@intlayer/config`'s logger and its ANSI\n * colour table — around 6 KB — out of production bundles: with the branch\n * folded away nothing references the imports any more and they are shaken out.\n * That only works while `process.env.NODE_ENV` survives this package's own\n * build and reaches the consuming app's bundler, which is why `tsdown.config.ts`\n * pins `platform: 'neutral'`.\n *\n * @param api - Name of the shimmed `next-i18next` export, e.g. `serverSideTranslations`.\n * @param reason - What the developer should do instead.\n */\nexport const warnUnsupported = (api: string, reason: string): void => {\n if (process.env.NODE_ENV !== 'development') return;\n\n getAppLogger({ log })(`${colorize(api, CYAN)} ${reason}`);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkBA,MAAa,mBAAmB,KAAa,WAAyB;CACpE,IAAI,QAAQ,IAAI,aAAa,eAAe;CAE5C,0CAAa,EAAE,gCAAI,CAAC,CAAC,CAAC,OAAGA,kCAAS,KAAKC,4BAAI,EAAE,GAAG,QAAQ;AAC1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appWithTranslation.mjs","names":[],"sources":["../../src/appWithTranslation.tsx"],"sourcesContent":["import type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport type { appWithTranslation as _appWithTranslation } from 'next-i18next/pages';\nimport
|
|
1
|
+
{"version":3,"file":"appWithTranslation.mjs","names":[],"sources":["../../src/appWithTranslation.tsx"],"sourcesContent":["import type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport type { appWithTranslation as _appWithTranslation } from 'next-i18next/pages';\nimport { IntlayerProvider } from 'next-intlayer';\nimport type * as React from 'react';\n\n/**\n * Drop-in replacement for next-i18next's `appWithTranslation` HOC.\n *\n * Wraps the Next.js `App` component in `IntlayerProvider` and passes the\n * active locale from `_nextI18Next.initialLocale` or the Next.js router.\n *\n * @example\n * ```tsx\n * export default appWithTranslation(MyApp);\n * ```\n */\nexport const appWithTranslation: typeof _appWithTranslation = (\n WrappedApp,\n _configOverride?\n) => {\n const AppWithTranslation = (\n props: React.ComponentProps<typeof WrappedApp> & {\n pageProps: {\n _nextI18Next?: { initialLocale?: string };\n [key: string]: unknown;\n };\n router?: { locale?: string };\n }\n ) => {\n const locale: string | undefined =\n props.pageProps?._nextI18Next?.initialLocale ?? props.router?.locale;\n\n return (\n <IntlayerProvider locale={locale as LocalesValues}>\n <WrappedApp {...props} />\n </IntlayerProvider>\n );\n };\n\n AppWithTranslation.displayName = `appWithTranslation(${\n WrappedApp.displayName ?? WrappedApp.name ?? 'App'\n })`;\n\n return AppWithTranslation as unknown as ReturnType<\n typeof _appWithTranslation\n >;\n};\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,MAAa,sBACX,YACA,oBACG;CACH,MAAM,sBACJ,UAOG;EACH,MAAM,SACJ,MAAM,WAAW,cAAc,iBAAiB,MAAM,QAAQ;EAEhE,OACE,oBAAC,kBAAD;GAA0B;aACxB,oBAAC,YAAD,EAAY,GAAI,MAAQ;EACR;CAEtB;CAEA,mBAAmB,cAAc,sBAC/B,WAAW,eAAe,WAAW,QAAQ,MAC9C;CAED,OAAO;AAGT"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { log } from "@intlayer/config/built";
|
|
2
|
+
import { CYAN } from "@intlayer/config/colors";
|
|
3
|
+
import { colorize, getAppLogger } from "@intlayer/config/logger";
|
|
4
|
+
|
|
5
|
+
//#region src/warnUnsupported.ts
|
|
6
|
+
/**
|
|
7
|
+
* Warns, in development only, that a `next-i18next` API is a no-op under the
|
|
8
|
+
* intlayer adapter.
|
|
9
|
+
*
|
|
10
|
+
* The `NODE_ENV` check is what keeps `@intlayer/config`'s logger and its ANSI
|
|
11
|
+
* colour table — around 6 KB — out of production bundles: with the branch
|
|
12
|
+
* folded away nothing references the imports any more and they are shaken out.
|
|
13
|
+
* That only works while `process.env.NODE_ENV` survives this package's own
|
|
14
|
+
* build and reaches the consuming app's bundler, which is why `tsdown.config.ts`
|
|
15
|
+
* pins `platform: 'neutral'`.
|
|
16
|
+
*
|
|
17
|
+
* @param api - Name of the shimmed `next-i18next` export, e.g. `serverSideTranslations`.
|
|
18
|
+
* @param reason - What the developer should do instead.
|
|
19
|
+
*/
|
|
20
|
+
const warnUnsupported = (api, reason) => {
|
|
21
|
+
if (process.env.NODE_ENV !== "development") return;
|
|
22
|
+
getAppLogger({ log })(`${colorize(api, CYAN)} ${reason}`);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
export { warnUnsupported };
|
|
27
|
+
//# sourceMappingURL=warnUnsupported.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warnUnsupported.mjs","names":[],"sources":["../../src/warnUnsupported.ts"],"sourcesContent":["import { log } from '@intlayer/config/built';\nimport { CYAN } from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\n\n/**\n * Warns, in development only, that a `next-i18next` API is a no-op under the\n * intlayer adapter.\n *\n * The `NODE_ENV` check is what keeps `@intlayer/config`'s logger and its ANSI\n * colour table — around 6 KB — out of production bundles: with the branch\n * folded away nothing references the imports any more and they are shaken out.\n * That only works while `process.env.NODE_ENV` survives this package's own\n * build and reaches the consuming app's bundler, which is why `tsdown.config.ts`\n * pins `platform: 'neutral'`.\n *\n * @param api - Name of the shimmed `next-i18next` export, e.g. `serverSideTranslations`.\n * @param reason - What the developer should do instead.\n */\nexport const warnUnsupported = (api: string, reason: string): void => {\n if (process.env.NODE_ENV !== 'development') return;\n\n getAppLogger({ log })(`${colorize(api, CYAN)} ${reason}`);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA,MAAa,mBAAmB,KAAa,WAAyB;CACpE,IAAI,QAAQ,IAAI,aAAa,eAAe;CAE5C,aAAa,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,SAAS,KAAK,IAAI,EAAE,GAAG,QAAQ;AAC1D"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/warnUnsupported.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Warns, in development only, that a `next-i18next` API is a no-op under the
|
|
4
|
+
* intlayer adapter.
|
|
5
|
+
*
|
|
6
|
+
* The `NODE_ENV` check is what keeps `@intlayer/config`'s logger and its ANSI
|
|
7
|
+
* colour table — around 6 KB — out of production bundles: with the branch
|
|
8
|
+
* folded away nothing references the imports any more and they are shaken out.
|
|
9
|
+
* That only works while `process.env.NODE_ENV` survives this package's own
|
|
10
|
+
* build and reaches the consuming app's bundler, which is why `tsdown.config.ts`
|
|
11
|
+
* pins `platform: 'neutral'`.
|
|
12
|
+
*
|
|
13
|
+
* @param api - Name of the shimmed `next-i18next` export, e.g. `serverSideTranslations`.
|
|
14
|
+
* @param reason - What the developer should do instead.
|
|
15
|
+
*/
|
|
16
|
+
export declare const warnUnsupported: (api: string, reason: string) => void;
|
|
17
|
+
//#endregion
|
|
18
|
+
//# sourceMappingURL=warnUnsupported.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warnUnsupported.d.ts","names":[],"sources":["../../src/warnUnsupported.ts"],"mappings":";;;;;;;;;;;;;;;qBAkBa,kBAAe,aAAe"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/next-i18next",
|
|
3
|
-
"version": "9.5.
|
|
3
|
+
"version": "9.5.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "next-i18next API adapter for intlayer — serverSideTranslations, appWithTranslation, useTranslation backed by next-intlayer",
|
|
6
6
|
"keywords": [
|
|
@@ -79,18 +79,18 @@
|
|
|
79
79
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"@intlayer/config": "9.5.
|
|
83
|
-
"@intlayer/core": "9.5.
|
|
84
|
-
"@intlayer/engine": "9.5.
|
|
85
|
-
"@intlayer/i18next": "9.5.
|
|
86
|
-
"@intlayer/react-i18next": "9.5.
|
|
87
|
-
"@intlayer/types": "9.5.
|
|
88
|
-
"next-intlayer": "9.5.
|
|
89
|
-
"react-intlayer": "9.5.
|
|
82
|
+
"@intlayer/config": "9.5.3",
|
|
83
|
+
"@intlayer/core": "9.5.3",
|
|
84
|
+
"@intlayer/engine": "9.5.3",
|
|
85
|
+
"@intlayer/i18next": "9.5.3",
|
|
86
|
+
"@intlayer/react-i18next": "9.5.3",
|
|
87
|
+
"@intlayer/types": "9.5.3",
|
|
88
|
+
"next-intlayer": "9.5.3",
|
|
89
|
+
"react-intlayer": "9.5.3"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
|
-
"@types/node": "
|
|
93
|
-
"@types/react": "19.
|
|
92
|
+
"@types/node": "^22",
|
|
93
|
+
"@types/react": "19.3.0",
|
|
94
94
|
"@utils/ts-config": "1.0.4",
|
|
95
95
|
"@utils/ts-config-types": "1.0.4",
|
|
96
96
|
"@utils/tsdown-config": "1.0.4",
|