next-intl 3.17.4 → 3.17.6
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/dist/development/react-client/useLocale.js +2 -1
- package/dist/development/server/react-server/getConfig.js +3 -2
- package/dist/esm/server/react-server/getConfig.js +1 -1
- package/dist/production/server/react-server/getConfig.js +1 -1
- package/dist/types/src/server/react-server/getConfig.d.ts +2 -2
- package/package.json +3 -37
- /package/dist/types/src/react-server/{utils.d.ts → testUtils.d.ts} +0 -0
|
@@ -12,7 +12,8 @@ function useLocale() {
|
|
|
12
12
|
const params = navigation.useParams();
|
|
13
13
|
let locale;
|
|
14
14
|
try {
|
|
15
|
-
// eslint-disable-next-line react-
|
|
15
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
16
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks, react-compiler/react-compiler -- False positive
|
|
16
17
|
locale = _useLocale.useLocale();
|
|
17
18
|
} catch (error) {
|
|
18
19
|
if (typeof (params === null || params === void 0 ? void 0 : params[constants.LOCALE_SEGMENT_NAME]) === 'string') {
|
|
@@ -50,12 +50,13 @@ async function receiveRuntimeConfigImpl(getConfig, localeOverride) {
|
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
const receiveRuntimeConfig = React.cache(receiveRuntimeConfigImpl);
|
|
53
|
-
const getFormatters = React.cache(core.
|
|
53
|
+
const getFormatters = React.cache(core._createIntlFormatters);
|
|
54
|
+
const getCache = React.cache(core._createCache);
|
|
54
55
|
async function getConfigImpl(localeOverride) {
|
|
55
56
|
const runtimeConfig = await receiveRuntimeConfig(getRuntimeConfig__default.default, localeOverride);
|
|
56
57
|
return {
|
|
57
58
|
...core.initializeConfig(runtimeConfig),
|
|
58
|
-
_formatters: getFormatters()
|
|
59
|
+
_formatters: getFormatters(getCache())
|
|
59
60
|
};
|
|
60
61
|
}
|
|
61
62
|
const getConfig = React.cache(getConfigImpl);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cache as t}from"react";import{
|
|
1
|
+
import{cache as t}from"react";import{_createIntlFormatters as e,_createCache as o,initializeConfig as n}from"use-intl/core";import{getRequestLocale as r}from"./RequestLocale.js";import a from"next-intl/config";const s=t((function(){return new Date}));const i=t((function(){return Intl.DateTimeFormat().resolvedOptions().timeZone}));const c=t((async function(t,e){let o=!1;const n={get locale(){return o=!0,e||r()}};let a=t(n);return a instanceof Promise&&(a=await a),a.locale&&o&&console.error("\nYou've read the `locale` param that was passed to `getRequestConfig` but have also returned one from the function. This is likely an error, please ensure that you're consistently using a setup with or without i18n routing: https://next-intl-docs.vercel.app/docs/getting-started/app-router\n"),{...a,locale:a.locale||n.locale,now:a.now||s(),timeZone:a.timeZone||i()}})),l=t(e),u=t(o);const m=t((async function(t){const e=await c(a,t);return{...n(e),_formatters:l(u())}}));export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("use-intl/core"),n=require("./RequestLocale.js");function o(e){return e&&e.__esModule?e:{default:e}}var r=o(require("next-intl/config"));const a=e.cache((function(){return new Date}));const c=e.cache((function(){return Intl.DateTimeFormat().resolvedOptions().timeZone}));const s=e.cache((async function(e,t){let o=!1;const r={get locale(){return o=!0,t||n.getRequestLocale()}};let s=e(r);return s instanceof Promise&&(s=await s),s.locale&&o&&console.error("\nYou've read the `locale` param that was passed to `getRequestConfig` but have also returned one from the function. This is likely an error, please ensure that you're consistently using a setup with or without i18n routing: https://next-intl-docs.vercel.app/docs/getting-started/app-router\n"),{...s,locale:s.locale||r.locale,now:s.now||a(),timeZone:s.timeZone||c()}})),i=e.cache(t.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("use-intl/core"),n=require("./RequestLocale.js");function o(e){return e&&e.__esModule?e:{default:e}}var r=o(require("next-intl/config"));const a=e.cache((function(){return new Date}));const c=e.cache((function(){return Intl.DateTimeFormat().resolvedOptions().timeZone}));const s=e.cache((async function(e,t){let o=!1;const r={get locale(){return o=!0,t||n.getRequestLocale()}};let s=e(r);return s instanceof Promise&&(s=await s),s.locale&&o&&console.error("\nYou've read the `locale` param that was passed to `getRequestConfig` but have also returned one from the function. This is likely an error, please ensure that you're consistently using a setup with or without i18n routing: https://next-intl-docs.vercel.app/docs/getting-started/app-router\n"),{...s,locale:s.locale||r.locale,now:s.now||a(),timeZone:s.timeZone||c()}})),i=e.cache(t._createIntlFormatters),u=e.cache(t._createCache);const l=e.cache((async function(e){const n=await s(r.default,e);return{...t.initializeConfig(n),_formatters:i(u())}}));exports.default=l;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { IntlConfig,
|
|
1
|
+
import { IntlConfig, _createIntlFormatters } from 'use-intl/core';
|
|
2
2
|
declare function getConfigImpl(localeOverride?: string): Promise<IntlConfig & {
|
|
3
3
|
getMessageFallback: NonNullable<IntlConfig['getMessageFallback']>;
|
|
4
4
|
now: NonNullable<IntlConfig['now']>;
|
|
5
5
|
onError: NonNullable<IntlConfig['onError']>;
|
|
6
6
|
timeZone: NonNullable<IntlConfig['timeZone']>;
|
|
7
|
-
_formatters: ReturnType<typeof
|
|
7
|
+
_formatters: ReturnType<typeof _createIntlFormatters>;
|
|
8
8
|
}>;
|
|
9
9
|
declare const getConfig: typeof getConfigImpl;
|
|
10
10
|
export default getConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-intl",
|
|
3
|
-
"version": "3.17.
|
|
3
|
+
"version": "3.17.6",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"author": "Jan Amann <jan@amann.work>",
|
|
6
6
|
"funding": [
|
|
@@ -87,45 +87,11 @@
|
|
|
87
87
|
"dependencies": {
|
|
88
88
|
"@formatjs/intl-localematcher": "^0.5.4",
|
|
89
89
|
"negotiator": "^0.6.3",
|
|
90
|
-
"use-intl": "^3.17.
|
|
90
|
+
"use-intl": "^3.17.6"
|
|
91
91
|
},
|
|
92
92
|
"peerDependencies": {
|
|
93
93
|
"next": "^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0",
|
|
94
94
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
95
95
|
},
|
|
96
|
-
"
|
|
97
|
-
{
|
|
98
|
-
"path": "dist/production/index.react-client.js",
|
|
99
|
-
"limit": "16.055 KB"
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
"path": "dist/production/index.react-server.js",
|
|
103
|
-
"limit": "16.875 KB"
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
"path": "dist/production/navigation.react-client.js",
|
|
107
|
-
"limit": "3.55 KB"
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
"path": "dist/production/navigation.react-server.js",
|
|
111
|
-
"limit": "18.355 KB"
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
"path": "dist/production/server.react-client.js",
|
|
115
|
-
"limit": "1 KB"
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
"path": "dist/production/server.react-server.js",
|
|
119
|
-
"limit": "16.025 KB"
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
"path": "dist/production/middleware.js",
|
|
123
|
-
"limit": "11.515 KB"
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
"path": "dist/production/routing.js",
|
|
127
|
-
"limit": "0 KB"
|
|
128
|
-
}
|
|
129
|
-
],
|
|
130
|
-
"gitHead": "720c254b5f1b189adfd5406e501793ad4d4cc8a6"
|
|
96
|
+
"gitHead": "9d9d53c9e55f80ce5c6f5cb9bb5f1be04e4d302c"
|
|
131
97
|
}
|
|
File without changes
|