use-intl 4.13.0 → 4.13.1
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.
|
@@ -62,8 +62,8 @@ function getPlainMessage(candidate, values) {
|
|
|
62
62
|
return (
|
|
63
63
|
// 1. Values are provided
|
|
64
64
|
values ||
|
|
65
|
-
// 2. There are
|
|
66
|
-
/'[{}]/.test(candidate) ||
|
|
65
|
+
// 2. There are ICU escape sequences (e.g. "'{name'}")
|
|
66
|
+
/'[{}<#|']/.test(candidate) ||
|
|
67
67
|
// 3. There are missing arguments or tags (dev-only error handling)
|
|
68
68
|
/<|{/.test(candidate) ? undefined // Compile
|
|
69
69
|
: candidate // Don't compile
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{IntlMessageFormat as t}from"intl-messageformat";import{isValidElement as e}from"react";import{I as r,a as o,m as a}from"../formatters-CJcico0N.js";function m(...[m,s,i,n]){if(Array.isArray(s))throw new r(o.INVALID_MESSAGE,void 0);if("object"==typeof s)throw new r(o.INSUFFICIENT_PATH,void 0);if("string"==typeof s){const t=function(t,e){return e||/'[{}]/.test(t)?void 0:t}(s,i);if(t)return t}const{cache:f,formats:c,formatters:g,globalFormats:u,locale:d,timeZone:A}=n;let p;g.getMessageFormat||(g.getMessageFormat=function(e,r){return a(((...e)=>new t(e[0],e[1],e[2],{formatters:r,...e[3]})),e.message)}(f,g));try{p=g.getMessageFormat(s,d,function(e,r,o){const a=t.formats.date,m=t.formats.time,s={...e?.dateTime,...r?.dateTime},i={date:{...a,...s},time:{...m,...s},number:{...e?.number,...r?.number}};return o&&["date","time"].forEach((t=>{const e=i[t];for(const[t,r]of Object.entries(e))e[t]={timeZone:o,...r}})),i}(u,c,A),{formatters:{...g,getDateTimeFormat:(t,e)=>g.getDateTimeFormat(t,{...e,timeZone:e?.timeZone??A})}})}catch(t){throw new r(o.INVALID_MESSAGE,void 0)}const w=p.format(i);return e(w)||Array.isArray(w)||"string"==typeof w?w:String(w)}m.raw=!0;export{m as default};
|
|
1
|
+
import{IntlMessageFormat as t}from"intl-messageformat";import{isValidElement as e}from"react";import{I as r,a as o,m as a}from"../formatters-CJcico0N.js";function m(...[m,s,i,n]){if(Array.isArray(s))throw new r(o.INVALID_MESSAGE,void 0);if("object"==typeof s)throw new r(o.INSUFFICIENT_PATH,void 0);if("string"==typeof s){const t=function(t,e){return e||/'[{}<#|']/.test(t)?void 0:t}(s,i);if(t)return t}const{cache:f,formats:c,formatters:g,globalFormats:u,locale:d,timeZone:A}=n;let p;g.getMessageFormat||(g.getMessageFormat=function(e,r){return a(((...e)=>new t(e[0],e[1],e[2],{formatters:r,...e[3]})),e.message)}(f,g));try{p=g.getMessageFormat(s,d,function(e,r,o){const a=t.formats.date,m=t.formats.time,s={...e?.dateTime,...r?.dateTime},i={date:{...a,...s},time:{...m,...s},number:{...e?.number,...r?.number}};return o&&["date","time"].forEach((t=>{const e=i[t];for(const[t,r]of Object.entries(e))e[t]={timeZone:o,...r}})),i}(u,c,A),{formatters:{...g,getDateTimeFormat:(t,e)=>g.getDateTimeFormat(t,{...e,timeZone:e?.timeZone??A})}})}catch(t){throw new r(o.INVALID_MESSAGE,void 0)}const w=p.format(i);return e(w)||Array.isArray(w)||"string"==typeof w?w:String(w)}m.raw=!0;export{m as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "use-intl",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.1",
|
|
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.13.
|
|
80
|
+
"icu-minify": "^4.13.1",
|
|
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": "
|
|
86
|
+
"gitHead": "976ca1f83a6e06b5646865b87c4fb461cbf84374"
|
|
87
87
|
}
|