use-intl 4.11.2 → 4.12.0

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.
@@ -192,12 +192,12 @@ function getArgs(messageOrParams, ...rest) {
192
192
  message = messageOrParams.message;
193
193
  values = messageOrParams.values;
194
194
  formats = messageOrParams.formats;
195
- // `description` is is not used at runtime
195
+ // `description` is not used at runtime
196
196
  }
197
197
  // @ts-expect-error -- Secret fallback parameter
198
198
  return [undefined,
199
199
  // Always use fallback if not compiled
200
- values, formats, message ];
200
+ values, formats, message];
201
201
  }
202
202
 
203
203
  // Note: This API is usually compiled into `useTranslations`,
@@ -1 +1 @@
1
- import{createContext as e,useContext as r,useMemo as t,useState as o,useEffect as n}from"react";import{b as a,c as s,I as c,a as i}from"./formatters-CJcico0N.js";import{i as m,r as f,a as u,c as l}from"./initializeConfig-CHgjheii.js";import{jsx as g}from"react/jsx-runtime";const d=e(void 0);function v({children:e,formats:o,getMessageFallback:n,locale:c,messages:i,now:f,onError:u,timeZone:l}){const v=r(d),w=t((()=>v?.cache||a()),[c,v?.cache]),p=t((()=>v?.formatters||s(w)),[w,v?.formatters]),h=t((()=>({...m({locale:c,formats:void 0===o?v?.formats:o,getMessageFallback:n||v?.getMessageFallback,messages:void 0===i?v?.messages:i,now:f||v?.now,onError:u||v?.onError,timeZone:l||v?.timeZone}),formatters:p,cache:w})),[w,o,p,n,c,i,f,u,v,l]);return g(d.Provider,{value:h,children:e})}function w(){const e=r(d);if(!e)throw new Error(void 0);return e}let p=!1;const h="undefined"==typeof window;function E(e){return function(e,r,o){const{cache:n,formats:a,formatters:s,getMessageFallback:m,locale:l,onError:g,timeZone:d}=w(),v=e[o],E=f(r,o);return d||p||!h||(p=!0,g(new c(i.ENVIRONMENT_FALLBACK,void 0))),t((()=>u({cache:n,formatters:s,getMessageFallback:m,messages:v,namespace:E,onError:g,formats:a,locale:l,timeZone:d})),[n,s,m,v,E,g,a,l,d])}({"!":w().messages},e?`!.${e}`:"!","!")}function Z(){return w().locale}function k(){return new Date}function b(e){const r=e?.updateInterval,{now:t}=w(),[a,s]=o(t||k());return n((()=>{if(!r)return;const e=setInterval((()=>{s(k())}),r);return()=>{clearInterval(e)}}),[t,r]),null==r&&t?t:a}function F(){return w().timeZone}function M(){const e=w();if(!e.messages)throw new Error(void 0);return e.messages}function I(){const{formats:e,formatters:r,locale:o,now:n,onError:a,timeZone:s}=w();return t((()=>l({formats:e,locale:o,now:n,onError:a,timeZone:s,_formatters:r})),[e,r,n,o,a,s])}function j(e,...r){let t,o;return"string"==typeof e?(t=r[0],o=r[1]):(t=e.values,o=e.formats),[void 0,t,o,void 0]}function x(e){const r=E(e);function t(...e){return r(...j(...e))}return t.rich=(...e)=>r.rich(...j(...e)),t.markup=(...e)=>r.markup(...j(...e)),t.has=function(e){return!0},t}export{v as IntlProvider,x as _useExtracted,I as useFormatter,Z as useLocale,M as useMessages,b as useNow,F as useTimeZone,E as useTranslations};
1
+ import{createContext as e,useContext as r,useMemo as t,useState as o,useEffect as a}from"react";import{b as n,c as s,I as c,a as i}from"./formatters-CJcico0N.js";import{i as m,r as l,a as f,c as u}from"./initializeConfig-CHgjheii.js";import{jsx as d}from"react/jsx-runtime";const g=e(void 0);function w({children:e,formats:o,getMessageFallback:a,locale:c,messages:i,now:l,onError:f,timeZone:u}){const w=r(g),p=t((()=>w?.cache||n()),[c,w?.cache]),E=t((()=>w?.formatters||s(p)),[p,w?.formatters]),h=t((()=>({...m({locale:c,formats:void 0===o?w?.formats:o,getMessageFallback:a||w?.getMessageFallback,messages:void 0===i?w?.messages:i,now:l||w?.now,onError:f||w?.onError,timeZone:u||w?.timeZone}),formatters:E,cache:p})),[p,o,E,a,c,i,l,f,w,u]);return d(g.Provider,{value:h,children:e})}function p(){const e=r(g);if(!e)throw new Error(void 0);return e}let E=!1;const h="undefined"==typeof window;function v(e){return function(e,r,o){const{cache:a,formats:n,formatters:s,getMessageFallback:m,locale:u,onError:d,timeZone:g}=p(),w=e[o],v=l(r,o);return g||E||!h||(E=!0,d(new c(i.ENVIRONMENT_FALLBACK,void 0))),t((()=>f({cache:a,formatters:s,getMessageFallback:m,messages:w,namespace:v,onError:d,formats:n,locale:u,timeZone:g})),[a,s,m,w,v,d,n,u,g])}({"!":p().messages},e?`!.${e}`:"!","!")}function Z(){return p().locale}function k(){return new Date}function b(e){const r=e?.updateInterval,{now:t}=p(),[n,s]=o(t||k());return a((()=>{if(!r)return;const e=setInterval((()=>{s(k())}),r);return()=>{clearInterval(e)}}),[t,r]),null==r&&t?t:n}function x(){return p().timeZone}function F(){const e=p();if(!e.messages)throw new Error(void 0);return e.messages}function I(){const{formats:e,formatters:r,locale:o,now:a,onError:n,timeZone:s}=p();return t((()=>u({formats:e,locale:o,now:a,onError:n,timeZone:s,_formatters:r})),[e,r,a,o,n,s])}function M(e){throw v(e),new Error("[next-intl] `useExtracted` was called in production without compilation. Include modules that call `useExtracted` in `srcPath` and use `transpilePackages` for 3rd-party packages.")}export{w as IntlProvider,M as _useExtracted,I as useFormatter,Z as useLocale,F as useMessages,b as useNow,x as useTimeZone,v as useTranslations};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "use-intl",
3
- "version": "4.11.2",
3
+ "version": "4.12.0",
4
4
  "sideEffects": false,
5
5
  "author": "Jan Amann <jan@amann.work>",
6
6
  "funding": [
@@ -77,11 +77,11 @@
77
77
  "dependencies": {
78
78
  "@formatjs/fast-memoize": "^3.1.0",
79
79
  "@schummar/icu-type-parser": "1.21.5",
80
- "icu-minify": "^4.11.2",
80
+ "icu-minify": "^4.12.0",
81
81
  "intl-messageformat": "^11.1.0"
82
82
  },
83
83
  "peerDependencies": {
84
84
  "react": "^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0 || ^19.0.0"
85
85
  },
86
- "gitHead": "940dfbfbad98ceef00bb9c47822c533f384c0e02"
86
+ "gitHead": "d7bf7af5f882da3ccff30fddaa7fc6dd9a5573c2"
87
87
  }