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

use-intl

Package Overview
Dependencies
Maintainers
1
Versions
262
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-intl - npm Package Compare versions

Comparing version 4.0.0-beta-9ea117c to 4.0.0-beta-c323050

dist/esm/development/initializeConfig-fLcuxncj.js

19

dist/esm/development/core.js

@@ -1,3 +0,3 @@

import { r as resolveNamespace, e as createBaseTranslator, d as createCache, b as createIntlFormatters, f as defaultGetMessageFallback, g as defaultOnError } from './initializeConfig-DSmAVNvj.js';
export { I as IntlError, a as IntlErrorCode, c as createFormatter, i as initializeConfig } from './initializeConfig-DSmAVNvj.js';
import { r as resolveNamespace, e as createBaseTranslator, d as createCache, b as createIntlFormatters, f as defaultGetMessageFallback, g as defaultOnError } from './initializeConfig-fLcuxncj.js';
export { I as IntlError, a as IntlErrorCode, c as createFormatter, i as initializeConfig } from './initializeConfig-fLcuxncj.js';

@@ -61,20 +61,5 @@

*
* Additionally, in development, the provided locales are validated to
* ensure they follow the Unicode language identifier standard.
*
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale
*/
function hasLocale(locales, candidate) {
{
for (const locale of locales) {
try {
const constructed = new Intl.Locale(locale);
if (!constructed.language) {
throw new Error('Language is required');
}
} catch {
console.error(`Found invalid locale within provided \`locales\`: "${locale}"\nPlease ensure you're using a valid Unicode locale identifier (e.g. "en-US").`);
}
}
}
return locales.includes(candidate);

@@ -81,0 +66,0 @@ }

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

export { I as IntlError, a as IntlErrorCode, d as _createCache, b as _createIntlFormatters, c as createFormatter, i as initializeConfig } from './initializeConfig-DSmAVNvj.js';
export { I as IntlError, a as IntlErrorCode, d as _createCache, b as _createIntlFormatters, c as createFormatter, i as initializeConfig } from './initializeConfig-fLcuxncj.js';
export { createTranslator, hasLocale } from './core.js';

@@ -3,0 +3,0 @@ export { IntlProvider, useFormatter, useLocale, useMessages, useNow, useTimeZone, useTranslations } from './react.js';

import { createContext, useContext, useMemo, useState, useEffect } from 'react';
import { d as createCache, b as createIntlFormatters, i as initializeConfig, r as resolveNamespace, I as IntlError, a as IntlErrorCode, e as createBaseTranslator, c as createFormatter } from './initializeConfig-DSmAVNvj.js';
import { d as createCache, b as createIntlFormatters, i as initializeConfig, r as resolveNamespace, I as IntlError, a as IntlErrorCode, e as createBaseTranslator, c as createFormatter } from './initializeConfig-fLcuxncj.js';
import { jsx } from 'react/jsx-runtime';

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

@@ -8,12 +8,15 @@ import type { ReactNode } from 'react';

import type { MessageKeys, NamespaceKeys, NestedKeyOf, NestedValueOf } from './MessageKeys.tsx';
import type { ICUArg, MarkupTagsFunction, RichTagsFunction } from './TranslationValues.tsx';
import type { MarkupTagsFunction, RichTagsFunction, TranslationValues } from './TranslationValues.tsx';
import { type Formatters, type IntlCache } from './formatters.tsx';
import type { Prettify } from './types.tsx';
type ICUArgsWithTags<MessageString extends string, TagsFn extends RichTagsFunction | MarkupTagsFunction = never> = ICUArgs<MessageString, {
ICUArgument: string | number | boolean | Date;
ICUArgument: string;
ICUNumberArgument: number;
ICUDateArgument: Date | number;
ICUDateArgument: Date;
}> & ([TagsFn] extends [never] ? {} : ICUTags<MessageString, TagsFn>);
type OnlyOptional<T> = Partial<T> extends T ? true : false;
type TranslateArgs<Value extends string, TagsFn extends RichTagsFunction | MarkupTagsFunction = never> = string extends Value ? [values?: Record<string, ICUArg | TagsFn>, formats?: Formats] : (Value extends any ? (key: ICUArgsWithTags<Value, TagsFn>) => void : never) extends (key: infer Args) => void ? OnlyOptional<Args> extends true ? [values?: undefined, formats?: Formats] : [values: Prettify<Args>, formats?: Formats] : never;
type TranslateArgs<Value extends string, TagsFn extends RichTagsFunction | MarkupTagsFunction = never> = string extends Value ? [
values?: Record<string, TranslationValues[string] | TagsFn>,
formats?: Formats
] : (Value extends any ? (key: ICUArgsWithTags<Value, TagsFn>) => void : never) extends (key: infer Args) => void ? OnlyOptional<Args> extends true ? [values?: undefined, formats?: Formats] : [values: Prettify<Args>, formats?: Formats] : never;
type NamespacedMessageKeys<TranslatorMessages extends Messages, Namespace extends NamespaceKeys<TranslatorMessages, NestedKeyOf<TranslatorMessages>> = never> = MessageKeys<NestedValueOf<{

@@ -20,0 +23,0 @@ '!': TranslatorMessages;

@@ -5,7 +5,4 @@ import type { Locale } from './AppConfig.tsx';

*
* Additionally, in development, the provided locales are validated to
* ensure they follow the Unicode language identifier standard.
*
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale
*/
export default function hasLocale<LocaleType extends Locale>(locales: ReadonlyArray<LocaleType>, candidate?: string | null): candidate is LocaleType;
export type { default as AbstractIntlMessages } from './AbstractIntlMessages.tsx';
export type { TranslationValues, ICUArg, RichTranslationValues, MarkupTranslationValues, RichTagsFunction, MarkupTagsFunction } from './TranslationValues.tsx';
export type { TranslationValues, RichTranslationValues, MarkupTranslationValues, RichTagsFunction, MarkupTagsFunction } from './TranslationValues.tsx';
export type { default as Formats } from './Formats.tsx';

@@ -4,0 +4,0 @@ export type { default as IntlConfig } from './IntlConfig.tsx';

import type { ReactNode } from 'react';
export type ICUArg = string | number | boolean | Date;
export type TranslationValues = Record<string, ICUArg>;
export type TranslationValues = Record<string, string | number | Date>;
export type RichTagsFunction = (chunks: ReactNode) => ReactNode;
export type MarkupTagsFunction = (chunks: string) => string;
export type RichTranslationValues = Record<string, ICUArg | RichTagsFunction>;
export type MarkupTranslationValues = Record<string, ICUArg | MarkupTagsFunction>;
export type RichTranslationValues = Record<string, TranslationValues[string] | RichTagsFunction>;
export type MarkupTranslationValues = Record<string, TranslationValues[string] | MarkupTagsFunction>;
{
"name": "use-intl",
"version": "4.0.0-beta-9ea117c",
"version": "4.0.0-beta-c323050",
"sideEffects": false,

@@ -67,3 +67,3 @@ "author": "Jan Amann <jan@amann.work>",

},
"gitHead": "6f3b777c6f396da1f3f948d78ea7f6dc065e81e2"
"gitHead": "759c798b20a0b88e6f42aa5bfc3d54683763f154"
}
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