@cloudflare/intl-core
Advanced tools
Comparing version 1.14.1 to 1.14.2
@@ -6,2 +6,10 @@ # Change Log | ||
## [1.14.2](https://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/intl-core@1.14.1...@cloudflare/intl-core@1.14.2) (2023-10-25) | ||
**Note:** Version bump only for package @cloudflare/intl-core | ||
## [1.14.1](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/intl-core@1.14.0...@cloudflare/intl-core@1.14.1) (2023-08-30) | ||
@@ -8,0 +16,0 @@ |
@@ -1,21 +0,18 @@ | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
export class TranslatorError extends Error { | ||
constructor(translationKey, message) { | ||
super(message); | ||
_defineProperty(this, "translationKey", void 0); | ||
this.translationKey = translationKey; | ||
this.name = 'TranslatorError'; | ||
} | ||
} | ||
export class TranslatorKeyNotFoundError extends TranslatorError { | ||
constructor(key) { | ||
super(key, `Translation key not found: ${key}`); | ||
super(key, "Translation key not found: ".concat(key)); | ||
this.name = 'TranslatorKeyNotFoundError'; | ||
} | ||
} | ||
export default TranslatorError; |
import { Interpolation } from '@cloudflare/intl-types'; | ||
export function trans(strings, ...keys) { | ||
const string = strings.reduce((accum, str, i) => { | ||
let result = accum + str; | ||
const paramName = keys[i]; | ||
export function trans(strings) { | ||
for (var _len = arguments.length, keys = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
keys[_key - 1] = arguments[_key]; | ||
} | ||
var string = strings.reduce((accum, str, i) => { | ||
var result = accum + str; | ||
var paramName = keys[i]; | ||
if (typeof paramName === 'string') { | ||
result += `%{${paramName}}`; | ||
result += "%{".concat(paramName, "}"); | ||
} | ||
return result; | ||
@@ -12,0 +13,0 @@ }, ''); |
@@ -1,53 +0,46 @@ | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } | ||
function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } | ||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
function _readOnlyError(name) { throw new TypeError("\"" + name + "\" is read-only"); } | ||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } | ||
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } | ||
import { SupportedLocales } from './index'; | ||
var loadLocale = /*#__PURE__*/function () { | ||
var _ref = _asyncToGenerator(function* (locales, locale) { | ||
var module = yield locales[locale](); | ||
if (module.translations) { | ||
return module.translations; | ||
} | ||
const loadLocale = async (locales, locale) => { | ||
const module = await locales[locale](); | ||
// with weback 4.0 the module is loaded into the default attr | ||
// in older versions it is not | ||
return module.default ? module.default : module; | ||
}); | ||
return function loadLocale(_x, _x2) { | ||
return _ref.apply(this, arguments); | ||
}; | ||
}(); | ||
if (module.translations) { | ||
return module.translations; | ||
} // with weback 4.0 the module is loaded into the default attr | ||
// in older versions it is not | ||
return module.default ? module.default : module; | ||
}; //returns a function which returns a Promise resolving in phrases for a particular locale. | ||
//returns a function which returns a Promise resolving in phrases for a particular locale. | ||
//loads english catalog by default and overwrites it with catalog in target language. | ||
//so that for any phrases for which target language catalog is missing a value, the english one is used. | ||
var makeLoadPhrases = function loadPhrases(locales) { | ||
var loadPhrases = /*#__PURE__*/function () { | ||
var _ref2 = _asyncToGenerator(function* (locale) { | ||
if (locale === SupportedLocales.en_US) { | ||
return loadLocale(locales, locale); | ||
} | ||
var [enPhrases, otherPhrases] = yield Promise.all([loadLocale(locales, SupportedLocales.en_US), loadLocale(locales, locale)]); | ||
const makeLoadPhrases = function loadPhrases(locales) { | ||
const loadPhrases = async locale => { | ||
if (locale === SupportedLocales.en_US) { | ||
return loadLocale(locales, locale); | ||
} | ||
const _await$Promise$all = await Promise.all([loadLocale(locales, SupportedLocales.en_US), loadLocale(locales, locale)]), | ||
_await$Promise$all2 = _slicedToArray(_await$Promise$all, 2), | ||
enPhrases = _await$Promise$all2[0], | ||
otherPhrases = _await$Promise$all2[1]; // enPhrases are the English phrases and otherPhrases should be the target locale's phrases | ||
// otherPhrases clobbers the English phrase key if it exists | ||
return _objectSpread({}, enPhrases, otherPhrases); | ||
}; | ||
// enPhrases are the English phrases and otherPhrases should be the target locale's phrases | ||
// otherPhrases clobbers the English phrase key if it exists | ||
return _objectSpread({}, enPhrases, otherPhrases); | ||
}); | ||
return function loadPhrases(_x3) { | ||
return _ref2.apply(this, arguments); | ||
}; | ||
}(); | ||
return loadPhrases; | ||
}; | ||
export default makeLoadPhrases; |
import set from 'lodash/set'; | ||
import { Interpolation } from '@cloudflare/intl-types'; | ||
/** | ||
@@ -25,6 +26,5 @@ * Prepares a catalog for use with our intl libraries and exports | ||
*/ | ||
export function prepareTranslations(namespace, trans) { | ||
const translations = flattenCatalog(namespace, trans); | ||
const keys = Object.keys(translations).reduce((result, key) => set(result, key.substring(`${namespace}.`.length), key), {}); | ||
var translations = flattenCatalog(namespace, trans); | ||
var keys = Object.keys(translations).reduce((result, key) => set(result, key.substring("".concat(namespace, ".").length), key), {}); | ||
return { | ||
@@ -36,2 +36,3 @@ translations, | ||
} | ||
/** | ||
@@ -55,11 +56,8 @@ * Takes a nested catalog of the form: | ||
*/ | ||
function flattenCatalog(namespace, obj) { | ||
const result = {}; | ||
const keys = [namespace]; | ||
var result = {}; | ||
var keys = [namespace]; | ||
function iterate(obj) { | ||
Object.keys(obj).forEach(key => { | ||
keys.push(key); | ||
if (typeof obj[key] === 'string' || obj[key] instanceof Interpolation) { | ||
@@ -70,9 +68,7 @@ result[keys.join('.')] = obj[key].toString(); | ||
} | ||
keys.pop(); | ||
}); | ||
} | ||
iterate(obj); | ||
return result; | ||
} |
@@ -1,5 +0,5 @@ | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } | ||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
/* This module was converted to TypeScript from | ||
@@ -10,3 +10,4 @@ * https://github.com/bunkat/pseudoloc/blob/306d43f66dd8630b066b5b38fe291fd251a01417/pseudoloc.js | ||
*/ | ||
export const DEFAULT_OPTIONS = { | ||
export var DEFAULT_OPTIONS = { | ||
prepend: '[!!', | ||
@@ -20,3 +21,3 @@ append: '!!]', | ||
}; | ||
export const CHARACTER_TABLE = { | ||
export var CHARACTER_TABLE = { | ||
A: String.fromCharCode(192, 193, 194, 195, 196, 197, 256, 258, 260, 506, 512, 514), | ||
@@ -69,49 +70,39 @@ a: String.fromCharCode(224, 225, 226, 227, 228, 229, 257, 259, 261, 507, 513, 515), | ||
}; | ||
export const pseudoloc = { | ||
export var pseudoloc = { | ||
version: '1.1.0', | ||
option: _objectSpread({}, DEFAULT_OPTIONS), | ||
reset() { | ||
this.option = _objectSpread({}, DEFAULT_OPTIONS); | ||
}, | ||
table: CHARACTER_TABLE, | ||
pad(str, percent) { | ||
var lenLeft = Math.floor(str.length * percent / 2), | ||
lenRight = lenLeft, | ||
pStr = str; | ||
lenRight = lenLeft, | ||
pStr = str; | ||
while (lenLeft-- > 0) { | ||
pStr = ' ' + pStr; | ||
} | ||
while (lenRight-- > 0) { | ||
pStr = pStr + ' '; | ||
} | ||
return pStr; | ||
}, | ||
str(str) { | ||
var opts = this.option, | ||
startdelim = opts.startDelimiter || opts.delimiter, | ||
enddelim = opts.endDelimiter || opts.delimiter, | ||
re = new RegExp(startdelim + '\\s*[\\w\\.\\s*]+\\s*' + enddelim, 'g'), | ||
m, | ||
tokens = [], | ||
i = 0, | ||
tokenIdx = 0, | ||
result = '', | ||
c, | ||
pc; | ||
startdelim = opts.startDelimiter || opts.delimiter, | ||
enddelim = opts.endDelimiter || opts.delimiter, | ||
re = new RegExp(startdelim + '\\s*[\\w\\.\\s*]+\\s*' + enddelim, 'g'), | ||
m, | ||
tokens = [], | ||
i = 0, | ||
tokenIdx = 0, | ||
result = '', | ||
c, | ||
pc; | ||
while (m = re.exec(str)) { | ||
tokens.push(m); | ||
} | ||
var token = tokens[tokenIdx++] || { | ||
index: -1 | ||
}; | ||
while (i < str.length) { | ||
@@ -126,6 +117,4 @@ if (token.index === i) { | ||
} | ||
c = opts.override !== undefined ? opts.override : str[i]; | ||
pc = CHARACTER_TABLE[c]; | ||
if (pc) { | ||
@@ -135,11 +124,8 @@ var diacriticalIndex = str.length % pc.length; | ||
} | ||
result += c; | ||
i++; | ||
} | ||
return opts.prepend + this.pad(result, opts.extend) + opts.append; | ||
} | ||
}; | ||
export default pseudoloc; |
@@ -1,3 +0,4 @@ | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
import Polyglot from 'node-polyglot'; | ||
@@ -12,17 +13,15 @@ import { SupportedLocales } from '@cloudflare/intl-types'; | ||
pseudoloc.option.endDelimiter = '}'; | ||
class Translator { | ||
constructor(options) { | ||
_defineProperty(this, "map", void 0); | ||
_defineProperty(this, "currentLocale", SupportedLocales.en_US); | ||
_defineProperty(this, "options", void 0); | ||
_defineProperty(this, "psudoLocalizePhrases", phrases => { | ||
return Object.entries(phrases).reduce((acc, [key, value]) => Object.assign(acc, { | ||
[key]: pseudoloc.str(value) | ||
}), {}); | ||
return Object.entries(phrases).reduce((acc, _ref) => { | ||
var [key, value] = _ref; | ||
return Object.assign(acc, { | ||
[key]: pseudoloc.str(value) | ||
}); | ||
}, {}); | ||
}); | ||
_defineProperty(this, "getInstance", locale => { | ||
@@ -35,6 +34,4 @@ if (locale) { | ||
}); | ||
_defineProperty(this, "getInstanceMatchingPhrase", phrase => { | ||
const p = this.getInstance(); | ||
var p = this.getInstance(); | ||
if (p.has(phrase)) { | ||
@@ -46,16 +43,11 @@ return p; | ||
}); | ||
_defineProperty(this, "extend", (phrases, locale) => { | ||
const p = this.getInstance(locale); | ||
var p = this.getInstance(locale); | ||
if (this.options.pseudoLoc) { | ||
phrases = this.psudoLocalizePhrases(phrases); | ||
} | ||
p.extend(phrases); | ||
}); | ||
_defineProperty(this, "t", (phrase, arg) => { | ||
const p = this.getInstanceMatchingPhrase(phrase); | ||
var p = this.getInstanceMatchingPhrase(phrase); | ||
if (arg) { | ||
@@ -68,14 +60,10 @@ if (typeof arg === 'number') { | ||
} | ||
return p.t(phrase); | ||
}); | ||
_defineProperty(this, "tm", (phrase, arg) => { | ||
return markdown(this.t(phrase, arg)); | ||
}); | ||
_defineProperty(this, "clear", () => { | ||
this.getInstance().clear(); | ||
}); | ||
_defineProperty(this, "replace", phrases => { | ||
@@ -85,10 +73,7 @@ if (this.options.pseudoLoc) { | ||
} | ||
this.getInstance().replace(phrases); | ||
}); | ||
_defineProperty(this, "locale", locale => { | ||
if (locale) { | ||
this.currentLocale = locale; | ||
if (!this.map[locale]) { | ||
@@ -98,10 +83,7 @@ this.createInstance(locale); | ||
} | ||
return this.currentLocale; | ||
}); | ||
_defineProperty(this, "has", phrase => { | ||
return this.getInstanceMatchingPhrase(phrase).has(phrase); | ||
}); | ||
_defineProperty(this, "translateSeconds", seconds => { | ||
@@ -115,3 +97,2 @@ // Prevent 0 seconds returning "0 days" | ||
} | ||
if (seconds % 3600 === 0) { | ||
@@ -122,3 +103,2 @@ return this.t('time.num_hours', { | ||
} | ||
if (seconds % 60 === 0) { | ||
@@ -130,3 +110,2 @@ return this.t('time.num_minutes', { | ||
} | ||
return this.t('time.num_seconds', { | ||
@@ -136,35 +115,31 @@ smart_count: seconds | ||
}); | ||
_defineProperty(this, "translateObject", phrases => { | ||
return mapValues(phrases, this.t); | ||
}); | ||
this.map = {}; | ||
this.options = options || {}; | ||
this.options.allowMissing = true; | ||
this.options.onMissingKey = (key, options, locale) => { | ||
if (process.env.NODE_ENV === 'staging' || process.env.NODE_ENV === 'production') { | ||
console.error(new TranslatorKeyNotFoundError(key)); // If a fallback is present, display that | ||
console.error(new TranslatorKeyNotFoundError(key)); | ||
if (options._) return options._; // Otherwise display the raw key | ||
// If a fallback is present, display that | ||
if (options._) return options._; | ||
// Otherwise display the raw key | ||
return key; | ||
} | ||
if (process.env.NODE_ENV === 'test') { | ||
return key; | ||
} | ||
throw new Error(`Translation error. The translate function was called on a key that does not exist or is in a catalog that has not yet been loaded. Key: ${key}. Locale: ${locale}. There are several reasons this might be happening, check the i18n FAQ for more information: https://guide.cloudflare-ui.com/docs/i18n#i18n-faq`); | ||
throw new Error("Translation error. The translate function was called on a key that does not exist or is in a catalog that has not yet been loaded. Key: ".concat(key, ". Locale: ").concat(locale, ". There are several reasons this might be happening, check the i18n FAQ for more information: https://guide.cloudflare-ui.com/docs/i18n#i18n-faq")); | ||
}; | ||
this.locale(options && options.locale || SupportedLocales.en_US); | ||
this.locale(options && options.locale || SupportedLocales.en_US); //clear locale and phrases since future instances of Polyglot | ||
//clear locale and phrases since future instances of Polyglot | ||
//created should be based on params passed in to functions and not | ||
//initial options | ||
if (options && options.phrases) { | ||
options.phrases = undefined; | ||
} | ||
if (options && options.locale) { | ||
@@ -174,3 +149,2 @@ options.locale = undefined; | ||
} | ||
createInstance(locale) { | ||
@@ -180,3 +154,2 @@ if (this.options.pseudoLoc && this.options.phrases) { | ||
} | ||
this.map[locale] = new Polyglot(Object.assign(this.options, { | ||
@@ -186,5 +159,3 @@ locale | ||
} | ||
} | ||
export default Translator; |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -9,37 +7,27 @@ value: true | ||
exports.default = exports.TranslatorKeyNotFoundError = exports.TranslatorError = void 0; | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); } | ||
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } | ||
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
var TranslatorError = /*#__PURE__*/function (_Error) { | ||
_inherits(TranslatorError, _Error); | ||
var _super = _createSuper(TranslatorError); | ||
function TranslatorError(translationKey, message) { | ||
var _this; | ||
_classCallCheck(this, TranslatorError); | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(TranslatorError).call(this, message)); | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "translationKey", void 0); | ||
_this = _super.call(this, message); | ||
_defineProperty(_assertThisInitialized(_this), "translationKey", void 0); | ||
_this.translationKey = translationKey; | ||
@@ -49,26 +37,19 @@ _this.name = 'TranslatorError'; | ||
} | ||
return TranslatorError; | ||
}(_wrapNativeSuper(Error)); | ||
return _createClass(TranslatorError); | ||
}( /*#__PURE__*/_wrapNativeSuper(Error)); | ||
exports.TranslatorError = TranslatorError; | ||
var TranslatorKeyNotFoundError = /*#__PURE__*/function (_TranslatorError) { | ||
_inherits(TranslatorKeyNotFoundError, _TranslatorError); | ||
var _super2 = _createSuper(TranslatorKeyNotFoundError); | ||
function TranslatorKeyNotFoundError(key) { | ||
var _this2; | ||
_classCallCheck(this, TranslatorKeyNotFoundError); | ||
_this2 = _possibleConstructorReturn(this, _getPrototypeOf(TranslatorKeyNotFoundError).call(this, key, "Translation key not found: ".concat(key))); | ||
_this2 = _super2.call(this, key, "Translation key not found: ".concat(key)); | ||
_this2.name = 'TranslatorKeyNotFoundError'; | ||
return _this2; | ||
} | ||
return TranslatorKeyNotFoundError; | ||
return _createClass(TranslatorKeyNotFoundError); | ||
}(TranslatorError); | ||
exports.TranslatorKeyNotFoundError = TranslatorKeyNotFoundError; | ||
var _default = TranslatorError; | ||
exports.default = _default; |
@@ -22,12 +22,9 @@ "use strict"; | ||
}); | ||
var _Translator = _interopRequireDefault(require("./Translator")); | ||
var _makeLoadPhrases = _interopRequireDefault(require("./makeLoadPhrases")); | ||
var _intlTypes = require("@cloudflare/intl-types"); | ||
Object.keys(_intlTypes).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
if (key in exports && exports[key] === _intlTypes[key]) return; | ||
Object.defineProperty(exports, key, { | ||
@@ -40,8 +37,7 @@ enumerable: true, | ||
}); | ||
var _prepare = require("./prepare"); | ||
Object.keys(_prepare).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
if (key in exports && exports[key] === _prepare[key]) return; | ||
Object.defineProperty(exports, key, { | ||
@@ -54,8 +50,7 @@ enumerable: true, | ||
}); | ||
var _Interpolation = require("./Interpolation"); | ||
Object.keys(_Interpolation).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
if (key in exports && exports[key] === _Interpolation[key]) return; | ||
Object.defineProperty(exports, key, { | ||
@@ -68,8 +63,7 @@ enumerable: true, | ||
}); | ||
var _errors = require("./errors"); | ||
Object.keys(_errors).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
if (key in exports && exports[key] === _errors[key]) return; | ||
Object.defineProperty(exports, key, { | ||
@@ -82,3 +76,2 @@ enumerable: true, | ||
}); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.trans = trans; | ||
var _intlTypes = require("@cloudflare/intl-types"); | ||
function trans(strings) { | ||
@@ -15,11 +13,8 @@ for (var _len = arguments.length, keys = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
} | ||
var string = strings.reduce(function (accum, str, i) { | ||
var result = accum + str; | ||
var paramName = keys[i]; | ||
if (typeof paramName === 'string') { | ||
result += "%{".concat(paramName, "}"); | ||
} | ||
return result; | ||
@@ -26,0 +21,0 @@ }, ''); |
"use strict"; | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -7,99 +8,75 @@ value: true | ||
exports.default = void 0; | ||
var _index = require("./index"); | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } | ||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } | ||
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
function _readOnlyError(name) { throw new TypeError("\"" + name + "\" is read-only"); } | ||
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; } | ||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } | ||
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } | ||
var loadLocale = /*#__PURE__*/function () { | ||
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(locales, locale) { | ||
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(locales, locale) { | ||
var module; | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
_context.next = 2; | ||
return locales[locale](); | ||
case 2: | ||
module = _context.sent; | ||
if (!module.translations) { | ||
_context.next = 5; | ||
break; | ||
} | ||
return _context.abrupt("return", module.translations); | ||
case 5: | ||
return _context.abrupt("return", module.default ? module.default : module); | ||
case 6: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
return _regeneratorRuntime().wrap(function _callee$(_context) { | ||
while (1) switch (_context.prev = _context.next) { | ||
case 0: | ||
_context.next = 2; | ||
return locales[locale](); | ||
case 2: | ||
module = _context.sent; | ||
if (!module.translations) { | ||
_context.next = 5; | ||
break; | ||
} | ||
return _context.abrupt("return", module.translations); | ||
case 5: | ||
return _context.abrupt("return", module.default ? module.default : module); | ||
case 6: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
}, _callee, this); | ||
}, _callee); | ||
})); | ||
return function loadLocale(_x, _x2) { | ||
return _ref.apply(this, arguments); | ||
}; | ||
}(); //returns a function which returns a Promise resolving in phrases for a particular locale. | ||
}(); | ||
//returns a function which returns a Promise resolving in phrases for a particular locale. | ||
//loads english catalog by default and overwrites it with catalog in target language. | ||
//so that for any phrases for which target language catalog is missing a value, the english one is used. | ||
var makeLoadPhrases = function loadPhrases(locales) { | ||
var loadPhrases = /*#__PURE__*/function () { | ||
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(locale) { | ||
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(locale) { | ||
var _yield$Promise$all, _yield$Promise$all2, enPhrases, otherPhrases; | ||
return regeneratorRuntime.wrap(function _callee2$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
if (!(locale === _index.SupportedLocales.en_US)) { | ||
_context2.next = 2; | ||
break; | ||
} | ||
return _context2.abrupt("return", loadLocale(locales, locale)); | ||
case 2: | ||
_context2.next = 4; | ||
return Promise.all([loadLocale(locales, _index.SupportedLocales.en_US), loadLocale(locales, locale)]); | ||
case 4: | ||
_yield$Promise$all = _context2.sent; | ||
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2); | ||
enPhrases = _yield$Promise$all2[0]; | ||
otherPhrases = _yield$Promise$all2[1]; | ||
return _context2.abrupt("return", _objectSpread({}, enPhrases, otherPhrases)); | ||
case 9: | ||
case "end": | ||
return _context2.stop(); | ||
} | ||
return _regeneratorRuntime().wrap(function _callee2$(_context2) { | ||
while (1) switch (_context2.prev = _context2.next) { | ||
case 0: | ||
if (!(locale === _index.SupportedLocales.en_US)) { | ||
_context2.next = 2; | ||
break; | ||
} | ||
return _context2.abrupt("return", loadLocale(locales, locale)); | ||
case 2: | ||
_context2.next = 4; | ||
return Promise.all([loadLocale(locales, _index.SupportedLocales.en_US), loadLocale(locales, locale)]); | ||
case 4: | ||
_yield$Promise$all = _context2.sent; | ||
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2); | ||
enPhrases = _yield$Promise$all2[0]; | ||
otherPhrases = _yield$Promise$all2[1]; | ||
return _context2.abrupt("return", _objectSpread({}, enPhrases, otherPhrases)); | ||
case 9: | ||
case "end": | ||
return _context2.stop(); | ||
} | ||
}, _callee2, this); | ||
}, _callee2); | ||
})); | ||
return function loadPhrases(_x3) { | ||
@@ -109,7 +86,5 @@ return _ref2.apply(this, arguments); | ||
}(); | ||
return loadPhrases; | ||
}; | ||
var _default = makeLoadPhrases; | ||
exports.default = _default; |
@@ -7,11 +7,6 @@ "use strict"; | ||
exports.prepareTranslations = prepareTranslations; | ||
var _set = _interopRequireDefault(require("lodash/set")); | ||
var _intlTypes = require("@cloudflare/intl-types"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
/** | ||
@@ -50,2 +45,3 @@ * Prepares a catalog for use with our intl libraries and exports | ||
} | ||
/** | ||
@@ -69,12 +65,8 @@ * Takes a nested catalog of the form: | ||
*/ | ||
function flattenCatalog(namespace, obj) { | ||
var result = {}; | ||
var keys = [namespace]; | ||
function iterate(obj) { | ||
Object.keys(obj).forEach(function (key) { | ||
keys.push(key); | ||
if (typeof obj[key] === 'string' || obj[key] instanceof _intlTypes.Interpolation) { | ||
@@ -85,9 +77,7 @@ result[keys.join('.')] = obj[key].toString(); | ||
} | ||
keys.pop(); | ||
}); | ||
} | ||
iterate(obj); | ||
return result; | ||
} |
@@ -6,8 +6,8 @@ "use strict"; | ||
}); | ||
exports.default = exports.pseudoloc = exports.CHARACTER_TABLE = exports.DEFAULT_OPTIONS = void 0; | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
exports.pseudoloc = exports.default = exports.DEFAULT_OPTIONS = exports.CHARACTER_TABLE = void 0; | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } | ||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
/* This module was converted to TypeScript from | ||
@@ -18,2 +18,3 @@ * https://github.com/bunkat/pseudoloc/blob/306d43f66dd8630b066b5b38fe291fd251a01417/pseudoloc.js | ||
*/ | ||
var DEFAULT_OPTIONS = { | ||
@@ -87,13 +88,10 @@ prepend: '[!!', | ||
var lenLeft = Math.floor(str.length * percent / 2), | ||
lenRight = lenLeft, | ||
pStr = str; | ||
lenRight = lenLeft, | ||
pStr = str; | ||
while (lenLeft-- > 0) { | ||
pStr = ' ' + pStr; | ||
} | ||
while (lenRight-- > 0) { | ||
pStr = pStr + ' '; | ||
} | ||
return pStr; | ||
@@ -103,21 +101,18 @@ }, | ||
var opts = this.option, | ||
startdelim = opts.startDelimiter || opts.delimiter, | ||
enddelim = opts.endDelimiter || opts.delimiter, | ||
re = new RegExp(startdelim + '\\s*[\\w\\.\\s*]+\\s*' + enddelim, 'g'), | ||
m, | ||
tokens = [], | ||
i = 0, | ||
tokenIdx = 0, | ||
result = '', | ||
c, | ||
pc; | ||
startdelim = opts.startDelimiter || opts.delimiter, | ||
enddelim = opts.endDelimiter || opts.delimiter, | ||
re = new RegExp(startdelim + '\\s*[\\w\\.\\s*]+\\s*' + enddelim, 'g'), | ||
m, | ||
tokens = [], | ||
i = 0, | ||
tokenIdx = 0, | ||
result = '', | ||
c, | ||
pc; | ||
while (m = re.exec(_str)) { | ||
tokens.push(m); | ||
} | ||
var token = tokens[tokenIdx++] || { | ||
index: -1 | ||
}; | ||
while (i < _str.length) { | ||
@@ -132,6 +127,4 @@ if (token.index === i) { | ||
} | ||
c = opts.override !== undefined ? opts.override : _str[i]; | ||
pc = CHARACTER_TABLE[c]; | ||
if (pc) { | ||
@@ -141,7 +134,5 @@ var diacriticalIndex = _str.length % pc.length; | ||
} | ||
result += c; | ||
i++; | ||
} | ||
return opts.prepend + this.pad(result, opts.extend) + opts.append; | ||
@@ -148,0 +139,0 @@ } |
@@ -7,63 +7,40 @@ "use strict"; | ||
exports.default = void 0; | ||
var _nodePolyglot = _interopRequireDefault(require("node-polyglot")); | ||
var _intlTypes = require("@cloudflare/intl-types"); | ||
var _utilMarkdown = _interopRequireDefault(require("@cloudflare/util-markdown")); | ||
var _mapValues = _interopRequireDefault(require("lodash/mapValues")); | ||
var _pseudoloc = _interopRequireDefault(require("./pseudoloc")); | ||
var _errors = require("./errors"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } | ||
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
_pseudoloc.default.option.delimiter = '%'; | ||
_pseudoloc.default.option.startDelimiter = '{'; | ||
_pseudoloc.default.option.endDelimiter = '}'; | ||
var Translator = /*#__PURE__*/function () { | ||
function Translator(options) { | ||
var _this = this; | ||
_classCallCheck(this, Translator); | ||
_defineProperty(this, "map", void 0); | ||
_defineProperty(this, "currentLocale", _intlTypes.SupportedLocales.en_US); | ||
_defineProperty(this, "options", void 0); | ||
_defineProperty(this, "psudoLocalizePhrases", function (phrases) { | ||
return Object.entries(phrases).reduce(function (acc, _ref) { | ||
var _ref2 = _slicedToArray(_ref, 2), | ||
key = _ref2[0], | ||
value = _ref2[1]; | ||
key = _ref2[0], | ||
value = _ref2[1]; | ||
return Object.assign(acc, _defineProperty({}, key, _pseudoloc.default.str(value))); | ||
}, {}); | ||
}); | ||
_defineProperty(this, "getInstance", function (locale) { | ||
@@ -76,6 +53,4 @@ if (locale) { | ||
}); | ||
_defineProperty(this, "getInstanceMatchingPhrase", function (phrase) { | ||
var p = _this.getInstance(); | ||
if (p.has(phrase)) { | ||
@@ -87,16 +62,11 @@ return p; | ||
}); | ||
_defineProperty(this, "extend", function (phrases, locale) { | ||
var p = _this.getInstance(locale); | ||
if (_this.options.pseudoLoc) { | ||
phrases = _this.psudoLocalizePhrases(phrases); | ||
} | ||
p.extend(phrases); | ||
}); | ||
_defineProperty(this, "t", function (phrase, arg) { | ||
var p = _this.getInstanceMatchingPhrase(phrase); | ||
if (arg) { | ||
@@ -109,14 +79,10 @@ if (typeof arg === 'number') { | ||
} | ||
return p.t(phrase); | ||
}); | ||
_defineProperty(this, "tm", function (phrase, arg) { | ||
return (0, _utilMarkdown.default)(_this.t(phrase, arg)); | ||
}); | ||
_defineProperty(this, "clear", function () { | ||
_this.getInstance().clear(); | ||
}); | ||
_defineProperty(this, "replace", function (phrases) { | ||
@@ -126,10 +92,7 @@ if (_this.options.pseudoLoc) { | ||
} | ||
_this.getInstance().replace(phrases); | ||
}); | ||
_defineProperty(this, "locale", function (locale) { | ||
if (locale) { | ||
_this.currentLocale = locale; | ||
if (!_this.map[locale]) { | ||
@@ -139,10 +102,7 @@ _this.createInstance(locale); | ||
} | ||
return _this.currentLocale; | ||
}); | ||
_defineProperty(this, "has", function (phrase) { | ||
return _this.getInstanceMatchingPhrase(phrase).has(phrase); | ||
}); | ||
_defineProperty(this, "translateSeconds", function (seconds) { | ||
@@ -156,3 +116,2 @@ // Prevent 0 seconds returning "0 days" | ||
} | ||
if (seconds % 3600 === 0) { | ||
@@ -163,3 +122,2 @@ return _this.t('time.num_hours', { | ||
} | ||
if (seconds % 60 === 0) { | ||
@@ -171,3 +129,2 @@ return _this.t('time.num_minutes', { | ||
} | ||
return _this.t('time.num_seconds', { | ||
@@ -177,35 +134,31 @@ smart_count: seconds | ||
}); | ||
_defineProperty(this, "translateObject", function (phrases) { | ||
return (0, _mapValues.default)(phrases, _this.t); | ||
}); | ||
this.map = {}; | ||
this.options = options || {}; | ||
this.options.allowMissing = true; | ||
this.options.onMissingKey = function (key, options, locale) { | ||
if (process.env.NODE_ENV === 'staging' || process.env.NODE_ENV === 'production') { | ||
console.error(new _errors.TranslatorKeyNotFoundError(key)); // If a fallback is present, display that | ||
console.error(new _errors.TranslatorKeyNotFoundError(key)); | ||
if (options._) return options._; // Otherwise display the raw key | ||
// If a fallback is present, display that | ||
if (options._) return options._; | ||
// Otherwise display the raw key | ||
return key; | ||
} | ||
if (process.env.NODE_ENV === 'test') { | ||
return key; | ||
} | ||
throw new Error("Translation error. The translate function was called on a key that does not exist or is in a catalog that has not yet been loaded. Key: ".concat(key, ". Locale: ").concat(locale, ". There are several reasons this might be happening, check the i18n FAQ for more information: https://guide.cloudflare-ui.com/docs/i18n#i18n-faq")); | ||
}; | ||
this.locale(options && options.locale || _intlTypes.SupportedLocales.en_US); | ||
this.locale(options && options.locale || _intlTypes.SupportedLocales.en_US); //clear locale and phrases since future instances of Polyglot | ||
//clear locale and phrases since future instances of Polyglot | ||
//created should be based on params passed in to functions and not | ||
//initial options | ||
if (options && options.phrases) { | ||
options.phrases = undefined; | ||
} | ||
if (options && options.locale) { | ||
@@ -215,3 +168,2 @@ options.locale = undefined; | ||
} | ||
_createClass(Translator, [{ | ||
@@ -223,3 +175,2 @@ key: "createInstance", | ||
} | ||
this.map[locale] = new _nodePolyglot.default(Object.assign(this.options, { | ||
@@ -230,7 +181,5 @@ locale: locale | ||
}]); | ||
return Translator; | ||
}(); | ||
var _default = Translator; | ||
exports.default = _default; |
{ | ||
"name": "@cloudflare/intl-core", | ||
"description": "", | ||
"version": "1.14.1", | ||
"version": "1.14.2", | ||
"types": "./dist/index.d.ts", | ||
@@ -12,2 +12,3 @@ "main": "lib/index.js", | ||
"publishConfig": { | ||
"main": "lib/index.js", | ||
"registry": "https://registry.npmjs.org/", | ||
@@ -17,3 +18,3 @@ "access": "public" | ||
"dependencies": { | ||
"@cloudflare/intl-types": "^1.5.1", | ||
"@cloudflare/intl-types": "^1.5.2", | ||
"@cloudflare/util-markdown": "^1.2.15", | ||
@@ -35,7 +36,4 @@ "@types/lodash": "^4.14.107", | ||
"lint": "yarn global:lint", | ||
"test": "yarn global:test", | ||
"test-coverage": "stratus test --coverage", | ||
"test-watch": "stratus test --watch" | ||
}, | ||
"gitHead": "21f24c9f4c82163dd2dc4cbc6fb48992e9d89df4" | ||
} | ||
"test": "yarn global:test" | ||
} | ||
} |
86115
1324