New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

use-intl

Package Overview
Dependencies
Maintainers
0
Versions
276
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-67507cc to 4.0.0-beta-77949ef

dist/esm/development/initializeConfig-N-uKzgAH.js

4

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-DNjOIggo.js';
export { I as IntlError, a as IntlErrorCode, c as createFormatter, i as initializeConfig } from './initializeConfig-DNjOIggo.js';
import { r as resolveNamespace, e as createBaseTranslator, d as createCache, b as createIntlFormatters, f as defaultGetMessageFallback, g as defaultOnError } from './initializeConfig-N-uKzgAH.js';
export { I as IntlError, a as IntlErrorCode, c as createFormatter, i as initializeConfig } from './initializeConfig-N-uKzgAH.js';

@@ -4,0 +4,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-DNjOIggo.js';
export { I as IntlError, a as IntlErrorCode, d as _createCache, b as _createIntlFormatters, c as createFormatter, i as initializeConfig } from './initializeConfig-N-uKzgAH.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-DNjOIggo.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-N-uKzgAH.js';
import { jsx } from 'react/jsx-runtime';

@@ -41,5 +41,5 @@

// (required by provider)
formats: formats || prevContext?.formats,
formats: formats === undefined ? prevContext?.formats : formats,
getMessageFallback: getMessageFallback || prevContext?.getMessageFallback,
messages: messages || prevContext?.messages,
messages: messages === undefined ? prevContext?.messages : messages,
now: now || prevContext?.now,

@@ -46,0 +46,0 @@ onError: onError || prevContext?.onError,

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

import{r as e,e as s,d as r,b as t,f as o,g as n}from"./initializeConfig-BE7tJS3N.js";export{I as IntlError,a as IntlErrorCode,c as createFormatter,i as initializeConfig}from"./initializeConfig-BE7tJS3N.js";function m({_cache:a=r(),_formatters:i=t(a),getMessageFallback:m=o,messages:c,namespace:f,onError:g=n,...l}){return function({messages:a,namespace:r,...t},o){return a=a[o],r=e(r,o),s({...t,messages:a,namespace:r})}({...l,onError:g,cache:a,formatters:i,getMessageFallback:m,messages:{"!":c},namespace:f?`!.${f}`:"!"},"!")}function f(e,a){return e.includes(a)}export{r as _createCache,t as _createIntlFormatters,m as createTranslator,f as hasLocale};
import{r as e,e as s,d as r,b as t,f as o,g as n}from"./initializeConfig-zfMDfl5R.js";export{I as IntlError,a as IntlErrorCode,c as createFormatter,i as initializeConfig}from"./initializeConfig-zfMDfl5R.js";function m({_cache:a=r(),_formatters:i=t(a),getMessageFallback:m=o,messages:c,namespace:f,onError:g=n,...l}){return function({messages:a,namespace:r,...t},o){return a=a[o],r=e(r,o),s({...t,messages:a,namespace:r})}({...l,onError:g,cache:a,formatters:i,getMessageFallback:m,messages:{"!":c},namespace:f?`!.${f}`:"!"},"!")}function f(e,a){return e.includes(a)}export{r as _createCache,t as _createIntlFormatters,m as createTranslator,f as hasLocale};

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

export{I as IntlError,a as IntlErrorCode,d as _createCache,b as _createIntlFormatters,c as createFormatter,i as initializeConfig}from"./initializeConfig-BE7tJS3N.js";export{createTranslator,hasLocale}from"./core.js";export{IntlProvider,useFormatter,useLocale,useMessages,useNow,useTimeZone,useTranslations}from"./react.js";
export{I as IntlError,a as IntlErrorCode,d as _createCache,b as _createIntlFormatters,c as createFormatter,i as initializeConfig}from"./initializeConfig-zfMDfl5R.js";export{createTranslator,hasLocale}from"./core.js";export{IntlProvider,useFormatter,useLocale,useMessages,useNow,useTimeZone,useTranslations}from"./react.js";

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

