@formatjs/intl 1.16.0 → 1.18.2
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/lib/src/create-intl.js +3 -3
- package/lib/src/dateTime.d.ts.map +1 -1
- package/lib/src/dateTime.js +1 -3
- package/lib/src/error.js +4 -4
- package/lib/src/list.js +1 -1
- package/lib/src/message.js +3 -3
- package/lib/src/types.d.ts +7 -2
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/utils.d.ts +2 -1
- package/lib/src/utils.d.ts.map +1 -1
- package/lib/src/utils.js +1 -1
- package/package.json +8 -8
- package/src/create-intl.js +3 -3
- package/src/dateTime.d.ts.map +1 -1
- package/src/dateTime.js +1 -3
- package/src/error.js +4 -4
- package/src/list.js +1 -1
- package/src/message.js +3 -3
- package/src/types.d.ts +7 -2
- package/src/types.d.ts.map +1 -1
- package/src/utils.d.ts +2 -1
- package/src/utils.d.ts.map +1 -1
- package/src/utils.js +1 -1
package/lib/src/create-intl.js
CHANGED
|
@@ -29,7 +29,7 @@ export function createIntl(config, cache) {
|
|
|
29
29
|
var locale = resolvedConfig.locale, defaultLocale = resolvedConfig.defaultLocale, onError = resolvedConfig.onError;
|
|
30
30
|
if (!locale) {
|
|
31
31
|
if (onError) {
|
|
32
|
-
onError(new InvalidConfigError("\"locale\" was not configured, using \""
|
|
32
|
+
onError(new InvalidConfigError("\"locale\" was not configured, using \"".concat(defaultLocale, "\" as fallback. See https://formatjs.io/docs/react-intl/api#intlshape for more details")));
|
|
33
33
|
}
|
|
34
34
|
// Since there's no registered locale data for `locale`, this will
|
|
35
35
|
// fallback to the `defaultLocale` to make sure things can render.
|
|
@@ -39,11 +39,11 @@ export function createIntl(config, cache) {
|
|
|
39
39
|
resolvedConfig.locale = resolvedConfig.defaultLocale || 'en';
|
|
40
40
|
}
|
|
41
41
|
else if (!Intl.NumberFormat.supportedLocalesOf(locale).length && onError) {
|
|
42
|
-
onError(new MissingDataError("Missing locale data for locale: \""
|
|
42
|
+
onError(new MissingDataError("Missing locale data for locale: \"".concat(locale, "\" in Intl.NumberFormat. Using default locale: \"").concat(defaultLocale, "\" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details")));
|
|
43
43
|
}
|
|
44
44
|
else if (!Intl.DateTimeFormat.supportedLocalesOf(locale).length &&
|
|
45
45
|
onError) {
|
|
46
|
-
onError(new MissingDataError("Missing locale data for locale: \""
|
|
46
|
+
onError(new MissingDataError("Missing locale data for locale: \"".concat(locale, "\" in Intl.DateTimeFormat. Using default locale: \"").concat(defaultLocale, "\" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details")));
|
|
47
47
|
}
|
|
48
48
|
verifyConfigMessages(resolvedConfig);
|
|
49
49
|
return __assign(__assign({}, resolvedConfig), { formatters: formatters, formatNumber: formatNumber.bind(null, resolvedConfig, formatters.getNumberFormat), formatNumberToParts: formatNumberToParts.bind(null, resolvedConfig, formatters.getNumberFormat), formatRelativeTime: formatRelativeTime.bind(null, resolvedConfig, formatters.getRelativeTimeFormat), formatDate: formatDate.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatDateToParts: formatDateToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTime: formatTime.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatDateTimeRange: formatDateTimeRange.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTimeToParts: formatTimeToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatPlural: formatPlural.bind(null, resolvedConfig, formatters.getPluralRules), formatMessage: formatMessage.bind(null, resolvedConfig, formatters), formatList: formatList.bind(null, resolvedConfig, formatters.getListFormat), formatListToParts: formatListToParts.bind(null, resolvedConfig, formatters.getListFormat), formatDisplayName: formatDisplayName.bind(null, resolvedConfig, formatters.getDisplayNames) });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateTime.d.ts","sourceRoot":"","sources":["../../../../../../../packages/intl/src/dateTime.ts"],"names":[],"mappings":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wBAAgB,iBAAiB,CAC/B,MAAM,EAAE;IACN,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,aAAa,CAAA;IACtB,OAAO,EAAE,SAAS,CAAA;CACnB,EACD,iBAAiB,EAAE,UAAU,CAAC,mBAAmB,CAAC,EAClD,GAAG,CAAC,KAAK,EAAE,OAAY,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC,GACxE,IAAI,CAAC,kBAAkB,EAAE,CAiB3B"}
|
package/lib/src/dateTime.js
CHANGED
|
@@ -27,9 +27,7 @@ export function getFormatter(_a, type, getDateTimeFormat, options) {
|
|
|
27
27
|
if (options === void 0) { options = {}; }
|
|
28
28
|
var format = options.format;
|
|
29
29
|
var defaults = __assign(__assign({}, (timeZone && { timeZone: timeZone })), (format && getNamedFormat(formats, type, format, onError)));
|
|
30
|
-
var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS,
|
|
31
|
-
// @ts-expect-error es2020 has a lot stuff from es2021 bleed in
|
|
32
|
-
defaults);
|
|
30
|
+
var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, defaults);
|
|
33
31
|
if (type === 'time' &&
|
|
34
32
|
!filteredOptions.hour &&
|
|
35
33
|
!filteredOptions.minute &&
|
package/lib/src/error.js
CHANGED
|
@@ -16,7 +16,7 @@ var IntlError = /** @class */ (function (_super) {
|
|
|
16
16
|
? exception
|
|
17
17
|
: new Error(String(exception))
|
|
18
18
|
: undefined;
|
|
19
|
-
_this = _super.call(this, "[@formatjs/intl Error "
|
|
19
|
+
_this = _super.call(this, "[@formatjs/intl Error ".concat(code, "] ").concat(message, " \n").concat(err ? "\n".concat(err.message, "\n").concat(err.stack) : '')) || this;
|
|
20
20
|
_this.code = code;
|
|
21
21
|
// @ts-ignore just so we don't need to declare dep on @types/node
|
|
22
22
|
if (typeof Error.captureStackTrace === 'function') {
|
|
@@ -55,7 +55,7 @@ export { MissingDataError };
|
|
|
55
55
|
var IntlFormatError = /** @class */ (function (_super) {
|
|
56
56
|
__extends(IntlFormatError, _super);
|
|
57
57
|
function IntlFormatError(message, locale, exception) {
|
|
58
|
-
return _super.call(this, IntlErrorCode.FORMAT_ERROR, message
|
|
58
|
+
return _super.call(this, IntlErrorCode.FORMAT_ERROR, "".concat(message, " \nLocale: ").concat(locale, "\n"), exception) || this;
|
|
59
59
|
}
|
|
60
60
|
return IntlFormatError;
|
|
61
61
|
}(IntlError));
|
|
@@ -63,7 +63,7 @@ export { IntlFormatError };
|
|
|
63
63
|
var MessageFormatError = /** @class */ (function (_super) {
|
|
64
64
|
__extends(MessageFormatError, _super);
|
|
65
65
|
function MessageFormatError(message, locale, descriptor, exception) {
|
|
66
|
-
var _this = _super.call(this, message
|
|
66
|
+
var _this = _super.call(this, "".concat(message, " \nMessageID: ").concat(descriptor === null || descriptor === void 0 ? void 0 : descriptor.id, "\nDefault Message: ").concat(descriptor === null || descriptor === void 0 ? void 0 : descriptor.defaultMessage, "\nDescription: ").concat(descriptor === null || descriptor === void 0 ? void 0 : descriptor.description, " \n"), locale, exception) || this;
|
|
67
67
|
_this.descriptor = descriptor;
|
|
68
68
|
return _this;
|
|
69
69
|
}
|
|
@@ -73,7 +73,7 @@ export { MessageFormatError };
|
|
|
73
73
|
var MissingTranslationError = /** @class */ (function (_super) {
|
|
74
74
|
__extends(MissingTranslationError, _super);
|
|
75
75
|
function MissingTranslationError(descriptor, locale) {
|
|
76
|
-
var _this = _super.call(this, IntlErrorCode.MISSING_TRANSLATION, "Missing message: \""
|
|
76
|
+
var _this = _super.call(this, IntlErrorCode.MISSING_TRANSLATION, "Missing message: \"".concat(descriptor.id, "\" for locale \"").concat(locale, "\", using ").concat(descriptor.defaultMessage ? 'default message' : 'id', " as fallback.")) || this;
|
|
77
77
|
_this.descriptor = descriptor;
|
|
78
78
|
return _this;
|
|
79
79
|
}
|
package/lib/src/list.js
CHANGED
|
@@ -9,7 +9,7 @@ var LIST_FORMAT_OPTIONS = [
|
|
|
9
9
|
];
|
|
10
10
|
var now = Date.now();
|
|
11
11
|
function generateToken(i) {
|
|
12
|
-
return now
|
|
12
|
+
return "".concat(now, "_").concat(i, "_").concat(now);
|
|
13
13
|
}
|
|
14
14
|
export function formatList(opts, getListFormat, values, options) {
|
|
15
15
|
if (options === void 0) { options = {}; }
|
package/lib/src/message.js
CHANGED
|
@@ -70,7 +70,7 @@ export function formatMessage(_a, state, messageDescriptor, values, opts) {
|
|
|
70
70
|
return formatter.format(values);
|
|
71
71
|
}
|
|
72
72
|
catch (e) {
|
|
73
|
-
onError(new MessageFormatError("Error formatting default message for: \""
|
|
73
|
+
onError(new MessageFormatError("Error formatting default message for: \"".concat(id, "\", rendering default message verbatim"), locale, messageDescriptor, e));
|
|
74
74
|
return typeof defaultMessage === 'string' ? defaultMessage : id;
|
|
75
75
|
}
|
|
76
76
|
}
|
|
@@ -82,7 +82,7 @@ export function formatMessage(_a, state, messageDescriptor, values, opts) {
|
|
|
82
82
|
return formatter.format(values);
|
|
83
83
|
}
|
|
84
84
|
catch (e) {
|
|
85
|
-
onError(new MessageFormatError("Error formatting message: \""
|
|
85
|
+
onError(new MessageFormatError("Error formatting message: \"".concat(id, "\", using ").concat(defaultMessage ? 'default message' : 'id', " as fallback."), locale, messageDescriptor, e));
|
|
86
86
|
}
|
|
87
87
|
if (defaultMessage) {
|
|
88
88
|
try {
|
|
@@ -90,7 +90,7 @@ export function formatMessage(_a, state, messageDescriptor, values, opts) {
|
|
|
90
90
|
return formatter.format(values);
|
|
91
91
|
}
|
|
92
92
|
catch (e) {
|
|
93
|
-
onError(new MessageFormatError("Error formatting the default message for: \""
|
|
93
|
+
onError(new MessageFormatError("Error formatting the default message for: \"".concat(id, "\", rendering message verbatim"), locale, messageDescriptor, e));
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
if (typeof message === 'string') {
|
package/lib/src/types.d.ts
CHANGED
|
@@ -10,11 +10,16 @@ declare global {
|
|
|
10
10
|
namespace FormatjsIntl {
|
|
11
11
|
interface Message {
|
|
12
12
|
}
|
|
13
|
+
interface IntlConfig {
|
|
14
|
+
}
|
|
13
15
|
}
|
|
14
16
|
}
|
|
15
17
|
declare type MessageIds = FormatjsIntl.Message extends {
|
|
16
18
|
ids: string;
|
|
17
19
|
} ? FormatjsIntl.Message['ids'] : string;
|
|
20
|
+
declare type Locale = FormatjsIntl.IntlConfig extends {
|
|
21
|
+
locale: string;
|
|
22
|
+
} ? FormatjsIntl.IntlConfig['locale'] : string;
|
|
18
23
|
export declare type OnErrorFn = (err: MissingTranslationError | MessageFormatError | MissingDataError | InvalidConfigError | UnsupportedFormatterError | FormatError) => void;
|
|
19
24
|
/**
|
|
20
25
|
* Config for intl object.
|
|
@@ -22,7 +27,7 @@ export declare type OnErrorFn = (err: MissingTranslationError | MessageFormatErr
|
|
|
22
27
|
* With React, T would be React.ReactNode
|
|
23
28
|
*/
|
|
24
29
|
export interface ResolvedIntlConfig<T = string> {
|
|
25
|
-
locale:
|
|
30
|
+
locale: Locale;
|
|
26
31
|
timeZone?: string;
|
|
27
32
|
fallbackOnEmptyString?: boolean;
|
|
28
33
|
formats: CustomFormats;
|
|
@@ -63,7 +68,7 @@ export interface IntlFormatters<T = any, R = T> {
|
|
|
63
68
|
}
|
|
64
69
|
export interface Formatters {
|
|
65
70
|
getDateTimeFormat(...args: ConstructorParameters<typeof Intl.DateTimeFormat>): DateTimeFormat;
|
|
66
|
-
getNumberFormat(
|
|
71
|
+
getNumberFormat(locales?: string | string[], opts?: NumberFormatOptions): Intl.NumberFormat;
|
|
67
72
|
getMessageFormat(...args: ConstructorParameters<typeof IntlMessageFormat>): IntlMessageFormat;
|
|
68
73
|
getRelativeTimeFormat(...args: ConstructorParameters<typeof Intl.RelativeTimeFormat>): Intl.RelativeTimeFormat;
|
|
69
74
|
getPluralRules(...args: ConstructorParameters<typeof Intl.PluralRules>): Intl.PluralRules;
|
package/lib/src/types.d.ts.map
CHANGED
|
@@ -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,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,YAAY,CAAC;QACrB,UAAU,OAAO;SAAG;
|
|
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;AAC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AC,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/lib/src/utils.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IntlCache, CustomFormats, Formatters, OnErrorFn, ResolvedIntlConfig } from './types';
|
|
2
|
+
import { NumberFormatOptions } from '@formatjs/ecma402-abstract';
|
|
2
3
|
export declare function filterProps<T extends Record<string, any>, K extends string>(props: T, whitelist: Array<K>, defaults?: Partial<T>): Pick<T, K>;
|
|
3
4
|
export declare const DEFAULT_INTL_CONFIG: Pick<ResolvedIntlConfig<any>, 'fallbackOnEmptyString' | 'formats' | 'messages' | 'timeZone' | 'defaultLocale' | 'defaultFormats' | 'onError'>;
|
|
4
5
|
export declare function createIntlCache(): IntlCache;
|
|
@@ -7,5 +8,5 @@ export declare function createIntlCache(): IntlCache;
|
|
|
7
8
|
* @param cache explicit cache to prevent leaking memory
|
|
8
9
|
*/
|
|
9
10
|
export declare function createFormatters(cache?: IntlCache): Formatters;
|
|
10
|
-
export declare function getNamedFormat<T extends keyof CustomFormats>(formats: CustomFormats, type: T, name: string, onError: OnErrorFn):
|
|
11
|
+
export declare function getNamedFormat<T extends keyof CustomFormats>(formats: CustomFormats, type: T, name: string, onError: OnErrorFn): NumberFormatOptions | Intl.DateTimeFormatOptions | Intl.RelativeTimeFormatOptions | undefined;
|
|
11
12
|
//# sourceMappingURL=utils.d.ts.map
|
package/lib/src/utils.d.ts.map
CHANGED
|
@@ -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;
|
|
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;AAIhB,OAAO,EAAiB,mBAAmB,EAAC,MAAM,4BAA4B,CAAA;AAE9E,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,mBAAmB,GACnB,IAAI,CAAC,qBAAqB,GAC1B,IAAI,CAAC,yBAAyB,GAC9B,SAAS,CAWZ"}
|
package/lib/src/utils.js
CHANGED
|
@@ -151,5 +151,5 @@ export function getNamedFormat(formats, type, name, onError) {
|
|
|
151
151
|
if (format) {
|
|
152
152
|
return format;
|
|
153
153
|
}
|
|
154
|
-
onError(new UnsupportedFormatterError("No "
|
|
154
|
+
onError(new UnsupportedFormatterError("No ".concat(type, " format named: ").concat(name)));
|
|
155
155
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/intl",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.2",
|
|
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,16 +29,16 @@
|
|
|
29
29
|
"module": "lib/index.js",
|
|
30
30
|
"sideEffects": false,
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@formatjs/ecma402-abstract": "1.
|
|
33
|
-
"@formatjs/fast-memoize": "1.2.
|
|
34
|
-
"@formatjs/icu-messageformat-parser": "2.0.
|
|
35
|
-
"@formatjs/intl-displaynames": "5.
|
|
36
|
-
"@formatjs/intl-listformat": "6.
|
|
37
|
-
"intl-messageformat": "9.
|
|
32
|
+
"@formatjs/ecma402-abstract": "1.11.1",
|
|
33
|
+
"@formatjs/fast-memoize": "1.2.1",
|
|
34
|
+
"@formatjs/icu-messageformat-parser": "2.0.16",
|
|
35
|
+
"@formatjs/intl-displaynames": "5.4.0",
|
|
36
|
+
"@formatjs/intl-listformat": "6.5.0",
|
|
37
|
+
"intl-messageformat": "9.11.1",
|
|
38
38
|
"tslib": "^2.1.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"typescript": "^4.
|
|
41
|
+
"typescript": "^4.5"
|
|
42
42
|
},
|
|
43
43
|
"peerDependenciesMeta": {
|
|
44
44
|
"typescript": {
|
package/src/create-intl.js
CHANGED
|
@@ -32,7 +32,7 @@ function createIntl(config, cache) {
|
|
|
32
32
|
var locale = resolvedConfig.locale, defaultLocale = resolvedConfig.defaultLocale, onError = resolvedConfig.onError;
|
|
33
33
|
if (!locale) {
|
|
34
34
|
if (onError) {
|
|
35
|
-
onError(new error_1.InvalidConfigError("\"locale\" was not configured, using \""
|
|
35
|
+
onError(new error_1.InvalidConfigError("\"locale\" was not configured, using \"".concat(defaultLocale, "\" as fallback. See https://formatjs.io/docs/react-intl/api#intlshape for more details")));
|
|
36
36
|
}
|
|
37
37
|
// Since there's no registered locale data for `locale`, this will
|
|
38
38
|
// fallback to the `defaultLocale` to make sure things can render.
|
|
@@ -42,11 +42,11 @@ function createIntl(config, cache) {
|
|
|
42
42
|
resolvedConfig.locale = resolvedConfig.defaultLocale || 'en';
|
|
43
43
|
}
|
|
44
44
|
else if (!Intl.NumberFormat.supportedLocalesOf(locale).length && onError) {
|
|
45
|
-
onError(new error_1.MissingDataError("Missing locale data for locale: \""
|
|
45
|
+
onError(new error_1.MissingDataError("Missing locale data for locale: \"".concat(locale, "\" in Intl.NumberFormat. Using default locale: \"").concat(defaultLocale, "\" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details")));
|
|
46
46
|
}
|
|
47
47
|
else if (!Intl.DateTimeFormat.supportedLocalesOf(locale).length &&
|
|
48
48
|
onError) {
|
|
49
|
-
onError(new error_1.MissingDataError("Missing locale data for locale: \""
|
|
49
|
+
onError(new error_1.MissingDataError("Missing locale data for locale: \"".concat(locale, "\" in Intl.DateTimeFormat. Using default locale: \"").concat(defaultLocale, "\" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details")));
|
|
50
50
|
}
|
|
51
51
|
verifyConfigMessages(resolvedConfig);
|
|
52
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) });
|
package/src/dateTime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateTime.d.ts","sourceRoot":"","sources":["../../../../../../packages/intl/src/dateTime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,cAAc,EAAE,aAAa,EAAE,SAAS,EAAC,MAAM,SAAS,CAAA;AAI5E,OAAO,EAAC,cAAc,EAAC,MAAM,4BAA4B,CAAA;AA0BzD,wBAAgB,YAAY,CAC1B,EACE,MAAM,EACN,OAAO,EACP,OAAO,EACP,QAAQ,GACT,EAAE;IACD,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,aAAa,CAAA;IACtB,OAAO,EAAE,SAAS,CAAA;CACnB,EACD,IAAI,EAAE,MAAM,GAAG,MAAM,EACrB,iBAAiB,EAAE,UAAU,CAAC,mBAAmB,CAAC,EAClD,OAAO,GAAE,UAAU,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAM,GACxD,cAAc,
|
|
1
|
+
{"version":3,"file":"dateTime.d.ts","sourceRoot":"","sources":["../../../../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mB,CACjC,MAAM,EAAE;IACN,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,SAAS,CAAA;CACnB,EACD,iBAAiB,EAAE,UAAU,CAAC,mBAAmB,CAAC,EAClD,GAAG,CAAC,IAAI,EAAE,EAAE,EAAE,OAAY,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC,qBAAqB,CAAC,CAAC,GAC7E,MAAM,CAsBR;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE;IACN,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,aAAa,CAAA;IACtB,OAAO,EAAE,SAAS,CAAA;CACnB,EACD,iBAAiB,EAAE,UAAU,CAAC,mBAAmB,CAAC,EAClD,GAAG,CAAC,KAAK,EAAE,OAAY,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,GACjE,IAAI,CAAC,kBAAkB,EAAE,CAgB3B;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE;IACN,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,aAAa,CAAA;IACtB,OAAO,EAAE,SAAS,CAAA;CACnB,EACD,iBAAiB,EAAE,UAAU,CAAC,mBAAmB,CAAC,EAClD,GAAG,CAAC,KAAK,EAAE,OAAY,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC,GACxE,IAAI,CAAC,kBAAkB,EAAE,CAiB3B"}
|
package/src/dateTime.js
CHANGED
|
@@ -30,9 +30,7 @@ function getFormatter(_a, type, getDateTimeFormat, options) {
|
|
|
30
30
|
if (options === void 0) { options = {}; }
|
|
31
31
|
var format = options.format;
|
|
32
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
|
-
// @ts-expect-error es2020 has a lot stuff from es2021 bleed in
|
|
35
|
-
defaults);
|
|
33
|
+
var filteredOptions = (0, utils_1.filterProps)(options, DATE_TIME_FORMAT_OPTIONS, defaults);
|
|
36
34
|
if (type === 'time' &&
|
|
37
35
|
!filteredOptions.hour &&
|
|
38
36
|
!filteredOptions.minute &&
|
package/src/error.js
CHANGED
|
@@ -19,7 +19,7 @@ var IntlError = /** @class */ (function (_super) {
|
|
|
19
19
|
? exception
|
|
20
20
|
: new Error(String(exception))
|
|
21
21
|
: undefined;
|
|
22
|
-
_this = _super.call(this, "[@formatjs/intl Error "
|
|
22
|
+
_this = _super.call(this, "[@formatjs/intl Error ".concat(code, "] ").concat(message, " \n").concat(err ? "\n".concat(err.message, "\n").concat(err.stack) : '')) || this;
|
|
23
23
|
_this.code = code;
|
|
24
24
|
// @ts-ignore just so we don't need to declare dep on @types/node
|
|
25
25
|
if (typeof Error.captureStackTrace === 'function') {
|
|
@@ -58,7 +58,7 @@ exports.MissingDataError = MissingDataError;
|
|
|
58
58
|
var IntlFormatError = /** @class */ (function (_super) {
|
|
59
59
|
(0, tslib_1.__extends)(IntlFormatError, _super);
|
|
60
60
|
function IntlFormatError(message, locale, exception) {
|
|
61
|
-
return _super.call(this, IntlErrorCode.FORMAT_ERROR, message
|
|
61
|
+
return _super.call(this, IntlErrorCode.FORMAT_ERROR, "".concat(message, " \nLocale: ").concat(locale, "\n"), exception) || this;
|
|
62
62
|
}
|
|
63
63
|
return IntlFormatError;
|
|
64
64
|
}(IntlError));
|
|
@@ -66,7 +66,7 @@ exports.IntlFormatError = IntlFormatError;
|
|
|
66
66
|
var MessageFormatError = /** @class */ (function (_super) {
|
|
67
67
|
(0, tslib_1.__extends)(MessageFormatError, _super);
|
|
68
68
|
function MessageFormatError(message, locale, descriptor, exception) {
|
|
69
|
-
var _this = _super.call(this, message
|
|
69
|
+
var _this = _super.call(this, "".concat(message, " \nMessageID: ").concat(descriptor === null || descriptor === void 0 ? void 0 : descriptor.id, "\nDefault Message: ").concat(descriptor === null || descriptor === void 0 ? void 0 : descriptor.defaultMessage, "\nDescription: ").concat(descriptor === null || descriptor === void 0 ? void 0 : descriptor.description, " \n"), locale, exception) || this;
|
|
70
70
|
_this.descriptor = descriptor;
|
|
71
71
|
return _this;
|
|
72
72
|
}
|
|
@@ -76,7 +76,7 @@ exports.MessageFormatError = MessageFormatError;
|
|
|
76
76
|
var MissingTranslationError = /** @class */ (function (_super) {
|
|
77
77
|
(0, tslib_1.__extends)(MissingTranslationError, _super);
|
|
78
78
|
function MissingTranslationError(descriptor, locale) {
|
|
79
|
-
var _this = _super.call(this, IntlErrorCode.MISSING_TRANSLATION, "Missing message: \""
|
|
79
|
+
var _this = _super.call(this, IntlErrorCode.MISSING_TRANSLATION, "Missing message: \"".concat(descriptor.id, "\" for locale \"").concat(locale, "\", using ").concat(descriptor.defaultMessage ? 'default message' : 'id', " as fallback.")) || this;
|
|
80
80
|
_this.descriptor = descriptor;
|
|
81
81
|
return _this;
|
|
82
82
|
}
|
package/src/list.js
CHANGED
|
@@ -12,7 +12,7 @@ var LIST_FORMAT_OPTIONS = [
|
|
|
12
12
|
];
|
|
13
13
|
var now = Date.now();
|
|
14
14
|
function generateToken(i) {
|
|
15
|
-
return now
|
|
15
|
+
return "".concat(now, "_").concat(i, "_").concat(now);
|
|
16
16
|
}
|
|
17
17
|
function formatList(opts, getListFormat, values, options) {
|
|
18
18
|
if (options === void 0) { options = {}; }
|
package/src/message.js
CHANGED
|
@@ -73,7 +73,7 @@ function formatMessage(_a, state, messageDescriptor, values, opts) {
|
|
|
73
73
|
return formatter.format(values);
|
|
74
74
|
}
|
|
75
75
|
catch (e) {
|
|
76
|
-
onError(new error_1.MessageFormatError("Error formatting default message for: \""
|
|
76
|
+
onError(new error_1.MessageFormatError("Error formatting default message for: \"".concat(id, "\", rendering default message verbatim"), locale, messageDescriptor, e));
|
|
77
77
|
return typeof defaultMessage === 'string' ? defaultMessage : id;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
@@ -85,7 +85,7 @@ function formatMessage(_a, state, messageDescriptor, values, opts) {
|
|
|
85
85
|
return formatter.format(values);
|
|
86
86
|
}
|
|
87
87
|
catch (e) {
|
|
88
|
-
onError(new error_1.MessageFormatError("Error formatting message: \""
|
|
88
|
+
onError(new error_1.MessageFormatError("Error formatting message: \"".concat(id, "\", using ").concat(defaultMessage ? 'default message' : 'id', " as fallback."), locale, messageDescriptor, e));
|
|
89
89
|
}
|
|
90
90
|
if (defaultMessage) {
|
|
91
91
|
try {
|
|
@@ -93,7 +93,7 @@ function formatMessage(_a, state, messageDescriptor, values, opts) {
|
|
|
93
93
|
return formatter.format(values);
|
|
94
94
|
}
|
|
95
95
|
catch (e) {
|
|
96
|
-
onError(new error_1.MessageFormatError("Error formatting the default message for: \""
|
|
96
|
+
onError(new error_1.MessageFormatError("Error formatting the default message for: \"".concat(id, "\", rendering message verbatim"), locale, messageDescriptor, e));
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
if (typeof message === 'string') {
|
package/src/types.d.ts
CHANGED
|
@@ -10,11 +10,16 @@ declare global {
|
|
|
10
10
|
namespace FormatjsIntl {
|
|
11
11
|
interface Message {
|
|
12
12
|
}
|
|
13
|
+
interface IntlConfig {
|
|
14
|
+
}
|
|
13
15
|
}
|
|
14
16
|
}
|
|
15
17
|
declare type MessageIds = FormatjsIntl.Message extends {
|
|
16
18
|
ids: string;
|
|
17
19
|
} ? FormatjsIntl.Message['ids'] : string;
|
|
20
|
+
declare type Locale = FormatjsIntl.IntlConfig extends {
|
|
21
|
+
locale: string;
|
|
22
|
+
} ? FormatjsIntl.IntlConfig['locale'] : string;
|
|
18
23
|
export declare type OnErrorFn = (err: MissingTranslationError | MessageFormatError | MissingDataError | InvalidConfigError | UnsupportedFormatterError | FormatError) => void;
|
|
19
24
|
/**
|
|
20
25
|
* Config for intl object.
|
|
@@ -22,7 +27,7 @@ export declare type OnErrorFn = (err: MissingTranslationError | MessageFormatErr
|
|
|
22
27
|
* With React, T would be React.ReactNode
|
|
23
28
|
*/
|
|
24
29
|
export interface ResolvedIntlConfig<T = string> {
|
|
25
|
-
locale:
|
|
30
|
+
locale: Locale;
|
|
26
31
|
timeZone?: string;
|
|
27
32
|
fallbackOnEmptyString?: boolean;
|
|
28
33
|
formats: CustomFormats;
|
|
@@ -63,7 +68,7 @@ export interface IntlFormatters<T = any, R = T> {
|
|
|
63
68
|
}
|
|
64
69
|
export interface Formatters {
|
|
65
70
|
getDateTimeFormat(...args: ConstructorParameters<typeof Intl.DateTimeFormat>): DateTimeFormat;
|
|
66
|
-
getNumberFormat(
|
|
71
|
+
getNumberFormat(locales?: string | string[], opts?: NumberFormatOptions): Intl.NumberFormat;
|
|
67
72
|
getMessageFormat(...args: ConstructorParameters<typeof IntlMessageFormat>): IntlMessageFormat;
|
|
68
73
|
getRelativeTimeFormat(...args: ConstructorParameters<typeof Intl.RelativeTimeFormat>): Intl.RelativeTimeFormat;
|
|
69
74
|
getPluralRules(...args: ConstructorParameters<typeof Intl.PluralRules>): Intl.PluralRules;
|
package/src/types.d.ts.map
CHANGED
|
@@ -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,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,YAAY,CAAC;QACrB,UAAU,OAAO;SAAG;
|
|
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;QACpB,UAAU,UAAU;SAAG;KACxB;CACF;AAED,aAAK,UAAU,GAAG,YAAY,CAAC,OAAO,SAAS;IAAC,GAAG,EAAE,MAAM,CAAA;CAAC,GACxD,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,GAC3B,MAAM,C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CAAA;IACjB,eAAe,CACb,GAAG,IAAI,EAAE,qBAAqB,CAAC,OAAO,YAAY,CAAC,GAClD,YAAY,CAAA;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,4 +1,5 @@
|
|
|
1
1
|
import { IntlCache, CustomFormats, Formatters, OnErrorFn, ResolvedIntlConfig } from './types';
|
|
2
|
+
import { NumberFormatOptions } from '@formatjs/ecma402-abstract';
|
|
2
3
|
export declare function filterProps<T extends Record<string, any>, K extends string>(props: T, whitelist: Array<K>, defaults?: Partial<T>): Pick<T, K>;
|
|
3
4
|
export declare const DEFAULT_INTL_CONFIG: Pick<ResolvedIntlConfig<any>, 'fallbackOnEmptyString' | 'formats' | 'messages' | 'timeZone' | 'defaultLocale' | 'defaultFormats' | 'onError'>;
|
|
4
5
|
export declare function createIntlCache(): IntlCache;
|
|
@@ -7,5 +8,5 @@ export declare function createIntlCache(): IntlCache;
|
|
|
7
8
|
* @param cache explicit cache to prevent leaking memory
|
|
8
9
|
*/
|
|
9
10
|
export declare function createFormatters(cache?: IntlCache): Formatters;
|
|
10
|
-
export declare function getNamedFormat<T extends keyof CustomFormats>(formats: CustomFormats, type: T, name: string, onError: OnErrorFn):
|
|
11
|
+
export declare function getNamedFormat<T extends keyof CustomFormats>(formats: CustomFormats, type: T, name: string, onError: OnErrorFn): NumberFormatOptions | Intl.DateTimeFormatOptions | Intl.RelativeTimeFormatOptions | undefined;
|
|
11
12
|
//# sourceMappingURL=utils.d.ts.map
|
package/src/utils.d.ts.map
CHANGED
|
@@ -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;
|
|
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;AAIhB,OAAO,EAAiB,mBAAmB,EAAC,MAAM,4BAA4B,CAAA;AAE9E,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,mBAAmB,GACnB,IAAI,CAAC,qBAAqB,GAC1B,IAAI,CAAC,yBAAyB,GAC9B,SAAS,CAWZ"}
|
package/src/utils.js
CHANGED
|
@@ -157,6 +157,6 @@ function getNamedFormat(formats, type, name, onError) {
|
|
|
157
157
|
if (format) {
|
|
158
158
|
return format;
|
|
159
159
|
}
|
|
160
|
-
onError(new error_1.UnsupportedFormatterError("No "
|
|
160
|
+
onError(new error_1.UnsupportedFormatterError("No ".concat(type, " format named: ").concat(name)));
|
|
161
161
|
}
|
|
162
162
|
exports.getNamedFormat = getNamedFormat;
|