next-intl 3.2.3 → 3.2.4

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.
@@ -21,9 +21,13 @@ function getRequestConfig() {
21
21
  const getFormatter = notSupported('getFormatter');
22
22
  const getNow = notSupported('getNow');
23
23
  const getTimeZone = notSupported('getTimeZone');
24
- const getTranslations = notSupported('getTranslations');
25
24
  const getMessages = notSupported('getMessages');
26
25
  const getLocale = notSupported('getLocale');
26
+
27
+ // The type of `getTranslations` is not assigned here because it
28
+ // causes a type error. The types use the `react-server` entry
29
+ // anyway, therefore this is irrelevant.
30
+ const getTranslations = notSupported('getTranslations');
27
31
  const unstable_setRequestLocale = notSupported('unstable_setRequestLocale');
28
32
 
29
33
  exports.getFormatter = getFormatter;
@@ -8,7 +8,6 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
8
 
9
9
  var getRuntimeConfig__default = /*#__PURE__*/_interopDefault(getRuntimeConfig);
10
10
 
11
- // @ts-expect-error
12
11
  // eslint-disable-next-line import/no-extraneous-dependencies
13
12
 
14
13
  Object.defineProperty(exports, 'default', {
@@ -10,6 +10,10 @@ var getLocale = require('./getLocale.js');
10
10
  // Maintainer note: `getTranslations` has two different call signatures.
11
11
  // We need to define these with function overloads, otherwise TypeScript
12
12
  // messes up the return type.
13
+
14
+ // CALL SIGNATURE 1: `getTranslations(namespace)`
15
+ // CALL SIGNATURE 2: `getTranslations({locale, namespace})`
16
+ // IMPLEMENTATION
13
17
  async function getTranslations(namespaceOrOpts) {
14
18
  let namespace;
15
19
  let locale;
@@ -1 +1 @@
1
- function e(e){return()=>{throw new Error("`".concat(e,"` is not supported in Client Components."))}}function t(){return e("getRequestConfig")}const n=e("getFormatter"),o=e("getNow"),r=e("getTimeZone"),s=e("getTranslations"),g=e("getMessages"),a=e("getLocale"),i=e("unstable_setRequestLocale");export{n as getFormatter,a as getLocale,g as getMessages,o as getNow,t as getRequestConfig,r as getTimeZone,s as getTranslations,i as unstable_setRequestLocale};
1
+ function e(e){return()=>{throw new Error("`".concat(e,"` is not supported in Client Components."))}}function t(){return e("getRequestConfig")}const n=e("getFormatter"),o=e("getNow"),r=e("getTimeZone"),s=e("getMessages"),g=e("getLocale"),a=e("getTranslations"),i=e("unstable_setRequestLocale");export{n as getFormatter,g as getLocale,s as getMessages,o as getNow,t as getRequestConfig,r as getTimeZone,a as getTranslations,i as unstable_setRequestLocale};
@@ -1 +1 @@
1
- "use strict";function e(e){return()=>{throw new Error("`".concat(e,"` is not supported in Client Components."))}}Object.defineProperty(exports,"__esModule",{value:!0});const t=e("getFormatter"),o=e("getNow"),s=e("getTimeZone"),r=e("getTranslations"),n=e("getMessages"),g=e("getLocale"),a=e("unstable_setRequestLocale");exports.getFormatter=t,exports.getLocale=g,exports.getMessages=n,exports.getNow=o,exports.getRequestConfig=function(){return e("getRequestConfig")},exports.getTimeZone=s,exports.getTranslations=r,exports.unstable_setRequestLocale=a;
1
+ "use strict";function e(e){return()=>{throw new Error("`".concat(e,"` is not supported in Client Components."))}}Object.defineProperty(exports,"__esModule",{value:!0});const t=e("getFormatter"),o=e("getNow"),s=e("getTimeZone"),r=e("getMessages"),n=e("getLocale"),g=e("getTranslations"),a=e("unstable_setRequestLocale");exports.getFormatter=t,exports.getLocale=n,exports.getMessages=r,exports.getNow=o,exports.getRequestConfig=function(){return e("getRequestConfig")},exports.getTimeZone=s,exports.getTranslations=g,exports.unstable_setRequestLocale=a;
@@ -1,58 +1,9 @@
1
- /// <reference types="react" />
2
1
  import type { getRequestConfig as getRequestConfig_type, getFormatter as getFormatter_type, getNow as getNow_type, getTimeZone as getTimeZone_type, getMessages as getMessages_type, getLocale as getLocale_type, unstable_setRequestLocale as unstable_setRequestLocale_type } from '../react-server';
3
2
  export declare function getRequestConfig(...args: Parameters<typeof getRequestConfig_type>): ReturnType<typeof getRequestConfig_type>;
4
3
  export declare const getFormatter: typeof getFormatter_type;
5
4
  export declare const getNow: typeof getNow_type;
6
5
  export declare const getTimeZone: typeof getTimeZone_type;
7
- export declare const getTranslations: {
8
- <NestedKey extends string = never>(namespace?: NestedKey | undefined): Promise<{
9
- <TargetKey extends import("use-intl/dist/types/src/core/utils/MessageKeys").default<import("use-intl/dist/types/src/core/utils/NestedValueOf").default<{
10
- '!': IntlMessages;
11
- }, [NestedKey] extends [never] ? "!" : `!.${NestedKey}`>, import("use-intl/dist/types/src/core/utils/NestedKeyOf").default<import("use-intl/dist/types/src/core/utils/NestedValueOf").default<{
12
- '!': IntlMessages;
13
- }, [NestedKey] extends [never] ? "!" : `!.${NestedKey}`>>>>(key: [TargetKey] extends [never] ? string : TargetKey, values?: import("use-intl/dist/types/src/core/TranslationValues").default | undefined, formats?: Partial<import("use-intl/dist/types/src/core/Formats").default> | undefined): string;
14
- rich<TargetKey_1 extends import("use-intl/dist/types/src/core/utils/MessageKeys").default<import("use-intl/dist/types/src/core/utils/NestedValueOf").default<{
15
- '!': IntlMessages;
16
- }, [NestedKey] extends [never] ? "!" : `!.${NestedKey}`>, import("use-intl/dist/types/src/core/utils/NestedKeyOf").default<import("use-intl/dist/types/src/core/utils/NestedValueOf").default<{
17
- '!': IntlMessages;
18
- }, [NestedKey] extends [never] ? "!" : `!.${NestedKey}`>>>>(key: [TargetKey_1] extends [never] ? string : TargetKey_1, values?: import("use-intl").RichTranslationValues | undefined, formats?: Partial<import("use-intl/dist/types/src/core/Formats").default> | undefined): string | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNodeArray;
19
- markup<TargetKey_2 extends import("use-intl/dist/types/src/core/utils/MessageKeys").default<import("use-intl/dist/types/src/core/utils/NestedValueOf").default<{
20
- '!': IntlMessages;
21
- }, [NestedKey] extends [never] ? "!" : `!.${NestedKey}`>, import("use-intl/dist/types/src/core/utils/NestedKeyOf").default<import("use-intl/dist/types/src/core/utils/NestedValueOf").default<{
22
- '!': IntlMessages;
23
- }, [NestedKey] extends [never] ? "!" : `!.${NestedKey}`>>>>(key: [TargetKey_2] extends [never] ? string : TargetKey_2, values?: import("use-intl").MarkupTranslationValues | undefined, formats?: Partial<import("use-intl/dist/types/src/core/Formats").default> | undefined): string;
24
- raw<TargetKey_3 extends import("use-intl/dist/types/src/core/utils/MessageKeys").default<import("use-intl/dist/types/src/core/utils/NestedValueOf").default<{
25
- '!': IntlMessages;
26
- }, [NestedKey] extends [never] ? "!" : `!.${NestedKey}`>, import("use-intl/dist/types/src/core/utils/NestedKeyOf").default<import("use-intl/dist/types/src/core/utils/NestedValueOf").default<{
27
- '!': IntlMessages;
28
- }, [NestedKey] extends [never] ? "!" : `!.${NestedKey}`>>>>(key: [TargetKey_3] extends [never] ? string : TargetKey_3): any;
29
- }>;
30
- <NestedKey_1 extends string = never>(opts?: {
31
- locale: string;
32
- namespace?: NestedKey_1 | undefined;
33
- } | undefined): Promise<{
34
- <TargetKey_4 extends import("use-intl/dist/types/src/core/utils/MessageKeys").default<import("use-intl/dist/types/src/core/utils/NestedValueOf").default<{
35
- '!': IntlMessages;
36
- }, [NestedKey_1] extends [never] ? "!" : `!.${NestedKey_1}`>, import("use-intl/dist/types/src/core/utils/NestedKeyOf").default<import("use-intl/dist/types/src/core/utils/NestedValueOf").default<{
37
- '!': IntlMessages;
38
- }, [NestedKey_1] extends [never] ? "!" : `!.${NestedKey_1}`>>>>(key: TargetKey_4, values?: import("use-intl/dist/types/src/core/TranslationValues").default | undefined, formats?: Partial<import("use-intl/dist/types/src/core/Formats").default> | undefined): string;
39
- rich<TargetKey_5 extends import("use-intl/dist/types/src/core/utils/MessageKeys").default<import("use-intl/dist/types/src/core/utils/NestedValueOf").default<{
40
- '!': IntlMessages;
41
- }, [NestedKey_1] extends [never] ? "!" : `!.${NestedKey_1}`>, import("use-intl/dist/types/src/core/utils/NestedKeyOf").default<import("use-intl/dist/types/src/core/utils/NestedValueOf").default<{
42
- '!': IntlMessages;
43
- }, [NestedKey_1] extends [never] ? "!" : `!.${NestedKey_1}`>>>>(key: TargetKey_5, values?: import("use-intl").RichTranslationValues | undefined, formats?: Partial<import("use-intl/dist/types/src/core/Formats").default> | undefined): string | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNodeArray;
44
- markup<TargetKey_6 extends import("use-intl/dist/types/src/core/utils/MessageKeys").default<import("use-intl/dist/types/src/core/utils/NestedValueOf").default<{
45
- '!': IntlMessages;
46
- }, [NestedKey_1] extends [never] ? "!" : `!.${NestedKey_1}`>, import("use-intl/dist/types/src/core/utils/NestedKeyOf").default<import("use-intl/dist/types/src/core/utils/NestedValueOf").default<{
47
- '!': IntlMessages;
48
- }, [NestedKey_1] extends [never] ? "!" : `!.${NestedKey_1}`>>>>(key: TargetKey_6, values?: import("use-intl").MarkupTranslationValues | undefined, formats?: Partial<import("use-intl/dist/types/src/core/Formats").default> | undefined): string;
49
- raw<TargetKey_7 extends import("use-intl/dist/types/src/core/utils/MessageKeys").default<import("use-intl/dist/types/src/core/utils/NestedValueOf").default<{
50
- '!': IntlMessages;
51
- }, [NestedKey_1] extends [never] ? "!" : `!.${NestedKey_1}`>, import("use-intl/dist/types/src/core/utils/NestedKeyOf").default<import("use-intl/dist/types/src/core/utils/NestedValueOf").default<{
52
- '!': IntlMessages;
53
- }, [NestedKey_1] extends [never] ? "!" : `!.${NestedKey_1}`>>>>(key: TargetKey_7): any;
54
- }>;
55
- };
56
6
  export declare const getMessages: typeof getMessages_type;
57
7
  export declare const getLocale: typeof getLocale_type;
8
+ export declare const getTranslations: () => never;
58
9
  export declare const unstable_setRequestLocale: typeof unstable_setRequestLocale_type;
@@ -1,23 +1,8 @@
1
- declare const getConfig: (locale: string) => Promise<Omit<{
2
- locale: string;
3
- now: Date;
4
- timeZone: string;
5
- formats?: Partial<import("use-intl/dist/types/src/core/Formats").default> | undefined;
6
- onError?: ((error: import("use-intl/core").IntlError) => void) | undefined;
7
- getMessageFallback?: ((info: {
8
- error: import("use-intl/core").IntlError;
9
- key: string;
10
- namespace?: string | undefined;
11
- }) => string) | undefined;
12
- messages?: import("use-intl/dist/types/src/core/AbstractIntlMessages").default | undefined;
13
- defaultTranslationValues?: import("use-intl/core").RichTranslationValues | undefined;
14
- }, "onError" | "getMessageFallback" | "messages"> & {
15
- messages: import("use-intl/dist/types/src/core/AbstractIntlMessages").default | undefined;
16
- onError: typeof import("use-intl/dist/types/src/core/defaults").defaultOnError;
17
- getMessageFallback: (info: {
18
- error: import("use-intl/core").IntlError;
19
- key: string;
20
- namespace?: string | undefined;
21
- }) => string;
1
+ import { IntlConfig } from 'use-intl/core';
2
+ declare const getConfig: (locale: string) => Promise<IntlConfig & {
3
+ getMessageFallback: NonNullable<IntlConfig['getMessageFallback']>;
4
+ now: NonNullable<IntlConfig['now']>;
5
+ onError: NonNullable<IntlConfig['onError']>;
6
+ timeZone: NonNullable<IntlConfig['timeZone']>;
22
7
  }>;
23
8
  export default getConfig;
@@ -1,3 +1,4 @@
1
+ import { createFormatter } from 'use-intl/core';
1
2
  /**
2
3
  * Returns a formatter based on the given locale.
3
4
  *
@@ -6,9 +7,4 @@
6
7
  */
7
8
  export default function getFormatter(opts?: {
8
9
  locale?: string;
9
- }): Promise<{
10
- dateTime: (value: number | Date, formatOrOptions?: string | import("use-intl/dist/types/src/core/DateTimeFormatOptions").default | undefined) => string;
11
- number: (value: number | bigint, formatOrOptions?: string | import("use-intl/core").NumberFormatOptions | undefined) => string;
12
- relativeTime: (date: number | Date, nowOrOptions?: number | Date | import("use-intl/dist/types/src/core/RelativeTimeFormatOptions").default | undefined) => string;
13
- list: (value: Iterable<string>, formatOrOptions?: string | Intl.ListFormatOptions | undefined) => string;
14
- }>;
10
+ }): Promise<ReturnType<typeof createFormatter>>;
@@ -1,3 +1,4 @@
1
+ import type { AbstractIntlMessages } from 'use-intl';
1
2
  export default function getMessages(opts?: {
2
3
  locale?: string;
3
- }): Promise<import("use-intl/dist/types/src/core/AbstractIntlMessages").default>;
4
+ }): Promise<AbstractIntlMessages>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-intl",
3
- "version": "3.2.3",
3
+ "version": "3.2.4",
4
4
  "sideEffects": false,
5
5
  "author": "Jan Amann <jan@amann.work>",
6
6
  "funding": [
@@ -80,7 +80,7 @@
80
80
  "dependencies": {
81
81
  "@formatjs/intl-localematcher": "^0.2.32",
82
82
  "negotiator": "^0.6.3",
83
- "use-intl": "^3.2.3"
83
+ "use-intl": "^3.2.4"
84
84
  },
85
85
  "peerDependencies": {
86
86
  "next": "^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0",
@@ -137,5 +137,5 @@
137
137
  "limit": "5.72 KB"
138
138
  }
139
139
  ],
140
- "gitHead": "1782e9a56db0a7ee6e67dd4ea12a5f527439fa5e"
140
+ "gitHead": "f8b245523f9b37a543d8ab0d52c89a1b79e275e3"
141
141
  }