Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-intl

Package Overview
Dependencies
Maintainers
8
Versions
341
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-intl - npm Package Compare versions

Comparing version 6.5.1 to 6.5.2

65

lib/index.js

@@ -1,25 +0,50 @@

import { createFormattedComponent, createFormattedDateTimePartsComponent, } from './src/components/createFormattedComponent';
import injectIntl, { Provider as RawIntlProvider, Context as IntlContext, } from './src/components/injectIntl';
import useIntl from './src/components/useIntl';
import IntlProvider, { createIntl } from './src/components/provider';
import FormattedRelativeTime from './src/components/relative';
import FormattedPlural from './src/components/plural';
import FormattedMessage from './src/components/message';
import FormattedDateTimeRange from './src/components/dateTimeRange';
export { FormattedDateTimeRange, FormattedMessage, FormattedPlural, FormattedRelativeTime, IntlContext, IntlProvider, RawIntlProvider, createIntl, injectIntl, useIntl, };
export { createIntlCache, UnsupportedFormatterError, InvalidConfigError, MissingDataError, MessageFormatError, MissingTranslationError, IntlErrorCode as ReactIntlErrorCode, IntlError as ReactIntlError, } from '@formatjs/intl';
export function defineMessages(msgs) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FormattedListParts = exports.FormattedNumberParts = exports.FormattedTimeParts = exports.FormattedDateParts = exports.FormattedDisplayName = exports.FormattedList = exports.FormattedNumber = exports.FormattedTime = exports.FormattedDate = exports.defineMessage = exports.defineMessages = exports.ReactIntlError = exports.ReactIntlErrorCode = exports.MissingTranslationError = exports.MessageFormatError = exports.MissingDataError = exports.InvalidConfigError = exports.UnsupportedFormatterError = exports.createIntlCache = exports.useIntl = exports.injectIntl = exports.createIntl = exports.RawIntlProvider = exports.IntlProvider = exports.IntlContext = exports.FormattedRelativeTime = exports.FormattedPlural = exports.FormattedMessage = exports.FormattedDateTimeRange = void 0;
var tslib_1 = require("tslib");
var createFormattedComponent_1 = require("./src/components/createFormattedComponent");
var injectIntl_1 = tslib_1.__importStar(require("./src/components/injectIntl"));
exports.injectIntl = injectIntl_1.default;
Object.defineProperty(exports, "RawIntlProvider", { enumerable: true, get: function () { return injectIntl_1.Provider; } });
Object.defineProperty(exports, "IntlContext", { enumerable: true, get: function () { return injectIntl_1.Context; } });
var useIntl_1 = tslib_1.__importDefault(require("./src/components/useIntl"));
exports.useIntl = useIntl_1.default;
var provider_1 = tslib_1.__importStar(require("./src/components/provider"));
exports.IntlProvider = provider_1.default;
Object.defineProperty(exports, "createIntl", { enumerable: true, get: function () { return provider_1.createIntl; } });
var relative_1 = tslib_1.__importDefault(require("./src/components/relative"));
exports.FormattedRelativeTime = relative_1.default;
var plural_1 = tslib_1.__importDefault(require("./src/components/plural"));
exports.FormattedPlural = plural_1.default;
var message_1 = tslib_1.__importDefault(require("./src/components/message"));
exports.FormattedMessage = message_1.default;
var dateTimeRange_1 = tslib_1.__importDefault(require("./src/components/dateTimeRange"));
exports.FormattedDateTimeRange = dateTimeRange_1.default;
var intl_1 = require("@formatjs/intl");
Object.defineProperty(exports, "createIntlCache", { enumerable: true, get: function () { return intl_1.createIntlCache; } });
Object.defineProperty(exports, "UnsupportedFormatterError", { enumerable: true, get: function () { return intl_1.UnsupportedFormatterError; } });
Object.defineProperty(exports, "InvalidConfigError", { enumerable: true, get: function () { return intl_1.InvalidConfigError; } });
Object.defineProperty(exports, "MissingDataError", { enumerable: true, get: function () { return intl_1.MissingDataError; } });
Object.defineProperty(exports, "MessageFormatError", { enumerable: true, get: function () { return intl_1.MessageFormatError; } });
Object.defineProperty(exports, "MissingTranslationError", { enumerable: true, get: function () { return intl_1.MissingTranslationError; } });
Object.defineProperty(exports, "ReactIntlErrorCode", { enumerable: true, get: function () { return intl_1.IntlErrorCode; } });
Object.defineProperty(exports, "ReactIntlError", { enumerable: true, get: function () { return intl_1.IntlError; } });
function defineMessages(msgs) {
return msgs;
}
export function defineMessage(msg) {
exports.defineMessages = defineMessages;
function defineMessage(msg) {
return msg;
}
exports.defineMessage = defineMessage;
// IMPORTANT: Explicit here to prevent api-extractor from outputing `import('./src/types').CustomFormatConfig`
export var FormattedDate = createFormattedComponent('formatDate');
export var FormattedTime = createFormattedComponent('formatTime');
export var FormattedNumber = createFormattedComponent('formatNumber');
export var FormattedList = createFormattedComponent('formatList');
export var FormattedDisplayName = createFormattedComponent('formatDisplayName');
export var FormattedDateParts = createFormattedDateTimePartsComponent('formatDate');
export var FormattedTimeParts = createFormattedDateTimePartsComponent('formatTime');
export { FormattedNumberParts, FormattedListParts, } from './src/components/createFormattedComponent';
exports.FormattedDate = (0, createFormattedComponent_1.createFormattedComponent)('formatDate');
exports.FormattedTime = (0, createFormattedComponent_1.createFormattedComponent)('formatTime');
exports.FormattedNumber = (0, createFormattedComponent_1.createFormattedComponent)('formatNumber');
exports.FormattedList = (0, createFormattedComponent_1.createFormattedComponent)('formatList');
exports.FormattedDisplayName = (0, createFormattedComponent_1.createFormattedComponent)('formatDisplayName');
exports.FormattedDateParts = (0, createFormattedComponent_1.createFormattedDateTimePartsComponent)('formatDate');
exports.FormattedTimeParts = (0, createFormattedComponent_1.createFormattedDateTimePartsComponent)('formatTime');
var createFormattedComponent_2 = require("./src/components/createFormattedComponent");
Object.defineProperty(exports, "FormattedNumberParts", { enumerable: true, get: function () { return createFormattedComponent_2.FormattedNumberParts; } });
Object.defineProperty(exports, "FormattedListParts", { enumerable: true, get: function () { return createFormattedComponent_2.FormattedListParts; } });

@@ -1,4 +0,7 @@

import { __rest } from "tslib";
import * as React from 'react';
import useIntl from './useIntl';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createFormattedComponent = exports.createFormattedDateTimePartsComponent = exports.FormattedListParts = exports.FormattedNumberParts = void 0;
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var useIntl_1 = tslib_1.__importDefault(require("./useIntl"));
var DisplayName;

@@ -21,18 +24,20 @@ (function (DisplayName) {

})(DisplayNameParts || (DisplayNameParts = {}));
export var FormattedNumberParts = function (props) {
var intl = useIntl();
var value = props.value, children = props.children, formatProps = __rest(props, ["value", "children"]);
var FormattedNumberParts = function (props) {
var intl = (0, useIntl_1.default)();
var value = props.value, children = props.children, formatProps = tslib_1.__rest(props, ["value", "children"]);
return children(intl.formatNumberToParts(value, formatProps));
};
FormattedNumberParts.displayName = 'FormattedNumberParts';
export var FormattedListParts = function (props) {
var intl = useIntl();
var value = props.value, children = props.children, formatProps = __rest(props, ["value", "children"]);
exports.FormattedNumberParts = FormattedNumberParts;
exports.FormattedNumberParts.displayName = 'FormattedNumberParts';
var FormattedListParts = function (props) {
var intl = (0, useIntl_1.default)();
var value = props.value, children = props.children, formatProps = tslib_1.__rest(props, ["value", "children"]);
return children(intl.formatListToParts(value, formatProps));
};
FormattedNumberParts.displayName = 'FormattedNumberParts';
export function createFormattedDateTimePartsComponent(name) {
exports.FormattedListParts = FormattedListParts;
exports.FormattedNumberParts.displayName = 'FormattedNumberParts';
function createFormattedDateTimePartsComponent(name) {
var ComponentParts = function (props) {
var intl = useIntl();
var value = props.value, children = props.children, formatProps = __rest(props, ["value", "children"]);
var intl = (0, useIntl_1.default)();
var value = props.value, children = props.children, formatProps = tslib_1.__rest(props, ["value", "children"]);
var date = typeof value === 'string' ? new Date(value || 0) : value;

@@ -47,6 +52,7 @@ var formattedParts = name === 'formatDate'

}
export function createFormattedComponent(name) {
exports.createFormattedDateTimePartsComponent = createFormattedDateTimePartsComponent;
function createFormattedComponent(name) {
var Component = function (props) {
var intl = useIntl();
var value = props.value, children = props.children, formatProps = __rest(props
var intl = (0, useIntl_1.default)();
var value = props.value, children = props.children, formatProps = tslib_1.__rest(props
// TODO: fix TS type definition for localeMatcher upstream

@@ -65,1 +71,2 @@ , ["value", "children"]);

}
exports.createFormattedComponent = createFormattedComponent;

@@ -1,7 +0,9 @@

import { __rest } from "tslib";
import * as React from 'react';
import useIntl from './useIntl';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var useIntl_1 = tslib_1.__importDefault(require("./useIntl"));
var FormattedDateTimeRange = function (props) {
var intl = useIntl();
var from = props.from, to = props.to, children = props.children, formatProps = __rest(props, ["from", "to", "children"]);
var intl = (0, useIntl_1.default)();
var from = props.from, to = props.to, children = props.children, formatProps = tslib_1.__rest(props, ["from", "to", "children"]);
var formattedValue = intl.formatDateTimeRange(from, to, formatProps);

@@ -15,2 +17,2 @@ if (typeof children === 'function') {

FormattedDateTimeRange.displayName = 'FormattedDateTimeRange';
export default FormattedDateTimeRange;
exports.default = FormattedDateTimeRange;

@@ -1,5 +0,8 @@

import { __assign } from "tslib";
import * as React from 'react';
import hoistNonReactStatics from 'hoist-non-react-statics';
import { invariantIntlContext } from '../utils';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Context = exports.Provider = void 0;
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var hoist_non_react_statics_1 = tslib_1.__importDefault(require("hoist-non-react-statics"));
var utils_1 = require("../utils");
function getDisplayName(Component) {

@@ -15,5 +18,5 @@ return Component.displayName || Component.name || 'Component';

var IntlConsumer = IntlContext.Consumer, IntlProvider = IntlContext.Provider;
export var Provider = IntlProvider;
export var Context = IntlContext;
export default function injectIntl(WrappedComponent, options) {
exports.Provider = IntlProvider;
exports.Context = IntlContext;
function injectIntl(WrappedComponent, options) {
var _a = options || {}, _b = _a.intlPropName, intlPropName = _b === void 0 ? 'intl' : _b, _c = _a.forwardRef, forwardRef = _c === void 0 ? false : _c, _d = _a.enforceContext, enforceContext = _d === void 0 ? true : _d;

@@ -23,6 +26,6 @@ var WithIntl = function (props) { return (React.createElement(IntlConsumer, null, function (intl) {

if (enforceContext) {
invariantIntlContext(intl);
(0, utils_1.invariantIntlContext)(intl);
}
var intlProp = (_a = {}, _a[intlPropName] = intl, _a);
return (React.createElement(WrappedComponent, __assign({}, props, intlProp, { ref: forwardRef ? props.forwardedRef : null })));
return (React.createElement(WrappedComponent, tslib_1.__assign({}, props, intlProp, { ref: forwardRef ? props.forwardedRef : null })));
})); };

@@ -32,5 +35,6 @@ WithIntl.displayName = "injectIntl(".concat(getDisplayName(WrappedComponent), ")");

if (forwardRef) {
return hoistNonReactStatics(React.forwardRef(function (props, ref) { return (React.createElement(WithIntl, __assign({}, props, { forwardedRef: ref }))); }), WrappedComponent);
return (0, hoist_non_react_statics_1.default)(React.forwardRef(function (props, ref) { return (React.createElement(WithIntl, tslib_1.__assign({}, props, { forwardedRef: ref }))); }), WrappedComponent);
}
return hoistNonReactStatics(WithIntl, WrappedComponent);
return (0, hoist_non_react_statics_1.default)(WithIntl, WrappedComponent);
}
exports.default = injectIntl;

@@ -0,1 +1,2 @@

"use strict";
/*

@@ -6,14 +7,15 @@ * Copyright 2015, Yahoo Inc.

*/
import { __rest } from "tslib";
import * as React from 'react';
import useIntl from './useIntl';
import { shallowEqual } from '../utils';
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var useIntl_1 = tslib_1.__importDefault(require("./useIntl"));
var utils_1 = require("../utils");
function areEqual(prevProps, nextProps) {
var values = prevProps.values, otherProps = __rest(prevProps, ["values"]);
var nextValues = nextProps.values, nextOtherProps = __rest(nextProps, ["values"]);
return (shallowEqual(nextValues, values) &&
shallowEqual(otherProps, nextOtherProps));
var values = prevProps.values, otherProps = tslib_1.__rest(prevProps, ["values"]);
var nextValues = nextProps.values, nextOtherProps = tslib_1.__rest(nextProps, ["values"]);
return ((0, utils_1.shallowEqual)(nextValues, values) &&
(0, utils_1.shallowEqual)(otherProps, nextOtherProps));
}
function FormattedMessage(props) {
var intl = useIntl();
var intl = (0, useIntl_1.default)();
var formatMessage = intl.formatMessage, _a = intl.textComponent, Text = _a === void 0 ? React.Fragment : _a;

@@ -36,2 +38,2 @@ var id = props.id, description = props.description, defaultMessage = props.defaultMessage, values = props.values, children = props.children, _b = props.tagName, Component = _b === void 0 ? Text : _b, ignoreTag = props.ignoreTag;

MemoizedFormattedMessage.displayName = 'MemoizedFormattedMessage';
export default MemoizedFormattedMessage;
exports.default = MemoizedFormattedMessage;

@@ -0,1 +1,2 @@

"use strict";
/*

@@ -6,6 +7,8 @@ * Copyright 2015, Yahoo Inc.

*/
import * as React from 'react';
import useIntl from './useIntl';
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var useIntl_1 = tslib_1.__importDefault(require("./useIntl"));
var FormattedPlural = function (props) {
var _a = useIntl(), formatPlural = _a.formatPlural, Text = _a.textComponent;
var _a = (0, useIntl_1.default)(), formatPlural = _a.formatPlural, Text = _a.textComponent;
var value = props.value, other = props.other, children = props.children;

@@ -27,2 +30,2 @@ var pluralCategory = formatPlural(value, props);

FormattedPlural.displayName = 'FormattedPlural';
export default FormattedPlural;
exports.default = FormattedPlural;

@@ -0,4 +1,4 @@

import { CreateIntlFn, IntlCache } from '@formatjs/intl';
import * as React from 'react';
import type { IntlConfig, IntlShape, ResolvedIntlConfig } from '../types';
import { IntlCache, CreateIntlFn } from '@formatjs/intl';
interface State {

@@ -28,3 +28,3 @@ /**

static displayName: string;
static defaultProps: Pick<ResolvedIntlConfig, "onError" | "timeZone" | "fallbackOnEmptyString" | "formats" | "messages" | "defaultLocale" | "defaultFormats" | "textComponent">;
static defaultProps: Pick<ResolvedIntlConfig, "timeZone" | "onError" | "fallbackOnEmptyString" | "formats" | "messages" | "defaultLocale" | "defaultFormats" | "textComponent">;
private cache;

@@ -31,0 +31,0 @@ state: State;

@@ -0,1 +1,2 @@

"use strict";
/*

@@ -6,8 +7,10 @@ * Copyright 2015, Yahoo Inc.

*/
import { __assign, __extends, __rest, __spreadArray } from "tslib";
import * as React from 'react';
import { Provider } from './injectIntl';
import { DEFAULT_INTL_CONFIG, invariantIntlContext, assignUniqueKeysToParts, shallowEqual, } from '../utils';
import { formatMessage as coreFormatMessage, createIntl as coreCreateIntl, createIntlCache, } from '@formatjs/intl';
import { isFormatXMLElementFn, } from 'intl-messageformat';
Object.defineProperty(exports, "__esModule", { value: true });
exports.createIntl = void 0;
var tslib_1 = require("tslib");
var intl_1 = require("@formatjs/intl");
var React = tslib_1.__importStar(require("react"));
var utils_1 = require("../utils");
var injectIntl_1 = require("./injectIntl");
var intl_messageformat_1 = require("intl-messageformat");
function processIntlConfig(config) {

@@ -35,4 +38,4 @@ return {

var v = values[k];
acc[k] = isFormatXMLElementFn(v)
? assignUniqueKeysToParts(v)
acc[k] = (0, intl_messageformat_1.isFormatXMLElementFn)(v)
? (0, utils_1.assignUniqueKeysToParts)(v)
: v;

@@ -48,3 +51,3 @@ return acc;

var values = assignUniqueKeysToFormatXMLElementFnArgument(rawValues);
var chunks = coreFormatMessage.apply(void 0, __spreadArray([config,
var chunks = intl_1.formatMessage.apply(void 0, tslib_1.__spreadArray([config,
formatters,

@@ -63,6 +66,6 @@ descriptor,

*/
export var createIntl = function (_a, cache) {
var rawDefaultRichTextElements = _a.defaultRichTextElements, config = __rest(_a, ["defaultRichTextElements"]);
var createIntl = function (_a, cache) {
var rawDefaultRichTextElements = _a.defaultRichTextElements, config = tslib_1.__rest(_a, ["defaultRichTextElements"]);
var defaultRichTextElements = assignUniqueKeysToFormatXMLElementFnArgument(rawDefaultRichTextElements);
var coreIntl = coreCreateIntl(__assign(__assign(__assign({}, DEFAULT_INTL_CONFIG), config), { defaultRichTextElements: defaultRichTextElements }), cache);
var coreIntl = (0, intl_1.createIntl)(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, utils_1.DEFAULT_INTL_CONFIG), config), { defaultRichTextElements: defaultRichTextElements }), cache);
var resolvedConfig = {

@@ -79,16 +82,17 @@ locale: coreIntl.locale,

};
return __assign(__assign({}, coreIntl), {
return tslib_1.__assign(tslib_1.__assign({}, coreIntl), { formatMessage: formatMessage.bind(null, resolvedConfig,
// @ts-expect-error fix this
formatMessage: formatMessage.bind(null, resolvedConfig, coreIntl.formatters),
coreIntl.formatters),
// @ts-expect-error fix this
$t: formatMessage.bind(null, resolvedConfig, coreIntl.formatters) });
};
exports.createIntl = createIntl;
var IntlProvider = /** @class */ (function (_super) {
__extends(IntlProvider, _super);
tslib_1.__extends(IntlProvider, _super);
function IntlProvider() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.cache = createIntlCache();
_this.cache = (0, intl_1.createIntlCache)();
_this.state = {
cache: _this.cache,
intl: createIntl(processIntlConfig(_this.props), _this.cache),
intl: (0, exports.createIntl)(processIntlConfig(_this.props), _this.cache),
prevConfig: processIntlConfig(_this.props),

@@ -101,5 +105,5 @@ };

var config = processIntlConfig(props);
if (!shallowEqual(prevConfig, config)) {
if (!(0, utils_1.shallowEqual)(prevConfig, config)) {
return {
intl: createIntl(config, cache),
intl: (0, exports.createIntl)(config, cache),
prevConfig: config,

@@ -111,9 +115,9 @@ };

IntlProvider.prototype.render = function () {
invariantIntlContext(this.state.intl);
return React.createElement(Provider, { value: this.state.intl }, this.props.children);
(0, utils_1.invariantIntlContext)(this.state.intl);
return React.createElement(injectIntl_1.Provider, { value: this.state.intl }, this.props.children);
};
IntlProvider.displayName = 'IntlProvider';
IntlProvider.defaultProps = DEFAULT_INTL_CONFIG;
IntlProvider.defaultProps = utils_1.DEFAULT_INTL_CONFIG;
return IntlProvider;
}(React.PureComponent));
export default IntlProvider;
exports.default = IntlProvider;

@@ -1,2 +0,4 @@

import { __assign, __rest } from "tslib";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/*

@@ -7,5 +9,5 @@ * Copyright 2015, Yahoo Inc.

*/
import * as React from 'react';
import { invariant, } from '@formatjs/ecma402-abstract';
import useIntl from './useIntl';
var React = tslib_1.__importStar(require("react"));
var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
var useIntl_1 = tslib_1.__importDefault(require("./useIntl"));
var MINUTE = 60;

@@ -62,4 +64,4 @@ var HOUR = 60 * 60;

var SimpleFormattedRelativeTime = function (props) {
var _a = useIntl(), formatRelativeTime = _a.formatRelativeTime, Text = _a.textComponent;
var children = props.children, value = props.value, unit = props.unit, otherProps = __rest(props, ["children", "value", "unit"]);
var _a = (0, useIntl_1.default)(), formatRelativeTime = _a.formatRelativeTime, Text = _a.textComponent;
var children = props.children, value = props.value, unit = props.unit, otherProps = tslib_1.__rest(props, ["children", "value", "unit"]);
var formattedRelativeTime = formatRelativeTime(value || 0, unit, otherProps);

@@ -75,4 +77,4 @@ if (typeof children === 'function') {

var FormattedRelativeTime = function (_a) {
var value = _a.value, unit = _a.unit, updateIntervalInSeconds = _a.updateIntervalInSeconds, otherProps = __rest(_a, ["value", "unit", "updateIntervalInSeconds"]);
invariant(!updateIntervalInSeconds ||
var value = _a.value, unit = _a.unit, updateIntervalInSeconds = _a.updateIntervalInSeconds, otherProps = tslib_1.__rest(_a, ["value", "unit", "updateIntervalInSeconds"]);
(0, ecma402_abstract_1.invariant)(!updateIntervalInSeconds ||
!!(updateIntervalInSeconds && canIncrement(unit)), 'Cannot schedule update with unit longer than hour');

@@ -125,3 +127,3 @@ var _b = React.useState(), prevUnit = _b[0], setPrevUnit = _b[1];

}
return (React.createElement(SimpleFormattedRelativeTime, __assign({ value: currentValue, unit: currentUnit }, otherProps)));
return (React.createElement(SimpleFormattedRelativeTime, tslib_1.__assign({ value: currentValue, unit: currentUnit }, otherProps)));
};

@@ -133,2 +135,2 @@ FormattedRelativeTime.displayName = 'FormattedRelativeTime';

};
export default FormattedRelativeTime;
exports.default = FormattedRelativeTime;

@@ -1,8 +0,12 @@

import * as React from 'react';
import { Context } from './injectIntl';
import { invariantIntlContext } from '../utils';
export default function useIntl() {
var intl = React.useContext(Context);
invariantIntlContext(intl);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var injectIntl_1 = require("./injectIntl");
var utils_1 = require("../utils");
function useIntl() {
var intl = React.useContext(injectIntl_1.Context);
(0, utils_1.invariantIntlContext)(intl);
return intl;
}
exports.default = useIntl;

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,10 +0,14 @@

import { __assign } from "tslib";
import * as React from 'react';
import { invariant } from '@formatjs/ecma402-abstract';
import { DEFAULT_INTL_CONFIG as CORE_DEFAULT_INTL_CONFIG } from '@formatjs/intl';
export function invariantIntlContext(intl) {
invariant(intl, '[React Intl] Could not find required `intl` object. ' +
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.shallowEqual = exports.assignUniqueKeysToParts = exports.DEFAULT_INTL_CONFIG = exports.invariantIntlContext = void 0;
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
var intl_1 = require("@formatjs/intl");
function invariantIntlContext(intl) {
(0, ecma402_abstract_1.invariant)(intl, '[React Intl] Could not find required `intl` object. ' +
'<IntlProvider> needs to exist in the component ancestry.');
}
export var DEFAULT_INTL_CONFIG = __assign(__assign({}, CORE_DEFAULT_INTL_CONFIG), { textComponent: React.Fragment });
exports.invariantIntlContext = invariantIntlContext;
exports.DEFAULT_INTL_CONFIG = tslib_1.__assign(tslib_1.__assign({}, intl_1.DEFAULT_INTL_CONFIG), { textComponent: React.Fragment });
/**

@@ -16,3 +20,3 @@ * Takes a `formatXMLElementFn`, and composes it in function, which passes

*/
export function assignUniqueKeysToParts(formatXMLElementFn) {
function assignUniqueKeysToParts(formatXMLElementFn) {
return function (parts) {

@@ -23,3 +27,4 @@ // eslint-disable-next-line prefer-rest-params

}
export function shallowEqual(objA, objB) {
exports.assignUniqueKeysToParts = assignUniqueKeysToParts;
function shallowEqual(objA, objB) {
if (objA === objB) {

@@ -46,1 +51,2 @@ return true;

}
exports.shallowEqual = shallowEqual;
{
"name": "react-intl",
"version": "6.5.1",
"version": "6.5.2",
"description": "Internationalize React apps. This library provides React components and an API to format dates, numbers, and strings, including pluralization and handling translations.",

@@ -135,12 +135,12 @@ "keywords": [

"tslib": "^2.4.0",
"@formatjs/intl-displaynames": "6.6.1",
"@formatjs/intl": "2.9.5",
"@formatjs/ecma402-abstract": "1.17.2",
"@formatjs/icu-messageformat-parser": "2.7.0",
"@formatjs/intl-listformat": "7.5.0",
"intl-messageformat": "10.5.4"
"@formatjs/ecma402-abstract": "1.17.3",
"@formatjs/icu-messageformat-parser": "2.7.1",
"@formatjs/intl": "2.9.6",
"@formatjs/intl-displaynames": "6.6.2",
"@formatjs/intl-listformat": "7.5.1",
"intl-messageformat": "10.5.5"
},
"devDependencies": {
"@formatjs/intl-numberformat": "8.8.0",
"@formatjs/intl-relativetimeformat": "11.2.7"
"@formatjs/intl-numberformat": "8.8.1",
"@formatjs/intl-relativetimeformat": "11.2.8"
},

@@ -147,0 +147,0 @@ "peerDependencies": {

@@ -0,4 +1,4 @@

import { CreateIntlFn, IntlCache } from '@formatjs/intl';
import * as React from 'react';
import type { IntlConfig, IntlShape, ResolvedIntlConfig } from '../types';
import { IntlCache, CreateIntlFn } from '@formatjs/intl';
interface State {

@@ -28,3 +28,3 @@ /**

static displayName: string;
static defaultProps: Pick<ResolvedIntlConfig, "onError" | "timeZone" | "fallbackOnEmptyString" | "formats" | "messages" | "defaultLocale" | "defaultFormats" | "textComponent">;
static defaultProps: Pick<ResolvedIntlConfig, "timeZone" | "onError" | "fallbackOnEmptyString" | "formats" | "messages" | "defaultLocale" | "defaultFormats" | "textComponent">;
private cache;

@@ -31,0 +31,0 @@ state: State;

@@ -10,6 +10,6 @@ "use strict";

var tslib_1 = require("tslib");
var intl_1 = require("@formatjs/intl");
var React = tslib_1.__importStar(require("react"));
var utils_1 = require("../utils");
var injectIntl_1 = require("./injectIntl");
var utils_1 = require("../utils");
var intl_1 = require("@formatjs/intl");
var intl_messageformat_1 = require("intl-messageformat");

@@ -79,5 +79,5 @@ function processIntlConfig(config) {

};
return tslib_1.__assign(tslib_1.__assign({}, coreIntl), {
return tslib_1.__assign(tslib_1.__assign({}, coreIntl), { formatMessage: formatMessage.bind(null, resolvedConfig,
// @ts-expect-error fix this
formatMessage: formatMessage.bind(null, resolvedConfig, coreIntl.formatters),
coreIntl.formatters),
// @ts-expect-error fix this

@@ -84,0 +84,0 @@ $t: formatMessage.bind(null, resolvedConfig, coreIntl.formatters) });

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc