@intlayer/core 7.5.0-canary.0 → 7.5.0
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.
- package/dist/cjs/deepTransformPlugins/getFilterMissingTranslationsContent.cjs +10 -10
- package/dist/cjs/deepTransformPlugins/getFilterMissingTranslationsContent.cjs.map +1 -1
- package/dist/cjs/deepTransformPlugins/getFilterTranslationsOnlyContent.cjs +11 -11
- package/dist/cjs/deepTransformPlugins/getFilterTranslationsOnlyContent.cjs.map +1 -1
- package/dist/cjs/deepTransformPlugins/getFilteredLocalesContent.cjs +4 -4
- package/dist/cjs/deepTransformPlugins/getFilteredLocalesContent.cjs.map +1 -1
- package/dist/cjs/deepTransformPlugins/getMissingLocalesContent.cjs +7 -7
- package/dist/cjs/deepTransformPlugins/getMissingLocalesContent.cjs.map +1 -1
- package/dist/cjs/deepTransformPlugins/getSplittedContent.cjs +3 -3
- package/dist/cjs/deepTransformPlugins/getSplittedContent.cjs.map +1 -1
- package/dist/cjs/deepTransformPlugins/insertContentInDictionary.cjs +6 -6
- package/dist/cjs/deepTransformPlugins/insertContentInDictionary.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/editDictionaryByKeyPath.cjs +6 -6
- package/dist/cjs/dictionaryManipulator/editDictionaryByKeyPath.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getContentNodeByKeyPath.cjs +5 -5
- package/dist/cjs/dictionaryManipulator/getContentNodeByKeyPath.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getDefaultNode.cjs +27 -27
- package/dist/cjs/dictionaryManipulator/getDefaultNode.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getEmptyNode.cjs +5 -5
- package/dist/cjs/dictionaryManipulator/getEmptyNode.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getNodeChildren.cjs +3 -3
- package/dist/cjs/dictionaryManipulator/getNodeChildren.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getNodeType.cjs +11 -11
- package/dist/cjs/dictionaryManipulator/getNodeType.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/mergeDictionaries.cjs +5 -5
- package/dist/cjs/dictionaryManipulator/mergeDictionaries.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/orderDictionaries.cjs +3 -3
- package/dist/cjs/dictionaryManipulator/orderDictionaries.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/removeContentNodeByKeyPath.cjs +4 -4
- package/dist/cjs/dictionaryManipulator/removeContentNodeByKeyPath.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/renameContentNodeByKeyPath.cjs +4 -4
- package/dist/cjs/dictionaryManipulator/renameContentNodeByKeyPath.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/updateNodeChildren.cjs +3 -3
- package/dist/cjs/dictionaryManipulator/updateNodeChildren.cjs.map +1 -1
- package/dist/cjs/formatters/compact.cjs +3 -3
- package/dist/cjs/formatters/compact.cjs.map +1 -1
- package/dist/cjs/formatters/currency.cjs +3 -3
- package/dist/cjs/formatters/currency.cjs.map +1 -1
- package/dist/cjs/formatters/date.cjs +3 -3
- package/dist/cjs/formatters/date.cjs.map +1 -1
- package/dist/cjs/formatters/list.cjs +3 -3
- package/dist/cjs/formatters/list.cjs.map +1 -1
- package/dist/cjs/formatters/number.cjs +3 -3
- package/dist/cjs/formatters/number.cjs.map +1 -1
- package/dist/cjs/formatters/percentage.cjs +3 -3
- package/dist/cjs/formatters/percentage.cjs.map +1 -1
- package/dist/cjs/formatters/relativeTime.cjs +3 -3
- package/dist/cjs/formatters/relativeTime.cjs.map +1 -1
- package/dist/cjs/formatters/units.cjs +3 -3
- package/dist/cjs/formatters/units.cjs.map +1 -1
- package/dist/cjs/getStorageAttributes.cjs +4 -4
- package/dist/cjs/getStorageAttributes.cjs.map +1 -1
- package/dist/cjs/interpreter/getContent/deepTransform.cjs +3 -3
- package/dist/cjs/interpreter/getContent/deepTransform.cjs.map +1 -1
- package/dist/cjs/interpreter/getContent/getContent.cjs +3 -3
- package/dist/cjs/interpreter/getContent/getContent.cjs.map +1 -1
- package/dist/cjs/interpreter/getContent/plugins.cjs +18 -18
- package/dist/cjs/interpreter/getContent/plugins.cjs.map +1 -1
- package/dist/cjs/interpreter/getIntlayer.cjs +7 -7
- package/dist/cjs/interpreter/getIntlayer.cjs.map +1 -1
- package/dist/cjs/localization/getBrowserLocale.cjs +7 -7
- package/dist/cjs/localization/getBrowserLocale.cjs.map +1 -1
- package/dist/cjs/localization/getHTMLTextDir.cjs +39 -26
- package/dist/cjs/localization/getHTMLTextDir.cjs.map +1 -1
- package/dist/cjs/localization/getLocale.cjs +8 -8
- package/dist/cjs/localization/getLocale.cjs.map +1 -1
- package/dist/cjs/localization/getLocaleFromPath.cjs +5 -5
- package/dist/cjs/localization/getLocaleFromPath.cjs.map +1 -1
- package/dist/cjs/localization/getLocalizedUrl.cjs +6 -6
- package/dist/cjs/localization/getLocalizedUrl.cjs.map +1 -1
- package/dist/cjs/localization/getMultilingualUrls.cjs +6 -6
- package/dist/cjs/localization/getMultilingualUrls.cjs.map +1 -1
- package/dist/cjs/localization/getPathWithoutLocale.cjs +3 -3
- package/dist/cjs/localization/getPathWithoutLocale.cjs.map +1 -1
- package/dist/cjs/localization/getPrefix.cjs +6 -6
- package/dist/cjs/localization/getPrefix.cjs.map +1 -1
- package/dist/cjs/localization/localeMapper.cjs +6 -6
- package/dist/cjs/localization/localeMapper.cjs.map +1 -1
- package/dist/cjs/localization/localeResolver.cjs +3 -3
- package/dist/cjs/localization/localeResolver.cjs.map +1 -1
- package/dist/cjs/localization/validatePrefix.cjs +6 -6
- package/dist/cjs/localization/validatePrefix.cjs.map +1 -1
- package/dist/cjs/messageFormat/ICU.cjs +5 -5
- package/dist/cjs/messageFormat/ICU.cjs.map +1 -1
- package/dist/cjs/messageFormat/i18next.cjs +5 -5
- package/dist/cjs/messageFormat/i18next.cjs.map +1 -1
- package/dist/cjs/messageFormat/verify-icu-format.cjs +65 -0
- package/dist/cjs/messageFormat/verify-icu-format.cjs.map +1 -0
- package/dist/cjs/messageFormat/vue-i18n.cjs +5 -5
- package/dist/cjs/messageFormat/vue-i18n.cjs.map +1 -1
- package/dist/cjs/transpiler/condition/condition.cjs +2 -2
- package/dist/cjs/transpiler/condition/condition.cjs.map +1 -1
- package/dist/cjs/transpiler/enumeration/enumeration.cjs +2 -2
- package/dist/cjs/transpiler/enumeration/enumeration.cjs.map +1 -1
- package/dist/cjs/transpiler/file/file.cjs +7 -7
- package/dist/cjs/transpiler/file/file.cjs.map +1 -1
- package/dist/cjs/transpiler/file/fileBrowser.cjs +1 -1
- package/dist/cjs/transpiler/gender/gender.cjs +2 -2
- package/dist/cjs/transpiler/gender/gender.cjs.map +1 -1
- package/dist/cjs/transpiler/insertion/insertion.cjs +2 -2
- package/dist/cjs/transpiler/insertion/insertion.cjs.map +1 -1
- package/dist/cjs/transpiler/markdown/markdown.cjs +2 -2
- package/dist/cjs/transpiler/markdown/markdown.cjs.map +1 -1
- package/dist/cjs/transpiler/nesting/nesting.cjs +2 -2
- package/dist/cjs/transpiler/nesting/nesting.cjs.map +1 -1
- package/dist/cjs/transpiler/translation/translation.cjs +2 -2
- package/dist/cjs/transpiler/translation/translation.cjs.map +1 -1
- package/dist/cjs/utils/intl.cjs +3 -3
- package/dist/cjs/utils/intl.cjs.map +1 -1
- package/dist/cjs/utils/localeStorage.cjs +5 -5
- package/dist/cjs/utils/localeStorage.cjs.map +1 -1
- package/dist/esm/localization/getHTMLTextDir.mjs +18 -5
- package/dist/esm/localization/getHTMLTextDir.mjs.map +1 -1
- package/dist/esm/messageFormat/ICU.mjs.map +1 -1
- package/dist/esm/messageFormat/verify-icu-format.mjs +65 -0
- package/dist/esm/messageFormat/verify-icu-format.mjs.map +1 -0
- package/dist/esm/utils/intl.mjs +19 -22
- package/dist/esm/utils/intl.mjs.map +1 -1
- package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts +8 -8
- package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts.map +1 -1
- package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts +8 -8
- package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/orderDictionaries.d.ts +2 -2
- package/dist/types/interpreter/getContent/plugins.d.ts.map +1 -1
- package/dist/types/messageFormat/ICU.d.ts.map +1 -1
- package/dist/types/messageFormat/verify-icu-format.d.ts +1 -0
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compact.cjs","names":["CachedIntl","configuration"],"sources":["../../../src/formatters/compact.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\nimport { Intl as CachedIntl } from '../utils/intl';\n\n/**\n * Formats a numeric value using compact notation (e.g., 1K, 1M, 1B)\n * based on locale and formatting options.\n *\n * @example\n * compact({ value: 1200 }); // \"1.2K\"\n *\n * @example\n * compact({ value: \"1000000\", locale: Locales.FRENCH, compactDisplay: \"long\" });\n * // \"1 million\"\n */\nexport const compact = (\n value: string | number,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string =>\n new CachedIntl.NumberFormat(\n options?.locale ?? configuration?.internationalization?.defaultLocale,\n {\n ...options,\n notation: 'compact',\n }\n ).format(Number(value));\n"],"mappings":";;;;;;;;;;;;;;;;;AAeA,MAAa,WACX,OACA,YAEA,IAAIA,8BAAW,aACb,SAAS,UAAUC,
|
|
1
|
+
{"version":3,"file":"compact.cjs","names":["CachedIntl","configuration"],"sources":["../../../src/formatters/compact.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\nimport { Intl as CachedIntl } from '../utils/intl';\n\n/**\n * Formats a numeric value using compact notation (e.g., 1K, 1M, 1B)\n * based on locale and formatting options.\n *\n * @example\n * compact({ value: 1200 }); // \"1.2K\"\n *\n * @example\n * compact({ value: \"1000000\", locale: Locales.FRENCH, compactDisplay: \"long\" });\n * // \"1 million\"\n */\nexport const compact = (\n value: string | number,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string =>\n new CachedIntl.NumberFormat(\n options?.locale ?? configuration?.internationalization?.defaultLocale,\n {\n ...options,\n notation: 'compact',\n }\n ).format(Number(value));\n"],"mappings":";;;;;;;;;;;;;;;;;AAeA,MAAa,WACX,OACA,YAEA,IAAIA,8BAAW,aACb,SAAS,UAAUC,gCAAe,sBAAsB,eACxD;CACE,GAAG;CACH,UAAU;CACX,CACF,CAAC,OAAO,OAAO,MAAM,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_utils_intl = require('../utils/intl.cjs');
|
|
3
|
-
let
|
|
4
|
-
|
|
3
|
+
let _intlayer_config_built = require("@intlayer/config/built");
|
|
4
|
+
_intlayer_config_built = require_rolldown_runtime.__toESM(_intlayer_config_built);
|
|
5
5
|
|
|
6
6
|
//#region src/formatters/currency.ts
|
|
7
7
|
/**
|
|
@@ -15,7 +15,7 @@ __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_bui
|
|
|
15
15
|
* currency({ value: "5000", locale: Locales.FRENCH, currency: "CAD", currencyDisplay: "code" });
|
|
16
16
|
* // "5 000,00 CAD"
|
|
17
17
|
*/
|
|
18
|
-
const currency = (value, options) => new require_utils_intl.CachedIntl.NumberFormat(options?.locale ??
|
|
18
|
+
const currency = (value, options) => new require_utils_intl.CachedIntl.NumberFormat(options?.locale ?? _intlayer_config_built.default?.internationalization?.defaultLocale, {
|
|
19
19
|
style: "currency",
|
|
20
20
|
currency: options?.currency ?? "USD",
|
|
21
21
|
currencyDisplay: options?.currencyDisplay ?? "symbol",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"currency.cjs","names":["CachedIntl","configuration"],"sources":["../../../src/formatters/currency.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\nimport { Intl as CachedIntl } from '../utils/intl';\n\n/**\n * Formats a numeric or string value into a localized currency string using the Intl API.\n *\n * @example\n * currency({ value: 1234.5, currency: 'EUR' });\n * // \"€1,234.50\"\n *\n * @example\n * currency({ value: \"5000\", locale: Locales.FRENCH, currency: \"CAD\", currencyDisplay: \"code\" });\n * // \"5 000,00 CAD\"\n */\nexport const currency = (\n value: string | number,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string =>\n new CachedIntl.NumberFormat(\n options?.locale ?? configuration?.internationalization?.defaultLocale,\n {\n style: 'currency',\n currency: options?.currency ?? 'USD',\n currencyDisplay: options?.currencyDisplay ?? 'symbol',\n minimumFractionDigits: options?.minimumFractionDigits ?? 2,\n maximumFractionDigits: options?.maximumFractionDigits ?? 2,\n ...options,\n }\n ).format(Number(value));\n"],"mappings":";;;;;;;;;;;;;;;;;AAeA,MAAa,YACX,OACA,YAEA,IAAIA,8BAAW,aACb,SAAS,UAAUC,
|
|
1
|
+
{"version":3,"file":"currency.cjs","names":["CachedIntl","configuration"],"sources":["../../../src/formatters/currency.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\nimport { Intl as CachedIntl } from '../utils/intl';\n\n/**\n * Formats a numeric or string value into a localized currency string using the Intl API.\n *\n * @example\n * currency({ value: 1234.5, currency: 'EUR' });\n * // \"€1,234.50\"\n *\n * @example\n * currency({ value: \"5000\", locale: Locales.FRENCH, currency: \"CAD\", currencyDisplay: \"code\" });\n * // \"5 000,00 CAD\"\n */\nexport const currency = (\n value: string | number,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string =>\n new CachedIntl.NumberFormat(\n options?.locale ?? configuration?.internationalization?.defaultLocale,\n {\n style: 'currency',\n currency: options?.currency ?? 'USD',\n currencyDisplay: options?.currencyDisplay ?? 'symbol',\n minimumFractionDigits: options?.minimumFractionDigits ?? 2,\n maximumFractionDigits: options?.maximumFractionDigits ?? 2,\n ...options,\n }\n ).format(Number(value));\n"],"mappings":";;;;;;;;;;;;;;;;;AAeA,MAAa,YACX,OACA,YAEA,IAAIA,8BAAW,aACb,SAAS,UAAUC,gCAAe,sBAAsB,eACxD;CACE,OAAO;CACP,UAAU,SAAS,YAAY;CAC/B,iBAAiB,SAAS,mBAAmB;CAC7C,uBAAuB,SAAS,yBAAyB;CACzD,uBAAuB,SAAS,yBAAyB;CACzD,GAAG;CACJ,CACF,CAAC,OAAO,OAAO,MAAM,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_utils_intl = require('../utils/intl.cjs');
|
|
3
|
-
let
|
|
4
|
-
|
|
3
|
+
let _intlayer_config_built = require("@intlayer/config/built");
|
|
4
|
+
_intlayer_config_built = require_rolldown_runtime.__toESM(_intlayer_config_built);
|
|
5
5
|
|
|
6
6
|
//#region src/formatters/date.ts
|
|
7
7
|
const presets = {
|
|
@@ -52,7 +52,7 @@ const presets = {
|
|
|
52
52
|
const date = (date$1, options) => {
|
|
53
53
|
const dateTime = new Date(date$1);
|
|
54
54
|
const resolvedOptions = typeof options === "string" ? presets[options] ?? {} : options;
|
|
55
|
-
return new require_utils_intl.CachedIntl.DateTimeFormat(options?.locale ??
|
|
55
|
+
return new require_utils_intl.CachedIntl.DateTimeFormat(options?.locale ?? _intlayer_config_built.default?.internationalization?.defaultLocale, resolvedOptions).format(dateTime);
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.cjs","names":["presets: Record<DateTimePreset, Intl.DateTimeFormatOptions>","date","CachedIntl","configuration"],"sources":["../../../src/formatters/date.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\nimport { Intl as CachedIntl } from '../utils/intl';\n\ntype DateTimePreset = 'short' | 'long' | 'dateOnly' | 'timeOnly' | 'full';\n\nconst presets: Record<DateTimePreset, Intl.DateTimeFormatOptions> = {\n short: {\n year: '2-digit',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n },\n long: {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n },\n full: {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n hour12: false,\n },\n dateOnly: {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n },\n timeOnly: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n },\n};\n\n/**\n * Formats a date/time value into a localized string using Intl.DateTimeFormat.\n *\n * @example\n * date({ date: new Date(), options: \"short\" });\n * // \"08/02/25, 14:30\"\n *\n * @example\n * date({ date: \"2025-08-02T14:30:00Z\", locale: Locales.FRENCH, options: { month: \"long\", day: \"numeric\" } });\n * // \"2 août\"\n */\nexport const date = (\n date: Date | string | number,\n options?: Intl.DateTimeFormatOptions & { locale?: LocalesValues }\n): string => {\n const dateTime = new Date(date);\n\n const resolvedOptions =\n typeof options === 'string' ? (presets[options] ?? {}) : options;\n\n const formatter = new CachedIntl.DateTimeFormat(\n options?.locale ?? configuration?.internationalization?.defaultLocale,\n resolvedOptions\n );\n\n return formatter.format(dateTime);\n};\n"],"mappings":";;;;;;AAMA,MAAMA,UAA8D;CAClE,OAAO;EACL,MAAM;EACN,OAAO;EACP,KAAK;EACL,MAAM;EACN,QAAQ;EACT;CACD,MAAM;EACJ,MAAM;EACN,OAAO;EACP,KAAK;EACL,MAAM;EACN,QAAQ;EACT;CACD,MAAM;EACJ,MAAM;EACN,OAAO;EACP,KAAK;EACL,MAAM;EACN,QAAQ;EACR,QAAQ;EACT;CACD,UAAU;EACR,MAAM;EACN,OAAO;EACP,KAAK;EACN;CACD,UAAU;EACR,MAAM;EACN,QAAQ;EACR,QAAQ;EACT;CACF;;;;;;;;;;;;AAaD,MAAa,QACX,QACA,YACW;CACX,MAAM,WAAW,IAAI,KAAKC,OAAK;CAE/B,MAAM,kBACJ,OAAO,YAAY,WAAY,QAAQ,YAAY,EAAE,GAAI;AAO3D,QALkB,IAAIC,8BAAW,eAC/B,SAAS,UAAUC,
|
|
1
|
+
{"version":3,"file":"date.cjs","names":["presets: Record<DateTimePreset, Intl.DateTimeFormatOptions>","date","CachedIntl","configuration"],"sources":["../../../src/formatters/date.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\nimport { Intl as CachedIntl } from '../utils/intl';\n\ntype DateTimePreset = 'short' | 'long' | 'dateOnly' | 'timeOnly' | 'full';\n\nconst presets: Record<DateTimePreset, Intl.DateTimeFormatOptions> = {\n short: {\n year: '2-digit',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n },\n long: {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n },\n full: {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n hour12: false,\n },\n dateOnly: {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n },\n timeOnly: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n },\n};\n\n/**\n * Formats a date/time value into a localized string using Intl.DateTimeFormat.\n *\n * @example\n * date({ date: new Date(), options: \"short\" });\n * // \"08/02/25, 14:30\"\n *\n * @example\n * date({ date: \"2025-08-02T14:30:00Z\", locale: Locales.FRENCH, options: { month: \"long\", day: \"numeric\" } });\n * // \"2 août\"\n */\nexport const date = (\n date: Date | string | number,\n options?: Intl.DateTimeFormatOptions & { locale?: LocalesValues }\n): string => {\n const dateTime = new Date(date);\n\n const resolvedOptions =\n typeof options === 'string' ? (presets[options] ?? {}) : options;\n\n const formatter = new CachedIntl.DateTimeFormat(\n options?.locale ?? configuration?.internationalization?.defaultLocale,\n resolvedOptions\n );\n\n return formatter.format(dateTime);\n};\n"],"mappings":";;;;;;AAMA,MAAMA,UAA8D;CAClE,OAAO;EACL,MAAM;EACN,OAAO;EACP,KAAK;EACL,MAAM;EACN,QAAQ;EACT;CACD,MAAM;EACJ,MAAM;EACN,OAAO;EACP,KAAK;EACL,MAAM;EACN,QAAQ;EACT;CACD,MAAM;EACJ,MAAM;EACN,OAAO;EACP,KAAK;EACL,MAAM;EACN,QAAQ;EACR,QAAQ;EACT;CACD,UAAU;EACR,MAAM;EACN,OAAO;EACP,KAAK;EACN;CACD,UAAU;EACR,MAAM;EACN,QAAQ;EACR,QAAQ;EACT;CACF;;;;;;;;;;;;AAaD,MAAa,QACX,QACA,YACW;CACX,MAAM,WAAW,IAAI,KAAKC,OAAK;CAE/B,MAAM,kBACJ,OAAO,YAAY,WAAY,QAAQ,YAAY,EAAE,GAAI;AAO3D,QALkB,IAAIC,8BAAW,eAC/B,SAAS,UAAUC,gCAAe,sBAAsB,eACxD,gBACD,CAEgB,OAAO,SAAS"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_utils_intl = require('../utils/intl.cjs');
|
|
3
|
-
let
|
|
4
|
-
|
|
3
|
+
let _intlayer_config_built = require("@intlayer/config/built");
|
|
4
|
+
_intlayer_config_built = require_rolldown_runtime.__toESM(_intlayer_config_built);
|
|
5
5
|
|
|
6
6
|
//#region src/formatters/list.ts
|
|
7
7
|
/**
|
|
@@ -19,7 +19,7 @@ __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_bui
|
|
|
19
19
|
* list([1, 2, 3], { type: 'unit' });
|
|
20
20
|
* // "1, 2, 3"
|
|
21
21
|
*/
|
|
22
|
-
const list = (values, options) => new require_utils_intl.CachedIntl.ListFormat(options?.locale ??
|
|
22
|
+
const list = (values, options) => new require_utils_intl.CachedIntl.ListFormat(options?.locale ?? _intlayer_config_built.default?.internationalization?.defaultLocale, {
|
|
23
23
|
type: options?.type ?? "conjunction",
|
|
24
24
|
style: options?.style ?? "long",
|
|
25
25
|
...options
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.cjs","names":["CachedIntl","configuration"],"sources":["../../../src/formatters/list.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\nimport { Intl as CachedIntl } from '../utils/intl';\n\n/**\n * Formats an array of values into a localized list string using the Intl API.\n *\n * @example\n * list(['apple', 'banana', 'orange']);\n * // \"apple, banana, and orange\"\n *\n * @example\n * list(['red', 'green', 'blue'], { locale: Locales.FRENCH, type: 'disjunction' });\n * // \"rouge, vert ou bleu\"\n *\n * @example\n * list([1, 2, 3], { type: 'unit' });\n * // \"1, 2, 3\"\n */\nexport const list = (\n values: (string | number)[],\n // @ts-ignore Namespace 'Intl' has no exported member 'ListFormatOptions'\n options?: Intl.ListFormatOptions & { locale?: LocalesValues }\n): string =>\n new CachedIntl.ListFormat(\n options?.locale ?? configuration?.internationalization?.defaultLocale,\n {\n type: options?.type ?? 'conjunction',\n style: options?.style ?? 'long',\n ...options,\n }\n ).format(values.map(String));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmBA,MAAa,QACX,QAEA,YAEA,IAAIA,8BAAW,WACb,SAAS,UAAUC,
|
|
1
|
+
{"version":3,"file":"list.cjs","names":["CachedIntl","configuration"],"sources":["../../../src/formatters/list.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\nimport { Intl as CachedIntl } from '../utils/intl';\n\n/**\n * Formats an array of values into a localized list string using the Intl API.\n *\n * @example\n * list(['apple', 'banana', 'orange']);\n * // \"apple, banana, and orange\"\n *\n * @example\n * list(['red', 'green', 'blue'], { locale: Locales.FRENCH, type: 'disjunction' });\n * // \"rouge, vert ou bleu\"\n *\n * @example\n * list([1, 2, 3], { type: 'unit' });\n * // \"1, 2, 3\"\n */\nexport const list = (\n values: (string | number)[],\n // @ts-ignore Namespace 'Intl' has no exported member 'ListFormatOptions'\n options?: Intl.ListFormatOptions & { locale?: LocalesValues }\n): string =>\n new CachedIntl.ListFormat(\n options?.locale ?? configuration?.internationalization?.defaultLocale,\n {\n type: options?.type ?? 'conjunction',\n style: options?.style ?? 'long',\n ...options,\n }\n ).format(values.map(String));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmBA,MAAa,QACX,QAEA,YAEA,IAAIA,8BAAW,WACb,SAAS,UAAUC,gCAAe,sBAAsB,eACxD;CACE,MAAM,SAAS,QAAQ;CACvB,OAAO,SAAS,SAAS;CACzB,GAAG;CACJ,CACF,CAAC,OAAO,OAAO,IAAI,OAAO,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_utils_intl = require('../utils/intl.cjs');
|
|
3
|
-
let
|
|
4
|
-
|
|
3
|
+
let _intlayer_config_built = require("@intlayer/config/built");
|
|
4
|
+
_intlayer_config_built = require_rolldown_runtime.__toESM(_intlayer_config_built);
|
|
5
5
|
|
|
6
6
|
//#region src/formatters/number.ts
|
|
7
7
|
/**
|
|
@@ -11,7 +11,7 @@ __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_bui
|
|
|
11
11
|
* number({ value: 123456.789 }); // "123,456.789"
|
|
12
12
|
* number({ value: "1000000", locale: Locales.FRENCH }); // "1 000 000"
|
|
13
13
|
*/
|
|
14
|
-
const number = (value, options) => new require_utils_intl.CachedIntl.NumberFormat(options?.locale ??
|
|
14
|
+
const number = (value, options) => new require_utils_intl.CachedIntl.NumberFormat(options?.locale ?? _intlayer_config_built.default?.internationalization?.defaultLocale, options).format(Number(value));
|
|
15
15
|
|
|
16
16
|
//#endregion
|
|
17
17
|
exports.number = number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number.cjs","names":["CachedIntl","configuration"],"sources":["../../../src/formatters/number.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\nimport { Intl as CachedIntl } from '../utils/intl';\n\n/**\n * Formats a numeric value using locale-aware formatting.\n *\n * @example\n * number({ value: 123456.789 }); // \"123,456.789\"\n * number({ value: \"1000000\", locale: Locales.FRENCH }); // \"1 000 000\"\n */\nexport const number = (\n value: string | number,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string =>\n new CachedIntl.NumberFormat(\n options?.locale ?? configuration?.internationalization?.defaultLocale,\n options\n ).format(Number(value));\n"],"mappings":";;;;;;;;;;;;;AAWA,MAAa,UACX,OACA,YAEA,IAAIA,8BAAW,aACb,SAAS,UAAUC,
|
|
1
|
+
{"version":3,"file":"number.cjs","names":["CachedIntl","configuration"],"sources":["../../../src/formatters/number.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\nimport { Intl as CachedIntl } from '../utils/intl';\n\n/**\n * Formats a numeric value using locale-aware formatting.\n *\n * @example\n * number({ value: 123456.789 }); // \"123,456.789\"\n * number({ value: \"1000000\", locale: Locales.FRENCH }); // \"1 000 000\"\n */\nexport const number = (\n value: string | number,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string =>\n new CachedIntl.NumberFormat(\n options?.locale ?? configuration?.internationalization?.defaultLocale,\n options\n ).format(Number(value));\n"],"mappings":";;;;;;;;;;;;;AAWA,MAAa,UACX,OACA,YAEA,IAAIA,8BAAW,aACb,SAAS,UAAUC,gCAAe,sBAAsB,eACxD,QACD,CAAC,OAAO,OAAO,MAAM,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_utils_intl = require('../utils/intl.cjs');
|
|
3
|
-
let
|
|
4
|
-
|
|
3
|
+
let _intlayer_config_built = require("@intlayer/config/built");
|
|
4
|
+
_intlayer_config_built = require_rolldown_runtime.__toESM(_intlayer_config_built);
|
|
5
5
|
|
|
6
6
|
//#region src/formatters/percentage.ts
|
|
7
7
|
/**
|
|
@@ -14,7 +14,7 @@ __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_bui
|
|
|
14
14
|
const percentage = (value, options) => {
|
|
15
15
|
let numericValue = Number(value);
|
|
16
16
|
if (numericValue > 1) numericValue /= 100;
|
|
17
|
-
return new require_utils_intl.CachedIntl.NumberFormat(options?.locale ??
|
|
17
|
+
return new require_utils_intl.CachedIntl.NumberFormat(options?.locale ?? _intlayer_config_built.default?.internationalization?.defaultLocale, {
|
|
18
18
|
style: "percent",
|
|
19
19
|
...options
|
|
20
20
|
}).format(Number(numericValue));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"percentage.cjs","names":["CachedIntl","configuration"],"sources":["../../../src/formatters/percentage.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\nimport { Intl as CachedIntl } from '../utils/intl';\n\n/**\n * Formats a number as a percentage string (e.g., 0.25 → \"25%\").\n *\n * @example\n * percentage({ value: 0.25 }) // \"25%\"\n * percentage({ value: 0.25, minimumFractionDigits: 2 }) // \"25.00%\"\n */\nexport const percentage = (\n value: string | number,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string => {\n let numericValue = Number(value);\n\n // Normalize: if user passes 10, treat it as 10% instead of 1000%\n if (numericValue > 1) {\n numericValue /= 100;\n }\n\n const formatter = new CachedIntl.NumberFormat(\n options?.locale ?? configuration?.internationalization?.defaultLocale,\n {\n style: 'percent',\n ...options,\n }\n );\n\n return formatter.format(Number(numericValue));\n};\n"],"mappings":";;;;;;;;;;;;;AAWA,MAAa,cACX,OACA,YACW;CACX,IAAI,eAAe,OAAO,MAAM;AAGhC,KAAI,eAAe,EACjB,iBAAgB;AAWlB,QARkB,IAAIA,8BAAW,aAC/B,SAAS,UAAUC,
|
|
1
|
+
{"version":3,"file":"percentage.cjs","names":["CachedIntl","configuration"],"sources":["../../../src/formatters/percentage.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\nimport { Intl as CachedIntl } from '../utils/intl';\n\n/**\n * Formats a number as a percentage string (e.g., 0.25 → \"25%\").\n *\n * @example\n * percentage({ value: 0.25 }) // \"25%\"\n * percentage({ value: 0.25, minimumFractionDigits: 2 }) // \"25.00%\"\n */\nexport const percentage = (\n value: string | number,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string => {\n let numericValue = Number(value);\n\n // Normalize: if user passes 10, treat it as 10% instead of 1000%\n if (numericValue > 1) {\n numericValue /= 100;\n }\n\n const formatter = new CachedIntl.NumberFormat(\n options?.locale ?? configuration?.internationalization?.defaultLocale,\n {\n style: 'percent',\n ...options,\n }\n );\n\n return formatter.format(Number(numericValue));\n};\n"],"mappings":";;;;;;;;;;;;;AAWA,MAAa,cACX,OACA,YACW;CACX,IAAI,eAAe,OAAO,MAAM;AAGhC,KAAI,eAAe,EACjB,iBAAgB;AAWlB,QARkB,IAAIA,8BAAW,aAC/B,SAAS,UAAUC,gCAAe,sBAAsB,eACxD;EACE,OAAO;EACP,GAAG;EACJ,CACF,CAEgB,OAAO,OAAO,aAAa,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_utils_intl = require('../utils/intl.cjs');
|
|
3
|
-
let
|
|
4
|
-
|
|
3
|
+
let _intlayer_config_built = require("@intlayer/config/built");
|
|
4
|
+
_intlayer_config_built = require_rolldown_runtime.__toESM(_intlayer_config_built);
|
|
5
5
|
|
|
6
6
|
//#region src/formatters/relativeTime.ts
|
|
7
7
|
/**
|
|
@@ -25,7 +25,7 @@ const relativeTime = (from, to = /* @__PURE__ */ new Date(), options) => {
|
|
|
25
25
|
const toDate = new Date(to);
|
|
26
26
|
const unit = options?.unit ?? "second";
|
|
27
27
|
const value = diffInUnit(fromDate, toDate, unit);
|
|
28
|
-
return new require_utils_intl.CachedIntl.RelativeTimeFormat(options?.locale ??
|
|
28
|
+
return new require_utils_intl.CachedIntl.RelativeTimeFormat(options?.locale ?? _intlayer_config_built.default?.internationalization?.defaultLocale, options).format(Math.round(value), unit);
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relativeTime.cjs","names":["CachedIntl","configuration"],"sources":["../../../src/formatters/relativeTime.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\nimport { Intl as CachedIntl } from '../utils/intl';\n\ntype RelativeTimeUnit = Intl.RelativeTimeFormatUnit;\n\n/**\n * Calculate the difference between 2 dates in the given unit.\n */\nconst diffInUnit = (from: Date, to: Date, unit: RelativeTimeUnit): number => {\n const msDiff = to.getTime() - from.getTime();\n const sec = msDiff / 1000;\n\n switch (unit) {\n case 'second':\n return sec;\n case 'minute':\n return sec / 60;\n case 'hour':\n return sec / 3600;\n case 'day':\n return sec / 86400;\n case 'month':\n return sec / (30 * 86400); // approx\n case 'quarter':\n return sec / (3 * 30 * 86400); // 3 months approx\n case 'year':\n return sec / (365 * 86400); // approx\n default:\n return sec;\n }\n};\n\nexport const relativeTime = (\n from: Date | string | number,\n to: Date | string | number = new Date(),\n options?: Intl.RelativeTimeFormatOptions & {\n locale?: LocalesValues;\n unit?: RelativeTimeUnit;\n }\n): string => {\n const fromDate = new Date(from);\n const toDate = new Date(to);\n const unit = options?.unit ?? 'second';\n\n const value = diffInUnit(fromDate, toDate, unit);\n\n return new CachedIntl.RelativeTimeFormat(\n options?.locale ?? configuration?.internationalization?.defaultLocale,\n options\n ).format(Math.round(value), unit);\n};\n"],"mappings":";;;;;;;;;AASA,MAAM,cAAc,MAAY,IAAU,SAAmC;CAE3E,MAAM,OADS,GAAG,SAAS,GAAG,KAAK,SAAS,IACvB;AAErB,SAAQ,MAAR;EACE,KAAK,SACH,QAAO;EACT,KAAK,SACH,QAAO,MAAM;EACf,KAAK,OACH,QAAO,MAAM;EACf,KAAK,MACH,QAAO,MAAM;EACf,KAAK,QACH,QAAO,OAAO,KAAK;EACrB,KAAK,UACH,QAAO,OAAO,KAAS;EACzB,KAAK,OACH,QAAO,OAAO,MAAM;EACtB,QACE,QAAO;;;AAIb,MAAa,gBACX,MACA,qBAA6B,IAAI,MAAM,EACvC,YAIW;CACX,MAAM,WAAW,IAAI,KAAK,KAAK;CAC/B,MAAM,SAAS,IAAI,KAAK,GAAG;CAC3B,MAAM,OAAO,SAAS,QAAQ;CAE9B,MAAM,QAAQ,WAAW,UAAU,QAAQ,KAAK;AAEhD,QAAO,IAAIA,8BAAW,mBACpB,SAAS,UAAUC,
|
|
1
|
+
{"version":3,"file":"relativeTime.cjs","names":["CachedIntl","configuration"],"sources":["../../../src/formatters/relativeTime.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\nimport { Intl as CachedIntl } from '../utils/intl';\n\ntype RelativeTimeUnit = Intl.RelativeTimeFormatUnit;\n\n/**\n * Calculate the difference between 2 dates in the given unit.\n */\nconst diffInUnit = (from: Date, to: Date, unit: RelativeTimeUnit): number => {\n const msDiff = to.getTime() - from.getTime();\n const sec = msDiff / 1000;\n\n switch (unit) {\n case 'second':\n return sec;\n case 'minute':\n return sec / 60;\n case 'hour':\n return sec / 3600;\n case 'day':\n return sec / 86400;\n case 'month':\n return sec / (30 * 86400); // approx\n case 'quarter':\n return sec / (3 * 30 * 86400); // 3 months approx\n case 'year':\n return sec / (365 * 86400); // approx\n default:\n return sec;\n }\n};\n\nexport const relativeTime = (\n from: Date | string | number,\n to: Date | string | number = new Date(),\n options?: Intl.RelativeTimeFormatOptions & {\n locale?: LocalesValues;\n unit?: RelativeTimeUnit;\n }\n): string => {\n const fromDate = new Date(from);\n const toDate = new Date(to);\n const unit = options?.unit ?? 'second';\n\n const value = diffInUnit(fromDate, toDate, unit);\n\n return new CachedIntl.RelativeTimeFormat(\n options?.locale ?? configuration?.internationalization?.defaultLocale,\n options\n ).format(Math.round(value), unit);\n};\n"],"mappings":";;;;;;;;;AASA,MAAM,cAAc,MAAY,IAAU,SAAmC;CAE3E,MAAM,OADS,GAAG,SAAS,GAAG,KAAK,SAAS,IACvB;AAErB,SAAQ,MAAR;EACE,KAAK,SACH,QAAO;EACT,KAAK,SACH,QAAO,MAAM;EACf,KAAK,OACH,QAAO,MAAM;EACf,KAAK,MACH,QAAO,MAAM;EACf,KAAK,QACH,QAAO,OAAO,KAAK;EACrB,KAAK,UACH,QAAO,OAAO,KAAS;EACzB,KAAK,OACH,QAAO,OAAO,MAAM;EACtB,QACE,QAAO;;;AAIb,MAAa,gBACX,MACA,qBAA6B,IAAI,MAAM,EACvC,YAIW;CACX,MAAM,WAAW,IAAI,KAAK,KAAK;CAC/B,MAAM,SAAS,IAAI,KAAK,GAAG;CAC3B,MAAM,OAAO,SAAS,QAAQ;CAE9B,MAAM,QAAQ,WAAW,UAAU,QAAQ,KAAK;AAEhD,QAAO,IAAIA,8BAAW,mBACpB,SAAS,UAAUC,gCAAe,sBAAsB,eACxD,QACD,CAAC,OAAO,KAAK,MAAM,MAAM,EAAE,KAAK"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_utils_intl = require('../utils/intl.cjs');
|
|
3
|
-
let
|
|
4
|
-
|
|
3
|
+
let _intlayer_config_built = require("@intlayer/config/built");
|
|
4
|
+
_intlayer_config_built = require_rolldown_runtime.__toESM(_intlayer_config_built);
|
|
5
5
|
|
|
6
6
|
//#region src/formatters/units.ts
|
|
7
7
|
/**
|
|
@@ -11,7 +11,7 @@ __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_bui
|
|
|
11
11
|
* units({ value: 5, unit: "kilometer", unitDisplay: "long", locale: "en-GB" })
|
|
12
12
|
* // "5 kilometers"
|
|
13
13
|
*/
|
|
14
|
-
const units = (value, options) => new require_utils_intl.CachedIntl.NumberFormat(options?.locale ??
|
|
14
|
+
const units = (value, options) => new require_utils_intl.CachedIntl.NumberFormat(options?.locale ?? _intlayer_config_built.default?.internationalization?.defaultLocale, {
|
|
15
15
|
style: "unit",
|
|
16
16
|
unit: options?.unit ?? "day",
|
|
17
17
|
unitDisplay: options?.unitDisplay ?? "short",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"units.cjs","names":["CachedIntl","configuration"],"sources":["../../../src/formatters/units.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\nimport { Intl as CachedIntl } from '../utils/intl';\n\n/**\n * Formats a numeric value as a localized unit string.\n *\n * @example\n * units({ value: 5, unit: \"kilometer\", unitDisplay: \"long\", locale: \"en-GB\" })\n * // \"5 kilometers\"\n */\nexport const units = (\n value: number | string,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string =>\n new CachedIntl.NumberFormat(\n options?.locale ?? configuration?.internationalization?.defaultLocale,\n {\n style: 'unit',\n unit: options?.unit ?? 'day',\n unitDisplay: options?.unitDisplay ?? 'short',\n useGrouping: options?.useGrouping ?? false,\n }\n ).format(Number(value));\n"],"mappings":";;;;;;;;;;;;;AAWA,MAAa,SACX,OACA,YAEA,IAAIA,8BAAW,aACb,SAAS,UAAUC,
|
|
1
|
+
{"version":3,"file":"units.cjs","names":["CachedIntl","configuration"],"sources":["../../../src/formatters/units.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\nimport { Intl as CachedIntl } from '../utils/intl';\n\n/**\n * Formats a numeric value as a localized unit string.\n *\n * @example\n * units({ value: 5, unit: \"kilometer\", unitDisplay: \"long\", locale: \"en-GB\" })\n * // \"5 kilometers\"\n */\nexport const units = (\n value: number | string,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string =>\n new CachedIntl.NumberFormat(\n options?.locale ?? configuration?.internationalization?.defaultLocale,\n {\n style: 'unit',\n unit: options?.unit ?? 'day',\n unitDisplay: options?.unitDisplay ?? 'short',\n useGrouping: options?.useGrouping ?? false,\n }\n ).format(Number(value));\n"],"mappings":";;;;;;;;;;;;;AAWA,MAAa,SACX,OACA,YAEA,IAAIA,8BAAW,aACb,SAAS,UAAUC,gCAAe,sBAAsB,eACxD;CACE,OAAO;CACP,MAAM,SAAS,QAAQ;CACvB,aAAa,SAAS,eAAe;CACrC,aAAa,SAAS,eAAe;CACtC,CACF,CAAC,OAAO,OAAO,MAAM,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let
|
|
2
|
+
let _intlayer_config_client = require("@intlayer/config/client");
|
|
3
3
|
|
|
4
4
|
//#region src/getStorageAttributes.ts
|
|
5
5
|
/**
|
|
@@ -8,7 +8,7 @@ let __intlayer_config_client = require("@intlayer/config/client");
|
|
|
8
8
|
const createCookieEntry = (options) => {
|
|
9
9
|
const { name, path, expires, domain, secure, sameSite, httpOnly } = options ?? {};
|
|
10
10
|
return {
|
|
11
|
-
name: name ??
|
|
11
|
+
name: name ?? _intlayer_config_client.DefaultValues.Routing.COOKIE_NAME,
|
|
12
12
|
attributes: {
|
|
13
13
|
path,
|
|
14
14
|
expires,
|
|
@@ -24,14 +24,14 @@ const createCookieEntry = (options) => {
|
|
|
24
24
|
*/
|
|
25
25
|
const createWebStorageEntry = (options) => {
|
|
26
26
|
const { name } = options ?? {};
|
|
27
|
-
return { name: name ??
|
|
27
|
+
return { name: name ?? _intlayer_config_client.DefaultValues.Routing.LOCALE_STORAGE_NAME };
|
|
28
28
|
};
|
|
29
29
|
/**
|
|
30
30
|
* Creates a header entry with default name
|
|
31
31
|
*/
|
|
32
32
|
const createHeaderEntry = (options) => {
|
|
33
33
|
const { name } = options ?? {};
|
|
34
|
-
return { name: name ??
|
|
34
|
+
return { name: name ?? _intlayer_config_client.DefaultValues.Routing.HEADER_NAME };
|
|
35
35
|
};
|
|
36
36
|
/**
|
|
37
37
|
* Determines if a storage entry is a cookie based on its properties
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getStorageAttributes.cjs","names":["DefaultValues","rest","emptyResult: ProcessedStorageAttributes"],"sources":["../../src/getStorageAttributes.ts"],"sourcesContent":["import { DefaultValues } from '@intlayer/config/client';\nimport type {\n CookiesAttributes,\n IntlayerConfig,\n StorageAttributes,\n} from '@intlayer/types';\n\n// ============================================================================\n// Types\n// ============================================================================\n\ntype CookieEntry = {\n name: string;\n attributes: Omit<CookiesAttributes, 'type' | 'name'>;\n};\n\ntype WebStorageEntry = {\n name: string;\n};\n\ntype HeaderEntry = {\n name: string;\n};\n\nexport type ProcessedStorageAttributes = {\n cookies: CookieEntry[];\n localStorage: WebStorageEntry[];\n sessionStorage: WebStorageEntry[];\n headers: HeaderEntry[];\n};\n\ntype StorageEntry =\n | 'cookie'\n | 'localStorage'\n | 'sessionStorage'\n | 'header'\n | CookiesAttributes\n | StorageAttributes;\n\n// ============================================================================\n// Helper Functions\n// ============================================================================\n\n/**\n * Creates a cookie entry with default values for missing attributes\n */\nconst createCookieEntry = (\n options?: Partial<CookiesAttributes>\n): CookieEntry => {\n const { name, path, expires, domain, secure, sameSite, httpOnly } =\n options ?? {};\n\n return {\n name: name ?? DefaultValues.Routing.COOKIE_NAME,\n attributes: {\n path,\n expires,\n domain,\n secure,\n sameSite,\n httpOnly,\n },\n };\n};\n\n/**\n * Creates a web storage entry (localStorage or sessionStorage) with default name\n */\nconst createWebStorageEntry = (\n options?: Partial<StorageAttributes>\n): WebStorageEntry => {\n const { name } = options ?? {};\n\n return {\n name: name ?? DefaultValues.Routing.LOCALE_STORAGE_NAME,\n };\n};\n\n/**\n * Creates a header entry with default name\n */\nconst createHeaderEntry = (\n options?: Partial<StorageAttributes>\n): HeaderEntry => {\n const { name } = options ?? {};\n\n return {\n name: name ?? DefaultValues.Routing.HEADER_NAME,\n };\n};\n\n/**\n * Determines if a storage entry is a cookie based on its properties\n */\nconst isCookieEntry = (entry: any): boolean => {\n return (\n entry.type === 'cookie' ||\n 'sameSite' in entry ||\n 'httpOnly' in entry ||\n 'secure' in entry\n );\n};\n\n/**\n * Determines the storage type from a string literal\n */\nconst isStorageType = (\n value: string\n): value is 'cookie' | 'localStorage' | 'sessionStorage' | 'header' => {\n return (\n value === 'cookie' ||\n value === 'localStorage' ||\n value === 'sessionStorage' ||\n value === 'header'\n );\n};\n\n// ============================================================================\n// Main Function\n// ============================================================================\n\n/**\n * Processes a single storage entry and returns the appropriate storage attributes\n */\nconst processStorageEntry = (\n entry: StorageEntry\n): Partial<ProcessedStorageAttributes> => {\n // Handle string literals\n if (typeof entry === 'string') {\n if (!isStorageType(entry)) {\n return { cookies: [], localStorage: [], sessionStorage: [], headers: [] };\n }\n\n if (entry === 'cookie') {\n return { cookies: [createCookieEntry()] };\n }\n\n if (entry === 'localStorage') {\n return { localStorage: [createWebStorageEntry()] };\n }\n\n if (entry === 'sessionStorage') {\n return { sessionStorage: [createWebStorageEntry()] };\n }\n\n if (entry === 'header') {\n return { headers: [createHeaderEntry()] };\n }\n }\n\n // Handle object entries\n if (typeof entry === 'object' && entry !== null) {\n const typedEntry = entry as CookiesAttributes | StorageAttributes;\n\n if (isCookieEntry(typedEntry)) {\n return { cookies: [createCookieEntry(typedEntry as CookiesAttributes)] };\n }\n\n // Handle localStorage\n if ('type' in typedEntry && typedEntry.type === 'localStorage') {\n const { name, ...rest } = typedEntry as StorageAttributes;\n return { localStorage: [createWebStorageEntry({ name, ...rest })] };\n }\n\n // Handle sessionStorage\n if ('type' in typedEntry && typedEntry.type === 'sessionStorage') {\n const { name, ...rest } = typedEntry as StorageAttributes;\n return { sessionStorage: [createWebStorageEntry({ name, ...rest })] };\n }\n\n // Handle header\n if ('type' in typedEntry && typedEntry.type === 'header') {\n const { name, ...rest } = typedEntry as StorageAttributes;\n return { headers: [createHeaderEntry({ name, ...rest })] };\n }\n\n // Default to localStorage for ambiguous objects\n const { name, ...rest } = typedEntry as Omit<StorageAttributes, 'type'>;\n return { localStorage: [createWebStorageEntry({ name, ...rest })] };\n }\n\n return { cookies: [], localStorage: [], sessionStorage: [], headers: [] };\n};\n\n/**\n * Merges multiple partial storage attributes into a single result\n */\nconst mergeStorageAttributes = (\n accumulated: ProcessedStorageAttributes,\n partial: Partial<ProcessedStorageAttributes>\n): ProcessedStorageAttributes => {\n return {\n cookies: [...accumulated.cookies, ...(partial.cookies ?? [])],\n localStorage: [\n ...accumulated.localStorage,\n ...(partial.localStorage ?? []),\n ],\n sessionStorage: [\n ...accumulated.sessionStorage,\n ...(partial.sessionStorage ?? []),\n ],\n headers: [...accumulated.headers, ...(partial.headers ?? [])],\n };\n};\n\n/**\n * Extracts and normalizes storage configuration into separate arrays for each storage type\n *\n * @param options - The storage configuration from IntlayerConfig\n * @returns An object containing arrays for cookies, localStorage, and sessionStorage\n */\nexport const getStorageAttributes = (\n options: IntlayerConfig['routing']['storage']\n): ProcessedStorageAttributes => {\n const emptyResult: ProcessedStorageAttributes = {\n cookies: [],\n localStorage: [],\n sessionStorage: [],\n headers: [],\n };\n\n // Storage is disabled\n if (options === false || options === undefined) {\n return emptyResult;\n }\n\n // Handle array of storage entries\n if (Array.isArray(options)) {\n return options.reduce<ProcessedStorageAttributes>((acc, entry) => {\n const partial = processStorageEntry(entry);\n return mergeStorageAttributes(acc, partial);\n }, emptyResult);\n }\n\n // Handle single storage entry\n const partial = processStorageEntry(options);\n\n return mergeStorageAttributes(emptyResult, partial);\n};\n"],"mappings":";;;;;;;AA8CA,MAAM,qBACJ,YACgB;CAChB,MAAM,EAAE,MAAM,MAAM,SAAS,QAAQ,QAAQ,UAAU,aACrD,WAAW,EAAE;AAEf,QAAO;EACL,MAAM,QAAQA,
|
|
1
|
+
{"version":3,"file":"getStorageAttributes.cjs","names":["DefaultValues","rest","emptyResult: ProcessedStorageAttributes"],"sources":["../../src/getStorageAttributes.ts"],"sourcesContent":["import { DefaultValues } from '@intlayer/config/client';\nimport type {\n CookiesAttributes,\n IntlayerConfig,\n StorageAttributes,\n} from '@intlayer/types';\n\n// ============================================================================\n// Types\n// ============================================================================\n\ntype CookieEntry = {\n name: string;\n attributes: Omit<CookiesAttributes, 'type' | 'name'>;\n};\n\ntype WebStorageEntry = {\n name: string;\n};\n\ntype HeaderEntry = {\n name: string;\n};\n\nexport type ProcessedStorageAttributes = {\n cookies: CookieEntry[];\n localStorage: WebStorageEntry[];\n sessionStorage: WebStorageEntry[];\n headers: HeaderEntry[];\n};\n\ntype StorageEntry =\n | 'cookie'\n | 'localStorage'\n | 'sessionStorage'\n | 'header'\n | CookiesAttributes\n | StorageAttributes;\n\n// ============================================================================\n// Helper Functions\n// ============================================================================\n\n/**\n * Creates a cookie entry with default values for missing attributes\n */\nconst createCookieEntry = (\n options?: Partial<CookiesAttributes>\n): CookieEntry => {\n const { name, path, expires, domain, secure, sameSite, httpOnly } =\n options ?? {};\n\n return {\n name: name ?? DefaultValues.Routing.COOKIE_NAME,\n attributes: {\n path,\n expires,\n domain,\n secure,\n sameSite,\n httpOnly,\n },\n };\n};\n\n/**\n * Creates a web storage entry (localStorage or sessionStorage) with default name\n */\nconst createWebStorageEntry = (\n options?: Partial<StorageAttributes>\n): WebStorageEntry => {\n const { name } = options ?? {};\n\n return {\n name: name ?? DefaultValues.Routing.LOCALE_STORAGE_NAME,\n };\n};\n\n/**\n * Creates a header entry with default name\n */\nconst createHeaderEntry = (\n options?: Partial<StorageAttributes>\n): HeaderEntry => {\n const { name } = options ?? {};\n\n return {\n name: name ?? DefaultValues.Routing.HEADER_NAME,\n };\n};\n\n/**\n * Determines if a storage entry is a cookie based on its properties\n */\nconst isCookieEntry = (entry: any): boolean => {\n return (\n entry.type === 'cookie' ||\n 'sameSite' in entry ||\n 'httpOnly' in entry ||\n 'secure' in entry\n );\n};\n\n/**\n * Determines the storage type from a string literal\n */\nconst isStorageType = (\n value: string\n): value is 'cookie' | 'localStorage' | 'sessionStorage' | 'header' => {\n return (\n value === 'cookie' ||\n value === 'localStorage' ||\n value === 'sessionStorage' ||\n value === 'header'\n );\n};\n\n// ============================================================================\n// Main Function\n// ============================================================================\n\n/**\n * Processes a single storage entry and returns the appropriate storage attributes\n */\nconst processStorageEntry = (\n entry: StorageEntry\n): Partial<ProcessedStorageAttributes> => {\n // Handle string literals\n if (typeof entry === 'string') {\n if (!isStorageType(entry)) {\n return { cookies: [], localStorage: [], sessionStorage: [], headers: [] };\n }\n\n if (entry === 'cookie') {\n return { cookies: [createCookieEntry()] };\n }\n\n if (entry === 'localStorage') {\n return { localStorage: [createWebStorageEntry()] };\n }\n\n if (entry === 'sessionStorage') {\n return { sessionStorage: [createWebStorageEntry()] };\n }\n\n if (entry === 'header') {\n return { headers: [createHeaderEntry()] };\n }\n }\n\n // Handle object entries\n if (typeof entry === 'object' && entry !== null) {\n const typedEntry = entry as CookiesAttributes | StorageAttributes;\n\n if (isCookieEntry(typedEntry)) {\n return { cookies: [createCookieEntry(typedEntry as CookiesAttributes)] };\n }\n\n // Handle localStorage\n if ('type' in typedEntry && typedEntry.type === 'localStorage') {\n const { name, ...rest } = typedEntry as StorageAttributes;\n return { localStorage: [createWebStorageEntry({ name, ...rest })] };\n }\n\n // Handle sessionStorage\n if ('type' in typedEntry && typedEntry.type === 'sessionStorage') {\n const { name, ...rest } = typedEntry as StorageAttributes;\n return { sessionStorage: [createWebStorageEntry({ name, ...rest })] };\n }\n\n // Handle header\n if ('type' in typedEntry && typedEntry.type === 'header') {\n const { name, ...rest } = typedEntry as StorageAttributes;\n return { headers: [createHeaderEntry({ name, ...rest })] };\n }\n\n // Default to localStorage for ambiguous objects\n const { name, ...rest } = typedEntry as Omit<StorageAttributes, 'type'>;\n return { localStorage: [createWebStorageEntry({ name, ...rest })] };\n }\n\n return { cookies: [], localStorage: [], sessionStorage: [], headers: [] };\n};\n\n/**\n * Merges multiple partial storage attributes into a single result\n */\nconst mergeStorageAttributes = (\n accumulated: ProcessedStorageAttributes,\n partial: Partial<ProcessedStorageAttributes>\n): ProcessedStorageAttributes => {\n return {\n cookies: [...accumulated.cookies, ...(partial.cookies ?? [])],\n localStorage: [\n ...accumulated.localStorage,\n ...(partial.localStorage ?? []),\n ],\n sessionStorage: [\n ...accumulated.sessionStorage,\n ...(partial.sessionStorage ?? []),\n ],\n headers: [...accumulated.headers, ...(partial.headers ?? [])],\n };\n};\n\n/**\n * Extracts and normalizes storage configuration into separate arrays for each storage type\n *\n * @param options - The storage configuration from IntlayerConfig\n * @returns An object containing arrays for cookies, localStorage, and sessionStorage\n */\nexport const getStorageAttributes = (\n options: IntlayerConfig['routing']['storage']\n): ProcessedStorageAttributes => {\n const emptyResult: ProcessedStorageAttributes = {\n cookies: [],\n localStorage: [],\n sessionStorage: [],\n headers: [],\n };\n\n // Storage is disabled\n if (options === false || options === undefined) {\n return emptyResult;\n }\n\n // Handle array of storage entries\n if (Array.isArray(options)) {\n return options.reduce<ProcessedStorageAttributes>((acc, entry) => {\n const partial = processStorageEntry(entry);\n return mergeStorageAttributes(acc, partial);\n }, emptyResult);\n }\n\n // Handle single storage entry\n const partial = processStorageEntry(options);\n\n return mergeStorageAttributes(emptyResult, partial);\n};\n"],"mappings":"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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let
|
|
2
|
+
let _intlayer_types = require("@intlayer/types");
|
|
3
3
|
|
|
4
4
|
//#region src/interpreter/getContent/deepTransform.ts
|
|
5
5
|
/**
|
|
@@ -15,7 +15,7 @@ const deepTransformNode = (node, props) => {
|
|
|
15
15
|
...props,
|
|
16
16
|
children: child,
|
|
17
17
|
keyPath: [...props.keyPath, {
|
|
18
|
-
type:
|
|
18
|
+
type: _intlayer_types.NodeType.Array,
|
|
19
19
|
key: index
|
|
20
20
|
}]
|
|
21
21
|
});
|
|
@@ -26,7 +26,7 @@ const deepTransformNode = (node, props) => {
|
|
|
26
26
|
...props,
|
|
27
27
|
children: node[key],
|
|
28
28
|
keyPath: [...props.keyPath, {
|
|
29
|
-
type:
|
|
29
|
+
type: _intlayer_types.NodeType.Object,
|
|
30
30
|
key
|
|
31
31
|
}]
|
|
32
32
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deepTransform.cjs","names":["node","props","NodeType","result: Record<string, any>"],"sources":["../../../../src/interpreter/getContent/deepTransform.ts"],"sourcesContent":["import { type KeyPath, NodeType } from '@intlayer/types';\nimport type { NodeProps } from './plugins';\n\n/**\n * Recursively traverses a node (object/array/primitive).\n * Applies the *first* plugin that can transform a node, then stops descending further.\n * If no plugin transforms it, it recurses into its children.\n */\nexport const deepTransformNode = (node: any, props: NodeProps): any => {\n // Otherwise, if it's an object, check if any plugin can handle it:\n for (const plugin of props.plugins ?? []) {\n if (plugin.canHandle(node)) {\n // Return the transformed node => do NOT recurse further\n return plugin.transform(node, props, (node: any, props: any) =>\n deepTransformNode(node, props)\n );\n }\n }\n\n // If it's null/undefined or not an object, just return it directly:\n if (node === null || typeof node !== 'object') {\n return node;\n }\n\n // If it's an array, transform each element:\n if (Array.isArray(node)) {\n return node.map((child, index) => {\n const childProps = {\n ...props,\n children: child,\n keyPath: [\n ...props.keyPath,\n { type: NodeType.Array, key: index } as KeyPath,\n ],\n };\n return deepTransformNode(child, childProps);\n });\n }\n\n // If no plugin transforms it, we keep traversing its properties.\n const result: Record<string, any> = {};\n for (const key in node) {\n const childProps = {\n ...props,\n children: node[key],\n keyPath: [...props.keyPath, { type: NodeType.Object, key } as KeyPath],\n };\n result[key] = deepTransformNode(node[key], childProps);\n }\n\n return result;\n};\n"],"mappings":";;;;;;;;;AAQA,MAAa,qBAAqB,MAAW,UAA0B;AAErE,MAAK,MAAM,UAAU,MAAM,WAAW,EAAE,CACtC,KAAI,OAAO,UAAU,KAAK,CAExB,QAAO,OAAO,UAAU,MAAM,QAAQ,QAAW,YAC/C,kBAAkBA,QAAMC,QAAM,CAC/B;AAKL,KAAI,SAAS,QAAQ,OAAO,SAAS,SACnC,QAAO;AAIT,KAAI,MAAM,QAAQ,KAAK,CACrB,QAAO,KAAK,KAAK,OAAO,UAAU;AAShC,SAAO,kBAAkB,OARN;GACjB,GAAG;GACH,UAAU;GACV,SAAS,CACP,GAAG,MAAM,SACT;IAAE,MAAMC,
|
|
1
|
+
{"version":3,"file":"deepTransform.cjs","names":["node","props","NodeType","result: Record<string, any>"],"sources":["../../../../src/interpreter/getContent/deepTransform.ts"],"sourcesContent":["import { type KeyPath, NodeType } from '@intlayer/types';\nimport type { NodeProps } from './plugins';\n\n/**\n * Recursively traverses a node (object/array/primitive).\n * Applies the *first* plugin that can transform a node, then stops descending further.\n * If no plugin transforms it, it recurses into its children.\n */\nexport const deepTransformNode = (node: any, props: NodeProps): any => {\n // Otherwise, if it's an object, check if any plugin can handle it:\n for (const plugin of props.plugins ?? []) {\n if (plugin.canHandle(node)) {\n // Return the transformed node => do NOT recurse further\n return plugin.transform(node, props, (node: any, props: any) =>\n deepTransformNode(node, props)\n );\n }\n }\n\n // If it's null/undefined or not an object, just return it directly:\n if (node === null || typeof node !== 'object') {\n return node;\n }\n\n // If it's an array, transform each element:\n if (Array.isArray(node)) {\n return node.map((child, index) => {\n const childProps = {\n ...props,\n children: child,\n keyPath: [\n ...props.keyPath,\n { type: NodeType.Array, key: index } as KeyPath,\n ],\n };\n return deepTransformNode(child, childProps);\n });\n }\n\n // If no plugin transforms it, we keep traversing its properties.\n const result: Record<string, any> = {};\n for (const key in node) {\n const childProps = {\n ...props,\n children: node[key],\n keyPath: [...props.keyPath, { type: NodeType.Object, key } as KeyPath],\n };\n result[key] = deepTransformNode(node[key], childProps);\n }\n\n return result;\n};\n"],"mappings":";;;;;;;;;AAQA,MAAa,qBAAqB,MAAW,UAA0B;AAErE,MAAK,MAAM,UAAU,MAAM,WAAW,EAAE,CACtC,KAAI,OAAO,UAAU,KAAK,CAExB,QAAO,OAAO,UAAU,MAAM,QAAQ,QAAW,YAC/C,kBAAkBA,QAAMC,QAAM,CAC/B;AAKL,KAAI,SAAS,QAAQ,OAAO,SAAS,SACnC,QAAO;AAIT,KAAI,MAAM,QAAQ,KAAK,CACrB,QAAO,KAAK,KAAK,OAAO,UAAU;AAShC,SAAO,kBAAkB,OARN;GACjB,GAAG;GACH,UAAU;GACV,SAAS,CACP,GAAG,MAAM,SACT;IAAE,MAAMC,yBAAS;IAAO,KAAK;IAAO,CACrC;GACF,CAC0C;GAC3C;CAIJ,MAAMC,SAA8B,EAAE;AACtC,MAAK,MAAM,OAAO,MAAM;EACtB,MAAM,aAAa;GACjB,GAAG;GACH,UAAU,KAAK;GACf,SAAS,CAAC,GAAG,MAAM,SAAS;IAAE,MAAMD,yBAAS;IAAQ;IAAK,CAAY;GACvE;AACD,SAAO,OAAO,kBAAkB,KAAK,MAAM,WAAW;;AAGxD,QAAO"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_interpreter_getContent_deepTransform = require('./deepTransform.cjs');
|
|
3
3
|
const require_interpreter_getContent_plugins = require('./plugins.cjs');
|
|
4
|
-
let
|
|
5
|
-
|
|
4
|
+
let _intlayer_config_built = require("@intlayer/config/built");
|
|
5
|
+
_intlayer_config_built = require_rolldown_runtime.__toESM(_intlayer_config_built);
|
|
6
6
|
|
|
7
7
|
//#region src/interpreter/getContent/getContent.ts
|
|
8
8
|
/**
|
|
@@ -12,7 +12,7 @@ __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_bui
|
|
|
12
12
|
* @param locale The locale to use if your transformers need it (e.g. for translations).
|
|
13
13
|
*/
|
|
14
14
|
const getContent = (node, nodeProps, locale) => {
|
|
15
|
-
const defaultLocale =
|
|
15
|
+
const defaultLocale = _intlayer_config_built.default?.internationalization?.defaultLocale;
|
|
16
16
|
const plugins = [
|
|
17
17
|
require_interpreter_getContent_plugins.insertionPlugin,
|
|
18
18
|
require_interpreter_getContent_plugins.translationPlugin(locale ?? defaultLocale, defaultLocale),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getContent.cjs","names":["configuration","plugins: Plugins[]","insertionPlugin","translationPlugin","enumerationPlugin","conditionPlugin","nestedPlugin","filePlugin","deepTransformNode"],"sources":["../../../../src/interpreter/getContent/getContent.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { getAppLogger } from '@intlayer/config/client';\nimport type {\n ContentNode,\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types';\nimport { deepTransformNode } from './deepTransform';\nimport {\n conditionPlugin,\n type DeepTransformContent,\n enumerationPlugin,\n filePlugin,\n type IInterpreterPluginState,\n insertionPlugin,\n type NodeProps,\n nestedPlugin,\n type Plugins,\n translationPlugin,\n} from './plugins';\n\n/**\n * Transforms a node in a single pass, applying each plugin as needed.\n *\n * @param node The node to transform.\n * @param locale The locale to use if your transformers need it (e.g. for translations).\n */\nexport const getContent = <\n T extends ContentNode,\n L extends LocalesValues = DeclaredLocales,\n>(\n node: T,\n nodeProps: NodeProps,\n locale?: L\n) => {\n const defaultLocale = configuration?.internationalization?.defaultLocale;\n\n const plugins: Plugins[] = [\n insertionPlugin,\n translationPlugin(locale ?? defaultLocale, defaultLocale),\n enumerationPlugin,\n conditionPlugin,\n nestedPlugin,\n filePlugin,\n ...(nodeProps.plugins ?? []),\n ];\n\n return deepTransformNode(node, {\n ...nodeProps,\n plugins,\n }) as DeepTransformContent<T, IInterpreterPluginState, L>;\n};\n"],"mappings":";;;;;;;;;;;;;AA2BA,MAAa,cAIX,MACA,WACA,WACG;CACH,MAAM,gBAAgBA,
|
|
1
|
+
{"version":3,"file":"getContent.cjs","names":["configuration","plugins: Plugins[]","insertionPlugin","translationPlugin","enumerationPlugin","conditionPlugin","nestedPlugin","filePlugin","deepTransformNode"],"sources":["../../../../src/interpreter/getContent/getContent.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { getAppLogger } from '@intlayer/config/client';\nimport type {\n ContentNode,\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types';\nimport { deepTransformNode } from './deepTransform';\nimport {\n conditionPlugin,\n type DeepTransformContent,\n enumerationPlugin,\n filePlugin,\n type IInterpreterPluginState,\n insertionPlugin,\n type NodeProps,\n nestedPlugin,\n type Plugins,\n translationPlugin,\n} from './plugins';\n\n/**\n * Transforms a node in a single pass, applying each plugin as needed.\n *\n * @param node The node to transform.\n * @param locale The locale to use if your transformers need it (e.g. for translations).\n */\nexport const getContent = <\n T extends ContentNode,\n L extends LocalesValues = DeclaredLocales,\n>(\n node: T,\n nodeProps: NodeProps,\n locale?: L\n) => {\n const defaultLocale = configuration?.internationalization?.defaultLocale;\n\n const plugins: Plugins[] = [\n insertionPlugin,\n translationPlugin(locale ?? defaultLocale, defaultLocale),\n enumerationPlugin,\n conditionPlugin,\n nestedPlugin,\n filePlugin,\n ...(nodeProps.plugins ?? []),\n ];\n\n return deepTransformNode(node, {\n ...nodeProps,\n plugins,\n }) as DeepTransformContent<T, IInterpreterPluginState, L>;\n};\n"],"mappings":";;;;;;;;;;;;;AA2BA,MAAa,cAIX,MACA,WACA,WACG;CACH,MAAM,gBAAgBA,gCAAe,sBAAsB;CAE3D,MAAMC,UAAqB;EACzBC;EACAC,yDAAkB,UAAU,eAAe,cAAc;EACzDC;EACAC;EACAC;EACAC;EACA,GAAI,UAAU,WAAW,EAAE;EAC5B;AAED,QAAOC,+DAAkB,MAAM;EAC7B,GAAG;EACH;EACD,CAAC"}
|
|
@@ -5,21 +5,21 @@ const require_interpreter_getGender = require('../getGender.cjs');
|
|
|
5
5
|
const require_interpreter_getInsertion = require('../getInsertion.cjs');
|
|
6
6
|
const require_interpreter_getNesting = require('../getNesting.cjs');
|
|
7
7
|
const require_interpreter_getTranslation = require('../getTranslation.cjs');
|
|
8
|
-
let
|
|
8
|
+
let _intlayer_types = require("@intlayer/types");
|
|
9
9
|
|
|
10
10
|
//#region src/interpreter/getContent/plugins.ts
|
|
11
11
|
/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
|
|
12
12
|
const translationPlugin = (locale, fallback, onContentNotFound) => ({
|
|
13
13
|
id: "translation-plugin",
|
|
14
|
-
canHandle: (node) => typeof node === "object" && node?.nodeType ===
|
|
14
|
+
canHandle: (node) => typeof node === "object" && node?.nodeType === _intlayer_types.NodeType.Translation,
|
|
15
15
|
transform: (node, props, deepTransformNode) => {
|
|
16
|
-
const result = structuredClone(node[
|
|
16
|
+
const result = structuredClone(node[_intlayer_types.NodeType.Translation]);
|
|
17
17
|
for (const key in result) {
|
|
18
18
|
const childProps = {
|
|
19
19
|
...props,
|
|
20
20
|
children: result[key],
|
|
21
21
|
keyPath: [...props.keyPath, {
|
|
22
|
-
type:
|
|
22
|
+
type: _intlayer_types.NodeType.Translation,
|
|
23
23
|
key
|
|
24
24
|
}]
|
|
25
25
|
};
|
|
@@ -31,16 +31,16 @@ const translationPlugin = (locale, fallback, onContentNotFound) => ({
|
|
|
31
31
|
/** Enumeration plugin. Replaces node with a function that takes quantity => string. */
|
|
32
32
|
const enumerationPlugin = {
|
|
33
33
|
id: "enumeration-plugin",
|
|
34
|
-
canHandle: (node) => typeof node === "object" && node?.nodeType ===
|
|
34
|
+
canHandle: (node) => typeof node === "object" && node?.nodeType === _intlayer_types.NodeType.Enumeration,
|
|
35
35
|
transform: (node, props, deepTransformNode) => {
|
|
36
|
-
const result = structuredClone(node[
|
|
36
|
+
const result = structuredClone(node[_intlayer_types.NodeType.Enumeration]);
|
|
37
37
|
for (const key in result) {
|
|
38
38
|
const child = result[key];
|
|
39
39
|
result[key] = deepTransformNode(child, {
|
|
40
40
|
...props,
|
|
41
41
|
children: child,
|
|
42
42
|
keyPath: [...props.keyPath, {
|
|
43
|
-
type:
|
|
43
|
+
type: _intlayer_types.NodeType.Enumeration,
|
|
44
44
|
key
|
|
45
45
|
}]
|
|
46
46
|
});
|
|
@@ -51,16 +51,16 @@ const enumerationPlugin = {
|
|
|
51
51
|
/** Condition plugin. Replaces node with a function that takes boolean => string. */
|
|
52
52
|
const conditionPlugin = {
|
|
53
53
|
id: "condition-plugin",
|
|
54
|
-
canHandle: (node) => typeof node === "object" && node?.nodeType ===
|
|
54
|
+
canHandle: (node) => typeof node === "object" && node?.nodeType === _intlayer_types.NodeType.Condition,
|
|
55
55
|
transform: (node, props, deepTransformNode) => {
|
|
56
|
-
const result = structuredClone(node[
|
|
56
|
+
const result = structuredClone(node[_intlayer_types.NodeType.Condition]);
|
|
57
57
|
for (const key in result) {
|
|
58
58
|
const child = result[key];
|
|
59
59
|
result[key] = deepTransformNode(child, {
|
|
60
60
|
...props,
|
|
61
61
|
children: child,
|
|
62
62
|
keyPath: [...props.keyPath, {
|
|
63
|
-
type:
|
|
63
|
+
type: _intlayer_types.NodeType.Condition,
|
|
64
64
|
key
|
|
65
65
|
}]
|
|
66
66
|
});
|
|
@@ -71,16 +71,16 @@ const conditionPlugin = {
|
|
|
71
71
|
/** Gender plugin. Replaces node with a function that takes gender => string. */
|
|
72
72
|
const genderPlugin = {
|
|
73
73
|
id: "gender-plugin",
|
|
74
|
-
canHandle: (node) => typeof node === "object" && node?.nodeType ===
|
|
74
|
+
canHandle: (node) => typeof node === "object" && node?.nodeType === _intlayer_types.NodeType.Gender,
|
|
75
75
|
transform: (node, props, deepTransformNode) => {
|
|
76
|
-
const result = structuredClone(node[
|
|
76
|
+
const result = structuredClone(node[_intlayer_types.NodeType.Gender]);
|
|
77
77
|
for (const key in result) {
|
|
78
78
|
const child = result[key];
|
|
79
79
|
result[key] = deepTransformNode(child, {
|
|
80
80
|
...props,
|
|
81
81
|
children: child,
|
|
82
82
|
keyPath: [...props.keyPath, {
|
|
83
|
-
type:
|
|
83
|
+
type: _intlayer_types.NodeType.Gender,
|
|
84
84
|
key
|
|
85
85
|
}]
|
|
86
86
|
});
|
|
@@ -90,10 +90,10 @@ const genderPlugin = {
|
|
|
90
90
|
};
|
|
91
91
|
const insertionPlugin = {
|
|
92
92
|
id: "insertion-plugin",
|
|
93
|
-
canHandle: (node) => typeof node === "object" && node?.nodeType ===
|
|
93
|
+
canHandle: (node) => typeof node === "object" && node?.nodeType === _intlayer_types.NodeType.Insertion,
|
|
94
94
|
transform: (node, props, deepTransformNode) => {
|
|
95
|
-
const newKeyPath = [...props.keyPath, { type:
|
|
96
|
-
const children = node[
|
|
95
|
+
const newKeyPath = [...props.keyPath, { type: _intlayer_types.NodeType.Insertion }];
|
|
96
|
+
const children = node[_intlayer_types.NodeType.Insertion];
|
|
97
97
|
/** Insertion string plugin. Replaces string node with a component that render the insertion. */
|
|
98
98
|
const insertionStringPlugin = {
|
|
99
99
|
id: "insertion-string-plugin",
|
|
@@ -125,13 +125,13 @@ const insertionPlugin = {
|
|
|
125
125
|
/** Nested plugin. Replaces node with the result of `getNesting`. */
|
|
126
126
|
const nestedPlugin = {
|
|
127
127
|
id: "nested-plugin",
|
|
128
|
-
canHandle: (node) => typeof node === "object" && node?.nodeType ===
|
|
128
|
+
canHandle: (node) => typeof node === "object" && node?.nodeType === _intlayer_types.NodeType.Nested,
|
|
129
129
|
transform: (node, props) => require_interpreter_getNesting.getNesting(node.nested.dictionaryKey, node.nested.path, props)
|
|
130
130
|
};
|
|
131
131
|
/** File plugin. Replaces node with the result of `getNesting`. */
|
|
132
132
|
const filePlugin = {
|
|
133
133
|
id: "file-plugin",
|
|
134
|
-
canHandle: (node) => typeof node === "object" && node?.nodeType ===
|
|
134
|
+
canHandle: (node) => typeof node === "object" && node?.nodeType === _intlayer_types.NodeType.File,
|
|
135
135
|
transform: (node, props, deepTransform) => deepTransform(node.content, {
|
|
136
136
|
...props,
|
|
137
137
|
children: node.content
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.cjs","names":["NodeType","getTranslation","enumerationPlugin: Plugins","getEnumeration","conditionPlugin: Plugins","getCondition","genderPlugin: Plugins","getGender","insertionPlugin: Plugins","newKeyPath: KeyPath[]","insertionStringPlugin: Plugins","node","deepTransformNode","children","getInsertion","nestedPlugin: Plugins","getNesting","filePlugin: Plugins"],"sources":["../../../../src/interpreter/getContent/plugins.ts"],"sourcesContent":["import {\n type DeclaredLocales,\n type DictionaryKeys,\n type KeyPath,\n type Locale,\n type LocalesValues,\n NodeType,\n} from '@intlayer/types';\nimport type {\n ConditionContent,\n EnumerationContent,\n FileContent,\n Gender,\n GenderContent,\n InsertionContent,\n NestedContent,\n TranslationContent,\n} from '../../transpiler';\nimport { getCondition } from '../getCondition';\nimport { getEnumeration } from '../getEnumeration';\nimport { getGender } from '../getGender';\nimport { getInsertion } from '../getInsertion';\nimport { type GetNestingResult, getNesting } from '../getNesting';\nimport { getTranslation } from '../getTranslation';\n\n/** ---------------------------------------------\n * PLUGIN DEFINITION\n * --------------------------------------------- */\n\n/**\n * A plugin/transformer that can optionally transform a node during a single DFS pass.\n * - `canHandle` decides if the node is transformable by this plugin.\n * - `transform` returns the transformed node (and does not recurse further).\n *\n * > `transformFn` is a function that can be used to deeply transform inside the plugin.\n */\nexport type Plugins = {\n id: string;\n canHandle: (node: any) => boolean;\n transform: (\n node: any,\n props: NodeProps,\n transformFn: (node: any, props: NodeProps) => any\n ) => any;\n};\n\n/** ---------------------------------------------\n * TRANSLATION PLUGIN\n * --------------------------------------------- */\n\nexport type TranslationCond<T, S, L extends LocalesValues> = T extends {\n nodeType: NodeType | string;\n [NodeType.Translation]: infer U;\n}\n ? U extends Record<PropertyKey, unknown>\n ? L extends keyof U\n ? DeepTransformContent<U[L], S>\n : DeepTransformContent<U[keyof U], S>\n : never\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const translationPlugin = (\n locale: LocalesValues,\n fallback?: LocalesValues,\n onContentNotFound?: (\n locale: LocalesValues,\n fallback: LocalesValues,\n keyPath: KeyPath[]\n ) => void\n): Plugins => ({\n id: 'translation-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Translation,\n transform: (node: TranslationContent, props, deepTransformNode) => {\n const result = structuredClone(node[NodeType.Translation]);\n\n for (const key in result) {\n const childProps = {\n ...props,\n children: result[key as keyof typeof result],\n keyPath: [\n ...props.keyPath,\n { type: NodeType.Translation, key } as KeyPath,\n ],\n };\n result[key as keyof typeof result] = deepTransformNode(\n result[key as keyof typeof result],\n childProps\n );\n }\n\n return getTranslation(result, locale, fallback);\n },\n});\n\n/** ---------------------------------------------\n * ENUMERATION PLUGIN\n * --------------------------------------------- */\n\nexport type EnumerationCond<T, S, L> = T extends {\n nodeType: NodeType | string;\n [NodeType.Enumeration]: object;\n}\n ? (\n quantity: number\n ) => DeepTransformContent<\n T[NodeType.Enumeration][keyof T[NodeType.Enumeration]],\n S\n >\n : never;\n\n/** Enumeration plugin. Replaces node with a function that takes quantity => string. */\nexport const enumerationPlugin: Plugins = {\n id: 'enumeration-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Enumeration,\n transform: (node: EnumerationContent, props, deepTransformNode) => {\n const result = structuredClone(node[NodeType.Enumeration]);\n\n for (const key in result) {\n const child = result[key as unknown as keyof typeof result];\n const childProps = {\n ...props,\n children: child,\n keyPath: [\n ...props.keyPath,\n { type: NodeType.Enumeration, key } as KeyPath,\n ],\n };\n result[key as unknown as keyof typeof result] = deepTransformNode(\n child,\n childProps\n );\n }\n\n return (quantity: number) => getEnumeration(result, quantity);\n },\n};\n\n/** ---------------------------------------------\n * CONDITION PLUGIN\n * --------------------------------------------- */\n\nexport type ConditionCond<T, S, L> = T extends {\n nodeType: NodeType | string;\n [NodeType.Condition]: object;\n}\n ? (\n value: boolean\n ) => DeepTransformContent<\n T[NodeType.Condition][keyof T[NodeType.Condition]],\n S\n >\n : never;\n\n/** Condition plugin. Replaces node with a function that takes boolean => string. */\nexport const conditionPlugin: Plugins = {\n id: 'condition-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Condition,\n transform: (node: ConditionContent, props, deepTransformNode) => {\n const result = structuredClone(node[NodeType.Condition]);\n\n for (const key in result) {\n const child = result[key as keyof typeof result];\n const childProps = {\n ...props,\n children: child,\n keyPath: [\n ...props.keyPath,\n { type: NodeType.Condition, key } as KeyPath,\n ],\n };\n result[key as unknown as keyof typeof result] = deepTransformNode(\n child,\n childProps\n );\n }\n\n return (value: boolean) => getCondition(result, value);\n },\n};\n\n/** ---------------------------------------------\n * GENDER PLUGIN\n * --------------------------------------------- */\n\nexport type GenderCond<T, S, L> = T extends {\n nodeType: NodeType | string;\n [NodeType.Gender]: object;\n}\n ? (\n value: Gender\n ) => DeepTransformContent<T[NodeType.Gender][keyof T[NodeType.Gender]], S>\n : never;\n\n/** Gender plugin. Replaces node with a function that takes gender => string. */\nexport const genderPlugin: Plugins = {\n id: 'gender-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Gender,\n transform: (node: GenderContent, props, deepTransformNode) => {\n const result = structuredClone(node[NodeType.Gender]);\n\n for (const key in result) {\n const child = result[key as keyof typeof result];\n const childProps = {\n ...props,\n children: child,\n keyPath: [...props.keyPath, { type: NodeType.Gender, key } as KeyPath],\n };\n result[key as unknown as keyof typeof result] = deepTransformNode(\n child,\n childProps\n );\n }\n\n return (value: Gender) => getGender(result, value);\n },\n};\n\n/** ---------------------------------------------\n * INSERTION PLUGIN\n * --------------------------------------------- */\n\nexport type InsertionCond<T, S, L> = T extends {\n nodeType: NodeType | string;\n [NodeType.Insertion]: infer I;\n fields?: infer U;\n}\n ? U extends readonly string[]\n ? (data: Record<U[number], string | number>) => DeepTransformContent<I, S>\n : (data: Record<string, string | number>) => DeepTransformContent<I, S>\n : never;\n\nexport const insertionPlugin: Plugins = {\n id: 'insertion-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Insertion,\n transform: (node: InsertionContent, props, deepTransformNode) => {\n const newKeyPath: KeyPath[] = [\n ...props.keyPath,\n {\n type: NodeType.Insertion,\n },\n ];\n\n const children = node[NodeType.Insertion];\n\n /** Insertion string plugin. Replaces string node with a component that render the insertion. */\n const insertionStringPlugin: Plugins = {\n id: 'insertion-string-plugin',\n canHandle: (node) => typeof node === 'string',\n transform: (node: string, subProps, deepTransformNode) => {\n const transformedResult = deepTransformNode(node, {\n ...subProps,\n children: node,\n plugins: [\n ...(props.plugins ?? ([] as Plugins[])).filter(\n (plugin) => plugin.id !== 'intlayer-node-plugin'\n ),\n ],\n });\n\n return (\n values: {\n [K in InsertionContent['fields'][number]]: string | number;\n }\n ) => {\n const children = getInsertion(transformedResult, values);\n\n return deepTransformNode(children, {\n ...subProps,\n plugins: props.plugins,\n children,\n });\n };\n },\n };\n\n return deepTransformNode(children, {\n ...props,\n children,\n keyPath: newKeyPath,\n plugins: [insertionStringPlugin, ...(props.plugins ?? [])],\n });\n },\n};\n\n/** ---------------------------------------------\n * NESTED PLUGIN\n * --------------------------------------------- */\n\nexport type NestedCond<T, S, L> = T extends {\n nodeType: NodeType | string;\n [NodeType.Nested]: infer U;\n}\n ? U extends {\n dictionaryKey: infer K extends DictionaryKeys;\n path?: infer P;\n }\n ? GetNestingResult<K, P, S>\n : never\n : never;\n\n/** Nested plugin. Replaces node with the result of `getNesting`. */\nexport const nestedPlugin: Plugins = {\n id: 'nested-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Nested,\n transform: (node: NestedContent, props) =>\n getNesting(node.nested.dictionaryKey, node.nested.path, props),\n};\n\n// /** ---------------------------------------------\n// * FILE PLUGIN\n// * --------------------------------------------- */\n\nexport type FileCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeType.File]: string;\n content?: string;\n}\n ? string\n : never;\n\n/** File plugin. Replaces node with the result of `getNesting`. */\nexport const filePlugin: Plugins = {\n id: 'file-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.File,\n transform: (node: FileContent, props, deepTransform) =>\n deepTransform(node.content, {\n ...props,\n children: node.content,\n }),\n};\n\n/**\n * PLUGIN RESULT\n */\n\n/**\n * Interface that defines the properties of a node.\n * This interface can be augmented in other packages, such as `react-intlayer`.\n */\nexport interface NodeProps {\n dictionaryKey: string;\n keyPath: KeyPath[];\n plugins?: Plugins[];\n locale?: Locale;\n dictionaryPath?: string;\n children?: any;\n}\n\n/**\n * Interface that defines the plugins that can be used to transform a node.\n * This interface can be augmented in other packages, such as `react-intlayer`.\n */\nexport interface IInterpreterPlugin<T, S, L extends LocalesValues> {\n translation: TranslationCond<T, S, L>;\n insertion: InsertionCond<T, S, L>;\n enumeration: EnumerationCond<T, S, L>;\n condition: ConditionCond<T, S, L>;\n nested: NestedCond<T, S, L>;\n // file: FileCond<T>;\n}\n\n/**\n * Allow to avoid overwriting import from `intlayer` package when `IInterpreterPlugin<T>` interface is augmented in another package, such as `react-intlayer`.\n */\nexport type IInterpreterPluginState = {\n translation: true;\n enumeration: true;\n condition: true;\n insertion: true;\n nested: true;\n // file: true;\n};\n\n/**\n * Utility type to check if a plugin can be applied to a node.\n */\ntype CheckApplyPlugin<\n T,\n K extends keyof IInterpreterPlugin<T, S, L>,\n S,\n L extends LocalesValues = DeclaredLocales,\n> = K extends keyof S // Test if the key is a key of S.\n ? // Test if the key of S is true. Then the plugin can be applied.\n S[K] extends true\n ? // Test if the key of S exist\n IInterpreterPlugin<T, S, L>[K] extends never\n ? never\n : // Test if the plugin condition is true (if it's not, the plugin is skipped for this node)\n IInterpreterPlugin<T, S, L>[K]\n : never\n : never;\n\n/**\n * Traverse recursively through an object or array, applying each plugin as needed.\n */\ntype Traverse<\n T,\n S,\n L extends LocalesValues = DeclaredLocales,\n> = T extends ReadonlyArray<infer U> // Turn any read-only array into a plain mutable array\n ? Array<DeepTransformContent<U, S, L>>\n : T extends object\n ? { [K in keyof T]: DeepTransformContent<T[K], S, L> }\n : T;\n\nexport type IsAny<T> = 0 extends 1 & T ? true : false;\n\n/**\n * Traverse recursively through an object or array, applying each plugin as needed.\n */\nexport type DeepTransformContent<\n T,\n S = IInterpreterPluginState,\n L extends LocalesValues = DeclaredLocales,\n> = IsAny<T> extends true\n ? T\n : CheckApplyPlugin<T, keyof IInterpreterPlugin<T, S, L>, S> extends never // Check if there is a plugin for T:\n ? // No plugin was found, so try to transform T recursively:\n Traverse<T, S, L>\n : // A plugin was found – use the plugin’s transformation.\n IInterpreterPlugin<T, S, L>[keyof IInterpreterPlugin<T, S, L>];\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"plugins.cjs","names":["NodeType","getTranslation","enumerationPlugin: Plugins","getEnumeration","conditionPlugin: Plugins","getCondition","genderPlugin: Plugins","getGender","insertionPlugin: Plugins","newKeyPath: KeyPath[]","insertionStringPlugin: Plugins","node","deepTransformNode","children","getInsertion","nestedPlugin: Plugins","getNesting","filePlugin: Plugins"],"sources":["../../../../src/interpreter/getContent/plugins.ts"],"sourcesContent":["import {\n type DeclaredLocales,\n type DictionaryKeys,\n type KeyPath,\n type Locale,\n type LocalesValues,\n NodeType,\n} from '@intlayer/types';\nimport type {\n ConditionContent,\n EnumerationContent,\n FileContent,\n Gender,\n GenderContent,\n InsertionContent,\n NestedContent,\n TranslationContent,\n} from '../../transpiler';\nimport { getCondition } from '../getCondition';\nimport { getEnumeration } from '../getEnumeration';\nimport { getGender } from '../getGender';\nimport { getInsertion } from '../getInsertion';\nimport { type GetNestingResult, getNesting } from '../getNesting';\nimport { getTranslation } from '../getTranslation';\n\n/** ---------------------------------------------\n * PLUGIN DEFINITION\n * --------------------------------------------- */\n\n/**\n * A plugin/transformer that can optionally transform a node during a single DFS pass.\n * - `canHandle` decides if the node is transformable by this plugin.\n * - `transform` returns the transformed node (and does not recurse further).\n *\n * > `transformFn` is a function that can be used to deeply transform inside the plugin.\n */\nexport type Plugins = {\n id: string;\n canHandle: (node: any) => boolean;\n transform: (\n node: any,\n props: NodeProps,\n transformFn: (node: any, props: NodeProps) => any\n ) => any;\n};\n\n/** ---------------------------------------------\n * TRANSLATION PLUGIN\n * --------------------------------------------- */\n\nexport type TranslationCond<T, S, L extends LocalesValues> = T extends {\n nodeType: NodeType | string;\n [NodeType.Translation]: infer U;\n}\n ? U extends Record<PropertyKey, unknown>\n ? L extends keyof U\n ? DeepTransformContent<U[L], S>\n : DeepTransformContent<U[keyof U], S>\n : never\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const translationPlugin = (\n locale: LocalesValues,\n fallback?: LocalesValues,\n onContentNotFound?: (\n locale: LocalesValues,\n fallback: LocalesValues,\n keyPath: KeyPath[]\n ) => void\n): Plugins => ({\n id: 'translation-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Translation,\n transform: (node: TranslationContent, props, deepTransformNode) => {\n const result = structuredClone(node[NodeType.Translation]);\n\n for (const key in result) {\n const childProps = {\n ...props,\n children: result[key as keyof typeof result],\n keyPath: [\n ...props.keyPath,\n { type: NodeType.Translation, key } as KeyPath,\n ],\n };\n result[key as keyof typeof result] = deepTransformNode(\n result[key as keyof typeof result],\n childProps\n );\n }\n\n return getTranslation(result, locale, fallback);\n },\n});\n\n/** ---------------------------------------------\n * ENUMERATION PLUGIN\n * --------------------------------------------- */\n\nexport type EnumerationCond<T, S, L> = T extends {\n nodeType: NodeType | string;\n [NodeType.Enumeration]: object;\n}\n ? (\n quantity: number\n ) => DeepTransformContent<\n T[NodeType.Enumeration][keyof T[NodeType.Enumeration]],\n S\n >\n : never;\n\n/** Enumeration plugin. Replaces node with a function that takes quantity => string. */\nexport const enumerationPlugin: Plugins = {\n id: 'enumeration-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Enumeration,\n transform: (node: EnumerationContent, props, deepTransformNode) => {\n const result = structuredClone(node[NodeType.Enumeration]);\n\n for (const key in result) {\n const child = result[key as unknown as keyof typeof result];\n const childProps = {\n ...props,\n children: child,\n keyPath: [\n ...props.keyPath,\n { type: NodeType.Enumeration, key } as KeyPath,\n ],\n };\n result[key as unknown as keyof typeof result] = deepTransformNode(\n child,\n childProps\n );\n }\n\n return (quantity: number) => getEnumeration(result, quantity);\n },\n};\n\n/** ---------------------------------------------\n * CONDITION PLUGIN\n * --------------------------------------------- */\n\nexport type ConditionCond<T, S, L> = T extends {\n nodeType: NodeType | string;\n [NodeType.Condition]: object;\n}\n ? (\n value: boolean\n ) => DeepTransformContent<\n T[NodeType.Condition][keyof T[NodeType.Condition]],\n S\n >\n : never;\n\n/** Condition plugin. Replaces node with a function that takes boolean => string. */\nexport const conditionPlugin: Plugins = {\n id: 'condition-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Condition,\n transform: (node: ConditionContent, props, deepTransformNode) => {\n const result = structuredClone(node[NodeType.Condition]);\n\n for (const key in result) {\n const child = result[key as keyof typeof result];\n const childProps = {\n ...props,\n children: child,\n keyPath: [\n ...props.keyPath,\n { type: NodeType.Condition, key } as KeyPath,\n ],\n };\n result[key as unknown as keyof typeof result] = deepTransformNode(\n child,\n childProps\n );\n }\n\n return (value: boolean) => getCondition(result, value);\n },\n};\n\n/** ---------------------------------------------\n * GENDER PLUGIN\n * --------------------------------------------- */\n\nexport type GenderCond<T, S, L> = T extends {\n nodeType: NodeType | string;\n [NodeType.Gender]: object;\n}\n ? (\n value: Gender\n ) => DeepTransformContent<T[NodeType.Gender][keyof T[NodeType.Gender]], S>\n : never;\n\n/** Gender plugin. Replaces node with a function that takes gender => string. */\nexport const genderPlugin: Plugins = {\n id: 'gender-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Gender,\n transform: (node: GenderContent, props, deepTransformNode) => {\n const result = structuredClone(node[NodeType.Gender]);\n\n for (const key in result) {\n const child = result[key as keyof typeof result];\n const childProps = {\n ...props,\n children: child,\n keyPath: [...props.keyPath, { type: NodeType.Gender, key } as KeyPath],\n };\n result[key as unknown as keyof typeof result] = deepTransformNode(\n child,\n childProps\n );\n }\n\n return (value: Gender) => getGender(result, value);\n },\n};\n\n/** ---------------------------------------------\n * INSERTION PLUGIN\n * --------------------------------------------- */\n\nexport type InsertionCond<T, S, L> = T extends {\n nodeType: NodeType | string;\n [NodeType.Insertion]: infer I;\n fields?: infer U;\n}\n ? U extends readonly string[]\n ? (data: Record<U[number], string | number>) => DeepTransformContent<I, S>\n : (data: Record<string, string | number>) => DeepTransformContent<I, S>\n : never;\n\nexport const insertionPlugin: Plugins = {\n id: 'insertion-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Insertion,\n transform: (node: InsertionContent, props, deepTransformNode) => {\n const newKeyPath: KeyPath[] = [\n ...props.keyPath,\n {\n type: NodeType.Insertion,\n },\n ];\n\n const children = node[NodeType.Insertion];\n\n /** Insertion string plugin. Replaces string node with a component that render the insertion. */\n const insertionStringPlugin: Plugins = {\n id: 'insertion-string-plugin',\n canHandle: (node) => typeof node === 'string',\n transform: (node: string, subProps, deepTransformNode) => {\n const transformedResult = deepTransformNode(node, {\n ...subProps,\n children: node,\n plugins: [\n ...(props.plugins ?? ([] as Plugins[])).filter(\n (plugin) => plugin.id !== 'intlayer-node-plugin'\n ),\n ],\n });\n\n return (\n values: {\n [K in InsertionContent['fields'][number]]: string | number;\n }\n ) => {\n const children = getInsertion(transformedResult, values);\n\n return deepTransformNode(children, {\n ...subProps,\n plugins: props.plugins,\n children,\n });\n };\n },\n };\n\n return deepTransformNode(children, {\n ...props,\n children,\n keyPath: newKeyPath,\n plugins: [insertionStringPlugin, ...(props.plugins ?? [])],\n });\n },\n};\n\n/** ---------------------------------------------\n * NESTED PLUGIN\n * --------------------------------------------- */\n\nexport type NestedCond<T, S, L> = T extends {\n nodeType: NodeType | string;\n [NodeType.Nested]: infer U;\n}\n ? U extends {\n dictionaryKey: infer K extends DictionaryKeys;\n path?: infer P;\n }\n ? GetNestingResult<K, P, S>\n : never\n : never;\n\n/** Nested plugin. Replaces node with the result of `getNesting`. */\nexport const nestedPlugin: Plugins = {\n id: 'nested-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Nested,\n transform: (node: NestedContent, props) =>\n getNesting(node.nested.dictionaryKey, node.nested.path, props),\n};\n\n// /** ---------------------------------------------\n// * FILE PLUGIN\n// * --------------------------------------------- */\n\nexport type FileCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeType.File]: string;\n content?: string;\n}\n ? string\n : never;\n\n/** File plugin. Replaces node with the result of `getNesting`. */\nexport const filePlugin: Plugins = {\n id: 'file-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.File,\n transform: (node: FileContent, props, deepTransform) =>\n deepTransform(node.content, {\n ...props,\n children: node.content,\n }),\n};\n\n/**\n * PLUGIN RESULT\n */\n\n/**\n * Interface that defines the properties of a node.\n * This interface can be augmented in other packages, such as `react-intlayer`.\n */\nexport interface NodeProps {\n dictionaryKey: string;\n keyPath: KeyPath[];\n plugins?: Plugins[];\n locale?: Locale;\n dictionaryPath?: string;\n children?: any;\n}\n\n/**\n * Interface that defines the plugins that can be used to transform a node.\n * This interface can be augmented in other packages, such as `react-intlayer`.\n */\nexport interface IInterpreterPlugin<T, S, L extends LocalesValues> {\n translation: TranslationCond<T, S, L>;\n insertion: InsertionCond<T, S, L>;\n enumeration: EnumerationCond<T, S, L>;\n condition: ConditionCond<T, S, L>;\n nested: NestedCond<T, S, L>;\n // file: FileCond<T>;\n}\n\n/**\n * Allow to avoid overwriting import from `intlayer` package when `IInterpreterPlugin<T>` interface is augmented in another package, such as `react-intlayer`.\n */\nexport type IInterpreterPluginState = {\n translation: true;\n enumeration: true;\n condition: true;\n insertion: true;\n nested: true;\n // file: true;\n};\n\n/**\n * Utility type to check if a plugin can be applied to a node.\n */\ntype CheckApplyPlugin<\n T,\n K extends keyof IInterpreterPlugin<T, S, L>,\n S,\n L extends LocalesValues = DeclaredLocales,\n> = K extends keyof S // Test if the key is a key of S.\n ? // Test if the key of S is true. Then the plugin can be applied.\n S[K] extends true\n ? // Test if the key of S exist\n IInterpreterPlugin<T, S, L>[K] extends never\n ? never\n : // Test if the plugin condition is true (if it's not, the plugin is skipped for this node)\n IInterpreterPlugin<T, S, L>[K]\n : never\n : never;\n\n/**\n * Traverse recursively through an object or array, applying each plugin as needed.\n */\ntype Traverse<\n T,\n S,\n L extends LocalesValues = DeclaredLocales,\n> = T extends ReadonlyArray<infer U> // Turn any read-only array into a plain mutable array\n ? Array<DeepTransformContent<U, S, L>>\n : T extends object\n ? { [K in keyof T]: DeepTransformContent<T[K], S, L> }\n : T;\n\nexport type IsAny<T> = 0 extends 1 & T ? true : false;\n\n/**\n * Traverse recursively through an object or array, applying each plugin as needed.\n */\nexport type DeepTransformContent<\n T,\n S = IInterpreterPluginState,\n L extends LocalesValues = DeclaredLocales,\n> = IsAny<T> extends true\n ? T\n : CheckApplyPlugin<T, keyof IInterpreterPlugin<T, S, L>, S> extends never // Check if there is a plugin for T:\n ? // No plugin was found, so try to transform T recursively:\n Traverse<T, S, L>\n : // A plugin was found – use the plugin’s transformation.\n IInterpreterPlugin<T, S, L>[keyof IInterpreterPlugin<T, S, L>];\n"],"mappings":"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"}
|