@wix/fed-cli-i18next 1.6.41 → 1.6.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-async-messages-loader.js","names":[],"sources":["../src/create-async-messages-loader.ts"],"sourcesContent":["import type { Messages } from './i18n';\n\nconst memoWhilePending = <Value>() => {\n const map = new Map<string, Promise<Value>>();\n\n const getOrInsert = (key: string, factory: () => Promise<Value>): Promise<Value> => {\n if (!map.has(key)) {\n map.set(\n key,\n factory().finally(() => {\n map.delete(key);\n }),\n );\n }\n\n return map.get(key)!;\n };\n\n return {\n getOrInsert,\n };\n};\n\nconst load = async (loader: () => Promise<{ default: Messages }>) => {\n try {\n const { default: messages } = await loader();\n\n return messages;\n } catch {\n return undefined;\n }\n};\n\ntype CreateAsyncMessagesLoaderOptions = {\n isDev?: boolean;\n loadMessages: (languageCode: string) => Promise<{ default: Messages }>;\n loadDevMessages?: (languageCode: string) => Promise<{ default: Messages }>;\n};\n\nexport const createAsyncMessagesLoader = ({\n isDev,\n loadMessages,\n loadDevMessages,\n}: CreateAsyncMessagesLoaderOptions) => {\n const pending = memoWhilePending<Messages>();\n\n const loadLanguage = async (languageCode: string): Promise<Messages> => {\n const [messages, devMessages] = await Promise.all([\n load(() => loadMessages(languageCode)),\n !isDev || !loadDevMessages ? undefined : load(() => loadDevMessages(languageCode)),\n ]);\n\n if (messages && devMessages) {\n // devMessages override messages only in development and only if both are present\n return { ...messages, ...devMessages };\n }\n\n if (messages) {\n // callers must treat returned dictionaries as read-only\n return messages;\n }\n\n if (devMessages) {\n // callers must treat returned dictionaries as read-only\n return devMessages;\n }\n\n throw new Error(`No translation files found for ${languageCode}`);\n };\n\n return (languageCode: string): Promise<Messages> => {\n return pending.getOrInsert(languageCode, () => loadLanguage(languageCode));\n };\n};\n"],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"create-async-messages-loader.js","names":["memoWhilePending","map","key","factory","load","messages","loader","createAsyncMessagesLoader","pending","loadLanguage","devMessages","loadMessages","languageCode","isDev","loadDevMessages"],"sources":["../src/create-async-messages-loader.ts"],"sourcesContent":["import type { Messages } from './i18n';\n\nconst memoWhilePending = <Value>() => {\n const map = new Map<string, Promise<Value>>();\n\n const getOrInsert = (key: string, factory: () => Promise<Value>): Promise<Value> => {\n if (!map.has(key)) {\n map.set(\n key,\n factory().finally(() => {\n map.delete(key);\n }),\n );\n }\n\n return map.get(key)!;\n };\n\n return {\n getOrInsert,\n };\n};\n\nconst load = async (loader: () => Promise<{ default: Messages }>) => {\n try {\n const { default: messages } = await loader();\n\n return messages;\n } catch {\n return undefined;\n }\n};\n\ntype CreateAsyncMessagesLoaderOptions = {\n isDev?: boolean;\n loadMessages: (languageCode: string) => Promise<{ default: Messages }>;\n loadDevMessages?: (languageCode: string) => Promise<{ default: Messages }>;\n};\n\nexport const createAsyncMessagesLoader = ({\n isDev,\n loadMessages,\n loadDevMessages,\n}: CreateAsyncMessagesLoaderOptions) => {\n const pending = memoWhilePending<Messages>();\n\n const loadLanguage = async (languageCode: string): Promise<Messages> => {\n const [messages, devMessages] = await Promise.all([\n load(() => loadMessages(languageCode)),\n !isDev || !loadDevMessages ? undefined : load(() => loadDevMessages(languageCode)),\n ]);\n\n if (messages && devMessages) {\n // devMessages override messages only in development and only if both are present\n return { ...messages, ...devMessages };\n }\n\n if (messages) {\n // callers must treat returned dictionaries as read-only\n return messages;\n }\n\n if (devMessages) {\n // callers must treat returned dictionaries as read-only\n return devMessages;\n }\n\n throw new Error(`No translation files found for ${languageCode}`);\n };\n\n return (languageCode: string): Promise<Messages> => {\n return pending.getOrInsert(languageCode, () => loadLanguage(languageCode));\n };\n};\n"],"mappings":"AAEA,MAAMA,MAAgC,CACpC,IAAMC,kBAAM,IAAI,IAehB,MAAO,CACL,aAdmB,EAAa,KAC3BA,EAAI,IAAIC,CAAG,GACdD,EAAI,IACFC,EACAC,EAAQ,CAAC,CAAC,YAAc,CACtBF,EAAI,OAAOC,CAAG,CAChB,CAAC,CACH,EAGKD,EAAI,IAAIC,CAAG,EAKpB,CACF,EAEME,EAAO,KAAO,IAAiD,CACnE,GAAI,CACF,GAAM,CAAE,QAASC,GAAa,MAAMC,EAAO,EAE3C,OAAOD,CACT,MAAQ,CACN,MACF,CACF,EAQaE,GAA6B,CACxC,QACA,eACA,qBACsC,CACtC,IAAMC,EAAUR,EAA2B,EAErCS,EAAe,KAAO,IAA4C,CACtE,GAAM,CAACJ,EAAUK,GAAe,MAAM,QAAQ,IAAI,CAChDN,MAAWO,EAAaC,CAAY,CAAC,EACrC,CAACC,GAAS,CAACC,EAAkB,IAAA,GAAYV,MAAWU,EAAgBF,CAAY,CAAC,CACnF,CAAC,EAED,GAAIP,GAAYK,EAEd,MAAO,CAAE,GAAGL,EAAU,GAAGK,CAAY,EAGvC,GAAIL,EAEF,OAAOA,EAGT,GAAIK,EAEF,OAAOA,EAGT,MAAU,MAAM,kCAAkCE,GAAc,CAClE,EAEA,MAAQ,IACCJ,EAAQ,YAAYI,MAAoBH,EAAaG,CAAY,CAAC,CAE7E"}
|
package/dist/i18n.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.d.ts","names":[],"sources":["../src/i18n.ts"],"mappings":";;;;UAMiB;GACd;;;UAIO;EACR;EACA,uBAAuB,qBAAqB,QAAQ;EACpD,WAAW;EACX;;;;;EAKA;EACA;EACA;;KAGG,eAAe,SAAS,aAAa;EAAe;
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","names":["i18nType"],"sources":["../src/i18n.ts"],"mappings":";;;;UAMiB;GACd;;;UAIO;EACR;EACA,uBAAuB,qBAAqB,QAAQ;EACpD,WAAW;EACX;;;;;EAKA;EACA;EACA;;KAGG,eAAe,SAAS,aAAa;EAAe;MAAgBA;;;;;;;cAQ5D,MAAM;;;;;;iBAsEH,WACd,eACG;EAEH,aAAa;EAEb;IACE,cAAWA;;;;;;iBAeC,mBAAmB,SAAS,KAAK,mDAAgDA"}
|
package/dist/i18n.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.js","names":[],"sources":["../src/i18n.ts"],"sourcesContent":["import i18next from 'i18next';\nimport type { InitOptions, i18n as i18nType } from 'i18next';\nimport type { IcuConfig } from './icu';\nimport ICU from './icu';\n\n/** A flat map of translation keys to their translated strings. */\nexport interface Messages {\n [key: string]: string;\n}\n\n/** Configuration options for initializing an i18next instance. */\ninterface I18nOptions {\n locale: string;\n asyncMessagesLoader?: (language: string) => Promise<Messages>;\n messages?: Messages;\n useSuspense?: boolean;\n /**\n * @deprecated No-op. The underlying `react.wait` option was removed from\n * react-i18next in v10; use `useSuspense` instead. Kept for backward compatibility.\n */\n wait?: boolean;\n disableAutoInit?: boolean;\n bindI18n?: string;\n}\n\ntype I18nFactory = (options: I18nOptions, icuOptions?: { icu?: any }) => i18nType;\n\n/**\n * Creates and configures an i18next instance with optional ICU support and async message loading.\n * @param options - Locale, messages, and behavior configuration.\n * @param icuOptions - Optional ICU plugin instance for MessageFormat support.\n * @returns A configured i18next instance.\n */\nexport const i18n: I18nFactory = (\n { locale, asyncMessagesLoader, messages, useSuspense = false, disableAutoInit = false, bindI18n },\n { icu } = {},\n) => {\n const config: InitOptions = {\n // Initial language\n lng: locale,\n fallbackLng: 'en',\n\n // Don't use a key separator (no support for nested translation objects)\n keySeparator: false,\n\n react: {\n useSuspense,\n bindI18n,\n },\n\n // Basically when BM can be loaded without this config - you're good to go.\n // oxlint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error _polyfill is a non-standard BM-specific option not in i18next's InitOptions\n _polyfill: { isLoading: false },\n };\n\n const i18nInstance = i18next.createInstance(disableAutoInit ? config : undefined);\n\n // icu is optional since this function can be called from initI18n or initI18nWithoutICU modules\n if (icu) {\n i18nInstance.use(icu);\n }\n\n if (asyncMessagesLoader) {\n i18nInstance.use({\n type: 'backend' as const,\n read: async (\n language: string,\n _namespace: string,\n callback: (error: null | unknown, messages: null | Record<string, string>) => void,\n ) => {\n // We configure how i18next should fetch a translation resource when it\n // needs it: We use Webpack's dynamic imports to fetch resources without\n // increasing our bundle size.\n //\n // See https://webpack.js.org/guides/code-splitting/#dynamic-imports for\n // more information.\n try {\n const translation = await asyncMessagesLoader(language);\n return callback(null, translation);\n } catch (err) {\n return callback(err, null);\n }\n },\n });\n }\n\n if (messages) {\n config.resources = { [locale]: { translation: messages } };\n }\n\n if (!disableAutoInit) {\n i18nInstance.init(config);\n }\n\n return i18nInstance;\n};\n\n/**\n * Initializes an i18next instance with ICU MessageFormat support.\n * This is the recommended entry point for apps that need ICU pluralization and formatting.\n * @returns A configured i18next instance with ICU plugin.\n */\nexport function initI18n({\n icuOptions = {},\n ...options\n}: {\n icuOptions?: IcuConfig;\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n parseErrorHandler?: any;\n} & I18nOptions) {\n const { parseErrorHandler = undefined } = options;\n const icu = new ICU({\n parseErrorHandler,\n bindI18n: options.bindI18n,\n ...icuOptions,\n });\n return i18n(options, { icu });\n}\n\n/**\n * Initializes an i18next instance without ICU MessageFormat support.\n * Use when ICU formatting is not needed or when bundle size is a concern.\n * @returns A configured i18next instance without ICU plugin.\n */\nexport function initI18nWithoutICU(options: Omit<I18nOptions, 'icuOptions' | 'parseErrorHandler'>) {\n return i18n(options);\n}\n"],"mappings":"+CAiCA,
|
|
1
|
+
{"version":3,"file":"i18n.js","names":["ICU","i18next","i18n","config","locale","i18nInstance","disableAutoInit","icu","asyncMessagesLoader","callback","language","err","messages","initI18n","options","icuOptions","initI18nWithoutICU"],"sources":["../src/i18n.ts"],"sourcesContent":["import i18next from 'i18next';\nimport type { InitOptions, i18n as i18nType } from 'i18next';\nimport type { IcuConfig } from './icu';\nimport ICU from './icu';\n\n/** A flat map of translation keys to their translated strings. */\nexport interface Messages {\n [key: string]: string;\n}\n\n/** Configuration options for initializing an i18next instance. */\ninterface I18nOptions {\n locale: string;\n asyncMessagesLoader?: (language: string) => Promise<Messages>;\n messages?: Messages;\n useSuspense?: boolean;\n /**\n * @deprecated No-op. The underlying `react.wait` option was removed from\n * react-i18next in v10; use `useSuspense` instead. Kept for backward compatibility.\n */\n wait?: boolean;\n disableAutoInit?: boolean;\n bindI18n?: string;\n}\n\ntype I18nFactory = (options: I18nOptions, icuOptions?: { icu?: any }) => i18nType;\n\n/**\n * Creates and configures an i18next instance with optional ICU support and async message loading.\n * @param options - Locale, messages, and behavior configuration.\n * @param icuOptions - Optional ICU plugin instance for MessageFormat support.\n * @returns A configured i18next instance.\n */\nexport const i18n: I18nFactory = (\n { locale, asyncMessagesLoader, messages, useSuspense = false, disableAutoInit = false, bindI18n },\n { icu } = {},\n) => {\n const config: InitOptions = {\n // Initial language\n lng: locale,\n fallbackLng: 'en',\n\n // Don't use a key separator (no support for nested translation objects)\n keySeparator: false,\n\n react: {\n useSuspense,\n bindI18n,\n },\n\n // Basically when BM can be loaded without this config - you're good to go.\n // oxlint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error _polyfill is a non-standard BM-specific option not in i18next's InitOptions\n _polyfill: { isLoading: false },\n };\n\n const i18nInstance = i18next.createInstance(disableAutoInit ? config : undefined);\n\n // icu is optional since this function can be called from initI18n or initI18nWithoutICU modules\n if (icu) {\n i18nInstance.use(icu);\n }\n\n if (asyncMessagesLoader) {\n i18nInstance.use({\n type: 'backend' as const,\n read: async (\n language: string,\n _namespace: string,\n callback: (error: null | unknown, messages: null | Record<string, string>) => void,\n ) => {\n // We configure how i18next should fetch a translation resource when it\n // needs it: We use Webpack's dynamic imports to fetch resources without\n // increasing our bundle size.\n //\n // See https://webpack.js.org/guides/code-splitting/#dynamic-imports for\n // more information.\n try {\n const translation = await asyncMessagesLoader(language);\n return callback(null, translation);\n } catch (err) {\n return callback(err, null);\n }\n },\n });\n }\n\n if (messages) {\n config.resources = { [locale]: { translation: messages } };\n }\n\n if (!disableAutoInit) {\n i18nInstance.init(config);\n }\n\n return i18nInstance;\n};\n\n/**\n * Initializes an i18next instance with ICU MessageFormat support.\n * This is the recommended entry point for apps that need ICU pluralization and formatting.\n * @returns A configured i18next instance with ICU plugin.\n */\nexport function initI18n({\n icuOptions = {},\n ...options\n}: {\n icuOptions?: IcuConfig;\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n parseErrorHandler?: any;\n} & I18nOptions) {\n const { parseErrorHandler = undefined } = options;\n const icu = new ICU({\n parseErrorHandler,\n bindI18n: options.bindI18n,\n ...icuOptions,\n });\n return i18n(options, { icu });\n}\n\n/**\n * Initializes an i18next instance without ICU MessageFormat support.\n * Use when ICU formatting is not needed or when bundle size is a concern.\n * @returns A configured i18next instance without ICU plugin.\n */\nexport function initI18nWithoutICU(options: Omit<I18nOptions, 'icuOptions' | 'parseErrorHandler'>) {\n return i18n(options);\n}\n"],"mappings":"+CAiCA,MAAaE,GACX,CAAE,SAAQ,sBAAqB,WAAU,cAAc,GAAO,kBAAkB,GAAO,YACvF,CAAE,OAAQ,CAAC,IACR,CACH,IAAMC,EAAsB,CAE1B,IAAKC,EACL,YAAa,KAGb,aAAc,GAEd,MAAO,CACL,cACA,UACF,EAKA,UAAW,CAAE,UAAW,EAAM,CAChC,EAEMC,EAAeJ,EAAQ,eAAeK,EAAkBH,EAAS,IAAA,EAAS,EAuChF,OApCII,GACFF,EAAa,IAAIE,CAAG,EAGlBC,GACFH,EAAa,IAAI,CACf,KAAM,UACN,KAAM,MACJ,EACA,EACA,IACG,CAOH,GAAI,CAEF,OAAOI,EAAS,KAAM,MADID,EAAoBE,CAAQ,CACrB,CACnC,OAASC,EAAK,CACZ,OAAOF,EAASE,EAAK,IAAI,CAC3B,CACF,CACF,CAAC,EAGCC,IACF,EAAO,UAAY,EAAGR,GAAS,CAAE,YAAaQ,CAAS,CAAE,GAGtDN,GACHD,EAAa,KAAKF,CAAM,EAGnBE,CACT,EAOA,SAAgBQ,EAAS,CACvB,aAAa,CAAC,EACd,GAAGC,GAKY,CACf,GAAM,CAAE,oBAAoB,IAAA,IAAcA,EACpCP,EAAM,IAAIP,EAAI,CAClB,oBACA,SAAUc,EAAQ,SAClB,GAAGC,CACL,CAAC,EACD,OAAOb,EAAKY,EAAS,CAAE,KAAI,CAAC,CAC9B,CAOA,SAAgBE,EAAmB,EAAgE,CACjG,OAAOd,EAAKY,CAAO,CACrB"}
|
package/dist/icu.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icu.js","names":[],"sources":["../src/icu.ts"],"sourcesContent":["import { IntlMessageFormat } from 'intl-messageformat';\nimport type { Formatters } from 'intl-messageformat';\nimport type { i18n } from 'i18next';\n\ninterface IcuFormats {\n number?: {\n [styleName: string]: Intl.NumberFormatOptions;\n };\n date?: {\n [styleName: string]: Intl.DateTimeFormatOptions;\n };\n time?: {\n [styleName: string]: Intl.DateTimeFormatOptions;\n };\n}\n\ntype StoreEvent = 'added' | 'removed';\n\ninterface CachedMessage {\n lng: string;\n ns: string;\n source: string;\n fc: IntlMessageFormat;\n}\n\nexport interface IcuConfig {\n memoize?: boolean;\n memoizeFallback?: boolean;\n /** Maximum compiled messages per instance. Defaults to 1000; 0 disables this cache, Infinity disables eviction. */\n maxCacheSize?: number;\n /** Maximum shared Intl formatters per instance. Defaults to 100; 0 disables this cache, Infinity disables eviction. */\n maxFormatterCacheSize?: number;\n formats?: IcuFormats;\n bindI18n?: string;\n /** Space-separated resource-store events. Defaults to 'added removed'. */\n bindI18nStore?: '' | StoreEvent | 'added removed' | 'removed added';\n localeData?: any;\n parseErrorHandler?: (err: Error, key: string, res: string, options: object) => string;\n parseLngForICU?: (lng: string) => string;\n}\n\nfunction getDefaults(): IcuConfig {\n return {\n memoize: true,\n memoizeFallback: false,\n maxCacheSize: 1000,\n maxFormatterCacheSize: 100,\n bindI18n: '',\n bindI18nStore: 'added removed',\n parseErrorHandler: (_err, _key, res) => {\n return res;\n },\n };\n}\n\n/**\n * Copied from original ICU source code.\n * @source https://github.com/i18next/i18next-icu/blob/7809547c821a7ef3b2bb9ab2610cdbbcfedcb2f9/src/index.js\n *\n * It's done in order to support `IntlMessageFormat` out of the box.\n * `IntlMessageFormat` is adding formatters that are not provided by i18n.\n * For example, `select` formatter - https://formatjs.io/docs/core-concepts/icu-syntax#select-format\n * It allows to use following translation value: 'Welcome back{inputData, select, 0 {} 1 {, John}}'\n * See example in tests: __tests__/i18n.spec.tsx\n */\nclass ICU {\n options: IcuConfig | undefined;\n formats: IcuFormats | undefined;\n type: string;\n private cacheRoot = new Map<string, CachedMessage>();\n private formatterCache = new Map<\n string,\n Intl.NumberFormat | Intl.DateTimeFormat | Intl.PluralRules\n >();\n private unbindEvents?: () => void;\n private formatters: Formatters = {\n getNumberFormat: (...args) => this.getFormatter('number', Intl.NumberFormat, args),\n getDateTimeFormat: (...args) => this.getFormatter('dateTime', Intl.DateTimeFormat, args),\n getPluralRules: (...args) => this.getFormatter('pluralRules', Intl.PluralRules, args),\n };\n\n constructor(options: IcuConfig) {\n this.type = 'i18nFormat';\n\n this.init(null, options);\n }\n\n init(i18next: i18n | null, options: IcuConfig) {\n const i18nextOptions = (i18next && i18next.options && i18next.options.i18nFormat) || {};\n this.options = defaults(i18nextOptions, options, this.options || {}, getDefaults());\n for (const name of ['maxCacheSize', 'maxFormatterCacheSize'] as const) {\n const limit = this.options![name]!;\n if (limit !== Infinity && (!Number.isSafeInteger(limit) || limit < 0)) {\n throw new RangeError(`${name} must be a non-negative safe integer or Infinity`);\n }\n }\n this.formats = this.options?.formats;\n this.unbindEvents?.();\n this.unbindEvents = undefined;\n this.clearCache();\n\n if (i18next) {\n const { bindI18n, bindI18nStore } = this.options!;\n\n // @ts-expect-error fix later\n i18next.IntlMessageFormat = IntlMessageFormat;\n // @ts-expect-error fix later\n i18next.ICU = this;\n\n // Resources can only stale compiled messages, never the shared Intl formatters.\n const clearAll = () => this.clearMessages();\n // Store events report the (lng, ns) that changed, so only that much needs dropping.\n const clearChanged = (lng: string, ns: string) => this.clearNamespace(lng, ns);\n const store = i18next.store;\n const i18nEvents = bindI18n ? bindI18n.split(' ') : [];\n const storeEvents = bindI18nStore ? (bindI18nStore.split(' ') as StoreEvent[]) : [];\n for (const event of i18nEvents) i18next.on(event, clearAll);\n for (const event of storeEvents) store.on(event, clearChanged);\n this.unbindEvents = () => {\n for (const event of i18nEvents) i18next.off(event, clearAll);\n for (const event of storeEvents) store.off(event, clearChanged);\n };\n }\n\n if (this.options?.localeData) {\n if (Object.prototype.toString.apply(this.options.localeData) === '[object Array]') {\n this.options.localeData.forEach((ld: any) => this.addLocaleData(ld));\n } else {\n this.addLocaleData(this.options.localeData);\n }\n }\n }\n\n addLocaleData(data: any) {\n const locales = Array.isArray(data) ? data : [data];\n\n locales.forEach((localeData) => {\n if (localeData && localeData.locale) {\n // Undeclared legacy escape hatch on IntlMessageFormat.\n (IntlMessageFormat as any)['__addLocaleData'](localeData);\n }\n });\n }\n\n addUserDefinedFormats(formats: IcuFormats) {\n this.formats = this.formats ? { ...this.formats, ...formats } : formats;\n // Compiled messages capture `formats`; formatters are keyed by their resolved options.\n this.clearMessages();\n }\n\n parse(\n res: string,\n options: Record<string, any>,\n lng: string,\n ns: string,\n key: string,\n info: any,\n ) {\n // An undefined key means caching is off.\n const cacheKey =\n this.options?.memoize && this.options.maxCacheSize! > 0\n ? JSON.stringify([lng, ns, key])\n : undefined;\n\n let fc: IntlMessageFormat | undefined;\n if (cacheKey !== undefined) {\n const cached = this.cacheRoot.get(cacheKey);\n // A changed source must be recompiled even when no invalidation event fired.\n if (cached?.source === res) {\n fc = cached.fc;\n this.touch(cacheKey, cached);\n }\n }\n\n try {\n if (!fc) {\n fc = new IntlMessageFormat(res, lng, this.formats, { formatters: this.formatters });\n if (\n cacheKey !== undefined &&\n (this.options!.memoizeFallback || !info || info.resolved?.res)\n ) {\n this.touch(cacheKey, { lng, ns, source: res, fc });\n if (this.cacheRoot.size > this.options!.maxCacheSize!) {\n this.cacheRoot.delete(this.cacheRoot.keys().next().value!);\n }\n }\n }\n\n return fc.format(options);\n } catch (err) {\n return this.options?.parseErrorHandler?.(err as Error, key, res, options);\n }\n }\n\n addLookupKeys(finalKeys: any) {\n // no additional keys needed for select or plural\n // so there is no need to add keys to that finalKeys array\n return finalKeys;\n }\n\n /** Drops compiled messages, keeping the shared Intl formatters. */\n clearMessages() {\n this.cacheRoot.clear();\n }\n\n /** Drops compiled messages and the shared Intl formatters. */\n clearCache() {\n this.clearMessages();\n this.formatterCache.clear();\n }\n\n private clearNamespace(lng: string, ns: string) {\n for (const [cacheKey, entry] of this.cacheRoot) {\n if (entry.lng === lng && entry.ns === ns) this.cacheRoot.delete(cacheKey);\n }\n }\n\n /** Re-inserts to mark most recently used: Map.set keeps an existing key's position. */\n private touch(cacheKey: string, entry: CachedMessage) {\n this.cacheRoot.delete(cacheKey);\n this.cacheRoot.set(cacheKey, entry);\n }\n\n private getFormatter<\n T extends Intl.NumberFormat | Intl.DateTimeFormat | Intl.PluralRules,\n Args extends unknown[],\n >(type: string, Formatter: new (...args: Args) => T, args: Args): T {\n if (!this.options?.memoize || this.options.maxFormatterCacheSize === 0) {\n return new Formatter(...args);\n }\n\n const [locales, options] = args;\n // Equivalent option objects should share a formatter regardless of property order.\n const key = JSON.stringify([\n type,\n locales,\n // oxlint-disable-next-line no-array-sort -- Object.entries already returns a fresh array\n Object.entries(options ?? {}).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)),\n ]);\n const cached = this.formatterCache.get(key);\n if (cached) {\n this.formatterCache.delete(key);\n this.formatterCache.set(key, cached);\n return cached as T;\n }\n\n const formatter = new Formatter(...args);\n this.formatterCache.set(key, formatter);\n if (this.formatterCache.size > this.options!.maxFormatterCacheSize!) {\n this.formatterCache.delete(this.formatterCache.keys().next().value!);\n }\n return formatter;\n }\n}\n\n// @ts-expect-error fix it later\nICU.type = 'i18nFormat';\n\nexport default ICU;\n\n/** Fills only the keys `obj` leaves undefined, so explicit `undefined` never clobbers a default. */\nfunction defaults(obj: IcuConfig, ...sources: (IcuConfig | undefined)[]): IcuConfig {\n const target = obj as Record<string, unknown>;\n for (const source of sources) {\n if (!source) continue;\n for (const [key, value] of Object.entries(source)) {\n if (target[key] === undefined) target[key] = value;\n }\n }\n return obj;\n}\n"],"mappings":"uDAyCA,SAAS,GAAyB,CAChC,MAAO,CACL,QAAS,GACT,gBAAiB,GACjB,aAAc,IACd,sBAAuB,IACvB,SAAU,GACV,cAAe,gBACf,mBAAoB,EAAM,EAAM,IACvB,CAEX,CACF,CAYA,IAAM,EAAN,KAAU,CACR,QACA,QACA,KACA,0BAAoB,IAAI,IACxB,+BAAyB,IAAI,IAI7B,aACA,WAAiC,CAC/B,iBAAkB,GAAG,IAAS,KAAK,aAAa,SAAU,KAAK,aAAc,CAAI,EACjF,mBAAoB,GAAG,IAAS,KAAK,aAAa,WAAY,KAAK,eAAgB,CAAI,EACvF,gBAAiB,GAAG,IAAS,KAAK,aAAa,cAAe,KAAK,YAAa,CAAI,CACtF,EAEA,YAAY,EAAoB,CAC9B,KAAK,KAAO,aAEZ,KAAK,KAAK,KAAM,CAAO,CACzB,CAEA,KAAK,EAAsB,EAAoB,CAC7C,IAAM,EAAkB,GAAW,EAAQ,SAAW,EAAQ,QAAQ,YAAe,CAAC,EACtF,KAAK,QAAU,EAAS,EAAgB,EAAS,KAAK,SAAW,CAAC,EAAG,EAAY,CAAC,EAClF,IAAK,IAAM,IAAQ,CAAC,eAAgB,uBAAuB,EAAY,CACrE,IAAM,EAAQ,KAAK,QAAS,GAC5B,GAAI,IAAU,MAAa,CAAC,OAAO,cAAc,CAAK,GAAK,EAAQ,GACjE,MAAU,WAAW,GAAG,EAAK,iDAAiD,CAElF,CAMA,GALA,KAAK,QAAU,KAAK,SAAS,QAC7B,KAAK,eAAe,EACpB,KAAK,aAAe,IAAA,GACpB,KAAK,WAAW,EAEZ,EAAS,CACX,GAAM,CAAE,WAAU,iBAAkB,KAAK,QAGzC,EAAQ,kBAAoB,EAE5B,EAAQ,IAAM,K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KAAK,eAAe,OAAO,CAAG,EAC9B,KAAK,eAAe,IAAI,EAAK,CAAM,EAC5B,EAGT,IAAM,EAAY,IAAI,EAAU,GAAG,CAAI,EAKvC,OAJA,KAAK,eAAe,IAAI,EAAK,CAAS,EAClC,KAAK,eAAe,KAAO,KAAK,QAAS,uBAC3C,KAAK,eAAe,OAAO,KAAK,eAAe,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,KAAM,EAE9D,CACT,CACF,EAGA,EAAI,KAAO,aAKX,SAAS,EAAS,EAAgB,GAAG,EAA+C,CAClF,IAAM,EAAS,EACf,IAAK,IAAM,KAAU,EACnB,GAAK,EACL,IAAK,GAAM,CAAC,EAAK,KAAU,OAAO,QAAQ,CAAM,EAC1C,EAAO,KAAS,IAAA,KAAW,EAAO,GAAO,GAGjD,OAAO,CACT"}
|
|
1
|
+
{"version":3,"file":"icu.js","names":["getDefaults","res","ICU","args","options","i18nextOptions","i18next","defaults","name","limit","IntlMessageFormat","clearAll","clearChanged","lng","ns","store","i18nEvents","bindI18n","storeEvents","bindI18nStore","event","ld","data","localeData","\"__addLocaleData\"","formats","cacheKey","key","fc","cached","info","err","finalKeys","entry","Formatter","locales","type","a","b","formatter","sources","target","obj","source","value"],"sources":["../src/icu.ts"],"sourcesContent":["import { IntlMessageFormat } from 'intl-messageformat';\nimport type { Formatters } from 'intl-messageformat';\nimport type { i18n } from 'i18next';\n\ninterface IcuFormats {\n number?: {\n [styleName: string]: Intl.NumberFormatOptions;\n };\n date?: {\n [styleName: string]: Intl.DateTimeFormatOptions;\n };\n time?: {\n [styleName: string]: Intl.DateTimeFormatOptions;\n };\n}\n\ntype StoreEvent = 'added' | 'removed';\n\ninterface CachedMessage {\n lng: string;\n ns: string;\n source: string;\n fc: IntlMessageFormat;\n}\n\nexport interface IcuConfig {\n memoize?: boolean;\n memoizeFallback?: boolean;\n /** Maximum compiled messages per instance. Defaults to 1000; 0 disables this cache, Infinity disables eviction. */\n maxCacheSize?: number;\n /** Maximum shared Intl formatters per instance. Defaults to 100; 0 disables this cache, Infinity disables eviction. */\n maxFormatterCacheSize?: number;\n formats?: IcuFormats;\n bindI18n?: string;\n /** Space-separated resource-store events. Defaults to 'added removed'. */\n bindI18nStore?: '' | StoreEvent | 'added removed' | 'removed added';\n localeData?: any;\n parseErrorHandler?: (err: Error, key: string, res: string, options: object) => string;\n parseLngForICU?: (lng: string) => string;\n}\n\nfunction getDefaults(): IcuConfig {\n return {\n memoize: true,\n memoizeFallback: false,\n maxCacheSize: 1000,\n maxFormatterCacheSize: 100,\n bindI18n: '',\n bindI18nStore: 'added removed',\n parseErrorHandler: (_err, _key, res) => {\n return res;\n },\n };\n}\n\n/**\n * Copied from original ICU source code.\n * @source https://github.com/i18next/i18next-icu/blob/7809547c821a7ef3b2bb9ab2610cdbbcfedcb2f9/src/index.js\n *\n * It's done in order to support `IntlMessageFormat` out of the box.\n * `IntlMessageFormat` is adding formatters that are not provided by i18n.\n * For example, `select` formatter - https://formatjs.io/docs/core-concepts/icu-syntax#select-format\n * It allows to use following translation value: 'Welcome back{inputData, select, 0 {} 1 {, John}}'\n * See example in tests: __tests__/i18n.spec.tsx\n */\nclass ICU {\n options: IcuConfig | undefined;\n formats: IcuFormats | undefined;\n type: string;\n private cacheRoot = new Map<string, CachedMessage>();\n private formatterCache = new Map<\n string,\n Intl.NumberFormat | Intl.DateTimeFormat | Intl.PluralRules\n >();\n private unbindEvents?: () => void;\n private formatters: Formatters = {\n getNumberFormat: (...args) => this.getFormatter('number', Intl.NumberFormat, args),\n getDateTimeFormat: (...args) => this.getFormatter('dateTime', Intl.DateTimeFormat, args),\n getPluralRules: (...args) => this.getFormatter('pluralRules', Intl.PluralRules, args),\n };\n\n constructor(options: IcuConfig) {\n this.type = 'i18nFormat';\n\n this.init(null, options);\n }\n\n init(i18next: i18n | null, options: IcuConfig) {\n const i18nextOptions = (i18next && i18next.options && i18next.options.i18nFormat) || {};\n this.options = defaults(i18nextOptions, options, this.options || {}, getDefaults());\n for (const name of ['maxCacheSize', 'maxFormatterCacheSize'] as const) {\n const limit = this.options![name]!;\n if (limit !== Infinity && (!Number.isSafeInteger(limit) || limit < 0)) {\n throw new RangeError(`${name} must be a non-negative safe integer or Infinity`);\n }\n }\n this.formats = this.options?.formats;\n this.unbindEvents?.();\n this.unbindEvents = undefined;\n this.clearCache();\n\n if (i18next) {\n const { bindI18n, bindI18nStore } = this.options!;\n\n // @ts-expect-error fix later\n i18next.IntlMessageFormat = IntlMessageFormat;\n // @ts-expect-error fix later\n i18next.ICU = this;\n\n // Resources can only stale compiled messages, never the shared Intl formatters.\n const clearAll = () => this.clearMessages();\n // Store events report the (lng, ns) that changed, so only that much needs dropping.\n const clearChanged = (lng: string, ns: string) => this.clearNamespace(lng, ns);\n const store = i18next.store;\n const i18nEvents = bindI18n ? bindI18n.split(' ') : [];\n const storeEvents = bindI18nStore ? (bindI18nStore.split(' ') as StoreEvent[]) : [];\n for (const event of i18nEvents) i18next.on(event, clearAll);\n for (const event of storeEvents) store.on(event, clearChanged);\n this.unbindEvents = () => {\n for (const event of i18nEvents) i18next.off(event, clearAll);\n for (const event of storeEvents) store.off(event, clearChanged);\n };\n }\n\n if (this.options?.localeData) {\n if (Object.prototype.toString.apply(this.options.localeData) === '[object Array]') {\n this.options.localeData.forEach((ld: any) => this.addLocaleData(ld));\n } else {\n this.addLocaleData(this.options.localeData);\n }\n }\n }\n\n addLocaleData(data: any) {\n const locales = Array.isArray(data) ? data : [data];\n\n locales.forEach((localeData) => {\n if (localeData && localeData.locale) {\n // Undeclared legacy escape hatch on IntlMessageFormat.\n (IntlMessageFormat as any)['__addLocaleData'](localeData);\n }\n });\n }\n\n addUserDefinedFormats(formats: IcuFormats) {\n this.formats = this.formats ? { ...this.formats, ...formats } : formats;\n // Compiled messages capture `formats`; formatters are keyed by their resolved options.\n this.clearMessages();\n }\n\n parse(\n res: string,\n options: Record<string, any>,\n lng: string,\n ns: string,\n key: string,\n info: any,\n ) {\n // An undefined key means caching is off.\n const cacheKey =\n this.options?.memoize && this.options.maxCacheSize! > 0\n ? JSON.stringify([lng, ns, key])\n : undefined;\n\n let fc: IntlMessageFormat | undefined;\n if (cacheKey !== undefined) {\n const cached = this.cacheRoot.get(cacheKey);\n // A changed source must be recompiled even when no invalidation event fired.\n if (cached?.source === res) {\n fc = cached.fc;\n this.touch(cacheKey, cached);\n }\n }\n\n try {\n if (!fc) {\n fc = new IntlMessageFormat(res, lng, this.formats, { formatters: this.formatters });\n if (\n cacheKey !== undefined &&\n (this.options!.memoizeFallback || !info || info.resolved?.res)\n ) {\n this.touch(cacheKey, { lng, ns, source: res, fc });\n if (this.cacheRoot.size > this.options!.maxCacheSize!) {\n this.cacheRoot.delete(this.cacheRoot.keys().next().value!);\n }\n }\n }\n\n return fc.format(options);\n } catch (err) {\n return this.options?.parseErrorHandler?.(err as Error, key, res, options);\n }\n }\n\n addLookupKeys(finalKeys: any) {\n // no additional keys needed for select or plural\n // so there is no need to add keys to that finalKeys array\n return finalKeys;\n }\n\n /** Drops compiled messages, keeping the shared Intl formatters. */\n clearMessages() {\n this.cacheRoot.clear();\n }\n\n /** Drops compiled messages and the shared Intl formatters. */\n clearCache() {\n this.clearMessages();\n this.formatterCache.clear();\n }\n\n private clearNamespace(lng: string, ns: string) {\n for (const [cacheKey, entry] of this.cacheRoot) {\n if (entry.lng === lng && entry.ns === ns) this.cacheRoot.delete(cacheKey);\n }\n }\n\n /** Re-inserts to mark most recently used: Map.set keeps an existing key's position. */\n private touch(cacheKey: string, entry: CachedMessage) {\n this.cacheRoot.delete(cacheKey);\n this.cacheRoot.set(cacheKey, entry);\n }\n\n private getFormatter<\n T extends Intl.NumberFormat | Intl.DateTimeFormat | Intl.PluralRules,\n Args extends unknown[],\n >(type: string, Formatter: new (...args: Args) => T, args: Args): T {\n if (!this.options?.memoize || this.options.maxFormatterCacheSize === 0) {\n return new Formatter(...args);\n }\n\n const [locales, options] = args;\n // Equivalent option objects should share a formatter regardless of property order.\n const key = JSON.stringify([\n type,\n locales,\n // oxlint-disable-next-line no-array-sort -- Object.entries already returns a fresh array\n Object.entries(options ?? {}).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)),\n ]);\n const cached = this.formatterCache.get(key);\n if (cached) {\n this.formatterCache.delete(key);\n this.formatterCache.set(key, cached);\n return cached as T;\n }\n\n const formatter = new Formatter(...args);\n this.formatterCache.set(key, formatter);\n if (this.formatterCache.size > this.options!.maxFormatterCacheSize!) {\n this.formatterCache.delete(this.formatterCache.keys().next().value!);\n }\n return formatter;\n }\n}\n\n// @ts-expect-error fix it later\nICU.type = 'i18nFormat';\n\nexport default ICU;\n\n/** Fills only the keys `obj` leaves undefined, so explicit `undefined` never clobbers a default. */\nfunction defaults(obj: IcuConfig, ...sources: (IcuConfig | undefined)[]): IcuConfig {\n const target = obj as Record<string, unknown>;\n for (const source of sources) {\n if (!source) continue;\n for (const [key, value] of Object.entries(source)) {\n if (target[key] === undefined) target[key] = value;\n }\n }\n return obj;\n}\n"],"mappings":"uDAyCA,SAASA,GAAyB,CAChC,MAAO,CACL,QAAS,GACT,gBAAiB,GACjB,aAAc,IACd,sBAAuB,IACvB,SAAU,GACV,cAAe,gBACf,mBAAoB,EAAM,EAAM,IACvBC,CAEX,CACF,CAYA,IAAMC,EAAN,KAAU,CACR,QACA,QACA,KACA,0BAAoB,IAAI,IACxB,+BAAyB,IAAI,IAI7B,aACA,WAAiC,CAC/B,iBAAkB,GAAGC,IAAS,KAAK,aAAa,SAAU,KAAK,aAAcA,CAAI,EACjF,mBAAoB,GAAGA,IAAS,KAAK,aAAa,WAAY,KAAK,eAAgBA,CAAI,EACvF,gBAAiB,GAAGA,IAAS,KAAK,aAAa,cAAe,KAAK,YAAaA,CAAI,CACtF,EAEA,YAAY,EAAoB,CAC9B,KAAK,KAAO,aAEZ,KAAK,KAAK,KAAMC,CAAO,CACzB,CAEA,KAAK,EAAsB,EAAoB,CAC7C,IAAMC,EAAkBC,GAAWA,EAAQ,SAAWA,EAAQ,QAAQ,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src/relative-time-formatting.ts"],"sourcesContent":["type LanguageKey =\n | 'en'\n | 'nl'\n | 'cs'\n | 'da'\n | 'de'\n | 'fr'\n | 'hi'\n | 'it'\n | 'ja'\n | 'ko'\n | 'lt'\n | 'nb'\n | 'pl'\n | 'pt'\n | 'es'\n | 'sv'\n | 'th'\n | 'tr'\n | 'ru'\n | 'zh-cn'\n | 'uk';\n\ninterface ExpressionMap {\n s: string;\n ss: string;\n m: string;\n mm: string;\n h: string;\n hh: string;\n d?: string;\n dd?: string;\n}\n\nconst shortExpressions: Record<LanguageKey, ExpressionMap> = {\n en: {\n s: '1s',\n ss: '%ds',\n m: '1m',\n mm: '%dm',\n h: '1h',\n hh: '%dh',\n d: '1d',\n dd: '%dd',\n },\n nl: {\n s: '1sec.',\n ss: '%dsec.',\n m: '1min.',\n mm: '%dmin.',\n h: '1u.',\n hh: '%du.',\n },\n cs: {\n s: '1sek',\n ss: '%dsek',\n m: '1min',\n mm: '%dmin',\n h: '1hod',\n hh: '%dhod',\n },\n da: {\n s: '1s',\n ss: '%ds',\n m: '1m',\n mm: '%dm',\n h: '1t',\n hh: '%dt',\n },\n de: {\n s: '1Sek.',\n ss: '%dSek.',\n m: '1Min.',\n mm: '%dMin.',\n h: '1Std.',\n hh: '%dStd.',\n },\n fr: {\n s: '1s',\n ss: '%ds',\n m: '1min',\n mm: '%dmin',\n h: '1h',\n hh: '%dh',\n },\n hi: {\n s: '1से',\n ss: '%dसे',\n m: '1मि',\n mm: '%dमि',\n h: '1घंटा',\n hh: '%dघंटा',\n },\n it: {\n s: '1sec',\n ss: '%dsec',\n m: '1min',\n mm: '%dmin',\n h: '1ora',\n hh: '%dore',\n },\n ja: {\n s: '1秒',\n ss: '%d秒',\n m: '1分',\n mm: '%d分',\n h: '1時間',\n hh: '%d時間',\n },\n ko: {\n s: '1초',\n ss: '%d초',\n m: '1분',\n mm: '%d분',\n h: '1시간',\n hh: '%d시간',\n },\n lt: {\n s: '1s',\n ss: '%ds',\n m: '1min',\n mm: '%dmin',\n h: '1val',\n hh: '%dval',\n },\n nb: {\n s: '1sek',\n ss: '%dsek',\n m: '1min',\n mm: '%dmin',\n h: '1time',\n hh: '%dtimer',\n },\n pl: {\n s: '1s',\n ss: '%ds',\n m: '1min',\n mm: '%dmin',\n h: '1h',\n hh: '%dh',\n },\n pt: {\n s: '1s',\n ss: '%ds',\n m: '1min',\n mm: '%dmin',\n h: '1h',\n hh: '%dh',\n },\n es: {\n s: '1seg',\n ss: '%dseg',\n m: '1min',\n mm: '%dmin',\n h: '1h',\n hh: '%dhs',\n },\n sv: {\n s: '1s',\n ss: '%ds',\n m: '1min',\n mm: '%dmin',\n h: '1h',\n hh: '%dh',\n },\n th: {\n s: '1วินาที',\n ss: '%dวินาที',\n m: '1นาที',\n mm: '%dนาที',\n h: '1ชั่วโมง',\n hh: '%dชั่วโมง',\n },\n tr: {\n s: '1sn.',\n ss: '%dsn.',\n m: '1dk.',\n mm: '%ddk.',\n h: '1sa.',\n hh: '%dsa.',\n },\n ru: {\n s: '1сек.',\n ss: '%dсек.',\n m: '1dмин.',\n mm: '%dмин.',\n h: '1ч.',\n hh: '%dч.',\n },\n 'zh-cn': {\n s: '1秒',\n ss: '%d秒',\n m: '1d分鐘',\n mm: '%d分鐘',\n h: '1小時',\n hh: '%d小時',\n },\n uk: {\n s: '1с.',\n ss: '%dс.',\n m: '1dхв.',\n mm: '%dхв.',\n h: '1г.',\n hh: '%dг.',\n },\n};\n\nconst MS_PER_SECOND = 1000;\nconst MS_PER_MINUTE = MS_PER_SECOND * 60;\nconst MS_PER_HOUR = MS_PER_MINUTE * 60;\nconst MS_PER_DAY = MS_PER_HOUR * 24;\n\nenum TIME_UNIT {\n SECONDS = 'second',\n MINUTES = 'minute',\n HOURS = 'hour',\n DAYS = 'day',\n}\n\nfunction applyShortenedExpression(language: LanguageKey, timeUnit: TIME_UNIT, value: number) {\n const placeholder = '%d';\n const unitToShorthand: Record<TIME_UNIT, keyof ExpressionMap> = {\n [TIME_UNIT.SECONDS]: 'ss',\n [TIME_UNIT.MINUTES]: 'mm',\n [TIME_UNIT.HOURS]: 'hh',\n [TIME_UNIT.DAYS]: 'dd',\n };\n\n const shorthand: keyof ExpressionMap =\n value === -1\n ? (unitToShorthand[timeUnit][0] as keyof ExpressionMap)\n : unitToShorthand[timeUnit];\n const expression = shortExpressions[language] ? shortExpressions[language][shorthand] : null;\n if (expression) {\n return expression.replace(placeholder, `${-value}`);\n }\n\n return null;\n}\n\nfunction getTimeUnit(time: number) {\n const timeAdjusted = time < 0 ? -time : time;\n switch (true) {\n case timeAdjusted < MS_PER_MINUTE:\n return TIME_UNIT.SECONDS;\n case timeAdjusted < MS_PER_HOUR:\n return TIME_UNIT.MINUTES;\n case timeAdjusted < MS_PER_DAY:\n return TIME_UNIT.HOURS;\n default:\n return TIME_UNIT.DAYS;\n }\n}\n\nfunction getRelativeTime(time: number, unit: TIME_UNIT, floorSeconds: boolean) {\n let returnTime;\n switch (unit) {\n case TIME_UNIT.SECONDS:\n if (floorSeconds) {\n returnTime = 1;\n } else {\n returnTime = time / MS_PER_SECOND;\n }\n break;\n case TIME_UNIT.MINUTES:\n returnTime = time / MS_PER_MINUTE;\n break;\n case TIME_UNIT.HOURS:\n returnTime = time / MS_PER_HOUR;\n break;\n case TIME_UNIT.DAYS:\n returnTime = time / MS_PER_DAY;\n break;\n default:\n returnTime = time;\n }\n return -Math.round(returnTime);\n}\n\nfunction isLibAvailable() {\n return typeof Intl.RelativeTimeFormat !== 'undefined';\n}\n\ntype DateTime = string | number | Date;\n\nexport function createRtfFormatter(\n language: string,\n { floorSeconds = false, extraShortExpression = false } = {},\n options = {},\n) {\n let rtf: Intl.RelativeTimeFormat;\n return (time: DateTime) => {\n if (!rtf && isLibAvailable()) {\n rtf = new Intl.RelativeTimeFormat(language, { ...options });\n }\n let timeDiff = new Date().getTime() - new Date(time).getTime();\n if (isNaN(timeDiff)) {\n console.error(\n `[@wix/fed-cli-i18next/relative-time-formatter] received invalid time: ${time}`,\n );\n timeDiff = MS_PER_SECOND;\n }\n const unit = getTimeUnit(timeDiff);\n const relativeTime = getRelativeTime(timeDiff, unit, floorSeconds);\n\n const shortExpression =\n extraShortExpression || !rtf\n ? applyShortenedExpression(language as LanguageKey, unit, relativeTime)\n : null;\n\n if (shortExpression) {\n return shortExpression;\n }\n\n if (rtf) {\n return rtf.format(relativeTime, unit);\n }\n\n return time;\n };\n}\n"],"mappings":"AAkCA,
|
|
1
|
+
{"version":3,"file":"relative-time-formatting.js","names":["shortExpressions","MS_PER_SECOND","MS_PER_MINUTE","MS_PER_HOUR","MS_PER_DAY","applyShortenedExpression","unitToShorthand","\"second\"","\"minute\"","\"hour\"","\"day\"","shorthand","value","timeUnit","expression","language","getTimeUnit","timeAdjusted","time","getRelativeTime","returnTime","unit","floorSeconds","isLibAvailable","createRtfFormatter","rtf","options","timeDiff","relativeTime","extraShortExpression"],"sources":["../src/relative-time-formatting.ts"],"sourcesContent":["type LanguageKey =\n | 'en'\n | 'nl'\n | 'cs'\n | 'da'\n | 'de'\n | 'fr'\n | 'hi'\n | 'it'\n | 'ja'\n | 'ko'\n | 'lt'\n | 'nb'\n | 'pl'\n | 'pt'\n | 'es'\n | 'sv'\n | 'th'\n | 'tr'\n | 'ru'\n | 'zh-cn'\n | 'uk';\n\ninterface ExpressionMap {\n s: string;\n ss: string;\n m: string;\n mm: string;\n h: string;\n hh: string;\n d?: string;\n dd?: string;\n}\n\nconst shortExpressions: Record<LanguageKey, ExpressionMap> = {\n en: {\n s: '1s',\n ss: '%ds',\n m: '1m',\n mm: '%dm',\n h: '1h',\n hh: '%dh',\n d: '1d',\n dd: '%dd',\n },\n nl: {\n s: '1sec.',\n ss: '%dsec.',\n m: '1min.',\n mm: '%dmin.',\n h: '1u.',\n hh: '%du.',\n },\n cs: {\n s: '1sek',\n ss: '%dsek',\n m: '1min',\n mm: '%dmin',\n h: '1hod',\n hh: '%dhod',\n },\n da: {\n s: '1s',\n ss: '%ds',\n m: '1m',\n mm: '%dm',\n h: '1t',\n hh: '%dt',\n },\n de: {\n s: '1Sek.',\n ss: '%dSek.',\n m: '1Min.',\n mm: '%dMin.',\n h: '1Std.',\n hh: '%dStd.',\n },\n fr: {\n s: '1s',\n ss: '%ds',\n m: '1min',\n mm: '%dmin',\n h: '1h',\n hh: '%dh',\n },\n hi: {\n s: '1से',\n ss: '%dसे',\n m: '1मि',\n mm: '%dमि',\n h: '1घंटा',\n hh: '%dघंटा',\n },\n it: {\n s: '1sec',\n ss: '%dsec',\n m: '1min',\n mm: '%dmin',\n h: '1ora',\n hh: '%dore',\n },\n ja: {\n s: '1秒',\n ss: '%d秒',\n m: '1分',\n mm: '%d分',\n h: '1時間',\n hh: '%d時間',\n },\n ko: {\n s: '1초',\n ss: '%d초',\n m: '1분',\n mm: '%d분',\n h: '1시간',\n hh: '%d시간',\n },\n lt: {\n s: '1s',\n ss: '%ds',\n m: '1min',\n mm: '%dmin',\n h: '1val',\n hh: '%dval',\n },\n nb: {\n s: '1sek',\n ss: '%dsek',\n m: '1min',\n mm: '%dmin',\n h: '1time',\n hh: '%dtimer',\n },\n pl: {\n s: '1s',\n ss: '%ds',\n m: '1min',\n mm: '%dmin',\n h: '1h',\n hh: '%dh',\n },\n pt: {\n s: '1s',\n ss: '%ds',\n m: '1min',\n mm: '%dmin',\n h: '1h',\n hh: '%dh',\n },\n es: {\n s: '1seg',\n ss: '%dseg',\n m: '1min',\n mm: '%dmin',\n h: '1h',\n hh: '%dhs',\n },\n sv: {\n s: '1s',\n ss: '%ds',\n m: '1min',\n mm: '%dmin',\n h: '1h',\n hh: '%dh',\n },\n th: {\n s: '1วินาที',\n ss: '%dวินาที',\n m: '1นาที',\n mm: '%dนาที',\n h: '1ชั่วโมง',\n hh: '%dชั่วโมง',\n },\n tr: {\n s: '1sn.',\n ss: '%dsn.',\n m: '1dk.',\n mm: '%ddk.',\n h: '1sa.',\n hh: '%dsa.',\n },\n ru: {\n s: '1сек.',\n ss: '%dсек.',\n m: '1dмин.',\n mm: '%dмин.',\n h: '1ч.',\n hh: '%dч.',\n },\n 'zh-cn': {\n s: '1秒',\n ss: '%d秒',\n m: '1d分鐘',\n mm: '%d分鐘',\n h: '1小時',\n hh: '%d小時',\n },\n uk: {\n s: '1с.',\n ss: '%dс.',\n m: '1dхв.',\n mm: '%dхв.',\n h: '1г.',\n hh: '%dг.',\n },\n};\n\nconst MS_PER_SECOND = 1000;\nconst MS_PER_MINUTE = MS_PER_SECOND * 60;\nconst MS_PER_HOUR = MS_PER_MINUTE * 60;\nconst MS_PER_DAY = MS_PER_HOUR * 24;\n\nenum TIME_UNIT {\n SECONDS = 'second',\n MINUTES = 'minute',\n HOURS = 'hour',\n DAYS = 'day',\n}\n\nfunction applyShortenedExpression(language: LanguageKey, timeUnit: TIME_UNIT, value: number) {\n const placeholder = '%d';\n const unitToShorthand: Record<TIME_UNIT, keyof ExpressionMap> = {\n [TIME_UNIT.SECONDS]: 'ss',\n [TIME_UNIT.MINUTES]: 'mm',\n [TIME_UNIT.HOURS]: 'hh',\n [TIME_UNIT.DAYS]: 'dd',\n };\n\n const shorthand: keyof ExpressionMap =\n value === -1\n ? (unitToShorthand[timeUnit][0] as keyof ExpressionMap)\n : unitToShorthand[timeUnit];\n const expression = shortExpressions[language] ? shortExpressions[language][shorthand] : null;\n if (expression) {\n return expression.replace(placeholder, `${-value}`);\n }\n\n return null;\n}\n\nfunction getTimeUnit(time: number) {\n const timeAdjusted = time < 0 ? -time : time;\n switch (true) {\n case timeAdjusted < MS_PER_MINUTE:\n return TIME_UNIT.SECONDS;\n case timeAdjusted < MS_PER_HOUR:\n return TIME_UNIT.MINUTES;\n case timeAdjusted < MS_PER_DAY:\n return TIME_UNIT.HOURS;\n default:\n return TIME_UNIT.DAYS;\n }\n}\n\nfunction getRelativeTime(time: number, unit: TIME_UNIT, floorSeconds: boolean) {\n let returnTime;\n switch (unit) {\n case TIME_UNIT.SECONDS:\n if (floorSeconds) {\n returnTime = 1;\n } else {\n returnTime = time / MS_PER_SECOND;\n }\n break;\n case TIME_UNIT.MINUTES:\n returnTime = time / MS_PER_MINUTE;\n break;\n case TIME_UNIT.HOURS:\n returnTime = time / MS_PER_HOUR;\n break;\n case TIME_UNIT.DAYS:\n returnTime = time / MS_PER_DAY;\n break;\n default:\n returnTime = time;\n }\n return -Math.round(returnTime);\n}\n\nfunction isLibAvailable() {\n return typeof Intl.RelativeTimeFormat !== 'undefined';\n}\n\ntype DateTime = string | number | Date;\n\nexport function createRtfFormatter(\n language: string,\n { floorSeconds = false, extraShortExpression = false } = {},\n options = {},\n) {\n let rtf: Intl.RelativeTimeFormat;\n return (time: DateTime) => {\n if (!rtf && isLibAvailable()) {\n rtf = new Intl.RelativeTimeFormat(language, { ...options });\n }\n let timeDiff = new Date().getTime() - new Date(time).getTime();\n if (isNaN(timeDiff)) {\n console.error(\n `[@wix/fed-cli-i18next/relative-time-formatter] received invalid time: ${time}`,\n );\n timeDiff = MS_PER_SECOND;\n }\n const unit = getTimeUnit(timeDiff);\n const relativeTime = getRelativeTime(timeDiff, unit, floorSeconds);\n\n const shortExpression =\n extraShortExpression || !rtf\n ? applyShortenedExpression(language as LanguageKey, unit, relativeTime)\n : null;\n\n if (shortExpression) {\n return shortExpression;\n }\n\n if (rtf) {\n return rtf.format(relativeTime, unit);\n }\n\n return time;\n };\n}\n"],"mappings":"AAkCA,MAAMA,EAAuD,CAC3D,GAAI,CACF,EAAG,KACH,GAAI,MACJ,EAAG,KACH,GAAI,MACJ,EAAG,KACH,GAAI,MACJ,EAAG,KACH,GAAI,KACN,EACA,GAAI,CACF,EAAG,QACH,GAAI,SACJ,EAAG,QACH,GAAI,SACJ,EAAG,MACH,GAAI,MACN,EACA,GAAI,CACF,EAAG,OACH,GAAI,QACJ,EAAG,OACH,GAAI,QACJ,EAAG,OACH,GAAI,OACN,EACA,GAAI,CACF,EAAG,KACH,GAAI,MACJ,EAAG,KACH,GAAI,MACJ,EAAG,KACH,GAAI,KACN,EACA,GAAI,CACF,EAAG,QAC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B,CAACA,GAAOF,EAAe,IACzB,EAAM,IAAI,KAAK,mBAAmBR,EAAU,CAAE,GAAGW,CAAQ,CAAC,GAE5D,IAAIC,mBAAW,IAAI,KAAK,EAAA,CAAE,QAAQ,EAAI,IAAI,KAAKT,CAAI,CAAC,CAAC,QAAQ,EACzD,MAAMS,CAAQ,IAChB,QAAQ,MACN,yEAAyET,GAC3E,EACA,EAAWjB,GAEb,IAAMoB,EAAOL,EAAYW,CAAQ,EAC3BC,EAAeT,EAAgBQ,EAAUN,EAAMC,CAAY,EAejE,OAZEO,GAAwB,CAACJ,EACrBpB,EAAyBU,EAAyBM,EAAMO,CAAY,EACpE,QAMFH,EACKA,EAAI,OAAOG,EAAcP,CAAI,EAG/BH,EACT,CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/fed-cli-i18next",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.42",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"@wix/fed-cli-oxlint": "1.0.0",
|
|
40
40
|
"@wix/fed-cli-rolldown": "1.0.0",
|
|
41
41
|
"oxfmt": "^0.58.0",
|
|
42
|
-
"oxlint": "^1.
|
|
42
|
+
"oxlint": "^1.86.0",
|
|
43
43
|
"react": "^18.3.1",
|
|
44
44
|
"react-dom": "^18.3.1",
|
|
45
|
-
"rolldown": "^1.2.
|
|
45
|
+
"rolldown": "^1.2.11",
|
|
46
46
|
"typescript": "^6.0.3",
|
|
47
|
-
"vite": "^8.3.
|
|
47
|
+
"vite": "^8.3.1",
|
|
48
48
|
"vitest": "^5.0.3"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
]
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
|
-
"falconPackageHash": "
|
|
66
|
+
"falconPackageHash": "bf908b230a4abcdf2d52b53a556d9783258787982cdbd6eb85cf52ff"
|
|
67
67
|
}
|