import{createContext as e,useContext as r,useMemo as o,useState as t,useEffect as n}from"react";import{d as a,b as s,i as c,r as i,I as m,a as f,e as l,c as u}from"./initializeConfig-BE7tJS3N.js";import{jsx as g}from"react/jsx-runtime";const w=e(void 0);function d({children:e,formats:t,getMessageFallback:n,locale:i,messages:m,now:f,onError:l,timeZone:u}){const d=r(w),E=o((()=>d?.cache||a()),[i,d?.cache]),h=o((()=>d?.formatters||s(E)),[E,d?.formatters]),p=o((()=>({...c({locale:i,formats:t||d?.formats,getMessageFallback:n||d?.getMessageFallback,messages:m||d?.messages,now:f||d?.now,onError:l||d?.onError,timeZone:u||d?.timeZone}),formatters:h,cache:E})),[E,t,h,n,i,m,f,l,d,u]);return g(w.Provider,{value:p,children:e})}function E(){const e=r(w);if(!e)throw new Error(void 0);return e}let h=!1;const p="undefined"==typeof window;function v(e){return function(e,r,t){const{cache:n,formats:a,formatters:s,getMessageFallback:c,locale:u,onError:g,timeZone:w}=E(),d=e[t],v=i(r,t);return w||h||!p||(h=!0,g(new m(f.ENVIRONMENT_FALLBACK,void 0))),o((()=>l({cache:n,formatters:s,getMessageFallback:c,messages:d,namespace:v,onError:g,formats:a,locale:u,timeZone:w})),[n,s,c,d,v,g,a,u,w])}({"!":E().messages},e?`!.${e}`:"!","!")}function Z(){return E().locale}function b(){return new Date}function F(e){const r=e?.updateInterval,{now:o}=E(),[a,s]=t(o||b());return n((()=>{if(!r)return;const e=setInterval((()=>{s(b())}),r);return()=>{clearInterval(e)}}),[o,r]),null==r&&o?o:a}function M(){return E().timeZone}function k(){const e=E();if(!e.messages)throw new Error(void 0);return e.messages}function I(){const{formats:e,formatters:r,locale:t,now:n,onError:a,timeZone:s}=E();return o((()=>u({formats:e,locale:t,now:n,onError:a,timeZone:s,_formatters:r})),[e,r,n,t,a,s])}export{d as IntlProvider,I as useFormatter,Z as useLocale,k as useMessages,F as useNow,M as useTimeZone,v as useTranslations};
import{createContext as e,useContext as r,useMemo as o,useState as t,useEffect as n}from"react";import{d as a,b as s,i as c,r as i,I as m,a as f,e as l,c as u}from"./initializeConfig-zfMDfl5R.js";import{jsx as g}from"react/jsx-runtime";const d=e(void 0);function w({children:e,formats:t,getMessageFallback:n,locale:i,messages:m,now:f,onError:l,timeZone:u}){const w=r(d),v=o((()=>w?.cache||a()),[i,w?.cache]),E=o((()=>w?.formatters||s(v)),[v,w?.formatters]),h=o((()=>({...c({locale:i,formats:void 0===t?w?.formats:t,getMessageFallback:n||w?.getMessageFallback,messages:void 0===m?w?.messages:m,now:f||w?.now,onError:l||w?.onError,timeZone:u||w?.timeZone}),formatters:E,cache:v})),[v,t,E,n,i,m,f,l,w,u]);return g(d.Provider,{value:h,children:e})}function v(){const e=r(d);if(!e)throw new Error(void 0);return e}let E=!1;const h="undefined"==typeof window;function p(e){return function(e,r,t){const{cache:n,formats:a,formatters:s,getMessageFallback:c,locale:u,onError:g,timeZone:d}=v(),w=e[t],p=i(r,t);return d||E||!h||(E=!0,g(new m(f.ENVIRONMENT_FALLBACK,void 0))),o((()=>l({cache:n,formatters:s,getMessageFallback:c,messages:w,namespace:p,onError:g,formats:a,locale:u,timeZone:d})),[n,s,c,w,p,g,a,u,d])}({"!":v().messages},e?`!.${e}`:"!","!")}function Z(){return v().locale}function b(){return new Date}function F(e){const r=e?.updateInterval,{now:o}=v(),[a,s]=t(o||b());return n((()=>{if(!r)return;const e=setInterval((()=>{s(b())}),r);return()=>{clearInterval(e)}}),[o,r]),null==r&&o?o:a}function M(){return v().timeZone}function k(){const e=v();if(!e.messages)throw new Error(void 0);return e.messages}function I(){const{formats:e,formatters:r,locale:t,now:n,onError:a,timeZone:s}=v();return o((()=>u({formats:e,locale:t,now:n,onError:a,timeZone:s,_formatters:r})),[e,r,n,t,a,s])}export{w as IntlProvider,I as useFormatter,Z as useLocale,k as useMessages,F as useNow,M as useTimeZone,p as useTranslations};

