react-intl 10.1.9 → 10.1.11

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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/react-intl.iife.js +49 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-intl",
3
3
  "description": "Internationalize React apps. This library provides React components and an API to format dates, numbers, and strings, including pluralization and handling translations.",
4
- "version": "10.1.9",
4
+ "version": "10.1.11",
5
5
  "license": "BSD-3-Clause",
6
6
  "author": "Eric Ferraiuolo <edf@ericf.me>",
7
7
  "type": "module",
@@ -12,9 +12,9 @@
12
12
  "./server": "./server.js"
13
13
  },
14
14
  "dependencies": {
15
+ "@formatjs/icu-messageformat-parser": "3.5.10",
15
16
  "@formatjs/intl": "4.1.12",
16
- "intl-messageformat": "11.2.7",
17
- "@formatjs/icu-messageformat-parser": "3.5.10"
17
+ "intl-messageformat": "11.2.7"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "@types/react": "19",
@@ -1824,6 +1824,37 @@ function matchIdentifierAtIndex(s, index) {
1824
1824
  IDENTIFIER_PREFIX_RE.lastIndex = index;
1825
1825
  return IDENTIFIER_PREFIX_RE.exec(s)[1] ?? "";
1826
1826
  }
1827
+ function plainTopLevelEndPosition(message) {
1828
+ if (message.length === 0) return null;
1829
+ let line = 1;
1830
+ let column = 1;
1831
+ for (let offset = 0; offset < message.length;) {
1832
+ const code = message.charCodeAt(offset);
1833
+ switch (code) {
1834
+ case 35:
1835
+ case 39:
1836
+ case 60:
1837
+ case 123:
1838
+ case 125: return null;
1839
+ }
1840
+ if (code === 10) {
1841
+ line++;
1842
+ column = 1;
1843
+ offset++;
1844
+ } else {
1845
+ column++;
1846
+ if (code >= 55296 && code <= 56319 && offset + 1 < message.length) {
1847
+ const next = message.charCodeAt(offset + 1);
1848
+ offset += next >= 56320 && next <= 57343 ? 2 : 1;
1849
+ } else offset++;
1850
+ }
1851
+ }
1852
+ return {
1853
+ offset: message.length,
1854
+ line,
1855
+ column
1856
+ };
1857
+ }
1827
1858
  var Parser = class {
1828
1859
  constructor(message, options = {}) {
1829
1860
  this.message = message;
@@ -1839,6 +1870,24 @@ var Parser = class {
1839
1870
  }
1840
1871
  parse() {
1841
1872
  if (this.offset() !== 0) throw Error("parser can only be used once");
1873
+ if (this.message.length > 0) {
1874
+ const firstCode = this.message.charCodeAt(0);
1875
+ if (firstCode !== 35 && firstCode !== 39 && firstCode !== 60 && firstCode !== 123 && firstCode !== 125) {
1876
+ const plainEndPosition = plainTopLevelEndPosition(this.message);
1877
+ if (plainEndPosition) {
1878
+ const start = this.clonePosition();
1879
+ this.position = plainEndPosition;
1880
+ return {
1881
+ val: [{
1882
+ type: 0,
1883
+ value: this.message,
1884
+ location: createLocation(start, this.clonePosition())
1885
+ }],
1886
+ err: null
1887
+ };
1888
+ }
1889
+ }
1890
+ }
1842
1891
  return this.parseMessage(0, "", false);
1843
1892
  }
1844
1893
  parseMessage(nestingLevel, parentArgType, expectingCloseTag) {