@formatjs/intl 1.14.3 → 1.16.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.
package/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
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;
4
4
  var tslib_1 = require("tslib");
5
- tslib_1.__exportStar(require("./src/types"), exports);
5
+ (0, tslib_1.__exportStar)(require("./src/types"), exports);
6
6
  function defineMessages(msgs) {
7
7
  return msgs;
8
8
  }
@@ -17,7 +17,7 @@ Object.defineProperty(exports, "filterProps", { enumerable: true, get: function
17
17
  Object.defineProperty(exports, "DEFAULT_INTL_CONFIG", { enumerable: true, get: function () { return utils_1.DEFAULT_INTL_CONFIG; } });
18
18
  Object.defineProperty(exports, "createFormatters", { enumerable: true, get: function () { return utils_1.createFormatters; } });
19
19
  Object.defineProperty(exports, "getNamedFormat", { enumerable: true, get: function () { return utils_1.getNamedFormat; } });
20
- tslib_1.__exportStar(require("./src/error"), exports);
20
+ (0, tslib_1.__exportStar)(require("./src/error"), exports);
21
21
  var message_1 = require("./src/message");
22
22
  Object.defineProperty(exports, "formatMessage", { enumerable: true, get: function () { return message_1.formatMessage; } });
23
23
  var dateTime_1 = require("./src/dateTime");
@@ -8,20 +8,24 @@ export declare enum IntlErrorCode {
8
8
  }
9
9
  export declare class IntlError<T extends IntlErrorCode = IntlErrorCode.FORMAT_ERROR> extends Error {
10
10
  readonly code: T;
11
- constructor(code: T, message: string, exception?: Error);
11
+ constructor(code: T, message: string, exception?: Error | unknown);
12
12
  }
13
13
  export declare class UnsupportedFormatterError extends IntlError<IntlErrorCode.UNSUPPORTED_FORMATTER> {
14
- constructor(message: string, exception?: Error);
14
+ constructor(message: string, exception?: Error | unknown);
15
15
  }
16
16
  export declare class InvalidConfigError extends IntlError<IntlErrorCode.INVALID_CONFIG> {
17
- constructor(message: string, exception?: Error);
17
+ constructor(message: string, exception?: Error | unknown);
18
18
  }
19
19
  export declare class MissingDataError extends IntlError<IntlErrorCode.MISSING_DATA> {
20
- constructor(message: string, exception?: Error);
20
+ constructor(message: string, exception?: Error | unknown);
21
21
  }
22
- export declare class MessageFormatError extends IntlError<IntlErrorCode.FORMAT_ERROR> {
22
+ export declare class IntlFormatError extends IntlError<IntlErrorCode.FORMAT_ERROR> {
23
23
  readonly descriptor?: MessageDescriptor;
24
- constructor(message: string, locale: string, descriptor?: MessageDescriptor, exception?: Error);
24
+ constructor(message: string, locale: string, exception?: Error | unknown);
25
+ }
26
+ export declare class MessageFormatError extends IntlFormatError {
27
+ readonly descriptor?: MessageDescriptor;
28
+ constructor(message: string, locale: string, descriptor?: MessageDescriptor, exception?: Error | unknown);
25
29
  }
26
30
  export declare class MissingTranslationError extends IntlError<IntlErrorCode.MISSING_TRANSLATION> {
27
31
  readonly descriptor?: MessageDescriptor;
@@ -1 +1 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../../../../../packages/intl/src/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAC,MAAM,SAAS,CAAA;AAEzC,oBAAY,aAAa;IACvB,YAAY,iBAAiB;IAC7B,qBAAqB,0BAA0B;IAC/C,cAAc,mBAAmB;IACjC,YAAY,iBAAiB;IAC7B,mBAAmB,wBAAwB;CAC5C;AAED,qBAAa,SAAS,CACpB,CAAC,SAAS,aAAa,GAAG,aAAa,CAAC,YAAY,CACpD,SAAQ,KAAK;IACb,SAAgB,IAAI,EAAE,CAAC,CAAA;gBAEX,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC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O,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,KAAK,GAAG,OAAO;CAiBlE;AAED,qBAAa,yBAA0B,SAAQ,SAAS,CAAC,aAAa,CAAC,qBAAqB,CAAC;gBAC/E,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,KAAK,GAAG,OAAO;CAGzD;AAED,qBAAa,kBAAmB,SAAQ,SAAS,CAAC,aAAa,CAAC,cAAc,CAAC;gBACjE,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,KAAK,GAAG,OAAO;CAGzD;AAED,qBAAa,gBAAiB,SAAQ,SAAS,CAAC,aAAa,CAAC,YAAY,CAAC;gBAC7D,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,KAAK,GAAG,OAAO;CAGzD;AAED,qBAAa,eAAgB,SAAQ,SAAS,CAAC,aAAa,CAAC,YAAY,CAAC;IACxE,SAAgB,UAAU,CAAC,EAAE,iBAAiB,CAAA;gBAClC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,KAAK,GAAG,OAAO;CASzE;AAED,qBAAa,kBAAmB,SAAQ,eAAe;IACrD,SAAgB,UAAU,CAAC,EAAE,iBAAiB,CAAA;gBAE5C,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,iBAAiB,EAC9B,SAAS,CAAC,EAAE,KAAK,GAAG,OAAO;CAa9B;AAED,qBAAa,uBAAwB,SAAQ,SAAS,CAAC,aAAa,CAAC,mBAAmB,CAAC;IACvF,SAAgB,UAAU,CAAC,EAAE,iBAAiB,CAAA;gBAClC,UAAU,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM;CAS1D"}
package/lib/src/error.js CHANGED
@@ -10,7 +10,13 @@ export var IntlErrorCode;
10
10
  var IntlError = /** @class */ (function (_super) {
11
11
  __extends(IntlError, _super);
12
12
  function IntlError(code, message, exception) {
13
- var _this = _super.call(this, "[@formatjs/intl Error " + code + "] " + message + " \n" + (exception ? "\n" + exception.message + "\n" + exception.stack : '')) || this;
13
+ var _this = this;
14
+ var err = exception
15
+ ? exception instanceof Error
16
+ ? exception
17
+ : new Error(String(exception))
18
+ : undefined;
19
+ _this = _super.call(this, "[@formatjs/intl Error " + code + "] " + message + " \n" + (err ? "\n" + err.message + "\n" + err.stack : '')) || this;
14
20
  _this.code = code;
15
21
  // @ts-ignore just so we don't need to declare dep on @types/node
16
22
  if (typeof Error.captureStackTrace === 'function') {
@@ -46,15 +52,23 @@ var MissingDataError = /** @class */ (function (_super) {
46
52
  return MissingDataError;
47
53
  }(IntlError));
48
54
  export { MissingDataError };
55
+ var IntlFormatError = /** @class */ (function (_super) {
56
+ __extends(IntlFormatError, _super);
57
+ function IntlFormatError(message, locale, exception) {
58
+ return _super.call(this, IntlErrorCode.FORMAT_ERROR, message + " \nLocale: " + locale + "\n", exception) || this;
59
+ }
60
+ return IntlFormatError;
61
+ }(IntlError));
62
+ export { IntlFormatError };
49
63
  var MessageFormatError = /** @class */ (function (_super) {
50
64
  __extends(MessageFormatError, _super);
51
65
  function MessageFormatError(message, locale, descriptor, exception) {
52
- var _this = _super.call(this, IntlErrorCode.FORMAT_ERROR, message + " \nLocale: " + locale + "\nMessageID: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.id) + "\nDefault Message: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.defaultMessage) + "\nDescription: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.description) + " \n", exception) || this;
66
+ var _this = _super.call(this, message + " \nMessageID: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.id) + "\nDefault Message: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.defaultMessage) + "\nDescription: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.description) + " \n", locale, exception) || this;
53
67
  _this.descriptor = descriptor;
54
68
  return _this;
55
69
  }
56
70
  return MessageFormatError;
57
- }(IntlError));
71
+ }(IntlFormatError));
58
72
  export { MessageFormatError };
59
73
  var MissingTranslationError = /** @class */ (function (_super) {
60
74
  __extends(MissingTranslationError, _super);
@@ -24,7 +24,7 @@ function deepMergeFormatsAndSetTimeZone(f1, timeZone) {
24
24
  return __assign(__assign(__assign({}, mfFormats), f1), { date: deepMergeOptions(setTimeZoneInOptions(mfFormats.date, timeZone), setTimeZoneInOptions(f1.date || {}, timeZone)), time: deepMergeOptions(setTimeZoneInOptions(mfFormats.time, timeZone), setTimeZoneInOptions(f1.time || {}, timeZone)) });
25
25
  }
26
26
  export function formatMessage(_a, state, messageDescriptor, values, opts) {
27
- var locale = _a.locale, formats = _a.formats, messages = _a.messages, defaultLocale = _a.defaultLocale, defaultFormats = _a.defaultFormats, onError = _a.onError, timeZone = _a.timeZone, defaultRichTextElements = _a.defaultRichTextElements;
27
+ var locale = _a.locale, formats = _a.formats, messages = _a.messages, defaultLocale = _a.defaultLocale, defaultFormats = _a.defaultFormats, fallbackOnEmptyString = _a.fallbackOnEmptyString, onError = _a.onError, timeZone = _a.timeZone, defaultRichTextElements = _a.defaultRichTextElements;
28
28
  if (messageDescriptor === void 0) { messageDescriptor = { id: '' }; }
29
29
  var msgId = messageDescriptor.id, defaultMessage = messageDescriptor.defaultMessage;
30
30
  // `id` is a required field of a Message Descriptor.
@@ -54,6 +54,9 @@ export function formatMessage(_a, state, messageDescriptor, values, opts) {
54
54
  formats = deepMergeFormatsAndSetTimeZone(formats, timeZone);
55
55
  defaultFormats = deepMergeFormatsAndSetTimeZone(defaultFormats, timeZone);
56
56
  if (!message) {
57
+ if (fallbackOnEmptyString === false && message === '') {
58
+ return message;
59
+ }
57
60
  if (!defaultMessage ||
58
61
  (locale && locale.toLowerCase() !== defaultLocale.toLowerCase())) {
59
62
  // This prevents warnings from littering the console in development
package/lib/src/plural.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { filterProps } from './utils';
2
- import { MessageFormatError } from './error';
2
+ import { IntlFormatError } from './error';
3
3
  import { ErrorCode, FormatError } from 'intl-messageformat';
4
4
  var PLURAL_FORMAT_OPTIONS = [
5
5
  'localeMatcher',
@@ -16,7 +16,7 @@ export function formatPlural(_a, getPluralRules, value, options) {
16
16
  return getPluralRules(locale, filteredOptions).select(value);
17
17
  }
18
18
  catch (e) {
19
- onError(new MessageFormatError('Error formatting plural.', e));
19
+ onError(new IntlFormatError('Error formatting plural.', locale, e));
20
20
  }
21
21
  return 'other';
22
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"relativeTime.d.ts","sourceRoot":"","sources":["../../../../../../../packages/intl/src/relativeTime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAC,MAAM,SAAS,CAAA;AAoC5E,wBAAgB,kBAAkB,CAChC,MAAM,EAAE;IACN,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,aAAa,CAAA;IACtB,OAAO,EAAE,SAAS,CAAA;CACnB,EACD,qBAAqB,EAAE,UAAU,CAAC,uBAAuB,CAAC,EAC1D,KAAK,EAAE,UAAU,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,EAC1D,IAAI,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,EAC1D,OAAO,GAAE,UAAU,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAM,GAChE,MAAM,CAyBR"}
1
+ {"version":3,"file":"relativeTime.d.ts","sourceRoot":"","sources":["../../../../../../../packages/intl/src/relativeTime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAC,MAAM,SAAS,CAAA;AAoC5E,wBAAgB,kBAAkB,CAChC,MAAM,EAAE;IACN,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,aAAa,CAAA;IACtB,OAAO,EAAE,SAAS,CAAA;CACnB,EACD,qBAAqB,EAAE,UAAU,CAAC,uBAAuB,CAAC,EAC1D,KAAK,EAAE,UAAU,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,EAC1D,IAAI,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,EAC1D,OAAO,GAAE,UAAU,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAM,GAChE,MAAM,CA2BR"}
@@ -1,6 +1,6 @@
1
1
  import { getNamedFormat, filterProps } from './utils';
2
2
  import { FormatError, ErrorCode } from 'intl-messageformat';
3
- import { MessageFormatError } from './error';
3
+ import { IntlFormatError } from './error';
4
4
  var RELATIVE_TIME_FORMAT_OPTIONS = ['numeric', 'style'];
5
5
  function getFormatter(_a, getRelativeTimeFormat, options) {
6
6
  var locale = _a.locale, formats = _a.formats, onError = _a.onError;
@@ -23,7 +23,7 @@ export function formatRelativeTime(config, getRelativeTimeFormat, value, unit, o
23
23
  return getFormatter(config, getRelativeTimeFormat, options).format(value, unit);
24
24
  }
25
25
  catch (e) {
26
- config.onError(new MessageFormatError('Error formatting relative time.', e));
26
+ config.onError(new IntlFormatError('Error formatting relative time.', config.locale, e));
27
27
  }
28
28
  return String(value);
29
29
  }
@@ -6,6 +6,15 @@ import { DisplayNames, DisplayNamesOptions } from '@formatjs/intl-displaynames';
6
6
  import { MissingTranslationError, MessageFormatError, MissingDataError, InvalidConfigError, UnsupportedFormatterError } from './error';
7
7
  import { DEFAULT_INTL_CONFIG } from './utils';
8
8
  import { NumberFormatOptions } from '@formatjs/ecma402-abstract';
9
+ declare global {
10
+ namespace FormatjsIntl {
11
+ interface Message {
12
+ }
13
+ }
14
+ }
15
+ declare type MessageIds = FormatjsIntl.Message extends {
16
+ ids: string;
17
+ } ? FormatjsIntl.Message['ids'] : string;
9
18
  export declare type OnErrorFn = (err: MissingTranslationError | MessageFormatError | MissingDataError | InvalidConfigError | UnsupportedFormatterError | FormatError) => void;
10
19
  /**
11
20
  * Config for intl object.
@@ -15,8 +24,9 @@ export declare type OnErrorFn = (err: MissingTranslationError | MessageFormatErr
15
24
  export interface ResolvedIntlConfig<T = string> {
16
25
  locale: string;
17
26
  timeZone?: string;
27
+ fallbackOnEmptyString?: boolean;
18
28
  formats: CustomFormats;
19
- messages: Record<string, string> | Record<string, MessageFormatElement[]>;
29
+ messages: Record<MessageIds, string> | Record<MessageIds, MessageFormatElement[]>;
20
30
  defaultLocale: string;
21
31
  defaultFormats: CustomFormats;
22
32
  defaultRichTextElements?: Record<string, FormatXMLElementFn<T>>;
@@ -73,9 +83,10 @@ export interface IntlCache {
73
83
  displayNames: Record<string, DisplayNames>;
74
84
  }
75
85
  export interface MessageDescriptor {
76
- id?: string | number;
86
+ id?: MessageIds;
77
87
  description?: string | object;
78
88
  defaultMessage?: string | MessageFormatElement[];
79
89
  }
80
90
  export declare type IntlConfig<T = string> = Omit<ResolvedIntlConfig<T>, keyof typeof DEFAULT_INTL_CONFIG> & Partial<typeof DEFAULT_INTL_CONFIG>;
91
+ export {};
81
92
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../packages/intl/src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,OAAO,EACP,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,OAAO,IAAI,wBAAwB,EACpC,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAC,cAAc,EAAC,MAAM,4BAA4B,CAAA;AACzD,OAAO,EAAC,oBAAoB,EAAC,MAAM,oCAAoC,CAAA;AACvE,OAAO,cAAc,EAAE,EACrB,qBAAqB,EACrB,IAAI,EACL,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAC,YAAY,EAAE,mBAAmB,EAAC,MAAM,6BAA6B,CAAA;AAC7E,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,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C,CAAA;CAC3C;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,CAAC,EAAE,UAAU,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC7B,cAAc,CAAC,EAAE,MAAM,GAAG,oBAAoB,EAAE,CAAA;CACjD;AAED,oBAAY,UAAU,CAAC,CAAC,GAAG,MAAM,IAAI,IAAI,CACvC,kBAAkB,CAAC,CAAC,CAAC,EACrB,MAAM,OAAO,mBAAmB,CACjC,GACC,OAAO,CAAC,OAAO,mBAAmB,CAAC,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { IntlCache, CustomFormats, Formatters, OnErrorFn, ResolvedIntlConfig } from './types';
2
2
  export declare function filterProps<T extends Record<string, any>, K extends string>(props: T, whitelist: Array<K>, defaults?: Partial<T>): Pick<T, K>;
3
- export declare const DEFAULT_INTL_CONFIG: Pick<ResolvedIntlConfig<any>, 'formats' | 'messages' | 'timeZone' | 'defaultLocale' | 'defaultFormats' | 'onError'>;
3
+ export declare const DEFAULT_INTL_CONFIG: Pick<ResolvedIntlConfig<any>, 'fallbackOnEmptyString' | 'formats' | 'messages' | 'timeZone' | 'defaultLocale' | 'defaultFormats' | 'onError'>;
4
4
  export declare function createIntlCache(): IntlCache;
5
5
  /**
6
6
  * Create intl formatters and populate cache
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../../packages/intl/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,aAAa,EACb,UAAU,EACV,SAAS,EACT,kBAAkB,EACnB,MAAM,SAAS,CAAA;AAMhB,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC,SAAS,MAAM,EACzE,KAAK,EAAE,CAAC,EACR,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,EACnB,QAAQ,GAAE,OAAO,CAAC,CAAC,CAAM,GACxB,IAAI,CAAC,CAAC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B,KAAK,GAAE,SAA6B,GACnC,UAAU,CAsDZ;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,aAAa,EAC1D,OAAO,EAAE,aAAa,EACtB,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,SAAS,GAEhB,IAAI,CAAC,mBAAmB,GACxB,IAAI,CAAC,qBAAqB,GAC1B,IAAI,CAAC,yBAAyB,GAC9B,SAAS,CAWZ"}
package/lib/src/utils.js CHANGED
@@ -26,6 +26,7 @@ export var DEFAULT_INTL_CONFIG = {
26
26
  timeZone: undefined,
27
27
  defaultLocale: 'en',
28
28
  defaultFormats: {},
29
+ fallbackOnEmptyString: true,
29
30
  onError: defaultErrorHandler,
30
31
  };
31
32
  export function createIntlCache() {
@@ -68,7 +69,7 @@ export function createFormatters(cache) {
68
69
  for (var _i = 0; _i < arguments.length; _i++) {
69
70
  args[_i] = arguments[_i];
70
71
  }
71
- return new ((_a = Intl.DateTimeFormat).bind.apply(_a, __spreadArray([void 0], args)))();
72
+ return new ((_a = Intl.DateTimeFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();
72
73
  }, {
73
74
  cache: createFastMemoizeCache(cache.dateTime),
74
75
  strategy: strategies.variadic,
@@ -79,7 +80,7 @@ export function createFormatters(cache) {
79
80
  for (var _i = 0; _i < arguments.length; _i++) {
80
81
  args[_i] = arguments[_i];
81
82
  }
82
- return new ((_a = Intl.NumberFormat).bind.apply(_a, __spreadArray([void 0], args)))();
83
+ return new ((_a = Intl.NumberFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();
83
84
  }, {
84
85
  cache: createFastMemoizeCache(cache.number),
85
86
  strategy: strategies.variadic,
@@ -90,7 +91,7 @@ export function createFormatters(cache) {
90
91
  for (var _i = 0; _i < arguments.length; _i++) {
91
92
  args[_i] = arguments[_i];
92
93
  }
93
- return new ((_a = Intl.PluralRules).bind.apply(_a, __spreadArray([void 0], args)))();
94
+ return new ((_a = Intl.PluralRules).bind.apply(_a, __spreadArray([void 0], args, false)))();
94
95
  }, {
95
96
  cache: createFastMemoizeCache(cache.pluralRules),
96
97
  strategy: strategies.variadic,
@@ -113,7 +114,7 @@ export function createFormatters(cache) {
113
114
  for (var _i = 0; _i < arguments.length; _i++) {
114
115
  args[_i] = arguments[_i];
115
116
  }
116
- return new (RelativeTimeFormat.bind.apply(RelativeTimeFormat, __spreadArray([void 0], args)))();
117
+ return new (RelativeTimeFormat.bind.apply(RelativeTimeFormat, __spreadArray([void 0], args, false)))();
117
118
  }, {
118
119
  cache: createFastMemoizeCache(cache.relativeTime),
119
120
  strategy: strategies.variadic,
@@ -124,7 +125,7 @@ export function createFormatters(cache) {
124
125
  for (var _i = 0; _i < arguments.length; _i++) {
125
126
  args[_i] = arguments[_i];
126
127
  }
127
- return new (ListFormat.bind.apply(ListFormat, __spreadArray([void 0], args)))();
128
+ return new (ListFormat.bind.apply(ListFormat, __spreadArray([void 0], args, false)))();
128
129
  }, {
129
130
  cache: createFastMemoizeCache(cache.list),
130
131
  strategy: strategies.variadic,
@@ -134,7 +135,7 @@ export function createFormatters(cache) {
134
135
  for (var _i = 0; _i < arguments.length; _i++) {
135
136
  args[_i] = arguments[_i];
136
137
  }
137
- return new (DisplayNames.bind.apply(DisplayNames, __spreadArray([void 0], args)))();
138
+ return new (DisplayNames.bind.apply(DisplayNames, __spreadArray([void 0], args, false)))();
138
139
  }, {
139
140
  cache: createFastMemoizeCache(cache.displayNames),
140
141
  strategy: strategies.variadic,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formatjs/intl",
3
- "version": "1.14.3",
3
+ "version": "1.16.0",
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",
@@ -31,14 +31,14 @@
31
31
  "dependencies": {
32
32
  "@formatjs/ecma402-abstract": "1.10.0",
33
33
  "@formatjs/fast-memoize": "1.2.0",
34
- "@formatjs/icu-messageformat-parser": "2.0.13",
34
+ "@formatjs/icu-messageformat-parser": "2.0.14",
35
35
  "@formatjs/intl-displaynames": "5.2.5",
36
36
  "@formatjs/intl-listformat": "6.3.5",
37
- "intl-messageformat": "9.9.3",
37
+ "intl-messageformat": "9.9.6",
38
38
  "tslib": "^2.1.0"
39
39
  },
40
40
  "peerDependencies": {
41
- "typescript": "^4.3"
41
+ "typescript": "^4.4"
42
42
  },
43
43
  "peerDependenciesMeta": {
44
44
  "typescript": {
@@ -27,8 +27,8 @@ function verifyConfigMessages(config) {
27
27
  * @param cache cache for formatter instances to prevent memory leak
28
28
  */
29
29
  function createIntl(config, cache) {
30
- var formatters = utils_1.createFormatters(cache);
31
- var resolvedConfig = tslib_1.__assign(tslib_1.__assign({}, utils_1.DEFAULT_INTL_CONFIG), config);
30
+ var formatters = (0, utils_1.createFormatters)(cache);
31
+ var resolvedConfig = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, utils_1.DEFAULT_INTL_CONFIG), config);
32
32
  var locale = resolvedConfig.locale, defaultLocale = resolvedConfig.defaultLocale, onError = resolvedConfig.onError;
33
33
  if (!locale) {
34
34
  if (onError) {
@@ -49,6 +49,6 @@ function createIntl(config, cache) {
49
49
  onError(new error_1.MissingDataError("Missing locale data for locale: \"" + locale + "\" in Intl.DateTimeFormat. Using default locale: \"" + defaultLocale + "\" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details"));
50
50
  }
51
51
  verifyConfigMessages(resolvedConfig);
52
- return tslib_1.__assign(tslib_1.__assign({}, resolvedConfig), { formatters: formatters, formatNumber: number_1.formatNumber.bind(null, resolvedConfig, formatters.getNumberFormat), formatNumberToParts: number_1.formatNumberToParts.bind(null, resolvedConfig, formatters.getNumberFormat), formatRelativeTime: relativeTime_1.formatRelativeTime.bind(null, resolvedConfig, formatters.getRelativeTimeFormat), formatDate: dateTime_1.formatDate.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatDateToParts: dateTime_1.formatDateToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTime: dateTime_1.formatTime.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatDateTimeRange: dateTime_1.formatDateTimeRange.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTimeToParts: dateTime_1.formatTimeToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatPlural: plural_1.formatPlural.bind(null, resolvedConfig, formatters.getPluralRules), formatMessage: 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) });
52
+ return (0, tslib_1.__assign)((0, tslib_1.__assign)({}, resolvedConfig), { formatters: formatters, formatNumber: number_1.formatNumber.bind(null, resolvedConfig, formatters.getNumberFormat), formatNumberToParts: number_1.formatNumberToParts.bind(null, resolvedConfig, formatters.getNumberFormat), formatRelativeTime: relativeTime_1.formatRelativeTime.bind(null, resolvedConfig, formatters.getRelativeTimeFormat), formatDate: dateTime_1.formatDate.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatDateToParts: dateTime_1.formatDateToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTime: dateTime_1.formatTime.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatDateTimeRange: dateTime_1.formatDateTimeRange.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTimeToParts: dateTime_1.formatTimeToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatPlural: plural_1.formatPlural.bind(null, resolvedConfig, formatters.getPluralRules), formatMessage: 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) });
53
53
  }
54
54
  exports.createIntl = createIntl;
package/src/dateTime.js CHANGED
@@ -29,8 +29,8 @@ function getFormatter(_a, type, getDateTimeFormat, options) {
29
29
  var locale = _a.locale, formats = _a.formats, onError = _a.onError, timeZone = _a.timeZone;
30
30
  if (options === void 0) { options = {}; }
31
31
  var format = options.format;
32
- var defaults = tslib_1.__assign(tslib_1.__assign({}, (timeZone && { timeZone: timeZone })), (format && utils_1.getNamedFormat(formats, type, format, onError)));
33
- var filteredOptions = utils_1.filterProps(options, DATE_TIME_FORMAT_OPTIONS,
32
+ var defaults = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, (timeZone && { timeZone: timeZone })), (format && (0, utils_1.getNamedFormat)(formats, type, format, onError)));
33
+ var filteredOptions = (0, utils_1.filterProps)(options, DATE_TIME_FORMAT_OPTIONS,
34
34
  // @ts-expect-error es2020 has a lot stuff from es2021 bleed in
35
35
  defaults);
36
36
  if (type === 'time' &&
@@ -40,7 +40,7 @@ function getFormatter(_a, type, getDateTimeFormat, options) {
40
40
  !filteredOptions.timeStyle &&
41
41
  !filteredOptions.dateStyle) {
42
42
  // Add default formatting options if hour, minute, or second isn't defined.
43
- filteredOptions = tslib_1.__assign(tslib_1.__assign({}, filteredOptions), { hour: 'numeric', minute: 'numeric' });
43
+ filteredOptions = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, filteredOptions), { hour: 'numeric', minute: 'numeric' });
44
44
  }
45
45
  return getDateTimeFormat(locale, filteredOptions);
46
46
  }
@@ -84,7 +84,7 @@ function formatDateTimeRange(config, getDateTimeFormat) {
84
84
  }
85
85
  var from = _a[0], to = _a[1], _b = _a[2], options = _b === void 0 ? {} : _b;
86
86
  var timeZone = config.timeZone, locale = config.locale, onError = config.onError;
87
- var filteredOptions = utils_1.filterProps(options, DATE_TIME_FORMAT_OPTIONS, timeZone ? { timeZone: timeZone } : {});
87
+ var filteredOptions = (0, utils_1.filterProps)(options, DATE_TIME_FORMAT_OPTIONS, timeZone ? { timeZone: timeZone } : {});
88
88
  try {
89
89
  return getDateTimeFormat(locale, filteredOptions).formatRange(from, to);
90
90
  }
@@ -16,7 +16,7 @@ function formatDisplayName(_a, getDisplayNames, value, options) {
16
16
  if (!DisplayNames) {
17
17
  onError(new intl_messageformat_1.FormatError("Intl.DisplayNames is not available in this environment.\nTry polyfilling it using \"@formatjs/intl-displaynames\"\n", intl_messageformat_1.ErrorCode.MISSING_INTL_API));
18
18
  }
19
- var filteredOptions = utils_1.filterProps(options, DISPLAY_NAMES_OPTONS);
19
+ var filteredOptions = (0, utils_1.filterProps)(options, DISPLAY_NAMES_OPTONS);
20
20
  try {
21
21
  return getDisplayNames(locale, filteredOptions).of(value);
22
22
  }
package/src/error.d.ts CHANGED
@@ -8,20 +8,24 @@ export declare enum IntlErrorCode {
8
8
  }
9
9
  export declare class IntlError<T extends IntlErrorCode = IntlErrorCode.FORMAT_ERROR> extends Error {
10
10
  readonly code: T;
11
- constructor(code: T, message: string, exception?: Error);
11
+ constructor(code: T, message: string, exception?: Error | unknown);
12
12
  }
13
13
  export declare class UnsupportedFormatterError extends IntlError<IntlErrorCode.UNSUPPORTED_FORMATTER> {
14
- constructor(message: string, exception?: Error);
14
+ constructor(message: string, exception?: Error | unknown);
15
15
  }
16
16
  export declare class InvalidConfigError extends IntlError<IntlErrorCode.INVALID_CONFIG> {
17
- constructor(message: string, exception?: Error);
17
+ constructor(message: string, exception?: Error | unknown);
18
18
  }
19
19
  export declare class MissingDataError extends IntlError<IntlErrorCode.MISSING_DATA> {
20
- constructor(message: string, exception?: Error);
20
+ constructor(message: string, exception?: Error | unknown);
21
21
  }
22
- export declare class MessageFormatError extends IntlError<IntlErrorCode.FORMAT_ERROR> {
22
+ export declare class IntlFormatError extends IntlError<IntlErrorCode.FORMAT_ERROR> {
23
23
  readonly descriptor?: MessageDescriptor;
24
- constructor(message: string, locale: string, descriptor?: MessageDescriptor, exception?: Error);
24
+ constructor(message: string, locale: string, exception?: Error | unknown);
25
+ }
26
+ export declare class MessageFormatError extends IntlFormatError {
27
+ readonly descriptor?: MessageDescriptor;
28
+ constructor(message: string, locale: string, descriptor?: MessageDescriptor, exception?: Error | unknown);
25
29
  }
26
30
  export declare class MissingTranslationError extends IntlError<IntlErrorCode.MISSING_TRANSLATION> {
27
31
  readonly descriptor?: MessageDescriptor;
@@ -1 +1 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../../../../packages/intl/src/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAC,MAAM,SAAS,CAAA;AAEzC,oBAAY,aAAa;IACvB,YAAY,iBAAiB;IAC7B,qBAAqB,0BAA0B;IAC/C,cAAc,mBAAmB;IACjC,YAAY,iBAAiB;IAC7B,mBAAmB,wBAAwB;CAC5C;AAED,qBAAa,SAAS,CACpB,CAAC,SAAS,aAAa,GAAG,aAAa,CAAC,YAAY,CACpD,SAAQ,KAAK;IACb,SAAgB,IAAI,EAAE,CAAC,CAAA;gBAEX,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,KAAK;CAYxD;AAED,qBAAa,yBAA0B,SAAQ,SAAS,CAAC,aAAa,CAAC,qBAAqB,CAAC;gBAC/E,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,KAAK;CAG/C;AAED,qBAAa,kBAAmB,SAAQ,SAAS,CAAC,aAAa,CAAC,cAAc,CAAC;gBACjE,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,KAAK;CAG/C;AAED,qBAAa,gBAAiB,SAAQ,SAAS,CAAC,aAAa,CAAC,YAAY,CAAC;gBAC7D,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,KAAK;CAG/C;AAED,qBAAa,kBAAmB,SAAQ,SAAS,CAAC,aAAa,CAAC,YAAY,CAAC;IAC3E,SAAgB,UAAU,CAAC,EAAE,iBAAiB,CAAA;gBAE5C,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,iBA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;gBAClC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,KAAK,GAAG,OAAO;CASzE;AAED,qBAAa,kBAAmB,SAAQ,eAAe;IACrD,SAAgB,UAAU,CAAC,EAAE,iBAAiB,CAAA;gBAE5C,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,iBAAiB,EAC9B,SAAS,CAAC,EAAE,KAAK,GAAG,OAAO;CAa9B;AAED,qBAAa,uBAAwB,SAAQ,SAAS,CAAC,aAAa,CAAC,mBAAmB,CAAC;IACvF,SAAgB,UAAU,CAAC,EAAE,iBAAiB,CAAA;gBAClC,UAAU,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM;CAS1D"}
package/src/error.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MissingTranslationError = exports.MessageFormatError = exports.MissingDataError = exports.InvalidConfigError = exports.UnsupportedFormatterError = exports.IntlError = exports.IntlErrorCode = void 0;
3
+ exports.MissingTranslationError = exports.MessageFormatError = exports.IntlFormatError = exports.MissingDataError = exports.InvalidConfigError = exports.UnsupportedFormatterError = exports.IntlError = exports.IntlErrorCode = void 0;
4
4
  var tslib_1 = require("tslib");
5
5
  var IntlErrorCode;
6
6
  (function (IntlErrorCode) {
@@ -11,9 +11,15 @@ var IntlErrorCode;
11
11
  IntlErrorCode["MISSING_TRANSLATION"] = "MISSING_TRANSLATION";
12
12
  })(IntlErrorCode = exports.IntlErrorCode || (exports.IntlErrorCode = {}));
13
13
  var IntlError = /** @class */ (function (_super) {
14
- tslib_1.__extends(IntlError, _super);
14
+ (0, tslib_1.__extends)(IntlError, _super);
15
15
  function IntlError(code, message, exception) {
16
- var _this = _super.call(this, "[@formatjs/intl Error " + code + "] " + message + " \n" + (exception ? "\n" + exception.message + "\n" + exception.stack : '')) || this;
16
+ var _this = this;
17
+ var err = exception
18
+ ? exception instanceof Error
19
+ ? exception
20
+ : new Error(String(exception))
21
+ : undefined;
22
+ _this = _super.call(this, "[@formatjs/intl Error " + code + "] " + message + " \n" + (err ? "\n" + err.message + "\n" + err.stack : '')) || this;
17
23
  _this.code = code;
18
24
  // @ts-ignore just so we don't need to declare dep on @types/node
19
25
  if (typeof Error.captureStackTrace === 'function') {
@@ -26,7 +32,7 @@ var IntlError = /** @class */ (function (_super) {
26
32
  }(Error));
27
33
  exports.IntlError = IntlError;
28
34
  var UnsupportedFormatterError = /** @class */ (function (_super) {
29
- tslib_1.__extends(UnsupportedFormatterError, _super);
35
+ (0, tslib_1.__extends)(UnsupportedFormatterError, _super);
30
36
  function UnsupportedFormatterError(message, exception) {
31
37
  return _super.call(this, IntlErrorCode.UNSUPPORTED_FORMATTER, message, exception) || this;
32
38
  }
@@ -34,7 +40,7 @@ var UnsupportedFormatterError = /** @class */ (function (_super) {
34
40
  }(IntlError));
35
41
  exports.UnsupportedFormatterError = UnsupportedFormatterError;
36
42
  var InvalidConfigError = /** @class */ (function (_super) {
37
- tslib_1.__extends(InvalidConfigError, _super);
43
+ (0, tslib_1.__extends)(InvalidConfigError, _super);
38
44
  function InvalidConfigError(message, exception) {
39
45
  return _super.call(this, IntlErrorCode.INVALID_CONFIG, message, exception) || this;
40
46
  }
@@ -42,25 +48,33 @@ var InvalidConfigError = /** @class */ (function (_super) {
42
48
  }(IntlError));
43
49
  exports.InvalidConfigError = InvalidConfigError;
44
50
  var MissingDataError = /** @class */ (function (_super) {
45
- tslib_1.__extends(MissingDataError, _super);
51
+ (0, tslib_1.__extends)(MissingDataError, _super);
46
52
  function MissingDataError(message, exception) {
47
53
  return _super.call(this, IntlErrorCode.MISSING_DATA, message, exception) || this;
48
54
  }
49
55
  return MissingDataError;
50
56
  }(IntlError));
51
57
  exports.MissingDataError = MissingDataError;
58
+ var IntlFormatError = /** @class */ (function (_super) {
59
+ (0, tslib_1.__extends)(IntlFormatError, _super);
60
+ function IntlFormatError(message, locale, exception) {
61
+ return _super.call(this, IntlErrorCode.FORMAT_ERROR, message + " \nLocale: " + locale + "\n", exception) || this;
62
+ }
63
+ return IntlFormatError;
64
+ }(IntlError));
65
+ exports.IntlFormatError = IntlFormatError;
52
66
  var MessageFormatError = /** @class */ (function (_super) {
53
- tslib_1.__extends(MessageFormatError, _super);
67
+ (0, tslib_1.__extends)(MessageFormatError, _super);
54
68
  function MessageFormatError(message, locale, descriptor, exception) {
55
- var _this = _super.call(this, IntlErrorCode.FORMAT_ERROR, message + " \nLocale: " + locale + "\nMessageID: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.id) + "\nDefault Message: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.defaultMessage) + "\nDescription: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.description) + " \n", exception) || this;
69
+ var _this = _super.call(this, message + " \nMessageID: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.id) + "\nDefault Message: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.defaultMessage) + "\nDescription: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.description) + " \n", locale, exception) || this;
56
70
  _this.descriptor = descriptor;
57
71
  return _this;
58
72
  }
59
73
  return MessageFormatError;
60
- }(IntlError));
74
+ }(IntlFormatError));
61
75
  exports.MessageFormatError = MessageFormatError;
62
76
  var MissingTranslationError = /** @class */ (function (_super) {
63
- tslib_1.__extends(MissingTranslationError, _super);
77
+ (0, tslib_1.__extends)(MissingTranslationError, _super);
64
78
  function MissingTranslationError(descriptor, locale) {
65
79
  var _this = _super.call(this, IntlErrorCode.MISSING_TRANSLATION, "Missing message: \"" + descriptor.id + "\" for locale \"" + locale + "\", using " + (descriptor.defaultMessage ? 'default message' : 'id') + " as fallback.") || this;
66
80
  _this.descriptor = descriptor;
package/src/list.js CHANGED
@@ -39,7 +39,7 @@ function formatListToParts(_a, getListFormat, values, options) {
39
39
  if (!ListFormat) {
40
40
  onError(new intl_messageformat_1.FormatError("Intl.ListFormat is not available in this environment.\nTry polyfilling it using \"@formatjs/intl-listformat\"\n", intl_messageformat_1.ErrorCode.MISSING_INTL_API));
41
41
  }
42
- var filteredOptions = utils_1.filterProps(options, LIST_FORMAT_OPTIONS);
42
+ var filteredOptions = (0, utils_1.filterProps)(options, LIST_FORMAT_OPTIONS);
43
43
  try {
44
44
  var richValues_1 = {};
45
45
  var serializedValues = values.map(function (v, i) {
@@ -55,7 +55,7 @@ function formatListToParts(_a, getListFormat, values, options) {
55
55
  .map(function (part) {
56
56
  return part.type === 'literal'
57
57
  ? part
58
- : tslib_1.__assign(tslib_1.__assign({}, part), { value: richValues_1[part.value] || part.value });
58
+ : (0, tslib_1.__assign)((0, tslib_1.__assign)({}, part), { value: richValues_1[part.value] || part.value });
59
59
  });
60
60
  }
61
61
  catch (e) {
package/src/message.js CHANGED
@@ -8,14 +8,14 @@ var error_1 = require("./error");
8
8
  var icu_messageformat_parser_1 = require("@formatjs/icu-messageformat-parser");
9
9
  function setTimeZoneInOptions(opts, timeZone) {
10
10
  return Object.keys(opts).reduce(function (all, k) {
11
- all[k] = tslib_1.__assign({ timeZone: timeZone }, opts[k]);
11
+ all[k] = (0, tslib_1.__assign)({ timeZone: timeZone }, opts[k]);
12
12
  return all;
13
13
  }, {});
14
14
  }
15
15
  function deepMergeOptions(opts1, opts2) {
16
- var keys = Object.keys(tslib_1.__assign(tslib_1.__assign({}, opts1), opts2));
16
+ var keys = Object.keys((0, tslib_1.__assign)((0, tslib_1.__assign)({}, opts1), opts2));
17
17
  return keys.reduce(function (all, k) {
18
- all[k] = tslib_1.__assign(tslib_1.__assign({}, (opts1[k] || {})), (opts2[k] || {}));
18
+ all[k] = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, (opts1[k] || {})), (opts2[k] || {}));
19
19
  return all;
20
20
  }, {});
21
21
  }
@@ -24,14 +24,14 @@ function deepMergeFormatsAndSetTimeZone(f1, timeZone) {
24
24
  return f1;
25
25
  }
26
26
  var mfFormats = intl_messageformat_1.IntlMessageFormat.formats;
27
- return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, mfFormats), f1), { date: deepMergeOptions(setTimeZoneInOptions(mfFormats.date, timeZone), setTimeZoneInOptions(f1.date || {}, timeZone)), time: deepMergeOptions(setTimeZoneInOptions(mfFormats.time, timeZone), setTimeZoneInOptions(f1.time || {}, timeZone)) });
27
+ return (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, mfFormats), f1), { date: deepMergeOptions(setTimeZoneInOptions(mfFormats.date, timeZone), setTimeZoneInOptions(f1.date || {}, timeZone)), time: deepMergeOptions(setTimeZoneInOptions(mfFormats.time, timeZone), setTimeZoneInOptions(f1.time || {}, timeZone)) });
28
28
  }
29
29
  function formatMessage(_a, state, messageDescriptor, values, opts) {
30
- var locale = _a.locale, formats = _a.formats, messages = _a.messages, defaultLocale = _a.defaultLocale, defaultFormats = _a.defaultFormats, onError = _a.onError, timeZone = _a.timeZone, defaultRichTextElements = _a.defaultRichTextElements;
30
+ var locale = _a.locale, formats = _a.formats, messages = _a.messages, defaultLocale = _a.defaultLocale, defaultFormats = _a.defaultFormats, fallbackOnEmptyString = _a.fallbackOnEmptyString, onError = _a.onError, timeZone = _a.timeZone, defaultRichTextElements = _a.defaultRichTextElements;
31
31
  if (messageDescriptor === void 0) { messageDescriptor = { id: '' }; }
32
32
  var msgId = messageDescriptor.id, defaultMessage = messageDescriptor.defaultMessage;
33
33
  // `id` is a required field of a Message Descriptor.
34
- ecma402_abstract_1.invariant(!!msgId, "[@formatjs/intl] An `id` must be provided to format a message. You can either:\n1. Configure your build toolchain with [babel-plugin-formatjs](https://formatjs.io/docs/tooling/babel-plugin)\nor [@formatjs/ts-transformer](https://formatjs.io/docs/tooling/ts-transformer) OR\n2. Configure your `eslint` config to include [eslint-plugin-formatjs](https://formatjs.io/docs/tooling/linter#enforce-id)\nto autofix this issue");
34
+ (0, ecma402_abstract_1.invariant)(!!msgId, "[@formatjs/intl] An `id` must be provided to format a message. You can either:\n1. Configure your build toolchain with [babel-plugin-formatjs](https://formatjs.io/docs/tooling/babel-plugin)\nor [@formatjs/ts-transformer](https://formatjs.io/docs/tooling/ts-transformer) OR\n2. Configure your `eslint` config to include [eslint-plugin-formatjs](https://formatjs.io/docs/tooling/linter#enforce-id)\nto autofix this issue");
35
35
  var id = String(msgId);
36
36
  var message =
37
37
  // In case messages is Object.create(null)
@@ -53,10 +53,13 @@ function formatMessage(_a, state, messageDescriptor, values, opts) {
53
53
  !defaultRichTextElements) {
54
54
  return message.replace(/'\{(.*?)\}'/gi, "{$1}");
55
55
  }
56
- values = tslib_1.__assign(tslib_1.__assign({}, defaultRichTextElements), (values || {}));
56
+ values = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, defaultRichTextElements), (values || {}));
57
57
  formats = deepMergeFormatsAndSetTimeZone(formats, timeZone);
58
58
  defaultFormats = deepMergeFormatsAndSetTimeZone(defaultFormats, timeZone);
59
59
  if (!message) {
60
+ if (fallbackOnEmptyString === false && message === '') {
61
+ return message;
62
+ }
60
63
  if (!defaultMessage ||
61
64
  (locale && locale.toLowerCase() !== defaultLocale.toLowerCase())) {
62
65
  // This prevents warnings from littering the console in development
@@ -78,7 +81,7 @@ function formatMessage(_a, state, messageDescriptor, values, opts) {
78
81
  }
79
82
  // We have the translated message
80
83
  try {
81
- var formatter = state.getMessageFormat(message, locale, formats, tslib_1.__assign({ formatters: state }, (opts || {})));
84
+ var formatter = state.getMessageFormat(message, locale, formats, (0, tslib_1.__assign)({ formatters: state }, (opts || {})));
82
85
  return formatter.format(values);
83
86
  }
84
87
  catch (e) {
package/src/number.js CHANGED
@@ -31,9 +31,9 @@ function getFormatter(_a, getNumberFormat, options) {
31
31
  if (options === void 0) { options = {}; }
32
32
  var format = options.format;
33
33
  var defaults = ((format &&
34
- utils_1.getNamedFormat(formats, 'number', format, onError)) ||
34
+ (0, utils_1.getNamedFormat)(formats, 'number', format, onError)) ||
35
35
  {});
36
- var filteredOptions = utils_1.filterProps(options, NUMBER_FORMAT_OPTIONS, defaults);
36
+ var filteredOptions = (0, utils_1.filterProps)(options, NUMBER_FORMAT_OPTIONS, defaults);
37
37
  return getNumberFormat(locale, filteredOptions);
38
38
  }
39
39
  exports.getFormatter = getFormatter;
package/src/plural.js CHANGED
@@ -14,12 +14,12 @@ function formatPlural(_a, getPluralRules, value, options) {
14
14
  if (!Intl.PluralRules) {
15
15
  onError(new intl_messageformat_1.FormatError("Intl.PluralRules is not available in this environment.\nTry polyfilling it using \"@formatjs/intl-pluralrules\"\n", intl_messageformat_1.ErrorCode.MISSING_INTL_API));
16
16
  }
17
- var filteredOptions = utils_1.filterProps(options, PLURAL_FORMAT_OPTIONS);
17
+ var filteredOptions = (0, utils_1.filterProps)(options, PLURAL_FORMAT_OPTIONS);
18
18
  try {
19
19
  return getPluralRules(locale, filteredOptions).select(value);
20
20
  }
21
21
  catch (e) {
22
- onError(new error_1.MessageFormatError('Error formatting plural.', e));
22
+ onError(new error_1.IntlFormatError('Error formatting plural.', locale, e));
23
23
  }
24
24
  return 'other';
25
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"relativeTime.d.ts","sourceRoot":"","sources":["../../../../../../packages/intl/src/relativeTime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAC,MAAM,SAAS,CAAA;AAoC5E,wBAAgB,kBAAkB,CAChC,MAAM,EAAE;IACN,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,aAAa,CAAA;IACtB,OAAO,EAAE,SAAS,CAAA;CACnB,EACD,qBAAqB,EAAE,UAAU,CAAC,uBAAuB,CAAC,EAC1D,KAAK,EAAE,UAAU,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,EAC1D,IAAI,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,EAC1D,OAAO,GAAE,UAAU,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAM,GAChE,MAAM,CAyBR"}
1
+ {"version":3,"file":"relativeTime.d.ts","sourceRoot":"","sources":["../../../../../../packages/intl/src/relativeTime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAC,MAAM,SAAS,CAAA;AAoC5E,wBAAgB,kBAAkB,CAChC,MAAM,EAAE;IACN,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,aAAa,CAAA;IACtB,OAAO,EAAE,SAAS,CAAA;CACnB,EACD,qBAAqB,EAAE,UAAU,CAAC,uBAAuB,CAAC,EAC1D,KAAK,EAAE,UAAU,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,EAC1D,IAAI,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,EAC1D,OAAO,GAAE,UAAU,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAM,GAChE,MAAM,CA2BR"}
@@ -9,8 +9,8 @@ function getFormatter(_a, getRelativeTimeFormat, options) {
9
9
  var locale = _a.locale, formats = _a.formats, onError = _a.onError;
10
10
  if (options === void 0) { options = {}; }
11
11
  var format = options.format;
12
- var defaults = (!!format && utils_1.getNamedFormat(formats, 'relative', format, onError)) || {};
13
- var filteredOptions = utils_1.filterProps(options, RELATIVE_TIME_FORMAT_OPTIONS, defaults);
12
+ var defaults = (!!format && (0, utils_1.getNamedFormat)(formats, 'relative', format, onError)) || {};
13
+ var filteredOptions = (0, utils_1.filterProps)(options, RELATIVE_TIME_FORMAT_OPTIONS, defaults);
14
14
  return getRelativeTimeFormat(locale, filteredOptions);
15
15
  }
16
16
  function formatRelativeTime(config, getRelativeTimeFormat, value, unit, options) {
@@ -26,7 +26,7 @@ function formatRelativeTime(config, getRelativeTimeFormat, value, unit, options)
26
26
  return getFormatter(config, getRelativeTimeFormat, options).format(value, unit);
27
27
  }
28
28
  catch (e) {
29
- config.onError(new error_1.MessageFormatError('Error formatting relative time.', e));
29
+ config.onError(new error_1.IntlFormatError('Error formatting relative time.', config.locale, e));
30
30
  }
31
31
  return String(value);
32
32
  }
package/src/types.d.ts CHANGED
@@ -6,6 +6,15 @@ import { DisplayNames, DisplayNamesOptions } from '@formatjs/intl-displaynames';
6
6
  import { MissingTranslationError, MessageFormatError, MissingDataError, InvalidConfigError, UnsupportedFormatterError } from './error';
7
7
  import { DEFAULT_INTL_CONFIG } from './utils';
8
8
  import { NumberFormatOptions } from '@formatjs/ecma402-abstract';
9
+ declare global {
10
+ namespace FormatjsIntl {
11
+ interface Message {
12
+ }
13
+ }
14
+ }
15
+ declare type MessageIds = FormatjsIntl.Message extends {
16
+ ids: string;
17
+ } ? FormatjsIntl.Message['ids'] : string;
9
18
  export declare type OnErrorFn = (err: MissingTranslationError | MessageFormatError | MissingDataError | InvalidConfigError | UnsupportedFormatterError | FormatError) => void;
10
19
  /**
11
20
  * Config for intl object.
@@ -15,8 +24,9 @@ export declare type OnErrorFn = (err: MissingTranslationError | MessageFormatErr
15
24
  export interface ResolvedIntlConfig<T = string> {
16
25
  locale: string;
17
26
  timeZone?: string;
27
+ fallbackOnEmptyString?: boolean;
18
28
  formats: CustomFormats;
19
- messages: Record<string, string> | Record<string, MessageFormatElement[]>;
29
+ messages: Record<MessageIds, string> | Record<MessageIds, MessageFormatElement[]>;
20
30
  defaultLocale: string;
21
31
  defaultFormats: CustomFormats;
22
32
  defaultRichTextElements?: Record<string, FormatXMLElementFn<T>>;
@@ -73,9 +83,10 @@ export interface IntlCache {
73
83
  displayNames: Record<string, DisplayNames>;
74
84
  }
75
85
  export interface MessageDescriptor {
76
- id?: string | number;
86
+ id?: MessageIds;
77
87
  description?: string | object;
78
88
  defaultMessage?: string | MessageFormatElement[];
79
89
  }
80
90
  export declare type IntlConfig<T = string> = Omit<ResolvedIntlConfig<T>, keyof typeof DEFAULT_INTL_CONFIG> & Partial<typeof DEFAULT_INTL_CONFIG>;
91
+ export {};
81
92
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../packages/intl/src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,OAAO,EACP,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,OAAO,IAAI,wBAAwB,EACpC,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAC,cAAc,EAAC,MAAM,4BAA4B,CAAA;AACzD,OAAO,EAAC,oBAAoB,EAAC,MAAM,oCAAoC,CAAA;AACvE,OAAO,cAAc,EAAE,EACrB,qBAAqB,EACrB,IAAI,EACL,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAC,YAAY,EAAE,mBAAmB,EAAC,MAAM,6BAA6B,CAAA;AAC7E,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,yBAAyB,EAC1B,MAAM,SAAS,CAAA;AAChB,OAAO,EAAC,mBAAmB,EAAC,MAAM,SAAS,CAAA;AAC3C,OAAO,EAAC,mBAAmB,EAAC,MAAM,4BAA4B,CAAA;AAE9D,oBAAY,SAAS,GAAG,CACtB,GAAG,EACC,uBAAuB,GACvB,kBAAkB,GAClB,gBAAgB,GAChB,kBAAkB,GAClB,yBAAyB,GACzB,WAAW,KACZ,IAAI,CAAA;AAET;;;;GAIG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC,GAAG,MAAM;IAC5C,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,aAAa,CAAA;IACtB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,EAAE,CAAC,CAAA;IACzE,aAAa,EAAE,MAAM,CAAA;IACrB,cAAc,EAAE,a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YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;CAC3C;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC7B,cAAc,CAAC,EAAE,MAAM,GAAG,oBAAoB,EAAE,CAAA;CACjD;AAED,oBAAY,UAAU,CAAC,CAAC,GAAG,MAAM,IAAI,IAAI,CACvC,kBAAkB,CAAC,CAAC,CAAC,EACrB,MAAM,OAAO,mBAAmB,CACjC,GACC,OAAO,CAAC,OAAO,mBAAmB,CAAC,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../packages/intl/src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,OAAO,EACP,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,OAAO,IAAI,wBAAwB,EACpC,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAC,cAAc,EAAC,MAAM,4BAA4B,CAAA;AACzD,OAAO,EAAC,oBAAoB,EAAC,MAAM,oCAAoC,CAAA;AACvE,OAAO,cAAc,EAAE,EACrB,qBAAqB,EACrB,IAAI,EACL,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAC,YAAY,EAAE,mBAAmB,EAAC,MAAM,6BAA6B,CAAA;AAC7E,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,yBAAyB,EAC1B,MAAM,SAAS,CAAA;AAChB,OAAO,EAAC,mBAAmB,EAAC,MAAM,SAAS,CAAA;AAC3C,OAAO,EAAC,mBAAmB,EAAC,MAAM,4BAA4B,CAAA;AAE9D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,YAAY,CAAC;QACrB,UAAU,OAAO;SAAG;KACrB;CACF;AAED,aAAK,UAAU,GAAG,YAAY,CAAC,OAAO,SAAS;IAAC,GAAG,EAAE,MAA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A;CAChB;AAED,MAAM,WAAW,SAAS,CAAC,CAAC,GAAG,MAAM,CACnC,SAAQ,kBAAkB,CAAC,CAAC,CAAC,EAC3B,cAAc;IAChB,UAAU,EAAE,UAAU,CAAA;CACvB;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;IACxC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,CAAA;IACzC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;IAC1C,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAA;IACrD,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;IAC7C,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;IACpC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;CAC3C;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,CAAC,EAAE,UAAU,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC7B,cAAc,CAAC,EAAE,MAAM,GAAG,oBAAoB,EAAE,CAAA;CACjD;AAED,oBAAY,UAAU,CAAC,CAAC,GAAG,MAAM,IAAI,IAAI,CACvC,kBAAkB,CAAC,CAAC,CAAC,EACrB,MAAM,OAAO,mBAAmB,CACjC,GACC,OAAO,CAAC,OAAO,mBAAmB,CAAC,CAAA"}
package/src/utils.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { IntlCache, CustomFormats, Formatters, OnErrorFn, ResolvedIntlConfig } from './types';
2
2
  export declare function filterProps<T extends Record<string, any>, K extends string>(props: T, whitelist: Array<K>, defaults?: Partial<T>): Pick<T, K>;
3
- export declare const DEFAULT_INTL_CONFIG: Pick<ResolvedIntlConfig<any>, 'formats' | 'messages' | 'timeZone' | 'defaultLocale' | 'defaultFormats' | 'onError'>;
3
+ export declare const DEFAULT_INTL_CONFIG: Pick<ResolvedIntlConfig<any>, 'fallbackOnEmptyString' | 'formats' | 'messages' | 'timeZone' | 'defaultLocale' | 'defaultFormats' | 'onError'>;
4
4
  export declare function createIntlCache(): IntlCache;
5
5
  /**
6
6
  * Create intl formatters and populate cache
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/intl/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,aAAa,EACb,UAAU,EACV,SAAS,EACT,kBAAkB,EACnB,MAAM,SAAS,CAAA;AAMhB,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC,SAAS,MAAM,EACzE,KAAK,EAAE,CAAC,EACR,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,EACnB,QAAQ,GAAE,OAAO,CAAC,CAAC,CAAM,GACxB,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAUZ;AASD,eAAO,MAAM,mBAAmB,EAAE,IAAI,CACpC,kBAAkB,CAAC,GAAG,CAAC,EACrB,SAAS,GACT,UAAU,GACV,UAAU,GACV,eAAe,GACf,gBAAgB,GAChB,SAAS,CAUZ,CAAA;AAED,wBAAgB,eAAe,IAAI,SAAS,CAU3C;AAiBD;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,GAAE,SAA6B,GACnC,UAAU,CAsDZ;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,aAAa,EAC1D,OAAO,EAAE,aAAa,EACtB,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,SAAS,GAEhB,IAAI,CAAC,mBAAmB,GACxB,IAAI,CAAC,qBAAqB,GAC1B,IAAI,CAAC,yBAAyB,GAC9B,SAAS,CAWZ"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/intl/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,aAAa,EACb,UAAU,EACV,SAAS,EACT,kBAAkB,EACnB,MAAM,SAAS,CAAA;AAMhB,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC,SAAS,MAAM,EACzE,KAAK,EAAE,CAAC,EACR,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,EACnB,QAAQ,GAAE,OAAO,CAAC,CAAC,CAAM,GACxB,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAUZ;AASD,eAAO,MAAM,mBAAmB,EAAE,IAAI,CACpC,kBAAkB,CAAC,GAAG,CAAC,EACrB,uBAAuB,GACvB,SAAS,GACT,UAAU,GACV,UAAU,GACV,eAAe,GACf,gBAAgB,GAChB,SAAS,CAYZ,CAAA;AAED,wBAAgB,eAAe,IAAI,SAAS,CAU3C;AAiBD;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,GAAE,SAA6B,GACnC,UAAU,CAsDZ;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,aAAa,EAC1D,OAAO,EAAE,aAAa,EACtB,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,SAAS,GAEhB,IAAI,CAAC,mBAAmB,GACxB,IAAI,CAAC,qBAAqB,GAC1B,IAAI,CAAC,yBAAyB,GAC9B,SAAS,CAWZ"}
package/src/utils.js CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getNamedFormat = exports.createFormatters = exports.createIntlCache = exports.DEFAULT_INTL_CONFIG = exports.filterProps = void 0;
4
4
  var tslib_1 = require("tslib");
5
5
  var intl_messageformat_1 = require("intl-messageformat");
6
- var fast_memoize_1 = tslib_1.__importStar(require("@formatjs/fast-memoize"));
6
+ var fast_memoize_1 = (0, tslib_1.__importStar)(require("@formatjs/fast-memoize"));
7
7
  var error_1 = require("./error");
8
8
  function filterProps(props, whitelist, defaults) {
9
9
  if (defaults === void 0) { defaults = {}; }
@@ -30,6 +30,7 @@ exports.DEFAULT_INTL_CONFIG = {
30
30
  timeZone: undefined,
31
31
  defaultLocale: 'en',
32
32
  defaultFormats: {},
33
+ fallbackOnEmptyString: true,
33
34
  onError: defaultErrorHandler,
34
35
  };
35
36
  function createIntlCache() {
@@ -67,35 +68,35 @@ function createFormatters(cache) {
67
68
  var RelativeTimeFormat = Intl.RelativeTimeFormat;
68
69
  var ListFormat = Intl.ListFormat;
69
70
  var DisplayNames = Intl.DisplayNames;
70
- var getDateTimeFormat = fast_memoize_1.default(function () {
71
+ var getDateTimeFormat = (0, fast_memoize_1.default)(function () {
71
72
  var _a;
72
73
  var args = [];
73
74
  for (var _i = 0; _i < arguments.length; _i++) {
74
75
  args[_i] = arguments[_i];
75
76
  }
76
- return new ((_a = Intl.DateTimeFormat).bind.apply(_a, tslib_1.__spreadArray([void 0], args)))();
77
+ return new ((_a = Intl.DateTimeFormat).bind.apply(_a, (0, tslib_1.__spreadArray)([void 0], args, false)))();
77
78
  }, {
78
79
  cache: createFastMemoizeCache(cache.dateTime),
79
80
  strategy: fast_memoize_1.strategies.variadic,
80
81
  });
81
- var getNumberFormat = fast_memoize_1.default(function () {
82
+ var getNumberFormat = (0, fast_memoize_1.default)(function () {
82
83
  var _a;
83
84
  var args = [];
84
85
  for (var _i = 0; _i < arguments.length; _i++) {
85
86
  args[_i] = arguments[_i];
86
87
  }
87
- return new ((_a = Intl.NumberFormat).bind.apply(_a, tslib_1.__spreadArray([void 0], args)))();
88
+ return new ((_a = Intl.NumberFormat).bind.apply(_a, (0, tslib_1.__spreadArray)([void 0], args, false)))();
88
89
  }, {
89
90
  cache: createFastMemoizeCache(cache.number),
90
91
  strategy: fast_memoize_1.strategies.variadic,
91
92
  });
92
- var getPluralRules = fast_memoize_1.default(function () {
93
+ var getPluralRules = (0, fast_memoize_1.default)(function () {
93
94
  var _a;
94
95
  var args = [];
95
96
  for (var _i = 0; _i < arguments.length; _i++) {
96
97
  args[_i] = arguments[_i];
97
98
  }
98
- return new ((_a = Intl.PluralRules).bind.apply(_a, tslib_1.__spreadArray([void 0], args)))();
99
+ return new ((_a = Intl.PluralRules).bind.apply(_a, (0, tslib_1.__spreadArray)([void 0], args, false)))();
99
100
  }, {
100
101
  cache: createFastMemoizeCache(cache.pluralRules),
101
102
  strategy: fast_memoize_1.strategies.variadic,
@@ -103,8 +104,8 @@ function createFormatters(cache) {
103
104
  return {
104
105
  getDateTimeFormat: getDateTimeFormat,
105
106
  getNumberFormat: getNumberFormat,
106
- getMessageFormat: fast_memoize_1.default(function (message, locales, overrideFormats, opts) {
107
- return new intl_messageformat_1.IntlMessageFormat(message, locales, overrideFormats, tslib_1.__assign({ formatters: {
107
+ getMessageFormat: (0, fast_memoize_1.default)(function (message, locales, overrideFormats, opts) {
108
+ return new intl_messageformat_1.IntlMessageFormat(message, locales, overrideFormats, (0, tslib_1.__assign)({ formatters: {
108
109
  getNumberFormat: getNumberFormat,
109
110
  getDateTimeFormat: getDateTimeFormat,
110
111
  getPluralRules: getPluralRules,
@@ -113,33 +114,33 @@ function createFormatters(cache) {
113
114
  cache: createFastMemoizeCache(cache.message),
114
115
  strategy: fast_memoize_1.strategies.variadic,
115
116
  }),
116
- getRelativeTimeFormat: fast_memoize_1.default(function () {
117
+ getRelativeTimeFormat: (0, fast_memoize_1.default)(function () {
117
118
  var args = [];
118
119
  for (var _i = 0; _i < arguments.length; _i++) {
119
120
  args[_i] = arguments[_i];
120
121
  }
121
- return new (RelativeTimeFormat.bind.apply(RelativeTimeFormat, tslib_1.__spreadArray([void 0], args)))();
122
+ return new (RelativeTimeFormat.bind.apply(RelativeTimeFormat, (0, tslib_1.__spreadArray)([void 0], args, false)))();
122
123
  }, {
123
124
  cache: createFastMemoizeCache(cache.relativeTime),
124
125
  strategy: fast_memoize_1.strategies.variadic,
125
126
  }),
126
127
  getPluralRules: getPluralRules,
127
- getListFormat: fast_memoize_1.default(function () {
128
+ getListFormat: (0, fast_memoize_1.default)(function () {
128
129
  var args = [];
129
130
  for (var _i = 0; _i < arguments.length; _i++) {
130
131
  args[_i] = arguments[_i];
131
132
  }
132
- return new (ListFormat.bind.apply(ListFormat, tslib_1.__spreadArray([void 0], args)))();
133
+ return new (ListFormat.bind.apply(ListFormat, (0, tslib_1.__spreadArray)([void 0], args, false)))();
133
134
  }, {
134
135
  cache: createFastMemoizeCache(cache.list),
135
136
  strategy: fast_memoize_1.strategies.variadic,
136
137
  }),
137
- getDisplayNames: fast_memoize_1.default(function () {
138
+ getDisplayNames: (0, fast_memoize_1.default)(function () {
138
139
  var args = [];
139
140
  for (var _i = 0; _i < arguments.length; _i++) {
140
141
  args[_i] = arguments[_i];
141
142
  }
142
- return new (DisplayNames.bind.apply(DisplayNames, tslib_1.__spreadArray([void 0], args)))();
143
+ return new (DisplayNames.bind.apply(DisplayNames, (0, tslib_1.__spreadArray)([void 0], args, false)))();
143
144
  }, {
144
145
  cache: createFastMemoizeCache(cache.displayNames),
145
146
  strategy: fast_memoize_1.strategies.variadic,