@formatjs/intl 2.10.7 → 2.10.9

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.
package/index.js CHANGED
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createIntl = exports.formatNumberToParts = exports.formatNumber = exports.formatRelativeTime = exports.formatPlural = exports.formatList = exports.formatDisplayName = exports.formatTimeToParts = exports.formatTime = exports.formatDateToParts = exports.formatDate = exports.formatMessage = exports.getNamedFormat = exports.createFormatters = exports.DEFAULT_INTL_CONFIG = exports.filterProps = exports.createIntlCache = exports.defineMessage = exports.defineMessages = void 0;
3
+ exports.createIntl = exports.formatNumberToParts = exports.formatNumber = exports.formatRelativeTime = exports.formatPlural = exports.formatList = exports.formatDisplayName = exports.formatTimeToParts = exports.formatTime = exports.formatDateToParts = exports.formatDate = exports.formatMessage = exports.getNamedFormat = exports.createFormatters = exports.DEFAULT_INTL_CONFIG = exports.filterProps = exports.createIntlCache = void 0;
4
+ exports.defineMessages = defineMessages;
5
+ exports.defineMessage = defineMessage;
4
6
  var tslib_1 = require("tslib");
5
7
  tslib_1.__exportStar(require("./src/types"), exports);
6
8
  function defineMessages(msgs) {
7
9
  return msgs;
8
10
  }
9
- exports.defineMessages = defineMessages;
10
11
  function defineMessage(msg) {
11
12
  return msg;
12
13
  }
13
- exports.defineMessage = defineMessage;
14
14
  var utils_1 = require("./src/utils");
15
15
  Object.defineProperty(exports, "createIntlCache", { enumerable: true, get: function () { return utils_1.createIntlCache; } });
