Skip to content

Commit ba73b17

Browse files
committed
Upgrade packages
I upgraded as many packages as I could without causing issues I couldn't fix. We'll probably want to switch from Mocha to Jest if we keep this package around much longer.
1 parent edab5d1 commit ba73b17

22 files changed

+905
-301
lines changed

dist/es6/format.d.ts

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
1-
export declare type IntlFormat = Intl.DateTimeFormat | Intl.NumberFormat;
2-
export declare type IntlFormatType<X extends IntlFormat> = X extends Intl.DateTimeFormat ? typeof Intl.DateTimeFormat : typeof Intl.NumberFormat;
3-
export declare type IntlFormatOptions<X extends IntlFormat> = X extends Intl.DateTimeFormat ? Intl.DateTimeFormatOptions : Intl.NumberFormatOptions;
4-
export declare type CachedFormatter<X extends IntlFormat> = (locale: string, formatOptions?: IntlFormatOptions<X>) => X;
1+
export type IntlFormat = Intl.DateTimeFormat | Intl.NumberFormat;
2+
export type IntlFormatType<X extends IntlFormat> = X extends Intl.DateTimeFormat ? typeof Intl.DateTimeFormat : typeof Intl.NumberFormat;
3+
export type IntlFormatOptions<X extends IntlFormat> = X extends Intl.DateTimeFormat ? Intl.DateTimeFormatOptions : Intl.NumberFormatOptions;
4+
export type CachedFormatter<X extends IntlFormat> = (locale: string, formatOptions?: IntlFormatOptions<X>) => X;
55
export declare const dateTimeFormats: {
6-
short: {
7-
month: string;
8-
day: string;
9-
year: string;
6+
readonly short: {
7+
readonly month: "short";
8+
readonly day: "numeric";
9+
readonly year: "numeric";
1010
};
11-
long: {
12-
month: string;
13-
day: string;
14-
year: string;
11+
readonly long: {
12+
readonly month: "long";
13+
readonly day: "numeric";
14+
readonly year: "numeric";
1515
};
16-
dateTime: {
17-
month: string;
18-
day: string;
19-
year: string;
20-
hour: string;
21-
minute: string;
16+
readonly dateTime: {
17+
readonly month: "short";
18+
readonly day: "numeric";
19+
readonly year: "numeric";
20+
readonly hour: "numeric";
21+
readonly minute: "numeric";
2222
};
2323
};
2424
export declare const numberFormats: {
25-
currency: {
26-
style: string;
27-
currency: string;
25+
readonly currency: {
26+
readonly style: "currency";
27+
readonly currency: "USD";
2828
};
29-
decimal: {
30-
style: string;
29+
readonly decimal: {
30+
readonly style: "decimal";
3131
};
32-
percent: {
33-
style: string;
32+
readonly percent: {
33+
readonly style: "percent";
3434
};
3535
};
3636
export default function createCachedFormatter<X extends IntlFormat>(intlFormat: IntlFormatType<X>): CachedFormatter<X>;

dist/es6/t-i18n.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export interface IntlFormatters {
1212
date: (value: Date | number, formatName?: keyof typeof dateTimeFormats, locale?: string) => string;
1313
number: (value: number, formatName?: keyof typeof numberFormats, locale?: string) => string;
1414
}
15-
export declare type TFunc = BasicTFunc & IntlFormatters;
15+
export type TFunc = BasicTFunc & IntlFormatters;
1616
export declare const makeBasicT: () => BasicTFunc;
1717
export declare const makeT: () => TFunc;
1818
declare const _default: TFunc;

dist/es6/t-i18n.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ const makeIntlFormatters = (locale) => {
2424
const getDateTimeFormat = () => {
2525
const delegate = Intl.DateTimeFormat;
2626
function DateTimeFormat() {
27-
var _a, _b, _c;
27+
var _a;
2828
const args = Array.prototype.slice.apply(arguments);
29-
const lang = typeof ((_a = args) === null || _a === void 0 ? void 0 : _a[0]) === "string" ? args[0] : "en-US";
30-
const timeZone = typeof ((_c = (_b = args) === null || _b === void 0 ? void 0 : _b[1]) === null || _c === void 0 ? void 0 : _c.timeZone) === "string" ? args[1].timeZone : "America/Toronto";
29+
const lang = typeof (args === null || args === void 0 ? void 0 : args[0]) === "string" ? args[0] : "en-US";
30+
const timeZone = typeof ((_a = args === null || args === void 0 ? void 0 : args[1]) === null || _a === void 0 ? void 0 : _a.timeZone) === "string" ? args[1].timeZone : "America/Toronto";
3131
return delegate.apply(this, [lang, timeZone]);
3232
}
3333
DateTimeFormat.prototype = delegate.prototype;

dist/es6/types.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
export declare type MFunc = (replacements?: IcuReplacements) => string;
2-
export declare type Compiler = (message: string) => MFunc;
1+
export type MFunc = (replacements?: IcuReplacements) => string;
2+
export type Compiler = (message: string) => MFunc;
33
export interface Messages {
44
[s: string]: {
55
[s: string]: string | MFunc;
@@ -10,8 +10,8 @@ export interface Config {
1010
locale: string;
1111
idGenerator: (message: string) => string;
1212
}
13-
export declare type Mutable<X> = {
14-
[P in keyof X]: X[P];
13+
export type Mutable<X> = {
14+
-readonly [P in keyof X]: X[P];
1515
};
1616
export interface IcuReplacements {
1717
readonly [s: string]: string | number;

dist/es6/types.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {};

dist/format.d.ts

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
1-
export declare type IntlFormat = Intl.DateTimeFormat | Intl.NumberFormat;
2-
export declare type IntlFormatType<X extends IntlFormat> = X extends Intl.DateTimeFormat ? typeof Intl.DateTimeFormat : typeof Intl.NumberFormat;
3-
export declare type IntlFormatOptions<X extends IntlFormat> = X extends Intl.DateTimeFormat ? Intl.DateTimeFormatOptions : Intl.NumberFormatOptions;
4-
export declare type CachedFormatter<X extends IntlFormat> = (locale: string, formatOptions?: IntlFormatOptions<X>) => X;
1+
export type IntlFormat = Intl.DateTimeFormat | Intl.NumberFormat;
2+
export type IntlFormatType<X extends IntlFormat> = X extends Intl.DateTimeFormat ? typeof Intl.DateTimeFormat : typeof Intl.NumberFormat;
3+
export type IntlFormatOptions<X extends IntlFormat> = X extends Intl.DateTimeFormat ? Intl.DateTimeFormatOptions : Intl.NumberFormatOptions;
4+
export type CachedFormatter<X extends IntlFormat> = (locale: string, formatOptions?: IntlFormatOptions<X>) => X;
55
export declare const dateTimeFormats: {
6-
short: {
7-
month: string;
8-
day: string;
9-
year: string;
6+
readonly short: {
7+
readonly month: "short";
8+
readonly day: "numeric";
9+
readonly year: "numeric";
1010
};
11-
long: {
12-
month: string;
13-
day: string;
14-
year: string;
11+
readonly long: {
12+
readonly month: "long";
13+
readonly day: "numeric";
14+
readonly year: "numeric";
1515
};
16-
dateTime: {
17-
month: string;
18-
day: string;
19-
year: string;
20-
hour: string;
21-
minute: string;
16+
readonly dateTime: {
17+
readonly month: "short";
18+
readonly day: "numeric";
19+
readonly year: "numeric";
20+
readonly hour: "numeric";
21+
readonly minute: "numeric";
2222
};
2323
};
2424
export declare const numberFormats: {
25-
currency: {
26-
style: string;
27-
currency: string;
25+
readonly currency: {
26+
readonly style: "currency";
27+
readonly currency: "USD";
2828
};
29-
decimal: {
30-
style: string;
29+
readonly decimal: {
30+
readonly style: "decimal";
3131
};
32-
percent: {
33-
style: string;
32+
readonly percent: {
33+
readonly style: "percent";
3434
};
3535
};
3636
export default function createCachedFormatter<X extends IntlFormat>(intlFormat: IntlFormatType<X>): CachedFormatter<X>;

dist/format.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
"use strict";
2-
var __spreadArrays = (this && this.__spreadArrays) || function () {
3-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
4-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
5-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
6-
r[k] = a[j];
7-
return r;
2+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4+
if (ar || !(i in from)) {
5+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6+
ar[i] = from[i];
7+
}
8+
}
9+
return to.concat(ar || Array.prototype.slice.call(from));
810
};
911
Object.defineProperty(exports, "__esModule", { value: true });
12+
exports.numberFormats = exports.dateTimeFormats = void 0;
13+
exports.default = createCachedFormatter;
1014
exports.dateTimeFormats = {
1115
short: {
1216
month: "short",
@@ -46,9 +50,8 @@ function createCachedFormatter(intlFormat) {
4650
var id = locale + "-" + JSON.stringify(formatOptions);
4751
if (id in cache)
4852
return cache[id];
49-
var formatter = new ((_a = Function.prototype.bind).call.apply(_a, __spreadArrays([intlFormat, null], args)));
53+
var formatter = new ((_a = Function.prototype.bind).call.apply(_a, __spreadArray([intlFormat, null], args, false)));
5054
cache[id] = formatter;
5155
return formatter;
5256
};
5357
}
54-
exports.default = createCachedFormatter;

dist/helpers.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
3+
exports.assign = exports.splitAndEscapeReplacements = exports.generator = void 0;
4+
exports.Plural = Plural;
35
var spaceRegex = /\s/g;
46
var nonWordRegex = /\W/g;
57
exports.generator = {
@@ -18,7 +20,6 @@ function Plural(pluralizeFor, options) {
1820
(one ? "\tone{" + one + "}\n" : "") +
1921
("\tother{" + other + "}}");
2022
}
21-
exports.Plural = Plural;
2223
var xmlEscapes = {
2324
"&": "&amp;",
2425
"<": "&lt;",
@@ -27,7 +28,7 @@ var xmlEscapes = {
2728
"'": '&#39;'
2829
};
2930
var escapeXml = function (str) { return (str.replace(/[&<>"']/g, function (match) { return xmlEscapes[match]; })); };
30-
exports.splitAndEscapeReplacements = function (replacements) {
31+
var splitAndEscapeReplacements = function (replacements) {
3132
var icu = {};
3233
var xml = {};
3334
for (var key in replacements) {
@@ -46,7 +47,8 @@ exports.splitAndEscapeReplacements = function (replacements) {
4647
}
4748
return [icu, xml];
4849
};
49-
exports.assign = function (target, source) {
50+
exports.splitAndEscapeReplacements = splitAndEscapeReplacements;
51+
var assign = function (target, source) {
5052
var to = Object(target);
5153
for (var nextKey in source) {
5254
if (Object.prototype.hasOwnProperty.call(source, nextKey)) {
@@ -55,3 +57,4 @@ exports.assign = function (target, source) {
5557
}
5658
return to;
5759
};
60+
exports.assign = assign;

dist/icu.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
3+
exports.default = parseIcu;
34
var TOKEN = {
45
OPEN: '{',
56
CLOSE: '}',
@@ -26,4 +27,3 @@ function parseIcu(icuString, replacements) {
2627
elements.push(currentToken);
2728
return elements.join('');
2829
}
29-
exports.default = parseIcu;

dist/index.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
3+
exports.makeT = exports.makeBasicT = exports.T = exports.generator = exports.Plural = void 0;
34
var helpers_1 = require("./helpers");
4-
exports.Plural = helpers_1.Plural;
5-
exports.generator = helpers_1.generator;
5+
Object.defineProperty(exports, "Plural", { enumerable: true, get: function () { return helpers_1.Plural; } });
6+
Object.defineProperty(exports, "generator", { enumerable: true, get: function () { return helpers_1.generator; } });
67
var t_i18n_1 = require("./t-i18n");
7-
exports.T = t_i18n_1.default;
8-
exports.makeBasicT = t_i18n_1.makeBasicT;
9-
exports.makeT = t_i18n_1.makeT;
8+
Object.defineProperty(exports, "T", { enumerable: true, get: function () { return t_i18n_1.default; } });
9+
Object.defineProperty(exports, "makeBasicT", { enumerable: true, get: function () { return t_i18n_1.makeBasicT; } });
10+
Object.defineProperty(exports, "makeT", { enumerable: true, get: function () { return t_i18n_1.makeT; } });

0 commit comments

Comments
 (0)