Comparing version 4.0.0-beta-00a79d4 to 4.0.0-beta-18156c4
@@ -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,9 +8,9 @@ import type { ReactNode } from 'react'; | ||
import type { MessageKeys, NamespaceKeys, NestedKeyOf, NestedValueOf } from './MessageKeys.tsx'; | ||
import type { ICUArg, ICUDate, ICUNumber, MarkupTagsFunction, RichTagsFunction } from './TranslationValues.tsx'; | ||
import type { ICUArg, MarkupTagsFunction, RichTagsFunction } 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: ICUArg; | ||
ICUNumberArgument: ICUNumber; | ||
ICUDateArgument: ICUDate; | ||
ICUArgument: string | number | boolean | Date; | ||
ICUNumberArgument: number; | ||
ICUDateArgument: Date | number; | ||
}> & ([TagsFn] extends [never] ? {} : ICUTags<MessageString, TagsFn>); | ||
@@ -17,0 +17,0 @@ type OnlyOptional<T> = Partial<T> extends T ? true : false; |
@@ -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, RichTranslationValues, MarkupTranslationValues, ICUArg, ICUNumber, ICUDate, RichTagsFunction, MarkupTagsFunction } from './TranslationValues.tsx'; | ||
export type { TranslationValues, ICUArg, 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 ICUNumber = number; | ||
export type ICUDate = Date | number | string; | ||
export type TranslationValues = Record<string, ICUArg>; | ||
@@ -6,0 +4,0 @@ export type RichTagsFunction = (chunks: ReactNode) => ReactNode; |
{ | ||
"name": "use-intl", | ||
"version": "4.0.0-beta-00a79d4", | ||
"version": "4.0.0-beta-18156c4", | ||
"sideEffects": false, | ||
@@ -67,3 +67,3 @@ "author": "Jan Amann <jan@amann.work>", | ||
}, | ||
"gitHead": "9c05cd576d214480f7459b2351f94cfa9e4aef85" | ||
"gitHead": "c2e8c72ec78937a28955625dc1ed9dc2a10c4d32" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
82922
1467