16
16
  Object.defineProperty(exports, "filterProps", { enumerable: true, get: function () { return utils_1.filterProps; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formatjs/intl",
3
- "version": "2.10.7",
3
+ "version": "2.10.9",
4
4
  "description": "Internationalize JS apps. This library provides an API to format dates, numbers, and strings, including pluralization and handling translations.",
5
5
  "keywords": [
6
6
  "intl",
@@ -29,17 +29,17 @@
29
29
  "module": "lib/index.js",
30
30
  "sideEffects": false,
31
31
  "dependencies": {
32
- "tslib": "^2.4.0",
33
- "@formatjs/ecma402-abstract": "2.1.0",
34
- "@formatjs/fast-memoize": "2.2.0",
35
- "@formatjs/intl-displaynames": "6.6.9",
36
- "@formatjs/intl-listformat": "7.5.8",
37
- "intl-messageformat": "10.6.0",
38
- "@formatjs/icu-messageformat-parser": "2.7.9"
32
+ "tslib": "^2.7.0",
33
+ "@formatjs/ecma402-abstract": "2.2.0",
34
+ "@formatjs/fast-memoize": "2.2.1",
35
+ "@formatjs/icu-messageformat-parser": "2.8.0",
36
+ "intl-messageformat": "10.7.1",
37
+ "@formatjs/intl-displaynames": "6.7.0",
38
+ "@formatjs/intl-listformat": "7.6.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@formatjs/intl-numberformat": "8.11.0",
42
- "@formatjs/intl-datetimeformat": "6.13.0"
41
+ "@formatjs/intl-numberformat": "8.13.0",
42
+ "@formatjs/intl-datetimeformat": "6.15.0"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "typescript": "^4.7 || 5"
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createIntl = void 0;
3
+ exports.createIntl = createIntl;
4
4
  var tslib_1 = require("tslib");
5
5
  var utils_1 = require("./utils");
6
6
  var error_1 = require("./error");
@@ -56,4 +56,3 @@ function createIntl(config, cache) {
56
56
  // @ts-expect-error TODO: will get to this later
57
57
  $t: message_1.formatMessage.bind(null, resolvedConfig, formatters), formatList: list_1.formatList.bind(null, resolvedConfig, formatters.getListFormat), formatListToParts: list_1.formatListToParts.bind(null, resolvedConfig, formatters.getListFormat), formatDisplayName: displayName_1.formatDisplayName.bind(null, resolvedConfig, formatters.getDisplayNames) });
58
58
  }
59
- exports.createIntl = createIntl;
package/src/dateTime.js CHANGED
@@ -1,6 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatTimeToParts = exports.formatDateToParts = exports.formatDateTimeRange = exports.formatTime = exports.formatDate = exports.getFormatter = void 0;
3
+ exports.getFormatter = getFormatter;
4
+ exports.formatDate = formatDate;
5
+ exports.formatTime = formatTime;
6
+ exports.formatDateTimeRange = formatDateTimeRange;
7
+ exports.formatDateToParts = formatDateToParts;
8
+ exports.formatTimeToParts = formatTimeToParts;
4
9
  var tslib_1 = require("tslib");
5
10
  var utils_1 = require("./utils");
6
11
  var error_1 = require("./error");
@@ -42,7 +47,6 @@ function getFormatter(_a, type, getDateTimeFormat, options) {
42
47
  }
43
48
  return getDateTimeFormat(locale, filteredOptions);
44
49
  }
45
- exports.getFormatter = getFormatter;
46
50
  function formatDate(config, getDateTimeFormat) {
47
51
  var _a = [];
48
52
  for (var _i = 2; _i < arguments.length; _i++) {
@@ -58,7 +62,6 @@ function formatDate(config, getDateTimeFormat) {
58
62
  }
59
63
  return String(date);
60
64
  }
61
- exports.formatDate = formatDate;
62
65
  function formatTime(config, getDateTimeFormat) {
63
66
  var _a = [];
64
67
  for (var _i = 2; _i < arguments.length; _i++) {
@@ -74,7 +77,6 @@ function formatTime(config, getDateTimeFormat) {
74
77
  }
75
78
  return String(date);
76
79
  }
77
- exports.formatTime = formatTime;
78
80
  function formatDateTimeRange(config, getDateTimeFormat) {
79
81
  var _a = [];
80
82
  for (var _i = 2; _i < arguments.length; _i++) {
@@ -91,7 +93,6 @@ function formatDateTimeRange(config, getDateTimeFormat) {
91
93
  }
92
94
  return String(from);
93
95
  }
94
- exports.formatDateTimeRange = formatDateTimeRange;
95
96
  function formatDateToParts(config, getDateTimeFormat) {
96
97
  var _a = [];
97
98
  for (var _i = 2; _i < arguments.length; _i++) {
@@ -107,7 +108,6 @@ function formatDateToParts(config, getDateTimeFormat) {
107
108
  }
108
109
  return [];
109
110
  }
110
- exports.formatDateToParts = formatDateToParts;
111
111
  function formatTimeToParts(config, getDateTimeFormat) {
112
112
  var _a = [];
113
113
  for (var _i = 2; _i < arguments.length; _i++) {
@@ -123,4 +123,3 @@ function formatTimeToParts(config, getDateTimeFormat) {
123
123
  }
124
124
  return [];
125
125
  }
126
- exports.formatTimeToParts = formatTimeToParts;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatDisplayName = void 0;
3
+ exports.formatDisplayName = formatDisplayName;
4
4
  var utils_1 = require("./utils");
5
5
  var intl_messageformat_1 = require("intl-messageformat");
6
6
  var error_1 = require("./error");
@@ -24,4 +24,3 @@ function formatDisplayName(_a, getDisplayNames, value, options) {
24
24
  onError(new error_1.IntlFormatError('Error formatting display name.', locale, e));
25
25
  }
26
26
  }
27
- exports.formatDisplayName = formatDisplayName;
package/src/list.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatListToParts = exports.formatList = void 0;
3
+ exports.formatList = formatList;
4
+ exports.formatListToParts = formatListToParts;
4
5
  var tslib_1 = require("tslib");
5
6
  var utils_1 = require("./utils");
6
7
  var intl_messageformat_1 = require("intl-messageformat");
@@ -30,7 +31,6 @@ function formatList(opts, getListFormat, values, options) {
30
31
  }, []);
31
32
  return results.length === 1 ? results[0] : results.length === 0 ? '' : results;
32
33
  }
33
- exports.formatList = formatList;
34
34
  function formatListToParts(_a, getListFormat, values, options) {
35
35
  var locale = _a.locale, onError = _a.onError;
36
36
  if (options === void 0) { options = {}; }
@@ -63,4 +63,3 @@ function formatListToParts(_a, getListFormat, values, options) {
63
63
  // @ts-ignore
64
64
  return values;
65
65
  }
66
- exports.formatListToParts = formatListToParts;
package/src/number.js CHANGED
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatNumberToParts = exports.formatNumber = exports.getFormatter = void 0;
3
+ exports.getFormatter = getFormatter;
4
+ exports.formatNumber = formatNumber;
5
+ exports.formatNumberToParts = formatNumberToParts;
4
6
  var error_1 = require("./error");
5
7
  var utils_1 = require("./utils");
6
8
  var NUMBER_FORMAT_OPTIONS = [
@@ -39,7 +41,6 @@ function getFormatter(_a, getNumberFormat, options) {
39
41
  var filteredOptions = (0, utils_1.filterProps)(options, NUMBER_FORMAT_OPTIONS, defaults);
40
42
  return getNumberFormat(locale, filteredOptions);
41
43
  }
42
- exports.getFormatter = getFormatter;
43
44
  function formatNumber(config, getNumberFormat, value, options) {
44
45
  if (options === void 0) { options = {}; }
45
46
  try {
@@ -50,7 +51,6 @@ function formatNumber(config, getNumberFormat, value, options) {
50
51
  }
51
52
  return String(value);
52
53
  }
53
- exports.formatNumber = formatNumber;
54
54
  function formatNumberToParts(config, getNumberFormat, value, options) {
55
55
  if (options === void 0) { options = {}; }
56
56
  try {
@@ -61,4 +61,3 @@ function formatNumberToParts(config, getNumberFormat, value, options) {
61
61
  }
62
62
  return [];
63
63
  }
64
- exports.formatNumberToParts = formatNumberToParts;
package/src/plural.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatPlural = void 0;
3
+ exports.formatPlural = formatPlural;
4
4
  var utils_1 = require("./utils");
5
5
  var error_1 = require("./error");
6
6
  var intl_messageformat_1 = require("intl-messageformat");
@@ -20,4 +20,3 @@ function formatPlural(_a, getPluralRules, value, options) {
20
20
  }
21
21
  return 'other';
22
22
  }
23
- exports.formatPlural = formatPlural;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatRelativeTime = void 0;
3
+ exports.formatRelativeTime = formatRelativeTime;
4
4
  var utils_1 = require("./utils");
5
5
  var intl_messageformat_1 = require("intl-messageformat");
6
6
  var error_1 = require("./error");
@@ -30,4 +30,3 @@ function formatRelativeTime(config, getRelativeTimeFormat, value, unit, options)
30
30
  }
31
31
  return String(value);
32
32
  }
33
- exports.formatRelativeTime = formatRelativeTime;
package/src/utils.js CHANGED
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getNamedFormat = exports.createFormatters = exports.createIntlCache = exports.DEFAULT_INTL_CONFIG = exports.filterProps = void 0;
3
+ exports.DEFAULT_INTL_CONFIG = void 0;
4
+ exports.filterProps = filterProps;
5
+ exports.createIntlCache = createIntlCache;
6
+ exports.createFormatters = createFormatters;
7
+ exports.getNamedFormat = getNamedFormat;
4
8
  var tslib_1 = require("tslib");
5
9
  var intl_messageformat_1 = require("intl-messageformat");
6
10
  var fast_memoize_1 = require("@formatjs/fast-memoize");
@@ -17,7 +21,6 @@ function filterProps(props, allowlist, defaults) {
17
21
  return filtered;
18
22
  }, {});
19
23
  }
20
- exports.filterProps = filterProps;
21
24
  var defaultErrorHandler = function (error) {
22
25
  // @ts-ignore just so we don't need to declare dep on @types/node
23
26
  if (process.env.NODE_ENV !== 'production') {
@@ -51,7 +54,6 @@ function createIntlCache() {
51
54
  displayNames: {},
52
55
  };
53
56
  }
54
- exports.createIntlCache = createIntlCache;
55
57
  function createFastMemoizeCache(store) {
56
58
  return {
57
59
  create: function () {
@@ -154,7 +156,6 @@ function createFormatters(cache) {
154
156
  }),
155
157
  };
156
158
  }
157
- exports.createFormatters = createFormatters;
158
159
  function getNamedFormat(formats, type, name, onError) {
159
160
  var formatType = formats && formats[type];
160
161
  var format;
@@ -166,4 +167,3 @@ function getNamedFormat(formats, type, name, onError) {
166
167
  }
167
168
  onError(new error_1.UnsupportedFormatterError("No ".concat(type, " format named: ").concat(name)));
168
169
  }
169
- exports.getNamedFormat = getNamedFormat;