next-intl 3.5.2 → 3.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.
@@ -4,15 +4,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
  var core = require('use-intl/core');
7
+ var messageFormatCache = require('../shared/messageFormatCache.js');
7
8
 
8
- function getMessageFormatCacheImpl() {
9
- return new Map();
10
- }
11
- const getMessageFormatCache = React.cache(getMessageFormatCacheImpl);
12
9
  function getTranslatorImpl(config, namespace) {
13
10
  return core.createTranslator({
14
11
  ...config,
15
- messageFormatCache: getMessageFormatCache(),
12
+ messageFormatCache: messageFormatCache.getMessageFormatCache(),
16
13
  namespace
17
14
  });
18
15
  }
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
  var core = require('use-intl/core');
7
+ var messageFormatCache = require('../../shared/messageFormatCache.js');
7
8
  var getConfig = require('./getConfig.js');
8
9
  var getLocale = require('./getLocale.js');
9
10
 
@@ -26,6 +27,7 @@ async function getTranslations(namespaceOrOpts) {
26
27
  const config = await getConfig.default(locale || (await getLocale.default()));
27
28
  return core.createTranslator({
28
29
  ...config,
30
+ messageFormatCache: messageFormatCache.getMessageFormatCache(),
29
31
  namespace,
30
32
  messages: config.messages
31
33
  });
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+
7
+ function getMessageFormatCacheImpl() {
8
+ return new Map();
9
+ }
10
+ const getMessageFormatCache = React.cache(getMessageFormatCacheImpl);
11
+
12
+ exports.getMessageFormatCache = getMessageFormatCache;
@@ -1 +1 @@
1
- import{cache as e}from"react";import{createTranslator as r}from"use-intl/core";const t=e((function(){return new Map}));var a=e((function(e,a){return r({...e,messageFormatCache:t(),namespace:a})}));export{a as default};
1
+ import{cache as e}from"react";import{createTranslator as r}from"use-intl/core";import{getMessageFormatCache as a}from"../shared/messageFormatCache.js";var m=e((function(e,m){return r({...e,messageFormatCache:a(),namespace:m})}));export{m as default};
@@ -1 +1 @@
1
- import{cache as e}from"react";import{createTranslator as t}from"use-intl/core";import a from"./getConfig.js";import o from"./getLocale.js";var r=e((async function(e){let r,s;"string"==typeof e?r=e:e&&(s=e.locale,r=e.namespace);const m=await a(s||await o());return t({...m,namespace:r,messages:m.messages})}));export{r as default};
1
+ import{cache as e}from"react";import{createTranslator as a}from"use-intl/core";import{getMessageFormatCache as s}from"../../shared/messageFormatCache.js";import t from"./getConfig.js";import o from"./getLocale.js";var r=e((async function(e){let r,m;"string"==typeof e?r=e:e&&(m=e.locale,r=e.namespace);const c=await t(m||await o());return a({...c,messageFormatCache:s(),namespace:r,messages:c.messages})}));export{r as default};
@@ -0,0 +1 @@
1
+ import{cache as r}from"react";const t=r((function(){return new Map}));export{t as getMessageFormatCache};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("use-intl/core");const t=e.cache((function(){return new Map}));var a=e.cache((function(e,a){return r.createTranslator({...e,messageFormatCache:t(),namespace:a})}));exports.default=a;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("use-intl/core"),a=require("../shared/messageFormatCache.js");var t=e.cache((function(e,t){return r.createTranslator({...e,messageFormatCache:a.getMessageFormatCache(),namespace:t})}));exports.default=t;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),a=require("use-intl/core"),r=require("./getConfig.js"),t=require("./getLocale.js");var s=e.cache((async function(e){let s,c;"string"==typeof e?s=e:e&&(c=e.locale,s=e.namespace);const u=await r.default(c||await t.default());return a.createTranslator({...u,namespace:s,messages:u.messages})}));exports.default=s;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),a=require("use-intl/core"),r=require("../../shared/messageFormatCache.js"),s=require("./getConfig.js"),t=require("./getLocale.js");var c=e.cache((async function(e){let c,o;"string"==typeof e?c=e:e&&(o=e.locale,c=e.namespace);const u=await s.default(o||await t.default());return a.createTranslator({...u,messageFormatCache:r.getMessageFormatCache(),namespace:c,messages:u.messages})}));exports.default=c;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=require("react").cache((function(){return new Map}));exports.getMessageFormatCache=e;
@@ -3,7 +3,7 @@ export { default } from 'react';
3
3
  export declare function use(promise: Promise<unknown> & {
4
4
  value?: unknown;
5
5
  }): {};
6
- export declare function cache(fn: (...args: Array<unknown>) => unknown): (...args: Array<unknown>) => unknown;
6
+ export declare function cache(fn: (...args: Array<unknown>) => unknown): (...args: Array<unknown>) => any;
7
7
  export declare namespace cache {
8
8
  var reset: () => void;
9
9
  }
@@ -0,0 +1,3 @@
1
+ declare function getMessageFormatCacheImpl(): Map<any, any>;
2
+ export declare const getMessageFormatCache: typeof getMessageFormatCacheImpl;
3
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-intl",
3
- "version": "3.5.2",
3
+ "version": "3.5.3",
4
4
  "sideEffects": false,
5
5
  "author": "Jan Amann <jan@amann.work>",
6
6
  "funding": [
@@ -82,7 +82,7 @@
82
82
  "dependencies": {
83
83
  "@formatjs/intl-localematcher": "^0.2.32",
84
84
  "negotiator": "^0.6.3",
85
- "use-intl": "^3.5.2"
85
+ "use-intl": "^3.5.3"
86
86
  },
87
87
  "peerDependencies": {
88
88
  "next": "^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0",
@@ -141,5 +141,5 @@
141
141
  "limit": "5.81 KB"
142
142
  }
143
143
  ],
144
- "gitHead": "6aec1c0f1f944fa97730f3564831d039b4b059a8"
144
+ "gitHead": "899552bf5629b29db88353fbc58a8397c086b285"
145
145
  }