@@ -22,8 +22,20 @@ import type { ReactElement } from 'react';

export default function createFormatter(props: Props): {
dateTime: (value: Date | number, formatOrOptions?: FormatNames["dateTime"] | DateTimeFormatOptions) => string;
number: (value: number | bigint, formatOrOptions?: FormatNames["number"] | NumberFormatOptions) => string;
dateTime: {
(value: Date | number, options?: DateTimeFormatOptions): string;
(value: Date | number, format?: FormatNames["dateTime"], options?: DateTimeFormatOptions): string;
};
number: {
(value: number | bigint, options?: NumberFormatOptions): string;
(value: number | bigint, format?: FormatNames["number"], options?: NumberFormatOptions): string;
};
relativeTime: (date: number | Date, nowOrOptions?: RelativeTimeFormatOptions["now"] | RelativeTimeFormatOptions) => string;
list: <Value extends string | ReactElement<any, string | import("react").JSXElementConstructor<any>>>(value: Iterable<Value>, formatOrOptions?: FormatNames["list"] | Intl.ListFormatOptions) => Value extends string ? string : Iterable<ReactElement>;
dateTimeRange: (start: Date | number, end: Date | number, formatOrOptions?: FormatNames["dateTime"] | DateTimeFormatOptions) => string;
list: {
<Value extends string | ReactElement<any, string | import("react").JSXElementConstructor<any>>>(value: Iterable<Value>, options?: Intl.ListFormatOptions): Value extends string ? string : Iterable<ReactElement>;
<Value extends string | ReactElement<any, string | import("react").JSXElementConstructor<any>>>(value: Iterable<Value>, format?: FormatNames["list"], options?: Intl.ListFormatOptions): Value extends string ? string : Iterable<ReactElement>;
};
dateTimeRange: {
(start: Date | number, end: Date | number, options?: DateTimeFormatOptions): string;
(start: Date | number, end: Date | number, format?: FormatNames["dateTime"], options?: DateTimeFormatOptions): string;
};
};
export {};

@@ -5,4 +5,5 @@ import type IntlConfig from './IntlConfig.js';

*/
export default function initializeConfig<Props extends IntlConfig>({ getMessageFallback, messages, onError, ...rest }: Props): Omit<Props, "onError" | "getMessageFallback" | "messages"> & {
messages: import("./types.js").DeepPartial<Record<string, any>> | undefined;
export default function initializeConfig<Props extends IntlConfig>({ formats, getMessageFallback, messages, onError, ...rest }: Props): Omit<Props, "formats" | "messages" | "onError" | "getMessageFallback"> & {
formats: NonNullable<IntlConfig["formats"]> | undefined;
messages: NonNullable<IntlConfig["messages"]> | undefined;
onError: (error: import("./IntlError.js").default) => void;

@@ -9,0 +10,0 @@ getMessageFallback: (info: {

@@ -14,3 +14,3 @@ import type { Locale, Messages } from './AppConfig.js';

* formatting across components. */
formats?: Formats;
formats?: Formats | null;
/** A time zone as defined in [the tz database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) which will be applied when formatting dates and times. If this is absent, the user time zone will be used. You can override this by supplying an explicit time zone to `formatDateTime`. */

@@ -42,3 +42,3 @@ timeZone?: TimeZone;

/** All messages that will be available. */
messages?: DeepPartial<Messages>;
messages?: DeepPartial<Messages> | null;
};

@@ -50,3 +50,5 @@ /**

*/
export type InitializedIntlConfig = IntlConfig & {
export type InitializedIntlConfig = Omit<IntlConfig, 'formats' | 'messages' | 'onError' | 'getMessageFallback'> & {
formats?: NonNullable<IntlConfig['formats']>;
messages?: NonNullable<IntlConfig['messages']>;
onError: NonNullable<IntlConfig['onError']>;

@@ -53,0 +55,0 @@ getMessageFallback: NonNullable<IntlConfig['getMessageFallback']>;

{
"name": "use-intl",
"version": "4.0.0-beta-67507cc",
"version": "4.0.0-beta-77949ef",
"sideEffects": false,

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

},
"gitHead": "9220b68c2e83f70b1d45ecad3f672ecf2cde0d57"
"gitHead": "1c5f6e1ccef3db9cff75f14da2a590329faf03cf"
}
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